Commit Graph

692 Commits

Author SHA1 Message Date
iven
9a313e3c92 docs(wiki): 回复效率+建议并行化优化 wiki 同步
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- middleware.md: 分波并行执行设计决策 + parallel_safe 标注 + 不变量 + 执行流
- chat.md: suggestion prefetch + 解耦 memory + prompt 重写
- log.md: 追加变更记录
- CLAUDE.md: §13 架构快照 + 最近变更
2026-04-23 23:45:28 +08:00
iven
ee5611a2f8 perf(middleware): before_completion 分波并行执行
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- MiddlewareContext 加 Clone derive, 支持并行克隆上下文
- AgentMiddleware trait 新增 parallel_safe() 默认方法 (false)
- MiddlewareChain::run_before_completion 改为分波执行:
  连续 2+ 个 parallel_safe 中间件用 tokio::spawn 并发执行,
  各自独立修改 system_prompt, 执行完成后合并贡献
- 5 个只修改 system_prompt 的中间件标记 parallel_safe:
  evolution(P78), butler_router(P80), memory(P150),
  title(P180), skill_index(P200)
- 非 parallel_safe 中间件 (compaction, dangling_tool 等) 保持串行

分波效果:
  Wave 1: evolution + butler_router → 并行 (省 ~0.5-1s)
  Wave 2: compaction → 串行 (可能修改 messages)
  Wave 3: memory + title + skill_index → 并行 (省 ~0.5-2s)
  Wave 4+: 工具/安全中间件 → 串行
2026-04-23 23:37:57 +08:00
iven
5cf7adff69 perf(chat): 回复效率 + 建议生成并行化优化
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- identity prompt 缓存: LazyLock<RwLock<HashMap>> 缓存已构建的 identity prompt,
  soul.md 更新时自动失效, 省去每次请求的 mutex + 磁盘 I/O (~0.5-1s)
- pre-conversation hook 并行化: tokio::join! 并行执行 identity build 和
  continuity context 查询, 不再串行等待 (~1-2s)
- suggestion context 预取: 流式回复期间提前启动 fetchSuggestionContext,
  回复结束时 context 已就绪 (~0.5-1s)
- 建议生成与 memory extraction 解耦: generateLLMSuggestions 不再等待
  memory extraction LLM 调用完成, 独立启动 (~3-8s)
- Path B (agent stream) 补全 context: lifecycle:end 路径使用预取 context,
  修复零个性化问题
- 上下文窗口扩展: slice(-6) → slice(-20), 每条截断 200 字符
- suggestion prompt 重写: 1 深入追问 + 1 实用行动 + 1 管家关怀,
  明确角色定位, 禁止空泛建议
2026-04-23 23:13:20 +08:00
iven
10497362bb fix(chat): 澄清问题卡片 UX 优化 — 去悬空引用 + 默认展开
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- 提示词增加 ask_clarification 引用规则,避免 LLM 在文本中生成
  "以下信息"/"比如:"等悬空引用短语
- 新增 stripDanglingClarificationRef 前端安全网,当消息包含
  ask_clarification 工具调用时自动移除末尾悬空引用
- 澄清卡片默认展开,让用户直接看到选项无需额外点击
2026-04-23 19:21:10 +08:00
iven
d7dbdf8600 docs(wiki): 动态建议智能化变更日志
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
2026-04-23 18:01:44 +08:00
iven
8c25b20fe2 feat(suggest): 更新 suggestion prompt 为混合型(2续问+1管家关怀)
- llm-service.ts: HARDCODED_PROMPTS.suggestions.system 改为混合型
  - 2条对话续问 + 1条管家关怀(痛点回访/经验复用/技能推荐)
- streamStore.ts: LLM_PROMPTS_SYSTEM 改为引用 llm-service 导出
  - 单一真相源,OTA 更新时自动生效
