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
package/dist/runtime/daemon.js
CHANGED
|
@@ -25437,6 +25437,9 @@ var AttachSchema = external_exports.strictObject({
|
|
|
25437
25437
|
),
|
|
25438
25438
|
autoHide: external_exports.boolean().describe(
|
|
25439
25439
|
"Hide the Windows Sandbox window whenever this terminal attaches; it keeps running (sandbox show brings it back)."
|
|
25440
|
+
),
|
|
25441
|
+
confirmCtrlC: external_exports.boolean().describe(
|
|
25442
|
+
'In an attached terminal and the sandbox window, a single Ctrl+C is held back (the title says so) and only a second one within 1.5 seconds reaches the agent: a Ctrl+C meant as "copy" no longer stops it. Esc still stops an agent.'
|
|
25440
25443
|
)
|
|
25441
25444
|
});
|
|
25442
25445
|
var AgentCommandsSchema = external_exports.strictObject({
|
|
@@ -25481,7 +25484,9 @@ var SandboxSchema = external_exports.strictObject({
|
|
|
25481
25484
|
engine: external_exports.enum(["windows-sandbox", "hcs"]).describe(
|
|
25482
25485
|
'(alpha) What runs the sandbox. "windows-sandbox" = Windows Sandbox (the default: desktop, Windows Terminal, GPU, clipboard, audio, printers). "hcs" = a headless Hyper-V isolated Server Core container for agents (no desktop, GPU or clipboard); it needs Windows features and an image on this PC (sandbox engine check hcs lists what is missing), and starting it is not enabled yet in this alpha. sandbox engine shows what each engine can do. Yours only: a project file (.sandbox-config.json) cannot set it.'
|
|
25483
25486
|
),
|
|
25484
|
-
memoryMb: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(2048)]).describe(
|
|
25487
|
+
memoryMb: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(2048)]).describe(
|
|
25488
|
+
'Sandbox RAM in MB (>= 2048), or "auto": free RAM minus reserveHostMb, capped at maxMemoryMb. Never more than this PC can keep in RAM for it (its RAM minus the larger of reserveHostMb and 25 %, 2 GB more with vGPU): a bigger value is lowered.'
|
|
25489
|
+
),
|
|
25485
25490
|
maxMemoryMb: external_exports.number().int().positive().describe('Upper limit for memoryMb "auto".'),
|
|
25486
25491
|
maxMemoryPercent: external_exports.number().int().min(10).max(100).describe(`memoryMb "auto" never takes more than this share of this PC's total RAM (percent).`),
|
|
25487
25492
|
cpuLimit: external_exports.union([external_exports.literal("none"), external_exports.number().int().min(5).max(100)]).describe(
|
|
@@ -25494,10 +25499,10 @@ var SandboxSchema = external_exports.strictObject({
|
|
|
25494
25499
|
'Memory always left for this PC when memoryMb is "auto": the sandbox gets at most (free RAM, and RAM plus paging file still unused) minus this.'
|
|
25495
25500
|
),
|
|
25496
25501
|
agentMemoryHeadroomMb: external_exports.union([external_exports.literal("auto"), external_exports.literal("none"), external_exports.number().int().min(0)]).describe(
|
|
25497
|
-
'
|
|
25502
|
+
'The last resort that keeps the sandbox up, in MB below its commit limit (RAM plus paging file): builds are slowed down long before (sandbox.pressureResponse); only if everything the agents start together would take the sandbox to the very edge of its memory, where Windows inside it would start failing, is a build refused memory instead of Windows. "auto" = the larger of 1536 MB and 3 % of the commit limit; "none" = no backstop. Yours only: a project file cannot change it.'
|
|
25498
25503
|
),
|
|
25499
25504
|
pressureResponse: external_exports.boolean().describe(
|
|
25500
|
-
"When the sandbox (or this PC) runs low on memory, slow
|
|
25505
|
+
"When the sandbox (or this PC) runs low on memory, slow builds down in steps, like a PC that gets slower instead of failing: build programs get lower CPU and memory priority, then less CPU, then compilers take turns (the waiting ones briefly suspended and trimmed to the paging file). Nothing is stopped or killed, and the agents themselves are never touched. Yours only: a project file cannot change it."
|
|
25501
25506
|
),
|
|
25502
25507
|
vGpu: external_exports.boolean().describe(
|
|
25503
25508
|
"Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface. The sandbox then uses this PC's graphics card, and with some graphics drivers heavy use can freeze the whole PC: turn it on only when a program in the sandbox needs the GPU (the mesa toolchain gives software OpenGL without it)."
|
|
@@ -25643,7 +25648,7 @@ var ToolchainsSchema = external_exports.strictObject({
|
|
|
25643
25648
|
`GNU host: "lld" links with Rust's own lld through MinGW's gcc (much less memory than GNU ld), "gnu" with GNU ld.`
|
|
25644
25649
|
),
|
|
25645
25650
|
linkSlots: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(1).max(32)]).describe(
|
|
25646
|
-
'GNU host: how many programs may link at the same time in the whole sandbox (other links wait). "auto" = one per
|
|
25651
|
+
'GNU host: how many programs may link at the same time in the whole sandbox (other links wait). "auto" = one per 3 GB of sandbox memory after 6 GB, 2 to 8 (the memory governor slows links down too when memory runs short).'
|
|
25647
25652
|
)
|
|
25648
25653
|
}),
|
|
25649
25654
|
msvc: external_exports.strictObject({
|
|
@@ -25718,7 +25723,7 @@ var ToolchainsSchema = external_exports.strictObject({
|
|
|
25718
25723
|
}),
|
|
25719
25724
|
cli: external_exports.strictObject({
|
|
25720
25725
|
gh: EnabledSchema.describe(
|
|
25721
|
-
'GitHub CLI (gh). Only with provisioning.git.access "full": gh can push and merge through the GitHub API, past a read-only git. Your PC\'s gh login is never copied; `gh auth login` inside persists (GH_CONFIG_DIR). "auto" = when the project has a .github folder.'
|
|
25726
|
+
'GitHub CLI (gh). Only with provisioning.git.access "full": gh can push and merge through the GitHub API, past a read-only git. Your PC\'s gh login is never copied; `gh auth login` inside persists (GH_CONFIG_DIR), unless a token you saved for sandboxes is handed over (github.shareToken). "auto" = when the project has a .github folder.'
|
|
25722
25727
|
),
|
|
25723
25728
|
zstd: EnabledSchema.describe('Zstandard (zstd). "auto" = off; set true to get it.'),
|
|
25724
25729
|
openssl: EnabledSchema.describe(
|
|
@@ -26646,6 +26651,13 @@ var VpnSchema = external_exports.strictObject({
|
|
|
26646
26651
|
)
|
|
26647
26652
|
});
|
|
26648
26653
|
|
|
26654
|
+
// src/core/schema/github.ts
|
|
26655
|
+
var GithubSchema = external_exports.strictObject({
|
|
26656
|
+
shareToken: external_exports.boolean().describe(
|
|
26657
|
+
'Give each sandbox the GitHub token you saved with `sandbox github login` (best a fine-grained token limited to some repositories and permissions), so gh and https git work there without logging in. Only with provisioning.git.access "full". The agent in the sandbox can read the token and use it for whatever it allows. A project file (.sandbox-config.json) cannot turn this on.'
|
|
26658
|
+
)
|
|
26659
|
+
});
|
|
26660
|
+
|
|
26649
26661
|
// src/core/schema/config.ts
|
|
26650
26662
|
var ConfigSchema = external_exports.strictObject({
|
|
26651
26663
|
$schema: SchemaRefSchema.optional(),
|
|
@@ -26676,6 +26688,7 @@ var ConfigSchema = external_exports.strictObject({
|
|
|
26676
26688
|
}),
|
|
26677
26689
|
network: NetworkSchema,
|
|
26678
26690
|
vpn: VpnSchema,
|
|
26691
|
+
github: GithubSchema,
|
|
26679
26692
|
provisioning: ProvisioningSchema,
|
|
26680
26693
|
downloads: DownloadsSchema,
|
|
26681
26694
|
toolchains: ToolchainsSchema,
|
|
@@ -26838,19 +26851,25 @@ var GuestRequestSchema = external_exports.discriminatedUnion("kind", [
|
|
|
26838
26851
|
id: IdSchema,
|
|
26839
26852
|
reason: Text(300),
|
|
26840
26853
|
seconds: external_exports.number().int().min(10).max(300),
|
|
26854
|
+
/** "severe": the PC is nearly out of memory; builds go to the governor's last step at once. */
|
|
26855
|
+
level: external_exports.enum(["slow", "severe"]).optional(),
|
|
26841
26856
|
createdAt: TimeSchema
|
|
26842
26857
|
})
|
|
26843
26858
|
]);
|
|
26844
26859
|
var PressureStatusSchema = external_exports.object({
|
|
26845
26860
|
level: external_exports.enum(["ok", "throttled", "suspending"]),
|
|
26861
|
+
/** The governor's dial, 0 (nothing wrong) to 4 (one compiler at a time). */
|
|
26862
|
+
step: external_exports.number().int().min(0).max(4).optional(),
|
|
26846
26863
|
profile: external_exports.enum(["normal", "gentle"]),
|
|
26847
26864
|
/** Share of the sandbox's RAM still free and of its commit limit in use (percent). */
|
|
26848
26865
|
ramFreePercent: external_exports.number().int().min(0).max(100),
|
|
26849
26866
|
commitPercent: external_exports.number().int().min(0).max(100),
|
|
26850
26867
|
/** Programs running at lower priority because of it. */
|
|
26851
26868
|
lowered: external_exports.number().int().min(0).max(1024),
|
|
26852
|
-
/**
|
|
26869
|
+
/** Compilers waiting their turn right now (name, process id, seconds until they may go on). */
|
|
26853
26870
|
paused: external_exports.array(external_exports.object({ name: Text(64), pid: external_exports.number().int(), seconds: external_exports.number().int().min(0).max(60) })).max(8),
|
|
26871
|
+
/** The CPU share the compilers get together (percent; 100 = no cap). */
|
|
26872
|
+
cpuPercent: external_exports.number().int().min(0).max(100).optional(),
|
|
26854
26873
|
/** The PC itself asked for slowing down (its memory or CPU is low). */
|
|
26855
26874
|
pcLow: external_exports.boolean(),
|
|
26856
26875
|
lastAction: Text(300),
|
|
@@ -26894,6 +26913,8 @@ var VpnStatusSchema = external_exports.object({
|
|
|
26894
26913
|
state: external_exports.enum(["off", "starting", "up", "failed"]),
|
|
26895
26914
|
message: Text(2e3),
|
|
26896
26915
|
killSwitch: external_exports.boolean(),
|
|
26916
|
+
/** A direct connection was tried after the kill switch was applied: false = it still got out. */
|
|
26917
|
+
killSwitchHeld: external_exports.boolean().optional(),
|
|
26897
26918
|
/** The server's name, e.g. uk2201.nordvpn.com. */
|
|
26898
26919
|
server: Text(128).optional(),
|
|
26899
26920
|
/** What the sandbox's traffic looks like from outside, once the tunnel is up. */
|
|
@@ -27119,6 +27140,8 @@ var RunDir = class {
|
|
|
27119
27140
|
vpnFile;
|
|
27120
27141
|
/** What the memory governor in the sandbox is doing (pressure.json). */
|
|
27121
27142
|
pressureFile;
|
|
27143
|
+
/** What the sandbox's programs may really use (budget.json): processors, memory, build jobs, link slots. */
|
|
27144
|
+
budgetFile;
|
|
27122
27145
|
requestsDir;
|
|
27123
27146
|
responsesDir;
|
|
27124
27147
|
sessionsDir;
|
|
@@ -27132,6 +27155,7 @@ var RunDir = class {
|
|
|
27132
27155
|
this.sandboxFile = path7.join(this.root, "sandbox.json");
|
|
27133
27156
|
this.vpnFile = path7.join(this.root, "vpn.json");
|
|
27134
27157
|
this.pressureFile = path7.join(this.root, "pressure.json");
|
|
27158
|
+
this.budgetFile = path7.join(this.root, "budget.json");
|
|
27135
27159
|
this.requestsDir = path7.join(this.root, "requests");
|
|
27136
27160
|
this.responsesDir = path7.join(this.root, "responses");
|
|
27137
27161
|
this.sessionsDir = path7.join(this.root, "sessions");
|
|
@@ -27685,6 +27709,12 @@ function safely(what, work) {
|
|
|
27685
27709
|
// src/guest/runtime/secrets.ts
|
|
27686
27710
|
import fs13 from "node:fs";
|
|
27687
27711
|
|
|
27712
|
+
// src/shared/github/token.ts
|
|
27713
|
+
var MIN_LENGTH = 20;
|
|
27714
|
+
var MAX_LENGTH = 255;
|
|
27715
|
+
var PRINTABLE = /^[\x21-\x7e]+$/;
|
|
27716
|
+
var GithubTokenSchema = external_exports.string().min(MIN_LENGTH).max(MAX_LENGTH).regex(PRINTABLE);
|
|
27717
|
+
|
|
27688
27718
|
// src/shared/channel/secrets.ts
|
|
27689
27719
|
var Environment = external_exports.record(external_exports.string().max(256), external_exports.string().max(65536));
|
|
27690
27720
|
var SecretsFileSchema = external_exports.strictObject({
|
|
@@ -27699,7 +27729,9 @@ var SecretsFileSchema = external_exports.strictObject({
|
|
|
27699
27729
|
/** VPN service credentials (vpn.provider's login), only for the launch's own sandbox. */
|
|
27700
27730
|
vpn: external_exports.strictObject({ username: external_exports.string().min(1).max(256), password: external_exports.string().min(1).max(1024) }).optional(),
|
|
27701
27731
|
/** The checked WireGuard config of vpn.provider wireguard-file (holds the private key). */
|
|
27702
|
-
wireguardConfig: external_exports.string().min(1).max(32 * 1024).optional()
|
|
27732
|
+
wireguardConfig: external_exports.string().min(1).max(32 * 1024).optional(),
|
|
27733
|
+
/** The GitHub token you saved for sandboxes (github.shareToken), only with git access "full". */
|
|
27734
|
+
githubToken: GithubTokenSchema.optional()
|
|
27703
27735
|
});
|
|
27704
27736
|
var withEnvironment = (harness, environment) => environment ? { ...harness, environment: { ...harness.environment, ...environment } } : harness;
|
|
27705
27737
|
function mergeRequestSecrets(request, secrets) {
|
|
@@ -29943,9 +29975,23 @@ async function setupUv(env) {
|
|
|
29943
29975
|
function ghConfigDir() {
|
|
29944
29976
|
return path45.join(stateDir, "gh");
|
|
29945
29977
|
}
|
|
29978
|
+
function deliveredGhConfigDir() {
|
|
29979
|
+
return path45.join(localDir, "gh-token");
|
|
29980
|
+
}
|
|
29981
|
+
var GH_NOTE = " (log in once with: gh auth login --web --insecure-storage; it is kept between sandboxes)";
|
|
29982
|
+
function warnKeyringLogin() {
|
|
29983
|
+
try {
|
|
29984
|
+
const hosts = fs35.readFileSync(path45.join(ghConfigDir(), "hosts.yml"), "utf8");
|
|
29985
|
+
if (/^\s*user:/m.test(hosts) && !/oauth_token:/.test(hosts))
|
|
29986
|
+
warn(
|
|
29987
|
+
"gh: the GitHub login from an earlier sandbox was kept in Windows Credential Manager, which is wiped with each sandbox. Log in again with: gh auth login --web --insecure-storage (then it lasts)."
|
|
29988
|
+
);
|
|
29989
|
+
} catch {
|
|
29990
|
+
}
|
|
29991
|
+
}
|
|
29946
29992
|
var toolVars = {
|
|
29947
29993
|
gh: () => ({
|
|
29948
|
-
GH_CONFIG_DIR: mkdirp(ghConfigDir()),
|
|
29994
|
+
GH_CONFIG_DIR: exists(deliveredGhConfigDir()) ? deliveredGhConfigDir() : mkdirp(ghConfigDir()),
|
|
29949
29995
|
GH_NO_UPDATE_NOTIFIER: "1",
|
|
29950
29996
|
GH_NO_EXTENSION_UPDATE_NOTIFIER: "1"
|
|
29951
29997
|
})
|
|
@@ -29983,9 +30029,11 @@ async function setupCli(env, settings, gitAccess, refresh = false) {
|
|
|
29983
30029
|
await setupSingleExe(env, name, entry.repo, entry.asset(arch), entry.exe, tool("cli", name), {
|
|
29984
30030
|
refresh,
|
|
29985
30031
|
subdir: entry.subdir,
|
|
29986
|
-
size: entry.size
|
|
30032
|
+
size: entry.size,
|
|
30033
|
+
...name === "gh" ? { note: GH_NOTE } : {}
|
|
29987
30034
|
});
|
|
29988
30035
|
Object.assign(env.vars, toolVars[name]?.() ?? {});
|
|
30036
|
+
if (name === "gh") warnKeyringLogin();
|
|
29989
30037
|
} catch (e) {
|
|
29990
30038
|
warn(name + " could not be set up and is skipped; the other tools are not affected. Reason: " + errMsg(e));
|
|
29991
30039
|
env.summary.push(entry.name + ": FAILED");
|
|
@@ -30791,6 +30839,10 @@ var activate = async (version2) => {
|
|
|
30791
30839
|
fs43.rmSync(NVM_SYMLINK, { recursive: true, force: true });
|
|
30792
30840
|
fs43.symlinkSync(path56.join(NVM_HOME, "v" + version2), NVM_SYMLINK, "junction");
|
|
30793
30841
|
};
|
|
30842
|
+
var PLAYWRIGHT_VARS = () => ({
|
|
30843
|
+
PLAYWRIGHT_BROWSERS_PATH: tool("ms-playwright"),
|
|
30844
|
+
PLAYWRIGHT_MCP_BROWSER: "msedge"
|
|
30845
|
+
});
|
|
30794
30846
|
async function setupNode(env, versions, config2) {
|
|
30795
30847
|
if (dryRun) {
|
|
30796
30848
|
log("(dry run) would provision nvm and Node " + versions.node.spec + " (from " + versions.node.source + ")");
|
|
@@ -30824,13 +30876,14 @@ async function setupNode(env, versions, config2) {
|
|
|
30824
30876
|
warn("Node " + version2 + " from this PC: " + errMsg(e));
|
|
30825
30877
|
}
|
|
30826
30878
|
}
|
|
30827
|
-
Object.assign(env.vars, { NVM_HOME, NVM_SYMLINK });
|
|
30879
|
+
Object.assign(env.vars, { NVM_HOME, NVM_SYMLINK, ...PLAYWRIGHT_VARS() });
|
|
30828
30880
|
if (duringSession()) env.prepend.push(path56.join(NVM_HOME, "v" + main), NVM_HOME, NVM_SYMLINK);
|
|
30829
30881
|
else {
|
|
30830
30882
|
await activate(main);
|
|
30831
30883
|
env.prepend.push(NVM_HOME, NVM_SYMLINK);
|
|
30832
30884
|
}
|
|
30833
30885
|
env.summary.push("node: " + main + " (from " + versions.node.source + ", switch with nvm use)");
|
|
30886
|
+
env.summary.push("playwright: ready (Edge; browsers it downloads are kept; in tests use channel: 'msedge')");
|
|
30834
30887
|
await packageManagers(env, config2, main);
|
|
30835
30888
|
}
|
|
30836
30889
|
var packageManagers = async (env, config2, version2) => {
|
|
@@ -31377,27 +31430,44 @@ import os8 from "node:os";
|
|
|
31377
31430
|
import path62 from "node:path";
|
|
31378
31431
|
|
|
31379
31432
|
// src/shared/memory/policy.ts
|
|
31380
|
-
var
|
|
31381
|
-
normal:
|
|
31382
|
-
|
|
31383
|
-
|
|
31384
|
-
|
|
31385
|
-
|
|
31386
|
-
|
|
31387
|
-
|
|
31388
|
-
|
|
31389
|
-
|
|
31390
|
-
|
|
31391
|
-
|
|
31392
|
-
|
|
31393
|
-
calmSamples: 3
|
|
31394
|
-
}
|
|
31433
|
+
var DIAL_STEPS = {
|
|
31434
|
+
normal: [
|
|
31435
|
+
{ availablePercent: 15, commitPercent: 80 },
|
|
31436
|
+
{ availablePercent: 10, commitPercent: 88 },
|
|
31437
|
+
{ availablePercent: 6, commitPercent: 94, secondsToLimit: 20 },
|
|
31438
|
+
{ availablePercent: 4, commitPercent: 97, secondsToLimit: 8 }
|
|
31439
|
+
],
|
|
31440
|
+
gentle: [
|
|
31441
|
+
{ availablePercent: 20, commitPercent: 75 },
|
|
31442
|
+
{ availablePercent: 15, commitPercent: 85 },
|
|
31443
|
+
{ availablePercent: 8, commitPercent: 92, secondsToLimit: 25 },
|
|
31444
|
+
{ availablePercent: 5, commitPercent: 96, secondsToLimit: 10 }
|
|
31445
|
+
]
|
|
31395
31446
|
};
|
|
31447
|
+
var DIAL_EXIT_MARGIN = { availablePercent: 5, commitPercent: 4 };
|
|
31448
|
+
var DIAL_CALM_SAMPLES = 3;
|
|
31449
|
+
var DIAL_CPU_RATE = [100, 100, 60, 35, 15];
|
|
31450
|
+
function compilersAllowed(step, running) {
|
|
31451
|
+
if (step <= 1 || running <= 1) return running;
|
|
31452
|
+
if (step === 2) return Math.max(1, Math.ceil(running * 0.6));
|
|
31453
|
+
if (step === 3) return Math.max(1, Math.ceil(running / 3));
|
|
31454
|
+
return 1;
|
|
31455
|
+
}
|
|
31456
|
+
function buildJobs(cpus, memoryGb) {
|
|
31457
|
+
return Math.max(2, Math.min(cpus, Math.floor((memoryGb - 6) / 3)));
|
|
31458
|
+
}
|
|
31459
|
+
function linkSlotsFor(memoryGb) {
|
|
31460
|
+
return Math.max(2, Math.min(8, Math.floor((memoryGb - 6) / 3)));
|
|
31461
|
+
}
|
|
31462
|
+
function usableCpus(cpus, percent) {
|
|
31463
|
+
if (percent === null || percent >= 100) return cpus;
|
|
31464
|
+
return Math.max(2, Math.min(cpus, Math.floor(cpus * percent / 100)));
|
|
31465
|
+
}
|
|
31396
31466
|
function cargoJobs(cpus, memoryGb, sessions2) {
|
|
31397
|
-
const byCpu = Math.max(2, Math.min(
|
|
31467
|
+
const byCpu = Math.max(2, Math.min(8, Math.floor(cpus / 4)));
|
|
31398
31468
|
const byMemory = Math.max(1, Math.floor(memoryGb / 4));
|
|
31399
31469
|
const jobs = Math.min(byCpu, byMemory);
|
|
31400
|
-
return Math.max(1, Math.min(jobs, Math.floor(
|
|
31470
|
+
return Math.max(1, Math.min(jobs, Math.floor(buildJobs(cpus, memoryGb) / Math.max(1, sessions2))));
|
|
31401
31471
|
}
|
|
31402
31472
|
function maxCompilers(cpus, profile) {
|
|
31403
31473
|
return profile === "gentle" ? Math.max(2, Math.floor(cpus / 4)) : null;
|
|
@@ -31423,7 +31493,7 @@ function linkGate(env, rust, host) {
|
|
|
31423
31493
|
const gate = path62.join(mkdirp(tool("shims")), "linkgate.exe");
|
|
31424
31494
|
fs48.copyFileSync(ensureCompiled("linkgate"), gate);
|
|
31425
31495
|
const memoryGb = os8.totalmem() / 1024 ** 3;
|
|
31426
|
-
const slots = rust.linkSlots === "auto" ?
|
|
31496
|
+
const slots = rust.linkSlots === "auto" ? linkSlotsFor(memoryGb) : rust.linkSlots;
|
|
31427
31497
|
env.vars.AGENT_LINK_SLOTS = String(slots);
|
|
31428
31498
|
env.vars.AGENT_REAL_LINKER = gcc;
|
|
31429
31499
|
env.vars.CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER = gate;
|
|
@@ -32275,11 +32345,33 @@ var harnessFor = (req) => {
|
|
|
32275
32345
|
};
|
|
32276
32346
|
function memoryEnv(env, sessions2) {
|
|
32277
32347
|
const out = {};
|
|
32278
|
-
|
|
32279
|
-
|
|
32280
|
-
|
|
32348
|
+
out.PTYHOST_BACKSTOP_MB = String(session.agentBackstop ?? "auto");
|
|
32349
|
+
const cpus = usableCpus(os11.cpus().length, session.cpuLimitPercent ?? null);
|
|
32350
|
+
const memoryGb = os11.totalmem() / 1024 ** 3;
|
|
32351
|
+
const jobs = cargoJobs(cpus, memoryGb, sessions2);
|
|
32352
|
+
out.NUMBER_OF_PROCESSORS = String(cpus);
|
|
32353
|
+
if (!env.CARGO_BUILD_JOBS) out.CARGO_BUILD_JOBS = String(jobs);
|
|
32354
|
+
if (!env.CMAKE_BUILD_PARALLEL_LEVEL) out.CMAKE_BUILD_PARALLEL_LEVEL = String(jobs);
|
|
32355
|
+
out.SANDBOX_BUDGET_FILE = run.budgetFile;
|
|
32356
|
+
writeBudget(cpus, memoryGb, jobs, env);
|
|
32281
32357
|
return out;
|
|
32282
32358
|
}
|
|
32359
|
+
function writeBudget(cpus, memoryGb, jobs, env) {
|
|
32360
|
+
try {
|
|
32361
|
+
writeJsonAtomic(run.budgetFile, {
|
|
32362
|
+
processors: cpus,
|
|
32363
|
+
memoryMb: Math.round(memoryGb * 1024),
|
|
32364
|
+
buildJobs: buildJobs(cpus, memoryGb),
|
|
32365
|
+
cargoJobsPerSession: jobs,
|
|
32366
|
+
linkSlots: Number(env.AGENT_LINK_SLOTS) || linkSlotsFor(memoryGb),
|
|
32367
|
+
cpuLimitPercent: session.cpuLimitPercent ?? null,
|
|
32368
|
+
governor: run.pressureFile,
|
|
32369
|
+
note: "Plan builds with these numbers. When memory runs short the sandbox slows builds down in steps (governor); nothing fails."
|
|
32370
|
+
});
|
|
32371
|
+
} catch (e) {
|
|
32372
|
+
warn("budget.json could not be written: " + errMsg(e));
|
|
32373
|
+
}
|
|
32374
|
+
}
|
|
32283
32375
|
var launchPtyHost = async (req, remote, env, say, sessions2) => {
|
|
32284
32376
|
const harness = harnessFor(req);
|
|
32285
32377
|
say("Preparing " + req.harness);
|
|
@@ -32504,7 +32596,6 @@ var COMPILERS = /* @__PURE__ */ new Set([
|
|
|
32504
32596
|
"javac"
|
|
32505
32597
|
]);
|
|
32506
32598
|
var BUILD_TOOLS = /* @__PURE__ */ new Set([
|
|
32507
|
-
"node",
|
|
32508
32599
|
"dotnet",
|
|
32509
32600
|
"msbuild",
|
|
32510
32601
|
"vbcscompiler",
|
|
@@ -32573,88 +32664,123 @@ var HEAVY = /* @__PURE__ */ new Set([
|
|
|
32573
32664
|
var isHeavyCompiler = (name) => !isNeverTouched(name) && HEAVY.has(key(name));
|
|
32574
32665
|
var canPause = (name) => !isNeverTouched(name) && COMPILERS.has(key(name));
|
|
32575
32666
|
var INITIAL_STATE = {
|
|
32576
|
-
|
|
32667
|
+
step: 0,
|
|
32577
32668
|
calm: 0,
|
|
32578
|
-
samples: 0,
|
|
32579
32669
|
lowered: {},
|
|
32580
|
-
|
|
32581
|
-
|
|
32582
|
-
|
|
32670
|
+
memLow: [],
|
|
32671
|
+
throttled: [],
|
|
32672
|
+
trimmed: [],
|
|
32673
|
+
cpuRate: 100,
|
|
32674
|
+
lastCommitMb: 0,
|
|
32675
|
+
lastAt: 0,
|
|
32676
|
+
growth: 0,
|
|
32677
|
+
hostUntil: 0,
|
|
32678
|
+
hostStep: 0
|
|
32583
32679
|
};
|
|
32680
|
+
var GROWTH_WEIGHT = 0.3;
|
|
32584
32681
|
var HOLD_MS = 3e3;
|
|
32585
|
-
var
|
|
32586
|
-
var
|
|
32587
|
-
|
|
32588
|
-
|
|
32589
|
-
|
|
32590
|
-
|
|
32682
|
+
var ROTATE_MS = 2e4;
|
|
32683
|
+
var SOON_WITHIN_PERCENT = 12;
|
|
32684
|
+
function stepFor(ramFree, commit, secondsToLimit, profile) {
|
|
32685
|
+
let step = 0;
|
|
32686
|
+
DIAL_STEPS[profile].forEach((t, i) => {
|
|
32687
|
+
const near = commit > t.commitPercent - SOON_WITHIN_PERCENT;
|
|
32688
|
+
const soon = near && t.secondsToLimit !== void 0 && secondsToLimit < t.secondsToLimit;
|
|
32689
|
+
if (ramFree < t.availablePercent || commit > t.commitPercent || soon) step = i + 1;
|
|
32690
|
+
});
|
|
32691
|
+
return step;
|
|
32692
|
+
}
|
|
32693
|
+
function clearOf(step, ramFree, commit, profile) {
|
|
32694
|
+
if (step === 0) return true;
|
|
32695
|
+
const t = DIAL_STEPS[profile][step - 1];
|
|
32696
|
+
return ramFree > t.availablePercent + DIAL_EXIT_MARGIN.availablePercent && commit < t.commitPercent - DIAL_EXIT_MARGIN.commitPercent;
|
|
32697
|
+
}
|
|
32698
|
+
function decide(prev, sample, nowMs, profile, maxCompilers2 = null) {
|
|
32591
32699
|
const ramFree = sample.ramAvailMb / Math.max(1, sample.ramTotalMb) * 100;
|
|
32592
|
-
const
|
|
32700
|
+
const usedMb = sample.commitLimitMb - sample.commitAvailMb;
|
|
32701
|
+
const commit = usedMb / Math.max(1, sample.commitLimitMb) * 100;
|
|
32702
|
+
const seconds = (nowMs - prev.lastAt) / 1e3;
|
|
32703
|
+
const instant = prev.lastAt > 0 && seconds > 0 ? (usedMb - prev.lastCommitMb) / seconds : 0;
|
|
32704
|
+
const growth = prev.lastAt > 0 ? prev.growth * (1 - GROWTH_WEIGHT) + instant * GROWTH_WEIGHT : 0;
|
|
32705
|
+
const secondsToLimit = growth > 0 ? sample.commitAvailMb / growth : Number.POSITIVE_INFINITY;
|
|
32593
32706
|
const pcLow = nowMs < prev.hostUntil;
|
|
32594
|
-
const
|
|
32595
|
-
|
|
32596
|
-
let
|
|
32597
|
-
|
|
32598
|
-
|
|
32599
|
-
|
|
32600
|
-
|
|
32601
|
-
|
|
32602
|
-
samples = prev.samples + 1;
|
|
32603
|
-
} else if (prev.pressure) {
|
|
32604
|
-
calm = recovered ? prev.calm + 1 : 0;
|
|
32605
|
-
if (calm >= thresholds.calmSamples) {
|
|
32606
|
-
pressure = false;
|
|
32707
|
+
const wanted2 = Math.max(stepFor(ramFree, commit, secondsToLimit, profile), pcLow ? prev.hostStep : 0);
|
|
32708
|
+
let step = prev.step;
|
|
32709
|
+
let calm = 0;
|
|
32710
|
+
if (wanted2 > prev.step) step = wanted2;
|
|
32711
|
+
else if (prev.step > 0 && wanted2 < prev.step && clearOf(prev.step, ramFree, commit, profile)) {
|
|
32712
|
+
calm = prev.calm + 1;
|
|
32713
|
+
if (calm >= DIAL_CALM_SAMPLES) {
|
|
32714
|
+
step = prev.step - 1;
|
|
32607
32715
|
calm = 0;
|
|
32608
|
-
samples = 0;
|
|
32609
32716
|
}
|
|
32610
32717
|
}
|
|
32611
32718
|
const actions = [];
|
|
32612
32719
|
const present2 = new Set(sample.procs.map((p) => p.pid));
|
|
32720
|
+
const keep = (pids) => pids.filter((pid) => present2.has(pid));
|
|
32613
32721
|
const lowered = {};
|
|
32614
32722
|
for (const [pid, to] of Object.entries(prev.lowered)) if (present2.has(Number(pid))) lowered[Number(pid)] = to;
|
|
32615
|
-
|
|
32616
|
-
|
|
32617
|
-
|
|
32618
|
-
|
|
32619
|
-
|
|
32620
|
-
|
|
32621
|
-
|
|
32622
|
-
|
|
32623
|
-
|
|
32624
|
-
|
|
32625
|
-
|
|
32626
|
-
|
|
32627
|
-
|
|
32628
|
-
|
|
32629
|
-
|
|
32630
|
-
|
|
32631
|
-
|
|
32632
|
-
|
|
32633
|
-
|
|
32634
|
-
|
|
32635
|
-
|
|
32636
|
-
|
|
32637
|
-
|
|
32638
|
-
|
|
32639
|
-
|
|
32640
|
-
|
|
32641
|
-
|
|
32642
|
-
|
|
32643
|
-
|
|
32644
|
-
|
|
32645
|
-
|
|
32646
|
-
|
|
32647
|
-
|
|
32648
|
-
if (
|
|
32649
|
-
const
|
|
32650
|
-
|
|
32651
|
-
|
|
32652
|
-
for (const p of heavy.slice(Math.max(1, maxCompilers2)))
|
|
32723
|
+
const memLow = new Set(keep(prev.memLow));
|
|
32724
|
+
const throttled = new Set(keep(prev.throttled));
|
|
32725
|
+
const trimmed = new Set(keep(prev.trimmed));
|
|
32726
|
+
for (const p of sample.procs) {
|
|
32727
|
+
if (!canLower(p.name)) continue;
|
|
32728
|
+
const rest = profile === "gentle" && canPause(p.name) ? "below" : "normal";
|
|
32729
|
+
const target = step >= 2 ? "idle" : step === 1 ? "below" : rest;
|
|
32730
|
+
const was = lowered[p.pid];
|
|
32731
|
+
const touched = was !== void 0 || target !== "normal";
|
|
32732
|
+
if (touched && was !== target && p.prio !== target)
|
|
32733
|
+
actions.push({ kind: "priority", pid: p.pid, name: p.name, to: target });
|
|
32734
|
+
if (target === "normal") delete lowered[p.pid];
|
|
32735
|
+
else lowered[p.pid] = target;
|
|
32736
|
+
}
|
|
32737
|
+
const lowMemory = step >= 1;
|
|
32738
|
+
for (const p of sample.procs) {
|
|
32739
|
+
if (!canLower(p.name) || lowMemory === memLow.has(p.pid)) continue;
|
|
32740
|
+
actions.push({ kind: "memory", pid: p.pid, name: p.name, low: lowMemory });
|
|
32741
|
+
if (lowMemory) memLow.add(p.pid);
|
|
32742
|
+
else memLow.delete(p.pid);
|
|
32743
|
+
}
|
|
32744
|
+
if (step >= 2) {
|
|
32745
|
+
for (const p of sample.procs)
|
|
32746
|
+
if (canPause(p.name) && !throttled.has(p.pid)) {
|
|
32747
|
+
actions.push({ kind: "throttle", pid: p.pid, name: p.name });
|
|
32748
|
+
throttled.add(p.pid);
|
|
32749
|
+
}
|
|
32750
|
+
}
|
|
32751
|
+
const cpuRate = DIAL_CPU_RATE[step] ?? 100;
|
|
32752
|
+
if (cpuRate !== prev.cpuRate) actions.push({ kind: "cpu", percent: cpuRate });
|
|
32753
|
+
const heavy = sample.procs.filter((p) => isHeavyCompiler(p.name)).sort((a, b) => a.pid - b.pid);
|
|
32754
|
+
let allowed = compilersAllowed(step, heavy.length);
|
|
32755
|
+
if (maxCompilers2 !== null && step >= 2) allowed = Math.min(allowed, Math.max(1, maxCompilers2));
|
|
32756
|
+
if (allowed < heavy.length) {
|
|
32757
|
+
const turn = Math.floor(nowMs / ROTATE_MS) % heavy.length;
|
|
32758
|
+
const order = [...heavy.slice(turn), ...heavy.slice(0, turn)];
|
|
32759
|
+
for (const p of order.slice(allowed)) {
|
|
32653
32760
|
actions.push({ kind: "hold", pid: p.pid, name: p.name, ms: HOLD_MS });
|
|
32654
|
-
|
|
32655
|
-
|
|
32761
|
+
if (step >= 3 && !trimmed.has(p.pid)) {
|
|
32762
|
+
actions.push({ kind: "trim", pid: p.pid, name: p.name });
|
|
32763
|
+
trimmed.add(p.pid);
|
|
32764
|
+
}
|
|
32765
|
+
}
|
|
32766
|
+
for (const p of order.slice(0, allowed)) trimmed.delete(p.pid);
|
|
32767
|
+
} else trimmed.clear();
|
|
32768
|
+
const level = step >= 3 ? "suspending" : step >= 1 ? "throttled" : "ok";
|
|
32656
32769
|
return {
|
|
32657
|
-
state: {
|
|
32770
|
+
state: {
|
|
32771
|
+
step,
|
|
32772
|
+
calm,
|
|
32773
|
+
lowered,
|
|
32774
|
+
memLow: [...memLow],
|
|
32775
|
+
throttled: [...throttled],
|
|
32776
|
+
trimmed: [...trimmed],
|
|
32777
|
+
cpuRate,
|
|
32778
|
+
lastCommitMb: usedMb,
|
|
32779
|
+
lastAt: nowMs,
|
|
32780
|
+
growth,
|
|
32781
|
+
hostUntil: prev.hostUntil,
|
|
32782
|
+
hostStep: prev.hostStep
|
|
32783
|
+
},
|
|
32658
32784
|
actions,
|
|
32659
32785
|
level,
|
|
32660
32786
|
ramFreePercent: Math.round(ramFree),
|
|
@@ -32662,26 +32788,14 @@ function decide(prev, sample, nowMs, thresholds, profile, maxCompilers2 = null)
|
|
|
32662
32788
|
};
|
|
32663
32789
|
}
|
|
32664
32790
|
|
|
32665
|
-
// src/guest/governor/
|
|
32666
|
-
|
|
32667
|
-
|
|
32668
|
-
|
|
32669
|
-
|
|
32670
|
-
|
|
32671
|
-
|
|
32672
|
-
|
|
32673
|
-
ramAvailMb: external_exports.number(),
|
|
32674
|
-
commitLimitMb: external_exports.number(),
|
|
32675
|
-
commitAvailMb: external_exports.number(),
|
|
32676
|
-
procs: external_exports.array(
|
|
32677
|
-
external_exports.object({
|
|
32678
|
-
pid: external_exports.number().int(),
|
|
32679
|
-
name: external_exports.string().max(128),
|
|
32680
|
-
mb: external_exports.number(),
|
|
32681
|
-
prio: external_exports.enum(["idle", "below", "normal"]).catch("normal")
|
|
32682
|
-
})
|
|
32683
|
-
).max(1024)
|
|
32684
|
-
});
|
|
32791
|
+
// src/guest/governor/core.ts
|
|
32792
|
+
var STEP_TEXT = [
|
|
32793
|
+
"builds back to normal",
|
|
32794
|
+
"build programs at lower priority",
|
|
32795
|
+
"builds get less CPU and take turns",
|
|
32796
|
+
"builds take turns, waiting ones go to the paging file",
|
|
32797
|
+
"one compiler at a time"
|
|
32798
|
+
];
|
|
32685
32799
|
var GovernorCore = class {
|
|
32686
32800
|
constructor(deps) {
|
|
32687
32801
|
this.deps = deps;
|
|
@@ -32691,52 +32805,51 @@ var GovernorCore = class {
|
|
|
32691
32805
|
lastAction = "";
|
|
32692
32806
|
lastWrite = "";
|
|
32693
32807
|
lastWriteAt = 0;
|
|
32694
|
-
|
|
32695
|
-
|
|
32696
|
-
|
|
32697
|
-
|
|
32698
|
-
const until =
|
|
32699
|
-
|
|
32700
|
-
|
|
32701
|
-
|
|
32702
|
-
this.
|
|
32703
|
-
|
|
32808
|
+
/** Compilers waiting their turn now, by pid (name), to log a hold once. */
|
|
32809
|
+
held = /* @__PURE__ */ new Map();
|
|
32810
|
+
hostPressure(seconds, reason, level = "slow") {
|
|
32811
|
+
const nowMs = this.deps.now();
|
|
32812
|
+
const until = nowMs + seconds * 1e3;
|
|
32813
|
+
const active = this.state.hostUntil > nowMs;
|
|
32814
|
+
const step = Math.max(level === "severe" ? 4 : 2, active ? this.state.hostStep : 0);
|
|
32815
|
+
if (!active || step > this.state.hostStep)
|
|
32816
|
+
this.deps.logLine(
|
|
32817
|
+
"governor: this PC is " + (level === "severe" ? "nearly out of memory" : "low") + " (" + reason + "); builds to step " + step
|
|
32818
|
+
);
|
|
32819
|
+
this.state = { ...this.state, hostUntil: Math.max(until, this.state.hostUntil), hostStep: step };
|
|
32704
32820
|
}
|
|
32705
32821
|
get current() {
|
|
32706
32822
|
return this.state;
|
|
32707
32823
|
}
|
|
32708
32824
|
onSample(sample) {
|
|
32709
32825
|
const nowMs = this.deps.now();
|
|
32710
|
-
const before = this.state.
|
|
32711
|
-
const
|
|
32712
|
-
for (const pid of this.held) if (!seen.has(pid)) this.held.delete(pid);
|
|
32713
|
-
const d = decide(
|
|
32714
|
-
this.state,
|
|
32715
|
-
sample,
|
|
32716
|
-
nowMs,
|
|
32717
|
-
GUEST_THRESHOLDS[this.deps.profile],
|
|
32718
|
-
this.deps.profile,
|
|
32719
|
-
this.deps.maxCompilers ?? null
|
|
32720
|
-
);
|
|
32826
|
+
const before = this.state.step;
|
|
32827
|
+
const d = decide(this.state, sample, nowMs, this.deps.profile, this.deps.maxCompilers ?? null);
|
|
32721
32828
|
this.state = d.state;
|
|
32722
|
-
|
|
32723
|
-
|
|
32829
|
+
const holding = /* @__PURE__ */ new Set();
|
|
32830
|
+
for (const action of d.actions) {
|
|
32831
|
+
if (action.kind === "hold") holding.add(action.pid);
|
|
32832
|
+
this.apply(action);
|
|
32833
|
+
}
|
|
32834
|
+
for (const pid of [...this.held.keys()]) if (!holding.has(pid)) this.held.delete(pid);
|
|
32835
|
+
if (d.state.step !== before)
|
|
32724
32836
|
this.deps.logLine(
|
|
32725
|
-
d.state.
|
|
32837
|
+
"governor: step " + d.state.step + " (" + d.ramFreePercent + "% RAM free, commit " + d.commitPercent + "% used): " + STEP_TEXT[d.state.step]
|
|
32726
32838
|
);
|
|
32727
|
-
const paused = nowMs < d.state.pausedUntil && this.pausedPid ? [{ name: this.pausedName, pid: this.pausedPid, seconds: Math.ceil((d.state.pausedUntil - nowMs) / 1e3) }] : [];
|
|
32728
32839
|
const status = {
|
|
32729
32840
|
level: d.level,
|
|
32841
|
+
step: d.state.step,
|
|
32730
32842
|
profile: this.deps.profile,
|
|
32731
32843
|
ramFreePercent: Math.max(0, Math.min(100, d.ramFreePercent)),
|
|
32732
32844
|
commitPercent: Math.max(0, Math.min(100, d.commitPercent)),
|
|
32733
32845
|
lowered: Object.keys(d.state.lowered).length,
|
|
32734
|
-
paused,
|
|
32846
|
+
paused: [...this.held].slice(0, 8).map(([pid, name]) => ({ name: name.slice(0, 64), pid, seconds: HOLD_MS / 1e3 })),
|
|
32847
|
+
cpuPercent: d.state.cpuRate,
|
|
32735
32848
|
pcLow: nowMs < d.state.hostUntil,
|
|
32736
|
-
lastAction: this.lastAction,
|
|
32849
|
+
lastAction: this.lastAction.slice(0, 300),
|
|
32737
32850
|
updatedAt: now()
|
|
32738
32851
|
};
|
|
32739
|
-
const shape = JSON.stringify({ ...status, updatedAt: "", paused: paused.map((p) => p.pid) });
|
|
32852
|
+
const shape = JSON.stringify({ ...status, updatedAt: "", paused: status.paused.map((p) => p.pid) });
|
|
32740
32853
|
if (shape !== this.lastWrite || nowMs - this.lastWriteAt > 6e4) {
|
|
32741
32854
|
this.lastWrite = shape;
|
|
32742
32855
|
this.lastWriteAt = nowMs;
|
|
@@ -32744,33 +32857,64 @@ var GovernorCore = class {
|
|
|
32744
32857
|
}
|
|
32745
32858
|
}
|
|
32746
32859
|
apply(action) {
|
|
32860
|
+
const port = this.deps.port;
|
|
32747
32861
|
try {
|
|
32748
|
-
|
|
32749
|
-
|
|
32750
|
-
|
|
32751
|
-
this.held.
|
|
32752
|
-
|
|
32753
|
-
|
|
32754
|
-
|
|
32755
|
-
|
|
32756
|
-
|
|
32757
|
-
|
|
32758
|
-
|
|
32759
|
-
|
|
32760
|
-
|
|
32761
|
-
|
|
32762
|
-
|
|
32763
|
-
|
|
32764
|
-
|
|
32765
|
-
|
|
32766
|
-
|
|
32862
|
+
switch (action.kind) {
|
|
32863
|
+
case "hold":
|
|
32864
|
+
port.hold(action.pid, action.ms);
|
|
32865
|
+
if (!this.held.has(action.pid)) {
|
|
32866
|
+
this.held.set(action.pid, action.name);
|
|
32867
|
+
this.note(action.name + " (" + action.pid + ") waits its turn");
|
|
32868
|
+
}
|
|
32869
|
+
return;
|
|
32870
|
+
case "priority":
|
|
32871
|
+
port.setPriority(action.pid, action.to);
|
|
32872
|
+
this.note(action.name + " (" + action.pid + ") priority " + action.to);
|
|
32873
|
+
return;
|
|
32874
|
+
case "memory":
|
|
32875
|
+
port.setMemoryPriority(action.pid, action.low);
|
|
32876
|
+
return;
|
|
32877
|
+
case "throttle":
|
|
32878
|
+
port.throttle(action.pid);
|
|
32879
|
+
return;
|
|
32880
|
+
case "cpu":
|
|
32881
|
+
port.setCpuRate(action.percent);
|
|
32882
|
+
this.note(action.percent >= 100 ? "compilers: no CPU cap" : "compilers: at most " + action.percent + "% CPU");
|
|
32883
|
+
return;
|
|
32884
|
+
case "trim":
|
|
32885
|
+
port.trim(action.pid);
|
|
32886
|
+
return;
|
|
32767
32887
|
}
|
|
32768
|
-
this.deps.logLine("governor: " + this.lastAction);
|
|
32769
32888
|
} catch (e) {
|
|
32770
|
-
warn("governor: " + errMsg(e));
|
|
32889
|
+
this.deps.warn("governor: " + errMsg(e));
|
|
32771
32890
|
}
|
|
32772
32891
|
}
|
|
32892
|
+
note(text) {
|
|
32893
|
+
this.lastAction = text;
|
|
32894
|
+
this.deps.logLine("governor: " + text);
|
|
32895
|
+
}
|
|
32773
32896
|
};
|
|
32897
|
+
|
|
32898
|
+
// src/guest/governor/governor.ts
|
|
32899
|
+
import fs53 from "node:fs";
|
|
32900
|
+
import os12 from "node:os";
|
|
32901
|
+
import path69 from "node:path";
|
|
32902
|
+
import { spawn as spawn8 } from "node:child_process";
|
|
32903
|
+
import { createInterface } from "node:readline";
|
|
32904
|
+
var SampleSchema = external_exports.object({
|
|
32905
|
+
ramTotalMb: external_exports.number(),
|
|
32906
|
+
ramAvailMb: external_exports.number(),
|
|
32907
|
+
commitLimitMb: external_exports.number(),
|
|
32908
|
+
commitAvailMb: external_exports.number(),
|
|
32909
|
+
procs: external_exports.array(
|
|
32910
|
+
external_exports.object({
|
|
32911
|
+
pid: external_exports.number().int(),
|
|
32912
|
+
name: external_exports.string().max(128),
|
|
32913
|
+
mb: external_exports.number(),
|
|
32914
|
+
prio: external_exports.enum(["idle", "below", "normal"]).catch("normal")
|
|
32915
|
+
})
|
|
32916
|
+
).max(1024)
|
|
32917
|
+
});
|
|
32774
32918
|
var MemGovProcess = class {
|
|
32775
32919
|
constructor(onSample) {
|
|
32776
32920
|
this.onSample = onSample;
|
|
@@ -32801,10 +32945,25 @@ var MemGovProcess = class {
|
|
|
32801
32945
|
}
|
|
32802
32946
|
}
|
|
32803
32947
|
setPriority(pid, to) {
|
|
32804
|
-
this.
|
|
32948
|
+
this.send("priority " + pid + " " + to);
|
|
32949
|
+
}
|
|
32950
|
+
hold(pid, ms) {
|
|
32951
|
+
this.send("suspend " + pid + " " + ms);
|
|
32952
|
+
}
|
|
32953
|
+
setMemoryPriority(pid, low) {
|
|
32954
|
+
this.send("memprio " + pid + " " + (low ? "low" : "normal"));
|
|
32955
|
+
}
|
|
32956
|
+
throttle(pid) {
|
|
32957
|
+
this.send("throttle " + pid);
|
|
32958
|
+
}
|
|
32959
|
+
setCpuRate(percent) {
|
|
32960
|
+
this.send("cpurate " + Math.round(percent));
|
|
32961
|
+
}
|
|
32962
|
+
trim(pid) {
|
|
32963
|
+
this.send("trim " + pid);
|
|
32805
32964
|
}
|
|
32806
|
-
|
|
32807
|
-
this.child?.stdin?.write(
|
|
32965
|
+
send(line) {
|
|
32966
|
+
this.child?.stdin?.write(line + "\n");
|
|
32808
32967
|
}
|
|
32809
32968
|
};
|
|
32810
32969
|
function appendToMemoryLog(line) {
|
|
@@ -32822,8 +32981,8 @@ var Governor = class {
|
|
|
32822
32981
|
core = null;
|
|
32823
32982
|
describe() {
|
|
32824
32983
|
const profile = session.loadProfile === "gentle" ? "gentle" : "normal";
|
|
32825
|
-
const
|
|
32826
|
-
return session.pressureResponse === false ? "off (sandbox.pressureResponse)" : profile + " profile: slows builds down
|
|
32984
|
+
const first = DIAL_STEPS[profile][0];
|
|
32985
|
+
return session.pressureResponse === false ? "off (sandbox.pressureResponse)" : profile + " profile: slows builds down from " + first.availablePercent + "% free RAM or " + first.commitPercent + "% commit, in steps";
|
|
32827
32986
|
}
|
|
32828
32987
|
start() {
|
|
32829
32988
|
if (session.pressureResponse === false) return;
|
|
@@ -32835,6 +32994,7 @@ var Governor = class {
|
|
|
32835
32994
|
maxCompilers: maxCompilers(os12.cpus().length, profile),
|
|
32836
32995
|
now: () => Date.now(),
|
|
32837
32996
|
logLine: appendToMemoryLog,
|
|
32997
|
+
warn,
|
|
32838
32998
|
saveStatus: (status) => {
|
|
32839
32999
|
try {
|
|
32840
33000
|
writeJsonAtomic(run.pressureFile, status);
|
|
@@ -32845,9 +33005,9 @@ var Governor = class {
|
|
|
32845
33005
|
});
|
|
32846
33006
|
proc.start();
|
|
32847
33007
|
}
|
|
32848
|
-
/** The host's watchdog: this PC is low for a while. */
|
|
32849
|
-
hostPressure(seconds, reason) {
|
|
32850
|
-
this.core?.hostPressure(seconds, reason);
|
|
33008
|
+
/** The host's watchdog: this PC is low (or nearly out of memory) for a while. */
|
|
33009
|
+
hostPressure(seconds, reason, level = "slow") {
|
|
33010
|
+
this.core?.hostPressure(seconds, reason, level);
|
|
32851
33011
|
}
|
|
32852
33012
|
};
|
|
32853
33013
|
var governor = new Governor();
|
|
@@ -32895,7 +33055,7 @@ var Daemon = class {
|
|
|
32895
33055
|
case "restart":
|
|
32896
33056
|
return sessions.restart(req);
|
|
32897
33057
|
case "pressure":
|
|
32898
|
-
return governor.hostPressure(req.seconds, req.reason);
|
|
33058
|
+
return governor.hostPressure(req.seconds, req.reason, req.level ?? "slow");
|
|
32899
33059
|
case "ping":
|
|
32900
33060
|
return respond(req.id, { ok: true, message: "pong (" + sessions.count + " session(s) running)" });
|
|
32901
33061
|
}
|