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
@@ -8,9 +8,9 @@ using System.Runtime.InteropServices;
8
8
  [assembly: AssemblyCompany("windows-development-sandbox (open source)")]
9
9
  [assembly: AssemblyProduct("Windows Development Sandbox")]
10
10
  [assembly: AssemblyCopyright("MIT License, windows-development-sandbox contributors")]
11
- [assembly: AssemblyVersion("1.18.0.0")]
12
- [assembly: AssemblyFileVersion("1.18.0.0")]
13
- [assembly: AssemblyInformationalVersion("1.18.0")]
11
+ [assembly: AssemblyVersion("1.18.3.0")]
12
+ [assembly: AssemblyFileVersion("1.18.3.0")]
13
+ [assembly: AssemblyInformationalVersion("1.18.3")]
14
14
  [assembly: ComVisible(false)]
15
15
  // computecore.dll and computestorage.dll are not KnownDLLs: load them from System32 only, never from the exe's folder.
16
16
  [assembly: DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
@@ -8,7 +8,7 @@ using System.Runtime.InteropServices;
8
8
  [assembly: AssemblyCompany("windows-development-sandbox (open source)")]
9
9
  [assembly: AssemblyProduct("Windows Development Sandbox")]
10
10
  [assembly: AssemblyCopyright("MIT License, windows-development-sandbox contributors")]
11
- [assembly: AssemblyVersion("1.18.0.0")]
12
- [assembly: AssemblyFileVersion("1.18.0.0")]
13
- [assembly: AssemblyInformationalVersion("1.18.0")]
11
+ [assembly: AssemblyVersion("1.18.3.0")]
12
+ [assembly: AssemblyFileVersion("1.18.3.0")]
13
+ [assembly: AssemblyInformationalVersion("1.18.3")]
14
14
  [assembly: ComVisible(false)]
@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
9
9
  [assembly: AssemblyCompany("windows-development-sandbox (open source)")]
10
10
  [assembly: AssemblyProduct("Windows Development Sandbox")]
11
11
  [assembly: AssemblyCopyright("MIT License, windows-development-sandbox contributors")]
12
- [assembly: AssemblyVersion("1.18.0.0")]
13
- [assembly: AssemblyFileVersion("1.18.0.0")]
14
- [assembly: AssemblyInformationalVersion("1.18.0")]
12
+ [assembly: AssemblyVersion("1.18.3.0")]
13
+ [assembly: AssemblyFileVersion("1.18.3.0")]
14
+ [assembly: AssemblyInformationalVersion("1.18.3")]
15
15
  [assembly: ComVisible(false)]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "windows-development-sandbox",
3
- "version": "1.18.0",
3
+ "version": "1.18.3",
4
4
  "description": "A disposable Windows Sandbox for development, with or without an AI agent (Claude Code, Codex, Gemini, opencode, ...): the folder you run it from is the workspace, toolchains and databases for your project install themselves, and nothing else on your PC is reachable.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -6,6 +6,7 @@
6
6
  // procs = the processes in the agents' job (the job ptyhost makes for everything the agents start), nothing else.
7
7
  // stdin, one command per line:
8
8
  // priority <pid> <idle|below|normal> lowers (or restores) the priority of a process in that job
9
+ // iopriority <pid> <verylow|low|normal> the disk queue priority of a process in that job
9
10
  // suspend <pid> <ms> pauses a process in that job, resumes it after ms (at most 30000)
10
11
  // exit
11
12
  //
@@ -45,6 +46,11 @@ static class MemGov
45
46
  private const int ProcessMemoryPriorityClass = 0;
46
47
  private const uint MemoryPriorityLow = 2;
47
48
  private const uint MemoryPriorityNormal = 5;
49
+ // NtSetInformationProcess(ProcessIoPriority): IO_PRIORITY_HINT VeryLow = 0, Low = 1, Normal = 2.
50
+ private const int ProcessIoPriority = 33;
51
+ private const int IoPriorityVeryLow = 0;
52
+ private const int IoPriorityLow = 1;
53
+ private const int IoPriorityNormal = 2;
48
54
 
49
55
  // JOBOBJECT_CPU_RATE_CONTROL_INFORMATION (CpuRate in hundredths of a percent).
50
56
  [StructLayout(LayoutKind.Sequential)]
@@ -133,6 +139,13 @@ static class MemGov
133
139
  [DllImport("kernel32.dll", EntryPoint = "K32GetProcessMemoryInfo", SetLastError = true)]
134
140
  public static extern bool GetProcessMemoryInfo(IntPtr process, ref MemoryCounters counters, uint size);
135
141
 
142
+ // NTSTATUS, not Win32: SetLastError does not apply, the status is the result (0 = success).
143
+ [DllImport("ntdll.dll")]
144
+ public static extern int NtSetInformationProcess(IntPtr process, int infoClass, ref int info, int length);
145
+
146
+ [DllImport("ntdll.dll")]
147
+ public static extern uint RtlNtStatusToDosError(int status);
148
+
136
149
  [DllImport("ntdll.dll")]
137
150
  public static extern int NtSuspendProcess(IntPtr process);
138
151
 
@@ -397,6 +410,14 @@ static class MemGov
397
410
  {
398
411
  SetMemoryPriority(pid, parts[2] == "low" ? MemoryPriorityLow : MemoryPriorityNormal);
399
412
  }
413
+ else if (parts[0] == "iopriority")
414
+ {
415
+ int level = ParseIoPriority(parts[2]);
416
+ if (level >= 0)
417
+ {
418
+ SetIoPriority(pid, level);
419
+ }
420
+ }
400
421
  else if (parts[0] == "priority")
401
422
  {
402
423
  uint cls = parts[2] == "idle" ? IdleClass : parts[2] == "below" ? BelowNormalClass : NormalClass;
@@ -487,6 +508,43 @@ static class MemGov
487
508
  }
488
509
  }
