@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,766 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { SpritesApiError, createLogger, } from "@boxes-dev/core";
|
|
3
|
-
import { mergeCodexInitConfig } from "./codex/config.js";
|
|
4
|
-
const DAEMON_SERVICE_NAME = "devbox-sprite-daemon";
|
|
5
|
-
const MODAL_DAEMON_HEALTH_PORT = 8080;
|
|
6
|
-
const SPRITE_DAEMON_SESSION_PORT = 8788;
|
|
7
|
-
const DEFAULT_DAEMON_BASE_URL = process.env.SPRITE_DAEMON_BASE_URL?.trim() || "https://deploy-dev.boxes.dev";
|
|
8
|
-
const DEFAULT_HEARTBEAT_MS = 30_000;
|
|
9
|
-
const MANAGED_DAEMON_NODE_PATH = "/opt/devbox-runtime/node/current/bin/node";
|
|
10
|
-
const BOOTSTRAP_EXEC_TIMEOUT_MS = 90_000;
|
|
11
|
-
const BOOTSTRAP_EXEC_HANDSHAKE_TIMEOUT_MS = 20_000;
|
|
12
|
-
const BASIC_ALIASES_MARKER = "\n# Basic aliases";
|
|
13
|
-
const LEGACY_BASH_TRAP = "trap 'echo -ne \"\\033]0;${BASH_COMMAND}\\007\"' DEBUG";
|
|
14
|
-
const SAFE_BASH_TRAP = 'trap \'printf "\\033]0;%s\\007" "${BASH_COMMAND//[^[:print:]]/}"\' DEBUG';
|
|
15
|
-
const BASH_HISTORY_BLOCK = [
|
|
16
|
-
"# History search with up/down arrows",
|
|
17
|
-
"if [[ $- == *i* ]]; then bind '\"\\e[A\": history-search-backward'; fi",
|
|
18
|
-
"if [[ $- == *i* ]]; then bind '\"\\eOA\": history-search-backward'; fi",
|
|
19
|
-
"if [[ $- == *i* ]]; then bind '\"\\e[B\": history-search-forward'; fi",
|
|
20
|
-
"if [[ $- == *i* ]]; then bind '\"\\eOB\": history-search-forward'; fi",
|
|
21
|
-
].join("\n");
|
|
22
|
-
const ZSH_HISTORY_BLOCK = [
|
|
23
|
-
"# History search with up/down arrows",
|
|
24
|
-
"autoload -Uz history-search-end",
|
|
25
|
-
"zle -N history-beginning-search-backward-end history-search-end",
|
|
26
|
-
"zle -N history-beginning-search-forward-end history-search-end",
|
|
27
|
-
"bindkey '^[[A' history-beginning-search-backward-end # Up arrow",
|
|
28
|
-
"bindkey '^[OA' history-beginning-search-backward-end # Up arrow",
|
|
29
|
-
"bindkey '^[[B' history-beginning-search-forward-end # Down arrow",
|
|
30
|
-
"bindkey '^[OB' history-beginning-search-forward-end # Down arrow",
|
|
31
|
-
].join("\n");
|
|
32
|
-
const HISTORY_BLOCK_PATTERN = /^# History search with up\/down arrows\n[\s\S]*?(?=\n# Basic aliases|(?![\s\S]))/m;
|
|
33
|
-
const BASH_HISTORY_LINE_PATTERN = /^.*history-search-(?:backward|forward).*$\n?/gm;
|
|
34
|
-
const ZSH_HISTORY_LINE_PATTERN = /^.*history-search-end.*$\n?|^.*history-beginning-search-backward-end.*$\n?|^.*history-beginning-search-forward-end.*$\n?/gm;
|
|
35
|
-
const logger = createLogger("devbox-init");
|
|
36
|
-
const truncateTail = (value, maxChars) => {
|
|
37
|
-
if (value.length <= maxChars)
|
|
38
|
-
return value;
|
|
39
|
-
const omitted = value.length - maxChars;
|
|
40
|
-
return `[truncated ${omitted} chars] ${value.slice(-maxChars)}`;
|
|
41
|
-
};
|
|
42
|
-
const shellQuote = (value) => `'${value.replace(/'/g, `'\\''`)}'`;
|
|
43
|
-
const buildDaemonPaths = (homeDir) => {
|
|
44
|
-
const daemonDir = `${homeDir}/.devbox/daemon`;
|
|
45
|
-
return {
|
|
46
|
-
daemonDir,
|
|
47
|
-
daemonTarball: `${daemonDir}/sprite-daemon.tar.gz`,
|
|
48
|
-
daemonBundleDir: `${daemonDir}/bundle`,
|
|
49
|
-
daemonEntry: `${daemonDir}/bundle/sprite-daemon.mjs`,
|
|
50
|
-
daemonWrapper: `${daemonDir}/run-daemon.sh`,
|
|
51
|
-
daemonConfigFile: `${daemonDir}/config.json`,
|
|
52
|
-
daemonLogFile: `${daemonDir}/sprite-daemon.log`,
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
const resolveDaemonAssetTarget = (computeProvider) => computeProvider === "sprites" ? "sprites" : "managed";
|
|
56
|
-
const resolveRemoteHomeDir = async (client, spriteAlias) => {
|
|
57
|
-
const homeResult = await execWithLog(client, spriteAlias, ["set -euo pipefail", 'printf "%s" "$HOME"'].join("\n"), "resolve-remote-home");
|
|
58
|
-
if (homeResult.exitCode !== 0) {
|
|
59
|
-
const details = homeResult.stderr || homeResult.stdout || "";
|
|
60
|
-
throw new Error(details
|
|
61
|
-
? `resolve remote home failed: ${details}`
|
|
62
|
-
: `resolve remote home failed (exit ${homeResult.exitCode})`);
|
|
63
|
-
}
|
|
64
|
-
const resolved = homeResult.stdout.trim();
|
|
65
|
-
if (!resolved.startsWith("/")) {
|
|
66
|
-
throw new Error(`resolve remote home returned invalid path: ${resolved}`);
|
|
67
|
-
}
|
|
68
|
-
return resolved.replace(/\/+$/, "") || resolved;
|
|
69
|
-
};
|
|
70
|
-
const expandHome = (value, homeDir) => {
|
|
71
|
-
if (value.startsWith("~/")) {
|
|
72
|
-
return `${homeDir}/${value.slice(2)}`;
|
|
73
|
-
}
|
|
74
|
-
return value;
|
|
75
|
-
};
|
|
76
|
-
const execWithLog = async (client, spriteAlias, script, stage, options) => {
|
|
77
|
-
const requestId = randomUUID();
|
|
78
|
-
const startedAt = Date.now();
|
|
79
|
-
logger.info("sprites_request", {
|
|
80
|
-
requestId,
|
|
81
|
-
method: "exec",
|
|
82
|
-
path: "/exec",
|
|
83
|
-
box: spriteAlias,
|
|
84
|
-
stage,
|
|
85
|
-
});
|
|
86
|
-
const result = await client.exec(spriteAlias, ["/bin/bash", "-lc", script], options);
|
|
87
|
-
const durationMs = Date.now() - startedAt;
|
|
88
|
-
logger.info("sprites_response", {
|
|
89
|
-
requestId,
|
|
90
|
-
method: "exec",
|
|
91
|
-
path: "/exec",
|
|
92
|
-
status: result.exitCode === 0 ? "ok" : "error",
|
|
93
|
-
exitCode: result.exitCode,
|
|
94
|
-
durationMs,
|
|
95
|
-
...(result.exitCode !== 0
|
|
96
|
-
? {
|
|
97
|
-
stdoutBytes: result.stdout.length,
|
|
98
|
-
stderrBytes: result.stderr.length,
|
|
99
|
-
stdoutPreview: result.stdout
|
|
100
|
-
? truncateTail(result.stdout, 4000)
|
|
101
|
-
: undefined,
|
|
102
|
-
stderrPreview: result.stderr
|
|
103
|
-
? truncateTail(result.stderr, 4000)
|
|
104
|
-
: undefined,
|
|
105
|
-
}
|
|
106
|
-
: {}),
|
|
107
|
-
box: spriteAlias,
|
|
108
|
-
stage,
|
|
109
|
-
});
|
|
110
|
-
return result;
|
|
111
|
-
};
|
|
112
|
-
const writeRemoteFile = async (client, spriteAlias, path, content, stage) => {
|
|
113
|
-
const requestId = randomUUID();
|
|
114
|
-
logger.info("sprites_request", {
|
|
115
|
-
requestId,
|
|
116
|
-
method: "writeFile",
|
|
117
|
-
path,
|
|
118
|
-
box: spriteAlias,
|
|
119
|
-
stage,
|
|
120
|
-
});
|
|
121
|
-
const buffer = typeof content === "string" ? Buffer.from(content, "utf8") : content;
|
|
122
|
-
await client.writeFile(spriteAlias, path, buffer);
|
|
123
|
-
logger.info("sprites_response", {
|
|
124
|
-
requestId,
|
|
125
|
-
method: "writeFile",
|
|
126
|
-
path,
|
|
127
|
-
status: "ok",
|
|
128
|
-
box: spriteAlias,
|
|
129
|
-
stage,
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
const readRemoteFile = async (client, spriteAlias, path, stage) => {
|
|
133
|
-
const requestId = randomUUID();
|
|
134
|
-
logger.info("sprites_request", {
|
|
135
|
-
requestId,
|
|
136
|
-
method: "readFile",
|
|
137
|
-
path,
|
|
138
|
-
box: spriteAlias,
|
|
139
|
-
stage,
|
|
140
|
-
});
|
|
141
|
-
try {
|
|
142
|
-
const bytes = await client.readFile(spriteAlias, { path });
|
|
143
|
-
logger.info("sprites_response", {
|
|
144
|
-
requestId,
|
|
145
|
-
method: "readFile",
|
|
146
|
-
path,
|
|
147
|
-
status: "ok",
|
|
148
|
-
bytes: bytes.byteLength,
|
|
149
|
-
box: spriteAlias,
|
|
150
|
-
stage,
|
|
151
|
-
});
|
|
152
|
-
return Buffer.from(bytes).toString("utf8");
|
|
153
|
-
}
|
|
154
|
-
catch (error) {
|
|
155
|
-
const notFound = error instanceof SpritesApiError && error.status === 404;
|
|
156
|
-
logger.info("sprites_response", {
|
|
157
|
-
requestId,
|
|
158
|
-
method: "readFile",
|
|
159
|
-
path,
|
|
160
|
-
status: notFound ? "not_found" : "error",
|
|
161
|
-
box: spriteAlias,
|
|
162
|
-
stage,
|
|
163
|
-
});
|
|
164
|
-
if (notFound)
|
|
165
|
-
return null;
|
|
166
|
-
throw error;
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
const ensureTrailingNewline = (value) => value.endsWith("\n") ? value : `${value}\n`;
|
|
170
|
-
const upsertHistoryBlock = ({ data, canonicalBlock, historyLinePattern, }) => {
|
|
171
|
-
if (HISTORY_BLOCK_PATTERN.test(data)) {
|
|
172
|
-
return data.replace(HISTORY_BLOCK_PATTERN, () => canonicalBlock);
|
|
173
|
-
}
|
|
174
|
-
const withoutLegacyLines = data.replace(historyLinePattern, "");
|
|
175
|
-
if (withoutLegacyLines.includes(BASIC_ALIASES_MARKER)) {
|
|
176
|
-
return withoutLegacyLines.replace(BASIC_ALIASES_MARKER, `\n${canonicalBlock}\n${BASIC_ALIASES_MARKER}`);
|
|
177
|
-
}
|
|
178
|
-
return `${withoutLegacyLines.replace(/\n+$/, "")}\n\n${canonicalBlock}\n`;
|
|
179
|
-
};
|
|
180
|
-
const patchBashrcContent = (data) => {
|
|
181
|
-
let next = data;
|
|
182
|
-
if (next.includes(LEGACY_BASH_TRAP)) {
|
|
183
|
-
next = next.replace(LEGACY_BASH_TRAP, SAFE_BASH_TRAP);
|
|
184
|
-
}
|
|
185
|
-
next = upsertHistoryBlock({
|
|
186
|
-
data: next,
|
|
187
|
-
canonicalBlock: BASH_HISTORY_BLOCK,
|
|
188
|
-
historyLinePattern: BASH_HISTORY_LINE_PATTERN,
|
|
189
|
-
});
|
|
190
|
-
return ensureTrailingNewline(next);
|
|
191
|
-
};
|
|
192
|
-
const patchZshrcContent = (data) => ensureTrailingNewline(upsertHistoryBlock({
|
|
193
|
-
data,
|
|
194
|
-
canonicalBlock: ZSH_HISTORY_BLOCK,
|
|
195
|
-
historyLinePattern: ZSH_HISTORY_LINE_PATTERN,
|
|
196
|
-
}));
|
|
197
|
-
const bootstrapDevbox = async (client, spriteAlias, { onPhase } = {}) => {
|
|
198
|
-
const totalPhases = 4;
|
|
199
|
-
const reportPhase = (completedPhases, detail) => {
|
|
200
|
-
onPhase?.(completedPhases, totalPhases, detail);
|
|
201
|
-
};
|
|
202
|
-
const remoteHome = await resolveRemoteHomeDir(client, spriteAlias);
|
|
203
|
-
reportPhase(0, "fix ownership/permissions");
|
|
204
|
-
const permissionsScript = [
|
|
205
|
-
"set -euo pipefail",
|
|
206
|
-
`home=${shellQuote(remoteHome)}`,
|
|
207
|
-
'if [ ! -d "$home" ]; then',
|
|
208
|
-
' echo "missing home directory: $home" >&2',
|
|
209
|
-
" exit 1",
|
|
210
|
-
"fi",
|
|
211
|
-
'mkdir -p "$home/.devbox"',
|
|
212
|
-
'chmod 755 "$home" || true',
|
|
213
|
-
'chmod 755 "$home/.devbox" || true',
|
|
214
|
-
].join("\n");
|
|
215
|
-
const permsResult = await execWithLog(client, spriteAlias, permissionsScript, "bootstrap-permissions", {
|
|
216
|
-
timeoutMs: BOOTSTRAP_EXEC_TIMEOUT_MS,
|
|
217
|
-
handshakeTimeoutMs: BOOTSTRAP_EXEC_HANDSHAKE_TIMEOUT_MS,
|
|
218
|
-
});
|
|
219
|
-
if (permsResult.exitCode !== 0) {
|
|
220
|
-
const details = permsResult.stderr || permsResult.stdout || "";
|
|
221
|
-
throw new Error(details
|
|
222
|
-
? `devbox bootstrap failed: ${details}`
|
|
223
|
-
: `devbox bootstrap failed (exit ${permsResult.exitCode})`);
|
|
224
|
-
}
|
|
225
|
-
reportPhase(1, "prefer IPv4 localhost");
|
|
226
|
-
const ipv4PreferenceScript = [
|
|
227
|
-
"set -euo pipefail",
|
|
228
|
-
'if [ "$(id -u)" -eq 0 ]; then',
|
|
229
|
-
' if ! grep -q "ipv4first" /etc/gai.conf 2>/dev/null; then',
|
|
230
|
-
" cat <<'EOF' >> /etc/gai.conf",
|
|
231
|
-
"# devbox: prefer IPv4 for localhost",
|
|
232
|
-
"precedence ::ffff:0:0/96 100",
|
|
233
|
-
"EOF",
|
|
234
|
-
" fi",
|
|
235
|
-
"else",
|
|
236
|
-
' if ! sudo -n grep -q "ipv4first" /etc/gai.conf 2>/dev/null; then',
|
|
237
|
-
" cat <<'EOF' | sudo -n tee -a /etc/gai.conf >/dev/null",
|
|
238
|
-
"# devbox: prefer IPv4 for localhost",
|
|
239
|
-
"precedence ::ffff:0:0/96 100",
|
|
240
|
-
"EOF",
|
|
241
|
-
" fi",
|
|
242
|
-
"fi",
|
|
243
|
-
].join("\n");
|
|
244
|
-
const ipv4Result = await execWithLog(client, spriteAlias, ipv4PreferenceScript, "bootstrap-ipv4-preference", {
|
|
245
|
-
timeoutMs: BOOTSTRAP_EXEC_TIMEOUT_MS,
|
|
246
|
-
handshakeTimeoutMs: BOOTSTRAP_EXEC_HANDSHAKE_TIMEOUT_MS,
|
|
247
|
-
});
|
|
248
|
-
if (ipv4Result.exitCode !== 0) {
|
|
249
|
-
const details = ipv4Result.stderr || ipv4Result.stdout || "";
|
|
250
|
-
throw new Error(details
|
|
251
|
-
? `devbox bootstrap failed: ${details}`
|
|
252
|
-
: `devbox bootstrap failed (exit ${ipv4Result.exitCode})`);
|
|
253
|
-
}
|
|
254
|
-
reportPhase(2, "patching .bashrc");
|
|
255
|
-
await patchBashrc(client, spriteAlias, remoteHome);
|
|
256
|
-
reportPhase(3, "patching .zshrc");
|
|
257
|
-
await patchZshrc(client, spriteAlias, remoteHome);
|
|
258
|
-
reportPhase(4, "completed");
|
|
259
|
-
};
|
|
260
|
-
const patchRemoteRcFile = async (client, spriteAlias, options) => {
|
|
261
|
-
const existing = await readRemoteFile(client, spriteAlias, options.path, `${options.errorLabel}-read`);
|
|
262
|
-
if (existing === null) {
|
|
263
|
-
logger.warn("init_rc_patch_skipped_missing_file", {
|
|
264
|
-
box: spriteAlias,
|
|
265
|
-
path: options.path,
|
|
266
|
-
rcFile: options.errorLabel,
|
|
267
|
-
});
|
|
268
|
-
return;
|
|
269
|
-
}
|
|
270
|
-
const next = options.transform(existing);
|
|
271
|
-
if (next === existing) {
|
|
272
|
-
return;
|
|
273
|
-
}
|
|
274
|
-
await writeRemoteFile(client, spriteAlias, options.path, next, `${options.errorLabel}-write`);
|
|
275
|
-
const modeResult = await execWithLog(client, spriteAlias, ["set -euo pipefail", `chmod 644 ${shellQuote(options.path)}`].join("\n"), `${options.errorLabel}-chmod`);
|
|
276
|
-
if (modeResult.exitCode !== 0) {
|
|
277
|
-
const details = modeResult.stderr || modeResult.stdout || "";
|
|
278
|
-
throw new Error(details
|
|
279
|
-
? `${options.errorLabel} patch failed: ${details}`
|
|
280
|
-
: `${options.errorLabel} patch failed (exit ${modeResult.exitCode})`);
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
const patchBashrc = async (client, spriteAlias, homeDir) => await patchRemoteRcFile(client, spriteAlias, {
|
|
284
|
-
path: `${homeDir}/.bashrc`,
|
|
285
|
-
errorLabel: "bashrc",
|
|
286
|
-
transform: patchBashrcContent,
|
|
287
|
-
});
|
|
288
|
-
const patchZshrc = async (client, spriteAlias, homeDir) => await patchRemoteRcFile(client, spriteAlias, {
|
|
289
|
-
path: `${homeDir}/.zshrc`,
|
|
290
|
-
errorLabel: "zshrc",
|
|
291
|
-
transform: patchZshrcContent,
|
|
292
|
-
});
|
|
293
|
-
const ensureRemoteCodexConfig = async ({ client, spriteAlias, trustedPaths, }) => {
|
|
294
|
-
const remoteHome = await resolveRemoteHomeDir(client, spriteAlias);
|
|
295
|
-
const codexConfigDir = `${remoteHome}/.codex`;
|
|
296
|
-
const codexConfigPath = `${codexConfigDir}/config.toml`;
|
|
297
|
-
const mkdirResult = await execWithLog(client, spriteAlias, [
|
|
298
|
-
"set -euo pipefail",
|
|
299
|
-
`mkdir -p ${shellQuote(codexConfigDir)}`,
|
|
300
|
-
`chmod 700 ${shellQuote(codexConfigDir)}`,
|
|
301
|
-
].join("\n"), "codex-config-mkdir");
|
|
302
|
-
if (mkdirResult.exitCode !== 0) {
|
|
303
|
-
const details = mkdirResult.stderr || mkdirResult.stdout || "";
|
|
304
|
-
throw new Error(details
|
|
305
|
-
? `codex config mkdir failed: ${details}`
|
|
306
|
-
: `codex config mkdir failed (exit ${mkdirResult.exitCode})`);
|
|
307
|
-
}
|
|
308
|
-
const existing = await readRemoteFile(client, spriteAlias, codexConfigPath, "codex-config-read");
|
|
309
|
-
const next = mergeCodexInitConfig({
|
|
310
|
-
existingContent: existing,
|
|
311
|
-
trustedPaths,
|
|
312
|
-
});
|
|
313
|
-
await writeRemoteFile(client, spriteAlias, codexConfigPath, next, "codex-config-write");
|
|
314
|
-
const chmodResult = await execWithLog(client, spriteAlias, ["set -euo pipefail", `chmod 600 ${shellQuote(codexConfigPath)}`].join("\n"), "codex-config-chmod");
|
|
315
|
-
if (chmodResult.exitCode !== 0) {
|
|
316
|
-
const details = chmodResult.stderr || chmodResult.stdout || "";
|
|
317
|
-
throw new Error(details
|
|
318
|
-
? `codex config chmod failed: ${details}`
|
|
319
|
-
: `codex config chmod failed (exit ${chmodResult.exitCode})`);
|
|
320
|
-
}
|
|
321
|
-
};
|
|
322
|
-
const stageRemoteSetupArtifacts = async ({ client, spriteAlias, computeProvider, workdir, artifactsBundlePath, artifactsManifestPath, }) => {
|
|
323
|
-
const remoteHome = await resolveRemoteHomeDir(client, spriteAlias);
|
|
324
|
-
const { daemonBundleDir } = buildDaemonPaths(remoteHome);
|
|
325
|
-
const daemonNodePath = computeProvider === "sprites"
|
|
326
|
-
? `${daemonBundleDir}/bin/node`
|
|
327
|
-
: MANAGED_DAEMON_NODE_PATH;
|
|
328
|
-
const stagedExternalDir = `${workdir.replace(/\/$/, "")}/.devbox/staged-external`;
|
|
329
|
-
const stagedIndexPath = `${stagedExternalDir}/index.json`;
|
|
330
|
-
const script = [
|
|
331
|
-
"set -euo pipefail",
|
|
332
|
-
"",
|
|
333
|
-
`workdir=${shellQuote(workdir)}`,
|
|
334
|
-
`bundle=${shellQuote(artifactsBundlePath)}`,
|
|
335
|
-
`manifest=${shellQuote(artifactsManifestPath)}`,
|
|
336
|
-
`staged_external=${shellQuote(stagedExternalDir)}`,
|
|
337
|
-
`staged_index=${shellQuote(stagedIndexPath)}`,
|
|
338
|
-
`daemon_node=${shellQuote(daemonNodePath)}`,
|
|
339
|
-
"",
|
|
340
|
-
'mkdir -p "$workdir/.devbox"',
|
|
341
|
-
'mkdir -p "$staged_external"',
|
|
342
|
-
"",
|
|
343
|
-
'if [ ! -x "$daemon_node" ]; then',
|
|
344
|
-
' echo "daemon node missing at $daemon_node" >&2',
|
|
345
|
-
" exit 1",
|
|
346
|
-
"fi",
|
|
347
|
-
'node_cmd="$daemon_node"',
|
|
348
|
-
"",
|
|
349
|
-
'tmp="$(mktemp -d)"',
|
|
350
|
-
'cleanup() { rm -rf "$tmp"; }',
|
|
351
|
-
"trap cleanup EXIT",
|
|
352
|
-
"",
|
|
353
|
-
"have_bundle=0",
|
|
354
|
-
"have_manifest=0",
|
|
355
|
-
'if [ -s "$bundle" ]; then have_bundle=1; fi',
|
|
356
|
-
'if [ -s "$manifest" ]; then have_manifest=1; fi',
|
|
357
|
-
"",
|
|
358
|
-
'if [ "$have_bundle" -eq 1 ]; then',
|
|
359
|
-
' mkdir -p "$tmp/extracted"',
|
|
360
|
-
' tar -xzf "$bundle" -C "$tmp/extracted"',
|
|
361
|
-
"",
|
|
362
|
-
' if [ -d "$tmp/extracted/repo" ]; then',
|
|
363
|
-
' backup_root="$workdir/.devbox/backups/setup-artifacts-$(date -u +%Y%m%dT%H%M%SZ)"',
|
|
364
|
-
' mkdir -p "$backup_root/repo"',
|
|
365
|
-
" if command -v rsync >/dev/null 2>&1; then",
|
|
366
|
-
' rsync -a --backup --backup-dir="$backup_root/repo" "$tmp/extracted/repo/" "$workdir/"',
|
|
367
|
-
" else",
|
|
368
|
-
' echo "Warning: rsync missing; copying repo artifacts without backup" >&2',
|
|
369
|
-
' cp -a "$tmp/extracted/repo/." "$workdir/"',
|
|
370
|
-
" fi",
|
|
371
|
-
" fi",
|
|
372
|
-
"",
|
|
373
|
-
' if [ -d "$tmp/extracted/external" ]; then',
|
|
374
|
-
" # External artifacts are staged for Codex to place appropriately on Linux.",
|
|
375
|
-
" if command -v rsync >/dev/null 2>&1; then",
|
|
376
|
-
' rsync -a --delete "$tmp/extracted/external/" "$staged_external/"',
|
|
377
|
-
" else",
|
|
378
|
-
' rm -rf "$staged_external"',
|
|
379
|
-
' mkdir -p "$staged_external"',
|
|
380
|
-
' cp -a "$tmp/extracted/external/." "$staged_external/"',
|
|
381
|
-
" fi",
|
|
382
|
-
" fi",
|
|
383
|
-
"fi",
|
|
384
|
-
"",
|
|
385
|
-
'if [ "$have_manifest" -eq 1 ] && [ -n "$node_cmd" ]; then',
|
|
386
|
-
' MANIFEST_PATH="$manifest" STAGED_INDEX_PATH="$staged_index" "$node_cmd" - <<\'NODE\'',
|
|
387
|
-
"const fs = require('fs');",
|
|
388
|
-
"const path = require('path');",
|
|
389
|
-
"",
|
|
390
|
-
"const manifestPath = process.env.MANIFEST_PATH;",
|
|
391
|
-
"const outPath = process.env.STAGED_INDEX_PATH;",
|
|
392
|
-
"",
|
|
393
|
-
"let manifest;",
|
|
394
|
-
"try {",
|
|
395
|
-
" manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf8'));",
|
|
396
|
-
"} catch {",
|
|
397
|
-
" manifest = null;",
|
|
398
|
-
"}",
|
|
399
|
-
"",
|
|
400
|
-
"const entries = Array.isArray(manifest?.entries) ? manifest.entries : [];",
|
|
401
|
-
"const external = [];",
|
|
402
|
-
"for (const entry of entries) {",
|
|
403
|
-
" if (!entry || typeof entry !== 'object') continue;",
|
|
404
|
-
" const bundlePath = entry.bundlePath;",
|
|
405
|
-
" if (typeof bundlePath !== 'string') continue;",
|
|
406
|
-
" if (!bundlePath.startsWith('external/')) continue;",
|
|
407
|
-
" const rel = bundlePath.slice('external/'.length).replace(/\\\\/g, '/');",
|
|
408
|
-
" const stagedPath = path.posix.join('.devbox', 'staged-external', rel);",
|
|
409
|
-
" external.push({",
|
|
410
|
-
" kind: typeof entry.kind === 'string' ? entry.kind : null,",
|
|
411
|
-
" name: typeof entry.name === 'string' ? entry.name : null,",
|
|
412
|
-
" sourcePath: typeof entry.sourcePath === 'string' ? entry.sourcePath : null,",
|
|
413
|
-
" stagedPath,",
|
|
414
|
-
" description: typeof entry.description === 'string' ? entry.description : null,",
|
|
415
|
-
" vars: Array.isArray(entry.vars) ? entry.vars.filter((v) => typeof v === 'string') : null,",
|
|
416
|
-
" usage: typeof entry.usage === 'string' ? entry.usage : null,",
|
|
417
|
-
" });",
|
|
418
|
-
"}",
|
|
419
|
-
"",
|
|
420
|
-
"const payload = {",
|
|
421
|
-
" createdAt: new Date().toISOString(),",
|
|
422
|
-
" entries: external,",
|
|
423
|
-
"};",
|
|
424
|
-
"",
|
|
425
|
-
"fs.mkdirSync(path.dirname(outPath), { recursive: true });",
|
|
426
|
-
"fs.writeFileSync(outPath, JSON.stringify(payload, null, 2), 'utf8');",
|
|
427
|
-
"NODE",
|
|
428
|
-
"else",
|
|
429
|
-
" # Manifest missing: still write an empty index so Codex can rely on it existing.",
|
|
430
|
-
' created_at="$(date -u +%Y-%m-%dT%H:%M:%SZ)"',
|
|
431
|
-
' printf \'{"createdAt":"%s","entries":[]}\\n\' "$created_at" > "$staged_index"',
|
|
432
|
-
"fi",
|
|
433
|
-
"",
|
|
434
|
-
'chmod -R u+rwX,go-rwx "$workdir/.devbox" || true',
|
|
435
|
-
].join("\n");
|
|
436
|
-
const result = await execWithLog(client, spriteAlias, script, "stage-setup-artifacts");
|
|
437
|
-
if (result.exitCode !== 0) {
|
|
438
|
-
const details = result.stderr || result.stdout || "";
|
|
439
|
-
throw new Error(details
|
|
440
|
-
? `staging setup artifacts failed: ${details}`
|
|
441
|
-
: `staging setup artifacts failed (exit ${result.exitCode})`);
|
|
442
|
-
}
|
|
443
|
-
};
|
|
444
|
-
const resolveDaemonUrl = (release, computeProvider) => release.url?.trim() ||
|
|
445
|
-
`${DEFAULT_DAEMON_BASE_URL}/sprite-daemon-${resolveDaemonAssetTarget(computeProvider)}-${release.sha256}.tar.gz`;
|
|
446
|
-
const fetchDaemonBinary = async (release, computeProvider, onProgress) => {
|
|
447
|
-
const url = resolveDaemonUrl(release, computeProvider);
|
|
448
|
-
const response = await fetch(url);
|
|
449
|
-
if (!response.ok) {
|
|
450
|
-
throw new Error(`Failed to download the remote daemon package (${response.status} ${response.statusText}).`);
|
|
451
|
-
}
|
|
452
|
-
const expectedSize = Number.isFinite(release.size) && release.size > 0 ? release.size : null;
|
|
453
|
-
const contentLengthHeader = response.headers.get("content-length");
|
|
454
|
-
const parsedContentLength = contentLengthHeader
|
|
455
|
-
? Number.parseInt(contentLengthHeader, 10)
|
|
456
|
-
: Number.NaN;
|
|
457
|
-
const responseContentLength = Number.isFinite(parsedContentLength) && parsedContentLength > 0
|
|
458
|
-
? parsedContentLength
|
|
459
|
-
: null;
|
|
460
|
-
const totalBytes = expectedSize ?? responseContentLength;
|
|
461
|
-
if (!response.body) {
|
|
462
|
-
const buffer = new Uint8Array(await response.arrayBuffer());
|
|
463
|
-
if (onProgress) {
|
|
464
|
-
const fallbackTotal = Math.max(totalBytes ?? 0, buffer.byteLength);
|
|
465
|
-
onProgress(0, fallbackTotal);
|
|
466
|
-
onProgress(buffer.byteLength, fallbackTotal);
|
|
467
|
-
}
|
|
468
|
-
return { buffer, url };
|
|
469
|
-
}
|
|
470
|
-
const reader = response.body.getReader();
|
|
471
|
-
const chunks = [];
|
|
472
|
-
let receivedBytes = 0;
|
|
473
|
-
if (onProgress) {
|
|
474
|
-
onProgress(0, totalBytes ?? 1);
|
|
475
|
-
}
|
|
476
|
-
while (true) {
|
|
477
|
-
const { done, value } = await reader.read();
|
|
478
|
-
if (done)
|
|
479
|
-
break;
|
|
480
|
-
if (!value || value.byteLength === 0)
|
|
481
|
-
continue;
|
|
482
|
-
chunks.push(value);
|
|
483
|
-
receivedBytes += value.byteLength;
|
|
484
|
-
if (onProgress) {
|
|
485
|
-
const progressTotal = totalBytes === null
|
|
486
|
-
? Math.max(receivedBytes, 1)
|
|
487
|
-
: Math.max(totalBytes, receivedBytes);
|
|
488
|
-
onProgress(receivedBytes, progressTotal);
|
|
489
|
-
}
|
|
490
|
-
}
|
|
491
|
-
const buffer = new Uint8Array(receivedBytes);
|
|
492
|
-
let offset = 0;
|
|
493
|
-
for (const chunk of chunks) {
|
|
494
|
-
buffer.set(chunk, offset);
|
|
495
|
-
offset += chunk.byteLength;
|
|
496
|
-
}
|
|
497
|
-
if (onProgress) {
|
|
498
|
-
const progressTotal = totalBytes === null
|
|
499
|
-
? Math.max(receivedBytes, 1)
|
|
500
|
-
: Math.max(totalBytes, receivedBytes);
|
|
501
|
-
onProgress(receivedBytes, progressTotal);
|
|
502
|
-
}
|
|
503
|
-
return { buffer, url };
|
|
504
|
-
};
|
|
505
|
-
const fetchDaemonBinaryOnRemote = async ({ client, spriteAlias, release, computeProvider, remoteTarballPath, onProgress, }) => {
|
|
506
|
-
const url = resolveDaemonUrl(release, computeProvider);
|
|
507
|
-
const totalBytes = Number.isFinite(release.size) && release.size > 0 ? release.size : 1;
|
|
508
|
-
onProgress?.(0, totalBytes);
|
|
509
|
-
const script = [
|
|
510
|
-
"set -euo pipefail",
|
|
511
|
-
`url=${shellQuote(url)}`,
|
|
512
|
-
`tarball=${shellQuote(remoteTarballPath)}`,
|
|
513
|
-
`expected_sha=${shellQuote(release.sha256)}`,
|
|
514
|
-
'mkdir -p "$(dirname "$tarball")"',
|
|
515
|
-
"if ! command -v curl >/dev/null 2>&1; then",
|
|
516
|
-
' echo "curl is required to fetch the remote daemon package." >&2',
|
|
517
|
-
" exit 127",
|
|
518
|
-
"fi",
|
|
519
|
-
"if ! command -v sha256sum >/dev/null 2>&1; then",
|
|
520
|
-
' echo "sha256sum is required to verify the remote daemon package." >&2',
|
|
521
|
-
" exit 127",
|
|
522
|
-
"fi",
|
|
523
|
-
'tmp_tarball="${tarball}.tmp.$$"',
|
|
524
|
-
'cleanup() { rm -f "$tmp_tarball"; }',
|
|
525
|
-
"trap cleanup EXIT",
|
|
526
|
-
'curl --fail --location --silent --show-error "$url" --output "$tmp_tarball"',
|
|
527
|
-
'actual_sha="$(sha256sum "$tmp_tarball" | awk \'{print $1}\')"',
|
|
528
|
-
'if [ "$actual_sha" != "$expected_sha" ]; then',
|
|
529
|
-
' echo "remote daemon package checksum mismatch" >&2',
|
|
530
|
-
" exit 1",
|
|
531
|
-
"fi",
|
|
532
|
-
'mv "$tmp_tarball" "$tarball"',
|
|
533
|
-
"trap - EXIT",
|
|
534
|
-
'chmod 600 "$tarball" || true',
|
|
535
|
-
].join("\n");
|
|
536
|
-
const result = await execWithLog(client, spriteAlias, script, "fetch-remote-daemon-package", {
|
|
537
|
-
timeoutMs: 120_000,
|
|
538
|
-
handshakeTimeoutMs: BOOTSTRAP_EXEC_HANDSHAKE_TIMEOUT_MS,
|
|
539
|
-
});
|
|
540
|
-
if (result.exitCode !== 0) {
|
|
541
|
-
throw new Error(result.stderr ||
|
|
542
|
-
result.stdout ||
|
|
543
|
-
"Failed to fetch the remote daemon package.");
|
|
544
|
-
}
|
|
545
|
-
onProgress?.(totalBytes, totalBytes);
|
|
546
|
-
};
|
|
547
|
-
const buildDaemonConfig = (convexUrl, heartbeatToken, computeProvider) => new TextEncoder().encode(JSON.stringify({
|
|
548
|
-
convexUrl,
|
|
549
|
-
heartbeatToken,
|
|
550
|
-
heartbeatMs: DEFAULT_HEARTBEAT_MS,
|
|
551
|
-
computeProvider,
|
|
552
|
-
}, null, 2));
|
|
553
|
-
const isSameArgs = (left, right) => {
|
|
554
|
-
if (!left)
|
|
555
|
-
return right.length === 0;
|
|
556
|
-
if (left.length !== right.length)
|
|
557
|
-
return false;
|
|
558
|
-
return left.every((value, index) => value === right[index]);
|
|
559
|
-
};
|
|
560
|
-
const ensureSpriteDaemonService = async ({ client, spriteName, computeProvider, }) => {
|
|
561
|
-
const remoteHome = await resolveRemoteHomeDir(client, spriteName);
|
|
562
|
-
const paths = buildDaemonPaths(remoteHome);
|
|
563
|
-
if (computeProvider === "modal") {
|
|
564
|
-
const script = [
|
|
565
|
-
"set -euo pipefail",
|
|
566
|
-
`wrapper=${shellQuote(paths.daemonWrapper)}`,
|
|
567
|
-
`health_port=${String(MODAL_DAEMON_HEALTH_PORT)}`,
|
|
568
|
-
'if [ ! -x "$wrapper" ]; then',
|
|
569
|
-
' echo "missing remote daemon launcher" >&2',
|
|
570
|
-
" exit 1",
|
|
571
|
-
"fi",
|
|
572
|
-
"ready=0",
|
|
573
|
-
"for _ in $(seq 1 120); do",
|
|
574
|
-
' if (echo >"/dev/tcp/127.0.0.1/${health_port}") >/dev/null 2>&1; then',
|
|
575
|
-
" ready=1",
|
|
576
|
-
" break",
|
|
577
|
-
" fi",
|
|
578
|
-
" sleep 0.25",
|
|
579
|
-
"done",
|
|
580
|
-
'if [ "$ready" -ne 1 ]; then',
|
|
581
|
-
' echo "remote daemon health port not ready" >&2',
|
|
582
|
-
" exit 1",
|
|
583
|
-
"fi",
|
|
584
|
-
"echo ok",
|
|
585
|
-
].join("\n");
|
|
586
|
-
const result = await execWithLog(client, spriteName, script, "ensure-sprite-daemon");
|
|
587
|
-
if (result.exitCode !== 0) {
|
|
588
|
-
throw new Error(result.stderr || result.stdout || "Remote daemon health check failed.");
|
|
589
|
-
}
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
if (computeProvider === "e2b") {
|
|
593
|
-
const script = [
|
|
594
|
-
"set -euo pipefail",
|
|
595
|
-
`wrapper=${shellQuote(paths.daemonWrapper)}`,
|
|
596
|
-
`control_port=${String(MODAL_DAEMON_HEALTH_PORT)}`,
|
|
597
|
-
`session_port=${String(SPRITE_DAEMON_SESSION_PORT)}`,
|
|
598
|
-
'if [ ! -x "$wrapper" ]; then',
|
|
599
|
-
' echo "missing remote daemon launcher" >&2',
|
|
600
|
-
" exit 1",
|
|
601
|
-
"fi",
|
|
602
|
-
"control_ready=0",
|
|
603
|
-
"for _ in $(seq 1 120); do",
|
|
604
|
-
' if (echo >"/dev/tcp/127.0.0.1/${control_port}") >/dev/null 2>&1; then',
|
|
605
|
-
" control_ready=1",
|
|
606
|
-
" break",
|
|
607
|
-
" fi",
|
|
608
|
-
" sleep 0.25",
|
|
609
|
-
"done",
|
|
610
|
-
'if [ "$control_ready" -ne 1 ]; then',
|
|
611
|
-
' echo "remote daemon control port not ready" >&2',
|
|
612
|
-
" exit 1",
|
|
613
|
-
"fi",
|
|
614
|
-
"session_ready=0",
|
|
615
|
-
"for _ in $(seq 1 40); do",
|
|
616
|
-
' if (echo >"/dev/tcp/127.0.0.1/${session_port}") >/dev/null 2>&1; then',
|
|
617
|
-
" session_ready=1",
|
|
618
|
-
" break",
|
|
619
|
-
" fi",
|
|
620
|
-
" sleep 0.25",
|
|
621
|
-
"done",
|
|
622
|
-
'if [ "$session_ready" -ne 1 ]; then',
|
|
623
|
-
' echo "remote daemon session port not ready" >&2',
|
|
624
|
-
" exit 1",
|
|
625
|
-
"fi",
|
|
626
|
-
'echo "ok"',
|
|
627
|
-
].join("\n");
|
|
628
|
-
const result = await execWithLog(client, spriteName, script, "ensure-sprite-daemon");
|
|
629
|
-
if (result.exitCode !== 0) {
|
|
630
|
-
throw new Error(result.stderr || result.stdout || "Remote daemon health check failed.");
|
|
631
|
-
}
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
const expectedCmd = paths.daemonWrapper;
|
|
635
|
-
const expectedArgs = [];
|
|
636
|
-
const existing = await client.getService(spriteName, DAEMON_SERVICE_NAME);
|
|
637
|
-
const needsCreate = !existing ||
|
|
638
|
-
existing.cmd !== expectedCmd ||
|
|
639
|
-
!isSameArgs(existing.args, expectedArgs);
|
|
640
|
-
if (needsCreate) {
|
|
641
|
-
await client.createService(spriteName, DAEMON_SERVICE_NAME, {
|
|
642
|
-
cmd: expectedCmd,
|
|
643
|
-
args: expectedArgs,
|
|
644
|
-
});
|
|
645
|
-
}
|
|
646
|
-
const current = needsCreate
|
|
647
|
-
? await client.getService(spriteName, DAEMON_SERVICE_NAME)
|
|
648
|
-
: existing;
|
|
649
|
-
const status = current?.state?.status ?? null;
|
|
650
|
-
if (status !== "running") {
|
|
651
|
-
await client.startService(spriteName, DAEMON_SERVICE_NAME, {
|
|
652
|
-
duration: "0",
|
|
653
|
-
});
|
|
654
|
-
}
|
|
655
|
-
const refreshed = await client.getService(spriteName, DAEMON_SERVICE_NAME);
|
|
656
|
-
if (refreshed?.state?.status !== "running") {
|
|
657
|
-
throw new Error("Remote daemon service failed to start.");
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
const installSpriteDaemon = async ({ client, bootstrapClient, spriteName, release, convexUrl, heartbeatToken, computeProvider, onDownloadProgress, onUploadProgress, onPhase, }) => {
|
|
661
|
-
const usesRemotePackageFetch = computeProvider === "e2b";
|
|
662
|
-
const totalPhases = usesRemotePackageFetch ? 4 : 5;
|
|
663
|
-
const reportPhase = (completedPhases, detail) => {
|
|
664
|
-
onPhase?.(completedPhases, totalPhases, detail);
|
|
665
|
-
};
|
|
666
|
-
const installClient = computeProvider === "e2b" && bootstrapClient ? bootstrapClient : client;
|
|
667
|
-
const remoteHome = await resolveRemoteHomeDir(installClient, spriteName);
|
|
668
|
-
const paths = buildDaemonPaths(remoteHome);
|
|
669
|
-
const configPhase = usesRemotePackageFetch ? 1 : 2;
|
|
670
|
-
const installPhase = usesRemotePackageFetch ? 2 : 3;
|
|
671
|
-
const ensurePhase = usesRemotePackageFetch ? 3 : 4;
|
|
672
|
-
if (usesRemotePackageFetch) {
|
|
673
|
-
reportPhase(0, "fetch package");
|
|
674
|
-
await fetchDaemonBinaryOnRemote({
|
|
675
|
-
client: installClient,
|
|
676
|
-
spriteAlias: spriteName,
|
|
677
|
-
release,
|
|
678
|
-
computeProvider,
|
|
679
|
-
remoteTarballPath: paths.daemonTarball,
|
|
680
|
-
...(onDownloadProgress ? { onProgress: onDownloadProgress } : {}),
|
|
681
|
-
});
|
|
682
|
-
}
|
|
683
|
-
else {
|
|
684
|
-
reportPhase(0, "download package");
|
|
685
|
-
const { buffer } = await fetchDaemonBinary(release, computeProvider, onDownloadProgress);
|
|
686
|
-
reportPhase(1, "upload package");
|
|
687
|
-
if (onUploadProgress) {
|
|
688
|
-
await installClient.writeFile(spriteName, paths.daemonTarball, buffer, {
|
|
689
|
-
onProgress: onUploadProgress,
|
|
690
|
-
});
|
|
691
|
-
}
|
|
692
|
-
else {
|
|
693
|
-
await installClient.writeFile(spriteName, paths.daemonTarball, buffer);
|
|
694
|
-
}
|
|
695
|
-
}
|
|
696
|
-
reportPhase(configPhase, "upload config");
|
|
697
|
-
await installClient.writeFile(spriteName, paths.daemonConfigFile, Buffer.from(buildDaemonConfig(convexUrl, heartbeatToken, computeProvider)));
|
|
698
|
-
reportPhase(installPhase, "install daemon");
|
|
699
|
-
const installLines = [
|
|
700
|
-
`mkdir -p ${paths.daemonDir}`,
|
|
701
|
-
`rm -rf ${paths.daemonBundleDir}`,
|
|
702
|
-
`mkdir -p ${paths.daemonBundleDir}`,
|
|
703
|
-
`tar -xzf ${paths.daemonTarball} -C ${paths.daemonBundleDir}`,
|
|
704
|
-
`chmod 755 ${paths.daemonEntry} || true`,
|
|
705
|
-
`chmod 755 ${paths.daemonBundleDir}/bin/* || true`,
|
|
706
|
-
];
|
|
707
|
-
if (computeProvider === "modal" || computeProvider === "e2b") {
|
|
708
|
-
installLines.push(`managed_node_path=${shellQuote(MANAGED_DAEMON_NODE_PATH)}`);
|
|
709
|
-
if (computeProvider === "modal") {
|
|
710
|
-
installLines.push('if [ ! -x "$managed_node_path" ] && [ -x /opt/modal-devbox/converge.sh ]; then', " /opt/modal-devbox/converge.sh --mode upgrade --force >/tmp/devbox-converge.log 2>&1 || true", "fi");
|
|
711
|
-
}
|
|
712
|
-
else {
|
|
713
|
-
installLines.push('if [ ! -x "$managed_node_path" ] && [ -x /opt/e2b-devbox/converge.sh ]; then', " sudo -n /opt/e2b-devbox/converge.sh --mode upgrade --force >/tmp/devbox-converge.log 2>&1 || true", "fi");
|
|
714
|
-
}
|
|
715
|
-
installLines.push([
|
|
716
|
-
'if [ ! -x "$managed_node_path" ]; then',
|
|
717
|
-
' echo "required managed daemon node missing at $managed_node_path" >&2',
|
|
718
|
-
" if [ -f /tmp/devbox-converge.log ]; then",
|
|
719
|
-
' echo "--- /tmp/devbox-converge.log (tail) ---" >&2',
|
|
720
|
-
" tail -n 200 /tmp/devbox-converge.log >&2 || true",
|
|
721
|
-
" fi",
|
|
722
|
-
" exit 1",
|
|
723
|
-
"fi",
|
|
724
|
-
].join("\n"), [
|
|
725
|
-
'"$managed_node_path"',
|
|
726
|
-
shellQuote(paths.daemonEntry),
|
|
727
|
-
"daemonctl install --json --timeout-ms 20000",
|
|
728
|
-
`--tarball ${shellQuote(paths.daemonTarball)}`,
|
|
729
|
-
`--release-sha ${shellQuote(release.sha256)}`,
|
|
730
|
-
`--config-path ${shellQuote(paths.daemonConfigFile)}`,
|
|
731
|
-
].join(" "));
|
|
732
|
-
}
|
|
733
|
-
else {
|
|
734
|
-
installLines.push([
|
|
735
|
-
`${paths.daemonEntry} daemonctl install --json --timeout-ms 20000`,
|
|
736
|
-
`--tarball ${paths.daemonTarball}`,
|
|
737
|
-
`--release-sha ${release.sha256}`,
|
|
738
|
-
`--config-path ${paths.daemonConfigFile}`,
|
|
739
|
-
].join(" "));
|
|
740
|
-
}
|
|
741
|
-
const installScript = ["set -euo pipefail", ...installLines].join("\n");
|
|
742
|
-
const result = computeProvider === "e2b"
|
|
743
|
-
? await execWithLog(installClient, spriteName, installScript, "install-sprite-daemon", {
|
|
744
|
-
timeoutMs: 120_000,
|
|
745
|
-
handshakeTimeoutMs: BOOTSTRAP_EXEC_HANDSHAKE_TIMEOUT_MS,
|
|
746
|
-
})
|
|
747
|
-
: await client.exec(spriteName, [
|
|
748
|
-
"/bin/bash",
|
|
749
|
-
"--noprofile",
|
|
750
|
-
"--norc",
|
|
751
|
-
"-e",
|
|
752
|
-
"-u",
|
|
753
|
-
"-o",
|
|
754
|
-
"pipefail",
|
|
755
|
-
"-c",
|
|
756
|
-
installLines.join("\n"),
|
|
757
|
-
], { timeoutMs: 120_000 });
|
|
758
|
-
if (result.exitCode !== 0) {
|
|
759
|
-
throw new Error(result.stderr || result.stdout || "Daemon install failed.");
|
|
760
|
-
}
|
|
761
|
-
reportPhase(ensurePhase, "ensure daemon service");
|
|
762
|
-
await ensureSpriteDaemonService({ client, spriteName, computeProvider });
|
|
763
|
-
reportPhase(totalPhases, "completed");
|
|
764
|
-
};
|
|
765
|
-
export { bootstrapDevbox, ensureSpriteDaemonService, expandHome, resolveRemoteHomeDir, shellQuote, installSpriteDaemon, ensureRemoteCodexConfig, stageRemoteSetupArtifacts, };
|
|
766
|
-
//# sourceMappingURL=remote.js.map
|