Commit Graph

1313 Commits

Author SHA1 Message Date
Peixian Gong
805228e91e fix: add shell=True for npm subprocess calls on Windows
On Windows, npm is installed as npm.cmd (a batch script), not a direct
executable. When subprocess.run() is called with a list like
['npm', 'install'] without shell=True, Python's CreateProcess cannot
locate npm.cmd, resulting in:

  FileNotFoundError: [WinError 2] The system cannot find the file specified

This fix adds a sys.platform == 'win32' check before each npm subprocess
call. On Windows, it uses shell=True with a string command so the shell
can resolve npm.cmd. On other platforms, the original list-based call is
preserved unchanged.

Affected locations:
- _get_bridge_dir(): npm install, npm run build
- channels_login(): npm start

No behavioral change on Linux/macOS.
2026-03-14 17:19:01 +08:00
Protocol Zero
c9cc160600 merge: resolve PR #1796 conflicts with main
Merge the latest main branch into the Telegram media filename fix and keep the file_unique_id-based download path on top of the refactored media handling and newer Telegram tests.

Made-with: Cursor
2026-03-14 08:33:56 +00:00
Xubin Ren
af65145bc8 fix(qq): add configurable message format and onboard backfill 2026-03-14 08:25:44 +00:00
chengyongru
91d95f139e fix: cross-platform test compatibility
- test_channel_plugins: fix assertion logic for discoverable channels
- test_filesystem_tools: normalize path separators for Windows
- test_tool_validation: use python to generate output, avoid cmd line limits
2026-03-14 16:13:38 +08:00
Xubin Ren
dbdb43faff feat: channel plugin architecture with decoupled configs
- Add plugin discovery via Python entry_points (group: nanobot.channels)
- Move 11 channel Config classes from schema.py into their own channel modules
- ChannelsConfig now only keeps send_progress + send_tool_hints (extra=allow)
- Each built-in channel parses dict->Pydantic in __init__, zero internal changes
- All channels implement default_config() for onboard auto-population
- nanobot onboard injects defaults for all discovered channels (built-in + plugins)
- Add nanobot plugins list CLI command
- Add Channel Plugin Guide (docs/CHANNEL_PLUGIN_GUIDE.md)
- Fully backward compatible: existing config.json and sessions work as-is
- 340 tests pass, zero regressions
2026-03-14 16:13:38 +08:00
Xubin Ren
58389766a7 Merge PR #1981: chore: bump wecom-aibot-sdk-python to >=0.1.5
chore: bump wecom-aibot-sdk-python to >=0.1.5
2026-03-13 23:42:43 +08:00
chengyongru
1e163d615d chore: bump wecom-aibot-sdk-python to >=0.1.5
- Includes bug fixes for duplicate recv loops
- Handles disconnected_event properly
- Fixes heartbeat timeout
2026-03-13 18:45:41 +08:00
nne998
a8fbea6a95 cleanup 2026-03-13 16:53:57 +08:00
nne998
e3cb3a814d cleanup 2026-03-13 15:14:26 +08:00
nne998
aac076dfd1 add uvlock to .gitignore 2026-03-13 15:11:01 +08:00
mru4913
670d2a6ff8 feat(feishu): implement message reply/quote support
- Add `reply_to_message: bool = False` config to `FeishuConfig`
- Parse `parent_id` and `root_id` from incoming events into metadata
- Fetch quoted message content via `im.v1.message.get` and prepend
  `[Reply to: ...]` context for the LLM when a user quotes a message
- Add `_reply_message_sync` using `im.v1.message.reply` API so the
  bot's response appears as a threaded quote in Feishu
- First outbound message uses reply API; subsequent chunks fall back
  to `create` to avoid duplicate quote bubbles; progress messages
  always use `create`
- Add 19 unit tests covering all new code paths
2026-03-13 15:02:57 +08:00
Tony
2787523f49 fix: prevent empty </think> tags from appearing in messages
- Enhance _strip_think to handle stray tags:
  * Remove unmatched closing tags (</think>)
  * Remove incomplete blocks (<think> ... to end of string)