489
510
 
511
+ /// <summary>verylow, low or normal to the IO priority value; -1 when it is none of them.</summary>
512
+ private static int ParseIoPriority(string word)
513
+ {
514
+ if (word == "verylow")
515
+ {
516
+ return IoPriorityVeryLow;
517
+ }
518
+ if (word == "low")
519
+ {
520
+ return IoPriorityLow;
521
+ }
522
+ return word == "normal" ? IoPriorityNormal : -1;
523
+ }
524
+
525
+ /// <summary>The process's disk requests queue behind the others' (needs no privilege for very low and low).</summary>
526
+ private static void SetIoPriority(int pid, int level)
527
+ {
528
+ IntPtr process = NativeMethods.OpenProcess(ProcessSetInformation, false, pid);
529
+ if (process == IntPtr.Zero)
530
+ {
531
+ return;
532
+ }
533
+ try
534
+ {
535
+ int value = level;
536
+ int status = NativeMethods.NtSetInformationProcess(process, ProcessIoPriority, ref value, sizeof(int));
537
+ if (status != 0)
538
+ {
539
+ throw new Win32Exception((int)NativeMethods.RtlNtStatusToDosError(status));
540
+ }
541
+ }
542
+ finally
543
+ {
544
+ NativeMethods.CloseHandle(process);
545
+ }
546
+ }
547
+
490
548
  /// <summary>A waiting compiler's pages go to the paging file now, so the ones that run have the RAM.</summary>
491
549
  private static void Trim(int pid)
492
550
  {
@@ -144,7 +144,7 @@
144
144
  "maximum": 9007199254740991
145
145
  }
146
146
  ],
147
- "description": "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."
147
+ "description": "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."
148
148
  },
149
149
  "maxMemoryMb": {
150
150
  "type": "integer",
@@ -772,7 +772,7 @@
772
772
  "targetDir": {
773
773
  "type": "string",
774
774
  "minLength": 1,
775
- "description": "\"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."
775
+ "description": "\"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."
776
776
  },
777
777
  "linker": {
778
778
  "type": "string",
@@ -794,7 +794,7 @@
794
794
  "maximum": 32
795
795
  }
796
796
  ],
797
- "description": "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)."
797
+ "description": "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)."
798
798
  }
799
799
  },
800
800
  "additionalProperties": false
@@ -105,7 +105,7 @@
105
105
  "maximum": 9007199254740991
106
106
  }
107
107
  ],
108
- "description": "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."
108
+ "description": "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."
109
109
  },
110
110
  "vGpu": {
111
111
  "type": "boolean",
@@ -457,7 +457,7 @@
457
457
  "targetDir": {
458
458
  "type": "string",
459
459
  "minLength": 1,
460
- "description": "\"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."
460
+ "description": "\"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."
461
461
  },
462
462
  "linker": {
463
463
  "type": "string",
@@ -479,7 +479,7 @@
479
479
  "maximum": 32
480
480
  }
481
481
  ],
482
- "description": "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)."
482
+ "description": "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)."
483
483
  }
484
484
  },
485
485
  "additionalProperties": false