windows-development-sandbox 1.4.1 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (872) hide show
  1. package/config.example.json +3 -1
  2. package/dist/api.js +27 -16
  3. package/dist/cli/args.d.ts +4 -6
  4. package/dist/cli/args.js +67 -34
  5. package/dist/cli/argv.d.ts +9 -0
  6. package/dist/cli/argv.js +22 -0
  7. package/dist/cli/commands/accounts.d.ts +1 -1
  8. package/dist/cli/commands/accounts.js +42 -27
  9. package/dist/cli/commands/agent-commands.d.ts +3 -3
  10. package/dist/cli/commands/agent-commands.js +27 -18
  11. package/dist/cli/commands/context.d.ts +9 -11
  12. package/dist/cli/commands/context.js +35 -32
  13. package/dist/cli/commands/data/clean.d.ts +2 -2
  14. package/dist/cli/commands/data/clean.js +27 -11
  15. package/dist/cli/commands/data/collect.d.ts +6 -3
  16. package/dist/cli/commands/data/collect.js +46 -15
  17. package/dist/cli/commands/data/index.d.ts +2 -2
  18. package/dist/cli/commands/data/index.js +30 -12
  19. package/dist/cli/commands/data/remove.d.ts +1 -1
  20. package/dist/cli/commands/data/remove.js +4 -4
  21. package/dist/cli/commands/index.d.ts +5 -4
  22. package/dist/cli/commands/index.js +5 -4
  23. package/dist/cli/commands/launch/add-root.d.ts +7 -0
  24. package/dist/cli/commands/launch/add-root.js +64 -0
  25. package/dist/cli/commands/launch/boot-progress.d.ts +7 -0
  26. package/dist/cli/commands/launch/boot-progress.js +48 -0
  27. package/dist/cli/commands/launch/boot-wants.d.ts +11 -0
  28. package/dist/cli/commands/launch/boot-wants.js +48 -0
  29. package/dist/cli/commands/launch/first-start.d.ts +10 -0
  30. package/dist/cli/commands/launch/first-start.js +53 -0
  31. package/dist/cli/commands/launch/index.d.ts +6 -0
  32. package/dist/cli/commands/launch/index.js +6 -0
  33. package/dist/cli/commands/launch/launch.d.ts +8 -0
  34. package/dist/cli/commands/launch/launch.js +211 -0
  35. package/dist/cli/commands/launch/prepare.d.ts +23 -0
  36. package/dist/cli/commands/launch/prepare.js +109 -0
  37. package/dist/cli/commands/launch/running.d.ts +45 -0
  38. package/dist/cli/commands/launch/running.js +218 -0
  39. package/dist/cli/commands/launch/summary.d.ts +8 -0
  40. package/dist/cli/commands/launch/summary.js +98 -0
  41. package/dist/cli/commands/maintenance/audit.d.ts +3 -0
  42. package/dist/cli/commands/maintenance/audit.js +58 -0
  43. package/dist/cli/commands/maintenance/clean.d.ts +2 -0
  44. package/dist/cli/commands/maintenance/clean.js +10 -0
  45. package/dist/cli/commands/maintenance/config.d.ts +2 -0
  46. package/dist/cli/commands/maintenance/config.js +145 -0
  47. package/dist/cli/commands/maintenance/doctor.d.ts +2 -0
  48. package/dist/cli/commands/maintenance/doctor.js +52 -0
  49. package/dist/cli/commands/maintenance/host-claude.d.ts +2 -0
  50. package/dist/cli/commands/maintenance/host-claude.js +4 -0
  51. package/dist/cli/commands/maintenance/index.d.ts +8 -0
  52. package/dist/cli/commands/maintenance/index.js +9 -0
  53. package/dist/cli/commands/maintenance/logs.d.ts +2 -0
  54. package/dist/cli/commands/maintenance/logs.js +44 -0
  55. package/dist/cli/commands/maintenance/sync.d.ts +2 -0
  56. package/dist/cli/commands/maintenance/sync.js +12 -0
  57. package/dist/cli/commands/maintenance/watch.d.ts +3 -0
  58. package/dist/cli/commands/maintenance/watch.js +6 -0
  59. package/dist/cli/commands/projects/describe-sessions.d.ts +3 -0
  60. package/dist/cli/commands/projects/describe-sessions.js +15 -0
  61. package/dist/cli/commands/projects/here.d.ts +38 -0
  62. package/dist/cli/commands/projects/here.js +145 -0
  63. package/dist/cli/commands/projects/index.d.ts +4 -0
  64. package/dist/cli/commands/projects/index.js +4 -0
  65. package/dist/cli/commands/projects/projects.d.ts +14 -0
  66. package/dist/cli/commands/projects/projects.js +213 -0
  67. package/dist/cli/commands/projects/restart.d.ts +15 -0
  68. package/dist/cli/commands/projects/restart.js +149 -0
  69. package/dist/cli/commands/registry.d.ts +3 -0
  70. package/dist/cli/commands/registry.js +34 -0
  71. package/dist/cli/commands/repair/checks.js +105 -29
  72. package/dist/cli/commands/repair/finders.d.ts +13 -10
  73. package/dist/cli/commands/repair/finders.js +63 -43
  74. package/dist/cli/commands/repair/index.d.ts +4 -4
  75. package/dist/cli/commands/repair/index.js +47 -21
  76. package/dist/cli/commands/repair/types.d.ts +2 -2
  77. package/dist/cli/commands/repair/types.js +7 -2
  78. package/dist/cli/commands/sessions/attach.d.ts +2 -0
  79. package/dist/cli/commands/sessions/attach.js +45 -0
  80. package/dist/cli/commands/sessions/control.d.ts +4 -0
  81. package/dist/cli/commands/sessions/control.js +62 -0
  82. package/dist/cli/commands/sessions/exec.d.ts +6 -0
  83. package/dist/cli/commands/sessions/exec.js +72 -0
  84. package/dist/cli/commands/sessions/index.d.ts +6 -0
  85. package/dist/cli/commands/sessions/index.js +9 -0
  86. package/dist/cli/commands/sessions/list.d.ts +15 -0
  87. package/dist/cli/commands/sessions/list.js +65 -0
  88. package/dist/cli/commands/sessions/status.d.ts +2 -0
  89. package/dist/cli/commands/sessions/status.js +153 -0
  90. package/dist/cli/commands/sessions/window.d.ts +3 -0
  91. package/dist/cli/commands/sessions/window.js +18 -0
  92. package/dist/cli/commands/setup/checks.d.ts +4 -4
  93. package/dist/cli/commands/setup/checks.js +36 -19
  94. package/dist/cli/commands/setup/facts.d.ts +6 -6
  95. package/dist/cli/commands/setup/facts.js +23 -11
  96. package/dist/cli/commands/setup/index.d.ts +1 -1
  97. package/dist/cli/commands/setup/index.js +25 -12
  98. package/dist/cli/commands/user-config.d.ts +5 -5
  99. package/dist/cli/commands/user-config.js +14 -12
  100. package/dist/cli/history.d.ts +5 -4
  101. package/dist/cli/history.js +23 -11
  102. package/dist/cli/index.d.ts +4 -14
  103. package/dist/cli/index.js +27 -77
  104. package/dist/cli/manifest.d.ts +464 -10
  105. package/dist/cli/manifest.js +327 -53
  106. package/dist/cli/menu/apps.d.ts +7 -5
  107. package/dist/cli/menu/apps.js +64 -16
  108. package/dist/cli/menu/command-fields.d.ts +15 -0
  109. package/dist/cli/menu/command-fields.js +23 -0
  110. package/dist/cli/menu/command-form.d.ts +3 -5
  111. package/dist/cli/menu/command-form.js +116 -48
  112. package/dist/cli/menu/home.d.ts +22 -0
  113. package/dist/cli/menu/home.js +72 -0
  114. package/dist/cli/menu/index.d.ts +2 -24
  115. package/dist/cli/menu/index.js +4 -178
  116. package/dist/cli/menu/menu.d.ts +23 -0
  117. package/dist/cli/menu/menu.js +185 -0
  118. package/dist/cli/menu/settings/categories.d.ts +2 -2
  119. package/dist/cli/menu/settings/categories.js +123 -20
  120. package/dist/cli/menu/settings/collections/collection-editor.d.ts +23 -0
  121. package/dist/cli/menu/settings/collections/collection-editor.js +89 -0
  122. package/dist/cli/menu/settings/collections/map-editor.d.ts +10 -0
  123. package/dist/cli/menu/settings/collections/map-editor.js +34 -0
  124. package/dist/cli/menu/settings/collections/object-list-editor.d.ts +10 -0
  125. package/dist/cli/menu/settings/collections/object-list-editor.js +23 -0
  126. package/dist/cli/menu/settings/collections/object-map-editor.d.ts +10 -0
  127. package/dist/cli/menu/settings/collections/object-map-editor.js +35 -0
  128. package/dist/cli/menu/settings/collections/string-list-editor.d.ts +12 -0
  129. package/dist/cli/menu/settings/collections/string-list-editor.js +39 -0
  130. package/dist/cli/menu/settings/config-file.d.ts +2 -2
  131. package/dist/cli/menu/settings/config-file.js +42 -19
  132. package/dist/cli/menu/settings/editor-actions.d.ts +2 -0
  133. package/dist/cli/menu/settings/editor-actions.js +2 -0
  134. package/dist/cli/menu/settings/format.d.ts +5 -0
  135. package/dist/cli/menu/settings/format.js +39 -0
  136. package/dist/cli/menu/settings/index.d.ts +1 -29
  137. package/dist/cli/menu/settings/index.js +1 -133
  138. package/dist/cli/menu/settings/object-editor.d.ts +12 -0
  139. package/dist/cli/menu/settings/object-editor.js +86 -0
  140. package/dist/cli/menu/settings/schema-node.d.ts +3 -1
  141. package/dist/cli/menu/settings/schema-node.js +71 -24
  142. package/dist/cli/menu/settings/settings-editor.d.ts +30 -0
  143. package/dist/cli/menu/settings/settings-editor.js +176 -0
  144. package/dist/cli/menu/settings/{editors.d.ts → value-editor.d.ts} +2 -13
  145. package/dist/cli/menu/settings/value-editor.js +137 -0
  146. package/dist/cli/menu/several.d.ts +4 -4
  147. package/dist/cli/menu/several.js +61 -20
  148. package/dist/cli/{colors.d.ts → output/colors.d.ts} +8 -8
  149. package/dist/cli/{colors.js → output/colors.js} +32 -14
  150. package/dist/cli/output/index.d.ts +3 -0
  151. package/dist/cli/output/index.js +3 -0
  152. package/dist/cli/output/print.d.ts +5 -0
  153. package/dist/cli/output/print.js +14 -0
  154. package/dist/cli/{progress.d.ts → output/progress.d.ts} +5 -5
  155. package/dist/cli/{progress.js → output/progress.js} +42 -19
  156. package/dist/cli/report.d.ts +2 -0
  157. package/dist/cli/report.js +20 -0
  158. package/dist/cli/tui/app.d.ts +6 -16
  159. package/dist/cli/tui/app.js +28 -8
  160. package/dist/cli/tui/dialogs/confirm-screen.d.ts +20 -0
  161. package/dist/cli/tui/dialogs/confirm-screen.js +50 -0
  162. package/dist/cli/tui/dialogs/message-screen.d.ts +17 -0
  163. package/dist/cli/tui/dialogs/message-screen.js +55 -0
  164. package/dist/cli/tui/dialogs/paragraphs.d.ts +2 -0
  165. package/dist/cli/tui/dialogs/paragraphs.js +5 -0
  166. package/dist/cli/tui/dialogs/text-screen.d.ts +26 -0
  167. package/dist/cli/tui/dialogs/text-screen.js +107 -0
  168. package/dist/cli/tui/frame.js +3 -1
  169. package/dist/cli/tui/index.d.ts +7 -3
  170. package/dist/cli/tui/index.js +4 -2
  171. package/dist/cli/tui/list/list-screen.d.ts +29 -0
  172. package/dist/cli/tui/{list-screen.js → list/list-screen.js} +86 -23
  173. package/dist/cli/tui/{list-screen.d.ts → list/list-types.d.ts} +0 -28
  174. package/dist/cli/tui/screen.d.ts +14 -0
  175. package/dist/cli/tui/terminal.js +34 -10
  176. package/dist/cli/tui/text.d.ts +2 -1
  177. package/dist/cli/tui/text.js +37 -7
  178. package/dist/cli/tui/theme.js +27 -9
  179. package/dist/cli/validate.d.ts +8 -8
  180. package/dist/cli/validate.js +32 -21
  181. package/dist/core/config/defaults.d.ts +2 -0
  182. package/dist/core/config/defaults.js +203 -0
  183. package/dist/core/config/index.d.ts +2 -0
  184. package/dist/core/config/index.js +3 -0
  185. package/dist/core/{config.d.ts → config/loader.d.ts} +1 -2
  186. package/dist/core/config/loader.js +47 -0
  187. package/dist/core/{detect-databases.js → detect/databases.js} +111 -23
  188. package/dist/core/detect/index.d.ts +4 -0
  189. package/dist/core/detect/index.js +4 -0
  190. package/dist/core/{detect-pwsh.d.ts → detect/pwsh.d.ts} +1 -1
  191. package/dist/core/{detect-pwsh.js → detect/pwsh.js} +25 -11
  192. package/dist/core/{detect-toolchains.d.ts → detect/toolchains.d.ts} +1 -1
  193. package/dist/core/{detect-toolchains.js → detect/toolchains.js} +42 -5
  194. package/dist/{guest/toolchains → core/detect}/versions.js +28 -12
  195. package/dist/core/disk.d.ts +2 -0
  196. package/dist/core/disk.js +46 -3
  197. package/dist/core/local-config/boot-wants.d.ts +45 -0
  198. package/dist/core/local-config/boot-wants.js +120 -0
  199. package/dist/core/local-config/file.d.ts +3 -0
  200. package/dist/core/local-config/file.js +16 -0
  201. package/dist/core/local-config/index.d.ts +5 -0
  202. package/dist/core/local-config/index.js +7 -0
  203. package/dist/core/{local-config.d.ts → local-config/overrides.d.ts} +3 -18
  204. package/dist/core/{local-config.js → local-config/overrides.js} +45 -52
  205. package/dist/core/local-config/policy.d.ts +19 -0
  206. package/dist/core/local-config/policy.js +45 -0
  207. package/dist/core/local-config/trust.d.ts +13 -0
  208. package/dist/core/local-config/trust.js +43 -0
  209. package/dist/core/package-info.d.ts +4 -0
  210. package/dist/core/package-info.js +13 -0
  211. package/dist/core/run/guest-workspace.d.ts +23 -0
  212. package/dist/core/run/guest-workspace.js +47 -0
  213. package/dist/core/run/index.d.ts +3 -0
  214. package/dist/core/run/index.js +3 -0
  215. package/dist/core/run/resolve-run.d.ts +3 -0
  216. package/dist/core/run/resolve-run.js +202 -0
  217. package/dist/core/run/versions.d.ts +13 -0
  218. package/dist/core/run/versions.js +65 -0
  219. package/dist/core/safe-paths.js +17 -5
  220. package/dist/core/schema/apps.d.ts +4 -4
  221. package/dist/core/schema/apps.js +55 -21
  222. package/dist/core/schema/common.d.ts +13 -10
  223. package/dist/core/schema/common.js +16 -10
  224. package/dist/core/schema/config.d.ts +15 -10
  225. package/dist/core/schema/config.js +78 -53
  226. package/dist/core/schema/databases.d.ts +4 -3
  227. package/dist/core/schema/databases.js +16 -12
  228. package/dist/core/schema/harness.d.ts +1 -1
  229. package/dist/core/schema/harness.js +17 -7
  230. package/dist/core/schema/index.d.ts +6 -0
  231. package/dist/core/schema/index.js +8 -0
  232. package/dist/core/schema/json-schema.js +10 -5
  233. package/dist/core/schema/profile.d.ts +4 -4
  234. package/dist/core/schema/profile.js +37 -17
  235. package/dist/core/schema/projects.d.ts +1 -1
  236. package/dist/core/schema/projects.js +16 -6
  237. package/dist/core/schema/sandbox.d.ts +11 -11
  238. package/dist/core/schema/sandbox.js +101 -37
  239. package/dist/core/schema/toolchains.d.ts +6 -1
  240. package/dist/core/schema/toolchains.js +84 -34
  241. package/dist/core/types.d.ts +19 -9
  242. package/dist/core/util/errors.d.ts +8 -0
  243. package/dist/core/util/errors.js +14 -0
  244. package/dist/core/util/fs.d.ts +8 -0
  245. package/dist/core/util/fs.js +40 -0
  246. package/dist/core/util/index.d.ts +7 -0
  247. package/dist/core/util/index.js +7 -0
  248. package/dist/core/util/jsonc.d.ts +6 -0
  249. package/dist/core/util/jsonc.js +25 -0
  250. package/dist/core/util/links.d.ts +10 -0
  251. package/dist/core/util/links.js +39 -0
  252. package/dist/core/util/paths.d.ts +7 -0
  253. package/dist/core/util/paths.js +33 -0
  254. package/dist/core/util/process.d.ts +15 -0
  255. package/dist/core/util/process.js +54 -0
  256. package/dist/core/util/text.d.ts +8 -0
  257. package/dist/core/util/text.js +8 -0
  258. package/dist/guest/{setup/agents.js → agents/agent-installer.js} +24 -4
  259. package/dist/guest/apps/after-install.d.ts +3 -0
  260. package/dist/guest/apps/after-install.js +47 -0
  261. package/dist/guest/apps/app-installer.d.ts +22 -0
  262. package/dist/guest/apps/app-installer.js +116 -0
  263. package/dist/guest/apps/find-exe.d.ts +5 -0
  264. package/dist/guest/apps/find-exe.js +41 -0
  265. package/dist/guest/apps/index.d.ts +3 -10
  266. package/dist/guest/apps/index.js +6 -206
  267. package/dist/guest/apps/resolvers.js +37 -9
  268. package/dist/guest/apps/shortcuts.d.ts +6 -0
  269. package/dist/guest/apps/shortcuts.js +28 -0
  270. package/dist/guest/apps/sources.d.ts +4 -0
  271. package/dist/guest/apps/sources.js +17 -0
  272. package/dist/guest/apps/unpack.d.ts +3 -0
  273. package/dist/guest/apps/unpack.js +47 -0
  274. package/dist/guest/{audit-parse.js → audit/parse.js} +39 -3
  275. package/dist/guest/{audit.d.ts → audit/process-audit.d.ts} +3 -1
  276. package/dist/guest/{audit.js → audit/process-audit.js} +33 -8
  277. package/dist/guest/boot/boot-env.d.ts +4 -0
  278. package/dist/guest/{boot-env.js → boot/boot-env.js} +7 -5
  279. package/dist/guest/boot/boot.d.ts +1 -0
  280. package/dist/guest/{main.js → boot/boot.js} +96 -50
  281. package/dist/guest/{guide.js → boot/guide.js} +32 -7
  282. package/dist/guest/{project-env.d.ts → boot/project-env.d.ts} +3 -3
  283. package/dist/guest/{project-env.js → boot/project-env.js} +12 -4
  284. package/dist/guest/boot/project-status.d.ts +5 -0
  285. package/dist/guest/boot/project-status.js +28 -0
  286. package/dist/guest/daemon/daemon.d.ts +1 -0
  287. package/dist/guest/daemon/daemon.js +51 -0
  288. package/dist/guest/daemon/exec.js +18 -6
  289. package/dist/guest/daemon/{shutdown.js → idle-shutdown.js} +5 -4
  290. package/dist/guest/daemon/{project.d.ts → project-provisioner.d.ts} +3 -3
  291. package/dist/guest/daemon/{project.js → project-provisioner.js} +60 -22
  292. package/dist/guest/daemon/relays.js +5 -3
  293. package/dist/guest/daemon/{session.js → sessions.js} +84 -24
  294. package/dist/guest/daemon/state.d.ts +4 -1
  295. package/dist/guest/daemon/state.js +34 -20
  296. package/dist/guest/databases/database-server.d.ts +13 -0
  297. package/dist/guest/databases/database-server.js +35 -0
  298. package/dist/guest/databases/dynamodb.d.ts +12 -0
  299. package/dist/guest/databases/dynamodb.js +81 -0
  300. package/dist/guest/databases/index.d.ts +2 -0
  301. package/dist/guest/databases/index.js +2 -0
  302. package/dist/guest/databases/mongodb.d.ts +7 -0
  303. package/dist/guest/databases/mongodb.js +46 -0
  304. package/dist/guest/databases/mysql.d.ts +7 -0
  305. package/dist/guest/databases/mysql.js +59 -0
  306. package/dist/guest/databases/names.d.ts +5 -0
  307. package/dist/guest/databases/names.js +8 -0
  308. package/dist/guest/databases/postgres.d.ts +9 -0
  309. package/dist/guest/databases/postgres.js +85 -0
  310. package/dist/guest/databases/redis.d.ts +7 -0
  311. package/dist/guest/databases/redis.js +25 -0
  312. package/dist/guest/databases/registry.d.ts +5 -0
  313. package/dist/guest/databases/registry.js +51 -0
  314. package/dist/guest/databases/sbx-db.d.ts +1 -0
  315. package/dist/guest/{db.js → databases/sbx-db.js} +13 -13
  316. package/dist/guest/{toolchains/databases → databases}/server.d.ts +5 -5
  317. package/dist/guest/{toolchains/databases → databases}/server.js +18 -13
  318. package/dist/guest/entries/daemon.js +16 -0
  319. package/dist/guest/entries/db.js +10 -0
  320. package/dist/guest/entries/gitguard.js +20 -0
  321. package/dist/guest/entries/main.d.ts +1 -0
  322. package/dist/guest/entries/main.js +24 -0
  323. package/dist/guest/entries/netproxy.d.ts +1 -0
  324. package/dist/guest/entries/netproxy.js +7 -0
  325. package/dist/guest/entries/view.d.ts +1 -0
  326. package/dist/guest/entries/view.js +11 -0
  327. package/dist/guest/{gitguard.js → git/decision.js} +49 -26
  328. package/dist/guest/network/addresses.d.ts +2 -0
  329. package/dist/guest/network/addresses.js +6 -0
  330. package/dist/guest/{setup/network.d.ts → network/allow-only.d.ts} +0 -10
  331. package/dist/guest/network/allow-only.js +84 -0
  332. package/dist/guest/network/firewall.d.ts +9 -0
  333. package/dist/guest/{setup/network.js → network/firewall.js} +58 -63
  334. package/dist/guest/network/proxy-server.d.ts +2 -0
  335. package/dist/guest/{netproxy.js → network/proxy-server.js} +37 -18
  336. package/dist/guest/{helpers.d.ts → runtime/csc.d.ts} +1 -1
  337. package/dist/guest/{helpers.js → runtime/csc.js} +7 -2
  338. package/dist/guest/runtime/fs.d.ts +2 -0
  339. package/dist/guest/runtime/fs.js +6 -0
  340. package/dist/guest/runtime/log.d.ts +3 -0
  341. package/dist/guest/runtime/log.js +22 -0
  342. package/dist/guest/runtime/paths.d.ts +13 -0
  343. package/dist/guest/runtime/paths.js +14 -0
  344. package/dist/guest/{ports.js → runtime/ports.js} +8 -2
  345. package/dist/guest/runtime/process.d.ts +15 -0
  346. package/dist/guest/runtime/process.js +59 -0
  347. package/dist/guest/{project-context.js → runtime/project-context.js} +1 -1
  348. package/dist/guest/runtime/session.d.ts +5 -0
  349. package/dist/guest/runtime/session.js +10 -0
  350. package/dist/guest/runtime/status.d.ts +7 -0
  351. package/dist/guest/runtime/status.js +57 -0
  352. package/dist/guest/{cmdline.js → sessions/cmdline.js} +10 -4
  353. package/dist/guest/{ptyhost.js → sessions/pty-host.js} +12 -5
  354. package/dist/guest/{view.js → sessions/viewer.js} +8 -11
  355. package/dist/guest/setup/claude-mem.d.ts +10 -0
  356. package/dist/guest/setup/{claude.js → claude-mem.js} +18 -78
  357. package/dist/guest/setup/{claude.d.ts → claude-profile.d.ts} +0 -10
  358. package/dist/guest/setup/claude-profile.js +89 -0
  359. package/dist/guest/setup/desktop.d.ts +2 -0
  360. package/dist/guest/setup/desktop.js +32 -0
  361. package/dist/guest/setup/environment.js +28 -5
  362. package/dist/guest/setup/{user.d.ts → git-identity.d.ts} +0 -2
  363. package/dist/guest/setup/git-identity.js +34 -0
  364. package/dist/guest/{gitrules.d.ts → setup/git-rules.d.ts} +1 -1
  365. package/dist/guest/setup/git-rules.js +50 -0
  366. package/dist/guest/setup/hooks.js +22 -5
  367. package/dist/guest/setup/{policy.js → managed-policy.js} +2 -2
  368. package/dist/guest/toolchains/catalogue.d.ts +4 -4
  369. package/dist/guest/toolchains/catalogue.js +30 -7
  370. package/dist/guest/toolchains/detect.d.ts +12 -0
  371. package/dist/guest/toolchains/detect.js +54 -0
  372. package/dist/guest/toolchains/index.d.ts +3 -17
  373. package/dist/guest/toolchains/index.js +1 -106
  374. package/dist/guest/toolchains/install.d.ts +20 -0
  375. package/dist/guest/toolchains/install.js +29 -0
  376. package/dist/guest/toolchains/languages/go.d.ts +3 -0
  377. package/dist/guest/toolchains/{go.js → languages/go.js} +27 -9
  378. package/dist/guest/toolchains/languages/java.d.ts +8 -0
  379. package/dist/guest/toolchains/{java.js → languages/java.js} +57 -18
  380. package/dist/guest/toolchains/languages/node.d.ts +3 -0
  381. package/dist/guest/toolchains/{node.js → languages/node.js} +51 -18
  382. package/dist/guest/toolchains/languages/php.d.ts +3 -0
  383. package/dist/guest/toolchains/{scripting → languages}/php.js +36 -11
  384. package/dist/guest/toolchains/languages/python-tools.d.ts +3 -0
  385. package/dist/guest/toolchains/languages/python-tools.js +12 -0
  386. package/dist/guest/toolchains/languages/python.d.ts +3 -0
  387. package/dist/guest/toolchains/{python.js → languages/python.js} +29 -16
  388. package/dist/guest/toolchains/languages/ruby.d.ts +3 -0
  389. package/dist/guest/toolchains/{scripting → languages}/ruby.js +28 -10
  390. package/dist/guest/toolchains/leftovers.d.ts +1 -1
  391. package/dist/guest/toolchains/leftovers.js +13 -11
  392. package/dist/guest/toolchains/managers.d.ts +6 -6
  393. package/dist/guest/toolchains/managers.js +38 -17
  394. package/dist/guest/toolchains/native/binstall.d.ts +3 -2
  395. package/dist/guest/toolchains/native/binstall.js +20 -8
  396. package/dist/guest/toolchains/native/cpp.d.ts +2 -2
  397. package/dist/guest/toolchains/native/cpp.js +23 -8
  398. package/dist/guest/toolchains/native/dotnet.d.ts +5 -3
  399. package/dist/guest/toolchains/native/dotnet.js +72 -24
  400. package/dist/guest/toolchains/native/mesa.d.ts +2 -2
  401. package/dist/guest/toolchains/native/mesa.js +27 -10
  402. package/dist/guest/toolchains/native/msvc/environment.d.ts +4 -4
  403. package/dist/guest/toolchains/native/msvc/environment.js +30 -16
  404. package/dist/guest/toolchains/native/msvc/index.d.ts +3 -3
  405. package/dist/guest/toolchains/native/msvc/index.js +10 -8
  406. package/dist/guest/toolchains/native/msvc/packages.d.ts +1 -1
  407. package/dist/guest/toolchains/native/msvc/packages.js +69 -23
  408. package/dist/guest/toolchains/native/msvc/tree.d.ts +6 -6
  409. package/dist/guest/toolchains/native/msvc/tree.js +15 -9
  410. package/dist/guest/toolchains/native/rust-extras.d.ts +23 -0
  411. package/dist/guest/toolchains/native/rust-extras.js +100 -0
  412. package/dist/guest/toolchains/native/rust.d.ts +2 -2
  413. package/dist/guest/toolchains/native/rust.js +41 -10
  414. package/dist/guest/toolchains/{scripting → native}/vcruntime.d.ts +2 -2
  415. package/dist/guest/toolchains/{scripting → native}/vcruntime.js +17 -7
  416. package/dist/guest/toolchains/package-ledger.d.ts +17 -0
  417. package/dist/guest/toolchains/package-ledger.js +54 -0
  418. package/dist/guest/toolchains/plan.d.ts +3 -24
  419. package/dist/guest/toolchains/plan.js +99 -111
  420. package/dist/guest/toolchains/runtimes.d.ts +6 -6
  421. package/dist/guest/toolchains/runtimes.js +31 -13
  422. package/dist/guest/toolchains/scheduler.d.ts +22 -0
  423. package/dist/guest/toolchains/scheduler.js +123 -0
  424. package/dist/guest/toolchains/setup.d.ts +10 -0
  425. package/dist/guest/toolchains/setup.js +22 -0
  426. package/dist/guest/toolchains/state-file.d.ts +3 -0
  427. package/dist/guest/toolchains/state-file.js +10 -0
  428. package/dist/guest/toolchains/step.d.ts +24 -0
  429. package/dist/guest/toolchains/step.js +1 -0
  430. package/dist/guest/toolchains/tool-env.d.ts +12 -0
  431. package/dist/guest/toolchains/tool-env.js +16 -0
  432. package/dist/guest/toolchains/tools/cli.d.ts +10 -0
  433. package/dist/guest/toolchains/{cli.js → tools/cli.js} +35 -15
  434. package/dist/guest/toolchains/tools/git.d.ts +3 -0
  435. package/dist/guest/toolchains/{git.js → tools/git.js} +38 -15
  436. package/dist/guest/toolchains/tools/pwsh.d.ts +4 -0
  437. package/dist/guest/toolchains/{pwsh.js → tools/pwsh.js} +14 -7
  438. package/dist/guest/toolchains/{vscode-profile.d.ts → tools/vscode-profile.d.ts} +6 -6
  439. package/dist/guest/toolchains/{vscode-profile.js → tools/vscode-profile.js} +28 -12
  440. package/dist/guest/toolchains/{vscode.d.ts → tools/vscode.d.ts} +6 -6
  441. package/dist/guest/toolchains/{vscode.js → tools/vscode.js} +67 -21
  442. package/dist/guest/toolchains/version-cache.d.ts +16 -0
  443. package/dist/guest/toolchains/version-cache.js +67 -0
  444. package/dist/host/agent-commands/commands.d.ts +13 -0
  445. package/dist/host/agent-commands/commands.js +33 -0
  446. package/dist/host/agent-commands/forwarders.d.ts +7 -0
  447. package/dist/host/agent-commands/forwarders.js +31 -0
  448. package/dist/host/agent-commands/index.d.ts +4 -0
  449. package/dist/host/agent-commands/index.js +4 -0
  450. package/dist/host/agent-commands/reconcile.d.ts +12 -0
  451. package/dist/host/agent-commands/reconcile.js +69 -0
  452. package/dist/host/agent-commands/user-path.d.ts +2 -0
  453. package/dist/host/agent-commands/user-path.js +33 -0
  454. package/dist/host/audit/collect.d.ts +2 -2
  455. package/dist/host/audit/collect.js +59 -22
  456. package/dist/host/audit/log.d.ts +2 -2
  457. package/dist/host/audit/log.js +24 -8
  458. package/dist/host/{attach.d.ts → channel/attach.d.ts} +2 -2
  459. package/dist/host/{attach.js → channel/attach.js} +33 -15
  460. package/dist/host/channel/channel.d.ts +51 -0
  461. package/dist/host/channel/channel.js +196 -0
  462. package/dist/host/channel/index.d.ts +2 -0
  463. package/dist/host/channel/index.js +2 -0
  464. package/dist/host/guard/agent-files.d.ts +7 -0
  465. package/dist/host/guard/agent-files.js +103 -0
  466. package/dist/host/guard/commands.d.ts +10 -0
  467. package/dist/host/guard/commands.js +123 -0
  468. package/dist/host/guard/file-hash.d.ts +4 -0
  469. package/dist/host/guard/file-hash.js +37 -0
  470. package/dist/host/guard/git-config.d.ts +5 -0
  471. package/dist/host/guard/git-config.js +62 -0
  472. package/dist/host/guard/git-dirs.d.ts +12 -0
  473. package/dist/host/guard/git-dirs.js +53 -0
  474. package/dist/host/guard/index.d.ts +5 -0
  475. package/dist/host/guard/index.js +4 -0
  476. package/dist/host/guard/mark-of-the-web.d.ts +8 -0
  477. package/dist/host/guard/mark-of-the-web.js +74 -0
  478. package/dist/host/guard/nested-repos.d.ts +14 -0
  479. package/dist/host/guard/nested-repos.js +88 -0
  480. package/dist/host/guard/quarantine.d.ts +3 -0
  481. package/dist/host/guard/quarantine.js +24 -0
  482. package/dist/host/guard/repo-guard.d.ts +10 -0
  483. package/dist/host/guard/repo-guard.js +36 -0
  484. package/dist/host/guard/store.d.ts +40 -0
  485. package/dist/host/guard/store.js +145 -0
  486. package/dist/host/guard/types.d.ts +27 -0
  487. package/dist/host/guard/types.js +3 -0
  488. package/dist/host/guard/watch-state.d.ts +9 -0
  489. package/dist/host/guard/watch-state.js +26 -0
  490. package/dist/host/launch/boot-projects.d.ts +17 -0
  491. package/dist/host/launch/{projects.js → boot-projects.js} +22 -13
  492. package/dist/host/{database-plan.d.ts → launch/database-plan.d.ts} +5 -5
  493. package/dist/host/{database-plan.js → launch/database-plan.js} +24 -13
  494. package/dist/host/launch/generate.d.ts +4 -0
  495. package/dist/host/launch/generate.js +77 -0
  496. package/dist/host/launch/index.d.ts +10 -0
  497. package/dist/host/launch/index.js +10 -0
  498. package/dist/host/launch/mappings.d.ts +5 -5
  499. package/dist/host/launch/mappings.js +37 -24
  500. package/dist/host/launch/pc-scan.d.ts +5 -0
  501. package/dist/host/{pc-scan.js → launch/pc-scan.js} +20 -13
  502. package/dist/host/launch/project-scan.d.ts +7 -0
  503. package/dist/host/{project-scan.js → launch/project-scan.js} +29 -21
  504. package/dist/host/launch/session-file.d.ts +23 -0
  505. package/dist/host/launch/session-file.js +73 -0
  506. package/dist/host/launch/stage.d.ts +5 -5
  507. package/dist/host/launch/stage.js +14 -13
  508. package/dist/host/launch/toolchains.d.ts +4 -0
  509. package/dist/host/launch/toolchains.js +11 -0
  510. package/dist/host/launch/{wsb.d.ts → wsb-file.d.ts} +4 -2
  511. package/dist/host/launch/wsb-file.js +56 -0
  512. package/dist/host/life/crash-report.d.ts +8 -0
  513. package/dist/host/life/crash-report.js +87 -0
  514. package/dist/host/life/index.d.ts +6 -0
  515. package/dist/host/life/index.js +6 -0
  516. package/dist/host/life/keep-awake.d.ts +10 -0
  517. package/dist/host/life/keep-awake.js +29 -0
  518. package/dist/host/life/life-record.d.ts +48 -0
  519. package/dist/host/life/life-record.js +76 -0
  520. package/dist/host/life/stop-events.d.ts +27 -0
  521. package/dist/host/life/stop-events.js +96 -0
  522. package/dist/host/life/stop-warning.d.ts +4 -0
  523. package/dist/host/life/stop-warning.js +25 -0
  524. package/dist/host/life/windows-update.d.ts +3 -0
  525. package/dist/host/life/windows-update.js +11 -0
  526. package/dist/host/native.d.ts +4 -0
  527. package/dist/host/native.js +11 -0
  528. package/dist/host/network/index.d.ts +1 -0
  529. package/dist/host/network/index.js +1 -0
  530. package/dist/host/{port-forward.d.ts → network/port-forward.d.ts} +1 -1
  531. package/dist/host/{port-forward.js → network/port-forward.js} +16 -10
  532. package/dist/host/profile/accounts.d.ts +37 -0
  533. package/dist/host/profile/accounts.js +146 -0
  534. package/dist/host/profile/claude-login.d.ts +22 -0
  535. package/dist/host/profile/claude-login.js +57 -0
  536. package/dist/host/{claude-profile.d.ts → profile/claude-profile.d.ts} +9 -9
  537. package/dist/host/{claude-profile.js → profile/claude-profile.js} +32 -22
  538. package/dist/host/profile/index.d.ts +7 -0
  539. package/dist/host/profile/index.js +7 -0
  540. package/dist/host/profile/personalize.d.ts +2 -0
  541. package/dist/host/profile/personalize.js +127 -0
  542. package/dist/host/profile/reg-file.d.ts +8 -0
  543. package/dist/host/profile/reg-file.js +45 -0
  544. package/dist/host/profile/secret-files.d.ts +2 -0
  545. package/dist/host/profile/secret-files.js +25 -0
  546. package/dist/host/profile/secret-patterns.d.ts +6 -0
  547. package/dist/host/profile/secret-patterns.js +128 -0
  548. package/dist/host/profile/secrets.d.ts +12 -0
  549. package/dist/host/profile/secrets.js +100 -0
  550. package/dist/host/projects/index.d.ts +4 -0
  551. package/dist/host/projects/index.js +4 -0
  552. package/dist/host/{join.d.ts → projects/join.d.ts} +12 -9
  553. package/dist/host/{join.js → projects/join.js} +62 -33
  554. package/dist/host/projects/known.d.ts +28 -0
  555. package/dist/host/projects/known.js +55 -0
  556. package/dist/host/projects/mapper.d.ts +29 -0
  557. package/dist/host/projects/mapper.js +88 -0
  558. package/dist/host/projects/registry.d.ts +83 -0
  559. package/dist/host/projects/registry.js +136 -0
  560. package/dist/host/sandbox/doctor.d.ts +2 -0
  561. package/dist/host/sandbox/doctor.js +42 -0
  562. package/dist/host/sandbox/host-claude.d.ts +1 -0
  563. package/dist/host/sandbox/host-claude.js +26 -0
  564. package/dist/host/sandbox/index.d.ts +6 -0
  565. package/dist/host/sandbox/index.js +6 -0
  566. package/dist/host/{platform.d.ts → sandbox/platform.d.ts} +0 -5
  567. package/dist/host/sandbox/platform.js +60 -0
  568. package/dist/host/sandbox/probe.d.ts +3 -0
  569. package/dist/host/sandbox/probe.js +47 -0
  570. package/dist/host/{window.js → sandbox/window.js} +7 -5
  571. package/dist/host/{wsb.js → sandbox/wsb-cli.js} +31 -8
  572. package/dist/host/{cleanup.js → storage/cleanup.js} +27 -12
  573. package/dist/host/storage/index.d.ts +2 -0
  574. package/dist/host/storage/index.js +2 -0
  575. package/dist/host/storage/state-files.d.ts +4 -0
  576. package/dist/host/storage/state-files.js +10 -0
  577. package/dist/host/test-guard.js +1 -1
  578. package/dist/host/tools/conpty.d.ts +8 -0
  579. package/dist/host/tools/conpty.js +58 -0
  580. package/dist/host/tools/index.d.ts +2 -0
  581. package/dist/host/tools/index.js +2 -0
  582. package/dist/host/{terminal.d.ts → tools/windows-terminal.d.ts} +2 -10
  583. package/dist/host/{terminal.js → tools/windows-terminal.js} +33 -57
  584. package/dist/host/workspace-view/active-views.d.ts +3 -0
  585. package/dist/host/workspace-view/active-views.js +22 -0
  586. package/dist/host/workspace-view/index.d.ts +2 -18
  587. package/dist/host/workspace-view/index.js +2 -49
  588. package/dist/host/workspace-view/plan.d.ts +16 -0
  589. package/dist/host/workspace-view/plan.js +50 -0
  590. package/dist/host/workspace-view/rules.js +10 -3
  591. package/dist/host/workspace-view/view-state.d.ts +10 -0
  592. package/dist/host/workspace-view/view-state.js +31 -0
  593. package/dist/host/workspace-view/view.d.ts +1 -0
  594. package/dist/host/workspace-view/view.js +51 -55
  595. package/dist/runtime/daemon.js +4220 -1968
  596. package/dist/runtime/db.js +2134 -849
  597. package/dist/runtime/gitguard.js +29 -11
  598. package/dist/runtime/main.js +4687 -2243
  599. package/dist/runtime/netproxy.js +1644 -420
  600. package/dist/runtime/view.js +1356 -428
  601. package/dist/selftest/accounts.test.d.ts +1 -1
  602. package/dist/selftest/accounts.test.js +20 -17
  603. package/dist/selftest/agent-commands.test.d.ts +1 -1
  604. package/dist/selftest/agent-commands.test.js +9 -5
  605. package/dist/selftest/audit.test.d.ts +1 -1
  606. package/dist/selftest/audit.test.js +46 -13
  607. package/dist/selftest/channel.test.d.ts +1 -1
  608. package/dist/selftest/channel.test.js +63 -16
  609. package/dist/selftest/cli.test.d.ts +1 -1
  610. package/dist/selftest/cli.test.js +68 -16
  611. package/dist/selftest/cmdline.test.d.ts +1 -1
  612. package/dist/selftest/cmdline.test.js +36 -7
  613. package/dist/selftest/config.test.d.ts +1 -1
  614. package/dist/selftest/config.test.js +12 -5
  615. package/dist/selftest/data.test.d.ts +1 -1
  616. package/dist/selftest/data.test.js +35 -6
  617. package/dist/selftest/detect.test.d.ts +1 -1
  618. package/dist/selftest/detect.test.js +22 -9
  619. package/dist/selftest/generate.test.d.ts +1 -1
  620. package/dist/selftest/generate.test.js +33 -9
  621. package/dist/selftest/git-access.test.d.ts +1 -1
  622. package/dist/selftest/git-access.test.js +42 -4
  623. package/dist/selftest/guest-boot.test.d.ts +1 -1
  624. package/dist/selftest/guest-boot.test.js +25 -7
  625. package/dist/selftest/host-sim.test.d.ts +1 -1
  626. package/dist/selftest/host-sim.test.js +27 -3
  627. package/dist/selftest/hostile-input.test.d.ts +1 -1
  628. package/dist/selftest/hostile-input.test.js +5 -5
  629. package/dist/selftest/index.d.ts +1 -1
  630. package/dist/selftest/index.js +72 -16
  631. package/dist/selftest/layout.test.d.ts +2 -0
  632. package/dist/selftest/layout.test.js +131 -0
  633. package/dist/selftest/links.test.d.ts +1 -1
  634. package/dist/selftest/links.test.js +16 -11
  635. package/dist/selftest/live-daemon.test.d.ts +1 -1
  636. package/dist/selftest/live-daemon.test.js +20 -8
  637. package/dist/selftest/live-git.test.d.ts +1 -1
  638. package/dist/selftest/live-git.test.js +13 -4
  639. package/dist/selftest/live-network.test.d.ts +1 -1
  640. package/dist/selftest/live-network.test.js +24 -9
  641. package/dist/selftest/live-projects.test.d.ts +1 -1
  642. package/dist/selftest/live-projects.test.js +47 -20
  643. package/dist/selftest/live-terminal.test.d.ts +1 -1
  644. package/dist/selftest/live-terminal.test.js +41 -15
  645. package/dist/selftest/local-config.test.d.ts +1 -1
  646. package/dist/selftest/local-config.test.js +64 -16
  647. package/dist/selftest/mirror.test.d.ts +1 -1
  648. package/dist/selftest/mirror.test.js +102 -32
  649. package/dist/selftest/network.test.d.ts +1 -1
  650. package/dist/selftest/network.test.js +17 -8
  651. package/dist/selftest/personalization.test.d.ts +1 -1
  652. package/dist/selftest/personalization.test.js +12 -5
  653. package/dist/selftest/projects.test.d.ts +1 -1
  654. package/dist/selftest/projects.test.js +280 -85
  655. package/dist/selftest/repair.test.d.ts +1 -1
  656. package/dist/selftest/repair.test.js +17 -5
  657. package/dist/selftest/repo-guard.test.d.ts +1 -1
  658. package/dist/selftest/repo-guard.test.js +21 -20
  659. package/dist/selftest/secrets.test.d.ts +1 -1
  660. package/dist/selftest/secrets.test.js +57 -13
  661. package/dist/selftest/setup.test.d.ts +1 -1
  662. package/dist/selftest/setup.test.js +25 -5
  663. package/dist/selftest/{fixtures.d.ts → support/fixtures.d.ts} +5 -3
  664. package/dist/selftest/{fixtures.js → support/fixtures.js} +95 -17
  665. package/dist/selftest/{harness.js → support/harness.js} +24 -7
  666. package/dist/selftest/{live.d.ts → support/live.d.ts} +2 -2
  667. package/dist/selftest/{live.js → support/live.js} +34 -10
  668. package/dist/selftest/support/suite.js +1 -0
  669. package/dist/selftest/sync.test.d.ts +1 -1
  670. package/dist/selftest/sync.test.js +64 -26
  671. package/dist/selftest/test-guard.test.d.ts +1 -1
  672. package/dist/selftest/test-guard.test.js +43 -15
  673. package/dist/selftest/toolchains.test.d.ts +1 -1
  674. package/dist/selftest/toolchains.test.js +135 -36
  675. package/dist/selftest/workspace-view.test.d.ts +1 -1
  676. package/dist/selftest/workspace-view.test.js +48 -11
  677. package/dist/selftest/workspace.test.d.ts +1 -1
  678. package/dist/selftest/workspace.test.js +13 -4
  679. package/dist/shared/{apps.d.ts → apps/catalogue.d.ts} +1 -11
  680. package/dist/shared/apps/catalogue.js +768 -0
  681. package/dist/shared/apps/index.d.ts +2 -0
  682. package/dist/shared/apps/index.js +2 -0
  683. package/dist/shared/apps/selection.d.ts +11 -0
  684. package/dist/shared/apps/selection.js +40 -0
  685. package/dist/shared/channel/index.d.ts +2 -0
  686. package/dist/shared/channel/index.js +2 -0
  687. package/dist/shared/channel/run-dir.d.ts +30 -0
  688. package/dist/shared/channel/run-dir.js +84 -0
  689. package/dist/shared/{schema.d.ts → channel/schema.d.ts} +38 -21
  690. package/dist/shared/{schema.js → channel/schema.js} +62 -35
  691. package/dist/shared/download/archive.d.ts +13 -0
  692. package/dist/shared/download/archive.js +57 -0
  693. package/dist/shared/download/downloader.d.ts +35 -0
  694. package/dist/shared/download/downloader.js +110 -0
  695. package/dist/shared/download/github.d.ts +16 -0
  696. package/dist/shared/download/github.js +74 -0
  697. package/dist/shared/download/http.d.ts +5 -0
  698. package/dist/shared/download/http.js +30 -0
  699. package/dist/shared/download/index.d.ts +5 -0
  700. package/dist/shared/download/index.js +5 -0
  701. package/dist/shared/download/spawn.d.ts +2 -0
  702. package/dist/shared/download/spawn.js +7 -0
  703. package/dist/shared/io/index.d.ts +3 -0
  704. package/dist/shared/io/index.js +3 -0
  705. package/dist/shared/io/json-file.d.ts +10 -0
  706. package/dist/shared/io/json-file.js +21 -0
  707. package/dist/shared/io/json.d.ts +13 -0
  708. package/dist/shared/io/json.js +49 -0
  709. package/dist/shared/{safe-remove.js → io/safe-remove.js} +32 -7
  710. package/dist/shared/{netrules.js → network/firewall-rules.js} +36 -5
  711. package/dist/shared/network/index.d.ts +2 -0
  712. package/dist/shared/network/index.js +2 -0
  713. package/dist/shared/{netpolicy.js → network/policy.js} +66 -11
  714. package/dist/shared/{paths.js → paths/claude-paths.js} +12 -2
  715. package/dist/shared/{guest-paths.d.ts → paths/guest-paths.d.ts} +6 -12
  716. package/dist/shared/{guest-paths.js → paths/guest-paths.js} +53 -36
  717. package/dist/shared/paths/index.d.ts +3 -0
  718. package/dist/shared/paths/index.js +3 -0
  719. package/dist/shared/{projects.js → paths/projects.js} +13 -3
  720. package/dist/shared/pty/client.d.ts +21 -0
  721. package/dist/shared/pty/client.js +79 -0
  722. package/dist/shared/{console-input.js → pty/console-input.js} +26 -6
  723. package/dist/shared/pty/index.d.ts +6 -0
  724. package/dist/shared/pty/index.js +6 -0
  725. package/dist/shared/pty/input-joiner.d.ts +15 -0
  726. package/dist/shared/pty/input-joiner.js +44 -0
  727. package/dist/shared/pty/output-filter.d.ts +13 -0
  728. package/dist/shared/pty/output-filter.js +140 -0
  729. package/dist/shared/pty/protocol.d.ts +36 -0
  730. package/dist/shared/pty/protocol.js +60 -0
  731. package/dist/shared/pty/terminal.d.ts +24 -0
  732. package/dist/shared/pty/terminal.js +147 -0
  733. package/dist/shared/test-guard.js +3 -1
  734. package/dist/sync/claude-mem.d.ts +1 -1
  735. package/dist/sync/claude-mem.js +9 -4
  736. package/dist/sync/history.d.ts +1 -29
  737. package/dist/sync/history.js +57 -45
  738. package/dist/sync/index.d.ts +5 -0
  739. package/dist/sync/index.js +5 -0
  740. package/dist/sync/sync-cycle.d.ts +18 -0
  741. package/dist/sync/sync-cycle.js +85 -0
  742. package/dist/sync/sync-state.d.ts +32 -0
  743. package/dist/sync/sync-state.js +37 -0
  744. package/dist/sync/watcher.d.ts +0 -18
  745. package/dist/sync/watcher.js +66 -100
  746. package/native/keep-awake.ps1 +8 -0
  747. package/native/power.cs +23 -0
  748. package/native/stop-events.ps1 +38 -0
  749. package/package.json +11 -3
  750. package/sandbox/linkgate.cs +98 -0
  751. package/sandbox/memlog.ps1 +15 -6
  752. package/schemas/config.schema.json +34 -1
  753. package/schemas/sandbox-config.schema.json +34 -1
  754. package/dist/cli/boot-progress.d.ts +0 -22
  755. package/dist/cli/boot-progress.js +0 -59
  756. package/dist/cli/commands/launch.d.ts +0 -32
  757. package/dist/cli/commands/launch.js +0 -421
  758. package/dist/cli/commands/maintenance.d.ts +0 -10
  759. package/dist/cli/commands/maintenance.js +0 -220
  760. package/dist/cli/commands/project.d.ts +0 -33
  761. package/dist/cli/commands/project.js +0 -102
  762. package/dist/cli/commands/projects.d.ts +0 -14
  763. package/dist/cli/commands/projects.js +0 -146
  764. package/dist/cli/commands/restart.d.ts +0 -6
  765. package/dist/cli/commands/restart.js +0 -95
  766. package/dist/cli/commands/sessions.d.ts +0 -12
  767. package/dist/cli/commands/sessions.js +0 -258
  768. package/dist/cli/menu/settings/editors.js +0 -305
  769. package/dist/cli/tui/dialogs.d.ts +0 -57
  770. package/dist/cli/tui/dialogs.js +0 -162
  771. package/dist/core/config.js +0 -109
  772. package/dist/core/project-policy.d.ts +0 -62
  773. package/dist/core/project-policy.js +0 -121
  774. package/dist/core/schema.d.ts +0 -6
  775. package/dist/core/schema.js +0 -8
  776. package/dist/core/util.d.ts +0 -62
  777. package/dist/core/util.js +0 -156
  778. package/dist/core/workspace.d.ts +0 -35
  779. package/dist/core/workspace.js +0 -206
  780. package/dist/guest/boot-env.d.ts +0 -4
  781. package/dist/guest/daemon.js +0 -57
  782. package/dist/guest/env.d.ts +0 -56
  783. package/dist/guest/env.js +0 -115
  784. package/dist/guest/gitrules.js +0 -11
  785. package/dist/guest/project-status.d.ts +0 -5
  786. package/dist/guest/project-status.js +0 -17
  787. package/dist/guest/setup/user.js +0 -51
  788. package/dist/guest/toolchains/cli.d.ts +0 -10
  789. package/dist/guest/toolchains/common.d.ts +0 -54
  790. package/dist/guest/toolchains/common.js +0 -147
  791. package/dist/guest/toolchains/databases/dynamodb.d.ts +0 -8
  792. package/dist/guest/toolchains/databases/dynamodb.js +0 -52
  793. package/dist/guest/toolchains/databases/index.d.ts +0 -6
  794. package/dist/guest/toolchains/databases/index.js +0 -62
  795. package/dist/guest/toolchains/databases/mongodb.d.ts +0 -3
  796. package/dist/guest/toolchains/databases/mongodb.js +0 -31
  797. package/dist/guest/toolchains/databases/mysql.d.ts +0 -3
  798. package/dist/guest/toolchains/databases/mysql.js +0 -38
  799. package/dist/guest/toolchains/databases/postgres.d.ts +0 -5
  800. package/dist/guest/toolchains/databases/postgres.js +0 -38
  801. package/dist/guest/toolchains/databases/redis.d.ts +0 -3
  802. package/dist/guest/toolchains/databases/redis.js +0 -16
  803. package/dist/guest/toolchains/git.d.ts +0 -3
  804. package/dist/guest/toolchains/go.d.ts +0 -3
  805. package/dist/guest/toolchains/java.d.ts +0 -8
  806. package/dist/guest/toolchains/node.d.ts +0 -3
  807. package/dist/guest/toolchains/pwsh.d.ts +0 -4
  808. package/dist/guest/toolchains/python.d.ts +0 -3
  809. package/dist/guest/toolchains/scripting/php.d.ts +0 -3
  810. package/dist/guest/toolchains/scripting/ruby.d.ts +0 -3
  811. package/dist/host/accounts.d.ts +0 -32
  812. package/dist/host/accounts.js +0 -128
  813. package/dist/host/agent-commands.d.ts +0 -25
  814. package/dist/host/agent-commands.js +0 -145
  815. package/dist/host/channel.d.ts +0 -38
  816. package/dist/host/channel.js +0 -163
  817. package/dist/host/generate.d.ts +0 -13
  818. package/dist/host/generate.js +0 -115
  819. package/dist/host/launch/projects.d.ts +0 -17
  820. package/dist/host/launch/wsb.js +0 -34
  821. package/dist/host/motw.d.ts +0 -17
  822. package/dist/host/motw.js +0 -74
  823. package/dist/host/pc-scan.d.ts +0 -6
  824. package/dist/host/personalize.d.ts +0 -10
  825. package/dist/host/personalize.js +0 -97
  826. package/dist/host/platform.js +0 -129
  827. package/dist/host/project-scan.d.ts +0 -7
  828. package/dist/host/projects.d.ts +0 -123
  829. package/dist/host/projects.js +0 -196
  830. package/dist/host/repo-guard.d.ts +0 -43
  831. package/dist/host/repo-guard.js +0 -347
  832. package/dist/host/secrets.d.ts +0 -14
  833. package/dist/host/secrets.js +0 -133
  834. package/dist/host/stops.d.ts +0 -67
  835. package/dist/host/stops.js +0 -126
  836. package/dist/shared/apps.js +0 -114
  837. package/dist/shared/download.d.ts +0 -63
  838. package/dist/shared/download.js +0 -238
  839. package/dist/shared/pty-client.d.ts +0 -108
  840. package/dist/shared/pty-client.js +0 -406
  841. package/dist/shared/rundir.d.ts +0 -41
  842. package/dist/shared/rundir.js +0 -96
  843. /package/dist/{guest/daemon.d.ts → cli/tui/list/list-types.js} +0 -0
  844. /package/dist/{guest/db.d.ts → cli/tui/screen.js} +0 -0
  845. /package/dist/core/{detect-databases.d.ts → detect/databases.d.ts} +0 -0
  846. /package/dist/{guest/toolchains → core/detect}/versions.d.ts +0 -0
  847. /package/dist/guest/{setup/agents.d.ts → agents/agent-installer.d.ts} +0 -0
  848. /package/dist/guest/{audit-parse.d.ts → audit/parse.d.ts} +0 -0
  849. /package/dist/guest/{guide.d.ts → boot/guide.d.ts} +0 -0
  850. /package/dist/guest/daemon/{shutdown.d.ts → idle-shutdown.d.ts} +0 -0
  851. /package/dist/guest/daemon/{session.d.ts → sessions.d.ts} +0 -0
  852. /package/dist/guest/{main.d.ts → entries/daemon.d.ts} +0 -0
  853. /package/dist/guest/{netproxy.d.ts → entries/db.d.ts} +0 -0
  854. /package/dist/{selftest/suite.js → guest/entries/gitguard.d.ts} +0 -0
  855. /package/dist/guest/{gitguard.d.ts → git/decision.d.ts} +0 -0
  856. /package/dist/guest/{ports.d.ts → runtime/ports.d.ts} +0 -0
  857. /package/dist/guest/{project-context.d.ts → runtime/project-context.d.ts} +0 -0
  858. /package/dist/guest/{cmdline.d.ts → sessions/cmdline.d.ts} +0 -0
  859. /package/dist/guest/{ptyhost.d.ts → sessions/pty-host.d.ts} +0 -0
  860. /package/dist/guest/{view.d.ts → sessions/viewer.d.ts} +0 -0
  861. /package/dist/guest/setup/{policy.d.ts → managed-policy.d.ts} +0 -0
  862. /package/dist/host/{window.d.ts → sandbox/window.d.ts} +0 -0
  863. /package/dist/host/{wsb.d.ts → sandbox/wsb-cli.d.ts} +0 -0
  864. /package/dist/host/{cleanup.d.ts → storage/cleanup.d.ts} +0 -0
  865. /package/dist/selftest/{harness.d.ts → support/harness.d.ts} +0 -0
  866. /package/dist/selftest/{suite.d.ts → support/suite.d.ts} +0 -0
  867. /package/dist/shared/{safe-remove.d.ts → io/safe-remove.d.ts} +0 -0
  868. /package/dist/shared/{netrules.d.ts → network/firewall-rules.d.ts} +0 -0
  869. /package/dist/shared/{netpolicy.d.ts → network/policy.d.ts} +0 -0
  870. /package/dist/shared/{paths.d.ts → paths/claude-paths.d.ts} +0 -0
  871. /package/dist/shared/{projects.d.ts → paths/projects.d.ts} +0 -0
  872. /package/dist/shared/{console-input.d.ts → pty/console-input.d.ts} +0 -0
