windows-development-sandbox 1.18.3 → 1.20.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 (216) hide show
  1. package/README.md +1 -1
  2. package/config.example.json +9 -0
  3. package/dist/app/features/accounts/accounts.def.d.ts +4 -0
  4. package/dist/app/features/accounts/accounts.run.d.ts +1 -0
  5. package/dist/app/features/accounts/services.def.d.ts +3 -0
  6. package/dist/app/features/accounts/services.def.js +4 -2
  7. package/dist/app/features/accounts/services.run.d.ts +1 -0
  8. package/dist/app/features/accounts/services.run.js +3 -1
  9. package/dist/app/features/agent-commands/agent-commands.def.d.ts +37 -0
  10. package/dist/app/features/agent-commands/agent-commands.def.js +91 -0
  11. package/dist/app/features/agent-commands/agent-commands.run.d.ts +28 -0
  12. package/dist/app/features/agent-commands/agent-commands.run.js +35 -0
  13. package/dist/app/features/agent-commands/index.d.ts +2 -0
  14. package/dist/app/features/agent-commands/index.js +3 -0
  15. package/dist/app/features/agents/agents.def.d.ts +14 -1
  16. package/dist/app/features/agents/agents.def.js +61 -6
  17. package/dist/app/features/agents/agents.run.d.ts +1 -0
  18. package/dist/app/features/agents/agents.run.js +8 -1
  19. package/dist/app/features/agents/claude-env.def.d.ts +36 -0
  20. package/dist/app/features/agents/claude-env.def.js +305 -0
  21. package/dist/app/features/agents/env.def.d.ts +163 -0
  22. package/dist/app/features/agents/env.def.js +184 -0
  23. package/dist/app/features/agents/env.run.d.ts +43 -0
  24. package/dist/app/features/agents/env.run.js +86 -0
  25. package/dist/app/features/agents/index.d.ts +2 -0
  26. package/dist/app/features/agents/index.js +2 -0
  27. package/dist/app/features/defs.d.ts +150 -1
  28. package/dist/app/features/defs.js +11 -1
  29. package/dist/app/features/sandbox/sandbox.def.d.ts +22 -0
  30. package/dist/app/features/sandbox/sandbox.def.js +41 -14
  31. package/dist/app/features/sandbox/sandbox.run.d.ts +20 -0
  32. package/dist/app/features/sandbox/sandbox.run.js +41 -1
  33. package/dist/app/features/settings/categories.def.js +5 -2
  34. package/dist/app/features/settings/settings-rows.js +5 -1
  35. package/dist/app/features/settings/settings.run.d.ts +8 -0
  36. package/dist/app/features/settings/settings.run.js +9 -0
  37. package/dist/app/features/updates/updates.run.js +12 -2
  38. package/dist/app/features/vpn/vpn.def.d.ts +33 -0
  39. package/dist/app/features/vpn/vpn.def.js +30 -6
  40. package/dist/app/features/vpn/vpn.run.d.ts +11 -0
  41. package/dist/app/features/vpn/vpn.run.js +4 -1
  42. package/dist/app/kernel/rpc.d.ts +1 -1
  43. package/dist/app/registry.js +9 -2
  44. package/dist/bin/agent-sandbox.js +2 -2
  45. package/dist/bin/{chunk-M6XUQK53.js → chunk-2IMT7ZCT.js} +1 -1
  46. package/dist/bin/{chunk-3G53NNZP.js → chunk-DK4NTBUF.js} +69 -26
  47. package/dist/bin/{chunk-FQWYCF6L.js → chunk-Z2P5OGKL.js} +6427 -5259
  48. package/dist/bin/claude-host.js +2 -2
  49. package/dist/bin/claude-sbx.js +2 -2
  50. package/dist/bin/codex-sbx.js +2 -2
  51. package/dist/bin/gemini-sbx.js +2 -2
  52. package/dist/bin/sandbox.js +2 -2
  53. package/dist/bin/sbx-hide.js +2 -2
  54. package/dist/bin/sbx-show.js +2 -2
  55. package/dist/cli/commands/agent-commands.d.ts +0 -1
  56. package/dist/cli/commands/agent-commands.js +2 -32
  57. package/dist/cli/commands/index.d.ts +1 -1
  58. package/dist/cli/commands/index.js +1 -1
  59. package/dist/cli/commands/launch/launch.js +6 -3
  60. package/dist/cli/commands/launch/leftover-offer.d.ts +3 -0
  61. package/dist/cli/commands/launch/leftover-offer.js +26 -0
  62. package/dist/cli/commands/registry.js +3 -2
  63. package/dist/cli/commands/repair/checks/sandbox.js +29 -2
  64. package/dist/cli/manifest.d.ts +1 -1
  65. package/dist/cli/manifest.js +1 -1
  66. package/dist/cli/menu/menu.d.ts +1 -1
  67. package/dist/cli/menu/menu.js +3 -3
  68. package/dist/cli/menu/pages/agents-page.d.ts +7 -2
  69. package/dist/cli/menu/pages/agents-page.js +67 -11
  70. package/dist/cli/menu/pages/maintenance-page.js +1 -2
  71. package/dist/cli/menu/pages/settings-page.js +1 -0
  72. package/dist/cli/menu/views.js +2 -1
  73. package/dist/cli/services/agent-commands-service.d.ts +2 -0
  74. package/dist/cli/services/agent-commands-service.js +13 -7
  75. package/dist/cli/services/vpn-service.d.ts +5 -1
  76. package/dist/cli/services/vpn-service.js +6 -1
  77. package/dist/cli/tui/dialogs/text-screen.js +2 -1
  78. package/dist/cli/tui/terminal.js +3 -1
  79. package/dist/core/config/defaults.js +9 -0
  80. package/dist/core/detect/toolchains.js +9 -0
  81. package/dist/core/disk.d.ts +1 -5
  82. package/dist/core/disk.js +1 -16
  83. package/dist/core/schema/codex.d.ts +29 -0
  84. package/dist/core/schema/codex.js +24 -0
  85. package/dist/core/schema/config.d.ts +46 -14
  86. package/dist/core/schema/config.js +2 -0
  87. package/dist/core/schema/index.d.ts +1 -0
  88. package/dist/core/schema/index.js +1 -0
  89. package/dist/core/schema/toolchains.d.ts +4 -0
  90. package/dist/core/schema/toolchains.js +3 -0
  91. package/dist/core/types.d.ts +2 -0
  92. package/dist/guest/accounts/apply.d.ts +6 -6
  93. package/dist/guest/agents/agent-files.d.ts +26 -6
  94. package/dist/guest/agents/agent-files.js +84 -14
  95. package/dist/guest/agents/local-state.d.ts +5 -2
  96. package/dist/guest/agents/local-state.js +24 -10
  97. package/dist/guest/boot/boot.js +10 -5
  98. package/dist/guest/daemon/heartbeat.d.ts +7 -2
  99. package/dist/guest/daemon/heartbeat.js +34 -15
  100. package/dist/guest/daemon/idle-shutdown.js +2 -0
  101. package/dist/guest/daemon/sessions.js +2 -1
  102. package/dist/guest/entries/daemon.js +1 -1
  103. package/dist/guest/toolchains/installers.d.ts +6 -10
  104. package/dist/guest/toolchains/installers.js +4 -12
  105. package/dist/guest/toolchains/native/autosdk.d.ts +3 -0
  106. package/dist/guest/toolchains/native/autosdk.js +50 -0
  107. package/dist/guest/toolchains/native/unreal.js +3 -0
  108. package/dist/guest/toolchains/native/vcruntime.d.ts +0 -3
  109. package/dist/guest/toolchains/native/vcruntime.js +2 -5
  110. package/dist/guest/toolchains/native/visual-studio.d.ts +2 -2
  111. package/dist/guest/toolchains/native/visual-studio.js +100 -16
  112. package/dist/guest/toolchains/native/vs-request.d.ts +21 -0
  113. package/dist/guest/toolchains/native/vs-request.js +60 -1
  114. package/dist/guest/toolchains/not-yet.d.ts +1 -1
  115. package/dist/guest/toolchains/not-yet.js +3 -3
  116. package/dist/guest/toolchains/persisted.js +2 -7
  117. package/dist/guest/toolchains/plan.js +9 -4
  118. package/dist/guest/toolchains/signature.d.ts +5 -0
  119. package/dist/guest/toolchains/signature.js +22 -0
  120. package/dist/guest/vpn/tunnel.d.ts +3 -0
  121. package/dist/guest/vpn/tunnel.js +10 -12
  122. package/dist/guest/vpn/vpn.js +6 -1
  123. package/dist/host/accounts/leases.d.ts +3 -3
  124. package/dist/host/accounts/source.js +1 -1
  125. package/dist/host/agent-commands/commands.js +1 -1
  126. package/dist/host/agent-commands/forwarders.d.ts +14 -2
  127. package/dist/host/agent-commands/forwarders.js +31 -13
  128. package/dist/host/agent-commands/reconcile.d.ts +2 -1
  129. package/dist/host/agent-commands/reconcile.js +7 -8
  130. package/dist/host/agent-commands/user-path.d.ts +5 -0
  131. package/dist/host/agent-commands/user-path.js +13 -0
  132. package/dist/host/health/index.d.ts +1 -0
  133. package/dist/host/health/index.js +1 -0
  134. package/dist/host/health/leftovers.d.ts +3 -0
  135. package/dist/host/health/leftovers.js +40 -0
  136. package/dist/host/health/stale.d.ts +48 -0
  137. package/dist/host/health/stale.js +40 -0
  138. package/dist/host/launch/session-file.js +1 -0
  139. package/dist/host/life/crash-report.d.ts +1 -1
  140. package/dist/host/life/crash-report.js +5 -3
  141. package/dist/host/life/last-end.d.ts +7 -0
  142. package/dist/host/life/last-end.js +21 -0
  143. package/dist/host/life/life-record.d.ts +3 -0
  144. package/dist/host/life/life-record.js +2 -2
  145. package/dist/host/life/stop-events.d.ts +3 -1
  146. package/dist/host/life/stop-events.js +59 -0
  147. package/dist/host/life/stop-warning.js +3 -0
  148. package/dist/host/profile/accounts.js +2 -4
  149. package/dist/host/profile/claude-login.d.ts +3 -2
  150. package/dist/host/profile/claude-login.js +3 -13
  151. package/dist/host/sandbox/cleanup.d.ts +37 -0
  152. package/dist/host/sandbox/cleanup.js +82 -0
  153. package/dist/host/sandbox/index.d.ts +1 -0
  154. package/dist/host/sandbox/index.js +1 -0
  155. package/dist/host/sandbox/platform.js +1 -1
  156. package/dist/host/vpn/index.d.ts +2 -1
  157. package/dist/host/vpn/index.js +2 -1
  158. package/dist/host/vpn/last.d.ts +28 -0
  159. package/dist/host/vpn/last.js +43 -0
  160. package/dist/host/vpn/login.d.ts +3 -1
  161. package/dist/host/vpn/login.js +17 -3
  162. package/dist/runtime/agent.js +31 -1
  163. package/dist/runtime/daemon.js +1419 -1197
  164. package/dist/runtime/db.js +33 -1
  165. package/dist/runtime/main.js +1311 -1037
  166. package/dist/runtime/netproxy.js +25 -1
  167. package/dist/runtime/tool.js +241 -209
  168. package/dist/runtime/view.js +25 -1
  169. package/dist/selftest/agent-commands.test.js +45 -7
  170. package/dist/selftest/agent-paths.test.js +1 -12
  171. package/dist/selftest/agent-settings.test.d.ts +2 -0
  172. package/dist/selftest/agent-settings.test.js +94 -0
  173. package/dist/selftest/app.test.js +2 -1
  174. package/dist/selftest/cli.test.js +4 -0
  175. package/dist/selftest/heavy-load.test.js +119 -2
  176. package/dist/selftest/index.js +2 -0
  177. package/dist/selftest/menu.test.js +5 -3
  178. package/dist/selftest/pc-installs.test.js +5 -0
  179. package/dist/selftest/persisted-installs.test.js +69 -0
  180. package/dist/selftest/service-accounts.test.js +1 -1
  181. package/dist/selftest/support/engine-golden.js +1 -1
  182. package/dist/selftest/support/fixtures.d.ts +9 -0
  183. package/dist/selftest/vpn.test.js +51 -3
  184. package/dist/shared/accounts/anthropic.d.ts +5 -0
  185. package/dist/shared/accounts/anthropic.js +15 -0
  186. package/dist/shared/accounts/index.d.ts +1 -0
  187. package/dist/shared/accounts/index.js +1 -0
  188. package/dist/shared/channel/schema.d.ts +20 -0
  189. package/dist/shared/channel/schema.js +4 -1
  190. package/dist/shared/io/disk.d.ts +9 -0
  191. package/dist/shared/io/disk.js +19 -0
  192. package/dist/shared/io/index.d.ts +1 -0
  193. package/dist/shared/io/index.js +1 -0
  194. package/dist/shared/readiness.d.ts +9 -0
  195. package/dist/shared/readiness.js +11 -0
  196. package/dist/shared/signer.d.ts +24 -0
  197. package/dist/shared/signer.js +15 -0
  198. package/dist/shared/system.d.ts +1 -0
  199. package/dist/shared/system.js +1 -0
  200. package/dist/shared/vpn/failure.d.ts +10 -0
  201. package/dist/shared/vpn/failure.js +28 -0
  202. package/dist/sync/watcher.js +11 -4
  203. package/dist/web/index.html +1 -1
  204. package/dist/web/{main-6XYO5FZC.js → main-OUUQYNK4.js} +75 -74
  205. package/native/csharp/HcsHost/AssemblyInfo.cs +3 -3
  206. package/native/csharp/HostTools/AssemblyInfo.cs +3 -3
  207. package/native/csharp/HostTools/Program.cs +19 -2
  208. package/native/csharp/HostTools/UserPath.cs +17 -0
  209. package/native/csharp/StorageHelper/AssemblyInfo.cs +3 -3
  210. package/native/scripts/edit-user-path.ps1 +6 -2
  211. package/native/scripts/stop-events.ps1 +7 -3
  212. package/package.json +1 -1
  213. package/sandbox/scripts/get-signature.ps1 +13 -0
  214. package/schemas/config.schema.json +64 -0
  215. package/schemas/sandbox-config.schema.json +8 -0
  216. package/sandbox/scripts/get-signer.ps1 +0 -8
