@roarpeng/graphflow 1.4.4 → 1.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (227) hide show
  1. package/AGENTS.md +1 -1
  2. package/CHANGELOG.md +72 -0
  3. package/CLAUDE.md +1 -1
  4. package/README.md +76 -50
  5. package/dist/agents/atp-schema.d.ts +59 -0
  6. package/dist/agents/atp-schema.d.ts.map +1 -0
  7. package/dist/agents/atp-schema.js +3 -0
  8. package/dist/agents/atp-schema.js.map +1 -0
  9. package/dist/agents/decision-engine.d.ts +55 -0
  10. package/dist/agents/decision-engine.d.ts.map +1 -0
  11. package/dist/agents/decision-engine.js +338 -0
  12. package/dist/agents/decision-engine.js.map +1 -0
  13. package/dist/agents/insight.d.ts +69 -2
  14. package/dist/agents/insight.d.ts.map +1 -1
  15. package/dist/agents/insight.js +420 -27
  16. package/dist/agents/insight.js.map +1 -1
  17. package/dist/agents/task-profile.d.ts +19 -0
  18. package/dist/agents/task-profile.d.ts.map +1 -0
  19. package/dist/agents/task-profile.js +64 -0
  20. package/dist/agents/task-profile.js.map +1 -0
  21. package/dist/agents/validator.js +1 -1
  22. package/dist/agents/validator.js.map +1 -1
  23. package/dist/config/defaults.d.ts.map +1 -1
  24. package/dist/config/defaults.js +4 -3
  25. package/dist/config/defaults.js.map +1 -1
  26. package/dist/config/discover-workspace.d.ts.map +1 -1
  27. package/dist/config/discover-workspace.js +13 -2
  28. package/dist/config/discover-workspace.js.map +1 -1
  29. package/dist/config/embedding-factory.d.ts.map +1 -1
  30. package/dist/config/embedding-factory.js +87 -8
  31. package/dist/config/embedding-factory.js.map +1 -1
  32. package/dist/config/loader.d.ts.map +1 -1
  33. package/dist/config/loader.js +10 -4
  34. package/dist/config/loader.js.map +1 -1
  35. package/dist/config/provider-env.d.ts +32 -0
  36. package/dist/config/provider-env.d.ts.map +1 -0
  37. package/dist/config/provider-env.js +51 -0
  38. package/dist/config/provider-env.js.map +1 -0
  39. package/dist/config/resolve.d.ts.map +1 -1
  40. package/dist/config/resolve.js +7 -2
  41. package/dist/config/resolve.js.map +1 -1
  42. package/dist/config/schema.d.ts +17 -3
  43. package/dist/config/schema.d.ts.map +1 -1
  44. package/dist/config/workspace-root.d.ts +0 -12
  45. package/dist/config/workspace-root.d.ts.map +1 -1
  46. package/dist/config/workspace-root.js +21 -5
  47. package/dist/config/workspace-root.js.map +1 -1
  48. package/dist/core/agent-delegation.d.ts +8 -1
  49. package/dist/core/agent-delegation.d.ts.map +1 -1
  50. package/dist/core/agent-delegation.js +233 -38
  51. package/dist/core/agent-delegation.js.map +1 -1
  52. package/dist/core/cancellation.d.ts +57 -0
  53. package/dist/core/cancellation.d.ts.map +1 -0
  54. package/dist/core/cancellation.js +195 -0
  55. package/dist/core/cancellation.js.map +1 -0
  56. package/dist/core/dag-engine.d.ts +6 -1
  57. package/dist/core/dag-engine.d.ts.map +1 -1
  58. package/dist/core/dag-engine.js +67 -9
  59. package/dist/core/dag-engine.js.map +1 -1
  60. package/dist/core/orchestrator-context.d.ts.map +1 -1
  61. package/dist/core/orchestrator-context.js +28 -3
  62. package/dist/core/orchestrator-context.js.map +1 -1
  63. package/dist/core/orchestrator-route.d.ts +1 -1
  64. package/dist/core/orchestrator-route.d.ts.map +1 -1
  65. package/dist/core/orchestrator-route.js.map +1 -1
  66. package/dist/core/orchestrator.js +6 -1
  67. package/dist/core/orchestrator.js.map +1 -1
  68. package/dist/core/runtime-controller.d.ts +19 -0
  69. package/dist/core/runtime-controller.d.ts.map +1 -0
  70. package/dist/core/runtime-controller.js +89 -0
  71. package/dist/core/runtime-controller.js.map +1 -0
  72. package/dist/core/types.d.ts +17 -0
  73. package/dist/core/types.d.ts.map +1 -1
  74. package/dist/graph/context-slicer-types.d.ts +2 -4
  75. package/dist/graph/context-slicer-types.d.ts.map +1 -1
  76. package/dist/graph/context-slicer-types.js.map +1 -1
  77. package/dist/graph/context-slicer.d.ts +1 -0
  78. package/dist/graph/context-slicer.d.ts.map +1 -1
  79. package/dist/graph/context-slicer.js +54 -18
  80. package/dist/graph/context-slicer.js.map +1 -1
  81. package/dist/graph/file-indexer-walker.d.ts +3 -0
  82. package/dist/graph/file-indexer-walker.d.ts.map +1 -1
  83. package/dist/graph/file-indexer-walker.js.map +1 -1
  84. package/dist/graph/file-indexer.d.ts +1 -0
  85. package/dist/graph/file-indexer.d.ts.map +1 -1
  86. package/dist/graph/file-indexer.js +14 -18
  87. package/dist/graph/file-indexer.js.map +1 -1
  88. package/dist/graph/file-watcher.d.ts.map +1 -1
  89. package/dist/graph/file-watcher.js +9 -2
  90. package/dist/graph/file-watcher.js.map +1 -1
  91. package/dist/graph/graph-utils.d.ts +6 -1
  92. package/dist/graph/graph-utils.d.ts.map +1 -1
  93. package/dist/graph/graph-utils.js +116 -2
  94. package/dist/graph/graph-utils.js.map +1 -1
  95. package/dist/graph/graphify-file-client.d.ts.map +1 -1
  96. package/dist/graph/graphify-file-client.js +2 -1
  97. package/dist/graph/graphify-file-client.js.map +1 -1
  98. package/dist/graph/hit-diversify.d.ts +31 -0
  99. package/dist/graph/hit-diversify.d.ts.map +1 -0
  100. package/dist/graph/hit-diversify.js +270 -0
  101. package/dist/graph/hit-diversify.js.map +1 -0
  102. package/dist/graph/language-indexers/go.d.ts.map +1 -1
  103. package/dist/graph/language-indexers/go.js +2 -3
  104. package/dist/graph/language-indexers/go.js.map +1 -1
  105. package/dist/graph/language-indexers/incremental-parse.d.ts +9 -0
  106. package/dist/graph/language-indexers/incremental-parse.d.ts.map +1 -0
  107. package/dist/graph/language-indexers/incremental-parse.js +114 -0
  108. package/dist/graph/language-indexers/incremental-parse.js.map +1 -0
  109. package/dist/graph/language-indexers/python.d.ts.map +1 -1
  110. package/dist/graph/language-indexers/python.js +2 -3
  111. package/dist/graph/language-indexers/python.js.map +1 -1
  112. package/dist/graph/language-indexers/rust.d.ts.map +1 -1
  113. package/dist/graph/language-indexers/rust.js +2 -3
  114. package/dist/graph/language-indexers/rust.js.map +1 -1
  115. package/dist/graph/language-indexers/tree-sitter-loader.d.ts +19 -3
  116. package/dist/graph/language-indexers/tree-sitter-loader.d.ts.map +1 -1
  117. package/dist/graph/language-indexers/tree-sitter-loader.js +24 -4
  118. package/dist/graph/language-indexers/tree-sitter-loader.js.map +1 -1
  119. package/dist/graph/query-expand.d.ts.map +1 -1
  120. package/dist/graph/query-expand.js +2 -0
  121. package/dist/graph/query-expand.js.map +1 -1
  122. package/dist/index.d.ts +1 -1
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +2 -1
  125. package/dist/index.js.map +1 -1
  126. package/dist/integrations/agent-mcp-installer.d.ts +39 -0
  127. package/dist/integrations/agent-mcp-installer.d.ts.map +1 -1
  128. package/dist/integrations/agent-mcp-installer.js +220 -14
  129. package/dist/integrations/agent-mcp-installer.js.map +1 -1
  130. package/dist/learning/embedding-quality.d.ts +46 -0
  131. package/dist/learning/embedding-quality.d.ts.map +1 -0
  132. package/dist/learning/embedding-quality.js +131 -0
  133. package/dist/learning/embedding-quality.js.map +1 -0
  134. package/dist/learning/embeddings.d.ts +46 -3
  135. package/dist/learning/embeddings.d.ts.map +1 -1
  136. package/dist/learning/embeddings.js +186 -26
  137. package/dist/learning/embeddings.js.map +1 -1
  138. package/dist/learning/hnsw-index.d.ts +9 -35
  139. package/dist/learning/hnsw-index.d.ts.map +1 -1
  140. package/dist/learning/hnsw-index.js +8 -154
  141. package/dist/learning/hnsw-index.js.map +1 -1
  142. package/dist/learning/skill-flywheel.d.ts +1 -1
  143. package/dist/learning/skill-flywheel.d.ts.map +1 -1
  144. package/dist/learning/skill-flywheel.js +10 -3
  145. package/dist/learning/skill-flywheel.js.map +1 -1
  146. package/dist/routing/deepseek-tools.d.ts +7 -0
  147. package/dist/routing/deepseek-tools.d.ts.map +1 -0
  148. package/dist/routing/deepseek-tools.js +154 -0
  149. package/dist/routing/deepseek-tools.js.map +1 -0
  150. package/dist/routing/model-router.d.ts +1 -1
  151. package/dist/routing/model-router.d.ts.map +1 -1
  152. package/dist/routing/model-router.js +5 -1
  153. package/dist/routing/model-router.js.map +1 -1
  154. package/dist/routing/provider-adapters/anthropic.d.ts.map +1 -1
  155. package/dist/routing/provider-adapters/anthropic.js +7 -4
  156. package/dist/routing/provider-adapters/anthropic.js.map +1 -1
  157. package/dist/routing/provider-adapters/bailian.d.ts.map +1 -1
  158. package/dist/routing/provider-adapters/bailian.js +7 -4
  159. package/dist/routing/provider-adapters/bailian.js.map +1 -1
  160. package/dist/routing/provider-adapters/deepseek.d.ts +5 -0
  161. package/dist/routing/provider-adapters/deepseek.d.ts.map +1 -0
  162. package/dist/routing/provider-adapters/deepseek.js +109 -0
  163. package/dist/routing/provider-adapters/deepseek.js.map +1 -0
  164. package/dist/routing/provider-adapters/doubao.d.ts.map +1 -1
  165. package/dist/routing/provider-adapters/doubao.js +7 -4
  166. package/dist/routing/provider-adapters/doubao.js.map +1 -1
  167. package/dist/routing/provider-adapters/openai.d.ts +2 -4
  168. package/dist/routing/provider-adapters/openai.d.ts.map +1 -1
  169. package/dist/routing/provider-adapters/openai.js +23 -32
  170. package/dist/routing/provider-adapters/openai.js.map +1 -1
  171. package/dist/routing/provider-adapters/types.d.ts +61 -0
  172. package/dist/routing/provider-adapters/types.d.ts.map +1 -0
  173. package/dist/routing/provider-adapters/types.js +56 -0
  174. package/dist/routing/provider-adapters/types.js.map +1 -0
  175. package/dist/routing/provider-executor.d.ts +6 -1
  176. package/dist/routing/provider-executor.d.ts.map +1 -1
  177. package/dist/routing/provider-executor.js +70 -39
  178. package/dist/routing/provider-executor.js.map +1 -1
  179. package/dist/routing/provider-health.d.ts.map +1 -1
  180. package/dist/routing/provider-health.js +7 -1
  181. package/dist/routing/provider-health.js.map +1 -1
  182. package/dist/routing/role-capabilities.d.ts +11 -0
  183. package/dist/routing/role-capabilities.d.ts.map +1 -0
  184. package/dist/routing/role-capabilities.js +94 -0
  185. package/dist/routing/role-capabilities.js.map +1 -0
  186. package/dist/surfaces/antigravity-rules/graphflow.md +8 -8
  187. package/dist/surfaces/cli/runtime/env.d.ts.map +1 -1
  188. package/dist/surfaces/cli/runtime/env.js +3 -0
  189. package/dist/surfaces/cli/runtime/env.js.map +1 -1
  190. package/dist/surfaces/cli/runtime/facade.d.ts +2 -1
  191. package/dist/surfaces/cli/runtime/facade.d.ts.map +1 -1
  192. package/dist/surfaces/cli/runtime/facade.js +1 -0
  193. package/dist/surfaces/cli/runtime/facade.js.map +1 -1
  194. package/dist/surfaces/cli/runtime/graph.d.ts.map +1 -1
  195. package/dist/surfaces/cli/runtime/graph.js +7 -1
  196. package/dist/surfaces/cli/runtime/graph.js.map +1 -1
  197. package/dist/surfaces/cli/runtime/routing.d.ts +3 -0
  198. package/dist/surfaces/cli/runtime/routing.d.ts.map +1 -1
  199. package/dist/surfaces/cli/runtime/routing.js +31 -4
  200. package/dist/surfaces/cli/runtime/routing.js.map +1 -1
  201. package/dist/surfaces/cli/runtime/settings.d.ts.map +1 -1
  202. package/dist/surfaces/cli/runtime/settings.js +0 -5
  203. package/dist/surfaces/cli/runtime/settings.js.map +1 -1
  204. package/dist/surfaces/cli/runtime/types.d.ts +23 -9
  205. package/dist/surfaces/cli/runtime/types.d.ts.map +1 -1
  206. package/dist/surfaces/cli/runtime.d.ts +1 -1
  207. package/dist/surfaces/cli/runtime.d.ts.map +1 -1
  208. package/dist/surfaces/cli/runtime.js +2 -1
  209. package/dist/surfaces/cli/runtime.js.map +1 -1
  210. package/dist/surfaces/copilot-instructions/graphflow.md +6 -6
  211. package/dist/surfaces/cursor-rules/graphflow.mdc +20 -27
  212. package/dist/surfaces/mcp/server.js +17 -6
  213. package/dist/surfaces/mcp/server.js.map +1 -1
  214. package/dist/surfaces/mcp/tool-definitions.d.ts.map +1 -1
  215. package/dist/surfaces/mcp/tool-definitions.js +31 -124
  216. package/dist/surfaces/mcp/tool-definitions.js.map +1 -1
  217. package/dist/surfaces/mcp/tool-handlers.d.ts.map +1 -1
  218. package/dist/surfaces/mcp/tool-handlers.js +80 -42
  219. package/dist/surfaces/mcp/tool-handlers.js.map +1 -1
  220. package/dist/surfaces/trae-rules/graphflow.md +9 -9
  221. package/dist/surfaces/trae-skill/graphflow/SKILL.md +68 -75
  222. package/package.json +2 -2
  223. package/src/surfaces/antigravity-rules/graphflow.md +8 -8
  224. package/src/surfaces/copilot-instructions/graphflow.md +6 -6
  225. package/src/surfaces/cursor-rules/graphflow.mdc +20 -27
  226. package/src/surfaces/trae-rules/graphflow.md +9 -9
  227. package/src/surfaces/trae-skill/graphflow/SKILL.md +68 -75
