@boxes-dev/dvb-runtime 1.0.186 → 1.0.188

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.
Files changed (30) hide show
  1. package/dist/bin/dvb.cjs +249 -156
  2. package/dist/bin/dvb.cjs.map +1 -1
  3. package/dist/bin/dvbd.cjs +6 -6
  4. package/dist/devbox/commands/init/codex/events.d.ts.map +1 -1
  5. package/dist/devbox/commands/init/codex/events.js +26 -1
  6. package/dist/devbox/commands/init/codex/events.js.map +1 -1
  7. package/dist/devbox/commands/init/codex/index.d.ts.map +1 -1
  8. package/dist/devbox/commands/init/codex/index.js +4 -2
  9. package/dist/devbox/commands/init/codex/index.js.map +1 -1
  10. package/dist/devbox/commands/init/codex/local.d.ts.map +1 -1
  11. package/dist/devbox/commands/init/codex/local.js +43 -91
  12. package/dist/devbox/commands/init/codex/local.js.map +1 -1
  13. package/dist/devbox/commands/init/codex/localExecArgs.d.ts +18 -0
  14. package/dist/devbox/commands/init/codex/localExecArgs.d.ts.map +1 -0
  15. package/dist/devbox/commands/init/codex/localExecArgs.js +29 -0
  16. package/dist/devbox/commands/init/codex/localExecArgs.js.map +1 -0
  17. package/dist/devbox/commands/init/codex/retry.d.ts +1 -0
  18. package/dist/devbox/commands/init/codex/retry.d.ts.map +1 -1
  19. package/dist/devbox/commands/init/codex/retry.js.map +1 -1
  20. package/dist/devbox/commands/init/codex/scanStatus.d.ts +4 -0
  21. package/dist/devbox/commands/init/codex/scanStatus.d.ts.map +1 -0
  22. package/dist/devbox/commands/init/codex/scanStatus.js +26 -0
  23. package/dist/devbox/commands/init/codex/scanStatus.js.map +1 -0
  24. package/dist/devbox/commands/init/provider/modal.d.ts.map +1 -1
  25. package/dist/devbox/commands/init/provider/modal.js +21 -12
  26. package/dist/devbox/commands/init/provider/modal.js.map +1 -1
  27. package/dist/devbox/commands/init/setupPlanFlow.d.ts.map +1 -1
  28. package/dist/devbox/commands/init/setupPlanFlow.js +11 -2
  29. package/dist/devbox/commands/init/setupPlanFlow.js.map +1 -1
  30. package/package.json +2 -2
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]="dab189dc-59c8-54af-b40c-b5ea0eb33006")}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]="a0a101a2-0ead-5d3d-8af3-ec4f67fbac2d")}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.186";
88692
- const rawGitSha = "f12e4dee5a3533b641109fa484a2599f48441723";
88691
+ const rawPackageVersion = "1.0.188";
88692
+ const rawGitSha = "184142c7c842dd6273dcfc369fbe788ce96777cc";
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.186";
120885
- const rawGitSha = "f12e4dee5a3533b641109fa484a2599f48441723";
120886
- const rawSentryRelease = "boxes-dev-dvb@1.0.186+f12e4dee5a3533b641109fa484a2599f48441723";
120884
+ const rawPackageVersion = "1.0.188";
120885
+ const rawGitSha = "184142c7c842dd6273dcfc369fbe788ce96777cc";
120886
+ const rawSentryRelease = "boxes-dev-dvb@1.0.188+184142c7c842dd6273dcfc369fbe788ce96777cc";
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.186";
124883
+ const raw = "1.0.188";
124884
124884
  return trimVersion(raw);
124885
124885
  };
