windows-development-sandbox 1.10.0 → 1.11.4

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 (383) hide show
  1. package/README.md +64 -17
  2. package/config.example.json +5 -1
  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 +194 -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 +959 -4
  32. package/dist/app/features/defs.js +151 -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 +297 -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 +220 -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 +224 -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 +21 -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 -89
  149. package/dist/cli/commands/web.d.ts +2 -1
  150. package/dist/cli/commands/web.js +14 -78
  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 +2 -1
  200. package/dist/core/schema/config.d.ts +5 -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/types.d.ts +6 -3
  211. package/dist/guest/boot/boot.js +8 -0
  212. package/dist/guest/daemon/daemon.js +1 -1
  213. package/dist/guest/daemon/sessions.d.ts +3 -2
  214. package/dist/guest/daemon/sessions.js +38 -7
  215. package/dist/guest/governor/core.d.ts +44 -0
  216. package/dist/guest/governor/core.js +124 -0
  217. package/dist/guest/governor/decide.d.ts +46 -18
  218. package/dist/guest/governor/decide.js +136 -82
  219. package/dist/guest/governor/governor.d.ts +2 -38
  220. package/dist/guest/governor/governor.js +33 -113
  221. package/dist/guest/governor/index.d.ts +1 -0
  222. package/dist/guest/governor/index.js +1 -0
  223. package/dist/guest/network/firewall.d.ts +2 -0
  224. package/dist/guest/network/firewall.js +3 -3
  225. package/dist/guest/sessions/viewer.js +5 -1
  226. package/dist/guest/setup/github-token.d.ts +7 -0
  227. package/dist/guest/setup/github-token.js +65 -0
  228. package/dist/guest/toolchains/languages/node.js +11 -1
  229. package/dist/guest/toolchains/native/rust-extras.js +2 -2
  230. package/dist/guest/toolchains/tools/cli.d.ts +8 -0
  231. package/dist/guest/toolchains/tools/cli.js +35 -2
  232. package/dist/guest/vpn/openvpn.d.ts +5 -0
  233. package/dist/guest/vpn/openvpn.js +14 -1
  234. package/dist/guest/vpn/vpn.js +55 -16
  235. package/dist/guest/vpn/wireguard.js +2 -0
  236. package/dist/host/channel/attach.d.ts +1 -0
  237. package/dist/host/channel/attach.js +1 -0
  238. package/dist/host/channel/channel.d.ts +1 -1
  239. package/dist/host/channel/channel.js +2 -2
  240. package/dist/host/engines/hcs/check.d.ts +1 -0
  241. package/dist/host/engines/hcs/check.js +1 -1
  242. package/dist/host/engines/hcs/engine.d.ts +1 -1
  243. package/dist/host/engines/hcs/engine.js +6 -4
  244. package/dist/host/engines/hcs/helper.d.ts +11 -0
  245. package/dist/host/engines/hcs/helper.js +31 -2
  246. package/dist/host/engines/hcs/leftovers.d.ts +42 -0
  247. package/dist/host/engines/hcs/leftovers.js +101 -0
  248. package/dist/host/engines/index.d.ts +1 -0
  249. package/dist/host/engines/index.js +1 -0
  250. package/dist/host/github/deliver.d.ts +13 -0
  251. package/dist/host/github/deliver.js +51 -0
  252. package/dist/host/github/index.d.ts +2 -0
  253. package/dist/host/github/index.js +3 -0
  254. package/dist/host/github/token.d.ts +21 -0
  255. package/dist/host/github/token.js +74 -0
  256. package/dist/host/launch/generate.js +11 -5
  257. package/dist/host/launch/index.d.ts +1 -1
  258. package/dist/host/launch/index.js +1 -1
  259. package/dist/host/launch/session-file.js +1 -2
  260. package/dist/host/launch/wsb-file.d.ts +11 -7
  261. package/dist/host/launch/wsb-file.js +30 -12
  262. package/dist/host/life/host-memory.d.ts +18 -0
  263. package/dist/host/life/host-memory.js +66 -0
  264. package/dist/host/life/watchdog.d.ts +9 -0
  265. package/dist/host/life/watchdog.js +17 -1
  266. package/dist/host/sandbox/tasklist.d.ts +6 -0
  267. package/dist/host/sandbox/tasklist.js +37 -0
  268. package/dist/host/secrets/launch-secrets.d.ts +2 -1
  269. package/dist/host/secrets/launch-secrets.js +4 -2
  270. package/dist/host/vpn/status.js +13 -3
  271. package/dist/host/web/backend.d.ts +1 -3
  272. package/dist/host/web/index.d.ts +2 -1
  273. package/dist/host/web/index.js +2 -1
  274. package/dist/host/web/live.d.ts +23 -0
  275. package/dist/host/web/live.js +107 -0
  276. package/dist/host/web/rpc.d.ts +6 -1
  277. package/dist/host/web/rpc.js +23 -31
  278. package/dist/host/web/runner.d.ts +4 -0
  279. package/dist/host/web/runner.js +12 -1
  280. package/dist/host/web/server.d.ts +30 -2
  281. package/dist/host/web/server.js +87 -29
  282. package/dist/host/web/state.d.ts +1 -0
  283. package/dist/host/web/state.js +2 -0
  284. package/dist/runtime/agent.js +30 -6
  285. package/dist/runtime/daemon.js +337 -177
  286. package/dist/runtime/db.js +30 -6
  287. package/dist/runtime/main.js +389 -77
  288. package/dist/runtime/netproxy.js +30 -6
  289. package/dist/runtime/view.js +495 -146
  290. package/dist/selftest/app.test.js +632 -12
  291. package/dist/selftest/channel.test.js +18 -1
  292. package/dist/selftest/cli.test.js +1 -1
  293. package/dist/selftest/config.test.js +1 -1
  294. package/dist/selftest/contained.test.js +1 -1
  295. package/dist/selftest/data.test.js +1 -2
  296. package/dist/selftest/engine.test.js +3 -1
  297. package/dist/selftest/github.test.d.ts +2 -0
  298. package/dist/selftest/github.test.js +243 -0
  299. package/dist/selftest/hcs.test.js +105 -8
  300. package/dist/selftest/health.test.js +71 -0
  301. package/dist/selftest/heavy-load.test.js +132 -72
  302. package/dist/selftest/index.js +4 -0
  303. package/dist/selftest/layout.test.js +8 -0
  304. package/dist/selftest/live-terminal.test.js +74 -0
  305. package/dist/selftest/menu-screens.js +171 -56
  306. package/dist/selftest/menu.test.js +54 -37
  307. package/dist/selftest/migrate.test.js +14 -12
  308. package/dist/selftest/powershell-variables.test.d.ts +2 -0
  309. package/dist/selftest/powershell-variables.test.js +61 -0
  310. package/dist/selftest/support/engine-golden.js +1 -0
  311. package/dist/selftest/support/fixtures.d.ts +4 -0
  312. package/dist/selftest/support/web-preview.d.ts +1 -0
  313. package/dist/selftest/support/web-preview.js +856 -0
  314. package/dist/selftest/update-service.test.js +15 -8
  315. package/dist/selftest/vpn.test.js +86 -2
  316. package/dist/selftest/web.test.js +58 -11
  317. package/dist/shared/channel/run-dir.d.ts +2 -0
  318. package/dist/shared/channel/run-dir.js +3 -0
  319. package/dist/shared/channel/schema.d.ts +7 -0
  320. package/dist/shared/channel/schema.js +9 -1
  321. package/dist/shared/channel/secrets.d.ts +1 -0
  322. package/dist/shared/channel/secrets.js +3 -0
  323. package/dist/shared/github/index.d.ts +1 -0
  324. package/dist/shared/github/index.js +2 -0
  325. package/dist/shared/github/token.d.ts +29 -0
  326. package/dist/shared/github/token.js +89 -0
  327. package/dist/shared/memory/policy.d.ts +33 -12
  328. package/dist/shared/memory/policy.js +50 -19
  329. package/dist/shared/pty/ctrl-c.d.ts +18 -0
  330. package/dist/shared/pty/ctrl-c.js +36 -0
  331. package/dist/shared/pty/index.d.ts +1 -0
  332. package/dist/shared/pty/index.js +1 -0
  333. package/dist/shared/pty/terminal.d.ts +2 -0
  334. package/dist/shared/pty/terminal.js +21 -2
  335. package/dist/shared/vpn/kill-switch.d.ts +13 -2
  336. package/dist/shared/vpn/kill-switch.js +88 -8
  337. package/dist/shared/web/protocol.d.ts +0 -4
  338. package/dist/sync/watcher.d.ts +2 -0
  339. package/dist/sync/watcher.js +8 -3
  340. package/dist/web/index.html +2 -2
  341. package/dist/web/{main-T5DMCHYV.css → main-MU5XWZMS.css} +1 -1
  342. package/dist/web/main-SLQNJRXD.js +219 -0
  343. package/native/csharp/HcsHost/AssemblyInfo.cs +3 -3
  344. package/native/csharp/HostTools/AssemblyInfo.cs +3 -3
  345. package/native/csharp/HostTools/MemoryStatus.cs +58 -2
  346. package/native/csharp/HostTools/Program.cs +7 -1
  347. package/package.json +10 -3
  348. package/sandbox/csharp/MemGov.cs +240 -38
  349. package/sandbox/csharp/PtyHost.cs +104 -15
  350. package/sandbox/csharp/SandboxTools/CpuCap.cs +50 -1
  351. package/sandbox/csharp/SandboxTools/Program.cs +1 -1
  352. package/sandbox/scripts/repair-wmi-services.ps1 +26 -0
  353. package/schemas/config.schema.json +19 -5
  354. package/schemas/sandbox-config.schema.json +7 -3
  355. package/dist/cli/commands/accounts.d.ts +0 -2
  356. package/dist/cli/commands/accounts.js +0 -96
  357. package/dist/cli/commands/data/clean.d.ts +0 -3
  358. package/dist/cli/commands/data/clean.js +0 -60
  359. package/dist/cli/commands/data/index.d.ts +0 -4
  360. package/dist/cli/commands/data/index.js +0 -62
  361. package/dist/cli/commands/maintenance/clean.d.ts +0 -2
  362. package/dist/cli/commands/maintenance/clean.js +0 -24
  363. package/dist/cli/commands/maintenance/config-share.d.ts +0 -12
  364. package/dist/cli/commands/maintenance/config-share.js +0 -80
  365. package/dist/cli/commands/projects/projects.d.ts +0 -2
  366. package/dist/cli/commands/projects/projects.js +0 -162
  367. package/dist/cli/commands/storage/contained.d.ts +0 -3
  368. package/dist/cli/commands/storage/contained.js +0 -179
  369. package/dist/cli/commands/storage/storage.d.ts +0 -8
  370. package/dist/cli/commands/storage/storage.js +0 -179
  371. package/dist/cli/menu/add-agent.d.ts +0 -47
  372. package/dist/cli/menu/add-agent.js +0 -168
  373. package/dist/cli/menu/apps.d.ts +0 -69
  374. package/dist/cli/menu/apps.js +0 -214
  375. package/dist/cli/menu/data-folder.d.ts +0 -18
  376. package/dist/cli/menu/data-folder.js +0 -99
  377. package/dist/cli/menu/share-settings.d.ts +0 -21
  378. package/dist/cli/menu/share-settings.js +0 -112
  379. package/dist/cli/menu/vpn-login.d.ts +0 -16
  380. package/dist/cli/menu/vpn-login.js +0 -74
  381. package/dist/web/main-NRRS5O6Z.js +0 -157
  382. /package/dist/cli/{commands/data/collect.d.ts → services/data-collect.d.ts} +0 -0
  383. /package/dist/cli/{commands/data/remove.d.ts → services/data-remove.d.ts} +0 -0
