mindweave 0.0.1 → 2.1.2

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 (481) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +171 -14
  3. package/dist/alternator/chassis/cache.js +47 -0
  4. package/dist/alternator/chassis/cache.js.map +1 -0
  5. package/dist/alternator/chassis/domRefs.js +53 -0
  6. package/dist/alternator/chassis/domRefs.js.map +1 -0
  7. package/dist/alternator/chassis/extractWorker.js +65 -0
  8. package/dist/alternator/chassis/extractWorker.js.map +1 -0
  9. package/dist/alternator/chassis/graph.js +221 -0
  10. package/dist/alternator/chassis/graph.js.map +1 -0
  11. package/dist/alternator/chassis/index.js +463 -0
  12. package/dist/alternator/chassis/index.js.map +1 -0
  13. package/dist/alternator/chassis/isolation.js +336 -0
  14. package/dist/alternator/chassis/isolation.js.map +1 -0
  15. package/dist/alternator/chassis/langCases.js +69 -0
  16. package/dist/alternator/chassis/langCases.js.map +1 -0
  17. package/dist/alternator/chassis/lsp.js +469 -0
  18. package/dist/alternator/chassis/lsp.js.map +1 -0
  19. package/dist/alternator/chassis/markup.js +262 -0
  20. package/dist/alternator/chassis/markup.js.map +1 -0
  21. package/dist/alternator/chassis/provision.js +198 -0
  22. package/dist/alternator/chassis/provision.js.map +1 -0
  23. package/dist/alternator/chassis/rank.js +72 -0
  24. package/dist/alternator/chassis/rank.js.map +1 -0
  25. package/dist/alternator/chassis/servers.js +215 -0
  26. package/dist/alternator/chassis/servers.js.map +1 -0
  27. package/dist/alternator/chassis/treesitter.js +608 -0
  28. package/dist/alternator/chassis/treesitter.js.map +1 -0
  29. package/dist/alternator/chassis/types.js +24 -0
  30. package/dist/alternator/chassis/types.js.map +1 -0
  31. package/dist/alternator/lane.js +67 -0
  32. package/dist/alternator/lane.js.map +1 -0
  33. package/dist/cli/App.js +2586 -0
  34. package/dist/cli/App.js.map +1 -0
  35. package/dist/cli/altScreen.js +67 -0
  36. package/dist/cli/altScreen.js.map +1 -0
  37. package/dist/cli/approvalChannel.js +72 -0
  38. package/dist/cli/approvalChannel.js.map +1 -0
  39. package/dist/cli/attachments.js +188 -0
  40. package/dist/cli/attachments.js.map +1 -0
  41. package/dist/cli/bootstrap.js +279 -0
  42. package/dist/cli/bootstrap.js.map +1 -0
  43. package/dist/cli/chatAnchor.js +94 -0
  44. package/dist/cli/chatAnchor.js.map +1 -0
  45. package/dist/cli/commandArgs.js +79 -0
  46. package/dist/cli/commandArgs.js.map +1 -0
  47. package/dist/cli/commandRoute.js +78 -0
  48. package/dist/cli/commandRoute.js.map +1 -0
  49. package/dist/cli/compaction.js +69 -0
  50. package/dist/cli/compaction.js.map +1 -0
  51. package/dist/cli/components/ApprovalBox.js +100 -0
  52. package/dist/cli/components/ApprovalBox.js.map +1 -0
  53. package/dist/cli/components/BlockView.js +128 -0
  54. package/dist/cli/components/BlockView.js.map +1 -0
  55. package/dist/cli/components/FirstRunFrame.js +41 -0
  56. package/dist/cli/components/FirstRunFrame.js.map +1 -0
  57. package/dist/cli/components/KeyManager.js +197 -0
  58. package/dist/cli/components/KeyManager.js.map +1 -0
  59. package/dist/cli/components/KeySetup.js +125 -0
  60. package/dist/cli/components/KeySetup.js.map +1 -0
  61. package/dist/cli/components/MenuFrame.js +24 -0
  62. package/dist/cli/components/MenuFrame.js.map +1 -0
  63. package/dist/cli/components/Picker.js +82 -0
  64. package/dist/cli/components/Picker.js.map +1 -0
  65. package/dist/cli/components/PromptInput.js +509 -0
  66. package/dist/cli/components/PromptInput.js.map +1 -0
  67. package/dist/cli/components/SubagentView.js +86 -0
  68. package/dist/cli/components/SubagentView.js.map +1 -0
  69. package/dist/cli/components/ToolGroup.js +60 -0
  70. package/dist/cli/components/ToolGroup.js.map +1 -0
  71. package/dist/cli/components/ToolLine.js +123 -0
  72. package/dist/cli/components/ToolLine.js.map +1 -0
  73. package/dist/cli/components/TrustGate.js +37 -0
  74. package/dist/cli/components/TrustGate.js.map +1 -0
  75. package/dist/cli/costView.js +40 -0
  76. package/dist/cli/costView.js.map +1 -0
  77. package/dist/cli/frameRate.js +30 -0
  78. package/dist/cli/frameRate.js.map +1 -0
  79. package/dist/cli/framebuffer/paint.js +165 -0
  80. package/dist/cli/framebuffer/paint.js.map +1 -0
  81. package/dist/cli/framebuffer/parse.js +266 -0
  82. package/dist/cli/framebuffer/parse.js.map +1 -0
  83. package/dist/cli/framebuffer/screen.js +196 -0
  84. package/dist/cli/framebuffer/screen.js.map +1 -0
  85. package/dist/cli/framebuffer/writer.js +139 -0
  86. package/dist/cli/framebuffer/writer.js.map +1 -0
  87. package/dist/cli/groupReveal.js +51 -0
  88. package/dist/cli/groupReveal.js.map +1 -0
  89. package/dist/cli/help.js +55 -0
  90. package/dist/cli/help.js.map +1 -0
  91. package/dist/cli/inputView.js +105 -0
  92. package/dist/cli/inputView.js.map +1 -0
  93. package/dist/cli/keyManager.js +65 -0
  94. package/dist/cli/keyManager.js.map +1 -0
  95. package/dist/cli/keySetup.js +35 -0
  96. package/dist/cli/keySetup.js.map +1 -0
  97. package/dist/cli/keyStore.js +73 -0
  98. package/dist/cli/keyStore.js.map +1 -0
  99. package/dist/cli/markdown.js +460 -0
  100. package/dist/cli/markdown.js.map +1 -0
  101. package/dist/cli/messageQueue.js +96 -0
  102. package/dist/cli/messageQueue.js.map +1 -0
  103. package/dist/cli/modes.js +90 -0
  104. package/dist/cli/modes.js.map +1 -0
  105. package/dist/cli/mouse.js +78 -0
  106. package/dist/cli/mouse.js.map +1 -0
  107. package/dist/cli/pasteAssembler.js +44 -0
  108. package/dist/cli/pasteAssembler.js.map +1 -0
  109. package/dist/cli/pathComplete.js +39 -0
  110. package/dist/cli/pathComplete.js.map +1 -0
  111. package/dist/cli/perfLog.js +90 -0
  112. package/dist/cli/perfLog.js.map +1 -0
  113. package/dist/cli/reveal.js +32 -0
  114. package/dist/cli/reveal.js.map +1 -0
  115. package/dist/cli/revealPace.js +59 -0
  116. package/dist/cli/revealPace.js.map +1 -0
  117. package/dist/cli/sessionCarry.js +19 -0
  118. package/dist/cli/sessionCarry.js.map +1 -0
  119. package/dist/cli/smoothScroll.js +74 -0
  120. package/dist/cli/smoothScroll.js.map +1 -0
  121. package/dist/cli/startupArgs.js +96 -0
  122. package/dist/cli/startupArgs.js.map +1 -0
  123. package/dist/cli/terminalRestore.js +34 -0
  124. package/dist/cli/terminalRestore.js.map +1 -0
  125. package/dist/cli/toolDisplay.js +219 -0
  126. package/dist/cli/toolDisplay.js.map +1 -0
  127. package/dist/cli/toolItems.js +65 -0
  128. package/dist/cli/toolItems.js.map +1 -0
  129. package/dist/cli/transcript.js +351 -0
  130. package/dist/cli/transcript.js.map +1 -0
  131. package/dist/cli/trust.js +79 -0
  132. package/dist/cli/trust.js.map +1 -0
  133. package/dist/cli/updateCheck.js +107 -0
  134. package/dist/cli/updateCheck.js.map +1 -0
  135. package/dist/cli/version.js +39 -0
  136. package/dist/cli/version.js.map +1 -0
  137. package/dist/cli/viewport.js +179 -0
  138. package/dist/cli/viewport.js.map +1 -0
  139. package/dist/cli/virtualWindow.js +103 -0
  140. package/dist/cli/virtualWindow.js.map +1 -0
  141. package/dist/cli/workingVerb.js +37 -0
  142. package/dist/cli/workingVerb.js.map +1 -0
  143. package/dist/cli/wrap.js +145 -0
  144. package/dist/cli/wrap.js.map +1 -0
  145. package/dist/drivers/anthropic/cachePoints.js +77 -0
  146. package/dist/drivers/anthropic/cachePoints.js.map +1 -0
  147. package/dist/drivers/anthropic/client.js +432 -0
  148. package/dist/drivers/anthropic/client.js.map +1 -0
  149. package/dist/drivers/anthropic/index.js +10 -0
  150. package/dist/drivers/anthropic/index.js.map +1 -0
  151. package/dist/drivers/anthropic/manifest.js +221 -0
  152. package/dist/drivers/anthropic/manifest.js.map +1 -0
  153. package/dist/drivers/cerebras/client.js +69 -0
  154. package/dist/drivers/cerebras/client.js.map +1 -0
  155. package/dist/drivers/cerebras/index.js +5 -0
  156. package/dist/drivers/cerebras/index.js.map +1 -0
  157. package/dist/drivers/cerebras/manifest.js +140 -0
  158. package/dist/drivers/cerebras/manifest.js.map +1 -0
  159. package/dist/drivers/clientId.js +41 -0
  160. package/dist/drivers/clientId.js.map +1 -0
  161. package/dist/drivers/contextOverflow.js +77 -0
  162. package/dist/drivers/contextOverflow.js.map +1 -0
  163. package/dist/drivers/deepseek/client.js +168 -0
  164. package/dist/drivers/deepseek/client.js.map +1 -0
  165. package/dist/drivers/deepseek/index.js +16 -0
  166. package/dist/drivers/deepseek/index.js.map +1 -0
  167. package/dist/drivers/deepseek/inlineTools.js +46 -0
  168. package/dist/drivers/deepseek/inlineTools.js.map +1 -0
  169. package/dist/drivers/deepseek/manifest.js +166 -0
  170. package/dist/drivers/deepseek/manifest.js.map +1 -0
  171. package/dist/drivers/gemini/client.js +38 -0
  172. package/dist/drivers/gemini/client.js.map +1 -0
  173. package/dist/drivers/gemini/index.js +5 -0
  174. package/dist/drivers/gemini/index.js.map +1 -0
  175. package/dist/drivers/gemini/manifest.js +150 -0
  176. package/dist/drivers/gemini/manifest.js.map +1 -0
  177. package/dist/drivers/glm/client.js +90 -0
  178. package/dist/drivers/glm/client.js.map +1 -0
  179. package/dist/drivers/glm/index.js +9 -0
  180. package/dist/drivers/glm/index.js.map +1 -0
  181. package/dist/drivers/glm/manifest.js +183 -0
  182. package/dist/drivers/glm/manifest.js.map +1 -0
  183. package/dist/drivers/groq/client.js +80 -0
  184. package/dist/drivers/groq/client.js.map +1 -0
  185. package/dist/drivers/groq/index.js +5 -0
  186. package/dist/drivers/groq/index.js.map +1 -0
  187. package/dist/drivers/groq/manifest.js +160 -0
  188. package/dist/drivers/groq/manifest.js.map +1 -0
  189. package/dist/drivers/kimi/client.js +82 -0
  190. package/dist/drivers/kimi/client.js.map +1 -0
  191. package/dist/drivers/kimi/index.js +9 -0
  192. package/dist/drivers/kimi/index.js.map +1 -0
  193. package/dist/drivers/kimi/manifest.js +168 -0
  194. package/dist/drivers/kimi/manifest.js.map +1 -0
  195. package/dist/drivers/meta/client.js +30 -0
  196. package/dist/drivers/meta/client.js.map +1 -0
  197. package/dist/drivers/meta/index.js +5 -0
  198. package/dist/drivers/meta/index.js.map +1 -0
  199. package/dist/drivers/meta/manifest.js +101 -0
  200. package/dist/drivers/meta/manifest.js.map +1 -0
  201. package/dist/drivers/minimax/client.js +36 -0
  202. package/dist/drivers/minimax/client.js.map +1 -0
  203. package/dist/drivers/minimax/index.js +5 -0
  204. package/dist/drivers/minimax/index.js.map +1 -0
  205. package/dist/drivers/minimax/manifest.js +120 -0
  206. package/dist/drivers/minimax/manifest.js.map +1 -0
  207. package/dist/drivers/mistral/client.js +54 -0
  208. package/dist/drivers/mistral/client.js.map +1 -0
  209. package/dist/drivers/mistral/index.js +5 -0
  210. package/dist/drivers/mistral/index.js.map +1 -0
  211. package/dist/drivers/mistral/manifest.js +118 -0
  212. package/dist/drivers/mistral/manifest.js.map +1 -0
  213. package/dist/drivers/openai/client.js +290 -0
  214. package/dist/drivers/openai/client.js.map +1 -0
  215. package/dist/drivers/openai/index.js +9 -0
  216. package/dist/drivers/openai/index.js.map +1 -0
  217. package/dist/drivers/openai/manifest.js +133 -0
  218. package/dist/drivers/openai/manifest.js.map +1 -0
  219. package/dist/drivers/openaiCompat/wire.js +493 -0
  220. package/dist/drivers/openaiCompat/wire.js.map +1 -0
  221. package/dist/drivers/partialTurn.js +23 -0
  222. package/dist/drivers/partialTurn.js.map +1 -0
  223. package/dist/drivers/providerError.js +181 -0
  224. package/dist/drivers/providerError.js.map +1 -0
  225. package/dist/drivers/qwen/client.js +93 -0
  226. package/dist/drivers/qwen/client.js.map +1 -0
  227. package/dist/drivers/qwen/index.js +9 -0
  228. package/dist/drivers/qwen/index.js.map +1 -0
  229. package/dist/drivers/qwen/manifest.js +146 -0
  230. package/dist/drivers/qwen/manifest.js.map +1 -0
  231. package/dist/drivers/registry.js +177 -0
  232. package/dist/drivers/registry.js.map +1 -0
  233. package/dist/drivers/retryPolicy.js +129 -0
  234. package/dist/drivers/retryPolicy.js.map +1 -0
  235. package/dist/drivers/searchBlocks.js +61 -0
  236. package/dist/drivers/searchBlocks.js.map +1 -0
  237. package/dist/drivers/types.js +2 -0
  238. package/dist/drivers/types.js.map +1 -0
  239. package/dist/drivers/xai/client.js +63 -0
  240. package/dist/drivers/xai/client.js.map +1 -0
  241. package/dist/drivers/xai/index.js +5 -0
  242. package/dist/drivers/xai/index.js.map +1 -0
  243. package/dist/drivers/xai/manifest.js +137 -0
  244. package/dist/drivers/xai/manifest.js.map +1 -0
  245. package/dist/dynamo/_probe.tmp.js +20 -0
  246. package/dist/dynamo/_probe.tmp.js.map +1 -0
  247. package/dist/dynamo/cacheBreak.js +88 -0
  248. package/dist/dynamo/cacheBreak.js.map +1 -0
  249. package/dist/dynamo/contextWindow.js +243 -0
  250. package/dist/dynamo/contextWindow.js.map +1 -0
  251. package/dist/dynamo/engine.js +2011 -0
  252. package/dist/dynamo/engine.js.map +1 -0
  253. package/dist/dynamo/guard.js +132 -0
  254. package/dist/dynamo/guard.js.map +1 -0
  255. package/dist/dynamo/liveMeter.js +58 -0
  256. package/dist/dynamo/liveMeter.js.map +1 -0
  257. package/dist/dynamo/model.js +172 -0
  258. package/dist/dynamo/model.js.map +1 -0
  259. package/dist/dynamo/planArtifact.js +125 -0
  260. package/dist/dynamo/planArtifact.js.map +1 -0
  261. package/dist/dynamo/pricing.js +140 -0
  262. package/dist/dynamo/pricing.js.map +1 -0
  263. package/dist/dynamo/prompt.js +264 -0
  264. package/dist/dynamo/prompt.js.map +1 -0
  265. package/dist/dynamo/spend.js +45 -0
  266. package/dist/dynamo/spend.js.map +1 -0
  267. package/dist/dynamo/verify.js +483 -0
  268. package/dist/dynamo/verify.js.map +1 -0
  269. package/dist/governor/forbidden.js +181 -0
  270. package/dist/governor/forbidden.js.map +1 -0
  271. package/dist/governor/freshness.js +83 -0
  272. package/dist/governor/freshness.js.map +1 -0
  273. package/dist/governor/frontmatter.js +38 -0
  274. package/dist/governor/frontmatter.js.map +1 -0
  275. package/dist/governor/glob.js +75 -0
  276. package/dist/governor/glob.js.map +1 -0
  277. package/dist/governor/index.js +87 -0
  278. package/dist/governor/index.js.map +1 -0
  279. package/dist/governor/rules.js +80 -0
  280. package/dist/governor/rules.js.map +1 -0
  281. package/dist/governor/scope.js +91 -0
  282. package/dist/governor/scope.js.map +1 -0
  283. package/dist/governor/skills.js +176 -0
  284. package/dist/governor/skills.js.map +1 -0
  285. package/dist/governor/types.js +16 -0
  286. package/dist/governor/types.js.map +1 -0
  287. package/dist/governor/write.js +182 -0
  288. package/dist/governor/write.js.map +1 -0
  289. package/dist/index.js +89 -0
  290. package/dist/index.js.map +1 -0
  291. package/dist/mcp/catalog.js +232 -0
  292. package/dist/mcp/catalog.js.map +1 -0
  293. package/dist/mcp/config.js +116 -0
  294. package/dist/mcp/config.js.map +1 -0
  295. package/dist/mcp/configWrite.js +254 -0
  296. package/dist/mcp/configWrite.js.map +1 -0
  297. package/dist/mcp/connection.js +504 -0
  298. package/dist/mcp/connection.js.map +1 -0
  299. package/dist/mcp/deferred.js +104 -0
  300. package/dist/mcp/deferred.js.map +1 -0
  301. package/dist/mcp/discover.js +128 -0
  302. package/dist/mcp/discover.js.map +1 -0
  303. package/dist/mcp/manager.js +679 -0
  304. package/dist/mcp/manager.js.map +1 -0
  305. package/dist/mcp/paramHeaders.js +163 -0
  306. package/dist/mcp/paramHeaders.js.map +1 -0
  307. package/dist/mcp/prompts.js +136 -0
  308. package/dist/mcp/prompts.js.map +1 -0
  309. package/dist/mcp/protocol.js +171 -0
  310. package/dist/mcp/protocol.js.map +1 -0
  311. package/dist/mcp/resources.js +119 -0
  312. package/dist/mcp/resources.js.map +1 -0
  313. package/dist/mcp/resultStore.js +180 -0
  314. package/dist/mcp/resultStore.js.map +1 -0
  315. package/dist/mcp/subscriptions.js +74 -0
  316. package/dist/mcp/subscriptions.js.map +1 -0
  317. package/dist/mcp/transport/headerValue.js +40 -0
  318. package/dist/mcp/transport/headerValue.js.map +1 -0
  319. package/dist/mcp/transport/http.js +321 -0
  320. package/dist/mcp/transport/http.js.map +1 -0
  321. package/dist/mcp/transport/stdio.js +234 -0
  322. package/dist/mcp/transport/stdio.js.map +1 -0
  323. package/dist/mcp/transport/types.js +27 -0
  324. package/dist/mcp/transport/types.js.map +1 -0
  325. package/dist/mcp/trust.js +98 -0
  326. package/dist/mcp/trust.js.map +1 -0
  327. package/dist/mcp/trustStore.js +55 -0
  328. package/dist/mcp/trustStore.js.map +1 -0
  329. package/dist/memory/autoMemory.js +340 -0
  330. package/dist/memory/autoMemory.js.map +1 -0
  331. package/dist/memory/compaction.js +513 -0
  332. package/dist/memory/compaction.js.map +1 -0
  333. package/dist/memory/images.js +173 -0
  334. package/dist/memory/images.js.map +1 -0
  335. package/dist/memory/presence.js +59 -0
  336. package/dist/memory/presence.js.map +1 -0
  337. package/dist/memory/projectNotes.js +247 -0
  338. package/dist/memory/projectNotes.js.map +1 -0
  339. package/dist/memory/restore.js +72 -0
  340. package/dist/memory/restore.js.map +1 -0
  341. package/dist/memory/session.js +472 -0
  342. package/dist/memory/session.js.map +1 -0
  343. package/dist/memory/sessionMemory.js +142 -0
  344. package/dist/memory/sessionMemory.js.map +1 -0
  345. package/dist/memory/sessionMemoryCompact.js +136 -0
  346. package/dist/memory/sessionMemoryCompact.js.map +1 -0
  347. package/dist/memory/store.js +217 -0
  348. package/dist/memory/store.js.map +1 -0
  349. package/dist/memory/types.js +14 -0
  350. package/dist/memory/types.js.map +1 -0
  351. package/dist/memory/workingSet.js +383 -0
  352. package/dist/memory/workingSet.js.map +1 -0
  353. package/dist/project/context.js +425 -0
  354. package/dist/project/context.js.map +1 -0
  355. package/dist/tools/approval.js +189 -0
  356. package/dist/tools/approval.js.map +1 -0
  357. package/dist/tools/askUser.js +103 -0
  358. package/dist/tools/askUser.js.map +1 -0
  359. package/dist/tools/atomicWrite.js +151 -0
  360. package/dist/tools/atomicWrite.js.map +1 -0
  361. package/dist/tools/backgroundShells.js +468 -0
  362. package/dist/tools/backgroundShells.js.map +1 -0
  363. package/dist/tools/captureSweep.js +77 -0
  364. package/dist/tools/captureSweep.js.map +1 -0
  365. package/dist/tools/chassisMux.js +92 -0
  366. package/dist/tools/chassisMux.js.map +1 -0
  367. package/dist/tools/checkpoints.js +328 -0
  368. package/dist/tools/checkpoints.js.map +1 -0
  369. package/dist/tools/codeIntel.js +267 -0
  370. package/dist/tools/codeIntel.js.map +1 -0
  371. package/dist/tools/deferredNative.js +121 -0
  372. package/dist/tools/deferredNative.js.map +1 -0
  373. package/dist/tools/detail.js +135 -0
  374. package/dist/tools/detail.js.map +1 -0
  375. package/dist/tools/diagnostics.js +174 -0
  376. package/dist/tools/diagnostics.js.map +1 -0
  377. package/dist/tools/edit.js +167 -0
  378. package/dist/tools/edit.js.map +1 -0
  379. package/dist/tools/editCore.js +283 -0
  380. package/dist/tools/editCore.js.map +1 -0
  381. package/dist/tools/editFile.js +183 -0
  382. package/dist/tools/editFile.js.map +1 -0
  383. package/dist/tools/editRipple.js +126 -0
  384. package/dist/tools/editRipple.js.map +1 -0
  385. package/dist/tools/editTarget.js +131 -0
  386. package/dist/tools/editTarget.js.map +1 -0
  387. package/dist/tools/editWindow.js +49 -0
  388. package/dist/tools/editWindow.js.map +1 -0
  389. package/dist/tools/eol.js +56 -0
  390. package/dist/tools/eol.js.map +1 -0
  391. package/dist/tools/exitPlan.js +175 -0
  392. package/dist/tools/exitPlan.js.map +1 -0
  393. package/dist/tools/focus.js +42 -0
  394. package/dist/tools/focus.js.map +1 -0
  395. package/dist/tools/gitignore.js +148 -0
  396. package/dist/tools/gitignore.js.map +1 -0
  397. package/dist/tools/glob.js +134 -0
  398. package/dist/tools/glob.js.map +1 -0
  399. package/dist/tools/governorTools.js +258 -0
  400. package/dist/tools/governorTools.js.map +1 -0
  401. package/dist/tools/grep.js +450 -0
  402. package/dist/tools/grep.js.map +1 -0
  403. package/dist/tools/guard.js +220 -0
  404. package/dist/tools/guard.js.map +1 -0
  405. package/dist/tools/killTree.js +215 -0
  406. package/dist/tools/killTree.js.map +1 -0
  407. package/dist/tools/listDir.js +143 -0
  408. package/dist/tools/listDir.js.map +1 -0
  409. package/dist/tools/mcpAdd.js +176 -0
  410. package/dist/tools/mcpAdd.js.map +1 -0
  411. package/dist/tools/mcpResources.js +116 -0
  412. package/dist/tools/mcpResources.js.map +1 -0
  413. package/dist/tools/mcpSearch.js +123 -0
  414. package/dist/tools/mcpSearch.js.map +1 -0
  415. package/dist/tools/multiEdit.js +168 -0
  416. package/dist/tools/multiEdit.js.map +1 -0
  417. package/dist/tools/paths.js +225 -0
  418. package/dist/tools/paths.js.map +1 -0
  419. package/dist/tools/posixShell.js +123 -0
  420. package/dist/tools/posixShell.js.map +1 -0
  421. package/dist/tools/readFile.js +371 -0
  422. package/dist/tools/readFile.js.map +1 -0
  423. package/dist/tools/readSymbol.js +145 -0
  424. package/dist/tools/readSymbol.js.map +1 -0
  425. package/dist/tools/registry.js +120 -0
  426. package/dist/tools/registry.js.map +1 -0
  427. package/dist/tools/replaceSymbol.js +141 -0
  428. package/dist/tools/replaceSymbol.js.map +1 -0
  429. package/dist/tools/results.js +15 -0
  430. package/dist/tools/results.js.map +1 -0
  431. package/dist/tools/ripgrep.js +145 -0
  432. package/dist/tools/ripgrep.js.map +1 -0
  433. package/dist/tools/runCommand.js +633 -0
  434. package/dist/tools/runCommand.js.map +1 -0
  435. package/dist/tools/saveMemory.js +102 -0
  436. package/dist/tools/saveMemory.js.map +1 -0
  437. package/dist/tools/screenshot.js +200 -0
  438. package/dist/tools/screenshot.js.map +1 -0
  439. package/dist/tools/screenshotWin.js +227 -0
  440. package/dist/tools/screenshotWin.js.map +1 -0
  441. package/dist/tools/search.js +121 -0
  442. package/dist/tools/search.js.map +1 -0
  443. package/dist/tools/sessionTools.js +187 -0
  444. package/dist/tools/sessionTools.js.map +1 -0
  445. package/dist/tools/shellCheckpoint.js +123 -0
  446. package/dist/tools/shellCheckpoint.js.map +1 -0
  447. package/dist/tools/shellLint.js +102 -0
  448. package/dist/tools/shellLint.js.map +1 -0
  449. package/dist/tools/shellTools.js +203 -0
  450. package/dist/tools/shellTools.js.map +1 -0
  451. package/dist/tools/spanCore.js +78 -0
  452. package/dist/tools/spanCore.js.map +1 -0
  453. package/dist/tools/subagent.js +224 -0
  454. package/dist/tools/subagent.js.map +1 -0
  455. package/dist/tools/subagentReport.js +114 -0
  456. package/dist/tools/subagentReport.js.map +1 -0
  457. package/dist/tools/tempSweep.js +118 -0
  458. package/dist/tools/tempSweep.js.map +1 -0
  459. package/dist/tools/todo.js +117 -0
  460. package/dist/tools/todo.js.map +1 -0
  461. package/dist/tools/types.js +2 -0
  462. package/dist/tools/types.js.map +1 -0
  463. package/dist/tools/untrusted.js +46 -0
  464. package/dist/tools/untrusted.js.map +1 -0
  465. package/dist/tools/useSkill.js +62 -0
  466. package/dist/tools/useSkill.js.map +1 -0
  467. package/dist/tools/walk.js +152 -0
  468. package/dist/tools/walk.js.map +1 -0
  469. package/dist/tools/web.js +61 -0
  470. package/dist/tools/web.js.map +1 -0
  471. package/dist/tools/webFetch.js +444 -0
  472. package/dist/tools/webFetch.js.map +1 -0
  473. package/dist/tools/webSearch.js +130 -0
  474. package/dist/tools/webSearch.js.map +1 -0
  475. package/dist/tools/workspace.js +212 -0
  476. package/dist/tools/workspace.js.map +1 -0
  477. package/dist/tools/workspaceDiscover.js +216 -0
  478. package/dist/tools/workspaceDiscover.js.map +1 -0
  479. package/dist/tools/writeFile.js +162 -0
  480. package/dist/tools/writeFile.js.map +1 -0
  481. package/package.json +74 -28
