windows-development-sandbox 1.4.0 → 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 (877) hide show
  1. package/.sandbox-config.example.json +2 -1
  2. package/config.example.json +4 -1
  3. package/dist/api.js +27 -16
  4. package/dist/cli/args.d.ts +4 -6
  5. package/dist/cli/args.js +67 -34
  6. package/dist/cli/argv.d.ts +9 -0
  7. package/dist/cli/argv.js +22 -0
  8. package/dist/cli/commands/accounts.d.ts +1 -1
  9. package/dist/cli/commands/accounts.js +42 -27
  10. package/dist/cli/commands/agent-commands.d.ts +3 -3
  11. package/dist/cli/commands/agent-commands.js +27 -18
  12. package/dist/cli/commands/context.d.ts +9 -11
  13. package/dist/cli/commands/context.js +35 -32
  14. package/dist/cli/commands/data/clean.d.ts +2 -2
  15. package/dist/cli/commands/data/clean.js +27 -11
  16. package/dist/cli/commands/data/collect.d.ts +6 -3
  17. package/dist/cli/commands/data/collect.js +46 -15
  18. package/dist/cli/commands/data/index.d.ts +2 -2
  19. package/dist/cli/commands/data/index.js +30 -12
  20. package/dist/cli/commands/data/remove.d.ts +1 -1
  21. package/dist/cli/commands/data/remove.js +4 -4
  22. package/dist/cli/commands/index.d.ts +5 -4
  23. package/dist/cli/commands/index.js +5 -4
  24. package/dist/cli/commands/launch/add-root.d.ts +7 -0
  25. package/dist/cli/commands/launch/add-root.js +64 -0
  26. package/dist/cli/commands/launch/boot-progress.d.ts +7 -0
  27. package/dist/cli/commands/launch/boot-progress.js +48 -0
  28. package/dist/cli/commands/launch/boot-wants.d.ts +11 -0
  29. package/dist/cli/commands/launch/boot-wants.js +48 -0
  30. package/dist/cli/commands/launch/first-start.d.ts +10 -0
  31. package/dist/cli/commands/launch/first-start.js +53 -0
  32. package/dist/cli/commands/launch/index.d.ts +6 -0
  33. package/dist/cli/commands/launch/index.js +6 -0
  34. package/dist/cli/commands/launch/launch.d.ts +8 -0
  35. package/dist/cli/commands/launch/launch.js +211 -0
  36. package/dist/cli/commands/launch/prepare.d.ts +23 -0
  37. package/dist/cli/commands/launch/prepare.js +109 -0
  38. package/dist/cli/commands/launch/running.d.ts +45 -0
  39. package/dist/cli/commands/launch/running.js +218 -0
  40. package/dist/cli/commands/launch/summary.d.ts +8 -0
  41. package/dist/cli/commands/launch/summary.js +98 -0
  42. package/dist/cli/commands/maintenance/audit.d.ts +3 -0
  43. package/dist/cli/commands/maintenance/audit.js +58 -0
  44. package/dist/cli/commands/maintenance/clean.d.ts +2 -0
  45. package/dist/cli/commands/maintenance/clean.js +10 -0
  46. package/dist/cli/commands/maintenance/config.d.ts +2 -0
  47. package/dist/cli/commands/maintenance/config.js +145 -0
  48. package/dist/cli/commands/maintenance/doctor.d.ts +2 -0
  49. package/dist/cli/commands/maintenance/doctor.js +52 -0
  50. package/dist/cli/commands/maintenance/host-claude.d.ts +2 -0
  51. package/dist/cli/commands/maintenance/host-claude.js +4 -0
  52. package/dist/cli/commands/maintenance/index.d.ts +8 -0
  53. package/dist/cli/commands/maintenance/index.js +9 -0
  54. package/dist/cli/commands/maintenance/logs.d.ts +2 -0
  55. package/dist/cli/commands/maintenance/logs.js +44 -0
  56. package/dist/cli/commands/maintenance/sync.d.ts +2 -0
  57. package/dist/cli/commands/maintenance/sync.js +12 -0
  58. package/dist/cli/commands/maintenance/watch.d.ts +3 -0
  59. package/dist/cli/commands/maintenance/watch.js +6 -0
  60. package/dist/cli/commands/projects/describe-sessions.d.ts +3 -0
  61. package/dist/cli/commands/projects/describe-sessions.js +15 -0
  62. package/dist/cli/commands/projects/here.d.ts +38 -0
  63. package/dist/cli/commands/projects/here.js +145 -0
  64. package/dist/cli/commands/projects/index.d.ts +4 -0
  65. package/dist/cli/commands/projects/index.js +4 -0
  66. package/dist/cli/commands/projects/projects.d.ts +14 -0
  67. package/dist/cli/commands/projects/projects.js +213 -0
  68. package/dist/cli/commands/projects/restart.d.ts +15 -0
  69. package/dist/cli/commands/projects/restart.js +149 -0
  70. package/dist/cli/commands/registry.d.ts +3 -0
  71. package/dist/cli/commands/registry.js +34 -0
  72. package/dist/cli/commands/repair/checks.js +105 -29
  73. package/dist/cli/commands/repair/finders.d.ts +13 -10
  74. package/dist/cli/commands/repair/finders.js +63 -43
  75. package/dist/cli/commands/repair/index.d.ts +4 -4
  76. package/dist/cli/commands/repair/index.js +47 -21
  77. package/dist/cli/commands/repair/types.d.ts +2 -2
  78. package/dist/cli/commands/repair/types.js +7 -2
  79. package/dist/cli/commands/sessions/attach.d.ts +2 -0
  80. package/dist/cli/commands/sessions/attach.js +45 -0
  81. package/dist/cli/commands/sessions/control.d.ts +4 -0
  82. package/dist/cli/commands/sessions/control.js +62 -0
  83. package/dist/cli/commands/sessions/exec.d.ts +6 -0
  84. package/dist/cli/commands/sessions/exec.js +72 -0
  85. package/dist/cli/commands/sessions/index.d.ts +6 -0
  86. package/dist/cli/commands/sessions/index.js +9 -0
  87. package/dist/cli/commands/sessions/list.d.ts +15 -0
  88. package/dist/cli/commands/sessions/list.js +65 -0
  89. package/dist/cli/commands/sessions/status.d.ts +2 -0
  90. package/dist/cli/commands/sessions/status.js +153 -0
  91. package/dist/cli/commands/sessions/window.d.ts +3 -0
  92. package/dist/cli/commands/sessions/window.js +18 -0
  93. package/dist/cli/commands/setup/checks.d.ts +4 -4
  94. package/dist/cli/commands/setup/checks.js +36 -19
  95. package/dist/cli/commands/setup/facts.d.ts +6 -6
  96. package/dist/cli/commands/setup/facts.js +23 -11
  97. package/dist/cli/commands/setup/index.d.ts +1 -1
  98. package/dist/cli/commands/setup/index.js +25 -12
  99. package/dist/cli/commands/user-config.d.ts +5 -5
  100. package/dist/cli/commands/user-config.js +14 -12
  101. package/dist/cli/history.d.ts +5 -4
  102. package/dist/cli/history.js +23 -11
  103. package/dist/cli/index.d.ts +4 -14
  104. package/dist/cli/index.js +27 -77
  105. package/dist/cli/manifest.d.ts +464 -10
  106. package/dist/cli/manifest.js +328 -54
  107. package/dist/cli/menu/apps.d.ts +7 -5
  108. package/dist/cli/menu/apps.js +64 -16
  109. package/dist/cli/menu/command-fields.d.ts +15 -0
  110. package/dist/cli/menu/command-fields.js +23 -0
  111. package/dist/cli/menu/command-form.d.ts +3 -5
  112. package/dist/cli/menu/command-form.js +116 -48
  113. package/dist/cli/menu/home.d.ts +22 -0
  114. package/dist/cli/menu/home.js +72 -0
  115. package/dist/cli/menu/index.d.ts +2 -24
  116. package/dist/cli/menu/index.js +4 -178
  117. package/dist/cli/menu/menu.d.ts +23 -0
  118. package/dist/cli/menu/menu.js +185 -0
  119. package/dist/cli/menu/settings/categories.d.ts +2 -2
  120. package/dist/cli/menu/settings/categories.js +123 -20
  121. package/dist/cli/menu/settings/collections/collection-editor.d.ts +23 -0
  122. package/dist/cli/menu/settings/collections/collection-editor.js +89 -0
  123. package/dist/cli/menu/settings/collections/map-editor.d.ts +10 -0
  124. package/dist/cli/menu/settings/collections/map-editor.js +34 -0
  125. package/dist/cli/menu/settings/collections/object-list-editor.d.ts +10 -0
  126. package/dist/cli/menu/settings/collections/object-list-editor.js +23 -0
  127. package/dist/cli/menu/settings/collections/object-map-editor.d.ts +10 -0
  128. package/dist/cli/menu/settings/collections/object-map-editor.js +35 -0
  129. package/dist/cli/menu/settings/collections/string-list-editor.d.ts +12 -0
  130. package/dist/cli/menu/settings/collections/string-list-editor.js +39 -0
  131. package/dist/cli/menu/settings/config-file.d.ts +2 -2
  132. package/dist/cli/menu/settings/config-file.js +42 -19
  133. package/dist/cli/menu/settings/editor-actions.d.ts +2 -0
  134. package/dist/cli/menu/settings/editor-actions.js +2 -0
  135. package/dist/cli/menu/settings/format.d.ts +5 -0
  136. package/dist/cli/menu/settings/format.js +39 -0
  137. package/dist/cli/menu/settings/index.d.ts +1 -29
  138. package/dist/cli/menu/settings/index.js +1 -133
  139. package/dist/cli/menu/settings/object-editor.d.ts +12 -0
  140. package/dist/cli/menu/settings/object-editor.js +86 -0
  141. package/dist/cli/menu/settings/schema-node.d.ts +3 -1
  142. package/dist/cli/menu/settings/schema-node.js +71 -24
  143. package/dist/cli/menu/settings/settings-editor.d.ts +30 -0
  144. package/dist/cli/menu/settings/settings-editor.js +176 -0
  145. package/dist/cli/menu/settings/{editors.d.ts → value-editor.d.ts} +2 -13
  146. package/dist/cli/menu/settings/value-editor.js +137 -0
  147. package/dist/cli/menu/several.d.ts +4 -4
  148. package/dist/cli/menu/several.js +61 -20
  149. package/dist/cli/{colors.d.ts → output/colors.d.ts} +8 -8
  150. package/dist/cli/{colors.js → output/colors.js} +32 -14
  151. package/dist/cli/output/index.d.ts +3 -0
  152. package/dist/cli/output/index.js +3 -0
  153. package/dist/cli/output/print.d.ts +5 -0
  154. package/dist/cli/output/print.js +14 -0
  155. package/dist/cli/output/progress.d.ts +24 -0
  156. package/dist/cli/output/progress.js +124 -0
  157. package/dist/cli/report.d.ts +2 -0
  158. package/dist/cli/report.js +20 -0
  159. package/dist/cli/tui/app.d.ts +6 -16
  160. package/dist/cli/tui/app.js +28 -8
  161. package/dist/cli/tui/dialogs/confirm-screen.d.ts +20 -0
  162. package/dist/cli/tui/dialogs/confirm-screen.js +50 -0
  163. package/dist/cli/tui/dialogs/message-screen.d.ts +17 -0
  164. package/dist/cli/tui/dialogs/message-screen.js +55 -0
  165. package/dist/cli/tui/dialogs/paragraphs.d.ts +2 -0
  166. package/dist/cli/tui/dialogs/paragraphs.js +5 -0
  167. package/dist/cli/tui/dialogs/text-screen.d.ts +26 -0
  168. package/dist/cli/tui/dialogs/text-screen.js +107 -0
  169. package/dist/cli/tui/frame.js +3 -1
  170. package/dist/cli/tui/index.d.ts +7 -3
  171. package/dist/cli/tui/index.js +4 -2
  172. package/dist/cli/tui/list/list-screen.d.ts +29 -0
  173. package/dist/cli/tui/{list-screen.js → list/list-screen.js} +86 -23
  174. package/dist/cli/tui/{list-screen.d.ts → list/list-types.d.ts} +0 -28
  175. package/dist/cli/tui/screen.d.ts +14 -0
  176. package/dist/cli/tui/terminal.js +34 -10
  177. package/dist/cli/tui/text.d.ts +2 -1
  178. package/dist/cli/tui/text.js +37 -7
  179. package/dist/cli/tui/theme.js +27 -9
  180. package/dist/cli/validate.d.ts +8 -8
  181. package/dist/cli/validate.js +32 -21
  182. package/dist/core/config/defaults.d.ts +2 -0
  183. package/dist/core/config/defaults.js +203 -0
  184. package/dist/core/config/index.d.ts +2 -0
  185. package/dist/core/config/index.js +3 -0
  186. package/dist/core/{config.d.ts → config/loader.d.ts} +1 -2
  187. package/dist/core/config/loader.js +47 -0
  188. package/dist/core/{detect-databases.js → detect/databases.js} +111 -23
  189. package/dist/core/detect/index.d.ts +4 -0
  190. package/dist/core/detect/index.js +4 -0
  191. package/dist/core/{detect-pwsh.d.ts → detect/pwsh.d.ts} +1 -1
  192. package/dist/core/{detect-pwsh.js → detect/pwsh.js} +25 -11
  193. package/dist/core/{detect-toolchains.d.ts → detect/toolchains.d.ts} +1 -1
  194. package/dist/core/{detect-toolchains.js → detect/toolchains.js} +42 -5
  195. package/dist/{guest/toolchains → core/detect}/versions.js +28 -12
  196. package/dist/core/disk.d.ts +2 -0
  197. package/dist/core/disk.js +46 -3
  198. package/dist/core/local-config/boot-wants.d.ts +45 -0
  199. package/dist/core/local-config/boot-wants.js +120 -0
  200. package/dist/core/local-config/file.d.ts +3 -0
  201. package/dist/core/local-config/file.js +16 -0
  202. package/dist/core/local-config/index.d.ts +5 -0
  203. package/dist/core/local-config/index.js +7 -0
  204. package/dist/core/{local-config.d.ts → local-config/overrides.d.ts} +11 -11
  205. package/dist/core/{local-config.js → local-config/overrides.js} +53 -54
  206. package/dist/core/{project-policy.d.ts → local-config/policy.d.ts} +7 -3
  207. package/dist/core/{project-policy.js → local-config/policy.js} +16 -6
  208. package/dist/core/local-config/trust.d.ts +13 -0
  209. package/dist/core/local-config/trust.js +43 -0
  210. package/dist/core/package-info.d.ts +4 -0
  211. package/dist/core/package-info.js +13 -0
  212. package/dist/core/run/guest-workspace.d.ts +23 -0
  213. package/dist/core/run/guest-workspace.js +47 -0
  214. package/dist/core/run/index.d.ts +3 -0
  215. package/dist/core/run/index.js +3 -0
  216. package/dist/core/run/resolve-run.d.ts +3 -0
  217. package/dist/core/run/resolve-run.js +202 -0
  218. package/dist/core/run/versions.d.ts +13 -0
  219. package/dist/core/run/versions.js +65 -0
  220. package/dist/core/safe-paths.js +17 -5
  221. package/dist/core/schema/apps.d.ts +4 -4
  222. package/dist/core/schema/apps.js +55 -21
  223. package/dist/core/schema/common.d.ts +13 -10
  224. package/dist/core/schema/common.js +16 -10
  225. package/dist/core/schema/config.d.ts +18 -12
  226. package/dist/core/schema/config.js +78 -53
  227. package/dist/core/schema/databases.d.ts +4 -3
  228. package/dist/core/schema/databases.js +16 -12
  229. package/dist/core/schema/harness.d.ts +1 -1
  230. package/dist/core/schema/harness.js +17 -7
  231. package/dist/core/schema/index.d.ts +6 -0
  232. package/dist/core/schema/index.js +8 -0
  233. package/dist/core/schema/json-schema.js +10 -5
  234. package/dist/core/schema/profile.d.ts +4 -4
  235. package/dist/core/schema/profile.js +37 -17
  236. package/dist/core/schema/projects.d.ts +2 -1
  237. package/dist/core/schema/projects.js +16 -5
  238. package/dist/core/schema/sandbox.d.ts +12 -12
  239. package/dist/core/schema/sandbox.js +101 -37
  240. package/dist/core/schema/toolchains.d.ts +6 -1
  241. package/dist/core/schema/toolchains.js +84 -34
  242. package/dist/core/types.d.ts +36 -9
  243. package/dist/core/util/errors.d.ts +8 -0
  244. package/dist/core/util/errors.js +14 -0
  245. package/dist/core/util/fs.d.ts +8 -0
  246. package/dist/core/util/fs.js +40 -0
  247. package/dist/core/util/index.d.ts +7 -0
  248. package/dist/core/util/index.js +7 -0
  249. package/dist/core/util/jsonc.d.ts +6 -0
  250. package/dist/core/util/jsonc.js +25 -0
  251. package/dist/core/util/links.d.ts +10 -0
  252. package/dist/core/util/links.js +39 -0
  253. package/dist/core/util/paths.d.ts +7 -0
  254. package/dist/core/util/paths.js +33 -0
  255. package/dist/core/util/process.d.ts +15 -0
  256. package/dist/core/util/process.js +54 -0
  257. package/dist/core/util/text.d.ts +8 -0
  258. package/dist/core/util/text.js +8 -0
  259. package/dist/guest/{setup/agents.js → agents/agent-installer.js} +24 -4
  260. package/dist/guest/apps/after-install.d.ts +3 -0
  261. package/dist/guest/apps/after-install.js +47 -0
  262. package/dist/guest/apps/app-installer.d.ts +22 -0
  263. package/dist/guest/apps/app-installer.js +116 -0
  264. package/dist/guest/apps/find-exe.d.ts +5 -0
  265. package/dist/guest/apps/find-exe.js +41 -0
  266. package/dist/guest/apps/index.d.ts +3 -10
  267. package/dist/guest/apps/index.js +6 -206
  268. package/dist/guest/apps/resolvers.js +37 -9
  269. package/dist/guest/apps/shortcuts.d.ts +6 -0
  270. package/dist/guest/apps/shortcuts.js +28 -0
  271. package/dist/guest/apps/sources.d.ts +4 -0
  272. package/dist/guest/apps/sources.js +17 -0
  273. package/dist/guest/apps/unpack.d.ts +3 -0
  274. package/dist/guest/apps/unpack.js +47 -0
  275. package/dist/guest/{audit-parse.js → audit/parse.js} +39 -3
  276. package/dist/guest/{audit.d.ts → audit/process-audit.d.ts} +3 -1
  277. package/dist/guest/{audit.js → audit/process-audit.js} +33 -8
  278. package/dist/guest/boot/boot-env.d.ts +4 -0
  279. package/dist/guest/{boot-env.js → boot/boot-env.js} +7 -5
  280. package/dist/guest/boot/boot.d.ts +1 -0
  281. package/dist/guest/{main.js → boot/boot.js} +100 -50
  282. package/dist/guest/{guide.js → boot/guide.js} +32 -7
  283. package/dist/guest/{project-env.d.ts → boot/project-env.d.ts} +3 -3
  284. package/dist/guest/{project-env.js → boot/project-env.js} +12 -4
  285. package/dist/guest/boot/project-status.d.ts +5 -0
  286. package/dist/guest/boot/project-status.js +28 -0
  287. package/dist/guest/daemon/daemon.d.ts +1 -0
  288. package/dist/guest/daemon/daemon.js +51 -0
  289. package/dist/guest/daemon/exec.js +18 -6
  290. package/dist/guest/daemon/{shutdown.js → idle-shutdown.js} +5 -4
  291. package/dist/guest/daemon/{project.d.ts → project-provisioner.d.ts} +3 -3
  292. package/dist/guest/daemon/{project.js → project-provisioner.js} +60 -22
  293. package/dist/guest/daemon/relays.js +5 -3
  294. package/dist/guest/daemon/{session.js → sessions.js} +84 -24
  295. package/dist/guest/daemon/state.d.ts +4 -1
  296. package/dist/guest/daemon/state.js +34 -20
  297. package/dist/guest/databases/database-server.d.ts +13 -0
  298. package/dist/guest/databases/database-server.js +35 -0
  299. package/dist/guest/databases/dynamodb.d.ts +12 -0
  300. package/dist/guest/databases/dynamodb.js +81 -0
  301. package/dist/guest/databases/index.d.ts +2 -0
  302. package/dist/guest/databases/index.js +2 -0
  303. package/dist/guest/databases/mongodb.d.ts +7 -0
  304. package/dist/guest/databases/mongodb.js +46 -0
  305. package/dist/guest/databases/mysql.d.ts +7 -0
  306. package/dist/guest/databases/mysql.js +59 -0
  307. package/dist/guest/databases/names.d.ts +5 -0
  308. package/dist/guest/databases/names.js +8 -0
  309. package/dist/guest/databases/postgres.d.ts +9 -0
  310. package/dist/guest/databases/postgres.js +85 -0
  311. package/dist/guest/databases/redis.d.ts +7 -0
  312. package/dist/guest/databases/redis.js +25 -0
  313. package/dist/guest/databases/registry.d.ts +5 -0
  314. package/dist/guest/databases/registry.js +51 -0
  315. package/dist/guest/databases/sbx-db.d.ts +1 -0
  316. package/dist/guest/{db.js → databases/sbx-db.js} +13 -13
  317. package/dist/guest/{toolchains/databases → databases}/server.d.ts +5 -5
  318. package/dist/guest/{toolchains/databases → databases}/server.js +18 -13
  319. package/dist/guest/entries/daemon.js +16 -0
  320. package/dist/guest/entries/db.js +10 -0
  321. package/dist/guest/entries/gitguard.js +20 -0
  322. package/dist/guest/entries/main.d.ts +1 -0
  323. package/dist/guest/entries/main.js +24 -0
  324. package/dist/guest/entries/netproxy.d.ts +1 -0
  325. package/dist/guest/entries/netproxy.js +7 -0
  326. package/dist/guest/entries/view.d.ts +1 -0
  327. package/dist/guest/entries/view.js +11 -0
  328. package/dist/guest/{gitguard.js → git/decision.js} +49 -26
  329. package/dist/guest/network/addresses.d.ts +2 -0
  330. package/dist/guest/network/addresses.js +6 -0
  331. package/dist/guest/{setup/network.d.ts → network/allow-only.d.ts} +0 -10
  332. package/dist/guest/network/allow-only.js +84 -0
  333. package/dist/guest/network/firewall.d.ts +9 -0
  334. package/dist/guest/{setup/network.js → network/firewall.js} +58 -63
  335. package/dist/guest/network/proxy-server.d.ts +2 -0
  336. package/dist/guest/{netproxy.js → network/proxy-server.js} +37 -18
  337. package/dist/guest/{helpers.d.ts → runtime/csc.d.ts} +1 -1
  338. package/dist/guest/{helpers.js → runtime/csc.js} +7 -2
  339. package/dist/guest/runtime/fs.d.ts +2 -0
  340. package/dist/guest/runtime/fs.js +6 -0
  341. package/dist/guest/runtime/log.d.ts +3 -0
  342. package/dist/guest/runtime/log.js +22 -0
  343. package/dist/guest/runtime/paths.d.ts +13 -0
  344. package/dist/guest/runtime/paths.js +14 -0
  345. package/dist/guest/{ports.js → runtime/ports.js} +8 -2
  346. package/dist/guest/runtime/process.d.ts +15 -0
  347. package/dist/guest/runtime/process.js +59 -0
  348. package/dist/guest/{project-context.js → runtime/project-context.js} +1 -1
  349. package/dist/guest/runtime/session.d.ts +5 -0
  350. package/dist/guest/runtime/session.js +10 -0
  351. package/dist/guest/runtime/status.d.ts +7 -0
  352. package/dist/guest/runtime/status.js +57 -0
  353. package/dist/guest/{cmdline.js → sessions/cmdline.js} +10 -4
  354. package/dist/guest/{ptyhost.js → sessions/pty-host.js} +12 -5
  355. package/dist/guest/{view.js → sessions/viewer.js} +8 -11
  356. package/dist/guest/setup/claude-mem.d.ts +10 -0
  357. package/dist/guest/setup/{claude.js → claude-mem.js} +18 -78
  358. package/dist/guest/setup/{claude.d.ts → claude-profile.d.ts} +0 -10
  359. package/dist/guest/setup/claude-profile.js +89 -0
  360. package/dist/guest/setup/desktop.d.ts +2 -0
  361. package/dist/guest/setup/desktop.js +32 -0
  362. package/dist/guest/setup/environment.js +28 -5
  363. package/dist/guest/setup/{user.d.ts → git-identity.d.ts} +0 -2
  364. package/dist/guest/setup/git-identity.js +34 -0
  365. package/dist/guest/{gitrules.d.ts → setup/git-rules.d.ts} +1 -1
  366. package/dist/guest/setup/git-rules.js +50 -0
  367. package/dist/guest/setup/hooks.js +22 -5
  368. package/dist/guest/setup/{policy.js → managed-policy.js} +2 -2
  369. package/dist/guest/toolchains/catalogue.d.ts +4 -4
  370. package/dist/guest/toolchains/catalogue.js +30 -7
  371. package/dist/guest/toolchains/detect.d.ts +12 -0
  372. package/dist/guest/toolchains/detect.js +54 -0
  373. package/dist/guest/toolchains/index.d.ts +3 -17
  374. package/dist/guest/toolchains/index.js +1 -80
  375. package/dist/guest/toolchains/install.d.ts +20 -0
  376. package/dist/guest/toolchains/install.js +29 -0
  377. package/dist/guest/toolchains/languages/go.d.ts +3 -0
  378. package/dist/guest/toolchains/{go.js → languages/go.js} +27 -9
  379. package/dist/guest/toolchains/languages/java.d.ts +8 -0
  380. package/dist/guest/toolchains/{java.js → languages/java.js} +57 -18
  381. package/dist/guest/toolchains/languages/node.d.ts +3 -0
  382. package/dist/guest/toolchains/{node.js → languages/node.js} +51 -18
  383. package/dist/guest/toolchains/languages/php.d.ts +3 -0
  384. package/dist/guest/toolchains/{scripting → languages}/php.js +36 -11
  385. package/dist/guest/toolchains/languages/python-tools.d.ts +3 -0
  386. package/dist/guest/toolchains/languages/python-tools.js +12 -0
  387. package/dist/guest/toolchains/languages/python.d.ts +3 -0
  388. package/dist/guest/toolchains/{python.js → languages/python.js} +29 -16
  389. package/dist/guest/toolchains/languages/ruby.d.ts +3 -0
  390. package/dist/guest/toolchains/{scripting → languages}/ruby.js +28 -10
  391. package/dist/guest/toolchains/leftovers.d.ts +1 -1
  392. package/dist/guest/toolchains/leftovers.js +13 -11
  393. package/dist/guest/toolchains/managers.d.ts +6 -6
  394. package/dist/guest/toolchains/managers.js +38 -17
  395. package/dist/guest/toolchains/native/binstall.d.ts +3 -2
  396. package/dist/guest/toolchains/native/binstall.js +20 -8
  397. package/dist/guest/toolchains/native/cpp.d.ts +2 -2
  398. package/dist/guest/toolchains/native/cpp.js +23 -8
  399. package/dist/guest/toolchains/native/dotnet.d.ts +5 -3
  400. package/dist/guest/toolchains/native/dotnet.js +72 -24
  401. package/dist/guest/toolchains/native/mesa.d.ts +2 -2
  402. package/dist/guest/toolchains/native/mesa.js +27 -10
  403. package/dist/guest/toolchains/native/msvc/environment.d.ts +4 -4
  404. package/dist/guest/toolchains/native/msvc/environment.js +30 -16
  405. package/dist/guest/toolchains/native/msvc/index.d.ts +3 -3
  406. package/dist/guest/toolchains/native/msvc/index.js +10 -8
  407. package/dist/guest/toolchains/native/msvc/packages.d.ts +1 -1
  408. package/dist/guest/toolchains/native/msvc/packages.js +69 -23
  409. package/dist/guest/toolchains/native/msvc/tree.d.ts +6 -6
  410. package/dist/guest/toolchains/native/msvc/tree.js +15 -9
  411. package/dist/guest/toolchains/native/rust-extras.d.ts +23 -0
  412. package/dist/guest/toolchains/native/rust-extras.js +100 -0
  413. package/dist/guest/toolchains/native/rust.d.ts +2 -2
  414. package/dist/guest/toolchains/native/rust.js +41 -10
  415. package/dist/guest/toolchains/{scripting → native}/vcruntime.d.ts +2 -2
  416. package/dist/guest/toolchains/{scripting → native}/vcruntime.js +17 -7
  417. package/dist/guest/toolchains/package-ledger.d.ts +17 -0
  418. package/dist/guest/toolchains/package-ledger.js +54 -0
  419. package/dist/guest/toolchains/plan.d.ts +3 -24
  420. package/dist/guest/toolchains/plan.js +99 -111
  421. package/dist/guest/toolchains/runtimes.d.ts +6 -6
  422. package/dist/guest/toolchains/runtimes.js +31 -13
  423. package/dist/guest/toolchains/scheduler.d.ts +22 -0
  424. package/dist/guest/toolchains/scheduler.js +123 -0
  425. package/dist/guest/toolchains/setup.d.ts +10 -0
  426. package/dist/guest/toolchains/setup.js +22 -0
  427. package/dist/guest/toolchains/state-file.d.ts +3 -0
  428. package/dist/guest/toolchains/state-file.js +10 -0
  429. package/dist/guest/toolchains/step.d.ts +24 -0
  430. package/dist/guest/toolchains/step.js +1 -0
  431. package/dist/guest/toolchains/tool-env.d.ts +12 -0
  432. package/dist/guest/toolchains/tool-env.js +16 -0
  433. package/dist/guest/toolchains/tools/cli.d.ts +10 -0
  434. package/dist/guest/toolchains/{cli.js → tools/cli.js} +35 -15
  435. package/dist/guest/toolchains/tools/git.d.ts +3 -0
  436. package/dist/guest/toolchains/{git.js → tools/git.js} +38 -15
  437. package/dist/guest/toolchains/tools/pwsh.d.ts +4 -0
  438. package/dist/guest/toolchains/{pwsh.js → tools/pwsh.js} +14 -7
  439. package/dist/guest/toolchains/{vscode-profile.d.ts → tools/vscode-profile.d.ts} +6 -6
  440. package/dist/guest/toolchains/{vscode-profile.js → tools/vscode-profile.js} +28 -12
  441. package/dist/guest/toolchains/{vscode.d.ts → tools/vscode.d.ts} +6 -6
  442. package/dist/guest/toolchains/{vscode.js → tools/vscode.js} +67 -21
  443. package/dist/guest/toolchains/version-cache.d.ts +16 -0
  444. package/dist/guest/toolchains/version-cache.js +67 -0
  445. package/dist/host/agent-commands/commands.d.ts +13 -0
  446. package/dist/host/agent-commands/commands.js +33 -0
  447. package/dist/host/agent-commands/forwarders.d.ts +7 -0
  448. package/dist/host/agent-commands/forwarders.js +31 -0
  449. package/dist/host/agent-commands/index.d.ts +4 -0
  450. package/dist/host/agent-commands/index.js +4 -0
  451. package/dist/host/agent-commands/reconcile.d.ts +12 -0
  452. package/dist/host/agent-commands/reconcile.js +69 -0
  453. package/dist/host/agent-commands/user-path.d.ts +2 -0
  454. package/dist/host/agent-commands/user-path.js +33 -0
  455. package/dist/host/audit/collect.d.ts +2 -2
  456. package/dist/host/audit/collect.js +59 -22
  457. package/dist/host/audit/log.d.ts +2 -2
  458. package/dist/host/audit/log.js +24 -8
  459. package/dist/host/{attach.d.ts → channel/attach.d.ts} +2 -2
  460. package/dist/host/{attach.js → channel/attach.js} +33 -15
  461. package/dist/host/channel/channel.d.ts +51 -0
  462. package/dist/host/channel/channel.js +196 -0
  463. package/dist/host/channel/index.d.ts +2 -0
  464. package/dist/host/channel/index.js +2 -0
  465. package/dist/host/guard/agent-files.d.ts +7 -0
  466. package/dist/host/guard/agent-files.js +103 -0
  467. package/dist/host/guard/commands.d.ts +10 -0
  468. package/dist/host/guard/commands.js +123 -0
  469. package/dist/host/guard/file-hash.d.ts +4 -0
  470. package/dist/host/guard/file-hash.js +37 -0
  471. package/dist/host/guard/git-config.d.ts +5 -0
  472. package/dist/host/guard/git-config.js +62 -0
  473. package/dist/host/guard/git-dirs.d.ts +12 -0
  474. package/dist/host/guard/git-dirs.js +53 -0
  475. package/dist/host/guard/index.d.ts +5 -0
  476. package/dist/host/guard/index.js +4 -0
  477. package/dist/host/guard/mark-of-the-web.d.ts +8 -0
  478. package/dist/host/guard/mark-of-the-web.js +74 -0
  479. package/dist/host/guard/nested-repos.d.ts +14 -0
  480. package/dist/host/guard/nested-repos.js +88 -0
  481. package/dist/host/guard/quarantine.d.ts +3 -0
  482. package/dist/host/guard/quarantine.js +24 -0
  483. package/dist/host/guard/repo-guard.d.ts +10 -0
  484. package/dist/host/guard/repo-guard.js +36 -0
  485. package/dist/host/guard/store.d.ts +40 -0
  486. package/dist/host/guard/store.js +145 -0
  487. package/dist/host/guard/types.d.ts +27 -0
  488. package/dist/host/guard/types.js +3 -0
  489. package/dist/host/guard/watch-state.d.ts +9 -0
  490. package/dist/host/guard/watch-state.js +26 -0
  491. package/dist/host/launch/boot-projects.d.ts +17 -0
  492. package/dist/host/launch/{projects.js → boot-projects.js} +27 -12
  493. package/dist/host/{database-plan.d.ts → launch/database-plan.d.ts} +5 -5
  494. package/dist/host/{database-plan.js → launch/database-plan.js} +24 -13
  495. package/dist/host/launch/generate.d.ts +4 -0
  496. package/dist/host/launch/generate.js +77 -0
  497. package/dist/host/launch/index.d.ts +10 -0
  498. package/dist/host/launch/index.js +10 -0
  499. package/dist/host/launch/mappings.d.ts +7 -2
  500. package/dist/host/launch/mappings.js +83 -24
  501. package/dist/host/launch/pc-scan.d.ts +5 -0
  502. package/dist/host/{pc-scan.js → launch/pc-scan.js} +20 -13
  503. package/dist/host/launch/project-scan.d.ts +7 -0
  504. package/dist/host/{project-scan.js → launch/project-scan.js} +29 -21
  505. package/dist/host/launch/session-file.d.ts +23 -0
  506. package/dist/host/launch/session-file.js +73 -0
  507. package/dist/host/launch/stage.d.ts +5 -5
  508. package/dist/host/launch/stage.js +14 -13
  509. package/dist/host/launch/toolchains.d.ts +4 -0
  510. package/dist/host/launch/toolchains.js +11 -0
  511. package/dist/host/launch/{wsb.d.ts → wsb-file.d.ts} +4 -2
  512. package/dist/host/launch/wsb-file.js +56 -0
  513. package/dist/host/life/crash-report.d.ts +8 -0
  514. package/dist/host/life/crash-report.js +87 -0
  515. package/dist/host/life/index.d.ts +6 -0
  516. package/dist/host/life/index.js +6 -0
  517. package/dist/host/life/keep-awake.d.ts +10 -0
  518. package/dist/host/life/keep-awake.js +29 -0
  519. package/dist/host/life/life-record.d.ts +48 -0
  520. package/dist/host/life/life-record.js +76 -0
  521. package/dist/host/life/stop-events.d.ts +27 -0
  522. package/dist/host/life/stop-events.js +96 -0
  523. package/dist/host/life/stop-warning.d.ts +4 -0
  524. package/dist/host/life/stop-warning.js +25 -0
  525. package/dist/host/life/windows-update.d.ts +3 -0
  526. package/dist/host/life/windows-update.js +11 -0
  527. package/dist/host/native.d.ts +4 -0
  528. package/dist/host/native.js +11 -0
  529. package/dist/host/network/index.d.ts +1 -0
  530. package/dist/host/network/index.js +1 -0
  531. package/dist/host/{port-forward.d.ts → network/port-forward.d.ts} +1 -1
  532. package/dist/host/{port-forward.js → network/port-forward.js} +16 -10
  533. package/dist/host/profile/accounts.d.ts +37 -0
  534. package/dist/host/profile/accounts.js +146 -0
  535. package/dist/host/profile/claude-login.d.ts +22 -0
  536. package/dist/host/profile/claude-login.js +57 -0
  537. package/dist/host/{claude-profile.d.ts → profile/claude-profile.d.ts} +9 -9
  538. package/dist/host/{claude-profile.js → profile/claude-profile.js} +32 -22
  539. package/dist/host/profile/index.d.ts +7 -0
  540. package/dist/host/profile/index.js +7 -0
  541. package/dist/host/profile/personalize.d.ts +2 -0
  542. package/dist/host/profile/personalize.js +127 -0
  543. package/dist/host/profile/reg-file.d.ts +8 -0
  544. package/dist/host/profile/reg-file.js +45 -0
  545. package/dist/host/profile/secret-files.d.ts +2 -0
  546. package/dist/host/profile/secret-files.js +25 -0
  547. package/dist/host/profile/secret-patterns.d.ts +6 -0
  548. package/dist/host/profile/secret-patterns.js +128 -0
  549. package/dist/host/profile/secrets.d.ts +12 -0
  550. package/dist/host/profile/secrets.js +100 -0
  551. package/dist/host/projects/index.d.ts +4 -0
  552. package/dist/host/projects/index.js +4 -0
  553. package/dist/host/projects/join.d.ts +38 -0
  554. package/dist/host/projects/join.js +119 -0
  555. package/dist/host/projects/known.d.ts +28 -0
  556. package/dist/host/projects/known.js +55 -0
  557. package/dist/host/projects/mapper.d.ts +29 -0
  558. package/dist/host/projects/mapper.js +88 -0
  559. package/dist/host/projects/registry.d.ts +83 -0
  560. package/dist/host/projects/registry.js +136 -0
  561. package/dist/host/sandbox/doctor.d.ts +2 -0
  562. package/dist/host/sandbox/doctor.js +42 -0
  563. package/dist/host/sandbox/host-claude.d.ts +1 -0
  564. package/dist/host/sandbox/host-claude.js +26 -0
  565. package/dist/host/sandbox/index.d.ts +6 -0
  566. package/dist/host/sandbox/index.js +6 -0
  567. package/dist/host/{platform.d.ts → sandbox/platform.d.ts} +0 -5
  568. package/dist/host/sandbox/platform.js +60 -0
  569. package/dist/host/sandbox/probe.d.ts +3 -0
  570. package/dist/host/sandbox/probe.js +47 -0
  571. package/dist/host/{window.js → sandbox/window.js} +7 -5
  572. package/dist/host/{wsb.js → sandbox/wsb-cli.js} +31 -8
  573. package/dist/host/{cleanup.js → storage/cleanup.js} +27 -12
  574. package/dist/host/storage/index.d.ts +2 -0
  575. package/dist/host/storage/index.js +2 -0
  576. package/dist/host/storage/state-files.d.ts +4 -0
  577. package/dist/host/storage/state-files.js +10 -0
  578. package/dist/host/test-guard.js +1 -1
  579. package/dist/host/tools/conpty.d.ts +8 -0
  580. package/dist/host/tools/conpty.js +58 -0
  581. package/dist/host/tools/index.d.ts +2 -0
  582. package/dist/host/tools/index.js +2 -0
  583. package/dist/host/{terminal.d.ts → tools/windows-terminal.d.ts} +2 -10
  584. package/dist/host/{terminal.js → tools/windows-terminal.js} +33 -57
  585. package/dist/host/workspace-view/active-views.d.ts +3 -0
  586. package/dist/host/workspace-view/active-views.js +22 -0
  587. package/dist/host/workspace-view/index.d.ts +2 -18
  588. package/dist/host/workspace-view/index.js +2 -49
  589. package/dist/host/workspace-view/plan.d.ts +16 -0
  590. package/dist/host/workspace-view/plan.js +50 -0
  591. package/dist/host/workspace-view/rules.js +10 -3
  592. package/dist/host/workspace-view/view-state.d.ts +10 -0
  593. package/dist/host/workspace-view/view-state.js +31 -0
  594. package/dist/host/workspace-view/view.d.ts +1 -0
  595. package/dist/host/workspace-view/view.js +51 -55
  596. package/dist/runtime/daemon.js +4232 -1918
  597. package/dist/runtime/db.js +2145 -830
  598. package/dist/runtime/gitguard.js +29 -11
  599. package/dist/runtime/main.js +4760 -2155
  600. package/dist/runtime/netproxy.js +1654 -418
  601. package/dist/runtime/view.js +1515 -453
  602. package/dist/selftest/accounts.test.d.ts +1 -1
  603. package/dist/selftest/accounts.test.js +20 -17
  604. package/dist/selftest/agent-commands.test.d.ts +1 -1
  605. package/dist/selftest/agent-commands.test.js +9 -5
  606. package/dist/selftest/audit.test.d.ts +1 -1
  607. package/dist/selftest/audit.test.js +46 -13
  608. package/dist/selftest/channel.test.d.ts +1 -1
  609. package/dist/selftest/channel.test.js +91 -8
  610. package/dist/selftest/cli.test.d.ts +1 -1
  611. package/dist/selftest/cli.test.js +68 -16
  612. package/dist/selftest/cmdline.test.d.ts +1 -1
  613. package/dist/selftest/cmdline.test.js +36 -7
  614. package/dist/selftest/config.test.d.ts +1 -1
  615. package/dist/selftest/config.test.js +12 -5
  616. package/dist/selftest/data.test.d.ts +1 -1
  617. package/dist/selftest/data.test.js +35 -6
  618. package/dist/selftest/detect.test.d.ts +1 -1
  619. package/dist/selftest/detect.test.js +22 -9
  620. package/dist/selftest/generate.test.d.ts +1 -1
  621. package/dist/selftest/generate.test.js +33 -9
  622. package/dist/selftest/git-access.test.d.ts +1 -1
  623. package/dist/selftest/git-access.test.js +42 -4
  624. package/dist/selftest/guest-boot.test.d.ts +1 -1
  625. package/dist/selftest/guest-boot.test.js +25 -7
  626. package/dist/selftest/host-sim.test.d.ts +1 -1
  627. package/dist/selftest/host-sim.test.js +27 -3
  628. package/dist/selftest/hostile-input.test.d.ts +1 -1
  629. package/dist/selftest/hostile-input.test.js +5 -5
  630. package/dist/selftest/index.d.ts +1 -1
  631. package/dist/selftest/index.js +73 -16
  632. package/dist/selftest/layout.test.d.ts +2 -0
  633. package/dist/selftest/layout.test.js +131 -0
  634. package/dist/selftest/links.test.d.ts +1 -1
  635. package/dist/selftest/links.test.js +16 -11
  636. package/dist/selftest/live-daemon.test.d.ts +1 -1
  637. package/dist/selftest/live-daemon.test.js +20 -8
  638. package/dist/selftest/live-git.test.d.ts +1 -1
  639. package/dist/selftest/live-git.test.js +13 -4
  640. package/dist/selftest/live-network.test.d.ts +1 -1
  641. package/dist/selftest/live-network.test.js +24 -9
  642. package/dist/selftest/live-projects.test.d.ts +1 -1
  643. package/dist/selftest/live-projects.test.js +47 -20
  644. package/dist/selftest/live-terminal.test.d.ts +2 -0
  645. package/dist/selftest/live-terminal.test.js +195 -0
  646. package/dist/selftest/local-config.test.d.ts +1 -1
  647. package/dist/selftest/local-config.test.js +88 -15
  648. package/dist/selftest/mirror.test.d.ts +1 -1
  649. package/dist/selftest/mirror.test.js +118 -19
  650. package/dist/selftest/network.test.d.ts +1 -1
  651. package/dist/selftest/network.test.js +17 -8
  652. package/dist/selftest/personalization.test.d.ts +1 -1
  653. package/dist/selftest/personalization.test.js +12 -5
  654. package/dist/selftest/projects.test.d.ts +1 -1
  655. package/dist/selftest/projects.test.js +336 -72
  656. package/dist/selftest/repair.test.d.ts +1 -1
  657. package/dist/selftest/repair.test.js +17 -5
  658. package/dist/selftest/repo-guard.test.d.ts +1 -1
  659. package/dist/selftest/repo-guard.test.js +21 -20
  660. package/dist/selftest/secrets.test.d.ts +1 -1
  661. package/dist/selftest/secrets.test.js +57 -13
  662. package/dist/selftest/setup.test.d.ts +1 -1
  663. package/dist/selftest/setup.test.js +25 -5
  664. package/dist/selftest/{fixtures.d.ts → support/fixtures.d.ts} +7 -4
  665. package/dist/selftest/{fixtures.js → support/fixtures.js} +95 -17
  666. package/dist/selftest/{harness.js → support/harness.js} +24 -7
  667. package/dist/selftest/{live.d.ts → support/live.d.ts} +2 -2
  668. package/dist/selftest/{live.js → support/live.js} +34 -10
  669. package/dist/selftest/support/suite.js +1 -0
  670. package/dist/selftest/sync.test.d.ts +1 -1
  671. package/dist/selftest/sync.test.js +64 -26
  672. package/dist/selftest/test-guard.test.d.ts +1 -1
  673. package/dist/selftest/test-guard.test.js +43 -15
  674. package/dist/selftest/toolchains.test.d.ts +1 -1
  675. package/dist/selftest/toolchains.test.js +135 -36
  676. package/dist/selftest/workspace-view.test.d.ts +1 -1
  677. package/dist/selftest/workspace-view.test.js +48 -11
  678. package/dist/selftest/workspace.test.d.ts +1 -1
  679. package/dist/selftest/workspace.test.js +13 -4
  680. package/dist/shared/{apps.d.ts → apps/catalogue.d.ts} +1 -11
  681. package/dist/shared/apps/catalogue.js +768 -0
  682. package/dist/shared/apps/index.d.ts +2 -0
  683. package/dist/shared/apps/index.js +2 -0
  684. package/dist/shared/apps/selection.d.ts +11 -0
  685. package/dist/shared/apps/selection.js +40 -0
  686. package/dist/shared/channel/index.d.ts +2 -0
  687. package/dist/shared/channel/index.js +2 -0
  688. package/dist/shared/channel/run-dir.d.ts +30 -0
  689. package/dist/shared/channel/run-dir.js +84 -0
  690. package/dist/shared/{schema.d.ts → channel/schema.d.ts} +60 -19
  691. package/dist/shared/channel/schema.js +131 -0
  692. package/dist/shared/download/archive.d.ts +13 -0
  693. package/dist/shared/download/archive.js +57 -0
  694. package/dist/shared/download/downloader.d.ts +35 -0
  695. package/dist/shared/download/downloader.js +110 -0
  696. package/dist/shared/download/github.d.ts +16 -0
  697. package/dist/shared/download/github.js +74 -0
  698. package/dist/shared/download/http.d.ts +5 -0
  699. package/dist/shared/download/http.js +30 -0
  700. package/dist/shared/download/index.d.ts +5 -0
  701. package/dist/shared/download/index.js +5 -0
  702. package/dist/shared/download/spawn.d.ts +2 -0
  703. package/dist/shared/download/spawn.js +7 -0
  704. package/dist/shared/io/index.d.ts +3 -0
  705. package/dist/shared/io/index.js +3 -0
  706. package/dist/shared/io/json-file.d.ts +10 -0
  707. package/dist/shared/io/json-file.js +21 -0
  708. package/dist/shared/io/json.d.ts +13 -0
  709. package/dist/shared/io/json.js +49 -0
  710. package/dist/shared/{safe-remove.js → io/safe-remove.js} +32 -7
  711. package/dist/shared/{netrules.js → network/firewall-rules.js} +36 -5
  712. package/dist/shared/network/index.d.ts +2 -0
  713. package/dist/shared/network/index.js +2 -0
  714. package/dist/shared/{netpolicy.js → network/policy.js} +66 -11
  715. package/dist/shared/{paths.js → paths/claude-paths.js} +12 -2
  716. package/dist/shared/{guest-paths.d.ts → paths/guest-paths.d.ts} +21 -0
  717. package/dist/shared/paths/guest-paths.js +146 -0
  718. package/dist/shared/paths/index.d.ts +3 -0
  719. package/dist/shared/paths/index.js +3 -0
  720. package/dist/shared/{projects.d.ts → paths/projects.d.ts} +27 -4
  721. package/dist/shared/paths/projects.js +136 -0
  722. package/dist/shared/pty/client.d.ts +21 -0
  723. package/dist/shared/pty/client.js +79 -0
  724. package/dist/shared/pty/console-input.d.ts +11 -0
  725. package/dist/shared/pty/console-input.js +81 -0
  726. package/dist/shared/pty/index.d.ts +6 -0
  727. package/dist/shared/pty/index.js +6 -0
  728. package/dist/shared/pty/input-joiner.d.ts +15 -0
  729. package/dist/shared/pty/input-joiner.js +44 -0
  730. package/dist/shared/pty/output-filter.d.ts +13 -0
  731. package/dist/shared/pty/output-filter.js +140 -0
  732. package/dist/shared/pty/protocol.d.ts +36 -0
  733. package/dist/shared/pty/protocol.js +60 -0
  734. package/dist/shared/pty/terminal.d.ts +24 -0
  735. package/dist/shared/pty/terminal.js +147 -0
  736. package/dist/shared/test-guard.js +3 -1
  737. package/dist/sync/claude-mem.d.ts +1 -1
  738. package/dist/sync/claude-mem.js +9 -4
  739. package/dist/sync/history.d.ts +1 -29
  740. package/dist/sync/history.js +57 -45
  741. package/dist/sync/index.d.ts +5 -0
  742. package/dist/sync/index.js +5 -0
  743. package/dist/sync/sync-cycle.d.ts +18 -0
  744. package/dist/sync/sync-cycle.js +85 -0
  745. package/dist/sync/sync-state.d.ts +32 -0
  746. package/dist/sync/sync-state.js +37 -0
  747. package/dist/sync/watcher.d.ts +0 -18
  748. package/dist/sync/watcher.js +66 -100
  749. package/native/keep-awake.ps1 +8 -0
  750. package/native/power.cs +23 -0
  751. package/native/stop-events.ps1 +38 -0
  752. package/package.json +11 -3
  753. package/sandbox/linkgate.cs +98 -0
  754. package/sandbox/memlog.ps1 +15 -6
  755. package/sandbox/ptyhost.cs +60 -3
  756. package/schemas/config.schema.json +48 -1
  757. package/schemas/sandbox-config.schema.json +37 -3
  758. package/dist/cli/commands/launch.d.ts +0 -29
  759. package/dist/cli/commands/launch.js +0 -366
  760. package/dist/cli/commands/maintenance.d.ts +0 -10
  761. package/dist/cli/commands/maintenance.js +0 -187
  762. package/dist/cli/commands/project.d.ts +0 -29
  763. package/dist/cli/commands/project.js +0 -63
  764. package/dist/cli/commands/projects.d.ts +0 -14
  765. package/dist/cli/commands/projects.js +0 -146
  766. package/dist/cli/commands/restart.d.ts +0 -6
  767. package/dist/cli/commands/restart.js +0 -85
  768. package/dist/cli/commands/sessions.d.ts +0 -12
  769. package/dist/cli/commands/sessions.js +0 -257
  770. package/dist/cli/menu/settings/editors.js +0 -305
  771. package/dist/cli/progress.d.ts +0 -9
  772. package/dist/cli/progress.js +0 -49
  773. package/dist/cli/tui/dialogs.d.ts +0 -57
  774. package/dist/cli/tui/dialogs.js +0 -162
  775. package/dist/core/config.js +0 -109
  776. package/dist/core/schema.d.ts +0 -6
  777. package/dist/core/schema.js +0 -8
  778. package/dist/core/util.d.ts +0 -62
  779. package/dist/core/util.js +0 -156
  780. package/dist/core/workspace.d.ts +0 -18
  781. package/dist/core/workspace.js +0 -145
  782. package/dist/guest/boot-env.d.ts +0 -4
  783. package/dist/guest/daemon.js +0 -57
  784. package/dist/guest/env.d.ts +0 -52
  785. package/dist/guest/env.js +0 -103
  786. package/dist/guest/gitrules.js +0 -11
  787. package/dist/guest/project-status.d.ts +0 -5
  788. package/dist/guest/project-status.js +0 -17
  789. package/dist/guest/setup/user.js +0 -51
  790. package/dist/guest/toolchains/cli.d.ts +0 -10
  791. package/dist/guest/toolchains/common.d.ts +0 -54
  792. package/dist/guest/toolchains/common.js +0 -147
  793. package/dist/guest/toolchains/databases/dynamodb.d.ts +0 -8
  794. package/dist/guest/toolchains/databases/dynamodb.js +0 -52
  795. package/dist/guest/toolchains/databases/index.d.ts +0 -6
  796. package/dist/guest/toolchains/databases/index.js +0 -62
  797. package/dist/guest/toolchains/databases/mongodb.d.ts +0 -3
  798. package/dist/guest/toolchains/databases/mongodb.js +0 -31
  799. package/dist/guest/toolchains/databases/mysql.d.ts +0 -3
  800. package/dist/guest/toolchains/databases/mysql.js +0 -38
  801. package/dist/guest/toolchains/databases/postgres.d.ts +0 -5
  802. package/dist/guest/toolchains/databases/postgres.js +0 -38
  803. package/dist/guest/toolchains/databases/redis.d.ts +0 -3
  804. package/dist/guest/toolchains/databases/redis.js +0 -16
  805. package/dist/guest/toolchains/git.d.ts +0 -3
  806. package/dist/guest/toolchains/go.d.ts +0 -3
  807. package/dist/guest/toolchains/java.d.ts +0 -8
  808. package/dist/guest/toolchains/node.d.ts +0 -3
  809. package/dist/guest/toolchains/pwsh.d.ts +0 -4
  810. package/dist/guest/toolchains/python.d.ts +0 -3
  811. package/dist/guest/toolchains/scripting/php.d.ts +0 -3
  812. package/dist/guest/toolchains/scripting/ruby.d.ts +0 -3
  813. package/dist/host/accounts.d.ts +0 -32
  814. package/dist/host/accounts.js +0 -128
  815. package/dist/host/agent-commands.d.ts +0 -25
  816. package/dist/host/agent-commands.js +0 -145
  817. package/dist/host/channel.d.ts +0 -38
  818. package/dist/host/channel.js +0 -162
  819. package/dist/host/generate.d.ts +0 -13
  820. package/dist/host/generate.js +0 -108
  821. package/dist/host/join.d.ts +0 -28
  822. package/dist/host/join.js +0 -76
  823. package/dist/host/launch/projects.d.ts +0 -15
  824. package/dist/host/launch/wsb.js +0 -34
  825. package/dist/host/motw.d.ts +0 -17
  826. package/dist/host/motw.js +0 -74
  827. package/dist/host/pc-scan.d.ts +0 -6
  828. package/dist/host/personalize.d.ts +0 -10
  829. package/dist/host/personalize.js +0 -97
  830. package/dist/host/platform.js +0 -129
  831. package/dist/host/project-scan.d.ts +0 -7
  832. package/dist/host/projects.d.ts +0 -100
  833. package/dist/host/projects.js +0 -147
  834. package/dist/host/repo-guard.d.ts +0 -43
  835. package/dist/host/repo-guard.js +0 -347
  836. package/dist/host/secrets.d.ts +0 -14
  837. package/dist/host/secrets.js +0 -133
  838. package/dist/host/stops.d.ts +0 -67
  839. package/dist/host/stops.js +0 -126
  840. package/dist/shared/apps.js +0 -114
  841. package/dist/shared/download.d.ts +0 -60
  842. package/dist/shared/download.js +0 -215
  843. package/dist/shared/guest-paths.js +0 -61
  844. package/dist/shared/projects.js +0 -67
  845. package/dist/shared/pty-client.d.ts +0 -91
  846. package/dist/shared/pty-client.js +0 -349
  847. package/dist/shared/rundir.d.ts +0 -41
  848. package/dist/shared/rundir.js +0 -96
  849. package/dist/shared/schema.js +0 -92
  850. /package/dist/{guest/daemon.d.ts → cli/tui/list/list-types.js} +0 -0
  851. /package/dist/{guest/db.d.ts → cli/tui/screen.js} +0 -0
  852. /package/dist/core/{detect-databases.d.ts → detect/databases.d.ts} +0 -0
  853. /package/dist/{guest/toolchains → core/detect}/versions.d.ts +0 -0
  854. /package/dist/guest/{setup/agents.d.ts → agents/agent-installer.d.ts} +0 -0
  855. /package/dist/guest/{audit-parse.d.ts → audit/parse.d.ts} +0 -0
  856. /package/dist/guest/{guide.d.ts → boot/guide.d.ts} +0 -0
  857. /package/dist/guest/daemon/{shutdown.d.ts → idle-shutdown.d.ts} +0 -0
  858. /package/dist/guest/daemon/{session.d.ts → sessions.d.ts} +0 -0
  859. /package/dist/guest/{main.d.ts → entries/daemon.d.ts} +0 -0
  860. /package/dist/guest/{netproxy.d.ts → entries/db.d.ts} +0 -0
  861. /package/dist/{selftest/suite.js → guest/entries/gitguard.d.ts} +0 -0
  862. /package/dist/guest/{gitguard.d.ts → git/decision.d.ts} +0 -0
  863. /package/dist/guest/{ports.d.ts → runtime/ports.d.ts} +0 -0
  864. /package/dist/guest/{project-context.d.ts → runtime/project-context.d.ts} +0 -0
  865. /package/dist/guest/{cmdline.d.ts → sessions/cmdline.d.ts} +0 -0
  866. /package/dist/guest/{ptyhost.d.ts → sessions/pty-host.d.ts} +0 -0
  867. /package/dist/guest/{view.d.ts → sessions/viewer.d.ts} +0 -0
  868. /package/dist/guest/setup/{policy.d.ts → managed-policy.d.ts} +0 -0
  869. /package/dist/host/{window.d.ts → sandbox/window.d.ts} +0 -0
  870. /package/dist/host/{wsb.d.ts → sandbox/wsb-cli.d.ts} +0 -0
  871. /package/dist/host/{cleanup.d.ts → storage/cleanup.d.ts} +0 -0
  872. /package/dist/selftest/{harness.d.ts → support/harness.d.ts} +0 -0
  873. /package/dist/selftest/{suite.d.ts → support/suite.d.ts} +0 -0
  874. /package/dist/shared/{safe-remove.d.ts → io/safe-remove.d.ts} +0 -0
  875. /package/dist/shared/{netrules.d.ts → network/firewall-rules.d.ts} +0 -0
  876. /package/dist/shared/{netpolicy.d.ts → network/policy.d.ts} +0 -0
  877. /package/dist/shared/{paths.d.ts → paths/claude-paths.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: GuestPath.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: mapped to C:\\Mirror\\F\\... and shown as F: (subst) at boot."),
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,153 +26344,225 @@ 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
- 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
+ )
25577
26387
  });
