iomgaa
7cd49a5a3f
docs: 同步 app/search/ 模块结构 + OCRProvider 签名到 ARCHITECTURE.md
2026-07-07 06:14:26 -04:00
iomgaa
dc19e9e007
docs: 同步 app/search/ 模块结构 + OCRProvider 签名到 ARCHITECTURE.md
2026-07-07 06:14:26 -04:00
iomgaa
499c5b8043
feat(search): __init__.py 公开 API + 修复 OCR 测试 asyncio 兼容性
2026-07-07 06:13:25 -04:00
iomgaa
c42813992f
feat(search): __init__.py 公开 API + 修复 OCR 测试 asyncio 兼容性
2026-07-07 06:13:25 -04:00
iomgaa
4baf92c93f
feat(search): PromptManager — 搜索 Agent 提示词加载与组装
...
从 TRM4 core/search/prompt.py 迁移。有意变更:
- 工具描述从 app.search.tools.get_tool_descriptions 获取
- format_user_prompt 参数显式化(question/options/l1_node_ids/task_type)
16 个单元测试覆盖 __init__、build_inference_prompt(auto/manual/none
三种 skill_mode)、format_user_prompt、load。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 06:11:13 -04:00
iomgaa
502681694b
feat(search): PromptManager — 搜索 Agent 提示词加载与组装
...
从 TRM4 core/search/prompt.py 迁移。有意变更:
- 工具描述从 app.search.tools.get_tool_descriptions 获取
- format_user_prompt 参数显式化(question/options/l1_node_ids/task_type)
16 个单元测试覆盖 __init__、build_inference_prompt(auto/manual/none
三种 skill_mode)、format_user_prompt、load。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 06:11:13 -04:00
iomgaa
f4f92b0938
feat(search): 实现 SearchToolDispatcher 工具调度器 (Task 7)
...
- 新增 app/search/tools.py:
- get_tool_descriptions() 工具描述文本(与 TRM4 一致)
- SearchToolDispatcher 类实现 ToolDispatcher Protocol
- dispatch() 按工具名路由: view_node / search_similar /
observe_frame / submit_answer / read_skill
- ValueError(未知工具)上抛,KeyError/FileNotFoundError 捕获返回错误文本
- view_node: env.get_node_text + summarize_node + get_children_info + summarize_children
- search_similar: env.search_similar + summarize_nodes_batch
- observe_frame: env.resolve_frame_paths + get_subtitle + observe_frame + 字幕前置
- 修复 app/tree/environment.py get_children_info():
- 原实现返回 _format_time_range (str) 导致 summarize_children 解包失败
- 改为返回原始数值元组 via 新增 _node_time_range_raw 静态方法
- 新增 tests/unit/test_search_tools.py (14 tests):
- get_tool_descriptions 含/不含 read_skill
- 五种工具 dispatch 路由验证
- 未知工具 ValueError + 节点不存在错误文本
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 06:07:27 -04:00
iomgaa
96e63a3e19
feat(search): 实现 SearchToolDispatcher 工具调度器 (Task 7)
...
- 新增 app/search/tools.py:
- get_tool_descriptions() 工具描述文本(与 TRM4 一致)
- SearchToolDispatcher 类实现 ToolDispatcher Protocol
- dispatch() 按工具名路由: view_node / search_similar /
observe_frame / submit_answer / read_skill
- ValueError(未知工具)上抛,KeyError/FileNotFoundError 捕获返回错误文本
- view_node: env.get_node_text + summarize_node + get_children_info + summarize_children
- search_similar: env.search_similar + summarize_nodes_batch
- observe_frame: env.resolve_frame_paths + get_subtitle + observe_frame + 字幕前置
- 修复 app/tree/environment.py get_children_info():
- 原实现返回 _format_time_range (str) 导致 summarize_children 解包失败
- 改为返回原始数值元组 via 新增 _node_time_range_raw 静态方法
- 新增 tests/unit/test_search_tools.py (14 tests):
- get_tool_descriptions 含/不含 read_skill
- 五种工具 dispatch 路由验证
- 未知工具 ValueError + 节点不存在错误文本
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 06:07:27 -04:00
iomgaa
ca3ea1cdf2
style: format summarizer.py
2026-07-07 05:55:40 -04:00
iomgaa
3fe077a249
style: format summarizer.py
2026-07-07 05:55:40 -04:00
iomgaa
ba7fdaddf6
style: format vision.py
2026-07-07 05:53:33 -04:00
iomgaa
b8706adb33
style: format vision.py
2026-07-07 05:53:33 -04:00
iomgaa
3ae3d5ab50
feat(search): app/search/vision.py — 两轮 VLM 帧观察模块
...
从 TRM4 core/tree/vision.py 迁移 observe_frame,关键变更:
- VLM 调用走 VLMProvider.chat_with_images Protocol(images 传 Path)
- OCR 调用走 OCRProvider.transcribe_frames 异步 Protocol
- 遥测字段 session_id / parent_call_id 透传
- 帧文件存在性前置校验
12 个单元测试覆盖:两轮正常、仅提取、OCR 注入/失败降级/None、
VLM 提取失败、VLM 验证失败降级、帧缺失、stats 完整性、
分歧/弃权标记、遥测透传。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 05:52:54 -04:00
iomgaa
d83e720c4b
feat(search): app/search/vision.py — 两轮 VLM 帧观察模块
...
从 TRM4 core/tree/vision.py 迁移 observe_frame,关键变更:
- VLM 调用走 VLMProvider.chat_with_images Protocol(images 传 Path)
- OCR 调用走 OCRProvider.transcribe_frames 异步 Protocol
- 遥测字段 session_id / parent_call_id 透传
- 帧文件存在性前置校验
12 个单元测试覆盖:两轮正常、仅提取、OCR 注入/失败降级/None、
VLM 提取失败、VLM 验证失败降级、帧缺失、stats 完整性、
分歧/弃权标记、遥测透传。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 05:52:54 -04:00
iomgaa
86b19d1e07
feat(adapters): OCRProvider Protocol + MonkeyOCRClient 异步适配器
...
- app/ports.py: 新增 OCRProvider Protocol(runtime_checkable,与
EmbeddingProvider 同级),定义 async transcribe_frames 端口
- adapters/ocr.py: 从 TRM4 core/tree/ocr.py 保真迁移 MonkeyOCRClient
- assert → ValueError(P5 防御性校验)
- 公开方法改 async(asyncio.to_thread 包装同步 HTTP)
- 内部逻辑不变:多端点轮询、线程安全 Session、单帧降级、行去重
- tests/unit/test_ocr_adapter.py: 17 个测试覆盖 Protocol 合规、
构造校验、健康检查、转录、降级、去重、轮询
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 05:47:55 -04:00
iomgaa
224c75ba9e
feat(adapters): OCRProvider Protocol + MonkeyOCRClient 异步适配器
...
- app/ports.py: 新增 OCRProvider Protocol(runtime_checkable,与
EmbeddingProvider 同级),定义 async transcribe_frames 端口
- adapters/ocr.py: 从 TRM4 core/tree/ocr.py 保真迁移 MonkeyOCRClient
- assert → ValueError(P5 防御性校验)
- 公开方法改 async(asyncio.to_thread 包装同步 HTTP)
- 内部逻辑不变:多端点轮询、线程安全 Session、单帧降级、行去重
- tests/unit/test_ocr_adapter.py: 17 个测试覆盖 Protocol 合规、
构造校验、健康检查、转录、降级、去重、轮询
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 05:47:55 -04:00
iomgaa
60e737e2fc
feat(search): app/search/skills.py — 技能注册表与 frontmatter 解析
...
从 TRM4 core/search/skills.py 保真迁移。提供 parse_frontmatter、
strip_frontmatter、SkillRegistry、discover_skills 四个公共 API。
逻辑完全一致,仅调整导入路径并添加中文 docstring。
17 个单元测试全部通过,覆盖正常/异常/边界场景。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 05:46:25 -04:00
iomgaa
83e6475f90
feat(search): app/search/skills.py — 技能注册表与 frontmatter 解析
...
从 TRM4 core/search/skills.py 保真迁移。提供 parse_frontmatter、
strip_frontmatter、SkillRegistry、discover_skills 四个公共 API。
逻辑完全一致,仅调整导入路径并添加中文 docstring。
17 个单元测试全部通过,覆盖正常/异常/边界场景。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 05:46:25 -04:00
iomgaa
82f1607195
style: format environment.py
2026-07-07 05:46:25 -04:00
iomgaa
f0a49b08e5
style: format environment.py
2026-07-07 05:46:25 -04:00
iomgaa
44ee62867d
feat(tree): add get_node_text + get_children_info to TreeEnvironment
...
- get_node_text(node_id, anchor=False): returns raw text + optional
anchor_map dict by parsing [cN]/[sN] prefixes from anchored text
- get_children_info(node_id): returns structured child list with
id/time_range/summary (description truncated to 120 chars)
- Both methods reuse existing internal helpers (_node_full_text,
_node_anchored_text, _get_children, _node_description,
_format_time_range)
- 9 new test cases across TestGetNodeText and TestGetChildrenInfo
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 05:45:48 -04:00
iomgaa
2bc5dc74c2
feat(tree): add get_node_text + get_children_info to TreeEnvironment
...
- get_node_text(node_id, anchor=False): returns raw text + optional
anchor_map dict by parsing [cN]/[sN] prefixes from anchored text
- get_children_info(node_id): returns structured child list with
id/time_range/summary (description truncated to 120 chars)
- Both methods reuse existing internal helpers (_node_full_text,
_node_anchored_text, _get_children, _node_description,
_format_time_range)
- 9 new test cases across TestGetNodeText and TestGetChildrenInfo
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 05:45:48 -04:00
iomgaa
ffb37a1c1e
chore: 复制 TRM4 v2 prompt 种子文件(9 个,字节级一致)
...
.gitignore 添加 !store/prompts/ 例外——prompt 是版本化资源需提交
2026-07-07 05:42:11 -04:00
iomgaa
112876de2e
chore: 复制 TRM4 v2 prompt 种子文件(9 个,字节级一致)
...
.gitignore 添加 !store/prompts/ 例外——prompt 是版本化资源需提交
2026-07-07 05:42:11 -04:00
iomgaa
dcaeefa484
docs(plan): 恢复被 wiki 工具覆盖的计划全文
2026-07-07 05:39:21 -04:00
iomgaa
e36f7c63f3
docs(plan): 恢复被 wiki 工具覆盖的计划全文
2026-07-07 05:39:21 -04:00
iomgaa
7af64db499
docs(plan): app/search/ 搜索 Agent 装配层实现计划(10 Task)
2026-07-07 05:36:25 -04:00
iomgaa
e20bfac48d
docs(plan): app/search/ 搜索 Agent 装配层实现计划(10 Task)
2026-07-07 05:36:25 -04:00
iomgaa
9e1f39c147
docs(design): 修复 Codex 审查发现 — 10 项修正
...
Critical: OCRProvider 移至 app/ports.py;新增 TreeEnvironment 结构化 API;
observe_frame 补充字幕上下文拼接;search_similar 补充节点文本获取
Important: 遥测链路透传 session_id/parent_call_id;异常降级边界明确化;
verify_vision/anchor/assemble_mode 改为必传;Prompt 路径逐文件列出;
测试目录规范化到 tests/unit/
Minor: 依赖图补全 VLMProvider 连线
2026-07-07 05:29:52 -04:00
iomgaa
961e85111b
docs(design): 修复 Codex 审查发现 — 10 项修正
...
Critical: OCRProvider 移至 app/ports.py;新增 TreeEnvironment 结构化 API;
observe_frame 补充字幕上下文拼接;search_similar 补充节点文本获取
Important: 遥测链路透传 session_id/parent_call_id;异常降级边界明确化;
verify_vision/anchor/assemble_mode 改为必传;Prompt 路径逐文件列出;
测试目录规范化到 tests/unit/
Minor: 依赖图补全 VLMProvider 连线
2026-07-07 05:29:52 -04:00
iomgaa
5c89ca543a
docs(design): 补充 summarizer 模块 — view_node/search_similar 的 LLM 两轮摘要
...
自审发现 TRM4 三个搜索工具全有 question-conditioned 中间摘要层,
原设计遗漏了 summarizer.py。新增:
- §4.4 summarizer API(summarize_node / _children / _nodes_batch)
- anchor 锚模式完整保留
- 6 个额外 prompt 文件
- 更新交互流程图、错误处理、测试策略
2026-07-07 05:22:55 -04:00
iomgaa
bc18fc8635
docs(design): 补充 summarizer 模块 — view_node/search_similar 的 LLM 两轮摘要
...
自审发现 TRM4 三个搜索工具全有 question-conditioned 中间摘要层,
原设计遗漏了 summarizer.py。新增:
- §4.4 summarizer API(summarize_node / _children / _nodes_batch)
- anchor 锚模式完整保留
- 6 个额外 prompt 文件
- 更新交互流程图、错误处理、测试策略
2026-07-07 05:22:55 -04:00
iomgaa
11107f5758
docs(design): 搜索 Agent 装配层设计(app/search/)
...
方案 A 平铺模块:prompt.py / skills.py / tools.py / vision.py
新增 OCRProvider Protocol + adapters/ocr.py
Prompt 从 TRM4 store/prompts/v2/ 原封不动复制
2026-07-07 05:15:22 -04:00
iomgaa
5ab5adec51
docs(design): 搜索 Agent 装配层设计(app/search/)
...
方案 A 平铺模块:prompt.py / skills.py / tools.py / vision.py
新增 OCRProvider Protocol + adapters/ocr.py
Prompt 从 TRM4 store/prompts/v2/ 原封不动复制
2026-07-07 05:15:22 -04:00
iomgaa
da28c10c84
docs: 同步 question_gen 模块路径到 ARCHITECTURE.md 和 CLAUDE.md
...
DataLoader 代码位置 generator.py → loader.py;
目录树更新 question_gen/ 结构反映实际文件。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 04:51:26 -04:00
iomgaa
253f36797b
docs: 同步 question_gen 模块路径到 ARCHITECTURE.md 和 CLAUDE.md
...
DataLoader 代码位置 generator.py → loader.py;
目录树更新 question_gen/ 结构反映实际文件。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 04:51:26 -04:00
iomgaa
d8a903fb54
feat(question_gen): QuestionGenerator Protocol + 模块公开 API
...
app/ports.py 追加 QuestionGenerator Protocol(预留 LLM 出题接口)。
app/question_gen/__init__.py re-export load_benchmark 和 stratified_sample。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 04:48:21 -04:00
iomgaa
f94c352d66
feat(question_gen): QuestionGenerator Protocol + 模块公开 API
...
app/ports.py 追加 QuestionGenerator Protocol(预留 LLM 出题接口)。
app/question_gen/__init__.py re-export load_benchmark 和 stratified_sample。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 04:48:21 -04:00
iomgaa
8d515ff01f
feat(question_gen): stratified_sample — 分层采样 + 题型保底
...
算法 100% 保真 TRM4: task_types 过滤、correctness.get(id, False) 语义、
对题在前返回顺序、min_per_class 遍历 pool 全部题型(含稀疏类)。
所有参数显式传入,无默认值。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 04:45:19 -04:00
iomgaa
c4d42eeca0
feat(question_gen): stratified_sample — 分层采样 + 题型保底
...
算法 100% 保真 TRM4: task_types 过滤、correctness.get(id, False) 语义、
对题在前返回顺序、min_per_class 遍历 pool 全部题型(含稀疏类)。
所有参数显式传入,无默认值。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 04:45:19 -04:00
iomgaa
dea8a7d3f6
feat(question_gen): load_benchmark — benchmark JSON 加载
...
从 JSON 目录 glob *.json 加载题目,stem 作 video_id。
legacy schema 无 difficulty 字段时赋 _LEGACY_DEFAULT_DIFFICULTY 常量。
options/source_nodes 转 tuple 配合 frozen dataclass。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 04:41:25 -04:00
iomgaa
8f5fbf8d2d
feat(question_gen): load_benchmark — benchmark JSON 加载
...
从 JSON 目录 glob *.json 加载题目,stem 作 video_id。
legacy schema 无 difficulty 字段时赋 _LEGACY_DEFAULT_DIFFICULTY 常量。
options/source_nodes 转 tuple 配合 frozen dataclass。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 04:41:25 -04:00
iomgaa
eea3bcba3f
feat(core): 追加 GeneratedQuestion frozen dataclass
...
跨层共享类型,被 core/evolution/ 和 app/harness/、app/question_gen/ 使用。
frozen=True + tuple 字段确保不可变。无默认值(显式传入)。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 04:36:56 -04:00
iomgaa
9bdfd28c63
feat(core): 追加 GeneratedQuestion frozen dataclass
...
跨层共享类型,被 core/evolution/ 和 app/harness/、app/question_gen/ 使用。
frozen=True + tuple 字段确保不可变。无默认值(显式传入)。
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 04:36:56 -04:00
iomgaa
4686adf266
feat(tree/repair): 检测器扩展 — visible_entities/ongoing_actions/spatial_layout 为空也触发修复
2026-07-07 03:15:42 -04:00
iomgaa
15fad65b1b
feat(tree/repair): 检测器扩展 — visible_entities/ongoing_actions/spatial_layout 为空也触发修复
2026-07-07 03:15:42 -04:00
iomgaa
ee5bd0de57
fix(tools): handle None card in flat tree conversion
2026-07-07 03:13:38 -04:00
iomgaa
faf6f1bd63
fix(tools): handle None card in flat tree conversion
2026-07-07 03:13:38 -04:00
iomgaa
73b240cc84
test(tree): 建树模块端到端集成测试
...
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 02:44:28 -04:00
iomgaa
c61ceca538
test(tree): 建树模块端到端集成测试
...
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com >
2026-07-07 02:44:28 -04:00