@@ -0,0 +1,483 @@
1
+ /**
2
+ * verify.ts — the verification gate's fact detectors (pure).
3
+ *
4
+ * The gate's job is narrow and honest: notice when the model edited files this
5
+ * turn and then tried to finish WITHOUT ever checking its work, and nudge once.
6
+ * It decides nothing about engineering — it only reports two observable facts:
7
+ * "was a file changed?" and "was a check run?". WHAT counts as an adequate check
8
+ * for a given task stays the model's judgment (the thin-prompt boundary). Keeping
9
+ * these as pure predicates means the behavior is unit-tested, never blind-shipped.
10
+ */
11
+ /** True if a tool call changed files on disk (an edit or a write). */
12
+ export function isFileMutation(toolName) {
13
+ return toolName === "edit" || toolName === "write_file" || toolName === "replace_symbol_body";
14
+ }
15
+ /** File extensions whose content has no runtime surface — prose/docs, not code or
16
+ * config. A build, test, or type check can't catch anything in them, so editing
17
+ * ONLY these needs no verification. Deliberately narrow: config formats like .json,
18
+ * .toml, .yaml stay OUT (a broken tsconfig/Cargo.toml fails the build), so they DO
19
+ * need a check. */
20
+ const NON_RUNTIME_EXTENSIONS = new Set([
21
+ ".md",
22
+ ".markdown",
23
+ ".mdx",
24
+ ".txt",
25
+ ".rst",
26
+ ".adoc",
27
+ ]);
28
+ /**
29
+ * Should a mutating tool call oblige the verification gate — i.e. did it change a
30
+ * file with a runtime surface (code/config a check could catch a problem in)?
31
+ * A docs-only edit (MINDWEAVE.md, a README, a .txt) returns false, so the gate never
32
+ * fires on it and the model is never forced to explain that "no check applies".
33
+ * An unknown/extensionless path is treated as code (safe default: the gate fires).
34
+ */
35
+ export function mutationNeedsVerification(toolName, args) {
36
+ if (!isFileMutation(toolName))
37
+ return false;
38
+ const path = typeof args.path === "string" ? args.path : "";
39
+ if (!path)
40
+ return true; // unknown target — be safe, treat as code
41
+ const dot = path.lastIndexOf(".");
42
+ const slash = Math.max(path.lastIndexOf("/"), path.lastIndexOf("\\"));
43
+ // A dot only counts as an extension if it's in the final path segment.
44
+ const ext = dot > slash ? path.slice(dot).toLowerCase() : "";
45
+ return !NON_RUNTIME_EXTENSIONS.has(ext);
46
+ }
47
+ /**
48
+ * Does a shell command look like a build / test / typecheck / lint — i.e. a real
49
+ * verification of code? Conservative and matched on the command's program names,
50
+ * so ordinary commands (ls, git status, echo) never read as a check. Case-insensitive.
51
+ */
52
+ export function looksLikeVerification(command) {
53
+ const c = command.toLowerCase();
54
+ // Package-runner scripts: `npm test`, `npm run build`, `pnpm typecheck`, `yarn lint`, etc.
55
+ if (/\b(npm|pnpm|yarn|bun)\b[^\n|&;]*\b(test|build|lint|typecheck|type-check|check|tsc|vitest|jest)\b/.test(c))
56
+ return true;
57
+ // Direct tool invocations across common ecosystems.
58
+ const tools = [
59
+ "tsc",
60
+ "vitest",
61
+ "jest",
62
+ "mocha",
63
+ "eslint",
64
+ "biome",
65
+ "pytest",
66
+ "mypy",
67
+ "ruff",
68
+ "pyright",
69
+ "go test",
70
+ "go build",
71
+ "go vet",
72
+ "cargo test",
73
+ "cargo build",
74
+ "cargo check",
75
+ "cargo clippy",
76
+ "gradle test",
77
+ "mvn test",
78
+ "mvn verify",
79
+ "make test",
80
+ "make check",
81
+ "ctest",
82
+ "rspec",
83
+ "phpunit",
84
+ ];
85
+ return tools.some((t) => new RegExp(`(^|[\\s|&;])${t.replace(/ /g, "\\s+")}\\b`).test(c));
86
+ }
87
+ /**
88
+ * Did this tool call count as verifying the code? Either the diagnostics tool
89
+ * (LSP errors/warnings) or a shell command that runs a build/test/typecheck/lint.
90
+ */
91
+ export function isVerification(toolName, args) {
92
+ if (toolName === "diagnostics")
93
+ return true;
94
+ if (toolName === "run_command")
95
+ return looksLikeVerification(String(args.command ?? ""));
96
+ return false;
97
+ }
98
+ /**
99
+ * Re-scope guard (pure). A turn is one user request; when the model finishes its
100
+ * whole todo list it has done what was asked. If it then opens a NEW list of
101
+ * pending work in the same turn, it's taking on scope the user never asked for —
102
+ * the "did the same task three times" runaway. This decides, from observable
103
+ * facts alone, whether that has happened.
104
+ *
105
+ * - `completedBefore` — was a full list already completed earlier this turn?
106
+ * - `stepResults` — the tool results from the latest step (name + summary).
107
+ * - `todos` — the current task list after the step.
108
+ *
109
+ * Returns the updated `completed` flag (carry it into the next step) and whether
110
+ * the turn should pause. It decides nothing about the code — only turn-taking.
111
+ */
112
+ export function reScopeCheck(completedBefore, stepResults, todos) {
113
+ const finishedNow = stepResults.some((r) => r.name === "todo_write" && r.summary === "all tasks completed");
114
+ const completed = completedBefore || finishedNow;
115
+ // A list finishing clears itself, so the pending check only trips on a genuinely
116
+ // NEW list created after the completion — never on the completing step itself.
117
+ const morePending = todos?.some((t) => t.status !== "completed") ?? false;
118
+ return { completed, pause: completed && morePending };
119
+ }
120
+ /**
121
+ * Background-poll guard (pure). A background shell's completion is pushed to the
122
+ * model automatically (see backgroundEventNotes), so re-reading a still-running
123
+ * shell with the `shells` tool accomplishes nothing — it just spends a step
124
+ * and narrates "still running" to the user, the exact spam a wait-loop produces.
125
+ * This detects a step whose ONLY work was polling background shells that are still
126
+ * running. A step that does any real work alongside (an edit, a file read, a real
127
+ * command) is NOT a poll step, so genuine progress never trips the guard.
128
+ */
129
+ export function isBackgroundPollStep(stepResults) {
130
+ if (stepResults.length === 0)
131
+ return false;
132
+ const isStatusRead = (name) => name === "shells";
133
+ if (!stepResults.every((r) => isStatusRead(r.name)))
134
+ return false;
135
+ // At least one polled shell must still be RUNNING — a poll that finds the shell
136
+ // already finished is legitimate (the model reads the result and reports it).
137
+ // A read summary is "shell #1 (running)"; a listing is "N running,
138
+ // M total" (N≥1 only when something is actually running — avoids "0 running").
139
+ return stepResults.some((r) => /\(running\)|[1-9]\d* running/i.test(r.summary ?? ""));
140
+ }
141
+ /**
142
+ * Repeat-failure breaker (pure). A weaker model can get stuck firing the SAME thing
143
+ * over and over when it keeps failing — an edit that errors "file not found" six times,
144
+ * or ten near-identical PowerShell commands that all die with the same error — because
145
+ * it doesn't recognize the error is the same and never changes course. The fix is to key
146
+ * the repeat detection on the ERROR MESSAGE, not the exact command — which is what catches
147
+ * a run of slightly-different commands that all fail identically.
148
+ *
149
+ * `stepFailureSignature` returns a stable signature for a step whose EVERY tool result
150
+ * errored (a pure-failure step), or null otherwise — any success alongside is progress,
151
+ * so the streak resets. The engine counts consecutive identical signatures and stops
152
+ * losslessly once they cross a small limit, surfacing the real error to the user.
153
+ */
154
+ export function stepFailureSignature(results) {
155
+ if (results.length === 0)
156
+ return null;
157
+ // Any non-error result means the step made some progress — not a pure-failure step.
158
+ if (!results.every((r) => r.isError))
159
+ return null;
160
+ return results
161
+ .map((r) => `${r.name}:${normalizeErrorSignature(r.output)}`)
162
+ .sort()
163
+ .join("|");
164
+ }
165
+ /**
166
+ * Collapse an error output to its stable core so two failures of the same KIND match
167
+ * even when the offending command differs. Drops the noise that varies call-to-call:
168
+ * PowerShell's code-echo/caret lines (start with `+` or `~`) and its `At line:N char:N`
169
+ * locators, then strips digits (so `char:80` and `char:99` unify) and collapses space.
170
+ * Harmless on non-PowerShell output — plain error text passes through digit-normalized.
171
+ */
172
+ export function normalizeErrorSignature(output) {
173
+ const kept = output
174
+ .split(/\r?\n/)
175
+ .map((l) => l.trim())
176
+ .filter((t) => {
177
+ if (t === "")
178
+ return false;
179
+ if (t.startsWith("+") || /^~+$/.test(t))
180
+ return false; // PS code-echo / caret underline
181
+ if (/at line:\d+ char:\d+/i.test(t))
182
+ return false; // PS location line
183
+ return true;
184
+ });
185
+ return kept
186
+ .join(" ")
187
+ .toLowerCase()
188
+ .replace(/\d+/g, "#")
189
+ .replace(/\s+/g, " ")
190
+ .trim()
191
+ .slice(0, 240);
192
+ }
193
+ export function repeatFailureStep(streak, limit, nudged) {
194
+ if (streak < limit)
195
+ return "none";
196
+ return nudged ? "stop" : "nudge";
197
+ }
198
+ /**
199
+ * The first line of an error worth showing a human: skips blanks and PowerShell's
200
+ * code-echo/caret decoration, and clips so one runaway line can't fill the screen.
201
+ */
202
+ export function firstErrorLine(output, max = 200) {
203
+ const line = output
204
+ .split(/\r?\n/)
205
+ .map((l) => l.trim())
206
+ .find((l) => l && !l.startsWith("+") && !/^~+$/.test(l)) ?? "the same error";
207
+ return line.length > max ? line.slice(0, max - 3) + "…" : line;
208
+ }
209
+ /**
210
+ * A one-line label for the thing that kept failing. For a shell command that's the
211
+ * command itself (the actual repeated text); for anything else it's the tool plus
212
+ * whichever argument identifies what it acted on.
213
+ */
214
+ export function failedActionLabel(name, args) {
215
+ const command = typeof args.command === "string" ? args.command.trim() : "";
216
+ if (command)
217
+ return command.length > 160 ? command.slice(0, 157) + "…" : command;
218
+ const target = ["path", "file_path", "file", "pattern", "query"]
219
+ .map((k) => args[k])
220
+ .find((v) => typeof v === "string" && v);
221
+ return target ? `${name} ${target}` : name;
222
+ }
223
+ /**
224
+ * The interrupt injected on the first trip of the breaker.
225
+ *
226
+ * Every sentence here is a FACT the model cannot otherwise see: how many times it
227
+ * repeated itself, what it repeated, what the error was, where its shell actually is,
228
+ * and what the harness will do next. That last one matters — the model can only weigh
229
+ * "retry once more" against a stop if it knows the stop is coming.
230
+ *
231
+ * `cwd` is included only when the shell has moved off the project root, which is the
232
+ * failure this was written for: `cd` persists within a turn, so a later relative path
233
+ * silently resolves from somewhere else and the model has no way to notice.
234
+ */
235
+ export function repeatFailureNudge(opts) {
236
+ const where = opts.cwd
237
+ ? `Your shell is currently in ${opts.cwd}, not the project root. Relative paths resolve from there, ` +
238
+ `so a path that looks right from the root will not be.\n\n`
239
+ : "";
240
+ return (`You have now run this ${opts.attempts} times and gotten the same error every time:\n\n` +
241
+ ` ${opts.action}\n` +
242
+ ` ${opts.error}\n\n` +
243
+ where +
244
+ `Running it again unchanged will end the turn. Find out why it fails before you act again: ` +
245
+ `check the path or file it names, confirm the state you are actually in, or take a different ` +
246
+ `route to the same goal. (This fires once per failure loop.)`);
247
+ }
248
+ /**
249
+ * How many single edits to the SAME file a turn may make before it is told to batch.
250
+ *
251
+ * Two is the allowance because two is defensible: the second edit is often something the
252
+ * first one revealed. A third means the model is working through a list it already had,
253
+ * one call at a time.
254
+ */
255
+ export const SAME_FILE_EDIT_LIMIT = 2;
256
+ /**
257
+ * Count ONE-AT-A-TIME edits per file in a step (pure).
258
+ *
259
+ * Only single-edit calls count. An `edit` call carrying several edits IS the batched
260
+ * form this nudge is asking for, so counting it would scold the model for doing the
261
+ * right thing. `write_file` is a different decision entirely and never counts.
262
+ *
263
+ * This used to key on the tool NAME, back when `edit_file` and `multi_edit` were
264
+ * separate tools and the name alone told you which shape had been used. With one
265
+ * merged tool the shape is in the arguments, so that is where it is read from.
266
+ */
267
+ export function sameFileEditCounts(results) {
268
+ const counts = new Map();
269
+ for (const r of results) {
270
+ if (r.name !== "edit")
271
+ continue;
272
+ const edits = r.args?.edits;
273
+ // Anything other than exactly one edit is either already batched or malformed;
274
+ // neither is the pattern being discouraged.
275
+ if (!Array.isArray(edits) || edits.length !== 1)
276
+ continue;
277
+ const path = typeof r.args?.path === "string" ? r.args.path.trim() : "";
278
+ if (!path)
279
+ continue;
280
+ counts.set(path, (counts.get(path) ?? 0) + 1);
281
+ }
282
+ return counts;
283
+ }
284
+ /**
285
+ * The file a turn has now edited one-at-a-time too often, or null (pure).
286
+ *
287
+ * Why this is mechanical rather than a line in a tool description: measured against a
288
+ * real model, the same task with the same descriptions routed correctly on one run and
289
+ * made three separate one-edit calls to one file on another. Prose can bias a choice;
290
+ * it cannot make it hold. Anything that must be true for EVERY provider has to be
291
+ * enforced by the harness, which is the same reasoning behind the verify gate and the
292
+ * repeat-failure breaker.
293
+ */
294
+ export function overusedSingleEdits(running, limit = SAME_FILE_EDIT_LIMIT) {
295
+ for (const [path, n] of running)
296
+ if (n > limit)
297
+ return path;
298
+ return null;
299
+ }
300
+ /** The one-shot nudge injected when a turn keeps editing one file a change at a time. */
301
+ export function batchEditNudge(path, count) {
302
+ return (`You've made ${count} separate one-edit calls to ${path} in this turn. When one file needs several ` +
303
+ `changes, put them in the SAME edit call as several entries in \`edits\` instead: they apply in order, ` +
304
+ `each sees the result of the last, and if any fails to match the file is left untouched rather than ` +
305
+ `half-edited. Keep it to one call per file — don't try to cover several files in one call. ` +
306
+ `(This reminder fires once per turn.)`);
307
+ }
308
+ /** The one-shot nudge injected when files changed but nothing was checked. */
309
+ export const VERIFY_NUDGE = "You edited files this turn but never ran a check. Before finishing, verify what you changed actually " +
310
+ "works — run the project's build or tests, or call `diagnostics` on the files you touched, and fix anything " +
311
+ "it surfaces. If no check meaningfully applies here (for example a docs or config edit), say so in one line " +
312
+ "and finish. (This reminder fires once per turn.)";
313
+ // ── Narration budget ──────────────────────────────────────────────────────────
314
+ // Prose between tool calls is not free: it is written into the transcript and
315
+ // re-sent on every subsequent turn until compaction, so a paragraph restated five
316
+ // times is paid for five times, forever. Measured on a real session before this
317
+ // existed: the same assessment given five times, the same status table twice, one
318
+ // block of 46 sentences, ~10,700 characters of prose in a turn that made no edits.
319
+ //
320
+ // Mechanical rather than only a line in the prompt, for the reason the batching gate
321
+ // gives: prose biases a choice, it cannot make it hold. The prompt states the rule;
322
+ // this catches the turn where the rule slipped and says so while it can still matter.
323
+ /** Sentences the model may spend on an intermediate step before it is over budget. */
324
+ export const NARRATION_SENTENCES = 2;
325
+ /** Identifiers repeated from earlier prose before it counts as restating. */
326
+ const RESTATE_IDENTS = 3;
327
+ /** Rough sentence split for prose (fenced code is not narration). Pure. */
328
+ export function proseSentences(text) {
329
+ return text
330
+ .replace(/```[\s\S]*?```/g, " ")
331
+ .split(/(?<=[.!?])\s+|\n{2,}|\n(?=[-*\d])/)
332
+ .map((s) => s.trim())
333
+ .filter((s) => s.length > 1);
334
+ }
335
+ /** camelCase / snake_case identifiers named in prose, 4+ chars. Pure. */
336
+ export function proseIdentifiers(text) {
337
+ const found = text.replace(/```[\s\S]*?```/g, " ").match(/\b[A-Za-z_$][A-Za-z0-9_$]*(?:[A-Z][A-Za-z0-9_$]*|_[A-Za-z0-9_$]+)\b/g) ?? [];
338
+ return [...new Set(found.filter((s) => s.length > 3))];
339
+ }
340
+ /**
341
+ * Why this intermediate message breaks the budget, or null if it is fine (pure).
342
+ *
343
+ * Two separate faults, because they need different corrections. LENGTH is an essay
344
+ * where a line belonged. RESTATING is the worse one and the one a length cap alone
345
+ * misses: three short blocks that each re-summarise the picture are individually
346
+ * within budget and collectively the thing that makes a transcript unreadable.
347
+ * Re-derivation is paraphrased, so matching wording finds nothing — what recurs is
348
+ * the SUBJECT, which is why this compares identifiers rather than phrases.
349
+ */
350
+ export function narrationFault(text, earlier) {
351
+ const prose = text.trim();
352
+ if (!prose)
353
+ return null;
354
+ const seenBefore = new Set(earlier.flatMap((e) => proseIdentifiers(e)));
355
+ const repeated = proseIdentifiers(prose).filter((id) => seenBefore.has(id));
356
+ const sentences = proseSentences(prose).length;
357
+ // Restating is checked first: it is the more serious fault and can hold at any length.
358
+ if (repeated.length >= RESTATE_IDENTS)
359
+ return { kind: "restating", sentences, repeated };
360
+ if (sentences > NARRATION_SENTENCES)
361
+ return { kind: "length", sentences, repeated };
362
+ return null;
363
+ }
364
+ /** The one-shot nudge injected when a turn narrates past its budget. */
365
+ export function narrationNudge(fault) {
366
+ if (fault.kind === "restating") {
367
+ return (`You have already told the user about ${fault.repeated.slice(0, 4).join(", ")} earlier in this turn. ` +
368
+ `Do not summarise the picture again — each message should carry only what is NEW since your last one. ` +
369
+ `Keep gathering silently and give the assessment ONCE, when there is something to conclude. ` +
370
+ `(This reminder fires once per turn.)`);
371
+ }
372
+ return (`That was ${fault.sentences} sentences between tool calls, where the budget is ${NARRATION_SENTENCES}. ` +
373
+ `The user can see every call you make, so say only what you learned and what you are doing next. ` +
374
+ `Spend more only when they would act differently for knowing. (This reminder fires once per turn.)`);
375
+ }
376
+ /**
377
+ * Levenshtein distance — the edit cost between two tool names. Small and iterative
378
+ * (two rolling rows) because it runs over the whole registry on a rare path.
379
+ */
380
+ function editDistance(a, b) {
381
+ if (a === b)
382
+ return 0;
383
+ let prev = Array.from({ length: b.length + 1 }, (_, i) => i);
384
+ for (let i = 1; i <= a.length; i++) {
385
+ const row = [i];
386
+ for (let j = 1; j <= b.length; j++) {
387
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
388
+ row[j] = Math.min(row[j - 1] + 1, prev[j] + 1, prev[j - 1] + cost);
389
+ }
390
+ prev = row;
391
+ }
392
+ return prev[b.length];
393
+ }
394
+ /**
395
+ * The registered tools closest to a name the model invented.
396
+ *
397
+ * A model occasionally calls a tool that does not exist (seen live: `index_results`).
398
+ * The bare "unknown tool" error tells it nothing it can act on, so it either gives up
399
+ * or guesses again. Naming the near misses turns the dead end into a correction it can
400
+ * make on the next step.
401
+ *
402
+ * Returns nothing when nothing is genuinely close. A suggestion has to be plausibly
403
+ * what was meant — past roughly a third of the name's length the "nearest" match is
404
+ * just whichever registered name happens to be shortest, and pointing at that is worse
405
+ * than pointing at nothing.
406
+ */
407
+ export function nearestTools(name, known, max = 2) {
408
+ return known
409
+ .map((k) => ({ k, d: editDistance(name, k) }))
410
+ .filter(({ k, d }) => d <= Math.max(2, Math.floor(Math.max(name.length, k.length) / 3)))
411
+ .sort((a, b) => a.d - b.d || a.k.localeCompare(b.k))
412
+ .slice(0, max)
413
+ .map((s) => s.k);
414
+ }
415
+ /** The error handed back for a tool that does not exist, with a way forward. */
416
+ export function unknownToolError(name, known) {
417
+ const near = nearestTools(name, known);
418
+ const hint = near.length > 0
419
+ ? `Did you mean ${near.map((n) => `'${n}'`).join(" or ")}?`
420
+ : `Call find_tools to see what is available.`;
421
+ return `Error: unknown tool '${name}'. Mindweave has no tool by that name. ${hint}`;
422
+ }
423
+ /**
424
+ * Lines of plain prose a reply that REPORTS FINISHED WORK may spend.
425
+ *
426
+ * The same budget REPLY_STYLE states in the prompt. It is repeated here because this
427
+ * is the copy that holds: the prompt has asked for it in three different wordings and
428
+ * the model still answers a two-word confirmation with a page.
429
+ */
430
+ export const REPLY_LINES = 4;
431
+ /**
432
+ * Whether the reply ending this turn is over budget.
433
+ *
434
+ * Only WORK turns are gated. A turn that answered a question, explained something, or
435
+ * changed nothing is exactly where a long answer is the right answer, and cutting
436
+ * those would trade one bad habit for a worse one. After work, though, the user has
437
+ * watched every tool call and can read the diff, so a recap is the model narrating
438
+ * something already on screen.
439
+ *
440
+ * Fenced code is not counted — a snippet or a diff in the reply is content, never
441
+ * padding. Headings and a second question are refused at any length: a four-line
442
+ * answer that needs a heading is not a four-line answer.
443
+ */
444
+ export function replyFault(text, didWork) {
445
+ if (!didWork)
446
+ return null;
447
+ const prose = text.trim();
448
+ if (!prose)
449
+ return null;
450
+ const withoutFences = prose.replace(/```[\s\S]*?```/g, "");
451
+ const lines = withoutFences.split("\n").map((l) => l.trim()).filter(Boolean);
452
+ const headings = lines.filter((l) => /^#{1,6}\s/.test(l)).length;
453
+ const labels = lines.filter((l) => /^\*\*[^*]+\*\*:?$/.test(l)).length;
454
+ const questions = (withoutFences.match(/\?/g) ?? []).length;
455
+ const shape = [];
456
+ if (headings > 0)
457
+ shape.push(`${headings} heading${headings === 1 ? "" : "s"}`);
458
+ if (labels > 0)
459
+ shape.push(`${labels} bold section label${labels === 1 ? "" : "s"}`);
460
+ if (questions > 1)
461
+ shape.push(`${questions} questions`);
462
+ if (shape.length > 0)
463
+ return { kind: "shape", lines: lines.length, detail: shape.join(" and ") };
464
+ if (lines.length > REPLY_LINES)
465
+ return { kind: "length", lines: lines.length, detail: `${lines.length} lines` };
466
+ return null;
467
+ }
468
+ /**
469
+ * The instruction that replaces an over-budget reply.
470
+ *
471
+ * Addressed to the model as a rewrite of text it can still see, so nothing it worked
472
+ * out is lost — only the scaffolding around it. Deliberately names the fault, because
473
+ * "be shorter" produces a shorter version of the same shape.
474
+ */
475
+ export function replyRewrite(fault) {
476
+ const cause = fault.kind === "shape"
477
+ ? `That reply used ${fault.detail}, to report work the user watched you do.`
478
+ : `That reply ran to ${fault.detail}, where the budget after doing work is ${REPLY_LINES}.`;
479
+ return (`${cause} Write it again in ${REPLY_LINES} lines or fewer of plain prose: no headings, no bold ` +
480
+ `section labels, at most one question, and no recap of the changes — the user saw every call and ` +
481
+ `can read the diff. Keep any fact they could not have seen. Reply with the rewrite only, nothing else.`);
482
+ }
483
+ //# sourceMappingURL=verify.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify.js","sourceRoot":"","sources":["../../src/dynamo/verify.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,sEAAsE;AACtE,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,OAAO,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,YAAY,IAAI,QAAQ,KAAK,qBAA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