优化: 上下文管理与提示词链路批

- T1 usage 口径: anthropic usage 两层容错+cache 三口径归一(prompt=input+read+creation)
- T2 压缩水位判据: compress_should_trigger 双模式+ratio 钳位,开关关逐字节等价
- T3 跨会话检索: history_search 工具(两跳式)+message_repo 关键词检索+prompt 指引
- T4 代语义闭环: status 终局补写+飞书停靠/换代推卡+交付引导+watcher 兜底补漏
- 段序缓存重排: build_runtime_prompt 恒静段上移/工作上下文压尾(前缀缓存失效面收窄)
- 智谱缓存解析: anthropic 臂补 prompt_tokens_details.cached_tokens 嵌套回退
- 工时禁令: 提示词双语加「禁止预估工时,AI Coding 工时无意义」
- 拖拽文件落盘: 非图片附件存引用行,防整段文本灌入输入框
- 事实修正: 提示词「40+ 工具」→「80+」(基线 81);tool_failure_memory 测试串行锁除竞态
- UI 拆分: TopBar/ToolResultBody 壳层化(top-bar/tool-result-body 子件目录)
This commit is contained in:
lxy
2026-10-26 01:36:00 +08:00
parent 23e505bc40
commit a30f599fe2
59 changed files with 2651 additions and 2541 deletions
+7 -3
View File
@@ -496,6 +496,8 @@ pub fn run() {
commands::ai::ai_pending_tool_calls,
commands::ai::ai_chat_clear,
commands::ai::ai_is_generating,
// 桌面拖拽/粘贴文件落盘(治「文件内容被当文本塞进输入框」)
commands::ai::ai_save_dropped_file,
// 桌面端补充注入(运行中会话 u-claw 语义:补充并进当前回答,不开新轮不入队)
commands::ai::ai_inject_runtime,
// F-15 阶段2 手动上下文管理:分段归档 + LLM 压缩
@@ -532,6 +534,8 @@ pub fn run() {
commands::ai::ai_conversation_archive,
commands::ai::ai_conversation_set_pinned,
commands::ai::ai_update_conversation_goals,
// P1-A 跨会话消息检索(F4-1 后端搜索面;AI 工具 history_search 共用同源内核)
commands::ai::search_messages,
// 无人值守任务边界(设计 §2.3):发起时一次拍板 / 回显;清除=回退逐次审批
commands::ai::ai_task_boundary_get,
commands::ai::ai_task_boundary_set,
@@ -547,8 +551,6 @@ pub fn run() {
commands::ai::ai_set_allowed_dirs,
// 工具风险元数据投影(前端启动构建 High 风险名单,审批二次确认门控)
commands::ai::ai_list_tools,
// F-260619-03 Phase B: 路径授权弹窗决策(消费 AiDirAuthRequired 挂起)
commands::ai::ai_authorize_dir,
// 审批历史面板查 ai_tool_executions 表,敏感字段截断)
commands::ai::audit::record::list_tool_executions,
// S4 TaskDrawer 关联会话:按 task_id 反查发起过任务工具的主会话(审计表推导,只读)
@@ -566,6 +568,9 @@ pub fn run() {
commands::knowledge::knowledge_record_reuse,
commands::knowledge::knowledge_list_candidates,
commands::knowledge::knowledge_archive,
commands::knowledge::knowledge_archive_stale,
commands::knowledge::knowledge_list_related,
commands::knowledge::knowledge_distill_group,
commands::knowledge::knowledge_retry_embedding,
commands::knowledge::knowledge_get_config,
commands::knowledge::knowledge_save_config,
@@ -604,7 +609,6 @@ pub fn run() {
commands::settings::save_template,
commands::settings::delete_template,
// CI 状态
commands::ci_status::get_commit_status,
// Phase3: 内嵌 HTTP MCP server 状态查询
crate::mcp::mcp_get_status,
])