windows-development-sandbox 1.10.0 → 1.11.4
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 +64 -17
- package/config.example.json +5 -1
- package/dist/app/features/accounts/accounts.def.d.ts +122 -0
- package/dist/app/features/accounts/accounts.def.js +243 -0
- package/dist/app/features/accounts/accounts.run.d.ts +51 -0
- package/dist/app/features/accounts/accounts.run.js +125 -0
- package/dist/app/features/accounts/index.d.ts +2 -0
- package/dist/app/features/accounts/index.js +3 -0
- package/dist/app/features/agents/agent-entry.d.ts +17 -0
- package/dist/app/features/agents/agent-entry.js +50 -0
- package/dist/app/features/agents/agents.def.d.ts +65 -0
- package/dist/app/features/agents/agents.def.js +142 -0
- package/dist/app/features/agents/agents.run.d.ts +31 -0
- package/dist/app/features/agents/agents.run.js +189 -0
- package/dist/app/features/agents/index.d.ts +3 -0
- package/dist/app/features/agents/index.js +4 -0
- package/dist/app/features/apps/apps-rows.d.ts +31 -0
- package/dist/app/features/apps/apps-rows.js +73 -0
- package/dist/app/features/apps/apps.def.d.ts +181 -0
- package/dist/app/features/apps/apps.def.js +264 -0
- package/dist/app/features/apps/apps.run.d.ts +58 -0
- package/dist/app/features/apps/apps.run.js +76 -0
- package/dist/app/features/apps/index.d.ts +3 -0
- package/dist/app/features/apps/index.js +4 -0
- package/dist/app/features/data/data.def.d.ts +154 -0
- package/dist/app/features/data/data.def.js +194 -0
- package/dist/app/features/data/data.run.d.ts +46 -0
- package/dist/app/features/data/data.run.js +141 -0
- package/dist/app/features/data/index.d.ts +2 -0
- package/dist/app/features/data/index.js +3 -0
- package/dist/app/features/defs.d.ts +959 -4
- package/dist/app/features/defs.js +151 -10
- package/dist/app/features/engine/engine.def.d.ts +228 -0
- package/dist/app/features/engine/engine.def.js +194 -0
- package/dist/app/features/engine/engine.run.d.ts +72 -0
- package/dist/app/features/engine/engine.run.js +77 -0
- package/dist/app/features/engine/index.d.ts +2 -0
- package/dist/app/features/engine/index.js +4 -0
- package/dist/app/features/files/files.def.d.ts +51 -0
- package/dist/app/features/files/files.def.js +38 -0
- package/dist/app/features/files/files.run.d.ts +20 -0
- package/dist/app/features/files/files.run.js +59 -0
- package/dist/app/features/files/index.d.ts +2 -0
- package/dist/app/features/files/index.js +3 -0
- package/dist/app/features/github/github.def.d.ts +80 -0
- package/dist/app/features/github/github.def.js +142 -0
- package/dist/app/features/github/github.run.d.ts +36 -0
- package/dist/app/features/github/github.run.js +59 -0
- package/dist/app/features/github/index.d.ts +2 -0
- package/dist/app/features/github/index.js +3 -0
- package/dist/app/features/health/health.def.d.ts +275 -0
- package/dist/app/features/health/health.def.js +297 -0
- package/dist/app/features/health/health.run.d.ts +125 -0
- package/dist/app/features/health/health.run.js +204 -0
- package/dist/app/features/health/index.d.ts +2 -0
- package/dist/app/features/health/index.js +3 -0
- package/dist/app/features/logs/index.d.ts +2 -0
- package/dist/app/features/logs/index.js +3 -0
- package/dist/app/features/logs/logs.def.d.ts +78 -0
- package/dist/app/features/logs/logs.def.js +115 -0
- package/dist/app/features/logs/logs.run.d.ts +20 -0
- package/dist/app/features/logs/logs.run.js +42 -0
- package/dist/app/features/projects/index.d.ts +2 -0
- package/dist/app/features/projects/index.js +3 -0
- package/dist/app/features/projects/projects.def.d.ts +101 -0
- package/dist/app/features/projects/projects.def.js +208 -0
- package/dist/app/features/projects/projects.run.d.ts +56 -0
- package/dist/app/features/projects/projects.run.js +155 -0
- package/dist/app/features/sandbox/sandbox.def.js +11 -5
- package/dist/app/features/sessions/sessions.def.js +3 -0
- package/dist/app/features/settings/categories.def.js +3 -2
- package/dist/{cli/menu/settings/share.d.ts → app/features/settings/settings-share.d.ts} +1 -1
- package/dist/{cli/menu/settings/share.js → app/features/settings/settings-share.js} +3 -2
- package/dist/app/features/settings/settings.def.d.ts +22 -5
- package/dist/app/features/settings/settings.def.js +81 -6
- package/dist/app/features/settings/settings.run.d.ts +17 -0
- package/dist/app/features/settings/settings.run.js +89 -4
- package/dist/app/features/storage/index.d.ts +2 -0
- package/dist/app/features/storage/index.js +3 -0
- package/dist/app/features/storage/storage.def.d.ts +133 -0
- package/dist/app/features/storage/storage.def.js +220 -0
- package/dist/app/features/storage/storage.run.d.ts +62 -0
- package/dist/app/features/storage/storage.run.js +370 -0
- package/dist/app/features/updates/index.d.ts +3 -0
- package/dist/app/features/updates/index.js +4 -0
- package/dist/app/features/updates/update-lines.d.ts +13 -0
- package/dist/app/features/updates/update-lines.js +61 -0
- package/dist/app/features/updates/updates.def.d.ts +89 -0
- package/dist/app/features/updates/updates.def.js +224 -0
- package/dist/app/features/updates/updates.run.d.ts +48 -0
- package/dist/app/features/updates/updates.run.js +154 -0
- package/dist/app/features/vpn/index.d.ts +2 -0
- package/dist/app/features/vpn/index.js +3 -0
- package/dist/app/features/vpn/vpn.def.d.ts +112 -0
- package/dist/app/features/vpn/vpn.def.js +174 -0
- package/dist/app/features/vpn/vpn.run.d.ts +37 -0
- package/dist/app/features/vpn/vpn.run.js +54 -0
- package/dist/app/features/web/index.d.ts +2 -0
- package/dist/app/features/web/index.js +3 -0
- package/dist/app/features/web/web.def.d.ts +33 -0
- package/dist/app/features/web/web.def.js +90 -0
- package/dist/app/features/web/web.run.d.ts +24 -0
- package/dist/app/features/web/web.run.js +93 -0
- package/dist/app/kernel/define.d.ts +10 -1
- package/dist/app/kernel/io.d.ts +34 -0
- package/dist/app/kernel/io.js +9 -0
- package/dist/app/kernel/rpc.d.ts +17 -0
- package/dist/app/kernel/text.d.ts +2 -0
- package/dist/app/kernel/text.js +7 -0
- package/dist/app/kernel/view.d.ts +24 -1
- package/dist/app/kernel/view.js +1 -1
- package/dist/app/registry.js +74 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/commands/context.d.ts +7 -0
- package/dist/cli/commands/context.js +29 -2
- package/dist/cli/commands/engine.js +5 -58
- package/dist/cli/commands/github.d.ts +2 -0
- package/dist/cli/commands/github.js +11 -0
- package/dist/cli/commands/index.d.ts +3 -5
- package/dist/cli/commands/index.js +3 -5
- package/dist/cli/commands/launch/launch.js +21 -4
- package/dist/cli/commands/launch/running.js +4 -1
- package/dist/cli/commands/maintenance/config.js +1 -6
- package/dist/cli/commands/maintenance/index.d.ts +0 -1
- package/dist/cli/commands/maintenance/index.js +1 -2
- package/dist/cli/commands/maintenance/logs.js +27 -32
- package/dist/cli/commands/maintenance/migrate.d.ts +0 -8
- package/dist/cli/commands/maintenance/migrate.js +2 -44
- package/dist/cli/commands/maintenance/update.d.ts +0 -19
- package/dist/cli/commands/maintenance/update.js +1 -99
- package/dist/cli/commands/projects/index.d.ts +0 -1
- package/dist/cli/commands/projects/index.js +0 -1
- package/dist/cli/commands/registry.d.ts +1 -1
- package/dist/cli/commands/registry.js +29 -11
- package/dist/cli/commands/repair/checks/data.js +1 -1
- package/dist/cli/commands/repair/checks/hcs.js +28 -1
- package/dist/cli/commands/repair/checks/sandbox.js +1 -1
- package/dist/cli/commands/repair/health-run.d.ts +30 -0
- package/dist/cli/commands/repair/health-run.js +32 -0
- package/dist/cli/commands/repair/printer.d.ts +2 -2
- package/dist/cli/commands/repair/printer.js +2 -11
- package/dist/cli/commands/repair/run.d.ts +1 -21
- package/dist/cli/commands/repair/run.js +13 -70
- package/dist/cli/commands/storage/index.d.ts +0 -1
- package/dist/cli/commands/storage/index.js +0 -1
- package/dist/cli/commands/storage/offer.js +6 -2
- package/dist/cli/commands/vpn.d.ts +1 -3
- package/dist/cli/commands/vpn.js +8 -89
- package/dist/cli/commands/web.d.ts +2 -1
- package/dist/cli/commands/web.js +14 -78
- package/dist/cli/index.js +3 -2
- package/dist/cli/manifest.d.ts +16 -153
- package/dist/cli/manifest.js +20 -50
- package/dist/cli/menu/command-form.js +1 -2
- package/dist/cli/menu/io-menu.d.ts +2 -2
- package/dist/cli/menu/io-menu.js +6 -4
- package/dist/cli/menu/menu.js +1 -1
- package/dist/cli/menu/pages/accounts-page.d.ts +5 -17
- package/dist/cli/menu/pages/accounts-page.js +28 -170
- package/dist/cli/menu/pages/agents-page.d.ts +17 -18
- package/dist/cli/menu/pages/agents-page.js +67 -124
- package/dist/cli/menu/pages/apps-page.d.ts +15 -8
- package/dist/cli/menu/pages/apps-page.js +121 -29
- package/dist/cli/menu/pages/list-page.js +10 -1
- package/dist/cli/menu/pages/maintenance-page.d.ts +51 -52
- package/dist/cli/menu/pages/maintenance-page.js +246 -427
- package/dist/cli/menu/pages/sandbox-page.d.ts +3 -5
- package/dist/cli/menu/pages/sandbox-page.js +34 -112
- package/dist/cli/menu/pages/settings-page.d.ts +21 -3
- package/dist/cli/menu/pages/settings-page.js +89 -17
- package/dist/cli/menu/render-view.js +2 -1
- package/dist/cli/menu/settings/index.d.ts +0 -1
- package/dist/cli/menu/settings/index.js +3 -3
- package/dist/cli/menu/views.js +28 -0
- package/dist/cli/operations/handler.js +7 -3
- package/dist/cli/operations/input.d.ts +1 -1
- package/dist/cli/operations/input.js +29 -5
- package/dist/cli/operations/io-cli.js +9 -1
- package/dist/cli/operations/spec.js +8 -2
- package/dist/cli/output/render-view.js +2 -0
- package/dist/cli/{commands/data/collect.js → services/data-collect.js} +2 -2
- package/dist/cli/{commands/data/remove.js → services/data-remove.js} +2 -2
- package/dist/cli/services/data-service.d.ts +1 -1
- package/dist/cli/services/data-service.js +2 -2
- package/dist/cli/services/databases-service.d.ts +5 -0
- package/dist/cli/services/databases-service.js +15 -0
- package/dist/cli/services/health-service.d.ts +8 -4
- package/dist/cli/services/health-service.js +10 -8
- package/dist/cli/services/index.d.ts +4 -1
- package/dist/cli/services/index.js +4 -1
- package/dist/cli/services/logs-service.d.ts +7 -0
- package/dist/cli/services/logs-service.js +13 -0
- package/dist/cli/services/storage-service.d.ts +19 -0
- package/dist/cli/services/storage-service.js +71 -0
- package/dist/cli/services/vpn-service.d.ts +6 -4
- package/dist/cli/services/vpn-service.js +5 -11
- package/dist/cli/services/web-service.d.ts +4 -3
- package/dist/cli/services/web-service.js +12 -32
- package/dist/core/config/defaults.js +2 -1
- package/dist/core/schema/config.d.ts +5 -0
- package/dist/core/schema/config.js +2 -0
- package/dist/core/schema/github.d.ts +4 -0
- package/dist/core/schema/github.js +7 -0
- package/dist/core/schema/index.d.ts +1 -0
- package/dist/core/schema/index.js +1 -0
- package/dist/core/schema/profile.d.ts +1 -0
- package/dist/core/schema/profile.js +3 -0
- package/dist/core/schema/sandbox.js +3 -3
- package/dist/core/schema/toolchains.js +2 -2
- package/dist/core/types.d.ts +6 -3
- package/dist/guest/boot/boot.js +8 -0
- package/dist/guest/daemon/daemon.js +1 -1
- package/dist/guest/daemon/sessions.d.ts +3 -2
- package/dist/guest/daemon/sessions.js +38 -7
- package/dist/guest/governor/core.d.ts +44 -0
- package/dist/guest/governor/core.js +124 -0
- package/dist/guest/governor/decide.d.ts +46 -18
- package/dist/guest/governor/decide.js +136 -82
- package/dist/guest/governor/governor.d.ts +2 -38
- package/dist/guest/governor/governor.js +33 -113
- package/dist/guest/governor/index.d.ts +1 -0
- package/dist/guest/governor/index.js +1 -0
- package/dist/guest/network/firewall.d.ts +2 -0
- package/dist/guest/network/firewall.js +3 -3
- package/dist/guest/sessions/viewer.js +5 -1
- package/dist/guest/setup/github-token.d.ts +7 -0
- package/dist/guest/setup/github-token.js +65 -0
- package/dist/guest/toolchains/languages/node.js +11 -1
- package/dist/guest/toolchains/native/rust-extras.js +2 -2
- package/dist/guest/toolchains/tools/cli.d.ts +8 -0
- package/dist/guest/toolchains/tools/cli.js +35 -2
- package/dist/guest/vpn/openvpn.d.ts +5 -0
- package/dist/guest/vpn/openvpn.js +14 -1
- package/dist/guest/vpn/vpn.js +55 -16
- package/dist/guest/vpn/wireguard.js +2 -0
- package/dist/host/channel/attach.d.ts +1 -0
- package/dist/host/channel/attach.js +1 -0
- package/dist/host/channel/channel.d.ts +1 -1
- package/dist/host/channel/channel.js +2 -2
- package/dist/host/engines/hcs/check.d.ts +1 -0
- package/dist/host/engines/hcs/check.js +1 -1
- package/dist/host/engines/hcs/engine.d.ts +1 -1
- package/dist/host/engines/hcs/engine.js +6 -4
- package/dist/host/engines/hcs/helper.d.ts +11 -0
- package/dist/host/engines/hcs/helper.js +31 -2
- package/dist/host/engines/hcs/leftovers.d.ts +42 -0
- package/dist/host/engines/hcs/leftovers.js +101 -0
- package/dist/host/engines/index.d.ts +1 -0
- package/dist/host/engines/index.js +1 -0
- package/dist/host/github/deliver.d.ts +13 -0
- package/dist/host/github/deliver.js +51 -0
- package/dist/host/github/index.d.ts +2 -0
- package/dist/host/github/index.js +3 -0
- package/dist/host/github/token.d.ts +21 -0
- package/dist/host/github/token.js +74 -0
- package/dist/host/launch/generate.js +11 -5
- package/dist/host/launch/index.d.ts +1 -1
- package/dist/host/launch/index.js +1 -1
- package/dist/host/launch/session-file.js +1 -2
- package/dist/host/launch/wsb-file.d.ts +11 -7
- package/dist/host/launch/wsb-file.js +30 -12
- package/dist/host/life/host-memory.d.ts +18 -0
- package/dist/host/life/host-memory.js +66 -0
- package/dist/host/life/watchdog.d.ts +9 -0
- package/dist/host/life/watchdog.js +17 -1
- package/dist/host/sandbox/tasklist.d.ts +6 -0
- package/dist/host/sandbox/tasklist.js +37 -0
- package/dist/host/secrets/launch-secrets.d.ts +2 -1
- package/dist/host/secrets/launch-secrets.js +4 -2
- package/dist/host/vpn/status.js +13 -3
- package/dist/host/web/backend.d.ts +1 -3
- package/dist/host/web/index.d.ts +2 -1
- package/dist/host/web/index.js +2 -1
- package/dist/host/web/live.d.ts +23 -0
- package/dist/host/web/live.js +107 -0
- package/dist/host/web/rpc.d.ts +6 -1
- package/dist/host/web/rpc.js +23 -31
- package/dist/host/web/runner.d.ts +4 -0
- package/dist/host/web/runner.js +12 -1
- package/dist/host/web/server.d.ts +30 -2
- package/dist/host/web/server.js +87 -29
- package/dist/host/web/state.d.ts +1 -0
- package/dist/host/web/state.js +2 -0
- package/dist/runtime/agent.js +30 -6
- package/dist/runtime/daemon.js +337 -177
- package/dist/runtime/db.js +30 -6
- package/dist/runtime/main.js +389 -77
- package/dist/runtime/netproxy.js +30 -6
- package/dist/runtime/view.js +495 -146
- package/dist/selftest/app.test.js +632 -12
- package/dist/selftest/channel.test.js +18 -1
- package/dist/selftest/cli.test.js +1 -1
- package/dist/selftest/config.test.js +1 -1
- package/dist/selftest/contained.test.js +1 -1
- package/dist/selftest/data.test.js +1 -2
- package/dist/selftest/engine.test.js +3 -1
- package/dist/selftest/github.test.d.ts +2 -0
- package/dist/selftest/github.test.js +243 -0
- package/dist/selftest/hcs.test.js +105 -8
- package/dist/selftest/health.test.js +71 -0
- package/dist/selftest/heavy-load.test.js +132 -72
- package/dist/selftest/index.js +4 -0
- package/dist/selftest/layout.test.js +8 -0
- package/dist/selftest/live-terminal.test.js +74 -0
- package/dist/selftest/menu-screens.js +171 -56
- package/dist/selftest/menu.test.js +54 -37
- package/dist/selftest/migrate.test.js +14 -12
- package/dist/selftest/powershell-variables.test.d.ts +2 -0
- package/dist/selftest/powershell-variables.test.js +61 -0
- package/dist/selftest/support/engine-golden.js +1 -0
- package/dist/selftest/support/fixtures.d.ts +4 -0
- package/dist/selftest/support/web-preview.d.ts +1 -0
- package/dist/selftest/support/web-preview.js +856 -0
- package/dist/selftest/update-service.test.js +15 -8
- package/dist/selftest/vpn.test.js +86 -2
- package/dist/selftest/web.test.js +58 -11
- package/dist/shared/channel/run-dir.d.ts +2 -0
- package/dist/shared/channel/run-dir.js +3 -0
- package/dist/shared/channel/schema.d.ts +7 -0
- package/dist/shared/channel/schema.js +9 -1
- package/dist/shared/channel/secrets.d.ts +1 -0
- package/dist/shared/channel/secrets.js +3 -0
- package/dist/shared/github/index.d.ts +1 -0
- package/dist/shared/github/index.js +2 -0
- package/dist/shared/github/token.d.ts +29 -0
- package/dist/shared/github/token.js +89 -0
- package/dist/shared/memory/policy.d.ts +33 -12
- package/dist/shared/memory/policy.js +50 -19
- package/dist/shared/pty/ctrl-c.d.ts +18 -0
- package/dist/shared/pty/ctrl-c.js +36 -0
- package/dist/shared/pty/index.d.ts +1 -0
- package/dist/shared/pty/index.js +1 -0
- package/dist/shared/pty/terminal.d.ts +2 -0
- package/dist/shared/pty/terminal.js +21 -2
- package/dist/shared/vpn/kill-switch.d.ts +13 -2
- package/dist/shared/vpn/kill-switch.js +88 -8
- package/dist/shared/web/protocol.d.ts +0 -4
- package/dist/sync/watcher.d.ts +2 -0
- package/dist/sync/watcher.js +8 -3
- package/dist/web/index.html +2 -2
- package/dist/web/{main-T5DMCHYV.css → main-MU5XWZMS.css} +1 -1
- package/dist/web/main-SLQNJRXD.js +219 -0
- package/native/csharp/HcsHost/AssemblyInfo.cs +3 -3
- package/native/csharp/HostTools/AssemblyInfo.cs +3 -3
- package/native/csharp/HostTools/MemoryStatus.cs +58 -2
- package/native/csharp/HostTools/Program.cs +7 -1
- package/package.json +10 -3
- package/sandbox/csharp/MemGov.cs +240 -38
- package/sandbox/csharp/PtyHost.cs +104 -15
- package/sandbox/csharp/SandboxTools/CpuCap.cs +50 -1
- package/sandbox/csharp/SandboxTools/Program.cs +1 -1
- package/sandbox/scripts/repair-wmi-services.ps1 +26 -0
- package/schemas/config.schema.json +19 -5
- package/schemas/sandbox-config.schema.json +7 -3
- package/dist/cli/commands/accounts.d.ts +0 -2
- package/dist/cli/commands/accounts.js +0 -96
- package/dist/cli/commands/data/clean.d.ts +0 -3
- package/dist/cli/commands/data/clean.js +0 -60
- package/dist/cli/commands/data/index.d.ts +0 -4
- package/dist/cli/commands/data/index.js +0 -62
- package/dist/cli/commands/maintenance/clean.d.ts +0 -2
- package/dist/cli/commands/maintenance/clean.js +0 -24
- package/dist/cli/commands/maintenance/config-share.d.ts +0 -12
- package/dist/cli/commands/maintenance/config-share.js +0 -80
- package/dist/cli/commands/projects/projects.d.ts +0 -2
- package/dist/cli/commands/projects/projects.js +0 -162
- package/dist/cli/commands/storage/contained.d.ts +0 -3
- package/dist/cli/commands/storage/contained.js +0 -179
- package/dist/cli/commands/storage/storage.d.ts +0 -8
- package/dist/cli/commands/storage/storage.js +0 -179
- package/dist/cli/menu/add-agent.d.ts +0 -47
- package/dist/cli/menu/add-agent.js +0 -168
- package/dist/cli/menu/apps.d.ts +0 -69
- package/dist/cli/menu/apps.js +0 -214
- package/dist/cli/menu/data-folder.d.ts +0 -18
- package/dist/cli/menu/data-folder.js +0 -99
- package/dist/cli/menu/share-settings.d.ts +0 -21
- package/dist/cli/menu/share-settings.js +0 -112
- package/dist/cli/menu/vpn-login.d.ts +0 -16
- package/dist/cli/menu/vpn-login.js +0 -74
- package/dist/web/main-NRRS5O6Z.js +0 -157
- /package/dist/cli/{commands/data/collect.d.ts → services/data-collect.d.ts} +0 -0
- /package/dist/cli/{commands/data/remove.d.ts → services/data-remove.d.ts} +0 -0
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type Page, type Tone } from '../../kernel/index.js';
|
|
3
|
+
export declare const StatusSchema: z.ZodEnum<{
|
|
4
|
+
fixed: "fixed";
|
|
5
|
+
ok: "ok";
|
|
6
|
+
warn: "warn";
|
|
7
|
+
"needs-you": "needs-you";
|
|
8
|
+
skipped: "skipped";
|
|
9
|
+
}>;
|
|
10
|
+
export declare const CheckRowSchema: z.ZodObject<{
|
|
11
|
+
id: z.ZodString;
|
|
12
|
+
group: z.ZodString;
|
|
13
|
+
name: z.ZodString;
|
|
14
|
+
status: z.ZodEnum<{
|
|
15
|
+
fixed: "fixed";
|
|
16
|
+
ok: "ok";
|
|
17
|
+
warn: "warn";
|
|
18
|
+
"needs-you": "needs-you";
|
|
19
|
+
skipped: "skipped";
|
|
20
|
+
}>;
|
|
21
|
+
detail: z.ZodString;
|
|
22
|
+
means: z.ZodOptional<z.ZodString>;
|
|
23
|
+
fix: z.ZodOptional<z.ZodString>;
|
|
24
|
+
plan: z.ZodOptional<z.ZodString>;
|
|
25
|
+
lines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
26
|
+
fixable: z.ZodBoolean;
|
|
27
|
+
timedOut: z.ZodOptional<z.ZodBoolean>;
|
|
28
|
+
applied: z.ZodOptional<z.ZodObject<{
|
|
29
|
+
done: z.ZodString;
|
|
30
|
+
before: z.ZodString;
|
|
31
|
+
after: z.ZodString;
|
|
32
|
+
}, z.core.$strip>>;
|
|
33
|
+
error: z.ZodOptional<z.ZodString>;
|
|
34
|
+
}, z.core.$strip>;
|
|
35
|
+
export type CheckRow = z.output<typeof CheckRowSchema>;
|
|
36
|
+
export declare const SummarySchema: z.ZodObject<{
|
|
37
|
+
total: z.ZodNumber;
|
|
38
|
+
ok: z.ZodNumber;
|
|
39
|
+
fixed: z.ZodNumber;
|
|
40
|
+
warn: z.ZodNumber;
|
|
41
|
+
needsYou: z.ZodNumber;
|
|
42
|
+
skipped: z.ZodNumber;
|
|
43
|
+
fixable: z.ZodNumber;
|
|
44
|
+
}, z.core.$strip>;
|
|
45
|
+
export type HealthSummary = z.output<typeof SummarySchema>;
|
|
46
|
+
export declare const SetupRowSchema: z.ZodObject<{
|
|
47
|
+
name: z.ZodString;
|
|
48
|
+
status: z.ZodEnum<{
|
|
49
|
+
ok: "ok";
|
|
50
|
+
warn: "warn";
|
|
51
|
+
action: "action";
|
|
52
|
+
}>;
|
|
53
|
+
detail: z.ZodString;
|
|
54
|
+
}, z.core.$strip>;
|
|
55
|
+
export declare const HealthLastSchema: z.ZodObject<{
|
|
56
|
+
at: z.ZodString;
|
|
57
|
+
mode: z.ZodEnum<{
|
|
58
|
+
check: "check";
|
|
59
|
+
repair: "repair";
|
|
60
|
+
}>;
|
|
61
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
62
|
+
id: z.ZodString;
|
|
63
|
+
group: z.ZodString;
|
|
64
|
+
name: z.ZodString;
|
|
65
|
+
status: z.ZodEnum<{
|
|
66
|
+
fixed: "fixed";
|
|
67
|
+
ok: "ok";
|
|
68
|
+
warn: "warn";
|
|
69
|
+
"needs-you": "needs-you";
|
|
70
|
+
skipped: "skipped";
|
|
71
|
+
}>;
|
|
72
|
+
detail: z.ZodString;
|
|
73
|
+
means: z.ZodOptional<z.ZodString>;
|
|
74
|
+
fix: z.ZodOptional<z.ZodString>;
|
|
75
|
+
plan: z.ZodOptional<z.ZodString>;
|
|
76
|
+
lines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
77
|
+
fixable: z.ZodBoolean;
|
|
78
|
+
timedOut: z.ZodOptional<z.ZodBoolean>;
|
|
79
|
+
applied: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
done: z.ZodString;
|
|
81
|
+
before: z.ZodString;
|
|
82
|
+
after: z.ZodString;
|
|
83
|
+
}, z.core.$strip>>;
|
|
84
|
+
error: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>>;
|
|
86
|
+
summary: z.ZodObject<{
|
|
87
|
+
total: z.ZodNumber;
|
|
88
|
+
ok: z.ZodNumber;
|
|
89
|
+
fixed: z.ZodNumber;
|
|
90
|
+
warn: z.ZodNumber;
|
|
91
|
+
needsYou: z.ZodNumber;
|
|
92
|
+
skipped: z.ZodNumber;
|
|
93
|
+
fixable: z.ZodNumber;
|
|
94
|
+
}, z.core.$strip>;
|
|
95
|
+
details: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
|
|
96
|
+
setup: z.ZodNullable<z.ZodObject<{
|
|
97
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
98
|
+
name: z.ZodString;
|
|
99
|
+
status: z.ZodEnum<{
|
|
100
|
+
ok: "ok";
|
|
101
|
+
warn: "warn";
|
|
102
|
+
action: "action";
|
|
103
|
+
}>;
|
|
104
|
+
detail: z.ZodString;
|
|
105
|
+
}, z.core.$strip>>;
|
|
106
|
+
canEnable: z.ZodBoolean;
|
|
107
|
+
error: z.ZodNullable<z.ZodString>;
|
|
108
|
+
}, z.core.$strip>>;
|
|
109
|
+
log: z.ZodNullable<z.ZodString>;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
export type HealthLast = z.output<typeof HealthLastSchema>;
|
|
112
|
+
/** "6 ok, 1 fixed, 1 needs you, 1 warning": the parts that are zero are left out (except ok). */
|
|
113
|
+
export declare function summaryText(s: HealthSummary): string;
|
|
114
|
+
export interface ResultLine {
|
|
115
|
+
readonly text: string;
|
|
116
|
+
readonly tone?: Tone;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* The lines of one result as the plain printer writes them (HealthPrinter.result with animate off), without the group
|
|
120
|
+
* heading. The tone paints the first line only.
|
|
121
|
+
*/
|
|
122
|
+
export declare function resultLines(r: CheckRow): ResultLine[];
|
|
123
|
+
export declare const lastHealth: import("../../kernel/define.js").QueryDef<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
124
|
+
last: z.ZodNullable<z.ZodObject<{
|
|
125
|
+
at: z.ZodString;
|
|
126
|
+
mode: z.ZodEnum<{
|
|
127
|
+
check: "check";
|
|
128
|
+
repair: "repair";
|
|
129
|
+
}>;
|
|
130
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
131
|
+
id: z.ZodString;
|
|
132
|
+
group: z.ZodString;
|
|
133
|
+
name: z.ZodString;
|
|
134
|
+
status: z.ZodEnum<{
|
|
135
|
+
fixed: "fixed";
|
|
136
|
+
ok: "ok";
|
|
137
|
+
warn: "warn";
|
|
138
|
+
"needs-you": "needs-you";
|
|
139
|
+
skipped: "skipped";
|
|
140
|
+
}>;
|
|
141
|
+
detail: z.ZodString;
|
|
142
|
+
means: z.ZodOptional<z.ZodString>;
|
|
143
|
+
fix: z.ZodOptional<z.ZodString>;
|
|
144
|
+
plan: z.ZodOptional<z.ZodString>;
|
|
145
|
+
lines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
146
|
+
fixable: z.ZodBoolean;
|
|
147
|
+
timedOut: z.ZodOptional<z.ZodBoolean>;
|
|
148
|
+
applied: z.ZodOptional<z.ZodObject<{
|
|
149
|
+
done: z.ZodString;
|
|
150
|
+
before: z.ZodString;
|
|
151
|
+
after: z.ZodString;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
error: z.ZodOptional<z.ZodString>;
|
|
154
|
+
}, z.core.$strip>>;
|
|
155
|
+
summary: z.ZodObject<{
|
|
156
|
+
total: z.ZodNumber;
|
|
157
|
+
ok: z.ZodNumber;
|
|
158
|
+
fixed: z.ZodNumber;
|
|
159
|
+
warn: z.ZodNumber;
|
|
160
|
+
needsYou: z.ZodNumber;
|
|
161
|
+
skipped: z.ZodNumber;
|
|
162
|
+
fixable: z.ZodNumber;
|
|
163
|
+
}, z.core.$strip>;
|
|
164
|
+
details: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
|
|
165
|
+
setup: z.ZodNullable<z.ZodObject<{
|
|
166
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
167
|
+
name: z.ZodString;
|
|
168
|
+
status: z.ZodEnum<{
|
|
169
|
+
ok: "ok";
|
|
170
|
+
warn: "warn";
|
|
171
|
+
action: "action";
|
|
172
|
+
}>;
|
|
173
|
+
detail: z.ZodString;
|
|
174
|
+
}, z.core.$strip>>;
|
|
175
|
+
canEnable: z.ZodBoolean;
|
|
176
|
+
error: z.ZodNullable<z.ZodString>;
|
|
177
|
+
}, z.core.$strip>>;
|
|
178
|
+
log: z.ZodNullable<z.ZodString>;
|
|
179
|
+
}, z.core.$strip>>;
|
|
180
|
+
}, z.core.$strip>, "health.last">;
|
|
181
|
+
export declare const checkHealth: import("../../kernel/define.js").OperationDef<z.ZodObject<{
|
|
182
|
+
harness: z.ZodOptional<z.ZodString>;
|
|
183
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
184
|
+
summary: z.ZodObject<{
|
|
185
|
+
total: z.ZodNumber;
|
|
186
|
+
ok: z.ZodNumber;
|
|
187
|
+
fixed: z.ZodNumber;
|
|
188
|
+
warn: z.ZodNumber;
|
|
189
|
+
needsYou: z.ZodNumber;
|
|
190
|
+
skipped: z.ZodNumber;
|
|
191
|
+
fixable: z.ZodNumber;
|
|
192
|
+
}, z.core.$strip>;
|
|
193
|
+
changed: z.ZodBoolean;
|
|
194
|
+
log: z.ZodNullable<z.ZodString>;
|
|
195
|
+
}, z.core.$strip>, "health.check">;
|
|
196
|
+
export declare const repairHealth: import("../../kernel/define.js").OperationDef<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
197
|
+
summary: z.ZodObject<{
|
|
198
|
+
total: z.ZodNumber;
|
|
199
|
+
ok: z.ZodNumber;
|
|
200
|
+
fixed: z.ZodNumber;
|
|
201
|
+
warn: z.ZodNumber;
|
|
202
|
+
needsYou: z.ZodNumber;
|
|
203
|
+
skipped: z.ZodNumber;
|
|
204
|
+
fixable: z.ZodNumber;
|
|
205
|
+
}, z.core.$strip>;
|
|
206
|
+
changed: z.ZodBoolean;
|
|
207
|
+
log: z.ZodNullable<z.ZodString>;
|
|
208
|
+
}, z.core.$strip>, "health.repair">;
|
|
209
|
+
export declare const enableSandbox: import("../../kernel/define.js").OperationDef<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
210
|
+
message: z.ZodString;
|
|
211
|
+
}, z.core.$strip>, "health.enableSandbox">;
|
|
212
|
+
/** The health page: before any check, the two things to do; after one, what it found. Pure. */
|
|
213
|
+
export declare function healthPage(o: {
|
|
214
|
+
last: HealthLast | null;
|
|
215
|
+
}): Page;
|
|
216
|
+
export declare const healthView: import("../../kernel/define.js").ViewDef<{
|
|
217
|
+
last: import("../../kernel/define.js").QueryDef<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
|
|
218
|
+
last: z.ZodNullable<z.ZodObject<{
|
|
219
|
+
at: z.ZodString;
|
|
220
|
+
mode: z.ZodEnum<{
|
|
221
|
+
check: "check";
|
|
222
|
+
repair: "repair";
|
|
223
|
+
}>;
|
|
224
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
225
|
+
id: z.ZodString;
|
|
226
|
+
group: z.ZodString;
|
|
227
|
+
name: z.ZodString;
|
|
228
|
+
status: z.ZodEnum<{
|
|
229
|
+
fixed: "fixed";
|
|
230
|
+
ok: "ok";
|
|
231
|
+
warn: "warn";
|
|
232
|
+
"needs-you": "needs-you";
|
|
233
|
+
skipped: "skipped";
|
|
234
|
+
}>;
|
|
235
|
+
detail: z.ZodString;
|
|
236
|
+
means: z.ZodOptional<z.ZodString>;
|
|
237
|
+
fix: z.ZodOptional<z.ZodString>;
|
|
238
|
+
plan: z.ZodOptional<z.ZodString>;
|
|
239
|
+
lines: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
240
|
+
fixable: z.ZodBoolean;
|
|
241
|
+
timedOut: z.ZodOptional<z.ZodBoolean>;
|
|
242
|
+
applied: z.ZodOptional<z.ZodObject<{
|
|
243
|
+
done: z.ZodString;
|
|
244
|
+
before: z.ZodString;
|
|
245
|
+
after: z.ZodString;
|
|
246
|
+
}, z.core.$strip>>;
|
|
247
|
+
error: z.ZodOptional<z.ZodString>;
|
|
248
|
+
}, z.core.$strip>>;
|
|
249
|
+
summary: z.ZodObject<{
|
|
250
|
+
total: z.ZodNumber;
|
|
251
|
+
ok: z.ZodNumber;
|
|
252
|
+
fixed: z.ZodNumber;
|
|
253
|
+
warn: z.ZodNumber;
|
|
254
|
+
needsYou: z.ZodNumber;
|
|
255
|
+
skipped: z.ZodNumber;
|
|
256
|
+
fixable: z.ZodNumber;
|
|
257
|
+
}, z.core.$strip>;
|
|
258
|
+
details: z.ZodArray<z.ZodTuple<[z.ZodString, z.ZodString], null>>;
|
|
259
|
+
setup: z.ZodNullable<z.ZodObject<{
|
|
260
|
+
checks: z.ZodArray<z.ZodObject<{
|
|
261
|
+
name: z.ZodString;
|
|
262
|
+
status: z.ZodEnum<{
|
|
263
|
+
ok: "ok";
|
|
264
|
+
warn: "warn";
|
|
265
|
+
action: "action";
|
|
266
|
+
}>;
|
|
267
|
+
detail: z.ZodString;
|
|
268
|
+
}, z.core.$strip>>;
|
|
269
|
+
canEnable: z.ZodBoolean;
|
|
270
|
+
error: z.ZodNullable<z.ZodString>;
|
|
271
|
+
}, z.core.$strip>>;
|
|
272
|
+
log: z.ZodNullable<z.ZodString>;
|
|
273
|
+
}, z.core.$strip>>;
|
|
274
|
+
}, z.core.$strip>, "health.last">;
|
|
275
|
+
}, Record<string, never>, "health">;
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
// The health of this PC and the sandbox: the last check or repair (saved), checking, repairing, and turning Windows
|
|
2
|
+
// Sandbox on. Pure: schemas, the line format the surfaces print, and the view. The checks and the saving are in
|
|
3
|
+
// health.run.ts (Node side).
|
|
4
|
+
import { z } from 'zod';
|
|
5
|
+
import { action, ago, defineOperation, defineQuery, defineView, } from '../../kernel/index.js';
|
|
6
|
+
const CLI_DOCTOR = 'sandbox doctor and sandbox repair are hand-written renderers of this run (lines redrawn in place, --json alone, repair before the settings load)';
|
|
7
|
+
export const StatusSchema = z.enum(['ok', 'fixed', 'needs-you', 'warn', 'skipped']).describe('What the check found');
|
|
8
|
+
export const CheckRowSchema = z.object({
|
|
9
|
+
id: z.string().describe('The check'),
|
|
10
|
+
group: z.string().describe('Its heading (This PC, Install ...)'),
|
|
11
|
+
name: z.string().describe('What was checked'),
|
|
12
|
+
status: StatusSchema,
|
|
13
|
+
detail: z.string().describe('What was found'),
|
|
14
|
+
means: z.string().optional().describe('What it means for you'),
|
|
15
|
+
fix: z.string().optional().describe('What to do yourself'),
|
|
16
|
+
plan: z.string().optional().describe('What repair would change'),
|
|
17
|
+
lines: z.array(z.string()).optional().describe('More lines (a diff, folders)'),
|
|
18
|
+
fixable: z.boolean().describe('Repair can mend it'),
|
|
19
|
+
timedOut: z.boolean().optional().describe('It took too long'),
|
|
20
|
+
applied: z
|
|
21
|
+
.object({ done: z.string(), before: z.string(), after: z.string() })
|
|
22
|
+
.optional()
|
|
23
|
+
.describe('What a fix changed'),
|
|
24
|
+
error: z.string().optional().describe('Why a fix did not work'),
|
|
25
|
+
});
|
|
26
|
+
export const SummarySchema = z
|
|
27
|
+
.object({
|
|
28
|
+
total: z.number().describe('Checks that ran'),
|
|
29
|
+
ok: z.number().describe('Checks that are fine'),
|
|
30
|
+
fixed: z.number().describe('Problems repair fixed'),
|
|
31
|
+
warn: z.number().describe('Warnings'),
|
|
32
|
+
needsYou: z.number().describe('Problems you need to fix'),
|
|
33
|
+
skipped: z.number().describe('Checks that did not run'),
|
|
34
|
+
fixable: z.number().describe('Problems repair can still mend'),
|
|
35
|
+
})
|
|
36
|
+
.describe('How many checks ended how');
|
|
37
|
+
export const SetupRowSchema = z.object({
|
|
38
|
+
name: z.string().describe('What was looked at'),
|
|
39
|
+
status: z.enum(['ok', 'warn', 'action']).describe('OK, a warning, or something to do'),
|
|
40
|
+
detail: z.string().describe('What was found'),
|
|
41
|
+
});
|
|
42
|
+
export const HealthLastSchema = z.object({
|
|
43
|
+
at: z.string().describe('When it ran (ISO time)'),
|
|
44
|
+
mode: z.enum(['check', 'repair']).describe('A check or a repair'),
|
|
45
|
+
checks: z.array(CheckRowSchema).describe('The results'),
|
|
46
|
+
summary: SummarySchema,
|
|
47
|
+
details: z.array(z.tuple([z.string(), z.string()])).describe('The doctor details: name and value'),
|
|
48
|
+
setup: z
|
|
49
|
+
.object({
|
|
50
|
+
checks: z.array(SetupRowSchema),
|
|
51
|
+
canEnable: z.boolean().describe('Windows Sandbox can be turned on from here'),
|
|
52
|
+
error: z.string().nullable().describe('Why the setup could not be read'),
|
|
53
|
+
})
|
|
54
|
+
.nullable()
|
|
55
|
+
.describe('What sandbox setup found'),
|
|
56
|
+
log: z.string().nullable().describe('The repair log, if one was written'),
|
|
57
|
+
});
|
|
58
|
+
/** "6 ok, 1 fixed, 1 needs you, 1 warning": the parts that are zero are left out (except ok). */
|
|
59
|
+
export function summaryText(s) {
|
|
60
|
+
const parts = [
|
|
61
|
+
s.ok + ' ok',
|
|
62
|
+
s.fixed && s.fixed + ' fixed',
|
|
63
|
+
s.needsYou && s.needsYou + ' ' + (s.needsYou === 1 ? 'needs' : 'need') + ' you',
|
|
64
|
+
s.warn && s.warn + (s.warn === 1 ? ' warning' : ' warnings'),
|
|
65
|
+
s.skipped && s.skipped + ' skipped',
|
|
66
|
+
];
|
|
67
|
+
return parts.filter(Boolean).join(', ');
|
|
68
|
+
}
|
|
69
|
+
const MARK = {
|
|
70
|
+
ok: '[ok]',
|
|
71
|
+
fixed: '[fixed]',
|
|
72
|
+
warn: '[!]',
|
|
73
|
+
'needs-you': '[x]',
|
|
74
|
+
skipped: '[-]',
|
|
75
|
+
};
|
|
76
|
+
const TONE = {
|
|
77
|
+
ok: undefined,
|
|
78
|
+
fixed: 'accent',
|
|
79
|
+
warn: 'warn',
|
|
80
|
+
'needs-you': 'danger',
|
|
81
|
+
skipped: 'muted',
|
|
82
|
+
};
|
|
83
|
+
const MAX_LINES = 6;
|
|
84
|
+
/**
|
|
85
|
+
* The lines of one result as the plain printer writes them (HealthPrinter.result with animate off), without the group
|
|
86
|
+
* heading. The tone paints the first line only.
|
|
87
|
+
*/
|
|
88
|
+
export function resultLines(r) {
|
|
89
|
+
const first = {
|
|
90
|
+
text: ' ' + MARK[r.status] + ' ' + r.name + ': ' + r.detail + (r.timedOut ? ' (took too long)' : ''),
|
|
91
|
+
...(TONE[r.status] ? { tone: TONE[r.status] } : {}),
|
|
92
|
+
};
|
|
93
|
+
if (r.status === 'ok')
|
|
94
|
+
return [first];
|
|
95
|
+
const out = [first];
|
|
96
|
+
if (r.means)
|
|
97
|
+
out.push({ text: ' What it means: ' + r.means });
|
|
98
|
+
if (r.fixable && r.plan)
|
|
99
|
+
out.push({ text: ' Fix: sandbox repair will ' + r.plan });
|
|
100
|
+
else if (r.fix)
|
|
101
|
+
out.push({ text: ' Fix: ' + r.fix });
|
|
102
|
+
const lines = r.lines ?? [];
|
|
103
|
+
for (const line of lines.slice(0, MAX_LINES))
|
|
104
|
+
out.push({ text: ' ' + line });
|
|
105
|
+
if (lines.length > MAX_LINES)
|
|
106
|
+
out.push({ text: ' ... and ' + (lines.length - MAX_LINES) + ' more' });
|
|
107
|
+
return out;
|
|
108
|
+
}
|
|
109
|
+
const BADGE = {
|
|
110
|
+
ok: 'OK',
|
|
111
|
+
fixed: 'FIXED',
|
|
112
|
+
'needs-you': 'NEEDS YOU',
|
|
113
|
+
warn: 'WARNING',
|
|
114
|
+
skipped: 'SKIPPED',
|
|
115
|
+
};
|
|
116
|
+
function cut(text, max) {
|
|
117
|
+
return text.length <= max ? text : text.slice(0, max - 1) + '…';
|
|
118
|
+
}
|
|
119
|
+
const OutcomeSchema = z.object({
|
|
120
|
+
summary: SummarySchema,
|
|
121
|
+
changed: z.boolean().describe('Fixes were applied'),
|
|
122
|
+
log: z.string().nullable().describe('The repair log, if one was written'),
|
|
123
|
+
});
|
|
124
|
+
export const lastHealth = defineQuery({
|
|
125
|
+
id: 'health.last',
|
|
126
|
+
title: 'Health',
|
|
127
|
+
summary: 'the last check or repair of this PC and the sandbox',
|
|
128
|
+
input: z.object({}),
|
|
129
|
+
output: z.object({ last: HealthLastSchema.nullable().describe('Nothing yet: no check has run') }),
|
|
130
|
+
surfaces: { except: { cli: 'the command line prints results as it checks (sandbox doctor)' } },
|
|
131
|
+
});
|
|
132
|
+
export const checkHealth = defineOperation({
|
|
133
|
+
id: 'health.check',
|
|
134
|
+
title: 'Check this PC',
|
|
135
|
+
summary: 'check this PC, the install, your settings and the sandbox (changes nothing)',
|
|
136
|
+
input: z.object({ harness: z.string().optional().describe('agent to check') }),
|
|
137
|
+
output: OutcomeSchema,
|
|
138
|
+
text: (o) => 'Summary: ' + summaryText(o.summary),
|
|
139
|
+
surfaces: { except: { cli: CLI_DOCTOR } },
|
|
140
|
+
});
|
|
141
|
+
export const repairHealth = defineOperation({
|
|
142
|
+
id: 'health.repair',
|
|
143
|
+
title: 'Run the checks and fix what can be fixed',
|
|
144
|
+
summary: 'find and fix problems (install, data folder, settings, stale state, half-installed tools)',
|
|
145
|
+
input: z.object({}),
|
|
146
|
+
output: OutcomeSchema,
|
|
147
|
+
danger: true,
|
|
148
|
+
text: (o) => 'Summary: ' +
|
|
149
|
+
summaryText(o.summary) +
|
|
150
|
+
(o.log ? '. Log: ' + o.log : '. No log was written (the storage folder does not exist yet).'),
|
|
151
|
+
surfaces: { except: { cli: CLI_DOCTOR } },
|
|
152
|
+
});
|
|
153
|
+
export const enableSandbox = defineOperation({
|
|
154
|
+
id: 'health.enableSandbox',
|
|
155
|
+
title: 'Turn on Windows Sandbox',
|
|
156
|
+
summary: 'turn on the Windows Sandbox feature (Windows asks for admin permission; restart to finish)',
|
|
157
|
+
input: z.object({}),
|
|
158
|
+
output: z.object({ message: z.string().describe('What happened') }),
|
|
159
|
+
danger: true,
|
|
160
|
+
text: (o) => o.message,
|
|
161
|
+
surfaces: {
|
|
162
|
+
except: {
|
|
163
|
+
cli: 'sandbox setup asks and turns it on (hand-written: it also offers to restart Windows)',
|
|
164
|
+
web: 'Windows asks for admin permission on this PC; use the menu or sandbox setup',
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
});
|
|
168
|
+
/** A repair row: what it means is the description; what was found and the fix are the detail lines. */
|
|
169
|
+
function checkItems(last) {
|
|
170
|
+
return last.checks.map((r, i) => {
|
|
171
|
+
const found = r.detail + (r.timedOut ? ' (took too long)' : '');
|
|
172
|
+
const rest = resultLines(r)
|
|
173
|
+
.slice(1)
|
|
174
|
+
.map((l) => l.text.trim())
|
|
175
|
+
.filter((l) => !l.startsWith('What it means: '));
|
|
176
|
+
const details = r.means ? [found, ...rest] : rest;
|
|
177
|
+
return {
|
|
178
|
+
id: 'repair:' + i,
|
|
179
|
+
label: r.name,
|
|
180
|
+
hint: BADGE[r.status],
|
|
181
|
+
...(TONE[r.status] ? { tone: TONE[r.status] } : {}),
|
|
182
|
+
badges: [{ text: BADGE[r.status], ...(TONE[r.status] ? { tone: TONE[r.status] } : {}) }],
|
|
183
|
+
description: r.means ?? found,
|
|
184
|
+
...(details.length ? { details } : {}),
|
|
185
|
+
};
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/** A "Set up this PC" row: the real value is the hint; OK or action needed is the tone and the badge. */
|
|
189
|
+
const SETUP_BADGE = {
|
|
190
|
+
ok: 'OK',
|
|
191
|
+
warn: 'WARNING',
|
|
192
|
+
action: 'NEEDS YOU',
|
|
193
|
+
};
|
|
194
|
+
/** The health page: before any check, the two things to do; after one, what it found. Pure. */
|
|
195
|
+
export function healthPage(o) {
|
|
196
|
+
const last = o.last;
|
|
197
|
+
const check = action(checkHealth, {}, { verb: 'check' });
|
|
198
|
+
const repair = action(repairHealth, {}, { verb: 'check and fix' });
|
|
199
|
+
if (!last) {
|
|
200
|
+
return {
|
|
201
|
+
title: 'Health',
|
|
202
|
+
sections: [
|
|
203
|
+
{
|
|
204
|
+
id: 'doctor',
|
|
205
|
+
title: 'Doctor',
|
|
206
|
+
cards: true,
|
|
207
|
+
items: [
|
|
208
|
+
{
|
|
209
|
+
id: 'health:check',
|
|
210
|
+
label: 'Check this PC',
|
|
211
|
+
description: 'Looks at this PC: Windows features, the install, the folders and the sandbox. It takes a few seconds, so it only runs when you ask.',
|
|
212
|
+
primary: check,
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
},
|
|
216
|
+
{
|
|
217
|
+
id: 'repair',
|
|
218
|
+
title: 'Repair',
|
|
219
|
+
cards: true,
|
|
220
|
+
items: [
|
|
221
|
+
{
|
|
222
|
+
id: 'repair:run',
|
|
223
|
+
label: 'Run the checks and fix what can be fixed',
|
|
224
|
+
description: 'Checks the install, data folder, settings and sandbox, lists what it would change, and asks before it fixes anything.',
|
|
225
|
+
primary: repair,
|
|
226
|
+
},
|
|
227
|
+
],
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
const canEnable = Boolean(last.setup?.canEnable);
|
|
233
|
+
const sections = [
|
|
234
|
+
{
|
|
235
|
+
id: 'status',
|
|
236
|
+
summary: (last.mode === 'repair' ? 'Last repair ' : 'Last check ') + ago(last.at),
|
|
237
|
+
...(last.log ? { notes: [{ text: 'Log: ' + last.log, tone: 'muted' }] } : {}),
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
id: 'doctor',
|
|
241
|
+
title: 'Doctor',
|
|
242
|
+
items: last.details.map(([name, detail], i) => ({
|
|
243
|
+
id: 'doctor:' + i,
|
|
244
|
+
label: name,
|
|
245
|
+
// The hint is the whole value; only a long one is cut, and then the description keeps all of it.
|
|
246
|
+
hint: cut(detail, 50),
|
|
247
|
+
...(detail.length > 50 ? { description: detail } : {}),
|
|
248
|
+
})),
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
id: 'repair',
|
|
252
|
+
title: 'Repair',
|
|
253
|
+
items: checkItems(last),
|
|
254
|
+
},
|
|
255
|
+
];
|
|
256
|
+
if (last.setup) {
|
|
257
|
+
const setup = last.setup;
|
|
258
|
+
sections.push({
|
|
259
|
+
id: 'setup',
|
|
260
|
+
title: 'Set up this PC',
|
|
261
|
+
items: setup.error
|
|
262
|
+
? [{ id: 'setup:error', label: setup.error }]
|
|
263
|
+
: setup.checks.map((c, i) => ({
|
|
264
|
+
id: 'setup:' + i,
|
|
265
|
+
label: c.name,
|
|
266
|
+
hint: c.detail,
|
|
267
|
+
tone: c.status === 'ok' ? 'ok' : c.status === 'warn' ? 'warn' : 'danger',
|
|
268
|
+
badges: [
|
|
269
|
+
{
|
|
270
|
+
text: SETUP_BADGE[c.status],
|
|
271
|
+
tone: c.status === 'ok' ? 'ok' : c.status === 'warn' ? 'warn' : 'danger',
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
})),
|
|
275
|
+
notes: canEnable
|
|
276
|
+
? [{ text: 'Turn Windows Sandbox on from the menu or with sandbox setup.', tone: 'muted', only: 'web' }]
|
|
277
|
+
: [],
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
return {
|
|
281
|
+
title: 'Health',
|
|
282
|
+
sections,
|
|
283
|
+
actions: [
|
|
284
|
+
action(repairHealth, {}, { key: 'f', verb: 'check and fix', importance: 1 }),
|
|
285
|
+
action(checkHealth, {}, { key: 'l', verb: last ? 'check again' : 'check', importance: 2 }),
|
|
286
|
+
...(canEnable ? [action(enableSandbox, {}, { key: 'e', verb: 'turn on Windows Sandbox', importance: 3 })] : []),
|
|
287
|
+
],
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
export const healthView = defineView({
|
|
291
|
+
id: 'health',
|
|
292
|
+
title: 'Health',
|
|
293
|
+
summary: 'Checks this PC and your settings, repairs problems, and sets up Windows Sandbox.',
|
|
294
|
+
queries: { last: lastHealth },
|
|
295
|
+
operations: [checkHealth, repairHealth, enableSandbox],
|
|
296
|
+
build: ({ last }) => healthPage(last),
|
|
297
|
+
});
|