package/AGENTS.md CHANGED
@@ -34,7 +34,7 @@ During repository development you can also point Claude Code at this checkout:
34
34
  ## Usage guidance
35
35
 
36
36
  - Ask GraphFlow to plan before broad changes: `graphflow_plan`.
37
- - Ask GraphFlow to compress and anchor code context: `graphflow_preview_context`.
37
+ - Ask GraphFlow to compress and anchor code context: `graphflow_context`.
38
38
  - Ask GraphFlow to inspect graph state or skill learnings when the repo history matters.
39
39
  - After executing work from a `graphflow_run` `executionDescriptor`, **must** call `graphflow_report_outcome` with the `episodeId` from the run result, a `success` boolean, and optional `lessons` to close the skill flywheel loop.
40
40
  - Fall back to `graphflow ... --json` only if MCP is not available (including `graphflow --json outcome report <episodeId> <success>`).
package/CHANGELOG.md CHANGED
@@ -2,8 +2,80 @@
2
2
 
3
3
  All notable changes to this project are documented in this file.
4
4
 
5
+ ## [1.7.4] - 2026-07-13
6
+
7
+ ### Added
8
+
9
+ - **DeepSeek 一等 provider**:`ProviderName` 新增 `deepseek`;默认模型 `deepseek-v4-pro` / `deepseek-v4-flash`;Settings 可选 deepseek
10
+ - **配置→env 桥接**:`resolveConfig` 将 `providers.*.apiKey/baseUrl` 注入 `DEEPSEEK_*` / `OPENAI_*` 等(不覆盖已有环境变量)
11
+ - **DeepSeek 能力**:思考模式(thinking + reasoning_effort)、JSON Output、`reasoning_content` 解析、KV cache usage 记录、可选只读 graph tool_calls
12
+
13
+ ### Fixed
14
+
15
+ - **LLM 配置无法联通**:此前适配器只读环境变量,忽略配置文件中的 apiKey/baseUrl
16
+
5
17
  ## [Unreleased]
