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