oudecheng
|
3e97ed903c
|
feat(mcp): 为 MCP 工具调用增加超时保护,默认 5 分钟
在 McpToolWrapper 适配层用 tokio::time::timeout 包裹 call_tool,防止外部 MCP server 挂起导致 agent loop 无限阻塞。超时时间通过 config.mcp_tool_timeout_secs 配置(默认 300 秒,0=不超时),前端 McpTab 设置页提供输入框。
|
2026-08-11 21:53:07 +08:00 |
|
oudecheng
|
f26ec49182
|
chore: 修复 release 构建的编译器警告
- 为 regex::Captures 补全显式生命周期标注
- 将仅用于 debug 日志的局部变量 (media_count/len/total) 用 cfg(debug_assertions) 条件化
- 为仅 debug 读取的 AnthropicProvider::llm_timeout_secs 字段添加 cfg_attr allow(dead_code)
|
2026-08-07 14:36:27 +08:00 |
|
oudecheng
|
bf8c227634
|
refactor: 迁移 parking_lot 锁并优化阻塞 IO 与内存管理
## 锁迁移:std::sync → parking_lot
消除锁中毒(poison)导致的级联崩溃风险。parking_lot 锁不会中毒,
且性能更优。迁移覆盖全部生产代码:
- experts/mod.rs: 4 RwLock + 13 expect
- skills/mod.rs: 1 RwLock + 11 expect
- tools/registry.rs: 1 RwLock + 2 expect
- gateway/model_selection.rs: 1 RwLock + 2 expect
- tools/task/repository.rs: 1 RwLock + 4 unwrap
- tools/task/runtime.rs: 2 RwLock + 17 expect
- gateway/session.rs + task/runtime.rs: stream_message_id Mutex
- gateway/processor.rs: description_generation_in_flight Mutex
- command/handler.rs + help.rs: metadata Mutex(公开 API)
- mcp/client.rs: stderr_lines Mutex
测试代码中的 std::sync::Mutex(串行化锁 + TestObserver)有意保留,
已通过 unwrap_or_else(|err| err.into_inner()) 做中毒恢复。
## P1: 阻塞 IO 迁移到 spawn_blocking
将 3 处阻塞 async worker 的操作迁移到 blocking 线程池:
- file_read.rs: read_to_string + 行处理 + base64 编码整体包入 spawn_blocking
- agent_loop.rs: 新增 preencode_images_for_request 两阶段预编码
(顺序分配预算 → 并行 spawn_blocking 编码),build_llm_request 改为 async
- wechat.rs: media_to_send_content 改为 async,std::fs::read 用 spawn_blocking 包裹
## P2: session_history topic_histories 内存上限
新增 MAX_CACHED_TOPICS=32 上限和 evict_inactive_if_needed 方法。
超限时驱逐非活跃 topic(不在 chat_topic_ids、不在 compression_in_flight、
serial_lock 未被持有)。活跃 topic 永不误驱逐。
remove_history 同步清理 topic_serial_locks,防止无限增长。
## P3: 减少 panic 面
agent_loop.rs retry 循环的 response.expect(...) 改为 ok_or_else(...)?
返回 AgentError::Other,逻辑 bug 不再导致整个 agent 崩溃。
## 对抗性审查修复
- preencode_images_for_request: 用 seen HashSet 去重,防止同 path 重复
编码导致 HashMap entry 覆盖(NoBudget 覆盖 Encoded 等)
- evict_inactive_if_needed: 检查 topic_serial_lock.try_lock(),防止驱逐
正在 agent 处理中的 topic(original_topic_id 不在 chat_topic_ids 但
agent 仍持锁)
- remove_history: 清理 topic_serial_locks
## 验证
- cargo check: 通过(仅既有 lifetime 警告)
- cargo test: 559 passed / 3 failed(均为环境/sandbox 权限问题,与本次改动无关)
|
2026-08-06 08:18:04 +08:00 |
|
oudecheng
|
cda14360af
|
chore: 建立工程化基线(rustfmt + clippy + CI + eslint + prettier)
配置:
- rustfmt.toml: 固化 max_width=100 / 4 空格缩进,cargo fmt 全量格式化
- Cargo.toml: 配置 [lints.rust] 与 [lints.clippy] 渐进式规则
- .github/workflows/ci.yml: Rust(fmt+clippy+test) + 前端(eslint+tsc+test) 双平台 CI
- Makefile: 新增 check/fmt/fix 目标,clippy 对齐 --all-targets --all-features
- web: eslint flat config + prettier 配置 + package.json 脚本与依赖
- src/main.rs: loop→while 修复 clippy::never_loop
对抗性审查发现并修复:
- eslint 缺 caughtErrorsIgnorePattern 导致 catch(_) 误报为 error
- 前端 lint 未接入 CI,现已补上 Lint 步骤
- Makefile 与 CI 的 clippy flags 不一致,已对齐
|
2026-08-03 23:24:02 +08:00 |
|
oudecheng
|
53a45ad7c4
|
修复mcp log
|
2026-07-08 15:52:36 +08:00 |
|
oudecheng
|
6c393dca05
|
build: 将 rmcp 依赖从 git branch 迁移到 crates.io 版本
- Cargo.toml: rmcp 从 git="...rust-sdk", branch="main" 改为 version="1.7"
(semver 解析为 1.8.0,最新兼容 1.x 版本)
- src/mcp/client.rs: 适配 rmcp 1.8+ API 变更
peer_info() 返回类型从 Option<ServerInfo> 变为 Option<Arc<ServerInfo>>,
使用 .map(|arc| arc.as_ref().clone()) 替代 .cloned()
解决 git branch 依赖带来的问题:构建不可复现、供应链安全风险、
版本语义模糊、升级路径不清晰、CI 构建性能损耗。
|
2026-07-08 10:56:25 +08:00 |
|
oudecheng
|
76abdbd1de
|
feat: MCP stdio 命令解析与错误诊断增强
- 新增 resolve_command_path:Windows 上搜索 .exe/.cmd/.bat 后缀
- 启动失败时给出友好错误信息(含 PATH 和建议)
- 捕获子进程 stderr 并在连接失败时回显
- ConfigPage 新增 cwd 工作目录字段
- 添加单元测试覆盖路径解析逻辑
|
2026-07-03 19:31:52 +08:00 |
|
oudecheng
|
1309fa28da
|
feat: McpClientManager 传递 cwd 参数至 connect_stdio
|
2026-07-03 16:34:01 +08:00 |
|
oudecheng
|
1af0fab3ad
|
feat: 更新配置管理,支持异步读取和写入;添加 MCP 服务器状态接口
|
2026-07-03 08:37:02 +08:00 |
|
oudecheng
|
4fabbe47e9
|
feat: 增强MCP集成,支持配置路径和连接重试机制
|
2026-06-30 10:46:33 +08:00 |
|
|
|
4605c2dad3
|
feat: 重构 MCP 配置,支持 mcpServers 字段,优化工具注册和连接管理
|
2026-05-24 10:00:25 +08:00 |
|
|
|
5e04832f20
|
feat: 更新 MCP 配置和工具适配器,支持 Claude Desktop 格式,优化服务器连接管理
|
2026-05-23 23:37:45 +08:00 |
|
|
|
ef7e899584
|
feat: 集成 MCP (Model Context Protocol),支持 Stdio 和 HTTP 传输方式,优化工具注册和连接管理
|
2026-05-23 23:22:36 +08:00 |
|
|
|
b3fa0bb978
|
feat: 添加 HTTP 传输连接支持,优化 MCP 客户端管理器
|
2026-05-23 22:57:08 +08:00 |
|
|
|
cbb384a4e6
|
feat: 添加 MCP (Model Context Protocol) 支持,包含客户端管理器和工具适配器
|
2026-05-23 22:52:36 +08:00 |
|