47 Commits

Author SHA1 Message Date
chengjun.zhu
9c19de67bf fix: 错误消息流转路径:1. 当 LLM 服务出现临时性错误(如网络波动、超时、429限流等)时, base.py 中的 _run_with_retry 方法会启动重试机制。2. 在重试等待期间, _sleep_with_heartbeat 方法会周期性调用 on_retry_wait 回调函数,发送类似 'Model request failed, retry in 1s (attempt 1)' 的心跳消息。3. 之前 on_retry_wait 参数被错误地绑定到 _bus_progress ,导致这些内部诊断消息被当作普通进度消息发送到飞书客户端。4. manager.py 的消息分发器没有过滤这类重试心跳消息。 修复方案:1. loop.py - 新增重试等待回调- 新增独立的 _on_retry_wait 回调函数,为重试消息添加 _retry_wait: True 元数据标识- 在 AgentRunSpec 中传入 retry_wait_callback 参数。2. runner.py - 支持重试回调参数- 在 AgentRunSpec 数据类中新增 retry_wait_callback 字段- 在 _build_request_kwargs 中将 on_retry_wait 参数从 progress_callback 改为 retry_wait_callback。3. manager.py - 过滤重试心跳消息- 在 _dispatch_outbound 方法中新增过滤逻辑,丢弃所有带 _retry_wait 标识的消息,确保重试心跳不会发送到任何客户端。 2026-04-18 13:50:05 +08:00
flobo3
0401ca9dbc fix: pass apiBase from config to GroqTranscriptionProvider 2026-04-17 13:46:51 +08:00
Xubin Ren
1f33df1ea6 fix: preserve empty dict allow_from handling
Keep dict-backed channel configs compatible with both allow_from and allowFrom without losing empty-list semantics, and add focused regression coverage for the allow-list boundary.

Made-with: Cursor
2026-04-15 01:26:51 +08:00
samy
73cf9a220b fix: handle dict config in is_allowed() and _validate_allow_from()
getattr() on a dict never finds custom keys — it only searches
object attributes, not dict keys. When channel config is loaded as
a Pydantic extra field (which is a plain dict), getattr(config,
'allow_from', []) always returns the default [], causing all access
to be denied regardless of the allowFrom configuration.

Fix both is_allowed() and _validate_allow_from() to use isinstance
checks, falling back to dict.get() for dict configs while preserving
getattr() for object-style configs.
2026-04-15 01:26:51 +08:00
Xubin Ren
019eaff225 simplify: remove transcription fallback, respect explicit config
Configured provider is the only one used — no silent fallback.

Made-with: Cursor
2026-04-06 06:13:43 +00:00
Xubin Ren
3bf1fa5225 feat: auto-fallback to other transcription provider on failure
When the primary transcription provider fails (bad key, API error, etc.),
automatically try the other provider if its API key is available.

Made-with: Cursor
2026-04-06 06:10:08 +00:00
Xubin Ren
35dde8a30e refactor: unify voice transcription config across all channels
- Move transcriptionProvider to global channels config (not per-channel)
- ChannelManager auto-resolves API key from matching provider config
- BaseChannel gets transcription_provider attribute, no more getattr hack
- Remove redundant transcription fields from WhatsAppConfig
- Update README: document transcriptionProvider, update provider table

Made-with: Cursor
2026-04-06 06:07:30 +00:00
imfondof
896d578677 fix(restart): show restart completion with elapsed time across channels 2026-04-04 02:21:42 +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
Xubin Ren
f0f0bf02d7 refactor(channel): centralize retry around explicit send failures
Make channel delivery failures raise consistently so retry policy lives in ChannelManager rather than being split across individual channels. Tighten Telegram stream finalization, clarify sendMaxRetries semantics, and align the docs with the behavior the system actually guarantees.
2026-03-25 22:37:11 +08:00
chengyongru
5e9fa28ff2 feat(channel): add message send retry mechanism with exponential backoff
- Add send_max_retries config option (default: 3, range: 0-10)
- Implement _send_with_retry in ChannelManager with 1s/2s/4s backoff
- Propagate CancelledError for graceful shutdown
- Fix telegram send_delta to raise exceptions for Manager retry
- Add comprehensive tests for retry logic
- Document channel settings in README
2026-03-25 22:37:11 +08:00
Xubin Ren
bd621df57f feat: add streaming channel support with automatic fallback
Provider layer: add chat_stream / chat_stream_with_retry to all providers
(base fallback, litellm, custom, azure, codex). Refactor shared kwargs
building in each provider.

Channel layer: BaseChannel gains send_delta (no-op) and supports_streaming
(checks config + method override). ChannelManager routes _stream_delta /
_stream_end to send_delta, skips _streamed final messages.

AgentLoop._dispatch builds bus-backed on_stream/on_stream_end callbacks
when _wants_stream metadata is set. Non-streaming path unchanged.

