65 Commits

Author SHA1 Message Date
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
e37dea886b refactor(tools): 优化交互式进程输出捕获逻辑
- 删除了 PendingUserAction 相关的冗余辅助消息发送代码
- 引入自适应 drain_until_stable 函数循环读取输出直到稳定
- 用 drain_until_stable 替代固定延时等待以捕获最终提示内容
- 确保进程等待 stdin 时完整且及时地捕获所有输出数据
- 移除过时的常量和注释,简化代码逻辑
- 保持对最大循环次数和间隔时间的限制防止死循环
2026-06-13 17:40:44 +08:00
640829ce52 fix(agent): 优化等待工具输出内容的提取逻辑
- 跳过标记行、session_id元数据和空行
- 跳过提示行,提取提示行之后的实际内容
- 限制提取内容最多20行,防止消息过长
- 当提取内容为空时,使用默认提示消息
- 改善助手消息的显示内容格式
2026-06-13 17:40:30 +08:00
988e77123c feat: 精简日志记录,移除冗余信息,优化调试输出 2026-06-06 10:41:52 +08:00
fb90641774 feat: 增强日志记录,添加消息处理和工具执行的详细信息 2026-06-06 09:26:50 +08:00
oudecheng
d1d4998a26 feat: 增加工具结果字符限制,提升处理能力至 100,000 字符 2026-06-04 17:33:01 +08:00
oudecheng
2f529e96d0 feat: 添加滚动控制功能,支持回到顶部和回到底部的按钮 2026-06-04 16:00:43 +08:00
oudecheng
1b571e943f feat: 添加停止当前执行的 Agent 功能,支持通过 /stop 命令取消执行 2026-06-03 16:49:29 +08:00
oudecheng
a11fdac86a feat: 优化消息历史清理逻辑,支持移除任意位置的未完成工具调用序列 2026-06-03 15:14:18 +08:00
oudecheng
cb58d9f3f0 feat: 清理消息历史中不完整的 tool call 序列
新增 sanitize_incomplete_tool_call_sequences() 方法,移除末尾
缺少对应 tool result 的 assistant tool_calls 消息。解决进程中断
导致部分 tool call 序列残留、进而引发 API 报错的问题。

