windows-development-sandbox 1.7.0 → 1.9.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 (413) hide show
  1. package/config.example.json +10 -0
  2. package/dist/app/context.d.ts +8 -0
  3. package/dist/app/context.js +12 -0
  4. package/dist/app/features/defs.d.ts +322 -0
  5. package/dist/app/features/defs.js +28 -0
  6. package/dist/app/features/sandbox/index.d.ts +2 -0
  7. package/dist/app/features/sandbox/index.js +3 -0
  8. package/dist/app/features/sandbox/sandbox.def.d.ts +193 -0
  9. package/dist/app/features/sandbox/sandbox.def.js +245 -0
  10. package/dist/app/features/sandbox/sandbox.run.d.ts +72 -0
  11. package/dist/app/features/sandbox/sandbox.run.js +98 -0
  12. package/dist/app/features/sessions/index.d.ts +2 -0
  13. package/dist/app/features/sessions/index.js +3 -0
  14. package/dist/app/features/sessions/sessions.def.d.ts +141 -0
  15. package/dist/app/features/sessions/sessions.def.js +176 -0
  16. package/dist/app/features/sessions/sessions.run.d.ts +39 -0
  17. package/dist/app/features/sessions/sessions.run.js +58 -0
  18. package/dist/{cli/menu/settings/categories.d.ts → app/features/settings/categories.def.d.ts} +2 -0
  19. package/dist/{cli/menu/settings/categories.js → app/features/settings/categories.def.js} +24 -5
  20. package/dist/app/features/settings/index.d.ts +5 -0
  21. package/dist/app/features/settings/index.js +6 -0
  22. package/dist/{cli/menu/settings/config-file.d.ts → app/features/settings/settings-file.d.ts} +1 -1
  23. package/dist/{cli/menu/settings/config-file.js → app/features/settings/settings-file.js} +1 -1
  24. package/dist/app/features/settings/settings-rows.d.ts +35 -0
  25. package/dist/app/features/settings/settings-rows.js +94 -0
  26. package/dist/app/features/settings/settings.def.d.ts +157 -0
  27. package/dist/app/features/settings/settings.def.js +179 -0
  28. package/dist/app/features/settings/settings.run.d.ts +67 -0
  29. package/dist/app/features/settings/settings.run.js +84 -0
  30. package/dist/app/kernel/define.d.ts +143 -0
  31. package/dist/app/kernel/define.js +42 -0
  32. package/dist/app/kernel/errors.d.ts +34 -0
  33. package/dist/app/kernel/errors.js +45 -0
  34. package/dist/app/kernel/fields.d.ts +70 -0
  35. package/dist/app/kernel/fields.js +243 -0
  36. package/dist/app/kernel/index.d.ts +8 -0
  37. package/dist/app/kernel/index.js +10 -0
  38. package/dist/app/kernel/io.d.ts +193 -0
  39. package/dist/app/kernel/io.js +126 -0
  40. package/dist/app/kernel/rpc.d.ts +156 -0
  41. package/dist/app/kernel/rpc.js +47 -0
  42. package/dist/app/kernel/text.d.ts +6 -0
  43. package/dist/app/kernel/text.js +57 -0
  44. package/dist/app/kernel/view.d.ts +146 -0
  45. package/dist/app/kernel/view.js +28 -0
  46. package/dist/app/registry.d.ts +10 -0
  47. package/dist/app/registry.js +50 -0
  48. package/dist/cli/args.d.ts +5 -0
  49. package/dist/cli/args.js +6 -0
  50. package/dist/cli/commands/engine.d.ts +2 -0
  51. package/dist/cli/commands/engine.js +60 -0
  52. package/dist/cli/commands/index.d.ts +1 -1
  53. package/dist/cli/commands/index.js +1 -1
  54. package/dist/cli/commands/launch/launch.js +47 -7
  55. package/dist/cli/commands/launch/prepare.js +3 -3
  56. package/dist/cli/commands/launch/running.js +2 -1
  57. package/dist/cli/commands/launch/summary.d.ts +2 -0
  58. package/dist/cli/commands/maintenance/config-share.d.ts +12 -0
  59. package/dist/cli/commands/maintenance/config-share.js +80 -0
  60. package/dist/cli/commands/maintenance/config.js +8 -82
  61. package/dist/cli/commands/maintenance/logs.js +14 -0
  62. package/dist/cli/commands/registry.js +3 -7
  63. package/dist/cli/commands/repair/checks/contained.d.ts +2 -0
  64. package/dist/cli/commands/repair/checks/contained.js +139 -0
  65. package/dist/cli/commands/repair/checks/hcs.d.ts +7 -0
  66. package/dist/cli/commands/repair/checks/hcs.js +28 -0
  67. package/dist/cli/commands/repair/checks/index.js +4 -0
  68. package/dist/cli/commands/repair/checks/pc.js +32 -1
  69. package/dist/cli/commands/repair/checks/sandbox.js +16 -1
  70. package/dist/cli/commands/repair/checks/vpn.js +34 -9
  71. package/dist/cli/commands/repair/env.js +2 -1
  72. package/dist/cli/commands/sessions/index.d.ts +0 -4
  73. package/dist/cli/commands/sessions/index.js +3 -7
  74. package/dist/cli/commands/shared-use.d.ts +5 -2
  75. package/dist/cli/commands/shared-use.js +11 -8
  76. package/dist/cli/commands/storage/contained.d.ts +3 -0
  77. package/dist/cli/commands/storage/contained.js +179 -0
  78. package/dist/cli/commands/storage/offer.js +7 -1
  79. package/dist/cli/commands/storage/storage.js +10 -2
  80. package/dist/cli/commands/user-config.js +1 -1
  81. package/dist/cli/commands/vpn.js +19 -3
  82. package/dist/cli/commands/web.js +2 -0
  83. package/dist/cli/index.js +2 -1
  84. package/dist/cli/manifest.d.ts +72 -104
  85. package/dist/cli/manifest.js +64 -39
  86. package/dist/cli/menu/add-agent.d.ts +1 -1
  87. package/dist/cli/menu/add-agent.js +1 -1
  88. package/dist/cli/menu/apps.d.ts +7 -1
  89. package/dist/cli/menu/apps.js +36 -0
  90. package/dist/cli/menu/command-fields.d.ts +1 -1
  91. package/dist/cli/menu/command-form.js +2 -2
  92. package/dist/cli/menu/io-menu.d.ts +29 -0
  93. package/dist/cli/menu/io-menu.js +126 -0
  94. package/dist/cli/menu/live.d.ts +27 -0
  95. package/dist/cli/menu/live.js +69 -0
  96. package/dist/cli/menu/memory.d.ts +19 -0
  97. package/dist/cli/menu/memory.js +53 -0
  98. package/dist/cli/menu/menu.d.ts +10 -1
  99. package/dist/cli/menu/menu.js +27 -9
  100. package/dist/cli/menu/pages/agents-page.d.ts +3 -1
  101. package/dist/cli/menu/pages/agents-page.js +12 -5
  102. package/dist/cli/menu/pages/apps-page.d.ts +3 -1
  103. package/dist/cli/menu/pages/apps-page.js +19 -2
  104. package/dist/cli/menu/pages/list-page.d.ts +27 -0
  105. package/dist/cli/menu/pages/list-page.js +109 -7
  106. package/dist/cli/menu/pages/maintenance-page.d.ts +0 -5
  107. package/dist/cli/menu/pages/maintenance-page.js +17 -19
  108. package/dist/cli/menu/pages/sandbox-page.d.ts +4 -6
  109. package/dist/cli/menu/pages/sandbox-page.js +26 -118
  110. package/dist/cli/menu/pages/scopes.d.ts +1 -1
  111. package/dist/cli/menu/pages/sessions-page.d.ts +5 -11
  112. package/dist/cli/menu/pages/sessions-page.js +19 -88
  113. package/dist/cli/menu/pages/settings-page.d.ts +2 -10
  114. package/dist/cli/menu/pages/settings-page.js +64 -94
  115. package/dist/cli/menu/render-view.d.ts +28 -0
  116. package/dist/cli/menu/render-view.js +112 -0
  117. package/dist/cli/menu/settings/{path-kind.d.ts → ask-path.d.ts} +1 -7
  118. package/dist/cli/menu/settings/ask-path.js +14 -0
  119. package/dist/cli/menu/settings/collections/collection-editor.d.ts +1 -1
  120. package/dist/cli/menu/settings/collections/string-list-editor.d.ts +1 -2
  121. package/dist/cli/menu/settings/collections/string-list-editor.js +1 -1
  122. package/dist/cli/menu/settings/draft.d.ts +1 -1
  123. package/dist/cli/menu/settings/format.d.ts +1 -3
  124. package/dist/cli/menu/settings/format.js +6 -36
  125. package/dist/cli/menu/settings/index.d.ts +1 -3
  126. package/dist/cli/menu/settings/index.js +3 -3
  127. package/dist/cli/menu/settings/object-editor.d.ts +1 -1
  128. package/dist/cli/menu/settings/share.d.ts +36 -0
  129. package/dist/cli/menu/settings/share.js +131 -0
  130. package/dist/cli/menu/settings/value-editor.d.ts +5 -1
  131. package/dist/cli/menu/settings/value-editor.js +57 -54
  132. package/dist/cli/menu/several.js +1 -1
  133. package/dist/cli/menu/share-settings.d.ts +21 -0
  134. package/dist/cli/menu/share-settings.js +112 -0
  135. package/dist/cli/menu/shell.d.ts +21 -5
  136. package/dist/cli/menu/shell.js +31 -6
  137. package/dist/cli/menu/views.d.ts +7 -0
  138. package/dist/cli/menu/views.js +11 -0
  139. package/dist/cli/menu/vpn-login.js +8 -0
  140. package/dist/cli/operations/handler.d.ts +6 -0
  141. package/dist/cli/operations/handler.js +61 -0
  142. package/dist/cli/operations/index.d.ts +4 -0
  143. package/dist/cli/operations/index.js +5 -0
  144. package/dist/cli/operations/input.d.ts +6 -0
  145. package/dist/cli/operations/input.js +37 -0
  146. package/dist/cli/operations/io-cli.d.ts +7 -0
  147. package/dist/cli/operations/io-cli.js +62 -0
  148. package/dist/cli/operations/spec.d.ts +18 -0
  149. package/dist/cli/operations/spec.js +108 -0
  150. package/dist/cli/output/colors.d.ts +2 -2
  151. package/dist/cli/output/colors.js +2 -11
  152. package/dist/cli/output/index.d.ts +1 -0
  153. package/dist/cli/output/index.js +1 -0
  154. package/dist/cli/output/print.d.ts +3 -1
  155. package/dist/cli/output/print.js +7 -3
  156. package/dist/cli/output/progress.d.ts +15 -0
  157. package/dist/cli/output/progress.js +44 -0
  158. package/dist/cli/output/render-view.d.ts +4 -0
  159. package/dist/cli/output/render-view.js +63 -0
  160. package/dist/cli/services/agent-commands-service.d.ts +2 -0
  161. package/dist/cli/services/agent-commands-service.js +11 -2
  162. package/dist/cli/services/logs-service.js +4 -3
  163. package/dist/cli/tui/app.d.ts +6 -1
  164. package/dist/cli/tui/app.js +26 -4
  165. package/dist/cli/tui/list/list-screen.d.ts +14 -0
  166. package/dist/cli/tui/list/list-screen.js +64 -36
  167. package/dist/cli/tui/list/list-types.d.ts +2 -0
  168. package/dist/cli/tui/terminal.d.ts +7 -0
  169. package/dist/cli/tui/terminal.js +30 -10
  170. package/dist/core/config/defaults.js +8 -0
  171. package/dist/core/schema/config.d.ts +13 -0
  172. package/dist/core/schema/config.js +16 -1
  173. package/dist/core/schema/harness.d.ts +1 -0
  174. package/dist/core/schema/harness.js +5 -0
  175. package/dist/core/schema/sandbox.d.ts +6 -0
  176. package/dist/core/schema/sandbox.js +20 -3
  177. package/dist/core/schema/vpn.d.ts +2 -1
  178. package/dist/core/schema/vpn.js +3 -3
  179. package/dist/core/types.d.ts +23 -5
  180. package/dist/core/util/fs.d.ts +2 -0
  181. package/dist/core/util/fs.js +9 -0
  182. package/dist/core/util/index.d.ts +1 -1
  183. package/dist/core/util/index.js +1 -1
  184. package/dist/guest/agents/agent-files.d.ts +5 -0
  185. package/dist/guest/agents/agent-files.js +4 -0
  186. package/dist/guest/agents/local-state.d.ts +2 -0
  187. package/dist/guest/agents/local-state.js +21 -1
  188. package/dist/guest/boot/boot.js +2 -1
  189. package/dist/guest/daemon/daemon.js +4 -0
  190. package/dist/guest/daemon/sessions.d.ts +5 -0
  191. package/dist/guest/daemon/sessions.js +17 -3
  192. package/dist/guest/entries/daemon.js +3 -0
  193. package/dist/guest/governor/decide.d.ts +61 -0
  194. package/dist/guest/governor/decide.js +182 -0
  195. package/dist/guest/governor/governor.d.ts +42 -0
  196. package/dist/guest/governor/governor.js +214 -0
  197. package/dist/guest/governor/index.d.ts +2 -0
  198. package/dist/guest/governor/index.js +2 -0
  199. package/dist/guest/runtime/csc.d.ts +1 -0
  200. package/dist/guest/runtime/csc.js +1 -0
  201. package/dist/guest/sessions/viewer.js +3 -1
  202. package/dist/guest/toolchains/native/rust-extras.js +4 -2
  203. package/dist/guest/vpn/vpn.js +69 -21
  204. package/dist/guest/vpn/wireguard.d.ts +32 -0
  205. package/dist/guest/vpn/wireguard.js +132 -0
  206. package/dist/host/agent-commands/commands.d.ts +4 -0
  207. package/dist/host/agent-commands/commands.js +31 -7
  208. package/dist/host/audit/log.d.ts +1 -1
  209. package/dist/host/channel/attach.d.ts +3 -1
  210. package/dist/host/channel/attach.js +5 -2
  211. package/dist/host/channel/channel.d.ts +2 -0
  212. package/dist/host/channel/channel.js +4 -0
  213. package/dist/host/engines/engine.d.ts +12 -0
  214. package/dist/host/engines/engine.js +1 -0
  215. package/dist/host/engines/hcs/check.d.ts +25 -0
  216. package/dist/host/engines/hcs/check.js +95 -0
  217. package/dist/host/engines/hcs/documents.d.ts +44 -0
  218. package/dist/host/engines/hcs/documents.js +155 -0
  219. package/dist/host/engines/hcs/engine.d.ts +39 -0
  220. package/dist/host/engines/hcs/engine.js +171 -0
  221. package/dist/host/engines/hcs/helper.d.ts +43 -0
  222. package/dist/host/engines/hcs/helper.js +173 -0
  223. package/dist/host/engines/hcs/images.d.ts +37 -0
  224. package/dist/host/engines/hcs/images.js +152 -0
  225. package/dist/host/engines/index.d.ts +7 -0
  226. package/dist/host/engines/index.js +5 -0
  227. package/dist/host/engines/registry.d.ts +16 -0
  228. package/dist/host/engines/registry.js +30 -0
  229. package/dist/host/engines/types.d.ts +58 -0
  230. package/dist/host/engines/types.js +1 -0
  231. package/dist/host/engines/windows-sandbox/engine.d.ts +16 -0
  232. package/dist/host/engines/windows-sandbox/engine.js +63 -0
  233. package/dist/host/engines/windows-sandbox/wsb-text.d.ts +2 -0
  234. package/dist/host/engines/windows-sandbox/wsb-text.js +29 -0
  235. package/dist/host/launch/generate.d.ts +5 -1
  236. package/dist/host/launch/generate.js +50 -8
  237. package/dist/host/launch/index.d.ts +3 -1
  238. package/dist/host/launch/index.js +3 -1
  239. package/dist/host/launch/launch-plan.d.ts +13 -0
  240. package/dist/host/launch/launch-plan.js +26 -0
  241. package/dist/host/launch/mappings.js +2 -1
  242. package/dist/host/launch/risk-notes.d.ts +10 -0
  243. package/dist/host/launch/risk-notes.js +18 -0
  244. package/dist/host/launch/session-file.d.ts +2 -0
  245. package/dist/host/launch/session-file.js +7 -1
  246. package/dist/host/launch/wsb-file.d.ts +28 -4
  247. package/dist/host/launch/wsb-file.js +61 -42
  248. package/dist/host/life/crash-report.d.ts +27 -1
  249. package/dist/host/life/crash-report.js +173 -7
  250. package/dist/host/life/host-memory.d.ts +40 -0
  251. package/dist/host/life/host-memory.js +137 -0
  252. package/dist/host/life/index.d.ts +2 -0
  253. package/dist/host/life/index.js +2 -0
  254. package/dist/host/life/stop-events.d.ts +2 -0
  255. package/dist/host/life/stop-events.js +20 -3
  256. package/dist/host/life/stop-warning.js +1 -1
  257. package/dist/host/life/watchdog.d.ts +54 -0
  258. package/dist/host/life/watchdog.js +108 -0
  259. package/dist/host/native.d.ts +3 -2
  260. package/dist/host/native.js +22 -3
  261. package/dist/host/profile/claude-login.js +3 -2
  262. package/dist/host/sandbox/contained-deps.d.ts +2 -0
  263. package/dist/host/sandbox/contained-deps.js +17 -0
  264. package/dist/host/sandbox/index.d.ts +2 -0
  265. package/dist/host/sandbox/index.js +2 -0
  266. package/dist/host/sandbox/platform.d.ts +2 -0
  267. package/dist/host/sandbox/platform.js +7 -7
  268. package/dist/host/sandbox/tasklist.d.ts +13 -0
  269. package/dist/host/sandbox/tasklist.js +47 -0
  270. package/dist/host/secrets/launch-secrets.js +2 -1
  271. package/dist/host/sharing/current.js +2 -6
  272. package/dist/host/storage/contained/check.d.ts +9 -0
  273. package/dist/host/storage/contained/check.js +37 -0
  274. package/dist/host/storage/contained/contained-storage.d.ts +66 -0
  275. package/dist/host/storage/contained/contained-storage.js +168 -0
  276. package/dist/host/storage/contained/disk-port.d.ts +43 -0
  277. package/dist/host/storage/contained/disk-port.js +122 -0
  278. package/dist/host/storage/contained/index.d.ts +9 -0
  279. package/dist/host/storage/contained/index.js +8 -0
  280. package/dist/host/storage/contained/layout.d.ts +28 -0
  281. package/dist/host/storage/contained/layout.js +45 -0
  282. package/dist/host/storage/contained/resolve.d.ts +4 -0
  283. package/dist/host/storage/contained/resolve.js +30 -0
  284. package/dist/host/storage/contained/setting.d.ts +1 -0
  285. package/dist/host/storage/contained/setting.js +5 -0
  286. package/dist/host/storage/contained/state.d.ts +89 -0
  287. package/dist/host/storage/contained/state.js +166 -0
  288. package/dist/host/storage/contained/transfer.d.ts +24 -0
  289. package/dist/host/storage/contained/transfer.js +121 -0
  290. package/dist/host/storage/index.d.ts +2 -0
  291. package/dist/host/storage/index.js +2 -0
  292. package/dist/host/storage/providers/contained.d.ts +15 -0
  293. package/dist/host/storage/providers/contained.js +39 -0
  294. package/dist/host/storage/providers/folder.d.ts +12 -0
  295. package/dist/host/storage/providers/folder.js +20 -0
  296. package/dist/host/storage/providers/index.d.ts +4 -0
  297. package/dist/host/storage/providers/index.js +3 -0
  298. package/dist/host/storage/providers/registry.d.ts +9 -0
  299. package/dist/host/storage/providers/registry.js +14 -0
  300. package/dist/host/storage/providers/types.d.ts +33 -0
  301. package/dist/host/storage/providers/types.js +1 -0
  302. package/dist/host/tools/conpty.js +3 -2
  303. package/dist/host/tools/windows-terminal.js +8 -7
  304. package/dist/host/vpn/index.d.ts +1 -1
  305. package/dist/host/vpn/index.js +1 -1
  306. package/dist/host/vpn/prepare.d.ts +2 -0
  307. package/dist/host/vpn/prepare.js +63 -2
  308. package/dist/host/web/browser.d.ts +2 -0
  309. package/dist/host/web/browser.js +14 -1
  310. package/dist/host/web/index.d.ts +3 -2
  311. package/dist/host/web/index.js +3 -2
  312. package/dist/host/web/rpc.d.ts +24 -0
  313. package/dist/host/web/rpc.js +149 -0
  314. package/dist/host/web/runner.d.ts +2 -0
  315. package/dist/host/web/runner.js +1 -2
  316. package/dist/host/web/server.d.ts +7 -0
  317. package/dist/host/web/server.js +23 -3
  318. package/dist/runtime/agent.js +69 -8
  319. package/dist/runtime/daemon.js +1058 -624
  320. package/dist/runtime/db.js +69 -8
  321. package/dist/runtime/main.js +624 -182
  322. package/dist/runtime/netproxy.js +69 -8
  323. package/dist/runtime/view.js +87 -13
  324. package/dist/selftest/agent-paths.test.js +11 -1
  325. package/dist/selftest/app.test.d.ts +2 -0
  326. package/dist/selftest/app.test.js +324 -0
  327. package/dist/selftest/channel.test.js +13 -0
  328. package/dist/selftest/cli.test.js +2 -1
  329. package/dist/selftest/config.test.js +59 -0
  330. package/dist/selftest/contained.test.d.ts +2 -0
  331. package/dist/selftest/contained.test.js +544 -0
  332. package/dist/selftest/credentials.test.js +1 -1
  333. package/dist/selftest/engine.test.d.ts +2 -0
  334. package/dist/selftest/engine.test.js +127 -0
  335. package/dist/selftest/hcs.test.d.ts +2 -0
  336. package/dist/selftest/hcs.test.js +482 -0
  337. package/dist/selftest/heavy-load.test.d.ts +2 -0
  338. package/dist/selftest/heavy-load.test.js +329 -0
  339. package/dist/selftest/index.js +12 -0
  340. package/dist/selftest/layout.test.js +12 -0
  341. package/dist/selftest/menu-perf.test.d.ts +2 -0
  342. package/dist/selftest/menu-perf.test.js +248 -0
  343. package/dist/selftest/menu-screens.js +4 -2
  344. package/dist/selftest/menu.test.js +36 -8
  345. package/dist/selftest/support/engine-cases.d.ts +8 -0
  346. package/dist/selftest/support/engine-cases.js +65 -0
  347. package/dist/selftest/support/engine-golden.d.ts +3 -0
  348. package/dist/selftest/support/engine-golden.js +66 -0
  349. package/dist/selftest/support/fixtures.d.ts +7 -1
  350. package/dist/selftest/support/hcs-probes.d.ts +17 -0
  351. package/dist/selftest/support/hcs-probes.js +41 -0
  352. package/dist/selftest/vpn.test.js +136 -3
  353. package/dist/selftest/web.test.js +101 -3
  354. package/dist/shared/channel/run-dir.d.ts +4 -1
  355. package/dist/shared/channel/run-dir.js +7 -1
  356. package/dist/shared/channel/schema.d.ts +35 -1
  357. package/dist/shared/channel/schema.js +27 -0
  358. package/dist/shared/channel/secrets.d.ts +1 -0
  359. package/dist/shared/channel/secrets.js +6 -0
  360. package/dist/shared/memory/index.d.ts +1 -0
  361. package/dist/shared/memory/index.js +1 -0
  362. package/dist/shared/memory/policy.d.ts +33 -0
  363. package/dist/shared/memory/policy.js +55 -0
  364. package/dist/shared/pty/output-filter.d.ts +14 -1
  365. package/dist/shared/pty/output-filter.js +22 -4
  366. package/dist/shared/pty/terminal.d.ts +4 -1
  367. package/dist/shared/pty/terminal.js +4 -2
  368. package/dist/shared/system.d.ts +1 -0
  369. package/dist/shared/system.js +1 -0
  370. package/dist/shared/vpn/download.d.ts +16 -0
  371. package/dist/shared/vpn/download.js +16 -0
  372. package/dist/shared/vpn/wireguard.d.ts +51 -0
  373. package/dist/shared/vpn/wireguard.js +227 -0
  374. package/dist/sync/sync-cycle.js +5 -5
  375. package/dist/sync/watcher.d.ts +13 -0
  376. package/dist/sync/watcher.js +92 -3
  377. package/dist/web/index.html +4 -3
  378. package/dist/web/main-NRRS5O6Z.js +157 -0
  379. package/dist/web/main-T5DMCHYV.css +1 -0
  380. package/native/csharp/HcsHost/AssemblyInfo.cs +14 -0
  381. package/native/csharp/HcsHost/Guard.cs +100 -0
  382. package/native/csharp/HcsHost/Hcs.cs +256 -0
  383. package/native/csharp/HcsHost/Json.cs +78 -0
  384. package/native/csharp/HcsHost/Program.cs +185 -0
  385. package/native/csharp/HcsHost/VirtualDisk.cs +95 -0
  386. package/native/csharp/HostTools/AssemblyInfo.cs +14 -0
  387. package/native/csharp/HostTools/MemoryStatus.cs +107 -0
  388. package/native/csharp/HostTools/Program.cs +58 -17
  389. package/native/scripts/check-contained.ps1 +28 -0
  390. package/native/scripts/contained-common.ps1 +241 -0
  391. package/native/scripts/dismount-contained.ps1 +66 -0
  392. package/native/scripts/memory-status.ps1 +34 -0
  393. package/native/scripts/mount-contained.ps1 +139 -0
  394. package/native/scripts/run-elevated.ps1 +17 -4
  395. package/native/scripts/stop-events.ps1 +23 -8
  396. package/package.json +9 -2
  397. package/sandbox/csharp/MemGov.cs +398 -0
  398. package/sandbox/csharp/PtyHost.cs +111 -5
  399. package/schemas/config.schema.json +60 -6
  400. package/schemas/sandbox-config.schema.json +3 -3
  401. package/dist/cli/commands/sessions/control.d.ts +0 -4
  402. package/dist/cli/commands/sessions/control.js +0 -66
  403. package/dist/cli/commands/sessions/list.d.ts +0 -2
  404. package/dist/cli/commands/sessions/list.js +0 -48
  405. package/dist/cli/commands/sessions/status.d.ts +0 -4
  406. package/dist/cli/commands/sessions/status.js +0 -114
  407. package/dist/cli/commands/sessions/window.d.ts +0 -3
  408. package/dist/cli/commands/sessions/window.js +0 -18
  409. package/dist/cli/menu/settings/path-kind.js +0 -44
  410. package/dist/web/main-CXESL347.js +0 -45
  411. package/dist/web/main-VLR7DVQ4.css +0 -1
  412. /package/dist/{cli/menu/settings → app/kernel}/schema-node.d.ts +0 -0
  413. /package/dist/{cli/menu/settings → app/kernel}/schema-node.js +0 -0
