1550 Commits

Author SHA1 Message Date
Xubin Ren
feb04a046d fix(providers): normalize anthropic cached token usage 2026-04-02 04:48:11 +00:00
Xubin Ren
4ce0a8a68e Merge remote-tracking branch 'origin/main' into pr-2703 2026-04-02 04:28:23 +00:00
Tejas1Koli
42fa8fa933 fix(providers): only apply cache_control for Claude models on OpenRouter 2026-04-02 04:04:18 +08:00
Tejas1Koli
05fe73947f fix(providers): only apply cache_control for Claude models on OpenRouter 2026-04-02 04:04:18 +08:00
Xubin Ren
485c75e065 test(exec): verify windows drive-root workspace guard 2026-04-02 04:00:03 +08:00
zhangxiaoyu.york
bc2e474079 Fix ExecTool to block root directory paths when restrict_to_workspace is enabled 2026-04-02 04:00:03 +08:00
WormW
ddc9fc4fd2 fix: also check channel match before inheriting default message_id
Different channels could theoretically share the same chat_id.
Check both channel and chat_id to avoid cross-channel reply issues.

Co-authored-by: layla <111667698+04cb@users.noreply.github.com>
2026-04-02 03:46:54 +08:00
WormW
6973bfff24 fix(agent): message tool incorrectly replies to original chat when targeting different chat_id
When the message tool is used to send a message to a different chat_id

than the current conversation, it was incorrectly including the default

message_id from the original context. This caused channels like Feishu

to send the message as a reply to the original chat instead of creating

a new message in the target chat.

Changes:

- Only use default message_id when chat_id matches the default context

- When targeting a different chat, set message_id to None to avoid

  unintended reply behavior
2026-04-02 03:46:54 +08:00
Xubin Ren
7e719f41cc test(providers): cover github copilot lazy export 2026-04-02 03:46:40 +08:00
Xubin Ren
2ec68582eb fix(sdk): route github copilot through oauth provider 2026-04-02 03:46:40 +08:00
RongLei
c5f0997381 fix: refresh copilot token before requests
Address PR review feedback by avoiding an async method reference as the OpenAI client api_key.

Initialize the client with a placeholder key, refresh the Copilot token before each chat/chat_stream call, and update the runtime client api_key before dispatch.

Add a regression test that verifies the client api_key is refreshed to a real string before chat requests.

Generated with GitHub Copilot, GPT-5.4.
2026-04-02 03:46:40 +08:00
RongLei
a37bc26ed3 fix: restore GitHub Copilot auth flow
Implement the real GitHub device flow and Copilot token exchange for the GitHub Copilot provider.

Also route github-copilot models through a dedicated backend and strip the provider prefix before API requests.

Add focused regression coverage for provider wiring and model normalization.

Generated with GitHub Copilot, GPT-5.4.
2026-04-02 03:46:40 +08:00
chengyongru
122e27ceb7 feat(provider): show cache hit rate in /status (#2645) 2026-04-01 15:56:57 +08:00
Xubin Ren
63d646f731
Merge PR #2676: fix(test): fix flaky test_fixed_session_requests_are_serialized
fix(test): fix flaky test_fixed_session_requests_are_serialized
2026-03-31 22:08:47 +08:00
chengyongru
69624779dc fix(test): fix flaky test_fixed_session_requests_are_serialized
Remove the fragile barrier-based synchronization that could cause
deadlock when the second request is scheduled first. Instead, rely
on the session lock for serialization and handle either execution
order in assertions.
2026-03-31 21:50:33 +08:00
Xubin Ren
a4dfbdf996
Merge PR #2614: feat(weixin): weixin multimodal capabilities and align with version 2.1.1
feat(weixin): weixin multimodal capabilities and align with version 2.1.1
2026-03-31 19:43:02 +08:00
Xubin Ren
949a10f536 fix(weixin): reset QR poll host after refresh 2026-03-31 19:40:13 +08:00
xcosmosbox
2a6c616080 fix(WeiXin): fix full_url download error 2026-03-31 19:40:13 +08:00
xcosmosbox
1bcd5f9742 fix(weixin): fix test file version reader 2026-03-31 19:40:13 +08:00
xcosmosbox
26947db479 feat(weixin): add voice message, typing keepalive, getConfig cache, and QR polling resilience 2026-03-31 19:40:13 +08:00
xcosmosbox
0514233217 fix(weixin): align full_url AES key handling and quoted media fallback logic with reference
1. Fix full_url path for non-image media to require AES key and skip download when missing,
   instead of persisting encrypted bytes as valid media.
2. Restrict quoted media fallback trigger to only when no top-level media item exists,
   not when top-level media download/decryption fails.
2026-03-31 19:40:13 +08:00
xcosmosbox
345c393e53 feat(weixin): implement getConfig and sendTyping 2026-03-31 19:40:13 +08:00
xcosmosbox
faf2b07923 feat(weixin): add fallback logic for referenced media download 2026-03-31 19:40:13 +08:00
xcosmosbox
efd42cc236 feat(weixin): implement QR redirect handling 2026-03-31 19:40:13 +08:00
xcosmosbox
3823042290 fix(weixin): correct PKCS7 unpadding for AES-ECB; support full_url for media download 2026-03-31 19:40:13 +08:00
xcosmosbox
5bdb7a90b1 feat(weixin):
1.align protocol headers with package.json metadata
2.support upload_full_url with fallback to upload_param
2026-03-31 19:40:13 +08:00
Xubin Ren
bc8fbd1ce4 fix(weixin): reset QR poll host after refresh 2026-03-31 11:34:33 +00:00
Xubin Ren
6aad945719 Merge remote-tracking branch 'origin/main' into pr-2614 2026-03-31 11:29:36 +00:00
Xubin Ren
f450c6ef6c fix(channel): preserve threaded streaming context 2026-03-31 19:26:07 +08:00
Jesse
8956df3668 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-31 19:26:07 +08:00
Paresh Mathur
0506e6c1c1 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-31 19:26:07 +08:00
npodbielski
b94d4c0509 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-31 19:26:07 +08:00
xcosmosbox
d0c68157b1 fix(WeiXin): fix full_url download error 2026-03-31 12:55:29 +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
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
xcosmosbox
2dce5e07c1 fix(weixin): fix test file version reader 2026-03-30 09:06:49 +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
xcosmosbox
1a4ad67628 feat(weixin): add voice message, typing keepalive, getConfig cache, and QR polling resilience 2026-03-29 21:28:58 +08:00