同时清理因父消息被移除而残留的孤儿 tool result 消息。
2026-06-02 20:40:05 +08:00
oudecheng
4d6d989247 feat: 添加工具执行时长字段,增强消息处理功能 2026-06-02 16:52:47 +08:00
oudecheng
f8fc0f7d0f feat: 添加工具结果处理功能,支持执行时长记录和显示 2026-06-02 16:15:05 +08:00
oudecheng
06756a4816 fix: 修复消息持久化缺失 topic 关联和 assistant 文本丢失
- PersistingEmittedMessageHandler 新增 topic_id 参数,使用 append_message_with_topic 替代 append_message
- agent_loop 的所有退出路径中为最终 assistant 文本添加 emit_live_tool_call_message
- 更新 finalize_result filter,live_emitter 存在时抑制所有消息的 post-loop 广播

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 18:09:00 +08:00
oudecheng
d0051baa07 refactor: 消息持久化从批量改为实时逐条,通过装饰器模式实现
- 新增 PersistingEmittedMessageHandler 装饰器,在 emitter 广播前逐条落库
- processor 和 task/runtime 使用装饰器包裹 emitter,替代 post-loop 批量写入
- 移除 session_history 中的批量 DB 写入,仅保留内存历史更新
- execution 中跳过已由 live emitter 实时广播的工具消息,避免重复
- 前端支持运行中 task 工具卡片"查看实时进度"跳转子智能体视图

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-29 16:47:57 +08:00
oudecheng
5e5de7ce9f refactor: 移除 show_tool_results 开关,始终实时推送工具调用消息
简化工具消息推送逻辑,去掉条件判断,让所有工具消息(含结果)
直接通过 emit_live_tool_call_message 实时发送给用户。

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-28 18:52:40 +08:00
oudecheng
624d8e8943 feat: 添加 React Web UI 前端界面
- 使用 React 18 + TypeScript + Vite + Tailwind CSS 构建前端
- 实现 WebSocket 实时通信(useWebSocket hook)
- 添加聊天界面组件(MessageList, MessageBubble, MessageInput)
- 集成 Topic 管理(新建、列出、切换)
- 支持 Markdown 渲染(react-markdown + remark-gfm)
- 添加工具调用展示面板
- 实现深色科技主题(Tech Dark)
- 后端集成静态文件服务(tower-http)
- 添加 Makefile 和 build.sh 构建脚本
- 更新 .gitignore 忽略前端构建产物

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 17:43:15 +08:00
b571d7b7b3 feat: 添加图片上下文限制配置,支持最大图片数量和消息轮次限制 2026-05-24 18:06:22 +08:00
oudecheng
159c1bbb7a feat: 移除日志中的响应内容和模型信息,优化工具调用的日志记录 2026-05-21 17:20:26 +08:00
oudecheng
efc8af12eb feat: 添加参数提取工具函数,支持处理字符串化 JSON 数组,优化技能管理和会话发送功能 2026-05-21 17:00:22 +08:00
oudecheng
7540828397 Revert "feat: 添加流式聊天支持,更新相关依赖和接口以实现流式响应"
This reverts commit cb48ef09b22ef72798a15ff3485c8e21f77e59f4.
2026-05-20 09:20:26 +08:00
oudecheng
cb48ef09b2 feat: 添加流式聊天支持,更新相关依赖和接口以实现流式响应 2026-05-20 09:10:47 +08:00
6b5d45e3a5 feat: 添加探索类型最大执行时间配置,优化子代理任务执行逻辑 2026-05-16 17:05:03 +08:00
oudecheng
1c1efcabf4 feat: 移除冗余的 provider_config 字段,优化 AgentFactory 和 Session 的构造逻辑 2026-05-13 15:41:52 +08:00
oudecheng
a06fceaf0c feat: 添加系统提示词提供者,支持动态注入和组合多个提示词源 2026-05-13 14:55:50 +08:00
9d9fa1dc4b feat: 添加 memory_maintenance_timeout_secs 配置,优化内存维护超时设置 2026-05-12 22:11:34 +08:00
oudecheng
4473c9fc47 feat: 增强参数截断逻辑,确保在截断时遵循UTF-8字符边界,并添加相关单元测试 2026-05-12 17:44:39 +08:00
181740559b feat: 移除不再使用的记忆工具提示,更新默认代理配置中的记忆处理规则 2026-05-10 14:17:45 +08:00
495c8cdc7e feat: 添加技能匹配摘要功能,优化技能提示信息,明确技能与工具的区别
Co-authored-by: Copilot <copilot@github.com>
2026-05-02 09:38:31 +08:00
531e72d24f feat: 添加图像处理预算和估算逻辑,优化消息内容构建,支持图像媒体引用
Co-authored-by: Copilot <copilot@github.com>
2026-05-01 21:22:07 +08:00
716d92a618 feat: 引入 AgentRuntimeConfig,重构相关模块以支持运行时配置
Co-authored-by: Copilot <copilot@github.com>
2026-04-30 22:34:22 +08:00
90e44950cb feat: 重构技能事件处理逻辑,移除 SkillEventSink,添加 SkillActivateTool 模块以优化技能激活流程
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 15:31:56 +08:00
396504dffb Refactor agent and storage components to introduce SkillProvider and repository patterns
- Introduced `SkillProvider` trait to abstract skill-related functionalities.
- Replaced `SkillRuntime` with `EmptySkillProvider` in `AgentLoop` for default behavior.
- Updated `AgentFactory` to accept `SkillProvider` instead of `SkillRuntime`.
- Created `SessionHistory` struct to manage chat histories and interactions.
- Added `MemoryRepository`, `SchedulerJobRepository`, and `SkillEventRepository` traits for better storage abstraction.
- Refactored tools to use new repository traits for memory and scheduler management.
- Cleaned up session management logic by consolidating chat history handling into `SessionHistory`.

