@boxes-dev/dvb-runtime 1.0.298 → 1.0.299

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 (488) hide show
  1. package/dist/bin/.bundle-state.json +2 -2
  2. package/dist/bin/dvb.cjs +6 -6
  3. package/dist/bin/dvbd.cjs +6 -6
  4. package/package.json +7 -5
  5. package/dist/devbox/auth.d.ts +0 -22
  6. package/dist/devbox/auth.d.ts.map +0 -1
  7. package/dist/devbox/auth.js +0 -233
  8. package/dist/devbox/auth.js.map +0 -1
  9. package/dist/devbox/browser.d.ts +0 -19
  10. package/dist/devbox/browser.d.ts.map +0 -1
  11. package/dist/devbox/browser.js +0 -60
  12. package/dist/devbox/browser.js.map +0 -1
  13. package/dist/devbox/cli.d.ts +0 -7
  14. package/dist/devbox/cli.d.ts.map +0 -1
  15. package/dist/devbox/cli.js +0 -124
  16. package/dist/devbox/cli.js.map +0 -1
  17. package/dist/devbox/commandRegistry/args.d.ts +0 -18
  18. package/dist/devbox/commandRegistry/args.d.ts.map +0 -1
  19. package/dist/devbox/commandRegistry/args.js +0 -107
  20. package/dist/devbox/commandRegistry/args.js.map +0 -1
  21. package/dist/devbox/commandRegistry/catalog.d.ts +0 -4
  22. package/dist/devbox/commandRegistry/catalog.d.ts.map +0 -1
  23. package/dist/devbox/commandRegistry/catalog.js +0 -763
  24. package/dist/devbox/commandRegistry/catalog.js.map +0 -1
  25. package/dist/devbox/commandRegistry/dispatch.d.ts +0 -3
  26. package/dist/devbox/commandRegistry/dispatch.d.ts.map +0 -1
  27. package/dist/devbox/commandRegistry/dispatch.js +0 -61
  28. package/dist/devbox/commandRegistry/dispatch.js.map +0 -1
  29. package/dist/devbox/commandRegistry/errors.d.ts +0 -8
  30. package/dist/devbox/commandRegistry/errors.d.ts.map +0 -1
  31. package/dist/devbox/commandRegistry/errors.js +0 -26
  32. package/dist/devbox/commandRegistry/errors.js.map +0 -1
  33. package/dist/devbox/commandRegistry/help.d.ts +0 -5
  34. package/dist/devbox/commandRegistry/help.d.ts.map +0 -1
  35. package/dist/devbox/commandRegistry/help.js +0 -94
  36. package/dist/devbox/commandRegistry/help.js.map +0 -1
  37. package/dist/devbox/commandRegistry/resolve.d.ts +0 -7
  38. package/dist/devbox/commandRegistry/resolve.d.ts.map +0 -1
  39. package/dist/devbox/commandRegistry/resolve.js +0 -32
  40. package/dist/devbox/commandRegistry/resolve.js.map +0 -1
  41. package/dist/devbox/commandRegistry/tab.d.ts +0 -10
  42. package/dist/devbox/commandRegistry/tab.d.ts.map +0 -1
  43. package/dist/devbox/commandRegistry/tab.js +0 -83
  44. package/dist/devbox/commandRegistry/tab.js.map +0 -1
  45. package/dist/devbox/commandRegistry/types.d.ts +0 -32
  46. package/dist/devbox/commandRegistry/types.d.ts.map +0 -1
  47. package/dist/devbox/commandRegistry/types.js +0 -2
  48. package/dist/devbox/commandRegistry/types.js.map +0 -1
  49. package/dist/devbox/commands/agent.d.ts +0 -52
  50. package/dist/devbox/commands/agent.d.ts.map +0 -1
  51. package/dist/devbox/commands/agent.js +0 -397
  52. package/dist/devbox/commands/agent.js.map +0 -1
  53. package/dist/devbox/commands/boxSelect.d.ts +0 -25
  54. package/dist/devbox/commands/boxSelect.d.ts.map +0 -1
  55. package/dist/devbox/commands/boxSelect.js +0 -94
  56. package/dist/devbox/commands/boxSelect.js.map +0 -1
  57. package/dist/devbox/commands/checkpoint.d.ts +0 -9
  58. package/dist/devbox/commands/checkpoint.d.ts.map +0 -1
  59. package/dist/devbox/commands/checkpoint.js +0 -105
  60. package/dist/devbox/commands/checkpoint.js.map +0 -1
  61. package/dist/devbox/commands/commandProvider.d.ts +0 -33
  62. package/dist/devbox/commands/commandProvider.d.ts.map +0 -1
  63. package/dist/devbox/commands/commandProvider.js +0 -156
  64. package/dist/devbox/commands/commandProvider.js.map +0 -1
  65. package/dist/devbox/commands/connect.d.ts +0 -39
  66. package/dist/devbox/commands/connect.d.ts.map +0 -1
  67. package/dist/devbox/commands/connect.js +0 -1367
  68. package/dist/devbox/commands/connect.js.map +0 -1
  69. package/dist/devbox/commands/connectSessionMapping.d.ts +0 -64
  70. package/dist/devbox/commands/connectSessionMapping.d.ts.map +0 -1
  71. package/dist/devbox/commands/connectSessionMapping.js +0 -153
  72. package/dist/devbox/commands/connectSessionMapping.js.map +0 -1
  73. package/dist/devbox/commands/cp.d.ts +0 -60
  74. package/dist/devbox/commands/cp.d.ts.map +0 -1
  75. package/dist/devbox/commands/cp.js +0 -383
  76. package/dist/devbox/commands/cp.js.map +0 -1
  77. package/dist/devbox/commands/daemon.d.ts +0 -4
  78. package/dist/devbox/commands/daemon.d.ts.map +0 -1
  79. package/dist/devbox/commands/daemon.js +0 -49
  80. package/dist/devbox/commands/daemon.js.map +0 -1
  81. package/dist/devbox/commands/destroy.d.ts +0 -2
  82. package/dist/devbox/commands/destroy.d.ts.map +0 -1
  83. package/dist/devbox/commands/destroy.js +0 -204
  84. package/dist/devbox/commands/destroy.js.map +0 -1
  85. package/dist/devbox/commands/destroyE2b.d.ts +0 -22
  86. package/dist/devbox/commands/destroyE2b.d.ts.map +0 -1
  87. package/dist/devbox/commands/destroyE2b.js +0 -12
  88. package/dist/devbox/commands/destroyE2b.js.map +0 -1
  89. package/dist/devbox/commands/destroyLocalState.d.ts +0 -34
  90. package/dist/devbox/commands/destroyLocalState.d.ts.map +0 -1
  91. package/dist/devbox/commands/destroyLocalState.js +0 -187
  92. package/dist/devbox/commands/destroyLocalState.js.map +0 -1
  93. package/dist/devbox/commands/destroyModal.d.ts +0 -21
  94. package/dist/devbox/commands/destroyModal.d.ts.map +0 -1
  95. package/dist/devbox/commands/destroyModal.js +0 -13
  96. package/dist/devbox/commands/destroyModal.js.map +0 -1
  97. package/dist/devbox/commands/destroyShared.d.ts +0 -14
  98. package/dist/devbox/commands/destroyShared.d.ts.map +0 -1
  99. package/dist/devbox/commands/destroyShared.js +0 -37
  100. package/dist/devbox/commands/destroyShared.js.map +0 -1
  101. package/dist/devbox/commands/fork.d.ts +0 -9
  102. package/dist/devbox/commands/fork.d.ts.map +0 -1
  103. package/dist/devbox/commands/fork.js +0 -94
  104. package/dist/devbox/commands/fork.js.map +0 -1
  105. package/dist/devbox/commands/ide.d.ts +0 -35
  106. package/dist/devbox/commands/ide.d.ts.map +0 -1
  107. package/dist/devbox/commands/ide.js +0 -987
  108. package/dist/devbox/commands/ide.js.map +0 -1
  109. package/dist/devbox/commands/init/args.d.ts +0 -18
  110. package/dist/devbox/commands/init/args.d.ts.map +0 -1
  111. package/dist/devbox/commands/init/args.js +0 -44
  112. package/dist/devbox/commands/init/args.js.map +0 -1
  113. package/dist/devbox/commands/init/clack.d.ts +0 -22
  114. package/dist/devbox/commands/init/clack.d.ts.map +0 -1
  115. package/dist/devbox/commands/init/clack.js +0 -158
  116. package/dist/devbox/commands/init/clack.js.map +0 -1
  117. package/dist/devbox/commands/init/claudeBootstrap.d.ts +0 -49
  118. package/dist/devbox/commands/init/claudeBootstrap.d.ts.map +0 -1
  119. package/dist/devbox/commands/init/claudeBootstrap.js +0 -504
  120. package/dist/devbox/commands/init/claudeBootstrap.js.map +0 -1
  121. package/dist/devbox/commands/init/codex/artifacts.d.ts +0 -49
  122. package/dist/devbox/commands/init/codex/artifacts.d.ts.map +0 -1
  123. package/dist/devbox/commands/init/codex/artifacts.js +0 -278
  124. package/dist/devbox/commands/init/codex/artifacts.js.map +0 -1
  125. package/dist/devbox/commands/init/codex/config.d.ts +0 -6
  126. package/dist/devbox/commands/init/codex/config.d.ts.map +0 -1
  127. package/dist/devbox/commands/init/codex/config.js +0 -43
  128. package/dist/devbox/commands/init/codex/config.js.map +0 -1
  129. package/dist/devbox/commands/init/codex/events.d.ts +0 -14
  130. package/dist/devbox/commands/init/codex/events.d.ts.map +0 -1
  131. package/dist/devbox/commands/init/codex/events.js +0 -435
  132. package/dist/devbox/commands/init/codex/events.js.map +0 -1
  133. package/dist/devbox/commands/init/codex/execConfig.d.ts +0 -5
  134. package/dist/devbox/commands/init/codex/execConfig.d.ts.map +0 -1
  135. package/dist/devbox/commands/init/codex/execConfig.js +0 -10
  136. package/dist/devbox/commands/init/codex/execConfig.js.map +0 -1
  137. package/dist/devbox/commands/init/codex/index.d.ts +0 -136
  138. package/dist/devbox/commands/init/codex/index.d.ts.map +0 -1
  139. package/dist/devbox/commands/init/codex/index.js +0 -1115
  140. package/dist/devbox/commands/init/codex/index.js.map +0 -1
  141. package/dist/devbox/commands/init/codex/local.d.ts +0 -124
  142. package/dist/devbox/commands/init/codex/local.d.ts.map +0 -1
  143. package/dist/devbox/commands/init/codex/local.js +0 -1381
  144. package/dist/devbox/commands/init/codex/local.js.map +0 -1
  145. package/dist/devbox/commands/init/codex/localExecArgs.d.ts +0 -25
  146. package/dist/devbox/commands/init/codex/localExecArgs.d.ts.map +0 -1
  147. package/dist/devbox/commands/init/codex/localExecArgs.js +0 -48
  148. package/dist/devbox/commands/init/codex/localExecArgs.js.map +0 -1
  149. package/dist/devbox/commands/init/codex/plan.d.ts +0 -99
  150. package/dist/devbox/commands/init/codex/plan.d.ts.map +0 -1
  151. package/dist/devbox/commands/init/codex/plan.js +0 -231
  152. package/dist/devbox/commands/init/codex/plan.js.map +0 -1
  153. package/dist/devbox/commands/init/codex/prompts.d.ts +0 -9
  154. package/dist/devbox/commands/init/codex/prompts.d.ts.map +0 -1
  155. package/dist/devbox/commands/init/codex/prompts.js +0 -51
  156. package/dist/devbox/commands/init/codex/prompts.js.map +0 -1
  157. package/dist/devbox/commands/init/codex/proxy.d.ts +0 -10
  158. package/dist/devbox/commands/init/codex/proxy.d.ts.map +0 -1
  159. package/dist/devbox/commands/init/codex/proxy.js +0 -32
  160. package/dist/devbox/commands/init/codex/proxy.js.map +0 -1
  161. package/dist/devbox/commands/init/codex/remote.d.ts +0 -96
  162. package/dist/devbox/commands/init/codex/remote.d.ts.map +0 -1
  163. package/dist/devbox/commands/init/codex/remote.js +0 -927
  164. package/dist/devbox/commands/init/codex/remote.js.map +0 -1
  165. package/dist/devbox/commands/init/codex/retry.d.ts +0 -17
  166. package/dist/devbox/commands/init/codex/retry.d.ts.map +0 -1
  167. package/dist/devbox/commands/init/codex/retry.js +0 -17
  168. package/dist/devbox/commands/init/codex/retry.js.map +0 -1
  169. package/dist/devbox/commands/init/codex/scanStatus.d.ts +0 -5
  170. package/dist/devbox/commands/init/codex/scanStatus.d.ts.map +0 -1
  171. package/dist/devbox/commands/init/codex/scanStatus.js +0 -27
  172. package/dist/devbox/commands/init/codex/scanStatus.js.map +0 -1
  173. package/dist/devbox/commands/init/codex/shellHistory.d.ts +0 -39
  174. package/dist/devbox/commands/init/codex/shellHistory.d.ts.map +0 -1
  175. package/dist/devbox/commands/init/codex/shellHistory.js +0 -258
  176. package/dist/devbox/commands/init/codex/shellHistory.js.map +0 -1
  177. package/dist/devbox/commands/init/codex/template.d.ts +0 -3
  178. package/dist/devbox/commands/init/codex/template.d.ts.map +0 -1
  179. package/dist/devbox/commands/init/codex/template.js +0 -3
  180. package/dist/devbox/commands/init/codex/template.js.map +0 -1
  181. package/dist/devbox/commands/init/finalizeFlow.d.ts +0 -95
  182. package/dist/devbox/commands/init/finalizeFlow.d.ts.map +0 -1
  183. package/dist/devbox/commands/init/finalizeFlow.js +0 -786
  184. package/dist/devbox/commands/init/finalizeFlow.js.map +0 -1
  185. package/dist/devbox/commands/init/index.d.ts +0 -11
  186. package/dist/devbox/commands/init/index.d.ts.map +0 -1
  187. package/dist/devbox/commands/init/index.js +0 -1058
  188. package/dist/devbox/commands/init/index.js.map +0 -1
  189. package/dist/devbox/commands/init/modal.d.ts +0 -5
  190. package/dist/devbox/commands/init/modal.d.ts.map +0 -1
  191. package/dist/devbox/commands/init/modal.js +0 -4
  192. package/dist/devbox/commands/init/modal.js.map +0 -1
  193. package/dist/devbox/commands/init/packaging.d.ts +0 -5
  194. package/dist/devbox/commands/init/packaging.d.ts.map +0 -1
  195. package/dist/devbox/commands/init/packaging.js +0 -81
  196. package/dist/devbox/commands/init/packaging.js.map +0 -1
  197. package/dist/devbox/commands/init/progress.d.ts +0 -31
  198. package/dist/devbox/commands/init/progress.d.ts.map +0 -1
  199. package/dist/devbox/commands/init/progress.js +0 -205
  200. package/dist/devbox/commands/init/progress.js.map +0 -1
  201. package/dist/devbox/commands/init/provider/e2b.d.ts +0 -29
  202. package/dist/devbox/commands/init/provider/e2b.d.ts.map +0 -1
  203. package/dist/devbox/commands/init/provider/e2b.js +0 -130
  204. package/dist/devbox/commands/init/provider/e2b.js.map +0 -1
  205. package/dist/devbox/commands/init/provider/e2bRuntime.d.ts +0 -39
  206. package/dist/devbox/commands/init/provider/e2bRuntime.d.ts.map +0 -1
  207. package/dist/devbox/commands/init/provider/e2bRuntime.js +0 -679
  208. package/dist/devbox/commands/init/provider/e2bRuntime.js.map +0 -1
  209. package/dist/devbox/commands/init/provider/index.d.ts +0 -8
  210. package/dist/devbox/commands/init/provider/index.d.ts.map +0 -1
  211. package/dist/devbox/commands/init/provider/index.js +0 -5
  212. package/dist/devbox/commands/init/provider/index.js.map +0 -1
  213. package/dist/devbox/commands/init/provider/modal.d.ts +0 -34
  214. package/dist/devbox/commands/init/provider/modal.d.ts.map +0 -1
  215. package/dist/devbox/commands/init/provider/modal.js +0 -274
  216. package/dist/devbox/commands/init/provider/modal.js.map +0 -1
  217. package/dist/devbox/commands/init/provider/modalRuntime.d.ts +0 -3
  218. package/dist/devbox/commands/init/provider/modalRuntime.d.ts.map +0 -1
  219. package/dist/devbox/commands/init/provider/modalRuntime.js +0 -2
  220. package/dist/devbox/commands/init/provider/modalRuntime.js.map +0 -1
  221. package/dist/devbox/commands/init/provider/resolve.d.ts +0 -44
  222. package/dist/devbox/commands/init/provider/resolve.d.ts.map +0 -1
  223. package/dist/devbox/commands/init/provider/resolve.js +0 -172
  224. package/dist/devbox/commands/init/provider/resolve.js.map +0 -1
  225. package/dist/devbox/commands/init/provider/shared.d.ts +0 -10
  226. package/dist/devbox/commands/init/provider/shared.d.ts.map +0 -1
  227. package/dist/devbox/commands/init/provider/shared.js +0 -2
  228. package/dist/devbox/commands/init/provider/shared.js.map +0 -1
  229. package/dist/devbox/commands/init/provider/sprites.d.ts +0 -30
  230. package/dist/devbox/commands/init/provider/sprites.d.ts.map +0 -1
  231. package/dist/devbox/commands/init/provider/sprites.js +0 -183
  232. package/dist/devbox/commands/init/provider/sprites.js.map +0 -1
  233. package/dist/devbox/commands/init/provider/types.d.ts +0 -19
  234. package/dist/devbox/commands/init/provider/types.d.ts.map +0 -1
  235. package/dist/devbox/commands/init/provider/types.js +0 -2
  236. package/dist/devbox/commands/init/provider/types.js.map +0 -1
  237. package/dist/devbox/commands/init/provisionFlow.d.ts +0 -53
  238. package/dist/devbox/commands/init/provisionFlow.d.ts.map +0 -1
  239. package/dist/devbox/commands/init/provisionFlow.js +0 -541
  240. package/dist/devbox/commands/init/provisionFlow.js.map +0 -1
  241. package/dist/devbox/commands/init/registry.d.ts +0 -15
  242. package/dist/devbox/commands/init/registry.d.ts.map +0 -1
  243. package/dist/devbox/commands/init/registry.js +0 -38
  244. package/dist/devbox/commands/init/registry.js.map +0 -1
  245. package/dist/devbox/commands/init/remote.d.ts +0 -48
  246. package/dist/devbox/commands/init/remote.d.ts.map +0 -1
  247. package/dist/devbox/commands/init/remote.js +0 -766
  248. package/dist/devbox/commands/init/remote.js.map +0 -1
  249. package/dist/devbox/commands/init/repo.d.ts +0 -45
  250. package/dist/devbox/commands/init/repo.d.ts.map +0 -1
  251. package/dist/devbox/commands/init/repo.js +0 -235
  252. package/dist/devbox/commands/init/repo.js.map +0 -1
  253. package/dist/devbox/commands/init/retryableErrors.d.ts +0 -4
  254. package/dist/devbox/commands/init/retryableErrors.d.ts.map +0 -1
  255. package/dist/devbox/commands/init/retryableErrors.js +0 -42
  256. package/dist/devbox/commands/init/retryableErrors.js.map +0 -1
  257. package/dist/devbox/commands/init/scanProgress.d.ts +0 -18
  258. package/dist/devbox/commands/init/scanProgress.d.ts.map +0 -1
  259. package/dist/devbox/commands/init/scanProgress.js +0 -47
  260. package/dist/devbox/commands/init/scanProgress.js.map +0 -1
  261. package/dist/devbox/commands/init/session.d.ts +0 -72
  262. package/dist/devbox/commands/init/session.d.ts.map +0 -1
  263. package/dist/devbox/commands/init/session.js +0 -348
  264. package/dist/devbox/commands/init/session.js.map +0 -1
  265. package/dist/devbox/commands/init/setupArtifactsValidation.d.ts +0 -28
  266. package/dist/devbox/commands/init/setupArtifactsValidation.d.ts.map +0 -1
  267. package/dist/devbox/commands/init/setupArtifactsValidation.js +0 -113
  268. package/dist/devbox/commands/init/setupArtifactsValidation.js.map +0 -1
  269. package/dist/devbox/commands/init/setupPlanFlow.d.ts +0 -34
  270. package/dist/devbox/commands/init/setupPlanFlow.d.ts.map +0 -1
  271. package/dist/devbox/commands/init/setupPlanFlow.js +0 -967
  272. package/dist/devbox/commands/init/setupPlanFlow.js.map +0 -1
  273. package/dist/devbox/commands/init/ssh.d.ts +0 -19
  274. package/dist/devbox/commands/init/ssh.d.ts.map +0 -1
  275. package/dist/devbox/commands/init/ssh.js +0 -276
  276. package/dist/devbox/commands/init/ssh.js.map +0 -1
  277. package/dist/devbox/commands/init/state.d.ts +0 -73
  278. package/dist/devbox/commands/init/state.d.ts.map +0 -1
  279. package/dist/devbox/commands/init/state.js +0 -118
  280. package/dist/devbox/commands/init/state.js.map +0 -1
  281. package/dist/devbox/commands/init/statusFlow.d.ts +0 -27
  282. package/dist/devbox/commands/init/statusFlow.d.ts.map +0 -1
  283. package/dist/devbox/commands/init/statusFlow.js +0 -160
  284. package/dist/devbox/commands/init/statusFlow.js.map +0 -1
  285. package/dist/devbox/commands/list.d.ts +0 -35
  286. package/dist/devbox/commands/list.d.ts.map +0 -1
  287. package/dist/devbox/commands/list.js +0 -311
  288. package/dist/devbox/commands/list.js.map +0 -1
  289. package/dist/devbox/commands/listFormatting.d.ts +0 -27
  290. package/dist/devbox/commands/listFormatting.d.ts.map +0 -1
  291. package/dist/devbox/commands/listFormatting.js +0 -155
  292. package/dist/devbox/commands/listFormatting.js.map +0 -1
  293. package/dist/devbox/commands/logout.d.ts +0 -2
  294. package/dist/devbox/commands/logout.d.ts.map +0 -1
  295. package/dist/devbox/commands/logout.js +0 -64
  296. package/dist/devbox/commands/logout.js.map +0 -1
  297. package/dist/devbox/commands/managedProviderClient.d.ts +0 -24
  298. package/dist/devbox/commands/managedProviderClient.d.ts.map +0 -1
  299. package/dist/devbox/commands/managedProviderClient.js +0 -42
  300. package/dist/devbox/commands/managedProviderClient.js.map +0 -1
  301. package/dist/devbox/commands/managedProviderContext.d.ts +0 -34
  302. package/dist/devbox/commands/managedProviderContext.d.ts.map +0 -1
  303. package/dist/devbox/commands/managedProviderContext.js +0 -34
  304. package/dist/devbox/commands/managedProviderContext.js.map +0 -1
  305. package/dist/devbox/commands/mount.d.ts +0 -25
  306. package/dist/devbox/commands/mount.d.ts.map +0 -1
  307. package/dist/devbox/commands/mount.js +0 -200
  308. package/dist/devbox/commands/mount.js.map +0 -1
  309. package/dist/devbox/commands/ports.d.ts +0 -11
  310. package/dist/devbox/commands/ports.d.ts.map +0 -1
  311. package/dist/devbox/commands/ports.js +0 -183
  312. package/dist/devbox/commands/ports.js.map +0 -1
  313. package/dist/devbox/commands/power.d.ts +0 -10
  314. package/dist/devbox/commands/power.d.ts.map +0 -1
  315. package/dist/devbox/commands/power.js +0 -139
  316. package/dist/devbox/commands/power.js.map +0 -1
  317. package/dist/devbox/commands/provider/daemonRuntimeShared.d.ts +0 -25
  318. package/dist/devbox/commands/provider/daemonRuntimeShared.d.ts.map +0 -1
  319. package/dist/devbox/commands/provider/daemonRuntimeShared.js +0 -217
  320. package/dist/devbox/commands/provider/daemonRuntimeShared.js.map +0 -1
  321. package/dist/devbox/commands/provider/directDaemonRuntime.d.ts +0 -106
  322. package/dist/devbox/commands/provider/directDaemonRuntime.d.ts.map +0 -1
  323. package/dist/devbox/commands/provider/directDaemonRuntime.js +0 -1442
  324. package/dist/devbox/commands/provider/directDaemonRuntime.js.map +0 -1
  325. package/dist/devbox/commands/provider/e2bCommandContext.d.ts +0 -11
  326. package/dist/devbox/commands/provider/e2bCommandContext.d.ts.map +0 -1
  327. package/dist/devbox/commands/provider/e2bCommandContext.js +0 -16
  328. package/dist/devbox/commands/provider/e2bCommandContext.js.map +0 -1
  329. package/dist/devbox/commands/provider/e2bLifecycleShared.d.ts +0 -20
  330. package/dist/devbox/commands/provider/e2bLifecycleShared.d.ts.map +0 -1
  331. package/dist/devbox/commands/provider/e2bLifecycleShared.js +0 -42
  332. package/dist/devbox/commands/provider/e2bLifecycleShared.js.map +0 -1
  333. package/dist/devbox/commands/provider/modalCommandContext.d.ts +0 -22
  334. package/dist/devbox/commands/provider/modalCommandContext.d.ts.map +0 -1
  335. package/dist/devbox/commands/provider/modalCommandContext.js +0 -47
  336. package/dist/devbox/commands/provider/modalCommandContext.js.map +0 -1
  337. package/dist/devbox/commands/provider/modalLifecycle.d.ts +0 -158
  338. package/dist/devbox/commands/provider/modalLifecycle.d.ts.map +0 -1
  339. package/dist/devbox/commands/provider/modalLifecycle.js +0 -702
  340. package/dist/devbox/commands/provider/modalLifecycle.js.map +0 -1
  341. package/dist/devbox/commands/provider/modalRuntime.d.ts +0 -25
  342. package/dist/devbox/commands/provider/modalRuntime.d.ts.map +0 -1
  343. package/dist/devbox/commands/provider/modalRuntime.js +0 -791
  344. package/dist/devbox/commands/provider/modalRuntime.js.map +0 -1
  345. package/dist/devbox/commands/provider/runtimeTypes.d.ts +0 -8
  346. package/dist/devbox/commands/provider/runtimeTypes.d.ts.map +0 -1
  347. package/dist/devbox/commands/provider/runtimeTypes.js +0 -2
  348. package/dist/devbox/commands/provider/runtimeTypes.js.map +0 -1
  349. package/dist/devbox/commands/providerClient.d.ts +0 -82
  350. package/dist/devbox/commands/providerClient.d.ts.map +0 -1
  351. package/dist/devbox/commands/providerClient.js +0 -719
  352. package/dist/devbox/commands/providerClient.js.map +0 -1
  353. package/dist/devbox/commands/reboot.d.ts +0 -8
  354. package/dist/devbox/commands/reboot.d.ts.map +0 -1
  355. package/dist/devbox/commands/reboot.js +0 -100
  356. package/dist/devbox/commands/reboot.js.map +0 -1
  357. package/dist/devbox/commands/reset.d.ts +0 -30
  358. package/dist/devbox/commands/reset.d.ts.map +0 -1
  359. package/dist/devbox/commands/reset.js +0 -114
  360. package/dist/devbox/commands/reset.js.map +0 -1
  361. package/dist/devbox/commands/runtimeClient.d.ts +0 -65
  362. package/dist/devbox/commands/runtimeClient.d.ts.map +0 -1
  363. package/dist/devbox/commands/runtimeClient.js +0 -127
  364. package/dist/devbox/commands/runtimeClient.js.map +0 -1
  365. package/dist/devbox/commands/sentryTest.d.ts +0 -2
  366. package/dist/devbox/commands/sentryTest.d.ts.map +0 -1
  367. package/dist/devbox/commands/sentryTest.js +0 -117
  368. package/dist/devbox/commands/sentryTest.js.map +0 -1
  369. package/dist/devbox/commands/services.d.ts +0 -2
  370. package/dist/devbox/commands/services.d.ts.map +0 -1
  371. package/dist/devbox/commands/services.js +0 -619
  372. package/dist/devbox/commands/services.js.map +0 -1
  373. package/dist/devbox/commands/servicesConfig.d.ts +0 -19
  374. package/dist/devbox/commands/servicesConfig.d.ts.map +0 -1
  375. package/dist/devbox/commands/servicesConfig.js +0 -61
  376. package/dist/devbox/commands/servicesConfig.js.map +0 -1
  377. package/dist/devbox/commands/servicesToml.d.ts +0 -13
  378. package/dist/devbox/commands/servicesToml.d.ts.map +0 -1
  379. package/dist/devbox/commands/servicesToml.js +0 -201
  380. package/dist/devbox/commands/servicesToml.js.map +0 -1
  381. package/dist/devbox/commands/sessionUtils.d.ts +0 -10
  382. package/dist/devbox/commands/sessionUtils.d.ts.map +0 -1
  383. package/dist/devbox/commands/sessionUtils.js +0 -48
  384. package/dist/devbox/commands/sessionUtils.js.map +0 -1
  385. package/dist/devbox/commands/sessions.d.ts +0 -3
  386. package/dist/devbox/commands/sessions.d.ts.map +0 -1
  387. package/dist/devbox/commands/sessions.js +0 -490
  388. package/dist/devbox/commands/sessions.js.map +0 -1
  389. package/dist/devbox/commands/setup.d.ts +0 -36
  390. package/dist/devbox/commands/setup.d.ts.map +0 -1
  391. package/dist/devbox/commands/setup.js +0 -816
  392. package/dist/devbox/commands/setup.js.map +0 -1
  393. package/dist/devbox/commands/setupClaude.d.ts +0 -51
  394. package/dist/devbox/commands/setupClaude.d.ts.map +0 -1
  395. package/dist/devbox/commands/setupClaude.js +0 -202
  396. package/dist/devbox/commands/setupClaude.js.map +0 -1
  397. package/dist/devbox/commands/setupTooling.d.ts +0 -56
  398. package/dist/devbox/commands/setupTooling.d.ts.map +0 -1
  399. package/dist/devbox/commands/setupTooling.js +0 -187
  400. package/dist/devbox/commands/setupTooling.js.map +0 -1
  401. package/dist/devbox/commands/sshAccess.d.ts +0 -31
  402. package/dist/devbox/commands/sshAccess.d.ts.map +0 -1
  403. package/dist/devbox/commands/sshAccess.js +0 -353
  404. package/dist/devbox/commands/sshAccess.js.map +0 -1
  405. package/dist/devbox/commands/sshConfig.d.ts +0 -23
  406. package/dist/devbox/commands/sshConfig.d.ts.map +0 -1
  407. package/dist/devbox/commands/sshConfig.js +0 -366
  408. package/dist/devbox/commands/sshConfig.js.map +0 -1
  409. package/dist/devbox/commands/sshProxy.d.ts +0 -2
  410. package/dist/devbox/commands/sshProxy.d.ts.map +0 -1
  411. package/dist/devbox/commands/sshProxy.js +0 -215
  412. package/dist/devbox/commands/sshProxy.js.map +0 -1
  413. package/dist/devbox/commands/uninstall.d.ts +0 -2
  414. package/dist/devbox/commands/uninstall.d.ts.map +0 -1
  415. package/dist/devbox/commands/uninstall.js +0 -365
  416. package/dist/devbox/commands/uninstall.js.map +0 -1
  417. package/dist/devbox/commands/upgrade.d.ts +0 -14
  418. package/dist/devbox/commands/upgrade.d.ts.map +0 -1
  419. package/dist/devbox/commands/upgrade.js +0 -60
  420. package/dist/devbox/commands/upgrade.js.map +0 -1
  421. package/dist/devbox/commands/version.d.ts +0 -8
  422. package/dist/devbox/commands/version.d.ts.map +0 -1
  423. package/dist/devbox/commands/version.js +0 -134
  424. package/dist/devbox/commands/version.js.map +0 -1
  425. package/dist/devbox/commands/whoami.d.ts +0 -2
  426. package/dist/devbox/commands/whoami.d.ts.map +0 -1
  427. package/dist/devbox/commands/whoami.js +0 -114
  428. package/dist/devbox/commands/whoami.js.map +0 -1
  429. package/dist/devbox/completions/cache.d.ts +0 -53
  430. package/dist/devbox/completions/cache.d.ts.map +0 -1
  431. package/dist/devbox/completions/cache.js +0 -227
  432. package/dist/devbox/completions/cache.js.map +0 -1
  433. package/dist/devbox/completions/index.d.ts +0 -18
  434. package/dist/devbox/completions/index.d.ts.map +0 -1
  435. package/dist/devbox/completions/index.js +0 -759
  436. package/dist/devbox/completions/index.js.map +0 -1
  437. package/dist/devbox/controlPlane.d.ts +0 -460
  438. package/dist/devbox/controlPlane.d.ts.map +0 -1
  439. package/dist/devbox/controlPlane.js +0 -1910
  440. package/dist/devbox/controlPlane.js.map +0 -1
  441. package/dist/devbox/daemonClient.d.ts +0 -44
  442. package/dist/devbox/daemonClient.d.ts.map +0 -1
  443. package/dist/devbox/daemonClient.js +0 -677
  444. package/dist/devbox/daemonClient.js.map +0 -1
  445. package/dist/devbox/e2bExecErrors.d.ts +0 -11
  446. package/dist/devbox/e2bExecErrors.d.ts.map +0 -1
  447. package/dist/devbox/e2bExecErrors.js +0 -19
  448. package/dist/devbox/e2bExecErrors.js.map +0 -1
  449. package/dist/devbox/latency.d.ts +0 -25
  450. package/dist/devbox/latency.d.ts.map +0 -1
  451. package/dist/devbox/latency.js +0 -186
  452. package/dist/devbox/latency.js.map +0 -1
  453. package/dist/devbox/logger.d.ts +0 -2
  454. package/dist/devbox/logger.d.ts.map +0 -1
  455. package/dist/devbox/logger.js +0 -3
  456. package/dist/devbox/logger.js.map +0 -1
  457. package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.d.ts +0 -11
  458. package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.d.ts.map +0 -1
  459. package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.js +0 -118
  460. package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.js.map +0 -1
  461. package/dist/devbox/terminal/osc.d.ts +0 -11
  462. package/dist/devbox/terminal/osc.d.ts.map +0 -1
  463. package/dist/devbox/terminal/osc.js +0 -84
  464. package/dist/devbox/terminal/osc.js.map +0 -1
  465. package/dist/devbox/terminal/sessionProtocol.d.ts +0 -46
  466. package/dist/devbox/terminal/sessionProtocol.d.ts.map +0 -1
  467. package/dist/devbox/terminal/sessionProtocol.js +0 -631
  468. package/dist/devbox/terminal/sessionProtocol.js.map +0 -1
  469. package/dist/devbox/ui/colors.d.ts +0 -19
  470. package/dist/devbox/ui/colors.d.ts.map +0 -1
  471. package/dist/devbox/ui/colors.js +0 -22
  472. package/dist/devbox/ui/colors.js.map +0 -1
  473. package/dist/devbox/ui/copyableUrl.d.ts +0 -4
  474. package/dist/devbox/ui/copyableUrl.d.ts.map +0 -1
  475. package/dist/devbox/ui/copyableUrl.js +0 -10
  476. package/dist/devbox/ui/copyableUrl.js.map +0 -1
  477. package/dist/devbox/ui/qr.d.ts +0 -3
  478. package/dist/devbox/ui/qr.d.ts.map +0 -1
  479. package/dist/devbox/ui/qr.js +0 -17
  480. package/dist/devbox/ui/qr.js.map +0 -1
  481. package/dist/devbox/ui/statusLine.d.ts +0 -14
  482. package/dist/devbox/ui/statusLine.d.ts.map +0 -1
  483. package/dist/devbox/ui/statusLine.js +0 -92
  484. package/dist/devbox/ui/statusLine.js.map +0 -1
  485. package/dist/devbox/updateNotice.d.ts +0 -2
  486. package/dist/devbox/updateNotice.d.ts.map +0 -1
  487. package/dist/devbox/updateNotice.js +0 -43
  488. package/dist/devbox/updateNotice.js.map +0 -1
