substrate-ai 0.20.31 → 0.20.33

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-BnMsd9hC.js";
2
+ import "./adapter-registry-DXLMTmfD.js";
3
+
4
+ export { AdapterRegistry };
package/dist/cli/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { FileStateStore, RunManifest, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, ZERO_FINDING_COUNTS, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts } from "../health-B0cPyaYJ.js";
2
+ import { FileStateStore, RunManifest, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, ZERO_FINDING_COUNTS, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts } from "../health-Cz4RTHNh.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, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createDoltClient, createPipelineRun, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-CqtWS9wF.js";
5
+ import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, GlobalSettingsSchema, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createDoltClient, createPipelineRun, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-BnMsd9hC.js";
6
6
  import "../adapter-registry-DXLMTmfD.js";
7
- import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-C8IJQ5i5.js";
8
- import "../errors-1uLGqnvr.js";
7
+ import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-BLaHTh1C.js";
8
+ import "../errors-DSGhhrgv.js";
9
9
  import "../routing-CcBOCuC9.js";
10
10
  import "../decisions-C0pz9Clx.js";
11
11
  import "../version-manager-impl-BmOWu8ml.js";
12
- import { registerUpgradeCommand } from "../upgrade-k15NGTno.js";
12
+ import { registerUpgradeCommand } from "../upgrade-D3NuTkSL.js";
13
13
  import { Command } from "commander";
14
14
  import { fileURLToPath } from "url";
15
15
  import { dirname, join, resolve } from "path";
@@ -3667,7 +3667,7 @@ async function runStatusAction(options) {
3667
3667
  logger$12.debug({ err }, "Work graph query failed, continuing without work graph data");
3668
3668
  }