@@ -25408,6 +25408,9 @@ var HarnessSchema = external_exports.strictObject({
25408
25408
  localState: external_exports.record(external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/), SubfolderSchema).optional().describe(
25409
25409
  "Environment variable -> folder below the agent's own state folder (state\\<agent>) for SQLite databases. SQLite cannot run in a mapped folder, so the agent runs from a copy on the sandbox's disk (the variable points to it) that is copied from and back to that folder."
25410
25410
  ),
25411
+ bootReset: external_exports.array(SubfolderSchema).max(32).optional().describe(
25412
+ "Files and folders below the agent's own state folder (state\\<agent>) that only work on the machine that wrote them (keys sealed with Windows DPAPI, local accounts it created). Every sandbox is a new machine, so they are deleted at each boot and the agent sets them up again."
25413
+ ),
25411
25414
  resumeArguments: StringsSchema.optional().describe(
25412
25415
  "Arguments used when the agent is restarted in place (e.g. after an account switch) so it resumes the conversation."
25413
25416
  ),
@@ -25485,6 +25488,9 @@ var MappingSchema = external_exports.strictObject({
25485
25488
  optional: external_exports.boolean().optional().describe("true = skip it quietly when the host folder does not exist.")
25486
25489
  });
25487
25490
  var SandboxSchema = external_exports.strictObject({
25491
+ engine: external_exports.enum(["windows-sandbox", "hcs"]).describe(
25492
+ '(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.'
25493
+ ),
25488
25494
  memoryMb: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(2048)]).describe('Sandbox RAM in MB (>= 2048), or "auto": free RAM minus reserveHostMb, capped at maxMemoryMb.'),
25489
25495
  maxMemoryMb: external_exports.number().int().positive().describe('Upper limit for memoryMb "auto".'),
25490
25496
  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).`),
@@ -25494,10 +25500,22 @@ var SandboxSchema = external_exports.strictObject({
25494
25500
  pageFileMb: external_exports.number().int().min(0).max(262144).describe(
25495
25501
  `Size of the sandbox's paging file in MB, created at full size when it starts so it never grows while builds run (8 GB of its disk always stays free). Windows Sandbox starts with about 1 GB: parallel builds then fail with "The paging file is too small", and Windows grows the file under load. 0 = leave Windows' own.`
25496
25502
  ),
25497
- reserveHostMb: external_exports.number().int().nonnegative().describe('RAM always left for this PC when memoryMb is "auto".'),
25498
- vGpu: external_exports.boolean().describe("Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface."),
25503
+ reserveHostMb: external_exports.number().int().nonnegative().describe(
25504
+ 'Memory always left for this PC when memoryMb is "auto": the sandbox gets at most (free RAM, and RAM plus paging file still unused) minus this.'
25505
+ ),
25506
+ agentMemoryHeadroomMb: external_exports.union([external_exports.literal("auto"), external_exports.literal("none"), external_exports.number().int().min(0)]).describe(
25507
+ 'Memory kept out of the agents reach inside the sandbox, in MB: everything the agents start (their builds, tests, tools) together may use at most the sandbox memory minus this; a runaway parallel build then gets out-of-memory errors in its own session instead of freezing or crashing the whole sandbox. "auto" = the larger of 2048 MB and 10 % of the sandbox memory; "none" = no limit. Yours only: a project file cannot change it.'
25508
+ ),
25509
+ pressureResponse: external_exports.boolean().describe(
25510
+ "When the sandbox (or this PC) runs low on memory, slow the heaviest build programs down (lower priority) and, if that is not enough, pause the biggest compiler for a few seconds at a time, so heavy parallel builds slow down instead of closing the sandbox. Never touches the agents themselves. Yours only: a project file cannot change it."
25511
+ ),
25512
+ vGpu: external_exports.boolean().describe(
25513
+ "Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface. The sandbox then uses this PC's graphics card, and with some graphics drivers heavy use can freeze the whole PC: turn it on only when a program in the sandbox needs the GPU (the mesa toolchain gives software OpenGL without it)."
25514
+ ),
25499
25515
  networking: external_exports.boolean().describe("Internet access. false is the only hard network isolation Windows Sandbox offers."),
25500
- clipboard: external_exports.boolean().describe("Shared clipboard between this PC and the sandbox."),
25516
+ clipboard: external_exports.boolean().describe(
25517
+ "Shared clipboard between this PC and the sandbox. Also lets an agent's copy (in sandbox attach) reach this PC's clipboard."
25518
+ ),
25501
25519
  audioInput: external_exports.boolean().describe("Microphone access."),
25502
25520
  videoInput: external_exports.boolean().describe("Camera access."),
25503
25521
  printerRedirection: external_exports.boolean().describe("Printers from this PC."),
@@ -26579,18 +26597,18 @@ var WebSchema = external_exports.strictObject({
26579
26597
  });
26580
26598
 
26581
26599
  // src/core/schema/vpn.ts
26582
- var VPN_PROVIDERS = ["nordvpn", "openvpn-file"];
26600
+ var VPN_PROVIDERS = ["nordvpn", "openvpn-file", "wireguard-file"];
26583
26601
  var VpnSchema = external_exports.strictObject({
26584
26602
  enabled: external_exports.boolean().describe(
26585
26603
  "Send the sandbox's traffic through a VPN. Only the sandbox: your PC's own connection is untouched. Needs a saved login first (sandbox vpn login). The agent in the sandbox can read that login and can turn the tunnel off (it is the administrator there)."
26586
26604
  ),
26587
26605
  provider: external_exports.enum(VPN_PROVIDERS).describe(
26588
- "nordvpn: a recommended NordVPN server is picked at every launch. openvpn-file: your own .ovpn file (configFile)."
26606
+ "nordvpn: a recommended NordVPN server is picked at every launch. openvpn-file: your own .ovpn file (configFile). wireguard-file: your own WireGuard .conf (configFile), e.g. from your company."
26589
26607
  ),
26590
26608
  protocol: external_exports.enum(["udp", "tcp"]).describe("udp is faster; tcp gets through networks that block udp."),
26591
26609
  country: external_exports.string().regex(/^([A-Za-z][A-Za-z .'-]{0,39})?$/, "a country name or code like uk or Germany").describe("nordvpn: the country of the server, e.g. uk, us or Germany. Empty = the best server anywhere."),
26592
26610
  configFile: external_exports.string().describe(
26593
- "openvpn-file: the .ovpn file on this PC (its certificates inside it). Files that run programs (script-security, up, down, plugin ...) are refused. A project's file can never set this."
26611
+ "openvpn-file / wireguard-file: the .ovpn or .conf file on this PC (an .ovpn has its certificates inside it). Files that run programs (script-security, up, down, plugin, PostUp ...) are refused. A WireGuard file holds your private key: it is read when a sandbox starts and handed over in a one-shot file. A project's file can never set this."
26594
26612
  ),
26595
26613
  killSwitch: external_exports.boolean().describe(
26596
26614
  "Block all traffic that does not go through the tunnel: when the tunnel cannot start, the sandbox stays offline instead of using your normal connection. A project can only turn this on, never off."
@@ -26617,6 +26635,10 @@ var ConfigSchema = external_exports.strictObject({
26617
26635
  markSandboxFiles: external_exports.boolean().describe(
26618
26636
  `Programs and scripts (.exe, .ps1, .bat, .cmd, .msi, .lnk ...) that appear or change in your project while a sandbox runs get Windows' "downloaded from the internet" mark, so SmartScreen and PowerShell ask before they run on this PC.`
