@greppleai/grip 0.1.5 → 0.1.7
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 +35 -0
- package/README.md +1 -1
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/embedded-assets.d.ts.map +1 -1
- package/dist/bun/embedded-assets.js.map +1 -1
- package/dist/bun/register-bedrock.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.d.ts.map +1 -1
- package/dist/bun/restore-sandbox-env.js.map +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/config-selector.d.ts.map +1 -1
- package/dist/cli/config-selector.js.map +1 -1
- package/dist/cli/file-processor.d.ts.map +1 -1
- package/dist/cli/file-processor.js.map +1 -1
- package/dist/cli/initial-message.d.ts +1 -1
- package/dist/cli/initial-message.d.ts.map +1 -1
- package/dist/cli/initial-message.js.map +1 -1
- package/dist/cli/list-models.d.ts.map +1 -1
- package/dist/cli/list-models.js.map +1 -1
- package/dist/cli/session-picker.d.ts.map +1 -1
- package/dist/cli/session-picker.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +2 -0
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +38 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +289 -154
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/auth-guidance.d.ts.map +1 -1
- package/dist/core/auth-guidance.js.map +1 -1
- package/dist/core/auth-storage.d.ts +4 -0
- package/dist/core/auth-storage.d.ts.map +1 -1
- package/dist/core/auth-storage.js +3 -10
- package/dist/core/auth-storage.js.map +1 -1
- package/dist/core/bash-executor.d.ts.map +1 -1
- package/dist/core/bash-executor.js +19 -23
- package/dist/core/bash-executor.js.map +1 -1
- package/dist/core/compaction/branch-summarization.d.ts.map +1 -1
- package/dist/core/compaction/branch-summarization.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +9 -2
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/compaction/compression-detection-ledger.d.ts.map +1 -1
- package/dist/core/compaction/compression-detection-ledger.js.map +1 -1
- package/dist/core/compaction/compression-detector.d.ts +1 -0
- package/dist/core/compaction/compression-detector.d.ts.map +1 -1
- package/dist/core/compaction/compression-detector.js +10 -21
- package/dist/core/compaction/compression-detector.js.map +1 -1
- package/dist/core/compaction/compression-economics.d.ts.map +1 -1
- package/dist/core/compaction/compression-economics.js.map +1 -1
- package/dist/core/compaction/utils.d.ts.map +1 -1
- package/dist/core/compaction/utils.js.map +1 -1
- package/dist/core/defaults.d.ts.map +1 -1
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/event-bus.d.ts.map +1 -1
- package/dist/core/event-bus.js.map +1 -1
- package/dist/core/exec.d.ts.map +1 -1
- package/dist/core/exec.js.map +1 -1
- package/dist/core/export-html/ansi-to-html.d.ts.map +1 -1
- package/dist/core/export-html/ansi-to-html.js.map +1 -1
- package/dist/core/export-html/index.d.ts.map +1 -1
- package/dist/core/export-html/index.js.map +1 -1
- package/dist/core/export-html/tool-renderer.d.ts.map +1 -1
- package/dist/core/export-html/tool-renderer.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +3 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +40 -30
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +21 -1
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +15 -16
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/grip-agent.d.ts.map +1 -1
- package/dist/core/grip-agent.js +7 -21
- package/dist/core/grip-agent.js.map +1 -1
- package/dist/core/grip-manifest.d.ts.map +1 -1
- package/dist/core/grip-manifest.js.map +1 -1
- package/dist/core/hooks/aggregate.d.ts.map +1 -1
- package/dist/core/hooks/aggregate.js.map +1 -1
- package/dist/core/hooks/config.d.ts.map +1 -1
- package/dist/core/hooks/config.js.map +1 -1
- package/dist/core/hooks/executor.d.ts.map +1 -1
- package/dist/core/hooks/executor.js.map +1 -1
- package/dist/core/hooks/index.d.ts.map +1 -1
- package/dist/core/hooks/index.js.map +1 -1
- package/dist/core/hooks/matcher.d.ts.map +1 -1
- package/dist/core/hooks/matcher.js.map +1 -1
- package/dist/core/hooks/trust-store.d.ts.map +1 -1
- package/dist/core/hooks/trust-store.js +0 -3
- package/dist/core/hooks/trust-store.js.map +1 -1
- package/dist/core/hooks/types.d.ts.map +1 -1
- package/dist/core/hooks/types.js.map +1 -1
- package/dist/core/http-dispatcher.d.ts.map +1 -1
- package/dist/core/http-dispatcher.js.map +1 -1
- package/dist/core/instruction-resource-loader.d.ts +1 -0
- package/dist/core/instruction-resource-loader.d.ts.map +1 -1
- package/dist/core/instruction-resource-loader.js +2 -4
- package/dist/core/instruction-resource-loader.js.map +1 -1
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +0 -1
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/lsp/abort.d.ts.map +1 -1
- package/dist/core/lsp/abort.js.map +1 -1
- package/dist/core/lsp/client.d.ts.map +1 -1
- package/dist/core/lsp/client.js +8 -22
- package/dist/core/lsp/client.js.map +1 -1
- package/dist/core/lsp/config-loader.d.ts.map +1 -1
- package/dist/core/lsp/config-loader.js.map +1 -1
- package/dist/core/lsp/config.d.ts.map +1 -1
- package/dist/core/lsp/config.js.map +1 -1
- package/dist/core/lsp/diagnostics.d.ts.map +1 -1
- package/dist/core/lsp/diagnostics.js.map +1 -1
- package/dist/core/lsp/file-sync.d.ts.map +1 -1
- package/dist/core/lsp/file-sync.js +7 -9
- package/dist/core/lsp/file-sync.js.map +1 -1
- package/dist/core/lsp/integration.d.ts.map +1 -1
- package/dist/core/lsp/integration.js.map +1 -1
- package/dist/core/lsp/language-map.d.ts.map +1 -1
- package/dist/core/lsp/language-map.js +2 -7
- package/dist/core/lsp/language-map.js.map +1 -1
- package/dist/core/lsp/manager.d.ts.map +1 -1
- package/dist/core/lsp/manager.js +18 -29
- package/dist/core/lsp/manager.js.map +1 -1
- package/dist/core/lsp/navigation.d.ts.map +1 -1
- package/dist/core/lsp/navigation.js.map +1 -1
- package/dist/core/lsp/portable-path.d.ts.map +1 -1
- package/dist/core/lsp/portable-path.js.map +1 -1
- package/dist/core/lsp/refactor.d.ts.map +1 -1
- package/dist/core/lsp/refactor.js.map +1 -1
- package/dist/core/lsp/transport.d.ts.map +1 -1
- package/dist/core/lsp/transport.js.map +1 -1
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +30 -1
- package/dist/core/messages.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +5 -7
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/model-resolver.d.ts.map +1 -1
- package/dist/core/model-resolver.js.map +1 -1
- package/dist/core/output-guard.d.ts.map +1 -1
- package/dist/core/output-guard.js.map +1 -1
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +0 -6
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/prompt-templates.d.ts.map +1 -1
- package/dist/core/prompt-templates.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/contract.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/contract.js +4 -2
- package/dist/core/remote-workspace-protocol/contract.js.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-client.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-client.js +1 -5
- package/dist/core/remote-workspace-protocol/guest-shared-client.js.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js +5 -10
- package/dist/core/remote-workspace-protocol/guest-shared-outbound-scheduler.js.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.js +2 -9
- package/dist/core/remote-workspace-protocol/guest-shared-uplink.js.map +1 -1
- package/dist/core/remote-workspace-protocol/lima-owner-directory.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/lima-owner-directory.js.map +1 -1
- package/dist/core/remote-workspace-protocol/lima-owner-lock.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/lima-owner-lock.js.map +1 -1
- package/dist/core/remote-workspace-protocol/session.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/session.js +27 -65
- package/dist/core/remote-workspace-protocol/session.js.map +1 -1
- package/dist/core/remote-workspace-protocol/shared-transport.d.ts.map +1 -1
- package/dist/core/remote-workspace-protocol/shared-transport.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +0 -48
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/rules.d.ts.map +1 -1
- package/dist/core/rules.js.map +1 -1
- package/dist/core/sandbox/command.d.ts.map +1 -1
- package/dist/core/sandbox/command.js.map +1 -1
- package/dist/core/sandbox/config.d.ts.map +1 -1
- package/dist/core/sandbox/config.js.map +1 -1
- package/dist/core/sandbox/lima-guest-binary.d.ts.map +1 -1
- package/dist/core/sandbox/lima-guest-binary.js.map +1 -1
- package/dist/core/sandbox/lima.d.ts +2 -0
- package/dist/core/sandbox/lima.d.ts.map +1 -1
- package/dist/core/sandbox/lima.js +3 -9
- package/dist/core/sandbox/lima.js.map +1 -1
- package/dist/core/sandbox/shared-lima-roots.d.ts.map +1 -1
- package/dist/core/sandbox/shared-lima-roots.js.map +1 -1
- package/dist/core/sandbox/update-shared-guest-binary.d.ts.map +1 -1
- package/dist/core/sandbox/update-shared-guest-binary.js.map +1 -1
- package/dist/core/session/constants.d.ts.map +1 -1
- package/dist/core/session/context-metadata.d.ts.map +1 -1
- package/dist/core/session/context-metadata.js.map +1 -1
- package/dist/core/session/context.d.ts.map +1 -1
- package/dist/core/session/context.js.map +1 -1
- package/dist/core/session/ids.d.ts.map +1 -1
- package/dist/core/session/ids.js.map +1 -1
- package/dist/core/session/in-memory-session-manager.d.ts.map +1 -1
- package/dist/core/session/in-memory-session-manager.js +0 -1
- package/dist/core/session/in-memory-session-manager.js.map +1 -1
- package/dist/core/session/in-memory-session.d.ts.map +1 -1
- package/dist/core/session/in-memory-session.js.map +1 -1
- package/dist/core/session/jsonl-errors.d.ts.map +1 -1
- package/dist/core/session/jsonl-errors.js +0 -11
- package/dist/core/session/jsonl-errors.js.map +1 -1
- package/dist/core/session/jsonl-helpers.d.ts.map +1 -1
- package/dist/core/session/jsonl-helpers.js.map +1 -1
- package/dist/core/session/local-session-manager.d.ts.map +1 -1
- package/dist/core/session/local-session-manager.js +4 -6
- package/dist/core/session/local-session-manager.js.map +1 -1
- package/dist/core/session/local-session.d.ts.map +1 -1
- package/dist/core/session/local-session.js.map +1 -1
- package/dist/core/session/migrations.d.ts.map +1 -1
- package/dist/core/session/migrations.js.map +1 -1
- package/dist/core/session/remote-session-client.d.ts.map +1 -1
- package/dist/core/session/remote-session-client.js +0 -6
- package/dist/core/session/remote-session-client.js.map +1 -1
- package/dist/core/session/remote-session-manager.d.ts.map +1 -1
- package/dist/core/session/remote-session-manager.js +0 -3
- package/dist/core/session/remote-session-manager.js.map +1 -1
- package/dist/core/session/remote-session.d.ts.map +1 -1
- package/dist/core/session/remote-session.js +0 -1
- package/dist/core/session/remote-session.js.map +1 -1
- package/dist/core/session/session-manager.d.ts.map +1 -1
- package/dist/core/session/session.d.ts.map +1 -1
- package/dist/core/session/session.js +1 -5
- package/dist/core/session/session.js.map +1 -1
- package/dist/core/session/stores/in-memory-session-store.d.ts.map +1 -1
- package/dist/core/session/stores/in-memory-session-store.js +7 -6
- package/dist/core/session/stores/in-memory-session-store.js.map +1 -1
- package/dist/core/session/stores/jsonl-session-store.d.ts.map +1 -1
- package/dist/core/session/stores/jsonl-session-store.js +6 -14
- package/dist/core/session/stores/jsonl-session-store.js.map +1 -1
- package/dist/core/session/stores/remote-session-store.d.ts.map +1 -1
- package/dist/core/session/stores/remote-session-store.js +3 -8
- package/dist/core/session/stores/remote-session-store.js.map +1 -1
- package/dist/core/session/stores/session-store.d.ts.map +1 -1
- package/dist/core/session/types.d.ts.map +1 -1
- package/dist/core/session/usage-ledger.d.ts.map +1 -1
- package/dist/core/session/usage-ledger.js.map +1 -1
- package/dist/core/session-cwd.d.ts.map +1 -1
- package/dist/core/session-cwd.js +0 -1
- package/dist/core/session-cwd.js.map +1 -1
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +9 -17
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +3 -2
- package/dist/core/skills.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/source-info.d.ts.map +1 -1
- package/dist/core/source-info.js.map +1 -1
- package/dist/core/system-prompt.d.ts +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +3 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/telemetry.d.ts.map +1 -1
- package/dist/core/telemetry.js.map +1 -1
- package/dist/core/timings.d.ts.map +1 -1
- package/dist/core/timings.js.map +1 -1
- package/dist/core/tools/bash.d.ts +1 -0
- package/dist/core/tools/bash.d.ts.map +1 -1
- package/dist/core/tools/bash.js +34 -28
- package/dist/core/tools/bash.js.map +1 -1
- package/dist/core/tools/compress-context.d.ts.map +1 -1
- package/dist/core/tools/compress-context.js.map +1 -1
- package/dist/core/tools/edit-diff.d.ts.map +1 -1
- package/dist/core/tools/edit-diff.js.map +1 -1
- package/dist/core/tools/edit.d.ts.map +1 -1
- package/dist/core/tools/edit.js.map +1 -1
- package/dist/core/tools/file-mutation-queue.d.ts.map +1 -1
- package/dist/core/tools/file-mutation-queue.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js.map +1 -1
- package/dist/core/tools/grep.d.ts.map +1 -1
- package/dist/core/tools/grep.js.map +1 -1
- package/dist/core/tools/hash-store.d.ts.map +1 -1
- package/dist/core/tools/hash-store.js.map +1 -1
- package/dist/core/tools/hashline/apply.d.ts.map +1 -1
- package/dist/core/tools/hashline/apply.js.map +1 -1
- package/dist/core/tools/hashline/hash.d.ts.map +1 -1
- package/dist/core/tools/hashline/hash.js.map +1 -1
- package/dist/core/tools/hashline/parse.d.ts.map +1 -1
- package/dist/core/tools/hashline/parse.js.map +1 -1
- package/dist/core/tools/hashline/resolve.d.ts.map +1 -1
- package/dist/core/tools/hashline/resolve.js.map +1 -1
- package/dist/core/tools/hashline-utils.d.ts.map +1 -1
- package/dist/core/tools/hashline-utils.js.map +1 -1
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/core/tools/ls.d.ts.map +1 -1
- package/dist/core/tools/ls.js.map +1 -1
- package/dist/core/tools/operations.d.ts +11 -0
- package/dist/core/tools/operations.d.ts.map +1 -1
- package/dist/core/tools/operations.js +54 -28
- package/dist/core/tools/operations.js.map +1 -1
- package/dist/core/tools/output-accumulator.d.ts.map +1 -1
- package/dist/core/tools/output-accumulator.js +12 -18
- package/dist/core/tools/output-accumulator.js.map +1 -1
- package/dist/core/tools/path-utils.d.ts.map +1 -1
- package/dist/core/tools/path-utils.js.map +1 -1
- package/dist/core/tools/read.d.ts.map +1 -1
- package/dist/core/tools/read.js.map +1 -1
- package/dist/core/tools/render-utils.d.ts.map +1 -1
- package/dist/core/tools/render-utils.js.map +1 -1
- package/dist/core/tools/replace-diff.d.ts.map +1 -1
- package/dist/core/tools/replace-diff.js.map +1 -1
- package/dist/core/tools/replace-normalize.d.ts.map +1 -1
- package/dist/core/tools/replace-normalize.js.map +1 -1
- package/dist/core/tools/replace-render.d.ts +1 -1
- package/dist/core/tools/replace-render.d.ts.map +1 -1
- package/dist/core/tools/replace-render.js.map +1 -1
- package/dist/core/tools/runtime.d.ts.map +1 -1
- package/dist/core/tools/runtime.js.map +1 -1
- package/dist/core/tools/session-history.d.ts.map +1 -1
- package/dist/core/tools/session-history.js.map +1 -1
- package/dist/core/tools/subagent-agents.d.ts.map +1 -1
- package/dist/core/tools/subagent-agents.js.map +1 -1
- package/dist/core/tools/subagent.d.ts.map +1 -1
- package/dist/core/tools/subagent.js.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.d.ts.map +1 -1
- package/dist/core/tools/tool-definition-wrapper.js.map +1 -1
- package/dist/core/tools/truncate.d.ts.map +1 -1
- package/dist/core/tools/truncate.js.map +1 -1
- package/dist/core/tools/websearch.d.ts.map +1 -1
- package/dist/core/tools/websearch.js.map +1 -1
- package/dist/core/tools/workspace-tool-host.d.ts +1 -0
- package/dist/core/tools/workspace-tool-host.d.ts.map +1 -1
- package/dist/core/tools/workspace-tool-host.js +36 -22
- package/dist/core/tools/workspace-tool-host.js.map +1 -1
- package/dist/core/tools/write.d.ts.map +1 -1
- package/dist/core/tools/write.js +0 -1
- package/dist/core/tools/write.js.map +1 -1
- package/dist/core/workspace-identity.d.ts.map +1 -1
- package/dist/daemon/activity-budget.d.ts.map +1 -1
- package/dist/daemon/activity-budget.js +2 -3
- package/dist/daemon/activity-budget.js.map +1 -1
- package/dist/daemon/command.d.ts.map +1 -1
- package/dist/daemon/command.js.map +1 -1
- package/dist/daemon/config.d.ts +2 -0
- package/dist/daemon/config.d.ts.map +1 -1
- package/dist/daemon/config.js +4 -0
- package/dist/daemon/config.js.map +1 -1
- package/dist/daemon/help.d.ts.map +1 -1
- package/dist/daemon/help.js +4 -3
- package/dist/daemon/help.js.map +1 -1
- package/dist/daemon/lsp-config.d.ts.map +1 -1
- package/dist/daemon/lsp-config.js.map +1 -1
- package/dist/daemon/outbound-budget.d.ts.map +1 -1
- package/dist/daemon/outbound-budget.js +2 -4
- package/dist/daemon/outbound-budget.js.map +1 -1
- package/dist/daemon/security.d.ts.map +1 -1
- package/dist/daemon/security.js.map +1 -1
- package/dist/daemon/server.d.ts.map +1 -1
- package/dist/daemon/server.js.map +1 -1
- package/dist/daemon/shared-connection.d.ts.map +1 -1
- package/dist/daemon/shared-connection.js +10 -15
- package/dist/daemon/shared-connection.js.map +1 -1
- package/dist/daemon/shared-revision.d.ts.map +1 -1
- package/dist/daemon/shared-revision.js +2 -1
- package/dist/daemon/shared-revision.js.map +1 -1
- package/dist/daemon/shared-roots.d.ts.map +1 -1
- package/dist/daemon/shared-roots.js +0 -1
- package/dist/daemon/shared-roots.js.map +1 -1
- package/dist/daemon/workspace-runtime.d.ts +2 -0
- package/dist/daemon/workspace-runtime.d.ts.map +1 -1
- package/dist/daemon/workspace-runtime.js +43 -15
- package/dist/daemon/workspace-runtime.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +8 -3
- package/dist/main.js.map +1 -1
- package/dist/migrations.d.ts.map +1 -1
- package/dist/migrations.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +3 -10
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/bash-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/bash-execution.js +4 -9
- package/dist/modes/interactive/components/bash-execution.js.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.d.ts.map +1 -1
- package/dist/modes/interactive/components/bordered-loader.js +0 -3
- package/dist/modes/interactive/components/bordered-loader.js.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/branch-summary-message.js +1 -3
- package/dist/modes/interactive/components/branch-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/compaction-summary-message.js +1 -3
- package/dist/modes/interactive/components/compaction-summary-message.js.map +1 -1
- package/dist/modes/interactive/components/config-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/config-selector.js +6 -16
- package/dist/modes/interactive/components/config-selector.js.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.d.ts.map +1 -1
- package/dist/modes/interactive/components/countdown-timer.js +0 -5
- package/dist/modes/interactive/components/countdown-timer.js.map +1 -1
- package/dist/modes/interactive/components/custom-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-editor.js +1 -8
- package/dist/modes/interactive/components/custom-editor.js.map +1 -1
- package/dist/modes/interactive/components/custom-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/custom-message.js +1 -6
- package/dist/modes/interactive/components/custom-message.js.map +1 -1
- package/dist/modes/interactive/components/diff.d.ts.map +1 -1
- package/dist/modes/interactive/components/diff.js.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.d.ts.map +1 -1
- package/dist/modes/interactive/components/dynamic-border.js +0 -1
- package/dist/modes/interactive/components/dynamic-border.js.map +1 -1
- package/dist/modes/interactive/components/extension-editor.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-editor.js +1 -7
- package/dist/modes/interactive/components/extension-editor.js.map +1 -1
- package/dist/modes/interactive/components/extension-input.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-input.js +2 -8
- package/dist/modes/interactive/components/extension-input.js.map +1 -1
- package/dist/modes/interactive/components/extension-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/extension-selector.js +1 -9
- package/dist/modes/interactive/components/extension-selector.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +8 -4
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/hook-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/hook-execution.js +2 -5
- package/dist/modes/interactive/components/hook-execution.js.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.d.ts.map +1 -1
- package/dist/modes/interactive/components/keybinding-hints.js.map +1 -1
- package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/dist/modes/interactive/components/login-dialog.js +3 -9
- package/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.d.ts.map +1 -1
- package/dist/modes/interactive/components/markdown-transform.js.map +1 -1
- package/dist/modes/interactive/components/mermaid.d.ts.map +1 -1
- package/dist/modes/interactive/components/mermaid.js.map +1 -1
- package/dist/modes/interactive/components/message-card.d.ts.map +1 -1
- package/dist/modes/interactive/components/message-card.js +0 -1
- package/dist/modes/interactive/components/message-card.js.map +1 -1
- package/dist/modes/interactive/components/model-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/model-selector.js +13 -28
- package/dist/modes/interactive/components/model-selector.js.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/oauth-selector.js +3 -12
- package/dist/modes/interactive/components/oauth-selector.js.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/scoped-models-selector.js +9 -13
- package/dist/modes/interactive/components/scoped-models-selector.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +33 -58
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +0 -4
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/show-images-selector.js +0 -1
- package/dist/modes/interactive/components/show-images-selector.js.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/skill-invocation-message.js +1 -3
- package/dist/modes/interactive/components/skill-invocation-message.js.map +1 -1
- package/dist/modes/interactive/components/theme-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/theme-selector.js +0 -2
- package/dist/modes/interactive/components/theme-selector.js.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/thinking-selector.js +0 -1
- package/dist/modes/interactive/components/thinking-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +9 -24
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tree-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/tree-selector.js +18 -34
- package/dist/modes/interactive/components/tree-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message-selector.js +3 -6
- package/dist/modes/interactive/components/user-message-selector.js.map +1 -1
- package/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/user-message.js +0 -4
- package/dist/modes/interactive/components/user-message.js.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.d.ts.map +1 -1
- package/dist/modes/interactive/components/visual-truncate.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +13 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +162 -136
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/dist/modes/interactive/theme/theme.js +0 -7
- package/dist/modes/interactive/theme/theme.js.map +1 -1
- package/dist/modes/json-event.d.ts.map +1 -1
- package/dist/modes/json-event.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js.map +1 -1
- package/dist/modes/rpc/jsonl.d.ts.map +1 -1
- package/dist/modes/rpc/jsonl.js.map +1 -1
- package/dist/modes/rpc/rpc-client.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-client.js +10 -11
- package/dist/modes/rpc/rpc-client.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/package-manager-cli.d.ts.map +1 -1
- package/dist/package-manager-cli.js +33 -2
- package/dist/package-manager-cli.js.map +1 -1
- package/dist/utils/ansi.d.ts.map +1 -1
- package/dist/utils/ansi.js.map +1 -1
- package/dist/utils/binary-self-update.d.ts +25 -0
- package/dist/utils/binary-self-update.d.ts.map +1 -0
- package/dist/utils/binary-self-update.js +159 -0
- package/dist/utils/binary-self-update.js.map +1 -0
- package/dist/utils/changelog.d.ts.map +1 -1
- package/dist/utils/changelog.js.map +1 -1
- package/dist/utils/child-process.d.ts.map +1 -1
- package/dist/utils/child-process.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard-native.d.ts.map +1 -1
- package/dist/utils/clipboard-native.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/deprecation.d.ts.map +1 -1
- package/dist/utils/deprecation.js.map +1 -1
- package/dist/utils/directory-completions.d.ts +8 -0
- package/dist/utils/directory-completions.d.ts.map +1 -1
- package/dist/utils/directory-completions.js +42 -1
- package/dist/utils/directory-completions.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts.map +1 -1
- package/dist/utils/exif-orientation.js.map +1 -1
- package/dist/utils/frontmatter.d.ts.map +1 -1
- package/dist/utils/frontmatter.js.map +1 -1
- package/dist/utils/fs-watch.d.ts.map +1 -1
- package/dist/utils/fs-watch.js.map +1 -1
- package/dist/utils/git.d.ts.map +1 -1
- package/dist/utils/git.js.map +1 -1
- package/dist/utils/grip-user-agent.d.ts.map +1 -1
- package/dist/utils/grip-user-agent.js.map +1 -1
- package/dist/utils/html.d.ts.map +1 -1
- package/dist/utils/html.js.map +1 -1
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-process.d.ts.map +1 -1
- package/dist/utils/image-process.js.map +1 -1
- package/dist/utils/image-resize-core.d.ts.map +1 -1
- package/dist/utils/image-resize-core.js.map +1 -1
- package/dist/utils/image-resize-worker.d.ts.map +1 -1
- package/dist/utils/image-resize-worker.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/json.d.ts.map +1 -1
- package/dist/utils/json.js.map +1 -1
- package/dist/utils/mime.d.ts.map +1 -1
- package/dist/utils/mime.js.map +1 -1
- package/dist/utils/open-browser.d.ts.map +1 -1
- package/dist/utils/open-browser.js.map +1 -1
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/photon.d.ts.map +1 -1
- package/dist/utils/photon.js +10 -5
- package/dist/utils/photon.js.map +1 -1
- package/dist/utils/shell.d.ts.map +1 -1
- package/dist/utils/shell.js.map +1 -1
- package/dist/utils/sleep.d.ts.map +1 -1
- package/dist/utils/sleep.js.map +1 -1
- package/dist/utils/syntax-highlight.d.ts.map +1 -1
- package/dist/utils/syntax-highlight.js +1 -1
- package/dist/utils/syntax-highlight.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js.map +1 -1
- package/dist/utils/version-check.d.ts.map +1 -1
- package/dist/utils/version-check.js.map +1 -1
- package/dist/utils/windows-self-update.d.ts.map +1 -1
- package/dist/utils/windows-self-update.js.map +1 -1
- package/docs/extensions.md +31 -1
- package/docs/sandbox.md +6 -0
- package/docs/sessions.md +1 -1
- package/docs/skills.md +4 -4
- package/docs/usage.md +2 -1
- package/examples/extensions/custom-provider-anthropic/package.json +2 -2
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/sandbox/package.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +602 -834
- package/package.json +20 -21
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/core/tools/operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkD,KAAK,KAAK,EAAoB,MAAM,SAAS,CAAC;AAWvG,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAa3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAKN,KAAK,eAAe,EAGpB,MAAM,0CAA0C,CAAC;AAOlD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;AACvE,MAAM,MAAM,4BAA4B,GAAG,OAAO,GAAG,QAAQ,GAAG,aAAa,CAAC;AAC9E,MAAM,MAAM,kCAAkC,GAAG,OAAO,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;AAChG,KAAK,2BAA2B,GAAG,IAAI,CAAC;AAExC,MAAM,WAAW,YAAY;IAC5B,WAAW,EAAE,MAAM,OAAO,CAAC;IAC3B,MAAM,EAAE,MAAM,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC/B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM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,GAAG,IAAI,GAAG,SAAS,CAAC,CAG1E;IAED,cAAc,IAAI,eAAe,CAShC;IACD,cAAc,IAAI,OAAO,CAExB;IAED,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAKvB;CACD;AAED,wBAAgB,0BAA0B,CACzC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,kCAAkC,GAC1C,OAAO,CAAC,oBAAoB,CAAC,CAW/B","sourcesContent":["import { type ChildProcess, spawn } from \"node:child_process\";\nimport { createHash } from \"node:crypto\";\nimport { constants, createReadStream, createWriteStream, type Stats, type WriteStream } from \"node:fs\";\nimport {\n\taccess as fsAccess,\n\tmkdir as fsMkdir,\n\treaddir as fsReaddir,\n\treadFile as fsReadFile,\n\tstat as fsStat,\n\twriteFile as fsWriteFile,\n} from \"node:fs/promises\";\nimport { posix, win32 } from \"node:path\";\nimport { pipeline } from \"node:stream/promises\";\nimport type { AgentToolResult, AgentToolUpdateCallback } from \"@greppleai/grip-agent-core\";\nimport WebSocket, { type RawData } from \"ws\";\nimport { DAEMON_WEBSOCKET_PROTOCOL } from \"../../daemon/config.ts\";\nimport { waitForChildProcess } from \"../../utils/child-process.ts\";\nimport { detectSupportedImageMimeTypeFromFile } from \"../../utils/mime.ts\";\nimport {\n\tgetShellConfig,\n\tgetShellEnv,\n\tkillProcessTree,\n\ttrackDetachedChildPid,\n\tuntrackDetachedChildPid,\n} from \"../../utils/shell.ts\";\n\nimport type { PortablePathFlavor } from \"../lsp/portable-path.ts\";\nimport {\n\tDEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n\tdecodeCanonicalBase64,\n\thashRemoteWorkspaceJson,\n\tparseRemoteWorkspaceToolResult,\n\ttype RemoteLspStatus,\n\ttype RemoteWorkspaceClientMessage,\n\ttype RemoteWorkspaceMethod,\n} from \"../remote-workspace-protocol/contract.ts\";\nimport { GuestSharedClientTransport } from \"../remote-workspace-protocol/guest-shared-client.ts\";\nimport {\n\tRemoteWorkspaceClientProtocol,\n\ttype RemoteWorkspaceProtocolCloseReason,\n\tRemoteWorkspaceRequestError,\n} from \"../remote-workspace-protocol/session.ts\";\nimport type { WorkspaceIdentity } from \"../workspace-identity.ts\";\n\nexport type ToolAccessMode = \"exists\" | \"read\" | \"write\" | \"readwrite\";\nexport type WorkspaceToolExecutionTarget = \"local\" | \"remote\" | \"unavailable\";\nexport type RemoteWorkspaceToolExecutionTarget = Exclude<WorkspaceToolExecutionTarget, \"local\">;\ntype RemoteToolTransportProtocol = \"ws\";\n\nexport interface ToolFileStat {\n\tisDirectory: () => boolean;\n\tisFile: () => boolean;\n}\n\nexport interface ToolExecOptions {\n\tcwd?: string;\n\tonData: (data: Buffer) => void;\n\tsignal?: AbortSignal;\n\ttimeout?: number;\n\tenv?: NodeJS.ProcessEnv;\n}\n\nexport interface ToolExecResult {\n\texitCode: number | null;\n}\n\nexport interface ToolMkdirOptions {\n\trecursive?: boolean;\n}\n\nexport interface ToolGlobOptions {\n\tignore: string[];\n\tlimit: number;\n}\n\nexport interface ToolGrepOptions {\n\tpattern: string;\n\tpath: string;\n\tglob?: string;\n\tignoreCase?: boolean;\n\tliteral?: boolean;\n\tlimit: number;\n}\n\nexport interface ToolGrepMatch {\n\tfilePath: string;\n\tlineNumber: number;\n\tlineText?: string;\n}\n\nexport interface ToolGrepResult {\n\tisDirectory: boolean;\n\tmatches: ToolGrepMatch[];\n}\n\nexport type ToolBackendInfo =\n\t| { type: \"local\"; cwd: string }\n\t| { type: \"remote\"; cwd: string; configured: false }\n\t| {\n\t\t\ttype: \"remote\";\n\t\t\tcwd: string;\n\t\t\turl: string;\n\t\t\tprotocol: \"ws\";\n\t\t\tconfigured: true;\n\t\t\tworkspace: WorkspaceIdentity;\n\t };\n\n// grip-ignore noNearIdenticalDataStructures: Remote backend invocations require host-normalized execution options, while public host invocations accept omitted options and apply defaults.\nexport interface WorkspaceToolRemoteInvocation {\n\ttoolCallId: string;\n\targuments: unknown;\n\tsignal?: AbortSignal;\n\tonUpdate?: AgentToolUpdateCallback<unknown>;\n\texecutionOptions: WorkspaceToolExecutionOptions;\n}\n\nexport interface GripSessionEnvironment {\n\tGRIP_SESSION_ID?: string;\n\tGRIP_SESSION_FILE?: string;\n\tGRIP_PROVIDER?: string;\n\tGRIP_MODEL?: string;\n\tGRIP_REASONING_LEVEL?: string;\n}\n\nexport const GRIP_SESSION_ENVIRONMENT_NAMES = Object.freeze([\n\t\"GRIP_SESSION_ID\",\n\t\"GRIP_SESSION_FILE\",\n\t\"GRIP_PROVIDER\",\n\t\"GRIP_MODEL\",\n\t\"GRIP_REASONING_LEVEL\",\n] as const);\n\nexport interface WorkspaceToolExecutionOptions {\n\timageAutoResize?: boolean;\n\tshellCommandPrefix?: string;\n\tsessionEnvironment?: GripSessionEnvironment;\n}\n\ninterface NormalizedRemoteWorkspaceUrl {\n\turl: string;\n\tprotocol: \"ws\";\n}\n\nexport interface DeferredRemoteToolOperationsConnectOptions extends RemoteToolOperationsConnectOptions {\n\texpectedCwd?: string;\n}\n\ntype SharedExpectedRevision = { sha256: string } | { absent: true };\n\nexport type BorrowedToolOperations = Omit<ToolOperations, \"dispose\">;\n\nexport function borrowToolOperations(operations: ToolOperations): BorrowedToolOperations {\n\tconst boundMethods = new Map<PropertyKey, unknown>();\n\treturn new Proxy(operations, {\n\t\tget(target, property, receiver) {\n\t\t\tif (property === \"dispose\") return undefined;\n\t\t\tconst value = Reflect.get(target, property, receiver) as unknown;\n\t\t\tif (typeof value !== \"function\") return value;\n\t\t\tlet bound = boundMethods.get(property);\n\t\t\tif (!bound) {\n\t\t\t\tbound = value.bind(target);\n\t\t\t\tboundMethods.set(property, bound);\n\t\t\t}\n\t\t\treturn bound;\n\t\t},\n\t\thas(target, property) {\n\t\t\treturn property === \"dispose\" ? false : Reflect.has(target, property);\n\t\t},\n\t}) as BorrowedToolOperations;\n}\n\nexport interface ToolOperations {\n\tcwd: string;\n\texec(command: string, options: ToolExecOptions): Promise<ToolExecResult>;\n\taccess(path: string, mode?: ToolAccessMode): Promise<void>;\n\treadFile(path: string): Promise<Buffer>;\n\twriteFile(path: string, content: string | Buffer): Promise<void>;\n\treadResource?(path: string): Promise<Buffer>;\n\tuploadFile?(sourcePath: string, destinationPath: string): Promise<void>;\n\tdownloadFile?(sourcePath: string, destinationPath: string): Promise<void>;\n\tmkdir(path: string, options?: ToolMkdirOptions): Promise<void>;\n\tstat(path: string): Promise<ToolFileStat>;\n\treaddir(path: string): Promise<string[]>;\n\tglob?(pattern: string, cwd: string, options: ToolGlobOptions): Promise<string[]>;\n\tgrep?(options: ToolGrepOptions): Promise<ToolGrepResult>;\n\tdetectImageMimeType?(path: string): Promise<string | null | undefined>;\n\tgetBackendInfo?(): ToolBackendInfo;\n\tresolveWorkspaceToolExecution?(name: string, parameterSchema: unknown): WorkspaceToolExecutionTarget;\n\texecuteWorkspaceTool?(name: string, invocation: WorkspaceToolRemoteInvocation): Promise<AgentToolResult<unknown>>;\n\tonWorkspaceToolCatalogChanged?(listener: () => void | Promise<void>): () => void;\n\tgetRemoteLspStatus?(): RemoteLspStatus;\n\tdispose?(): Promise<void>;\n}\n\nexport interface LocalToolOperationsOptions {\n\tshellPath?: string;\n}\n\nfunction workspaceRootsEqual(left: string, right: string, pathFlavor: PortablePathFlavor): boolean {\n\tif (pathFlavor === \"windows\") return win32.normalize(left).toLowerCase() === win32.normalize(right).toLowerCase();\n\treturn posix.normalize(left) === posix.normalize(right);\n}\n\nfunction accessModeToFsMode(mode: ToolAccessMode | undefined): number {\n\tswitch (mode) {\n\t\tcase \"read\":\n\t\t\treturn constants.R_OK;\n\t\tcase \"write\":\n\t\t\treturn constants.W_OK;\n\t\tcase \"readwrite\":\n\t\t\treturn constants.R_OK | constants.W_OK;\n\t\tcase \"exists\":\n\t\tcase undefined:\n\t\t\treturn constants.F_OK;\n\t}\n}\n\nconst MAX_TIMEOUT_MS = 2_147_483_647;\nconst MAX_TIMEOUT_SECONDS = MAX_TIMEOUT_MS / 1000;\n\nfunction resolveTimeoutMs(timeout: number | undefined): number | undefined {\n\tif (timeout === undefined) return undefined;\n\tif (!Number.isFinite(timeout) || timeout <= 0) {\n\t\tthrow new Error(\"Invalid timeout: must be a finite number of seconds\");\n\t}\n\n\tconst timeoutMs = timeout * 1000;\n\tif (timeoutMs > MAX_TIMEOUT_MS) {\n\t\tthrow new Error(`Invalid timeout: maximum is ${MAX_TIMEOUT_SECONDS} seconds`);\n\t}\n\treturn timeoutMs;\n}\n\nfunction registerChildProcessAbort(signal: AbortSignal | undefined, child: ChildProcess): () => void {\n\tconst onAbort = (): void => {\n\t\tif (child.pid) killProcessTree(child.pid);\n\t};\n\tif (!signal) return () => undefined;\n\tif (signal.aborted) onAbort();\n\telse signal.addEventListener(\"abort\", onAbort, { once: true });\n\treturn () => signal.removeEventListener(\"abort\", onAbort);\n}\n\nfunction terminateLingeringProcessGroup(child: ChildProcess): void {\n\tif (!child.pid || process.platform === \"win32\") return;\n\ttry {\n\t\tprocess.kill(-child.pid, 0);\n\t\tkillProcessTree(child.pid);\n\t} catch {}\n}\n\nfunction cleanupChildExecution(\n\tchild: ChildProcess,\n\ttimeoutHandle: NodeJS.Timeout | undefined,\n\tremoveAbortListener: () => void,\n): void {\n\tif (child.pid) untrackDetachedChildPid(child.pid);\n\tif (timeoutHandle) clearTimeout(timeoutHandle);\n\tremoveAbortListener();\n}\n\nasync function copyFileStream(sourcePath: string, destinationPath: string): Promise<void> {\n\tawait pipeline(createReadStream(sourcePath), createWriteStream(destinationPath));\n}\n\nfunction writeStreamChunk(stream: WriteStream, chunk: Buffer): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst onError = (error: Error) => {\n\t\t\tstream.off(\"error\", onError);\n\t\t\treject(error);\n\t\t};\n\t\tstream.once(\"error\", onError);\n\t\tstream.write(chunk, (error) => {\n\t\t\tstream.off(\"error\", onError);\n\t\t\tif (error) {\n\t\t\t\treject(error);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tresolve();\n\t\t});\n\t});\n}\n\nfunction endWriteStream(stream: WriteStream): Promise<void> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst onError = (error: Error) => {\n\t\t\tstream.off(\"error\", onError);\n\t\t\treject(error);\n\t\t};\n\t\tstream.once(\"error\", onError);\n\t\tstream.end(() => {\n\t\t\tstream.off(\"error\", onError);\n\t\t\tresolve();\n\t\t});\n\t});\n}\n\nexport class LocalToolOperations implements ToolOperations {\n\tcwd: string;\n\tprivate shellPath: string | undefined;\n\n\tconstructor(cwd: string, options: LocalToolOperationsOptions = {}) {\n\t\tthis.cwd = cwd;\n\t\tthis.shellPath = options.shellPath;\n\t}\n\n\tsetShellPath(shellPath: string | undefined): void {\n\t\tthis.shellPath = shellPath;\n\t}\n\n\tasync exec(command: string, options: ToolExecOptions): Promise<ToolExecResult> {\n\t\tconst timeoutMs = resolveTimeoutMs(options.timeout);\n\t\tconst cwd = options.cwd ?? this.cwd;\n\t\tconst { shell, args } = getShellConfig(this.shellPath);\n\t\ttry {\n\t\t\tawait fsAccess(cwd, constants.F_OK);\n\t\t} catch {\n\t\t\tthrow new Error(`Working directory does not exist: ${cwd}\\nCannot execute bash commands.`);\n\t\t}\n\t\tif (options.signal?.aborted) {\n\t\t\tthrow new Error(\"aborted\");\n\t\t}\n\t\treturn new Promise((resolve, reject) => {\n\t\t\tconst child = spawn(shell, [...args, command], {\n\t\t\t\tcwd,\n\t\t\t\tdetached: process.platform !== \"win32\",\n\t\t\t\tenv: options.env ?? getShellEnv(),\n\t\t\t\tstdio: [\"ignore\", \"pipe\", \"pipe\"],\n\t\t\t\twindowsHide: true,\n\t\t\t});\n\t\t\tif (child.pid) trackDetachedChildPid(child.pid);\n\t\t\tlet timedOut = false;\n\t\t\tlet timeoutHandle: NodeJS.Timeout | undefined;\n\t\t\tif (timeoutMs !== undefined) {\n\t\t\t\ttimeoutHandle = setTimeout(() => {\n\t\t\t\t\ttimedOut = true;\n\t\t\t\t\tif (child.pid) killProcessTree(child.pid);\n\t\t\t\t}, timeoutMs);\n\t\t\t}\n\t\t\tchild.stdout?.on(\"data\", options.onData);\n\t\t\tchild.stderr?.on(\"data\", options.onData);\n\t\t\tconst removeAbortListener = registerChildProcessAbort(options.signal, child);\n\t\t\twaitForChildProcess(child)\n\t\t\t\t.then((code) => {\n\t\t\t\t\tterminateLingeringProcessGroup(child);\n\t\t\t\t\tcleanupChildExecution(child, timeoutHandle, removeAbortListener);\n\t\t\t\t\tif (options.signal?.aborted) {\n\t\t\t\t\t\treject(new Error(\"aborted\"));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tif (timedOut) {\n\t\t\t\t\t\treject(new Error(`timeout:${options.timeout}`));\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t\tresolve({ exitCode: code });\n\t\t\t\t})\n\t\t\t\t.catch((error: unknown) => {\n\t\t\t\t\tcleanupChildExecution(child, timeoutHandle, removeAbortListener);\n\t\t\t\t\treject(error);\n\t\t\t\t});\n\t\t});\n\t}\n\n\tasync access(path: string, mode?: ToolAccessMode): Promise<void> {\n\t\tawait fsAccess(path, accessModeToFsMode(mode));\n\t}\n\n\tasync readFile(path: string): Promise<Buffer> {\n\t\treturn fsReadFile(path);\n\t}\n\n\tasync writeFile(path: string, content: string | Buffer): Promise<void> {\n\t\tawait fsWriteFile(path, content, typeof content === \"string\" ? \"utf-8\" : undefined);\n\t}\n\n\tasync uploadFile(sourcePath: string, destinationPath: string): Promise<void> {\n\t\tawait copyFileStream(sourcePath, destinationPath);\n\t}\n\n\tasync downloadFile(sourcePath: string, destinationPath: string): Promise<void> {\n\t\tawait copyFileStream(sourcePath, destinationPath);\n\t}\n\n\tasync mkdir(path: string, options: ToolMkdirOptions = {}): Promise<void> {\n\t\tawait fsMkdir(path, { recursive: options.recursive ?? false });\n\t}\n\n\tasync stat(path: string): Promise<Stats> {\n\t\treturn fsStat(path);\n\t}\n\n\tasync readdir(path: string): Promise<string[]> {\n\t\treturn fsReaddir(path);\n\t}\n\n\tasync detectImageMimeType(path: string): Promise<string | null | undefined> {\n\t\treturn detectSupportedImageMimeTypeFromFile(path);\n\t}\n\n\tgetBackendInfo(): ToolBackendInfo {\n\t\treturn { type: \"local\", cwd: this.cwd };\n\t}\n}\n\nexport class DeferredRemoteToolOperations implements ToolOperations {\n\tcwd: string;\n\tprivate readonly expectedCwd: string;\n\tprivate operations: RemoteToolOperations | undefined;\n\tprivate remoteCatalogUnsubscribe: (() => void) | undefined;\n\tprivate readonly catalogListeners = new Set<() => void | Promise<void>>();\n\tprivate disposePromise: Promise<void> | undefined;\n\tprivate readonly onDisconnect: ((message: string) => void) | undefined;\n\n\tconstructor(cwd: string, onDisconnect?: (message: string) => void) {\n\t\tthis.cwd = cwd;\n\t\tthis.expectedCwd = cwd;\n\t\tthis.onDisconnect = onDisconnect;\n\t}\n\n\tasync configureRemote(\n\t\turl: string,\n\t\toptions: DeferredRemoteToolOperationsConnectOptions = {},\n\t): Promise<ToolBackendInfo> {\n\t\tconst next = await createRemoteToolOperations(url, { ...options, onDisconnect: this.onDisconnect });\n\t\ttry {\n\t\t\tconst stat = await next.stat(next.cwd);\n\t\t\tif (!stat.isDirectory()) throw new Error(`Remote daemon cwd is not a directory: ${next.cwd}`);\n\t\t\tconst expectedCwd = options.expectedCwd ?? this.expectedCwd;\n\t\t\tif (!workspaceRootsEqual(next.cwd, expectedCwd, next.workspacePathFlavor)) {\n\t\t\t\tthrow new Error(`Remote daemon workspace root mismatch: expected ${expectedCwd}, received ${next.cwd}`);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tawait next.dispose();\n\t\t\tthrow error;\n\t\t}\n\t\tawait this.replaceOperations(next);\n\t\treturn this.getBackendInfo();\n\t}\n\n\tasync clear(): Promise<void> {\n\t\tconst previous = this.operations;\n\t\tthis.remoteCatalogUnsubscribe?.();\n\t\tthis.remoteCatalogUnsubscribe = undefined;\n\t\tthis.operations = undefined;\n\t\tawait previous?.dispose?.();\n\t}\n\n\tprivate requireOperations(): RemoteToolOperations {\n\t\tif (!this.operations) {\n\t\t\tthrow new Error(\n\t\t\t\t\"Remote backend is not configured. Configure it over RPC or with /sandbox before using tools.\",\n\t\t\t);\n\t\t}\n\t\treturn this.operations;\n\t}\n\n\tasync exec(command: string, options: ToolExecOptions): Promise<ToolExecResult> {\n\t\treturn this.requireOperations().exec(command, options);\n\t}\n\n\tasync access(path: string, mode?: ToolAccessMode): Promise<void> {\n\t\tawait this.requireOperations().access(path, mode);\n\t}\n\n\tasync readFile(path: string): Promise<Buffer> {\n\t\treturn this.requireOperations().readFile(path);\n\t}\n\n\tasync writeFile(path: string, content: string | Buffer): Promise<void> {\n\t\tawait this.requireOperations().writeFile(path, content);\n\t}\n\n\tasync uploadFile(sourcePath: string, destinationPath: string): Promise<void> {\n\t\tconst operations = this.requireOperations();\n\t\tif (!operations.uploadFile) throw new Error(\"Remote backend does not support file upload\");\n\t\tawait operations.uploadFile(sourcePath, destinationPath);\n\t}\n\n\tasync downloadFile(sourcePath: string, destinationPath: string): Promise<void> {\n\t\tconst operations = this.requireOperations();\n\t\tif (!operations.downloadFile) throw new Error(\"Remote backend does not support file download\");\n\t\tawait operations.downloadFile(sourcePath, destinationPath);\n\t}\n\n\tasync mkdir(path: string, options?: ToolMkdirOptions): Promise<void> {\n\t\tawait this.requireOperations().mkdir(path, options);\n\t}\n\n\tasync stat(path: string): Promise<ToolFileStat> {\n\t\treturn this.requireOperations().stat(path);\n\t}\n\n\tasync readdir(path: string): Promise<string[]> {\n\t\treturn this.requireOperations().readdir(path);\n\t}\n\n\tasync glob(pattern: string, cwd: string, options: ToolGlobOptions): Promise<string[]> {\n\t\treturn this.requireOperations().glob(pattern, cwd, options);\n\t}\n\n\tasync grep(options: ToolGrepOptions): Promise<ToolGrepResult> {\n\t\treturn this.requireOperations().grep(options);\n\t}\n\n\tasync detectImageMimeType(path: string): Promise<string | null | undefined> {\n\t\treturn this.requireOperations().detectImageMimeType(path);\n\t}\n\n\tgetBackendInfo(): ToolBackendInfo {\n\t\treturn this.operations?.getBackendInfo() ?? { type: \"remote\", cwd: this.cwd, configured: false };\n\t}\n\tisDisconnected(): boolean {\n\t\treturn this.operations?.isDisconnected() ?? false;\n\t}\n\n\tresolveWorkspaceToolExecution(name: string, parameterSchema: unknown): RemoteWorkspaceToolExecutionTarget {\n\t\treturn this.operations ? this.operations.resolveWorkspaceToolExecution(name, parameterSchema) : \"unavailable\";\n\t}\n\n\texecuteWorkspaceTool(name: string, invocation: WorkspaceToolRemoteInvocation): Promise<AgentToolResult<unknown>> {\n\t\treturn this.requireOperations().executeWorkspaceTool(name, invocation);\n\t}\n\n\tgetRemoteLspStatus(): RemoteLspStatus {\n\t\treturn this.operations?.getRemoteLspStatus() ?? { enabled: false, servers: [] };\n\t}\n\n\tonWorkspaceToolCatalogChanged(listener: () => void | Promise<void>): () => void {\n\t\tthis.catalogListeners.add(listener);\n\t\treturn () => this.catalogListeners.delete(listener);\n\t}\n\n\tdispose(): Promise<void> {\n\t\tthis.disposePromise ??= (async () => {\n\t\t\tthis.remoteCatalogUnsubscribe?.();\n\t\t\tthis.remoteCatalogUnsubscribe = undefined;\n\t\t\tconst previous = this.operations;\n\t\t\tthis.operations = undefined;\n\t\t\tawait previous?.dispose?.();\n\t\t})();\n\t\treturn this.disposePromise;\n\t}\n\n\tprivate async replaceOperations(next: RemoteToolOperations): Promise<void> {\n\t\tif (this.disposePromise) {\n\t\t\tawait next.dispose?.();\n\t\t\tthrow new Error(\"Deferred remote backend is disposed\");\n\t\t}\n\t\tconst previous = this.operations;\n\t\tthis.remoteCatalogUnsubscribe?.();\n\t\tthis.remoteCatalogUnsubscribe = undefined;\n\t\tthis.operations = next;\n\t\tthis.cwd = next.cwd;\n\t\tthis.remoteCatalogUnsubscribe = next.onWorkspaceToolCatalogChanged(() =>\n\t\t\tPromise.all([...this.catalogListeners].map((listener) => listener())).then(() => undefined),\n\t\t);\n\t\tawait previous?.dispose?.();\n\t}\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n\treturn typeof value === \"object\" && value !== null;\n}\n\nfunction requireRecord(value: unknown, label: string): Record<string, unknown> {\n\tif (!isRecord(value)) throw new Error(`Invalid remote workspace ${label}`);\n\treturn value;\n}\n\nfunction requireString(value: unknown, label: string): string {\n\tif (typeof value !== \"string\") throw new Error(`Invalid remote workspace ${label}`);\n\treturn value;\n}\n\nfunction normalizeRemoteUrl(url: string): NormalizedRemoteWorkspaceUrl {\n\tconst parsed = new URL(url);\n\tif (parsed.protocol !== \"ws:\" && parsed.protocol !== \"wss:\") {\n\t\tthrow new Error(`--remote supports ws:// and wss:// URLs, got ${parsed.protocol}`);\n\t}\n\tif (parsed.username || parsed.password) throw new Error(\"Remote workspace URLs must not contain credentials\");\n\tif (parsed.hash) throw new Error(\"Remote workspace URLs must not contain fragments\");\n\treturn { url: parsed.toString(), protocol: \"ws\" };\n}\n\nfunction websocketPayload(data: RawData): Uint8Array {\n\tif (Buffer.isBuffer(data)) return Uint8Array.from(data);\n\tif (Array.isArray(data)) return Uint8Array.from(Buffer.concat(data));\n\treturn Uint8Array.from(new Uint8Array(data));\n}\n\nfunction websocketCloseCode(reason: RemoteWorkspaceProtocolCloseReason): number {\n\tswitch (reason.code) {\n\t\tcase \"normal\":\n\t\t\treturn 1000;\n\t\tcase \"protocol_error\":\n\t\t\treturn 1002;\n\t\tcase \"invalid_payload\":\n\t\t\treturn 1007;\n\t\tcase \"policy_violation\":\n\t\t\treturn 1008;\n\t\tcase \"message_too_large\":\n\t\t\treturn 1009;\n\t}\n}\n\nexport interface RemoteToolOperationsConnectOptions {\n\ttoken?: string;\n\thandshakeTimeoutMs?: number;\n\tonDisconnect?: (message: string) => void;\n}\n\nexport class RemoteToolOperations implements ToolOperations {\n\treadonly url: string;\n\treadonly protocol: RemoteToolTransportProtocol;\n\tcwd: string;\n\tworkspacePathFlavor: PortablePathFlavor = \"posix\";\n\tprivate workspaceId = \"\";\n\tprivate readonly socket: WebSocket | GuestSharedClientTransport;\n\tprivate readonly isShared: boolean;\n\tprivate readonly client: RemoteWorkspaceClientProtocol;\n\tprivate readonly localToolSchemas = new Map<string, string>();\n\tprivate readonly catalogListeners = new Set<() => void | Promise<void>>();\n\tprivate remoteLspStatus: RemoteLspStatus = { enabled: false, servers: [] };\n\tprivate disconnected = false;\n\tprivate disposePromise: Promise<void> | undefined;\n\n\tprivate constructor(\n\t\turl: string,\n\t\tprotocol: RemoteToolTransportProtocol,\n\t\tsocket: WebSocket | GuestSharedClientTransport,\n\t\toptions: RemoteToolOperationsConnectOptions,\n\t) {\n\t\tthis.url = url;\n\t\tthis.protocol = protocol;\n\t\tthis.socket = socket;\n\t\tthis.isShared = socket instanceof GuestSharedClientTransport;\n\t\tthis.cwd = \"/\";\n\t\tconst transport =\n\t\t\tsocket instanceof GuestSharedClientTransport\n\t\t\t\t? socket\n\t\t\t\t: {\n\t\t\t\t\t\tsend: (message: RemoteWorkspaceClientMessage): Promise<void> =>\n\t\t\t\t\t\t\tnew Promise((resolve, reject) => {\n\t\t\t\t\t\t\t\tif (socket.readyState !== WebSocket.OPEN) {\n\t\t\t\t\t\t\t\t\treject(new Error(\"Remote workspace connection is not open\"));\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tsocket.send(JSON.stringify(message), { binary: false, compress: false }, (error) => {\n\t\t\t\t\t\t\t\t\tif (error) reject(error);\n\t\t\t\t\t\t\t\t\telse resolve();\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\tclose: (reason: RemoteWorkspaceProtocolCloseReason): Promise<void> => {\n\t\t\t\t\t\t\tif (socket.readyState === WebSocket.CLOSED) return Promise.resolve();\n\t\t\t\t\t\t\treturn new Promise((resolve) => {\n\t\t\t\t\t\t\t\tsocket.once(\"close\", () => resolve());\n\t\t\t\t\t\t\t\tsocket.close(websocketCloseCode(reason), reason.message);\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t},\n\t\t\t\t\t};\n\t\tthis.client = new RemoteWorkspaceClientProtocol(transport, {\n\t\t\trequiredCapabilities: [\"primitive_operations\", \"tool_updates\"],\n\t\t\toptionalCapabilities: this.isShared\n\t\t\t\t? [\"catalog_refresh\", \"artifacts\", \"lsp_status\"]\n\t\t\t\t: [\"catalog_refresh\", \"file_transfer\", \"artifacts\", \"lsp_status\"],\n\t\t\treceiveLimits: DEFAULT_REMOTE_WORKSPACE_PROTOCOL_LIMITS,\n\t\t\tlocalToolSchemas: this.localToolSchemas,\n\t\t\thandshakeTimeoutMs: options.handshakeTimeoutMs,\n\t\t\tonDisconnect: (message) => {\n\t\t\t\tthis.disconnected = true;\n\t\t\t\toptions.onDisconnect?.(message);\n\t\t\t},\n\t\t\tonCatalogRefreshed: async () => {\n\t\t\t\tawait this.refreshRemoteLspStatus();\n\t\t\t\tawait Promise.all([...this.catalogListeners].map((listener) => listener()));\n\t\t\t},\n\t\t});\n\t\tif (socket instanceof GuestSharedClientTransport) {\n\t\t\tsocket.bind(this.client);\n\t\t} else {\n\t\t\tsocket.on(\"message\", (data, isBinary) => {\n\t\t\t\tif (isBinary) {\n\t\t\t\t\tvoid this.client.disconnect(\"Remote workspace sent an unexpected binary frame\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tvoid this.client.receive(websocketPayload(data)).catch(() => undefined);\n\t\t\t});\n\t\t\tsocket.on(\"close\", () => void this.client.disconnect(\"Remote workspace connection closed\"));\n\t\t\tsocket.on(\"error\", () => void this.client.disconnect(\"Remote workspace connection failed\"));\n\t\t}\n\t}\n\n\tstatic async connect(url: string, options: RemoteToolOperationsConnectOptions = {}): Promise<RemoteToolOperations> {\n\t\tconst normalized = normalizeRemoteUrl(url);\n\t\tconst token = options.token ?? process.env.GRIP_REMOTE_TOKEN;\n\t\tconst socket = await new Promise<WebSocket>((resolve, reject) => {\n\t\t\tconst websocket = new WebSocket(normalized.url, DAEMON_WEBSOCKET_PROTOCOL, {\n\t\t\t\tperMessageDeflate: false,\n\t\t\t\t...(token ? { headers: { authorization: `Bearer ${token}` } } : {}),\n\t\t\t});\n\t\t\tconst cleanup = () => {\n\t\t\t\twebsocket.off(\"open\", onOpen);\n\t\t\t\twebsocket.off(\"error\", onError);\n\t\t\t};\n\t\t\tconst onOpen = () => {\n\t\t\t\tcleanup();\n\t\t\t\tresolve(websocket);\n\t\t\t};\n\t\t\tconst onError = () => {\n\t\t\t\tcleanup();\n\t\t\t\twebsocket.terminate();\n\t\t\t\treject(new Error(`Failed to connect remote workspace: ${normalized.url}`));\n\t\t\t};\n\t\t\twebsocket.once(\"open\", onOpen);\n\t\t\twebsocket.once(\"error\", onError);\n\t\t});\n\t\tconst operations = new RemoteToolOperations(normalized.url, normalized.protocol, socket, options);\n\t\ttry {\n\t\t\tconst handshake = await operations.client.start();\n\t\t\toperations.cwd = handshake.workspace.root;\n\t\t\toperations.workspacePathFlavor = handshake.workspace.pathFlavor;\n\t\t\toperations.workspaceId = handshake.workspace.id;\n\t\t\tawait operations.refreshRemoteLspStatus();\n\t\t\treturn operations;\n\t\t} catch (error) {\n\t\t\tsocket.terminate();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tstatic async connectGuestShared(\n\t\turl: string,\n\t\troot: string,\n\t\ttoken: string,\n\t\toptions: RemoteToolOperationsConnectOptions = {},\n\t): Promise<RemoteToolOperations> {\n\t\tconst socket = await GuestSharedClientTransport.attach(url, root, token);\n\t\tconst operations = new RemoteToolOperations(url, \"ws\", socket, options);\n\t\ttry {\n\t\t\tconst handshake = await operations.client.start();\n\t\t\tif (!workspaceRootsEqual(handshake.workspace.root, root, handshake.workspace.pathFlavor)) {\n\t\t\t\tthrow new Error(\"Guest shared workspace root differs from daemon handshake\");\n\t\t\t}\n\t\t\toperations.cwd = handshake.workspace.root;\n\t\t\toperations.workspacePathFlavor = handshake.workspace.pathFlavor;\n\t\t\toperations.workspaceId = handshake.workspace.id;\n\t\t\tawait operations.refreshRemoteLspStatus();\n\t\t\treturn operations;\n\t\t} catch (error) {\n\t\t\tawait socket.close({ code: \"normal\", message: \"Shared guest attach failed\" });\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tresolveWorkspaceToolExecution(name: string, parameterSchema: unknown): RemoteWorkspaceToolExecutionTarget {\n\t\tconst schemaHash = hashRemoteWorkspaceJson(parameterSchema);\n\t\tconst catalogTool = this.client.handshake?.catalog.tools.find((tool) => tool.name === name);\n\t\tif (!catalogTool) return \"unavailable\";\n\t\tif (catalogTool.schemaHash !== schemaHash) {\n\t\t\tthrow new Error(`Remote tool schema does not match the local canonical definition: ${name}`);\n\t\t}\n\t\tthis.localToolSchemas.set(name, schemaHash);\n\t\tthis.client.setLocalToolSchemas(this.localToolSchemas);\n\t\treturn \"remote\";\n\t}\n\n\tasync executeWorkspaceTool(\n\t\tname: string,\n\t\tinvocation: WorkspaceToolRemoteInvocation,\n\t): Promise<AgentToolResult<unknown>> {\n\t\tconst invoke = async () => {\n\t\t\tawait this.client.waitForCatalogRefresh();\n\t\t\tconst handshake = this.client.handshake;\n\t\t\tif (!handshake) throw new Error(\"Remote workspace protocol handshake is unavailable\");\n\t\t\tconst catalogTool = handshake.catalog.tools.find((tool) => tool.name === name);\n\t\t\tconst schemaHash = this.localToolSchemas.get(name);\n\t\t\tif (!catalogTool || !schemaHash || catalogTool.schemaHash !== schemaHash) {\n\t\t\t\tthrow new Error(`Remote tool is unavailable or has schema drift: ${name}`);\n\t\t\t}\n\t\t\tconst expectedRevision = await this.revisionForTool(name, invocation);\n\t\t\tconst result = requireRecord(\n\t\t\t\tawait this.client.request(\n\t\t\t\t\t\"tool.invoke\",\n\t\t\t\t\t{\n\t\t\t\t\t\tgeneration: handshake.catalog.generation,\n\t\t\t\t\t\tcatalogHash: handshake.catalogHash,\n\t\t\t\t\t\ttoolName: name,\n\t\t\t\t\t\tschemaHash,\n\t\t\t\t\t\targumentsPrepared: true,\n\t\t\t\t\t\targuments: invocation.arguments,\n\t\t\t\t\t\t...(expectedRevision ? { expectedRevision } : {}),\n\t\t\t\t\t\texecutionOptions: invocation.executionOptions,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tsignal: invocation.signal,\n\t\t\t\t\t\tonUpdate: invocation.onUpdate\n\t\t\t\t\t\t\t? (update) =>\n\t\t\t\t\t\t\t\t\tinvocation.onUpdate!(parseRemoteWorkspaceToolResult(update) as AgentToolResult<unknown>)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t},\n\t\t\t\t),\n\t\t\t\t\"tool result\",\n\t\t\t);\n\t\t\tconst toolResult = result;\n\t\t\tif (!Array.isArray(toolResult.content)) throw new Error(\"Invalid remote workspace tool result content\");\n\t\t\tif (name.startsWith(\"lsp_\")) await this.refreshRemoteLspStatus().catch(() => undefined);\n\t\t\treturn {\n\t\t\t\tcontent: toolResult.content as AgentToolResult<unknown>[\"content\"],\n\t\t\t\tdetails: toolResult.details,\n\t\t\t\t...(typeof toolResult.terminate === \"boolean\" ? { terminate: toolResult.terminate } : {}),\n\t\t\t};\n\t\t};\n\t\ttry {\n\t\t\treturn await invoke();\n\t\t} catch (error) {\n\t\t\tif (\n\t\t\t\terror instanceof RemoteWorkspaceRequestError &&\n\t\t\t\terror.code === \"stale_generation\" &&\n\t\t\t\terror.executionState === \"not_started\"\n\t\t\t) {\n\t\t\t\treturn invoke();\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tgetRemoteLspStatus(): RemoteLspStatus {\n\t\treturn structuredClone(this.remoteLspStatus);\n\t}\n\n\tonWorkspaceToolCatalogChanged(listener: () => void | Promise<void>): () => void {\n\t\tthis.catalogListeners.add(listener);\n\t\treturn () => this.catalogListeners.delete(listener);\n\t}\n\n\tprivate async refreshRemoteLspStatus(): Promise<void> {\n\t\tif (!this.client.handshake?.catalog.operations.includes(\"lsp.status\")) {\n\t\t\tthis.remoteLspStatus = { enabled: false, servers: [] };\n\t\t\treturn;\n\t\t}\n\t\tthis.remoteLspStatus = (await this.client.request(\"lsp.status\", {})) as RemoteLspStatus;\n\t}\n\n\tprivate request(method: RemoteWorkspaceMethod, params: unknown) {\n\t\treturn this.client.request(method, params);\n\t}\n\n\tprivate async revisionForTool(\n\t\tname: string,\n\t\tinvocation: WorkspaceToolRemoteInvocation,\n\t): Promise<SharedExpectedRevision | undefined> {\n\t\tif (!this.isShared || (name !== \"edit\" && name !== \"write\")) return undefined;\n\t\tconst path = requireString(\n\t\t\trequireRecord(invocation.arguments, \"shared mutation arguments\").path,\n\t\t\t\"shared mutation path\",\n\t\t);\n\t\treturn this.sharedExpectedRevision(path, invocation.signal, name === \"write\");\n\t}\n\n\t/** Observe exact bytes for CAS, or a daemon-confirmed absent target for creation. */\n\tprivate async sharedExpectedRevision(\n\t\tpath: string,\n\t\tsignal?: AbortSignal,\n\t\tallowAbsent = true,\n\t): Promise<SharedExpectedRevision> {\n\t\tlet read: unknown;\n\t\ttry {\n\t\t\tread = await this.client.request(\"workspace.read\", { path }, { signal });\n\t\t} catch (error) {\n\t\t\tif (!allowAbsent) throw error;\n\t\t\t// Do not infer absence from an error message: only a v2 server stat of the\n\t\t\t// same workspace and path may establish the expected-absent precondition.\n\t\t\tconst stat = requireRecord(\n\t\t\t\tawait this.client.request(\"workspace.stat\", { path }, { signal }),\n\t\t\t\t\"shared stat result\",\n\t\t\t);\n\t\t\tif (stat.kind !== \"absent\") throw error;\n\t\t\treturn { absent: true };\n\t\t}\n\t\tconst result = requireRecord(read, \"shared read result\");\n\t\tconst content = decodeCanonicalBase64(\n\t\t\trequireString(result.contentBase64, \"shared read content\"),\n\t\t\tNumber.MAX_SAFE_INTEGER,\n\t\t);\n\t\tconst sha256 = createHash(\"sha256\").update(content).digest(\"hex\");\n\t\tif (result.revision !== sha256) throw new Error(\"Shared daemon did not confirm the observed file revision\");\n\t\treturn { sha256 };\n\t}\n\tasync exec(command: string, options: ToolExecOptions): Promise<ToolExecResult> {\n\t\tconst result = requireRecord(\n\t\t\tawait this.client.request(\n\t\t\t\t\"workspace.exec\",\n\t\t\t\t{ command, cwd: options.cwd ?? this.cwd },\n\t\t\t\t{\n\t\t\t\t\tsignal: options.signal,\n\t\t\t\t\ttimeoutMs: options.timeout === undefined ? undefined : Math.round(options.timeout * 1000),\n\t\t\t\t\tonUpdate: (update) => {\n\t\t\t\t\t\tconst record = requireRecord(update, \"exec update\");\n\t\t\t\t\t\toptions.onData(\n\t\t\t\t\t\t\tdecodeCanonicalBase64(requireString(record.dataBase64, \"exec update data\"), 1024 * 1024),\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t),\n\t\t\t\"exec result\",\n\t\t);\n\t\treturn { exitCode: typeof result.exitCode === \"number\" ? result.exitCode : null };\n\t}\n\n\tasync access(path: string, mode?: ToolAccessMode): Promise<void> {\n\t\tawait this.request(\"workspace.access\", { path, ...(mode ? { mode } : {}) });\n\t}\n\n\tasync readFile(path: string): Promise<Buffer> {\n\t\tconst result = requireRecord(await this.request(\"workspace.read\", { path }), \"read result\");\n\t\treturn decodeCanonicalBase64(requireString(result.contentBase64, \"read content\"), Number.MAX_SAFE_INTEGER);\n\t}\n\n\tasync writeFile(path: string, content: string | Buffer): Promise<void> {\n\t\tconst expectedRevision = this.isShared ? await this.sharedExpectedRevision(path) : undefined;\n\t\tawait this.request(\"workspace.write\", {\n\t\t\tpath,\n\t\t\tcontentBase64: Buffer.from(content).toString(\"base64\"),\n\t\t\t...(expectedRevision ? { expectedRevision } : {}),\n\t\t});\n\t}\n\n\tasync readResource(path: string): Promise<Buffer> {\n\t\tif (!this.client.handshake?.catalog.operations.includes(\"resource.read\")) {\n\t\t\tthrow new Error(\"Remote workspace does not expose resource reads\");\n\t\t}\n\t\tconst result = requireRecord(await this.request(\"resource.read\", { path }), \"resource read result\");\n\t\treturn decodeCanonicalBase64(\n\t\t\trequireString(result.contentBase64, \"resource read content\"),\n\t\t\tNumber.MAX_SAFE_INTEGER,\n\t\t);\n\t}\n\n\tasync uploadFile(sourcePath: string, destinationPath: string): Promise<void> {\n\t\tif (this.isShared) throw new Error(\"Shared guest file transfers are unavailable\");\n\t\tconst content = await fsReadFile(sourcePath);\n\t\tconst sha256 = createHash(\"sha256\").update(content).digest(\"hex\");\n\t\tconst handle = this.client.beginRequest(\"transfer.upload\", {\n\t\t\tpath: destinationPath,\n\t\t\tlength: content.byteLength,\n\t\t\tsha256,\n\t\t\toverwrite: true,\n\t\t});\n\t\tconst chunkBytes = this.client.handshake?.limits.maxTransferChunkBytes ?? 64 * 1024;\n\t\tfor (let offset = 0; offset < content.byteLength; offset += chunkBytes) {\n\t\t\tawait handle.sendTransferChunk(content.subarray(offset, Math.min(offset + chunkBytes, content.byteLength)));\n\t\t}\n\t\tawait handle.finishTransfer(content.byteLength, sha256);\n\t\tawait handle.result;\n\t}\n\n\tasync downloadFile(sourcePath: string, destinationPath: string): Promise<void> {\n\t\tif (this.isShared) throw new Error(\"Shared guest file transfers are unavailable\");\n\t\tconst stream = createWriteStream(destinationPath);\n\t\ttry {\n\t\t\tawait this.client.request(\n\t\t\t\t\"transfer.download\",\n\t\t\t\t{ path: sourcePath },\n\t\t\t\t{\n\t\t\t\t\tonTransferChunk: (chunk) => writeStreamChunk(stream, chunk),\n\t\t\t\t},\n\t\t\t);\n\t\t\tawait endWriteStream(stream);\n\t\t} catch (error) {\n\t\t\tstream.destroy();\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tasync mkdir(path: string, options: ToolMkdirOptions = {}): Promise<void> {\n\t\tawait this.request(\"workspace.mkdir\", { path, recursive: options.recursive ?? false });\n\t}\n\n\tasync stat(path: string): Promise<ToolFileStat> {\n\t\tconst result = requireRecord(await this.request(\"workspace.stat\", { path }), \"stat result\");\n\t\tif (result.kind === \"absent\") throw new Error(`Remote workspace path does not exist: ${path}`);\n\t\treturn {\n\t\t\tisDirectory: () => result.kind === \"directory\",\n\t\t\tisFile: () => result.kind === \"file\",\n\t\t};\n\t}\n\n\tasync readdir(path: string): Promise<string[]> {\n\t\tconst result = requireRecord(await this.request(\"workspace.readdir\", { path }), \"readdir result\");\n\t\tif (!Array.isArray(result.entries) || !result.entries.every((entry) => typeof entry === \"string\")) {\n\t\t\tthrow new Error(\"Invalid remote workspace readdir entries\");\n\t\t}\n\t\treturn result.entries;\n\t}\n\n\tasync glob(pattern: string, cwd: string, options: ToolGlobOptions): Promise<string[]> {\n\t\tconst result = requireRecord(\n\t\t\tawait this.request(\"workspace.glob\", { pattern, cwd, ignore: options.ignore, limit: options.limit }),\n\t\t\t\"glob result\",\n\t\t);\n\t\tif (!Array.isArray(result.matches) || !result.matches.every((entry) => typeof entry === \"string\")) {\n\t\t\tthrow new Error(\"Invalid remote workspace glob matches\");\n\t\t}\n\t\treturn result.matches;\n\t}\n\n\tasync grep(options: ToolGrepOptions): Promise<ToolGrepResult> {\n\t\tconst result = requireRecord(await this.request(\"workspace.grep\", options), \"grep result\");\n\t\tif (!Array.isArray(result.matches)) throw new Error(\"Invalid remote workspace grep matches\");\n\t\treturn {\n\t\t\tisDirectory: result.isDirectory === true,\n\t\t\tmatches: result.matches.map((entry) => {\n\t\t\t\tconst match = requireRecord(entry, \"grep match\");\n\t\t\t\treturn {\n\t\t\t\t\tfilePath: requireString(match.filePath, \"grep file path\"),\n\t\t\t\t\tlineNumber: typeof match.lineNumber === \"number\" ? match.lineNumber : 0,\n\t\t\t\t\t...(typeof match.lineText === \"string\" ? { lineText: match.lineText } : {}),\n\t\t\t\t};\n\t\t\t}),\n\t\t};\n\t}\n\n\tasync detectImageMimeType(path: string): Promise<string | null | undefined> {\n\t\tconst result = requireRecord(await this.request(\"workspace.detect_image_mime\", { path }), \"image MIME result\");\n\t\treturn typeof result.mimeType === \"string\" ? result.mimeType : null;\n\t}\n\n\tgetBackendInfo(): ToolBackendInfo {\n\t\treturn {\n\t\t\ttype: \"remote\",\n\t\t\tcwd: this.cwd,\n\t\t\turl: this.url,\n\t\t\tprotocol: this.protocol,\n\t\t\tconfigured: true,\n\t\t\tworkspace: { id: this.workspaceId, root: this.cwd, pathFlavor: this.workspacePathFlavor },\n\t\t};\n\t}\n\tisDisconnected(): boolean {\n\t\treturn this.disconnected;\n\t}\n\n\tdispose(): Promise<void> {\n\t\tthis.disposePromise ??= this.client.close().catch(() => {\n\t\t\tif (this.socket instanceof WebSocket) this.socket.terminate();\n\t\t});\n\t\treturn this.disposePromise;\n\t}\n}\n\nexport function createRemoteToolOperations(\n\turl: string,\n\toptions?: RemoteToolOperationsConnectOptions,\n): Promise<RemoteToolOperations> {\n\tif (url.startsWith(\"grip+ws:\")) {\n\t\tconst parsed = new URL(url.replace(/^grip\\+/, \"\"));\n\t\tconst root = parsed.searchParams.get(\"root\");\n\t\tif (!root || !posix.isAbsolute(root) || parsed.searchParams.size !== 1 || !options?.token) {\n\t\t\treturn Promise.reject(new Error(\"Invalid guest shared workspace attachment\"));\n\t\t}\n\t\tparsed.search = \"\";\n\t\treturn RemoteToolOperations.connectGuestShared(parsed.toString(), root, options.token, options);\n\t}\n\treturn RemoteToolOperations.connect(url, options);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../src/core/tools/operations.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkD,KAAK,KAAK,EAAoB,MAAM,SAAS,CAAC;AAYvG,OAAO,KAAK,EAAE,eAAe,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAa3F,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAKN,KAAK,eAAe,EAGpB,MAAM,0CAA0C,CAAC;AAOlD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAElE,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,WAAW,CAAC;AACvE,MAAM,MAAM,4BAA4B,GAAG,OAAO,GAAG,QAAQ,GAAG,aAAa,CAAC;AAC9E,MAAM,MAAM,kCAAkC,GAAG,OAAO,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC;AAChG,KAAK,2BAA2B,GAA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AAC,CAgB3E;IAEK,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAgB7E;IAEK,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,gBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAEvE;IAEK,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC,CAO9C;IAEK,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAO7D;IAEK,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAM7C;IAEK,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CASpF;IAEK,IAAI,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAc5D;IAEK,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAG1E;IAED,cAAc,IAAI,eAAe,CAShC;IACD,cAAc,IAAI,OAAO,CAExB;IAED,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAKvB;CACD;AAED,wBAAgB,0BAA0B,CACzC,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,kCAAkC,GAC1C,OAAO,CAAC,oBAAoB,CAAC,CAW/B"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { spawn } from "node:child_process";
|
|
2
2
|
import { createHash } from "node:crypto";
|
|
3
3
|
import { constants, createReadStream, createWriteStream } from "node:fs";
|
|
4
|
-
import { access as fsAccess, mkdir as fsMkdir, readdir as fsReaddir, readFile as fsReadFile, stat as fsStat, writeFile as fsWriteFile, } from "node:fs/promises";
|
|
5
|
-
import { posix, win32 } from "node:path";
|
|
4
|
+
import { access as fsAccess, mkdir as fsMkdir, readdir as fsReaddir, readFile as fsReadFile, realpath as fsRealpath, stat as fsStat, writeFile as fsWriteFile, } from "node:fs/promises";
|
|
5
|
+
import { isAbsolute, posix, relative, resolve, sep, win32 } from "node:path";
|
|
6
6
|
import { pipeline } from "node:stream/promises";
|
|
7
7
|
import WebSocket from "ws";
|
|
8
8
|
import { DAEMON_WEBSOCKET_PROTOCOL } from "../../daemon/config.js";
|
|
@@ -135,8 +135,6 @@ function endWriteStream(stream) {
|
|
|
135
135
|
});
|
|
136
136
|
}
|
|
137
137
|
export class LocalToolOperations {
|
|
138
|
-
cwd;
|
|
139
|
-
shellPath;
|
|
140
138
|
constructor(cwd, options = {}) {
|
|
141
139
|
this.cwd = cwd;
|
|
142
140
|
this.shellPath = options.shellPath;
|
|
@@ -231,14 +229,8 @@ export class LocalToolOperations {
|
|
|
231
229
|
}
|
|
232
230
|
}
|
|
233
231
|
export class DeferredRemoteToolOperations {
|
|
234
|
-
cwd;
|
|
235
|
-
expectedCwd;
|
|
236
|
-
operations;
|
|
237
|
-
remoteCatalogUnsubscribe;
|
|
238
|
-
catalogListeners = new Set();
|
|
239
|
-
disposePromise;
|
|
240
|
-
onDisconnect;
|
|
241
232
|
constructor(cwd, onDisconnect) {
|
|
233
|
+
this.catalogListeners = new Set();
|
|
242
234
|
this.cwd = cwd;
|
|
243
235
|
this.expectedCwd = cwd;
|
|
244
236
|
this.onDisconnect = onDisconnect;
|
|
@@ -253,19 +245,22 @@ export class DeferredRemoteToolOperations {
|
|
|
253
245
|
if (!workspaceRootsEqual(next.cwd, expectedCwd, next.workspacePathFlavor)) {
|
|
254
246
|
throw new Error(`Remote daemon workspace root mismatch: expected ${expectedCwd}, received ${next.cwd}`);
|
|
255
247
|
}
|
|
248
|
+
const hostRoot = options.hostWorkspaceRoot ? await fsRealpath(options.hostWorkspaceRoot) : undefined;
|
|
249
|
+
await this.replaceOperations(next);
|
|
250
|
+
this.hostWorkspaceRoot = hostRoot;
|
|
251
|
+
return this.getBackendInfo();
|
|
256
252
|
}
|
|
257
253
|
catch (error) {
|
|
258
254
|
await next.dispose();
|
|
259
255
|
throw error;
|
|
260
256
|
}
|
|
261
|
-
await this.replaceOperations(next);
|
|
262
|
-
return this.getBackendInfo();
|
|
263
257
|
}
|
|
264
258
|
async clear() {
|
|
265
259
|
const previous = this.operations;
|
|
266
260
|
this.remoteCatalogUnsubscribe?.();
|
|
267
261
|
this.remoteCatalogUnsubscribe = undefined;
|
|
268
262
|
this.operations = undefined;
|
|
263
|
+
this.hostWorkspaceRoot = undefined;
|
|
269
264
|
await previous?.dispose?.();
|
|
270
265
|
}
|
|
271
266
|
requireOperations() {
|
|
@@ -304,6 +299,29 @@ export class DeferredRemoteToolOperations {
|
|
|
304
299
|
async stat(path) {
|
|
305
300
|
return this.requireOperations().stat(path);
|
|
306
301
|
}
|
|
302
|
+
async resolveWorkspaceDirectory(path) {
|
|
303
|
+
return this.requireOperations().resolveWorkspaceDirectory(path);
|
|
304
|
+
}
|
|
305
|
+
async mapWorkspaceDirectoryToHost(guestPath) {
|
|
306
|
+
const remote = this.requireOperations();
|
|
307
|
+
const hostRoot = this.hostWorkspaceRoot;
|
|
308
|
+
if (!hostRoot || remote.workspacePathFlavor !== "posix") {
|
|
309
|
+
throw new Error("No verified host mount mapping is available for this sandbox");
|
|
310
|
+
}
|
|
311
|
+
const canonicalGuest = await remote.resolveWorkspaceDirectory(posix.resolve(this.cwd, guestPath));
|
|
312
|
+
const suffix = posix.relative(remote.cwd, canonicalGuest);
|
|
313
|
+
if (suffix === ".." || suffix.startsWith("../") || posix.isAbsolute(suffix)) {
|
|
314
|
+
throw new Error("Guest directory is outside the mounted workspace");
|
|
315
|
+
}
|
|
316
|
+
const hostPath = await fsRealpath(resolve(hostRoot, suffix));
|
|
317
|
+
const hostRelative = relative(hostRoot, hostPath);
|
|
318
|
+
if (hostRelative === ".." || hostRelative.startsWith(`..${sep}`) || isAbsolute(hostRelative)) {
|
|
319
|
+
throw new Error("Host directory escapes the mounted workspace");
|
|
320
|
+
}
|
|
321
|
+
if (!(await fsStat(hostPath)).isDirectory())
|
|
322
|
+
throw new Error("Host working directory is not a directory");
|
|
323
|
+
return hostPath;
|
|
324
|
+
}
|
|
307
325
|
async readdir(path) {
|
|
308
326
|
return this.requireOperations().readdir(path);
|
|
309
327
|
}
|
|
@@ -326,7 +344,13 @@ export class DeferredRemoteToolOperations {
|
|
|
326
344
|
return this.operations ? this.operations.resolveWorkspaceToolExecution(name, parameterSchema) : "unavailable";
|
|
327
345
|
}
|
|
328
346
|
executeWorkspaceTool(name, invocation) {
|
|
329
|
-
return this.requireOperations().executeWorkspaceTool(name,
|
|
347
|
+
return this.requireOperations().executeWorkspaceTool(name, {
|
|
348
|
+
...invocation,
|
|
349
|
+
executionOptions: {
|
|
350
|
+
...invocation.executionOptions,
|
|
351
|
+
...(this.cwd === this.requireOperations().cwd ? {} : { cwd: this.cwd }),
|
|
352
|
+
},
|
|
353
|
+
});
|
|
330
354
|
}
|
|
331
355
|
getRemoteLspStatus() {
|
|
332
356
|
return this.operations?.getRemoteLspStatus() ?? { enabled: false, servers: [] };
|
|
@@ -341,6 +365,7 @@ export class DeferredRemoteToolOperations {
|
|
|
341
365
|
this.remoteCatalogUnsubscribe = undefined;
|
|
342
366
|
const previous = this.operations;
|
|
343
367
|
this.operations = undefined;
|
|
368
|
+
this.hostWorkspaceRoot = undefined;
|
|
344
369
|
await previous?.dispose?.();
|
|
345
370
|
})();
|
|
346
371
|
return this.disposePromise;
|
|
@@ -405,20 +430,13 @@ function websocketCloseCode(reason) {
|
|
|
405
430
|
}
|
|
406
431
|
}
|
|
407
432
|
export class RemoteToolOperations {
|
|
408
|
-
url;
|
|
409
|
-
protocol;
|
|
410
|
-
cwd;
|
|
411
|
-
workspacePathFlavor = "posix";
|
|
412
|
-
workspaceId = "";
|
|
413
|
-
socket;
|
|
414
|
-
isShared;
|
|
415
|
-
client;
|
|
416
|
-
localToolSchemas = new Map();
|
|
417
|
-
catalogListeners = new Set();
|
|
418
|
-
remoteLspStatus = { enabled: false, servers: [] };
|
|
419
|
-
disconnected = false;
|
|
420
|
-
disposePromise;
|
|
421
433
|
constructor(url, protocol, socket, options) {
|
|
434
|
+
this.workspacePathFlavor = "posix";
|
|
435
|
+
this.workspaceId = "";
|
|
436
|
+
this.localToolSchemas = new Map();
|
|
437
|
+
this.catalogListeners = new Set();
|
|
438
|
+
this.remoteLspStatus = { enabled: false, servers: [] };
|
|
439
|
+
this.disconnected = false;
|
|
422
440
|
this.url = url;
|
|
423
441
|
this.protocol = protocol;
|
|
424
442
|
this.socket = socket;
|
|
@@ -620,7 +638,9 @@ export class RemoteToolOperations {
|
|
|
620
638
|
if (!this.isShared || (name !== "edit" && name !== "write"))
|
|
621
639
|
return undefined;
|
|
622
640
|
const path = requireString(requireRecord(invocation.arguments, "shared mutation arguments").path, "shared mutation path");
|
|
623
|
-
|
|
641
|
+
const cwd = invocation.executionOptions.cwd;
|
|
642
|
+
const target = cwd ? (this.workspacePathFlavor === "windows" ? win32 : posix).resolve(cwd, path) : path;
|
|
643
|
+
return this.sharedExpectedRevision(target, invocation.signal, name === "write");
|
|
624
644
|
}
|
|
625
645
|
/** Observe exact bytes for CAS, or a daemon-confirmed absent target for creation. */
|
|
626
646
|
async sharedExpectedRevision(path, signal, allowAbsent = true) {
|
|
@@ -723,6 +743,12 @@ export class RemoteToolOperations {
|
|
|
723
743
|
isFile: () => result.kind === "file",
|
|
724
744
|
};
|
|
725
745
|
}
|
|
746
|
+
async resolveWorkspaceDirectory(path) {
|
|
747
|
+
const result = requireRecord(await this.request("workspace.stat", { path, workspaceOnly: true }), "workspace directory result");
|
|
748
|
+
if (result.kind !== "directory")
|
|
749
|
+
throw new Error(`Not a workspace directory: ${path}`);
|
|
750
|
+
return requireString(result.canonicalPath, "workspace directory canonical path");
|
|
751
|
+
}
|
|
726
752
|
async readdir(path) {
|
|
727
753
|
const result = requireRecord(await this.request("workspace.readdir", { path }), "readdir result");
|
|
728
754
|
if (!Array.isArray(result.entries) || !result.entries.every((entry) => typeof entry === "string")) {
|