124886
124886
  readNearestPackageMetadata = (basePath) => {
@@ -215305,7 +215305,7 @@ var init_prompts = __esm({
215305
215305
  });
215306
215306
 
215307
215307
  // src/devbox/commands/init/codex/events.ts
215308
- var stripAnsi2, extractBoldText, normalizeProgressMessage, toRecord, extractProgressFromJsonLine, extractThreadIdFromJsonLine;
215308
+ var stripAnsi2, extractBoldText, normalizeProgressMessage, toRecord, extractTodoListProgress, extractProgressFromJsonLine, extractThreadIdFromJsonLine;
215309
215309
  var init_events = __esm({
215310
215310
  "src/devbox/commands/init/codex/events.ts"() {
215311
215311
  "use strict";
@@ -215326,6 +215326,18 @@ var init_events = __esm({
215326
215326
  return normalized;
215327
215327
  };
215328
215328
  toRecord = (value) => typeof value === "object" && value !== null ? value : null;
215329
+ extractTodoListProgress = (item) => {
215330
+ if (item.type !== "todo_list" || !Array.isArray(item.items)) return null;
215331
+ const entries = item.items.map((entry) => toRecord(entry)).filter((entry) => entry !== null);
215332
+ if (entries.length === 0) return null;
215333
+ const completedCount = entries.filter(
215334
+ (entry) => entry.completed === true
215335
+ ).length;
215336
+ const pending = entries.find((entry) => entry.completed !== true) ?? entries.at(-1) ?? null;
215337
+ const pendingText = pending && typeof pending.text === "string" ? pending.text : null;
215338
+ const summary = pendingText ? `${completedCount}/${entries.length} ${pendingText}` : `${completedCount}/${entries.length} todo items`;
215339
+ return normalizeProgressMessage(summary);
215340
+ };
215329
215341
  extractProgressFromJsonLine = (line) => {
215330
215342
  const trimmed = line.trim();
215331
215343
  if (!trimmed.startsWith("{")) return null;
@@ -215337,13 +215349,23 @@ var init_events = __esm({
215337
215349
  }
215338
215350
  const record = toRecord(parsed);
215339
215351
  if (!record) return null;
215352
+ if (record.type === "error" && typeof record.message === "string") {
215353
+ return normalizeProgressMessage(record.message);
215354
+ }
215340
215355
  if (record.type === "reasoning") {
215341
215356
  return normalizeProgressMessage(
215342
215357
  extractBoldText(String(record.text ?? "")) ?? String(record.text ?? "")
215343
215358
  );
215344
215359
  }
215345
215360
  const item = toRecord(record.item);
215346
- if (!item || item.type !== "reasoning") return null;
215361
+ if (!item) return null;
215362
+ if (item.type === "reasoning") {
215363
+ return normalizeProgressMessage(
215364
+ extractBoldText(String(item.text ?? "")) ?? String(item.text ?? "")
215365
+ );
215366
+ }
215367
+ const todoProgress = extractTodoListProgress(item);
215368
+ if (todoProgress) return todoProgress;
215347
215369
  return normalizeProgressMessage(
215348
215370
  extractBoldText(String(item.text ?? "")) ?? String(item.text ?? "")
215349
215371
  );
@@ -216324,6 +216346,75 @@ var init_retry = __esm({
216324
216346
  }
216325
216347
  });
216326
216348
 
216349
+ // src/devbox/commands/init/codex/localExecArgs.ts
216350
+ var buildCodexExecAttemptArgs, buildLocalStructuredOutputExecArgs;
216351
+ var init_localExecArgs = __esm({
216352
+ "src/devbox/commands/init/codex/localExecArgs.ts"() {
216353
+ "use strict";
216354
+ buildCodexExecAttemptArgs = ({
216355
+ initialArgs,
216356
+ resumeExecArgs,
216357
+ resumeSubcommandArgs,
216358
+ prompt,
216359
+ resumeThreadId
216360
+ }) => resumeThreadId ? [
216361
+ ...resumeExecArgs,
216362
+ "resume",
216363
+ ...resumeSubcommandArgs,
216364
+ resumeThreadId,
216365
+ prompt
216366
+ ] : [...initialArgs, prompt];
216367
+ buildLocalStructuredOutputExecArgs = ({
216368
+ schemaPath,
216369
+ outputPath
216370
+ }) => ({
216371
+ initialArgs: [
216372
+ "--json",
216373
+ "--sandbox",
216374
+ "workspace-write",
216375
+ "--output-schema",
216376
+ schemaPath,
216377
+ "-o",
216378
+ outputPath
216379
+ ],
216380
+ resumeExecArgs: [
216381
+ "--sandbox",
216382
+ "workspace-write",
216383
+ "--output-schema",
216384
+ schemaPath
216385
+ ],
216386
+ resumeSubcommandArgs: ["--json", "-o", outputPath]
216387
+ });
216388
+ }
216389
+ });
216390
+
216391
+ // src/devbox/commands/init/codex/scanStatus.ts
216392
+ var toRecord2, summarizeIncompleteScanResult, formatRetryReason;
216393
+ var init_scanStatus = __esm({
216394
+ "src/devbox/commands/init/codex/scanStatus.ts"() {
216395
+ "use strict";
216396
+ toRecord2 = (value) => typeof value === "object" && value !== null ? value : null;
216397
+ summarizeIncompleteScanResult = (value) => {
216398
+ const record = toRecord2(value);
216399
+ if (!record) return null;
216400
+ const parts = [];
216401
+ if (typeof record.scanFullyCompleted === "boolean") {
216402
+ parts.push(`scanFullyCompleted=${String(record.scanFullyCompleted)}`);
216403
+ }
216404
+ for (const [key, entry] of Object.entries(record)) {
216405
+ if (!Array.isArray(entry)) continue;
216406
+ parts.push(`${key}=${entry.length}`);
216407
+ }
216408
+ return parts.length > 0 ? parts.join(", ") : null;
216409
+ };
216410
+ formatRetryReason = (reason) => {
216411
+ const trimmed = reason.replace(/^Codex scan failed:\s*/i, "").trim();
216412
+ if (trimmed.length <= 120) return trimmed;
216413
+ return `${trimmed.slice(0, 117)}...`;
216414
+ };
216415
+ }
216416
+ });
216417
+
216327
216418
  // src/devbox/commands/init/clack.ts
216328
216419
  var import_node_util4, apply, wrapLine, DEFAULT_MULTISELECT_HELP, multiselectWithHelp;
216329
216420
  var init_clack = __esm({
@@ -216467,7 +216558,7 @@ ${bottom}
216467
216558
  });
216468
216559
 
216469
216560
  // src/devbox/commands/init/codex/local.ts
216470
- 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, parseCodexExecArgs, buildCodexExecArgs, formatCodexRetryProgress, runCodexExec, runLocalSetupEnvSecretsScan, runLocalSetupExternalScan, runLocalSetupExtraArtifactsScan, runLocalServicesScan, toPosixPath, toRepoRelativePath, countSecretVars, buildEnvFileHint, buildExternalDependencyLabel, promptForPlanApproval, promptForServicesApproval;
216561
+ 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;
216471
216562
  var init_local = __esm({
216472
216563
  "src/devbox/commands/init/codex/local.ts"() {
216473
216564
  "use strict";
@@ -216482,6 +216573,8 @@ var init_local = __esm({
216482
216573
  init_execConfig();
216483
216574
  init_events();
216484
216575
  init_retry();
216576
+ init_localExecArgs();
216577
+ init_scanStatus();
216485
216578
  init_clack();
216486
216579
  isRelayUsageLimitExceeded = (value) => /usage limit exceeded/i.test(value) && /(?:relay\.boxes\.dev\/v1\/responses|\/v1\/responses)/i.test(value);
216487
216580
  isRelayForbidden = (value) => /(unexpected status 403 Forbidden|403 Forbidden: forbidden)/i.test(value) && /\/v1\/responses/i.test(value);
@@ -216509,52 +216602,19 @@ var init_local = __esm({
216509
216602
  "",
216510
216603
  "Re-run the scan and return corrected JSON."
216511
216604
  ].filter((line) => line.length > 0).join("\n") : basePrompt;
216512
- parseCodexExecArgs = (args) => {
216513
- if (args.length === 0) {
216514
- throw new Error("Missing Codex exec prompt.");
216515
- }
216516
- if (args[0] === "resume") {
216517
- if (args.length < 4) {
216518
- throw new Error("Invalid Codex resume exec arguments.");
216519
- }
216520
- const prompt2 = args.at(-1);
216521
- const resumeThreadId = args.at(-2);
216522
- if (!prompt2 || !resumeThreadId) {
216523
- throw new Error("Invalid Codex resume exec arguments.");
216524
- }
216525
- return {
216526
- sharedArgs: args.slice(1, -2),
216527
- prompt: prompt2,
216528
- resumeThreadId
216529
- };
216530
- }
216531
- const prompt = args.at(-1);
216532
- if (!prompt) {
216533
- throw new Error("Missing Codex exec prompt.");
216534
- }
216535
- return {
216536
- sharedArgs: args.slice(0, -1),
216537
- prompt,
216538
- resumeThreadId: null
216539
- };
216540
- };
216541
- buildCodexExecArgs = ({
216542
- sharedArgs,
216543
- prompt,
216544
- resumeThreadId
216545
- }) => resumeThreadId ? [...sharedArgs, "resume", resumeThreadId, prompt] : [...sharedArgs, prompt];
216546
216605
  formatCodexRetryProgress = ({
216547
216606
  attempt,
216548
216607
  maxAttempts,
216549
216608
  delayMs,
216550
- sessionId
216609
+ sessionId,
216610
+ reason
216551
216611
  }) => {
216552
216612
  const nextAttempt = attempt + 1;
216553
216613
  const delaySeconds = Math.max(1, Math.ceil(delayMs / 1e3));
216554
216614
  const mode = sessionId ? "continuing existing session" : "starting a fresh session";
216555
- return `retry ${nextAttempt}/${maxAttempts} in ${delaySeconds}s (${mode})`;
216615
+ return `retry ${nextAttempt}/${maxAttempts} in ${delaySeconds}s (${mode}): ${formatRetryReason(reason)}`;
216556
216616
  };
216557
- runCodexExec = async (cwd, args, onProgress, logOptions = {}) => {
216617
+ runCodexExec = async (cwd, commandArgs, onProgress, logOptions = {}) => {
216558
216618
  const {
216559
216619
  stdoutLogPath,
216560
216620
  stderrLogPath,
@@ -216616,9 +216676,8 @@ var init_local = __esm({
216616
216676
  await new Promise((resolve2) => stream.end(() => resolve2()));
216617
216677
  };
216618
216678
  try {
216619
- const baseArgs = parseCodexExecArgs(args);
216620
- let resumeThreadId = baseArgs.resumeThreadId;
216621
- let prompt = baseArgs.prompt;
216679
+ let resumeThreadId = commandArgs.resumeThreadId;
216680
+ let prompt = commandArgs.prompt;
216622
216681
  const runAttempt = async (attemptArgs, attemptResumeThreadId) => await new Promise((resolve2, reject) => {
216623
216682
  const child = (0, import_node_child_process12.spawn)(
216624
216683
  "codex",
@@ -216762,8 +216821,8 @@ ${stdout}`;
216762
216821
  });
216763
216822
  });
216764
216823
  for (let attempt = 1; attempt <= DEFAULT_CODEX_EXEC_MAX_ATTEMPTS; attempt += 1) {
216765
- const attemptArgs = buildCodexExecArgs({
216766
- sharedArgs: baseArgs.sharedArgs,
216824
+ const attemptArgs = buildCodexExecAttemptArgs({
216825
+ ...commandArgs,
216767
216826
  prompt,
216768
216827
  resumeThreadId
216769
216828
  });
@@ -216779,10 +216838,11 @@ ${stdout}`;
216779
216838
  attempt,
216780
216839
  maxAttempts: DEFAULT_CODEX_EXEC_MAX_ATTEMPTS,
216781
216840
  delayMs,
216782
- sessionId: resumeThreadId
216841
+ sessionId: resumeThreadId,
216842
+ reason: error2.message
216783
216843
  });
216784
216844
  await delay2(delayMs);
216785
- prompt = resumeThreadId ? "continue" : baseArgs.prompt;
216845
+ prompt = resumeThreadId ? "continue" : commandArgs.prompt;
216786
216846
  }
216787
216847
  }
216788
216848
  throw new Error("Codex exec failed after retries.");
@@ -216843,27 +216903,26 @@ ${stdout}`;
216843
216903
  "utf8"
216844
216904
  );
216845
216905
  const prompt = buildRetryPrompt(localScanPrompt, retryFeedback);
216846
- const sharedArgs = [
216847
- "--json",
216848
- "--sandbox",
216849
- "workspace-write",
216850
- "--output-schema",
216851
- schemaPath,
216852
- "-o",
216853
- outputPath
216854
- ];
216855
- const args = resumeThreadId ? ["resume", ...sharedArgs, resumeThreadId, prompt] : [...sharedArgs, prompt];
216856
- const result = await runCodexExec(cwd, args, onProgress, {
216857
- stdoutLogPath,
216858
- stderrLogPath,
216859
- ...proxyOptions ? { proxyOptions } : {},
216860
- trustedPaths: [cwd],
216861
- ...onProgress ? {
216862
- onRetry: (info) => {
216863
- onProgress(formatCodexRetryProgress(info));
216864
- }
216865
- } : {}
216866
- });
216906
+ const result = await runCodexExec(
216907
+ cwd,
216908
+ {
216909
+ ...buildLocalStructuredOutputExecArgs({ schemaPath, outputPath }),
216910
+ prompt,
216911
+ resumeThreadId: resumeThreadId ?? null
216912
+ },
216913
+ onProgress,
216914
+ {
216915
+ stdoutLogPath,
216916
+ stderrLogPath,
216917
+ ...proxyOptions ? { proxyOptions } : {},
216918
+ trustedPaths: [cwd],
216919
+ ...onProgress ? {
216920
+ onRetry: (info) => {
216921
+ onProgress(formatCodexRetryProgress(info));
216922
+ }
216923
+ } : {}
216924
+ }
216925
+ );
216867
216926
  return result.threadId;
216868
216927
  };
216869
216928
  runLocalSetupExternalScan = async ({
@@ -216917,28 +216976,34 @@ ${stdout}`;
216917
216976
  "utf8"
216918
216977
  );
216919
216978
  const prompt = buildRetryPrompt(localScanPrompt, retryFeedback);
216920
- const sharedArgs = [
216921
- "--json",
216922
- "--sandbox",
216923
- "workspace-write",
216924
- ...homeDir2 ? ["--add-dir", homeDir2] : [],
216925
- "--output-schema",
216979
+ const structuredArgs = buildLocalStructuredOutputExecArgs({
216926
216980
  schemaPath,
216927
- "-o",
216928
216981
  outputPath
216929
- ];
216930
- const args = resumeThreadId ? ["resume", ...sharedArgs, resumeThreadId, prompt] : [...sharedArgs, prompt];
216931
- const result = await runCodexExec(cwd, args, onProgress, {
216932
- stdoutLogPath,
216933
- stderrLogPath,
216934
- ...proxyOptions ? { proxyOptions } : {},
216935
- trustedPaths: homeDir2 ? [cwd, homeDir2] : [cwd],
216936
- ...onProgress ? {
216937
- onRetry: (info) => {
216938
- onProgress(formatCodexRetryProgress(info));
216939
- }
216940
- } : {}
216941
216982
  });
216983
+ if (homeDir2) {
216984
+ structuredArgs.initialArgs.splice(3, 0, "--add-dir", homeDir2);
216985
+ structuredArgs.resumeExecArgs.push("--add-dir", homeDir2);
216986
+ }
216987
+ const result = await runCodexExec(
216988
+ cwd,
216989
+ {
216990
+ ...structuredArgs,
216991
+ prompt,
216992
+ resumeThreadId: resumeThreadId ?? null
216993
+ },
216994
+ onProgress,
216995
+ {
216996
+ stdoutLogPath,
216997
+ stderrLogPath,
216998
+ ...proxyOptions ? { proxyOptions } : {},
216999
+ trustedPaths: homeDir2 ? [cwd, homeDir2] : [cwd],
217000
+ ...onProgress ? {
217001
+ onRetry: (info) => {
217002
+ onProgress(formatCodexRetryProgress(info));
217003
+ }
217004
+ } : {}
217005
+ }
217006
+ );
216942
217007
  return result.threadId;
216943
217008
  };
216944
217009
  runLocalSetupExtraArtifactsScan = async ({
@@ -216991,27 +217056,26 @@ ${stdout}`;
216991
217056
  "utf8"
216992
217057
  );
216993
217058
  const prompt = buildRetryPrompt(localScanPrompt, retryFeedback);
216994
- const sharedArgs = [
216995
- "--json",
216996
- "--sandbox",
216997
- "workspace-write",
216998
- "--output-schema",
216999
- schemaPath,
217000
- "-o",
217001
- outputPath
217002
- ];
217003
- const args = resumeThreadId ? ["resume", ...sharedArgs, resumeThreadId, prompt] : [...sharedArgs, prompt];
217004
- const result = await runCodexExec(cwd, args, onProgress, {
217005
- stdoutLogPath,
217006
- stderrLogPath,
217007
- ...proxyOptions ? { proxyOptions } : {},
217008
- trustedPaths: [cwd],
217009
- ...onProgress ? {
217010
- onRetry: (info) => {
217011
- onProgress(formatCodexRetryProgress(info));
217012
- }
217013
- } : {}
217014
- });
217059
+ const result = await runCodexExec(
217060
+ cwd,
217061
+ {
217062
+ ...buildLocalStructuredOutputExecArgs({ schemaPath, outputPath }),
217063
+ prompt,
217064
+ resumeThreadId: resumeThreadId ?? null
217065
+ },
217066
+ onProgress,
217067
+ {
217068
+ stdoutLogPath,
217069
+ stderrLogPath,
217070
+ ...proxyOptions ? { proxyOptions } : {},
217071
+ trustedPaths: [cwd],
217072
+ ...onProgress ? {
217073
+ onRetry: (info) => {
217074
+ onProgress(formatCodexRetryProgress(info));
217075
+ }
217076
+ } : {}
217077
+ }
217078
+ );
217015
217079
  return result.threadId;
217016
217080
  };
217017
217081
  runLocalServicesScan = async ({
@@ -217065,28 +217129,34 @@ ${stdout}`;
217065
217129
  "utf8"
217066
217130
  );
217067
217131
  const prompt = buildRetryPrompt(servicesScanPrompt, retryFeedback);
217068
- const sharedArgs = [
217069
- "--json",
217070
- "--sandbox",
217071
- "workspace-write",
217072
- ...homeDir2 ? ["--add-dir", homeDir2] : [],
217073
- "--output-schema",
217132
+ const structuredArgs = buildLocalStructuredOutputExecArgs({
217074
217133
  schemaPath,
217075
- "-o",
217076
217134
  outputPath
217077
- ];
217078
- const args = resumeThreadId ? ["resume", ...sharedArgs, resumeThreadId, prompt] : [...sharedArgs, prompt];
217079
- const result = await runCodexExec(cwd, args, onProgress, {
217080
- stdoutLogPath,
217081
- stderrLogPath,
217082
- ...proxyOptions ? { proxyOptions } : {},
217083
- trustedPaths: homeDir2 ? [cwd, homeDir2] : [cwd],
217084
- ...onProgress ? {
217085
- onRetry: (info) => {
217086
- onProgress(formatCodexRetryProgress(info));
217087
- }
217088
- } : {}
217089
217135
  });
217136
+ if (homeDir2) {
217137
+ structuredArgs.initialArgs.splice(3, 0, "--add-dir", homeDir2);
217138
+ structuredArgs.resumeExecArgs.push("--add-dir", homeDir2);
217139
+ }
217140
+ const result = await runCodexExec(
217141
+ cwd,
217142
+ {
217143
+ ...structuredArgs,
217144
+ prompt,
217145
+ resumeThreadId: resumeThreadId ?? null
217146
+ },
217147
+ onProgress,
217148
+ {
217149
+ stdoutLogPath,
217150
+ stderrLogPath,
217151
+ ...proxyOptions ? { proxyOptions } : {},
217152
+ trustedPaths: homeDir2 ? [cwd, homeDir2] : [cwd],
217153
+ ...onProgress ? {
217154
+ onRetry: (info) => {
217155
+ onProgress(formatCodexRetryProgress(info));
217156
+ }
217157
+ } : {}
217158
+ }
217159
+ );
217090
217160
  return result.threadId;
217091
217161
  };
217092
217162
  toPosixPath = (value) => value.split(import_node_path29.default.sep).join(import_node_path29.default.posix.sep);
@@ -217574,6 +217644,7 @@ var init_codex = __esm({
217574
217644
  init_artifacts();
217575
217645
  init_progress();
217576
217646
  init_retry();
217647
+ init_scanStatus();
217577
217648
  CODEX_REQUEST_URL_REGEX2 = /error sending request for url \(([^)]+)\)/i;
217578
217649
  CODEX_STREAM_DISCONNECT_DETAIL_REGEX = /stream disconnected before completion:\s*([^\n\r]+)/i;
217579
217650
  CODEX_SESSION_ID_REGEX = /session id:\s*([0-9a-f-]{20,})/i;
@@ -217629,12 +217700,13 @@ var init_codex = __esm({
217629
217700
  attempt,
217630
217701
  maxAttempts,
217631
217702
  delayMs,
217632
- sessionId
217703
+ sessionId,
217704
+ reason
217633
217705
  }) => {
217634
217706
  const nextAttempt = attempt + 1;
217635
217707
  const delaySeconds = Math.max(1, Math.ceil(delayMs / 1e3));
217636
217708
  const mode = sessionId ? "continuing existing session" : "starting a fresh session";
217637
- return `retry ${nextAttempt}/${maxAttempts} in ${delaySeconds}s (${mode})`;
217709
+ return `retry ${nextAttempt}/${maxAttempts} in ${delaySeconds}s (${mode}): ${formatRetryReason(reason)}`;
217638
217710
  };
217639
217711
  classifyRemoteCodexSetupFailure = ({
217640
217712
  execResult,
@@ -218398,7 +218470,8 @@ codex login`
218398
218470
  attempt,
218399
218471
  maxAttempts: DEFAULT_CODEX_EXEC_MAX_ATTEMPTS,
218400
218472
  delayMs,
218401
- sessionId: resumeSessionId
218473
+ sessionId: resumeSessionId,
218474
+ reason: failure.error.message
218402
218475
  })}`
218403
218476
  );
218404
218477
  await delay2(delayMs);
@@ -218568,6 +218641,7 @@ var init_setupPlanFlow = __esm({
218568
218641
  import_node_os18 = __toESM(require("node:os"), 1);
218569
218642
  init_dist4();
218570
218643
  init_codex();
218644
+ init_scanStatus();
218571
218645
  init_progress();
218572
218646
  init_setupArtifactsValidation();
218573
218647
  SETUP_ARTIFACT_REGEN_MAX_ATTEMPTS = 3;
@@ -218713,11 +218787,19 @@ var init_setupPlanFlow = __esm({
218713
218787
  try {
218714
218788
  await run2();
218715
218789
  let out = await read2();
218716
- if (shouldRetry(out)) {
218717
- update("retrying");
218790
+ const needsImmediateRetry = shouldRetry(out);
218791
+ if (needsImmediateRetry) {
218792
+ const retrySummary = summarizeIncompleteScanResult(out);
218793
+ update(retrySummary ? `retrying - ${retrySummary}` : "retrying");
218718
218794
  await import_promises29.default.rm(outputPath, { force: true });
218719
218795
  await run2();
218720
218796
  out = await read2();
218797
+ if (shouldRetry(out)) {
218798
+ const retrySummary2 = summarizeIncompleteScanResult(out);
218799
+ throw new Error(
218800
+ retrySummary2 ? `${scanLabel} scan returned incomplete empty results after retry (${retrySummary2}).` : `${scanLabel} scan returned incomplete empty results after retry.`
218801
+ );
218802
+ }
218721
218803
  }
218722
218804
  update("done");
218723
218805
  return out;
@@ -221881,7 +221963,7 @@ var init_resolve = __esm({
221881
221963
  });
221882
221964
 
221883
221965
  // src/devbox/commands/init/provider/modal.ts
221884
- var MODAL_TERMINATION_PROPAGATION_TIMEOUT_MS, MODAL_TERMINATION_PROPAGATION_POLL_INTERVAL_MS, sleep3, resolveModalControlPlaneToken, createModalResumeRestoreError, confirmTerminateExistingModalSandbox, waitForModalSandboxAbsenceAfterTermination, runModalProviderInitPhases;
221966
+ var MODAL_TERMINATION_PROPAGATION_TIMEOUT_MS, MODAL_TERMINATION_PROPAGATION_POLL_INTERVAL_MS, sleep3, resolveModalControlPlaneToken, createModalResumeRestoreError, confirmTerminateExistingModalSandbox, provisionModalSandboxAfterTermination, runModalProviderInitPhases;
221885
221967
  var init_modal = __esm({
221886
221968
  "src/devbox/commands/init/provider/modal.ts"() {
221887
221969
  "use strict";
@@ -221936,27 +222018,41 @@ var init_modal = __esm({
221936
222018
  }
221937
222019
  return true;
221938
222020
  };
221939
- waitForModalSandboxAbsenceAfterTermination = async ({
222021
+ provisionModalSandboxAfterTermination = async ({
221940
222022
  alias,
221941
222023
  modalOperationOptions,
221942
222024
  timeoutMs = MODAL_TERMINATION_PROPAGATION_TIMEOUT_MS,
221943
222025
  pollIntervalMs = MODAL_TERMINATION_PROPAGATION_POLL_INTERVAL_MS
221944
222026
  }) => {
221945
222027
  const deadline = Date.now() + timeoutMs;
222028
+ let lastSeenSandbox = null;
221946
222029
  while (true) {
221947
- const existing = await findModalSandbox(
222030
+ try {
222031
+ return await provisionModalSandbox(alias, modalOperationOptions);
222032
+ } catch (error2) {
222033
+ if (!isModalAlreadyExistsError(error2)) {
222034
+ throw error2;
222035
+ }
222036
+ }
222037
+ lastSeenSandbox = await findModalSandbox(
221948
222038
  { alias, includeFinished: true },
221949
222039
  modalOperationOptions
221950
222040
  );
221951
- if (!existing) {
221952
- return;
221953
- }
221954
222041
  const remainingMs = deadline - Date.now();
221955
222042
  if (remainingMs <= 0) {
222043
+ if (lastSeenSandbox) {
222044
+ throw new Error(
222045
+ `Timed out waiting for modal sandbox alias "${alias}" to become available after termination. Last seen sandbox id "${lastSeenSandbox.sandboxId}" with status "${lastSeenSandbox.status}".`
222046
+ );
222047
+ }
221956
222048
  throw new Error(
221957
- `Timed out waiting for modal sandbox alias "${alias}" to disappear after termination. Last seen sandbox id "${existing.sandboxId}" with status "${existing.status}".`
222049
+ `Timed out waiting for modal sandbox alias "${alias}" to become available after termination.`
221958
222050
  );
221959
222051
  }
222052
+ await terminateModalSandboxesByAlias(alias, {
222053
+ ...modalOperationOptions,
222054
+ includeFinished: true
222055
+ });
221960
222056
  await sleep3(Math.min(pollIntervalMs, remainingMs));
221961
222057
  }
221962
222058
  };
@@ -222133,15 +222229,12 @@ var init_modal = __esm({
222133
222229
  `Modal reported ALREADY_EXISTS for alias "${alias}", but no matching sandbox was found to terminate.`
222134
222230
  );
222135
222231
  }
222136
- status.stage("Waiting for Modal to finalize termination");
222137
- await waitForModalSandboxAbsenceAfterTermination({
222138
- alias,
222139
- ...modalOperationOptions ? { modalOperationOptions } : {}
222140
- });
222141
- status.stage("Provisioning in Modal");
222142
- const reprovisioned = await provisionModalSandbox(
222143
- alias,
222144
- modalOperationOptions
222232
+ status.stage("Waiting for Modal to release sandbox name");
222233
+ const reprovisioned = await provisionModalSandboxAfterTermination(
222234
+ {
222235
+ alias,
222236
+ ...modalOperationOptions ? { modalOperationOptions } : {}
222237
+ }
222145
222238
  );
222146
222239
  await recordProvisionedModal(reprovisioned);
222147
222240
  return;
@@ -229775,4 +229868,4 @@ smol-toml/dist/index.js:
229775
229868
  */
229776
229869
  //# sourceMappingURL=dvb.cjs.map
229777
229870
 
229778
- //# debugId=dab189dc-59c8-54af-b40c-b5ea0eb33006
229871
+ //# debugId=a0a101a2-0ead-5d3d-8af3-ec4f67fbac2d