6
18
 
19
+ ## [1.7.3] - 2026-07-12
20
+
21
+ ### Fixed
22
+
23
+ - **无痛 Windows MCP**:扩展激活时调用 `repairUnsafeWindowsMcpCommands`,自动扫描 Trae / Trae CN / TRAE SOLO 等已有 `mcp.json`,把含空格的 `command` 就地改成短路径或 `node`(无需手动 Install)
24
+ - **CI Test 挂死**:禁用 vitest/CI 下 embedding 后台预热(HuggingFace MiniLM 下载无超时可卡 30m+);`validate.yml` 设置 `GRAPHFLOW_SKIP_EMBEDDING_WARMUP=1`
25
+
26
+ ## [1.7.2] - 2026-07-12
27
+
28
+ ### Fixed
29
+
30
+ - **Trae/Windows MCP install**:`buildMcpServerNode` / 写入配置时统一将含空格的 `command`(如 `C:\Program Files\nodejs\node.exe`)转为 8.3 短路径或回退 `node`,避免 Trae Solo 经 cmd 无引号启动时出现 `'C:\Program' 不是内部或外部命令`
31
+
32
+ ## [1.7.1] - 2026-07-12
33
+
34
+ ### Added
35
+
36
+ - **Resilient local embedding**:`@xenova/transformers` 缺失或加载失败时自动降级到 `fnv1a-384` hash;支持从 workspace `node_modules` 解析
37
+ - **可选全图向量召回**:`embeddingPolicy.enableFullGraphVectorRecall`(默认 `false`),开启后对带 embedding 的图节点做 HNSW + RRF
38
+ - **P2 transformers 离线缓存路径**:`embeddingPolicy.modelCacheDir` / `transformersCachePath` 或 `GRAPHFLOW_EMBEDDING_CACHE_DIR`
39
+ - **测试**:`m77-embedding-fallback`、`m78-full-graph-vector-recall`
40
+
41
+ ### Changed
42
+
43
+ - **检索降噪**:架构查询提升 `src/graph`/`src/core` 等,降低 `vscode-extension`/`vendor`/`node_modules`/非 src `dist` 权重
44
+ - **Adaptive budget 日志**:`logger.info` → `logger.debug`,避免 MCP stderr 被 IDE 标成伪 error
45
+ - **Installer surface 冻结**:当前 IDE/Agent 安装目标保持维护,不再继续扩展新的 IDE 自动安装面
46
+ - **VSIX / 扩展说明**:`graphflow-vscode@1.7.1` 描述与 README 同步上述行为
47
+ - **Windows MCP launcher**:优先 spawn `.cjs`,避免 `.cmd` + `shell:false` 的 EINVAL
48
+
49
+ ### Notes (VSIX)
50
+
51
+ - VSIX **仍不**捆绑 `@xenova/transformers`(体积与平台原生依赖)
52
+ - 默认 hash embedding 可用;真语义请预置缓存目录
53
+
54
+ ## [1.7.0] - 2026-07-11
55
+
56
+ ### Added
57
+
58
+ - **P0 向量召回修正**:引入 `@xenova/transformers` + `all-MiniLM-L6-v2`(384 维,约 22MB),实现真正的本地语义 embedding 召回
59
+ - **P2 ATP 自适应截断**:简单任务(低优先级、无约束、短描述)自动 short-circuit,跳过 First Principles / Decision Matrix / Reflection,节省 4-6 次 LLM 调用
60
+ - **P2 MCP 工具精简**:18 个工具合并为 10 个核心工具,降低 LLM 工具调用认知负荷
61
+
62
+ ### Changed
63
+
64
+ - **embedding provider 默认改为 `transformers`**:替代原有的 FNV-1a hash embedding(伪语义)
65
+ - **MCP 工具合并**:
66
+ - `graphflow_context` = `preview_context` + `expand_anchor`
67
+ - `graphflow_plan` = `plan` + `plan_insight`(mode 参数区分)
68
+ - `graphflow_index` = `index` + `index_file` + `rebuild`
69
+ - `graphflow_insight` = `submit_insight` + `merge_insight`
70
+ - `graphflow_diagnose` = `diagnose` + `inspect_graph` + `stats`
71
+ - `graphflow_artifact` = `export_artifact` + `import_artifact`
72
+
73
+ ### Removed
74
+
75
+ - **P1 移除 `hnswlib-node`**:彻底移除 C++ 编译依赖,向量召回统一使用纯线性扫描
76
+ - 移除 `graphPolicy.enableHnsw` 配置项及相关代码
77
+ - 移除 `hash` embedding provider 及相关函数
78
+
7
79
  ## [1.4.4] - 2026-07-05
