windows-development-sandbox 1.9.0 → 1.11.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 (398) hide show
  1. package/README.md +64 -17
  2. package/config.example.json +7 -2
  3. package/dist/app/features/accounts/accounts.def.d.ts +122 -0
  4. package/dist/app/features/accounts/accounts.def.js +243 -0
  5. package/dist/app/features/accounts/accounts.run.d.ts +51 -0
  6. package/dist/app/features/accounts/accounts.run.js +125 -0
  7. package/dist/app/features/accounts/index.d.ts +2 -0
  8. package/dist/app/features/accounts/index.js +3 -0
  9. package/dist/app/features/agents/agent-entry.d.ts +17 -0
  10. package/dist/app/features/agents/agent-entry.js +50 -0
  11. package/dist/app/features/agents/agents.def.d.ts +65 -0
  12. package/dist/app/features/agents/agents.def.js +142 -0
  13. package/dist/app/features/agents/agents.run.d.ts +31 -0
  14. package/dist/app/features/agents/agents.run.js +189 -0
  15. package/dist/app/features/agents/index.d.ts +3 -0
  16. package/dist/app/features/agents/index.js +4 -0
  17. package/dist/app/features/apps/apps-rows.d.ts +31 -0
  18. package/dist/app/features/apps/apps-rows.js +73 -0
  19. package/dist/app/features/apps/apps.def.d.ts +181 -0
  20. package/dist/app/features/apps/apps.def.js +264 -0
  21. package/dist/app/features/apps/apps.run.d.ts +58 -0
  22. package/dist/app/features/apps/apps.run.js +76 -0
  23. package/dist/app/features/apps/index.d.ts +3 -0
  24. package/dist/app/features/apps/index.js +4 -0
  25. package/dist/app/features/data/data.def.d.ts +154 -0
  26. package/dist/app/features/data/data.def.js +201 -0
  27. package/dist/app/features/data/data.run.d.ts +46 -0
  28. package/dist/app/features/data/data.run.js +141 -0
  29. package/dist/app/features/data/index.d.ts +2 -0
  30. package/dist/app/features/data/index.js +3 -0
  31. package/dist/app/features/defs.d.ts +952 -4
  32. package/dist/app/features/defs.js +147 -10
  33. package/dist/app/features/engine/engine.def.d.ts +228 -0
  34. package/dist/app/features/engine/engine.def.js +194 -0
  35. package/dist/app/features/engine/engine.run.d.ts +72 -0
  36. package/dist/app/features/engine/engine.run.js +77 -0
  37. package/dist/app/features/engine/index.d.ts +2 -0
  38. package/dist/app/features/engine/index.js +4 -0
  39. package/dist/app/features/files/files.def.d.ts +51 -0
  40. package/dist/app/features/files/files.def.js +38 -0
  41. package/dist/app/features/files/files.run.d.ts +20 -0
  42. package/dist/app/features/files/files.run.js +59 -0
  43. package/dist/app/features/files/index.d.ts +2 -0
  44. package/dist/app/features/files/index.js +3 -0
  45. package/dist/app/features/github/github.def.d.ts +80 -0
  46. package/dist/app/features/github/github.def.js +142 -0
  47. package/dist/app/features/github/github.run.d.ts +36 -0
  48. package/dist/app/features/github/github.run.js +59 -0
  49. package/dist/app/features/github/index.d.ts +2 -0
  50. package/dist/app/features/github/index.js +3 -0
  51. package/dist/app/features/health/health.def.d.ts +275 -0
  52. package/dist/app/features/health/health.def.js +281 -0
  53. package/dist/app/features/health/health.run.d.ts +125 -0
  54. package/dist/app/features/health/health.run.js +204 -0
  55. package/dist/app/features/health/index.d.ts +2 -0
  56. package/dist/app/features/health/index.js +3 -0
  57. package/dist/app/features/logs/index.d.ts +2 -0
  58. package/dist/app/features/logs/index.js +3 -0
  59. package/dist/app/features/logs/logs.def.d.ts +78 -0
  60. package/dist/app/features/logs/logs.def.js +115 -0
  61. package/dist/app/features/logs/logs.run.d.ts +20 -0
  62. package/dist/app/features/logs/logs.run.js +42 -0
  63. package/dist/app/features/projects/index.d.ts +2 -0
  64. package/dist/app/features/projects/index.js +3 -0
  65. package/dist/app/features/projects/projects.def.d.ts +101 -0
  66. package/dist/app/features/projects/projects.def.js +208 -0
  67. package/dist/app/features/projects/projects.run.d.ts +56 -0
  68. package/dist/app/features/projects/projects.run.js +155 -0
  69. package/dist/app/features/sandbox/sandbox.def.js +11 -5
  70. package/dist/app/features/sessions/sessions.def.js +3 -0
  71. package/dist/app/features/settings/categories.def.js +3 -2
  72. package/dist/{cli/menu/settings/share.d.ts → app/features/settings/settings-share.d.ts} +1 -1
  73. package/dist/{cli/menu/settings/share.js → app/features/settings/settings-share.js} +3 -2
  74. package/dist/app/features/settings/settings.def.d.ts +22 -5
  75. package/dist/app/features/settings/settings.def.js +81 -6
  76. package/dist/app/features/settings/settings.run.d.ts +17 -0
  77. package/dist/app/features/settings/settings.run.js +89 -4
  78. package/dist/app/features/storage/index.d.ts +2 -0
  79. package/dist/app/features/storage/index.js +3 -0
  80. package/dist/app/features/storage/storage.def.d.ts +133 -0
  81. package/dist/app/features/storage/storage.def.js +225 -0
  82. package/dist/app/features/storage/storage.run.d.ts +62 -0
  83. package/dist/app/features/storage/storage.run.js +370 -0
  84. package/dist/app/features/updates/index.d.ts +3 -0
  85. package/dist/app/features/updates/index.js +4 -0
  86. package/dist/app/features/updates/update-lines.d.ts +13 -0
  87. package/dist/app/features/updates/update-lines.js +61 -0
  88. package/dist/app/features/updates/updates.def.d.ts +89 -0
  89. package/dist/app/features/updates/updates.def.js +225 -0
  90. package/dist/app/features/updates/updates.run.d.ts +48 -0
  91. package/dist/app/features/updates/updates.run.js +154 -0
  92. package/dist/app/features/vpn/index.d.ts +2 -0
  93. package/dist/app/features/vpn/index.js +3 -0
  94. package/dist/app/features/vpn/vpn.def.d.ts +112 -0
  95. package/dist/app/features/vpn/vpn.def.js +174 -0
  96. package/dist/app/features/vpn/vpn.run.d.ts +37 -0
  97. package/dist/app/features/vpn/vpn.run.js +54 -0
  98. package/dist/app/features/web/index.d.ts +2 -0
  99. package/dist/app/features/web/index.js +3 -0
  100. package/dist/app/features/web/web.def.d.ts +33 -0
  101. package/dist/app/features/web/web.def.js +90 -0
  102. package/dist/app/features/web/web.run.d.ts +24 -0
  103. package/dist/app/features/web/web.run.js +93 -0
  104. package/dist/app/kernel/define.d.ts +10 -1
  105. package/dist/app/kernel/io.d.ts +34 -0
  106. package/dist/app/kernel/io.js +9 -0
  107. package/dist/app/kernel/rpc.d.ts +17 -0
  108. package/dist/app/kernel/text.d.ts +2 -0
  109. package/dist/app/kernel/text.js +7 -0
  110. package/dist/app/kernel/view.d.ts +24 -1
  111. package/dist/app/kernel/view.js +1 -1
  112. package/dist/app/registry.js +74 -1
  113. package/dist/cli/args.js +1 -1
  114. package/dist/cli/commands/context.d.ts +7 -0
  115. package/dist/cli/commands/context.js +29 -2
  116. package/dist/cli/commands/engine.js +5 -58
  117. package/dist/cli/commands/github.d.ts +2 -0
  118. package/dist/cli/commands/github.js +11 -0
  119. package/dist/cli/commands/index.d.ts +3 -5
  120. package/dist/cli/commands/index.js +3 -5
  121. package/dist/cli/commands/launch/launch.js +23 -4
  122. package/dist/cli/commands/launch/running.js +4 -1
  123. package/dist/cli/commands/maintenance/config.js +1 -6
  124. package/dist/cli/commands/maintenance/index.d.ts +0 -1
  125. package/dist/cli/commands/maintenance/index.js +1 -2
  126. package/dist/cli/commands/maintenance/logs.js +27 -32
  127. package/dist/cli/commands/maintenance/migrate.d.ts +0 -8
  128. package/dist/cli/commands/maintenance/migrate.js +2 -44
  129. package/dist/cli/commands/maintenance/update.d.ts +0 -19
  130. package/dist/cli/commands/maintenance/update.js +1 -99
  131. package/dist/cli/commands/projects/index.d.ts +0 -1
  132. package/dist/cli/commands/projects/index.js +0 -1
  133. package/dist/cli/commands/registry.d.ts +1 -1
  134. package/dist/cli/commands/registry.js +29 -11
  135. package/dist/cli/commands/repair/checks/data.js +1 -1
  136. package/dist/cli/commands/repair/checks/hcs.js +28 -1
  137. package/dist/cli/commands/repair/checks/sandbox.js +1 -1
  138. package/dist/cli/commands/repair/health-run.d.ts +30 -0
  139. package/dist/cli/commands/repair/health-run.js +32 -0
  140. package/dist/cli/commands/repair/printer.d.ts +2 -2
  141. package/dist/cli/commands/repair/printer.js +2 -11
  142. package/dist/cli/commands/repair/run.d.ts +1 -21
  143. package/dist/cli/commands/repair/run.js +13 -70
  144. package/dist/cli/commands/storage/index.d.ts +0 -1
  145. package/dist/cli/commands/storage/index.js +0 -1
  146. package/dist/cli/commands/storage/offer.js +6 -2
  147. package/dist/cli/commands/vpn.d.ts +1 -3
  148. package/dist/cli/commands/vpn.js +8 -88
  149. package/dist/cli/commands/web.d.ts +7 -1
  150. package/dist/cli/commands/web.js +45 -71
  151. package/dist/cli/index.js +3 -2
  152. package/dist/cli/manifest.d.ts +16 -153
  153. package/dist/cli/manifest.js +20 -50
  154. package/dist/cli/menu/command-form.js +1 -2
  155. package/dist/cli/menu/io-menu.d.ts +2 -2
  156. package/dist/cli/menu/io-menu.js +6 -4
  157. package/dist/cli/menu/menu.js +1 -1
  158. package/dist/cli/menu/pages/accounts-page.d.ts +5 -17
  159. package/dist/cli/menu/pages/accounts-page.js +28 -170
  160. package/dist/cli/menu/pages/agents-page.d.ts +17 -18
  161. package/dist/cli/menu/pages/agents-page.js +67 -124
  162. package/dist/cli/menu/pages/apps-page.d.ts +15 -8
  163. package/dist/cli/menu/pages/apps-page.js +121 -29
  164. package/dist/cli/menu/pages/list-page.js +10 -1
  165. package/dist/cli/menu/pages/maintenance-page.d.ts +51 -52
  166. package/dist/cli/menu/pages/maintenance-page.js +246 -427
  167. package/dist/cli/menu/pages/sandbox-page.d.ts +3 -5
  168. package/dist/cli/menu/pages/sandbox-page.js +34 -112
  169. package/dist/cli/menu/pages/settings-page.d.ts +21 -3
  170. package/dist/cli/menu/pages/settings-page.js +89 -17
  171. package/dist/cli/menu/render-view.js +2 -1
  172. package/dist/cli/menu/settings/index.d.ts +0 -1
  173. package/dist/cli/menu/settings/index.js +3 -3
  174. package/dist/cli/menu/views.js +28 -0
  175. package/dist/cli/operations/handler.js +7 -3
  176. package/dist/cli/operations/input.d.ts +1 -1
  177. package/dist/cli/operations/input.js +29 -5
  178. package/dist/cli/operations/io-cli.js +9 -1
  179. package/dist/cli/operations/spec.js +8 -2
  180. package/dist/cli/output/render-view.js +2 -0
  181. package/dist/cli/{commands/data/collect.js → services/data-collect.js} +2 -2
  182. package/dist/cli/{commands/data/remove.js → services/data-remove.js} +2 -2
  183. package/dist/cli/services/data-service.d.ts +1 -1
  184. package/dist/cli/services/data-service.js +2 -2
  185. package/dist/cli/services/databases-service.d.ts +5 -0
  186. package/dist/cli/services/databases-service.js +15 -0
  187. package/dist/cli/services/health-service.d.ts +8 -4
  188. package/dist/cli/services/health-service.js +10 -8
  189. package/dist/cli/services/index.d.ts +4 -1
  190. package/dist/cli/services/index.js +4 -1
  191. package/dist/cli/services/logs-service.d.ts +7 -0
  192. package/dist/cli/services/logs-service.js +13 -0
  193. package/dist/cli/services/storage-service.d.ts +19 -0
  194. package/dist/cli/services/storage-service.js +71 -0
  195. package/dist/cli/services/vpn-service.d.ts +6 -4
  196. package/dist/cli/services/vpn-service.js +5 -11
  197. package/dist/cli/services/web-service.d.ts +4 -3
  198. package/dist/cli/services/web-service.js +12 -32
  199. package/dist/core/config/defaults.js +3 -2
  200. package/dist/core/schema/config.d.ts +6 -0
  201. package/dist/core/schema/config.js +2 -0
  202. package/dist/core/schema/github.d.ts +4 -0
  203. package/dist/core/schema/github.js +7 -0
  204. package/dist/core/schema/index.d.ts +1 -0
  205. package/dist/core/schema/index.js +1 -0
  206. package/dist/core/schema/profile.d.ts +1 -0
  207. package/dist/core/schema/profile.js +3 -0
  208. package/dist/core/schema/sandbox.js +3 -3
  209. package/dist/core/schema/toolchains.js +2 -2
  210. package/dist/core/schema/vpn.js +1 -1
  211. package/dist/core/schema/web.d.ts +1 -0
  212. package/dist/core/schema/web.js +4 -1
  213. package/dist/core/types.d.ts +6 -3
  214. package/dist/guest/boot/boot.js +11 -1
  215. package/dist/guest/daemon/daemon.js +1 -1
  216. package/dist/guest/daemon/sessions.d.ts +3 -2
  217. package/dist/guest/daemon/sessions.js +38 -7
  218. package/dist/guest/governor/core.d.ts +44 -0
  219. package/dist/guest/governor/core.js +124 -0
  220. package/dist/guest/governor/decide.d.ts +53 -15
  221. package/dist/guest/governor/decide.js +155 -72
  222. package/dist/guest/governor/governor.d.ts +2 -35
  223. package/dist/guest/governor/governor.js +35 -99
  224. package/dist/guest/governor/index.d.ts +1 -0
  225. package/dist/guest/governor/index.js +1 -0
  226. package/dist/guest/network/firewall.d.ts +3 -0
  227. package/dist/guest/network/firewall.js +65 -23
  228. package/dist/guest/runtime/process.js +53 -5
  229. package/dist/guest/sessions/viewer.js +5 -1
  230. package/dist/guest/setup/claude-mem.js +12 -4
  231. package/dist/guest/setup/github-token.d.ts +7 -0
  232. package/dist/guest/setup/github-token.js +65 -0
  233. package/dist/guest/toolchains/languages/node.js +40 -4
  234. package/dist/guest/toolchains/native/rust-extras.js +2 -2
  235. package/dist/guest/toolchains/tools/cli.d.ts +8 -0
  236. package/dist/guest/toolchains/tools/cli.js +16 -2
  237. package/dist/guest/vpn/openvpn.d.ts +5 -0
  238. package/dist/guest/vpn/openvpn.js +14 -1
  239. package/dist/guest/vpn/vpn.js +55 -16
  240. package/dist/guest/vpn/wireguard.js +2 -0
  241. package/dist/host/channel/attach.d.ts +1 -0
  242. package/dist/host/channel/attach.js +1 -0
  243. package/dist/host/channel/channel.d.ts +1 -1
  244. package/dist/host/channel/channel.js +2 -2
  245. package/dist/host/engines/hcs/check.d.ts +1 -0
  246. package/dist/host/engines/hcs/check.js +1 -1
  247. package/dist/host/engines/hcs/engine.d.ts +1 -1
  248. package/dist/host/engines/hcs/engine.js +6 -4
  249. package/dist/host/engines/hcs/helper.d.ts +11 -0
  250. package/dist/host/engines/hcs/helper.js +31 -2
  251. package/dist/host/engines/hcs/leftovers.d.ts +42 -0
  252. package/dist/host/engines/hcs/leftovers.js +101 -0
  253. package/dist/host/engines/index.d.ts +1 -0
  254. package/dist/host/engines/index.js +1 -0
  255. package/dist/host/github/deliver.d.ts +13 -0
  256. package/dist/host/github/deliver.js +51 -0
  257. package/dist/host/github/index.d.ts +2 -0
  258. package/dist/host/github/index.js +3 -0
  259. package/dist/host/github/token.d.ts +21 -0
  260. package/dist/host/github/token.js +74 -0
  261. package/dist/host/launch/generate.js +11 -5
  262. package/dist/host/launch/index.d.ts +1 -1
  263. package/dist/host/launch/index.js +1 -1
  264. package/dist/host/launch/session-file.js +1 -2
  265. package/dist/host/launch/wsb-file.d.ts +11 -7
  266. package/dist/host/launch/wsb-file.js +30 -12
  267. package/dist/host/life/host-memory.d.ts +1 -0
  268. package/dist/host/life/host-memory.js +4 -1
  269. package/dist/host/life/watchdog.d.ts +11 -0
  270. package/dist/host/life/watchdog.js +36 -4
  271. package/dist/host/sandbox/tasklist.d.ts +6 -0
  272. package/dist/host/sandbox/tasklist.js +37 -0
  273. package/dist/host/secrets/launch-secrets.d.ts +2 -1
  274. package/dist/host/secrets/launch-secrets.js +4 -2
  275. package/dist/host/vpn/status.js +13 -3
  276. package/dist/host/web/backend.d.ts +1 -3
  277. package/dist/host/web/index.d.ts +2 -1
  278. package/dist/host/web/index.js +2 -1
  279. package/dist/host/web/live.d.ts +23 -0
  280. package/dist/host/web/live.js +107 -0
  281. package/dist/host/web/rpc.d.ts +6 -1
  282. package/dist/host/web/rpc.js +23 -31
  283. package/dist/host/web/runner.d.ts +4 -0
  284. package/dist/host/web/runner.js +12 -1
  285. package/dist/host/web/server.d.ts +30 -2
  286. package/dist/host/web/server.js +87 -29
  287. package/dist/host/web/state.d.ts +1 -0
  288. package/dist/host/web/state.js +2 -0
  289. package/dist/runtime/agent.js +44 -16
  290. package/dist/runtime/daemon.js +1154 -857
  291. package/dist/runtime/db.js +44 -16
  292. package/dist/runtime/main.js +532 -115
  293. package/dist/runtime/netproxy.js +34 -9
  294. package/dist/runtime/view.js +499 -149
  295. package/dist/selftest/app.test.js +620 -12
  296. package/dist/selftest/channel.test.js +18 -1
  297. package/dist/selftest/cli.test.js +1 -1
  298. package/dist/selftest/config.test.js +1 -1
  299. package/dist/selftest/contained.test.js +1 -1
  300. package/dist/selftest/data.test.js +1 -2
  301. package/dist/selftest/engine.test.js +3 -1
  302. package/dist/selftest/github.test.d.ts +2 -0
  303. package/dist/selftest/github.test.js +243 -0
  304. package/dist/selftest/guest-boot.test.js +47 -1
  305. package/dist/selftest/hcs.test.js +105 -8
  306. package/dist/selftest/health.test.js +71 -0
  307. package/dist/selftest/heavy-load.test.js +152 -66
  308. package/dist/selftest/index.js +4 -0
  309. package/dist/selftest/layout.test.js +8 -0
  310. package/dist/selftest/live-terminal.test.js +74 -0
  311. package/dist/selftest/menu-screens.js +171 -56
  312. package/dist/selftest/menu.test.js +54 -37
  313. package/dist/selftest/migrate.test.js +14 -12
  314. package/dist/selftest/network.test.js +20 -1
  315. package/dist/selftest/powershell-variables.test.d.ts +2 -0
  316. package/dist/selftest/powershell-variables.test.js +61 -0
  317. package/dist/selftest/support/engine-golden.js +1 -0
  318. package/dist/selftest/support/fixtures.d.ts +5 -0
  319. package/dist/selftest/support/web-preview.d.ts +1 -0
  320. package/dist/selftest/support/web-preview.js +856 -0
  321. package/dist/selftest/update-service.test.js +15 -8
  322. package/dist/selftest/vpn.test.js +86 -2
  323. package/dist/selftest/web.test.js +58 -11
  324. package/dist/shared/channel/run-dir.d.ts +2 -0
  325. package/dist/shared/channel/run-dir.js +3 -0
  326. package/dist/shared/channel/schema.d.ts +7 -0
  327. package/dist/shared/channel/schema.js +9 -1
  328. package/dist/shared/channel/secrets.d.ts +1 -0
  329. package/dist/shared/channel/secrets.js +3 -0
  330. package/dist/shared/github/index.d.ts +1 -0
  331. package/dist/shared/github/index.js +2 -0
  332. package/dist/shared/github/token.d.ts +29 -0
  333. package/dist/shared/github/token.js +89 -0
  334. package/dist/shared/io/copy-tree.d.ts +7 -0
  335. package/dist/shared/io/copy-tree.js +45 -0
  336. package/dist/shared/io/index.d.ts +2 -0
  337. package/dist/shared/io/index.js +2 -0
  338. package/dist/shared/io/robocopy-result.d.ts +6 -0
  339. package/dist/shared/io/robocopy-result.js +23 -0
  340. package/dist/shared/memory/policy.d.ts +38 -12
  341. package/dist/shared/memory/policy.js +58 -19
  342. package/dist/shared/network/firewall-rules.d.ts +8 -0
  343. package/dist/shared/network/firewall-rules.js +28 -0
  344. package/dist/shared/pty/ctrl-c.d.ts +18 -0
  345. package/dist/shared/pty/ctrl-c.js +36 -0
  346. package/dist/shared/pty/index.d.ts +1 -0
  347. package/dist/shared/pty/index.js +1 -0
  348. package/dist/shared/pty/terminal.d.ts +2 -0
  349. package/dist/shared/pty/terminal.js +21 -2
  350. package/dist/shared/vpn/kill-switch.d.ts +13 -2
  351. package/dist/shared/vpn/kill-switch.js +88 -8
  352. package/dist/shared/web/protocol.d.ts +0 -4
  353. package/dist/sync/watcher.js +1 -1
  354. package/dist/web/index.html +2 -2
  355. package/dist/web/{main-T5DMCHYV.css → main-6JF3ASB5.css} +1 -1
  356. package/dist/web/main-Z645W45E.js +219 -0
  357. package/native/csharp/HcsHost/AssemblyInfo.cs +3 -3
  358. package/native/csharp/HostTools/AssemblyInfo.cs +3 -3
  359. package/native/csharp/HostTools/MemoryStatus.cs +128 -107
  360. package/native/scripts/memory-status.ps1 +10 -2
  361. package/package.json +10 -3
  362. package/sandbox/csharp/MemGov.cs +668 -398
  363. package/sandbox/csharp/PtyHost.cs +104 -15
  364. package/sandbox/csharp/SandboxTools/CpuCap.cs +50 -1
  365. package/sandbox/csharp/SandboxTools/Program.cs +1 -1
  366. package/sandbox/scripts/new-shortcuts.ps1 +3 -1
  367. package/sandbox/scripts/repair-wmi-services.ps1 +26 -0
  368. package/schemas/config.schema.json +25 -7
  369. package/schemas/sandbox-config.schema.json +7 -3
  370. package/dist/cli/commands/accounts.d.ts +0 -2
  371. package/dist/cli/commands/accounts.js +0 -96
  372. package/dist/cli/commands/data/clean.d.ts +0 -3
  373. package/dist/cli/commands/data/clean.js +0 -60
  374. package/dist/cli/commands/data/index.d.ts +0 -4
  375. package/dist/cli/commands/data/index.js +0 -62
  376. package/dist/cli/commands/maintenance/clean.d.ts +0 -2
  377. package/dist/cli/commands/maintenance/clean.js +0 -24
  378. package/dist/cli/commands/maintenance/config-share.d.ts +0 -12
  379. package/dist/cli/commands/maintenance/config-share.js +0 -80
  380. package/dist/cli/commands/projects/projects.d.ts +0 -2
  381. package/dist/cli/commands/projects/projects.js +0 -162
  382. package/dist/cli/commands/storage/contained.d.ts +0 -3
  383. package/dist/cli/commands/storage/contained.js +0 -179
  384. package/dist/cli/commands/storage/storage.d.ts +0 -8
  385. package/dist/cli/commands/storage/storage.js +0 -179
  386. package/dist/cli/menu/add-agent.d.ts +0 -47
  387. package/dist/cli/menu/add-agent.js +0 -168
  388. package/dist/cli/menu/apps.d.ts +0 -69
  389. package/dist/cli/menu/apps.js +0 -214
  390. package/dist/cli/menu/data-folder.d.ts +0 -18
  391. package/dist/cli/menu/data-folder.js +0 -99
  392. package/dist/cli/menu/share-settings.d.ts +0 -21
  393. package/dist/cli/menu/share-settings.js +0 -112
  394. package/dist/cli/menu/vpn-login.d.ts +0 -16
  395. package/dist/cli/menu/vpn-login.js +0 -74
  396. package/dist/web/main-NRRS5O6Z.js +0 -157
  397. /package/dist/cli/{commands/data/collect.d.ts → services/data-collect.d.ts} +0 -0
  398. /package/dist/cli/{commands/data/remove.d.ts → services/data-remove.d.ts} +0 -0