Co-authored-by: Copilot <copilot@github.com>
2026-04-28 15:12:45 +08:00
c547b88a12 feat: 添加持久化技能事件处理逻辑,重构技能事件记录机制
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 14:49:31 +08:00
af7860f2fd feat: 重构消息模块,添加 ContentBlock 和 ToolCall 结构,优化消息处理逻辑
Co-authored-by: Copilot <copilot@github.com>
2026-04-28 14:04:59 +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
ed45ec54ed feat: 增强错误处理,添加format_error_chain函数以格式化错误链,优化日志记录 2026-04-27 09:35:10 +08:00
fc8a0aa6ae feat: 添加normalize_tool_arguments函数以解析字符串化的JSON参数,优化工具调用的参数处理 2026-04-27 09:29:50 +08:00
95c53fa830 feat: 添加推理内容支持到聊天消息,增强消息处理能力 2026-04-24 17:42:19 +08:00
4b74fabb98 feat: 添加字符计数和文本截断功能,增强文本处理能力 2026-04-24 14:34:06 +08:00
ab7a8ad924 feat(media): 添加媒体引用处理,增强用户内容的丰富性 2026-04-23 22:31:13 +08:00
7fefd40dca feat: 重构记忆工具提示和代理配置,增强用户指导和系统提示 2026-04-23 17:33:10 +08:00
f3f369b329 feat: add llm_timeout_secs to provider configuration and implement timeout handling
- Introduced llm_timeout_secs in ProviderConfig and LLMProviderConfig to specify timeout for LLM requests.
- Updated OpenAIProvider and AnthropicProvider to utilize the timeout setting when creating HTTP clients.
- Enhanced error handling for API responses to include timeout information.
- Modified SessionManager to support agent-specific provider configurations, allowing for more flexible agent management.
- Added tests to verify the correct behavior of timeout settings and agent task validation.
2026-04-23 09:23:15 +08:00
73840c608c feat(memory): 更新长期记忆工具提示,增强用户使用指导和检索流程
feat(gateway): 修改 WebSocket 处理逻辑以支持会话 ID 的字符串处理
2026-04-22 23:40:11 +08:00
a3ae8acde5 feat: add DB-backed scheduler for heartbeat, delayed jobs, interval jobs, and cron jobs
- Add scheduler module with SQLite persistence
- Support schedule types: delay, interval, at, cron
- Support job kinds: internal_event, outbound_message
- Add scheduler_manage tool for runtime management
- Add session_cleanup internal event for expired sessions
- Update memory tool usage prompt for better context awareness
- Add chrono and cron dependencies
2026-04-22 20:32:18 +08:00
65abf017a1 feat(gateway): 添加 show_tool_results 配置以控制工具结果显示
feat(memory): 更新 MemoryManageTool 和 MemorySearchTool 描述,优化参数处理
2026-04-22 15:27:53 +08:00
0331774466 feat: 更新长期记忆工具提示,增强用户使用指导 2026-04-22 15:06:11 +08:00
71a8033d15 feat(memory): 添加 MemorySearchTool 以支持长期用户记忆的搜索和读取功能 2026-04-22 14:52:16 +08:00
038b5eccc6 feat: Enhance tool execution handling with pending user action state
- Introduced ToolMessageState enum to represent tool execution states (Completed, PendingUserAction).
- Updated ChatMessage struct to include tool_state for tracking tool execution status.
- Modified AgentLoop to handle tool results and pending actions, providing appropriate responses to users.
- Enhanced BashTool to detect when commands require user interaction, returning a pending state with hints.
- Updated WebSocket protocol to support tool pending messages, allowing clients to handle pending actions effectively.
- Refactored related tests to ensure proper functionality of new pending state handling.
2026-04-22 14:49:50 +08:00
30d033e1d1 feat(agent_loop): 优化工具结果截断逻辑,确保正确处理UTF-8字符边界 2026-04-22 13:03:23 +08:00
9cda2ab8d5 feat(memory_manage): 更新记忆管理工具描述,增强搜索关键词的双语支持和内容匹配说明 2026-04-22 11:37:15 +08:00