@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,716 @@
|
|
|
1
|
+
import { createHash, randomBytes } from "node:crypto";
|
|
2
|
+
import { realpath } from "node:fs/promises";
|
|
3
|
+
import { createConnection } from "node:net";
|
|
4
|
+
import { basename, resolve } from "node:path";
|
|
5
|
+
import { VERSION } from "../../config.js";
|
|
6
|
+
import { DAEMON_WEBSOCKET_PATH } from "../../daemon/config.js";
|
|
7
|
+
import { spawnProcess } from "../../utils/child-process.js";
|
|
8
|
+
import { acquireSharedLimaOwnerLock } from "../remote-workspace-protocol/lima-owner-lock.js";
|
|
9
|
+
import { allocateSandboxDaemonPort, redactSecrets, resolveSandboxConfig, SANDBOX_LABEL_PREFIX } from "./config.js";
|
|
10
|
+
import { inspectLocalGuestBinary, installLocalGuestBinary } from "./lima-guest-binary.js";
|
|
11
|
+
import { resolveSharedLimaWorkspace } from "./shared-lima-roots.js";
|
|
12
|
+
import { stageSharedGuestBinary } from "./update-shared-guest-binary.js";
|
|
13
|
+
class ProcessLimaRunner {
|
|
14
|
+
run(command, args, options = {}) {
|
|
15
|
+
return new Promise((resolveCommand, reject) => {
|
|
16
|
+
const child = spawnProcess(command, args, {
|
|
17
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
18
|
+
env: { ...process.env, ...options.env },
|
|
19
|
+
});
|
|
20
|
+
let stdout = "";
|
|
21
|
+
let stderr = "";
|
|
22
|
+
child.stdout?.on("data", (chunk) => {
|
|
23
|
+
stdout += chunk.toString("utf8");
|
|
24
|
+
});
|
|
25
|
+
child.stderr?.on("data", (chunk) => {
|
|
26
|
+
stderr += chunk.toString("utf8");
|
|
27
|
+
});
|
|
28
|
+
child.once("error", reject);
|
|
29
|
+
child.once("close", (exitCode) => resolveCommand({ exitCode, stdout, stderr }));
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function shellQuote(value) {
|
|
34
|
+
return `'${value.replaceAll("'", `'"'"'`)}'`;
|
|
35
|
+
}
|
|
36
|
+
function parseLimaRecords(output) {
|
|
37
|
+
const text = output.trim();
|
|
38
|
+
if (!text)
|
|
39
|
+
return [];
|
|
40
|
+
try {
|
|
41
|
+
const parsed = JSON.parse(text);
|
|
42
|
+
return Array.isArray(parsed) ? parsed : [parsed];
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
return text
|
|
46
|
+
.split(/\r?\n/)
|
|
47
|
+
.filter(Boolean)
|
|
48
|
+
.map((line) => JSON.parse(line));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
function ensureLimaSuccessful(binary, result, args) {
|
|
52
|
+
if (result.exitCode === 0)
|
|
53
|
+
return;
|
|
54
|
+
const detail = result.stderr.trim() || result.stdout.trim() || `exit code ${result.exitCode ?? "unknown"}`;
|
|
55
|
+
throw new Error(redactSecrets(`Lima command failed: ${binary} ${args.join(" ")}: ${detail}`));
|
|
56
|
+
}
|
|
57
|
+
function daemonConnectionHost(host) {
|
|
58
|
+
if (host === "0.0.0.0")
|
|
59
|
+
return "127.0.0.1";
|
|
60
|
+
if (host === "::")
|
|
61
|
+
return "::1";
|
|
62
|
+
return host;
|
|
63
|
+
}
|
|
64
|
+
function urlHost(host) {
|
|
65
|
+
return host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
|
|
66
|
+
}
|
|
67
|
+
async function canConnect(host, port) {
|
|
68
|
+
return new Promise((resolveConnection) => {
|
|
69
|
+
const socket = createConnection({ host, port });
|
|
70
|
+
let settled = false;
|
|
71
|
+
const finish = (connected) => {
|
|
72
|
+
if (settled)
|
|
73
|
+
return;
|
|
74
|
+
settled = true;
|
|
75
|
+
socket.destroy();
|
|
76
|
+
resolveConnection(connected);
|
|
77
|
+
};
|
|
78
|
+
socket.setTimeout(250, () => finish(false));
|
|
79
|
+
socket.once("connect", () => finish(true));
|
|
80
|
+
socket.once("error", () => finish(false));
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
async function waitForLimaDaemon(host, port) {
|
|
84
|
+
const deadline = Date.now() + 30_000;
|
|
85
|
+
while (Date.now() < deadline) {
|
|
86
|
+
if (await canConnect(daemonConnectionHost(host), port))
|
|
87
|
+
return;
|
|
88
|
+
await new Promise((resolveDelay) => setTimeout(resolveDelay, 100));
|
|
89
|
+
}
|
|
90
|
+
throw new Error(`Lima sandbox daemon did not become reachable on ${daemonConnectionHost(host)}:${port}`);
|
|
91
|
+
}
|
|
92
|
+
function createInstanceName(config, workspaceRoot, sessionId, daemonPort) {
|
|
93
|
+
const clean = (value) => value
|
|
94
|
+
.toLowerCase()
|
|
95
|
+
.replace(/[^a-z0-9-]+/g, "-")
|
|
96
|
+
.replace(/^-+|-+$/g, "") || "workspace";
|
|
97
|
+
const hash = createHash("sha256").update(resolve(workspaceRoot)).digest("hex").slice(0, 12);
|
|
98
|
+
return `${clean(config.limaInstanceNamePrefix)}-${clean(basename(resolve(workspaceRoot)))}-${hash}-${clean(sessionId).slice(0, 8).replace(/-+$/, "")}-p${daemonPort}-${randomBytes(4).toString("hex")}`;
|
|
99
|
+
}
|
|
100
|
+
function findWorkspaceMount(record, workspaceMountPath) {
|
|
101
|
+
return record.config?.mounts?.find((mount) => mount.mountPoint === workspaceMountPath);
|
|
102
|
+
}
|
|
103
|
+
function findDaemonForward(record, preferredPort) {
|
|
104
|
+
const namePort = Number(record.name?.match(/-p(\d+)-[a-f0-9]+$/)?.[1]);
|
|
105
|
+
const daemonPort = Number.isInteger(namePort) && namePort > 0 ? namePort : preferredPort;
|
|
106
|
+
const forwards = record.config?.portForwards?.filter((forward) => forward.guestPort === forward.hostPort && forward.hostPort !== undefined);
|
|
107
|
+
return (forwards?.find((forward) => forward.guestPort === daemonPort) ??
|
|
108
|
+
(forwards?.length === 1 ? forwards[0] : undefined));
|
|
109
|
+
}
|
|
110
|
+
function toSandboxContainer(record, workspaceMountPath) {
|
|
111
|
+
const mount = findWorkspaceMount(record, workspaceMountPath);
|
|
112
|
+
const forward = findDaemonForward(record);
|
|
113
|
+
const daemonEndpoint = forward?.hostPort
|
|
114
|
+
? `ws://${urlHost(daemonConnectionHost(forward.hostIP || "127.0.0.1"))}:${forward.hostPort}${DAEMON_WEBSOCKET_PATH}`
|
|
115
|
+
: undefined;
|
|
116
|
+
return {
|
|
117
|
+
id: record.name ?? "",
|
|
118
|
+
name: record.name ?? "",
|
|
119
|
+
image: `lima:${record.vmType ?? "vm"}/${record.arch ?? "unknown"}`,
|
|
120
|
+
status: record.status ?? "",
|
|
121
|
+
state: record.status?.toLowerCase(),
|
|
122
|
+
createdAt: undefined,
|
|
123
|
+
workspaceRoot: mount?.location ? resolve(mount.location) : undefined,
|
|
124
|
+
workspaceMountPath: mount?.mountPoint,
|
|
125
|
+
daemonPort: forward?.guestPort,
|
|
126
|
+
daemonEndpoint,
|
|
127
|
+
labels: { [`${SANDBOX_LABEL_PREFIX}.runtime`]: "lima", [`${SANDBOX_LABEL_PREFIX}.version`]: VERSION },
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
function selectLimaSandbox(instances, target) {
|
|
131
|
+
if (!target)
|
|
132
|
+
return instances.length === 1 ? instances[0] : undefined;
|
|
133
|
+
return instances.find((instance) => instance.name === target || instance.id.startsWith(target));
|
|
134
|
+
}
|
|
135
|
+
export class LimaSandboxService {
|
|
136
|
+
settingsManager;
|
|
137
|
+
env;
|
|
138
|
+
runner;
|
|
139
|
+
portAllocator;
|
|
140
|
+
readinessWaiter;
|
|
141
|
+
managedInstances;
|
|
142
|
+
constructor(options = {}) {
|
|
143
|
+
this.settingsManager = options.settingsManager;
|
|
144
|
+
this.env = options.env ?? process.env;
|
|
145
|
+
this.runner = options.runner ?? new ProcessLimaRunner();
|
|
146
|
+
this.portAllocator = options.portAllocator ?? allocateSandboxDaemonPort;
|
|
147
|
+
this.readinessWaiter = options.readinessWaiter ?? waitForLimaDaemon;
|
|
148
|
+
this.managedInstances = options.managedInstances ?? new Map();
|
|
149
|
+
}
|
|
150
|
+
resolveConfig(overrides = {}) {
|
|
151
|
+
return resolveSandboxConfig(this.settingsManager?.getSandboxSettings(), this.env, overrides);
|
|
152
|
+
}
|
|
153
|
+
async listRecords(config, name) {
|
|
154
|
+
const args = ["list", "--json", ...(name ? [name] : [])];
|
|
155
|
+
try {
|
|
156
|
+
const result = await this.runner.run(config.limaBinary, args);
|
|
157
|
+
if (name &&
|
|
158
|
+
result.exitCode !== 0 &&
|
|
159
|
+
/unmatched|not found|does not exist/i.test(`${result.stderr}\n${result.stdout}`)) {
|
|
160
|
+
return [];
|
|
161
|
+
}
|
|
162
|
+
ensureLimaSuccessful(config.limaBinary, result, args);
|
|
163
|
+
return parseLimaRecords(result.stdout);
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
167
|
+
throw new Error(redactSecrets(`Lima is unavailable or not reachable via ${config.limaBinary}: ${message}`));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/** Read-only validation: no VM creation, daemon restart, token rotation or ownership claim. */
|
|
171
|
+
async inspectSharedInstance(options) {
|
|
172
|
+
const config = this.resolveConfig();
|
|
173
|
+
const { instanceName } = options;
|
|
174
|
+
if (!/^[a-z0-9][a-z0-9-]*$/.test(instanceName))
|
|
175
|
+
throw new Error("Invalid shared Lima instance name");
|
|
176
|
+
if (config.daemonHostBind !== "127.0.0.1" && config.daemonHostBind !== "::1") {
|
|
177
|
+
throw new Error("Shared Lima daemon forward must bind to loopback");
|
|
178
|
+
}
|
|
179
|
+
const binding = await resolveSharedLimaWorkspace(options.hostParent, config.workspaceMountPath, options.hostRoot);
|
|
180
|
+
const records = await this.listRecords(config, instanceName);
|
|
181
|
+
if (records.length !== 1 || records[0]?.name !== instanceName) {
|
|
182
|
+
throw new Error(`Shared Lima instance ${instanceName} does not exist by exact name`);
|
|
183
|
+
}
|
|
184
|
+
const record = records[0];
|
|
185
|
+
if (record.status?.toLowerCase() !== "running") {
|
|
186
|
+
throw new Error(`Shared Lima instance ${instanceName} is not running`);
|
|
187
|
+
}
|
|
188
|
+
const mounts = record.config?.mounts?.filter((mount) => mount.mountPoint === binding.guestParent) ?? [];
|
|
189
|
+
if (mounts.length !== 1 || !mounts[0]?.writable || !mounts[0].location) {
|
|
190
|
+
throw new Error(`Shared Lima instance ${instanceName} requires one writable fixed parent mount`);
|
|
191
|
+
}
|
|
192
|
+
if ((await realpath(mounts[0].location)) !== binding.hostParent) {
|
|
193
|
+
throw new Error(`Shared Lima instance ${instanceName} mounts a different host parent`);
|
|
194
|
+
}
|
|
195
|
+
const forwards = record.config?.portForwards?.filter((forward) => forward.guestPort === config.daemonPort || forward.hostPort === config.daemonPort) ?? [];
|
|
196
|
+
if (forwards.length !== 1 ||
|
|
197
|
+
forwards[0]?.guestPort !== config.daemonPort ||
|
|
198
|
+
forwards[0].hostPort !== config.daemonPort ||
|
|
199
|
+
forwards[0].hostIP !== config.daemonHostBind) {
|
|
200
|
+
throw new Error(`Shared Lima instance ${instanceName} requires one matching loopback daemon forward`);
|
|
201
|
+
}
|
|
202
|
+
return {
|
|
203
|
+
...binding,
|
|
204
|
+
instanceName,
|
|
205
|
+
daemonUrl: `ws://${urlHost(config.daemonHostBind)}:${config.daemonPort}${DAEMON_WEBSOCKET_PATH}`,
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
/** Reinspect and reuse the supervised guest daemon under the exclusive named-VM owner lock. */
|
|
209
|
+
async ensureSharedDaemon(options, owner, updated = false) {
|
|
210
|
+
if (owner.instanceName !== options.instanceName)
|
|
211
|
+
throw new Error("Shared Lima owner lock names a different VM");
|
|
212
|
+
await owner.assertHeld();
|
|
213
|
+
await this.inspectSharedInstance(options);
|
|
214
|
+
const config = this.resolveConfig();
|
|
215
|
+
const local = this.env.GRIP_SANDBOX_GUEST_BINARY
|
|
216
|
+
? await inspectLocalGuestBinary(this.env.GRIP_SANDBOX_GUEST_BINARY)
|
|
217
|
+
: undefined;
|
|
218
|
+
const versionArgs = [
|
|
219
|
+
"shell",
|
|
220
|
+
"--tty=false",
|
|
221
|
+
options.instanceName,
|
|
222
|
+
"sh",
|
|
223
|
+
"-lc",
|
|
224
|
+
local || updated ? '"$HOME/.local/bin/grip" --version' : "grip --version",
|
|
225
|
+
];
|
|
226
|
+
const version = await this.runner.run(config.limaBinary, versionArgs);
|
|
227
|
+
if (version.exitCode !== 0 || version.stdout.trim() !== VERSION) {
|
|
228
|
+
throw new Error("Shared Lima grip version mismatch or binary missing; install the matching version manually");
|
|
229
|
+
}
|
|
230
|
+
await owner.assertHeld();
|
|
231
|
+
const directory = "$HOME/.cache/grip/shared-lima";
|
|
232
|
+
// /proc start time plus boot ID distinguishes a recycled PID or a rebooted guest.
|
|
233
|
+
// kill -0 also succeeds for zombies, which must never be reused as a live daemon.
|
|
234
|
+
const processStartTime = `awk '{ sub(/^.*\\) /, ""); if ($1 == "Z" || $1 == "X") exit 1; print $20 }'`;
|
|
235
|
+
const script = [
|
|
236
|
+
"set -eu",
|
|
237
|
+
"umask 077",
|
|
238
|
+
`directory="${directory}"`,
|
|
239
|
+
// Both current modes reserve the guest transition; a crashed reservation is operator-owned.
|
|
240
|
+
'mkdir -p "$HOME/.cache/grip"',
|
|
241
|
+
'mode_lock="$HOME/.cache/grip/daemon-mode.lock"',
|
|
242
|
+
'mkdir "$mode_lock" || exit 28',
|
|
243
|
+
"trap 'rmdir \"$mode_lock\" 2>/dev/null || true' EXIT",
|
|
244
|
+
// A legacy per-session daemon may own this VM or its port. Do not start a second daemon.
|
|
245
|
+
'for legacy_file in "$HOME/.cache/grip"/sandbox-daemon-*.pid "$HOME/.cache/grip"/sandbox-daemon-*.log; do',
|
|
246
|
+
' if test -e "$legacy_file" || test -L "$legacy_file"; then exit 27; fi',
|
|
247
|
+
"done",
|
|
248
|
+
// A transient user service must outlive the Lima SSH session. Do not mutate
|
|
249
|
+
// private state unless the guest manager is running and linger was enabled by an operator.
|
|
250
|
+
"command -v systemd-run >/dev/null && systemctl --user show-environment >/dev/null || exit 29",
|
|
251
|
+
'test "$(loginctl show-user "$(id -un)" --property=Linger --value)" = yes || exit 29',
|
|
252
|
+
`mkdir -p "$directory"; test ! -L "$directory"; chmod 700 "$directory"`,
|
|
253
|
+
'rmdir "$mode_lock" || exit 28',
|
|
254
|
+
"trap - EXIT",
|
|
255
|
+
`token_file="$directory/daemon-${config.daemonPort}.token"`,
|
|
256
|
+
`pid_file="$directory/daemon-${config.daemonPort}.pid"`,
|
|
257
|
+
`identity_file="$directory/daemon-${config.daemonPort}.identity"`,
|
|
258
|
+
`log_file="$directory/daemon-${config.daemonPort}.log"`,
|
|
259
|
+
`start_lock="$directory/daemon-${config.daemonPort}.starting"`,
|
|
260
|
+
`unit="grip-shared-lima-${config.daemonPort}.service"`,
|
|
261
|
+
'test ! -L "$token_file"; test ! -L "$pid_file"; test ! -L "$identity_file"; test ! -L "$log_file"',
|
|
262
|
+
'if test -e "$log_file"; then test -f "$log_file" && test "$(stat -c %a "$log_file")" = 600 || exit 22; fi',
|
|
263
|
+
'test ! -e "$start_lock" && test ! -L "$start_lock" || exit 26',
|
|
264
|
+
'if test -e "$token_file" || test -e "$pid_file" || test -e "$identity_file"; then',
|
|
265
|
+
' test -f "$token_file" && test -f "$pid_file" && test -f "$identity_file" || exit 21',
|
|
266
|
+
' test "$(stat -c %a "$token_file")" = 600 || exit 22',
|
|
267
|
+
' test "$(stat -c %a "$pid_file")" = 600 || exit 22',
|
|
268
|
+
' test "$(stat -c %a "$identity_file")" = 600 || exit 22',
|
|
269
|
+
' pid="$(cat "$pid_file")"',
|
|
270
|
+
" case \"$pid\" in ''|*[!0-9]*) exit 23;; esac",
|
|
271
|
+
' kill -0 "$pid" || exit 24',
|
|
272
|
+
` start_time="$(${processStartTime} "/proc/$pid/stat")" || exit 25`,
|
|
273
|
+
' boot_id="$(cat /proc/sys/kernel/random/boot_id)" || exit 25',
|
|
274
|
+
' test -n "$start_time" && test -n "$boot_id" && test "$(cat "$identity_file")" = "$boot_id:$start_time" || exit 25',
|
|
275
|
+
' test "$(systemctl --user show -P MainPID "$unit")" = "$pid" && systemctl --user is-active --quiet "$unit" || exit 25',
|
|
276
|
+
' token="$(cat "$token_file")"',
|
|
277
|
+
"else",
|
|
278
|
+
' mkdir "$start_lock" || exit 26',
|
|
279
|
+
" trap 'rmdir \"$start_lock\" 2>/dev/null || true' EXIT",
|
|
280
|
+
" token=\"$(head -c 32 /dev/urandom | base64 | tr -d '\\n')\"",
|
|
281
|
+
' printf \'%s\' "$token" >"$token_file"',
|
|
282
|
+
' chmod 600 "$token_file"',
|
|
283
|
+
// The systemd user manager owns the process. It reads the private token file
|
|
284
|
+
// inside the unit, never from a systemd-run argument or environment property.
|
|
285
|
+
local
|
|
286
|
+
? ' grip_bin="$HOME/.local/bin/grip"; test -x "$grip_bin"'
|
|
287
|
+
: ' grip_bin="$(command -v grip)"; case "$grip_bin" in /*) ;; *) exit 25;; esac',
|
|
288
|
+
` systemd-run --user --unit="$unit" --property=Restart=no --property=KillMode=control-group -- sh -c 'set -eu; umask 077; GRIP_DAEMON_TOKEN="$(cat "$HOME/.cache/grip/shared-lima/daemon-${config.daemonPort}.token")"; test -n "$GRIP_DAEMON_TOKEN"; export GRIP_DAEMON_TOKEN; exec "$1" --daemon --daemon-host 127.0.0.1 --daemon-allow-insecure-transport --daemon-port ${config.daemonPort} --daemon-cwd "$2" --daemon-shared-parent "$2" --daemon-allow-root --daemon-allow-process-exec >"$HOME/.cache/grip/shared-lima/daemon-${config.daemonPort}.log" 2>&1 </dev/null' sh "$grip_bin" ${shellQuote(config.workspaceMountPath)} >/dev/null`,
|
|
289
|
+
' pid=""; attempts=0',
|
|
290
|
+
' while test "$attempts" -lt 50; do',
|
|
291
|
+
' pid="$(systemctl --user show -P MainPID "$unit")" || exit 25',
|
|
292
|
+
' case "$pid" in ""|0) sleep 0.1;; *[!0-9]*) exit 25;; *) break;; esac',
|
|
293
|
+
" attempts=$((attempts + 1))",
|
|
294
|
+
" done",
|
|
295
|
+
' case "$pid" in ""|0|*[!0-9]*) exit 25;; esac',
|
|
296
|
+
' systemctl --user is-active --quiet "$unit" || exit 25',
|
|
297
|
+
' printf \'%s\' "$pid" >"$pid_file"',
|
|
298
|
+
' chmod 600 "$pid_file"',
|
|
299
|
+
` start_time="$(${processStartTime} "/proc/$pid/stat")" || exit 25`,
|
|
300
|
+
' boot_id="$(cat /proc/sys/kernel/random/boot_id)" || exit 25',
|
|
301
|
+
' test -n "$start_time" && test -n "$boot_id" || exit 25',
|
|
302
|
+
' printf \'%s:%s\' "$boot_id" "$start_time" >"$identity_file"',
|
|
303
|
+
' chmod 600 "$identity_file"',
|
|
304
|
+
' rmdir "$start_lock" || exit 26',
|
|
305
|
+
" trap - EXIT",
|
|
306
|
+
"fi",
|
|
307
|
+
"printf 'GRIP_SHARED_TOKEN=%s\\n' \"$token\"",
|
|
308
|
+
].join("\n");
|
|
309
|
+
const args = ["shell", "--tty=false", options.instanceName, "sh", "-lc", script];
|
|
310
|
+
const result = await this.runner.run(config.limaBinary, args);
|
|
311
|
+
// Never include stdout/stderr from a credential-bearing shell in an error.
|
|
312
|
+
if (result.exitCode !== 0)
|
|
313
|
+
throw new Error("Shared Lima daemon state is uncertain; reconcile guest PID/token files manually");
|
|
314
|
+
const token = result.stdout.match(/(?:^|\n)GRIP_SHARED_TOKEN=([A-Za-z0-9+/]{43}=)(?:\r?\n|$)/)?.[1];
|
|
315
|
+
if (!token)
|
|
316
|
+
throw new Error("Shared Lima daemon did not return a valid credential; reconcile manually");
|
|
317
|
+
await this.readinessWaiter(config.daemonHostBind, config.daemonPort);
|
|
318
|
+
// Readiness can outlive the owner. Never hand a guest credential to a lost owner.
|
|
319
|
+
await owner.assertHeld();
|
|
320
|
+
return token;
|
|
321
|
+
}
|
|
322
|
+
/** Update only a verified supervised daemon. Staging happens before disconnecting peers. */
|
|
323
|
+
async updateSharedDaemon(options, owner) {
|
|
324
|
+
await owner.assertHeld();
|
|
325
|
+
await this.inspectSharedInstance(options);
|
|
326
|
+
const config = this.resolveConfig();
|
|
327
|
+
const name = options.instanceName;
|
|
328
|
+
const port = config.daemonPort;
|
|
329
|
+
if (!this.env.GRIP_SANDBOX_GUEST_BINARY && process.argv[1]?.endsWith("/packages/coding-agent/src/cli.ts")) {
|
|
330
|
+
throw new Error("Development sandbox update requires GRIP_SANDBOX_GUEST_BINARY pointing to a built Linux Grip executable");
|
|
331
|
+
}
|
|
332
|
+
const local = this.env.GRIP_SANDBOX_GUEST_BINARY
|
|
333
|
+
? await inspectLocalGuestBinary(this.env.GRIP_SANDBOX_GUEST_BINARY)
|
|
334
|
+
: undefined;
|
|
335
|
+
const shell = (script) => this.runner.run(config.limaBinary, ["shell", "--tty=false", name, "sh", "-lc", script]);
|
|
336
|
+
const directory = "$HOME/.cache/grip/shared-lima";
|
|
337
|
+
const unit = `grip-shared-lima-${port}.service`;
|
|
338
|
+
const verify = [
|
|
339
|
+
"set -eu",
|
|
340
|
+
`directory="${directory}"`,
|
|
341
|
+
`unit=${shellQuote(unit)}`,
|
|
342
|
+
'test -d "$directory" && test ! -L "$directory"',
|
|
343
|
+
'test ! -e "$HOME/.cache/grip/daemon-mode.lock" && test ! -L "$HOME/.cache/grip/daemon-mode.lock"',
|
|
344
|
+
`token_file="$directory/daemon-${port}.token"`,
|
|
345
|
+
`pid_file="$directory/daemon-${port}.pid"`,
|
|
346
|
+
`identity_file="$directory/daemon-${port}.identity"`,
|
|
347
|
+
'for file in "$token_file" "$pid_file" "$identity_file"; do test -f "$file" && test ! -L "$file" && test "$(stat -c %a "$file")" = 600; done',
|
|
348
|
+
'pid="$(cat "$pid_file")"; case "$pid" in ""|0|*[!0-9]*) exit 45;; esac',
|
|
349
|
+
'kill -0 "$pid"',
|
|
350
|
+
`start_time="$(awk '{ sub(/^.*\\) /, ""); if ($1 == "Z" || $1 == "X") exit 1; print $20 }' "/proc/$pid/stat")"`,
|
|
351
|
+
'boot_id="$(cat /proc/sys/kernel/random/boot_id)"',
|
|
352
|
+
'test -n "$start_time" && test "$(cat "$identity_file")" = "$boot_id:$start_time"',
|
|
353
|
+
'test "$(systemctl --user show -P MainPID "$unit")" = "$pid" && systemctl --user is-active --quiet "$unit"',
|
|
354
|
+
'case "$(systemctl --user show -P ExecStart "$unit")" in *"$HOME/.local/bin/grip"*) ;; *) exit 46;; esac',
|
|
355
|
+
];
|
|
356
|
+
const preflight = await shell(verify.join("\n"));
|
|
357
|
+
if (preflight.exitCode !== 0) {
|
|
358
|
+
throw new Error("Shared Lima daemon identity or binary path is uncertain; update refused without disconnecting clients");
|
|
359
|
+
}
|
|
360
|
+
const staged = await stageSharedGuestBinary(this.runner, config.limaBinary, name, unit, VERSION, local);
|
|
361
|
+
try {
|
|
362
|
+
await owner.assertHeld();
|
|
363
|
+
const stop = await shell([
|
|
364
|
+
...verify,
|
|
365
|
+
'mkdir "$HOME/.cache/grip/daemon-mode.lock" || exit 45',
|
|
366
|
+
'trap \u0027rmdir "$HOME/.cache/grip/daemon-mode.lock" 2>/dev/null || true\u0027 EXIT',
|
|
367
|
+
'systemctl --user stop "$unit"',
|
|
368
|
+
'test "$(systemctl --user show -P MainPID "$unit")" = 0',
|
|
369
|
+
'! kill -0 "$pid" 2>/dev/null',
|
|
370
|
+
].join("\n"));
|
|
371
|
+
if (stop.exitCode !== 0)
|
|
372
|
+
throw new Error("Shared daemon stop is uncertain; inspect the guest before retrying update");
|
|
373
|
+
await owner.assertHeld();
|
|
374
|
+
await staged.install();
|
|
375
|
+
await owner.assertHeld();
|
|
376
|
+
const restart = await shell([
|
|
377
|
+
"set -eu",
|
|
378
|
+
`directory="${directory}"`,
|
|
379
|
+
`unit=${shellQuote(unit)}`,
|
|
380
|
+
'test -d "$directory" && test ! -L "$directory"',
|
|
381
|
+
`token_file="$directory/daemon-${port}.token"`,
|
|
382
|
+
`pid_file="$directory/daemon-${port}.pid"`,
|
|
383
|
+
`identity_file="$directory/daemon-${port}.identity"`,
|
|
384
|
+
'for file in "$token_file" "$pid_file" "$identity_file"; do test -f "$file" && test ! -L "$file" && test "$(stat -c %a "$file")" = 600; done',
|
|
385
|
+
'test ! -e "$HOME/.cache/grip/daemon-mode.lock" && test ! -L "$HOME/.cache/grip/daemon-mode.lock"',
|
|
386
|
+
'mkdir "$HOME/.cache/grip/daemon-mode.lock" || exit 45',
|
|
387
|
+
'trap \u0027rmdir "$HOME/.cache/grip/daemon-mode.lock" 2>/dev/null || true\u0027 EXIT',
|
|
388
|
+
'old_pid="$(cat "$pid_file")"; case "$old_pid" in ""|0|*[!0-9]*) exit 45;; esac',
|
|
389
|
+
'! kill -0 "$old_pid" 2>/dev/null',
|
|
390
|
+
`test "$("$HOME/.local/bin/grip" --version)" = ${shellQuote(VERSION)}`,
|
|
391
|
+
'load="$(systemctl --user show -P LoadState "$unit" 2>/dev/null || true)"',
|
|
392
|
+
'case "$load" in',
|
|
393
|
+
' loaded) test "$(systemctl --user show -P MainPID "$unit")" = 0; systemctl --user start "$unit" ;;',
|
|
394
|
+
' not-found|"")',
|
|
395
|
+
` systemd-run --user --unit="$unit" --property=Restart=no --property=KillMode=control-group -- sh -c 'set -eu; umask 077; GRIP_DAEMON_TOKEN="$(cat "$HOME/.cache/grip/shared-lima/daemon-${port}.token")"; test -n "$GRIP_DAEMON_TOKEN"; export GRIP_DAEMON_TOKEN; exec "$1" --daemon --daemon-host 127.0.0.1 --daemon-allow-insecure-transport --daemon-port ${port} --daemon-cwd "$2" --daemon-shared-parent "$2" --daemon-allow-root --daemon-allow-process-exec >"$HOME/.cache/grip/shared-lima/daemon-${port}.log" 2>&1 </dev/null' sh "$HOME/.local/bin/grip" ${shellQuote(config.workspaceMountPath)} >/dev/null ;;`,
|
|
396
|
+
" *) exit 45 ;;",
|
|
397
|
+
"esac",
|
|
398
|
+
'pid=""; attempts=0',
|
|
399
|
+
'while test "$attempts" -lt 50; do',
|
|
400
|
+
' pid="$(systemctl --user show -P MainPID "$unit")" || exit 45',
|
|
401
|
+
' case "$pid" in ""|0) sleep 0.1;; *[!0-9]*) exit 45;; *) break;; esac',
|
|
402
|
+
" attempts=$((attempts + 1))",
|
|
403
|
+
"done",
|
|
404
|
+
'case "$pid" in ""|0|*[!0-9]*) exit 45;; esac',
|
|
405
|
+
'kill -0 "$pid"; systemctl --user is-active --quiet "$unit"',
|
|
406
|
+
`start_time="$(awk '{ sub(/^.*\\) /, ""); if ($1 == "Z" || $1 == "X") exit 1; print $20 }' "/proc/$pid/stat")"`,
|
|
407
|
+
'boot_id="$(cat /proc/sys/kernel/random/boot_id)"',
|
|
408
|
+
'test -n "$start_time" && test -n "$boot_id"',
|
|
409
|
+
'printf "%s" "$pid" >"$pid_file"',
|
|
410
|
+
'printf "%s:%s" "$boot_id" "$start_time" >"$identity_file"',
|
|
411
|
+
'chmod 600 "$pid_file" "$identity_file"',
|
|
412
|
+
].join("\n"));
|
|
413
|
+
if (restart.exitCode !== 0)
|
|
414
|
+
throw new Error("Shared daemon restart is uncertain; inspect the guest before retrying update");
|
|
415
|
+
await this.readinessWaiter(config.daemonHostBind, port);
|
|
416
|
+
await owner.assertHeld();
|
|
417
|
+
}
|
|
418
|
+
finally {
|
|
419
|
+
await staged.cleanup();
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
async startInstance(config, workspaceRoot, name, daemonPort) {
|
|
423
|
+
const mountExpression = `.mounts = [{"location":${JSON.stringify(workspaceRoot)},"mountPoint":${JSON.stringify(config.workspaceMountPath)},"writable":true}]`;
|
|
424
|
+
const forwardExpression = `.portForwards += [{"guestPort":${daemonPort},"hostPort":${daemonPort},"hostIP":${JSON.stringify(config.daemonHostBind)}}]`;
|
|
425
|
+
const args = [
|
|
426
|
+
"start",
|
|
427
|
+
"--tty=false",
|
|
428
|
+
"--name",
|
|
429
|
+
name,
|
|
430
|
+
"--mount-none",
|
|
431
|
+
"--set",
|
|
432
|
+
mountExpression,
|
|
433
|
+
"--set",
|
|
434
|
+
forwardExpression,
|
|
435
|
+
config.limaTemplate,
|
|
436
|
+
];
|
|
437
|
+
ensureLimaSuccessful(config.limaBinary, await this.runner.run(config.limaBinary, args), args);
|
|
438
|
+
}
|
|
439
|
+
async ensureGrip(config, name, managed, local) {
|
|
440
|
+
if (local) {
|
|
441
|
+
await installLocalGuestBinary(this.runner, config.limaBinary, name, local, VERSION);
|
|
442
|
+
return;
|
|
443
|
+
}
|
|
444
|
+
const checkArgs = [
|
|
445
|
+
"shell",
|
|
446
|
+
"--tty=false",
|
|
447
|
+
name,
|
|
448
|
+
"sh",
|
|
449
|
+
"-lc",
|
|
450
|
+
'command -v grip >/dev/null || test -x "$HOME/.local/bin/grip"',
|
|
451
|
+
];
|
|
452
|
+
const check = await this.runner.run(config.limaBinary, checkArgs);
|
|
453
|
+
if (check.exitCode === 0)
|
|
454
|
+
return;
|
|
455
|
+
if (!managed) {
|
|
456
|
+
throw new Error(`Lima instance ${name} does not provide grip; install the matching Linux release in the VM first`);
|
|
457
|
+
}
|
|
458
|
+
const script = `set -eu; tmp="$(mktemp)"; trap 'rm -f "$tmp"' EXIT; curl -fsSL -o "$tmp" https://raw.githubusercontent.com/greppleai/grip/main/install.sh; GRIP_VERSION=${shellQuote(`v${VERSION}`)} sh "$tmp"; test -x "$HOME/.local/bin/grip"`;
|
|
459
|
+
const args = ["shell", "--tty=false", name, "sh", "-lc", script];
|
|
460
|
+
ensureLimaSuccessful(config.limaBinary, await this.runner.run(config.limaBinary, args), args);
|
|
461
|
+
}
|
|
462
|
+
/** A legacy named attach or stop must not rotate or kill a shared guest daemon. */
|
|
463
|
+
async assertNoSharedGuestState(config, name, operation = "attach") {
|
|
464
|
+
const script = 'test ! -e "$HOME/.cache/grip/shared-lima" && test ! -L "$HOME/.cache/grip/shared-lima"';
|
|
465
|
+
const args = ["shell", "--tty=false", name, "sh", "-lc", script];
|
|
466
|
+
const result = await this.runner.run(config.limaBinary, args);
|
|
467
|
+
// A guest shell failure is ambiguous too; never guess that shared state is absent.
|
|
468
|
+
if (result.exitCode !== 0) {
|
|
469
|
+
throw new Error(`Lima named VM may host a shared daemon; legacy ${operation} refused; reconcile manually`);
|
|
470
|
+
}
|
|
471
|
+
}
|
|
472
|
+
async startDaemon(config, name) {
|
|
473
|
+
const pidFile = `.cache/grip/sandbox-daemon-${config.daemonPort}.pid`;
|
|
474
|
+
const logFile = `.cache/grip/sandbox-daemon-${config.daemonPort}.log`;
|
|
475
|
+
const script = [
|
|
476
|
+
"set -eu",
|
|
477
|
+
"umask 077",
|
|
478
|
+
`mkdir -p "$HOME/.cache/grip"`,
|
|
479
|
+
'mode_lock="$HOME/.cache/grip/daemon-mode.lock"',
|
|
480
|
+
'mkdir "$mode_lock" || exit 28',
|
|
481
|
+
"trap 'rmdir \"$mode_lock\" 2>/dev/null || true' EXIT",
|
|
482
|
+
'test ! -e "$HOME/.cache/grip/shared-lima" && test ! -L "$HOME/.cache/grip/shared-lima" || exit 29',
|
|
483
|
+
`if test -f "$HOME/${pidFile}"; then old_pid="$(cat "$HOME/${pidFile}")"; kill "$old_pid" 2>/dev/null || true; fi`,
|
|
484
|
+
`token="$(head -c 32 /dev/urandom | base64 | tr -d '\\n')"`,
|
|
485
|
+
`nohup env GRIP_DAEMON_TOKEN="$token" "${this.env.GRIP_SANDBOX_GUEST_BINARY ? "$HOME/.local/bin/grip" : '$(command -v grip || printf %s "$HOME/.local/bin/grip")'}" --daemon --daemon-host 127.0.0.1 --daemon-allow-insecure-transport --daemon-port ${config.daemonPort} --daemon-cwd ${shellQuote(config.workspaceMountPath)} --daemon-allow-root --daemon-allow-process-exec >"$HOME/${logFile}" 2>&1 </dev/null &`,
|
|
486
|
+
`echo $! >"$HOME/${pidFile}"`,
|
|
487
|
+
'rmdir "$mode_lock" || exit 28',
|
|
488
|
+
"trap - EXIT",
|
|
489
|
+
`printf 'GRIP_SANDBOX_TOKEN=%s\\n' "$token"`,
|
|
490
|
+
].join("\n");
|
|
491
|
+
const args = ["shell", "--tty=false", "--workdir", config.workspaceMountPath, name, "sh", "-lc", script];
|
|
492
|
+
const result = await this.runner.run(config.limaBinary, args);
|
|
493
|
+
ensureLimaSuccessful(config.limaBinary, result, args);
|
|
494
|
+
const token = result.stdout.match(/(?:^|\n)GRIP_SANDBOX_TOKEN=([^\r\n]+)/)?.[1];
|
|
495
|
+
if (!token)
|
|
496
|
+
throw new Error(`Lima instance ${name} started the daemon without returning an authentication token`);
|
|
497
|
+
return token;
|
|
498
|
+
}
|
|
499
|
+
async prepareExistingInstance(config, record, name, workspaceRoot) {
|
|
500
|
+
const mount = findWorkspaceMount(record, config.workspaceMountPath);
|
|
501
|
+
if (!mount || resolve(mount.location ?? "") !== workspaceRoot || !mount.writable) {
|
|
502
|
+
throw new Error(`Lima instance ${name} must mount ${workspaceRoot} read-write at ${config.workspaceMountPath}`);
|
|
503
|
+
}
|
|
504
|
+
const status = record.status?.toLowerCase();
|
|
505
|
+
if (status === "running")
|
|
506
|
+
return;
|
|
507
|
+
if (status !== "stopped") {
|
|
508
|
+
throw new Error(`Lima instance ${name} is in an uncertain state; refusing to resume`);
|
|
509
|
+
}
|
|
510
|
+
const args = ["start", "--tty=false", name];
|
|
511
|
+
ensureLimaSuccessful(config.limaBinary, await this.runner.run(config.limaBinary, args), args);
|
|
512
|
+
}
|
|
513
|
+
async findExactLegacyInstance(config, name) {
|
|
514
|
+
if (!name)
|
|
515
|
+
return undefined;
|
|
516
|
+
const records = await this.listRecords(config, name);
|
|
517
|
+
if (records.length === 0)
|
|
518
|
+
return undefined;
|
|
519
|
+
if (records.length !== 1 || records[0]?.name !== name) {
|
|
520
|
+
throw new Error("Lima instance lookup did not return one exact name; refusing to attach or create");
|
|
521
|
+
}
|
|
522
|
+
return records[0];
|
|
523
|
+
}
|
|
524
|
+
async start(options) {
|
|
525
|
+
const requestedName = options.name?.trim();
|
|
526
|
+
if (!requestedName) {
|
|
527
|
+
if (options.update)
|
|
528
|
+
throw new Error("Sandbox update requires a named running shared VM");
|
|
529
|
+
return this.startWithLegacyInstance(options);
|
|
530
|
+
}
|
|
531
|
+
// Coordinate VM resume/create as well as guest daemon launch with a named shared owner.
|
|
532
|
+
// A stale lock is ambiguous, not permission to start an existing VM.
|
|
533
|
+
const owner = await acquireSharedLimaOwnerLock(requestedName);
|
|
534
|
+
try {
|
|
535
|
+
const config = this.resolveConfig(options);
|
|
536
|
+
const existing = await this.findExactLegacyInstance(config, requestedName);
|
|
537
|
+
if (options.update && existing?.status?.toLowerCase() !== "running") {
|
|
538
|
+
throw new Error("Sandbox update requires an existing running shared VM");
|
|
539
|
+
}
|
|
540
|
+
if (existing?.status?.toLowerCase() !== "running") {
|
|
541
|
+
return await this.startWithLegacyInstance(options, { record: existing });
|
|
542
|
+
}
|
|
543
|
+
// Select the guest mode before any legacy setup. An unreadable or ambiguous
|
|
544
|
+
// marker is not permission to start a per-session daemon in this VM.
|
|
545
|
+
const probe = await this.runner.run(config.limaBinary, [
|
|
546
|
+
"shell",
|
|
547
|
+
"--tty=false",
|
|
548
|
+
requestedName,
|
|
549
|
+
"sh",
|
|
550
|
+
"-lc",
|
|
551
|
+
'if test -e "$HOME/.cache/grip/shared-lima" || test -L "$HOME/.cache/grip/shared-lima"; then if test -d "$HOME/.cache/grip/shared-lima" && test ! -L "$HOME/.cache/grip/shared-lima"; then printf "GRIP_SHARED_GUEST\\n"; else exit 42; fi; else printf "GRIP_LEGACY_GUEST\\n"; fi',
|
|
552
|
+
]);
|
|
553
|
+
if (probe.exitCode !== 0)
|
|
554
|
+
throw new Error("Lima guest daemon mode is uncertain; refusing named attach");
|
|
555
|
+
if (probe.stdout.trim() === "GRIP_LEGACY_GUEST") {
|
|
556
|
+
if (options.update)
|
|
557
|
+
throw new Error("Sandbox update requires a supervised shared guest; legacy guest is unchanged");
|
|
558
|
+
return await this.startWithLegacyInstance(options, { record: existing });
|
|
559
|
+
}
|
|
560
|
+
if (probe.stdout.trim() !== "GRIP_SHARED_GUEST") {
|
|
561
|
+
throw new Error("Lima guest daemon mode is uncertain; refusing named attach");
|
|
562
|
+
}
|
|
563
|
+
await owner.assertHeld();
|
|
564
|
+
const mount = findWorkspaceMount(existing, config.workspaceMountPath);
|
|
565
|
+
if (!mount?.location)
|
|
566
|
+
throw new Error("Shared Lima instance mount is unavailable; refusing attach");
|
|
567
|
+
const sharedOptions = {
|
|
568
|
+
instanceName: requestedName,
|
|
569
|
+
hostParent: resolve(mount.location),
|
|
570
|
+
hostRoot: resolve(options.workspaceRoot),
|
|
571
|
+
};
|
|
572
|
+
const inspection = await this.inspectSharedInstance(sharedOptions);
|
|
573
|
+
if (options.update)
|
|
574
|
+
await this.updateSharedDaemon(sharedOptions, owner);
|
|
575
|
+
const token = await this.ensureSharedDaemon(sharedOptions, owner, options.update);
|
|
576
|
+
const daemonUrl = `grip+${inspection.daemonUrl}?root=${encodeURIComponent(inspection.guestRoot)}`;
|
|
577
|
+
return {
|
|
578
|
+
containerId: requestedName,
|
|
579
|
+
containerName: requestedName,
|
|
580
|
+
workspaceRoot: inspection.hostRoot,
|
|
581
|
+
workspaceMountPath: inspection.guestRoot,
|
|
582
|
+
daemonUrl,
|
|
583
|
+
daemonUrlRedacted: inspection.daemonUrl,
|
|
584
|
+
token,
|
|
585
|
+
labels: { [`${SANDBOX_LABEL_PREFIX}.runtime`]: "lima", [`${SANDBOX_LABEL_PREFIX}.version`]: VERSION },
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
finally {
|
|
589
|
+
await owner.release();
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
async startWithLegacyInstance(options, known) {
|
|
593
|
+
const workspaceRoot = resolve(options.workspaceRoot);
|
|
594
|
+
const local = this.env.GRIP_SANDBOX_GUEST_BINARY
|
|
595
|
+
? await inspectLocalGuestBinary(this.env.GRIP_SANDBOX_GUEST_BINARY)
|
|
596
|
+
: undefined;
|
|
597
|
+
const config = this.resolveConfig(options);
|
|
598
|
+
const requestedName = options.name?.trim();
|
|
599
|
+
const managed = !requestedName;
|
|
600
|
+
const existing = known ? known.record : await this.findExactLegacyInstance(config, requestedName);
|
|
601
|
+
if (existing)
|
|
602
|
+
await this.prepareExistingInstance(config, existing, requestedName, workspaceRoot);
|
|
603
|
+
const configuredForward = existing ? findDaemonForward(existing, config.daemonPort) : undefined;
|
|
604
|
+
if (configuredForward && configuredForward.guestPort !== configuredForward.hostPort) {
|
|
605
|
+
throw new Error(`Lima instance ${requestedName} must forward the sandbox daemon on the same guest and host port`);
|
|
606
|
+
}
|
|
607
|
+
const daemonPort = configuredForward?.hostPort ?? (await this.portAllocator(config.daemonHostBind, config.daemonPort));
|
|
608
|
+
const name = requestedName ?? createInstanceName(config, workspaceRoot, options.sessionId ?? "session", daemonPort);
|
|
609
|
+
const effectiveConfig = { ...config, daemonPort };
|
|
610
|
+
if (!existing)
|
|
611
|
+
await this.startInstance(effectiveConfig, workspaceRoot, name, daemonPort);
|
|
612
|
+
// A failed guest install/start can have changed state; never delete an uncertain VM.
|
|
613
|
+
if (existing)
|
|
614
|
+
await this.assertNoSharedGuestState(effectiveConfig, name);
|
|
615
|
+
await this.ensureGrip(effectiveConfig, name, !existing, local);
|
|
616
|
+
const token = await this.startDaemon(effectiveConfig, name);
|
|
617
|
+
await this.readinessWaiter(config.daemonHostBind, daemonPort);
|
|
618
|
+
// A failed readiness check is not proof that this daemon is ours to stop.
|
|
619
|
+
// Leave uncertain guest state for explicit operator reconciliation.
|
|
620
|
+
this.managedInstances.set(name, { workspaceRoot, daemonPort, ownerId: options.sessionId, managed });
|
|
621
|
+
const daemonUrl = `ws://${urlHost(daemonConnectionHost(config.daemonHostBind))}:${daemonPort}${DAEMON_WEBSOCKET_PATH}`;
|
|
622
|
+
return {
|
|
623
|
+
containerId: name,
|
|
624
|
+
containerName: name,
|
|
625
|
+
workspaceRoot,
|
|
626
|
+
workspaceMountPath: config.workspaceMountPath,
|
|
627
|
+
daemonUrl,
|
|
628
|
+
daemonUrlRedacted: daemonUrl,
|
|
629
|
+
token,
|
|
630
|
+
labels: { [`${SANDBOX_LABEL_PREFIX}.runtime`]: "lima", [`${SANDBOX_LABEL_PREFIX}.version`]: VERSION },
|
|
631
|
+
};
|
|
632
|
+
}
|
|
633
|
+
async list(options) {
|
|
634
|
+
const config = this.resolveConfig();
|
|
635
|
+
const workspaceRoot = resolve(options.workspaceRoot);
|
|
636
|
+
return (await this.listRecords(config))
|
|
637
|
+
.map((record) => toSandboxContainer(record, config.workspaceMountPath))
|
|
638
|
+
.filter((instance) => instance.workspaceRoot && (options.allWorkspaces || instance.workspaceRoot === workspaceRoot));
|
|
639
|
+
}
|
|
640
|
+
async stopDaemon(config, name, daemonPort) {
|
|
641
|
+
const pidFile = `.cache/grip/sandbox-daemon-${daemonPort}.pid`;
|
|
642
|
+
const script = `if test -f "$HOME/${pidFile}"; then pid="$(cat "$HOME/${pidFile}")"; kill "$pid" 2>/dev/null || true; rm -f "$HOME/${pidFile}"; fi`;
|
|
643
|
+
const args = ["shell", "--tty=false", name, "sh", "-lc", script];
|
|
644
|
+
ensureLimaSuccessful(config.limaBinary, await this.runner.run(config.limaBinary, args), args);
|
|
645
|
+
}
|
|
646
|
+
async stop(options) {
|
|
647
|
+
const config = this.resolveConfig();
|
|
648
|
+
const instances = await this.list({ workspaceRoot: options.workspaceRoot });
|
|
649
|
+
const selected = selectLimaSandbox(instances, options.target ?? options.currentContainerId);
|
|
650
|
+
if (!selected)
|
|
651
|
+
return { status: "not-found", message: "No matching Grip Lima sandbox found" };
|
|
652
|
+
if (instances.filter((instance) => instance.name === selected.name).length !== 1) {
|
|
653
|
+
throw new Error("Lima sandbox identity is ambiguous; refusing to stop a VM or daemon");
|
|
654
|
+
}
|
|
655
|
+
const tracked = this.managedInstances.get(selected.name);
|
|
656
|
+
// Names and Lima's list output do not establish ownership. In particular, a
|
|
657
|
+
// shared named VM can have the ordinary sandbox prefix without being ours.
|
|
658
|
+
// Only a VM started by this session may be stopped or have its daemon touched.
|
|
659
|
+
if (!tracked || tracked.workspaceRoot !== selected.workspaceRoot || tracked.daemonPort !== selected.daemonPort) {
|
|
660
|
+
throw new Error("Lima sandbox ownership is unknown or daemon port changed; refusing to stop an untracked VM or daemon");
|
|
661
|
+
}
|
|
662
|
+
// A shared guest must never lose its daemon or VM to a legacy
|
|
663
|
+
// in-process record. Resolve the selected VM again under the host owner lock.
|
|
664
|
+
const owner = await acquireSharedLimaOwnerLock(selected.name);
|
|
665
|
+
try {
|
|
666
|
+
const matches = (await this.list({ workspaceRoot: options.workspaceRoot })).filter((instance) => instance.name === selected.name);
|
|
667
|
+
const current = matches[0];
|
|
668
|
+
if (matches.length !== 1 ||
|
|
669
|
+
!current ||
|
|
670
|
+
current.id !== selected.id ||
|
|
671
|
+
current.state !== selected.state ||
|
|
672
|
+
current.workspaceRoot !== selected.workspaceRoot ||
|
|
673
|
+
current.daemonPort !== selected.daemonPort) {
|
|
674
|
+
throw new Error("Lima sandbox identity changed during stop; refusing to touch the VM or daemon");
|
|
675
|
+
}
|
|
676
|
+
return await this.stopTrackedInstance(config, current, tracked);
|
|
677
|
+
}
|
|
678
|
+
finally {
|
|
679
|
+
await owner.release();
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
async stopTrackedInstance(config, selected, tracked) {
|
|
683
|
+
const ownsInstance = tracked.managed;
|
|
684
|
+
if (selected.state !== "running") {
|
|
685
|
+
if (ownsInstance && config.cleanup === "remove") {
|
|
686
|
+
// An already stopped VM cannot be probed without resuming it. Its
|
|
687
|
+
// in-memory record is not proof it was never repurposed externally.
|
|
688
|
+
throw new Error("Lima sandbox is stopped; refusing to delete an unverifiable VM; reconcile manually");
|
|
689
|
+
}
|
|
690
|
+
this.managedInstances.delete(selected.name);
|
|
691
|
+
return { status: "already-stopped", container: selected };
|
|
692
|
+
}
|
|
693
|
+
await this.assertNoSharedGuestState(config, selected.name, "stop");
|
|
694
|
+
await this.stopDaemon(config, selected.name, tracked?.daemonPort ?? selected.daemonPort ?? config.daemonPort);
|
|
695
|
+
if (ownsInstance) {
|
|
696
|
+
const args = config.cleanup === "remove" ? ["delete", "--force", selected.name] : ["stop", selected.name];
|
|
697
|
+
ensureLimaSuccessful(config.limaBinary, await this.runner.run(config.limaBinary, args), args);
|
|
698
|
+
}
|
|
699
|
+
this.managedInstances.delete(selected.name);
|
|
700
|
+
return { status: ownsInstance && config.cleanup === "remove" ? "removed" : "stopped", container: selected };
|
|
701
|
+
}
|
|
702
|
+
async stopManagedInstances() {
|
|
703
|
+
const failures = [];
|
|
704
|
+
for (const [name, instance] of [...this.managedInstances]) {
|
|
705
|
+
try {
|
|
706
|
+
await this.stop({ workspaceRoot: instance.workspaceRoot, target: name, currentContainerId: name });
|
|
707
|
+
}
|
|
708
|
+
catch (error) {
|
|
709
|
+
failures.push(error);
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
if (failures.length > 0)
|
|
713
|
+
throw new AggregateError(failures, "Failed to stop managed Lima sandbox instances");
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
//# sourceMappingURL=lima.js.map
|