@@ -0,0 +1,13 @@
1
+ import type { Context } from '../../../cli/commands/context.js';
2
+ import type { MigrateContext } from '../../../cli/services/index.js';
3
+ import type { UpdateResult } from '../../../host/update/index.js';
4
+ /** One sentence for what an update run did, and whether it counts as done (1: it failed, or is waiting by hand). */
5
+ export declare function describeResult(result: UpdateResult | null, unattended: boolean): {
6
+ line: string;
7
+ code: number;
8
+ };
9
+ /**
10
+ * Where this context keeps the saved settings. Backups go where the data is: an upgrade that has not pinned the old
11
+ * folder yet would otherwise fill the new, empty default folder with them.
12
+ */
13
+ export declare function whereOf(ctx: Context): MigrateContext;
@@ -0,0 +1,61 @@
1
+ // The sentences an update run can end with, and where a settings backup goes. Node-side (UpdateResult comes from
2
+ // host/update), used by updates.run.ts and by the startup migration of the command line (cli/commands/maintenance).
3
+ import { userDir } from '../../../core/config/index.js';
4
+ import { holdsData, oldDefaultRoot } from '../../../host/storage/index.js';
5
+ /** One sentence for what an update run did, and whether it counts as done (1: it failed, or is waiting by hand). */
6
+ export function describeResult(result, unattended) {
7
+ if (!result)
8
+ return { line: 'Another update is running right now.', code: 0 };
9
+ if (result.kind === 'installed')
10
+ return {
11
+ line: 'Updated ' +
12
+ (result.previous ? 'from ' + result.previous + ' ' : '') +
13
+ 'to ' +
14
+ result.version +
15
+ '. Open a new terminal to use it.',
16
+ code: 0,
17
+ };
18
+ if (result.kind === 'failed')
19
+ return {
20
+ line: 'Update to ' +
21
+ result.version +
22
+ ' failed: ' +
23
+ result.reason.replace(/\.?\s*$/, '.') +
24
+ (result.rolledBack
25
+ ? ' The change was undone: you are on the version you had.'
26
+ : ' Going back to your previous version did not fully work: run sandbox update --rollback or the installer.') +
27
+ (result.autoUpdateOff
28
+ ? ' Automatic updates are off; turn them back on in Maintenance > Updates or with sandbox update --auto on.'
29
+ : result.blocked
30
+ ? ' It is not tried again; the next release is.'
31
+ : ' It is tried again later.'),
32
+ code: 1,
33
+ };
34
+ switch (result.reason) {
35
+ case 'up-to-date':
36
+ return { line: 'You have the newest version (' + result.current + ').', code: 0 };
37
+ case 'sandbox-running':
38
+ return {
39
+ line: 'A Windows Sandbox is running, so nothing was installed. Close it (sandbox stop), then update again.',
40
+ code: unattended ? 0 : 1,
41
+ };
42
+ case 'failed-before':
43
+ return {
44
+ line: 'The newest version failed to install before. It is not tried again until a newer one is released.',
45
+ code: 0,
46
+ };
47
+ case 'no-release':
48
+ return { line: 'No release was found.', code: 0 };
49
+ case 'too-soon':
50
+ return { line: 'Looked a short while ago; nothing to do yet.', code: 0 };
51
+ }
52
+ }
53
+ /**
54
+ * Where this context keeps the saved settings. Backups go where the data is: an upgrade that has not pinned the old
55
+ * folder yet would otherwise fill the new, empty default folder with them.
56
+ */
57
+ export function whereOf(ctx) {
58
+ const old = oldDefaultRoot();
59
+ const unpinned = old !== null && !holdsData(ctx.storageRoot) && holdsData(old) && !ctx.loaded.layers?.machine;
60
+ return { storageRoot: unpinned ? old : ctx.storageRoot, userDir: userDir(), configPath: ctx.loaded.configPath };
61
+ }
@@ -0,0 +1,89 @@
1
+ import { z } from 'zod';
2
+ import { type Page } from '../../kernel/index.js';
3
+ export declare const UpdatesStatusSchema: z.ZodObject<{
4
+ managed: z.ZodBoolean;
5
+ version: z.ZodString;
6
+ scope: z.ZodNullable<z.ZodEnum<{
7
+ user: "user";
8
+ machine: "machine";
9
+ }>>;
10
+ autoUpdate: z.ZodBoolean;
11
+ autoOffText: z.ZodNullable<z.ZodString>;
12
+ previous: z.ZodNullable<z.ZodString>;
13
+ failed: z.ZodNullable<z.ZodObject<{
14
+ version: z.ZodString;
15
+ reason: z.ZodString;
16
+ }, z.core.$strip>>;
17
+ npmCommand: z.ZodString;
18
+ error: z.ZodNullable<z.ZodString>;
19
+ settings: z.ZodObject<{
20
+ pending: z.ZodArray<z.ZodString>;
21
+ error: z.ZodNullable<z.ZodString>;
22
+ }, z.core.$strip>;
23
+ }, z.core.$strip>;
24
+ export type UpdatesStatus = z.output<typeof UpdatesStatusSchema>;
25
+ export declare const updatesStatus: import("../../kernel/define.js").QueryDef<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
26
+ managed: z.ZodBoolean;
27
+ version: z.ZodString;
28
+ scope: z.ZodNullable<z.ZodEnum<{
29
+ user: "user";
30
+ machine: "machine";
31
+ }>>;
32
+ autoUpdate: z.ZodBoolean;
33
+ autoOffText: z.ZodNullable<z.ZodString>;
34
+ previous: z.ZodNullable<z.ZodString>;
35
+ failed: z.ZodNullable<z.ZodObject<{
36
+ version: z.ZodString;
37
+ reason: z.ZodString;
38
+ }, z.core.$strip>>;
39
+ npmCommand: z.ZodString;
40
+ error: z.ZodNullable<z.ZodString>;
41
+ settings: z.ZodObject<{
42
+ pending: z.ZodArray<z.ZodString>;
43
+ error: z.ZodNullable<z.ZodString>;
44
+ }, z.core.$strip>;
45
+ }, z.core.$strip>, "updates.status">;
46
+ export declare const runUpdate: import("../../kernel/define.js").OperationDef<z.ZodObject<{
47
+ check: z.ZodDefault<z.ZodBoolean>;
48
+ rollback: z.ZodDefault<z.ZodBoolean>;
49
+ auto: z.ZodOptional<z.ZodEnum<{
50
+ off: "off";
51
+ on: "on";
52
+ }>>;
53
+ unattended: z.ZodDefault<z.ZodBoolean>;
54
+ feed: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strip>, z.ZodObject<{
56
+ line: z.ZodString;
57
+ latest: z.ZodNullable<z.ZodString>;
58
+ }, z.core.$strip>, "updates.update">;
59
+ export declare const migrateSettings: import("../../kernel/define.js").OperationDef<z.ZodObject<{
60
+ dryRun: z.ZodDefault<z.ZodBoolean>;
61
+ restore: z.ZodOptional<z.ZodString>;
62
+ }, z.core.$strip>, z.ZodObject<{
63
+ line: z.ZodString;
64
+ }, z.core.$strip>, "updates.migrate">;
65
+ /** The Updates page: "This program" (version, newest, automatic updates, previous, last failure) and saved settings. */
66
+ export declare function updatesPage(s: UpdatesStatus, latest: string | null): Page;
67
+ export declare const updatesView: import("../../kernel/define.js").ViewDef<{
68
+ status: import("../../kernel/define.js").QueryDef<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
69
+ managed: z.ZodBoolean;
70
+ version: z.ZodString;
71
+ scope: z.ZodNullable<z.ZodEnum<{
72
+ user: "user";
73
+ machine: "machine";
74
+ }>>;
75
+ autoUpdate: z.ZodBoolean;
76
+ autoOffText: z.ZodNullable<z.ZodString>;
77
+ previous: z.ZodNullable<z.ZodString>;
78
+ failed: z.ZodNullable<z.ZodObject<{
79
+ version: z.ZodString;
80
+ reason: z.ZodString;
81
+ }, z.core.$strip>>;
82
+ npmCommand: z.ZodString;
83
+ error: z.ZodNullable<z.ZodString>;
84
+ settings: z.ZodObject<{
85
+ pending: z.ZodArray<z.ZodString>;
86
+ error: z.ZodNullable<z.ZodString>;
87
+ }, z.core.$strip>;
88
+ }, z.core.$strip>, "updates.status">;
89
+ }, Record<string, never>, "updates">;
@@ -0,0 +1,225 @@
1
+ // The program's own updates (install, check, go back, automatic on/off) and your saved settings brought up to date.
2
+ // Pure: schemas, labels, CLI hints and the page builder; updates.run.ts does the work through UpdateService and
3
+ // MigrateService.
4
+ import { z } from 'zod';
5
+ import { action, defineOperation, defineQuery, defineView, } from '../../kernel/index.js';
6
+ const FailedSchema = z.object({
7
+ version: z.string().describe('The version that failed'),
8
+ reason: z.string().describe('Why it failed, in one sentence'),
9
+ });
10
+ export const UpdatesStatusSchema = z.object({
11
+ managed: z.boolean().describe('Installed by the installer, so it can update itself'),
12
+ version: z.string().describe('The version installed'),
13
+ scope: z.enum(['user', 'machine']).nullable().describe('Installed for you, or for everyone on this PC'),
14
+ autoUpdate: z.boolean().describe('New versions install by themselves'),
15
+ autoOffText: z.string().nullable().describe('Why automatic updates were turned off, if they were'),
16
+ previous: z.string().nullable().describe('The version an update replaced (roll back goes there)'),
17
+ failed: FailedSchema.nullable().describe('The last update that failed'),
18
+ npmCommand: z.string().describe('How an npm install is updated'),
19
+ error: z.string().nullable().describe('Why the status could not be read'),
20
+ settings: z
21
+ .object({
22
+ pending: z.array(z.string()).describe('Each change still to make, as "name: what it does"'),
23
+ error: z.string().nullable().describe('Why your saved settings could not be read'),
24
+ })
25
+ .describe('Changes still to make to your saved settings'),
26
+ });
27
+ export const updatesStatus = defineQuery({
28
+ id: 'updates.status',
29
+ title: 'Updates',
30
+ summary: 'which version is installed and what your saved settings still need',
31
+ input: z.object({}),
32
+ output: UpdatesStatusSchema,
33
+ surfaces: {
34
+ except: { cli: 'no command shows this page; sandbox update --check and --version cover the command line' },
35
+ },
36
+ });
37
+ const LineSchema = z.object({ line: z.string().describe('What happened, in one sentence') });
38
+ export const runUpdate = defineOperation({
39
+ id: 'updates.update',
40
+ title: 'Update now',
41
+ summary: 'install the newest version, or check, go back, or switch automatic updates',
42
+ input: z.object({
43
+ check: z.boolean().default(false).describe('only look whether a newer version exists'),
44
+ rollback: z.boolean().default(false).describe('go back to the version before the last update'),
45
+ auto: z
46
+ .enum(['on', 'off'])
47
+ .optional()
48
+ .describe('install new versions by themselves (for everyone on this PC: needs an admin terminal)'),
49
+ unattended: z.boolean().default(false).describe('used by automatic updates: no questions, short output'),
50
+ feed: z
51
+ .string()
52
+ .optional()
53
+ .describe('take the release from this folder (a feed.json and the package) instead of GitHub'),
54
+ }),
55
+ output: LineSchema.extend({ latest: z.string().nullable().describe('The newer version a check found') }),
56
+ danger: true,
57
+ text: (o) => o.line,
58
+ cli: {
59
+ name: 'update',
60
+ group: 'Health',
61
+ flags: {
62
+ check: { flag: '--check' },
63
+ rollback: { flag: '--rollback' },
64
+ auto: { flag: '--auto', value: 'on|off' },
65
+ unattended: { flag: '--unattended', noMenu: true, advanced: true },
66
+ feed: { flag: '--feed', value: 'folder', noMenu: true, advanced: true },
67
+ },
68
+ yes: '(--rollback) do not ask first',
69
+ },
70
+ });
71
+ export const migrateSettings = defineOperation({
72
+ id: 'updates.migrate',
73
+ title: 'Update saved settings',
74
+ summary: 'bring your saved settings up to date with this version',
75
+ input: z.object({
76
+ dryRun: z.boolean().default(false).describe('only list what would change'),
77
+ restore: z
78
+ .string()
79
+ .optional()
80
+ .describe('put back the files saved before an update (a folder under <storage>\\backups)'),
81
+ }),
82
+ output: LineSchema,
83
+ text: (o) => o.line,
84
+ cli: {
85
+ name: 'migrate',
86
+ group: 'Health',
87
+ flags: { dryRun: { flag: '--dry-run' }, restore: { flag: '--restore', value: 'backup', advanced: true } },
88
+ yes: '(--restore) do not ask first',
89
+ },
90
+ });
91
+ const row = (id, label, extra = {}) => ({ id: 'updates:' + id, label, ...extra });
92
+ /** The Updates page: "This program" (version, newest, automatic updates, previous, last failure) and saved settings. */
93
+ export function updatesPage(s, latest) {
94
+ const managed = s.managed && !s.error;
95
+ const machine = s.scope === 'machine';
96
+ const nextAuto = s.autoUpdate ? 'off' : 'on';
97
+ const rollback = action(runUpdate, { rollback: true }, { label: 'Roll back', verb: 'go back' });
98
+ const program = {
99
+ id: 'program',
100
+ title: 'This program',
101
+ notes: [
102
+ {
103
+ text: 'After an update this page still runs the version it started with; sandbox web open (or the next sandbox start) starts the new one.',
104
+ tone: 'muted',
105
+ only: 'web',
106
+ },
107
+ ],
108
+ items: s.error
109
+ ? [{ id: 'updates:error', label: s.error, tone: 'danger' }]
110
+ : !s.managed
111
+ ? [
112
+ row('version', 'Version', {
113
+ hint: s.version,
114
+ description: 'Installed with npm, so npm updates it: ' + s.npmCommand,
115
+ }),
116
+ row('npm', 'Update', {
117
+ hint: 'with npm',
118
+ tone: 'muted',
119
+ description: 'Run ' + s.npmCommand + ' in a terminal.',
120
+ }),
121
+ ]
122
+ : [
123
+ row('version', 'Version', {
124
+ hint: s.version,
125
+ description: 'Installed ' + (machine ? 'for everyone on this PC' : 'for you') + '.',
126
+ }),
127
+ row('latest', 'Newest version', {
128
+ hint: latest ?? 'not looked yet',
129
+ tone: latest ? 'warn' : 'muted',
130
+ keys: latest ? 'Enter installs it.' : 'Enter looks on GitHub for a newer version.',
131
+ primary: latest
132
+ ? action(runUpdate, {}, { label: 'Install ' + latest, verb: 'install' })
133
+ : action(runUpdate, { check: true }, { label: 'Check now', verb: 'look', danger: false }),
134
+ }),
135
+ row('auto', 'Automatic updates', {
136
+ hint: s.autoUpdate ? 'on' : 'off',
137
+ tone: s.autoUpdate ? 'ok' : 'muted',
138
+ description: machine
139
+ ? 'For everyone: needs an admin terminal.'
140
+ : 'A new version installs when no sandbox runs.',
141
+ keys: 'Enter switches them.',
142
+ primary: action(runUpdate, { auto: nextAuto }, {
143
+ label: 'Automatic updates ' + nextAuto,
144
+ verb: 'switch',
145
+ danger: false,
146
+ }),
147
+ actions: [
148
+ action(runUpdate, { auto: nextAuto }, {
149
+ key: 'a',
150
+ label: 'Automatic updates ' + nextAuto,
151
+ verb: 'automatic on/off',
152
+ danger: false,
153
+ }),
154
+ ],
155
+ }),
156
+ ...(s.autoOffText
157
+ ? [
158
+ row('autooff', 'Automatic updates turned off', {
159
+ hint: 'off',
160
+ tone: 'warn',
161
+ description: s.autoOffText,
162
+ details: [s.autoOffText],
163
+ }),
164
+ ]
165
+ : []),
166
+ ...(s.previous
167
+ ? [
168
+ row('previous', 'Previous version', {
169
+ hint: s.previous,
170
+ keys: 'Enter goes back to it.',
171
+ primary: rollback,
172
+ actions: [{ ...rollback, key: 'r', verb: 'roll back' }],
173
+ }),
174
+ ]
175
+ : []),
176
+ ...(s.failed
177
+ ? [
178
+ row('failed', 'Last failed update', {
179
+ hint: s.failed.version,
180
+ tone: 'danger',
181
+ description: s.failed.reason,
182
+ details: [s.failed.reason, 'It is not tried again until a newer version is released.'],
183
+ }),
184
+ ]
185
+ : []),
186
+ ],
187
+ };
188
+ const pending = s.settings.pending;
189
+ const settingsItems = s.settings.error
190
+ ? [{ id: 'settings:error', label: s.settings.error, tone: 'danger' }]
191
+ : pending.length
192
+ ? pending.map((line, i) => ({
193
+ id: 'settings:' + i,
194
+ label: line.split(':')[0],
195
+ hint: 'to update',
196
+ tone: 'warn',
197
+ description: 'A backup is kept first.',
198
+ keys: 'Enter updates your saved settings.',
199
+ details: [line],
200
+ primary: action(migrateSettings, {}, { label: 'Update saved settings', verb: 'update' }),
201
+ actions: [
202
+ action(migrateSettings, {}, { key: 's', label: 'Update saved settings', verb: 'update saved settings' }),
203
+ ],
204
+ }))
205
+ : [{ id: 'settings:none', label: 'Up to date', hint: 'OK', tone: 'ok', description: 'Nothing to update.' }];
206
+ const settings = { id: 'settings', title: 'Saved settings', items: settingsItems };
207
+ return {
208
+ title: 'Updates',
209
+ sections: [program, settings],
210
+ actions: managed
211
+ ? [
212
+ action(runUpdate, { check: true }, { key: 'c', label: 'Check now', verb: 'check now', danger: false }),
213
+ action(runUpdate, {}, { key: 'u', label: 'Update now', verb: 'update now' }),
214
+ ]
215
+ : [],
216
+ };
217
+ }
218
+ export const updatesView = defineView({
219
+ id: 'updates',
220
+ title: 'Updates',
221
+ summary: 'Which version is installed, installing a newer one, and bringing your saved settings up to date.',
222
+ queries: { status: updatesStatus },
223
+ operations: [runUpdate, migrateSettings],
224
+ build: ({ status }) => updatesPage(status, null),
225
+ });
@@ -0,0 +1,48 @@
1
+ import { MigrateService, UpdateService } from '../../../cli/services/index.js';
2
+ import { type InputOf, type OperationIO, type OutputOf } from '../../kernel/index.js';
3
+ import { migrateSettings, runUpdate } from './updates.def.js';
4
+ /** sandbox update's work, given the service (tests pass their own). */
5
+ export declare function updateWith(service: UpdateService, input: InputOf<typeof runUpdate>, io: OperationIO): Promise<OutputOf<typeof runUpdate>>;
6
+ export declare const runUpdateRun: import("../../kernel/define.js").Implementation<import("../../kernel/define.js").OperationDef<import("zod").ZodObject<{
7
+ check: import("zod").ZodDefault<import("zod").ZodBoolean>;
8
+ rollback: import("zod").ZodDefault<import("zod").ZodBoolean>;
9
+ auto: import("zod").ZodOptional<import("zod").ZodEnum<{
10
+ off: "off";
11
+ on: "on";
12
+ }>>;
13
+ unattended: import("zod").ZodDefault<import("zod").ZodBoolean>;
14
+ feed: import("zod").ZodOptional<import("zod").ZodString>;
15
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
16
+ line: import("zod").ZodString;
17
+ latest: import("zod").ZodNullable<import("zod").ZodString>;
18
+ }, import("zod/v4/core").$strip>, "updates.update">, import("../../../cli/commands/context.js").Context>;
19
+ /** sandbox migrate's work, given the service (tests pass their own). */
20
+ export declare function migrateWith(service: MigrateService, input: InputOf<typeof migrateSettings>, io: OperationIO): Promise<OutputOf<typeof migrateSettings>>;
21
+ export declare const migrateSettingsRun: import("../../kernel/define.js").Implementation<import("../../kernel/define.js").OperationDef<import("zod").ZodObject<{
22
+ dryRun: import("zod").ZodDefault<import("zod").ZodBoolean>;
23
+ restore: import("zod").ZodOptional<import("zod").ZodString>;
24
+ }, import("zod/v4/core").$strip>, import("zod").ZodObject<{
25
+ line: import("zod").ZodString;
26
+ }, import("zod/v4/core").$strip>, "updates.migrate">, import("../../../cli/commands/context.js").Context>;
27
+ /** What the page shows: the program's state and saved settings, each read on its own (one failure keeps the rest). */
28
+ export declare const updatesStatusRun: import("../../kernel/define.js").Implementation<import("../../kernel/define.js").QueryDef<import("zod").ZodObject<{}, import("zod/v4/core").$strip>, import("zod").ZodObject<{
29
+ managed: import("zod").ZodBoolean;
30
+ version: import("zod").ZodString;
31
+ scope: import("zod").ZodNullable<import("zod").ZodEnum<{
32
+ user: "user";
33
+ machine: "machine";
34
+ }>>;
35
+ autoUpdate: import("zod").ZodBoolean;
36
+ autoOffText: import("zod").ZodNullable<import("zod").ZodString>;
37
+ previous: import("zod").ZodNullable<import("zod").ZodString>;
38
+ failed: import("zod").ZodNullable<import("zod").ZodObject<{
39
+ version: import("zod").ZodString;
40
+ reason: import("zod").ZodString;
41
+ }, import("zod/v4/core").$strip>>;
42
+ npmCommand: import("zod").ZodString;
43
+ error: import("zod").ZodNullable<import("zod").ZodString>;
44
+ settings: import("zod").ZodObject<{
45
+ pending: import("zod").ZodArray<import("zod").ZodString>;
46
+ error: import("zod").ZodNullable<import("zod").ZodString>;
47
+ }, import("zod/v4/core").$strip>;
48
+ }, import("zod/v4/core").$strip>, "updates.status">, import("../../../cli/commands/context.js").Context>;
@@ -0,0 +1,154 @@
1
+ // The updates area's work: checking, installing and going back for the program (UpdateService), automatic updates, and
2
+ // your saved settings (MigrateService). Talks only through io. The installer's own safety (no install while a sandbox
3
+ // runs, rollback on failure) stays in host/update.
4
+ import { userDir } from '../../../core/config/index.js';
5
+ import { errMsg, fail } from '../../../core/util/index.js';
6
+ import { MigrateService, NPM_UPDATE_COMMAND, UpdateService } from '../../../cli/services/index.js';
7
+ import { implement } from '../../context.js';
8
+ import { cancelled } from '../../kernel/index.js';
9
+ import { describeResult, whereOf } from './update-lines.js';
10
+ import { migrateSettings, runUpdate, updatesStatus } from './updates.def.js';
11
+ /** sandbox update's work, given the service (tests pass their own). */
12
+ export async function updateWith(service, input, io) {
13
+ if (!service.managed)
14
+ return { line: 'This copy was installed with npm. Update it with: ' + NPM_UPDATE_COMMAND, latest: null };
15
+ // The scheduled task (it may outlive a removal that needed admin) and background starts only run when updates are on.
16
+ if (input.unattended && !input.auto && !service.status().autoUpdate)
17
+ return { line: '', latest: null };
18
+ if (input.auto) {
19
+ io.progress('Turning automatic updates ' + input.auto);
20
+ service.setAuto(input.auto === 'on');
21
+ return { line: 'Automatic updates are ' + input.auto + '.', latest: null };
22
+ }
23
+ if (input.rollback) {
24
+ const { version, state } = service.status();
25
+ const target = state.previous ? 'version ' + state.previous : 'the version before the last update';
26
+ const yes = await io.confirm({
27
+ title: 'Go back from version ' + version + ' to ' + target + '?',
28
+ lines: ['Takes effect the next time you start it.'],
29
+ yes: 'Go back',
30
+ danger: true,
31
+ noTerminal: { message: 'Cannot ask here (no terminal).', fix: 'Add --yes to go back without asking.' },
32
+ });
33
+ if (!yes)
34
+ cancelled('Nothing was changed.');
35
+ return { line: 'Went back to version ' + service.rollback() + '.', latest: null };
36
+ }
37
+ if (input.check) {
38
+ io.progress('Looking for a newer version');
39
+ const found = await service.check();
40
+ if (found.available && found.latest)
41
+ return {
42
+ line: 'Version ' + found.latest.version + ' is available (you have ' + found.current + '). Run: sandbox update',
43
+ latest: found.latest.version,
44
+ };
45
+ if (found.blocked)
46
+ return {
47
+ line: 'A newer version exists but failed to install before; you have ' + found.current + '.',
48
+ latest: null,
49
+ };
50
+ return { line: 'You have the newest version (' + found.current + ').', latest: null };
51
+ }
52
+ // Implied: the command line never asks (typing it was the decision, and --unattended runs from a task); the menu and
53
+ // the web ask, because they replace the program from a click.
54
+ const go = await io.confirm({
55
+ title: 'Install the newest version if there is one?',
56
+ lines: [
57
+ 'The program files are replaced. Open a new terminal afterwards to use it.',
58
+ 'Nothing is installed while a Windows Sandbox runs.',
59
+ ],
60
+ yes: 'Install',
61
+ danger: true,
62
+ implied: true,
63
+ });
64
+ if (!go)
65
+ cancelled();
66
+ io.progress('Installing the newest version');
67
+ const done = describeResult(await service.run(), input.unattended);
68
+ if (done.code !== 0)
69
+ fail(done.line);
70
+ return { line: done.line, latest: null };
71
+ }
72
+ export const runUpdateRun = implement(runUpdate, async (ctx, input, io) => {
73
+ // A folder of the user's choosing is installed from only on the command line (the web and the menu send no feed).
74
+ if (input.feed !== undefined && input.feed !== ctx.options.feed)
75
+ fail('--feed works only on the command line.');
76
+ return updateWith(UpdateService.forPackage(ctx.packageRoot, input.feed, { userDir: userDir() }), input, io);
77
+ });
78
+ /** sandbox migrate's work, given the service (tests pass their own). */
79
+ export async function migrateWith(service, input, io) {
80
+ if (input.restore) {
81
+ const restore = input.restore;
82
+ const yes = await io.confirm({
83
+ title: 'Put back the files saved in ' + restore + '? Your current settings files are replaced.',
84
+ yes: 'Put back',
85
+ danger: true,
86
+ noTerminal: { message: 'Cannot ask here (no terminal).', fix: 'Add --yes to put them back without asking.' },
87
+ });
88
+ if (!yes)
89
+ cancelled('Nothing was changed.');
90
+ service.restore(restore);
91
+ return { line: 'Put back the files saved in ' + restore + '.' };
92
+ }
93
+ if (input.dryRun) {
94
+ const plan = service.plan();
95
+ if (!plan.length)
96
+ return { line: 'Nothing to update.' };
97
+ io.log('Would update:');
98
+ for (const line of plan)
99
+ io.log(' ' + line);
100
+ return { line: '' };
101
+ }
102
+ const result = await service.run((line) => io.log(line, 'muted'));
103
+ const sentences = [];
104
+ if (result.applied.length)
105
+ sentences.push('Updated: ' + result.applied.join(', ') + '.');
106
+ else if (!result.postponed.length)
107
+ sentences.push('Nothing to update.');
108
+ if (result.postponed.length)
109
+ sentences.push('Waiting for no sandbox to run: ' + result.postponed.join(', ') + '.');
110
+ const last = sentences.pop() ?? 'Nothing to update.';
111
+ for (const s of sentences)
112
+ io.log(s);
113
+ return { line: last };
114
+ }
115
+ export const migrateSettingsRun = implement(migrateSettings, (ctx, input, io) => migrateWith(new MigrateService(whereOf(ctx)), input, io));
116
+ /** What the page shows: the program's state and saved settings, each read on its own (one failure keeps the rest). */
117
+ export const updatesStatusRun = implement(updatesStatus, (ctx) => {
118
+ let program;
119
+ try {
120
+ const s = UpdateService.forPackage(ctx.packageRoot, undefined, { userDir: userDir() }).status();
121
+ program = {
122
+ managed: s.managed,
123
+ version: s.version,
124
+ scope: s.scope,
125
+ autoUpdate: s.autoUpdate,
126
+ autoOffText: s.autoOffText ?? null,
127
+ previous: s.state.previous ?? null,
128
+ failed: s.state.failed ? { version: s.state.failed.version, reason: s.state.failed.reason } : null,
129
+ npmCommand: NPM_UPDATE_COMMAND,
130
+ error: null,
131
+ };
132
+ }
133
+ catch (e) {
134
+ program = {
135
+ managed: false,
136
+ version: '',
137
+ scope: null,
138
+ autoUpdate: false,
139
+ autoOffText: null,
140
+ previous: null,
141
+ failed: null,
142
+ npmCommand: NPM_UPDATE_COMMAND,
143
+ error: errMsg(e),
144
+ };
145
+ }
146
+ let settings;
147
+ try {
148
+ settings = { pending: new MigrateService(whereOf(ctx)).plan(), error: null };
149
+ }
150
+ catch (e) {
151
+ settings = { pending: [], error: errMsg(e) };
152
+ }
153
+ return { ...program, settings };
154
+ });
@@ -0,0 +1,2 @@
1
+ export * from './vpn.def.js';
2
+ export * from './vpn.run.js';
@@ -0,0 +1,3 @@
1
+ // The VPN feature: its status, saving and deleting the login.
2
+ export * from './vpn.def.js';
3
+ export * from './vpn.run.js';