windows-development-sandbox 1.18.0 → 1.18.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. package/config.example.json +1 -1
  2. package/dist/app/features/defs.d.ts +8 -0
  3. package/dist/app/features/sandbox/sandbox.def.d.ts +12 -0
  4. package/dist/app/features/sandbox/sandbox.def.js +17 -2
  5. package/dist/app/features/sandbox/sandbox.run.d.ts +4 -0
  6. package/dist/app/features/sandbox/sandbox.run.js +4 -0
  7. package/dist/bin/agent-sandbox.js +2 -2
  8. package/dist/bin/{chunk-BKF43GJ3.js → chunk-3G53NNZP.js} +1 -1
  9. package/dist/bin/{chunk-YD3A67RS.js → chunk-FQWYCF6L.js} +984 -868
  10. package/dist/bin/{chunk-Z5D32FN3.js → chunk-M6XUQK53.js} +1 -1
  11. package/dist/bin/claude-host.js +2 -2
  12. package/dist/bin/claude-sbx.js +2 -2
  13. package/dist/bin/codex-sbx.js +2 -2
  14. package/dist/bin/gemini-sbx.js +2 -2
  15. package/dist/bin/sandbox.js +2 -2
  16. package/dist/bin/sbx-hide.js +2 -2
  17. package/dist/bin/sbx-show.js +2 -2
  18. package/dist/cli/commands/repair/checks/sandbox.d.ts +3 -1
  19. package/dist/cli/commands/repair/checks/sandbox.js +24 -0
  20. package/dist/core/config/defaults.js +1 -1
  21. package/dist/core/schema/sandbox.js +1 -1
  22. package/dist/core/schema/toolchains.js +2 -2
  23. package/dist/guest/daemon/daemon.js +1 -1
  24. package/dist/guest/daemon/heartbeat.d.ts +6 -0
  25. package/dist/guest/daemon/heartbeat.js +40 -0
  26. package/dist/guest/entries/daemon.js +2 -0
  27. package/dist/guest/governor/core.d.ts +19 -1
  28. package/dist/guest/governor/core.js +23 -1
  29. package/dist/guest/governor/decide.d.ts +14 -0
  30. package/dist/guest/governor/decide.js +52 -7
  31. package/dist/guest/governor/governor.d.ts +4 -1
  32. package/dist/guest/governor/governor.js +9 -2
  33. package/dist/guest/toolchains/native/rust-extras.d.ts +7 -0
  34. package/dist/guest/toolchains/native/rust-extras.js +26 -3
  35. package/dist/guest/toolchains/plan.js +6 -4
  36. package/dist/host/channel/channel.d.ts +1 -1
  37. package/dist/host/channel/channel.js +10 -2
  38. package/dist/host/launch/wsb-file.d.ts +6 -1
  39. package/dist/host/launch/wsb-file.js +9 -5
  40. package/dist/host/life/crash-report.d.ts +2 -0
  41. package/dist/host/life/crash-report.js +4 -0
  42. package/dist/host/life/index.d.ts +1 -0
  43. package/dist/host/life/index.js +1 -0
  44. package/dist/host/life/last-end.d.ts +21 -0
  45. package/dist/host/life/last-end.js +70 -0
  46. package/dist/host/life/watchdog.d.ts +2 -0
  47. package/dist/host/life/watchdog.js +8 -2
  48. package/dist/host/profile/claude-login.js +3 -2
  49. package/dist/runtime/agent.js +26 -3
  50. package/dist/runtime/daemon.js +367 -234
  51. package/dist/runtime/db.js +26 -3
  52. package/dist/runtime/main.js +57 -11
  53. package/dist/runtime/netproxy.js +26 -3
  54. package/dist/runtime/tool.js +26 -3
  55. package/dist/runtime/view.js +26 -3
  56. package/dist/selftest/heavy-load.test.js +95 -14
  57. package/dist/selftest/live-terminal.test.js +4 -0
  58. package/dist/shared/channel/run-dir.d.ts +4 -1
  59. package/dist/shared/channel/run-dir.js +7 -1
  60. package/dist/shared/channel/schema.d.ts +23 -0
  61. package/dist/shared/channel/schema.js +21 -0
  62. package/dist/shared/memory/policy.d.ts +10 -0
  63. package/dist/shared/memory/policy.js +17 -1
  64. package/dist/sync/watcher.js +1 -1
  65. package/dist/web/index.html +1 -1
  66. package/dist/web/{main-CWIF4VQI.js → main-6XYO5FZC.js} +43 -43
  67. package/native/csharp/HcsHost/AssemblyInfo.cs +3 -3
  68. package/native/csharp/HostTools/AssemblyInfo.cs +3 -3
  69. package/native/csharp/StorageHelper/AssemblyInfo.cs +3 -3
  70. package/package.json +1 -1
  71. package/sandbox/csharp/MemGov.cs +58 -0
  72. package/schemas/config.schema.json +3 -3
  73. package/schemas/sandbox-config.schema.json +3 -3
