windows-development-sandbox 1.7.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.example.json +10 -0
- package/dist/app/context.d.ts +8 -0
- package/dist/app/context.js +12 -0
- package/dist/app/features/defs.d.ts +322 -0
- package/dist/app/features/defs.js +28 -0
- package/dist/app/features/sandbox/index.d.ts +2 -0
- package/dist/app/features/sandbox/index.js +3 -0
- package/dist/app/features/sandbox/sandbox.def.d.ts +193 -0
- package/dist/app/features/sandbox/sandbox.def.js +245 -0
- package/dist/app/features/sandbox/sandbox.run.d.ts +72 -0
- package/dist/app/features/sandbox/sandbox.run.js +98 -0
- package/dist/app/features/sessions/index.d.ts +2 -0
- package/dist/app/features/sessions/index.js +3 -0
- package/dist/app/features/sessions/sessions.def.d.ts +141 -0
- package/dist/app/features/sessions/sessions.def.js +176 -0
- package/dist/app/features/sessions/sessions.run.d.ts +39 -0
- package/dist/app/features/sessions/sessions.run.js +58 -0
- package/dist/{cli/menu/settings/categories.d.ts → app/features/settings/categories.def.d.ts} +2 -0
- package/dist/{cli/menu/settings/categories.js → app/features/settings/categories.def.js} +24 -5
- package/dist/app/features/settings/index.d.ts +5 -0
- package/dist/app/features/settings/index.js +6 -0
- package/dist/{cli/menu/settings/config-file.d.ts → app/features/settings/settings-file.d.ts} +1 -1
- package/dist/{cli/menu/settings/config-file.js → app/features/settings/settings-file.js} +1 -1
- package/dist/app/features/settings/settings-rows.d.ts +35 -0
- package/dist/app/features/settings/settings-rows.js +94 -0
- package/dist/app/features/settings/settings.def.d.ts +157 -0
- package/dist/app/features/settings/settings.def.js +179 -0
- package/dist/app/features/settings/settings.run.d.ts +67 -0
- package/dist/app/features/settings/settings.run.js +84 -0
- package/dist/app/kernel/define.d.ts +143 -0
- package/dist/app/kernel/define.js +42 -0
- package/dist/app/kernel/errors.d.ts +34 -0
- package/dist/app/kernel/errors.js +45 -0
- package/dist/app/kernel/fields.d.ts +70 -0
- package/dist/app/kernel/fields.js +243 -0
- package/dist/app/kernel/index.d.ts +8 -0
- package/dist/app/kernel/index.js +10 -0
- package/dist/app/kernel/io.d.ts +193 -0
- package/dist/app/kernel/io.js +126 -0
- package/dist/app/kernel/rpc.d.ts +156 -0
- package/dist/app/kernel/rpc.js +47 -0
- package/dist/app/kernel/text.d.ts +6 -0
- package/dist/app/kernel/text.js +57 -0
- package/dist/app/kernel/view.d.ts +146 -0
- package/dist/app/kernel/view.js +28 -0
- package/dist/app/registry.d.ts +10 -0
- package/dist/app/registry.js +50 -0
- package/dist/cli/args.d.ts +5 -0
- package/dist/cli/args.js +6 -0
- package/dist/cli/commands/engine.d.ts +2 -0
- package/dist/cli/commands/engine.js +60 -0
- package/dist/cli/commands/index.d.ts +1 -1
- package/dist/cli/commands/index.js +1 -1
- package/dist/cli/commands/launch/launch.js +47 -7
- package/dist/cli/commands/launch/prepare.js +3 -3
- package/dist/cli/commands/launch/running.js +2 -1
- package/dist/cli/commands/launch/summary.d.ts +2 -0
- package/dist/cli/commands/maintenance/config-share.d.ts +12 -0
- package/dist/cli/commands/maintenance/config-share.js +80 -0
- package/dist/cli/commands/maintenance/config.js +8 -82
- package/dist/cli/commands/maintenance/logs.js +14 -0
- package/dist/cli/commands/registry.js +3 -7
- package/dist/cli/commands/repair/checks/contained.d.ts +2 -0
- package/dist/cli/commands/repair/checks/contained.js +139 -0
- package/dist/cli/commands/repair/checks/hcs.d.ts +7 -0
- package/dist/cli/commands/repair/checks/hcs.js +28 -0
- package/dist/cli/commands/repair/checks/index.js +4 -0
- package/dist/cli/commands/repair/checks/pc.js +32 -1
- package/dist/cli/commands/repair/checks/sandbox.js +16 -1
- package/dist/cli/commands/repair/checks/vpn.js +34 -9
- package/dist/cli/commands/repair/env.js +2 -1
- package/dist/cli/commands/sessions/index.d.ts +0 -4
- package/dist/cli/commands/sessions/index.js +3 -7
- package/dist/cli/commands/shared-use.d.ts +5 -2
- package/dist/cli/commands/shared-use.js +11 -8
- package/dist/cli/commands/storage/contained.d.ts +3 -0
- package/dist/cli/commands/storage/contained.js +179 -0
- package/dist/cli/commands/storage/offer.js +7 -1
- package/dist/cli/commands/storage/storage.js +10 -2
- package/dist/cli/commands/user-config.js +1 -1
- package/dist/cli/commands/vpn.js +19 -3
- package/dist/cli/commands/web.js +2 -0
- package/dist/cli/index.js +2 -1
- package/dist/cli/manifest.d.ts +72 -104
- package/dist/cli/manifest.js +64 -39
- package/dist/cli/menu/add-agent.d.ts +1 -1
- package/dist/cli/menu/add-agent.js +1 -1
- package/dist/cli/menu/apps.d.ts +7 -1
- package/dist/cli/menu/apps.js +36 -0
- package/dist/cli/menu/command-fields.d.ts +1 -1
- package/dist/cli/menu/command-form.js +2 -2
- package/dist/cli/menu/io-menu.d.ts +29 -0
- package/dist/cli/menu/io-menu.js +126 -0
- package/dist/cli/menu/live.d.ts +27 -0
- package/dist/cli/menu/live.js +69 -0
- package/dist/cli/menu/memory.d.ts +19 -0
- package/dist/cli/menu/memory.js +53 -0
- package/dist/cli/menu/menu.d.ts +10 -1
- package/dist/cli/menu/menu.js +27 -9
- package/dist/cli/menu/pages/agents-page.d.ts +3 -1
- package/dist/cli/menu/pages/agents-page.js +12 -5
- package/dist/cli/menu/pages/apps-page.d.ts +3 -1
- package/dist/cli/menu/pages/apps-page.js +19 -2
- package/dist/cli/menu/pages/list-page.d.ts +27 -0
- package/dist/cli/menu/pages/list-page.js +109 -7
- package/dist/cli/menu/pages/maintenance-page.d.ts +0 -5
- package/dist/cli/menu/pages/maintenance-page.js +17 -19
- package/dist/cli/menu/pages/sandbox-page.d.ts +4 -6
- package/dist/cli/menu/pages/sandbox-page.js +26 -118
- package/dist/cli/menu/pages/scopes.d.ts +1 -1
- package/dist/cli/menu/pages/sessions-page.d.ts +5 -11
- package/dist/cli/menu/pages/sessions-page.js +19 -88
- package/dist/cli/menu/pages/settings-page.d.ts +2 -10
- package/dist/cli/menu/pages/settings-page.js +64 -94
- package/dist/cli/menu/render-view.d.ts +28 -0
- package/dist/cli/menu/render-view.js +112 -0
- package/dist/cli/menu/settings/{path-kind.d.ts → ask-path.d.ts} +1 -7
- package/dist/cli/menu/settings/ask-path.js +14 -0
- package/dist/cli/menu/settings/collections/collection-editor.d.ts +1 -1
- package/dist/cli/menu/settings/collections/string-list-editor.d.ts +1 -2
- package/dist/cli/menu/settings/collections/string-list-editor.js +1 -1
- package/dist/cli/menu/settings/draft.d.ts +1 -1
- package/dist/cli/menu/settings/format.d.ts +1 -3
- package/dist/cli/menu/settings/format.js +6 -36
- package/dist/cli/menu/settings/index.d.ts +1 -3
- package/dist/cli/menu/settings/index.js +3 -3
- package/dist/cli/menu/settings/object-editor.d.ts +1 -1
- package/dist/cli/menu/settings/share.d.ts +36 -0
- package/dist/cli/menu/settings/share.js +131 -0
- package/dist/cli/menu/settings/value-editor.d.ts +5 -1
- package/dist/cli/menu/settings/value-editor.js +57 -54
- package/dist/cli/menu/several.js +1 -1
- package/dist/cli/menu/share-settings.d.ts +21 -0
- package/dist/cli/menu/share-settings.js +112 -0
- package/dist/cli/menu/shell.d.ts +21 -5
- package/dist/cli/menu/shell.js +31 -6
- package/dist/cli/menu/views.d.ts +7 -0
- package/dist/cli/menu/views.js +11 -0
- package/dist/cli/menu/vpn-login.js +8 -0
- package/dist/cli/operations/handler.d.ts +6 -0
- package/dist/cli/operations/handler.js +61 -0
- package/dist/cli/operations/index.d.ts +4 -0
- package/dist/cli/operations/index.js +5 -0
- package/dist/cli/operations/input.d.ts +6 -0
- package/dist/cli/operations/input.js +37 -0
- package/dist/cli/operations/io-cli.d.ts +7 -0
- package/dist/cli/operations/io-cli.js +62 -0
- package/dist/cli/operations/spec.d.ts +18 -0
- package/dist/cli/operations/spec.js +108 -0
- package/dist/cli/output/colors.d.ts +2 -2
- package/dist/cli/output/colors.js +2 -11
- package/dist/cli/output/index.d.ts +1 -0
- package/dist/cli/output/index.js +1 -0
- package/dist/cli/output/print.d.ts +3 -1
- package/dist/cli/output/print.js +7 -3
- package/dist/cli/output/progress.d.ts +15 -0
- package/dist/cli/output/progress.js +44 -0
- package/dist/cli/output/render-view.d.ts +4 -0
- package/dist/cli/output/render-view.js +63 -0
- package/dist/cli/services/agent-commands-service.d.ts +2 -0
- package/dist/cli/services/agent-commands-service.js +11 -2
- package/dist/cli/services/logs-service.js +4 -3
- package/dist/cli/tui/app.d.ts +6 -1
- package/dist/cli/tui/app.js +26 -4
- package/dist/cli/tui/list/list-screen.d.ts +14 -0
- package/dist/cli/tui/list/list-screen.js +64 -36
- package/dist/cli/tui/list/list-types.d.ts +2 -0
- package/dist/cli/tui/terminal.d.ts +7 -0
- package/dist/cli/tui/terminal.js +30 -10
- package/dist/core/config/defaults.js +8 -0
- package/dist/core/schema/config.d.ts +13 -0
- package/dist/core/schema/config.js +16 -1
- package/dist/core/schema/harness.d.ts +1 -0
- package/dist/core/schema/harness.js +5 -0
- package/dist/core/schema/sandbox.d.ts +6 -0
- package/dist/core/schema/sandbox.js +20 -3
- package/dist/core/schema/vpn.d.ts +2 -1
- package/dist/core/schema/vpn.js +3 -3
- package/dist/core/types.d.ts +23 -5
- package/dist/core/util/fs.d.ts +2 -0
- package/dist/core/util/fs.js +9 -0
- package/dist/core/util/index.d.ts +1 -1
- package/dist/core/util/index.js +1 -1
- package/dist/guest/agents/agent-files.d.ts +5 -0
- package/dist/guest/agents/agent-files.js +4 -0
- package/dist/guest/agents/local-state.d.ts +2 -0
- package/dist/guest/agents/local-state.js +21 -1
- package/dist/guest/boot/boot.js +2 -1
- package/dist/guest/daemon/daemon.js +4 -0
- package/dist/guest/daemon/sessions.d.ts +5 -0
- package/dist/guest/daemon/sessions.js +17 -3
- package/dist/guest/entries/daemon.js +3 -0
- package/dist/guest/governor/decide.d.ts +61 -0
- package/dist/guest/governor/decide.js +182 -0
- package/dist/guest/governor/governor.d.ts +42 -0
- package/dist/guest/governor/governor.js +214 -0
- package/dist/guest/governor/index.d.ts +2 -0
- package/dist/guest/governor/index.js +2 -0
- package/dist/guest/runtime/csc.d.ts +1 -0
- package/dist/guest/runtime/csc.js +1 -0
- package/dist/guest/sessions/viewer.js +3 -1
- package/dist/guest/toolchains/native/rust-extras.js +4 -2
- package/dist/guest/vpn/vpn.js +69 -21
- package/dist/guest/vpn/wireguard.d.ts +32 -0
- package/dist/guest/vpn/wireguard.js +132 -0
- package/dist/host/agent-commands/commands.d.ts +4 -0
- package/dist/host/agent-commands/commands.js +31 -7
- package/dist/host/audit/log.d.ts +1 -1
- package/dist/host/channel/attach.d.ts +3 -1
- package/dist/host/channel/attach.js +5 -2
- package/dist/host/channel/channel.d.ts +2 -0
- package/dist/host/channel/channel.js +4 -0
- package/dist/host/engines/engine.d.ts +12 -0
- package/dist/host/engines/engine.js +1 -0
- package/dist/host/engines/hcs/check.d.ts +25 -0
- package/dist/host/engines/hcs/check.js +95 -0
- package/dist/host/engines/hcs/documents.d.ts +44 -0
- package/dist/host/engines/hcs/documents.js +155 -0
- package/dist/host/engines/hcs/engine.d.ts +39 -0
- package/dist/host/engines/hcs/engine.js +171 -0
- package/dist/host/engines/hcs/helper.d.ts +43 -0
- package/dist/host/engines/hcs/helper.js +173 -0
- package/dist/host/engines/hcs/images.d.ts +37 -0
- package/dist/host/engines/hcs/images.js +152 -0
- package/dist/host/engines/index.d.ts +7 -0
- package/dist/host/engines/index.js +5 -0
- package/dist/host/engines/registry.d.ts +16 -0
- package/dist/host/engines/registry.js +30 -0
- package/dist/host/engines/types.d.ts +58 -0
- package/dist/host/engines/types.js +1 -0
- package/dist/host/engines/windows-sandbox/engine.d.ts +16 -0
- package/dist/host/engines/windows-sandbox/engine.js +63 -0
- package/dist/host/engines/windows-sandbox/wsb-text.d.ts +2 -0
- package/dist/host/engines/windows-sandbox/wsb-text.js +29 -0
- package/dist/host/launch/generate.d.ts +5 -1
- package/dist/host/launch/generate.js +50 -8
- package/dist/host/launch/index.d.ts +3 -1
- package/dist/host/launch/index.js +3 -1
- package/dist/host/launch/launch-plan.d.ts +13 -0
- package/dist/host/launch/launch-plan.js +26 -0
- package/dist/host/launch/mappings.js +2 -1
- package/dist/host/launch/risk-notes.d.ts +10 -0
- package/dist/host/launch/risk-notes.js +18 -0
- package/dist/host/launch/session-file.d.ts +2 -0
- package/dist/host/launch/session-file.js +7 -1
- package/dist/host/launch/wsb-file.d.ts +28 -4
- package/dist/host/launch/wsb-file.js +61 -42
- package/dist/host/life/crash-report.d.ts +27 -1
- package/dist/host/life/crash-report.js +173 -7
- package/dist/host/life/host-memory.d.ts +40 -0
- package/dist/host/life/host-memory.js +137 -0
- package/dist/host/life/index.d.ts +2 -0
- package/dist/host/life/index.js +2 -0
- package/dist/host/life/stop-events.d.ts +2 -0
- package/dist/host/life/stop-events.js +20 -3
- package/dist/host/life/stop-warning.js +1 -1
- package/dist/host/life/watchdog.d.ts +54 -0
- package/dist/host/life/watchdog.js +108 -0
- package/dist/host/native.d.ts +3 -2
- package/dist/host/native.js +22 -3
- package/dist/host/profile/claude-login.js +3 -2
- package/dist/host/sandbox/contained-deps.d.ts +2 -0
- package/dist/host/sandbox/contained-deps.js +17 -0
- package/dist/host/sandbox/index.d.ts +2 -0
- package/dist/host/sandbox/index.js +2 -0
- package/dist/host/sandbox/platform.d.ts +2 -0
- package/dist/host/sandbox/platform.js +7 -7
- package/dist/host/sandbox/tasklist.d.ts +13 -0
- package/dist/host/sandbox/tasklist.js +47 -0
- package/dist/host/secrets/launch-secrets.js +2 -1
- package/dist/host/sharing/current.js +2 -6
- package/dist/host/storage/contained/check.d.ts +9 -0
- package/dist/host/storage/contained/check.js +37 -0
- package/dist/host/storage/contained/contained-storage.d.ts +66 -0
- package/dist/host/storage/contained/contained-storage.js +168 -0
- package/dist/host/storage/contained/disk-port.d.ts +43 -0
- package/dist/host/storage/contained/disk-port.js +122 -0
- package/dist/host/storage/contained/index.d.ts +9 -0
- package/dist/host/storage/contained/index.js +8 -0
- package/dist/host/storage/contained/layout.d.ts +28 -0
- package/dist/host/storage/contained/layout.js +45 -0
- package/dist/host/storage/contained/resolve.d.ts +4 -0
- package/dist/host/storage/contained/resolve.js +30 -0
- package/dist/host/storage/contained/setting.d.ts +1 -0
- package/dist/host/storage/contained/setting.js +5 -0
- package/dist/host/storage/contained/state.d.ts +89 -0
- package/dist/host/storage/contained/state.js +166 -0
- package/dist/host/storage/contained/transfer.d.ts +24 -0
- package/dist/host/storage/contained/transfer.js +121 -0
- package/dist/host/storage/index.d.ts +2 -0
- package/dist/host/storage/index.js +2 -0
- package/dist/host/storage/providers/contained.d.ts +15 -0
- package/dist/host/storage/providers/contained.js +39 -0
- package/dist/host/storage/providers/folder.d.ts +12 -0
- package/dist/host/storage/providers/folder.js +20 -0
- package/dist/host/storage/providers/index.d.ts +4 -0
- package/dist/host/storage/providers/index.js +3 -0
- package/dist/host/storage/providers/registry.d.ts +9 -0
- package/dist/host/storage/providers/registry.js +14 -0
- package/dist/host/storage/providers/types.d.ts +33 -0
- package/dist/host/storage/providers/types.js +1 -0
- package/dist/host/tools/conpty.js +3 -2
- package/dist/host/tools/windows-terminal.js +8 -7
- package/dist/host/vpn/index.d.ts +1 -1
- package/dist/host/vpn/index.js +1 -1
- package/dist/host/vpn/prepare.d.ts +2 -0
- package/dist/host/vpn/prepare.js +63 -2
- package/dist/host/web/browser.d.ts +2 -0
- package/dist/host/web/browser.js +14 -1
- package/dist/host/web/index.d.ts +3 -2
- package/dist/host/web/index.js +3 -2
- package/dist/host/web/rpc.d.ts +24 -0
- package/dist/host/web/rpc.js +149 -0
- package/dist/host/web/runner.d.ts +2 -0
- package/dist/host/web/runner.js +1 -2
- package/dist/host/web/server.d.ts +7 -0
- package/dist/host/web/server.js +23 -3
- package/dist/runtime/agent.js +69 -8
- package/dist/runtime/daemon.js +1058 -624
- package/dist/runtime/db.js +69 -8
- package/dist/runtime/main.js +624 -182
- package/dist/runtime/netproxy.js +69 -8
- package/dist/runtime/view.js +87 -13
- package/dist/selftest/agent-paths.test.js +11 -1
- package/dist/selftest/app.test.d.ts +2 -0
- package/dist/selftest/app.test.js +324 -0
- package/dist/selftest/channel.test.js +13 -0
- package/dist/selftest/cli.test.js +2 -1
- package/dist/selftest/config.test.js +59 -0
- package/dist/selftest/contained.test.d.ts +2 -0
- package/dist/selftest/contained.test.js +544 -0
- package/dist/selftest/credentials.test.js +1 -1
- package/dist/selftest/engine.test.d.ts +2 -0
- package/dist/selftest/engine.test.js +127 -0
- package/dist/selftest/hcs.test.d.ts +2 -0
- package/dist/selftest/hcs.test.js +482 -0
- package/dist/selftest/heavy-load.test.d.ts +2 -0
- package/dist/selftest/heavy-load.test.js +329 -0
- package/dist/selftest/index.js +12 -0
- package/dist/selftest/layout.test.js +12 -0
- package/dist/selftest/menu-perf.test.d.ts +2 -0
- package/dist/selftest/menu-perf.test.js +248 -0
- package/dist/selftest/menu-screens.js +4 -2
- package/dist/selftest/menu.test.js +36 -8
- package/dist/selftest/support/engine-cases.d.ts +8 -0
- package/dist/selftest/support/engine-cases.js +65 -0
- package/dist/selftest/support/engine-golden.d.ts +3 -0
- package/dist/selftest/support/engine-golden.js +66 -0
- package/dist/selftest/support/fixtures.d.ts +7 -1
- package/dist/selftest/support/hcs-probes.d.ts +17 -0
- package/dist/selftest/support/hcs-probes.js +41 -0
- package/dist/selftest/vpn.test.js +136 -3
- package/dist/selftest/web.test.js +101 -3
- package/dist/shared/channel/run-dir.d.ts +4 -1
- package/dist/shared/channel/run-dir.js +7 -1
- package/dist/shared/channel/schema.d.ts +35 -1
- package/dist/shared/channel/schema.js +27 -0
- package/dist/shared/channel/secrets.d.ts +1 -0
- package/dist/shared/channel/secrets.js +6 -0
- package/dist/shared/memory/index.d.ts +1 -0
- package/dist/shared/memory/index.js +1 -0
- package/dist/shared/memory/policy.d.ts +33 -0
- package/dist/shared/memory/policy.js +55 -0
- package/dist/shared/pty/output-filter.d.ts +14 -1
- package/dist/shared/pty/output-filter.js +22 -4
- package/dist/shared/pty/terminal.d.ts +4 -1
- package/dist/shared/pty/terminal.js +4 -2
- package/dist/shared/system.d.ts +1 -0
- package/dist/shared/system.js +1 -0
- package/dist/shared/vpn/download.d.ts +16 -0
- package/dist/shared/vpn/download.js +16 -0
- package/dist/shared/vpn/wireguard.d.ts +51 -0
- package/dist/shared/vpn/wireguard.js +227 -0
- package/dist/sync/sync-cycle.js +5 -5
- package/dist/sync/watcher.d.ts +13 -0
- package/dist/sync/watcher.js +92 -3
- package/dist/web/index.html +4 -3
- package/dist/web/main-NRRS5O6Z.js +157 -0
- package/dist/web/main-T5DMCHYV.css +1 -0
- package/native/csharp/HcsHost/AssemblyInfo.cs +14 -0
- package/native/csharp/HcsHost/Guard.cs +100 -0
- package/native/csharp/HcsHost/Hcs.cs +256 -0
- package/native/csharp/HcsHost/Json.cs +78 -0
- package/native/csharp/HcsHost/Program.cs +185 -0
- package/native/csharp/HcsHost/VirtualDisk.cs +95 -0
- package/native/csharp/HostTools/AssemblyInfo.cs +14 -0
- package/native/csharp/HostTools/MemoryStatus.cs +107 -0
- package/native/csharp/HostTools/Program.cs +58 -17
- package/native/scripts/check-contained.ps1 +28 -0
- package/native/scripts/contained-common.ps1 +241 -0
- package/native/scripts/dismount-contained.ps1 +66 -0
- package/native/scripts/memory-status.ps1 +34 -0
- package/native/scripts/mount-contained.ps1 +139 -0
- package/native/scripts/run-elevated.ps1 +17 -4
- package/native/scripts/stop-events.ps1 +23 -8
- package/package.json +9 -2
- package/sandbox/csharp/MemGov.cs +398 -0
- package/sandbox/csharp/PtyHost.cs +111 -5
- package/schemas/config.schema.json +60 -6
- package/schemas/sandbox-config.schema.json +3 -3
- package/dist/cli/commands/sessions/control.d.ts +0 -4
- package/dist/cli/commands/sessions/control.js +0 -66
- package/dist/cli/commands/sessions/list.d.ts +0 -2
- package/dist/cli/commands/sessions/list.js +0 -48
- package/dist/cli/commands/sessions/status.d.ts +0 -4
- package/dist/cli/commands/sessions/status.js +0 -114
- package/dist/cli/commands/sessions/window.d.ts +0 -3
- package/dist/cli/commands/sessions/window.js +0 -18
- package/dist/cli/menu/settings/path-kind.js +0 -44
- package/dist/web/main-CXESL347.js +0 -45
- package/dist/web/main-VLR7DVQ4.css +0 -1
- /package/dist/{cli/menu/settings → app/kernel}/schema-node.d.ts +0 -0
- /package/dist/{cli/menu/settings → app/kernel}/schema-node.js +0 -0
|
@@ -79,7 +79,7 @@ sealed class SessionHost
|
|
|
79
79
|
log.Write("starting: " + command);
|
|
80
80
|
while (true)
|
|
81
81
|
{
|
|
82
|
-
using (PseudoConsole console = PseudoConsole.Start(command, hub.Cols, hub.Rows, hub.Broadcast))
|
|
82
|
+
using (PseudoConsole console = PseudoConsole.Start(command, hub.Cols, hub.Rows, hub.Broadcast, log))
|
|
83
83
|
{
|
|
84
84
|
hub.Attach(console);
|
|
85
85
|
log.Write("pseudo console: " + Native.ConsoleKind);
|
|
@@ -856,7 +856,7 @@ sealed class PseudoConsole : IDisposable
|
|
|
856
856
|
this.pump = pump;
|
|
857
857
|
}
|
|
858
858
|
|
|
859
|
-
public static PseudoConsole Start(string commandLine, short cols, short rows, Action<byte[]> onOutput)
|
|
859
|
+
public static PseudoConsole Start(string commandLine, short cols, short rows, Action<byte[]> onOutput, Log log)
|
|
860
860
|
{
|
|
861
861
|
SafeFileHandle inRead;
|
|
862
862
|
SafeFileHandle inWrite;
|
|
@@ -872,7 +872,7 @@ sealed class PseudoConsole : IDisposable
|
|
|
872
872
|
}
|
|
873
873
|
inRead.Dispose();
|
|
874
874
|
outWrite.Dispose();
|
|
875
|
-
IntPtr process = Native.Spawn(commandLine, handle);
|
|
875
|
+
IntPtr process = Native.Spawn(commandLine, handle, log);
|
|
876
876
|
FileStream output = new FileStream(outRead, FileAccess.Read);
|
|
877
877
|
Thread pump = new Thread(() => Pump(output, onOutput));
|
|
878
878
|
pump.IsBackground = true;
|
|
@@ -1085,6 +1085,12 @@ sealed class Log
|
|
|
1085
1085
|
static class Native
|
|
1086
1086
|
{
|
|
1087
1087
|
private const uint ExtendedStartupInfoPresent = 0x00080000;
|
|
1088
|
+
private const uint CreateSuspended = 0x00000004;
|
|
1089
|
+
// The shared job of everything the agents start (the memory governor in the daemon opens it by this name).
|
|
1090
|
+
private const string AgentJobName = "Local\\AgentSandboxAgentsJob";
|
|
1091
|
+
private const int JobObjectExtendedLimitInformation = 9;
|
|
1092
|
+
private const uint JobObjectLimitJobMemory = 0x00000200;
|
|
1093
|
+
private const long BytesPerMb = 1024L * 1024L;
|
|
1088
1094
|
private const int UseStdHandles = 0x00000100;
|
|
1089
1095
|
private static readonly IntPtr PseudoConsoleAttribute = (IntPtr)0x00020016;
|
|
1090
1096
|
|
|
@@ -1125,6 +1131,43 @@ static class Native
|
|
|
1125
1131
|
public IntPtr lpAttributeList;
|
|
1126
1132
|
}
|
|
1127
1133
|
|
|
1134
|
+
// JOBOBJECT_BASIC_LIMIT_INFORMATION, IO_COUNTERS and JOBOBJECT_EXTENDED_LIMIT_INFORMATION.
|
|
1135
|
+
[StructLayout(LayoutKind.Sequential)]
|
|
1136
|
+
private struct JobBasicLimit
|
|
1137
|
+
{
|
|
1138
|
+
public long PerProcessUserTimeLimit;
|
|
1139
|
+
public long PerJobUserTimeLimit;
|
|
1140
|
+
public uint LimitFlags;
|
|
1141
|
+
public UIntPtr MinimumWorkingSetSize;
|
|
1142
|
+
public UIntPtr MaximumWorkingSetSize;
|
|
1143
|
+
public uint ActiveProcessLimit;
|
|
1144
|
+
public UIntPtr Affinity;
|
|
1145
|
+
public uint PriorityClass;
|
|
1146
|
+
public uint SchedulingClass;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
[StructLayout(LayoutKind.Sequential)]
|
|
1150
|
+
private struct IoCounters
|
|
1151
|
+
{
|
|
1152
|
+
public ulong ReadOperationCount;
|
|
1153
|
+
public ulong WriteOperationCount;
|
|
1154
|
+
public ulong OtherOperationCount;
|
|
1155
|
+
public ulong ReadTransferCount;
|
|
1156
|
+
public ulong WriteTransferCount;
|
|
1157
|
+
public ulong OtherTransferCount;
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
[StructLayout(LayoutKind.Sequential)]
|
|
1161
|
+
private struct JobExtendedLimit
|
|
1162
|
+
{
|
|
1163
|
+
public JobBasicLimit BasicLimitInformation;
|
|
1164
|
+
public IoCounters IoInfo;
|
|
1165
|
+
public UIntPtr ProcessMemoryLimit;
|
|
1166
|
+
public UIntPtr JobMemoryLimit;
|
|
1167
|
+
public UIntPtr PeakProcessMemoryUsed;
|
|
1168
|
+
public UIntPtr PeakJobMemoryUsed;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1128
1171
|
[StructLayout(LayoutKind.Sequential)]
|
|
1129
1172
|
private struct ProcessInformation
|
|
1130
1173
|
{
|
|
@@ -1182,6 +1225,18 @@ static class Native
|
|
|
1182
1225
|
[DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
|
|
1183
1226
|
public static extern bool CreateProcessW(string lpApplicationName, StringBuilder lpCommandLine, IntPtr lpProcessAttributes, IntPtr lpThreadAttributes, bool bInheritHandles, uint dwCreationFlags, IntPtr lpEnvironment, string lpCurrentDirectory, ref StartupInfoEx lpStartupInfo, out ProcessInformation lpProcessInformation);
|
|
1184
1227
|
|
|
1228
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
1229
|
+
public static extern IntPtr CreateJobObjectW(IntPtr attributes, string name);
|
|
1230
|
+
|
|
1231
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
1232
|
+
public static extern bool SetInformationJobObject(IntPtr job, int infoClass, ref JobExtendedLimit info, int length);
|
|
1233
|
+
|
|
1234
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
1235
|
+
public static extern bool AssignProcessToJobObject(IntPtr job, IntPtr process);
|
|
1236
|
+
|
|
1237
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
1238
|
+
public static extern uint ResumeThread(IntPtr thread);
|
|
1239
|
+
|
|
1185
1240
|
[DllImport("kernel32.dll", SetLastError = true)]
|
|
1186
1241
|
public static extern uint WaitForSingleObject(IntPtr hHandle, uint dwMilliseconds);
|
|
1187
1242
|
|
|
@@ -1241,9 +1296,51 @@ static class Native
|
|
|
1241
1296
|
return NativeMethods.CreatePipe(out read, out write, IntPtr.Zero, 0);
|
|
1242
1297
|
}
|
|
1243
1298
|
|
|
1299
|
+
private static IntPtr agentJob;
|
|
1300
|
+
private static bool agentJobTried;
|
|
1301
|
+
|
|
1302
|
+
/// <summary>
|
|
1303
|
+
/// The shared job of everything the agents start, with a memory limit for all of it together (PTYHOST_JOB_MB, set
|
|
1304
|
+
/// by the daemon from sandbox.agentMemoryHeadroomMb): a runaway build then gets out-of-memory errors in its own
|
|
1305
|
+
/// session instead of using up the whole sandbox. Zero when no limit is asked for or the job cannot be made; ptyhost
|
|
1306
|
+
/// itself is never in it. The handle stays open for ptyhost's whole life (the job lives while a handle is open).
|
|
1307
|
+
/// </summary>
|
|
1308
|
+
private static IntPtr AgentJob(Log log)
|
|
1309
|
+
{
|
|
1310
|
+
if (agentJobTried)
|
|
1311
|
+
{
|
|
1312
|
+
return agentJob;
|
|
1313
|
+
}
|
|
1314
|
+
agentJobTried = true;
|
|
1315
|
+
long limitMb;
|
|
1316
|
+
if (!long.TryParse(Environment.GetEnvironmentVariable("PTYHOST_JOB_MB"), out limitMb) || limitMb < 512)
|
|
1317
|
+
{
|
|
1318
|
+
return IntPtr.Zero;
|
|
1319
|
+
}
|
|
1320
|
+
IntPtr job = NativeMethods.CreateJobObjectW(IntPtr.Zero, AgentJobName);
|
|
1321
|
+
if (job == IntPtr.Zero)
|
|
1322
|
+
{
|
|
1323
|
+
log.Write("agent job: CreateJobObject failed (" + Marshal.GetLastWin32Error() + "); no memory limit");
|
|
1324
|
+
return IntPtr.Zero;
|
|
1325
|
+
}
|
|
1326
|
+
JobExtendedLimit info = new JobExtendedLimit();
|
|
1327
|
+
info.BasicLimitInformation.LimitFlags = JobObjectLimitJobMemory;
|
|
1328
|
+
info.JobMemoryLimit = new UIntPtr((ulong)(limitMb * BytesPerMb));
|
|
1329
|
+
if (!NativeMethods.SetInformationJobObject(job, JobObjectExtendedLimitInformation, ref info, Marshal.SizeOf(typeof(JobExtendedLimit))))
|
|
1330
|
+
{
|
|
1331
|
+
log.Write("agent job: setting the limit failed (" + Marshal.GetLastWin32Error() + "); no memory limit");
|
|
1332
|
+
NativeMethods.CloseHandle(job);
|
|
1333
|
+
return IntPtr.Zero;
|
|
1334
|
+
}
|
|
1335
|
+
log.Write("agent job: everything the agent starts may use " + limitMb + " MB together");
|
|
1336
|
+
agentJob = job;
|
|
1337
|
+
return job;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1244
1340
|
/// <summary>Starts `commandLine` attached to the pseudo console. Null std handles: never leak our own stdio into the child.</summary>
|
|
1245
|
-
public static IntPtr Spawn(string commandLine, IntPtr pseudoConsole)
|
|
1341
|
+
public static IntPtr Spawn(string commandLine, IntPtr pseudoConsole, Log log)
|
|
1246
1342
|
{
|
|
1343
|
+
IntPtr job = AgentJob(log);
|
|
1247
1344
|
IntPtr size = IntPtr.Zero;
|
|
1248
1345
|
NativeMethods.InitializeProcThreadAttributeList(IntPtr.Zero, 1, 0, ref size);
|
|
1249
1346
|
IntPtr attributes = Marshal.AllocHGlobal(size);
|
|
@@ -1256,10 +1353,19 @@ static class Native
|
|
|
1256
1353
|
info.StartupInfo.dwFlags = UseStdHandles;
|
|
1257
1354
|
info.lpAttributeList = attributes;
|
|
1258
1355
|
ProcessInformation pi;
|
|
1259
|
-
if (!NativeMethods.CreateProcessW(null, new StringBuilder(commandLine), IntPtr.Zero, IntPtr.Zero, false, ExtendedStartupInfoPresent, IntPtr.Zero, null, ref info, out pi))
|
|
1356
|
+
if (!NativeMethods.CreateProcessW(null, new StringBuilder(commandLine), IntPtr.Zero, IntPtr.Zero, false, ExtendedStartupInfoPresent | (job != IntPtr.Zero ? CreateSuspended : 0), IntPtr.Zero, null, ref info, out pi))
|
|
1260
1357
|
{
|
|
1261
1358
|
throw new IOException("CreateProcess failed (" + Marshal.GetLastWin32Error() + "): " + commandLine);
|
|
1262
1359
|
}
|
|
1360
|
+
if (job != IntPtr.Zero)
|
|
1361
|
+
{
|
|
1362
|
+
// Suspended until it is in the job, so nothing it starts can be outside.
|
|
1363
|
+
if (!NativeMethods.AssignProcessToJobObject(job, pi.hProcess))
|
|
1364
|
+
{
|
|
1365
|
+
log.Write("agent job: could not add the agent (" + Marshal.GetLastWin32Error() + "); it runs without the memory limit");
|
|
1366
|
+
}
|
|
1367
|
+
NativeMethods.ResumeThread(pi.hThread);
|
|
1368
|
+
}
|
|
1263
1369
|
NativeMethods.CloseHandle(pi.hThread);
|
|
1264
1370
|
return pi.hProcess;
|
|
1265
1371
|
}
|
|
@@ -120,6 +120,14 @@
|
|
|
120
120
|
"sandbox": {
|
|
121
121
|
"type": "object",
|
|
122
122
|
"properties": {
|
|
123
|
+
"engine": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"enum": [
|
|
126
|
+
"windows-sandbox",
|
|
127
|
+
"hcs"
|
|
128
|
+
],
|
|
129
|
+
"description": "(alpha) What runs the sandbox. \"windows-sandbox\" = Windows Sandbox (the default: desktop, Windows Terminal, GPU, clipboard, audio, printers). \"hcs\" = a headless Hyper-V isolated Server Core container for agents (no desktop, GPU or clipboard); it needs Windows features and an image on this PC (sandbox engine check hcs lists what is missing), and starting it is not enabled yet in this alpha. sandbox engine shows what each engine can do. Yours only: a project file (.sandbox-config.json) cannot set it."
|
|
130
|
+
},
|
|
123
131
|
"memoryMb": {
|
|
124
132
|
"anyOf": [
|
|
125
133
|
{
|
|
@@ -170,11 +178,33 @@
|
|
|
170
178
|
"type": "integer",
|
|
171
179
|
"minimum": 0,
|
|
172
180
|
"maximum": 9007199254740991,
|
|
173
|
-
"description": "
|
|
181
|
+
"description": "Memory always left for this PC when memoryMb is \"auto\": the sandbox gets at most (free RAM, and RAM plus paging file still unused) minus this."
|
|
182
|
+
},
|
|
183
|
+
"agentMemoryHeadroomMb": {
|
|
184
|
+
"anyOf": [
|
|
185
|
+
{
|
|
186
|
+
"type": "string",
|
|
187
|
+
"const": "auto"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"type": "string",
|
|
191
|
+
"const": "none"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"type": "integer",
|
|
195
|
+
"minimum": 0,
|
|
196
|
+
"maximum": 9007199254740991
|
|
197
|
+
}
|
|
198
|
+
],
|
|
199
|
+
"description": "Memory kept out of the agents reach inside the sandbox, in MB: everything the agents start (their builds, tests, tools) together may use at most the sandbox memory minus this; a runaway parallel build then gets out-of-memory errors in its own session instead of freezing or crashing the whole sandbox. \"auto\" = the larger of 2048 MB and 10 % of the sandbox memory; \"none\" = no limit. Yours only: a project file cannot change it."
|
|
200
|
+
},
|
|
201
|
+
"pressureResponse": {
|
|
202
|
+
"type": "boolean",
|
|
203
|
+
"description": "When the sandbox (or this PC) runs low on memory, slow the heaviest build programs down (lower priority) and, if that is not enough, pause the biggest compiler for a few seconds at a time, so heavy parallel builds slow down instead of closing the sandbox. Never touches the agents themselves. Yours only: a project file cannot change it."
|
|
174
204
|
},
|
|
175
205
|
"vGpu": {
|
|
176
206
|
"type": "boolean",
|
|
177
|
-
"description": "Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface."
|
|
207
|
+
"description": "Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface. The sandbox then uses this PC's graphics card, and with some graphics drivers heavy use can freeze the whole PC: turn it on only when a program in the sandbox needs the GPU (the mesa toolchain gives software OpenGL without it)."
|
|
178
208
|
},
|
|
179
209
|
"networking": {
|
|
180
210
|
"type": "boolean",
|
|
@@ -182,7 +212,7 @@
|
|
|
182
212
|
},
|
|
183
213
|
"clipboard": {
|
|
184
214
|
"type": "boolean",
|
|
185
|
-
"description": "Shared clipboard between this PC and the sandbox."
|
|
215
|
+
"description": "Shared clipboard between this PC and the sandbox. Also lets an agent's copy (in sandbox attach) reach this PC's clipboard."
|
|
186
216
|
},
|
|
187
217
|
"audioInput": {
|
|
188
218
|
"type": "boolean",
|
|
@@ -242,6 +272,20 @@
|
|
|
242
272
|
"type": "boolean",
|
|
243
273
|
"description": "Programs and scripts (.exe, .ps1, .bat, .cmd, .msi, .lnk ...) that appear or change in your project while a sandbox runs get Windows' \"downloaded from the internet\" mark, so SmartScreen and PowerShell ask before they run on this PC."
|
|
244
274
|
},
|
|
275
|
+
"contained": {
|
|
276
|
+
"type": "string",
|
|
277
|
+
"enum": [
|
|
278
|
+
"off",
|
|
279
|
+
"vhdx"
|
|
280
|
+
],
|
|
281
|
+
"description": "(beta) Keep the sandbox tools, state and logs inside one disk image file (vhdx) instead of loose folders, so scanning programs on this PC see one file. Not yet tried on a real PC. Turn it on with sandbox storage contained on (it moves your files and asks first); Windows asks for permission to mount the image when a sandbox starts. \"off\" = loose folders, as always. Yours only: a project file (.sandbox-config.json) cannot set it."
|
|
282
|
+
},
|
|
283
|
+
"containedMaxGb": {
|
|
284
|
+
"type": "integer",
|
|
285
|
+
"minimum": 8,
|
|
286
|
+
"maximum": 4096,
|
|
287
|
+
"description": "(beta) Largest size, in GB, the disk image of storage.contained may grow to."
|
|
288
|
+
},
|
|
245
289
|
"warnDataGb": {
|
|
246
290
|
"type": "number",
|
|
247
291
|
"minimum": 0,
|
|
@@ -324,9 +368,10 @@
|
|
|
324
368
|
"type": "string",
|
|
325
369
|
"enum": [
|
|
326
370
|
"nordvpn",
|
|
327
|
-
"openvpn-file"
|
|
371
|
+
"openvpn-file",
|
|
372
|
+
"wireguard-file"
|
|
328
373
|
],
|
|
329
|
-
"description": "nordvpn: a recommended NordVPN server is picked at every launch. openvpn-file: your own .ovpn file (configFile)."
|
|
374
|
+
"description": "nordvpn: a recommended NordVPN server is picked at every launch. openvpn-file: your own .ovpn file (configFile). wireguard-file: your own WireGuard .conf (configFile), e.g. from your company."
|
|
330
375
|
},
|
|
331
376
|
"protocol": {
|
|
332
377
|
"type": "string",
|
|
@@ -343,7 +388,7 @@
|
|
|
343
388
|
},
|
|
344
389
|
"configFile": {
|
|
345
390
|
"type": "string",
|
|
346
|
-
"description": "openvpn-file: the .ovpn file on this PC (its certificates inside it). Files that run programs (script-security, up, down, plugin ...) are refused. A project's file can never set this."
|
|
391
|
+
"description": "openvpn-file / wireguard-file: the .ovpn or .conf file on this PC (an .ovpn has its certificates inside it). Files that run programs (script-security, up, down, plugin, PostUp ...) are refused. A WireGuard file holds your private key: it is read when a sandbox starts and handed over in a one-shot file. A project's file can never set this."
|
|
347
392
|
},
|
|
348
393
|
"killSwitch": {
|
|
349
394
|
"type": "boolean",
|
|
@@ -1576,6 +1621,15 @@
|
|
|
1576
1621
|
"pattern": "^(?!.*(^|[\\\\/])\\.\\.([\\\\/]|$))[A-Za-z0-9._ -]+([\\\\/][A-Za-z0-9._ -]+)*$"
|
|
1577
1622
|
}
|
|
1578
1623
|
},
|
|
1624
|
+
"bootReset": {
|
|
1625
|
+
"description": "Files and folders below the agent's own state folder (state\\<agent>) that only work on the machine that wrote them (keys sealed with Windows DPAPI, local accounts it created). Every sandbox is a new machine, so they are deleted at each boot and the agent sets them up again.",
|
|
1626
|
+
"maxItems": 32,
|
|
1627
|
+
"type": "array",
|
|
1628
|
+
"items": {
|
|
1629
|
+
"type": "string",
|
|
1630
|
+
"pattern": "^(?!.*(^|[\\\\/])\\.\\.([\\\\/]|$))[A-Za-z0-9._ -]+([\\\\/][A-Za-z0-9._ -]+)*$"
|
|
1631
|
+
}
|
|
1632
|
+
},
|
|
1579
1633
|
"resumeArguments": {
|
|
1580
1634
|
"description": "Arguments used when the agent is restarted in place (e.g. after an account switch) so it resumes the conversation.",
|
|
1581
1635
|
"type": "array",
|
|
@@ -123,11 +123,11 @@
|
|
|
123
123
|
"type": "integer",
|
|
124
124
|
"minimum": 0,
|
|
125
125
|
"maximum": 9007199254740991,
|
|
126
|
-
"description": "
|
|
126
|
+
"description": "Memory always left for this PC when memoryMb is \"auto\": the sandbox gets at most (free RAM, and RAM plus paging file still unused) minus this."
|
|
127
127
|
},
|
|
128
128
|
"vGpu": {
|
|
129
129
|
"type": "boolean",
|
|
130
|
-
"description": "Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface."
|
|
130
|
+
"description": "Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface. The sandbox then uses this PC's graphics card, and with some graphics drivers heavy use can freeze the whole PC: turn it on only when a program in the sandbox needs the GPU (the mesa toolchain gives software OpenGL without it)."
|
|
131
131
|
},
|
|
132
132
|
"networking": {
|
|
133
133
|
"type": "boolean",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
},
|
|
136
136
|
"clipboard": {
|
|
137
137
|
"type": "boolean",
|
|
138
|
-
"description": "Shared clipboard between this PC and the sandbox."
|
|
138
|
+
"description": "Shared clipboard between this PC and the sandbox. Also lets an agent's copy (in sandbox attach) reach this PC's clipboard."
|
|
139
139
|
},
|
|
140
140
|
"audioInput": {
|
|
141
141
|
"type": "boolean",
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { askYesNo } from '../../../core/prompt.js';
|
|
3
|
-
import { fail, safeText } from '../../../core/util/index.js';
|
|
4
|
-
import { SandboxChannel } from '../../../host/channel/index.js';
|
|
5
|
-
import { runningOwner } from '../../../host/sharing/index.js';
|
|
6
|
-
import { useSharedSandbox } from '../shared-use.js';
|
|
7
|
-
import { requireOnPc, requireRunning } from '../context.js';
|
|
8
|
-
import { working, c } from '../../output/index.js';
|
|
9
|
-
import { SandboxService, SessionsService } from '../../services/index.js';
|
|
10
|
-
/** Restarts this folder's project's sessions (--all: every session). */
|
|
11
|
-
export async function restart(ctx) {
|
|
12
|
-
requireOnPc('restart');
|
|
13
|
-
requireRunning();
|
|
14
|
-
await useSharedSandbox(ctx, { kind: 'owner-only', what: 'restart the agents' });
|
|
15
|
-
const service = new SessionsService(ctx);
|
|
16
|
-
const scope = service.restartScope(Boolean(ctx.options.all));
|
|
17
|
-
if (scope.notAProject)
|
|
18
|
-
console.log(c.dim(scope.folder + ' is not a project of the running sandbox: restarting every session.'));
|
|
19
|
-
console.log(safeText(await working('Restarting the agents' + (scope.guest ? ' of ' + scope.projectName : ''), () => service.restart(ctx.options.harness ?? null, scope.guest))));
|
|
20
|
-
return 0;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Stopping ends every project's sessions: other projects' sessions need a yes (or --yes). A script must never end them
|
|
24
|
-
* by accident, so without a terminal to ask in it fails.
|
|
25
|
-
*/
|
|
26
|
-
async function othersMayEnd(ctx, others) {
|
|
27
|
-
if (!others.length || ctx.options.yes)
|
|
28
|
-
return true;
|
|
29
|
-
const interactive = process.stdin.isTTY && process.stdout.isTTY;
|
|
30
|
-
if (!interactive)
|
|
31
|
-
fail(others.length + ' of these sessions belong to other projects, so the sandbox was not stopped.', 'Stop it anyway with: sandbox stop --yes');
|
|
32
|
-
return askYesNo(others.length + ' of them belong to other projects. Stop the whole sandbox?');
|
|
33
|
-
}
|
|
34
|
-
export async function stop(asked) {
|
|
35
|
-
requireOnPc('stop');
|
|
36
|
-
if (!new SandboxService(asked).isRunning()) {
|
|
37
|
-
console.log('No Windows Sandbox is running.');
|
|
38
|
-
return 0;
|
|
39
|
-
}
|
|
40
|
-
// Another user's sandbox: only when shared, and only after typing their name (--yes in scripts).
|
|
41
|
-
let ctx = asked;
|
|
42
|
-
if (runningOwner().kind !== 'mine') {
|
|
43
|
-
ctx = await useSharedSandbox(asked, (shared) => ({
|
|
44
|
-
kind: 'stop',
|
|
45
|
-
sessions: new SandboxChannel(shared.dataPath).currentSessions().length,
|
|
46
|
-
}));
|
|
47
|
-
}
|
|
48
|
-
const service = new SandboxService(ctx);
|
|
49
|
-
// Stopping ends every project's sessions, not just this folder's: say which, and ask when others would end too.
|
|
50
|
-
const { sandbox, running, others } = service.stopPlan();
|
|
51
|
-
if (running.length)
|
|
52
|
-
console.log('Stopping ends ' +
|
|
53
|
-
running.length +
|
|
54
|
-
' session(s): ' +
|
|
55
|
-
running
|
|
56
|
-
.map((s) => safeText(s.harness) + ' in ' + safeText(s.project ?? path.win32.basename(s.cwd)))
|
|
57
|
-
.join(', ') +
|
|
58
|
-
'.');
|
|
59
|
-
if (!(await othersMayEnd(ctx, others))) {
|
|
60
|
-
console.log('Nothing changed.');
|
|
61
|
-
return 1;
|
|
62
|
-
}
|
|
63
|
-
await working('Asking the sandbox to shut down', () => service.shutdown(sandbox));
|
|
64
|
-
console.log('Sandbox is shutting down; history and claude-mem sync back when it closes.');
|
|
65
|
-
return 0;
|
|
66
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import _ from 'lodash';
|
|
2
|
-
import { safeText } from '../../../core/util/index.js';
|
|
3
|
-
import { printJson, table, ago, c, shortenMiddle, termWidth } from '../../output/index.js';
|
|
4
|
-
import { SessionsService, viewerText } from '../../services/index.js';
|
|
5
|
-
import { lookAtSandbox } from '../shared-use.js';
|
|
6
|
-
export async function sessions(asked) {
|
|
7
|
-
// Another user's sandbox: shared, its sessions are listed from their folders; not shared, only whose it is.
|
|
8
|
-
const view = lookAtSandbox(asked);
|
|
9
|
-
const ctx = view.ctx;
|
|
10
|
-
if (view.limited) {
|
|
11
|
-
if (!printJson(ctx, []))
|
|
12
|
-
console.log(view.line);
|
|
13
|
-
return 0;
|
|
14
|
-
}
|
|
15
|
-
if (view.line && !ctx.options.json)
|
|
16
|
-
console.log(c.bold(view.line));
|
|
17
|
-
const service = new SessionsService(ctx);
|
|
18
|
-
const list = await service.list();
|
|
19
|
-
if (printJson(ctx, list.map((s) => _.omit(s, 'attach'))))
|
|
20
|
-
return 0;
|
|
21
|
-
if (list.length === 0) {
|
|
22
|
-
console.log('No sessions. Start one with: sandbox claude');
|
|
23
|
-
return 0;
|
|
24
|
-
}
|
|
25
|
-
// Harness, cwd and times are written by the sandbox.
|
|
26
|
-
const wide = ctx.options.wide;
|
|
27
|
-
const folderWidth = Math.max(16, termWidth() - 80);
|
|
28
|
-
table([
|
|
29
|
-
['', 'ID', 'AGENT', 'PROJECT', 'STATE', 'ATTACHED', ...(wide ? ['FOLDER'] : []), 'STARTED'],
|
|
30
|
-
...service
|
|
31
|
-
.ordered(list)
|
|
32
|
-
.map((s) => [
|
|
33
|
-
s.here ? '*' : '',
|
|
34
|
-
s.id,
|
|
35
|
-
safeText(s.harness),
|
|
36
|
-
safeText(s.projectName ?? '-'),
|
|
37
|
-
s.phase + (s.exitCode !== undefined ? ' (' + s.exitCode + ')' : ''),
|
|
38
|
-
viewerText(s.viewers),
|
|
39
|
-
...(wide ? [shortenMiddle(safeText(s.cwd), folderWidth)] : []),
|
|
40
|
-
ago(s.startedAt),
|
|
41
|
-
]),
|
|
42
|
-
]);
|
|
43
|
-
if (list.some((s) => s.here))
|
|
44
|
-
console.log(c.dim('* = the project of this folder'));
|
|
45
|
-
if (!wide)
|
|
46
|
-
console.log(c.dim('Folders: sandbox sessions --wide'));
|
|
47
|
-
return 0;
|
|
48
|
-
}
|
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { safeText } from '../../../core/util/index.js';
|
|
2
|
-
import { printJson, table, ago, c, shortenMiddle, termWidth } from '../../output/index.js';
|
|
3
|
-
import { SandboxService } from '../../services/index.js';
|
|
4
|
-
import { lookAtSandbox } from '../shared-use.js';
|
|
5
|
-
const MECHANISM_TEXT = {
|
|
6
|
-
launch: 'started from here',
|
|
7
|
-
root: 'in a project root',
|
|
8
|
-
boot: 'mapped at start',
|
|
9
|
-
};
|
|
10
|
-
function mechanismText(mechanism) {
|
|
11
|
-
return mechanism in MECHANISM_TEXT ? MECHANISM_TEXT[mechanism] : 'wsb share';
|
|
12
|
-
}
|
|
13
|
-
function printProject(p) {
|
|
14
|
-
console.log((p.here ? '* ' : ' ') +
|
|
15
|
-
c.bold(p.name) +
|
|
16
|
-
' ' +
|
|
17
|
-
p.host +
|
|
18
|
-
' -> ' +
|
|
19
|
-
p.guest +
|
|
20
|
-
c.dim(' (' + mechanismText(p.mechanism) + ')'));
|
|
21
|
-
console.log(' setup: ' +
|
|
22
|
-
p.setup.phase +
|
|
23
|
-
(p.setup.phase === 'ready' ? '' : ' - ' + shortenMiddle(p.setup.message, termWidth() - 20)));
|
|
24
|
-
if (p.databases.length)
|
|
25
|
-
console.log(' databases: ' + p.databases.map((d) => d.database + ' :' + d.port + ' ' + d.state).join(', '));
|
|
26
|
-
for (const s of p.sessions)
|
|
27
|
-
console.log(' session ' + s.id + ' ' + s.harness + ' ' + s.viewers + ' ' + ago(s.started));
|
|
28
|
-
for (const f of p.repoGuard)
|
|
29
|
-
console.log(' ' + c.yellow('guard: ' + f));
|
|
30
|
-
}
|
|
31
|
-
/** "pong (2 session(s) running)" from the helper in the sandbox, in plain words. */
|
|
32
|
-
export function helperText(answer) {
|
|
33
|
-
const sessions = /^pong \((\d+) session/.exec(answer);
|
|
34
|
-
if (!sessions)
|
|
35
|
-
return answer === '-' ? '-' : safeText(answer);
|
|
36
|
-
return 'responding, ' + sessions[1] + (sessions[1] === '1' ? ' session' : ' sessions') + ' running';
|
|
37
|
-
}
|
|
38
|
-
export async function status(asked) {
|
|
39
|
-
// Another user's sandbox: shared, it is shown from their folders; not shared, only whose it is.
|
|
40
|
-
const view = lookAtSandbox(asked);
|
|
41
|
-
const ctx = view.ctx;
|
|
42
|
-
if (view.limited) {
|
|
43
|
-
const owner = view.owner;
|
|
44
|
-
const user = owner?.kind === 'other' ? owner.user : null;
|
|
45
|
-
if (!printJson(ctx, { sandbox: { running: true, shared: false, startedBy: user } }))
|
|
46
|
-
console.log(view.line);
|
|
47
|
-
return 0;
|
|
48
|
-
}
|
|
49
|
-
const report = await new SandboxService(ctx).status();
|
|
50
|
-
const { startedAt, ...state } = report.sandbox;
|
|
51
|
-
const info = {
|
|
52
|
-
// Same keys and order as the service's state, with the start time shown as an uptime.
|
|
53
|
-
sandbox: {
|
|
54
|
-
...(ctx.borrowed ? { startedBy: ctx.borrowed.user, shared: true } : {}),
|
|
55
|
-
running: state.running,
|
|
56
|
-
phase: state.phase,
|
|
57
|
-
message: state.message,
|
|
58
|
-
headless: state.headless,
|
|
59
|
-
uptime: state.running && startedAt ? ago(startedAt).replace(' ago', '') : null,
|
|
60
|
-
daemon: state.daemon,
|
|
61
|
-
account: state.account,
|
|
62
|
-
syncWatcher: state.syncWatcher,
|
|
63
|
-
},
|
|
64
|
-
here: report.here,
|
|
65
|
-
roots: report.roots,
|
|
66
|
-
projects: report.projects,
|
|
67
|
-
otherSessions: report.otherSessions,
|
|
68
|
-
repoGuard: report.repoGuard,
|
|
69
|
-
};
|
|
70
|
-
if (printJson(ctx, info))
|
|
71
|
-
return 0;
|
|
72
|
-
const sb = info.sandbox;
|
|
73
|
-
if (view.line)
|
|
74
|
-
console.log(c.bold(view.line) + c.dim('. Its window is on their desktop; use its agents here.'));
|
|
75
|
-
table([
|
|
76
|
-
...(ctx.borrowed ? [['Started by', safeText(ctx.borrowed.user)]] : []),
|
|
77
|
-
['Running', sb.running ? 'yes' : 'no'],
|
|
78
|
-
...(sb.running
|
|
79
|
-
? [
|
|
80
|
-
['Phase', safeText(sb.phase ?? '-')],
|
|
81
|
-
['Message', safeText(sb.message ?? '-')],
|
|
82
|
-
['Window', sb.headless ? 'hidden (sandbox show opens it)' : 'shown'],
|
|
83
|
-
['Uptime', sb.uptime ?? '-'],
|
|
84
|
-
['Helper', helperText(sb.daemon)],
|
|
85
|
-
]
|
|
86
|
-
: []),
|
|
87
|
-
['Account', sb.account ? safeText(sb.account) : 'none selected (sandbox account use)'],
|
|
88
|
-
['Background sync', sb.syncWatcher ? 'on' : 'off'],
|
|
89
|
-
]);
|
|
90
|
-
if (!state.running)
|
|
91
|
-
return 0;
|
|
92
|
-
console.log('\n' + c.bold('Projects'));
|
|
93
|
-
for (const p of info.projects)
|
|
94
|
-
printProject(p);
|
|
95
|
-
for (const r of info.roots)
|
|
96
|
-
console.log(' root ' + r.host + ' -> ' + r.guest + c.dim(' (every project in it opens without a restart)'));
|
|
97
|
-
console.log(c.dim(info.projects.some((p) => p.here)
|
|
98
|
-
? '* = the project of this folder'
|
|
99
|
-
: info.here.folder + ' is not in this sandbox (start it here: sandbox claude)'));
|
|
100
|
-
for (const s of info.otherSessions)
|
|
101
|
-
console.log(' session ' + s.id + ' ' + s.harness + ' ' + s.cwd);
|
|
102
|
-
const findings = info.repoGuard.findings;
|
|
103
|
-
console.log('\n' +
|
|
104
|
-
c.bold('Repo guard') +
|
|
105
|
-
' ' +
|
|
106
|
-
info.repoGuard.guarded +
|
|
107
|
-
' folder(s) guarded; ' +
|
|
108
|
-
(findings.length
|
|
109
|
-
? c.yellow(findings.length + ' change(s) neutralised:')
|
|
110
|
-
: 'nothing from the sandbox needed neutralising'));
|
|
111
|
-
for (const f of findings.slice(-10))
|
|
112
|
-
console.log(' ' + c.yellow(safeText(f)));
|
|
113
|
-
return 0;
|
|
114
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { requireOnPc, requireRunning } from '../context.js';
|
|
2
|
-
import { SandboxService } from '../../services/index.js';
|
|
3
|
-
import { useSharedSandbox } from '../shared-use.js';
|
|
4
|
-
export async function show(ctx) {
|
|
5
|
-
requireOnPc('show');
|
|
6
|
-
requireRunning();
|
|
7
|
-
await useSharedSandbox(ctx, { kind: 'owner-only', what: 'show the window', window: true });
|
|
8
|
-
new SandboxService(ctx).showWindow();
|
|
9
|
-
return 0;
|
|
10
|
-
}
|
|
11
|
-
export async function hide(ctx) {
|
|
12
|
-
requireOnPc('hide');
|
|
13
|
-
requireRunning();
|
|
14
|
-
await useSharedSandbox(ctx, { kind: 'owner-only', what: 'hide the window', window: true });
|
|
15
|
-
await new SandboxService(ctx).hideWindow();
|
|
16
|
-
console.log('Sandbox window hidden. Bring it back with: sbx-show');
|
|
17
|
-
return 0;
|
|
18
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/** Top-level settings whose list entries are folders or files, and the single settings that are one. */
|
|
2
|
-
const KINDS = {
|
|
3
|
-
'storage.root': 'dir',
|
|
4
|
-
'projects.roots': 'dir',
|
|
5
|
-
'projects.exclude': 'dir',
|
|
6
|
-
'projects.declinedRoots': 'dir',
|
|
7
|
-
'claudeProfile.hostDir': 'dir',
|
|
8
|
-
'claudeProfile.globalStateFile': 'file',
|
|
9
|
-
scripts: 'file',
|
|
10
|
-
};
|
|
11
|
-
/** The kind of path a setting holds (its key without list positions), or undefined when it is not a path. */
|
|
12
|
-
export function pathKindOf(key) {
|
|
13
|
-
const id = key.join('.');
|
|
14
|
-
const last = key[key.length - 1] ?? '';
|
|
15
|
-
if (KINDS[id])
|
|
16
|
-
return KINDS[id];
|
|
17
|
-
if (key[0] === 'mappings' && last === 'host')
|
|
18
|
-
return 'dir';
|
|
19
|
-
if (last === 'hostDir')
|
|
20
|
-
return 'dir';
|
|
21
|
-
if (/(Dir|Folder)$/.test(last))
|
|
22
|
-
return 'dir';
|
|
23
|
-
if (/File$/.test(last))
|
|
24
|
-
return 'file';
|
|
25
|
-
return undefined;
|
|
26
|
-
}
|
|
27
|
-
/** Words that are fine instead of a path ("auto"), read from the setting's description. */
|
|
28
|
-
export function pathLiterals(node) {
|
|
29
|
-
return /"auto"/.test(node.description ?? '') ? ['auto'] : [];
|
|
30
|
-
}
|
|
31
|
-
/** Picks a folder or file in the path picker; typing a path (or an allowed word) still works. */
|
|
32
|
-
export function askPath(app, o) {
|
|
33
|
-
return app.pickPath({
|
|
34
|
-
path: o.path,
|
|
35
|
-
title: o.title,
|
|
36
|
-
about: o.about,
|
|
37
|
-
initial: o.initial,
|
|
38
|
-
files: o.kind === 'file',
|
|
39
|
-
use: o.kind === 'file' ? 'use this file' : 'use this folder',
|
|
40
|
-
literals: o.literals,
|
|
41
|
-
relative: true,
|
|
42
|
-
validate: o.validate,
|
|
43
|
-
});
|
|
44
|
-
}
|