35 Commits

Author SHA1 Message Date
oudecheng
4866ea9538 fix: todo_write 持久化从 finalize_result 移到 BusToolCallEmitter,即时触发
之前持久化挂在 agent 全部完成后,长任务永远等不到。
现在每个 todo_write 工具调用完成时立即持久化到 SQLite。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-12 16:58:05 +08:00
eeea7d44d0 feat: 添加 topic_id 支持,确保消息按话题隔离 2026-06-07 17:49:22 +08:00
3a623cc8a3 fix: 修复话题描述更新逻辑的竞态条件和语义错误,前端自动刷新描述
- topic_description.rs: LLM 返回空字符串时返回 Err 而非 Ok(""),防止空值写回 DB 触发循环生成
- processor.rs: 添加 Arc<Mutex<HashSet>> 生成中守卫防止重复触发,改用 DB 中真正第一条用户消息生成描述
- useChat.ts: assistant_response 时检测当前话题描述为空则递增刷新信号
- App.tsx: 监听刷新信号,500ms 防抖后自动发送 list_topics 获取新描述
2026-06-07 16:52:44 +08:00
b5e2886068 feat: 添加删除话题功能,包括命令处理器和前端交互 2026-06-07 14:09:14 +08:00
oudecheng
1d4ebb27a7 feat: 更新 StopExecution 命令和 CancelManager,支持按话题取消 Agent 执行 2026-06-03 18:13:15 +08:00
oudecheng
1b571e943f feat: 添加停止当前执行的 Agent 功能,支持通过 /stop 命令取消执行 2026-06-03 16:49:29 +08:00
oudecheng
eebfe0faa5 feat: 增强错误处理和日志记录,优雅处理通道关闭情况 2026-06-02 15:23:50 +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
542e11d0b3 refactor: 将 Session 命令重构为 Topic 命令
- 新增 LoadTopic 命令处理器,替代 LoadSession
- 新增 SwitchTopic 命令处理器,替代 SwitchSession
- 删除 LoadSession 和 SwitchSession 处理器
- 更新 Command 枚举:LoadSession -> LoadTopic, SwitchSession -> SwitchTopic
- 同步更新前端协议类型定义
- 调整适配器和网关代码以适应新命令

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-27 16:01:07 +08:00
0732b31e6b feat: 添加主题描述生成和更新功能,优化会话信息展示 2026-05-24 08:32:34 +08:00
oudecheng
49475783a2 feat: 添加子智能体支持到保存话题和会话功能,优化数据持久化 2026-05-20 17:52:46 +08:00
oudecheng
90228a4d49 feat: 更新 GetCurrentSessionCommandHandler,添加系统提示词提供者支持并优化令牌估算逻辑 2026-05-19 18:29:32 +08:00
oudecheng
2d5b6168cc feat: 添加会话管理器支持到 GetCurrentSessionCommandHandler,并重构从会话获取消息的逻辑 2026-05-19 17:42:47 +08:00
oudecheng
cd97ac0f57 feat: 更新 save_topic 处理器以支持从会话获取历史消息,并在命令处理器中配置会话管理器 2026-05-19 17:11:23 +08:00
831832664d feat: 重构会话管理逻辑,添加获取当前话题的方法,简化命令处理中的会话获取逻辑 2026-05-16 20:19:49 +08:00
3591822145 feat: add /help command to display all supported commands
- Implemented HelpCommandHandler to handle the /help command.
- Added CommandMetadata struct to store command metadata.
- Registered new command handlers for GetCurrentSession, ListSessions, LoadSession, and SwitchSession.
- Updated existing command handlers to provide metadata for help command.
- Removed deprecated SessionQueryCommandHandler.
- Added new command handlers for listing sessions and loading sessions.
2026-05-16 19:48:39 +08:00
20f32a3f96 feat: 添加保存话题功能,支持将当前话题内容保存为 Markdown 文件 2026-05-16 19:33:42 +08:00
oudecheng
8edc7ef905 feat: 添加当前话题获取功能,优化命令上下文处理 2026-05-15 18:42:26 +08:00
oudecheng
34938f57b8 feat: 添加 SessionManager 支持到 SessionCommandHandler,优化会话管理 2026-05-15 16:51:06 +08:00
oudecheng
2e13f6932c feat: Enhance session management with topic support
- Added topic management capabilities, allowing users to create, switch, and query topics within sessions.
- Updated command structure to include new commands: SwitchSession and GetCurrentSession.
- Introduced TopicRecord for managing topic data in the storage layer.
- Modified session handlers to accommodate topic operations, including listing and loading topics.
- Enhanced database schema to support topics, including new tables and relationships.
- Updated input adapters to recognize new commands and handle topic-related actions.
- Improved logging for session and topic operations to aid in debugging and monitoring.
2026-05-15 15:01:58 +08:00
oudecheng
025c0b5d7f feat: 添加 session_id 支持到 OutboundMessage,优化会话管理 2026-05-15 10:00:17 +08:00
530bea518d feat: 优化会话列表消息格式,添加会话切换提示 2026-05-14 23:45:52 +08:00
e005d06a9b feat: 添加会话管理命令,支持列出和加载会话功能 2026-05-14 23:35:34 +08:00
5eb9a26843 feat: 添加会话查询命令处理器,支持列出和加载会话功能 2026-05-14 23:27:23 +08:00
b77fc93d71 Refactor command handling and input adapters
- Removed the `format_session_list` function and related session handling from the client module.
- Simplified command output in the client by removing session-related commands.
- Introduced `ChannelInputAdapter` for parsing channel commands like `/new` and `/save`.
- Updated WebSocket handling to process commands via the new command system.
- Removed deprecated in-chat command handling from the gateway.
- Adjusted tests to reflect changes in command serialization and session handling.
- Enhanced session cleanup and job scheduling in the configuration module.
2026-05-14 22:23:02 +08:00
oudecheng
23b7497b12 feat: 更新 save_session 处理器,使用组合系统提示词提供者;移除 LLMProviderConfig 依赖 2026-05-14 16:07:49 +08:00
oudecheng
4181253b17 feat: 更新文件路径解析逻辑,自动保存会话到用户主目录下的 .picobot/sessions/ 目录;修改 InboundProcessor 结构体字段命名 2026-05-14 10:42:35 +08:00
oudecheng
102a4a63c5 feat: 更新 /save 命令,支持保存全部消息到指定路径;修改命令处理逻辑以包含新参数 2026-05-14 10:07:58 +08:00
b17ddd7556 feat: 更新 InChatCommandHandler 接口,添加会话管理器参数;修改命令路由和保存会话逻辑以支持会话管理 2026-05-13 23:11:02 +08:00
08172dcf9c feat: 实现 InChat 命令处理器和路由器,支持聊天中直接输入的命令;添加保存会话功能 2026-05-13 22:40:41 +08:00
d4c15e0478 feat: 添加 max_concurrent_requests 配置项,优化并发请求控制;更新 InboundProcessor 以支持信号量控制并发 2026-05-13 21:56:01 +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