133 Commits

Author SHA1 Message Date
5aec8cefb9 feat: add config.example.json template and update AGENTS.md with new config path 2026-05-10 18:45:53 +08:00
a479b92cdf feat(tools): add ContentSearchTool and FileSearchTool for enhanced file and content searching capabilities 2026-05-10 18:32:35 +08:00
af07eaf820 feat: add default AGENTS.md and USER.md templates and ensure their presence in the user's config directory 2026-05-10 18:07:50 +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
11a8e93b77 feat(chat-manager): enhance message retrieval with pagination and time range filtering 2026-05-10 15:12:30 +08:00
8c0c76a232 fix(session): persist compression marker on retry, warn on storage/persist errors 2026-05-10 14:52:10 +08:00
709d70f828 docs: add incremental session recovery design and implementation plan 2026-05-10 14:46:27 +08:00
25d37bcdc1 feat(system-prompt): add history section prompting agent to use timeline_recall 2026-05-10 14:46:20 +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
29543444da feat(storage): add load_messages_after_timestamp, load_session_timelines, get_max_message_seq 2026-05-10 14:36:40 +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
ceb8234a30 飞书渠道剥离思维链内容,不显示<think>标签 2026-05-08 16:19:19 +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
618016ac43 chore: add .worktrees/ to .gitignore 2026-05-07 23:05:01 +08:00
06811160f0 docs: add memory system implementation plan 2026-05-07 23:02:47 +08:00
28ef813c37 docs: add memory system design document 2026-05-07 22:56:19 +08:00
2fe953cdad 改为短id 2026-05-07 16:28:54 +08:00
61d2fe9ef0 修复及完善cron任务 2026-05-07 16:24:13 +08:00
db609342f7 fix: char-boundary-safe name truncation in cron_add tool
The name fallback used byte-index slice on the prompt,
which panics on multi-byte UTF-8 characters like Chinese.
Use is_char_boundary() to find a safe truncation point.
2026-05-05 00:56:42 +08:00
62f4326131 refactor: move scheduler store to storage module, cron tools to tools module
- storage/scheduler.rs: ScheduledJob/JobRun types + CRUD on Storage
- tools/cron.rs: 6 cron agent tools (add/list/remove/enable/disable/update)
- scheduler/types.rs: keep only Schedule enum
- scheduler/mod.rs: use Arc<Storage> instead of raw SqlitePool
- gateway/mod.rs: inject Storage directly, replace pool field
- storage/mod.rs: scheduler tables in init_schema
2026-05-05 00:49:54 +08:00
0056bfbd23 chore: fix clippy warnings in scheduler module 2026-05-05 00:31:22 +08:00
5746668e36 test: add scheduler integration tests 2026-05-05 00:29:00 +08:00
f7b0a33e66 feat: add 6 cron agent tools (add/list/remove/enable/disable/update) 2026-05-05 00:27:27 +08:00
205b814933 feat: wire scheduler into GatewayState startup and message processing 2026-05-05 00:17:19 +08:00
3a94b9718f feat: add Scheduler run loop and next_run_for_schedule 2026-05-05 00:16:07 +08:00
0757638c6f feat: add SessionManager::handle_cron_message for scheduled task execution 2026-05-05 00:13:07 +08:00
8415e85026 feat: add SchedulerStore with SQLite schema and CRUD 2026-05-05 00:12:10 +08:00
eccae20a0a feat: add ChatMessage::user_with_source and Session::create_user_message_with_source 2026-05-05 00:09:00 +08:00
4e5f412c2d feat: add scheduler data types (Schedule, ScheduledJob, JobRun) 2026-05-05 00:08:00 +08:00
75b8f7b8a5 feat: add SchedulerConfig to GatewayConfig 2026-05-05 00:06:57 +08:00
46527edb7b deps: add cron and chrono-tz for scheduled tasks 2026-05-05 00:06: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
2f2631e36a fix(session): /new 后新对话被旧对话数据覆盖的问题
问题原因:execute_slash_command 执行 /new 后,错误地将旧 session 的数据
存储到新 session 的 key 下,导致 current_sessions 虽然指向新 session,
但 sessions 里面存的是旧数据。

解决方案:移除错误的 session 映射更新逻辑。create_session 已经正确地将
新 session 存入 sessions 并更新 current_sessions,不需要额外覆盖。
2026-04-29 22:32:58 +08:00
e2fd836794 fix(session): 消息持久化和恢复
问题:消息只写内存,重启后丢失。from_storage 恢复了 meta 但没加载消息。

修复:
- add_message 改为 async,同时写内存和 Storage
- compact 场景用 persist=false 避免重复持久化
- clear_session_history 同时清内存和 Storage 消息
- 所有调用点添加 .await 和错误转换
2026-04-28 23:10:53 +08:00