25578
26388
 
25579
26389
  // src/core/schema/config.ts
25580
- var Config = external_exports.strictObject({
25581
- $schema: SchemaRef.optional(),
25582
- defaultHarness: Name.describe("Agent started by `sandbox launch` (sandbox claude always runs claude)."),
25583
- 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,
25584
26394
  readOnly: external_exports.boolean().describe("Map the workspace read-only."),
25585
- workspaceFilter: WorkspaceFilter,
25586
- audit: Audit,
25587
- mappings: external_exports.array(Mapping).describe("Extra folders from this PC."),
25588
- sandbox: Sandbox,
26395
+ workspaceFilter: WorkspaceFilterSchema,
26396
+ audit: AuditSchema,
26397
+ mappings: external_exports.array(MappingSchema).describe("Extra folders from this PC."),
26398
+ sandbox: SandboxSchema,
25589
26399
  storage: external_exports.strictObject({
25590
26400
  root: external_exports.string().min(1).describe("Where everything is kept on this PC (tools, databases, logins, launches)."),
25591
26401
  persistAgentState: external_exports.boolean().describe("Keep agent logins and history between sandboxes."),
25592
- dataName: Name.describe("Name of the persistent data set (C:\\AgentData) shared by all workspaces."),
25593
- 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.`),
25594
- 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
+ )
25595
26409
  }),
25596
- network: Network,
25597
- provisioning: Provisioning,
25598
- downloads: Downloads,
25599
- toolchains: Toolchains,
25600
- databases: Databases.describe("Databases running inside the sandbox. Data persists in C:\\AgentData\\databases; each one starts at boot."),
25601
- attach: Attach,
25602
- agentCommands: AgentCommands,
25603
- 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,
25604
26420
  personalization: toggle("Copy your desktop look (theme, accent, taskbar, wallpaper, ...) into the sandbox."),
25605
- apps: Apps,
25606
- claudeProfile: ClaudeProfile,
25607
- 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."),
25608
26424
  hooks: external_exports.strictObject({ failFast: external_exports.boolean().describe("Stop when a hook script fails.") }),
25609
- projects: Projects.describe("Several projects in one sandbox: folders of projects mapped at every start, and adding folders while it runs.")
25610
- }).refine((c) => c.harnesses[c.defaultHarness] !== void 0, { message: "defaultHarness must be one of the configured harnesses", path: ["defaultHarness"] });
25611
- var LocalOverrides = external_exports.strictObject({
25612
- $schema: SchemaRef,
25613
- harness: Name.describe("Agent for this project."),
25614
- 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,
25615
26436
  readOnly: external_exports.boolean().describe("Map this project read-only."),
25616
26437
  // A project may turn the filter on and keep more out, never let ignored files in.
25617
- workspaceFilter: WorkspaceFilter.pick({ enabled: true, exclude: true }).partial(),
25618
- mappings: external_exports.array(Mapping).describe("Extra folders inside this project (relative to this file), e.g. a read-only data folder at another place in the sandbox."),
25619
- 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
+ ),
25620
26445
  // This PC's resources are yours to share: CPU and paging file (this PC's disk) are not a project's to set.
25621
- sandbox: Sandbox.omit({ cpuLimit: true, pageFileMb: true }).partial(),
26446
+ sandbox: SandboxSchema.omit({ cpuLimit: true, pageFileMb: true }).partial(),
25622
26447
  // A project may block more (the LAN, hosts); it never opens hosts, ports, DNS or a proxy.
25623
- network: Network.pick({ blockPrivateRanges: true, blockHosts: true }).partial(),
25624
- provisioning: Provisioning.pick({ copyFromHost: true, fallbackToInstall: true, refresh: true }).extend({ git: Git.partial(), terminal: toggle("Windows Terminal as the sandbox window.").partial() }).partial(),
25625
- 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(),
25626
26451
  // Every toolchain setting, each one optional (a project usually only switches languages on or pins a version).
25627
26452
  toolchains: external_exports.strictObject({
25628
- ...import_lodash.default.mapValues(import_lodash.default.omit(Toolchains.shape, "environment"), (shape) => shape.partial()),
25629
- environment: Toolchains.shape.environment
26453
+ ...import_lodash.default.mapValues(import_lodash.default.omit(ToolchainsSchema.shape, "environment"), (shape) => shape.partial()),
26454
+ environment: ToolchainsSchema.shape.environment
25630
26455
  }).partial(),
25631
- databases: external_exports.strictObject(import_lodash.default.mapValues(Databases.shape, (shape) => shape.partial())).partial(),
25632
- attach: Attach.partial(),
26456
+ databases: external_exports.strictObject(import_lodash.default.mapValues(DatabasesSchema.shape, (shape) => shape.partial())).partial(),
26457
+ attach: AttachSchema.partial(),
25633
26458
  personalization: toggle("Copy your desktop look into the sandbox.").partial(),
25634
- // Catalogue apps only (a vetted list): your own programs (apps.custom) download anything, so a repo cannot add them.
25635
- apps: Apps.pick({ install: true }).partial(),
25636
- 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(),
25637
26469
  hooks: external_exports.strictObject({ failFast: external_exports.boolean() }).partial()
25638
26470
  }).partial();
25639
26471
 
25640
- // src/shared/schema.ts
25641
- 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");
25642
26474
  var Text = (max = 4096) => external_exports.string().max(max);
25643
- var Time = Text(64);
25644
- var AttachEndpoint = external_exports.strictObject({
26475
+ var TimeSchema = Text(64);
26476
+ var AttachEndpointSchema = external_exports.strictObject({
25645
26477
  addresses: external_exports.array(Text(64)).max(16),
25646
26478
  port: external_exports.number().int().min(1024).max(65535),
25647
26479
  token: Text(256)
25648
26480
  });
25649
- var SandboxStatus = external_exports.object({
26481
+ var BootProgressSchema = external_exports.strictObject({
26482
+ step: external_exports.number().int().min(1).max(32),
26483
+ steps: external_exports.number().int().min(1).max(32),
26484
+ title: Text(120),
26485
+ /** Being set up now; percent while it downloads (when the size is known). */
26486
+ active: external_exports.array(external_exports.strictObject({ name: Text(64), percent: external_exports.number().int().min(0).max(100).optional() })).max(8),
26487
+ done: external_exports.number().int().min(0).max(1e3),
26488
+ total: external_exports.number().int().min(0).max(1e3)
26489
+ });
26490
+ var SandboxStatusSchema = external_exports.object({
25650
26491
  launchId: Text(64),
25651
26492
  phase: external_exports.enum(["booting", "provisioning", "ready", "failed"]),
25652
26493
  message: Text(),
25653
- updatedAt: Time,
26494
+ updatedAt: TimeSchema,
25654
26495
  workspaceHost: Text(),
25655
26496
  guestWorkspace: Text(),
25656
26497
  headless: external_exports.boolean(),
25657
26498
  /** The sandbox's IPv4 addresses (for network.forwardPorts; the host only uses ones on its Hyper-V network). */
25658
- addresses: external_exports.array(external_exports.string().max(45)).max(8).optional()
26499
+ addresses: external_exports.array(external_exports.string().max(45)).max(8).optional(),
26500
+ /** A malformed progress is dropped, never the status (the phase still counts). */
26501
+ progress: BootProgressSchema.optional().catch(void 0)
25659
26502
  });
25660
- var Version = external_exports.strictObject({ spec: Text(128), source: Text(256) });
25661
- var DatabasePlan = external_exports.strictObject({
26503
+ var VersionSchema = external_exports.strictObject({ spec: Text(128), source: Text(256) });
26504
+ var DatabasePlanSchema = external_exports.strictObject({
25662
26505
  database: external_exports.enum(["postgres", "mysql", "sqlserver", "mongodb", "redis", "dynamodb"]),
25663
26506
  reasons: external_exports.array(Text(1024)).max(32),
25664
26507
  version: Text(64),
25665
26508
  port: external_exports.number().int().min(1024).max(65535),
25666
26509
  adminPort: external_exports.number().int().min(1024).max(65535).optional()
25667
26510
  });
25668
- var ProjectSpec = external_exports.strictObject({
25669
- name: Id,
26511
+ var ProjectSpecSchema = external_exports.strictObject({
26512
+ name: IdSchema,
25670
26513
  /** Inside the sandbox: C:\Projects\<name>. */
25671
26514
  workspace: Text(1024),
25672
26515
  workspaceHost: Text(1024),
25673
- toolchains: Toolchains,
25674
- versions: external_exports.strictObject({ node: Version, nodeExtra: external_exports.array(Text(128)).max(16), python: Version }),
25675
- 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),
25676
26519
  /** Agents this project may start that the sandbox did not boot with (its .sandbox-config.json "harness"). */
25677
- 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"),
25678
26521
  /** Its hooks were staged in C:\AgentLaunch\projects\<name>\hooks. */
25679
26522
  hooks: external_exports.boolean()
25680
26523
  });
25681
- var GuestRequest = external_exports.discriminatedUnion("kind", [
25682
- 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
+ }),
25683
26535
  /** Provision a registered project without starting an agent (sandbox start / exec / db from its folder). */
25684
- external_exports.strictObject({ kind: external_exports.literal("project"), id: Id, project: ProjectSpec, createdAt: Time }),
25685
- 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
+ }),
25686
26545
  /** cwd: only the sessions in this folder or below (one project's); omitted = every session. */
25687
- external_exports.strictObject({ kind: external_exports.literal("restart"), id: Id, harness: Text(64).nullable(), cwd: Text().optional(), createdAt: Time }),
25688
- 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 })
25689
26554
  ]);
25690
- var GuestResponse = external_exports.object({
25691
- id: Id,
26555
+ var GuestResponseSchema = external_exports.object({
26556
+ id: IdSchema,
25692
26557
  ok: external_exports.boolean(),
25693
26558
  message: Text(65536),
25694
26559
  exitCode: external_exports.number().int().optional(),
25695
26560
  stdout: Text(4 * 1024 * 1024).optional(),
25696
26561
  stderr: Text(4 * 1024 * 1024).optional(),
25697
- finishedAt: Time
26562
+ finishedAt: TimeSchema
25698
26563
  });
25699
- var SessionStatus = external_exports.object({
25700
- id: Id,
26564
+ var SessionStatusSchema = external_exports.object({
26565
+ id: IdSchema,
25701
26566
  launchId: Text(64),
25702
26567
  harness: Text(64),
25703
26568
  cwd: Text(),
@@ -25705,22 +26570,22 @@ var SessionStatus = external_exports.object({
25705
26570
  project: Text(64).optional(),
25706
26571
  phase: external_exports.enum(["starting", "running", "exited", "failed"]),
25707
26572
  message: Text(),
25708
- updatedAt: Time,
25709
- startedAt: Time,
26573
+ updatedAt: TimeSchema,
26574
+ startedAt: TimeSchema,
25710
26575
  exitCode: external_exports.number().int().optional(),
25711
- attach: AttachEndpoint.optional()
26576
+ attach: AttachEndpointSchema.optional()
25712
26577
  });
25713
- var ProjectStatus = external_exports.object({
25714
- name: Id,
26578
+ var ProjectStatusSchema = external_exports.object({
26579
+ name: IdSchema,
25715
26580
  workspace: Text(1024),
25716
26581
  phase: external_exports.enum(["provisioning", "ready", "failed"]),
25717
26582
  message: Text(),
25718
- updatedAt: Time,
26583
+ updatedAt: TimeSchema,
25719
26584
  databases: external_exports.array(external_exports.object({ database: Text(32), port: external_exports.number().int() })).max(16),
25720
26585
  summary: external_exports.array(Text(512)).max(64)
25721
26586
  });
25722
26587
 
25723
- // src/guest/ports.ts
26588
+ // src/guest/runtime/ports.ts
25724
26589
  import net from "node:net";
25725
26590
  var portOpen = (port) => new Promise((resolve) => {
25726
26591
  const socket = net.connect({ host: "127.0.0.1", port }, () => {
@@ -25737,64 +26602,42 @@ var waitForPort = async (port, seconds) => {
25737
26602
  return false;
25738
26603
  };
25739
26604
 
25740
- // src/guest/toolchains/databases/index.ts
25741
- import fs10 from "node:fs";
25742
- import path15 from "node:path";
25743
- import { spawnSync as spawnSync2 } from "node:child_process";
25744
-
25745
- // src/shared/system.ts
25746
- import path from "node:path";
25747
- var systemRoot = () => process.env.SystemRoot ?? process.env.WINDIR ?? "C:\\Windows";
25748
- var system32 = (exe) => path.join(systemRoot(), "System32", exe);
25749
- var SYSTEM = {
25750
- cmd: () => system32("cmd.exe"),
25751
- powershell: () => system32("WindowsPowerShell\\v1.0\\powershell.exe"),
25752
- tasklist: () => system32("tasklist.exe"),
25753
- tar: () => system32("tar.exe"),
25754
- reg: () => system32("reg.exe"),
25755
- netsh: () => system32("netsh.exe"),
25756
- netstat: () => system32("NETSTAT.EXE"),
25757
- route: () => system32("ROUTE.EXE"),
25758
- ipconfig: () => system32("ipconfig.exe"),
25759
- robocopy: () => system32("Robocopy.exe"),
25760
- shutdown: () => system32("shutdown.exe"),
25761
- dism: () => system32("Dism.exe"),
25762
- 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"
25763
26613
  };
25764
26614
 
25765
- // src/guest/env.ts
25766
- import fs5 from "node:fs";
25767
- import path6 from "node:path";
25768
- import { spawnSync } from "node:child_process";
26615
+ // src/guest/runtime/paths.ts
26616
+ import path5 from "node:path";
25769
26617
 
25770
- // src/shared/download.ts
25771
- import fs3 from "node:fs";
26618
+ // src/shared/channel/run-dir.ts
26619
+ import fs4 from "node:fs";
25772
26620
  import path4 from "node:path";
25773
- import crypto from "node:crypto";
25774
- import { spawn } from "node:child_process";
25775
- import { Readable, Transform } from "node:stream";
25776
- import { pipeline } from "node:stream/promises";
25777
26621
 
25778
- // src/shared/safe-remove.ts
26622
+ // src/shared/io/json.ts
25779
26623
  import fs2 from "node:fs";
25780
- import os2 from "node:os";
25781
- import path3 from "node:path";
26624
+ import path2 from "node:path";
25782
26625
 
25783
26626
  // src/shared/test-guard.ts
25784
26627
  import fs from "node:fs";
25785
26628
  import os from "node:os";
25786
- import path2 from "node:path";
26629
+ import path from "node:path";
25787
26630
  var selfTestRunning = () => process.env.AGENT_SANDBOX_SELFTEST === "1";
25788
26631
  var canonical = (p) => {
25789
26632
  let rest = "";
25790
- let current = path2.resolve(p);
26633
+ let current = path.resolve(p);
25791
26634
  for (; ; ) {
25792
26635
  try {
25793
- return path2.join(fs.realpathSync.native(current), rest).toLowerCase();
26636
+ return path.join(fs.realpathSync.native(current), rest).toLowerCase();
25794
26637
  } catch {
25795
- const parent = path2.dirname(current);
25796
- if (parent === current) return path2.resolve(p).toLowerCase();
25797
- 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);
25798
26641
  current = parent;
25799
26642
  }
25800
26643
  }
@@ -25803,14 +26646,55 @@ var testWriteRefusal = (target) => {
25803
26646
  if (!selfTestRunning()) return null;
25804
26647
  const temp = canonical(os.tmpdir());
25805
26648
  const t = canonical(target);
25806
- 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.";
25807
26650
  };
25808
26651
  var assertTestWritable = (target) => {
25809
26652
  const refusal = testWriteRefusal(target);
25810
26653
  if (refusal) throw new Error(refusal);
25811
26654
  };
25812
26655
 
25813
- // 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";
25814
26698
  var norm = (p) => path3.resolve(p).replace(/[\\/]+$/, "").toLowerCase();
25815
26699
  var isAncestorOrSame = (parent, child) => {
25816
26700
  const a = norm(parent);
@@ -25832,7 +26716,15 @@ var protectedFolders = () => [
25832
26716
  "C:\\Users",
25833
26717
  "C:\\Windows"
25834
26718
  ].filter((p) => typeof p === "string" && p.trim() !== "");
25835
- 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() !== "");
25836
26728
  var removeRefusal = (target, root) => {
25837
26729
  if (!target || !path3.isAbsolute(target) || !root || !path3.isAbsolute(root)) return "not an absolute path";
25838
26730
  if (/^[\\/]{2}[?.][\\/]/.test(target) || /^[\\/]{2}[?.][\\/]/.test(root)) return "a device path (\\\\?\\ or \\\\.\\)";
@@ -25851,34 +26743,143 @@ var safeRemove = (target, root) => {
25851
26743
  assertTestWritable(target);
25852
26744
  let stat;
25853
26745
  try {
25854
- stat = fs2.lstatSync(target);
26746
+ stat = fs3.lstatSync(target);
25855
26747
  } catch {
25856
26748
  return;
25857
26749
  }
25858
26750
  if (stat.isSymbolicLink()) {
25859
26751
  try {
25860
- fs2.unlinkSync(target);
26752
+ fs3.unlinkSync(target);
25861
26753
  } catch {
25862
- fs2.rmdirSync(target);
26754
+ fs3.rmdirSync(target);
25863
26755
  }
25864
26756
  return;
25865
26757
  }
25866
- fs2.rmSync(target, { recursive: true, force: true, maxRetries: 2 });
26758
+ fs3.rmSync(target, { recursive: true, force: true, maxRetries: 2 });
25867
26759
  };
25868
26760
 
25869
- // src/shared/download.ts
25870
- var USER_AGENT = "windows-development-sandbox";
25871
- var stagingFolder = (destination) => destination + ".staging-" + crypto.randomBytes(3).toString("hex");
25872
- var moveIntoPlace = (work, destination) => {
25873
- safeRemove(destination, path4.dirname(destination));
25874
- fs3.mkdirSync(path4.dirname(destination), { recursive: true });
25875
- 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 };
25876
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";
25877
26874
  var fetchRetry = async (url2, init = {}, attempts = 5, timeoutMs = 6e4) => {
25878
26875
  let last;
25879
26876
  for (let i = 1; i <= attempts; i++) {
25880
26877
  try {
25881
- 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
+ });
25882
26883
  if (response.ok) return response;
25883
26884
  last = new Error("HTTP " + response.status + " for " + url2);
25884
26885
  if (response.status === 404) break;
@@ -25891,42 +26892,174 @@ var fetchRetry = async (url2, init = {}, attempts = 5, timeoutMs = 6e4) => {
25891
26892
  };
25892
26893
  var fetchJson = async (url2) => await (await fetchRetry(url2, { headers: { Accept: "application/json" } }, 2, 2e4)).json();
25893
26894
  var fetchText = async (url2) => await (await fetchRetry(url2)).text();
25894
- var checksumRequired = false;
25895
- var setChecksumRequired = (on) => {
25896
- checksumRequired = on;
25897
- };
25898
- var download = async (url2, destination, expected = null) => {
25899
- const sums = typeof expected === "string" || expected === null ? { sha256: expected } : expected;
25900
- if (checksumRequired && !sums.sha256?.trim() && !sums.sha512?.trim()) {
25901
- 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.");
25902
- }
25903
- const response = await fetchRetry(url2, {}, 3, 20 * 60 * 1e3);
25904
- if (!response.body) throw new Error("Empty response for " + url2);
25905
- fs3.mkdirSync(path4.dirname(destination), { recursive: true });
25906
- const checks = ["sha256", "sha512"].flatMap((kind) => {
25907
- const want = sums[kind]?.trim().toLowerCase();
25908
- return want ? [{ want, hash: crypto.createHash(kind) }] : [];
25909
- });
25910
- const tap = new Transform({ transform(chunk, _encoding, done) {
25911
- for (const c of checks) c.hash.update(chunk);
25912
- done(null, chunk);
25913
- } });
25914
- const partial2 = destination + ".part";
25915
- try {
25916
- await pipeline(Readable.fromWeb(response.body), tap, fs3.createWriteStream(partial2));
25917
- if (checks.some((c) => c.hash.digest("hex") !== c.want)) throw new Error("Checksum mismatch for " + url2);
25918
- fs3.rmSync(destination, { force: true });
25919
- fs3.renameSync(partial2, destination);
25920
- } finally {
25921
- fs3.rmSync(partial2, { force: true });
25922
- }
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")
25923
26919
  };
26920
+
26921
+ // src/shared/download/spawn.ts
26922
+ import { spawn } from "node:child_process";
25924
26923
  var spawnAsync = (file2, args, options = {}) => new Promise((resolve, reject) => {
25925
26924
  const child = spawn(file2, args, { stdio: "ignore", windowsHide: true, ...options });
25926
26925
  child.once("error", reject);
25927
26926
  child.once("close", (code) => resolve(code ?? -1));
25928
26927
  });
25929
- var toAsset = (asset) => ({ url: asset.browser_download_url, name: asset.name, sha256: asset.digest?.startsWith("sha256:") ? asset.digest.slice(7) : null });
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
+ }
27016
+ }
27017
+ done(null, chunk);
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));
27052
+ }
27053
+ }
27054
+ };
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
27062
+ });
25930
27063
  var githubAsset = async (repo, pattern, searchOlder = false) => {
25931
27064
  let latest;
25932
27065
  try {
@@ -25938,13 +27071,17 @@ var githubAsset = async (repo, pattern, searchOlder = false) => {
25938
27071
  const hit = latest.assets.find((a) => pattern.test(a.name));
25939
27072
  if (hit) return toAsset(hit);
25940
27073
  if (searchOlder) {
25941
- 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
+ );
25942
27077
  for (const release of releases.filter((r) => !r.prerelease && !r.draft)) {
25943
27078
  const older = release.assets.find((a) => pattern.test(a.name));
25944
27079
  if (older) return toAsset(older);
25945
27080
  }
25946
27081
  }
25947
- 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
+ );
25948
27085
  };
25949
27086
  var parseReleasePage = (html) => {
25950
27087
  const links = [...html.matchAll(/href="(\/[^"]+\/releases\/download\/[^"]+)"/g)];
@@ -25960,172 +27097,193 @@ var latestGithubTag = async (repo) => {
25960
27097
  };
25961
27098
  var parseReleaseTags = (html, repo) => {
25962
27099
  const escaped = repo.replace(/[.*+?^${}()|[\]\\/]/g, "\\$&");
25963
- 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
+ );
25964
27103
  return [...new Set(tags)];
25965
27104
  };
25966
27105
  var OLDER_RELEASES = 10;
25967
27106
  var githubAssetFromPage = async (repo, pattern, searchOlder) => {
25968
- 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));
25969
27110
  const latest = await latestGithubTag(repo);
25970
27111
  const hit = await assetsOf(latest);
25971
27112
  if (hit) return hit;
25972
27113
  if (searchOlder) {
25973
- 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
+ );
25974
27117
  for (const tag of older.slice(0, OLDER_RELEASES)) {
25975
27118
  const found = await assetsOf(tag);
25976
27119
  if (found) return found;
25977
27120
  }
25978
27121
  }
25979
- 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
+ );
25980
27125
  };
25981
- var extractArchive = async (archive, destination, members2 = []) => {
25982
- fs3.mkdirSync(destination, { recursive: true });
25983
- let status = await spawnAsync(SYSTEM.tar(), ["-xf", archive, "-C", destination, ...members2]);
25984
- if (status !== 0 && /\.(zip|nupkg)$/i.test(archive)) {
25985
- const zip = archive.endsWith(".zip") ? archive : archive + ".zip";
25986
- if (zip !== archive) fs3.copyFileSync(archive, zip);
25987
- 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
+ }
25988
27156
  }
25989
- if (status !== 0) throw new Error("Could not extract " + archive);
25990
- };
25991
- var findFile = (root, name, maxDepth = 4) => {
25992
- if (maxDepth < 0 || !fs3.existsSync(root)) return null;
25993
- const entries = fs3.readdirSync(root, { withFileTypes: true });
25994
- for (const entry of entries) if (entry.isFile() && entry.name.toLowerCase() === name.toLowerCase()) return path4.join(root, entry.name);
25995
- for (const entry of entries) if (entry.isDirectory()) {
25996
- const found = findFile(path4.join(root, entry.name), name, maxDepth - 1);
25997
- if (found) return found;
27157
+ }
27158
+ var DatabaseServer = class {
27159
+ get label() {
27160
+ return DATABASE_NAMES[this.id];
25998
27161
  }
25999
- return null;
26000
- };
26001
- var installArchive = async (url2, destination, options = {}) => {
26002
- const work = stagingFolder(destination);
26003
- try {
26004
- const archive = path4.join(work, options.fileName ?? path4.basename(new URL(url2).pathname));
26005
- await download(url2, archive, { sha256: options.sha256, sha512: options.sha512 });
26006
- const extracted = path4.join(work, "x");
26007
- await extractArchive(archive, extracted, options.members);
26008
- let root = extracted;
26009
- if (options.locate) {
26010
- const found = findFile(extracted, options.locate);
26011
- if (!found) throw new Error(options.locate + " not found in " + url2);
26012
- root = path4.dirname(found);
26013
- for (let i = 0; i < (options.up ?? 0) && path4.dirname(root).startsWith(extracted); i++) root = path4.dirname(root);
26014
- }
26015
- moveIntoPlace(root, destination);
26016
- } finally {
26017
- 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);
26018
27165
  }
26019
27166
  };
26020
27167
 
26021
- // src/shared/rundir.ts
26022
- import fs4 from "node:fs";
26023
- import path5 from "node:path";
26024
- var MAX_MESSAGE_BYTES = 8 * 1024 * 1024;
26025
- var safeId = (id) => Id.parse(id);
26026
- var runPaths = (dataDir2) => {
26027
- const run2 = path5.join(dataDir2, "run");
26028
- const file2 = (dir) => (id) => path5.join(run2, dir, safeId(id) + ".json");
26029
- return {
26030
- run: run2,
26031
- sandbox: path5.join(run2, "sandbox.json"),
26032
- requests: path5.join(run2, "requests"),
26033
- responses: path5.join(run2, "responses"),
26034
- sessions: path5.join(run2, "sessions"),
26035
- projects: path5.join(run2, "projects"),
26036
- /** audit.processes: programs the sandbox started, in small .jsonl files the host takes in and deletes. */
26037
- audit: path5.join(run2, "audit"),
26038
- request: file2("requests"),
26039
- response: file2("responses"),
26040
- session: file2("sessions"),
26041
- project: file2("projects")
26042
- };
26043
- };
26044
- var pause = (ms) => {
26045
- Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
26046
- };
26047
- var writeJsonAtomic = (file2, value) => writeFileAtomic(file2, JSON.stringify(value, null, 2) + "\n");
26048
- var writeFileAtomic = (file2, text) => {
26049
- assertTestWritable(file2);
26050
- fs4.mkdirSync(path5.dirname(file2), { recursive: true });
26051
- const temp = file2 + "." + process.pid + "-" + Math.random().toString(36).slice(2) + ".tmp";
26052
- fs4.writeFileSync(temp, text, { encoding: "utf8", flag: "wx" });
26053
- for (let attempt = 1; ; attempt++) {
26054
- try {
26055
- fs4.renameSync(temp, file2);
26056
- return;
26057
- } catch (e) {
26058
- const code = e.code;
26059
- if (attempt >= 8 || code !== "EPERM" && code !== "EBUSY" && code !== "EACCES") {
26060
- fs4.rmSync(temp, { force: true });
26061
- throw e;
26062
- }
26063
- pause(50 * attempt);
26064
- }
26065
- }
26066
- };
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";
26067
27172
 
26068
- // src/guest/env.ts
26069
- var isWin = process.platform === "win32";
26070
- var dryRun = process.env.AGENT_DRY_RUN === "1";
26071
- var testMode = process.env.AGENT_SANDBOX_TEST === "1";
26072
- var launchDir = process.env.AGENT_LAUNCH_DIR ?? "C:\\AgentLaunch";
26073
- var dataDir = process.env.AGENT_DATA_DIR ?? "C:\\AgentData";
26074
- var hostToolsDir = process.env.AGENT_HOST_TOOLS_DIR ?? "C:\\HostTools";
26075
- var localDir = process.env.AGENT_LOCAL_DIR ?? "C:\\nvm";
26076
- var toolsDir = path6.join(dataDir, "tools");
26077
- var logsDir = path6.join(dataDir, "logs");
26078
- var run = runPaths(dataDir);
26079
- var session = JSON.parse(fs5.readFileSync(path6.join(launchDir, "session.json"), "utf8").replace(/^\uFEFF/, ""));
26080
- setChecksumRequired(session.downloads?.requireChecksum === true);
26081
- var workspace = process.env.AGENT_WORKSPACE ?? session.workspace;
26082
- var stateDir = path6.join(dataDir, session.persistAgentState ? "state" : "state-session");
26083
- var claudeDir = path6.join(stateDir, "claude");
26084
- fs5.mkdirSync(logsDir, { recursive: true });
26085
- var logFile = path6.join(logsDir, (process.env.AGENT_LOG_PREFIX ?? "guest") + "-" + (/* @__PURE__ */ new Date()).toISOString().replace(/[:.]/g, "-") + ".log");
26086
- var append = (line) => {
26087
- try {
26088
- fs5.appendFileSync(logFile, line + "\n");
26089
- } catch {
26090
- }
26091
- };
26092
- var log = (message) => {
26093
- console.log(message);
26094
- append(message);
26095
- };
26096
- var warn = (message) => {
26097
- console.warn("\x1B[33mWARNING: " + message + "\x1B[0m");
26098
- append("WARNING: " + message);
26099
- };
26100
- var errMsg = (e) => e instanceof Error ? e.message : String(e);
26101
- var exists = (p) => fs5.existsSync(p);
26102
- var mkdirp = (p) => {
26103
- fs5.mkdirSync(p, { recursive: true });
26104
- return p;
26105
- };
27173
+ // src/guest/runtime/process.ts
27174
+ import path11 from "node:path";
27175
+ import { spawnSync as spawnSync2 } from "node:child_process";
26106
27176
  var exec = (file2, args, options = {}) => {
26107
- const result = spawnSync(file2, args, { stdio: "inherit", windowsHide: true, ...options });
27177
+ const result = spawnSync2(file2, args, { stdio: "inherit", windowsHide: true, ...options });
26108
27178
  if (result.error) throw result.error;
26109
- 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);
26110
27181
  };
26111
27182
  var execAsync = async (file2, args, options = {}) => {
26112
27183
  const code = await spawnAsync(file2, args, { stdio: "inherit", ...options });
26113
- 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);
26114
27186
  };
26115
27187
  var powershell = (script) => exec(SYSTEM.powershell(), ["-NoLogo", "-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", script]);
26116
27188
 
26117
- // src/guest/toolchains/common.ts
26118
- import fs6 from "node:fs";
26119
- 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
+ };
26120
27196
 
26121
- // src/guest/project-context.ts
26122
- import { AsyncLocalStorage } from "node:async_hooks";
26123
- var store = new AsyncLocalStorage();
26124
- var projectWorkspace = () => store.getStore()?.workspace ?? workspace;
26125
- 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
+ }
27278
+
27279
+ // src/guest/toolchains/detect.ts
27280
+ import fs12 from "node:fs";
27281
+ import path13 from "node:path";
26126
27282
 
26127
- // src/guest/toolchains/versions.ts
26128
- var specFromVersionFile = (text) => /(\d+(?:\.\d+){0,2})/.exec(text.split(/\r?\n/).map((l) => l.replace(/#.*$/, "").trim()).find(Boolean) ?? "")?.[1] ?? null;
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;
26129
27287
  var javaMajorFrom = (text, sdkmanrc = false) => {
26130
27288
  const line = sdkmanrc ? /^\s*java\s*=\s*(.+)$/m.exec(text)?.[1] : text;
26131
27289
  const spec = line ? specFromVersionFile(line) : null;
@@ -26134,15 +27292,49 @@ var javaMajorFrom = (text, sdkmanrc = false) => {
26134
27292
  return major === "1" && minor ? minor : major;
26135
27293
  };
26136
27294
 
26137
- // src/core/detect-toolchains.ts
27295
+ // src/core/detect/toolchains.ts
26138
27296
  var MARKERS = {
26139
- 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
+ ],
26140
27309
  rust: ["Cargo.toml", "rust-toolchain", "rust-toolchain.toml"],
26141
27310
  msvc: ["*.vcxproj", "CMakePresets.json", "CMakeUserPresets.json"],
26142
- 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
+ ],
26143
27324
  dotnet: ["*.sln", "*.slnx", "*.csproj", "*.fsproj", "*.vbproj", "global.json", "*.cs"],
26144
27325
  go: ["go.mod", "go.work", "*.go"],
26145
- 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
+ ],
26146
27338
  ruby: ["Gemfile", "*.gemspec", ".ruby-version", "*.rb"],
26147
27339
  php: ["composer.json", "artisan", ".php-version", "*.php"],
26148
27340
  deno: ["deno.json", "deno.jsonc", "deno.lock"],
@@ -26152,117 +27344,89 @@ var MARKERS = {
26152
27344
  var AUTO_TOOLCHAINS = Object.keys(MARKERS);
26153
27345
  var PROJECT_FILES = [.../* @__PURE__ */ new Set([...Object.values(MARKERS).flat(), "package.json", "deno.json", "*.ts", "*.js"])];
26154
27346
 
26155
- // src/guest/toolchains/common.ts
26156
- var emptyEnv = () => ({ vars: {}, prepend: [], append: [], summary: [] });
26157
- var arch = process.arch === "arm64" ? "arm64" : "x64";
26158
- var tool = (...parts) => path7.join(toolsDir, ...parts);
26159
- var readState = (file2, schema, empty) => {
26160
- try {
26161
- return schema.safeParse(JSON.parse(fs6.readFileSync(file2, "utf8").replace(/^/, ""))).data ?? empty;
26162
- } catch {
26163
- return empty;
26164
- }
26165
- };
26166
- 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() })]));
26167
- var resolvedFile = () => tool("resolved-versions.json");
26168
- var remembered = () => Object.fromEntries(Object.entries(readState(resolvedFile(), Resolved, {})).map(([k, v]) => [k, typeof v === "string" ? { value: v, at: 0 } : v]));
26169
- var FRESH_MS = 24 * 60 * 60 * 1e3;
26170
- var offline = false;
26171
- 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 ?? ""));
26172
- var resolveCached = async (key, resolve) => {
26173
- const cached2 = remembered()[key];
26174
- if (cached2 && (offline || !session.provisioning.refresh && Date.now() - cached2.at < FRESH_MS)) return cached2.value;
26175
- try {
26176
- const value = await resolve();
26177
- fs6.mkdirSync(toolsDir, { recursive: true });
26178
- writeJsonAtomic(resolvedFile(), { ...remembered(), [key]: { value, at: Date.now() } });
26179
- return value;
26180
- } catch (e) {
26181
- if (networkError(e)) offline = true;
26182
- if (!cached2) throw e;
26183
- warn("Could not look up the latest " + key + " online (" + errMsg(e) + "); using " + cached2.value + " from an earlier start.");
26184
- return cached2.value;
26185
- }
26186
- };
26187
- var installFromGithub = async (repo, pattern, o) => {
26188
- const asset = await githubAsset(repo, pattern, o.searchOlder);
26189
- log("Downloading " + (typeof o.what === "string" ? o.what : o.what(asset)) + " ...");
26190
- await installArchive(asset.url, o.dest, { sha256: asset.sha256, fileName: asset.name, ...o.locate ? { locate: o.locate } : {}, ...o.up ? { up: o.up } : {} });
26191
- };
26192
- var versionFromFiles = (files, parse3 = (t) => specFromVersionFile(t)) => {
27347
+ // src/guest/toolchains/detect.ts
27348
+ function versionFromFiles(files, parse3 = (t) => specFromVersionFile(t)) {
26193
27349
  for (const name of files) {
26194
- const file2 = path7.join(projectWorkspace(), name);
27350
+ const file2 = path13.join(projectWorkspace(), name);
26195
27351
  if (!exists(file2)) continue;
26196
- const spec = parse3(fs6.readFileSync(file2, "utf8"), name);
27352
+ const spec = parse3(fs12.readFileSync(file2, "utf8"), name);
26197
27353
  if (spec) return { spec, source: name };
26198
27354
  }
26199
27355
  return null;
26200
- };
26201
-
26202
- // src/guest/toolchains/databases/dynamodb.ts
26203
- import fs9 from "node:fs";
26204
- import path10 from "node:path";
26205
- import { spawn as spawn3 } from "node:child_process";
27356
+ }
26206
27357
 
26207
- // src/guest/toolchains/java.ts
26208
- import fs7 from "node:fs";
26209
- import path8 from "node:path";
27358
+ // src/guest/toolchains/languages/java.ts
26210
27359
  var ADOPTIUM = "https://api.adoptium.net/v3";
26211
27360
  var temurin = async (major) => {
26212
- 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
+ );
26213
27364
  return assets.find((a) => a.binary.package.name.endsWith(".zip")) ?? Promise.reject(new Error("No Temurin " + major + " JDK zip for Windows"));
26214
27365
  };
26215
27366
  var javaMajor = async (config2) => {
26216
- 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
+ );
26217
27371
  if (fromProject) return { major: fromProject.spec, source: fromProject.source };
26218
27372
  const spec = config2.version.trim().toLowerCase();
26219
27373
  if (spec !== "lts") return { major: javaMajorFrom(spec) ?? spec, source: "config" };
26220
- 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
+ );
26221
27378
  return { major: lts, source: "newest LTS" };
26222
27379
  };
26223
27380
  var setupJdk = async (env, config2) => {
26224
27381
  const { major, source } = await javaMajor(config2);
26225
27382
  const release = await resolveCached("java:" + major, async () => (await temurin(major)).release_name);
26226
27383
  const home = tool("java", release.replace(/[^A-Za-z0-9.-]/g, "_"));
26227
- if (!exists(path8.join(home, "bin", "java.exe"))) {
27384
+ if (!exists(path14.join(home, "bin", "java.exe"))) {
26228
27385
  const asset = await temurin(major);
26229
27386
  log("Downloading Java " + release + " (JDK, ~200 MB once) ...");
26230
- 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
+ });
26231
27392
  }
26232
27393
  env.vars.JAVA_HOME = home;
26233
- env.prepend.push(path8.join(home, "bin"));
27394
+ env.prepend.push(path14.join(home, "bin"));
26234
27395
  env.summary.push("java: " + release + " (Temurin, from " + source + ")");
26235
27396
  };
26236
- var ensureJdk = async () => {
27397
+ async function ensureJdk() {
26237
27398
  const root = tool("java");
26238
- 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 })) : [];
26239
- 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]);
26240
27401
  const scratch = emptyEnv();
26241
27402
  await setupJdk(scratch, { enabled: true, version: "lts", maven: false, gradle: false });
26242
27403
  return scratch.vars.JAVA_HOME;
26243
- };
27404
+ }
26244
27405
 
26245
- // src/guest/toolchains/databases/server.ts
26246
- import fs8 from "node:fs";
26247
- import path9 from "node:path";
27406
+ // src/guest/databases/server.ts
27407
+ import fs14 from "node:fs";
27408
+ import path15 from "node:path";
26248
27409
  import { spawn as spawn2 } from "node:child_process";
26249
- var dataFor = (name) => path9.join(dataDir, "databases", name);
26250
- 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) {
26251
27414
  if (await portOpen(port)) throw new Error("port " + port + " is already in use (change databases." + name + ".port)");
26252
- const logFile2 = path9.join(logsDir, name + ".log");
26253
- const out = fs8.openSync(logFile2, "a");
27415
+ const logFile2 = path15.join(logsDir, name + ".log");
27416
+ const out = fs14.openSync(logFile2, "a");
26254
27417
  spawn2(exe, args, { detached: true, stdio: ["ignore", out, out], windowsHide: true }).unref();
26255
- fs8.closeSync(out);
26256
- if (!await waitForPort(port, 60)) throw new Error(name + " did not start listening on port " + port + "; see " + logFile2);
26257
- };
26258
- 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) {
26259
27423
  if (await portOpen(port)) return;
26260
- for (const f of files) fs8.rmSync(path9.join(dir, f), { force: true });
26261
- };
26262
- var createOnce = async (data, marker, create) => {
26263
- 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;
26264
27428
  const existed = exists(data);
26265
- mkdirp(path9.dirname(data));
27429
+ mkdirp(path15.dirname(data));
26266
27430
  try {
26267
27431
  await create();
26268
27432
  } catch (e) {
@@ -26274,192 +27438,335 @@ var createOnce = async (data, marker, create) => {
26274
27438
  }
26275
27439
  throw e;
26276
27440
  }
26277
- };
27441
+ }
26278
27442
 
26279
- // src/guest/toolchains/databases/dynamodb.ts
27443
+ // src/guest/databases/dynamodb.ts
26280
27444
  var DYNAMO_ZIP = "https://d1ni2b6xgvw0s0.cloudfront.net/v2.x/dynamodb_local_latest.zip";
26281
- var setupDynamo = async (env, plan) => {
26282
- const java = path10.join(await ensureJdk(), "bin", "java.exe");
26283
- const home = tool("dynamodb-local");
26284
- if (!exists(path10.join(home, "DynamoDBLocal.jar"))) {
26285
- log("Downloading DynamoDB Local (~60 MB once) ...");
26286
- const sha256 = (await fetchText(DYNAMO_ZIP + ".sha256")).trim().split(/\s+/)[0];
26287
- await installArchive(DYNAMO_ZIP, home, { sha256, locate: "DynamoDBLocal.jar", fileName: "dynamodb_local.zip" });
26288
- }
26289
- const data = mkdirp(dataFor("dynamodb"));
26290
- 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);
26291
- const endpoint = "http://localhost:" + plan.port;
26292
- 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" };
26293
- Object.assign(env.vars, aws);
26294
- env.summary.push("dynamodb (DynamoDB Local): " + endpoint + " (AWS SDKs use it automatically via AWS_ENDPOINT_URL_DYNAMODB; dummy credentials)");
26295
- if (!plan.adminPort) return;
26296
- const prefix = tool("dynamodb-admin");
26297
- const script = path10.join(prefix, "node_modules", "dynamodb-admin", "dist", "dynamodb-admin.js");
26298
- if (!exists(script)) {
26299
- log("Installing dynamodb-admin, the DynamoDB web UI (~20 MB once) ...");
26300
- const npmCli = path10.join(path10.dirname(process.execPath), "node_modules", "npm", "bin", "npm-cli.js");
26301
- await execAsync(process.execPath, [npmCli, "install", "--global", "--prefix", prefix, "dynamodb-admin", "--no-fund", "--no-audit"], { stdio: "ignore" });
26302
- }
26303
- if (await portOpen(plan.adminPort)) {
26304
- env.summary.push("dynamodb-admin: NOT started, port " + plan.adminPort + " is in use (change databases.dynamodb.adminPort)");
26305
- 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
+ );
26306
27523
  }
26307
- const out = fs9.openSync(path10.join(logsDir, "dynamodb-admin.log"), "a");
26308
- 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();
26309
- fs9.closeSync(out);
26310
- if (!await waitForPort(plan.adminPort, 30)) throw new Error("dynamodb-admin did not start; see " + path10.join(logsDir, "dynamodb-admin.log"));
26311
- env.summary.push("dynamodb-admin: http://localhost:" + plan.adminPort + " (browse and edit tables in the sandbox's browser)");
26312
27524
  };
26313
27525
 
26314
- // src/guest/toolchains/databases/mongodb.ts
26315
- import path11 from "node:path";
26316
- var setupMongo = async (env, plan) => {
26317
- const find2 = async () => {
26318
- const { versions } = await fetchJson("https://downloads.mongodb.org/full.json");
26319
- const prod = versions.filter((v) => v.production_release);
26320
- const hit = plan.version === "latest" ? prod[0] : prod.find((v) => v.version === plan.version || v.version.startsWith(plan.version + "."));
26321
- const archive = hit?.downloads.find((d) => d.target === "windows" && d.arch === "x86_64" && d.edition === "base")?.archive;
26322
- return hit && archive ? { version: hit.version, archive } : Promise.reject(new Error("No MongoDB " + plan.version + " for Windows"));
26323
- };
26324
- const version2 = await resolveCached("mongodb:" + plan.version, async () => (await find2()).version);
26325
- const home = tool("mongodb", version2);
26326
- if (!exists(path11.join(home, "bin", "mongod.exe"))) {
26327
- const { archive } = await find2();
26328
- log("Downloading MongoDB " + version2 + " (~400 MB once) ...");
26329
- await installArchive(archive.url, home, { sha256: archive.sha256, locate: "mongod.exe", up: 1 });
26330
- }
26331
- const shell = tool("mongosh");
26332
- if (!exists(path11.join(shell, "mongosh.exe"))) {
26333
- await installFromGithub("mongodb-js/mongosh", /^mongosh-[\d.]+-win32-x64\.zip$/, { dest: shell, what: "mongosh, the MongoDB shell (~50 MB once)", locate: "mongosh.exe" });
26334
- }
26335
- const data = mkdirp(dataFor("mongodb"));
26336
- await clearStaleLocks(data, ["mongod.lock"], plan.port);
26337
- await startServer("mongodb", path11.join(home, "bin", "mongod.exe"), ["--dbpath", data, "--bind_ip", "127.0.0.1", "--port", String(plan.port)], plan.port);
26338
- env.prepend.push(path11.join(home, "bin"), shell);
26339
- 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
+ }
26340
27580
  };
26341
27581
 
26342
- // src/guest/toolchains/databases/mysql.ts
26343
- import path12 from "node:path";
27582
+ // src/guest/databases/mysql.ts
27583
+ import path18 from "node:path";
26344
27584
  var MARIA = "https://downloads.mariadb.org/rest-api/mariadb/";
26345
- var setupMysql = async (env, plan) => {
26346
- const series = await resolveCached("mariadb:" + plan.version, async () => {
26347
- if (plan.version !== "lts") return plan.version;
26348
- const { major_releases: all } = await fetchJson(MARIA);
26349
- 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"));
26350
- });
26351
- const latest = async () => {
26352
- const { releases } = await fetchJson(MARIA + series + "/latest/");
26353
- const [version3, release] = Object.entries(releases)[0] ?? [];
26354
- const zip = release?.files.find((f) => /-winx64\.zip$/.test(f.file_name));
26355
- return zip ? { version: version3, zip } : Promise.reject(new Error("No MariaDB " + series + " zip for Windows"));
26356
- };
26357
- const version2 = await resolveCached("mariadb-version:" + series, async () => (await latest()).version);
26358
- const home = tool("mariadb", version2);
26359
- const bin = path12.join(home, "bin");
26360
- if (!exists(path12.join(bin, "mariadbd.exe"))) {
26361
- const { zip } = await latest();
26362
- log("Downloading MariaDB " + version2 + " (~90 MB once) ...");
26363
- await installArchive(zip.file_download_url.replace(/^http:/, "https:"), home, { sha256: zip.checksum?.sha256sum ?? null, locate: "mariadbd.exe", up: 1, fileName: zip.file_name });
26364
- }
26365
- const data = dataFor("mariadb");
26366
- await createOnce(data, "mysql", async () => {
26367
- log("Creating the MariaDB database (first start) ...");
26368
- await execAsync(path12.join(bin, "mariadb-install-db.exe"), ["--datadir=" + data, "--port=" + plan.port], { stdio: "ignore" });
26369
- });
26370
- await startServer("mysql", path12.join(bin, "mariadbd.exe"), ["--datadir=" + data, "--port=" + plan.port, "--bind-address=127.0.0.1", "--console"], plan.port);
26371
- Object.assign(env.vars, { MYSQL_HOST: "127.0.0.1", MYSQL_TCP_PORT: String(plan.port) });
26372
- env.prepend.push(bin);
26373
- 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
+ }
26374
27631
  };
26375
27632
 
26376
- // src/guest/toolchains/databases/postgres.ts
26377
- import path13 from "node:path";
26378
- var postgresData = (version2) => dataFor("postgres-" + version2.split(".")[0]);
26379
- var setupPostgres = async (env, plan) => {
26380
- const exact = await resolveCached("postgres:" + plan.version, async () => {
26381
- const versions = (await fetchJson("https://www.postgresql.org/versions.json")).filter((v) => v.supported);
26382
- const hit = plan.version === "latest" ? versions.find((v) => v.current) ?? versions[versions.length - 1] : versions.find((v) => v.major === plan.version.split(".")[0]);
26383
- return hit ? hit.major + "." + hit.latestMinor : Promise.reject(new Error("No supported PostgreSQL " + plan.version));
26384
- });
26385
- const home = tool("postgres", exact);
26386
- const bin = path13.join(home, "bin");
26387
- if (!exists(path13.join(bin, "pg_ctl.exe"))) {
26388
- log("Downloading PostgreSQL " + exact + " (~330 MB once) ...");
26389
- await installArchive("https://get.enterprisedb.com/postgresql/postgresql-" + exact + "-1-windows-x64-binaries.zip", home, {
26390
- locate: "pg_ctl.exe",
26391
- up: 1,
26392
- fileName: "postgresql-" + exact + ".zip",
26393
- 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
+ );
26394
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);
26395
27709
  }
26396
- const data = postgresData(exact);
26397
- await createOnce(data, "PG_VERSION", async () => {
26398
- log("Creating the PostgreSQL database (first start) ...");
26399
- await execAsync(path13.join(bin, "initdb.exe"), ["-D", data, "-U", "postgres", "-A", "trust", "-E", "UTF8", "--locale=C"], { stdio: "ignore" });
26400
- });
26401
- if (await portOpen(plan.port)) throw new Error("port " + plan.port + " is already in use (change databases.postgres.port)");
26402
- await clearStaleLocks(data, ["postmaster.pid"], plan.port);
26403
- 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" });
26404
- Object.assign(env.vars, { PGHOST: "localhost", PGPORT: String(plan.port), PGUSER: "postgres" });
26405
- env.prepend.push(bin);
26406
- env.summary.push("postgres " + exact + ": localhost:" + plan.port + ", user postgres, no password (postgres://postgres@localhost:" + plan.port + "/postgres)");
26407
27710
  };
26408
27711
 
26409
- // src/guest/toolchains/databases/redis.ts
26410
- import path14 from "node:path";
26411
- var setupRedis = async (env, plan) => {
26412
- const home = tool("redis");
26413
- if (!exists(path14.join(home, "redis-server.exe"))) {
26414
- 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" });
26415
- }
26416
- const data = mkdirp(dataFor("redis"));
26417
- 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);
26418
- env.prepend.push(home);
26419
- 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
+ }
26420
27735
  };
26421
27736
 
26422
- // src/guest/toolchains/databases/index.ts
26423
- var SETUP = { postgres: setupPostgres, mysql: setupMysql, mongodb: setupMongo, redis: setupRedis, dynamodb: setupDynamo };
26424
- var DATABASE_NAMES = { postgres: "PostgreSQL", mysql: "MySQL (MariaDB)", mongodb: "MongoDB", redis: "Redis", dynamodb: "DynamoDB Local", sqlserver: "SQL Server" };
26425
- var listenerPid = (port) => {
26426
- const out = spawnSync2(SYSTEM.netstat(), ["-ano", "-p", "TCP"], { encoding: "utf8", windowsHide: true }).stdout ?? "";
26427
- 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);
26428
- 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()
26429
27744
  };
26430
- var stopDatabase = async (plan) => {
27745
+ async function stopDatabase(plan) {
26431
27746
  if (!await portOpen(plan.port)) return false;
26432
- if (plan.database === "postgres" && exists(tool("postgres"))) {
26433
- for (const version2 of fs10.readdirSync(tool("postgres"))) {
26434
- const data = postgresData(version2);
26435
- const pgCtl = path15.join(tool("postgres", version2), "bin", "pg_ctl.exe");
26436
- if (exists(path15.join(data, "postmaster.pid")) && exists(pgCtl)) await execAsync(pgCtl, ["stop", "-D", data, "-m", "fast", "-w"], { stdio: "ignore" });
26437
- }
26438
- }
26439
- for (const port of [plan.port, plan.adminPort ?? 0]) {
26440
- const pid = port && listenerPid(port);
26441
- if (pid) try {
26442
- process.kill(pid);
26443
- } catch {
26444
- }
26445
- }
27747
+ if (plan.database === "sqlserver") killListeners(plan);
27748
+ else await SERVERS[plan.database].stop(plan);
26446
27749
  return true;
26447
- };
26448
- var setupDatabase = async (env, plan) => {
27750
+ }
27751
+ async function setupDatabase(env, plan) {
26449
27752
  if (plan.database === "sqlserver") {
26450
- 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
+ );
26451
27756
  return;
26452
27757
  }
26453
27758
  if (dryRun) {
26454
- 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
+ );
26455
27762
  return;
26456
27763
  }
26457
27764
  if (duringSession() && await portOpen(plan.port)) {
26458
27765
  env.summary.push(plan.database + ": shared, already running on port " + plan.port);
26459
27766
  return;
26460
27767
  }
26461
- await SETUP[plan.database](env, plan);
26462
- };
27768
+ await SERVERS[plan.database].start(env, plan);
27769
+ }
26463
27770
 
26464
27771
  // src/guest/setup/environment.ts
26465
27772
  var addMachineEnvironment = (vars, dirs, additive = false) => {
@@ -26478,13 +27785,13 @@ var addMachineEnvironment = (vars, dirs, additive = false) => {
26478
27785
  }
26479
27786
  };
26480
27787
 
26481
- // src/guest/db.ts
27788
+ // src/guest/databases/sbx-db.ts
26482
27789
  var USAGE = "Usage: sbx-db [list] | sbx-db start <name> | sbx-db stop <name>";
26483
27790
  var projectPlans = () => {
26484
27791
  const file2 = process.env.AGENT_PROJECT_FILE;
26485
27792
  if (!file2) return null;
26486
27793
  try {
26487
- 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;
26488
27795
  } catch {
26489
27796
  return null;
26490
27797
  }
@@ -26496,7 +27803,10 @@ var plans = () => {
26496
27803
  var find = (name) => {
26497
27804
  const all = plans();
26498
27805
  const plan = all.find((p) => p.database === name?.toLowerCase());
26499
- 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
+ );
26500
27810
  if (plan.database === "sqlserver") throw new Error("SQL Server cannot run inside Windows Sandbox.");
26501
27811
  return plan;
26502
27812
  };
@@ -26526,17 +27836,22 @@ var stop = async (name) => {
26526
27836
  console.log(await stopDatabase(plan) ? "Stopped " + plan.database + "." : plan.database + " was not running.");
26527
27837
  return 0;
26528
27838
  };
26529
- var main = (args) => {
27839
+ function runSbxDb(args) {
26530
27840
  const [action = "list", name] = args;
26531
27841
  if (action === "list") return list();
26532
27842
  if (action === "start") return start(name);
26533
27843
  if (action === "stop") return stop(name);
26534
27844
  console.error(USAGE);
26535
27845
  return Promise.resolve(2);
26536
- };
26537
- main(process.argv.slice(2)).then((code) => {
26538
- process.exitCode = code;
26539
- }, (e) => {
26540
- console.error(errMsg(e));
26541
- process.exitCode = 1;
26542
- });
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
+ );