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.
- package/LICENSE +190 -0
- package/README.md +171 -14
- package/dist/alternator/chassis/cache.js +47 -0
- package/dist/alternator/chassis/cache.js.map +1 -0
- package/dist/alternator/chassis/domRefs.js +53 -0
- package/dist/alternator/chassis/domRefs.js.map +1 -0
- package/dist/alternator/chassis/extractWorker.js +65 -0
- package/dist/alternator/chassis/extractWorker.js.map +1 -0
- package/dist/alternator/chassis/graph.js +221 -0
- package/dist/alternator/chassis/graph.js.map +1 -0
- package/dist/alternator/chassis/index.js +463 -0
- package/dist/alternator/chassis/index.js.map +1 -0
- package/dist/alternator/chassis/isolation.js +336 -0
- package/dist/alternator/chassis/isolation.js.map +1 -0
- package/dist/alternator/chassis/langCases.js +69 -0
- package/dist/alternator/chassis/langCases.js.map +1 -0
- package/dist/alternator/chassis/lsp.js +469 -0
- package/dist/alternator/chassis/lsp.js.map +1 -0
- package/dist/alternator/chassis/markup.js +262 -0
- package/dist/alternator/chassis/markup.js.map +1 -0
- package/dist/alternator/chassis/provision.js +198 -0
- package/dist/alternator/chassis/provision.js.map +1 -0
- package/dist/alternator/chassis/rank.js +72 -0
- package/dist/alternator/chassis/rank.js.map +1 -0
- package/dist/alternator/chassis/servers.js +215 -0
- package/dist/alternator/chassis/servers.js.map +1 -0
- package/dist/alternator/chassis/treesitter.js +608 -0
- package/dist/alternator/chassis/treesitter.js.map +1 -0
- package/dist/alternator/chassis/types.js +24 -0
- package/dist/alternator/chassis/types.js.map +1 -0
- package/dist/alternator/lane.js +67 -0
- package/dist/alternator/lane.js.map +1 -0
- package/dist/cli/App.js +2586 -0
- package/dist/cli/App.js.map +1 -0
- package/dist/cli/altScreen.js +67 -0
- package/dist/cli/altScreen.js.map +1 -0
- package/dist/cli/approvalChannel.js +72 -0
- package/dist/cli/approvalChannel.js.map +1 -0
- package/dist/cli/attachments.js +188 -0
- package/dist/cli/attachments.js.map +1 -0
- package/dist/cli/bootstrap.js +279 -0
- package/dist/cli/bootstrap.js.map +1 -0
- package/dist/cli/chatAnchor.js +94 -0
- package/dist/cli/chatAnchor.js.map +1 -0
- package/dist/cli/commandArgs.js +79 -0
- package/dist/cli/commandArgs.js.map +1 -0
- package/dist/cli/commandRoute.js +78 -0
- package/dist/cli/commandRoute.js.map +1 -0
- package/dist/cli/compaction.js +69 -0
- package/dist/cli/compaction.js.map +1 -0
- package/dist/cli/components/ApprovalBox.js +100 -0
- package/dist/cli/components/ApprovalBox.js.map +1 -0
- package/dist/cli/components/BlockView.js +128 -0
- package/dist/cli/components/BlockView.js.map +1 -0
- package/dist/cli/components/FirstRunFrame.js +41 -0
- package/dist/cli/components/FirstRunFrame.js.map +1 -0
- package/dist/cli/components/KeyManager.js +197 -0
- package/dist/cli/components/KeyManager.js.map +1 -0
- package/dist/cli/components/KeySetup.js +125 -0
- package/dist/cli/components/KeySetup.js.map +1 -0
- package/dist/cli/components/MenuFrame.js +24 -0
- package/dist/cli/components/MenuFrame.js.map +1 -0
- package/dist/cli/components/Picker.js +82 -0
- package/dist/cli/components/Picker.js.map +1 -0
- package/dist/cli/components/PromptInput.js +509 -0
- package/dist/cli/components/PromptInput.js.map +1 -0
- package/dist/cli/components/SubagentView.js +86 -0
- package/dist/cli/components/SubagentView.js.map +1 -0
- package/dist/cli/components/ToolGroup.js +60 -0
- package/dist/cli/components/ToolGroup.js.map +1 -0
- package/dist/cli/components/ToolLine.js +123 -0
- package/dist/cli/components/ToolLine.js.map +1 -0
- package/dist/cli/components/TrustGate.js +37 -0
- package/dist/cli/components/TrustGate.js.map +1 -0
- package/dist/cli/costView.js +40 -0
- package/dist/cli/costView.js.map +1 -0
- package/dist/cli/frameRate.js +30 -0
- package/dist/cli/frameRate.js.map +1 -0
- package/dist/cli/framebuffer/paint.js +165 -0
- package/dist/cli/framebuffer/paint.js.map +1 -0
- package/dist/cli/framebuffer/parse.js +266 -0
- package/dist/cli/framebuffer/parse.js.map +1 -0
- package/dist/cli/framebuffer/screen.js +196 -0
- package/dist/cli/framebuffer/screen.js.map +1 -0
- package/dist/cli/framebuffer/writer.js +139 -0
- package/dist/cli/framebuffer/writer.js.map +1 -0
- package/dist/cli/groupReveal.js +51 -0
- package/dist/cli/groupReveal.js.map +1 -0
- package/dist/cli/help.js +55 -0
- package/dist/cli/help.js.map +1 -0
- package/dist/cli/inputView.js +105 -0
- package/dist/cli/inputView.js.map +1 -0
- package/dist/cli/keyManager.js +65 -0
- package/dist/cli/keyManager.js.map +1 -0
- package/dist/cli/keySetup.js +35 -0
- package/dist/cli/keySetup.js.map +1 -0
- package/dist/cli/keyStore.js +73 -0
- package/dist/cli/keyStore.js.map +1 -0
- package/dist/cli/markdown.js +460 -0
- package/dist/cli/markdown.js.map +1 -0
- package/dist/cli/messageQueue.js +96 -0
- package/dist/cli/messageQueue.js.map +1 -0
- package/dist/cli/modes.js +90 -0
- package/dist/cli/modes.js.map +1 -0
- package/dist/cli/mouse.js +78 -0
- package/dist/cli/mouse.js.map +1 -0
- package/dist/cli/pasteAssembler.js +44 -0
- package/dist/cli/pasteAssembler.js.map +1 -0
- package/dist/cli/pathComplete.js +39 -0
- package/dist/cli/pathComplete.js.map +1 -0
- package/dist/cli/perfLog.js +90 -0
- package/dist/cli/perfLog.js.map +1 -0
- package/dist/cli/reveal.js +32 -0
- package/dist/cli/reveal.js.map +1 -0
- package/dist/cli/revealPace.js +59 -0
- package/dist/cli/revealPace.js.map +1 -0
- package/dist/cli/sessionCarry.js +19 -0
- package/dist/cli/sessionCarry.js.map +1 -0
- package/dist/cli/smoothScroll.js +74 -0
- package/dist/cli/smoothScroll.js.map +1 -0
- package/dist/cli/startupArgs.js +96 -0
- package/dist/cli/startupArgs.js.map +1 -0
- package/dist/cli/terminalRestore.js +34 -0
- package/dist/cli/terminalRestore.js.map +1 -0
- package/dist/cli/toolDisplay.js +219 -0
- package/dist/cli/toolDisplay.js.map +1 -0
- package/dist/cli/toolItems.js +65 -0
- package/dist/cli/toolItems.js.map +1 -0
- package/dist/cli/transcript.js +351 -0
- package/dist/cli/transcript.js.map +1 -0
- package/dist/cli/trust.js +79 -0
- package/dist/cli/trust.js.map +1 -0
- package/dist/cli/updateCheck.js +107 -0
- package/dist/cli/updateCheck.js.map +1 -0
- package/dist/cli/version.js +39 -0
- package/dist/cli/version.js.map +1 -0
- package/dist/cli/viewport.js +179 -0
- package/dist/cli/viewport.js.map +1 -0
- package/dist/cli/virtualWindow.js +103 -0
- package/dist/cli/virtualWindow.js.map +1 -0
- package/dist/cli/workingVerb.js +37 -0
- package/dist/cli/workingVerb.js.map +1 -0
- package/dist/cli/wrap.js +145 -0
- package/dist/cli/wrap.js.map +1 -0
- package/dist/drivers/anthropic/cachePoints.js +77 -0
- package/dist/drivers/anthropic/cachePoints.js.map +1 -0
- package/dist/drivers/anthropic/client.js +432 -0
- package/dist/drivers/anthropic/client.js.map +1 -0
- package/dist/drivers/anthropic/index.js +10 -0
- package/dist/drivers/anthropic/index.js.map +1 -0
- package/dist/drivers/anthropic/manifest.js +221 -0
- package/dist/drivers/anthropic/manifest.js.map +1 -0
- package/dist/drivers/cerebras/client.js +69 -0
- package/dist/drivers/cerebras/client.js.map +1 -0
- package/dist/drivers/cerebras/index.js +5 -0
- package/dist/drivers/cerebras/index.js.map +1 -0
- package/dist/drivers/cerebras/manifest.js +140 -0
- package/dist/drivers/cerebras/manifest.js.map +1 -0
- package/dist/drivers/clientId.js +41 -0
- package/dist/drivers/clientId.js.map +1 -0
- package/dist/drivers/contextOverflow.js +77 -0
- package/dist/drivers/contextOverflow.js.map +1 -0
- package/dist/drivers/deepseek/client.js +168 -0
- package/dist/drivers/deepseek/client.js.map +1 -0
- package/dist/drivers/deepseek/index.js +16 -0
- package/dist/drivers/deepseek/index.js.map +1 -0
- package/dist/drivers/deepseek/inlineTools.js +46 -0
- package/dist/drivers/deepseek/inlineTools.js.map +1 -0
- package/dist/drivers/deepseek/manifest.js +166 -0
- package/dist/drivers/deepseek/manifest.js.map +1 -0
- package/dist/drivers/gemini/client.js +38 -0
- package/dist/drivers/gemini/client.js.map +1 -0
- package/dist/drivers/gemini/index.js +5 -0
- package/dist/drivers/gemini/index.js.map +1 -0
- package/dist/drivers/gemini/manifest.js +150 -0
- package/dist/drivers/gemini/manifest.js.map +1 -0
- package/dist/drivers/glm/client.js +90 -0
- package/dist/drivers/glm/client.js.map +1 -0
- package/dist/drivers/glm/index.js +9 -0
- package/dist/drivers/glm/index.js.map +1 -0
- package/dist/drivers/glm/manifest.js +183 -0
- package/dist/drivers/glm/manifest.js.map +1 -0
- package/dist/drivers/groq/client.js +80 -0
- package/dist/drivers/groq/client.js.map +1 -0
- package/dist/drivers/groq/index.js +5 -0
- package/dist/drivers/groq/index.js.map +1 -0
- package/dist/drivers/groq/manifest.js +160 -0
- package/dist/drivers/groq/manifest.js.map +1 -0
- package/dist/drivers/kimi/client.js +82 -0
- package/dist/drivers/kimi/client.js.map +1 -0
- package/dist/drivers/kimi/index.js +9 -0
- package/dist/drivers/kimi/index.js.map +1 -0
- package/dist/drivers/kimi/manifest.js +168 -0
- package/dist/drivers/kimi/manifest.js.map +1 -0
- package/dist/drivers/meta/client.js +30 -0
- package/dist/drivers/meta/client.js.map +1 -0
- package/dist/drivers/meta/index.js +5 -0
- package/dist/drivers/meta/index.js.map +1 -0
- package/dist/drivers/meta/manifest.js +101 -0
- package/dist/drivers/meta/manifest.js.map +1 -0
- package/dist/drivers/minimax/client.js +36 -0
- package/dist/drivers/minimax/client.js.map +1 -0
- package/dist/drivers/minimax/index.js +5 -0
- package/dist/drivers/minimax/index.js.map +1 -0
- package/dist/drivers/minimax/manifest.js +120 -0
- package/dist/drivers/minimax/manifest.js.map +1 -0
- package/dist/drivers/mistral/client.js +54 -0
- package/dist/drivers/mistral/client.js.map +1 -0
- package/dist/drivers/mistral/index.js +5 -0
- package/dist/drivers/mistral/index.js.map +1 -0
- package/dist/drivers/mistral/manifest.js +118 -0
- package/dist/drivers/mistral/manifest.js.map +1 -0
- package/dist/drivers/openai/client.js +290 -0
- package/dist/drivers/openai/client.js.map +1 -0
- package/dist/drivers/openai/index.js +9 -0
- package/dist/drivers/openai/index.js.map +1 -0
- package/dist/drivers/openai/manifest.js +133 -0
- package/dist/drivers/openai/manifest.js.map +1 -0
- package/dist/drivers/openaiCompat/wire.js +493 -0
- package/dist/drivers/openaiCompat/wire.js.map +1 -0
- package/dist/drivers/partialTurn.js +23 -0
- package/dist/drivers/partialTurn.js.map +1 -0
- package/dist/drivers/providerError.js +181 -0
- package/dist/drivers/providerError.js.map +1 -0
- package/dist/drivers/qwen/client.js +93 -0
- package/dist/drivers/qwen/client.js.map +1 -0
- package/dist/drivers/qwen/index.js +9 -0
- package/dist/drivers/qwen/index.js.map +1 -0
- package/dist/drivers/qwen/manifest.js +146 -0
- package/dist/drivers/qwen/manifest.js.map +1 -0
- package/dist/drivers/registry.js +177 -0
- package/dist/drivers/registry.js.map +1 -0
- package/dist/drivers/retryPolicy.js +129 -0
- package/dist/drivers/retryPolicy.js.map +1 -0
- package/dist/drivers/searchBlocks.js +61 -0
- package/dist/drivers/searchBlocks.js.map +1 -0
- package/dist/drivers/types.js +2 -0
- package/dist/drivers/types.js.map +1 -0
- package/dist/drivers/xai/client.js +63 -0
- package/dist/drivers/xai/client.js.map +1 -0
- package/dist/drivers/xai/index.js +5 -0
- package/dist/drivers/xai/index.js.map +1 -0
- package/dist/drivers/xai/manifest.js +137 -0
- package/dist/drivers/xai/manifest.js.map +1 -0
- package/dist/dynamo/_probe.tmp.js +20 -0
- package/dist/dynamo/_probe.tmp.js.map +1 -0
- package/dist/dynamo/cacheBreak.js +88 -0
- package/dist/dynamo/cacheBreak.js.map +1 -0
- package/dist/dynamo/contextWindow.js +243 -0
- package/dist/dynamo/contextWindow.js.map +1 -0
- package/dist/dynamo/engine.js +2011 -0
- package/dist/dynamo/engine.js.map +1 -0
- package/dist/dynamo/guard.js +132 -0
- package/dist/dynamo/guard.js.map +1 -0
- package/dist/dynamo/liveMeter.js +58 -0
- package/dist/dynamo/liveMeter.js.map +1 -0
- package/dist/dynamo/model.js +172 -0
- package/dist/dynamo/model.js.map +1 -0
- package/dist/dynamo/planArtifact.js +125 -0
- package/dist/dynamo/planArtifact.js.map +1 -0
- package/dist/dynamo/pricing.js +140 -0
- package/dist/dynamo/pricing.js.map +1 -0
- package/dist/dynamo/prompt.js +264 -0
- package/dist/dynamo/prompt.js.map +1 -0
- package/dist/dynamo/spend.js +45 -0
- package/dist/dynamo/spend.js.map +1 -0
- package/dist/dynamo/verify.js +483 -0
- package/dist/dynamo/verify.js.map +1 -0
- package/dist/governor/forbidden.js +181 -0
- package/dist/governor/forbidden.js.map +1 -0
- package/dist/governor/freshness.js +83 -0
- package/dist/governor/freshness.js.map +1 -0
- package/dist/governor/frontmatter.js +38 -0
- package/dist/governor/frontmatter.js.map +1 -0
- package/dist/governor/glob.js +75 -0
- package/dist/governor/glob.js.map +1 -0
- package/dist/governor/index.js +87 -0
- package/dist/governor/index.js.map +1 -0
- package/dist/governor/rules.js +80 -0
- package/dist/governor/rules.js.map +1 -0
- package/dist/governor/scope.js +91 -0
- package/dist/governor/scope.js.map +1 -0
- package/dist/governor/skills.js +176 -0
- package/dist/governor/skills.js.map +1 -0
- package/dist/governor/types.js +16 -0
- package/dist/governor/types.js.map +1 -0
- package/dist/governor/write.js +182 -0
- package/dist/governor/write.js.map +1 -0
- package/dist/index.js +89 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/catalog.js +232 -0
- package/dist/mcp/catalog.js.map +1 -0
- package/dist/mcp/config.js +116 -0
- package/dist/mcp/config.js.map +1 -0
- package/dist/mcp/configWrite.js +254 -0
- package/dist/mcp/configWrite.js.map +1 -0
- package/dist/mcp/connection.js +504 -0
- package/dist/mcp/connection.js.map +1 -0
- package/dist/mcp/deferred.js +104 -0
- package/dist/mcp/deferred.js.map +1 -0
- package/dist/mcp/discover.js +128 -0
- package/dist/mcp/discover.js.map +1 -0
- package/dist/mcp/manager.js +679 -0
- package/dist/mcp/manager.js.map +1 -0
- package/dist/mcp/paramHeaders.js +163 -0
- package/dist/mcp/paramHeaders.js.map +1 -0
- package/dist/mcp/prompts.js +136 -0
- package/dist/mcp/prompts.js.map +1 -0
- package/dist/mcp/protocol.js +171 -0
- package/dist/mcp/protocol.js.map +1 -0
- package/dist/mcp/resources.js +119 -0
- package/dist/mcp/resources.js.map +1 -0
- package/dist/mcp/resultStore.js +180 -0
- package/dist/mcp/resultStore.js.map +1 -0
- package/dist/mcp/subscriptions.js +74 -0
- package/dist/mcp/subscriptions.js.map +1 -0
- package/dist/mcp/transport/headerValue.js +40 -0
- package/dist/mcp/transport/headerValue.js.map +1 -0
- package/dist/mcp/transport/http.js +321 -0
- package/dist/mcp/transport/http.js.map +1 -0
- package/dist/mcp/transport/stdio.js +234 -0
- package/dist/mcp/transport/stdio.js.map +1 -0
- package/dist/mcp/transport/types.js +27 -0
- package/dist/mcp/transport/types.js.map +1 -0
- package/dist/mcp/trust.js +98 -0
- package/dist/mcp/trust.js.map +1 -0
- package/dist/mcp/trustStore.js +55 -0
- package/dist/mcp/trustStore.js.map +1 -0
- package/dist/memory/autoMemory.js +340 -0
- package/dist/memory/autoMemory.js.map +1 -0
- package/dist/memory/compaction.js +513 -0
- package/dist/memory/compaction.js.map +1 -0
- package/dist/memory/images.js +173 -0
- package/dist/memory/images.js.map +1 -0
- package/dist/memory/presence.js +59 -0
- package/dist/memory/presence.js.map +1 -0
- package/dist/memory/projectNotes.js +247 -0
- package/dist/memory/projectNotes.js.map +1 -0
- package/dist/memory/restore.js +72 -0
- package/dist/memory/restore.js.map +1 -0
- package/dist/memory/session.js +472 -0
- package/dist/memory/session.js.map +1 -0
- package/dist/memory/sessionMemory.js +142 -0
- package/dist/memory/sessionMemory.js.map +1 -0
- package/dist/memory/sessionMemoryCompact.js +136 -0
- package/dist/memory/sessionMemoryCompact.js.map +1 -0
- package/dist/memory/store.js +217 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/memory/types.js +14 -0
- package/dist/memory/types.js.map +1 -0
- package/dist/memory/workingSet.js +383 -0
- package/dist/memory/workingSet.js.map +1 -0
- package/dist/project/context.js +425 -0
- package/dist/project/context.js.map +1 -0
- package/dist/tools/approval.js +189 -0
- package/dist/tools/approval.js.map +1 -0
- package/dist/tools/askUser.js +103 -0
- package/dist/tools/askUser.js.map +1 -0
- package/dist/tools/atomicWrite.js +151 -0
- package/dist/tools/atomicWrite.js.map +1 -0
- package/dist/tools/backgroundShells.js +468 -0
- package/dist/tools/backgroundShells.js.map +1 -0
- package/dist/tools/captureSweep.js +77 -0
- package/dist/tools/captureSweep.js.map +1 -0
- package/dist/tools/chassisMux.js +92 -0
- package/dist/tools/chassisMux.js.map +1 -0
- package/dist/tools/checkpoints.js +328 -0
- package/dist/tools/checkpoints.js.map +1 -0
- package/dist/tools/codeIntel.js +267 -0
- package/dist/tools/codeIntel.js.map +1 -0
- package/dist/tools/deferredNative.js +121 -0
- package/dist/tools/deferredNative.js.map +1 -0
- package/dist/tools/detail.js +135 -0
- package/dist/tools/detail.js.map +1 -0
- package/dist/tools/diagnostics.js +174 -0
- package/dist/tools/diagnostics.js.map +1 -0
- package/dist/tools/edit.js +167 -0
- package/dist/tools/edit.js.map +1 -0
- package/dist/tools/editCore.js +283 -0
- package/dist/tools/editCore.js.map +1 -0
- package/dist/tools/editFile.js +183 -0
- package/dist/tools/editFile.js.map +1 -0
- package/dist/tools/editRipple.js +126 -0
- package/dist/tools/editRipple.js.map +1 -0
- package/dist/tools/editTarget.js +131 -0
- package/dist/tools/editTarget.js.map +1 -0
- package/dist/tools/editWindow.js +49 -0
- package/dist/tools/editWindow.js.map +1 -0
- package/dist/tools/eol.js +56 -0
- package/dist/tools/eol.js.map +1 -0
- package/dist/tools/exitPlan.js +175 -0
- package/dist/tools/exitPlan.js.map +1 -0
- package/dist/tools/focus.js +42 -0
- package/dist/tools/focus.js.map +1 -0
- package/dist/tools/gitignore.js +148 -0
- package/dist/tools/gitignore.js.map +1 -0
- package/dist/tools/glob.js +134 -0
- package/dist/tools/glob.js.map +1 -0
- package/dist/tools/governorTools.js +258 -0
- package/dist/tools/governorTools.js.map +1 -0
- package/dist/tools/grep.js +450 -0
- package/dist/tools/grep.js.map +1 -0
- package/dist/tools/guard.js +220 -0
- package/dist/tools/guard.js.map +1 -0
- package/dist/tools/killTree.js +215 -0
- package/dist/tools/killTree.js.map +1 -0
- package/dist/tools/listDir.js +143 -0
- package/dist/tools/listDir.js.map +1 -0
- package/dist/tools/mcpAdd.js +176 -0
- package/dist/tools/mcpAdd.js.map +1 -0
- package/dist/tools/mcpResources.js +116 -0
- package/dist/tools/mcpResources.js.map +1 -0
- package/dist/tools/mcpSearch.js +123 -0
- package/dist/tools/mcpSearch.js.map +1 -0
- package/dist/tools/multiEdit.js +168 -0
- package/dist/tools/multiEdit.js.map +1 -0
- package/dist/tools/paths.js +225 -0
- package/dist/tools/paths.js.map +1 -0
- package/dist/tools/posixShell.js +123 -0
- package/dist/tools/posixShell.js.map +1 -0
- package/dist/tools/readFile.js +371 -0
- package/dist/tools/readFile.js.map +1 -0
- package/dist/tools/readSymbol.js +145 -0
- package/dist/tools/readSymbol.js.map +1 -0
- package/dist/tools/registry.js +120 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/replaceSymbol.js +141 -0
- package/dist/tools/replaceSymbol.js.map +1 -0
- package/dist/tools/results.js +15 -0
- package/dist/tools/results.js.map +1 -0
- package/dist/tools/ripgrep.js +145 -0
- package/dist/tools/ripgrep.js.map +1 -0
- package/dist/tools/runCommand.js +633 -0
- package/dist/tools/runCommand.js.map +1 -0
- package/dist/tools/saveMemory.js +102 -0
- package/dist/tools/saveMemory.js.map +1 -0
- package/dist/tools/screenshot.js +200 -0
- package/dist/tools/screenshot.js.map +1 -0
- package/dist/tools/screenshotWin.js +227 -0
- package/dist/tools/screenshotWin.js.map +1 -0
- package/dist/tools/search.js +121 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/tools/sessionTools.js +187 -0
- package/dist/tools/sessionTools.js.map +1 -0
- package/dist/tools/shellCheckpoint.js +123 -0
- package/dist/tools/shellCheckpoint.js.map +1 -0
- package/dist/tools/shellLint.js +102 -0
- package/dist/tools/shellLint.js.map +1 -0
- package/dist/tools/shellTools.js +203 -0
- package/dist/tools/shellTools.js.map +1 -0
- package/dist/tools/spanCore.js +78 -0
- package/dist/tools/spanCore.js.map +1 -0
- package/dist/tools/subagent.js +224 -0
- package/dist/tools/subagent.js.map +1 -0
- package/dist/tools/subagentReport.js +114 -0
- package/dist/tools/subagentReport.js.map +1 -0
- package/dist/tools/tempSweep.js +118 -0
- package/dist/tools/tempSweep.js.map +1 -0
- package/dist/tools/todo.js +117 -0
- package/dist/tools/todo.js.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/untrusted.js +46 -0
- package/dist/tools/untrusted.js.map +1 -0
- package/dist/tools/useSkill.js +62 -0
- package/dist/tools/useSkill.js.map +1 -0
- package/dist/tools/walk.js +152 -0
- package/dist/tools/walk.js.map +1 -0
- package/dist/tools/web.js +61 -0
- package/dist/tools/web.js.map +1 -0
- package/dist/tools/webFetch.js +444 -0
- package/dist/tools/webFetch.js.map +1 -0
- package/dist/tools/webSearch.js +130 -0
- package/dist/tools/webSearch.js.map +1 -0
- package/dist/tools/workspace.js +212 -0
- package/dist/tools/workspace.js.map +1 -0
- package/dist/tools/workspaceDiscover.js +216 -0
- package/dist/tools/workspaceDiscover.js.map +1 -0
- package/dist/tools/writeFile.js +162 -0
- package/dist/tools/writeFile.js.map +1 -0
- package/package.json +74 -28
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
export const FABLE = "claude-fable-5";
|
|
2
|
+
export const OPUS = "claude-opus-5";
|
|
3
|
+
export const OPUS_48 = "claude-opus-4-8";
|
|
4
|
+
export const SONNET = "claude-sonnet-5";
|
|
5
|
+
export const HAIKU = "claude-haiku-4-5";
|
|
6
|
+
/** The model used when nothing is saved and no env override is set. */
|
|
7
|
+
export const DEFAULT_MODEL = SONNET;
|
|
8
|
+
/**
|
|
9
|
+
* The models offered by `/model`. First entry is this provider's default, which is
|
|
10
|
+
* also where `/provider` lands when someone switches to Anthropic.
|
|
11
|
+
*
|
|
12
|
+
* Descriptions say what the model is FOR, not what it scores. Someone reading the
|
|
13
|
+
* picker is choosing between five things they are about to pay for, and the useful
|
|
14
|
+
* distinction is the kind of work each one earns its rate on.
|
|
15
|
+
*/
|
|
16
|
+
export const MODELS = [
|
|
17
|
+
{ id: SONNET, label: "Claude Sonnet 5", description: "fast, strong at code — the default" },
|
|
18
|
+
{ id: OPUS, label: "Claude Opus 5", description: "deep reasoning for long, complex work" },
|
|
19
|
+
{ id: OPUS_48, label: "Claude Opus 4.8", description: "the previous Opus — proven and steady" },
|
|
20
|
+
{ id: FABLE, label: "Claude Fable 5", description: "the toughest challenges, at the highest rate" },
|
|
21
|
+
{ id: HAIKU, label: "Claude Haiku 4.5", description: "cheapest and quickest, for simple work" },
|
|
22
|
+
];
|
|
23
|
+
const CURRENT = {
|
|
24
|
+
canDisableThinking: true,
|
|
25
|
+
takesEffort: true,
|
|
26
|
+
maxDisabledEffort: null,
|
|
27
|
+
// Every model on this surface STORES 1M tokens, but this is deliberately the
|
|
28
|
+
// sharp window rather than the storage cap: on BYOK every token in the window is
|
|
29
|
+
// the user's money on every turn, so anchoring compaction at 1M would mean
|
|
30
|
+
// carrying an enormous prompt long after it stopped earning its cost.
|
|
31
|
+
window: 200_000,
|
|
32
|
+
searchTool: "web_search_20260209",
|
|
33
|
+
};
|
|
34
|
+
const SURFACES = {
|
|
35
|
+
// Thinking is always on and any explicit `thinking` config is rejected — see
|
|
36
|
+
// `client.ts`, which omits the field entirely for this model.
|
|
37
|
+
[FABLE]: { ...CURRENT, canDisableThinking: false },
|
|
38
|
+
// Thinking may be turned off, but only at effort `high` or below.
|
|
39
|
+
[OPUS]: { ...CURRENT, maxDisabledEffort: "high" },
|
|
40
|
+
[OPUS_48]: { ...CURRENT },
|
|
41
|
+
[SONNET]: { ...CURRENT },
|
|
42
|
+
// The legacy surface. No `effort` rungs, thinking is a token budget, and the
|
|
43
|
+
// window here is the model's real maximum rather than a judgment call — Haiku
|
|
44
|
+
// stores 200K, it does not store 1M.
|
|
45
|
+
[HAIKU]: {
|
|
46
|
+
canDisableThinking: true,
|
|
47
|
+
takesEffort: false,
|
|
48
|
+
maxDisabledEffort: null,
|
|
49
|
+
window: 200_000,
|
|
50
|
+
searchTool: "web_search_20250305",
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
/** The surface a model runs on, falling back to the default model's for unknown ids. */
|
|
54
|
+
export function surfaceOf(model) {
|
|
55
|
+
return SURFACES[model] ?? SURFACES[DEFAULT_MODEL];
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The reasoning levels offered by `/think`, which depend on the model's surface.
|
|
59
|
+
*
|
|
60
|
+
* Three shapes, one per surface rule:
|
|
61
|
+
*
|
|
62
|
+
* - Fable 5 has no "answer directly" rung at all, because there is no such
|
|
63
|
+
* request to make. Offering one would be a switch that silently did nothing —
|
|
64
|
+
* or, worse, a 400. The choice on this model is only how much it thinks.
|
|
65
|
+
* - Haiku 4.5 has no effort ladder, so it gets the plain on/off pair. The stored
|
|
66
|
+
* `effort` is inert for it and `normalize` pins it so nothing odd persists.
|
|
67
|
+
* - The rest get the full four rungs.
|
|
68
|
+
*
|
|
69
|
+
* The current-surface "Standard" deliberately pairs no-thinking with `high` rather
|
|
70
|
+
* than a lower rung: on Opus 5 thinking may only be turned off at effort `high` or
|
|
71
|
+
* below, so this is the one setting that keeps a no-thinking request legal on every
|
|
72
|
+
* model that offers it.
|
|
73
|
+
*/
|
|
74
|
+
export function thinkLevels(model) {
|
|
75
|
+
const surface = surfaceOf(model);
|
|
76
|
+
if (!surface.canDisableThinking) {
|
|
77
|
+
return [
|
|
78
|
+
{ label: "Standard", description: "always thinks — lighter budget", thinking: true, effort: "medium" },
|
|
79
|
+
{ label: "Thinking", description: "think first, then answer", thinking: true, effort: "high" },
|
|
80
|
+
{ label: "Deep", description: "more reasoning, more tool work", thinking: true, effort: "xhigh" },
|
|
81
|
+
{ label: "Maximum", description: "maximum reasoning budget", thinking: true, effort: "max" },
|
|
82
|
+
];
|
|
83
|
+
}
|
|
84
|
+
if (!surface.takesEffort) {
|
|
85
|
+
return [
|
|
86
|
+
{ label: "Standard", description: "answer directly — fastest", thinking: false, effort: "high" },
|
|
87
|
+
{ label: "Thinking", description: "think first, then answer", thinking: true, effort: "high" },
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
return [
|
|
91
|
+
{ label: "Standard", description: "answer directly — fastest", thinking: false, effort: "high" },
|
|
92
|
+
{ label: "Thinking", description: "think first, then answer", thinking: true, effort: "high" },
|
|
93
|
+
{ label: "Deep", description: "more reasoning, more tool work", thinking: true, effort: "xhigh" },
|
|
94
|
+
{ label: "Maximum", description: "maximum reasoning budget", thinking: true, effort: "max" },
|
|
95
|
+
];
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* List prices (USD / 1M tokens). Cache reads are ~1/10 of fresh input, which is
|
|
99
|
+
* what keeps a re-sent conversation cheap. Sonnet is running an introductory rate
|
|
100
|
+
* below this through 2026-08-31; the durable list price is used here so the
|
|
101
|
+
* estimate doesn't start under-reporting the moment that ends.
|
|
102
|
+
*/
|
|
103
|
+
/** Anthropic bills a 5-minute cache WRITE at 1.25x base input — the tokens are both
|
|
104
|
+
* processed and stored. (The 1h TTL is 2x; Mindweave does not buy it.) Folding writes
|
|
105
|
+
* into the plain input rate under-reported every turn of an agentic loop, which writes
|
|
106
|
+
* a new prefix segment constantly. */
|
|
107
|
+
const CACHE_WRITE_MULTIPLIER = 1.25;
|
|
108
|
+
const PRICES = {
|
|
109
|
+
[FABLE]: { cacheHit: 1, cacheMiss: 10, output: 50, cacheWrite: 10 * CACHE_WRITE_MULTIPLIER },
|
|
110
|
+
[OPUS]: { cacheHit: 0.5, cacheMiss: 5, output: 25, cacheWrite: 5 * CACHE_WRITE_MULTIPLIER },
|
|
111
|
+
[OPUS_48]: { cacheHit: 0.5, cacheMiss: 5, output: 25, cacheWrite: 5 * CACHE_WRITE_MULTIPLIER },
|
|
112
|
+
[SONNET]: { cacheHit: 0.3, cacheMiss: 3, output: 15, cacheWrite: 3 * CACHE_WRITE_MULTIPLIER },
|
|
113
|
+
[HAIKU]: { cacheHit: 0.1, cacheMiss: 1, output: 5, cacheWrite: 1 * CACHE_WRITE_MULTIPLIER },
|
|
114
|
+
};
|
|
115
|
+
/** Cache-aware list price for a model, falling back to the default model's. */
|
|
116
|
+
export function price(model) {
|
|
117
|
+
return PRICES[model] ?? PRICES[DEFAULT_MODEL];
|
|
118
|
+
}
|
|
119
|
+
/** The model's USABLE context window — see `ModelSurface.window`. */
|
|
120
|
+
export function contextWindow(model) {
|
|
121
|
+
return surfaceOf(model).window;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* The ceiling this driver puts on a single buffered (non-streaming) call.
|
|
125
|
+
*
|
|
126
|
+
* Every model here accepts far more, but a non-streaming request that runs long
|
|
127
|
+
* risks an HTTP timeout, so the buffered path — core's small internal calls, like
|
|
128
|
+
* a compaction summary — is deliberately capped low. `client.ts` sends this value
|
|
129
|
+
* and `dynamo/contextWindow.ts` reserves it; keeping one exported constant means
|
|
130
|
+
* the request and the reservation cannot drift apart.
|
|
131
|
+
*
|
|
132
|
+
* The streaming ceiling is a separate, much larger number and lives in `client.ts`,
|
|
133
|
+
* because nothing in core needs to reserve room for it.
|
|
134
|
+
*/
|
|
135
|
+
export const BUFFERED_OUTPUT_TOKENS = 16_000;
|
|
136
|
+
export function bufferedOutputTokens(_model) {
|
|
137
|
+
return BUFFERED_OUTPUT_TOKENS;
|
|
138
|
+
}
|
|
139
|
+
/** Effort rungs the current surface accepts, weakest first. */
|
|
140
|
+
const EFFORTS = ["low", "medium", "high", "xhigh", "max"];
|
|
141
|
+
/**
|
|
142
|
+
* Every model offered here reads images. Anthropic accepts JPEG, PNG, GIF and WebP,
|
|
143
|
+
* and downscales anything oversized itself, so this driver takes what core sends and
|
|
144
|
+
* adds no resizing of its own.
|
|
145
|
+
*/
|
|
146
|
+
export function acceptsImages(_model) {
|
|
147
|
+
return true;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Coerce a stored or unknown config onto a model this provider actually serves, and
|
|
151
|
+
* keep the reasoning intent legal for it.
|
|
152
|
+
*
|
|
153
|
+
* Four corrections. The first three enforce rules the API would otherwise reject:
|
|
154
|
+
* - Fable 5 always thinks, so a no-thinking config becomes a thinking one.
|
|
155
|
+
* - Haiku 4.5 takes no effort rung, so the stored value is pinned to `high`
|
|
156
|
+
* (inert for it, and the rung every other model treats as the safe default).
|
|
157
|
+
* - Opus 5 rejects no-thinking above `high`, so such a config steps its effort
|
|
158
|
+
* down rather than reaching the wire.
|
|
159
|
+
*
|
|
160
|
+
* The fourth is about the UI rather than the wire: the result is snapped onto a
|
|
161
|
+
* rung the target model's `/think` ladder actually OFFERS. A legal-but-unlisted
|
|
162
|
+
* setting is the failure this catches — Fable's lightest rung is `medium`, which
|
|
163
|
+
* every current-surface model accepts happily, so carrying it to Sonnet produced a
|
|
164
|
+
* config that worked but that `/think` could not show as selected, leaving the user
|
|
165
|
+
* in a state with no tick beside it and no way to name what they were running.
|
|
166
|
+
*
|
|
167
|
+
* All four matter most on a MODEL SWITCH: `/model` carries the current reasoning
|
|
168
|
+
* intent across, so every level of every model has to land somewhere real on every
|
|
169
|
+
* other model.
|
|
170
|
+
*/
|
|
171
|
+
export function normalize(config) {
|
|
172
|
+
const model = SURFACES[config.model] ? config.model : DEFAULT_MODEL;
|
|
173
|
+
const surface = surfaceOf(model);
|
|
174
|
+
const thinking = surface.canDisableThinking ? config.thinking === true : true;
|
|
175
|
+
let effort = EFFORTS.includes(config.effort) ? config.effort : "high";
|
|
176
|
+
if (!surface.takesEffort)
|
|
177
|
+
effort = "high";
|
|
178
|
+
const cap = surface.maxDisabledEffort;
|
|
179
|
+
if (!thinking && cap && EFFORTS.indexOf(effort) > EFFORTS.indexOf(cap))
|
|
180
|
+
effort = cap;
|
|
181
|
+
return { model, thinking, effort: snapToOfferedRung(model, thinking, effort) };
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Move an effort onto the nearest rung this model's `/think` ladder offers.
|
|
185
|
+
*
|
|
186
|
+
* Ties break DOWNWARD: an unlisted setting resolves to the cheaper neighbour, never
|
|
187
|
+
* the dearer one, because silently spending more of the user's money than the level
|
|
188
|
+
* they were on is the worse of the two ways to be wrong.
|
|
189
|
+
*/
|
|
190
|
+
function snapToOfferedRung(model, thinking, effort) {
|
|
191
|
+
const offered = thinkLevels(model).filter((l) => l.thinking === thinking);
|
|
192
|
+
if (offered.length === 0)
|
|
193
|
+
return effort;
|
|
194
|
+
if (offered.some((l) => l.effort === effort))
|
|
195
|
+
return effort;
|
|
196
|
+
const want = EFFORTS.indexOf(effort);
|
|
197
|
+
let best = offered[0];
|
|
198
|
+
for (const level of offered) {
|
|
199
|
+
const d = Math.abs(EFFORTS.indexOf(level.effort) - want);
|
|
200
|
+
const bestD = Math.abs(EFFORTS.indexOf(best.effort) - want);
|
|
201
|
+
if (d < bestD || (d === bestD && EFFORTS.indexOf(level.effort) < EFFORTS.indexOf(best.effort))) {
|
|
202
|
+
best = level;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return best.effort;
|
|
206
|
+
}
|
|
207
|
+
/** The cheap metadata half of this driver — see `index.ts` for the wire half. */
|
|
208
|
+
export const anthropicManifest = {
|
|
209
|
+
id: "anthropic",
|
|
210
|
+
label: "Anthropic",
|
|
211
|
+
apiKeyEnv: "ANTHROPIC_API_KEY",
|
|
212
|
+
keysUrl: "https://console.anthropic.com/settings/keys",
|
|
213
|
+
models: MODELS,
|
|
214
|
+
thinkLevels,
|
|
215
|
+
price,
|
|
216
|
+
contextWindow,
|
|
217
|
+
bufferedOutputTokens,
|
|
218
|
+
acceptsImages,
|
|
219
|
+
normalize,
|
|
220
|
+
};
|
|
221
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/drivers/anthropic/manifest.ts"],"names":[],"mappings":"AAyBA,MAAM,CAAC,MAAM,KAAK,GAAG,gBAAgB,CAAC;AACtC,MAAM,CAAC,MAAM,IAAI,GAAG,eAAe,CAAC;AACpC,MAAM,CAAC,MAAM,OAAO,GAAG,iBAAiB,CAAC;AACzC,MAAM,CAAC,MAAM,MAAM,GAAG,iBAAiB,CAAC;AACxC,MAAM,CAAC,MAAM,KAAK,GAAG,kBAAkB,CAAC;AAExC,uEAAuE;AACvE,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC;AAEpC;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,oCAAoC,EAAE;IAC3F,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,eAAe,EAAE,WAAW,EAAE,uCAAuC,EAAE;IAC1F,EAAE,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,uCAAuC,EAAE;IAC/F,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,8CAA8C,EAAE;IACnG,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,kBAAkB,EAAE,WAAW,EAAE,wCAAwC,EAAE;CAChG,CAAC;AAyBF,MAAM,OAAO,GAAG;IACd,kBAAkB,EAAE,IAAI;IACxB,WAAW,EAAE,IAAI;IACjB,iBAAiB,EAAE,IAAI;IACvB,6EAA6E;IAC7E,iFAAiF;IACjF,2EAA2E;IAC3E,sEAAsE;IACtE,MAAM,EAAE,OAAO;IACf,UAAU,EAAE,qBAAqB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E,OAAO,MAAM,CAAC;IAE5D,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrC,IAAI,IAAI,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC;IACvB,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QACzD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC;QAC5D,IAAI,CAAC,GAAG,KAAK,IAAI,CAAC,CAAC,KAAK,KAAK,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC;YAC/F,IAAI,GAAG,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC;AAED,iFAAiF;AACjF,MAAM,CAAC,MAAM,iBAAiB,GAAmB;IAC/C,EAAE,EAAE,WAAW;IACf,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,mBAAmB;IAC9B,OAAO,EAAE,6CAA6C;IACtD,MAAM,EAAE,MAAM;IACd,WAAW;IACX,KAAK;IACL,aAAa;IACb,oBAAoB;IACpB,aAAa;IACb,SAAS;CACV,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { compatStreamTurn, compatToolTurn, listModels, standardCacheSplit } from "../openaiCompat/wire.js";
|
|
2
|
+
import { BUFFERED_OUTPUT_TOKENS, DEFAULT_MODEL, takesEffort } from "./manifest.js";
|
|
3
|
+
const BASE_URL = process.env.MINDWEAVE_CEREBRAS_URL ?? "https://api.cerebras.ai/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
|
+
* Cerebras's reasoning fields.
|
|
10
|
+
*
|
|
11
|
+
* Collapsed to two states rather than forwarding the shared effort rung. The models
|
|
12
|
+
* here come from several vendors whose effort vocabularies differ, and this driver
|
|
13
|
+
* cannot tell from a discovered id which one applies — so it sends the values every
|
|
14
|
+
* one of them accepts instead of a rung that works on some and is rejected by others.
|
|
15
|
+
*/
|
|
16
|
+
export function reasoningFields(config) {
|
|
17
|
+
if (!takesEffort(modelOf(config)))
|
|
18
|
+
return {};
|
|
19
|
+
return { reasoning_effort: config?.thinking ? "default" : "none" };
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Turn Cerebras's live catalogue into picker entries.
|
|
23
|
+
*
|
|
24
|
+
* No context window is reported by this endpoint, so entries carry no size hint —
|
|
25
|
+
* saying "128K context" here would be repeating this driver's own conservative
|
|
26
|
+
* default back to the user as though the provider had stated it.
|
|
27
|
+
*/
|
|
28
|
+
export function toChoices(listed) {
|
|
29
|
+
return listed
|
|
30
|
+
.filter((m) => !/whisper|tts|guard|embed/i.test(m.id))
|
|
31
|
+
.map((m) => ({ id: m.id, label: m.id, description: "served on Cerebras" }))
|
|
32
|
+
.sort((a, b) => a.id.localeCompare(b.id));
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Fetch the models Cerebras is serving right now.
|
|
36
|
+
*
|
|
37
|
+
* Throws when the key is missing or the request fails, which is the contract the
|
|
38
|
+
* registry relies on: a throw keeps the previous list, an empty array replaces it.
|
|
39
|
+
*/
|
|
40
|
+
export async function discoverModels() {
|
|
41
|
+
return toChoices(await listModels(cerebrasProvider));
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Cerebras caches automatically, and the split is read for the TOKEN COUNT rather
|
|
45
|
+
* than for the price: unlike every other provider here, it bills cached input at the
|
|
46
|
+
* full standard rate, so the caching buys latency and nothing else. The manifest's
|
|
47
|
+
* prices reflect that (no discount); this hook exists so a multi-step turn does not
|
|
48
|
+
* report every step's whole prompt as fresh, which is a count, not a bill.
|
|
49
|
+
*
|
|
50
|
+
* No `extraStop`: the finish reasons are the plain OpenAI set.
|
|
51
|
+
*/
|
|
52
|
+
export const cerebrasProvider = {
|
|
53
|
+
label: "Cerebras",
|
|
54
|
+
baseUrl: BASE_URL,
|
|
55
|
+
apiKeyEnv: "CEREBRAS_API_KEY",
|
|
56
|
+
defaultModel: process.env.MINDWEAVE_MODEL ?? DEFAULT_MODEL,
|
|
57
|
+
reasoningFields,
|
|
58
|
+
cacheSplit: standardCacheSplit,
|
|
59
|
+
bufferedMaxTokens: BUFFERED_OUTPUT_TOKENS,
|
|
60
|
+
};
|
|
61
|
+
/** Ask the model for one turn. */
|
|
62
|
+
export async function toolTurn(req, options = {}) {
|
|
63
|
+
return compatToolTurn(cerebrasProvider, req, options.signal);
|
|
64
|
+
}
|
|
65
|
+
/** Ask the model for one turn, streaming deltas to `options.onEvent`. */
|
|
66
|
+
export async function streamTurn(req, options = {}) {
|
|
67
|
+
return compatStreamTurn(cerebrasProvider, req, options.onEvent, options.signal);
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../../src/drivers/cerebras/client.ts"],"names":[],"mappings":"AAgBA,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,sBAAsB,IAAI,4BAA4B,CAAC;AAEpF,6EAA6E;AAC7E,SAAS,OAA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,kBAAkB;IAC9B,iBAAiB,EAAE,sBAAsB;CAC1C,CAAC;AAEF,kCAAkC;AAClC,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,GAAiB,EAAE,UAAuB,EAAE;IACzE,OAAO,cAAc,CAAC,gBAAgB,EAAE,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/D,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,GAAiB,EAAE,UAAyB,EAAE;IAC7E,OAAO,gBAAgB,CAAC,gBAAgB,EAAE,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAClF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/drivers/cerebras/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,CAAC,MAAM,cAAc,GAAW,EAAE,GAAG,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;AAEpF,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A minimal fallback list, shown only before discovery has run or when it fails.
|
|
3
|
+
* Short on purpose: a fallback naming a withdrawn model is worse than one naming
|
|
4
|
+
* two that work. The live list replaces this entirely.
|
|
5
|
+
*/
|
|
6
|
+
export const MODELS = [
|
|
7
|
+
{ id: "gpt-oss-120b", label: "GPT-OSS 120B", description: "open weights, with a reasoning dial" },
|
|
8
|
+
{ id: "zai-glm-4.7", label: "GLM 4.7", description: "served on Cerebras, very fast" },
|
|
9
|
+
];
|
|
10
|
+
/** The model used when nothing is saved and no env override is set. */
|
|
11
|
+
export const DEFAULT_MODEL = MODELS[0].id;
|
|
12
|
+
/**
|
|
13
|
+
* Models known to accept `reasoning_effort`, matched by SUBSTRING rather than exact
|
|
14
|
+
* id — the discovered ids carry vendor prefixes and size suffixes that vary, so an
|
|
15
|
+
* exact table would go stale for the same reason the model list does. A false
|
|
16
|
+
* negative costs a reasoning dial; a false positive costs a rejected request, so the
|
|
17
|
+
* list stays narrow.
|
|
18
|
+
*/
|
|
19
|
+
const EFFORT_MODELS = ["gpt-oss", "qwen3", "glm"];
|
|
20
|
+
export function takesEffort(model) {
|
|
21
|
+
const id = model.toLowerCase();
|
|
22
|
+
return EFFORT_MODELS.some((fragment) => id.includes(fragment));
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The reasoning levels offered by `/think`.
|
|
26
|
+
*
|
|
27
|
+
* Two states rather than a graded ladder. The models served here come from several
|
|
28
|
+
* vendors with different effort vocabularies, and this driver does not know which
|
|
29
|
+
* one a discovered id belongs to — so it offers the states every one of them
|
|
30
|
+
* accepts, instead of a rung that works on some and 400s on others.
|
|
31
|
+
*/
|
|
32
|
+
export function thinkLevels(model) {
|
|
33
|
+
if (takesEffort(model)) {
|
|
34
|
+
return [
|
|
35
|
+
{ label: "Standard", description: "answer directly — fastest", thinking: false, effort: "low" },
|
|
36
|
+
{ label: "Thinking", description: "think first, then answer", thinking: true, effort: "high" },
|
|
37
|
+
];
|
|
38
|
+
}
|
|
39
|
+
return [{ label: "Standard", description: "this model has no reasoning dial", thinking: false, effort: "low" }];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* List prices (USD / 1M tokens), for the models whose rates are published.
|
|
43
|
+
*
|
|
44
|
+
* A discovered lineup cannot have a complete table by definition. The fallback is
|
|
45
|
+
* the cheapest plausible rate rather than an average, for the same reason as Groq's:
|
|
46
|
+
* this provider serves open models cheaply, so guessing high would make an
|
|
47
|
+
* inexpensive session look alarming.
|
|
48
|
+
*
|
|
49
|
+
* `cacheHit` deliberately EQUALS `cacheMiss` throughout, and that is a fact rather
|
|
50
|
+
* than an unfinished table: Cerebras bills cached input at the standard rate, so its
|
|
51
|
+
* prompt caching buys latency and no money. It is the one provider here where a
|
|
52
|
+
* cache discount would be invented.
|
|
53
|
+
*/
|
|
54
|
+
const PRICES = [
|
|
55
|
+
["gpt-oss-120b", { cacheHit: 0.25, cacheMiss: 0.25, output: 0.69 }],
|
|
56
|
+
["glm-4.7", { cacheHit: 0.6, cacheMiss: 0.6, output: 2.2 }],
|
|
57
|
+
["qwen3", { cacheHit: 0.29, cacheMiss: 0.29, output: 0.59 }],
|
|
58
|
+
];
|
|
59
|
+
const UNKNOWN_PRICE = { cacheHit: 0.25, cacheMiss: 0.25, output: 0.69 };
|
|
60
|
+
export function price(model) {
|
|
61
|
+
const id = model.toLowerCase();
|
|
62
|
+
return PRICES.find(([fragment]) => id.includes(fragment))?.[1] ?? UNKNOWN_PRICE;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* The model's USABLE context window. A single conservative figure, because the
|
|
66
|
+
* listing reports no per-model size and the open models served here vary widely.
|
|
67
|
+
* Under-stating costs some usable context; over-stating lets a transcript grow past
|
|
68
|
+
* what the model can attend to, which is the worse failure.
|
|
69
|
+
*/
|
|
70
|
+
export function contextWindow(_model) {
|
|
71
|
+
return 128_000;
|
|
72
|
+
}
|
|
73
|
+
/** The ceiling this driver puts on a single BUFFERED call. */
|
|
74
|
+
export const BUFFERED_OUTPUT_TOKENS = 8_000;
|
|
75
|
+
export function bufferedOutputTokens(_model) {
|
|
76
|
+
return BUFFERED_OUTPUT_TOKENS;
|
|
77
|
+
}
|
|
78
|
+
const EFFORTS = ["low", "medium", "high", "xhigh", "max"];
|
|
79
|
+
/**
|
|
80
|
+
* Coerce a stored config onto something serveable.
|
|
81
|
+
*
|
|
82
|
+
* As with Groq, an unknown model id is KEPT rather than coerced. A discovered
|
|
83
|
+
* provider's list is empty until it is asked, and rewriting the user's saved model
|
|
84
|
+
* in that window would silently change their choice on every launch.
|
|
85
|
+
*/
|
|
86
|
+
export function normalize(config) {
|
|
87
|
+
const model = config.model || DEFAULT_MODEL;
|
|
88
|
+
const thinking = takesEffort(model) ? config.thinking === true : false;
|
|
89
|
+
const effort = EFFORTS.includes(config.effort) ? config.effort : "low";
|
|
90
|
+
return { model, thinking, effort: snapToOfferedRung(model, thinking, effort) };
|
|
91
|
+
}
|
|
92
|
+
/** Move an effort onto the nearest rung this model's ladder offers, ties downward. */
|
|
93
|
+
function snapToOfferedRung(model, thinking, effort) {
|
|
94
|
+
const offered = thinkLevels(model).filter((l) => l.thinking === thinking);
|
|
95
|
+
if (offered.length === 0)
|
|
96
|
+
return thinkLevels(model)[0].effort;
|
|
97
|
+
if (offered.some((l) => l.effort === effort))
|
|
98
|
+
return effort;
|
|
99
|
+
const want = EFFORTS.indexOf(effort);
|
|
100
|
+
let best = offered[0];
|
|
101
|
+
for (const level of offered) {
|
|
102
|
+
const d = Math.abs(EFFORTS.indexOf(level.effort) - want);
|
|
103
|
+
const bestD = Math.abs(EFFORTS.indexOf(best.effort) - want);
|
|
104
|
+
if (d < bestD || (d === bestD && EFFORTS.indexOf(level.effort) < EFFORTS.indexOf(best.effort)))
|
|
105
|
+
best = level;
|
|
106
|
+
}
|
|
107
|
+
return best.effort;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Recognise a Cerebras model id without a list.
|
|
111
|
+
*
|
|
112
|
+
* Narrower than Groq's on purpose. Both providers serve overlapping open models, so
|
|
113
|
+
* a broad claim here would let Cerebras capture ids Groq also serves, and whichever
|
|
114
|
+
* provider happened to be earlier in the registry would win — a coin toss deciding
|
|
115
|
+
* which endpoint a saved model runs against. Only the `zai-` prefix is distinctive
|
|
116
|
+
* to this catalogue; everything else is left to the real lists.
|
|
117
|
+
*
|
|
118
|
+
* The consequence, stated rather than hidden: a saved Cerebras model with a shared
|
|
119
|
+
* id resolves correctly only once discovery has run, which it does at session start.
|
|
120
|
+
*/
|
|
121
|
+
export function ownsModel(model) {
|
|
122
|
+
return model.toLowerCase().startsWith("zai-");
|
|
123
|
+
}
|
|
124
|
+
/** The cheap metadata half of this driver — see `index.ts` for the wire half. */
|
|
125
|
+
export const cerebrasManifest = {
|
|
126
|
+
id: "cerebras",
|
|
127
|
+
label: "Cerebras",
|
|
128
|
+
apiKeyEnv: "CEREBRAS_API_KEY",
|
|
129
|
+
keysUrl: "https://cloud.cerebras.ai/",
|
|
130
|
+
models: MODELS,
|
|
131
|
+
thinkLevels,
|
|
132
|
+
price,
|
|
133
|
+
contextWindow,
|
|
134
|
+
bufferedOutputTokens,
|
|
135
|
+
normalize,
|
|
136
|
+
ownsModel,
|
|
137
|
+
/** Imported inside the function so this module loads no wire code — see Groq's. */
|
|
138
|
+
discoverModels: async () => (await import("./client.js")).discoverModels(),
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=manifest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/drivers/cerebras/manifest.ts"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,MAAM,CAAC,MAAM,MAAM,GAAkB;IACnC,EAAE,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,qCAAqC,EAAE;IACjG,EAAE,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,+BAA+B,EAAE;CACtF,CAAC;AAEF,uEAAuE;AACvE,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,CAAC,CAAE,CAAC,EAAE,CAAC;AAE3C;;;;;;GAMG;AACH,MAAM,aAAa,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAElD,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,C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EAAE,CAAC,CAAC,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc,EAAE;CAC3E,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* clientId.ts — the identifying string Mindweave sends with every provider
|
|
3
|
+
* request.
|
|
4
|
+
*
|
|
5
|
+
* Every provider logs the `User-Agent` (or equivalent) header on inbound
|
|
6
|
+
* requests for its own analytics, rate-limit tiers, and abuse review — the same
|
|
7
|
+
* way Cursor, Cline, Aider and every other terminal coding agent identify
|
|
8
|
+
* themselves rather than looking like a bare SDK call. This is that string, sent
|
|
9
|
+
* consistently from every driver so Mindweave's traffic reads as Mindweave's
|
|
10
|
+
* traffic wherever a provider looks.
|
|
11
|
+
*
|
|
12
|
+
* Deliberately self-contained rather than importing `cli/version.ts` — a driver
|
|
13
|
+
* may import nothing from outside `drivers/` except `types.js` (see the header of
|
|
14
|
+
* that file), and this constant is exactly the kind of core-adjacent thing that
|
|
15
|
+
* boundary exists to keep out. So the same safe, degrade-to-nothing read is
|
|
16
|
+
* duplicated here in miniature rather than the boundary being bent for it.
|
|
17
|
+
*/
|
|
18
|
+
import { readFileSync } from "node:fs";
|
|
19
|
+
import { fileURLToPath } from "node:url";
|
|
20
|
+
import { dirname, join } from "node:path";
|
|
21
|
+
let cached = null;
|
|
22
|
+
/** `mindweave/1.9.9 (mwcode)`, or `mindweave (mwcode)` if the version can't be
|
|
23
|
+
* read — never throws, never blocks a request on a missing package.json. */
|
|
24
|
+
export function clientId() {
|
|
25
|
+
if (cached !== null)
|
|
26
|
+
return cached;
|
|
27
|
+
let version = "";
|
|
28
|
+
try {
|
|
29
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
30
|
+
const pkg = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
|
|
31
|
+
if (typeof pkg.version === "string")
|
|
32
|
+
version = pkg.version;
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
// No package.json (or it's malformed) — identify without a version rather
|
|
36
|
+
// than fail a request over it.
|
|
37
|
+
}
|
|
38
|
+
cached = version ? `mindweave/${version} (mwcode)` : "mindweave (mwcode)";
|
|
39
|
+
return cached;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=clientId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clientId.js","sourceRoot":"","sources":["../../src/drivers/clientId.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,IAAI,MAAM,GAAkB,IAAI,CAAC;AAEjC;6EAC6E;AAC7E,MAAM,UAAU,QAAQ;IACtB,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IACnC,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;QACvE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAA0B,CAAC;QAClG,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;YAAE,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IAC7D,CAAC;IAAC,MAAM,CAAC;QACP,0EAA0E;QAC1E,+BAA+B;IACjC,CAAC;IACD,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,aAAa,OAAO,WAAW,CAAC,CAAC,CAAC,oBAAoB,CAAC;IAC1E,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* contextOverflow.ts — telling "this conversation no longer fits" apart from
|
|
3
|
+
* "we sent something broken".
|
|
4
|
+
*
|
|
5
|
+
* A provider can refuse an over-long request two ways, and only one of them was
|
|
6
|
+
* handled. Some report it as a FINISH REASON on an otherwise successful response
|
|
7
|
+
* (`model_context_window_exceeded`), which the drivers already map to the `overflow`
|
|
8
|
+
* stop and the engine already recovers from by shedding its oldest rounds. Most
|
|
9
|
+
* providers instead REJECT the request outright with a 400, and that path had no
|
|
10
|
+
* recovery at all: `providerError.ts` classifies a 400 as a malformed request, our
|
|
11
|
+
* bug, deliberately loud — so a conversation that had merely grown too long ended the
|
|
12
|
+
* turn with a red error, after the user had already paid for the refused call.
|
|
13
|
+
*
|
|
14
|
+
* That classification stays exactly as it is for every other 400. This is the same
|
|
15
|
+
* kind of narrow reprieve the balance-phrase carve-out is: it answers one prior
|
|
16
|
+
* question, "is this refusal about LENGTH", and answers it from the provider's own
|
|
17
|
+
* sentence rather than from a status code that cannot distinguish it.
|
|
18
|
+
*
|
|
19
|
+
* WHICH DIRECTION THIS SHOULD FAIL. A miss costs a dead turn. A false positive costs
|
|
20
|
+
* the oldest rounds of a conversation and one retry, and if the request was never
|
|
21
|
+
* really too long the retry fails again and the real error surfaces then. So the
|
|
22
|
+
* phrase list leans towards matching, and the recovery it triggers is capped at once
|
|
23
|
+
* per turn precisely so a wrong guess cannot loop.
|
|
24
|
+
*/
|
|
25
|
+
import { detailOf, providerMessage, statusOf } from "./providerError.js";
|
|
26
|
+
/**
|
|
27
|
+
* Statuses that can carry a length refusal.
|
|
28
|
+
*
|
|
29
|
+
* 400 is where almost every provider puts it. 413 is the literal "payload too large",
|
|
30
|
+
* which a gateway in front of a provider may return instead. 422 covers the handful
|
|
31
|
+
* that treat an over-long prompt as a validation failure. A 5xx is the provider
|
|
32
|
+
* falling over and a 401/402/403/429 is the account, and neither becomes recoverable
|
|
33
|
+
* by dropping history, so both are excluded rather than left to the phrase match.
|
|
34
|
+
*/
|
|
35
|
+
const OVERFLOW_STATUSES = new Set([400, 413, 422]);
|
|
36
|
+
/**
|
|
37
|
+
* How the providers in the lineup word it. Lower-cased substrings, checked against
|
|
38
|
+
* the provider's own sentence.
|
|
39
|
+
*
|
|
40
|
+
* Every entry here is about SIZE and nothing else, which is what keeps this from
|
|
41
|
+
* quietly widening into "any 400 we felt like retrying". `context_length_exceeded` is
|
|
42
|
+
* OpenAI's machine-readable code rather than prose, and is matched because it travels
|
|
43
|
+
* in the same body.
|
|
44
|
+
*/
|
|
45
|
+
const OVERFLOW_PHRASES = [
|
|
46
|
+
"context length",
|
|
47
|
+
"context window",
|
|
48
|
+
"context_length_exceeded",
|
|
49
|
+
"maximum context",
|
|
50
|
+
"prompt is too long",
|
|
51
|
+
"too many tokens",
|
|
52
|
+
"input token count",
|
|
53
|
+
"token count exceeds",
|
|
54
|
+
"exceeds the maximum number of tokens",
|
|
55
|
+
"reduce the length of the messages",
|
|
56
|
+
"request too large",
|
|
57
|
+
];
|
|
58
|
+
/**
|
|
59
|
+
* Did the provider refuse this request because the conversation no longer fits (pure)?
|
|
60
|
+
*
|
|
61
|
+
* An error with no status at all is still examined: SDK wrappers do not always expose
|
|
62
|
+
* one, and a sentence that plainly says the prompt was too long means the same thing
|
|
63
|
+
* whether or not the number survived the trip.
|
|
64
|
+
*/
|
|
65
|
+
export function isContextOverflowError(error) {
|
|
66
|
+
const status = statusOf(error);
|
|
67
|
+
if (status !== null && !OVERFLOW_STATUSES.has(status))
|
|
68
|
+
return false;
|
|
69
|
+
const detail = detailOf(error);
|
|
70
|
+
// The provider's own sentence when one can be extracted, and the raw body when it
|
|
71
|
+
// cannot — a phrase this specific is not going to match the surrounding JSON by
|
|
72
|
+
// accident, and insisting on a parsed message would miss every provider that sends
|
|
73
|
+
// plain text.
|
|
74
|
+
const text = `${providerMessage(detail)}\n${detail}`.toLowerCase();
|
|
75
|
+
return OVERFLOW_PHRASES.some((phrase) => text.includes(phrase));
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=contextOverflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contextOverflow.js","sourceRoot":"","sources":["../../src/drivers/contextOverflow.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAEzE;;;;;;;;GAQG;AACH,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC;AAEnD;;;;;;;;GAQG;AACH,MAAM,gBAAgB,GAAG;IACvB,gBAAgB;IAChB,gBAAgB;IAChB,yBAAyB;IACzB,iBAAiB;IACjB,oBAAoB;IACpB,iBAAiB;IACjB,mBAAmB;IACnB,qBAAqB;IACrB,sCAAsC;IACtC,mCAAmC;IACnC,mBAAmB;CACpB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAc;IACnD,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,MAAM,KAAK,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,MAAM,CAAC;QAAE,OAAO,KAAK,CAAC;IAEpE,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC/B,kFAAkF;IAClF,gFAAgF;IAChF,mFAAmF;IACnF,cAAc;IACd,MAAM,IAAI,GAAG,GAAG,eAAe,CAAC,MAAM,CAAC,KAAK,MAAM,EAAE,CAAC,WAAW,EAAE,CAAC;IACnE,OAAO,gBAAgB,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAClE,CAAC"}
|