Commit Graph
523 Commits
Author SHA1 Message Date
chengyongru 73a55e0b2f fix(gateway): request graceful Windows shutdown (#6353)
* fix(gateway): request graceful Windows shutdown

* docs(cli): simplify Windows gateway stop guidance

* test(gateway): compare native Windows owner SIDs
2026-10-21 11:05:30 +08:00
Xubin Ren 28f6c26946 fix(webui): recover model failures and align chat controls 2026-10-21 02:34:09 +08:00
bingqilinweimaotaiandClaude Code 6741acb391 feat(qq): add QR scan connection for QQ bots
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>
2026-10-20 21:55:17 +08:00
chengyongru 282839cc65 feat(webui): add reading text size preferences (#6325)
* feat(webui): add reading text size preferences

* fix(webui): align loading skeletons with reading typography
2026-10-20 16:33:05 +08:00
chengyongru 11152626f8 fix(webui): refine browser notifications (NAN-227)
Reconcile the original notification fix with the integrated main snapshot.

Group notification settings and simplify localized copy and documentation.
Preserve permission opt-out and notification click routing across app transitions.
Suppress late completion notifications for discarded temporary chats and align
notification settings skeletons with the loaded layout.
2026-10-20 13:45:04 +08:00
Xubin Ren 7b2af031c0 fix(webui): make browser notification failures actionable 2026-10-20 13:45:04 +08:00
chengyongru 909b277e7a fix(webui): recognize typed session handles as references (#6311)
* fix(webui): recognize typed session handles as references

Refs NAN-286

* refactor(webui): simplify session reference handling

* fix(webui): recognize mentions after punctuation

* docs(webui): focus topic references on usage
2026-10-20 01:05:11 +08:00
chengyongru 125d9221d0 fix(webui): merge consecutive waiting messages (#6309)
* fix(webui): merge consecutive waiting messages

* fix(webui): retain legacy draft session targets on refresh
2026-10-19 21:06:46 +08:00
chengyongru f57018aa7f feat(webui): render Mermaid diagrams with Pele (#6302)
* feat(webui): render Mermaid diagrams with Pele

* fix(webui): reserve diagram replacement capacity

* fix(webui): prebundle lazy diagram worker dependencies

* fix(webui): account diagram capacity by encoded size

* fix(webui): use shared hover hints for diagram actions

* docs(webui): focus diagram guide on usage
2026-10-19 17:16:20 +08:00
chengyongru dca49c258a fix(tools): refine DeepSeek search credentials and query validation
Require a configured Search API key while preserving explicit ${VAR_NAME} references.
Reject overlong Unicode queries locally instead of silently truncating them.
Keep the shared Settings flow and condense the configuration documentation.
2026-10-19 16:50:17 +08:00
moran e5b469ebd4 feat(tools): add DeepSeek Search as a web_search provider
Add a standalone `deepseek` search backend that calls the DeepSeek Search
API (POST https://api.deepseek.com/v1/tools/search), following the
provider layout used by AnySearch (#5607) and Bocha (#4182).

This is a search-only integration. It does not touch the DeepSeek LLM
provider, does not inject a `web_search` tool into model requests, and
does not implement the Fetch endpoint.

- Trim and truncate queries to the API's 128 Unicode-character limit
  locally, rejecting whitespace-only queries without a network call.
- Clamp `count` to the API's 1-50 range and always send
  `need_content: false` so page bodies stay out of the model context.
- Format results from `summary`, falling back to `snippet` when a summary
  is missing or blank, and include `date` when present. Cap each result's
  text at 500 characters: live responses reach ~4,500 characters, so ten
  uncapped results cost roughly 10k tokens per call.
- Return actionable 401 and 402 messages; retry 408/429/5xx once after
  1.0s like the Brave provider; surface `error.message` for other 4xx,
  tag-stripped because the upstream body is untrusted. Unexpected
  transport errors report the exception type only, with the detail
  logged when tool log content is allowed.
- Read the key from `tools.web.search.apiKey` or `DEEPSEEK_API_KEY` and
  fall back to DuckDuckGo when neither is set, like other keyed
  providers. The key is never logged or echoed in errors.
- Register the provider for the CLI wizard and WebUI settings, and reuse
  the bundled DeepSeek brand asset.
2026-10-19 16:50:17 +08:00
chengyongru 103840171b fix(docker): preserve explicit config selectors during bootstrap
Only initialize the Compose default instance when no --config/-c selector is present. Preserve all CLI-supported selector spellings and cover gateway/API startup against selected persisted settings in the Docker smoke test.
2026-10-19 13:02:26 +08:00
chengyongru de8fbc3ad2 fix(api): keep unconfigured services running and preserve Docker onboarding 2026-10-19 13:02:26 +08:00
chengyongru e20737a509 fix(docker): validate and atomically save first-boot configuration 2026-10-19 13:02:26 +08:00
LuckVd ddd22a26f8 Bootstrap a working Docker Compose config on first boot so the WebUI works out of the box
A fresh 'docker compose up' started with no config (the entrypoint only
bootstrapped for Render), so every published port was unreachable: the
gateway and WebSocket channel defaulted to a container-local 127.0.0.1
bind, and nanobot-api exited into a restart loop because serve refuses a
non-loopback host without an api_key.

Bootstrap config.json for container runs (NANOBOT_DOCKER_BOOTSTRAP, set
by docker-compose.yml) from a committed docker-config.json with binds
that survive the container boundary, baking the WebUI token and API key
at first boot (env value if provided, generated otherwise, printed to
the log). Move nanobot-api under the 'api' profile since it cannot
serve before a provider is configured. Install curl in the image and
document the new first-boot flow.

Fixes #6165
2026-10-19 13:02:26 +08:00
chengyongru 1832255995 docs: make user guidance easier to follow 2026-10-19 10:11:45 +08:00
chengyongru 0a8b18fa58 fix(deepseek): align model capabilities with the official API (#6283)
* fix(deepseek): preserve vision for legacy Flash aliases

* fix(deepseek): expose validated model catalog capabilities

* fix(deepseek): retain explicit off control with live reasoning levels

* docs: clarify provider-specific model guidance
2026-10-18 19:17:05 +08:00
Xubin Ren f9a3e55b64 perf(webui): revalidate prompt summaries and bound navigation work 2026-10-18 17:13:18 +08:00
Xubin Ren bf1eada575 fix(webui): navigate complete prompt history with bounded pages 2026-10-18 17:13:18 +08:00
Xubin Ren c49d84b4e5 fix(whatsapp_agent): retain unsent scheduled results across reconnects 2026-10-18 14:49:49 +08:00
Xubin Ren 86f16ff493 fix(whatsapp_agent): clarify privacy and align current channel setup 2026-10-18 14:49:49 +08:00
Xubin Ren 5a0f2c2dc3 fix(whatsapp_agent): preserve poll continuity and partial delivery progress 2026-10-18 14:49:49 +08:00
Carmelo Campos b7cb5da4b5 feat(channels): add WhatsApp Agent Platform channel
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.
2026-10-18 14:49:49 +08:00
chengyongru d9537bcc94 feat(webui): rename sidebar topics inline 2026-10-18 01:48:42 +08:00
Xubin Ren 0869c928a2 feat(webui): preview Markdown files with a source toggle 2026-10-18 00:14:36 +08:00
chengyongru d076e4ef13 docs(automations): keep Markdown paragraphs on one line 2026-10-17 18:26:15 +08:00
Xubin Ren 508cedff31 fix(channels): retain scheduled results across pre-send outages 2026-10-17 12:49:03 +08:00
Xubin Ren 61db036cee test(cron): narrow delivery review to saved-chat routing 2026-10-17 12:49:03 +08:00
Xubin Ren 8691bdedd5 test(cron): cover WebUI-origin cross-channel delivery 2026-10-17 12:49:03 +08:00
Xubin Ren 182ada6825 fix(channels): preserve recovery order and adapter ownership 2026-10-17 12:49:03 +08:00
Xubin Ren 9c1b16b3cc fix(channels): retain scheduled results across pre-send outages 2026-10-17 12:49:03 +08:00
chengyongru 8f6a5594fb refactor(session): centralize state ownership in SQLite (#5943)
* fix(session): move persistence off event loop

* refactor(session): isolate async persistence boundary

* refactor(session): keep a single session manager

* refactor(session): use stateless async adapters

* fix(session): serialize local persistence without file-lock contention

* refactor(session): own async persistence and snapshot commits

* refactor(session): narrow persistence changes to async adapters

* refactor(session): remove redundant async forwarding helpers

* fix(command): offload compact session persistence

* fix(session): adapt idle compaction to current main

* fix(webui): offload session metadata persistence

* refactor(session): centralize state ownership in SQLite

* fix(session): skip storage for non-recoverable followups

* test(webui): honor the full gateway event deadline

* perf(session): persist incremental changes and reuse owner snapshots

* test(agent): allow durable worker shutdown in burst test

* fix(gateway): drain session storage on Windows console shutdown

* fix(session): enforce bounded ownership and lifecycle-safe persistence

* fix: reject unresolved home paths and stabilize platform tests

* fix(session): preserve request context compatibility and owner-backed tests

* docs: focus configuration guide on user-facing behavior

* fix(session): adapt goal admission to async ownership after rebase

* fix(session): integrate current gateway and subagent contracts

* fix(session): align rebased workspace admission and async tests

* fix(session): support compatible SQLite schema evolution

* test(agent): use session owner in workspace context regressions

* test: stabilize Windows lifecycle and browser checks

* refactor(session): remove premature JSONL file export

* ci: bound Windows full-suite worker concurrency

* chore: remove session state refactor notes

* fix(session): queue writes and retain worker connections

* perf(webui): read detached metadata for session and task lists

* perf(agent): bound prompt preparation and local token counting

* docs: remove internal session storage guide

* perf(session): skip archived transcripts during idle scans

* fix(session): coordinate turns and isolate legacy session data

Bind WebUI input generations to the execution session and serialize idle
and SDK compaction with turns. Keep turn drafts through preparation so the
latest channel route persists.

Move imported workspace JSONL and checkpoints to durable private backups
before gateway admission, resuming cleanup after interruptions. Remove
committed child sessions when task creation is cancelled.

Validation: focused Python and frontend regressions, Ruff, BasedPyright,
import boundaries, WebUI build, and isolated gateway/browser flows.

* fix(agent): keep cancellation hooks independent of prompt preparation

* fix(session): preserve admission, delivery, and migration contracts

* fix(agent): preserve cancellation settlement after rebase

* fix(session): preserve request attribution through async ownership
2026-10-16 17:28:47 +08:00
chengyongru 6310a39bac fix(shell): separate wait, idle, and runtime limits (#6228)
* fix(shell): separate wait, idle, and runtime limits

* fix(shell): separate wait, idle, and runtime limits

* fix(exec): preserve settings aliases and reclaim completed sessions

* fix(webui): make shell runtime limits explicit
2026-10-16 13:44:15 +08:00
chengyongru fdeda8a468 fix(webui): reconcile turns after reconnect (#6211)
* fix(webui): reconcile turns after reconnect

* perf(webui): bound reconnect recovery and index turn reconciliation

* refactor(webui): simplify reconnect reconciliation

* fix(webui): preserve turn authority during recovery

* fix(webui): validate canonical completion identities
2026-10-16 11:38:05 +08:00
chengyongru 31b193236f fix(cli): reject misplaced gateway instance selectors (#6229)
* fix(cli): inherit gateway instance selectors in subcommands

* fix(cli): reject misplaced gateway instance selectors

* test(cli): strip ANSI styling from gateway usage assertions
2026-10-16 01:24:50 +08:00
akinolurandchengyongru 9d2762a4f1 feat(provider): langfuse tracing for codex (#5520)
* 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>
2026-10-16 00:44:17 +08:00
chengyongru 2ad0da786d fix(session): serialize compaction with active turns 2026-10-15 10:43:02 +08:00
chengyongru 152abe7949 feat(webui): expand MCP service presets (#6216)
* feat(webui): expand MCP service presets

* refactor(webui): load MCP presets from JSON

Validate and package the static service catalogue while preserving existing preset definitions. Pass Redis connection URLs through the official CLI option to retain target, TLS, database, and credential settings.

* docs(mcp): include all built-in service presets
2026-10-14 22:41:55 +08:00
David KlaperandCopilot 2732e2b3ce fix(webui): send same-origin cookies with uploads
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-10-14 16:12:50 +08:00
chengyongru cd2a863710 feat(skills): explain nanobot usage from bundled documentation (#6176)
* feat(skills): add nanobot documentation guide with bundled docs

* docs: prefer graphical setup and align bundled guides with runtime

* docs: lead provider setup with built-in endpoint defaults

* fix: preserve documentation packaging and lookup across install paths

* fix(skills): narrow documentation loading to relevant sections

* refactor(skills): keep documentation guidance concise

* fix(docs): complete first-use workflows and clarify runtime boundaries

* style(docs): remove manual paragraph wrapping

* docs: guide first-run users to conversational setup help

* docs: fold README installation alternatives and details

* docs: separate README alert marker from its body

* docs: clarify README onboarding and runtime boundaries
2026-10-13 00:44:25 +08:00
Xubin Renandchengyongru 23941355a8 feat(images): reuse named connections and image request settings
Preserve the reviewed tree while removing obsolete stacked branch history.

Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
2026-10-12 21:22:35 +08:00
Xubin Ren b89ef23df5 fix(webui): make pairing recovery explicit and retryable 2026-10-12 17:38:43 +08:00
Xubin Ren 2aa98677c6 fix(feishu): restore assistant creation and pairing recovery
Refs NAN-239
2026-10-12 17:38:43 +08:00
Xubin Ren cfb0f51e78 fix(webui): complete restarts independently in each tab 2026-10-12 17:30:53 +08:00
Xubin Ren 77660ea8e5 fix(webui): keep settings restarts out of chat history 2026-10-12 17:30:53 +08:00
Xubin Ren 7a3a0559c4 fix(webui): place web proxy with web access settings 2026-10-12 17:24:04 +08:00
Xubin Ren d4b01285a9 feat(models): add per-preset request overrides 2026-10-12 17:17:02 +08:00
chengyongru bdfc8f7bd4 fix(image): use standalone Codex Images API (#6177)
* fix(image): use standalone Codex Images API

* docs(image): keep Codex setup focused on user actions
2026-10-12 17:05:38 +08:00
chengyongru 73af08efab fix(webui): allow switching Default permissions back to Full Access (#6175)
* fix(webui): allow authenticated access mode switching

* refactor(webui): remove constant full access eligibility helpers

* refactor(webui): remove obsolete full access policy parameter

* docs(webui): remove redundant access switching paragraph

* refactor(webui): remove obsolete full access capability
2026-10-12 15:39:33 +08:00
chengyongru 61fa3aa83c fix(channels): remove retired outbound metadata compatibility (#6169)
* docs(channels): remove expired entry-point migration notice

* fix(channels): remove retired outbound metadata compatibility
2026-10-12 11:36:25 +08:00