@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,499 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
import { randomBytes } from "node:crypto";
|
|
3
|
+
import { cloneIrohRemoteRpcGrant, createIrohRemotePresetAccess } from "./access-grant.js";
|
|
4
|
+
import { IrohRemoteAuditLogger } from "./audit.js";
|
|
5
|
+
import { hashIrohRemotePairingSecret, } from "./authorization.js";
|
|
6
|
+
import { assertIrohRemoteHandshakeHostIdentity, createIrohRemoteHandshakeFailure, createIrohRemoteHandshakeSuccess, IrohRemoteHandshakeError, parseIrohRemoteHandshakeResponseLine, parseIrohRemoteHelloLine, } from "./handshake.js";
|
|
7
|
+
import { readIrohRemoteHandshakeLine, writeIrohRemoteHandshakeResponse, writeIrohRemoteHello, } from "./handshake-reader.js";
|
|
8
|
+
import { createIrohRemoteHostMetadata } from "./metadata.js";
|
|
9
|
+
import { DEFAULT_IROH_REMOTE_ALLOW_TOOLS, IROH_REMOTE_ALPN, IROH_REMOTE_HOST_FEATURES, normalizeIrohRemoteAllowTools, } from "./protocol.js";
|
|
10
|
+
import { parseIrohRemoteWorkspace, } from "./state.js";
|
|
11
|
+
import { assertIrohRemoteTicketNotExpired, decodeIrohRemoteTicketPayload, encodeIrohRemoteTicketPayload, } from "./ticket.js";
|
|
12
|
+
import { findIrohRemoteWorkspace } from "./workspace.js";
|
|
13
|
+
export const DEFAULT_IROH_REMOTE_PAIRING_TICKET_TTL_MS = 10 * 60 * 1000;
|
|
14
|
+
function createConversationHandshakeMetadata(hello, conversationSession) {
|
|
15
|
+
if (hello.mode !== "conversation") {
|
|
16
|
+
throw new Error("conversation handshake metadata requires a conversation hello");
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
target: hello.conversation.target,
|
|
20
|
+
sessionId: conversationSession.sessionId,
|
|
21
|
+
selection: conversationSession.selection,
|
|
22
|
+
...(conversationSession.requestedSessionId === undefined
|
|
23
|
+
? {}
|
|
24
|
+
: { requestedSessionId: conversationSession.requestedSessionId }),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function isEmptyIrohRemoteHostStateForRuntimePairingBootstrap(state) {
|
|
28
|
+
return (state.workspaces.length === 0 &&
|
|
29
|
+
state.clients.length === 0 &&
|
|
30
|
+
(state.revokedClients ?? []).length === 0 &&
|
|
31
|
+
(state.pendingPairingTickets ?? []).length === 0 &&
|
|
32
|
+
(state.pairingSecretTombstones ?? []).length === 0);
|
|
33
|
+
}
|
|
34
|
+
export class IrohRemoteHostEngine {
|
|
35
|
+
auditLogger;
|
|
36
|
+
classifyWorkspaceAvailability;
|
|
37
|
+
hostNodeId;
|
|
38
|
+
relayMode;
|
|
39
|
+
relayUrls;
|
|
40
|
+
now;
|
|
41
|
+
stateManager;
|
|
42
|
+
validateWorkspace;
|
|
43
|
+
workspace;
|
|
44
|
+
authorizationQueue = Promise.resolve();
|
|
45
|
+
allowTools;
|
|
46
|
+
rpcGrant;
|
|
47
|
+
pairingAllowTools;
|
|
48
|
+
pairingRpcGrant;
|
|
49
|
+
pairingExpiresAt;
|
|
50
|
+
pairingSecret;
|
|
51
|
+
pairingWorkspaceName;
|
|
52
|
+
constructor(options) {
|
|
53
|
+
const defaultAccess = createIrohRemotePresetAccess("coding");
|
|
54
|
+
this.allowTools = normalizeIrohRemoteAllowTools(options.allowTools ?? DEFAULT_IROH_REMOTE_ALLOW_TOOLS);
|
|
55
|
+
this.rpcGrant = cloneIrohRemoteRpcGrant(options.rpcGrant ?? defaultAccess.rpcGrant);
|
|
56
|
+
this.auditLogger = options.auditLogger ?? new IrohRemoteAuditLogger();
|
|
57
|
+
this.classifyWorkspaceAvailability = options.classifyWorkspaceAvailability;
|
|
58
|
+
this.hostNodeId = options.hostNodeId;
|
|
59
|
+
this.relayMode = options.relayMode;
|
|
60
|
+
this.relayUrls = options.relayUrls;
|
|
61
|
+
this.now = options.now ?? Date.now;
|
|
62
|
+
this.pairingExpiresAt = options.pairingExpiresAt;
|
|
63
|
+
this.pairingSecret = options.pairingSecret;
|
|
64
|
+
this.pairingWorkspaceName = options.pairingSecret === undefined ? undefined : options.workspace.name;
|
|
65
|
+
this.stateManager = options.stateManager;
|
|
66
|
+
this.validateWorkspace = options.validateWorkspace;
|
|
67
|
+
this.workspace = parseIrohRemoteWorkspace(options.workspace);
|
|
68
|
+
}
|
|
69
|
+
async pair(options) {
|
|
70
|
+
return this.runAuthorizationExclusive(async () => {
|
|
71
|
+
const requestedWorkspace = options.workspace ?? this.workspace.name;
|
|
72
|
+
const workspace = await this.resolvePairWorkspace(requestedWorkspace, options.workspace === undefined);
|
|
73
|
+
const secret = options.secret ?? randomBytes(24).toString("base64url");
|
|
74
|
+
const createdAt = this.now();
|
|
75
|
+
const expiresAt = options.expiresAt ?? createdAt + (options.ttlMs ?? DEFAULT_IROH_REMOTE_PAIRING_TICKET_TTL_MS);
|
|
76
|
+
const allowTools = normalizeIrohRemoteAllowTools(options.allowTools ?? workspace.allowedTools ?? this.allowTools);
|
|
77
|
+
const rpcGrant = cloneIrohRemoteRpcGrant(options.rpcGrant ?? this.rpcGrant);
|
|
78
|
+
this.pairingAllowTools = allowTools;
|
|
79
|
+
this.pairingRpcGrant = rpcGrant;
|
|
80
|
+
this.pairingSecret = secret;
|
|
81
|
+
this.pairingExpiresAt = expiresAt;
|
|
82
|
+
this.pairingWorkspaceName = workspace.name;
|
|
83
|
+
const pendingPairingTicket = await this.stateManager.addPendingPairingTicket({
|
|
84
|
+
secretHash: hashIrohRemotePairingSecret(secret),
|
|
85
|
+
workspace: workspace.name,
|
|
86
|
+
allowedTools: allowTools,
|
|
87
|
+
rpcGrant,
|
|
88
|
+
expiresAt,
|
|
89
|
+
createdAt,
|
|
90
|
+
...(options.labelHint === undefined ? {} : { labelHint: options.labelHint }),
|
|
91
|
+
});
|
|
92
|
+
const payload = {
|
|
93
|
+
alpn: IROH_REMOTE_ALPN,
|
|
94
|
+
expiresAt,
|
|
95
|
+
irohTicket: options.irohTicket,
|
|
96
|
+
nodeId: options.nodeId,
|
|
97
|
+
relayMode: options.relayMode,
|
|
98
|
+
...(options.relayUrls === undefined ? {} : { relayUrls: options.relayUrls }),
|
|
99
|
+
...(options.relayAuthToken === undefined ? {} : { relayAuthToken: options.relayAuthToken }),
|
|
100
|
+
secret,
|
|
101
|
+
workspace: workspace.name,
|
|
102
|
+
};
|
|
103
|
+
const ticket = encodeIrohRemoteTicketPayload(payload);
|
|
104
|
+
await this.log({
|
|
105
|
+
type: "pairing_ticket_created",
|
|
106
|
+
workspace: payload.workspace,
|
|
107
|
+
details: {
|
|
108
|
+
allowedTools: pendingPairingTicket.allowedTools,
|
|
109
|
+
rpcGrant: pendingPairingTicket.rpcGrant,
|
|
110
|
+
createdAt: pendingPairingTicket.createdAt,
|
|
111
|
+
expiresAt: pendingPairingTicket.expiresAt,
|
|
112
|
+
labelHint: pendingPairingTicket.labelHint,
|
|
113
|
+
nodeId: options.nodeId,
|
|
114
|
+
relayMode: options.relayMode,
|
|
115
|
+
},
|
|
116
|
+
});
|
|
117
|
+
return { expiresAt, payload, secret, ticket };
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
async listClients() {
|
|
121
|
+
const clients = await this.stateManager.listClients();
|
|
122
|
+
await this.log({ type: "clients_listed", details: { count: clients.length } });
|
|
123
|
+
return clients;
|
|
124
|
+
}
|
|
125
|
+
async revokeClient(nodeId) {
|
|
126
|
+
const result = await this.stateManager.revokeClient(nodeId, this.now());
|
|
127
|
+
await this.log({
|
|
128
|
+
type: "client_revoked",
|
|
129
|
+
clientNodeId: nodeId,
|
|
130
|
+
success: result.revoked,
|
|
131
|
+
error: result.revoked ? undefined : "client not found",
|
|
132
|
+
});
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
async updateClientAccess(nodeId, expectedRevision, access) {
|
|
136
|
+
const result = await this.stateManager.updateClientAccess(nodeId, expectedRevision, access);
|
|
137
|
+
await this.log({
|
|
138
|
+
type: "client_access_updated",
|
|
139
|
+
clientNodeId: nodeId,
|
|
140
|
+
success: result.ok,
|
|
141
|
+
error: result.ok ? undefined : result.reason,
|
|
142
|
+
details: result.ok
|
|
143
|
+
? {
|
|
144
|
+
expectedRevision,
|
|
145
|
+
revision: result.client.rpcGrant.revision,
|
|
146
|
+
allowedTools: result.client.allowedTools,
|
|
147
|
+
rpcCapabilities: result.client.rpcGrant.capabilities,
|
|
148
|
+
}
|
|
149
|
+
: { expectedRevision, currentRevision: result.currentRevision },
|
|
150
|
+
});
|
|
151
|
+
return result;
|
|
152
|
+
}
|
|
153
|
+
async approveClientRePair(nodeId) {
|
|
154
|
+
const result = await this.stateManager.approveClientRePair(nodeId, this.now());
|
|
155
|
+
await this.log({
|
|
156
|
+
type: "client_repair_approved",
|
|
157
|
+
clientNodeId: nodeId,
|
|
158
|
+
success: result.approved,
|
|
159
|
+
error: result.approved ? undefined : "revoked client not found",
|
|
160
|
+
});
|
|
161
|
+
return result;
|
|
162
|
+
}
|
|
163
|
+
async setClientLastSessionId(nodeId, workspace, sessionId) {
|
|
164
|
+
return this.stateManager.setClientLastSessionId(nodeId, workspace, sessionId);
|
|
165
|
+
}
|
|
166
|
+
async authorizeHello(hello, remoteNodeId) {
|
|
167
|
+
return this.runAuthorizationExclusive(() => this.authorizeHelloUnlocked(hello, remoteNodeId));
|
|
168
|
+
}
|
|
169
|
+
async ensurePrimaryWorkspaceRegistered() {
|
|
170
|
+
const state = await this.stateManager.getState();
|
|
171
|
+
const workspace = findIrohRemoteWorkspace(state, this.workspace.name);
|
|
172
|
+
if (workspace) {
|
|
173
|
+
return workspace;
|
|
174
|
+
}
|
|
175
|
+
return await this.stateManager.upsertWorkspace(this.workspace);
|
|
176
|
+
}
|
|
177
|
+
async resolvePairWorkspace(workspaceName, registerPrimaryFallback) {
|
|
178
|
+
const workspace = registerPrimaryFallback && workspaceName === this.workspace.name
|
|
179
|
+
? await this.ensurePrimaryWorkspaceRegistered()
|
|
180
|
+
: findIrohRemoteWorkspace(await this.stateManager.getState(), workspaceName);
|
|
181
|
+
if (!workspace) {
|
|
182
|
+
throw new Error(`workspace_unavailable: workspace not registered: ${workspaceName}`);
|
|
183
|
+
}
|
|
184
|
+
if (this.validateWorkspace !== undefined && !(await this.validateWorkspace(workspace))) {
|
|
185
|
+
throw new Error(`workspace_unavailable: workspace path is unavailable: ${workspaceName}`);
|
|
186
|
+
}
|
|
187
|
+
return workspace;
|
|
188
|
+
}
|
|
189
|
+
async authorizeHelloUnlocked(hello, remoteNodeId) {
|
|
190
|
+
await this.ensureRuntimePairingWorkspaceRegistered();
|
|
191
|
+
const allowTools = normalizeIrohRemoteAllowTools(this.pairingSecret !== undefined && hello.secret === this.pairingSecret
|
|
192
|
+
? (this.pairingAllowTools ?? this.allowTools)
|
|
193
|
+
: this.allowTools);
|
|
194
|
+
const result = await this.stateManager.authorizeClient(hello, remoteNodeId, {
|
|
195
|
+
allowTools,
|
|
196
|
+
rpcGrant: this.pairingSecret !== undefined && hello.secret === this.pairingSecret
|
|
197
|
+
? (this.pairingRpcGrant ?? this.rpcGrant)
|
|
198
|
+
: this.rpcGrant,
|
|
199
|
+
classifyWorkspaceAvailability: this.classifyWorkspaceAvailability,
|
|
200
|
+
now: this.now(),
|
|
201
|
+
pairingExpiresAt: this.pairingExpiresAt,
|
|
202
|
+
pairingSecret: this.pairingSecret,
|
|
203
|
+
validateWorkspace: this.validateWorkspace,
|
|
204
|
+
});
|
|
205
|
+
if (result.ok && result.pairingSecretConsumed) {
|
|
206
|
+
this.clearPairingSecret();
|
|
207
|
+
}
|
|
208
|
+
else if (!result.ok && result.pairingSecretExpired) {
|
|
209
|
+
this.clearPairingSecret();
|
|
210
|
+
}
|
|
211
|
+
await this.logPairingTicketLifecycle(result, remoteNodeId);
|
|
212
|
+
await this.logAuthorization(hello, remoteNodeId, result);
|
|
213
|
+
return result;
|
|
214
|
+
}
|
|
215
|
+
runAuthorizationExclusive(operation) {
|
|
216
|
+
const run = this.authorizationQueue.then(operation, operation);
|
|
217
|
+
this.authorizationQueue = run.then(() => undefined, () => undefined);
|
|
218
|
+
return run;
|
|
219
|
+
}
|
|
220
|
+
async readHandshake(stream, remoteNodeId, options = {}) {
|
|
221
|
+
let initialInput = Buffer.alloc(0);
|
|
222
|
+
try {
|
|
223
|
+
const handshake = await readIrohRemoteHandshakeLine(stream.recv, options);
|
|
224
|
+
initialInput = handshake.rest;
|
|
225
|
+
if (handshake.line === undefined) {
|
|
226
|
+
return await this.writeHandshakeResult(stream, await this.createHandshakeFailure("missing handshake", initialInput));
|
|
227
|
+
}
|
|
228
|
+
const hello = parseIrohRemoteHelloLine(handshake.line);
|
|
229
|
+
const authorization = await this.authorizeHello(hello, remoteNodeId);
|
|
230
|
+
if (!authorization.ok) {
|
|
231
|
+
return await this.writeHandshakeResult(stream, {
|
|
232
|
+
ok: false,
|
|
233
|
+
error: authorization.error,
|
|
234
|
+
initialInput,
|
|
235
|
+
response: createIrohRemoteHandshakeFailure(authorization.error, {
|
|
236
|
+
hostNodeId: this.hostNodeId,
|
|
237
|
+
outcome: authorization.outcome,
|
|
238
|
+
workspace: authorization.workspace?.name,
|
|
239
|
+
}),
|
|
240
|
+
responseWritten: false,
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
const successResult = {
|
|
244
|
+
ok: true,
|
|
245
|
+
authorization,
|
|
246
|
+
hello,
|
|
247
|
+
initialInput,
|
|
248
|
+
response: this.createHandshakeSuccessResponse(hello, authorization, remoteNodeId, options),
|
|
249
|
+
responseWritten: false,
|
|
250
|
+
};
|
|
251
|
+
if (options.writeSuccessResponse === false) {
|
|
252
|
+
return successResult;
|
|
253
|
+
}
|
|
254
|
+
return await this.writeHandshakeResult(stream, successResult);
|
|
255
|
+
}
|
|
256
|
+
catch (error) {
|
|
257
|
+
return await this.writeHandshakeResult(stream, await this.createHandshakeFailure(error instanceof Error ? error.message : String(error), initialInput, error));
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
setAllowTools(allowTools) {
|
|
261
|
+
this.allowTools = normalizeIrohRemoteAllowTools(allowTools);
|
|
262
|
+
}
|
|
263
|
+
clearPairingSecretForWorkspace(workspaceName) {
|
|
264
|
+
if (this.pairingWorkspaceName !== workspaceName) {
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
this.clearPairingSecret();
|
|
268
|
+
return true;
|
|
269
|
+
}
|
|
270
|
+
async cancelPairingSecretByHash(secretHash) {
|
|
271
|
+
return this.runAuthorizationExclusive(async () => {
|
|
272
|
+
const liveSecretMatches = this.pairingSecret !== undefined && hashIrohRemotePairingSecret(this.pairingSecret) === secretHash;
|
|
273
|
+
if (liveSecretMatches)
|
|
274
|
+
this.clearPairingSecret();
|
|
275
|
+
const removedPendingTicket = await this.stateManager.removePendingPairingTicket(secretHash);
|
|
276
|
+
return liveSecretMatches || removedPendingTicket;
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
async ensureRuntimePairingWorkspaceRegistered() {
|
|
280
|
+
if (this.pairingSecret === undefined || this.pairingWorkspaceName !== this.workspace.name) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
const state = await this.stateManager.getState();
|
|
284
|
+
if (findIrohRemoteWorkspace(state, this.workspace.name)) {
|
|
285
|
+
return;
|
|
286
|
+
}
|
|
287
|
+
if (isEmptyIrohRemoteHostStateForRuntimePairingBootstrap(state)) {
|
|
288
|
+
await this.stateManager.upsertWorkspace(this.workspace);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
this.clearPairingSecret();
|
|
292
|
+
}
|
|
293
|
+
clearPairingSecret() {
|
|
294
|
+
this.pairingAllowTools = undefined;
|
|
295
|
+
this.pairingRpcGrant = undefined;
|
|
296
|
+
this.pairingSecret = undefined;
|
|
297
|
+
this.pairingExpiresAt = undefined;
|
|
298
|
+
this.pairingWorkspaceName = undefined;
|
|
299
|
+
}
|
|
300
|
+
async createHandshakeFailure(error, initialInput, cause) {
|
|
301
|
+
const outcome = cause instanceof IrohRemoteHandshakeError ? cause.outcome : undefined;
|
|
302
|
+
await this.log({
|
|
303
|
+
type: "handshake_rejected",
|
|
304
|
+
workspace: this.workspace.name,
|
|
305
|
+
success: false,
|
|
306
|
+
error,
|
|
307
|
+
details: outcome === undefined ? undefined : { outcome },
|
|
308
|
+
});
|
|
309
|
+
return {
|
|
310
|
+
ok: false,
|
|
311
|
+
error,
|
|
312
|
+
initialInput,
|
|
313
|
+
response: createIrohRemoteHandshakeFailure(error, {
|
|
314
|
+
hostNodeId: this.hostNodeId,
|
|
315
|
+
...(outcome === undefined ? {} : { outcome }),
|
|
316
|
+
}),
|
|
317
|
+
responseWritten: false,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
createHandshakeSuccessResponse(hello, authorization, remoteNodeId, options) {
|
|
321
|
+
const common = {
|
|
322
|
+
child: options.child,
|
|
323
|
+
clientNodeId: remoteNodeId,
|
|
324
|
+
features: [...IROH_REMOTE_HOST_FEATURES],
|
|
325
|
+
hostNodeId: this.hostNodeId,
|
|
326
|
+
remoteHost: createIrohRemoteHostMetadata({
|
|
327
|
+
authorization,
|
|
328
|
+
hostNodeId: this.hostNodeId,
|
|
329
|
+
relayMode: this.relayMode,
|
|
330
|
+
relayUrls: this.relayUrls,
|
|
331
|
+
features: [...IROH_REMOTE_HOST_FEATURES],
|
|
332
|
+
}),
|
|
333
|
+
workspace: authorization.workspace.name,
|
|
334
|
+
};
|
|
335
|
+
if (hello.mode === "workspaceDiscovery") {
|
|
336
|
+
return createIrohRemoteHandshakeSuccess({
|
|
337
|
+
...common,
|
|
338
|
+
workspaceDiscovery: { purpose: hello.workspaceDiscovery.purpose },
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
if (hello.mode === "workspaceManagement") {
|
|
342
|
+
return createIrohRemoteHandshakeSuccess({
|
|
343
|
+
...common,
|
|
344
|
+
workspaceManagement: { purpose: hello.workspaceManagement.purpose },
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
if (options.conversationSession === undefined) {
|
|
348
|
+
if (options.writeSuccessResponse === false) {
|
|
349
|
+
return createIrohRemoteHandshakeSuccess(common);
|
|
350
|
+
}
|
|
351
|
+
throw new IrohRemoteHandshakeError("conversation_streams_unsupported", "conversation stream requires resolved session metadata");
|
|
352
|
+
}
|
|
353
|
+
return createIrohRemoteHandshakeSuccess({
|
|
354
|
+
...common,
|
|
355
|
+
sessionId: options.conversationSession.sessionId,
|
|
356
|
+
conversation: createConversationHandshakeMetadata(hello, options.conversationSession),
|
|
357
|
+
});
|
|
358
|
+
}
|
|
359
|
+
async writeHandshakeResult(stream, result) {
|
|
360
|
+
try {
|
|
361
|
+
await writeIrohRemoteHandshakeResponse(stream.send, result.response);
|
|
362
|
+
return { ...result, responseWritten: true };
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
// Authorization may already be committed; response write failures should not reclassify the result.
|
|
366
|
+
return {
|
|
367
|
+
...result,
|
|
368
|
+
responseWritten: false,
|
|
369
|
+
responseWriteError: error instanceof Error ? error.message : String(error),
|
|
370
|
+
};
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
async logPairingTicketLifecycle(result, remoteNodeId) {
|
|
374
|
+
for (const ticket of result.expiredPairingTickets ?? []) {
|
|
375
|
+
await this.log({
|
|
376
|
+
type: "pairing_ticket_expired",
|
|
377
|
+
workspace: ticket.workspace,
|
|
378
|
+
success: false,
|
|
379
|
+
details: {
|
|
380
|
+
allowedTools: ticket.allowedTools,
|
|
381
|
+
rpcGrant: ticket.rpcGrant,
|
|
382
|
+
createdAt: ticket.createdAt,
|
|
383
|
+
expiresAt: ticket.expiresAt,
|
|
384
|
+
},
|
|
385
|
+
});
|
|
386
|
+
}
|
|
387
|
+
if (!result.ok || !result.pairingSecretConsumed) {
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
await this.log({
|
|
391
|
+
type: "pairing_ticket_consumed",
|
|
392
|
+
clientNodeId: remoteNodeId,
|
|
393
|
+
workspace: result.workspace.name,
|
|
394
|
+
success: true,
|
|
395
|
+
details: result.consumedPairingTicket
|
|
396
|
+
? {
|
|
397
|
+
allowedTools: result.consumedPairingTicket.allowedTools,
|
|
398
|
+
rpcGrant: result.consumedPairingTicket.rpcGrant,
|
|
399
|
+
createdAt: result.consumedPairingTicket.createdAt,
|
|
400
|
+
expiresAt: result.consumedPairingTicket.expiresAt,
|
|
401
|
+
labelHint: result.consumedPairingTicket.labelHint,
|
|
402
|
+
}
|
|
403
|
+
: undefined,
|
|
404
|
+
});
|
|
405
|
+
}
|
|
406
|
+
async logAuthorization(hello, remoteNodeId, result) {
|
|
407
|
+
await this.log({
|
|
408
|
+
type: result.ok ? "client_authorized" : "client_rejected",
|
|
409
|
+
clientNodeId: remoteNodeId,
|
|
410
|
+
workspace: hello.workspace,
|
|
411
|
+
success: result.ok,
|
|
412
|
+
error: result.ok ? undefined : result.error,
|
|
413
|
+
details: result.ok
|
|
414
|
+
? { paired: result.paired }
|
|
415
|
+
: { outcome: result.outcome, pairingSecretExpired: result.pairingSecretExpired },
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
async log(event) {
|
|
419
|
+
try {
|
|
420
|
+
await this.auditLogger.log(event);
|
|
421
|
+
}
|
|
422
|
+
catch (error) {
|
|
423
|
+
// A valid handshake must not be reclassified as a failure when audit I/O
|
|
424
|
+
// fails, but a dropped security-relevant event must not vanish silently.
|
|
425
|
+
// Surface it to the daemon log (captured stderr) so the omission is visible.
|
|
426
|
+
console.error(`[iroh-remote] failed to write audit event ${event.type}: ${error instanceof Error ? error.message : String(error)}`);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
export class IrohRemoteClientEngine {
|
|
431
|
+
auditLogger;
|
|
432
|
+
clientLabel;
|
|
433
|
+
clientNodeId;
|
|
434
|
+
now;
|
|
435
|
+
constructor(options = {}) {
|
|
436
|
+
this.auditLogger = options.auditLogger ?? new IrohRemoteAuditLogger();
|
|
437
|
+
this.clientLabel = options.clientLabel;
|
|
438
|
+
this.clientNodeId = options.clientNodeId;
|
|
439
|
+
this.now = options.now ?? Date.now;
|
|
440
|
+
}
|
|
441
|
+
async createHelloFromTicket(ticket) {
|
|
442
|
+
const payload = decodeIrohRemoteTicketPayload(ticket);
|
|
443
|
+
assertIrohRemoteTicketNotExpired(payload, this.now());
|
|
444
|
+
const hello = this.createHello(payload);
|
|
445
|
+
await this.log({
|
|
446
|
+
type: "ticket_loaded",
|
|
447
|
+
workspace: payload.workspace,
|
|
448
|
+
details: { nodeId: payload.nodeId, relayMode: payload.relayMode },
|
|
449
|
+
});
|
|
450
|
+
return { hello, payload };
|
|
451
|
+
}
|
|
452
|
+
createHello(payload) {
|
|
453
|
+
return {
|
|
454
|
+
type: "volt_iroh_hello",
|
|
455
|
+
protocol: IROH_REMOTE_ALPN,
|
|
456
|
+
workspace: payload.workspace,
|
|
457
|
+
secret: payload.secret,
|
|
458
|
+
clientLabel: this.clientLabel,
|
|
459
|
+
clientNodeId: this.clientNodeId,
|
|
460
|
+
mode: "conversation",
|
|
461
|
+
conversation: { target: "last" },
|
|
462
|
+
};
|
|
463
|
+
}
|
|
464
|
+
async writeHello(stream, payload) {
|
|
465
|
+
const hello = this.createHello(payload);
|
|
466
|
+
await writeIrohRemoteHello(stream.send, hello);
|
|
467
|
+
await this.log({
|
|
468
|
+
type: "hello_sent",
|
|
469
|
+
workspace: payload.workspace,
|
|
470
|
+
details: { nodeId: payload.nodeId },
|
|
471
|
+
});
|
|
472
|
+
return hello;
|
|
473
|
+
}
|
|
474
|
+
async readHandshakeResponse(recv, options = {}) {
|
|
475
|
+
const handshake = await readIrohRemoteHandshakeLine(recv, options);
|
|
476
|
+
if (handshake.line === undefined) {
|
|
477
|
+
throw new Error("missing handshake response");
|
|
478
|
+
}
|
|
479
|
+
const response = parseIrohRemoteHandshakeResponseLine(handshake.line);
|
|
480
|
+
assertIrohRemoteHandshakeHostIdentity(response, options.expectedHostNodeId);
|
|
481
|
+
await this.log({
|
|
482
|
+
type: "handshake_response_received",
|
|
483
|
+
workspace: response.success ? response.workspace : undefined,
|
|
484
|
+
success: response.success,
|
|
485
|
+
error: response.success ? undefined : response.error,
|
|
486
|
+
details: response.success ? undefined : { outcome: response.outcome },
|
|
487
|
+
});
|
|
488
|
+
return { initialInput: handshake.rest, response };
|
|
489
|
+
}
|
|
490
|
+
async log(event) {
|
|
491
|
+
try {
|
|
492
|
+
await this.auditLogger.log(event);
|
|
493
|
+
}
|
|
494
|
+
catch {
|
|
495
|
+
// Client-side protocol progress should not fail after audit I/O fails.
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
//# sourceMappingURL=engine.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"engine.js","sourceRoot":"","sources":["../../../../src/core/remote/iroh/engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,uBAAuB,EAAE,4BAA4B,EAA2B,MAAM,mBAAmB,CAAC;AACnH,OAAO,EAAkC,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnF,OAAO,EACN,2BAA2B,GAG3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EACN,qCAAqC,EAC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QACH,OAAO,EAAE,YAAY,EAAE,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC;IAAA,CAClD;IAEO,KAAK,CAAC,GAAG,CAAC,KAAgC,EAAiB;QAClE,IAAI,CAAC;YACJ,MAAM,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnC,CAAC;QAAC,MAAM,CAAC;YACR,uEAAuE;QACxE,CAAC;IAAA,CACD;CACD","sourcesContent":["import { Buffer } from \"node:buffer\";\nimport { randomBytes } from \"node:crypto\";\nimport type { IrohBiStreamLike, IrohBytes, IrohRecvStreamLike } from \"../../rpc/index.ts\";\nimport { cloneIrohRemoteRpcGrant, createIrohRemotePresetAccess, type IrohRemoteRpcGrant } from \"./access-grant.ts\";\nimport { type IrohRemoteAuditEventInput, IrohRemoteAuditLogger } from \"./audit.ts\";\nimport {\n\thashIrohRemotePairingSecret,\n\ttype IrohRemoteClientAuthorizationResult,\n\ttype IrohRemoteClientAuthorizationSuccess,\n} from \"./authorization.ts\";\nimport {\n\tassertIrohRemoteHandshakeHostIdentity,\n\tcreateIrohRemoteHandshakeFailure,\n\tcreateIrohRemoteHandshakeSuccess,\n\ttype IrohRemoteConversationHandshakeMetadata,\n\ttype IrohRemoteConversationSelection,\n\tIrohRemoteHandshakeError,\n\ttype IrohRemoteHandshakeFailure,\n\ttype IrohRemoteHandshakeResponse,\n\ttype IrohRemoteHandshakeSuccess,\n\ttype IrohRemoteHello,\n\tparseIrohRemoteHandshakeResponseLine,\n\tparseIrohRemoteHelloLine,\n} from \"./handshake.ts\";\nimport {\n\ttype IrohRemoteHandshakeLineReadOptions,\n\treadIrohRemoteHandshakeLine,\n\twriteIrohRemoteHandshakeResponse,\n\twriteIrohRemoteHello,\n} from \"./handshake-reader.ts\";\nimport { createIrohRemoteHostMetadata } from \"./metadata.ts\";\nimport {\n\tDEFAULT_IROH_REMOTE_ALLOW_TOOLS,\n\tIROH_REMOTE_ALPN,\n\tIROH_REMOTE_HOST_FEATURES,\n\ttype IrohRemoteRelayMode,\n\tnormalizeIrohRemoteAllowTools,\n} from \"./protocol.ts\";\nimport {\n\ttype IrohRemoteClient,\n\ttype IrohRemoteHostState,\n\ttype IrohRemoteWorkspace,\n\tparseIrohRemoteWorkspace,\n} from \"./state.ts\";\nimport type {\n\tIrohRemoteClientAccessUpdateResult,\n\tIrohRemoteClientRePairApprovalResult,\n\tIrohRemoteClientRevocationResult,\n\tIrohRemoteHostStateManager,\n} from \"./state-manager.ts\";\nimport {\n\tassertIrohRemoteTicketNotExpired,\n\tdecodeIrohRemoteTicketPayload,\n\tencodeIrohRemoteTicketPayload,\n\ttype IrohRemoteTicketPayload,\n} from \"./ticket.ts\";\nimport { findIrohRemoteWorkspace, type IrohRemoteWorkspaceAvailabilityClassifier } from \"./workspace.ts\";\n\nexport const DEFAULT_IROH_REMOTE_PAIRING_TICKET_TTL_MS = 10 * 60 * 1000;\n\nexport interface IrohRemoteHostEngineOptions {\n\tallowTools?: string;\n\trpcGrant?: IrohRemoteRpcGrant;\n\tauditLogger?: IrohRemoteAuditLogger;\n\thostNodeId?: string;\n\tnow?: () => number;\n\tpairingExpiresAt?: number;\n\tpairingSecret?: string;\n\trelayMode?: IrohRemoteRelayMode;\n\trelayUrls?: string[];\n\tstateManager: IrohRemoteHostStateManager;\n\tclassifyWorkspaceAvailability?: IrohRemoteWorkspaceAvailabilityClassifier;\n\tvalidateWorkspace?: (workspace: IrohRemoteWorkspace) => boolean | Promise<boolean>;\n\tworkspace: IrohRemoteWorkspace;\n}\n\nexport interface IrohRemoteHostPairOptions {\n\tallowTools?: string;\n\trpcGrant?: IrohRemoteRpcGrant;\n\texpiresAt?: number;\n\tirohTicket: string;\n\tlabelHint?: string;\n\tnodeId?: string;\n\trelayMode?: IrohRemoteRelayMode;\n\trelayUrls?: string[];\n\trelayAuthToken?: string;\n\tsecret?: string;\n\tttlMs?: number;\n\tworkspace?: string;\n}\n\nexport interface IrohRemotePairingTicket {\n\texpiresAt: number;\n\tpayload: IrohRemoteTicketPayload;\n\tsecret: string;\n\tticket: string;\n}\n\nexport type IrohRemoteHostHandshakeResult =\n\t| {\n\t\t\tok: true;\n\t\t\tauthorization: IrohRemoteClientAuthorizationSuccess;\n\t\t\thello: IrohRemoteHello;\n\t\t\tinitialInput: IrohBytes;\n\t\t\tresponse: IrohRemoteHandshakeSuccess;\n\t\t\tresponseWritten: boolean;\n\t\t\tresponseWriteError?: string;\n\t }\n\t| {\n\t\t\tok: false;\n\t\t\terror: string;\n\t\t\tinitialInput: IrohBytes;\n\t\t\tresponse: IrohRemoteHandshakeFailure;\n\t\t\tresponseWritten: boolean;\n\t\t\tresponseWriteError?: string;\n\t };\n\nexport interface IrohRemoteHostReadHandshakeOptions extends IrohRemoteHandshakeLineReadOptions {\n\tchild?: string;\n\tconversationSession?: {\n\t\tselection: IrohRemoteConversationSelection;\n\t\tsessionId: string;\n\t\trequestedSessionId?: string;\n\t};\n\twriteSuccessResponse?: boolean;\n}\n\nexport interface IrohRemoteClientEngineOptions {\n\tauditLogger?: IrohRemoteAuditLogger;\n\tclientLabel?: string;\n\tclientNodeId?: string;\n\tnow?: () => number;\n}\n\nexport interface IrohRemoteClientTicketHello {\n\thello: IrohRemoteHello;\n\tpayload: IrohRemoteTicketPayload;\n}\n\nexport interface IrohRemoteClientHandshakeResponseResult {\n\tinitialInput: IrohBytes;\n\tresponse: IrohRemoteHandshakeResponse;\n}\n\nexport interface IrohRemoteClientReadHandshakeResponseOptions extends IrohRemoteHandshakeLineReadOptions {\n\texpectedHostNodeId?: string;\n}\n\nfunction createConversationHandshakeMetadata(\n\thello: IrohRemoteHello,\n\tconversationSession: { selection: IrohRemoteConversationSelection; sessionId: string; requestedSessionId?: string },\n): IrohRemoteConversationHandshakeMetadata {\n\tif (hello.mode !== \"conversation\") {\n\t\tthrow new Error(\"conversation handshake metadata requires a conversation hello\");\n\t}\n\treturn {\n\t\ttarget: hello.conversation.target,\n\t\tsessionId: conversationSession.sessionId,\n\t\tselection: conversationSession.selection,\n\t\t...(conversationSession.requestedSessionId === undefined\n\t\t\t? {}\n\t\t\t: { requestedSessionId: conversationSession.requestedSessionId }),\n\t};\n}\n\nfunction isEmptyIrohRemoteHostStateForRuntimePairingBootstrap(state: IrohRemoteHostState): boolean {\n\treturn (\n\t\tstate.workspaces.length === 0 &&\n\t\tstate.clients.length === 0 &&\n\t\t(state.revokedClients ?? []).length === 0 &&\n\t\t(state.pendingPairingTickets ?? []).length === 0 &&\n\t\t(state.pairingSecretTombstones ?? []).length === 0\n\t);\n}\n\nexport class IrohRemoteHostEngine {\n\tprivate readonly auditLogger: IrohRemoteAuditLogger;\n\tprivate readonly classifyWorkspaceAvailability: IrohRemoteWorkspaceAvailabilityClassifier | undefined;\n\tprivate readonly hostNodeId: string | undefined;\n\tprivate readonly relayMode: IrohRemoteRelayMode | undefined;\n\tprivate readonly relayUrls: string[] | undefined;\n\tprivate readonly now: () => number;\n\tprivate readonly stateManager: IrohRemoteHostStateManager;\n\tprivate readonly validateWorkspace: ((workspace: IrohRemoteWorkspace) => boolean | Promise<boolean>) | undefined;\n\tprivate readonly workspace: IrohRemoteWorkspace;\n\tprivate authorizationQueue: Promise<void> = Promise.resolve();\n\tprivate allowTools: string;\n\tprivate rpcGrant: IrohRemoteRpcGrant;\n\tprivate pairingAllowTools: string | undefined;\n\tprivate pairingRpcGrant: IrohRemoteRpcGrant | undefined;\n\tprivate pairingExpiresAt: number | undefined;\n\tprivate pairingSecret: string | undefined;\n\tprivate pairingWorkspaceName: string | undefined;\n\n\tconstructor(options: IrohRemoteHostEngineOptions) {\n\t\tconst defaultAccess = createIrohRemotePresetAccess(\"coding\");\n\t\tthis.allowTools = normalizeIrohRemoteAllowTools(options.allowTools ?? DEFAULT_IROH_REMOTE_ALLOW_TOOLS);\n\t\tthis.rpcGrant = cloneIrohRemoteRpcGrant(options.rpcGrant ?? defaultAccess.rpcGrant);\n\t\tthis.auditLogger = options.auditLogger ?? new IrohRemoteAuditLogger();\n\t\tthis.classifyWorkspaceAvailability = options.classifyWorkspaceAvailability;\n\t\tthis.hostNodeId = options.hostNodeId;\n\t\tthis.relayMode = options.relayMode;\n\t\tthis.relayUrls = options.relayUrls;\n\t\tthis.now = options.now ?? Date.now;\n\t\tthis.pairingExpiresAt = options.pairingExpiresAt;\n\t\tthis.pairingSecret = options.pairingSecret;\n\t\tthis.pairingWorkspaceName = options.pairingSecret === undefined ? undefined : options.workspace.name;\n\t\tthis.stateManager = options.stateManager;\n\t\tthis.validateWorkspace = options.validateWorkspace;\n\t\tthis.workspace = parseIrohRemoteWorkspace(options.workspace);\n\t}\n\n\tasync pair(options: IrohRemoteHostPairOptions): Promise<IrohRemotePairingTicket> {\n\t\treturn this.runAuthorizationExclusive(async () => {\n\t\t\tconst requestedWorkspace = options.workspace ?? this.workspace.name;\n\t\t\tconst workspace = await this.resolvePairWorkspace(requestedWorkspace, options.workspace === undefined);\n\n\t\t\tconst secret = options.secret ?? randomBytes(24).toString(\"base64url\");\n\t\t\tconst createdAt = this.now();\n\t\t\tconst expiresAt =\n\t\t\t\toptions.expiresAt ?? createdAt + (options.ttlMs ?? DEFAULT_IROH_REMOTE_PAIRING_TICKET_TTL_MS);\n\t\t\tconst allowTools = normalizeIrohRemoteAllowTools(\n\t\t\t\toptions.allowTools ?? workspace.allowedTools ?? this.allowTools,\n\t\t\t);\n\t\t\tconst rpcGrant = cloneIrohRemoteRpcGrant(options.rpcGrant ?? this.rpcGrant);\n\t\t\tthis.pairingAllowTools = allowTools;\n\t\t\tthis.pairingRpcGrant = rpcGrant;\n\t\t\tthis.pairingSecret = secret;\n\t\t\tthis.pairingExpiresAt = expiresAt;\n\t\t\tthis.pairingWorkspaceName = workspace.name;\n\t\t\tconst pendingPairingTicket = await this.stateManager.addPendingPairingTicket({\n\t\t\t\tsecretHash: hashIrohRemotePairingSecret(secret),\n\t\t\t\tworkspace: workspace.name,\n\t\t\t\tallowedTools: allowTools,\n\t\t\t\trpcGrant,\n\t\t\t\texpiresAt,\n\t\t\t\tcreatedAt,\n\t\t\t\t...(options.labelHint === undefined ? {} : { labelHint: options.labelHint }),\n\t\t\t});\n\n\t\t\tconst payload: IrohRemoteTicketPayload = {\n\t\t\t\talpn: IROH_REMOTE_ALPN,\n\t\t\t\texpiresAt,\n\t\t\t\tirohTicket: options.irohTicket,\n\t\t\t\tnodeId: options.nodeId,\n\t\t\t\trelayMode: options.relayMode,\n\t\t\t\t...(options.relayUrls === undefined ? {} : { relayUrls: options.relayUrls }),\n\t\t\t\t...(options.relayAuthToken === undefined ? {} : { relayAuthToken: options.relayAuthToken }),\n\t\t\t\tsecret,\n\t\t\t\tworkspace: workspace.name,\n\t\t\t};\n\t\t\tconst ticket = encodeIrohRemoteTicketPayload(payload);\n\t\t\tawait this.log({\n\t\t\t\ttype: \"pairing_ticket_created\",\n\t\t\t\tworkspace: payload.workspace,\n\t\t\t\tdetails: {\n\t\t\t\t\tallowedTools: pendingPairingTicket.allowedTools,\n\t\t\t\t\trpcGrant: pendingPairingTicket.rpcGrant,\n\t\t\t\t\tcreatedAt: pendingPairingTicket.createdAt,\n\t\t\t\t\texpiresAt: pendingPairingTicket.expiresAt,\n\t\t\t\t\tlabelHint: pendingPairingTicket.labelHint,\n\t\t\t\t\tnodeId: options.nodeId,\n\t\t\t\t\trelayMode: options.relayMode,\n\t\t\t\t},\n\t\t\t});\n\t\t\treturn { expiresAt, payload, secret, ticket };\n\t\t});\n\t}\n\n\tasync listClients(): Promise<IrohRemoteClient[]> {\n\t\tconst clients = await this.stateManager.listClients();\n\t\tawait this.log({ type: \"clients_listed\", details: { count: clients.length } });\n\t\treturn clients;\n\t}\n\n\tasync revokeClient(nodeId: string): Promise<IrohRemoteClientRevocationResult> {\n\t\tconst result = await this.stateManager.revokeClient(nodeId, this.now());\n\t\tawait this.log({\n\t\t\ttype: \"client_revoked\",\n\t\t\tclientNodeId: nodeId,\n\t\t\tsuccess: result.revoked,\n\t\t\terror: result.revoked ? undefined : \"client not found\",\n\t\t});\n\t\treturn result;\n\t}\n\n\tasync updateClientAccess(\n\t\tnodeId: string,\n\t\texpectedRevision: number,\n\t\taccess: { allowedTools: string; rpcGrant: IrohRemoteRpcGrant },\n\t): Promise<IrohRemoteClientAccessUpdateResult> {\n\t\tconst result = await this.stateManager.updateClientAccess(nodeId, expectedRevision, access);\n\t\tawait this.log({\n\t\t\ttype: \"client_access_updated\",\n\t\t\tclientNodeId: nodeId,\n\t\t\tsuccess: result.ok,\n\t\t\terror: result.ok ? undefined : result.reason,\n\t\t\tdetails: result.ok\n\t\t\t\t? {\n\t\t\t\t\t\texpectedRevision,\n\t\t\t\t\t\trevision: result.client.rpcGrant.revision,\n\t\t\t\t\t\tallowedTools: result.client.allowedTools,\n\t\t\t\t\t\trpcCapabilities: result.client.rpcGrant.capabilities,\n\t\t\t\t\t}\n\t\t\t\t: { expectedRevision, currentRevision: result.currentRevision },\n\t\t});\n\t\treturn result;\n\t}\n\n\tasync approveClientRePair(nodeId: string): Promise<IrohRemoteClientRePairApprovalResult> {\n\t\tconst result = await this.stateManager.approveClientRePair(nodeId, this.now());\n\t\tawait this.log({\n\t\t\ttype: \"client_repair_approved\",\n\t\t\tclientNodeId: nodeId,\n\t\t\tsuccess: result.approved,\n\t\t\terror: result.approved ? undefined : \"revoked client not found\",\n\t\t});\n\t\treturn result;\n\t}\n\n\tasync setClientLastSessionId(\n\t\tnodeId: string,\n\t\tworkspace: string,\n\t\tsessionId: string,\n\t): Promise<IrohRemoteClient | undefined> {\n\t\treturn this.stateManager.setClientLastSessionId(nodeId, workspace, sessionId);\n\t}\n\n\tasync authorizeHello(hello: IrohRemoteHello, remoteNodeId: string): Promise<IrohRemoteClientAuthorizationResult> {\n\t\treturn this.runAuthorizationExclusive(() => this.authorizeHelloUnlocked(hello, remoteNodeId));\n\t}\n\n\tprivate async ensurePrimaryWorkspaceRegistered(): Promise<IrohRemoteWorkspace> {\n\t\tconst state = await this.stateManager.getState();\n\t\tconst workspace = findIrohRemoteWorkspace(state, this.workspace.name);\n\t\tif (workspace) {\n\t\t\treturn workspace;\n\t\t}\n\t\treturn await this.stateManager.upsertWorkspace(this.workspace);\n\t}\n\n\tprivate async resolvePairWorkspace(\n\t\tworkspaceName: string,\n\t\tregisterPrimaryFallback: boolean,\n\t): Promise<IrohRemoteWorkspace> {\n\t\tconst workspace =\n\t\t\tregisterPrimaryFallback && workspaceName === this.workspace.name\n\t\t\t\t? await this.ensurePrimaryWorkspaceRegistered()\n\t\t\t\t: findIrohRemoteWorkspace(await this.stateManager.getState(), workspaceName);\n\t\tif (!workspace) {\n\t\t\tthrow new Error(`workspace_unavailable: workspace not registered: ${workspaceName}`);\n\t\t}\n\t\tif (this.validateWorkspace !== undefined && !(await this.validateWorkspace(workspace))) {\n\t\t\tthrow new Error(`workspace_unavailable: workspace path is unavailable: ${workspaceName}`);\n\t\t}\n\t\treturn workspace;\n\t}\n\n\tprivate async authorizeHelloUnlocked(\n\t\thello: IrohRemoteHello,\n\t\tremoteNodeId: string,\n\t): Promise<IrohRemoteClientAuthorizationResult> {\n\t\tawait this.ensureRuntimePairingWorkspaceRegistered();\n\t\tconst allowTools = normalizeIrohRemoteAllowTools(\n\t\t\tthis.pairingSecret !== undefined && hello.secret === this.pairingSecret\n\t\t\t\t? (this.pairingAllowTools ?? this.allowTools)\n\t\t\t\t: this.allowTools,\n\t\t);\n\t\tconst result = await this.stateManager.authorizeClient(hello, remoteNodeId, {\n\t\t\tallowTools,\n\t\t\trpcGrant:\n\t\t\t\tthis.pairingSecret !== undefined && hello.secret === this.pairingSecret\n\t\t\t\t\t? (this.pairingRpcGrant ?? this.rpcGrant)\n\t\t\t\t\t: this.rpcGrant,\n\t\t\tclassifyWorkspaceAvailability: this.classifyWorkspaceAvailability,\n\t\t\tnow: this.now(),\n\t\t\tpairingExpiresAt: this.pairingExpiresAt,\n\t\t\tpairingSecret: this.pairingSecret,\n\t\t\tvalidateWorkspace: this.validateWorkspace,\n\t\t});\n\n\t\tif (result.ok && result.pairingSecretConsumed) {\n\t\t\tthis.clearPairingSecret();\n\t\t} else if (!result.ok && result.pairingSecretExpired) {\n\t\t\tthis.clearPairingSecret();\n\t\t}\n\n\t\tawait this.logPairingTicketLifecycle(result, remoteNodeId);\n\t\tawait this.logAuthorization(hello, remoteNodeId, result);\n\t\treturn result;\n\t}\n\n\tprivate runAuthorizationExclusive<T>(operation: () => Promise<T>): Promise<T> {\n\t\tconst run = this.authorizationQueue.then(operation, operation);\n\t\tthis.authorizationQueue = run.then(\n\t\t\t() => undefined,\n\t\t\t() => undefined,\n\t\t);\n\t\treturn run;\n\t}\n\n\tasync readHandshake(\n\t\tstream: IrohBiStreamLike,\n\t\tremoteNodeId: string,\n\t\toptions: IrohRemoteHostReadHandshakeOptions = {},\n\t): Promise<IrohRemoteHostHandshakeResult> {\n\t\tlet initialInput: IrohBytes = Buffer.alloc(0);\n\t\ttry {\n\t\t\tconst handshake = await readIrohRemoteHandshakeLine(stream.recv, options);\n\t\t\tinitialInput = handshake.rest;\n\t\t\tif (handshake.line === undefined) {\n\t\t\t\treturn await this.writeHandshakeResult(\n\t\t\t\t\tstream,\n\t\t\t\t\tawait this.createHandshakeFailure(\"missing handshake\", initialInput),\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst hello = parseIrohRemoteHelloLine(handshake.line);\n\t\t\tconst authorization = await this.authorizeHello(hello, remoteNodeId);\n\t\t\tif (!authorization.ok) {\n\t\t\t\treturn await this.writeHandshakeResult(stream, {\n\t\t\t\t\tok: false,\n\t\t\t\t\terror: authorization.error,\n\t\t\t\t\tinitialInput,\n\t\t\t\t\tresponse: createIrohRemoteHandshakeFailure(authorization.error, {\n\t\t\t\t\t\thostNodeId: this.hostNodeId,\n\t\t\t\t\t\toutcome: authorization.outcome,\n\t\t\t\t\t\tworkspace: authorization.workspace?.name,\n\t\t\t\t\t}),\n\t\t\t\t\tresponseWritten: false,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst successResult: IrohRemoteHostHandshakeResult = {\n\t\t\t\tok: true,\n\t\t\t\tauthorization,\n\t\t\t\thello,\n\t\t\t\tinitialInput,\n\t\t\t\tresponse: this.createHandshakeSuccessResponse(hello, authorization, remoteNodeId, options),\n\t\t\t\tresponseWritten: false,\n\t\t\t};\n\t\t\tif (options.writeSuccessResponse === false) {\n\t\t\t\treturn successResult;\n\t\t\t}\n\t\t\treturn await this.writeHandshakeResult(stream, successResult);\n\t\t} catch (error: unknown) {\n\t\t\treturn await this.writeHandshakeResult(\n\t\t\t\tstream,\n\t\t\t\tawait this.createHandshakeFailure(\n\t\t\t\t\terror instanceof Error ? error.message : String(error),\n\t\t\t\t\tinitialInput,\n\t\t\t\t\terror,\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tsetAllowTools(allowTools: string): void {\n\t\tthis.allowTools = normalizeIrohRemoteAllowTools(allowTools);\n\t}\n\n\tclearPairingSecretForWorkspace(workspaceName: string): boolean {\n\t\tif (this.pairingWorkspaceName !== workspaceName) {\n\t\t\treturn false;\n\t\t}\n\t\tthis.clearPairingSecret();\n\t\treturn true;\n\t}\n\n\tasync cancelPairingSecretByHash(secretHash: string): Promise<boolean> {\n\t\treturn this.runAuthorizationExclusive(async () => {\n\t\t\tconst liveSecretMatches =\n\t\t\t\tthis.pairingSecret !== undefined && hashIrohRemotePairingSecret(this.pairingSecret) === secretHash;\n\t\t\tif (liveSecretMatches) this.clearPairingSecret();\n\t\t\tconst removedPendingTicket = await this.stateManager.removePendingPairingTicket(secretHash);\n\t\t\treturn liveSecretMatches || removedPendingTicket;\n\t\t});\n\t}\n\n\tprivate async ensureRuntimePairingWorkspaceRegistered(): Promise<void> {\n\t\tif (this.pairingSecret === undefined || this.pairingWorkspaceName !== this.workspace.name) {\n\t\t\treturn;\n\t\t}\n\t\tconst state = await this.stateManager.getState();\n\t\tif (findIrohRemoteWorkspace(state, this.workspace.name)) {\n\t\t\treturn;\n\t\t}\n\t\tif (isEmptyIrohRemoteHostStateForRuntimePairingBootstrap(state)) {\n\t\t\tawait this.stateManager.upsertWorkspace(this.workspace);\n\t\t\treturn;\n\t\t}\n\t\tthis.clearPairingSecret();\n\t}\n\n\tprivate clearPairingSecret(): void {\n\t\tthis.pairingAllowTools = undefined;\n\t\tthis.pairingRpcGrant = undefined;\n\t\tthis.pairingSecret = undefined;\n\t\tthis.pairingExpiresAt = undefined;\n\t\tthis.pairingWorkspaceName = undefined;\n\t}\n\n\tprivate async createHandshakeFailure(\n\t\terror: string,\n\t\tinitialInput: IrohBytes,\n\t\tcause?: unknown,\n\t): Promise<IrohRemoteHostHandshakeResult> {\n\t\tconst outcome = cause instanceof IrohRemoteHandshakeError ? cause.outcome : undefined;\n\t\tawait this.log({\n\t\t\ttype: \"handshake_rejected\",\n\t\t\tworkspace: this.workspace.name,\n\t\t\tsuccess: false,\n\t\t\terror,\n\t\t\tdetails: outcome === undefined ? undefined : { outcome },\n\t\t});\n\t\treturn {\n\t\t\tok: false,\n\t\t\terror,\n\t\t\tinitialInput,\n\t\t\tresponse: createIrohRemoteHandshakeFailure(error, {\n\t\t\t\thostNodeId: this.hostNodeId,\n\t\t\t\t...(outcome === undefined ? {} : { outcome }),\n\t\t\t}),\n\t\t\tresponseWritten: false,\n\t\t};\n\t}\n\n\tprivate createHandshakeSuccessResponse(\n\t\thello: IrohRemoteHello,\n\t\tauthorization: IrohRemoteClientAuthorizationSuccess,\n\t\tremoteNodeId: string,\n\t\toptions: IrohRemoteHostReadHandshakeOptions,\n\t): IrohRemoteHandshakeSuccess {\n\t\tconst common = {\n\t\t\tchild: options.child,\n\t\t\tclientNodeId: remoteNodeId,\n\t\t\tfeatures: [...IROH_REMOTE_HOST_FEATURES],\n\t\t\thostNodeId: this.hostNodeId,\n\t\t\tremoteHost: createIrohRemoteHostMetadata({\n\t\t\t\tauthorization,\n\t\t\t\thostNodeId: this.hostNodeId,\n\t\t\t\trelayMode: this.relayMode,\n\t\t\t\trelayUrls: this.relayUrls,\n\t\t\t\tfeatures: [...IROH_REMOTE_HOST_FEATURES],\n\t\t\t}),\n\t\t\tworkspace: authorization.workspace.name,\n\t\t};\n\t\tif (hello.mode === \"workspaceDiscovery\") {\n\t\t\treturn createIrohRemoteHandshakeSuccess({\n\t\t\t\t...common,\n\t\t\t\tworkspaceDiscovery: { purpose: hello.workspaceDiscovery.purpose },\n\t\t\t});\n\t\t}\n\t\tif (hello.mode === \"workspaceManagement\") {\n\t\t\treturn createIrohRemoteHandshakeSuccess({\n\t\t\t\t...common,\n\t\t\t\tworkspaceManagement: { purpose: hello.workspaceManagement.purpose },\n\t\t\t});\n\t\t}\n\t\tif (options.conversationSession === undefined) {\n\t\t\tif (options.writeSuccessResponse === false) {\n\t\t\t\treturn createIrohRemoteHandshakeSuccess(common);\n\t\t\t}\n\t\t\tthrow new IrohRemoteHandshakeError(\n\t\t\t\t\"conversation_streams_unsupported\",\n\t\t\t\t\"conversation stream requires resolved session metadata\",\n\t\t\t);\n\t\t}\n\t\treturn createIrohRemoteHandshakeSuccess({\n\t\t\t...common,\n\t\t\tsessionId: options.conversationSession.sessionId,\n\t\t\tconversation: createConversationHandshakeMetadata(hello, options.conversationSession),\n\t\t});\n\t}\n\n\tprivate async writeHandshakeResult(\n\t\tstream: IrohBiStreamLike,\n\t\tresult: IrohRemoteHostHandshakeResult,\n\t): Promise<IrohRemoteHostHandshakeResult> {\n\t\ttry {\n\t\t\tawait writeIrohRemoteHandshakeResponse(stream.send, result.response);\n\t\t\treturn { ...result, responseWritten: true };\n\t\t} catch (error) {\n\t\t\t// Authorization may already be committed; response write failures should not reclassify the result.\n\t\t\treturn {\n\t\t\t\t...result,\n\t\t\t\tresponseWritten: false,\n\t\t\t\tresponseWriteError: error instanceof Error ? error.message : String(error),\n\t\t\t};\n\t\t}\n\t}\n\n\tprivate async logPairingTicketLifecycle(\n\t\tresult: IrohRemoteClientAuthorizationResult,\n\t\tremoteNodeId: string,\n\t): Promise<void> {\n\t\tfor (const ticket of result.expiredPairingTickets ?? []) {\n\t\t\tawait this.log({\n\t\t\t\ttype: \"pairing_ticket_expired\",\n\t\t\t\tworkspace: ticket.workspace,\n\t\t\t\tsuccess: false,\n\t\t\t\tdetails: {\n\t\t\t\t\tallowedTools: ticket.allowedTools,\n\t\t\t\t\trpcGrant: ticket.rpcGrant,\n\t\t\t\t\tcreatedAt: ticket.createdAt,\n\t\t\t\t\texpiresAt: ticket.expiresAt,\n\t\t\t\t},\n\t\t\t});\n\t\t}\n\t\tif (!result.ok || !result.pairingSecretConsumed) {\n\t\t\treturn;\n\t\t}\n\t\tawait this.log({\n\t\t\ttype: \"pairing_ticket_consumed\",\n\t\t\tclientNodeId: remoteNodeId,\n\t\t\tworkspace: result.workspace.name,\n\t\t\tsuccess: true,\n\t\t\tdetails: result.consumedPairingTicket\n\t\t\t\t? {\n\t\t\t\t\t\tallowedTools: result.consumedPairingTicket.allowedTools,\n\t\t\t\t\t\trpcGrant: result.consumedPairingTicket.rpcGrant,\n\t\t\t\t\t\tcreatedAt: result.consumedPairingTicket.createdAt,\n\t\t\t\t\t\texpiresAt: result.consumedPairingTicket.expiresAt,\n\t\t\t\t\t\tlabelHint: result.consumedPairingTicket.labelHint,\n\t\t\t\t\t}\n\t\t\t\t: undefined,\n\t\t});\n\t}\n\n\tprivate async logAuthorization(\n\t\thello: IrohRemoteHello,\n\t\tremoteNodeId: string,\n\t\tresult: IrohRemoteClientAuthorizationResult,\n\t): Promise<void> {\n\t\tawait this.log({\n\t\t\ttype: result.ok ? \"client_authorized\" : \"client_rejected\",\n\t\t\tclientNodeId: remoteNodeId,\n\t\t\tworkspace: hello.workspace,\n\t\t\tsuccess: result.ok,\n\t\t\terror: result.ok ? undefined : result.error,\n\t\t\tdetails: result.ok\n\t\t\t\t? { paired: result.paired }\n\t\t\t\t: { outcome: result.outcome, pairingSecretExpired: result.pairingSecretExpired },\n\t\t});\n\t}\n\n\tprivate async log(event: IrohRemoteAuditEventInput): Promise<void> {\n\t\ttry {\n\t\t\tawait this.auditLogger.log(event);\n\t\t} catch (error) {\n\t\t\t// A valid handshake must not be reclassified as a failure when audit I/O\n\t\t\t// fails, but a dropped security-relevant event must not vanish silently.\n\t\t\t// Surface it to the daemon log (captured stderr) so the omission is visible.\n\t\t\tconsole.error(\n\t\t\t\t`[iroh-remote] failed to write audit event ${event.type}: ${\n\t\t\t\t\terror instanceof Error ? error.message : String(error)\n\t\t\t\t}`,\n\t\t\t);\n\t\t}\n\t}\n}\n\nexport class IrohRemoteClientEngine {\n\tprivate readonly auditLogger: IrohRemoteAuditLogger;\n\tprivate readonly clientLabel: string | undefined;\n\tprivate readonly clientNodeId: string | undefined;\n\tprivate readonly now: () => number;\n\n\tconstructor(options: IrohRemoteClientEngineOptions = {}) {\n\t\tthis.auditLogger = options.auditLogger ?? new IrohRemoteAuditLogger();\n\t\tthis.clientLabel = options.clientLabel;\n\t\tthis.clientNodeId = options.clientNodeId;\n\t\tthis.now = options.now ?? Date.now;\n\t}\n\n\tasync createHelloFromTicket(ticket: string): Promise<IrohRemoteClientTicketHello> {\n\t\tconst payload = decodeIrohRemoteTicketPayload(ticket);\n\t\tassertIrohRemoteTicketNotExpired(payload, this.now());\n\t\tconst hello = this.createHello(payload);\n\t\tawait this.log({\n\t\t\ttype: \"ticket_loaded\",\n\t\t\tworkspace: payload.workspace,\n\t\t\tdetails: { nodeId: payload.nodeId, relayMode: payload.relayMode },\n\t\t});\n\t\treturn { hello, payload };\n\t}\n\n\tcreateHello(payload: IrohRemoteTicketPayload): IrohRemoteHello {\n\t\treturn {\n\t\t\ttype: \"volt_iroh_hello\",\n\t\t\tprotocol: IROH_REMOTE_ALPN,\n\t\t\tworkspace: payload.workspace,\n\t\t\tsecret: payload.secret,\n\t\t\tclientLabel: this.clientLabel,\n\t\t\tclientNodeId: this.clientNodeId,\n\t\t\tmode: \"conversation\",\n\t\t\tconversation: { target: \"last\" },\n\t\t};\n\t}\n\n\tasync writeHello(stream: IrohBiStreamLike, payload: IrohRemoteTicketPayload): Promise<IrohRemoteHello> {\n\t\tconst hello = this.createHello(payload);\n\t\tawait writeIrohRemoteHello(stream.send, hello);\n\t\tawait this.log({\n\t\t\ttype: \"hello_sent\",\n\t\t\tworkspace: payload.workspace,\n\t\t\tdetails: { nodeId: payload.nodeId },\n\t\t});\n\t\treturn hello;\n\t}\n\n\tasync readHandshakeResponse(\n\t\trecv: IrohRecvStreamLike,\n\t\toptions: IrohRemoteClientReadHandshakeResponseOptions = {},\n\t): Promise<IrohRemoteClientHandshakeResponseResult> {\n\t\tconst handshake = await readIrohRemoteHandshakeLine(recv, options);\n\t\tif (handshake.line === undefined) {\n\t\t\tthrow new Error(\"missing handshake response\");\n\t\t}\n\t\tconst response = parseIrohRemoteHandshakeResponseLine(handshake.line);\n\t\tassertIrohRemoteHandshakeHostIdentity(response, options.expectedHostNodeId);\n\t\tawait this.log({\n\t\t\ttype: \"handshake_response_received\",\n\t\t\tworkspace: response.success ? response.workspace : undefined,\n\t\t\tsuccess: response.success,\n\t\t\terror: response.success ? undefined : response.error,\n\t\t\tdetails: response.success ? undefined : { outcome: response.outcome },\n\t\t});\n\t\treturn { initialInput: handshake.rest, response };\n\t}\n\n\tprivate async log(event: IrohRemoteAuditEventInput): Promise<void> {\n\t\ttry {\n\t\t\tawait this.auditLogger.log(event);\n\t\t} catch {\n\t\t\t// Client-side protocol progress should not fail after audit I/O fails.\n\t\t}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type IrohBytes, type IrohRecvStreamLike, type IrohSendStreamLike } from "../../rpc/index.ts";
|
|
2
|
+
import type { IrohRemoteHandshakeResponse, IrohRemoteHello } from "./handshake.ts";
|
|
3
|
+
export declare const DEFAULT_IROH_REMOTE_HANDSHAKE_MAX_LINE_BYTES: number;
|
|
4
|
+
export declare const DEFAULT_IROH_REMOTE_HANDSHAKE_TIMEOUT_MS = 15000;
|
|
5
|
+
export interface IrohRemoteHandshakeLineReadOptions {
|
|
6
|
+
initialInput?: IrohBytes;
|
|
7
|
+
maxLineBytes?: number;
|
|
8
|
+
readLimit?: number;
|
|
9
|
+
timeoutStopErrorCode?: bigint;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface IrohRemoteHandshakeLineReadResult {
|
|
13
|
+
line: string | undefined;
|
|
14
|
+
rest: IrohBytes;
|
|
15
|
+
}
|
|
16
|
+
export declare function readIrohRemoteHandshakeLine(recv: IrohRecvStreamLike, options?: IrohRemoteHandshakeLineReadOptions): Promise<IrohRemoteHandshakeLineReadResult>;
|
|
17
|
+
export declare function writeIrohRemoteHello(send: IrohSendStreamLike, hello: IrohRemoteHello): Promise<void>;
|
|
18
|
+
export declare function writeIrohRemoteHandshakeResponse(send: IrohSendStreamLike, response: IrohRemoteHandshakeResponse): Promise<void>;
|
|
19
|
+
//# sourceMappingURL=handshake-reader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handshake-reader.d.ts","sourceRoot":"","sources":["../../../../src/core/remote/iroh/handshake-reader.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,KAAK,SAAS,EACd,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAEvB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,2BAA2B,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEnF,eAAO,MAAM,4CAA4C,QAAY,CAAC;AACtE,eAAO,MAAM,wCAAwC,QAAS,CAAC;AAE/D,MAAM,WAAW,kCAAkC;IAClD,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iCAAiC;IACjD,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,SAAS,CAAC;CAChB;AAED,wBAAsB,2BAA2B,CAChD,IAAI,EAAE,kBAAkB,EACxB,OAAO,GAAE,kCAAuC,GAC9C,OAAO,CAAC,iCAAiC,CAAC,CAY5C;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1G;AAED,wBAAsB,gCAAgC,CACrD,IAAI,EAAE,kBAAkB,EACxB,QAAQ,EAAE,2BAA2B,GACnC,OAAO,CAAC,IAAI,CAAC,CAEf","sourcesContent":["import { Buffer } from \"node:buffer\";\nimport {\n\tDEFAULT_IROH_READ_LIMIT,\n\ttype IrohBytes,\n\ttype IrohRecvStreamLike,\n\ttype IrohSendStreamLike,\n\tserializeJsonLine,\n} from \"../../rpc/index.ts\";\nimport type { IrohRemoteHandshakeResponse, IrohRemoteHello } from \"./handshake.ts\";\n\nexport const DEFAULT_IROH_REMOTE_HANDSHAKE_MAX_LINE_BYTES = 16 * 1024;\nexport const DEFAULT_IROH_REMOTE_HANDSHAKE_TIMEOUT_MS = 15_000;\n\nexport interface IrohRemoteHandshakeLineReadOptions {\n\tinitialInput?: IrohBytes;\n\tmaxLineBytes?: number;\n\treadLimit?: number;\n\ttimeoutStopErrorCode?: bigint;\n\ttimeoutMs?: number;\n}\n\nexport interface IrohRemoteHandshakeLineReadResult {\n\tline: string | undefined;\n\trest: IrohBytes;\n}\n\nexport async function readIrohRemoteHandshakeLine(\n\trecv: IrohRecvStreamLike,\n\toptions: IrohRemoteHandshakeLineReadOptions = {},\n): Promise<IrohRemoteHandshakeLineReadResult> {\n\tconst timeoutMs = options.timeoutMs ?? DEFAULT_IROH_REMOTE_HANDSHAKE_TIMEOUT_MS;\n\treturn withTimeout(readBoundedIrohLine(recv, options), timeoutMs, \"Iroh remote handshake timed out\", () => {\n\t\ttry {\n\t\t\tconst stopResult = recv.stop?.(options.timeoutStopErrorCode ?? 0n);\n\t\t\tif (stopResult) {\n\t\t\t\tvoid Promise.resolve(stopResult).catch(() => {});\n\t\t\t}\n\t\t} catch {\n\t\t\t// Timeout cleanup is best-effort; callers should receive the timeout error.\n\t\t}\n\t});\n}\n\nexport async function writeIrohRemoteHello(send: IrohSendStreamLike, hello: IrohRemoteHello): Promise<void> {\n\tawait send.writeAll(textToBytes(serializeJsonLine(hello)));\n}\n\nexport async function writeIrohRemoteHandshakeResponse(\n\tsend: IrohSendStreamLike,\n\tresponse: IrohRemoteHandshakeResponse,\n): Promise<void> {\n\tawait send.writeAll(textToBytes(serializeJsonLine(response)));\n}\n\nasync function readBoundedIrohLine(\n\trecv: IrohRecvStreamLike,\n\toptions: IrohRemoteHandshakeLineReadOptions,\n): Promise<IrohRemoteHandshakeLineReadResult> {\n\tconst maxLineBytes = normalizePositiveInteger(\n\t\toptions.maxLineBytes ?? DEFAULT_IROH_REMOTE_HANDSHAKE_MAX_LINE_BYTES,\n\t\t\"maxLineBytes\",\n\t);\n\tconst requestedReadLimit = normalizePositiveInteger(options.readLimit ?? DEFAULT_IROH_READ_LIMIT, \"readLimit\");\n\tconst readLimit = Math.min(requestedReadLimit, maxLineBytes + 1);\n\tlet buffer = options.initialInput ? bytesToBuffer(options.initialInput) : Buffer.alloc(0);\n\n\twhile (true) {\n\t\tconst newlineIndex = buffer.indexOf(10);\n\t\tif (newlineIndex !== -1) {\n\t\t\tlet lineBuffer = buffer.subarray(0, newlineIndex);\n\t\t\tif (lineBuffer.length > 0 && lineBuffer[lineBuffer.length - 1] === 13) {\n\t\t\t\tlineBuffer = lineBuffer.subarray(0, lineBuffer.length - 1);\n\t\t\t}\n\t\t\tassertLineWithinLimit(lineBuffer.length, maxLineBytes);\n\t\t\treturn {\n\t\t\t\tline: lineBuffer.toString(\"utf8\"),\n\t\t\t\trest: buffer.subarray(newlineIndex + 1),\n\t\t\t};\n\t\t}\n\n\t\tassertLineWithinLimit(buffer.length, maxLineBytes);\n\t\tconst chunk = await recv.read(readLimit);\n\t\tif (!chunk || chunk.length === 0) {\n\t\t\treturn { line: undefined, rest: buffer };\n\t\t}\n\t\tbuffer = Buffer.concat([buffer, bytesToBuffer(chunk)]);\n\t}\n}\n\nfunction assertLineWithinLimit(length: number, maxLineBytes: number): void {\n\tif (length > maxLineBytes) {\n\t\tthrow new Error(`Iroh remote handshake line exceeds maximum size of ${maxLineBytes} bytes`);\n\t}\n}\n\nfunction normalizePositiveInteger(value: number, label: string): number {\n\tif (!Number.isInteger(value) || value <= 0) {\n\t\tthrow new Error(`${label} must be a positive integer`);\n\t}\n\treturn value;\n}\n\nasync function withTimeout<T>(\n\tpromise: Promise<T>,\n\ttimeoutMs: number,\n\tmessage: string,\n\tonTimeout: () => void,\n): Promise<T> {\n\tnormalizePositiveInteger(timeoutMs, \"timeoutMs\");\n\tlet timeout: NodeJS.Timeout | undefined;\n\ttry {\n\t\treturn await Promise.race([\n\t\t\tpromise,\n\t\t\tnew Promise<T>((_resolve, reject) => {\n\t\t\t\ttimeout = setTimeout(() => {\n\t\t\t\t\treject(new Error(message));\n\t\t\t\t\tonTimeout();\n\t\t\t\t}, timeoutMs);\n\t\t\t}),\n\t\t]);\n\t} finally {\n\t\tif (timeout) {\n\t\t\tclearTimeout(timeout);\n\t\t}\n\t}\n}\n\nfunction bytesToBuffer(bytes: IrohBytes): Buffer {\n\tif (Buffer.isBuffer(bytes)) {\n\t\treturn bytes;\n\t}\n\treturn Buffer.from(Array.from(bytes));\n}\n\nfunction textToBytes(text: string): Array<number> {\n\treturn Array.from(Buffer.from(text, \"utf8\"));\n}\n"]}
|