2026-04-23 17:58:58 +08:00
iven
87110ffdff feat(suggest): 改造 createCompleteHandler 并行化 + generateLLMSuggestions 增强
- createCompleteHandler: 记忆提取+上下文拉取 Promise.all 并行
- generateLLMSuggestions: 新增 SuggestionContext 参数,构建增强 user message
- llmSuggestViaSaaS: 删除 2s 人为延迟(并行化后不再需要)
- 变量重命名 context→conversationContext 避免与 SuggestionContext 冲突
2026-04-23 17:57:17 +08:00
iven
980a8135fa feat(suggest): 新增 fetchSuggestionContext 聚合函数 + 类型定义
- 4 路并行拉取智能上下文:用户画像、痛点、经验、技能匹配
- 500ms 超时保护 + 静默降级(失败不阻断建议生成)
- Tauri 不可用时直接返回空上下文
2026-04-23 17:54:57 +08:00
iven
e9e7ffd609 feat(intelligence): 新增 experience_find_relevant Tauri 命令 + ExperienceBrief
- 新增 ExperienceBrief 结构(痛点模式+方案摘要+复用次数)
- OnceLock 单例 + init_experience_extractor() 启动初始化
- experience_find_relevant 命令:按 agent_id + query 检索相关经验
- 注册到 invoke_handler + setup 阶段优雅降级初始化
- 新增序列化测试(10 tests PASS)
2026-04-23 17:52:33 +08:00
iven
00ebf18f23 docs(spec): 动态建议智能化设计 — 接通智能层的 Prompt 增强方案
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
发散式探讨确定方案A: 在现有建议生成流程中并行拉取4个智能上下文
(UserProfiler + 痛点 + 经验 + 技能路由),注入增强prompt。
新增1个只读Tauri命令(experience_find_relevant),消除2s人为延迟。
2026-04-23 17:16:25 +08:00
iven
aa84172ca4 refactor(panel): 移除 Agent tab — 跨会话身份由 soul.md 接管
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Agent tab 展示的信息对用户无实际作用,身份记忆已通过
soul.md → pre_conversation_hook 实现跨会话。移除 Agent tab
(简洁+专业模式),清理 ~280 行 dead code。
2026-04-23 14:51:47 +08:00
iven
1c0029001d fix(identity): agent_update 同步写入 soul.md — 跨会话名字记忆
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
config.name 更新后新会话的 system prompt 看不到名字,因为
pre_conversation_hook 只读 soul.md。现在 agent_update 在 name
变更时同步更新 soul.md(含/替换"你的名字是X"),确保下次
会话的 system prompt 包含身份信息。
2026-04-23 14:17:36 +08:00
iven
0bb526509d fix(identity): 名字检测从 memory extraction 解耦 — 502 不再阻断面板刷新
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
agent/user name 检测之前放在 extractFromConversation().then() 回调里,
memory extractor 502 时整个 .then() 跳过,名字永远不会更新。
现在名字检测独立执行,memory extraction 失败不影响面板刷新。
2026-04-23 14:01:05 +08:00
iven
394cb66311 fix(identity): 重构 agent 命名检测正则 — 覆盖"名称改为小芳"等表达
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
detectAgentNameSuggestion 从固定正则改为 trigger+extract 两步法,
10 个 trigger 模式覆盖中文/英文常见命名表达,stopWords 过滤误匹配。
同时修复 streamStore content 类型处理和 RightPanel 重复事件监听。
2026-04-23 13:13:40 +08:00
iven
b56d1a4c34 feat(chat): LLM 动态对话建议 — 替换硬编码关键词匹配
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
AI 回复结束后,将最近对话发给 LLM 生成 3 个上下文相关的后续问题,
替换原有的"继续深入分析"等泛泛默认建议。

变更:
- llm-service.ts: 添加 suggestions 提示模板 + llmSuggest() 辅助函数
- streamStore.ts: SSE 流式请求 via SaaS relay,response.text() 一次性
  读取避免 Tauri WebView2 ReadableStream 兼容问题,失败降级到关键词
- chatStore.ts: suggestionsLoading 状态镜像
- SuggestionChips.tsx: loading 骨架动画
- ChatArea.tsx: 传递 loading prop
2026-04-23 11:41:50 +08:00
iven
3e78dacef3 docs(wiki): 追加身份信号提取与持久化修复日志
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
2026-04-23 10:31:46 +08:00
iven
e64a3ea9a3 fix(identity): Agent详情面板监听Rust身份更新事件刷新名称
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
问题: Rust端post_conversation_hook写回soul.md后emit Tauri事件,
但前端RightPanel未监听该事件,导致面板不刷新。

