Commit Graph
4938 Commits
Author SHA1 Message Date
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
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 4d45564362 fix(whatsapp_agent): scope the bad-token heuristic away from media methods
The Developer Manual documents 400/100 as meaning "the API token is
present but not valid" only on endpoints without media. Media methods
share that same status and code with an unknown or expired media id and
with a length cap.

Classifying a 400 from `GET /media/<id>` as an invalid token would stop
the channel because one attachment expired, so media requests now pass
`media_endpoint=True` and the heuristic is skipped for them. A malformed
Authorization header (401/190) is still recognised on every endpoint.

Also corrects the state module docstring: the store keeps the cursor,
dedup window, creator identifier, and delivery receipts, and holds no
token material.
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 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 c7ab7aa6da refactor(webui): remove obsolete topic rename dialog mode 2026-10-18 01:48:42 +08:00
chengyongru d9537bcc94 feat(webui): rename sidebar topics inline 2026-10-18 01:48:42 +08:00
chengyongru 7edd377352 fix(webui): keep search activity summaries on one line 2026-10-18 01:45:53 +08:00
chengyongru c91e2bd553 fix(webui): preserve list semantics around links
Classify compact title-plus-URL previews at the Markdown AST boundary instead of flattening arbitrary list descendants. Preserve ordinary prose, nested lists, independent links, numbering, task status, and inline formatting across streaming modes.

Refs NAN-269.
2026-10-18 00:48:07 +08:00
chengyongru 756f6a6fe5 refactor(agent): deduplicate model request preparation 2026-10-18 00:26:19 +08:00
chengyongru 1a4cee5815 fix(webui): align mention overlay spacing with the native caret 2026-10-18 00:25:47 +08:00
Xubin Ren 61666c495a fix(webui): reuse preview tabs for resolved file aliases 2026-10-18 00:14:36 +08:00
Xubin Ren 0869c928a2 feat(webui): preview Markdown files with a source toggle 2026-10-18 00:14:36 +08:00
chengyongru 742ea48df3 fix(webui): keep CLI Apps reads off the event loop 2026-10-18 00:05:14 +08:00
chengyongru 8de03ac0a2 fix(webui): use file-type icons in file change activity 2026-10-17 23:27:00 +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
faf1efaf09 fix(consolidation): trigger compaction from reported usage, not just tiktoken estimates (#6260)
Co-authored-by: Muzhen2000 <254800372+Muzhen2000@users.noreply.github.com>
Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
2026-10-17 02:47:42 +08:00
Gianfranco DemarcoandCursor bd779e9f54 fix(webui): hide provider models past OpenAI shutdown_date
The settings picker mirrored GET /v1/models without reading shutdown_date,
so retired chat-latest snapshots stayed selectable until a turn failed.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-17 02:01:19 +08:00
chengyongru 559107172a fix(webui): hide recovery notice while resumed tasks run
Render recovery decisions only for awaiting_user and failed states so a reload cannot resurrect a resuming banner. Preserve the runtime recovery state and normal running controls.

Refs NAN-260
2026-10-16 18:25:40 +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 33ff520d12 fix: preserve subtask request attribution after restart (#6247)
* fix: preserve request origin across recovery continuations

* fix: bind request origin to each continuation

* fix: capture origin when queuing continuation messages

* chore: remove redundant request context comment

* fix: persist origin for independent system turns
2026-10-16 16:46:39 +08:00
hazelxue 6d84786efa Require dulwich>=0.24.0: GitStore.diff_commits uses porcelain.diff
porcelain.diff only exists from dulwich 0.24.0 (0.22.x and 0.23.x have
init/add/commit/status but not diff). On the declared floor every call to
GitStore.diff_commits / show_commit_diff raised GitStoreError, and the
dream line-ending test failed for the same reason. tests/agent/test_git_store.py
and tests/agent/test_dream.py pass with 0.24.0 and the other dependencies
still at their minimum versions.
2026-10-16 16:01:15 +08:00
Willow Lopezandchengyongru d2aaa8e54b fix(webui): preserve sidebar state after failed initial fetch (#6009)
* fix(webui): wait for sidebar state before persisting edits

* test(webui): load sidebar state in temporary chat fixtures

* fix(webui): preserve sidebar pushes during initial reads

* fix(webui): require successful session reads before pruning

Treat sidebar initialization and session-list completeness as separate permissions. Retain sidebar metadata, workbench panes, activity markers, and workspace overrides when the session list fails or only a partial reload cache is available.

Add integration coverage for recovery with and without cached sessions, successful deletion reconciliation, and successful empty session lists.

* test(webui): align sidebar recovery fixture with current schema

Remove obsolete preview and timestamp settings from the raw API fixture. Assert supported view preferences while retaining exact metadata and workbench comparisons.

---------

Co-authored-by: chengyongru <chengyongru.ai@gmail.com>
2026-10-16 15:47:15 +08:00
chengyongru f101a24571 refactor(cli): use Questionary for onboarding selection (#6251)
* fix(cli): require compatible terminal prompt dependencies

Require prompt-toolkit 3.0.52 for Windows VT100 input flushing and Questionary 2.1.1 for compatibility with its prompt layout. Keep the existing major-version bounds and Python minimum.

* refactor(cli): use Questionary for onboarding selection

Delegate menu navigation, selection and scrolling to questionary.select. Retain the existing back/cancel contract, palette and position feedback through a thin adapter and exercise real prompt keyboard behavior instead of viewport arithmetic.
2026-10-16 15:34:49 +08:00
chengyongru 67248790c7 test(shell): remove scheduling race from partial-byte idle check 2026-10-16 15:05:56 +08:00
chengyongru e4fc8788c4 refactor(providers): remove duplicate chat response parsers 2026-10-16 15:05:56 +08:00
chengyongru 0d09b3dc09 perf(webui): avoid subtree style invalidation while typing 2026-10-16 15:00:38 +08:00
chengyongru b8df1f0418 refactor(settings): preserve domain controller objects 2026-10-16 14:57:33 +08:00
chengyongru 0d1beac3aa refactor(webui): centralize client run lifecycle state 2026-10-16 14:54:37 +08:00
chengyongru 6f04038d21 fix(webui): preserve custom shell runtime editing 2026-10-16 14:09:55 +08:00
chengyongru 3ccc181d29 fix(webui): load history for running sessions 2026-10-16 14:07:10 +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 70ac000ad9 fix(webui): space other tasks from following messages 2026-10-16 13:40:14 +08:00
chengyongru 836092424d fix(webui): resume queued prompts after turn completion (#6242)
* fix(webui): resume queued prompts after turn completion

Persist the lifecycle turn each queued prompt waits for and use canonical completion identities to resume after navigation or reconnect. Release one entry at a time, and retain stopped or rejected entries for manual sending.

* fix(webui): drain temporary chat prompts on live completion

* perf(webui): resume queued prompts from live completion
2026-10-16 13:33:41 +08:00
chengyongru 3abcfe70c5 perf(agent): prepare prompts outside the event loop (#6224)
* perf(agent): prepare prompts outside the event loop

* fix(agent): preserve cancellation during run cleanup

* refactor(agent): clarify prompt preparation boundaries

* revert(agent): restore original prompt preparation structure

This reverts commit 484cb96a08bf3a805f5828d5a65316be7decaaa5.
2026-10-16 13:16:13 +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 aeca1c0f1a fix(webui): avoid blocking the gateway on skill loading 2026-10-16 11:21:28 +08:00
chengyongru a721eb8476 fix(webui): keep sheet close focus rings keyboard-only 2026-10-16 10:34:38 +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