@greppleai/grip 0.0.0-stage → 0.1.3
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 +115 -0
- package/README.md +731 -2
- package/dist/bun/cli.d.ts +3 -0
- package/dist/bun/cli.d.ts.map +1 -0
- package/dist/bun/cli.js +13 -0
- package/dist/bun/cli.js.map +1 -0
- package/dist/bun/embedded-assets.d.ts +3 -0
- package/dist/bun/embedded-assets.d.ts.map +1 -0
- package/dist/bun/embedded-assets.js +52 -0
- package/dist/bun/embedded-assets.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 +442 -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 +5191 -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 +465 -0
- package/dist/core/remote-workspace-protocol/contract.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/contract.js +825 -0
- package/dist/core/remote-workspace-protocol/contract.js.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts +16 -0
- package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-client.js +54 -0
- package/dist/core/remote-workspace-protocol/guest-shared-client.js.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts +23 -0
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js +112 -0
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts +30 -0
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.js +243 -0
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.js.map +1 -0
- package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts +3 -0
- package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/lima-owner-directory.js +31 -0
- package/dist/core/remote-workspace-protocol/lima-owner-directory.js.map +1 -0
- package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts +9 -0
- package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/lima-owner-lock.js +89 -0
- package/dist/core/remote-workspace-protocol/lima-owner-lock.js.map +1 -0
- package/dist/core/remote-workspace-protocol/session.d.ts +249 -0
- package/dist/core/remote-workspace-protocol/session.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/session.js +1842 -0
- package/dist/core/remote-workspace-protocol/session.js.map +1 -0
- package/dist/core/remote-workspace-protocol/shared-transport.d.ts +71 -0
- package/dist/core/remote-workspace-protocol/shared-transport.d.ts.map +1 -0
- package/dist/core/remote-workspace-protocol/shared-transport.js +68 -0
- package/dist/core/remote-workspace-protocol/shared-transport.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 +25 -0
- package/dist/core/sandbox/command.d.ts.map +1 -0
- package/dist/core/sandbox/command.js +102 -0
- package/dist/core/sandbox/command.js.map +1 -0
- package/dist/core/sandbox/config.d.ts +91 -0
- package/dist/core/sandbox/config.d.ts.map +1 -0
- package/dist/core/sandbox/config.js +88 -0
- package/dist/core/sandbox/config.js.map +1 -0
- package/dist/core/sandbox/lima-guest-binary.d.ts +11 -0
- package/dist/core/sandbox/lima-guest-binary.d.ts.map +1 -0
- package/dist/core/sandbox/lima-guest-binary.js +140 -0
- package/dist/core/sandbox/lima-guest-binary.js.map +1 -0
- package/dist/core/sandbox/lima.d.ts +57 -0
- package/dist/core/sandbox/lima.d.ts.map +1 -0
- package/dist/core/sandbox/lima.js +716 -0
- package/dist/core/sandbox/lima.js.map +1 -0
- package/dist/core/sandbox/shared-lima-roots.d.ts +11 -0
- package/dist/core/sandbox/shared-lima-roots.d.ts.map +1 -0
- package/dist/core/sandbox/shared-lima-roots.js +25 -0
- package/dist/core/sandbox/shared-lima-roots.js.map +1 -0
- package/dist/core/sandbox/update-shared-guest-binary.d.ts +8 -0
- package/dist/core/sandbox/update-shared-guest-binary.d.ts.map +1 -0
- package/dist/core/sandbox/update-shared-guest-binary.js +100 -0
- package/dist/core/sandbox/update-shared-guest-binary.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 +314 -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 +321 -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 +8 -0
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -0
- package/dist/core/tools/file-mutation-queue.js +69 -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 +212 -0
- package/dist/core/tools/operations.d.ts.map +1 -0
- package/dist/core/tools/operations.js +793 -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/activity-budget.d.ts +10 -0
- package/dist/daemon/activity-budget.d.ts.map +1 -0
- package/dist/daemon/activity-budget.js +34 -0
- package/dist/daemon/activity-budget.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 +45 -0
- package/dist/daemon/config.d.ts.map +1 -0
- package/dist/daemon/config.js +319 -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/outbound-budget.d.ts +10 -0
- package/dist/daemon/outbound-budget.d.ts.map +1 -0
- package/dist/daemon/outbound-budget.js +30 -0
- package/dist/daemon/outbound-budget.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 +177 -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 +480 -0
- package/dist/daemon/server.js.map +1 -0
- package/dist/daemon/shared-connection.d.ts +33 -0
- package/dist/daemon/shared-connection.d.ts.map +1 -0
- package/dist/daemon/shared-connection.js +271 -0
- package/dist/daemon/shared-connection.js.map +1 -0
- package/dist/daemon/shared-revision.d.ts +5 -0
- package/dist/daemon/shared-revision.d.ts.map +1 -0
- package/dist/daemon/shared-revision.js +61 -0
- package/dist/daemon/shared-revision.js.map +1 -0
- package/dist/daemon/shared-roots.d.ts +9 -0
- package/dist/daemon/shared-roots.d.ts.map +1 -0
- package/dist/daemon/shared-roots.js +33 -0
- package/dist/daemon/shared-roots.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 +705 -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 +765 -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 +30 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/assistant-message.js +159 -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 +17 -0
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/branch-summary-message.js +45 -0
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts +17 -0
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/compaction-summary-message.js +46 -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 +81 -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 +185 -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/message-card.d.ts +9 -0
- package/dist/modes/interactive/components/message-card.d.ts.map +1 -0
- package/dist/modes/interactive/components/message-card.js +24 -0
- package/dist/modes/interactive/components/message-card.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 +18 -0
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -0
- package/dist/modes/interactive/components/skill-invocation-message.js +48 -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 +312 -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 +50 -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 +554 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -0
- package/dist/modes/interactive/interactive-mode.js +5870 -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 +109 -0
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/dist/modes/interactive/theme/theme.js +1040 -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 +86 -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 +126 -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 +112 -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 +77 -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 +159 -0
- package/docs/rpc.md +1492 -0
- package/docs/rules.md +117 -0
- package/docs/sandbox.md +104 -0
- package/docs/sdk.md +360 -0
- package/docs/session-format.md +414 -0
- package/docs/sessions.md +137 -0
- package/docs/settings.md +372 -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 +112 -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 +29 -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/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 +101 -5
|
@@ -0,0 +1,705 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { mkdir as fsMkdir, lstat, open, readFile, realpath, rename, rm } from "node:fs/promises";
|
|
4
|
+
import { basename, isAbsolute, relative, resolve, sep } from "node:path";
|
|
5
|
+
import { createLspRuntimeState, createLspToolDefinitions } from "../core/lsp/integration.js";
|
|
6
|
+
import { createManagedStdioConnectionFactory, resolveLspConnectionFactory } from "../core/lsp/transport.js";
|
|
7
|
+
import { hashRemoteWorkspaceJson, } from "../core/remote-workspace-protocol/contract.js";
|
|
8
|
+
import { RemoteWorkspaceRequestError, } from "../core/remote-workspace-protocol/session.js";
|
|
9
|
+
import { withFileMutationQueue } from "../core/tools/file-mutation-queue.js";
|
|
10
|
+
import { GRIP_SESSION_ENVIRONMENT_NAMES, LocalToolOperations, } from "../core/tools/operations.js";
|
|
11
|
+
import { WorkspaceToolHost } from "../core/tools/workspace-tool-host.js";
|
|
12
|
+
import { loadDaemonLspConfiguration } from "./lsp-config.js";
|
|
13
|
+
import { redactDaemonText } from "./security.js";
|
|
14
|
+
const PRIMITIVE_OPERATIONS = [
|
|
15
|
+
"workspace.access",
|
|
16
|
+
"workspace.read",
|
|
17
|
+
"workspace.write",
|
|
18
|
+
"workspace.mkdir",
|
|
19
|
+
"workspace.stat",
|
|
20
|
+
"workspace.readdir",
|
|
21
|
+
"workspace.glob",
|
|
22
|
+
"workspace.grep",
|
|
23
|
+
"workspace.detect_image_mime",
|
|
24
|
+
"workspace.exec",
|
|
25
|
+
];
|
|
26
|
+
const SECRET_ENVIRONMENT_SUFFIX = /_(?:API_KEY|TOKEN|SECRET|PASSWORD|PRIVATE_KEY|CREDENTIALS)$/iu;
|
|
27
|
+
const BASELINE_ENVIRONMENT = process.platform === "win32"
|
|
28
|
+
? ["PATH", "PATHEXT", "SYSTEMROOT", "COMSPEC", "TEMP", "TMP", "USER", "USERNAME"]
|
|
29
|
+
: ["PATH", "HOME", "USER", "LOGNAME", "SHELL", "LANG", "TERM", "COLORTERM", "NO_COLOR", "TMPDIR"];
|
|
30
|
+
function isSecretEnvironmentName(name) {
|
|
31
|
+
const upper = name.toUpperCase();
|
|
32
|
+
return (upper === "GRIP_DAEMON_TOKEN" ||
|
|
33
|
+
upper === "PI_DAEMON_TOKEN" ||
|
|
34
|
+
upper === "GRIP_REMOTE_TOKEN" ||
|
|
35
|
+
upper.startsWith("GRIP_DAEMON_TLS_") ||
|
|
36
|
+
upper.startsWith("PI_DAEMON_TLS_") ||
|
|
37
|
+
SECRET_ENVIRONMENT_SUFFIX.test(upper));
|
|
38
|
+
}
|
|
39
|
+
process.platform === "win32"
|
|
40
|
+
? ["PATH", "PATHEXT", "SYSTEMROOT", "TEMP", "TMP"]
|
|
41
|
+
: ["PATH", "HOME", "LANG", "LC_ALL", "TERM", "TMPDIR"];
|
|
42
|
+
function isMissingPath(error) {
|
|
43
|
+
return error instanceof Error && "code" in error && error.code === "ENOENT";
|
|
44
|
+
}
|
|
45
|
+
function sanitizeLspStatus(status, configuration) {
|
|
46
|
+
const { capabilities: _capabilities, ...safe } = status;
|
|
47
|
+
const secrets = [configuration.token, configuration.tls?.passphrase];
|
|
48
|
+
const redact = (value) => (value ? redactDaemonText(value, secrets) : undefined);
|
|
49
|
+
return {
|
|
50
|
+
...safe,
|
|
51
|
+
serverId: redact(safe.serverId),
|
|
52
|
+
languageIds: safe.languageIds.map((value) => redact(value)),
|
|
53
|
+
transport: redact(safe.transport),
|
|
54
|
+
...(safe.instanceKey ? { instanceKey: redact(safe.instanceKey) } : {}),
|
|
55
|
+
...(safe.workspaceRoot ? { workspaceRoot: redact(safe.workspaceRoot) } : {}),
|
|
56
|
+
...(safe.rootUri ? { rootUri: redact(safe.rootUri) } : {}),
|
|
57
|
+
...(safe.endpoint ? { endpoint: redact(safe.endpoint) } : {}),
|
|
58
|
+
...(safe.lastError ? { lastError: redact(safe.lastError) } : {}),
|
|
59
|
+
...(safe.lastRequestError ? { lastRequestError: redact(safe.lastRequestError) } : {}),
|
|
60
|
+
...(safe.stderr ? { stderr: redact(safe.stderr) } : {}),
|
|
61
|
+
...(safe.synchronizationError ? { synchronizationError: redact(safe.synchronizationError) } : {}),
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function portableToolResult(result) {
|
|
65
|
+
const clone = JSON.parse(JSON.stringify(result));
|
|
66
|
+
const details = clone.details;
|
|
67
|
+
if (!details || typeof details !== "object" || !("fullOutputPath" in details))
|
|
68
|
+
return clone;
|
|
69
|
+
const fullOutputPath = details.fullOutputPath;
|
|
70
|
+
if (typeof fullOutputPath !== "string")
|
|
71
|
+
return clone;
|
|
72
|
+
delete details.fullOutputPath;
|
|
73
|
+
for (const content of clone.content) {
|
|
74
|
+
if (content.type === "text") {
|
|
75
|
+
content.text = content.text.replaceAll(fullOutputPath, "[remote full output is not transferable]");
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return clone;
|
|
79
|
+
}
|
|
80
|
+
function operationKind(name) {
|
|
81
|
+
if (name.startsWith("lsp_"))
|
|
82
|
+
return "service";
|
|
83
|
+
switch (name) {
|
|
84
|
+
case "read":
|
|
85
|
+
case "grep":
|
|
86
|
+
case "find":
|
|
87
|
+
case "ls":
|
|
88
|
+
return "read";
|
|
89
|
+
case "edit":
|
|
90
|
+
case "write":
|
|
91
|
+
return "mutation";
|
|
92
|
+
case "bash":
|
|
93
|
+
return "process";
|
|
94
|
+
}
|
|
95
|
+
throw new Error(`Unknown daemon tool: ${name}`);
|
|
96
|
+
}
|
|
97
|
+
function runCommand(command, args, environment, maxBufferedBytes) {
|
|
98
|
+
return new Promise((resolvePromise, reject) => {
|
|
99
|
+
const child = spawn(command, args, { stdio: ["ignore", "pipe", "pipe"], windowsHide: true, env: environment });
|
|
100
|
+
const stdout = [];
|
|
101
|
+
const stderr = [];
|
|
102
|
+
let bufferedBytes = 0;
|
|
103
|
+
let settled = false;
|
|
104
|
+
const append = (target, chunk) => {
|
|
105
|
+
if (settled)
|
|
106
|
+
return;
|
|
107
|
+
bufferedBytes += chunk.byteLength;
|
|
108
|
+
if (bufferedBytes > maxBufferedBytes) {
|
|
109
|
+
settled = true;
|
|
110
|
+
child.kill();
|
|
111
|
+
reject(new Error(`${command} output exceeded the daemon buffered-output limit`));
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
target.push(Buffer.from(chunk));
|
|
115
|
+
};
|
|
116
|
+
child.stdout.on("data", (chunk) => append(stdout, chunk));
|
|
117
|
+
child.stderr.on("data", (chunk) => append(stderr, chunk));
|
|
118
|
+
child.once("error", (error) => {
|
|
119
|
+
if (settled)
|
|
120
|
+
return;
|
|
121
|
+
settled = true;
|
|
122
|
+
reject(error);
|
|
123
|
+
});
|
|
124
|
+
child.once("close", (code) => {
|
|
125
|
+
if (settled)
|
|
126
|
+
return;
|
|
127
|
+
settled = true;
|
|
128
|
+
if (code === 0 || (command === "rg" && code === 1)) {
|
|
129
|
+
resolvePromise(Buffer.concat(stdout));
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
reject(new Error(Buffer.concat(stderr).toString("utf8").trim() || `${command} exited with code ${code}`));
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function isUnknownRecord(value) {
|
|
137
|
+
return typeof value === "object" && value !== null;
|
|
138
|
+
}
|
|
139
|
+
function nestedText(record, key) {
|
|
140
|
+
const nested = record?.[key];
|
|
141
|
+
return isUnknownRecord(nested) && typeof nested.text === "string" ? nested.text : undefined;
|
|
142
|
+
}
|
|
143
|
+
function parseDaemonGrepMatch(line) {
|
|
144
|
+
if (!line)
|
|
145
|
+
return undefined;
|
|
146
|
+
let event;
|
|
147
|
+
try {
|
|
148
|
+
event = JSON.parse(line);
|
|
149
|
+
}
|
|
150
|
+
catch {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
const eventRecord = isUnknownRecord(event) ? event : undefined;
|
|
154
|
+
if (eventRecord?.type !== "match")
|
|
155
|
+
return undefined;
|
|
156
|
+
const data = isUnknownRecord(eventRecord.data) ? eventRecord.data : undefined;
|
|
157
|
+
const filePath = nestedText(data, "path");
|
|
158
|
+
const lineNumber = data?.line_number;
|
|
159
|
+
if (!filePath || typeof lineNumber !== "number")
|
|
160
|
+
return undefined;
|
|
161
|
+
const lineText = nestedText(data, "lines");
|
|
162
|
+
return { filePath, lineNumber, ...(lineText === undefined ? {} : { lineText }) };
|
|
163
|
+
}
|
|
164
|
+
export class ConfinedDaemonToolOperations {
|
|
165
|
+
cwd;
|
|
166
|
+
local;
|
|
167
|
+
allowedRoots;
|
|
168
|
+
allowProcessExec;
|
|
169
|
+
environment;
|
|
170
|
+
maxBufferedOutputBytes;
|
|
171
|
+
constructor(configuration) {
|
|
172
|
+
this.cwd = configuration.workspaceRoot;
|
|
173
|
+
this.local = new LocalToolOperations(this.cwd);
|
|
174
|
+
this.allowedRoots = Object.freeze([
|
|
175
|
+
this.cwd,
|
|
176
|
+
...(configuration.temporaryRoot ? [configuration.temporaryRoot] : []),
|
|
177
|
+
]);
|
|
178
|
+
this.allowProcessExec = configuration.allowProcessExec;
|
|
179
|
+
this.maxBufferedOutputBytes = configuration.maxBufferedOutputBytes;
|
|
180
|
+
const localeNames = Object.keys(process.env).filter((name) => /^LC_/iu.test(name));
|
|
181
|
+
const names = new Set([...BASELINE_ENVIRONMENT, ...localeNames, ...configuration.forwardedEnvironment]);
|
|
182
|
+
this.environment = {};
|
|
183
|
+
for (const name of names) {
|
|
184
|
+
if (isSecretEnvironmentName(name))
|
|
185
|
+
continue;
|
|
186
|
+
const value = process.env[name];
|
|
187
|
+
if (value !== undefined)
|
|
188
|
+
this.environment[name] = value;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
createChildEnvironment(extra = {}) {
|
|
192
|
+
const environment = {};
|
|
193
|
+
for (const [name, value] of Object.entries(this.environment)) {
|
|
194
|
+
if (value !== undefined)
|
|
195
|
+
environment[name] = value;
|
|
196
|
+
}
|
|
197
|
+
Object.assign(environment, extra);
|
|
198
|
+
for (const name of Object.keys(environment)) {
|
|
199
|
+
if (isSecretEnvironmentName(name))
|
|
200
|
+
delete environment[name];
|
|
201
|
+
}
|
|
202
|
+
return environment;
|
|
203
|
+
}
|
|
204
|
+
isWithinAllowedRoot(candidate, root) {
|
|
205
|
+
const pathRelative = relative(root, candidate);
|
|
206
|
+
return pathRelative !== ".." && !pathRelative.startsWith(`..${sep}`) && !isAbsolute(pathRelative);
|
|
207
|
+
}
|
|
208
|
+
lexicalPath(path) {
|
|
209
|
+
const candidate = resolve(this.cwd, path);
|
|
210
|
+
if (!this.allowedRoots.some((root) => this.isWithinAllowedRoot(candidate, root))) {
|
|
211
|
+
throw new Error(`Path escapes the daemon workspace and allowed temporary root: ${path}`);
|
|
212
|
+
}
|
|
213
|
+
return candidate;
|
|
214
|
+
}
|
|
215
|
+
async existingPath(path) {
|
|
216
|
+
const candidate = this.lexicalPath(path);
|
|
217
|
+
const canonical = await realpath(candidate);
|
|
218
|
+
return this.lexicalPath(canonical);
|
|
219
|
+
}
|
|
220
|
+
async existingWritablePath(candidate, path) {
|
|
221
|
+
try {
|
|
222
|
+
const stat = await lstat(candidate);
|
|
223
|
+
if (stat.isSymbolicLink()) {
|
|
224
|
+
try {
|
|
225
|
+
this.lexicalPath(await realpath(candidate));
|
|
226
|
+
}
|
|
227
|
+
catch (error) {
|
|
228
|
+
if (isMissingPath(error))
|
|
229
|
+
throw new Error(`Writable path uses a broken symbolic link: ${path}`);
|
|
230
|
+
throw error;
|
|
231
|
+
}
|
|
232
|
+
throw new Error(`Writable path uses a symbolic link: ${path}`);
|
|
233
|
+
}
|
|
234
|
+
const canonical = await realpath(candidate);
|
|
235
|
+
this.lexicalPath(canonical);
|
|
236
|
+
return this.lexicalPath(canonical);
|
|
237
|
+
}
|
|
238
|
+
catch (error) {
|
|
239
|
+
if (isMissingPath(error))
|
|
240
|
+
return undefined;
|
|
241
|
+
throw error;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
async ensureConfinedWritableParent(candidate, path) {
|
|
245
|
+
let parent = resolve(candidate, "..");
|
|
246
|
+
while (true) {
|
|
247
|
+
try {
|
|
248
|
+
const parentStat = await lstat(parent);
|
|
249
|
+
if (parentStat.isSymbolicLink()) {
|
|
250
|
+
this.lexicalPath(await realpath(parent));
|
|
251
|
+
throw new Error(`Writable parent uses a symbolic link: ${path}`);
|
|
252
|
+
}
|
|
253
|
+
const canonicalParent = await realpath(parent);
|
|
254
|
+
this.lexicalPath(canonicalParent);
|
|
255
|
+
return;
|
|
256
|
+
}
|
|
257
|
+
catch (error) {
|
|
258
|
+
if (!isMissingPath(error))
|
|
259
|
+
throw error;
|
|
260
|
+
const next = resolve(parent, "..");
|
|
261
|
+
if (next === parent)
|
|
262
|
+
throw new Error(`No confined parent exists for path: ${path}`);
|
|
263
|
+
parent = next;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
async writablePath(path) {
|
|
268
|
+
const candidate = this.lexicalPath(path);
|
|
269
|
+
const existing = await this.existingWritablePath(candidate, path);
|
|
270
|
+
if (existing)
|
|
271
|
+
return existing;
|
|
272
|
+
await this.ensureConfinedWritableParent(candidate, path);
|
|
273
|
+
return candidate;
|
|
274
|
+
}
|
|
275
|
+
async atomicWriteFile(path, content) {
|
|
276
|
+
const target = await this.writablePath(path);
|
|
277
|
+
const parent = resolve(target, "..");
|
|
278
|
+
const temporary = resolve(parent, `.grip-remote-write-${process.pid}-${randomUUID()}-${basename(target)}.tmp`);
|
|
279
|
+
this.lexicalPath(temporary);
|
|
280
|
+
let wroteTemporary = false;
|
|
281
|
+
try {
|
|
282
|
+
const handle = await open(temporary, "wx", 0o600);
|
|
283
|
+
try {
|
|
284
|
+
await handle.writeFile(content, typeof content === "string" ? "utf8" : undefined);
|
|
285
|
+
}
|
|
286
|
+
finally {
|
|
287
|
+
await handle.close();
|
|
288
|
+
}
|
|
289
|
+
wroteTemporary = true;
|
|
290
|
+
this.lexicalPath(await realpath(temporary));
|
|
291
|
+
try {
|
|
292
|
+
if ((await lstat(target)).isSymbolicLink())
|
|
293
|
+
throw new Error(`Writable path uses a symbolic link: ${path}`);
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
if (!isMissingPath(error))
|
|
297
|
+
throw error;
|
|
298
|
+
}
|
|
299
|
+
await rename(temporary, target);
|
|
300
|
+
wroteTemporary = false;
|
|
301
|
+
this.lexicalPath(await realpath(target));
|
|
302
|
+
}
|
|
303
|
+
finally {
|
|
304
|
+
if (wroteTemporary)
|
|
305
|
+
await rm(temporary, { force: true });
|
|
306
|
+
}
|
|
307
|
+
}
|
|
308
|
+
async exec(command, options) {
|
|
309
|
+
if (!this.allowProcessExec)
|
|
310
|
+
throw new Error("Process execution is disabled by daemon policy");
|
|
311
|
+
const cwd = await this.existingPath(options.cwd ?? this.cwd);
|
|
312
|
+
const environment = { ...this.environment };
|
|
313
|
+
for (const name of GRIP_SESSION_ENVIRONMENT_NAMES) {
|
|
314
|
+
const value = options.env?.[name];
|
|
315
|
+
if (value !== undefined)
|
|
316
|
+
environment[name] = value;
|
|
317
|
+
}
|
|
318
|
+
return this.local.exec(command, { ...options, cwd, env: environment });
|
|
319
|
+
}
|
|
320
|
+
async access(path, mode) {
|
|
321
|
+
await this.local.access(await this.existingPath(path), mode);
|
|
322
|
+
}
|
|
323
|
+
async readFile(path) {
|
|
324
|
+
return this.local.readFile(await this.existingPath(path));
|
|
325
|
+
}
|
|
326
|
+
async writeFile(path, content) {
|
|
327
|
+
await this.atomicWriteFile(path, content);
|
|
328
|
+
}
|
|
329
|
+
async mkdir(path, options) {
|
|
330
|
+
await fsMkdir(await this.writablePath(path), options);
|
|
331
|
+
}
|
|
332
|
+
async stat(path) {
|
|
333
|
+
return this.local.stat(await this.existingPath(path));
|
|
334
|
+
}
|
|
335
|
+
async readdir(path) {
|
|
336
|
+
return this.local.readdir(await this.existingPath(path));
|
|
337
|
+
}
|
|
338
|
+
async glob(pattern, cwd, options) {
|
|
339
|
+
const searchRoot = await this.existingPath(cwd);
|
|
340
|
+
const args = ["--glob", "--color=never", "--hidden", "--no-require-git", "--max-results", String(options.limit)];
|
|
341
|
+
for (const ignored of options.ignore)
|
|
342
|
+
args.push("--exclude", ignored);
|
|
343
|
+
let effectivePattern = pattern;
|
|
344
|
+
if (pattern.includes("/")) {
|
|
345
|
+
args.push("--full-path");
|
|
346
|
+
if (!pattern.startsWith("/") && !pattern.startsWith("**/") && pattern !== "**")
|
|
347
|
+
effectivePattern = `**/${pattern}`;
|
|
348
|
+
}
|
|
349
|
+
args.push("--", effectivePattern, searchRoot);
|
|
350
|
+
const output = await runCommand("fd", args, this.environment, this.maxBufferedOutputBytes);
|
|
351
|
+
const results = [];
|
|
352
|
+
for (const entry of output.toString("utf8").split("\n")) {
|
|
353
|
+
if (!entry)
|
|
354
|
+
continue;
|
|
355
|
+
try {
|
|
356
|
+
results.push(await this.existingPath(entry));
|
|
357
|
+
}
|
|
358
|
+
catch {
|
|
359
|
+
// Symlinks escaping the workspace are deliberately omitted.
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
return results;
|
|
363
|
+
}
|
|
364
|
+
async grep(options) {
|
|
365
|
+
const searchPath = await this.existingPath(options.path);
|
|
366
|
+
const isDirectory = (await this.local.stat(searchPath)).isDirectory();
|
|
367
|
+
const args = ["--json", "--line-number", "--color=never", "--hidden"];
|
|
368
|
+
if (options.ignoreCase)
|
|
369
|
+
args.push("--ignore-case");
|
|
370
|
+
if (options.literal)
|
|
371
|
+
args.push("--fixed-strings");
|
|
372
|
+
if (options.glob)
|
|
373
|
+
args.push("--glob", options.glob);
|
|
374
|
+
args.push("--", options.pattern, searchPath);
|
|
375
|
+
const output = await runCommand("rg", args, this.environment, this.maxBufferedOutputBytes);
|
|
376
|
+
const matches = [];
|
|
377
|
+
for (const line of output.toString("utf8").split("\n")) {
|
|
378
|
+
if (matches.length >= options.limit)
|
|
379
|
+
continue;
|
|
380
|
+
const match = parseDaemonGrepMatch(line);
|
|
381
|
+
if (!match)
|
|
382
|
+
continue;
|
|
383
|
+
try {
|
|
384
|
+
await this.existingPath(match.filePath);
|
|
385
|
+
}
|
|
386
|
+
catch {
|
|
387
|
+
continue;
|
|
388
|
+
}
|
|
389
|
+
matches.push(match);
|
|
390
|
+
}
|
|
391
|
+
return { isDirectory, matches };
|
|
392
|
+
}
|
|
393
|
+
async detectImageMimeType(path) {
|
|
394
|
+
return this.local.detectImageMimeType(await this.existingPath(path));
|
|
395
|
+
}
|
|
396
|
+
getBackendInfo() {
|
|
397
|
+
return { type: "local", cwd: this.cwd };
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
function requestError(code, message, state) {
|
|
401
|
+
return new RemoteWorkspaceRequestError({ code, message, executionState: state, retryable: false });
|
|
402
|
+
}
|
|
403
|
+
function withDaemonWorkspace(result, workspace) {
|
|
404
|
+
return { ...result, workspace };
|
|
405
|
+
}
|
|
406
|
+
async function synchronizeDaemonToolFile(toolName, invocationArguments, runtime) {
|
|
407
|
+
if (!runtime.lspRuntime)
|
|
408
|
+
return;
|
|
409
|
+
const args = invocationArguments;
|
|
410
|
+
if (typeof args.path !== "string")
|
|
411
|
+
return;
|
|
412
|
+
try {
|
|
413
|
+
if (toolName === "read") {
|
|
414
|
+
await runtime.lspRuntime.fileSync.handleFileRead(args.path, runtime.operations);
|
|
415
|
+
}
|
|
416
|
+
else if (toolName === "write" || toolName === "edit") {
|
|
417
|
+
await runtime.lspRuntime.fileSync.handleFileWrite(args.path, runtime.operations);
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
catch {
|
|
421
|
+
// Synchronization remains best-effort, matching local AgentSession behavior.
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
function marksToolSideEffect(kind, toolName, sharedMode) {
|
|
425
|
+
return kind !== "read" && !(sharedMode && (toolName === "edit" || toolName === "write"));
|
|
426
|
+
}
|
|
427
|
+
async function invokeDaemonTool(request, params, context, runtime) {
|
|
428
|
+
const toolName = params.toolName;
|
|
429
|
+
const kind = operationKind(toolName);
|
|
430
|
+
if (marksToolSideEffect(kind, toolName, runtime.sharedMode))
|
|
431
|
+
context.markSideEffectStarted();
|
|
432
|
+
let updateQueue = Promise.resolve();
|
|
433
|
+
try {
|
|
434
|
+
const result = await runtime.host.executePrepared(toolName, {
|
|
435
|
+
toolCallId: request.id,
|
|
436
|
+
arguments: params.arguments,
|
|
437
|
+
signal: context.signal,
|
|
438
|
+
executionOptions: params.executionOptions,
|
|
439
|
+
onUpdate: (update) => {
|
|
440
|
+
updateQueue = updateQueue.then(() => context.sendUpdate(portableToolResult(update)));
|
|
441
|
+
},
|
|
442
|
+
});
|
|
443
|
+
await updateQueue;
|
|
444
|
+
await synchronizeDaemonToolFile(toolName, params.arguments, runtime);
|
|
445
|
+
if (kind !== "read")
|
|
446
|
+
context.markCommitted();
|
|
447
|
+
return portableToolResult(result);
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
await updateQueue.catch(() => undefined);
|
|
451
|
+
if (context.signal.aborted) {
|
|
452
|
+
throw requestError("cancelled", "Remote workspace tool invocation was cancelled", kind === "read" ? "not_started" : "indeterminate");
|
|
453
|
+
}
|
|
454
|
+
if (error instanceof RemoteWorkspaceRequestError)
|
|
455
|
+
throw error;
|
|
456
|
+
throw new RemoteWorkspaceRequestError({
|
|
457
|
+
code: "internal_error",
|
|
458
|
+
message: error instanceof Error ? error.message.slice(0, 4096) : "Workspace tool failed",
|
|
459
|
+
executionState: kind === "read" ? "not_started" : "indeterminate",
|
|
460
|
+
retryable: false,
|
|
461
|
+
});
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
async function executeDaemonWorkspaceProcess(params, context, runtime) {
|
|
465
|
+
context.markSideEffectStarted();
|
|
466
|
+
let updateQueue = Promise.resolve();
|
|
467
|
+
let pendingOutputBytes = 0;
|
|
468
|
+
let outputLimitExceeded = false;
|
|
469
|
+
const outputController = new AbortController();
|
|
470
|
+
const signal = AbortSignal.any([context.signal, outputController.signal]);
|
|
471
|
+
let result;
|
|
472
|
+
try {
|
|
473
|
+
result = await runtime.operations.exec(params.command, {
|
|
474
|
+
cwd: params.cwd,
|
|
475
|
+
signal,
|
|
476
|
+
onData: (data) => {
|
|
477
|
+
if (outputLimitExceeded)
|
|
478
|
+
return;
|
|
479
|
+
const chunk = Buffer.from(data);
|
|
480
|
+
pendingOutputBytes += chunk.byteLength;
|
|
481
|
+
if (pendingOutputBytes > runtime.configuration.maxBufferedOutputBytes) {
|
|
482
|
+
outputLimitExceeded = true;
|
|
483
|
+
outputController.abort();
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
updateQueue = updateQueue
|
|
487
|
+
.then(() => context.sendUpdate({ dataBase64: chunk.toString("base64") }))
|
|
488
|
+
.finally(() => {
|
|
489
|
+
pendingOutputBytes -= chunk.byteLength;
|
|
490
|
+
});
|
|
491
|
+
// The process may run after an update fails; observe rejection until the final await.
|
|
492
|
+
void updateQueue.catch(() => undefined);
|
|
493
|
+
},
|
|
494
|
+
});
|
|
495
|
+
}
|
|
496
|
+
catch (error) {
|
|
497
|
+
if (outputLimitExceeded)
|
|
498
|
+
throw new Error("Process output exceeded the daemon buffered-output limit");
|
|
499
|
+
throw error;
|
|
500
|
+
}
|
|
501
|
+
await updateQueue;
|
|
502
|
+
context.markCommitted();
|
|
503
|
+
return result;
|
|
504
|
+
}
|
|
505
|
+
async function readDaemonResource(params, runtime) {
|
|
506
|
+
const path = params.path;
|
|
507
|
+
const resourcePath = path === "SANDBOX.md"
|
|
508
|
+
? runtime.configuration.sandboxInstructionsPath
|
|
509
|
+
: path === "AGENTS.md"
|
|
510
|
+
? runtime.configuration.userAgentsPath
|
|
511
|
+
: undefined;
|
|
512
|
+
if (!resourcePath) {
|
|
513
|
+
throw new RemoteWorkspaceRequestError({
|
|
514
|
+
code: "not_available",
|
|
515
|
+
message: "Requested daemon resource is not available",
|
|
516
|
+
executionState: "not_started",
|
|
517
|
+
retryable: false,
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
return withDaemonWorkspace({ contentBase64: (await readFile(resourcePath)).toString("base64") }, runtime.workspace);
|
|
521
|
+
}
|
|
522
|
+
function getDaemonLspStatus(runtime) {
|
|
523
|
+
if (!runtime.lspRuntime) {
|
|
524
|
+
throw new RemoteWorkspaceRequestError({
|
|
525
|
+
code: "not_available",
|
|
526
|
+
message: "Daemon LSP is not configured",
|
|
527
|
+
executionState: "not_started",
|
|
528
|
+
retryable: false,
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
return {
|
|
532
|
+
enabled: true,
|
|
533
|
+
servers: runtime.lspRuntime.manager.getStatus().map((status) => sanitizeLspStatus(status, runtime.configuration)),
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
async function statDaemonWorkspace(path, runtime) {
|
|
537
|
+
try {
|
|
538
|
+
const value = await runtime.operations.stat(path);
|
|
539
|
+
return withDaemonWorkspace({ kind: value.isDirectory() ? "directory" : value.isFile() ? "file" : "other" }, runtime.workspace);
|
|
540
|
+
}
|
|
541
|
+
catch (error) {
|
|
542
|
+
if (!runtime.sharedMode || !isMissingPath(error))
|
|
543
|
+
throw error;
|
|
544
|
+
return withDaemonWorkspace({ kind: "absent" }, runtime.workspace);
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
async function dispatchDaemonWorkspaceRequest(request, context, runtime) {
|
|
548
|
+
const params = request.params;
|
|
549
|
+
switch (request.method) {
|
|
550
|
+
case "tool.invoke":
|
|
551
|
+
return invokeDaemonTool(request, params, context, runtime);
|
|
552
|
+
case "workspace.access":
|
|
553
|
+
await runtime.operations.access(params.path, params.mode);
|
|
554
|
+
return {};
|
|
555
|
+
case "workspace.read":
|
|
556
|
+
return withDaemonWorkspace({ contentBase64: (await runtime.operations.readFile(params.path)).toString("base64") }, runtime.workspace);
|
|
557
|
+
case "workspace.write":
|
|
558
|
+
if (!runtime.sharedMode)
|
|
559
|
+
context.markSideEffectStarted();
|
|
560
|
+
await withFileMutationQueue(resolve(runtime.configuration.workspaceRoot, params.path), () => runtime.operations.writeFile(params.path, Buffer.from(params.contentBase64, "base64")));
|
|
561
|
+
context.markCommitted();
|
|
562
|
+
return {};
|
|
563
|
+
case "workspace.mkdir":
|
|
564
|
+
if (!runtime.sharedMode)
|
|
565
|
+
context.markSideEffectStarted();
|
|
566
|
+
await withFileMutationQueue(resolve(runtime.configuration.workspaceRoot, params.path), () => {
|
|
567
|
+
if (runtime.sharedMode) {
|
|
568
|
+
if (context.signal.aborted)
|
|
569
|
+
throw requestError("cancelled", "Shared directory creation was cancelled before starting", "not_started");
|
|
570
|
+
context.markSideEffectStarted();
|
|
571
|
+
}
|
|
572
|
+
return runtime.operations.mkdir(params.path, { recursive: params.recursive === true });
|
|
573
|
+
});
|
|
574
|
+
context.markCommitted();
|
|
575
|
+
return {};
|
|
576
|
+
case "workspace.stat":
|
|
577
|
+
return statDaemonWorkspace(params.path, runtime);
|
|
578
|
+
case "workspace.readdir":
|
|
579
|
+
return withDaemonWorkspace({ entries: await runtime.operations.readdir(params.path) }, runtime.workspace);
|
|
580
|
+
case "workspace.glob":
|
|
581
|
+
return withDaemonWorkspace({
|
|
582
|
+
matches: await runtime.operations.glob(params.pattern, params.cwd, {
|
|
583
|
+
ignore: params.ignore,
|
|
584
|
+
limit: params.limit,
|
|
585
|
+
}),
|
|
586
|
+
}, runtime.workspace);
|
|
587
|
+
case "workspace.grep": {
|
|
588
|
+
const result = await runtime.operations.grep(params);
|
|
589
|
+
return withDaemonWorkspace(result, runtime.workspace);
|
|
590
|
+
}
|
|
591
|
+
case "workspace.detect_image_mime":
|
|
592
|
+
return withDaemonWorkspace({ mimeType: (await runtime.operations.detectImageMimeType(params.path)) ?? null }, runtime.workspace);
|
|
593
|
+
case "workspace.exec":
|
|
594
|
+
return executeDaemonWorkspaceProcess(params, context, runtime);
|
|
595
|
+
case "resource.read":
|
|
596
|
+
return readDaemonResource(params, runtime);
|
|
597
|
+
case "lsp.status":
|
|
598
|
+
return getDaemonLspStatus(runtime);
|
|
599
|
+
default:
|
|
600
|
+
throw new RemoteWorkspaceRequestError({
|
|
601
|
+
code: "method_not_supported",
|
|
602
|
+
message: `Workspace operation is not implemented: ${request.method}`,
|
|
603
|
+
executionState: "not_started",
|
|
604
|
+
retryable: false,
|
|
605
|
+
});
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
export function createDaemonWorkspaceRuntime(configuration) {
|
|
609
|
+
const operations = new ConfinedDaemonToolOperations(configuration);
|
|
610
|
+
const toolNames = ["read", "edit", "write", "grep", "find", "ls"];
|
|
611
|
+
if (configuration.allowProcessExec)
|
|
612
|
+
toolNames.splice(1, 0, "bash");
|
|
613
|
+
const lspConfiguration = loadDaemonLspConfiguration(configuration);
|
|
614
|
+
const lspRuntime = lspConfiguration.enabled
|
|
615
|
+
? createLspRuntimeState(configuration.workspaceRoot, {
|
|
616
|
+
configuration: lspConfiguration,
|
|
617
|
+
getToolBackendInfo: () => operations.getBackendInfo(),
|
|
618
|
+
getToolOperations: () => operations,
|
|
619
|
+
resolveConnectionFactory: (transport) => transport.type === "spawn"
|
|
620
|
+
? createManagedStdioConnectionFactory({
|
|
621
|
+
...transport,
|
|
622
|
+
env: operations.createChildEnvironment(transport.env),
|
|
623
|
+
inheritEnvironment: false,
|
|
624
|
+
})
|
|
625
|
+
: resolveLspConnectionFactory(transport),
|
|
626
|
+
})
|
|
627
|
+
: undefined;
|
|
628
|
+
const host = new WorkspaceToolHost({
|
|
629
|
+
cwd: configuration.workspaceRoot,
|
|
630
|
+
operations,
|
|
631
|
+
toolNames,
|
|
632
|
+
additionalDefinitions: lspRuntime
|
|
633
|
+
? createLspToolDefinitions(() => lspRuntime, () => operations)
|
|
634
|
+
: undefined,
|
|
635
|
+
disposeTimeoutMs: Math.min(configuration.shutdownTimeoutMs, 60_000),
|
|
636
|
+
});
|
|
637
|
+
const catalog = {
|
|
638
|
+
generation: 1,
|
|
639
|
+
tools: host.getCatalog().map((entry) => ({
|
|
640
|
+
name: entry.name,
|
|
641
|
+
executionMode: operationKind(entry.name),
|
|
642
|
+
parameterSchema: structuredClone(entry.parameters),
|
|
643
|
+
schemaHash: hashRemoteWorkspaceJson(entry.parameters),
|
|
644
|
+
featureFlags: [],
|
|
645
|
+
})),
|
|
646
|
+
operations: [
|
|
647
|
+
...PRIMITIVE_OPERATIONS.filter((method) => method !== "workspace.exec" || configuration.allowProcessExec),
|
|
648
|
+
...(configuration.sandboxInstructionsPath || configuration.userAgentsPath ? ["resource.read"] : []),
|
|
649
|
+
...(lspRuntime ? ["lsp.status"] : []),
|
|
650
|
+
],
|
|
651
|
+
};
|
|
652
|
+
const capabilities = [
|
|
653
|
+
"catalog_refresh",
|
|
654
|
+
"primitive_operations",
|
|
655
|
+
"tool_updates",
|
|
656
|
+
...(lspRuntime ? ["lsp_status"] : []),
|
|
657
|
+
];
|
|
658
|
+
let activeRequests = 0;
|
|
659
|
+
return {
|
|
660
|
+
operations,
|
|
661
|
+
host,
|
|
662
|
+
lspRuntime,
|
|
663
|
+
catalog,
|
|
664
|
+
capabilities,
|
|
665
|
+
createHandler(workspace, sharedMode = false) {
|
|
666
|
+
const requestRuntime = {
|
|
667
|
+
configuration,
|
|
668
|
+
operations,
|
|
669
|
+
host,
|
|
670
|
+
lspRuntime,
|
|
671
|
+
workspace,
|
|
672
|
+
sharedMode,
|
|
673
|
+
};
|
|
674
|
+
return {
|
|
675
|
+
validateToolArguments: (toolName, value) => host.validatePreparedArguments(toolName, value),
|
|
676
|
+
async handleRequest(request, context) {
|
|
677
|
+
if (activeRequests >= configuration.maxGlobalRequests) {
|
|
678
|
+
throw new RemoteWorkspaceRequestError({
|
|
679
|
+
code: "limit_exceeded",
|
|
680
|
+
message: "Daemon global active request limit reached",
|
|
681
|
+
executionState: "not_started",
|
|
682
|
+
retryable: true,
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
activeRequests++;
|
|
686
|
+
try {
|
|
687
|
+
return await dispatchDaemonWorkspaceRequest(request, context, requestRuntime);
|
|
688
|
+
}
|
|
689
|
+
finally {
|
|
690
|
+
activeRequests--;
|
|
691
|
+
}
|
|
692
|
+
},
|
|
693
|
+
};
|
|
694
|
+
},
|
|
695
|
+
retire: async () => {
|
|
696
|
+
await host.waitForIdle(configuration.shutdownTimeoutMs);
|
|
697
|
+
await lspRuntime?.manager.shutdownAll();
|
|
698
|
+
await host.dispose();
|
|
699
|
+
},
|
|
700
|
+
dispose: async () => {
|
|
701
|
+
await Promise.all([lspRuntime?.manager.shutdownAll(), host.dispose()]);
|
|
702
|
+
},
|
|
703
|
+
};
|
|
704
|
+
}
|
|
705
|
+
//# sourceMappingURL=workspace-runtime.js.map
|