@@ -25442,7 +25442,7 @@ var SandboxSchema = external_exports.strictObject({
25442
25442
  '(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.'
25443
25443
  ),
25444
25444
  memoryMb: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(2048)]).describe(
25445
- '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.'
25445
+ '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 %, 4 GB more with vGPU): a bigger value is lowered.'
25446
25446
  ),
25447
25447
  maxMemoryMb: external_exports.number().int().positive().describe('Upper limit for memoryMb "auto".'),
25448
25448
  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).`),
@@ -25604,13 +25604,13 @@ var ToolchainsSchema = external_exports.strictObject({
25604
25604
  '["sccache", "cargo-nextest", "cargo-deny"]'
25605
25605
  ),
25606
25606
  targetDir: external_exports.string().min(1).describe(
25607
- `"shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`
25607
+ `"auto" (default): on the sandbox's own disk when C: has 25 GB free at boot, else "separate" (builds then write through the mapped workspace, which can overload this PC's disk). "shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`
25608
25608
  ),
25609
25609
  linker: external_exports.enum(["lld", "gnu"]).describe(
25610
25610
  `GNU host: "lld" links with Rust's own lld through MinGW's gcc (much less memory than GNU ld), "gnu" with GNU ld.`
25611
25611
  ),
25612
25612
  linkSlots: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(1).max(32)]).describe(
25613
- '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).'
25613
+ 'GNU host: how many programs may link at the same time in the whole sandbox (other links wait). "auto" = one per 6 GB of sandbox memory, 1 to 4 (the memory governor slows links down too when memory runs short).'
25614
25614
  )
25615
25615
  }),
25616
25616
  msvc: external_exports.strictObject({
@@ -27258,6 +27258,8 @@ var GuestRequestSchema = external_exports.discriminatedUnion("kind", [
27258
27258
  seconds: external_exports.number().int().min(10).max(300),
27259
27259
  /** "severe": the PC is nearly out of memory; builds go to the governor's last step at once. */
27260
27260
  level: external_exports.enum(["slow", "severe"]).optional(),
27261
+ /** The disk queue the PC reported (shown in the heartbeat). */
27262
+ diskQueue: external_exports.number().min(0).max(1e5).optional(),
27261
27263
  createdAt: TimeSchema
27262
27264
  })
27263
27265
  ]);
@@ -27280,6 +27282,21 @@ var PressureStatusSchema = external_exports.object({
27280
27282
  lastAction: Text(300),
27281
27283
  updatedAt: TimeSchema
27282
27284
  });
