@boxes-dev/dvb-runtime 1.0.297 → 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,791 +0,0 @@
1
- import { createHash, randomUUID } from "node:crypto";
2
- import path from "node:path";
3
- import { ModalClient, NotFoundError } from "modal";
4
- import { createLogger, ProviderClientError, SpritesApiError, resolveModalClientCredentials, withDevboxSpan, } from "@boxes-dev/core";
5
- import { resolveModalEnvironmentName, resolveModalSandboxName, } from "./modalLifecycle.js";
6
- import { CORE_SERVICE_NAMES, mapDaemonControlSessionRecord, mapProviderServiceRecord, mapProviderServiceRecordToSpriteService, parseDaemonControlError, validateManagedServiceName, withTimeout, } from "./daemonRuntimeShared.js";
7
- import { DirectDaemonExecSocket, runDirectDaemonControlRequest, } from "./directDaemonRuntime.js";
8
- const MODAL_DAEMON_REQUEST_TIMEOUT_MS = 15_000;
9
- const MODAL_DAEMON_REQUEST_TIMEOUT_MAX_MS = 120_000;
10
- const MODAL_SANDBOX_RESOLVE_TIMEOUT_MS = 30_000;
11
- const MODAL_DAEMON_FS_WRITE_MAX_RAW_BYTES = 1 * 1024 * 1024;
12
- // Keep direct Modal control frames comfortably below the transport ceiling.
13
- const MODAL_DAEMON_FS_WRITE_FRAME_MAX_BYTES = 3 * 1024 * 1024;
14
- const MODAL_DAEMON_REQUEST_ID_PLACEHOLDER = "0".repeat(32);
15
- const MODAL_DAEMON_MULTIPART_WRITE_CONCURRENCY = 1;
16
- const MODAL_DAEMON_WRITE_TIMEOUT_BASE_MS = 5_000;
17
- const MODAL_DAEMON_WRITE_TIMEOUT_PER_MIB_MS = 2_000;
18
- const MODAL_DAEMON_MULTIPART_ASSEMBLE_MIN_TIMEOUT_MS = 30_000;
19
- const logger = createLogger("modal_runtime");
20
- const isSandboxNotFoundError = (error) => error instanceof NotFoundError;
21
- const shellQuote = (value) => `'${value.replace(/'/g, `'\\''`)}'`;
22
- const clampModalControlTimeoutMs = (timeoutMs) => {
23
- if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
24
- return MODAL_DAEMON_REQUEST_TIMEOUT_MS;
25
- }
26
- return Math.min(Math.max(Math.ceil(timeoutMs), MODAL_DAEMON_REQUEST_TIMEOUT_MS), MODAL_DAEMON_REQUEST_TIMEOUT_MAX_MS);
27
- };
28
- const sha256Hex = (data) => createHash("sha256").update(data).digest("hex");
29
- const estimateBase64EncodedByteLength = (bytes) => Math.ceil(bytes / 3) * 4;
30
- const estimateModalFsWriteControlMessageBytes = (remotePath, bytes) => {
31
- const overhead = Buffer.byteLength(JSON.stringify({
32
- type: "fs_write",
33
- path: remotePath,
34
- mkdir: true,
35
- requestId: MODAL_DAEMON_REQUEST_ID_PLACEHOLDER,
36
- data: "",
37
- }), "utf8");
38
- return overhead + estimateBase64EncodedByteLength(bytes);
39
- };
40
- const resolveMaxModalFsWriteBytes = (remotePath) => {
41
- const overhead = estimateModalFsWriteControlMessageBytes(remotePath, 0);
42
- const remainingBytes = MODAL_DAEMON_FS_WRITE_FRAME_MAX_BYTES - overhead;
43
- if (remainingBytes <= 0) {
44
- throw new Error(`Modal fs_write path exceeds the control frame budget: ${remotePath}`);
45
- }
46
- return Math.max(1, Math.min(MODAL_DAEMON_FS_WRITE_MAX_RAW_BYTES, Math.floor(remainingBytes / 4) * 3));
47
- };
48
- const shouldChunkModalFsWrite = (remotePath, bytes) => bytes > resolveMaxModalFsWriteBytes(remotePath);
49
- const estimateModalWriteTimeoutMs = (bytes) => {
50
- const wholeMiB = Math.max(1, Math.ceil(bytes / (1024 * 1024)));
51
- return clampModalControlTimeoutMs(MODAL_DAEMON_WRITE_TIMEOUT_BASE_MS +
52
- wholeMiB * MODAL_DAEMON_WRITE_TIMEOUT_PER_MIB_MS);
53
- };
54
- const normalizeConcurrency = (concurrency) => Math.max(1, Math.floor(concurrency));
55
- const resolveBoundedConcurrency = (itemCount, concurrency) => Math.max(1, Math.min(itemCount, normalizeConcurrency(concurrency)));
56
- const estimateModalMultipartPartTimeoutMs = (bytes, concurrency) => estimateModalWriteTimeoutMs(bytes * normalizeConcurrency(concurrency));
57
- const estimateModalMultipartAssembleTimeoutMs = (bytes) => clampModalControlTimeoutMs(Math.max(MODAL_DAEMON_MULTIPART_ASSEMBLE_MIN_TIMEOUT_MS, estimateModalWriteTimeoutMs(bytes) * 2));
58
- const buildModalMultipartWritePlan = (remotePath, data) => {
59
- const normalizedRemotePath = path.posix.normalize(remotePath);
60
- const remoteDir = path.posix.dirname(normalizedRemotePath);
61
- const remoteBaseName = path.posix.basename(normalizedRemotePath);
62
- const uploadId = randomUUID();
63
- const partDir = path.posix.join(remoteDir, `.${remoteBaseName}.tmp-upload-${uploadId}`);
64
- const assembledTmpPath = path.posix.join(remoteDir, `.${remoteBaseName}.tmp-assemble-${uploadId}`);
65
- const partSizeLimitBytes = resolveMaxModalFsWriteBytes(path.posix.join(partDir, "part-00000"));
66
- const parts = [];
67
- for (let offset = 0, index = 0; offset < data.length; index += 1) {
68
- const nextOffset = Math.min(offset + partSizeLimitBytes, data.length);
69
- const partData = data.subarray(offset, nextOffset);
70
- parts.push({
71
- index,
72
- remotePath: path.posix.join(partDir, `part-${String(index).padStart(5, "0")}`),
73
- data: partData,
74
- sizeBytes: partData.length,
75
- sha256: sha256Hex(partData),
76
- });
77
- offset = nextOffset;
78
- }
79
- return {
80
- partDir,
81
- assembledTmpPath,
82
- expectedSizeBytes: data.length,
83
- expectedSha256: sha256Hex(data),
84
- partSizeLimitBytes,
85
- parts,
86
- };
87
- };
88
- const buildModalMultipartAssembleScript = (remotePath, plan) => [
89
- "set -euo pipefail",
90
- `target=${shellQuote(path.posix.normalize(remotePath))}`,
91
- `part_dir=${shellQuote(plan.partDir)}`,
92
- `assembled_tmp=${shellQuote(plan.assembledTmpPath)}`,
93
- `expected_size=${plan.expectedSizeBytes}`,
94
- `expected_sha=${shellQuote(plan.expectedSha256)}`,
95
- "hash_file() {",
96
- " if command -v sha256sum >/dev/null 2>&1; then",
97
- " sha256sum \"$1\" | awk '{print $1}'",
98
- " return 0",
99
- " fi",
100
- " if command -v shasum >/dev/null 2>&1; then",
101
- " shasum -a 256 \"$1\" | awk '{print $1}'",
102
- " return 0",
103
- " fi",
104
- ' echo "No SHA256 tool available (sha256sum/shasum)." >&2',
105
- " return 1",
106
- "}",
107
- 'cleanup() { rm -f "$assembled_tmp"; }',
108
- "trap cleanup EXIT",
109
- 'mkdir -p "$(dirname "$target")"',
110
- '[ -d "$part_dir" ] || { echo "Missing multipart upload directory: $part_dir" >&2; exit 1; }',
111
- ': > "$assembled_tmp"',
112
- ...plan.parts.flatMap((part) => [
113
- `part_path=${shellQuote(part.remotePath)}`,
114
- `part_expected_size=${part.sizeBytes}`,
115
- `part_expected_sha=${shellQuote(part.sha256)}`,
116
- '[ -f "$part_path" ] || { echo "Missing upload part: $part_path" >&2; exit 1; }',
117
- 'part_size="$(wc -c < "$part_path" | tr -d \'[:space:]\')"',
118
- 'if [ "$part_size" != "$part_expected_size" ]; then echo "Part size mismatch for $part_path: expected $part_expected_size got $part_size" >&2; exit 1; fi',
119
- 'part_sha="$(hash_file "$part_path")"',
120
- 'if [ "$part_sha" != "$part_expected_sha" ]; then echo "Part checksum mismatch for $part_path" >&2; exit 1; fi',
121
- 'cat "$part_path" >> "$assembled_tmp"',
122
- ]),
123
- 'assembled_size="$(wc -c < "$assembled_tmp" | tr -d \'[:space:]\')"',
124
- 'if [ "$assembled_size" != "$expected_size" ]; then echo "Assembled file size mismatch: expected $expected_size got $assembled_size" >&2; exit 1; fi',
125
- 'assembled_sha="$(hash_file "$assembled_tmp")"',
126
- 'if [ "$assembled_sha" != "$expected_sha" ]; then echo "Assembled file checksum mismatch" >&2; exit 1; fi',
127
- 'mv "$assembled_tmp" "$target"',
128
- 'rm -rf "$part_dir"',
129
- "trap - EXIT",
130
- ].join("\n");
131
- const buildModalMultipartCleanupScript = (plan) => [
132
- "set -euo pipefail",
133
- `rm -rf ${shellQuote(plan.partDir)}`,
134
- `rm -f ${shellQuote(plan.assembledTmpPath)}`,
135
- ].join("\n");
136
- const buildModalControlTraceAttributes = (alias, requestPayload, expectedType, responseTimeoutMs) => {
137
- const requestType = typeof requestPayload.type === "string" ? requestPayload.type : "unknown";
138
- return {
139
- "devbox.modal.alias": alias,
140
- "devbox.modal.request_type": requestType,
141
- "devbox.modal.expected_type": expectedType,
142
- "devbox.modal.response_timeout_ms": responseTimeoutMs,
143
- ...(typeof requestPayload.path === "string"
144
- ? { "devbox.modal.path": requestPayload.path }
145
- : {}),
146
- ...(typeof requestPayload.serviceName === "string"
147
- ? { "devbox.modal.service_name": requestPayload.serviceName }
148
- : {}),
149
- ...(typeof requestPayload.sessionId === "string"
150
- ? { "devbox.modal.session_id": requestPayload.sessionId }
151
- : {}),
152
- ...(requestType === "fs_write" && typeof requestPayload.data === "string"
153
- ? { "devbox.modal.write_base64_bytes": requestPayload.data.length }
154
- : {}),
155
- ...(requestType === "exec" && Array.isArray(requestPayload.cmd)
156
- ? {
157
- "devbox.modal.exec_argc": requestPayload.cmd.length,
158
- "devbox.modal.exec_argv0": typeof requestPayload.cmd[0] === "string"
159
- ? requestPayload.cmd[0]
160
- : "",
161
- }
162
- : {}),
163
- };
164
- };
165
- const runWithConcurrency = async (items, concurrency, worker) => {
166
- if (items.length === 0) {
167
- return;
168
- }
169
- const boundedConcurrency = resolveBoundedConcurrency(items.length, concurrency);
170
- let nextIndex = 0;
171
- let firstError = null;
172
- const workers = Array.from({ length: boundedConcurrency }, async () => {
173
- while (true) {
174
- if (firstError) {
175
- return;
176
- }
177
- const currentIndex = nextIndex;
178
- nextIndex += 1;
179
- if (currentIndex >= items.length) {
180
- return;
181
- }
182
- const item = items.at(currentIndex);
183
- if (item === undefined) {
184
- return;
185
- }
186
- try {
187
- await worker(item);
188
- }
189
- catch (error) {
190
- if (!firstError) {
191
- firstError = error;
192
- }
193
- return;
194
- }
195
- }
196
- });
197
- await Promise.all(workers);
198
- if (firstError) {
199
- throw firstError;
200
- }
201
- };
202
- const resolveReadPath = (readPath, workingDir) => {
203
- if (path.posix.isAbsolute(readPath))
204
- return path.posix.normalize(readPath);
205
- if (workingDir && workingDir.trim().length > 0) {
206
- return path.posix.normalize(path.posix.join(workingDir, readPath));
207
- }
208
- return path.posix.normalize(readPath);
209
- };
210
- const createModalRuntimeClient = ({ alias, appName: initialAppName, sandboxId: initialSandboxId, ensureActive, credentialMode, credentials, createConnectToken: _createConnectToken, createCheckpoint: createCheckpointViaControlPlane, cwd, serviceRole: requestedServiceRole, }) => {
211
- let modal = null;
212
- let modalSandboxName = alias;
213
- try {
214
- const modalCredentials = resolveModalClientCredentials({
215
- ...(credentialMode ? { credentialMode } : {}),
216
- ...(credentials !== undefined ? { credentials } : {}),
217
- ...(cwd ? { cwd } : {}),
218
- });
219
- const modalEnvironmentName = resolveModalEnvironmentName();
220
- modalSandboxName = resolveModalSandboxName(alias, modalEnvironmentName);
221
- modal = new ModalClient({
222
- tokenId: modalCredentials.tokenId,
223
- tokenSecret: modalCredentials.tokenSecret,
224
- environment: modalEnvironmentName,
225
- });
226
- }
227
- catch (error) {
228
- if (!(error instanceof ProviderClientError &&
229
- error.code === "authentication_required")) {
230
- throw error;
231
- }
232
- }
233
- let appName = initialAppName;
234
- let sandboxId = initialSandboxId;
235
- let sandboxPromise = null;
236
- const serviceRole = requestedServiceRole ?? "user";
237
- const resolveDaemonConnectInfo = async ({ alias: rawAlias, intent, }) => {
238
- const normalizedAlias = rawAlias.trim();
239
- if (normalizedAlias !== alias) {
240
- throw new Error(`Modal init runtime is bound to alias "${alias}", but got "${normalizedAlias}".`);
241
- }
242
- if (!_createConnectToken) {
243
- throw new Error("Modal daemon access requires a control plane session. Run `dvb setup` and retry.");
244
- }
245
- const connectInfo = await _createConnectToken(intent);
246
- return {
247
- provider: "modal",
248
- url: connectInfo.url,
249
- connectToken: connectInfo.token,
250
- };
251
- };
252
- const requireAlias = (name) => {
253
- if (name !== alias) {
254
- throw new Error(`Modal init runtime is bound to alias "${alias}", but got "${name}".`);
255
- }
256
- };
257
- const resolveSandbox = async (intent = "shell") => {
258
- if (!modal) {
259
- throw new Error("Modal direct API access is unavailable. Use BYO modal auth for file and command operations.");
260
- }
261
- const directModal = modal;
262
- if (sandboxPromise)
263
- return sandboxPromise;
264
- sandboxPromise = (async () => {
265
- try {
266
- const runningSandbox = await withTimeout(directModal.sandboxes.fromName(appName, modalSandboxName), MODAL_SANDBOX_RESOLVE_TIMEOUT_MS, "Timed out resolving running modal sandbox by name.");
267
- sandboxId = runningSandbox.sandboxId;
268
- return runningSandbox;
269
- }
270
- catch (error) {
271
- if (!isSandboxNotFoundError(error)) {
272
- throw error;
273
- }
274
- }
275
- if (ensureActive) {
276
- const ensured = await withTimeout(ensureActive(intent), MODAL_SANDBOX_RESOLVE_TIMEOUT_MS, "Timed out waiting for modal devbox wake.");
277
- appName = ensured.appName;
278
- sandboxId = ensured.sandboxId;
279
- return await withTimeout(directModal.sandboxes.fromId(ensured.sandboxId), MODAL_SANDBOX_RESOLVE_TIMEOUT_MS, "Timed out resolving modal sandbox after wake.");
280
- }
281
- return await withTimeout(directModal.sandboxes.fromId(sandboxId), MODAL_SANDBOX_RESOLVE_TIMEOUT_MS, "Timed out resolving modal sandbox by id.");
282
- })().catch((error) => {
283
- sandboxPromise = null;
284
- throw error;
285
- });
286
- return sandboxPromise;
287
- };
288
- const exec = async (name, cmd, options) => {
289
- requireAlias(name);
290
- const response = await runControlRequest({
291
- type: "exec",
292
- cmd,
293
- ...(typeof options?.timeoutMs === "number"
294
- ? { timeoutMs: options.timeoutMs }
295
- : {}),
296
- }, "exec_result", typeof options?.timeoutMs === "number"
297
- ? {
298
- responseTimeoutMs: clampModalControlTimeoutMs(options.timeoutMs + 5_000),
299
- }
300
- : undefined);
301
- if (response.status !== "ok") {
302
- const { text } = parseDaemonControlError(response, "Modal daemon control request failed.");
303
- throw new Error(text);
304
- }
305
- const exitCode = typeof response.exitCode === "number" &&
306
- Number.isFinite(response.exitCode)
307
- ? response.exitCode
308
- : 1;
309
- const stdout = typeof response.stdout === "string" ? response.stdout : "";
310
- const stderr = typeof response.stderr === "string" ? response.stderr : "";
311
- return { exitCode, stdout, stderr };
312
- };
313
- const execShellScript = async (script, timeoutMs, failureMessage) => {
314
- const result = await exec(alias, [
315
- "/bin/bash",
316
- "--noprofile",
317
- "--norc",
318
- "-e",
319
- "-u",
320
- "-o",
321
- "pipefail",
322
- "-c",
323
- script,
324
- ], { timeoutMs });
325
- if (result.exitCode !== 0) {
326
- throw new Error(result.stderr || result.stdout || failureMessage);
327
- }
328
- };
329
- const readFile = async (name, options) => {
330
- requireAlias(name);
331
- const resolvedPath = resolveReadPath(options.path, options.workingDir);
332
- const response = await runControlRequest({
333
- type: "fs_read",
334
- path: options.path,
335
- ...(options.workingDir ? { workingDir: options.workingDir } : {}),
336
- }, "fs_read_result");
337
- if (response.status !== "ok") {
338
- const { code, text } = parseDaemonControlError(response, "Modal daemon control request failed.");
339
- if (code === "not_found") {
340
- throw new SpritesApiError(404, "GET", `/files/${encodeURIComponent(resolvedPath)}`, text);
341
- }
342
- throw new Error(text);
343
- }
344
- const data = typeof response.data === "string"
345
- ? Buffer.from(response.data, "base64")
346
- : Buffer.alloc(0);
347
- return new Uint8Array(data);
348
- };
349
- const writeFile = async (name, remotePath, data, options) => {
350
- requireAlias(name);
351
- const total = data.length;
352
- options?.onProgress?.(0, total);
353
- const chunked = shouldChunkModalFsWrite(remotePath, total);
354
- const plan = chunked
355
- ? buildModalMultipartWritePlan(remotePath, data)
356
- : null;
357
- const chunkCount = plan ? plan.parts.length : 0;
358
- const multipartConcurrency = plan
359
- ? resolveBoundedConcurrency(plan.parts.length, MODAL_DAEMON_MULTIPART_WRITE_CONCURRENCY)
360
- : 1;
361
- await withDevboxSpan("modal.write_file", {
362
- "devbox.modal.alias": alias,
363
- "devbox.modal.path": remotePath,
364
- "devbox.modal.size_bytes": total,
365
- "devbox.modal.chunked": chunked,
366
- ...(chunked ? { "devbox.modal.chunk_count": chunkCount } : {}),
367
- }, async () => {
368
- logger.info("modal_fs_write_start", {
369
- alias,
370
- remotePath,
371
- sizeBytes: total,
372
- chunked,
373
- ...(chunked
374
- ? {
375
- chunkBytes: plan?.partSizeLimitBytes,
376
- chunkCount,
377
- multipartConcurrency,
378
- }
379
- : {}),
380
- });
381
- try {
382
- if (!chunked) {
383
- const response = await runControlRequest({
384
- type: "fs_write",
385
- path: remotePath,
386
- mkdir: true,
387
- data: Buffer.from(data).toString("base64"),
388
- }, "fs_write_result", {
389
- responseTimeoutMs: estimateModalWriteTimeoutMs(total),
390
- });
391
- if (response.status !== "ok") {
392
- const { text } = parseDaemonControlError(response, "Modal daemon control request failed.");
393
- throw new Error(text);
394
- }
395
- options?.onProgress?.(total, total);
396
- logger.info("modal_fs_write_complete", {
397
- alias,
398
- remotePath,
399
- sizeBytes: total,
400
- chunked: false,
401
- });
402
- return;
403
- }
404
- if (!plan) {
405
- throw new Error("Missing multipart upload plan.");
406
- }
407
- let uploadedBytes = 0;
408
- await runWithConcurrency(plan.parts, multipartConcurrency, async (part) => {
409
- const response = await runControlRequest({
410
- type: "fs_write",
411
- path: part.remotePath,
412
- mkdir: true,
413
- data: Buffer.from(part.data).toString("base64"),
414
- }, "fs_write_result", {
415
- responseTimeoutMs: estimateModalMultipartPartTimeoutMs(part.sizeBytes, multipartConcurrency),
416
- });
417
- if (response.status !== "ok") {
418
- const { text } = parseDaemonControlError(response, "Modal daemon control request failed.");
419
- throw new Error(text);
420
- }
421
- uploadedBytes += part.sizeBytes;
422
- logger.info("modal_fs_write_chunk_complete", {
423
- alias,
424
- remotePath,
425
- chunkIndex: part.index,
426
- chunkCount: plan.parts.length,
427
- chunkSizeBytes: part.sizeBytes,
428
- uploadedBytes,
429
- totalBytes: total,
430
- });
431
- options?.onProgress?.(uploadedBytes, total);
432
- });
433
- await execShellScript(buildModalMultipartAssembleScript(remotePath, plan), estimateModalMultipartAssembleTimeoutMs(total), "Failed to assemble multipart Modal upload.");
434
- options?.onProgress?.(total, total);
435
- logger.info("modal_fs_write_complete", {
436
- alias,
437
- remotePath,
438
- sizeBytes: total,
439
- chunked: true,
440
- chunkCount: plan.parts.length,
441
- });
442
- }
443
- catch (error) {
444
- if (plan) {
445
- try {
446
- await execShellScript(buildModalMultipartCleanupScript(plan), MODAL_DAEMON_REQUEST_TIMEOUT_MS, "Failed to clean up multipart Modal upload.");
447
- }
448
- catch (cleanupError) {
449
- logger.warn("modal_fs_write_cleanup_failed", {
450
- alias,
451
- remotePath,
452
- error: cleanupError instanceof Error
453
- ? cleanupError.message
454
- : String(cleanupError),
455
- });
456
- }
457
- }
458
- logger.error("modal_fs_write_failed", {
459
- alias,
460
- remotePath,
461
- sizeBytes: total,
462
- chunked,
463
- error: error instanceof Error ? error.message : String(error),
464
- });
465
- throw error;
466
- }
467
- });
468
- };
469
- const upsertServiceControl = async (name, service, input) => {
470
- const response = await runControlRequest({
471
- type: "service_upsert",
472
- serviceName: service,
473
- actor: serviceRole,
474
- scope: input.scope,
475
- cmd: input.cmd,
476
- args: input.args,
477
- httpPort: input.httpPort,
478
- workingDir: input.workingDir,
479
- autostart: input.autostart,
480
- restartPolicy: input.restartPolicy,
481
- }, "service_upsert_result");
482
- if (response.status !== "ok") {
483
- const { code, text } = parseDaemonControlError(response, "Modal daemon control request failed.");
484
- if (code === "service_not_found") {
485
- throw new SpritesApiError(404, "PUT", `/v1/sprites/${encodeURIComponent(name)}/services/${encodeURIComponent(service)}`, text);
486
- }
487
- throw new Error(text);
488
- }
489
- return mapProviderServiceRecord(response.service);
490
- };
491
- const listServices = async (name) => {
492
- const records = await listServiceRecords(name);
493
- return records.map((record) => mapProviderServiceRecordToSpriteService(record));
494
- };
495
- const getService = async (name, service) => {
496
- const record = await getServiceRecord(name, service);
497
- return record ? mapProviderServiceRecordToSpriteService(record) : null;
498
- };
499
- const listServiceRecords = async (name) => {
500
- requireAlias(name);
501
- const response = await runControlRequest({ type: "services_list" }, "services_list_result");
502
- if (response.status !== "ok") {
503
- const { text } = parseDaemonControlError(response, "Modal daemon control request failed.");
504
- throw new Error(text);
505
- }
506
- const records = Array.isArray(response.services) ? response.services : [];
507
- return records.map((entry) => mapProviderServiceRecord(entry));
508
- };
509
- const getServiceRecord = async (name, service) => {
510
- requireAlias(name);
511
- validateManagedServiceName(service);
512
- const response = await runControlRequest({ type: "service_get", serviceName: service }, "service_get_result");
513
- if (response.status !== "ok") {
514
- const { code, text } = parseDaemonControlError(response, "Modal daemon control request failed.");
515
- if (code === "service_not_found") {
516
- return null;
517
- }
518
- throw new Error(text);
519
- }
520
- return mapProviderServiceRecord(response.service);
521
- };
522
- const upsertServiceRecord = async (name, service, input) => {
523
- requireAlias(name);
524
- validateManagedServiceName(service);
525
- return await upsertServiceControl(name, service, input);
526
- };
527
- const createService = async (name, service, input) => {
528
- requireAlias(name);
529
- validateManagedServiceName(service);
530
- if (!input.cmd || !input.cmd.trim()) {
531
- throw new Error(`Service "${service}" is missing a command.`);
532
- }
533
- if (input.needs && input.needs.length > 0) {
534
- throw new Error("Service dependencies are not supported yet.");
535
- }
536
- const record = await upsertServiceControl(name, service, {
537
- scope: CORE_SERVICE_NAMES.has(service) ? "core" : "user",
538
- cmd: input.cmd.trim(),
539
- args: input.args ?? [],
540
- httpPort: typeof input.httpPort === "number" ? input.httpPort : null,
541
- workingDir: null,
542
- autostart: true,
543
- restartPolicy: "always",
544
- });
545
- return mapProviderServiceRecordToSpriteService(record);
546
- };
547
- const startService = async (name, service) => {
548
- requireAlias(name);
549
- validateManagedServiceName(service);
550
- const response = await runControlRequest({ type: "service_start", serviceName: service, actor: serviceRole }, "service_start_result");
551
- if (response.status !== "ok") {
552
- const { code, text } = parseDaemonControlError(response, "Modal daemon control request failed.");
553
- if (code === "service_not_found") {
554
- throw new Error(`Service "${service}" does not exist.`);
555
- }
556
- throw new Error(text);
557
- }
558
- return Array.isArray(response.events)
559
- ? response.events
560
- .filter((entry) => entry && typeof entry === "object")
561
- .map((entry) => entry)
562
- : [{ event: "started", service }];
563
- };
564
- const stopService = async (name, service, options) => {
565
- requireAlias(name);
566
- validateManagedServiceName(service);
567
- const response = await runControlRequest({
568
- type: "service_stop",
569
- serviceName: service,
570
- actor: serviceRole,
571
- ...(options?.timeout ? { timeout: options.timeout } : {}),
572
- }, "service_stop_result");
573
- if (response.status !== "ok") {
574
- const { code, text } = parseDaemonControlError(response, "Modal daemon control request failed.");
575
- if (code === "service_not_found") {
576
- throw new Error(`Service "${service}" does not exist.`);
577
- }
578
- throw new Error(text);
579
- }
580
- return Array.isArray(response.events)
581
- ? response.events
582
- .filter((entry) => entry && typeof entry === "object")
583
- .map((entry) => entry)
584
- : [{ event: "stopped", service }];
585
- };
586
- const signalService = async (name, service, options) => {
587
- requireAlias(name);
588
- validateManagedServiceName(service);
589
- const signal = typeof options?.signal === "string" && options.signal.trim().length > 0
590
- ? options.signal.trim()
591
- : "TERM";
592
- const response = await runControlRequest({
593
- type: "service_signal",
594
- serviceName: service,
595
- signal,
596
- actor: serviceRole,
597
- }, "service_signal_result");
598
- if (response.status !== "ok") {
599
- const { code, text } = parseDaemonControlError(response, "Modal daemon control request failed.");
600
- if (code === "service_not_found") {
601
- throw new Error(`Service "${service}" does not exist.`);
602
- }
603
- throw new Error(text);
604
- }
605
- return Array.isArray(response.events)
606
- ? response.events
607
- .filter((entry) => entry && typeof entry === "object")
608
- .map((entry) => entry)
609
- : [{ event: "signaled", service, signal }];
610
- };
611
- const deleteService = async (name, service) => {
612
- requireAlias(name);
613
- validateManagedServiceName(service);
614
- const response = await runControlRequest({ type: "service_delete", serviceName: service, actor: serviceRole }, "service_delete_result");
615
- if (response.status !== "ok") {
616
- const { code, text } = parseDaemonControlError(response, "Modal daemon control request failed.");
617
- if (code === "service_not_found") {
618
- throw new SpritesApiError(404, "DELETE", `/v1/sprites/${encodeURIComponent(name)}/services/${encodeURIComponent(service)}`, text);
619
- }
620
- throw new Error(text);
621
- }
622
- };
623
- const readServiceLogs = async (name, service, options) => {
624
- requireAlias(name);
625
- validateManagedServiceName(service);
626
- const tailValue = typeof options?.tail === "number" && Number.isFinite(options.tail)
627
- ? Math.max(1, Math.min(20_000, Math.floor(options.tail)))
628
- : 200;
629
- const response = await runControlRequest({ type: "service_logs_tail", serviceName: service, tail: tailValue }, "service_logs_tail_result");
630
- if (response.status !== "ok") {
631
- const { text } = parseDaemonControlError(response, "Modal daemon control request failed.");
632
- throw new Error(text);
633
- }
634
- const lines = Array.isArray(response.lines)
635
- ? response.lines.map((entry) => String(entry))
636
- : [];
637
- return lines.join("\n");
638
- };
639
- const parseKillTimeoutOption = (value) => {
640
- if (!value)
641
- return undefined;
642
- const trimmed = value.trim().toLowerCase();
643
- if (!trimmed)
644
- return undefined;
645
- const match = /^(\d+)(ms|s|m)?$/.exec(trimmed);
646
- if (!match)
647
- return undefined;
648
- const amount = Number.parseInt(match[1] ?? "", 10);
649
- if (!Number.isFinite(amount) || amount <= 0) {
650
- return undefined;
651
- }
652
- const unit = match[2] ?? "ms";
653
- if (unit === "ms")
654
- return amount;
655
- if (unit === "s")
656
- return amount * 1000;
657
- if (unit === "m")
658
- return amount * 60_000;
659
- return undefined;
660
- };
661
- const runControlRequest = async (requestPayload, expectedType, options) => {
662
- const requestType = typeof requestPayload.type === "string" ? requestPayload.type : "unknown";
663
- const responseTimeoutMs = clampModalControlTimeoutMs(options?.responseTimeoutMs ?? MODAL_DAEMON_REQUEST_TIMEOUT_MS);
664
- return await withDevboxSpan("modal.control.request", buildModalControlTraceAttributes(alias, requestPayload, expectedType, responseTimeoutMs), async () => {
665
- const startedAt = Date.now();
666
- try {
667
- return await runDirectDaemonControlRequest({
668
- alias,
669
- provider: "modal",
670
- resolveConnectInfo: resolveDaemonConnectInfo,
671
- requestPayload,
672
- expectedType,
673
- timeoutMs: responseTimeoutMs,
674
- });
675
- }
676
- catch (error) {
677
- logger.error("modal_control_request_failed", {
678
- alias,
679
- requestType,
680
- expectedType,
681
- responseTimeoutMs,
682
- durationMs: Date.now() - startedAt,
683
- error: error instanceof Error ? error.message : String(error),
684
- });
685
- throw error;
686
- }
687
- });
688
- };
689
- const listExecSessions = async (name) => {
690
- requireAlias(name);
691
- const response = await runControlRequest({ type: "sessions_list" }, "sessions_list_result");
692
- if (response.status !== "ok") {
693
- const { text } = parseDaemonControlError(response, "Modal daemon control request failed.");
694
- throw new Error(text);
695
- }
696
- const records = Array.isArray(response.sessions) ? response.sessions : [];
697
- const sessions = [];
698
- for (const entry of records) {
699
- const mapped = mapDaemonControlSessionRecord(entry);
700
- if (!mapped)
701
- continue;
702
- sessions.push(mapped);
703
- }
704
- return sessions;
705
- };
706
- const killExecSession = async (name, sessionId, options) => {
707
- requireAlias(name);
708
- const timeoutMs = parseKillTimeoutOption(options?.timeout);
709
- const response = await runControlRequest({
710
- type: "session_kill",
711
- sessionId,
712
- ...(options?.signal ? { signal: options.signal } : {}),
713
- ...(typeof timeoutMs === "number" ? { timeoutMs } : {}),
714
- }, "session_kill_result", typeof timeoutMs === "number"
715
- ? {
716
- responseTimeoutMs: clampModalControlTimeoutMs(timeoutMs + 5_000),
717
- }
718
- : undefined);
719
- if (response.status !== "ok") {
720
- const { code, text } = parseDaemonControlError(response, "Modal daemon control request failed.");
721
- if (code === "not_found") {
722
- throw new SpritesApiError(404, "DELETE", `/v1/sprites/${encodeURIComponent(name)}/exec/${encodeURIComponent(sessionId)}`, text);
723
- }
724
- throw new Error(text);
725
- }
726
- return Array.isArray(response.events)
727
- ? response.events
728
- .filter((entry) => entry && typeof entry === "object")
729
- .map((entry) => entry)
730
- : [{ event: "killed", session_id: sessionId }];
731
- };
732
- const openExecSession = (name, options) => {
733
- const normalizedAlias = name.trim();
734
- requireAlias(normalizedAlias);
735
- return new DirectDaemonExecSocket("modal", resolveDaemonConnectInfo, normalizedAlias, options);
736
- };
737
- const attachExecSession = (name, sessionId) => {
738
- const normalizedAlias = name.trim();
739
- requireAlias(normalizedAlias);
740
- return new DirectDaemonExecSocket("modal", resolveDaemonConnectInfo, normalizedAlias, {
741
- cmd: [],
742
- tty: true,
743
- stdin: true,
744
- sessionId,
745
- });
746
- };
747
- const createCheckpoint = async (name, options) => {
748
- requireAlias(name);
749
- if (modal) {
750
- const sandbox = await resolveSandbox();
751
- const image = await sandbox.snapshotFilesystem();
752
- const checkpointId = `v${Date.now()}${Math.floor(Math.random() * 10_000)}`;
753
- return [
754
- {
755
- id: checkpointId,
756
- checkpoint_id: checkpointId,
757
- provider: "modal",
758
- provider_checkpoint_id: image.imageId,
759
- ...(options?.comment ? { comment: options.comment } : {}),
760
- },
761
- ];
762
- }
763
- if (createCheckpointViaControlPlane) {
764
- return await createCheckpointViaControlPlane(options?.comment);
765
- }
766
- throw new Error("Modal checkpoint creation is unavailable. Run `dvb setup` or provide Modal BYO credentials.");
767
- };
768
- return {
769
- writeFile,
770
- readFile,
771
- exec,
772
- listExecSessions,
773
- killExecSession,
774
- createCheckpoint,
775
- listServices,
776
- getService,
777
- createService,
778
- startService,
779
- stopService,
780
- listServiceRecords,
781
- getServiceRecord,
782
- upsertServiceRecord,
783
- signalService,
784
- deleteService,
785
- readServiceLogs,
786
- openExecSession,
787
- attachExecSession,
788
- };
789
- };
790
- export { createModalRuntimeClient };
791
- //# sourceMappingURL=modalRuntime.js.map