substrate-ai 0.20.136 → 0.20.138

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.
@@ -0,0 +1,4 @@
1
+ import { AdapterRegistry } from "./dist-DnvGvKLu.js";
2
+ import "./adapter-registry-DIcrxjH8.js";
3
+
4
+ export { AdapterRegistry };
package/dist/cli/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import { FileKvStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createDatabaseAdapter, createDoltOperatorReader, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion } from "../health-COhVUNXM.js";
2
+ import { FileKvStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createDatabaseAdapter, createDoltOperatorReader, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion } from "../health-2Kfa00-H.js";
3
3
  import { createLogger } from "../logger-KeHncl-f.js";
4
4
  import { createEventBus } from "../helpers-CElYrONe.js";
5
- import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, GlobalSettingsSchema, InMemoryDatabaseAdapter, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createPipelineRun, createStderrLogger, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initWorkGraphSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, swallowDebug, tagRunAsBaseline, updatePipelineRun } from "../dist-T6ZXe2Q2.js";
6
- import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-lBgnO-3E.js";
5
+ import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, GlobalSettingsSchema, InMemoryDatabaseAdapter, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createPipelineRun, createStderrLogger, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initWorkGraphSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, swallowDebug, tagRunAsBaseline, updatePipelineRun } from "../dist-DnvGvKLu.js";
6
+ import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-Dbwlb4Md.js";
7
7
  import "../adapter-registry-DIcrxjH8.js";
8
- import { RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck } from "../manifest-read-C84VX-CF.js";
9
- import "../errors-C-9u7gCX.js";
8
+ import { RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck } from "../manifest-read-DJFbGhSd.js";
9
+ import "../errors-i3s5sshZ.js";
10
10
  import "../routing-DFxoKHDt.js";
11
11
  import { WorkGraphRepository } from "../work-graph-repository-DZyJv5pV.js";
12
12
  import "../decisions-CzSIEeGP.js";
13
13
  import "../decision-router-DblHY8se.js";
14
- import "../interactive-prompt-wZnuOAri.js";
14
+ import "../interactive-prompt-B91mG5v4.js";
15
15
  import "../recovery-engine-BKGBeBnW.js";
16
16
  import "../version-manager-impl-qFBiO4Eh.js";
17
- import { registerUpgradeCommand } from "../upgrade-CZMWjtYN.js";
17
+ import { registerUpgradeCommand } from "../upgrade-yULZIAAW.js";
18
18
  import { Command } from "commander";
19
19
  import { fileURLToPath } from "url";
20
20
  import { dirname, join, resolve } from "path";
@@ -406,7 +406,8 @@ function healthResultToJson(adapterId, displayName, healthResult) {
406
406
  cliPath: healthResult.cliPath ?? null,
407
407
  detectedBillingModes: healthResult.detectedBillingModes ?? [],
408
408
  supportsHeadless: healthResult.supportsHeadless,
409
- error: healthResult.error ?? null
409
+ error: healthResult.error ?? null,
410
+ compatibilityWarning: healthResult.compatibilityWarning ?? null
410
411
  };
411
412
  }
412
413
 
@@ -462,6 +463,18 @@ function registerAdaptersCommand(program, version, registry) {
462
463
  if (opts.verbose) for (const result of report.results) {
463
464
  const health = result.healthResult;
464
465
  if (!health.healthy && health.error) process.stdout.write(`\n[${result.adapterId}] Error: ${health.error}\n`);
466
+ if (health.compatibilityWarning !== void 0) process.stdout.write(`\n[${result.adapterId}] Compatibility: ${health.compatibilityWarning}\n`);
467
+ }
468
+ else {
469
+ const drifted = report.results.filter((r) => r.healthResult.compatibilityWarning !== void 0);
470
+ if (drifted.length > 0) {
471
+ process.stdout.write("\nCLI version notes (run with --verbose for full text):\n");
472
+ for (const result of drifted) {
473
+ const w = result.healthResult.compatibilityWarning;
474
+ const oneLine = w.length > 120 ? w.slice(0, 117) + "..." : w;
475
+ process.stdout.write(` ${result.adapterId}: ${oneLine}\n`);
476
+ }
477
+ }
465
478
  }
466
479
  process.exit(EXIT_CODE_SUCCESS);
467
480
  });
@@ -7023,7 +7036,7 @@ async function runStatusAction(options) {
7023
7036
  logger$15.debug({ err }, "Work graph query failed, continuing without work graph data");
7024
7037
  }
