77 Commits

Author SHA1 Message Date
27d126cf73 tui客户端增强。 2026-07-14 14:31:16 +08:00
f42e9d44cc refactor(session): isolate messaging and persistence 2026-07-14 11:56:19 +08:00
954bfd1d75 fix(messaging): make persistence and delivery explicit 2026-07-14 11:49:02 +08:00
c2d4fc5f09 refactor: remove dead code and unused state 2026-07-14 11:41:07 +08:00
f691c1aad6 fix(agent): supervise background tasks atomically 2026-07-14 11:30:32 +08:00
63d20d1eb8 refactor: eliminate build warnings and legacy evaluator
Resolve strict Clippy findings across all targets, preserve public API compatibility with scoped lint exceptions, and fix sourced messages retaining media references. Replace meval and its future-incompatible nom dependency with a bounded internal expression parser and regression tests.
2026-07-14 11:00:39 +08:00
3d580828b5 fix(runtime): harden persistence scheduling and shutdown
Add versioned SQLite migrations, enforced runtime pragmas, and transactional message constraints. Claim scheduled jobs with durable leases, execute them concurrently within bounds, and commit completion atomically. Supervise background tasks and clean up WebSocket clients and writer tasks during ordered shutdown.
2026-07-14 10:37:58 +08:00
b06bc4f025 fix(runtime): harden session persistence and outbound dispatch 2026-07-14 10:08:55 +08:00
fdd7f47305 系统提示词精简,拆分固定部分与可变部分,固化工具skill顺序,提升缓存命中率 2026-06-17 23:25:28 +08:00
ad7fa70a02 优化session的锁 2026-06-16 22:47:07 +08:00
c6f4392e63 Fix CLI session routing and dialog controls 2026-06-15 23:44:41 +08:00
3df628bd28 补充/info信息 2026-05-29 16:23:35 +08:00
ea1338c94f 优化子agent提示词 2026-05-29 11:22:48 +08:00
41b4895ff0 增加sub-agent机制。 2026-05-25 23:23:10 +08:00
a77c026826 增加deepseek的支持。 2026-05-25 17:40:17 +08:00
f0879f8d13 重构文件消息处理流程。 2026-05-25 11:59:29 +08:00
22be6e404b 优化斜杠命令处理机制,增加/stop命令 2026-05-24 18:12:18 +08:00
b85578a7d2 新增浏览器调用能力。 2026-05-21 17:11:53 +08:00
52925fcd73 增加MCP适配 2026-05-13 16:43:38 +08:00
d957f9c649 feat(send_message): support file sending via Feishu; fix upload endpoint and message format
- OutboundMessenger trait: add media: Vec<MediaItem> param to send_message()
- send_message tool: add optional 'files' param with path-to-MediaItem conversion
- SessionManager::send_message(): forward media to OutboundMessage
- Feishu: fix image upload endpoint (/im/v1/images/upload → /im/v1/images)
- Feishu: fix post image tag (image → img)
- Feishu: fix file upload file_type mapping (use valid Feishu types)
- Feishu: send files as separate messages (file/audio/media msg_type), not embedded in post
- Feishu: add debug logging for upload/send responses
- Skip [message from] prefix for pure file messages to same session
2026-05-13 12:06:55 +08:00
ebbf7e4036 refactor(session): make cron stateless, split session lock, eliminate deadlock
- handle_cron_message: bypass Session entirely, use create_cron_agent() for direct LLM call; cron LLM delivers results via send_message tool
- handle_message: split session lock into Phase1(prepare)/Phase2(LLM unlocked)/Phase3(persist), allowing send_message to lock freely
- send_message: restore lock().await (remove try_lock workaround)
- scheduler: remove outbound publish (LLM handles delivery via send_message)
2026-05-13 10:40:58 +08:00
99a57a816a 增加LLM相关错误处理 2026-05-13 08:59:23 +08:00
3d42f22f83 fix(session): replace Mutex with task-local storage to prevent reentrant deadlock in send_message 2026-05-13 08:48:31 +08:00
ac2c1e0fe0 chore: fix clippy lints and suppress dead_code warnings 2026-05-10 23:26:55 +08:00
5ef89cd667 refactor: remove unused functions and improve path resolution in tools 2026-05-10 23:14:12 +08:00
c81b1e42c7 feat(skills): enhance SkillsLoader to support workspace skills directory and update skills loading logic
feat(get-skill): add action parameter for skill retrieval and implement skill listing functionality
fix(session): adjust skills prompt formatting for improved clarity
2026-05-10 17:45:34 +08:00
bafa7a606c fix: update database filename and improve session management in chat manager 2026-05-10 15:51:03 +08:00
8c0c76a232 fix(session): persist compression marker on retry, warn on storage/persist errors 2026-05-10 14:52:10 +08:00
3d29854079 feat(session): incremental recovery from storage using compressed timeline 2026-05-10 14:41:48 +08:00
e65130450e feat(compressor): return CompressionResult with created_timelines flag, record marker in handle_message and /compact 2026-05-10 14:40:13 +08:00
d022e30943 feat(storage): add last_compressed_message_at column to sessions table and Session struct 2026-05-10 14:35:21 +08:00
cb1140e9be refactor(memory): Timeline 按 session 隔离,拆分知识/摘要检索工具
- storage/memory: search_memories 和 search_memories_by_time 增加 session_id 过滤参数
- memory/manager: recall/recall_by_time 透传 session_id
- tools: MemoryStoreTool/MemoryRecallTool 锁定 Knowledge 类别,移除 category 参数
- tools: 新增 TimelineRecallTool 用于检索会话摘要,支持可选 session_id 过滤
- tools: 输出格式化增加 session 信息显示
- tests: 新增 test_session_id_filter 验证会话级过滤
2026-05-10 13:35:21 +08:00
f9ae4b2c69 fix(context): 全面修复和增强上下文压缩机制
Bug修复:
- fast_trim 死代码: 去掉 .clone() 使其真正修改原 history
- compress_once 边界错误: 第一条 user 重复 + 最后一条 user 丢失
- handle_cron_message 遗留的重复压缩调用

