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,90 @@
1
+ import { compatStreamTurn, compatToolTurn } from "../openaiCompat/wire.js";
2
+ import { BUFFERED_OUTPUT_TOKENS, DEFAULT_MODEL, takesEffort } from "./manifest.js";
3
+ /**
4
+ * Z.ai's international OpenAI-compatible endpoint. The China platform
5
+ * (`open.bigmodel.cn`) serves the same model ids at different prices on a
6
+ * different key, so it is an override rather than a guess: a user on that account
7
+ * sets `MINDWEAVE_GLM_URL` and everything else works unchanged.
8
+ */
9
+ const BASE_URL = process.env.MINDWEAVE_GLM_URL ?? "https://api.z.ai/api/paas/v4";
10
+ /** The model a request runs on, matching the shared layer's own fallback so the
11
+ * reasoning fields can never be built for a different model than is being called. */
12
+ function modelOf(config) {
13
+ return config?.model ?? process.env.MINDWEAVE_MODEL ?? DEFAULT_MODEL;
14
+ }
15
+ /**
16
+ * GLM's reasoning fields.
17
+ *
18
+ * `thinking` is ALWAYS sent, both ways. The provider's default is `enabled`, so
19
+ * omitting the field does not mean "no thinking" — it means the model reasons and
20
+ * bills for it. Every internal call that never sets `req.model` (the session
21
+ * summarizer, the page distiller) would quietly pay for reasoning the UI discards.
22
+ * This is the third provider in this project with that exact default; it is a
23
+ * family pattern rather than a coincidence.
24
+ *
25
+ * `reasoning_effort` rides along only on the model that has the dial. Sending it to
26
+ * one that does not is a parameter the model has never heard of, not a soft no-op.
27
+ */
28
+ export function reasoningFields(config) {
29
+ const thinking = config?.thinking === true;
30
+ const fields = { thinking: { type: thinking ? "enabled" : "disabled" } };
31
+ if (thinking && takesEffort(modelOf(config))) {
32
+ fields.reasoning_effort = config?.effort ?? "high";
33
+ }
34
+ return fields;
35
+ }
36
+ /**
37
+ * Map this provider's own `finish_reason` values onto the shared set.
38
+ *
39
+ * The widest extra vocabulary of any driver here, and two of the three matter a
40
+ * great deal: without a case, `sensitive` and `model_context_window_exceeded` both
41
+ * fall through to `"end"`, so a refused reply and an overflowed conversation are
42
+ * each reported to the engine as a clean, complete finish.
43
+ */
44
+ export function extraStop(reason) {
45
+ switch (reason) {
46
+ case "sensitive":
47
+ return "refused";
48
+ case "model_context_window_exceeded":
49
+ return "overflow";
50
+ case "network_error":
51
+ return "overloaded";
52
+ default:
53
+ return undefined;
54
+ }
55
+ }
56
+ /**
57
+ * GLM reports its cache hit as `prompt_tokens_details.cached_tokens`, where
58
+ * `prompt_tokens` is the FULL prompt including the cached part — so the miss side
59
+ * is the remainder rather than a separate figure to add.
60
+ */
61
+ export function cacheSplit(usage) {
62
+ const details = usage.prompt_tokens_details;
63
+ const hit = typeof details?.cached_tokens === "number" ? details.cached_tokens : 0;
64
+ if (hit === 0)
65
+ return undefined;
66
+ const prompt = typeof usage.prompt_tokens === "number" ? usage.prompt_tokens : 0;
67
+ return { hit, miss: Math.max(0, prompt - hit) };
68
+ }
69
+ /** Everything the shared wire layer needs to talk to GLM. */
70
+ export const glmProvider = {
71
+ label: "GLM",
72
+ baseUrl: BASE_URL,
73
+ apiKeyEnv: "ZAI_API_KEY",
74
+ defaultModel: process.env.MINDWEAVE_MODEL ?? DEFAULT_MODEL,
75
+ reasoningFields,
76
+ extraStop,
77
+ cacheSplit,
78
+ // Must match the manifest's `bufferedOutputTokens`, which is what core reserves
79
+ // room for below the context window.
80
+ bufferedMaxTokens: BUFFERED_OUTPUT_TOKENS,
81
+ };
82
+ /** Ask the model for one turn. */
83
+ export async function toolTurn(req, options = {}) {
84
+ return compatToolTurn(glmProvider, req, options.signal);
85
+ }
86
+ /** Ask the model for one turn, streaming deltas to `options.onEvent`. */
87
+ export async function streamTurn(req, options = {}) {
88
+ return compatStreamTurn(glmProvider, req, options.onEvent, options.signal);
89
+ }
90
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/drivers/glm/client.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAuB,MAAM,yBAAyB,CAAC;AAChG,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEnF;;;;;GAKG;AACH,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,IAAI,8BAA8B,CAAC;AAEjF;sFACsF;AACtF,SAAS,OAAO,CAAC,MAA+B;IAC9C,OAAO,MAAM,EAAE,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,aAAa,CAAC;AACvE,CAAC;AAED;;;;;;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;AAClD,CAAC;AAED,6DAA6D;AAC7D,MAAM,CAAC,MAAM,WAAW,GAAmB;IACzC,KAAK,EAAE,KAAK;IACZ,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,aAAa;IACxB,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,aAAa;IAC1D,eAAe;IACf,SAAS;IACT,UAAU;IACV,gFAAgF;IAChF,qCAAqC;IACrC,iBAAiB,EAAE,sBAAsB;CAC1C,CAAC;AAEF,kCAAkC;AAClC,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAiB,EAAE,UAAuB,EAAE;IACzE,OAAO,cAAc,CAAC,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1D,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAiB,EAAE,UAAyB,EAAE;IAC7E,OAAO,gBAAgB,CAAC,WAAW,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7E,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { streamTurn, toolTurn } from "./client.js";
2
+ import { glmManifest } from "./manifest.js";
3
+ export const glmDriver = {
4
+ ...glmManifest,
5
+ toolTurn,
6
+ streamTurn,
7
+ };
8
+ export default glmDriver;
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drivers/glm/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,CAAC,MAAM,SAAS,GAAW;IAC/B,GAAG,WAAW;IACd,QAAQ;IACR,UAAU;CACX,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,183 @@
1
+ export const GLM_53 = "glm-5.3";
2
+ export const GLM_53_FLASH = "glm-5.3-flash";
3
+ export const GLM_52 = "glm-5.2";
4
+ export const GLM_5 = "glm-5";
5
+ export const GLM_47 = "glm-4.7";
6
+ export const GLM_47_FLASHX = "glm-4.7-flashx";
7
+ /** The model used when nothing is saved and no env override is set. */
8
+ export const DEFAULT_MODEL = GLM_53;
9
+ /**
10
+ * The models offered by `/model`. First entry is this provider's default, which is
11
+ * also where `/provider` lands when someone switches to GLM.
12
+ *
13
+ * The flagship leads here, unlike the other drivers, because on this provider it is
14
+ * not the expensive choice: GLM-5.2 runs well under half of Claude Sonnet's rate,
15
+ * and it is the only model in the lineup with a reasoning dial. The cheaper rungs
16
+ * are a real ladder below it rather than the sensible middle.
17
+ */
18
+ export const MODELS = [
19
+ { id: GLM_53, label: "GLM-5.3", description: "the flagship, three reasoning depths — the default" },
20
+ { id: GLM_53_FLASH, label: "GLM-5.3 Flash", description: "most of the flagship, a fraction of the price" },
21
+ { id: GLM_52, label: "GLM-5.2", description: "the previous flagship, with a reasoning dial" },
22
+ { id: GLM_5, label: "GLM-5", description: "older, a little cheaper again" },
23
+ { id: GLM_47, label: "GLM-4.7", description: "strong value for everyday work" },
24
+ { id: GLM_47_FLASHX, label: "GLM-4.7 FlashX", description: "very cheap and quick, for simple work" },
25
+ ];
26
+ /**
27
+ * Whether a model takes the `reasoning_effort` dial. Only GLM-5.2 does; the rest
28
+ * have thinking as a plain on/off toggle, and sending them an effort would be a
29
+ * parameter they do not know.
30
+ */
31
+ export function takesEffort(model) {
32
+ return model === GLM_52 || alwaysThinks(model);
33
+ }
34
+ /** * Models whose thinking cannot be switched off. * * Offering them an "answer directly" rung would build a menu entry that produces a * request the provider refuses. The ladder and `normalize` both read this. */ export function alwaysThinks(model) { return model === GLM_53 || model === GLM_53_FLASH; }
35
+ /**
36
+ * The reasoning levels offered by `/think`.
37
+ *
38
+ * GLM-5.2's `reasoning_effort` accepts seven values, but they COLLAPSE: `none` and
39
+ * `minimal` skip thinking, `low` and `medium` both map up to `high`, and `xhigh`
40
+ * maps up to `max`. So there are two real thinking levels behind seven names.
41
+ *
42
+ * Only the two are offered. Listing `low` and `medium` as separate rungs would put
43
+ * choices in front of the user that provably do nothing — the same reason Fable 5
44
+ * has no "answer directly" rung on the Anthropic driver. A menu should not contain
45
+ * a switch that is wired to the same place as the one above it.
46
+ */
47
+ export function thinkLevels(model) {
48
+ // GLM-5.3: three documented depths, and no way to answer without reasoning. The
49
+ // lightest rung is still thinking, so it is not labelled as though it skips it.
50
+ if (model === GLM_53) {
51
+ return [
52
+ { label: "Light", description: "reasons briefly — fastest", thinking: true, effort: "low" },
53
+ { label: "Thinking", description: "think first, then answer", thinking: true, effort: "high" },
54
+ { label: "Maximum", description: "maximum reasoning budget", thinking: true, effort: "max" },
55
+ ];
56
+ }
57
+ // GLM-5.3 Flash documents one effort value and no way to disable thinking, so it
58
+ // gets one honest rung rather than a menu of switches wired to the same place.
59
+ if (model === GLM_53_FLASH) {
60
+ return [{ label: "Thinking", description: "always reasons — this model cannot skip it", thinking: true, effort: "max" }];
61
+ }
62
+ if (takesEffort(model)) {
63
+ return [
64
+ { label: "Standard", description: "answer directly — fastest", thinking: false, effort: "high" },
65
+ { label: "Thinking", description: "think first, then answer", thinking: true, effort: "high" },
66
+ { label: "Maximum", description: "maximum reasoning budget", thinking: true, effort: "max" },
67
+ ];
68
+ }
69
+ return [
70
+ { label: "Standard", description: "answer directly — fastest", thinking: false, effort: "high" },
71
+ { label: "Thinking", description: "think first, then answer", thinking: true, effort: "high" },
72
+ ];
73
+ }
74
+ /**
75
+ * List prices (USD / 1M tokens), international endpoint. Cached input is billed
76
+ * separately and far lower, which is what keeps a re-sent conversation cheap.
77
+ *
78
+ * The China endpoint charges different rates for the same model ids. This driver
79
+ * targets international, so these are the figures that apply to it.
80
+ */
81
+ const PRICES = {
82
+ // Standard rates, NOT the launch promotion that halves Flash until 2026-09-09: a
83
+ // meter that quotes a discount is wrong the day it ends, and wrong quietly.
84
+ [GLM_53]: { cacheHit: 0.26, cacheMiss: 1.4, output: 4.4 },
85
+ [GLM_53_FLASH]: { cacheHit: 0.03, cacheMiss: 0.15, output: 0.5 },
86
+ [GLM_52]: { cacheHit: 0.26, cacheMiss: 1.4, output: 4.4 },
87
+ [GLM_5]: { cacheHit: 0.2, cacheMiss: 1, output: 3.2 },
88
+ [GLM_47]: { cacheHit: 0.11, cacheMiss: 0.6, output: 2.2 },
89
+ [GLM_47_FLASHX]: { cacheHit: 0.014, cacheMiss: 0.07, output: 0.4 },
90
+ };
91
+ /** Cache-aware list price for a model, falling back to the default model's. */
92
+ export function price(model) {
93
+ return PRICES[model] ?? PRICES[DEFAULT_MODEL];
94
+ }
95
+ /**
96
+ * The model's USABLE context window. GLM-5.2 stores 1M, but this is deliberately
97
+ * the sharp window rather than the storage cap: on BYOK every token in the window is
98
+ * the user's money on every turn, so anchoring compaction at 1M would mean carrying
99
+ * an enormous prompt long after it stopped earning its cost. Same reasoning, and the
100
+ * same figure, as the other drivers.
101
+ */
102
+ export function contextWindow(_model) {
103
+ return 200_000;
104
+ }
105
+ /**
106
+ * The ceiling this driver puts on a single BUFFERED (non-streaming) call. These
107
+ * models accept up to 128K output, but a non-streaming request that runs long risks
108
+ * an HTTP timeout, so the buffered path — core's small internal calls — is capped
109
+ * far lower. `client.ts` sends the same constant, and core reserves exactly this
110
+ * much room below the window, so the request and the reservation cannot drift apart.
111
+ */
112
+ export const BUFFERED_OUTPUT_TOKENS = 8_000;
113
+ export function bufferedOutputTokens(_model) {
114
+ return BUFFERED_OUTPUT_TOKENS;
115
+ }
116
+ /**
117
+ * Which models can SEE an image.
118
+ *
119
+ * GLM-5.3-Flash is natively multimodal — Z.ai documents image (and video) input on its
120
+ * own id, sent the ordinary OpenAI-compat way (`image_url` content parts), which the
121
+ * shared transport already produces. So core may attach the bytes and the model reads
122
+ * them. Every other GLM model here is text-only: pointing an image at one still degrades
123
+ * before anything is sent, which is what core does with a false answer here. (The older
124
+ * `glm-*v*` vision line is separate and not offered by this driver.)
125
+ */
126
+ export function acceptsImages(model) {
127
+ return model === GLM_53_FLASH;
128
+ }
129
+ /**
130
+ * Coerce a stored or unknown config onto a model this provider actually serves.
131
+ *
132
+ * No per-model rule to enforce beyond the effort dial: every model here can have
133
+ * thinking turned off. The result is snapped onto a rung `/think` actually lists,
134
+ * which is also what keeps the request legal — the ladder holds only values the
135
+ * model accepts, so snapping to it is what stops the shared type's other rungs from
136
+ * reaching a model that has no dial at all.
137
+ */
138
+ export function normalize(config) {
139
+ const model = PRICES[config.model] ? config.model : DEFAULT_MODEL;
140
+ // Forced on where the provider allows nothing else, so a config carried over from
141
+ // another model cannot produce a request this one refuses.
142
+ const thinking = alwaysThinks(model) ? true : config.thinking === true;
143
+ const effort = takesEffort(model) ? config.effort : "high";
144
+ return { model, thinking, effort: snapToOfferedRung(model, thinking, effort) };
145
+ }
146
+ /**
147
+ * Move an effort onto the nearest rung this model's `/think` ladder offers. Ties
148
+ * break DOWNWARD: an unlisted setting resolves to the cheaper neighbour, because
149
+ * silently spending more of the user's money is the worse way to be wrong.
150
+ */
151
+ function snapToOfferedRung(model, thinking, effort) {
152
+ const ladder = ["low", "medium", "high", "xhigh", "max"];
153
+ const offered = thinkLevels(model).filter((l) => l.thinking === thinking);
154
+ if (offered.length === 0)
155
+ return effort;
156
+ if (offered.some((l) => l.effort === effort))
157
+ return effort;
158
+ const want = ladder.indexOf(effort);
159
+ let best = offered[0];
160
+ for (const level of offered) {
161
+ const d = Math.abs(ladder.indexOf(level.effort) - want);
162
+ const bestD = Math.abs(ladder.indexOf(best.effort) - want);
163
+ if (d < bestD || (d === bestD && ladder.indexOf(level.effort) < ladder.indexOf(best.effort))) {
164
+ best = level;
165
+ }
166
+ }
167
+ return best.effort;
168
+ }
169
+ /** The cheap metadata half of this driver — see `index.ts` for the wire half. */
170
+ export const glmManifest = {
171
+ id: "glm",
172
+ label: "GLM",
173
+ apiKeyEnv: "ZAI_API_KEY",
174
+ keysUrl: "https://z.ai/manage-apikey/apikey-list",
175
+ models: MODELS,
176
+ thinkLevels,
177
+ price,
178
+ contextWindow,
179
+ bufferedOutputTokens,
180
+ acceptsImages,
181
+ normalize,
182
+ };
183
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/drivers/glm/manifest.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAChC,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAC;AAC5C,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAChC,MAAM,CAAC,MAAM,KAAK,GAAG,OAAO,CAAC;AAC7B,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAG,gBAAgB,CAAC;AAE9C,uEAAuE;AACvE,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AAEpC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,oDAAoD,EAAE;IACnG,EAAE,EAAE,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,+CAA+C,EAAE;IAC1G,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,8CAA8C,EAAE;IAC7F,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,+BAA+B,EAAE;IAC3E,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,gCAAgC,EAAE;IAC/E,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,uCAAuC,EAAE;CACrG,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,KAA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"../openaiCompat/wire.js";
2
+ import { BUFFERED_OUTPUT_TOKENS, DEFAULT_MODEL, takesEffort } from "./manifest.js";
3
+ const BASE_URL = process.env.MINDWEAVE_GROQ_URL ?? "https://api.groq.com/openai/v1";
4
+ /** The model a request runs on, matching the shared layer's own fallback. */
5
+ function modelOf(config) {
6
+ return config?.model ?? process.env.MINDWEAVE_MODEL ?? DEFAULT_MODEL;
7
+ }
8
+ /**
9
+ * Groq's reasoning fields.
10
+ *
11
+ * `reasoning_effort` here accepts only `none` or `default` — not the graded ladder
12
+ * every other provider on this layer exposes. Sending `high` is a 400, not a
13
+ * downgrade, so the shared effort rung is deliberately NOT forwarded: it is
14
+ * collapsed to the two states this API actually has.
15
+ *
16
+ * Sent only for the models that accept the parameter at all; the rest reject it.
17
+ */
18
+ export function reasoningFields(config) {
19
+ if (!takesEffort(modelOf(config)))
20
+ return {};
21
+ return { reasoning_effort: config?.thinking ? "default" : "none" };
22
+ }
23
+ /**
24
+ * Turn Groq's live catalogue into picker entries.
25
+ *
26
+ * The listing reports a real `context_window` per model, which is the one piece of
27
+ * per-model truth a discovered provider would otherwise have to guess. It is folded
28
+ * into the description so the choice is informed, rather than dropped because the
29
+ * shared `ModelChoice` has nowhere structured to put it.
30
+ *
31
+ * Non-chat models are filtered out. The endpoint lists speech and guard models
32
+ * alongside chat ones, and offering a transcription model in `/model` would be an
33
+ * entry that fails on first use.
34
+ */
35
+ export function toChoices(listed) {
36
+ return listed
37
+ .filter((m) => !/whisper|tts|guard|prompt-?guard/i.test(m.id))
38
+ .map((m) => ({
39
+ id: m.id,
40
+ label: m.id,
41
+ description: m.context_window ? `${Math.round(m.context_window / 1000)}K context` : "served on Groq",
42
+ }))
43
+ .sort((a, b) => a.id.localeCompare(b.id));
44
+ }
45
+ /**
46
+ * Fetch the models Groq is serving right now.
47
+ *
48
+ * Throws when the key is missing or the request fails, which is the contract the
49
+ * registry relies on: a throw keeps the previous list, an empty array replaces it.
50
+ */
51
+ export async function discoverModels() {
52
+ return toChoices(await listModels(groqProvider));
53
+ }
54
+ /**
55
+ * Groq caches automatically on every request, with no code change and no opt-in, and
56
+ * reports the hit as `prompt_tokens_details.cached_tokens`. An earlier version of
57
+ * this driver claimed it reported nothing, which made a multi-step turn count every
58
+ * step's whole prompt as fresh and report several times the tokens it used.
59
+ *
60
+ * No `extraStop`: the finish reasons are the plain OpenAI set, so there is nothing
61
+ * extra to map. That absence is deliberate.
62
+ */
63
+ export const groqProvider = {
64
+ label: "Groq",
65
+ baseUrl: BASE_URL,
66
+ apiKeyEnv: "GROQ_API_KEY",
67
+ defaultModel: process.env.MINDWEAVE_MODEL ?? DEFAULT_MODEL,
68
+ reasoningFields,
69
+ cacheSplit: standardCacheSplit,
70
+ bufferedMaxTokens: BUFFERED_OUTPUT_TOKENS,
71
+ };
72
+ /** Ask the model for one turn. */
73
+ export async function toolTurn(req, options = {}) {
74
+ return compatToolTurn(groqProvider, req, options.signal);
75
+ }
76
+ /** Ask the model for one turn, streaming deltas to `options.onEvent`. */
77
+ export async function streamTurn(req, options = {}) {
78
+ return compatStreamTurn(groqProvider, req, options.onEvent, options.signal);
79
+ }
80
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/drivers/groq/client.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,UAAU,EAAE,kBAAkB,EAAuB,MAAM,yBAAyB,CAAC;AAChI,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEnF,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,gCAAgC,CAAC;AAEpF,6EAA6E;AAC7E,SAAS,OAAO,CAAC,MAA+B;IAC9C,OAAO,MAAM,EAAE,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,aAAa,CAAC;AACvE,CAAC;AAED;;;;;;;;;GASG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C9B,iBAAiB,EAAE,sBAAsB;CAC1C,CAAC;AAEF,kCAAkC;AAClC,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAiB,EAAE,UAAuB,EAAE;IACzE,OAAO,cAAc,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAiB,EAAE,UAAyB,EAAE;IAC7E,OAAO,gBAAgB,CAAC,YAAY,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC9E,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { streamTurn, toolTurn } from "./client.js";
2
+ import { groqManifest } from "./manifest.js";
3
+ export const groqDriver = { ...groqManifest, toolTurn, streamTurn };
4
+ export default groqDriver;
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drivers/groq/index.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE7C,MAAM,CAAC,MAAM,UAAU,GAAW,EAAE,GAAG,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAE5E,eAAe,UAAU,CAAC"}
@@ -0,0 +1,160 @@
1
+ /**
2
+ * A minimal fallback list, shown only before discovery has run or when it fails.
3
+ *
4
+ * Deliberately short and boring: these are the ids least likely to have been
5
+ * retired, because a fallback that names a withdrawn model is worse than a fallback
6
+ * that names two working ones. The live list replaces this entirely.
7
+ */
8
+ export const MODELS = [
9
+ { id: "llama-3.3-70b-versatile", label: "Llama 3.3 70B", description: "general purpose, very fast" },
10
+ { id: "openai/gpt-oss-120b", label: "GPT-OSS 120B", description: "open weights, with a reasoning dial" },
11
+ ];
12
+ /** The model used when nothing is saved and no env override is set. */
13
+ export const DEFAULT_MODEL = MODELS[0].id;
14
+ /**
15
+ * Models known to accept `reasoning_effort`.
16
+ *
17
+ * Matched by SUBSTRING rather than exact id, and that is a concession to the
18
+ * discovered lineup: ids arrive with vendor prefixes and size suffixes that vary
19
+ * (`openai/gpt-oss-120b`, `qwen/qwen3-32b`), so an exact table would go stale for
20
+ * the same reason the model list does. A false negative here costs a reasoning dial;
21
+ * a false positive costs a rejected request, so the list stays narrow.
22
+ */
23
+ const EFFORT_MODELS = ["gpt-oss", "qwen3"];
24
+ export function takesEffort(model) {
25
+ const id = model.toLowerCase();
26
+ return EFFORT_MODELS.some((fragment) => id.includes(fragment));
27
+ }
28
+ /**
29
+ * The reasoning levels offered by `/think`.
30
+ *
31
+ * Groq accepts only `none` and `default` for `reasoning_effort` — not the graded
32
+ * ladder other providers expose. So there are exactly two states, and offering a
33
+ * "Deep" or "Maximum" rung would be a menu entry that sends a value the API rejects.
34
+ * `default` is expressed here as thinking-on; `none` as thinking-off.
35
+ */
36
+ export function thinkLevels(model) {
37
+ if (takesEffort(model)) {
38
+ return [
39
+ { label: "Standard", description: "answer directly — fastest", thinking: false, effort: "low" },
40
+ { label: "Thinking", description: "think first, then answer", thinking: true, effort: "high" },
41
+ ];
42
+ }
43
+ return [{ label: "Standard", description: "this model has no reasoning dial", thinking: false, effort: "low" }];
44
+ }
45
+ /**
46
+ * List prices (USD / 1M tokens), for the models whose rates are published.
47
+ *
48
+ * A discovered lineup cannot have a complete price table by definition — a model
49
+ * that appears tomorrow has no row here. The fallback is deliberately the CHEAPEST
50
+ * plausible rate rather than an average: this provider serves small open models at
51
+ * low rates, so guessing high would make a cost figure look alarming for a session
52
+ * that was in fact inexpensive. Matched by substring, for the same reason as
53
+ * `takesEffort`.
54
+ *
55
+ * Cached input takes a flat 50% discount here — not the ~90% most providers give —
56
+ * so `cacheHit` is half of `cacheMiss` throughout rather than a tenth.
57
+ */
58
+ const PRICES = [
59
+ ["gpt-oss-120b", { cacheHit: 0.075, cacheMiss: 0.15, output: 0.75 }],
60
+ ["gpt-oss-20b", { cacheHit: 0.05, cacheMiss: 0.1, output: 0.5 }],
61
+ ["llama-3.3-70b", { cacheHit: 0.295, cacheMiss: 0.59, output: 0.79 }],
62
+ ["llama-3.1-8b", { cacheHit: 0.025, cacheMiss: 0.05, output: 0.08 }],
63
+ ["qwen3-32b", { cacheHit: 0.145, cacheMiss: 0.29, output: 0.59 }],
64
+ ];
65
+ const UNKNOWN_PRICE = { cacheHit: 0.05, cacheMiss: 0.1, output: 0.5 };
66
+ export function price(model) {
67
+ const id = model.toLowerCase();
68
+ return PRICES.find(([fragment]) => id.includes(fragment))?.[1] ?? UNKNOWN_PRICE;
69
+ }
70
+ /**
71
+ * The model's USABLE context window.
72
+ *
73
+ * Groq's `/models` listing reports a real `context_window` per model, and
74
+ * `client.ts` folds it into the discovered entry. This is the floor used when that
75
+ * is unavailable — a conservative 128K, since the open models served here range from
76
+ * 8K to over 250K and over-stating it would let a transcript grow past what the
77
+ * model can actually attend to.
78
+ */
79
+ export function contextWindow(_model) {
80
+ return 128_000;
81
+ }
82
+ /** The ceiling this driver puts on a single BUFFERED call. */
83
+ export const BUFFERED_OUTPUT_TOKENS = 8_000;
84
+ export function bufferedOutputTokens(_model) {
85
+ return BUFFERED_OUTPUT_TOKENS;
86
+ }
87
+ /** The effort rungs this driver uses; Groq's real vocabulary is two states. */
88
+ const EFFORTS = ["low", "medium", "high", "xhigh", "max"];
89
+ /**
90
+ * Coerce a stored or unknown config onto something serveable.
91
+ *
92
+ * The one thing that CANNOT be done here, and is the difference from every static
93
+ * driver: reject an unknown model id. A discovered provider's list may be empty
94
+ * (discovery has not run, or the key is missing), and coercing the user's saved
95
+ * model onto a fallback in that window would silently change their choice on every
96
+ * launch. So an unrecognised id is kept as-is and left for the provider to judge.
97
+ */
98
+ export function normalize(config) {
99
+ const model = config.model || DEFAULT_MODEL;
100
+ const thinking = takesEffort(model) ? config.thinking === true : false;
101
+ const effort = EFFORTS.includes(config.effort) ? config.effort : "low";
102
+ return { model, thinking, effort: snapToOfferedRung(model, thinking, effort) };
103
+ }
104
+ /** Move an effort onto the nearest rung this model's ladder offers, ties downward. */
105
+ function snapToOfferedRung(model, thinking, effort) {
106
+ const offered = thinkLevels(model).filter((l) => l.thinking === thinking);
107
+ if (offered.length === 0)
108
+ return thinkLevels(model)[0].effort;
109
+ if (offered.some((l) => l.effort === effort))
110
+ return effort;
111
+ const want = EFFORTS.indexOf(effort);
112
+ let best = offered[0];
113
+ for (const level of offered) {
114
+ const d = Math.abs(EFFORTS.indexOf(level.effort) - want);
115
+ const bestD = Math.abs(EFFORTS.indexOf(best.effort) - want);
116
+ if (d < bestD || (d === bestD && EFFORTS.indexOf(level.effort) < EFFORTS.indexOf(best.effort)))
117
+ best = level;
118
+ }
119
+ return best.effort;
120
+ }
121
+ /**
122
+ * Recognise a Groq model id without a list.
123
+ *
124
+ * Needed because the provider is derived from the model id and a discovered list is
125
+ * empty until asked: without this, a saved Groq model would be attributed to the
126
+ * fallback provider on launch and the session would open on the wrong one. These
127
+ * fragments are the vendor prefixes Groq's catalogue uses.
128
+ *
129
+ * Consulted only AFTER every provider's real list is searched, so it can never take
130
+ * a model another provider actually serves.
131
+ */
132
+ export function ownsModel(model) {
133
+ const id = model.toLowerCase();
134
+ return ["llama-", "openai/gpt-oss", "qwen/", "moonshotai/", "groq/", "meta-llama/"].some((p) => id.startsWith(p));
135
+ }
136
+ /** The cheap metadata half of this driver — see `index.ts` for the wire half. */
137
+ export const groqManifest = {
138
+ id: "groq",
139
+ label: "Groq",
140
+ apiKeyEnv: "GROQ_API_KEY",
141
+ keysUrl: "https://console.groq.com/keys",
142
+ models: MODELS,
143
+ thinkLevels,
144
+ price,
145
+ contextWindow,
146
+ bufferedOutputTokens,
147
+ normalize,
148
+ ownsModel,
149
+ /**
150
+ * Discovery lives here rather than on the driver, because the `/model` picker
151
+ * needs the list before any wire code has been loaded — that is the whole reason
152
+ * manifests are separate from drivers.
153
+ *
154
+ * The import is INSIDE the function, so this module still touches no network and
155
+ * loads no wire code at import time. A manifest that imported its client at the
156
+ * top would undo the lazy split for every user of every other provider.
157
+ */
158
+ discoverModels: async () => (await import("./client.js")).discoverModels(),
159
+ };
160
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/drivers/groq/manifest.ts"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,EAAE,EAAE,EAAE,yBAAyB,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,4BAA4B,EAAE;IACpG,EAAE,EAAE,EAAE,qBAAqB,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,qCAAqC,EAAE;CACzG,CAAC;AAEF,uEAAuE;AACvE,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC;AAE3C;;;;;;;;GAQG;AACH,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;AAE3C,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,MAAM,EAAE,GAAG,KAAK,CAAC,WAAW,EAAE,CAAC;IAC/B,OAAO,aAAa,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO;YACL,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,2BAA2B,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;YAC/F,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,0BAA0B,EAAE,QAAQ,EAAE,IAAI,EA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L,aAAa;IACb,oBAAoB;IACpB,SAAS;IACT,SAAS;IACT;;;;;;;;OAQG;IACH,cAAc,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,EAAE;CAC3E,CAAC"}
@@ -0,0 +1,82 @@
1
+ import { compatStreamTurn, compatToolTurn } from "../openaiCompat/wire.js";
2
+ import { BUFFERED_OUTPUT_TOKENS, DEFAULT_MODEL, surfaceOf } from "./manifest.js";
3
+ /** Moonshot's international endpoint, which is where these model ids are served. */
4
+ const BASE_URL = process.env.MINDWEAVE_KIMI_URL ?? "https://api.moonshot.ai/v1";
5
+ /** The model a request runs on, matching the shared layer's own fallback so the
6
+ * reasoning fields can never be built for a different model than is being called. */
7
+ function modelOf(config) {
8
+ return config?.model ?? process.env.MINDWEAVE_MODEL ?? DEFAULT_MODEL;
9
+ }
10
+ /**
11
+ * Kimi's reasoning fields — three shapes across one lineup.
12
+ *
13
+ * - K3 has NO `thinking` parameter. It takes a top-level `reasoning_effort`, and
14
+ * it reasons on every response whether asked to or not. Sending `thinking` here
15
+ * would be a parameter the model does not know.
16
+ * - K2.7 Code takes `thinking: {type}` but accepts only `"enabled"`; `"disabled"`
17
+ * is a rejected request rather than a soft no-op.
18
+ * - K2.6 and K2.5 take `thinking: {type}` both ways, and default to ENABLED — so
19
+ * the off switch is sent explicitly, exactly as on Qwen and DeepSeek. Omitting
20
+ * it would mean every internal call (the summarizer, the page distiller) quietly
21
+ * paying for reasoning the UI then discards.
22
+ *
23
+ * `normalize` has already made the config legal for the model, so this only renders
24
+ * it. The model is resolved the same way the shared layer resolves it, so the two
25
+ * can never disagree about which model's rules apply.
26
+ */
27
+ export function reasoningFields(config) {
28
+ const surface = surfaceOf(modelOf(config));
29
+ if (surface.takesEffort) {
30
+ // K3: always reasons; the rung is the only choice. `normalize` has already
31
+ // clamped it to a value this model accepts.
32
+ return { reasoning_effort: config?.effort ?? "high" };
33
+ }
34
+ if (!surface.canDisableThinking)
35
+ return { thinking: { type: "enabled" } };
36
+ return { thinking: { type: config?.thinking ? "enabled" : "disabled" } };
37
+ }
38
+ /**
39
+ * Kimi reports its cache hit as `cached_tokens` on the usage object, where
40
+ * `prompt_tokens` is the FULL prompt including the cached part — so the miss side
41
+ * is the remainder rather than a separate figure to add. The nested
42
+ * `prompt_tokens_details` shape is read too, since the platform reports it both
43
+ * ways depending on the model.
44
+ */
45
+ export function cacheSplit(usage) {
46
+ const details = usage.prompt_tokens_details;
47
+ const nested = typeof details?.cached_tokens === "number" ? details.cached_tokens : 0;
48
+ const flat = typeof usage.cached_tokens === "number" ? usage.cached_tokens : 0;
49
+ const hit = nested || flat;
50
+ if (hit === 0)
51
+ return undefined;
52
+ const prompt = typeof usage.prompt_tokens === "number" ? usage.prompt_tokens : 0;
53
+ return { hit, miss: Math.max(0, prompt - hit) };
54
+ }
55
+ /**
56
+ * Everything the shared wire layer needs to talk to Kimi.
57
+ *
58
+ * No `extraStop`: this platform documents exactly the OpenAI vocabulary
59
+ * (`stop` / `length` / `tool_calls`), so there is nothing extra to map. Stated
60
+ * rather than left blank, because an absent mapper is otherwise indistinguishable
61
+ * from a forgotten one.
62
+ */
63
+ export const kimiProvider = {
64
+ label: "Kimi",
65
+ baseUrl: BASE_URL,
66
+ apiKeyEnv: "MOONSHOT_API_KEY",
67
+ defaultModel: process.env.MINDWEAVE_MODEL ?? DEFAULT_MODEL,
68
+ reasoningFields,
69
+ cacheSplit,
70
+ // Must match the manifest's `bufferedOutputTokens`, which is what core reserves
71
+ // room for below the context window.
72
+ bufferedMaxTokens: BUFFERED_OUTPUT_TOKENS,
73
+ };
74
+ /** Ask the model for one turn. */
75
+ export async function toolTurn(req, options = {}) {
76
+ return compatToolTurn(kimiProvider, req, options.signal);
77
+ }
78
+ /** Ask the model for one turn, streaming deltas to `options.onEvent`. */
79
+ export async function streamTurn(req, options = {}) {
80
+ return compatStreamTurn(kimiProvider, req, options.onEvent, options.signal);
81
+ }
82
+ //# sourceMappingURL=client.js.map