@@ -1,4 +1,5 @@
1
1
  export * from './platform.js';
2
+ export * from './cleanup.js';
2
3
  export * from './probe.js';
3
4
  export * from './tasklist.js';
4
5
  export * from './host-claude.js';
@@ -89,7 +89,7 @@ export async function confirmSandboxStarted(wsbPath, waitMs = START_WAIT_MS) {
89
89
  if (Date.now() >= deadline)
90
90
  fail('Windows Sandbox did not start within ' + Math.round(waitMs / 1000) + ' seconds.', 'Open ' +
91
91
  wsbPath +
92
- ' yourself to see the message Windows gives, or run sandbox doctor to check the Windows Sandbox feature.');
92
+ ' yourself to see the message Windows gives, or run sandbox doctor to check the Windows Sandbox feature. If Windows says the sandbox was signed out, a sandbox that died left its programs behind: run sandbox cleanup.');
93
93
  await sleep(1000);
94
94
  }
95
95
  }
@@ -1,4 +1,5 @@
1
- export { VpnLogin, loginProblem, type LoginState, type VpnCredentials } from './login.js';
1
+ export { VpnLogin, loginProblem, loginWarning, type LoginState, type VpnCredentials } from './login.js';
2
2
  export { fetchBounded, findCountry, nordProfile, recommendedServer, type Fetcher, type NordServer } from './nordvpn.js';
