@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,677 +0,0 @@
1
- import http from "node:http";
2
- import path from "node:path";
3
- import { spawn, spawnSync } from "node:child_process";
4
- import { randomUUID } from "node:crypto";
5
- import fs from "node:fs";
6
- import { access } from "node:fs/promises";
7
- import { injectActiveTraceContextHeaders, parseUpgradeRequiredResponseBody, readCurrentPackageVersion, resolveDevboxDir, resolveSocketInfo, } from "@boxes-dev/core";
8
- import { getControlPlaneUrl, getConvexUrl } from "./controlPlane.js";
9
- import { logger } from "./logger.js";
10
- export const DAEMON_TIMEOUT_MS = {
11
- health: 300,
12
- quick: 500,
13
- registry: 5000,
14
- };
15
- const AUTH_RELOGIN_HINT = "Run `dvb setup` in a TTY to sign in again.";
16
- const readNonEmptyString = (value) => {
17
- if (typeof value !== "string")
18
- return null;
19
- const trimmed = value.trim();
20
- return trimmed.length > 0 ? trimmed : null;
21
- };
22
- const extractDaemonErrorPayload = (body) => {
23
- if (!body || typeof body !== "object") {
24
- return {};
25
- }
26
- return body;
27
- };
28
- const shouldAttachReloginHint = (message) => {
29
- const normalized = message.toLowerCase();
30
- return (normalized.includes("control plane") &&
31
- normalized.includes("auth") &&
32
- !normalized.includes("dvb setup"));
33
- };
34
- export const formatDaemonResponseError = (response) => {
35
- const payload = extractDaemonErrorPayload(response.body);
36
- const errorCode = readNonEmptyString(payload.error);
37
- const detail = readNonEmptyString(payload.message) ?? readNonEmptyString(payload.detail);
38
- if (errorCode === "control_plane_auth_invalid" ||
39
- errorCode === "control_plane_auth_missing") {
40
- const detailWithHint = detail && !detail.includes("dvb setup")
41
- ? `${detail} ${AUTH_RELOGIN_HINT}`
42
- : (detail ?? AUTH_RELOGIN_HINT);
43
- return detailWithHint;
44
- }
45
- if (detail) {
46
- return shouldAttachReloginHint(detail)
47
- ? `${detail} ${AUTH_RELOGIN_HINT}`
48
- : detail;
49
- }
50
- if (errorCode) {
51
- return `dvbd error (${response.status}): ${errorCode}`;
52
- }
53
- const rawBody = readNonEmptyString(response.rawBody);
54
- if (rawBody) {
55
- return `dvbd error (${response.status}): ${rawBody.slice(0, 220)}`;
56
- }
57
- return `dvbd error: ${response.status}`;
58
- };
59
- export const throwDaemonResponseError = (response) => {
60
- const upgradeRequired = parseUpgradeRequiredResponseBody(typeof response.rawBody === "string"
61
- ? response.rawBody
62
- : JSON.stringify(response.body ?? {}), {
63
- source: "daemon",
64
- statusCode: response.status,
65
- });
66
- if (upgradeRequired) {
67
- throw upgradeRequired;
68
- }
69
- throw new Error(formatDaemonResponseError(response));
70
- };
71
- class DaemonConnectionError extends Error {
72
- code;
73
- socketPath;
74
- constructor(socketPath, cause) {
75
- super(cause.message);
76
- this.name = "DaemonConnectionError";
77
- this.code = cause.code;
78
- this.socketPath = socketPath;
79
- this.cause = cause;
80
- }
81
- }
82
- const isConnectionError = (error) => {
83
- if (!(error instanceof Error))
84
- return false;
85
- const code = error.code;
86
- return (code === "ENOENT" ||
87
- code === "ECONNREFUSED" ||
88
- code === "EPIPE" ||
89
- code === "ENOTFOUND" ||
90
- code === "EINVAL" ||
91
- code === "ENAMETOOLONG");
92
- };
93
- export const isDaemonConnectionError = isConnectionError;
94
- const unixSocketPathLimit = () => {
95
- return process.platform === "linux" ? 107 : 103;
96
- };
97
- const isSocketPathTooLong = (socketPath) => {
98
- return Buffer.byteLength(socketPath, "utf8") > unixSocketPathLimit();
99
- };
100
- let expectedDaemonVersionCache = null;
101
- const daemonFeaturesCache = new Map();
102
- const ensureDaemonRunningInFlight = new Map();
103
- const ACTIVE_DAEMON_RECOVERY_TIMEOUT_MS = 20_000;
104
- const readExpectedDaemonVersion = () => {
105
- if (expectedDaemonVersionCache)
106
- return expectedDaemonVersionCache;
107
- expectedDaemonVersionCache = readCurrentPackageVersion() ?? "unknown";
108
- return expectedDaemonVersionCache;
109
- };
110
- const DAEMON_PID_EXIT_GRACE_MS = 1_500;
111
- const DAEMON_FORCE_KILL_TIMEOUT_MS = 1_000;
112
- const DAEMON_POLL_INTERVAL_MS = 100;
113
- const sleep = async (ms) => await new Promise((resolve) => setTimeout(resolve, ms));
114
- const isProcessAlive = (pid) => {
115
- if (!Number.isInteger(pid) || pid <= 0)
116
- return false;
117
- try {
118
- process.kill(pid, 0);
119
- return true;
120
- }
121
- catch (error) {
122
- const code = error?.code;
123
- return code === "EPERM";
124
- }
125
- };
126
- const waitForPidExit = async (pid, timeoutMs) => {
127
- const deadline = Date.now() + timeoutMs;
128
- while (Date.now() < deadline) {
129
- if (!isProcessAlive(pid))
130
- return true;
131
- await sleep(DAEMON_POLL_INTERVAL_MS);
132
- }
133
- return !isProcessAlive(pid);
134
- };
135
- const hasSocketPath = async (socketPath) => {
136
- try {
137
- await access(socketPath);
138
- return true;
139
- }
140
- catch {
141
- return false;
142
- }
143
- };
144
- const signalPid = (pid, signal) => {
145
- try {
146
- process.kill(pid, signal);
147
- return true;
148
- }
149
- catch (error) {
150
- const code = error?.code;
151
- if (code === "ESRCH") {
152
- return false;
153
- }
154
- throw error;
155
- }
156
- };
157
- const normalizeVersion = (value) => {
158
- if (typeof value !== "string")
159
- return null;
160
- const trimmed = value.trim();
161
- if (!trimmed)
162
- return null;
163
- if (trimmed === "unknown")
164
- return null;
165
- return trimmed;
166
- };
167
- const parseIsoTimestampMs = (value) => {
168
- if (typeof value !== "string") {
169
- return null;
170
- }
171
- const parsed = Date.parse(value);
172
- return Number.isFinite(parsed) ? parsed : null;
173
- };
174
- const shouldRestartDaemonForRuntimeMismatch = (args) => {
175
- const versionMismatch = Boolean(args.expectedVersion &&
176
- args.actualVersion &&
177
- args.actualVersion !== args.expectedVersion);
178
- const scriptChangedSinceStart = Boolean(args.expectedScriptMtimeMs &&
179
- args.startedAtMs &&
180
- args.expectedScriptMtimeMs > args.startedAtMs + 250);
181
- return {
182
- versionMismatch,
183
- scriptChangedSinceStart,
184
- shouldRestart: versionMismatch || scriptChangedSinceStart,
185
- };
186
- };
187
- const terminateDaemonPid = async (socketPath, pid, reason) => {
188
- const termSent = signalPid(pid, "SIGTERM");
189
- if (!termSent) {
190
- return;
191
- }
192
- const exitedGracefully = await waitForPidExit(pid, DAEMON_PID_EXIT_GRACE_MS);
193
- if (exitedGracefully) {
194
- return;
195
- }
196
- logger.warn("daemon_force_kill", {
197
- socketPath,
198
- pid,
199
- reason,
200
- });
201
- const killSent = signalPid(pid, "SIGKILL");
202
- if (!killSent) {
203
- return;
204
- }
205
- const exitedAfterKill = await waitForPidExit(pid, DAEMON_FORCE_KILL_TIMEOUT_MS);
206
- if (exitedAfterKill) {
207
- return;
208
- }
209
- throw new Error(`dvbd pid ${pid} did not exit after SIGKILL`);
210
- };
211
- const terminateDaemonPids = async (socketPath, pids, reason) => {
212
- for (const pid of pids) {
213
- await terminateDaemonPid(socketPath, pid, reason);
214
- }
215
- };
216
- export const requestJson = async (socketPath, method, requestPath, timeoutMs, body) => {
217
- const requestId = randomUUID();
218
- logger.info("daemon_request", {
219
- requestId,
220
- method,
221
- path: requestPath,
222
- });
223
- return new Promise((resolve, reject) => {
224
- const payload = body ? JSON.stringify(body) : null;
225
- const headers = injectActiveTraceContextHeaders({
226
- "x-request-id": requestId,
227
- ...(payload
228
- ? {
229
- "content-type": "application/json",
230
- "content-length": Buffer.byteLength(payload).toString(),
231
- }
232
- : {}),
233
- });
234
- const req = http.request({
235
- method,
236
- socketPath,
237
- path: requestPath,
238
- headers,
239
- }, (res) => {
240
- const chunks = [];
241
- res.on("data", (chunk) => {
242
- chunks.push(Buffer.from(chunk));
243
- });
244
- res.on("end", () => {
245
- const payload = Buffer.concat(chunks).toString("utf8");
246
- let parsedBody = {};
247
- let parseError;
248
- if (payload) {
249
- try {
250
- parsedBody = JSON.parse(payload);
251
- }
252
- catch (error) {
253
- parseError =
254
- error instanceof Error ? error.message : "invalid_json";
255
- logger.warn("daemon_response_invalid_json", {
256
- requestId,
257
- method,
258
- path: requestPath,
259
- status: res.statusCode,
260
- error: parseError,
261
- });
262
- }
263
- }
264
- logger.info("daemon_response", {
265
- requestId,
266
- method,
267
- path: requestPath,
268
- status: res.statusCode,
269
- });
270
- resolve({
271
- status: res.statusCode ?? 0,
272
- body: parsedBody,
273
- ...(payload ? { rawBody: payload } : {}),
274
- ...(parseError ? { parseError } : {}),
275
- });
276
- });
277
- });
278
- req.on("error", (error) => {
279
- if (isConnectionError(error)) {
280
- reject(new DaemonConnectionError(socketPath, error));
281
- return;
282
- }
283
- reject(error);
284
- });
285
- req.setTimeout(timeoutMs, () => {
286
- req.destroy(new Error("request_timeout"));
287
- });
288
- if (payload) {
289
- req.write(payload);
290
- }
291
- req.end();
292
- });
293
- };
294
- export const requireDaemonFeatures = async (socketPath, required) => {
295
- if (!required.length)
296
- return;
297
- let available = daemonFeaturesCache.get(socketPath);
298
- if (!available) {
299
- const response = await requestJson(socketPath, "GET", "/version", DAEMON_TIMEOUT_MS.quick);
300
- if (response.status !== 200) {
301
- throw new Error("dvbd does not support this command. Restart the daemon and try again.");
302
- }
303
- const features = Array.isArray(response.body.features)
304
- ? response.body.features
305
- : [];
306
- available = new Set(features);
307
- daemonFeaturesCache.set(socketPath, available);
308
- }
309
- const missing = required.filter((feature) => !available.has(feature));
310
- if (missing.length) {
311
- throw new Error(`dvbd is missing required capabilities (${missing.join(", ")}). Restart the daemon and try again.`);
312
- }
313
- };
314
- const resolveDaemonCommand = () => {
315
- if (process.env.DEVBOXD_BIN_PATH) {
316
- return {
317
- command: process.execPath,
318
- args: [process.env.DEVBOXD_BIN_PATH],
319
- source: "env",
320
- };
321
- }
322
- if (process.argv[1]) {
323
- return {
324
- command: process.execPath,
325
- args: [process.argv[1], "--daemon"],
326
- source: "self",
327
- };
328
- }
329
- return {
330
- command: process.execPath,
331
- args: ["--daemon"],
332
- source: "self",
333
- };
334
- };
335
- const resolveExpectedDaemonScriptPath = () => {
336
- const command = resolveDaemonCommand();
337
- const scriptPath = command.args[0]?.trim() ?? "";
338
- if (!scriptPath || scriptPath === "--daemon") {
339
- return null;
340
- }
341
- return scriptPath;
342
- };
343
- const readExpectedDaemonScriptMtimeMs = () => {
344
- const scriptPath = resolveExpectedDaemonScriptPath();
345
- if (!scriptPath) {
346
- return null;
347
- }
348
- try {
349
- return fs.statSync(scriptPath).mtimeMs;
350
- }
351
- catch {
352
- return null;
353
- }
354
- };
355
- const spawnDaemon = (socketPath) => {
356
- const command = resolveDaemonCommand();
357
- const controlPlaneUrl = getControlPlaneUrl();
358
- const convexUrl = getConvexUrl();
359
- const runtimeDir = path.dirname(socketPath);
360
- const logPath = path.join(runtimeDir, "dvbd.log");
361
- let logFd = null;
362
- try {
363
- // Keep daemon startup logs somewhere users can inspect when health checks fail.
364
- logFd = fs.openSync(logPath, "a");
365
- }
366
- catch {
367
- logFd = null;
368
- }
369
- logger.info("daemon_spawn", {
370
- socketPath,
371
- command: command.command,
372
- args: command.args,
373
- source: command.source,
374
- ...(logFd !== null ? { logPath } : {}),
375
- });
376
- const child = spawn(command.command, command.args, {
377
- env: {
378
- ...process.env,
379
- DEVBOX_SOCKET_PATH: socketPath,
380
- ...(controlPlaneUrl ? { DEVBOX_CONTROL_PLANE_URL: controlPlaneUrl } : {}),
381
- ...(convexUrl ? { DEVBOX_CONVEX_URL: convexUrl } : {}),
382
- },
383
- stdio: logFd !== null ? ["ignore", logFd, logFd] : "ignore",
384
- detached: true,
385
- });
386
- if (logFd !== null) {
387
- try {
388
- fs.closeSync(logFd);
389
- }
390
- catch {
391
- // ignore
392
- }
393
- }
394
- child.unref();
395
- };
396
- const waitForHealth = async (socketPath, timeoutMs) => {
397
- const deadline = Date.now() + timeoutMs;
398
- while (Date.now() < deadline) {
399
- try {
400
- const response = await requestJson(socketPath, "GET", "/health", DAEMON_TIMEOUT_MS.quick);
401
- if (response.status === 200 && response.body.ok)
402
- return response.body;
403
- }
404
- catch {
405
- // retry until timeout
406
- }
407
- await new Promise((resolve) => setTimeout(resolve, 150));
408
- }
409
- throw new Error("dvbd did not become healthy in time");
410
- };
411
- const listAlternateSocketPaths = (primary) => {
412
- const candidates = new Set();
413
- const envWithoutSocket = { ...process.env };
414
- delete envWithoutSocket.DEVBOX_SOCKET_PATH;
415
- const fallback = resolveSocketInfo(envWithoutSocket).socketPath;
416
- candidates.add(fallback);
417
- const homeDir = process.env.HOME?.trim();
418
- if (homeDir) {
419
- candidates.add(path.join(resolveDevboxDir(homeDir), "run", "devboxd.sock"));
420
- }
421
- candidates.delete(primary);
422
- return [...candidates].filter((socketPath) => {
423
- if (!isSocketPathTooLong(socketPath))
424
- return true;
425
- logger.warn("daemon_duplicate_check_skipped", {
426
- socketPath,
427
- reason: "socket_path_too_long",
428
- });
429
- return false;
430
- });
431
- };
432
- const pruneDuplicateDaemons = async (primary) => {
433
- const candidates = listAlternateSocketPaths(primary);
434
- for (const socketPath of candidates) {
435
- try {
436
- const health = await requestJson(socketPath, "GET", "/health", DAEMON_TIMEOUT_MS.health);
437
- if (health.status === 200 && health.body.ok) {
438
- logger.warn("daemon_duplicate_detected", {
439
- socketPath,
440
- pid: health.body.pid,
441
- });
442
- await stopDaemon(socketPath);
443
- }
444
- }
445
- catch (error) {
446
- if (!isConnectionError(error)) {
447
- logger.warn("daemon_duplicate_check_failed", {
448
- socketPath,
449
- error: String(error),
450
- });
451
- }
452
- }
453
- }
454
- };
455
- const listDaemonPidsForSocket = (socketPath) => {
456
- const ps = spawnSync("ps", ["eww", "-Ao", "pid=,command="], {
457
- encoding: "utf8",
458
- });
459
- if (ps.status !== 0 || typeof ps.stdout !== "string") {
460
- return [];
461
- }
462
- const expectedSocketEnv = `DEVBOX_SOCKET_PATH=${socketPath}`;
463
- const pids = new Set();
464
- for (const rawLine of ps.stdout.split(/\r?\n/)) {
465
- const line = rawLine.trim();
466
- if (!line)
467
- continue;
468
- if (!line.includes(" --daemon"))
469
- continue;
470
- if (!line.includes("dvb.cjs") && !line.includes("dvbd.cjs"))
471
- continue;
472
- if (!line.includes(expectedSocketEnv))
473
- continue;
474
- const firstSpace = line.indexOf(" ");
475
- if (firstSpace <= 0)
476
- continue;
477
- const pid = Number.parseInt(line.slice(0, firstSpace).trim(), 10);
478
- if (!Number.isFinite(pid) || pid <= 0 || pid === process.pid)
479
- continue;
480
- pids.add(pid);
481
- }
482
- return [...pids];
483
- };
484
- const pruneSameSocketDaemons = async (socketPath, keepPid) => {
485
- const pids = listDaemonPidsForSocket(socketPath);
486
- for (const pid of pids) {
487
- if (pid === keepPid)
488
- continue;
489
- logger.warn("daemon_duplicate_same_socket_detected", {
490
- socketPath,
491
- keepPid,
492
- duplicatePid: pid,
493
- });
494
- try {
495
- await terminateDaemonPid(socketPath, pid, "duplicate_same_socket");
496
- }
497
- catch (error) {
498
- const code = error?.code;
499
- if (code !== "ESRCH") {
500
- logger.warn("daemon_duplicate_same_socket_stop_failed", {
501
- socketPath,
502
- duplicatePid: pid,
503
- error: String(error),
504
- });
505
- }
506
- }
507
- }
508
- };
509
- const maybeRestartDaemonForVersionMismatch = async (socketPath, health) => {
510
- const expected = normalizeVersion(readExpectedDaemonVersion());
511
- const expectedScriptMtimeMs = readExpectedDaemonScriptMtimeMs();
512
- const startedAtMs = parseIsoTimestampMs(health.startedAt);
513
- if (!expected && !expectedScriptMtimeMs)
514
- return health;
515
- const versionResponse = await requestJson(socketPath, "GET", "/version", DAEMON_TIMEOUT_MS.quick);
516
- if (versionResponse.status !== 200)
517
- return health;
518
- const actual = normalizeVersion(versionResponse.body.version);
519
- const mismatch = shouldRestartDaemonForRuntimeMismatch({
520
- expectedVersion: expected,
521
- actualVersion: actual,
522
- expectedScriptMtimeMs,
523
- startedAtMs,
524
- });
525
- if (!mismatch.shouldRestart)
526
- return health;
527
- logger.warn(mismatch.versionMismatch
528
- ? "daemon_version_mismatch"
529
- : "daemon_script_stale", {
530
- socketPath,
531
- pid: health.pid,
532
- expected,
533
- actual,
534
- ...(expectedScriptMtimeMs
535
- ? { expectedScriptMtimeMs: Math.trunc(expectedScriptMtimeMs) }
536
- : {}),
537
- ...(startedAtMs ? { startedAtMs: Math.trunc(startedAtMs) } : {}),
538
- });
539
- try {
540
- await stopDaemon(socketPath);
541
- }
542
- catch (error) {
543
- logger.warn("daemon_restart_failed", {
544
- socketPath,
545
- pid: health.pid,
546
- error: String(error),
547
- });
548
- return health;
549
- }
550
- spawnDaemon(socketPath);
551
- return await waitForHealth(socketPath, 5000);
552
- };
553
- const readHealthyDaemon = async (socketPath, timeoutMs) => {
554
- try {
555
- const response = await requestJson(socketPath, "GET", "/health", timeoutMs);
556
- if (response.status === 200 && response.body.ok) {
557
- return response.body;
558
- }
559
- }
560
- catch (error) {
561
- if (!isConnectionError(error))
562
- throw error;
563
- }
564
- return null;
565
- };
566
- export const ensureDaemonRunning = async (socketPath) => {
567
- const inFlight = ensureDaemonRunningInFlight.get(socketPath);
568
- if (inFlight) {
569
- return await inFlight;
570
- }
571
- const ensure = (async () => {
572
- daemonFeaturesCache.delete(socketPath);
573
- const active = await readHealthyDaemon(socketPath, DAEMON_TIMEOUT_MS.health);
574
- if (active) {
575
- await pruneDuplicateDaemons(socketPath);
576
- const health = await maybeRestartDaemonForVersionMismatch(socketPath, active);
577
- await pruneSameSocketDaemons(socketPath, health.pid);
578
- return health;
579
- }
580
- await pruneDuplicateDaemons(socketPath);
581
- const existingDaemonPids = listDaemonPidsForSocket(socketPath);
582
- const socketExists = await hasSocketPath(socketPath);
583
- if (existingDaemonPids.length > 0 && !socketExists) {
584
- logger.warn("daemon_orphan_detected", {
585
- socketPath,
586
- pids: existingDaemonPids,
587
- });
588
- await terminateDaemonPids(socketPath, existingDaemonPids, "missing_socket");
589
- spawnDaemon(socketPath);
590
- const health = await waitForHealth(socketPath, 5000);
591
- await pruneSameSocketDaemons(socketPath, health.pid);
592
- return health;
593
- }
594
- const recoverTimeoutMs = existingDaemonPids.length > 0 ? ACTIVE_DAEMON_RECOVERY_TIMEOUT_MS : 1200;
595
- // If the daemon process still exists, prefer waiting for it to finish
596
- // in-flight work rather than replacing it on the same socket.
597
- try {
598
- const recovered = await waitForHealth(socketPath, recoverTimeoutMs);
599
- const health = await maybeRestartDaemonForVersionMismatch(socketPath, recovered);
600
- await pruneSameSocketDaemons(socketPath, health.pid);
601
- return health;
602
- }
603
- catch {
604
- // Fall through to daemon spawn when the existing socket truly is unhealthy.
605
- }
606
- if (existingDaemonPids.length > 0) {
607
- logger.warn("daemon_unhealthy_reaping_before_restart", {
608
- socketPath,
609
- pids: existingDaemonPids,
610
- });
611
- await terminateDaemonPids(socketPath, existingDaemonPids, "unhealthy_after_recovery_timeout");
612
- }
613
- spawnDaemon(socketPath);
614
- const health = await waitForHealth(socketPath, 5000);
615
- await pruneSameSocketDaemons(socketPath, health.pid);
616
- return health;
617
- })();
618
- ensureDaemonRunningInFlight.set(socketPath, ensure);
619
- try {
620
- return await ensure;
621
- }
622
- finally {
623
- if (ensureDaemonRunningInFlight.get(socketPath) === ensure) {
624
- ensureDaemonRunningInFlight.delete(socketPath);
625
- }
626
- }
627
- };
628
- // Best-effort: if dvbd is already running, ensure it's the same version as the
629
- // currently installed CLI package. This avoids a common footgun where upgrading
630
- // `dvb` leaves a long-running older dvbd process in place.
631
- //
632
- // Intentionally does not spawn the daemon if it's not running; callers that
633
- // need dvbd should use `ensureDaemonRunning`.
634
- export const ensureDaemonUpToDateIfRunning = async (socketPath) => {
635
- daemonFeaturesCache.delete(socketPath);
636
- const active = await readHealthyDaemon(socketPath, DAEMON_TIMEOUT_MS.health);
637
- if (active) {
638
- await pruneDuplicateDaemons(socketPath);
639
- const health = await maybeRestartDaemonForVersionMismatch(socketPath, active);
640
- await pruneSameSocketDaemons(socketPath, health.pid);
641
- return health;
642
- }
643
- return null;
644
- };
645
- export const __testOnly = {
646
- shouldRestartDaemonForRuntimeMismatch,
647
- };
648
- export const stopDaemon = async (socketPath) => {
649
- daemonFeaturesCache.delete(socketPath);
650
- try {
651
- const health = await requestJson(socketPath, "GET", "/health", DAEMON_TIMEOUT_MS.health);
652
- if (health.status === 200 && health.body.ok) {
653
- await terminateDaemonPid(socketPath, health.body.pid, "stop_daemon");
654
- return true;
655
- }
656
- }
657
- catch (error) {
658
- if (!isConnectionError(error))
659
- throw error;
660
- }
661
- const existingDaemonPids = listDaemonPidsForSocket(socketPath);
662
- if (existingDaemonPids.length === 0) {
663
- return false;
664
- }
665
- logger.warn("daemon_orphan_detected", {
666
- socketPath,
667
- pids: existingDaemonPids,
668
- });
669
- await terminateDaemonPids(socketPath, existingDaemonPids, "stop_daemon_orphan");
670
- if (await hasSocketPath(socketPath)) {
671
- logger.warn("daemon_socket_still_present_after_stop", {
672
- socketPath,
673
- });
674
- }
675
- return true;
676
- };
677
- //# sourceMappingURL=daemonClient.js.map