8
80
 
9
81
  ### Added
package/CLAUDE.md CHANGED
@@ -34,7 +34,7 @@ During repository development you can also point Claude Code at this checkout:
34
34
  ## Usage guidance
35
35
 
36
36
  - Ask GraphFlow to plan before broad changes: `graphflow_plan`.
37
- - Ask GraphFlow to compress and anchor code context: `graphflow_preview_context`.
37
+ - Ask GraphFlow to compress and anchor code context: `graphflow_context`.
38
38
  - Ask GraphFlow to inspect graph state or skill learnings when the repo history matters.
39
39
  - After executing work from a `graphflow_run` `executionDescriptor`, **must** call `graphflow_report_outcome` with the `episodeId` from the run result, a `success` boolean, and optional `lessons` to close the skill flywheel loop.
40
40
  - Fall back to `graphflow ... --json` only if MCP is not available (including `graphflow --json outcome report <episodeId> <success>`).
package/README.md CHANGED
@@ -31,7 +31,7 @@ npx @roarpeng/graphflow context preview "orchestrator" --json
31
31
  }
32
32
  ```
33
33
 
34
- 接好后让 agent 优先调用 `graphflow_preview_context` 取压缩上下文;多步任务用 `graphflow_plan`。配置 provider API key 是**可选**的——只在需要 LLM 规划增强时才用。
34
+ 接好后让 agent 优先调用 `graphflow_context` 取压缩上下文;多步任务用 `graphflow_plan`。配置 provider API key 是**可选**的——只在需要 LLM 规划增强时才用。
35
35
 
36
36
  ## 为什么选 GraphFlow(与同类对比)
37
37
 
@@ -48,27 +48,62 @@ npx @roarpeng/graphflow context preview "orchestrator" --json
48
48
 
49
49
  > 实话实说:论纯图谱的成熟度与社区规模,CodeGraph 更领先;论 LSP 符号编辑标准,Serena 更专精;论整库打包,Repomix 更简单。GraphFlow 的价值在于把"图谱 + 压缩 + 规划 + 学习记忆"合到一处,让 agent 不仅省 token,还能跨会话复用项目经验。
50
50
 
51
- ## 当前能力总览(v1.4.0+)
51
+ ## 当前能力总览(v1.7.4+)
52
52
 
53
53
  | 能力域 | 说明 |
54
54
  | --- | --- |
55
- | **任务规划与移交** | 按任务复杂度分流 simple / complex / insight;DAG 规划;`graphflow_plan_insight` 六顶思考帽 + 5-Why 深度分析;默认 **bridge 模式**输出结构化任务描述符交给外部 coding agent 执行 |
56
- | **模型路由** | Smart / Economy 双 tier;多 provider 健康探测与 fallback(OpenAI、Anthropic、百炼、豆包) |
55
+ | **任务规划与移交** | 按任务复杂度分流 simple / complex / insight;DAG 规划;**ATP v1.0 Agent Thinking Protocol**:Intent → Requirement → Six Hats → 5-Why First Principles → Decision Matrix → Planning → Reflection(`planInsight(task, opts, true)` 开启完整 8 阶段分析,简单任务自动 short-circuit);Agent 委托模式生成 work items;默认 **bridge 模式**输出结构化任务描述符交给外部 coding agent 执行 |
56
+
57
+ | **模型路由** | Smart / Economy 双 tier;多 provider 健康探测与 fallback(**DeepSeek**、OpenAI、Anthropic、百炼、豆包) |
57
58
  | **知识图谱** | 工作区 AST 索引(TS/JS/Python/Rust/Go/C/C++/Java/Ruby/Kotlin/Swift);File / Module / Symbol 节点 + 依赖/引用/定义/调用/继承边;图谱 artifact 导入/导出 |
58
- | **上下文压缩** | L1/L2/L3 分层锚点;近无损打包;图结构压缩(边权重+PageRank,零成本默认开启);向量召回 + RRF + HNSW ANN;RepoMap 概览;自适应预算 |
59
- | **持续建图** | 默认 `autoIndexOnSave`;MCP 启动时自动启动 FileWatcher;preview / run 前按需增量索引;MCP `graphflow_index_file` 单文件增量 |
59
+ | **上下文压缩** | L1/L2/L3 分层锚点;近无损打包;图结构压缩(边权重+PageRank,零成本默认开启);向量召回 + RRF 融合;RepoMap 概览;自适应预算 |
60
+ | **持续建图** | 默认 `autoIndexOnSave`;MCP 启动时自动启动 FileWatcher;preview / run 前按需增量索引;MCP `graphflow_index` 单文件增量 |
60
61
  | **学习飞轮** | Episodic Memory(Jaccard + embedding RRF 语义检索)、Reflection(聚类 + Lesson 提取)、Skill 节点(score ±1,bounded [-20,20])、nightly 学习、技能提示注入规划 |
61
- | **可观测性** | `graphflow_stats` 累计 token 节省;VS Code 知识图谱 Snapshot |
62
- | **Agent 接入** | CLI `--json`;MCP stdio(**18 工具**);自动安装 MCP 到 15+ Agent(Cursor / Claude Code / Windsurf / Cline / Codex / Gemini 等) |
62
+ | **可观测性** | `graphflow_diagnose` 累计 token 节省;VS Code 知识图谱 Snapshot |
63
+ | **Agent 接入** | CLI `--json`;MCP stdio(**10 工具**);自动安装 MCP 到 15+ Agent(Cursor / Claude Code / Windsurf / Cline / Codex / Gemini 等) |
63
64
  | **VS Code 扩展** | Settings、建图、路由测试、Context Preview、**知识图谱可视化**、Skill Insights、Chat Agent、一键安装 MCP |
64
65
  | **存储后端** | `file`(JSON)/ `memory` / `sqlite`(FTS5)/ `mcp-http`(Graphify) |
65
66
  | **多项目隔离** | 全局配置共享 LLM/路由;**图谱路径按当前工作区解析**,不再串读其它项目的 `graphflow-out` |
66
- | **工程质量** | TypeScript strict;**56 测试文件 / 249+ tests**;`npm run ci` 含扩展 esbuild 打包与 bundled runtime smoke |
67
+ | **工程质量** | TypeScript strict;**59 测试文件 / 280+ tests**;`npm run ci` 含扩展 esbuild 打包与 bundled runtime smoke |
67
68
 
68
69
  ### 一句话总结
69
70
 
70
71
  > 从 task 描述出发,自动规划 → 路由模型 → 压缩图谱上下文(含向量召回)→ **输出结构化执行描述符交给外部 coding agent**,并把经验沉淀回知识图谱;定位为 **上下文与规划服务(context service)**,而非独立执行器。
71
72
 
73
+ ### v1.7.0 核心(2026-07)
74
+
75
+ **P0 向量召回修正**:废弃 FNV-1a hash embedding,引入 `@xenova/transformers` + `all-MiniLM-L6-v2`(384 维,约 22MB,纯 JS 推理),实现真正的本地语义召回。
76
+
77
+ **P1 移除 hnswlib-node**:彻底移除 C++ 编译依赖,向量召回统一使用纯线性扫描(典型仓库 <10K 节点性能完全够用)。
78
+
79
+ **P2 MCP 工具精简**:18 个工具合并为 10 个核心工具(context、plan、index、insight、diagnose、artifact 等合并),降低 LLM 工具调用认知负荷。
80
+
81
+ **P2 ATP 自适应截断**:简单任务(低优先级、无约束、短描述)自动 short-circuit,跳过 First Principles / Decision Matrix / Reflection,节省 4-6 次 LLM 调用。
82
+
83
+ ---
84
+
85
+ ### v1.5.0 核心(2026-07)
86
+
87
+ **ATP v1.0 Agent Thinking Protocol**:以文档驱动的全链路思考协议增强深度分析流程。
88
+
89
+ **新增 5 个分析阶段**(在 Six Hats + 5-Why 基础上补齐):
90
+
91
+ 1. **Intent Analysis** — 区分显式/隐式意图、核心问题、非目标、成功标准
92
+ 2. **Requirement Analysis** — 结构化功能/非功能需求、优先级、范围(included/excluded)
93
+ 3. **First Principles** — 拆解到不可再分事实、挑战假设
94
+ 4. **Decision Matrix** — 多方案按 5 维度打分(complexity/cost/risk/maintainability/impact)比较后推荐
95
+ 5. **Plan Reflection** — 规划阶段自评置信度、不确定性、缺失信息、改进方向
96
+
97
+ **ATP 类型 IR**:`atp-schema.ts` 导出 `AgentThinkingProtocol` 完整接口,作为 Multi-Agent 共享中间表示。
98
+
99
+ **TaskNode 丰富**:新增 `priority`、`complexity`、`verification`、`inputs`、`outputs`、`risks` 6 个可选字段。
100
+
101
+ **Agent 委托扩展**:work items 扩展(+intent +requirement +first-principles +decision-matrix +reflection),submit/merge 闭环不变。
102
+
103
+ **向后兼容**:`planInsight(task, options)` 不传第三参数时行为不变;`runFullAtp=true` 启用完整 ATP 8 阶段。
104
+
105
+ **P0 残留清理**:移除 VS Code 扩展中对已删除 runtime 方法的调用(`enrichGraph`/`downloadModel`/`showSetupGuide` 命令 + `/enrich` 聊天命令);清理 87 处 OpenBMB/enrichment 残留代码;移除 `canaryAllowed`/`canaryReason` 和 5 个 enrichment 类型字段。
106
+
72
107
  ### v1.4.0 核心(2026-07)
73
108
 
74
109
  **奥卡姆剃刀精简**:移除 OpenBMB 本地部署、语义压缩模型、语义增强器、技能进化、金丝雀门控、本地嵌入模型、向量存储等未产生真实价值的模块。留下的是三条经过验证的闭环链路。
@@ -76,10 +111,9 @@ npx @roarpeng/graphflow context preview "orchestrator" --json
76
111
  **三大核心功能验证修复**:
77
112
 
78
113
  1. **HNSW 向量召回完全打通**(P0 修复)
79
- - `file-indexer` 现在为所有 File/Symbol/Module 节点附加 hash embedding(零成本 FNV-1a,256 维)
114
+ - `file-indexer` 现在为所有 File/Symbol/Module 节点附加真正的语义 embedding(`@xenova/transformers` + `all-MiniLM-L6-v2`,384 维)
80
115
  - `orchestrator-context` 现在传递 `embeddingProvider` + `enableVectorRecall` 到压缩管道
81
- - HNSW 索引持久化路径接通(`vectorStorePath` → `.hnsw` 文件)
82
- - 大仓库(≥200 节点)自动使用 HNSW ANN(10-100x 提速),小仓库线性扫描
116
+ - 向量召回统一使用纯线性扫描,无需 C++ 编译依赖
83
117
 
84
118
  2. **FileWatcher 接入 MCP 启动**(P0 修复)
85
119
  - `startFileWatcherIfEnabled` 此前是死代码,现已接入 MCP 服务器启动路径
@@ -97,7 +131,7 @@ npx @roarpeng/graphflow context preview "orchestrator" --json
97
131
 
98
132
  ### 发布信息
99
133
 
100
- - 最新版本:**v1.4.4**(root + vscode-extension);npm:`@roarpeng/graphflow@1.4.4`
134
+ - 最新版本:**v1.7.4**(root + vscode-extension);npm:`@roarpeng/graphflow@1.7.4`
101
135
  - **GitHub Release**:push 到 `main` 后 CI 在 `windows-2022` 上自动构建 VSIX 并发布到 [GitHub Releases](https://github.com/Roarpeng/GraphFlow/releases)
102
136
  - **npm 发布**:push tag `v*`(如 `v1.4.1`)触发 [Publish npm](https://github.com/Roarpeng/GraphFlow/actions/workflows/publish-npm.yml) 工作流
103
137
  - 变更日志:`CHANGELOG.md`
@@ -107,9 +141,7 @@ npx @roarpeng/graphflow context preview "orchestrator" --json
107
141
  1. Node.js >= 20
108
142
  2. npm >= 10
109
143
  3. Windows / macOS / Linux 均可
110
- 4. **npm 安装 `@roarpeng/graphflow` 时**:`hnswlib-node` 为**强制依赖**(HNSW 向量召回),首次安装会编译原生模块
111
- - **Linux / macOS**:通常自带 C++ 工具链即可
112
- - **Windows**:需安装 [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) 并勾选 **「使用 C++ 的桌面开发」**;或使用 WSL / Linux 环境安装
144
+ 4. **npm 安装 `@roarpeng/graphflow` 时**:纯 JS/TS 依赖,无原生模块编译
113
145
 
114
146
  ## 5 分钟本地试跑
115
147
 
@@ -118,7 +150,7 @@ npm install
118
150
  npm run ci
119
151
  ```
