@roarpeng/graphflow 1.7.0 → 1.7.5

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 (332) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +13 -10
  3. package/dist/agents/insight.d.ts +13 -2
  4. package/dist/agents/insight.d.ts.map +1 -1
  5. package/dist/agents/insight.js +56 -26
  6. package/dist/agents/insight.js.map +1 -1
  7. package/dist/agents/task-profile.d.ts +19 -0
  8. package/dist/agents/task-profile.d.ts.map +1 -0
  9. package/dist/agents/task-profile.js +64 -0
  10. package/dist/agents/task-profile.js.map +1 -0
  11. package/dist/agents/validator.js +1 -1
  12. package/dist/agents/validator.js.map +1 -1
  13. package/dist/config/defaults.d.ts.map +1 -1
  14. package/dist/config/defaults.js +3 -1
  15. package/dist/config/defaults.js.map +1 -1
  16. package/dist/config/discover-workspace.d.ts.map +1 -1
  17. package/dist/config/discover-workspace.js +10 -2
  18. package/dist/config/discover-workspace.js.map +1 -1
  19. package/dist/config/embedding-factory.d.ts.map +1 -1
  20. package/dist/config/embedding-factory.js +88 -9
  21. package/dist/config/embedding-factory.js.map +1 -1
  22. package/dist/config/loader.d.ts.map +1 -1
  23. package/dist/config/loader.js +9 -2
  24. package/dist/config/loader.js.map +1 -1
  25. package/dist/config/provider-env.d.ts +32 -0
  26. package/dist/config/provider-env.d.ts.map +1 -0
  27. package/dist/config/provider-env.js +51 -0
  28. package/dist/config/provider-env.js.map +1 -0
  29. package/dist/config/resolve.d.ts.map +1 -1
  30. package/dist/config/resolve.js +7 -2
  31. package/dist/config/resolve.js.map +1 -1
  32. package/dist/config/schema.d.ts +17 -2
  33. package/dist/config/schema.d.ts.map +1 -1
  34. package/dist/config/workspace-root.d.ts +0 -12
  35. package/dist/config/workspace-root.d.ts.map +1 -1
  36. package/dist/config/workspace-root.js +21 -5
  37. package/dist/config/workspace-root.js.map +1 -1
  38. package/dist/core/agent-delegation.d.ts +5 -0
  39. package/dist/core/agent-delegation.d.ts.map +1 -1
  40. package/dist/core/agent-delegation.js +131 -57
  41. package/dist/core/agent-delegation.js.map +1 -1
  42. package/dist/core/cancellation.d.ts +57 -0
  43. package/dist/core/cancellation.d.ts.map +1 -0
  44. package/dist/core/cancellation.js +195 -0
  45. package/dist/core/cancellation.js.map +1 -0
  46. package/dist/core/dag-engine.d.ts +6 -1
  47. package/dist/core/dag-engine.d.ts.map +1 -1
  48. package/dist/core/dag-engine.js +67 -9
  49. package/dist/core/dag-engine.js.map +1 -1
  50. package/dist/core/orchestrator-context.d.ts.map +1 -1
  51. package/dist/core/orchestrator-context.js +3 -0
  52. package/dist/core/orchestrator-context.js.map +1 -1
  53. package/dist/core/orchestrator-route.d.ts +1 -1
  54. package/dist/core/orchestrator-route.d.ts.map +1 -1
  55. package/dist/core/orchestrator-route.js.map +1 -1
  56. package/dist/core/orchestrator.d.ts.map +1 -1
  57. package/dist/core/orchestrator.js +61 -42
  58. package/dist/core/orchestrator.js.map +1 -1
  59. package/dist/core/runtime-controller.d.ts +19 -0
  60. package/dist/core/runtime-controller.d.ts.map +1 -0
  61. package/dist/core/runtime-controller.js +89 -0
  62. package/dist/core/runtime-controller.js.map +1 -0
  63. package/dist/core/types.d.ts +5 -0
  64. package/dist/core/types.d.ts.map +1 -1
  65. package/dist/graph/context-cache.d.ts +23 -0
  66. package/dist/graph/context-cache.d.ts.map +1 -0
  67. package/dist/graph/context-cache.js +92 -0
  68. package/dist/graph/context-cache.js.map +1 -0
  69. package/dist/graph/context-slicer-types.d.ts +2 -0
  70. package/dist/graph/context-slicer-types.d.ts.map +1 -1
  71. package/dist/graph/context-slicer-types.js.map +1 -1
  72. package/dist/graph/context-slicer.d.ts +1 -0
  73. package/dist/graph/context-slicer.d.ts.map +1 -1
  74. package/dist/graph/context-slicer.js +54 -8
  75. package/dist/graph/context-slicer.js.map +1 -1
  76. package/dist/graph/file-indexer.d.ts +4 -1
  77. package/dist/graph/file-indexer.d.ts.map +1 -1
  78. package/dist/graph/file-indexer.js +16 -5
  79. package/dist/graph/file-indexer.js.map +1 -1
  80. package/dist/graph/file-watcher.d.ts.map +1 -1
  81. package/dist/graph/file-watcher.js +9 -2
  82. package/dist/graph/file-watcher.js.map +1 -1
  83. package/dist/graph/graph-utils.d.ts +6 -1
  84. package/dist/graph/graph-utils.d.ts.map +1 -1
  85. package/dist/graph/graph-utils.js +116 -2
  86. package/dist/graph/graph-utils.js.map +1 -1
  87. package/dist/graph/graphify-file-client.d.ts.map +1 -1
  88. package/dist/graph/graphify-file-client.js +2 -1
  89. package/dist/graph/graphify-file-client.js.map +1 -1
  90. package/dist/graph/hit-diversify.d.ts +31 -0
  91. package/dist/graph/hit-diversify.d.ts.map +1 -0
  92. package/dist/graph/hit-diversify.js +270 -0
  93. package/dist/graph/hit-diversify.js.map +1 -0
  94. package/dist/graph/language-indexers/go.d.ts.map +1 -1
  95. package/dist/graph/language-indexers/go.js +2 -3
  96. package/dist/graph/language-indexers/go.js.map +1 -1
  97. package/dist/graph/language-indexers/incremental-parse.d.ts +9 -0
  98. package/dist/graph/language-indexers/incremental-parse.d.ts.map +1 -0
  99. package/dist/graph/language-indexers/incremental-parse.js +114 -0
  100. package/dist/graph/language-indexers/incremental-parse.js.map +1 -0
  101. package/dist/graph/language-indexers/python.d.ts.map +1 -1
  102. package/dist/graph/language-indexers/python.js +2 -3
  103. package/dist/graph/language-indexers/python.js.map +1 -1
  104. package/dist/graph/language-indexers/rust.d.ts.map +1 -1
  105. package/dist/graph/language-indexers/rust.js +2 -3
  106. package/dist/graph/language-indexers/rust.js.map +1 -1
  107. package/dist/graph/language-indexers/tree-sitter-loader.d.ts +19 -3
  108. package/dist/graph/language-indexers/tree-sitter-loader.d.ts.map +1 -1
  109. package/dist/graph/language-indexers/tree-sitter-loader.js +24 -4
  110. package/dist/graph/language-indexers/tree-sitter-loader.js.map +1 -1
  111. package/dist/graph/query-expand.d.ts.map +1 -1
  112. package/dist/graph/query-expand.js +2 -0
  113. package/dist/graph/query-expand.js.map +1 -1
  114. package/dist/index.d.ts +1 -1
  115. package/dist/index.d.ts.map +1 -1
  116. package/dist/index.js +2 -1
  117. package/dist/index.js.map +1 -1
  118. package/dist/integrations/agent-mcp-installer.d.ts +39 -0
  119. package/dist/integrations/agent-mcp-installer.d.ts.map +1 -1
  120. package/dist/integrations/agent-mcp-installer.js +242 -31
  121. package/dist/integrations/agent-mcp-installer.js.map +1 -1
  122. package/dist/integrations/agent-profiles/index.d.ts +26 -0
  123. package/dist/integrations/agent-profiles/index.d.ts.map +1 -0
  124. package/dist/integrations/agent-profiles/index.js +31 -0
  125. package/dist/integrations/agent-profiles/index.js.map +1 -0
  126. package/dist/integrations/agent-profiles/profiles/amazon-q.d.ts +2 -0
  127. package/dist/integrations/agent-profiles/profiles/amazon-q.d.ts.map +1 -0
  128. package/dist/integrations/agent-profiles/profiles/amazon-q.js +18 -0
  129. package/dist/integrations/agent-profiles/profiles/amazon-q.js.map +1 -0
  130. package/dist/integrations/agent-profiles/profiles/antigravity.d.ts +2 -0
  131. package/dist/integrations/agent-profiles/profiles/antigravity.d.ts.map +1 -0
  132. package/dist/integrations/agent-profiles/profiles/antigravity.js +33 -0
  133. package/dist/integrations/agent-profiles/profiles/antigravity.js.map +1 -0
  134. package/dist/integrations/agent-profiles/profiles/claude-code.d.ts +2 -0
  135. package/dist/integrations/agent-profiles/profiles/claude-code.d.ts.map +1 -0
  136. package/dist/integrations/agent-profiles/profiles/claude-code.js +22 -0
  137. package/dist/integrations/agent-profiles/profiles/claude-code.js.map +1 -0
  138. package/dist/integrations/agent-profiles/profiles/cline.d.ts +2 -0
  139. package/dist/integrations/agent-profiles/profiles/cline.d.ts.map +1 -0
  140. package/dist/integrations/agent-profiles/profiles/cline.js +33 -0
  141. package/dist/integrations/agent-profiles/profiles/cline.js.map +1 -0
  142. package/dist/integrations/agent-profiles/profiles/codex.d.ts +2 -0
  143. package/dist/integrations/agent-profiles/profiles/codex.d.ts.map +1 -0
  144. package/dist/integrations/agent-profiles/profiles/codex.js +22 -0
  145. package/dist/integrations/agent-profiles/profiles/codex.js.map +1 -0
  146. package/dist/integrations/agent-profiles/profiles/continue.d.ts +2 -0
  147. package/dist/integrations/agent-profiles/profiles/continue.d.ts.map +1 -0
  148. package/dist/integrations/agent-profiles/profiles/continue.js +23 -0
  149. package/dist/integrations/agent-profiles/profiles/continue.js.map +1 -0
  150. package/dist/integrations/agent-profiles/profiles/cursor.d.ts +2 -0
  151. package/dist/integrations/agent-profiles/profiles/cursor.d.ts.map +1 -0
  152. package/dist/integrations/agent-profiles/profiles/cursor.js +28 -0
  153. package/dist/integrations/agent-profiles/profiles/cursor.js.map +1 -0
  154. package/dist/integrations/agent-profiles/profiles/gemini.d.ts +2 -0
  155. package/dist/integrations/agent-profiles/profiles/gemini.d.ts.map +1 -0
  156. package/dist/integrations/agent-profiles/profiles/gemini.js +30 -0
  157. package/dist/integrations/agent-profiles/profiles/gemini.js.map +1 -0
  158. package/dist/integrations/agent-profiles/profiles/kilocode.d.ts +2 -0
  159. package/dist/integrations/agent-profiles/profiles/kilocode.d.ts.map +1 -0
  160. package/dist/integrations/agent-profiles/profiles/kilocode.js +33 -0
  161. package/dist/integrations/agent-profiles/profiles/kilocode.js.map +1 -0
  162. package/dist/integrations/agent-profiles/profiles/pearai.d.ts +2 -0
  163. package/dist/integrations/agent-profiles/profiles/pearai.d.ts.map +1 -0
  164. package/dist/integrations/agent-profiles/profiles/pearai.js +23 -0
  165. package/dist/integrations/agent-profiles/profiles/pearai.js.map +1 -0
  166. package/dist/integrations/agent-profiles/profiles/qoder.d.ts +2 -0
  167. package/dist/integrations/agent-profiles/profiles/qoder.d.ts.map +1 -0
  168. package/dist/integrations/agent-profiles/profiles/qoder.js +32 -0
  169. package/dist/integrations/agent-profiles/profiles/qoder.js.map +1 -0
  170. package/dist/integrations/agent-profiles/profiles/roo-code.d.ts +2 -0
  171. package/dist/integrations/agent-profiles/profiles/roo-code.d.ts.map +1 -0
  172. package/dist/integrations/agent-profiles/profiles/roo-code.js +33 -0
  173. package/dist/integrations/agent-profiles/profiles/roo-code.js.map +1 -0
  174. package/dist/integrations/agent-profiles/profiles/trae.d.ts +2 -0
  175. package/dist/integrations/agent-profiles/profiles/trae.d.ts.map +1 -0
  176. package/dist/integrations/agent-profiles/profiles/trae.js +42 -0
  177. package/dist/integrations/agent-profiles/profiles/trae.js.map +1 -0
  178. package/dist/integrations/agent-profiles/profiles/vscode.d.ts +2 -0
  179. package/dist/integrations/agent-profiles/profiles/vscode.d.ts.map +1 -0
  180. package/dist/integrations/agent-profiles/profiles/vscode.js +28 -0
  181. package/dist/integrations/agent-profiles/profiles/vscode.js.map +1 -0
  182. package/dist/integrations/agent-profiles/profiles/windsurf.d.ts +2 -0
  183. package/dist/integrations/agent-profiles/profiles/windsurf.d.ts.map +1 -0
  184. package/dist/integrations/agent-profiles/profiles/windsurf.js +21 -0
  185. package/dist/integrations/agent-profiles/profiles/windsurf.js.map +1 -0
  186. package/dist/integrations/agent-profiles/profiles/zed.d.ts +2 -0
  187. package/dist/integrations/agent-profiles/profiles/zed.d.ts.map +1 -0
  188. package/dist/integrations/agent-profiles/profiles/zed.js +26 -0
  189. package/dist/integrations/agent-profiles/profiles/zed.js.map +1 -0
  190. package/dist/integrations/agent-profiles/registry.d.ts +5 -0
  191. package/dist/integrations/agent-profiles/registry.d.ts.map +1 -0
  192. package/dist/integrations/agent-profiles/registry.js +45 -0
  193. package/dist/integrations/agent-profiles/registry.js.map +1 -0
  194. package/dist/integrations/agent-profiles/skills/antigravity.d.ts +2 -0
  195. package/dist/integrations/agent-profiles/skills/antigravity.d.ts.map +1 -0
  196. package/dist/integrations/agent-profiles/skills/antigravity.js +13 -0
  197. package/dist/integrations/agent-profiles/skills/antigravity.js.map +1 -0
  198. package/dist/integrations/agent-profiles/skills/claude-code.d.ts +2 -0
  199. package/dist/integrations/agent-profiles/skills/claude-code.d.ts.map +1 -0
  200. package/dist/integrations/agent-profiles/skills/claude-code.js +13 -0
  201. package/dist/integrations/agent-profiles/skills/claude-code.js.map +1 -0
  202. package/dist/integrations/agent-profiles/skills/codex.d.ts +2 -0
  203. package/dist/integrations/agent-profiles/skills/codex.d.ts.map +1 -0
  204. package/dist/integrations/agent-profiles/skills/codex.js +18 -0
  205. package/dist/integrations/agent-profiles/skills/codex.js.map +1 -0
  206. package/dist/integrations/agent-profiles/skills/cursor.d.ts +2 -0
  207. package/dist/integrations/agent-profiles/skills/cursor.d.ts.map +1 -0
  208. package/dist/integrations/agent-profiles/skills/cursor.js +13 -0
  209. package/dist/integrations/agent-profiles/skills/cursor.js.map +1 -0
  210. package/dist/integrations/agent-profiles/skills/kilocode.d.ts +2 -0
  211. package/dist/integrations/agent-profiles/skills/kilocode.d.ts.map +1 -0
  212. package/dist/integrations/agent-profiles/skills/kilocode.js +13 -0
  213. package/dist/integrations/agent-profiles/skills/kilocode.js.map +1 -0
  214. package/dist/integrations/agent-profiles/skills/qoder.d.ts +2 -0
  215. package/dist/integrations/agent-profiles/skills/qoder.d.ts.map +1 -0
  216. package/dist/integrations/agent-profiles/skills/qoder.js +13 -0
  217. package/dist/integrations/agent-profiles/skills/qoder.js.map +1 -0
  218. package/dist/integrations/agent-profiles/skills/roo-code.d.ts +2 -0
  219. package/dist/integrations/agent-profiles/skills/roo-code.d.ts.map +1 -0
  220. package/dist/integrations/agent-profiles/skills/roo-code.js +13 -0
  221. package/dist/integrations/agent-profiles/skills/roo-code.js.map +1 -0
  222. package/dist/integrations/agent-profiles/types.d.ts +31 -0
  223. package/dist/integrations/agent-profiles/types.d.ts.map +1 -0
  224. package/dist/integrations/agent-profiles/types.js +3 -0
  225. package/dist/integrations/agent-profiles/types.js.map +1 -0
  226. package/dist/integrations/agent-profiles/utils.d.ts +12 -0
  227. package/dist/integrations/agent-profiles/utils.d.ts.map +1 -0
  228. package/dist/integrations/agent-profiles/utils.js +75 -0
  229. package/dist/integrations/agent-profiles/utils.js.map +1 -0
  230. package/dist/integrations/errors.d.ts +28 -0
  231. package/dist/integrations/errors.d.ts.map +1 -0
  232. package/dist/integrations/errors.js +97 -0
  233. package/dist/integrations/errors.js.map +1 -0
  234. package/dist/integrations/skill-health.d.ts +24 -0
  235. package/dist/integrations/skill-health.d.ts.map +1 -0
  236. package/dist/integrations/skill-health.js +111 -0
  237. package/dist/integrations/skill-health.js.map +1 -0
  238. package/dist/integrations/skill-installer.d.ts.map +1 -1
  239. package/dist/integrations/skill-installer.js +5 -8
  240. package/dist/integrations/skill-installer.js.map +1 -1
  241. package/dist/learning/embedding-quality.d.ts +46 -0
  242. package/dist/learning/embedding-quality.d.ts.map +1 -0
  243. package/dist/learning/embedding-quality.js +131 -0
  244. package/dist/learning/embedding-quality.js.map +1 -0
  245. package/dist/learning/embeddings.d.ts +45 -1
  246. package/dist/learning/embeddings.d.ts.map +1 -1
  247. package/dist/learning/embeddings.js +180 -5
  248. package/dist/learning/embeddings.js.map +1 -1
  249. package/dist/learning/skill-flywheel.d.ts +1 -1
  250. package/dist/learning/skill-flywheel.d.ts.map +1 -1
  251. package/dist/learning/skill-flywheel.js +10 -3
  252. package/dist/learning/skill-flywheel.js.map +1 -1
  253. package/dist/routing/deepseek-tools.d.ts +7 -0
  254. package/dist/routing/deepseek-tools.d.ts.map +1 -0
  255. package/dist/routing/deepseek-tools.js +154 -0
  256. package/dist/routing/deepseek-tools.js.map +1 -0
  257. package/dist/routing/model-router.d.ts +1 -1
  258. package/dist/routing/model-router.d.ts.map +1 -1
  259. package/dist/routing/model-router.js +5 -1
  260. package/dist/routing/model-router.js.map +1 -1
  261. package/dist/routing/provider-adapters/anthropic.d.ts.map +1 -1
  262. package/dist/routing/provider-adapters/anthropic.js +7 -4
  263. package/dist/routing/provider-adapters/anthropic.js.map +1 -1
  264. package/dist/routing/provider-adapters/bailian.d.ts.map +1 -1
  265. package/dist/routing/provider-adapters/bailian.js +7 -4
  266. package/dist/routing/provider-adapters/bailian.js.map +1 -1
  267. package/dist/routing/provider-adapters/deepseek.d.ts +5 -0
  268. package/dist/routing/provider-adapters/deepseek.d.ts.map +1 -0
  269. package/dist/routing/provider-adapters/deepseek.js +109 -0
  270. package/dist/routing/provider-adapters/deepseek.js.map +1 -0
  271. package/dist/routing/provider-adapters/doubao.d.ts.map +1 -1
  272. package/dist/routing/provider-adapters/doubao.js +7 -4
  273. package/dist/routing/provider-adapters/doubao.js.map +1 -1
  274. package/dist/routing/provider-adapters/openai.d.ts +2 -4
  275. package/dist/routing/provider-adapters/openai.d.ts.map +1 -1
  276. package/dist/routing/provider-adapters/openai.js +23 -32
  277. package/dist/routing/provider-adapters/openai.js.map +1 -1
  278. package/dist/routing/provider-adapters/types.d.ts +61 -0
  279. package/dist/routing/provider-adapters/types.d.ts.map +1 -0
  280. package/dist/routing/provider-adapters/types.js +56 -0
  281. package/dist/routing/provider-adapters/types.js.map +1 -0
  282. package/dist/routing/provider-executor.d.ts +6 -1
  283. package/dist/routing/provider-executor.d.ts.map +1 -1
  284. package/dist/routing/provider-executor.js +70 -39
  285. package/dist/routing/provider-executor.js.map +1 -1
  286. package/dist/routing/provider-health.d.ts.map +1 -1
  287. package/dist/routing/provider-health.js +7 -1
  288. package/dist/routing/provider-health.js.map +1 -1
  289. package/dist/routing/role-capabilities.d.ts +11 -0
  290. package/dist/routing/role-capabilities.d.ts.map +1 -0
  291. package/dist/routing/role-capabilities.js +94 -0
  292. package/dist/routing/role-capabilities.js.map +1 -0
  293. package/dist/surfaces/antigravity-rules/graphflow.md +3 -2
  294. package/dist/surfaces/cli/runtime/env.d.ts.map +1 -1
  295. package/dist/surfaces/cli/runtime/env.js +3 -0
  296. package/dist/surfaces/cli/runtime/env.js.map +1 -1
  297. package/dist/surfaces/cli/runtime/facade.d.ts +2 -1
  298. package/dist/surfaces/cli/runtime/facade.d.ts.map +1 -1
  299. package/dist/surfaces/cli/runtime/facade.js +1 -0
  300. package/dist/surfaces/cli/runtime/facade.js.map +1 -1
  301. package/dist/surfaces/cli/runtime/graph.d.ts.map +1 -1
  302. package/dist/surfaces/cli/runtime/graph.js +18 -2
  303. package/dist/surfaces/cli/runtime/graph.js.map +1 -1
  304. package/dist/surfaces/cli/runtime/routing.d.ts +3 -0
  305. package/dist/surfaces/cli/runtime/routing.d.ts.map +1 -1
  306. package/dist/surfaces/cli/runtime/routing.js +34 -6
  307. package/dist/surfaces/cli/runtime/routing.js.map +1 -1
  308. package/dist/surfaces/cli/runtime/types.d.ts +24 -1
  309. package/dist/surfaces/cli/runtime/types.d.ts.map +1 -1
  310. package/dist/surfaces/cli/runtime.d.ts +1 -1
  311. package/dist/surfaces/cli/runtime.d.ts.map +1 -1
  312. package/dist/surfaces/cli/runtime.js +2 -1
  313. package/dist/surfaces/cli/runtime.js.map +1 -1
  314. package/dist/surfaces/copilot-instructions/graphflow.md +3 -2
  315. package/dist/surfaces/cursor-rules/graphflow.mdc +3 -2
  316. package/dist/surfaces/mcp/server.js +17 -6
  317. package/dist/surfaces/mcp/server.js.map +1 -1
  318. package/dist/surfaces/mcp/tool-definitions.d.ts.map +1 -1
  319. package/dist/surfaces/mcp/tool-definitions.js +1 -1
  320. package/dist/surfaces/mcp/tool-definitions.js.map +1 -1
  321. package/dist/surfaces/mcp/tool-handlers.d.ts.map +1 -1
  322. package/dist/surfaces/mcp/tool-handlers.js +2 -0
  323. package/dist/surfaces/mcp/tool-handlers.js.map +1 -1
  324. package/dist/surfaces/trae-rules/graphflow.md +3 -2
  325. package/dist/surfaces/trae-skill/graphflow/SKILL.md +2 -0
  326. package/package.json +1 -1
  327. package/scripts/safe-postinstall.cjs +1 -0
  328. package/src/surfaces/antigravity-rules/graphflow.md +3 -2
  329. package/src/surfaces/copilot-instructions/graphflow.md +3 -2
  330. package/src/surfaces/cursor-rules/graphflow.mdc +3 -2
  331. package/src/surfaces/trae-rules/graphflow.md +3 -2
  332. package/src/surfaces/trae-skill/graphflow/SKILL.md +2 -0
