windows-development-sandbox 1.23.2 → 1.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/config.example.json +0 -1
  2. package/dist/bin/agent-sandbox.js +2 -2
  3. package/dist/bin/{chunk-USTRSHIE.js → chunk-IZRGTSQ5.js} +158 -131
  4. package/dist/bin/{chunk-QFSJX2KW.js → chunk-KH4MI2U5.js} +1 -1
  5. package/dist/bin/{chunk-7YPEDAJD.js → chunk-SUYYVIDW.js} +1 -1
  6. package/dist/bin/claude-host.js +2 -2
  7. package/dist/bin/claude-sbx.js +2 -2
  8. package/dist/bin/codex-sbx.js +2 -2
  9. package/dist/bin/gemini-sbx.js +2 -2
  10. package/dist/bin/sandbox.js +2 -2
  11. package/dist/bin/sbx-hide.js +2 -2
  12. package/dist/bin/sbx-show.js +2 -2
  13. package/dist/core/config/defaults.js +0 -1
  14. package/dist/core/detect/toolchains.js +0 -6
  15. package/dist/core/schema/config.d.ts +1 -2
  16. package/dist/core/schema/toolchains.d.ts +1 -2
  17. package/dist/core/schema/toolchains.js +3 -6
  18. package/dist/guest/agents/agent-files.d.ts +11 -7
  19. package/dist/guest/agents/agent-files.js +37 -11
  20. package/dist/guest/agents/local-state.d.ts +2 -1
  21. package/dist/guest/agents/local-state.js +2 -1
  22. package/dist/guest/boot/boot-console.d.ts +28 -0
  23. package/dist/guest/boot/boot-console.js +98 -0
  24. package/dist/guest/boot/boot.d.ts +8 -1
  25. package/dist/guest/boot/boot.js +66 -42
  26. package/dist/guest/boot/graph.d.ts +9 -5
  27. package/dist/guest/boot/graph.js +8 -2
  28. package/dist/guest/boot/progress-view.d.ts +116 -0
  29. package/dist/guest/boot/progress-view.js +456 -0
  30. package/dist/guest/boot/runner.d.ts +20 -10
  31. package/dist/guest/boot/runner.js +39 -47
  32. package/dist/guest/runtime/log-line.d.ts +7 -0
  33. package/dist/guest/runtime/log-line.js +18 -0
  34. package/dist/guest/runtime/log.d.ts +17 -4
  35. package/dist/guest/runtime/log.js +40 -17
  36. package/dist/guest/runtime/process.d.ts +9 -0
  37. package/dist/guest/runtime/process.js +69 -8
  38. package/dist/guest/setup/environment.js +9 -4
  39. package/dist/guest/setup/hooks.d.ts +2 -0
  40. package/dist/guest/setup/hooks.js +4 -0
  41. package/dist/guest/setup/path-plan.d.ts +12 -0
  42. package/dist/guest/setup/path-plan.js +18 -0
  43. package/dist/guest/toolchains/native/unreal.js +4 -6
  44. package/dist/guest/toolchains/native/visual-studio.d.ts +14 -14
  45. package/dist/guest/toolchains/native/visual-studio.js +145 -174
  46. package/dist/guest/toolchains/native/vs-persist.d.ts +189 -0
  47. package/dist/guest/toolchains/native/vs-persist.js +256 -0
  48. package/dist/guest/toolchains/native/vs-request.d.ts +6 -26
  49. package/dist/guest/toolchains/native/vs-request.js +16 -50
  50. package/dist/guest/toolchains/plan.js +11 -14
  51. package/dist/host/migrate/migrations/drop-vs-install-files.d.ts +5 -0
  52. package/dist/host/migrate/migrations/drop-vs-install-files.js +34 -0
  53. package/dist/host/migrate/registry.js +7 -1
  54. package/dist/runtime/agent.js +67 -26
  55. package/dist/runtime/daemon.js +958 -716
  56. package/dist/runtime/db.js +67 -26
  57. package/dist/runtime/main.js +1792 -1038
  58. package/dist/runtime/netproxy.js +3 -6
  59. package/dist/runtime/tool.js +44 -24
  60. package/dist/runtime/view.js +4 -7
  61. package/dist/selftest/agent-paths.test.js +17 -1
  62. package/dist/selftest/agent-settings.test.js +36 -5
  63. package/dist/selftest/boot-console.test.d.ts +2 -0
  64. package/dist/selftest/boot-console.test.js +291 -0
  65. package/dist/selftest/boot-runner.test.js +10 -12
  66. package/dist/selftest/guest-boot.test.js +7 -1
  67. package/dist/selftest/index.js +2 -0
  68. package/dist/selftest/layout.test.js +4 -0
  69. package/dist/selftest/migrate.test.js +21 -0
  70. package/dist/selftest/persisted-installs.test.js +169 -33
  71. package/dist/selftest/support/engine-golden.js +2 -0
  72. package/dist/selftest/support/fixtures.d.ts +1 -2
  73. package/dist/shared/channel/schema.d.ts +3 -6
  74. package/dist/shared/pty/terminal.js +2 -1
  75. package/dist/sync/watcher.js +5 -1
  76. package/native/csharp/HcsHost/AssemblyInfo.cs +3 -3
  77. package/native/csharp/HostTools/AssemblyInfo.cs +3 -3
  78. package/native/csharp/StorageHelper/AssemblyInfo.cs +3 -3
  79. package/package.json +1 -1
  80. package/sandbox/scripts/restore-visual-studio.ps1 +78 -0
  81. package/sandbox/scripts/save-visual-studio.ps1 +106 -0
  82. package/schemas/config.schema.json +3 -7
  83. package/schemas/sandbox-config.schema.json +3 -7
  84. package/dist/guest/toolchains/native/autosdk.d.ts +0 -3
  85. package/dist/guest/toolchains/native/autosdk.js +0 -50