@@ -1,702 +0,0 @@
1
- import { resolveDevboxProfile, resolveModalClientCredentials, } from "@boxes-dev/core";
2
- import { createHash } from "node:crypto";
3
- import { AlreadyExistsError, ModalClient, NotFoundError } from "modal";
4
- import { findModalSandboxViaControlPlane, provisionModalSandboxViaControlPlane, terminateModalSandboxesByAliasViaControlPlane, } from "../../controlPlane.js";
5
- const DEFAULT_APP_NAME = "sandbox-modal-smoke";
6
- const DEFAULT_MODAL_ENVIRONMENT = "main";
7
- const DEFAULT_MODAL_DEVBOX_IMAGE = "public.ecr.aws/d8m4p4w9/modal-devbox:latest";
8
- const DEFAULT_TIMEOUT_MS = 24 * 60 * 60 * 1000;
9
- const IMAGE_TAG_RESOLUTION_CACHE_TTL_MS = 5 * 60 * 1000;
10
- const MODAL_SANDBOX_RUNNING_POLL_MS = 1_000;
11
- const SANDBOX_LIST_PAGE_LIMIT = 100;
12
- const MODAL_PID1_GUARD_PATH = "/usr/local/bin/pid1-guard";
13
- const MODAL_DAEMON_SUPERVISOR_PATH = "/opt/modal-devbox/modal-daemon-supervisor.sh";
14
- const MODAL_PLATFORM_VERSION_PATH = "/etc/modal-devbox/platform-version";
15
- const MODAL_BOOTSTRAP_CONTRACT_VERSION_PATH = "/etc/modal-devbox/bootstrap-contract-version";
16
- const CURRENT_MODAL_BOOTSTRAP_CONTRACT_VERSION = "2";
17
- const FINISHED_STATUS_LABELS = {
18
- 1: "success",
19
- 2: "failure",
20
- 3: "terminated",
21
- 4: "timeout",
22
- 5: "init_failure",
23
- 6: "internal_failure",
24
- 7: "idle_timeout",
25
- };
26
- const REGISTRY_MANIFEST_ACCEPT_HEADER = [
27
- "application/vnd.oci.image.index.v1+json",
28
- "application/vnd.oci.image.manifest.v1+json",
29
- "application/vnd.docker.distribution.manifest.list.v2+json",
30
- "application/vnd.docker.distribution.manifest.v2+json",
31
- ].join(", ");
32
- const resolvedImageTagCache = new Map();
33
- const shellQuote = (value) => `'${value.replace(/'/g, `'\\''`)}'`;
34
- const MODAL_DAEMON_SUPERVISOR_ENTRYPOINT = [
35
- MODAL_PID1_GUARD_PATH,
36
- MODAL_DAEMON_SUPERVISOR_PATH,
37
- ];
38
- const trimEnv = (value) => value?.trim() ?? "";
39
- const EMBEDDED_BUILD_PROFILE = resolveDevboxProfile();
40
- const resolveModalEnvironmentName = () => {
41
- // Production `dvb` builds are pinned to `main` regardless of runtime env.
42
- if (!EMBEDDED_BUILD_PROFILE) {
43
- return DEFAULT_MODAL_ENVIRONMENT;
44
- }
45
- return trimEnv(process.env.MODAL_ENVIRONMENT) || "dev";
46
- };
47
- const resolveConvexInstanceSeed = () => {
48
- const candidates = [
49
- trimEnv(process.env.DEVBOX_CONVEX_URL),
50
- trimEnv(process.env.CONVEX_CLOUD_URL),
51
- trimEnv(process.env.CONVEX_SITE_URL),
52
- ].filter((value) => value.length > 0);
53
- const raw = candidates[0];
54
- if (!raw) {
55
- return null;
56
- }
57
- let normalized = raw;
58
- if (normalized.startsWith("dev:")) {
59
- normalized = normalized.slice(4);
60
- }
61
- if (normalized.includes(".convex.site")) {
62
- normalized = normalized.replace(".convex.site", ".convex.cloud");
63
- }
64
- if (!normalized.startsWith("http://") && !normalized.startsWith("https://")) {
65
- normalized = `https://${normalized}`;
66
- }
67
- try {
68
- return new URL(normalized).host.toLowerCase();
69
- }
70
- catch {
71
- return normalized.toLowerCase();
72
- }
73
- };
74
- const resolveDevModalSandboxPrefix = () => {
75
- const seed = resolveConvexInstanceSeed();
76
- if (!seed) {
77
- throw new Error("Missing Convex deployment URL context for MODAL_ENVIRONMENT=dev. Set DEVBOX_CONVEX_URL or CONVEX_CLOUD_URL.");
78
- }
79
- return createHash("sha256").update(seed).digest("hex").slice(0, 8);
80
- };
81
- const resolveModalSandboxName = (alias, environmentName) => {
82
- const normalizedAlias = alias.trim();
83
- if (!normalizedAlias) {
84
- throw new Error("Modal alias is required.");
85
- }
86
- if (environmentName !== "dev") {
87
- return normalizedAlias;
88
- }
89
- return `${resolveDevModalSandboxPrefix()}-${normalizedAlias}`;
90
- };
91
- const parseRegistryImageTag = (imageTag) => {
92
- const trimmed = imageTag.trim();
93
- if (!trimmed || trimmed.includes("@")) {
94
- return null;
95
- }
96
- const lastSlashIndex = trimmed.lastIndexOf("/");
97
- const lastColonIndex = trimmed.lastIndexOf(":");
98
- if (lastColonIndex <= lastSlashIndex) {
99
- return null;
100
- }
101
- const repositoryWithHost = trimmed.slice(0, lastColonIndex);
102
- const tag = trimmed.slice(lastColonIndex + 1).trim();
103
- if (!repositoryWithHost || !tag) {
104
- return null;
105
- }
106
- const firstSlashIndex = repositoryWithHost.indexOf("/");
107
- if (firstSlashIndex <= 0) {
108
- return null;
109
- }
110
- const registryHost = repositoryWithHost.slice(0, firstSlashIndex);
111
- const repository = repositoryWithHost.slice(firstSlashIndex + 1);
112
- if (!repository) {
113
- return null;
114
- }
115
- const hasExplicitRegistryHost = registryHost.includes(".") ||
116
- registryHost.includes(":") ||
117
- registryHost === "localhost";
118
- if (!hasExplicitRegistryHost) {
119
- return null;
120
- }
121
- return {
122
- registryHost,
123
- repository,
124
- tag,
125
- repositoryWithHost,
126
- };
127
- };
128
- const parseWwwAuthenticateBearer = (headerValue) => {
129
- const trimmed = headerValue.trim();
130
- if (!trimmed.toLowerCase().startsWith("bearer ")) {
131
- return null;
132
- }
133
- const attributes = new Map();
134
- for (const match of trimmed
135
- .slice("bearer ".length)
136
- .matchAll(/([A-Za-z0-9_-]+)="([^"]*)"/g)) {
137
- const [, key, value] = match;
138
- if (!key) {
139
- continue;
140
- }
141
- attributes.set(key.toLowerCase(), value ?? "");
142
- }
143
- const realm = attributes.get("realm");
144
- const service = attributes.get("service");
145
- const scope = attributes.get("scope");
146
- if (!realm || !service) {
147
- return null;
148
- }
149
- return {
150
- realm,
151
- service,
152
- scope: scope || null,
153
- };
154
- };
155
- const fetchRegistryToken = async ({ realm, service, scope, }) => {
156
- const tokenUrl = new URL(realm);
157
- tokenUrl.searchParams.set("service", service);
158
- if (scope) {
159
- tokenUrl.searchParams.set("scope", scope);
160
- }
161
- const response = await fetch(tokenUrl.toString());
162
- if (!response.ok) {
163
- throw new Error(`Container registry auth token request failed (${response.status}).`);
164
- }
165
- const payload = (await response.json());
166
- const token = typeof payload.token === "string"
167
- ? payload.token.trim()
168
- : typeof payload.access_token === "string"
169
- ? payload.access_token.trim()
170
- : "";
171
- if (!token) {
172
- throw new Error("Container registry auth token response was empty.");
173
- }
174
- return token;
175
- };
176
- const resolveLatestImageTagToDigest = async (parsed) => {
177
- const manifestUrl = `https://${parsed.registryHost}/v2/${parsed.repository}/manifests/${encodeURIComponent(parsed.tag)}`;
178
- const fetchManifest = async ({ method, token, }) => {
179
- const headers = {
180
- Accept: REGISTRY_MANIFEST_ACCEPT_HEADER,
181
- };
182
- if (token) {
183
- headers.Authorization = `Bearer ${token}`;
184
- }
185
- return await fetch(manifestUrl, {
186
- headers,
187
- method,
188
- });
189
- };
190
- let token = null;
191
- let headResponse = await fetchManifest({ method: "HEAD" });
192
- if (headResponse.status === 401) {
193
- const authHeader = headResponse.headers.get("www-authenticate") ?? "";
194
- const challenge = parseWwwAuthenticateBearer(authHeader);
195
- if (!challenge) {
196
- throw new Error(`Container registry auth challenge missing or invalid for ${parsed.repositoryWithHost}:${parsed.tag}.`);
197
- }
198
- token = await fetchRegistryToken(challenge);
199
- headResponse = await fetchManifest({
200
- method: "HEAD",
201
- token,
202
- });
203
- }
204
- if (!headResponse.ok) {
205
- throw new Error(`Container registry manifest lookup failed for ${parsed.repositoryWithHost}:${parsed.tag} (${headResponse.status}).`);
206
- }
207
- const headDigest = headResponse.headers.get("docker-content-digest")?.trim();
208
- if (headDigest) {
209
- return `${parsed.repositoryWithHost}@${headDigest}`;
210
- }
211
- const getResponse = await fetchManifest(token
212
- ? {
213
- method: "GET",
214
- token,
215
- }
216
- : {
217
- method: "GET",
218
- });
219
- if (!getResponse.ok) {
220
- throw new Error(`Container registry manifest body lookup failed for ${parsed.repositoryWithHost}:${parsed.tag} (${getResponse.status}).`);
221
- }
222
- const headerDigest = getResponse.headers.get("docker-content-digest")?.trim();
223
- if (headerDigest) {
224
- return `${parsed.repositoryWithHost}@${headerDigest}`;
225
- }
226
- const manifestBytes = Buffer.from(await getResponse.arrayBuffer());
227
- const bodyDigest = `sha256:${createHash("sha256").update(manifestBytes).digest("hex")}`;
228
- return `${parsed.repositoryWithHost}@${bodyDigest}`;
229
- };
230
- const resolveImageTagForBuild = async (imageTag) => {
231
- const parsed = parseRegistryImageTag(imageTag);
232
- if (!parsed || parsed.tag !== "latest") {
233
- return imageTag;
234
- }
235
- const cacheKey = `${parsed.repositoryWithHost}:${parsed.tag}`;
236
- const now = Date.now();
237
- const cached = resolvedImageTagCache.get(cacheKey);
238
- if (cached && cached.expiresAt > now) {
239
- return cached.value;
240
- }
241
- const resolved = await resolveLatestImageTagToDigest(parsed);
242
- resolvedImageTagCache.set(cacheKey, {
243
- value: resolved,
244
- expiresAt: now + IMAGE_TAG_RESOLUTION_CACHE_TTL_MS,
245
- });
246
- return resolved;
247
- };
248
- const decodeJwtExpMs = (token) => {
249
- const segments = token.split(".");
250
- if (segments.length < 2)
251
- return null;
252
- const payload = segments[1];
253
- if (!payload)
254
- return null;
255
- const normalized = payload.replace(/-/g, "+").replace(/_/g, "/");
256
- const padLength = (4 - (normalized.length % 4)) % 4;
257
- const padded = `${normalized}${"=".repeat(padLength)}`;
258
- try {
259
- const parsed = JSON.parse(Buffer.from(padded, "base64").toString("utf8"));
260
- const exp = parsed.exp;
261
- if (typeof exp !== "number" || !Number.isFinite(exp) || exp <= 0) {
262
- return null;
263
- }
264
- return Math.floor(exp * 1000);
265
- }
266
- catch {
267
- return null;
268
- }
269
- };
270
- const createSafeModalAuthTokenManager = (modal) => {
271
- let token = "";
272
- let tokenExpMs = 0;
273
- let inFlight = null;
274
- const TOKEN_REFRESH_SKEW_MS = 30_000;
275
- const FALLBACK_TOKEN_TTL_MS = 15 * 60 * 1000;
276
- const hasFreshToken = () => token.length > 0 && Date.now() + TOKEN_REFRESH_SKEW_MS < tokenExpMs;
277
- const fetchToken = async () => {
278
- const authTokenGet = modal.cpClient.authTokenGet;
279
- if (typeof authTokenGet !== "function") {
280
- throw new Error("Modal auth token endpoint unavailable.");
281
- }
282
- const response = await authTokenGet({});
283
- const nextToken = typeof response?.token === "string" ? response.token.trim() : "";
284
- if (!nextToken) {
285
- throw new Error("Modal auth token unavailable.");
286
- }
287
- token = nextToken;
288
- tokenExpMs =
289
- decodeJwtExpMs(nextToken) ?? Date.now() + FALLBACK_TOKEN_TTL_MS;
290
- return nextToken;
291
- };
292
- return {
293
- start: () => { },
294
- stop: () => {
295
- token = "";
296
- tokenExpMs = 0;
297
- inFlight = null;
298
- },
299
- getToken: async () => {
300
- if (hasFreshToken())
301
- return token;
302
- if (!inFlight) {
303
- inFlight = fetchToken().finally(() => {
304
- inFlight = null;
305
- });
306
- }
307
- return await inFlight;
308
- },
309
- };
310
- };
311
- const installSafeModalAuthTokenManager = (modal) => {
312
- const candidate = modal;
313
- if (candidate.authTokenManager)
314
- return;
315
- candidate.authTokenManager = createSafeModalAuthTokenManager(candidate);
316
- };
317
- const normalizeModalVersion = (value) => {
318
- if (typeof value !== "string") {
319
- return null;
320
- }
321
- const trimmed = value.trim();
322
- return trimmed.length > 0 ? trimmed : null;
323
- };
324
- const parseModalPlatformState = (stdout) => {
325
- const values = new Map();
326
- for (const rawLine of stdout.split(/\r?\n/)) {
327
- const line = rawLine.trim();
328
- if (!line) {
329
- continue;
330
- }
331
- const separatorIndex = line.indexOf("=");
332
- if (separatorIndex <= 0) {
333
- continue;
334
- }
335
- values.set(line.slice(0, separatorIndex).trim(), line.slice(separatorIndex + 1).trim());
336
- }
337
- return {
338
- platformVersion: normalizeModalVersion(values.get("platform_version")),
339
- bootstrapContractVersion: normalizeModalVersion(values.get("bootstrap_contract_version")),
340
- };
341
- };
342
- const isSandboxRunning = (runtime) => (runtime?.result?.status ?? 0) === 0;
343
- const isSandboxTerminal = (runtime) => {
344
- const statusCode = runtime?.result?.status;
345
- return (typeof statusCode === "number" &&
346
- statusCode !== 0 &&
347
- Object.prototype.hasOwnProperty.call(FINISHED_STATUS_LABELS, statusCode));
348
- };
349
- const sleepMs = (ms) => new Promise((resolve) => {
350
- setTimeout(resolve, ms);
351
- });
352
- const formatRuntimeResult = (runtime) => {
353
- const statusCode = runtime?.result?.status;
354
- const exitCode = runtime?.result?.exitcode;
355
- const statusLabel = typeof statusCode === "number"
356
- ? (FINISHED_STATUS_LABELS[statusCode] ?? String(statusCode))
357
- : "unknown";
358
- const exitLabel = typeof exitCode === "number" ? String(exitCode) : "unknown";
359
- return `status=${statusLabel}, exit=${exitLabel}`;
360
- };
361
- const waitForSandboxRunning = async ({ modal, sandboxId, timeoutSeconds, context, }) => {
362
- const deadline = Date.now() + timeoutSeconds * 1_000;
363
- let lastRuntime;
364
- while (true) {
365
- // Modal returns the current state immediately for timeout=0, while positive
366
- // timeouts can block until the timeout expires even if the sandbox is
367
- // already running.
368
- const runtime = await modal.cpClient.sandboxWait({
369
- sandboxId,
370
- timeout: 0,
371
- });
372
- lastRuntime = runtime;
373
- if (isSandboxRunning(runtime)) {
374
- return;
375
- }
376
- if (isSandboxTerminal(runtime) || Date.now() >= deadline) {
377
- throw new Error(`Modal sandbox ${sandboxId} was not running after ${context} (${formatRuntimeResult(lastRuntime)}).`);
378
- }
379
- await sleepMs(MODAL_SANDBOX_RUNNING_POLL_MS);
380
- }
381
- };
382
- const readModalPlatformStateFromSandbox = async (modal, sandboxId) => {
383
- if (!modal.sandboxes) {
384
- return {
385
- platformVersion: null,
386
- bootstrapContractVersion: CURRENT_MODAL_BOOTSTRAP_CONTRACT_VERSION,
387
- };
388
- }
389
- const sandbox = await modal.sandboxes.fromId(sandboxId);
390
- const script = [
391
- "set -euo pipefail",
392
- `platform_version=""`,
393
- `if [ -r ${shellQuote(MODAL_PLATFORM_VERSION_PATH)} ]; then`,
394
- ` platform_version="$(head -n 1 ${shellQuote(MODAL_PLATFORM_VERSION_PATH)} | tr -d '\\r')"`,
395
- "fi",
396
- `bootstrap_contract_version=""`,
397
- `if [ -r ${shellQuote(MODAL_BOOTSTRAP_CONTRACT_VERSION_PATH)} ]; then`,
398
- ` bootstrap_contract_version="$(head -n 1 ${shellQuote(MODAL_BOOTSTRAP_CONTRACT_VERSION_PATH)} | tr -d '\\r')"`,
399
- "fi",
400
- 'printf "platform_version=%s\\n" "$platform_version"',
401
- 'printf "bootstrap_contract_version=%s\\n" "$bootstrap_contract_version"',
402
- ].join("\n");
403
- const process = await sandbox.exec(["/bin/bash", "-lc", script], {
404
- mode: "text",
405
- stdout: "pipe",
406
- stderr: "pipe",
407
- timeoutMs: 60_000,
408
- });
409
- const [exitCode, stdout, stderr] = await Promise.all([
410
- process.wait(),
411
- process.stdout.readText(),
412
- process.stderr.readText(),
413
- ]);
414
- if (exitCode !== 0) {
415
- const detail = stderr.trim() || stdout.trim() || `exit=${exitCode}`;
416
- throw new Error(`Failed to read Modal platform state: ${detail}`);
417
- }
418
- const platformState = parseModalPlatformState(stdout);
419
- return {
420
- platformVersion: platformState.platformVersion,
421
- bootstrapContractVersion: platformState.bootstrapContractVersion ??
422
- CURRENT_MODAL_BOOTSTRAP_CONTRACT_VERSION,
423
- };
424
- };
425
- const parsePositiveInt = (value, fallback) => {
426
- const parsed = Number.parseInt(value, 10);
427
- if (!Number.isFinite(parsed) || parsed <= 0)
428
- return fallback;
429
- return parsed;
430
- };
431
- const resolveRegions = () => {
432
- const raw = trimEnv(process.env.MODAL_SANDBOX_REGION);
433
- if (!raw)
434
- return [];
435
- return raw
436
- .split(",")
437
- .map((value) => value.trim())
438
- .filter((value) => value.length > 0);
439
- };
440
- const resolveAppName = () => trimEnv(process.env.MODAL_SANDBOX_APP) || DEFAULT_APP_NAME;
441
- const resolveModalSandboxTimeoutMs = () => parsePositiveInt(trimEnv(process.env.MODAL_SANDBOX_TIMEOUT_MS), DEFAULT_TIMEOUT_MS);
442
- const isNotFoundError = (error) => error instanceof NotFoundError;
443
- const isModalAlreadyExistsError = (error) => {
444
- if (error instanceof AlreadyExistsError) {
445
- return true;
446
- }
447
- const message = error instanceof Error
448
- ? `${error.name} ${error.message}`
449
- : String(error ?? "");
450
- if (/\bALREADY_EXISTS\b/i.test(message)) {
451
- return true;
452
- }
453
- return /already exists/i.test(message);
454
- };
455
- const trimToNull = (value) => {
456
- if (typeof value !== "string")
457
- return null;
458
- const trimmed = value.trim();
459
- return trimmed.length > 0 ? trimmed : null;
460
- };
461
- const resolveControlPlaneToken = (options) => trimToNull(options?.credentials?.controlPlaneToken);
462
- const hasContextModalCredentialPair = (options) => Boolean(trimToNull(options?.credentials?.modalTokenId) &&
463
- trimToNull(options?.credentials?.modalTokenSecret));
464
- const shouldUseControlPlaneFallback = (options) => !options?.client &&
465
- Boolean(resolveControlPlaneToken(options)) &&
466
- !hasContextModalCredentialPair(options);
467
- const withModalClient = async (options, fn) => {
468
- if (options?.client) {
469
- return await fn(options.client);
470
- }
471
- const modalCredentials = resolveModalClientCredentials({
472
- ...(options?.credentialMode
473
- ? { credentialMode: options.credentialMode }
474
- : {}),
475
- ...(options?.credentials !== undefined
476
- ? { credentials: options.credentials }
477
- : {}),
478
- ...(options?.cwd ? { cwd: options.cwd } : {}),
479
- });
480
- const modal = new ModalClient({
481
- tokenId: modalCredentials.tokenId,
482
- tokenSecret: modalCredentials.tokenSecret,
483
- environment: resolveModalEnvironmentName(),
484
- });
485
- installSafeModalAuthTokenManager(modal);
486
- try {
487
- return await fn(modal);
488
- }
489
- finally {
490
- modal.close();
491
- }
492
- };
493
- const resolveModalApp = async (modal, appName, createIfMissing) => {
494
- try {
495
- const app = await modal.apps.fromName(appName, { createIfMissing });
496
- return { appId: app.appId, appName };
497
- }
498
- catch (error) {
499
- if (!createIfMissing && isNotFoundError(error)) {
500
- return null;
501
- }
502
- throw error;
503
- }
504
- };
505
- const listSandboxesRaw = async (modal, appId, includeFinished) => {
506
- const sandboxes = [];
507
- let beforeTimestamp = 0;
508
- let guard = 0;
509
- while (true) {
510
- guard += 1;
511
- if (guard > SANDBOX_LIST_PAGE_LIMIT) {
512
- throw new Error("Modal sandbox list pagination exceeded safety limit.");
513
- }
514
- const response = await modal.cpClient.sandboxList({
515
- appId,
516
- beforeTimestamp,
517
- environmentName: modal.environmentName(),
518
- includeFinished,
519
- tags: [],
520
- });
521
- if (!response.sandboxes.length)
522
- break;
523
- sandboxes.push(...response.sandboxes);
524
- const nextCursor = response.sandboxes[response.sandboxes.length - 1];
525
- if (!nextCursor || nextCursor.createdAt === beforeTimestamp)
526
- break;
527
- beforeTimestamp = nextCursor.createdAt;
528
- }
529
- return sandboxes;
530
- };
531
- const formatSandboxStatus = (sandbox) => {
532
- const result = sandbox.taskInfo?.result;
533
- const status = result?.status ?? 0;
534
- if (status === 0)
535
- return "running";
536
- const label = FINISHED_STATUS_LABELS[status] ?? String(status);
537
- const exitCode = result?.exitcode ?? "unknown";
538
- return `finished:${label}:exit=${String(exitCode)}`;
539
- };
540
- const isRunningSandbox = (sandbox) => (sandbox.taskInfo?.result?.status ?? 0) === 0;
541
- const resolveImageFromTag = async (modal, imageTag) => {
542
- const secretName = trimEnv(process.env.MODAL_SANDBOX_IMAGE_SECRET);
543
- if (!secretName) {
544
- return modal.images.fromRegistry(imageTag);
545
- }
546
- const secret = await modal.secrets.fromName(secretName);
547
- if (imageTag.includes(".dkr.ecr.")) {
548
- return modal.images.fromAwsEcr(imageTag, secret);
549
- }
550
- return modal.images.fromRegistry(imageTag, secret);
551
- };
552
- const provisionModalSandbox = async (alias, options) => {
553
- if (shouldUseControlPlaneFallback(options)) {
554
- const controlPlaneToken = resolveControlPlaneToken(options);
555
- if (!controlPlaneToken) {
556
- throw new Error("Control plane token is required for modal provisioning.");
557
- }
558
- return await provisionModalSandboxViaControlPlane(controlPlaneToken, alias);
559
- }
560
- const appName = resolveAppName();
561
- const envImageTag = trimEnv(process.env.MODAL_SANDBOX_IMAGE);
562
- const imageTag = envImageTag || DEFAULT_MODAL_DEVBOX_IMAGE;
563
- const resolvedImageTag = await resolveImageTagForBuild(imageTag);
564
- const timeoutMs = resolveModalSandboxTimeoutMs();
565
- const timeoutSecs = Math.max(1, Math.floor(timeoutMs / 1000));
566
- const regions = resolveRegions();
567
- return await withModalClient(options, async (modal) => {
568
- const sandboxName = resolveModalSandboxName(alias, modal.environmentName());
569
- const app = await resolveModalApp(modal, appName, true);
570
- if (!app) {
571
- throw new Error(`Could not resolve Modal app "${appName}".`);
572
- }
573
- const buildImage = async (tag) => {
574
- const image = await resolveImageFromTag(modal, tag);
575
- return await image.build({ appId: app.appId });
576
- };
577
- const builtImage = await buildImage(resolvedImageTag);
578
- const createResponse = await modal.cpClient.sandboxCreate({
579
- appId: app.appId,
580
- definition: {
581
- imageId: builtImage.imageId,
582
- timeoutSecs,
583
- name: sandboxName,
584
- ...(regions.length > 0 ? { schedulerPlacement: { regions } } : {}),
585
- entrypointArgs: MODAL_DAEMON_SUPERVISOR_ENTRYPOINT,
586
- enableSnapshot: true,
587
- },
588
- });
589
- const sandboxId = typeof createResponse.sandboxId === "string"
590
- ? createResponse.sandboxId.trim()
591
- : "";
592
- if (!sandboxId) {
593
- throw new Error("Modal sandbox create response is missing sandbox id.");
594
- }
595
- await waitForSandboxRunning({
596
- modal,
597
- sandboxId,
598
- timeoutSeconds: 120,
599
- context: "fresh Modal sandbox provision",
600
- });
601
- const platformState = await readModalPlatformStateFromSandbox(modal, sandboxId);
602
- return {
603
- sandboxId,
604
- appId: app.appId,
605
- appName,
606
- imageTag: resolvedImageTag,
607
- timeoutMs,
608
- memorySnapshotEnabled: false,
609
- regions,
610
- platformVersion: platformState.platformVersion,
611
- bootstrapContractVersion: platformState.bootstrapContractVersion,
612
- };
613
- });
614
- };
615
- const findModalSandbox = async (options, operationOptions) => {
616
- if (shouldUseControlPlaneFallback(operationOptions)) {
617
- const controlPlaneToken = resolveControlPlaneToken(operationOptions);
618
- if (!controlPlaneToken) {
619
- throw new Error("Control plane token is required for modal sandbox lookup.");
620
- }
621
- return await findModalSandboxViaControlPlane(controlPlaneToken, options);
622
- }
623
- const appName = resolveAppName();
624
- const includeFinished = options.includeFinished ?? true;
625
- return await withModalClient(operationOptions, async (modal) => {
626
- const sandboxName = resolveModalSandboxName(options.alias, modal.environmentName());
627
- const app = await resolveModalApp(modal, appName, false);
628
- if (!app)
629
- return null;
630
- const sandboxes = await listSandboxesRaw(modal, app.appId, includeFinished);
631
- const matching = sandboxes.filter((sandbox) => {
632
- if (options.sandboxId && sandbox.id === options.sandboxId)
633
- return true;
634
- return sandbox.name === sandboxName;
635
- });
636
- if (matching.length === 0)
637
- return null;
638
- matching.sort((left, right) => {
639
- const runningOrder = Number(isRunningSandbox(right)) - Number(isRunningSandbox(left));
640
- if (runningOrder !== 0)
641
- return runningOrder;
642
- return right.createdAt - left.createdAt;
643
- });
644
- const selected = matching[0];
645
- if (!selected) {
646
- throw new Error("Modal sandbox selection failed.");
647
- }
648
- return {
649
- sandboxId: selected.id,
650
- appId: app.appId,
651
- appName: app.appName,
652
- name: options.alias,
653
- createdAt: selected.createdAt,
654
- status: formatSandboxStatus(selected),
655
- regions: selected.regions,
656
- };
657
- });
658
- };
659
- const terminateModalSandboxesByAlias = async (alias, options) => {
660
- if (shouldUseControlPlaneFallback(options)) {
661
- const controlPlaneToken = resolveControlPlaneToken(options);
662
- if (!controlPlaneToken) {
663
- throw new Error("Control plane token is required for modal sandbox termination.");
664
- }
665
- return await terminateModalSandboxesByAliasViaControlPlane(controlPlaneToken, {
666
- alias,
667
- ...(typeof options?.includeFinished === "boolean"
668
- ? { includeFinished: options.includeFinished }
669
- : {}),
670
- });
671
- }
672
- const appName = resolveAppName();
673
- const includeFinished = options?.includeFinished ?? false;
674
- return await withModalClient(options, async (modal) => {
675
- const sandboxName = resolveModalSandboxName(alias, modal.environmentName());
676
- const app = await resolveModalApp(modal, appName, false);
677
- if (!app) {
678
- return {
679
- appName,
680
- appId: null,
681
- matchedSandboxIds: [],
682
- terminatedSandboxIds: [],
683
- };
684
- }
685
- const sandboxes = await listSandboxesRaw(modal, app.appId, includeFinished);
686
- const matching = sandboxes.filter((sandbox) => sandbox.name === sandboxName);
687
- const terminatedSandboxIds = [];
688
- for (const sandbox of matching) {
689
- await modal.cpClient.sandboxTerminate({ sandboxId: sandbox.id });
690
- terminatedSandboxIds.push(sandbox.id);
691
- }
692
- return {
693
- appName: app.appName,
694
- appId: app.appId,
695
- matchedSandboxIds: matching.map((sandbox) => sandbox.id),
696
- terminatedSandboxIds,
697
- };
698
- });
699
- };
700
- export { provisionModalSandbox };
701
- export { findModalSandbox, isModalAlreadyExistsError, resolveModalEnvironmentName, resolveModalSandboxName, resolveModalSandboxTimeoutMs, terminateModalSandboxesByAlias, };
702
- //# sourceMappingURL=modalLifecycle.js.map