3669
3669
  if (run === void 0) {
3670
- const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-C6pR6QvM.js");
3670
+ const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-B6AMpmJB.js");
3671
3671
  const substrateDirPath = join(projectRoot, ".substrate");
3672
3672
  const processInfo = inspectProcessTree$1({
3673
3673
  projectRoot,
@@ -4617,7 +4617,7 @@ function defaultSupervisorDeps() {
4617
4617
  if (cached === null) {
4618
4618
  const { AdapterRegistry: AR } = await import(
4619
4619
  /* @vite-ignore */
4620
- "../adapter-registry-N0Klnk7Y.js"
4620
+ "../adapter-registry-Cu2eLuau.js"
4621
4621
  );
4622
4622
  cached = new AR();
4623
4623
  await cached.discoverAndRegister();
@@ -5184,11 +5184,11 @@ async function runSupervisorAction(options, deps = {}) {
5184
5184
  try {
5185
5185
  const { createExperimenter } = await import(
5186
5186
  /* @vite-ignore */
5187
- "../experimenter-VEJHtfLh.js"
5187
+ "../experimenter-CN8PhRbv.js"
5188
5188
  );
5189
5189
  const { getLatestRun: getLatest } = await import(
5190
5190
  /* @vite-ignore */
5191
- "../decisions-7UJcRETq.js"
5191
+ "../decisions-DlPFWRDm.js"
5192
5192
  );
5193
5193
  const expAdapter = createDatabaseAdapter({
5194
5194
  backend: "auto",
@@ -5198,7 +5198,7 @@ async function runSupervisorAction(options, deps = {}) {
5198
5198
  await initSchema(expAdapter);
5199
5199
  const { runRunAction: runPipeline } = await import(
5200
5200
  /* @vite-ignore */
5201
- "../run-Dt5fuOCt.js"
5201
+ "../run-C-mxCkwh.js"
5202
5202
  );
5203
5203
  const runStoryFn = async (opts) => {
5204
5204
  const exitCode = await runPipeline({
@@ -5730,7 +5730,7 @@ async function runMetricsAction(options) {
5730
5730
  const routingConfigPath = join(dbDir, "routing.yml");
5731
5731
  let routingConfig = null;
5732
5732
  if (existsSync$1(routingConfigPath)) try {
5733
- const { loadModelRoutingConfig } = await import("../routing-Ccpb_syA.js");
5733
+ const { loadModelRoutingConfig } = await import("../routing-sauIk945.js");
5734
5734
  routingConfig = loadModelRoutingConfig(routingConfigPath);
5735
5735
  } catch {}
5736
5736
  if (routingConfig === null) routingConfig = {
@@ -9003,8 +9003,8 @@ async function createProgram() {
9003
9003
  /** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
9004
9004
  function checkForUpdatesInBackground(currentVersion) {
9005
9005
  if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
9006
- import("../upgrade-CVaD7iUR.js").then(async () => {
9007
- const { createVersionManager } = await import("../version-manager-impl-CEiZEsmi.js");
9006
+ import("../upgrade-BXfinu5K.js").then(async () => {
9007
+ const { createVersionManager } = await import("../version-manager-impl-ChzfLw90.js");
9008
9008
  const vm = createVersionManager();
9009
9009
  const result = await vm.checkForUpdates();
9010
9010
  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-CqtWS9wF.js";
1
+ import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-BnMsd9hC.js";
2
2
  import "./decisions-C0pz9Clx.js";
3
3
 
4
4
  export { getLatestRun };
@@ -283,7 +283,21 @@ function parseYamlResult(yamlText, schema) {
283
283
  error: `YAML parse error: ${message}`
284
284
  };
285
285
  }
286
- else return {
286
+ else if (message.includes("bad indentation of a mapping entry")) {
287
+ const recovered = attemptBlockScalarRecovery(yamlText, message);
288
+ if (recovered !== null) try {
289
+ raw = yaml.load(sanitizeYamlEscapes(recovered));
290
+ } catch {
291
+ return {
292
+ parsed: null,
293
+ error: `YAML parse error: ${message}`
294
+ };
295
+ }
296
+ else return {
297
+ parsed: null,
298
+ error: `YAML parse error: ${message}`
299
+ };
300
+ } else return {
287
301
  parsed: null,
288
302
  error: `YAML parse error: ${message}`
289
303
  };
@@ -307,6 +321,67 @@ function parseYamlResult(yamlText, schema) {
307
321
  };
308
322
  }
309
323
  /**
324
+ * Field names whose values are known free-form strings and may safely be
325
+ * rewritten as block scalars when the parser fails on an embedded colon.
326
+ * Other fields (numeric, enum, structural) stay strict.
327
+ *
328
+ * Allowlist intent: we only rescue the failure mode that obs_015 documents
329
+ * (reviewer-style agents quoting colons in description-shaped fields).
330
+ * Adding fields here loosens the recovery surface; do so only when an
331
+ * empirical case shows a new field needs the same protection.
332
+ */
333
+ const RECOVERABLE_BLOCK_SCALAR_FIELDS = new Set([
334
+ "description",
335
+ "message",
336
+ "error",
337
+ "notes",
338
+ "comment",
339
+ "finding",
340
+ "command",
341
+ "details",
342
+ "rationale",
343
+ "reason"
344
+ ]);
345
+ /**
346
+ * Attempt to rewrite a single `<field>: <value-with-colons>` line as a
347
+ * literal block scalar (`<field>: |-\n <value>`) so the YAML parser
348
+ * doesn't reinterpret the inner colons as mapping separators.
349
+ *
350
+ * Returns the rewritten YAML on success, or `null` when:
351
+ * - the error message doesn't carry a parseable position
352
+ * - no allowlisted field within a 4-line backward window matches
353
+ * - the matched value doesn't contain a colon (the trigger condition)
354
+ */
355
+ function attemptBlockScalarRecovery(yamlText, errorMessage) {
356
+ const positionMatch = errorMessage.match(/\((\d+):(\d+)\)/);
357
+ if (positionMatch === null) return null;
358
+ const lineNum = Number.parseInt(positionMatch[1] ?? "", 10);
359
+ if (!Number.isFinite(lineNum) || lineNum <= 0) return null;
360
+ const lineIdx = lineNum - 1;
361
+ const lines = yamlText.split("\n");
362
+ if (lineIdx >= lines.length) return null;
363
+ for (let i = lineIdx; i >= Math.max(0, lineIdx - 4); i -= 1) {
364
+ const line = lines[i] ?? "";
365
+ const m = line.match(/^(\s*-?\s*)([A-Za-z_][A-Za-z0-9_]*):\s+(\S.*?)\s*$/);
366
+ if (m === null) continue;
367
+ const fieldName = (m[2] ?? "").toLowerCase();
368
+ if (!RECOVERABLE_BLOCK_SCALAR_FIELDS.has(fieldName)) continue;
369
+ const value = m[3] ?? "";
370
+ if (!value.includes(":")) continue;
371
+ const prefix = m[1] ?? "";
372
+ const valueIndent = " ".repeat(prefix.length + 2);
373
+ const rewrittenKeyLine = `${prefix}${m[2]}: |-`;
374
+ const valueLines = value.split("\n").map((v) => `${valueIndent}${v}`);
375
+ return [
376
+ ...lines.slice(0, i),
377
+ rewrittenKeyLine,
378
+ ...valueLines,
379
+ ...lines.slice(i + 1)
380
+ ].join("\n");
381
+ }
382
+ return null;
383
+ }
384
+ /**
310
385
  * Valid YAML escape sequences in double-quoted strings (YAML 1.2 spec).
311
386
  * Any backslash followed by a character NOT in this set is invalid.
312
387
  */
@@ -10940,4 +11015,4 @@ async function callLLM(params) {
10940
11015
 
10941
11016
  //#endregion
10942
11017
  export { ADVISORY_NOTES, AdapterRegistry, AdtError, BudgetConfigSchema, 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, 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, compareRunMetrics, createAmendmentRun, createConfigSystem, createDatabaseAdapter as createDatabaseAdapter$1, createDecision, createDoltClient, createExperimenter, createPipelineRun, createRequirement, createVersionManager, detectInterfaceChanges, determineVerdict, getActiveDecisions, getAllCostEntriesFiltered, getArtifactByTypeForRun, getArtifactsByRun, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getModelTier, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRequirements, listRunMetrics, loadModelRoutingConfig, loadParentRunDecisions, registerArtifact, resolvePromptFile, supersedeDecision, tagRunAsBaseline, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics };
10943
- //# sourceMappingURL=dist-CqtWS9wF.js.map
11018
+ //# sourceMappingURL=dist-BnMsd9hC.js.map
@@ -1,4 +1,4 @@
1
- import { AdtError } from "./dist-CqtWS9wF.js";
1
+ import { AdtError } from "./dist-BnMsd9hC.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-1uLGqnvr.js.map
74
+ //# sourceMappingURL=errors-DSGhhrgv.js.map
@@ -1,3 +1,3 @@
1
- import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-CqtWS9wF.js";
1
+ import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-BnMsd9hC.js";
2
2
 
3
3
  export { createExperimenter };
@@ -1,6 +1,6 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-B0cPyaYJ.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-Cz4RTHNh.js";
2
2
  import "./logger-KeHncl-f.js";
3
- import "./dist-CqtWS9wF.js";
3
+ import "./dist-BnMsd9hC.js";
4
4
  import "./decisions-C0pz9Clx.js";
5
5
 
6
6
  export { inspectProcessTree };
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { DoltClient, DoltQueryError, LEARNING_FINDING, createDatabaseAdapter$1 as createDatabaseAdapter, createDecision, getDecisionsByCategory, getLatestRun, getPipelineRunById, initSchema } from "./dist-CqtWS9wF.js";
2
+ import { DoltClient, DoltQueryError, LEARNING_FINDING, createDatabaseAdapter$1 as createDatabaseAdapter, createDecision, getDecisionsByCategory, getLatestRun, getPipelineRunById, initSchema } from "./dist-BnMsd9hC.js";
3
3
  import { createRequire } from "module";
4
4
  import { dirname, join } from "path";
5
5
  import { readFile } from "fs/promises";
@@ -7,6 +7,7 @@ import { EventEmitter } from "node:events";
7
7
  import { YAMLException, load } from "js-yaml";
8
8
  import { existsSync, promises, readFileSync, readdirSync, statSync } from "node:fs";
9
9
  import { spawn, spawnSync } from "node:child_process";
10
+ import * as path$1 from "node:path";
10
11
  import { basename as basename$1, dirname as dirname$1, join as join$1, resolve as resolve$1 } from "node:path";
11
12
  import { z } from "zod";
12
13
  import { mkdir as mkdir$1, open, readFile as readFile$1, unlink, writeFile as writeFile$1 } from "node:fs/promises";
@@ -480,20 +481,20 @@ function detectCycles(edges) {
480
481
  }
481
482
  const visited = new Set();
482
483
  const visiting = new Set();
483
- const path$1 = [];
484
+ const path$2 = [];
484
485
  function dfs(node) {
485
486
  if (visiting.has(node)) {
486
- const cycleStart = path$1.indexOf(node);
487
- return [...path$1.slice(cycleStart), node];
487
+ const cycleStart = path$2.indexOf(node);
488
+ return [...path$2.slice(cycleStart), node];
488
489
  }
489
490
  if (visited.has(node)) return null;
490
491
  visiting.add(node);
491
- path$1.push(node);
492
+ path$2.push(node);
492
493
  for (const neighbor of adj.get(node) ?? []) {
493
494
  const cycle = dfs(neighbor);
494
495
  if (cycle !== null) return cycle;
495
496
  }
496
- path$1.pop();
497
+ path$2.pop();
497
498
  visiting.delete(node);
498
499
  visited.add(node);
499
500
  return null;
@@ -3270,14 +3271,31 @@ var AcceptanceCriteriaEvidenceCheck = class {
3270
3271
  const claimedIds = new Set(extractClaimedAcceptanceCriteriaIds(devResult.ac_met));
3271
3272
  const missingIds = expectedIds.filter((id) => !claimedIds.has(id));
3272
3273
  if (missingIds.length > 0) {
3274
+ const acceptanceTexts = extractAcceptanceCriteriaTexts(storyContent);
3275
+ const filesModified = devResult.files_modified ?? [];
3273
3276
  const claimedSummary = formatIds(sortAcIds(claimedIds)) || "none";
3274
- const findings = missingIds.map((id) => ({
3275
- category: "ac-missing-evidence",
3276
- severity: "error",
3277
- message: `missing dev-story AC evidence for ${id} (expected ${formatIds(expectedIds)}, claimed ${claimedSummary})`
3278
- }));
3277
+ const findings = missingIds.map((id) => {
3278
+ const acText = acceptanceTexts.get(id) ?? "";
3279
+ const evidence = findCodeEvidence({
3280
+ acId: id,
3281
+ acText,
3282
+ filesModified,
3283
+ workingDir: context.workingDir
3284
+ });
3285
+ if (evidence.found) return {
3286
+ category: "ac-missing-evidence-claim",
3287
+ severity: "info",
3288
+ message: `dev-story did not claim ${id} but code-evidence was found: ${evidence.reason} (expected ${formatIds(expectedIds)}, claimed ${claimedSummary})`
3289
+ };
3290
+ return {
3291
+ category: "ac-missing-evidence",
3292
+ severity: "error",
3293
+ message: `missing dev-story AC evidence for ${id} (expected ${formatIds(expectedIds)}, claimed ${claimedSummary})`
3294
+ };
3295
+ });
3296
+ const hasErrorFinding = findings.some((f) => f.severity === "error");
3279
3297
  return {
3280
- status: "fail",
3298
+ status: hasErrorFinding ? "fail" : "warn",
3281
3299
  details: renderFindings(findings),
3282
3300
  duration_ms: Date.now() - start,
3283
3301
  findings
@@ -3304,6 +3322,155 @@ var AcceptanceCriteriaEvidenceCheck = class {
3304
3322
  };
3305
3323
  }
3306
3324
  };
3325
+ /**
3326
+ * Build a per-AC text map (id → AC body text). Used by the code-evidence
3327
+ * fallback (Story 61-7) when an AC is missing from the dev's claim list —
3328
+ * the AC's text drives path-token extraction so we can look for evidence
3329
+ * that the work was done despite the under-claim.
3330
+ *
3331
+ * Resolution order per AC id:
3332
+ * 1. Lines in the acceptance section that explicitly mention `AC<N>` or
3333
+ * `AC: #<N>` are concatenated.
3334
+ * 2. If no explicit mention, fall back to position: the Nth bullet
3335
+ * (`- ...`) under the section is AC<N>'s text.
3336
+ * 3. If no bullets, the Nth numbered item (`<N>. ...`).
3337
+ */
3338
+ function extractAcceptanceCriteriaTexts(storyContent) {
3339
+ const result = new Map();
3340
+ const section = extractAcceptanceSection(storyContent);
3341
+ if (section === void 0) return result;
3342
+ const lines = section.split(/\r?\n/);
3343
+ const explicitByNum = new Map();
3344
+ const explicitRefRe = /\bAC\s*:?\s*#?\s*(\d+)\b/gi;
3345
+ for (const line of lines) {
3346
+ explicitRefRe.lastIndex = 0;
3347
+ let m;
3348
+ while ((m = explicitRefRe.exec(line)) !== null) {
3349
+ const n = Number.parseInt(m[1] ?? "", 10);
3350
+ if (!Number.isFinite(n) || n <= 0) continue;
3351
+ const list = explicitByNum.get(n) ?? [];
3352
+ if (!list.includes(line)) list.push(line);
3353
+ explicitByNum.set(n, list);
3354
+ }
3355
+ }
3356
+ const bulletLines = [];
3357
+ const numberedLines = [];
3358
+ for (const line of lines) {
3359
+ if (/^\s*[-*]\s+\S/.test(line) && !/^\s*(?:[-*]\s*)?(?:\[[ xX]\]\s*)?(\d+)[.)]\s+\S/.test(line)) bulletLines.push(line);
3360
+ if (/^\s*(?:[-*]\s*)?(?:\[[ xX]\]\s*)?(\d+)[.)]\s+\S/.test(line)) numberedLines.push(line);
3361
+ }
3362
+ const allNums = new Set([...Array.from(explicitByNum.keys()), ...Array.from({ length: Math.max(bulletLines.length, numberedLines.length) }, (_, i) => i + 1)]);
3363
+ for (const n of allNums) {
3364
+ const explicit = explicitByNum.get(n);
3365
+ if (explicit && explicit.length > 0) {
3366
+ result.set(`AC${n}`, explicit.join("\n"));
3367
+ continue;
3368
+ }
3369
+ if (n - 1 < bulletLines.length) {
3370
+ result.set(`AC${n}`, bulletLines[n - 1] ?? "");
3371
+ continue;
3372
+ }
3373
+ if (n - 1 < numberedLines.length) result.set(`AC${n}`, numberedLines[n - 1] ?? "");
3374
+ }
3375
+ return result;
3376
+ }
3377
+ /**
3378
+ * Recognized source/test extensions for path-token extraction. Mirrors
3379
+ * scope-guardrail.ts's RECOGNIZED_EXTENSIONS but lives here to avoid a
3380
+ * cross-package import (sdlc cannot depend on src/modules).
3381
+ */
3382
+ const PATH_TOKEN_EXTENSIONS = [
3383
+ ".ts",
3384
+ ".tsx",
3385
+ ".js",
3386
+ ".jsx",
3387
+ ".md",
3388
+ ".json",
3389
+ ".yaml",
3390
+ ".yml",
3391
+ ".py",
3392
+ ".go",
3393
+ ".java",
3394
+ ".rb",
3395
+ ".rs",
3396
+ ".sh",
3397
+ ".css",
3398
+ ".scss",
3399
+ ".html"
3400
+ ];
3401
+ /**
3402
+ * Extract path-like tokens from arbitrary text. A path-like token contains
3403
+ * `/`, has a recognized extension, and contains no whitespace.
3404
+ */
3405
+ function extractPathTokens(text) {
3406
+ if (text === "") return [];
3407
+ const tokens = new Set();
3408
+ const backtickRe = /`([^`]+)`/g;
3409
+ let m;
3410
+ while ((m = backtickRe.exec(text)) !== null) {
3411
+ const candidate = (m[1] ?? "").trim();
3412
+ if (looksLikePath(candidate)) tokens.add(candidate);
3413
+ }
3414
+ const stripped = text.replace(/`[^`]+`/g, " ");
3415
+ for (const raw of stripped.split(/\s+/)) {
3416
+ const clean = raw.replace(/[,;:()\[\]{}'"]+$/g, "").replace(/^[,;:()\[\]{}'"]+/g, "");
3417
+ if (looksLikePath(clean)) tokens.add(clean);
3418
+ }
3419
+ return Array.from(tokens);
3420
+ }
3421
+ function looksLikePath(candidate) {
3422
+ if (candidate === "" || /\s/.test(candidate)) return false;
3423
+ if (!candidate.includes("/")) return false;
3424
+ return PATH_TOKEN_EXTENSIONS.some((ext) => candidate.endsWith(ext));
3425
+ }
3426
+ function isTestFilePath(filePath) {
3427
+ return filePath.includes(".test.") || filePath.includes(".spec.") || filePath.includes("__tests__/") || filePath.includes("__tests__\\") || filePath.includes("/__tests__") || filePath.includes("\\__tests__");
3428
+ }
3429
+ /**
3430
+ * Find code-evidence that an unclaimed AC was actually implemented.
3431
+ *
3432
+ * Returns `{ found: true, reason }` when any of the three checks succeeds:
3433
+ * 1. AC text mentions a file path that's in `filesModified` (exact or basename match)
3434
+ * 2. AC text mentions a path that exists in the working tree
3435
+ * 3. A test file in `filesModified` contains the AC id (e.g., `AC10`)
3436
+ *
3437
+ * Returns `{ found: false }` otherwise.
3438
+ */
3439
+ function findCodeEvidence(opts) {
3440
+ const { acId, acText, filesModified, workingDir } = opts;
3441
+ const tokens = extractPathTokens(acText);
3442
+ for (const token of tokens) if (filesModified.includes(token)) return {
3443
+ found: true,
3444
+ reason: `AC text references ${token}, which is in files_modified`
3445
+ };
3446
+ for (const token of tokens) {
3447
+ const base = path$1.basename(token);
3448
+ const match = filesModified.find((f) => path$1.basename(f) === base);
3449
+ if (match !== void 0) return {
3450
+ found: true,
3451
+ reason: `AC text references ${token}; matching basename ${match} is in files_modified`
3452
+ };
3453
+ }
3454
+ for (const token of tokens) try {
3455
+ if (existsSync(path$1.join(workingDir, token))) return {
3456
+ found: true,
3457
+ reason: `AC text references ${token}, which exists in working tree`
3458
+ };
3459
+ } catch {}
3460
+ const num = acId.replace(/^AC/i, "");
3461
+ if (num !== "") {
3462
+ const acMentionRe = new RegExp(`\\bAC\\s*:?\\s*#?\\s*${num}\\b`, "i");
3463
+ const testFiles = filesModified.filter(isTestFilePath);
3464
+ for (const testFile of testFiles) try {
3465
+ const content = readFileSync(path$1.join(workingDir, testFile), "utf-8");
3466
+ if (acMentionRe.test(content)) return {
3467
+ found: true,
3468
+ reason: `${testFile} mentions ${acId}`
3469
+ };
3470
+ } catch {}
3471
+ }
3472
+ return { found: false };
3473
+ }
3307
3474
 
3308
3475
  //#endregion
3309
3476
  //#region packages/sdlc/dist/verification/checks/build-check.js
@@ -3622,11 +3789,11 @@ function parseRuntimeProbes(storyContent) {
3622
3789
  const validation = RuntimeProbeListSchema.safeParse(parsed);
3623
3790
  if (!validation.success) {
3624
3791
  const first = validation.error.issues[0];
3625
- const path$1 = first?.path.join(".") ?? "";
3792
+ const path$2 = first?.path.join(".") ?? "";
3626
3793
  const message = first?.message ?? "schema validation failed";
3627
3794
  return {
3628
3795
  kind: "invalid",
3629
- error: `probe list is malformed at ${path$1 || "<root>"}: ${message}`
3796
+ error: `probe list is malformed at ${path$2 || "<root>"}: ${message}`
3630
3797
  };
3631
3798
  }
3632
3799
  const probes = validation.data;
@@ -3850,6 +4017,9 @@ const TRIGGER_COMMAND_PATTERNS = [
3850
4017
  ];
3851
4018
  /**
3852
4019
  * Returns true if the source AC text mentions an event-driven mechanism.
4020
+ *
4021
+ * Exported for use by probe-author-integration.ts (Story 60-13) so the
4022
+ * orchestrator can gate probe-author dispatch on the same heuristic.
3853
4023
  */
3854
4024
  function detectsEventDrivenAC(sourceEpicContent) {
3855
4025
  for (const pattern of EVENT_DRIVEN_KEYWORDS) if (pattern.test(sourceEpicContent)) return true;
@@ -4042,18 +4212,18 @@ function existsAnywhereUnderRoot(root, base) {
4042
4212
  depth: 0
4043
4213
  }];
4044
4214
  while (stack.length > 0) {
4045
- const { path: path$1, depth } = stack.pop();
4215
+ const { path: path$2, depth } = stack.pop();
4046
4216
  if (depth > MAX_WALK_DEPTH) continue;
4047
4217
  let entries;
4048
4218
  try {
4049
- entries = readdirSync(path$1);
4219
+ entries = readdirSync(path$2);
4050
4220
  } catch {
4051
4221
  continue;
4052
4222
  }
4053
4223
  for (const entry of entries) {
4054
4224
  if (SKIP_DIRS.has(entry)) continue;
4055
4225
  if (entry === base) return true;
4056
- const full = join$1(path$1, entry);
4226
+ const full = join$1(path$2, entry);
4057
4227
  try {
4058
4228
  const s = statSync(full);
4059
4229
  if (s.isDirectory()) stack.push({
@@ -5686,7 +5856,7 @@ function inspectProcessTree(opts) {
5686
5856
  }
5687
5857
  const lines = psOutput.split("\n");
5688
5858
  if (substrateDirPath !== void 0) try {
5689
- const readFileSyncFn = readFileSyncOverride ?? ((path$1, encoding) => readFileSync(path$1, encoding));
5859
+ const readFileSyncFn = readFileSyncOverride ?? ((path$2, encoding) => readFileSync(path$2, encoding));
5690
5860
  const pidContent = readFileSyncFn(join(substrateDirPath, "orchestrator.pid"), "utf-8");
5691
5861
  const pid = parseInt(pidContent.trim(), 10);
5692
5862
  if (!isNaN(pid) && pid > 0) {
@@ -6120,5 +6290,5 @@ function registerHealthCommand(program, _version = "0.0.0", projectRoot = proces
6120
6290
  }
6121
6291
 
6122
6292
  //#endregion
6123
- export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, DoltMergeConflict, FileStateStore, FindingsInjector, RunManifest, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN$1 as STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, ZERO_FINDING_COUNTS, __commonJS, __require, __toESM, applyConfigToGraph, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, createStateStore, detectCycles, extractTargetFilesFromStoryContent, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, registerHealthCommand, renderFindings, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, runHealthAction, validateStoryKey };
6124
- //# sourceMappingURL=health-B0cPyaYJ.js.map
6293
+ export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, DoltMergeConflict, FileStateStore, FindingsInjector, RunManifest, RuntimeProbeListSchema, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN$1 as STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, ZERO_FINDING_COUNTS, __commonJS, __require, __toESM, applyConfigToGraph, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, createStateStore, detectCycles, detectsEventDrivenAC, extractTargetFilesFromStoryContent, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, registerHealthCommand, renderFindings, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, runHealthAction, validateStoryKey };
6294
+ //# sourceMappingURL=health-Cz4RTHNh.js.map
package/dist/index.d.ts CHANGED
@@ -2106,6 +2106,24 @@ interface OrchestratorEvents {
2106
2106
  storyKey: string;
2107
2107
  reason: string;
2108
2108
  };
2109
+ /**
2110
+ * Story 62-3: code-review agent emitted YAML output that failed schema
2111
+ * validation (typically a parse error from unquoted-colon-in-value or
2112
+ * unbalanced quotes — see obs_2026-04-27_015). Distinct from the generic
2113
+ * phantom-review path so operators can debug agent emission shape rather
2114
+ * than chase a crash/timeout phantom. Fires on each malformed-output
2115
+ * cycle; final escalation (after MAX_SCHEMA_VALIDATION_RETRIES exhausted)
2116
+ * surfaces via the standard `orchestrator:story-escalated` event with
2117
+ * `lastVerdict: 'code-review-output-malformed-budget-exceeded'`.
2118
+ */
2119
+ 'orchestrator:code-review-output-malformed': {
2120
+ storyKey: string;
2121
+ reviewCycles: number;
2122
+ attempt: number;
2123
+ maxAttempts: number;
2124
+ error: string;
2125
+ details?: string;
2126
+ };
2109
2127
  /** Implementation orchestrator has finished all stories */
2110
2128
  'orchestrator:complete': {
2111
2129
  totalStories: number;
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-CqtWS9wF.js";
3
+ import { AdapterRegistry, AdtError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter } from "./dist-BnMsd9hC.js";
4
4
  import "./adapter-registry-DXLMTmfD.js";
5
- import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-1uLGqnvr.js";
5
+ import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-DSGhhrgv.js";
6
6
 
7
7
  //#region src/core/di.ts
8
8
  /**
@@ -1,4 +1,4 @@
1
- import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-CqtWS9wF.js";
1
+ import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-BnMsd9hC.js";
2
2
  import "./routing-CcBOCuC9.js";
3
3
 
4
4
  export { loadModelRoutingConfig };