@@ -25669,7 +25669,7 @@ var ToolchainsSchema = external_exports.strictObject({
25669
25669
  }),
25670
25670
  unreal: external_exports.strictObject({
25671
25671
  enabled: enabled(
25672
- "Unreal Engine development: Visual Studio Community 2022 with the C++ game workload (MSVC, a Windows 11 SDK, .NET Framework targeting packs, Unreal integration and the Epic Games Launcher) and the DirectX End-User Runtime. A real installer: it runs every boot (~10 GB on the sandbox disk). The engine itself comes from the Epic Games Launcher or its source.",
25672
+ "Unreal Engine development: Visual Studio Community 2022 with the C++ game workload (MSVC, a Windows 11 SDK, .NET Framework targeting packs, Unreal integration and the Epic Games Launcher) and the DirectX End-User Runtime. Visual Studio is installed once and kept on the data disk (~6.5 GB); later boots put it back in seconds. The engine itself comes from the Epic Games Launcher or its source.",
25673
25673
  "a .uproject or .uplugin"
25674
25674
  ),
25675
25675
  acceptLicense: external_exports.boolean().describe(
@@ -25678,11 +25678,8 @@ var ToolchainsSchema = external_exports.strictObject({
25678
25678
  components: StringsSchema.describe(
25679
25679
  'More Visual Studio workload or component IDs to add, e.g. ["Microsoft.VisualStudio.Component.VC.Llvm.Clang"].'
25680
25680
  ),
25681
- keepInstallFiles: external_exports.boolean().describe(
25682
- "Keep an offline copy of the Visual Studio install files in tools\\visualstudio (~10 GB, made once), so later boots install without downloading them again. Skipped while that disk has too little room."
25683
- ),
25684
- visualStudio: external_exports.enum(["full", "autosdk"]).describe(
25685
- `"full": install Visual Studio Community (the engine finds it through the Setup API; ~10 GB, redone every boot). "autosdk" (experimental): skip Visual Studio and build an Unreal AutoSDK tree from the portable MSVC in tools\\unreal\\autosdk (kept between sandboxes); UnrealBuildTool finds MSVC through AutoSDK, but the editor's Visual Studio integration is not available. Needs toolchains.msvc (turned on for you).`
25681
+ visualStudio: external_exports.enum(["full", "buildtools"]).describe(
25682
+ '"full": Visual Studio Community with the C++ game workload (the IDE, its debugger and Unreal integration). "buildtools": only the Visual Studio Build Tools (MSVC, the Windows SDK and the .NET Framework parts UnrealBuildTool needs; no IDE). Either is installed once and kept on the data disk (tools\\visualstudio\\persist, ~6.5 GB for Community); later boots put it back in seconds.'
25686
25683
  ),
25687
25684
  persistEngines: external_exports.boolean().describe(
25688
25685
  "Engines the Epic Games Launcher installs go to tools\\unreal\\engines (kept between sandboxes, 40-60 GB each) and are registered with the launcher again every boot. Off: they go on the sandbox disk and are lost when it closes. Engines installed on this PC can be mapped instead (pcInstalls.unrealEngines)."
@@ -27852,36 +27849,45 @@ function mkdirp(p) {
27852
27849
  import fs6 from "node:fs";
27853
27850
  import path7 from "node:path";
27854
27851
  import { AsyncLocalStorage } from "node:async_hooks";
27852
+
27853
+ // src/guest/runtime/log-line.ts
27854
+ var ESCAPES = /\x1b\[[0-9;?]{0,32}[A-Za-z]/g;
27855
+ function plainText(text) {
27856
+ return text.replace(ESCAPES, "");
27857
+ }
27858
+ function fileLines(message, at = /* @__PURE__ */ new Date(), task) {
27859
+ const stamp = at.toISOString() + " " + (task ? "[" + task + "] " : "");
27860
+ return plainText(message).split(/\r?\n/).filter((line) => line.trim() !== "").map((line) => stamp + line.trimEnd());
27861
+ }
27862
+
27863
+ // src/guest/runtime/log.ts
27855
27864
  fs6.mkdirSync(logsDir, { recursive: true });
27856
27865
  var logFile = path7.join(
27857
27866
  logsDir,
27858
27867
  (process.env.AGENT_LOG_PREFIX ?? "guest") + "-" + (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-") + ".log"
27859
27868
  );
27860
27869
  var context = new AsyncLocalStorage();
27861
- function fileLine(message, at = /* @__PURE__ */ new Date()) {
27862
- return at.toISOString() + " " + message;
27863
- }
27864
- var append = (line) => {
27870
+ var sink = null;
27871
+ var append = (message, ctx) => {
27865
27872
  try {
27866
- fs6.appendFileSync(logFile, fileLine(line) + "\n");
27873
+ const lines = fileLines(message, /* @__PURE__ */ new Date(), ctx?.task);
27874
+ if (lines.length) fs6.appendFileSync(logFile, lines.join("\n") + "\n");
27867
27875
  } catch {
27868
27876
  }
27869
27877
  };
27870
- var tagged = (message, ctx) => {
27871
- const prefix = ctx?.prefix?.();
27872
- return prefix ? prefix + " | " + message : message;
27873
- };
27874
27878
  function log(message) {
27875
27879
  const ctx = context.getStore();
27876
- const line = tagged(message, ctx);
27877
- if (!ctx?.quiet) console.log(line);
27878
- append(line);
27880
+ append(message, ctx);
27881
+ if (ctx?.quiet) return;
27882
+ if (sink) sink.line(message, ctx?.stage);
27883
+ else console.log(message);
27879
27884
  }
27880
27885
  function warn(message) {
27881
27886
  const ctx = context.getStore();
27882
- const line = tagged(message, ctx);
27883
- if (!ctx?.quiet) console.warn("\x1B[33mWARNING: " + line + "\x1B[0m");
27884
- append("WARNING: " + line);
27887
+ append("WARNING: " + message, ctx);
27888
+ if (ctx?.quiet) return;
27889
+ if (sink) sink.warning(message);
27890
+ else console.warn("\x1B[33mWARNING: " + message + "\x1B[0m");
27885
27891
  }
27886
27892
 
27887
27893
  // src/guest/toolchains/tool-env.ts
@@ -28177,24 +28183,56 @@ var githubAssetFromPage = async (repo, pattern, searchOlder) => {
28177
28183
  };
28178
28184
 
28179
28185
  // src/guest/runtime/process.ts
28186
+ var outputSink = null;
28187
+ var captureOutput = () => outputSink?.capturing() ?? false;
28188
+ function logOutput(text) {
28189
+ for (const line of text.split(/\r?\n/)) if (line.trim()) outputSink?.line(line.trimEnd());
28190
+ }
28191
+ var CAPTURE_BYTES = 64 * 1024 * 1024;
28192
+ var LINE_CHARS = 2e3;
28193
+ function logLines(stream) {
28194
+ if (!stream) return;
28195
+ let partial2 = "";
28196
+ stream.setEncoding("utf8");
28197
+ stream.on("data", (chunk) => {
28198
+ const lines = (partial2 + chunk).split(/\r?\n/);
28199
+ partial2 = lines.pop().slice(0, LINE_CHARS);
28200
+ logOutput(lines.map((l) => l.slice(0, LINE_CHARS)).join("\n"));
28201
+ });
28202
+ stream.on("end", () => logOutput(partial2));
28203
+ }
28180
28204
  async function execAsync(file2, args, options = {}) {
28181
- const code = await spawnAsync(file2, args, { stdio: "inherit", ...options });
28205
+ const code = captureOutput() ? await new Promise((resolve, reject) => {
28206
+ const child = spawn2(file2, args, { stdio: ["inherit", "pipe", "pipe"], windowsHide: true, ...options });
28207
+ logLines(child.stdout);
28208
+ logLines(child.stderr);
28209
+ child.once("error", reject);
28210
+ child.once("close", (c) => resolve(c ?? -1));
28211
+ }) : await spawnAsync(file2, args, { stdio: "inherit", ...options });
28182
28212
  if (code !== 0)
28183
28213
  throw new Error(path11.basename(file2) + " " + args.slice(0, 3).join(" ") + " failed with exit code " + code);
28184
28214
  }
28215
+ function scriptErrors(errors) {
28216
+ if (!errors) return;
28217
+ if (captureOutput()) logOutput(errors);
28218
+ else process.stderr.write(errors + "\n");
28219
+ }
28185
28220
  function execOutput(file2, args, options = {}) {
28186
28221
  const result = spawnSync(file2, args, { encoding: "utf8", windowsHide: true, ...options });
28187
28222
  return result.status === 0 ? String(result.stdout ?? "").trim() : "";
28188
28223
  }
28189
28224
  function runScript(name, args = []) {
28225
+ const capture = captureOutput();
28190
28226
  const result = spawnSync(SYSTEM.powershell(), scriptArgs(name, args), {
28191
- stdio: ["inherit", "inherit", "pipe"],
28227
+ stdio: ["inherit", capture ? "pipe" : "inherit", "pipe"],
28192
28228
  encoding: "utf8",
28193
- windowsHide: true
28229
+ windowsHide: true,
28230
+ ...capture ? { maxBuffer: CAPTURE_BYTES } : {}
28194
28231
  });
28232
+ if (capture) logOutput(String(result.stdout ?? ""));
28195
28233
  if (result.error) throw result.error;
28196
28234
  const errors = String(result.stderr ?? "").trim();
28197
- if (errors) process.stderr.write(errors + "\n");
28235
+ scriptErrors(errors);
28198
28236
  if (result.status !== 0)
28199
28237
  throw new Error(name + " failed with exit code " + result.status + (errors ? ": " + errors.slice(0, 400) : ""));
28200
28238
  }
@@ -28381,9 +28419,12 @@ function agentCommand(name, harness) {
28381
28419
  return harness.npmBin ?? harness.uvBin ?? (harness.hostExecutable ?? name).replace(/\.exe$/i, "");
28382
28420
  }
28383
28421
  var CODEX_MARKER = "# Set by the sandbox";
28422
+ var CODEX_MARKER_LINE = CODEX_MARKER + " from its codex settings (`sandbox config`); a line of your own without it wins.";
28423
+ var CODEX_MARKERS = [CODEX_MARKER, "# agent-sandbox:"];
28424
+ var CODEX_OWNED_KEYS = ["sandbox_mode", "approval_policy", "model", "model_reasoning_effort"];
28384
28425
  var MAX_CODEX_CONFIG_BYTES = 1024 * 1024;
28385
28426
  var MARKED_LINES = new RegExp(
28386
- "^" + CODEX_MARKER + "[^\r\n]*\r?\n(?:(?:sandbox_mode|approval_policy)[ ]*=[^\r\n]*\r?\n)*(?:[ ]*\r?\n)?",
28427
+ "^(?:" + CODEX_MARKERS.join("|") + ")[^\r\n]*\r?\n(?:(?:" + CODEX_OWNED_KEYS.join("|") + ")[ ]*=[^\r\n]*(?:\r?\n|$))*(?:[ ]*\r?\n)?",
28387
28428
  "m"
28388
28429
  );
28389
28430