27285
+ var HeartbeatSchema = external_exports.object({
27286
+ at: TimeSchema,
27287
+ /** Seconds since the sandbox booted. */
27288
+ uptimeS: external_exports.number().int().min(0).max(1e9),
27289
+ ramFreePct: external_exports.number().min(0).max(100),
27290
+ commitPct: external_exports.number().min(0).max(100),
27291
+ /** The governor's dial now, and the step this PC asked for. */
27292
+ step: external_exports.number().int().min(0).max(4),
27293
+ hostStep: external_exports.number().int().min(0).max(4),
27294
+ /** The biggest programs in the agents' job. */
27295
+ topProcesses: external_exports.array(external_exports.object({ name: Text(64), privateMb: external_exports.number().int().min(0).max(1e7) })).max(5),
27296
+ /** The disk queue this PC last reported while asking the sandbox to slow down. */
27297
+ diskQueueReported: external_exports.number().min(0).max(1e5).optional(),
27298
+ phase: external_exports.enum(["ready", "working"])
27299
+ });
27283
27300
  var GuestResponseSchema = external_exports.object({
27284
27301
  id: IdSchema,
27285
27302
  ok: external_exports.boolean(),
@@ -27527,6 +27544,8 @@ var RunDir = class {
27527
27544
  vpnFile;
27528
27545
  /** What the memory governor in the sandbox is doing (pressure.json). */
27529
27546
  pressureFile;
27547
+ /** The daemon's heartbeat every 10 seconds (heartbeat.json): what the sandbox did last. */
27548
+ heartbeatFile;
27530
27549
  /** What the sandbox's programs may really use (budget.json): processors, memory, build jobs, link slots. */
27531
27550
  budgetFile;
27532
27551
  requestsDir;
@@ -27550,6 +27569,7 @@ var RunDir = class {
27550
27569
  this.sandboxFile = path5.join(this.root, "sandbox.json");
27551
27570
  this.vpnFile = path5.join(this.root, "vpn.json");
27552
27571
  this.pressureFile = path5.join(this.root, "pressure.json");
27572
+ this.heartbeatFile = path5.join(this.root, "heartbeat.json");
27553
27573
  this.budgetFile = path5.join(this.root, "budget.json");
27554
27574
  this.requestsDir = path5.join(this.root, "requests");
27555
27575
  this.responsesDir = path5.join(this.root, "responses");
@@ -27594,6 +27614,9 @@ var RunDir = class {
27594
27614
  readPressure() {
27595
27615
  return readValid(PressureStatusSchema, this.pressureFile);
27596
27616
  }
27617
+ readHeartbeat() {
27618
+ return readValid(HeartbeatSchema, this.heartbeatFile);
27619
+ }
27597
27620
  readSession(id) {
27598
27621
  return readValid(SessionStatusSchema, this.sessionFile(id));
27599
27622
  }
@@ -25459,7 +25459,7 @@ var SandboxSchema = external_exports.strictObject({
25459
25459
  '(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.'
25460
25460
  ),
25461
25461
  memoryMb: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(2048)]).describe(
25462
- '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.'
25462
+ '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 %, 4 GB more with vGPU): a bigger value is lowered.'
25463
25463
  ),
25464
25464
  maxMemoryMb: external_exports.number().int().positive().describe('Upper limit for memoryMb "auto".'),
25465
25465
  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).`),
@@ -25621,13 +25621,13 @@ var ToolchainsSchema = external_exports.strictObject({
25621
25621
  '["sccache", "cargo-nextest", "cargo-deny"]'
25622
25622
  ),
25623
25623
  targetDir: external_exports.string().min(1).describe(
25624
- `"shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`
25624
+ `"auto" (default): on the sandbox's own disk when C: has 25 GB free at boot, else "separate" (builds then write through the mapped workspace, which can overload this PC's disk). "shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`
25625
25625
  ),
25626
25626
  linker: external_exports.enum(["lld", "gnu"]).describe(
25627
25627
  `GNU host: "lld" links with Rust's own lld through MinGW's gcc (much less memory than GNU ld), "gnu" with GNU ld.`
25628
25628
  ),
25629
25629
  linkSlots: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(1).max(32)]).describe(
25630
- '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).'
25630
+ 'GNU host: how many programs may link at the same time in the whole sandbox (other links wait). "auto" = one per 6 GB of sandbox memory, 1 to 4 (the memory governor slows links down too when memory runs short).'
25631
25631
  )
25632
25632
  }),
25633
25633
  msvc: external_exports.strictObject({
@@ -27388,6 +27388,8 @@ var GuestRequestSchema = external_exports.discriminatedUnion("kind", [
27388
27388
  seconds: external_exports.number().int().min(10).max(300),
27389
27389
  /** "severe": the PC is nearly out of memory; builds go to the governor's last step at once. */
27390
27390
  level: external_exports.enum(["slow", "severe"]).optional(),
27391
+ /** The disk queue the PC reported (shown in the heartbeat). */
27392
+ diskQueue: external_exports.number().min(0).max(1e5).optional(),
27391
27393
  createdAt: TimeSchema
27392
27394
  })
27393
27395
  ]);
@@ -27410,6 +27412,21 @@ var PressureStatusSchema = external_exports.object({
27410
27412
  lastAction: Text(300),
27411
27413
  updatedAt: TimeSchema
27412
27414
  });
