@greppleai/grip 0.0.0-stage → 0.0.1
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/CHANGELOG.md +22 -0
- package/README.md +725 -2
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +11 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/register-bedrock.d.ts +2 -0
- package/dist/bun/register-bedrock.d.ts.map +1 -0
- package/dist/bun/register-bedrock.js +4 -0
- package/dist/bun/register-bedrock.js.map +1 -0
- package/dist/bun/restore-sandbox-env.d.ts +13 -0
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -0
- package/dist/bun/restore-sandbox-env.js +32 -0
- package/dist/bun/restore-sandbox-env.js.map +1 -0
- package/dist/cli/args.d.ts +70 -0
- package/dist/cli/args.d.ts.map +1 -0
- package/dist/cli/args.js +441 -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 +60 -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/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.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +82 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +406 -0
- package/dist/config.js.map +1 -0
- package/dist/core/agent-session.d.ts +970 -0
- package/dist/core/agent-session.d.ts.map +1 -0
- package/dist/core/agent-session.js +5176 -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 +150 -0
- package/dist/core/auth-storage.d.ts.map +1 -0
- package/dist/core/auth-storage.js +557 -0
- package/dist/core/auth-storage.js.map +1 -0
- package/dist/core/bash-executor.d.ts +26 -0
- package/dist/core/bash-executor.d.ts.map +1 -0
- package/dist/core/bash-executor.js +99 -0
- package/dist/core/bash-executor.js.map +1 -0
- package/dist/core/compaction/branch-summarization.d.ts +83 -0
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -0
- package/dist/core/compaction/branch-summarization.js +220 -0
- package/dist/core/compaction/branch-summarization.js.map +1 -0
- package/dist/core/compaction/compaction.d.ts +65 -0
- package/dist/core/compaction/compaction.d.ts.map +1 -0
- package/dist/core/compaction/compaction.js +550 -0
- package/dist/core/compaction/compaction.js.map +1 -0
- package/dist/core/compaction/compression-detection-ledger.d.ts +34 -0
- package/dist/core/compaction/compression-detection-ledger.d.ts.map +1 -0
- package/dist/core/compaction/compression-detection-ledger.js +52 -0
- package/dist/core/compaction/compression-detection-ledger.js.map +1 -0
- package/dist/core/compaction/compression-detector.d.ts +71 -0
- package/dist/core/compaction/compression-detector.d.ts.map +1 -0
- package/dist/core/compaction/compression-detector.js +407 -0
- package/dist/core/compaction/compression-detector.js.map +1 -0
- package/dist/core/compaction/compression-economics.d.ts +55 -0
- package/dist/core/compaction/compression-economics.d.ts.map +1 -0
- package/dist/core/compaction/compression-economics.js +151 -0
- package/dist/core/compaction/compression-economics.js.map +1 -0
- package/dist/core/compaction/utils.d.ts +28 -0
- package/dist/core/compaction/utils.d.ts.map +1 -0
- package/dist/core/compaction/utils.js +165 -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 +18 -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/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 +245 -0
- package/dist/core/export-html/ansi-to-html.js.map +1 -0
- package/dist/core/export-html/index.d.ts +21 -0
- package/dist/core/export-html/index.d.ts.map +1 -0
- package/dist/core/export-html/index.js +230 -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 +32 -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/loader.d.ts +24 -0
- package/dist/core/extensions/loader.d.ts.map +1 -0
- package/dist/core/extensions/loader.js +613 -0
- package/dist/core/extensions/loader.js.map +1 -0
- package/dist/core/extensions/runner.d.ts +160 -0
- package/dist/core/extensions/runner.d.ts.map +1 -0
- package/dist/core/extensions/runner.js +962 -0
- package/dist/core/extensions/runner.js.map +1 -0
- package/dist/core/extensions/types.d.ts +1311 -0
- package/dist/core/extensions/types.d.ts.map +1 -0
- package/dist/core/extensions/types.js +51 -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 +52 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -0
- package/dist/core/footer-data-provider.js +318 -0
- package/dist/core/footer-data-provider.js.map +1 -0
- package/dist/core/grip-agent.d.ts +240 -0
- package/dist/core/grip-agent.d.ts.map +1 -0
- package/dist/core/grip-agent.js +1243 -0
- package/dist/core/grip-agent.js.map +1 -0
- package/dist/core/grip-manifest.d.ts +9 -0
- package/dist/core/grip-manifest.d.ts.map +1 -0
- package/dist/core/grip-manifest.js +25 -0
- package/dist/core/grip-manifest.js.map +1 -0
- package/dist/core/hooks/aggregate.d.ts +5 -0
- package/dist/core/hooks/aggregate.d.ts.map +1 -0
- package/dist/core/hooks/aggregate.js +226 -0
- package/dist/core/hooks/aggregate.js.map +1 -0
- package/dist/core/hooks/config.d.ts +14 -0
- package/dist/core/hooks/config.d.ts.map +1 -0
- package/dist/core/hooks/config.js +372 -0
- package/dist/core/hooks/config.js.map +1 -0
- package/dist/core/hooks/executor.d.ts +12 -0
- package/dist/core/hooks/executor.d.ts.map +1 -0
- package/dist/core/hooks/executor.js +708 -0
- package/dist/core/hooks/executor.js.map +1 -0
- package/dist/core/hooks/index.d.ts +9 -0
- package/dist/core/hooks/index.d.ts.map +1 -0
- package/dist/core/hooks/index.js +14 -0
- package/dist/core/hooks/index.js.map +1 -0
- package/dist/core/hooks/matcher.d.ts +10 -0
- package/dist/core/hooks/matcher.d.ts.map +1 -0
- package/dist/core/hooks/matcher.js +70 -0
- package/dist/core/hooks/matcher.js.map +1 -0
- package/dist/core/hooks/trust-store.d.ts +38 -0
- package/dist/core/hooks/trust-store.d.ts.map +1 -0
- package/dist/core/hooks/trust-store.js +167 -0
- package/dist/core/hooks/trust-store.js.map +1 -0
- package/dist/core/hooks/types.d.ts +234 -0
- package/dist/core/hooks/types.d.ts.map +1 -0
- package/dist/core/hooks/types.js +52 -0
- package/dist/core/hooks/types.js.map +1 -0
- package/dist/core/http-dispatcher.d.ts +21 -0
- package/dist/core/http-dispatcher.d.ts.map +1 -0
- package/dist/core/http-dispatcher.js +82 -0
- package/dist/core/http-dispatcher.js.map +1 -0
- package/dist/core/instruction-resource-loader.d.ts +81 -0
- package/dist/core/instruction-resource-loader.d.ts.map +1 -0
- package/dist/core/instruction-resource-loader.js +574 -0
- package/dist/core/instruction-resource-loader.js.map +1 -0
- package/dist/core/keybindings.d.ts +399 -0
- package/dist/core/keybindings.d.ts.map +1 -0
- package/dist/core/keybindings.js +299 -0
- package/dist/core/keybindings.js.map +1 -0
- package/dist/core/lsp/abort.d.ts +3 -0
- package/dist/core/lsp/abort.d.ts.map +1 -0
- package/dist/core/lsp/abort.js +28 -0
- package/dist/core/lsp/abort.js.map +1 -0
- package/dist/core/lsp/client.d.ts +108 -0
- package/dist/core/lsp/client.d.ts.map +1 -0
- package/dist/core/lsp/client.js +586 -0
- package/dist/core/lsp/client.js.map +1 -0
- package/dist/core/lsp/config-loader.d.ts +44 -0
- package/dist/core/lsp/config-loader.d.ts.map +1 -0
- package/dist/core/lsp/config-loader.js +223 -0
- package/dist/core/lsp/config-loader.js.map +1 -0
- package/dist/core/lsp/config.d.ts +134 -0
- package/dist/core/lsp/config.d.ts.map +1 -0
- package/dist/core/lsp/config.js +682 -0
- package/dist/core/lsp/config.js.map +1 -0
- package/dist/core/lsp/diagnostics.d.ts +18 -0
- package/dist/core/lsp/diagnostics.d.ts.map +1 -0
- package/dist/core/lsp/diagnostics.js +311 -0
- package/dist/core/lsp/diagnostics.js.map +1 -0
- package/dist/core/lsp/file-sync.d.ts +58 -0
- package/dist/core/lsp/file-sync.d.ts.map +1 -0
- package/dist/core/lsp/file-sync.js +432 -0
- package/dist/core/lsp/file-sync.js.map +1 -0
- package/dist/core/lsp/integration.d.ts +62 -0
- package/dist/core/lsp/integration.d.ts.map +1 -0
- package/dist/core/lsp/integration.js +145 -0
- package/dist/core/lsp/integration.js.map +1 -0
- package/dist/core/lsp/language-map.d.ts +54 -0
- package/dist/core/lsp/language-map.d.ts.map +1 -0
- package/dist/core/lsp/language-map.js +300 -0
- package/dist/core/lsp/language-map.js.map +1 -0
- package/dist/core/lsp/manager.d.ts +120 -0
- package/dist/core/lsp/manager.d.ts.map +1 -0
- package/dist/core/lsp/manager.js +636 -0
- package/dist/core/lsp/manager.js.map +1 -0
- package/dist/core/lsp/navigation.d.ts +32 -0
- package/dist/core/lsp/navigation.d.ts.map +1 -0
- package/dist/core/lsp/navigation.js +327 -0
- package/dist/core/lsp/navigation.js.map +1 -0
- package/dist/core/lsp/portable-path.d.ts +18 -0
- package/dist/core/lsp/portable-path.d.ts.map +1 -0
- package/dist/core/lsp/portable-path.js +83 -0
- package/dist/core/lsp/portable-path.js.map +1 -0
- package/dist/core/lsp/refactor.d.ts +32 -0
- package/dist/core/lsp/refactor.d.ts.map +1 -0
- package/dist/core/lsp/refactor.js +519 -0
- package/dist/core/lsp/refactor.js.map +1 -0
- package/dist/core/lsp/transport.d.ts +39 -0
- package/dist/core/lsp/transport.d.ts.map +1 -0
- package/dist/core/lsp/transport.js +261 -0
- package/dist/core/lsp/transport.js.map +1 -0
- package/dist/core/messages.d.ts +34 -0
- package/dist/core/messages.d.ts.map +1 -0
- package/dist/core/messages.js +140 -0
- package/dist/core/messages.js.map +1 -0
- package/dist/core/model-registry.d.ts +148 -0
- package/dist/core/model-registry.d.ts.map +1 -0
- package/dist/core/model-registry.js +812 -0
- package/dist/core/model-registry.js.map +1 -0
- package/dist/core/model-resolver.d.ts +115 -0
- package/dist/core/model-resolver.d.ts.map +1 -0
- package/dist/core/model-resolver.js +498 -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 +209 -0
- package/dist/core/package-manager.d.ts.map +1 -0
- package/dist/core/package-manager.js +2341 -0
- package/dist/core/package-manager.js.map +1 -0
- package/dist/core/prompt-templates.d.ts +57 -0
- package/dist/core/prompt-templates.d.ts.map +1 -0
- package/dist/core/prompt-templates.js +353 -0
- package/dist/core/prompt-templates.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 +33 -0
- package/dist/core/provider-display-names.js.map +1 -0
- package/dist/core/remote-workspace-protocol/contract.d.ts +456 -0
- package/dist/core/remote-workspace-protocol/contract.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/contract.js +809 -0
- package/dist/core/remote-workspace-protocol/contract.js.map +1 -0
- package/dist/core/remote-workspace-protocol/session.d.ts +247 -0
- package/dist/core/remote-workspace-protocol/session.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/session.js +1839 -0
- package/dist/core/remote-workspace-protocol/session.js.map +1 -0
- package/dist/core/resolve-config-value.d.ts +32 -0
- package/dist/core/resolve-config-value.d.ts.map +1 -0
- package/dist/core/resolve-config-value.js +257 -0
- package/dist/core/resolve-config-value.js.map +1 -0
- package/dist/core/resource-loader.d.ts +200 -0
- package/dist/core/resource-loader.d.ts.map +1 -0
- package/dist/core/resource-loader.js +1209 -0
- package/dist/core/resource-loader.js.map +1 -0
- package/dist/core/rules.d.ts +40 -0
- package/dist/core/rules.d.ts.map +1 -0
- package/dist/core/rules.js +57 -0
- package/dist/core/rules.js.map +1 -0
- package/dist/core/sandbox/command.d.ts +27 -0
- package/dist/core/sandbox/command.d.ts.map +1 -0
- package/dist/core/sandbox/command.js +124 -0
- package/dist/core/sandbox/command.js.map +1 -0
- package/dist/core/sandbox/docker.d.ts +169 -0
- package/dist/core/sandbox/docker.d.ts.map +1 -0
- package/dist/core/sandbox/docker.js +633 -0
- package/dist/core/sandbox/docker.js.map +1 -0
- package/dist/core/sandbox/lima.d.ts +38 -0
- package/dist/core/sandbox/lima.d.ts.map +1 -0
- package/dist/core/sandbox/lima.js +324 -0
- package/dist/core/sandbox/lima.js.map +1 -0
- package/dist/core/session/constants.d.ts +2 -0
- package/dist/core/session/constants.d.ts.map +1 -0
- package/dist/core/session/constants.js +2 -0
- package/dist/core/session/constants.js.map +1 -0
- package/dist/core/session/context-metadata.d.ts +5 -0
- package/dist/core/session/context-metadata.d.ts.map +1 -0
- package/dist/core/session/context-metadata.js +55 -0
- package/dist/core/session/context-metadata.js.map +1 -0
- package/dist/core/session/context.d.ts +14 -0
- package/dist/core/session/context.d.ts.map +1 -0
- package/dist/core/session/context.js +117 -0
- package/dist/core/session/context.js.map +1 -0
- package/dist/core/session/ids.d.ts +9 -0
- package/dist/core/session/ids.d.ts.map +1 -0
- package/dist/core/session/ids.js +21 -0
- package/dist/core/session/ids.js.map +1 -0
- package/dist/core/session/in-memory-session-manager.d.ts +17 -0
- package/dist/core/session/in-memory-session-manager.d.ts.map +1 -0
- package/dist/core/session/in-memory-session-manager.js +40 -0
- package/dist/core/session/in-memory-session-manager.js.map +1 -0
- package/dist/core/session/in-memory-session.d.ts +7 -0
- package/dist/core/session/in-memory-session.d.ts.map +1 -0
- package/dist/core/session/in-memory-session.js +11 -0
- package/dist/core/session/in-memory-session.js.map +1 -0
- package/dist/core/session/jsonl-errors.d.ts +36 -0
- package/dist/core/session/jsonl-errors.d.ts.map +1 -0
- package/dist/core/session/jsonl-errors.js +49 -0
- package/dist/core/session/jsonl-errors.js.map +1 -0
- package/dist/core/session/jsonl-helpers.d.ts +20 -0
- package/dist/core/session/jsonl-helpers.d.ts.map +1 -0
- package/dist/core/session/jsonl-helpers.js +21 -0
- package/dist/core/session/jsonl-helpers.js.map +1 -0
- package/dist/core/session/local-session-manager.d.ts +30 -0
- package/dist/core/session/local-session-manager.d.ts.map +1 -0
- package/dist/core/session/local-session-manager.js +205 -0
- package/dist/core/session/local-session-manager.js.map +1 -0
- package/dist/core/session/local-session.d.ts +9 -0
- package/dist/core/session/local-session.d.ts.map +1 -0
- package/dist/core/session/local-session.js +15 -0
- package/dist/core/session/local-session.js.map +1 -0
- package/dist/core/session/migrations.d.ts +11 -0
- package/dist/core/session/migrations.d.ts.map +1 -0
- package/dist/core/session/migrations.js +78 -0
- package/dist/core/session/migrations.js.map +1 -0
- package/dist/core/session/remote-session-client.d.ts +83 -0
- package/dist/core/session/remote-session-client.d.ts.map +1 -0
- package/dist/core/session/remote-session-client.js +224 -0
- package/dist/core/session/remote-session-client.js.map +1 -0
- package/dist/core/session/remote-session-manager.d.ts +32 -0
- package/dist/core/session/remote-session-manager.d.ts.map +1 -0
- package/dist/core/session/remote-session-manager.js +124 -0
- package/dist/core/session/remote-session-manager.js.map +1 -0
- package/dist/core/session/remote-session.d.ts +20 -0
- package/dist/core/session/remote-session.d.ts.map +1 -0
- package/dist/core/session/remote-session.js +33 -0
- package/dist/core/session/remote-session.js.map +1 -0
- package/dist/core/session/session-manager.d.ts +18 -0
- package/dist/core/session/session-manager.d.ts.map +1 -0
- package/dist/core/session/session-manager.js +2 -0
- package/dist/core/session/session-manager.js.map +1 -0
- package/dist/core/session/session.d.ts +140 -0
- package/dist/core/session/session.d.ts.map +1 -0
- package/dist/core/session/session.js +461 -0
- package/dist/core/session/session.js.map +1 -0
- package/dist/core/session/stores/in-memory-session-store.d.ts +39 -0
- package/dist/core/session/stores/in-memory-session-store.d.ts.map +1 -0
- package/dist/core/session/stores/in-memory-session-store.js +168 -0
- package/dist/core/session/stores/in-memory-session-store.js.map +1 -0
- package/dist/core/session/stores/jsonl-session-store.d.ts +97 -0
- package/dist/core/session/stores/jsonl-session-store.d.ts.map +1 -0
- package/dist/core/session/stores/jsonl-session-store.js +1140 -0
- package/dist/core/session/stores/jsonl-session-store.js.map +1 -0
- package/dist/core/session/stores/remote-session-store.d.ts +44 -0
- package/dist/core/session/stores/remote-session-store.d.ts.map +1 -0
- package/dist/core/session/stores/remote-session-store.js +159 -0
- package/dist/core/session/stores/remote-session-store.js.map +1 -0
- package/dist/core/session/stores/session-store.d.ts +42 -0
- package/dist/core/session/stores/session-store.d.ts.map +1 -0
- package/dist/core/session/stores/session-store.js +2 -0
- package/dist/core/session/stores/session-store.js.map +1 -0
- package/dist/core/session/types.d.ts +141 -0
- package/dist/core/session/types.d.ts.map +1 -0
- package/dist/core/session/types.js +2 -0
- package/dist/core/session/types.js.map +1 -0
- package/dist/core/session/usage-ledger.d.ts +18 -0
- package/dist/core/session/usage-ledger.d.ts.map +1 -0
- package/dist/core/session/usage-ledger.js +68 -0
- package/dist/core/session/usage-ledger.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/settings-manager.d.ts +318 -0
- package/dist/core/settings-manager.d.ts.map +1 -0
- package/dist/core/settings-manager.js +991 -0
- package/dist/core/settings-manager.js.map +1 -0
- package/dist/core/skills.d.ts +40 -0
- package/dist/core/skills.d.ts.map +1 -0
- package/dist/core/skills.js +57 -0
- package/dist/core/skills.js.map +1 -0
- package/dist/core/slash-commands.d.ts +15 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +36 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/core/source-info.d.ts +26 -0
- package/dist/core/source-info.d.ts.map +1 -0
- package/dist/core/source-info.js +27 -0
- package/dist/core/source-info.js.map +1 -0
- package/dist/core/system-prompt.d.ts +32 -0
- package/dist/core/system-prompt.d.ts.map +1 -0
- package/dist/core/system-prompt.js +131 -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/timings.d.ts +10 -0
- package/dist/core/timings.d.ts.map +1 -0
- package/dist/core/timings.js +41 -0
- package/dist/core/timings.js.map +1 -0
- package/dist/core/tools/bash.d.ts +51 -0
- package/dist/core/tools/bash.d.ts.map +1 -0
- package/dist/core/tools/bash.js +310 -0
- package/dist/core/tools/bash.js.map +1 -0
- package/dist/core/tools/compress-context.d.ts +27 -0
- package/dist/core/tools/compress-context.d.ts.map +1 -0
- package/dist/core/tools/compress-context.js +142 -0
- package/dist/core/tools/compress-context.js.map +1 -0
- package/dist/core/tools/edit-diff.d.ts +82 -0
- package/dist/core/tools/edit-diff.d.ts.map +1 -0
- package/dist/core/tools/edit-diff.js +327 -0
- package/dist/core/tools/edit-diff.js.map +1 -0
- package/dist/core/tools/edit.d.ts +50 -0
- package/dist/core/tools/edit.d.ts.map +1 -0
- package/dist/core/tools/edit.js +324 -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 +60 -0
- package/dist/core/tools/file-mutation-queue.js.map +1 -0
- package/dist/core/tools/find.d.ts +22 -0
- package/dist/core/tools/find.d.ts.map +1 -0
- package/dist/core/tools/find.js +268 -0
- package/dist/core/tools/find.js.map +1 -0
- package/dist/core/tools/grep.d.ts +27 -0
- package/dist/core/tools/grep.d.ts.map +1 -0
- package/dist/core/tools/grep.js +332 -0
- package/dist/core/tools/grep.js.map +1 -0
- package/dist/core/tools/hash-store.d.ts +12 -0
- package/dist/core/tools/hash-store.d.ts.map +1 -0
- package/dist/core/tools/hash-store.js +48 -0
- package/dist/core/tools/hash-store.js.map +1 -0
- package/dist/core/tools/hashline/apply.d.ts +40 -0
- package/dist/core/tools/hashline/apply.d.ts.map +1 -0
- package/dist/core/tools/hashline/apply.js +261 -0
- package/dist/core/tools/hashline/apply.js.map +1 -0
- package/dist/core/tools/hashline/hash.d.ts +56 -0
- package/dist/core/tools/hashline/hash.d.ts.map +1 -0
- package/dist/core/tools/hashline/hash.js +196 -0
- package/dist/core/tools/hashline/hash.js.map +1 -0
- package/dist/core/tools/hashline/parse.d.ts +8 -0
- package/dist/core/tools/hashline/parse.d.ts.map +1 -0
- package/dist/core/tools/hashline/parse.js +41 -0
- package/dist/core/tools/hashline/parse.js.map +1 -0
- package/dist/core/tools/hashline/resolve.d.ts +51 -0
- package/dist/core/tools/hashline/resolve.d.ts.map +1 -0
- package/dist/core/tools/hashline/resolve.js +187 -0
- package/dist/core/tools/hashline/resolve.js.map +1 -0
- package/dist/core/tools/hashline-utils.d.ts +6 -0
- package/dist/core/tools/hashline-utils.d.ts.map +1 -0
- package/dist/core/tools/hashline-utils.js +23 -0
- package/dist/core/tools/hashline-utils.js.map +1 -0
- package/dist/core/tools/index.d.ts +36 -0
- package/dist/core/tools/index.d.ts.map +1 -0
- package/dist/core/tools/index.js +141 -0
- package/dist/core/tools/index.js.map +1 -0
- package/dist/core/tools/ls.d.ts +21 -0
- package/dist/core/tools/ls.d.ts.map +1 -0
- package/dist/core/tools/ls.js +156 -0
- package/dist/core/tools/ls.js.map +1 -0
- package/dist/core/tools/operations.d.ts +201 -0
- package/dist/core/tools/operations.d.ts.map +1 -0
- package/dist/core/tools/operations.js +697 -0
- package/dist/core/tools/operations.js.map +1 -0
- package/dist/core/tools/output-accumulator.d.ts +54 -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 +9 -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 +32 -0
- package/dist/core/tools/read.d.ts.map +1 -0
- package/dist/core/tools/read.js +318 -0
- package/dist/core/tools/read.js.map +1 -0
- package/dist/core/tools/render-utils.d.ts +33 -0
- package/dist/core/tools/render-utils.d.ts.map +1 -0
- package/dist/core/tools/render-utils.js +61 -0
- package/dist/core/tools/render-utils.js.map +1 -0
- package/dist/core/tools/replace-diff.d.ts +16 -0
- package/dist/core/tools/replace-diff.d.ts.map +1 -0
- package/dist/core/tools/replace-diff.js +117 -0
- package/dist/core/tools/replace-diff.js.map +1 -0
- package/dist/core/tools/replace-normalize.d.ts +2 -0
- package/dist/core/tools/replace-normalize.d.ts.map +1 -0
- package/dist/core/tools/replace-normalize.js +73 -0
- package/dist/core/tools/replace-normalize.js.map +1 -0
- package/dist/core/tools/replace-render.d.ts +51 -0
- package/dist/core/tools/replace-render.d.ts.map +1 -0
- package/dist/core/tools/replace-render.js +162 -0
- package/dist/core/tools/replace-render.js.map +1 -0
- package/dist/core/tools/runtime.d.ts +2 -0
- package/dist/core/tools/runtime.d.ts.map +1 -0
- package/dist/core/tools/runtime.js +6 -0
- package/dist/core/tools/runtime.js.map +1 -0
- package/dist/core/tools/session-history.d.ts +55 -0
- package/dist/core/tools/session-history.d.ts.map +1 -0
- package/dist/core/tools/session-history.js +649 -0
- package/dist/core/tools/session-history.js.map +1 -0
- package/dist/core/tools/subagent-agents.d.ts +29 -0
- package/dist/core/tools/subagent-agents.d.ts.map +1 -0
- package/dist/core/tools/subagent-agents.js +223 -0
- package/dist/core/tools/subagent-agents.js.map +1 -0
- package/dist/core/tools/subagent.d.ts +185 -0
- package/dist/core/tools/subagent.d.ts.map +1 -0
- package/dist/core/tools/subagent.js +1309 -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 +39 -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/websearch.d.ts +33 -0
- package/dist/core/tools/websearch.d.ts.map +1 -0
- package/dist/core/tools/websearch.js +341 -0
- package/dist/core/tools/websearch.js.map +1 -0
- package/dist/core/tools/workspace-tool-host.d.ts +102 -0
- package/dist/core/tools/workspace-tool-host.d.ts.map +1 -0
- package/dist/core/tools/workspace-tool-host.js +348 -0
- package/dist/core/tools/workspace-tool-host.js.map +1 -0
- package/dist/core/tools/write.d.ts +16 -0
- package/dist/core/tools/write.d.ts.map +1 -0
- package/dist/core/tools/write.js +204 -0
- package/dist/core/tools/write.js.map +1 -0
- package/dist/core/workspace-identity.d.ts +7 -0
- package/dist/core/workspace-identity.d.ts.map +1 -0
- package/dist/core/workspace-identity.js +2 -0
- package/dist/core/workspace-identity.js.map +1 -0
- package/dist/daemon/command.d.ts +6 -0
- package/dist/daemon/command.d.ts.map +1 -0
- package/dist/daemon/command.js +58 -0
- package/dist/daemon/command.js.map +1 -0
- package/dist/daemon/config.d.ts +43 -0
- package/dist/daemon/config.d.ts.map +1 -0
- package/dist/daemon/config.js +304 -0
- package/dist/daemon/config.js.map +1 -0
- package/dist/daemon/help.d.ts +2 -0
- package/dist/daemon/help.d.ts.map +1 -0
- package/dist/daemon/help.js +42 -0
- package/dist/daemon/help.js.map +1 -0
- package/dist/daemon/lsp-config.d.ts +4 -0
- package/dist/daemon/lsp-config.d.ts.map +1 -0
- package/dist/daemon/lsp-config.js +155 -0
- package/dist/daemon/lsp-config.js.map +1 -0
- package/dist/daemon/security.d.ts +19 -0
- package/dist/daemon/security.d.ts.map +1 -0
- package/dist/daemon/security.js +175 -0
- package/dist/daemon/security.js.map +1 -0
- package/dist/daemon/server.d.ts +20 -0
- package/dist/daemon/server.d.ts.map +1 -0
- package/dist/daemon/server.js +400 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/daemon/workspace-runtime.d.ts +46 -0
- package/dist/daemon/workspace-runtime.d.ts.map +1 -0
- package/dist/daemon/workspace-runtime.js +673 -0
- package/dist/daemon/workspace-runtime.js.map +1 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +39 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +763 -0
- package/dist/main.js.map +1 -0
- package/dist/migrations.d.ts +35 -0
- package/dist/migrations.d.ts.map +1 -0
- package/dist/migrations.js +412 -0
- package/dist/migrations.js.map +1 -0
- package/dist/modes/interactive/components/assistant-message.d.ts +29 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +149 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -0
- package/dist/modes/interactive/components/bash-execution.d.ts +36 -0
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/bash-execution.js +173 -0
- package/dist/modes/interactive/components/bash-execution.js.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts +18 -0
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -0
- package/dist/modes/interactive/components/bordered-loader.js +54 -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 +74 -0
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/config-selector.js +514 -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 +25 -0
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/custom-editor.js +85 -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 +80 -0
- package/dist/modes/interactive/components/custom-message.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 +118 -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 +22 -0
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-editor.js +128 -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 +26 -0
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/extension-selector.js +83 -0
- package/dist/modes/interactive/components/extension-selector.js.map +1 -0
- package/dist/modes/interactive/components/footer.d.ts +36 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -0
- package/dist/modes/interactive/components/footer.js +227 -0
- package/dist/modes/interactive/components/footer.js.map +1 -0
- package/dist/modes/interactive/components/hook-execution.d.ts +19 -0
- package/dist/modes/interactive/components/hook-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/hook-execution.js +184 -0
- package/dist/modes/interactive/components/hook-execution.js.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts +13 -0
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -0
- package/dist/modes/interactive/components/keybinding-hints.js +36 -0
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -0
- package/dist/modes/interactive/components/login-dialog.d.ts +55 -0
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -0
- package/dist/modes/interactive/components/login-dialog.js +176 -0
- package/dist/modes/interactive/components/login-dialog.js.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts +4 -0
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -0
- package/dist/modes/interactive/components/markdown-transform.js +19 -0
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -0
- package/dist/modes/interactive/components/mermaid.d.ts +14 -0
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -0
- package/dist/modes/interactive/components/mermaid.js +228 -0
- package/dist/modes/interactive/components/mermaid.js.map +1 -0
- package/dist/modes/interactive/components/model-selector.d.ts +52 -0
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/model-selector.js +296 -0
- package/dist/modes/interactive/components/model-selector.js.map +1 -0
- package/dist/modes/interactive/components/oauth-selector.d.ts +33 -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/scoped-models-selector.d.ts +50 -0
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/scoped-models-selector.js +300 -0
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts +22 -0
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector-search.js +144 -0
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -0
- package/dist/modes/interactive/components/session-selector.d.ts +108 -0
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/session-selector.js +835 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -0
- package/dist/modes/interactive/components/settings-selector.d.ts +81 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/settings-selector.js +455 -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/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 +51 -0
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -0
- package/dist/modes/interactive/components/tool-execution.d.ts +67 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-execution.js +306 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -0
- package/dist/modes/interactive/components/tree-selector.d.ts +127 -0
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -0
- package/dist/modes/interactive/components/tree-selector.js +1098 -0
- package/dist/modes/interactive/components/tree-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 +16 -0
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/user-message.js +49 -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/interactive-mode.d.ts +557 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +5859 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -0
- package/dist/modes/interactive/theme/dark.json +86 -0
- package/dist/modes/interactive/theme/light.json +85 -0
- package/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/dist/modes/interactive/theme/theme.d.ts +106 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +1030 -0
- package/dist/modes/interactive/theme/theme.js.map +1 -0
- package/dist/modes/json-event.d.ts +28 -0
- package/dist/modes/json-event.d.ts.map +1 -0
- package/dist/modes/json-event.js +12 -0
- package/dist/modes/json-event.js.map +1 -0
- package/dist/modes/print-mode.d.ts +29 -0
- package/dist/modes/print-mode.d.ts.map +1 -0
- package/dist/modes/print-mode.js +142 -0
- package/dist/modes/print-mode.js.map +1 -0
- package/dist/modes/rpc/jsonl.d.ts +17 -0
- package/dist/modes/rpc/jsonl.d.ts.map +1 -0
- package/dist/modes/rpc/jsonl.js +49 -0
- package/dist/modes/rpc/jsonl.js.map +1 -0
- package/dist/modes/rpc/rpc-client.d.ts +321 -0
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-client.js +755 -0
- package/dist/modes/rpc/rpc-client.js.map +1 -0
- package/dist/modes/rpc/rpc-mode.d.ts +20 -0
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-mode.js +963 -0
- package/dist/modes/rpc/rpc-mode.js.map +1 -0
- package/dist/modes/rpc/rpc-types.d.ts +652 -0
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -0
- package/dist/modes/rpc/rpc-types.js +8 -0
- package/dist/modes/rpc/rpc-types.js.map +1 -0
- package/dist/package-manager-cli.d.ts +4 -0
- package/dist/package-manager-cli.d.ts.map +1 -0
- package/dist/package-manager-cli.js +488 -0
- package/dist/package-manager-cli.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 +25 -0
- package/dist/utils/ansi.js.map +1 -0
- package/dist/utils/changelog.d.ts +23 -0
- package/dist/utils/changelog.d.ts.map +1 -0
- package/dist/utils/changelog.js +74 -0
- package/dist/utils/changelog.js.map +1 -0
- package/dist/utils/child-process.d.ts +15 -0
- package/dist/utils/child-process.d.ts.map +1 -0
- package/dist/utils/child-process.js +88 -0
- package/dist/utils/child-process.js.map +1 -0
- package/dist/utils/clipboard-image.d.ts +13 -0
- package/dist/utils/clipboard-image.d.ts.map +1 -0
- package/dist/utils/clipboard-image.js +248 -0
- package/dist/utils/clipboard-image.js.map +1 -0
- package/dist/utils/clipboard-native.d.ts +11 -0
- package/dist/utils/clipboard-native.d.ts.map +1 -0
- package/dist/utils/clipboard-native.js +20 -0
- package/dist/utils/clipboard-native.js.map +1 -0
- package/dist/utils/clipboard.d.ts +4 -0
- package/dist/utils/clipboard.d.ts.map +1 -0
- package/dist/utils/clipboard.js +171 -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/directory-completions.d.ts +5 -0
- package/dist/utils/directory-completions.d.ts.map +1 -0
- package/dist/utils/directory-completions.js +64 -0
- package/dist/utils/directory-completions.js.map +1 -0
- package/dist/utils/exif-orientation.d.ts +6 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +166 -0
- package/dist/utils/exif-orientation.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 +27 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +237 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/grip-user-agent.d.ts +2 -0
- package/dist/utils/grip-user-agent.d.ts.map +1 -0
- package/dist/utils/grip-user-agent.js +5 -0
- package/dist/utils/grip-user-agent.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/image-convert.d.ts +12 -0
- package/dist/utils/image-convert.d.ts.map +1 -0
- package/dist/utils/image-convert.js +43 -0
- package/dist/utils/image-convert.js.map +1 -0
- package/dist/utils/image-process.d.ts +18 -0
- package/dist/utils/image-process.d.ts.map +1 -0
- package/dist/utils/image-process.js +83 -0
- package/dist/utils/image-process.js.map +1 -0
- package/dist/utils/image-resize-core.d.ts +30 -0
- package/dist/utils/image-resize-core.d.ts.map +1 -0
- package/dist/utils/image-resize-core.js +133 -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 +19 -0
- package/dist/utils/image-resize.d.ts.map +1 -0
- package/dist/utils/image-resize.js +81 -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 +110 -0
- package/dist/utils/mime.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 +87 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/photon.d.ts +22 -0
- package/dist/utils/photon.d.ts.map +1 -0
- package/dist/utils/photon.js +125 -0
- package/dist/utils/photon.js.map +1 -0
- package/dist/utils/shell.d.ts +28 -0
- package/dist/utils/shell.d.ts.map +1 -0
- package/dist/utils/shell.js +188 -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 +12 -0
- package/dist/utils/syntax-highlight.d.ts.map +1 -0
- package/dist/utils/syntax-highlight.js +125 -0
- package/dist/utils/syntax-highlight.js.map +1 -0
- package/dist/utils/tools-manager.d.ts +5 -0
- package/dist/utils/tools-manager.d.ts.map +1 -0
- package/dist/utils/tools-manager.js +329 -0
- package/dist/utils/tools-manager.js.map +1 -0
- package/dist/utils/version-check.d.ts +14 -0
- package/dist/utils/version-check.d.ts.map +1 -0
- package/dist/utils/version-check.js +91 -0
- package/dist/utils/version-check.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 +408 -0
- package/docs/custom-provider.md +714 -0
- package/docs/daemon-architecture.md +399 -0
- package/docs/daemon.md +110 -0
- package/docs/development.md +72 -0
- package/docs/docs.json +164 -0
- package/docs/extensions.md +2745 -0
- package/docs/hooks.md +85 -0
- package/docs/images/doom-extension.png +0 -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 +81 -0
- package/docs/json.md +89 -0
- package/docs/keybindings.md +230 -0
- package/docs/lsp.md +499 -0
- package/docs/migrating-to-grip.md +18 -0
- package/docs/models.md +496 -0
- package/docs/packages.md +228 -0
- package/docs/prompt-templates.md +88 -0
- package/docs/providers.md +251 -0
- package/docs/quickstart.md +167 -0
- package/docs/rpc.md +1492 -0
- package/docs/rules.md +117 -0
- package/docs/sandbox.md +181 -0
- package/docs/sdk.md +360 -0
- package/docs/session-format.md +414 -0
- package/docs/sessions.md +137 -0
- package/docs/settings.md +371 -0
- package/docs/shell-aliases.md +13 -0
- package/docs/skills.md +246 -0
- package/docs/terminal-setup.md +112 -0
- package/docs/termux.md +129 -0
- package/docs/themes.md +295 -0
- package/docs/tmux.md +61 -0
- package/docs/tui.md +918 -0
- package/docs/usage.md +304 -0
- package/docs/windows.md +17 -0
- package/examples/README.md +31 -0
- package/examples/daemon-docker/Dockerfile +43 -0
- package/examples/daemon-docker/README.md +45 -0
- package/examples/extensions/README.md +208 -0
- package/examples/extensions/auto-commit-on-exit.ts +46 -0
- package/examples/extensions/bash-spawn-hook.ts +30 -0
- package/examples/extensions/bookmark.ts +50 -0
- package/examples/extensions/border-status-editor.ts +145 -0
- package/examples/extensions/built-in-tool-renderer.ts +259 -0
- package/examples/extensions/claude-rules.ts +86 -0
- package/examples/extensions/commands.ts +82 -0
- package/examples/extensions/confirm-destructive.ts +59 -0
- package/examples/extensions/custom-compaction.ts +131 -0
- package/examples/extensions/custom-footer.ts +79 -0
- package/examples/extensions/custom-header.ts +73 -0
- package/examples/extensions/custom-provider-anthropic/index.ts +707 -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 +402 -0
- package/examples/extensions/custom-provider-gitlab-duo/package.json +16 -0
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +104 -0
- package/examples/extensions/dirty-repo-guard.ts +59 -0
- package/examples/extensions/doom-overlay/README.md +46 -0
- package/examples/extensions/doom-overlay/doom/build/doom.js +21 -0
- package/examples/extensions/doom-overlay/doom/build/doom.wasm +0 -0
- package/examples/extensions/doom-overlay/doom/build.sh +152 -0
- package/examples/extensions/doom-overlay/doom/doomgeneric_pi.c +72 -0
- package/examples/extensions/doom-overlay/doom-component.ts +133 -0
- package/examples/extensions/doom-overlay/doom-engine.ts +173 -0
- package/examples/extensions/doom-overlay/doom-keys.ts +104 -0
- package/examples/extensions/doom-overlay/index.ts +74 -0
- package/examples/extensions/doom-overlay/wad-finder.ts +51 -0
- package/examples/extensions/dynamic-resources/RULES.md +8 -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 +16 -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 +125 -0
- package/examples/extensions/github-issue-autocomplete.ts +191 -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 +104 -0
- package/examples/extensions/input-transform.ts +43 -0
- package/examples/extensions/interactive-shell.ts +194 -0
- package/examples/extensions/mac-system-theme.ts +47 -0
- package/examples/extensions/message-renderer.ts +59 -0
- package/examples/extensions/minimal-mode.ts +428 -0
- package/examples/extensions/modal-editor.ts +86 -0
- package/examples/extensions/model-status.ts +31 -0
- package/examples/extensions/notify.ts +55 -0
- package/examples/extensions/overlay-qa-tests.ts +1374 -0
- package/examples/extensions/overlay-test.ts +171 -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 +346 -0
- package/examples/extensions/plan-mode/utils.ts +172 -0
- package/examples/extensions/preset.ts +426 -0
- package/examples/extensions/prompt-customizer.ts +97 -0
- package/examples/extensions/protected-paths.ts +29 -0
- package/examples/extensions/provider-payload.ts +18 -0
- package/examples/extensions/qna.ts +125 -0
- package/examples/extensions/question.ts +294 -0
- package/examples/extensions/questionnaire.ts +459 -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 +320 -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 +381 -0
- package/examples/extensions/space-invaders.ts +597 -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 +1083 -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 +186 -0
- package/examples/extensions/system-prompt-header.ts +17 -0
- package/examples/extensions/tic-tac-toe.ts +1091 -0
- package/examples/extensions/timed-confirm.ts +70 -0
- package/examples/extensions/titlebar-spinner.ts +58 -0
- package/examples/extensions/todo.ts +306 -0
- package/examples/extensions/tool-override.ts +144 -0
- package/examples/extensions/tools.ts +141 -0
- package/examples/extensions/trigger-compact.ts +50 -0
- package/examples/extensions/truncated-tool.ts +200 -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-session-server/README.md +71 -0
- package/examples/remote-session-server/server.ts +353 -0
- package/examples/rpc-extension-ui.ts +642 -0
- package/examples/sandbox-docker/Dockerfile +274 -0
- package/examples/sandbox-docker/README.md +88 -0
- package/examples/sdk/01-minimal.ts +27 -0
- package/examples/sdk/02-custom-model.ts +54 -0
- package/examples/sdk/03-custom-prompt.ts +76 -0
- package/examples/sdk/04-skills.ts +60 -0
- package/examples/sdk/05-tools.ts +55 -0
- package/examples/sdk/06-extensions.ts +94 -0
- package/examples/sdk/07-context-files.ts +47 -0
- package/examples/sdk/08-prompt-templates.ts +56 -0
- package/examples/sdk/09-api-keys-and-oauth.ts +50 -0
- package/examples/sdk/10-settings.ts +58 -0
- package/examples/sdk/11-sessions.ts +54 -0
- package/examples/sdk/12-full-control.ts +79 -0
- package/examples/sdk/13-session-runtime.ts +49 -0
- package/examples/sdk/README.md +94 -0
- package/npm-shrinkwrap.json +1878 -0
- package/package.json +102 -5
|
@@ -0,0 +1,809 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { Type } from "typebox";
|
|
3
|
+
import { Compile } from "typebox/compile";
|
|
4
|
+
export const REMOTE_WORKSPACE_PROTOCOL_VERSIONS = [{ major: 1, minMinor: 0, maxMinor: 0 }];
|
|
5
|
+
export const REMOTE_WORKSPACE_CAPABILITIES = [
|
|
6
|
+
"catalog_refresh",
|
|
7
|
+
"tool_updates",
|
|
8
|
+
"primitive_operations",
|
|
9
|
+
"lsp_status",
|
|
10
|
+
"file_transfer",
|
|
11
|
+
"artifacts",
|
|
12
|
+
];
|
|
13
|
+
export const REMOTE_WORKSPACE_METHODS = [
|
|
14
|
+
"catalog.get",
|
|
15
|
+
"tool.invoke",
|
|
16
|
+
"workspace.access",
|
|
17
|
+
"workspace.read",
|
|
18
|
+
"workspace.write",
|
|
19
|
+
"workspace.mkdir",
|
|
20
|
+
"workspace.stat",
|
|
21
|
+
"workspace.readdir",
|
|
22
|
+
"workspace.glob",
|
|
23
|
+
"workspace.grep",
|
|
24
|
+
"workspace.detect_image_mime",
|
|
25
|
+
"workspace.exec",
|
|
26
|
+
"lsp.status",
|
|
27
|
+
"resource.read",
|
|
28
|
+
"artifact.read",
|
|
29
|
+
"transfer.upload",
|
|
30
|
+
"transfer.download",
|
|
31
|
+
];
|
|
32
|
+
export const REMOTE_WORKSPACE_ERROR_CODES = [
|
|
33
|
+
"invalid_request",
|
|
34
|
+
"method_not_supported",
|
|
35
|
+
"incompatible_version",
|
|
36
|
+
"capability_mismatch",
|
|
37
|
+
"schema_mismatch",
|
|
38
|
+
"stale_generation",
|
|
39
|
+
"not_available",
|
|
40
|
+
"limit_exceeded",
|
|
41
|
+
"deadline_exceeded",
|
|
42
|
+
"cancelled",
|
|
43
|
+
"generation_retired",
|
|
44
|
+
"connection_draining",
|
|
45
|
+
"result_too_large",
|
|
46
|
+
"internal_error",
|
|
47
|
+
];
|
|
48
|
+
export const DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS = {
|
|
49
|
+
maxMessageBytes: 2 * 1024 * 1024,
|
|
50
|
+
maxStringBytes: 1536 * 1024,
|
|
51
|
+
maxDepth: 32,
|
|
52
|
+
maxObjectKeys: 4096,
|
|
53
|
+
maxArrayLength: 4096,
|
|
54
|
+
maxNodes: 16_384,
|
|
55
|
+
maxRequestMs: 10 * 60 * 1000,
|
|
56
|
+
maxTransferChunkBytes: 64 * 1024,
|
|
57
|
+
maxPendingTransferBytes: 256 * 1024,
|
|
58
|
+
maxPendingInboundBytes: 4 * 1024 * 1024,
|
|
59
|
+
maxPendingInboundMessages: 64,
|
|
60
|
+
maxPendingOutboundBytes: 4 * 1024 * 1024,
|
|
61
|
+
maxPendingOutboundMessages: 128,
|
|
62
|
+
maxTransferBytes: 100 * 1024 * 1024,
|
|
63
|
+
maxTransferChunks: 16_384,
|
|
64
|
+
maxActiveRequests: 64,
|
|
65
|
+
maxActiveTransfers: 8,
|
|
66
|
+
maxCancellationMs: 100,
|
|
67
|
+
maxTransportSendMs: 10_000,
|
|
68
|
+
};
|
|
69
|
+
const closedObject = { additionalProperties: false };
|
|
70
|
+
const safeIntegerOptions = { minimum: 0, maximum: Number.MAX_SAFE_INTEGER };
|
|
71
|
+
const RequestIdSchema = Type.String({ minLength: 1, maxLength: 128, pattern: "^[A-Za-z0-9._:-]+$" });
|
|
72
|
+
const HashSchema = Type.String({ pattern: "^[0-9a-f]{64}$" });
|
|
73
|
+
const CapabilitySchema = Type.String({ minLength: 1, maxLength: 128, pattern: "^[a-z][a-z0-9_.-]*$" });
|
|
74
|
+
const RemoteWorkspaceMethodSchema = Type.Union([
|
|
75
|
+
Type.Literal("catalog.get"),
|
|
76
|
+
Type.Literal("tool.invoke"),
|
|
77
|
+
Type.Literal("workspace.access"),
|
|
78
|
+
Type.Literal("workspace.read"),
|
|
79
|
+
Type.Literal("workspace.write"),
|
|
80
|
+
Type.Literal("workspace.mkdir"),
|
|
81
|
+
Type.Literal("workspace.stat"),
|
|
82
|
+
Type.Literal("workspace.readdir"),
|
|
83
|
+
Type.Literal("workspace.glob"),
|
|
84
|
+
Type.Literal("workspace.grep"),
|
|
85
|
+
Type.Literal("workspace.detect_image_mime"),
|
|
86
|
+
Type.Literal("workspace.exec"),
|
|
87
|
+
Type.Literal("lsp.status"),
|
|
88
|
+
Type.Literal("resource.read"),
|
|
89
|
+
Type.Literal("artifact.read"),
|
|
90
|
+
Type.Literal("transfer.upload"),
|
|
91
|
+
Type.Literal("transfer.download"),
|
|
92
|
+
]);
|
|
93
|
+
export const RemoteWorkspaceVersionRangeSchema = Type.Object({
|
|
94
|
+
major: Type.Integer({ minimum: 1, maximum: 65535 }),
|
|
95
|
+
minMinor: Type.Integer({ minimum: 0, maximum: 65535 }),
|
|
96
|
+
maxMinor: Type.Integer({ minimum: 0, maximum: 65535 }),
|
|
97
|
+
}, closedObject);
|
|
98
|
+
export const RemoteWorkspaceVersionSchema = Type.Object({
|
|
99
|
+
major: Type.Integer({ minimum: 1, maximum: 65535 }),
|
|
100
|
+
minor: Type.Integer({ minimum: 0, maximum: 65535 }),
|
|
101
|
+
}, closedObject);
|
|
102
|
+
export const RemoteWorkspaceLimitsSchema = Type.Object({
|
|
103
|
+
maxMessageBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),
|
|
104
|
+
maxStringBytes: Type.Integer({ minimum: 1, maximum: 64 * 1024 * 1024 }),
|
|
105
|
+
maxDepth: Type.Integer({ minimum: 1, maximum: 256 }),
|
|
106
|
+
maxObjectKeys: Type.Integer({ minimum: 1, maximum: 1_000_000 }),
|
|
107
|
+
maxArrayLength: Type.Integer({ minimum: 1, maximum: 1_000_000 }),
|
|
108
|
+
maxNodes: Type.Integer({ minimum: 1, maximum: 2_000_000 }),
|
|
109
|
+
maxRequestMs: Type.Integer({ minimum: 1, maximum: 24 * 60 * 60 * 1000 }),
|
|
110
|
+
maxTransferChunkBytes: Type.Integer({ minimum: 1024, maximum: 1024 * 1024 }),
|
|
111
|
+
maxPendingTransferBytes: Type.Integer({ minimum: 1024, maximum: 16 * 1024 * 1024 }),
|
|
112
|
+
maxPendingInboundBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),
|
|
113
|
+
maxPendingInboundMessages: Type.Integer({ minimum: 1, maximum: 100_000 }),
|
|
114
|
+
maxPendingOutboundBytes: Type.Integer({ minimum: 1024, maximum: 64 * 1024 * 1024 }),
|
|
115
|
+
maxPendingOutboundMessages: Type.Integer({ minimum: 1, maximum: 100_000 }),
|
|
116
|
+
maxTransferBytes: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),
|
|
117
|
+
maxTransferChunks: Type.Integer({ minimum: 1, maximum: 1_000_000 }),
|
|
118
|
+
maxActiveRequests: Type.Integer({ minimum: 1, maximum: 10_000_000 }),
|
|
119
|
+
maxActiveTransfers: Type.Integer({ minimum: 1, maximum: 10_000 }),
|
|
120
|
+
maxCancellationMs: Type.Integer({ minimum: 1, maximum: 60_000 }),
|
|
121
|
+
maxTransportSendMs: Type.Integer({ minimum: 1, maximum: 5 * 60_000 }),
|
|
122
|
+
}, closedObject);
|
|
123
|
+
export const RemoteWorkspaceIdentitySchema = Type.Object({
|
|
124
|
+
id: Type.String({ minLength: 16, maxLength: 128, pattern: "^[A-Za-z0-9_-]+$" }),
|
|
125
|
+
root: Type.String({ minLength: 1, maxLength: 32_768 }),
|
|
126
|
+
pathFlavor: Type.Union([Type.Literal("posix"), Type.Literal("windows")]),
|
|
127
|
+
}, closedObject);
|
|
128
|
+
export const RemoteWorkspaceToolCatalogEntrySchema = Type.Object({
|
|
129
|
+
name: Type.String({ minLength: 1, maxLength: 128, pattern: "^[A-Za-z][A-Za-z0-9_.-]*$" }),
|
|
130
|
+
executionMode: Type.Union([
|
|
131
|
+
Type.Literal("read"),
|
|
132
|
+
Type.Literal("mutation"),
|
|
133
|
+
Type.Literal("process"),
|
|
134
|
+
Type.Literal("service"),
|
|
135
|
+
]),
|
|
136
|
+
parameterSchema: Type.Record(Type.String({ maxLength: 256 }), Type.Unknown()),
|
|
137
|
+
schemaHash: HashSchema,
|
|
138
|
+
featureFlags: Type.Array(CapabilitySchema, { maxItems: 256 }),
|
|
139
|
+
}, closedObject);
|
|
140
|
+
export const RemoteWorkspaceCatalogSchema = Type.Object({
|
|
141
|
+
generation: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),
|
|
142
|
+
tools: Type.Array(RemoteWorkspaceToolCatalogEntrySchema, { maxItems: 1024 }),
|
|
143
|
+
operations: Type.Array(RemoteWorkspaceMethodSchema, { maxItems: 256 }),
|
|
144
|
+
}, closedObject);
|
|
145
|
+
export const RemoteWorkspaceHandshakeSchema = Type.Object({
|
|
146
|
+
type: Type.Literal("handshake"),
|
|
147
|
+
id: RequestIdSchema,
|
|
148
|
+
versions: Type.Array(RemoteWorkspaceVersionRangeSchema, { minItems: 1, maxItems: 16 }),
|
|
149
|
+
requiredCapabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),
|
|
150
|
+
optionalCapabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),
|
|
151
|
+
receiveLimits: RemoteWorkspaceLimitsSchema,
|
|
152
|
+
}, closedObject);
|
|
153
|
+
export const RemoteWorkspaceHandshakeAckSchema = Type.Object({
|
|
154
|
+
type: Type.Literal("handshake_ack"),
|
|
155
|
+
id: RequestIdSchema,
|
|
156
|
+
version: RemoteWorkspaceVersionSchema,
|
|
157
|
+
capabilities: Type.Array(CapabilitySchema, { maxItems: 256 }),
|
|
158
|
+
workspace: RemoteWorkspaceIdentitySchema,
|
|
159
|
+
limits: RemoteWorkspaceLimitsSchema,
|
|
160
|
+
catalog: RemoteWorkspaceCatalogSchema,
|
|
161
|
+
catalogHash: HashSchema,
|
|
162
|
+
backendMetadata: Type.Object({
|
|
163
|
+
kind: Type.Literal("remote-workspace"),
|
|
164
|
+
label: Type.Optional(Type.String({ minLength: 1, maxLength: 256 })),
|
|
165
|
+
}, closedObject),
|
|
166
|
+
}, closedObject);
|
|
167
|
+
export const RemoteWorkspaceRequestSchema = Type.Object({
|
|
168
|
+
type: Type.Literal("request"),
|
|
169
|
+
id: RequestIdSchema,
|
|
170
|
+
method: Type.String({ minLength: 1, maxLength: 128 }),
|
|
171
|
+
timeoutMs: Type.Integer({ minimum: 1, maximum: 24 * 60 * 60 * 1000 }),
|
|
172
|
+
params: Type.Unknown(),
|
|
173
|
+
}, closedObject);
|
|
174
|
+
export const RemoteWorkspaceCancelSchema = Type.Object({
|
|
175
|
+
type: Type.Literal("cancel"),
|
|
176
|
+
id: RequestIdSchema,
|
|
177
|
+
reason: Type.Optional(Type.String({ maxLength: 256 })),
|
|
178
|
+
}, closedObject);
|
|
179
|
+
export const RemoteWorkspaceTransferChunkSchema = Type.Object({
|
|
180
|
+
type: Type.Literal("transfer_chunk"),
|
|
181
|
+
id: RequestIdSchema,
|
|
182
|
+
sequence: Type.Integer(safeIntegerOptions),
|
|
183
|
+
dataBase64: Type.String({ minLength: 4 }),
|
|
184
|
+
}, closedObject);
|
|
185
|
+
export const RemoteWorkspaceTransferFinishSchema = Type.Object({
|
|
186
|
+
type: Type.Literal("transfer_finish"),
|
|
187
|
+
id: RequestIdSchema,
|
|
188
|
+
length: Type.Integer(safeIntegerOptions),
|
|
189
|
+
sha256: HashSchema,
|
|
190
|
+
}, closedObject);
|
|
191
|
+
export const RemoteWorkspaceResultSchema = Type.Object({
|
|
192
|
+
type: Type.Literal("result"),
|
|
193
|
+
id: RequestIdSchema,
|
|
194
|
+
result: Type.Unknown(),
|
|
195
|
+
}, closedObject);
|
|
196
|
+
export const RemoteWorkspaceProtocolErrorSchema = Type.Object({
|
|
197
|
+
code: Type.Union([
|
|
198
|
+
Type.Literal("invalid_request"),
|
|
199
|
+
Type.Literal("method_not_supported"),
|
|
200
|
+
Type.Literal("incompatible_version"),
|
|
201
|
+
Type.Literal("capability_mismatch"),
|
|
202
|
+
Type.Literal("schema_mismatch"),
|
|
203
|
+
Type.Literal("stale_generation"),
|
|
204
|
+
Type.Literal("not_available"),
|
|
205
|
+
Type.Literal("limit_exceeded"),
|
|
206
|
+
Type.Literal("deadline_exceeded"),
|
|
207
|
+
Type.Literal("cancelled"),
|
|
208
|
+
Type.Literal("generation_retired"),
|
|
209
|
+
Type.Literal("connection_draining"),
|
|
210
|
+
Type.Literal("result_too_large"),
|
|
211
|
+
Type.Literal("internal_error"),
|
|
212
|
+
]),
|
|
213
|
+
message: Type.String({ minLength: 1, maxLength: 4096 }),
|
|
214
|
+
executionState: Type.Union([
|
|
215
|
+
Type.Literal("not_started"),
|
|
216
|
+
Type.Literal("completed"),
|
|
217
|
+
Type.Literal("indeterminate"),
|
|
218
|
+
]),
|
|
219
|
+
retryable: Type.Boolean(),
|
|
220
|
+
details: Type.Optional(Type.Unknown()),
|
|
221
|
+
}, closedObject);
|
|
222
|
+
export const RemoteWorkspaceErrorMessageSchema = Type.Object({
|
|
223
|
+
type: Type.Literal("error"),
|
|
224
|
+
id: RequestIdSchema,
|
|
225
|
+
error: RemoteWorkspaceProtocolErrorSchema,
|
|
226
|
+
}, closedObject);
|
|
227
|
+
export const RemoteWorkspaceUpdateSchema = Type.Object({
|
|
228
|
+
type: Type.Literal("update"),
|
|
229
|
+
id: RequestIdSchema,
|
|
230
|
+
sequence: Type.Integer(safeIntegerOptions),
|
|
231
|
+
update: Type.Unknown(),
|
|
232
|
+
}, closedObject);
|
|
233
|
+
export const RemoteWorkspaceTransferStartSchema = Type.Object({
|
|
234
|
+
type: Type.Literal("transfer_start"),
|
|
235
|
+
id: RequestIdSchema,
|
|
236
|
+
length: Type.Integer(safeIntegerOptions),
|
|
237
|
+
sha256: HashSchema,
|
|
238
|
+
}, closedObject);
|
|
239
|
+
export const RemoteWorkspaceCatalogChangedSchema = Type.Object({
|
|
240
|
+
type: Type.Literal("catalog_changed"),
|
|
241
|
+
generation: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),
|
|
242
|
+
catalogHash: HashSchema,
|
|
243
|
+
}, closedObject);
|
|
244
|
+
export const RemoteWorkspaceClientMessageSchema = Type.Union([
|
|
245
|
+
RemoteWorkspaceHandshakeSchema,
|
|
246
|
+
RemoteWorkspaceRequestSchema,
|
|
247
|
+
RemoteWorkspaceCancelSchema,
|
|
248
|
+
RemoteWorkspaceTransferChunkSchema,
|
|
249
|
+
RemoteWorkspaceTransferFinishSchema,
|
|
250
|
+
]);
|
|
251
|
+
export const RemoteWorkspaceServerMessageSchema = Type.Union([
|
|
252
|
+
RemoteWorkspaceHandshakeAckSchema,
|
|
253
|
+
RemoteWorkspaceResultSchema,
|
|
254
|
+
RemoteWorkspaceErrorMessageSchema,
|
|
255
|
+
RemoteWorkspaceUpdateSchema,
|
|
256
|
+
RemoteWorkspaceTransferStartSchema,
|
|
257
|
+
RemoteWorkspaceTransferChunkSchema,
|
|
258
|
+
RemoteWorkspaceCatalogChangedSchema,
|
|
259
|
+
]);
|
|
260
|
+
const EmptyParamsSchema = Type.Object({}, closedObject);
|
|
261
|
+
const PathParamsSchema = Type.Object({ path: Type.String({ minLength: 1, maxLength: 32_768 }) }, closedObject);
|
|
262
|
+
const CatalogGetParamsSchema = EmptyParamsSchema;
|
|
263
|
+
const SessionEnvironmentSchema = Type.Object({
|
|
264
|
+
GRIP_SESSION_ID: Type.Optional(Type.String({ maxLength: 32_768 })),
|
|
265
|
+
GRIP_SESSION_FILE: Type.Optional(Type.String({ maxLength: 32_768 })),
|
|
266
|
+
GRIP_PROVIDER: Type.Optional(Type.String({ maxLength: 32_768 })),
|
|
267
|
+
GRIP_MODEL: Type.Optional(Type.String({ maxLength: 32_768 })),
|
|
268
|
+
GRIP_REASONING_LEVEL: Type.Optional(Type.String({ maxLength: 32_768 })),
|
|
269
|
+
}, closedObject);
|
|
270
|
+
const ToolInvokeParamsSchema = Type.Object({
|
|
271
|
+
generation: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),
|
|
272
|
+
catalogHash: HashSchema,
|
|
273
|
+
toolName: Type.String({ minLength: 1, maxLength: 128 }),
|
|
274
|
+
schemaHash: HashSchema,
|
|
275
|
+
argumentsPrepared: Type.Literal(true),
|
|
276
|
+
arguments: Type.Unknown(),
|
|
277
|
+
executionOptions: Type.Object({
|
|
278
|
+
imageAutoResize: Type.Optional(Type.Boolean()),
|
|
279
|
+
shellCommandPrefix: Type.Optional(Type.String({ maxLength: 32_768 })),
|
|
280
|
+
sessionEnvironment: Type.Optional(SessionEnvironmentSchema),
|
|
281
|
+
}, closedObject),
|
|
282
|
+
}, closedObject);
|
|
283
|
+
const AccessParamsSchema = Type.Object({
|
|
284
|
+
path: Type.String({ minLength: 1, maxLength: 32_768 }),
|
|
285
|
+
mode: Type.Optional(Type.Union([Type.Literal("exists"), Type.Literal("read"), Type.Literal("write"), Type.Literal("readwrite")])),
|
|
286
|
+
}, closedObject);
|
|
287
|
+
const WriteParamsSchema = Type.Object({
|
|
288
|
+
path: Type.String({ minLength: 1, maxLength: 32_768 }),
|
|
289
|
+
contentBase64: Type.String(),
|
|
290
|
+
}, closedObject);
|
|
291
|
+
const MkdirParamsSchema = Type.Object({
|
|
292
|
+
path: Type.String({ minLength: 1, maxLength: 32_768 }),
|
|
293
|
+
recursive: Type.Boolean(),
|
|
294
|
+
}, closedObject);
|
|
295
|
+
const GlobParamsSchema = Type.Object({
|
|
296
|
+
pattern: Type.String({ minLength: 1, maxLength: 32_768 }),
|
|
297
|
+
cwd: Type.String({ minLength: 1, maxLength: 32_768 }),
|
|
298
|
+
ignore: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 4096 }),
|
|
299
|
+
limit: Type.Integer({ minimum: 1, maximum: 1_000_000 }),
|
|
300
|
+
}, closedObject);
|
|
301
|
+
const GrepParamsSchema = Type.Object({
|
|
302
|
+
pattern: Type.String({ maxLength: 1024 * 1024 }),
|
|
303
|
+
path: Type.String({ minLength: 1, maxLength: 32_768 }),
|
|
304
|
+
glob: Type.Optional(Type.String({ maxLength: 32_768 })),
|
|
305
|
+
ignoreCase: Type.Optional(Type.Boolean()),
|
|
306
|
+
literal: Type.Optional(Type.Boolean()),
|
|
307
|
+
limit: Type.Integer({ minimum: 1, maximum: 1_000_000 }),
|
|
308
|
+
}, closedObject);
|
|
309
|
+
const ExecParamsSchema = Type.Object({
|
|
310
|
+
command: Type.String({ minLength: 1 }),
|
|
311
|
+
cwd: Type.String({ minLength: 1, maxLength: 32_768 }),
|
|
312
|
+
}, closedObject);
|
|
313
|
+
const TransferUploadParamsSchema = Type.Object({
|
|
314
|
+
path: Type.String({ minLength: 1, maxLength: 32_768 }),
|
|
315
|
+
length: Type.Integer(safeIntegerOptions),
|
|
316
|
+
sha256: HashSchema,
|
|
317
|
+
overwrite: Type.Boolean(),
|
|
318
|
+
}, closedObject);
|
|
319
|
+
const TransferDownloadParamsSchema = Type.Object({
|
|
320
|
+
path: Type.String({ minLength: 1, maxLength: 32_768 }),
|
|
321
|
+
}, closedObject);
|
|
322
|
+
const ToolContentSchema = Type.Union([
|
|
323
|
+
Type.Object({ type: Type.Literal("text"), text: Type.String() }, closedObject),
|
|
324
|
+
Type.Object({
|
|
325
|
+
type: Type.Literal("image"),
|
|
326
|
+
data: Type.String(),
|
|
327
|
+
mimeType: Type.String({ minLength: 1, maxLength: 256 }),
|
|
328
|
+
}, closedObject),
|
|
329
|
+
]);
|
|
330
|
+
const ToolResultSchema = Type.Object({
|
|
331
|
+
content: Type.Array(ToolContentSchema),
|
|
332
|
+
details: Type.Optional(Type.Unknown()),
|
|
333
|
+
terminate: Type.Optional(Type.Boolean()),
|
|
334
|
+
}, closedObject);
|
|
335
|
+
const EmptyResultSchema = EmptyParamsSchema;
|
|
336
|
+
const LspStatusServerSchema = Type.Object({
|
|
337
|
+
serverId: Type.String({ minLength: 1, maxLength: 256 }),
|
|
338
|
+
languageIds: Type.Array(Type.String({ maxLength: 256 }), { maxItems: 256 }),
|
|
339
|
+
transport: Type.String({ minLength: 1, maxLength: 128 }),
|
|
340
|
+
instanceKey: Type.Optional(Type.String({ maxLength: 4096 })),
|
|
341
|
+
workspaceRoot: Type.Optional(Type.String({ maxLength: 32_768 })),
|
|
342
|
+
endpoint: Type.Optional(Type.String({ maxLength: 4096 })),
|
|
343
|
+
rootUri: Type.Optional(Type.String({ maxLength: 32_768 })),
|
|
344
|
+
ownership: Type.Union([Type.Literal("managed"), Type.Literal("attached")]),
|
|
345
|
+
shutdownMode: Type.Union([Type.Literal("protocol"), Type.Literal("disconnect")]),
|
|
346
|
+
state: Type.Union([
|
|
347
|
+
Type.Literal("idle"),
|
|
348
|
+
Type.Literal("connecting"),
|
|
349
|
+
Type.Literal("initializing"),
|
|
350
|
+
Type.Literal("running"),
|
|
351
|
+
Type.Literal("closed"),
|
|
352
|
+
Type.Literal("failed"),
|
|
353
|
+
Type.Literal("disposed"),
|
|
354
|
+
]),
|
|
355
|
+
reconnectEligible: Type.Boolean(),
|
|
356
|
+
running: Type.Boolean(),
|
|
357
|
+
starting: Type.Boolean(),
|
|
358
|
+
diagnosticsCount: Type.Integer(safeIntegerOptions),
|
|
359
|
+
lastError: Type.Optional(Type.String()),
|
|
360
|
+
lastRequestError: Type.Optional(Type.String()),
|
|
361
|
+
stderr: Type.Optional(Type.String()),
|
|
362
|
+
synchronizationError: Type.Optional(Type.String()),
|
|
363
|
+
}, closedObject);
|
|
364
|
+
const LspStatusResultSchema = Type.Object({ enabled: Type.Boolean(), servers: Type.Array(LspStatusServerSchema, { maxItems: 1024 }) }, closedObject);
|
|
365
|
+
const ReadResultSchema = Type.Object({
|
|
366
|
+
contentBase64: Type.String(),
|
|
367
|
+
workspace: RemoteWorkspaceIdentitySchema,
|
|
368
|
+
}, closedObject);
|
|
369
|
+
const StatResultSchema = Type.Object({
|
|
370
|
+
kind: Type.Union([Type.Literal("file"), Type.Literal("directory"), Type.Literal("other")]),
|
|
371
|
+
workspace: RemoteWorkspaceIdentitySchema,
|
|
372
|
+
}, closedObject);
|
|
373
|
+
const ReaddirResultSchema = Type.Object({
|
|
374
|
+
entries: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 1_000_000 }),
|
|
375
|
+
workspace: RemoteWorkspaceIdentitySchema,
|
|
376
|
+
}, closedObject);
|
|
377
|
+
const GlobResultSchema = Type.Object({
|
|
378
|
+
matches: Type.Array(Type.String({ maxLength: 32_768 }), { maxItems: 1_000_000 }),
|
|
379
|
+
workspace: RemoteWorkspaceIdentitySchema,
|
|
380
|
+
}, closedObject);
|
|
381
|
+
const GrepResultSchema = Type.Object({
|
|
382
|
+
isDirectory: Type.Boolean(),
|
|
383
|
+
matches: Type.Array(Type.Object({
|
|
384
|
+
filePath: Type.String({ minLength: 1, maxLength: 32_768 }),
|
|
385
|
+
lineNumber: Type.Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }),
|
|
386
|
+
lineText: Type.Optional(Type.String()),
|
|
387
|
+
}, closedObject), { maxItems: 1_000_000 }),
|
|
388
|
+
workspace: RemoteWorkspaceIdentitySchema,
|
|
389
|
+
}, closedObject);
|
|
390
|
+
const MimeResultSchema = Type.Object({
|
|
391
|
+
mimeType: Type.Union([
|
|
392
|
+
Type.Literal("image/jpeg"),
|
|
393
|
+
Type.Literal("image/png"),
|
|
394
|
+
Type.Literal("image/gif"),
|
|
395
|
+
Type.Literal("image/webp"),
|
|
396
|
+
Type.Null(),
|
|
397
|
+
]),
|
|
398
|
+
workspace: RemoteWorkspaceIdentitySchema,
|
|
399
|
+
}, closedObject);
|
|
400
|
+
const ExecResultSchema = Type.Object({ exitCode: Type.Union([Type.Integer({ minimum: 0, maximum: 255 }), Type.Null()]) }, closedObject);
|
|
401
|
+
const TransferResultSchema = Type.Object({
|
|
402
|
+
length: Type.Integer(safeIntegerOptions),
|
|
403
|
+
sha256: HashSchema,
|
|
404
|
+
}, closedObject);
|
|
405
|
+
const parameterValidators = {
|
|
406
|
+
"catalog.get": Compile(CatalogGetParamsSchema),
|
|
407
|
+
"tool.invoke": Compile(ToolInvokeParamsSchema),
|
|
408
|
+
"workspace.access": Compile(AccessParamsSchema),
|
|
409
|
+
"workspace.read": Compile(PathParamsSchema),
|
|
410
|
+
"workspace.write": Compile(WriteParamsSchema),
|
|
411
|
+
"workspace.mkdir": Compile(MkdirParamsSchema),
|
|
412
|
+
"workspace.stat": Compile(PathParamsSchema),
|
|
413
|
+
"workspace.readdir": Compile(PathParamsSchema),
|
|
414
|
+
"workspace.glob": Compile(GlobParamsSchema),
|
|
415
|
+
"workspace.grep": Compile(GrepParamsSchema),
|
|
416
|
+
"workspace.detect_image_mime": Compile(PathParamsSchema),
|
|
417
|
+
"workspace.exec": Compile(ExecParamsSchema),
|
|
418
|
+
"lsp.status": Compile(EmptyParamsSchema),
|
|
419
|
+
"resource.read": Compile(PathParamsSchema),
|
|
420
|
+
"artifact.read": Compile(PathParamsSchema),
|
|
421
|
+
"transfer.upload": Compile(TransferUploadParamsSchema),
|
|
422
|
+
"transfer.download": Compile(TransferDownloadParamsSchema),
|
|
423
|
+
};
|
|
424
|
+
const resultValidators = {
|
|
425
|
+
"catalog.get": Compile(RemoteWorkspaceCatalogSchema),
|
|
426
|
+
"tool.invoke": Compile(ToolResultSchema),
|
|
427
|
+
"workspace.access": Compile(EmptyResultSchema),
|
|
428
|
+
"workspace.read": Compile(ReadResultSchema),
|
|
429
|
+
"workspace.write": Compile(EmptyResultSchema),
|
|
430
|
+
"workspace.mkdir": Compile(EmptyResultSchema),
|
|
431
|
+
"workspace.stat": Compile(StatResultSchema),
|
|
432
|
+
"workspace.readdir": Compile(ReaddirResultSchema),
|
|
433
|
+
"workspace.glob": Compile(GlobResultSchema),
|
|
434
|
+
"workspace.grep": Compile(GrepResultSchema),
|
|
435
|
+
"workspace.detect_image_mime": Compile(MimeResultSchema),
|
|
436
|
+
"workspace.exec": Compile(ExecResultSchema),
|
|
437
|
+
"lsp.status": Compile(LspStatusResultSchema),
|
|
438
|
+
"resource.read": Compile(ReadResultSchema),
|
|
439
|
+
"artifact.read": Compile(TransferResultSchema),
|
|
440
|
+
"transfer.upload": Compile(TransferResultSchema),
|
|
441
|
+
"transfer.download": Compile(TransferResultSchema),
|
|
442
|
+
};
|
|
443
|
+
const clientMessageValidator = Compile(RemoteWorkspaceClientMessageSchema);
|
|
444
|
+
const serverMessageValidator = Compile(RemoteWorkspaceServerMessageSchema);
|
|
445
|
+
const handshakeAckValidator = Compile(RemoteWorkspaceHandshakeAckSchema);
|
|
446
|
+
const limitsValidator = Compile(RemoteWorkspaceLimitsSchema);
|
|
447
|
+
export class RemoteWorkspaceValidationError extends Error {
|
|
448
|
+
constructor(message) {
|
|
449
|
+
super(message);
|
|
450
|
+
this.name = "RemoteWorkspaceValidationError";
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
function validationMessage(validator, value) {
|
|
454
|
+
const error = validator.Errors(value)[0];
|
|
455
|
+
if (!error)
|
|
456
|
+
return "value does not match the protocol schema";
|
|
457
|
+
return `${error.instancePath || "/"}: ${error.message}`;
|
|
458
|
+
}
|
|
459
|
+
function parseWithValidator(validator, value, label) {
|
|
460
|
+
if (!validator.Check(value)) {
|
|
461
|
+
throw new RemoteWorkspaceValidationError(`Invalid ${label}: ${validationMessage(validator, value)}`);
|
|
462
|
+
}
|
|
463
|
+
return value;
|
|
464
|
+
}
|
|
465
|
+
export function validateRemoteWorkspaceProtocolLimits(value) {
|
|
466
|
+
const limits = parseWithValidator(limitsValidator, value, "protocol limits");
|
|
467
|
+
if (limits.maxMessageBytes > limits.maxPendingInboundBytes) {
|
|
468
|
+
throw new RemoteWorkspaceValidationError("maxMessageBytes must not exceed maxPendingInboundBytes");
|
|
469
|
+
}
|
|
470
|
+
if (limits.maxMessageBytes > limits.maxPendingOutboundBytes) {
|
|
471
|
+
throw new RemoteWorkspaceValidationError("maxMessageBytes must not exceed maxPendingOutboundBytes");
|
|
472
|
+
}
|
|
473
|
+
if (limits.maxTransferChunkBytes > limits.maxPendingTransferBytes) {
|
|
474
|
+
throw new RemoteWorkspaceValidationError("maxTransferChunkBytes must not exceed maxPendingTransferBytes");
|
|
475
|
+
}
|
|
476
|
+
if (Math.ceil((limits.maxTransferChunkBytes * 4) / 3) + 512 > limits.maxMessageBytes) {
|
|
477
|
+
throw new RemoteWorkspaceValidationError("maxTransferChunkBytes must fit in one base64 protocol message");
|
|
478
|
+
}
|
|
479
|
+
return limits;
|
|
480
|
+
}
|
|
481
|
+
function validateRemoteWorkspaceNodeBudget(depth, state) {
|
|
482
|
+
state.nodes++;
|
|
483
|
+
if (state.nodes > state.limits.maxNodes)
|
|
484
|
+
throw new RemoteWorkspaceValidationError("Protocol value exceeds node limit");
|
|
485
|
+
if (depth > state.limits.maxDepth)
|
|
486
|
+
throw new RemoteWorkspaceValidationError("Protocol value exceeds depth limit");
|
|
487
|
+
}
|
|
488
|
+
function validateRemoteWorkspaceScalar(value, limits) {
|
|
489
|
+
if (value === null || typeof value === "boolean")
|
|
490
|
+
return true;
|
|
491
|
+
if (typeof value === "number") {
|
|
492
|
+
if (!Number.isFinite(value))
|
|
493
|
+
throw new RemoteWorkspaceValidationError("Protocol numbers must be finite");
|
|
494
|
+
return true;
|
|
495
|
+
}
|
|
496
|
+
if (typeof value !== "string")
|
|
497
|
+
return false;
|
|
498
|
+
if (Buffer.byteLength(value, "utf8") > limits.maxStringBytes) {
|
|
499
|
+
throw new RemoteWorkspaceValidationError("Protocol string exceeds byte limit");
|
|
500
|
+
}
|
|
501
|
+
return true;
|
|
502
|
+
}
|
|
503
|
+
function enqueueRemoteWorkspaceArray(value, depth, state) {
|
|
504
|
+
if (value.length > state.limits.maxArrayLength) {
|
|
505
|
+
throw new RemoteWorkspaceValidationError("Protocol array exceeds item limit");
|
|
506
|
+
}
|
|
507
|
+
for (let index = value.length - 1; index >= 0; index--) {
|
|
508
|
+
state.pending.push({ value: value[index], depth: depth + 1 });
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
function enqueueRemoteWorkspaceObject(value, depth, state) {
|
|
512
|
+
if (value === null || typeof value !== "object")
|
|
513
|
+
throw new RemoteWorkspaceValidationError("Protocol values must be JSON-compatible");
|
|
514
|
+
const prototype = Object.getPrototypeOf(value);
|
|
515
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
516
|
+
throw new RemoteWorkspaceValidationError("Protocol objects must be plain JSON objects");
|
|
517
|
+
}
|
|
518
|
+
const entries = Object.entries(value);
|
|
519
|
+
if (entries.length > state.limits.maxObjectKeys) {
|
|
520
|
+
throw new RemoteWorkspaceValidationError("Protocol object exceeds key limit");
|
|
521
|
+
}
|
|
522
|
+
state.objectKeys += entries.length;
|
|
523
|
+
if (state.objectKeys > state.limits.maxObjectKeys) {
|
|
524
|
+
throw new RemoteWorkspaceValidationError("Protocol value exceeds total key limit");
|
|
525
|
+
}
|
|
526
|
+
for (let index = entries.length - 1; index >= 0; index--) {
|
|
527
|
+
const entry = entries[index];
|
|
528
|
+
if (!entry)
|
|
529
|
+
continue;
|
|
530
|
+
if (Buffer.byteLength(entry[0], "utf8") > state.limits.maxStringBytes) {
|
|
531
|
+
throw new RemoteWorkspaceValidationError("Protocol object key exceeds byte limit");
|
|
532
|
+
}
|
|
533
|
+
state.pending.push({ value: entry[1], depth: depth + 1 });
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
export function assertRemoteWorkspaceJsonStructure(value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
|
|
537
|
+
const state = {
|
|
538
|
+
pending: [{ value, depth: 1 }],
|
|
539
|
+
nodes: 0,
|
|
540
|
+
objectKeys: 0,
|
|
541
|
+
limits,
|
|
542
|
+
};
|
|
543
|
+
while (state.pending.length > 0) {
|
|
544
|
+
const current = state.pending.pop();
|
|
545
|
+
if (!current)
|
|
546
|
+
break;
|
|
547
|
+
validateRemoteWorkspaceNodeBudget(current.depth, state);
|
|
548
|
+
if (validateRemoteWorkspaceScalar(current.value, limits))
|
|
549
|
+
continue;
|
|
550
|
+
if (Array.isArray(current.value)) {
|
|
551
|
+
enqueueRemoteWorkspaceArray(current.value, current.depth, state);
|
|
552
|
+
continue;
|
|
553
|
+
}
|
|
554
|
+
enqueueRemoteWorkspaceObject(current.value, current.depth, state);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
export function decodeRemoteWorkspaceMessage(payload, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
|
|
558
|
+
const bytes = typeof payload === "string" ? Buffer.from(payload, "utf8") : payload;
|
|
559
|
+
if (bytes.byteLength > limits.maxMessageBytes) {
|
|
560
|
+
throw new RemoteWorkspaceValidationError("Protocol message exceeds byte limit");
|
|
561
|
+
}
|
|
562
|
+
const text = typeof payload === "string" ? payload : new TextDecoder("utf-8", { fatal: true }).decode(payload);
|
|
563
|
+
let value;
|
|
564
|
+
try {
|
|
565
|
+
value = JSON.parse(text);
|
|
566
|
+
}
|
|
567
|
+
catch (error) {
|
|
568
|
+
throw new RemoteWorkspaceValidationError(`Protocol message is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
569
|
+
}
|
|
570
|
+
assertRemoteWorkspaceJsonStructure(value, limits);
|
|
571
|
+
return value;
|
|
572
|
+
}
|
|
573
|
+
export function parseRemoteWorkspaceClientMessage(value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
|
|
574
|
+
assertRemoteWorkspaceJsonStructure(value, limits);
|
|
575
|
+
return parseWithValidator(clientMessageValidator, value, "client message");
|
|
576
|
+
}
|
|
577
|
+
export function parseRemoteWorkspaceServerMessage(value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
|
|
578
|
+
assertRemoteWorkspaceJsonStructure(value, limits);
|
|
579
|
+
return parseWithValidator(serverMessageValidator, value, "server message");
|
|
580
|
+
}
|
|
581
|
+
export function isRemoteWorkspaceMethod(method) {
|
|
582
|
+
return REMOTE_WORKSPACE_METHODS.includes(method);
|
|
583
|
+
}
|
|
584
|
+
export function parseRemoteWorkspaceRequestParams(method, value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
|
|
585
|
+
assertRemoteWorkspaceJsonStructure(value, limits);
|
|
586
|
+
const parsed = parseWithValidator(parameterValidators[method], value, `${method} params`);
|
|
587
|
+
if (method === "workspace.write") {
|
|
588
|
+
decodeCanonicalBase64(parsed.contentBase64, limits.maxMessageBytes);
|
|
589
|
+
}
|
|
590
|
+
return parsed;
|
|
591
|
+
}
|
|
592
|
+
export function parseRemoteWorkspaceResult(method, value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
|
|
593
|
+
assertRemoteWorkspaceJsonStructure(value, limits);
|
|
594
|
+
const validator = resultValidators[method];
|
|
595
|
+
const parsed = validator ? parseWithValidator(validator, value, `${method} result`) : value;
|
|
596
|
+
if (method === "workspace.read" || method === "resource.read") {
|
|
597
|
+
decodeCanonicalBase64(parsed.contentBase64, limits.maxMessageBytes);
|
|
598
|
+
}
|
|
599
|
+
return parsed;
|
|
600
|
+
}
|
|
601
|
+
export function parseRemoteWorkspaceToolResult(value, limits = DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS) {
|
|
602
|
+
assertRemoteWorkspaceJsonStructure(value, limits);
|
|
603
|
+
return parseWithValidator(Compile(ToolResultSchema), value, "tool result");
|
|
604
|
+
}
|
|
605
|
+
export function decodeCanonicalBase64(value, maxBytes) {
|
|
606
|
+
if (value.length % 4 !== 0 || !/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(value)) {
|
|
607
|
+
throw new RemoteWorkspaceValidationError("Transfer data is not canonical base64");
|
|
608
|
+
}
|
|
609
|
+
const decoded = Buffer.from(value, "base64");
|
|
610
|
+
if (decoded.byteLength > maxBytes)
|
|
611
|
+
throw new RemoteWorkspaceValidationError("Transfer chunk exceeds byte limit");
|
|
612
|
+
if (decoded.toString("base64") !== value) {
|
|
613
|
+
throw new RemoteWorkspaceValidationError("Transfer data is not canonical base64");
|
|
614
|
+
}
|
|
615
|
+
return decoded;
|
|
616
|
+
}
|
|
617
|
+
function canonicalJson(value) {
|
|
618
|
+
if (value === null)
|
|
619
|
+
return "null";
|
|
620
|
+
if (typeof value === "boolean")
|
|
621
|
+
return value ? "true" : "false";
|
|
622
|
+
if (typeof value === "number") {
|
|
623
|
+
if (!Number.isFinite(value))
|
|
624
|
+
throw new RemoteWorkspaceValidationError("Cannot hash a non-finite number");
|
|
625
|
+
return JSON.stringify(value);
|
|
626
|
+
}
|
|
627
|
+
if (typeof value === "string")
|
|
628
|
+
return JSON.stringify(value);
|
|
629
|
+
if (Array.isArray(value))
|
|
630
|
+
return `[${value.map((entry) => canonicalJson(entry)).join(",")}]`;
|
|
631
|
+
if (typeof value !== "object" || value === undefined) {
|
|
632
|
+
throw new RemoteWorkspaceValidationError("Cannot hash a non-JSON value");
|
|
633
|
+
}
|
|
634
|
+
const entries = Object.entries(value).sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0));
|
|
635
|
+
return `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${canonicalJson(entry)}`).join(",")}}`;
|
|
636
|
+
}
|
|
637
|
+
export function hashRemoteWorkspaceJson(value) {
|
|
638
|
+
assertRemoteWorkspaceJsonStructure(value);
|
|
639
|
+
return createHash("sha256").update(canonicalJson(value)).digest("hex");
|
|
640
|
+
}
|
|
641
|
+
export function hashRemoteWorkspaceCatalog(catalog) {
|
|
642
|
+
return hashRemoteWorkspaceJson(catalog);
|
|
643
|
+
}
|
|
644
|
+
function assertUnique(values, label) {
|
|
645
|
+
if (new Set(values).size !== values.length)
|
|
646
|
+
throw new RemoteWorkspaceValidationError(`${label} contains duplicates`);
|
|
647
|
+
}
|
|
648
|
+
export function validateRemoteWorkspaceCatalog(catalog) {
|
|
649
|
+
parseWithValidator(Compile(RemoteWorkspaceCatalogSchema), catalog, "tool catalog");
|
|
650
|
+
assertUnique(catalog.operations, "Catalog operations");
|
|
651
|
+
assertUnique(catalog.tools.map((tool) => tool.name), "Catalog tool names");
|
|
652
|
+
for (const tool of catalog.tools) {
|
|
653
|
+
assertUnique(tool.featureFlags, `Feature flags for ${tool.name}`);
|
|
654
|
+
if (hashRemoteWorkspaceJson(tool.parameterSchema) !== tool.schemaHash) {
|
|
655
|
+
throw new RemoteWorkspaceValidationError(`Schema hash mismatch for tool ${tool.name}`);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
export function validateRemoteWorkspaceLocalToolSchemas(catalog, localToolSchemas) {
|
|
660
|
+
for (const tool of catalog.tools) {
|
|
661
|
+
const localHash = localToolSchemas.get(tool.name);
|
|
662
|
+
if (localHash !== undefined && localHash !== tool.schemaHash) {
|
|
663
|
+
throw new RemoteWorkspaceValidationError(`Remote schema does not match the local canonical schema for ${tool.name}`);
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
export function validateRemoteWorkspaceHandshakeAck(ack, offer, localToolSchemas = new Map()) {
|
|
668
|
+
const parsed = parseWithValidator(handshakeAckValidator, ack, "handshake response");
|
|
669
|
+
validateRemoteWorkspaceProtocolLimits(offer.receiveLimits);
|
|
670
|
+
validateRemoteWorkspaceProtocolLimits(parsed.limits);
|
|
671
|
+
const selected = offer.versions.some((range) => range.major === parsed.version.major &&
|
|
672
|
+
range.minMinor <= parsed.version.minor &&
|
|
673
|
+
range.maxMinor >= parsed.version.minor);
|
|
674
|
+
if (!selected)
|
|
675
|
+
throw new RemoteWorkspaceValidationError("Server selected a protocol version outside the offered range");
|
|
676
|
+
const offeredCapabilities = new Set([...offer.requiredCapabilities, ...offer.optionalCapabilities]);
|
|
677
|
+
for (const capability of parsed.capabilities) {
|
|
678
|
+
if (!offeredCapabilities.has(capability)) {
|
|
679
|
+
throw new RemoteWorkspaceValidationError(`Server selected an unoffered capability: ${capability}`);
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
const selectedCapabilities = new Set(parsed.capabilities);
|
|
683
|
+
for (const capability of offer.requiredCapabilities) {
|
|
684
|
+
if (!selectedCapabilities.has(capability)) {
|
|
685
|
+
throw new RemoteWorkspaceValidationError(`Server omitted required capability: ${capability}`);
|
|
686
|
+
}
|
|
687
|
+
}
|
|
688
|
+
assertUnique(parsed.capabilities, "Negotiated capabilities");
|
|
689
|
+
validateRemoteWorkspaceCatalog(parsed.catalog);
|
|
690
|
+
if (hashRemoteWorkspaceCatalog(parsed.catalog) !== parsed.catalogHash) {
|
|
691
|
+
throw new RemoteWorkspaceValidationError("Catalog hash does not match the negotiated catalog");
|
|
692
|
+
}
|
|
693
|
+
validateRemoteWorkspaceLocalToolSchemas(parsed.catalog, localToolSchemas);
|
|
694
|
+
for (const key of Object.keys(offer.receiveLimits)) {
|
|
695
|
+
if (parsed.limits[key] > offer.receiveLimits[key]) {
|
|
696
|
+
throw new RemoteWorkspaceValidationError(`Server increased negotiated limit: ${key}`);
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
return parsed;
|
|
700
|
+
}
|
|
701
|
+
export class RemoteWorkspaceNegotiationError extends Error {
|
|
702
|
+
code;
|
|
703
|
+
constructor(code, message) {
|
|
704
|
+
super(message);
|
|
705
|
+
this.name = "RemoteWorkspaceNegotiationError";
|
|
706
|
+
this.code = code;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
function validateVersionRanges(ranges, label) {
|
|
710
|
+
for (const range of ranges) {
|
|
711
|
+
if (range.minMinor > range.maxMinor) {
|
|
712
|
+
throw new RemoteWorkspaceNegotiationError("incompatible_version", `${label} has an inverted minor range`);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
function findCompatibleRemoteWorkspaceVersions(clientVersions, serverVersions) {
|
|
717
|
+
const serverVersionsByMajor = new Map();
|
|
718
|
+
for (const server of serverVersions) {
|
|
719
|
+
const ranges = serverVersionsByMajor.get(server.major) ?? [];
|
|
720
|
+
ranges.push(server);
|
|
721
|
+
serverVersionsByMajor.set(server.major, ranges);
|
|
722
|
+
}
|
|
723
|
+
const candidates = [];
|
|
724
|
+
for (const client of clientVersions) {
|
|
725
|
+
for (const server of serverVersionsByMajor.get(client.major) ?? []) {
|
|
726
|
+
const minMinor = Math.max(client.minMinor, server.minMinor);
|
|
727
|
+
const maxMinor = Math.min(client.maxMinor, server.maxMinor);
|
|
728
|
+
if (minMinor <= maxMinor)
|
|
729
|
+
candidates.push({ major: client.major, minor: maxMinor });
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
return candidates;
|
|
733
|
+
}
|
|
734
|
+
export function negotiateRemoteWorkspaceHandshake(handshake, options) {
|
|
735
|
+
validateRemoteWorkspaceProtocolLimits(handshake.receiveLimits);
|
|
736
|
+
validateRemoteWorkspaceProtocolLimits(options.serverLimits);
|
|
737
|
+
validateVersionRanges(handshake.versions, "Client version offer");
|
|
738
|
+
validateVersionRanges(options.serverVersions, "Server version offer");
|
|
739
|
+
assertUnique(handshake.requiredCapabilities, "Required capabilities");
|
|
740
|
+
assertUnique(handshake.optionalCapabilities, "Optional capabilities");
|
|
741
|
+
const optionalCapabilities = new Set(handshake.optionalCapabilities);
|
|
742
|
+
const duplicateOffer = handshake.requiredCapabilities.find((capability) => optionalCapabilities.has(capability));
|
|
743
|
+
if (duplicateOffer) {
|
|
744
|
+
throw new RemoteWorkspaceNegotiationError("capability_mismatch", `Capability is both required and optional: ${duplicateOffer}`);
|
|
745
|
+
}
|
|
746
|
+
const candidates = findCompatibleRemoteWorkspaceVersions(handshake.versions, options.serverVersions);
|
|
747
|
+
candidates.sort((left, right) => right.major - left.major || right.minor - left.minor);
|
|
748
|
+
const version = candidates[0];
|
|
749
|
+
if (!version) {
|
|
750
|
+
throw new RemoteWorkspaceNegotiationError("incompatible_version", "No compatible remote workspace protocol version");
|
|
751
|
+
}
|
|
752
|
+
const serverCapabilities = new Set(options.serverCapabilities);
|
|
753
|
+
for (const capability of handshake.requiredCapabilities) {
|
|
754
|
+
if (!serverCapabilities.has(capability)) {
|
|
755
|
+
throw new RemoteWorkspaceNegotiationError("capability_mismatch", `Server does not support required capability: ${capability}`);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
const clientCapabilities = new Set([...handshake.requiredCapabilities, ...handshake.optionalCapabilities]);
|
|
759
|
+
for (const capability of options.requiredClientCapabilities ?? []) {
|
|
760
|
+
if (!clientCapabilities.has(capability)) {
|
|
761
|
+
throw new RemoteWorkspaceNegotiationError("capability_mismatch", `Client does not support required capability: ${capability}`);
|
|
762
|
+
}
|
|
763
|
+
}
|
|
764
|
+
const capabilities = Array.from(clientCapabilities)
|
|
765
|
+
.filter((capability) => serverCapabilities.has(capability))
|
|
766
|
+
.sort();
|
|
767
|
+
const clientLimits = handshake.receiveLimits;
|
|
768
|
+
const serverLimits = options.serverLimits;
|
|
769
|
+
return {
|
|
770
|
+
version,
|
|
771
|
+
capabilities,
|
|
772
|
+
limits: {
|
|
773
|
+
maxMessageBytes: Math.min(clientLimits.maxMessageBytes, serverLimits.maxMessageBytes),
|
|
774
|
+
maxStringBytes: Math.min(clientLimits.maxStringBytes, serverLimits.maxStringBytes),
|
|
775
|
+
maxDepth: Math.min(clientLimits.maxDepth, serverLimits.maxDepth),
|
|
776
|
+
maxObjectKeys: Math.min(clientLimits.maxObjectKeys, serverLimits.maxObjectKeys),
|
|
777
|
+
maxArrayLength: Math.min(clientLimits.maxArrayLength, serverLimits.maxArrayLength),
|
|
778
|
+
maxNodes: Math.min(clientLimits.maxNodes, serverLimits.maxNodes),
|
|
779
|
+
maxRequestMs: Math.min(clientLimits.maxRequestMs, serverLimits.maxRequestMs),
|
|
780
|
+
maxTransferChunkBytes: Math.min(clientLimits.maxTransferChunkBytes, serverLimits.maxTransferChunkBytes),
|
|
781
|
+
maxPendingTransferBytes: Math.min(clientLimits.maxPendingTransferBytes, serverLimits.maxPendingTransferBytes),
|
|
782
|
+
maxPendingInboundBytes: Math.min(clientLimits.maxPendingInboundBytes, serverLimits.maxPendingInboundBytes),
|
|
783
|
+
maxPendingInboundMessages: Math.min(clientLimits.maxPendingInboundMessages, serverLimits.maxPendingInboundMessages),
|
|
784
|
+
maxPendingOutboundBytes: Math.min(clientLimits.maxPendingOutboundBytes, serverLimits.maxPendingOutboundBytes),
|
|
785
|
+
maxPendingOutboundMessages: Math.min(clientLimits.maxPendingOutboundMessages, serverLimits.maxPendingOutboundMessages),
|
|
786
|
+
maxTransferBytes: Math.min(clientLimits.maxTransferBytes, serverLimits.maxTransferBytes),
|
|
787
|
+
maxTransferChunks: Math.min(clientLimits.maxTransferChunks, serverLimits.maxTransferChunks),
|
|
788
|
+
maxActiveRequests: Math.min(clientLimits.maxActiveRequests, serverLimits.maxActiveRequests),
|
|
789
|
+
maxActiveTransfers: Math.min(clientLimits.maxActiveTransfers, serverLimits.maxActiveTransfers),
|
|
790
|
+
maxCancellationMs: Math.min(clientLimits.maxCancellationMs, serverLimits.maxCancellationMs),
|
|
791
|
+
maxTransportSendMs: Math.min(clientLimits.maxTransportSendMs, serverLimits.maxTransportSendMs),
|
|
792
|
+
},
|
|
793
|
+
};
|
|
794
|
+
}
|
|
795
|
+
export function getRemoteWorkspaceMethodKind(method) {
|
|
796
|
+
switch (method) {
|
|
797
|
+
case "workspace.write":
|
|
798
|
+
case "workspace.mkdir":
|
|
799
|
+
case "transfer.upload":
|
|
800
|
+
return "mutation";
|
|
801
|
+
case "workspace.exec":
|
|
802
|
+
return "process";
|
|
803
|
+
case "tool.invoke":
|
|
804
|
+
return "service";
|
|
805
|
+
default:
|
|
806
|
+
return "read";
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
//# sourceMappingURL=contract.js.map
|