1529 Commits

Author SHA1 Message Date
chengyongru
4fd4658146 fix(memory): extract successful solutions in consolidate prompt
Add "Solutions" category to consolidate prompt so trial-and-error
workflows that reach a working approach are captured in history for
Dream to persist. Remove overly broad "debug steps" skip rule that
discarded these valuable findings.
2026-04-01 17:53:40 +08:00
chengyongru
c93bf114d2 Revert "fix(feishu): handle _resuming in send_delta to prevent duplicate messages (#2667)"
This reverts commit 5d2a13db6ab8f4439637fd1268875b64ddcbd4d2.
2026-04-01 17:30:46 +08:00
Flo
e747d32dda
fix(telegram): change drop_pending_updates to False on startup (#2686) 2026-04-01 16:47:41 +08:00
LeftX
5d2a13db6a
fix(feishu): handle _resuming in send_delta to prevent duplicate messages (#2667)
When a tool call triggers a mid-turn _stream_end(resuming=True), Feishu
channel unconditionally popped the buffer and closed the streaming card.
The next segment then created a new card, causing duplicate/fragmented
replies.

Now send_delta checks _resuming: if True, it flushes current text to
the existing card but keeps the buffer alive so subsequent segments
append to the same card. Only the final _stream_end (resuming=False)
pops the buffer and closes streaming mode.


Made-with: Cursor
2026-04-01 14:54:12 +08:00
Flo
9a468ab69b
fix(tools): strip <think> blocks from message tool content (#2621) 2026-04-01 14:42:18 +08:00
Flo
c41ab9e52e
feat(telegram): include author context in reply tags (#2605) (#2606)
* feat(telegram): include author context in reply tags (#2605)

* fix(telegram): handle missing attributes in reply_user safely
2026-04-01 14:16:51 +08:00
Flo
2780292c9d
fix(telegram): remove acknowledgment reaction when response completes (#2564) 2026-04-01 14:14:42 +08:00
Flo
ebf6201b42
fix(telegram): handle RetryAfter delay internally in channel (#2552) 2026-04-01 14:13:08 +08:00
daliu858
94e6d569b3
feat(qq): add configurable instant acknowledgment message (#2561)
Add ack_message config field to QQConfig (default: Processing...). When non-empty, sends an instant text reply before agent processing begins, filling the silence gap for users. Uses existing _send_text_only method; failure is logged but never blocks normal message handling.

Made-with: Cursor
2026-04-01 14:10:54 +08:00
Flo
973fcced2f
fix(telegram): support commands with bot username suffix in groups (#2553)
* fix(telegram): support commands with bot username suffix in groups

* fix(command): preserve metadata in builtin command responses
2026-04-01 14:00:52 +08:00
Jiajun Xie
0d6deb9197 fix(cli): prevent spinner ANSI escape codes from being printed verbatim
Fixes #2591

The "nanobot is thinking..." spinner was printing ANSI escape codes
literally in some terminals, causing garbled output like:
  ?[2K?[32m⠧?[0m ?[2mnanobot is thinking...?[0m

Root causes:
1. Console created without force_terminal=True, so Rich couldn't
   reliably detect terminal capabilities
2. Spinner continued running during user input prompt, conflicting
   with prompt_toolkit

Changes:
- Set force_terminal=True in _make_console() for proper ANSI handling
- Add stop_for_input() method to StreamRenderer
- Call stop_for_input() before reading user input in interactive mode
- Add tests for the new functionality
2026-04-01 10:30:16 +08:00
chengyongru
5da86258cc feat(agent): two-stage memory system with Dream consolidation
Replace single-stage MemoryConsolidator with a two-stage architecture:

- Consolidator: lightweight token-budget triggered summarization,
  appends to HISTORY.md with cursor-based tracking
- Dream: cron-scheduled two-phase processor that analyzes HISTORY.md
  and updates SOUL.md, USER.md, MEMORY.md via AgentRunner with
  edit_file tools for surgical, fault-tolerant updates

New files: MemoryStore (pure file I/O), Dream class, DreamConfig,
/dream and /dream-log commands. 89 tests covering all components.
2026-04-01 09:45:24 +08:00
chengyongru
cda627f956 Merge branch 'main' into nightly 2026-03-31 17:09:32 +08:00
Xubin Ren
351e3720b6 test(agent): cover disabled subagent exec tool
Add a regression test for the maintainer fix so subagents cannot register ExecTool when exec support is disabled.

Made-with: Cursor
2026-03-31 12:14:28 +08:00
zhangxiaoyu.york
c3c1424db3 fix:register exec when enable exec_config 2026-03-31 12:14:28 +08:00
04cb
929ee09499 fix(utils): ensure reasoning_content present with thinking_blocks (#2579) 2026-03-31 11:49:23 +08:00
04cb
3f21e83af8 fix(tools): clarify cron message param as agent instruction (#2566) 2026-03-31 11:49:23 +08:00
04cb
8682b017e2 fix(tools): add Accept header for MCP SSE connections (#2651) 2026-03-31 11:49:23 +08:00
Xubin Ren
7fad14802e feat: add Python SDK facade and per-session isolation 2026-03-31 11:26:43 +08:00
chengyongru
0334fa9944 feat(provider): show cache hit rate in /status (#2645) 2026-03-31 10:57:39 +08:00
chengyongru
4741026538 Merge branch 'main' into nightly 2026-03-31 09:46:09 +08:00
Xubin Ren
842b8b255d fix(agent): preserve core hook failure semantics 2026-03-31 02:19:29 +08:00
Xubin Ren
758c4e74c9 fix(agent): preserve LoopHook error semantics when extra hooks are present 2026-03-31 02:19:29 +08:00
sontianye
f08de72f18 feat(agent): add CompositeHook for composable lifecycle hooks
Introduce a CompositeHook that fans out lifecycle callbacks to an
ordered list of AgentHook instances with per-hook error isolation.
Extract the nested _LoopHook and _SubagentHook to module scope as
public LoopHook / SubagentHook so downstream users can subclass or
compose them.  Add `hooks` parameter to AgentLoop.__init__ for
registering custom hooks at construction time.

Closes #2603
2026-03-31 02:19:29 +08:00
Xubin Ren
1814272583
Merge PR #1362: feat: add OpenAI-compatible API
feat: add OpenAI-compatible API
2026-03-30 23:40:04 +08:00
Xubin Ren
5e99b81c6e refactor(api): reduce compatibility and test noise
Make the fixed-session API surface explicit, document its usage, exclude api/ from core agent line counts, and remove implicit aiohttp pytest fixture dependencies from API tests.
2026-03-30 15:05:06 +00:00
Xubin Ren
d9a5080d66 refactor(api): tighten fixed-session API contract
Require a single user message, reject mismatched models, document the OpenAI-compatible API, and exclude api/ from core agent line counts so the interface matches nanobot's minimal fixed-session runtime.
2026-03-30 14:43:22 +00:00
Xubin Ren
55501057ac refactor(api): tighten fixed-session chat input contract
Reject mismatched models and require a single user message so the OpenAI-compatible endpoint reflects the fixed-session nanobot runtime without extra compatibility noise.
2026-03-30 14:20:14 +00:00
VanditKumar
7c34910fd1
feat(channel): add iMessage integration (#2539)
* feat(channel): add iMessage integration

Add iMessage as a built-in channel via Photon's iMessage platform.

Local mode (macOS) reads ~/Library/Messages/chat.db via sqlite3 with
attachment support, sends via AppleScript, and handles voice
transcription.  Remote mode connects to a Photon endpoint over pure
HTTP with proxy support, implementing send, attachments, tapback
reactions, typing indicators, mark-as-read, polls, groups, contacts,
and health checks.

Paragraph splitting sends each \n\n-separated block as a separate
iMessage bubble.  Startup seeds existing message IDs to avoid
replaying old messages on restart.

Tested end-to-end on both modes.

* fix(imessage): address review feedback

- Add retry with exponential backoff for SQLite lock contention
- Escape newlines/tabs in AppleScript to prevent parse failures
- Lower _MAX_MESSAGE_LEN to 6000 (paragraph splitting handles UX)
- Add privacy note in README for Photon remote mode
- Merge poll interval constants; make local mode configurable too
2026-03-30 15:13:23 +08:00
Jesse
dd73d5d8df
feat(discord): configurable read receipt + subagent working indicator (#2330)
* feat(discord): channel-side read receipt and subagent indicator

- Add 👀 reaction on message receipt, removed after bot reply
- Add 🔧 reaction on first progress message, removed on final reply
- Both managed purely in discord.py channel layer, no subagent.py changes
- Config: read_receipt_emoji, subagent_emoji with sensible defaults

Addresses maintainer feedback on HKUDS/nanobot#2330

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(discord): add both reactions on inbound, not on progress

_progress flag is for streaming chunks, not subagent lifecycle.
Add 👀 + 🔧 immediately on message receipt, clear both on final reply.

* fix: remove stale _subagent_active reference in _clear_reactions

* fix(discord): clean up reactions on message handling failure

Previously, if _handle_message raised an exception, pending reactions
(read receipt + subagent indicator) would remain on the user's message
indefinitely since send() — which handles normal cleanup — would never
be called.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

* refactor(discord): replace subagent_emoji with delayed working indicator

- Rename subagent_emoji → working_emoji (honest naming: not tied to
  subagent lifecycle)
- Add working_emoji_delay (default 2s) — cosmetic delay so 🔧 appears
  after 👀, cancelled if bot replies before delay fires
- Clean up: cancel pending task + remove both reactions on reply/error

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-30 14:02:43 +08:00
chengyongru
0d10c129e8 fix(agent): preserve inbound metadata in streaming callbacks
The on_stream and on_stream_end closures in _dispatch hardcoded
their metadata dicts, dropping channel-specific fields like
message_thread_id. Copy msg.metadata first, then add internal
streaming flags, matching the pattern already used by _bus_progress.
2026-03-30 11:58:46 +08:00
Xubin Ren
5635907e33 feat(api): load serve settings from config
Read serve host, port, and timeout from config by default, keep CLI flags higher priority, and bind the API to localhost by default for safer local usage.
2026-03-29 15:32:33 +00:00
Xubin Ren
a0684978fb feat(api): add fixed-session OpenAI-compatible endpoint
Expose OpenAI-compatible chat completions and models endpoints through a single persistent API session, keeping the integration simple without adding multi-session isolation yet.
2026-03-29 14:48:52 +00:00
Paresh Mathur
80403d352b feat(discord): Use discord.py for stable discord channel (#2486)
Co-authored-by: Pares Mathur <paresh.2047@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
2026-03-29 21:12:22 +08:00
npodbielski
5118ea824a feat(matrix): streaming support (#2447)
* Added streaming message support with incremental updates for Matrix channel

* Improve Matrix message handling and add tests

* Adjust Matrix streaming edit interval to 2 seconds

---------

Co-authored-by: natan <natan@podbielski>
2026-03-29 21:12:14 +08:00
Xubin Ren
c8c520cc9a docs: update providers information 2026-03-28 13:28:56 +00:00
Charles
bee89df422 fix(skill-creator): Fix grammar in SKILL.md: 'another the agent' 2026-03-28 20:37:45 +08:00
Xubin Ren
17d21c8e64 docs: update news section for v0.1.4.post6 release 2026-03-27 15:18:31 +00:00
Xubin Ren
aebe928cf0 docs: update v0.1.4.post6 release news 2026-03-27 15:17:22 +00:00
Xubin Ren
a42a4e9d83 docs: update v0.1.4.post6 release news 2026-03-27 15:16:28 +00:00
Xubin Ren
c15f63a320 chore: bump version to 0.1.4.post6 v0.1.4.post6 2026-03-27 14:42:19 +00:00
Xubin Ren
9652e67204 Merge remote-tracking branch 'origin/main' into advisory-email-fix 2026-03-27 14:28:40 +00:00
Xubin Ren
f8c580d015 test(telegram): cover network error logging 2026-03-27 22:17:01 +08:00
flobo3
5968b408dc fix(telegram): log network errors as warnings without stacktrace 2026-03-27 22:17:01 +08:00
Xubin Ren
e464a81545 fix(feishu): only stream visible cards 2026-03-27 21:59:11 +08:00
LeftX
0ba71298e6 feat(feishu): support stream output (cardkit) (#2382)
* feat(feishu): add streaming support via CardKit PATCH API

Implement send_delta() for Feishu channel using interactive card
progressive editing:
- First delta creates a card with markdown content and typing cursor
- Subsequent deltas throttled at 0.5s to respect 5 QPS PATCH limit
- stream_end finalizes with full formatted card (tables, rich markdown)

Also refactors _send_message_sync to return message_id (str | None)
and adds _patch_card_sync for card updates.

Includes 17 new unit tests covering streaming lifecycle, config,
card building, and edge cases.

Made-with: Cursor

* feat(feishu): close CardKit streaming_mode on stream end

Call cardkit card.settings after final content update so chat preview
leaves default [生成中...] summary (Feishu streaming docs).

Made-with: Cursor

* style: polish Feishu streaming (PEP8 spacing, drop unused test imports)

Made-with: Cursor

* docs(feishu): document cardkit:card:write for streaming

- README: permissions, upgrade note for existing apps, streaming toggle
- CHANNEL_PLUGIN_GUIDE: Feishu CardKit scope and when to disable streaming

Made-with: Cursor

* docs: address PR 2382 review (test path, plugin guide, README, English docstrings)

- Move Feishu streaming tests to tests/channels/
- Remove Feishu CardKit scope from CHANNEL_PLUGIN_GUIDE (plugin-dev doc only)
- README Feishu permissions: consistent English
- feishu.py: replace Chinese in streaming docstrings/comments

Made-with: Cursor
2026-03-27 21:59:11 +08:00
Xubin Ren
cf25a582ba fix(channel): stop delta coalescing at stream boundaries 2026-03-27 21:43:57 +08:00
chengyongru
5ff9146a24 fix(channel): coalesce queued stream deltas to reduce API calls
When LLM generates faster than channel can process, asyncio.Queue
accumulates multiple _stream_delta messages. Each delta triggers a
separate API call (~700ms each), causing visible delay after LLM
finishes.

Solution: In _dispatch_outbound, drain all queued deltas for the same
(channel, chat_id) before sending, combining them into a single API
call. Non-matching messages are preserved in a pending buffer for
subsequent processing.

This reduces N API calls to 1 when queue has N accumulated deltas.
2026-03-27 21:43:57 +08:00
Flo
1331084873 fix(providers): make max_tokens and max_completion_tokens mutually exclusive (#2491)
* fix(providers): make max_tokens and max_completion_tokens mutually exclusive

* docs: document supports_max_completion_tokens ProviderSpec option
2026-03-27 21:19:23 +08:00
Xubin Ren
ace3fd6049 feat: add default OpenRouter app attribution headers 2026-03-27 11:40:23 +00:00