Commit Graph
2295 Commits
Author SHA1 Message Date
chengyongru 4dc695ca76 fix(webui): keep version checks on the gateway event loop (#6376)
* fix(webui): keep version checks on the gateway event loop

* fix(webui): keep update channel failures factual

Note: CI failed, but it’s not related to this PR.
2026-10-21 23:08:35 +08:00
Xubin Renandchengyongru fbb61a373f feat(update): integrate managed installs and recoverable in-app updates (#6168)
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>
2026-10-21 19:16:56 +08:00
chengyongru 76da55994b fix(webui): preserve answer checkpoints and stream order (#6368)
* fix(webui): preserve answer checkpoints and stream order

* fix(stream): close hosted-tool answer segments at the producer
2026-10-21 18:30:52 +08:00
chengyongru b32b1327ce refactor(session): unify model and display history storage (#6336)
* refactor(session): persist display history in SQLite

* fix(session): preserve new fork activity timestamps

* test(agent): use SQLite-owned model failure recovery fixture

* test(agent): isolate session slash routing from loop shutdown

Exercise the real inbound dispatcher and await its session worker. Keep response deadlines and behavioral assertions, while leaving full SQLite cleanup to the existing async fixture rather than an unrelated two-second shutdown deadline.

* fix(webui): admit direct deliveries to display history

* docs: clarify session history migration guidance
2026-10-21 16:13:59 +08:00
chengyongru f284749d2f ci: reduce Python test overhead and Windows latency (#6357)
* test: merge overlapping semantic contract coverage

Consolidate the six confirmed NAN-310 overlap groups while preserving replay, usage, generation kwargs, archive metadata, inspect fields, and subagent crash/redelivery assertions.

* test: lighten history seeds and layer runner progress rules

* ci: defer test storage setup and record phase timings

Close each listener-owned binary bridge before waiting for its TCP server; retain active upload and undecided-connection regressions. Avoid consuming readiness twice and run the repository import scan once in its static gate. NAN-310.

* test: scope filesystem mocks and observe consumed socket prefixes

* test: publish subprocess readiness files atomically

* ci: isolate external tool discovery and use three Windows workers
2026-10-21 14:47:55 +08:00
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
chengyongru 688976bcb9 fix(agent): skip subagent sessions during idle compaction (#6339)
Refs: NAN-304
2026-10-20 22:26:49 +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 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 af68da3280 perf(webui): reuse versioned history navigation snapshots 2026-10-19 13:45:04 +08:00
chengyongru 3ab8082118 test(docker): read persisted configuration as UTF-8 on Windows 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 53e0edf709 fix(session): prevent consumed follow-ups from replaying after restart (#6299)
* fix(session): atomically acknowledge consumed follow-ups

* refactor(webui): drop legacy follow-up replay compatibility
2026-10-19 11:31:19 +08:00
Xubin Ren b702ac633f test(gateway): publish child claim markers atomically 2026-10-18 22:11:14 +08:00
fhgffy a3ead61580 fix(cron): preserve schedules edited during execution 2026-10-18 22:11:14 +08:00
Xubin Ren 59bfdc895b test(cron): cover repeated restart and overdue interval behavior 2026-10-18 21:44:59 +08:00
DDT 6dd3788e05 fix(cron): keep pending interval runs across gateway restarts
Every-interval jobs had their next run recomputed from now on startup,
and register_system_job reset the Dream/heartbeat state on each boot.
A gateway restarted more often than the interval therefore never ran
the job. Keep a persisted next run while it is still pending and at
most one interval away.
2026-10-18 21:44:59 +08:00
pei711 6670dd72da fix(mcp): discover all resource and prompt pages 2026-10-18 21:32:42 +08:00
pei711 a377a8e0d3 fix(mcp): honor optional server tool capabilities 2026-10-18 21:18:54 +08:00
wkd 68e9b1cc3a fix(mcp): prevent credential leakage in discovery error logs 2026-10-18 20:52:31 +08:00
Xubin Ren 5d99f909a7 test(cli): identify Windows handoff stages on timeout 2026-10-18 20:36:33 +08:00
KennySimpson 23bf1b87cd fix: use JSON equality for enum validation 2026-10-18 20:36:33 +08:00
Shoaib 9fe061a537 fix(tools): accept integral JSON numbers for integer parameters
JSON Schema accepts numbers such as 3.0 as integers, but Python decodes
that representation as float. Tool calls with valid integral arguments
were therefore rejected before execution, including nullable and union
integer schemas.

Share the integer check across schema validation and union matching, then
convert integral floats to int before calling the tool. Keep fractional
values, booleans, and non-finite numbers outside the integer type.

Add schema and registry regressions for integral JSON numbers.

Validation: 144 tool-validation tests; Ruff; BasedPyright;
import-boundary checks; git diff --check.
2026-10-18 20:22:33 +08:00
pei711 5fd79c25fa fix(providers): preserve first SSE event after UTF-8 BOM 2026-10-18 20:10:51 +08:00
Xubin Ren d0a1423ccf fix(agent): retain skipped inline reasoning separators 2026-10-18 19:57:34 +08:00
yixi ning ed8143f7d0 fix(agent): preserve separators in streamed inline reasoning 2026-10-18 19:57:34 +08:00
Jin Long ba406fc624 fix(session): preserve Unicode separators during JSONL migration 2026-10-18 19:30:29 +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 90fcb7f903 test(agent): close session input fixtures and share shutdown diagnostics 2026-10-18 18:33:24 +08:00
Xubin Ren 2756c6bb78 test(agent): capture native shutdown timeout stacks 2026-10-18 18:33:24 +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
takiAA 5f6e8a6baa fix(documents): preserve complete PDF pages across reads 2026-10-18 16:52:47 +08:00
Xubin Ren 42276f4884 test(shell): treat vanished Linux proc entries as stopped 2026-10-18 16:40:43 +08:00
Rudy Celekli af353fae73 fix(grep): preserve XLSX cell locators for literal tabs
Keep extracted spreadsheet text unchanged and carry actual cell start offsets into grep headers. Add real workbook GrepTool regressions and plain/empty-cell controls. Focused literal-source extraction/ContentPage replay passes; full GrepTool and required CI remain pending.
2026-10-18 16:40:43 +08:00
lux-liang a2f9fae8fe fix(documents): skip chart-only sheets when reading XLSX files 2026-10-18 16:22:53 +08:00
Xubin Ren 6330b748de test(shell): handle process reaping during PID checks 2026-10-18 15:55:24 +08:00
fhgffy 8adab28aee fix(web): handle case-insensitive image media types 2026-10-18 15:55:24 +08:00
Shoaib b4f381ca55 fix(media): keep upload filenames within the UTF-8 byte limit
The 80-character stem limit can still produce a filename longer than 255
bytes when a document name contains CJK characters or emoji. Adding the
upload ID then makes an otherwise valid document name fail on disk.

Retain the character limit and trim only stems that exceed the remaining
byte budget after the ID, separator, and extension. Decode at a character
boundary so the saved name remains valid Unicode.

Add file-write regressions for CJK and emoji document names.

Validation: 38 media and attachment-store tests; Ruff; BasedPyright;
import-boundary checks; git diff --check.
2026-10-18 15:23:07 +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 74942bd190 test: replace false-green checks with behavioral coverage (#6282)
* test: replace false-green checks with behavioral coverage

* test: complete behavior-focused audit coverage
2026-10-18 03:16:25 +08:00
chengyongru 756f6a6fe5 refactor(agent): deduplicate model request preparation 2026-10-18 00:26:19 +08:00
chengyongru 742ea48df3 fix(webui): keep CLI Apps reads off the event loop 2026-10-18 00:05:14 +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