修复: RightPanel添加zclaw:agent-identity-updated事件监听,
收到后调用updateClone更新AgentConfig.name并刷新clone列表。
2026-04-23 10:28:12 +08:00
iven
08812e541c fix(identity): 接通身份信号提取与持久化 — 对话中起名跨会话记忆
Some checks failed
CI / Rust Check (push) Has been cancelled
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
根因: 记忆提取管道(COMBINED_EXTRACTION_PROMPT)提取5种画像信号
但无身份信号(agent_name/user_name),不存在从对话到AgentConfig.name
或IdentityFiles的写回路径。

修复内容:
- ProfileSignals 增加 agent_name/user_name 字段
- COMBINED_EXTRACTION_PROMPT 增加身份提取指令
- parse_profile_signals 解析新字段 + 回退推断
- GrowthIntegration 存储身份信号到 VikingStorage
- post_conversation_hook 写回 soul.md + emit Tauri 事件
- streamStore 规则化检测 agent 名字并更新 AgentConfig.name
- cold-start-mapper 新增 detectAgentNameSuggestion

链路: 对话→提取→VikingStorage→hook写回soul.md→事件→前端刷新
2026-04-23 09:20:35 +08:00
iven
17a7a36608 docs(wiki): 追加 agentStore stale client 修复日志
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
2026-04-23 00:07:52 +08:00
iven
5485404c70 docs(wiki): 追加 Agent tab 数据同步修复日志
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
2026-04-22 23:04:31 +08:00
iven
a09a4c0e0a fix(agent-tab): 修复详情页 Agent tab 数据不同步问题
Some checks failed
CI / Rust Check (push) Has been cancelled
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- 修复 updateClone 中 role→description 字段映射错误:前端发送 role
  但 Tauri agent_update 期望 description,导致角色描述从未保存
- 修复 listClones 中 userName/userRole 数据不可用:agent_list 不
  返回 userProfile,现通过 agent_get + identity_get_file 双通道
  获取用户配置数据和动态学习数据
- 修复 userAddressing 错误使用 agent nickname 作为用户称呼方式
2026-04-22 22:59:26 +08:00
iven
62578d9df4 docs: wiki 知识库编制方法论 — 基于ZCLAW实战提炼的可复用指南
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
6条设计原则 + 5节模块模板 + 集成契约/不变量/症状导航机制
+ 维护工作流 + AI辅助开发特殊考量 + 检查清单

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 22:49:08 +08:00
iven
9756d9d995 docs: CLAUDE.md+log同步 — wiki重构后§3.3§8.3更新
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 22:03:38 +08:00
iven
7ba7389093 docs(wiki): Phase E+F完成 — index重构+feature-map转索引
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- index.md: 移除架构Q&A(移入模块页)+新增症状导航表 (144→101行)
- feature-map.md: 33链路详细描述→紧凑索引表 (424→60行)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 21:57:47 +08:00
iven
c10e50d58e docs(wiki): Phase D完成 — 6模块页重构(routing/chat/butler/hands-skills/pipeline/data-model)
- routing.md: 移除Store/lib列表+5节模板 (330→131行)
- chat.md: 添加集成契约+不变量 (180→134行)
- butler.md: 移除重复→引用memory/hands-skills (215→150行)
- hands-skills.md: 5节模板+契约+不变量 (281→170行)
- pipeline.md: 添加契约+重组 (157→154行)
- data-model.md: 添加契约+双库架构图 (181→153行)

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 21:53:17 +08:00
iven
5d88d129d1 docs(wiki): Phase B+C完成 — middleware/saas/security/memory 5节模板重构
- middleware.md: 集成契约+3不变量+执行流 (157→136行)
- saas.md: 移除安全重复→引用security.md+Token Pool算法 (231→173行)
- security.md: 吸收saas认证内容成为安全唯一真相源 (158→199行)
- memory.md: 最大压缩363→147行+Hermes洞察提炼+4不变量

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 21:42:24 +08:00
iven
36612eac53 docs(wiki): Phase A完成 — hermes归档+known-issues转索引
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 21:33:35 +08:00
iven
b864973a54 docs(wiki): 归档 log.md 旧条目 — 保留38条,归档22条至 archive/
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 21:31:16 +08:00
iven
73139da57a docs: wiki重构设计spec+实施计划 — 移至 docs/wiki-restructure/
Some checks failed
CI / E2E Tests (push) Has been cancelled
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 21:26:51 +08:00
iven
de7d88afcc docs(spec): wiki重构设计v2 — 修复review问题(执行顺序+内容映射+契约示例)
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 20:04:54 +08:00
iven
8fd8c02953 docs(spec): wiki 重构设计文档 — 三级结构+集成契约+症状导航
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 20:00:39 +08:00
iven
fa5ab4e161 refactor(middleware): 移除数据脱敏中间件及相关代码
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
移除不再使用的数据脱敏功能,包括:
1. 删除data_masking模块
2. 清理loop_runner中的unmask逻辑
3. 移除前端saas-relay-client.ts中的mask/unmask实现
4. 更新中间件层数从15层降为14层
5. 同步更新相关文档(CLAUDE.md、TRUTH.md、wiki等)

