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 @@
|
|
|
1
|
+
{"version":3,"file":"chassisMux.js","sourceRoot":"","sources":["../../src/tools/chassisMux.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGjD,OAAO,EAAE,SAAS,EAAiB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AC,WAAW,CAAC,EAAE,CAAC;AAC7D,CAAC;AAED;qFACqF;AACrF,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,GAAgB,EAChB,IAAY,EACZ,OAAyC,EAAE;IAE3C,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACjC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC,CAAC,CAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACxD,MAAM,KAAK,GAAiB,EAAE,CAAC;IAC/B,KAAK,MAAM,EAAE,IAAI,IAAI;QAAE,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAClE,OAAO,KAAK,CAAC;AACf,CAAC;AAED;kCACkC;AAClC,SAAS,OAAO,CAAC,OAAgB;IAC/B,MAAM,CAAC,GAAI,OAA0C,CAAC,QAAQ,EAAE,EAAE,CAAC;IACnE,OAAO,CAAC,YAAY,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3C,CAAC"}
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* checkpoints.ts — a per-turn undo net for file edits.
|
|
3
|
+
*
|
|
4
|
+
* Recoverability without git: whenever a mutating tool is about to change a file,
|
|
5
|
+
* it first hands the file's ORIGINAL bytes here (once per file per turn — the
|
|
6
|
+
* first touch wins, so we keep the true pre-turn state) along with the bytes it is
|
|
7
|
+
* ABOUT TO WRITE (last write wins — that is the state we expect to find on disk).
|
|
8
|
+
* At the end of a turn the engine `seal`s those into one restorable checkpoint.
|
|
9
|
+
* `/undo` then rolls the last turn's file changes back.
|
|
10
|
+
*
|
|
11
|
+
* It's deliberately a shadow-copy in memory (bounded stack), not a shadow git
|
|
12
|
+
* repo: cheap, dependency-free, and it works even when the project isn't a git
|
|
13
|
+
* repo at all. Client-side state (holds file bytes), like the background shells —
|
|
14
|
+
* absent in bare contexts, in which case edits simply aren't checkpointed.
|
|
15
|
+
*
|
|
16
|
+
* FOUR RULES THIS FILE EXISTS TO KEEP, all learned the hard way:
|
|
17
|
+
*
|
|
18
|
+
* 1. **Never destroy work we did not do.** If a file no longer matches what we
|
|
19
|
+
* wrote, somebody else changed it — the user, their editor, another process.
|
|
20
|
+
* Restoring would silently overwrite that. We report it and leave it alone.
|
|
21
|
+
* 2. **A failed restore must stay retryable, but not forever.** The checkpoint is
|
|
22
|
+
* retired once every file settles — or once retrying stops being useful. Popping
|
|
23
|
+
* first and restoring after loses the checkpoint to one locked file; never
|
|
24
|
+
* retiring pins that checkpoint at the top and walls off every older turn.
|
|
25
|
+
* 3. **Never say more than we did.** Anything `run_command` changed is invisible
|
|
26
|
+
* here, and a file too large to hold is not covered either. Both are reported
|
|
27
|
+
* rather than quietly folded into "the turn was undone".
|
|
28
|
+
* 4. **Bounded in bytes, not just in turns.** Twenty checkpoints of large files is
|
|
29
|
+
* hundreds of megabytes resident. The count bound never was the real limit.
|
|
30
|
+
*/
|
|
31
|
+
import { promises as fs } from "node:fs";
|
|
32
|
+
import { writeFileAtomic } from "./atomicWrite.js";
|
|
33
|
+
/**
|
|
34
|
+
* Per-file ceiling on what we will hold. We keep two copies of every checkpointed
|
|
35
|
+
* file (the original, to restore; what we wrote, to detect someone else's edit), so
|
|
36
|
+
* the real cost is double. A source file past this size is not something anyone is
|
|
37
|
+
* hand-editing, and holding it would crowd out every ordinary file behind it.
|
|
38
|
+
*/
|
|
39
|
+
const MAX_FILE_BYTES = 4 * 1024 * 1024;
|
|
40
|
+
/**
|
|
41
|
+
* Ceiling across the whole stack. Oldest checkpoints are evicted first when a new
|
|
42
|
+
* one pushes past it — except that the most recent checkpoint is always kept, even
|
|
43
|
+
* if it alone exceeds the budget. Undoing the last turn is the case that matters;
|
|
44
|
+
* leaving a user with no undo at all to satisfy a memory bound is the wrong trade.
|
|
45
|
+
*/
|
|
46
|
+
const MAX_TOTAL_BYTES = 32 * 1024 * 1024;
|
|
47
|
+
/**
|
|
48
|
+
* How many times `/undo` re-tries a checkpoint that had files it could not write.
|
|
49
|
+
*
|
|
50
|
+
* Keeping a failed file for a retry is right — a lock from an editor or a dev server
|
|
51
|
+
* usually clears. Keeping it FOREVER is not: a file that never becomes writable would
|
|
52
|
+
* pin its checkpoint at the top of the stack permanently, and every older turn behind
|
|
53
|
+
* it would be unreachable. So retry, then give up and let the user get on.
|
|
54
|
+
*/
|
|
55
|
+
const MAX_UNDO_ATTEMPTS = 2;
|
|
56
|
+
const byteLen = (s) => (s === null ? 0 : Buffer.byteLength(s, "utf8"));
|
|
57
|
+
/**
|
|
58
|
+
* The whole undo decision, as a pure function of what we recorded and what is on
|
|
59
|
+
* disk. Split out because this is where the judgement lives — the caller does only
|
|
60
|
+
* I/O around it, and the two failure modes that matter (clobbering someone else's
|
|
61
|
+
* edit, and mishandling a file that vanished) are decided here where they can be
|
|
62
|
+
* tested exhaustively.
|
|
63
|
+
*
|
|
64
|
+
* `currentBytes` is null when the file is not on disk, for any reason.
|
|
65
|
+
*/
|
|
66
|
+
export function undoAction(state, currentBytes) {
|
|
67
|
+
if (state.original === null && currentBytes === null)
|
|
68
|
+
return "settled";
|
|
69
|
+
if (currentBytes !== state.written)
|
|
70
|
+
return "conflict";
|
|
71
|
+
return state.original === null ? "delete" : "restore";
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Parse what follows `/undo`: nothing (roll back the last turn), `list` (show what
|
|
75
|
+
* is available), or a count (roll back that many turns, newest first).
|
|
76
|
+
*/
|
|
77
|
+
export function parseUndoArg(arg) {
|
|
78
|
+
const text = arg.trim().toLowerCase();
|
|
79
|
+
if (text === "")
|
|
80
|
+
return { kind: "undo", count: 1 };
|
|
81
|
+
if (text === "list" || text === "ls")
|
|
82
|
+
return { kind: "list" };
|
|
83
|
+
if (/^\d+$/.test(text)) {
|
|
84
|
+
const count = Number(text);
|
|
85
|
+
if (count < 1)
|
|
86
|
+
return { kind: "error", message: "How many turns? /undo 1 rolls back the last one." };
|
|
87
|
+
return { kind: "undo", count };
|
|
88
|
+
}
|
|
89
|
+
return { kind: "error", message: `I don't understand "${arg.trim()}". Use /undo, /undo list, or /undo <number>.` };
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* What the MODEL is told after an undo. Pure.
|
|
93
|
+
*
|
|
94
|
+
* Without this the rollback is invisible to it: the transcript still says the edits
|
|
95
|
+
* were made, so the next turn reasons about code that is no longer on disk. The
|
|
96
|
+
* conversation is deliberately NOT rewound — only the facts are corrected, which is
|
|
97
|
+
* the smallest honest fix for the two drifting apart.
|
|
98
|
+
*/
|
|
99
|
+
export function undoNotice(results, display) {
|
|
100
|
+
const list = (paths) => paths.map(display).join(", ");
|
|
101
|
+
const gather = (pick) => [...new Set(results.flatMap(pick))];
|
|
102
|
+
const labels = results.map((r) => `"${r.label}"`).join(", ");
|
|
103
|
+
const lines = [
|
|
104
|
+
`The user ran /undo. The file changes from ${labels} were rolled back on disk.`,
|
|
105
|
+
];
|
|
106
|
+
const restored = gather((r) => r.restored);
|
|
107
|
+
const conflicts = gather((r) => r.conflicts);
|
|
108
|
+
const failed = gather((r) => r.failed);
|
|
109
|
+
const skipped = gather((r) => r.skipped);
|
|
110
|
+
if (restored.length > 0) {
|
|
111
|
+
lines.push(`Back to their pre-turn state: ${list(restored)}. Your edits to these are gone.`);
|
|
112
|
+
}
|
|
113
|
+
if (conflicts.length > 0) {
|
|
114
|
+
lines.push(`Left as they are, because they changed after you wrote them: ${list(conflicts)}.`);
|
|
115
|
+
}
|
|
116
|
+
if (failed.length > 0) {
|
|
117
|
+
lines.push(`Could not be rolled back and are still in their edited state: ${list(failed)}.`);
|
|
118
|
+
}
|
|
119
|
+
if (skipped.length > 0) {
|
|
120
|
+
lines.push(`Too large to checkpoint, so still in their edited state: ${list(skipped)}.`);
|
|
121
|
+
}
|
|
122
|
+
if (results.some((r) => r.ranShell)) {
|
|
123
|
+
lines.push("Shell commands also ran; whatever those changed was not rolled back.");
|
|
124
|
+
}
|
|
125
|
+
lines.push("Re-read any of these before editing them again.");
|
|
126
|
+
return lines.join(" ");
|
|
127
|
+
}
|
|
128
|
+
export class Checkpoints {
|
|
129
|
+
max;
|
|
130
|
+
current = new Map();
|
|
131
|
+
currentBytes = 0;
|
|
132
|
+
currentSkipped = new Set();
|
|
133
|
+
shellRan = false;
|
|
134
|
+
stack = [];
|
|
135
|
+
resumed = false;
|
|
136
|
+
constructor(max = 20) {
|
|
137
|
+
this.max = max;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* Record a file's pre-change content the first time it's touched this turn, and
|
|
141
|
+
* the content being written now. `original` is the exact bytes on disk (or null
|
|
142
|
+
* for a not-yet-existing file); `written` is what the tool is about to put there.
|
|
143
|
+
*
|
|
144
|
+
* A file too large to hold is recorded as SKIPPED rather than dropped silently —
|
|
145
|
+
* `/undo` then says it wasn't covered instead of implying it was.
|
|
146
|
+
*/
|
|
147
|
+
backup(absPath, original, written) {
|
|
148
|
+
const prior = this.current.get(absPath);
|
|
149
|
+
if (prior) {
|
|
150
|
+
// A later touch in the same turn moves only `written`; `original` is the
|
|
151
|
+
// pre-turn truth and never changes.
|
|
152
|
+
const grown = byteLen(original) + byteLen(written);
|
|
153
|
+
if (grown > MAX_FILE_BYTES) {
|
|
154
|
+
// It has outgrown what we can hold. Drop it wholesale rather than keep a
|
|
155
|
+
// half-record we would have to reason about at restore time.
|
|
156
|
+
this.currentBytes -= byteLen(prior.original) + byteLen(prior.written);
|
|
157
|
+
this.current.delete(absPath);
|
|
158
|
+
this.currentSkipped.add(absPath);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
this.currentBytes += byteLen(written) - byteLen(prior.written);
|
|
162
|
+
prior.written = written;
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
const cost = byteLen(original) + byteLen(written);
|
|
166
|
+
if (cost > MAX_FILE_BYTES || this.currentBytes + cost > MAX_TOTAL_BYTES) {
|
|
167
|
+
this.currentSkipped.add(absPath);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
this.current.set(absPath, { original, written });
|
|
171
|
+
this.currentBytes += cost;
|
|
172
|
+
}
|
|
173
|
+
/** Note that this turn ran a shell command, whose effects we cannot capture. */
|
|
174
|
+
noteShell() {
|
|
175
|
+
this.shellRan = true;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Mark this as a resumed session. Undo history lives in memory, so a resumed
|
|
179
|
+
* session starts empty even though earlier turns really did change files — the
|
|
180
|
+
* difference matters when telling the user why there is nothing to undo.
|
|
181
|
+
*/
|
|
182
|
+
noteResumed() {
|
|
183
|
+
this.resumed = true;
|
|
184
|
+
}
|
|
185
|
+
/** Whether this session was resumed (so earlier turns' undo history is gone). */
|
|
186
|
+
wasResumed() {
|
|
187
|
+
return this.resumed;
|
|
188
|
+
}
|
|
189
|
+
/** Close this turn's edits into a restorable checkpoint. No-op if nothing happened. */
|
|
190
|
+
seal(label) {
|
|
191
|
+
// A turn whose only file changes were too large still gets a checkpoint: it has
|
|
192
|
+
// nothing to restore, but it has something to SAY, and saying it is the point.
|
|
193
|
+
if (this.current.size === 0 && this.currentSkipped.size === 0) {
|
|
194
|
+
this.shellRan = false;
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
197
|
+
this.stack.push({
|
|
198
|
+
label: label || "(edits)",
|
|
199
|
+
at: Date.now(),
|
|
200
|
+
files: this.current,
|
|
201
|
+
skipped: [...this.currentSkipped],
|
|
202
|
+
ranShell: this.shellRan,
|
|
203
|
+
bytes: this.currentBytes,
|
|
204
|
+
attempts: 0,
|
|
205
|
+
});
|
|
206
|
+
this.current = new Map();
|
|
207
|
+
this.currentBytes = 0;
|
|
208
|
+
this.currentSkipped = new Set();
|
|
209
|
+
this.shellRan = false;
|
|
210
|
+
this.evict();
|
|
211
|
+
}
|
|
212
|
+
/** Trim the stack to both bounds: the turn count, then the byte budget. */
|
|
213
|
+
evict() {
|
|
214
|
+
while (this.stack.length > this.max)
|
|
215
|
+
this.stack.shift();
|
|
216
|
+
let total = this.stack.reduce((n, cp) => n + cp.bytes, 0);
|
|
217
|
+
// `length > 1` keeps the newest checkpoint whatever it costs — see MAX_TOTAL_BYTES.
|
|
218
|
+
// Currently unreachable, because `backup` already refuses once a single turn's
|
|
219
|
+
// held bytes would pass the budget, so no lone checkpoint can exceed it. Kept
|
|
220
|
+
// anyway: it is one condition, and it is what stops that in-turn cap from
|
|
221
|
+
// becoming load-bearing in a way nobody would notice if it were relaxed.
|
|
222
|
+
while (total > MAX_TOTAL_BYTES && this.stack.length > 1) {
|
|
223
|
+
total -= this.stack.shift().bytes;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/** Whether there's a sealed checkpoint to undo. */
|
|
227
|
+
hasUndo() {
|
|
228
|
+
return this.stack.length > 0;
|
|
229
|
+
}
|
|
230
|
+
/** The label of the checkpoint that `undo()` would restore, if any. */
|
|
231
|
+
nextUndoLabel() {
|
|
232
|
+
return this.stack[this.stack.length - 1]?.label;
|
|
233
|
+
}
|
|
234
|
+
/** What is available to undo, newest first. */
|
|
235
|
+
list() {
|
|
236
|
+
return [...this.stack]
|
|
237
|
+
.reverse()
|
|
238
|
+
.map((cp) => ({
|
|
239
|
+
label: cp.label,
|
|
240
|
+
at: cp.at,
|
|
241
|
+
files: cp.files.size,
|
|
242
|
+
skipped: cp.skipped.length,
|
|
243
|
+
ranShell: cp.ranShell,
|
|
244
|
+
}));
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Restore the most recent sealed checkpoint. Files that no longer match what we
|
|
248
|
+
* wrote are reported as conflicts and left untouched; files that fail to write
|
|
249
|
+
* are reported and KEPT in the checkpoint so a second `/undo` retries just those.
|
|
250
|
+
* The checkpoint retires when nothing is left in it, or when retrying it has
|
|
251
|
+
* stopped being useful.
|
|
252
|
+
*/
|
|
253
|
+
async undo() {
|
|
254
|
+
const cp = this.stack[this.stack.length - 1];
|
|
255
|
+
if (!cp)
|
|
256
|
+
return null;
|
|
257
|
+
const restored = [];
|
|
258
|
+
const conflicts = [];
|
|
259
|
+
const failed = [];
|
|
260
|
+
for (const [path, state] of [...cp.files]) {
|
|
261
|
+
let currentBytes;
|
|
262
|
+
try {
|
|
263
|
+
currentBytes = await fs.readFile(path, "utf8");
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
currentBytes = null; // not on disk (deleted, or never created)
|
|
267
|
+
}
|
|
268
|
+
const action = undoAction(state, currentBytes);
|
|
269
|
+
if (action === "settled") {
|
|
270
|
+
cp.files.delete(path); // nothing to do, nothing worth reporting
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
if (action === "conflict") {
|
|
274
|
+
conflicts.push(path);
|
|
275
|
+
cp.files.delete(path); // reported once; their copy stands
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
if (action === "delete")
|
|
280
|
+
await fs.rm(path, { force: true });
|
|
281
|
+
// ATOMIC, like every other write to a user's file. Writing straight onto the
|
|
282
|
+
// destination truncates it first, so a crash inside that window destroys the
|
|
283
|
+
// file — during the one operation whose entire purpose is to save it. Undo is
|
|
284
|
+
// the recovery mechanism; it must not be the thing that loses the work.
|
|
285
|
+
else
|
|
286
|
+
await writeFileAtomic(path, state.original);
|
|
287
|
+
restored.push(path);
|
|
288
|
+
cp.files.delete(path);
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
failed.push(path); // left in place so the next /undo can try again
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
cp.attempts++;
|
|
295
|
+
const retired = cp.files.size === 0 || cp.attempts >= MAX_UNDO_ATTEMPTS;
|
|
296
|
+
if (retired)
|
|
297
|
+
this.stack.pop();
|
|
298
|
+
return {
|
|
299
|
+
label: cp.label,
|
|
300
|
+
at: cp.at,
|
|
301
|
+
restored,
|
|
302
|
+
conflicts,
|
|
303
|
+
failed,
|
|
304
|
+
retryable: failed.length > 0 && !retired,
|
|
305
|
+
skipped: cp.skipped,
|
|
306
|
+
ranShell: cp.ranShell,
|
|
307
|
+
};
|
|
308
|
+
}
|
|
309
|
+
/**
|
|
310
|
+
* Undo up to `count` checkpoints, newest first — the coherent way to go back more
|
|
311
|
+
* than one turn, since a later turn's edits sit on top of an earlier one's. Stops
|
|
312
|
+
* early if the stack runs out, or if a checkpoint is left retryable (pressing on
|
|
313
|
+
* past a file we could not write would unwind state the user thinks is still here).
|
|
314
|
+
*/
|
|
315
|
+
async undoMany(count) {
|
|
316
|
+
const results = [];
|
|
317
|
+
for (let i = 0; i < count; i++) {
|
|
318
|
+
const result = await this.undo();
|
|
319
|
+
if (!result)
|
|
320
|
+
break;
|
|
321
|
+
results.push(result);
|
|
322
|
+
if (result.retryable)
|
|
323
|
+
break;
|
|
324
|
+
}
|
|
325
|
+
return results;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
//# sourceMappingURL=checkpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkpoints.js","sourceRoot":"","sources":["../../src/tools/checkpoints.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,cAAc,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAAC;AAEvC;;;;;GAKG;AACH,MAAM,eAAe,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAEzC;;;;;;;GAOG;AACH,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAE5B,MAAM,OAAO,GAAG,CAAC,CAAgB,EAAU,EAAE,CA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E,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,OAAO;YACxC,OAAO,EAAE,EAAE,CAAC,OAAO;YACnB,QAAQ,EAAE,EAAE,CAAC,QAAQ;SACtB,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,QAAQ,CAAC,KAAa;QAC1B,MAAM,OAAO,GAAiB,EAAE,CAAC;QACjC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YAC/B,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;YACjC,IAAI,CAAC,MAAM;gBAAE,MAAM;YACnB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACrB,IAAI,MAAM,CAAC,SAAS;gBAAE,MAAM;QAC9B,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* codeIntel.ts — the read-only tools that query the chassis (Mindweave's code map).
|
|
3
|
+
*
|
|
4
|
+
* These give the model IDE-grade navigation — outline, jump-to-definition,
|
|
5
|
+
* find-references, and a relevance map — without reading or grepping blindly.
|
|
6
|
+
* They query `ctx.chassis` (built by the alternator lane) and fall back to a
|
|
7
|
+
* clear "use grep/read" message when it isn't available. Every result carries
|
|
8
|
+
* the chassis's confidence: `name-level` answers tell the model to verify with
|
|
9
|
+
* grep when exact identity matters (the assistant-not-authority rule).
|
|
10
|
+
*/
|
|
11
|
+
import { promises as fs } from "node:fs";
|
|
12
|
+
import { relativize, resolvePath } from "./paths.js";
|
|
13
|
+
import { allChassis, chassisForPath, mergedDefinition, mergedReferences } from "./chassisMux.js";
|
|
14
|
+
import { walkFiles } from "./walk.js";
|
|
15
|
+
import { excludedFromSearch } from "./guard.js";
|
|
16
|
+
import { isSupported } from "../alternator/chassis/treesitter.js";
|
|
17
|
+
import { isMarkupSupported } from "../alternator/chassis/markup.js";
|
|
18
|
+
import { fail, failQuietly } from "./results.js";
|
|
19
|
+
const DIR_FILE_CAP = 40;
|
|
20
|
+
const REF_CAP = 100;
|
|
21
|
+
function indexingNote(ctx) {
|
|
22
|
+
return ctx.chassis?.status().ready ? "" : " (code map still indexing — may be incomplete)";
|
|
23
|
+
}
|
|
24
|
+
function caveat(confidence) {
|
|
25
|
+
return confidence === "name-level"
|
|
26
|
+
? "\n(name-level match — verify with grep if exact identity matters)"
|
|
27
|
+
: "";
|
|
28
|
+
}
|
|
29
|
+
const outlineDef = {
|
|
30
|
+
name: "outline",
|
|
31
|
+
readOnly: true,
|
|
32
|
+
// Two things were missing, and the second one matters more than it looks. A directory
|
|
33
|
+
// outline leads with a rollup (counts, the central symbols, which folders it depends
|
|
34
|
+
// on) that the description never mentioned, so the model had no reason to point this
|
|
35
|
+
// at a folder. And a directory outline stops after DIR_FILE_CAP files WITHOUT saying
|
|
36
|
+
// so, which means a model that outlines a 200-file folder believes it has seen the
|
|
37
|
+
// shape of all of it. Silent truncation is the worst kind: it looks like completeness.
|
|
38
|
+
description: "Show the structural outline of a file: its symbols and signatures, never bodies. " +
|
|
39
|
+
"Point it at a DIRECTORY and you get more than the files, you get a rollup first — " +
|
|
40
|
+
"how many files and symbols it holds, which symbols are most central to it, and " +
|
|
41
|
+
"which other folders it depends on. That is the fastest way to understand an " +
|
|
42
|
+
"unfamiliar area, and it costs one call. " +
|
|
43
|
+
`A directory outline covers at most ${DIR_FILE_CAP} files, so for anything larger ` +
|
|
44
|
+
"treat it as a sample and narrow to a subfolder. Files with no symbols are left out. " +
|
|
45
|
+
"Works on HTML and CSS too: it lists a page's sections and ids, and a stylesheet's " +
|
|
46
|
+
"selectors, with line numbers, so you can navigate a big page instead of reading it " +
|
|
47
|
+
"top to bottom.",
|
|
48
|
+
parameters: {
|
|
49
|
+
type: "object",
|
|
50
|
+
additionalProperties: false,
|
|
51
|
+
properties: {
|
|
52
|
+
path: { type: "string", description: "File or directory. Defaults to the working directory." },
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
async execute(args, ctx) {
|
|
56
|
+
if (allChassis(ctx).length === 0)
|
|
57
|
+
return degraded();
|
|
58
|
+
const rawPath = typeof args.path === "string" && args.path.trim() ? args.path.trim() : ".";
|
|
59
|
+
const abs = resolvePath(ctx, rawPath);
|
|
60
|
+
let stat;
|
|
61
|
+
try {
|
|
62
|
+
stat = await fs.stat(abs);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return fail(`path not found: ${rawPath}`);
|
|
66
|
+
}
|
|
67
|
+
const groups = [];
|
|
68
|
+
let rollup = "";
|
|
69
|
+
let dirTruncated = null;
|
|
70
|
+
if (stat.isFile()) {
|
|
71
|
+
const entries = await (chassisForPath(ctx, abs)?.outline(abs) ?? Promise.resolve([]));
|
|
72
|
+
groups.push({ file: abs, entries });
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
// A directory: lead with a folder rollup (counts, central symbols, deps).
|
|
76
|
+
const summary = await chassisForPath(ctx, abs)?.directorySummary(abs);
|
|
77
|
+
if (summary)
|
|
78
|
+
rollup = renderDirSummary(ctx, summary);
|
|
79
|
+
const { files } = await walkFiles(abs, 5000);
|
|
80
|
+
// `excludedFromSearch` is what keeps secrets and other agents' data out of
|
|
81
|
+
// grep and glob. outline walked the same tree without it, so the one
|
|
82
|
+
// discovery tool that reads file CONTENTS to build its output was the one not
|
|
83
|
+
// applying the exclusion. Same list, same walk, same rule.
|
|
84
|
+
const eligible = files.filter((f) => !excludedFromSearch(f.abs) && (isSupported(f.abs) || isMarkupSupported(f.abs)));
|
|
85
|
+
const supported = eligible.slice(0, DIR_FILE_CAP);
|
|
86
|
+
// Say so when the cap bites. The description warns that a cap exists, but a
|
|
87
|
+
// model reading one particular reply cannot tell whether THIS answer hit it,
|
|
88
|
+
// and truncation that looks like completeness is how a partial survey gets
|
|
89
|
+
// treated as the shape of the whole folder.
|
|
90
|
+
if (eligible.length > supported.length) {
|
|
91
|
+
dirTruncated = { shown: supported.length, total: eligible.length };
|
|
92
|
+
}
|
|
93
|
+
for (const f of supported) {
|
|
94
|
+
const entries = (await chassisForPath(ctx, f.abs)?.outline(f.abs)) ?? [];
|
|
95
|
+
if (entries.length)
|
|
96
|
+
groups.push({ file: f.abs, entries });
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
const outlineBody = groups
|
|
100
|
+
.map((g) => {
|
|
101
|
+
const header = relativize(ctx, g.file);
|
|
102
|
+
return `${header}\n${renderOutlineEntries(g.entries).join("\n")}`;
|
|
103
|
+
})
|
|
104
|
+
.join("\n\n");
|
|
105
|
+
const truncNote = dirTruncated
|
|
106
|
+
? `\n\n(outlined ${dirTruncated.shown} of ${dirTruncated.total} files — this is a ` +
|
|
107
|
+
`sample, not the whole folder; narrow to a subfolder to see the rest)`
|
|
108
|
+
: "";
|
|
109
|
+
const body = [rollup, outlineBody].filter(Boolean).join("\n\n");
|
|
110
|
+
if (!body)
|
|
111
|
+
return { output: `No symbols found in ${rawPath}.${indexingNote(ctx)}`, summary: `outline ${rawPath} (empty)` };
|
|
112
|
+
return {
|
|
113
|
+
output: body + truncNote + indexingNote(ctx),
|
|
114
|
+
summary: `outline ${rawPath} (${groups.length} file${groups.length === 1 ? "" : "s"})`,
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
const definitionDef = {
|
|
119
|
+
name: "definition",
|
|
120
|
+
readOnly: true,
|
|
121
|
+
// "the exact file:line" was an overclaim: a name defined in two files returns BOTH,
|
|
122
|
+
// which is the right behaviour and needs saying, because a model told it gets THE
|
|
123
|
+
// location will take the first row. The genuinely useful part was also unstated:
|
|
124
|
+
// the declaration line comes back with the location, so most lookups need no read
|
|
125
|
+
// at all. Same two-level certainty as references, for the same reason.
|
|
126
|
+
description: "Find where a symbol (function, class, type, and so on) is defined, by name. " +
|
|
127
|
+
"Returns file:line PLUS the declaration itself, so for most lookups you never need " +
|
|
128
|
+
"to open the file; use read_symbol when you want the body. " +
|
|
129
|
+
"If the name is defined in more than one place you get EVERY definition rather than " +
|
|
130
|
+
"a best guess, so an ambiguous name is visible instead of silently resolved. " +
|
|
131
|
+
"Certainty comes in two levels and the output says which one you got: resolved when " +
|
|
132
|
+
"a language server has analyzed the file, otherwise a NAME match, which can include " +
|
|
133
|
+
"an unrelated symbol that happens to share the name. " +
|
|
134
|
+
"Covers HTML and CSS as well: pass a CSS class or id (e.g. \"hero-stats\") to jump " +
|
|
135
|
+
"to its style rule, or an element id to find that section. " +
|
|
136
|
+
"An empty result means it is not in the code map, which may still be indexing, so " +
|
|
137
|
+
"fall back to grep rather than concluding the symbol does not exist.",
|
|
138
|
+
parameters: {
|
|
139
|
+
type: "object",
|
|
140
|
+
additionalProperties: false,
|
|
141
|
+
required: ["name"],
|
|
142
|
+
properties: { name: { type: "string", description: "The symbol name to locate." } },
|
|
143
|
+
},
|
|
144
|
+
async execute(args, ctx) {
|
|
145
|
+
if (allChassis(ctx).length === 0)
|
|
146
|
+
return degraded();
|
|
147
|
+
const name = typeof args.name === "string" ? args.name.trim() : "";
|
|
148
|
+
if (!name)
|
|
149
|
+
return failQuietly("`name` is required.");
|
|
150
|
+
const { symbols, confidence } = await mergedDefinition(ctx, name);
|
|
151
|
+
if (symbols.length === 0) {
|
|
152
|
+
return { output: `No definition of '${name}' in the code map.${indexingNote(ctx)} Try grep.`, summary: `definition ${name} — none` };
|
|
153
|
+
}
|
|
154
|
+
const body = symbols
|
|
155
|
+
.map((s) => `${relativize(ctx, s.file)}:${s.line} ${s.kind} ${s.signature ?? s.name}`)
|
|
156
|
+
.join("\n");
|
|
157
|
+
return { output: body + caveat(confidence) + indexingNote(ctx), summary: `definition ${name} (${symbols.length})` };
|
|
158
|
+
},
|
|
159
|
+
};
|
|
160
|
+
const referencesDef = {
|
|
161
|
+
name: "references",
|
|
162
|
+
readOnly: true,
|
|
163
|
+
// The old description read as if this were full semantic resolution. It is not, and
|
|
164
|
+
// the difference decides whether the model can trust the list: refs are keyed by NAME
|
|
165
|
+
// in the graph, and only files a language server has analyzed come back `resolved`.
|
|
166
|
+
// The tool already prints that caveat at runtime; a model that has not been told the
|
|
167
|
+
// distinction up front reads a name-level list as certainty and refactors on it.
|
|
168
|
+
description: "Find where a symbol is used, by name. Reads PARSED code rather than raw text, so a " +
|
|
169
|
+
"mention inside a comment or a string is never a match. Returns file:line locations " +
|
|
170
|
+
`(up to ${REF_CAP}), not the code itself. ` +
|
|
171
|
+
"There are TWO levels of certainty here and the output tells you which one you got. " +
|
|
172
|
+
"When a language server has analyzed the files involved, the answer is resolved. " +
|
|
173
|
+
"Otherwise it is a NAME match, and a different symbol that happens to share the name " +
|
|
174
|
+
"in an unrelated file WILL appear in the list. When it says name-level and exact " +
|
|
175
|
+
"identity matters, confirm with grep or by opening the candidates before you act. " +
|
|
176
|
+
"For a CSS class or id this returns every HTML element and every script " +
|
|
177
|
+
"(getElementById/querySelector/classList) that uses it, which is the cross-language " +
|
|
178
|
+
"blast radius before you change a style. " +
|
|
179
|
+
"An empty result means nothing in the code map references it; the map may still be " +
|
|
180
|
+
"indexing, so fall back to grep rather than concluding the symbol is unused.",
|
|
181
|
+
parameters: {
|
|
182
|
+
type: "object",
|
|
183
|
+
additionalProperties: false,
|
|
184
|
+
required: ["name"],
|
|
185
|
+
properties: { name: { type: "string", description: "The symbol name to find references to." } },
|
|
186
|
+
},
|
|
187
|
+
async execute(args, ctx) {
|
|
188
|
+
if (allChassis(ctx).length === 0)
|
|
189
|
+
return degraded();
|
|
190
|
+
const name = typeof args.name === "string" ? args.name.trim() : "";
|
|
191
|
+
if (!name)
|
|
192
|
+
return failQuietly("`name` is required.");
|
|
193
|
+
const { refs, confidence } = await mergedReferences(ctx, name);
|
|
194
|
+
if (refs.length === 0) {
|
|
195
|
+
return { output: `No references to '${name}' in the code map.${indexingNote(ctx)} Try grep.`, summary: `references ${name} — none` };
|
|
196
|
+
}
|
|
197
|
+
const shown = refs.slice(0, REF_CAP).map((r) => `${relativize(ctx, r.file)}:${r.line}`);
|
|
198
|
+
if (refs.length > REF_CAP)
|
|
199
|
+
shown.push(`… (${refs.length - REF_CAP} more)`);
|
|
200
|
+
return { output: shown.join("\n") + caveat(confidence) + indexingNote(ctx), summary: `references ${name} (${refs.length})` };
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
/** Render a directory rollup: counts, its most central symbols, and folder deps. */
|
|
204
|
+
function renderDirSummary(ctx, s) {
|
|
205
|
+
const where = relativize(ctx, s.dir);
|
|
206
|
+
const lines = [`${where}/ — ${s.files} file${s.files === 1 ? "" : "s"}, ${s.symbols} symbol${s.symbols === 1 ? "" : "s"}`];
|
|
207
|
+
if (s.topSymbols.length) {
|
|
208
|
+
lines.push(` central: ${s.topSymbols.slice(0, 8).map((sym) => `${sym.name} (${sym.kind})`).join(", ")}`);
|
|
209
|
+
}
|
|
210
|
+
if (s.dependsOn.length) {
|
|
211
|
+
lines.push(` depends on: ${s.dependsOn.map((d) => `${relativize(ctx, d)}/`).join(", ")}`);
|
|
212
|
+
}
|
|
213
|
+
return lines.join("\n");
|
|
214
|
+
}
|
|
215
|
+
/** Render a nested outline: indent by depth, show each symbol's doc when present. */
|
|
216
|
+
export function renderOutlineEntries(entries, depth = 0) {
|
|
217
|
+
const out = [];
|
|
218
|
+
for (const e of entries) {
|
|
219
|
+
const indent = " ".repeat(depth);
|
|
220
|
+
const doc = e.doc ? ` — ${e.doc}` : "";
|
|
221
|
+
out.push(` ${String(e.line).padStart(4)} ${indent}${e.kind} ${e.name}${doc}`);
|
|
222
|
+
if (e.children?.length)
|
|
223
|
+
out.push(...renderOutlineEntries(e.children, depth + 1));
|
|
224
|
+
}
|
|
225
|
+
return out;
|
|
226
|
+
}
|
|
227
|
+
function degraded() {
|
|
228
|
+
return {
|
|
229
|
+
output: "The code map isn't available here — use grep, glob, and read_file instead.",
|
|
230
|
+
summary: "code map unavailable",
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* These four never render a row.
|
|
235
|
+
*
|
|
236
|
+
* Outlining a file, resolving a definition, finding call sites, ranking what's
|
|
237
|
+
* relevant — that is the agent reading its way around the code, not work done
|
|
238
|
+
* TO the project. A row per lookup filled the transcript with the agent's own
|
|
239
|
+
* navigation while saying nothing the user could act on; the answers show up in
|
|
240
|
+
* what it goes on to say and do. The model still receives every result in full.
|
|
241
|
+
*
|
|
242
|
+
* Applied as a wrapper rather than a `quiet: true` on each return, because these
|
|
243
|
+
* four tools have eleven return sites between them and the next one added would
|
|
244
|
+
* silently start rendering again.
|
|
245
|
+
*/
|
|
246
|
+
function navigational(tool) {
|
|
247
|
+
return {
|
|
248
|
+
...tool,
|
|
249
|
+
/**
|
|
250
|
+
* Deferred, all four of them. They answer structural questions — where is this
|
|
251
|
+
* defined, what calls it, what is related — which is a phase of a task rather than a
|
|
252
|
+
* step in the edit loop, and four schemas is 1,257 tokens in front of the model on
|
|
253
|
+
* every single request.
|
|
254
|
+
*
|
|
255
|
+
* Marked here rather than on each definition because it is one decision about one
|
|
256
|
+
* family; splitting it four ways is four places for it to drift.
|
|
257
|
+
*/
|
|
258
|
+
deferred: true,
|
|
259
|
+
async execute(args, ctx) {
|
|
260
|
+
return { ...(await tool.execute(args, ctx)), quiet: true };
|
|
261
|
+
},
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
export const outlineTool = navigational(outlineDef);
|
|
265
|
+
export const definitionTool = navigational(definitionDef);
|
|
266
|
+
export const referencesTool = navigational(referencesDef);
|
|
267
|
+
//# sourceMappingURL=codeIntel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeIntel.js","sourceRoot":"","sources":["../../src/tools/codeIntel.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACrD,OAAO,EA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