26619
26637
  ),
26638
+ contained: external_exports.enum(["off", "vhdx"]).describe(
26639
+ '(beta) Keep the sandbox tools, state and logs inside one disk image file (vhdx) instead of loose folders, so scanning programs on this PC see one file. Not yet tried on a real PC. Turn it on with sandbox storage contained on (it moves your files and asks first); Windows asks for permission to mount the image when a sandbox starts. "off" = loose folders, as always. Yours only: a project file (.sandbox-config.json) cannot set it.'
26640
+ ),
26641
+ containedMaxGb: external_exports.number().int().min(8).max(4096).describe("(beta) Largest size, in GB, the disk image of storage.contained may grow to."),
26620
26642
  warnDataGb: external_exports.number().min(0).describe(
26621
26643
  "Say at launch when the persisted data (tools, databases, logins) is bigger than this many GB; 0 = never. sandbox data shows what takes the space."
26622
26644
  )
@@ -26660,7 +26682,13 @@ var LocalOverridesSchema = external_exports.strictObject({
26660
26682
  "Scripts (.ps1 / .mjs / .cmd, relative to this file) run inside the sandbox before the agent."
26661
26683
  ),
26662
26684
  // This PC's resources are yours to share: CPU and paging file (this PC's disk) are not a project's to set.
26663
- sandbox: SandboxSchema.omit({ cpuLimit: true, pageFileMb: true }).partial(),
26685
+ sandbox: SandboxSchema.omit({
26686
+ cpuLimit: true,
26687
+ pageFileMb: true,
26688
+ engine: true,
26689
+ agentMemoryHeadroomMb: true,
26690
+ pressureResponse: true
26691
+ }).partial(),
26664
26692
  // A project may block more (the LAN, hosts); it never opens hosts, ports, DNS or a proxy.
26665
26693
  network: NetworkSchema.pick({ blockPrivateRanges: true, blockHosts: true }).partial(),
26666
26694
  // A project may turn the kill switch on, never off, and never choose a VPN, a server, a file or a login.
@@ -26769,8 +26797,34 @@ var GuestRequestSchema = external_exports.discriminatedUnion("kind", [
26769
26797
  cwd: Text().optional(),
26770
26798
  createdAt: TimeSchema
26771
26799
  }),
26772
- external_exports.strictObject({ kind: external_exports.literal("ping"), id: IdSchema, createdAt: TimeSchema })
26800
+ external_exports.strictObject({ kind: external_exports.literal("ping"), id: IdSchema, createdAt: TimeSchema }),
26801
+ /**
26802
+ * The PC's own memory or CPU is running low (the host watchdog): the sandbox slows its heaviest builds down for
26803
+ * `seconds` (it never stops them) so Windows does not have to close it. Repeated while the PC stays low.
26804
+ */
26805
+ external_exports.strictObject({
26806
+ kind: external_exports.literal("pressure"),
26807
+ id: IdSchema,
26808
+ reason: Text(300),
26809
+ seconds: external_exports.number().int().min(10).max(300),
26810
+ createdAt: TimeSchema
26811
+ })
26773
26812
  ]);
