@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,58 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join, relative, sep } from "node:path";
|
|
3
|
+
import ignore from "ignore";
|
|
4
|
+
const IGNORE_FILE_NAMES = [".gitignore", ".ignore", ".fdignore"];
|
|
5
|
+
export function createIgnoreMatcher() {
|
|
6
|
+
return ignore();
|
|
7
|
+
}
|
|
8
|
+
function hasDirectorySeparator(pattern) {
|
|
9
|
+
const withoutTrailingSlash = pattern.endsWith("/") ? pattern.slice(0, -1) : pattern;
|
|
10
|
+
return withoutTrailingSlash.includes("/");
|
|
11
|
+
}
|
|
12
|
+
function prefixIgnorePattern(line, prefix) {
|
|
13
|
+
const trimmed = line.trim();
|
|
14
|
+
if (!trimmed)
|
|
15
|
+
return null;
|
|
16
|
+
if (trimmed.startsWith("#") && !trimmed.startsWith("\\#"))
|
|
17
|
+
return null;
|
|
18
|
+
let pattern = line;
|
|
19
|
+
let negated = false;
|
|
20
|
+
let escapedNegation = false;
|
|
21
|
+
if (pattern.startsWith("!")) {
|
|
22
|
+
negated = true;
|
|
23
|
+
pattern = pattern.slice(1);
|
|
24
|
+
}
|
|
25
|
+
else if (pattern.startsWith("\\!")) {
|
|
26
|
+
escapedNegation = true;
|
|
27
|
+
pattern = pattern.slice(1);
|
|
28
|
+
}
|
|
29
|
+
const anchored = pattern.startsWith("/");
|
|
30
|
+
if (anchored) {
|
|
31
|
+
pattern = pattern.slice(1);
|
|
32
|
+
}
|
|
33
|
+
const descendantPrefix = prefix && !anchored && !hasDirectorySeparator(pattern) ? "**/" : "";
|
|
34
|
+
const prefixed = prefix ? `${prefix}${descendantPrefix}${pattern}` : pattern;
|
|
35
|
+
const escaped = escapedNegation && !prefix ? `\\${prefixed}` : prefixed;
|
|
36
|
+
return negated ? `!${escaped}` : escaped;
|
|
37
|
+
}
|
|
38
|
+
export function addIgnoreRules(ig, dir, rootDir) {
|
|
39
|
+
const relativeDir = relative(rootDir, dir);
|
|
40
|
+
const prefix = relativeDir ? `${relativeDir.split(sep).join("/")}/` : "";
|
|
41
|
+
for (const filename of IGNORE_FILE_NAMES) {
|
|
42
|
+
const ignorePath = join(dir, filename);
|
|
43
|
+
if (!existsSync(ignorePath))
|
|
44
|
+
continue;
|
|
45
|
+
try {
|
|
46
|
+
const content = readFileSync(ignorePath, "utf-8");
|
|
47
|
+
const patterns = content
|
|
48
|
+
.split(/\r?\n/)
|
|
49
|
+
.map((line) => prefixIgnorePattern(line, prefix))
|
|
50
|
+
.filter((line) => Boolean(line));
|
|
51
|
+
if (patterns.length > 0) {
|
|
52
|
+
ig.add(patterns);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
catch { }
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=ignore-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ignore-files.js","sourceRoot":"","sources":["../../src/utils/ignore-files.ts"],"names":[],"mappings":"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","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { join, relative, sep } from \"node:path\";\nimport ignore from \"ignore\";\n\nconst IGNORE_FILE_NAMES = [\".gitignore\", \".ignore\", \".fdignore\"];\n\nexport type IgnoreMatcher = ReturnType<typeof ignore>;\n\nexport function createIgnoreMatcher(): IgnoreMatcher {\n\treturn ignore();\n}\n\nfunction hasDirectorySeparator(pattern: string): boolean {\n\tconst withoutTrailingSlash = pattern.endsWith(\"/\") ? pattern.slice(0, -1) : pattern;\n\treturn withoutTrailingSlash.includes(\"/\");\n}\n\nfunction prefixIgnorePattern(line: string, prefix: string): string | null {\n\tconst trimmed = line.trim();\n\tif (!trimmed) return null;\n\tif (trimmed.startsWith(\"#\") && !trimmed.startsWith(\"\\\\#\")) return null;\n\n\tlet pattern = line;\n\tlet negated = false;\n\tlet escapedNegation = false;\n\n\tif (pattern.startsWith(\"!\")) {\n\t\tnegated = true;\n\t\tpattern = pattern.slice(1);\n\t} else if (pattern.startsWith(\"\\\\!\")) {\n\t\tescapedNegation = true;\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tconst anchored = pattern.startsWith(\"/\");\n\tif (anchored) {\n\t\tpattern = pattern.slice(1);\n\t}\n\n\tconst descendantPrefix = prefix && !anchored && !hasDirectorySeparator(pattern) ? \"**/\" : \"\";\n\tconst prefixed = prefix ? `${prefix}${descendantPrefix}${pattern}` : pattern;\n\tconst escaped = escapedNegation && !prefix ? `\\\\${prefixed}` : prefixed;\n\treturn negated ? `!${escaped}` : escaped;\n}\n\nexport function addIgnoreRules(ig: IgnoreMatcher, dir: string, rootDir: string): void {\n\tconst relativeDir = relative(rootDir, dir);\n\tconst prefix = relativeDir ? `${relativeDir.split(sep).join(\"/\")}/` : \"\";\n\n\tfor (const filename of IGNORE_FILE_NAMES) {\n\t\tconst ignorePath = join(dir, filename);\n\t\tif (!existsSync(ignorePath)) continue;\n\t\ttry {\n\t\t\tconst content = readFileSync(ignorePath, \"utf-8\");\n\t\t\tconst patterns = content\n\t\t\t\t.split(/\\r?\\n/)\n\t\t\t\t.map((line) => prefixIgnorePattern(line, prefix))\n\t\t\t\t.filter((line): line is string => Boolean(line));\n\t\t\tif (patterns.length > 0) {\n\t\t\t\tig.add(patterns);\n\t\t\t}\n\t\t} catch {}\n\t}\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ResizeStrategy } from "@jimp/plugin-resize";
|
|
2
|
+
export interface DecodedImage {
|
|
3
|
+
readonly width: number;
|
|
4
|
+
readonly height: number;
|
|
5
|
+
readonly mime?: string;
|
|
6
|
+
clone(): DecodedImage;
|
|
7
|
+
resize(options: {
|
|
8
|
+
w: number;
|
|
9
|
+
h: number;
|
|
10
|
+
mode: ResizeStrategy;
|
|
11
|
+
}): DecodedImage;
|
|
12
|
+
getBuffer(mimeType: "image/png"): Promise<Buffer>;
|
|
13
|
+
getBuffer(mimeType: "image/jpeg", options: {
|
|
14
|
+
quality: number;
|
|
15
|
+
}): Promise<Buffer>;
|
|
16
|
+
}
|
|
17
|
+
export declare function decodeImage(bytes: Uint8Array): Promise<DecodedImage>;
|
|
18
|
+
export declare function resizeDecodedImage(image: DecodedImage, width: number, height: number): DecodedImage;
|
|
19
|
+
export declare function encodePng(image: DecodedImage): Promise<Buffer>;
|
|
20
|
+
export declare function encodeJpeg(image: DecodedImage, quality: number): Promise<Buffer>;
|
|
21
|
+
export declare function decodeImageToPng(bytes: Uint8Array): Promise<Uint8Array | null>;
|
|
22
|
+
//# sourceMappingURL=image-codec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-codec.d.ts","sourceRoot":"","sources":["../../src/utils/image-codec.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAA4B,MAAM,qBAAqB,CAAC;AAO/E,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,KAAK,IAAI,YAAY,CAAC;IACtB,MAAM,CAAC,OAAO,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,cAAc,CAAA;KAAE,GAAG,YAAY,CAAC;IAC9E,SAAS,CAAC,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAClD,SAAS,CAAC,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACjF;AAED,wBAAsB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAE1E;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY,CAMnG;AAED,wBAAsB,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,OAAO,CAAC,MAAM,CAAC,CAEpE;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAEtF;AAED,wBAAsB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,GAAG,IAAI,CAAC,CAMpF","sourcesContent":["import { createJimp } from \"@jimp/core\";\nimport bmp, { msBmp } from \"@jimp/js-bmp\";\nimport gif from \"@jimp/js-gif\";\nimport jpeg from \"@jimp/js-jpeg\";\nimport png from \"@jimp/js-png\";\nimport { ResizeStrategy, methods as resizeMethods } from \"@jimp/plugin-resize\";\n\nconst Image = createJimp({\n\tformats: [png, jpeg, gif, bmp, msBmp],\n\tplugins: [resizeMethods],\n});\n\nexport interface DecodedImage {\n\treadonly width: number;\n\treadonly height: number;\n\treadonly mime?: string;\n\tclone(): DecodedImage;\n\tresize(options: { w: number; h: number; mode: ResizeStrategy }): DecodedImage;\n\tgetBuffer(mimeType: \"image/png\"): Promise<Buffer>;\n\tgetBuffer(mimeType: \"image/jpeg\", options: { quality: number }): Promise<Buffer>;\n}\n\nexport async function decodeImage(bytes: Uint8Array): Promise<DecodedImage> {\n\treturn Image.fromBuffer(Buffer.from(bytes));\n}\n\nexport function resizeDecodedImage(image: DecodedImage, width: number, height: number): DecodedImage {\n\treturn image.clone().resize({\n\t\tw: width,\n\t\th: height,\n\t\tmode: ResizeStrategy.BICUBIC,\n\t});\n}\n\nexport async function encodePng(image: DecodedImage): Promise<Buffer> {\n\treturn image.getBuffer(\"image/png\");\n}\n\nexport async function encodeJpeg(image: DecodedImage, quality: number): Promise<Buffer> {\n\treturn image.getBuffer(\"image/jpeg\", { quality });\n}\n\nexport async function decodeImageToPng(bytes: Uint8Array): Promise<Uint8Array | null> {\n\ttry {\n\t\treturn await encodePng(await decodeImage(bytes));\n\t} catch {\n\t\treturn null;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createJimp } from "@jimp/core";
|
|
2
|
+
import bmp, { msBmp } from "@jimp/js-bmp";
|
|
3
|
+
import gif from "@jimp/js-gif";
|
|
4
|
+
import jpeg from "@jimp/js-jpeg";
|
|
5
|
+
import png from "@jimp/js-png";
|
|
6
|
+
import { ResizeStrategy, methods as resizeMethods } from "@jimp/plugin-resize";
|
|
7
|
+
const Image = createJimp({
|
|
8
|
+
formats: [png, jpeg, gif, bmp, msBmp],
|
|
9
|
+
plugins: [resizeMethods],
|
|
10
|
+
});
|
|
11
|
+
export async function decodeImage(bytes) {
|
|
12
|
+
return Image.fromBuffer(Buffer.from(bytes));
|
|
13
|
+
}
|
|
14
|
+
export function resizeDecodedImage(image, width, height) {
|
|
15
|
+
return image.clone().resize({
|
|
16
|
+
w: width,
|
|
17
|
+
h: height,
|
|
18
|
+
mode: ResizeStrategy.BICUBIC,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export async function encodePng(image) {
|
|
22
|
+
return image.getBuffer("image/png");
|
|
23
|
+
}
|
|
24
|
+
export async function encodeJpeg(image, quality) {
|
|
25
|
+
return image.getBuffer("image/jpeg", { quality });
|
|
26
|
+
}
|
|
27
|
+
export async function decodeImageToPng(bytes) {
|
|
28
|
+
try {
|
|
29
|
+
return await encodePng(await decodeImage(bytes));
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=image-codec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-codec.js","sourceRoot":"","sources":["../../src/utils/image-codec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,GAAG,EAAE,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,GAAG,MAAM,cAAc,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAE/E,MAAM,KAAK,GAAG,UAAU,CAAC;IACxB,OAAO,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,KAAK,CAAC;IACrC,OAAO,EAAE,CAAC,aAAa,CAAC;CACxB,CAAC,CAAC;AAYH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAiB,EAAyB;IAC3E,OAAO,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;AAAA,CAC5C;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAmB,EAAE,KAAa,EAAE,MAAc,EAAgB;IACpG,OAAO,KAAK,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC;QAC3B,CAAC,EAAE,KAAK;QACR,CAAC,EAAE,MAAM;QACT,IAAI,EAAE,cAAc,CAAC,OAAO;KAC5B,CAAC,CAAC;AAAA,CACH;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,KAAmB,EAAmB;IACrE,OAAO,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;AAAA,CACpC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,KAAmB,EAAE,OAAe,EAAmB;IACvF,OAAO,KAAK,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;AAAA,CAClD;AAED,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,KAAiB,EAA8B;IACrF,IAAI,CAAC;QACJ,OAAO,MAAM,SAAS,CAAC,MAAM,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AAAA,CACD","sourcesContent":["import { createJimp } from \"@jimp/core\";\nimport bmp, { msBmp } from \"@jimp/js-bmp\";\nimport gif from \"@jimp/js-gif\";\nimport jpeg from \"@jimp/js-jpeg\";\nimport png from \"@jimp/js-png\";\nimport { ResizeStrategy, methods as resizeMethods } from \"@jimp/plugin-resize\";\n\nconst Image = createJimp({\n\tformats: [png, jpeg, gif, bmp, msBmp],\n\tplugins: [resizeMethods],\n});\n\nexport interface DecodedImage {\n\treadonly width: number;\n\treadonly height: number;\n\treadonly mime?: string;\n\tclone(): DecodedImage;\n\tresize(options: { w: number; h: number; mode: ResizeStrategy }): DecodedImage;\n\tgetBuffer(mimeType: \"image/png\"): Promise<Buffer>;\n\tgetBuffer(mimeType: \"image/jpeg\", options: { quality: number }): Promise<Buffer>;\n}\n\nexport async function decodeImage(bytes: Uint8Array): Promise<DecodedImage> {\n\treturn Image.fromBuffer(Buffer.from(bytes));\n}\n\nexport function resizeDecodedImage(image: DecodedImage, width: number, height: number): DecodedImage {\n\treturn image.clone().resize({\n\t\tw: width,\n\t\th: height,\n\t\tmode: ResizeStrategy.BICUBIC,\n\t});\n}\n\nexport async function encodePng(image: DecodedImage): Promise<Buffer> {\n\treturn image.getBuffer(\"image/png\");\n}\n\nexport async function encodeJpeg(image: DecodedImage, quality: number): Promise<Buffer> {\n\treturn image.getBuffer(\"image/jpeg\", { quality });\n}\n\nexport async function decodeImageToPng(bytes: Uint8Array): Promise<Uint8Array | null> {\n\ttry {\n\t\treturn await encodePng(await decodeImage(bytes));\n\t} catch {\n\t\treturn null;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Convert image to PNG format for terminal display.
|
|
3
|
+
* Kitty graphics protocol requires PNG format (f=100).
|
|
4
|
+
*/
|
|
5
|
+
export declare function convertToPng(base64Data: string, mimeType: string): Promise<{
|
|
6
|
+
data: string;
|
|
7
|
+
mimeType: string;
|
|
8
|
+
} | null>;
|
|
9
|
+
//# sourceMappingURL=image-convert.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-convert.d.ts","sourceRoot":"","sources":["../../src/utils/image-convert.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAsB,YAAY,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CAkBpD","sourcesContent":["import { decodeImageToPng } from \"./image-codec.ts\";\n\n/**\n * Convert image to PNG format for terminal display.\n * Kitty graphics protocol requires PNG format (f=100).\n */\nexport async function convertToPng(\n\tbase64Data: string,\n\tmimeType: string,\n): Promise<{ data: string; mimeType: string } | null> {\n\t// Already PNG, no conversion needed\n\tif (mimeType === \"image/png\") {\n\t\treturn { data: base64Data, mimeType };\n\t}\n\n\ttry {\n\t\tconst bytes = new Uint8Array(Buffer.from(base64Data, \"base64\"));\n\t\tconst pngBuffer = await decodeImageToPng(bytes);\n\t\tif (!pngBuffer) return null;\n\t\treturn {\n\t\t\tdata: Buffer.from(pngBuffer).toString(\"base64\"),\n\t\t\tmimeType: \"image/png\",\n\t\t};\n\t} catch {\n\t\t// Conversion failed\n\t\treturn null;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { decodeImageToPng } from "./image-codec.js";
|
|
2
|
+
/**
|
|
3
|
+
* Convert image to PNG format for terminal display.
|
|
4
|
+
* Kitty graphics protocol requires PNG format (f=100).
|
|
5
|
+
*/
|
|
6
|
+
export async function convertToPng(base64Data, mimeType) {
|
|
7
|
+
// Already PNG, no conversion needed
|
|
8
|
+
if (mimeType === "image/png") {
|
|
9
|
+
return { data: base64Data, mimeType };
|
|
10
|
+
}
|
|
11
|
+
try {
|
|
12
|
+
const bytes = new Uint8Array(Buffer.from(base64Data, "base64"));
|
|
13
|
+
const pngBuffer = await decodeImageToPng(bytes);
|
|
14
|
+
if (!pngBuffer)
|
|
15
|
+
return null;
|
|
16
|
+
return {
|
|
17
|
+
data: Buffer.from(pngBuffer).toString("base64"),
|
|
18
|
+
mimeType: "image/png",
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Conversion failed
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=image-convert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-convert.js","sourceRoot":"","sources":["../../src/utils/image-convert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,UAAkB,EAClB,QAAgB,EACqC;IACrD,oCAAoC;IACpC,IAAI,QAAQ,KAAK,WAAW,EAAE,CAAC;QAC9B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;IACvC,CAAC;IAED,IAAI,CAAC;QACJ,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;QAChE,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC,KAAK,CAAC,CAAC;QAChD,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QAC5B,OAAO;YACN,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;YAC/C,QAAQ,EAAE,WAAW;SACrB,CAAC;IACH,CAAC;IAAC,MAAM,CAAC;QACR,oBAAoB;QACpB,OAAO,IAAI,CAAC;IACb,CAAC;AAAA,CACD","sourcesContent":["import { decodeImageToPng } from \"./image-codec.ts\";\n\n/**\n * Convert image to PNG format for terminal display.\n * Kitty graphics protocol requires PNG format (f=100).\n */\nexport async function convertToPng(\n\tbase64Data: string,\n\tmimeType: string,\n): Promise<{ data: string; mimeType: string } | null> {\n\t// Already PNG, no conversion needed\n\tif (mimeType === \"image/png\") {\n\t\treturn { data: base64Data, mimeType };\n\t}\n\n\ttry {\n\t\tconst bytes = new Uint8Array(Buffer.from(base64Data, \"base64\"));\n\t\tconst pngBuffer = await decodeImageToPng(bytes);\n\t\tif (!pngBuffer) return null;\n\t\treturn {\n\t\t\tdata: Buffer.from(pngBuffer).toString(\"base64\"),\n\t\t\tmimeType: \"image/png\",\n\t\t};\n\t} catch {\n\t\t// Conversion failed\n\t\treturn null;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface ImageResizeOptions {
|
|
2
|
+
maxWidth?: number;
|
|
3
|
+
maxHeight?: number;
|
|
4
|
+
maxBytes?: number;
|
|
5
|
+
jpegQuality?: number;
|
|
6
|
+
}
|
|
7
|
+
export interface ResizedImage {
|
|
8
|
+
data: string;
|
|
9
|
+
mimeType: string;
|
|
10
|
+
originalWidth: number;
|
|
11
|
+
originalHeight: number;
|
|
12
|
+
width: number;
|
|
13
|
+
height: number;
|
|
14
|
+
wasResized: boolean;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Resize an image to fit within the specified max dimensions and encoded file size.
|
|
18
|
+
* Returns null if the image cannot be resized below maxBytes.
|
|
19
|
+
*
|
|
20
|
+
* Uses a pure-JavaScript Jimp codec set for PNG, JPEG, GIF, and BMP. WebP is
|
|
21
|
+
* passed through when it already satisfies the limits because the standalone
|
|
22
|
+
* distribution intentionally does not carry a WebP native or WASM codec.
|
|
23
|
+
*
|
|
24
|
+
* Strategy for staying under maxBytes:
|
|
25
|
+
* 1. First resize to maxWidth/maxHeight
|
|
26
|
+
* 2. Try both PNG and JPEG formats, pick the smaller one
|
|
27
|
+
* 3. If still too large, try JPEG with decreasing quality
|
|
28
|
+
* 4. If still too large, progressively reduce dimensions until 1x1
|
|
29
|
+
*/
|
|
30
|
+
export declare function resizeImageInProcess(inputBytes: Uint8Array, mimeType: string, options?: ImageResizeOptions): Promise<ResizedImage | null>;
|
|
31
|
+
//# sourceMappingURL=image-resize-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-resize-core.d.ts","sourceRoot":"","sources":["../../src/utils/image-resize-core.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,OAAO,CAAC;CACpB;AA8FD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,oBAAoB,CACzC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAwG9B","sourcesContent":["import { decodeImage, encodeJpeg, encodePng, resizeDecodedImage } from \"./image-codec.ts\";\n\nexport interface ImageResizeOptions {\n\tmaxWidth?: number; // Default: 2000\n\tmaxHeight?: number; // Default: 2000\n\tmaxBytes?: number; // Default: 4.5MB of base64 payload (below Anthropic's 5MB limit)\n\tjpegQuality?: number; // Default: 80\n}\n\nexport interface ResizedImage {\n\tdata: string; // base64\n\tmimeType: string;\n\toriginalWidth: number;\n\toriginalHeight: number;\n\twidth: number;\n\theight: number;\n\twasResized: boolean;\n}\n\n// 4.5MB of base64 payload. Provides headroom below Anthropic's 5MB limit.\nconst DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024;\n\nconst DEFAULT_OPTIONS: Required<ImageResizeOptions> = {\n\tmaxWidth: 2000,\n\tmaxHeight: 2000,\n\tmaxBytes: DEFAULT_MAX_BYTES,\n\tjpegQuality: 80,\n};\n\ninterface EncodedCandidate {\n\tdata: string;\n\tencodedSize: number;\n\tmimeType: string;\n}\n\nfunction encodeCandidate(buffer: Uint8Array, mimeType: string): EncodedCandidate {\n\tconst data = Buffer.from(buffer).toString(\"base64\");\n\treturn {\n\t\tdata,\n\t\tencodedSize: Buffer.byteLength(data, \"utf-8\"),\n\t\tmimeType,\n\t};\n}\n\nfunction readUint24LE(bytes: Uint8Array, offset: number): number {\n\treturn bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16);\n}\n\nfunction readUint32LE(bytes: Uint8Array, offset: number): number {\n\treturn (bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16) | (bytes[offset + 3] << 24)) >>> 0;\n}\n\nfunction matchesAscii(bytes: Uint8Array, offset: number, value: string): boolean {\n\tif (offset + value.length > bytes.length) return false;\n\tfor (let i = 0; i < value.length; i++) {\n\t\tif (bytes[offset + i] !== value.charCodeAt(i)) return false;\n\t}\n\treturn true;\n}\n\nfunction readWebpDimensions(bytes: Uint8Array): { width: number; height: number } | null {\n\tif (bytes.length < 20 || !matchesAscii(bytes, 0, \"RIFF\") || !matchesAscii(bytes, 8, \"WEBP\")) {\n\t\treturn null;\n\t}\n\n\tconst riffSize = readUint32LE(bytes, 4);\n\tif (riffSize < 12 || riffSize + 8 > bytes.length) {\n\t\treturn null;\n\t}\n\n\tlet offset = 12;\n\tconst riffEnd = riffSize + 8;\n\twhile (offset + 8 <= riffEnd) {\n\t\tconst chunkSize = readUint32LE(bytes, offset + 4);\n\t\tconst dataStart = offset + 8;\n\t\tconst dataEnd = dataStart + chunkSize;\n\t\tif (dataEnd > riffEnd || dataEnd > bytes.length) return null;\n\n\t\tif (matchesAscii(bytes, offset, \"VP8X\") && chunkSize >= 10) {\n\t\t\treturn {\n\t\t\t\twidth: readUint24LE(bytes, dataStart + 4) + 1,\n\t\t\t\theight: readUint24LE(bytes, dataStart + 7) + 1,\n\t\t\t};\n\t\t}\n\n\t\tif (matchesAscii(bytes, offset, \"VP8L\") && chunkSize >= 5 && bytes[dataStart] === 0x2f) {\n\t\t\tconst dimensions = readUint32LE(bytes, dataStart + 1);\n\t\t\treturn {\n\t\t\t\twidth: (dimensions & 0x3fff) + 1,\n\t\t\t\theight: ((dimensions >>> 14) & 0x3fff) + 1,\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\tmatchesAscii(bytes, offset, \"VP8 \") &&\n\t\t\tchunkSize >= 10 &&\n\t\t\tbytes[dataStart + 3] === 0x9d &&\n\t\t\tbytes[dataStart + 4] === 0x01 &&\n\t\t\tbytes[dataStart + 5] === 0x2a\n\t\t) {\n\t\t\tconst width = (bytes[dataStart + 6] | (bytes[dataStart + 7] << 8)) & 0x3fff;\n\t\t\tconst height = (bytes[dataStart + 8] | (bytes[dataStart + 9] << 8)) & 0x3fff;\n\t\t\treturn width > 0 && height > 0 ? { width, height } : null;\n\t\t}\n\n\t\toffset = dataEnd + (chunkSize % 2);\n\t}\n\n\treturn null;\n}\n\n/**\n * Resize an image to fit within the specified max dimensions and encoded file size.\n * Returns null if the image cannot be resized below maxBytes.\n *\n * Uses a pure-JavaScript Jimp codec set for PNG, JPEG, GIF, and BMP. WebP is\n * passed through when it already satisfies the limits because the standalone\n * distribution intentionally does not carry a WebP native or WASM codec.\n *\n * Strategy for staying under maxBytes:\n * 1. First resize to maxWidth/maxHeight\n * 2. Try both PNG and JPEG formats, pick the smaller one\n * 3. If still too large, try JPEG with decreasing quality\n * 4. If still too large, progressively reduce dimensions until 1x1\n */\nexport async function resizeImageInProcess(\n\tinputBytes: Uint8Array,\n\tmimeType: string,\n\toptions?: ImageResizeOptions,\n): Promise<ResizedImage | null> {\n\tconst opts = { ...DEFAULT_OPTIONS, ...options };\n\tconst inputBase64Size = Math.ceil(inputBytes.byteLength / 3) * 4;\n\tconst normalizedMimeType = mimeType.split(\";\")[0]?.trim().toLowerCase() || mimeType;\n\n\tif (normalizedMimeType === \"image/webp\") {\n\t\tconst dimensions = readWebpDimensions(inputBytes);\n\t\tif (\n\t\t\tdimensions &&\n\t\t\tdimensions.width <= opts.maxWidth &&\n\t\t\tdimensions.height <= opts.maxHeight &&\n\t\t\tinputBase64Size < opts.maxBytes\n\t\t) {\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(inputBytes).toString(\"base64\"),\n\t\t\t\tmimeType: normalizedMimeType,\n\t\t\t\toriginalWidth: dimensions.width,\n\t\t\t\toriginalHeight: dimensions.height,\n\t\t\t\twidth: dimensions.width,\n\t\t\t\theight: dimensions.height,\n\t\t\t\twasResized: false,\n\t\t\t};\n\t\t}\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst image = await decodeImage(inputBytes);\n\t\tconst originalWidth = image.width;\n\t\tconst originalHeight = image.height;\n\n\t\t// Check if already within all limits (dimensions AND encoded size)\n\t\tif (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes) {\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(inputBytes).toString(\"base64\"),\n\t\t\t\tmimeType: normalizedMimeType || image.mime || \"image/png\",\n\t\t\t\toriginalWidth,\n\t\t\t\toriginalHeight,\n\t\t\t\twidth: originalWidth,\n\t\t\t\theight: originalHeight,\n\t\t\t\twasResized: false,\n\t\t\t};\n\t\t}\n\n\t\t// Calculate initial dimensions respecting max limits\n\t\tlet targetWidth = originalWidth;\n\t\tlet targetHeight = originalHeight;\n\n\t\tif (targetWidth > opts.maxWidth) {\n\t\t\ttargetHeight = Math.max(1, Math.round((targetHeight * opts.maxWidth) / targetWidth));\n\t\t\ttargetWidth = opts.maxWidth;\n\t\t}\n\t\tif (targetHeight > opts.maxHeight) {\n\t\t\ttargetWidth = Math.max(1, Math.round((targetWidth * opts.maxHeight) / targetHeight));\n\t\t\ttargetHeight = opts.maxHeight;\n\t\t}\n\n\t\tasync function tryEncodings(width: number, height: number, jpegQualities: number[]): Promise<EncodedCandidate[]> {\n\t\t\tconst resized = resizeDecodedImage(image, width, height);\n\t\t\tconst candidates: EncodedCandidate[] = [encodeCandidate(await encodePng(resized), \"image/png\")];\n\t\t\tfor (const quality of jpegQualities) {\n\t\t\t\tcandidates.push(encodeCandidate(await encodeJpeg(resized, quality), \"image/jpeg\"));\n\t\t\t}\n\t\t\treturn candidates;\n\t\t}\n\n\t\tconst qualitySteps = Array.from(new Set([opts.jpegQuality, 85, 70, 55, 40]));\n\t\tlet currentWidth = targetWidth;\n\t\tlet currentHeight = targetHeight;\n\n\t\twhile (true) {\n\t\t\tconst candidates = await tryEncodings(currentWidth, currentHeight, qualitySteps);\n\t\t\tfor (const candidate of candidates) {\n\t\t\t\tif (candidate.encodedSize < opts.maxBytes) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: candidate.data,\n\t\t\t\t\t\tmimeType: candidate.mimeType,\n\t\t\t\t\t\toriginalWidth,\n\t\t\t\t\t\toriginalHeight,\n\t\t\t\t\t\twidth: currentWidth,\n\t\t\t\t\t\theight: currentHeight,\n\t\t\t\t\t\twasResized: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentWidth === 1 && currentHeight === 1) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst nextWidth = currentWidth === 1 ? 1 : Math.max(1, Math.floor(currentWidth * 0.75));\n\t\t\tconst nextHeight = currentHeight === 1 ? 1 : Math.max(1, Math.floor(currentHeight * 0.75));\n\t\t\tif (nextWidth === currentWidth && nextHeight === currentHeight) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcurrentWidth = nextWidth;\n\t\t\tcurrentHeight = nextHeight;\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import { decodeImage, encodeJpeg, encodePng, resizeDecodedImage } from "./image-codec.js";
|
|
2
|
+
// 4.5MB of base64 payload. Provides headroom below Anthropic's 5MB limit.
|
|
3
|
+
const DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024;
|
|
4
|
+
const DEFAULT_OPTIONS = {
|
|
5
|
+
maxWidth: 2000,
|
|
6
|
+
maxHeight: 2000,
|
|
7
|
+
maxBytes: DEFAULT_MAX_BYTES,
|
|
8
|
+
jpegQuality: 80,
|
|
9
|
+
};
|
|
10
|
+
function encodeCandidate(buffer, mimeType) {
|
|
11
|
+
const data = Buffer.from(buffer).toString("base64");
|
|
12
|
+
return {
|
|
13
|
+
data,
|
|
14
|
+
encodedSize: Buffer.byteLength(data, "utf-8"),
|
|
15
|
+
mimeType,
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function readUint24LE(bytes, offset) {
|
|
19
|
+
return bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16);
|
|
20
|
+
}
|
|
21
|
+
function readUint32LE(bytes, offset) {
|
|
22
|
+
return (bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16) | (bytes[offset + 3] << 24)) >>> 0;
|
|
23
|
+
}
|
|
24
|
+
function matchesAscii(bytes, offset, value) {
|
|
25
|
+
if (offset + value.length > bytes.length)
|
|
26
|
+
return false;
|
|
27
|
+
for (let i = 0; i < value.length; i++) {
|
|
28
|
+
if (bytes[offset + i] !== value.charCodeAt(i))
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
return true;
|
|
32
|
+
}
|
|
33
|
+
function readWebpDimensions(bytes) {
|
|
34
|
+
if (bytes.length < 20 || !matchesAscii(bytes, 0, "RIFF") || !matchesAscii(bytes, 8, "WEBP")) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
const riffSize = readUint32LE(bytes, 4);
|
|
38
|
+
if (riffSize < 12 || riffSize + 8 > bytes.length) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
let offset = 12;
|
|
42
|
+
const riffEnd = riffSize + 8;
|
|
43
|
+
while (offset + 8 <= riffEnd) {
|
|
44
|
+
const chunkSize = readUint32LE(bytes, offset + 4);
|
|
45
|
+
const dataStart = offset + 8;
|
|
46
|
+
const dataEnd = dataStart + chunkSize;
|
|
47
|
+
if (dataEnd > riffEnd || dataEnd > bytes.length)
|
|
48
|
+
return null;
|
|
49
|
+
if (matchesAscii(bytes, offset, "VP8X") && chunkSize >= 10) {
|
|
50
|
+
return {
|
|
51
|
+
width: readUint24LE(bytes, dataStart + 4) + 1,
|
|
52
|
+
height: readUint24LE(bytes, dataStart + 7) + 1,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (matchesAscii(bytes, offset, "VP8L") && chunkSize >= 5 && bytes[dataStart] === 0x2f) {
|
|
56
|
+
const dimensions = readUint32LE(bytes, dataStart + 1);
|
|
57
|
+
return {
|
|
58
|
+
width: (dimensions & 0x3fff) + 1,
|
|
59
|
+
height: ((dimensions >>> 14) & 0x3fff) + 1,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
if (matchesAscii(bytes, offset, "VP8 ") &&
|
|
63
|
+
chunkSize >= 10 &&
|
|
64
|
+
bytes[dataStart + 3] === 0x9d &&
|
|
65
|
+
bytes[dataStart + 4] === 0x01 &&
|
|
66
|
+
bytes[dataStart + 5] === 0x2a) {
|
|
67
|
+
const width = (bytes[dataStart + 6] | (bytes[dataStart + 7] << 8)) & 0x3fff;
|
|
68
|
+
const height = (bytes[dataStart + 8] | (bytes[dataStart + 9] << 8)) & 0x3fff;
|
|
69
|
+
return width > 0 && height > 0 ? { width, height } : null;
|
|
70
|
+
}
|
|
71
|
+
offset = dataEnd + (chunkSize % 2);
|
|
72
|
+
}
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Resize an image to fit within the specified max dimensions and encoded file size.
|
|
77
|
+
* Returns null if the image cannot be resized below maxBytes.
|
|
78
|
+
*
|
|
79
|
+
* Uses a pure-JavaScript Jimp codec set for PNG, JPEG, GIF, and BMP. WebP is
|
|
80
|
+
* passed through when it already satisfies the limits because the standalone
|
|
81
|
+
* distribution intentionally does not carry a WebP native or WASM codec.
|
|
82
|
+
*
|
|
83
|
+
* Strategy for staying under maxBytes:
|
|
84
|
+
* 1. First resize to maxWidth/maxHeight
|
|
85
|
+
* 2. Try both PNG and JPEG formats, pick the smaller one
|
|
86
|
+
* 3. If still too large, try JPEG with decreasing quality
|
|
87
|
+
* 4. If still too large, progressively reduce dimensions until 1x1
|
|
88
|
+
*/
|
|
89
|
+
export async function resizeImageInProcess(inputBytes, mimeType, options) {
|
|
90
|
+
const opts = { ...DEFAULT_OPTIONS, ...options };
|
|
91
|
+
const inputBase64Size = Math.ceil(inputBytes.byteLength / 3) * 4;
|
|
92
|
+
const normalizedMimeType = mimeType.split(";")[0]?.trim().toLowerCase() || mimeType;
|
|
93
|
+
if (normalizedMimeType === "image/webp") {
|
|
94
|
+
const dimensions = readWebpDimensions(inputBytes);
|
|
95
|
+
if (dimensions &&
|
|
96
|
+
dimensions.width <= opts.maxWidth &&
|
|
97
|
+
dimensions.height <= opts.maxHeight &&
|
|
98
|
+
inputBase64Size < opts.maxBytes) {
|
|
99
|
+
return {
|
|
100
|
+
data: Buffer.from(inputBytes).toString("base64"),
|
|
101
|
+
mimeType: normalizedMimeType,
|
|
102
|
+
originalWidth: dimensions.width,
|
|
103
|
+
originalHeight: dimensions.height,
|
|
104
|
+
width: dimensions.width,
|
|
105
|
+
height: dimensions.height,
|
|
106
|
+
wasResized: false,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
return null;
|
|
110
|
+
}
|
|
111
|
+
try {
|
|
112
|
+
const image = await decodeImage(inputBytes);
|
|
113
|
+
const originalWidth = image.width;
|
|
114
|
+
const originalHeight = image.height;
|
|
115
|
+
// Check if already within all limits (dimensions AND encoded size)
|
|
116
|
+
if (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes) {
|
|
117
|
+
return {
|
|
118
|
+
data: Buffer.from(inputBytes).toString("base64"),
|
|
119
|
+
mimeType: normalizedMimeType || image.mime || "image/png",
|
|
120
|
+
originalWidth,
|
|
121
|
+
originalHeight,
|
|
122
|
+
width: originalWidth,
|
|
123
|
+
height: originalHeight,
|
|
124
|
+
wasResized: false,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
// Calculate initial dimensions respecting max limits
|
|
128
|
+
let targetWidth = originalWidth;
|
|
129
|
+
let targetHeight = originalHeight;
|
|
130
|
+
if (targetWidth > opts.maxWidth) {
|
|
131
|
+
targetHeight = Math.max(1, Math.round((targetHeight * opts.maxWidth) / targetWidth));
|
|
132
|
+
targetWidth = opts.maxWidth;
|
|
133
|
+
}
|
|
134
|
+
if (targetHeight > opts.maxHeight) {
|
|
135
|
+
targetWidth = Math.max(1, Math.round((targetWidth * opts.maxHeight) / targetHeight));
|
|
136
|
+
targetHeight = opts.maxHeight;
|
|
137
|
+
}
|
|
138
|
+
async function tryEncodings(width, height, jpegQualities) {
|
|
139
|
+
const resized = resizeDecodedImage(image, width, height);
|
|
140
|
+
const candidates = [encodeCandidate(await encodePng(resized), "image/png")];
|
|
141
|
+
for (const quality of jpegQualities) {
|
|
142
|
+
candidates.push(encodeCandidate(await encodeJpeg(resized, quality), "image/jpeg"));
|
|
143
|
+
}
|
|
144
|
+
return candidates;
|
|
145
|
+
}
|
|
146
|
+
const qualitySteps = Array.from(new Set([opts.jpegQuality, 85, 70, 55, 40]));
|
|
147
|
+
let currentWidth = targetWidth;
|
|
148
|
+
let currentHeight = targetHeight;
|
|
149
|
+
while (true) {
|
|
150
|
+
const candidates = await tryEncodings(currentWidth, currentHeight, qualitySteps);
|
|
151
|
+
for (const candidate of candidates) {
|
|
152
|
+
if (candidate.encodedSize < opts.maxBytes) {
|
|
153
|
+
return {
|
|
154
|
+
data: candidate.data,
|
|
155
|
+
mimeType: candidate.mimeType,
|
|
156
|
+
originalWidth,
|
|
157
|
+
originalHeight,
|
|
158
|
+
width: currentWidth,
|
|
159
|
+
height: currentHeight,
|
|
160
|
+
wasResized: true,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
if (currentWidth === 1 && currentHeight === 1) {
|
|
165
|
+
break;
|
|
166
|
+
}
|
|
167
|
+
const nextWidth = currentWidth === 1 ? 1 : Math.max(1, Math.floor(currentWidth * 0.75));
|
|
168
|
+
const nextHeight = currentHeight === 1 ? 1 : Math.max(1, Math.floor(currentHeight * 0.75));
|
|
169
|
+
if (nextWidth === currentWidth && nextHeight === currentHeight) {
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
currentWidth = nextWidth;
|
|
173
|
+
currentHeight = nextHeight;
|
|
174
|
+
}
|
|
175
|
+
return null;
|
|
176
|
+
}
|
|
177
|
+
catch {
|
|
178
|
+
return null;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=image-resize-core.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-resize-core.js","sourceRoot":"","sources":["../../src/utils/image-resize-core.ts"],"names":[],"mappings":"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","sourcesContent":["import { decodeImage, encodeJpeg, encodePng, resizeDecodedImage } from \"./image-codec.ts\";\n\nexport interface ImageResizeOptions {\n\tmaxWidth?: number; // Default: 2000\n\tmaxHeight?: number; // Default: 2000\n\tmaxBytes?: number; // Default: 4.5MB of base64 payload (below Anthropic's 5MB limit)\n\tjpegQuality?: number; // Default: 80\n}\n\nexport interface ResizedImage {\n\tdata: string; // base64\n\tmimeType: string;\n\toriginalWidth: number;\n\toriginalHeight: number;\n\twidth: number;\n\theight: number;\n\twasResized: boolean;\n}\n\n// 4.5MB of base64 payload. Provides headroom below Anthropic's 5MB limit.\nconst DEFAULT_MAX_BYTES = 4.5 * 1024 * 1024;\n\nconst DEFAULT_OPTIONS: Required<ImageResizeOptions> = {\n\tmaxWidth: 2000,\n\tmaxHeight: 2000,\n\tmaxBytes: DEFAULT_MAX_BYTES,\n\tjpegQuality: 80,\n};\n\ninterface EncodedCandidate {\n\tdata: string;\n\tencodedSize: number;\n\tmimeType: string;\n}\n\nfunction encodeCandidate(buffer: Uint8Array, mimeType: string): EncodedCandidate {\n\tconst data = Buffer.from(buffer).toString(\"base64\");\n\treturn {\n\t\tdata,\n\t\tencodedSize: Buffer.byteLength(data, \"utf-8\"),\n\t\tmimeType,\n\t};\n}\n\nfunction readUint24LE(bytes: Uint8Array, offset: number): number {\n\treturn bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16);\n}\n\nfunction readUint32LE(bytes: Uint8Array, offset: number): number {\n\treturn (bytes[offset] | (bytes[offset + 1] << 8) | (bytes[offset + 2] << 16) | (bytes[offset + 3] << 24)) >>> 0;\n}\n\nfunction matchesAscii(bytes: Uint8Array, offset: number, value: string): boolean {\n\tif (offset + value.length > bytes.length) return false;\n\tfor (let i = 0; i < value.length; i++) {\n\t\tif (bytes[offset + i] !== value.charCodeAt(i)) return false;\n\t}\n\treturn true;\n}\n\nfunction readWebpDimensions(bytes: Uint8Array): { width: number; height: number } | null {\n\tif (bytes.length < 20 || !matchesAscii(bytes, 0, \"RIFF\") || !matchesAscii(bytes, 8, \"WEBP\")) {\n\t\treturn null;\n\t}\n\n\tconst riffSize = readUint32LE(bytes, 4);\n\tif (riffSize < 12 || riffSize + 8 > bytes.length) {\n\t\treturn null;\n\t}\n\n\tlet offset = 12;\n\tconst riffEnd = riffSize + 8;\n\twhile (offset + 8 <= riffEnd) {\n\t\tconst chunkSize = readUint32LE(bytes, offset + 4);\n\t\tconst dataStart = offset + 8;\n\t\tconst dataEnd = dataStart + chunkSize;\n\t\tif (dataEnd > riffEnd || dataEnd > bytes.length) return null;\n\n\t\tif (matchesAscii(bytes, offset, \"VP8X\") && chunkSize >= 10) {\n\t\t\treturn {\n\t\t\t\twidth: readUint24LE(bytes, dataStart + 4) + 1,\n\t\t\t\theight: readUint24LE(bytes, dataStart + 7) + 1,\n\t\t\t};\n\t\t}\n\n\t\tif (matchesAscii(bytes, offset, \"VP8L\") && chunkSize >= 5 && bytes[dataStart] === 0x2f) {\n\t\t\tconst dimensions = readUint32LE(bytes, dataStart + 1);\n\t\t\treturn {\n\t\t\t\twidth: (dimensions & 0x3fff) + 1,\n\t\t\t\theight: ((dimensions >>> 14) & 0x3fff) + 1,\n\t\t\t};\n\t\t}\n\n\t\tif (\n\t\t\tmatchesAscii(bytes, offset, \"VP8 \") &&\n\t\t\tchunkSize >= 10 &&\n\t\t\tbytes[dataStart + 3] === 0x9d &&\n\t\t\tbytes[dataStart + 4] === 0x01 &&\n\t\t\tbytes[dataStart + 5] === 0x2a\n\t\t) {\n\t\t\tconst width = (bytes[dataStart + 6] | (bytes[dataStart + 7] << 8)) & 0x3fff;\n\t\t\tconst height = (bytes[dataStart + 8] | (bytes[dataStart + 9] << 8)) & 0x3fff;\n\t\t\treturn width > 0 && height > 0 ? { width, height } : null;\n\t\t}\n\n\t\toffset = dataEnd + (chunkSize % 2);\n\t}\n\n\treturn null;\n}\n\n/**\n * Resize an image to fit within the specified max dimensions and encoded file size.\n * Returns null if the image cannot be resized below maxBytes.\n *\n * Uses a pure-JavaScript Jimp codec set for PNG, JPEG, GIF, and BMP. WebP is\n * passed through when it already satisfies the limits because the standalone\n * distribution intentionally does not carry a WebP native or WASM codec.\n *\n * Strategy for staying under maxBytes:\n * 1. First resize to maxWidth/maxHeight\n * 2. Try both PNG and JPEG formats, pick the smaller one\n * 3. If still too large, try JPEG with decreasing quality\n * 4. If still too large, progressively reduce dimensions until 1x1\n */\nexport async function resizeImageInProcess(\n\tinputBytes: Uint8Array,\n\tmimeType: string,\n\toptions?: ImageResizeOptions,\n): Promise<ResizedImage | null> {\n\tconst opts = { ...DEFAULT_OPTIONS, ...options };\n\tconst inputBase64Size = Math.ceil(inputBytes.byteLength / 3) * 4;\n\tconst normalizedMimeType = mimeType.split(\";\")[0]?.trim().toLowerCase() || mimeType;\n\n\tif (normalizedMimeType === \"image/webp\") {\n\t\tconst dimensions = readWebpDimensions(inputBytes);\n\t\tif (\n\t\t\tdimensions &&\n\t\t\tdimensions.width <= opts.maxWidth &&\n\t\t\tdimensions.height <= opts.maxHeight &&\n\t\t\tinputBase64Size < opts.maxBytes\n\t\t) {\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(inputBytes).toString(\"base64\"),\n\t\t\t\tmimeType: normalizedMimeType,\n\t\t\t\toriginalWidth: dimensions.width,\n\t\t\t\toriginalHeight: dimensions.height,\n\t\t\t\twidth: dimensions.width,\n\t\t\t\theight: dimensions.height,\n\t\t\t\twasResized: false,\n\t\t\t};\n\t\t}\n\t\treturn null;\n\t}\n\n\ttry {\n\t\tconst image = await decodeImage(inputBytes);\n\t\tconst originalWidth = image.width;\n\t\tconst originalHeight = image.height;\n\n\t\t// Check if already within all limits (dimensions AND encoded size)\n\t\tif (originalWidth <= opts.maxWidth && originalHeight <= opts.maxHeight && inputBase64Size < opts.maxBytes) {\n\t\t\treturn {\n\t\t\t\tdata: Buffer.from(inputBytes).toString(\"base64\"),\n\t\t\t\tmimeType: normalizedMimeType || image.mime || \"image/png\",\n\t\t\t\toriginalWidth,\n\t\t\t\toriginalHeight,\n\t\t\t\twidth: originalWidth,\n\t\t\t\theight: originalHeight,\n\t\t\t\twasResized: false,\n\t\t\t};\n\t\t}\n\n\t\t// Calculate initial dimensions respecting max limits\n\t\tlet targetWidth = originalWidth;\n\t\tlet targetHeight = originalHeight;\n\n\t\tif (targetWidth > opts.maxWidth) {\n\t\t\ttargetHeight = Math.max(1, Math.round((targetHeight * opts.maxWidth) / targetWidth));\n\t\t\ttargetWidth = opts.maxWidth;\n\t\t}\n\t\tif (targetHeight > opts.maxHeight) {\n\t\t\ttargetWidth = Math.max(1, Math.round((targetWidth * opts.maxHeight) / targetHeight));\n\t\t\ttargetHeight = opts.maxHeight;\n\t\t}\n\n\t\tasync function tryEncodings(width: number, height: number, jpegQualities: number[]): Promise<EncodedCandidate[]> {\n\t\t\tconst resized = resizeDecodedImage(image, width, height);\n\t\t\tconst candidates: EncodedCandidate[] = [encodeCandidate(await encodePng(resized), \"image/png\")];\n\t\t\tfor (const quality of jpegQualities) {\n\t\t\t\tcandidates.push(encodeCandidate(await encodeJpeg(resized, quality), \"image/jpeg\"));\n\t\t\t}\n\t\t\treturn candidates;\n\t\t}\n\n\t\tconst qualitySteps = Array.from(new Set([opts.jpegQuality, 85, 70, 55, 40]));\n\t\tlet currentWidth = targetWidth;\n\t\tlet currentHeight = targetHeight;\n\n\t\twhile (true) {\n\t\t\tconst candidates = await tryEncodings(currentWidth, currentHeight, qualitySteps);\n\t\t\tfor (const candidate of candidates) {\n\t\t\t\tif (candidate.encodedSize < opts.maxBytes) {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tdata: candidate.data,\n\t\t\t\t\t\tmimeType: candidate.mimeType,\n\t\t\t\t\t\toriginalWidth,\n\t\t\t\t\t\toriginalHeight,\n\t\t\t\t\t\twidth: currentWidth,\n\t\t\t\t\t\theight: currentHeight,\n\t\t\t\t\t\twasResized: true,\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (currentWidth === 1 && currentHeight === 1) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tconst nextWidth = currentWidth === 1 ? 1 : Math.max(1, Math.floor(currentWidth * 0.75));\n\t\t\tconst nextHeight = currentHeight === 1 ? 1 : Math.max(1, Math.floor(currentHeight * 0.75));\n\t\t\tif (nextWidth === currentWidth && nextHeight === currentHeight) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcurrentWidth = nextWidth;\n\t\t\tcurrentHeight = nextHeight;\n\t\t}\n\n\t\treturn null;\n\t} catch {\n\t\treturn null;\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-resize-worker.d.ts","sourceRoot":"","sources":["../../src/utils/image-resize-worker.ts"],"names":[],"mappings":"","sourcesContent":["import { parentPort } from \"node:worker_threads\";\nimport { type ImageResizeOptions, type ResizedImage, resizeImageInProcess } from \"./image-resize-core.ts\";\n\ninterface ResizeImageWorkerRequest {\n\tinputBytes: Uint8Array;\n\tmimeType: string;\n\toptions?: ImageResizeOptions;\n}\n\ninterface ResizeImageWorkerResponse {\n\tresult?: ResizedImage | null;\n\terror?: string;\n}\n\nfunction isResizeImageWorkerRequest(value: unknown): value is ResizeImageWorkerRequest {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst record = value as Record<string, unknown>;\n\treturn record.inputBytes instanceof Uint8Array && typeof record.mimeType === \"string\";\n}\n\nconst port = parentPort;\nif (!port) {\n\tthrow new Error(\"image resize worker requires parentPort\");\n}\n\nport.once(\"message\", (message: unknown) => {\n\tvoid (async () => {\n\t\ttry {\n\t\t\tif (!isResizeImageWorkerRequest(message)) {\n\t\t\t\tthrow new Error(\"Invalid image resize worker request\");\n\t\t\t}\n\t\t\tconst result = await resizeImageInProcess(message.inputBytes, message.mimeType, message.options);\n\t\t\tconst response: ResizeImageWorkerResponse = { result };\n\t\t\tport.postMessage(response);\n\t\t} catch (error) {\n\t\t\tconst response: ResizeImageWorkerResponse = {\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t};\n\t\t\tport.postMessage(response);\n\t\t}\n\t})();\n});\n"]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { parentPort } from "node:worker_threads";
|
|
2
|
+
import { resizeImageInProcess } from "./image-resize-core.js";
|
|
3
|
+
function isResizeImageWorkerRequest(value) {
|
|
4
|
+
if (!value || typeof value !== "object")
|
|
5
|
+
return false;
|
|
6
|
+
const record = value;
|
|
7
|
+
return record.inputBytes instanceof Uint8Array && typeof record.mimeType === "string";
|
|
8
|
+
}
|
|
9
|
+
const port = parentPort;
|
|
10
|
+
if (!port) {
|
|
11
|
+
throw new Error("image resize worker requires parentPort");
|
|
12
|
+
}
|
|
13
|
+
port.once("message", (message) => {
|
|
14
|
+
void (async () => {
|
|
15
|
+
try {
|
|
16
|
+
if (!isResizeImageWorkerRequest(message)) {
|
|
17
|
+
throw new Error("Invalid image resize worker request");
|
|
18
|
+
}
|
|
19
|
+
const result = await resizeImageInProcess(message.inputBytes, message.mimeType, message.options);
|
|
20
|
+
const response = { result };
|
|
21
|
+
port.postMessage(response);
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
const response = {
|
|
25
|
+
error: error instanceof Error ? error.message : String(error),
|
|
26
|
+
};
|
|
27
|
+
port.postMessage(response);
|
|
28
|
+
}
|
|
29
|
+
})();
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=image-resize-worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-resize-worker.js","sourceRoot":"","sources":["../../src/utils/image-resize-worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAA8C,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAa1G,SAAS,0BAA0B,CAAC,KAAc,EAAqC;IACtF,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IACtD,MAAM,MAAM,GAAG,KAAgC,CAAC;IAChD,OAAO,MAAM,CAAC,UAAU,YAAY,UAAU,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAC;AAAA,CACtF;AAED,MAAM,IAAI,GAAG,UAAU,CAAC;AACxB,IAAI,CAAC,IAAI,EAAE,CAAC;IACX,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;AAC5D,CAAC;AAED,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,OAAgB,EAAE,EAAE,CAAC;IAC1C,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;QACjB,IAAI,CAAC;YACJ,IAAI,CAAC,0BAA0B,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC1C,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;YACxD,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,OAAO,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;YACjG,MAAM,QAAQ,GAA8B,EAAE,MAAM,EAAE,CAAC;YACvD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,MAAM,QAAQ,GAA8B;gBAC3C,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC7D,CAAC;YACF,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;QAC5B,CAAC;IAAA,CACD,CAAC,EAAE,CAAC;AAAA,CACL,CAAC,CAAC","sourcesContent":["import { parentPort } from \"node:worker_threads\";\nimport { type ImageResizeOptions, type ResizedImage, resizeImageInProcess } from \"./image-resize-core.ts\";\n\ninterface ResizeImageWorkerRequest {\n\tinputBytes: Uint8Array;\n\tmimeType: string;\n\toptions?: ImageResizeOptions;\n}\n\ninterface ResizeImageWorkerResponse {\n\tresult?: ResizedImage | null;\n\terror?: string;\n}\n\nfunction isResizeImageWorkerRequest(value: unknown): value is ResizeImageWorkerRequest {\n\tif (!value || typeof value !== \"object\") return false;\n\tconst record = value as Record<string, unknown>;\n\treturn record.inputBytes instanceof Uint8Array && typeof record.mimeType === \"string\";\n}\n\nconst port = parentPort;\nif (!port) {\n\tthrow new Error(\"image resize worker requires parentPort\");\n}\n\nport.once(\"message\", (message: unknown) => {\n\tvoid (async () => {\n\t\ttry {\n\t\t\tif (!isResizeImageWorkerRequest(message)) {\n\t\t\t\tthrow new Error(\"Invalid image resize worker request\");\n\t\t\t}\n\t\t\tconst result = await resizeImageInProcess(message.inputBytes, message.mimeType, message.options);\n\t\t\tconst response: ResizeImageWorkerResponse = { result };\n\t\t\tport.postMessage(response);\n\t\t} catch (error) {\n\t\t\tconst response: ResizeImageWorkerResponse = {\n\t\t\t\terror: error instanceof Error ? error.message : String(error),\n\t\t\t};\n\t\t\tport.postMessage(response);\n\t\t}\n\t})();\n});\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ImageResizeOptions, type ResizedImage } from "./image-resize-core.ts";
|
|
2
|
+
export type { ImageResizeOptions, ResizedImage } from "./image-resize-core.ts";
|
|
3
|
+
/**
|
|
4
|
+
* Resize an image to fit within the specified max dimensions and encoded file size.
|
|
5
|
+
* Runs image decoding, resizing, and encoding in a worker thread so it does not
|
|
6
|
+
* block the TUI event loop. If the worker cannot be loaded, fall back to
|
|
7
|
+
* in-process resizing so image reads still work.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resizeImage(inputBytes: Uint8Array, mimeType: string, options?: ImageResizeOptions): Promise<ResizedImage | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Format a dimension note for resized images.
|
|
12
|
+
* This helps the model understand the coordinate mapping.
|
|
13
|
+
*/
|
|
14
|
+
export declare function formatDimensionNote(result: ResizedImage): string | undefined;
|
|
15
|
+
//# sourceMappingURL=image-resize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-resize.d.ts","sourceRoot":"","sources":["../../src/utils/image-resize.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,kBAAkB,EAAE,KAAK,YAAY,EAAwB,MAAM,wBAAwB,CAAC;AAE1G,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AA0E/E;;;;;GAKG;AACH,wBAAsB,WAAW,CAChC,UAAU,EAAE,UAAU,EACtB,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAY9B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,GAAG,SAAS,CAO5E","sourcesContent":["import { pathToFileURL } from \"node:url\";\nimport { Worker } from \"node:worker_threads\";\nimport { isStandaloneBinary } from \"../config.ts\";\nimport { type ImageResizeOptions, type ResizedImage, resizeImageInProcess } from \"./image-resize-core.ts\";\n\nexport type { ImageResizeOptions, ResizedImage } from \"./image-resize-core.ts\";\n\ninterface ResizeImageWorkerResponse {\n\tresult?: ResizedImage | null;\n\terror?: string;\n}\n\nfunction toTransferableBytes(input: Uint8Array): Uint8Array<ArrayBuffer> {\n\t// Transfer detaches the buffer, so transfer a worker-owned copy and leave the\n\t// caller's bytes intact.\n\treturn new Uint8Array(input);\n}\n\nfunction isResizeImageWorkerResponse(value: unknown): value is ResizeImageWorkerResponse {\n\treturn value !== null && typeof value === \"object\";\n}\n\nfunction createResizeWorker(workerSpecifier: string | URL): Worker {\n\treturn new Worker(workerSpecifier);\n}\n\nasync function resizeImageInWorker(\n\tworkerSpecifier: string | URL,\n\tinputBytes: Uint8Array,\n\tmimeType: string,\n\toptions?: ImageResizeOptions,\n): Promise<ResizedImage | null> {\n\tconst worker = createResizeWorker(workerSpecifier);\n\ttry {\n\t\tconst inputBytesForWorker = toTransferableBytes(inputBytes);\n\t\treturn await new Promise<ResizedImage | null>((resolve, reject) => {\n\t\t\tlet settled = false;\n\t\t\tconst settle = (result: ResizedImage | null): void => {\n\t\t\t\tif (settled) return;\n\t\t\t\tsettled = true;\n\t\t\t\tresolve(result);\n\t\t\t};\n\t\t\tconst fail = (error: Error): void => {\n\t\t\t\tif (settled) return;\n\t\t\t\tsettled = true;\n\t\t\t\treject(error);\n\t\t\t};\n\n\t\t\tworker.once(\"message\", (message: unknown) => {\n\t\t\t\tif (!isResizeImageWorkerResponse(message)) {\n\t\t\t\t\tfail(new Error(\"Invalid image resize worker response\"));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tif (message.error) {\n\t\t\t\t\tfail(new Error(message.error));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tsettle(message.result ?? null);\n\t\t\t});\n\t\t\tworker.once(\"error\", fail);\n\t\t\tworker.once(\"exit\", (code) => {\n\t\t\t\tif (!settled) {\n\t\t\t\t\tfail(new Error(`Image resize worker exited with code ${code}`));\n\t\t\t\t}\n\t\t\t});\n\t\t\tworker.postMessage(\n\t\t\t\t{\n\t\t\t\t\tinputBytes: inputBytesForWorker,\n\t\t\t\t\tmimeType,\n\t\t\t\t\toptions,\n\t\t\t\t},\n\t\t\t\t[inputBytesForWorker.buffer],\n\t\t\t);\n\t\t});\n\t} finally {\n\t\tvoid worker.terminate().catch(() => undefined);\n\t}\n}\n\n/**\n * Resize an image to fit within the specified max dimensions and encoded file size.\n * Runs image decoding, resizing, and encoding in a worker thread so it does not\n * block the TUI event loop. If the worker cannot be loaded, fall back to\n * in-process resizing so image reads still work.\n */\nexport async function resizeImage(\n\tinputBytes: Uint8Array,\n\tmimeType: string,\n\toptions?: ImageResizeOptions,\n): Promise<ResizedImage | null> {\n\tconst moduleUrl: string | undefined = import.meta.url;\n\tconst isTypeScriptRuntime = moduleUrl?.endsWith(\".ts\") === true;\n\tconst workerUrl = isStandaloneBinary\n\t\t? new URL(\"./image-resize-worker.cjs\", pathToFileURL(process.execPath))\n\t\t: new URL(isTypeScriptRuntime ? \"./image-resize-worker.ts\" : \"./image-resize-worker.js\", moduleUrl);\n\n\ttry {\n\t\treturn await resizeImageInWorker(workerUrl, inputBytes, mimeType, options);\n\t} catch {\n\t\treturn resizeImageInProcess(inputBytes, mimeType, options);\n\t}\n}\n\n/**\n * Format a dimension note for resized images.\n * This helps the model understand the coordinate mapping.\n */\nexport function formatDimensionNote(result: ResizedImage): string | undefined {\n\tif (!result.wasResized) {\n\t\treturn undefined;\n\t}\n\n\tconst scale = result.originalWidth / result.width;\n\treturn `[Image: original ${result.originalWidth}x${result.originalHeight}, displayed at ${result.width}x${result.height}. Multiply coordinates by ${scale.toFixed(2)} to map to original image.]`;\n}\n"]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { pathToFileURL } from "node:url";
|
|
2
|
+
import { Worker } from "node:worker_threads";
|
|
3
|
+
import { isStandaloneBinary } from "../config.js";
|
|
4
|
+
import { resizeImageInProcess } from "./image-resize-core.js";
|
|
5
|
+
function toTransferableBytes(input) {
|
|
6
|
+
// Transfer detaches the buffer, so transfer a worker-owned copy and leave the
|
|
7
|
+
// caller's bytes intact.
|
|
8
|
+
return new Uint8Array(input);
|
|
9
|
+
}
|
|
10
|
+
function isResizeImageWorkerResponse(value) {
|
|
11
|
+
return value !== null && typeof value === "object";
|
|
12
|
+
}
|
|
13
|
+
function createResizeWorker(workerSpecifier) {
|
|
14
|
+
return new Worker(workerSpecifier);
|
|
15
|
+
}
|
|
16
|
+
async function resizeImageInWorker(workerSpecifier, inputBytes, mimeType, options) {
|
|
17
|
+
const worker = createResizeWorker(workerSpecifier);
|
|
18
|
+
try {
|
|
19
|
+
const inputBytesForWorker = toTransferableBytes(inputBytes);
|
|
20
|
+
return await new Promise((resolve, reject) => {
|
|
21
|
+
let settled = false;
|
|
22
|
+
const settle = (result) => {
|
|
23
|
+
if (settled)
|
|
24
|
+
return;
|
|
25
|
+
settled = true;
|
|
26
|
+
resolve(result);
|
|
27
|
+
};
|
|
28
|
+
const fail = (error) => {
|
|
29
|
+
if (settled)
|
|
30
|
+
return;
|
|
31
|
+
settled = true;
|
|
32
|
+
reject(error);
|
|
33
|
+
};
|
|
34
|
+
worker.once("message", (message) => {
|
|
35
|
+
if (!isResizeImageWorkerResponse(message)) {
|
|
36
|
+
fail(new Error("Invalid image resize worker response"));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (message.error) {
|
|
40
|
+
fail(new Error(message.error));
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
settle(message.result ?? null);
|
|
44
|
+
});
|
|
45
|
+
worker.once("error", fail);
|
|
46
|
+
worker.once("exit", (code) => {
|
|
47
|
+
if (!settled) {
|
|
48
|
+
fail(new Error(`Image resize worker exited with code ${code}`));
|
|
49
|
+
}
|
|
50
|
+
});
|
|
51
|
+
worker.postMessage({
|
|
52
|
+
inputBytes: inputBytesForWorker,
|
|
53
|
+
mimeType,
|
|
54
|
+
options,
|
|
55
|
+
}, [inputBytesForWorker.buffer]);
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
finally {
|
|
59
|
+
void worker.terminate().catch(() => undefined);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Resize an image to fit within the specified max dimensions and encoded file size.
|
|
64
|
+
* Runs image decoding, resizing, and encoding in a worker thread so it does not
|
|
65
|
+
* block the TUI event loop. If the worker cannot be loaded, fall back to
|
|
66
|
+
* in-process resizing so image reads still work.
|
|
67
|
+
*/
|
|
68
|
+
export async function resizeImage(inputBytes, mimeType, options) {
|
|
69
|
+
const moduleUrl = import.meta.url;
|
|
70
|
+
const isTypeScriptRuntime = moduleUrl?.endsWith(".ts") === true;
|
|
71
|
+
const workerUrl = isStandaloneBinary
|
|
72
|
+
? new URL("./image-resize-worker.cjs", pathToFileURL(process.execPath))
|
|
73
|
+
: new URL(isTypeScriptRuntime ? "./image-resize-worker.ts" : "./image-resize-worker.js", moduleUrl);
|
|
74
|
+
try {
|
|
75
|
+
return await resizeImageInWorker(workerUrl, inputBytes, mimeType, options);
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return resizeImageInProcess(inputBytes, mimeType, options);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Format a dimension note for resized images.
|
|
83
|
+
* This helps the model understand the coordinate mapping.
|
|
84
|
+
*/
|
|
85
|
+
export function formatDimensionNote(result) {
|
|
86
|
+
if (!result.wasResized) {
|
|
87
|
+
return undefined;
|
|
88
|
+
}
|
|
89
|
+
const scale = result.originalWidth / result.width;
|
|
90
|
+
return `[Image: original ${result.originalWidth}x${result.originalHeight}, displayed at ${result.width}x${result.height}. Multiply coordinates by ${scale.toFixed(2)} to map to original image.]`;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=image-resize.js.map
|