@@ -9,6 +9,8 @@ const node_module_1 = require("node:module");
9
9
  const requireFn = (0, node_module_1.createRequire)(__filename);
10
10
  let initPromise = null;
11
11
  const WASM_CACHE_DIR = (0, node_path_1.join)(process.cwd(), ".graphflow-cache", "wasm");
12
+ const languageLoadPromises = new Map();
13
+ const parserPool = new Map();
12
14
  function wasmFileName(language) {
13
15
  return `tree-sitter-${language}.wasm`;
14
16
  }
@@ -65,18 +67,36 @@ function resolveTreeSitterWasmsPath(fileName) {
65
67
  }
66
68
  }
67
69
  async function getTreeSitterParser(language) {
70
+ const pooledParser = parserPool.get(language);
71
+ if (pooledParser) {
72
+ return pooledParser;
73
+ }
74
+ const parserPromise = createTreeSitterParser(language);
75
+ parserPool.set(language, parserPromise);
76
+ return parserPromise;
77
+ }
78
+ async function createTreeSitterParser(language) {
68
79
  if (!initPromise) {
69
80
  initPromise = Parser.init();
70
81
  }
71
82
  await initPromise;
83
+ const parser = new Parser();
84
+ const lang = await loadTreeSitterLanguage(language);
85
+ parser.setLanguage(lang);
86
+ return parser;
87
+ }
88
+ async function loadTreeSitterLanguage(language) {
89
+ const cachedLanguage = languageLoadPromises.get(language);
90
+ if (cachedLanguage) {
91
+ return cachedLanguage;
92
+ }
72
93
  const wasmPath = resolveBundledWasmPath(language);
73
94
  if (!wasmPath) {
74
95
  throw new Error(`Bundled tree-sitter grammar not found for "${language}". ` +
75
96
  "Reinstall @roarpeng/graphflow or run `npm run wasm:bundle` in the GraphFlow source tree.");
76
97
  }
77
- const parser = new Parser();
78
- const lang = await Parser.Language.load(wasmPath);
79
- parser.setLanguage(lang);
80
- return parser;
98
+ const languagePromise = Parser.Language.load(wasmPath);
99
+ languageLoadPromises.set(language, languagePromise);
100
+ return languagePromise;
81
101
  }
