@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,1381 +0,0 @@
1
- import { spawn } from "node:child_process";
2
- import { createWriteStream } from "node:fs";
3
- import fs from "node:fs/promises";
4
- import os from "node:os";
5
- import path from "node:path";
6
- import { cancel, isCancel, log } from "@clack/prompts";
7
- import { loadLocalEnvSecretsScanPrompt, loadLocalExternalScanPrompt, loadLocalExtraArtifactsScanPrompt, loadLocalShellHistoryScanPrompt, loadLocalServicesScanPrompt, } from "./prompts.js";
8
- import { buildCodexProxyAuthorizationHeader, buildCodexProxyConfig, } from "./proxy.js";
9
- import { mergeCodexInitConfig } from "./config.js";
10
- import { buildCodexInitExecArgs } from "./execConfig.js";
11
- import { extractBoldText, extractProgressUpdateFromJsonLine, extractTurnCompletedFromJsonLine, extractThreadIdFromJsonLine, extractTurnFailureFromJsonLine, normalizeProgressMessage, stripAnsi, } from "./events.js";
12
- import { DEFAULT_CODEX_EXEC_MAX_ATTEMPTS, RetryableCodexExecError, computeCodexExecRetryDelayMs, delay, } from "./retry.js";
13
- import { DEFAULT_LOCAL_SCAN_SANDBOX_MODE, buildCodexExecAttemptArgs, buildLocalStructuredOutputExecArgs, } from "./localExecArgs.js";
14
- import { DEFAULT_SHELL_HISTORY_COMMAND_LIMIT, writeShellHistorySummary, } from "./shellHistory.js";
15
- import { formatRetryReason } from "./scanStatus.js";
16
- import { multiselectWithHelp } from "../clack.js";
17
- const CODEX_REQUEST_URL_REGEX = /error sending request for url \(([^)]+)\)/i;
18
- const extractRequestUrl = (value) => {
19
- const match = value.match(CODEX_REQUEST_URL_REGEX);
20
- const url = match?.[1]?.trim();
21
- return url && url.length > 0 ? url : null;
22
- };
23
- const isHostedAtBoxesRelay = (requestUrl) => {
24
- try {
25
- return new URL(requestUrl).hostname === "relay.boxes.dev";
26
- }
27
- catch {
28
- return false;
29
- }
30
- };
31
- const isRelayUsageLimitExceeded = (value) => {
32
- const requestUrl = extractRequestUrl(value);
33
- return (/usage limit exceeded/i.test(value) &&
34
- ((requestUrl !== null && isHostedAtBoxesRelay(requestUrl)) ||
35
- /https?:\/\/relay\.boxes\.dev\/v1\/responses/i.test(value)));
36
- };
37
- const isRelayForbidden = (value) => {
38
- const requestUrl = extractRequestUrl(value);
39
- return (/(unexpected status 403 Forbidden|403 Forbidden: forbidden)/i.test(value) &&
40
- requestUrl !== null &&
41
- (isHostedAtBoxesRelay(requestUrl) || isLoopbackRelayUrl(requestUrl)));
42
- };
43
- const isRelayMissingOpenAiProxyConfiguration = (value) => {
44
- const requestUrl = extractRequestUrl(value);
45
- return (/unexpected status 503 Service Unavailable/i.test(value) &&
46
- /missing OpenAI proxy configuration/i.test(value) &&
47
- requestUrl !== null &&
48
- (isHostedAtBoxesRelay(requestUrl) || isLoopbackRelayUrl(requestUrl)));
49
- };
50
- const isStreamDisconnected = (value) => /stream disconnected before completion/i.test(value) &&
51
- /error sending request for url \([^)]+\)/i.test(value);
52
- const isLoopbackRelayUrl = (requestUrl) => {
53
- try {
54
- const url = new URL(requestUrl);
55
- return (url.hostname === "127.0.0.1" ||
56
- url.hostname === "localhost" ||
57
- url.hostname === "::1");
58
- }
59
- catch {
60
- return false;
61
- }
62
- };
63
- const LOOPBACK_RELAY_HEALTH_TIMEOUT_MS = 3_000;
64
- const CODEX_EXEC_INACTIVITY_TIMEOUT_MS = 180_000;
65
- const CODEX_EXEC_FORCE_KILL_GRACE_MS = 5_000;
66
- const loopbackRelayHealthChecks = new Map();
67
- const resolveEffectiveCodexHome = () => {
68
- const configured = (process.env.CODEX_HOME ?? "").trim();
69
- return configured.length > 0 ? configured : path.join(os.homedir(), ".codex");
70
- };
71
- const HTTP_STATUS_REGEX = /unexpected status (\d{3})(?: ([^:\n]+))?/i;
72
- const toObjectRecord = (value) => typeof value === "object" && value !== null
73
- ? value
74
- : null;
75
- const truncateDiagnosticText = (value, maxChars = 4_000) => {
76
- const trimmed = stripAnsi(value ?? "").trim();
77
- if (!trimmed)
78
- return null;
79
- if (trimmed.length <= maxChars)
80
- return trimmed;
81
- return `...${trimmed.slice(-maxChars)}`;
82
- };
83
- const writeMetaLogBestEffort = async (metaLogPath, update) => {
84
- if (!metaLogPath)
85
- return;
86
- try {
87
- await fs.mkdir(path.dirname(metaLogPath), { recursive: true });
88
- await update(metaLogPath);
89
- }
90
- catch {
91
- // best effort diagnostics only
92
- }
93
- };
94
- const serializeErrorLike = (error) => {
95
- if (error instanceof Error) {
96
- const nodeError = error;
97
- return {
98
- name: error.name,
99
- message: error.message,
100
- code: nodeError.code ?? null,
101
- stack: truncateDiagnosticText(error.stack ?? error.message),
102
- };
103
- }
104
- return {
105
- name: null,
106
- message: truncateDiagnosticText(String(error)) ?? String(error),
107
- code: null,
108
- stack: null,
109
- };
110
- };
111
- const updateMetaLogFile = async (metaLogPath, update) => {
112
- let current = {};
113
- try {
114
- const raw = await fs.readFile(metaLogPath, "utf8");
115
- const parsed = JSON.parse(raw);
116
- current = toObjectRecord(parsed) ?? {};
117
- }
118
- catch {
119
- current = {};
120
- }
121
- const next = update(current);
122
- await fs.writeFile(metaLogPath, JSON.stringify(next, null, 2), "utf8");
123
- };
124
- const appendCodexExecAttemptMeta = async ({ metaLogPath, attempt, patch, }) => {
125
- await updateMetaLogFile(metaLogPath, (current) => {
126
- const currentCodexExec = toObjectRecord(current.codexExec) ?? {};
127
- const currentAttempts = Array.isArray(currentCodexExec.attempts)
128
- ? currentCodexExec.attempts
129
- : [];
130
- const nextAttempts = [...currentAttempts];
131
- const existingIndex = nextAttempts.findIndex((entry) => {
132
- const record = toObjectRecord(entry);
133
- return record?.attempt === attempt;
134
- });
135
- const existing = existingIndex >= 0
136
- ? (toObjectRecord(nextAttempts[existingIndex]) ?? {})
137
- : {};
138
- const nextEntry = {
139
- ...existing,
140
- attempt,
141
- ...patch,
142
- };
143
- if (existingIndex >= 0) {
144
- nextAttempts[existingIndex] = nextEntry;
145
- }
146
- else {
147
- nextAttempts.push(nextEntry);
148
- }
149
- return {
150
- ...current,
151
- codexExec: {
152
- ...currentCodexExec,
153
- attempts: nextAttempts,
154
- },
155
- };
156
- });
157
- };
158
- const updateCodexExecMeta = async ({ metaLogPath, patch, }) => {
159
- await updateMetaLogFile(metaLogPath, (current) => {
160
- const currentCodexExec = toObjectRecord(current.codexExec) ?? {};
161
- return {
162
- ...current,
163
- codexExec: {
164
- ...currentCodexExec,
165
- ...patch,
166
- },
167
- };
168
- });
169
- };
170
- const collectCodexFailureSignals = (value) => {
171
- const requestUrl = extractRequestUrl(value);
172
- const isLoopbackRequestUrl = requestUrl !== null && isLoopbackRelayUrl(requestUrl);
173
- let requestHost = null;
174
- let requestPath = null;
175
- let requestProtocol = null;
176
- if (requestUrl) {
177
- try {
178
- const parsed = new URL(requestUrl);
179
- requestHost = parsed.host;
180
- requestPath = parsed.pathname;
181
- requestProtocol = parsed.protocol.replace(/:$/, "");
182
- }
183
- catch {
184
- requestHost = null;
185
- requestPath = null;
186
- requestProtocol = null;
187
- }
188
- }
189
- const statusMatch = value.match(HTTP_STATUS_REGEX);
190
- const parsedStatusCode = statusMatch?.[1]
191
- ? Number.parseInt(statusMatch[1], 10)
192
- : Number.NaN;
193
- return {
194
- requestUrl,
195
- requestHost,
196
- requestPath,
197
- requestProtocol,
198
- httpStatusCode: Number.isFinite(parsedStatusCode) ? parsedStatusCode : null,
199
- httpStatusText: statusMatch?.[2]?.trim() || null,
200
- isLoopbackRequestUrl,
201
- isStreamDisconnected: isStreamDisconnected(value),
202
- isRelayUsageLimitExceeded: isRelayUsageLimitExceeded(value),
203
- isRelayForbidden: isRelayForbidden(value),
204
- isRelayMissingOpenAiProxyConfiguration: isRelayMissingOpenAiProxyConfiguration(value),
205
- };
206
- };
207
- const buildRetryPrompt = (basePrompt, retryFeedback) => retryFeedback
208
- ? [
209
- basePrompt,
210
- "",
211
- "Retry feedback:",
212
- retryFeedback.trim(),
213
- "",
214
- "Re-run the scan and return corrected JSON.",
215
- ]
216
- .filter((line) => line.length > 0)
217
- .join("\n")
218
- : basePrompt;
219
- const formatCodexRetryProgress = ({ attempt, maxAttempts, delayMs, sessionId, reason, }) => {
220
- const nextAttempt = attempt + 1;
221
- const delaySeconds = Math.max(1, Math.ceil(delayMs / 1000));
222
- const mode = sessionId
223
- ? "continuing existing session"
224
- : "starting a fresh session";
225
- return `retry ${nextAttempt}/${maxAttempts} in ${delaySeconds}s (${mode}): ${formatRetryReason(reason)}`;
226
- };
227
- const describeLoopbackRelayHealthError = (error) => {
228
- if (error instanceof DOMException && error.name === "TimeoutError") {
229
- return "timed out";
230
- }
231
- const code = error?.code ??
232
- error?.cause?.code;
233
- if (code === "ECONNREFUSED")
234
- return "was refused";
235
- if (code === "ENOTFOUND" || code === "EAI_AGAIN" || code === "ETIMEDOUT") {
236
- return "was unreachable";
237
- }
238
- return error instanceof Error ? error.message : String(error);
239
- };
240
- const createLoopbackRelayHealthError = ({ healthUrl, detail, }) => new Error(`Codex scan failed: local relay health check ${detail} at ${healthUrl}. Start or restart it with \`just dev\` and retry with \`dvb init --resume\`.`);
241
- const createCodexExecInactivityError = (inactivityTimeoutMs) => new Error(`Codex scan failed: Codex session produced no output for ${Math.ceil(inactivityTimeoutMs / 1000)}s and did not complete. Retry with \`dvb init --resume\`.`);
242
- const summarizeLocalCodexFailureDetail = ({ detail, turnFailedMessage, }) => {
243
- const candidate = turnFailedMessage?.trim() || detail.trim();
244
- if (!candidate)
245
- return null;
246
- return candidate.length <= 500 ? candidate : `${candidate.slice(0, 500)}...`;
247
- };
248
- const ensureLoopbackRelayHealthy = async (relayBaseUrl) => {
249
- if (!isLoopbackRelayUrl(relayBaseUrl))
250
- return;
251
- const normalizedRelayBaseUrl = new URL(relayBaseUrl).toString();
252
- const inFlight = loopbackRelayHealthChecks.get(normalizedRelayBaseUrl);
253
- if (inFlight) {
254
- return await inFlight;
255
- }
256
- const healthUrl = new URL("/health", normalizedRelayBaseUrl).toString();
257
- const check = (async () => {
258
- try {
259
- const response = await fetch(healthUrl, {
260
- method: "GET",
261
- signal: AbortSignal.timeout(LOOPBACK_RELAY_HEALTH_TIMEOUT_MS),
262
- });
263
- if (!response.ok) {
264
- throw createLoopbackRelayHealthError({
265
- healthUrl,
266
- detail: `returned HTTP ${response.status}`,
267
- });
268
- }
269
- }
270
- catch (error) {
271
- if (error instanceof Error &&
272
- error.message.includes("local relay health check")) {
273
- throw error;
274
- }
275
- throw createLoopbackRelayHealthError({
276
- healthUrl,
277
- detail: describeLoopbackRelayHealthError(error),
278
- });
279
- }
280
- })();
281
- loopbackRelayHealthChecks.set(normalizedRelayBaseUrl, check);
282
- try {
283
- await check;
284
- }
285
- catch (error) {
286
- if (loopbackRelayHealthChecks.get(normalizedRelayBaseUrl) === check) {
287
- loopbackRelayHealthChecks.delete(normalizedRelayBaseUrl);
288
- }
289
- throw error;
290
- }
291
- };
292
- const classifyCodexExecFailure = ({ combinedOutput, detail, exitCode, turnCompleted, turnFailedMessage, }) => {
293
- const failureOutput = turnFailedMessage
294
- ? `${combinedOutput}\n${turnFailedMessage}`
295
- : combinedOutput;
296
- const signals = collectCodexFailureSignals(failureOutput);
297
- const requestUrl = signals.requestUrl;
298
- const failureDetail = summarizeLocalCodexFailureDetail({
299
- detail,
300
- turnFailedMessage,
301
- });
302
- const detailSuffix = failureDetail ? ` Detail: ${failureDetail}` : "";
303
- if (exitCode === 0 && turnCompleted && !turnFailedMessage) {
304
- return null;
305
- }
306
- if (signals.isRelayUsageLimitExceeded) {
307
- const requestTarget = requestUrl ?? "https://relay.boxes.dev/v1/responses";
308
- return {
309
- error: new Error(`Codex scan failed: relay proxy usage limit exceeded while calling ${requestTarget}. Run \`dvb setup --codex-auth byo\` to use your own Codex auth, then retry with \`dvb init --resume\`.${detailSuffix}`),
310
- retryable: false,
311
- classifier: "relay_usage_limit",
312
- signals,
313
- };
314
- }
315
- if (signals.isRelayForbidden) {
316
- return {
317
- error: new Error("Codex scan failed: relay proxy returned 403 forbidden. If you're using a dev/local relay config, keep local scans on that relay or run `dvb setup --codex-auth byo`, then retry with `dvb init --resume`."),
318
- retryable: false,
319
- classifier: "relay_forbidden",
320
- signals,
321
- };
322
- }
323
- if (signals.isRelayMissingOpenAiProxyConfiguration) {
324
- return {
325
- error: new Error("Codex scan failed: relay proxy is missing OPENAI_API_KEY configuration. Re-run `just dev` so the relay tunnel deploy includes OPENAI_API_KEY, then retry with `dvb init --resume`."),
326
- retryable: false,
327
- classifier: "relay_missing_openai_proxy_configuration",
328
- signals,
329
- };
330
- }
331
- if (signals.isStreamDisconnected) {
332
- if (requestUrl && signals.isLoopbackRequestUrl) {
333
- return {
334
- error: new Error(`Codex scan failed: local relay is unreachable at ${requestUrl}. This dev CLI is configured for a local relay; start it with \`just dev\` and retry with \`dvb init --resume\`.`),
335
- retryable: false,
336
- classifier: "stream_disconnected_loopback",
337
- signals,
338
- };
339
- }
340
- const requestTarget = requestUrl ?? "relay /v1/responses endpoint";
341
- return {
342
- error: new Error(`Codex scan failed: transport disconnected while calling ${requestTarget}. Check relay health/auth and retry with \`dvb init --resume\`.`),
343
- retryable: true,
344
- classifier: "stream_disconnected_transport",
345
- signals,
346
- };
347
- }
348
- if (/no last agent message/i.test(failureOutput)) {
349
- return {
350
- error: new Error("Codex scan failed: Codex session ended without a final response. Retry with `dvb init --resume`."),
351
- retryable: true,
352
- classifier: "no_last_agent_message",
353
- signals,
354
- };
355
- }
356
- if (turnFailedMessage) {
357
- const normalized = turnFailedMessage.trim();
358
- return {
359
- error: new Error(normalized
360
- ? `Codex scan failed: ${normalized}`
361
- : "Codex scan failed: Codex turn failed."),
362
- retryable: true,
363
- classifier: "turn_failed",
364
- signals,
365
- };
366
- }
367
- if (exitCode === null) {
368
- return {
369
- error: new Error("Codex scan failed: Codex session ended before reporting an exit status. Retry with `dvb init --resume`."),
370
- retryable: true,
371
- classifier: "missing_exit_status",
372
- signals,
373
- };
374
- }
375
- if (exitCode === 0) {
376
- return null;
377
- }
378
- const suffix = detail ? `: ${detail}` : "";
379
- return {
380
- error: new Error(`codex exec failed (exit ${exitCode})${suffix}`),
381
- retryable: false,
382
- classifier: "nonzero_exit",
383
- signals,
384
- };
385
- };
386
- const runCodexExec = async (cwd, commandArgs, onProgress, logOptions = {}) => {
387
- const { stdoutLogPath, stderrLogPath, metaLogPath, proxyOptions, trustedPaths = [], onRetry, inactivityTimeoutMs = CODEX_EXEC_INACTIVITY_TIMEOUT_MS, forceKillGraceMs = CODEX_EXEC_FORCE_KILL_GRACE_MS, } = logOptions;
388
- let stdoutStream = null;
389
- let stderrStream = null;
390
- let tempCodexHome = null;
391
- let childEnv = process.env;
392
- try {
393
- if (stdoutLogPath) {
394
- await fs.mkdir(path.dirname(stdoutLogPath), { recursive: true });
395
- stdoutStream = createWriteStream(stdoutLogPath, { flags: "a" });
396
- }
397
- if (stderrLogPath) {
398
- await fs.mkdir(path.dirname(stderrLogPath), { recursive: true });
399
- stderrStream = createWriteStream(stderrLogPath, { flags: "a" });
400
- }
401
- }
402
- catch {
403
- stdoutStream = null;
404
- stderrStream = null;
405
- }
406
- if (proxyOptions || trustedPaths.length > 0) {
407
- try {
408
- tempCodexHome = await fs.mkdtemp(path.join(os.tmpdir(), "devbox-codex-"));
409
- const configPath = path.join(tempCodexHome, "config.toml");
410
- const configContent = proxyOptions
411
- ? buildCodexProxyConfig({
412
- relayBaseUrl: proxyOptions.relayBaseUrl,
413
- trustedPaths,
414
- })
415
- : mergeCodexInitConfig({
416
- existingContent: await (async () => {
417
- try {
418
- return await fs.readFile(path.join(resolveEffectiveCodexHome(), "config.toml"), "utf8");
419
- }
420
- catch {
421
- return null;
422
- }
423
- })(),
424
- trustedPaths,
425
- });
426
- await fs.writeFile(configPath, configContent, {
427
- encoding: "utf8",
428
- mode: 0o600,
429
- });
430
- try {
431
- await fs.chmod(configPath, 0o600);
432
- }
433
- catch {
434
- // best effort on filesystems that do not support chmod
435
- }
436
- if (!proxyOptions) {
437
- const sourceAuthPath = path.join(resolveEffectiveCodexHome(), "auth.json");
438
- const targetAuthPath = path.join(tempCodexHome, "auth.json");
439
- try {
440
- await fs.copyFile(sourceAuthPath, targetAuthPath);
441
- try {
442
- await fs.chmod(targetAuthPath, 0o600);
443
- }
444
- catch {
445
- // best effort on filesystems that do not support chmod
446
- }
447
- }
448
- catch {
449
- // Missing local auth is handled by Codex itself if direct scans need it.
450
- }
451
- }
452
- childEnv = {
453
- ...process.env,
454
- CODEX_HOME: tempCodexHome,
455
- ...(proxyOptions
456
- ? {
457
- DEVBOX_TOKEN: buildCodexProxyAuthorizationHeader(proxyOptions.controlPlaneToken),
458
- }
459
- : {}),
460
- };
461
- }
462
- catch (error) {
463
- if (tempCodexHome) {
464
- await fs.rm(tempCodexHome, { recursive: true, force: true });
465
- }
466
- throw error;
467
- }
468
- }
469
- const closeStream = async (stream) => {
470
- if (!stream)
471
- return;
472
- await new Promise((resolve) => stream.end(() => resolve()));
473
- };
474
- try {
475
- const relayBaseUrl = proxyOptions?.relayBaseUrl ?? null;
476
- const relayHealthUrl = relayBaseUrl && isLoopbackRelayUrl(relayBaseUrl)
477
- ? new URL("/health", relayBaseUrl).toString()
478
- : null;
479
- await writeMetaLogBestEffort(metaLogPath, async (resolvedMetaLogPath) => {
480
- await updateCodexExecMeta({
481
- metaLogPath: resolvedMetaLogPath,
482
- patch: {
483
- startedAt: new Date().toISOString(),
484
- status: "running",
485
- executionPath: proxyOptions ? "proxy" : "direct",
486
- proxyConfigured: Boolean(proxyOptions),
487
- relayBaseUrl,
488
- relayBaseUrlIsLoopback: relayBaseUrl !== null && isLoopbackRelayUrl(relayBaseUrl),
489
- relayHealthCheck: relayHealthUrl === null
490
- ? {
491
- status: proxyOptions ? "not_required" : "not_configured",
492
- url: null,
493
- checkedAt: null,
494
- error: null,
495
- }
496
- : {
497
- status: "pending",
498
- url: relayHealthUrl,
499
- checkedAt: null,
500
- error: null,
501
- },
502
- trustedPaths,
503
- stdoutLogPath: stdoutLogPath ?? null,
504
- stderrLogPath: stderrLogPath ?? null,
505
- tempCodexHome,
506
- initialArgs: commandArgs.initialArgs,
507
- resumeExecArgs: commandArgs.resumeExecArgs,
508
- resumeSubcommandArgs: commandArgs.resumeSubcommandArgs,
509
- maxAttempts: DEFAULT_CODEX_EXEC_MAX_ATTEMPTS,
510
- },
511
- });
512
- });
513
- if (proxyOptions) {
514
- try {
515
- await ensureLoopbackRelayHealthy(proxyOptions.relayBaseUrl);
516
- if (relayHealthUrl) {
517
- await writeMetaLogBestEffort(metaLogPath, async (resolvedMetaLogPath) => {
518
- await updateCodexExecMeta({
519
- metaLogPath: resolvedMetaLogPath,
520
- patch: {
521
- relayHealthCheck: {
522
- status: "ok",
523
- url: relayHealthUrl,
524
- checkedAt: new Date().toISOString(),
525
- error: null,
526
- },
527
- },
528
- });
529
- });
530
- }
531
- }
532
- catch (error) {
533
- if (relayHealthUrl) {
534
- await writeMetaLogBestEffort(metaLogPath, async (resolvedMetaLogPath) => {
535
- await updateCodexExecMeta({
536
- metaLogPath: resolvedMetaLogPath,
537
- patch: {
538
- relayHealthCheck: {
539
- status: "failed",
540
- url: relayHealthUrl,
541
- checkedAt: new Date().toISOString(),
542
- error: serializeErrorLike(error),
543
- },
544
- status: "failed",
545
- finishedAt: new Date().toISOString(),
546
- finalError: serializeErrorLike(error),
547
- },
548
- });
549
- });
550
- }
551
- throw error;
552
- }
553
- }
554
- let resumeThreadId = commandArgs.resumeThreadId;
555
- let prompt = commandArgs.prompt;
556
- const runAttempt = async (attempt, attemptArgs, attemptResumeThreadId) => {
557
- const codexArgs = [
558
- "-a",
559
- "never",
560
- "exec",
561
- ...buildCodexInitExecArgs(),
562
- ...attemptArgs,
563
- ];
564
- await writeMetaLogBestEffort(metaLogPath, async (resolvedMetaLogPath) => {
565
- await appendCodexExecAttemptMeta({
566
- metaLogPath: resolvedMetaLogPath,
567
- attempt,
568
- patch: {
569
- startedAt: new Date().toISOString(),
570
- status: "running",
571
- mode: attemptResumeThreadId ? "resume" : "initial",
572
- resumeThreadId: attemptResumeThreadId,
573
- codexArgs: codexArgs.slice(0, -1),
574
- promptStrategy: attemptResumeThreadId ? "continue" : "initial",
575
- },
576
- });
577
- });
578
- return await new Promise((resolve, reject) => {
579
- const child = spawn("codex", codexArgs, {
580
- cwd,
581
- env: childEnv,
582
- stdio: ["ignore", "pipe", "pipe"],
583
- });
584
- let stdout = "";
585
- let stderr = "";
586
- let stdoutBuffer = "";
587
- let stderrBuffer = "";
588
- let lastProgressKey = null;
589
- let threadId = null;
590
- let turnCompleted = false;
591
- let turnFailedMessage = null;
592
- let inactivityTimedOut = false;
593
- let inactivityTimer = null;
594
- let forceKillTimer = null;
595
- const clearInactivityTimers = () => {
596
- if (inactivityTimer) {
597
- clearTimeout(inactivityTimer);
598
- inactivityTimer = null;
599
- }
600
- if (forceKillTimer) {
601
- clearTimeout(forceKillTimer);
602
- forceKillTimer = null;
603
- }
604
- };
605
- const scheduleInactivityTimeout = () => {
606
- if (inactivityTimeoutMs <= 0 || inactivityTimedOut)
607
- return;
608
- if (inactivityTimer) {
609
- clearTimeout(inactivityTimer);
610
- }
611
- inactivityTimer = setTimeout(() => {
612
- inactivityTimedOut = true;
613
- onProgress?.({
614
- kind: "command",
615
- message: `codex exec idle for ${Math.ceil(inactivityTimeoutMs / 1000)}s; restarting session`,
616
- });
617
- try {
618
- child.kill();
619
- }
620
- catch {
621
- // best effort
622
- }
623
- forceKillTimer = setTimeout(() => {
624
- try {
625
- child.kill("SIGKILL");
626
- }
627
- catch {
628
- // best effort
629
- }
630
- }, forceKillGraceMs);
631
- forceKillTimer.unref?.();
632
- }, inactivityTimeoutMs);
633
- inactivityTimer.unref?.();
634
- };
635
- const handleLine = (line) => {
636
- const clean = stripAnsi(line);
637
- if (!threadId) {
638
- const parsedThreadId = extractThreadIdFromJsonLine(clean);
639
- if (parsedThreadId) {
640
- threadId = parsedThreadId;
641
- }
642
- }
643
- if (!turnCompleted && extractTurnCompletedFromJsonLine(clean)) {
644
- turnCompleted = true;
645
- }
646
- const parsedTurnFailure = extractTurnFailureFromJsonLine(clean);
647
- if (parsedTurnFailure && !turnFailedMessage) {
648
- turnFailedMessage = parsedTurnFailure;
649
- }
650
- if (!onProgress)
651
- return;
652
- const parsed = extractProgressUpdateFromJsonLine(clean);
653
- if (parsed) {
654
- const progressKey = `${parsed.kind}:${parsed.message}`;
655
- if (progressKey === lastProgressKey)
656
- return;
657
- lastProgressKey = progressKey;
658
- onProgress(parsed);
659
- return;
660
- }
661
- if (clean.trimStart().startsWith("{"))
662
- return;
663
- const bold = normalizeProgressMessage(extractBoldText(clean));
664
- if (!bold)
665
- return;
666
- const progressKey = `reasoning:${bold}`;
667
- if (progressKey === lastProgressKey)
668
- return;
669
- lastProgressKey = progressKey;
670
- onProgress({ kind: "reasoning", message: bold });
671
- };
672
- const consume = (chunk, buffer, update) => {
673
- let next = buffer + chunk.toString();
674
- let idx = next.indexOf("\n");
675
- while (idx !== -1) {
676
- const line = next.slice(0, idx);
677
- handleLine(line);
678
- next = next.slice(idx + 1);
679
- idx = next.indexOf("\n");
680
- }
681
- update(next);
682
- };
683
- child.stdout?.on("data", (chunk) => {
684
- scheduleInactivityTimeout();
685
- stdout += chunk.toString();
686
- stdoutStream?.write(chunk);
687
- consume(chunk, stdoutBuffer, (next) => {
688
- stdoutBuffer = next;
689
- });
690
- });
691
- child.stderr?.on("data", (chunk) => {
692
- scheduleInactivityTimeout();
693
- stderr += chunk.toString();
694
- stderrStream?.write(chunk);
695
- consume(chunk, stderrBuffer, (next) => {
696
- stderrBuffer = next;
697
- });
698
- });
699
- scheduleInactivityTimeout();
700
- child.on("error", (error) => {
701
- clearInactivityTimers();
702
- void (async () => {
703
- await writeMetaLogBestEffort(metaLogPath, async (resolvedMetaLogPath) => {
704
- await appendCodexExecAttemptMeta({
705
- metaLogPath: resolvedMetaLogPath,
706
- attempt,
707
- patch: {
708
- finishedAt: new Date().toISOString(),
709
- status: "spawn_error",
710
- error: serializeErrorLike(error),
711
- },
712
- });
713
- });
714
- reject(error);
715
- })();
716
- });
717
- child.on("close", (code) => {
718
- void (async () => {
719
- clearInactivityTimers();
720
- if (stdoutBuffer)
721
- handleLine(stdoutBuffer);
722
- if (stderrBuffer)
723
- handleLine(stderrBuffer);
724
- const combinedOutput = `${stderr}\n${stdout}`;
725
- const detail = stderr.trim() || stdout.trim();
726
- const sessionId = threadId ?? attemptResumeThreadId;
727
- const baseAttemptPatch = {
728
- finishedAt: new Date().toISOString(),
729
- exitCode: code,
730
- threadId,
731
- sessionId,
732
- turnFailedMessage: turnFailedMessage?.trim() || null,
733
- stdoutTail: truncateDiagnosticText(stdout),
734
- stderrTail: truncateDiagnosticText(stderr),
735
- combinedOutputTail: truncateDiagnosticText(combinedOutput),
736
- detailTail: truncateDiagnosticText(detail),
737
- };
738
- if (inactivityTimedOut) {
739
- const inactivityError = createCodexExecInactivityError(inactivityTimeoutMs);
740
- await writeMetaLogBestEffort(metaLogPath, async (resolvedMetaLogPath) => {
741
- await appendCodexExecAttemptMeta({
742
- metaLogPath: resolvedMetaLogPath,
743
- attempt,
744
- patch: {
745
- ...baseAttemptPatch,
746
- status: "retryable_failure",
747
- failureMode: "inactivity_timeout",
748
- retryable: true,
749
- errorMessage: inactivityError.message,
750
- },
751
- });
752
- });
753
- reject(new RetryableCodexExecError(inactivityError.message, sessionId));
754
- return;
755
- }
756
- const failure = classifyCodexExecFailure({
757
- combinedOutput,
758
- detail,
759
- exitCode: code,
760
- turnCompleted,
761
- turnFailedMessage,
762
- });
763
- if (!failure) {
764
- await writeMetaLogBestEffort(metaLogPath, async (resolvedMetaLogPath) => {
765
- await appendCodexExecAttemptMeta({
766
- metaLogPath: resolvedMetaLogPath,
767
- attempt,
768
- patch: {
769
- ...baseAttemptPatch,
770
- status: "success",
771
- },
772
- });
773
- });
774
- resolve({ threadId: sessionId });
775
- return;
776
- }
777
- await writeMetaLogBestEffort(metaLogPath, async (resolvedMetaLogPath) => {
778
- await appendCodexExecAttemptMeta({
779
- metaLogPath: resolvedMetaLogPath,
780
- attempt,
781
- patch: {
782
- ...baseAttemptPatch,
783
- status: failure.retryable ? "retryable_failure" : "failed",
784
- classifier: failure.classifier,
785
- retryable: failure.retryable,
786
- errorMessage: failure.error.message,
787
- signals: failure.signals,
788
- },
789
- });
790
- });
791
- if (failure.retryable) {
792
- reject(new RetryableCodexExecError(failure.error.message, sessionId));
793
- return;
794
- }
795
- reject(failure.error);
796
- })();
797
- });
798
- });
799
- };
800
- for (let attempt = 1; attempt <= DEFAULT_CODEX_EXEC_MAX_ATTEMPTS; attempt += 1) {
801
- const attemptArgs = buildCodexExecAttemptArgs({
802
- ...commandArgs,
803
- prompt,
804
- resumeThreadId,
805
- });
806
- try {
807
- const result = await runAttempt(attempt, attemptArgs, resumeThreadId);
808
- await writeMetaLogBestEffort(metaLogPath, async (resolvedMetaLogPath) => {
809
- await updateCodexExecMeta({
810
- metaLogPath: resolvedMetaLogPath,
811
- patch: {
812
- status: "success",
813
- finishedAt: new Date().toISOString(),
814
- finalThreadId: result.threadId,
815
- attemptsRun: attempt,
816
- },
817
- });
818
- });
819
- return result;
820
- }
821
- catch (error) {
822
- if (!(error instanceof RetryableCodexExecError) ||
823
- attempt >= DEFAULT_CODEX_EXEC_MAX_ATTEMPTS) {
824
- throw error;
825
- }
826
- resumeThreadId = error.sessionId ?? resumeThreadId;
827
- const delayMs = computeCodexExecRetryDelayMs(attempt);
828
- await writeMetaLogBestEffort(metaLogPath, async (resolvedMetaLogPath) => {
829
- await appendCodexExecAttemptMeta({
830
- metaLogPath: resolvedMetaLogPath,
831
- attempt,
832
- patch: {
833
- retryDelayMs: delayMs,
834
- retryScheduledAt: new Date().toISOString(),
835
- retrySessionId: resumeThreadId,
836
- retryReason: error.message,
837
- },
838
- });
839
- await updateCodexExecMeta({
840
- metaLogPath: resolvedMetaLogPath,
841
- patch: {
842
- status: "retrying",
843
- attemptsRun: attempt,
844
- nextAttempt: attempt + 1,
845
- retrySessionId: resumeThreadId,
846
- retryReason: error.message,
847
- },
848
- });
849
- });
850
- await onRetry?.({
851
- attempt,
852
- maxAttempts: DEFAULT_CODEX_EXEC_MAX_ATTEMPTS,
853
- delayMs,
854
- sessionId: resumeThreadId,
855
- reason: error.message,
856
- });
857
- await delay(delayMs);
858
- prompt = resumeThreadId ? "continue" : commandArgs.prompt;
859
- }
860
- }
861
- throw new Error("Codex exec failed after retries.");
862
- }
863
- catch (error) {
864
- await writeMetaLogBestEffort(metaLogPath, async (resolvedMetaLogPath) => {
865
- await updateCodexExecMeta({
866
- metaLogPath: resolvedMetaLogPath,
867
- patch: {
868
- status: "failed",
869
- finishedAt: new Date().toISOString(),
870
- finalError: serializeErrorLike(error),
871
- },
872
- });
873
- });
874
- throw error;
875
- }
876
- finally {
877
- await Promise.all([closeStream(stdoutStream), closeStream(stderrStream)]);
878
- if (tempCodexHome) {
879
- await fs.rm(tempCodexHome, { recursive: true, force: true });
880
- }
881
- }
882
- };
883
- const runLocalSetupEnvSecretsScan = async ({ cwd, logDir, schemaPath, outputPath, sandboxMode = DEFAULT_LOCAL_SCAN_SANDBOX_MODE, proxyOptions, onProgress, resumeThreadId, retryFeedback, }) => {
884
- const localScanPrompt = await loadLocalEnvSecretsScanPrompt();
885
- const stamp = new Date().toISOString().replace(/[:.]/g, "-");
886
- const stdoutLogPath = path.join(logDir, `codex-local-setup-env-secrets-scan-${stamp}.jsonl`);
887
- const stderrLogPath = path.join(logDir, `codex-local-setup-env-secrets-scan-${stamp}.stderr.log`);
888
- const metaLogPath = path.join(logDir, `codex-local-setup-env-secrets-scan-${stamp}.meta.json`);
889
- await fs.mkdir(logDir, { recursive: true, mode: 0o700 });
890
- try {
891
- await fs.chmod(logDir, 0o700);
892
- }
893
- catch {
894
- // best effort on filesystems that do not support chmod
895
- }
896
- await fs.mkdir(path.dirname(outputPath), { recursive: true });
897
- await fs.writeFile(metaLogPath, JSON.stringify({
898
- kind: "local-setup-env-secrets-scan",
899
- createdAt: new Date().toISOString(),
900
- cwd,
901
- logDir,
902
- schemaPath,
903
- outputPath,
904
- sandboxMode,
905
- prompt: localScanPrompt,
906
- resumedFromThreadId: resumeThreadId ?? null,
907
- retryFeedback: retryFeedback ?? null,
908
- }, null, 2), "utf8");
909
- const prompt = buildRetryPrompt(localScanPrompt, retryFeedback);
910
- const result = await runCodexExec(cwd, {
911
- ...buildLocalStructuredOutputExecArgs({
912
- schemaPath,
913
- outputPath,
914
- sandboxMode,
915
- }),
916
- prompt,
917
- resumeThreadId: resumeThreadId ?? null,
918
- }, onProgress, {
919
- stdoutLogPath,
920
- stderrLogPath,
921
- metaLogPath,
922
- ...(proxyOptions ? { proxyOptions } : {}),
923
- trustedPaths: [cwd],
924
- ...(onProgress
925
- ? {
926
- onRetry: (info) => {
927
- onProgress({
928
- kind: "command",
929
- message: formatCodexRetryProgress(info),
930
- });
931
- },
932
- }
933
- : {}),
934
- });
935
- return result.threadId;
936
- };
937
- const runLocalSetupExternalScan = async ({ cwd, logDir, schemaPath, outputPath, homeDir, sandboxMode = DEFAULT_LOCAL_SCAN_SANDBOX_MODE, proxyOptions, onProgress, resumeThreadId, retryFeedback, }) => {
938
- const localScanPrompt = await loadLocalExternalScanPrompt();
939
- const stamp = new Date().toISOString().replace(/[:.]/g, "-");
940
- const stdoutLogPath = path.join(logDir, `codex-local-setup-external-scan-${stamp}.jsonl`);
941
- const stderrLogPath = path.join(logDir, `codex-local-setup-external-scan-${stamp}.stderr.log`);
942
- const metaLogPath = path.join(logDir, `codex-local-setup-external-scan-${stamp}.meta.json`);
943
- await fs.mkdir(logDir, { recursive: true, mode: 0o700 });
944
- try {
945
- await fs.chmod(logDir, 0o700);
946
- }
947
- catch {
948
- // best effort on filesystems that do not support chmod
949
- }
950
- await fs.mkdir(path.dirname(outputPath), { recursive: true });
951
- await fs.writeFile(metaLogPath, JSON.stringify({
952
- kind: "local-setup-external-scan",
953
- createdAt: new Date().toISOString(),
954
- cwd,
955
- logDir,
956
- schemaPath,
957
- outputPath,
958
- sandboxMode,
959
- prompt: localScanPrompt,
960
- resumedFromThreadId: resumeThreadId ?? null,
961
- retryFeedback: retryFeedback ?? null,
962
- }, null, 2), "utf8");
963
- const prompt = buildRetryPrompt(localScanPrompt, retryFeedback);
964
- const structuredArgs = buildLocalStructuredOutputExecArgs({
965
- schemaPath,
966
- outputPath,
967
- sandboxMode,
968
- addDirs: homeDir ? [homeDir] : [],
969
- });
970
- const result = await runCodexExec(cwd, {
971
- ...structuredArgs,
972
- prompt,
973
- resumeThreadId: resumeThreadId ?? null,
974
- }, onProgress, {
975
- stdoutLogPath,
976
- stderrLogPath,
977
- metaLogPath,
978
- ...(proxyOptions ? { proxyOptions } : {}),
979
- trustedPaths: homeDir ? [cwd, homeDir] : [cwd],
980
- ...(onProgress
981
- ? {
982
- onRetry: (info) => {
983
- onProgress({
984
- kind: "command",
985
- message: formatCodexRetryProgress(info),
986
- });
987
- },
988
- }
989
- : {}),
990
- });
991
- return result.threadId;
992
- };
993
- const runLocalShellHistoryScan = async ({ cwd, logDir, schemaPath, outputPath, homeDir, sandboxMode = DEFAULT_LOCAL_SCAN_SANDBOX_MODE, proxyOptions, onProgress, resumeThreadId, retryFeedback, }) => {
994
- const historySummaryPath = path.join(path.dirname(outputPath), "shell-history-summary.json");
995
- const historySummary = await writeShellHistorySummary({
996
- outputPath: historySummaryPath,
997
- ...(homeDir ? { homeDir } : {}),
998
- limit: DEFAULT_SHELL_HISTORY_COMMAND_LIMIT,
999
- });
1000
- const localScanPrompt = await loadLocalShellHistoryScanPrompt(historySummaryPath);
1001
- const stamp = new Date().toISOString().replace(/[:.]/g, "-");
1002
- const stdoutLogPath = path.join(logDir, `codex-local-shell-history-scan-${stamp}.jsonl`);
1003
- const stderrLogPath = path.join(logDir, `codex-local-shell-history-scan-${stamp}.stderr.log`);
1004
- const metaLogPath = path.join(logDir, `codex-local-shell-history-scan-${stamp}.meta.json`);
1005
- await fs.mkdir(logDir, { recursive: true, mode: 0o700 });
1006
- try {
1007
- await fs.chmod(logDir, 0o700);
1008
- }
1009
- catch {
1010
- // best effort on filesystems that do not support chmod
1011
- }
1012
- await fs.mkdir(path.dirname(outputPath), { recursive: true });
1013
- await fs.writeFile(metaLogPath, JSON.stringify({
1014
- kind: "local-shell-history-scan",
1015
- createdAt: new Date().toISOString(),
1016
- cwd,
1017
- logDir,
1018
- schemaPath,
1019
- outputPath,
1020
- historySummaryPath,
1021
- sandboxMode,
1022
- historySummary: {
1023
- sourceShell: historySummary.sourceShell,
1024
- collectionMethod: historySummary.collectionMethod,
1025
- collectedCommandCount: historySummary.collectedCommandCount,
1026
- commandCounts: historySummary.commandCounts.slice(0, 20),
1027
- },
1028
- prompt: localScanPrompt,
1029
- resumedFromThreadId: resumeThreadId ?? null,
1030
- retryFeedback: retryFeedback ?? null,
1031
- }, null, 2), "utf8");
1032
- const prompt = buildRetryPrompt(localScanPrompt, retryFeedback);
1033
- const trustedPathSet = new Set([cwd]);
1034
- const addDirPaths = new Set([path.dirname(historySummaryPath)]);
1035
- const scanCwd = path.dirname(historySummaryPath);
1036
- if (homeDir) {
1037
- trustedPathSet.add(homeDir);
1038
- addDirPaths.add(homeDir);
1039
- }
1040
- const structuredArgs = buildLocalStructuredOutputExecArgs({
1041
- schemaPath,
1042
- outputPath,
1043
- sandboxMode,
1044
- addDirs: [...addDirPaths],
1045
- skipGitRepoCheck: true,
1046
- });
1047
- const result = await runCodexExec(scanCwd, {
1048
- ...structuredArgs,
1049
- prompt,
1050
- resumeThreadId: resumeThreadId ?? null,
1051
- }, onProgress, {
1052
- stdoutLogPath,
1053
- stderrLogPath,
1054
- metaLogPath,
1055
- ...(proxyOptions ? { proxyOptions } : {}),
1056
- trustedPaths: [...trustedPathSet, path.dirname(historySummaryPath)],
1057
- ...(onProgress
1058
- ? {
1059
- onRetry: (info) => {
1060
- onProgress({
1061
- kind: "command",
1062
- message: formatCodexRetryProgress(info),
1063
- });
1064
- },
1065
- }
1066
- : {}),
1067
- });
1068
- return result.threadId;
1069
- };
1070
- const runLocalSetupExtraArtifactsScan = async ({ cwd, logDir, schemaPath, outputPath, sandboxMode = DEFAULT_LOCAL_SCAN_SANDBOX_MODE, proxyOptions, onProgress, resumeThreadId, retryFeedback, }) => {
1071
- const localScanPrompt = await loadLocalExtraArtifactsScanPrompt();
1072
- const stamp = new Date().toISOString().replace(/[:.]/g, "-");
1073
- const stdoutLogPath = path.join(logDir, `codex-local-setup-extra-artifacts-scan-${stamp}.jsonl`);
1074
- const stderrLogPath = path.join(logDir, `codex-local-setup-extra-artifacts-scan-${stamp}.stderr.log`);
1075
- const metaLogPath = path.join(logDir, `codex-local-setup-extra-artifacts-scan-${stamp}.meta.json`);
1076
- await fs.mkdir(logDir, { recursive: true, mode: 0o700 });
1077
- try {
1078
- await fs.chmod(logDir, 0o700);
1079
- }
1080
- catch {
1081
- // best effort on filesystems that do not support chmod
1082
- }
1083
- await fs.mkdir(path.dirname(outputPath), { recursive: true });
1084
- await fs.writeFile(metaLogPath, JSON.stringify({
1085
- kind: "local-setup-extra-artifacts-scan",
1086
- createdAt: new Date().toISOString(),
1087
- cwd,
1088
- logDir,
1089
- schemaPath,
1090
- outputPath,
1091
- sandboxMode,
1092
- prompt: localScanPrompt,
1093
- resumedFromThreadId: resumeThreadId ?? null,
1094
- retryFeedback: retryFeedback ?? null,
1095
- }, null, 2), "utf8");
1096
- const prompt = buildRetryPrompt(localScanPrompt, retryFeedback);
1097
- const result = await runCodexExec(cwd, {
1098
- ...buildLocalStructuredOutputExecArgs({
1099
- schemaPath,
1100
- outputPath,
1101
- sandboxMode,
1102
- }),
1103
- prompt,
1104
- resumeThreadId: resumeThreadId ?? null,
1105
- }, onProgress, {
1106
- stdoutLogPath,
1107
- stderrLogPath,
1108
- metaLogPath,
1109
- ...(proxyOptions ? { proxyOptions } : {}),
1110
- trustedPaths: [cwd],
1111
- ...(onProgress
1112
- ? {
1113
- onRetry: (info) => {
1114
- onProgress({
1115
- kind: "command",
1116
- message: formatCodexRetryProgress(info),
1117
- });
1118
- },
1119
- }
1120
- : {}),
1121
- });
1122
- return result.threadId;
1123
- };
1124
- const runLocalServicesScan = async ({ cwd, logDir, schemaPath, outputPath, homeDir, sandboxMode = DEFAULT_LOCAL_SCAN_SANDBOX_MODE, proxyOptions, onProgress, resumeThreadId, retryFeedback, }) => {
1125
- const servicesScanPrompt = await loadLocalServicesScanPrompt();
1126
- const stamp = new Date().toISOString().replace(/[:.]/g, "-");
1127
- const stdoutLogPath = path.join(logDir, `codex-local-services-scan-${stamp}.jsonl`);
1128
- const stderrLogPath = path.join(logDir, `codex-local-services-scan-${stamp}.stderr.log`);
1129
- const metaLogPath = path.join(logDir, `codex-local-services-scan-${stamp}.meta.json`);
1130
- await fs.mkdir(logDir, { recursive: true, mode: 0o700 });
1131
- await fs.mkdir(path.dirname(outputPath), { recursive: true, mode: 0o700 });
1132
- try {
1133
- await fs.chmod(logDir, 0o700);
1134
- }
1135
- catch {
1136
- // best effort on filesystems that do not support chmod
1137
- }
1138
- await fs.writeFile(metaLogPath, JSON.stringify({
1139
- kind: "local-services-scan",
1140
- createdAt: new Date().toISOString(),
1141
- cwd,
1142
- logDir,
1143
- schemaPath,
1144
- outputPath,
1145
- sandboxMode,
1146
- prompt: servicesScanPrompt,
1147
- resumedFromThreadId: resumeThreadId ?? null,
1148
- retryFeedback: retryFeedback ?? null,
1149
- }, null, 2), "utf8");
1150
- const prompt = buildRetryPrompt(servicesScanPrompt, retryFeedback);
1151
- const structuredArgs = buildLocalStructuredOutputExecArgs({
1152
- schemaPath,
1153
- outputPath,
1154
- sandboxMode,
1155
- addDirs: homeDir ? [homeDir] : [],
1156
- });
1157
- const result = await runCodexExec(cwd, {
1158
- ...structuredArgs,
1159
- prompt,
1160
- resumeThreadId: resumeThreadId ?? null,
1161
- }, onProgress, {
1162
- stdoutLogPath,
1163
- stderrLogPath,
1164
- metaLogPath,
1165
- ...(proxyOptions ? { proxyOptions } : {}),
1166
- trustedPaths: homeDir ? [cwd, homeDir] : [cwd],
1167
- ...(onProgress
1168
- ? {
1169
- onRetry: (info) => {
1170
- onProgress({
1171
- kind: "command",
1172
- message: formatCodexRetryProgress(info),
1173
- });
1174
- },
1175
- }
1176
- : {}),
1177
- });
1178
- return result.threadId;
1179
- };
1180
- const toPosixPath = (value) => value.split(path.sep).join(path.posix.sep);
1181
- const toRepoRelativePath = (repoRoot, filePath) => {
1182
- const resolved = path.isAbsolute(filePath)
1183
- ? filePath
1184
- : path.resolve(repoRoot, filePath);
1185
- const relative = path.relative(repoRoot, resolved) || filePath;
1186
- return toPosixPath(relative);
1187
- };
1188
- const countSecretVars = (vars) => vars.reduce((count, entry) => count + (entry.isSecret ? 1 : 0), 0);
1189
- const buildEnvFileHint = (entry) => {
1190
- const usageText = entry.usage?.trim() || "none";
1191
- const secrets = countSecretVars(entry.vars);
1192
- const varsText = `${entry.vars.length} var${entry.vars.length === 1 ? "" : "s"}`;
1193
- const secretsText = `${secrets} secret${secrets === 1 ? "" : "s"}`;
1194
- return `${varsText}\n${secretsText}\n${usageText}`;
1195
- };
1196
- const buildExternalDependencyLabel = (entry) => entry.version ? `${entry.name}@${entry.version}` : entry.name;
1197
- const setupApprovalPrefaceLines = [
1198
- "We scanned this repo and your machine, and built an inventory of what's needed to recreate this dev environment on the devbox.",
1199
- "",
1200
- "You'll be able to approve which files we'll send to the remote, which external dependencies we'll install, and what entry point the remote coding agent will use to run your app to make sure it can run.",
1201
- ];
1202
- const setupApprovalSectionExplainers = {
1203
- envFiles: "Selected .env files will be copied to the devbox repo so your app can run with the same environment values as your local machine.",
1204
- secretFiles: "Selected secret and config files will be copied to the devbox.",
1205
- extraArtifacts: "Selected .gitignored files and directories will be copied into the devbox workspace unchanged.",
1206
- externalDependencies: "Selected external dependencies will be installed on the devbox so the remote environment matches your local setup.",
1207
- externalConfigs: "Selected files from outside the repo will be staged on the devbox so remote setup can place them where Linux expects them.",
1208
- appEntrypoints: "Selected app commands will be run on the devbox during setup to verify the app starts cleanly there.",
1209
- backgroundServices: "Selected background services will be written into devbox service config and enabled on the devbox.",
1210
- };
1211
- const showApprovalExplainer = (message) => {
1212
- log.message(message, { withGuide: false });
1213
- };
1214
- const promptForPlanApproval = async ({ plan, repoRoot, initialPlan, }) => {
1215
- log.step("Review setup findings");
1216
- const envFileOptions = plan.envFiles.map((entry) => ({
1217
- value: entry.path,
1218
- label: toRepoRelativePath(repoRoot, entry.path),
1219
- hint: buildEnvFileHint(entry),
1220
- }));
1221
- const secretFileOptions = plan.secretFiles.map((entry) => ({
1222
- value: entry.path,
1223
- label: toRepoRelativePath(repoRoot, entry.path),
1224
- hint: entry.description,
1225
- }));
1226
- const extraArtifactOptions = plan.extraArtifacts.map((entry) => ({
1227
- value: entry.path,
1228
- label: toRepoRelativePath(repoRoot, entry.path),
1229
- hint: entry.description,
1230
- }));
1231
- const externalDependencyOptions = plan.externalDependencies.map((entry) => ({
1232
- value: entry.name,
1233
- label: buildExternalDependencyLabel(entry),
1234
- hint: entry.evidence ? `Evidence: ${entry.evidence}` : "Evidence: none",
1235
- }));
1236
- const externalConfigOptions = plan.externalConfigs.map((entry) => ({
1237
- value: entry.path,
1238
- label: toRepoRelativePath(repoRoot, entry.path),
1239
- hint: entry.description,
1240
- }));
1241
- let envFileSelection = [];
1242
- if (plan.envFiles.length > 0) {
1243
- showApprovalExplainer(setupApprovalSectionExplainers.envFiles);
1244
- envFileSelection = await multiselectWithHelp({
1245
- message: "Select .env files to copy to the devbox",
1246
- options: envFileOptions,
1247
- initialValues: initialPlan?.envFiles.map((entry) => entry.path) ??
1248
- plan.envFiles.map((entry) => entry.path),
1249
- required: false,
1250
- });
1251
- }
1252
- if (isCancel(envFileSelection)) {
1253
- cancel("Init canceled.");
1254
- throw new Error("Init canceled.");
1255
- }
1256
- let secretFileSelection = [];
1257
- if (plan.secretFiles.length > 0) {
1258
- showApprovalExplainer(setupApprovalSectionExplainers.secretFiles);
1259
- secretFileSelection = await multiselectWithHelp({
1260
- message: "Select secret/config files to copy to the devbox",
1261
- options: secretFileOptions,
1262
- initialValues: initialPlan?.secretFiles.map((entry) => entry.path) ??
1263
- plan.secretFiles.map((entry) => entry.path),
1264
- required: false,
1265
- });
1266
- }
1267
- if (isCancel(secretFileSelection)) {
1268
- cancel("Init canceled.");
1269
- throw new Error("Init canceled.");
1270
- }
1271
- let extraArtifactSelection = [];
1272
- if (plan.extraArtifacts.length > 0) {
1273
- showApprovalExplainer(setupApprovalSectionExplainers.extraArtifacts);
1274
- extraArtifactSelection = await multiselectWithHelp({
1275
- message: "Select other artifacts to copy to the devbox",
1276
- options: extraArtifactOptions,
1277
- initialValues: initialPlan?.extraArtifacts.map((entry) => entry.path) ??
1278
- plan.extraArtifacts.map((entry) => entry.path),
1279
- required: false,
1280
- });
1281
- }
1282
- if (isCancel(extraArtifactSelection)) {
1283
- cancel("Init canceled.");
1284
- throw new Error("Init canceled.");
1285
- }
1286
- let externalDependencySelection = [];
1287
- if (plan.externalDependencies.length > 0) {
1288
- showApprovalExplainer(setupApprovalSectionExplainers.externalDependencies);
1289
- externalDependencySelection = await multiselectWithHelp({
1290
- message: "Select external dependencies to install on the devbox",
1291
- options: externalDependencyOptions,
1292
- initialValues: initialPlan?.externalDependencies.map((entry) => entry.name) ??
1293
- plan.externalDependencies.map((entry) => entry.name),
1294
- required: false,
1295
- });
1296
- }
1297
- if (isCancel(externalDependencySelection)) {
1298
- cancel("Init canceled.");
1299
- throw new Error("Init canceled.");
1300
- }
1301
- let externalConfigSelection = [];
1302
- if (plan.externalConfigs.length > 0) {
1303
- showApprovalExplainer(setupApprovalSectionExplainers.externalConfigs);
1304
- externalConfigSelection = await multiselectWithHelp({
1305
- message: "Select external config/secret files to copy to the devbox",
1306
- options: externalConfigOptions,
1307
- initialValues: initialPlan?.externalConfigs.map((entry) => entry.path) ??
1308
- plan.externalConfigs.map((entry) => entry.path),
1309
- required: false,
1310
- });
1311
- }
1312
- if (isCancel(externalConfigSelection)) {
1313
- cancel("Init canceled.");
1314
- throw new Error("Init canceled.");
1315
- }
1316
- const envFileSet = new Set(envFileSelection);
1317
- const secretFileSet = new Set(secretFileSelection);
1318
- const extraArtifactSet = new Set(extraArtifactSelection);
1319
- const externalDependencySet = new Set(externalDependencySelection);
1320
- const externalConfigSet = new Set(externalConfigSelection);
1321
- return {
1322
- schemaVersion: plan.schemaVersion,
1323
- envFiles: plan.envFiles.filter((entry) => envFileSet.has(entry.path)),
1324
- secretFiles: plan.secretFiles.filter((entry) => secretFileSet.has(entry.path)),
1325
- extraArtifacts: plan.extraArtifacts.filter((entry) => extraArtifactSet.has(entry.path)),
1326
- externalDependencies: plan.externalDependencies.filter((entry) => externalDependencySet.has(entry.name)),
1327
- externalConfigs: plan.externalConfigs.filter((entry) => externalConfigSet.has(entry.path)),
1328
- services: initialPlan?.services ?? plan.services,
1329
- };
1330
- };
1331
- const promptForServicesApproval = async ({ plan, initialSelection, }) => {
1332
- log.step("Review run services findings");
1333
- const appEntrypointOptions = plan.appEntrypoints.map((entry) => ({
1334
- value: entry.command,
1335
- label: entry.command,
1336
- hint: entry.description?.trim() || "no description",
1337
- }));
1338
- const backgroundServiceOptions = plan.backgroundServices.map((entry) => ({
1339
- value: entry.name,
1340
- label: entry.name,
1341
- hint: `${entry.command}; HTTP port: ${entry.httpPort ?? "none"}`,
1342
- }));
1343
- let appEntrypointSelection = [];
1344
- if (plan.appEntrypoints.length > 0) {
1345
- showApprovalExplainer(setupApprovalSectionExplainers.appEntrypoints);
1346
- appEntrypointSelection = await multiselectWithHelp({
1347
- message: "Select app entrypoints to validate setup",
1348
- options: appEntrypointOptions,
1349
- initialValues: initialSelection?.appEntrypoints.map((entry) => entry.command) ??
1350
- plan.appEntrypoints.map((entry) => entry.command),
1351
- required: false,
1352
- });
1353
- }
1354
- if (isCancel(appEntrypointSelection)) {
1355
- cancel("Init canceled.");
1356
- throw new Error("Init canceled.");
1357
- }
1358
- let backgroundServiceSelection = [];
1359
- if (plan.backgroundServices.length > 0) {
1360
- showApprovalExplainer(setupApprovalSectionExplainers.backgroundServices);
1361
- backgroundServiceSelection = await multiselectWithHelp({
1362
- message: "Select background services to run in the devbox",
1363
- options: backgroundServiceOptions,
1364
- initialValues: initialSelection?.backgroundServices.map((entry) => entry.name) ??
1365
- plan.backgroundServices.map((entry) => entry.name),
1366
- required: false,
1367
- });
1368
- }
1369
- if (isCancel(backgroundServiceSelection)) {
1370
- cancel("Init canceled.");
1371
- throw new Error("Init canceled.");
1372
- }
1373
- const appEntrypointSet = new Set(appEntrypointSelection);
1374
- const backgroundServiceSet = new Set(backgroundServiceSelection);
1375
- return {
1376
- appEntrypoints: plan.appEntrypoints.filter((entry) => appEntrypointSet.has(entry.command)),
1377
- backgroundServices: plan.backgroundServices.filter((entry) => backgroundServiceSet.has(entry.name)),
1378
- };
1379
- };
1380
- export { classifyCodexExecFailure, promptForPlanApproval, promptForServicesApproval, runCodexExec, runLocalShellHistoryScan, runLocalServicesScan, runLocalSetupEnvSecretsScan, runLocalSetupExternalScan, runLocalSetupExtraArtifactsScan, setupApprovalPrefaceLines, setupApprovalSectionExplainers, };
1381
- //# sourceMappingURL=local.js.map