27415
+ var HeartbeatSchema = external_exports.object({
27416
+ at: TimeSchema,
27417
+ /** Seconds since the sandbox booted. */
27418
+ uptimeS: external_exports.number().int().min(0).max(1e9),
27419
+ ramFreePct: external_exports.number().min(0).max(100),
27420
+ commitPct: external_exports.number().min(0).max(100),
27421
+ /** The governor's dial now, and the step this PC asked for. */
27422
+ step: external_exports.number().int().min(0).max(4),
27423
+ hostStep: external_exports.number().int().min(0).max(4),
27424
+ /** The biggest programs in the agents' job. */
27425
+ topProcesses: external_exports.array(external_exports.object({ name: Text(64), privateMb: external_exports.number().int().min(0).max(1e7) })).max(5),
27426
+ /** The disk queue this PC last reported while asking the sandbox to slow down. */
27427
+ diskQueueReported: external_exports.number().min(0).max(1e5).optional(),
27428
+ phase: external_exports.enum(["ready", "working"])
27429
+ });
27413
27430
  var GuestResponseSchema = external_exports.object({
27414
27431
  id: IdSchema,
27415
27432
  ok: external_exports.boolean(),
@@ -27682,6 +27699,8 @@ var RunDir = class {
27682
27699
  vpnFile;
27683
27700
  /** What the memory governor in the sandbox is doing (pressure.json). */
27684
27701
  pressureFile;
27702
+ /** The daemon's heartbeat every 10 seconds (heartbeat.json): what the sandbox did last. */
27703
+ heartbeatFile;
27685
27704
  /** What the sandbox's programs may really use (budget.json): processors, memory, build jobs, link slots. */
27686
27705
  budgetFile;
27687
27706
  requestsDir;
@@ -27705,6 +27724,7 @@ var RunDir = class {
27705
27724
  this.sandboxFile = path6.join(this.root, "sandbox.json");
27706
27725
  this.vpnFile = path6.join(this.root, "vpn.json");
27707
27726
  this.pressureFile = path6.join(this.root, "pressure.json");
27727
+ this.heartbeatFile = path6.join(this.root, "heartbeat.json");
27708
27728
  this.budgetFile = path6.join(this.root, "budget.json");
27709
27729
  this.requestsDir = path6.join(this.root, "requests");
27710
27730
  this.responsesDir = path6.join(this.root, "responses");
@@ -27749,6 +27769,9 @@ var RunDir = class {
27749
27769
  readPressure() {
27750
27770
  return readValid(PressureStatusSchema, this.pressureFile);
27751
27771
  }
27772
+ readHeartbeat() {
27773
+ return readValid(HeartbeatSchema, this.heartbeatFile);
27774
+ }
27752
27775
  readSession(id) {
27753
27776
  return readValid(SessionStatusSchema, this.sessionFile(id));
27754
27777
  }
@@ -33786,17 +33809,39 @@ import path60 from "node:path";
33786
33809
  function buildJobs(cpus, memoryGb) {
33787
33810
  return Math.max(2, Math.min(cpus, Math.floor((memoryGb - 6) / 3)));
33788
33811
  }
33789
- function linkSlotsFor(memoryGb) {
33790
- return Math.max(2, Math.min(8, Math.floor((memoryGb - 6) / 3)));
33791
- }
33792
33812
  function cargoJobs(cpus, memoryGb, sessions) {
33793
33813
  const byCpu = Math.max(2, Math.min(8, Math.floor(cpus / 4)));
33794
33814
  const byMemory = Math.max(1, Math.floor(memoryGb / 4));
33795
33815
  const jobs = Math.min(byCpu, byMemory);
33796
33816
  return Math.max(1, Math.min(jobs, Math.floor(buildJobs(cpus, memoryGb) / Math.max(1, sessions))));
33797
33817
  }
33818
+ var LOCAL_TARGET_MIN_BYTES = 25 * 1024 ** 3;
33819
+ function chooseTargetDir(targetDir, freeBytes2) {
33820
+ if (targetDir !== "auto") return { targetDir };
33821
+ if (freeBytes2 >= LOCAL_TARGET_MIN_BYTES) return { targetDir: "local" };
33822
+ return {
33823
+ targetDir: "separate",
33824
+ warning: "Rust builds write through the mapped workspace; this can overload your PC's disk (C: has less than 25 GB free for a local build folder)"
33825
+ };
33826
+ }
33827
+
33828
+ // src/guest/governor/decide.ts
33829
+ function linkerSlots(totalMb, cpus) {
33830
+ return Math.max(1, Math.min(4, Math.max(1, Math.floor(cpus)), Math.floor(totalMb / 6144)));
33831
+ }
33798
33832
 
33799
33833
  // src/guest/toolchains/native/rust-extras.ts
33834
+ function resolveTargetDir(rust, free = freeBytes((process.env.SystemDrive ?? "C:") + "\\"), note = warn) {
33835
+ if (rust.targetDir !== "auto") return rust;
33836
+ const chosen = chooseTargetDir(rust.targetDir, free);
33837
+ if (chosen.warning) note(chosen.warning);
33838
+ return { ...rust, targetDir: chosen.targetDir };
33839
+ }
33840
+ function targetSummary(rust) {
33841
+ const target = cargoTarget(rust.targetDir);
33842
+ if (target) return "rust builds: " + target + " (CARGO_TARGET_DIR)";
33843
+ return rust.targetDir === "shared" ? "rust builds: target\\ in each project (shared with this PC)" : "rust builds: target\\sandbox in each project (on the mapped workspace)";
33844
+ }
33800
33845
  var cargoTarget = (targetDir) => {
33801
33846
  if (targetDir === "shared" || targetDir === "separate") return null;
33802
33847
  if (targetDir === "local") return path60.join(localDir, "cargo-target");
@@ -33815,8 +33860,7 @@ function linkGate(env, rust, host) {
33815
33860
  if (!host.endsWith("-pc-windows-gnu") || !exists(gcc)) return;
33816
33861
  const gate = path60.join(mkdirp(tool("shims")), "linkgate.exe");
33817
33862
  fs50.copyFileSync(ensureCompiled("linkgate"), gate);
33818
- const memoryGb = os10.totalmem() / 1024 ** 3;
33819
- const slots = rust.linkSlots === "auto" ? linkSlotsFor(memoryGb) : rust.linkSlots;
33863
+ const slots = rust.linkSlots === "auto" ? linkerSlots(os10.totalmem() / 1024 ** 2, os10.cpus().length) : rust.linkSlots;
33820
33864
  env.vars.AGENT_LINK_SLOTS = String(slots);
33821
33865
  env.vars.AGENT_REAL_LINKER = gcc;
33822
33866
  env.vars.CARGO_TARGET_X86_64_PC_WINDOWS_GNU_LINKER = gate;
@@ -33928,11 +33972,13 @@ function plan(config2, versions, o) {
33928
33972
  after: ["C/C++", "MSVC", "Visual Studio", "Unreal"],
33929
33973
  install: async (env) => {
33930
33974
  await setupRust(env, { ...config2.rust, host: rustHost(config2) }, o.refresh);
33931
- Object.assign(env.vars, rustCaches(config2.rust));
33975
+ const rust = resolveTargetDir(config2.rust);
33976
+ Object.assign(env.vars, rustCaches(rust));
33977
+ env.summary.push(targetSummary(rust));
33932
33978
  if (!dryRun) {
33933
33979
  cargoDefaults(rustHost(config2));
33934
- cargoShim(env, config2.rust);
33935
- linkGate(env, config2.rust, rustHost(config2));
33980
+ cargoShim(env, rust);
33981
+ linkGate(env, rust, rustHost(config2));
33936
33982
  }
33937
33983
  }
33938
33984
  },
@@ -25495,7 +25495,7 @@ var SandboxSchema = external_exports.strictObject({
25495
25495
  '(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.'
25496
25496
  ),
25497
25497
  memoryMb: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(2048)]).describe(
25498
- '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.'
25498
+ '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 %, 4 GB more with vGPU): a bigger value is lowered.'
25499
25499
  ),
25500
25500
  maxMemoryMb: external_exports.number().int().positive().describe('Upper limit for memoryMb "auto".'),
25501
25501
  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).`),
@@ -25657,13 +25657,13 @@ var ToolchainsSchema = external_exports.strictObject({
25657
25657
  '["sccache", "cargo-nextest", "cargo-deny"]'
25658
25658
  ),
25659
25659
  targetDir: external_exports.string().min(1).describe(
25660
- `"shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`
25660
+ `"auto" (default): on the sandbox's own disk when C: has 25 GB free at boot, else "separate" (builds then write through the mapped workspace, which can overload this PC's disk). "shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`
25661
25661
  ),
25662
25662
  linker: external_exports.enum(["lld", "gnu"]).describe(
25663
25663
  `GNU host: "lld" links with Rust's own lld through MinGW's gcc (much less memory than GNU ld), "gnu" with GNU ld.`
25664
25664
  ),
25665
25665
  linkSlots: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(1).max(32)]).describe(
25666
- '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).'
25666
+ 'GNU host: how many programs may link at the same time in the whole sandbox (other links wait). "auto" = one per 6 GB of sandbox memory, 1 to 4 (the memory governor slows links down too when memory runs short).'
25667
25667
  )
25668
25668
  }),