82
102
  //# sourceMappingURL=tree-sitter-loader.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tree-sitter-loader.js","sourceRoot":"","sources":["../../../src/graph/language-indexers/tree-sitter-loader.ts"],"names":[],"mappings":";;AA+DA,wDAgBC;AAuBD,kDAoBC;AA1HD,MAAM,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;AAC1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MAAM,qBAAqB,CAAC;AAKvD;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,MAAM,EACb,aAAa,CAAC,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAsBtB"}
1
+ {"version":3,"file":"query-expand.d.ts","sourceRoot":"","sources":["../../src/graph/query-expand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAKvD;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,WAAW,EACnB,KAAK,EAAE,MAAM,EACb,aAAa,CAAC,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,SAAS,EAAE,CAAC,CAwBtB"}
@@ -12,6 +12,7 @@ async function collectExpandedKeywordHits(client, query, workspaceRoot, englishQ
12
12
  const queries = (0, graph_utils_js_1.expandSearchQueries)(query, workspaceRoot, englishQuery);
13
13
  const baseScoreTokens = (0, graph_utils_js_1.buildSearchScoreTokens)(query, englishQuery);
14
14
  const matchQueries = englishQuery?.trim() ? [query, englishQuery.trim()] : [query];
15
+ const pathHints = (0, graph_utils_js_1.extractPathTokens)(workspaceRoot);
15
16
  const rankings = [];
16
17
  for (const q of queries) {
17
18
  const hits = await client.queryByKeyword(q);
@@ -19,6 +20,7 @@ async function collectExpandedKeywordHits(client, query, workspaceRoot, englishQ
19
20
  rankings.push((0, graph_utils_js_2.rankNodesForContextQuery)(hits, query, {
20
21
  scoreTokens: scoreTokens.length > 0 ? scoreTokens : baseScoreTokens,
21
22
  matchQueries,
23
+ pathHints,
22
24
  }));
23
25
  }
24
26
  if (rankings.length <= 1) {
@@ -1 +1 @@
1
- {"version":3,"file":"query-expand.js","sourceRoot":"","sources":["../../src/graph/query-expand.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, type OrchestrateOptions } from "./core/orchestrator";
2
- export { runTask, runTaskResult, reportOutcome, submitAgentInsightResult, mergeAgentInsightResult, previewContext, expandAnchor, getGraphFlowSettings, getSettingsPanelStatus, testRoutingAndIndexGraph, indexGraphFromSettings, validateSettingsForGraphIndex, validateSettingsForRouting, saveGraphFlowSettings, indexGraph, inspectGraph, getSkillInsights, resolveConfig, diagnoseRouting, diagnoseRoutingResult, planAndBrainstorm, planAndBrainstormResult, assertGraphFlowRuntime, detectInstalledAgents, formatModelConfigGuide, installMcpToDetectedAgents, runLearningNightly, runLearningNightlyResult, startFileWatcherIfEnabled, } from "./surfaces/cli/runtime";
2
+ export { runTask, runTaskResult, reportOutcome, submitAgentInsightResult, mergeAgentInsightResult, previewContext, expandAnchor, getGraphFlowSettings, getSettingsPanelStatus, testRoutingAndIndexGraph, indexGraphFromSettings, validateSettingsForGraphIndex, validateSettingsForRouting, saveGraphFlowSettings, indexGraph, inspectGraph, getSkillInsights, resolveConfig, diagnoseRouting, diagnoseRoutingResult, planAndBrainstorm, planAndBrainstormResult, assertGraphFlowRuntime, detectInstalledAgents, formatModelConfigGuide, installMcpToDetectedAgents, repairUnsafeWindowsMcpCommands, runLearningNightly, runLearningNightlyResult, startFileWatcherIfEnabled, } from "./surfaces/cli/runtime";
3
3
  export type { GraphFlowRuntime, GraphFlowRuntimeModule, LearningNightlyResult } from "./surfaces/cli/runtime";
4
4
  export { parseCliOptions, formatCliResult, type CliCommandResult } from "./surfaces/cli/output";
5
5
  export { createMcpServer, executeToolCall, getToolDefinitions, startStdioServer, } from "./surfaces/mcp/server";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,KAAK,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAC3E,OAAO,EACL,OAAO,EACP,aAAa,EACb,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACvB,cAAc,EACd,YAAY,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AA2B,CAAC;AACjE,OAAO,EACL,8BAA8B,EAC9B,0BAA0B,EAC1B,0BAA0B,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,mBAAmB,EACxB,KAAK,aAAa,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,EACL,iBAAiB,EACjB,KAAK,WAAW,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,cAAc,EAAE,KAAK,gBAAgB,EAAE,sBAAsB,EAAE,KAAK,sBAAsB,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC/K,OAAO,EACL,eAAe,EACf,WAAW,EACX,UAAU,EACV,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,aAAa,GACnB,MAAM,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.listSkills = exports.invokeSkill = exports.graphflowSkills = exports.validateConfigDetailed = exports.loadConfigSafe = exports.loadConfig = exports.validateConfig = exports.createGraphClient = exports.planInsightResult = exports.summarizeInsightForContext = exports.buildAgentInsightWorkItems = exports.buildAgentDelegatedPlanInsight = exports.hasUsableLlmProvider = exports.startStdioServer = exports.getToolDefinitions = exports.executeToolCall = exports.createMcpServer = exports.formatCliResult = exports.parseCliOptions = exports.startFileWatcherIfEnabled = exports.runLearningNightlyResult = exports.runLearningNightly = exports.installMcpToDetectedAgents = exports.formatModelConfigGuide = exports.detectInstalledAgents = exports.assertGraphFlowRuntime = exports.planAndBrainstormResult = exports.planAndBrainstorm = exports.diagnoseRoutingResult = exports.diagnoseRouting = exports.resolveConfig = exports.getSkillInsights = exports.inspectGraph = exports.indexGraph = exports.saveGraphFlowSettings = exports.validateSettingsForRouting = exports.validateSettingsForGraphIndex = exports.indexGraphFromSettings = exports.testRoutingAndIndexGraph = exports.getSettingsPanelStatus = exports.getGraphFlowSettings = exports.expandAnchor = exports.previewContext = exports.mergeAgentInsightResult = exports.submitAgentInsightResult = exports.reportOutcome = exports.runTaskResult = exports.runTask = exports.orchestrate = void 0;
3
+ exports.listSkills = exports.invokeSkill = exports.graphflowSkills = exports.validateConfigDetailed = exports.loadConfigSafe = exports.loadConfig = exports.validateConfig = exports.createGraphClient = exports.planInsightResult = exports.summarizeInsightForContext = exports.buildAgentInsightWorkItems = exports.buildAgentDelegatedPlanInsight = exports.hasUsableLlmProvider = exports.startStdioServer = exports.getToolDefinitions = exports.executeToolCall = exports.createMcpServer = exports.formatCliResult = exports.parseCliOptions = exports.startFileWatcherIfEnabled = exports.runLearningNightlyResult = exports.runLearningNightly = exports.repairUnsafeWindowsMcpCommands = exports.installMcpToDetectedAgents = exports.formatModelConfigGuide = exports.detectInstalledAgents = exports.assertGraphFlowRuntime = exports.planAndBrainstormResult = exports.planAndBrainstorm = exports.diagnoseRoutingResult = exports.diagnoseRouting = exports.resolveConfig = exports.getSkillInsights = exports.inspectGraph = exports.indexGraph = exports.saveGraphFlowSettings = exports.validateSettingsForRouting = exports.validateSettingsForGraphIndex = exports.indexGraphFromSettings = exports.testRoutingAndIndexGraph = exports.getSettingsPanelStatus = exports.getGraphFlowSettings = exports.expandAnchor = exports.previewContext = exports.mergeAgentInsightResult = exports.submitAgentInsightResult = exports.reportOutcome = exports.runTaskResult = exports.runTask = exports.orchestrate = void 0;
4
4
  var orchestrator_1 = require("./core/orchestrator");
5
5
  Object.defineProperty(exports, "orchestrate", { enumerable: true, get: function () { return orchestrator_1.orchestrate; } });
6
6
  var runtime_1 = require("./surfaces/cli/runtime");
@@ -30,6 +30,7 @@ Object.defineProperty(exports, "assertGraphFlowRuntime", { enumerable: true, get
30
30
  Object.defineProperty(exports, "detectInstalledAgents", { enumerable: true, get: function () { return runtime_1.detectInstalledAgents; } });
31
31
  Object.defineProperty(exports, "formatModelConfigGuide", { enumerable: true, get: function () { return runtime_1.formatModelConfigGuide; } });
32
32
  Object.defineProperty(exports, "installMcpToDetectedAgents", { enumerable: true, get: function () { return runtime_1.installMcpToDetectedAgents; } });
33
+ Object.defineProperty(exports, "repairUnsafeWindowsMcpCommands", { enumerable: true, get: function () { return runtime_1.repairUnsafeWindowsMcpCommands; } });
33
34
  Object.defineProperty(exports, "runLearningNightly", { enumerable: true, get: function () { return runtime_1.runLearningNightly; } });
34
35
  Object.defineProperty(exports, "runLearningNightlyResult", { enumerable: true, get: function () { return runtime_1.runLearningNightlyResult; } });
35
36
  Object.defineProperty(exports, "startFileWatcherIfEnabled", { enumerable: true, get: function () { return runtime_1.startFileWatcherIfEnabled; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,oDAA2E;AAAlE,2GAAA,WAAW,OAAA;AACpB,kDA8BgC;AA7B9B,kGAAA,OAAO,OAAA;AACP,wGAAA,aAAa,OAAA;AACb,wGAAA,aAAa,OAAA;AACb,mHAAA,wBAAwB,OAAA;AACxB,kHAAA,uBAAuB,OAAA;AACvB,yGAAA,cAAc,OAAA;AACd,uGAAA,YAAY,OAAA;AACZ,+GAAA,oBAAoB,OAAA;AACpB,iHAAA,sBAAsB,OAAA;AACtB,mHAAA,wBAAwB,OAAA;AACxB,iHAAA,sBAAsB,OAAA;AACtB,wHAAA,6BAA6B,OAAA;AAC7B,qHAAA,0BAA0B,OAAA;AAC1B,gH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A,UAAU,OAAA;AAAE,wGAAA,cAAc,OAAA;AAAyB,gHAAA,sBAAsB,OAAA;AAClG,mCAqBkB;AApBhB,yGAAA,eAAe,OAAA;AACf,qGAAA,WAAW,OAAA;AACX,oGAAA,UAAU,OAAA"}
@@ -84,6 +84,45 @@ export declare function resolveMcpNodeLaunch(options: {
84
84
  command: string;
85
85
  env: Record<string, string>;
86
86
  };
87
+ /**
88
+ * On Windows, convert a long path containing spaces to its 8.3 short form.
89
+ * Many MCP clients (e.g., TRAE) spawn the `command` field via cmd.exe without
90
+ * quoting, so paths like "C:\Program Files\..." break with "'C:\Program' is not
91
+ * recognized". The 8.3 short name (e.g., "C:\PROGRA~1\...") avoids this entirely.
92
+ */
93
+ export declare function getWindowsShortPath(longPath: string): string | undefined;
94
+ /** Prefer 8.3 short path on Windows when the input contains spaces; otherwise keep as-is. */
95
+ export declare function preferSpaceFreeWindowsPath(pathValue: string): string;
96
+ /**
97
+ * Final guard for MCP clients (notably Trae) that spawn `command` via cmd.exe
98
+ * without quoting. Ensures install-time configs never write spaced absolute paths.
99
+ */
100
+ export declare function sanitizeMcpServerNodeForWindowsClients(node: McpServerNode): McpServerNode;
101
+ /** True when command/cwd/path-like args still contain spaces (unsafe for unquoted cmd spawn). */
102
+ export declare function mcpNodeNeedsWindowsSpaceRepair(node: McpServerNode): boolean;
103
+ export interface McpWindowsSpaceRepairResult {
104
+ agentId: string;
105
+ agentName: string;
106
+ configPath: string;
107
+ repaired: boolean;
108
+ beforeCommand?: string;
109
+ afterCommand?: string;
110
+ }
111
+ /**
112
+ * Painless migrate: rewrite existing GraphFlow MCP entries that still use spaced
113
+ * absolute paths (e.g. Program Files). Scans every known agent config path that
114
+ * exists — not only currently "detected" markers — so Trae / Trae CN / TRAE SOLO
115
+ * variants are all fixed on extension activate without a manual Install click.
116
+ */
117
+ export declare function repairUnsafeWindowsMcpCommands(serverName?: string, options?: {
118
+ /** Test/injection hook — override scanned targets. */
119
+ targets?: Array<{
120
+ agentId: string;
121
+ agentName: string;
122
+ configPath: string;
123
+ serversKey: McpServersKey;
124
+ }>;
125
+ }): McpWindowsSpaceRepairResult[];
87
126
  export declare function buildMcpServerNode(options: McpInstallOptions): McpServerNode;
88
127
  /** 从 JSON 配置文件中移除指定 MCP 服务器的配置条目 */
89
128
  export declare function removeMcpEntry(configPath: string, serversKey: McpServersKey, serverName: string): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"agent-mcp-installer.d.ts","sourceRoot":"","sources":["../../src/integrations/agent-mcp-installer.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,SAAS,GAAG,iBAAiB,CAAC;AAEzE,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,MAAM,MAAM,kBAAkB,GAAG,KAAK,GAAG,YAAY,GAAG,cAAc,CAAC;AACvE,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,KAAK,CAAC;AAE7C,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,2EAA2E;IAC3E,YAAY,CAAC,EAAE,eAAe,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,6FAA6F;IAC7F,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oFAAoF;IACpF,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,uFAAuF;IACvF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2FAA2F;IAC3F,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,gBAAg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AK,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,UAAU,EAAE,MAAM,CAAC;QACnB,UAAU,EAAE,aAAa,CAAC;KAC3B,CAAC,CAAC;CACJ,GACA,2BAA2B,EAAE,CAiE/B;AAgCD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAE5E;AAyVD,oCAAoC;AACpC,wBAAgB,cAAc,CAC5B,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,aAAa,EACzB,UAAU,EAAE,MAAM,GACjB,OAAO,CAiBT;AAED,0CAA0C;AAC1C,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GACjB,OAAO,CAYT;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,EAAE,CAyDzF;AAED,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,yCAAyC;AACzC,wBAAgB,8BAA8B,CAAC,OAAO,CAAC,EAAE,gBAAgB,GAAG,eAAe,EAAE,CAmD5F;AAED,wBAAgB,sBAAsB,CAAC,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CA+BrE"}
@@ -8,6 +8,11 @@ exports.isEphemeralNodePath = isEphemeralNodePath;
8
8
  exports.isIdeBundledNode = isIdeBundledNode;
9
9
  exports.resolveSystemNodeCommand = resolveSystemNodeCommand;
10
10
  exports.resolveMcpNodeLaunch = resolveMcpNodeLaunch;
11
+ exports.getWindowsShortPath = getWindowsShortPath;
12
+ exports.preferSpaceFreeWindowsPath = preferSpaceFreeWindowsPath;
13
+ exports.sanitizeMcpServerNodeForWindowsClients = sanitizeMcpServerNodeForWindowsClients;
14
+ exports.mcpNodeNeedsWindowsSpaceRepair = mcpNodeNeedsWindowsSpaceRepair;
15
+ exports.repairUnsafeWindowsMcpCommands = repairUnsafeWindowsMcpCommands;
11
16
  exports.buildMcpServerNode = buildMcpServerNode;
12
17
  exports.removeMcpEntry = removeMcpEntry;
13
18
  exports.removeCodexMcpEntry = removeCodexMcpEntry;
@@ -263,9 +268,6 @@ function buildAgentProfiles() {
263
268
  {
264
269
  id: "claude-code",
265
270
  name: "Claude Code",
266
- // Claude Code stores user-scope MCP servers under the top-level `mcpServers`
267
- // key of ~/.claude.json. Per official docs it does NOT read ~/.claude/mcp.json
268
- // or %APPDATA%/Claude*/mcp.json, so those legacy paths are intentionally dropped.
269
271
  markerPaths: [
270
272
  (0, node_path_1.join)(home, ".claude"),
271
273
  (0, node_path_1.join)(home, ".claude.json"),
@@ -273,7 +275,6 @@ function buildAgentProfiles() {
273
275
  userTargets: [
274
276
  { configPath: (0, node_path_1.join)(home, ".claude.json"), serversKey: "mcpServers" },
275
277
  ],
276
- // Project scope is shared via <project>/.mcp.json (top-level `mcpServers`).
277
278
  workspaceRelativePaths: [{ relativePath: ".mcp.json", serversKey: "mcpServers" }],
278
279
  },
279
280
  {
@@ -372,9 +373,6 @@ function buildAgentProfiles() {
372
373
  {
373
374
  id: "gemini",
374
375
  name: "Gemini",
375
- // Gemini CLI reads MCP servers from the `mcpServers` object in settings.json.
376
- // User scope: ~/.gemini/settings.json; project scope: <project>/.gemini/settings.json.
377
- // Shared Antigravity toolchain: ~/.gemini/config/mcp_config.json (optional).
378
376
  markerPaths: [
379
377
  (0, node_path_1.join)(home, ".gemini"),
380
378
  ],
@@ -404,13 +402,9 @@ function buildAgentProfiles() {
404
402
  },
405
403
  ],
406
404
  },
407
- // ─── 实验性支持 ───
408
405
  {
409
406
  id: "antigravity",
410
407
  name: "Antigravity",
411
- // Google Antigravity MCP: ~/.gemini/antigravity/mcp_config.json (mcpServers key).
412
- // Shared config across Antigravity products: ~/.gemini/config/mcp_config.json.
413
- // Project scope: .agents/mcp_config.json
414
408
  markerPaths: [
415
409
  (0, node_path_1.join)(home, ".gemini", "antigravity"),
416
410
  (0, node_path_1.join)(home, ".antigravity"),
@@ -442,8 +436,6 @@ function buildAgentProfiles() {
442
436
  {
443
437
  id: "zed",
444
438
  name: "Zed",
445
- // Zed 已在 v0.165+ 支持 MCP(称为 "context servers")
446
- // 配置格式: settings.json 中的 "context_servers" 键
447
439
  markerPaths: [
448
440
  (0, node_path_1.join)(home, ".config", "zed"),
449
441
  isWindows() ? (0, node_path_1.join)(appData, "Zed") : undefined,
@@ -460,10 +452,6 @@ function buildAgentProfiles() {
460
452
  {
461
453
  id: "continue",
462
454
  name: "Continue",
463
- // Continue 是 VS Code / JetBrains 的 AI 编程助手扩展
464
- // MCP 配置写入 ~/.continue/config.yaml 中的 "mcpServers" 节
465
- // 注意:Continue 的 config.yaml 格式为 YAML,当前实现仅支持 JSON
466
- // 如需完整支持,需额外添加 YAML 读写逻辑
467
455
  markerPaths: [
468
456
  (0, node_path_1.join)(home, ".continue"),
469
457
  ],
@@ -474,6 +462,28 @@ function buildAgentProfiles() {
474
462
  },
475
463
  ],
476
464
  },
465
+ {
466
+ id: "qoder",
467
+ name: "Qoder",
468
+ markerPaths: [
469
+ (0, node_path_1.join)(home, ".qoder"),
470
+ (0, node_path_1.join)(appData, "Qoder"),
471
+ (0, node_path_1.join)(localAppData, "Programs", "qoder"),
472
+ ],
473
+ userTargets: [
474
+ {
475
+ configPath: (0, node_path_1.join)(home, ".qoder", "mcp.json"),
476
+ serversKey: "mcpServers",
477
+ },
478
+ {
479
+ configPath: isWindows()
480
+ ? (0, node_path_1.join)(appData, "Qoder", "User", "mcp.json")
481
+ : (0, node_path_1.join)(home, ".config", "Qoder", "User", "mcp.json"),
482
+ serversKey: "mcpServers",
483
+ },
484
+ ],
485
+ workspaceRelativePaths: [{ relativePath: (0, node_path_1.join)(".qoder", "mcp.json"), serversKey: "mcpServers" }],
486
+ },
477
487
  ];
478
488
  if (wslWindowsHome) {
479
489
  profiles.push(...buildWindowsProfilesFromWsl(wslWindowsHome));
@@ -631,7 +641,10 @@ function resolveMcpNodeLaunch(options) {
631
641
  // 1. Explicit node command (highest priority)
632
642
  const explicitNode = options.nodeCommand?.trim();
633
643
  if (explicitNode && isUsableNodeCommand(explicitNode) && !isEphemeralNodePath(explicitNode)) {
634
- return { command: explicitNode, env: { ...MCP_STDIO_ENV } };
644
+ return {
645
+ command: preferSpaceFreeWindowsPath(explicitNode),
646
+ env: { ...MCP_STDIO_ENV },
647
+ };
635
648
  }
636
649
  // 2. System Node — preferred over Electron because:
637
650
  // - Path is stable across IDE updates
@@ -639,13 +652,23 @@ function resolveMcpNodeLaunch(options) {
639
652
  // - Better compatibility with MCP client spawn logic
640
653
  const systemNode = resolveSystemNodeCommand();
641
654
  if (systemNode && systemNode !== "node") {
642
- return { command: systemNode, env: { ...MCP_STDIO_ENV } };
655
+ const safeNode = preferSpaceFreeWindowsPath(systemNode);
656
+ // Trae/some clients invoke `command` via cmd.exe without quoting. If we still
657
+ // have spaces (8.3 disabled), fall back to bare "node" so PATH resolution works.
658
+ if (safeNode.includes(" ")) {
659
+ return { command: "node", env: { ...MCP_STDIO_ENV } };
660
+ }
661
+ return { command: safeNode, env: { ...MCP_STDIO_ENV } };
643
662
  }
644
663
  // 3. Electron fallback — when system Node is unavailable, use the IDE's bundled Electron
645
664
  const electronExecPath = options.electronExecPath?.trim();
646
665
  if (electronExecPath && (0, node_fs_1.existsSync)(electronExecPath)) {
666
+ const safeElectron = preferSpaceFreeWindowsPath(electronExecPath);
667
+ if (safeElectron.includes(" ")) {
668
+ return { command: "node", env: { ...MCP_STDIO_ENV } };
669
+ }
647
670
  return {
648
- command: electronExecPath,
671
+ command: safeElectron,
649
672
  env: {
650
673
  ...MCP_STDIO_ENV,
651
674
  ELECTRON_RUN_AS_NODE: "1",
@@ -655,6 +678,173 @@ function resolveMcpNodeLaunch(options) {
655
678
  // 4. Last resort: bare "node" (relies on PATH resolution at MCP launch time)
656
679
  return { command: "node", env: { ...MCP_STDIO_ENV } };
657
680
  }
681
+ /**
682
+ * On Windows, convert a long path containing spaces to its 8.3 short form.
683
+ * Many MCP clients (e.g., TRAE) spawn the `command` field via cmd.exe without
684
+ * quoting, so paths like "C:\Program Files\..." break with "'C:\Program' is not
685
+ * recognized". The 8.3 short name (e.g., "C:\PROGRA~1\...") avoids this entirely.
686
+ */
687
+ function getWindowsShortPath(longPath) {
688
+ if (!isWindows() || !longPath || !longPath.includes(" ")) {
689
+ return longPath;
690
+ }
691
+ // Try cmd.exe first (faster, available on all Windows)
692
+ try {
693
+ const result = (0, node_child_process_1.execSync)(`for %A in ("${longPath}") do @echo %~sA`, {
694
+ encoding: "utf8",
695
+ stdio: ["ignore", "pipe", "ignore"],
696
+ timeout: 3000,
697
+ shell: "cmd.exe",
698
+ }).trim();
699
+ const lines = result.split(/\r?\n/).filter((l) => l.trim());
700
+ const shortPath = lines[lines.length - 1]?.trim();
701
+ if (shortPath && !shortPath.includes(" ") && (0, node_fs_1.existsSync)(shortPath)) {
702
+ return shortPath;
703
+ }
704
+ }
705
+ catch {
706
+ // fall through to PowerShell
707
+ }
708
+ // Fallback: PowerShell with FileSystemObject COM
709
+ try {
710
+ const escaped = longPath.replace(/'/g, "''");
711
+ const result = (0, node_child_process_1.execSync)(`$fso = New-Object -ComObject Scripting.FileSystemObject; if (Test-Path -LiteralPath '${escaped}') { if ((Get-Item -LiteralPath '${escaped}') -is [System.IO.DirectoryInfo]) { $fso.GetFolder('${escaped}').ShortPath } else { $fso.GetFile('${escaped}').ShortPath } }`, {
712
+ encoding: "utf8",
713
+ stdio: ["ignore", "pipe", "ignore"],
714
+ timeout: 5000,
715
+ shell: "powershell.exe",
716
+ }).trim();
717
+ if (result && !result.includes(" ") && (0, node_fs_1.existsSync)(result)) {
718
+ return result;
719
+ }
720
+ }
721
+ catch {
722
+ // 8.3 name generation may be disabled on some volumes
723
+ }
724
+ return undefined;
725
+ }
726
+ /** Prefer 8.3 short path on Windows when the input contains spaces; otherwise keep as-is. */
727
+ function preferSpaceFreeWindowsPath(pathValue) {
728
+ if (!isWindows() || !pathValue.includes(" ")) {
729
+ return pathValue;
730
+ }
731
+ return getWindowsShortPath(pathValue) ?? pathValue;
732
+ }
733
+ /**
734
+ * Final guard for MCP clients (notably Trae) that spawn `command` via cmd.exe
735
+ * without quoting. Ensures install-time configs never write spaced absolute paths.
736
+ */
737
+ function sanitizeMcpServerNodeForWindowsClients(node) {
738
+ if (!isWindows()) {
739
+ return node;
740
+ }
741
+ let command = preferSpaceFreeWindowsPath(node.command);
742
+ // Absolute node/electron paths that still contain spaces → bare "node" via PATH.
743
+ if (command.includes(" ") &&
744
+ (/[\\/]node(\.exe)?$/i.test(command) || /[\\/]electron(\.exe)?$/i.test(command))) {
745
+ command = "node";
746
+ }
747
+ const args = node.args.map((arg) => {
748
+ if (!arg.includes(" ")) {
749
+ return arg;
750
+ }
751
+ // Only rewrite filesystem-looking args; leave flags like "--foo bar" alone.
752
+ if (/^[A-Za-z]:[\\/]/.test(arg) || arg.startsWith("\\\\") || arg.includes("/") || arg.includes("\\")) {
753
+ return preferSpaceFreeWindowsPath(arg);
754
+ }
755
+ return arg;
756
+ });
757
+ const sanitized = {
758
+ command,
759
+ args,
760
+ };
761
+ if (node.env) {
762
+ sanitized.env = node.env;
763
+ }
764
+ if (node.cwd) {
765
+ sanitized.cwd = preferSpaceFreeWindowsPath(node.cwd);
766
+ }
767
+ return sanitized;
768
+ }
769
+ /** True when command/cwd/path-like args still contain spaces (unsafe for unquoted cmd spawn). */
770
+ function mcpNodeNeedsWindowsSpaceRepair(node) {
771
+ if (node.command.includes(" ")) {
772
+ return true;
773
+ }
774
+ if (node.cwd?.includes(" ")) {
775
+ return true;
776
+ }
777
+ return node.args.some((arg) => {
778
+ if (!arg.includes(" ")) {
779
+ return false;
780
+ }
781
+ return /^[A-Za-z]:[\\/]/.test(arg) || arg.startsWith("\\\\") || arg.includes("/") || arg.includes("\\");
782
+ });
783
+ }
784
+ /**
785
+ * Painless migrate: rewrite existing GraphFlow MCP entries that still use spaced
786
+ * absolute paths (e.g. Program Files). Scans every known agent config path that
787
+ * exists — not only currently "detected" markers — so Trae / Trae CN / TRAE SOLO
788
+ * variants are all fixed on extension activate without a manual Install click.
789
+ */
790
+ function repairUnsafeWindowsMcpCommands(serverName = "graphflow", options) {
791
+ if (!isWindows()) {
792
+ return [];
793
+ }
794
+ const results = [];
795
+ const seen = new Set();
796
+ const targets = options?.targets ??
797
+ buildAgentProfiles().flatMap((profile) => profile.userTargets
798
+ .filter((t) => (t.configFormat ?? "json") !== "codex-toml")
799
+ .map((t) => ({
800
+ agentId: profile.id,
801
+ agentName: profile.name,
802
+ configPath: t.configPath,
803
+ serversKey: t.serversKey,
804
+ })));
805
+ for (const target of targets) {
806
+ const key = `${target.configPath}::${target.serversKey}`;
807
+ if (seen.has(key) || !(0, node_fs_1.existsSync)(target.configPath)) {
808
+ continue;
809
+ }
810
+ seen.add(key);
811
+ try {
812
+ const json = readJsonConfig(target.configPath);
813
+ const servers = json[target.serversKey] ?? {};
814
+ const previous = servers[serverName];
815
+ if (!previous || typeof previous.command !== "string" || !Array.isArray(previous.args)) {
816
+ continue;
817
+ }
818
+ if (!mcpNodeNeedsWindowsSpaceRepair(previous)) {
819
+ results.push({
820
+ agentId: target.agentId,
821
+ agentName: target.agentName,
822
+ configPath: target.configPath,
823
+ repaired: false,
824
+ beforeCommand: previous.command,
825
+ afterCommand: previous.command,
826
+ });
827
+ continue;
828
+ }
829
+ const sanitized = sanitizeMcpServerNodeForWindowsClients(previous);
830
+ servers[serverName] = sanitized;
831
+ json[target.serversKey] = servers;
832
+ writeJsonConfig(target.configPath, json);
833
+ results.push({
834
+ agentId: target.agentId,
835
+ agentName: target.agentName,
836
+ configPath: target.configPath,
837
+ repaired: true,
838
+ beforeCommand: previous.command,
839
+ afterCommand: sanitized.command,
840
+ });
841
+ }
842
+ catch {
843
+ // Config may be malformed; skip — install path will recreate.
844
+ }
845
+ }
846
+ return results;
847
+ }
658
848
  function resolveWindowsNpxLaunch() {
659
849
  const node = resolveSystemNodeCommand();
660
850
  if (!node) {
@@ -667,15 +857,27 @@ function resolveWindowsNpxLaunch() {
667
857
  ];
668
858
  for (const npxCli of candidates) {
669
859
  if ((0, node_fs_1.existsSync)(npxCli)) {
860
+ // If paths contain spaces, try 8.3 short format to avoid quoting issues
861
+ // with MCP clients that don't properly quote the command (e.g., TRAE).
862
+ const shortNode = getWindowsShortPath(node) ?? node;
863
+ const shortNpxCli = getWindowsShortPath(npxCli) ?? npxCli;
864
+ if (shortNode.includes(" ") || shortNpxCli.includes(" ")) {
865
+ // Can't resolve to a space-free path; fall back to npx.cmd which
866
+ // relies on PATH resolution and handles quoting internally.
867
+ return undefined;
868
+ }
670
869
  return {
671
- command: node,
672
- args: [npxCli, "-y", "--package=@roarpeng/graphflow", "graphflow-mcp"],
870
+ command: shortNode,
871
+ args: [shortNpxCli, "-y", "--package=@roarpeng/graphflow", "graphflow-mcp"],
673
872
  };
674
873
  }
675
874
  }
676
875
  return undefined;
677
876
  }
678
877
  function buildMcpServerNode(options) {
878
+ return sanitizeMcpServerNodeForWindowsClients(buildMcpServerNodeRaw(options));
879
+ }
880
+ function buildMcpServerNodeRaw(options) {
679
881
  const cwd = options.workspaceRoot ?? options.npmScriptCwd ?? process.cwd();
680
882
  // Only inject workspace root when explicitly passed (workspace-scope installs).
681
883
  // Never fall back to process.env — that pollutes user-level agent configs.
@@ -692,12 +894,21 @@ function buildMcpServerNode(options) {
692
894
  }
693
895
  const runtimeRoot = options.bundledRuntimeRoot ?? (0, node_path_1.join)(options.bundledServerPath, "..", "..", "..");
694
896
  if (options.launcherPath) {
897
+ // Cursor/Node spawn(.cmd, {shell:false}) fails on Windows with EINVAL /
898
+ // "系统找不到指定的路径". Prefer the sibling .cjs under node; fall back to cmd /c.
899
+ let launcherForSpawn = options.launcherPath;
695
900
  if (isWindows() && options.launcherPath.toLowerCase().endsWith(".cmd")) {
696
- return {
697
- command: options.launcherPath,
698
- args: [],
699
- env: { ...mcpEnv },
700
- };
901
+ const cjsSibling = options.launcherPath.replace(/\.cmd$/i, ".cjs");
902
+ if ((0, node_fs_1.existsSync)(cjsSibling)) {
903
+ launcherForSpawn = cjsSibling;
904
+ }
905
+ else {
906
+ return {
907
+ command: "cmd.exe",
908
+ args: ["/c", options.launcherPath],
909
+ env: { ...mcpEnv },
910
+ };
911
+ }
701
912
  }
702
913
  const launch = resolveMcpNodeLaunch({
703
914
  ...(options.nodeCommand !== undefined ? { nodeCommand: options.nodeCommand } : {}),
@@ -705,7 +916,7 @@ function buildMcpServerNode(options) {
705
916
  });
706
917
  return {
707
918
  command: launch.command,
708
- args: [options.launcherPath],
919
+ args: [launcherForSpawn],
709
920
  env: { ...mcpEnv, ...launch.env },
710
921
  };
711
922
  }
@@ -909,13 +1120,13 @@ function injectIntoConfig(configPath, serversKey, serverName, node) {
909
1120
  if (!node.env?.GRAPHFLOW_WORKSPACE_ROOT) {
910
1121
  delete mergedEnv.GRAPHFLOW_WORKSPACE_ROOT;
911
1122
  }
912
- servers[serverName] = {
1123
+ servers[serverName] = sanitizeMcpServerNodeForWindowsClients({
913
1124
  ...previous,
914
1125
  ...node,
915
1126
  ...(previous?.args && !node.args?.length ? { args: previous.args } : {}),
916
1127
  ...(previous?.command && !node.command ? { command: previous.command } : {}),
917
1128
  env: mergedEnv,
918
- };
1129
+ });
919
1130
  if (!Object.prototype.hasOwnProperty.call(node, "cwd")) {
920
1131
  delete servers[serverName].cwd;
921
1132
  }
@@ -1067,7 +1278,7 @@ function formatModelConfigGuide(workspaceRoot) {
1067
1278
  "在 VS Code 命令面板运行:`GraphFlow: Settings`",
1068
1279
  "",
1069
1280
  "## 2. 配置 LLM Provider(规划 / 执行任务)",
1070
- "- 在设置面板的 Smart / Economy 层分别选择 provider(如 openai / anthropic / bailian / doubao)",
1281
+ "- 在设置面板的 Smart / Economy 层分别选择 provider(如 deepseek / openai / anthropic / bailian / doubao)",
1071
1282
  "- API Key:填环境变量名(如 `DEEPSEEK_API_KEY`)、`${DEEPSEEK_API_KEY}`、或直接 `sk-...`",
1072
1283
  "- Base URL:每层卡片内直接填写(如 DeepSeek 使用 `https://api.deepseek.com`)",
1073
1284
  "- Smart / Economy 模型均可选;留空则使用 provider 默认路由",