26813
+ var PressureStatusSchema = external_exports.object({
26814
+ level: external_exports.enum(["ok", "throttled", "suspending"]),
26815
+ profile: external_exports.enum(["normal", "gentle"]),
26816
+ /** Share of the sandbox's RAM still free and of its commit limit in use (percent). */
26817
+ ramFreePercent: external_exports.number().int().min(0).max(100),
26818
+ commitPercent: external_exports.number().int().min(0).max(100),
26819
+ /** Programs running at lower priority because of it. */
26820
+ lowered: external_exports.number().int().min(0).max(1024),
26821
+ /** Programs paused right now (name, process id, seconds left). */
26822
+ paused: external_exports.array(external_exports.object({ name: Text(64), pid: external_exports.number().int(), seconds: external_exports.number().int().min(0).max(60) })).max(8),
26823
+ /** The PC itself asked for slowing down (its memory or CPU is low). */
26824
+ pcLow: external_exports.boolean(),
26825
+ lastAction: Text(300),
26826
+ updatedAt: TimeSchema
26827
+ });
26774
26828
  var GuestResponseSchema = external_exports.object({
26775
26829
  id: IdSchema,
26776
26830
  ok: external_exports.boolean(),
@@ -26950,6 +27004,8 @@ var RunDir = class {
26950
27004
  root;
26951
27005
  sandboxFile;
26952
27006
  vpnFile;
27007
+ /** What the memory governor in the sandbox is doing (pressure.json). */
27008
+ pressureFile;
26953
27009
  requestsDir;
26954
27010
  responsesDir;
26955
27011
  sessionsDir;
@@ -26962,6 +27018,7 @@ var RunDir = class {
26962
27018
  this.root = path3.join(dataDir2, "run");
26963
27019
  this.sandboxFile = path3.join(this.root, "sandbox.json");
26964
27020
  this.vpnFile = path3.join(this.root, "vpn.json");
27021
+ this.pressureFile = path3.join(this.root, "pressure.json");
26965
27022
  this.requestsDir = path3.join(this.root, "requests");
26966
27023
  this.responsesDir = path3.join(this.root, "responses");
26967
27024
  this.sessionsDir = path3.join(this.root, "sessions");
@@ -26990,6 +27047,9 @@ var RunDir = class {
26990
27047
  readVpnStatus() {
26991
27048
  return readValid(VpnStatusSchema, this.vpnFile);
26992
27049
  }
27050
+ readPressure() {
27051
+ return readValid(PressureStatusSchema, this.pressureFile);
27052
+ }
26993
27053
  readSession(id) {
26994
27054
  return readValid(SessionStatusSchema, this.sessionFile(id));
26995
27055
  }
@@ -27075,6 +27135,7 @@ var SYSTEM = {
27075
27135
  shutdown: () => system32("shutdown.exe"),
27076
27136
  dism: () => system32("Dism.exe"),
27077
27137
  msiexec: () => system32("msiexec.exe"),
27138
+ sc: () => system32("sc.exe"),
27078
27139
  /** The .NET Framework C# compiler that ships with Windows (C# 5). */
27079
27140
  csc: () => path5.join(systemRoot(), "Microsoft.NET", "Framework64", "v4.0.30319", "csc.exe")
27080
27141
  };
@@ -5622,7 +5622,14 @@ var KEPT_OSC = (body) => {
5622
5622
  return n <= 2 || n === 8 || n === 133 || n === 9 && body.startsWith(number4[1] + ";4;");
5623
5623
  };
5624
5624
  var MAX_KEPT_STRING = 4096;
5625
+ var MAX_CLIPBOARD_STRING = 1024 * 1024;
5626
+ var CLIPBOARD_WRITE = /^0{0,2}52;[cpqs0-7]{0,8};[A-Za-z0-9+/=]*$/;
5625
5627
  var OutputFilter = class {
5628
+ constructor(options = {}) {
5629
+ this.options = options;
5630
+ this.maxString = options.clipboardWrites ? MAX_CLIPBOARD_STRING : MAX_KEPT_STRING;
5631
+ }
5632
+ options;
5626
5633
  /**
5627
5634
  * text: normal output; esc: after ESC; c2: after a 0xC2 lead byte; string: inside an OSC/DCS/...; stringEsc /
5628
5635
  * stringC2: a possible terminator inside one.
@@ -5630,8 +5637,14 @@ var OutputFilter = class {
5630
5637
  state = "text";
5631
5638
  /** The string being read: an OSC worth keeping is collected until its terminator; null = being dropped. */
5632
5639
  body = null;
5640
+ maxString;
5641
+ /** An OSC that may pass: a short title, link, progress or mark, or (when allowed) a clipboard write. */
5642
+ kept(body) {
5643
+ if (this.options.clipboardWrites && CLIPBOARD_WRITE.test(body)) return true;
5644
+ return body.length <= MAX_KEPT_STRING && KEPT_OSC(body);
5645
+ }
5633
5646
  push(chunk) {
5634
- const out = Buffer.allocUnsafe(chunk.length + MAX_KEPT_STRING + 8);
5647
+ const out = Buffer.allocUnsafe(chunk.length + (this.body?.length ?? 0) + 8);
5635
5648
  let n = 0;
5636
5649
  const put = (...bytes) => {
5637
5650
  for (const b of bytes) out[n++] = b;
@@ -5651,7 +5664,7 @@ var OutputFilter = class {
5651
5664
  };
5652
5665
  const endString = (terminator) => {
5653
5666
  const body = this.body && Buffer.from(this.body).toString("latin1");
5654
- if (body !== null && KEPT_OSC(body)) {
5667
+ if (body !== null && this.kept(body)) {
5655
5668
  put(27, 93);
5656
5669
  out.write(body, n, "latin1");
5657
5670
  n += body.length;
@@ -5661,7 +5674,7 @@ var OutputFilter = class {
5661
5674
  this.state = "text";
5662
5675
  };
5663
5676
  const collect = (b) => {
5664
- if (this.body && this.body.push(b) > MAX_KEPT_STRING) this.body = null;
5677
+ if (this.body && this.body.push(b) > this.maxString) this.body = null;
5665
5678
  };
5666
5679
  for (const b of chunk) {
5667
5680
  switch (this.state) {
@@ -5751,6 +5764,7 @@ var SYSTEM = {
5751
5764
  shutdown: () => system32("shutdown.exe"),
5752
5765
  dism: () => system32("Dism.exe"),
5753
5766
  msiexec: () => system32("msiexec.exe"),
5767
+ sc: () => system32("sc.exe"),
5754
5768
  /** The .NET Framework C# compiler that ships with Windows (C# 5). */
5755
5769
  csc: () => path.join(systemRoot(), "Microsoft.NET", "Framework64", "v4.0.30319", "csc.exe")
5756
5770
  };
@@ -5861,7 +5875,7 @@ function runTerminalClient(socket, token, options = {}) {
5861
5875
  return new Promise((resolve) => {
5862
5876
  let done = false;
5863
5877
  const reader = new FrameReader();
5864
- const filter = new OutputFilter();
5878
+ const filter = new OutputFilter({ clipboardWrites: options.clipboardWrites });
5865
5879
  let sent = size();
5866
5880
  let resizeTimer;
5867
5881
  let vtInput;
@@ -25745,6 +25759,9 @@ var HarnessSchema = external_exports.strictObject({
25745
25759
  localState: external_exports.record(external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/), SubfolderSchema).optional().describe(
25746
25760
  "Environment variable -> folder below the agent's own state folder (state\\<agent>) for SQLite databases. SQLite cannot run in a mapped folder, so the agent runs from a copy on the sandbox's disk (the variable points to it) that is copied from and back to that folder."
25747
25761
  ),
25762
+ bootReset: external_exports.array(SubfolderSchema).max(32).optional().describe(
25763
+ "Files and folders below the agent's own state folder (state\\<agent>) that only work on the machine that wrote them (keys sealed with Windows DPAPI, local accounts it created). Every sandbox is a new machine, so they are deleted at each boot and the agent sets them up again."
25764
+ ),
25748
25765
  resumeArguments: StringsSchema.optional().describe(
25749
25766
  "Arguments used when the agent is restarted in place (e.g. after an account switch) so it resumes the conversation."
25750
25767
  ),
@@ -25822,6 +25839,9 @@ var MappingSchema = external_exports.strictObject({
25822
25839
  optional: external_exports.boolean().optional().describe("true = skip it quietly when the host folder does not exist.")
25823
25840
  });
25824
25841
  var SandboxSchema = external_exports.strictObject({
25842
+ engine: external_exports.enum(["windows-sandbox", "hcs"]).describe(
25843
+ '(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.'
25844
+ ),
25825
25845
  memoryMb: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(2048)]).describe('Sandbox RAM in MB (>= 2048), or "auto": free RAM minus reserveHostMb, capped at maxMemoryMb.'),
25826
25846
  maxMemoryMb: external_exports.number().int().positive().describe('Upper limit for memoryMb "auto".'),
25827
25847
  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).`),
@@ -25831,10 +25851,22 @@ var SandboxSchema = external_exports.strictObject({
25831
25851
  pageFileMb: external_exports.number().int().min(0).max(262144).describe(
25832
25852
  `Size of the sandbox's paging file in MB, created at full size when it starts so it never grows while builds run (8 GB of its disk always stays free). Windows Sandbox starts with about 1 GB: parallel builds then fail with "The paging file is too small", and Windows grows the file under load. 0 = leave Windows' own.`
25833
25853
  ),
25834
- reserveHostMb: external_exports.number().int().nonnegative().describe('RAM always left for this PC when memoryMb is "auto".'),
25835
- vGpu: external_exports.boolean().describe("Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface."),
25854
+ reserveHostMb: external_exports.number().int().nonnegative().describe(
25855
+ 'Memory always left for this PC when memoryMb is "auto": the sandbox gets at most (free RAM, and RAM plus paging file still unused) minus this.'
25856
+ ),
25857
+ agentMemoryHeadroomMb: external_exports.union([external_exports.literal("auto"), external_exports.literal("none"), external_exports.number().int().min(0)]).describe(
25858
+ 'Memory kept out of the agents reach inside the sandbox, in MB: everything the agents start (their builds, tests, tools) together may use at most the sandbox memory minus this; a runaway parallel build then gets out-of-memory errors in its own session instead of freezing or crashing the whole sandbox. "auto" = the larger of 2048 MB and 10 % of the sandbox memory; "none" = no limit. Yours only: a project file cannot change it.'
25859
+ ),
25860
+ pressureResponse: external_exports.boolean().describe(
25861
+ "When the sandbox (or this PC) runs low on memory, slow the heaviest build programs down (lower priority) and, if that is not enough, pause the biggest compiler for a few seconds at a time, so heavy parallel builds slow down instead of closing the sandbox. Never touches the agents themselves. Yours only: a project file cannot change it."
25862
+ ),
25863
+ vGpu: external_exports.boolean().describe(
25864
+ "Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface. The sandbox then uses this PC's graphics card, and with some graphics drivers heavy use can freeze the whole PC: turn it on only when a program in the sandbox needs the GPU (the mesa toolchain gives software OpenGL without it)."
25865
+ ),
25836
25866
  networking: external_exports.boolean().describe("Internet access. false is the only hard network isolation Windows Sandbox offers."),
25837
- clipboard: external_exports.boolean().describe("Shared clipboard between this PC and the sandbox."),
25867
+ clipboard: external_exports.boolean().describe(
25868
+ "Shared clipboard between this PC and the sandbox. Also lets an agent's copy (in sandbox attach) reach this PC's clipboard."
25869
+ ),
25838
25870
  audioInput: external_exports.boolean().describe("Microphone access."),
25839
25871
  videoInput: external_exports.boolean().describe("Camera access."),
25840
25872
  printerRedirection: external_exports.boolean().describe("Printers from this PC."),
@@ -26916,18 +26948,18 @@ var WebSchema = external_exports.strictObject({
26916
26948
  });
26917
26949
 
26918
26950
  // src/core/schema/vpn.ts
26919
- var VPN_PROVIDERS = ["nordvpn", "openvpn-file"];
26951
+ var VPN_PROVIDERS = ["nordvpn", "openvpn-file", "wireguard-file"];
26920
26952
  var VpnSchema = external_exports.strictObject({
26921
26953
  enabled: external_exports.boolean().describe(
26922
26954
  "Send the sandbox's traffic through a VPN. Only the sandbox: your PC's own connection is untouched. Needs a saved login first (sandbox vpn login). The agent in the sandbox can read that login and can turn the tunnel off (it is the administrator there)."
26923
26955
  ),
26924
26956
  provider: external_exports.enum(VPN_PROVIDERS).describe(
26925
- "nordvpn: a recommended NordVPN server is picked at every launch. openvpn-file: your own .ovpn file (configFile)."
26957
+ "nordvpn: a recommended NordVPN server is picked at every launch. openvpn-file: your own .ovpn file (configFile). wireguard-file: your own WireGuard .conf (configFile), e.g. from your company."
26926
26958
  ),
26927
26959
  protocol: external_exports.enum(["udp", "tcp"]).describe("udp is faster; tcp gets through networks that block udp."),
26928
26960
  country: external_exports.string().regex(/^([A-Za-z][A-Za-z .'-]{0,39})?$/, "a country name or code like uk or Germany").describe("nordvpn: the country of the server, e.g. uk, us or Germany. Empty = the best server anywhere."),
26929
26961
  configFile: external_exports.string().describe(
26930
- "openvpn-file: the .ovpn file on this PC (its certificates inside it). Files that run programs (script-security, up, down, plugin ...) are refused. A project's file can never set this."
26962
+ "openvpn-file / wireguard-file: the .ovpn or .conf file on this PC (an .ovpn has its certificates inside it). Files that run programs (script-security, up, down, plugin, PostUp ...) are refused. A WireGuard file holds your private key: it is read when a sandbox starts and handed over in a one-shot file. A project's file can never set this."
26931
26963
  ),
26932
26964
  killSwitch: external_exports.boolean().describe(
26933
26965
  "Block all traffic that does not go through the tunnel: when the tunnel cannot start, the sandbox stays offline instead of using your normal connection. A project can only turn this on, never off."
@@ -26954,6 +26986,10 @@ var ConfigSchema = external_exports.strictObject({
26954
26986
  markSandboxFiles: external_exports.boolean().describe(
26955
26987
  `Programs and scripts (.exe, .ps1, .bat, .cmd, .msi, .lnk ...) that appear or change in your project while a sandbox runs get Windows' "downloaded from the internet" mark, so SmartScreen and PowerShell ask before they run on this PC.`
26956
26988
  ),
26989
+ contained: external_exports.enum(["off", "vhdx"]).describe(
26990
+ '(beta) Keep the sandbox tools, state and logs inside one disk image file (vhdx) instead of loose folders, so scanning programs on this PC see one file. Not yet tried on a real PC. Turn it on with sandbox storage contained on (it moves your files and asks first); Windows asks for permission to mount the image when a sandbox starts. "off" = loose folders, as always. Yours only: a project file (.sandbox-config.json) cannot set it.'
26991
+ ),
26992
+ containedMaxGb: external_exports.number().int().min(8).max(4096).describe("(beta) Largest size, in GB, the disk image of storage.contained may grow to."),
26957
26993
  warnDataGb: external_exports.number().min(0).describe(
26958
26994
  "Say at launch when the persisted data (tools, databases, logins) is bigger than this many GB; 0 = never. sandbox data shows what takes the space."
26959
26995
  )
@@ -26997,7 +27033,13 @@ var LocalOverridesSchema = external_exports.strictObject({
26997
27033
  "Scripts (.ps1 / .mjs / .cmd, relative to this file) run inside the sandbox before the agent."
26998
27034
  ),
26999
27035
  // This PC's resources are yours to share: CPU and paging file (this PC's disk) are not a project's to set.
27000
- sandbox: SandboxSchema.omit({ cpuLimit: true, pageFileMb: true }).partial(),
27036
+ sandbox: SandboxSchema.omit({
27037
+ cpuLimit: true,
27038
+ pageFileMb: true,
27039
+ engine: true,
27040
+ agentMemoryHeadroomMb: true,
27041
+ pressureResponse: true
27042
+ }).partial(),
27001
27043
  // A project may block more (the LAN, hosts); it never opens hosts, ports, DNS or a proxy.
27002
27044
  network: NetworkSchema.pick({ blockPrivateRanges: true, blockHosts: true }).partial(),
27003
27045
  // A project may turn the kill switch on, never off, and never choose a VPN, a server, a file or a login.
@@ -27106,8 +27148,34 @@ var GuestRequestSchema = external_exports.discriminatedUnion("kind", [
27106
27148
  cwd: Text().optional(),
27107
27149
  createdAt: TimeSchema
27108
27150
  }),
27109
- external_exports.strictObject({ kind: external_exports.literal("ping"), id: IdSchema, createdAt: TimeSchema })
27151
+ external_exports.strictObject({ kind: external_exports.literal("ping"), id: IdSchema, createdAt: TimeSchema }),
27152
+ /**
27153
+ * The PC's own memory or CPU is running low (the host watchdog): the sandbox slows its heaviest builds down for
27154
+ * `seconds` (it never stops them) so Windows does not have to close it. Repeated while the PC stays low.
27155
+ */
27156
+ external_exports.strictObject({
27157
+ kind: external_exports.literal("pressure"),
27158
+ id: IdSchema,
27159
+ reason: Text(300),
27160
+ seconds: external_exports.number().int().min(10).max(300),
27161
+ createdAt: TimeSchema
27162
+ })
27110
27163
  ]);
27164
+ var PressureStatusSchema = external_exports.object({
27165
+ level: external_exports.enum(["ok", "throttled", "suspending"]),
27166
+ profile: external_exports.enum(["normal", "gentle"]),
27167
+ /** Share of the sandbox's RAM still free and of its commit limit in use (percent). */
27168
+ ramFreePercent: external_exports.number().int().min(0).max(100),
27169
+ commitPercent: external_exports.number().int().min(0).max(100),
27170
+ /** Programs running at lower priority because of it. */
27171
+ lowered: external_exports.number().int().min(0).max(1024),
27172
+ /** Programs paused right now (name, process id, seconds left). */
27173
+ paused: external_exports.array(external_exports.object({ name: Text(64), pid: external_exports.number().int(), seconds: external_exports.number().int().min(0).max(60) })).max(8),
27174
+ /** The PC itself asked for slowing down (its memory or CPU is low). */
27175
+ pcLow: external_exports.boolean(),
27176
+ lastAction: Text(300),
27177
+ updatedAt: TimeSchema
27178
+ });
27111
27179
  var GuestResponseSchema = external_exports.object({
27112
27180
  id: IdSchema,
27113
27181
  ok: external_exports.boolean(),
@@ -27189,6 +27257,8 @@ var RunDir = class {
27189
27257
  root;
27190
27258
  sandboxFile;
27191
27259
  vpnFile;
27260
+ /** What the memory governor in the sandbox is doing (pressure.json). */
27261
+ pressureFile;
27192
27262
  requestsDir;
27193
27263
  responsesDir;
27194
27264
  sessionsDir;
@@ -27201,6 +27271,7 @@ var RunDir = class {
27201
27271
  this.root = path3.join(dataDir2, "run");
27202
27272
  this.sandboxFile = path3.join(this.root, "sandbox.json");
27203
27273
  this.vpnFile = path3.join(this.root, "vpn.json");
27274
+ this.pressureFile = path3.join(this.root, "pressure.json");
27204
27275
  this.requestsDir = path3.join(this.root, "requests");
27205
27276
  this.responsesDir = path3.join(this.root, "responses");
27206
27277
  this.sessionsDir = path3.join(this.root, "sessions");
@@ -27229,6 +27300,9 @@ var RunDir = class {
27229
27300
  readVpnStatus() {
27230
27301
  return readValid(VpnStatusSchema, this.vpnFile);
27231
27302
  }
27303
+ readPressure() {
27304
+ return readValid(PressureStatusSchema, this.pressureFile);
27305
+ }
27232
27306
  readSession(id) {
27233
27307
  return readValid(SessionStatusSchema, this.sessionFile(id));
27234
27308
  }
@@ -27287,7 +27361,7 @@ async function viewSession(id) {
27287
27361
  return 1;
27288
27362
  }
27289
27363
  const socket = await connect({ ...session.attach, addresses: ["127.0.0.1"] });
27290
- const result = await runTerminalClient(socket, session.attach.token);
27364
+ const result = await runTerminalClient(socket, session.attach.token, { clipboardWrites: true });
27291
27365
  if (result.reason === "exit") console.log(session.harness + " exited with code " + result.exitCode + ".");
27292
27366
  else if (result.reason === "error") console.log("Session error: " + result.message);
27293
27367
  return result.reason === "exit" ? result.exitCode : 1;
@@ -5,7 +5,7 @@ import path from 'node:path';
5
5
  import { DEFAULTS, mergeConfig, validateConfig } from '../core/config/index.js';
6
6
  import { isWin } from '../core/util/index.js';
7
7
  import { SYSTEM } from '../shared/system.js';
8
- import { agentCommand, agentShims, isCopyableDatabaseFile, isDatabaseFile, localStateEntries, shimText, } from '../guest/agents/agent-files.js';
8
+ import { agentCommand, agentShims, bootResetPaths, isCopyableDatabaseFile, isDatabaseFile, localStateEntries, shimText, } from '../guest/agents/agent-files.js';
9
9
  import { appendMissing, expandVars, isPinnedNodeDir, parseRegPath, pathKey, planPath, rebuildPath, splitPath, } from '../guest/setup/path-plan.js';
10
10
  import { withReloadEnvironment } from '../host/tools/index.js';
11
11
  import { HarnessSchema } from '../core/schema/index.js';
@@ -48,6 +48,16 @@ export const agentPathsSuite = {
48
48
  t.check(HarnessSchema.safeParse({ ...DEFAULTS.harnesses.codex, localState: { X: '..\\up' } }).success === false, 'a local state folder cannot leave the agent state folder');
49
49
  t.equal(['state_5.sqlite', 'x.sqlite-wal', 'x.sqlite-shm', 'a.db', 'auth.json'].map(isDatabaseFile), [true, true, true, true, false], 'database files are told apart');
50
50
  t.equal(['state_5.sqlite', 'x.sqlite-wal', 'x.sqlite-shm'].map(isCopyableDatabaseFile), [true, true, false], 'the -shm file is not copied (SQLite rebuilds it)');
51
+ t.section('agent files sealed to the last sandbox');
52
+ t.equal(bootResetPaths(DEFAULTS.harnesses, 'C:\\AgentData\\state')
53
+ .filter((p) => p.agent === 'codex')
54
+ .map((p) => p.path), [
55
+ 'C:\\AgentData\\state\\codex\\.sandbox-secrets',
56
+ 'C:\\AgentData\\state\\codex\\.sandbox\\setup_marker.json',
57
+ 'C:\\AgentData\\state\\codex\\.sandbox\\deny_read_acl_state.json',
58
+ ], "codex's DPAPI-sealed sandbox users and setup marker are removed at boot (CryptUnprotectData otherwise)");
59
+ t.check(HarnessSchema.safeParse({ ...DEFAULTS.harnesses.codex, bootReset: ['..\\login'] }).success === false &&
60
+ HarnessSchema.safeParse({ ...DEFAULTS.harnesses.codex, bootReset: ['C:\\Windows'] }).success === false, 'bootReset takes only plain paths below the agent state folder');
51
61
  t.section('PATH planner');
52
62
  const present = new Set(['c:\\a', 'c:\\b', 'c:\\c\\d', 'c:\\nvm\\v24.1.0']);
53
63
  const exists = (f) => present.has(pathKey(f));
@@ -0,0 +1,2 @@
1
+ import type { Suite } from './support/suite.js';
2
+ export declare const appSuite: Suite;