substrate-ai 0.20.138 → 0.20.141

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 (27) hide show
  1. package/dist/adapter-registry-qU0IkbbQ.js +4 -0
  2. package/dist/cli/index.js +41 -37
  3. package/dist/{decision-router-DblHY8se.js → decision-router-BAPpON_C.js} +4 -2
  4. package/dist/{decisions-fBdZmqOK.js → decisions-Dvw5HhyM.js} +1 -1
  5. package/dist/{dist-DnvGvKLu.js → dist-DiNK6QOD.js} +104 -17
  6. package/dist/{errors-i3s5sshZ.js → errors-B21JUhcc.js} +2 -2
  7. package/dist/{experimenter-DU2Cv51N.js → experimenter-D55L011w.js} +1 -1
  8. package/dist/{health-2Kfa00-H.js → health-BQRsVP6s.js} +3 -3
  9. package/dist/{health-Caa24SFM.js → health-Cm-pA1mZ.js} +3 -3
  10. package/dist/{index-BJEANS9i.d.ts → index-BqVBOAO0.d.ts} +25 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +2 -2
  13. package/dist/{interactive-prompt-B91mG5v4.js → interactive-prompt-CgerI5Y6.js} +2 -2
  14. package/dist/{manifest-read-DJFbGhSd.js → manifest-read-Doh2Ion5.js} +17 -3
  15. package/dist/modules/interactive-prompt/index.js +3 -3
  16. package/dist/{routing-DFIBY9Yk.js → routing-_PGfe_cD.js} +1 -1
  17. package/dist/{run-Ppco-3HT.js → run-BHRkyn_H.js} +6 -6
  18. package/dist/{run-Dbwlb4Md.js → run-CRvusFIv.js} +674 -183
  19. package/dist/src/modules/decision-router/index.d.ts +1 -1
  20. package/dist/src/modules/decision-router/index.js +1 -1
  21. package/dist/src/modules/recovery-engine/index.d.ts +9 -1
  22. package/dist/{upgrade-CnIsoLpT.js → upgrade-CTj4hi8J.js} +2 -2
  23. package/dist/{upgrade-yULZIAAW.js → upgrade-DB7KzD9c.js} +2 -2
  24. package/dist/{version-manager-impl-C7ZhqLX3.js → version-manager-impl-HJMonRJi.js} +1 -1
  25. package/package.json +3 -3
  26. package/packs/bmad/prompts/probe-author.md +17 -0
  27. package/dist/adapter-registry-Bpa7ESBV.js +0 -4
@@ -0,0 +1,4 @@
1
+ import { AdapterRegistry } from "./dist-DiNK6QOD.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-2Kfa00-H.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-BQRsVP6s.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-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";
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-DiNK6QOD.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-CRvusFIv.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-DJFbGhSd.js";
9
- import "../errors-i3s5sshZ.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-Doh2Ion5.js";
9
+ import "../errors-B21JUhcc.js";
10
10
  import "../routing-DFxoKHDt.js";
11
11
  import { WorkGraphRepository } from "../work-graph-repository-DZyJv5pV.js";
12
12
  import "../decisions-CzSIEeGP.js";
13
- import "../decision-router-DblHY8se.js";
14
- import "../interactive-prompt-B91mG5v4.js";
13
+ import "../decision-router-BAPpON_C.js";
14
+ import "../interactive-prompt-CgerI5Y6.js";
15
15
  import "../recovery-engine-BKGBeBnW.js";
16
16
  import "../version-manager-impl-qFBiO4Eh.js";
17
- import { registerUpgradeCommand } from "../upgrade-yULZIAAW.js";
17
+ import { registerUpgradeCommand } from "../upgrade-DB7KzD9c.js";
18
18
  import { Command } from "commander";
19
19
  import { fileURLToPath } from "url";
20
20
  import { dirname, join, resolve } from "path";
@@ -7036,7 +7036,7 @@ async function runStatusAction(options) {
7036
7036
  logger$15.debug({ err }, "Work graph query failed, continuing without work graph data");
7037
7037
  }
