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,168 @@
1
+ import { compatStreamTurn, compatToolTurn, requireApiKey } from "../openaiCompat/wire.js";
2
+ import { clientId } from "../clientId.js";
3
+ import { extractSearch, SEARCH_MAX_USES, SEARCH_SYSTEM } from "../searchBlocks.js";
4
+ import { parseInlineToolCalls } from "./inlineTools.js";
5
+ import { DEFAULT_MODEL } from "./manifest.js";
6
+ const BASE_URL = process.env.MINDWEAVE_BASE_URL ?? "https://api.deepseek.com";
7
+ const MODEL = process.env.MINDWEAVE_MODEL ?? DEFAULT_MODEL;
8
+ /**
9
+ * Where DeepSeek serves its own web search.
10
+ *
11
+ * DeepSeek speaks two protocols on one account and one key. Chat and tools run over
12
+ * the OpenAI-compatible path above; the native web search is served ONLY over this
13
+ * Anthropic-Messages-compatible one, as a server-side tool. So this driver talks to
14
+ * both, and which one a request uses is decided by the OPERATION rather than by
15
+ * configuration — there is nothing for the user to choose and no second key.
16
+ *
17
+ * Only the search call moves. Putting the whole driver here would cost real things:
18
+ * this endpoint ignores `cache_control` (so the prompt cache the OpenAI path relies
19
+ * on would be gone) and does not carry MCP tools, images, or code execution.
20
+ */
21
+ const ANTHROPIC_BASE_URL = process.env.MINDWEAVE_DEEPSEEK_ANTHROPIC_URL ?? "https://api.deepseek.com/anthropic";
22
+ /** Output ceiling for the buffered search call. */
23
+ const SEARCH_MAX_TOKENS = 8_000;
24
+ /**
25
+ * DeepSeek's reasoning fields.
26
+ *
27
+ * The `thinking` field is ALWAYS sent, one way or the other — DeepSeek's own docs
28
+ * say omitting it entirely defaults to ENABLED at high effort, not disabled. So
29
+ * every internal call that never sets `req.model` (the session-memory summarizer,
30
+ * the web-page distiller) was once silently paying for full reasoning it never
31
+ * asked for and the UI was never going to show, since reasoning deltas are
32
+ * discarded unconditionally. Sending an explicit `{ type: "disabled" }` is what
33
+ * actually turns it off.
34
+ *
35
+ * This turned out to be the family pattern rather than a DeepSeek quirk: Qwen and
36
+ * GLM default to thinking-on in exactly the same way, and their drivers send the
37
+ * off switch explicitly for exactly this reason.
38
+ */
39
+ export function reasoningFields(config) {
40
+ if (!config?.thinking)
41
+ return { thinking: { type: "disabled" } };
42
+ return { thinking: { type: "enabled" }, reasoning_effort: config.effort };
43
+ }
44
+ /**
45
+ * DeepSeek's documented sampling settings for agent use.
46
+ *
47
+ * Two facts from their docs, and the second is why this is a function rather than a
48
+ * constant spread into every body:
49
+ *
50
+ * 1. The recommended operating point is `temperature = 1.0` with `top_p = 0.95` for
51
+ * agentic use (`1.0` otherwise). We were sending NEITHER, so every call ran on
52
+ * whatever the endpoint's default happened to be — fine until it changes, and
53
+ * invisible when it does.
54
+ * 2. "Thinking mode does not support the temperature, top_p, presence_penalty, or
55
+ * frequency_penalty parameters. These parameters will not trigger an error but
56
+ * will have no effect." So with thinking ON there is nothing to set.
57
+ *
58
+ * Which means this bites exactly where thinking is off: the Standard `/think` level,
59
+ * and every internal buffered call — the session summarizer, the web-page distiller —
60
+ * since `reasoningFields` sends `{ type: "disabled" }` for those. Those are the calls
61
+ * that were silently un-tuned, and they are also the ones whose output feeds straight
62
+ * back into the transcript.
63
+ *
64
+ * Temperature is NOT lowered to shorten output, ever, however tempting that looks for
65
+ * a summarizer: DeepSeek warns that lower temperatures collapse the reasoning trace
66
+ * and degrade the answer, and that length belongs to `max_tokens`. Written down here
67
+ * because it is exactly the "optimisation" a later reader would otherwise try.
68
+ */
69
+ export function sampling(config) {
70
+ if (config?.thinking)
71
+ return {};
72
+ return { temperature: 1.0, top_p: 0.95 };
73
+ }
74
+ /**
75
+ * `insufficient_system_resource` is DeepSeek-specific, not part of the OpenAI
76
+ * spec: the request was cut off by DeepSeek's own infrastructure, not a token limit
77
+ * or a safety decision. Without a case for it, it falls through to `"end"` — a
78
+ * resource-starved, incomplete reply reported as a clean finish.
79
+ */
80
+ export function extraStop(reason) {
81
+ return reason === "insufficient_system_resource" ? "overloaded" : undefined;
82
+ }
83
+ /**
84
+ * DeepSeek reports BOTH sides of the cache split directly, as siblings of
85
+ * `prompt_tokens`, rather than nesting a `cached_tokens` figure that the miss side
86
+ * has to be derived from. Read as given: deriving one from the other here would
87
+ * disagree with the provider whenever the two do not sum to the prompt exactly.
88
+ */
89
+ export function cacheSplit(usage) {
90
+ const num = (key) => (typeof usage[key] === "number" ? usage[key] : 0);
91
+ const hit = num("prompt_cache_hit_tokens");
92
+ const miss = num("prompt_cache_miss_tokens");
93
+ if (hit === 0 && miss === 0)
94
+ return undefined;
95
+ return { hit, miss };
96
+ }
97
+ /**
98
+ * Recover tool calls DeepSeek leaked into the TEXT channel as DSML markup, and
99
+ * strip that markup from the content either way.
100
+ *
101
+ * The recovery only fires when the structured list is empty: a model that emitted
102
+ * a proper `tool_calls` array and also narrated one in prose has already had its
103
+ * call registered, and adding the narrated copy would run it twice.
104
+ */
105
+ export function repairContent(content, toolCalls) {
106
+ const inline = parseInlineToolCalls(content);
107
+ const recovered = toolCalls.length === 0 ? inline.toolCalls : toolCalls;
108
+ return { content: inline.cleaned, toolCalls: recovered };
109
+ }
110
+ /** Everything the shared wire layer needs to talk to DeepSeek. */
111
+ export const deepseekProvider = {
112
+ label: "DeepSeek",
113
+ baseUrl: BASE_URL,
114
+ apiKeyEnv: "DEEPSEEK_API_KEY",
115
+ defaultModel: MODEL,
116
+ reasoningFields,
117
+ sampling,
118
+ extraStop,
119
+ cacheSplit,
120
+ repairContent,
121
+ };
122
+ /** Ask the model for one turn. An empty `tools` array forces a plain-text answer. */
123
+ export async function toolTurn(req, options = {}) {
124
+ return compatToolTurn(deepseekProvider, req, options.signal);
125
+ }
126
+ /** Ask the model for one turn, streaming deltas to `options.onEvent`. */
127
+ export async function streamTurn(req, options = {}) {
128
+ return compatStreamTurn(deepseekProvider, req, options.onEvent, options.signal);
129
+ }
130
+ /**
131
+ * Search the web, over DeepSeek's own Anthropic-protocol endpoint.
132
+ *
133
+ * DeepSeek runs the search on its own servers with the key the user already has.
134
+ * Nothing third-party is involved and there is no second key — the same account,
135
+ * reached over the protocol that happens to carry its search.
136
+ *
137
+ * The SDK is imported HERE rather than at the top of the file so that a DeepSeek
138
+ * session that never searches does not load it. That lazy split is measured and
139
+ * deliberate (it is why drivers load on demand at all), and a top-level import would
140
+ * quietly undo it for every DeepSeek user.
141
+ *
142
+ * The model id is passed through as DeepSeek's own (`deepseek-v4-pro`), which is what
143
+ * their documented example does. Their Claude-name mapping is a compatibility shim
144
+ * for clients that only know Anthropic model names, and routing through it would mean
145
+ * naming a Claude model to get a DeepSeek one — indirection with nothing to gain.
146
+ */
147
+ export async function webSearch(query, options = {}) {
148
+ const { default: Anthropic } = await import("@anthropic-ai/sdk");
149
+ const client = new Anthropic({
150
+ apiKey: requireApiKey(deepseekProvider),
151
+ baseURL: ANTHROPIC_BASE_URL,
152
+ // DeepSeek authenticates this endpoint with `x-api-key`, which is what the SDK
153
+ // sends for `apiKey`. It ignores `anthropic-version` rather than requiring it.
154
+ defaultHeaders: { "User-Agent": clientId() },
155
+ });
156
+ const message = await client.messages.create({
157
+ model: MODEL,
158
+ max_tokens: SEARCH_MAX_TOKENS,
159
+ system: SEARCH_SYSTEM,
160
+ messages: [{ role: "user", content: query }],
161
+ // The original tool version, not Anthropic's newer dated one: this is
162
+ // DeepSeek's implementation of the protocol, and the widely-implemented
163
+ // version is the one to send to a compatibility endpoint.
164
+ tools: [{ type: "web_search_20250305", name: "web_search", max_uses: SEARCH_MAX_USES }],
165
+ }, { signal: options.signal });
166
+ return extractSearch(message);
167
+ }
168
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/drivers/deepseek/client.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAuB,MAAM,yBAAyB,CAAC;AAC/G,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAE9C,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,0BAA0B,CAAC;AAC9E,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,aAAa,CAAC;AAE3D;;;;;;;;;;;;GAYG;AACH,MAAM,kBAAkB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Aa,CAAC,gBAAgB,CAAC;QACvC,OAAO,EAAE,kBAAkB;QAC3B,+EAA+E;QAC/E,+EAA+E;QAC/E,cAAc,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,EAAE;KAC7C,CAAC,CAAC;IACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,MAAM,CAC1C;QACE,KAAK,EAAE,KAAK;QACZ,UAAU,EAAE,iBAAiB;QAC7B,MAAM,EAAE,aAAa;QACrB,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;QAC5C,sEAAsE;QACtE,wEAAwE;QACxE,0DAA0D;QAC1D,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;KACxF,EACD,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAC3B,CAAC;IACF,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { streamTurn, toolTurn, webSearch } from "./client.js";
2
+ import { stripInlineToolCalls } from "./inlineTools.js";
3
+ import { deepseekManifest } from "./manifest.js";
4
+ export const deepseekDriver = {
5
+ ...deepseekManifest,
6
+ toolTurn,
7
+ streamTurn,
8
+ // Served over DeepSeek's own Anthropic-protocol endpoint, with the same key. Chat
9
+ // stays on the OpenAI path; only this call changes protocol.
10
+ webSearch,
11
+ // The live UI renders raw text deltas, which is the one place DeepSeek's leaked
12
+ // DSML markup can still reach the screen — the assembled turn is already clean.
13
+ sanitizeText: stripInlineToolCalls,
14
+ };
15
+ export default deepseekDriver;
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drivers/deepseek/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,CAAC,MAAM,cAAc,GAAW;IACpC,GAAG,gBAAgB;IACnB,QAAQ;IACR,UAAU;IACV,kFAAkF;IAClF,6DAA6D;IAC7D,SAAS;IACT,gFAAgF;IAChF,gFAAgF;IAChF,YAAY,EAAE,oBAAoB;CACnC,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -0,0 +1,46 @@
1
+ const BLOCK_RE = /<[^<>]*DSML[^<>]*tool_calls\s*>[\s\S]*?<\/[^<>]*DSML[^<>]*tool_calls\s*>/g;
2
+ const INVOKE_RE = /<[^<>]*DSML[^<>]*invoke[^<>]*name="([^"]+)"[^<>]*>([\s\S]*?)<\/[^<>]*DSML[^<>]*invoke[^<>]*>/g;
3
+ const PARAM_RE = /<[^<>]*DSML[^<>]*parameter[^<>]*name="([^"]+)"([^<>]*)>([\s\S]*?)<\/[^<>]*DSML[^<>]*parameter[^<>]*>/g;
4
+ /** True if the text contains a leaked DSML tool-call block (cheap pre-check). */
5
+ export function hasInlineToolCalls(content) {
6
+ BLOCK_RE.lastIndex = 0;
7
+ return BLOCK_RE.test(content);
8
+ }
9
+ /** Strip leaked tool-call markup from text for DISPLAY (no parsing). */
10
+ export function stripInlineToolCalls(content) {
11
+ return content.replace(BLOCK_RE, "").replace(/\n{3,}/g, "\n\n").trim();
12
+ }
13
+ /** Parse leaked tool-call blocks into real tool calls and return the cleaned text. */
14
+ export function parseInlineToolCalls(content) {
15
+ const toolCalls = [];
16
+ let n = 0;
17
+ for (const block of content.match(BLOCK_RE) ?? []) {
18
+ INVOKE_RE.lastIndex = 0;
19
+ let inv;
20
+ while ((inv = INVOKE_RE.exec(block)) !== null) {
21
+ const name = inv[1];
22
+ const args = {};
23
+ PARAM_RE.lastIndex = 0;
24
+ let p;
25
+ while ((p = PARAM_RE.exec(inv[2])) !== null) {
26
+ const key = p[1];
27
+ const attrs = p[2] ?? "";
28
+ const raw = p[3].trim();
29
+ // The convention DeepSeek follows: a parameter is a string unless it's
30
+ // flagged `string="false"`, in which case its value is JSON.
31
+ args[key] = /string="false"/i.test(attrs) ? tryJson(raw) : raw;
32
+ }
33
+ toolCalls.push({ id: `inline_${Date.now()}_${n++}`, name, arguments: JSON.stringify(args) });
34
+ }
35
+ }
36
+ return { cleaned: stripInlineToolCalls(content), toolCalls };
37
+ }
38
+ function tryJson(raw) {
39
+ try {
40
+ return JSON.parse(raw);
41
+ }
42
+ catch {
43
+ return raw; // not valid JSON → keep the literal text
44
+ }
45
+ }
46
+ //# sourceMappingURL=inlineTools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inlineTools.js","sourceRoot":"","sources":["../../../src/drivers/deepseek/inlineTools.ts"],"names":[],"mappings":"AAwBA,MAAM,QAAQ,GAAG,2EAA2E,CAAC;AAC7F,MAAM,SAAS,GAAG,+FAA+F,CAAC;AAClH,MAAM,QAAQ,GAAG,uGAAuG,CAAC;AASzH,iFAAiF;AACjF,MAAM,UAAU,kBAAkB,CAAC,OAAe;IAChD,QAAQ,CAAC,SAAS,GAAG,CAAC,CAAC;IACvB,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAChC,CAAC;AAED,wEAAwE;AACxE,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,OAAO,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;AACzE,CAAC;AAED,sFAAsF;AACtF,MAAM,UAAU,oBAAoB,CAAC,OAAe;IAClD,MAAM,SAAS,GAAe,EAAE,CAAC;IACjC,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,KAAK,MAAM,KAAK,IAAI,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,EA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GAAG,CAAC,CAAC;IACzB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,GAAG,CAAC,CAAC,yCAAyC;IACvD,CAAC;AACH,CAAC"}
@@ -0,0 +1,166 @@
1
+ export const FLASH = "deepseek-v4-flash";
2
+ export const PRO = "deepseek-v4-pro";
3
+ /** The multimodal model, added 2026-08-21. `-exp` is DeepSeek's own suffix: they
4
+ * ship it as experimental, and the id is theirs, not a label we chose. */
5
+ export const VISION = "deepseek-v4-flash-vision-exp";
6
+ /** The model used when nothing is saved and no env override is set. */
7
+ export const DEFAULT_MODEL = FLASH;
8
+ /** The models offered by `/model`. First entry is the default. */
9
+ export const MODELS = [
10
+ { id: FLASH, label: "DeepSeek V4 Flash", description: "fast & cheap — the default" },
11
+ { id: PRO, label: "DeepSeek V4 Pro", description: "stronger, for harder work" },
12
+ { id: VISION, label: "DeepSeek V4 Flash Vision", description: "reads images — experimental" },
13
+ ];
14
+ /**
15
+ * The effort values DeepSeek's API actually accepts for `reasoning_effort`.
16
+ *
17
+ * The shared `Effort` type is the union of every provider's ladder and includes
18
+ * rungs DeepSeek has never had (`medium`, `xhigh` — those are Anthropic's). Sending
19
+ * one is not a soft failure: it's a value the API does not recognize. So this set
20
+ * is the authority, `normalize` clamps to it, and a test asserts every level we
21
+ * advertise survives that clamp.
22
+ */
23
+ const ACCEPTED_EFFORTS = new Set(["low", "high", "max"]);
24
+ /**
25
+ * The reasoning levels offered by `/think`. DeepSeek V4 exposes thinking as a toggle
26
+ * on the same model id plus a `reasoning_effort` budget, so the whole space is:
27
+ *
28
+ * Standard (no thinking) · High (thinking, high) · Maximum (thinking, max)
29
+ *
30
+ * Pro's Maximum sends `max`. It previously sent `xhigh`, which DeepSeek does not
31
+ * accept, so that level had never done anything — the rung had leaked in from the
32
+ * shared type when a second provider was added.
33
+ *
34
+ * FLASH HAS A MAXIMUM TIER TOO, and used to be denied one here. The fix that removed
35
+ * `xhigh` also scoped Maximum to Pro, on the assumption that the cheaper model had a
36
+ * shorter ladder. It does not: DeepSeek documents `reasoning_effort` as low/high/max
37
+ * for V4 Flash as well, unscoped by model. Withholding it meant the DEFAULT model —
38
+ * the one most sessions run — silently could not reach its top reasoning setting.
39
+ *
40
+ * The ladder is identical for both, so it is built once. What differs between Flash
41
+ * and Pro is the size of the model underneath, not the settings it accepts.
42
+ */
43
+ export function thinkLevels(model) {
44
+ const standard = { label: "Standard", description: "answer directly — fastest", thinking: false, effort: "high" };
45
+ // The vision model is offered WITHOUT a reasoning ladder, and the omission is
46
+ // deliberate. DeepSeek's vision guide documents the request shape, the formats and
47
+ // the image budget, and says nothing at all about `reasoning_effort` on this id.
48
+ // This driver has already been bitten by assuming a rung exists: `xhigh` was
49
+ // advertised for a year, is not a value DeepSeek accepts, and so the setting had
50
+ // never once done anything. Advertising a level that may be rejected is worse than
51
+ // withholding one that turns out to work, because only the first breaks a request.
52
+ // Add the other two the moment the docs name them.
53
+ if (model === VISION)
54
+ return [standard];
55
+ return [
56
+ standard,
57
+ { label: "High", description: "think first, then answer", thinking: true, effort: "high" },
58
+ { label: "Maximum", description: "maximum reasoning budget", thinking: true, effort: "max" },
59
+ ];
60
+ }
61
+ // DeepSeek list prices (USD / 1M). Cache hits are ~1/10 of misses — the whole
62
+ // reason re-sent context stays cheap. `-pro` is estimated higher; correct it if
63
+ // needed. These are best-effort defaults a user can override without a rebuild.
64
+ const PRICES = {
65
+ [FLASH]: { cacheHit: 0.014, cacheMiss: 0.14, output: 0.28 },
66
+ [PRO]: { cacheHit: 0.028, cacheMiss: 0.28, output: 0.56 },
67
+ // DeepSeek's price list gives vision exactly Flash's rates, so it is written as the
68
+ // same numbers rather than derived from them: if Flash's estimate is corrected one
69
+ // day, that is a judgment about Flash and should not silently move a second model.
70
+ [VISION]: { cacheHit: 0.014, cacheMiss: 0.14, output: 0.28 },
71
+ };
72
+ const DEFAULT_PRICE = PRICES[FLASH];
73
+ /** Cache-aware list price for a model, falling back to Flash's for unknown ids. */
74
+ export function price(model) {
75
+ return PRICES[model] ?? DEFAULT_PRICE;
76
+ }
77
+ /**
78
+ * The model's USABLE context window — where retrieval and attention stay reliable,
79
+ * not the raw storage cap. Both models store 1M tokens (native pretraining, not a
80
+ * RoPE-extended stretch), but V4 runs hybrid sparse attention (CSA at 4x KV
81
+ * compression alternating with HCA at 128x), and compression is where accuracy
82
+ * leaks at range.
83
+ *
84
+ * The number that matters for an agent is MULTI-needle retrieval, not single: a
85
+ * coding session recalls many scattered facts (files read, decisions made, which
86
+ * command failed), which is the multi-needle shape. That is also V4's weakest
87
+ * axis — its single-to-multi drop at 1M is the largest in the field.
88
+ *
89
+ * Published V4-Pro figures (NIAH-2 / MRCR):
90
+ * 200K single 96% multi-8 84%
91
+ * 256K multi-8 ~0.82 ← still flat
92
+ * 1M single 78% multi-8 41% ← cliff
93
+ *
94
+ * So Pro anchors at 256K: the top of the demonstrated flat region. Past it the
95
+ * evidence thins to a single bad endpoint, and on BYOK the user pays for every
96
+ * token we let the transcript grow into.
97
+ */
98
+ const PRO_WINDOW = 256_000;
99
+ /**
100
+ * Flash gets its own, lower value rather than inheriting Pro's curve.
101
+ *
102
+ * Flash is 284B with 13B active against Pro's 1.6T/49B, and there is NO published
103
+ * multi-needle data for it at any length. The one datapoint (100% single-needle
104
+ * NIAH at 435K) is the easy axis and says nothing about the axis we care about.
105
+ * 192K is a deliberate judgment call under absent data: clearly above the old
106
+ * shared 128K, clearly inside Pro's proven-flat region, and revisable the moment
107
+ * someone publishes a Flash multi-needle curve.
108
+ */
109
+ const FLASH_WINDOW = 192_000;
110
+ export function contextWindow(model) {
111
+ // Vision anchors to Flash. DeepSeek documents the same 1M store for all three and
112
+ // states its pure-text ability is on par with Flash, so the sharp-window judgment
113
+ // made for Flash is the one that applies; inventing a separate number for a model
114
+ // with no published multi-needle curve of its own would be a guess wearing a
115
+ // decimal point.
116
+ return model === PRO ? PRO_WINDOW : FLASH_WINDOW;
117
+ }
118
+ /**
119
+ * Only the vision model takes image input, and only since 2026-08-21.
120
+ *
121
+ * This used to be absent entirely, with a comment recording that as a fact rather
122
+ * than an oversight. It is now true of exactly one id, so the check is by id and not
123
+ * by provider: pointing an image at Flash or Pro still degrades before anything is
124
+ * sent, which is what core does with a false answer here.
125
+ */
126
+ export function acceptsImages(model) {
127
+ return model === VISION;
128
+ }
129
+ /**
130
+ * Coerce a stored or unknown config onto a model this driver actually serves, and
131
+ * keep the reasoning intent valid. DeepSeek accepts three of the five shared effort
132
+ * rungs (`low`, `high`, `max`), so anything else clamps to `high`.
133
+ *
134
+ * No model-scoped step-down any more: both models take the same three rungs, so
135
+ * switching between them preserves the user's reasoning choice instead of quietly
136
+ * demoting it. See thinkLevels for why the old Pro-only Maximum was wrong.
137
+ */
138
+ export function normalize(config) {
139
+ // Three ids now, so this can no longer be "PRO or else FLASH": that shape would
140
+ // have quietly rewritten a vision selection back to Flash, and the user would have
141
+ // watched their chosen model change itself with no message.
142
+ const model = config.model === PRO ? PRO : config.model === VISION ? VISION : FLASH;
143
+ // Thinking is forced off on vision for the reason thinkLevels gives none: the flag
144
+ // is undocumented there, and this is the gate that stops a config saved on another
145
+ // model carrying one in.
146
+ const thinking = model === VISION ? false : config.thinking === true;
147
+ // Anything outside DeepSeek's accepted set becomes `high`. That covers a config
148
+ // saved by an older build (which stored `xhigh`) and a rung belonging to another
149
+ // provider. `max` is accepted on BOTH models and is no longer stepped down.
150
+ const effort = ACCEPTED_EFFORTS.has(config.effort) ? config.effort : "high";
151
+ return { model, thinking, effort };
152
+ }
153
+ /** The cheap metadata half of this driver — see `index.ts` for the wire half. */
154
+ export const deepseekManifest = {
155
+ id: "deepseek",
156
+ label: "DeepSeek",
157
+ apiKeyEnv: "DEEPSEEK_API_KEY",
158
+ keysUrl: "https://platform.deepseek.com/api_keys",
159
+ models: MODELS,
160
+ thinkLevels,
161
+ price,
162
+ contextWindow,
163
+ acceptsImages,
164
+ normalize,
165
+ };
166
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"man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C1B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CAAC,MAAmB;IAC3C,gFAAgF;IAChF,mFAAmF;IACnF,4DAA4D;IAC5D,MAAM,KAAK,GAAY,MAAM,CAAC,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;IAC7F,mFAAmF;IACnF,mFAAmF;IACnF,yBAAyB;IACzB,MAAM,QAAQ,GAAG,KAAK,KAAK,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,KAAK,IAAI,CAAC;IACrE,gFAAgF;IAChF,iFAAiF;IACjF,4EAA4E;IAC5E,MAAM,MAAM,GAAW,gBAAgB,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC;IACpF,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AACrC,CAAC;AAED,iFAAiF;AACjF,MAAM,CAAC,MAAM,gBAAgB,GAAmB;IAC9C,EAAE,EAAE,UAAU;IACd,KAAK,EAAE,UAAU;IACjB,SAAS,EAAE,kBAAkB;IAC7B,OAAO,EAAE,wCAAwC;IACjD,MAAM,EAAE,MAAM;IACd,WAAW;IACX,KAAK;IACL,aAAa;IACb,aAAa;IACb,SAAS;CACV,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { compatStreamTurn, compatToolTurn, standardCacheSplit } from "../openaiCompat/wire.js";
2
+ import { BUFFERED_OUTPUT_TOKENS, DEFAULT_MODEL } from "./manifest.js";
3
+ const BASE_URL = process.env.MINDWEAVE_GEMINI_URL ?? "https://generativelanguage.googleapis.com/v1beta/openai";
4
+ /**
5
+ * Gemini's reasoning field.
6
+ *
7
+ * Google documents its OpenAI-compatible endpoint translating the standard
8
+ * `reasoning_effort` parameter onto its own `thinking_level` internally, so this
9
+ * is a bare pass-through rather than a renamed field like Qwen's or xAI's. Every
10
+ * model in this lineup always reasons (see the manifest header), so unlike xAI or
11
+ * DeepSeek there is no "send nothing, thinking is off" branch to guard here — an
12
+ * effort is always sent.
13
+ */
14
+ export function reasoningFields(config) {
15
+ return { reasoning_effort: config?.effort ?? "low" };
16
+ }
17
+ /** Gemini reports its cache hit the standard OpenAI-compatible way, the same
18
+ * shape Qwen, GLM, xAI, Mistral, Groq and Cerebras all return. */
19
+ export const cacheSplit = standardCacheSplit;
20
+ /** Everything the shared wire layer needs to talk to Gemini. */
21
+ export const geminiProvider = {
22
+ label: "Gemini",
23
+ baseUrl: BASE_URL,
24
+ apiKeyEnv: "GEMINI_API_KEY",
25
+ defaultModel: process.env.MINDWEAVE_MODEL ?? DEFAULT_MODEL,
26
+ reasoningFields,
27
+ cacheSplit,
28
+ bufferedMaxTokens: BUFFERED_OUTPUT_TOKENS,
29
+ };
30
+ /** Ask the model for one turn. */
31
+ export async function toolTurn(req, options = {}) {
32
+ return compatToolTurn(geminiProvider, req, options.signal);
33
+ }
34
+ /** Ask the model for one turn, streaming deltas to `options.onEvent`. */
35
+ export async function streamTurn(req, options = {}) {
36
+ return compatStreamTurn(geminiProvider, req, options.onEvent, options.signal);
37
+ }
38
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/drivers/gemini/client.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,kBAAkB,EAAuB,MAAM,yBAAyB,CAAC;AACpH,OAAO,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEtE,MAAM,QAAQ,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,yDAAyD,CAAC;AAE/G;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,MAA+B;IAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,EAAE,CAAC;AACvD,CAAC;AAED;mEACmE;AACnE,MAAM,CAAC,MAAM,UAAU,GAAG,kBAAkB,CAAC;AAE7C,gEAAgE;AAChE,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,KAAK,EAAE,QAAQ;IACf,OAAO,EAAE,QAAQ;IACjB,SAAS,EAAE,gBAAgB;IAC3B,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,aAAa;IAC1D,eAAe;IACf,UAAU;IACV,iBAAiB,EAAE,sBAAsB;CAC1C,CAAC;AAEF,kCAAkC;AAClC,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAiB,EAAE,UAAuB,EAAE;IACzE,OAAO,cAAc,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAiB,EAAE,UAAyB,EAAE;IAC7E,OAAO,gBAAgB,CAAC,cAAc,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAChF,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { streamTurn, toolTurn } from "./client.js";
2
+ import { geminiManifest } from "./manifest.js";
3
+ export const geminiDriver = { ...geminiManifest, toolTurn, streamTurn };
4
+ export default geminiDriver;
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drivers/gemini/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,CAAC,MAAM,YAAY,GAAW,EAAE,GAAG,cAAc,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAEhF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,150 @@
1
+ export const FLASH_37 = "gemini-3.7-flash";
2
+ export const PRO_31 = "gemini-3.1-pro-preview";
3
+ export const FLASH_LITE_35 = "gemini-3.5-flash-lite";
4
+ export const FLASH_36 = "gemini-3.6-flash";
5
+ export const FLASH_35 = "gemini-3.5-flash";
6
+ export const FLASH_LITE_31 = "gemini-3.1-flash-lite";
7
+ /** The model used when nothing is saved and no env override is set. */
8
+ export const DEFAULT_MODEL = FLASH_37;
9
+ /** The models offered by `/model`. First entry is this provider's default. */
10
+ export const MODELS = [
11
+ { id: FLASH_37, label: "Gemini 3.7 Flash", description: "the current flash model, built for coding — the default" },
12
+ { id: PRO_31, label: "Gemini 3.1 Pro", description: "the deepest reasoning tier, for the hardest problems" },
13
+ { id: FLASH_LITE_35, label: "Gemini 3.5 Flash-Lite", description: "cheap and quick, for high-volume work" },
14
+ { id: FLASH_36, label: "Gemini 3.6 Flash", description: "the previous flash generation" },
15
+ { id: FLASH_35, label: "Gemini 3.5 Flash", description: "older flash, stronger than its Lite sibling" },
16
+ { id: FLASH_LITE_31, label: "Gemini 3.1 Flash-Lite", description: "the cheapest model here" },
17
+ ];
18
+ /**
19
+ * The reasoning levels offered by `/think`.
20
+ *
21
+ * No off switch — see the file header. All three rungs are real settings a Gemini
22
+ * 3 model will run at, not a stub standing in for one that does not exist.
23
+ */
24
+ export function thinkLevels(_model) {
25
+ return [
26
+ { label: "Standard", description: "lighter reasoning budget — this model always reasons", thinking: true, effort: "low" },
27
+ { label: "Thinking", description: "more reasoning before answering", thinking: true, effort: "medium" },
28
+ { label: "Maximum", description: "maximum reasoning budget", thinking: true, effort: "high" },
29
+ ];
30
+ }
31
+ /**
32
+ * List prices (USD / 1M tokens), the ≤200K-token tier where one applies.
33
+ *
34
+ * Two of these carry a promotional rate that Google has stated ends 2026-12-31,
35
+ * after which Flash's input/output both double. Not modelled here — a rate that
36
+ * changes on a calendar date belongs in a review before that date, not a branch in
37
+ * this function guessing today's date against it.
38
+ */
39
+ const PRICES = {
40
+ [FLASH_37]: { cacheHit: 0.075, cacheMiss: 0.75, output: 3.75 },
41
+ [PRO_31]: { cacheHit: 0.2, cacheMiss: 2, output: 12 },
42
+ [FLASH_LITE_35]: { cacheHit: 0.03, cacheMiss: 0.3, output: 2.5 },
43
+ // 3.6 Flash carries the same promotional rate as 3.7 (both double on 2027-01-01);
44
+ // see the note above on why that date is not branched on here.
45
+ [FLASH_36]: { cacheHit: 0.075, cacheMiss: 0.75, output: 3.75 },
46
+ // 3.5 Flash is the odd one: it costs MORE than either newer Flash above, because
47
+ // those two are promotionally discounted and it is not. Listed as published rather
48
+ // than reordered to look tidy — the cost line has to match the bill, not intuition.
49
+ [FLASH_35]: { cacheHit: 0.15, cacheMiss: 1.5, output: 9 },
50
+ [FLASH_LITE_31]: { cacheHit: 0.025, cacheMiss: 0.25, output: 1.5 },
51
+ };
52
+ /**
53
+ * Whether this model has its OWN entry in the table above.
54
+ *
55
+ * Exists because `price()` cannot answer it: a model with no entry silently returns the
56
+ * default's rate, and when two models genuinely share a rate (3.7 and 3.6 Flash carry
57
+ * the same promotional price) comparing values cannot tell a real entry from a
58
+ * fallthrough. A model added to MODELS but forgotten in PRICES would then be costed as
59
+ * something else, wrongly and invisibly, in a figure shown to the user as money.
60
+ */
61
+ export function hasListedPrice(model) {
62
+ return Object.hasOwn(PRICES, model);
63
+ }
64
+ /** Cache-aware list price for a model, falling back to the default model's. */
65
+ export function price(model) {
66
+ return PRICES[model] ?? PRICES[DEFAULT_MODEL];
67
+ }
68
+ /**
69
+ * The model's USABLE context window.
70
+ *
71
+ * Gemini 3.1 Pro is billed in two tiers — the price table above is the ≤200K-token
72
+ * rate, and crossing that line DOUBLES the rate on the whole request, the same
73
+ * shape xAI's Grok 4.3 has. 128K keeps ordinary sessions clear of it, for the same
74
+ * reason and the same number as that driver.
75
+ *
76
+ * The two Flash models carry no such cliff; 200K is the ordinary ceiling this
77
+ * codebase uses elsewhere once a window is chosen for cost rather than storage —
78
+ * both models store far more, but the point of a usable window is what the user's
79
+ * money should still be paying to carry, not what the provider will hold.
80
+ */
81
+ export function contextWindow(model) {
82
+ return model === PRO_31 ? 128_000 : 200_000;
83
+ }
84
+ /**
85
+ * The ceiling this driver puts on a single BUFFERED (non-streaming) call. Core
86
+ * reserves exactly this much room below the window, and `client.ts` sends the same
87
+ * constant, so the request and the reservation cannot drift apart.
88
+ */
89
+ export const BUFFERED_OUTPUT_TOKENS = 8_000;
90
+ export function bufferedOutputTokens(_model) {
91
+ return BUFFERED_OUTPUT_TOKENS;
92
+ }
93
+ /**
94
+ * Vision is deliberately NOT declared, even though Gemini itself reads images
95
+ * fine. The shared OpenAI-compatible wire layer (`../openaiCompat/wire.ts`) never
96
+ * renders `ChatMessage.images` into the request body at all — only the two
97
+ * SDK-backed drivers (Anthropic, OpenAI) do that today. Declaring it here would
98
+ * mean core attaching bytes this path silently never sends. Add it once the shared
99
+ * layer carries image parts.
100
+ */
101
+ /** The effort rungs this provider accepts, weakest first — note the absent top two. */
102
+ const EFFORTS = ["low", "medium", "high"];
103
+ /**
104
+ * Coerce a stored or unknown config onto a model this provider actually serves.
105
+ *
106
+ * Thinking is forced true unconditionally — there is no model in this lineup for
107
+ * which it could legally be false — and the effort then snaps onto a rung
108
+ * `/think` actually lists, which is what keeps `xhigh`/`max` from another
109
+ * provider's config from ever reaching the wire.
110
+ */
111
+ export function normalize(config) {
112
+ const model = PRICES[config.model] ? config.model : DEFAULT_MODEL;
113
+ const effort = EFFORTS.includes(config.effort) ? config.effort : "low";
114
+ return { model, thinking: true, effort: snapToOfferedRung(model, effort) };
115
+ }
116
+ /**
117
+ * Move an effort onto the nearest rung this model's `/think` ladder offers. Ties
118
+ * break DOWNWARD: an unlisted setting resolves to the cheaper neighbour, because
119
+ * silently spending more of the user's money is the worse way to be wrong.
120
+ */
121
+ function snapToOfferedRung(model, effort) {
122
+ const ladder = ["low", "medium", "high", "xhigh", "max"];
123
+ const offered = thinkLevels(model);
124
+ if (offered.some((l) => l.effort === effort))
125
+ return effort;
126
+ const want = ladder.indexOf(effort);
127
+ let best = offered[0];
128
+ for (const level of offered) {
129
+ const d = Math.abs(ladder.indexOf(level.effort) - want);
130
+ const bestD = Math.abs(ladder.indexOf(best.effort) - want);
131
+ if (d < bestD || (d === bestD && ladder.indexOf(level.effort) < ladder.indexOf(best.effort))) {
132
+ best = level;
133
+ }
134
+ }
135
+ return best.effort;
136
+ }
137
+ /** The cheap metadata half of this driver — see `index.ts` for the wire half. */
138
+ export const geminiManifest = {
139
+ id: "gemini",
140
+ label: "Gemini",
141
+ apiKeyEnv: "GEMINI_API_KEY",
142
+ keysUrl: "https://aistudio.google.com/apikey",
143
+ models: MODELS,
144
+ thinkLevels,
145
+ price,
146
+ contextWindow,
147
+ bufferedOutputTokens,
148
+ normalize,
149
+ };
150
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/drivers/gemini/manifest.ts"],"names":[],"mappings":"AA4BA,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAC3C,MAAM,CAAC,MAAM,MAAM,GAAG,wBAAwB,CAAC;AAC/C,MAAM,CAAC,MAAM,aAAa,GAAG,uBAAuB,CAAC;AACrD,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAC3C,MAAM,CAAC,MAAM,QAAQ,GAAG,kBAAkB,CAAC;AAC3C,MAAM,CAAC,MAAM,aAAa,GAAG,uBAAuB,CAAC;AAErD,uEAAuE;AACvE,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;AAEtC,8EAA8E;AAC9E,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,EAAE,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,yDAAyD,EAAE;IACnH,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAA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