ac7576bb4b
feat(session): Phase 3 - SessionManager 完善
...
- SessionManager::new 接收 Arc<Storage> 参数
- create_session / get_or_create_session 写入/恢复 Storage
- handle_message 支持无 dialog_id 时自动查找最近活跃 session 或创建新 session
- 实现 list_dialogs() — 从 Storage 读取最近 10 条
- 实现 switch_dialog() — 从 Storage 恢复 session
- 实现 delete_dialog() — 软删除 Storage + 内存移除
- 实现 rename_dialog() — 更新 Storage 和内存 title
- 实现 archive_dialog()(空实现,archive 概念已删除)
- 新增 start_cleanup_task() 后台 TTL 清理任务
- GatewayConfig 新增 session_db_path 和 cleanup_interval_minutes 配置
- Gateway::new 改为 async,创建 Storage 并启动清理任务
- rename_dialog / delete_dialog 改为 async(需 .await)
- WsOutbound::SystemNotification 已在 Phase 2 添加
2026-04-28 22:29:24 +08:00
5f7ffd28ef
feat(session): Phase 2 - 扩展 Session 结构
...
- Session 新增字段: title, created_at, last_active_at,
message_count, total_message_count, seq_counter,
storage, routing_info
- Session::new 新增 storage/routing_info/title 参数
- 新增 Session::from_storage() 从 Storage 恢复 Session
- 新增 Session::add_message_and_persist() 持久化版本
- 新增 Session::send_system_notification() 不记历史的通知
- 新增 Session::persist_session_meta() 写回 Storage
- 新增 Session::should_generate_title() / generate_title()
- 新增 LLM title 自动生成(10 条消息后触发)
- SessionManager::create_session 新增 routing_info 参数
- WsOutbound 新增 SystemNotification variant
- Client mod.rs 处理 SystemNotification
2026-04-28 22:25:10 +08:00
1ac6de118a
修复 /dump 命令:保存到文件并注入系统提示词
...
- /dump 现在保存到 {workspace}/dumps/ 目录而非仅返回文本
- dump 文件包含注入模型的完整系统提示词(AgentLoop + Skills)
- 修复 cli_chat 中 current_session_guard 变量声明问题
- gateway 正确处理 HandleResult::AgentResponse 和 CommandOutput
- 移除 cli_chat 中未使用的 parse_slash_command 导入
2026-04-28 21:27:36 +08:00
e61b78eaff
重构:斜杠命令通过 handle_message 处理,Channel 不再管理 Session
...
架构优化:
- Feishu 渠道的 handle_and_publish 简化为只发布消息到 bus
- Session 创建/复用由 SessionManager 在 handle_message 内部处理
- 斜杠命令检测移到 handle_message,execute_slash_command 直接调用
- CLI 和 Feishu 统一通过消息总线处理斜杠命令
2026-04-28 21:10:28 +08:00
e787203e94
修复飞书渠道会话创建时机:执行斜杠命令前先确保会话存在
...
在 Feishu 收到斜杠命令时,先通过 CreateDialog 创建会话,
再执行实际的命令。这样 /dump 等命令就能正确获取对话历史。
2026-04-28 21:06:25 +08:00
c52461055d
修复飞书渠道 /dump 和 /info 命令:支持无会话时自动创建
...
当 Feishu 用户首次发送斜杠命令时,如果没有会话则自动创建。
这使得 /dump 和 /info 命令可以在对话开始前使用。
2026-04-28 21:03:58 +08:00
a3d8ebb534
添加 /dump 命令,导出 session 为 markdown 文档
...
/dump 命令会输出当前 session 的完整信息:
- Session 元信息 (ID, channel, chat_id, model 等)
- 所有对话历史 (system, user, assistant, tool)
- 每条消息包含角色、时间戳、内容、工具调用等
2026-04-28 20:54:54 +08:00
84bb06cc76
优化日志输出:斜杠命令执行时打印,过滤冗余的压缩日志
...
- 添加斜杠命令执行的 info 日志
- Context compression 日志只在实际触发压缩时输出 (debug级别)
2026-04-28 20:52:20 +08:00
7220e89a22
简化斜杠命令,移除不可用的命令
...
删除:sessions, switch, rename, archive
保留:new, delete, compact, info
2026-04-28 20:50:01 +08:00
6c50f433d1
删除旧的session持久化机制
2026-04-28 20:34:44 +08:00
61eea62bfc
增强斜杠命令功能,支持参数解析和新命令;实现双重 Ctrl+C 退出确认
2026-04-28 00:01:28 +08:00
c11eb348f9
Refactor: Make AgentLoop stateless, clean up architecture
2026-04-27 23:23:10 +08:00
1abac85034
集成技能功能到系统提示词框架
...
- 在 AgentLoop 中添加 SkillsLoader 支持\n- 在系统提示词构建中集成技能提示\n- 更新 Session 以传递 SkillsLoader\n- 修复所有编译错误和测试问题
2026-04-27 23:04:24 +08:00
8226e8429d
Merge remote-tracking branch 'origin/main'
2026-04-27 22:47:37 +08:00
f704900e07
统一工作目录管理
2026-04-27 17:23:52 +08:00
75a3bf9df4
增加系统提示词框架
2026-04-27 17:07:01 +08:00
ac2333900a
重构: 添加技能加载和获取工具,优化技能管理
2026-04-26 23:35:06 +08:00
401a7b6473
初步实现skill
2026-04-26 23:18:23 +08:00
0c356e7ac4
重构: 添加斜杠命令解析和执行功能
2026-04-26 21:51:24 +08:00
bcee62713f
重构: 移除调试日志以简化消息处理流程
2026-04-26 21:26:27 +08:00
86dea0f874
Refactor session management to support dialog-based architecture
...
- Removed InputHandler and related input event handling code.
- Updated GatewayState to handle new session commands for dialogs.
- Introduced UnifiedSessionId for managing session identifiers across channels and chats.
- Refactored Session and SessionManager to manage dialogs instead of sessions.
- Added methods for creating, listing, switching, renaming, archiving, and deleting dialogs.
- Updated storage functions to accommodate dialog IDs in persistent session management.
- Enhanced tests to cover new dialog functionalities and ensure stability.
2026-04-26 20:59:54 +08:00
5ce5502c56
refactor: 抽取独立 session 模块
...
将 Session/SessionManager 从 gateway 抽取到独立的 session 模块:
- 新建 src/session/ 目录
- mod.rs: 模块导出
- error.rs: SessionError 类型
- commands.rs: SessionCommand 枚举
- events.rs: SessionEvent 枚举
- session.rs: Session 和 SessionManager 实现
- 更新 src/gateway/mod.rs
- 移除 pub mod session
- 改用 crate::session::SessionManager
- 更新 src/lib.rs
- 添加 pub mod session
- 删除 src/gateway/session.rs (内容已移动)
注意: ControlInbound/ControlOutbound/ControlMessage 保留在 bus/message.rs,
cli_chat 仍通过消息总线与 SessionManager 通信,待后续简化。
2026-04-26 17:48:23 +08:00