CLI: clean up spinner ANSI workarounds, simplify commands.py flow.
Made-with: Cursor
2026-03-23 10:20:41 +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
Re-bin
254cfd48ba refactor: auto-discover channels via pkgutil, eliminate hardcoded registry 2026-03-11 14:23:19 +00:00
Re-bin
d0b4f0d70d feat(wecom): add WeCom channel with SDK pinned to GitHub tag v0.1.2 2026-03-11 07:57:12 +00:00
chengyongru
a660a25504 feat(wecom): add wecom channel [wobsocket]
support text/audio[wecom support audio message by default]
2026-03-09 22:46:35 +08:00
chengyongru
215360113f feat(feishu): add audio transcription support using Groq Whisper 2026-03-07 16:21:52 +08:00
Re-bin
bbfc1b40c1 security: deny-by-default allowFrom with wildcard support and startup validation 2026-03-02 06:13:37 +00:00
JK_Lu
977ca725f2 style: unify code formatting and import order
- Remove trailing whitespace and normalize blank lines
- Unify string quotes and line breaks for long lines
- Sort imports alphabetically across modules
2026-02-28 20:55:43 +08:00
Tanish Rajput
568a54ae3e Initialize Matrix channel in ChannelManager when enabled in config 2026-02-27 11:39:01 +05:30
Re-bin
df2c837e25 feat(channels): split send_progress into send_progress + send_tool_hints 2026-02-23 07:12:41 +00:00
Yingwen Luo-LUOYW
0c412b3728 feat(channels): add send_progress option to control progress message delivery
Add a boolean config option `channels.sendProgress` (default: false) to
control whether progress messages (marked with `_progress` metadata) are
sent to chat channels. When disabled, progress messages are filtered
out in the outbound dispatcher.
2026-02-23 09:41:13 +08:00
Re-bin
37252a4226 fix: complete loguru native formatting migration across all files 2026-02-20 07:55:34 +00:00
Nikolas de Hor
53b83a38e2 fix: use loguru native formatting to prevent KeyError on messages containing curly braces
Closes #857
2026-02-19 17:19:36 -03:00
Re-bin
903caaa642 feat: unified slash commands (/new, /help) across all channels 2026-02-13 03:30:21 +00:00
Re-bin
d1f0615282 resolve conflicts with main; remove test_mochat_channel.py 2026-02-10 06:52:52 +00:00
Re-bin
2c45657b14 resolve merge conflicts: keep all channels and add QQ 2026-02-09 11:58:38 +00:00
Re-bin
74e3c411a1 resolve merge conflicts: keep all channels and add slack 2026-02-09 11:17:07 +00:00
tjb-tech
ef7972b6d3 Merge origin/main into feat/mochat-channel 2026-02-09 09:01:25 +00:00
tjb-tech
3779225917 refactor(channels): rename moltchat integration to mochat 2026-02-09 08:50:17 +00:00
tjb-tech
20b8a2fc58 feat(channels): add Moltchat websocket channel with polling fallback 2026-02-09 08:46:47 +00:00
yinwm
34dc933fce feat: add QQ channel integration with botpy SDK
Add official QQ platform support using botpy SDK with WebSocket connection.

Features:
- C2C (private message) support via QQ Open Platform
- WebSocket-based bot connection (no public IP required)
- Message deduplication with efficient deque-based LRU cache
- User whitelist support via allow_from configuration
- Clean async architecture using single event loop

Changes:
- Add QQChannel implementation in nanobot/channels/qq.py
- Add QQConfig schema with appId and secret fields
- Register QQ channel in ChannelManager
- Update README with QQ setup instructions
- Add qq-botpy dependency to pyproject.toml
- Add botpy.log to .gitignore

Setup:
1. Get AppID and Secret from q.qq.com
2. Configure in ~/.nanobot/config.json:
   {
     "channels": {
       "qq": {
         "enabled": true,
         "appId": "YOUR_APP_ID",
         "secret": "YOUR_APP_SECRET",
         "allowFrom": []
       }
     }
   }
3. Run: nanobot gateway

Note: Group chat support will be added in future updates.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-02-09 15:54:14 +08:00
Re-bin
994f5601e9 resolve merge conflicts: keep both dingtalk and email channels 2026-02-09 06:02:36 +00:00
Re-bin
499f602223 Merge branch 'main' into pr-219 2026-02-08 17:34:06 +00:00
Re-bin
f7f812a177 feat: add /reset and /help commands for Telegram bot 2026-02-08 05:06:41 +00:00
w0x7ce
240db894b4 feat(channels): add DingTalk channel support and documentation 2026-02-08 11:58:49 +08:00
alan
3166c15cff feat: add telegram proxy support and add error handling for channel startup 2026-02-07 20:37:41 +08:00
张涔熙
cfe43e4920 feat(email): add consent-gated IMAP/SMTP email channel 2026-02-07 11:08:30 +08:00
Re-bin
71fc73ecc4 resolve conflicts with main 2026-02-06 07:08:29 +00:00
Kamal
051e396a8a feat: add Slack channel support 2026-02-04 23:26:20 +05:30
tao.jun
50fa024ab4 feishu support 2026-02-04 14:07:45 +08:00
Anunay Aatipamula
7d2bebcfa3
Merge branch 'main' into feat/discord-support 2026-02-03 21:15:15 +05:30
Re-bin
8989adc9ae refactor: use explicit dependency injection for groq_api_key 2026-02-03 06:36:58 +00:00
Anunay Aatipamula
ba6c4b748f feat(discord): add Discord channel support
- Implement Discord channel functionality with websocket integration.
- Update configuration schema to include Discord settings.
- Enhance README with setup instructions for Discord integration.
- Modify channel manager to initialize Discord channel if enabled.
- Update CLI status command to display Discord channel status.
2026-02-02 18:41:17 +05:30
Manus AI
42f62c0c1a feat: add voice transcription support with groq (fixes #13) 2026-02-02 04:33:26 -05:00
Re-bin
d4cc48afd5 🐈nanobot: hello world! 2026-02-01 07:36:42 +00:00