oudecheng
6fc6d5628f
perf(gateway): send_with_retry 对 ChannelFull 不重试,加速队列消费
...
ws 连接队列满时,sender task 原本重试 3 次浪费 1+2+4=7s,期间 channel 队列堆积。新增 ChannelError::ChannelFull 变体区分队列满错误,CliChannel::send 在 try_send Full 时返回该变体;send_with_retry 遇到 ChannelFull 立即返回不重试,sender task 记 warn(预期背压丢弃)而非 error。
- base.rs: 新增 ChannelFull 变体及 Display 实现
- cli.rs: try_send 错误区分 Full(ChannelFull,不可重试)与 Closed(SendError,可重试)
- outbound_dispatcher.rs: send_with_retry 短路返回 ChannelFull;run_sender_task 区分日志级别;新增 TestChannel.with_channel_full 及单测验证不重试(500ms 阈值内返回 + send 仅调用一次)
2026-08-05 11:14:53 +08:00
oudecheng
14d903e067
fix: Agent 执行与显示层解耦,修复锁屏冻结根因
...
浏览器锁屏导致 WebSocket 半死,ws_sender.send().await 永久阻塞,
级联阻塞 dispatcher → MessageBus → Agent Loop,后端停止执行直到解锁。
基于第一性原理建立"执行-显示解耦"原则:agent 执行只依赖 SQLite
持久化,实时广播是可丢弃的最佳努力通道。
核心改动:
- MessageBus::publish_outbound 由 send().await 改为 try_send(),
bus 满时丢弃消息并告警,agent 不再被显示层阻塞
- WebSocket writer task 包裹 30s 超时,使用每连接独立的
CancellationToken(非共享 CliChannel 级 token),避免一个连接
超时关闭所有连接;writer 退出时 cancel 通知主 loop 退出
- CliChannel::send 由 send().await 改为 try_send(),避免 dispatcher
单线程被卡住的 writer 阻塞 37s
- 全仓 13 处 publish_outbound 调用统一区分 Dropped(warn)/Closed(error)
- scheduler 3 处 ? 改为 warn,避免 Dropped 触发 misfire 重试风暴
- 前端 WebSocket 添加 25s ping + 指数退避重连(3s→60s封顶)
- 前端 session_list 区分重连恢复/首次连接,重连时保留 messages
并刷新 topic 列表
经五轮对抗性审查验证,修复了共享 cancel token、dispatcher 阻塞、
load_chat_messages 跨 topic 污染、原 session 删除后状态不一致等
回归问题。
同时升级版本号至 0.3.0 并更新 CHANGELOG。
验证:cargo clippy --all-targets --all-features ✓
npm run build ✓ | useChat.test.ts 13 passed ✓
2026-08-04 10:55:52 +08:00
oudecheng
cda14360af
chore: 建立工程化基线(rustfmt + clippy + CI + eslint + prettier)
...
配置:
- rustfmt.toml: 固化 max_width=100 / 4 空格缩进,cargo fmt 全量格式化
- Cargo.toml: 配置 [lints.rust] 与 [lints.clippy] 渐进式规则
- .github/workflows/ci.yml: Rust(fmt+clippy+test) + 前端(eslint+tsc+test) 双平台 CI
- Makefile: 新增 check/fmt/fix 目标,clippy 对齐 --all-targets --all-features
- web: eslint flat config + prettier 配置 + package.json 脚本与依赖
- src/main.rs: loop→while 修复 clippy::never_loop
对抗性审查发现并修复:
- eslint 缺 caughtErrorsIgnorePattern 导致 catch(_) 误报为 error
- 前端 lint 未接入 CI,现已补上 Lint 步骤
- Makefile 与 CI 的 clippy flags 不一致,已对齐
2026-08-03 23:24:02 +08:00
oudecheng
994db87f11
feat: 新增 ExecutionCompleted 信号修复发送按钮状态
...
- 后端 OutboundEventKind/WsOutbound 新增 ExecutionCompleted 变体
- processor 在 handle_message 完成后发送该信号
- 飞书/微信通道过滤该信号(不发送)
- 前端 useChat 移除 stream_delta/assistant_response 的 isLoading=false
- 改由 execution_completed 事件统一设置 isLoading=false,确保智能体迭代期间按钮保持停止态
2026-07-03 19:32:14 +08:00
oudecheng
7640a6e5b7
fix: 修复 WebSocket 连接泄漏,使用 CancellationToken 实现优雅重启
2026-07-03 16:32:43 +08:00
oudecheng
d2af01eb30
feat: 更新通道名称为 websocket,调整相关引用和逻辑
2026-07-03 10:58:24 +08:00
09dd15f557
feat(feishu): 支持引用回复消息 - 使用飞书 reply API (POST /im/v1/messages/{id}/reply) - 仅 AssistantResponse 使用回复接口,工具消息走普通发送 - 提取公共逻辑到 prepare_payload / check_send_response - 新增 reply_to_feishu_message / dispatch_send 方法
2026-06-14 14:15:21 +08:00
fc7df67474
feat(streaming): 支持流式文本增量与结束信号功能
...
- 新增 StreamDelta 和 StreamEnd 类型,支持流式数据增量传输
- 扩展 LLMProvider trait,添加带回调的 chat_with_streaming 接口
- 修改 OpenAI Provider 实现,支持流式聊天回调传输增量数据
- Agent 流处理改为异步消费增量消息并传递给前端
- 保证流式增量和最终消息使用相同消息 ID 以便前端替换
- 修改消息总线和协议层,支持携带和识别流式消息的消息 ID
- 客户端 CLI 通过增量输出实现交互式流式响应显示
- Web 前端接收流式增量消息,追加到对应消息,实现实时显示
- 各通道(飞书、微信)支持转发流式增量和结束消息
- 任务工具运行时添加消息 ID 支持,保持消息一致性
- 统一消息构造函数新增流式增量和结束信号的构建方法
2026-06-14 10:24:52 +08:00
6f33ec7604
feat: 多通道消息支持与 Session 选择器
...
后端:
- list_channels 从 ChannelManager 动态查询通道列表(合并 websocket + 所有已注册通道)
- build_channel_list 移至 ChannelManager,网关层直接依赖领域层
- get_current_topic 自动创建默认话题(修复微信等通道无话题的问题)
- is_channel_writable: 仅 websocket 可写,其余通道只读
前端:
- 右上角通道选择器 + Session 选择器(Portal 渲染,固定宽度居中)
- 只读通道显示刷新按钮替代新建按钮
- 话题列表时间戳修复(秒→毫秒)
- 移除冗余的 SessionInfo、AI Ready、所属会话等 UI
- 修复 scheduler view 路由无条件拦截消息的 bug
2026-06-06 22:25:10 +08:00
e36f66e23b
feat: 移除消息发送的速率限制逻辑,简化 WeChat 消息发送流程
2026-06-06 14:11:13 +08:00
b5a1635a05
feat: 实现消息发送的速率限制,确保同一用户之间的最小间隔
2026-06-06 10:57:40 +08:00
39072f724e
feat: 优化文本分割逻辑,避免在 markdown 表格和代码块中间拆分
2026-06-06 10:32:28 +08:00
c3bfe32fa3
feat: 实现长消息分块发送功能,优化 WeChat 消息传递
2026-06-06 10:24:55 +08:00
oudecheng
a783abd0e3
feat: 添加恢复代码块占位符的功能,优化文本处理逻辑
2026-06-03 08:54:08 +08:00
oudecheng
eebfe0faa5
feat: 增强错误处理和日志记录,优雅处理通道关闭情况
2026-06-02 15:23:50 +08:00
oudecheng
4cb26b5b67
feat: 子智能体任务消息查看,实时广播工具调用事件
...
- 新增 LoadTaskMessages 命令,加载子智能体任务的历史消息
- SubAgentEmitter 通过 MessageBus 实时广播子智能体工具调用
- 前端新增子智能体视图,支持导航进入/退出子智能体会话
- 外部渠道过滤子智能体事件,避免推送到飞书/微信
- ToolCall/ToolResult 新增 subagent_task_id 字段
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 11:15:38 +08:00
oudecheng
34011a6fa3
feat: 优化工具面板UI,外部渠道过滤工具消息
...
- 飞书/微信渠道不再推送 ToolResult/ToolPending 消息
- 聊天面板过滤 tool_call 消息,工具调用仅在工具面板展示
- 工具面板增加折叠预览、JSON格式化、状态动画等视觉优化
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 08:46:50 +08:00
oudecheng
3128abe3c6
feat: 优化 parse_post_content 函数,支持处理包含内容数组的代码块,并添加相关单元测试以确保向后兼容性
2026-05-21 17:17:44 +08:00
oudecheng
025c0b5d7f
feat: 添加 session_id 支持到 OutboundMessage,优化会话管理
2026-05-15 10:00:17 +08:00
oudecheng
f4758f8513
feat: 添加平台抽象层,支持跨平台兼容性;更新多个模块以使用临时目录和平台特定路径
2026-05-09 16:59:58 +08:00
42eb9f85d5
feat: 更新记忆工具使用说明,增加高价值场景记录要求;优化技能索引提示格式,支持 XML 标记
...
Co-authored-by: Copilot <copilot@github.com>
2026-05-06 17:22:01 +08:00
32690cb792
feat: 添加媒体下载功能,优化消息发送逻辑,记录发送信息
2026-05-06 14:42:46 +08:00
597881f72e
feat: Implement WeChatBot SDK with error handling and message protocol
...
- Add WeChatBotError enum for error handling with various error types.
- Create a Result type alias for easier error management.
- Implement ILinkClient for low-level API interactions including QR code generation, message sending, and updates retrieval.
- Define message types and structures for handling incoming messages and media content.
- Add tests for error handling and message parsing to ensure reliability.
Co-authored-by: Copilot <copilot@github.com>
2026-05-06 14:18:47 +08:00
260266b90f
feat: 添加会话消息发送工具,支持文本和附件的发送,优化消息发送逻辑
2026-05-02 09:15:36 +08:00
6756a3d0ae
feat: 添加 OutboundDispatcher 模块,重构消息分发逻辑,优化渠道消息处理
...
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 14:52:33 +08:00
8f27bd2735
feat: 重构工具和协议模块,添加工具注册和会话管理逻辑,优化消息处理
2026-04-28 14:16:30 +08:00
008aba91ac
feat: 重构调度器以使用 AgentTaskExecutor 和 SchedulerMaintenanceService
...
- 更新调度器,将 SessionManager 替换为 AgentTaskExecutor 和 SchedulerMaintenanceService。
- 修改作业执行逻辑,使用新服务处理代理任务和内部事件。
- 添加新的 CliChannel 以处理 CLI 连接,并包括适当的注册和注销逻辑。
- 引入 AgentTaskExecutor 和 SchedulerMaintenanceService,用于管理代理任务和会话维护。
- 实现聊天命令处理,用于重置会话上下文。
- 添加后台历史压缩功能,以优化会话存储。
- 创建实用函数,用于准备通过 WebSocket 通信的出站消息。
- 为新功能添加测试,并确保现有测试通过。
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 12:55:30 +08:00
73dab09bfe
Refactor code for improved readability and consistency
...
- Adjusted formatting and indentation in various files for better clarity.
- Consolidated multi-line statements into single lines where appropriate.
- Enhanced error handling messages for better debugging.
- Added a new InboundProcessor struct to handle inbound messages more effectively.
- Updated test cases to ensure they align with the new code structure.
2026-04-28 10:33:31 +08:00
4b74fabb98
feat: 添加字符计数和文本截断功能,增强文本处理能力
2026-04-24 14:34:06 +08:00
09ccd71cc7
feat(feishu): 优化文件下载文件名推断逻辑,支持从响应头和内容中提取文件名
2026-04-22 09:55:37 +08:00
a0fe7c57bd
feat(feishu): 支持 markdown 格式的消息处理,优化内容解析逻辑
2026-04-21 21:21:49 +08:00
dcf04279a7
feat(feishu): add reply context handling for messages and improve content fetching
2026-04-12 13:31:55 +08:00
3d72f3dfa8
feat(feishu): enhance message sending with dynamic format detection and support for interactive cards
2026-04-12 11:38:31 +08:00
21b4e60c44
feat(feishu): add reaction handling and metadata forwarding in messages
2026-04-08 10:24:15 +08:00
075b92f231
fix: truncate long text content before sending to Feishu
...
Feishu API rejects messages with content exceeding ~64KB with error
230001 "invalid message content". Added truncation at 60,000 characters
to prevent this, with a notice appended to truncated content.
2026-04-08 08:42:56 +08:00
2dada36bc6
feat: introduce multimodal content handling with media support
...
- Added ContentBlock enum for multimodal content representation (text, image).
- Enhanced ChatMessage struct to include media references.
- Updated InboundMessage and OutboundMessage to use MediaItem for media handling.
- Implemented media download and upload functionality in FeishuChannel.
- Modified message processing in the gateway to handle media items.
- Improved logging for message processing and media handling in debug mode.
- Refactored message serialization for LLM providers to support content blocks.
2026-04-07 23:09:31 +08:00
a051f83050
Refactor AgentLoop to manage history externally via SessionManager
...
- Removed internal history management from AgentLoop.
- Updated process method to accept conversation history as a parameter.
- Adjusted continue_with_tool_results to work with external history.
- Added OutboundDispatcher for handling outbound messages from MessageBus.
- Introduced InboundMessage and OutboundMessage structs for message handling.
- Updated Channel trait to include message handling and publishing to MessageBus.
- Refactored Session to manage chat histories instead of AgentLoop instances.
- Enhanced GatewayState to start message processing loops for inbound and outbound messages.
2026-04-07 21:53:37 +08:00
4ed2f986a1
添加 tracing 日志支持,替换 println! 输出,增强错误处理和调试信息
2026-04-06 23:11:41 +08:00
34ab439067
重构消息处理逻辑,添加 MessageHandler trait,支持多用户会话,更新 FeishuChannel 和 SessionManager,增强错误处理
2026-04-06 22:38:41 +08:00
04736f9f46
添加 Feishu 通道支持,重构配置以包含通道设置,更新依赖项,增强错误处理
2026-04-06 18:43:53 +08:00