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,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* modes.ts — the interaction modes shown under the chat, cycled with shift-tab.
|
|
3
|
+
*
|
|
4
|
+
* A mode is how much rein Mindweave has this turn. It's a CLIENT concept: the engine
|
|
5
|
+
* never sees "Architect" or a name — it only sees the behavioral flags a mode
|
|
6
|
+
* implies (today just `readOnly`, tomorrow Sentinel's confirm-before-acting), set
|
|
7
|
+
* onto the ToolContext when the mode changes. That keeps the layering clean: the
|
|
8
|
+
* UI owns the labels/icons/colors, the engine owns the behavior.
|
|
9
|
+
*
|
|
10
|
+
* Pure and tiny on purpose (unit-tested): the cycle skips modes that aren't
|
|
11
|
+
* enabled yet, so a not-yet-built mode (Sentinel) can sit in the list as a clean
|
|
12
|
+
* seam without ever landing in the rotation.
|
|
13
|
+
*/
|
|
14
|
+
/**
|
|
15
|
+
* The modes, in cycle order. Lightning (auto-accept, today's behavior) is the
|
|
16
|
+
* default and first stop; Architect (read-only planning) is the second; Sentinel
|
|
17
|
+
* (ask before each mutating action) is the third.
|
|
18
|
+
*/
|
|
19
|
+
export const MODES = [
|
|
20
|
+
{
|
|
21
|
+
id: "lightning",
|
|
22
|
+
name: "Lightning",
|
|
23
|
+
icon: "↯",
|
|
24
|
+
color: "yellow",
|
|
25
|
+
descriptor: "auto-accept",
|
|
26
|
+
readOnly: false,
|
|
27
|
+
guarded: false,
|
|
28
|
+
enabled: true,
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "architect",
|
|
32
|
+
name: "Architect",
|
|
33
|
+
icon: "△",
|
|
34
|
+
color: "magenta",
|
|
35
|
+
descriptor: "read-only · plan",
|
|
36
|
+
readOnly: true,
|
|
37
|
+
guarded: false,
|
|
38
|
+
enabled: true,
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: "sentinel",
|
|
42
|
+
name: "Sentinel",
|
|
43
|
+
icon: "❖",
|
|
44
|
+
color: "cyan",
|
|
45
|
+
descriptor: "ask before acting",
|
|
46
|
+
readOnly: false,
|
|
47
|
+
guarded: true,
|
|
48
|
+
enabled: true,
|
|
49
|
+
},
|
|
50
|
+
];
|
|
51
|
+
/** The mode a fresh session starts in. Architect is deliberately never sticky —
|
|
52
|
+
* you should never open a session and silently be unable to edit. */
|
|
53
|
+
export const DEFAULT_MODE = "lightning";
|
|
54
|
+
/** Look up a mode by id (falls back to the default — an unknown id can't wedge). */
|
|
55
|
+
export function modeById(id) {
|
|
56
|
+
return MODES.find((m) => m.id === id) ?? modeById(DEFAULT_MODE);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Which mode a set of behaviour flags amounts to (pure).
|
|
60
|
+
*
|
|
61
|
+
* The reverse of what `applyMode` does, and it exists because the flags can now move
|
|
62
|
+
* without the user pressing anything: approving a plan lifts `planMode` mid-turn and
|
|
63
|
+
* the engine restores it when the turn ends. The indicator has to be able to name
|
|
64
|
+
* whatever state it finds rather than only what it last set.
|
|
65
|
+
*
|
|
66
|
+
* Reading flags rather than being told a name is what keeps modes a client concept —
|
|
67
|
+
* nothing below this file knows the word "Architect". `planMode` wins over `guarded`
|
|
68
|
+
* because a read-only turn cannot act, so there is nothing left to confirm.
|
|
69
|
+
*/
|
|
70
|
+
export function modeFromFlags(flags) {
|
|
71
|
+
if (flags.planMode)
|
|
72
|
+
return "architect";
|
|
73
|
+
if (flags.guarded)
|
|
74
|
+
return "sentinel";
|
|
75
|
+
return "lightning";
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The next mode when the user presses shift-tab: the following ENABLED mode in
|
|
79
|
+
* list order, wrapping around. Disabled modes (Sentinel, for now) are skipped, so
|
|
80
|
+
* the rotation is only over what actually exists.
|
|
81
|
+
*/
|
|
82
|
+
export function nextMode(current) {
|
|
83
|
+
const rotation = MODES.filter((m) => m.enabled);
|
|
84
|
+
const at = rotation.findIndex((m) => m.id === current);
|
|
85
|
+
// If the current mode isn't in the rotation (e.g. a disabled mode was forced),
|
|
86
|
+
// start the cycle from the first enabled mode.
|
|
87
|
+
const next = rotation[(at + 1) % rotation.length] ?? rotation[0];
|
|
88
|
+
return next.id;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=modes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modes.js","sourceRoot":"","sources":["../../src/cli/modes.ts"],"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M,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAChD,MAAM,EAAE,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,OAAO,CAAC,CAAC;IACvD,+EAA+E;IAC/E,+CAA+C;IAC/C,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAE,CAAC;IAClE,OAAO,IAAI,CAAC,EAAE,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* mouse.ts — wheel scrolling in the alternate screen.
|
|
3
|
+
*
|
|
4
|
+
* The alternate screen has no scrollback of its own, so the terminal's own wheel
|
|
5
|
+
* does nothing: the rows on screen are all there is, and reaching for the wheel
|
|
6
|
+
* to look back at what scrolled away simply does not respond. Keyboard paging is
|
|
7
|
+
* not a substitute either — on Windows consoles those keys are frequently
|
|
8
|
+
* consumed by the console host before the app ever sees them.
|
|
9
|
+
*
|
|
10
|
+
* So the app asks the terminal to report wheel events, and scrolls itself.
|
|
11
|
+
*
|
|
12
|
+
* The catch, and it is the whole reason `stripMouse` exists: once reporting is
|
|
13
|
+
* on, those reports arrive as ordinary stdin bytes. They reach the wheel reader
|
|
14
|
+
* AND Ink's key parser, which has no notion of a mouse report and passes the
|
|
15
|
+
* bytes along as though they had been typed — so every scroll dumped
|
|
16
|
+
* `[<64;25;26M` into the prompt. Anything reading typed input must strip them
|
|
17
|
+
* first.
|
|
18
|
+
*
|
|
19
|
+
* The trade this makes, stated plainly: while wheel reporting is on, dragging to
|
|
20
|
+
* select text is captured by the app instead of the terminal. Every terminal
|
|
21
|
+
* worth using keeps selection available on Shift+drag, the same deal vim, htop,
|
|
22
|
+
* and every other full-screen tool strikes.
|
|
23
|
+
*/
|
|
24
|
+
import { MOUSE_OFF } from "./terminalRestore.js";
|
|
25
|
+
/** Report wheel/button presses (1000) using SGR encoding (1006), the only
|
|
26
|
+
* encoding that stays correct past column 223. */
|
|
27
|
+
const MOUSE_ON = "\x1b[?1000h\x1b[?1006h";
|
|
28
|
+
/**
|
|
29
|
+
* An SGR mouse report: `ESC [ < button ; col ; row (M|m)`.
|
|
30
|
+
*
|
|
31
|
+
* The ESC is optional because the same bytes reach us two ways: raw off stdin
|
|
32
|
+
* with the ESC intact, and again through Ink's key parser, which strips it. Both
|
|
33
|
+
* spellings have to match or the stripped one lands in the input box.
|
|
34
|
+
*/
|
|
35
|
+
const SGR = /\x1b?\[<(\d+);(\d+);(\d+)([Mm])/g;
|
|
36
|
+
/**
|
|
37
|
+
* Every wheel event in a chunk of terminal input, in order (pure).
|
|
38
|
+
*
|
|
39
|
+
* A single flick can deliver several reports in one chunk, and each is a notch
|
|
40
|
+
* the user turned — dropping the extras makes scrolling feel like it is ignoring
|
|
41
|
+
* you, so they are all returned rather than collapsed.
|
|
42
|
+
*/
|
|
43
|
+
export function readWheel(data) {
|
|
44
|
+
const out = [];
|
|
45
|
+
for (const match of data.matchAll(SGR)) {
|
|
46
|
+
const button = Number(match[1]);
|
|
47
|
+
// Bit 6 (64) marks a wheel event; bit 0 then separates up (0) from down (1).
|
|
48
|
+
if ((button & 64) === 0)
|
|
49
|
+
continue;
|
|
50
|
+
out.push((button & 1) === 0 ? "up" : "down");
|
|
51
|
+
}
|
|
52
|
+
return out;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The same input with every mouse report removed (pure).
|
|
56
|
+
*
|
|
57
|
+
* Used by anything that treats stdin as typed text. Also drops a trailing
|
|
58
|
+
* fragment of a report — a chunk boundary can split one, and half a report is
|
|
59
|
+
* still not something the user typed.
|
|
60
|
+
*/
|
|
61
|
+
export function stripMouse(data) {
|
|
62
|
+
return data.replace(SGR, "").replace(/\x1b?\[<[\d;]*$/, "");
|
|
63
|
+
}
|
|
64
|
+
/** Turn wheel reporting on, returning a function that turns it back off.
|
|
65
|
+
* A no-op off a TTY, matching how altScreen.ts gates itself. */
|
|
66
|
+
export function enableMouse() {
|
|
67
|
+
if (!process.stdout.isTTY)
|
|
68
|
+
return () => { };
|
|
69
|
+
process.stdout.write(MOUSE_ON);
|
|
70
|
+
let done = false;
|
|
71
|
+
return () => {
|
|
72
|
+
if (done)
|
|
73
|
+
return;
|
|
74
|
+
done = true;
|
|
75
|
+
process.stdout.write(MOUSE_OFF);
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=mouse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mouse.js","sourceRoot":"","sources":["../../src/cli/mouse.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD;mDACmD;AACnD,MAAM,QAAQ,GAAG,wBAAwB,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,GAAG,GAAG,kCAAkC,CAAC;AAI/C;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,MAAM,GAAG,GAAqB,EAAE,CAAC;IACjC,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAChC,6EAA6E;QAC7E,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC;YAAE,SAAS;QAClC,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED;iEACiE;AACjE,MAAM,UAAU,WAAW;IACzB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK;QAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC/B,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,OAAO,GAAG,EAAE;QACV,IAAI,IAAI;YAAE,OAAO;QACjB,IAAI,GAAG,IAAI,CAAC;QACZ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pasteAssembler.ts — reassembles a bracketed paste that the terminal delivers as
|
|
3
|
+
* several input chunks.
|
|
4
|
+
*
|
|
5
|
+
* When bracketed paste is enabled (`\x1b[?2004h`), a paste is wrapped in `\x1b[200~`
|
|
6
|
+
* … `\x1b[201~` markers. A large paste still arrives split across several `input`
|
|
7
|
+
* events (~1KB each), with the start marker on the first chunk and the end marker on
|
|
8
|
+
* the last — so we must track state across chunks and accumulate until the end.
|
|
9
|
+
*
|
|
10
|
+
* Ink's `parseKeypress` mangles the markers: it strips a leading ESC from a
|
|
11
|
+
* start-of-chunk sequence, so `\x1b[200~` reaches us as `[200~`, while a mid-chunk
|
|
12
|
+
* `\x1b[201~` keeps its ESC. We therefore match both markers ESC-optionally.
|
|
13
|
+
*
|
|
14
|
+
* This module is pure and synchronous so the state machine can be unit-tested without
|
|
15
|
+
* mounting the terminal UI. The timing-based fallback for terminals that lack
|
|
16
|
+
* bracketed paste stays in the component (it needs real timers).
|
|
17
|
+
*/
|
|
18
|
+
// Match the paste markers whether or not Ink left the leading ESC on.
|
|
19
|
+
export const PASTE_START_RE = /\x1b?\[200~/;
|
|
20
|
+
export const PASTE_END_RE = /\x1b?\[201~/;
|
|
21
|
+
export function initPasteState() {
|
|
22
|
+
return { active: false, buf: "" };
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Feed one raw input chunk. Returns what the caller should do. On `flush` the caller
|
|
26
|
+
* inserts `text` (as a chip if large); the state should be reset afterward.
|
|
27
|
+
*/
|
|
28
|
+
export function feedPasteChunk(state, input) {
|
|
29
|
+
const starting = PASTE_START_RE.test(input);
|
|
30
|
+
if (!state.active && !starting) {
|
|
31
|
+
return { kind: "passthrough" };
|
|
32
|
+
}
|
|
33
|
+
// Strip a start marker (only present on the first chunk) and detect the end marker.
|
|
34
|
+
let text = input.replace(PASTE_START_RE, "");
|
|
35
|
+
const ending = PASTE_END_RE.test(text);
|
|
36
|
+
text = text.replace(PASTE_END_RE, "");
|
|
37
|
+
const buf = state.buf + text;
|
|
38
|
+
if (ending) {
|
|
39
|
+
// A split end marker can leave a stray trailing ESC; drop it.
|
|
40
|
+
return { kind: "flush", text: buf.replace(/\x1b$/, "") };
|
|
41
|
+
}
|
|
42
|
+
return { kind: "buffering", state: { active: true, buf } };
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=pasteAssembler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pasteAssembler.js","sourceRoot":"","sources":["../../src/cli/pasteAssembler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;AAC5C,MAAM,CAAC,MAAM,YAAY,GAAG,aAAa,CAAC;AAiB1C,MAAM,UAAU,cAAc;IAC5B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,EAAE,CAAC;AACpC,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,KAAiB,EAAE,KAAa;IAC7D,MAAM,QAAQ,GAAG,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC/B,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC;IACjC,CAAC;IACD,oFAAoF;IACpF,IAAI,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IACtC,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,GAAG,IAAI,CAAC;IAC7B,IAAI,MAAM,EAAE,CAAC;QACX,8DAA8D;QAC9D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,EAAE,CAAC;IAC3D,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* pathComplete.ts — file completion for the `@mention` picker.
|
|
3
|
+
*
|
|
4
|
+
* Given what's been typed after `@` (e.g. `src/co`), list matching files and
|
|
5
|
+
* folders under the project root, shell-style: split off the directory part,
|
|
6
|
+
* match the trailing fragment against that directory's entries, return full
|
|
7
|
+
* relative paths (folders keep a trailing `/` so you can keep drilling in).
|
|
8
|
+
* Scoped to the primary root — dragging a file still handles any other path.
|
|
9
|
+
*/
|
|
10
|
+
import { promises as fs } from "node:fs";
|
|
11
|
+
import { resolve } from "node:path";
|
|
12
|
+
import { DEFAULT_IGNORES } from "../tools/walk.js";
|
|
13
|
+
const MAX_RESULTS = 12;
|
|
14
|
+
export async function completePath(cwd, prefix) {
|
|
15
|
+
const norm = prefix.split("\\").join("/");
|
|
16
|
+
const slash = norm.lastIndexOf("/");
|
|
17
|
+
const dirPart = slash >= 0 ? norm.slice(0, slash) : "";
|
|
18
|
+
const fragment = (slash >= 0 ? norm.slice(slash + 1) : norm).toLowerCase();
|
|
19
|
+
let entries;
|
|
20
|
+
try {
|
|
21
|
+
entries = await fs.readdir(resolve(cwd, dirPart), { withFileTypes: true });
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
return entries
|
|
27
|
+
.filter((e) => e.name.toLowerCase().startsWith(fragment))
|
|
28
|
+
.filter((e) => !(e.isDirectory() && DEFAULT_IGNORES.has(e.name)))
|
|
29
|
+
// Hide dotfiles unless the user is explicitly typing a dot.
|
|
30
|
+
.filter((e) => !e.name.startsWith(".") || fragment.startsWith("."))
|
|
31
|
+
.sort((a, b) => {
|
|
32
|
+
const ad = a.isDirectory() ? 0 : 1;
|
|
33
|
+
const bd = b.isDirectory() ? 0 : 1;
|
|
34
|
+
return ad !== bd ? ad - bd : a.name.localeCompare(b.name);
|
|
35
|
+
})
|
|
36
|
+
.slice(0, MAX_RESULTS)
|
|
37
|
+
.map((e) => (dirPart ? `${dirPart}/` : "") + e.name + (e.isDirectory() ? "/" : ""));
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=pathComplete.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathComplete.js","sourceRoot":"","sources":["../../src/cli/pathComplete.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAA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CAAC,GAAG,CAAC,CAAC;SAClE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QACb,MAAM,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,MAAM,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5D,CAAC,CAAC;SACD,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC;SACrB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACxF,CAAC"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* perfLog.ts — frame timings from the REAL terminal, on the user's machine.
|
|
3
|
+
*
|
|
4
|
+
* Every performance number this UI has been tuned against so far came from a probe
|
|
5
|
+
* writing to a fake stdout, where the terminal write costs exactly zero and Yoga runs
|
|
6
|
+
* on a machine that is not the one complaining. That is how a fix got shipped twice
|
|
7
|
+
* that measured beautifully and felt no different: the probe could not see the part
|
|
8
|
+
* that was slow.
|
|
9
|
+
*
|
|
10
|
+
* So this writes what actually happened, to a file, from the running app:
|
|
11
|
+
*
|
|
12
|
+
* - how long the terminal took to accept each write, and how big it was
|
|
13
|
+
* - how many blocks exist versus how many were handed to the renderer, which is the
|
|
14
|
+
* one fact that says whether virtualization is engaging at all
|
|
15
|
+
* - the gap between frames, which is what the user actually perceives as lag
|
|
16
|
+
*
|
|
17
|
+
* Off unless `MINDWEAVE_PERF` is set, and when off it costs one boolean read per frame
|
|
18
|
+
* and touches nothing else. It must never write to stdout: this is an alt-screen TUI,
|
|
19
|
+
* and a stray line would corrupt the frame it is trying to measure.
|
|
20
|
+
*/
|
|
21
|
+
import { appendFileSync, mkdirSync } from "node:fs";
|
|
22
|
+
import { dirname } from "node:path";
|
|
23
|
+
const PATH = process.env.MINDWEAVE_PERF ?? "";
|
|
24
|
+
const ON = PATH !== "" && PATH !== "0";
|
|
25
|
+
/** Whether frame instrumentation is on. */
|
|
26
|
+
export function perfEnabled() {
|
|
27
|
+
return ON;
|
|
28
|
+
}
|
|
29
|
+
let buffer = [];
|
|
30
|
+
let flushTimer = null;
|
|
31
|
+
/**
|
|
32
|
+
* Record one line. Buffered and flushed on a timer rather than written immediately —
|
|
33
|
+
* a synchronous file write per frame would itself become the slowest thing in the
|
|
34
|
+
* frame, and an instrument that changes what it measures is worse than none.
|
|
35
|
+
*/
|
|
36
|
+
export function perf(line) {
|
|
37
|
+
if (!ON)
|
|
38
|
+
return;
|
|
39
|
+
buffer.push(`${Date.now()} ${line}`);
|
|
40
|
+
if (flushTimer)
|
|
41
|
+
return;
|
|
42
|
+
flushTimer = setTimeout(flush, 1000);
|
|
43
|
+
flushTimer.unref?.();
|
|
44
|
+
}
|
|
45
|
+
/** Write everything buffered so far. Safe to call when there is nothing to write. */
|
|
46
|
+
export function flush() {
|
|
47
|
+
if (flushTimer) {
|
|
48
|
+
clearTimeout(flushTimer);
|
|
49
|
+
flushTimer = null;
|
|
50
|
+
}
|
|
51
|
+
if (!ON || buffer.length === 0)
|
|
52
|
+
return;
|
|
53
|
+
const lines = buffer;
|
|
54
|
+
buffer = [];
|
|
55
|
+
try {
|
|
56
|
+
mkdirSync(dirname(PATH), { recursive: true });
|
|
57
|
+
appendFileSync(PATH, `${lines.join("\n")}\n`, "utf8");
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// An instrument must never take the app down with it.
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Wrap `stdout.write` so every frame the renderer emits is timed and sized.
|
|
65
|
+
*
|
|
66
|
+
* This is the measurement that no probe could make. Ink erases and rewrites the drawn
|
|
67
|
+
* region on every state change, and how long the terminal takes to accept that is a
|
|
68
|
+
* property of the terminal — conhost, Windows Terminal, VS Code's, WSL — not of the
|
|
69
|
+
* code. If this number is large, no amount of layout work will fix the lag and the
|
|
70
|
+
* answer is to write less, less often.
|
|
71
|
+
*/
|
|
72
|
+
export function instrumentStdout(stream) {
|
|
73
|
+
if (!ON)
|
|
74
|
+
return;
|
|
75
|
+
const original = stream.write.bind(stream);
|
|
76
|
+
let n = 0;
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
|
+
stream.write = (chunk, ...rest) => {
|
|
79
|
+
const t0 = performance.now();
|
|
80
|
+
const result = original(chunk, ...rest);
|
|
81
|
+
const ms = performance.now() - t0;
|
|
82
|
+
const size = typeof chunk === "string" ? chunk.length : (chunk?.length ?? 0);
|
|
83
|
+
// Only the frames worth looking at. A TUI emits many tiny cursor moves and
|
|
84
|
+
// logging every one buries the writes that actually cost something.
|
|
85
|
+
if (size > 200 || ms > 1)
|
|
86
|
+
perf(`write bytes=${size} ms=${ms.toFixed(2)} n=${++n}`);
|
|
87
|
+
return result;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=perfLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"perfLog.js","sourceRoot":"","sources":["../../src/cli/perfLog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM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AAI,CAAC,EAAE;QAAE,OAAO;IAChB,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC3C,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,8DAA8D;IAC7D,MAAc,CAAC,KAAK,GAAG,CAAC,KAAU,EAAE,GAAG,IAAW,EAAE,EAAE;QACrD,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,IAAI,CAAC,CAAC;QACxC,MAAM,EAAE,GAAG,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC;QAClC,MAAM,IAAI,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;QAC7E,2EAA2E;QAC3E,oEAAoE;QACpE,IAAI,IAAI,GAAG,GAAG,IAAI,EAAE,GAAG,CAAC;YAAE,IAAI,CAAC,eAAe,IAAI,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAAC;QACnF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* reveal.ts — the pure decision for HOW to reveal a tool row.
|
|
3
|
+
*
|
|
4
|
+
* The old behavior revealed a tool the instant it started (a bare `● Run(cmd)`
|
|
5
|
+
* header) and only expanded its output — the `⎿` block — later, when the result
|
|
6
|
+
* landed. That reads as a two-step "header, then pop": jarring, and worse in a
|
|
7
|
+
* burst where every header shows first and every body expands at once.
|
|
8
|
+
*
|
|
9
|
+
* Instead we prefer to reveal a row ALREADY RESOLVED (header + output together, in
|
|
10
|
+
* one step). A just-started tool is held for a short grace window: if it finishes
|
|
11
|
+
* within it, the row appears complete; only a genuinely slower tool (still running
|
|
12
|
+
* after the grace) falls back to a running header so it never looks frozen. This
|
|
13
|
+
* function is the whole policy — pure, so it can be unit-tested away from timers.
|
|
14
|
+
*/
|
|
15
|
+
/** How long to hold a just-started tool before showing a running header, giving a
|
|
16
|
+
* fast tool the chance to finish so its row can appear already-resolved. Tunable. */
|
|
17
|
+
export const TOOL_GRACE_MS = 350;
|
|
18
|
+
/**
|
|
19
|
+
* Decide how to reveal a tool row.
|
|
20
|
+
* - result already available → "resolved" (the row appears complete at once).
|
|
21
|
+
* - flushing (Esc: drain with no pacing) and not resolved → "running" now.
|
|
22
|
+
* - still within the grace window → "hold" (come back once it resolves or grace ends).
|
|
23
|
+
* - grace elapsed and still running → "running" (a running header, expands later).
|
|
24
|
+
*/
|
|
25
|
+
export function planToolReveal(endAvailable, heldMs, graceMs, flush) {
|
|
26
|
+
if (endAvailable)
|
|
27
|
+
return "resolved";
|
|
28
|
+
if (flush)
|
|
29
|
+
return "running";
|
|
30
|
+
return heldMs >= graceMs ? "running" : "hold";
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=reveal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reveal.js","sourceRoot":"","sources":["../../src/cli/reveal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;sFACsF;AACtF,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AAOjC;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAC5B,YAAqB,EACrB,MAAc,EACd,OAAe,EACf,KAAc;IAEd,IAAI,YAAY;QAAE,OAAO,UAAU,CAAC;IACpC,IAAI,KAAK;QAAE,OAAO,SAAS,CAAC;IAC5B,OAAO,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* revealPace.ts — the tempo the transcript reveals at.
|
|
3
|
+
*
|
|
4
|
+
* A turn's events arrive in bursts, and this once held every block that appeared to a
|
|
5
|
+
* three-second beat so a burst of tool calls did not land at once. The reasoning was
|
|
6
|
+
* about perceived effort: a wait that shows work happening reads as deliberate rather
|
|
7
|
+
* than slow.
|
|
8
|
+
*
|
|
9
|
+
* IT DOES NOT. Used in anger it reads as an animation — words arriving with motion,
|
|
10
|
+
* the chat still moving after the work is done — which is the opposite of the
|
|
11
|
+
* impression it was aiming for. That was always the one thing here no test could
|
|
12
|
+
* settle, and the file said so: change it and re-run. It has now been run.
|
|
13
|
+
*
|
|
14
|
+
* The terminal agents that feel fastest pace nothing at all: no reveal delay, no
|
|
15
|
+
* typewriter, no gap between a block arriving and being painted. A tool that is quick
|
|
16
|
+
* should look quick.
|
|
17
|
+
*
|
|
18
|
+
* The mechanism is kept because it still SERIALISES: blocks reveal in order, one pump
|
|
19
|
+
* at a time, and Esc still flushes. Only the wait is gone.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* The beat, in milliseconds. Zero: content appears when it arrives.
|
|
23
|
+
*
|
|
24
|
+
* Left as a named constant rather than deleted along with the arithmetic, because the
|
|
25
|
+
* question it answers is a real one and a future change here should be a number, not a
|
|
26
|
+
* re-derivation. Anything above zero is visible as animation — that is measured by use,
|
|
27
|
+
* not by a test.
|
|
28
|
+
*/
|
|
29
|
+
export const REVEAL_GAP_MS = 0;
|
|
30
|
+
/**
|
|
31
|
+
* How long to hold before revealing the next block.
|
|
32
|
+
*
|
|
33
|
+
* Time already spent counts toward the beat, so a model that took four seconds
|
|
34
|
+
* between two tool calls pays nothing here — the rhythm was already right.
|
|
35
|
+
*/
|
|
36
|
+
export function revealWait({ now, lastRevealAt, flush }) {
|
|
37
|
+
if (flush)
|
|
38
|
+
return 0;
|
|
39
|
+
return Math.max(0, REVEAL_GAP_MS - (now - lastRevealAt));
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Whether unsealed narration is waiting, and would actually become a visible block.
|
|
43
|
+
*
|
|
44
|
+
* Streamed text accumulates silently and renders nothing until it seals (whole-block
|
|
45
|
+
* reveal, see transcript.ts), and `toolStart` seals it as part of its own action. So
|
|
46
|
+
* a sentence and the tool row it introduces reach the terminal in the SAME paint,
|
|
47
|
+
* landing together as one clump — the thing the beat exists to prevent, happening in
|
|
48
|
+
* the one place the pacer could not see.
|
|
49
|
+
*
|
|
50
|
+
* Sealing it on its own beat first lets the sentence land alone and be read before
|
|
51
|
+
* the row arrives under it. That is worth a beat only when a block will actually
|
|
52
|
+
* appear, which is why `narrated` is checked here: the narration budget is one line
|
|
53
|
+
* per TURN, so a second sentence seals to nothing (sealAssistant's `suppressed`) and
|
|
54
|
+
* pausing for it would buy an empty three seconds.
|
|
55
|
+
*/
|
|
56
|
+
export function narrationPending(s) {
|
|
57
|
+
return s.openAsstId !== null && !s.narrated && s.raw.trim().length > 0;
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=revealPace.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revealPace.js","sourceRoot":"","sources":["../../src/cli/revealPace.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC;AAW/B;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAa;IAChE,IAAI,KAAK;QAAE,OAAO,CAAC,CAAC;IACpB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,aAAa,GAAG,CAAC,GAAG,GAAG,YAAY,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,gBAAgB,CAAC,CAAgE;IAC/F,OAAO,CAAC,CAAC,UAAU,KAAK,IAAI,IAAI,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;AACzE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Move the parts of `from` that belong to the folder rather than to the conversation
|
|
3
|
+
* onto `to`, in place.
|
|
4
|
+
*
|
|
5
|
+
* Deliberately NOT carried, each for its own reason:
|
|
6
|
+
* - `reads` / working set — the new conversation has told the model nothing, so a
|
|
7
|
+
* ledger claiming files are already in context would make it skip reading them.
|
|
8
|
+
* - `backgroundShells` — they belong to the old context and nothing in the new one
|
|
9
|
+
* could reach or stop them; the caller kills them and says how many.
|
|
10
|
+
* - `todos` — a task list for work the model can no longer see.
|
|
11
|
+
* - `mcp` / `chassisByRoot` — real child processes, already disposed and rebuilt.
|
|
12
|
+
*/
|
|
13
|
+
export function carryAcrossFreshSession(from, to) {
|
|
14
|
+
// The instance itself, not a copy: it holds file bytes keyed by path, and a
|
|
15
|
+
// half-copied undo stack is worse than none.
|
|
16
|
+
if (from.checkpoints)
|
|
17
|
+
to.checkpoints = from.checkpoints;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=sessionCarry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sessionCarry.js","sourceRoot":"","sources":["../../src/cli/sessionCarry.ts"],"names":[],"mappings":"AAoBA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAiB,EAAE,EAAe;IACxE,4EAA4E;IAC5E,6CAA6C;IAC7C,IAAI,IAAI,CAAC,WAAW;QAAE,EAAE,CAAC,WAAW,GAAG,IAAI,CAAC,WAAW,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* smoothScroll.ts — the scroll travels to where it was sent, instead of teleporting.
|
|
3
|
+
*
|
|
4
|
+
* A wheel notch used to move the transcript three lines in a single frame. Mechanically
|
|
5
|
+
* correct, and it reads as a jerk: the eye has nothing to track between the two
|
|
6
|
+
* positions, so a flick of the wheel becomes a stack of discrete jumps rather than
|
|
7
|
+
* movement. Gemini CLI's ScrollableList solves it the same way this does, with the same
|
|
8
|
+
* numbers — an ease-in-out cubic run over ~200ms at ~30fps, driving the same `scrollTo`
|
|
9
|
+
* the instant version called.
|
|
10
|
+
*
|
|
11
|
+
* This module is only the arithmetic, deliberately: no timers, no state, no React. The
|
|
12
|
+
* caller owns the clock and asks "where should the scroll be at this instant", which is
|
|
13
|
+
* what makes the easing testable without rendering anything or waiting for real time.
|
|
14
|
+
*
|
|
15
|
+
* NOTE ON WHY THIS IS NOT A REGRESSION OF THE FROZEN SCROLL MECHANISM. It does not
|
|
16
|
+
* change where the scroll ends up, ever — `target` is exactly the value the old code
|
|
17
|
+
* assigned directly, and the animation always terminates on it (`progress >= 1` returns
|
|
18
|
+
* `to` itself, not an interpolation that might land a fraction short). All it changes is
|
|
19
|
+
* the values passed through on the way there.
|
|
20
|
+
*/
|
|
21
|
+
/** Total travel time for one scroll, in milliseconds. */
|
|
22
|
+
export const SCROLL_ANIM_MS = 200;
|
|
23
|
+
/** Interval between animation frames, in milliseconds — about 30fps. Matching Ink's
|
|
24
|
+
* own ~32ms render throttle: asking for frames faster than the renderer will draw
|
|
25
|
+
* them buys nothing and costs a timer wakeup each time. */
|
|
26
|
+
export const SCROLL_FRAME_MS = 33;
|
|
27
|
+
/**
|
|
28
|
+
* Ease-in-out cubic.
|
|
29
|
+
*
|
|
30
|
+
* Slow at both ends and quickest through the middle, which is what makes the movement
|
|
31
|
+
* read as one gesture rather than a start and a stop. Linear interpolation was tried
|
|
32
|
+
* first and is visibly worse: it begins and ends abruptly, so it looks like a jump with
|
|
33
|
+
* extra steps.
|
|
34
|
+
*/
|
|
35
|
+
export function ease(t) {
|
|
36
|
+
const p = Math.min(1, Math.max(0, t));
|
|
37
|
+
return p < 0.5 ? 4 * p * p * p : 1 - Math.pow(-2 * p + 2, 3) / 2;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Where the scroll should be at `now`, in lines.
|
|
41
|
+
*
|
|
42
|
+
* Returns a whole number of lines because the transcript can only be offset by whole
|
|
43
|
+
* rows — a fractional offset would be rounded by the renderer anyway, and rounding here
|
|
44
|
+
* means the caller can compare against the current value and skip a render when the
|
|
45
|
+
* frame would be identical.
|
|
46
|
+
*/
|
|
47
|
+
export function scrollAt(anim, now) {
|
|
48
|
+
const elapsed = now - anim.startedAt;
|
|
49
|
+
// Land exactly on the target rather than on an interpolation of it. Guarantees the
|
|
50
|
+
// animation cannot finish a line short of where it was sent, which over a few flicks
|
|
51
|
+
// would drift the view somewhere the user never scrolled to.
|
|
52
|
+
if (elapsed >= SCROLL_ANIM_MS)
|
|
53
|
+
return anim.to;
|
|
54
|
+
if (elapsed <= 0)
|
|
55
|
+
return anim.from;
|
|
56
|
+
return Math.round(anim.from + (anim.to - anim.from) * ease(elapsed / SCROLL_ANIM_MS));
|
|
57
|
+
}
|
|
58
|
+
/** Whether the animation has reached its target and the timer can stop. */
|
|
59
|
+
export function scrollDone(anim, now) {
|
|
60
|
+
return now - anim.startedAt >= SCROLL_ANIM_MS;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Start (or redirect) an animation towards `to`.
|
|
64
|
+
*
|
|
65
|
+
* A wheel flick sends several notches in quick succession, and each one must extend the
|
|
66
|
+
* gesture rather than restart it: the new animation begins from where the previous one
|
|
67
|
+
* had actually reached, so the movement stays continuous instead of snapping back to an
|
|
68
|
+
* older position and re-running. This is the whole reason `current` is a parameter
|
|
69
|
+
* rather than being read from the previous animation's `from`.
|
|
70
|
+
*/
|
|
71
|
+
export function retarget(current, to, now) {
|
|
72
|
+
return { from: current, to, startedAt: now };
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=smoothScroll.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smoothScroll.js","sourceRoot":"","sources":["../../src/cli/smoothScroll.ts"],"names":[],"mappings":"AAAA;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