7025
7038
  if (run === void 0) {
7026
- const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-Dt1yKeE5.js");
7039
+ const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-Caa24SFM.js");
7027
7040
  const substrateDirPath = join(projectRoot, ".substrate");
7028
7041
  const processInfo = inspectProcessTree$1({
7029
7042
  projectRoot,
@@ -7971,7 +7984,7 @@ function defaultSupervisorDeps() {
7971
7984
  if (cached === null) {
7972
7985
  const { AdapterRegistry: AR } = await import(
7973
7986
  /* @vite-ignore */
7974
- "../adapter-registry-JR4v2z6n.js"
7987
+ "../adapter-registry-Bpa7ESBV.js"
7975
7988
  );
7976
7989
  cached = new AR();
7977
7990
  await cached.discoverAndRegister();
@@ -8538,11 +8551,11 @@ async function runSupervisorAction(options, deps = {}) {
8538
8551
  try {
8539
8552
  const { createExperimenter } = await import(
8540
8553
  /* @vite-ignore */
8541
- "../experimenter-BZ1rtNzK.js"
8554
+ "../experimenter-DU2Cv51N.js"
8542
8555
  );
8543
8556
  const { getLatestRun: getLatest } = await import(
8544
8557
  /* @vite-ignore */
8545
- "../decisions-D0MA8bRv.js"
8558
+ "../decisions-fBdZmqOK.js"
8546
8559
  );
8547
8560
  const expAdapter = createDatabaseAdapter({
8548
8561
  backend: "auto",
@@ -8552,7 +8565,7 @@ async function runSupervisorAction(options, deps = {}) {
8552
8565
  await initSchema(expAdapter);
8553
8566
  const { runRunAction: runPipeline } = await import(
8554
8567
  /* @vite-ignore */
8555
- "../run-rq4X93Bs.js"
8568
+ "../run-Ppco-3HT.js"
8556
8569
  );
8557
8570
  const runStoryFn = async (opts) => {
8558
8571
  const exitCode = await runPipeline({
@@ -9077,7 +9090,7 @@ async function runMetricsAction(options) {
9077
9090
  const routingConfigPath = join(dbDir, "routing.yml");
9078
9091
  let routingConfig = null;
9079
9092
  if (existsSync$1(routingConfigPath)) try {
9080
- const { loadModelRoutingConfig } = await import("../routing-2kbRZmr7.js");
9093
+ const { loadModelRoutingConfig } = await import("../routing-DFIBY9Yk.js");
9081
9094
  routingConfig = loadModelRoutingConfig(routingConfigPath);
9082
9095
  } catch {}
9083
9096
  if (routingConfig === null) routingConfig = {
@@ -13387,8 +13400,8 @@ async function createProgram() {
13387
13400
  /** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
13388
13401
  function checkForUpdatesInBackground(currentVersion) {
13389
13402
  if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
13390
- import("../upgrade-DjJ4uqLJ.js").then(async () => {
13391
- const { createVersionManager } = await import("../version-manager-impl-BLXt2ucf.js");
13403
+ import("../upgrade-CnIsoLpT.js").then(async () => {
13404
+ const { createVersionManager } = await import("../version-manager-impl-C7ZhqLX3.js");
13392
13405
  const vm = createVersionManager();
13393
13406
  const result = await vm.checkForUpdates();
13394
13407
  if (result.updateAvailable) {
@@ -1,4 +1,4 @@
1
- import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-T6ZXe2Q2.js";
1
+ import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-DnvGvKLu.js";
2
2
  import "./decisions-CzSIEeGP.js";
3
3
 
4
4
  export { getLatestRun };
@@ -14,11 +14,12 @@ import { homedir } from "os";
14
14
  import { createServer } from "node:http";
15
15
  import { createGunzip, createInflate } from "node:zlib";
16
16
  import { promisify } from "node:util";
17
- import { createRequire } from "node:module";
18
- import { fileURLToPath } from "node:url";
19
17
  import * as semver$2 from "semver";
20
18
  import * as semver$1 from "semver";
21
19
  import * as semver from "semver";
20
+ import { coerce, compare, valid } from "semver";
21
+ import { createRequire } from "node:module";
22
+ import { fileURLToPath } from "node:url";
22
23
  import https from "node:https";
23
24
 
24
25
  //#region packages/core/dist/dispatch/types.js
@@ -9414,6 +9415,43 @@ var Recommender = class Recommender {
9414
9415
  }
9415
9416
  };
9416
9417
 
9418
+ //#endregion
9419
+ //#region packages/core/dist/adapters/version-compat.js
9420
+ function normalize(version) {
9421
+ return valid(version) ?? valid(coerce(version) ?? "") ?? null;
9422
+ }
9423
+ /**
9424
+ * Compare a live CLI binary's reported version against the tested range. Pure.
9425
+ *
9426
+ * Three outcomes:
9427
+ * - actual within range → `{ compatible: true }`
9428
+ * - actual outside range → `{ compatible: false, warning }` with a message
9429
+ * naming the adapter + drift + suggested operator action
9430
+ * - actual unparseable → `{ compatible: false, warning }` flagging that
9431
+ * the version couldn't be compared (degrade gracefully; never throw)
9432
+ */
9433
+ function checkAdapterVersionCompat(adapterName, actualVersion, tested) {
9434
+ const actual = normalize(actualVersion);
9435
+ const min = normalize(tested.min);
9436
+ const max = normalize(tested.max);
9437
+ if (actual === null || min === null || max === null) return {
9438
+ compatible: false,
9439
+ warning: `${adapterName}: CLI version '${actualVersion}' could not be parsed for comparison against substrate's tested range (${tested.min}–${tested.max}). Flag behavior may differ; report any dispatch failures.`
9440
+ };
9441
+ if (compare(actual, min) < 0) return {
9442
+ compatible: false,
9443
+ warning: `${adapterName}: CLI version ${actualVersion} is below substrate's tested range (${tested.min}–${tested.max}). Older flag forms may be required; consider upgrading the CLI to a version within range, or upgrading substrate.` + (tested.note !== void 0 ? ` Range note: ${tested.note}` : "")
9444
+ };
9445
+ if (compare(actual, max) > 0) return {
9446
+ compatible: false,
9447
+ warning: `${adapterName}: CLI version ${actualVersion} is newer than substrate's tested range (${tested.min}–${tested.max}). Flag behavior may have changed since substrate was tested; consider upgrading substrate or reporting any dispatch failures.` + (tested.note !== void 0 ? ` Range note: ${tested.note}` : "")
9448
+ };
9449
+ return tested.note !== void 0 ? {
9450
+ compatible: true,
9451
+ warning: `${adapterName}: ${tested.note}`
9452
+ } : { compatible: true };
9453
+ }
9454
+
9417
9455
  //#endregion
9418
9456
  //#region packages/core/dist/adapters/claude-adapter.js
9419
9457
  const execAsync$2 = promisify(exec);
@@ -9440,10 +9478,26 @@ function stripCodeFences$2(raw) {
9440
9478
  * Health check: runs `claude --version` to verify install.
9441
9479
  * Billing detection: detects subscription vs API via version output or env.
9442
9480
  */
9443
- var ClaudeCodeAdapter = class {
9481
+ var ClaudeCodeAdapter = class ClaudeCodeAdapter {
9444
9482
  id = "claude-code";
9445
9483
  displayName = "Claude Code";
9446
9484
  adapterVersion = "1.0.0";
9485
+ /**
9486
+ * Claude Code CLI version range substrate's `buildCommand` has been
9487
+ * empirically verified against (as of substrate v0.20.138 on 2026-05-31).
9488
+ * `healthCheck` compares the live `claude --version` against this range
9489
+ * and surfaces a warning when the operator's CLI is outside it.
9490
+ *
9491
+ * The `note` flags `--max-turns`: the flag is silently accepted by clap
9492
+ * but not honored — substrate's `options.maxTurns` has no effect on
9493
+ * Claude Code 2.x dispatches. Bumping the upper bound requires re-running
9494
+ * the empirical audit (see `feedback_cli_adapter_empirical_version_match`).
9495
+ */
9496
+ static TESTED_CLI_VERSION_RANGE = {
9497
+ min: "2.1.152",
9498
+ max: "2.1.158",
9499
+ note: "Claude Code 2.x silently accepts but does not honor `--max-turns`; substrate no longer passes that flag."
9500
+ };
9447
9501
  _logger;
9448
9502
  constructor(logger) {
9449
9503
  this._logger = logger ?? createStderrLogger("claude-adapter");
@@ -9462,12 +9516,14 @@ var ClaudeCodeAdapter = class {
9462
9516
  const whichResult = await execAsync$2("which claude", { timeout: 5e3 });
9463
9517
  cliPath = whichResult.stdout.trim();
9464
9518
  } catch {}
9519
+ const compat = checkAdapterVersionCompat("claude-code", output, ClaudeCodeAdapter.TESTED_CLI_VERSION_RANGE);
9465
9520
  return {
9466
9521
  healthy: true,
9467
9522
  version: output,
9468
9523
  ...cliPath !== void 0 ? { cliPath } : {},
9469
9524
  detectedBillingModes,
9470
- supportsHeadless: true
9525
+ supportsHeadless: true,
9526
+ ...compat.warning !== void 0 ? { compatibilityWarning: compat.warning } : {}
9471
9527
  };
9472
9528
  } catch (err) {
9473
9529
  const message = err instanceof Error ? err.message : String(err);
@@ -9491,7 +9547,6 @@ var ClaudeCodeAdapter = class {
9491
9547
  model,
9492
9548
  "--dangerously-skip-permissions"
9493
9549
  ];
9494
- if (options.maxTurns !== void 0) args.push("--max-turns", String(options.maxTurns));
9495
9550
  if (options.additionalFlags && options.additionalFlags.length > 0) args.push(...options.additionalFlags);
9496
9551
  const systemPromptParts = [BASE_SYSTEM_PROMPT];
9497
9552
  if (options.optimizationDirectives) systemPromptParts.push(`\n\n## Optimization Directives\n${options.optimizationDirectives}`);
@@ -9728,7 +9783,7 @@ const CODEX_SANDBOX_BLOCK_SIGNATURES = [
9728
9783
  "disallowed by requirements"
9729
9784
  ];
9730
9785
  /** Human-readable explanation appended to escalations caused by a Codex write-block. */
9731
- const CODEX_SANDBOX_BLOCK_HINT = "Likely cause: Codex could not write files. Substrate runs `codex exec --full-auto` (Codex's documented alias for `-a on-request --sandbox workspace-write` the standard low-friction non-interactive automation mode, NOT the org-blocked `--dangerously-bypass-approvals-and-sandbox`). If the run log shows \"approval is not supported in exec mode\" or \"patch rejected by user\", the most likely cause is a known Codex defect: `UnlessTrusted` policy unconditionally asks for approval on `apply_patch` (see codex-rs/core/src/safety.rs TODO(ragona)), and `OnRequest` may also fail in environments where `get_platform_sandbox()` returns None (e.g. WSL see Codex issue #18365). Workarounds: dispatch with a provider that can write here (e.g. `--agent claude-code`), or get the Codex CLI bug fixed upstream.";
9786
+ const CODEX_SANDBOX_BLOCK_HINT = "Likely cause: Codex could not write files. This is structural in `codex exec`, not substrate: the `exec` subcommand hardcodes `approval_policy=Never` (codex-rs/exec/src/lib.rs:407) and has no `--ask-for-approval` flag, so no substrate flag combination can override it. On non-enterprise installs this is fine `Never` + `workspace-write` auto-approves apply_patch within writable roots. On enterprise installs with managed configs that disallow `Never`, the hardcoded `Some(Never)` falls back to `UnlessTrusted`, which has a maintainer-flagged defect (`TODO(ragona)` at codex-rs/core/src/safety.rs:54-58) that unconditionally requests approval which exec mode rejects. Workarounds, in order of practical leverage: (1) dispatch with a provider that can write here (e.g. `--agent claude-code`); (2) get the enterprise managed config to add `Never` to `allowed_approval_policies` (the workspace-write sandbox provides the actual security boundary — see Codex docs and issue #10949); (3) wait for the upstream Codex fix to `safety.rs` or for an `exec`-side `--ask-for-approval` flag.";
9732
9787
  /**
9733
9788
  * Returns the Codex-write-block hint if `output` contains a sandbox/approval
9734
9789
  * block signature, else null. Pure + exported for diagnostics and testing.
@@ -9744,10 +9799,30 @@ function detectCodexSandboxBlock(output) {
9744
9799
  * Codex CLI uses stdin for the prompt and outputs JSON when --json flag is used.
9745
9800
  * Codex supports subscription billing (via `codex login`) and API key billing.
9746
9801
  */
9747
- var CodexCLIAdapter = class {
9802
+ var CodexCLIAdapter = class CodexCLIAdapter {
9748
9803
  id = "codex";
9749
9804
  displayName = "Codex CLI";
9750
9805
  adapterVersion = "1.0.0";
9806
+ /**
9807
+ * Codex CLI version range substrate's `buildCommand` has been empirically
9808
+ * verified against (as of substrate v0.20.138 on 2026-05-31). The range
9809
+ * is narrow because the v0.20.131→137 arc taught us how much can drift
9810
+ * between minor versions — `--full-auto` changed meaning between 0.111.0
9811
+ * and 0.128.0 (deprecated, semantics shifted) and almost certainly will
9812
+ * drift again.
9813
+ *
9814
+ * The `note` flags the structural truth: `codex exec` hardcodes
9815
+ * `approval_policy=Never` and ignores `-c approval_policy=...` overrides
9816
+ * (codex-rs/exec/src/lib.rs:407). On enterprise managed configs that
9817
+ * disallow `Never`, dispatch will fail at the apply_patch layer regardless
9818
+ * of substrate's flag — see CODEX_SANDBOX_BLOCK_HINT and the policy ask
9819
+ * document in `docs/2026-05-29-codex-managed-config-policy-ask.md`.
9820
+ */
9821
+ static TESTED_CLI_VERSION_RANGE = {
9822
+ min: "0.135.0",
9823
+ max: "0.135.0",
9824
+ note: "`codex exec` hardcodes approval_policy=Never (cannot be overridden); on enterprise managed configs disallowing Never, dispatch fails at apply_patch."
9825
+ };
9751
9826
  _logger;
9752
9827
  constructor(logger) {
9753
9828
  this._logger = logger ?? createStderrLogger("codex-adapter");
@@ -9764,12 +9839,14 @@ var CodexCLIAdapter = class {
9764
9839
  const whichResult = await execAsync$1("which codex", { timeout: 5e3 });
9765
9840
  cliPath = whichResult.stdout.trim();
9766
9841
  } catch {}
9842
+ const compat = checkAdapterVersionCompat("codex", output, CodexCLIAdapter.TESTED_CLI_VERSION_RANGE);
9767
9843
  return {
9768
9844
  healthy: true,
9769
9845
  version: output,
9770
9846
  ...cliPath !== void 0 ? { cliPath } : {},
9771
9847
  detectedBillingModes: CODEX_BILLING_MODES,
9772
- supportsHeadless: true
9848
+ supportsHeadless: true,
9849
+ ...compat.warning !== void 0 ? { compatibilityWarning: compat.warning } : {}
9773
9850
  };
9774
9851
  } catch (err) {
9775
9852
  const message = err instanceof Error ? err.message : String(err);
@@ -9784,30 +9861,37 @@ var CodexCLIAdapter = class {
9784
9861
  * Build spawn command for a coding task.
9785
9862
  * Uses: `codex exec` with prompt delivered via stdin.
9786
9863
  *
9787
- * `--full-auto` is Codex's documented `exec` convenience alias for
9788
- * `-a on-request --sandbox workspace-write` the standard low-friction
9789
- * non-interactive automation mode. We use this form for three reasons:
9864
+ * `--sandbox workspace-write` is Codex's documented form for non-interactive
9865
+ * automation as of v0.128.0+. The `--full-auto` flag (used in v0.20.136) was
9866
+ * deprecated in Codex v0.128.0 and now prints a warning on every invocation:
9867
+ * `warning: --full-auto is deprecated; use --sandbox workspace-write instead.`
9790
9868
  *
9791
- * 1. **It parses cleanly on `exec`.** `--full-auto` is a documented
9792
- * subcommand flag (`codex exec --help` lists it). The earlier substrate
9793
- * attempts hit two failure modes: `--ask-for-approval` is top-level
9794
- * only and errors `unexpected argument` after `exec` (v0.20.131–133),
9795
- * and `-c approval_policy=never` parses but gets silently downshifted
9796
- * under enterprise cloud-managed policies that disallow `Never`
9797
- * (v0.20.134–135 the operator's pv-core-harness case).
9798
- * 2. **`OnRequest` works with `apply_patch` in `workspace-write`.** Per
9799
- * Codex source (`codex-rs/core/src/safety.rs:33-116`), `OnRequest`
9800
- * falls through to `is_write_patch_constrained_to_writable_paths` and
9801
- * AUTO-APPROVES `apply_patch` calls when every target path is inside
9802
- * the writable roots of an active platform sandbox. So Codex writes
9803
- * land in `exec` mode without any approval prompt or escalation.
9804
- * `UnlessTrusted` is the only policy with the broken `TODO(ragona)`
9805
- * branch that unconditionally asks for approval we avoid it.
9806
- * 3. **`OnRequest` is broadly allow-listed.** Enterprise cloud policies
9807
- * that disallow `Never` typically still permit `OnRequest`
9808
- * (it's strictly more conservative). `--full-auto` is therefore the
9809
- * form most likely to work across both unrestricted and managed Codex
9810
- * installs.
9869
+ * **There is no flag form that can override `approval_policy` on `codex exec`.**
9870
+ * Per Codex source at tag `rust-v0.134.0`:
9871
+ * - `codex-rs/exec/src/lib.rs:407` the `exec` harness hardcodes
9872
+ * `ConfigOverrides { approval_policy: Some(AskForApproval::Never), ... }`
9873
+ * unconditionally.
9874
+ * - `codex-rs/core/src/config/mod.rs:2902-2914` harness overrides beat
9875
+ * both `-c approval_policy=...` and any TOML config.
9876
+ * - `codex-rs/exec/src/cli.rs` + `codex-rs/utils/cli/src/shared_options.rs`
9877
+ * zero references to `--ask-for-approval` on the `exec` subcommand;
9878
+ * `-a` is top-level only and is silently ignored if placed after `exec`.
9879
+ *
9880
+ * So `codex exec` deterministically runs with `approval_policy=Never`,
9881
+ * regardless of what flags substrate passes. On non-enterprise installs
9882
+ * this is fine: `Never` + `--sandbox workspace-write` + `apply_patch` inside
9883
+ * writable roots = auto-approve via the writable-paths fall-through
9884
+ * (`assess_patch_safety` in `codex-rs/core/src/safety.rs:138`).
9885
+ *
9886
+ * On enterprise installs with managed configs that disallow `Never`,
9887
+ * the hardcoded `Some(Never)` fails the constrained-set check, falls back
9888
+ * to `UnlessTrusted`, and `UnlessTrusted` hits a maintainer-flagged defect
9889
+ * (`TODO(ragona)` at `safety.rs:54-58`) that returns `AskUser` unconditionally
9890
+ * — which `exec` mode rejects with `file change approval is not supported`.
9891
+ * **No substrate flag combination unblocks this case**; the structural fix
9892
+ * is either an org-policy change (add `Never` to `allowed_approval_policies`)
9893
+ * or an upstream Codex fix (issue #10949, open since v0.98.0). The
9894
+ * `CODEX_SANDBOX_BLOCK_HINT` below names both escalation paths.
9811
9895
  *
9812
9896
  * Not the org-blocked `--dangerously-bypass-approvals-and-sandbox` flag.
9813
9897
  * The planning command stays read-only (it must not write).
@@ -9817,7 +9901,11 @@ var CodexCLIAdapter = class {
9817
9901
  * Raw text output is required (same rationale as Claude adapter).
9818
9902
  */
9819
9903
  buildCommand(prompt, options) {
9820
- const args = ["exec", "--full-auto"];
9904
+ const args = [
9905
+ "exec",
9906
+ "--sandbox",
9907
+ "workspace-write"
9908
+ ];
9821
9909
  if (options.additionalFlags && options.additionalFlags.length > 0) args.push(...options.additionalFlags);
9822
9910
  const envEntries = {};
9823
9911
  if (options.apiKey) envEntries.OPENAI_API_KEY = options.apiKey;
@@ -9994,10 +10082,22 @@ function stripCodeFences(raw) {
9994
10082
  * Gemini CLI follows similar patterns to Claude Code: prompt via `-p` flag,
9995
10083
  * JSON output via `--output-format json`, and model via `--model`.
9996
10084
  */
9997
- var GeminiCLIAdapter = class {
10085
+ var GeminiCLIAdapter = class GeminiCLIAdapter {
9998
10086
  id = "gemini";
9999
10087
  displayName = "Gemini CLI";
10000
10088
  adapterVersion = "1.0.0";
10089
+ /**
10090
+ * Gemini CLI version range substrate's `buildCommand` has been empirically
10091
+ * verified against (as of substrate v0.20.138 on 2026-05-31). Empirical
10092
+ * audit confirmed `-p`, `-m/--model`, `-o/--output-format` (with choices
10093
+ * `text|json|stream-json`) and the planning command's positional-prompt form
10094
+ * all parse cleanly on both 0.33.0 and 0.44.1 — same flag layer across a
10095
+ * meaningful version span.
10096
+ */
10097
+ static TESTED_CLI_VERSION_RANGE = {
10098
+ min: "0.33.0",
10099
+ max: "0.44.1"
10100
+ };
10001
10101
  _logger;
10002
10102
  constructor(logger) {
10003
10103
  this._logger = logger ?? createStderrLogger("gemini-adapter");
@@ -10016,12 +10116,14 @@ var GeminiCLIAdapter = class {
10016
10116
  const whichResult = await execAsync("which gemini", { timeout: 5e3 });
10017
10117
  cliPath = whichResult.stdout.trim();
10018
10118
  } catch {}
10119
+ const compat = checkAdapterVersionCompat("gemini", output, GeminiCLIAdapter.TESTED_CLI_VERSION_RANGE);
10019
10120
  return {
10020
10121
  healthy: true,
10021
10122
  version: output,
10022
10123
  ...cliPath !== void 0 ? { cliPath } : {},
10023
10124
  detectedBillingModes,
10024
- supportsHeadless: true
10125
+ supportsHeadless: true,
10126
+ ...compat.warning !== void 0 ? { compatibilityWarning: compat.warning } : {}
10025
10127
  };
10026
10128
  } catch (err) {
10027
10129
  const message = err instanceof Error ? err.message : String(err);
@@ -11331,4 +11433,4 @@ async function callLLM(params) {
11331
11433
 
11332
11434
  //#endregion
11333
11435
  export { ADVISORY_NOTES, AdapterRegistry, AdtError, BudgetConfigSchema, CODEX_SANDBOX_BLOCK_HINT, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, Categorizer, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, ConsumerAnalyzer, CostTrackerConfigSchema, DEFAULT_CONFIG, DEFAULT_GLOBAL_SETTINGS, DispatcherImpl, DoltClient, DoltNotInstalled, DoltQueryError, ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, EfficiencyScorer, GeminiCLIAdapter, GlobalSettingsSchema, InMemoryDatabaseAdapter, IngestionServer, LEARNING_FINDING, LogTurnAnalyzer, ModelRoutingConfigSchema, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProviderPolicySchema, ProvidersSchema, Recommender, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, STORY_METRICS, STORY_OUTCOME, SubstrateConfigSchema, TASK_TYPE_PHASE_MAP, TEST_EXPANSION_FINDING, TEST_PLAN, TelemetryConfigSchema, TelemetryNormalizer, TelemetryPipeline, TurnAnalyzer, VersionManagerImpl, addTokenUsage, aggregateTokenUsageForRun, aggregateTokenUsageForStory, buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, callLLM, checkDoltInstalled, classifyVersionGap, compareRunMetrics, createAmendmentRun, createConfigSystem, createDatabaseAdapter as createDatabaseAdapter$1, createDecision, createExperimenter, createPipelineRun, createRequirement, createStderrLogger, createVersionManager, detectCodexSandboxBlock, detectInterfaceChanges, determineVerdict, getActiveDecisions, getAllCostEntriesFiltered, getArtifactByTypeForRun, getArtifactsByRun, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getModelTier, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initWorkGraphSchema, initializeDolt, listRequirements, listRunMetrics, loadModelRoutingConfig, loadParentRunDecisions, registerArtifact, resolvePromptFile, supersedeDecision, swallowDebug, tagRunAsBaseline, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics };
11334
- //# sourceMappingURL=dist-T6ZXe2Q2.js.map
11436
+ //# sourceMappingURL=dist-DnvGvKLu.js.map
@@ -1,4 +1,4 @@
1
- import { AdtError } from "./dist-T6ZXe2Q2.js";
1
+ import { AdtError } from "./dist-DnvGvKLu.js";
2
2
 
3
3
  //#region src/core/errors.ts
4
4
  /** Error thrown when task configuration is invalid */
@@ -71,4 +71,4 @@ var TaskGraphIncompatibleFormatError = class extends AdtError {
71
71
 
72
72
  //#endregion
73
73
  export { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError };
74
- //# sourceMappingURL=errors-C-9u7gCX.js.map
74
+ //# sourceMappingURL=errors-i3s5sshZ.js.map
@@ -1,3 +1,3 @@
1
- import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-T6ZXe2Q2.js";
1
+ import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-DnvGvKLu.js";
2
2
 
3
3
  export { createExperimenter };
@@ -1,6 +1,6 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-T6ZXe2Q2.js";
3
- import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-C84VX-CF.js";
2
+ import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-DnvGvKLu.js";
3
+ import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-DJFbGhSd.js";
4
4
  import { createRequire } from "module";
5
5
  import { dirname, join } from "path";
6
6
  import { existsSync, readFileSync } from "node:fs";
@@ -1000,4 +1000,4 @@ function registerHealthCommand(program, _version = "0.0.0", projectRoot = proces
1000
1000
 
1001
1001
  //#endregion
1002
1002
  export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, FileKvStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createDoltOperatorReader, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, runHealthAction, validateStoryKey };
1003
- //# sourceMappingURL=health-COhVUNXM.js.map
1003
+ //# sourceMappingURL=health-2Kfa00-H.js.map
@@ -1,7 +1,7 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-COhVUNXM.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-2Kfa00-H.js";
2
2
  import "./logger-KeHncl-f.js";
3
- import "./dist-T6ZXe2Q2.js";
4
- import "./manifest-read-C84VX-CF.js";
3
+ import "./dist-DnvGvKLu.js";
4
+ import "./manifest-read-DJFbGhSd.js";
5
5
  import "./work-graph-repository-DZyJv5pV.js";
6
6
  import "./decisions-CzSIEeGP.js";
7
7
 
@@ -971,6 +971,14 @@ interface AdapterHealthResult {
971
971
  detectedBillingModes?: BillingMode[];
972
972
  /** Whether the CLI supports headless/non-interactive mode */
973
973
  supportsHeadless: boolean;
974
+ /**
975
+ * Human-readable note when the live CLI version is OUTSIDE substrate's
976
+ * tested range, OR when the tested range carries an informational caveat
977
+ * even within range. Surfaced by `substrate health` so operators see drift
978
+ * as a noisy first-dispatch signal instead of a multi-ship debugging arc.
979
+ * Pure-helper-computed; see `version-compat.ts`.
980
+ */
981
+ compatibilityWarning?: string;
974
982
  }
975
983
  /**
976
984
  * Parsed result from a task execution.
@@ -1260,8 +1268,49 @@ declare class AdapterRegistry {
1260
1268
  }
1261
1269
 
1262
1270
  //#endregion
1263
- //#region packages/core/dist/adapters/claude-adapter.d.ts
1271
+ //#region packages/core/dist/adapters/version-compat.d.ts
1264
1272
  //# sourceMappingURL=adapter-registry.d.ts.map
1273
+ /**
1274
+ * Per-adapter CLI version compatibility check.
1275
+ *
1276
+ * Each adapter declares a `TestedVersionRange` — the lowest and highest CLI
1277
+ * binary versions substrate's `buildCommand` has been empirically verified
1278
+ * against. At healthCheck time, the adapter compares the live binary's
1279
+ * reported version to that range and emits a human-readable warning when the
1280
+ * live version sits outside it.
1281
+ *
1282
+ * The lesson this addresses (v0.20.131→137 Codex arc): a string-presence
1283
+ * unit test on the args array proves only that substrate constructs the args
1284
+ * it intends to. It does NOT prove that the live CLI binary still accepts or
1285
+ * honors those args. CLI flag forms drift between versions: deprecations,
1286
+ * renames, silent-acceptance-then-ignore, and harness overrides that beat
1287
+ * `-c` config flags. When substrate's tested version range and the live
1288
+ * version diverge, operators should see a noisy first-dispatch warning
1289
+ * pointing at the right place — not a seven-ship arc of fix-shaped
1290
+ * iteration on substrate when the bug actually lives in Codex (or wherever).
1291
+ *
1292
+ * Pure + exported for unit testing; each adapter's healthCheck is the caller.
1293
+ */
1294
+ /**
1295
+ * The range of CLI binary versions substrate's adapter has been verified
1296
+ * against. Bumped whenever an adapter author confirms the buildCommand args
1297
+ * still parse and behave correctly on a newer CLI release.
1298
+ */
1299
+ interface TestedVersionRange {
1300
+ /** Lowest CLI version substrate has verified against. Inclusive. */
1301
+ min: string;
1302
+ /** Highest CLI version substrate has verified against. Inclusive. */
1303
+ max: string;
1304
+ /**
1305
+ * Optional informational note about known caveats *within* the tested range
1306
+ * (e.g. "Claude Code 2.x silently ignores --max-turns; substrate's
1307
+ * options.maxTurns has no effect"). Surfaced even when compatible.
1308
+ */
1309
+ note?: string;
1310
+ }
1311
+
1312
+ //#endregion
1313
+ //#region packages/core/dist/adapters/claude-adapter.d.ts
1265
1314
  /**
1266
1315
  * Adapter for the Claude Code CLI agent.
1267
1316
  *
@@ -1273,6 +1322,18 @@ declare class ClaudeCodeAdapter implements WorkerAdapter {
1273
1322
  readonly id: AgentId;
1274
1323
  readonly displayName = "Claude Code";
1275
1324
  readonly adapterVersion = "1.0.0";
1325
+ /**
1326
+ * Claude Code CLI version range substrate's `buildCommand` has been
1327
+ * empirically verified against (as of substrate v0.20.138 on 2026-05-31).
1328
+ * `healthCheck` compares the live `claude --version` against this range
1329
+ * and surfaces a warning when the operator's CLI is outside it.
1330
+ *
1331
+ * The `note` flags `--max-turns`: the flag is silently accepted by clap
1332
+ * but not honored — substrate's `options.maxTurns` has no effect on
1333
+ * Claude Code 2.x dispatches. Bumping the upper bound requires re-running
1334
+ * the empirical audit (see `feedback_cli_adapter_empirical_version_match`).
1335
+ */
1336
+ static readonly TESTED_CLI_VERSION_RANGE: TestedVersionRange;
1276
1337
  private readonly _logger;
1277
1338
  constructor(logger?: ILogger);
1278
1339
  /**
@@ -1323,6 +1384,22 @@ declare class CodexCLIAdapter implements WorkerAdapter {
1323
1384
  readonly id: AgentId;
1324
1385
  readonly displayName = "Codex CLI";
1325
1386
  readonly adapterVersion = "1.0.0";
1387
+ /**
1388
+ * Codex CLI version range substrate's `buildCommand` has been empirically
1389
+ * verified against (as of substrate v0.20.138 on 2026-05-31). The range
1390
+ * is narrow because the v0.20.131→137 arc taught us how much can drift
1391
+ * between minor versions — `--full-auto` changed meaning between 0.111.0
1392
+ * and 0.128.0 (deprecated, semantics shifted) and almost certainly will
1393
+ * drift again.
1394
+ *
1395
+ * The `note` flags the structural truth: `codex exec` hardcodes
1396
+ * `approval_policy=Never` and ignores `-c approval_policy=...` overrides
1397
+ * (codex-rs/exec/src/lib.rs:407). On enterprise managed configs that
1398
+ * disallow `Never`, dispatch will fail at the apply_patch layer regardless
1399
+ * of substrate's flag — see CODEX_SANDBOX_BLOCK_HINT and the policy ask
1400
+ * document in `docs/2026-05-29-codex-managed-config-policy-ask.md`.
1401
+ */
1402
+ static readonly TESTED_CLI_VERSION_RANGE: TestedVersionRange;
1326
1403
  private readonly _logger;
1327
1404
  constructor(logger?: ILogger);
1328
1405
  /**
@@ -1333,30 +1410,37 @@ declare class CodexCLIAdapter implements WorkerAdapter {
1333
1410
  * Build spawn command for a coding task.
1334
1411
  * Uses: `codex exec` with prompt delivered via stdin.
1335
1412
  *
1336
- * `--full-auto` is Codex's documented `exec` convenience alias for
1337
- * `-a on-request --sandbox workspace-write` the standard low-friction
1338
- * non-interactive automation mode. We use this form for three reasons:
1413
+ * `--sandbox workspace-write` is Codex's documented form for non-interactive
1414
+ * automation as of v0.128.0+. The `--full-auto` flag (used in v0.20.136) was
1415
+ * deprecated in Codex v0.128.0 and now prints a warning on every invocation:
1416
+ * `warning: --full-auto is deprecated; use --sandbox workspace-write instead.`
1417
+ *
1418
+ * **There is no flag form that can override `approval_policy` on `codex exec`.**
1419
+ * Per Codex source at tag `rust-v0.134.0`:
1420
+ * - `codex-rs/exec/src/lib.rs:407` — the `exec` harness hardcodes
1421
+ * `ConfigOverrides { approval_policy: Some(AskForApproval::Never), ... }`
1422
+ * unconditionally.
1423
+ * - `codex-rs/core/src/config/mod.rs:2902-2914` — harness overrides beat
1424
+ * both `-c approval_policy=...` and any TOML config.
1425
+ * - `codex-rs/exec/src/cli.rs` + `codex-rs/utils/cli/src/shared_options.rs`
1426
+ * — zero references to `--ask-for-approval` on the `exec` subcommand;
1427
+ * `-a` is top-level only and is silently ignored if placed after `exec`.
1339
1428
  *
1340
- * 1. **It parses cleanly on `exec`.** `--full-auto` is a documented
1341
- * subcommand flag (`codex exec --help` lists it). The earlier substrate
1342
- * attempts hit two failure modes: `--ask-for-approval` is top-level
1343
- * only and errors `unexpected argument` after `exec` (v0.20.131–133),
1344
- * and `-c approval_policy=never` parses but gets silently downshifted
1345
- * under enterprise cloud-managed policies that disallow `Never`
1346
- * (v0.20.134–135 the operator's pv-core-harness case).
1347
- * 2. **`OnRequest` works with `apply_patch` in `workspace-write`.** Per
1348
- * Codex source (`codex-rs/core/src/safety.rs:33-116`), `OnRequest`
1349
- * falls through to `is_write_patch_constrained_to_writable_paths` and
1350
- * AUTO-APPROVES `apply_patch` calls when every target path is inside
1351
- * the writable roots of an active platform sandbox. So Codex writes
1352
- * land in `exec` mode without any approval prompt or escalation.
1353
- * `UnlessTrusted` is the only policy with the broken `TODO(ragona)`
1354
- * branch that unconditionally asks for approval — we avoid it.
1355
- * 3. **`OnRequest` is broadly allow-listed.** Enterprise cloud policies
1356
- * that disallow `Never` typically still permit `OnRequest`
1357
- * (it's strictly more conservative). `--full-auto` is therefore the
1358
- * form most likely to work across both unrestricted and managed Codex
1359
- * installs.
1429
+ * So `codex exec` deterministically runs with `approval_policy=Never`,
1430
+ * regardless of what flags substrate passes. On non-enterprise installs
1431
+ * this is fine: `Never` + `--sandbox workspace-write` + `apply_patch` inside
1432
+ * writable roots = auto-approve via the writable-paths fall-through
1433
+ * (`assess_patch_safety` in `codex-rs/core/src/safety.rs:138`).
1434
+ *
1435
+ * On enterprise installs with managed configs that disallow `Never`,
1436
+ * the hardcoded `Some(Never)` fails the constrained-set check, falls back
1437
+ * to `UnlessTrusted`, and `UnlessTrusted` hits a maintainer-flagged defect
1438
+ * (`TODO(ragona)` at `safety.rs:54-58`) that returns `AskUser` unconditionally
1439
+ * — which `exec` mode rejects with `file change approval is not supported`.
1440
+ * **No substrate flag combination unblocks this case**; the structural fix
1441
+ * is either an org-policy change (add `Never` to `allowed_approval_policies`)
1442
+ * or an upstream Codex fix (issue #10949, open since v0.98.0). The
1443
+ * `CODEX_SANDBOX_BLOCK_HINT` below names both escalation paths.
1360
1444
  *
1361
1445
  * Not the org-blocked `--dangerously-bypass-approvals-and-sandbox` flag.
1362
1446
  * The planning command stays read-only (it must not write).
@@ -1406,6 +1490,15 @@ declare class GeminiCLIAdapter implements WorkerAdapter {
1406
1490
  readonly id: AgentId;
1407
1491
  readonly displayName = "Gemini CLI";
1408
1492
  readonly adapterVersion = "1.0.0";
1493
+ /**
1494
+ * Gemini CLI version range substrate's `buildCommand` has been empirically
1495
+ * verified against (as of substrate v0.20.138 on 2026-05-31). Empirical
1496
+ * audit confirmed `-p`, `-m/--model`, `-o/--output-format` (with choices
1497
+ * `text|json|stream-json`) and the planning command's positional-prompt form
1498
+ * all parse cleanly on both 0.33.0 and 0.44.1 — same flag layer across a
1499
+ * meaningful version span.
1500
+ */
1501
+ static readonly TESTED_CLI_VERSION_RANGE: TestedVersionRange;
1409
1502
  private readonly _logger;
1410
1503
  constructor(logger?: ILogger);
1411
1504
  /**
@@ -1467,4 +1560,4 @@ interface Recommendation {
1467
1560
 
1468
1561
  //#endregion
1469
1562
  export { AdapterDiscoveryResult, AdapterRegistry as AdapterRegistry$1, AdtError as AdtError$1, ClaudeCodeAdapter as ClaudeCodeAdapter$1, CodexCLIAdapter as CodexCLIAdapter$1, ConfigError as ConfigError$1, ConfigIncompatibleFormatError as ConfigIncompatibleFormatError$1, CoreEvents, DatabaseAdapter, DiscoveryReport, GeminiCLIAdapter as GeminiCLIAdapter$1, Recommendation, TypedEventBus };
1470
- //# sourceMappingURL=index-ChoQK2tb.d.ts.map
1563
+ //# sourceMappingURL=index-BJEANS9i.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { AdapterDiscoveryResult, AdapterRegistry$1 as AdapterRegistry, AdtError$1 as AdtError, ClaudeCodeAdapter$1 as ClaudeCodeAdapter, CodexCLIAdapter$1 as CodexCLIAdapter, ConfigError$1 as ConfigError, ConfigIncompatibleFormatError$1 as ConfigIncompatibleFormatError, DiscoveryReport, GeminiCLIAdapter$1 as GeminiCLIAdapter, Recommendation, TypedEventBus } from "./index-ChoQK2tb.js";
1
+ import { AdapterDiscoveryResult, AdapterRegistry$1 as AdapterRegistry, AdtError$1 as AdtError, ClaudeCodeAdapter$1 as ClaudeCodeAdapter, CodexCLIAdapter$1 as CodexCLIAdapter, ConfigError$1 as ConfigError, ConfigIncompatibleFormatError$1 as ConfigIncompatibleFormatError, DiscoveryReport, GeminiCLIAdapter$1 as GeminiCLIAdapter, Recommendation, TypedEventBus } from "./index-BJEANS9i.js";
2
2
  import pino from "pino";
3
3
  import { z } from "zod";
4
4
  import { Readable, Writable } from "node:stream";
@@ -2162,6 +2162,14 @@ interface AdapterHealthResult {
2162
2162
  detectedBillingModes?: BillingMode[];
2163
2163
  /** Whether the CLI supports headless/non-interactive mode */
2164
2164
  supportsHeadless: boolean;
2165
+ /**
2166
+ * v0.20.138: human-readable note when the live CLI binary version is
2167
+ * outside substrate's tested range, OR when the tested range carries
2168
+ * an informational caveat even within range. Mirrors the field on the
2169
+ * @substrate-ai/core type (separate definition is the same dual-schema
2170
+ * pattern Epic 79's contracts package is designed to consolidate).
2171
+ */
2172
+ compatibilityWarning?: string;
2165
2173
  }
2166
2174
  /**
2167
2175
  * Parsed result from a task execution.
package/dist/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { childLogger, createLogger, logger } from "./logger-KeHncl-f.js";
2
2
  import { assertDefined, createEventBus, createTuiApp, deepClone, formatDuration, generateId, isPlainObject, isTuiCapable, printNonTtyWarning, sleep, withRetry } from "./helpers-CElYrONe.js";
3
- import { AdapterRegistry, AdtError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter } from "./dist-T6ZXe2Q2.js";
3
+ import { AdapterRegistry, AdtError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter } from "./dist-DnvGvKLu.js";
4
4
  import "./adapter-registry-DIcrxjH8.js";
5
- import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-C-9u7gCX.js";
5
+ import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-i3s5sshZ.js";
6
6
 
7
7
  //#region src/core/di.ts
8
8
  /**
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { readCurrentRunId, resolveMainRepoRoot } from "./manifest-read-C84VX-CF.js";
2
+ import { readCurrentRunId, resolveMainRepoRoot } from "./manifest-read-DJFbGhSd.js";
3
3
  import { join } from "node:path";
4
4
  import { mkdir, readFile, writeFile } from "node:fs/promises";
5
5
  import * as readline from "node:readline";
@@ -180,4 +180,4 @@ async function runInteractivePrompt(decisionContext) {
180
180
 
181
181
  //#endregion
182
182
  export { runInteractivePrompt };
183
- //# sourceMappingURL=interactive-prompt-wZnuOAri.js.map
183
+ //# sourceMappingURL=interactive-prompt-B91mG5v4.js.map
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-T6ZXe2Q2.js";
2
+ import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-DnvGvKLu.js";
3
3
  import * as path$1 from "path";
4
4
  import { join } from "path";
5
5
  import { readFile } from "fs/promises";
@@ -5851,4 +5851,4 @@ async function resolveRunManifest(dbRoot, runId) {
5851
5851
 
5852
5852
  //#endregion
5853
5853
  export { FindingsInjector, RunManifest, RuntimeProbeListSchema, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, applyConfigToGraph, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, parseRuntimeProbes, readCurrentRunId, renderFindings, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck, runStaleVerificationRecovery };
5854
- //# sourceMappingURL=manifest-read-C84VX-CF.js.map
5854
+ //# sourceMappingURL=manifest-read-DJFbGhSd.js.map
@@ -1,6 +1,6 @@
1
1
  import "../../logger-KeHncl-f.js";
2
- import "../../dist-T6ZXe2Q2.js";
3
- import "../../manifest-read-C84VX-CF.js";
4
- import { runInteractivePrompt } from "../../interactive-prompt-wZnuOAri.js";
2
+ import "../../dist-DnvGvKLu.js";
3
+ import "../../manifest-read-DJFbGhSd.js";
4
+ import { runInteractivePrompt } from "../../interactive-prompt-B91mG5v4.js";
5
5
 
6
6
  export { runInteractivePrompt };
@@ -1,4 +1,4 @@
1
- import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-T6ZXe2Q2.js";
1
+ import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-DnvGvKLu.js";
2
2
  import "./routing-DFxoKHDt.js";
3
3
 
4
4
  export { loadModelRoutingConfig };
@@ -1,11 +1,11 @@
1
- import { BMAD_BASELINE_TOKENS_FULL, FileKvStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, validateStoryKey } from "./health-COhVUNXM.js";
1
+ import { BMAD_BASELINE_TOKENS_FULL, FileKvStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, validateStoryKey } from "./health-2Kfa00-H.js";
2
2
  import { createLogger } from "./logger-KeHncl-f.js";
3
3
  import { TypedEventBusImpl, createEventBus, createTuiApp, isTuiCapable, printNonTtyWarning, sleep } from "./helpers-CElYrONe.js";
4
- import { ADVISORY_NOTES, CODEX_SANDBOX_BLOCK_HINT, Categorizer, ConsumerAnalyzer, DEFAULT_GLOBAL_SETTINGS, DispatcherImpl, DoltClient, ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, EfficiencyScorer, IngestionServer, LogTurnAnalyzer, OPERATIONAL_FINDING, Recommender, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, STORY_METRICS, STORY_OUTCOME, SubstrateConfigSchema, TEST_EXPANSION_FINDING, TEST_PLAN, TelemetryNormalizer, TelemetryPipeline, TurnAnalyzer, addTokenUsage, aggregateTokenUsageForRun, aggregateTokenUsageForStory, callLLM, classifyVersionGap, createConfigSystem, createDatabaseAdapter$1, createDecision, createPipelineRun, createRequirement, createStderrLogger, detectCodexSandboxBlock, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunMetrics, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, listRequirements, loadModelRoutingConfig, registerArtifact, swallowDebug, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-T6ZXe2Q2.js";
5
- import { FindingsInjector, RunManifest, RuntimeProbeListSchema, applyConfigToGraph, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, parseRuntimeProbes, renderFindings, resolveGraphPath, resolveMainRepoRoot, runAcTraceabilityCheck, runStaleVerificationRecovery } from "./manifest-read-C84VX-CF.js";
4
+ import { ADVISORY_NOTES, CODEX_SANDBOX_BLOCK_HINT, Categorizer, ConsumerAnalyzer, DEFAULT_GLOBAL_SETTINGS, DispatcherImpl, DoltClient, ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, EfficiencyScorer, IngestionServer, LogTurnAnalyzer, OPERATIONAL_FINDING, Recommender, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, STORY_METRICS, STORY_OUTCOME, SubstrateConfigSchema, TEST_EXPANSION_FINDING, TEST_PLAN, TelemetryNormalizer, TelemetryPipeline, TurnAnalyzer, addTokenUsage, aggregateTokenUsageForRun, aggregateTokenUsageForStory, callLLM, classifyVersionGap, createConfigSystem, createDatabaseAdapter$1, createDecision, createPipelineRun, createRequirement, createStderrLogger, detectCodexSandboxBlock, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunMetrics, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, listRequirements, loadModelRoutingConfig, registerArtifact, swallowDebug, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-DnvGvKLu.js";
5
+ import { FindingsInjector, RunManifest, RuntimeProbeListSchema, applyConfigToGraph, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, parseRuntimeProbes, renderFindings, resolveGraphPath, resolveMainRepoRoot, runAcTraceabilityCheck, runStaleVerificationRecovery } from "./manifest-read-DJFbGhSd.js";
6
6
  import { WorkGraphRepository, detectCycles } from "./work-graph-repository-DZyJv5pV.js";
7
7
  import { deriveExitCode, routeDecision } from "./decision-router-DblHY8se.js";
8
- import { runInteractivePrompt } from "./interactive-prompt-wZnuOAri.js";
8
+ import { runInteractivePrompt } from "./interactive-prompt-B91mG5v4.js";
9
9
  import { runRecoveryEngine } from "./recovery-engine-BKGBeBnW.js";
10
10
  import { basename, dirname, extname, join } from "path";
11
11
  import { access, readFile, readdir, stat } from "fs/promises";
@@ -47442,7 +47442,7 @@ async function runFullPipeline(options) {
47442
47442
  */
47443
47443
  async function emitPreDispatchVersionAdvisory(currentVersion) {
47444
47444
  if (process.env["SUBSTRATE_NO_UPDATE_CHECK"] === "1") return;
47445
- const { createVersionManager } = await import("./version-manager-impl-BLXt2ucf.js");
47445
+ const { createVersionManager } = await import("./version-manager-impl-C7ZhqLX3.js");
47446
47446
  const vm = createVersionManager();
47447
47447
  const result = await vm.checkForUpdates(true);
47448
47448
  const gap = classifyVersionGap(currentVersion, result.latestVersion);
@@ -47539,4 +47539,4 @@ function registerRunCommand(program, version = "0.0.0", projectRoot = process.cw
47539
47539
 
47540
47540
  //#endregion
47541
47541
  export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR$1 as GLOBSTAR, GitClient, GrammarLoader, Minimatch$1 as Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape$1 as escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runRunAction, runSolutioningPhase, unescape$1 as unescape, validateStopAfterFromConflict, wireNdjsonEmitter };
47542
- //# sourceMappingURL=run-lBgnO-3E.js.map
47542
+ //# sourceMappingURL=run-Dbwlb4Md.js.map
@@ -1,14 +1,14 @@
1
- import "./health-COhVUNXM.js";
1
+ import "./health-2Kfa00-H.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
- import "./dist-T6ZXe2Q2.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-lBgnO-3E.js";
6
- import "./manifest-read-C84VX-CF.js";
4
+ import "./dist-DnvGvKLu.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-Dbwlb4Md.js";
6
+ import "./manifest-read-DJFbGhSd.js";
7
7
  import "./routing-DFxoKHDt.js";
8
8
  import "./work-graph-repository-DZyJv5pV.js";
9
9
  import "./decisions-CzSIEeGP.js";
10
10
  import "./decision-router-DblHY8se.js";
11
- import "./interactive-prompt-wZnuOAri.js";
11
+ import "./interactive-prompt-B91mG5v4.js";
12
12
  import "./recovery-engine-BKGBeBnW.js";
13
13
 
14
14
  export { runRunAction };
@@ -1,4 +1,4 @@
1
- import { CoreEvents, DatabaseAdapter, TypedEventBus } from "../../../index-ChoQK2tb.js";
1
+ import { CoreEvents, DatabaseAdapter, TypedEventBus } from "../../../index-BJEANS9i.js";
2
2
  import { z } from "zod";
3
3
 
4
4
  //#region packages/sdlc/dist/verification/findings.d.ts
@@ -1,5 +1,5 @@
1
- import "./dist-T6ZXe2Q2.js";
1
+ import "./dist-DnvGvKLu.js";
2
2
  import "./version-manager-impl-qFBiO4Eh.js";
3
- import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-CZMWjtYN.js";
3
+ import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-yULZIAAW.js";
4
4
 
5
5
  export { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand };
@@ -1,4 +1,4 @@
1
- import { createVersionManager } from "./dist-T6ZXe2Q2.js";
1
+ import { createVersionManager } from "./dist-DnvGvKLu.js";
2
2
  import { execSync, spawn } from "child_process";
3
3
  import * as readline from "readline";
4
4
 
@@ -123,4 +123,4 @@ function registerUpgradeCommand(program) {
123
123
 
124
124
  //#endregion
125
125
  export { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand };
126
- //# sourceMappingURL=upgrade-CZMWjtYN.js.map
126
+ //# sourceMappingURL=upgrade-yULZIAAW.js.map
@@ -1,4 +1,4 @@
1
- import { VersionManagerImpl, createVersionManager } from "./dist-T6ZXe2Q2.js";
1
+ import { VersionManagerImpl, createVersionManager } from "./dist-DnvGvKLu.js";
2
2
  import "./version-manager-impl-qFBiO4Eh.js";
3
3
 
4
4
  export { createVersionManager };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.20.136",
3
+ "version": "0.20.138",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -1,4 +0,0 @@
1
- import { AdapterRegistry } from "./dist-T6ZXe2Q2.js";
2
- import "./adapter-registry-DIcrxjH8.js";
3
-
4
- export { AdapterRegistry };