此次变更简化了系统架构,移除了不再需要的敏感数据处理逻辑。所有相关测试证据和截图已归档。
2026-04-22 19:19:07 +08:00
iven
14f2f497b6 docs(wiki): 记录跨会话记忆链路 + 管家Tab记忆展示架构
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- memory.md: 添加"跨会话记忆完整链路"章节,覆盖初始化/写入/读取/展示/数据库架构/关键文件地图
- butler.md: 添加"管家Tab记忆展示"章节,记录MemorySection数据源和组件结构
2026-04-22 19:13:08 +08:00
iven
4328e74157 docs(wiki): 更新跨会话记忆修复记录 — log/memory/known-issues
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- log.md: 添加BUG-M6修复详情(profile_store+双数据库)
- memory.md: 已知问题新增2项已修复记录
- known-issues.md: 添加BUG-M6条目
2026-04-22 19:10:18 +08:00
iven
adf0251cb1 fix(memory): 跨会话记忆断裂修复 — profile_store连接+双数据库统一+诊断日志
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
根因: 3个断裂点
1. profile_store未连接: create_middleware_chain()中GrowthIntegration未设置
   UserProfileStore, 导致extract_combined()的profile_signals被静默丢弃
2. 双数据库不一致: UserProfileStore写入data.db, agent_get读取memories.db,
   两库隔离导致UserProfile永远读不到
3. 缺少关键日志: 提取/存储/检索链路无info级别日志, 问题难以诊断

修复:
- create_middleware_chain()中添加 with_profile_store(memory.pool())
- agent_get改为使用kernel.memory()而非viking_commands::get_storage()
- Kernel暴露memory()方法返回Arc<MemoryStore>
- growth.rs增强日志: 存储成功/失败/提取详情/profile更新数

验证: Tauri端E2E测试通过
- 会话A发送消息 → 提取6记忆+4 profile signals → 存储成功
- 新会话B发送消息 → Injected memories → LLM回复提及之前话题
- 管家Tab显示: 用户画像(医疗/健康)+近期话题+53条记忆分组
2026-04-22 19:07:14 +08:00
iven
52078512a2 feat(desktop): 管家Tab记忆展示增强 — L1摘要+类型分组+用户画像
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
MemorySection.tsx 重写:
- 并行加载 L1 摘要 (viking_read L1) 替代仅显示 URI
- 按记忆类型分组: 偏好/知识/经验/会话
- 折叠/展开每组,默认展开偏好和知识
- 新增用户画像卡片: 行业/角色/沟通风格/近期话题/常用工具
- 数据源: viking_ls + viking_read + agent_get(userProfile)
2026-04-22 18:18:32 +08:00
iven
7afd64f536 docs(wiki): 添加 DataMasking 过度匹配修复记录
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
2026-04-22 17:26:57 +08:00
iven
73d50fda21 fix(runtime): 禁用 DataMasking 中间件 — 正则过度匹配通用中文文本
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
问题: DataMasking 中间件用正则 [^\s]{1,20}(?:公司|...) 匹配公司名,
将"有一家公司"等通用文本误判为公司实体,替换为 __ENTITY_1__ 占位符。
同时 LLM 响应路径缺少 unmask 逻辑,导致用户看到原始占位符。

修复:
- 禁用 DataMasking 中间件 (桌面端单用户场景无需脱敏)
- 在 AgentLoop 添加 data_masker + unmask 基础设施 (备用)
- 添加 unmask_text() 方法覆盖流式/非流式两条响应路径
- 保留 data_masking.rs 模块 (含改进正则和新增测试),待未来 NLP 方案启用