- Apply _strip_think to tool hint messages as well
- Prevents blank/parse errors from showing </think> in chat outputs

Fixes issue with empty </think> appearing in Feishu tool call cards and other messages.
2026-03-13 14:55:34 +08:00
Tony
87ab980bd1 refactor(feishu): extract tool hint card sending into dedicated method
- Extract card creation logic into _send_tool_hint_card() helper
- Improves code organization and testability
- Update tests to use pytest.mark.asyncio for cleaner async testing
- Remove redundant asyncio.run() calls in favor of native async test functions
2026-03-13 14:52:15 +08:00
Tony
82064efe51 feat(feishu): improve tool call card formatting for multiple tools
- Format multiple tool calls each on their own line
- Change title from 'Tool Call' to 'Tool Calls' (plural)
- Add explicit 'text' language for code block
- Improves readability and supports displaying longer content
- Update tests to match new formatting
2026-03-13 14:48:36 +08:00
Tony
7261bd8c3f feat(feishu): display tool calls in code block messages
- Tool hint messages with _tool_hint metadata now render as formatted code blocks
- Uses Feishu interactive card message type with markdown code fences
- Shows "Tool Call" header followed by code in a monospace block
- Adds comprehensive unit tests for the new functionality

Co-Authorship-Bot: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 14:43:47 +08:00
Tony
df89bd2dfa feat(feishu): display tool calls in code block messages
- Add special handling for tool hint messages (_tool_hint metadata)
- Send tool calls using Feishu's "code" message type with formatting
- Tool calls now appear as formatted code snippets in Feishu chat
- Add unit tests for the new functionality

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 14:41:54 +08:00
Tony
6ec56f5ec6 cleanup 2026-03-13 14:09:38 +08:00
Tony
e977d127bf ignore .DS_Store 2026-03-13 14:08:10 +08:00
Tony
da740c871d test 2026-03-13 14:06:22 +08:00
Xubin Ren
65cbd7eb78 docs: update web search configuration instruction 2026-03-13 05:54:51 +00:00
Tony
d286926f6b feat(memory): implement async background consolidation
Implement asynchronous memory consolidation that runs in the background when
sessions are idle, instead of blocking user interactions after each message.

Changes:
- MemoryConsolidator: Add background task management with idle detection
  * Track session activity timestamps
  * Background loop checks idle sessions every 30s
  * Consolidation triggers only when session idle > 60s
- AgentLoop: Integrate background task lifecycle
  * Start consolidation task when loop starts
  * Stop gracefully on shutdown
  * Record activity on each message
- Refactor maybe_consolidate_by_tokens: Keep sync API but schedule async
- Add debug logging for consolidation completion

Benefits:
- Non-blocking: Users no longer wait for consolidation after responses
- Efficient: Only consolidate idle sessions, avoiding redundant work
- Scalable: Background task can process multiple sessions efficiently
- Backward compatible: Existing API unchanged

Tests: 11 new tests covering background task lifecycle, idle detection,
scheduling, and error handling. All passing.

🤖 Generated with Claude Code
2026-03-13 13:52:36 +08:00
Xubin Ren
3040102c02 Merge PR #398: multi-provider web search 2026-03-13 05:44:16 +00:00
Xubin Ren
ca5047b602 feat(web): multi-provider web search + Jina Reader fetch 2026-03-13 05:44:16 +00:00
Xubin Ren
511a335e82 Merge branch 'main' into pr-398 2026-03-13 05:12:10 +00:00
Xubin Ren
04b45e0e5c Merge PR #1920: langsmith integration 2026-03-13 04:54:22 +00:00
Xubin Ren
20b4fb3bff fix: langsmith callback 防覆盖 + 加 optional dep 2026-03-13 04:54:22 +00:00
Xubin Ren
da325e4532 Merge branch 'main' into pr-1920 2026-03-13 04:20:14 +00:00
Xubin Ren
3ee80b000c Merge PR #1949: docs: correct BaiLian dashscope apiBase endpoint
docs: correct BaiLian dashscope apiBase endpoint
2026-03-13 12:18:00 +08:00
Xubin Ren
bd4ec46681 merge: PR #1916 add CI workflow + fix matrix init + test cleanup 2026-03-13 04:05:11 +00:00
Xubin Ren
84b107cf6c fix(ci): upgrade setup-python, add system deps, simplify test assertions 2026-03-13 04:05:08 +00:00
Xubin Ren
4b50a7b6c0 Merge branch 'main' into pr-1916 2026-03-13 03:57:09 +00:00
Xubin Ren
2490af99d4 merge: PR #1810 validate save_memory payload + raw-archive fallback 2026-03-13 03:54:53 +00:00
Xubin Ren
6d3a0ab6c9 fix(memory): validate save_memory payload and raw-archive on repeated failure
- Require both history_entry and memory_update, reject null/empty values
- Fallback to tool_choice=auto when provider rejects forced function call
- After 3 consecutive consolidation failures, raw-archive messages to
  HISTORY.md without LLM summarization to prevent context window overflow