新特性:
- System prompt 不参与压缩,在压缩后注入
- 孤儿 tool 清理: compress_once 返回前修复 tool 对完整性
- Agent Loop 内每轮 token 检查: 80% 窗口阈值时预裁剪旧 tool 输出
- 上下文溢出恢复: 解析 LLM 错误中的实际 token limit 并降级重试
- 硬截断降级: tokens > 90% context_window 时 head+tail 保底
- parse_context_limit_from_error: 支持 OpenAI/Anthropic/llama.cpp 格式

测试: 新增 6 个单元测试覆盖上述所有场景
2026-05-10 12:23:26 +08:00
488e10dceb fix: advance last_consolidated_at after compression, update docs 2026-05-08 21:56:05 +08:00
81e9f1e7db clippy --fix: 合并嵌套if、简化map_or、移除冗余引用等机械性优化 2026-05-08 16:35:21 +08:00
5d62141658 1、修复和提升记忆系统 2、简化消息标记 2026-05-08 15:09:27 +08:00
2617558a27 记忆工具合并文件,改成记忆系统总是开启。 2026-05-08 10:28:34 +08:00
c602a0695d feat: add memory system with FTS5 search and context compression integration 2026-05-07 23:32:59 +08:00
61d2fe9ef0 修复及完善cron任务 2026-05-07 16:24:13 +08:00
0757638c6f feat: add SessionManager::handle_cron_message for scheduled task execution 2026-05-05 00:13:07 +08:00
eccae20a0a feat: add ChatMessage::user_with_source and Session::create_user_message_with_source 2026-05-05 00:09:00 +08:00
0e146a8f2a 可观测性改善,llm api兼容性改善 2026-05-04 23:04:28 +08:00
98eb7bea3d 新增跨session消息发送能力 2026-05-04 00:32:24 +08:00
24d3407b05 fix(session): 所有时间显示改用本地时区而非 UTC
- /info 和 /sessions 中的时间戳通过 DateTime::from_timestamp_millis 后
  调用 with_timezone(&Local) 转换为本地时间
- dump_to_file 和 dump_as_markdown 导出的时间也改用本地时区
2026-04-29 23:04:01 +08:00
fe4088cd1f feat(session): 扩展 /info 命令显示更多 session 信息
新增:对话标题、模型名称、用户消息数/总消息数、创建时间、最后活跃时间
2026-04-29 22:59:49 +08:00
5c558027fa feat(session): 添加 /? 帮助命令,错误命令显示友好提示
- 新增 /? 和 /help 命令显示所有可用斜杠命令
- 未知命令不再报错,而是提示"未知命令:/xxx。输入 /? 获取帮助。"
- execute_slash_command 错误现在返回友好提示而非传播为服务器错误
2026-04-29 22:57:59 +08:00
e1681e0424 debug(session): 添加 handle_message 和 session 恢复的 tracing 日志
用于排查 restart 后 session 恢复和 TTL 刷新问题。
2026-04-29 22:51:50 +08:00
dcb2d552d9 chore(session): 将标题生成阈值从 10 条减至 5 条用户消息 2026-04-29 22:46:33 +08:00
228204517d fix(session): 每次 add_message 时同步更新 Storage 的 message_count
之前只持久化了消息内容,没有更新 SessionMeta.message_count,
导致重启后从 Storage 恢复时 message_count 低于实际值,
should_generate_title() 判断失败。
2026-04-29 22:45:04 +08:00
97e3be6d3a fix(session): 调用 generate_title 生成对话标题
之前 generate_title 函数已实现但从未被调用,导致对话标题
自动生成(10 条用户消息后)一直没有触发。
2026-04-29 22:34:02 +08:00