25669
25669
  msvc: external_exports.strictObject({
@@ -27311,6 +27311,8 @@ var GuestRequestSchema = external_exports.discriminatedUnion("kind", [
27311
27311
  seconds: external_exports.number().int().min(10).max(300),
27312
27312
  /** "severe": the PC is nearly out of memory; builds go to the governor's last step at once. */
27313
27313
  level: external_exports.enum(["slow", "severe"]).optional(),
27314
+ /** The disk queue the PC reported (shown in the heartbeat). */
27315
+ diskQueue: external_exports.number().min(0).max(1e5).optional(),
27314
27316
  createdAt: TimeSchema
27315
27317
  })
27316
27318
  ]);
@@ -27333,6 +27335,21 @@ var PressureStatusSchema = external_exports.object({
27333
27335
  lastAction: Text(300),
27334
27336
  updatedAt: TimeSchema
27335
27337
  });
27338
+ var HeartbeatSchema = external_exports.object({
27339
+ at: TimeSchema,
27340
+ /** Seconds since the sandbox booted. */
27341
+ uptimeS: external_exports.number().int().min(0).max(1e9),
27342
+ ramFreePct: external_exports.number().min(0).max(100),
27343
+ commitPct: external_exports.number().min(0).max(100),
27344
+ /** The governor's dial now, and the step this PC asked for. */
27345
+ step: external_exports.number().int().min(0).max(4),
27346
+ hostStep: external_exports.number().int().min(0).max(4),
27347
+ /** The biggest programs in the agents' job. */
27348
+ topProcesses: external_exports.array(external_exports.object({ name: Text(64), privateMb: external_exports.number().int().min(0).max(1e7) })).max(5),
27349
+ /** The disk queue this PC last reported while asking the sandbox to slow down. */
27350
+ diskQueueReported: external_exports.number().min(0).max(1e5).optional(),
27351
+ phase: external_exports.enum(["ready", "working"])
27352
+ });
27336
27353
  var GuestResponseSchema = external_exports.object({
27337
27354
  id: IdSchema,
27338
27355
  ok: external_exports.boolean(),
@@ -27518,6 +27535,8 @@ var RunDir = class {
27518
27535
  vpnFile;
27519
27536
  /** What the memory governor in the sandbox is doing (pressure.json). */
27520
27537
  pressureFile;
27538
+ /** The daemon's heartbeat every 10 seconds (heartbeat.json): what the sandbox did last. */
27539
+ heartbeatFile;
27521
27540
  /** What the sandbox's programs may really use (budget.json): processors, memory, build jobs, link slots. */
27522
27541
  budgetFile;
27523
27542
  requestsDir;
@@ -27541,6 +27560,7 @@ var RunDir = class {
27541
27560
  this.sandboxFile = path3.join(this.root, "sandbox.json");
27542
27561
  this.vpnFile = path3.join(this.root, "vpn.json");
27543
27562
  this.pressureFile = path3.join(this.root, "pressure.json");
27563
+ this.heartbeatFile = path3.join(this.root, "heartbeat.json");
27544
27564
  this.budgetFile = path3.join(this.root, "budget.json");
27545
27565
  this.requestsDir = path3.join(this.root, "requests");
27546
27566
  this.responsesDir = path3.join(this.root, "responses");
@@ -27585,6 +27605,9 @@ var RunDir = class {
27585
27605
  readPressure() {
27586
27606
  return readValid(PressureStatusSchema, this.pressureFile);
27587
27607
  }
27608
+ readHeartbeat() {
27609
+ return readValid(HeartbeatSchema, this.heartbeatFile);
27610
+ }
27588
27611
  readSession(id) {
27589
27612
  return readValid(SessionStatusSchema, this.sessionFile(id));
27590
27613
  }
@@ -26174,7 +26174,7 @@ var SandboxSchema = external_exports.strictObject({
26174
26174
  '(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.'
26175
26175
  ),
26176
26176
  memoryMb: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(2048)]).describe(
26177
- '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.'
26177
+ '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 %, 4 GB more with vGPU): a bigger value is lowered.'
26178
26178
  ),
26179
26179
  maxMemoryMb: external_exports.number().int().positive().describe('Upper limit for memoryMb "auto".'),
26180
26180
  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).`),
@@ -26336,13 +26336,13 @@ var ToolchainsSchema = external_exports.strictObject({
26336
26336
  '["sccache", "cargo-nextest", "cargo-deny"]'
26337
26337
  ),
26338
26338
  targetDir: external_exports.string().min(1).describe(
26339
- `"shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`
26339
+ `"auto" (default): on the sandbox's own disk when C: has 25 GB free at boot, else "separate" (builds then write through the mapped workspace, which can overload this PC's disk). "shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`
26340
26340
  ),
26341
26341
  linker: external_exports.enum(["lld", "gnu"]).describe(
26342
26342
  `GNU host: "lld" links with Rust's own lld through MinGW's gcc (much less memory than GNU ld), "gnu" with GNU ld.`
26343
26343
  ),
26344
26344
  linkSlots: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(1).max(32)]).describe(
26345
- '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).'
26345
+ 'GNU host: how many programs may link at the same time in the whole sandbox (other links wait). "auto" = one per 6 GB of sandbox memory, 1 to 4 (the memory governor slows links down too when memory runs short).'
26346
26346
  )