2026-03-13 03:53:50 +00:00
Xubin Ren
60c29702cc Merge branch 'main' into pr-1810
# Conflicts:
#	nanobot/agent/memory.py
#	tests/test_memory_consolidation_types.py
2026-03-13 03:29:16 +00:00
Xubin Ren
62a2e71748 Merge PR #1958: fix(restart): use -m nanobot for Windows compatibility
fix(restart): use -m nanobot for Windows compatibility
2026-03-13 11:19:57 +08:00
Xubin Ren
4f77b9385c fix(memory): fallback to tool_choice=auto when provider rejects forced function call
Some providers (e.g. Dashscope in thinking mode) reject object-style
tool_choice with "does not support being set to required or object".
Retry once with tool_choice="auto" instead of failing silently.

Made-with: Cursor
2026-03-13 03:18:08 +00:00
Xubin Ren
e30d19e94d merge: PR #1919 reorder Hatch build tables in pyproject 2026-03-13 03:07:27 +00:00
Xubin Ren
4f05e30331 Merge remote-tracking branch 'origin/main' into pr-1919 2026-03-13 03:02:17 +00:00
chengyongru
6ad30f12f5 fix(restart): use -m nanobot for Windows compatibility
On Windows, sys.argv[0] may be just "nanobot" without full path when
running from PATH. os.execv() doesn't search PATH, causing restart to
fail with "No such file or directory".

Fix by using `python -m nanobot` instead of relying on sys.argv[0].

Fixes #1937
2026-03-13 11:01:01 +08:00
Xubin Ren
ba045f56d8 Merge PR #1941: fix(qq): restore plain text replies for legacy clients
fix(qq): restore plain text replies for legacy clients
2026-03-13 10:57:58 +08:00
Xubin Ren
aab909e936 Merge PR #1953: fix: catch BaseException in MCP connection to handle CancelledError
fix: catch BaseException in MCP connection to handle CancelledError
2026-03-13 10:57:11 +08:00
Xubin Ren
fb9d54da21 docs: update .gitignore to add .docs 2026-03-13 02:41:52 +00:00
chengyongru
127ac39063 fix: catch BaseException in MCP connection to handle CancelledError 2026-03-13 10:23:15 +08:00
Frank
d48dd00682 docs: correct BaiLian dashscope apiBase endpoint 2026-03-12 18:23:05 -07:00
Frank
a09245e919 fix(qq): restore plain text replies for legacy clients 2026-03-12 12:48:25 -07:00
Re-bin
774452795b fix(memory): use explicit function name in tool_choice for DashScope compatibility 2026-03-12 16:09:24 +00:00
Re-bin
109ae13301 Merge PR #1930: fix async interactive CLI formatting with prompt_toolkit 2026-03-12 15:38:39 +00:00
Re-bin
3fa62e7fda fix: remove duplicate dim/arrow prefix in interactive progress line 2026-03-12 15:38:39 +00:00
Re-bin
48c74a11d4 Merge remote-tracking branch 'origin/main' into pr-1930 2026-03-12 15:28:57 +00:00
Re-bin
ab087ed05f Merge PR #1608: add VolcEngine/BytePlus providers and improve local provider auto-selection 2026-03-12 15:22:15 +00:00