120
152
 
121
- 预期:`lint` 无错误、`build` 成功、**249+ tests** 通过、扩展 bundle 与 runtime smoke 通过。
153
+ 预期:`lint` 无错误、`build` 成功、**280+ tests** 通过、扩展 bundle 与 runtime smoke 通过。
122
154
 
123
155
  ## Agent 工具接入
124
156
 
@@ -133,27 +165,19 @@ GraphFlow 支持两种对外接入方式:
133
165
  npm run start:mcp
134
166
  ```
135
167
 
136
- ### MCP 工具一览(18 个)
168
+ ### MCP 工具一览(10 个)
137
169
 
138
170
  | 工具 | 用途 |
139
171
  | --- | --- |
140
- | `graphflow_preview_context` | 压缩任务相关上下文(**优先调用**) |
141
- | `graphflow_plan` | 多步任务分解与 DAG 规划 |
142
- | `graphflow_plan_insight` | 六顶思考帽 + 5-Why 深度分析后规划(复杂任务) |
172
+ | `graphflow_context` | 预览压缩上下文(query)或扩展锚点(anchorId)(**优先调用**) |
173
+ | `graphflow_plan` | 多步任务分解与 DAG 规划(mode='simple' 或 'insight') |
143
174
  | `graphflow_run` | 规划 + 压缩上下文,输出 bridge 执行描述符 |
144
175
  | `graphflow_report_outcome` | 向 GraphFlow 汇报任务执行结果,用于学习飞轮 |
145
- | `graphflow_submit_insight` | 回传 `agentWorkItems` 中每条 prompt 的外部 agent 分析结果 |
146
- | `graphflow_merge_insight` | 合并已提交的 agent 分析为完整 Six Hats insight + DAG plan |
147
- | `graphflow_expand_anchor` | 扩展指定锚点的上下文详情 |
148
- | `graphflow_index` | 全工作区增量建图 |
149
- | `graphflow_index_file` | 单文件增量建图(适合 onSave / watcher) |
150
- | `graphflow_rebuild` | 清空缓存后全量重建 |
151
- | `graphflow_inspect_graph` | 图谱快照统计与样本节点 |
176
+ | `graphflow_insight` | 提交或合并 agent 分析结果(Six Hats / plan prompts) |
177
+ | `graphflow_index` | 全工作区增量建图、单文件建图或全量重建 |
152
178
  | `graphflow_skill_insights` | 技能学习洞察 |
153
- | `graphflow_diagnose` | 路由与模型健康诊断 |
154
- | `graphflow_export_artifact` | 导出压缩图谱 artifact |
155
- | `graphflow_import_artifact` | 导入图谱 artifact |
156
- | `graphflow_stats` | 累计 token 节省 ROI 统计 |
179
+ | `graphflow_diagnose` | 路由健康、图谱统计与 token 节省 |
180
+ | `graphflow_artifact` | 导出或导入压缩图谱 artifact |
157
181
  | `graphflow_skill_guide` | 获取 GraphFlow Skill 使用指南 |
158
182
 
159
183
  **MCP 建图提示**:用户级 MCP 进程的 `cwd` 不一定是当前项目。请任选其一:
@@ -215,16 +239,15 @@ GraphFlow 的压缩采用「两层渐进」策略,先用零成本图结构压
215
239
  | 层 | 机制 | 成本 | 默认 |
216
240
  | --- | --- | --- | --- |
217
241
  | 图结构压缩 | 边权重连通子图 + PageRank 中心性重排 | 零 LLM | **开启** |
218
- | 向量召回 | hash embedding + RRF 融合;候选 ≥200 自动用 HNSW ANN | LLM | **开启** |
242
+ | 向量召回 | transformers.js embedding + 线性扫描 + RRF 融合 | 本地模型 | **开启** |
219
243
  | RepoMap 概览 | 预算紧张时返回模块级地图 | 零 LLM | opt-in |
220
244
  | 自适应预算 | 按任务复杂度动态调整 token 预算 | 零 LLM | opt-in |
221
245
 
222
246
  **向量召回设计**:
223
247
 
224
- - 索引时:`file-indexer` 为每个节点生成 256 hash embedding(FNV-1a,零成本,无模型推理)
248
+ - 索引时:`file-indexer` 为每个节点生成 384 维语义 embedding(`@xenova/transformers` + `all-MiniLM-L6-v2`,约 22MB,纯 JS 推理)
225
249
  - 查询时:对 query 生成同样维度的 embedding,与图中节点做 cosine similarity
226
- - 大仓库(≥200 候选节点)自动启用 HNSW ANN(hnswlib-node),10-100x 提速
227
- - 小仓库使用线性扫描,避免 HNSW 构建开销
250
+ - 统一使用线性扫描(典型仓库 <10K 节点性能完全够用,无需 HNSW ANN
228
251
  - 关键词检索 + 向量召回结果通过 RRF(Reciprocal Rank Fusion, k=60)融合
229
252
 
230
253
  配置示例:
@@ -232,7 +255,6 @@ GraphFlow 的压缩采用「两层渐进」策略,先用零成本图结构压
232
255
  ```json