3
3
  export { prepareVpn, vpnNotes, wireguardFileProblem, type PrepareOptions } from './prepare.js';
4
4
  export { hostPublicIp, readVpnLine, vpnLine, type VpnLine } from './status.js';
5
+ export { readLastFailure, recordLastVpn, type LastVpn, type VpnFailureInfo } from './last.js';
@@ -1,4 +1,5 @@
1
- export { VpnLogin, loginProblem } from './login.js';
1
+ export { VpnLogin, loginProblem, loginWarning } from './login.js';
2
2
  export { fetchBounded, findCountry, nordProfile, recommendedServer } from './nordvpn.js';
3
3
  export { prepareVpn, vpnNotes, wireguardFileProblem } from './prepare.js';
4
4
  export { hostPublicIp, readVpnLine, vpnLine } from './status.js';
5
+ export { readLastFailure, recordLastVpn } from './last.js';
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ declare const LastSchema: z.ZodObject<{
3
+ state: z.ZodEnum<{
4
+ failed: "failed";
5
+ up: "up";
6
+ }>;
7
+ code: z.ZodOptional<z.ZodEnum<{
8
+ auth: "auth";
9
+ unreachable: "unreachable";
10
+ driver: "driver";
11
+ timeout: "timeout";
12
+ other: "other";
13
+ }>>;
14
+ message: z.ZodString;
15
+ at: z.ZodString;
16
+ }, z.core.$strip>;
17
+ export type LastVpn = z.output<typeof LastSchema>;
18
+ /** What the page shows for a failure: the plain sentence, never the raw log. */
19
+ export interface VpnFailureInfo {
20
+ readonly code: NonNullable<LastVpn['code']>;
21
+ readonly text: string;
22
+ readonly at: string;
23
+ }
24
+ /** Copies the sandbox's final VPN state to host storage (nothing when the VPN was off). Never throws. */
25
+ export declare function recordLastVpn(storageRoot: string, dataPath: string): void;
26
+ /** The last attempt, when it failed (null when it worked or none is known). */
27
+ export declare function readLastFailure(storageRoot: string): VpnFailureInfo | null;
28
+ export {};
@@ -0,0 +1,43 @@
1
+ // The last VPN result of a sandbox, kept in host storage (<storage>\vpn\last.json) when the sandbox closes, so "the
2
+ // login was refused" can still be shown after the sandbox is gone. Read from the sandbox's run\vpn.json (validated),
3
+ // never from anything else the guest wrote; the text is made safe before it is kept.
4
+ import path from 'node:path';
5
+ import { z } from 'zod';
6
+ import { RunDir } from '../../shared/channel/index.js';
7
+ import { JsonFile } from '../../shared/io/index.js';
8
+ import { FAILURE_TEXT } from '../../shared/vpn/failure.js';
9
+ import { safeText } from '../../core/util/index.js';
10
+ const LastSchema = z.object({
11
+ state: z.enum(['up', 'failed']),
12
+ code: z.enum(['auth', 'unreachable', 'driver', 'timeout', 'other']).optional(),
13
+ message: z.string().max(400),
14
+ at: z.string().max(64),
15
+ });
16
+ function lastFile(storageRoot) {
17
+ return new JsonFile(LastSchema, path.join(storageRoot, 'vpn', 'last.json'));
18
+ }
19
+ /** Copies the sandbox's final VPN state to host storage (nothing when the VPN was off). Never throws. */
20
+ export function recordLastVpn(storageRoot, dataPath) {
21
+ try {
22
+ const status = new RunDir(dataPath).readVpnStatus();
23
+ if (!status || (status.state !== 'up' && status.state !== 'failed'))
24
+ return;
25
+ lastFile(storageRoot).write({
26
+ state: status.state,
27
+ ...(status.code ? { code: status.code } : {}),
28
+ message: safeText(status.message).slice(0, 400),
29
+ at: status.updatedAt,
30
+ });
31
+ }
32
+ catch {
33
+ // Only a convenience for the page: a failure here must not hold the final sync up.
34
+ }
35
+ }
36
+ /** The last attempt, when it failed (null when it worked or none is known). */
37
+ export function readLastFailure(storageRoot) {
38
+ const last = lastFile(storageRoot).read();
39
+ if (!last || last.state !== 'failed')
40
+ return null;
41
+ const code = last.code ?? 'other';
42
+ return { code, text: FAILURE_TEXT[code], at: last.at };
43
+ }
@@ -7,7 +7,9 @@ export interface VpnCredentials {
7
7
  /** What `sandbox vpn status` may say about the login: never the values. */
8
8
  export type LoginState = 'none' | 'saved' | 'unreadable';
9
9
  /** The login must go on two lines of a file for OpenVPN, so no line breaks or other control characters. */
10
- export declare function loginProblem(c: VpnCredentials): string | null;
10
+ export declare function loginProblem(c: VpnCredentials, provider?: VpnProvider): string | null;
11
+ /** A hint (not a refusal) when a NordVPN login does not look like service credentials (letters and digits, ~24). */
12
+ export declare function loginWarning(c: VpnCredentials, provider: VpnProvider): string | null;
11
13
  export declare class VpnLogin {
12
14
  private readonly storageRoot;
13
15
  private readonly secrets;
@@ -14,16 +14,30 @@ const SavedSchema = z.object({
14
14
  sealed: z.string().max(10000),
15
15
  });
16
16
  /** The login must go on two lines of a file for OpenVPN, so no line breaks or other control characters. */
17
- export function loginProblem(c) {
17
+ export function loginProblem(c, provider) {
18
18
  const clean = (v) => !/[\u0000-\u001f\u007f]/.test(v);
19
19
  if (!c.username.trim() || !c.password)
20
20
  return 'Both the user name and the password are needed.';
21
21
  if (!clean(c.username) || !clean(c.password))
22
22
  return 'The login may not contain line breaks or control characters.';
23
+ // The markers a terminal puts around pasted text ([200~ ... [201~) are not part of any login.
24
+ if (/\[20[01]~/.test(c.username + c.password))
25
+ return 'The login has hidden paste characters in it (the terminal added them when you pasted).';
23
26
  if (c.username.length > 256 || c.password.length > 1024)
24
27
  return 'The user name or password is too long.';
28
+ if (provider === 'nordvpn' && /^[^@\s]+@[^@\s]+\.[^@\s]+$/.test(c.username.trim()))
29
+ return 'That looks like your NordVPN account e-mail. Use the service credentials: Nord Account > NordVPN > Manual setup.';
25
30
  return null;
26
31
  }
32
+ /** A hint (not a refusal) when a NordVPN login does not look like service credentials (letters and digits, ~24). */
33
+ export function loginWarning(c, provider) {
34
+ if (provider !== 'nordvpn')
35
+ return null;
36
+ const ok = (v) => /^[A-Za-z0-9]{16,64}$/.test(v.trim());
37
+ return ok(c.username) && ok(c.password)
38
+ ? null
39
+ : 'NordVPN service credentials are letters and digits only (about 24 each). If the VPN says the login was refused, copy them again from Nord Account > NordVPN > Manual setup.';
40
+ }
27
41
  export class VpnLogin {
28
42
  storageRoot;
29
43
  secrets;
@@ -36,13 +50,13 @@ export class VpnLogin {
36
50
  }
37
51
  /** Encrypts and saves the login (replacing an earlier one). */
38
52
  save(provider, login) {
39
- const problem = loginProblem(login);
53
+ const problem = loginProblem({ username: login.username.trim(), password: login.password.trim() }, provider);
40
54
  if (problem)
41
55
  fail(problem, 'Type the service credentials again.');
42
56
  this.file(provider).write({
43
57
  provider,
44
58
  savedAt: new Date().toISOString(),
45
- sealed: this.secrets.sealJson({ username: login.username.trim(), password: login.password }),
59
+ sealed: this.secrets.sealJson({ username: login.username.trim(), password: login.password.trim() }),
46
60
  });
47
61
  }
48
62
  /** The login, decrypted. Only the launch calls this. */
@@ -5541,6 +5541,7 @@ var SYSTEM = {
5541
5541
  cmd: () => system32("cmd.exe"),
5542
5542
  powershell: () => system32("WindowsPowerShell\\v1.0\\powershell.exe"),
5543
5543
  tasklist: () => system32("tasklist.exe"),
5544
+ taskkill: () => system32("taskkill.exe"),
5544
5545
  whoami: () => system32("whoami.exe"),
5545
5546
  icacls: () => system32("icacls.exe"),
5546
5547
  tar: () => system32("tar.exe"),
@@ -25350,6 +25351,22 @@ var DatabasesSchema = external_exports.strictObject({
25350
25351
  })
25351
25352
  });
25352
25353
 
25354
+ // src/core/schema/codex.ts
25355
+ var CodexSchema = external_exports.strictObject({
25356
+ sandboxMode: external_exports.enum(["danger-full-access", "workspace-write", "read-only"]).describe(
25357
+ "Codex's own sandbox. Inside Windows Sandbox Codex's own sandbox only slows it down (it re-grants file permissions over your profile at every boot), so the default is danger-full-access: Windows Sandbox is the sandbox."
25358
+ ),
25359
+ approvalPolicy: external_exports.enum(["never", "on-request", "on-failure", "untrusted"]).describe('When Codex asks before it runs a command. "never" with danger-full-access starts it with no questions.'),
25360
+ model: external_exports.string().max(100).regex(/^[A-Za-z0-9._:/-]*$/, "letters, digits and . _ : / - only").describe("The model Codex uses. Empty = Codex's own default."),
25361
+ reasoningEffort: external_exports.enum(["default", "minimal", "low", "medium", "high", "xhigh"]).describe(`How hard Codex thinks. "default" = Codex's own default.`),
25362
+ windowsSandbox: external_exports.enum(["off", "unelevated", "elevated"]).describe(
25363
+ `Codex's Windows sandbox mode in its config.toml. "off" removes the setting so Codex does not set up its sandbox users and firewall rules at every boot.`
25364
+ ),
25365
+ mcpLoginsInFile: external_exports.boolean().describe(
25366
+ `Keep the sign-ins of Codex's MCP servers in a file in the saved Codex folder (mcp_oauth_credentials_store = "file"), so they survive between sandboxes. A value you set in config.toml is kept.`
25367
+ )
25368
+ });
25369
+
25353
25370
  // src/core/schema/harness.ts
25354
25371
  var SubfolderSchema = external_exports.string().regex(/^(?!.*(^|[\\/])\.\.([\\/]|$))[A-Za-z0-9._ -]+([\\/][A-Za-z0-9._ -]+)*$/, "a plain relative folder");
25355
25372
  var HarnessHomeSchema = external_exports.strictObject({
@@ -25662,6 +25679,9 @@ var ToolchainsSchema = external_exports.strictObject({
25662
25679
  keepInstallFiles: external_exports.boolean().describe(
25663
25680
  "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."
25664
25681
  ),
25682
+ visualStudio: external_exports.enum(["full", "autosdk"]).describe(
25683
+ `"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).`
25684
+ ),
25665
25685
  persistEngines: external_exports.boolean().describe(
25666
25686
  "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)."
25667
25687
  ),
@@ -27118,6 +27138,7 @@ var ConfigSchema = external_exports.strictObject({
27118
27138
  apps: AppsSchema,
27119
27139
  claudeProfile: ClaudeProfileSchema,
27120
27140
  harnesses: external_exports.record(NameSchema, HarnessSchema).describe("Agents that can run in the sandbox."),
27141
+ codex: CodexSchema,
27121
27142
  hooks: external_exports.strictObject({ failFast: external_exports.boolean().describe("Stop when a hook script fails.") }),
27122
27143
  projects: ProjectsSchema.describe(
27123
27144
  "Several projects in one sandbox: folders of projects mapped at every start, and adding folders while it runs."
@@ -27319,7 +27340,8 @@ var HeartbeatSchema = external_exports.object({
27319
27340
  topProcesses: external_exports.array(external_exports.object({ name: Text(64), privateMb: external_exports.number().int().min(0).max(1e7) })).max(5),
27320
27341
  /** The disk queue this PC last reported while asking the sandbox to slow down. */
27321
27342
  diskQueueReported: external_exports.number().min(0).max(1e5).optional(),
27322
- phase: external_exports.enum(["ready", "working"])
27343
+ /** "ending": the sandbox is shutting down in order (idle shutdown, sandbox stop, Windows shutting down). */
27344
+ phase: external_exports.enum(["ready", "working", "ending"])
27323
27345
  });
27324
27346
  var GuestResponseSchema = external_exports.object({
27325
27347
  id: IdSchema,
@@ -27360,6 +27382,8 @@ var ProjectStatusSchema = external_exports.object({
27360
27382
  var VpnStatusSchema = external_exports.object({
27361
27383
  state: external_exports.enum(["off", "starting", "up", "failed"]),
27362
27384
  message: Text(2e3),
27385
+ /** Why it failed, when it did: `auth` (login refused), `unreachable`, `driver`, `timeout` or `other`. */
27386
+ code: external_exports.enum(["auth", "unreachable", "driver", "timeout", "other"]).optional(),
27363
27387
  killSwitch: external_exports.boolean(),
27364
27388
  /** A direct connection was tried after the kill switch was applied: false = it still got out. */
27365
27389
  killSwitchHeld: external_exports.boolean().optional(),
@@ -28054,6 +28078,12 @@ function agentPaths(toolsDir2, name, harness) {
28054
28078
  function agentCommand(name, harness) {
28055
28079
  return harness.npmBin ?? harness.uvBin ?? (harness.hostExecutable ?? name).replace(/\.exe$/i, "");
28056
28080
  }
28081
+ var CODEX_MARKER = "# Set by the sandbox";
28082
+ var MAX_CODEX_CONFIG_BYTES = 1024 * 1024;
28083
+ var MARKED_LINES = new RegExp(
28084
+ "^" + CODEX_MARKER + "[^\r\n]*\r?\n(?:(?:sandbox_mode|approval_policy)[ ]*=[^\r\n]*\r?\n)*(?:[ ]*\r?\n)?",
28085
+ "m"
28086
+ );
28057
28087
 
28058
28088
  // src/guest/setup/path-plan.ts
28059
28089
  import path16 from "node:path";