windows-development-sandbox 1.5.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/README.md +1 -0
- package/config.example.json +27 -1
- 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} +4 -0
- package/dist/{cli/menu/settings/categories.js → app/features/settings/categories.def.js} +40 -46
- 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/{cli/menu/settings → app/kernel}/schema-node.d.ts +9 -0
- package/dist/{cli/menu/settings → app/kernel}/schema-node.js +26 -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 +18 -2
- package/dist/cli/args.js +101 -24
- package/dist/cli/commands/accounts.js +45 -17
- package/dist/cli/commands/context.d.ts +2 -0
- package/dist/cli/commands/context.js +9 -2
- package/dist/cli/commands/data/clean.js +32 -9
- package/dist/cli/commands/engine.d.ts +2 -0
- package/dist/cli/commands/engine.js +60 -0
- package/dist/cli/commands/index.d.ts +2 -1
- package/dist/cli/commands/index.js +2 -1
- package/dist/cli/commands/launch/add-root.d.ts +3 -2
- package/dist/cli/commands/launch/add-root.js +11 -10
- package/dist/cli/commands/launch/launch.js +102 -9
- package/dist/cli/commands/launch/prepare.js +6 -4
- package/dist/cli/commands/launch/running.js +2 -1
- package/dist/cli/commands/launch/summary.d.ts +2 -0
- package/dist/cli/commands/maintenance/audit.js +1 -1
- package/dist/cli/commands/maintenance/clean.d.ts +1 -1
- package/dist/cli/commands/maintenance/clean.js +17 -3
- 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.d.ts +1 -1
- package/dist/cli/commands/maintenance/config.js +38 -10
- package/dist/cli/commands/maintenance/doctor.d.ts +1 -1
- package/dist/cli/commands/maintenance/doctor.js +2 -4
- package/dist/cli/commands/maintenance/logs.js +14 -0
- package/dist/cli/commands/maintenance/migrate.d.ts +2 -1
- package/dist/cli/commands/maintenance/migrate.js +19 -4
- package/dist/cli/commands/maintenance/sync.js +2 -0
- package/dist/cli/commands/maintenance/update.d.ts +2 -0
- package/dist/cli/commands/maintenance/update.js +27 -4
- package/dist/cli/commands/projects/here.js +12 -7
- package/dist/cli/commands/projects/projects.js +26 -17
- package/dist/cli/commands/registry.js +10 -7
- package/dist/cli/commands/repair/checks/agents.d.ts +2 -0
- package/dist/cli/commands/repair/checks/agents.js +70 -0
- package/dist/cli/commands/repair/checks/common.d.ts +8 -0
- package/dist/cli/commands/repair/checks/common.js +22 -0
- 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/data.d.ts +2 -0
- package/dist/cli/commands/repair/checks/data.js +241 -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.d.ts +2 -0
- package/dist/cli/commands/repair/checks/index.js +24 -0
- package/dist/cli/commands/repair/checks/install.d.ts +5 -0
- package/dist/cli/commands/repair/checks/install.js +318 -0
- package/dist/cli/commands/repair/checks/machine.d.ts +2 -0
- package/dist/cli/commands/repair/checks/machine.js +232 -0
- package/dist/cli/commands/repair/checks/network.d.ts +6 -0
- package/dist/cli/commands/repair/checks/network.js +60 -0
- package/dist/cli/commands/repair/checks/pc.d.ts +4 -0
- package/dist/cli/commands/repair/checks/pc.js +86 -0
- package/dist/cli/commands/repair/checks/sandbox.d.ts +2 -0
- package/dist/cli/commands/repair/checks/sandbox.js +282 -0
- package/dist/cli/commands/repair/checks/settings.d.ts +2 -0
- package/dist/cli/commands/repair/checks/settings.js +169 -0
- package/dist/cli/commands/repair/checks/vpn.d.ts +2 -0
- package/dist/cli/commands/repair/checks/vpn.js +78 -0
- package/dist/cli/commands/repair/engine.d.ts +32 -0
- package/dist/cli/commands/repair/engine.js +127 -0
- package/dist/cli/commands/repair/env.d.ts +7 -0
- package/dist/cli/commands/repair/env.js +50 -0
- package/dist/cli/commands/repair/index.d.ts +1 -9
- package/dist/cli/commands/repair/index.js +2 -54
- package/dist/cli/commands/repair/log.d.ts +17 -0
- package/dist/cli/commands/repair/log.js +82 -0
- package/dist/cli/commands/repair/printer.d.ts +32 -0
- package/dist/cli/commands/repair/printer.js +132 -0
- package/dist/cli/commands/repair/run.d.ts +33 -0
- package/dist/cli/commands/repair/run.js +133 -0
- package/dist/cli/commands/repair/types.d.ts +97 -9
- package/dist/cli/commands/repair/types.js +11 -7
- package/dist/cli/commands/resume.js +2 -2
- package/dist/cli/commands/sessions/index.d.ts +0 -4
- package/dist/cli/commands/sessions/index.js +3 -7
- package/dist/cli/commands/setup/index.d.ts +5 -0
- package/dist/cli/commands/setup/index.js +25 -1
- 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/index.d.ts +2 -0
- package/dist/cli/commands/storage/index.js +2 -0
- package/dist/cli/commands/storage/offer.d.ts +3 -0
- package/dist/cli/commands/storage/offer.js +91 -0
- package/dist/cli/commands/storage/storage.d.ts +8 -0
- package/dist/cli/commands/storage/storage.js +179 -0
- package/dist/cli/commands/user-config.js +2 -2
- package/dist/cli/commands/vpn.d.ts +4 -0
- package/dist/cli/commands/vpn.js +91 -0
- package/dist/cli/commands/web.d.ts +4 -0
- package/dist/cli/commands/web.js +97 -0
- package/dist/cli/history.js +1 -1
- package/dist/cli/index.js +48 -4
- package/dist/cli/manifest.d.ts +339 -97
- package/dist/cli/manifest.js +222 -67
- package/dist/cli/menu/add-agent.d.ts +47 -0
- package/dist/cli/menu/add-agent.js +168 -0
- package/dist/cli/menu/apps.d.ts +38 -3
- package/dist/cli/menu/apps.js +80 -5
- package/dist/cli/menu/command-fields.d.ts +18 -0
- package/dist/cli/menu/command-fields.js +61 -0
- package/dist/cli/menu/command-form.d.ts +22 -0
- package/dist/cli/menu/command-form.js +169 -46
- package/dist/cli/menu/data-folder.d.ts +18 -0
- package/dist/cli/menu/data-folder.js +99 -0
- 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 +11 -2
- package/dist/cli/menu/menu.js +36 -15
- package/dist/cli/menu/pages/accounts-page.js +55 -24
- package/dist/cli/menu/pages/agents-page.d.ts +68 -0
- package/dist/cli/menu/pages/agents-page.js +345 -0
- package/dist/cli/menu/pages/apps-page.d.ts +3 -1
- package/dist/cli/menu/pages/apps-page.js +20 -4
- package/dist/cli/menu/pages/list-page.d.ts +43 -3
- package/dist/cli/menu/pages/list-page.js +146 -12
- package/dist/cli/menu/pages/maintenance-page.d.ts +9 -5
- package/dist/cli/menu/pages/maintenance-page.js +172 -85
- package/dist/cli/menu/pages/sandbox-page.d.ts +7 -6
- package/dist/cli/menu/pages/sandbox-page.js +117 -120
- package/dist/cli/menu/pages/scopes.d.ts +1 -1
- package/dist/cli/menu/pages/sessions-page.d.ts +6 -8
- package/dist/cli/menu/pages/sessions-page.js +22 -75
- package/dist/cli/menu/pages/settings-page.d.ts +10 -14
- package/dist/cli/menu/pages/settings-page.js +95 -102
- package/dist/cli/menu/render-view.d.ts +28 -0
- package/dist/cli/menu/render-view.js +112 -0
- package/dist/cli/menu/settings/ask-path.d.ts +14 -0
- package/dist/cli/menu/settings/ask-path.js +14 -0
- package/dist/cli/menu/settings/collections/collection-editor.d.ts +8 -2
- package/dist/cli/menu/settings/collections/collection-editor.js +12 -8
- package/dist/cli/menu/settings/collections/map-editor.js +5 -1
- package/dist/cli/menu/settings/collections/object-list-editor.js +2 -2
- package/dist/cli/menu/settings/collections/object-map-editor.js +2 -2
- package/dist/cli/menu/settings/collections/string-list-editor.d.ts +10 -1
- package/dist/cli/menu/settings/collections/string-list-editor.js +23 -0
- 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 +6 -2
- package/dist/cli/menu/settings/object-editor.js +15 -4
- 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 +10 -1
- package/dist/cli/menu/settings/value-editor.js +99 -63
- package/dist/cli/menu/several.js +7 -5
- 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 +53 -10
- package/dist/cli/menu/shell.js +115 -10
- package/dist/cli/menu/views.d.ts +7 -0
- package/dist/cli/menu/views.js +11 -0
- package/dist/cli/menu/vpn-login.d.ts +16 -0
- package/dist/cli/menu/vpn-login.js +74 -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 +5 -1
- package/dist/cli/output/print.js +15 -4
- 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/accounts-service.d.ts +2 -0
- package/dist/cli/services/accounts-service.js +2 -2
- 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/health-service.d.ts +0 -6
- package/dist/cli/services/health-service.js +5 -42
- package/dist/cli/services/index.d.ts +3 -1
- package/dist/cli/services/index.js +3 -1
- package/dist/cli/services/logs-service.js +4 -3
- package/dist/cli/services/migrate-service.js +1 -1
- package/dist/cli/services/update-service.d.ts +2 -0
- package/dist/cli/services/update-service.js +13 -6
- package/dist/cli/services/vpn-service.d.ts +28 -0
- package/dist/cli/services/vpn-service.js +46 -0
- package/dist/cli/services/web-service.d.ts +22 -0
- package/dist/cli/services/web-service.js +111 -0
- package/dist/cli/tui/app.d.ts +12 -4
- package/dist/cli/tui/app.js +38 -9
- package/dist/cli/tui/dialogs/path-listing.d.ts +43 -0
- package/dist/cli/tui/dialogs/path-listing.js +127 -0
- package/dist/cli/tui/dialogs/path-picker.d.ts +67 -0
- package/dist/cli/tui/dialogs/path-picker.js +423 -0
- package/dist/cli/tui/dialogs/text-screen.d.ts +6 -0
- package/dist/cli/tui/dialogs/text-screen.js +10 -3
- package/dist/cli/tui/frame.d.ts +7 -10
- package/dist/cli/tui/frame.js +19 -10
- package/dist/cli/tui/index.d.ts +4 -3
- package/dist/cli/tui/index.js +2 -1
- package/dist/cli/tui/list/list-screen.d.ts +28 -2
- package/dist/cli/tui/list/list-screen.js +130 -66
- package/dist/cli/tui/list/list-types.d.ts +10 -4
- package/dist/cli/tui/nav.d.ts +29 -0
- package/dist/cli/tui/nav.js +67 -0
- package/dist/cli/tui/terminal.d.ts +7 -0
- package/dist/cli/tui/terminal.js +30 -10
- package/dist/cli/validate.d.ts +1 -1
- package/dist/cli/validate.js +3 -3
- package/dist/cli/version.d.ts +2 -0
- package/dist/cli/version.js +11 -0
- package/dist/core/config/defaults.js +13 -1
- package/dist/core/config/loader.js +12 -2
- package/dist/core/local-config/overrides.js +1 -0
- package/dist/core/prompt.d.ts +19 -0
- package/dist/core/prompt.js +43 -3
- package/dist/core/schema/common.d.ts +6 -0
- package/dist/core/schema/common.js +8 -0
- package/dist/core/schema/config.d.ts +36 -0
- package/dist/core/schema/config.js +26 -2
- package/dist/core/schema/harness.d.ts +2 -0
- package/dist/core/schema/harness.js +13 -2
- package/dist/core/schema/index.d.ts +3 -1
- package/dist/core/schema/index.js +3 -1
- package/dist/core/schema/profile.d.ts +1 -0
- package/dist/core/schema/profile.js +3 -0
- package/dist/core/schema/redact.d.ts +13 -0
- package/dist/core/schema/redact.js +75 -0
- package/dist/core/schema/sandbox.d.ts +6 -0
- package/dist/core/schema/sandbox.js +21 -3
- package/dist/core/schema/vpn.d.ts +18 -0
- package/dist/core/schema/vpn.js +22 -0
- package/dist/core/schema/web.d.ts +6 -0
- package/dist/core/schema/web.js +14 -0
- package/dist/core/types.d.ts +44 -0
- 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 +54 -0
- package/dist/guest/agents/agent-files.js +67 -0
- package/dist/guest/agents/agent-installer.js +2 -9
- package/dist/guest/agents/local-state.d.ts +14 -0
- package/dist/guest/agents/local-state.js +218 -0
- package/dist/guest/agents/sbx-agent.d.ts +2 -0
- package/dist/guest/agents/sbx-agent.js +35 -0
- package/dist/guest/boot/boot.d.ts +4 -0
- package/dist/guest/boot/boot.js +51 -11
- package/dist/guest/daemon/daemon.js +8 -1
- package/dist/guest/daemon/exec.js +2 -1
- package/dist/guest/daemon/idle-shutdown.js +2 -0
- package/dist/guest/daemon/sessions.d.ts +5 -0
- package/dist/guest/daemon/sessions.js +20 -3
- package/dist/guest/entries/agent.d.ts +1 -0
- package/dist/guest/entries/agent.js +10 -0
- package/dist/guest/entries/daemon.js +5 -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 +2 -0
- package/dist/guest/runtime/csc.js +2 -0
- package/dist/guest/runtime/secrets.d.ts +12 -0
- package/dist/guest/runtime/secrets.js +63 -0
- package/dist/guest/sessions/viewer.js +3 -1
- package/dist/guest/setup/claude-profile.d.ts +2 -1
- package/dist/guest/setup/claude-profile.js +12 -1
- package/dist/guest/setup/environment.d.ts +6 -0
- package/dist/guest/setup/environment.js +56 -6
- package/dist/guest/setup/path-plan.d.ts +32 -0
- package/dist/guest/setup/path-plan.js +67 -0
- package/dist/guest/setup/shell-path.d.ts +1 -0
- package/dist/guest/setup/shell-path.js +22 -0
- package/dist/guest/toolchains/languages/python.js +1 -1
- package/dist/guest/toolchains/native/rust-extras.js +4 -2
- package/dist/guest/toolchains/runtimes.js +2 -2
- package/dist/guest/vpn/index.d.ts +1 -0
- package/dist/guest/vpn/index.js +1 -0
- package/dist/guest/vpn/openvpn.d.ts +9 -0
- package/dist/guest/vpn/openvpn.js +47 -0
- package/dist/guest/vpn/tunnel.d.ts +17 -0
- package/dist/guest/vpn/tunnel.js +78 -0
- package/dist/guest/vpn/vpn.d.ts +6 -0
- package/dist/guest/vpn/vpn.js +174 -0
- 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 +6 -2
- package/dist/host/channel/attach.js +6 -3
- package/dist/host/channel/channel.d.ts +9 -0
- package/dist/host/channel/channel.js +30 -2
- 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/health/acl-read.d.ts +17 -0
- package/dist/host/health/acl-read.js +45 -0
- package/dist/host/health/config-backup.d.ts +11 -0
- package/dist/host/health/config-backup.js +73 -0
- package/dist/host/health/index.d.ts +6 -0
- package/dist/host/health/index.js +7 -0
- package/dist/host/health/install-state.d.ts +33 -0
- package/dist/host/health/install-state.js +110 -0
- package/dist/host/health/path-copies.d.ts +32 -0
- package/dist/host/health/path-copies.js +82 -0
- package/dist/host/health/stale.d.ts +45 -0
- package/dist/host/health/stale.js +120 -0
- package/dist/host/health/system.d.ts +37 -0
- package/dist/host/health/system.js +87 -0
- package/dist/host/install/copies.d.ts +13 -0
- package/dist/host/install/copies.js +63 -0
- package/dist/host/install/index.d.ts +1 -0
- package/dist/host/install/index.js +1 -0
- package/dist/host/launch/generate.d.ts +5 -1
- package/dist/host/launch/generate.js +73 -7
- 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 +11 -2
- package/dist/host/launch/stage.js +1 -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/migrate/backup.js +3 -0
- package/dist/host/migrate/migrations/config-file.d.ts +2 -0
- package/dist/host/migrate/migrations/config-file.js +7 -0
- package/dist/host/migrate/migrations/follow-machine-storage.js +9 -1
- package/dist/host/migrate/migrations/pin-storage-root.d.ts +4 -0
- package/dist/host/migrate/migrations/pin-storage-root.js +46 -0
- package/dist/host/migrate/migrations/unpin-config-defaults.js +4 -1
- package/dist/host/migrate/registry.js +2 -1
- package/dist/host/native.d.ts +3 -2
- package/dist/host/native.js +22 -3
- package/dist/host/profile/accounts.d.ts +25 -1
- package/dist/host/profile/accounts.js +96 -13
- package/dist/host/profile/agent-accounts.d.ts +5 -1
- package/dist/host/profile/agent-accounts.js +35 -5
- package/dist/host/profile/claude-login.js +3 -2
- package/dist/host/profile/index.d.ts +2 -1
- package/dist/host/profile/index.js +1 -0
- package/dist/host/profile/plugin-share.d.ts +26 -0
- package/dist/host/profile/plugin-share.js +146 -0
- package/dist/host/projects/join.d.ts +7 -1
- package/dist/host/projects/join.js +21 -4
- package/dist/host/projects/registry.d.ts +16 -10
- package/dist/host/projects/registry.js +74 -6
- 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 +4 -0
- package/dist/host/sandbox/platform.js +23 -4
- package/dist/host/sandbox/tasklist.d.ts +13 -0
- package/dist/host/sandbox/tasklist.js +47 -0
- package/dist/host/secrets/index.d.ts +2 -0
- package/dist/host/secrets/index.js +2 -0
- package/dist/host/secrets/launch-secrets.d.ts +17 -0
- package/dist/host/secrets/launch-secrets.js +94 -0
- package/dist/host/secrets/secret-store.d.ts +25 -0
- package/dist/host/secrets/secret-store.js +89 -0
- package/dist/host/sharing/acl.d.ts +16 -2
- package/dist/host/sharing/acl.js +35 -10
- package/dist/host/sharing/current.js +8 -3
- package/dist/host/sharing/doctor.d.ts +2 -0
- package/dist/host/sharing/doctor.js +44 -0
- package/dist/host/sharing/group-access.d.ts +6 -0
- package/dist/host/sharing/group-access.js +24 -0
- package/dist/host/sharing/index.d.ts +2 -1
- package/dist/host/sharing/index.js +2 -1
- package/dist/host/sharing/lifecycle.d.ts +8 -2
- package/dist/host/sharing/lifecycle.js +16 -7
- package/dist/host/storage/cleanup.d.ts +2 -0
- package/dist/host/storage/cleanup.js +2 -1
- 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/history.d.ts +21 -0
- package/dist/host/storage/history.js +49 -0
- package/dist/host/storage/index.d.ts +6 -0
- package/dist/host/storage/index.js +6 -0
- package/dist/host/storage/move.d.ts +95 -0
- package/dist/host/storage/move.js +384 -0
- package/dist/host/storage/offer.d.ts +11 -0
- package/dist/host/storage/offer.js +36 -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/storage/root.d.ts +18 -0
- package/dist/host/storage/root.js +77 -0
- package/dist/host/tools/conpty.js +3 -2
- package/dist/host/tools/windows-terminal.d.ts +2 -0
- package/dist/host/tools/windows-terminal.js +31 -12
- package/dist/host/update/index.d.ts +1 -1
- package/dist/host/update/index.js +1 -1
- package/dist/host/update/notice.d.ts +2 -0
- package/dist/host/update/notice.js +13 -1
- package/dist/host/update/update-state.d.ts +6 -0
- package/dist/host/update/update-state.js +2 -0
- package/dist/host/update/updater.d.ts +19 -0
- package/dist/host/update/updater.js +88 -12
- package/dist/host/vpn/index.d.ts +4 -0
- package/dist/host/vpn/index.js +4 -0
- package/dist/host/vpn/login.d.ts +24 -0
- package/dist/host/vpn/login.js +79 -0
- package/dist/host/vpn/nordvpn.d.ts +21 -0
- package/dist/host/vpn/nordvpn.js +77 -0
- package/dist/host/vpn/prepare.d.ts +19 -0
- package/dist/host/vpn/prepare.js +138 -0
- package/dist/host/vpn/status.d.ts +12 -0
- package/dist/host/vpn/status.js +53 -0
- package/dist/host/web/auth.d.ts +38 -0
- package/dist/host/web/auth.js +96 -0
- package/dist/host/web/backend.d.ts +14 -0
- package/dist/host/web/backend.js +1 -0
- package/dist/host/web/bridge.d.ts +27 -0
- package/dist/host/web/bridge.js +144 -0
- package/dist/host/web/browser.d.ts +3 -0
- package/dist/host/web/browser.js +23 -0
- package/dist/host/web/control.d.ts +17 -0
- package/dist/host/web/control.js +67 -0
- package/dist/host/web/index.d.ts +10 -0
- package/dist/host/web/index.js +9 -0
- package/dist/host/web/rpc.d.ts +24 -0
- package/dist/host/web/rpc.js +149 -0
- package/dist/host/web/runner.d.ts +16 -0
- package/dist/host/web/runner.js +44 -0
- package/dist/host/web/server.d.ts +47 -0
- package/dist/host/web/server.js +238 -0
- package/dist/host/web/state.d.ts +20 -0
- package/dist/host/web/state.js +41 -0
- package/dist/host/web/static-files.d.ts +13 -0
- package/dist/host/web/static-files.js +57 -0
- package/dist/runtime/agent.js +27675 -0
- package/dist/runtime/daemon.js +1950 -1122
- package/dist/runtime/db.js +302 -111
- package/dist/runtime/main.js +1560 -275
- package/dist/runtime/netproxy.js +168 -8
- package/dist/runtime/view.js +186 -13
- package/dist/selftest/accounts.test.js +40 -0
- package/dist/selftest/agent-paths.test.d.ts +2 -0
- package/dist/selftest/agent-paths.test.js +125 -0
- package/dist/selftest/app.test.d.ts +2 -0
- package/dist/selftest/app.test.js +324 -0
- package/dist/selftest/channel.test.js +18 -0
- package/dist/selftest/cli.test.js +35 -4
- 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.d.ts +2 -0
- package/dist/selftest/credentials.test.js +198 -0
- package/dist/selftest/engine.test.d.ts +2 -0
- package/dist/selftest/engine.test.js +127 -0
- package/dist/selftest/generate.test.js +1 -1
- package/dist/selftest/hcs.test.d.ts +2 -0
- package/dist/selftest/hcs.test.js +482 -0
- package/dist/selftest/health.test.d.ts +2 -0
- package/dist/selftest/health.test.js +470 -0
- package/dist/selftest/heavy-load.test.d.ts +2 -0
- package/dist/selftest/heavy-load.test.js +329 -0
- package/dist/selftest/host-sim.test.js +2 -0
- package/dist/selftest/index.js +31 -0
- package/dist/selftest/layout.test.js +14 -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.d.ts +7 -0
- package/dist/selftest/menu-screens.js +68 -17
- package/dist/selftest/menu.test.js +603 -22
- package/dist/selftest/migrate.test.js +1 -1
- package/dist/selftest/personalization.test.js +3 -1
- package/dist/selftest/projects.test.js +39 -1
- package/dist/selftest/shared-use.test.js +64 -2
- package/dist/selftest/sharing.test.js +50 -1
- package/dist/selftest/storage.test.d.ts +2 -0
- package/dist/selftest/storage.test.js +363 -0
- 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 +20 -0
- package/dist/selftest/support/hcs-probes.d.ts +17 -0
- package/dist/selftest/support/hcs-probes.js +41 -0
- package/dist/selftest/support/releases.js +1 -1
- package/dist/selftest/toolchains.test.js +21 -0
- package/dist/selftest/update-service.test.js +87 -3
- package/dist/selftest/vpn.test.d.ts +2 -0
- package/dist/selftest/vpn.test.js +412 -0
- package/dist/selftest/web.test.d.ts +2 -0
- package/dist/selftest/web.test.js +402 -0
- package/dist/shared/apps/catalogue.js +31 -0
- package/dist/shared/channel/index.d.ts +1 -0
- package/dist/shared/channel/index.js +1 -0
- package/dist/shared/channel/run-dir.d.ts +9 -1
- package/dist/shared/channel/run-dir.js +18 -1
- package/dist/shared/channel/schema.d.ts +53 -0
- package/dist/shared/channel/schema.js +38 -0
- package/dist/shared/channel/secrets.d.ts +29 -0
- package/dist/shared/channel/secrets.js +50 -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 +29 -0
- package/dist/shared/vpn/download.js +30 -0
- package/dist/shared/vpn/kill-switch.d.ts +18 -0
- package/dist/shared/vpn/kill-switch.js +81 -0
- package/dist/shared/vpn/ovpn.d.ts +23 -0
- package/dist/shared/vpn/ovpn.js +244 -0
- package/dist/shared/vpn/wireguard.d.ts +51 -0
- package/dist/shared/vpn/wireguard.js +227 -0
- package/dist/shared/web/index.d.ts +1 -0
- package/dist/shared/web/index.js +1 -0
- package/dist/shared/web/protocol.d.ts +61 -0
- package/dist/shared/web/protocol.js +35 -0
- package/dist/sync/sync-cycle.js +9 -5
- package/dist/sync/sync-state.d.ts +1 -0
- package/dist/sync/sync-state.js +1 -0
- package/dist/sync/watcher.d.ts +13 -0
- package/dist/sync/watcher.js +102 -3
- package/dist/web/index.html +14 -0
- package/dist/web/main-NRRS5O6Z.js +157 -0
- package/dist/web/main-T5DMCHYV.css +1 -0
- package/native/csharp/FolderSecurity.cs +29 -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/protect-data.ps1 +29 -0
- package/native/scripts/read-folder-sddl.ps1 +10 -0
- package/native/scripts/run-elevated.ps1 +17 -4
- package/native/scripts/set-folder-access.ps1 +49 -7
- package/native/scripts/stop-events.ps1 +23 -8
- package/node_modules/ws/LICENSE +20 -0
- package/node_modules/ws/README.md +548 -0
- package/node_modules/ws/browser.js +8 -0
- package/node_modules/ws/index.js +22 -0
- package/node_modules/ws/lib/buffer-util.js +131 -0
- package/node_modules/ws/lib/constants.js +19 -0
- package/node_modules/ws/lib/event-target.js +292 -0
- package/node_modules/ws/lib/extension.js +203 -0
- package/node_modules/ws/lib/limiter.js +55 -0
- package/node_modules/ws/lib/permessage-deflate.js +530 -0
- package/node_modules/ws/lib/receiver.js +743 -0
- package/node_modules/ws/lib/sender.js +607 -0
- package/node_modules/ws/lib/stream.js +161 -0
- package/node_modules/ws/lib/subprotocol.js +62 -0
- package/node_modules/ws/lib/validation.js +152 -0
- package/node_modules/ws/lib/websocket-server.js +562 -0
- package/node_modules/ws/lib/websocket.js +1421 -0
- package/node_modules/ws/package.json +74 -0
- package/node_modules/ws/wrapper.mjs +21 -0
- package/package.json +22 -5
- package/sandbox/csharp/EnvBroadcast.cs +33 -0
- package/sandbox/csharp/MemGov.cs +398 -0
- package/sandbox/csharp/PathSync.cs +90 -0
- package/sandbox/csharp/PtyHost.cs +111 -5
- package/sandbox/scripts/install-shell-path.ps1 +73 -0
- package/sandbox/scripts/set-machine-environment.ps1 +37 -4
- package/schemas/config.schema.json +136 -7
- package/schemas/sandbox-config.schema.json +17 -4
- package/dist/cli/commands/repair/checks.d.ts +0 -2
- package/dist/cli/commands/repair/checks.js +0 -246
- 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 -45
- package/dist/cli/commands/sessions/status.d.ts +0 -2
- package/dist/cli/commands/sessions/status.js +0 -93
- package/dist/cli/commands/sessions/window.d.ts +0 -3
- package/dist/cli/commands/sessions/window.js +0 -18
- package/dist/cli/menu/pages/start-page.d.ts +0 -43
- package/dist/cli/menu/pages/start-page.js +0 -192
- package/dist/cli/tui/tab-bar.d.ts +0 -9
- package/dist/cli/tui/tab-bar.js +0 -33
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ioFromAsker } from '../../app/kernel/index.js';
|
|
2
|
+
import { askChoice, askChoices, askName, askRequired, askSecret, askTyped } from '../../core/prompt.js';
|
|
3
|
+
import { fail } from '../../core/util/index.js';
|
|
4
|
+
import { c, ProgressLine } from '../output/index.js';
|
|
5
|
+
/** What to do instead when there is no terminal to ask in. */
|
|
6
|
+
const NO_TERMINAL_FIX = 'Run it in a terminal, or give the value on the command line.';
|
|
7
|
+
const PAINT = {
|
|
8
|
+
ok: c.green,
|
|
9
|
+
warn: c.yellow,
|
|
10
|
+
danger: c.red,
|
|
11
|
+
muted: c.dim,
|
|
12
|
+
accent: c.bold,
|
|
13
|
+
};
|
|
14
|
+
/** The question in one line, as a prompt says it: its lines, then the question itself. */
|
|
15
|
+
function promptText(q) {
|
|
16
|
+
return [...(q.lines ?? []), q.title].join(' ');
|
|
17
|
+
}
|
|
18
|
+
function interactive() {
|
|
19
|
+
return Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
20
|
+
}
|
|
21
|
+
async function ask(q, options) {
|
|
22
|
+
if ('problem' in q && q.problem)
|
|
23
|
+
console.log(c.yellow(q.problem));
|
|
24
|
+
switch (q.kind) {
|
|
25
|
+
case 'confirm': {
|
|
26
|
+
if (q.implied || options.yes)
|
|
27
|
+
return true;
|
|
28
|
+
if (!interactive())
|
|
29
|
+
fail(q.noTerminal?.message ?? 'Cannot ask here (no terminal).', q.noTerminal?.fix ?? 'Add --yes to answer yes.');
|
|
30
|
+
if (q.typed)
|
|
31
|
+
return askTyped(promptText(q), q.typed);
|
|
32
|
+
return askRequired(promptText(q), q.noTerminal?.fix);
|
|
33
|
+
}
|
|
34
|
+
case 'choose':
|
|
35
|
+
return askChoice(promptText(q), q.choices.map((ch) => ({ name: ch.label, value: ch.value, description: ch.description })), NO_TERMINAL_FIX);
|
|
36
|
+
case 'checklist':
|
|
37
|
+
return askChoices(promptText(q), q.choices.map((ch) => ({ name: ch.label, value: ch.value, description: ch.description })), NO_TERMINAL_FIX);
|
|
38
|
+
case 'secret':
|
|
39
|
+
return askSecret(promptText(q), NO_TERMINAL_FIX);
|
|
40
|
+
case 'text':
|
|
41
|
+
case 'path': {
|
|
42
|
+
const answer = await askName(promptText(q), NO_TERMINAL_FIX);
|
|
43
|
+
return answer === '' && q.kind === 'text' && !q.allowEmpty ? undefined : answer;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
/** An OperationIO for one command; close() removes a progress line still shown. */
|
|
48
|
+
export function cliIO(options) {
|
|
49
|
+
const progress = new ProgressLine();
|
|
50
|
+
const asker = async (q) => {
|
|
51
|
+
progress.stop();
|
|
52
|
+
return (await ask(q, options));
|
|
53
|
+
};
|
|
54
|
+
const io = ioFromAsker(asker, {
|
|
55
|
+
progress: (text) => progress.show(text),
|
|
56
|
+
log: (text, tone) => {
|
|
57
|
+
progress.stop();
|
|
58
|
+
console.log(tone ? PAINT[tone](text) : text);
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
return { io, close: () => progress.stop() };
|
|
62
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type AnyDefinition, type Field } from '../../app/kernel/index.js';
|
|
2
|
+
import type { CommandSpec } from '../manifest.js';
|
|
3
|
+
/** The definitions that are a command of their own. */
|
|
4
|
+
export declare function commandDefinitions(): AnyDefinition[];
|
|
5
|
+
/** The definitions that are an action of a hand-written command. */
|
|
6
|
+
export declare function actionDefinitions(): AnyDefinition[];
|
|
7
|
+
/** The Field of one input field of a definition. */
|
|
8
|
+
export declare function inputField(def: AnyDefinition, name: string): Field;
|
|
9
|
+
/** The manifest command of a definition that is a command of its own. */
|
|
10
|
+
export declare function commandSpecOf(def: AnyDefinition): CommandSpec;
|
|
11
|
+
/**
|
|
12
|
+
* A hand-written command with the actions the definitions add (`config reset`): the action is one of the first
|
|
13
|
+
* argument's choices, each later argument is asked for it in the menu's command form, and --json is offered when an
|
|
14
|
+
* action prints JSON.
|
|
15
|
+
*/
|
|
16
|
+
export declare function withActions(spec: CommandSpec, defs?: readonly AnyDefinition[]): CommandSpec;
|
|
17
|
+
/** Every command the definitions add, and the hand-written ones with their added actions. */
|
|
18
|
+
export declare function withOperationCommands(handWritten: readonly CommandSpec[]): CommandSpec[];
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
// The command line of the shared core's definitions: each definition with a CLI hint becomes a manifest command (its
|
|
2
|
+
// options and arguments read from the input schema, their help from .describe()), or an action of an existing command
|
|
3
|
+
// (`config get`). manifest.ts adds these to the hand-written commands, so --help, the parser and the menu's command
|
|
4
|
+
// list treat them like any other command.
|
|
5
|
+
import { DEFINITIONS } from '../../app/features/defs.js';
|
|
6
|
+
import { fieldOf, SchemaNode } from '../../app/kernel/index.js';
|
|
7
|
+
/** The definitions that are a command of their own. */
|
|
8
|
+
export function commandDefinitions() {
|
|
9
|
+
return DEFINITIONS.filter((d) => d.cli && !d.cli.action);
|
|
10
|
+
}
|
|
11
|
+
/** The definitions that are an action of a hand-written command. */
|
|
12
|
+
export function actionDefinitions() {
|
|
13
|
+
return DEFINITIONS.filter((d) => d.cli?.action);
|
|
14
|
+
}
|
|
15
|
+
/** The Field of one input field of a definition. */
|
|
16
|
+
export function inputField(def, name) {
|
|
17
|
+
const node = new SchemaNode(def.input).child(name);
|
|
18
|
+
if (!node)
|
|
19
|
+
throw new Error(def.id + ': the CLI hint names "' + name + '", which is not in its input');
|
|
20
|
+
return fieldOf(node, [name]);
|
|
21
|
+
}
|
|
22
|
+
const OPTION_TYPES = {
|
|
23
|
+
boolean: 'boolean',
|
|
24
|
+
number: 'number',
|
|
25
|
+
list: 'list',
|
|
26
|
+
};
|
|
27
|
+
function stringChoices(field) {
|
|
28
|
+
const values = field.choices?.map((c) => c.value).filter((v) => typeof v === 'string');
|
|
29
|
+
return values?.length ? values : undefined;
|
|
30
|
+
}
|
|
31
|
+
function optionSpec(def, name, flag) {
|
|
32
|
+
const field = inputField(def, name);
|
|
33
|
+
const type = OPTION_TYPES[field.kind] ?? 'string';
|
|
34
|
+
const choices = flag.choices ? (typeof flag.choices === 'string' ? flag.choices : [...flag.choices]) : undefined;
|
|
35
|
+
const fixed = choices ?? stringChoices(field);
|
|
36
|
+
const fallback = field.default;
|
|
37
|
+
return {
|
|
38
|
+
flag: flag.flag,
|
|
39
|
+
type,
|
|
40
|
+
description: field.help ?? '',
|
|
41
|
+
...(flag.short ? { short: flag.short } : {}),
|
|
42
|
+
...(flag.shownAs ? { shownAs: flag.shownAs } : {}),
|
|
43
|
+
...(type === 'boolean' ? {} : { value: flag.value ?? name }),
|
|
44
|
+
...(flag.label ? { label: flag.label } : {}),
|
|
45
|
+
...(fixed ? { choices: fixed } : {}),
|
|
46
|
+
...(type !== 'boolean' && (typeof fallback === 'string' || typeof fallback === 'number')
|
|
47
|
+
? { default: fallback }
|
|
48
|
+
: {}),
|
|
49
|
+
...(flag.noMenu ? { noMenu: true } : {}),
|
|
50
|
+
...(flag.advanced ? { advanced: true } : {}),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function argSpec(def, name) {
|
|
54
|
+
const field = inputField(def, name);
|
|
55
|
+
const choices = stringChoices(field);
|
|
56
|
+
return {
|
|
57
|
+
name,
|
|
58
|
+
description: field.help ?? '',
|
|
59
|
+
required: !field.optional,
|
|
60
|
+
...(choices ? { choices } : {}),
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
/** The manifest command of a definition that is a command of its own. */
|
|
64
|
+
export function commandSpecOf(def) {
|
|
65
|
+
const hint = def.cli;
|
|
66
|
+
if (!hint?.group)
|
|
67
|
+
throw new Error(def.id + ': a CLI command of its own needs a group');
|
|
68
|
+
return {
|
|
69
|
+
name: hint.name,
|
|
70
|
+
summary: hint.summary ?? def.summary,
|
|
71
|
+
group: hint.group,
|
|
72
|
+
args: (hint.positional ?? []).map((name) => argSpec(def, name)),
|
|
73
|
+
options: [
|
|
74
|
+
...Object.entries(hint.flags ?? {}).flatMap(([name, flag]) => (flag ? [optionSpec(def, name, flag)] : [])),
|
|
75
|
+
...(hint.yes
|
|
76
|
+
? [{ flag: '--yes', short: '-y', type: 'boolean', description: hint.yes, noMenu: true }]
|
|
77
|
+
: []),
|
|
78
|
+
],
|
|
79
|
+
...(hint.json ? { json: true } : {}),
|
|
80
|
+
...(hint.examples ? { examples: [...hint.examples] } : {}),
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* A hand-written command with the actions the definitions add (`config reset`): the action is one of the first
|
|
85
|
+
* argument's choices, each later argument is asked for it in the menu's command form, and --json is offered when an
|
|
86
|
+
* action prints JSON.
|
|
87
|
+
*/
|
|
88
|
+
export function withActions(spec, defs = actionDefinitions()) {
|
|
89
|
+
const mine = defs.filter((d) => d.cli?.name === spec.name);
|
|
90
|
+
if (!mine.length || !spec.args.length)
|
|
91
|
+
return spec;
|
|
92
|
+
const [first, ...rest] = spec.args;
|
|
93
|
+
const actions = mine.map((d) => d.cli.action);
|
|
94
|
+
const choices = Array.isArray(first.choices) ? [...new Set([...first.choices, ...actions])] : first.choices;
|
|
95
|
+
const asked = (arg, position) => {
|
|
96
|
+
const users = mine.filter((d) => (d.cli?.positional?.length ?? 0) > position).map((d) => d.cli.action);
|
|
97
|
+
if (!users.length || arg.when === undefined)
|
|
98
|
+
return arg;
|
|
99
|
+
const when = Array.isArray(arg.when) ? arg.when : [arg.when];
|
|
100
|
+
return { ...arg, when: [...new Set([...when, ...users])] };
|
|
101
|
+
};
|
|
102
|
+
const json = spec.json || mine.some((d) => d.cli?.json) ? { json: true } : {};
|
|
103
|
+
return { ...spec, ...json, args: [{ ...first, choices }, ...rest.map(asked)] };
|
|
104
|
+
}
|
|
105
|
+
/** Every command the definitions add, and the hand-written ones with their added actions. */
|
|
106
|
+
export function withOperationCommands(handWritten) {
|
|
107
|
+
return [...handWritten.map((spec) => withActions(spec)), ...commandDefinitions().map(commandSpecOf)];
|
|
108
|
+
}
|
|
@@ -14,8 +14,8 @@ export declare function stripAnsi(text: string): string;
|
|
|
14
14
|
export declare function shorten(text: string, max: number): string;
|
|
15
15
|
/** Cuts the middle out of a long path or id so both ends stay readable. */
|
|
16
16
|
export declare function shortenMiddle(text: string, max: number): string;
|
|
17
|
-
/**
|
|
18
|
-
export
|
|
17
|
+
/** "3 min ago" for the tables (the kernel's, so every surface says it the same way). */
|
|
18
|
+
export { ago } from '../../app/kernel/index.js';
|
|
19
19
|
/** Width to lay text out in (terminal columns, 80 when unknown, never absurdly small). */
|
|
20
20
|
export declare function termWidth(): number;
|
|
21
21
|
/** Each menu page starts on a clean screen (answered prompts would otherwise pile up above it). */
|
|
@@ -34,17 +34,8 @@ export function shortenMiddle(text, max) {
|
|
|
34
34
|
const head = Math.ceil(keep / 2);
|
|
35
35
|
return text.slice(0, head) + '…' + text.slice(text.length - (keep - head));
|
|
36
36
|
}
|
|
37
|
-
/**
|
|
38
|
-
export
|
|
39
|
-
const secs = Math.max(0, Math.round((now - new Date(then).getTime()) / 1000));
|
|
40
|
-
if (secs < 45)
|
|
41
|
-
return 'just now';
|
|
42
|
-
if (secs < 3600)
|
|
43
|
-
return Math.round(secs / 60) + ' min ago';
|
|
44
|
-
if (secs < 86400)
|
|
45
|
-
return Math.round(secs / 3600) + ' h ago';
|
|
46
|
-
return Math.round(secs / 86400) + ' d ago';
|
|
47
|
-
}
|
|
37
|
+
/** "3 min ago" for the tables (the kernel's, so every surface says it the same way). */
|
|
38
|
+
export { ago } from '../../app/kernel/index.js';
|
|
48
39
|
/** Width to lay text out in (terminal columns, 80 when unknown, never absurdly small). */
|
|
49
40
|
export function termWidth() {
|
|
50
41
|
return Math.max(40, process.stdout.columns ?? 80);
|
package/dist/cli/output/index.js
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { Context } from '../commands/context.js';
|
|
2
|
+
/** Rows as aligned columns (the last column is not padded). */
|
|
3
|
+
export declare function tableLines(rows: readonly (readonly string[])[]): string[];
|
|
2
4
|
/** Prints rows as aligned columns (the last column is not padded). */
|
|
3
|
-
export declare function table(rows: string[][]): void;
|
|
5
|
+
export declare function table(rows: readonly (readonly string[])[]): void;
|
|
4
6
|
/** Prints `value` as JSON when --json was given; returns whether it did. */
|
|
5
7
|
export declare function printJson(ctx: Context, value: unknown): boolean;
|
|
8
|
+
/** A dim "Next: ..." line after a command: the usual thing to do now. */
|
|
9
|
+
export declare function nextStep(text: string): void;
|
package/dist/cli/output/print.js
CHANGED
|
@@ -1,14 +1,25 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
|
+
import { scrubSecrets } from '../../core/schema/index.js';
|
|
3
|
+
import { c } from './colors.js';
|
|
4
|
+
/** Rows as aligned columns (the last column is not padded). */
|
|
5
|
+
export function tableLines(rows) {
|
|
6
|
+
const widths = _.range(_.max(rows.map((r) => r.length)) ?? 0).map((i) => _.max(rows.map((r) => (r[i] ?? '').length)) ?? 0);
|
|
7
|
+
return rows.map((row) => row.map((cell, i) => (i === row.length - 1 ? cell : _.padEnd(cell, widths[i] + 2))).join(''));
|
|
8
|
+
}
|
|
2
9
|
/** Prints rows as aligned columns (the last column is not padded). */
|
|
3
10
|
export function table(rows) {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
console.log(row.map((cell, i) => (i === row.length - 1 ? cell : _.padEnd(cell, widths[i] + 2))).join(''));
|
|
11
|
+
for (const line of tableLines(rows))
|
|
12
|
+
console.log(line);
|
|
7
13
|
}
|
|
8
14
|
/** Prints `value` as JSON when --json was given; returns whether it did. */
|
|
9
15
|
export function printJson(ctx, value) {
|
|
10
16
|
// JSON.stringify leaves C1 controls (U+0080-U+009F) as they are; text from the sandbox must not reach a terminal raw.
|
|
17
|
+
// Secret values of your settings (agent API keys) never appear, whatever built the value.
|
|
11
18
|
if (ctx.options.json)
|
|
12
|
-
console.log(JSON.stringify(value, null, 2).replace(/[\u0080-\u009f]/g, (ch) => '\\u' + ch.charCodeAt(0).toString(16).padStart(4, '0')));
|
|
19
|
+
console.log(scrubSecrets(JSON.stringify(value, null, 2), ctx.loaded.config).replace(/[\u0080-\u009f]/g, (ch) => '\\u' + ch.charCodeAt(0).toString(16).padStart(4, '0')));
|
|
13
20
|
return ctx.options.json;
|
|
14
21
|
}
|
|
22
|
+
/** A dim "Next: ..." line after a command: the usual thing to do now. */
|
|
23
|
+
export function nextStep(text) {
|
|
24
|
+
console.log(c.dim('Next: ' + text));
|
|
25
|
+
}
|
|
@@ -22,3 +22,18 @@ export declare function follow<T>(show: () => Progressing, work: () => Promise<T
|
|
|
22
22
|
* (waiting on the sandbox); for long synchronous work (measuring folders) the static line is what you see.
|
|
23
23
|
*/
|
|
24
24
|
export declare function working<T>(message: string | (() => string), work: () => Promise<T> | T, enabled?: boolean): Promise<T>;
|
|
25
|
+
/**
|
|
26
|
+
* A progress line that follows an operation (its io.progress): on a terminal one line redrawn in place until stop();
|
|
27
|
+
* without one, each new text once as "text...". Prompts and log lines call stop() first.
|
|
28
|
+
*/
|
|
29
|
+
export declare class ProgressLine {
|
|
30
|
+
private text;
|
|
31
|
+
private timer;
|
|
32
|
+
private frame;
|
|
33
|
+
private start;
|
|
34
|
+
private readonly animate;
|
|
35
|
+
show(text: string): void;
|
|
36
|
+
private draw;
|
|
37
|
+
/** Removes the line (the next show() starts it again). */
|
|
38
|
+
stop(): void;
|
|
39
|
+
}
|
|
@@ -122,3 +122,47 @@ export async function working(message, work, enabled = true) {
|
|
|
122
122
|
err.write('\r\x1b[2K');
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* A progress line that follows an operation (its io.progress): on a terminal one line redrawn in place until stop();
|
|
127
|
+
* without one, each new text once as "text...". Prompts and log lines call stop() first.
|
|
128
|
+
*/
|
|
129
|
+
export class ProgressLine {
|
|
130
|
+
text = '';
|
|
131
|
+
timer;
|
|
132
|
+
frame = 0;
|
|
133
|
+
start = 0;
|
|
134
|
+
animate = canAnimate(process.env, Boolean(process.stderr.isTTY));
|
|
135
|
+
show(text) {
|
|
136
|
+
if (text === this.text && (this.timer || !this.animate))
|
|
137
|
+
return;
|
|
138
|
+
this.text = text;
|
|
139
|
+
if (!this.animate) {
|
|
140
|
+
process.stderr.write(text + '...\n');
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (!this.timer) {
|
|
144
|
+
this.start = Date.now();
|
|
145
|
+
this.timer = setInterval(() => this.draw(), 120);
|
|
146
|
+
}
|
|
147
|
+
this.draw();
|
|
148
|
+
}
|
|
149
|
+
draw() {
|
|
150
|
+
const colour = colorEnabled(process.env, true);
|
|
151
|
+
process.stderr.write('\r\x1b[2K' +
|
|
152
|
+
(colour ? '\x1b[36m' : '') +
|
|
153
|
+
FRAMES[this.frame++ % FRAMES.length] +
|
|
154
|
+
(colour ? '\x1b[0m' : '') +
|
|
155
|
+
' ' +
|
|
156
|
+
shorten(this.text, termWidth() - 14) +
|
|
157
|
+
(Date.now() - this.start > 3000 ? ' (' + elapsed(Date.now() - this.start) + ')' : ''));
|
|
158
|
+
}
|
|
159
|
+
/** Removes the line (the next show() starts it again). */
|
|
160
|
+
stop() {
|
|
161
|
+
if (this.timer) {
|
|
162
|
+
clearInterval(this.timer);
|
|
163
|
+
this.timer = undefined;
|
|
164
|
+
process.stderr.write('\r\x1b[2K');
|
|
165
|
+
}
|
|
166
|
+
this.text = '';
|
|
167
|
+
}
|
|
168
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Page } from '../../app/kernel/index.js';
|
|
2
|
+
/** The page as lines of text (text that came from the sandbox was made safe by the feature; this makes sure). */
|
|
3
|
+
export declare function pageLines(page: Page): string[];
|
|
4
|
+
export declare function printPage(page: Page): void;
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { pageHasContent } from '../../app/kernel/index.js';
|
|
2
|
+
import { safeText } from '../../core/util/index.js';
|
|
3
|
+
import { c } from './colors.js';
|
|
4
|
+
import { tableLines } from './print.js';
|
|
5
|
+
const PAINT = {
|
|
6
|
+
ok: (t) => t,
|
|
7
|
+
warn: c.yellow,
|
|
8
|
+
danger: c.red,
|
|
9
|
+
muted: c.dim,
|
|
10
|
+
accent: (t) => t,
|
|
11
|
+
};
|
|
12
|
+
const forCli = (n) => n.only === undefined || n.only === 'cli';
|
|
13
|
+
function itemLine(item) {
|
|
14
|
+
const label = item.tone ? PAINT[item.tone](item.label) : item.details?.length ? c.bold(item.label) : item.label;
|
|
15
|
+
return (item.marked ? '* ' : ' ') + label + (item.hint ? ' ' + item.hint : '');
|
|
16
|
+
}
|
|
17
|
+
function sectionLines(section) {
|
|
18
|
+
const items = section.items ?? [];
|
|
19
|
+
const lines = [];
|
|
20
|
+
if (section.title)
|
|
21
|
+
lines.push(c.bold(section.title) + (section.summary ? ' ' + section.summary : ''));
|
|
22
|
+
if (section.facts?.length)
|
|
23
|
+
lines.push(...tableLines(section.facts.map((f) => [f.label, f.value])));
|
|
24
|
+
if (section.columns && items.length) {
|
|
25
|
+
const columns = section.columns;
|
|
26
|
+
lines.push(...tableLines([
|
|
27
|
+
columns.map((col) => col.label),
|
|
28
|
+
...items.map((i) => columns.map((col) => i.cells?.[col.key] ?? '')),
|
|
29
|
+
]));
|
|
30
|
+
}
|
|
31
|
+
else
|
|
32
|
+
for (const item of items) {
|
|
33
|
+
lines.push(itemLine(item));
|
|
34
|
+
for (const detail of item.details ?? [])
|
|
35
|
+
lines.push(' ' + detail);
|
|
36
|
+
}
|
|
37
|
+
for (const note of (section.notes ?? []).filter(forCli))
|
|
38
|
+
lines.push(note.tone ? PAINT[note.tone](note.text) : note.text);
|
|
39
|
+
return lines;
|
|
40
|
+
}
|
|
41
|
+
/** The page as lines of text (text that came from the sandbox was made safe by the feature; this makes sure). */
|
|
42
|
+
export function pageLines(page) {
|
|
43
|
+
const out = [];
|
|
44
|
+
if (page.notice)
|
|
45
|
+
out.push(c.bold(page.notice.text));
|
|
46
|
+
if (!pageHasContent(page) && page.empty) {
|
|
47
|
+
out.push(page.empty.cliText ?? page.empty.text);
|
|
48
|
+
return out.map(safeText);
|
|
49
|
+
}
|
|
50
|
+
for (const section of page.sections) {
|
|
51
|
+
const lines = sectionLines(section);
|
|
52
|
+
if (!lines.length)
|
|
53
|
+
continue;
|
|
54
|
+
if (section.title && out.length)
|
|
55
|
+
out.push('');
|
|
56
|
+
out.push(...lines);
|
|
57
|
+
}
|
|
58
|
+
return out.map(safeText);
|
|
59
|
+
}
|
|
60
|
+
export function printPage(page) {
|
|
61
|
+
for (const line of pageLines(page))
|
|
62
|
+
console.log(line);
|
|
63
|
+
}
|
|
@@ -13,6 +13,8 @@ export interface AgentAccounts {
|
|
|
13
13
|
export interface AccountRef {
|
|
14
14
|
readonly name: string;
|
|
15
15
|
readonly email: string | null;
|
|
16
|
+
/** Something worth telling after a switch (e.g. plugins were copied, or could not be). */
|
|
17
|
+
readonly note?: string;
|
|
16
18
|
}
|
|
17
19
|
export declare class AccountsService {
|
|
18
20
|
private readonly ctx;
|
|
@@ -12,7 +12,7 @@ export class AccountsService {
|
|
|
12
12
|
claude;
|
|
13
13
|
constructor(ctx) {
|
|
14
14
|
this.ctx = ctx;
|
|
15
|
-
this.claude = new AccountStore(ctx.storageRoot);
|
|
15
|
+
this.claude = new AccountStore(ctx.storageRoot, ctx.loaded.config.claudeProfile.sharePluginsAcrossAccounts);
|
|
16
16
|
}
|
|
17
17
|
/** Claude first, then the other agents that keep a login, then the ones that cannot. */
|
|
18
18
|
agents() {
|
|
@@ -68,7 +68,7 @@ export class AccountsService {
|
|
|
68
68
|
activate(name, agent = CLAUDE) {
|
|
69
69
|
if (agent === CLAUDE) {
|
|
70
70
|
const a = this.claude.activate(this.ctx.dataPath, name);
|
|
71
|
-
return { name: a.name, email: a.email };
|
|
71
|
+
return { name: a.name, email: a.email, note: this.claude.pluginNote ?? undefined };
|
|
72
72
|
}
|
|
73
73
|
const { store, stateDir } = this.other(agent);
|
|
74
74
|
store.activate(this.ctx.dataPath, name, stateDir);
|
|
@@ -15,6 +15,8 @@ export declare class AgentCommandsService {
|
|
|
15
15
|
/** Agent commands change this PC's PATH, so they are set up from the PC, not inside the sandbox. */
|
|
16
16
|
assertOnPc(): void;
|
|
17
17
|
status(): AgentCommandsStatus;
|
|
18
|
+
/** status() that does not block the program (the menu asks while it stays responsive). */
|
|
19
|
+
statusAsync(): Promise<AgentCommandsStatus>;
|
|
18
20
|
/** Writes agentCommands.enabled to your config file, then brings this PC in line with it. */
|
|
19
21
|
setEnabled(on: boolean): Reconciled | null;
|
|
20
22
|
/** Brings this PC in line with agentCommands. Null inside a sandbox (nothing to change there). */
|
|
@@ -3,10 +3,10 @@ import fs from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import { loadConfig, userConfigPath } from '../../core/config/index.js';
|
|
5
5
|
import { fail } from '../../core/util/index.js';
|
|
6
|
-
import { agentCommands, commandsDir, reconcileAgentCommands, } from '../../host/agent-commands/index.js';
|
|
6
|
+
import { agentCommands, agentCommandsAsync, commandsDir, reconcileAgentCommands, } from '../../host/agent-commands/index.js';
|
|
7
7
|
import { insideSandbox } from '../../host/sandbox/index.js';
|
|
8
8
|
import { writeFileAtomic } from '../../shared/io/index.js';
|
|
9
|
-
import { editConfigText } from '
|
|
9
|
+
import { editConfigText } from '../../app/features/settings/index.js';
|
|
10
10
|
export class AgentCommandsService {
|
|
11
11
|
ctx;
|
|
12
12
|
constructor(ctx) {
|
|
@@ -25,6 +25,15 @@ export class AgentCommandsService {
|
|
|
25
25
|
found: agentCommands(config, this.ctx.storageRoot),
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
+
/** status() that does not block the program (the menu asks while it stays responsive). */
|
|
29
|
+
async statusAsync() {
|
|
30
|
+
const { config } = this.ctx.loaded;
|
|
31
|
+
return {
|
|
32
|
+
enabled: config.agentCommands.enabled,
|
|
33
|
+
dir: commandsDir(this.ctx.storageRoot),
|
|
34
|
+
found: await agentCommandsAsync(config, this.ctx.storageRoot),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
28
37
|
/** Writes agentCommands.enabled to your config file, then brings this PC in line with it. */
|
|
29
38
|
setEnabled(on) {
|
|
30
39
|
const file = this.ctx.loaded.configPath ?? userConfigPath();
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import { UserError } from '../../core/util/index.js';
|
|
2
1
|
import type { Context } from '../commands/context.js';
|
|
3
|
-
import type { RepairCheck, RepairEnv, RepairResult } from '../commands/repair/types.js';
|
|
4
2
|
import { type Check } from '../commands/setup/checks.js';
|
|
5
3
|
import { type MachineFacts } from '../commands/setup/facts.js';
|
|
6
|
-
/** Runs every check in order; a check that throws is reported, never stops the rest. */
|
|
7
|
-
export declare function runChecks(env: RepairEnv, checks?: RepairCheck[]): RepairResult[];
|
|
8
4
|
/** What `sandbox setup` found out about this PC. */
|
|
9
5
|
export interface SetupReport {
|
|
10
6
|
readonly facts: MachineFacts;
|
|
@@ -17,8 +13,6 @@ export declare class HealthService {
|
|
|
17
13
|
constructor(ctx: Context);
|
|
18
14
|
/** The table `doctor` shows: [name, detail] rows. */
|
|
19
15
|
doctor(): string[][];
|
|
20
|
-
/** Runs the repair checks (and the fixes they make). A config file that does not load is the first problem. */
|
|
21
|
-
repair(configError?: UserError | null): RepairResult[];
|
|
22
16
|
/** Fails unless this is Windows: Windows Sandbox runs nowhere else. */
|
|
23
17
|
assertWindows(): void;
|
|
24
18
|
/** The setup checklist for this PC. */
|
|
@@ -1,28 +1,15 @@
|
|
|
1
|
-
// Is this PC (and the sandbox) in good shape: doctor
|
|
2
|
-
|
|
1
|
+
// Is this PC (and the sandbox) in good shape: the doctor details, the setup checklist. The checks themselves are in
|
|
2
|
+
// commands/repair (one engine for doctor and repair). Never prints.
|
|
3
3
|
import { spawnSync } from 'node:child_process';
|
|
4
|
-
import {
|
|
5
|
-
import { errMsg, expandPath, fail, isWin, UserError } from '../../core/util/index.js';
|
|
4
|
+
import { expandPath, fail, isWin } from '../../core/util/index.js';
|
|
6
5
|
import { detectWsb, doctorRows, insideSandbox, isSandboxRunning } from '../../host/sandbox/index.js';
|
|
6
|
+
import { machineDoctorRows } from '../../host/sharing/index.js';
|
|
7
7
|
import { KnownProjects, ProjectRegistry } from '../../host/projects/index.js';
|
|
8
8
|
import { nativeScript } from '../../host/native.js';
|
|
9
9
|
import { refuseInSelfTest } from '../../host/test-guard.js';
|
|
10
10
|
import { SYSTEM } from '../../shared/system.js';
|
|
11
|
-
import { CHECKS } from '../commands/repair/checks.js';
|
|
12
11
|
import { buildChecks, canEnableFeature } from '../commands/setup/checks.js';
|
|
13
12
|
import { ENABLE_COMMAND, gatherFacts } from '../commands/setup/facts.js';
|
|
14
|
-
/** Runs every check in order; a check that throws is reported, never stops the rest. */
|
|
15
|
-
export function runChecks(env, checks = CHECKS) {
|
|
16
|
-
return checks.map((check) => {
|
|
17
|
-
try {
|
|
18
|
-
return { name: check.name, ...check.run(env) };
|
|
19
|
-
}
|
|
20
|
-
catch (e) {
|
|
21
|
-
const fix = e instanceof UserError && e.fix ? ' ' + e.fix : '';
|
|
22
|
-
return { name: check.name, status: 'needs-you', detail: 'check failed: ' + errMsg(e) + fix };
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
13
|
export class HealthService {
|
|
27
14
|
ctx;
|
|
28
15
|
constructor(ctx) {
|
|
@@ -45,6 +32,7 @@ export class HealthService {
|
|
|
45
32
|
const wsb = p.wsbShare ? detectWsb() : null;
|
|
46
33
|
return [
|
|
47
34
|
...rows,
|
|
35
|
+
...machineDoctorRows(ctx.packageRoot, ctx.dataPath),
|
|
48
36
|
[
|
|
49
37
|
'Project roots',
|
|
50
38
|
p.roots.length
|
|
@@ -75,31 +63,6 @@ export class HealthService {
|
|
|
75
63
|
],
|
|
76
64
|
];
|
|
77
65
|
}
|
|
78
|
-
/** Runs the repair checks (and the fixes they make). A config file that does not load is the first problem. */
|
|
79
|
-
repair(configError = null) {
|
|
80
|
-
const { ctx } = this;
|
|
81
|
-
const env = {
|
|
82
|
-
ctx,
|
|
83
|
-
running: isSandboxRunning(),
|
|
84
|
-
dataPath: ctx.dataPath,
|
|
85
|
-
storageRoot: ctx.storageRoot,
|
|
86
|
-
toolsDir: path.join(ctx.dataPath, 'tools'),
|
|
87
|
-
configError,
|
|
88
|
-
};
|
|
89
|
-
// Re-check the config file even when the context loaded (it may have been edited since, or come from --config).
|
|
90
|
-
if (!env.configError) {
|
|
91
|
-
try {
|
|
92
|
-
loadConfig(ctx.options.config);
|
|
93
|
-
}
|
|
94
|
-
catch (e) {
|
|
95
|
-
if (e instanceof UserError)
|
|
96
|
-
env.configError = e;
|
|
97
|
-
else
|
|
98
|
-
throw e;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
return runChecks(env);
|
|
102
|
-
}
|
|
103
66
|
/** Fails unless this is Windows: Windows Sandbox runs nowhere else. */
|
|
104
67
|
assertWindows() {
|
|
105
68
|
if (!isWin)
|
|
@@ -5,8 +5,10 @@ export { resolveCleanTargets, type CleanTarget } from './data-targets.js';
|
|
|
5
5
|
export { DatabasesService, parseDatabaseList, type DatabaseAction, type DatabaseRow } from './databases-service.js';
|
|
6
6
|
export { autoMigrates, continuesAfterFailedMigration, MigrateService, type MigrateContext, type MigrateResult, } from './migrate-service.js';
|
|
7
7
|
export { NPM_UPDATE_COMMAND, UpdateService, runsAsSystem, type CheckResult, type UpdateServiceOptions, type UpdateStatus, type UpdateTaskPort, } from './update-service.js';
|
|
8
|
+
export { NORD_STEPS, VpnService, type VpnReport } from './vpn-service.js';
|
|
8
9
|
export { LogsService, type LogFile } from './logs-service.js';
|
|
9
|
-
export {
|
|
10
|
+
export { WebService, webSession } from './web-service.js';
|
|
11
|
+
export { HealthService, type SetupReport } from './health-service.js';
|
|
10
12
|
export { ProjectsService, type ProjectRow, type ProjectSettings, type ProjectsListing } from './projects-service.js';
|
|
11
13
|
export { SandboxService, type OtherSession, type ProjectInfo, type SandboxReport, type SandboxState, type StopPlan, } from './sandbox-service.js';
|
|
12
14
|
export { SessionsService, projectOf, viewerText, type ListedSession, type RestartScope } from './sessions-service.js';
|
|
@@ -5,8 +5,10 @@ export { resolveCleanTargets } from './data-targets.js';
|
|
|
5
5
|
export { DatabasesService, parseDatabaseList } from './databases-service.js';
|
|
6
6
|
export { autoMigrates, continuesAfterFailedMigration, MigrateService, } from './migrate-service.js';
|
|
7
7
|
export { NPM_UPDATE_COMMAND, UpdateService, runsAsSystem, } from './update-service.js';
|
|
8
|
+
export { NORD_STEPS, VpnService } from './vpn-service.js';
|
|
8
9
|
export { LogsService } from './logs-service.js';
|
|
9
|
-
export {
|
|
10
|
+
export { WebService, webSession } from './web-service.js';
|
|
11
|
+
export { HealthService } from './health-service.js';
|
|
10
12
|
export { ProjectsService } from './projects-service.js';
|
|
11
13
|
export { SandboxService, } from './sandbox-service.js';
|
|
12
14
|
export { SessionsService, projectOf, viewerText } from './sessions-service.js';
|
|
@@ -3,6 +3,7 @@ import fs from 'node:fs';
|
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import _ from 'lodash';
|
|
5
5
|
import { assertNoLinks, fail, safeText } from '../../core/util/index.js';
|
|
6
|
+
import { hostDataFolder, hostDataRoot } from '../../host/storage/index.js';
|
|
6
7
|
const LOG_NAME = /^(guest|daemon|bootstrap)-.*\.log$/;
|
|
7
8
|
/** Only the end of a log is read: the sandbox writes it. */
|
|
8
9
|
const FIRST_READ_BYTES = 64 * 1024;
|
|
@@ -13,8 +14,8 @@ export class LogsService {
|
|
|
13
14
|
this.ctx = ctx;
|
|
14
15
|
}
|
|
15
16
|
dir() {
|
|
16
|
-
const dir =
|
|
17
|
-
assertNoLinks(this.ctx.dataPath, dir);
|
|
17
|
+
const dir = hostDataFolder(this.ctx.dataPath, 'logs');
|
|
18
|
+
assertNoLinks(hostDataRoot(this.ctx.dataPath), dir);
|
|
18
19
|
return dir;
|
|
19
20
|
}
|
|
20
21
|
/** Log files, newest first. */
|
|
@@ -34,7 +35,7 @@ export class LogsService {
|
|
|
34
35
|
/** The newest log, or a UserError when there is none yet. */
|
|
35
36
|
newest() {
|
|
36
37
|
return (this.files()[0]?.path ??
|
|
37
|
-
fail('No sandbox logs yet in ' +
|
|
38
|
+
fail('No sandbox logs yet in ' + hostDataFolder(this.ctx.dataPath, 'logs') + '.', 'Logs appear after the first start (sandbox claude).'));
|
|
38
39
|
}
|
|
39
40
|
/**
|
|
40
41
|
* What was written to `file` since offset `from` (0 = the end of the log), as text safe for a terminal, and where
|
|
@@ -32,7 +32,7 @@ export class MigrateService {
|
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
/** Commands that never update the settings first: they must work whatever state the settings are in. */
|
|
35
|
-
const NO_AUTO_MIGRATION = ['self-test', 'migrate', 'update', '_watch'];
|
|
35
|
+
const NO_AUTO_MIGRATION = ['self-test', 'migrate', 'update', '_watch', '_web'];
|
|
36
36
|
/** Does this command update the saved settings before it runs (when the version changed)? Never inside a sandbox. */
|
|
37
37
|
export function autoMigrates(command, inSandbox) {
|
|
38
38
|
return !inSandbox && !NO_AUTO_MIGRATION.includes(command);
|