@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,927 +0,0 @@
|
|
|
1
|
-
import { openBrowser as openBrowserUrl } from "../../../browser.js";
|
|
2
|
-
import { loadRemoteApplyPrompt, readPromptTemplate } from "./prompts.js";
|
|
3
|
-
import { renderTemplate } from "./template.js";
|
|
4
|
-
import { extractBoldText, extractProgressUpdateFromJsonLine, extractThreadIdFromJsonLine, normalizeProgressMessage, stripAnsi, } from "./events.js";
|
|
5
|
-
const decodeBase64 = (value) => {
|
|
6
|
-
if (typeof value !== "string")
|
|
7
|
-
return Buffer.alloc(0);
|
|
8
|
-
try {
|
|
9
|
-
return Buffer.from(value, "base64");
|
|
10
|
-
}
|
|
11
|
-
catch {
|
|
12
|
-
return Buffer.alloc(0);
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
const parseExitCode = (value) => {
|
|
16
|
-
if (typeof value === "number" && Number.isFinite(value)) {
|
|
17
|
-
return Math.max(0, Math.min(255, Math.floor(value)));
|
|
18
|
-
}
|
|
19
|
-
const parsed = Number.parseInt(String(value ?? "0"), 10);
|
|
20
|
-
if (!Number.isFinite(parsed)) {
|
|
21
|
-
return 0;
|
|
22
|
-
}
|
|
23
|
-
return Math.max(0, Math.min(255, parsed));
|
|
24
|
-
};
|
|
25
|
-
const parseRemoteExecMessage = (data) => {
|
|
26
|
-
let payload;
|
|
27
|
-
try {
|
|
28
|
-
payload = JSON.parse(data);
|
|
29
|
-
}
|
|
30
|
-
catch {
|
|
31
|
-
return { kind: "raw" };
|
|
32
|
-
}
|
|
33
|
-
if (payload.type === "exit" && typeof payload.exit_code === "number") {
|
|
34
|
-
return { kind: "exit", code: parseExitCode(payload.exit_code) };
|
|
35
|
-
}
|
|
36
|
-
if (payload.type === "tty_exit") {
|
|
37
|
-
return {
|
|
38
|
-
kind: "exit",
|
|
39
|
-
code: parseExitCode(payload.code ?? payload.exit_code),
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
if (payload.type === "tty_data") {
|
|
43
|
-
const bytes = decodeBase64(payload.data);
|
|
44
|
-
if (bytes.length === 0)
|
|
45
|
-
return { kind: "ignore" };
|
|
46
|
-
return {
|
|
47
|
-
kind: "stream",
|
|
48
|
-
stream: payload.stream === "stderr" ? "stderr" : "stdout",
|
|
49
|
-
text: bytes.toString("utf8"),
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
if (payload.type === "tty_ready" || payload.type === "session_info") {
|
|
53
|
-
const rawSessionId = payload.sessionId ?? payload.session_id ?? payload.id ?? null;
|
|
54
|
-
if (typeof rawSessionId === "string" && rawSessionId.trim().length > 0) {
|
|
55
|
-
return { kind: "session", sessionId: rawSessionId.trim() };
|
|
56
|
-
}
|
|
57
|
-
return { kind: "ignore" };
|
|
58
|
-
}
|
|
59
|
-
if (payload.type === "tty_replay_start" ||
|
|
60
|
-
payload.type === "tty_replay_done" ||
|
|
61
|
-
payload.type === "port_opened" ||
|
|
62
|
-
payload.type === "port_closed") {
|
|
63
|
-
return { kind: "ignore" };
|
|
64
|
-
}
|
|
65
|
-
if ((payload.type === "tty_error" || payload.type === "error") &&
|
|
66
|
-
typeof payload.message === "string" &&
|
|
67
|
-
payload.message.trim().length > 0) {
|
|
68
|
-
return {
|
|
69
|
-
kind: "stream",
|
|
70
|
-
stream: "stderr",
|
|
71
|
-
text: `${payload.message}\n`,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
return { kind: "raw" };
|
|
75
|
-
};
|
|
76
|
-
const extractAuthUrl = (value) => {
|
|
77
|
-
const match = value.match(/https:\/\/auth\.openai\.com\/oauth\/authorize[^\s]+/);
|
|
78
|
-
return match?.[0] ?? null;
|
|
79
|
-
};
|
|
80
|
-
const extractLocalPort = (value) => {
|
|
81
|
-
const direct = value.match(/http:\/\/localhost:(\d+)/);
|
|
82
|
-
if (direct?.[1]) {
|
|
83
|
-
const port = Number(direct[1]);
|
|
84
|
-
if (Number.isFinite(port))
|
|
85
|
-
return port;
|
|
86
|
-
}
|
|
87
|
-
const encoded = value.match(/localhost%3A(\d+)/);
|
|
88
|
-
if (encoded?.[1]) {
|
|
89
|
-
const port = Number(encoded[1]);
|
|
90
|
-
if (Number.isFinite(port))
|
|
91
|
-
return port;
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
};
|
|
95
|
-
const summarizeExecOutput = (stderr, stdout) => {
|
|
96
|
-
const summarize = (value) => {
|
|
97
|
-
const cleaned = stripAnsi(value);
|
|
98
|
-
const lines = cleaned
|
|
99
|
-
.split(/\r?\n/)
|
|
100
|
-
.map((line) => line.trim())
|
|
101
|
-
.filter((line) => line.length > 0);
|
|
102
|
-
if (lines.length === 0)
|
|
103
|
-
return null;
|
|
104
|
-
const summary = lines.slice(-3).join(" | ");
|
|
105
|
-
if (summary.length <= 500)
|
|
106
|
-
return summary;
|
|
107
|
-
return `${summary.slice(0, 500)}...`;
|
|
108
|
-
};
|
|
109
|
-
return summarize(stderr) ?? summarize(stdout);
|
|
110
|
-
};
|
|
111
|
-
const REMOTE_CODEX_EXEC_INACTIVITY_TIMEOUT_MS = 180_000;
|
|
112
|
-
const REMOTE_CODEX_EXEC_FORCE_CLOSE_GRACE_MS = 5_000;
|
|
113
|
-
const REMOTE_CODEX_EXEC_PING_INTERVAL_MS = 20_000;
|
|
114
|
-
const REMOTE_CODEX_EXEC_PONG_GRACE_MS = 45_000;
|
|
115
|
-
const buildEntrypointsBlock = (entrypoints) => {
|
|
116
|
-
if (entrypoints.length === 0)
|
|
117
|
-
return "";
|
|
118
|
-
const lines = [
|
|
119
|
-
" Essential app entry points to get working are:",
|
|
120
|
-
...entrypoints.map((entry, index) => {
|
|
121
|
-
const description = entry.description?.trim() || "no description";
|
|
122
|
-
return ` ${index + 1}. \`${entry.command}\` (${description})`;
|
|
123
|
-
}),
|
|
124
|
-
];
|
|
125
|
-
return lines.join("\n");
|
|
126
|
-
};
|
|
127
|
-
const resolveRemoteApplyTemplateName = (computeProvider) => computeProvider === "modal"
|
|
128
|
-
? "remote-apply-modal.md"
|
|
129
|
-
: computeProvider === "e2b"
|
|
130
|
-
? "remote-apply-e2b.md"
|
|
131
|
-
: "remote-apply.md";
|
|
132
|
-
const renderRemoteApplyPromptFromTemplate = ({ template, setupPath, artifactsBundle, artifactsManifest, entrypoints, setupTodoPath, }) => renderTemplate(template, {
|
|
133
|
-
setup_path: setupPath,
|
|
134
|
-
artifacts_bundle: artifactsBundle,
|
|
135
|
-
artifacts_manifest: artifactsManifest,
|
|
136
|
-
entrypoints_block: buildEntrypointsBlock(entrypoints),
|
|
137
|
-
setup_todo_path: setupTodoPath,
|
|
138
|
-
}).trim();
|
|
139
|
-
const renderRemoteApplyPrompt = async ({ setupPath, artifactsBundle, artifactsManifest, entrypoints, computeProvider, setupTodoPath, }) => {
|
|
140
|
-
const template = await readPromptTemplate(resolveRemoteApplyTemplateName(computeProvider));
|
|
141
|
-
return renderRemoteApplyPromptFromTemplate({
|
|
142
|
-
template,
|
|
143
|
-
setupPath,
|
|
144
|
-
artifactsBundle,
|
|
145
|
-
artifactsManifest,
|
|
146
|
-
entrypoints,
|
|
147
|
-
setupTodoPath,
|
|
148
|
-
});
|
|
149
|
-
};
|
|
150
|
-
const buildRemoteApplyPrompt = async ({ setupPath, artifactsBundle, artifactsManifest, entrypoints, computeProvider, setupTodoPath, }) => loadRemoteApplyPrompt(setupPath, artifactsBundle, artifactsManifest, buildEntrypointsBlock(entrypoints), setupTodoPath, computeProvider);
|
|
151
|
-
const openBrowser = async (url) => openBrowserUrl(url);
|
|
152
|
-
const handleCodexProgressLine = ({ line, state, onProgress, }) => {
|
|
153
|
-
const clean = stripAnsi(line);
|
|
154
|
-
if (!state.threadId) {
|
|
155
|
-
const parsedThreadId = extractThreadIdFromJsonLine(clean);
|
|
156
|
-
if (parsedThreadId) {
|
|
157
|
-
state.threadId = parsedThreadId;
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
if (!onProgress)
|
|
161
|
-
return;
|
|
162
|
-
const parsed = extractProgressUpdateFromJsonLine(clean);
|
|
163
|
-
if (parsed) {
|
|
164
|
-
const progressKey = `${parsed.kind}:${parsed.message}`;
|
|
165
|
-
if (progressKey === state.lastProgressKey)
|
|
166
|
-
return;
|
|
167
|
-
state.lastProgressKey = progressKey;
|
|
168
|
-
onProgress(parsed);
|
|
169
|
-
return;
|
|
170
|
-
}
|
|
171
|
-
if (clean.trimStart().startsWith("{"))
|
|
172
|
-
return;
|
|
173
|
-
const bold = normalizeProgressMessage(extractBoldText(clean));
|
|
174
|
-
if (!bold)
|
|
175
|
-
return;
|
|
176
|
-
const progressKey = `reasoning:${bold}`;
|
|
177
|
-
if (progressKey === state.lastProgressKey)
|
|
178
|
-
return;
|
|
179
|
-
state.lastProgressKey = progressKey;
|
|
180
|
-
onProgress({ kind: "reasoning", message: bold });
|
|
181
|
-
};
|
|
182
|
-
const buildEnsureRemoteCodexScript = (computeProvider) => {
|
|
183
|
-
if (computeProvider !== "modal") {
|
|
184
|
-
return [
|
|
185
|
-
"set -euo pipefail",
|
|
186
|
-
'prefix="${HOME}/.local"',
|
|
187
|
-
'npm install -g --prefix "$prefix" @openai/codex --loglevel=error',
|
|
188
|
-
'if [ ! -x "$prefix/bin/codex" ]; then',
|
|
189
|
-
' echo "codex binary missing at $prefix/bin/codex" >&2',
|
|
190
|
-
" exit 1",
|
|
191
|
-
"fi",
|
|
192
|
-
'"$prefix/bin/codex" --version >/dev/null',
|
|
193
|
-
].join("\n");
|
|
194
|
-
}
|
|
195
|
-
return [
|
|
196
|
-
"set -euo pipefail",
|
|
197
|
-
'cleaned_path=""',
|
|
198
|
-
'IFS=":" read -r -a path_parts <<< "${PATH:-}"',
|
|
199
|
-
'for path_part in "${path_parts[@]}"; do',
|
|
200
|
-
' if [ -z "$path_part" ]; then',
|
|
201
|
-
" continue",
|
|
202
|
-
" fi",
|
|
203
|
-
' if [ "$path_part" = "$HOME/.devbox/bin" ] || [ "$path_part" = "$HOME/.local/bin" ]; then',
|
|
204
|
-
" continue",
|
|
205
|
-
" fi",
|
|
206
|
-
' if [ -n "$cleaned_path" ]; then',
|
|
207
|
-
' cleaned_path="${cleaned_path}:$path_part"',
|
|
208
|
-
" else",
|
|
209
|
-
' cleaned_path="$path_part"',
|
|
210
|
-
" fi",
|
|
211
|
-
"done",
|
|
212
|
-
'if [ -n "$cleaned_path" ]; then',
|
|
213
|
-
' if ! codex_bin="$(PATH="$cleaned_path" command -v codex 2>/dev/null)"; then',
|
|
214
|
-
' codex_bin=""',
|
|
215
|
-
" fi",
|
|
216
|
-
"else",
|
|
217
|
-
' codex_bin=""',
|
|
218
|
-
"fi",
|
|
219
|
-
'if [ -z "$codex_bin" ] || [ ! -x "$codex_bin" ]; then',
|
|
220
|
-
' echo "codex binary missing from Modal base image PATH" >&2',
|
|
221
|
-
" exit 1",
|
|
222
|
-
"fi",
|
|
223
|
-
'"$codex_bin" --version >/dev/null',
|
|
224
|
-
].join("\n");
|
|
225
|
-
};
|
|
226
|
-
const ensureRemoteCodexInstalled = async (client, spriteAlias, computeProvider) => {
|
|
227
|
-
const installScript = buildEnsureRemoteCodexScript(computeProvider);
|
|
228
|
-
const install = await client.exec(spriteAlias, [
|
|
229
|
-
"/bin/bash",
|
|
230
|
-
"--noprofile",
|
|
231
|
-
"--norc",
|
|
232
|
-
"-e",
|
|
233
|
-
"-u",
|
|
234
|
-
"-o",
|
|
235
|
-
"pipefail",
|
|
236
|
-
"-c",
|
|
237
|
-
installScript,
|
|
238
|
-
]);
|
|
239
|
-
if (install.exitCode !== 0) {
|
|
240
|
-
throw new Error(install.stderr || "Failed to install/upgrade Codex.");
|
|
241
|
-
}
|
|
242
|
-
};
|
|
243
|
-
const isRemoteCodexLoggedIn = async (client, spriteAlias) => {
|
|
244
|
-
const check = await client.exec(spriteAlias, [
|
|
245
|
-
"/bin/bash",
|
|
246
|
-
"--noprofile",
|
|
247
|
-
"--norc",
|
|
248
|
-
"-e",
|
|
249
|
-
"-u",
|
|
250
|
-
"-o",
|
|
251
|
-
"pipefail",
|
|
252
|
-
"-c",
|
|
253
|
-
`if codex login status >/dev/null 2>&1; then
|
|
254
|
-
exit 0
|
|
255
|
-
fi
|
|
256
|
-
|
|
257
|
-
# If this Codex build supports 'login status', a non-zero exit means
|
|
258
|
-
# unauthenticated and we should not guess from auth.json internals.
|
|
259
|
-
if codex login --help 2>/dev/null | grep -Eq '(^|[[:space:]])status([[:space:]]|$)'; then
|
|
260
|
-
exit 1
|
|
261
|
-
fi
|
|
262
|
-
|
|
263
|
-
auth_path="$HOME/.codex/auth.json"
|
|
264
|
-
if [ ! -s "$auth_path" ]; then
|
|
265
|
-
exit 1
|
|
266
|
-
fi
|
|
267
|
-
|
|
268
|
-
if command -v python3 >/dev/null 2>&1; then
|
|
269
|
-
python3 - <<'PY'
|
|
270
|
-
import json
|
|
271
|
-
import os
|
|
272
|
-
import sys
|
|
273
|
-
|
|
274
|
-
path = os.path.expanduser("~/.codex/auth.json")
|
|
275
|
-
try:
|
|
276
|
-
with open(path, "r", encoding="utf-8") as f:
|
|
277
|
-
raw = f.read()
|
|
278
|
-
except FileNotFoundError:
|
|
279
|
-
sys.exit(1)
|
|
280
|
-
|
|
281
|
-
raw = raw.strip()
|
|
282
|
-
if not raw:
|
|
283
|
-
sys.exit(1)
|
|
284
|
-
|
|
285
|
-
try:
|
|
286
|
-
data = json.loads(raw)
|
|
287
|
-
except Exception:
|
|
288
|
-
sys.exit(1)
|
|
289
|
-
|
|
290
|
-
TOKEN_KEYS = {
|
|
291
|
-
"access_token",
|
|
292
|
-
"refresh_token",
|
|
293
|
-
"id_token",
|
|
294
|
-
"api_key",
|
|
295
|
-
"apikey",
|
|
296
|
-
"openai_api_key",
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
def is_token_key(key: str) -> bool:
|
|
300
|
-
normalized = key.lower()
|
|
301
|
-
if normalized in TOKEN_KEYS:
|
|
302
|
-
return True
|
|
303
|
-
if normalized.endswith("_token") and normalized != "token_type":
|
|
304
|
-
return True
|
|
305
|
-
return False
|
|
306
|
-
|
|
307
|
-
stack = [data]
|
|
308
|
-
while stack:
|
|
309
|
-
value = stack.pop()
|
|
310
|
-
if isinstance(value, dict):
|
|
311
|
-
for k, v in value.items():
|
|
312
|
-
key = str(k)
|
|
313
|
-
if is_token_key(key) and isinstance(v, str) and v.strip():
|
|
314
|
-
sys.exit(0)
|
|
315
|
-
if isinstance(v, (dict, list)):
|
|
316
|
-
stack.append(v)
|
|
317
|
-
elif isinstance(value, list):
|
|
318
|
-
stack.extend(value)
|
|
319
|
-
|
|
320
|
-
sys.exit(1)
|
|
321
|
-
PY
|
|
322
|
-
else
|
|
323
|
-
# Heuristic fallback if python isn't available.
|
|
324
|
-
grep -Eqi '"(access_token|refresh_token|id_token|api_key|apikey|openai_api_key)"[[:space:]]*:[[:space:]]*"[^"]+"' "$auth_path"
|
|
325
|
-
fi`,
|
|
326
|
-
]);
|
|
327
|
-
return check.exitCode === 0;
|
|
328
|
-
};
|
|
329
|
-
const runRemoteCodexLogin = async ({ client, spriteAlias, cmd, tty, onUrl, onLocalPort, }) => new Promise((resolve, reject) => {
|
|
330
|
-
const ws = client.openExecSession(spriteAlias, {
|
|
331
|
-
cmd,
|
|
332
|
-
ephemeral: true,
|
|
333
|
-
tty: tty ?? false,
|
|
334
|
-
stdin: false,
|
|
335
|
-
});
|
|
336
|
-
let stdout = "";
|
|
337
|
-
let stderr = "";
|
|
338
|
-
let stdoutBuffer = "";
|
|
339
|
-
let stderrBuffer = "";
|
|
340
|
-
let exitCode = null;
|
|
341
|
-
let resolved = false;
|
|
342
|
-
let urlBuffer = "";
|
|
343
|
-
let sawUrl = false;
|
|
344
|
-
let sawLocalPort = false;
|
|
345
|
-
let callbackError = null;
|
|
346
|
-
let urlCallback = null;
|
|
347
|
-
let portCallback = null;
|
|
348
|
-
const captureCallbackError = (error) => {
|
|
349
|
-
callbackError = error instanceof Error ? error : new Error(String(error));
|
|
350
|
-
};
|
|
351
|
-
const noteUrl = (text) => {
|
|
352
|
-
if (sawUrl)
|
|
353
|
-
return;
|
|
354
|
-
const clean = stripAnsi(text);
|
|
355
|
-
urlBuffer = `${urlBuffer}${clean}`;
|
|
356
|
-
if (urlBuffer.length > 8192) {
|
|
357
|
-
urlBuffer = urlBuffer.slice(-8192);
|
|
358
|
-
}
|
|
359
|
-
const url = extractAuthUrl(urlBuffer);
|
|
360
|
-
if (!url)
|
|
361
|
-
return;
|
|
362
|
-
sawUrl = true;
|
|
363
|
-
if (!onUrl)
|
|
364
|
-
return;
|
|
365
|
-
try {
|
|
366
|
-
urlCallback = Promise.resolve(onUrl(url));
|
|
367
|
-
urlCallback.catch((error) => {
|
|
368
|
-
if (callbackError)
|
|
369
|
-
return;
|
|
370
|
-
captureCallbackError(error);
|
|
371
|
-
ws.close();
|
|
372
|
-
});
|
|
373
|
-
}
|
|
374
|
-
catch (error) {
|
|
375
|
-
if (callbackError)
|
|
376
|
-
return;
|
|
377
|
-
captureCallbackError(error);
|
|
378
|
-
ws.close();
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
const noteLocalPort = (text) => {
|
|
382
|
-
if (sawLocalPort)
|
|
383
|
-
return;
|
|
384
|
-
const clean = stripAnsi(text);
|
|
385
|
-
const port = extractLocalPort(clean);
|
|
386
|
-
if (!port)
|
|
387
|
-
return;
|
|
388
|
-
sawLocalPort = true;
|
|
389
|
-
if (!onLocalPort)
|
|
390
|
-
return;
|
|
391
|
-
try {
|
|
392
|
-
portCallback = Promise.resolve(onLocalPort(port));
|
|
393
|
-
portCallback.catch((error) => {
|
|
394
|
-
if (callbackError)
|
|
395
|
-
return;
|
|
396
|
-
captureCallbackError(error);
|
|
397
|
-
ws.close();
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
catch (error) {
|
|
401
|
-
if (callbackError)
|
|
402
|
-
return;
|
|
403
|
-
captureCallbackError(error);
|
|
404
|
-
ws.close();
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
const handleChunk = (text, buffer, update, sink) => {
|
|
408
|
-
noteUrl(text);
|
|
409
|
-
noteLocalPort(text);
|
|
410
|
-
let next = buffer + text;
|
|
411
|
-
let idx = next.indexOf("\n");
|
|
412
|
-
while (idx !== -1) {
|
|
413
|
-
const line = next.slice(0, idx);
|
|
414
|
-
next = next.slice(idx + 1);
|
|
415
|
-
idx = next.indexOf("\n");
|
|
416
|
-
}
|
|
417
|
-
update(next);
|
|
418
|
-
sink(text);
|
|
419
|
-
};
|
|
420
|
-
const handleBinary = (buffer) => {
|
|
421
|
-
if (buffer.length === 0)
|
|
422
|
-
return;
|
|
423
|
-
const streamId = buffer[0];
|
|
424
|
-
if (streamId !== 1 && streamId !== 2 && streamId !== 3) {
|
|
425
|
-
const text = Buffer.from(buffer).toString("utf8");
|
|
426
|
-
handleChunk(text, stdoutBuffer, (next) => {
|
|
427
|
-
stdoutBuffer = next;
|
|
428
|
-
}, (value) => {
|
|
429
|
-
stdout += value;
|
|
430
|
-
});
|
|
431
|
-
return;
|
|
432
|
-
}
|
|
433
|
-
const payload = buffer.subarray(1);
|
|
434
|
-
if (streamId === 1) {
|
|
435
|
-
const text = Buffer.from(payload).toString("utf8");
|
|
436
|
-
handleChunk(text, stdoutBuffer, (next) => {
|
|
437
|
-
stdoutBuffer = next;
|
|
438
|
-
}, (value) => {
|
|
439
|
-
stdout += value;
|
|
440
|
-
});
|
|
441
|
-
}
|
|
442
|
-
else if (streamId === 2) {
|
|
443
|
-
const text = Buffer.from(payload).toString("utf8");
|
|
444
|
-
handleChunk(text, stderrBuffer, (next) => {
|
|
445
|
-
stderrBuffer = next;
|
|
446
|
-
}, (value) => {
|
|
447
|
-
stderr += value;
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
else if (streamId === 3 && payload.length > 0) {
|
|
451
|
-
exitCode = payload[0] ?? 0;
|
|
452
|
-
ws.close();
|
|
453
|
-
}
|
|
454
|
-
};
|
|
455
|
-
const handleText = (data) => {
|
|
456
|
-
const parsed = parseRemoteExecMessage(data);
|
|
457
|
-
if (parsed.kind === "exit") {
|
|
458
|
-
exitCode = parsed.code;
|
|
459
|
-
ws.close();
|
|
460
|
-
return;
|
|
461
|
-
}
|
|
462
|
-
if (parsed.kind === "stream") {
|
|
463
|
-
if (parsed.stream === "stderr") {
|
|
464
|
-
handleChunk(parsed.text, stderrBuffer, (next) => {
|
|
465
|
-
stderrBuffer = next;
|
|
466
|
-
}, (value) => {
|
|
467
|
-
stderr += value;
|
|
468
|
-
});
|
|
469
|
-
return;
|
|
470
|
-
}
|
|
471
|
-
handleChunk(parsed.text, stdoutBuffer, (next) => {
|
|
472
|
-
stdoutBuffer = next;
|
|
473
|
-
}, (value) => {
|
|
474
|
-
stdout += value;
|
|
475
|
-
});
|
|
476
|
-
return;
|
|
477
|
-
}
|
|
478
|
-
if (parsed.kind === "ignore") {
|
|
479
|
-
return;
|
|
480
|
-
}
|
|
481
|
-
handleChunk(data, stdoutBuffer, (next) => {
|
|
482
|
-
stdoutBuffer = next;
|
|
483
|
-
}, (value) => {
|
|
484
|
-
stdout += value;
|
|
485
|
-
});
|
|
486
|
-
};
|
|
487
|
-
const onMessage = (event) => {
|
|
488
|
-
const data = event.data;
|
|
489
|
-
if (typeof data === "string") {
|
|
490
|
-
handleText(data);
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
if (data instanceof ArrayBuffer) {
|
|
494
|
-
handleBinary(new Uint8Array(data));
|
|
495
|
-
return;
|
|
496
|
-
}
|
|
497
|
-
if (data instanceof Uint8Array) {
|
|
498
|
-
handleBinary(data);
|
|
499
|
-
return;
|
|
500
|
-
}
|
|
501
|
-
if (typeof Blob !== "undefined" && data instanceof Blob) {
|
|
502
|
-
data
|
|
503
|
-
.arrayBuffer()
|
|
504
|
-
.then((buffer) => handleBinary(new Uint8Array(buffer)))
|
|
505
|
-
.catch(() => { });
|
|
506
|
-
}
|
|
507
|
-
};
|
|
508
|
-
const finish = (code) => {
|
|
509
|
-
if (resolved)
|
|
510
|
-
return;
|
|
511
|
-
resolved = true;
|
|
512
|
-
if (stdoutBuffer) {
|
|
513
|
-
noteUrl(stdoutBuffer);
|
|
514
|
-
noteLocalPort(stdoutBuffer);
|
|
515
|
-
}
|
|
516
|
-
if (stderrBuffer) {
|
|
517
|
-
noteUrl(stderrBuffer);
|
|
518
|
-
noteLocalPort(stderrBuffer);
|
|
519
|
-
}
|
|
520
|
-
const finalize = () => {
|
|
521
|
-
if (callbackError) {
|
|
522
|
-
reject(callbackError);
|
|
523
|
-
return;
|
|
524
|
-
}
|
|
525
|
-
if (code === null) {
|
|
526
|
-
const detail = summarizeExecOutput(stderr, stdout);
|
|
527
|
-
const suffix = detail ? `: ${detail}` : "";
|
|
528
|
-
reject(new Error(`codex login failed: remote exec stream closed before exit status${suffix}`));
|
|
529
|
-
return;
|
|
530
|
-
}
|
|
531
|
-
const finalCode = code;
|
|
532
|
-
if (finalCode === 0) {
|
|
533
|
-
resolve();
|
|
534
|
-
return;
|
|
535
|
-
}
|
|
536
|
-
const detail = summarizeExecOutput(stderr, stdout);
|
|
537
|
-
const suffix = detail ? `: ${detail}` : "";
|
|
538
|
-
reject(new Error(`codex login failed (exit ${finalCode})${suffix}`));
|
|
539
|
-
};
|
|
540
|
-
const pending = [urlCallback, portCallback].filter((value) => Boolean(value));
|
|
541
|
-
if (pending.length > 0) {
|
|
542
|
-
Promise.allSettled(pending).then(finalize);
|
|
543
|
-
return;
|
|
544
|
-
}
|
|
545
|
-
finalize();
|
|
546
|
-
};
|
|
547
|
-
ws.addEventListener("message", onMessage);
|
|
548
|
-
ws.addEventListener("close", () => finish(exitCode));
|
|
549
|
-
ws.addEventListener("error", () => finish(exitCode ?? 1));
|
|
550
|
-
});
|
|
551
|
-
const runRemoteCodexExec = async ({ client, spriteAlias, cmd, execSessionId, tty, onProgress, onStateChange, inactivityTimeoutMs = REMOTE_CODEX_EXEC_INACTIVITY_TIMEOUT_MS, forceCloseGraceMs = REMOTE_CODEX_EXEC_FORCE_CLOSE_GRACE_MS, pingIntervalMs = REMOTE_CODEX_EXEC_PING_INTERVAL_MS, pongGraceMs = REMOTE_CODEX_EXEC_PONG_GRACE_MS, }) => new Promise((resolve) => {
|
|
552
|
-
const ws = typeof execSessionId === "string" && execSessionId.trim().length > 0
|
|
553
|
-
? client.attachExecSession(spriteAlias, execSessionId.trim())
|
|
554
|
-
: client.openExecSession(spriteAlias, {
|
|
555
|
-
cmd,
|
|
556
|
-
ephemeral: false,
|
|
557
|
-
tty: tty ?? false,
|
|
558
|
-
stdin: false,
|
|
559
|
-
});
|
|
560
|
-
let stdout = "";
|
|
561
|
-
let stderr = "";
|
|
562
|
-
let stdoutBuffer = "";
|
|
563
|
-
let stderrBuffer = "";
|
|
564
|
-
let exitCode = null;
|
|
565
|
-
let resolved = false;
|
|
566
|
-
let lastProgressKey = null;
|
|
567
|
-
let threadId = null;
|
|
568
|
-
let resolvedExecSessionId = typeof execSessionId === "string" && execSessionId.trim().length > 0
|
|
569
|
-
? execSessionId.trim()
|
|
570
|
-
: null;
|
|
571
|
-
let lastAnnouncedThreadId = null;
|
|
572
|
-
let lastAnnouncedExecSessionId = null;
|
|
573
|
-
let pendingStateChange = Promise.resolve();
|
|
574
|
-
let inactivityTimer = null;
|
|
575
|
-
let forceCloseTimer = null;
|
|
576
|
-
let pingTimer = null;
|
|
577
|
-
let awaitingPongSince = null;
|
|
578
|
-
let watchdogFailureMessage = null;
|
|
579
|
-
let socketErrorMessage = null;
|
|
580
|
-
const announceStateChange = () => {
|
|
581
|
-
if (!onStateChange) {
|
|
582
|
-
return;
|
|
583
|
-
}
|
|
584
|
-
if (threadId === lastAnnouncedThreadId &&
|
|
585
|
-
resolvedExecSessionId === lastAnnouncedExecSessionId) {
|
|
586
|
-
return;
|
|
587
|
-
}
|
|
588
|
-
lastAnnouncedThreadId = threadId;
|
|
589
|
-
lastAnnouncedExecSessionId = resolvedExecSessionId;
|
|
590
|
-
const nextState = {
|
|
591
|
-
threadId,
|
|
592
|
-
execSessionId: resolvedExecSessionId,
|
|
593
|
-
};
|
|
594
|
-
pendingStateChange = pendingStateChange
|
|
595
|
-
.catch(() => { })
|
|
596
|
-
.then(() => Promise.resolve(onStateChange(nextState)))
|
|
597
|
-
.catch((error) => {
|
|
598
|
-
if (socketErrorMessage) {
|
|
599
|
-
return;
|
|
600
|
-
}
|
|
601
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
602
|
-
socketErrorMessage = `failed to persist init resume state: ${detail}`;
|
|
603
|
-
});
|
|
604
|
-
};
|
|
605
|
-
const onPong = () => {
|
|
606
|
-
awaitingPongSince = null;
|
|
607
|
-
};
|
|
608
|
-
const clearTimers = () => {
|
|
609
|
-
if (inactivityTimer) {
|
|
610
|
-
clearTimeout(inactivityTimer);
|
|
611
|
-
inactivityTimer = null;
|
|
612
|
-
}
|
|
613
|
-
if (forceCloseTimer) {
|
|
614
|
-
clearTimeout(forceCloseTimer);
|
|
615
|
-
forceCloseTimer = null;
|
|
616
|
-
}
|
|
617
|
-
if (pingTimer) {
|
|
618
|
-
clearInterval(pingTimer);
|
|
619
|
-
pingTimer = null;
|
|
620
|
-
}
|
|
621
|
-
if (typeof ws.off === "function") {
|
|
622
|
-
ws.off("pong", onPong);
|
|
623
|
-
}
|
|
624
|
-
else if (typeof ws.removeListener === "function") {
|
|
625
|
-
ws.removeListener("pong", onPong);
|
|
626
|
-
}
|
|
627
|
-
};
|
|
628
|
-
const forceCloseSocket = () => {
|
|
629
|
-
if (typeof ws.terminate === "function") {
|
|
630
|
-
try {
|
|
631
|
-
ws.terminate();
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
catch {
|
|
635
|
-
// fall through to close
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
try {
|
|
639
|
-
ws.close();
|
|
640
|
-
}
|
|
641
|
-
catch {
|
|
642
|
-
// best effort
|
|
643
|
-
}
|
|
644
|
-
};
|
|
645
|
-
const requestSocketClose = (message) => {
|
|
646
|
-
if (resolved || watchdogFailureMessage) {
|
|
647
|
-
return;
|
|
648
|
-
}
|
|
649
|
-
watchdogFailureMessage = message;
|
|
650
|
-
stderr += `${message}\n`;
|
|
651
|
-
onProgress?.({ kind: "command", message });
|
|
652
|
-
try {
|
|
653
|
-
ws.close();
|
|
654
|
-
}
|
|
655
|
-
catch {
|
|
656
|
-
// best effort
|
|
657
|
-
}
|
|
658
|
-
if (forceCloseGraceMs > 0) {
|
|
659
|
-
forceCloseTimer = setTimeout(() => {
|
|
660
|
-
if (resolved)
|
|
661
|
-
return;
|
|
662
|
-
forceCloseSocket();
|
|
663
|
-
}, forceCloseGraceMs);
|
|
664
|
-
forceCloseTimer.unref?.();
|
|
665
|
-
}
|
|
666
|
-
};
|
|
667
|
-
const scheduleInactivityTimeout = () => {
|
|
668
|
-
if (resolved || inactivityTimeoutMs <= 0 || watchdogFailureMessage) {
|
|
669
|
-
return;
|
|
670
|
-
}
|
|
671
|
-
if (inactivityTimer) {
|
|
672
|
-
clearTimeout(inactivityTimer);
|
|
673
|
-
}
|
|
674
|
-
inactivityTimer = setTimeout(() => {
|
|
675
|
-
requestSocketClose(`codex exec idle for ${Math.ceil(inactivityTimeoutMs / 1000)}s; restarting session`);
|
|
676
|
-
}, inactivityTimeoutMs);
|
|
677
|
-
inactivityTimer.unref?.();
|
|
678
|
-
};
|
|
679
|
-
const startKeepalive = () => {
|
|
680
|
-
if (pingIntervalMs <= 0 ||
|
|
681
|
-
pongGraceMs <= 0 ||
|
|
682
|
-
typeof ws.ping !== "function") {
|
|
683
|
-
return;
|
|
684
|
-
}
|
|
685
|
-
if (typeof ws.on === "function") {
|
|
686
|
-
ws.on("pong", onPong);
|
|
687
|
-
}
|
|
688
|
-
else {
|
|
689
|
-
return;
|
|
690
|
-
}
|
|
691
|
-
pingTimer = setInterval(() => {
|
|
692
|
-
if (resolved || watchdogFailureMessage)
|
|
693
|
-
return;
|
|
694
|
-
const now = Date.now();
|
|
695
|
-
if (awaitingPongSince !== null &&
|
|
696
|
-
now - awaitingPongSince > pongGraceMs) {
|
|
697
|
-
requestSocketClose(`remote exec connection missed keepalive pong for ${Math.ceil(pongGraceMs / 1000)}s; restarting session`);
|
|
698
|
-
return;
|
|
699
|
-
}
|
|
700
|
-
if (awaitingPongSince === null) {
|
|
701
|
-
awaitingPongSince = now;
|
|
702
|
-
}
|
|
703
|
-
try {
|
|
704
|
-
ws.ping?.();
|
|
705
|
-
}
|
|
706
|
-
catch {
|
|
707
|
-
// ignore ping failures; the socket lifecycle will surface them
|
|
708
|
-
}
|
|
709
|
-
}, pingIntervalMs);
|
|
710
|
-
pingTimer.unref?.();
|
|
711
|
-
};
|
|
712
|
-
const handleLine = (line) => {
|
|
713
|
-
const clean = stripAnsi(line);
|
|
714
|
-
if (!threadId) {
|
|
715
|
-
const parsedThreadId = extractThreadIdFromJsonLine(clean);
|
|
716
|
-
if (parsedThreadId) {
|
|
717
|
-
threadId = parsedThreadId;
|
|
718
|
-
announceStateChange();
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
if (!onProgress)
|
|
722
|
-
return;
|
|
723
|
-
const parsed = extractProgressUpdateFromJsonLine(clean);
|
|
724
|
-
if (parsed) {
|
|
725
|
-
const progressKey = `${parsed.kind}:${parsed.message}`;
|
|
726
|
-
if (progressKey === lastProgressKey)
|
|
727
|
-
return;
|
|
728
|
-
lastProgressKey = progressKey;
|
|
729
|
-
onProgress(parsed);
|
|
730
|
-
return;
|
|
731
|
-
}
|
|
732
|
-
if (clean.trimStart().startsWith("{"))
|
|
733
|
-
return;
|
|
734
|
-
const bold = normalizeProgressMessage(extractBoldText(clean));
|
|
735
|
-
if (!bold)
|
|
736
|
-
return;
|
|
737
|
-
const progressKey = `reasoning:${bold}`;
|
|
738
|
-
if (progressKey === lastProgressKey)
|
|
739
|
-
return;
|
|
740
|
-
lastProgressKey = progressKey;
|
|
741
|
-
onProgress({ kind: "reasoning", message: bold });
|
|
742
|
-
};
|
|
743
|
-
const handleChunk = (text, buffer, update, sink) => {
|
|
744
|
-
scheduleInactivityTimeout();
|
|
745
|
-
let next = buffer + text;
|
|
746
|
-
let idx = next.indexOf("\n");
|
|
747
|
-
while (idx !== -1) {
|
|
748
|
-
const line = next.slice(0, idx);
|
|
749
|
-
handleLine(line);
|
|
750
|
-
next = next.slice(idx + 1);
|
|
751
|
-
idx = next.indexOf("\n");
|
|
752
|
-
}
|
|
753
|
-
update(next);
|
|
754
|
-
sink(text);
|
|
755
|
-
};
|
|
756
|
-
const handleBinary = (buffer) => {
|
|
757
|
-
if (buffer.length === 0)
|
|
758
|
-
return;
|
|
759
|
-
const streamId = buffer[0];
|
|
760
|
-
if (streamId !== 1 && streamId !== 2 && streamId !== 3) {
|
|
761
|
-
const text = Buffer.from(buffer).toString("utf8");
|
|
762
|
-
handleChunk(text, stdoutBuffer, (next) => {
|
|
763
|
-
stdoutBuffer = next;
|
|
764
|
-
}, (value) => {
|
|
765
|
-
stdout += value;
|
|
766
|
-
});
|
|
767
|
-
return;
|
|
768
|
-
}
|
|
769
|
-
const payload = buffer.subarray(1);
|
|
770
|
-
if (streamId === 1) {
|
|
771
|
-
const text = Buffer.from(payload).toString("utf8");
|
|
772
|
-
handleChunk(text, stdoutBuffer, (next) => {
|
|
773
|
-
stdoutBuffer = next;
|
|
774
|
-
}, (value) => {
|
|
775
|
-
stdout += value;
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
|
-
else if (streamId === 2) {
|
|
779
|
-
const text = Buffer.from(payload).toString("utf8");
|
|
780
|
-
handleChunk(text, stderrBuffer, (next) => {
|
|
781
|
-
stderrBuffer = next;
|
|
782
|
-
}, (value) => {
|
|
783
|
-
stderr += value;
|
|
784
|
-
});
|
|
785
|
-
}
|
|
786
|
-
else if (streamId === 3 && payload.length > 0) {
|
|
787
|
-
exitCode = payload[0] ?? 0;
|
|
788
|
-
ws.close();
|
|
789
|
-
}
|
|
790
|
-
};
|
|
791
|
-
const handleText = (data) => {
|
|
792
|
-
const parsed = parseRemoteExecMessage(data);
|
|
793
|
-
if (parsed.kind === "exit") {
|
|
794
|
-
exitCode = parsed.code;
|
|
795
|
-
ws.close();
|
|
796
|
-
return;
|
|
797
|
-
}
|
|
798
|
-
if (parsed.kind === "session") {
|
|
799
|
-
resolvedExecSessionId = parsed.sessionId;
|
|
800
|
-
announceStateChange();
|
|
801
|
-
return;
|
|
802
|
-
}
|
|
803
|
-
if (parsed.kind === "stream") {
|
|
804
|
-
if (parsed.stream === "stderr") {
|
|
805
|
-
handleChunk(parsed.text, stderrBuffer, (next) => {
|
|
806
|
-
stderrBuffer = next;
|
|
807
|
-
}, (value) => {
|
|
808
|
-
stderr += value;
|
|
809
|
-
});
|
|
810
|
-
return;
|
|
811
|
-
}
|
|
812
|
-
handleChunk(parsed.text, stdoutBuffer, (next) => {
|
|
813
|
-
stdoutBuffer = next;
|
|
814
|
-
}, (value) => {
|
|
815
|
-
stdout += value;
|
|
816
|
-
});
|
|
817
|
-
return;
|
|
818
|
-
}
|
|
819
|
-
if (parsed.kind === "ignore") {
|
|
820
|
-
return;
|
|
821
|
-
}
|
|
822
|
-
handleChunk(data, stdoutBuffer, (next) => {
|
|
823
|
-
stdoutBuffer = next;
|
|
824
|
-
}, (value) => {
|
|
825
|
-
stdout += value;
|
|
826
|
-
});
|
|
827
|
-
};
|
|
828
|
-
const onMessage = (event) => {
|
|
829
|
-
const data = event.data;
|
|
830
|
-
if (typeof data === "string") {
|
|
831
|
-
handleText(data);
|
|
832
|
-
return;
|
|
833
|
-
}
|
|
834
|
-
if (data instanceof ArrayBuffer) {
|
|
835
|
-
handleBinary(new Uint8Array(data));
|
|
836
|
-
return;
|
|
837
|
-
}
|
|
838
|
-
if (data instanceof Uint8Array) {
|
|
839
|
-
handleBinary(data);
|
|
840
|
-
return;
|
|
841
|
-
}
|
|
842
|
-
if (typeof Blob !== "undefined" && data instanceof Blob) {
|
|
843
|
-
data
|
|
844
|
-
.arrayBuffer()
|
|
845
|
-
.then((buffer) => handleBinary(new Uint8Array(buffer)))
|
|
846
|
-
.catch(() => { });
|
|
847
|
-
}
|
|
848
|
-
};
|
|
849
|
-
const finish = async (code) => {
|
|
850
|
-
if (resolved)
|
|
851
|
-
return;
|
|
852
|
-
resolved = true;
|
|
853
|
-
clearTimers();
|
|
854
|
-
ws.removeEventListener("message", onMessage);
|
|
855
|
-
if (stdoutBuffer) {
|
|
856
|
-
handleLine(stdoutBuffer);
|
|
857
|
-
}
|
|
858
|
-
if (stderrBuffer) {
|
|
859
|
-
handleLine(stderrBuffer);
|
|
860
|
-
}
|
|
861
|
-
await pendingStateChange.catch(() => { });
|
|
862
|
-
if (socketErrorMessage && !stderr.includes(socketErrorMessage)) {
|
|
863
|
-
stderr += `${socketErrorMessage}\n`;
|
|
864
|
-
}
|
|
865
|
-
resolve({
|
|
866
|
-
stdout,
|
|
867
|
-
stderr,
|
|
868
|
-
exitCode: code,
|
|
869
|
-
threadId,
|
|
870
|
-
execSessionId: resolvedExecSessionId,
|
|
871
|
-
});
|
|
872
|
-
};
|
|
873
|
-
startKeepalive();
|
|
874
|
-
scheduleInactivityTimeout();
|
|
875
|
-
ws.addEventListener("message", onMessage);
|
|
876
|
-
ws.addEventListener("close", () => {
|
|
877
|
-
void finish(exitCode);
|
|
878
|
-
});
|
|
879
|
-
ws.addEventListener("error", (event) => {
|
|
880
|
-
const message = event.data instanceof Error
|
|
881
|
-
? event.data.message
|
|
882
|
-
: typeof event.data === "string"
|
|
883
|
-
? event.data
|
|
884
|
-
: null;
|
|
885
|
-
if (message && message.trim().length > 0) {
|
|
886
|
-
socketErrorMessage = message.trim();
|
|
887
|
-
}
|
|
888
|
-
void finish(exitCode);
|
|
889
|
-
});
|
|
890
|
-
});
|
|
891
|
-
const runRemoteCodexExecDirect = async ({ client, spriteAlias, cmd, onProgress, }) => {
|
|
892
|
-
const result = await client.exec(spriteAlias, cmd, {
|
|
893
|
-
timeoutMs: 20 * 60 * 1000,
|
|
894
|
-
});
|
|
895
|
-
const state = { threadId: null, lastProgressKey: null };
|
|
896
|
-
const inspectOutput = (text) => {
|
|
897
|
-
let buffer = text;
|
|
898
|
-
let idx = buffer.indexOf("\n");
|
|
899
|
-
while (idx !== -1) {
|
|
900
|
-
handleCodexProgressLine({
|
|
901
|
-
line: buffer.slice(0, idx),
|
|
902
|
-
state,
|
|
903
|
-
...(onProgress ? { onProgress } : {}),
|
|
904
|
-
});
|
|
905
|
-
buffer = buffer.slice(idx + 1);
|
|
906
|
-
idx = buffer.indexOf("\n");
|
|
907
|
-
}
|
|
908
|
-
if (buffer.length > 0) {
|
|
909
|
-
handleCodexProgressLine({
|
|
910
|
-
line: buffer,
|
|
911
|
-
state,
|
|
912
|
-
...(onProgress ? { onProgress } : {}),
|
|
913
|
-
});
|
|
914
|
-
}
|
|
915
|
-
};
|
|
916
|
-
inspectOutput(result.stdout);
|
|
917
|
-
inspectOutput(result.stderr);
|
|
918
|
-
return {
|
|
919
|
-
stdout: result.stdout,
|
|
920
|
-
stderr: result.stderr,
|
|
921
|
-
exitCode: result.exitCode,
|
|
922
|
-
threadId: state.threadId,
|
|
923
|
-
execSessionId: null,
|
|
924
|
-
};
|
|
925
|
-
};
|
|
926
|
-
export { buildEntrypointsBlock, buildEnsureRemoteCodexScript, buildRemoteApplyPrompt, ensureRemoteCodexInstalled, handleCodexProgressLine, isRemoteCodexLoggedIn, openBrowser, runRemoteCodexExecDirect, runRemoteCodexExec, runRemoteCodexLogin, renderRemoteApplyPrompt, renderRemoteApplyPromptFromTemplate, };
|
|
927
|
-
//# sourceMappingURL=remote.js.map
|