Add owner-aware Stable and Preview updates with explicit consent, verified release plans, protected process handoff and bounded service recovery. Keep configuration and conversations separate from program rollback.
Include the compact About controls, Windows long-path support, native package recovery checks and optional macOS Dock lifecycle integration. Preserve documented guidance for installations owned by other managers.
This code integration does not publish packages, enable signing or advance the public update channel.
Co-authored-by: chengyongru <61816729+chengyongru@users.noreply.github.com>
Scan the official QQ Bot binding page from Channels → QQ or
`nanobot channels login qq`; the returned AppID and encrypted secret are
decrypted locally, saved to config, and the channel is enabled by the
existing post-connect flow. The WebUI keeps manual entry of AppID and
Secret in Advanced, restores every QQ setup field there, and warns that
scanning again rotates the App Secret and invalidates the previous one.
Co-Authored-By: Claude Code <noreply@anthropic.com>
Adds `whatsapp_agent`, an additive channel that connects nanobot to the
official WhatsApp Agent Platform API (https://api.whatsapp.com/agent/v1).
It authenticates with a per-agent API token and long-polls `GET /updates`
instead of linking a device, so it is the officially supported interface
rather than the Neonize linked-device protocol used by the existing
`whatsapp` channel.
The existing `whatsapp` channel is unchanged; both can run at once under
different names.
Design notes:
- The poll cursor, dedup window, and creator identifier live in one
atomically replaced state file. A message id is recorded before it is
handled, so a crash re-reads the batch without answering twice, and the
cursor is only accepted after the batch is processed.
- The first poll omits `offset`, which resolves the head and never replays
up to 30 days of history into an auto-replying agent.
- A changed token resets the cursor, because `next_offset` is only valid
for the agent that issued it.
- Each API method is paced below its own rolling 60-second limit, and
progress/tool-hint messages default to off because they spend the shared
12-per-minute send budget.
- Retries are limited to confirmed non-delivery (`429`, `503`/`131016`).
A `500` or read timeout is ambiguous, so it is not retried unless
`retryAmbiguousSends` is set; a duplicate is worse than a missed reply.
- Inbound media is downloaded through the shared SSRF guard, size-capped,
and verified against the reported digest. Outbound media is validated
before upload.
- Reactions are receive-only, matching the API. The token is never logged
or persisted; state stores only a SHA-256 fingerprint.
Docs compare both WhatsApp channels, including the lack of end-to-end
encryption, country availability, and rate limits.
* feat: trace Codex requests via Langfuse native SDK
Codex has no OpenAI SDK client for Langfuse's usual swap trick, so
log one generation per request through langfuse's native SDK
instead. Tracing failures never affect the returned Codex response.
* docs: note Codex Langfuse tracing support
* fix: trace every Codex request, close every generation
- Move the Langfuse generation inside _send so the compaction
sub-request gets its own trace too, not just the main request.
- Derive traced model/input from the wire body (post extra_body
override, post response-item-ID stripping) instead of the
pre-normalized one.
- Wrap package detection in the same try/except as the SDK call, so
a broken find_spec() can't turn a valid Codex request into an error.
- Make generation finalization idempotent and cancellation-safe via
try/except/else/finally, so update() failures or a cancelled
request no longer leave a generation open.
- Add tests for compaction tracing, update() failures, and
cancellation.
* docs: fix cli-reference.md langfuse plugin row
* fix: don't trace a rejected compaction as success
- Add a validate hook to _send so a transport-successful compaction
reply with no usable item traces as an error, not a success.
- Add regression tests for a find_spec() failure, for the traced
model/input matching the actual wire body (extra_body override,
ID-stripped replayed items), and for the rejected-compaction case.
* fix: convert LLMUsage to dict for Langfuse usage_details
LLMResponse.usage is now the LLMUsage dataclass upstream, not a
plain dict - Langfuse's usage_details param needs the latter.
* fix: satisfy basedpyright strict on compaction items
* fix(providers): normalize Codex Langfuse cache usage
* fix(providers): migrate Langfuse tracing to SDK 4
---------
Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
Channel lazy load: discover_enabled() only imports enabled channel
modules instead of all 18 modules with heavy SDKs (telegram, discord,
slack, etc). discover_all() now delegates to discover_enabled().
Lazy OpenAI client: defer AsyncOpenAI() + httpx construction to
_ensure_client() with asyncio.Lock double-checked locking. openai
and httpx imports moved from module-level into _ensure_client().
Minor: lazy Nanobot/RunResult and CronService exports via __getattr__.
Benchmark: 6910ms → 460ms (-93.3%)
Previously _validate_allow_from raised SystemExit when allowFrom was
missing, forcing every channel to declare an explicit allowlist.
With the pairing feature this is no longer necessary: a channel with
no allowFrom simply operates in pairing-only mode, letting users
approve senders via /pairing approve <code> from the WebUI or CLI.
- Replace SystemExit with an info log in _validate_allow_from
- Add test_validate_allow_from_allows_missing_allow_from
- Add os.fsync with Windows-compatible directory flush in pairing store
- Increase pairing code length from 6 -> 8 characters for higher entropy
- Remove SystemExit on empty allowFrom; empty list now defers to pairing
- Update is_allowed docstring to document pairing fallback semantics
- Propagate is_dm to Matrix (direct rooms) and Slack (im channels)
- Slack _is_allowed now checks pairing store for DM allowlist mode
- Fix /pairing revoke to accept optional channel argument
- Move inline import time to module top-level
- Add WebSocket comment explaining is_dm=True assumption
- Add comprehensive tests for store and BaseChannel pairing integration
- Fix existing tests that expected empty allowFrom to hard-exit
Refs #3774
A single transient failure between the agent and an OpenAI/Groq Whisper
endpoint currently vanishes as `return ""` in transcribe(). The voice
message arrives as the empty string and there is no way to tell real
silence apart from a failed upload. A malformed but successful response
body is even worse: the JSON-decode error escapes the helper unhandled.
Add a shared `_post_transcription_with_retry` used by both providers.
Retry behaviour:
- exponential backoff 1s -> 2s -> 4s, up to 3 retries (4 attempts)
- retryable HTTP statuses: 408, 429, 500, 502, 503, 504
- retryable exceptions: TimeoutException, ConnectError, ReadError,
WriteError, RemoteProtocolError
Non-transient failures short-circuit to "" on the first attempt --
retrying a misconfigured key or a broken upload only burns rate-limit
quota. Branches that short-circuit:
- missing API key, missing audio file
- file-read errors (PermissionError, OSError) on the audio path,
preserving the nightly contract for direct provider callers
- HTTP auth/4xx body issues via raise_for_status()
- response.json() parse failures
- non-dict JSON payloads
Sharing one helper means OpenAI and Groq cannot drift apart silently.
Thread `language` through the helper. The multipart files dict is rebuilt
inside the per-attempt loop, so when a caller sets self.language the
`language` field is sent on every attempt -- not just the first.
Tests cover:
- every advertised retryable status and exception, parameterized
- language present on attempts 1 and 2 of a 503->200 sequence
- language absent when unset; present when set (both providers)
- malformed JSON body and non-dict JSON body short-circuit to ""
- PermissionError on file read short-circuits with no HTTP attempt
- max-attempts give-up, exponential-backoff schedule, auth no-retry,
missing-key / missing-file short-circuit
Test stub fix: the _StubResponse in tests/channels/test_channel_plugins.py
declared no status_code, which the new helper reads for retry classification.
Set status_code = 200 so the stub advertises the successful response that
those tests already simulate. Also moved the two transcription-provider
imports to the top of that file (previously placed mid-file) so the file
is ruff-clean (E402).
- Add ISO-639 pattern validation (2-3 lowercase letters) to schema
- Normalize empty language to None in provider constructors
- Extract shared httpx mock stubs, parameterize provider tests
- Add test for language=None omitting field from multipart body
- Add test for Pydantic pattern validation rejecting invalid codes
Complete the symmetry left by #3214: ChannelManager._resolve_transcription_base
already resolves providers.openai.api_base, but BaseChannel.transcribe_audio
instantiated OpenAITranscriptionProvider without forwarding it, and the provider
__init__ did not accept the parameter. Self-hosted OpenAI-compatible Whisper
endpoints (LiteLLM, vLLM, etc.) configured via config.json were therefore
ignored for the OpenAI backend.
- OpenAITranscriptionProvider.__init__ now accepts api_base with env fallback
(OPENAI_TRANSCRIPTION_BASE_URL) matching the Groq pattern.
- BaseChannel.transcribe_audio forwards self.transcription_api_base to OpenAI.
- Tests mirror the existing Groq coverage: manager propagation for provider
"openai", BaseChannel-to-provider argument passing, and provider default vs
override for api_url.
Fully backward-compatible: when api_base is None and the env var is unset,
the default https://api.openai.com/v1/audio/transcriptions is used.
Refs #3213, follow-up to #3214.
Keep dict-backed channel configs compatible with both allow_from and allowFrom without losing empty-list semantics, and add focused regression coverage for the allow-list boundary.
Made-with: Cursor