26347
26347
  }),
26348
26348
  msvc: external_exports.strictObject({
@@ -27865,6 +27865,8 @@ var GuestRequestSchema = external_exports.discriminatedUnion("kind", [
27865
27865
  seconds: external_exports.number().int().min(10).max(300),
27866
27866
  /** "severe": the PC is nearly out of memory; builds go to the governor's last step at once. */
27867
27867
  level: external_exports.enum(["slow", "severe"]).optional(),
27868
+ /** The disk queue the PC reported (shown in the heartbeat). */
27869
+ diskQueue: external_exports.number().min(0).max(1e5).optional(),
27868
27870
  createdAt: TimeSchema
27869
27871
  })
27870
27872
  ]);
@@ -27887,6 +27889,21 @@ var PressureStatusSchema = external_exports.object({
27887
27889
  lastAction: Text(300),
27888
27890
  updatedAt: TimeSchema
27889
27891
  });
27892
+ var HeartbeatSchema = external_exports.object({
27893
+ at: TimeSchema,
27894
+ /** Seconds since the sandbox booted. */
27895
+ uptimeS: external_exports.number().int().min(0).max(1e9),
27896
+ ramFreePct: external_exports.number().min(0).max(100),
27897
+ commitPct: external_exports.number().min(0).max(100),
27898
+ /** The governor's dial now, and the step this PC asked for. */
27899
+ step: external_exports.number().int().min(0).max(4),
27900
+ hostStep: external_exports.number().int().min(0).max(4),
27901
+ /** The biggest programs in the agents' job. */
27902
+ topProcesses: external_exports.array(external_exports.object({ name: Text(64), privateMb: external_exports.number().int().min(0).max(1e7) })).max(5),
27903
+ /** The disk queue this PC last reported while asking the sandbox to slow down. */
27904
+ diskQueueReported: external_exports.number().min(0).max(1e5).optional(),
27905
+ phase: external_exports.enum(["ready", "working"])
27906
+ });
27890
27907
  var GuestResponseSchema = external_exports.object({
27891
27908
  id: IdSchema,
27892
27909
  ok: external_exports.boolean(),
@@ -27958,6 +27975,8 @@ var RunDir = class {
27958
27975
  vpnFile;
27959
27976
  /** What the memory governor in the sandbox is doing (pressure.json). */
27960
27977
  pressureFile;
27978
+ /** The daemon's heartbeat every 10 seconds (heartbeat.json): what the sandbox did last. */
27979
+ heartbeatFile;
27961
27980
  /** What the sandbox's programs may really use (budget.json): processors, memory, build jobs, link slots. */
27962
27981
  budgetFile;
27963
27982
  requestsDir;
@@ -27981,6 +28000,7 @@ var RunDir = class {
27981
28000
  this.sandboxFile = path9.join(this.root, "sandbox.json");
27982
28001
  this.vpnFile = path9.join(this.root, "vpn.json");
27983
28002
  this.pressureFile = path9.join(this.root, "pressure.json");
28003
+ this.heartbeatFile = path9.join(this.root, "heartbeat.json");
27984
28004
  this.budgetFile = path9.join(this.root, "budget.json");
27985
28005
  this.requestsDir = path9.join(this.root, "requests");
27986
28006
  this.responsesDir = path9.join(this.root, "responses");
@@ -28025,6 +28045,9 @@ var RunDir = class {
28025
28045
  readPressure() {
28026
28046
  return readValid(PressureStatusSchema, this.pressureFile);
28027
28047
  }
28048
+ readHeartbeat() {
28049
+ return readValid(HeartbeatSchema, this.heartbeatFile);
28050
+ }
28028
28051
  readSession(id) {
28029
28052
  return readValid(SessionStatusSchema, this.sessionFile(id));
28030
28053
  }
@@ -26070,7 +26070,7 @@ var SandboxSchema = external_exports.strictObject({
26070
26070
  '(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.'
26071
26071
  ),
26072
26072
  memoryMb: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(2048)]).describe(
26073
- '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.'
26073
+ '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 %, 4 GB more with vGPU): a bigger value is lowered.'
26074
26074
  ),
26075
26075
  maxMemoryMb: external_exports.number().int().positive().describe('Upper limit for memoryMb "auto".'),
26076
26076
  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).`),
@@ -26232,13 +26232,13 @@ var ToolchainsSchema = external_exports.strictObject({
26232
26232
  '["sccache", "cargo-nextest", "cargo-deny"]'
26233
26233
  ),
26234
26234
  targetDir: external_exports.string().min(1).describe(
26235
- `"shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`
26235
+ `"auto" (default): on the sandbox's own disk when C: has 25 GB free at boot, else "separate" (builds then write through the mapped workspace, which can overload this PC's disk). "shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`
26236
26236
  ),
26237
26237
  linker: external_exports.enum(["lld", "gnu"]).describe(
26238
26238
  `GNU host: "lld" links with Rust's own lld through MinGW's gcc (much less memory than GNU ld), "gnu" with GNU ld.`
26239
26239
  ),
26240
26240
  linkSlots: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(1).max(32)]).describe(
26241
- '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).'
26241
+ 'GNU host: how many programs may link at the same time in the whole sandbox (other links wait). "auto" = one per 6 GB of sandbox memory, 1 to 4 (the memory governor slows links down too when memory runs short).'
26242
26242
  )