7038
7038
  if (run === void 0) {
7039
- const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-Caa24SFM.js");
7039
+ const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-Cm-pA1mZ.js");
7040
7040
  const substrateDirPath = join(projectRoot, ".substrate");
7041
7041
  const processInfo = inspectProcessTree$1({
7042
7042
  projectRoot,
@@ -7984,7 +7984,7 @@ function defaultSupervisorDeps() {
7984
7984
  if (cached === null) {
7985
7985
  const { AdapterRegistry: AR } = await import(
7986
7986
  /* @vite-ignore */
7987
- "../adapter-registry-Bpa7ESBV.js"
7987
+ "../adapter-registry-qU0IkbbQ.js"
7988
7988
  );
7989
7989
  cached = new AR();
7990
7990
  await cached.discoverAndRegister();
@@ -8551,11 +8551,11 @@ async function runSupervisorAction(options, deps = {}) {
8551
8551
  try {
8552
8552
  const { createExperimenter } = await import(
8553
8553
  /* @vite-ignore */
8554
- "../experimenter-DU2Cv51N.js"
8554
+ "../experimenter-D55L011w.js"
8555
8555
  );
8556
8556
  const { getLatestRun: getLatest } = await import(
8557
8557
  /* @vite-ignore */
8558
- "../decisions-fBdZmqOK.js"
8558
+ "../decisions-Dvw5HhyM.js"
8559
8559
  );
8560
8560
  const expAdapter = createDatabaseAdapter({
8561
8561
  backend: "auto",
@@ -8565,7 +8565,7 @@ async function runSupervisorAction(options, deps = {}) {
8565
8565
  await initSchema(expAdapter);
8566
8566
  const { runRunAction: runPipeline } = await import(
8567
8567
  /* @vite-ignore */
8568
- "../run-Ppco-3HT.js"
8568
+ "../run-BHRkyn_H.js"
8569
8569
  );
8570
8570
  const runStoryFn = async (opts) => {
8571
8571
  const exitCode = await runPipeline({
@@ -9090,7 +9090,7 @@ async function runMetricsAction(options) {
9090
9090
  const routingConfigPath = join(dbDir, "routing.yml");
9091
9091
  let routingConfig = null;
9092
9092
  if (existsSync$1(routingConfigPath)) try {
9093
- const { loadModelRoutingConfig } = await import("../routing-DFIBY9Yk.js");
9093
+ const { loadModelRoutingConfig } = await import("../routing-_PGfe_cD.js");
9094
9094
  routingConfig = loadModelRoutingConfig(routingConfigPath);
9095
9095
  } catch {}
9096
9096
  if (routingConfig === null) routingConfig = {
@@ -10505,7 +10505,7 @@ async function listWorktreesAction(options) {
10505
10505
  * @returns - Exit code (0 = success, 1 = error)
10506
10506
  */
10507
10507
  async function cleanupWorktreesAction(options) {
10508
- const { taskId, projectRoot } = options;
10508
+ const { taskId, projectRoot, force } = options;
10509
10509
  try {
10510
10510
  const eventBus = createEventBus();
10511
10511
  const manager = createGitWorktreeManager({
@@ -10513,7 +10513,7 @@ async function cleanupWorktreesAction(options) {
10513
10513
  projectRoot
10514
10514
  });
10515
10515
  if (taskId !== void 0) try {
10516
- await manager.cleanupWorktree(taskId);
10516
+ await manager.cleanupWorktree(taskId, { force: force === true });
10517
10517
  process.stdout.write(`Cleaned up worktree for task "${taskId}"\n`);
10518
10518
  return WORKTREES_EXIT_SUCCESS;
10519
10519
  } catch (err) {
@@ -10526,8 +10526,9 @@ async function cleanupWorktreesAction(options) {
10526
10526
  return WORKTREES_EXIT_ERROR;
10527
10527
  }
10528
10528
  try {
10529
- const cleaned = await manager.cleanupAllWorktrees();
10529
+ const cleaned = await manager.cleanupAllWorktrees({ force: force === true });
10530
10530
  process.stdout.write(`Cleaned up ${cleaned} worktree${cleaned === 1 ? "" : "s"}\n`);
10531
+ if (force !== true) process.stdout.write("Worktrees with uncommitted work or unmerged branch commits were preserved — re-run with --force to discard them.\n");
10531
10532
  return WORKTREES_EXIT_SUCCESS;
10532
10533
  } catch (err) {
10533
10534
  const message = err instanceof Error ? err.message : String(err);
@@ -10550,12 +10551,13 @@ async function cleanupWorktreesAction(options) {
10550
10551
  * @param projectRoot - Project root directory (defaults to process.cwd())
10551
10552
  */
10552
10553
  function registerWorktreesCommand(program, version = "0.0.0", projectRoot = process.cwd()) {
10553
- program.command("worktrees").description("List or clean up substrate git worktrees and their task branches").option("--output-format <format>", "Output format: table (default) or json", "table").option("--json", "Output JSON (shorthand for --output-format json)", false).option("--status <status>", `Filter by task status: ${VALID_STATUSES.join(", ")}`).option("--sort <key>", `Sort by: ${VALID_SORT_KEYS.join(", ")} (default: created)`, "created").option("--cleanup [task-id]", "Remove substrate worktree(s) and branches. Pass a task id to remove just one; omit the arg to remove all.").action(async (opts) => {
10554
+ program.command("worktrees").description("List or clean up substrate git worktrees and their task branches").option("--output-format <format>", "Output format: table (default) or json", "table").option("--json", "Output JSON (shorthand for --output-format json)", false).option("--status <status>", `Filter by task status: ${VALID_STATUSES.join(", ")}`).option("--sort <key>", `Sort by: ${VALID_SORT_KEYS.join(", ")} (default: created)`, "created").option("--cleanup [task-id]", "Remove substrate worktree(s) and branches. Pass a task id to remove just one; omit the arg to remove all.").option("--force", "Discard worktrees even when they hold uncommitted work or unmerged branch commits.", false).action(async (opts) => {
10554
10555
  if (opts.cleanup !== void 0 && opts.cleanup !== false) {
10555
10556
  const taskId = typeof opts.cleanup === "string" && opts.cleanup.trim().length > 0 ? opts.cleanup.trim() : void 0;
10556
10557
  const cleanupExitCode = await cleanupWorktreesAction({
10557
10558
  ...taskId !== void 0 ? { taskId } : {},
10558
- projectRoot
10559
+ projectRoot,
10560
+ force: opts.force
10559
10561
  });
10560
10562
  process.exitCode = cleanupExitCode;
10561
10563
  return;
@@ -12376,22 +12378,24 @@ async function readRunEntry(dbRoot, resolvedRunId) {
12376
12378
  * bash-session-drift footgun documented in obs_025.
12377
12379
  */
12378
12380
  function detectAutoCommit(storyKey, startedAt, projectRoot) {
12379
- const grepPattern = `feat(story-${storyKey})`;
12380
- const result = spawnSync("git", [
12381
- "log",
12382
- "--oneline",
12383
- `--since=${startedAt}`,
12384
- `--grep=${grepPattern}`
12385
- ], {
12386
- cwd: projectRoot,
12387
- encoding: "utf-8",
12388
- timeout: 1e4
12389
- });
12390
- if (result.status !== 0 || !result.stdout?.trim()) return void 0;
12391
- const lines = result.stdout.trim().split("\n").filter(Boolean);
12392
- for (const line of lines) {
12393
- const sha = line.split(" ")[0];
12394
- if (sha) return sha;
12381
+ for (const prefix of ["feat", "wip"]) {
12382
+ const grepPattern = `${prefix}(story-${storyKey})`;
12383
+ const result = spawnSync("git", [
12384
+ "log",
12385
+ "--oneline",
12386
+ `--since=${startedAt}`,
12387
+ `--grep=${grepPattern}`
12388
+ ], {
12389
+ cwd: projectRoot,
12390
+ encoding: "utf-8",
12391
+ timeout: 1e4
12392
+ });
12393
+ if (result.status !== 0 || !result.stdout?.trim()) continue;
12394
+ const lines = result.stdout.trim().split("\n").filter(Boolean);
12395
+ for (const line of lines) {
12396
+ const sha = line.split(" ")[0];
12397
+ if (sha) return sha;
12398
+ }
12395
12399
  }
12396
12400
  return void 0;
12397
12401
  }
@@ -13400,8 +13404,8 @@ async function createProgram() {
13400
13404
  /** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
13401
13405
  function checkForUpdatesInBackground(currentVersion) {
13402
13406
  if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
13403
- import("../upgrade-CnIsoLpT.js").then(async () => {
13404
- const { createVersionManager } = await import("../version-manager-impl-C7ZhqLX3.js");
13407
+ import("../upgrade-CTj4hi8J.js").then(async () => {
13408
+ const { createVersionManager } = await import("../version-manager-impl-HJMonRJi.js");
13405
13409
  const vm = createVersionManager();
13406
13410
  const result = await vm.checkForUpdates();
13407
13411
  if (result.updateAvailable) {
@@ -15,6 +15,7 @@ const DECISION_SEVERITY_MAP = {
15
15
  "scope-violation": "fatal",
16
16
  "cross-story-race-recovered": "info",
17
17
  "cross-story-race-still-failed": "critical",
18
+ "auth-failure": "fatal",
18
19
  "pipeline-escalation": "warning"
19
20
  };
20
21
  /**
@@ -29,7 +30,8 @@ const DEFAULT_ACTION_MAP = {
29
30
  "scope-violation": "abort-pipeline",
30
31
  "cross-story-race-recovered": "continue-autonomous",
31
32
  "cross-story-race-still-failed": "escalate-without-halt",
32
- "pipeline-escalation": "escalate-without-halt"
33
+ "pipeline-escalation": "escalate-without-halt",
34
+ "auth-failure": "abort-pipeline"
33
35
  };
34
36
  /** Fallback default action for unknown decision types. */
35
37
  const DEFAULT_DEFAULT_ACTION = "escalate-without-halt";
@@ -94,4 +96,4 @@ function deriveExitCode(outcome) {
94
96
 
95
97
  //#endregion
96
98
  export { DECISION_SEVERITY_MAP, deriveExitCode, routeDecision };
97
- //# sourceMappingURL=decision-router-DblHY8se.js.map
99
+ //# sourceMappingURL=decision-router-BAPpON_C.js.map
@@ -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-DnvGvKLu.js";
1
+ import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-DiNK6QOD.js";
2
2
  import "./decisions-CzSIEeGP.js";
3
3
 
4
4
  export { getLatestRun };
@@ -1414,7 +1414,10 @@ var DispatcherImpl = class {
1414
1414
  this._running.delete(id);
1415
1415
  this._drainQueue();
1416
1416
  if (code === 0) {
1417
- const normalizeResult = this._normalizer.normalize(stdout, agent);
1417
+ const streamOutput = adapter.parseStreamOutput?.(stdout);
1418
+ const effectiveStdout = streamOutput?.extractedText ?? stdout;
1419
+ const totalTurns = streamOutput?.totalTurns;
1420
+ const normalizeResult = this._normalizer.normalize(effectiveStdout, agent);
1418
1421
  let parsed = null;
1419
1422
  let parseError = null;
1420
1423
  if (normalizeResult instanceof AdapterFormatError) {
@@ -1423,13 +1426,13 @@ var DispatcherImpl = class {
1423
1426
  normalizeResult.tried_strategies.join(","),
1424
1427
  normalizeResult.raw_output_snippet
1425
1428
  ].join(" | ");
1426
- const quality$1 = estimateOutputQuality(stdout);
1429
+ const quality$1 = estimateOutputQuality(effectiveStdout);
1427
1430
  this._eventBus.emit("agent:completed", {
1428
1431
  dispatchId: id,
1429
1432
  exitCode: code,
1430
- output: stdout,
1433
+ output: effectiveStdout,
1431
1434
  inputTokens,
1432
- outputTokens: Math.ceil(stdout.length / CHARS_PER_TOKEN$3),
1435
+ outputTokens: Math.ceil(effectiveStdout.length / CHARS_PER_TOKEN$3),
1433
1436
  qualityScore: quality$1.qualityScore,
1434
1437
  agent,
1435
1438
  ...effectiveModel !== void 0 && { model: effectiveModel }
@@ -1445,7 +1448,7 @@ var DispatcherImpl = class {
1445
1448
  id,
1446
1449
  status: "completed",
1447
1450
  exitCode: code,
1448
- output: stdout,
1451
+ output: effectiveStdout,
1449
1452
  parsed: null,
1450
1453
  parseError: errMsg,
1451
1454
  adapterError: true,
@@ -1454,16 +1457,17 @@ var DispatcherImpl = class {
1454
1457
  durationMs,
1455
1458
  tokenEstimate: {
1456
1459
  input: inputTokens,
1457
- output: Math.ceil(stdout.length / CHARS_PER_TOKEN$3)
1460
+ output: Math.ceil(effectiveStdout.length / CHARS_PER_TOKEN$3)
1458
1461
  },
1459
- ...finalModel !== void 0 ? { model: finalModel } : {}
1462
+ ...finalModel !== void 0 ? { model: finalModel } : {},
1463
+ ...totalTurns !== void 0 ? { totalTurns } : {}
1460
1464
  });
1461
1465
  return;
1462
1466
  }
1463
1467
  const parseResult = parseYamlResult(normalizeResult.yaml, outputSchema);
1464
1468
  parsed = parseResult.parsed;
1465
1469
  parseError = parseResult.error;
1466
- const quality = estimateOutputQuality(stdout);
1470
+ const quality = estimateOutputQuality(effectiveStdout);
1467
1471
  if (quality.hedgingCount > 0 || quality.qualityScore < 40) this._logger.warn({
1468
1472
  id,
1469
1473
  agent,
@@ -1474,9 +1478,9 @@ var DispatcherImpl = class {
1474
1478
  this._eventBus.emit("agent:completed", {
1475
1479
  dispatchId: id,
1476
1480
  exitCode: code,
1477
- output: stdout,
1481
+ output: effectiveStdout,
1478
1482
  inputTokens,
1479
- outputTokens: Math.ceil(stdout.length / CHARS_PER_TOKEN$3),
1483
+ outputTokens: Math.ceil(effectiveStdout.length / CHARS_PER_TOKEN$3),
1480
1484
  qualityScore: quality.qualityScore,
1481
1485
  agent,
1482
1486
  ...effectiveModel !== void 0 && { model: effectiveModel }
@@ -1492,15 +1496,16 @@ var DispatcherImpl = class {
1492
1496
  id,
1493
1497
  status: "completed",
1494
1498
  exitCode: code,
1495
- output: stdout,
1499
+ output: effectiveStdout,
1496
1500
  parsed,
1497
1501
  parseError,
1498
1502
  durationMs,
1499
1503
  tokenEstimate: {
1500
1504
  input: inputTokens,
1501
- output: Math.ceil(stdout.length / CHARS_PER_TOKEN$3)
1505
+ output: Math.ceil(effectiveStdout.length / CHARS_PER_TOKEN$3)
1502
1506
  },
1503
- ...finalModel !== void 0 ? { model: finalModel } : {}
1507
+ ...finalModel !== void 0 ? { model: finalModel } : {},
1508
+ ...totalTurns !== void 0 ? { totalTurns } : {}
1504
1509
  });
1505
1510
  } else {
1506
1511
  const stderr = Buffer.concat(stderrChunks).toString("utf-8");
@@ -9457,6 +9462,39 @@ function checkAdapterVersionCompat(adapterName, actualVersion, tested) {
9457
9462
  const execAsync$2 = promisify(exec);
9458
9463
  /** Default model used when none is specified */
9459
9464
  const DEFAULT_MODEL$1 = "claude-sonnet-4-6";
9465
+ /**
9466
+ * Signatures the Claude Code CLI emits when a dispatch dies on authentication
9467
+ * rather than doing any work (H0.4, field finding #10). Matched
9468
+ * case-insensitively against the dispatch's combined output.
9469
+ *
9470
+ * Field-verified: a stale `ANTHROPIC_API_KEY` in the operator's shell made
9471
+ * spawned CLIs reject with "auth source takes precedence over claude.ai
9472
+ * login · Invalid API key" — surfaced as `create-story-no-file`
9473
+ * (qualityScore 40) or a full 600s timeout, never as an auth error, burning
9474
+ * ~25 minutes and two runs before diagnosis.
9475
+ */
9476
+ const CLAUDE_AUTH_FAILURE_SIGNATURES = [
9477
+ "invalid api key",
9478
+ "auth source takes precedence",
9479
+ "please run /login",
9480
+ "oauth token has expired",
9481
+ "oauth token is invalid",
9482
+ "oauth token revoked",
9483
+ "authentication_error",
9484
+ "credit balance is too low"
9485
+ ];
9486
+ /** Operator-facing remediation appended to auth-failure escalations. */
9487
+ const CLAUDE_AUTH_FAILURE_HINT = "The Claude CLI rejected authentication before doing any work. Every subsequent dispatch in this run would fail identically, so the run was halted. Likely causes, in order: (1) a stale ANTHROPIC_API_KEY exported in the environment that spawned substrate — the CLI prefers it over claude.ai subscription login and rejects it if invalid (substrate scrubs the var on coding dispatches, but keys configured inside Claude Code settings/apiKeyHelper are outside substrate's control; verify with `env -u ANTHROPIC_API_KEY claude -p \"ok\"`); (2) an expired claude.ai session — run `claude login`; (3) an exhausted API credit balance when api_billing is enabled. Fix the credential, then re-run — completed stories are preserved.";
9488
+ /**
9489
+ * Returns the matched auth-failure signature if `output` shows the Claude CLI
9490
+ * dying on authentication, else null. Pure + exported for diagnostics and
9491
+ * testing (mirrors detectCodexSandboxBlock).
9492
+ */
9493
+ function detectClaudeAuthFailure(output) {
9494
+ if (output === void 0 || output === null || output === "") return null;
9495
+ const lower = output.toLowerCase();
9496
+ return CLAUDE_AUTH_FAILURE_SIGNATURES.find((sig) => lower.includes(sig)) ?? null;
9497
+ }
9460
9498
  /** Approximate characters per token for estimation */
9461
9499
  const CHARS_PER_TOKEN$2 = 3;
9462
9500
  /** Estimated output token multiplier relative to input */
@@ -9495,8 +9533,8 @@ var ClaudeCodeAdapter = class ClaudeCodeAdapter {
9495
9533
  */
9496
9534
  static TESTED_CLI_VERSION_RANGE = {
9497
9535
  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."
9536
+ max: "2.1.168",
9537
+ note: "Claude Code 2.x silently accepts but does not honor `--max-turns`; substrate no longer passes that flag. `-p --output-format stream-json` REQUIRES `--verbose` (hard error otherwise) — empirically verified against 2.1.168 (2026-06-07): with --verbose, NDJSON events emitted and `num_turns` present on the terminal result event."
9500
9538
  };
9501
9539
  _logger;
9502
9540
  constructor(logger) {
@@ -9547,6 +9585,7 @@ var ClaudeCodeAdapter = class ClaudeCodeAdapter {
9547
9585
  model,
9548
9586
  "--dangerously-skip-permissions"
9549
9587
  ];
9588
+ args.push("--output-format", "stream-json", "--verbose");
9550
9589
  if (options.additionalFlags && options.additionalFlags.length > 0) args.push(...options.additionalFlags);
9551
9590
  const systemPromptParts = [BASE_SYSTEM_PROMPT];
9552
9591
  if (options.optimizationDirectives) systemPromptParts.push(`\n\n## Optimization Directives\n${options.optimizationDirectives}`);
@@ -9590,6 +9629,51 @@ var ClaudeCodeAdapter = class ClaudeCodeAdapter {
9590
9629
  };
9591
9630
  }
9592
9631
  /**
9632
+ * Pre-process `--output-format stream-json` stdout before YAML extraction (Story 81-9).
9633
+ *
9634
+ * Claude Code CLI with `--output-format stream-json` emits NDJSON events to stdout.
9635
+ * This method parses that stream to extract:
9636
+ * 1. `extractedText` — the full agent response from the terminal result event's
9637
+ * `result` field. Identical to raw text output; passed to AdapterOutputNormalizer.
9638
+ * 2. `totalTurns` — agentic turn count from `num_turns` in the result event.
9639
+ * This is the ONLY synchronous, reliable turn-count source available at
9640
+ * DispatchResult resolution time.
9641
+ *
9642
+ * Graceful fallbacks:
9643
+ * - If the stream cannot be parsed as NDJSON, returns `{ extractedText: stdout }`.
9644
+ * - If the result event is missing, returns `{ extractedText: stdout }`.
9645
+ * - If `num_turns` is absent from the event, returns without `totalTurns` (AC2:
9646
+ * "when the count is genuinely unavailable, leave the field absent, never fabricate").
9647
+ *
9648
+ * @param stdout Raw subprocess stdout (NDJSON event stream from Claude Code CLI)
9649
+ * @returns `{ extractedText, totalTurns? }` — text for YAML extraction and optional turn count
9650
+ */
9651
+ parseStreamOutput(stdout) {
9652
+ try {
9653
+ const lines = stdout.split("\n");
9654
+ for (const line of lines) {
9655
+ const trimmed = line.trim();
9656
+ if (trimmed === "") continue;
9657
+ let event;
9658
+ try {
9659
+ event = JSON.parse(trimmed);
9660
+ } catch {
9661
+ continue;
9662
+ }
9663
+ if (event !== null && typeof event === "object" && event["type"] === "result") {
9664
+ const resultEvent = event;
9665
+ const extractedText = typeof resultEvent.result === "string" && resultEvent.result.length > 0 ? resultEvent.result : stdout;
9666
+ const totalTurns = typeof resultEvent.num_turns === "number" && resultEvent.num_turns >= 0 ? resultEvent.num_turns : void 0;
9667
+ return totalTurns !== void 0 ? {
9668
+ extractedText,
9669
+ totalTurns
9670
+ } : { extractedText };
9671
+ }
9672
+ }
9673
+ } catch {}
9674
+ return { extractedText: stdout };
9675
+ }
9676
+ /**
9593
9677
  * Build spawn command for plan generation.
9594
9678
  */
9595
9679
  buildPlanningCommand(request, options) {
@@ -9604,10 +9688,13 @@ var ClaudeCodeAdapter = class ClaudeCodeAdapter {
9604
9688
  if (options.additionalFlags && options.additionalFlags.length > 0) args.push(...options.additionalFlags);
9605
9689
  const envEntries = {};
9606
9690
  if (options.billingMode === "api" && options.apiKey) envEntries.ANTHROPIC_API_KEY = options.apiKey;
9691
+ const unsetEnvKeys = ["CLAUDECODE"];
9692
+ if (options.billingMode !== "api") unsetEnvKeys.push("ANTHROPIC_API_KEY");
9607
9693
  return {
9608
9694
  binary: "claude",
9609
9695
  args,
9610
9696
  env: envEntries,
9697
+ unsetEnvKeys,
9611
9698
  cwd: options.worktreePath,
9612
9699
  stdin: planningPrompt
9613
9700
  };
@@ -11432,5 +11519,5 @@ async function callLLM(params) {
11432
11519
  }
11433
11520
 
11434
11521
  //#endregion
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 };
11436
- //# sourceMappingURL=dist-DnvGvKLu.js.map
11522
+ export { ADVISORY_NOTES, AdapterRegistry, AdtError, BudgetConfigSchema, CLAUDE_AUTH_FAILURE_HINT, 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, detectClaudeAuthFailure, 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 };
11523
+ //# sourceMappingURL=dist-DiNK6QOD.js.map
@@ -1,4 +1,4 @@
1
- import { AdtError } from "./dist-DnvGvKLu.js";
1
+ import { AdtError } from "./dist-DiNK6QOD.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-i3s5sshZ.js.map
74
+ //# sourceMappingURL=errors-B21JUhcc.js.map
@@ -1,3 +1,3 @@
1
- import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-DnvGvKLu.js";
1
+ import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-DiNK6QOD.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-DnvGvKLu.js";
3
- import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-DJFbGhSd.js";
2
+ import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-DiNK6QOD.js";
3
+ import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-Doh2Ion5.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-2Kfa00-H.js.map
1003
+ //# sourceMappingURL=health-BQRsVP6s.js.map
@@ -1,7 +1,7 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-2Kfa00-H.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-BQRsVP6s.js";
2
2
  import "./logger-KeHncl-f.js";
3
- import "./dist-DnvGvKLu.js";
4
- import "./manifest-read-DJFbGhSd.js";
3
+ import "./dist-DiNK6QOD.js";
4
+ import "./manifest-read-Doh2Ion5.js";
5
5
  import "./work-graph-repository-DZyJv5pV.js";
6
6
  import "./decisions-CzSIEeGP.js";
7
7
 
@@ -1347,6 +1347,30 @@ declare class ClaudeCodeAdapter implements WorkerAdapter {
1347
1347
  * Prompt is delivered via stdin (not CLI arg) to avoid E2BIG on large prompts.
1348
1348
  */
1349
1349
  buildCommand(prompt: string, options: AdapterOptions): SpawnCommand;
1350
+ /**
1351
+ * Pre-process `--output-format stream-json` stdout before YAML extraction (Story 81-9).
1352
+ *
1353
+ * Claude Code CLI with `--output-format stream-json` emits NDJSON events to stdout.
1354
+ * This method parses that stream to extract:
1355
+ * 1. `extractedText` — the full agent response from the terminal result event's
1356
+ * `result` field. Identical to raw text output; passed to AdapterOutputNormalizer.
1357
+ * 2. `totalTurns` — agentic turn count from `num_turns` in the result event.
1358
+ * This is the ONLY synchronous, reliable turn-count source available at
1359
+ * DispatchResult resolution time.
1360
+ *
1361
+ * Graceful fallbacks:
1362
+ * - If the stream cannot be parsed as NDJSON, returns `{ extractedText: stdout }`.
1363
+ * - If the result event is missing, returns `{ extractedText: stdout }`.
1364
+ * - If `num_turns` is absent from the event, returns without `totalTurns` (AC2:
1365
+ * "when the count is genuinely unavailable, leave the field absent, never fabricate").
1366
+ *
1367
+ * @param stdout Raw subprocess stdout (NDJSON event stream from Claude Code CLI)
1368
+ * @returns `{ extractedText, totalTurns? }` — text for YAML extraction and optional turn count
1369
+ */
1370
+ parseStreamOutput(stdout: string): {
1371
+ extractedText: string;
1372
+ totalTurns?: number;
1373
+ };
1350
1374
  /**
1351
1375
  * Build spawn command for plan generation.
1352
1376
  */
@@ -1560,4 +1584,4 @@ interface Recommendation {
1560
1584
 
1561
1585
  //#endregion
1562
1586
  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 };
1563
- //# sourceMappingURL=index-BJEANS9i.d.ts.map
1587
+ //# sourceMappingURL=index-BqVBOAO0.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-BJEANS9i.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-BqVBOAO0.js";
2
2
  import pino from "pino";
3
3
  import { z } from "zod";
4
4
  import { Readable, Writable } from "node:stream";
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-DnvGvKLu.js";
3
+ import { AdapterRegistry, AdtError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter } from "./dist-DiNK6QOD.js";
4
4
  import "./adapter-registry-DIcrxjH8.js";
5
- import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-i3s5sshZ.js";
5
+ import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-B21JUhcc.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-DJFbGhSd.js";
2
+ import { readCurrentRunId, resolveMainRepoRoot } from "./manifest-read-Doh2Ion5.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-B91mG5v4.js.map
183
+ //# sourceMappingURL=interactive-prompt-CgerI5Y6.js.map
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-DnvGvKLu.js";
2
+ import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-DiNK6QOD.js";
3
3
  import * as path$1 from "path";
4
4
  import { join } from "path";
5
5
  import { readFile } from "fs/promises";
@@ -4659,9 +4659,23 @@ const PerStoryStateSchema = z.object({
4659
4659
  escalation_reason: z.string().optional(),
4660
4660
  escalation_detail: z.string().optional(),
4661
4661
  commit_sha: z.string().optional(),
4662
+ baseline_sha: z.string().optional(),
4663
+ checkpoint_sha: z.string().optional(),
4662
4664
  story_file: z.string().optional(),
4663
4665
  story_file_input_path: z.string().optional(),
4664
- story_file_sha256: z.string().optional()
4666
+ story_file_sha256: z.string().optional(),
4667
+ verdict: z.union([
4668
+ z.literal("SHIP_IT"),
4669
+ z.literal("LGTM_WITH_NOTES"),
4670
+ z.literal("NEEDS_MINOR_FIXES"),
4671
+ z.literal("NEEDS_MAJOR_REWORK"),
4672
+ z.string()
4673
+ ]).optional(),
4674
+ total_turns: z.number().int().nonnegative().optional(),
4675
+ total_tokens: z.object({
4676
+ input: z.number().int().nonnegative(),
4677
+ output: z.number().int().nonnegative()
4678
+ }).optional()
4665
4679
  });
4666
4680
 
4667
4681
  //#endregion
@@ -5851,4 +5865,4 @@ async function resolveRunManifest(dbRoot, runId) {
5851
5865
 
5852
5866
  //#endregion
5853
5867
  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-DJFbGhSd.js.map
5868
+ //# sourceMappingURL=manifest-read-Doh2Ion5.js.map
@@ -1,6 +1,6 @@
1
1
  import "../../logger-KeHncl-f.js";
2
- import "../../dist-DnvGvKLu.js";
3
- import "../../manifest-read-DJFbGhSd.js";
4
- import { runInteractivePrompt } from "../../interactive-prompt-B91mG5v4.js";
2
+ import "../../dist-DiNK6QOD.js";
3
+ import "../../manifest-read-Doh2Ion5.js";
4
+ import { runInteractivePrompt } from "../../interactive-prompt-CgerI5Y6.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-DnvGvKLu.js";
1
+ import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-DiNK6QOD.js";
2
2
  import "./routing-DFxoKHDt.js";
3
3
 
4
4
  export { loadModelRoutingConfig };