@boxes-dev/dvb-runtime 1.0.189 → 1.0.190

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/dvb.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  "use strict";
3
- !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d891e41c-960d-5274-8d0e-b6e180994258")}catch(e){}}();
3
+ !function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="c9ef4017-000a-5236-919c-97a9c959aa9d")}catch(e){}}();
4
4
 
5
5
  var __create = Object.create;
6
6
  var __defProp = Object.defineProperty;
@@ -88688,8 +88688,8 @@ var init_otel = __esm({
88688
88688
  return trimmed && trimmed.length > 0 ? trimmed : void 0;
88689
88689
  };
88690
88690
  readBuildMetadata = () => {
88691
- const rawPackageVersion = "1.0.189";
88692
- const rawGitSha = "1ace2775538b3d0be8520ebddb5323148f994dd2";
88691
+ const rawPackageVersion = "1.0.190";
88692
+ const rawGitSha = "b2478e7e5aad4b1d4007d5c2b0484a52e268abf3";
88693
88693
  const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
88694
88694
  const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
88695
88695
  return { packageVersion, gitSha };
@@ -120881,9 +120881,9 @@ var init_sentry = __esm({
120881
120881
  sentryEnabled = false;
120882
120882
  uncaughtExceptionMonitorInstalled = false;
120883
120883
  readBuildMetadata2 = () => {
120884
- const rawPackageVersion = "1.0.189";
120885
- const rawGitSha = "1ace2775538b3d0be8520ebddb5323148f994dd2";
120886
- const rawSentryRelease = "boxes-dev-dvb@1.0.189+1ace2775538b3d0be8520ebddb5323148f994dd2";
120884
+ const rawPackageVersion = "1.0.190";
120885
+ const rawGitSha = "b2478e7e5aad4b1d4007d5c2b0484a52e268abf3";
120886
+ const rawSentryRelease = "boxes-dev-dvb@1.0.190+b2478e7e5aad4b1d4007d5c2b0484a52e268abf3";
120887
120887
  const packageVersion = typeof rawPackageVersion === "string" ? rawPackageVersion : void 0;
120888
120888
  const gitSha = typeof rawGitSha === "string" ? rawGitSha : void 0;
120889
120889
  const sentryRelease = typeof rawSentryRelease === "string" ? rawSentryRelease : void 0;
@@ -124880,7 +124880,7 @@ var init_packageVersion = __esm({
124880
124880
  return import_node_path8.default.join(process.cwd(), "dvb");
124881
124881
  };
124882
124882
  readEmbeddedPackageVersion = () => {
124883
- const raw = "1.0.189";
124883
+ const raw = "1.0.190";
124884
124884
  return trimVersion(raw);
124885
124885
  };
124886
124886
  readNearestPackageMetadata = (basePath) => {
@@ -215309,7 +215309,7 @@ var init_prompts = __esm({
215309
215309
  });
215310
215310
 
215311
215311
  // src/devbox/commands/init/codex/events.ts
215312
- var stripAnsi2, extractBoldText, normalizeProgressMessage, toRecord, extractTodoListProgress, extractProgressFromJsonLine, extractThreadIdFromJsonLine;
215312
+ var stripAnsi2, extractBoldText, normalizeProgressMessage, toRecord, stripShellWrapper, shortenCommand, summarizeCommandExecution, extractCommandExecutionProgress, extractTodoListProgress, extractProgressFromJsonLine, extractThreadIdFromJsonLine, extractTurnFailureFromJsonLine;
215313
215313
  var init_events = __esm({
215314
215314
  "src/devbox/commands/init/codex/events.ts"() {
215315
215315
  "use strict";
@@ -215330,6 +215330,85 @@ var init_events = __esm({
215330
215330
  return normalized;
215331
215331
  };
215332
215332
  toRecord = (value) => typeof value === "object" && value !== null ? value : null;
215333
+ stripShellWrapper = (command) => {
215334
+ const trimmed = command.trim();
215335
+ const shellMatch = trimmed.match(/^\/bin\/(?:bash|zsh|sh)\s+-lc\s+([\s\S]+)$/);
215336
+ const unwrapped = shellMatch?.[1]?.trim() ?? trimmed;
215337
+ if (unwrapped.startsWith("'") && unwrapped.endsWith("'") || unwrapped.startsWith('"') && unwrapped.endsWith('"')) {
215338
+ return unwrapped.slice(1, -1).trim();
215339
+ }
215340
+ return unwrapped;
215341
+ };
215342
+ shortenCommand = (command) => {
215343
+ const normalized = stripShellWrapper(command).replace(/\\/g, "").replace(/["'`]/g, "").replace(/[\[\]{}]/g, "").replace(/\s+/g, " ").trim();
215344
+ if (normalized.length <= 72) return normalized;
215345
+ return `${normalized.slice(0, 69).trimEnd()}...`;
215346
+ };
215347
+ summarizeCommandExecution = (command) => {
215348
+ const inner = stripShellWrapper(command);
215349
+ const lower = inner.toLowerCase();
215350
+ if (/\bls -la\b/.test(lower)) return "list repo root";
215351
+ if (/\bgit status\b/.test(lower)) return "check git status";
215352
+ if (/\bgit ls-files\b/.test(lower)) return "list ignored and untracked files";
215353
+ if (/\bcat \.gitignore\b/.test(lower)) return "read .gitignore";
215354
+ if (/\bcat package\.json\b/.test(lower)) return "read package.json";
215355
+ if (/\bsed -n .*package\.json\b/.test(lower)) return "read package.json";
215356
+ if (/\bcat readme\.md\b/.test(lower) || /\bsed -n .*readme\.md\b/.test(lower)) {
215357
+ return "read README.md";
215358
+ }
215359
+ if (/\bsed -n .*\.gitignore\b/.test(lower)) return "read .gitignore";
215360
+ if (/\bsed -n .*vite\.config\.ts\b/.test(lower)) return "read vite.config.ts";
215361
+ if (/\bnode --version\b/.test(lower)) return "check node version";
215362
+ if (/\bnpm --version\b/.test(lower)) return "check npm version";
215363
+ if (/\bnpm run\b/.test(lower)) return "list npm scripts";
215364
+ if (/\bjust --list\b/.test(lower)) return "list just recipes";
215365
+ if (/\bmake -qp\b/.test(lower) || /\bmakefile\b/.test(lower)) {
215366
+ return "inspect Makefile targets";
215367
+ }
215368
+ if (/\bfind\b/.test(lower) && /\.env/.test(lower)) return "scan env files";
215369
+ if (/\bfind\b/.test(lower) && /readme|contributing|justfile|makefile|package\.json/.test(lower)) {
215370
+ return "list docs and startup files";
215371
+ }
215372
+ if (/\bfind convex\b/.test(lower)) return "list Convex files";
215373
+ if (/\brg\b/.test(lower) && /vite_\|convex_\|dotenv/.test(lower)) {
215374
+ return "scan env var usage";
215375
+ }
215376
+ if (/\brg\b/.test(lower) && /artifact\|cert\|key\|token\|config\|credential\|cache/.test(lower)) {
215377
+ return "scan docs for required artifacts";
215378
+ }
215379
+ if (/\brg\b/.test(lower) && /just\|make\|task\|npm\|pnpm\|yarn\|bun\|docker\|wrangler\|fly\|convex\|codex\|sprite/.test(
215380
+ lower
215381
+ )) {
215382
+ return "scan docs for required tooling";
215383
+ }
215384
+ if (/\brg\b/.test(lower) && /dev\|start\|serve\|up\|run\|watch\|worker\|daemon\|api\|web\|frontend\|backend/.test(
215385
+ lower
215386
+ )) {
215387
+ return "scan docs for startup commands";
215388
+ }
215389
+ if (/\brg\b/.test(lower)) return "scan repo text";
215390
+ if (/\bfind\b/.test(lower)) return "scan candidate files";
215391
+ return shortenCommand(inner);
215392
+ };
215393
+ extractCommandExecutionProgress = (record, item) => {
215394
+ if (item.type !== "command_execution" || typeof item.command !== "string") {
215395
+ return null;
215396
+ }
215397
+ const summary = summarizeCommandExecution(item.command);
215398
+ const exitCode = typeof item.exit_code === "number" ? item.exit_code : null;
215399
+ const recordType = typeof record.type === "string" ? record.type : null;
215400
+ const status = typeof item.status === "string" ? item.status : null;
215401
+ if (recordType === "item.completed" || status === "completed") {
215402
+ if (exitCode !== null && exitCode !== 0) {
215403
+ return normalizeProgressMessage(`failed ${summary} (exit ${exitCode})`);
215404
+ }
215405
+ return normalizeProgressMessage(`done ${summary}`);
215406
+ }
215407
+ if (recordType === "item.started" || status === "in_progress") {
215408
+ return normalizeProgressMessage(`run ${summary}`);
215409
+ }
215410
+ return null;
215411
+ };
215333
215412
  extractTodoListProgress = (item) => {
215334
215413
  if (item.type !== "todo_list" || !Array.isArray(item.items)) return null;
215335
215414
  const entries = item.items.map((entry) => toRecord(entry)).filter((entry) => entry !== null);
@@ -215368,6 +215447,8 @@ var init_events = __esm({
215368
215447
  extractBoldText(String(item.text ?? "")) ?? String(item.text ?? "")
215369
215448
  );
215370
215449
  }
215450
+ const commandProgress = extractCommandExecutionProgress(record, item);
215451
+ if (commandProgress) return commandProgress;
215371
215452
  const todoProgress = extractTodoListProgress(item);
215372
215453
  if (todoProgress) return todoProgress;
215373
215454
  return normalizeProgressMessage(
@@ -215388,6 +215469,26 @@ var init_events = __esm({
215388
215469
  const threadId2 = record.thread_id;
215389
215470
  return typeof threadId2 === "string" && threadId2.length > 0 ? threadId2 : null;
215390
215471
  };
215472
+ extractTurnFailureFromJsonLine = (line) => {
215473
+ const trimmed = line.trim();
215474
+ if (!trimmed.startsWith("{")) return null;
215475
+ let parsed;
215476
+ try {
215477
+ parsed = JSON.parse(trimmed);
215478
+ } catch {
215479
+ return null;
215480
+ }
215481
+ const record = toRecord(parsed);
215482
+ if (!record || record.type !== "turn.failed") return null;
215483
+ const error2 = toRecord(record.error);
215484
+ if (typeof error2?.message === "string" && error2.message.trim().length > 0) {
215485
+ return error2.message.trim();
215486
+ }
215487
+ if (typeof record.message === "string" && record.message.trim().length > 0) {
215488
+ return record.message.trim();
215489
+ }
215490
+ return "Codex turn failed.";
215491
+ };
215391
215492
  }
215392
215493
  });
215393
215494
 
@@ -216562,7 +216663,7 @@ ${bottom}
216562
216663
  });
216563
216664
 
216564
216665
  // src/devbox/commands/init/codex/local.ts
216565
- var import_node_child_process12, import_node_fs10, import_promises25, import_node_os15, import_node_path29, isRelayUsageLimitExceeded, isRelayForbidden, isRelayMissingOpenAiProxyConfiguration, CODEX_REQUEST_URL_REGEX, extractRequestUrl, isStreamDisconnected, isLoopbackRelayUrl, buildRetryPrompt, formatCodexRetryProgress, runCodexExec, runLocalSetupEnvSecretsScan, runLocalSetupExternalScan, runLocalSetupExtraArtifactsScan, runLocalServicesScan, toPosixPath, toRepoRelativePath, countSecretVars, buildEnvFileHint, buildExternalDependencyLabel, promptForPlanApproval, promptForServicesApproval;
216666
+ var import_node_child_process12, import_node_fs10, import_promises25, import_node_os15, import_node_path29, isRelayUsageLimitExceeded, isRelayForbidden, isRelayMissingOpenAiProxyConfiguration, CODEX_REQUEST_URL_REGEX, extractRequestUrl, isStreamDisconnected, isLoopbackRelayUrl, LOOPBACK_RELAY_HEALTH_TIMEOUT_MS, loopbackRelayHealthChecks, buildRetryPrompt, formatCodexRetryProgress, describeLoopbackRelayHealthError, createLoopbackRelayHealthError, ensureLoopbackRelayHealthy, classifyCodexExecFailure, runCodexExec, runLocalSetupEnvSecretsScan, runLocalSetupExternalScan, runLocalSetupExtraArtifactsScan, runLocalServicesScan, toPosixPath, toRepoRelativePath, countSecretVars, buildEnvFileHint, buildExternalDependencyLabel, promptForPlanApproval, promptForServicesApproval;
216566
216667
  var init_local = __esm({
216567
216668
  "src/devbox/commands/init/codex/local.ts"() {
216568
216669
  "use strict";
@@ -216598,6 +216699,8 @@ var init_local = __esm({
216598
216699
  return false;
216599
216700
  }
216600
216701
  };
216702
+ LOOPBACK_RELAY_HEALTH_TIMEOUT_MS = 3e3;
216703
+ loopbackRelayHealthChecks = /* @__PURE__ */ new Map();
216601
216704
  buildRetryPrompt = (basePrompt, retryFeedback) => retryFeedback ? [
216602
216705
  basePrompt,
216603
216706
  "",
@@ -216618,6 +216721,147 @@ var init_local = __esm({
216618
216721
  const mode = sessionId ? "continuing existing session" : "starting a fresh session";
216619
216722
  return `retry ${nextAttempt}/${maxAttempts} in ${delaySeconds}s (${mode}): ${formatRetryReason(reason)}`;
216620
216723
  };
216724
+ describeLoopbackRelayHealthError = (error2) => {
216725
+ if (error2 instanceof DOMException && error2.name === "TimeoutError") {
216726
+ return "timed out";
216727
+ }
216728
+ const code2 = error2?.code ?? error2?.cause?.code;
216729
+ if (code2 === "ECONNREFUSED") return "was refused";
216730
+ if (code2 === "ENOTFOUND" || code2 === "EAI_AGAIN" || code2 === "ETIMEDOUT") {
216731
+ return "was unreachable";
216732
+ }
216733
+ return error2 instanceof Error ? error2.message : String(error2);
216734
+ };
216735
+ createLoopbackRelayHealthError = ({
216736
+ healthUrl,
216737
+ detail
216738
+ }) => new Error(
216739
+ `Codex scan failed: local relay health check ${detail} at ${healthUrl}. Start or restart it with \`just dev\` and retry with \`dvb init --resume\`.`
216740
+ );
216741
+ ensureLoopbackRelayHealthy = async (relayBaseUrl) => {
216742
+ if (!isLoopbackRelayUrl(relayBaseUrl)) return;
216743
+ const normalizedRelayBaseUrl = new URL(relayBaseUrl).toString();
216744
+ const inFlight = loopbackRelayHealthChecks.get(normalizedRelayBaseUrl);
216745
+ if (inFlight) {
216746
+ return await inFlight;
216747
+ }
216748
+ const healthUrl = new URL("/health", normalizedRelayBaseUrl).toString();
216749
+ const check = (async () => {
216750
+ try {
216751
+ const response = await fetch(healthUrl, {
216752
+ method: "GET",
216753
+ signal: AbortSignal.timeout(LOOPBACK_RELAY_HEALTH_TIMEOUT_MS)
216754
+ });
216755
+ if (!response.ok) {
216756
+ throw createLoopbackRelayHealthError({
216757
+ healthUrl,
216758
+ detail: `returned HTTP ${response.status}`
216759
+ });
216760
+ }
216761
+ } catch (error2) {
216762
+ if (error2 instanceof Error && error2.message.includes("local relay health check")) {
216763
+ throw error2;
216764
+ }
216765
+ throw createLoopbackRelayHealthError({
216766
+ healthUrl,
216767
+ detail: describeLoopbackRelayHealthError(error2)
216768
+ });
216769
+ }
216770
+ })();
216771
+ loopbackRelayHealthChecks.set(normalizedRelayBaseUrl, check);
216772
+ try {
216773
+ await check;
216774
+ } catch (error2) {
216775
+ if (loopbackRelayHealthChecks.get(normalizedRelayBaseUrl) === check) {
216776
+ loopbackRelayHealthChecks.delete(normalizedRelayBaseUrl);
216777
+ }
216778
+ throw error2;
216779
+ }
216780
+ };
216781
+ classifyCodexExecFailure = ({
216782
+ combinedOutput,
216783
+ detail,
216784
+ exitCode,
216785
+ turnFailedMessage
216786
+ }) => {
216787
+ const failureOutput = turnFailedMessage ? `${combinedOutput}
216788
+ ${turnFailedMessage}` : combinedOutput;
216789
+ if (isRelayUsageLimitExceeded(failureOutput)) {
216790
+ return {
216791
+ error: new Error(
216792
+ "Codex scan failed: OpenAI usage limit exceeded. Run `dvb setup --codex-auth byo` to use your own Codex auth, then retry with `dvb init --resume`."
216793
+ ),
216794
+ retryable: false
216795
+ };
216796
+ }
216797
+ if (isRelayForbidden(failureOutput)) {
216798
+ return {
216799
+ error: new Error(
216800
+ "Codex scan failed: relay proxy returned 403 forbidden. If you're using a dev/local relay config, keep local scans on that relay or run `dvb setup --codex-auth byo`, then retry with `dvb init --resume`."
216801
+ ),
216802
+ retryable: false
216803
+ };
216804
+ }
216805
+ if (isRelayMissingOpenAiProxyConfiguration(failureOutput)) {
216806
+ return {
216807
+ error: new Error(
216808
+ "Codex scan failed: relay proxy is missing OPENAI_API_KEY configuration. Re-run `just dev` so the relay tunnel deploy includes OPENAI_API_KEY, then retry with `dvb init --resume`."
216809
+ ),
216810
+ retryable: false
216811
+ };
216812
+ }
216813
+ if (isStreamDisconnected(failureOutput)) {
216814
+ const requestUrl = extractRequestUrl(failureOutput);
216815
+ if (requestUrl && isLoopbackRelayUrl(requestUrl)) {
216816
+ return {
216817
+ error: new Error(
216818
+ `Codex scan failed: local relay is unreachable at ${requestUrl}. This dev CLI is configured for a local relay; start it with \`just dev\` and retry with \`dvb init --resume\`.`
216819
+ ),
216820
+ retryable: false
216821
+ };
216822
+ }
216823
+ const requestTarget = requestUrl ?? "relay /v1/responses endpoint";
216824
+ return {
216825
+ error: new Error(
216826
+ `Codex scan failed: transport disconnected while calling ${requestTarget}. Check relay health/auth and retry with \`dvb init --resume\`.`
216827
+ ),
216828
+ retryable: true
216829
+ };
216830
+ }
216831
+ if (/no last agent message/i.test(failureOutput)) {
216832
+ return {
216833
+ error: new Error(
216834
+ "Codex scan failed: Codex session ended without a final response. Retry with `dvb init --resume`."
216835
+ ),
216836
+ retryable: true
216837
+ };
216838
+ }
216839
+ if (turnFailedMessage) {
216840
+ const normalized = turnFailedMessage.trim();
216841
+ return {
216842
+ error: new Error(
216843
+ normalized ? `Codex scan failed: ${normalized}` : "Codex scan failed: Codex turn failed."
216844
+ ),
216845
+ retryable: true
216846
+ };
216847
+ }
216848
+ if (exitCode === null) {
216849
+ return {
216850
+ error: new Error(
216851
+ "Codex scan failed: Codex session ended before reporting an exit status. Retry with `dvb init --resume`."
216852
+ ),
216853
+ retryable: true
216854
+ };
216855
+ }
216856
+ if (exitCode === 0) {
216857
+ return null;
216858
+ }
216859
+ const suffix = detail ? `: ${detail}` : "";
216860
+ return {
216861
+ error: new Error(`codex exec failed (exit ${exitCode})${suffix}`),
216862
+ retryable: false
216863
+ };
216864
+ };
216621
216865
  runCodexExec = async (cwd, commandArgs, onProgress, logOptions = {}) => {
216622
216866
  const {
216623
216867
  stdoutLogPath,
@@ -216680,6 +216924,9 @@ var init_local = __esm({
216680
216924
  await new Promise((resolve2) => stream.end(() => resolve2()));
216681
216925
  };
216682
216926
  try {
216927
+ if (proxyOptions) {
216928
+ await ensureLoopbackRelayHealthy(proxyOptions.relayBaseUrl);
216929
+ }
216683
216930
  let resumeThreadId = commandArgs.resumeThreadId;
216684
216931
  let prompt = commandArgs.prompt;
216685
216932
  const runAttempt = async (attemptArgs, attemptResumeThreadId) => await new Promise((resolve2, reject) => {
@@ -216698,6 +216945,7 @@ var init_local = __esm({
216698
216945
  let stderrBuffer = "";
216699
216946
  let lastProgress = null;
216700
216947
  let threadId2 = null;
216948
+ let turnFailedMessage = null;
216701
216949
  const handleLine = (line) => {
216702
216950
  const clean = stripAnsi2(line);
216703
216951
  if (!threadId2) {
@@ -216706,6 +216954,10 @@ var init_local = __esm({
216706
216954
  threadId2 = parsedThreadId;
216707
216955
  }
216708
216956
  }
216957
+ const parsedTurnFailure = extractTurnFailureFromJsonLine(clean);
216958
+ if (parsedTurnFailure && !turnFailedMessage) {
216959
+ turnFailedMessage = parsedTurnFailure;
216960
+ }
216709
216961
  if (!onProgress) return;
216710
216962
  const parsed = extractProgressFromJsonLine(clean);
216711
216963
  if (parsed) {
@@ -216749,79 +217001,25 @@ var init_local = __esm({
216749
217001
  child.on("close", (code2) => {
216750
217002
  if (stdoutBuffer) handleLine(stdoutBuffer);
216751
217003
  if (stderrBuffer) handleLine(stderrBuffer);
216752
- if (code2 === 0) {
216753
- resolve2({ threadId: threadId2 ?? attemptResumeThreadId });
216754
- return;
216755
- }
216756
217004
  const combinedOutput = `${stderr}
216757
217005
  ${stdout}`;
216758
217006
  const detail = stderr.trim() || stdout.trim();
216759
217007
  const sessionId = threadId2 ?? attemptResumeThreadId;
216760
- if (isRelayUsageLimitExceeded(combinedOutput)) {
216761
- reject(
216762
- new Error(
216763
- "Codex scan failed: OpenAI usage limit exceeded. Run `dvb setup --codex-auth byo` to use your own Codex auth, then retry with `dvb init --resume`."
216764
- )
216765
- );
216766
- return;
216767
- }
216768
- if (isRelayForbidden(combinedOutput)) {
216769
- reject(
216770
- new Error(
216771
- "Codex scan failed: relay proxy returned 403 forbidden. If you're using a dev/local relay config, keep local scans on that relay or run `dvb setup --codex-auth byo`, then retry with `dvb init --resume`."
216772
- )
216773
- );
216774
- return;
216775
- }
216776
- if (isRelayMissingOpenAiProxyConfiguration(combinedOutput)) {
216777
- reject(
216778
- new Error(
216779
- "Codex scan failed: relay proxy is missing OPENAI_API_KEY configuration. Re-run `just dev` so the relay tunnel deploy includes OPENAI_API_KEY, then retry with `dvb init --resume`."
216780
- )
216781
- );
216782
- return;
216783
- }
216784
- if (isStreamDisconnected(combinedOutput)) {
216785
- const requestUrl = extractRequestUrl(combinedOutput);
216786
- if (requestUrl && isLoopbackRelayUrl(requestUrl)) {
216787
- reject(
216788
- new Error(
216789
- `Codex scan failed: local relay is unreachable at ${requestUrl}. This dev CLI is configured for a local relay; start it with \`just dev\` and retry with \`dvb init --resume\`.`
216790
- )
216791
- );
216792
- return;
216793
- }
216794
- const requestTarget = requestUrl ?? "relay /v1/responses endpoint";
216795
- reject(
216796
- new RetryableCodexExecError(
216797
- `Codex scan failed: transport disconnected while calling ${requestTarget}. Check relay health/auth and retry with \`dvb init --resume\`.`,
216798
- sessionId
216799
- )
216800
- );
216801
- return;
216802
- }
216803
- if (/no last agent message/i.test(combinedOutput)) {
216804
- reject(
216805
- new RetryableCodexExecError(
216806
- "Codex scan failed: Codex session ended without a final response. Retry with `dvb init --resume`.",
216807
- sessionId
216808
- )
216809
- );
217008
+ const failure = classifyCodexExecFailure({
217009
+ combinedOutput,
217010
+ detail,
217011
+ exitCode: code2,
217012
+ turnFailedMessage
217013
+ });
217014
+ if (!failure) {
217015
+ resolve2({ threadId: sessionId });
216810
217016
  return;
216811
217017
  }
216812
- if (code2 === null) {
216813
- reject(
216814
- new RetryableCodexExecError(
216815
- "Codex scan failed: Codex session ended before reporting an exit status. Retry with `dvb init --resume`.",
216816
- sessionId
216817
- )
216818
- );
217018
+ if (failure.retryable) {
217019
+ reject(new RetryableCodexExecError(failure.error.message, sessionId));
216819
217020
  return;
216820
217021
  }
216821
- const suffix = detail ? `: ${detail}` : "";
216822
- reject(
216823
- new Error(`codex exec failed (exit ${code2 ?? "unknown"})${suffix}`)
216824
- );
217022
+ reject(failure.error);
216825
217023
  });
216826
217024
  });
216827
217025
  for (let attempt = 1; attempt <= DEFAULT_CODEX_EXEC_MAX_ATTEMPTS; attempt += 1) {
@@ -229873,4 +230071,4 @@ smol-toml/dist/index.js:
229873
230071
  */
229874
230072
  //# sourceMappingURL=dvb.cjs.map
229875
230073
 
229876
- //# debugId=d891e41c-960d-5274-8d0e-b6e180994258
230074
+ //# debugId=c9ef4017-000a-5236-919c-97a9c959aa9d