测试: 934 PASS, 0 FAIL
2026-04-22 17:24:46 +08:00
iven
8b3e43710b docs(wiki): 更新搜索功能修复记录 — hands-skills/feature-map/known-issues/log
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- hands-skills.md: Researcher 搜索能力详细说明 + 数据流 + 修复清单
- feature-map.md: 新增 F-09.5 Agent 搜索链路 (搜索引擎/网页获取/UI处理)
- known-issues.md: 搜索 04-22 P1×3 修复记录 (SEARCH-1/2/3)
- log.md: 追加 04-22 变更日志
2026-04-22 16:33:01 +08:00
iven
81005c39f9 fix(desktop): 修复搜索结果排版 — stripToolNarration 保留 markdown 结构
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
根因: stripToolNarration 按句子切分再用空格拼接,破坏了所有 markdown
格式(标题/列表/段落/代码块),导致搜索结果显示为纯文本墙。

修复: 改为按行处理,只过滤匹配叙述模式的行,保留 markdown 结构行
(标题/列表/空行/引用/代码/表格)。关键变化:
- 保留空行(markdown 段落分隔符)
- 保留以 #/-/*/数字/>/```/| 开头的结构行
- 仅过滤 LLM 内部叙述("让我执行..."、"Let me..."等)
2026-04-22 16:24:40 +08:00
iven
5816f56039 fix(runtime,hands): 搜索功能修复 — glm空参数回退+schema简化
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
根因: glm-5.1 不理解 oneOf+const 复杂 schema,发送 tool_calls 时
arguments 为空 {}。同时缺少从对话上下文提取用户意图的回退机制。

修复:
1. researcher input_schema 从 oneOf+const 改为扁平化属性 — glm 正确传参
2. loop_runner 增加 empty-input 回退 — 从最近用户消息注入 _fallback_query
3. researcher infer_action 增加 _fallback_query 分支处理
4. 调试日志降级 INFO→DEBUG (openai tool_calls delta, researcher input)
2026-04-22 16:06:47 +08:00
iven
3cb9709caf fix(runtime): SSE行缓冲 — 修复glm tool call参数截断丢失
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
根因: OpenAI driver的SSE解析直接按TCP chunk分行,
当glm的JSON响应被拆成多个TCP包时,SSE data行被截断,
导致tool call arguments丢失(input={})。

修复:
1. 添加pending_line缓冲区,跨chunk累积不完整的SSE行
2. 只处理完整的行(\n结尾),未完成的保留到下次
3. researcher.infer_action()增加更多字段推断(search/keyword/q等)

验证: 99 tests PASS, 160 hands tests PASS
2026-04-22 15:20:23 +08:00
iven
bc9537cd80 fix(hands): hand_researcher 参数容错 — LLM不传action字段时自动推断
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
根因: glm等国内LLM调用hand_researcher时不带action字段,
导致"missing field action"反复报错触发LoopGuard拦截。

修复: execute()先尝试严格反序列化,失败时调用infer_action()
从输入字段推断意图:
- 有query → search
- 有url → fetch
- 有urls → summarize
- 都没有 → 友好错误提示

验证: 160 tests PASS
2026-04-22 14:23:52 +08:00
iven
bb1869bb1b fix(hands): 搜索引擎优先级调整 — 国内用户优先百度+Bing CN
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
中国用户无法使用 Google/DuckDuckGo(被墙),调整策略:
1. Google/DuckDuckGo 路由降级到百度(非Bing)
2. search_native() 所有查询统一百度+Bing CN并行
3. DDG仅作为最后后备(主引擎都空时才尝试)
4. 移除 CJK 分支逻辑 — 百度+Bing CN 对中英文都有效
2026-04-22 14:06:20 +08:00
iven
46fee4b2c8 fix(desktop): 隐藏Hand状态消息 + 过滤LLM工具调用叙述
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
1. 所有 role=hand 的消息不再显示 (不仅仅是 researcher)
   - "Hand: hand_researcher - running" 不再出现
   - Hand 错误 JSON 不再显示
   - 移除未使用的 PresentationContainer import

2. 添加 stripToolNarration() 过滤 LLM 推理文本
   - 英文: "Now let me...", "I need to...", "I keep getting..."
   - 中文: "让我执行...", "让我尝试使用...", "好的,让我为您..."
   - 保留实际有用内容,仅过滤工具调用叙述

