142 Commits

Author SHA1 Message Date
2bff987be1 飞书渠道简化 2026-05-13 18:07:34 +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
1e69fa3bd1 feat: enhance memory section guide and improve search tool descriptions for clarity 2026-05-11 18:01:25 +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
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