@@ -1363,11 +1363,11 @@ var require_lodash = __commonJS({
1363
1363
  return isFunction(object2[key]);
1364
1364
  });
1365
1365
  }
1366
- function baseGet(object2, path16) {
1367
- path16 = castPath(path16, object2);
1368
- var index = 0, length = path16.length;
1366
+ function baseGet(object2, path21) {
1367
+ path21 = castPath(path21, object2);
1368
+ var index = 0, length = path21.length;
1369
1369
  while (object2 != null && index < length) {
1370
- object2 = object2[toKey(path16[index++])];
1370
+ object2 = object2[toKey(path21[index++])];
1371
1371
  }
1372
1372
  return index && index == length ? object2 : undefined2;
1373
1373
  }
@@ -1431,10 +1431,10 @@ var require_lodash = __commonJS({
1431
1431
  });
1432
1432
  return accumulator;
1433
1433
  }
1434
- function baseInvoke(object2, path16, args) {
1435
- path16 = castPath(path16, object2);
1436
- object2 = parent(object2, path16);
1437
- var func = object2 == null ? object2 : object2[toKey(last(path16))];
1434
+ function baseInvoke(object2, path21, args) {
1435
+ path21 = castPath(path21, object2);
1436
+ object2 = parent(object2, path21);
1437
+ var func = object2 == null ? object2 : object2[toKey(last(path21))];
1438
1438
  return func == null ? undefined2 : apply(func, object2, args);
1439
1439
  }
1440
1440
  function baseIsArguments(value) {
@@ -1590,13 +1590,13 @@ var require_lodash = __commonJS({
1590
1590
  return object2 === source || baseIsMatch(object2, source, matchData);
1591
1591
  };
1592
1592
  }
1593
- function baseMatchesProperty(path16, srcValue) {
1594
- if (isKey(path16) && isStrictComparable(srcValue)) {
1595
- return matchesStrictComparable(toKey(path16), srcValue);
1593
+ function baseMatchesProperty(path21, srcValue) {
1594
+ if (isKey(path21) && isStrictComparable(srcValue)) {
1595
+ return matchesStrictComparable(toKey(path21), srcValue);
1596
1596
  }
1597
1597
  return function(object2) {
1598
- var objValue = get(object2, path16);
1599
- return objValue === undefined2 && objValue === srcValue ? hasIn(object2, path16) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
1598
+ var objValue = get(object2, path21);
1599
+ return objValue === undefined2 && objValue === srcValue ? hasIn(object2, path21) : baseIsEqual(srcValue, objValue, COMPARE_PARTIAL_FLAG | COMPARE_UNORDERED_FLAG);
1600
1600
  };
1601
1601
  }
1602
1602
  function baseMerge(object2, source, srcIndex, customizer, stack) {
@@ -1693,23 +1693,23 @@ var require_lodash = __commonJS({
1693
1693
  });
1694
1694
  }
1695
1695
  function basePick(object2, paths) {
1696
- return basePickBy(object2, paths, function(value, path16) {
1697
- return hasIn(object2, path16);
1696
+ return basePickBy(object2, paths, function(value, path21) {
1697
+ return hasIn(object2, path21);
1698
1698
  });
1699
1699
  }
1700
1700
  function basePickBy(object2, paths, predicate) {
1701
1701
  var index = -1, length = paths.length, result2 = {};
1702
1702
  while (++index < length) {
1703
- var path16 = paths[index], value = baseGet(object2, path16);
1704
- if (predicate(value, path16)) {
1705
- baseSet(result2, castPath(path16, object2), value);
1703
+ var path21 = paths[index], value = baseGet(object2, path21);
1704
+ if (predicate(value, path21)) {
1705
+ baseSet(result2, castPath(path21, object2), value);
1706
1706
  }
1707
1707
  }
1708
1708
  return result2;
1709
1709
  }
1710
- function basePropertyDeep(path16) {
1710
+ function basePropertyDeep(path21) {
1711
1711
  return function(object2) {
1712
- return baseGet(object2, path16);
1712
+ return baseGet(object2, path21);
1713
1713
  };
1714
1714
  }
1715
1715
  function basePullAll(array2, values2, iteratee2, comparator) {
@@ -1783,14 +1783,14 @@ var require_lodash = __commonJS({
1783
1783
  var array2 = values(collection);
1784
1784
  return shuffleSelf(array2, baseClamp(n, 0, array2.length));
1785
1785
  }
1786
- function baseSet(object2, path16, value, customizer) {
1786
+ function baseSet(object2, path21, value, customizer) {
1787
1787
  if (!isObject2(object2)) {
1788
1788
  return object2;
1789
1789
  }
1790
- path16 = castPath(path16, object2);
1791
- var index = -1, length = path16.length, lastIndex = length - 1, nested = object2;
1790
+ path21 = castPath(path21, object2);
1791
+ var index = -1, length = path21.length, lastIndex = length - 1, nested = object2;
1792
1792
  while (nested != null && ++index < length) {
1793
- var key = toKey(path16[index]), newValue = value;
1793
+ var key = toKey(path21[index]), newValue = value;
1794
1794
  if (key === "__proto__" || key === "constructor" || key === "prototype") {
1795
1795
  return object2;
1796
1796
  }
@@ -1798,7 +1798,7 @@ var require_lodash = __commonJS({
1798
1798
  var objValue = nested[key];
1799
1799
  newValue = customizer ? customizer(objValue, key, nested) : undefined2;
1800
1800
  if (newValue === undefined2) {
1801
- newValue = isObject2(objValue) ? objValue : isIndex(path16[index + 1]) ? [] : {};
1801
+ newValue = isObject2(objValue) ? objValue : isIndex(path21[index + 1]) ? [] : {};
1802
1802
  }
1803
1803
  }
1804
1804
  assignValue(nested, key, newValue);
@@ -1964,14 +1964,14 @@ var require_lodash = __commonJS({
1964
1964
  }
1965
1965
  return result2;
1966
1966
  }
1967
- function baseUnset(object2, path16) {
1968
- path16 = castPath(path16, object2);
1969
- var index = -1, length = path16.length;
1967
+ function baseUnset(object2, path21) {
1968
+ path21 = castPath(path21, object2);
1969
+ var index = -1, length = path21.length;
1970
1970
  if (!length) {
1971
1971
  return true;
1972
1972
  }
1973
1973
  while (++index < length) {
1974
- var key = toKey(path16[index]);
1974
+ var key = toKey(path21[index]);
1975
1975
  if (key === "__proto__" && !hasOwnProperty.call(object2, "__proto__")) {
1976
1976
  return false;
1977
1977
  }
@@ -1979,11 +1979,11 @@ var require_lodash = __commonJS({
1979
1979
  return false;
1980
1980
  }
1981
1981
  }
1982
- var obj = parent(object2, path16);
1983
- return obj == null || delete obj[toKey(last(path16))];
1982
+ var obj = parent(object2, path21);
1983
+ return obj == null || delete obj[toKey(last(path21))];
1984
1984
  }
1985
- function baseUpdate(object2, path16, updater, customizer) {
1986
- return baseSet(object2, path16, updater(baseGet(object2, path16)), customizer);
1985
+ function baseUpdate(object2, path21, updater, customizer) {
1986
+ return baseSet(object2, path21, updater(baseGet(object2, path21)), customizer);
1987
1987
  }
1988
1988
  function baseWhile(array2, predicate, isDrop, fromRight) {
1989
1989
  var length = array2.length, index = fromRight ? length : -1;
@@ -2866,11 +2866,11 @@ var require_lodash = __commonJS({
2866
2866
  var match = source.match(reWrapDetails);
2867
2867
  return match ? match[1].split(reSplitDetails) : [];
2868
2868
  }
2869
- function hasPath(object2, path16, hasFunc) {
2870
- path16 = castPath(path16, object2);
2871
- var index = -1, length = path16.length, result2 = false;
2869
+ function hasPath(object2, path21, hasFunc) {
2870
+ path21 = castPath(path21, object2);
2871
+ var index = -1, length = path21.length, result2 = false;
2872
2872
  while (++index < length) {
2873
- var key = toKey(path16[index]);
2873
+ var key = toKey(path21[index]);
2874
2874
  if (!(result2 = object2 != null && hasFunc(object2, key))) {
2875
2875
  break;
2876
2876
  }
@@ -3072,8 +3072,8 @@ var require_lodash = __commonJS({
3072
3072
  return apply(func, this, otherArgs);
3073
3073
  };
3074
3074
  }
3075
- function parent(object2, path16) {
3076
- return path16.length < 2 ? object2 : baseGet(object2, baseSlice(path16, 0, -1));
3075
+ function parent(object2, path21) {
3076
+ return path21.length < 2 ? object2 : baseGet(object2, baseSlice(path21, 0, -1));
3077
3077
  }
3078
3078
  function reorder(array2, indexes) {
3079
3079
  var arrLength = array2.length, length = nativeMin(indexes.length, arrLength), oldArray = copyArray(array2);
@@ -3708,10 +3708,10 @@ var require_lodash = __commonJS({
3708
3708
  }
3709
3709
  return isString(collection) ? fromIndex <= length && collection.indexOf(value, fromIndex) > -1 : !!length && baseIndexOf(collection, value, fromIndex) > -1;
3710
3710
  }
3711
- var invokeMap = baseRest(function(collection, path16, args) {
3712
- var index = -1, isFunc = typeof path16 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
3711
+ var invokeMap = baseRest(function(collection, path21, args) {
3712
+ var index = -1, isFunc = typeof path21 == "function", result2 = isArrayLike(collection) ? Array2(collection.length) : [];
3713
3713
  baseEach(collection, function(value) {
3714
- result2[++index] = isFunc ? apply(path16, value, args) : baseInvoke(value, path16, args);
3714
+ result2[++index] = isFunc ? apply(path21, value, args) : baseInvoke(value, path21, args);
3715
3715
  });
3716
3716
  return result2;
3717
3717
  });
@@ -3801,7 +3801,7 @@ var require_lodash = __commonJS({
3801
3801
  }
3802
3802
  return baseOrderBy(collection, baseFlatten(iteratees, 1), []);
3803
3803
  });
3804
- var now2 = ctxNow || function() {
3804
+ var now = ctxNow || function() {
3805
3805
  return root.Date.now();
3806
3806
  };
3807
3807
  function after(n, func) {
@@ -3897,7 +3897,7 @@ var require_lodash = __commonJS({
3897
3897
  return lastCallTime === undefined2 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
3898
3898
  }
3899
3899
  function timerExpired() {
3900
- var time3 = now2();
3900
+ var time3 = now();
3901
3901
  if (shouldInvoke(time3)) {
3902
3902
  return trailingEdge(time3);
3903
3903
  }
@@ -3919,10 +3919,10 @@ var require_lodash = __commonJS({
3919
3919
  lastArgs = lastCallTime = lastThis = timerId = undefined2;
3920
3920
  }
3921
3921
  function flush() {
3922
- return timerId === undefined2 ? result2 : trailingEdge(now2());
3922
+ return timerId === undefined2 ? result2 : trailingEdge(now());
3923
3923
  }
3924
3924
  function debounced() {
3925
- var time3 = now2(), isInvoking = shouldInvoke(time3);
3925
+ var time3 = now(), isInvoking = shouldInvoke(time3);
3926
3926
  lastArgs = arguments;
3927
3927
  lastThis = this;
3928
3928
  lastCallTime = time3;
@@ -4363,15 +4363,15 @@ var require_lodash = __commonJS({
4363
4363
  function functionsIn(object2) {
4364
4364
  return object2 == null ? [] : baseFunctions(object2, keysIn(object2));
4365
4365
  }
4366
- function get(object2, path16, defaultValue) {
4367
- var result2 = object2 == null ? undefined2 : baseGet(object2, path16);
4366
+ function get(object2, path21, defaultValue) {
4367
+ var result2 = object2 == null ? undefined2 : baseGet(object2, path21);
4368
4368
  return result2 === undefined2 ? defaultValue : result2;
4369
4369
  }
4370
- function has(object2, path16) {
4371
- return object2 != null && hasPath(object2, path16, baseHas);
4370
+ function has(object2, path21) {
4371
+ return object2 != null && hasPath(object2, path21, baseHas);
4372
4372
  }
4373
- function hasIn(object2, path16) {
4374
- return object2 != null && hasPath(object2, path16, baseHasIn);
4373
+ function hasIn(object2, path21) {
4374
+ return object2 != null && hasPath(object2, path21, baseHasIn);
4375
4375
  }
4376
4376
  var invert = createInverter(function(result2, value, key) {
4377
4377
  if (value != null && typeof value.toString != "function") {
@@ -4424,10 +4424,10 @@ var require_lodash = __commonJS({
4424
4424
  return result2;
4425
4425
  }
4426
4426
  var isDeep = false;
4427
- paths = arrayMap(paths, function(path16) {
4428
- path16 = castPath(path16, object2);
4429
- isDeep || (isDeep = path16.length > 1);
4430
- return path16;
4427
+ paths = arrayMap(paths, function(path21) {
4428
+ path21 = castPath(path21, object2);
4429
+ isDeep || (isDeep = path21.length > 1);
4430
+ return path21;
4431
4431
  });
4432
4432
  copyObject(object2, getAllKeysIn(object2), result2);
4433
4433
  if (isDeep) {
@@ -4453,19 +4453,19 @@ var require_lodash = __commonJS({
4453
4453
  return [prop];
4454
4454
  });
4455
4455
  predicate = getIteratee(predicate);
4456
- return basePickBy(object2, props, function(value, path16) {
4457
- return predicate(value, path16[0]);
4456
+ return basePickBy(object2, props, function(value, path21) {
4457
+ return predicate(value, path21[0]);
4458
4458
  });
4459
4459
  }
4460
- function result(object2, path16, defaultValue) {
4461
- path16 = castPath(path16, object2);
4462
- var index = -1, length = path16.length;
4460
+ function result(object2, path21, defaultValue) {
4461
+ path21 = castPath(path21, object2);
4462
+ var index = -1, length = path21.length;
4463
4463
  if (!length) {
4464
4464
  length = 1;
4465
4465
  object2 = undefined2;
4466
4466
  }
4467
4467
  while (++index < length) {
4468
- var value = object2 == null ? undefined2 : object2[toKey(path16[index])];
4468
+ var value = object2 == null ? undefined2 : object2[toKey(path21[index])];
4469
4469
  if (value === undefined2) {
4470
4470
  index = length;
4471
4471
  value = defaultValue;
@@ -4474,12 +4474,12 @@ var require_lodash = __commonJS({
4474
4474
  }
4475
4475
  return object2;
4476
4476
  }
4477
- function set2(object2, path16, value) {
4478
- return object2 == null ? object2 : baseSet(object2, path16, value);
4477
+ function set2(object2, path21, value) {
4478
+ return object2 == null ? object2 : baseSet(object2, path21, value);
4479
4479
  }
4480
- function setWith(object2, path16, value, customizer) {
4480
+ function setWith(object2, path21, value, customizer) {
4481
4481
  customizer = typeof customizer == "function" ? customizer : undefined2;
4482
- return object2 == null ? object2 : baseSet(object2, path16, value, customizer);
4482
+ return object2 == null ? object2 : baseSet(object2, path21, value, customizer);
4483
4483
  }
4484
4484
  var toPairs = createToPairs(keys);
4485
4485
  var toPairsIn = createToPairs(keysIn);
@@ -4501,15 +4501,15 @@ var require_lodash = __commonJS({
4501
4501
  });
4502
4502
  return accumulator;
4503
4503
  }
4504
- function unset(object2, path16) {
4505
- return object2 == null ? true : baseUnset(object2, path16);
4504
+ function unset(object2, path21) {
4505
+ return object2 == null ? true : baseUnset(object2, path21);
4506
4506
  }
4507
- function update(object2, path16, updater) {
4508
- return object2 == null ? object2 : baseUpdate(object2, path16, castFunction(updater));
4507
+ function update(object2, path21, updater) {
4508
+ return object2 == null ? object2 : baseUpdate(object2, path21, castFunction(updater));
4509
4509
  }
4510
- function updateWith(object2, path16, updater, customizer) {
4510
+ function updateWith(object2, path21, updater, customizer) {
4511
4511
  customizer = typeof customizer == "function" ? customizer : undefined2;
4512
- return object2 == null ? object2 : baseUpdate(object2, path16, castFunction(updater), customizer);
4512
+ return object2 == null ? object2 : baseUpdate(object2, path21, castFunction(updater), customizer);
4513
4513
  }
4514
4514
  function values(object2) {
4515
4515
  return object2 == null ? [] : baseValues(object2, keys(object2));
@@ -4895,17 +4895,17 @@ var require_lodash = __commonJS({
4895
4895
  function matches(source) {
4896
4896
  return baseMatches(baseClone(source, CLONE_DEEP_FLAG));
4897
4897
  }
4898
- function matchesProperty(path16, srcValue) {
4899
- return baseMatchesProperty(path16, baseClone(srcValue, CLONE_DEEP_FLAG));
4898
+ function matchesProperty(path21, srcValue) {
4899
+ return baseMatchesProperty(path21, baseClone(srcValue, CLONE_DEEP_FLAG));
4900
4900
  }
4901
- var method = baseRest(function(path16, args) {
4901
+ var method = baseRest(function(path21, args) {
4902
4902
  return function(object2) {
4903
- return baseInvoke(object2, path16, args);
4903
+ return baseInvoke(object2, path21, args);
4904
4904
  };
4905
4905
  });
4906
4906
  var methodOf = baseRest(function(object2, args) {
4907
- return function(path16) {
4908
- return baseInvoke(object2, path16, args);
4907
+ return function(path21) {
4908
+ return baseInvoke(object2, path21, args);
4909
4909
  };
4910
4910
  });
4911
4911
  function mixin(object2, source, options) {
@@ -4952,12 +4952,12 @@ var require_lodash = __commonJS({
4952
4952
  var over = createOver(arrayMap);
4953
4953
  var overEvery = createOver(arrayEvery);
4954
4954
  var overSome = createOver(arraySome);
4955
- function property(path16) {
4956
- return isKey(path16) ? baseProperty(toKey(path16)) : basePropertyDeep(path16);
4955
+ function property(path21) {
4956
+ return isKey(path21) ? baseProperty(toKey(path21)) : basePropertyDeep(path21);
4957
4957
  }
4958
4958
  function propertyOf(object2) {
4959
- return function(path16) {
4960
- return object2 == null ? undefined2 : baseGet(object2, path16);
4959
+ return function(path21) {
4960
+ return object2 == null ? undefined2 : baseGet(object2, path21);
4961
4961
  };
4962
4962
  }
4963
4963
  var range = createRange();
@@ -5297,7 +5297,7 @@ var require_lodash = __commonJS({
5297
5297
  lodash.nth = nth;
5298
5298
  lodash.noConflict = noConflict;
5299
5299
  lodash.noop = noop;
5300
- lodash.now = now2;
5300
+ lodash.now = now;
5301
5301
  lodash.pad = pad;
5302
5302
  lodash.padEnd = padEnd;
5303
5303
  lodash.padStart = padStart;
@@ -5410,12 +5410,12 @@ var require_lodash = __commonJS({
5410
5410
  LazyWrapper.prototype.findLast = function(predicate) {
5411
5411
  return this.reverse().find(predicate);
5412
5412
  };
5413
- LazyWrapper.prototype.invokeMap = baseRest(function(path16, args) {
5414
- if (typeof path16 == "function") {
5413
+ LazyWrapper.prototype.invokeMap = baseRest(function(path21, args) {
5414
+ if (typeof path21 == "function") {
5415
5415
  return new LazyWrapper(this);
5416
5416
  }
5417
5417
  return this.map(function(value) {
5418
- return baseInvoke(value, path16, args);
5418
+ return baseInvoke(value, path21, args);
5419
5419
  });
5420
5420
  });
5421
5421
  LazyWrapper.prototype.reject = function(predicate) {
@@ -5531,8 +5531,11 @@ var require_lodash = __commonJS({
5531
5531
  }
5532
5532
  });
5533
5533
 
5534
- // src/guest/db.ts
5535
- import fs11 from "node:fs";
5534
+ // src/core/util/errors.ts
5535
+ var errMsg = (e) => e instanceof Error ? e.message : String(e);
5536
+
5537
+ // src/guest/databases/sbx-db.ts
5538
+ import fs17 from "node:fs";
5536
5539
 
5537
5540
  // node_modules/zod/v4/classic/external.js
5538
5541
  var external_exports = {};
@@ -6350,10 +6353,10 @@ function mergeDefs(...defs) {
6350
6353
  function cloneDef(schema) {
6351
6354
  return mergeDefs(schema._zod.def);
6352
6355
  }
6353
- function getElementAtPath(obj, path16) {
6354
- if (!path16)
6356
+ function getElementAtPath(obj, path21) {
6357
+ if (!path21)
6355
6358
  return obj;
6356
- return path16.reduce((acc, key) => acc?.[key], obj);
6359
+ return path21.reduce((acc, key) => acc?.[key], obj);
6357
6360
  }
6358
6361
  function promiseAllObject(promisesObj) {
6359
6362
  const keys = Object.keys(promisesObj);
@@ -6693,11 +6696,11 @@ function explicitlyAborted(x, startIndex = 0) {
6693
6696
  }
6694
6697
  return false;
6695
6698
  }
6696
- function prefixIssues(path16, issues) {
6699
+ function prefixIssues(path21, issues) {
6697
6700
  return issues.map((iss) => {
6698
6701
  var _a3;
6699
6702
  (_a3 = iss).path ?? (_a3.path = []);
6700
- iss.path.unshift(path16);
6703
+ iss.path.unshift(path21);
6701
6704
  return iss;
6702
6705
  });
6703
6706
  }
@@ -7147,16 +7150,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
7147
7150
  }
7148
7151
  function formatError(error62, mapper = (issue2) => issue2.message) {
7149
7152
  const fieldErrors = { _errors: [] };
7150
- const processError = (error63, path16 = []) => {
7153
+ const processError = (error63, path21 = []) => {
7151
7154
  for (const issue2 of error63.issues) {
7152
7155
  if (issue2.code === "invalid_union" && issue2.errors.length) {
7153
- issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
7156
+ issue2.errors.map((issues) => processError({ issues }, [...path21, ...issue2.path]));
7154
7157
  } else if (issue2.code === "invalid_key") {
7155
- processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
7158
+ processError({ issues: issue2.issues }, [...path21, ...issue2.path]);
7156
7159
  } else if (issue2.code === "invalid_element") {
7157
- processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
7160
+ processError({ issues: issue2.issues }, [...path21, ...issue2.path]);
7158
7161
  } else {
7159
- const fullpath = [...path16, ...issue2.path];
7162
+ const fullpath = [...path21, ...issue2.path];
7160
7163
  if (fullpath.length === 0) {
7161
7164
  fieldErrors._errors.push(mapper(issue2));
7162
7165
  } else {
@@ -7195,17 +7198,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
7195
7198
  }
7196
7199
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
7197
7200
  const result = { errors: [] };
7198
- const processError = (error63, path16 = []) => {
7201
+ const processError = (error63, path21 = []) => {
7199
7202
  var _a3;
7200
7203
  for (const issue2 of error63.issues) {
7201
7204
  if (issue2.code === "invalid_union" && issue2.errors.length) {
7202
- issue2.errors.map((issues) => processError({ issues }, [...path16, ...issue2.path]));
7205
+ issue2.errors.map((issues) => processError({ issues }, [...path21, ...issue2.path]));
7203
7206
  } else if (issue2.code === "invalid_key") {
7204
- processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
7207
+ processError({ issues: issue2.issues }, [...path21, ...issue2.path]);
7205
7208
  } else if (issue2.code === "invalid_element") {
7206
- processError({ issues: issue2.issues }, [...path16, ...issue2.path]);
7209
+ processError({ issues: issue2.issues }, [...path21, ...issue2.path]);
7207
7210
  } else {
7208
- const fullpath = [...path16, ...issue2.path];
7211
+ const fullpath = [...path21, ...issue2.path];
7209
7212
  if (fullpath.length === 0) {
7210
7213
  result.errors.push(mapper(issue2));
7211
7214
  continue;
@@ -7244,8 +7247,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
7244
7247
  }
7245
7248
  function toDotPath(_path) {
7246
7249
  const segs = [];
7247
- const path16 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
7248
- for (const seg of path16) {
7250
+ const path21 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
7251
+ for (const seg of path21) {
7249
7252
  if (typeof seg === "number")
7250
7253
  segs.push(`[${seg}]`);
7251
7254
  else if (typeof seg === "symbol")
@@ -24347,13 +24350,13 @@ function resolveRef(ref, ctx) {
24347
24350
  if (!ref.startsWith("#")) {
24348
24351
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
24349
24352
  }
24350
- const path16 = ref.slice(1).split("/").filter(Boolean);
24351
- if (path16.length === 0) {
24353
+ const path21 = ref.slice(1).split("/").filter(Boolean);
24354
+ if (path21.length === 0) {
24352
24355
  return ctx.rootSchema;
24353
24356
  }
24354
24357
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
24355
- if (path16[0] === defsKey) {
24356
- const key = path16[1] === void 0 ? void 0 : decodeJSONPointerSegment(path16[1]);
24358
+ if (path21[0] === defsKey) {
24359
+ const key = path21[1] === void 0 ? void 0 : decodeJSONPointerSegment(path21[1]);
24357
24360
  if (!key || !ctx.defs[key]) {
24358
24361
  throw new Error(`Reference not found: ${ref}`);
24359
24362
  }
@@ -25202,7 +25205,7 @@ function date4(params) {
25202
25205
  return _coercedDate(ZodDate, params);
25203
25206
  }
25204
25207
 
25205
- // src/shared/guest-paths.ts
25208
+ // src/shared/paths/guest-paths.ts
25206
25209
  var RESERVED_GUEST = /^C:\\(?:Windows|Program Files|Program Files \(x86\)|ProgramData|Users|AgentLaunch|AgentData|HostTools|nvm|Mirror)(?:\\|$)/i;
25207
25210
  var MIRROR_LETTER = /^[D-Z]$/;
25208
25211
  var DRIVE_PATH = /^([A-Za-z]):\\(.*)$/;
@@ -25213,93 +25216,122 @@ var isValidGuestPath = (guest) => {
25213
25216
  const letter = m[1].toUpperCase();
25214
25217
  const rest = m[2].replace(/\\+$/, "");
25215
25218
  if (rest === "" || BAD_CHARS.test(rest)) return false;
25216
- if (rest.split("\\").some((segment) => segment === "" || segment === "." || segment === ".." || /[. ]$/.test(segment))) return false;
25219
+ if (rest.split("\\").some((segment) => segment === "" || segment === "." || segment === ".." || /[. ]$/.test(segment)))
25220
+ return false;
25217
25221
  if (letter === "C") return !RESERVED_GUEST.test("C:\\" + rest);
25218
25222
  return MIRROR_LETTER.test(letter);
25219
25223
  };
25220
25224
 
25221
25225
  // src/core/schema/common.ts
25222
- var GuestPath = external_exports.string().refine(
25226
+ var GuestPathSchema = external_exports.string().refine(
25223
25227
  isValidGuestPath,
25224
25228
  "reserved or invalid guest path (a folder under C:\\ other than Windows, Program Files, Users, AgentData, Mirror, ..., or on drive D: to Z:)"
25225
25229
  );
25226
- var Name = external_exports.string().regex(/^[A-Za-z0-9_-]+$/, "letters, numbers, - and _ only");
25227
- var Strings = external_exports.array(external_exports.string());
25230
+ var NameSchema = external_exports.string().regex(/^[A-Za-z0-9_-]+$/, "letters, numbers, - and _ only");
25231
+ var StringsSchema = external_exports.array(external_exports.string());
25228
25232
  var toggle = (description) => external_exports.strictObject({ enabled: external_exports.boolean().describe(description) });
25229
- var SchemaRef = external_exports.string().describe("Path or URL of the JSON Schema for editor autocomplete and docs.");
25230
- var GitAccess = external_exports.enum(["full", "readonly", "none"]).describe("full: normal git. readonly: status/log/diff/show/blame only (no commit, push, checkout, ...). none: no git at all; .git is hidden from the agent.");
25231
- var Enabled = external_exports.union([external_exports.boolean(), external_exports.literal("auto")]);
25232
- var enabled = (what, markers) => Enabled.describe(what + ' true, false, or "auto" = only when the project has ' + markers + ".");
25233
- var Packages = (what, example) => Strings.describe(what + ", installed once and kept (e.g. " + example + ").");
25233
+ var SchemaRefSchema = external_exports.string().describe("Path or URL of the JSON Schema for editor autocomplete and docs.");
25234
+ var GitAccessSchema = external_exports.enum(["full", "readonly", "none"]).describe(
25235
+ "full: normal git. readonly: status/log/diff/show/blame only (no commit, push, checkout, ...). none: no git at all; .git is hidden from the agent."
25236
+ );
25237
+ var EnabledSchema = external_exports.union([external_exports.boolean(), external_exports.literal("auto")]);
25238
+ var enabled = (what, markers) => EnabledSchema.describe(what + ' true, false, or "auto" = only when the project has ' + markers + ".");
25239
+ var Packages = (what, example) => StringsSchema.describe(what + ", installed once and kept (e.g. " + example + ").");
25234
25240
 
25235
25241
  // src/core/schema/config.ts
25236
25242
  var import_lodash = __toESM(require_lodash(), 1);
25237
25243
 
25238
25244
  // src/core/schema/databases.ts
25239
- var Port = external_exports.number().int().min(1024).max(65535);
25240
- var dbEnabled = (name) => Enabled.describe(name + ': true, false, or "auto" = only when the project needs it (found from compose files, dependencies of every language, Prisma/ORM config and connection strings).');
25241
- var Databases = external_exports.strictObject({
25245
+ var PortSchema = external_exports.number().int().min(1024).max(65535);
25246
+ var dbEnabled = (name) => EnabledSchema.describe(
25247
+ name + ': true, false, or "auto" = only when the project needs it (found from compose files, dependencies of every language, Prisma/ORM config and connection strings).'
25248
+ );
25249
+ var DatabasesSchema = external_exports.strictObject({
25242
25250
  postgres: external_exports.strictObject({
25243
25251
  enabled: dbEnabled("PostgreSQL (with psql, pg_dump). User postgres, no password, localhost only"),
25244
25252
  version: external_exports.string().min(1).describe('"latest" or a major version such as "16". A compose file pinning postgres:<major> wins.'),
25245
- port: Port.describe("Port inside the sandbox.")
25253
+ port: PortSchema.describe("Port inside the sandbox.")
25246
25254
  }),
25247
25255
  mysql: external_exports.strictObject({
25248
25256
  enabled: dbEnabled("MySQL-compatible database (MariaDB). User root, no password, localhost only"),
25249
25257
  version: external_exports.string().min(1).describe('"lts" (newest MariaDB LTS) or a MariaDB series such as "11.4".'),
25250
- port: Port.describe("Port inside the sandbox.")
25258
+ port: PortSchema.describe("Port inside the sandbox.")
25251
25259
  }),
25252
25260
  mongodb: external_exports.strictObject({
25253
25261
  enabled: dbEnabled("MongoDB with mongosh, localhost only"),
25254
25262
  version: external_exports.string().min(1).describe('"latest" or a version prefix such as "8.0".'),
25255
- port: Port.describe("Port inside the sandbox.")
25263
+ port: PortSchema.describe("Port inside the sandbox.")
25256
25264
  }),
25257
25265
  redis: external_exports.strictObject({
25258
25266
  enabled: dbEnabled("Redis (community Windows build), localhost only"),
25259
- port: Port.describe("Port inside the sandbox.")
25267
+ port: PortSchema.describe("Port inside the sandbox.")
25260
25268
  }),
25261
25269
  dynamodb: external_exports.strictObject({
25262
- enabled: dbEnabled("DynamoDB Local (Amazon's official emulator, on the Java toolchain) with dynamodb-admin, a web UI to browse and edit tables"),
25263
- port: Port.describe("DynamoDB endpoint port inside the sandbox (http://localhost:<port>)."),
25264
- adminPort: Port.describe("dynamodb-admin web UI port (open http://localhost:<adminPort> in the sandbox's browser)."),
25270
+ enabled: dbEnabled(
25271
+ "DynamoDB Local (Amazon's official emulator, on the Java toolchain) with dynamodb-admin, a web UI to browse and edit tables"
25272
+ ),
25273
+ port: PortSchema.describe("DynamoDB endpoint port inside the sandbox (http://localhost:<port>)."),
25274
+ adminPort: PortSchema.describe(
25275
+ "dynamodb-admin web UI port (open http://localhost:<adminPort> in the sandbox's browser)."
25276
+ ),
25265
25277
  admin: external_exports.boolean().describe("Run dynamodb-admin next to DynamoDB Local.")
25266
25278
  }),
25267
25279
  sqlserver: external_exports.strictObject({
25268
- enabled: dbEnabled("SQL Server. It cannot run inside Windows Sandbox; when a project needs it you get a note to use Postgres or SQLite for local work")
25280
+ enabled: dbEnabled(
25281
+ "SQL Server. It cannot run inside Windows Sandbox; when a project needs it you get a note to use Postgres or SQLite for local work"
25282
+ )
25269
25283
  })
25270
25284
  });
25271
25285
 
25272
25286
  // src/core/schema/harness.ts
25273
- var Harness = external_exports.strictObject({
25287
+ var HarnessSchema = external_exports.strictObject({
25274
25288
  hostExecutable: external_exports.string().optional().describe("Executable copied from this PC when installed here (e.g. claude.exe)."),
25275
25289
  hostDir: external_exports.string().optional().describe('Folder of hostExecutable on this PC, or "auto" to search PATH and ~/.local/bin.'),
25276
25290
  npmPackage: external_exports.string().optional().describe("npm package installed inside the sandbox when there is no host copy."),
25277
25291
  npmBin: external_exports.string().optional().describe("Command the npm package provides."),
25278
25292
  uvPackage: external_exports.string().optional().describe("Python package installed with `uv tool install` inside the sandbox (e.g. aider-chat)."),
25279
25293
  uvBin: external_exports.string().optional().describe("Command the uv package provides."),
25280
- arguments: Strings.describe("Arguments always passed to the agent."),
25294
+ arguments: StringsSchema.describe("Arguments always passed to the agent."),
25281
25295
  environment: external_exports.record(external_exports.string(), external_exports.string()).describe("Environment variables for the agent."),
25282
- resumeArguments: Strings.optional().describe("Arguments used when the agent is restarted in place (e.g. after an account switch) so it resumes the conversation.")
25296
+ resumeArguments: StringsSchema.optional().describe(
25297
+ "Arguments used when the agent is restarted in place (e.g. after an account switch) so it resumes the conversation."
25298
+ )
25283
25299
  }).refine((h) => h.hostExecutable || h.npmPackage || h.uvPackage, "needs hostExecutable, npmPackage or uvPackage").refine((h) => !h.uvPackage || h.uvBin, "needs uvBin when uvPackage is set").refine((h) => !h.npmPackage || h.npmBin, "needs npmBin when npmPackage is set");
25284
25300
 
25285
25301
  // src/core/schema/profile.ts
25286
- var Secrets = external_exports.strictObject({
25287
- strip: external_exports.boolean().describe(`Remove credentials from everything copied into the sandbox (your Claude settings.json "env" and credential helpers, MCP servers' env, headers and arguments): AWS, Azure, Google Cloud, Cloudflare, hosting, CI, registries, payment, AI API keys, database URLs, anything named *_TOKEN / *_SECRET / *PASSWORD* / *_KEY or *PROD*, and values that look like keys.`),
25288
- allow: Strings.describe('Variable names that may go in anyway; * matches anything, e.g. ["AWS_REGION", "AWS_PROFILE", "MY_APP_*"].'),
25289
- patterns: Strings.describe('More variable names to treat as secrets; * matches anything, e.g. ["ACME_*", "*_INTERNAL_URL"].'),
25290
- warnFiles: external_exports.boolean().describe("Warn at launch about files in the workspace that usually hold secrets (.env, *.pem, credentials.json, ...). The agent CAN read them: Windows Sandbox maps the whole folder.")
25302
+ var SecretsSchema = external_exports.strictObject({
25303
+ strip: external_exports.boolean().describe(
25304
+ `Remove credentials from everything copied into the sandbox (your Claude settings.json "env" and credential helpers, MCP servers' env, headers and arguments): AWS, Azure, Google Cloud, Cloudflare, hosting, CI, registries, payment, AI API keys, database URLs, anything named *_TOKEN / *_SECRET / *PASSWORD* / *_KEY or *PROD*, and values that look like keys.`
25305
+ ),
25306
+ allow: StringsSchema.describe(
25307
+ 'Variable names that may go in anyway; * matches anything, e.g. ["AWS_REGION", "AWS_PROFILE", "MY_APP_*"].'
25308
+ ),
25309
+ patterns: StringsSchema.describe(
25310
+ 'More variable names to treat as secrets; * matches anything, e.g. ["ACME_*", "*_INTERNAL_URL"].'
25311
+ ),
25312
+ warnFiles: external_exports.boolean().describe(
25313
+ "Warn at launch about files in the workspace that usually hold secrets (.env, *.pem, credentials.json, ...). The agent CAN read them: Windows Sandbox maps the whole folder."
25314
+ )
25291
25315
  });
25292
- var Attach = external_exports.strictObject({
25316
+ var AttachSchema = external_exports.strictObject({
25293
25317
  enabled: external_exports.boolean().describe("Allow sandbox claude --terminal / sandbox attach from this PC."),
25294
- reuseSession: external_exports.boolean().describe("sandbox claude -t in a running sandbox reattaches to this folder's session when no terminal on this PC is attached to it (--new always starts another)."),
25295
- auto: external_exports.boolean().describe("Starting an agent attaches this terminal automatically, as if you passed -t (only in an interactive terminal)."),
25296
- autoHide: external_exports.boolean().describe("Hide the Windows Sandbox window whenever this terminal attaches; it keeps running (sandbox show brings it back).")
25318
+ reuseSession: external_exports.boolean().describe(
25319
+ "sandbox claude -t in a running sandbox reattaches to this folder's session when no terminal on this PC is attached to it (--new always starts another)."
25320
+ ),
25321
+ auto: external_exports.boolean().describe(
25322
+ "Starting an agent attaches this terminal automatically, as if you passed -t (only in an interactive terminal)."
25323
+ ),
25324
+ autoHide: external_exports.boolean().describe(
25325
+ "Hide the Windows Sandbox window whenever this terminal attaches; it keeps running (sandbox show brings it back)."
25326
+ )
25297
25327
  });
25298
- var AgentCommands = external_exports.strictObject({
25299
- enabled: external_exports.boolean().describe("(Beta) Typing an agent's own command on this PC (claude, codex, ...) starts it in a hidden sandbox for the folder you are in and attaches that terminal. Adds one folder to the start of YOUR PATH; off removes it. SANDBOX_AGENT_DIRECT=1 runs the real agent instead."),
25300
- agents: external_exports.union([external_exports.literal("auto"), external_exports.array(Name)]).describe('"auto" = every agent installed on this PC, or a list of agent names, e.g. ["claude", "codex"].')
25328
+ var AgentCommandsSchema = external_exports.strictObject({
25329
+ enabled: external_exports.boolean().describe(
25330
+ "(Beta) Typing an agent's own command on this PC (claude, codex, ...) starts it in a hidden sandbox for the folder you are in and attaches that terminal. Adds one folder to the start of YOUR PATH; off removes it. SANDBOX_AGENT_DIRECT=1 runs the real agent instead."
25331
+ ),
25332
+ agents: external_exports.union([external_exports.literal("auto"), external_exports.array(NameSchema)]).describe('"auto" = every agent installed on this PC, or a list of agent names, e.g. ["claude", "codex"].')
25301
25333
  });
25302
- var ClaudeProfile = external_exports.strictObject({
25334
+ var ClaudeProfileSchema = external_exports.strictObject({
25303
25335
  enabled: external_exports.boolean().describe("Copy selected Claude settings from this PC into the sandbox."),
25304
25336
  hostDir: external_exports.string().describe('Your Claude folder, or "auto" (~/.claude or CLAUDE_CONFIG_DIR).'),
25305
25337
  include: external_exports.array(external_exports.string().regex(/^[A-Za-z0-9._-]+$/)).describe("Files and folders copied from it."),
@@ -25307,25 +25339,37 @@ var ClaudeProfile = external_exports.strictObject({
25307
25339
  copyCredentials: external_exports.boolean().describe("Copy your Claude LOGIN into the sandbox. Prefer sandbox account instead."),
25308
25340
  overwrite: external_exports.boolean().describe("Refresh these settings from this PC on every launch."),
25309
25341
  syncHistory: external_exports.boolean().describe("Bring conversation history in, and sync new history back (path-translated)."),
25310
- historyScope: external_exports.enum(["project", "all"]).describe(`Which history comes in: "project" = only the projects in this sandbox (other projects' conversations, file backups and prompts stay on this PC), "all" = everything. Only this sandbox's projects ever sync back.`),
25342
+ historyScope: external_exports.enum(["project", "all"]).describe(
25343
+ `Which history comes in: "project" = only the projects in this sandbox (other projects' conversations, file backups and prompts stay on this PC), "all" = everything. Only this sandbox's projects ever sync back.`
25344
+ ),
25311
25345
  syncClaudeMem: external_exports.boolean().describe("Bring claude-mem data into the sandbox (its settings and backups stay on this PC)."),
25312
- syncClaudeMemBack: external_exports.boolean().describe("Also copy claude-mem's database back to this PC when the sandbox closes. Off by default: what is in it is loaded into every Claude session on this PC, so a compromised agent could plant instructions there.")
25346
+ syncClaudeMemBack: external_exports.boolean().describe(
25347
+ "Also copy claude-mem's database back to this PC when the sandbox closes. Off by default: what is in it is loaded into every Claude session on this PC, so a compromised agent could plant instructions there."
25348
+ )
25313
25349
  });
25314
25350
 
25315
25351
  // src/core/schema/sandbox.ts
25316
- var GuestWorkspace = external_exports.union([external_exports.literal("auto"), external_exports.literal("mirror"), GuestPath]).describe('Where the workspace appears inside the sandbox. "auto" = C:\\Workspace\\<folder name>. "mirror" = the same path as on this PC, so absolute paths in configs and build caches match (another drive letter such as F: is a subst drive onto C:\\Mirror\\F); paths the sandbox reserves (C:\\Users\\..., C:\\Program Files\\...) fall back to "auto".');
25317
- var Mapping = external_exports.strictObject({
25352
+ var GuestWorkspaceSchema = external_exports.union([external_exports.literal("auto"), external_exports.literal("mirror"), GuestPathSchema]).describe(
25353
+ 'Where the workspace appears inside the sandbox. "auto" = C:\\Workspace\\<folder name>. "mirror" = the same path as on this PC, so absolute paths in configs and build caches match (another drive letter such as F: is a subst drive onto C:\\Mirror\\F); paths the sandbox reserves (C:\\Users\\..., C:\\Program Files\\...) fall back to "auto".'
25354
+ );
25355
+ var MappingSchema = external_exports.strictObject({
25318
25356
  host: external_exports.string().min(1).describe("Folder on this PC (relative paths are relative to the config file)."),
25319
- guest: external_exports.string().min(1).max(1024).optional().describe("Where it appears inside the sandbox, e.g. C:\\Assets, or on another drive letter (D: to Z:) such as F:\\SteamLibrary\\steamapps\\common\\Game (shown as F: at boot). Leave it out to use the same path as on this PC (a folder inside the project stays where it is in the project). A path the sandbox cannot use (C:\\Windows\\..., C:\\Users\\..., one already in use) goes to C:\\Mapped\\<drive>\\<path> instead, and the launch says so."),
25357
+ guest: external_exports.string().min(1).max(1024).optional().describe(
25358
+ "Where it appears inside the sandbox, e.g. C:\\Assets, or on another drive letter (D: to Z:) such as F:\\SteamLibrary\\steamapps\\common\\Game (shown as F: at boot). Leave it out to use the same path as on this PC (a folder inside the project stays where it is in the project). A full path only; one the sandbox cannot use (C:\\Windows\\..., C:\\Users\\..., one already in use) stops the launch with the fix."
25359
+ ),
25320
25360
  readOnly: external_exports.boolean().describe("true = the agent can only read it."),
25321
25361
  optional: external_exports.boolean().optional().describe("true = skip it quietly when the host folder does not exist.")
25322
25362
  });
25323
- var Sandbox = external_exports.strictObject({
25363
+ var SandboxSchema = external_exports.strictObject({
25324
25364
  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.'),
25325
25365
  maxMemoryMb: external_exports.number().int().positive().describe('Upper limit for memoryMb "auto".'),
25326
25366
  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).`),
25327
- cpuLimit: external_exports.union([external_exports.literal("none"), external_exports.number().int().min(5).max(100)]).describe(`Most of this PC's CPU the sandbox may use, in percent (5-100), e.g. 50 keeps half free for you; "none" = no cap (Windows Sandbox would take every processor). Covers everything this tool starts in the sandbox (agents, installs, builds, its terminal).`),
25328
- pageFileMb: external_exports.number().int().min(0).max(262144).describe(`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.`),
25367
+ cpuLimit: external_exports.union([external_exports.literal("none"), external_exports.number().int().min(5).max(100)]).describe(
25368
+ `Most of this PC's CPU the sandbox may use, in percent (5-100), e.g. 50 keeps half free for you; "none" = no cap (Windows Sandbox would take every processor). Covers everything this tool starts in the sandbox (agents, installs, builds, its terminal).`
25369
+ ),
25370
+ pageFileMb: external_exports.number().int().min(0).max(262144).describe(
25371
+ `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.`
25372
+ ),
25329
25373
  reserveHostMb: external_exports.number().int().nonnegative().describe('RAM always left for this PC when memoryMb is "auto".'),
25330
25374
  vGpu: external_exports.boolean().describe("Virtual GPU. Off by default: Microsoft notes it widens the sandbox attack surface."),
25331
25375
  networking: external_exports.boolean().describe("Internet access. false is the only hard network isolation Windows Sandbox offers."),
@@ -25334,215 +25378,964 @@ var Sandbox = external_exports.strictObject({
25334
25378
  videoInput: external_exports.boolean().describe("Camera access."),
25335
25379
  printerRedirection: external_exports.boolean().describe("Printers from this PC."),
25336
25380
  protectedClient: external_exports.boolean().describe("Run the sandbox window in Protected Client mode (recommended)."),
25337
- headless: external_exports.boolean().describe("Hide the sandbox window (sbx-show brings it back). A headless sandbox shuts down when its last session ends."),
25338
- keepAwake: external_exports.boolean().describe("Keep this PC from sleeping while a sandbox runs, so agents left working overnight keep going (the screen may still turn off; closing a laptop lid still sleeps it).")
25381
+ headless: external_exports.boolean().describe(
25382
+ "Hide the sandbox window (sbx-show brings it back). A headless sandbox shuts down when its last session ends."
25383
+ ),
25384
+ keepAwake: external_exports.boolean().describe(
25385
+ "Keep this PC from sleeping while a sandbox runs, so agents left working overnight keep going (the screen may still turn off; closing a laptop lid still sleeps it)."
25386
+ )
25339
25387
  });
25340
- var Port2 = external_exports.number().int().min(1).max(65535);
25341
- var HostEntry = external_exports.string().max(253).regex(/^(@developer|(\*\.)?([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+)$/, "a host name like example.com, *.example.com, or @developer");
25342
- var Network = external_exports.strictObject({
25388
+ var PortSchema2 = external_exports.number().int().min(1).max(65535);
25389
+ var HostEntrySchema = external_exports.string().max(253).regex(
25390
+ /^(@developer|(\*\.)?([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+)$/,
25391
+ "a host name like example.com, *.example.com, or @developer"
25392
+ );
25393
+ var NetworkSchema = external_exports.strictObject({
25343
25394
  blockPrivateRanges: external_exports.boolean().describe("Block your LAN (10/8, 172.16/12, 192.168/16, SMB) from inside the sandbox."),
25344
- allowOnly: external_exports.array(HostEntry).describe("Only these hosts can be reached once the sandbox is set up (tools still download first). *.example.com covers its subdomains; @developer adds package registries, GitHub, toolchain downloads and the AI providers. Programs go through a proxy in the sandbox (HTTP_PROXY); anything else is blocked by its firewall. Empty = no limit."),
25345
- blockHosts: external_exports.array(external_exports.string().max(253).regex(/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/, "a host name like telemetry.example.com")).describe("Never reachable from the sandbox, e.g. production servers or telemetry (each exact name; the sandbox's hosts file sends them nowhere)."),
25346
- forwardPorts: external_exports.array(external_exports.strictObject({
25347
- pc: Port2.describe("The port on this PC (localhost only)."),
25348
- sandbox: Port2.describe("The port inside the sandbox (a server there may listen on localhost only).")
25349
- })).describe("Reach servers in the sandbox from this PC: http://localhost:<pc> here goes to <sandbox> inside, while it runs. Nothing else on your network can use them."),
25395
+ allowOnly: external_exports.array(HostEntrySchema).describe(
25396
+ "Only these hosts can be reached once the sandbox is set up (tools still download first). *.example.com covers its subdomains; @developer adds package registries, GitHub, toolchain downloads and the AI providers. Programs go through a proxy in the sandbox (HTTP_PROXY); anything else is blocked by its firewall. Empty = no limit."
25397
+ ),
25398
+ blockHosts: external_exports.array(
25399
+ external_exports.string().max(253).regex(/^([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+$/, "a host name like telemetry.example.com")
25400
+ ).describe(
25401
+ "Never reachable from the sandbox, e.g. production servers or telemetry (each exact name; the sandbox's hosts file sends them nowhere)."
25402
+ ),
25403
+ forwardPorts: external_exports.array(
25404
+ external_exports.strictObject({
25405
+ pc: PortSchema2.describe("The port on this PC (localhost only)."),
25406
+ sandbox: PortSchema2.describe("The port inside the sandbox (a server there may listen on localhost only).")
25407
+ })
25408
+ ).describe(
25409
+ "Reach servers in the sandbox from this PC: http://localhost:<pc> here goes to <sandbox> inside, while it runs. Nothing else on your network can use them."
25410
+ ),
25350
25411
  dns: external_exports.array(external_exports.string().regex(/^\d{1,3}(\.\d{1,3}){3}$/, "an IPv4 address like 1.1.1.1")).describe("DNS servers for the sandbox instead of your network's, e.g. 1.1.1.1 and 9.9.9.9."),
25351
- proxy: external_exports.string().regex(/^(https?:\/\/[^\s]+)?$/, "http://host:port").describe("An HTTP proxy the sandbox uses to reach the internet (HTTP_PROXY / HTTPS_PROXY for everything in it), e.g. http://proxy.corp:8080. Empty = none.")
25412
+ proxy: external_exports.string().regex(/^(https?:\/\/[^\s]+)?$/, "http://host:port").describe(
25413
+ "An HTTP proxy the sandbox uses to reach the internet (HTTP_PROXY / HTTPS_PROXY for everything in it), e.g. http://proxy.corp:8080. Empty = none."
25414
+ )
25352
25415
  });
25353
- var Audit = external_exports.strictObject({
25354
- enabled: external_exports.boolean().describe("Keep an audit log on this PC of what happened in your sandboxes: programs started (with their command lines), files changed in the project, sessions, and what the repo guard caught. The sandbox cannot change it. Read it with sandbox audit."),
25416
+ var AuditSchema = external_exports.strictObject({
25417
+ enabled: external_exports.boolean().describe(
25418
+ "Keep an audit log on this PC of what happened in your sandboxes: programs started (with their command lines), files changed in the project, sessions, and what the repo guard caught. The sandbox cannot change it. Read it with sandbox audit."
25419
+ ),
25355
25420
  days: external_exports.number().int().min(1).max(365).describe("Days the audit log is kept."),
25356
25421
  maxMb: external_exports.number().int().min(5).max(5e3).describe("Most space the audit log may take, in MB (older days go first). Days before today are compressed."),
25357
- processes: external_exports.boolean().describe("Record every program started in the sandbox with its command line (Windows process auditing; repeated runs are counted, not listed)."),
25422
+ processes: external_exports.boolean().describe(
25423
+ "Record every program started in the sandbox with its command line (Windows process auditing; repeated runs are counted, not listed)."
25424
+ ),
25358
25425
  files: external_exports.boolean().describe("Record the files changed in the project while the sandbox runs.")
25359
25426
  });
25360
- var WorkspaceFilter = external_exports.strictObject({
25361
- enabled: external_exports.boolean().describe("Keep what your .gitignore lists (.env files, node_modules, build output ...) out of the sandbox. The sandbox works on a copy of the project without those files, kept in step with it both ways within about a second; what it creates that is ignored (its own node_modules, builds) stays in the sandbox. Git works as usual. Off = the project folder itself is mapped."),
25427
+ var WorkspaceFilterSchema = external_exports.strictObject({
25428
+ enabled: external_exports.boolean().describe(
25429
+ "Keep what your .gitignore lists (.env files, node_modules, build output ...) out of the sandbox. The sandbox works on a copy of the project without those files, kept in step with it both ways within about a second; what it creates that is ignored (its own node_modules, builds) stays in the sandbox. Git works as usual. Off = the project folder itself is mapped."
25430
+ ),
25362
25431
  exclude: external_exports.array(external_exports.string().max(500)).describe("Also keep these out, as .gitignore patterns, e.g. secrets/, *.pem, data/private/."),
25363
25432
  include: external_exports.array(external_exports.string().max(500)).describe("Let these in although .gitignore lists them, e.g. .env.example, data/fixtures/.")
25364
25433
  });
25365
- var Git = external_exports.strictObject({ enabled: external_exports.boolean().describe("Provide Git for Windows (and Git Bash, which Claude Code needs)."), access: GitAccess });
25366
- var Provisioning = external_exports.strictObject({
25434
+ var GitSchema = external_exports.strictObject({
25435
+ enabled: external_exports.boolean().describe("Provide Git for Windows (and Git Bash, which Claude Code needs)."),
25436
+ access: GitAccessSchema
25437
+ });
25438
+ var ProvisioningSchema = external_exports.strictObject({
25367
25439
  copyFromHost: external_exports.boolean().describe("Copy Node, Git, nvm and the agent from this PC when they are installed here."),
25368
25440
  fallbackToInstall: external_exports.boolean().describe("Download anything that cannot be copied from this PC."),
25369
25441
  refresh: external_exports.boolean().describe("Re-copy / re-download everything on the next launch."),
25370
- git: Git,
25442
+ git: GitSchema,
25371
25443
  terminal: toggle("Windows Terminal as the sandbox window (downloaded once)."),
25372
- conpty: toggle("Agent sessions use Microsoft's newer pseudo console (conpty.dll, downloaded once) instead of the one built into Windows: no garbled screen after resizing, real scrollback for the mouse wheel. Off = the one built into Windows.")
25444
+ conpty: toggle(
25445
+ "Agent sessions use Microsoft's newer pseudo console (conpty.dll, downloaded once) instead of the one built into Windows: no garbled screen after resizing, real scrollback for the mouse wheel. Off = the one built into Windows."
25446
+ )
25373
25447
  });
25374
- var Downloads = external_exports.strictObject({
25375
- requireChecksum: external_exports.boolean().describe("Refuse any toolchain, database or tool download that has no published checksum (SHA-256/SHA-512) to verify it against. false = allow those, as before. Downloads that do have a published checksum are always verified. A project's .sandbox-config.json can only turn this on.")
25448
+ var DownloadsSchema = external_exports.strictObject({
25449
+ requireChecksum: external_exports.boolean().describe(
25450
+ "Refuse any toolchain, database or tool download that has no published checksum (SHA-256/SHA-512) to verify it against. false = allow those, as before. Downloads that do have a published checksum are always verified. A project's .sandbox-config.json can only turn this on."
25451
+ )
25376
25452
  });
25377
25453
 
25378
25454
  // src/core/schema/toolchains.ts
25379
- var Toolchains = external_exports.strictObject({
25455
+ var ToolchainsSchema = external_exports.strictObject({
25380
25456
  node: external_exports.strictObject({
25381
- version: external_exports.string().min(1).describe(`Default Node version for nvm. "host" = the Node on this PC. A project's .nvmrc / .node-version wins.`),
25382
- extraVersions: Strings.describe("More Node versions to install (switch with nvm use). On top of the up to 3 versions copied from this PC's nvm, not counted towards that limit."),
25457
+ version: external_exports.string().min(1).describe(
25458
+ `Default Node version for nvm. "host" = the Node on this PC. A project's .nvmrc / .node-version wins.`
25459
+ ),
25460
+ extraVersions: StringsSchema.describe(
25461
+ "More Node versions to install (switch with nvm use). On top of the up to 3 versions copied from this PC's nvm, not counted towards that limit."
25462
+ ),
25383
25463
  corepack: external_exports.boolean().describe(`pnpm and yarn through corepack (a project's "packageManager" in package.json picks the version).`),
25384
- volta: Enabled.describe(`Volta: true, false, or "auto" = when the project's package.json has "volta" pins or this PC uses Volta. With pins, Volta's node/npm/yarn/pnpm come first on PATH.`),
25385
- globalPackages: Packages("npm packages installed globally into the default Node version", '["typescript", "npm-check-updates"]')
25464
+ volta: EnabledSchema.describe(
25465
+ `Volta: true, false, or "auto" = when the project's package.json has "volta" pins or this PC uses Volta. With pins, Volta's node/npm/yarn/pnpm come first on PATH.`
25466
+ ),
25467
+ globalPackages: Packages(
25468
+ "npm packages installed globally into the default Node version",
25469
+ '["typescript", "npm-check-updates"]'
25470
+ )
25386
25471
  }),
25387
25472
  python: external_exports.strictObject({
25388
- enabled: enabled("Python 3 (CPython with pip).", "pyproject.toml, requirements.txt, setup.py, Pipfile or .python-version"),
25473
+ enabled: enabled(
25474
+ "Python 3 (CPython with pip).",
25475
+ "pyproject.toml, requirements.txt, setup.py, Pipfile or .python-version"
25476
+ ),
25389
25477
  version: external_exports.string().min(1).describe(`Python 3 version prefix, e.g. "3" or "3.12". A project's .python-version wins.`),
25390
25478
  python2: external_exports.boolean().describe("Also install Python 2.7 as python2 / pip2."),
25391
- pyenv: Enabled.describe('pyenv-win (pyenv install / local / global): true, false, or "auto" = when this PC uses pyenv. .python-version is honoured either way, and `uv python install` always works.'),
25392
- tools: Packages("Python command-line tools installed with `uv tool install` (needs uv)", '["poetry", "ruff", "pre-commit"]')
25479
+ pyenv: EnabledSchema.describe(
25480
+ 'pyenv-win (pyenv install / local / global): true, false, or "auto" = when this PC uses pyenv. .python-version is honoured either way, and `uv python install` always works.'
25481
+ ),
25482
+ tools: Packages(
25483
+ "Python command-line tools installed with `uv tool install` (needs uv)",
25484
+ '["poetry", "ruff", "pre-commit"]'
25485
+ )
25393
25486
  }),
25394
25487
  rust: external_exports.strictObject({
25395
25488
  enabled: enabled("Rust via rustup (cargo, rustc).", "Cargo.toml or rust-toolchain(.toml)"),
25396
25489
  toolchain: external_exports.string().min(1).describe('Default toolchain, e.g. "stable". rust-toolchain.toml in a project wins.'),
25397
- host: external_exports.string().min(1).describe('Host triple, or "auto": x86_64-pc-windows-msvc when the MSVC toolchain is on (like most PCs), else x86_64-pc-windows-gnu (MinGW is its linker).'),
25490
+ host: external_exports.string().min(1).describe(
25491
+ 'Host triple, or "auto": x86_64-pc-windows-msvc when the MSVC toolchain is on (like most PCs), else x86_64-pc-windows-gnu (MinGW is its linker).'
25492
+ ),
25398
25493
  components: Packages("Extra rustup components", '["rust-src", "llvm-tools"]'),
25399
25494
  targets: Packages("Extra rustup targets", '["wasm32-unknown-unknown"]'),
25400
- crates: Packages("Binaries for cargo: prebuilt via cargo-binstall when the crate publishes a Windows build, else compiled with `cargo install --locked` (slow the first time)", '["sccache", "cargo-nextest", "cargo-deny"]'),
25401
- targetDir: external_exports.string().min(1).describe(`"shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`)
25495
+ crates: Packages(
25496
+ "Binaries for cargo: prebuilt via cargo-binstall when the crate publishes a Windows build, else compiled with `cargo install --locked` (slow the first time)",
25497
+ '["sccache", "cargo-nextest", "cargo-deny"]'
25498
+ ),
25499
+ targetDir: external_exports.string().min(1).describe(
25500
+ `"shared": cargo's default target\\ (shared with builds on this PC, so builds on either side invalidate the other), "separate": <workspace>\\target\\sandbox (kept, no cross-talk), "local": on the sandbox's own disk (fastest, lost every boot), or a guest path.`
25501
+ ),
25502
+ linker: external_exports.enum(["lld", "gnu"]).describe(
25503
+ `GNU host: "lld" links with Rust's own lld through MinGW's gcc (much less memory than GNU ld), "gnu" with GNU ld.`
25504
+ ),
25505
+ linkSlots: external_exports.union([external_exports.literal("auto"), external_exports.number().int().min(1).max(32)]).describe(
25506
+ 'GNU host: how many programs may link at the same time in the whole sandbox (other links wait). "auto" = one per 8 GB of sandbox memory, 2 to 4. Several agents linking big programs at once can take Windows down.'
25507
+ )
25402
25508
  }),
25403
25509
  msvc: external_exports.strictObject({
25404
- enabled: enabled("MSVC (cl, link) and the Windows SDK, portable from Microsoft's Visual Studio manifest (~1-2 GB once), with vcvars64.bat and vswhere.", "a .vcxproj, CMakePresets.json, a script calling vcvars/vswhere, or a Rust project when this PC builds Rust with MSVC"),
25405
- acceptLicense: external_exports.boolean().describe("Required to install MSVC: you accept the Visual Studio licence terms (https://visualstudio.microsoft.com/license-terms/), which need a Visual Studio licence."),
25510
+ enabled: enabled(
25511
+ "MSVC (cl, link) and the Windows SDK, portable from Microsoft's Visual Studio manifest (~1-2 GB once), with vcvars64.bat and vswhere.",
25512
+ "a .vcxproj, CMakePresets.json, a script calling vcvars/vswhere, or a Rust project when this PC builds Rust with MSVC"
25513
+ ),
25514
+ acceptLicense: external_exports.boolean().describe(
25515
+ "Required to install MSVC: you accept the Visual Studio licence terms (https://visualstudio.microsoft.com/license-terms/), which need a Visual Studio licence."
25516
+ ),
25406
25517
  msvcVersion: external_exports.string().min(1).describe('"latest" or an MSVC tools version prefix, e.g. "14.44".'),
25407
25518
  sdkVersion: external_exports.string().min(1).describe('"latest" or a Windows SDK build, e.g. "26100" or "10.0.22621".')
25408
25519
  }),
25409
25520
  cpp: external_exports.strictObject({
25410
- enabled: enabled("MinGW-w64 GCC with CMake, Ninja, premake5 and mingw32-make (also Rust's linker).", "CMakeLists.txt, Makefile, meson.build, premake5.lua or Cargo.toml"),
25411
- flexBison: external_exports.boolean().describe("win_flex / win_bison, the parser generators many C/C++ projects (game engines among them) need; CMake finds them.")
25521
+ enabled: enabled(
25522
+ "MinGW-w64 GCC with CMake, Ninja, premake5 and mingw32-make (also Rust's linker).",
25523
+ "CMakeLists.txt, Makefile, meson.build, premake5.lua or Cargo.toml"
25524
+ ),
25525
+ flexBison: external_exports.boolean().describe(
25526
+ "win_flex / win_bison, the parser generators many C/C++ projects (game engines among them) need; CMake finds them."
25527
+ )
25412
25528
  }),
25413
25529
  dotnet: external_exports.strictObject({
25414
25530
  enabled: enabled(".NET SDK (C#, F#).", "a .sln, .slnx, .csproj, .fsproj or global.json"),
25415
- channels: Strings.describe(`SDK channels, e.g. ["LTS", "8.0"]. A project's global.json is installed too.`),
25531
+ channels: StringsSchema.describe(`SDK channels, e.g. ["LTS", "8.0"]. A project's global.json is installed too.`),
25416
25532
  tools: Packages("Global .NET tools (`dotnet tool install -g`)", '["dotnet-ef", "csharpier"]'),
25417
25533
  workloads: Packages("SDK workloads (`dotnet workload install`)", '["aspire", "wasm-tools"]'),
25418
- frameworkTargets: Strings.describe('.NET Framework reference assemblies (targeting packs) from NuGet, so net4x and old-style .csproj projects build without Visual Studio, e.g. ["net48", "net472", "net462"]. The 4.8 runtime itself ships with Windows.'),
25419
- netfx35: external_exports.boolean().describe(".NET Framework 3.5 runtime (a Windows feature, enabled from Windows Update on every boot; a few minutes).")
25534
+ frameworkTargets: StringsSchema.describe(
25535
+ '.NET Framework reference assemblies (targeting packs) from NuGet, so net4x and old-style .csproj projects build without Visual Studio, e.g. ["net48", "net472", "net462"]. The 4.8 runtime itself ships with Windows.'
25536
+ ),
25537
+ netfx35: external_exports.boolean().describe(
25538
+ ".NET Framework 3.5 runtime (a Windows feature, enabled from Windows Update on every boot; a few minutes)."
25539
+ )
25420
25540
  }),
25421
25541
  go: external_exports.strictObject({
25422
25542
  enabled: enabled("Go.", "go.mod or go.work"),
25423
- version: external_exports.string().min(1).describe('"stable" or a version prefix such as "1.23". A go.mod asking for newer fetches it itself (GOTOOLCHAIN=auto).'),
25543
+ version: external_exports.string().min(1).describe(
25544
+ '"stable" or a version prefix such as "1.23". A go.mod asking for newer fetches it itself (GOTOOLCHAIN=auto).'
25545
+ ),
25424
25546
  tools: Packages("Go tools (`go install <path>@<version>`)", '["golang.org/x/tools/gopls@latest"]')
25425
25547
  }),
25426
25548
  java: external_exports.strictObject({
25427
- enabled: enabled("Java: Eclipse Temurin JDK.", "pom.xml, build.gradle(.kts), settings.gradle(.kts), mvnw, gradlew or .java-version"),
25549
+ enabled: enabled(
25550
+ "Java: Eclipse Temurin JDK.",
25551
+ "pom.xml, build.gradle(.kts), settings.gradle(.kts), mvnw, gradlew or .java-version"
25552
+ ),
25428
25553
  version: external_exports.string().min(1).describe(`"lts" (newest LTS) or a major version such as "21". A project's .java-version or .sdkmanrc wins.`),
25429
25554
  maven: external_exports.boolean().describe("Apache Maven (mvn). A project's mvnw works either way."),
25430
25555
  gradle: external_exports.boolean().describe("Gradle (gradle). A project's gradlew works either way.")
25431
25556
  }),
25432
25557
  ruby: external_exports.strictObject({
25433
- enabled: enabled("Ruby (RubyInstaller, with gem and bundler). Gems with C extensions need MSYS2, which is not included.", "Gemfile, a .gemspec or .ruby-version"),
25558
+ enabled: enabled(
25559
+ "Ruby (RubyInstaller, with gem and bundler). Gems with C extensions need MSYS2, which is not included.",
25560
+ "Gemfile, a .gemspec or .ruby-version"
25561
+ ),
25434
25562
  version: external_exports.string().min(1).describe(`Version prefix, e.g. "3" or "3.3". A project's .ruby-version wins.`),
25435
25563
  gems: Packages("Gems installed globally", '["rubocop"]')
25436
25564
  }),
25437
25565
  php: external_exports.strictObject({
25438
- enabled: enabled("PHP (with the Visual C++ runtime it needs, installed on every boot).", "composer.json, artisan or .php-version"),
25566
+ enabled: enabled(
25567
+ "PHP (with the Visual C++ runtime it needs, installed on every boot).",
25568
+ "composer.json, artisan or .php-version"
25569
+ ),
25439
25570
  version: external_exports.string().min(1).describe(`Version prefix, e.g. "8" or "8.3". A project's .php-version wins.`),
25440
25571
  composer: external_exports.boolean().describe("Composer.")
25441
25572
  }),
25442
25573
  deno: external_exports.strictObject({ enabled: enabled("Deno.", "deno.json, deno.jsonc or deno.lock") }),
25443
- pwsh: external_exports.strictObject({ enabled: Enabled.describe('PowerShell 7 (pwsh), portable (~110 MB once); `powershell` stays Windows PowerShell 5.1. true, false, or "auto" = when a .ps1 at the root or one folder down has #Requires -Version 7 / -PSEdition Core or a `pwsh ...` usage line, or, in a folder that is no project yet, when this PC has PowerShell 7.') }),
25574
+ pwsh: external_exports.strictObject({
25575
+ enabled: EnabledSchema.describe(
25576
+ 'PowerShell 7 (pwsh), portable (~110 MB once); `powershell` stays Windows PowerShell 5.1. true, false, or "auto" = when a .ps1 at the root or one folder down has #Requires -Version 7 / -PSEdition Core or a `pwsh ...` usage line, or, in a folder that is no project yet, when this PC has PowerShell 7.'
25577
+ )
25578
+ }),
25444
25579
  cli: external_exports.strictObject({
25445
- gh: Enabled.describe('GitHub CLI (gh). Only with provisioning.git.access "full": gh can push and merge through the GitHub API, past a read-only git. Your PC\'s gh login is never copied; `gh auth login` inside persists (GH_CONFIG_DIR). "auto" = when the project has a .github folder.'),
25446
- zstd: Enabled.describe('Zstandard (zstd). "auto" = off; set true to get it.'),
25447
- openssl: Enabled.describe('`openssl` on PATH, from the copy Git for Windows ships (its mingw64\\bin is not put on PATH, so it cannot shadow MinGW\'s gcc). "auto" = on.')
25580
+ gh: EnabledSchema.describe(
25581
+ 'GitHub CLI (gh). Only with provisioning.git.access "full": gh can push and merge through the GitHub API, past a read-only git. Your PC\'s gh login is never copied; `gh auth login` inside persists (GH_CONFIG_DIR). "auto" = when the project has a .github folder.'
25582
+ ),
25583
+ zstd: EnabledSchema.describe('Zstandard (zstd). "auto" = off; set true to get it.'),
25584
+ openssl: EnabledSchema.describe(
25585
+ '`openssl` on PATH, from the copy Git for Windows ships (its mingw64\\bin is not put on PATH, so it cannot shadow MinGW\'s gcc). "auto" = on.'
25586
+ )
25448
25587
  }).describe("Small portable command-line tools from their GitHub releases, installed once into tools\\cli."),
25449
25588
  bun: toggle("Bun runtime (claude-mem needs it)."),
25450
25589
  uv: toggle("uv, the Python package manager (claude-mem needs it)."),
25451
- vcRuntime: toggle("Microsoft Visual C++ runtime for tools that need it (a real installer, so it runs on every boot, ~15 s). PHP installs it regardless."),
25590
+ vcRuntime: toggle(
25591
+ "Microsoft Visual C++ runtime for tools that need it (a real installer, so it runs on every boot, ~15 s). PHP installs it regardless."
25592
+ ),
25452
25593
  mesa: external_exports.strictObject({
25453
- enabled: external_exports.boolean().describe("Mesa 3D (llvmpipe): OpenGL 4.5 in software for games and apps when there is no GPU (sandbox.vGpu off). Copy opengl32.dll and libgallium_wgl.dll from %MESA_DIR% next to the program's .exe."),
25454
- vulkan: external_exports.boolean().describe("Also software Vulkan 1.4 (Mesa lavapipe) with the Khronos loader, registered for every program; for wgpu set WGPU_BACKEND=vulkan.")
25594
+ enabled: external_exports.boolean().describe(
25595
+ "Mesa 3D (llvmpipe): OpenGL 4.5 in software for games and apps when there is no GPU (sandbox.vGpu off). Copy opengl32.dll and libgallium_wgl.dll from %MESA_DIR% next to the program's .exe."
25596
+ ),
25597
+ vulkan: external_exports.boolean().describe(
25598
+ "Also software Vulkan 1.4 (Mesa lavapipe) with the Khronos loader, registered for every program; for wgpu set WGPU_BACKEND=vulkan."
25599
+ )
25455
25600
  }),
25456
25601
  vscode: external_exports.strictObject({
25457
- enabled: external_exports.boolean().describe("Portable VS Code inside the sandbox (code on PATH, desktop shortcut); its settings and extensions persist."),
25458
- setup: external_exports.boolean().describe("Point VS Code at the sandbox's own tools (JDK, Python, Go, compilers, .NET, Git, PowerShell 7 and Git Bash terminals) and install the language extensions for the toolchains in use."),
25602
+ enabled: external_exports.boolean().describe(
25603
+ "Portable VS Code inside the sandbox (code on PATH, desktop shortcut); its settings and extensions persist."
25604
+ ),
25605
+ setup: external_exports.boolean().describe(
25606
+ "Point VS Code at the sandbox's own tools (JDK, Python, Go, compilers, .NET, Git, PowerShell 7 and Git Bash terminals) and install the language extensions for the toolchains in use."
25607
+ ),
25459
25608
  recommended: external_exports.boolean().describe("Also install the extensions a project recommends in its .vscode/extensions.json."),
25460
25609
  extensions: external_exports.array(external_exports.string().regex(/^[\w-]+\.[\w-]+$/, "publisher.name, e.g. eamodio.gitlens")).describe("More extensions to install in every sandbox, e.g. eamodio.gitlens, ms-azuretools.vscode-docker.")
25461
25610
  }),
25462
- environment: external_exports.record(external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/, "letters, digits and _ only"), external_exports.string()).describe('Extra environment variables for the agent and every terminal, e.g. registry mirrors: {"NPM_CONFIG_REGISTRY": "https://...", "PIP_INDEX_URL": "https://..."}.')
25611
+ environment: external_exports.record(external_exports.string().regex(/^[A-Za-z_][A-Za-z0-9_]*$/, "letters, digits and _ only"), external_exports.string()).describe(
25612
+ 'Extra environment variables for the agent and every terminal, e.g. registry mirrors: {"NPM_CONFIG_REGISTRY": "https://...", "PIP_INDEX_URL": "https://..."}.'
25613
+ )
25463
25614
  });
25464
25615
 
25465
- // src/shared/apps.ts
25616
+ // src/shared/apps/catalogue.ts
25466
25617
  var gh = (github, asset) => ({ github, asset });
25467
25618
  var APPS = [
25468
25619
  // ---- editors
25469
- { id: "vscode", name: "Visual Studio Code", category: "editors", about: "Code editor with debugging, set up for the sandbox's languages.", size: "150 MB", source: { resolve: "setting" }, exe: "Code.exe", setting: "toolchains.vscode.enabled" },
25470
- { id: "windows-terminal", name: "Windows Terminal", category: "utilities", about: "The sandbox window: tabs, panes, PowerShell 7 profile.", size: "40 MB", source: { resolve: "setting" }, exe: "WindowsTerminal.exe", setting: "provisioning.terminal.enabled" },
25471
- { id: "notepadpp", name: "Notepad++", category: "editors", about: "Fast text and code editor.", size: "8 MB", source: gh("notepad-plus-plus/notepad-plus-plus", "^npp\\.[\\d.]+\\.portable\\.x64\\.zip$"), exe: "notepad++.exe" },
25472
- { id: "sublime", name: "Sublime Text", category: "editors", about: "Fast code editor (paid licence, free to evaluate).", size: "28 MB", source: { resolve: "sublime" }, exe: "sublime_text.exe" },
25473
- { id: "neovim", name: "Neovim", category: "editors", about: "Terminal text editor (nvim).", size: "12 MB", source: gh("neovim/neovim", "^nvim-win64\\.zip$"), exe: "nvim.exe", cli: true },
25620
+ {
25621
+ id: "vscode",
25622
+ name: "Visual Studio Code",
25623
+ category: "editors",
25624
+ about: "Code editor with debugging, set up for the sandbox's languages.",
25625
+ size: "150 MB",
25626
+ source: { resolve: "setting" },
25627
+ exe: "Code.exe",
25628
+ setting: "toolchains.vscode.enabled"
25629
+ },
25630
+ {
25631
+ id: "windows-terminal",
25632
+ name: "Windows Terminal",
25633
+ category: "utilities",
25634
+ about: "The sandbox window: tabs, panes, PowerShell 7 profile.",
25635
+ size: "40 MB",
25636
+ source: { resolve: "setting" },
25637
+ exe: "WindowsTerminal.exe",
25638
+ setting: "provisioning.terminal.enabled"
25639
+ },
25640
+ {
25641
+ id: "notepadpp",
25642
+ name: "Notepad++",
25643
+ category: "editors",
25644
+ about: "Fast text and code editor.",
25645
+ size: "8 MB",
25646
+ source: gh("notepad-plus-plus/notepad-plus-plus", "^npp\\.[\\d.]+\\.portable\\.x64\\.zip$"),
25647
+ exe: "notepad++.exe"
25648
+ },
25649
+ {
25650
+ id: "sublime",
25651
+ name: "Sublime Text",
25652
+ category: "editors",
25653
+ about: "Fast code editor (paid licence, free to evaluate).",
25654
+ size: "28 MB",
25655
+ source: { resolve: "sublime" },
25656
+ exe: "sublime_text.exe"
25657
+ },
25658
+ {
25659
+ id: "neovim",
25660
+ name: "Neovim",
25661
+ category: "editors",
25662
+ about: "Terminal text editor (nvim).",
25663
+ size: "12 MB",
25664
+ source: gh("neovim/neovim", "^nvim-win64\\.zip$"),
25665
+ exe: "nvim.exe",
25666
+ cli: true
25667
+ },
25474
25668
  // ---- database clients
25475
- { id: "dbeaver", name: "DBeaver Community", category: "databases", about: "Universal database client: PostgreSQL, MySQL, SQLite, SQL Server and more.", size: "120 MB", source: gh("dbeaver/dbeaver", "^dbeaver-ce-[\\d.]+-windows-x86_64\\.zip$"), exe: "dbeaver.exe" },
25476
- { id: "pgadmin", name: "pgAdmin 4", category: "databases", about: "The PostgreSQL admin GUI (from the PostgreSQL binaries zip).", size: "330 MB", source: { resolve: "pgadmin" }, exe: "pgAdmin4.exe" },
25477
- { id: "heidisql", name: "HeidiSQL", category: "databases", about: "Light client for MySQL, MariaDB, PostgreSQL and SQL Server.", size: "28 MB", source: gh("HeidiSQL/HeidiSQL", "^HeidiSQL_[\\d.]+_64_Portable\\.zip$"), exe: "heidisql.exe" },
25478
- { id: "sqlitebrowser", name: "DB Browser for SQLite", category: "databases", about: "Open, browse and edit SQLite files.", size: "21 MB", source: gh("sqlitebrowser/sqlitebrowser", "^DB\\.Browser\\.for\\.SQLite-v?[\\d.]+-win64\\.zip$"), exe: "DB Browser for SQLite.exe" },
25479
- { id: "compass", name: "MongoDB Compass", category: "databases", about: "The MongoDB GUI.", size: "220 MB", source: gh("mongodb-js/compass", "^mongodb-compass-[\\d.]+-win32-x64\\.zip$"), exe: "MongoDBCompass.exe" },
25480
- { id: "redisinsight", name: "Redis Insight", category: "databases", about: "The Redis GUI.", size: "110 MB", source: gh("redis/RedisInsight", "^Redis-Insight-win-installer\\.exe$"), unpack: "nsis", exe: "Redis Insight.exe", needs: ["7zip"] },
25481
- { id: "dbgate", name: "DbGate", category: "databases", about: "Database manager for SQL and NoSQL databases.", size: "180 MB", source: gh("dbgate/dbgate", "^dbgate-[\\d.]+-win_x64\\.zip$"), exe: "DbGate.exe" },
25482
- { id: "beekeeper", name: "Beekeeper Studio", category: "databases", about: "SQL editor and database manager.", size: "245 MB", source: gh("beekeeper-studio/beekeeper-studio", "^Beekeeper-Studio-[\\d.]+-portable\\.exe$"), unpack: "nsis", exe: "Beekeeper Studio.exe", needs: ["7zip"] },
25483
- { id: "dynamodb-admin", name: "dynamodb-admin", category: "databases", about: "Web GUI for DynamoDB Local: run dynamodb-admin, then open http://localhost:8001.", size: "5 MB", source: { npm: "dynamodb-admin" }, exe: "dynamodb-admin.cmd", cli: true },
25669
+ {
25670
+ id: "dbeaver",
25671
+ name: "DBeaver Community",
25672
+ category: "databases",
25673
+ about: "Universal database client: PostgreSQL, MySQL, SQLite, SQL Server and more.",
25674
+ size: "120 MB",
25675
+ source: gh("dbeaver/dbeaver", "^dbeaver-ce-[\\d.]+-windows-x86_64\\.zip$"),
25676
+ exe: "dbeaver.exe"
25677
+ },
25678
+ {
25679
+ id: "pgadmin",
25680
+ name: "pgAdmin 4",
25681
+ category: "databases",
25682
+ about: "The PostgreSQL admin GUI (from the PostgreSQL binaries zip).",
25683
+ size: "330 MB",
25684
+ source: { resolve: "pgadmin" },
25685
+ exe: "pgAdmin4.exe"
25686
+ },
25687
+ {
25688
+ id: "heidisql",
25689
+ name: "HeidiSQL",
25690
+ category: "databases",
25691
+ about: "Light client for MySQL, MariaDB, PostgreSQL and SQL Server.",
25692
+ size: "28 MB",
25693
+ source: gh("HeidiSQL/HeidiSQL", "^HeidiSQL_[\\d.]+_64_Portable\\.zip$"),
25694
+ exe: "heidisql.exe"
25695
+ },
25696
+ {
25697
+ id: "sqlitebrowser",
25698
+ name: "DB Browser for SQLite",
25699
+ category: "databases",
25700
+ about: "Open, browse and edit SQLite files.",
25701
+ size: "21 MB",
25702
+ source: gh("sqlitebrowser/sqlitebrowser", "^DB\\.Browser\\.for\\.SQLite-v?[\\d.]+-win64\\.zip$"),
25703
+ exe: "DB Browser for SQLite.exe"
25704
+ },
25705
+ {
25706
+ id: "compass",
25707
+ name: "MongoDB Compass",
25708
+ category: "databases",
25709
+ about: "The MongoDB GUI.",
25710
+ size: "220 MB",
25711
+ source: gh("mongodb-js/compass", "^mongodb-compass-[\\d.]+-win32-x64\\.zip$"),
25712
+ exe: "MongoDBCompass.exe"
25713
+ },
25714
+ {
25715
+ id: "redisinsight",
25716
+ name: "Redis Insight",
25717
+ category: "databases",
25718
+ about: "The Redis GUI.",
25719
+ size: "110 MB",
25720
+ source: gh("redis/RedisInsight", "^Redis-Insight-win-installer\\.exe$"),
25721
+ unpack: "nsis",
25722
+ exe: "Redis Insight.exe",
25723
+ needs: ["7zip"]
25724
+ },
25725
+ {
25726
+ id: "dbgate",
25727
+ name: "DbGate",
25728
+ category: "databases",
25729
+ about: "Database manager for SQL and NoSQL databases.",
25730
+ size: "180 MB",
25731
+ source: gh("dbgate/dbgate", "^dbgate-[\\d.]+-win_x64\\.zip$"),
25732
+ exe: "DbGate.exe"
25733
+ },
25734
+ {
25735
+ id: "beekeeper",
25736
+ name: "Beekeeper Studio",
25737
+ category: "databases",
25738
+ about: "SQL editor and database manager.",
25739
+ size: "245 MB",
25740
+ source: gh("beekeeper-studio/beekeeper-studio", "^Beekeeper-Studio-[\\d.]+-portable\\.exe$"),
25741
+ unpack: "nsis",
25742
+ exe: "Beekeeper Studio.exe",
25743
+ needs: ["7zip"]
25744
+ },
25745
+ {
25746
+ id: "dynamodb-admin",
25747
+ name: "dynamodb-admin",
25748
+ category: "databases",
25749
+ about: "Web GUI for DynamoDB Local: run dynamodb-admin, then open http://localhost:8001.",
25750
+ size: "5 MB",
25751
+ source: { npm: "dynamodb-admin" },
25752
+ exe: "dynamodb-admin.cmd",
25753
+ cli: true
25754
+ },
25484
25755
  // ---- API clients
25485
- { id: "bruno", name: "Bruno", category: "api", about: "Offline, git-friendly API client (collections are files in your repo).", size: "175 MB", source: gh("usebruno/bruno", "^bruno_[\\d.]+_x64_win\\.zip$"), exe: "Bruno.exe" },
25486
- { id: "insomnia", name: "Insomnia", category: "api", about: "REST, GraphQL and gRPC client.", size: "590 MB", source: gh("Kong/insomnia", "^insomnia-[\\d.]+-full\\.nupkg$"), exe: "Insomnia.exe" },
25756
+ {
25757
+ id: "bruno",
25758
+ name: "Bruno",
25759
+ category: "api",
25760
+ about: "Offline, git-friendly API client (collections are files in your repo).",
25761
+ size: "175 MB",
25762
+ source: gh("usebruno/bruno", "^bruno_[\\d.]+_x64_win\\.zip$"),
25763
+ exe: "Bruno.exe"
25764
+ },
25765
+ {
25766
+ id: "insomnia",
25767
+ name: "Insomnia",
25768
+ category: "api",
25769
+ about: "REST, GraphQL and gRPC client.",
25770
+ size: "590 MB",
25771
+ source: gh("Kong/insomnia", "^insomnia-[\\d.]+-full\\.nupkg$"),
25772
+ exe: "Insomnia.exe"
25773
+ },
25487
25774
  // ---- git
25488
- { id: "sourcegit", name: "SourceGit", category: "git", about: "Fast open-source Git GUI.", size: "26 MB", source: gh("sourcegit-scm/sourcegit", "^sourcegit_[\\d.]+\\.win-x64\\.zip$"), exe: "SourceGit.exe" },
25489
- { id: "githubdesktop", name: "GitHub Desktop", category: "git", about: 'Simple Git GUI from GitHub. It has its own git, so it needs provisioning.git.access "full".', size: "300 MB", source: gh("desktop/desktop", "^GitHubDesktop-[\\d.]+-x64-full\\.nupkg$"), exe: "GitHubDesktop.exe", fullGitOnly: true },
25490
- { id: "lazygit", name: "lazygit", category: "git", about: "Git in the terminal.", size: "7 MB", source: gh("jesseduffield/lazygit", "^lazygit_[\\d.]+_windows_x86_64\\.zip$"), exe: "lazygit.exe", cli: true },
25775
+ {
25776
+ id: "sourcegit",
25777
+ name: "SourceGit",
25778
+ category: "git",
25779
+ about: "Fast open-source Git GUI.",
25780
+ size: "26 MB",
25781
+ source: gh("sourcegit-scm/sourcegit", "^sourcegit_[\\d.]+\\.win-x64\\.zip$"),
25782
+ exe: "SourceGit.exe"
25783
+ },
25784
+ {
25785
+ id: "githubdesktop",
25786
+ name: "GitHub Desktop",
25787
+ category: "git",
25788
+ about: 'Simple Git GUI from GitHub. It has its own git, so it needs provisioning.git.access "full".',
25789
+ size: "300 MB",
25790
+ source: gh("desktop/desktop", "^GitHubDesktop-[\\d.]+-x64-full\\.nupkg$"),
25791
+ exe: "GitHubDesktop.exe",
25792
+ fullGitOnly: true
25793
+ },
25794
+ {
25795
+ id: "lazygit",
25796
+ name: "lazygit",
25797
+ category: "git",
25798
+ about: "Git in the terminal.",
25799
+ size: "7 MB",
25800
+ source: gh("jesseduffield/lazygit", "^lazygit_[\\d.]+_windows_x86_64\\.zip$"),
25801
+ exe: "lazygit.exe",
25802
+ cli: true
25803
+ },
25491
25804
  // ---- utilities
25492
- { id: "7zip", name: "7-Zip", category: "utilities", about: "Archive manager (7z, zip, rar, tar ...). Also unpacks installers for other apps.", size: "2 MB", source: { resolve: "7zip" }, exe: "7zFM.exe" },
25493
- { id: "winmerge", name: "WinMerge", category: "utilities", about: "Compare and merge files and folders.", size: "23 MB", source: gh("WinMerge/winmerge", "^winmerge-[\\d.]+-x64-exe\\.zip$"), exe: "WinMergeU.exe" },
25494
- { id: "everything", name: "Everything", category: "utilities", about: "Finds files by name instantly.", size: "2 MB", source: { resolve: "everything" }, exe: "Everything.exe" },
25495
- { id: "sysinternals", name: "Sysinternals Suite", category: "utilities", about: "Process Explorer, Process Monitor, Autoruns, TCPView and more (on PATH).", size: "200 MB", source: { url: "https://download.sysinternals.com/files/SysinternalsSuite.zip" }, exe: "procexp64.exe" },
25496
- { id: "imhex", name: "ImHex", category: "utilities", about: "Hex editor for reverse engineering and binary formats.", size: "80 MB", source: gh("WerWolv/ImHex", "^imhex-[\\d.]+-Windows-Portable-NoGPU-x86_64\\.zip$"), exe: "imhex-gui.exe" },
25805
+ {
25806
+ id: "7zip",
25807
+ name: "7-Zip",
25808
+ category: "utilities",
25809
+ about: "Archive manager (7z, zip, rar, tar ...). Also unpacks installers for other apps.",
25810
+ size: "2 MB",
25811
+ source: { resolve: "7zip" },
25812
+ exe: "7zFM.exe"
25813
+ },
25814
+ {
25815
+ id: "winmerge",
25816
+ name: "WinMerge",
25817
+ category: "utilities",
25818
+ about: "Compare and merge files and folders.",
25819
+ size: "23 MB",
25820
+ source: gh("WinMerge/winmerge", "^winmerge-[\\d.]+-x64-exe\\.zip$"),
25821
+ exe: "WinMergeU.exe"
25822
+ },
25823
+ {
25824
+ id: "everything",
25825
+ name: "Everything",
25826
+ category: "utilities",
25827
+ about: "Finds files by name instantly.",
25828
+ size: "2 MB",
25829
+ source: { resolve: "everything" },
25830
+ exe: "Everything.exe"
25831
+ },
25832
+ {
25833
+ id: "sysinternals",
25834
+ name: "Sysinternals Suite",
25835
+ category: "utilities",
25836
+ about: "Process Explorer, Process Monitor, Autoruns, TCPView and more (on PATH).",
25837
+ size: "200 MB",
25838
+ source: { url: "https://download.sysinternals.com/files/SysinternalsSuite.zip" },
25839
+ exe: "procexp64.exe"
25840
+ },
25841
+ {
25842
+ id: "imhex",
25843
+ name: "ImHex",
25844
+ category: "utilities",
25845
+ about: "Hex editor for reverse engineering and binary formats.",
25846
+ size: "80 MB",
25847
+ source: gh("WerWolv/ImHex", "^imhex-[\\d.]+-Windows-Portable-NoGPU-x86_64\\.zip$"),
25848
+ exe: "imhex-gui.exe"
25849
+ },
25497
25850
  // ---- browsers
25498
- { id: "chrome", name: "Chrome for Testing", category: "browsers", about: "Chrome build made for automated tests (with chromedriver on PATH).", size: "170 MB", source: { resolve: "chrome" }, exe: "chrome.exe" },
25499
- { id: "firefox", name: "Firefox", category: "browsers", about: "Firefox for testing.", size: "75 MB", source: { resolve: "firefox" }, unpack: "nsis", exe: "firefox.exe", needs: ["7zip"] },
25851
+ {
25852
+ id: "chrome",
25853
+ name: "Chrome for Testing",
25854
+ category: "browsers",
25855
+ about: "Chrome build made for automated tests (with chromedriver on PATH).",
25856
+ size: "170 MB",
25857
+ source: { resolve: "chrome" },
25858
+ exe: "chrome.exe"
25859
+ },
25860
+ {
25861
+ id: "firefox",
25862
+ name: "Firefox",
25863
+ category: "browsers",
25864
+ about: "Firefox for testing.",
25865
+ size: "75 MB",
25866
+ source: { resolve: "firefox" },
25867
+ unpack: "nsis",
25868
+ exe: "firefox.exe",
25869
+ needs: ["7zip"]
25870
+ },
25500
25871
  // ---- game development
25501
- { id: "godot", name: "Godot", category: "gamedev", about: "Open-source 2D and 3D game engine.", size: "80 MB", source: gh("godotengine/godot", "^Godot_v[\\d.]+-stable_win64\\.exe\\.zip$"), exe: "/^Godot_v[\\d.]+-stable_win64\\.exe$/", needs: ["mesa"] },
25502
- { id: "blender", name: "Blender", category: "gamedev", about: "3D modelling, animation and rendering.", size: "400 MB", source: { resolve: "blender" }, exe: "blender.exe", needs: ["mesa"] },
25503
- { id: "love", name: "L\xD6VE", category: "gamedev", about: "Lua framework for 2D games.", size: "4 MB", source: gh("love2d/love", "^love-[\\d.]+-win64\\.zip$"), exe: "love.exe", needs: ["mesa"] },
25504
- { id: "defold", name: "Defold", category: "gamedev", about: "Free 2D/3D game engine and editor.", size: "330 MB", source: gh("defold/defold", "^Defold-x86_64-win32\\.zip$"), exe: "Defold.exe", needs: ["mesa"] },
25505
- { id: "pixelorama", name: "Pixelorama", category: "gamedev", about: "Pixel-art and sprite editor.", size: "40 MB", source: gh("Orama-Interactive/Pixelorama", "^Pixelorama-Windows-64bit\\.zip$"), exe: "Pixelorama.exe", needs: ["mesa"] },
25506
- { id: "tiled", name: "Tiled", category: "gamedev", about: "Tile map editor.", size: "22 MB", source: gh("mapeditor/tiled", "^Tiled-[\\d.]+_Windows-10\\+_x86_64\\.msi$"), unpack: "msi", exe: "tiled.exe" },
25872
+ {
25873
+ id: "godot",
25874
+ name: "Godot",
25875
+ category: "gamedev",
25876
+ about: "Open-source 2D and 3D game engine.",
25877
+ size: "80 MB",
25878
+ source: gh("godotengine/godot", "^Godot_v[\\d.]+-stable_win64\\.exe\\.zip$"),
25879
+ exe: "/^Godot_v[\\d.]+-stable_win64\\.exe$/",
25880
+ needs: ["mesa"]
25881
+ },
25882
+ {
25883
+ id: "blender",
25884
+ name: "Blender",
25885
+ category: "gamedev",
25886
+ about: "3D modelling, animation and rendering.",
25887
+ size: "400 MB",
25888
+ source: { resolve: "blender" },
25889
+ exe: "blender.exe",
25890
+ needs: ["mesa"]
25891
+ },
25892
+ {
25893
+ id: "love",
25894
+ name: "L\xD6VE",
25895
+ category: "gamedev",
25896
+ about: "Lua framework for 2D games.",
25897
+ size: "4 MB",
25898
+ source: gh("love2d/love", "^love-[\\d.]+-win64\\.zip$"),
25899
+ exe: "love.exe",
25900
+ needs: ["mesa"]
25901
+ },
25902
+ {
25903
+ id: "defold",
25904
+ name: "Defold",
25905
+ category: "gamedev",
25906
+ about: "Free 2D/3D game engine and editor.",
25907
+ size: "330 MB",
25908
+ source: gh("defold/defold", "^Defold-x86_64-win32\\.zip$"),
25909
+ exe: "Defold.exe",
25910
+ needs: ["mesa"]
25911
+ },
25912
+ {
25913
+ id: "pixelorama",
25914
+ name: "Pixelorama",
25915
+ category: "gamedev",
25916
+ about: "Pixel-art and sprite editor.",
25917
+ size: "40 MB",
25918
+ source: gh("Orama-Interactive/Pixelorama", "^Pixelorama-Windows-64bit\\.zip$"),
25919
+ exe: "Pixelorama.exe",
25920
+ needs: ["mesa"]
25921
+ },
25922
+ {
25923
+ id: "tiled",
25924
+ name: "Tiled",
25925
+ category: "gamedev",
25926
+ about: "Tile map editor.",
25927
+ size: "22 MB",
25928
+ source: gh("mapeditor/tiled", "^Tiled-[\\d.]+_Windows-10\\+_x86_64\\.msi$"),
25929
+ unpack: "msi",
25930
+ exe: "tiled.exe"
25931
+ },
25507
25932
  // ---- cloud
25508
- { id: "kubectl", name: "kubectl", category: "cloud", about: "Kubernetes command line.", size: "60 MB", source: { resolve: "kubectl" }, unpack: "file", exe: "kubectl.exe", cli: true },
25509
- { id: "helm", name: "Helm", category: "cloud", about: "Kubernetes package manager.", size: "20 MB", source: { resolve: "helm" }, exe: "helm.exe", cli: true },
25510
- { id: "k9s", name: "k9s", category: "cloud", about: "Kubernetes cluster UI in the terminal.", size: "40 MB", source: gh("derailed/k9s", "^k9s_Windows_amd64\\.zip$"), exe: "k9s.exe", cli: true },
25511
- { id: "terraform", name: "Terraform", category: "cloud", about: "Infrastructure as code.", size: "30 MB", source: { resolve: "terraform" }, exe: "terraform.exe", cli: true },
25512
- { id: "azure-cli", name: "Azure CLI", category: "cloud", about: "Manage Azure (az).", size: "90 MB", source: { url: "https://aka.ms/installazurecliwindowszipx64" }, exe: "az.cmd", cli: true },
25513
- { id: "gcloud", name: "Google Cloud CLI", category: "cloud", about: "Manage Google Cloud (gcloud, gsutil, bq).", size: "120 MB", source: { url: "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-windows-x86_64-bundled-python.zip" }, exe: "gcloud.cmd", cli: true },
25514
- { id: "aws-cli", name: "AWS CLI", category: "cloud", about: "Manage AWS (aws).", size: "50 MB", source: { url: "https://awscli.amazonaws.com/AWSCLIV2.msi" }, unpack: "msi", exe: "aws.exe", cli: true },
25933
+ {
25934
+ id: "kubectl",
25935
+ name: "kubectl",
25936
+ category: "cloud",
25937
+ about: "Kubernetes command line.",
25938
+ size: "60 MB",
25939
+ source: { resolve: "kubectl" },
25940
+ unpack: "file",
25941
+ exe: "kubectl.exe",
25942
+ cli: true
25943
+ },
25944
+ {
25945
+ id: "helm",
25946
+ name: "Helm",
25947
+ category: "cloud",
25948
+ about: "Kubernetes package manager.",
25949
+ size: "20 MB",
25950
+ source: { resolve: "helm" },
25951
+ exe: "helm.exe",
25952
+ cli: true
25953
+ },
25954
+ {
25955
+ id: "k9s",
25956
+ name: "k9s",
25957
+ category: "cloud",
25958
+ about: "Kubernetes cluster UI in the terminal.",
25959
+ size: "40 MB",
25960
+ source: gh("derailed/k9s", "^k9s_Windows_amd64\\.zip$"),
25961
+ exe: "k9s.exe",
25962
+ cli: true
25963
+ },
25964
+ {
25965
+ id: "terraform",
25966
+ name: "Terraform",
25967
+ category: "cloud",
25968
+ about: "Infrastructure as code.",
25969
+ size: "30 MB",
25970
+ source: { resolve: "terraform" },
25971
+ exe: "terraform.exe",
25972
+ cli: true
25973
+ },
25974
+ {
25975
+ id: "azure-cli",
25976
+ name: "Azure CLI",
25977
+ category: "cloud",
25978
+ about: "Manage Azure (az).",
25979
+ size: "90 MB",
25980
+ source: { url: "https://aka.ms/installazurecliwindowszipx64" },
25981
+ exe: "az.cmd",
25982
+ cli: true
25983
+ },
25984
+ {
25985
+ id: "gcloud",
25986
+ name: "Google Cloud CLI",
25987
+ category: "cloud",
25988
+ about: "Manage Google Cloud (gcloud, gsutil, bq).",
25989
+ size: "120 MB",
25990
+ source: {
25991
+ url: "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-windows-x86_64-bundled-python.zip"
25992
+ },
25993
+ exe: "gcloud.cmd",
25994
+ cli: true
25995
+ },
25996
+ {
25997
+ id: "aws-cli",
25998
+ name: "AWS CLI",
25999
+ category: "cloud",
26000
+ about: "Manage AWS (aws).",
26001
+ size: "50 MB",
26002
+ source: { url: "https://awscli.amazonaws.com/AWSCLIV2.msi" },
26003
+ unpack: "msi",
26004
+ exe: "aws.exe",
26005
+ cli: true
26006
+ },
25515
26007
  // ---- diagrams and docs
25516
- { id: "drawio", name: "draw.io", category: "diagrams", about: "Diagram editor (flowcharts, architecture, UML).", size: "170 MB", source: gh("jgraph/drawio-desktop", "^draw\\.io-[\\d.]+-windows\\.zip$"), exe: "draw.io.exe" },
25517
- { id: "pandoc", name: "Pandoc", category: "diagrams", about: "Convert documents between Markdown, HTML, Word, PDF ...", size: "35 MB", source: gh("jgm/pandoc", "^pandoc-[\\d.]+-windows-x86_64\\.zip$"), exe: "pandoc.exe", cli: true },
26008
+ {
26009
+ id: "drawio",
26010
+ name: "draw.io",
26011
+ category: "diagrams",
26012
+ about: "Diagram editor (flowcharts, architecture, UML).",
26013
+ size: "170 MB",
26014
+ source: gh("jgraph/drawio-desktop", "^draw\\.io-[\\d.]+-windows\\.zip$"),
26015
+ exe: "draw.io.exe"
26016
+ },
26017
+ {
26018
+ id: "pandoc",
26019
+ name: "Pandoc",
26020
+ category: "diagrams",
26021
+ about: "Convert documents between Markdown, HTML, Word, PDF ...",
26022
+ size: "35 MB",
26023
+ source: gh("jgm/pandoc", "^pandoc-[\\d.]+-windows-x86_64\\.zip$"),
26024
+ exe: "pandoc.exe",
26025
+ cli: true
26026
+ },
25518
26027
  // ---- network
25519
- { id: "mitmproxy", name: "mitmproxy", category: "network", about: "Intercepting HTTPS proxy (mitmweb opens a web UI).", size: "90 MB", source: { resolve: "mitmproxy" }, exe: "mitmweb.exe", cli: true },
25520
- { id: "xh", name: "xh", category: "network", about: "Friendly HTTP requests from the terminal (like HTTPie).", size: "5 MB", source: gh("ducaale/xh", "^xh-v[\\d.]+-x86_64-pc-windows-msvc\\.zip$"), exe: "xh.exe", cli: true },
25521
- { id: "grpcurl", name: "grpcurl", category: "network", about: "curl for gRPC servers.", size: "10 MB", source: gh("fullstorydev/grpcurl", "^grpcurl_[\\d.]+_windows_x86_64\\.zip$"), exe: "grpcurl.exe", cli: true },
25522
- { id: "k6", name: "k6", category: "network", about: "Load testing with JavaScript scripts.", size: "30 MB", source: gh("grafana/k6", "^k6-v[\\d.]+-windows-amd64\\.zip$"), exe: "k6.exe", cli: true },
26028
+ {
26029
+ id: "mitmproxy",
26030
+ name: "mitmproxy",
26031
+ category: "network",
26032
+ about: "Intercepting HTTPS proxy (mitmweb opens a web UI).",
26033
+ size: "90 MB",
26034
+ source: { resolve: "mitmproxy" },
26035
+ exe: "mitmweb.exe",
26036
+ cli: true
26037
+ },
26038
+ {
26039
+ id: "xh",
26040
+ name: "xh",
26041
+ category: "network",
26042
+ about: "Friendly HTTP requests from the terminal (like HTTPie).",
26043
+ size: "5 MB",
26044
+ source: gh("ducaale/xh", "^xh-v[\\d.]+-x86_64-pc-windows-msvc\\.zip$"),
26045
+ exe: "xh.exe",
26046
+ cli: true
26047
+ },
26048
+ {
26049
+ id: "grpcurl",
26050
+ name: "grpcurl",
26051
+ category: "network",
26052
+ about: "curl for gRPC servers.",
26053
+ size: "10 MB",
26054
+ source: gh("fullstorydev/grpcurl", "^grpcurl_[\\d.]+_windows_x86_64\\.zip$"),
26055
+ exe: "grpcurl.exe",
26056
+ cli: true
26057
+ },
26058
+ {
26059
+ id: "k6",
26060
+ name: "k6",
26061
+ category: "network",
26062
+ about: "Load testing with JavaScript scripts.",
26063
+ size: "30 MB",
26064
+ source: gh("grafana/k6", "^k6-v[\\d.]+-windows-amd64\\.zip$"),
26065
+ exe: "k6.exe",
26066
+ cli: true
26067
+ },
26068
+ // ---- reverse engineering
26069
+ {
26070
+ id: "rea",
26071
+ name: "REA (Reverse Engineer Anything)",
26072
+ category: "reversing",
26073
+ about: "Agent-driven reverse engineering (MCP server and CLI, by morluto). Run `rea setup` once to add it to Claude Code and Codex. Native binaries need Ghidra; needs Node 22.19+.",
26074
+ size: "8 MB",
26075
+ source: { npm: "rea-agents" },
26076
+ exe: "rea.cmd",
26077
+ cli: true
26078
+ },
26079
+ {
26080
+ id: "ghidra",
26081
+ name: "Ghidra",
26082
+ category: "reversing",
26083
+ about: "NSA's reverse-engineering suite: disassembler and decompiler. Needs Java 21 (toolchains.java).",
26084
+ size: "570 MB",
26085
+ source: gh("NationalSecurityAgency/ghidra", "^ghidra_[\\d.]+_PUBLIC_[\\d]+\\.zip$"),
26086
+ exe: "ghidraRun.bat"
26087
+ },
26088
+ {
26089
+ id: "x64dbg",
26090
+ name: "x64dbg",
26091
+ category: "reversing",
26092
+ about: "Debugger for 64- and 32-bit Windows programs.",
26093
+ size: "32 MB",
26094
+ source: gh("x64dbg/x64dbg", "^snapshot_[\\d_-]+\\.zip$"),
26095
+ exe: "/^x64dbg\\.exe$/"
26096
+ },
26097
+ {
26098
+ id: "ilspy",
26099
+ name: "ILSpy",
26100
+ category: "reversing",
26101
+ about: ".NET decompiler.",
26102
+ size: "55 MB",
26103
+ source: gh("icsharpcode/ILSpy", "^ILSpy_windows_selfcontained_[\\d.]+-x64\\.zip$"),
26104
+ exe: "ILSpy.exe"
26105
+ },
26106
+ {
26107
+ id: "dnspy",
26108
+ name: "dnSpyEx",
26109
+ category: "reversing",
26110
+ about: ".NET debugger and assembly editor.",
26111
+ size: "100 MB",
26112
+ source: gh("dnSpyEx/dnSpy", "^dnSpy-net-win64\\.zip$"),
26113
+ exe: "dnSpy.exe"
26114
+ },
26115
+ {
26116
+ id: "die",
26117
+ name: "Detect It Easy",
26118
+ category: "reversing",
26119
+ about: "Identifies file types, compilers and packers.",
26120
+ size: "25 MB",
26121
+ source: gh("horsicq/DIE-engine", "^die_win64_portable_[\\d.]+_x64\\.zip$"),
26122
+ exe: "die.exe"
26123
+ },
26124
+ {
26125
+ id: "pe-bear",
26126
+ name: "PE-bear",
26127
+ category: "reversing",
26128
+ about: "Views and edits Windows executables (PE files).",
26129
+ size: "12 MB",
26130
+ source: gh("hasherezade/pe-bear", "^PE-bear_[\\d.]+_qt6_x64_win_vs22\\.zip$"),
26131
+ exe: "PE-bear.exe"
26132
+ },
26133
+ {
26134
+ id: "cutter",
26135
+ name: "Cutter",
26136
+ category: "reversing",
26137
+ about: "Reverse-engineering GUI built on rizin.",
26138
+ size: "141 MB",
26139
+ source: gh("rizinorg/cutter", "^Cutter-v[\\d.]+-Windows-x86_64\\.zip$"),
26140
+ exe: "cutter.exe"
26141
+ },
26142
+ {
26143
+ id: "radare2",
26144
+ name: "radare2",
26145
+ category: "reversing",
26146
+ about: "Command-line reverse-engineering framework (r2).",
26147
+ size: "14 MB",
26148
+ source: gh("radareorg/radare2", "^radare2-[\\d.]+-w64\\.zip$"),
26149
+ exe: "radare2.exe",
26150
+ cli: true
26151
+ },
26152
+ {
26153
+ id: "jadx",
26154
+ name: "JADX",
26155
+ category: "reversing",
26156
+ about: "Android APK and DEX decompiler.",
26157
+ size: "99 MB",
26158
+ source: gh("skylot/jadx", "^jadx-gui-[\\d.]+-with-jre-win\\.zip$"),
26159
+ exe: "jadx-gui.exe"
26160
+ },
26161
+ {
26162
+ id: "system-informer",
26163
+ name: "System Informer",
26164
+ category: "reversing",
26165
+ about: "Process, service and network monitor (Process Hacker's successor).",
26166
+ size: "22 MB",
26167
+ source: gh("winsiderss/systeminformer", "^systeminformer-[\\d.]+-bin\\.zip$"),
26168
+ exe: "SystemInformer.exe"
26169
+ },
25523
26170
  // ---- command-line tools
25524
- { id: "jq", name: "jq", category: "cli", about: "Query and reshape JSON.", size: "1 MB", source: gh("jqlang/jq", "^jq-windows-amd64\\.exe$"), unpack: "file", exe: "jq.exe", cli: true },
25525
- { id: "yq", name: "yq", category: "cli", about: "Query and edit YAML, JSON, XML and TOML.", size: "10 MB", source: gh("mikefarah/yq", "^yq_windows_amd64\\.exe$"), unpack: "file", exe: "yq.exe", cli: true },
25526
- { id: "ripgrep", name: "ripgrep", category: "cli", about: "Very fast recursive search (rg).", size: "2 MB", source: gh("BurntSushi/ripgrep", "^ripgrep-[\\d.]+-x86_64-pc-windows-msvc\\.zip$"), exe: "rg.exe", cli: true },
25527
- { id: "fd", name: "fd", category: "cli", about: "Fast, friendly alternative to find.", size: "2 MB", source: gh("sharkdp/fd", "^fd-v[\\d.]+-x86_64-pc-windows-msvc\\.zip$"), exe: "fd.exe", cli: true },
25528
- { id: "bat", name: "bat", category: "cli", about: "cat with syntax highlighting and git changes.", size: "3 MB", source: gh("sharkdp/bat", "^bat-v[\\d.]+-x86_64-pc-windows-msvc\\.zip$"), exe: "bat.exe", cli: true },
25529
- { id: "fzf", name: "fzf", category: "cli", about: "Fuzzy finder for the terminal.", size: "2 MB", source: gh("junegunn/fzf", "^fzf-[\\d.]+-windows_amd64\\.zip$"), exe: "fzf.exe", cli: true },
25530
- { id: "delta", name: "delta", category: "cli", about: "Readable git diffs with syntax highlighting.", size: "3 MB", source: gh("dandavison/delta", "^delta-[\\d.]+-x86_64-pc-windows-msvc\\.zip$"), exe: "delta.exe", cli: true },
25531
- { id: "just", name: "just", category: "cli", about: "Command runner (a simpler make for project tasks).", size: "2 MB", source: gh("casey/just", "^just-[\\d.]+-x86_64-pc-windows-msvc\\.zip$"), exe: "just.exe", cli: true },
25532
- { id: "hyperfine", name: "hyperfine", category: "cli", about: "Benchmark commands.", size: "1 MB", source: gh("sharkdp/hyperfine", "^hyperfine-v[\\d.]+-x86_64-pc-windows-msvc\\.zip$"), exe: "hyperfine.exe", cli: true },
25533
- { id: "watchexec", name: "watchexec", category: "cli", about: "Run a command when files change.", size: "5 MB", source: gh("watchexec/watchexec", "^watchexec-[\\d.]+-x86_64-pc-windows-msvc\\.zip$"), exe: "watchexec.exe", cli: true },
25534
- { id: "protoc", name: "protoc", category: "cli", about: "Protocol Buffers compiler.", size: "3 MB", source: gh("protocolbuffers/protobuf", "^protoc-[\\d.]+-win64\\.zip$"), exe: "protoc.exe", cli: true },
25535
- { id: "ninja", name: "Ninja", category: "cli", about: "Small, fast build system (CMake's favourite generator).", size: "1 MB", source: gh("ninja-build/ninja", "^ninja-win\\.zip$"), exe: "ninja.exe", cli: true },
25536
- { id: "ffmpeg", name: "FFmpeg", category: "cli", about: "Convert and process audio and video.", size: "200 MB", source: gh("BtbN/FFmpeg-Builds", "^ffmpeg-master-latest-win64-gpl\\.zip$"), exe: "ffmpeg.exe", cli: true },
25537
- { id: "sqlite", name: "SQLite tools", category: "cli", about: "sqlite3 command-line shell.", size: "5 MB", source: { resolve: "sqlite" }, exe: "sqlite3.exe", cli: true },
25538
- { id: "shellcheck", name: "ShellCheck", category: "cli", about: "Finds bugs in shell scripts.", size: "10 MB", source: gh("koalaman/shellcheck", "^shellcheck-v[\\d.]+\\.zip$"), exe: "shellcheck.exe", cli: true },
25539
- { id: "gitleaks", name: "Gitleaks", category: "cli", about: "Finds secrets committed to git.", size: "8 MB", source: gh("gitleaks/gitleaks", "^gitleaks_[\\d.]+_windows_x64\\.zip$"), exe: "gitleaks.exe", cli: true }
26171
+ {
26172
+ id: "jq",
26173
+ name: "jq",
26174
+ category: "cli",
26175
+ about: "Query and reshape JSON.",
26176
+ size: "1 MB",
26177
+ source: gh("jqlang/jq", "^jq-windows-amd64\\.exe$"),
26178
+ unpack: "file",
26179
+ exe: "jq.exe",
26180
+ cli: true
26181
+ },
26182
+ {
26183
+ id: "yq",
26184
+ name: "yq",
26185
+ category: "cli",
26186
+ about: "Query and edit YAML, JSON, XML and TOML.",
26187
+ size: "10 MB",
26188
+ source: gh("mikefarah/yq", "^yq_windows_amd64\\.exe$"),
26189
+ unpack: "file",
26190
+ exe: "yq.exe",
26191
+ cli: true
26192
+ },
26193
+ {
26194
+ id: "ripgrep",
26195
+ name: "ripgrep",
26196
+ category: "cli",
26197
+ about: "Very fast recursive search (rg).",
26198
+ size: "2 MB",
26199
+ source: gh("BurntSushi/ripgrep", "^ripgrep-[\\d.]+-x86_64-pc-windows-msvc\\.zip$"),
26200
+ exe: "rg.exe",
26201
+ cli: true
26202
+ },
26203
+ {
26204
+ id: "fd",
26205
+ name: "fd",
26206
+ category: "cli",
26207
+ about: "Fast, friendly alternative to find.",
26208
+ size: "2 MB",
26209
+ source: gh("sharkdp/fd", "^fd-v[\\d.]+-x86_64-pc-windows-msvc\\.zip$"),
26210
+ exe: "fd.exe",
26211
+ cli: true
26212
+ },
26213
+ {
26214
+ id: "bat",
26215
+ name: "bat",
26216
+ category: "cli",
26217
+ about: "cat with syntax highlighting and git changes.",
26218
+ size: "3 MB",
26219
+ source: gh("sharkdp/bat", "^bat-v[\\d.]+-x86_64-pc-windows-msvc\\.zip$"),
26220
+ exe: "bat.exe",
26221
+ cli: true
26222
+ },
26223
+ {
26224
+ id: "fzf",
26225
+ name: "fzf",
26226
+ category: "cli",
26227
+ about: "Fuzzy finder for the terminal.",
26228
+ size: "2 MB",
26229
+ source: gh("junegunn/fzf", "^fzf-[\\d.]+-windows_amd64\\.zip$"),
26230
+ exe: "fzf.exe",
26231
+ cli: true
26232
+ },
26233
+ {
26234
+ id: "delta",
26235
+ name: "delta",
26236
+ category: "cli",
26237
+ about: "Readable git diffs with syntax highlighting.",
26238
+ size: "3 MB",
26239
+ source: gh("dandavison/delta", "^delta-[\\d.]+-x86_64-pc-windows-msvc\\.zip$"),
26240
+ exe: "delta.exe",
26241
+ cli: true
26242
+ },
26243
+ {
26244
+ id: "just",
26245
+ name: "just",
26246
+ category: "cli",
26247
+ about: "Command runner (a simpler make for project tasks).",
26248
+ size: "2 MB",
26249
+ source: gh("casey/just", "^just-[\\d.]+-x86_64-pc-windows-msvc\\.zip$"),
26250
+ exe: "just.exe",
26251
+ cli: true
26252
+ },
26253
+ {
26254
+ id: "hyperfine",
26255
+ name: "hyperfine",
26256
+ category: "cli",
26257
+ about: "Benchmark commands.",
26258
+ size: "1 MB",
26259
+ source: gh("sharkdp/hyperfine", "^hyperfine-v[\\d.]+-x86_64-pc-windows-msvc\\.zip$"),
26260
+ exe: "hyperfine.exe",
26261
+ cli: true
26262
+ },
26263
+ {
26264
+ id: "watchexec",
26265
+ name: "watchexec",
26266
+ category: "cli",
26267
+ about: "Run a command when files change.",
26268
+ size: "5 MB",
26269
+ source: gh("watchexec/watchexec", "^watchexec-[\\d.]+-x86_64-pc-windows-msvc\\.zip$"),
26270
+ exe: "watchexec.exe",
26271
+ cli: true
26272
+ },
26273
+ {
26274
+ id: "protoc",
26275
+ name: "protoc",
26276
+ category: "cli",
26277
+ about: "Protocol Buffers compiler.",
26278
+ size: "3 MB",
26279
+ source: gh("protocolbuffers/protobuf", "^protoc-[\\d.]+-win64\\.zip$"),
26280
+ exe: "protoc.exe",
26281
+ cli: true
26282
+ },
26283
+ {
26284
+ id: "ninja",
26285
+ name: "Ninja",
26286
+ category: "cli",
26287
+ about: "Small, fast build system (CMake's favourite generator).",
26288
+ size: "1 MB",
26289
+ source: gh("ninja-build/ninja", "^ninja-win\\.zip$"),
26290
+ exe: "ninja.exe",
26291
+ cli: true
26292
+ },
26293
+ {
26294
+ id: "ffmpeg",
26295
+ name: "FFmpeg",
26296
+ category: "cli",
26297
+ about: "Convert and process audio and video.",
26298
+ size: "200 MB",
26299
+ source: gh("BtbN/FFmpeg-Builds", "^ffmpeg-master-latest-win64-gpl\\.zip$"),
26300
+ exe: "ffmpeg.exe",
26301
+ cli: true
26302
+ },
26303
+ {
26304
+ id: "sqlite",
26305
+ name: "SQLite tools",
26306
+ category: "cli",
26307
+ about: "sqlite3 command-line shell.",
26308
+ size: "5 MB",
26309
+ source: { resolve: "sqlite" },
26310
+ exe: "sqlite3.exe",
26311
+ cli: true
26312
+ },
26313
+ {
26314
+ id: "shellcheck",
26315
+ name: "ShellCheck",
26316
+ category: "cli",
26317
+ about: "Finds bugs in shell scripts.",
26318
+ size: "10 MB",
26319
+ source: gh("koalaman/shellcheck", "^shellcheck-v[\\d.]+\\.zip$"),
26320
+ exe: "shellcheck.exe",
26321
+ cli: true
26322
+ },
26323
+ {
26324
+ id: "gitleaks",
26325
+ name: "Gitleaks",
26326
+ category: "cli",
26327
+ about: "Finds secrets committed to git.",
26328
+ size: "8 MB",
26329
+ source: gh("gitleaks/gitleaks", "^gitleaks_[\\d.]+_windows_x64\\.zip$"),
26330
+ exe: "gitleaks.exe",
26331
+ cli: true
26332
+ }
25540
26333
  ];
25541
26334
 
25542
26335
  // src/core/schema/apps.ts
25543
26336
  var CATALOGUE_IDS = APPS.filter((a) => !a.setting).map((a) => a.id);
25544
- var AppId = external_exports.enum(CATALOGUE_IDS);
25545
- var CustomAppId = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,40}$/, "lower-case letters, digits and - only");
26337
+ var AppIdSchema = external_exports.enum(CATALOGUE_IDS);
26338
+ var CustomAppIdSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,40}$/, "lower-case letters, digits and - only");
25546
26339
  var compiles = (pattern) => {
25547
26340
  try {
25548
26341
  new RegExp(pattern);
@@ -25551,103 +26344,141 @@ var compiles = (pattern) => {
25551
26344
  return false;
25552
26345
  }
25553
26346
  };
25554
- var CustomApp = external_exports.strictObject({
26347
+ var CustomAppSchema = external_exports.strictObject({
25555
26348
  name: external_exports.string().min(1).max(80).describe('The name on the desktop shortcut, e.g. "My Tool".'),
25556
26349
  github: external_exports.string().regex(/^[\w.-]+\/[\w.-]+$/, "owner/repo, e.g. sharkdp/bat").optional().describe("GitHub repository (owner/repo): the file comes from its latest release."),
25557
26350
  asset: external_exports.string().max(200).refine(compiles, "not a valid pattern").optional().describe("With github: a pattern (regular expression) matching the release file, e.g. windows.*x64\\.zip$"),
25558
26351
  url: external_exports.string().url().startsWith("https://", "https:// only").optional().describe("Or a direct https:// download link (zip, 7z, exe or msi)."),
25559
26352
  sha256: external_exports.string().regex(/^[0-9a-fA-F]{64}$/, "64 hex characters").optional().describe("SHA-256 of the download (GitHub releases usually publish one; then this is not needed)."),
25560
- unpack: external_exports.enum(["archive", "file", "nsis", "msi"]).optional().describe("archive (zip, 7z, tar: the default), file (a single .exe), nsis (an installer 7-Zip can open) or msi."),
26353
+ unpack: external_exports.enum(["archive", "file", "nsis", "msi"]).optional().describe(
26354
+ "archive (zip, 7z, tar: the default), file (a single .exe), nsis (an installer 7-Zip can open) or msi."
26355
+ ),
25561
26356
  exe: external_exports.string().min(1).max(200).describe("The program to start (found anywhere in the download), e.g. mytool.exe."),
25562
26357
  cli: external_exports.boolean().optional().describe("A command-line tool: its folder goes on PATH instead of getting a desktop shortcut.")
25563
- }).refine((a) => a.github && a.asset ? !a.url : Boolean(a.url) && !a.github && !a.asset, { message: "give github + asset, or url (not both)" });
25564
- var Apps = external_exports.strictObject({
25565
- install: external_exports.array(AppId).describe("Apps from the catalogue to install in every sandbox (the Apps screen in the menu lists them by category). Each is downloaded once and kept."),
25566
- custom: external_exports.record(CustomAppId, CustomApp).describe("Programs of your own: a GitHub release or a download link, and the program to start. Installed like the catalogue apps.")
26358
+ }).refine((a) => a.github && a.asset ? !a.url : Boolean(a.url) && !a.github && !a.asset, {
26359
+ message: "give github + asset, or url (not both)"
26360
+ });
26361
+ var AppsSchema = external_exports.strictObject({
26362
+ install: external_exports.array(AppIdSchema).describe(
26363
+ "Apps from the catalogue to install in every sandbox (the Apps screen in the menu lists them by category). Each is downloaded once and kept."
26364
+ ),
26365
+ custom: external_exports.record(CustomAppIdSchema, CustomAppSchema).describe(
26366
+ "Programs of your own: a GitHub release or a download link, and the program to start. Installed like the catalogue apps."
26367
+ )
25567
26368
  });
25568
26369
 
25569
26370
  // src/core/schema/projects.ts
25570
- var Projects = external_exports.strictObject({
25571
- all: external_exports.boolean().describe("Map every project you have started before (and every folder in your roots) at every start, except those in exclude, so all of them open in the running sandbox without a restart. Every agent in the sandbox can then see all of them. Each one is still only set up when you first use it."),
26371
+ var ProjectsSchema = external_exports.strictObject({
26372
+ all: external_exports.boolean().describe(
26373
+ "Map every project you have started before (and every folder in your roots) at every start, except those in exclude, so all of them open in the running sandbox without a restart. Every agent in the sandbox can then see all of them. Each one is still only set up when you first use it."
26374
+ ),
25572
26375
  exclude: external_exports.array(external_exports.string().min(1)).describe('Projects left out when "all" is on (folders on this PC).'),
25573
- roots: external_exports.array(external_exports.string().min(1)).describe('Folders whose subfolders are your projects (e.g. "F:\\\\Code"), mapped read/write at every start. Any project inside one, including ones you create later, opens in the running sandbox at once, without a restart. Every agent in the sandbox can see all of them.'),
26376
+ roots: external_exports.array(external_exports.string().min(1)).describe(
26377
+ 'Folders whose subfolders are your projects (e.g. "F:\\\\Code"), mapped read/write at every start. Any project inside one, including ones you create later, opens in the running sandbox at once, without a restart. Every agent in the sandbox can see all of them.'
26378
+ ),
25574
26379
  askToAddRoot: external_exports.boolean().describe("When you start a project whose parent folder is not a root yet, ask once whether to add it."),
25575
26380
  declinedRoots: external_exports.array(external_exports.string().min(1)).describe("Parent folders you said no to (not asked again)."),
25576
- allowOutsideMappings: external_exports.union([external_exports.literal("ask"), external_exports.boolean()]).describe(`A project's .sandbox-config.json may map folders from outside the project (e.g. a game folder on another drive). "ask" = an interactive launch asks once per project and set of folders, and remembers your answer; true = always allowed (still listed when you approve the file); false = never (the launch stops and says which folders). Only your own settings decide this, never a project file.`),
25577
- wsbShare: external_exports.boolean().describe("On Windows 11 24H2+ with the Windows Sandbox command line (wsb), add other folders to the running sandbox with `wsb share` (untested). Otherwise starting a project outside every root offers a restart.")
26381
+ allowOutsideMappings: external_exports.union([external_exports.literal("ask"), external_exports.boolean()]).describe(
26382
+ `A project's .sandbox-config.json may map folders from outside the project (e.g. a game folder on another drive). "ask" = an interactive launch asks once per project and set of folders, and remembers your answer; true = always allowed (still listed when you approve the file); false = never (the launch stops and says which folders). Only your own settings decide this, never a project file.`
26383
+ ),
26384
+ wsbShare: external_exports.boolean().describe(
26385
+ "On Windows 11 24H2+ with the Windows Sandbox command line (wsb), add other folders to the running sandbox with `wsb share` (untested). Otherwise starting a project outside every root offers a restart."
26386
+ )
25578
26387
  });
25579
26388
 
25580
26389
  // src/core/schema/config.ts
25581
- var Config = external_exports.strictObject({
25582
- $schema: SchemaRef.optional(),
25583
- defaultHarness: Name.describe("Agent started by `sandbox launch` (sandbox claude always runs claude)."),
25584
- guestWorkspace: GuestWorkspace,
26390
+ var ConfigSchema = external_exports.strictObject({
26391
+ $schema: SchemaRefSchema.optional(),
26392
+ defaultHarness: NameSchema.describe("Agent started by `sandbox launch` (sandbox claude always runs claude)."),
26393
+ guestWorkspace: GuestWorkspaceSchema,
25585
26394
  readOnly: external_exports.boolean().describe("Map the workspace read-only."),
25586
- workspaceFilter: WorkspaceFilter,
25587
- audit: Audit,
25588
- mappings: external_exports.array(Mapping).describe("Extra folders from this PC."),
25589
- sandbox: Sandbox,
26395
+ workspaceFilter: WorkspaceFilterSchema,
26396
+ audit: AuditSchema,
26397
+ mappings: external_exports.array(MappingSchema).describe("Extra folders from this PC."),
26398
+ sandbox: SandboxSchema,
25590
26399
  storage: external_exports.strictObject({
25591
26400
  root: external_exports.string().min(1).describe("Where everything is kept on this PC (tools, databases, logins, launches)."),
25592
26401
  persistAgentState: external_exports.boolean().describe("Keep agent logins and history between sandboxes."),
25593
- dataName: Name.describe("Name of the persistent data set (C:\\AgentData) shared by all workspaces."),
25594
- markSandboxFiles: external_exports.boolean().describe(`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.`),
25595
- warnDataGb: external_exports.number().min(0).describe("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.")
26402
+ dataName: NameSchema.describe("Name of the persistent data set (C:\\AgentData) shared by all workspaces."),
26403
+ markSandboxFiles: external_exports.boolean().describe(
26404
+ `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.`
26405
+ ),
26406
+ warnDataGb: external_exports.number().min(0).describe(
26407
+ "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."
26408
+ )
25596
26409
  }),
25597
- network: Network,
25598
- provisioning: Provisioning,
25599
- downloads: Downloads,
25600
- toolchains: Toolchains,
25601
- databases: Databases.describe("Databases running inside the sandbox. Data persists in C:\\AgentData\\databases; each one starts at boot."),
25602
- attach: Attach,
25603
- agentCommands: AgentCommands,
25604
- secrets: Secrets,
26410
+ network: NetworkSchema,
26411
+ provisioning: ProvisioningSchema,
26412
+ downloads: DownloadsSchema,
26413
+ toolchains: ToolchainsSchema,
26414
+ databases: DatabasesSchema.describe(
26415
+ "Databases running inside the sandbox. Data persists in C:\\AgentData\\databases; each one starts at boot."
26416
+ ),
26417
+ attach: AttachSchema,
26418
+ agentCommands: AgentCommandsSchema,
26419
+ secrets: SecretsSchema,
25605
26420
  personalization: toggle("Copy your desktop look (theme, accent, taskbar, wallpaper, ...) into the sandbox."),
25606
- apps: Apps,
25607
- claudeProfile: ClaudeProfile,
25608
- harnesses: external_exports.record(Name, Harness).describe("Agents that can run in the sandbox."),
26421
+ apps: AppsSchema,
26422
+ claudeProfile: ClaudeProfileSchema,
26423
+ harnesses: external_exports.record(NameSchema, HarnessSchema).describe("Agents that can run in the sandbox."),
25609
26424
  hooks: external_exports.strictObject({ failFast: external_exports.boolean().describe("Stop when a hook script fails.") }),
25610
- projects: Projects.describe("Several projects in one sandbox: folders of projects mapped at every start, and adding folders while it runs.")
25611
- }).refine((c) => c.harnesses[c.defaultHarness] !== void 0, { message: "defaultHarness must be one of the configured harnesses", path: ["defaultHarness"] });
25612
- var LocalOverrides = external_exports.strictObject({
25613
- $schema: SchemaRef,
25614
- harness: Name.describe("Agent for this project."),
25615
- guestWorkspace: GuestWorkspace,
26425
+ projects: ProjectsSchema.describe(
26426
+ "Several projects in one sandbox: folders of projects mapped at every start, and adding folders while it runs."
26427
+ )
26428
+ }).refine((c) => c.harnesses[c.defaultHarness] !== void 0, {
26429
+ message: "defaultHarness must be one of the configured harnesses",
26430
+ path: ["defaultHarness"]
26431
+ });
26432
+ var LocalOverridesSchema = external_exports.strictObject({
26433
+ $schema: SchemaRefSchema,
26434
+ harness: NameSchema.describe("Agent for this project."),
26435
+ guestWorkspace: GuestWorkspaceSchema,
25616
26436
  readOnly: external_exports.boolean().describe("Map this project read-only."),
25617
26437
  // A project may turn the filter on and keep more out, never let ignored files in.
25618
- workspaceFilter: WorkspaceFilter.pick({ enabled: true, exclude: true }).partial(),
25619
- mappings: external_exports.array(Mapping).describe("Extra folders (relative paths are relative to this file), e.g. a read-only data folder at another place in the sandbox. Folders outside the project are used only as your projects.allowOutsideMappings setting allows (by default you are asked once)."),
25620
- scripts: Strings.describe("Scripts (.ps1 / .mjs / .cmd, relative to this file) run inside the sandbox before the agent."),
26438
+ workspaceFilter: WorkspaceFilterSchema.pick({ enabled: true, exclude: true }).partial(),
26439
+ mappings: external_exports.array(MappingSchema).describe(
26440
+ "Extra folders (relative paths are relative to this file), e.g. a read-only data folder at another place in the sandbox. Folders outside the project are used only as your projects.allowOutsideMappings setting allows (by default you are asked once)."
26441
+ ),
26442
+ scripts: StringsSchema.describe(
26443
+ "Scripts (.ps1 / .mjs / .cmd, relative to this file) run inside the sandbox before the agent."
26444
+ ),
25621
26445
  // This PC's resources are yours to share: CPU and paging file (this PC's disk) are not a project's to set.
25622
- sandbox: Sandbox.omit({ cpuLimit: true, pageFileMb: true }).partial(),
26446
+ sandbox: SandboxSchema.omit({ cpuLimit: true, pageFileMb: true }).partial(),
25623
26447
  // A project may block more (the LAN, hosts); it never opens hosts, ports, DNS or a proxy.
25624
- network: Network.pick({ blockPrivateRanges: true, blockHosts: true }).partial(),
25625
- provisioning: Provisioning.pick({ copyFromHost: true, fallbackToInstall: true, refresh: true }).extend({ git: Git.partial(), terminal: toggle("Windows Terminal as the sandbox window.").partial() }).partial(),
25626
- downloads: Downloads.partial(),
26448
+ network: NetworkSchema.pick({ blockPrivateRanges: true, blockHosts: true }).partial(),
26449
+ provisioning: ProvisioningSchema.pick({ copyFromHost: true, fallbackToInstall: true, refresh: true }).extend({ git: GitSchema.partial(), terminal: toggle("Windows Terminal as the sandbox window.").partial() }).partial(),
26450
+ downloads: DownloadsSchema.partial(),
25627
26451
  // Every toolchain setting, each one optional (a project usually only switches languages on or pins a version).
25628
26452
  toolchains: external_exports.strictObject({
25629
- ...import_lodash.default.mapValues(import_lodash.default.omit(Toolchains.shape, "environment"), (shape) => shape.partial()),
25630
- environment: Toolchains.shape.environment
26453
+ ...import_lodash.default.mapValues(import_lodash.default.omit(ToolchainsSchema.shape, "environment"), (shape) => shape.partial()),
26454
+ environment: ToolchainsSchema.shape.environment
25631
26455
  }).partial(),
25632
- databases: external_exports.strictObject(import_lodash.default.mapValues(Databases.shape, (shape) => shape.partial())).partial(),
25633
- attach: Attach.partial(),
26456
+ databases: external_exports.strictObject(import_lodash.default.mapValues(DatabasesSchema.shape, (shape) => shape.partial())).partial(),
26457
+ attach: AttachSchema.partial(),
25634
26458
  personalization: toggle("Copy your desktop look into the sandbox.").partial(),
25635
- // Catalogue apps only (a vetted list): your own programs (apps.custom) download anything, so a repo cannot add them.
25636
- apps: Apps.pick({ install: true }).partial(),
25637
- claudeProfile: ClaudeProfile.pick({ enabled: true, overwrite: true, copyCredentials: true, syncHistory: true, syncClaudeMem: true }).partial(),
26459
+ // Catalogue apps only (a vetted list): your own programs (apps.custom) download anything, so a repo cannot add
26460
+ // them.
26461
+ apps: AppsSchema.pick({ install: true }).partial(),
26462
+ claudeProfile: ClaudeProfileSchema.pick({
26463
+ enabled: true,
26464
+ overwrite: true,
26465
+ copyCredentials: true,
26466
+ syncHistory: true,
26467
+ syncClaudeMem: true
26468
+ }).partial(),
25638
26469
  hooks: external_exports.strictObject({ failFast: external_exports.boolean() }).partial()
25639
26470
  }).partial();
25640
26471
 
25641
- // src/shared/schema.ts
25642
- var Id = external_exports.string().regex(/^[A-Za-z0-9_-]{1,64}$/, "invalid id");
26472
+ // src/shared/channel/schema.ts
26473
+ var IdSchema = external_exports.string().regex(/^[A-Za-z0-9_-]{1,64}$/, "invalid id");
25643
26474
  var Text = (max = 4096) => external_exports.string().max(max);
25644
- var Time = Text(64);
25645
- var AttachEndpoint = external_exports.strictObject({
26475
+ var TimeSchema = Text(64);
26476
+ var AttachEndpointSchema = external_exports.strictObject({
25646
26477
  addresses: external_exports.array(Text(64)).max(16),
25647
26478
  port: external_exports.number().int().min(1024).max(65535),
25648
26479
  token: Text(256)
25649
26480
  });
25650
- var BootProgress = external_exports.strictObject({
26481
+ var BootProgressSchema = external_exports.strictObject({
25651
26482
  step: external_exports.number().int().min(1).max(32),
25652
26483
  steps: external_exports.number().int().min(1).max(32),
25653
26484
  title: Text(120),
@@ -25656,60 +26487,82 @@ var BootProgress = external_exports.strictObject({
25656
26487
  done: external_exports.number().int().min(0).max(1e3),
25657
26488
  total: external_exports.number().int().min(0).max(1e3)
25658
26489
  });
25659
- var SandboxStatus = external_exports.object({
26490
+ var SandboxStatusSchema = external_exports.object({
25660
26491
  launchId: Text(64),
25661
26492
  phase: external_exports.enum(["booting", "provisioning", "ready", "failed"]),
25662
26493
  message: Text(),
25663
- updatedAt: Time,
26494
+ updatedAt: TimeSchema,
25664
26495
  workspaceHost: Text(),
25665
26496
  guestWorkspace: Text(),
25666
26497
  headless: external_exports.boolean(),
25667
26498
  /** The sandbox's IPv4 addresses (for network.forwardPorts; the host only uses ones on its Hyper-V network). */
25668
26499
  addresses: external_exports.array(external_exports.string().max(45)).max(8).optional(),
25669
26500
  /** A malformed progress is dropped, never the status (the phase still counts). */
25670
- progress: BootProgress.optional().catch(void 0)
26501
+ progress: BootProgressSchema.optional().catch(void 0)
25671
26502
  });
25672
- var Version = external_exports.strictObject({ spec: Text(128), source: Text(256) });
25673
- var DatabasePlan = external_exports.strictObject({
26503
+ var VersionSchema = external_exports.strictObject({ spec: Text(128), source: Text(256) });
26504
+ var DatabasePlanSchema = external_exports.strictObject({
25674
26505
  database: external_exports.enum(["postgres", "mysql", "sqlserver", "mongodb", "redis", "dynamodb"]),
25675
26506
  reasons: external_exports.array(Text(1024)).max(32),
25676
26507
  version: Text(64),
25677
26508
  port: external_exports.number().int().min(1024).max(65535),
25678
26509
  adminPort: external_exports.number().int().min(1024).max(65535).optional()
25679
26510
  });
25680
- var ProjectSpec = external_exports.strictObject({
25681
- name: Id,
26511
+ var ProjectSpecSchema = external_exports.strictObject({
26512
+ name: IdSchema,
25682
26513
  /** Inside the sandbox: C:\Projects\<name>. */
25683
26514
  workspace: Text(1024),
25684
26515
  workspaceHost: Text(1024),
25685
- toolchains: Toolchains,
25686
- versions: external_exports.strictObject({ node: Version, nodeExtra: external_exports.array(Text(128)).max(16), python: Version }),
25687
- databases: external_exports.array(DatabasePlan).max(8),
26516
+ toolchains: ToolchainsSchema,
26517
+ versions: external_exports.strictObject({ node: VersionSchema, nodeExtra: external_exports.array(Text(128)).max(16), python: VersionSchema }),
26518
+ databases: external_exports.array(DatabasePlanSchema).max(8),
25688
26519
  /** Agents this project may start that the sandbox did not boot with (its .sandbox-config.json "harness"). */
25689
- harnesses: external_exports.record(Text(64), Harness).refine((h) => Object.keys(h).length <= 8, "at most 8 agents"),
26520
+ harnesses: external_exports.record(Text(64), HarnessSchema).refine((h) => Object.keys(h).length <= 8, "at most 8 agents"),
25690
26521
  /** Its hooks were staged in C:\AgentLaunch\projects\<name>\hooks. */
25691
26522
  hooks: external_exports.boolean()
25692
26523
  });
25693
- var GuestRequest = external_exports.discriminatedUnion("kind", [
25694
- external_exports.strictObject({ kind: external_exports.literal("session"), id: Id, harness: Text(64), args: external_exports.array(Text()).max(256), cwd: Text(), project: ProjectSpec.optional(), harnessSpec: Harness.optional(), createdAt: Time }),
26524
+ var GuestRequestSchema = external_exports.discriminatedUnion("kind", [
26525
+ external_exports.strictObject({
26526
+ kind: external_exports.literal("session"),
26527
+ id: IdSchema,
26528
+ harness: Text(64),
26529
+ args: external_exports.array(Text()).max(256),
26530
+ cwd: Text(),
26531
+ project: ProjectSpecSchema.optional(),
26532
+ harnessSpec: HarnessSchema.optional(),
26533
+ createdAt: TimeSchema
26534
+ }),
25695
26535
  /** Provision a registered project without starting an agent (sandbox start / exec / db from its folder). */
25696
- external_exports.strictObject({ kind: external_exports.literal("project"), id: Id, project: ProjectSpec, createdAt: Time }),
25697
- external_exports.strictObject({ kind: external_exports.literal("exec"), id: Id, command: external_exports.array(Text()).min(1).max(256), cwd: Text(), timeoutSeconds: external_exports.number().positive().max(86400), createdAt: Time }),
26536
+ external_exports.strictObject({ kind: external_exports.literal("project"), id: IdSchema, project: ProjectSpecSchema, createdAt: TimeSchema }),
26537
+ external_exports.strictObject({
26538
+ kind: external_exports.literal("exec"),
26539
+ id: IdSchema,
26540
+ command: external_exports.array(Text()).min(1).max(256),
26541
+ cwd: Text(),
26542
+ timeoutSeconds: external_exports.number().positive().max(86400),
26543
+ createdAt: TimeSchema
26544
+ }),
25698
26545
  /** cwd: only the sessions in this folder or below (one project's); omitted = every session. */
25699
- external_exports.strictObject({ kind: external_exports.literal("restart"), id: Id, harness: Text(64).nullable(), cwd: Text().optional(), createdAt: Time }),
25700
- external_exports.strictObject({ kind: external_exports.literal("ping"), id: Id, createdAt: Time })
26546
+ external_exports.strictObject({
26547
+ kind: external_exports.literal("restart"),
26548
+ id: IdSchema,
26549
+ harness: Text(64).nullable(),
26550
+ cwd: Text().optional(),
26551
+ createdAt: TimeSchema
26552
+ }),
26553
+ external_exports.strictObject({ kind: external_exports.literal("ping"), id: IdSchema, createdAt: TimeSchema })
25701
26554
  ]);
25702
- var GuestResponse = external_exports.object({
25703
- id: Id,
26555
+ var GuestResponseSchema = external_exports.object({
26556
+ id: IdSchema,
25704
26557
  ok: external_exports.boolean(),
25705
26558
  message: Text(65536),
25706
26559
  exitCode: external_exports.number().int().optional(),
25707
26560
  stdout: Text(4 * 1024 * 1024).optional(),
25708
26561
  stderr: Text(4 * 1024 * 1024).optional(),
25709
- finishedAt: Time
26562
+ finishedAt: TimeSchema
25710
26563
  });
25711
- var SessionStatus = external_exports.object({
25712
- id: Id,
26564
+ var SessionStatusSchema = external_exports.object({
26565
+ id: IdSchema,
25713
26566
  launchId: Text(64),
25714
26567
  harness: Text(64),
25715
26568
  cwd: Text(),
@@ -25717,22 +26570,22 @@ var SessionStatus = external_exports.object({
25717
26570
  project: Text(64).optional(),
25718
26571
  phase: external_exports.enum(["starting", "running", "exited", "failed"]),
25719
26572
  message: Text(),
25720
- updatedAt: Time,
25721
- startedAt: Time,
26573
+ updatedAt: TimeSchema,
26574
+ startedAt: TimeSchema,
25722
26575
  exitCode: external_exports.number().int().optional(),
25723
- attach: AttachEndpoint.optional()
26576
+ attach: AttachEndpointSchema.optional()
25724
26577
  });
25725
- var ProjectStatus = external_exports.object({
25726
- name: Id,
26578
+ var ProjectStatusSchema = external_exports.object({
26579
+ name: IdSchema,
25727
26580
  workspace: Text(1024),
25728
26581
  phase: external_exports.enum(["provisioning", "ready", "failed"]),
25729
26582
  message: Text(),
25730
- updatedAt: Time,
26583
+ updatedAt: TimeSchema,
25731
26584
  databases: external_exports.array(external_exports.object({ database: Text(32), port: external_exports.number().int() })).max(16),
25732
26585
  summary: external_exports.array(Text(512)).max(64)
25733
26586
  });
25734
26587
 
25735
- // src/guest/ports.ts
26588
+ // src/guest/runtime/ports.ts
25736
26589
  import net from "node:net";
25737
26590
  var portOpen = (port) => new Promise((resolve) => {
25738
26591
  const socket = net.connect({ host: "127.0.0.1", port }, () => {
@@ -25749,64 +26602,42 @@ var waitForPort = async (port, seconds) => {
25749
26602
  return false;
25750
26603
  };
25751
26604
 
25752
- // src/guest/toolchains/databases/index.ts
25753
- import fs10 from "node:fs";
25754
- import path15 from "node:path";
25755
- import { spawnSync as spawnSync2 } from "node:child_process";
25756
-
25757
- // src/shared/system.ts
25758
- import path from "node:path";
25759
- var systemRoot = () => process.env.SystemRoot ?? process.env.WINDIR ?? "C:\\Windows";
25760
- var system32 = (exe) => path.join(systemRoot(), "System32", exe);
25761
- var SYSTEM = {
25762
- cmd: () => system32("cmd.exe"),
25763
- powershell: () => system32("WindowsPowerShell\\v1.0\\powershell.exe"),
25764
- tasklist: () => system32("tasklist.exe"),
25765
- tar: () => system32("tar.exe"),
25766
- reg: () => system32("reg.exe"),
25767
- netsh: () => system32("netsh.exe"),
25768
- netstat: () => system32("NETSTAT.EXE"),
25769
- route: () => system32("ROUTE.EXE"),
25770
- ipconfig: () => system32("ipconfig.exe"),
25771
- robocopy: () => system32("Robocopy.exe"),
25772
- shutdown: () => system32("shutdown.exe"),
25773
- dism: () => system32("Dism.exe"),
25774
- msiexec: () => system32("msiexec.exe")
26605
+ // src/guest/databases/names.ts
26606
+ var DATABASE_NAMES = {
26607
+ postgres: "PostgreSQL",
26608
+ mysql: "MySQL (MariaDB)",
26609
+ mongodb: "MongoDB",
26610
+ redis: "Redis",
26611
+ dynamodb: "DynamoDB Local",
26612
+ sqlserver: "SQL Server"
25775
26613
  };
25776
26614
 
25777
- // src/guest/env.ts
25778
- import fs5 from "node:fs";
25779
- import path6 from "node:path";
25780
- import { spawnSync } from "node:child_process";
26615
+ // src/guest/runtime/paths.ts
26616
+ import path5 from "node:path";
25781
26617
 
25782
- // src/shared/download.ts
25783
- import fs3 from "node:fs";
26618
+ // src/shared/channel/run-dir.ts
26619
+ import fs4 from "node:fs";
25784
26620
  import path4 from "node:path";
25785
- import crypto from "node:crypto";
25786
- import { spawn } from "node:child_process";
25787
- import { Readable, Transform } from "node:stream";
25788
- import { pipeline } from "node:stream/promises";
25789
26621
 
25790
- // src/shared/safe-remove.ts
26622
+ // src/shared/io/json.ts
25791
26623
  import fs2 from "node:fs";
25792
- import os2 from "node:os";
25793
- import path3 from "node:path";
26624
+ import path2 from "node:path";
25794
26625
 
25795
26626
  // src/shared/test-guard.ts
25796
26627
  import fs from "node:fs";
25797
26628
  import os from "node:os";
25798
- import path2 from "node:path";
26629
+ import path from "node:path";
25799
26630
  var selfTestRunning = () => process.env.AGENT_SANDBOX_SELFTEST === "1";
25800
26631
  var canonical = (p) => {
25801
26632
  let rest = "";
25802
- let current = path2.resolve(p);
26633
+ let current = path.resolve(p);
25803
26634
  for (; ; ) {
25804
26635
  try {
25805
- return path2.join(fs.realpathSync.native(current), rest).toLowerCase();
26636
+ return path.join(fs.realpathSync.native(current), rest).toLowerCase();
25806
26637
  } catch {
25807
- const parent = path2.dirname(current);
25808
- if (parent === current) return path2.resolve(p).toLowerCase();
25809
- rest = path2.join(path2.basename(current), rest);
26638
+ const parent = path.dirname(current);
26639
+ if (parent === current) return path.resolve(p).toLowerCase();
26640
+ rest = path.join(path.basename(current), rest);
25810
26641
  current = parent;
25811
26642
  }
25812
26643
  }
@@ -25815,14 +26646,55 @@ var testWriteRefusal = (target) => {
25815
26646
  if (!selfTestRunning()) return null;
25816
26647
  const temp = canonical(os.tmpdir());
25817
26648
  const t = canonical(target);
25818
- return t === temp || t.startsWith(temp + path2.sep) ? null : "The self-test refused to change " + target + ": it only works in temp folders, so it can never change this PC.";
26649
+ return t === temp || t.startsWith(temp + path.sep) ? null : "The self-test refused to change " + target + ": it only works in temp folders, so it can never change this PC.";
25819
26650
  };
25820
26651
  var assertTestWritable = (target) => {
25821
26652
  const refusal = testWriteRefusal(target);
25822
26653
  if (refusal) throw new Error(refusal);
25823
26654
  };
25824
26655
 
25825
- // src/shared/safe-remove.ts
26656
+ // src/shared/io/json.ts
26657
+ var MAX_MESSAGE_BYTES = 8 * 1024 * 1024;
26658
+ var readJsonFile = (file2) => {
26659
+ try {
26660
+ if (fs2.statSync(file2).size > MAX_MESSAGE_BYTES) return null;
26661
+ return JSON.parse(fs2.readFileSync(file2, "utf8").replace(/^\uFEFF/, ""));
26662
+ } catch {
26663
+ return null;
26664
+ }
26665
+ };
26666
+ var readValid = (schema, file2) => {
26667
+ const parsed = schema.safeParse(readJsonFile(file2));
26668
+ return parsed.success ? parsed.data : null;
26669
+ };
26670
+ var pause = (ms) => {
26671
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
26672
+ };
26673
+ var writeJsonAtomic = (file2, value) => writeFileAtomic(file2, JSON.stringify(value, null, 2) + "\n");
26674
+ var writeFileAtomic = (file2, text) => {
26675
+ assertTestWritable(file2);
26676
+ fs2.mkdirSync(path2.dirname(file2), { recursive: true });
26677
+ const temp = file2 + "." + process.pid + "-" + Math.random().toString(36).slice(2) + ".tmp";
26678
+ fs2.writeFileSync(temp, text, { encoding: "utf8", flag: "wx" });
26679
+ for (let attempt = 1; ; attempt++) {
26680
+ try {
26681
+ fs2.renameSync(temp, file2);
26682
+ return;
26683
+ } catch (e) {
26684
+ const code = e.code;
26685
+ if (attempt >= 8 || code !== "EPERM" && code !== "EBUSY" && code !== "EACCES") {
26686
+ fs2.rmSync(temp, { force: true });
26687
+ throw e;
26688
+ }
26689
+ pause(50 * attempt);
26690
+ }
26691
+ }
26692
+ };
26693
+
26694
+ // src/shared/io/safe-remove.ts
26695
+ import fs3 from "node:fs";
26696
+ import os2 from "node:os";
26697
+ import path3 from "node:path";
25826
26698
  var norm = (p) => path3.resolve(p).replace(/[\\/]+$/, "").toLowerCase();
25827
26699
  var isAncestorOrSame = (parent, child) => {
25828
26700
  const a = norm(parent);
@@ -25844,7 +26716,15 @@ var protectedFolders = () => [
25844
26716
  "C:\\Users",
25845
26717
  "C:\\Windows"
25846
26718
  ].filter((p) => typeof p === "string" && p.trim() !== "");
25847
- var systemFolders = () => [process.env.SystemRoot, process.env.WINDIR, process.env.ProgramFiles, process.env["ProgramFiles(x86)"], "C:\\Windows", "C:\\Program Files", "C:\\Program Files (x86)"].filter((p) => typeof p === "string" && p.trim() !== "");
26719
+ var systemFolders = () => [
26720
+ process.env.SystemRoot,
26721
+ process.env.WINDIR,
26722
+ process.env.ProgramFiles,
26723
+ process.env["ProgramFiles(x86)"],
26724
+ "C:\\Windows",
26725
+ "C:\\Program Files",
26726
+ "C:\\Program Files (x86)"
26727
+ ].filter((p) => typeof p === "string" && p.trim() !== "");
25848
26728
  var removeRefusal = (target, root) => {
25849
26729
  if (!target || !path3.isAbsolute(target) || !root || !path3.isAbsolute(root)) return "not an absolute path";
25850
26730
  if (/^[\\/]{2}[?.][\\/]/.test(target) || /^[\\/]{2}[?.][\\/]/.test(root)) return "a device path (\\\\?\\ or \\\\.\\)";
@@ -25863,34 +26743,143 @@ var safeRemove = (target, root) => {
25863
26743
  assertTestWritable(target);
25864
26744
  let stat;
25865
26745
  try {
25866
- stat = fs2.lstatSync(target);
26746
+ stat = fs3.lstatSync(target);
25867
26747
  } catch {
25868
26748
  return;
25869
26749
  }
25870
26750
  if (stat.isSymbolicLink()) {
25871
26751
  try {
25872
- fs2.unlinkSync(target);
26752
+ fs3.unlinkSync(target);
25873
26753
  } catch {
25874
- fs2.rmdirSync(target);
26754
+ fs3.rmdirSync(target);
25875
26755
  }
25876
26756
  return;
25877
26757
  }
25878
- fs2.rmSync(target, { recursive: true, force: true, maxRetries: 2 });
26758
+ fs3.rmSync(target, { recursive: true, force: true, maxRetries: 2 });
25879
26759
  };
25880
26760
 
25881
- // src/shared/download.ts
25882
- var USER_AGENT = "windows-development-sandbox";
25883
- var stagingFolder = (destination) => destination + ".staging-" + crypto.randomBytes(3).toString("hex");
25884
- var moveIntoPlace = (work, destination) => {
25885
- safeRemove(destination, path4.dirname(destination));
25886
- fs3.mkdirSync(path4.dirname(destination), { recursive: true });
25887
- fs3.renameSync(work, destination);
26761
+ // src/shared/channel/run-dir.ts
26762
+ function safeId(id) {
26763
+ return IdSchema.parse(id);
26764
+ }
26765
+ var scan = (schema, dir) => {
26766
+ if (!fs4.existsSync(dir)) return { valid: [], invalid: [] };
26767
+ const valid = [];
26768
+ const invalid = [];
26769
+ for (const name of fs4.readdirSync(dir)) {
26770
+ if (name.endsWith(".tmp")) continue;
26771
+ const message = /^[A-Za-z0-9_-]{1,64}\.json$/.test(name) ? readValid(schema, path4.join(dir, name)) : null;
26772
+ if (message) valid.push(message);
26773
+ else invalid.push(path4.join(dir, name));
26774
+ }
26775
+ return { valid, invalid };
25888
26776
  };
26777
+ var RunDir = class {
26778
+ root;
26779
+ sandboxFile;
26780
+ requestsDir;
26781
+ responsesDir;
26782
+ sessionsDir;
26783
+ projectsDir;
26784
+ /** audit.processes: programs the sandbox started, in small .jsonl files the host takes in and deletes. */
26785
+ auditDir;
26786
+ constructor(dataDir2) {
26787
+ this.root = path4.join(dataDir2, "run");
26788
+ this.sandboxFile = path4.join(this.root, "sandbox.json");
26789
+ this.requestsDir = path4.join(this.root, "requests");
26790
+ this.responsesDir = path4.join(this.root, "responses");
26791
+ this.sessionsDir = path4.join(this.root, "sessions");
26792
+ this.projectsDir = path4.join(this.root, "projects");
26793
+ this.auditDir = path4.join(this.root, "audit");
26794
+ }
26795
+ requestFile(id) {
26796
+ return path4.join(this.requestsDir, safeId(id) + ".json");
26797
+ }
26798
+ responseFile(id) {
26799
+ return path4.join(this.responsesDir, safeId(id) + ".json");
26800
+ }
26801
+ sessionFile(id) {
26802
+ return path4.join(this.sessionsDir, safeId(id) + ".json");
26803
+ }
26804
+ projectFile(name) {
26805
+ return path4.join(this.projectsDir, safeId(name) + ".json");
26806
+ }
26807
+ readSandboxStatus() {
26808
+ return readValid(SandboxStatusSchema, this.sandboxFile);
26809
+ }
26810
+ readSession(id) {
26811
+ return readValid(SessionStatusSchema, this.sessionFile(id));
26812
+ }
26813
+ readResponse(id) {
26814
+ return readValid(GuestResponseSchema, this.responseFile(id));
26815
+ }
26816
+ listSessions() {
26817
+ return scan(SessionStatusSchema, this.sessionsDir).valid.sort((a, b) => a.startedAt.localeCompare(b.startedAt));
26818
+ }
26819
+ readProjectStatus(name) {
26820
+ return readValid(ProjectStatusSchema, this.projectFile(name));
26821
+ }
26822
+ listProjectStatus() {
26823
+ return scan(ProjectStatusSchema, this.projectsDir).valid.slice(0, 64);
26824
+ }
26825
+ scanRequests() {
26826
+ return scan(GuestRequestSchema, this.requestsDir);
26827
+ }
26828
+ };
26829
+
26830
+ // src/guest/runtime/paths.ts
26831
+ var isWin = process.platform === "win32";
26832
+ var dryRun = process.env.AGENT_DRY_RUN === "1";
26833
+ var testMode = process.env.AGENT_SANDBOX_TEST === "1";
26834
+ var launchDir = process.env.AGENT_LAUNCH_DIR ?? "C:\\AgentLaunch";
26835
+ var dataDir = process.env.AGENT_DATA_DIR ?? "C:\\AgentData";
26836
+ var hostToolsDir = process.env.AGENT_HOST_TOOLS_DIR ?? "C:\\HostTools";
26837
+ var localDir = process.env.AGENT_LOCAL_DIR ?? "C:\\nvm";
26838
+ var toolsDir = path5.join(dataDir, "tools");
26839
+ var logsDir = path5.join(dataDir, "logs");
26840
+ var run = new RunDir(dataDir);
26841
+
26842
+ // src/guest/runtime/log.ts
26843
+ import fs5 from "node:fs";
26844
+ import path6 from "node:path";
26845
+ fs5.mkdirSync(logsDir, { recursive: true });
26846
+ var logFile = path6.join(
26847
+ logsDir,
26848
+ (process.env.AGENT_LOG_PREFIX ?? "guest") + "-" + (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-") + ".log"
26849
+ );
26850
+ var append = (line) => {
26851
+ try {
26852
+ fs5.appendFileSync(logFile, line + "\n");
26853
+ } catch {
26854
+ }
26855
+ };
26856
+ var log = (message) => {
26857
+ console.log(message);
26858
+ append(message);
26859
+ };
26860
+ var warn = (message) => {
26861
+ console.warn("\x1B[33mWARNING: " + message + "\x1B[0m");
26862
+ append("WARNING: " + message);
26863
+ };
26864
+
26865
+ // src/guest/runtime/project-context.ts
26866
+ import { AsyncLocalStorage } from "node:async_hooks";
26867
+
26868
+ // src/guest/runtime/session.ts
26869
+ import fs8 from "node:fs";
26870
+ import path10 from "node:path";
26871
+
26872
+ // src/shared/download/http.ts
26873
+ var USER_AGENT = "windows-development-sandbox";
25889
26874
  var fetchRetry = async (url2, init = {}, attempts = 5, timeoutMs = 6e4) => {
25890
26875
  let last;
25891
26876
  for (let i = 1; i <= attempts; i++) {
25892
26877
  try {
25893
- const response = await fetch(url2, { ...init, signal: AbortSignal.timeout(timeoutMs), headers: { "User-Agent": USER_AGENT, ...init.headers ?? {} } });
26878
+ const response = await fetch(url2, {
26879
+ ...init,
26880
+ signal: AbortSignal.timeout(timeoutMs),
26881
+ headers: { "User-Agent": USER_AGENT, ...init.headers ?? {} }
26882
+ });
25894
26883
  if (response.ok) return response;
25895
26884
  last = new Error("HTTP " + response.status + " for " + url2);
25896
26885
  if (response.status === 404) break;
@@ -25903,60 +26892,174 @@ var fetchRetry = async (url2, init = {}, attempts = 5, timeoutMs = 6e4) => {
25903
26892
  };
25904
26893
  var fetchJson = async (url2) => await (await fetchRetry(url2, { headers: { Accept: "application/json" } }, 2, 2e4)).json();
25905
26894
  var fetchText = async (url2) => await (await fetchRetry(url2)).text();
25906
- var checksumRequired = false;
25907
- var setChecksumRequired = (on) => {
25908
- checksumRequired = on;
26895
+
26896
+ // src/shared/download/archive.ts
26897
+ import fs6 from "node:fs";
26898
+ import path8 from "node:path";
26899
+ import crypto from "node:crypto";
26900
+
26901
+ // src/shared/system.ts
26902
+ import path7 from "node:path";
26903
+ var systemRoot = () => process.env.SystemRoot ?? process.env.WINDIR ?? "C:\\Windows";
26904
+ var system32 = (exe) => path7.join(systemRoot(), "System32", exe);
26905
+ var SYSTEM = {
26906
+ cmd: () => system32("cmd.exe"),
26907
+ powershell: () => system32("WindowsPowerShell\\v1.0\\powershell.exe"),
26908
+ tasklist: () => system32("tasklist.exe"),
26909
+ tar: () => system32("tar.exe"),
26910
+ reg: () => system32("reg.exe"),
26911
+ netsh: () => system32("netsh.exe"),
26912
+ netstat: () => system32("NETSTAT.EXE"),
26913
+ route: () => system32("ROUTE.EXE"),
26914
+ ipconfig: () => system32("ipconfig.exe"),
26915
+ robocopy: () => system32("Robocopy.exe"),
26916
+ shutdown: () => system32("shutdown.exe"),
26917
+ dism: () => system32("Dism.exe"),
26918
+ msiexec: () => system32("msiexec.exe")
25909
26919
  };
25910
- var downloadWatcher = null;
25911
- var download = async (url2, destination, expected = null) => {
25912
- const sums = typeof expected === "string" || expected === null ? { sha256: expected } : expected;
25913
- if (checksumRequired && !sums.sha256?.trim() && !sums.sha512?.trim()) {
25914
- throw new Error("Refusing to download " + path4.basename(destination) + " (" + url2 + "): no checksum is published for it, and downloads.requireChecksum is on. Turn that setting off to allow downloads that cannot be verified.");
25915
- }
25916
- const response = await fetchRetry(url2, {}, 3, 20 * 60 * 1e3);
25917
- if (!response.body) throw new Error("Empty response for " + url2);
25918
- fs3.mkdirSync(path4.dirname(destination), { recursive: true });
25919
- const checks = ["sha256", "sha512"].flatMap((kind) => {
25920
- const want = sums[kind]?.trim().toLowerCase();
25921
- return want ? [{ want, hash: crypto.createHash(kind) }] : [];
25922
- });
25923
- const size = Number(response.headers.get("content-length")) || 0;
25924
- const report = size > 0 ? downloadWatcher?.() ?? null : null;
25925
- let received = 0;
25926
- let tenth = 0;
25927
- let reportedAt = Date.now();
25928
- const tap = new Transform({ transform(chunk, _encoding, done) {
25929
- for (const c of checks) c.hash.update(chunk);
25930
- if (report) {
25931
- received += chunk.length;
25932
- const now2 = Math.floor(received * 10 / size);
25933
- if (now2 !== tenth || Date.now() - reportedAt > 5e3) {
25934
- tenth = now2;
25935
- reportedAt = Date.now();
25936
- try {
25937
- report(Math.min(1, received / size));
25938
- } catch {
26920
+
26921
+ // src/shared/download/spawn.ts
26922
+ import { spawn } from "node:child_process";
26923
+ var spawnAsync = (file2, args, options = {}) => new Promise((resolve, reject) => {
26924
+ const child = spawn(file2, args, { stdio: "ignore", windowsHide: true, ...options });
26925
+ child.once("error", reject);
26926
+ child.once("close", (code) => resolve(code ?? -1));
26927
+ });
26928
+
26929
+ // src/shared/download/archive.ts
26930
+ var stagingFolder = (destination) => destination + ".staging-" + crypto.randomBytes(3).toString("hex");
26931
+ var moveIntoPlace = (work, destination) => {
26932
+ safeRemove(destination, path8.dirname(destination));
26933
+ fs6.mkdirSync(path8.dirname(destination), { recursive: true });
26934
+ fs6.renameSync(work, destination);
26935
+ };
26936
+ var extractArchive = async (archive, destination, members2 = []) => {
26937
+ fs6.mkdirSync(destination, { recursive: true });
26938
+ let status = await spawnAsync(SYSTEM.tar(), ["-xf", archive, "-C", destination, ...members2]);
26939
+ if (status !== 0 && /\.(zip|nupkg)$/i.test(archive)) {
26940
+ const zip = archive.endsWith(".zip") ? archive : archive + ".zip";
26941
+ if (zip !== archive) fs6.copyFileSync(archive, zip);
26942
+ status = await spawnAsync(SYSTEM.powershell(), [
26943
+ "-NoLogo",
26944
+ "-NoProfile",
26945
+ "-Command",
26946
+ "Expand-Archive -LiteralPath '" + zip.replace(/'/g, "''") + "' -DestinationPath '" + destination.replace(/'/g, "''") + "' -Force"
26947
+ ]);
26948
+ }
26949
+ if (status !== 0) throw new Error("Could not extract " + archive);
26950
+ };
26951
+ var findFile = (root, name, maxDepth = 4) => {
26952
+ if (maxDepth < 0 || !fs6.existsSync(root)) return null;
26953
+ const entries = fs6.readdirSync(root, { withFileTypes: true });
26954
+ for (const entry of entries)
26955
+ if (entry.isFile() && entry.name.toLowerCase() === name.toLowerCase()) return path8.join(root, entry.name);
26956
+ for (const entry of entries)
26957
+ if (entry.isDirectory()) {
26958
+ const found = findFile(path8.join(root, entry.name), name, maxDepth - 1);
26959
+ if (found) return found;
26960
+ }
26961
+ return null;
26962
+ };
26963
+
26964
+ // src/shared/download/downloader.ts
26965
+ import fs7 from "node:fs";
26966
+ import path9 from "node:path";
26967
+ import crypto2 from "node:crypto";
26968
+ import { Readable, Transform } from "node:stream";
26969
+ import { pipeline } from "node:stream/promises";
26970
+ var Downloader = class {
26971
+ /** downloads.requireChecksum: refuse anything without an expected hash. The guest sets it from session.json. */
26972
+ requireChecksum = false;
26973
+ watcher = null;
26974
+ /** Reports coarse progress of the downloads that start from now on to `watcher` (null: stop). */
26975
+ watch(watcher) {
26976
+ this.watcher = watcher;
26977
+ }
26978
+ /**
26979
+ * Streams a download to disk, hashing as it goes: big archives (PostgreSQL is ~330 MB) never sit in memory, and the
26980
+ * event loop stays free so other toolchains keep downloading meanwhile. A mismatch (or any failure) leaves no file
26981
+ * behind.
26982
+ */
26983
+ async file(url2, destination, expected = null) {
26984
+ const sums = typeof expected === "string" || expected === null ? { sha256: expected } : expected;
26985
+ if (this.requireChecksum && !sums.sha256?.trim() && !sums.sha512?.trim()) {
26986
+ throw new Error(
26987
+ "Refusing to download " + path9.basename(destination) + " (" + url2 + "): no checksum is published for it, and downloads.requireChecksum is on. Turn that setting off to allow downloads that cannot be verified."
26988
+ );
26989
+ }
26990
+ const response = await fetchRetry(url2, {}, 3, 20 * 60 * 1e3);
26991
+ if (!response.body) throw new Error("Empty response for " + url2);
26992
+ fs7.mkdirSync(path9.dirname(destination), { recursive: true });
26993
+ const checks = ["sha256", "sha512"].flatMap((kind) => {
26994
+ const want = sums[kind]?.trim().toLowerCase();
26995
+ return want ? [{ want, hash: crypto2.createHash(kind) }] : [];
26996
+ });
26997
+ const size = Number(response.headers.get("content-length")) || 0;
26998
+ const report = size > 0 ? this.watcher?.() ?? null : null;
26999
+ let received = 0;
27000
+ let tenth = 0;
27001
+ let reportedAt = Date.now();
27002
+ const tap = new Transform({
27003
+ transform(chunk, _encoding, done) {
27004
+ for (const c of checks) c.hash.update(chunk);
27005
+ if (report) {
27006
+ received += chunk.length;
27007
+ const now = Math.floor(received * 10 / size);
27008
+ if (now !== tenth || Date.now() - reportedAt > 5e3) {
27009
+ tenth = now;
27010
+ reportedAt = Date.now();
27011
+ try {
27012
+ report(Math.min(1, received / size));
27013
+ } catch {
27014
+ }
27015
+ }
25939
27016
  }
27017
+ done(null, chunk);
25940
27018
  }
27019
+ });
27020
+ const partial2 = destination + ".part";
27021
+ try {
27022
+ await pipeline(Readable.fromWeb(response.body), tap, fs7.createWriteStream(partial2));
27023
+ if (checks.some((c) => c.hash.digest("hex") !== c.want)) throw new Error("Checksum mismatch for " + url2);
27024
+ fs7.rmSync(destination, { force: true });
27025
+ fs7.renameSync(partial2, destination);
27026
+ } finally {
27027
+ fs7.rmSync(partial2, { force: true });
27028
+ }
27029
+ }
27030
+ /**
27031
+ * Downloads + extracts into `destination` atomically (staging folder, then rename). With `locate`, only the folder
27032
+ * holding that file is kept (`up` folders above it, e.g. locate ruby.exe with up 1 keeps the folder around bin).
27033
+ */
27034
+ async archive(url2, destination, options = {}) {
27035
+ const work = stagingFolder(destination);
27036
+ try {
27037
+ const archive = path9.join(work, options.fileName ?? path9.basename(new URL(url2).pathname));
27038
+ await this.file(url2, archive, { sha256: options.sha256, sha512: options.sha512 });
27039
+ const extracted = path9.join(work, "x");
27040
+ await extractArchive(archive, extracted, options.members);
27041
+ let root = extracted;
27042
+ if (options.locate) {
27043
+ const found = findFile(extracted, options.locate);
27044
+ if (!found) throw new Error(options.locate + " not found in " + url2);
27045
+ root = path9.dirname(found);
27046
+ for (let i = 0; i < (options.up ?? 0) && path9.dirname(root).startsWith(extracted); i++)
27047
+ root = path9.dirname(root);
27048
+ }
27049
+ moveIntoPlace(root, destination);
27050
+ } finally {
27051
+ safeRemove(work, path9.dirname(work));
25941
27052
  }
25942
- done(null, chunk);
25943
- } });
25944
- const partial2 = destination + ".part";
25945
- try {
25946
- await pipeline(Readable.fromWeb(response.body), tap, fs3.createWriteStream(partial2));
25947
- if (checks.some((c) => c.hash.digest("hex") !== c.want)) throw new Error("Checksum mismatch for " + url2);
25948
- fs3.rmSync(destination, { force: true });
25949
- fs3.renameSync(partial2, destination);
25950
- } finally {
25951
- fs3.rmSync(partial2, { force: true });
25952
27053
  }
25953
27054
  };
25954
- var spawnAsync = (file2, args, options = {}) => new Promise((resolve, reject) => {
25955
- const child = spawn(file2, args, { stdio: "ignore", windowsHide: true, ...options });
25956
- child.once("error", reject);
25957
- child.once("close", (code) => resolve(code ?? -1));
27055
+ var downloader = new Downloader();
27056
+
27057
+ // src/shared/download/github.ts
27058
+ var toAsset = (asset) => ({
27059
+ url: asset.browser_download_url,
27060
+ name: asset.name,
27061
+ sha256: asset.digest?.startsWith("sha256:") ? asset.digest.slice(7) : null
25958
27062
  });
25959
- var toAsset = (asset) => ({ url: asset.browser_download_url, name: asset.name, sha256: asset.digest?.startsWith("sha256:") ? asset.digest.slice(7) : null });
25960
27063
  var githubAsset = async (repo, pattern, searchOlder = false) => {
25961
27064
  let latest;
25962
27065
  try {
@@ -25968,13 +27071,17 @@ var githubAsset = async (repo, pattern, searchOlder = false) => {
25968
27071
  const hit = latest.assets.find((a) => pattern.test(a.name));
25969
27072
  if (hit) return toAsset(hit);
25970
27073
  if (searchOlder) {
25971
- const releases = await fetchJson("https://api.github.com/repos/" + repo + "/releases?per_page=100");
27074
+ const releases = await fetchJson(
27075
+ "https://api.github.com/repos/" + repo + "/releases?per_page=100"
27076
+ );
25972
27077
  for (const release of releases.filter((r) => !r.prerelease && !r.draft)) {
25973
27078
  const older = release.assets.find((a) => pattern.test(a.name));
25974
27079
  if (older) return toAsset(older);
25975
27080
  }
25976
27081
  }
25977
- throw new Error("No asset matching " + pattern + " in the " + (searchOlder ? "stable" : "latest") + " " + repo + " release(s)");
27082
+ throw new Error(
27083
+ "No asset matching " + pattern + " in the " + (searchOlder ? "stable" : "latest") + " " + repo + " release(s)"
27084
+ );
25978
27085
  };
25979
27086
  var parseReleasePage = (html) => {
25980
27087
  const links = [...html.matchAll(/href="(\/[^"]+\/releases\/download\/[^"]+)"/g)];
@@ -25990,172 +27097,193 @@ var latestGithubTag = async (repo) => {
25990
27097
  };
25991
27098
  var parseReleaseTags = (html, repo) => {
25992
27099
  const escaped = repo.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
25993
- const tags = [...html.matchAll(new RegExp('href="/' + escaped + '/releases/tag/([^"?#]+)"', "gi"))].map((m) => decodeURIComponent(m[1]));
27100
+ const tags = [...html.matchAll(new RegExp('href="/' + escaped + '/releases/tag/([^"?#]+)"', "gi"))].map(
27101
+ (m) => decodeURIComponent(m[1])
27102
+ );
25994
27103
  return [...new Set(tags)];
25995
27104
  };
25996
27105
  var OLDER_RELEASES = 10;
25997
27106
  var githubAssetFromPage = async (repo, pattern, searchOlder) => {
25998
- const assetsOf = async (tag) => parseReleasePage(await fetchText("https://github.com/" + repo + "/releases/expanded_assets/" + encodeURIComponent(tag))).find((a) => pattern.test(a.name));
27107
+ const assetsOf = async (tag) => parseReleasePage(
27108
+ await fetchText("https://github.com/" + repo + "/releases/expanded_assets/" + encodeURIComponent(tag))
27109
+ ).find((a) => pattern.test(a.name));
25999
27110
  const latest = await latestGithubTag(repo);
26000
27111
  const hit = await assetsOf(latest);
26001
27112
  if (hit) return hit;
26002
27113
  if (searchOlder) {
26003
- const older = parseReleaseTags(await fetchText("https://github.com/" + repo + "/releases"), repo).filter((t) => t !== latest);
27114
+ const older = parseReleaseTags(await fetchText("https://github.com/" + repo + "/releases"), repo).filter(
27115
+ (t) => t !== latest
27116
+ );
26004
27117
  for (const tag of older.slice(0, OLDER_RELEASES)) {
26005
27118
  const found = await assetsOf(tag);
26006
27119
  if (found) return found;
26007
27120
  }
26008
27121
  }
26009
- throw new Error("No asset matching " + pattern + " in " + repo + " " + latest + (searchOlder ? " or the releases before it" : ""));
27122
+ throw new Error(
27123
+ "No asset matching " + pattern + " in " + repo + " " + latest + (searchOlder ? " or the releases before it" : "")
27124
+ );
26010
27125
  };
26011
- var extractArchive = async (archive, destination, members2 = []) => {
26012
- fs3.mkdirSync(destination, { recursive: true });
26013
- let status = await spawnAsync(SYSTEM.tar(), ["-xf", archive, "-C", destination, ...members2]);
26014
- if (status !== 0 && /\.(zip|nupkg)$/i.test(archive)) {
26015
- const zip = archive.endsWith(".zip") ? archive : archive + ".zip";
26016
- if (zip !== archive) fs3.copyFileSync(archive, zip);
26017
- status = await spawnAsync(SYSTEM.powershell(), ["-NoLogo", "-NoProfile", "-Command", "Expand-Archive -LiteralPath '" + zip.replace(/'/g, "''") + "' -DestinationPath '" + destination.replace(/'/g, "''") + "' -Force"]);
27126
+
27127
+ // src/guest/runtime/session.ts
27128
+ var session = JSON.parse(
27129
+ fs8.readFileSync(path10.join(launchDir, "session.json"), "utf8").replace(/^\uFEFF/, "")
27130
+ );
27131
+ downloader.requireChecksum = session.downloads?.requireChecksum === true;
27132
+ var workspace = process.env.AGENT_WORKSPACE ?? session.workspace;
27133
+ var stateDir = path10.join(dataDir, session.persistAgentState ? "state" : "state-session");
27134
+ var claudeDir = path10.join(stateDir, "claude");
27135
+
27136
+ // src/guest/runtime/project-context.ts
27137
+ var store = new AsyncLocalStorage();
27138
+ var projectWorkspace = () => store.getStore()?.workspace ?? workspace;
27139
+ var duringSession = () => store.getStore()?.duringSession ?? false;
27140
+
27141
+ // src/guest/databases/database-server.ts
27142
+ import { spawnSync } from "node:child_process";
27143
+ function listenerPid(port) {
27144
+ const out = spawnSync(SYSTEM.netstat(), ["-ano", "-p", "TCP"], { encoding: "utf8", windowsHide: true }).stdout ?? "";
27145
+ const hit = out.split(/\r?\n/).map((l) => /^\s*TCP\s+\S+:(\d+)\s+\S+\s+LISTENING\s+(\d+)/.exec(l)).find((m) => m && Number(m[1]) === port);
27146
+ return hit ? Number(hit[2]) : null;
27147
+ }
27148
+ function killListeners(plan) {
27149
+ for (const port of [plan.port, plan.adminPort ?? 0]) {
27150
+ const pid = port && listenerPid(port);
27151
+ if (pid)
27152
+ try {
27153
+ process.kill(pid);
27154
+ } catch {
27155
+ }
26018
27156
  }
26019
- if (status !== 0) throw new Error("Could not extract " + archive);
26020
- };
26021
- var findFile = (root, name, maxDepth = 4) => {
26022
- if (maxDepth < 0 || !fs3.existsSync(root)) return null;
26023
- const entries = fs3.readdirSync(root, { withFileTypes: true });
26024
- for (const entry of entries) if (entry.isFile() && entry.name.toLowerCase() === name.toLowerCase()) return path4.join(root, entry.name);
26025
- for (const entry of entries) if (entry.isDirectory()) {
26026
- const found = findFile(path4.join(root, entry.name), name, maxDepth - 1);
26027
- if (found) return found;
27157
+ }
27158
+ var DatabaseServer = class {
27159
+ get label() {
27160
+ return DATABASE_NAMES[this.id];
26028
27161
  }
26029
- return null;
26030
- };
26031
- var installArchive = async (url2, destination, options = {}) => {
26032
- const work = stagingFolder(destination);
26033
- try {
26034
- const archive = path4.join(work, options.fileName ?? path4.basename(new URL(url2).pathname));
26035
- await download(url2, archive, { sha256: options.sha256, sha512: options.sha512 });
26036
- const extracted = path4.join(work, "x");
26037
- await extractArchive(archive, extracted, options.members);
26038
- let root = extracted;
26039
- if (options.locate) {
26040
- const found = findFile(extracted, options.locate);
26041
- if (!found) throw new Error(options.locate + " not found in " + url2);
26042
- root = path4.dirname(found);
26043
- for (let i = 0; i < (options.up ?? 0) && path4.dirname(root).startsWith(extracted); i++) root = path4.dirname(root);
26044
- }
26045
- moveIntoPlace(root, destination);
26046
- } finally {
26047
- safeRemove(work, path4.dirname(work));
27162
+ /** Ends whatever listens on the server's port (and its admin UI's port). */
27163
+ async stop(plan) {
27164
+ killListeners(plan);
26048
27165
  }
26049
27166
  };
26050
27167
 
26051
- // src/shared/rundir.ts
26052
- import fs4 from "node:fs";
26053
- import path5 from "node:path";
26054
- var MAX_MESSAGE_BYTES = 8 * 1024 * 1024;
26055
- var safeId = (id) => Id.parse(id);
26056
- var runPaths = (dataDir2) => {
26057
- const run2 = path5.join(dataDir2, "run");
26058
- const file2 = (dir) => (id) => path5.join(run2, dir, safeId(id) + ".json");
26059
- return {
26060
- run: run2,
26061
- sandbox: path5.join(run2, "sandbox.json"),
26062
- requests: path5.join(run2, "requests"),
26063
- responses: path5.join(run2, "responses"),
26064
- sessions: path5.join(run2, "sessions"),
26065
- projects: path5.join(run2, "projects"),
26066
- /** audit.processes: programs the sandbox started, in small .jsonl files the host takes in and deletes. */
26067
- audit: path5.join(run2, "audit"),
26068
- request: file2("requests"),
26069
- response: file2("responses"),
26070
- session: file2("sessions"),
26071
- project: file2("projects")
26072
- };
26073
- };
26074
- var pause = (ms) => {
26075
- Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
26076
- };
26077
- var writeJsonAtomic = (file2, value) => writeFileAtomic(file2, JSON.stringify(value, null, 2) + "\n");
26078
- var writeFileAtomic = (file2, text) => {
26079
- assertTestWritable(file2);
26080
- fs4.mkdirSync(path5.dirname(file2), { recursive: true });
26081
- const temp = file2 + "." + process.pid + "-" + Math.random().toString(36).slice(2) + ".tmp";
26082
- fs4.writeFileSync(temp, text, { encoding: "utf8", flag: "wx" });
26083
- for (let attempt = 1; ; attempt++) {
26084
- try {
26085
- fs4.renameSync(temp, file2);
26086
- return;
26087
- } catch (e) {
26088
- const code = e.code;
26089
- if (attempt >= 8 || code !== "EPERM" && code !== "EBUSY" && code !== "EACCES") {
26090
- fs4.rmSync(temp, { force: true });
26091
- throw e;
26092
- }
26093
- pause(50 * attempt);
26094
- }
26095
- }
26096
- };
27168
+ // src/guest/databases/dynamodb.ts
27169
+ import fs15 from "node:fs";
27170
+ import path16 from "node:path";
27171
+ import { spawn as spawn3 } from "node:child_process";
26097
27172
 
26098
- // src/guest/env.ts
26099
- var isWin = process.platform === "win32";
26100
- var dryRun = process.env.AGENT_DRY_RUN === "1";
26101
- var testMode = process.env.AGENT_SANDBOX_TEST === "1";
26102
- var launchDir = process.env.AGENT_LAUNCH_DIR ?? "C:\\AgentLaunch";
26103
- var dataDir = process.env.AGENT_DATA_DIR ?? "C:\\AgentData";
26104
- var hostToolsDir = process.env.AGENT_HOST_TOOLS_DIR ?? "C:\\HostTools";
26105
- var localDir = process.env.AGENT_LOCAL_DIR ?? "C:\\nvm";
26106
- var toolsDir = path6.join(dataDir, "tools");
26107
- var logsDir = path6.join(dataDir, "logs");
26108
- var run = runPaths(dataDir);
26109
- var session = JSON.parse(fs5.readFileSync(path6.join(launchDir, "session.json"), "utf8").replace(/^\uFEFF/, ""));
26110
- setChecksumRequired(session.downloads?.requireChecksum === true);
26111
- var workspace = process.env.AGENT_WORKSPACE ?? session.workspace;
26112
- var stateDir = path6.join(dataDir, session.persistAgentState ? "state" : "state-session");
26113
- var claudeDir = path6.join(stateDir, "claude");
26114
- fs5.mkdirSync(logsDir, { recursive: true });
26115
- var logFile = path6.join(logsDir, (process.env.AGENT_LOG_PREFIX ?? "guest") + "-" + (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-") + ".log");
26116
- var append = (line) => {
26117
- try {
26118
- fs5.appendFileSync(logFile, line + "\n");
26119
- } catch {
26120
- }
26121
- };
26122
- var log = (message) => {
26123
- console.log(message);
26124
- append(message);
26125
- };
26126
- var warn = (message) => {
26127
- console.warn("\x1B[33mWARNING: " + message + "\x1B[0m");
26128
- append("WARNING: " + message);
26129
- };
26130
- var errMsg = (e) => e instanceof Error ? e.message : String(e);
26131
- var exists = (p) => fs5.existsSync(p);
26132
- var mkdirp = (p) => {
26133
- fs5.mkdirSync(p, { recursive: true });
26134
- return p;
26135
- };
27173
+ // src/guest/runtime/process.ts
27174
+ import path11 from "node:path";
27175
+ import { spawnSync as spawnSync2 } from "node:child_process";
26136
27176
  var exec = (file2, args, options = {}) => {
26137
- const result = spawnSync(file2, args, { stdio: "inherit", windowsHide: true, ...options });
27177
+ const result = spawnSync2(file2, args, { stdio: "inherit", windowsHide: true, ...options });
26138
27178
  if (result.error) throw result.error;
26139
- if (result.status !== 0) throw new Error(path6.basename(file2) + " " + args.slice(0, 3).join(" ") + " failed with exit code " + result.status);
27179
+ if (result.status !== 0)
27180
+ throw new Error(path11.basename(file2) + " " + args.slice(0, 3).join(" ") + " failed with exit code " + result.status);
26140
27181
  };
26141
27182
  var execAsync = async (file2, args, options = {}) => {
26142
27183
  const code = await spawnAsync(file2, args, { stdio: "inherit", ...options });
26143
- if (code !== 0) throw new Error(path6.basename(file2) + " " + args.slice(0, 3).join(" ") + " failed with exit code " + code);
27184
+ if (code !== 0)
27185
+ throw new Error(path11.basename(file2) + " " + args.slice(0, 3).join(" ") + " failed with exit code " + code);
26144
27186
  };
26145
27187
  var powershell = (script) => exec(SYSTEM.powershell(), ["-NoLogo", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", script]);
26146
27188
 
26147
- // src/guest/toolchains/common.ts
26148
- import fs6 from "node:fs";
26149
- import path7 from "node:path";
27189
+ // src/guest/runtime/fs.ts
27190
+ import fs9 from "node:fs";
27191
+ var exists = (p) => fs9.existsSync(p);
27192
+ var mkdirp = (p) => {
27193
+ fs9.mkdirSync(p, { recursive: true });
27194
+ return p;
27195
+ };
26150
27196
 
26151
- // src/guest/project-context.ts
26152
- import { AsyncLocalStorage } from "node:async_hooks";
26153
- var store = new AsyncLocalStorage();
26154
- var projectWorkspace = () => store.getStore()?.workspace ?? workspace;
26155
- var duringSession = () => store.getStore()?.duringSession ?? false;
27197
+ // src/guest/toolchains/languages/java.ts
27198
+ import fs13 from "node:fs";
27199
+ import path14 from "node:path";
27200
+
27201
+ // src/guest/toolchains/tool-env.ts
27202
+ import path12 from "node:path";
27203
+ function emptyEnv() {
27204
+ return { vars: {}, prepend: [], append: [], summary: [] };
27205
+ }
27206
+ var arch = process.arch === "arm64" ? "arm64" : "x64";
27207
+ function tool(...parts) {
27208
+ return path12.join(toolsDir, ...parts);
27209
+ }
27210
+
27211
+ // src/guest/toolchains/version-cache.ts
27212
+ import fs11 from "node:fs";
27213
+
27214
+ // src/guest/toolchains/state-file.ts
27215
+ import fs10 from "node:fs";
27216
+ function readState(file2, schema, empty) {
27217
+ try {
27218
+ return schema.safeParse(JSON.parse(fs10.readFileSync(file2, "utf8").replace(/^\uFEFF/, ""))).data ?? empty;
27219
+ } catch {
27220
+ return empty;
27221
+ }
27222
+ }
27223
+
27224
+ // src/guest/toolchains/version-cache.ts
27225
+ var ResolvedSchema = external_exports.record(
27226
+ external_exports.string(),
27227
+ external_exports.union([external_exports.string(), external_exports.strictObject({ value: external_exports.string(), at: external_exports.number() })])
27228
+ );
27229
+ var FRESH_MS = 24 * 60 * 60 * 1e3;
27230
+ function isNetworkError(e) {
27231
+ return /fetch failed|timed? ?out|aborted|ENOTFOUND|EAI_AGAIN|ECONN|ENETUNREACH|EHOSTUNREACH|HTTP 5\d\d|socket/i.test(
27232
+ errMsg(e) + " " + String(e?.cause ?? "")
27233
+ );
27234
+ }
27235
+ var VersionCache = class {
27236
+ constructor(file2 = () => tool("resolved-versions.json")) {
27237
+ this.file = file2;
27238
+ }
27239
+ file;
27240
+ /** Set after a network failure: the remaining lookups go straight to the remembered versions. */
27241
+ offline = false;
27242
+ /**
27243
+ * Resolves a version online and remembers it for a day (provisioning.refresh looks again). After a network failure
27244
+ * the remaining lookups use the remembered versions instead of each waiting for the network; other errors (no such
27245
+ * version) do not.
27246
+ */
27247
+ async resolve(key, resolve) {
27248
+ const cached2 = this.remembered()[key];
27249
+ if (cached2 && (this.offline || !session.provisioning.refresh && Date.now() - cached2.at < FRESH_MS))
27250
+ return cached2.value;
27251
+ try {
27252
+ const value = await resolve();
27253
+ fs11.mkdirSync(toolsDir, { recursive: true });
27254
+ writeJsonAtomic(this.file(), { ...this.remembered(), [key]: { value, at: Date.now() } });
27255
+ return value;
27256
+ } catch (e) {
27257
+ if (isNetworkError(e)) this.offline = true;
27258
+ if (!cached2) throw e;
27259
+ warn(
27260
+ "Could not look up the latest " + key + " online (" + errMsg(e) + "); using " + cached2.value + " from an earlier start."
27261
+ );
27262
+ return cached2.value;
27263
+ }
27264
+ }
27265
+ remembered() {
27266
+ return Object.fromEntries(
27267
+ Object.entries(readState(this.file(), ResolvedSchema, {})).map(([k, v]) => [
27268
+ k,
27269
+ typeof v === "string" ? { value: v, at: 0 } : v
27270
+ ])
27271
+ );
27272
+ }
27273
+ };
27274
+ var versionCache = new VersionCache();
27275
+ function resolveCached(key, resolve) {
27276
+ return versionCache.resolve(key, resolve);
27277
+ }
26156
27278
 
26157
- // src/guest/toolchains/versions.ts
26158
- var specFromVersionFile = (text) => /(\d+(?:\.\d+){0,2})/.exec(text.split(/\r?\n/).map((l) => l.replace(/#.*$/, "").trim()).find(Boolean) ?? "")?.[1] ?? null;
27279
+ // src/guest/toolchains/detect.ts
27280
+ import fs12 from "node:fs";
27281
+ import path13 from "node:path";
27282
+
27283
+ // src/core/detect/versions.ts
27284
+ var specFromVersionFile = (text) => /(\d+(?:\.\d+){0,2})/.exec(
27285
+ text.split(/\r?\n/).map((l) => l.replace(/#.*$/, "").trim()).find(Boolean) ?? ""
27286
+ )?.[1] ?? null;
26159
27287
  var javaMajorFrom = (text, sdkmanrc = false) => {
26160
27288
  const line = sdkmanrc ? /^\s*java\s*=\s*(.+)$/m.exec(text)?.[1] : text;
26161
27289
  const spec = line ? specFromVersionFile(line) : null;
@@ -26164,15 +27292,49 @@ var javaMajorFrom = (text, sdkmanrc = false) => {
26164
27292
  return major === "1" && minor ? minor : major;
26165
27293
  };
26166
27294
 
26167
- // src/core/detect-toolchains.ts
27295
+ // src/core/detect/toolchains.ts
26168
27296
  var MARKERS = {
26169
- python: ["pyproject.toml", "requirements.txt", "setup.py", "setup.cfg", "Pipfile", "uv.lock", "poetry.lock", ".python-version", "*.py", "*.ipynb"],
27297
+ python: [
27298
+ "pyproject.toml",
27299
+ "requirements.txt",
27300
+ "setup.py",
27301
+ "setup.cfg",
27302
+ "Pipfile",
27303
+ "uv.lock",
27304
+ "poetry.lock",
27305
+ ".python-version",
27306
+ "*.py",
27307
+ "*.ipynb"
27308
+ ],
26170
27309
  rust: ["Cargo.toml", "rust-toolchain", "rust-toolchain.toml"],
26171
27310
  msvc: ["*.vcxproj", "CMakePresets.json", "CMakeUserPresets.json"],
26172
- cpp: ["CMakeLists.txt", "Makefile", "meson.build", "premake5.lua", "Cargo.toml", "*.vcxproj", "*.c", "*.cpp", "*.cc", "*.h", "*.hpp"],
27311
+ cpp: [
27312
+ "CMakeLists.txt",
27313
+ "Makefile",
27314
+ "meson.build",
27315
+ "premake5.lua",
27316
+ "Cargo.toml",
27317
+ "*.vcxproj",
27318
+ "*.c",
27319
+ "*.cpp",
27320
+ "*.cc",
27321
+ "*.h",
27322
+ "*.hpp"
27323
+ ],
26173
27324
  dotnet: ["*.sln", "*.slnx", "*.csproj", "*.fsproj", "*.vbproj", "global.json", "*.cs"],
26174
27325
  go: ["go.mod", "go.work", "*.go"],
26175
- java: ["pom.xml", "build.gradle", "build.gradle.kts", "settings.gradle", "settings.gradle.kts", "mvnw", "gradlew", ".java-version", ".sdkmanrc", "*.java"],
27326
+ java: [
27327
+ "pom.xml",
27328
+ "build.gradle",
27329
+ "build.gradle.kts",
27330
+ "settings.gradle",
27331
+ "settings.gradle.kts",
27332
+ "mvnw",
27333
+ "gradlew",
27334
+ ".java-version",
27335
+ ".sdkmanrc",
27336
+ "*.java"
27337
+ ],
26176
27338
  ruby: ["Gemfile", "*.gemspec", ".ruby-version", "*.rb"],
26177
27339
  php: ["composer.json", "artisan", ".php-version", "*.php"],
26178
27340
  deno: ["deno.json", "deno.jsonc", "deno.lock"],
@@ -26182,117 +27344,89 @@ var MARKERS = {
26182
27344
  var AUTO_TOOLCHAINS = Object.keys(MARKERS);
26183
27345
  var PROJECT_FILES = [.../* @__PURE__ */ new Set([...Object.values(MARKERS).flat(), "package.json", "deno.json", "*.ts", "*.js"])];
26184
27346
 
26185
- // src/guest/toolchains/common.ts
26186
- var emptyEnv = () => ({ vars: {}, prepend: [], append: [], summary: [] });
26187
- var arch = process.arch === "arm64" ? "arm64" : "x64";
26188
- var tool = (...parts) => path7.join(toolsDir, ...parts);
26189
- var readState = (file2, schema, empty) => {
26190
- try {
26191
- return schema.safeParse(JSON.parse(fs6.readFileSync(file2, "utf8").replace(/^/, ""))).data ?? empty;
26192
- } catch {
26193
- return empty;
26194
- }
26195
- };
26196
- var Resolved = external_exports.record(external_exports.string(), external_exports.union([external_exports.string(), external_exports.strictObject({ value: external_exports.string(), at: external_exports.number() })]));
26197
- var resolvedFile = () => tool("resolved-versions.json");
26198
- var remembered = () => Object.fromEntries(Object.entries(readState(resolvedFile(), Resolved, {})).map(([k, v]) => [k, typeof v === "string" ? { value: v, at: 0 } : v]));
26199
- var FRESH_MS = 24 * 60 * 60 * 1e3;
26200
- var offline = false;
26201
- var networkError = (e) => /fetch failed|timed? ?out|aborted|ENOTFOUND|EAI_AGAIN|ECONN|ENETUNREACH|EHOSTUNREACH|HTTP 5\d\d|socket/i.test(errMsg(e) + " " + String(e?.cause ?? ""));
26202
- var resolveCached = async (key, resolve) => {
26203
- const cached2 = remembered()[key];
26204
- if (cached2 && (offline || !session.provisioning.refresh && Date.now() - cached2.at < FRESH_MS)) return cached2.value;
26205
- try {
26206
- const value = await resolve();
26207
- fs6.mkdirSync(toolsDir, { recursive: true });
26208
- writeJsonAtomic(resolvedFile(), { ...remembered(), [key]: { value, at: Date.now() } });
26209
- return value;
26210
- } catch (e) {
26211
- if (networkError(e)) offline = true;
26212
- if (!cached2) throw e;
26213
- warn("Could not look up the latest " + key + " online (" + errMsg(e) + "); using " + cached2.value + " from an earlier start.");
26214
- return cached2.value;
26215
- }
26216
- };
26217
- var installFromGithub = async (repo, pattern, o) => {
26218
- const asset = await githubAsset(repo, pattern, o.searchOlder);
26219
- log("Downloading " + (typeof o.what === "string" ? o.what : o.what(asset)) + " ...");
26220
- await installArchive(asset.url, o.dest, { sha256: asset.sha256, fileName: asset.name, ...o.locate ? { locate: o.locate } : {}, ...o.up ? { up: o.up } : {} });
26221
- };
26222
- var versionFromFiles = (files, parse3 = (t) => specFromVersionFile(t)) => {
27347
+ // src/guest/toolchains/detect.ts
27348
+ function versionFromFiles(files, parse3 = (t) => specFromVersionFile(t)) {
26223
27349
  for (const name of files) {
26224
- const file2 = path7.join(projectWorkspace(), name);
27350
+ const file2 = path13.join(projectWorkspace(), name);
26225
27351
  if (!exists(file2)) continue;
26226
- const spec = parse3(fs6.readFileSync(file2, "utf8"), name);
27352
+ const spec = parse3(fs12.readFileSync(file2, "utf8"), name);
26227
27353
  if (spec) return { spec, source: name };
26228
27354
  }
26229
27355
  return null;
26230
- };
26231
-
26232
- // src/guest/toolchains/databases/dynamodb.ts
26233
- import fs9 from "node:fs";
26234
- import path10 from "node:path";
26235
- import { spawn as spawn3 } from "node:child_process";
27356
+ }
26236
27357
 
26237
- // src/guest/toolchains/java.ts
26238
- import fs7 from "node:fs";
26239
- import path8 from "node:path";
27358
+ // src/guest/toolchains/languages/java.ts
26240
27359
  var ADOPTIUM = "https://api.adoptium.net/v3";
26241
27360
  var temurin = async (major) => {
26242
- const assets = await fetchJson(ADOPTIUM + "/assets/latest/" + major + "/hotspot?image_type=jdk&os=windows&vendor=eclipse&architecture=" + (arch === "arm64" ? "aarch64" : "x64"));
27361
+ const assets = await fetchJson(
27362
+ ADOPTIUM + "/assets/latest/" + major + "/hotspot?image_type=jdk&os=windows&vendor=eclipse&architecture=" + (arch === "arm64" ? "aarch64" : "x64")
27363
+ );
26243
27364
  return assets.find((a) => a.binary.package.name.endsWith(".zip")) ?? Promise.reject(new Error("No Temurin " + major + " JDK zip for Windows"));
26244
27365
  };
26245
27366
  var javaMajor = async (config2) => {
26246
- const fromProject = versionFromFiles([".java-version", ".sdkmanrc"], (text, name) => javaMajorFrom(text, name === ".sdkmanrc"));
27367
+ const fromProject = versionFromFiles(
27368
+ [".java-version", ".sdkmanrc"],
27369
+ (text, name) => javaMajorFrom(text, name === ".sdkmanrc")
27370
+ );
26247
27371
  if (fromProject) return { major: fromProject.spec, source: fromProject.source };
26248
27372
  const spec = config2.version.trim().toLowerCase();
26249
27373
  if (spec !== "lts") return { major: javaMajorFrom(spec) ?? spec, source: "config" };
26250
- const lts = await resolveCached("java:lts", async () => String((await fetchJson(ADOPTIUM + "/info/available_releases")).most_recent_lts));
27374
+ const lts = await resolveCached(
27375
+ "java:lts",
27376
+ async () => String((await fetchJson(ADOPTIUM + "/info/available_releases")).most_recent_lts)
27377
+ );
26251
27378
  return { major: lts, source: "newest LTS" };
26252
27379
  };
26253
27380
  var setupJdk = async (env, config2) => {
26254
27381
  const { major, source } = await javaMajor(config2);
26255
27382
  const release = await resolveCached("java:" + major, async () => (await temurin(major)).release_name);
26256
27383
  const home = tool("java", release.replace(/[^A-Za-z0-9.-]/g, "_"));
26257
- if (!exists(path8.join(home, "bin", "java.exe"))) {
27384
+ if (!exists(path14.join(home, "bin", "java.exe"))) {
26258
27385
  const asset = await temurin(major);
26259
27386
  log("Downloading Java " + release + " (JDK, ~200 MB once) ...");
26260
- await installArchive(asset.binary.package.link, home, { sha256: asset.binary.package.checksum, locate: "release", fileName: asset.binary.package.name });
27387
+ await downloader.archive(asset.binary.package.link, home, {
27388
+ sha256: asset.binary.package.checksum,
27389
+ locate: "release",
27390
+ fileName: asset.binary.package.name
27391
+ });
26261
27392
  }
26262
27393
  env.vars.JAVA_HOME = home;
26263
- env.prepend.push(path8.join(home, "bin"));
27394
+ env.prepend.push(path14.join(home, "bin"));
26264
27395
  env.summary.push("java: " + release + " (Temurin, from " + source + ")");
26265
27396
  };
26266
- var ensureJdk = async () => {
27397
+ async function ensureJdk() {
26267
27398
  const root = tool("java");
26268
- const installed = exists(root) ? fs7.readdirSync(root).filter((d) => exists(path8.join(root, d, "bin", "java.exe"))).sort((a, b) => b.localeCompare(a, void 0, { numeric: true })) : [];
26269
- if (installed.length) return path8.join(root, installed[0]);
27399
+ const installed = exists(root) ? fs13.readdirSync(root).filter((d) => exists(path14.join(root, d, "bin", "java.exe"))).sort((a, b) => b.localeCompare(a, void 0, { numeric: true })) : [];
27400
+ if (installed.length) return path14.join(root, installed[0]);
26270
27401
  const scratch = emptyEnv();
26271
27402
  await setupJdk(scratch, { enabled: true, version: "lts", maven: false, gradle: false });
26272
27403
  return scratch.vars.JAVA_HOME;
26273
- };
27404
+ }
26274
27405
 
26275
- // src/guest/toolchains/databases/server.ts
26276
- import fs8 from "node:fs";
26277
- import path9 from "node:path";
27406
+ // src/guest/databases/server.ts
27407
+ import fs14 from "node:fs";
27408
+ import path15 from "node:path";
26278
27409
  import { spawn as spawn2 } from "node:child_process";
26279
- var dataFor = (name) => path9.join(dataDir, "databases", name);
26280
- var startServer = async (name, exe, args, port) => {
27410
+ function dataFor(name) {
27411
+ return path15.join(dataDir, "databases", name);
27412
+ }
27413
+ async function startServer(name, exe, args, port) {
26281
27414
  if (await portOpen(port)) throw new Error("port " + port + " is already in use (change databases." + name + ".port)");
26282
- const logFile2 = path9.join(logsDir, name + ".log");
26283
- const out = fs8.openSync(logFile2, "a");
27415
+ const logFile2 = path15.join(logsDir, name + ".log");
27416
+ const out = fs14.openSync(logFile2, "a");
26284
27417
  spawn2(exe, args, { detached: true, stdio: ["ignore", out, out], windowsHide: true }).unref();
26285
- fs8.closeSync(out);
26286
- if (!await waitForPort(port, 60)) throw new Error(name + " did not start listening on port " + port + "; see " + logFile2);
26287
- };
26288
- var clearStaleLocks = async (dir, files, port) => {
27418
+ fs14.closeSync(out);
27419
+ if (!await waitForPort(port, 60))
27420
+ throw new Error(name + " did not start listening on port " + port + "; see " + logFile2);
27421
+ }
27422
+ async function clearStaleLocks(dir, files, port) {
26289
27423
  if (await portOpen(port)) return;
26290
- for (const f of files) fs8.rmSync(path9.join(dir, f), { force: true });
26291
- };
26292
- var createOnce = async (data, marker, create) => {
26293
- if (exists(path9.join(data, marker))) return;
27424
+ for (const f of files) fs14.rmSync(path15.join(dir, f), { force: true });
27425
+ }
27426
+ async function createOnce(data, marker, create) {
27427
+ if (exists(path15.join(data, marker))) return;
26294
27428
  const existed = exists(data);
26295
- mkdirp(path9.dirname(data));
27429
+ mkdirp(path15.dirname(data));
26296
27430
  try {
26297
27431
  await create();
26298
27432
  } catch (e) {
@@ -26304,192 +27438,335 @@ var createOnce = async (data, marker, create) => {
26304
27438
  }
26305
27439
  throw e;
26306
27440
  }
26307
- };
27441
+ }
26308
27442
 
26309
- // src/guest/toolchains/databases/dynamodb.ts
27443
+ // src/guest/databases/dynamodb.ts
26310
27444
  var DYNAMO_ZIP = "https://d1ni2b6xgvw0s0.cloudfront.net/v2.x/dynamodb_local_latest.zip";
26311
- var setupDynamo = async (env, plan) => {
26312
- const java = path10.join(await ensureJdk(), "bin", "java.exe");
26313
- const home = tool("dynamodb-local");
26314
- if (!exists(path10.join(home, "DynamoDBLocal.jar"))) {
26315
- log("Downloading DynamoDB Local (~60 MB once) ...");
26316
- const sha256 = (await fetchText(DYNAMO_ZIP + ".sha256")).trim().split(/\s+/)[0];
26317
- await installArchive(DYNAMO_ZIP, home, { sha256, locate: "DynamoDBLocal.jar", fileName: "dynamodb_local.zip" });
26318
- }
26319
- const data = mkdirp(dataFor("dynamodb"));
26320
- await startServer("dynamodb", java, ["-Djava.library.path=" + path10.join(home, "DynamoDBLocal_lib"), "-jar", path10.join(home, "DynamoDBLocal.jar"), "-sharedDb", "-dbPath", data, "-port", String(plan.port)], plan.port);
26321
- const endpoint = "http://localhost:" + plan.port;
26322
- const aws = { AWS_ENDPOINT_URL_DYNAMODB: endpoint, DYNAMO_ENDPOINT: endpoint, AWS_ACCESS_KEY_ID: "local", AWS_SECRET_ACCESS_KEY: "local", AWS_REGION: "us-east-1", AWS_DEFAULT_REGION: "us-east-1" };
26323
- Object.assign(env.vars, aws);
26324
- env.summary.push("dynamodb (DynamoDB Local): " + endpoint + " (AWS SDKs use it automatically via AWS_ENDPOINT_URL_DYNAMODB; dummy credentials)");
26325
- if (!plan.adminPort) return;
26326
- const prefix = tool("dynamodb-admin");
26327
- const script = path10.join(prefix, "node_modules", "dynamodb-admin", "dist", "dynamodb-admin.js");
26328
- if (!exists(script)) {
26329
- log("Installing dynamodb-admin, the DynamoDB web UI (~20 MB once) ...");
26330
- const npmCli = path10.join(path10.dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js");
26331
- await execAsync(process.execPath, [npmCli, "install", "--global", "--prefix", prefix, "dynamodb-admin", "--no-fund", "--no-audit"], { stdio: "ignore" });
26332
- }
26333
- if (await portOpen(plan.adminPort)) {
26334
- env.summary.push("dynamodb-admin: NOT started, port " + plan.adminPort + " is in use (change databases.dynamodb.adminPort)");
26335
- return;
27445
+ var DynamoServer = class extends DatabaseServer {
27446
+ id = "dynamodb";
27447
+ /**
27448
+ * Amazon's DynamoDB Local (a Java program; the Java toolchain step runs first, else this installs the LTS JDK) and
27449
+ * dynamodb-admin, the web UI to browse and edit tables, installed with the runner's own npm. Every AWS SDK picks the
27450
+ * local endpoint up from AWS_ENDPOINT_URL_DYNAMODB, with dummy credentials (real ones never reach the sandbox).
27451
+ */
27452
+ async start(env, plan) {
27453
+ const java = path16.join(await ensureJdk(), "bin", "java.exe");
27454
+ const home = tool("dynamodb-local");
27455
+ if (!exists(path16.join(home, "DynamoDBLocal.jar"))) {
27456
+ log("Downloading DynamoDB Local (~60 MB once) ...");
27457
+ const sha256 = (await fetchText(DYNAMO_ZIP + ".sha256")).trim().split(/\s+/)[0];
27458
+ await downloader.archive(DYNAMO_ZIP, home, {
27459
+ sha256,
27460
+ locate: "DynamoDBLocal.jar",
27461
+ fileName: "dynamodb_local.zip"
27462
+ });
27463
+ }
27464
+ const data = mkdirp(dataFor("dynamodb"));
27465
+ await startServer(
27466
+ "dynamodb",
27467
+ java,
27468
+ [
27469
+ "-Djava.library.path=" + path16.join(home, "DynamoDBLocal_lib"),
27470
+ "-jar",
27471
+ path16.join(home, "DynamoDBLocal.jar"),
27472
+ "-sharedDb",
27473
+ "-dbPath",
27474
+ data,
27475
+ "-port",
27476
+ String(plan.port)
27477
+ ],
27478
+ plan.port
27479
+ );
27480
+ const endpoint = "http://localhost:" + plan.port;
27481
+ const aws = {
27482
+ AWS_ENDPOINT_URL_DYNAMODB: endpoint,
27483
+ DYNAMO_ENDPOINT: endpoint,
27484
+ AWS_ACCESS_KEY_ID: "local",
27485
+ AWS_SECRET_ACCESS_KEY: "local",
27486
+ AWS_REGION: "us-east-1",
27487
+ AWS_DEFAULT_REGION: "us-east-1"
27488
+ };
27489
+ Object.assign(env.vars, aws);
27490
+ env.summary.push(
27491
+ "dynamodb (DynamoDB Local): " + endpoint + " (AWS SDKs use it automatically via AWS_ENDPOINT_URL_DYNAMODB; dummy credentials)"
27492
+ );
27493
+ if (!plan.adminPort) return;
27494
+ const prefix = tool("dynamodb-admin");
27495
+ const script = path16.join(prefix, "node_modules", "dynamodb-admin", "dist", "dynamodb-admin.js");
27496
+ if (!exists(script)) {
27497
+ log("Installing dynamodb-admin, the DynamoDB web UI (~20 MB once) ...");
27498
+ const npmCli = path16.join(path16.dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js");
27499
+ await execAsync(
27500
+ process.execPath,
27501
+ [npmCli, "install", "--global", "--prefix", prefix, "dynamodb-admin", "--no-fund", "--no-audit"],
27502
+ { stdio: "ignore" }
27503
+ );
27504
+ }
27505
+ if (await portOpen(plan.adminPort)) {
27506
+ env.summary.push(
27507
+ "dynamodb-admin: NOT started, port " + plan.adminPort + " is in use (change databases.dynamodb.adminPort)"
27508
+ );
27509
+ return;
27510
+ }
27511
+ const out = fs15.openSync(path16.join(logsDir, "dynamodb-admin.log"), "a");
27512
+ spawn3(
27513
+ process.execPath,
27514
+ [script, "--port", String(plan.adminPort), "--dynamo-endpoint", endpoint, "--skip-default-credentials"],
27515
+ { detached: true, stdio: ["ignore", out, out], windowsHide: true, env: { ...process.env, ...aws } }
27516
+ ).unref();
27517
+ fs15.closeSync(out);
27518
+ if (!await waitForPort(plan.adminPort, 30))
27519
+ throw new Error("dynamodb-admin did not start; see " + path16.join(logsDir, "dynamodb-admin.log"));
27520
+ env.summary.push(
27521
+ "dynamodb-admin: http://localhost:" + plan.adminPort + " (browse and edit tables in the sandbox's browser)"
27522
+ );
26336
27523
  }
26337
- const out = fs9.openSync(path10.join(logsDir, "dynamodb-admin.log"), "a");
26338
- spawn3(process.execPath, [script, "--port", String(plan.adminPort), "--dynamo-endpoint", endpoint, "--skip-default-credentials"], { detached: true, stdio: ["ignore", out, out], windowsHide: true, env: { ...process.env, ...aws } }).unref();
26339
- fs9.closeSync(out);
26340
- if (!await waitForPort(plan.adminPort, 30)) throw new Error("dynamodb-admin did not start; see " + path10.join(logsDir, "dynamodb-admin.log"));
26341
- env.summary.push("dynamodb-admin: http://localhost:" + plan.adminPort + " (browse and edit tables in the sandbox's browser)");
26342
27524
  };
26343
27525
 
26344
- // src/guest/toolchains/databases/mongodb.ts
26345
- import path11 from "node:path";
26346
- var setupMongo = async (env, plan) => {
26347
- const find2 = async () => {
26348
- const { versions } = await fetchJson("https://downloads.mongodb.org/full.json");
26349
- const prod = versions.filter((v) => v.production_release);
26350
- const hit = plan.version === "latest" ? prod[0] : prod.find((v) => v.version === plan.version || v.version.startsWith(plan.version + "."));
26351
- const archive = hit?.downloads.find((d) => d.target === "windows" && d.arch === "x86_64" && d.edition === "base")?.archive;
26352
- return hit && archive ? { version: hit.version, archive } : Promise.reject(new Error("No MongoDB " + plan.version + " for Windows"));
26353
- };
26354
- const version2 = await resolveCached("mongodb:" + plan.version, async () => (await find2()).version);
26355
- const home = tool("mongodb", version2);
26356
- if (!exists(path11.join(home, "bin", "mongod.exe"))) {
26357
- const { archive } = await find2();
26358
- log("Downloading MongoDB " + version2 + " (~400 MB once) ...");
26359
- await installArchive(archive.url, home, { sha256: archive.sha256, locate: "mongod.exe", up: 1 });
26360
- }
26361
- const shell = tool("mongosh");
26362
- if (!exists(path11.join(shell, "mongosh.exe"))) {
26363
- await installFromGithub("mongodb-js/mongosh", /^mongosh-[\d.]+-win32-x64\.zip$/, { dest: shell, what: "mongosh, the MongoDB shell (~50 MB once)", locate: "mongosh.exe" });
26364
- }
26365
- const data = mkdirp(dataFor("mongodb"));
26366
- await clearStaleLocks(data, ["mongod.lock"], plan.port);
26367
- await startServer("mongodb", path11.join(home, "bin", "mongod.exe"), ["--dbpath", data, "--bind_ip", "127.0.0.1", "--port", String(plan.port)], plan.port);
26368
- env.prepend.push(path11.join(home, "bin"), shell);
26369
- env.summary.push("mongodb " + version2 + ": mongodb://127.0.0.1:" + plan.port + " (mongosh on PATH)");
27526
+ // src/guest/databases/mongodb.ts
27527
+ import path17 from "node:path";
27528
+
27529
+ // src/guest/toolchains/install.ts
27530
+ async function installFromGithub(repo, pattern, o) {
27531
+ const asset = await githubAsset(repo, pattern, o.searchOlder);
27532
+ log("Downloading " + (typeof o.what === "string" ? o.what : o.what(asset)) + " ...");
27533
+ await downloader.archive(asset.url, o.dest, {
27534
+ sha256: asset.sha256,
27535
+ fileName: asset.name,
27536
+ ...o.locate ? { locate: o.locate } : {},
27537
+ ...o.up ? { up: o.up } : {}
27538
+ });
27539
+ }
27540
+
27541
+ // src/guest/databases/mongodb.ts
27542
+ var MongoServer = class extends DatabaseServer {
27543
+ id = "mongodb";
27544
+ async start(env, plan) {
27545
+ const find2 = async () => {
27546
+ const { versions } = await fetchJson("https://downloads.mongodb.org/full.json");
27547
+ const prod = versions.filter((v) => v.production_release);
27548
+ const hit = plan.version === "latest" ? prod[0] : prod.find((v) => v.version === plan.version || v.version.startsWith(plan.version + "."));
27549
+ const archive = hit?.downloads.find(
27550
+ (d) => d.target === "windows" && d.arch === "x86_64" && d.edition === "base"
27551
+ )?.archive;
27552
+ return hit && archive ? { version: hit.version, archive } : Promise.reject(new Error("No MongoDB " + plan.version + " for Windows"));
27553
+ };
27554
+ const version2 = await resolveCached("mongodb:" + plan.version, async () => (await find2()).version);
27555
+ const home = tool("mongodb", version2);
27556
+ if (!exists(path17.join(home, "bin", "mongod.exe"))) {
27557
+ const { archive } = await find2();
27558
+ log("Downloading MongoDB " + version2 + " (~400 MB once) ...");
27559
+ await downloader.archive(archive.url, home, { sha256: archive.sha256, locate: "mongod.exe", up: 1 });
27560
+ }
27561
+ const shell = tool("mongosh");
27562
+ if (!exists(path17.join(shell, "mongosh.exe"))) {
27563
+ await installFromGithub("mongodb-js/mongosh", /^mongosh-[\d.]+-win32-x64\.zip$/, {
27564
+ dest: shell,
27565
+ what: "mongosh, the MongoDB shell (~50 MB once)",
27566
+ locate: "mongosh.exe"
27567
+ });
27568
+ }
27569
+ const data = mkdirp(dataFor("mongodb"));
27570
+ await clearStaleLocks(data, ["mongod.lock"], plan.port);
27571
+ await startServer(
27572
+ "mongodb",
27573
+ path17.join(home, "bin", "mongod.exe"),
27574
+ ["--dbpath", data, "--bind_ip", "127.0.0.1", "--port", String(plan.port)],
27575
+ plan.port
27576
+ );
27577
+ env.prepend.push(path17.join(home, "bin"), shell);
27578
+ env.summary.push("mongodb " + version2 + ": mongodb://127.0.0.1:" + plan.port + " (mongosh on PATH)");
27579
+ }
26370
27580
  };
26371
27581
 
26372
- // src/guest/toolchains/databases/mysql.ts
26373
- import path12 from "node:path";
27582
+ // src/guest/databases/mysql.ts
27583
+ import path18 from "node:path";
26374
27584
  var MARIA = "https://downloads.mariadb.org/rest-api/mariadb/";
26375
- var setupMysql = async (env, plan) => {
26376
- const series = await resolveCached("mariadb:" + plan.version, async () => {
26377
- if (plan.version !== "lts") return plan.version;
26378
- const { major_releases: all } = await fetchJson(MARIA);
26379
- return all.find((r) => r.release_status === "Stable" && r.release_support_type === "Long Term Support")?.release_id ?? Promise.reject(new Error("No MariaDB LTS release found"));
26380
- });
26381
- const latest = async () => {
26382
- const { releases } = await fetchJson(MARIA + series + "/latest/");
26383
- const [version3, release] = Object.entries(releases)[0] ?? [];
26384
- const zip = release?.files.find((f) => /-winx64\.zip$/.test(f.file_name));
26385
- return zip ? { version: version3, zip } : Promise.reject(new Error("No MariaDB " + series + " zip for Windows"));
26386
- };
26387
- const version2 = await resolveCached("mariadb-version:" + series, async () => (await latest()).version);
26388
- const home = tool("mariadb", version2);
26389
- const bin = path12.join(home, "bin");
26390
- if (!exists(path12.join(bin, "mariadbd.exe"))) {
26391
- const { zip } = await latest();
26392
- log("Downloading MariaDB " + version2 + " (~90 MB once) ...");
26393
- await installArchive(zip.file_download_url.replace(/^http:/, "https:"), home, { sha256: zip.checksum?.sha256sum ?? null, locate: "mariadbd.exe", up: 1, fileName: zip.file_name });
26394
- }
26395
- const data = dataFor("mariadb");
26396
- await createOnce(data, "mysql", async () => {
26397
- log("Creating the MariaDB database (first start) ...");
26398
- await execAsync(path12.join(bin, "mariadb-install-db.exe"), ["--datadir=" + data, "--port=" + plan.port], { stdio: "ignore" });
26399
- });
26400
- await startServer("mysql", path12.join(bin, "mariadbd.exe"), ["--datadir=" + data, "--port=" + plan.port, "--bind-address=127.0.0.1", "--console"], plan.port);
26401
- Object.assign(env.vars, { MYSQL_HOST: "127.0.0.1", MYSQL_TCP_PORT: String(plan.port) });
26402
- env.prepend.push(bin);
26403
- env.summary.push("mysql (MariaDB " + version2 + "): 127.0.0.1:" + plan.port + ", user root, no password (mysql://root@127.0.0.1:" + plan.port + ")");
27585
+ var MysqlServer = class extends DatabaseServer {
27586
+ id = "mysql";
27587
+ async start(env, plan) {
27588
+ const series = await resolveCached("mariadb:" + plan.version, async () => {
27589
+ if (plan.version !== "lts") return plan.version;
27590
+ const { major_releases: all } = await fetchJson(MARIA);
27591
+ return all.find((r) => r.release_status === "Stable" && r.release_support_type === "Long Term Support")?.release_id ?? Promise.reject(new Error("No MariaDB LTS release found"));
27592
+ });
27593
+ const latest = async () => {
27594
+ const { releases } = await fetchJson(MARIA + series + "/latest/");
27595
+ const [version3, release] = Object.entries(releases)[0] ?? [];
27596
+ const zip = release?.files.find((f) => /-winx64\.zip$/.test(f.file_name));
27597
+ return zip ? { version: version3, zip } : Promise.reject(new Error("No MariaDB " + series + " zip for Windows"));
27598
+ };
27599
+ const version2 = await resolveCached("mariadb-version:" + series, async () => (await latest()).version);
27600
+ const home = tool("mariadb", version2);
27601
+ const bin = path18.join(home, "bin");
27602
+ if (!exists(path18.join(bin, "mariadbd.exe"))) {
27603
+ const { zip } = await latest();
27604
+ log("Downloading MariaDB " + version2 + " (~90 MB once) ...");
27605
+ await downloader.archive(zip.file_download_url.replace(/^http:/, "https:"), home, {
27606
+ sha256: zip.checksum?.sha256sum ?? null,
27607
+ locate: "mariadbd.exe",
27608
+ up: 1,
27609
+ fileName: zip.file_name
27610
+ });
27611
+ }
27612
+ const data = dataFor("mariadb");
27613
+ await createOnce(data, "mysql", async () => {
27614
+ log("Creating the MariaDB database (first start) ...");
27615
+ await execAsync(path18.join(bin, "mariadb-install-db.exe"), ["--datadir=" + data, "--port=" + plan.port], {
27616
+ stdio: "ignore"
27617
+ });
27618
+ });
27619
+ await startServer(
27620
+ "mysql",
27621
+ path18.join(bin, "mariadbd.exe"),
27622
+ ["--datadir=" + data, "--port=" + plan.port, "--bind-address=127.0.0.1", "--console"],
27623
+ plan.port
27624
+ );
27625
+ Object.assign(env.vars, { MYSQL_HOST: "127.0.0.1", MYSQL_TCP_PORT: String(plan.port) });
27626
+ env.prepend.push(bin);
27627
+ env.summary.push(
27628
+ "mysql (MariaDB " + version2 + "): 127.0.0.1:" + plan.port + ", user root, no password (mysql://root@127.0.0.1:" + plan.port + ")"
27629
+ );
27630
+ }
26404
27631
  };
26405
27632
 
26406
- // src/guest/toolchains/databases/postgres.ts
26407
- import path13 from "node:path";
26408
- var postgresData = (version2) => dataFor("postgres-" + version2.split(".")[0]);
26409
- var setupPostgres = async (env, plan) => {
26410
- const exact = await resolveCached("postgres:" + plan.version, async () => {
26411
- const versions = (await fetchJson("https://www.postgresql.org/versions.json")).filter((v) => v.supported);
26412
- const hit = plan.version === "latest" ? versions.find((v) => v.current) ?? versions[versions.length - 1] : versions.find((v) => v.major === plan.version.split(".")[0]);
26413
- return hit ? hit.major + "." + hit.latestMinor : Promise.reject(new Error("No supported PostgreSQL " + plan.version));
26414
- });
26415
- const home = tool("postgres", exact);
26416
- const bin = path13.join(home, "bin");
26417
- if (!exists(path13.join(bin, "pg_ctl.exe"))) {
26418
- log("Downloading PostgreSQL " + exact + " (~330 MB once) ...");
26419
- await installArchive("https://get.enterprisedb.com/postgresql/postgresql-" + exact + "-1-windows-x64-binaries.zip", home, {
26420
- locate: "pg_ctl.exe",
26421
- up: 1,
26422
- fileName: "postgresql-" + exact + ".zip",
26423
- members: ["pgsql/bin", "pgsql/lib", "pgsql/share", "pgsql/include"]
27633
+ // src/guest/databases/postgres.ts
27634
+ import fs16 from "node:fs";
27635
+ import path19 from "node:path";
27636
+ function postgresData(version2) {
27637
+ return dataFor("postgres-" + version2.split(".")[0]);
27638
+ }
27639
+ var PostgresServer = class extends DatabaseServer {
27640
+ id = "postgres";
27641
+ async start(env, plan) {
27642
+ const exact = await resolveCached("postgres:" + plan.version, async () => {
27643
+ const versions = (await fetchJson("https://www.postgresql.org/versions.json")).filter(
27644
+ (v) => v.supported
27645
+ );
27646
+ const hit = plan.version === "latest" ? versions.find((v) => v.current) ?? versions[versions.length - 1] : versions.find((v) => v.major === plan.version.split(".")[0]);
27647
+ return hit ? hit.major + "." + hit.latestMinor : Promise.reject(new Error("No supported PostgreSQL " + plan.version));
27648
+ });
27649
+ const home = tool("postgres", exact);
27650
+ const bin = path19.join(home, "bin");
27651
+ if (!exists(path19.join(bin, "pg_ctl.exe"))) {
27652
+ log("Downloading PostgreSQL " + exact + " (~330 MB once) ...");
27653
+ await downloader.archive(
27654
+ "https://get.enterprisedb.com/postgresql/postgresql-" + exact + "-1-windows-x64-binaries.zip",
27655
+ home,
27656
+ {
27657
+ locate: "pg_ctl.exe",
27658
+ up: 1,
27659
+ fileName: "postgresql-" + exact + ".zip",
27660
+ members: ["pgsql/bin", "pgsql/lib", "pgsql/share", "pgsql/include"]
27661
+ }
27662
+ );
27663
+ }
27664
+ const data = postgresData(exact);
27665
+ await createOnce(data, "PG_VERSION", async () => {
27666
+ log("Creating the PostgreSQL database (first start) ...");
27667
+ await execAsync(
27668
+ path19.join(bin, "initdb.exe"),
27669
+ ["-D", data, "-U", "postgres", "-A", "trust", "-E", "UTF8", "--locale=C"],
27670
+ { stdio: "ignore" }
27671
+ );
26424
27672
  });
27673
+ if (await portOpen(plan.port))
27674
+ throw new Error("port " + plan.port + " is already in use (change databases.postgres.port)");
27675
+ await clearStaleLocks(data, ["postmaster.pid"], plan.port);
27676
+ await execAsync(
27677
+ path19.join(bin, "pg_ctl.exe"),
27678
+ [
27679
+ "start",
27680
+ "-D",
27681
+ data,
27682
+ "-w",
27683
+ "-t",
27684
+ "60",
27685
+ "-l",
27686
+ path19.join(logsDir, "postgres.log"),
27687
+ "-o",
27688
+ "-p " + plan.port + " -c listen_addresses=localhost"
27689
+ ],
27690
+ { stdio: "ignore" }
27691
+ );
27692
+ Object.assign(env.vars, { PGHOST: "localhost", PGPORT: String(plan.port), PGUSER: "postgres" });
27693
+ env.prepend.push(bin);
27694
+ env.summary.push(
27695
+ "postgres " + exact + ": localhost:" + plan.port + ", user postgres, no password (postgres://postgres@localhost:" + plan.port + "/postgres)"
27696
+ );
27697
+ }
27698
+ /** Every installed version's cluster shuts down cleanly through pg_ctl first. */
27699
+ async stop(plan) {
27700
+ if (exists(tool("postgres"))) {
27701
+ for (const version2 of fs16.readdirSync(tool("postgres"))) {
27702
+ const data = postgresData(version2);
27703
+ const pgCtl = path19.join(tool("postgres", version2), "bin", "pg_ctl.exe");
27704
+ if (exists(path19.join(data, "postmaster.pid")) && exists(pgCtl))
27705
+ await execAsync(pgCtl, ["stop", "-D", data, "-m", "fast", "-w"], { stdio: "ignore" });
27706
+ }
27707
+ }
27708
+ await super.stop(plan);
26425
27709
  }
26426
- const data = postgresData(exact);
26427
- await createOnce(data, "PG_VERSION", async () => {
26428
- log("Creating the PostgreSQL database (first start) ...");
26429
- await execAsync(path13.join(bin, "initdb.exe"), ["-D", data, "-U", "postgres", "-A", "trust", "-E", "UTF8", "--locale=C"], { stdio: "ignore" });
26430
- });
26431
- if (await portOpen(plan.port)) throw new Error("port " + plan.port + " is already in use (change databases.postgres.port)");
26432
- await clearStaleLocks(data, ["postmaster.pid"], plan.port);
26433
- await execAsync(path13.join(bin, "pg_ctl.exe"), ["start", "-D", data, "-w", "-t", "60", "-l", path13.join(logsDir, "postgres.log"), "-o", "-p " + plan.port + " -c listen_addresses=localhost"], { stdio: "ignore" });
26434
- Object.assign(env.vars, { PGHOST: "localhost", PGPORT: String(plan.port), PGUSER: "postgres" });
26435
- env.prepend.push(bin);
26436
- env.summary.push("postgres " + exact + ": localhost:" + plan.port + ", user postgres, no password (postgres://postgres@localhost:" + plan.port + "/postgres)");
26437
27710
  };
26438
27711
 
26439
- // src/guest/toolchains/databases/redis.ts
26440
- import path14 from "node:path";
26441
- var setupRedis = async (env, plan) => {
26442
- const home = tool("redis");
26443
- if (!exists(path14.join(home, "redis-server.exe"))) {
26444
- await installFromGithub("redis-windows/redis-windows", /^Redis-[\d.]+-Windows-x64-msys2\.zip$/, { dest: home, what: (a) => "Redis (" + a.name + ", ~10 MB once)", locate: "redis-server.exe" });
26445
- }
26446
- const data = mkdirp(dataFor("redis"));
26447
- await startServer("redis", path14.join(home, "redis-server.exe"), ["--port", String(plan.port), "--bind", "127.0.0.1", "--dir", data.replace(/\\/g, "/"), "--appendonly", "yes"], plan.port);
26448
- env.prepend.push(home);
26449
- env.summary.push("redis: redis://127.0.0.1:" + plan.port + " (redis-cli on PATH)");
27712
+ // src/guest/databases/redis.ts
27713
+ import path20 from "node:path";
27714
+ var RedisServer = class extends DatabaseServer {
27715
+ id = "redis";
27716
+ async start(env, plan) {
27717
+ const home = tool("redis");
27718
+ if (!exists(path20.join(home, "redis-server.exe"))) {
27719
+ await installFromGithub("redis-windows/redis-windows", /^Redis-[\d.]+-Windows-x64-msys2\.zip$/, {
27720
+ dest: home,
27721
+ what: (a) => "Redis (" + a.name + ", ~10 MB once)",
27722
+ locate: "redis-server.exe"
27723
+ });
27724
+ }
27725
+ const data = mkdirp(dataFor("redis"));
27726
+ await startServer(
27727
+ "redis",
27728
+ path20.join(home, "redis-server.exe"),
27729
+ ["--port", String(plan.port), "--bind", "127.0.0.1", "--dir", data.replace(/\\/g, "/"), "--appendonly", "yes"],
27730
+ plan.port
27731
+ );
27732
+ env.prepend.push(home);
27733
+ env.summary.push("redis: redis://127.0.0.1:" + plan.port + " (redis-cli on PATH)");
27734
+ }
26450
27735
  };
26451
27736
 
26452
- // src/guest/toolchains/databases/index.ts
26453
- var SETUP = { postgres: setupPostgres, mysql: setupMysql, mongodb: setupMongo, redis: setupRedis, dynamodb: setupDynamo };
26454
- var DATABASE_NAMES = { postgres: "PostgreSQL", mysql: "MySQL (MariaDB)", mongodb: "MongoDB", redis: "Redis", dynamodb: "DynamoDB Local", sqlserver: "SQL Server" };
26455
- var listenerPid = (port) => {
26456
- const out = spawnSync2(SYSTEM.netstat(), ["-ano", "-p", "TCP"], { encoding: "utf8", windowsHide: true }).stdout ?? "";
26457
- const hit = out.split(/\r?\n/).map((l) => /^\s*TCP\s+\S+:(\d+)\s+\S+\s+LISTENING\s+(\d+)/.exec(l)).find((m) => m && Number(m[1]) === port);
26458
- return hit ? Number(hit[2]) : null;
27737
+ // src/guest/databases/registry.ts
27738
+ var SERVERS = {
27739
+ postgres: new PostgresServer(),
27740
+ mysql: new MysqlServer(),
27741
+ mongodb: new MongoServer(),
27742
+ redis: new RedisServer(),
27743
+ dynamodb: new DynamoServer()
26459
27744
  };
26460
- var stopDatabase = async (plan) => {
27745
+ async function stopDatabase(plan) {
26461
27746
  if (!await portOpen(plan.port)) return false;
26462
- if (plan.database === "postgres" && exists(tool("postgres"))) {
26463
- for (const version2 of fs10.readdirSync(tool("postgres"))) {
26464
- const data = postgresData(version2);
26465
- const pgCtl = path15.join(tool("postgres", version2), "bin", "pg_ctl.exe");
26466
- if (exists(path15.join(data, "postmaster.pid")) && exists(pgCtl)) await execAsync(pgCtl, ["stop", "-D", data, "-m", "fast", "-w"], { stdio: "ignore" });
26467
- }
26468
- }
26469
- for (const port of [plan.port, plan.adminPort ?? 0]) {
26470
- const pid = port && listenerPid(port);
26471
- if (pid) try {
26472
- process.kill(pid);
26473
- } catch {
26474
- }
26475
- }
27747
+ if (plan.database === "sqlserver") killListeners(plan);
27748
+ else await SERVERS[plan.database].stop(plan);
26476
27749
  return true;
26477
- };
26478
- var setupDatabase = async (env, plan) => {
27750
+ }
27751
+ async function setupDatabase(env, plan) {
26479
27752
  if (plan.database === "sqlserver") {
26480
- env.summary.push("sqlserver: NOT available (SQL Server cannot start inside Windows Sandbox). Switch the project to Postgres or SQLite for local work");
27753
+ env.summary.push(
27754
+ "sqlserver: NOT available (SQL Server cannot start inside Windows Sandbox). Switch the project to Postgres or SQLite for local work"
27755
+ );
26481
27756
  return;
26482
27757
  }
26483
27758
  if (dryRun) {
26484
- log("(dry run) would run " + DATABASE_NAMES[plan.database] + " on port " + plan.port + " (" + plan.reasons.join("; ") + ")");
27759
+ log(
27760
+ "(dry run) would run " + DATABASE_NAMES[plan.database] + " on port " + plan.port + " (" + plan.reasons.join("; ") + ")"
27761
+ );
26485
27762
  return;
26486
27763
  }
26487
27764
  if (duringSession() && await portOpen(plan.port)) {
26488
27765
  env.summary.push(plan.database + ": shared, already running on port " + plan.port);
26489
27766
  return;
26490
27767
  }
26491
- await SETUP[plan.database](env, plan);
26492
- };
27768
+ await SERVERS[plan.database].start(env, plan);
27769
+ }
26493
27770
 
26494
27771
  // src/guest/setup/environment.ts
26495
27772
  var addMachineEnvironment = (vars, dirs, additive = false) => {
@@ -26508,13 +27785,13 @@ var addMachineEnvironment = (vars, dirs, additive = false) => {
26508
27785
  }
26509
27786
  };
26510
27787
 
26511
- // src/guest/db.ts
27788
+ // src/guest/databases/sbx-db.ts
26512
27789
  var USAGE = "Usage: sbx-db [list] | sbx-db start <name> | sbx-db stop <name>";
26513
27790
  var projectPlans = () => {
26514
27791
  const file2 = process.env.AGENT_PROJECT_FILE;
26515
27792
  if (!file2) return null;
26516
27793
  try {
26517
- return ProjectSpec.safeParse(JSON.parse(fs11.readFileSync(file2, "utf8"))).data?.databases ?? null;
27794
+ return ProjectSpecSchema.safeParse(JSON.parse(fs17.readFileSync(file2, "utf8"))).data?.databases ?? null;
26518
27795
  } catch {
26519
27796
  return null;
26520
27797
  }
@@ -26526,7 +27803,10 @@ var plans = () => {
26526
27803
  var find = (name) => {
26527
27804
  const all = plans();
26528
27805
  const plan = all.find((p) => p.database === name?.toLowerCase());
26529
- if (!plan) throw new Error((name ? 'Unknown database "' + name + '". ' : "") + "Choose one of: " + all.map((p) => p.database).join(", "));
27806
+ if (!plan)
27807
+ throw new Error(
27808
+ (name ? 'Unknown database "' + name + '". ' : "") + "Choose one of: " + all.map((p) => p.database).join(", ")
27809
+ );
26530
27810
  if (plan.database === "sqlserver") throw new Error("SQL Server cannot run inside Windows Sandbox.");
26531
27811
  return plan;
26532
27812
  };
@@ -26556,17 +27836,22 @@ var stop = async (name) => {
26556
27836
  console.log(await stopDatabase(plan) ? "Stopped " + plan.database + "." : plan.database + " was not running.");
26557
27837
  return 0;
26558
27838
  };
26559
- var main = (args) => {
27839
+ function runSbxDb(args) {
26560
27840
  const [action = "list", name] = args;
26561
27841
  if (action === "list") return list();
26562
27842
  if (action === "start") return start(name);
26563
27843
  if (action === "stop") return stop(name);
26564
27844
  console.error(USAGE);
26565
27845
  return Promise.resolve(2);
26566
- };
26567
- main(process.argv.slice(2)).then((code) => {
26568
- process.exitCode = code;
26569
- }, (e) => {
26570
- console.error(errMsg(e));
26571
- process.exitCode = 1;
26572
- });
27846
+ }
27847
+
27848
+ // src/guest/entries/db.ts
27849
+ runSbxDb(process.argv.slice(2)).then(
27850
+ (code) => {
27851
+ process.exitCode = code;
27852
+ },
27853
+ (e) => {
27854
+ console.error(errMsg(e));
27855
+ process.exitCode = 1;
27856
+ }
27857
+ );