@hansjm10/volt-coding-agent 0.0.0-bootstrap.0 → 0.1.0
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/BINARY-CAPABILITIES.md +28 -0
- package/CHANGELOG.md +4845 -0
- package/LICENSE +1 -1
- package/README.md +716 -3
- package/THIRD-PARTY-NOTICES.md +55 -0
- package/dist/LICENSES/clipboard-image-MIT.txt +9 -0
- package/dist/LICENSES/highlight.js-10.7.3-BSD-3-Clause.txt +29 -0
- package/dist/LICENSES/highlight.js-11.9.0-BSD-3-Clause.txt +29 -0
- package/dist/LICENSES/marked-18.0.5-LICENSE.txt +44 -0
- package/dist/LICENSES/run-jxa-MIT.txt +9 -0
- package/dist/cli/args.d.ts +60 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +414 -0
- package/dist/cli/args.js.map +1 -0
- package/dist/cli/config-selector.d.ts +14 -0
- package/dist/cli/config-selector.d.ts.map +1 -0
- package/dist/cli/config-selector.js +31 -0
- package/dist/cli/config-selector.js.map +1 -0
- package/dist/cli/file-processor.d.ts +15 -0
- package/dist/cli/file-processor.d.ts.map +1 -0
- package/dist/cli/file-processor.js +85 -0
- package/dist/cli/file-processor.js.map +1 -0
- package/dist/cli/initial-message.d.ts +18 -0
- package/dist/cli/initial-message.d.ts.map +1 -0
- package/dist/cli/initial-message.js +22 -0
- package/dist/cli/initial-message.js.map +1 -0
- package/dist/cli/list-models.d.ts +9 -0
- package/dist/cli/list-models.d.ts.map +1 -0
- package/dist/cli/list-models.js +98 -0
- package/dist/cli/list-models.js.map +1 -0
- package/dist/cli/project-trust.d.ts +10 -0
- package/dist/cli/project-trust.d.ts.map +1 -0
- package/dist/cli/project-trust.js +48 -0
- package/dist/cli/project-trust.js.map +1 -0
- package/dist/cli/session-picker.d.ts +9 -0
- package/dist/cli/session-picker.d.ts.map +1 -0
- package/dist/cli/session-picker.js +35 -0
- package/dist/cli/session-picker.js.map +1 -0
- package/dist/cli/startup-ui.d.ts +17 -0
- package/dist/cli/startup-ui.d.ts.map +1 -0
- package/dist/cli/startup-ui.js +133 -0
- package/dist/cli/startup-ui.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +18 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +85 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +487 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session-runtime.d.ts +160 -0
- package/dist/core/agent-session-runtime.d.ts.map +1 -0
- package/dist/core/agent-session-runtime.js +397 -0
- package/dist/core/agent-session-runtime.js.map +1 -0
- package/dist/core/agent-session-services.d.ts +98 -0
- package/dist/core/agent-session-services.d.ts.map +1 -0
- package/dist/core/agent-session-services.js +125 -0
- package/dist/core/agent-session-services.js.map +1 -0
- package/dist/core/agent-session.d.ts +739 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +3158 -0
- package/dist/core/agent-session.js.map +1 -0
- package/dist/core/auth-guidance.d.ts +5 -0
- package/dist/core/auth-guidance.d.ts.map +1 -0
- package/dist/core/auth-guidance.js +21 -0
- package/dist/core/auth-guidance.js.map +1 -0
- package/dist/core/auth-storage.d.ts +159 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +509 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +32 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +111 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +92 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +257 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +121 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +658 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/index.d.ts +7 -0
- package/dist/core/compaction/index.d.ts.map +1 -0
- package/dist/core/compaction/index.js +7 -0
- package/dist/core/compaction/index.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +56 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +271 -0
- package/dist/core/compaction/utils.js.map +1 -0
- package/dist/core/defaults.d.ts +3 -0
- package/dist/core/defaults.d.ts.map +1 -0
- package/dist/core/defaults.js +2 -0
- package/dist/core/defaults.js.map +1 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.d.ts.map +1 -0
- package/dist/core/diagnostics.js +2 -0
- package/dist/core/diagnostics.js.map +1 -0
- package/dist/core/event-bus.d.ts +9 -0
- package/dist/core/event-bus.d.ts.map +1 -0
- package/dist/core/event-bus.js +25 -0
- package/dist/core/event-bus.js.map +1 -0
- package/dist/core/exec.d.ts +29 -0
- package/dist/core/exec.d.ts.map +1 -0
- package/dist/core/exec.js +75 -0
- package/dist/core/exec.js.map +1 -0
- package/dist/core/experimental.d.ts +2 -0
- package/dist/core/experimental.d.ts.map +1 -0
- package/dist/core/experimental.js +4 -0
- package/dist/core/experimental.js.map +1 -0
- package/dist/core/export-html/ansi-to-html.d.ts +22 -0
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -0
- package/dist/core/export-html/ansi-to-html.js +249 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +37 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +234 -0
- package/dist/core/export-html/index.js.map +1 -0
- package/dist/core/export-html/template.css +1066 -0
- package/dist/core/export-html/template.html +55 -0
- package/dist/core/export-html/template.js +1864 -0
- package/dist/core/export-html/tool-renderer.d.ts +34 -0
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -0
- package/dist/core/export-html/tool-renderer.js +108 -0
- package/dist/core/export-html/tool-renderer.js.map +1 -0
- package/dist/core/export-html/vendor/highlight.min.js +1213 -0
- package/dist/core/export-html/vendor/marked.min.js +78 -0
- package/dist/core/extensions/index.d.ts +12 -0
- package/dist/core/extensions/index.d.ts.map +1 -0
- package/dist/core/extensions/index.js +9 -0
- package/dist/core/extensions/index.js.map +1 -0
- package/dist/core/extensions/loader.d.ts +25 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +516 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +180 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +938 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1215 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +48 -0
- package/dist/core/extensions/types.js.map +1 -0
- package/dist/core/extensions/wrapper.d.ts +20 -0
- package/dist/core/extensions/wrapper.d.ts.map +1 -0
- package/dist/core/extensions/wrapper.js +22 -0
- package/dist/core/extensions/wrapper.js.map +1 -0
- package/dist/core/footer-data-provider.d.ts +54 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +338 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/host-actions.d.ts +107 -0
- package/dist/core/host-actions.d.ts.map +1 -0
- package/dist/core/host-actions.js +632 -0
- package/dist/core/host-actions.js.map +1 -0
- package/dist/core/host-interaction.d.ts +35 -0
- package/dist/core/host-interaction.d.ts.map +1 -0
- package/dist/core/host-interaction.js +2 -0
- package/dist/core/host-interaction.js.map +1 -0
- package/dist/core/http-dispatcher.d.ts +22 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +64 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/index.d.ts +18 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +17 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/keybindings.d.ts +373 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +303 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/lsp/client.d.ts +119 -0
- package/dist/core/lsp/client.d.ts.map +1 -0
- package/dist/core/lsp/client.js +711 -0
- package/dist/core/lsp/client.js.map +1 -0
- package/dist/core/lsp/config.d.ts +96 -0
- package/dist/core/lsp/config.d.ts.map +1 -0
- package/dist/core/lsp/config.js +206 -0
- package/dist/core/lsp/config.js.map +1 -0
- package/dist/core/lsp/index.d.ts +6 -0
- package/dist/core/lsp/index.d.ts.map +1 -0
- package/dist/core/lsp/index.js +6 -0
- package/dist/core/lsp/index.js.map +1 -0
- package/dist/core/lsp/manager.d.ts +122 -0
- package/dist/core/lsp/manager.d.ts.map +1 -0
- package/dist/core/lsp/manager.js +1136 -0
- package/dist/core/lsp/manager.js.map +1 -0
- package/dist/core/lsp/trace.d.ts +26 -0
- package/dist/core/lsp/trace.d.ts.map +1 -0
- package/dist/core/lsp/trace.js +98 -0
- package/dist/core/lsp/trace.js.map +1 -0
- package/dist/core/lsp/workspace-edit.d.ts +60 -0
- package/dist/core/lsp/workspace-edit.d.ts.map +1 -0
- package/dist/core/lsp/workspace-edit.js +71 -0
- package/dist/core/lsp/workspace-edit.js.map +1 -0
- package/dist/core/mcp/audit.d.ts +39 -0
- package/dist/core/mcp/audit.d.ts.map +1 -0
- package/dist/core/mcp/audit.js +35 -0
- package/dist/core/mcp/audit.js.map +1 -0
- package/dist/core/mcp/auth.d.ts +7 -0
- package/dist/core/mcp/auth.d.ts.map +1 -0
- package/dist/core/mcp/auth.js +56 -0
- package/dist/core/mcp/auth.js.map +1 -0
- package/dist/core/mcp/client-factory.d.ts +20 -0
- package/dist/core/mcp/client-factory.d.ts.map +1 -0
- package/dist/core/mcp/client-factory.js +200 -0
- package/dist/core/mcp/client-factory.js.map +1 -0
- package/dist/core/mcp/config-loader.d.ts +9 -0
- package/dist/core/mcp/config-loader.d.ts.map +1 -0
- package/dist/core/mcp/config-loader.js +104 -0
- package/dist/core/mcp/config-loader.js.map +1 -0
- package/dist/core/mcp/config-writer.d.ts +21 -0
- package/dist/core/mcp/config-writer.d.ts.map +1 -0
- package/dist/core/mcp/config-writer.js +124 -0
- package/dist/core/mcp/config-writer.js.map +1 -0
- package/dist/core/mcp/config.d.ts +32 -0
- package/dist/core/mcp/config.d.ts.map +1 -0
- package/dist/core/mcp/config.js +385 -0
- package/dist/core/mcp/config.js.map +1 -0
- package/dist/core/mcp/direct-tools.d.ts +11 -0
- package/dist/core/mcp/direct-tools.d.ts.map +1 -0
- package/dist/core/mcp/direct-tools.js +47 -0
- package/dist/core/mcp/direct-tools.js.map +1 -0
- package/dist/core/mcp/gateway-tool.d.ts +29 -0
- package/dist/core/mcp/gateway-tool.d.ts.map +1 -0
- package/dist/core/mcp/gateway-tool.js +108 -0
- package/dist/core/mcp/gateway-tool.js.map +1 -0
- package/dist/core/mcp/index.d.ts +19 -0
- package/dist/core/mcp/index.d.ts.map +1 -0
- package/dist/core/mcp/index.js +18 -0
- package/dist/core/mcp/index.js.map +1 -0
- package/dist/core/mcp/manager.d.ts +117 -0
- package/dist/core/mcp/manager.d.ts.map +1 -0
- package/dist/core/mcp/manager.js +819 -0
- package/dist/core/mcp/manager.js.map +1 -0
- package/dist/core/mcp/metadata-cache.d.ts +27 -0
- package/dist/core/mcp/metadata-cache.d.ts.map +1 -0
- package/dist/core/mcp/metadata-cache.js +152 -0
- package/dist/core/mcp/metadata-cache.js.map +1 -0
- package/dist/core/mcp/oauth-flow.d.ts +94 -0
- package/dist/core/mcp/oauth-flow.d.ts.map +1 -0
- package/dist/core/mcp/oauth-flow.js +473 -0
- package/dist/core/mcp/oauth-flow.js.map +1 -0
- package/dist/core/mcp/oauth-provider.d.ts +39 -0
- package/dist/core/mcp/oauth-provider.d.ts.map +1 -0
- package/dist/core/mcp/oauth-provider.js +149 -0
- package/dist/core/mcp/oauth-provider.js.map +1 -0
- package/dist/core/mcp/oauth-store.d.ts +27 -0
- package/dist/core/mcp/oauth-store.d.ts.map +1 -0
- package/dist/core/mcp/oauth-store.js +111 -0
- package/dist/core/mcp/oauth-store.js.map +1 -0
- package/dist/core/mcp/output-store.d.ts +55 -0
- package/dist/core/mcp/output-store.d.ts.map +1 -0
- package/dist/core/mcp/output-store.js +206 -0
- package/dist/core/mcp/output-store.js.map +1 -0
- package/dist/core/mcp/rpc.d.ts +13 -0
- package/dist/core/mcp/rpc.d.ts.map +1 -0
- package/dist/core/mcp/rpc.js +29 -0
- package/dist/core/mcp/rpc.js.map +1 -0
- package/dist/core/mcp/safety.d.ts +6 -0
- package/dist/core/mcp/safety.d.ts.map +1 -0
- package/dist/core/mcp/safety.js +65 -0
- package/dist/core/mcp/safety.js.map +1 -0
- package/dist/core/mcp/search.d.ts +8 -0
- package/dist/core/mcp/search.d.ts.map +1 -0
- package/dist/core/mcp/search.js +85 -0
- package/dist/core/mcp/search.js.map +1 -0
- package/dist/core/mcp/server-supervisor.d.ts +59 -0
- package/dist/core/mcp/server-supervisor.d.ts.map +1 -0
- package/dist/core/mcp/server-supervisor.js +331 -0
- package/dist/core/mcp/server-supervisor.js.map +1 -0
- package/dist/core/mcp/types.d.ts +321 -0
- package/dist/core/mcp/types.d.ts.map +1 -0
- package/dist/core/mcp/types.js +2 -0
- package/dist/core/mcp/types.js.map +1 -0
- package/dist/core/messages.d.ts +78 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +138 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-catalog-watcher.d.ts +36 -0
- package/dist/core/model-catalog-watcher.d.ts.map +1 -0
- package/dist/core/model-catalog-watcher.js +101 -0
- package/dist/core/model-catalog-watcher.js.map +1 -0
- package/dist/core/model-registry.d.ts +160 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +754 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +111 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +534 -0
- package/dist/core/model-resolver.js.map +1 -0
- package/dist/core/output-guard.d.ts +7 -0
- package/dist/core/output-guard.d.ts.map +1 -0
- package/dist/core/output-guard.js +89 -0
- package/dist/core/output-guard.js.map +1 -0
- package/dist/core/package-manager.d.ts +220 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +2217 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/project-trust.d.ts +15 -0
- package/dist/core/project-trust.d.ts.map +1 -0
- package/dist/core/project-trust.js +58 -0
- package/dist/core/project-trust.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +53 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +236 -0
- package/dist/core/prompt-templates.js.map +1 -0
- package/dist/core/provider-attribution.d.ts +4 -0
- package/dist/core/provider-attribution.d.ts.map +1 -0
- package/dist/core/provider-attribution.js +81 -0
- package/dist/core/provider-attribution.js.map +1 -0
- package/dist/core/provider-display-names.d.ts +2 -0
- package/dist/core/provider-display-names.d.ts.map +1 -0
- package/dist/core/provider-display-names.js +36 -0
- package/dist/core/provider-display-names.js.map +1 -0
- package/dist/core/remote/iroh/access-grant.d.ts +40 -0
- package/dist/core/remote/iroh/access-grant.d.ts.map +1 -0
- package/dist/core/remote/iroh/access-grant.js +199 -0
- package/dist/core/remote/iroh/access-grant.js.map +1 -0
- package/dist/core/remote/iroh/active-stream-registry.d.ts +39 -0
- package/dist/core/remote/iroh/active-stream-registry.d.ts.map +1 -0
- package/dist/core/remote/iroh/active-stream-registry.js +109 -0
- package/dist/core/remote/iroh/active-stream-registry.js.map +1 -0
- package/dist/core/remote/iroh/audit.d.ts +67 -0
- package/dist/core/remote/iroh/audit.d.ts.map +1 -0
- package/dist/core/remote/iroh/audit.js +274 -0
- package/dist/core/remote/iroh/audit.js.map +1 -0
- package/dist/core/remote/iroh/authorization.d.ts +46 -0
- package/dist/core/remote/iroh/authorization.d.ts.map +1 -0
- package/dist/core/remote/iroh/authorization.js +327 -0
- package/dist/core/remote/iroh/authorization.js.map +1 -0
- package/dist/core/remote/iroh/control.d.ts +64 -0
- package/dist/core/remote/iroh/control.d.ts.map +1 -0
- package/dist/core/remote/iroh/control.js +326 -0
- package/dist/core/remote/iroh/control.js.map +1 -0
- package/dist/core/remote/iroh/device-log-rpc.d.ts +22 -0
- package/dist/core/remote/iroh/device-log-rpc.d.ts.map +1 -0
- package/dist/core/remote/iroh/device-log-rpc.js +152 -0
- package/dist/core/remote/iroh/device-log-rpc.js.map +1 -0
- package/dist/core/remote/iroh/engine.d.ts +148 -0
- package/dist/core/remote/iroh/engine.d.ts.map +1 -0
- package/dist/core/remote/iroh/engine.js +499 -0
- package/dist/core/remote/iroh/engine.js.map +1 -0
- package/dist/core/remote/iroh/handshake-reader.d.ts +19 -0
- package/dist/core/remote/iroh/handshake-reader.d.ts.map +1 -0
- package/dist/core/remote/iroh/handshake-reader.js +91 -0
- package/dist/core/remote/iroh/handshake-reader.js.map +1 -0
- package/dist/core/remote/iroh/handshake.d.ts +119 -0
- package/dist/core/remote/iroh/handshake.d.ts.map +1 -0
- package/dist/core/remote/iroh/handshake.js +621 -0
- package/dist/core/remote/iroh/handshake.js.map +1 -0
- package/dist/core/remote/iroh/host-policy.d.ts +13 -0
- package/dist/core/remote/iroh/host-policy.d.ts.map +1 -0
- package/dist/core/remote/iroh/host-policy.js +15 -0
- package/dist/core/remote/iroh/host-policy.js.map +1 -0
- package/dist/core/remote/iroh/index.d.ts +25 -0
- package/dist/core/remote/iroh/index.d.ts.map +1 -0
- package/dist/core/remote/iroh/index.js +25 -0
- package/dist/core/remote/iroh/index.js.map +1 -0
- package/dist/core/remote/iroh/metadata.d.ts +28 -0
- package/dist/core/remote/iroh/metadata.d.ts.map +1 -0
- package/dist/core/remote/iroh/metadata.js +16 -0
- package/dist/core/remote/iroh/metadata.js.map +1 -0
- package/dist/core/remote/iroh/outbound-filter.d.ts +29 -0
- package/dist/core/remote/iroh/outbound-filter.d.ts.map +1 -0
- package/dist/core/remote/iroh/outbound-filter.js +692 -0
- package/dist/core/remote/iroh/outbound-filter.js.map +1 -0
- package/dist/core/remote/iroh/protocol.d.ts +60 -0
- package/dist/core/remote/iroh/protocol.d.ts.map +1 -0
- package/dist/core/remote/iroh/protocol.js +204 -0
- package/dist/core/remote/iroh/protocol.js.map +1 -0
- package/dist/core/remote/iroh/push.d.ts +179 -0
- package/dist/core/remote/iroh/push.d.ts.map +1 -0
- package/dist/core/remote/iroh/push.js +662 -0
- package/dist/core/remote/iroh/push.js.map +1 -0
- package/dist/core/remote/iroh/qr.d.ts +12 -0
- package/dist/core/remote/iroh/qr.d.ts.map +1 -0
- package/dist/core/remote/iroh/qr.js +27 -0
- package/dist/core/remote/iroh/qr.js.map +1 -0
- package/dist/core/remote/iroh/rpc-command-filter.d.ts +47 -0
- package/dist/core/remote/iroh/rpc-command-filter.d.ts.map +1 -0
- package/dist/core/remote/iroh/rpc-command-filter.js +188 -0
- package/dist/core/remote/iroh/rpc-command-filter.js.map +1 -0
- package/dist/core/remote/iroh/rpc-transport.d.ts +21 -0
- package/dist/core/remote/iroh/rpc-transport.d.ts.map +1 -0
- package/dist/core/remote/iroh/rpc-transport.js +106 -0
- package/dist/core/remote/iroh/rpc-transport.js.map +1 -0
- package/dist/core/remote/iroh/state-manager.d.ts +141 -0
- package/dist/core/remote/iroh/state-manager.d.ts.map +1 -0
- package/dist/core/remote/iroh/state-manager.js +744 -0
- package/dist/core/remote/iroh/state-manager.js.map +1 -0
- package/dist/core/remote/iroh/state.d.ts +141 -0
- package/dist/core/remote/iroh/state.d.ts.map +1 -0
- package/dist/core/remote/iroh/state.js +433 -0
- package/dist/core/remote/iroh/state.js.map +1 -0
- package/dist/core/remote/iroh/ticket.d.ts +46 -0
- package/dist/core/remote/iroh/ticket.d.ts.map +1 -0
- package/dist/core/remote/iroh/ticket.js +267 -0
- package/dist/core/remote/iroh/ticket.js.map +1 -0
- package/dist/core/remote/iroh/transcript-text.d.ts +8 -0
- package/dist/core/remote/iroh/transcript-text.d.ts.map +1 -0
- package/dist/core/remote/iroh/transcript-text.js +26 -0
- package/dist/core/remote/iroh/transcript-text.js.map +1 -0
- package/dist/core/remote/iroh/workspace-rpc.d.ts +31 -0
- package/dist/core/remote/iroh/workspace-rpc.d.ts.map +1 -0
- package/dist/core/remote/iroh/workspace-rpc.js +73 -0
- package/dist/core/remote/iroh/workspace-rpc.js.map +1 -0
- package/dist/core/remote/iroh/workspace.d.ts +16 -0
- package/dist/core/remote/iroh/workspace.d.ts.map +1 -0
- package/dist/core/remote/iroh/workspace.js +104 -0
- package/dist/core/remote/iroh/workspace.js.map +1 -0
- package/dist/core/remote/iroh/worktree-rpc.d.ts +83 -0
- package/dist/core/remote/iroh/worktree-rpc.d.ts.map +1 -0
- package/dist/core/remote/iroh/worktree-rpc.js +148 -0
- package/dist/core/remote/iroh/worktree-rpc.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +30 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +245 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +214 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +824 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/review.d.ts +318 -0
- package/dist/core/review.d.ts.map +1 -0
- package/dist/core/review.js +1271 -0
- package/dist/core/review.js.map +1 -0
- package/dist/core/rpc/duplex-write-gate.d.ts +29 -0
- package/dist/core/rpc/duplex-write-gate.d.ts.map +1 -0
- package/dist/core/rpc/duplex-write-gate.js +124 -0
- package/dist/core/rpc/duplex-write-gate.js.map +1 -0
- package/dist/core/rpc/index.d.ts +6 -0
- package/dist/core/rpc/index.d.ts.map +1 -0
- package/dist/core/rpc/index.js +5 -0
- package/dist/core/rpc/index.js.map +1 -0
- package/dist/core/rpc/iroh-transport.d.ts +58 -0
- package/dist/core/rpc/iroh-transport.d.ts.map +1 -0
- package/dist/core/rpc/iroh-transport.js +278 -0
- package/dist/core/rpc/iroh-transport.js.map +1 -0
- package/dist/core/rpc/jsonl.d.ts +17 -0
- package/dist/core/rpc/jsonl.d.ts.map +1 -0
- package/dist/core/rpc/jsonl.js +49 -0
- package/dist/core/rpc/jsonl.js.map +1 -0
- package/dist/core/rpc/loopback-transport.d.ts +14 -0
- package/dist/core/rpc/loopback-transport.d.ts.map +1 -0
- package/dist/core/rpc/loopback-transport.js +120 -0
- package/dist/core/rpc/loopback-transport.js.map +1 -0
- package/dist/core/rpc/transcript.d.ts +37 -0
- package/dist/core/rpc/transcript.d.ts.map +1 -0
- package/dist/core/rpc/transcript.js +624 -0
- package/dist/core/rpc/transcript.js.map +1 -0
- package/dist/core/rpc/transport.d.ts +41 -0
- package/dist/core/rpc/transport.d.ts.map +1 -0
- package/dist/core/rpc/transport.js +155 -0
- package/dist/core/rpc/transport.js.map +1 -0
- package/dist/core/rpc/types.d.ts +1254 -0
- package/dist/core/rpc/types.d.ts.map +1 -0
- package/dist/core/rpc/types.js +8 -0
- package/dist/core/rpc/types.js.map +1 -0
- package/dist/core/rpc/ui-action-args.d.ts +3 -0
- package/dist/core/rpc/ui-action-args.d.ts.map +1 -0
- package/dist/core/rpc/ui-action-args.js +66 -0
- package/dist/core/rpc/ui-action-args.js.map +1 -0
- package/dist/core/rpc/ui-actions.d.ts +43 -0
- package/dist/core/rpc/ui-actions.d.ts.map +1 -0
- package/dist/core/rpc/ui-actions.js +362 -0
- package/dist/core/rpc/ui-actions.js.map +1 -0
- package/dist/core/sdk.d.ts +138 -0
- package/dist/core/sdk.d.ts.map +1 -0
- package/dist/core/sdk.js +324 -0
- package/dist/core/sdk.js.map +1 -0
- package/dist/core/session-cwd.d.ts +19 -0
- package/dist/core/session-cwd.d.ts.map +1 -0
- package/dist/core/session-cwd.js +38 -0
- package/dist/core/session-cwd.js.map +1 -0
- package/dist/core/session-manager.d.ts +346 -0
- package/dist/core/session-manager.d.ts.map +1 -0
- package/dist/core/session-manager.js +1280 -0
- package/dist/core/session-manager.js.map +1 -0
- package/dist/core/settings-manager.d.ts +359 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +1277 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +60 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +387 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +14 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +51 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/source-info.d.ts +18 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +19 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/subagents/delegation-scope.d.ts +47 -0
- package/dist/core/subagents/delegation-scope.d.ts.map +1 -0
- package/dist/core/subagents/delegation-scope.js +134 -0
- package/dist/core/subagents/delegation-scope.js.map +1 -0
- package/dist/core/subagents/index.d.ts +46 -0
- package/dist/core/subagents/index.d.ts.map +1 -0
- package/dist/core/subagents/index.js +369 -0
- package/dist/core/subagents/index.js.map +1 -0
- package/dist/core/subagents/manager.d.ts +183 -0
- package/dist/core/subagents/manager.d.ts.map +1 -0
- package/dist/core/subagents/manager.js +820 -0
- package/dist/core/subagents/manager.js.map +1 -0
- package/dist/core/system-prompt.d.ts +28 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +180 -0
- package/dist/core/system-prompt.js.map +1 -0
- package/dist/core/telemetry.d.ts +3 -0
- package/dist/core/telemetry.d.ts.map +1 -0
- package/dist/core/telemetry.js +9 -0
- package/dist/core/telemetry.js.map +1 -0
- package/dist/core/theme/dark.json +86 -0
- package/dist/core/theme/discovery.d.ts +48 -0
- package/dist/core/theme/discovery.d.ts.map +1 -0
- package/dist/core/theme/discovery.js +239 -0
- package/dist/core/theme/discovery.js.map +1 -0
- package/dist/core/theme/index.d.ts +6 -0
- package/dist/core/theme/index.d.ts.map +1 -0
- package/dist/core/theme/index.js +5 -0
- package/dist/core/theme/index.js.map +1 -0
- package/dist/core/theme/light.json +85 -0
- package/dist/core/theme/runtime.d.ts +55 -0
- package/dist/core/theme/runtime.d.ts.map +1 -0
- package/dist/core/theme/runtime.js +555 -0
- package/dist/core/theme/runtime.js.map +1 -0
- package/dist/core/theme/theme-schema.json +335 -0
- package/dist/core/theme/theme-service.d.ts +37 -0
- package/dist/core/theme/theme-service.d.ts.map +1 -0
- package/dist/core/theme/theme-service.js +222 -0
- package/dist/core/theme/theme-service.js.map +1 -0
- package/dist/core/theme/theme.d.ts +100 -0
- package/dist/core/theme/theme.d.ts.map +1 -0
- package/dist/core/theme/theme.js +243 -0
- package/dist/core/theme/theme.js.map +1 -0
- package/dist/core/theme/tokens.d.ts +20 -0
- package/dist/core/theme/tokens.d.ts.map +1 -0
- package/dist/core/theme/tokens.js +178 -0
- package/dist/core/theme/tokens.js.map +1 -0
- package/dist/core/theme/types.d.ts +21 -0
- package/dist/core/theme/types.d.ts.map +1 -0
- package/dist/core/theme/types.js +2 -0
- package/dist/core/theme/types.js.map +1 -0
- package/dist/core/timings.d.ts +8 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +31 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +68 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +345 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/diagnostics-provider.d.ts +12 -0
- package/dist/core/tools/diagnostics-provider.d.ts.map +1 -0
- package/dist/core/tools/diagnostics-provider.js +2 -0
- package/dist/core/tools/diagnostics-provider.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +77 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +506 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +56 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +300 -0
- package/dist/core/tools/edit.js.map +1 -0
- package/dist/core/tools/file-mutation-queue.d.ts +6 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +52 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +35 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +337 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +37 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +305 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/index.d.ts +56 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +174 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +37 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +167 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/lsp.d.ts +59 -0
- package/dist/core/tools/lsp.d.ts.map +1 -0
- package/dist/core/tools/lsp.js +157 -0
- package/dist/core/tools/lsp.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +52 -0
- package/dist/core/tools/output-accumulator.d.ts.map +1 -0
- package/dist/core/tools/output-accumulator.js +184 -0
- package/dist/core/tools/output-accumulator.js.map +1 -0
- package/dist/core/tools/path-utils.d.ts +10 -0
- package/dist/core/tools/path-utils.d.ts.map +1 -0
- package/dist/core/tools/path-utils.js +99 -0
- package/dist/core/tools/path-utils.js.map +1 -0
- package/dist/core/tools/read.d.ts +35 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +292 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +26 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +69 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/subagent.d.ts +219 -0
- package/dist/core/tools/subagent.d.ts.map +1 -0
- package/dist/core/tools/subagent.js +1445 -0
- package/dist/core/tools/subagent.js.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts +14 -0
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -0
- package/dist/core/tools/tool-definition-wrapper.js +34 -0
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -0
- package/dist/core/tools/truncate.d.ts +70 -0
- package/dist/core/tools/truncate.d.ts.map +1 -0
- package/dist/core/tools/truncate.js +215 -0
- package/dist/core/tools/truncate.js.map +1 -0
- package/dist/core/tools/web-search.d.ts +69 -0
- package/dist/core/tools/web-search.d.ts.map +1 -0
- package/dist/core/tools/web-search.js +634 -0
- package/dist/core/tools/web-search.js.map +1 -0
- package/dist/core/tools/write.d.ts +33 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +210 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/core/trust-manager.d.ts +36 -0
- package/dist/core/trust-manager.d.ts.map +1 -0
- package/dist/core/trust-manager.js +220 -0
- package/dist/core/trust-manager.js.map +1 -0
- package/dist/daemon/cli.d.ts +8 -0
- package/dist/daemon/cli.d.ts.map +1 -0
- package/dist/daemon/cli.js +468 -0
- package/dist/daemon/cli.js.map +1 -0
- package/dist/daemon/control-client.d.ts +60 -0
- package/dist/daemon/control-client.d.ts.map +1 -0
- package/dist/daemon/control-client.js +411 -0
- package/dist/daemon/control-client.js.map +1 -0
- package/dist/daemon/control-protocol.d.ts +507 -0
- package/dist/daemon/control-protocol.d.ts.map +1 -0
- package/dist/daemon/control-protocol.js +395 -0
- package/dist/daemon/control-protocol.js.map +1 -0
- package/dist/daemon/control-server.d.ts +77 -0
- package/dist/daemon/control-server.d.ts.map +1 -0
- package/dist/daemon/control-server.js +327 -0
- package/dist/daemon/control-server.js.map +1 -0
- package/dist/daemon/conversation-commands.d.ts +176 -0
- package/dist/daemon/conversation-commands.d.ts.map +1 -0
- package/dist/daemon/conversation-commands.js +1268 -0
- package/dist/daemon/conversation-commands.js.map +1 -0
- package/dist/daemon/daemon-lock.d.ts +27 -0
- package/dist/daemon/daemon-lock.d.ts.map +1 -0
- package/dist/daemon/daemon-lock.js +238 -0
- package/dist/daemon/daemon-lock.js.map +1 -0
- package/dist/daemon/handshake-responses.d.ts +47 -0
- package/dist/daemon/handshake-responses.d.ts.map +1 -0
- package/dist/daemon/handshake-responses.js +113 -0
- package/dist/daemon/handshake-responses.js.map +1 -0
- package/dist/daemon/integrated-runtimes.d.ts +137 -0
- package/dist/daemon/integrated-runtimes.d.ts.map +1 -0
- package/dist/daemon/integrated-runtimes.js +763 -0
- package/dist/daemon/integrated-runtimes.js.map +1 -0
- package/dist/daemon/iroh-native.d.ts +76 -0
- package/dist/daemon/iroh-native.d.ts.map +1 -0
- package/dist/daemon/iroh-native.js +18 -0
- package/dist/daemon/iroh-native.js.map +1 -0
- package/dist/daemon/iroh-resource-guard.d.ts +57 -0
- package/dist/daemon/iroh-resource-guard.d.ts.map +1 -0
- package/dist/daemon/iroh-resource-guard.js +134 -0
- package/dist/daemon/iroh-resource-guard.js.map +1 -0
- package/dist/daemon/iroh-service.d.ts +51 -0
- package/dist/daemon/iroh-service.d.ts.map +1 -0
- package/dist/daemon/iroh-service.js +2604 -0
- package/dist/daemon/iroh-service.js.map +1 -0
- package/dist/daemon/keep-awake.d.ts +62 -0
- package/dist/daemon/keep-awake.d.ts.map +1 -0
- package/dist/daemon/keep-awake.js +190 -0
- package/dist/daemon/keep-awake.js.map +1 -0
- package/dist/daemon/lease-broker.d.ts +139 -0
- package/dist/daemon/lease-broker.d.ts.map +1 -0
- package/dist/daemon/lease-broker.js +504 -0
- package/dist/daemon/lease-broker.js.map +1 -0
- package/dist/daemon/log.d.ts +16 -0
- package/dist/daemon/log.d.ts.map +1 -0
- package/dist/daemon/log.js +40 -0
- package/dist/daemon/log.js.map +1 -0
- package/dist/daemon/main.d.ts +70 -0
- package/dist/daemon/main.d.ts.map +1 -0
- package/dist/daemon/main.js +781 -0
- package/dist/daemon/main.js.map +1 -0
- package/dist/daemon/paths.d.ts +32 -0
- package/dist/daemon/paths.d.ts.map +1 -0
- package/dist/daemon/paths.js +208 -0
- package/dist/daemon/paths.js.map +1 -0
- package/dist/daemon/process-identity.d.ts +58 -0
- package/dist/daemon/process-identity.d.ts.map +1 -0
- package/dist/daemon/process-identity.js +185 -0
- package/dist/daemon/process-identity.js.map +1 -0
- package/dist/daemon/relay-stream.d.ts +89 -0
- package/dist/daemon/relay-stream.d.ts.map +1 -0
- package/dist/daemon/relay-stream.js +202 -0
- package/dist/daemon/relay-stream.js.map +1 -0
- package/dist/daemon/remote-cli.d.ts +7 -0
- package/dist/daemon/remote-cli.d.ts.map +1 -0
- package/dist/daemon/remote-cli.js +774 -0
- package/dist/daemon/remote-cli.js.map +1 -0
- package/dist/daemon/service-install.d.ts +43 -0
- package/dist/daemon/service-install.d.ts.map +1 -0
- package/dist/daemon/service-install.js +198 -0
- package/dist/daemon/service-install.js.map +1 -0
- package/dist/daemon/session-target.d.ts +62 -0
- package/dist/daemon/session-target.d.ts.map +1 -0
- package/dist/daemon/session-target.js +66 -0
- package/dist/daemon/session-target.js.map +1 -0
- package/dist/daemon/spawn.d.ts +53 -0
- package/dist/daemon/spawn.d.ts.map +1 -0
- package/dist/daemon/spawn.js +205 -0
- package/dist/daemon/spawn.js.map +1 -0
- package/dist/daemon/state.d.ts +145 -0
- package/dist/daemon/state.d.ts.map +1 -0
- package/dist/daemon/state.js +454 -0
- package/dist/daemon/state.js.map +1 -0
- package/dist/daemon/theme-push.d.ts +23 -0
- package/dist/daemon/theme-push.d.ts.map +1 -0
- package/dist/daemon/theme-push.js +30 -0
- package/dist/daemon/theme-push.js.map +1 -0
- package/dist/daemon/viewer-feed.d.ts +42 -0
- package/dist/daemon/viewer-feed.d.ts.map +1 -0
- package/dist/daemon/viewer-feed.js +138 -0
- package/dist/daemon/viewer-feed.js.map +1 -0
- package/dist/daemon/workspace-directory.d.ts +35 -0
- package/dist/daemon/workspace-directory.d.ts.map +1 -0
- package/dist/daemon/workspace-directory.js +105 -0
- package/dist/daemon/workspace-directory.js.map +1 -0
- package/dist/daemon/workspace-streams.d.ts +70 -0
- package/dist/daemon/workspace-streams.d.ts.map +1 -0
- package/dist/daemon/workspace-streams.js +289 -0
- package/dist/daemon/workspace-streams.js.map +1 -0
- package/dist/daemon/worktree-manager.d.ts +219 -0
- package/dist/daemon/worktree-manager.d.ts.map +1 -0
- package/dist/daemon/worktree-manager.js +1204 -0
- package/dist/daemon/worktree-manager.js.map +1 -0
- package/dist/index.d.ts +44 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +57 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +12 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +773 -0
- package/dist/main.js.map +1 -0
- package/dist/mcp-cli.d.ts +6 -0
- package/dist/mcp-cli.d.ts.map +1 -0
- package/dist/mcp-cli.js +347 -0
- package/dist/mcp-cli.js.map +1 -0
- package/dist/migrations.d.ts +33 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +281 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/index.d.ts +13 -0
- package/dist/modes/index.d.ts.map +1 -0
- package/dist/modes/index.js +12 -0
- package/dist/modes/index.js.map +1 -0
- package/dist/modes/interactive/components/armin.d.ts +34 -0
- package/dist/modes/interactive/components/armin.d.ts.map +1 -0
- package/dist/modes/interactive/components/armin.js +333 -0
- package/dist/modes/interactive/components/armin.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +22 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +129 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +39 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +212 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +17 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +57 -0
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +44 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +16 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +45 -0
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/config-selector.d.ts +71 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +510 -0
- package/dist/modes/interactive/components/config-selector.js.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts +14 -0
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -0
- package/dist/modes/interactive/components/countdown-timer.js +33 -0
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -0
- package/dist/modes/interactive/components/custom-editor.d.ts +21 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +70 -0
- package/dist/modes/interactive/components/custom-editor.js.map +1 -0
- package/dist/modes/interactive/components/custom-message.d.ts +20 -0
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-message.js +76 -0
- package/dist/modes/interactive/components/custom-message.js.map +1 -0
- package/dist/modes/interactive/components/daxnuts.d.ts +23 -0
- package/dist/modes/interactive/components/daxnuts.d.ts.map +1 -0
- package/dist/modes/interactive/components/daxnuts.js +140 -0
- package/dist/modes/interactive/components/daxnuts.js.map +1 -0
- package/dist/modes/interactive/components/diff.d.ts +12 -0
- package/dist/modes/interactive/components/diff.d.ts.map +1 -0
- package/dist/modes/interactive/components/diff.js +133 -0
- package/dist/modes/interactive/components/diff.js.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts +15 -0
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -0
- package/dist/modes/interactive/components/dynamic-border.js +21 -0
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -0
- package/dist/modes/interactive/components/extension-editor.d.ts +20 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +116 -0
- package/dist/modes/interactive/components/extension-editor.js.map +1 -0
- package/dist/modes/interactive/components/extension-input.d.ts +23 -0
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-input.js +61 -0
- package/dist/modes/interactive/components/extension-input.js.map +1 -0
- package/dist/modes/interactive/components/extension-selector.d.ts +27 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +98 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts +25 -0
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -0
- package/dist/modes/interactive/components/first-time-setup.js +103 -0
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +27 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +180 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/hotkeys.d.ts +24 -0
- package/dist/modes/interactive/components/hotkeys.d.ts.map +1 -0
- package/dist/modes/interactive/components/hotkeys.js +97 -0
- package/dist/modes/interactive/components/hotkeys.js.map +1 -0
- package/dist/modes/interactive/components/index.d.ts +35 -0
- package/dist/modes/interactive/components/index.d.ts.map +1 -0
- package/dist/modes/interactive/components/index.js +36 -0
- package/dist/modes/interactive/components/index.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +19 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +48 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +52 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +179 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/logo.d.ts +25 -0
- package/dist/modes/interactive/components/logo.d.ts.map +1 -0
- package/dist/modes/interactive/components/logo.js +89 -0
- package/dist/modes/interactive/components/logo.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +47 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +278 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +31 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.js +165 -0
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -0
- package/dist/modes/interactive/components/remote-control-center.d.ts +110 -0
- package/dist/modes/interactive/components/remote-control-center.d.ts.map +1 -0
- package/dist/modes/interactive/components/remote-control-center.js +1217 -0
- package/dist/modes/interactive/components/remote-control-center.js.map +1 -0
- package/dist/modes/interactive/components/review-tools-selector.d.ts +24 -0
- package/dist/modes/interactive/components/review-tools-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/review-tools-selector.js +93 -0
- package/dist/modes/interactive/components/review-tools-selector.js.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts +42 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +290 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +23 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +155 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +95 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +856 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +77 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +484 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts +10 -0
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/show-images-selector.js +39 -0
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts +17 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +47 -0
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -0
- package/dist/modes/interactive/components/streaming-render-coalescer.d.ts +29 -0
- package/dist/modes/interactive/components/streaming-render-coalescer.d.ts.map +1 -0
- package/dist/modes/interactive/components/streaming-render-coalescer.js +98 -0
- package/dist/modes/interactive/components/streaming-render-coalescer.js.map +1 -0
- package/dist/modes/interactive/components/subagent-inspector.d.ts +32 -0
- package/dist/modes/interactive/components/subagent-inspector.d.ts.map +1 -0
- package/dist/modes/interactive/components/subagent-inspector.js +439 -0
- package/dist/modes/interactive/components/subagent-inspector.js.map +1 -0
- package/dist/modes/interactive/components/theme-selector.d.ts +11 -0
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/theme-selector.js +50 -0
- package/dist/modes/interactive/components/theme-selector.js.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts +11 -0
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/thinking-selector.js +52 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +83 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +421 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +89 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1208 -0
- package/dist/modes/interactive/components/tree-selector.js.map +1 -0
- package/dist/modes/interactive/components/trust-selector.d.ts +23 -0
- package/dist/modes/interactive/components/trust-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/trust-selector.js +91 -0
- package/dist/modes/interactive/components/trust-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts +30 -0
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message-selector.js +114 -0
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -0
- package/dist/modes/interactive/components/user-message.d.ts +9 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +42 -0
- package/dist/modes/interactive/components/user-message.js.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts +24 -0
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -0
- package/dist/modes/interactive/components/visual-truncate.js +33 -0
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -0
- package/dist/modes/interactive/components/volt-announcement.d.ts +5 -0
- package/dist/modes/interactive/components/volt-announcement.d.ts.map +1 -0
- package/dist/modes/interactive/components/volt-announcement.js +15 -0
- package/dist/modes/interactive/components/volt-announcement.js.map +1 -0
- package/dist/modes/interactive/daemon-attach.d.ts +154 -0
- package/dist/modes/interactive/daemon-attach.d.ts.map +1 -0
- package/dist/modes/interactive/daemon-attach.js +552 -0
- package/dist/modes/interactive/daemon-attach.js.map +1 -0
- package/dist/modes/interactive/drain-viewer.d.ts +31 -0
- package/dist/modes/interactive/drain-viewer.d.ts.map +1 -0
- package/dist/modes/interactive/drain-viewer.js +166 -0
- package/dist/modes/interactive/drain-viewer.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +502 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +7007 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/prompt-image-attachments.d.ts +34 -0
- package/dist/modes/interactive/prompt-image-attachments.d.ts.map +1 -0
- package/dist/modes/interactive/prompt-image-attachments.js +120 -0
- package/dist/modes/interactive/prompt-image-attachments.js.map +1 -0
- package/dist/modes/interactive/relay-stream-adapter.d.ts +19 -0
- package/dist/modes/interactive/relay-stream-adapter.d.ts.map +1 -0
- package/dist/modes/interactive/relay-stream-adapter.js +107 -0
- package/dist/modes/interactive/relay-stream-adapter.js.map +1 -0
- package/dist/modes/print-mode.d.ts +28 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +132 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/in-process-rpc-client.d.ts +31 -0
- package/dist/modes/rpc/in-process-rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/in-process-rpc-client.js +63 -0
- package/dist/modes/rpc/in-process-rpc-client.js.map +1 -0
- package/dist/modes/rpc/iroh-remote-agent-runtime.d.ts +61 -0
- package/dist/modes/rpc/iroh-remote-agent-runtime.d.ts.map +1 -0
- package/dist/modes/rpc/iroh-remote-agent-runtime.js +155 -0
- package/dist/modes/rpc/iroh-remote-agent-runtime.js.map +1 -0
- package/dist/modes/rpc/iroh-remote-rpc-mode.d.ts +69 -0
- package/dist/modes/rpc/iroh-remote-rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/iroh-remote-rpc-mode.js +1223 -0
- package/dist/modes/rpc/iroh-remote-rpc-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +2 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +2 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client-base.d.ts +209 -0
- package/dist/modes/rpc/rpc-client-base.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client-base.js +530 -0
- package/dist/modes/rpc/rpc-client-base.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +50 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +190 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-command-dispatcher.d.ts +43 -0
- package/dist/modes/rpc/rpc-command-dispatcher.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-command-dispatcher.js +613 -0
- package/dist/modes/rpc/rpc-command-dispatcher.js.map +1 -0
- package/dist/modes/rpc/rpc-command-validation.d.ts +2 -0
- package/dist/modes/rpc/rpc-command-validation.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-command-validation.js +207 -0
- package/dist/modes/rpc/rpc-command-validation.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +48 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +1089 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-transport-client.d.ts +26 -0
- package/dist/modes/rpc/rpc-transport-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-transport-client.js +76 -0
- package/dist/modes/rpc/rpc-transport-client.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +2 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +2 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/package-manager-cli.d.ts +28 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +667 -0
- package/dist/package-manager-cli.js.map +1 -0
- package/dist/remote/integrated-runtime-retention.d.ts +17 -0
- package/dist/remote/integrated-runtime-retention.d.ts.map +1 -0
- package/dist/remote/integrated-runtime-retention.js +62 -0
- package/dist/remote/integrated-runtime-retention.js.map +1 -0
- package/dist/remote/iroh-native-adapter.cjs +19 -0
- package/dist/sea/cli.d.ts +4 -0
- package/dist/sea/cli.d.ts.map +1 -0
- package/dist/sea/cli.js +4 -0
- package/dist/sea/cli.js.map +1 -0
- package/dist/sea/register-bedrock.d.ts +2 -0
- package/dist/sea/register-bedrock.d.ts.map +1 -0
- package/dist/sea/register-bedrock.js +4 -0
- package/dist/sea/register-bedrock.js.map +1 -0
- package/dist/store/catalog.d.ts +57 -0
- package/dist/store/catalog.d.ts.map +1 -0
- package/dist/store/catalog.js +331 -0
- package/dist/store/catalog.js.map +1 -0
- package/dist/store/inspector.d.ts +36 -0
- package/dist/store/inspector.d.ts.map +1 -0
- package/dist/store/inspector.js +578 -0
- package/dist/store/inspector.js.map +1 -0
- package/dist/store/install-plan.d.ts +26 -0
- package/dist/store/install-plan.d.ts.map +1 -0
- package/dist/store/install-plan.js +80 -0
- package/dist/store/install-plan.js.map +1 -0
- package/dist/store/render.d.ts +11 -0
- package/dist/store/render.d.ts.map +1 -0
- package/dist/store/render.js +153 -0
- package/dist/store/render.js.map +1 -0
- package/dist/store/resolver.d.ts +22 -0
- package/dist/store/resolver.d.ts.map +1 -0
- package/dist/store/resolver.js +207 -0
- package/dist/store/resolver.js.map +1 -0
- package/dist/store/store-cli.d.ts +7 -0
- package/dist/store/store-cli.d.ts.map +1 -0
- package/dist/store/store-cli.js +636 -0
- package/dist/store/store-cli.js.map +1 -0
- package/dist/store/targets.d.ts +21 -0
- package/dist/store/targets.d.ts.map +1 -0
- package/dist/store/targets.js +55 -0
- package/dist/store/targets.js.map +1 -0
- package/dist/utils/ansi.d.ts +2 -0
- package/dist/utils/ansi.d.ts.map +1 -0
- package/dist/utils/ansi.js +52 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/changelog.d.ts +22 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +165 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/child-process.d.ts +18 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +106 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +11 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +245 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard.d.ts +2 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +94 -0
- package/dist/utils/clipboard.js.map +1 -0
- package/dist/utils/deprecation.d.ts +4 -0
- package/dist/utils/deprecation.d.ts.map +1 -0
- package/dist/utils/deprecation.js +13 -0
- package/dist/utils/deprecation.js.map +1 -0
- package/dist/utils/durable-atomic-write.d.ts +46 -0
- package/dist/utils/durable-atomic-write.d.ts.map +1 -0
- package/dist/utils/durable-atomic-write.js +104 -0
- package/dist/utils/durable-atomic-write.js.map +1 -0
- package/dist/utils/frontmatter.d.ts +8 -0
- package/dist/utils/frontmatter.d.ts.map +1 -0
- package/dist/utils/frontmatter.js +26 -0
- package/dist/utils/frontmatter.js.map +1 -0
- package/dist/utils/fs-watch.d.ts +5 -0
- package/dist/utils/fs-watch.d.ts.map +1 -0
- package/dist/utils/fs-watch.js +25 -0
- package/dist/utils/fs-watch.js.map +1 -0
- package/dist/utils/git.d.ts +26 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +195 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +40 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/ignore-files.d.ts +5 -0
- package/dist/utils/ignore-files.d.ts.map +1 -0
- package/dist/utils/ignore-files.js +58 -0
- package/dist/utils/ignore-files.js.map +1 -0
- package/dist/utils/image-codec.d.ts +22 -0
- package/dist/utils/image-codec.d.ts.map +1 -0
- package/dist/utils/image-codec.js +35 -0
- package/dist/utils/image-codec.js.map +1 -0
- package/dist/utils/image-convert.d.ts +9 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +26 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +31 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +181 -0
- package/dist/utils/image-resize-core.js.map +1 -0
- package/dist/utils/image-resize-worker.d.ts +2 -0
- package/dist/utils/image-resize-worker.d.ts.map +1 -0
- package/dist/utils/image-resize-worker.js +31 -0
- package/dist/utils/image-resize-worker.js.map +1 -0
- package/dist/utils/image-resize.d.ts +15 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +92 -0
- package/dist/utils/image-resize.js.map +1 -0
- package/dist/utils/json.d.ts +3 -0
- package/dist/utils/json.d.ts.map +1 -0
- package/dist/utils/json.js +7 -0
- package/dist/utils/json.js.map +1 -0
- package/dist/utils/mime.d.ts +3 -0
- package/dist/utils/mime.d.ts.map +1 -0
- package/dist/utils/mime.js +69 -0
- package/dist/utils/mime.js.map +1 -0
- package/dist/utils/npm-spec.d.ts +9 -0
- package/dist/utils/npm-spec.d.ts.map +1 -0
- package/dist/utils/npm-spec.js +15 -0
- package/dist/utils/npm-spec.js.map +1 -0
- package/dist/utils/open-browser.d.ts +9 -0
- package/dist/utils/open-browser.d.ts.map +1 -0
- package/dist/utils/open-browser.js +22 -0
- package/dist/utils/open-browser.js.map +1 -0
- package/dist/utils/paths.d.ts +31 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +92 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/private-files.d.ts +21 -0
- package/dist/utils/private-files.d.ts.map +1 -0
- package/dist/utils/private-files.js +103 -0
- package/dist/utils/private-files.js.map +1 -0
- package/dist/utils/process-env.d.ts +2 -0
- package/dist/utils/process-env.d.ts.map +1 -0
- package/dist/utils/process-env.js +31 -0
- package/dist/utils/process-env.js.map +1 -0
- package/dist/utils/shell.d.ts +30 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +195 -0
- package/dist/utils/shell.js.map +1 -0
- package/dist/utils/sleep.d.ts +5 -0
- package/dist/utils/sleep.d.ts.map +1 -0
- package/dist/utils/sleep.js +17 -0
- package/dist/utils/sleep.js.map +1 -0
- package/dist/utils/syntax-highlight.d.ts +18 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +139 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +3 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +328 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/version-check.d.ts +15 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +61 -0
- package/dist/utils/version-check.js.map +1 -0
- package/dist/utils/volt-user-agent.d.ts +2 -0
- package/dist/utils/volt-user-agent.d.ts.map +1 -0
- package/dist/utils/volt-user-agent.js +5 -0
- package/dist/utils/volt-user-agent.js.map +1 -0
- package/dist/utils/windows-self-update.d.ts +3 -0
- package/dist/utils/windows-self-update.d.ts.map +1 -0
- package/dist/utils/windows-self-update.js +77 -0
- package/dist/utils/windows-self-update.js.map +1 -0
- package/docs/compaction.md +394 -0
- package/docs/containerization.md +111 -0
- package/docs/custom-provider.md +737 -0
- package/docs/daemon.md +190 -0
- package/docs/development.md +70 -0
- package/docs/docs.json +176 -0
- package/docs/extensions.md +2692 -0
- package/docs/images/exy.png +0 -0
- package/docs/images/interactive-mode.png +0 -0
- package/docs/images/tree-view.png +0 -0
- package/docs/index.md +82 -0
- package/docs/iroh-remote-access-design.md +340 -0
- package/docs/iroh-remote-protocol.md +431 -0
- package/docs/json.md +87 -0
- package/docs/keybindings.md +200 -0
- package/docs/live-shared-session-daemon-design.md +1090 -0
- package/docs/lsp.md +143 -0
- package/docs/mcp.md +1044 -0
- package/docs/models.md +495 -0
- package/docs/packages.md +230 -0
- package/docs/prompt-templates.md +108 -0
- package/docs/providers.md +274 -0
- package/docs/quickstart.md +165 -0
- package/docs/rpc.md +2050 -0
- package/docs/sdk.md +1267 -0
- package/docs/security.md +139 -0
- package/docs/session-format.md +412 -0
- package/docs/sessions.md +145 -0
- package/docs/settings.md +371 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +243 -0
- package/docs/subagents-design.md +419 -0
- package/docs/terminal-setup.md +148 -0
- package/docs/termux.md +127 -0
- package/docs/themes.md +295 -0
- package/docs/tla/ClientAuth.cfg +16 -0
- package/docs/tla/ClientAuth.tla +205 -0
- package/docs/tla/ClientConn.cfg +16 -0
- package/docs/tla/ClientConn.tla +265 -0
- package/docs/tla/LeaseBroker.cfg +43 -0
- package/docs/tla/LeaseBroker.tla +563 -0
- package/docs/tla/PLAN.md +240 -0
- package/docs/tla/PushOrdering.cfg +17 -0
- package/docs/tla/PushOrdering.tla +183 -0
- package/docs/tla/README.md +205 -0
- package/docs/tla/RelayViewer.cfg +26 -0
- package/docs/tla/RelayViewer.tla +299 -0
- package/docs/tla/SessionTarget.cfg +18 -0
- package/docs/tla/SessionTarget.tla +192 -0
- package/docs/tla/check.sh +34 -0
- package/docs/tmux.md +63 -0
- package/docs/tui.md +949 -0
- package/docs/usage.md +482 -0
- package/docs/windows.md +17 -0
- package/docs/worktrees-design.md +605 -0
- package/examples/README.md +28 -0
- package/examples/extensions/README.md +211 -0
- package/examples/extensions/auto-commit-on-exit.ts +49 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +150 -0
- package/examples/extensions/built-in-tool-renderer.ts +249 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +127 -0
- package/examples/extensions/custom-footer.ts +64 -0
- package/examples/extensions/custom-header.ts +72 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +604 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +24 -0
- package/examples/extensions/custom-provider-anthropic/package.json +19 -0
- package/examples/extensions/custom-provider-gitlab-duo/index.ts +400 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +82 -0
- package/examples/extensions/dirty-repo-guard.ts +56 -0
- package/examples/extensions/dynamic-resources/SKILL.md +8 -0
- package/examples/extensions/dynamic-resources/dynamic.json +79 -0
- package/examples/extensions/dynamic-resources/dynamic.md +5 -0
- package/examples/extensions/dynamic-resources/index.ts +15 -0
- package/examples/extensions/dynamic-tools.ts +74 -0
- package/examples/extensions/event-bus.ts +43 -0
- package/examples/extensions/file-trigger.ts +41 -0
- package/examples/extensions/git-checkpoint.ts +53 -0
- package/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/examples/extensions/github-issue-autocomplete.ts +185 -0
- package/examples/extensions/gondolin/index.ts +531 -0
- package/examples/extensions/gondolin/package-lock.json +185 -0
- package/examples/extensions/gondolin/package.json +19 -0
- package/examples/extensions/handoff.ts +191 -0
- package/examples/extensions/hello.ts +26 -0
- package/examples/extensions/hidden-thinking-label.ts +53 -0
- package/examples/extensions/inline-bash.ts +94 -0
- package/examples/extensions/input-transform-streaming.ts +39 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +196 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +426 -0
- package/examples/extensions/modal-editor.ts +85 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +55 -0
- package/examples/extensions/overlay-qa-tests.ts +1450 -0
- package/examples/extensions/overlay-test.ts +153 -0
- package/examples/extensions/permission-gate.ts +34 -0
- package/examples/extensions/pirate.ts +47 -0
- package/examples/extensions/plan-mode/README.md +65 -0
- package/examples/extensions/plan-mode/index.ts +340 -0
- package/examples/extensions/plan-mode/utils.ts +168 -0
- package/examples/extensions/preset.ts +436 -0
- package/examples/extensions/project-trust.ts +64 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +30 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +122 -0
- package/examples/extensions/question.ts +277 -0
- package/examples/extensions/questionnaire.ts +440 -0
- package/examples/extensions/rainbow-editor.ts +88 -0
- package/examples/extensions/reload-runtime.ts +37 -0
- package/examples/extensions/rpc-demo.ts +118 -0
- package/examples/extensions/sandbox/index.ts +321 -0
- package/examples/extensions/sandbox/package-lock.json +92 -0
- package/examples/extensions/sandbox/package.json +19 -0
- package/examples/extensions/send-user-message.ts +97 -0
- package/examples/extensions/session-name.ts +27 -0
- package/examples/extensions/shutdown-command.ts +63 -0
- package/examples/extensions/snake.ts +343 -0
- package/examples/extensions/space-invaders.ts +560 -0
- package/examples/extensions/ssh.ts +220 -0
- package/examples/extensions/status-line.ts +32 -0
- package/examples/extensions/structured-output.ts +65 -0
- package/examples/extensions/subagent/README.md +175 -0
- package/examples/extensions/subagent/agents/planner.md +37 -0
- package/examples/extensions/subagent/agents/reviewer.md +35 -0
- package/examples/extensions/subagent/agents/scout.md +50 -0
- package/examples/extensions/subagent/agents/worker.md +24 -0
- package/examples/extensions/subagent/agents.ts +126 -0
- package/examples/extensions/subagent/index.ts +1009 -0
- package/examples/extensions/subagent/prompts/implement-and-review.md +10 -0
- package/examples/extensions/subagent/prompts/implement.md +10 -0
- package/examples/extensions/subagent/prompts/scout-and-plan.md +9 -0
- package/examples/extensions/summarize.ts +206 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1008 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +297 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +146 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +195 -0
- package/examples/extensions/widget-placement.ts +9 -0
- package/examples/extensions/with-deps/index.ts +32 -0
- package/examples/extensions/with-deps/package-lock.json +31 -0
- package/examples/extensions/with-deps/package.json +22 -0
- package/examples/extensions/working-indicator.ts +123 -0
- package/examples/extensions/working-message-test.ts +25 -0
- package/examples/remote/firebase-push-relay/README.md +79 -0
- package/examples/remote/firebase-push-relay/firebase.json +12 -0
- package/examples/remote/firebase-push-relay/firestore.indexes.json +11 -0
- package/examples/remote/firebase-push-relay/firestore.rules +9 -0
- package/examples/remote/firebase-push-relay/functions/core.js +511 -0
- package/examples/remote/firebase-push-relay/functions/core.test.js +273 -0
- package/examples/remote/firebase-push-relay/functions/index.js +413 -0
- package/examples/remote/firebase-push-relay/functions/package-lock.json +2974 -0
- package/examples/remote/firebase-push-relay/functions/package.json +18 -0
- package/examples/remote/iroh-sidecar/README.md +211 -0
- package/examples/remote/iroh-sidecar/client.mjs +554 -0
- package/examples/remote/iroh-sidecar/common.mjs +195 -0
- package/examples/remote/iroh-sidecar/host.mjs +4 -0
- package/examples/remote/iroh-sidecar/package-lock.json +213 -0
- package/examples/remote/iroh-sidecar/package.json +13 -0
- package/examples/remote/iroh-sidecar/source-aware-run.mjs +41 -0
- package/examples/rpc-extension-ui.ts +632 -0
- package/examples/sdk/01-minimal.ts +26 -0
- package/examples/sdk/02-custom-model.ts +53 -0
- package/examples/sdk/03-custom-prompt.ts +70 -0
- package/examples/sdk/04-skills.ts +55 -0
- package/examples/sdk/05-tools.ts +48 -0
- package/examples/sdk/06-extensions.ts +94 -0
- package/examples/sdk/07-context-files.ts +42 -0
- package/examples/sdk/08-prompt-templates.ts +51 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +52 -0
- package/examples/sdk/10-settings.ts +53 -0
- package/examples/sdk/11-sessions.ts +52 -0
- package/examples/sdk/12-full-control.ts +78 -0
- package/examples/sdk/13-session-runtime.ts +67 -0
- package/examples/sdk/README.md +147 -0
- package/npm-shrinkwrap.json +3442 -0
- package/package.json +125 -19
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
|
+
import { basename, resolve } from "node:path";
|
|
3
|
+
import { isIrohRemoteWorkspaceName } from "./handshake.js";
|
|
4
|
+
import { normalizeIrohRemoteAllowTools } from "./protocol.js";
|
|
5
|
+
export function parseIrohRemoteWorkspaceSpec(value, cwd = process.cwd()) {
|
|
6
|
+
if (!value) {
|
|
7
|
+
const name = basename(cwd) || "workspace";
|
|
8
|
+
assertIrohRemoteWorkspaceName(name);
|
|
9
|
+
return { name, path: cwd };
|
|
10
|
+
}
|
|
11
|
+
const separatorIndex = value.indexOf("=");
|
|
12
|
+
if (separatorIndex === -1) {
|
|
13
|
+
const path = resolve(cwd, value);
|
|
14
|
+
const name = basename(path) || "workspace";
|
|
15
|
+
assertIrohRemoteWorkspaceName(name);
|
|
16
|
+
return { name, path };
|
|
17
|
+
}
|
|
18
|
+
const name = value.slice(0, separatorIndex).trim();
|
|
19
|
+
const path = resolve(cwd, value.slice(separatorIndex + 1));
|
|
20
|
+
if (!name) {
|
|
21
|
+
throw new Error("Workspace name cannot be empty");
|
|
22
|
+
}
|
|
23
|
+
assertIrohRemoteWorkspaceName(name);
|
|
24
|
+
return { name, path };
|
|
25
|
+
}
|
|
26
|
+
export async function getIrohRemoteWorkspaceAvailabilityStatus(workspace) {
|
|
27
|
+
try {
|
|
28
|
+
const workspaceStat = await stat(workspace.path);
|
|
29
|
+
return workspaceStat.isDirectory() ? "available" : "unavailable";
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
return error instanceof Error && "code" in error && error.code === "ENOENT" ? "missing" : "unavailable";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function upsertIrohRemoteWorkspace(state, workspace, allowTools) {
|
|
36
|
+
assertIrohRemoteWorkspaceName(workspace.name);
|
|
37
|
+
const nameAlias = getIrohRemoteWorkspaceNameAlias(workspace.name);
|
|
38
|
+
const aliasConflict = state.workspaces.find((entry) => entry.name !== workspace.name && getIrohRemoteWorkspaceNameAlias(entry.name) === nameAlias);
|
|
39
|
+
if (aliasConflict) {
|
|
40
|
+
throw new Error(`Workspace name collides with existing registered workspace: ${aliasConflict.name}`);
|
|
41
|
+
}
|
|
42
|
+
const savedAllowedTools = allowTools ?? workspace.allowedTools;
|
|
43
|
+
const savedWorkspace = {
|
|
44
|
+
name: workspace.name,
|
|
45
|
+
path: workspace.path,
|
|
46
|
+
...(savedAllowedTools === undefined ? {} : { allowedTools: normalizeIrohRemoteAllowTools(savedAllowedTools) }),
|
|
47
|
+
};
|
|
48
|
+
const existing = state.workspaces.find((entry) => entry.name === workspace.name);
|
|
49
|
+
if (!existing) {
|
|
50
|
+
state.workspaces.push(savedWorkspace);
|
|
51
|
+
return savedWorkspace;
|
|
52
|
+
}
|
|
53
|
+
existing.path = savedWorkspace.path;
|
|
54
|
+
if (savedAllowedTools !== undefined) {
|
|
55
|
+
existing.allowedTools = savedAllowedTools;
|
|
56
|
+
}
|
|
57
|
+
return existing;
|
|
58
|
+
}
|
|
59
|
+
export function getIrohRemoteWorkspaceNameAlias(name) {
|
|
60
|
+
return name.normalize("NFC").toLowerCase();
|
|
61
|
+
}
|
|
62
|
+
function assertIrohRemoteWorkspaceName(name) {
|
|
63
|
+
if (!isIrohRemoteWorkspaceName(name)) {
|
|
64
|
+
throw new Error("Workspace name is invalid");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
export async function getIrohRemoteWorkspaceStatuses(state, classifier) {
|
|
68
|
+
return await Promise.all(state.workspaces.map(async (workspace) => ({
|
|
69
|
+
name: workspace.name,
|
|
70
|
+
status: await getIrohRemoteWorkspaceStatus(workspace, classifier),
|
|
71
|
+
})));
|
|
72
|
+
}
|
|
73
|
+
export function getAvailableIrohRemoteWorkspaceNames(workspaces) {
|
|
74
|
+
return workspaces.filter((entry) => entry.status === "available").map((entry) => entry.name);
|
|
75
|
+
}
|
|
76
|
+
async function getIrohRemoteWorkspaceStatus(workspace, classifier) {
|
|
77
|
+
if (classifier === undefined) {
|
|
78
|
+
return "available";
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
return await classifier(workspace);
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
return "unavailable";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export function findIrohRemoteWorkspace(state, workspaceName) {
|
|
88
|
+
return state.workspaces.find((entry) => entry.name === workspaceName);
|
|
89
|
+
}
|
|
90
|
+
export function selectIrohRemoteWorkspace(state, workspaceSpec, allowTools, cwd = process.cwd()) {
|
|
91
|
+
if (workspaceSpec) {
|
|
92
|
+
return upsertIrohRemoteWorkspace(state, parseIrohRemoteWorkspaceSpec(workspaceSpec, cwd), allowTools);
|
|
93
|
+
}
|
|
94
|
+
const cwdWorkspace = parseIrohRemoteWorkspaceSpec(undefined, cwd);
|
|
95
|
+
const workspace = state.workspaces.find((entry) => entry.path === cwdWorkspace.path);
|
|
96
|
+
if (workspace) {
|
|
97
|
+
if (allowTools !== undefined) {
|
|
98
|
+
workspace.allowedTools = allowTools;
|
|
99
|
+
}
|
|
100
|
+
return workspace;
|
|
101
|
+
}
|
|
102
|
+
return upsertIrohRemoteWorkspace(state, cwdWorkspace, allowTools);
|
|
103
|
+
}
|
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,KAAK,YAAY,CAAC,IAAI,CAAC,CAAC;IACrF,IAAI,SAAS,EAAE,CAAC;QACf,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;YAC9B,SAAS,CAAC,YAAY,GAAG,UAAU,CAAC;QACrC,CAAC;QACD,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,OAAO,yBAAyB,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;AAAA,CAClE","sourcesContent":["import { stat } from \"node:fs/promises\";\nimport { basename, resolve } from \"node:path\";\nimport { isIrohRemoteWorkspaceName } from \"./handshake.ts\";\nimport { normalizeIrohRemoteAllowTools } from \"./protocol.ts\";\nimport type { IrohRemoteHostState, IrohRemoteWorkspace } from \"./state.ts\";\n\nexport type IrohRemoteWorkspaceAvailabilityStatus = \"available\" | \"missing\" | \"unavailable\";\n\nexport interface IrohRemoteWorkspaceStatus {\n\tname: string;\n\tstatus: IrohRemoteWorkspaceAvailabilityStatus;\n}\n\nexport type IrohRemoteWorkspaceAvailabilityClassifier = (\n\tworkspace: IrohRemoteWorkspace,\n) => IrohRemoteWorkspaceAvailabilityStatus | Promise<IrohRemoteWorkspaceAvailabilityStatus>;\n\nexport function parseIrohRemoteWorkspaceSpec(value?: string, cwd = process.cwd()): IrohRemoteWorkspace {\n\tif (!value) {\n\t\tconst name = basename(cwd) || \"workspace\";\n\t\tassertIrohRemoteWorkspaceName(name);\n\t\treturn { name, path: cwd };\n\t}\n\n\tconst separatorIndex = value.indexOf(\"=\");\n\tif (separatorIndex === -1) {\n\t\tconst path = resolve(cwd, value);\n\t\tconst name = basename(path) || \"workspace\";\n\t\tassertIrohRemoteWorkspaceName(name);\n\t\treturn { name, path };\n\t}\n\n\tconst name = value.slice(0, separatorIndex).trim();\n\tconst path = resolve(cwd, value.slice(separatorIndex + 1));\n\tif (!name) {\n\t\tthrow new Error(\"Workspace name cannot be empty\");\n\t}\n\tassertIrohRemoteWorkspaceName(name);\n\treturn { name, path };\n}\n\nexport async function getIrohRemoteWorkspaceAvailabilityStatus(\n\tworkspace: IrohRemoteWorkspace,\n): Promise<IrohRemoteWorkspaceAvailabilityStatus> {\n\ttry {\n\t\tconst workspaceStat = await stat(workspace.path);\n\t\treturn workspaceStat.isDirectory() ? \"available\" : \"unavailable\";\n\t} catch (error) {\n\t\treturn error instanceof Error && \"code\" in error && error.code === \"ENOENT\" ? \"missing\" : \"unavailable\";\n\t}\n}\n\nexport function upsertIrohRemoteWorkspace(\n\tstate: IrohRemoteHostState,\n\tworkspace: IrohRemoteWorkspace,\n\tallowTools?: string,\n): IrohRemoteWorkspace {\n\tassertIrohRemoteWorkspaceName(workspace.name);\n\tconst nameAlias = getIrohRemoteWorkspaceNameAlias(workspace.name);\n\tconst aliasConflict = state.workspaces.find(\n\t\t(entry) => entry.name !== workspace.name && getIrohRemoteWorkspaceNameAlias(entry.name) === nameAlias,\n\t);\n\tif (aliasConflict) {\n\t\tthrow new Error(`Workspace name collides with existing registered workspace: ${aliasConflict.name}`);\n\t}\n\tconst savedAllowedTools = allowTools ?? workspace.allowedTools;\n\tconst savedWorkspace: IrohRemoteWorkspace = {\n\t\tname: workspace.name,\n\t\tpath: workspace.path,\n\t\t...(savedAllowedTools === undefined ? {} : { allowedTools: normalizeIrohRemoteAllowTools(savedAllowedTools) }),\n\t};\n\tconst existing = state.workspaces.find((entry) => entry.name === workspace.name);\n\tif (!existing) {\n\t\tstate.workspaces.push(savedWorkspace);\n\t\treturn savedWorkspace;\n\t}\n\n\texisting.path = savedWorkspace.path;\n\tif (savedAllowedTools !== undefined) {\n\t\texisting.allowedTools = savedAllowedTools;\n\t}\n\treturn existing;\n}\n\nexport function getIrohRemoteWorkspaceNameAlias(name: string): string {\n\treturn name.normalize(\"NFC\").toLowerCase();\n}\n\nfunction assertIrohRemoteWorkspaceName(name: string): void {\n\tif (!isIrohRemoteWorkspaceName(name)) {\n\t\tthrow new Error(\"Workspace name is invalid\");\n\t}\n}\n\nexport async function getIrohRemoteWorkspaceStatuses(\n\tstate: IrohRemoteHostState,\n\tclassifier?: IrohRemoteWorkspaceAvailabilityClassifier,\n): Promise<IrohRemoteWorkspaceStatus[]> {\n\treturn await Promise.all(\n\t\tstate.workspaces.map(async (workspace) => ({\n\t\t\tname: workspace.name,\n\t\t\tstatus: await getIrohRemoteWorkspaceStatus(workspace, classifier),\n\t\t})),\n\t);\n}\n\nexport function getAvailableIrohRemoteWorkspaceNames(workspaces: readonly IrohRemoteWorkspaceStatus[]): string[] {\n\treturn workspaces.filter((entry) => entry.status === \"available\").map((entry) => entry.name);\n}\n\nasync function getIrohRemoteWorkspaceStatus(\n\tworkspace: IrohRemoteWorkspace,\n\tclassifier: IrohRemoteWorkspaceAvailabilityClassifier | undefined,\n): Promise<IrohRemoteWorkspaceAvailabilityStatus> {\n\tif (classifier === undefined) {\n\t\treturn \"available\";\n\t}\n\ttry {\n\t\treturn await classifier(workspace);\n\t} catch {\n\t\treturn \"unavailable\";\n\t}\n}\n\nexport function findIrohRemoteWorkspace(\n\tstate: IrohRemoteHostState,\n\tworkspaceName: string,\n): IrohRemoteWorkspace | undefined {\n\treturn state.workspaces.find((entry) => entry.name === workspaceName);\n}\n\nexport function selectIrohRemoteWorkspace(\n\tstate: IrohRemoteHostState,\n\tworkspaceSpec: string | undefined,\n\tallowTools?: string,\n\tcwd = process.cwd(),\n): IrohRemoteWorkspace {\n\tif (workspaceSpec) {\n\t\treturn upsertIrohRemoteWorkspace(state, parseIrohRemoteWorkspaceSpec(workspaceSpec, cwd), allowTools);\n\t}\n\tconst cwdWorkspace = parseIrohRemoteWorkspaceSpec(undefined, cwd);\n\tconst workspace = state.workspaces.find((entry) => entry.path === cwdWorkspace.path);\n\tif (workspace) {\n\t\tif (allowTools !== undefined) {\n\t\t\tworkspace.allowedTools = allowTools;\n\t\t}\n\t\treturn workspace;\n\t}\n\treturn upsertIrohRemoteWorkspace(state, cwdWorkspace, allowTools);\n}\n"]}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type IrohRemoteRpcErrorResponse } from "./rpc-command-filter.ts";
|
|
2
|
+
export declare const IROH_REMOTE_CREATE_WORKTREE_RPC_TYPE = "create_worktree";
|
|
3
|
+
export declare const IROH_REMOTE_LIST_WORKTREES_RPC_TYPE = "list_worktrees";
|
|
4
|
+
export declare const IROH_REMOTE_REMOVE_WORKTREE_RPC_TYPE = "remove_worktree";
|
|
5
|
+
export declare const IROH_REMOTE_WORKTREE_RPC_TYPES: ReadonlySet<string>;
|
|
6
|
+
/**
|
|
7
|
+
* Wire shape for a worktree on the iroh remote protocol. NOTE: no filesystem
|
|
8
|
+
* paths ever cross the wire; checkout paths stay host-local.
|
|
9
|
+
*/
|
|
10
|
+
export interface IrohRemoteWorktreeSummary {
|
|
11
|
+
id: string;
|
|
12
|
+
branch: string;
|
|
13
|
+
baseRef?: string;
|
|
14
|
+
createdAt: number;
|
|
15
|
+
sessionIds: string[];
|
|
16
|
+
available?: boolean;
|
|
17
|
+
/** Uncommitted work in the checkout (`git status --porcelain` non-empty). */
|
|
18
|
+
dirty?: boolean;
|
|
19
|
+
/** Branch commits vs the base ref (merge-back guidance, design §5.3). */
|
|
20
|
+
aheadBehind?: {
|
|
21
|
+
ahead: number;
|
|
22
|
+
behind: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/** Host-side backend the RPC helpers delegate to (the daemon's WorktreeManager). */
|
|
26
|
+
export interface IrohRemoteWorktreeRpcBackend {
|
|
27
|
+
createWorktree(workspaceName: string, options: {
|
|
28
|
+
id?: string;
|
|
29
|
+
branch?: string;
|
|
30
|
+
baseRef?: string;
|
|
31
|
+
workingDirectory?: string;
|
|
32
|
+
}): Promise<{
|
|
33
|
+
ok: true;
|
|
34
|
+
worktree: IrohRemoteWorktreeSummary;
|
|
35
|
+
} | {
|
|
36
|
+
ok: false;
|
|
37
|
+
error: string;
|
|
38
|
+
detail?: string;
|
|
39
|
+
}>;
|
|
40
|
+
listWorktrees(workspaceName: string): Promise<{
|
|
41
|
+
ok: true;
|
|
42
|
+
worktrees: IrohRemoteWorktreeSummary[];
|
|
43
|
+
} | {
|
|
44
|
+
ok: false;
|
|
45
|
+
error: string;
|
|
46
|
+
detail?: string;
|
|
47
|
+
}>;
|
|
48
|
+
removeWorktree(workspaceName: string, worktreeId: string, force: boolean): Promise<{
|
|
49
|
+
ok: true;
|
|
50
|
+
stoppedRuntimeCount: number;
|
|
51
|
+
closedStreamCount: number;
|
|
52
|
+
} | {
|
|
53
|
+
ok: false;
|
|
54
|
+
error: string;
|
|
55
|
+
detail?: string;
|
|
56
|
+
}>;
|
|
57
|
+
}
|
|
58
|
+
export interface HandleIrohRemoteWorktreeRpcCommandOptions {
|
|
59
|
+
/** The stream-authorized workspace name; cross-workspace requests are session_mismatch. */
|
|
60
|
+
authorizedWorkspaceName: string;
|
|
61
|
+
backend: IrohRemoteWorktreeRpcBackend;
|
|
62
|
+
}
|
|
63
|
+
export interface IrohRemoteWorktreeRpcSuccessResponse {
|
|
64
|
+
id?: string;
|
|
65
|
+
type: "response";
|
|
66
|
+
command: string;
|
|
67
|
+
success: true;
|
|
68
|
+
data: Record<string, unknown>;
|
|
69
|
+
}
|
|
70
|
+
export type IrohRemoteWorktreeRpcResponse = IrohRemoteWorktreeRpcSuccessResponse | IrohRemoteRpcErrorResponse;
|
|
71
|
+
export type IrohRemoteWorktreeRpcResult = {
|
|
72
|
+
handled: false;
|
|
73
|
+
} | {
|
|
74
|
+
handled: true;
|
|
75
|
+
response: IrohRemoteWorktreeRpcResponse;
|
|
76
|
+
/** Present on success for audit hooks. */
|
|
77
|
+
audit?: {
|
|
78
|
+
type: string;
|
|
79
|
+
details: Record<string, unknown>;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
export declare function handleIrohRemoteWorktreeRpcCommand(command: Record<string, unknown>, options: HandleIrohRemoteWorktreeRpcCommandOptions): Promise<IrohRemoteWorktreeRpcResult>;
|
|
83
|
+
//# sourceMappingURL=worktree-rpc.d.ts.map
|
|
@@ -0,0 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CAC1D,CAAC;AAcL,wBAAsB,kCAAkC,CACvD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,EAAE,yCAAyC,GAChD,OAAO,CAAC,2BAA2B,CAAC,CAmHtC","sourcesContent":["import { isIrohRemoteWorkingDirectory, isIrohRemoteWorktreeId } from \"./protocol.ts\";\nimport { createIrohRemoteRpcErrorResponse, type IrohRemoteRpcErrorResponse } from \"./rpc-command-filter.ts\";\n\nexport const IROH_REMOTE_CREATE_WORKTREE_RPC_TYPE = \"create_worktree\";\nexport const IROH_REMOTE_LIST_WORKTREES_RPC_TYPE = \"list_worktrees\";\nexport const IROH_REMOTE_REMOVE_WORKTREE_RPC_TYPE = \"remove_worktree\";\n\nexport const IROH_REMOTE_WORKTREE_RPC_TYPES: ReadonlySet<string> = new Set([\n\tIROH_REMOTE_CREATE_WORKTREE_RPC_TYPE,\n\tIROH_REMOTE_LIST_WORKTREES_RPC_TYPE,\n\tIROH_REMOTE_REMOVE_WORKTREE_RPC_TYPE,\n]);\n\n/**\n * Wire shape for a worktree on the iroh remote protocol. NOTE: no filesystem\n * paths ever cross the wire; checkout paths stay host-local.\n */\nexport interface IrohRemoteWorktreeSummary {\n\tid: string;\n\tbranch: string;\n\tbaseRef?: string;\n\tcreatedAt: number;\n\tsessionIds: string[];\n\tavailable?: boolean;\n\t/** Uncommitted work in the checkout (`git status --porcelain` non-empty). */\n\tdirty?: boolean;\n\t/** Branch commits vs the base ref (merge-back guidance, design §5.3). */\n\taheadBehind?: { ahead: number; behind: number };\n}\n\n/** Host-side backend the RPC helpers delegate to (the daemon's WorktreeManager). */\nexport interface IrohRemoteWorktreeRpcBackend {\n\tcreateWorktree(\n\t\tworkspaceName: string,\n\t\toptions: { id?: string; branch?: string; baseRef?: string; workingDirectory?: string },\n\t): Promise<{ ok: true; worktree: IrohRemoteWorktreeSummary } | { ok: false; error: string; detail?: string }>;\n\tlistWorktrees(\n\t\tworkspaceName: string,\n\t): Promise<{ ok: true; worktrees: IrohRemoteWorktreeSummary[] } | { ok: false; error: string; detail?: string }>;\n\tremoveWorktree(\n\t\tworkspaceName: string,\n\t\tworktreeId: string,\n\t\tforce: boolean,\n\t): Promise<\n\t\t| { ok: true; stoppedRuntimeCount: number; closedStreamCount: number }\n\t\t| { ok: false; error: string; detail?: string }\n\t>;\n}\n\nexport interface HandleIrohRemoteWorktreeRpcCommandOptions {\n\t/** The stream-authorized workspace name; cross-workspace requests are session_mismatch. */\n\tauthorizedWorkspaceName: string;\n\tbackend: IrohRemoteWorktreeRpcBackend;\n}\n\nexport interface IrohRemoteWorktreeRpcSuccessResponse {\n\tid?: string;\n\ttype: \"response\";\n\tcommand: string;\n\tsuccess: true;\n\tdata: Record<string, unknown>;\n}\n\nexport type IrohRemoteWorktreeRpcResponse = IrohRemoteWorktreeRpcSuccessResponse | IrohRemoteRpcErrorResponse;\n\nexport type IrohRemoteWorktreeRpcResult =\n\t| { handled: false }\n\t| {\n\t\t\thandled: true;\n\t\t\tresponse: IrohRemoteWorktreeRpcResponse;\n\t\t\t/** Present on success for audit hooks. */\n\t\t\taudit?: { type: string; details: Record<string, unknown> };\n\t };\n\nconst CREATE_WORKTREE_ALLOWED_FIELDS = new Set([\n\t\"id\",\n\t\"type\",\n\t\"workspaceName\",\n\t\"worktreeName\",\n\t\"branch\",\n\t\"baseRef\",\n\t\"workingDirectory\",\n]);\nconst LIST_WORKTREES_ALLOWED_FIELDS = new Set([\"id\", \"type\", \"workspaceName\"]);\nconst REMOVE_WORKTREE_ALLOWED_FIELDS = new Set([\"id\", \"type\", \"workspaceName\", \"worktreeId\", \"force\"]);\n\nexport async function handleIrohRemoteWorktreeRpcCommand(\n\tcommand: Record<string, unknown>,\n\toptions: HandleIrohRemoteWorktreeRpcCommandOptions,\n): Promise<IrohRemoteWorktreeRpcResult> {\n\tif (typeof command.type !== \"string\" || !IROH_REMOTE_WORKTREE_RPC_TYPES.has(command.type)) {\n\t\treturn { handled: false };\n\t}\n\tconst commandType = command.type;\n\tconst id = typeof command.id === \"string\" ? command.id : undefined;\n\tconst fail = (error: string): IrohRemoteWorktreeRpcResult => ({\n\t\thandled: true,\n\t\tresponse: createIrohRemoteRpcErrorResponse(id, commandType, error),\n\t});\n\n\tconst allowedFields =\n\t\tcommandType === IROH_REMOTE_CREATE_WORKTREE_RPC_TYPE\n\t\t\t? CREATE_WORKTREE_ALLOWED_FIELDS\n\t\t\t: commandType === IROH_REMOTE_LIST_WORKTREES_RPC_TYPE\n\t\t\t\t? LIST_WORKTREES_ALLOWED_FIELDS\n\t\t\t\t: REMOVE_WORKTREE_ALLOWED_FIELDS;\n\t// No filesystem paths inbound, ever; anything outside the allowlist is invalid.\n\tfor (const field of Object.keys(command)) {\n\t\tif (!allowedFields.has(field)) {\n\t\t\treturn fail(\"invalid_request\");\n\t\t}\n\t}\n\tif (typeof command.workspaceName !== \"string\" || command.workspaceName.length === 0) {\n\t\treturn fail(\"invalid_request\");\n\t}\n\tif (command.workspaceName !== options.authorizedWorkspaceName) {\n\t\treturn fail(\"session_mismatch\");\n\t}\n\n\tif (commandType === IROH_REMOTE_CREATE_WORKTREE_RPC_TYPE) {\n\t\tif (command.worktreeName !== undefined && !isIrohRemoteWorktreeId(command.worktreeName)) {\n\t\t\treturn fail(\"invalid_request\");\n\t\t}\n\t\tif (command.branch !== undefined && typeof command.branch !== \"string\") {\n\t\t\treturn fail(\"invalid_request\");\n\t\t}\n\t\tif (command.baseRef !== undefined && typeof command.baseRef !== \"string\") {\n\t\t\treturn fail(\"invalid_request\");\n\t\t}\n\t\tif (command.workingDirectory !== undefined && !isIrohRemoteWorkingDirectory(command.workingDirectory)) {\n\t\t\treturn fail(\"invalid_request\");\n\t\t}\n\t\tconst created = await options.backend.createWorktree(command.workspaceName, {\n\t\t\t...(command.worktreeName === undefined ? {} : { id: command.worktreeName }),\n\t\t\t...(command.branch === undefined ? {} : { branch: command.branch }),\n\t\t\t...(command.baseRef === undefined ? {} : { baseRef: command.baseRef }),\n\t\t\t...(command.workingDirectory === undefined ? {} : { workingDirectory: command.workingDirectory }),\n\t\t});\n\t\tif (!created.ok) {\n\t\t\treturn fail(created.error);\n\t\t}\n\t\treturn {\n\t\t\thandled: true,\n\t\t\tresponse: {\n\t\t\t\t...(id === undefined ? {} : { id }),\n\t\t\t\ttype: \"response\",\n\t\t\t\tcommand: commandType,\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: { worktree: toWorktreeSummary(created.worktree) },\n\t\t\t},\n\t\t\taudit: {\n\t\t\t\ttype: \"worktree_created\",\n\t\t\t\tdetails: { worktreeId: created.worktree.id, branch: created.worktree.branch },\n\t\t\t},\n\t\t};\n\t}\n\n\tif (commandType === IROH_REMOTE_LIST_WORKTREES_RPC_TYPE) {\n\t\tconst listed = await options.backend.listWorktrees(command.workspaceName);\n\t\tif (!listed.ok) {\n\t\t\treturn fail(listed.error);\n\t\t}\n\t\treturn {\n\t\t\thandled: true,\n\t\t\tresponse: {\n\t\t\t\t...(id === undefined ? {} : { id }),\n\t\t\t\ttype: \"response\",\n\t\t\t\tcommand: commandType,\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: { worktrees: listed.worktrees.map((worktree) => toWorktreeSummary(worktree)) },\n\t\t\t},\n\t\t};\n\t}\n\n\tif (!isIrohRemoteWorktreeId(command.worktreeId)) {\n\t\treturn fail(\"invalid_request\");\n\t}\n\tif (command.force !== undefined && typeof command.force !== \"boolean\") {\n\t\treturn fail(\"invalid_request\");\n\t}\n\tconst force = command.force === true;\n\tconst removed = await options.backend.removeWorktree(command.workspaceName, command.worktreeId, force);\n\tif (!removed.ok) {\n\t\treturn fail(removed.error);\n\t}\n\treturn {\n\t\thandled: true,\n\t\tresponse: {\n\t\t\t...(id === undefined ? {} : { id }),\n\t\t\ttype: \"response\",\n\t\t\tcommand: commandType,\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\tworktreeId: command.worktreeId,\n\t\t\t\tremoved: true,\n\t\t\t\tstoppedRuntimeCount: removed.stoppedRuntimeCount,\n\t\t\t\tclosedStreamCount: removed.closedStreamCount,\n\t\t\t},\n\t\t},\n\t\taudit: {\n\t\t\ttype: \"worktree_removed\",\n\t\t\tdetails: { worktreeId: command.worktreeId, force, stoppedRuntimeCount: removed.stoppedRuntimeCount },\n\t\t},\n\t};\n}\n\n/** Field allowlist for the wire summary: never leak a `path` or workspaceName. */\nfunction toWorktreeSummary(worktree: IrohRemoteWorktreeSummary): IrohRemoteWorktreeSummary {\n\treturn {\n\t\tid: worktree.id,\n\t\tbranch: worktree.branch,\n\t\t...(worktree.baseRef === undefined ? {} : { baseRef: worktree.baseRef }),\n\t\tcreatedAt: worktree.createdAt,\n\t\tsessionIds: [...worktree.sessionIds],\n\t\t...(worktree.available === undefined ? {} : { available: worktree.available }),\n\t\t...(worktree.dirty === undefined ? {} : { dirty: worktree.dirty }),\n\t\t...(worktree.aheadBehind === undefined\n\t\t\t? {}\n\t\t\t: { aheadBehind: { ahead: worktree.aheadBehind.ahead, behind: worktree.aheadBehind.behind } }),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { isIrohRemoteWorkingDirectory, isIrohRemoteWorktreeId } from "./protocol.js";
|
|
2
|
+
import { createIrohRemoteRpcErrorResponse } from "./rpc-command-filter.js";
|
|
3
|
+
export const IROH_REMOTE_CREATE_WORKTREE_RPC_TYPE = "create_worktree";
|
|
4
|
+
export const IROH_REMOTE_LIST_WORKTREES_RPC_TYPE = "list_worktrees";
|
|
5
|
+
export const IROH_REMOTE_REMOVE_WORKTREE_RPC_TYPE = "remove_worktree";
|
|
6
|
+
export const IROH_REMOTE_WORKTREE_RPC_TYPES = new Set([
|
|
7
|
+
IROH_REMOTE_CREATE_WORKTREE_RPC_TYPE,
|
|
8
|
+
IROH_REMOTE_LIST_WORKTREES_RPC_TYPE,
|
|
9
|
+
IROH_REMOTE_REMOVE_WORKTREE_RPC_TYPE,
|
|
10
|
+
]);
|
|
11
|
+
const CREATE_WORKTREE_ALLOWED_FIELDS = new Set([
|
|
12
|
+
"id",
|
|
13
|
+
"type",
|
|
14
|
+
"workspaceName",
|
|
15
|
+
"worktreeName",
|
|
16
|
+
"branch",
|
|
17
|
+
"baseRef",
|
|
18
|
+
"workingDirectory",
|
|
19
|
+
]);
|
|
20
|
+
const LIST_WORKTREES_ALLOWED_FIELDS = new Set(["id", "type", "workspaceName"]);
|
|
21
|
+
const REMOVE_WORKTREE_ALLOWED_FIELDS = new Set(["id", "type", "workspaceName", "worktreeId", "force"]);
|
|
22
|
+
export async function handleIrohRemoteWorktreeRpcCommand(command, options) {
|
|
23
|
+
if (typeof command.type !== "string" || !IROH_REMOTE_WORKTREE_RPC_TYPES.has(command.type)) {
|
|
24
|
+
return { handled: false };
|
|
25
|
+
}
|
|
26
|
+
const commandType = command.type;
|
|
27
|
+
const id = typeof command.id === "string" ? command.id : undefined;
|
|
28
|
+
const fail = (error) => ({
|
|
29
|
+
handled: true,
|
|
30
|
+
response: createIrohRemoteRpcErrorResponse(id, commandType, error),
|
|
31
|
+
});
|
|
32
|
+
const allowedFields = commandType === IROH_REMOTE_CREATE_WORKTREE_RPC_TYPE
|
|
33
|
+
? CREATE_WORKTREE_ALLOWED_FIELDS
|
|
34
|
+
: commandType === IROH_REMOTE_LIST_WORKTREES_RPC_TYPE
|
|
35
|
+
? LIST_WORKTREES_ALLOWED_FIELDS
|
|
36
|
+
: REMOVE_WORKTREE_ALLOWED_FIELDS;
|
|
37
|
+
// No filesystem paths inbound, ever; anything outside the allowlist is invalid.
|
|
38
|
+
for (const field of Object.keys(command)) {
|
|
39
|
+
if (!allowedFields.has(field)) {
|
|
40
|
+
return fail("invalid_request");
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (typeof command.workspaceName !== "string" || command.workspaceName.length === 0) {
|
|
44
|
+
return fail("invalid_request");
|
|
45
|
+
}
|
|
46
|
+
if (command.workspaceName !== options.authorizedWorkspaceName) {
|
|
47
|
+
return fail("session_mismatch");
|
|
48
|
+
}
|
|
49
|
+
if (commandType === IROH_REMOTE_CREATE_WORKTREE_RPC_TYPE) {
|
|
50
|
+
if (command.worktreeName !== undefined && !isIrohRemoteWorktreeId(command.worktreeName)) {
|
|
51
|
+
return fail("invalid_request");
|
|
52
|
+
}
|
|
53
|
+
if (command.branch !== undefined && typeof command.branch !== "string") {
|
|
54
|
+
return fail("invalid_request");
|
|
55
|
+
}
|
|
56
|
+
if (command.baseRef !== undefined && typeof command.baseRef !== "string") {
|
|
57
|
+
return fail("invalid_request");
|
|
58
|
+
}
|
|
59
|
+
if (command.workingDirectory !== undefined && !isIrohRemoteWorkingDirectory(command.workingDirectory)) {
|
|
60
|
+
return fail("invalid_request");
|
|
61
|
+
}
|
|
62
|
+
const created = await options.backend.createWorktree(command.workspaceName, {
|
|
63
|
+
...(command.worktreeName === undefined ? {} : { id: command.worktreeName }),
|
|
64
|
+
...(command.branch === undefined ? {} : { branch: command.branch }),
|
|
65
|
+
...(command.baseRef === undefined ? {} : { baseRef: command.baseRef }),
|
|
66
|
+
...(command.workingDirectory === undefined ? {} : { workingDirectory: command.workingDirectory }),
|
|
67
|
+
});
|
|
68
|
+
if (!created.ok) {
|
|
69
|
+
return fail(created.error);
|
|
70
|
+
}
|
|
71
|
+
return {
|
|
72
|
+
handled: true,
|
|
73
|
+
response: {
|
|
74
|
+
...(id === undefined ? {} : { id }),
|
|
75
|
+
type: "response",
|
|
76
|
+
command: commandType,
|
|
77
|
+
success: true,
|
|
78
|
+
data: { worktree: toWorktreeSummary(created.worktree) },
|
|
79
|
+
},
|
|
80
|
+
audit: {
|
|
81
|
+
type: "worktree_created",
|
|
82
|
+
details: { worktreeId: created.worktree.id, branch: created.worktree.branch },
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
if (commandType === IROH_REMOTE_LIST_WORKTREES_RPC_TYPE) {
|
|
87
|
+
const listed = await options.backend.listWorktrees(command.workspaceName);
|
|
88
|
+
if (!listed.ok) {
|
|
89
|
+
return fail(listed.error);
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
handled: true,
|
|
93
|
+
response: {
|
|
94
|
+
...(id === undefined ? {} : { id }),
|
|
95
|
+
type: "response",
|
|
96
|
+
command: commandType,
|
|
97
|
+
success: true,
|
|
98
|
+
data: { worktrees: listed.worktrees.map((worktree) => toWorktreeSummary(worktree)) },
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
if (!isIrohRemoteWorktreeId(command.worktreeId)) {
|
|
103
|
+
return fail("invalid_request");
|
|
104
|
+
}
|
|
105
|
+
if (command.force !== undefined && typeof command.force !== "boolean") {
|
|
106
|
+
return fail("invalid_request");
|
|
107
|
+
}
|
|
108
|
+
const force = command.force === true;
|
|
109
|
+
const removed = await options.backend.removeWorktree(command.workspaceName, command.worktreeId, force);
|
|
110
|
+
if (!removed.ok) {
|
|
111
|
+
return fail(removed.error);
|
|
112
|
+
}
|
|
113
|
+
return {
|
|
114
|
+
handled: true,
|
|
115
|
+
response: {
|
|
116
|
+
...(id === undefined ? {} : { id }),
|
|
117
|
+
type: "response",
|
|
118
|
+
command: commandType,
|
|
119
|
+
success: true,
|
|
120
|
+
data: {
|
|
121
|
+
worktreeId: command.worktreeId,
|
|
122
|
+
removed: true,
|
|
123
|
+
stoppedRuntimeCount: removed.stoppedRuntimeCount,
|
|
124
|
+
closedStreamCount: removed.closedStreamCount,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
audit: {
|
|
128
|
+
type: "worktree_removed",
|
|
129
|
+
details: { worktreeId: command.worktreeId, force, stoppedRuntimeCount: removed.stoppedRuntimeCount },
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/** Field allowlist for the wire summary: never leak a `path` or workspaceName. */
|
|
134
|
+
function toWorktreeSummary(worktree) {
|
|
135
|
+
return {
|
|
136
|
+
id: worktree.id,
|
|
137
|
+
branch: worktree.branch,
|
|
138
|
+
...(worktree.baseRef === undefined ? {} : { baseRef: worktree.baseRef }),
|
|
139
|
+
createdAt: worktree.createdAt,
|
|
140
|
+
sessionIds: [...worktree.sessionIds],
|
|
141
|
+
...(worktree.available === undefined ? {} : { available: worktree.available }),
|
|
142
|
+
...(worktree.dirty === undefined ? {} : { dirty: worktree.dirty }),
|
|
143
|
+
...(worktree.aheadBehind === undefined
|
|
144
|
+
? {}
|
|
145
|
+
: { aheadBehind: { ahead: worktree.aheadBehind.ahead, behind: worktree.aheadBehind.behind } }),
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=worktree-rpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-rpc.js","sourceRoot":"","sources":["../../../../src/core/remote/iroh/worktree-rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AACrF,OAAO,EAAE,gCAAgC,EAAmC,MAAM,yBAAyB,CAAC;AAE5G,MAAM,CAAC,MAAM,oCAAoC,GAAG,iBAAiB,CAAC;AACtE,MAAM,CAAC,MAAM,mCAAmC,GAAG,gBAAgB,CAAC;AACpE,MAAM,CAAC,MAAM,oCAAoC,GAAG,iBAAiB,CAAC;AAEtE,MAAM,CAAC,MAAM,8BAA8B,GAAwB,IAAI,GAAG,CAAC;IAC1E,oCAAoC;IACpC,mCAAmC;IACnC,oCAAoC;CACpC,CAAC,CAAC;AA+DH,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAC;IAC9C,IAAI;IACJ,MAAM;IACN,eAAe;IACf,cAAc;IACd,QAAQ;IACR,SAAS;IACT,kBAAkB;CAClB,CAAC,CAAC;AACH,MAAM,6BAA6B,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC,CAAC;AAC/E,MAAM,8BAA8B,GAAG,IAAI,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,E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pc-command-filter.ts\";\n\nexport const IROH_REMOTE_CREATE_WORKTREE_RPC_TYPE = \"create_worktree\";\nexport const IROH_REMOTE_LIST_WORKTREES_RPC_TYPE = \"list_worktrees\";\nexport const IROH_REMOTE_REMOVE_WORKTREE_RPC_TYPE = \"remove_worktree\";\n\nexport const IROH_REMOTE_WORKTREE_RPC_TYPES: ReadonlySet<string> = new Set([\n\tIROH_REMOTE_CREATE_WORKTREE_RPC_TYPE,\n\tIROH_REMOTE_LIST_WORKTREES_RPC_TYPE,\n\tIROH_REMOTE_REMOVE_WORKTREE_RPC_TYPE,\n]);\n\n/**\n * Wire shape for a worktree on the iroh remote protocol. NOTE: no filesystem\n * paths ever cross the wire; checkout paths stay host-local.\n */\nexport interface IrohRemoteWorktreeSummary {\n\tid: string;\n\tbranch: string;\n\tbaseRef?: string;\n\tcreatedAt: number;\n\tsessionIds: string[];\n\tavailable?: boolean;\n\t/** Uncommitted work in the checkout (`git status --porcelain` non-empty). */\n\tdirty?: boolean;\n\t/** Branch commits vs the base ref (merge-back guidance, design §5.3). */\n\taheadBehind?: { ahead: number; behind: number };\n}\n\n/** Host-side backend the RPC helpers delegate to (the daemon's WorktreeManager). */\nexport interface IrohRemoteWorktreeRpcBackend {\n\tcreateWorktree(\n\t\tworkspaceName: string,\n\t\toptions: { id?: string; branch?: string; baseRef?: string; workingDirectory?: string },\n\t): Promise<{ ok: true; worktree: IrohRemoteWorktreeSummary } | { ok: false; error: string; detail?: string }>;\n\tlistWorktrees(\n\t\tworkspaceName: string,\n\t): Promise<{ ok: true; worktrees: IrohRemoteWorktreeSummary[] } | { ok: false; error: string; detail?: string }>;\n\tremoveWorktree(\n\t\tworkspaceName: string,\n\t\tworktreeId: string,\n\t\tforce: boolean,\n\t): Promise<\n\t\t| { ok: true; stoppedRuntimeCount: number; closedStreamCount: number }\n\t\t| { ok: false; error: string; detail?: string }\n\t>;\n}\n\nexport interface HandleIrohRemoteWorktreeRpcCommandOptions {\n\t/** The stream-authorized workspace name; cross-workspace requests are session_mismatch. */\n\tauthorizedWorkspaceName: string;\n\tbackend: IrohRemoteWorktreeRpcBackend;\n}\n\nexport interface IrohRemoteWorktreeRpcSuccessResponse {\n\tid?: string;\n\ttype: \"response\";\n\tcommand: string;\n\tsuccess: true;\n\tdata: Record<string, unknown>;\n}\n\nexport type IrohRemoteWorktreeRpcResponse = IrohRemoteWorktreeRpcSuccessResponse | IrohRemoteRpcErrorResponse;\n\nexport type IrohRemoteWorktreeRpcResult =\n\t| { handled: false }\n\t| {\n\t\t\thandled: true;\n\t\t\tresponse: IrohRemoteWorktreeRpcResponse;\n\t\t\t/** Present on success for audit hooks. */\n\t\t\taudit?: { type: string; details: Record<string, unknown> };\n\t };\n\nconst CREATE_WORKTREE_ALLOWED_FIELDS = new Set([\n\t\"id\",\n\t\"type\",\n\t\"workspaceName\",\n\t\"worktreeName\",\n\t\"branch\",\n\t\"baseRef\",\n\t\"workingDirectory\",\n]);\nconst LIST_WORKTREES_ALLOWED_FIELDS = new Set([\"id\", \"type\", \"workspaceName\"]);\nconst REMOVE_WORKTREE_ALLOWED_FIELDS = new Set([\"id\", \"type\", \"workspaceName\", \"worktreeId\", \"force\"]);\n\nexport async function handleIrohRemoteWorktreeRpcCommand(\n\tcommand: Record<string, unknown>,\n\toptions: HandleIrohRemoteWorktreeRpcCommandOptions,\n): Promise<IrohRemoteWorktreeRpcResult> {\n\tif (typeof command.type !== \"string\" || !IROH_REMOTE_WORKTREE_RPC_TYPES.has(command.type)) {\n\t\treturn { handled: false };\n\t}\n\tconst commandType = command.type;\n\tconst id = typeof command.id === \"string\" ? command.id : undefined;\n\tconst fail = (error: string): IrohRemoteWorktreeRpcResult => ({\n\t\thandled: true,\n\t\tresponse: createIrohRemoteRpcErrorResponse(id, commandType, error),\n\t});\n\n\tconst allowedFields =\n\t\tcommandType === IROH_REMOTE_CREATE_WORKTREE_RPC_TYPE\n\t\t\t? CREATE_WORKTREE_ALLOWED_FIELDS\n\t\t\t: commandType === IROH_REMOTE_LIST_WORKTREES_RPC_TYPE\n\t\t\t\t? LIST_WORKTREES_ALLOWED_FIELDS\n\t\t\t\t: REMOVE_WORKTREE_ALLOWED_FIELDS;\n\t// No filesystem paths inbound, ever; anything outside the allowlist is invalid.\n\tfor (const field of Object.keys(command)) {\n\t\tif (!allowedFields.has(field)) {\n\t\t\treturn fail(\"invalid_request\");\n\t\t}\n\t}\n\tif (typeof command.workspaceName !== \"string\" || command.workspaceName.length === 0) {\n\t\treturn fail(\"invalid_request\");\n\t}\n\tif (command.workspaceName !== options.authorizedWorkspaceName) {\n\t\treturn fail(\"session_mismatch\");\n\t}\n\n\tif (commandType === IROH_REMOTE_CREATE_WORKTREE_RPC_TYPE) {\n\t\tif (command.worktreeName !== undefined && !isIrohRemoteWorktreeId(command.worktreeName)) {\n\t\t\treturn fail(\"invalid_request\");\n\t\t}\n\t\tif (command.branch !== undefined && typeof command.branch !== \"string\") {\n\t\t\treturn fail(\"invalid_request\");\n\t\t}\n\t\tif (command.baseRef !== undefined && typeof command.baseRef !== \"string\") {\n\t\t\treturn fail(\"invalid_request\");\n\t\t}\n\t\tif (command.workingDirectory !== undefined && !isIrohRemoteWorkingDirectory(command.workingDirectory)) {\n\t\t\treturn fail(\"invalid_request\");\n\t\t}\n\t\tconst created = await options.backend.createWorktree(command.workspaceName, {\n\t\t\t...(command.worktreeName === undefined ? {} : { id: command.worktreeName }),\n\t\t\t...(command.branch === undefined ? {} : { branch: command.branch }),\n\t\t\t...(command.baseRef === undefined ? {} : { baseRef: command.baseRef }),\n\t\t\t...(command.workingDirectory === undefined ? {} : { workingDirectory: command.workingDirectory }),\n\t\t});\n\t\tif (!created.ok) {\n\t\t\treturn fail(created.error);\n\t\t}\n\t\treturn {\n\t\t\thandled: true,\n\t\t\tresponse: {\n\t\t\t\t...(id === undefined ? {} : { id }),\n\t\t\t\ttype: \"response\",\n\t\t\t\tcommand: commandType,\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: { worktree: toWorktreeSummary(created.worktree) },\n\t\t\t},\n\t\t\taudit: {\n\t\t\t\ttype: \"worktree_created\",\n\t\t\t\tdetails: { worktreeId: created.worktree.id, branch: created.worktree.branch },\n\t\t\t},\n\t\t};\n\t}\n\n\tif (commandType === IROH_REMOTE_LIST_WORKTREES_RPC_TYPE) {\n\t\tconst listed = await options.backend.listWorktrees(command.workspaceName);\n\t\tif (!listed.ok) {\n\t\t\treturn fail(listed.error);\n\t\t}\n\t\treturn {\n\t\t\thandled: true,\n\t\t\tresponse: {\n\t\t\t\t...(id === undefined ? {} : { id }),\n\t\t\t\ttype: \"response\",\n\t\t\t\tcommand: commandType,\n\t\t\t\tsuccess: true,\n\t\t\t\tdata: { worktrees: listed.worktrees.map((worktree) => toWorktreeSummary(worktree)) },\n\t\t\t},\n\t\t};\n\t}\n\n\tif (!isIrohRemoteWorktreeId(command.worktreeId)) {\n\t\treturn fail(\"invalid_request\");\n\t}\n\tif (command.force !== undefined && typeof command.force !== \"boolean\") {\n\t\treturn fail(\"invalid_request\");\n\t}\n\tconst force = command.force === true;\n\tconst removed = await options.backend.removeWorktree(command.workspaceName, command.worktreeId, force);\n\tif (!removed.ok) {\n\t\treturn fail(removed.error);\n\t}\n\treturn {\n\t\thandled: true,\n\t\tresponse: {\n\t\t\t...(id === undefined ? {} : { id }),\n\t\t\ttype: \"response\",\n\t\t\tcommand: commandType,\n\t\t\tsuccess: true,\n\t\t\tdata: {\n\t\t\t\tworktreeId: command.worktreeId,\n\t\t\t\tremoved: true,\n\t\t\t\tstoppedRuntimeCount: removed.stoppedRuntimeCount,\n\t\t\t\tclosedStreamCount: removed.closedStreamCount,\n\t\t\t},\n\t\t},\n\t\taudit: {\n\t\t\ttype: \"worktree_removed\",\n\t\t\tdetails: { worktreeId: command.worktreeId, force, stoppedRuntimeCount: removed.stoppedRuntimeCount },\n\t\t},\n\t};\n}\n\n/** Field allowlist for the wire summary: never leak a `path` or workspaceName. */\nfunction toWorktreeSummary(worktree: IrohRemoteWorktreeSummary): IrohRemoteWorktreeSummary {\n\treturn {\n\t\tid: worktree.id,\n\t\tbranch: worktree.branch,\n\t\t...(worktree.baseRef === undefined ? {} : { baseRef: worktree.baseRef }),\n\t\tcreatedAt: worktree.createdAt,\n\t\tsessionIds: [...worktree.sessionIds],\n\t\t...(worktree.available === undefined ? {} : { available: worktree.available }),\n\t\t...(worktree.dirty === undefined ? {} : { dirty: worktree.dirty }),\n\t\t...(worktree.aheadBehind === undefined\n\t\t\t? {}\n\t\t\t: { aheadBehind: { ahead: worktree.aheadBehind.ahead, behind: worktree.aheadBehind.behind } }),\n\t};\n}\n"]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve configuration values that may be shell commands, environment variables, or literals.
|
|
3
|
+
* Used by auth-storage.ts and model-registry.ts.
|
|
4
|
+
*/
|
|
5
|
+
export declare function getConfigValueEnvVarName(config: string): string | undefined;
|
|
6
|
+
export declare function getConfigValueEnvVarNames(config: string): string[];
|
|
7
|
+
export declare function getMissingConfigValueEnvVarNames(config: string, env?: Record<string, string>): string[];
|
|
8
|
+
export declare function isCommandConfigValue(config: string): boolean;
|
|
9
|
+
export declare function isConfigValueConfigured(config: string, env?: Record<string, string>): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Resolve a config value (API key, header value, etc.) to an actual value.
|
|
12
|
+
* - If starts with "!", executes the rest as a shell command and uses stdout (cached)
|
|
13
|
+
* - Interpolates "$ENV_VAR" or "${ENV_VAR}" references with the named environment variable
|
|
14
|
+
* - In non-command values, "$$" escapes a literal "$" and "$!" escapes a literal "!"
|
|
15
|
+
* - Otherwise treats the value as a literal
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveConfigValue(config: string, env?: Record<string, string>): string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve all header values using the same resolution logic as API keys.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveConfigValueUncached(config: string, env?: Record<string, string>): string | undefined;
|
|
22
|
+
export declare function resolveConfigValueOrThrow(config: string, description: string, env?: Record<string, string>): string;
|
|
23
|
+
/**
|
|
24
|
+
* Resolve all header values using the same resolution logic as API keys.
|
|
25
|
+
*/
|
|
26
|
+
export declare function resolveHeaders(headers: Record<string, string> | undefined, env?: Record<string, string>): Record<string, string> | undefined;
|
|
27
|
+
export declare function resolveHeadersOrThrow(headers: Record<string, string> | undefined, description: string, env?: Record<string, string>): Record<string, string> | undefined;
|
|
28
|
+
/** Clear the config value command cache. Exported for testing. */
|
|
29
|
+
export declare function clearConfigValueCache(): void;
|
|
30
|
+
//# sourceMappingURL=resolve-config-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-config-value.d.ts","sourceRoot":"","sources":["../../src/core/resolve-config-value.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA+GH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI3E;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAGlE;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,EAAE,CAEvG;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAE7F;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAMnG;AAiED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,GAAG,SAAS,CAM3G;AAED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAsBnH;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC7B,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAUpC;AAED,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,EAC3C,WAAW,EAAE,MAAM,EACnB,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAOpC;AAED,kEAAkE;AAClE,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C","sourcesContent":["/**\n * Resolve configuration values that may be shell commands, environment variables, or literals.\n * Used by auth-storage.ts and model-registry.ts.\n */\n\nimport { execSync, spawnSync } from \"child_process\";\nimport { getShellConfig } from \"../utils/shell.ts\";\n\n// Cache for shell command results (persists for process lifetime)\nconst commandResultCache = new Map<string, string | undefined>();\nconst ENV_VAR_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;\nconst ENV_VAR_NAME_PREFIX_RE = /^[A-Za-z_][A-Za-z0-9_]*/;\n\ntype TemplatePart = { type: \"literal\"; value: string } | { type: \"env\"; name: string };\n\ntype ConfigValueReference = { type: \"command\"; config: string } | { type: \"template\"; parts: TemplatePart[] };\n\nfunction appendLiteral(parts: TemplatePart[], value: string): void {\n\tif (!value) return;\n\tconst previousPart = parts[parts.length - 1];\n\tif (previousPart?.type === \"literal\") {\n\t\tpreviousPart.value += value;\n\t\treturn;\n\t}\n\tparts.push({ type: \"literal\", value });\n}\n\nfunction parseConfigValueTemplate(config: string): TemplatePart[] {\n\tconst parts: TemplatePart[] = [];\n\tlet index = 0;\n\n\twhile (index < config.length) {\n\t\tconst dollarIndex = config.indexOf(\"$\", index);\n\t\tif (dollarIndex < 0) {\n\t\t\tappendLiteral(parts, config.slice(index));\n\t\t\tbreak;\n\t\t}\n\n\t\tappendLiteral(parts, config.slice(index, dollarIndex));\n\t\tconst nextChar = config[dollarIndex + 1];\n\n\t\tif (nextChar === \"$\" || nextChar === \"!\") {\n\t\t\tappendLiteral(parts, nextChar);\n\t\t\tindex = dollarIndex + 2;\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (nextChar === \"{\") {\n\t\t\tconst endIndex = config.indexOf(\"}\", dollarIndex + 2);\n\t\t\tif (endIndex < 0) {\n\t\t\t\tappendLiteral(parts, \"$\");\n\t\t\t\tindex = dollarIndex + 1;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tconst name = config.slice(dollarIndex + 2, endIndex);\n\t\t\tif (ENV_VAR_NAME_RE.test(name)) {\n\t\t\t\tparts.push({ type: \"env\", name });\n\t\t\t} else {\n\t\t\t\tappendLiteral(parts, config.slice(dollarIndex, endIndex + 1));\n\t\t\t}\n\t\t\tindex = endIndex + 1;\n\t\t\tcontinue;\n\t\t}\n\n\t\tconst match = config.slice(dollarIndex + 1).match(ENV_VAR_NAME_PREFIX_RE);\n\t\tif (match) {\n\t\t\tparts.push({ type: \"env\", name: match[0] });\n\t\t\tindex = dollarIndex + 1 + match[0].length;\n\t\t\tcontinue;\n\t\t}\n\n\t\tappendLiteral(parts, \"$\");\n\t\tindex = dollarIndex + 1;\n\t}\n\n\treturn parts;\n}\n\nfunction parseConfigValueReference(config: string): ConfigValueReference {\n\tif (config.startsWith(\"!\")) {\n\t\treturn { type: \"command\", config };\n\t}\n\n\treturn { type: \"template\", parts: parseConfigValueTemplate(config) };\n}\n\nfunction resolveEnvConfigValue(name: string, env?: Record<string, string>): string | undefined {\n\treturn env?.[name] || process.env[name] || undefined;\n}\n\nfunction getTemplateEnvVarNames(parts: TemplatePart[]): string[] {\n\tconst names: string[] = [];\n\tfor (const part of parts) {\n\t\tif (part.type !== \"env\" || names.includes(part.name)) continue;\n\t\tnames.push(part.name);\n\t}\n\treturn names;\n}\n\nfunction resolveTemplate(parts: TemplatePart[], env?: Record<string, string>): string | undefined {\n\tlet resolved = \"\";\n\tfor (const part of parts) {\n\t\tif (part.type === \"literal\") {\n\t\t\tresolved += part.value;\n\t\t\tcontinue;\n\t\t}\n\t\tconst envValue = resolveEnvConfigValue(part.name, env);\n\t\tif (envValue === undefined) return undefined;\n\t\tresolved += envValue;\n\t}\n\treturn resolved;\n}\n\nexport function getConfigValueEnvVarName(config: string): string | undefined {\n\tconst reference = parseConfigValueReference(config);\n\tif (reference.type !== \"template\") return undefined;\n\treturn reference.parts.length === 1 && reference.parts[0]?.type === \"env\" ? reference.parts[0].name : undefined;\n}\n\nexport function getConfigValueEnvVarNames(config: string): string[] {\n\tconst reference = parseConfigValueReference(config);\n\treturn reference.type === \"template\" ? getTemplateEnvVarNames(reference.parts) : [];\n}\n\nexport function getMissingConfigValueEnvVarNames(config: string, env?: Record<string, string>): string[] {\n\treturn getConfigValueEnvVarNames(config).filter((name) => resolveEnvConfigValue(name, env) === undefined);\n}\n\nexport function isCommandConfigValue(config: string): boolean {\n\treturn parseConfigValueReference(config).type === \"command\";\n}\n\nexport function isConfigValueConfigured(config: string, env?: Record<string, string>): boolean {\n\treturn getMissingConfigValueEnvVarNames(config, env).length === 0;\n}\n\n/**\n * Resolve a config value (API key, header value, etc.) to an actual value.\n * - If starts with \"!\", executes the rest as a shell command and uses stdout (cached)\n * - Interpolates \"$ENV_VAR\" or \"${ENV_VAR}\" references with the named environment variable\n * - In non-command values, \"$$\" escapes a literal \"$\" and \"$!\" escapes a literal \"!\"\n * - Otherwise treats the value as a literal\n */\nexport function resolveConfigValue(config: string, env?: Record<string, string>): string | undefined {\n\tconst reference = parseConfigValueReference(config);\n\tif (reference.type === \"command\") {\n\t\treturn executeCommand(reference.config);\n\t}\n\treturn resolveTemplate(reference.parts, env);\n}\n\nfunction executeWithConfiguredShell(command: string): { executed: boolean; value: string | undefined } {\n\ttry {\n\t\tconst { shell, args } = getShellConfig();\n\t\tconst result = spawnSync(shell, [...args, command], {\n\t\t\tencoding: \"utf-8\",\n\t\t\ttimeout: 10000,\n\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t\tshell: false,\n\t\t\twindowsHide: true,\n\t\t});\n\n\t\tif (result.error) {\n\t\t\tconst error = result.error as NodeJS.ErrnoException;\n\t\t\tif (error.code === \"ENOENT\") {\n\t\t\t\treturn { executed: false, value: undefined };\n\t\t\t}\n\t\t\treturn { executed: true, value: undefined };\n\t\t}\n\n\t\tif (result.status !== 0) {\n\t\t\treturn { executed: true, value: undefined };\n\t\t}\n\n\t\tconst value = (result.stdout ?? \"\").trim();\n\t\treturn { executed: true, value: value || undefined };\n\t} catch {\n\t\treturn { executed: false, value: undefined };\n\t}\n}\n\nfunction executeWithDefaultShell(command: string): string | undefined {\n\ttry {\n\t\tconst output = execSync(command, {\n\t\t\tencoding: \"utf-8\",\n\t\t\ttimeout: 10000,\n\t\t\tstdio: [\"ignore\", \"pipe\", \"ignore\"],\n\t\t});\n\t\treturn output.trim() || undefined;\n\t} catch {\n\t\treturn undefined;\n\t}\n}\n\nfunction executeCommandUncached(commandConfig: string): string | undefined {\n\tconst command = commandConfig.slice(1);\n\treturn process.platform === \"win32\"\n\t\t? (() => {\n\t\t\t\tconst configuredResult = executeWithConfiguredShell(command);\n\t\t\t\treturn configuredResult.executed ? configuredResult.value : executeWithDefaultShell(command);\n\t\t\t})()\n\t\t: executeWithDefaultShell(command);\n}\n\nfunction executeCommand(commandConfig: string): string | undefined {\n\tif (commandResultCache.has(commandConfig)) {\n\t\treturn commandResultCache.get(commandConfig);\n\t}\n\n\tconst result = executeCommandUncached(commandConfig);\n\tcommandResultCache.set(commandConfig, result);\n\treturn result;\n}\n\n/**\n * Resolve all header values using the same resolution logic as API keys.\n */\nexport function resolveConfigValueUncached(config: string, env?: Record<string, string>): string | undefined {\n\tconst reference = parseConfigValueReference(config);\n\tif (reference.type === \"command\") {\n\t\treturn executeCommandUncached(reference.config);\n\t}\n\treturn resolveTemplate(reference.parts, env);\n}\n\nexport function resolveConfigValueOrThrow(config: string, description: string, env?: Record<string, string>): string {\n\tconst resolvedValue = resolveConfigValueUncached(config, env);\n\tif (resolvedValue !== undefined) {\n\t\treturn resolvedValue;\n\t}\n\n\tconst reference = parseConfigValueReference(config);\n\tif (reference.type === \"command\") {\n\t\tthrow new Error(`Failed to resolve ${description} from shell command: ${reference.config.slice(1)}`);\n\t}\n\n\tif (reference.type === \"template\") {\n\t\tconst missingEnvVars = getMissingConfigValueEnvVarNames(config, env);\n\t\tif (missingEnvVars.length === 1) {\n\t\t\tthrow new Error(`Failed to resolve ${description} from environment variable: ${missingEnvVars[0]}`);\n\t\t}\n\t\tif (missingEnvVars.length > 1) {\n\t\t\tthrow new Error(`Failed to resolve ${description} from environment variables: ${missingEnvVars.join(\", \")}`);\n\t\t}\n\t}\n\n\tthrow new Error(`Failed to resolve ${description}`);\n}\n\n/**\n * Resolve all header values using the same resolution logic as API keys.\n */\nexport function resolveHeaders(\n\theaders: Record<string, string> | undefined,\n\tenv?: Record<string, string>,\n): Record<string, string> | undefined {\n\tif (!headers) return undefined;\n\tconst resolved: Record<string, string> = {};\n\tfor (const [key, value] of Object.entries(headers)) {\n\t\tconst resolvedValue = resolveConfigValue(value, env);\n\t\tif (resolvedValue) {\n\t\t\tresolved[key] = resolvedValue;\n\t\t}\n\t}\n\treturn Object.keys(resolved).length > 0 ? resolved : undefined;\n}\n\nexport function resolveHeadersOrThrow(\n\theaders: Record<string, string> | undefined,\n\tdescription: string,\n\tenv?: Record<string, string>,\n): Record<string, string> | undefined {\n\tif (!headers) return undefined;\n\tconst resolved: Record<string, string> = {};\n\tfor (const [key, value] of Object.entries(headers)) {\n\t\tresolved[key] = resolveConfigValueOrThrow(value, `${description} header \"${key}\"`, env);\n\t}\n\treturn Object.keys(resolved).length > 0 ? resolved : undefined;\n}\n\n/** Clear the config value command cache. Exported for testing. */\nexport function clearConfigValueCache(): void {\n\tcommandResultCache.clear();\n}\n"]}
|