验证: tsc --noEmit 零错误, vitest 343 pass (1 pre-existing fail)
2026-04-22 13:17:54 +08:00
iven
6d7457de56 fix(hands): 搜索引擎升级 — DDG改POST + Jina Reader内容提取
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
借鉴DeerFlow(ddgs库)架构改进搜索:
1. DDG搜索从GET改为POST(form-encoded),匹配ddgs库行为
2. 新增Jina Reader API(r.jina.ai)用于网页内容提取,返回干净Markdown
3. Jina失败时自动降级到原有HTML解析
4. 支持 ZCLAW_JINA_API_KEY 环境变量(可选,免费tier无需key)
5. 内容截断4096字符(DeerFlow模式)

验证: 160 tests PASS, 0 warnings, workspace check clean
2026-04-22 12:59:48 +08:00
iven
eede45b13d fix(desktop): 隐藏 researcher hand 原始JSON输出 — 搜索结果已通过LLM回复展示
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
问题:搜索时 chat 中出现 hand_researcher 原始 JSON 结果,
包含 action/query/results 等技术细节,对用户无意义。

修复:MessageBubble 对 role='hand' && handName='researcher'
的消息直接返回 null(与 role='tool' 同理静默处理)。
搜索结果已由 LLM 整合在回复中呈现,无需重复显示。
2026-04-22 12:24:44 +08:00
iven
ee56bf6087 fix(hands): 搜索结果质量过滤 — 去除JS/CSS/广告等垃圾内容
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
问题:HTML解析器提取搜索引擎页面中的导航/脚本/广告片段,
导致搜索结果混入 function()/var/stylesheet 等垃圾文本。

修复:
- 新增 is_quality_result() 过滤函数,检查 title/snippet/url 质量
- 拒绝含 JS 关键词(function/var/const/window/document)的标题
- 拒绝含 CSS 标识(.css/stylesheet)的标题
- 拒绝过短(<2)或过长(>300)的标题
- 拒绝 javascript:/data: URL
- strip_html_tags 添加空白折叠 + 更多HTML实体
- 三个解析器(DDG/Bing/百度)全部接入质量过滤

测试: 68 PASS (新增8个质量过滤测试)
2026-04-22 12:16:02 +08:00
iven
5a0c652f4f fix(hands): 审计修复 — SSRF防护/输入验证/HTTP状态检查/解析加固
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
三维度穷尽审计(安全+质量+正确性)后修复:

CRITICAL:
- execute_fetch() 添加完整 SSRF 防护(IPv4/IPv6/私有地址/云元数据/主机名黑名单)
- reqwest 重定向策略限制为3次,阻止重定向链 SSRF
- DDG HTML 解析: split("result__body") → split("class=\"result__body\"") 防误匹配
- Google 变体降级到 Bing 时添加 tracing::warn 日志

HIGH:
- ResearchQuery 输入验证: 查询≤500字符, max_results≤50, 空查询拒绝
- Cache 容量限制: 200 条目上限 + 简单淘汰
- extract_href_uddg 手动 URL 解码替换为标准 percent_decode
- 3个搜索引擎方法添加 HTTP status code 检查(429/503 不再静默)

MEDIUM:
- config.toml default_engine 从 "searxng" 改为 "auto"(Rust 原生优先)
- User-Agent 从机器人标识改为浏览器 UA,降低反爬风险
- 百度解析器从精确匹配改为 c-container 包含匹配,覆盖更多变体
- 添加 url crate 依赖

测试: 60 PASS (新增12: SSRF 5 + percent_decode 3 + 输入验证 4)
2026-04-22 12:11:35 +08:00
iven
95a05bc6dc feat(hands): Rust原生多引擎搜索 — DuckDuckGo HTML/Bing CN/百度并行聚合
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- 用 DuckDuckGo HTML 搜索(html.duckduckgo.com)替换 Instant Answer API,获得真正搜索结果
- 新增 Bing CN 搜索(cn.bing.com),中文查询自动切换
- 新增百度搜索(baidu.com/s),中文内容覆盖
- CJK 自动检测:中文查询并行搜索 Bing+Baidu+DDG,英文查询 DDG+Bing
- 结果去重(URL) + 按相关性排序
- SearXNG 保留为可选后端,不再强制依赖 Docker
- 137 tests PASS(新增 20 个:HTML解析/CJK检测/辅助函数/引擎测试)
2026-04-22 11:41:19 +08:00