233
256
  {
234
257
  "graphPolicy": {
235
- "enableHnsw": true,
236
258
  "compression": {
237
259
  "enableGraphCompression": true,
238
260
  "enableAdaptiveBudget": true
@@ -240,13 +262,16 @@ GraphFlow 的压缩采用「两层渐进」策略,先用零成本图结构压
240
262
  },
241
263
  "embeddingPolicy": {
242
264
  "enabled": true,
243
- "provider": "hash",
265
+ "provider": "transformers",
266
+ "modelCacheDir": "/path/to/preseeded/transformers-cache",
244
267
  "topK": 8,
245
268
  "minSimilarity": 0.05
246
269
  }
247
270
  }
248
271
  ```
249
272
 
273
+ 离线环境可提前预下载 `@xenova/transformers` 模型缓存,并通过 `embeddingPolicy.modelCacheDir` 或环境变量 `GRAPHFLOW_EMBEDDING_CACHE_DIR` 指向该目录。
274
+
250
275
  查看当前压缩与路由状态:
251
276
 
252
277
  ```bash
@@ -324,8 +349,8 @@ Trae 区分 **Rules**(每轮自动加载)与 **Skill**(按需匹配)。
324
349
 
325
350
  | 路径 | 作用 |
326
351
  |------|------|
327
- | `.trae/rules/graphflow.md` | `alwaysApply: true` — 每轮强制先调 `graphflow_preview_context` |
328
- | `.trae/skills/graphflow/SKILL.md` | 详细 18 工具工作流;可用 `#graphflow` 手动触发 |
352
+ | `.trae/rules/graphflow.md` | `alwaysApply: true` — 每轮强制先调 `graphflow_context` |
353
+ | `.trae/skills/graphflow/SKILL.md` | 详细 10 工具工作流;可用 `#graphflow` 手动触发 |
329
354
  | `~/.config/Trae CN/User/skills/graphflow/SKILL.md` | 用户级 Skill(跨项目) |
330
355
  | `User/mcp.json` | GraphFlow MCP 服务器 |
331
356
 
@@ -335,7 +360,7 @@ npx @roarpeng/graphflow install
335
360
  npx @roarpeng/graphflow doctor # 检查 Trae CN rules/skill/MCP 是否就绪
336
361
  ```
337
362
 
338
- **注意**:MCP 配置中不要硬编码 `GRAPHFLOW_WORKSPACE_ROOT` 到其他项目;在 Trae 打开哪个仓库,就让 Agent 在 `graphflow_preview_context` 里传该仓库的 `rootDir`。
363
+ **注意**:MCP 配置中不要硬编码 `GRAPHFLOW_WORKSPACE_ROOT` 到其他项目;在 Trae 打开哪个仓库,就让 Agent 在 `graphflow_context` 里传该仓库的 `rootDir`。
339
364
 
340
365
  ### Antigravity IDE 推荐配置
341
366
 
@@ -402,15 +427,15 @@ cp graphflow.config.example.json graphflow.config.json
402
427
  | `graphPolicy.autoIndexOnSave` | 保存后增量索引(默认 **true**) |
403
428
  | `graphPolicy.autoIndexOnPreview` / `autoIndexOnRun` | preview / run 前自动索引 |
404
429
  | `graphPolicy.enableNearLosslessMode` | 近无损上下文打包 |
405
- | `graphPolicy.enableHnsw` | HNSW ANN 加速(默认 **true**) |
430
+
406
431
  | `graphPolicy.layerQuota` | L1/L2/L3 锚点配额 |
407
432
  | `routingPolicy.enableDynamicRouting` | provider 健康路由 |
408
433
  | `skillPolicy.enableSkillFlywheel` | 技能飞轮 |
409
- | `embeddingPolicy.provider` | embedding 提供者(`hash` 零成本 / `openai`) |
434
+ | `embeddingPolicy.provider` | embedding 提供者(`transformers` 本地 / `openai`) |
410
435
 
411
436
  ## VS Code / Cursor 扩展
412
437
 
413
- 扩展内置 GraphFlow runtime,**安装 VSIX 后无需再 clone 本仓库或配置 `npm run start`**。
438
+ 扩展内置 GraphFlow runtime,**安装 VSIX 后无需再 clone 本仓库或配置 `npm run start`**。VSIX 仍不捆绑 `@xenova/transformers` 模型包;需要本地语义向量时可预置缓存并设置 `GRAPHFLOW_EMBEDDING_CACHE_DIR`。Installer 支持面已冻结,后续不再继续扩展新的 IDE 安装目标。
414
439
 
415
440
  ### 安装 VSIX(推荐)
416
441
 
@@ -423,9 +448,9 @@ cp graphflow.config.example.json graphflow.config.json
423
448
  CLI 安装(若已安装 `code` / `cursor` 命令):
424
449
 
425
450
  ```bash
426
- code --install-extension graphflow-vscode-1.4.4.vsix
451
+ code --install-extension graphflow-vscode-1.7.4.vsix
427
452
  # 或
428
- cursor --install-extension graphflow-vscode-1.4.4.vsix
453
+ cursor --install-extension graphflow-vscode-1.7.4.vsix
429
454
  ```
430
455
 
431
456
  ### 命令面板
@@ -502,10 +527,11 @@ npm run package:extension
502
527
  **API Key 未配置**
503
528
 
504
529
  - 在 `graphflow.config.json` 配置 provider `apiKey`,支持 `${ENV_VAR}` 占位
530
+ - **DeepSeek(推荐)**:`providers.deepseek` + `tiers.*.provider: "deepseek"`,Base URL 默认 `https://api.deepseek.com`,模型用 `deepseek-v4-pro` / `deepseek-v4-flash`(见 [DeepSeek API 文档](https://api-docs.deepseek.com/zh-cn/))
505
531
 
506
532
  **无 LLM 时能用吗**
507
533
 
508
- - 可以:结构索引、图谱可视化、context preview(基于结构图谱 + hash embedding 向量召回)、MCP `graphflow_inspect_graph` 均不强制 LLM
534
+ - 可以:结构索引、图谱可视化、context preview(基于结构图谱 + transformers.js 语义向量召回)、MCP `graphflow_diagnose` 均不强制 LLM
509
535
  - 只有 Six Hats 深度规划和 LLM 语义压缩需要配置 provider
510
536
 
511
537
  ## 项目结构
@@ -515,12 +541,12 @@ GraphFlow/
515
541
  ├── src/
516
542
  │ ├── core/ # 编排核心:orchestrator, triage, dag-engine, types
517
543
  │ ├── graph/ # 索引、上下文切片、图压缩、snapshot
518
- │ ├── routing/ # 模型路由与健康探测(openai/anthropic/bailian/doubao)
544
+ │ ├── routing/ # 模型路由与健康探测(deepseek/openai/anthropic/bailian/doubao)
519
545
  │ ├── learning/ # embeddings, episode, skill-flywheel, reflector, hnsw
520
546
  │ └── surfaces/
521
547
  │ ├── cli/ # CLI + runtime 子模块
522
- │ └── mcp/ # MCP server (18 tools)
523
- ├── tests/ # 56 文件 / 249+ tests
548
+ │ └── mcp/ # MCP server (10 tools)
549
+ ├── tests/ # 59 文件 / 280+ tests
524
550
  ├── vscode-extension/ # VS Code 面板与命令
525
551
  ├── docs/
526
552
  └── CHANGELOG.md
@@ -0,0 +1,59 @@
1
+ export interface IntentAnalysis {
2
+ explicitIntent: string;
3
+ implicitIntent: string;
4
+ coreProblem: string;
5
+ nonGoals: string[];
6
+ successDefinition: string;
7
+ complexity?: "simple" | "moderate" | "complex";
8
+ }
9
+ export interface RequirementAnalysis {
10
+ functional: string[];
11
+ nonFunctional: string[];
12
+ constraints: string[];
13
+ priority: "Low" | "Medium" | "High" | "Critical";
14
+ scope: {
15
+ included: string[];
16
+ excluded: string[];
17
+ };
18
+ }
19
+ export interface FirstPrinciplesAnalysis {
20
+ assumptions: string[];
21
+ facts: string[];
22
+ deconstructedTo: string[];
23
+ challenges: string[];
24
+ }
25
+ export interface DecisionMatrixOption {
26
+ name: string;
27
+ description: string;
28
+ scores: {
29
+ complexity: number;
30
+ cost: number;
31
+ risk: number;
32
+ maintainability: number;
33
+ impact: number;
34
+ };
35
+ pros: string[];
36
+ cons: string[];
37
+ }
38
+ export interface DecisionMatrixResult {
39
+ options: DecisionMatrixOption[];
40
+ recommendedOption: string;
41
+ rationale: string;
42
+ }
43
+ export interface PlanReflection {
44
+ confidence: number;
45
+ uncertainties: string[];
46
+ missingInformation: string[];
47
+ improvementDirections: string[];
48
+ }
49
+ export interface AgentThinkingProtocol {
50
+ task: string;
51
+ intent: IntentAnalysis;
52
+ requirements: RequirementAnalysis;
53
+ sixHatsInsight: import("./insight").SixHatsInsight;
54
+ firstPrinciples: FirstPrinciplesAnalysis;
55
+ decisionMatrix: DecisionMatrixResult;
56
+ plan: import("../core/types").TaskNode[];
57
+ reflection: PlanReflection;
58
+ }
59
+ //# sourceMappingURL=atp-schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atp-schema.d.ts","sourceRoot":"","sources":["../../src/agents/atp-schema.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,cAAc;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,SAAS,CAAC;CAChD;AAGD,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,UAAU,CAAC;IACjD,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACH;AAGD,MAAM,WAAW,uBAAuB;IACtC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAGD,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE;QACN,UAAU,EAAE,MAAM,CAAC;QACnB,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,eAAe,EAAE,MAAM,CAAC;QACxB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,oBAAoB,EAAE,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;CACnB;AAGD,MAAM,WAAW,cAAc;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACjC;AAGD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,cAAc,CAAC;IACvB,YAAY,EAAE,mBAAmB,CAAC;IAClC,cAAc,EAAE,OAAO,WAAW,EAAE,cAAc,CAAC;IACnD,eAAe,EAAE,uBAAuB,CAAC;IACzC,cAAc,EAAE,oBAAoB,CAAC;IACrC,IAAI,EAAE,OAAO,eAAe,EAAE,QAAQ,EAAE,CAAC;IACzC,UAAU,EAAE,cAAc,CAAC;CAC5B"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=atp-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"atp-schema.js","sourceRoot":"","sources":["../../src/agents/atp-schema.ts"],"names":[],"mappings":""}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Decision Engine — First Principles Analysis + Decision Matrix.
3
+ *
4
+ * These two modules form the core of ATP v1.0's analytical depth:
5
+ * - First Principles: strip away assumptions, decompose to fundamental
6
+ * truths, and challenge every belief about the problem.
7
+ * - Decision Matrix: generate viable options, score them across
8
+ * multiple dimensions, and recommend the best path forward.
9
+ *
10
+ * Each module has an LLM-powered version (calls executeRolePrompt) and
11
+ * a heuristic fallback (rule-based, no LLM dependency). The LLM version
12
+ * always falls back to the heuristic when the call fails or the JSON
13
+ * response is unparseable.
14
+ */
15
+ import type { SixHatsInsight, PlanInsightOptions } from "./insight";
16
+ import type { FirstPrinciplesAnalysis, DecisionMatrixResult } from "./atp-schema";
17
+ /** === First Principles Analysis === */
18
+ /**
19
+ * Apply first principles thinking to the task using LLM.
20
+ *
21
+ * Asks the LLM to:
22
+ * 1. List current assumptions (assumptions)
23
+ * 2. Decompose to irreducible facts (facts)
24
+ * 3. Identify fundamental elements (deconstructedTo)
25
+ * 4. Challenge each assumption (challenges)
26
+ *
27
+ * Falls back to heuristic on LLM failure or unparseable response.
28
+ */
29
+ export declare function applyFirstPrinciples(task: string, insight: SixHatsInsight, options: PlanInsightOptions): Promise<FirstPrinciplesAnalysis>;
30
+ /**
31
+ * Heuristic first principles analysis — no LLM calls.
32
+ * Derives assumptions, facts, decomposition, and challenges from
33
+ * the Six Hats insight using rule-based logic.
34
+ */
35
+ export declare function applyFirstPrinciplesHeuristic(task: string, insight: SixHatsInsight): FirstPrinciplesAnalysis;
36
+ /** === Decision Matrix Evaluation === */
37
+ /**
38
+ * Evaluate solution options using a decision matrix with LLM.
39
+ *
40
+ * Asks the LLM to:
41
+ * 1. Generate 2-3 viable options based on first principles analysis
42
+ * 2. Score each option on complexity, cost, risk, maintainability, impact (1-10)
43
+ * 3. List pros and cons for each option
44
+ * 4. Recommend one option with rationale
45
+ *
46
+ * Falls back to heuristic on LLM failure or unparseable response.
47
+ */
48
+ export declare function evaluateOptions(task: string, insight: SixHatsInsight, firstPrinciples: FirstPrinciplesAnalysis, options: PlanInsightOptions): Promise<DecisionMatrixResult>;
49
+ /**
50
+ * Heuristic decision matrix evaluation — no LLM calls.
51
+ * Generates two standard options (Incremental vs Comprehensive)
52
+ * and recommends based on risk count.
53
+ */
54
+ export declare function evaluateOptionsHeuristic(_task: string, insight: SixHatsInsight): DecisionMatrixResult;
55
+ //# sourceMappingURL=decision-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"decision-engine.d.ts","sourceRoot":"","sources":["../../src/agents/decision-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AACpE,OAAO,KAAK,EACV,uBAAuB,EACvB,oBAAoB,EAErB,MAAM,cAAc,CAAC;AAItB,wCAAwC;AAExC;;;;;;;;;;GAUG;AACH,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,uBAAuB,CAAC,CA4ClC;AAED;;;;GAIG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,uBAAuB,CAoBzB;AAED,yCAAyC;AAEzC;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACnC,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,EACvB,eAAe,EAAE,uBAAuB,EACxC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,oBAAoB,CAAC,CAiE/B;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,cAAc,GACtB,oBAAoB,CAwBtB"}