@@ -1,214 +0,0 @@
1
- // The apps catalogue as data for the Apps tab: every app by category, ticked = installed in every sandbox. VS Code and
2
- // Windows Terminal are listed too (they have settings of their own, which ticking changes). Ticks are staged in the
3
- // Draft and written with Ctrl+S, to your config file or (catalogue apps only) the project's .sandbox-config.json.
4
- import fs from 'node:fs';
5
- import path from 'node:path';
6
- import _ from 'lodash';
7
- import { APPS } from '../../shared/apps/index.js';
8
- import { Text, Theme } from '../tui/index.js';
9
- export const CUSTOM = '@custom:';
10
- /** The catalogue has many small categories; the menu shows these few groups so the navigation stays short. */
11
- export const APP_GROUPS = [
12
- {
13
- id: 'editors',
14
- label: 'Editors & docs',
15
- description: 'Code and text editors (VS Code is on by default), plus diagrams and document conversion.',
16
- members: ['editors', 'diagrams'],
17
- },
18
- {
19
- id: 'clients',
20
- label: 'DB & API clients',
21
- description: 'GUIs for the sandbox databases, tools to send HTTP, REST and GraphQL requests, and to inspect traffic.',
22
- members: ['databases', 'api', 'network'],
23
- },
24
- {
25
- id: 'tools',
26
- label: 'Git & utilities',
27
- description: 'Git GUIs and terminal UIs, archives, file search and comparing, process tools, and decompilers.',
28
- members: ['git', 'utilities', 'reversing'],
29
- },
30
- {
31
- id: 'cli',
32
- label: 'Command-line & cloud',
33
- description: 'Small developer tools (JSON, search, builds, media ...) and tools for clouds and Kubernetes.',
34
- members: ['cli', 'cloud'],
35
- },
36
- {
37
- id: 'play',
38
- label: 'Browsers & games',
39
- description: 'Browsers for testing web apps, and game engines and editors (they draw with OpenGL on the CPU).',
40
- members: ['browsers', 'gamedev'],
41
- },
42
- ];
43
- /** The group an app category is shown under. */
44
- export function groupOf(category) {
45
- return APP_GROUPS.find((g) => g.members.includes(category))?.id ?? 'tools';
46
- }
47
- const INSTALL = ['apps', 'install'];
48
- /** The row in Apps that opens the "request an app" issue form (its id is not an app). */
49
- export const REQUEST_APP = '@request-app';
50
- /** This project's new-issue page on GitHub. */
51
- export const ISSUES_URL = 'https://github.com/JoshDiDuca/windows-development-sandbox/issues/new';
52
- /** The new-issue address with a title and a body to fill in (the page needs no login to show it). */
53
- export function requestAppUrl() {
54
- const body = [
55
- '**App name:**',
56
- '',
57
- '**Where to get it** (GitHub releases page or a direct download link):',
58
- '',
59
- '**What it is for:**',
60
- '',
61
- '**Command-line tool or desktop app?**',
62
- '',
63
- '**Does it need a GPU, a license or an account?**',
64
- ].join('\n');
65
- const query = [
66
- ['title', 'App request: '],
67
- ['body', body],
68
- ['labels', 'app-request'],
69
- ];
70
- return ISSUES_URL + '?' + query.map(([k, v]) => k + '=' + encodeURIComponent(v)).join('&');
71
- }
72
- export class AppsModel {
73
- file;
74
- dataPath;
75
- constructor(file, dataPath) {
76
- this.file = file;
77
- this.dataPath = dataPath;
78
- }
79
- /** The catalogue entries this file can change (a project cannot change an app that has a setting of its own). */
80
- entries() {
81
- return APPS.filter((a) => !(this.file.isProject && a.setting));
82
- }
83
- categories() {
84
- return [
85
- ...APP_GROUPS.map(({ id, label, description }) => ({ id, label, description })),
86
- ...(this.file.isProject
87
- ? []
88
- : [
89
- {
90
- id: 'custom',
91
- label: 'Your own programs',
92
- description: 'Programs you added yourself (c to add or change them).',
93
- },
94
- ]),
95
- ];
96
- }
97
- /** Downloaded already (into this data folder), so the next sandbox starts it without a download. */
98
- installed(entry) {
99
- if (entry.id === 'vscode')
100
- return fs.existsSync(path.join(this.dataPath, 'tools', 'vscode', 'Code.exe'));
101
- if (entry.id === 'windows-terminal')
102
- return fs.existsSync(path.join(this.dataPath, 'tools', 'terminal', 'WindowsTerminal.exe'));
103
- return fs.existsSync(path.join(this.dataPath, 'tools', 'apps', entry.id, '.agent-sandbox-app'));
104
- }
105
- savedInstall() {
106
- return ((this.file.isProject ? this.file.valueInFile(INSTALL) : this.file.userConfig().apps.install) ?? []);
107
- }
108
- /** Is the entry on in the saved file? */
109
- savedOn(entry) {
110
- return entry.setting
111
- ? _.get(this.file.userConfig(), entry.setting) === true
112
- : this.savedInstall().includes(entry.id);
113
- }
114
- /** Is the entry on once the staged changes are saved? */
115
- isOn(entry, draft) {
116
- if (entry.setting) {
117
- const key = entry.setting.split('.');
118
- return draft.has(this.file, key) ? draft.value(this.file, key) === true : this.savedOn(entry);
119
- }
120
- const staged = draft.has(this.file, INSTALL)
121
- ? draft.value(this.file, INSTALL)
122
- : undefined;
123
- return draft.has(this.file, INSTALL) ? (staged ?? []).includes(entry.id) : this.savedOn(entry);
124
- }
125
- /** Your own programs (apps.custom), staged or saved. */
126
- custom(draft) {
127
- if (this.file.isProject)
128
- return {};
129
- const key = ['apps', 'custom'];
130
- return (draft.has(this.file, key) ? draft.value(this.file, key) : this.file.userConfig().apps.custom);
131
- }
132
- item(entry, draft) {
133
- const notes = [
134
- Theme.muted('Download ') +
135
- '~' +
136
- entry.size +
137
- ' once, kept in C:\\AgentData\\tools\\' +
138
- (entry.setting ? '' : 'apps\\') +
139
- entry.id,
140
- Theme.muted('Starts ') +
141
- (entry.cli ? 'from a terminal (on PATH)' : 'from the desktop or Start > Sandbox apps'),
142
- ...(entry.needs?.includes('mesa')
143
- ? [Theme.muted('Graphics ') + 'OpenGL on the CPU (Mesa) is added for it']
144
- : []),
145
- ...(entry.fullGitOnly
146
- ? [Theme.warn('Needs full git access (Settings > Projects & setup > Git): it pushes with its own git.')]
147
- : []),
148
- ...(entry.setting ? [Theme.muted('Setting ') + entry.setting] : []),
149
- ];
150
- return {
151
- value: entry.id,
152
- label: entry.name,
153
- category: groupOf(entry.category),
154
- description: entry.about,
155
- details: notes,
156
- keywords: entry.id,
157
- hint: (this.installed(entry) ? Theme.ok('installed ') : '') + Theme.muted(entry.size),
158
- checked: this.isOn(entry, draft),
159
- };
160
- }
161
- items(draft) {
162
- return [
163
- ...this.entries().map((a) => this.item(a, draft)),
164
- ...(this.file.isProject
165
- ? []
166
- : [
167
- {
168
- value: REQUEST_APP,
169
- label: 'Request an app…',
170
- category: 'custom',
171
- description: 'Not in the list? Press r: your browser opens a prefilled request on GitHub (' + ISSUES_URL + ').',
172
- hint: Theme.muted('press r'),
173
- disabled: 'Press r to open the request form on GitHub.',
174
- },
175
- ]),
176
- ...Object.entries(this.custom(draft)).map(([id, a]) => ({
177
- value: CUSTOM + id,
178
- label: a.name,
179
- category: 'custom',
180
- description: a.github ? 'From the latest ' + a.github + ' release.' : 'From ' + a.url,
181
- hint: Theme.muted(a.cli ? 'command line' : 'desktop'),
182
- checked: true,
183
- disabled: 'Your own programs are always installed; c to change or remove them.',
184
- })),
185
- ];
186
- }
187
- /** Stages the ticks of the list: only what differs from the saved file is kept in the draft. */
188
- stageTicks(draft, ticked) {
189
- for (const entry of this.entries().filter((a) => a.setting)) {
190
- const key = entry.setting.split('.');
191
- const on = ticked.includes(entry.id);
192
- if (on === this.savedOn(entry))
193
- draft.unstage(this.file, key);
194
- else
195
- draft.stage(this.file, key, on);
196
- }
197
- const wanted = this.entries()
198
- .filter((a) => !a.setting && ticked.includes(a.id))
199
- .map((a) => a.id);
200
- if (_.isEqual([...wanted].sort(), [...this.savedInstall()].sort()))
201
- draft.unstage(this.file, INSTALL);
202
- else
203
- draft.stage(this.file, INSTALL, wanted.length || this.file.isProject ? wanted : undefined);
204
- }
205
- }
206
- /** For notices: "12 apps chosen". */
207
- export function appsSummary(file) {
208
- const config = file.userConfig();
209
- const n = config.apps.install.length + Object.keys(config.apps.custom).length;
210
- return n ? n + ' chosen' : 'none chosen';
211
- }
212
- export function appLabel(id) {
213
- return APPS.find((a) => a.id === id)?.name ?? Text.humanize(id);
214
- }
@@ -1,18 +0,0 @@
1
- import type { Context } from '../commands/context.js';
2
- import type { App } from '../tui/index.js';
3
- import type { ShellExit } from './shell.js';
4
- /** The row in Settings and Maintenance. */
5
- export declare function dataFolderRow(ctx: Context): {
6
- label: string;
7
- hint: string;
8
- description: string;
9
- };
10
- export declare class DataFolderFlow {
11
- private readonly app;
12
- private readonly ctx;
13
- constructor(app: App, ctx: Context);
14
- /** The command to run (move or use), or undefined when nothing was chosen. */
15
- run(): Promise<ShellExit | undefined>;
16
- private measure;
17
- private decide;
18
- }
@@ -1,99 +0,0 @@
1
- // The "Data folder" row and its flow: shows where the saved data is, lets you pick another folder in the path picker,
2
- // asks whether to move the data or only switch, and hands the command to run on the normal screen (the move prints its
3
- // progress there).
4
- import fs from 'node:fs';
5
- import { humanBytes } from '../../core/disk.js';
6
- import { describeDuration, describeSize, estimate, holdsData, measureFolder, moveProblem, moveWarning, } from '../../host/storage/index.js';
7
- /** Measuring for the dialog stops after this long (the size then reads "at least"). */
8
- const MEASURE_MS = 8000;
9
- /** The row in Settings and Maintenance. */
10
- export function dataFolderRow(ctx) {
11
- return {
12
- label: 'Data folder',
13
- hint: ctx.storageRoot,
14
- description: 'Where your tools, logins, history and logs are kept between sandboxes. Press Enter to move them to another folder or drive, or to use a different folder.',
15
- };
16
- }
17
- export class DataFolderFlow {
18
- app;
19
- ctx;
20
- constructor(app, ctx) {
21
- this.app = app;
22
- this.ctx = ctx;
23
- }
24
- /** The command to run (move or use), or undefined when nothing was chosen. */
25
- async run() {
26
- const from = this.ctx.storageRoot;
27
- const exists = fs.existsSync(from);
28
- const measured = exists ? this.measure(from) : { bytes: 0, files: 0, partial: false };
29
- const size = exists && holdsData(from) ? describeSize(measured) : 'nothing in it yet';
30
- const to = await this.app.pickPath({
31
- path: ['Data folder'],
32
- title: 'Choose the folder for your saved data',
33
- about: [
34
- 'Now: ' + from + ' (' + size + ').',
35
- 'Pick a new or empty folder to move your data there, or a folder that already holds data to use it.',
36
- ],
37
- initial: from.replace(/[\\/][^\\/]*$/, '\\'),
38
- use: 'use this folder',
39
- validate: (picked) => {
40
- const problem = moveProblem(from, picked, true);
41
- return problem ? problem.message : true;
42
- },
43
- });
44
- if (!to)
45
- return undefined;
46
- return this.decide(from, to, measured, exists);
47
- }
48
- measure(from) {
49
- const before = this.app.status;
50
- this.app.status = () => 'Measuring your saved data…';
51
- this.app.redraw();
52
- try {
53
- return measureFolder(from, MEASURE_MS);
54
- }
55
- finally {
56
- this.app.status = before;
57
- }
58
- }
59
- async decide(from, to, measured, exists) {
60
- if (to.toLowerCase() === from.toLowerCase())
61
- return undefined;
62
- const target = holdsData(to);
63
- const lines = [];
64
- let canMove = exists && holdsData(from) && !target;
65
- if (canMove) {
66
- const est = estimate(from, to, measured);
67
- lines.push('From: ' + from, 'To: ' + to, 'Size: ' + describeSize(measured));
68
- lines.push(est.sameVolume
69
- ? 'Time: a few seconds (same drive, nothing is copied)'
70
- : 'Time: ' + describeDuration(est.seconds) + ' (copied to another drive)');
71
- if (est.freeBytes !== null)
72
- lines.push('Free space on the target drive: ' + humanBytes(est.freeBytes));
73
- const warning = moveWarning(measured, est);
74
- if (warning)
75
- lines.push('', warning);
76
- if (!est.fits)
77
- canMove = false;
78
- }
79
- else {
80
- lines.push(target ? to + ' already holds data, so it is used as it is.' : 'There is nothing in ' + from + ' to move.', 'Your data stays where it is.');
81
- }
82
- const choice = await this.app.dialog({
83
- title: canMove ? 'Move your data to ' + to + '?' : 'Use ' + to + '?',
84
- lines: [...lines, '', 'Use without moving: the new folder is used from now on and your old data is left behind.'],
85
- choices: [
86
- ...(canMove ? [{ value: 'move', label: 'Move data', key: 'm' }] : []),
87
- { value: 'use', label: 'Switch without moving', key: 's' },
88
- { value: 'cancel', label: 'Cancel', key: 'c' },
89
- ],
90
- initial: 0,
91
- escape: 'cancel',
92
- });
93
- if (choice === 'move')
94
- return { kind: 'run', argv: ['storage', 'move', to, '--yes'] };
95
- if (choice === 'use')
96
- return { kind: 'run', argv: ['storage', 'use', to, '--yes'] };
97
- return undefined;
98
- }
99
- }
@@ -1,21 +0,0 @@
1
- import type { Context } from '../commands/context.js';
2
- import { type App } from '../tui/index.js';
3
- /** The rows' ids in the settings list. */
4
- export declare const EXPORT_SETTINGS = "@export-settings";
5
- export declare const IMPORT_SETTINGS = "@import-settings";
6
- export declare function shareSettingsRows(): {
7
- value: string;
8
- label: string;
9
- hint: string;
10
- description: string;
11
- }[];
12
- export declare class ShareSettingsFlow {
13
- private readonly app;
14
- private readonly ctx;
15
- constructor(app: App, ctx: Context);
16
- /** Your settings as they are on disk now (the menu may have saved changes since it started). */
17
- private fresh;
18
- /** Returns the notice to show (undefined when cancelled). */
19
- export(): Promise<string | undefined>;
20
- import(): Promise<string | undefined>;
21
- }
@@ -1,112 +0,0 @@
1
- // The "Export settings…" and "Import settings…" rows in Settings > General: pick a file, then (for an import) read the
2
- // diff of what would change and say yes once. Same rules as sandbox config export / import.
3
- import fs from 'node:fs';
4
- import path from 'node:path';
5
- import { loadConfig } from '../../core/config/index.js';
6
- import { errMsg } from '../../core/util/index.js';
7
- import { applyImport, DEFAULT_EXPORT, readImport, writeExport } from '../commands/maintenance/config-share.js';
8
- import { Theme } from '../tui/index.js';
9
- import { askPath } from './settings/ask-path.js';
10
- import { diffText, skippedLine } from './settings/index.js';
11
- /** The rows' ids in the settings list. */
12
- export const EXPORT_SETTINGS = '@export-settings';
13
- export const IMPORT_SETTINGS = '@import-settings';
14
- export function shareSettingsRows() {
15
- return [
16
- {
17
- value: EXPORT_SETTINGS,
18
- label: 'Export settings…',
19
- hint: '.json',
20
- description: 'Write the settings you changed to a .json file you can share with a team. Secrets, the data folder and folders or files of this PC are left out.',
21
- },
22
- {
23
- value: IMPORT_SETTINGS,
24
- label: 'Import settings…',
25
- hint: '.json',
26
- description: 'Read a settings file someone shared, see what it would change, and apply it once you say yes. Secrets, the data folder and paths in it are never taken.',
27
- },
28
- ];
29
- }
30
- export class ShareSettingsFlow {
31
- app;
32
- ctx;
33
- constructor(app, ctx) {
34
- this.app = app;
35
- this.ctx = ctx;
36
- }
37
- /** Your settings as they are on disk now (the menu may have saved changes since it started). */
38
- fresh() {
39
- return { ...this.ctx, loaded: loadConfig(this.ctx.loaded.configPath ?? undefined) };
40
- }
41
- /** Returns the notice to show (undefined when cancelled). */
42
- async export() {
43
- const where = ['Settings', 'Export settings'];
44
- try {
45
- const file = await askPath(this.app, {
46
- path: where,
47
- title: 'Where to write the settings file',
48
- about: ['Only what differs from the defaults is written; secrets and paths of this PC are left out.'],
49
- initial: path.resolve(DEFAULT_EXPORT),
50
- kind: 'file',
51
- validate: (p) => (p.toLowerCase().endsWith('.json') ? true : 'The file name should end in .json.'),
52
- });
53
- if (!file)
54
- return undefined;
55
- const exists = path.resolve(file);
56
- const replace = fs.existsSync(exists);
57
- if (replace &&
58
- !(await this.app.confirm({ path: where, question: exists + ' exists. Replace it?', initial: false })))
59
- return undefined;
60
- const skipped = writeExport(this.fresh(), file, false, replace);
61
- return (Theme.ok(Theme.glyph.ok + ' Wrote ' + exists + '.') +
62
- (skipped.length ? Theme.muted(' Left out: ' + skipped.join(', ') + '.') : ''));
63
- }
64
- catch (e) {
65
- return Theme.error(Theme.glyph.cross + ' ' + errMsg(e));
66
- }
67
- }
68
- async import() {
69
- const where = ['Settings', 'Import settings'];
70
- try {
71
- const file = await askPath(this.app, {
72
- path: where,
73
- title: 'Which settings file',
74
- about: ['A file made by Export settings (or sandbox config export).'],
75
- kind: 'file',
76
- });
77
- if (!file)
78
- return undefined;
79
- const ctx = this.fresh();
80
- const plan = readImport(ctx, file);
81
- const lines = [
82
- ...(plan.changes.length
83
- ? [
84
- plan.changes.length + ' setting' + (plan.changes.length === 1 ? '' : 's') + ' would change:',
85
- '',
86
- ...diffText(plan.lines),
87
- ]
88
- : ['Nothing to change: your settings already match the file.']),
89
- ...(plan.skipped.length
90
- ? ['', 'Not imported (never taken from a file):', ...plan.skipped.map((s) => skippedLine(s))]
91
- : []),
92
- ];
93
- if (!plan.changes.length) {
94
- await this.app.message({ path: where, lines });
95
- return Theme.muted('Nothing changed.');
96
- }
97
- const yes = await this.app.confirm({
98
- path: where,
99
- question: 'Change your settings like this?',
100
- about: lines,
101
- initial: false,
102
- });
103
- if (!yes)
104
- return Theme.muted('Nothing changed.');
105
- const n = applyImport(ctx, plan);
106
- return Theme.ok(Theme.glyph.ok + ' Imported ' + n + ' setting' + (n === 1 ? '' : 's') + '.');
107
- }
108
- catch (e) {
109
- return Theme.error(Theme.glyph.cross + ' ' + errMsg(e));
110
- }
111
- }
112
- }
@@ -1,16 +0,0 @@
1
- import type { Context } from '../commands/context.js';
2
- import { type App } from '../tui/index.js';
3
- /** The row's id in the settings list. */
4
- export declare const VPN_LOGIN = "@vpn-login";
5
- export declare function vpnLoginRow(ctx: Context): {
6
- label: string;
7
- hint: string;
8
- description: string;
9
- };
10
- export declare class VpnLoginFlow {
11
- private readonly app;
12
- private readonly ctx;
13
- constructor(app: App, ctx: Context);
14
- /** Returns the notice to show (undefined when cancelled). */
15
- run(): Promise<string | undefined>;
16
- }
@@ -1,74 +0,0 @@
1
- import { VPN_WARNINGS } from '../commands/vpn.js';
2
- import { NORD_STEPS, VpnService } from '../services/index.js';
3
- import { Theme } from '../tui/index.js';
4
- /** The row's id in the settings list. */
5
- export const VPN_LOGIN = '@vpn-login';
6
- export function vpnLoginRow(ctx) {
7
- const service = new VpnService(ctx);
8
- const nord = service.provider === 'nordvpn';
9
- if (service.provider === 'wireguard-file')
10
- return {
11
- label: 'VPN login',
12
- hint: 'not needed',
13
- description: 'A WireGuard file carries its own keys (vpn.configFile): there is no login to set.',
14
- };
15
- const state = service.loginState();
16
- return {
17
- label: nord ? 'Set NordVPN login…' : 'Set VPN login…',
18
- hint: state === 'saved' ? 'saved' : state === 'unreadable' ? 'cannot be read' : 'not saved',
19
- description: 'The login the VPN uses (for NordVPN the service credentials from Nord Account > NordVPN > Set up NordVPN manually, not your account password). Typed hidden, kept encrypted for your Windows user, never shown. ' +
20
- VPN_WARNINGS.join(' '),
21
- };
22
- }
23
- export class VpnLoginFlow {
24
- app;
25
- ctx;
26
- constructor(app, ctx) {
27
- this.app = app;
28
- this.ctx = ctx;
29
- }
30
- /** Returns the notice to show (undefined when cancelled). */
31
- async run() {
32
- const service = new VpnService(this.ctx);
33
- const nord = service.provider === 'nordvpn';
34
- if (service.provider === 'wireguard-file')
35
- return 'A WireGuard file carries its own keys: no login is needed.';
36
- const path = ['Settings', 'Network', 'VPN login'];
37
- await this.app.message({
38
- path,
39
- title: nord ? 'NordVPN service credentials' : 'VPN login',
40
- lines: [
41
- ...(nord
42
- ? ['To find them:', ...NORD_STEPS.map((s, i) => i + 1 + '. ' + s)]
43
- : ['The user name and password your VPN profile asks for.']),
44
- '',
45
- 'What you type next is hidden, kept encrypted for your Windows user and never shown again.',
46
- '',
47
- ...VPN_WARNINGS,
48
- ],
49
- });
50
- const username = await this.app.text({
51
- path,
52
- label: nord ? 'Service user name' : 'User name',
53
- masked: true,
54
- validate: (v) => (v.trim() ? true : 'Type the user name.'),
55
- });
56
- if (username === undefined)
57
- return undefined;
58
- const password = await this.app.text({
59
- path,
60
- label: nord ? 'Service password' : 'Password',
61
- masked: true,
62
- validate: (v) => (v ? true : 'Type the password.'),
63
- });
64
- if (password === undefined)
65
- return undefined;
66
- try {
67
- service.save({ username, password });
68
- }
69
- catch (e) {
70
- return Theme.error(Theme.glyph.cross + ' ' + (e instanceof Error ? e.message : String(e)));
71
- }
72
- return Theme.ok(Theme.glyph.ok + ' The VPN login is saved (encrypted). Turn the VPN on under Settings > Network.');
73
- }
74
- }