@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.
- package/dist/bin/.bundle-state.json +2 -2
- package/dist/bin/dvb.cjs +6 -6
- package/dist/bin/dvbd.cjs +6 -6
- package/package.json +7 -5
- package/dist/devbox/auth.d.ts +0 -22
- package/dist/devbox/auth.d.ts.map +0 -1
- package/dist/devbox/auth.js +0 -233
- package/dist/devbox/auth.js.map +0 -1
- package/dist/devbox/browser.d.ts +0 -19
- package/dist/devbox/browser.d.ts.map +0 -1
- package/dist/devbox/browser.js +0 -60
- package/dist/devbox/browser.js.map +0 -1
- package/dist/devbox/cli.d.ts +0 -7
- package/dist/devbox/cli.d.ts.map +0 -1
- package/dist/devbox/cli.js +0 -124
- package/dist/devbox/cli.js.map +0 -1
- package/dist/devbox/commandRegistry/args.d.ts +0 -18
- package/dist/devbox/commandRegistry/args.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/args.js +0 -107
- package/dist/devbox/commandRegistry/args.js.map +0 -1
- package/dist/devbox/commandRegistry/catalog.d.ts +0 -4
- package/dist/devbox/commandRegistry/catalog.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/catalog.js +0 -763
- package/dist/devbox/commandRegistry/catalog.js.map +0 -1
- package/dist/devbox/commandRegistry/dispatch.d.ts +0 -3
- package/dist/devbox/commandRegistry/dispatch.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/dispatch.js +0 -61
- package/dist/devbox/commandRegistry/dispatch.js.map +0 -1
- package/dist/devbox/commandRegistry/errors.d.ts +0 -8
- package/dist/devbox/commandRegistry/errors.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/errors.js +0 -26
- package/dist/devbox/commandRegistry/errors.js.map +0 -1
- package/dist/devbox/commandRegistry/help.d.ts +0 -5
- package/dist/devbox/commandRegistry/help.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/help.js +0 -94
- package/dist/devbox/commandRegistry/help.js.map +0 -1
- package/dist/devbox/commandRegistry/resolve.d.ts +0 -7
- package/dist/devbox/commandRegistry/resolve.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/resolve.js +0 -32
- package/dist/devbox/commandRegistry/resolve.js.map +0 -1
- package/dist/devbox/commandRegistry/tab.d.ts +0 -10
- package/dist/devbox/commandRegistry/tab.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/tab.js +0 -83
- package/dist/devbox/commandRegistry/tab.js.map +0 -1
- package/dist/devbox/commandRegistry/types.d.ts +0 -32
- package/dist/devbox/commandRegistry/types.d.ts.map +0 -1
- package/dist/devbox/commandRegistry/types.js +0 -2
- package/dist/devbox/commandRegistry/types.js.map +0 -1
- package/dist/devbox/commands/agent.d.ts +0 -52
- package/dist/devbox/commands/agent.d.ts.map +0 -1
- package/dist/devbox/commands/agent.js +0 -397
- package/dist/devbox/commands/agent.js.map +0 -1
- package/dist/devbox/commands/boxSelect.d.ts +0 -25
- package/dist/devbox/commands/boxSelect.d.ts.map +0 -1
- package/dist/devbox/commands/boxSelect.js +0 -94
- package/dist/devbox/commands/boxSelect.js.map +0 -1
- package/dist/devbox/commands/checkpoint.d.ts +0 -9
- package/dist/devbox/commands/checkpoint.d.ts.map +0 -1
- package/dist/devbox/commands/checkpoint.js +0 -105
- package/dist/devbox/commands/checkpoint.js.map +0 -1
- package/dist/devbox/commands/commandProvider.d.ts +0 -33
- package/dist/devbox/commands/commandProvider.d.ts.map +0 -1
- package/dist/devbox/commands/commandProvider.js +0 -156
- package/dist/devbox/commands/commandProvider.js.map +0 -1
- package/dist/devbox/commands/connect.d.ts +0 -39
- package/dist/devbox/commands/connect.d.ts.map +0 -1
- package/dist/devbox/commands/connect.js +0 -1367
- package/dist/devbox/commands/connect.js.map +0 -1
- package/dist/devbox/commands/connectSessionMapping.d.ts +0 -64
- package/dist/devbox/commands/connectSessionMapping.d.ts.map +0 -1
- package/dist/devbox/commands/connectSessionMapping.js +0 -153
- package/dist/devbox/commands/connectSessionMapping.js.map +0 -1
- package/dist/devbox/commands/cp.d.ts +0 -60
- package/dist/devbox/commands/cp.d.ts.map +0 -1
- package/dist/devbox/commands/cp.js +0 -383
- package/dist/devbox/commands/cp.js.map +0 -1
- package/dist/devbox/commands/daemon.d.ts +0 -4
- package/dist/devbox/commands/daemon.d.ts.map +0 -1
- package/dist/devbox/commands/daemon.js +0 -49
- package/dist/devbox/commands/daemon.js.map +0 -1
- package/dist/devbox/commands/destroy.d.ts +0 -2
- package/dist/devbox/commands/destroy.d.ts.map +0 -1
- package/dist/devbox/commands/destroy.js +0 -204
- package/dist/devbox/commands/destroy.js.map +0 -1
- package/dist/devbox/commands/destroyE2b.d.ts +0 -22
- package/dist/devbox/commands/destroyE2b.d.ts.map +0 -1
- package/dist/devbox/commands/destroyE2b.js +0 -12
- package/dist/devbox/commands/destroyE2b.js.map +0 -1
- package/dist/devbox/commands/destroyLocalState.d.ts +0 -34
- package/dist/devbox/commands/destroyLocalState.d.ts.map +0 -1
- package/dist/devbox/commands/destroyLocalState.js +0 -187
- package/dist/devbox/commands/destroyLocalState.js.map +0 -1
- package/dist/devbox/commands/destroyModal.d.ts +0 -21
- package/dist/devbox/commands/destroyModal.d.ts.map +0 -1
- package/dist/devbox/commands/destroyModal.js +0 -13
- package/dist/devbox/commands/destroyModal.js.map +0 -1
- package/dist/devbox/commands/destroyShared.d.ts +0 -14
- package/dist/devbox/commands/destroyShared.d.ts.map +0 -1
- package/dist/devbox/commands/destroyShared.js +0 -37
- package/dist/devbox/commands/destroyShared.js.map +0 -1
- package/dist/devbox/commands/fork.d.ts +0 -9
- package/dist/devbox/commands/fork.d.ts.map +0 -1
- package/dist/devbox/commands/fork.js +0 -94
- package/dist/devbox/commands/fork.js.map +0 -1
- package/dist/devbox/commands/ide.d.ts +0 -35
- package/dist/devbox/commands/ide.d.ts.map +0 -1
- package/dist/devbox/commands/ide.js +0 -987
- package/dist/devbox/commands/ide.js.map +0 -1
- package/dist/devbox/commands/init/args.d.ts +0 -18
- package/dist/devbox/commands/init/args.d.ts.map +0 -1
- package/dist/devbox/commands/init/args.js +0 -44
- package/dist/devbox/commands/init/args.js.map +0 -1
- package/dist/devbox/commands/init/clack.d.ts +0 -22
- package/dist/devbox/commands/init/clack.d.ts.map +0 -1
- package/dist/devbox/commands/init/clack.js +0 -158
- package/dist/devbox/commands/init/clack.js.map +0 -1
- package/dist/devbox/commands/init/claudeBootstrap.d.ts +0 -49
- package/dist/devbox/commands/init/claudeBootstrap.d.ts.map +0 -1
- package/dist/devbox/commands/init/claudeBootstrap.js +0 -504
- package/dist/devbox/commands/init/claudeBootstrap.js.map +0 -1
- package/dist/devbox/commands/init/codex/artifacts.d.ts +0 -49
- package/dist/devbox/commands/init/codex/artifacts.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/artifacts.js +0 -278
- package/dist/devbox/commands/init/codex/artifacts.js.map +0 -1
- package/dist/devbox/commands/init/codex/config.d.ts +0 -6
- package/dist/devbox/commands/init/codex/config.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/config.js +0 -43
- package/dist/devbox/commands/init/codex/config.js.map +0 -1
- package/dist/devbox/commands/init/codex/events.d.ts +0 -14
- package/dist/devbox/commands/init/codex/events.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/events.js +0 -435
- package/dist/devbox/commands/init/codex/events.js.map +0 -1
- package/dist/devbox/commands/init/codex/execConfig.d.ts +0 -5
- package/dist/devbox/commands/init/codex/execConfig.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/execConfig.js +0 -10
- package/dist/devbox/commands/init/codex/execConfig.js.map +0 -1
- package/dist/devbox/commands/init/codex/index.d.ts +0 -136
- package/dist/devbox/commands/init/codex/index.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/index.js +0 -1115
- package/dist/devbox/commands/init/codex/index.js.map +0 -1
- package/dist/devbox/commands/init/codex/local.d.ts +0 -124
- package/dist/devbox/commands/init/codex/local.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/local.js +0 -1381
- package/dist/devbox/commands/init/codex/local.js.map +0 -1
- package/dist/devbox/commands/init/codex/localExecArgs.d.ts +0 -25
- package/dist/devbox/commands/init/codex/localExecArgs.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/localExecArgs.js +0 -48
- package/dist/devbox/commands/init/codex/localExecArgs.js.map +0 -1
- package/dist/devbox/commands/init/codex/plan.d.ts +0 -99
- package/dist/devbox/commands/init/codex/plan.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/plan.js +0 -231
- package/dist/devbox/commands/init/codex/plan.js.map +0 -1
- package/dist/devbox/commands/init/codex/prompts.d.ts +0 -9
- package/dist/devbox/commands/init/codex/prompts.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/prompts.js +0 -51
- package/dist/devbox/commands/init/codex/prompts.js.map +0 -1
- package/dist/devbox/commands/init/codex/proxy.d.ts +0 -10
- package/dist/devbox/commands/init/codex/proxy.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/proxy.js +0 -32
- package/dist/devbox/commands/init/codex/proxy.js.map +0 -1
- package/dist/devbox/commands/init/codex/remote.d.ts +0 -96
- package/dist/devbox/commands/init/codex/remote.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/remote.js +0 -927
- package/dist/devbox/commands/init/codex/remote.js.map +0 -1
- package/dist/devbox/commands/init/codex/retry.d.ts +0 -17
- package/dist/devbox/commands/init/codex/retry.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/retry.js +0 -17
- package/dist/devbox/commands/init/codex/retry.js.map +0 -1
- package/dist/devbox/commands/init/codex/scanStatus.d.ts +0 -5
- package/dist/devbox/commands/init/codex/scanStatus.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/scanStatus.js +0 -27
- package/dist/devbox/commands/init/codex/scanStatus.js.map +0 -1
- package/dist/devbox/commands/init/codex/shellHistory.d.ts +0 -39
- package/dist/devbox/commands/init/codex/shellHistory.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/shellHistory.js +0 -258
- package/dist/devbox/commands/init/codex/shellHistory.js.map +0 -1
- package/dist/devbox/commands/init/codex/template.d.ts +0 -3
- package/dist/devbox/commands/init/codex/template.d.ts.map +0 -1
- package/dist/devbox/commands/init/codex/template.js +0 -3
- package/dist/devbox/commands/init/codex/template.js.map +0 -1
- package/dist/devbox/commands/init/finalizeFlow.d.ts +0 -95
- package/dist/devbox/commands/init/finalizeFlow.d.ts.map +0 -1
- package/dist/devbox/commands/init/finalizeFlow.js +0 -786
- package/dist/devbox/commands/init/finalizeFlow.js.map +0 -1
- package/dist/devbox/commands/init/index.d.ts +0 -11
- package/dist/devbox/commands/init/index.d.ts.map +0 -1
- package/dist/devbox/commands/init/index.js +0 -1058
- package/dist/devbox/commands/init/index.js.map +0 -1
- package/dist/devbox/commands/init/modal.d.ts +0 -5
- package/dist/devbox/commands/init/modal.d.ts.map +0 -1
- package/dist/devbox/commands/init/modal.js +0 -4
- package/dist/devbox/commands/init/modal.js.map +0 -1
- package/dist/devbox/commands/init/packaging.d.ts +0 -5
- package/dist/devbox/commands/init/packaging.d.ts.map +0 -1
- package/dist/devbox/commands/init/packaging.js +0 -81
- package/dist/devbox/commands/init/packaging.js.map +0 -1
- package/dist/devbox/commands/init/progress.d.ts +0 -31
- package/dist/devbox/commands/init/progress.d.ts.map +0 -1
- package/dist/devbox/commands/init/progress.js +0 -205
- package/dist/devbox/commands/init/progress.js.map +0 -1
- package/dist/devbox/commands/init/provider/e2b.d.ts +0 -29
- package/dist/devbox/commands/init/provider/e2b.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/e2b.js +0 -130
- package/dist/devbox/commands/init/provider/e2b.js.map +0 -1
- package/dist/devbox/commands/init/provider/e2bRuntime.d.ts +0 -39
- package/dist/devbox/commands/init/provider/e2bRuntime.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/e2bRuntime.js +0 -679
- package/dist/devbox/commands/init/provider/e2bRuntime.js.map +0 -1
- package/dist/devbox/commands/init/provider/index.d.ts +0 -8
- package/dist/devbox/commands/init/provider/index.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/index.js +0 -5
- package/dist/devbox/commands/init/provider/index.js.map +0 -1
- package/dist/devbox/commands/init/provider/modal.d.ts +0 -34
- package/dist/devbox/commands/init/provider/modal.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/modal.js +0 -274
- package/dist/devbox/commands/init/provider/modal.js.map +0 -1
- package/dist/devbox/commands/init/provider/modalRuntime.d.ts +0 -3
- package/dist/devbox/commands/init/provider/modalRuntime.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/modalRuntime.js +0 -2
- package/dist/devbox/commands/init/provider/modalRuntime.js.map +0 -1
- package/dist/devbox/commands/init/provider/resolve.d.ts +0 -44
- package/dist/devbox/commands/init/provider/resolve.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/resolve.js +0 -172
- package/dist/devbox/commands/init/provider/resolve.js.map +0 -1
- package/dist/devbox/commands/init/provider/shared.d.ts +0 -10
- package/dist/devbox/commands/init/provider/shared.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/shared.js +0 -2
- package/dist/devbox/commands/init/provider/shared.js.map +0 -1
- package/dist/devbox/commands/init/provider/sprites.d.ts +0 -30
- package/dist/devbox/commands/init/provider/sprites.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/sprites.js +0 -183
- package/dist/devbox/commands/init/provider/sprites.js.map +0 -1
- package/dist/devbox/commands/init/provider/types.d.ts +0 -19
- package/dist/devbox/commands/init/provider/types.d.ts.map +0 -1
- package/dist/devbox/commands/init/provider/types.js +0 -2
- package/dist/devbox/commands/init/provider/types.js.map +0 -1
- package/dist/devbox/commands/init/provisionFlow.d.ts +0 -53
- package/dist/devbox/commands/init/provisionFlow.d.ts.map +0 -1
- package/dist/devbox/commands/init/provisionFlow.js +0 -541
- package/dist/devbox/commands/init/provisionFlow.js.map +0 -1
- package/dist/devbox/commands/init/registry.d.ts +0 -15
- package/dist/devbox/commands/init/registry.d.ts.map +0 -1
- package/dist/devbox/commands/init/registry.js +0 -38
- package/dist/devbox/commands/init/registry.js.map +0 -1
- package/dist/devbox/commands/init/remote.d.ts +0 -48
- package/dist/devbox/commands/init/remote.d.ts.map +0 -1
- package/dist/devbox/commands/init/remote.js +0 -766
- package/dist/devbox/commands/init/remote.js.map +0 -1
- package/dist/devbox/commands/init/repo.d.ts +0 -45
- package/dist/devbox/commands/init/repo.d.ts.map +0 -1
- package/dist/devbox/commands/init/repo.js +0 -235
- package/dist/devbox/commands/init/repo.js.map +0 -1
- package/dist/devbox/commands/init/retryableErrors.d.ts +0 -4
- package/dist/devbox/commands/init/retryableErrors.d.ts.map +0 -1
- package/dist/devbox/commands/init/retryableErrors.js +0 -42
- package/dist/devbox/commands/init/retryableErrors.js.map +0 -1
- package/dist/devbox/commands/init/scanProgress.d.ts +0 -18
- package/dist/devbox/commands/init/scanProgress.d.ts.map +0 -1
- package/dist/devbox/commands/init/scanProgress.js +0 -47
- package/dist/devbox/commands/init/scanProgress.js.map +0 -1
- package/dist/devbox/commands/init/session.d.ts +0 -72
- package/dist/devbox/commands/init/session.d.ts.map +0 -1
- package/dist/devbox/commands/init/session.js +0 -348
- package/dist/devbox/commands/init/session.js.map +0 -1
- package/dist/devbox/commands/init/setupArtifactsValidation.d.ts +0 -28
- package/dist/devbox/commands/init/setupArtifactsValidation.d.ts.map +0 -1
- package/dist/devbox/commands/init/setupArtifactsValidation.js +0 -113
- package/dist/devbox/commands/init/setupArtifactsValidation.js.map +0 -1
- package/dist/devbox/commands/init/setupPlanFlow.d.ts +0 -34
- package/dist/devbox/commands/init/setupPlanFlow.d.ts.map +0 -1
- package/dist/devbox/commands/init/setupPlanFlow.js +0 -967
- package/dist/devbox/commands/init/setupPlanFlow.js.map +0 -1
- package/dist/devbox/commands/init/ssh.d.ts +0 -19
- package/dist/devbox/commands/init/ssh.d.ts.map +0 -1
- package/dist/devbox/commands/init/ssh.js +0 -276
- package/dist/devbox/commands/init/ssh.js.map +0 -1
- package/dist/devbox/commands/init/state.d.ts +0 -73
- package/dist/devbox/commands/init/state.d.ts.map +0 -1
- package/dist/devbox/commands/init/state.js +0 -118
- package/dist/devbox/commands/init/state.js.map +0 -1
- package/dist/devbox/commands/init/statusFlow.d.ts +0 -27
- package/dist/devbox/commands/init/statusFlow.d.ts.map +0 -1
- package/dist/devbox/commands/init/statusFlow.js +0 -160
- package/dist/devbox/commands/init/statusFlow.js.map +0 -1
- package/dist/devbox/commands/list.d.ts +0 -35
- package/dist/devbox/commands/list.d.ts.map +0 -1
- package/dist/devbox/commands/list.js +0 -311
- package/dist/devbox/commands/list.js.map +0 -1
- package/dist/devbox/commands/listFormatting.d.ts +0 -27
- package/dist/devbox/commands/listFormatting.d.ts.map +0 -1
- package/dist/devbox/commands/listFormatting.js +0 -155
- package/dist/devbox/commands/listFormatting.js.map +0 -1
- package/dist/devbox/commands/logout.d.ts +0 -2
- package/dist/devbox/commands/logout.d.ts.map +0 -1
- package/dist/devbox/commands/logout.js +0 -64
- package/dist/devbox/commands/logout.js.map +0 -1
- package/dist/devbox/commands/managedProviderClient.d.ts +0 -24
- package/dist/devbox/commands/managedProviderClient.d.ts.map +0 -1
- package/dist/devbox/commands/managedProviderClient.js +0 -42
- package/dist/devbox/commands/managedProviderClient.js.map +0 -1
- package/dist/devbox/commands/managedProviderContext.d.ts +0 -34
- package/dist/devbox/commands/managedProviderContext.d.ts.map +0 -1
- package/dist/devbox/commands/managedProviderContext.js +0 -34
- package/dist/devbox/commands/managedProviderContext.js.map +0 -1
- package/dist/devbox/commands/mount.d.ts +0 -25
- package/dist/devbox/commands/mount.d.ts.map +0 -1
- package/dist/devbox/commands/mount.js +0 -200
- package/dist/devbox/commands/mount.js.map +0 -1
- package/dist/devbox/commands/ports.d.ts +0 -11
- package/dist/devbox/commands/ports.d.ts.map +0 -1
- package/dist/devbox/commands/ports.js +0 -183
- package/dist/devbox/commands/ports.js.map +0 -1
- package/dist/devbox/commands/power.d.ts +0 -10
- package/dist/devbox/commands/power.d.ts.map +0 -1
- package/dist/devbox/commands/power.js +0 -139
- package/dist/devbox/commands/power.js.map +0 -1
- package/dist/devbox/commands/provider/daemonRuntimeShared.d.ts +0 -25
- package/dist/devbox/commands/provider/daemonRuntimeShared.d.ts.map +0 -1
- package/dist/devbox/commands/provider/daemonRuntimeShared.js +0 -217
- package/dist/devbox/commands/provider/daemonRuntimeShared.js.map +0 -1
- package/dist/devbox/commands/provider/directDaemonRuntime.d.ts +0 -106
- package/dist/devbox/commands/provider/directDaemonRuntime.d.ts.map +0 -1
- package/dist/devbox/commands/provider/directDaemonRuntime.js +0 -1442
- package/dist/devbox/commands/provider/directDaemonRuntime.js.map +0 -1
- package/dist/devbox/commands/provider/e2bCommandContext.d.ts +0 -11
- package/dist/devbox/commands/provider/e2bCommandContext.d.ts.map +0 -1
- package/dist/devbox/commands/provider/e2bCommandContext.js +0 -16
- package/dist/devbox/commands/provider/e2bCommandContext.js.map +0 -1
- package/dist/devbox/commands/provider/e2bLifecycleShared.d.ts +0 -20
- package/dist/devbox/commands/provider/e2bLifecycleShared.d.ts.map +0 -1
- package/dist/devbox/commands/provider/e2bLifecycleShared.js +0 -42
- package/dist/devbox/commands/provider/e2bLifecycleShared.js.map +0 -1
- package/dist/devbox/commands/provider/modalCommandContext.d.ts +0 -22
- package/dist/devbox/commands/provider/modalCommandContext.d.ts.map +0 -1
- package/dist/devbox/commands/provider/modalCommandContext.js +0 -47
- package/dist/devbox/commands/provider/modalCommandContext.js.map +0 -1
- package/dist/devbox/commands/provider/modalLifecycle.d.ts +0 -158
- package/dist/devbox/commands/provider/modalLifecycle.d.ts.map +0 -1
- package/dist/devbox/commands/provider/modalLifecycle.js +0 -702
- package/dist/devbox/commands/provider/modalLifecycle.js.map +0 -1
- package/dist/devbox/commands/provider/modalRuntime.d.ts +0 -25
- package/dist/devbox/commands/provider/modalRuntime.d.ts.map +0 -1
- package/dist/devbox/commands/provider/modalRuntime.js +0 -791
- package/dist/devbox/commands/provider/modalRuntime.js.map +0 -1
- package/dist/devbox/commands/provider/runtimeTypes.d.ts +0 -8
- package/dist/devbox/commands/provider/runtimeTypes.d.ts.map +0 -1
- package/dist/devbox/commands/provider/runtimeTypes.js +0 -2
- package/dist/devbox/commands/provider/runtimeTypes.js.map +0 -1
- package/dist/devbox/commands/providerClient.d.ts +0 -82
- package/dist/devbox/commands/providerClient.d.ts.map +0 -1
- package/dist/devbox/commands/providerClient.js +0 -719
- package/dist/devbox/commands/providerClient.js.map +0 -1
- package/dist/devbox/commands/reboot.d.ts +0 -8
- package/dist/devbox/commands/reboot.d.ts.map +0 -1
- package/dist/devbox/commands/reboot.js +0 -100
- package/dist/devbox/commands/reboot.js.map +0 -1
- package/dist/devbox/commands/reset.d.ts +0 -30
- package/dist/devbox/commands/reset.d.ts.map +0 -1
- package/dist/devbox/commands/reset.js +0 -114
- package/dist/devbox/commands/reset.js.map +0 -1
- package/dist/devbox/commands/runtimeClient.d.ts +0 -65
- package/dist/devbox/commands/runtimeClient.d.ts.map +0 -1
- package/dist/devbox/commands/runtimeClient.js +0 -127
- package/dist/devbox/commands/runtimeClient.js.map +0 -1
- package/dist/devbox/commands/sentryTest.d.ts +0 -2
- package/dist/devbox/commands/sentryTest.d.ts.map +0 -1
- package/dist/devbox/commands/sentryTest.js +0 -117
- package/dist/devbox/commands/sentryTest.js.map +0 -1
- package/dist/devbox/commands/services.d.ts +0 -2
- package/dist/devbox/commands/services.d.ts.map +0 -1
- package/dist/devbox/commands/services.js +0 -619
- package/dist/devbox/commands/services.js.map +0 -1
- package/dist/devbox/commands/servicesConfig.d.ts +0 -19
- package/dist/devbox/commands/servicesConfig.d.ts.map +0 -1
- package/dist/devbox/commands/servicesConfig.js +0 -61
- package/dist/devbox/commands/servicesConfig.js.map +0 -1
- package/dist/devbox/commands/servicesToml.d.ts +0 -13
- package/dist/devbox/commands/servicesToml.d.ts.map +0 -1
- package/dist/devbox/commands/servicesToml.js +0 -201
- package/dist/devbox/commands/servicesToml.js.map +0 -1
- package/dist/devbox/commands/sessionUtils.d.ts +0 -10
- package/dist/devbox/commands/sessionUtils.d.ts.map +0 -1
- package/dist/devbox/commands/sessionUtils.js +0 -48
- package/dist/devbox/commands/sessionUtils.js.map +0 -1
- package/dist/devbox/commands/sessions.d.ts +0 -3
- package/dist/devbox/commands/sessions.d.ts.map +0 -1
- package/dist/devbox/commands/sessions.js +0 -490
- package/dist/devbox/commands/sessions.js.map +0 -1
- package/dist/devbox/commands/setup.d.ts +0 -36
- package/dist/devbox/commands/setup.d.ts.map +0 -1
- package/dist/devbox/commands/setup.js +0 -816
- package/dist/devbox/commands/setup.js.map +0 -1
- package/dist/devbox/commands/setupClaude.d.ts +0 -51
- package/dist/devbox/commands/setupClaude.d.ts.map +0 -1
- package/dist/devbox/commands/setupClaude.js +0 -202
- package/dist/devbox/commands/setupClaude.js.map +0 -1
- package/dist/devbox/commands/setupTooling.d.ts +0 -56
- package/dist/devbox/commands/setupTooling.d.ts.map +0 -1
- package/dist/devbox/commands/setupTooling.js +0 -187
- package/dist/devbox/commands/setupTooling.js.map +0 -1
- package/dist/devbox/commands/sshAccess.d.ts +0 -31
- package/dist/devbox/commands/sshAccess.d.ts.map +0 -1
- package/dist/devbox/commands/sshAccess.js +0 -353
- package/dist/devbox/commands/sshAccess.js.map +0 -1
- package/dist/devbox/commands/sshConfig.d.ts +0 -23
- package/dist/devbox/commands/sshConfig.d.ts.map +0 -1
- package/dist/devbox/commands/sshConfig.js +0 -366
- package/dist/devbox/commands/sshConfig.js.map +0 -1
- package/dist/devbox/commands/sshProxy.d.ts +0 -2
- package/dist/devbox/commands/sshProxy.d.ts.map +0 -1
- package/dist/devbox/commands/sshProxy.js +0 -215
- package/dist/devbox/commands/sshProxy.js.map +0 -1
- package/dist/devbox/commands/uninstall.d.ts +0 -2
- package/dist/devbox/commands/uninstall.d.ts.map +0 -1
- package/dist/devbox/commands/uninstall.js +0 -365
- package/dist/devbox/commands/uninstall.js.map +0 -1
- package/dist/devbox/commands/upgrade.d.ts +0 -14
- package/dist/devbox/commands/upgrade.d.ts.map +0 -1
- package/dist/devbox/commands/upgrade.js +0 -60
- package/dist/devbox/commands/upgrade.js.map +0 -1
- package/dist/devbox/commands/version.d.ts +0 -8
- package/dist/devbox/commands/version.d.ts.map +0 -1
- package/dist/devbox/commands/version.js +0 -134
- package/dist/devbox/commands/version.js.map +0 -1
- package/dist/devbox/commands/whoami.d.ts +0 -2
- package/dist/devbox/commands/whoami.d.ts.map +0 -1
- package/dist/devbox/commands/whoami.js +0 -114
- package/dist/devbox/commands/whoami.js.map +0 -1
- package/dist/devbox/completions/cache.d.ts +0 -53
- package/dist/devbox/completions/cache.d.ts.map +0 -1
- package/dist/devbox/completions/cache.js +0 -227
- package/dist/devbox/completions/cache.js.map +0 -1
- package/dist/devbox/completions/index.d.ts +0 -18
- package/dist/devbox/completions/index.d.ts.map +0 -1
- package/dist/devbox/completions/index.js +0 -759
- package/dist/devbox/completions/index.js.map +0 -1
- package/dist/devbox/controlPlane.d.ts +0 -460
- package/dist/devbox/controlPlane.d.ts.map +0 -1
- package/dist/devbox/controlPlane.js +0 -1910
- package/dist/devbox/controlPlane.js.map +0 -1
- package/dist/devbox/daemonClient.d.ts +0 -44
- package/dist/devbox/daemonClient.d.ts.map +0 -1
- package/dist/devbox/daemonClient.js +0 -677
- package/dist/devbox/daemonClient.js.map +0 -1
- package/dist/devbox/e2bExecErrors.d.ts +0 -11
- package/dist/devbox/e2bExecErrors.d.ts.map +0 -1
- package/dist/devbox/e2bExecErrors.js +0 -19
- package/dist/devbox/e2bExecErrors.js.map +0 -1
- package/dist/devbox/latency.d.ts +0 -25
- package/dist/devbox/latency.d.ts.map +0 -1
- package/dist/devbox/latency.js +0 -186
- package/dist/devbox/latency.js.map +0 -1
- package/dist/devbox/logger.d.ts +0 -2
- package/dist/devbox/logger.d.ts.map +0 -1
- package/dist/devbox/logger.js +0 -3
- package/dist/devbox/logger.js.map +0 -1
- package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.d.ts +0 -11
- package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.d.ts.map +0 -1
- package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.js +0 -118
- package/dist/devbox/terminal/kittyCtrlCReleaseSuppressor.js.map +0 -1
- package/dist/devbox/terminal/osc.d.ts +0 -11
- package/dist/devbox/terminal/osc.d.ts.map +0 -1
- package/dist/devbox/terminal/osc.js +0 -84
- package/dist/devbox/terminal/osc.js.map +0 -1
- package/dist/devbox/terminal/sessionProtocol.d.ts +0 -46
- package/dist/devbox/terminal/sessionProtocol.d.ts.map +0 -1
- package/dist/devbox/terminal/sessionProtocol.js +0 -631
- package/dist/devbox/terminal/sessionProtocol.js.map +0 -1
- package/dist/devbox/ui/colors.d.ts +0 -19
- package/dist/devbox/ui/colors.d.ts.map +0 -1
- package/dist/devbox/ui/colors.js +0 -22
- package/dist/devbox/ui/colors.js.map +0 -1
- package/dist/devbox/ui/copyableUrl.d.ts +0 -4
- package/dist/devbox/ui/copyableUrl.d.ts.map +0 -1
- package/dist/devbox/ui/copyableUrl.js +0 -10
- package/dist/devbox/ui/copyableUrl.js.map +0 -1
- package/dist/devbox/ui/qr.d.ts +0 -3
- package/dist/devbox/ui/qr.d.ts.map +0 -1
- package/dist/devbox/ui/qr.js +0 -17
- package/dist/devbox/ui/qr.js.map +0 -1
- package/dist/devbox/ui/statusLine.d.ts +0 -14
- package/dist/devbox/ui/statusLine.d.ts.map +0 -1
- package/dist/devbox/ui/statusLine.js +0 -92
- package/dist/devbox/ui/statusLine.js.map +0 -1
- package/dist/devbox/updateNotice.d.ts +0 -2
- package/dist/devbox/updateNotice.d.ts.map +0 -1
- package/dist/devbox/updateNotice.js +0 -43
- package/dist/devbox/updateNotice.js.map +0 -1
|
@@ -1,1115 +0,0 @@
|
|
|
1
|
-
import path from "node:path";
|
|
2
|
-
import { randomUUID } from "node:crypto";
|
|
3
|
-
import fs from "node:fs/promises";
|
|
4
|
-
import { homedir } from "node:os";
|
|
5
|
-
import { cancel as clackCancel, isCancel, log as clackLog, select as clackSelect, } from "@clack/prompts";
|
|
6
|
-
import { resolveSocketInfo, SpritesApiError, } from "@boxes-dev/core";
|
|
7
|
-
import { requestJson, requireDaemonFeatures } from "../../../daemonClient.js";
|
|
8
|
-
import { showCopyableUrl } from "../../../ui/copyableUrl.js";
|
|
9
|
-
import { resolveRemoteHomeDir, shellQuote } from "../remote.js";
|
|
10
|
-
import { ensureRemoteCodexInstalled, isRemoteCodexLoggedIn, openBrowser, renderRemoteApplyPrompt, runRemoteCodexExec, runRemoteCodexLogin, } from "./remote.js";
|
|
11
|
-
import { buildCodexInitExecArgs } from "./execConfig.js";
|
|
12
|
-
import { readSetupPlan, readSetupEnvSecretsPlan, readSetupExternalPlan, readSetupExtraArtifactsPlan, readServicesPlan, mergeExternalPlanEntries, mergeSetupScans, writeSetupPlan, writeSetupEnvSecretsSchema, writeSetupExternalSchema, writeSetupExtraArtifactsSchema, writeServicesPlan, writeServicesSchema, } from "./plan.js";
|
|
13
|
-
import { promptForPlanApproval, promptForServicesApproval, runLocalShellHistoryScan, runLocalServicesScan, runLocalSetupEnvSecretsScan, runLocalSetupExternalScan, runLocalSetupExtraArtifactsScan, setupApprovalPrefaceLines, setupApprovalSectionExplainers, } from "./local.js";
|
|
14
|
-
import { buildCodexProxyAuthorizationHeader, buildCodexProxyConfig, } from "./proxy.js";
|
|
15
|
-
import { createSetupArtifacts, readSetupArtifactsPartsDescriptor, } from "./artifacts.js";
|
|
16
|
-
import {} from "../progress.js";
|
|
17
|
-
import { DEFAULT_CODEX_EXEC_MAX_ATTEMPTS, computeCodexExecRetryDelayMs, delay, } from "./retry.js";
|
|
18
|
-
import { formatRetryReason } from "./scanStatus.js";
|
|
19
|
-
const CODEX_REQUEST_URL_REGEX = /error sending request for url \(([^)]+)\)/i;
|
|
20
|
-
const CODEX_STREAM_DISCONNECT_DETAIL_REGEX = /stream disconnected before completion:\s*([^\n\r]+)/i;
|
|
21
|
-
const CODEX_SESSION_ID_REGEX = /session id:\s*([0-9a-f-]{20,})/i;
|
|
22
|
-
const REMOTE_RELAY_FORBIDDEN_REGEX = /(unexpected status 403 Forbidden|403 Forbidden: forbidden)/i;
|
|
23
|
-
const REMOTE_RELAY_MISSING_OPENAI_CONFIG_REGEX = /unexpected status 503 Service Unavailable/i;
|
|
24
|
-
const REMOTE_CODEX_AUTH_STRONG_SUBSTRINGS = [
|
|
25
|
-
"refresh_token_reused",
|
|
26
|
-
"provided authentication token is expired",
|
|
27
|
-
"your refresh token has already been used",
|
|
28
|
-
"your access token could not be refreshed",
|
|
29
|
-
"no codex auth is configured",
|
|
30
|
-
"please run `codex login`",
|
|
31
|
-
"please run codex login",
|
|
32
|
-
"not_logged_in",
|
|
33
|
-
"not logged in",
|
|
34
|
-
];
|
|
35
|
-
const REMOTE_CODEX_AUTH_AMBIGUOUS_SUBSTRINGS = [
|
|
36
|
-
"chatgpt account id not available",
|
|
37
|
-
"chatgpt token not available",
|
|
38
|
-
"oauth authorization required",
|
|
39
|
-
"chatgpt authentication required",
|
|
40
|
-
"codex account authentication required",
|
|
41
|
-
"no refresh token available",
|
|
42
|
-
"missing bearer or basic authentication in header",
|
|
43
|
-
];
|
|
44
|
-
const REMOTE_CODEX_STALE_RESUME_SUBSTRINGS = [
|
|
45
|
-
"no rollout found for thread id",
|
|
46
|
-
];
|
|
47
|
-
const CODEX_APPLY_ARTIFACT_GRACE_MS = 10_000;
|
|
48
|
-
const CODEX_APPLY_ARTIFACT_POLL_INTERVAL_MS = 1_000;
|
|
49
|
-
const extractRequestUrl = (value) => {
|
|
50
|
-
const match = value.match(CODEX_REQUEST_URL_REGEX);
|
|
51
|
-
const url = match?.[1]?.trim();
|
|
52
|
-
return url && url.length > 0 ? url : null;
|
|
53
|
-
};
|
|
54
|
-
const extractStreamDisconnectDetail = (value) => {
|
|
55
|
-
const match = value.match(CODEX_STREAM_DISCONNECT_DETAIL_REGEX);
|
|
56
|
-
const detail = match?.[1]?.trim();
|
|
57
|
-
return detail && detail.length > 0 ? detail : null;
|
|
58
|
-
};
|
|
59
|
-
const extractCodexSessionId = (value) => {
|
|
60
|
-
const match = value.match(CODEX_SESSION_ID_REGEX);
|
|
61
|
-
const sessionId = match?.[1]?.trim();
|
|
62
|
-
return sessionId && sessionId.length > 0 ? sessionId : null;
|
|
63
|
-
};
|
|
64
|
-
const stripAnsi = (value) => value.replace(/\u001b\[[0-9;]*[A-Za-z]/g, "");
|
|
65
|
-
const splitNonEmptyOutputLines = (value) => stripAnsi(value)
|
|
66
|
-
.split(/\r?\n/)
|
|
67
|
-
.map((line) => line.trim())
|
|
68
|
-
.filter((line) => line.length > 0);
|
|
69
|
-
const summarizeCodexOutputDetail = (value) => {
|
|
70
|
-
const lines = splitNonEmptyOutputLines(value);
|
|
71
|
-
if (lines.length === 0)
|
|
72
|
-
return null;
|
|
73
|
-
const summary = lines.slice(-3).join(" | ");
|
|
74
|
-
if (summary.length <= 500)
|
|
75
|
-
return summary;
|
|
76
|
-
return `${summary.slice(0, 500)}...`;
|
|
77
|
-
};
|
|
78
|
-
const summarizeCodexFailureDetail = ({ combinedOutputRaw, lastMessageReadError, sessionId, }) => {
|
|
79
|
-
const parts = [];
|
|
80
|
-
const resolvedSessionId = sessionId ?? extractCodexSessionId(combinedOutputRaw);
|
|
81
|
-
if (resolvedSessionId) {
|
|
82
|
-
parts.push(`session id: ${resolvedSessionId}`);
|
|
83
|
-
}
|
|
84
|
-
const outputDetail = summarizeCodexOutputDetail(combinedOutputRaw);
|
|
85
|
-
if (outputDetail) {
|
|
86
|
-
parts.push(`output: ${outputDetail}`);
|
|
87
|
-
}
|
|
88
|
-
const readErrorDetail = lastMessageReadError?.message.trim();
|
|
89
|
-
if (readErrorDetail) {
|
|
90
|
-
parts.push(`file read: ${readErrorDetail}`);
|
|
91
|
-
}
|
|
92
|
-
if (parts.length === 0)
|
|
93
|
-
return null;
|
|
94
|
-
return parts.join(" | ");
|
|
95
|
-
};
|
|
96
|
-
const isRelayForbidden = (value) => REMOTE_RELAY_FORBIDDEN_REGEX.test(value) && /\/v1\/responses/i.test(value);
|
|
97
|
-
const isRelayMissingOpenAiProxyConfiguration = (value) => REMOTE_RELAY_MISSING_OPENAI_CONFIG_REGEX.test(value) &&
|
|
98
|
-
/missing OpenAI proxy configuration/i.test(value) &&
|
|
99
|
-
/\/v1\/responses/i.test(value);
|
|
100
|
-
const isResponsesRequestUrl = (requestUrl) => {
|
|
101
|
-
try {
|
|
102
|
-
return new URL(requestUrl).pathname === "/v1/responses";
|
|
103
|
-
}
|
|
104
|
-
catch {
|
|
105
|
-
return /\/v1\/responses(?:[/?#)\s]|$)/i.test(requestUrl);
|
|
106
|
-
}
|
|
107
|
-
};
|
|
108
|
-
const lineLooksLikeRemoteCodexAuthFailure = (line) => {
|
|
109
|
-
const normalized = line.toLowerCase();
|
|
110
|
-
if (REMOTE_CODEX_AUTH_STRONG_SUBSTRINGS.some((substring) => normalized.includes(substring)) ||
|
|
111
|
-
REMOTE_CODEX_AUTH_AMBIGUOUS_SUBSTRINGS.some((substring) => normalized.includes(substring))) {
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
if (!normalized.includes("401 unauthorized")) {
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
const requestUrl = extractRequestUrl(line);
|
|
118
|
-
if (requestUrl && isResponsesRequestUrl(requestUrl)) {
|
|
119
|
-
return true;
|
|
120
|
-
}
|
|
121
|
-
return /\/v1\/responses(?:[/?#)\s]|$)/i.test(line);
|
|
122
|
-
};
|
|
123
|
-
const isRemoteCodexAuthFailure = (value) => splitNonEmptyOutputLines(value).some(lineLooksLikeRemoteCodexAuthFailure);
|
|
124
|
-
const formatCodexRetryProgress = ({ attempt, maxAttempts, delayMs, sessionId, reason, }) => {
|
|
125
|
-
const nextAttempt = attempt + 1;
|
|
126
|
-
const delaySeconds = Math.max(1, Math.ceil(delayMs / 1000));
|
|
127
|
-
const mode = sessionId
|
|
128
|
-
? "continuing existing session"
|
|
129
|
-
: "starting a fresh session";
|
|
130
|
-
return `retry ${nextAttempt}/${maxAttempts} in ${delaySeconds}s (${mode}): ${formatRetryReason(reason)}`;
|
|
131
|
-
};
|
|
132
|
-
const isRemoteCodexStaleResumeFailure = (value) => splitNonEmptyOutputLines(value).some((line) => {
|
|
133
|
-
const normalized = line.toLowerCase();
|
|
134
|
-
return REMOTE_CODEX_STALE_RESUME_SUBSTRINGS.some((substring) => normalized.includes(substring));
|
|
135
|
-
});
|
|
136
|
-
const classifyRemoteCodexSetupFailure = ({ execResult, lastMessageReadError, }) => {
|
|
137
|
-
const combinedOutputRaw = `${execResult.stdout}\n${execResult.stderr}`;
|
|
138
|
-
const combinedOutput = combinedOutputRaw.toLowerCase();
|
|
139
|
-
const sessionId = execResult.threadId ?? extractCodexSessionId(combinedOutputRaw);
|
|
140
|
-
// Remote Codex output includes stderr from tools the setup task runs inside
|
|
141
|
-
// the Codex session. Generic 401s from those tools are not Codex auth errors.
|
|
142
|
-
if (isRemoteCodexAuthFailure(combinedOutputRaw)) {
|
|
143
|
-
return {
|
|
144
|
-
error: new Error("codex exec failed: remote Codex auth returned 401 unauthorized. Re-run `dvb setup --codex-auth byo` (or ensure proxy auth is configured), then retry with `dvb init --resume`."),
|
|
145
|
-
retryable: false,
|
|
146
|
-
sessionId,
|
|
147
|
-
};
|
|
148
|
-
}
|
|
149
|
-
if (isRelayForbidden(combinedOutputRaw)) {
|
|
150
|
-
return {
|
|
151
|
-
error: new Error("codex exec failed: relay proxy returned 403 forbidden. Run `dvb setup --codex-auth byo` and retry with `dvb init --resume`."),
|
|
152
|
-
retryable: false,
|
|
153
|
-
sessionId,
|
|
154
|
-
};
|
|
155
|
-
}
|
|
156
|
-
if (isRelayMissingOpenAiProxyConfiguration(combinedOutputRaw)) {
|
|
157
|
-
return {
|
|
158
|
-
error: new Error("codex exec 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`."),
|
|
159
|
-
retryable: false,
|
|
160
|
-
sessionId,
|
|
161
|
-
};
|
|
162
|
-
}
|
|
163
|
-
if (isRemoteCodexStaleResumeFailure(combinedOutputRaw)) {
|
|
164
|
-
const detail = summarizeCodexFailureDetail({
|
|
165
|
-
combinedOutputRaw,
|
|
166
|
-
...(lastMessageReadError ? { lastMessageReadError } : {}),
|
|
167
|
-
sessionId,
|
|
168
|
-
});
|
|
169
|
-
const detailSuffix = detail ? ` Detail: ${detail}` : "";
|
|
170
|
-
return {
|
|
171
|
-
error: new Error(`codex exec failed: stored remote setup thread no longer exists. Retrying with a fresh Codex session.${detailSuffix}`),
|
|
172
|
-
retryable: true,
|
|
173
|
-
sessionId: null,
|
|
174
|
-
resetResumeState: true,
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
if (execResult.exitCode === null) {
|
|
178
|
-
const detail = summarizeCodexFailureDetail({
|
|
179
|
-
combinedOutputRaw,
|
|
180
|
-
sessionId,
|
|
181
|
-
});
|
|
182
|
-
const detailSuffix = detail ? ` Detail: ${detail}` : "";
|
|
183
|
-
return {
|
|
184
|
-
error: new Error(`codex exec failed: remote exec stream closed before exit status.${detailSuffix}`),
|
|
185
|
-
retryable: true,
|
|
186
|
-
sessionId,
|
|
187
|
-
};
|
|
188
|
-
}
|
|
189
|
-
if (combinedOutput.includes("stream disconnected before completion")) {
|
|
190
|
-
const requestUrl = extractRequestUrl(combinedOutputRaw);
|
|
191
|
-
const detail = extractStreamDisconnectDetail(combinedOutputRaw) ??
|
|
192
|
-
summarizeCodexOutputDetail(combinedOutputRaw);
|
|
193
|
-
const detailSuffix = detail ? ` Detail: ${detail}` : "";
|
|
194
|
-
if (requestUrl && isLoopbackRelayUrl(requestUrl)) {
|
|
195
|
-
return {
|
|
196
|
-
error: new Error(`codex exec failed: local relay is unreachable at ${requestUrl}. Set a reachable remote relay URL (for example \`DEVBOX_REMOTE_RELAY_BASE_URL=https://relay.boxes.dev\`), run \`dvb setup\`, then retry with \`dvb init --resume\`.${detailSuffix}`),
|
|
197
|
-
retryable: false,
|
|
198
|
-
sessionId,
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
const requestTarget = requestUrl ?? "relay /v1/responses endpoint";
|
|
202
|
-
return {
|
|
203
|
-
error: new Error(`codex exec failed: proxy stream disconnected before completion while calling ${requestTarget}. Ensure relay connectivity from the remote devbox, then retry with \`dvb init --resume\`.${detailSuffix}`),
|
|
204
|
-
retryable: true,
|
|
205
|
-
sessionId,
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
if (combinedOutput.includes("no last agent message")) {
|
|
209
|
-
const detail = summarizeCodexFailureDetail({
|
|
210
|
-
combinedOutputRaw,
|
|
211
|
-
sessionId,
|
|
212
|
-
});
|
|
213
|
-
const detailSuffix = detail ? ` Detail: ${detail}` : "";
|
|
214
|
-
return {
|
|
215
|
-
error: new Error(`codex exec failed: Codex session ended without a final response.${detailSuffix} Setup was not applied; retry with \`dvb init --resume\`.`),
|
|
216
|
-
retryable: true,
|
|
217
|
-
sessionId,
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
|
-
if (execResult.exitCode !== 0) {
|
|
221
|
-
const detail = summarizeCodexFailureDetail({
|
|
222
|
-
combinedOutputRaw,
|
|
223
|
-
sessionId,
|
|
224
|
-
...(lastMessageReadError ? { lastMessageReadError } : {}),
|
|
225
|
-
});
|
|
226
|
-
const detailSuffix = detail ? ` Detail: ${detail}` : "";
|
|
227
|
-
return {
|
|
228
|
-
error: new Error(`codex exec failed (exit ${String(execResult.exitCode)})${detailSuffix}`),
|
|
229
|
-
retryable: false,
|
|
230
|
-
sessionId,
|
|
231
|
-
};
|
|
232
|
-
}
|
|
233
|
-
if (lastMessageReadError) {
|
|
234
|
-
const detail = summarizeCodexFailureDetail({
|
|
235
|
-
combinedOutputRaw,
|
|
236
|
-
lastMessageReadError,
|
|
237
|
-
sessionId,
|
|
238
|
-
});
|
|
239
|
-
const detailSuffix = detail ? ` Detail: ${detail}` : "";
|
|
240
|
-
return {
|
|
241
|
-
error: new Error(`codex exec failed: Codex session ended without writing the final response file.${detailSuffix} Setup may be incomplete; retry with \`dvb init --resume\`.`),
|
|
242
|
-
retryable: true,
|
|
243
|
-
sessionId,
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
const detail = summarizeCodexFailureDetail({
|
|
247
|
-
combinedOutputRaw,
|
|
248
|
-
sessionId,
|
|
249
|
-
});
|
|
250
|
-
const detailSuffix = detail ? ` Detail: ${detail}` : "";
|
|
251
|
-
return {
|
|
252
|
-
error: new Error(`codex exec failed: Codex session ended without a final response.${detailSuffix} Setup was not applied; retry with \`dvb init --resume\`.`),
|
|
253
|
-
retryable: true,
|
|
254
|
-
sessionId,
|
|
255
|
-
};
|
|
256
|
-
};
|
|
257
|
-
const isLoopbackRelayUrl = (requestUrl) => {
|
|
258
|
-
try {
|
|
259
|
-
const url = new URL(requestUrl);
|
|
260
|
-
return (url.hostname === "127.0.0.1" ||
|
|
261
|
-
url.hostname === "localhost" ||
|
|
262
|
-
url.hostname === "::1");
|
|
263
|
-
}
|
|
264
|
-
catch {
|
|
265
|
-
return false;
|
|
266
|
-
}
|
|
267
|
-
};
|
|
268
|
-
const resolveLocalCodexAuthPathCandidates = () => {
|
|
269
|
-
const configured = (process.env.CODEX_HOME ?? "").trim();
|
|
270
|
-
if (configured) {
|
|
271
|
-
return [path.join(configured, "auth.json")];
|
|
272
|
-
}
|
|
273
|
-
return [path.join(homedir(), ".codex", "auth.json")];
|
|
274
|
-
};
|
|
275
|
-
const readLocalCodexAuthCache = async () => {
|
|
276
|
-
for (const authPath of resolveLocalCodexAuthPathCandidates()) {
|
|
277
|
-
try {
|
|
278
|
-
return await fs.readFile(authPath);
|
|
279
|
-
}
|
|
280
|
-
catch {
|
|
281
|
-
// try next candidate
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
return null;
|
|
285
|
-
};
|
|
286
|
-
const ensureLocalCodexAuthForByoInit = async () => {
|
|
287
|
-
if (await readLocalCodexAuthCache()) {
|
|
288
|
-
return;
|
|
289
|
-
}
|
|
290
|
-
throw new Error("Local Codex auth is required when `dvb setup --codex-auth byo` is active. Run `codex login` locally or switch back to `dvb setup --codex-auth proxy`, then retry with `dvb init --resume`.");
|
|
291
|
-
};
|
|
292
|
-
const readRemoteUtf8FileIfExists = async ({ client, spriteAlias, path, workingDir, }) => {
|
|
293
|
-
try {
|
|
294
|
-
const bytes = await client.readFile(spriteAlias, {
|
|
295
|
-
path,
|
|
296
|
-
...(workingDir ? { workingDir } : {}),
|
|
297
|
-
});
|
|
298
|
-
return Buffer.from(bytes).toString("utf8");
|
|
299
|
-
}
|
|
300
|
-
catch (error) {
|
|
301
|
-
if (error instanceof SpritesApiError && error.status === 404) {
|
|
302
|
-
return null;
|
|
303
|
-
}
|
|
304
|
-
throw error;
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
const trimRemoteTextValue = (value) => {
|
|
308
|
-
if (value === null)
|
|
309
|
-
return null;
|
|
310
|
-
const trimmed = value.trim();
|
|
311
|
-
return trimmed.length > 0 ? trimmed : null;
|
|
312
|
-
};
|
|
313
|
-
const readRemoteSetupTodoSummary = async ({ client, spriteAlias, workdir, path, }) => {
|
|
314
|
-
const summary = (await readRemoteUtf8FileIfExists({
|
|
315
|
-
client,
|
|
316
|
-
spriteAlias,
|
|
317
|
-
path: path ?? ".devbox/setup.todo",
|
|
318
|
-
...(!path || !path.startsWith("/") ? { workingDir: workdir } : {}),
|
|
319
|
-
})) ?? null;
|
|
320
|
-
return trimRemoteTextValue(summary);
|
|
321
|
-
};
|
|
322
|
-
const readRemoteCodexLastMessage = async ({ client, spriteAlias, path, }) => {
|
|
323
|
-
const value = (await readRemoteUtf8FileIfExists({
|
|
324
|
-
client,
|
|
325
|
-
spriteAlias,
|
|
326
|
-
path,
|
|
327
|
-
})) ?? null;
|
|
328
|
-
return trimRemoteTextValue(value);
|
|
329
|
-
};
|
|
330
|
-
const resolveRemoteCodexCompletionMessage = ({ lastMessage, setupTodoSummary, }) => lastMessage ?? setupTodoSummary;
|
|
331
|
-
const readRemoteCodexCompletionArtifacts = async ({ client, spriteAlias, workdir, lastMessagePath, setupTodoPath, }) => {
|
|
332
|
-
const [setupTodoRaw, lastMessage] = await Promise.all([
|
|
333
|
-
readRemoteUtf8FileIfExists({
|
|
334
|
-
client,
|
|
335
|
-
spriteAlias,
|
|
336
|
-
path: setupTodoPath,
|
|
337
|
-
...(!setupTodoPath.startsWith("/") ? { workingDir: workdir } : {}),
|
|
338
|
-
}),
|
|
339
|
-
readRemoteCodexLastMessage({
|
|
340
|
-
client,
|
|
341
|
-
spriteAlias,
|
|
342
|
-
path: lastMessagePath,
|
|
343
|
-
}),
|
|
344
|
-
]);
|
|
345
|
-
const setupTodoSummary = trimRemoteTextValue(setupTodoRaw);
|
|
346
|
-
return {
|
|
347
|
-
lastMessagePath,
|
|
348
|
-
setupTodoPath,
|
|
349
|
-
lastMessage,
|
|
350
|
-
setupTodoRaw,
|
|
351
|
-
setupTodoSummary,
|
|
352
|
-
completionMessage: resolveRemoteCodexCompletionMessage({
|
|
353
|
-
lastMessage,
|
|
354
|
-
setupTodoSummary,
|
|
355
|
-
}),
|
|
356
|
-
};
|
|
357
|
-
};
|
|
358
|
-
const waitForRemoteCodexCompletionArtifacts = async ({ client, spriteAlias, workdir, lastMessagePath, setupTodoPath, graceMs = CODEX_APPLY_ARTIFACT_GRACE_MS, pollIntervalMs = CODEX_APPLY_ARTIFACT_POLL_INTERVAL_MS, }) => {
|
|
359
|
-
const deadline = Date.now() + Math.max(0, graceMs);
|
|
360
|
-
let artifacts = await readRemoteCodexCompletionArtifacts({
|
|
361
|
-
client,
|
|
362
|
-
spriteAlias,
|
|
363
|
-
workdir,
|
|
364
|
-
lastMessagePath,
|
|
365
|
-
setupTodoPath,
|
|
366
|
-
});
|
|
367
|
-
while (!artifacts.completionMessage && Date.now() < deadline) {
|
|
368
|
-
const remainingMs = deadline - Date.now();
|
|
369
|
-
await delay(Math.min(Math.max(1, pollIntervalMs), remainingMs));
|
|
370
|
-
artifacts = await readRemoteCodexCompletionArtifacts({
|
|
371
|
-
client,
|
|
372
|
-
spriteAlias,
|
|
373
|
-
workdir,
|
|
374
|
-
lastMessagePath,
|
|
375
|
-
setupTodoPath,
|
|
376
|
-
});
|
|
377
|
-
}
|
|
378
|
-
return artifacts;
|
|
379
|
-
};
|
|
380
|
-
const hasRemoteExecSession = async ({ client, spriteAlias, execSessionId, }) => {
|
|
381
|
-
const targetSessionId = execSessionId.trim();
|
|
382
|
-
if (!targetSessionId) {
|
|
383
|
-
return false;
|
|
384
|
-
}
|
|
385
|
-
const sessions = await client.listExecSessions(spriteAlias);
|
|
386
|
-
return sessions.some((session) => session.id === targetSessionId);
|
|
387
|
-
};
|
|
388
|
-
const writeCanonicalSetupTodo = async ({ client, spriteAlias, canonicalSetupTodoPath, setupTodoRaw, completionMessage, }) => {
|
|
389
|
-
const canonicalContent = setupTodoRaw ?? `${completionMessage}\n`;
|
|
390
|
-
await client.writeFile(spriteAlias, canonicalSetupTodoPath, Buffer.from(canonicalContent.endsWith("\n")
|
|
391
|
-
? canonicalContent
|
|
392
|
-
: `${canonicalContent}\n`, "utf8"));
|
|
393
|
-
};
|
|
394
|
-
const syncLocalCodexAuthCacheToSprite = async ({ client, spriteAlias, status, }) => {
|
|
395
|
-
const authBytes = await readLocalCodexAuthCache();
|
|
396
|
-
if (!authBytes)
|
|
397
|
-
return false;
|
|
398
|
-
status.stage("Syncing Codex auth cache");
|
|
399
|
-
const remoteHome = await resolveRemoteHomeDir(client, spriteAlias).catch(() => null);
|
|
400
|
-
if (!remoteHome)
|
|
401
|
-
return false;
|
|
402
|
-
const remoteCodexDir = `${remoteHome}/.codex`;
|
|
403
|
-
const remoteAuthPath = `${remoteCodexDir}/auth.json`;
|
|
404
|
-
const ensureDir = await client.exec(spriteAlias, [
|
|
405
|
-
"/bin/bash",
|
|
406
|
-
"--noprofile",
|
|
407
|
-
"--norc",
|
|
408
|
-
"-e",
|
|
409
|
-
"-u",
|
|
410
|
-
"-o",
|
|
411
|
-
"pipefail",
|
|
412
|
-
"-c",
|
|
413
|
-
[
|
|
414
|
-
"set -euo pipefail",
|
|
415
|
-
`mkdir -p ${shellQuote(remoteCodexDir)}`,
|
|
416
|
-
`chmod 700 ${shellQuote(remoteCodexDir)}`,
|
|
417
|
-
].join("\n"),
|
|
418
|
-
]);
|
|
419
|
-
if (ensureDir.exitCode !== 0) {
|
|
420
|
-
return false;
|
|
421
|
-
}
|
|
422
|
-
try {
|
|
423
|
-
await client.writeFile(spriteAlias, remoteAuthPath, authBytes);
|
|
424
|
-
}
|
|
425
|
-
catch {
|
|
426
|
-
return false;
|
|
427
|
-
}
|
|
428
|
-
const chmodAuth = await client.exec(spriteAlias, [
|
|
429
|
-
"/bin/bash",
|
|
430
|
-
"--noprofile",
|
|
431
|
-
"--norc",
|
|
432
|
-
"-e",
|
|
433
|
-
"-u",
|
|
434
|
-
"-o",
|
|
435
|
-
"pipefail",
|
|
436
|
-
"-c",
|
|
437
|
-
`chmod 600 ${shellQuote(remoteAuthPath)}`,
|
|
438
|
-
]);
|
|
439
|
-
if (chmodAuth.exitCode !== 0) {
|
|
440
|
-
// Best-effort: the presence of the file is what our login check uses.
|
|
441
|
-
}
|
|
442
|
-
return true;
|
|
443
|
-
};
|
|
444
|
-
const defaultRemoteCodexLoginDeps = {
|
|
445
|
-
syncLocalCodexAuthCacheToSprite,
|
|
446
|
-
isRemoteCodexLoggedIn,
|
|
447
|
-
requireDaemonFeatures,
|
|
448
|
-
runRemoteCodexLogin,
|
|
449
|
-
requestJson,
|
|
450
|
-
showCopyableUrl,
|
|
451
|
-
selectOpenInBrowser: clackSelect,
|
|
452
|
-
isCancelSelection: isCancel,
|
|
453
|
-
cancelInit: clackCancel,
|
|
454
|
-
openBrowser,
|
|
455
|
-
log: clackLog,
|
|
456
|
-
};
|
|
457
|
-
const ensureRemoteCodexLoginForByoSetup = async ({ client, spriteAlias, expandedWorkdir, socketInfo, status, pathSetup, interactiveLoginAllowed = true, deps = defaultRemoteCodexLoginDeps, }) => {
|
|
458
|
-
await deps.syncLocalCodexAuthCacheToSprite({
|
|
459
|
-
client,
|
|
460
|
-
spriteAlias,
|
|
461
|
-
status,
|
|
462
|
-
});
|
|
463
|
-
status.stage("Check Codex login");
|
|
464
|
-
const loggedIn = await deps.isRemoteCodexLoggedIn(client, spriteAlias);
|
|
465
|
-
if (loggedIn) {
|
|
466
|
-
return;
|
|
467
|
-
}
|
|
468
|
-
if (!interactiveLoginAllowed) {
|
|
469
|
-
throw new Error("Codex login requires an interactive TTY. Re-run `dvb init --resume` without `--json`, or switch to `dvb setup --codex-auth proxy` so init can authenticate non-interactively.");
|
|
470
|
-
}
|
|
471
|
-
await deps.requireDaemonFeatures(socketInfo.socketPath, ["ports"]);
|
|
472
|
-
status.stage("Waiting for Codex login");
|
|
473
|
-
let openedUrl = false;
|
|
474
|
-
let forwarded = false;
|
|
475
|
-
let portReloadError = null;
|
|
476
|
-
await deps.runRemoteCodexLogin({
|
|
477
|
-
client,
|
|
478
|
-
spriteAlias,
|
|
479
|
-
cmd: [
|
|
480
|
-
"/bin/bash",
|
|
481
|
-
"--noprofile",
|
|
482
|
-
"--norc",
|
|
483
|
-
"-e",
|
|
484
|
-
"-u",
|
|
485
|
-
"-o",
|
|
486
|
-
"pipefail",
|
|
487
|
-
"-c",
|
|
488
|
-
`${pathSetup}\ncd ${shellQuote(expandedWorkdir)}\ncodex login`,
|
|
489
|
-
],
|
|
490
|
-
tty: true,
|
|
491
|
-
onUrl: async (url) => {
|
|
492
|
-
if (openedUrl)
|
|
493
|
-
return;
|
|
494
|
-
openedUrl = true;
|
|
495
|
-
status.stop();
|
|
496
|
-
deps.showCopyableUrl(url, "Codex login URL");
|
|
497
|
-
const action = await deps.selectOpenInBrowser({
|
|
498
|
-
message: "Open the Codex login URL in your browser?",
|
|
499
|
-
options: [
|
|
500
|
-
{ value: "open", label: "Open in browser" },
|
|
501
|
-
{ value: "skip", label: "Skip" },
|
|
502
|
-
],
|
|
503
|
-
initialValue: "open",
|
|
504
|
-
});
|
|
505
|
-
if (deps.isCancelSelection(action)) {
|
|
506
|
-
deps.cancelInit("Init canceled.");
|
|
507
|
-
throw new Error("Init canceled.");
|
|
508
|
-
}
|
|
509
|
-
if (action === "open") {
|
|
510
|
-
const opened = await deps.openBrowser(url);
|
|
511
|
-
if (opened) {
|
|
512
|
-
deps.log.success("Opened browser for Codex login.");
|
|
513
|
-
}
|
|
514
|
-
else {
|
|
515
|
-
deps.log.warn("Unable to open the browser automatically.");
|
|
516
|
-
deps.log.info("Open the URL above to log in to Codex.");
|
|
517
|
-
}
|
|
518
|
-
}
|
|
519
|
-
else {
|
|
520
|
-
deps.log.warn([
|
|
521
|
-
"Skipping browser open.",
|
|
522
|
-
"You must open the URL above to log in to Codex before setup can proceed.",
|
|
523
|
-
"If you exit, re-run `dvb init --resume` from this repo.",
|
|
524
|
-
].join(" "));
|
|
525
|
-
}
|
|
526
|
-
status.stage("Waiting for Codex login");
|
|
527
|
-
},
|
|
528
|
-
onLocalPort: async () => {
|
|
529
|
-
if (forwarded)
|
|
530
|
-
return;
|
|
531
|
-
forwarded = true;
|
|
532
|
-
try {
|
|
533
|
-
const reload = await deps.requestJson(socketInfo.socketPath, "POST", "/ports/reload", 5000, { box: spriteAlias });
|
|
534
|
-
if (reload.status < 200 || reload.status >= 300) {
|
|
535
|
-
throw new Error("Failed to refresh port forwarding for Codex login.");
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
catch (error) {
|
|
539
|
-
portReloadError =
|
|
540
|
-
error instanceof Error ? error : new Error(String(error));
|
|
541
|
-
}
|
|
542
|
-
},
|
|
543
|
-
});
|
|
544
|
-
if (!openedUrl) {
|
|
545
|
-
throw new Error("Codex login did not emit a login URL.");
|
|
546
|
-
}
|
|
547
|
-
if (portReloadError) {
|
|
548
|
-
throw portReloadError;
|
|
549
|
-
}
|
|
550
|
-
status.stage("Check Codex login");
|
|
551
|
-
const loggedInAfter = await deps.isRemoteCodexLoggedIn(client, spriteAlias);
|
|
552
|
-
if (!loggedInAfter) {
|
|
553
|
-
throw new Error([
|
|
554
|
-
"Codex login did not complete.",
|
|
555
|
-
"Open the login URL above and then re-run `dvb init --resume` from this repo.",
|
|
556
|
-
].join(" "));
|
|
557
|
-
}
|
|
558
|
-
};
|
|
559
|
-
const uploadSetupPlan = async ({ client, spriteAlias, localSetupPath, remoteSetupPath, localArtifactsBundlePath, localArtifactsManifestPath, localArtifactsPartsDescriptorPath, remoteArtifactsBundlePath, remoteArtifactsManifestPath, remoteArtifactsPartsDescriptorPath, status, }) => {
|
|
560
|
-
status.stage("Preparing setup files");
|
|
561
|
-
const setupDirResult = await client.exec(spriteAlias, [
|
|
562
|
-
"/bin/bash",
|
|
563
|
-
"--noprofile",
|
|
564
|
-
"--norc",
|
|
565
|
-
"-e",
|
|
566
|
-
"-u",
|
|
567
|
-
"-o",
|
|
568
|
-
"pipefail",
|
|
569
|
-
"-c",
|
|
570
|
-
`mkdir -p ${shellQuote(path.posix.dirname(remoteSetupPath))}`,
|
|
571
|
-
]);
|
|
572
|
-
if (setupDirResult.exitCode !== 0) {
|
|
573
|
-
throw new Error(setupDirResult.stderr || "Failed to prepare setup directory");
|
|
574
|
-
}
|
|
575
|
-
let splitArtifacts = null;
|
|
576
|
-
const uploadItems = [
|
|
577
|
-
{
|
|
578
|
-
label: "setup plan",
|
|
579
|
-
localPath: localSetupPath,
|
|
580
|
-
remotePath: remoteSetupPath,
|
|
581
|
-
},
|
|
582
|
-
];
|
|
583
|
-
if (localArtifactsBundlePath &&
|
|
584
|
-
localArtifactsManifestPath &&
|
|
585
|
-
remoteArtifactsBundlePath &&
|
|
586
|
-
remoteArtifactsManifestPath) {
|
|
587
|
-
if (localArtifactsPartsDescriptorPath &&
|
|
588
|
-
remoteArtifactsPartsDescriptorPath) {
|
|
589
|
-
const descriptor = await readSetupArtifactsPartsDescriptor(localArtifactsPartsDescriptorPath);
|
|
590
|
-
const descriptorDir = path.dirname(localArtifactsPartsDescriptorPath);
|
|
591
|
-
const remoteBundleDir = path.posix.dirname(remoteArtifactsBundlePath);
|
|
592
|
-
const parts = [];
|
|
593
|
-
for (const part of descriptor.parts) {
|
|
594
|
-
const localPartPath = path.resolve(descriptorDir, part.relativePath);
|
|
595
|
-
const stat = await fs.stat(localPartPath);
|
|
596
|
-
if (stat.size !== part.sizeBytes) {
|
|
597
|
-
throw new Error(`Setup artifact part size mismatch: ${localPartPath} (expected ${part.sizeBytes}, got ${stat.size})`);
|
|
598
|
-
}
|
|
599
|
-
parts.push({
|
|
600
|
-
index: part.index,
|
|
601
|
-
localPath: localPartPath,
|
|
602
|
-
remotePath: path.posix.join(remoteBundleDir, path.posix.basename(part.relativePath)),
|
|
603
|
-
sizeBytes: part.sizeBytes,
|
|
604
|
-
sha256: part.sha256,
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
parts.sort((a, b) => a.index - b.index);
|
|
608
|
-
splitArtifacts = {
|
|
609
|
-
descriptorPath: localArtifactsPartsDescriptorPath,
|
|
610
|
-
remoteDescriptorPath: remoteArtifactsPartsDescriptorPath,
|
|
611
|
-
expectedBundleSize: descriptor.totalSizeBytes,
|
|
612
|
-
expectedBundleSha: descriptor.bundleSha256,
|
|
613
|
-
parts,
|
|
614
|
-
};
|
|
615
|
-
status.stage("Prep split artifact upload");
|
|
616
|
-
const cleanupScript = [
|
|
617
|
-
"set -euo pipefail",
|
|
618
|
-
`bundle=${shellQuote(remoteArtifactsBundlePath)}`,
|
|
619
|
-
`descriptor=${shellQuote(remoteArtifactsPartsDescriptorPath)}`,
|
|
620
|
-
'bundle_dir="$(dirname "$bundle")"',
|
|
621
|
-
'bundle_base="$(basename "$bundle")"',
|
|
622
|
-
'rm -f "$bundle" "$descriptor" "$descriptor".tmp-upload-*',
|
|
623
|
-
'rm -f "$bundle_dir/$bundle_base.part-"*',
|
|
624
|
-
'rm -f "$bundle_dir/$bundle_base.part-"*.tmp-upload-*',
|
|
625
|
-
'rm -f "$bundle_dir/$bundle_base.tmp-assemble-"*',
|
|
626
|
-
].join("\n");
|
|
627
|
-
const cleanupResult = await client.exec(spriteAlias, [
|
|
628
|
-
"/bin/bash",
|
|
629
|
-
"--noprofile",
|
|
630
|
-
"--norc",
|
|
631
|
-
"-e",
|
|
632
|
-
"-u",
|
|
633
|
-
"-o",
|
|
634
|
-
"pipefail",
|
|
635
|
-
"-c",
|
|
636
|
-
cleanupScript,
|
|
637
|
-
]);
|
|
638
|
-
if (cleanupResult.exitCode !== 0) {
|
|
639
|
-
throw new Error(cleanupResult.stderr ||
|
|
640
|
-
cleanupResult.stdout ||
|
|
641
|
-
"Failed to clean stale split setup artifact uploads");
|
|
642
|
-
}
|
|
643
|
-
uploadItems.push({
|
|
644
|
-
label: `artifacts manifest (${path.basename(localArtifactsManifestPath)})`,
|
|
645
|
-
localPath: localArtifactsManifestPath,
|
|
646
|
-
remotePath: remoteArtifactsManifestPath,
|
|
647
|
-
}, {
|
|
648
|
-
label: `artifacts parts (${path.basename(localArtifactsPartsDescriptorPath)})`,
|
|
649
|
-
localPath: localArtifactsPartsDescriptorPath,
|
|
650
|
-
remotePath: remoteArtifactsPartsDescriptorPath,
|
|
651
|
-
});
|
|
652
|
-
for (const part of parts) {
|
|
653
|
-
uploadItems.push({
|
|
654
|
-
label: `artifacts part ${part.index + 1}/${parts.length}`,
|
|
655
|
-
localPath: part.localPath,
|
|
656
|
-
remotePath: part.remotePath,
|
|
657
|
-
});
|
|
658
|
-
}
|
|
659
|
-
}
|
|
660
|
-
else {
|
|
661
|
-
uploadItems.push({
|
|
662
|
-
label: "artifacts bundle",
|
|
663
|
-
localPath: localArtifactsBundlePath,
|
|
664
|
-
remotePath: remoteArtifactsBundlePath,
|
|
665
|
-
}, {
|
|
666
|
-
label: `artifacts manifest (${path.basename(localArtifactsManifestPath)})`,
|
|
667
|
-
localPath: localArtifactsManifestPath,
|
|
668
|
-
remotePath: remoteArtifactsManifestPath,
|
|
669
|
-
});
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
const plannedUploads = await Promise.all(uploadItems.map(async (item) => {
|
|
673
|
-
const stats = await fs.stat(item.localPath);
|
|
674
|
-
return { ...item, size: stats.size };
|
|
675
|
-
}));
|
|
676
|
-
const totalBytes = plannedUploads.reduce((sum, item) => sum + item.size, 0);
|
|
677
|
-
let uploadedBytes = 0;
|
|
678
|
-
const updateProgress = (currentFileBytes, detail) => status.byteProgress({
|
|
679
|
-
title: "Uploading setup plan",
|
|
680
|
-
uploadedBytes: uploadedBytes + currentFileBytes,
|
|
681
|
-
totalBytes,
|
|
682
|
-
detail,
|
|
683
|
-
});
|
|
684
|
-
for (const [index, upload] of plannedUploads.entries()) {
|
|
685
|
-
const detail = `${upload.label} (${index + 1}/${plannedUploads.length})`;
|
|
686
|
-
const fileData = await fs.readFile(upload.localPath);
|
|
687
|
-
updateProgress(0, detail);
|
|
688
|
-
await client.writeFile(spriteAlias, upload.remotePath, fileData, {
|
|
689
|
-
onProgress: (fileUploadedBytes, fileTotalBytes) => {
|
|
690
|
-
const bounded = Math.min(fileUploadedBytes, Math.max(fileData.length, fileTotalBytes));
|
|
691
|
-
updateProgress(bounded, detail);
|
|
692
|
-
},
|
|
693
|
-
});
|
|
694
|
-
uploadedBytes += fileData.length;
|
|
695
|
-
updateProgress(fileData.length, detail);
|
|
696
|
-
}
|
|
697
|
-
if (splitArtifacts && remoteArtifactsBundlePath) {
|
|
698
|
-
status.stage("Assembling artifacts on remote");
|
|
699
|
-
const assembledTmpPath = `${remoteArtifactsBundlePath}.tmp-assemble-${randomUUID()}`;
|
|
700
|
-
const assembleScript = [
|
|
701
|
-
"set -euo pipefail",
|
|
702
|
-
`bundle=${shellQuote(remoteArtifactsBundlePath)}`,
|
|
703
|
-
`descriptor=${shellQuote(splitArtifacts.remoteDescriptorPath)}`,
|
|
704
|
-
`assembled_tmp=${shellQuote(assembledTmpPath)}`,
|
|
705
|
-
`expected_bundle_size=${splitArtifacts.expectedBundleSize}`,
|
|
706
|
-
`expected_bundle_sha=${shellQuote(splitArtifacts.expectedBundleSha)}`,
|
|
707
|
-
"hash_file() {",
|
|
708
|
-
" if command -v sha256sum >/dev/null 2>&1; then",
|
|
709
|
-
" sha256sum \"$1\" | awk '{print $1}'",
|
|
710
|
-
" return 0",
|
|
711
|
-
" fi",
|
|
712
|
-
" if command -v shasum >/dev/null 2>&1; then",
|
|
713
|
-
" shasum -a 256 \"$1\" | awk '{print $1}'",
|
|
714
|
-
" return 0",
|
|
715
|
-
" fi",
|
|
716
|
-
' echo "No SHA256 tool available (sha256sum/shasum)." >&2',
|
|
717
|
-
" return 1",
|
|
718
|
-
"}",
|
|
719
|
-
'cleanup() { rm -f "$assembled_tmp"; }',
|
|
720
|
-
"trap cleanup EXIT",
|
|
721
|
-
': > "$assembled_tmp"',
|
|
722
|
-
...splitArtifacts.parts.flatMap((part) => [
|
|
723
|
-
`part_path=${shellQuote(part.remotePath)}`,
|
|
724
|
-
`part_expected_size=${part.sizeBytes}`,
|
|
725
|
-
`part_expected_sha=${shellQuote(part.sha256)}`,
|
|
726
|
-
'[ -f "$part_path" ] || { echo "Missing setup artifact part: $part_path" >&2; exit 1; }',
|
|
727
|
-
'part_size="$(wc -c < "$part_path" | tr -d \'[:space:]\')"',
|
|
728
|
-
'if [ "$part_size" != "$part_expected_size" ]; then echo "Part size mismatch for $part_path: expected $part_expected_size got $part_size" >&2; exit 1; fi',
|
|
729
|
-
'part_sha="$(hash_file "$part_path")"',
|
|
730
|
-
'if [ "$part_sha" != "$part_expected_sha" ]; then echo "Part checksum mismatch for $part_path" >&2; exit 1; fi',
|
|
731
|
-
'cat "$part_path" >> "$assembled_tmp"',
|
|
732
|
-
]),
|
|
733
|
-
'assembled_size="$(wc -c < "$assembled_tmp" | tr -d \'[:space:]\')"',
|
|
734
|
-
'if [ "$assembled_size" != "$expected_bundle_size" ]; then echo "Assembled bundle size mismatch: expected $expected_bundle_size got $assembled_size" >&2; exit 1; fi',
|
|
735
|
-
'assembled_sha="$(hash_file "$assembled_tmp")"',
|
|
736
|
-
'if [ "$assembled_sha" != "$expected_bundle_sha" ]; then echo "Assembled bundle checksum mismatch" >&2; exit 1; fi',
|
|
737
|
-
'mv "$assembled_tmp" "$bundle"',
|
|
738
|
-
'rm -f "$descriptor"',
|
|
739
|
-
...splitArtifacts.parts.map((part) => `rm -f ${shellQuote(part.remotePath)}`),
|
|
740
|
-
"trap - EXIT",
|
|
741
|
-
].join("\n");
|
|
742
|
-
const assembleResult = await client.exec(spriteAlias, [
|
|
743
|
-
"/bin/bash",
|
|
744
|
-
"--noprofile",
|
|
745
|
-
"--norc",
|
|
746
|
-
"-e",
|
|
747
|
-
"-u",
|
|
748
|
-
"-o",
|
|
749
|
-
"pipefail",
|
|
750
|
-
"-c",
|
|
751
|
-
assembleScript,
|
|
752
|
-
]);
|
|
753
|
-
if (assembleResult.exitCode !== 0) {
|
|
754
|
-
throw new Error(assembleResult.stderr ||
|
|
755
|
-
assembleResult.stdout ||
|
|
756
|
-
"Failed to assemble split setup artifacts on remote");
|
|
757
|
-
}
|
|
758
|
-
}
|
|
759
|
-
status.byteProgress({
|
|
760
|
-
title: "Uploading setup plan",
|
|
761
|
-
uploadedBytes: totalBytes,
|
|
762
|
-
totalBytes,
|
|
763
|
-
detail: "completed",
|
|
764
|
-
});
|
|
765
|
-
};
|
|
766
|
-
const runRemoteCodexSetup = async ({ client, spriteAlias, computeProvider, expandedWorkdir, remoteSetupPath, remoteArtifactsBundlePath, remoteArtifactsManifestPath, socketInfo, status, pathSetup, entrypoints, proxyOptions, resumeState = null, onResumeStateChange, interactiveLoginAllowed = true, emitCodexOutput = true, remoteExecOptions, completionArtifactsGraceMs = CODEX_APPLY_ARTIFACT_GRACE_MS, completionArtifactsPollIntervalMs = CODEX_APPLY_ARTIFACT_POLL_INTERVAL_MS, }) => {
|
|
767
|
-
if (!proxyOptions) {
|
|
768
|
-
// Always prefer local Codex auth in BYO mode so remote setup uses the same
|
|
769
|
-
// credential state as the user's local machine.
|
|
770
|
-
await ensureRemoteCodexLoginForByoSetup({
|
|
771
|
-
client,
|
|
772
|
-
spriteAlias,
|
|
773
|
-
expandedWorkdir,
|
|
774
|
-
socketInfo,
|
|
775
|
-
status,
|
|
776
|
-
pathSetup,
|
|
777
|
-
interactiveLoginAllowed,
|
|
778
|
-
});
|
|
779
|
-
}
|
|
780
|
-
status.stage("Apply setup plan");
|
|
781
|
-
const remoteHome = await resolveRemoteHomeDir(client, spriteAlias);
|
|
782
|
-
const proxyRoot = proxyOptions
|
|
783
|
-
? `${remoteHome}/.devbox/tmp/codex-proxy-${randomUUID()}`
|
|
784
|
-
: null;
|
|
785
|
-
const proxyTokenPath = proxyRoot ? `${proxyRoot}/devbox-token` : null;
|
|
786
|
-
const proxyCodexHome = proxyRoot ? `${proxyRoot}/codex-home` : null;
|
|
787
|
-
const proxyConfigPath = proxyCodexHome
|
|
788
|
-
? `${proxyCodexHome}/config.toml`
|
|
789
|
-
: null;
|
|
790
|
-
const canonicalSetupTodoPath = path.posix.join(expandedWorkdir, ".devbox", "setup.todo");
|
|
791
|
-
if (proxyOptions && proxyRoot && proxyTokenPath && proxyConfigPath) {
|
|
792
|
-
status.stage("Preparing Codex proxy");
|
|
793
|
-
const codexHomePath = proxyCodexHome ?? `${proxyRoot}/codex-home`;
|
|
794
|
-
try {
|
|
795
|
-
const prepResult = await client.exec(spriteAlias, [
|
|
796
|
-
"/bin/bash",
|
|
797
|
-
"--noprofile",
|
|
798
|
-
"--norc",
|
|
799
|
-
"-e",
|
|
800
|
-
"-u",
|
|
801
|
-
"-o",
|
|
802
|
-
"pipefail",
|
|
803
|
-
"-c",
|
|
804
|
-
[
|
|
805
|
-
"set -euo pipefail",
|
|
806
|
-
`mkdir -p ${shellQuote(codexHomePath)}`,
|
|
807
|
-
`chmod 700 ${shellQuote(proxyRoot)} ${shellQuote(codexHomePath)}`,
|
|
808
|
-
].join("\n"),
|
|
809
|
-
]);
|
|
810
|
-
if (prepResult.exitCode !== 0) {
|
|
811
|
-
throw new Error(prepResult.stderr ||
|
|
812
|
-
prepResult.stdout ||
|
|
813
|
-
"Failed to prepare Codex proxy context");
|
|
814
|
-
}
|
|
815
|
-
const proxyAuthHeader = buildCodexProxyAuthorizationHeader(proxyOptions.controlPlaneToken);
|
|
816
|
-
const proxyConfig = buildCodexProxyConfig({
|
|
817
|
-
relayBaseUrl: proxyOptions.relayBaseUrl,
|
|
818
|
-
trustedPaths: [expandedWorkdir, remoteHome],
|
|
819
|
-
});
|
|
820
|
-
await client.writeFile(spriteAlias, proxyTokenPath, Buffer.from(proxyAuthHeader, "utf8"));
|
|
821
|
-
await client.writeFile(spriteAlias, proxyConfigPath, Buffer.from(proxyConfig, "utf8"));
|
|
822
|
-
const chmodResult = await client.exec(spriteAlias, [
|
|
823
|
-
"/bin/bash",
|
|
824
|
-
"--noprofile",
|
|
825
|
-
"--norc",
|
|
826
|
-
"-e",
|
|
827
|
-
"-u",
|
|
828
|
-
"-o",
|
|
829
|
-
"pipefail",
|
|
830
|
-
"-c",
|
|
831
|
-
[
|
|
832
|
-
"set -euo pipefail",
|
|
833
|
-
`chmod 600 ${shellQuote(proxyTokenPath)} ${shellQuote(proxyConfigPath)}`,
|
|
834
|
-
].join("\n"),
|
|
835
|
-
]);
|
|
836
|
-
if (chmodResult.exitCode !== 0) {
|
|
837
|
-
throw new Error(chmodResult.stderr ||
|
|
838
|
-
chmodResult.stdout ||
|
|
839
|
-
"Failed to secure Codex proxy context");
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
catch (error) {
|
|
843
|
-
await client
|
|
844
|
-
.exec(spriteAlias, [
|
|
845
|
-
"/bin/bash",
|
|
846
|
-
"--noprofile",
|
|
847
|
-
"--norc",
|
|
848
|
-
"-e",
|
|
849
|
-
"-u",
|
|
850
|
-
"-o",
|
|
851
|
-
"pipefail",
|
|
852
|
-
"-c",
|
|
853
|
-
`rm -rf ${shellQuote(proxyRoot)}`,
|
|
854
|
-
])
|
|
855
|
-
.catch(() => { });
|
|
856
|
-
throw error;
|
|
857
|
-
}
|
|
858
|
-
}
|
|
859
|
-
const buildRemoteCodexExecArgs = ({ prompt, lastMessagePath, resumeThreadId, }) => resumeThreadId
|
|
860
|
-
? [
|
|
861
|
-
...buildCodexInitExecArgs(),
|
|
862
|
-
"resume",
|
|
863
|
-
"--dangerously-bypass-approvals-and-sandbox",
|
|
864
|
-
"--json",
|
|
865
|
-
"--output-last-message",
|
|
866
|
-
lastMessagePath,
|
|
867
|
-
resumeThreadId,
|
|
868
|
-
prompt,
|
|
869
|
-
]
|
|
870
|
-
: [
|
|
871
|
-
...buildCodexInitExecArgs(),
|
|
872
|
-
"--dangerously-bypass-approvals-and-sandbox",
|
|
873
|
-
"--json",
|
|
874
|
-
"--output-last-message",
|
|
875
|
-
lastMessagePath,
|
|
876
|
-
prompt,
|
|
877
|
-
];
|
|
878
|
-
const buildRemoteCodexCommand = ({ prompt, lastMessagePath, setupTodoPath, resumeThreadId, clearArtifacts, }) => [
|
|
879
|
-
"set -euo pipefail",
|
|
880
|
-
`output_path=${shellQuote(lastMessagePath)}`,
|
|
881
|
-
`summary_path=${shellQuote(setupTodoPath)}`,
|
|
882
|
-
`mkdir -p ${shellQuote(path.posix.dirname(lastMessagePath))}`,
|
|
883
|
-
`mkdir -p ${shellQuote(path.posix.dirname(setupTodoPath))}`,
|
|
884
|
-
...(clearArtifacts ? ['rm -f "$output_path" "$summary_path"'] : []),
|
|
885
|
-
pathSetup,
|
|
886
|
-
...(proxyRoot && proxyTokenPath && proxyCodexHome
|
|
887
|
-
? [
|
|
888
|
-
`proxy_root=${shellQuote(proxyRoot)}`,
|
|
889
|
-
`proxy_token=${shellQuote(proxyTokenPath)}`,
|
|
890
|
-
'export DEVBOX_TOKEN="$(cat "$proxy_token")"',
|
|
891
|
-
`export CODEX_HOME=${shellQuote(proxyCodexHome)}`,
|
|
892
|
-
]
|
|
893
|
-
: []),
|
|
894
|
-
`cd ${shellQuote(expandedWorkdir)}`,
|
|
895
|
-
`codex exec ${buildRemoteCodexExecArgs({
|
|
896
|
-
prompt,
|
|
897
|
-
lastMessagePath,
|
|
898
|
-
resumeThreadId,
|
|
899
|
-
})
|
|
900
|
-
.map((arg) => shellQuote(arg))
|
|
901
|
-
.join(" ")}`,
|
|
902
|
-
].join("\n");
|
|
903
|
-
let lastMessage = "";
|
|
904
|
-
let activeThreadId = resumeState?.threadId ?? null;
|
|
905
|
-
let activeExecSessionId = resumeState?.execSessionId ?? null;
|
|
906
|
-
let activeRunRoot = resumeState?.runRoot ?? null;
|
|
907
|
-
let activeLastMessagePath = resumeState?.lastMessagePath ?? null;
|
|
908
|
-
let activeSetupTodoPath = resumeState?.setupTodoPath ?? null;
|
|
909
|
-
try {
|
|
910
|
-
for (let attempt = 1; attempt <= DEFAULT_CODEX_EXEC_MAX_ATTEMPTS; attempt += 1) {
|
|
911
|
-
const existingExecSessionAvailable = activeExecSessionId
|
|
912
|
-
? await hasRemoteExecSession({
|
|
913
|
-
client,
|
|
914
|
-
spriteAlias,
|
|
915
|
-
execSessionId: activeExecSessionId,
|
|
916
|
-
})
|
|
917
|
-
: false;
|
|
918
|
-
if (activeExecSessionId && !existingExecSessionAvailable) {
|
|
919
|
-
activeExecSessionId = null;
|
|
920
|
-
if (!activeThreadId) {
|
|
921
|
-
activeRunRoot = null;
|
|
922
|
-
activeLastMessagePath = null;
|
|
923
|
-
activeSetupTodoPath = null;
|
|
924
|
-
await onResumeStateChange?.(null);
|
|
925
|
-
}
|
|
926
|
-
else if (onResumeStateChange &&
|
|
927
|
-
activeRunRoot &&
|
|
928
|
-
activeLastMessagePath &&
|
|
929
|
-
activeSetupTodoPath) {
|
|
930
|
-
await onResumeStateChange({
|
|
931
|
-
threadId: activeThreadId,
|
|
932
|
-
execSessionId: null,
|
|
933
|
-
runRoot: activeRunRoot,
|
|
934
|
-
lastMessagePath: activeLastMessagePath,
|
|
935
|
-
setupTodoPath: activeSetupTodoPath,
|
|
936
|
-
});
|
|
937
|
-
}
|
|
938
|
-
}
|
|
939
|
-
const reusingSessionArtifacts = Boolean(activeRunRoot && activeLastMessagePath && activeSetupTodoPath);
|
|
940
|
-
const reattachingExistingExecSession = Boolean(activeExecSessionId);
|
|
941
|
-
const continuingExistingThread = Boolean(activeThreadId);
|
|
942
|
-
const attemptRunRoot = reusingSessionArtifacts && activeRunRoot
|
|
943
|
-
? activeRunRoot
|
|
944
|
-
: `${remoteHome}/.devbox/tmp/codex-apply-${randomUUID()}`;
|
|
945
|
-
const attemptLastMessagePath = reusingSessionArtifacts && activeLastMessagePath
|
|
946
|
-
? activeLastMessagePath
|
|
947
|
-
: `${attemptRunRoot}/codex-setup-output.txt`;
|
|
948
|
-
const attemptSetupTodoPath = reusingSessionArtifacts && activeSetupTodoPath
|
|
949
|
-
? activeSetupTodoPath
|
|
950
|
-
: `${attemptRunRoot}/setup.todo`;
|
|
951
|
-
activeRunRoot = attemptRunRoot;
|
|
952
|
-
activeLastMessagePath = attemptLastMessagePath;
|
|
953
|
-
activeSetupTodoPath = attemptSetupTodoPath;
|
|
954
|
-
const prompt = reattachingExistingExecSession
|
|
955
|
-
? null
|
|
956
|
-
: continuingExistingThread
|
|
957
|
-
? "continue"
|
|
958
|
-
: await renderRemoteApplyPrompt({
|
|
959
|
-
setupPath: remoteSetupPath,
|
|
960
|
-
artifactsBundle: remoteArtifactsBundlePath,
|
|
961
|
-
artifactsManifest: remoteArtifactsManifestPath,
|
|
962
|
-
entrypoints,
|
|
963
|
-
computeProvider,
|
|
964
|
-
setupTodoPath: attemptSetupTodoPath,
|
|
965
|
-
});
|
|
966
|
-
const remoteCodexCommand = prompt === null
|
|
967
|
-
? null
|
|
968
|
-
: buildRemoteCodexCommand({
|
|
969
|
-
prompt,
|
|
970
|
-
lastMessagePath: attemptLastMessagePath,
|
|
971
|
-
setupTodoPath: attemptSetupTodoPath,
|
|
972
|
-
resumeThreadId: activeThreadId,
|
|
973
|
-
clearArtifacts: !reusingSessionArtifacts,
|
|
974
|
-
});
|
|
975
|
-
status.stage("Apply setup plan");
|
|
976
|
-
const execResult = await runRemoteCodexExec({
|
|
977
|
-
client,
|
|
978
|
-
spriteAlias,
|
|
979
|
-
...(activeExecSessionId ? { execSessionId: activeExecSessionId } : {}),
|
|
980
|
-
cmd: remoteCodexCommand === null
|
|
981
|
-
? []
|
|
982
|
-
: [
|
|
983
|
-
"/bin/bash",
|
|
984
|
-
"--noprofile",
|
|
985
|
-
"--norc",
|
|
986
|
-
"-e",
|
|
987
|
-
"-u",
|
|
988
|
-
"-o",
|
|
989
|
-
"pipefail",
|
|
990
|
-
"-c",
|
|
991
|
-
remoteCodexCommand,
|
|
992
|
-
],
|
|
993
|
-
onProgress: (update) => {
|
|
994
|
-
status.stage(`Apply setup plan - ${update.message}`);
|
|
995
|
-
},
|
|
996
|
-
onStateChange: async (state) => {
|
|
997
|
-
activeThreadId = state.threadId ?? activeThreadId;
|
|
998
|
-
activeExecSessionId = state.execSessionId ?? activeExecSessionId;
|
|
999
|
-
if (onResumeStateChange &&
|
|
1000
|
-
activeRunRoot &&
|
|
1001
|
-
activeLastMessagePath &&
|
|
1002
|
-
activeSetupTodoPath &&
|
|
1003
|
-
(activeThreadId || activeExecSessionId)) {
|
|
1004
|
-
await onResumeStateChange({
|
|
1005
|
-
threadId: activeThreadId,
|
|
1006
|
-
execSessionId: activeExecSessionId,
|
|
1007
|
-
runRoot: activeRunRoot,
|
|
1008
|
-
lastMessagePath: activeLastMessagePath,
|
|
1009
|
-
setupTodoPath: activeSetupTodoPath,
|
|
1010
|
-
});
|
|
1011
|
-
}
|
|
1012
|
-
},
|
|
1013
|
-
...(remoteExecOptions ?? {}),
|
|
1014
|
-
});
|
|
1015
|
-
activeThreadId = execResult.threadId ?? activeThreadId;
|
|
1016
|
-
activeExecSessionId = execResult.execSessionId ?? activeExecSessionId;
|
|
1017
|
-
if (onResumeStateChange &&
|
|
1018
|
-
activeRunRoot &&
|
|
1019
|
-
activeLastMessagePath &&
|
|
1020
|
-
activeSetupTodoPath &&
|
|
1021
|
-
(activeThreadId || activeExecSessionId)) {
|
|
1022
|
-
await onResumeStateChange({
|
|
1023
|
-
threadId: activeThreadId,
|
|
1024
|
-
execSessionId: activeExecSessionId,
|
|
1025
|
-
runRoot: activeRunRoot,
|
|
1026
|
-
lastMessagePath: activeLastMessagePath,
|
|
1027
|
-
setupTodoPath: activeSetupTodoPath,
|
|
1028
|
-
});
|
|
1029
|
-
}
|
|
1030
|
-
const completionArtifacts = execResult.exitCode === 0 || execResult.exitCode === null
|
|
1031
|
-
? await waitForRemoteCodexCompletionArtifacts({
|
|
1032
|
-
client,
|
|
1033
|
-
spriteAlias,
|
|
1034
|
-
workdir: expandedWorkdir,
|
|
1035
|
-
lastMessagePath: attemptLastMessagePath,
|
|
1036
|
-
setupTodoPath: attemptSetupTodoPath,
|
|
1037
|
-
graceMs: completionArtifactsGraceMs,
|
|
1038
|
-
pollIntervalMs: completionArtifactsPollIntervalMs,
|
|
1039
|
-
})
|
|
1040
|
-
: null;
|
|
1041
|
-
if (completionArtifacts?.completionMessage) {
|
|
1042
|
-
await writeCanonicalSetupTodo({
|
|
1043
|
-
client,
|
|
1044
|
-
spriteAlias,
|
|
1045
|
-
canonicalSetupTodoPath,
|
|
1046
|
-
setupTodoRaw: completionArtifacts.setupTodoRaw,
|
|
1047
|
-
completionMessage: completionArtifacts.completionMessage,
|
|
1048
|
-
});
|
|
1049
|
-
lastMessage = completionArtifacts.completionMessage;
|
|
1050
|
-
break;
|
|
1051
|
-
}
|
|
1052
|
-
const lastMessageReadError = completionArtifacts && completionArtifacts.lastMessage === null
|
|
1053
|
-
? new Error(`Remote Codex output file missing: ${completionArtifacts.lastMessagePath}`)
|
|
1054
|
-
: null;
|
|
1055
|
-
const failure = classifyRemoteCodexSetupFailure({
|
|
1056
|
-
execResult,
|
|
1057
|
-
...(lastMessageReadError ? { lastMessageReadError } : {}),
|
|
1058
|
-
});
|
|
1059
|
-
if (!failure.retryable || attempt >= DEFAULT_CODEX_EXEC_MAX_ATTEMPTS) {
|
|
1060
|
-
throw failure.error;
|
|
1061
|
-
}
|
|
1062
|
-
if (failure.resetResumeState) {
|
|
1063
|
-
activeThreadId = null;
|
|
1064
|
-
activeExecSessionId = null;
|
|
1065
|
-
activeRunRoot = null;
|
|
1066
|
-
activeLastMessagePath = null;
|
|
1067
|
-
activeSetupTodoPath = null;
|
|
1068
|
-
await onResumeStateChange?.(null);
|
|
1069
|
-
}
|
|
1070
|
-
else {
|
|
1071
|
-
activeThreadId = failure.sessionId ?? activeThreadId;
|
|
1072
|
-
if (!activeThreadId && !activeExecSessionId) {
|
|
1073
|
-
activeRunRoot = null;
|
|
1074
|
-
activeLastMessagePath = null;
|
|
1075
|
-
activeSetupTodoPath = null;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
const delayMs = computeCodexExecRetryDelayMs(attempt);
|
|
1079
|
-
status.stage(`Apply setup plan - ${formatCodexRetryProgress({
|
|
1080
|
-
attempt,
|
|
1081
|
-
maxAttempts: DEFAULT_CODEX_EXEC_MAX_ATTEMPTS,
|
|
1082
|
-
delayMs,
|
|
1083
|
-
sessionId: activeThreadId ?? activeExecSessionId,
|
|
1084
|
-
reason: failure.error.message,
|
|
1085
|
-
})}`);
|
|
1086
|
-
await delay(delayMs);
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
finally {
|
|
1090
|
-
if (proxyRoot) {
|
|
1091
|
-
await client
|
|
1092
|
-
.exec(spriteAlias, [
|
|
1093
|
-
"/bin/bash",
|
|
1094
|
-
"--noprofile",
|
|
1095
|
-
"--norc",
|
|
1096
|
-
"-e",
|
|
1097
|
-
"-u",
|
|
1098
|
-
"-o",
|
|
1099
|
-
"pipefail",
|
|
1100
|
-
"-c",
|
|
1101
|
-
`rm -rf ${shellQuote(proxyRoot)}`,
|
|
1102
|
-
])
|
|
1103
|
-
.catch(() => { });
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
if (!lastMessage) {
|
|
1107
|
-
throw new Error("codex exec failed: remote apply exhausted retries.");
|
|
1108
|
-
}
|
|
1109
|
-
if (!emitCodexOutput)
|
|
1110
|
-
return;
|
|
1111
|
-
status.stop();
|
|
1112
|
-
process.stdout.write(`${lastMessage}\n`);
|
|
1113
|
-
};
|
|
1114
|
-
export { createSetupArtifacts, promptForPlanApproval, promptForServicesApproval, readSetupPlan, readSetupEnvSecretsPlan, readSetupExternalPlan, readSetupExtraArtifactsPlan, readServicesPlan, runLocalShellHistoryScan, runLocalServicesScan, runLocalSetupEnvSecretsScan, runLocalSetupExternalScan, runLocalSetupExtraArtifactsScan, setupApprovalPrefaceLines, setupApprovalSectionExplainers, uploadSetupPlan, writeSetupPlan, mergeExternalPlanEntries, mergeSetupScans, writeSetupEnvSecretsSchema, writeSetupExternalSchema, writeSetupExtraArtifactsSchema, writeServicesPlan, writeServicesSchema, runRemoteCodexSetup, ensureRemoteCodexInstalled, isRemoteCodexLoggedIn, openBrowser, runRemoteCodexLogin, renderRemoteApplyPrompt, ensureLocalCodexAuthForByoInit, ensureRemoteCodexLoginForByoSetup, classifyRemoteCodexSetupFailure, resolveRemoteCodexCompletionMessage, waitForRemoteCodexCompletionArtifacts, readRemoteSetupTodoSummary, };
|
|
1115
|
-
//# sourceMappingURL=index.js.map
|