26243
26243
  }),
26244
26244
  msvc: external_exports.strictObject({
@@ -27886,6 +27886,8 @@ var GuestRequestSchema = external_exports.discriminatedUnion("kind", [
27886
27886
  seconds: external_exports.number().int().min(10).max(300),
27887
27887
  /** "severe": the PC is nearly out of memory; builds go to the governor's last step at once. */
27888
27888
  level: external_exports.enum(["slow", "severe"]).optional(),
27889
+ /** The disk queue the PC reported (shown in the heartbeat). */
27890
+ diskQueue: external_exports.number().min(0).max(1e5).optional(),
27889
27891
  createdAt: TimeSchema
27890
27892
  })
27891
27893
  ]);
@@ -27908,6 +27910,21 @@ var PressureStatusSchema = external_exports.object({
27908
27910
  lastAction: Text(300),
27909
27911
  updatedAt: TimeSchema
27910
27912
  });
27913
+ var HeartbeatSchema = external_exports.object({
27914
+ at: TimeSchema,
27915
+ /** Seconds since the sandbox booted. */
27916
+ uptimeS: external_exports.number().int().min(0).max(1e9),
27917
+ ramFreePct: external_exports.number().min(0).max(100),
27918
+ commitPct: external_exports.number().min(0).max(100),
27919
+ /** The governor's dial now, and the step this PC asked for. */
27920
+ step: external_exports.number().int().min(0).max(4),
27921
+ hostStep: external_exports.number().int().min(0).max(4),
27922
+ /** The biggest programs in the agents' job. */
27923
+ topProcesses: external_exports.array(external_exports.object({ name: Text(64), privateMb: external_exports.number().int().min(0).max(1e7) })).max(5),
27924
+ /** The disk queue this PC last reported while asking the sandbox to slow down. */
27925
+ diskQueueReported: external_exports.number().min(0).max(1e5).optional(),
27926
+ phase: external_exports.enum(["ready", "working"])
27927
+ });
27911
27928
  var GuestResponseSchema = external_exports.object({
27912
27929
  id: IdSchema,
27913
27930
  ok: external_exports.boolean(),
@@ -28093,6 +28110,8 @@ var RunDir = class {
28093
28110
  vpnFile;
28094
28111
  /** What the memory governor in the sandbox is doing (pressure.json). */
28095
28112
  pressureFile;
28113
+ /** The daemon's heartbeat every 10 seconds (heartbeat.json): what the sandbox did last. */
28114
+ heartbeatFile;
28096
28115
  /** What the sandbox's programs may really use (budget.json): processors, memory, build jobs, link slots. */
28097
28116
  budgetFile;
28098
28117
  requestsDir;
@@ -28116,6 +28135,7 @@ var RunDir = class {
28116
28135
  this.sandboxFile = path5.join(this.root, "sandbox.json");
28117
28136
  this.vpnFile = path5.join(this.root, "vpn.json");
28118
28137
  this.pressureFile = path5.join(this.root, "pressure.json");
28138
+ this.heartbeatFile = path5.join(this.root, "heartbeat.json");
28119
28139
  this.budgetFile = path5.join(this.root, "budget.json");
28120
28140
  this.requestsDir = path5.join(this.root, "requests");
28121
28141
  this.responsesDir = path5.join(this.root, "responses");
@@ -28160,6 +28180,9 @@ var RunDir = class {
28160
28180
  readPressure() {
28161
28181
  return readValid(PressureStatusSchema, this.pressureFile);
28162
28182
  }
28183
+ readHeartbeat() {
28184
+ return readValid(HeartbeatSchema, this.heartbeatFile);
28185
+ }
28163
28186
  readSession(id) {
28164
28187
  return readValid(SessionStatusSchema, this.sessionFile(id));
28165
28188
  }