substrate-ai 0.21.8 → 0.21.9

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-CO4BbTu3.js";
2
+ import "./adapter-registry-DXLMTmfD.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-QOH__JNf.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-BbgLm021.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, createGitWorktreeManager, 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-DeyV_vqU.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, createGitWorktreeManager, 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-CO4BbTu3.js";
6
6
  import "../adapter-registry-DXLMTmfD.js";
7
- import { ACCEPTANCE_CONTRACT_PROFILE_PATH, JOURNEY_DEFERRALS_PATH, JOURNEY_REGISTRY_PATH, RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, loadAcceptanceContractFromTrustedTree, loadJourneyRegistryFromFile, loadJourneyRegistryFromTrustedTree, parseAcceptanceContract, parseJourneyDeferrals, parseJourneyRegistry, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck } from "../manifest-read-9xd4yEkp.js";
8
- import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAcceptanceJudge, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-iZqvCT-f.js";
9
- import "../errors-BgV6pqUZ.js";
7
+ import { ACCEPTANCE_CONTRACT_PROFILE_PATH, JOURNEY_DEFERRALS_PATH, JOURNEY_REGISTRY_PATH, RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, loadAcceptanceContractFromTrustedTree, loadJourneyRegistryFromFile, loadJourneyRegistryFromTrustedTree, parseAcceptanceContract, parseJourneyDeferrals, parseJourneyRegistry, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck } from "../manifest-read-qsNEHEaF.js";
8
+ import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAcceptanceJudge, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-nda59MmG.js";
9
+ import "../errors-0OA2nge4.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-BAPpON_C.js";
14
- import "../interactive-prompt-CT_vtUGk.js";
14
+ import "../interactive-prompt-qTo2iuop.js";
15
15
  import "../recovery-engine-BKGBeBnW.js";
16
16
  import "../version-manager-impl-qFBiO4Eh.js";
17
- import { registerUpgradeCommand } from "../upgrade-lE_GIvWv.js";
17
+ import { registerUpgradeCommand } from "../upgrade-DGpQdA9A.js";
18
18
  import { Command } from "commander";
19
19
  import { fileURLToPath } from "url";
20
20
  import { dirname, join, resolve } from "path";
@@ -7130,7 +7130,7 @@ async function runStatusAction(options) {
7130
7130
  logger$15.debug({ err }, "Work graph query failed, continuing without work graph data");
7131
7131
  }
7132
7132
  if (run === void 0) {
7133
- const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-CTdPQfSH.js");
7133
+ const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-CLo5vM7O.js");
7134
7134
  const substrateDirPath = join(projectRoot, ".substrate");
7135
7135
  const processInfo = inspectProcessTree$1({
7136
7136
  projectRoot,
@@ -8078,7 +8078,7 @@ function defaultSupervisorDeps() {
8078
8078
  if (cached === null) {
8079
8079
  const { AdapterRegistry: AR } = await import(
8080
8080
  /* @vite-ignore */
8081
- "../adapter-registry-Csta1uJX.js"
8081
+ "../adapter-registry-Cr9f2ICC.js"
8082
8082
  );
8083
8083
  cached = new AR();
8084
8084
  await cached.discoverAndRegister();
@@ -8645,11 +8645,11 @@ async function runSupervisorAction(options, deps = {}) {
8645
8645
  try {
8646
8646
  const { createExperimenter } = await import(
8647
8647
  /* @vite-ignore */
8648
- "../experimenter-DDuRR16z.js"
8648
+ "../experimenter-BTUtFcGu.js"
8649
8649
  );
8650
8650
  const { getLatestRun: getLatest } = await import(
8651
8651
  /* @vite-ignore */
8652
- "../decisions-Blw6BzGL.js"
8652
+ "../decisions-DMUwdH1O.js"
8653
8653
  );
8654
8654
  const expAdapter = createDatabaseAdapter({
8655
8655
  backend: "auto",
@@ -8659,7 +8659,7 @@ async function runSupervisorAction(options, deps = {}) {
8659
8659
  await initSchema(expAdapter);
8660
8660
  const { runRunAction: runPipeline } = await import(
8661
8661
  /* @vite-ignore */
8662
- "../run-D3Idemy0.js"
8662
+ "../run-DXJeZOid.js"
8663
8663
  );
8664
8664
  const runStoryFn = async (opts) => {
8665
8665
  const exitCode = await runPipeline({
@@ -9184,7 +9184,7 @@ async function runMetricsAction(options) {
9184
9184
  const routingConfigPath = join(dbDir, "routing.yml");
9185
9185
  let routingConfig = null;
9186
9186
  if (existsSync$1(routingConfigPath)) try {
9187
- const { loadModelRoutingConfig } = await import("../routing-uZdhcjzV.js");
9187
+ const { loadModelRoutingConfig } = await import("../routing-Bet3Iu2w.js");
9188
9188
  routingConfig = loadModelRoutingConfig(routingConfigPath);
9189
9189
  } catch {}
9190
9190
  if (routingConfig === null) routingConfig = {
@@ -13735,8 +13735,8 @@ async function createProgram() {
13735
13735
  /** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
13736
13736
  function checkForUpdatesInBackground(currentVersion) {
13737
13737
  if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
13738
- import("../upgrade-BkP-yFWV.js").then(async () => {
13739
- const { createVersionManager } = await import("../version-manager-impl-Cc7yx4i5.js");
13738
+ import("../upgrade-Cryksfvg.js").then(async () => {
13739
+ const { createVersionManager } = await import("../version-manager-impl-DSK9i3Xk.js");
13740
13740
  const vm = createVersionManager();
13741
13741
  const result = await vm.checkForUpdates();
13742
13742
  if (result.updateAvailable) {
@@ -97,7 +97,7 @@ Lifecycle events on the NDJSON stream: `story:committed` → (`story:merged`)
97
97
 
98
98
  If the project declares a journey registry at `.substrate/acceptance/journeys.yaml` (PRD user journeys with concrete end-states — COMMIT the file; substrate reads the committed copy, never an agent-writable worktree copy), the pipeline audits journey coverage at each epic close and at run end: every registered journey lands in exactly one state — `walked-pass`, `walked-fail`, `deferred`, `unclaimed` (NO story claims it — the never-wired-journey class), or `unwalked`. Results stream as `acceptance:coverage` events and land on the run manifest.
99
99
 
100
- `acceptance.mode` in `.substrate/config.yaml`: `advisory` (default — warns, never blocks), `blocking` (an unclaimed/unwalked journey escalates `journey-unclaimed`/`journey-unwalked` on the LAST story of the epic before it integrates), or `off`. Create-story tags stories with the journeys they deliver (`journeys:` frontmatter). To explicitly skip a journey: `substrate acceptance defer <id> --reason "<why>"` and commit the deferral file. Lint the registry with `substrate acceptance validate`.
100
+ `acceptance.mode` in `.substrate/config.yaml`: `advisory` (default — warns, never blocks), `blocking`, or `off`. In blocking mode the verdict × tier policy applies: an unclaimed/unwalked journey escalates `journey-unclaimed`/`journey-unwalked` on the LAST story of the epic; a journey-critical acceptance FAIL escalates `acceptance-fail` before the story integrates (branch preserved); a story whose journey-critical verdicts ALL pass integrates via `acceptance.critical_pass_finalization` (`branch` default, or `pr`) instead of self-merging — the deliverable branch plus the verdict artifact await a human merge in the morning report. Standard-tier FAILs file a fix-story proposal and the run continues. Create-story tags stories with the journeys they deliver (`journeys:` frontmatter). To explicitly skip a journey: `substrate acceptance defer <id> --reason "<why>"` and commit the deferral file. Lint the registry with `substrate acceptance validate`; judge ad-hoc artifacts with `substrate acceptance judge`.
101
101
 
102
102
  ### Key Commands Reference
103
103
 
@@ -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-DeyV_vqU.js";
1
+ import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-CO4BbTu3.js";
2
2
  import "./decisions-CzSIEeGP.js";
3
3
 
4
4
  export { getLatestRun };
@@ -6343,11 +6343,14 @@ const SubstrateConfigSchema = z.object({
6343
6343
  merge_strategy: z.enum(["ff-only", "three-way"]).optional(),
6344
6344
  epic_gate_command: z.string().optional()
6345
6345
  }).strict().optional(),
6346
- acceptance: z.object({ mode: z.enum([
6347
- "off",
6348
- "advisory",
6349
- "blocking"
6350
- ]).optional() }).strict().optional()
6346
+ acceptance: z.object({
6347
+ mode: z.enum([
6348
+ "off",
6349
+ "advisory",
6350
+ "blocking"
6351
+ ]).optional(),
6352
+ critical_pass_finalization: z.enum(["branch", "pr"]).optional()
6353
+ }).strict().optional()
6351
6354
  }).passthrough();
6352
6355
  const PartialProviderConfigSchema = ProviderConfigSchema.partial();
6353
6356
  const PartialGlobalSettingsSchema = GlobalSettingsSchema.partial();
@@ -6375,11 +6378,14 @@ const PartialSubstrateConfigSchema = z.object({
6375
6378
  merge_strategy: z.enum(["ff-only", "three-way"]).optional(),
6376
6379
  epic_gate_command: z.string().optional()
6377
6380
  }).strict().optional(),
6378
- acceptance: z.object({ mode: z.enum([
6379
- "off",
6380
- "advisory",
6381
- "blocking"
6382
- ]).optional() }).strict().optional()
6381
+ acceptance: z.object({
6382
+ mode: z.enum([
6383
+ "off",
6384
+ "advisory",
6385
+ "blocking"
6386
+ ]).optional(),
6387
+ critical_pass_finalization: z.enum(["branch", "pr"]).optional()
6388
+ }).strict().optional()
6383
6389
  }).passthrough();
6384
6390
 
6385
6391
  //#endregion
@@ -12639,4 +12645,4 @@ async function callLLM(params) {
12639
12645
 
12640
12646
  //#endregion
12641
12647
  export { ADVISORY_NOTES, AdapterRegistry, AdtError, BRANCH_PREFIX, 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, createGitWorktreeManager, 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 };
12642
- //# sourceMappingURL=dist-DeyV_vqU.js.map
12648
+ //# sourceMappingURL=dist-CO4BbTu3.js.map
@@ -1,4 +1,4 @@
1
- import { AdtError } from "./dist-DeyV_vqU.js";
1
+ import { AdtError } from "./dist-CO4BbTu3.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-BgV6pqUZ.js.map
74
+ //# sourceMappingURL=errors-0OA2nge4.js.map
@@ -1,3 +1,3 @@
1
- import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-DeyV_vqU.js";
1
+ import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-CO4BbTu3.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-DeyV_vqU.js";
3
- import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-9xd4yEkp.js";
2
+ import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-CO4BbTu3.js";
3
+ import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-qsNEHEaF.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-QOH__JNf.js.map
1003
+ //# sourceMappingURL=health-BbgLm021.js.map
@@ -1,7 +1,7 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-QOH__JNf.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-BbgLm021.js";
2
2
  import "./logger-KeHncl-f.js";
3
- import "./dist-DeyV_vqU.js";
4
- import "./manifest-read-9xd4yEkp.js";
3
+ import "./dist-CO4BbTu3.js";
4
+ import "./manifest-read-qsNEHEaF.js";
5
5
  import "./work-graph-repository-DZyJv5pV.js";
6
6
  import "./decisions-CzSIEeGP.js";
7
7
 
@@ -320,6 +320,10 @@ declare const SubstrateConfigSchema: z.ZodObject<{
320
320
  advisory: "advisory";
321
321
  blocking: "blocking";
322
322
  }>>;
323
+ critical_pass_finalization: z.ZodOptional<z.ZodEnum<{
324
+ branch: "branch";
325
+ pr: "pr";
326
+ }>>;
323
327
  }, z.core.$strict>>;
324
328
  }, z.core.$loose>;
325
329
  type SubstrateConfig = z.infer<typeof SubstrateConfigSchema>; //#endregion
@@ -1629,4 +1633,4 @@ interface Recommendation {
1629
1633
 
1630
1634
  //#endregion
1631
1635
  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 };
1632
- //# sourceMappingURL=index-C31XtSMn.d.ts.map
1636
+ //# sourceMappingURL=index-s7wBSfVT.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-C31XtSMn.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-s7wBSfVT.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-DeyV_vqU.js";
3
+ import { AdapterRegistry, AdtError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter } from "./dist-CO4BbTu3.js";
4
4
  import "./adapter-registry-DXLMTmfD.js";
5
- import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-BgV6pqUZ.js";
5
+ import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-0OA2nge4.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-9xd4yEkp.js";
2
+ import { readCurrentRunId, resolveMainRepoRoot } from "./manifest-read-qsNEHEaF.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-CT_vtUGk.js.map
183
+ //# sourceMappingURL=interactive-prompt-qTo2iuop.js.map
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-DeyV_vqU.js";
2
+ import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-CO4BbTu3.js";
3
3
  import * as path$1 from "path";
4
4
  import { join } from "path";
5
5
  import { readFile } from "fs/promises";
@@ -7192,4 +7192,4 @@ async function resolveRunManifest(dbRoot, runId) {
7192
7192
 
7193
7193
  //#endregion
7194
7194
  export { ACCEPTANCE_CONTRACT_PROFILE_PATH, FindingsInjector, JOURNEY_DEFERRALS_PATH, JOURNEY_REGISTRY_PATH, RunManifest, RuntimeProbeListSchema, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, applyConfigToGraph, computeJourneyCoverage, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, loadAcceptanceContractFromTrustedTree, loadJourneyDeferralsFromTrustedTree, loadJourneyRegistryFromFile, loadJourneyRegistryFromTrustedTree, parseAcceptanceContract, parseJourneyDeferrals, parseJourneyRegistry, parseRuntimeProbes, parseStoryFrontmatter, readCurrentRunId, renderFindings, renderSurface, renderVerdictHtml, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck, runStaleVerificationRecovery, summarizeCoverage };
7195
- //# sourceMappingURL=manifest-read-9xd4yEkp.js.map
7195
+ //# sourceMappingURL=manifest-read-qsNEHEaF.js.map
@@ -1,6 +1,6 @@
1
1
  import "../../logger-KeHncl-f.js";
2
- import "../../dist-DeyV_vqU.js";
3
- import "../../manifest-read-9xd4yEkp.js";
4
- import { runInteractivePrompt } from "../../interactive-prompt-CT_vtUGk.js";
2
+ import "../../dist-CO4BbTu3.js";
3
+ import "../../manifest-read-qsNEHEaF.js";
4
+ import { runInteractivePrompt } from "../../interactive-prompt-qTo2iuop.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-DeyV_vqU.js";
1
+ import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-CO4BbTu3.js";
2
2
  import "./routing-DFxoKHDt.js";
3
3
 
4
4
  export { loadModelRoutingConfig };
@@ -1,14 +1,14 @@
1
- import "./health-QOH__JNf.js";
1
+ import "./health-BbgLm021.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
- import "./dist-DeyV_vqU.js";
5
- import "./manifest-read-9xd4yEkp.js";
6
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-iZqvCT-f.js";
4
+ import "./dist-CO4BbTu3.js";
5
+ import "./manifest-read-qsNEHEaF.js";
6
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-nda59MmG.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-BAPpON_C.js";
11
- import "./interactive-prompt-CT_vtUGk.js";
11
+ import "./interactive-prompt-qTo2iuop.js";
12
12
  import "./recovery-engine-BKGBeBnW.js";
13
13
 
14
14
  export { runRunAction };
@@ -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-QOH__JNf.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-BbgLm021.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, BRANCH_PREFIX, CLAUDE_AUTH_FAILURE_HINT, 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, createGitWorktreeManager, createPipelineRun, createRequirement, detectClaudeAuthFailure, 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-DeyV_vqU.js";
5
- import { ACCEPTANCE_CONTRACT_PROFILE_PATH, FindingsInjector, JOURNEY_DEFERRALS_PATH, RunManifest, RuntimeProbeListSchema, applyConfigToGraph, computeJourneyCoverage, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, loadAcceptanceContractFromTrustedTree, loadJourneyDeferralsFromTrustedTree, loadJourneyRegistryFromTrustedTree, parseRuntimeProbes, parseStoryFrontmatter, renderFindings, renderSurface, renderVerdictHtml, resolveGraphPath, resolveMainRepoRoot, runAcTraceabilityCheck, runStaleVerificationRecovery, summarizeCoverage } from "./manifest-read-9xd4yEkp.js";
4
+ import { ADVISORY_NOTES, BRANCH_PREFIX, CLAUDE_AUTH_FAILURE_HINT, 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, createGitWorktreeManager, createPipelineRun, createRequirement, detectClaudeAuthFailure, 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-CO4BbTu3.js";
5
+ import { ACCEPTANCE_CONTRACT_PROFILE_PATH, FindingsInjector, JOURNEY_DEFERRALS_PATH, RunManifest, RuntimeProbeListSchema, applyConfigToGraph, computeJourneyCoverage, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, loadAcceptanceContractFromTrustedTree, loadJourneyDeferralsFromTrustedTree, loadJourneyRegistryFromTrustedTree, parseRuntimeProbes, parseStoryFrontmatter, renderFindings, renderSurface, renderVerdictHtml, resolveGraphPath, resolveMainRepoRoot, runAcTraceabilityCheck, runStaleVerificationRecovery, summarizeCoverage } from "./manifest-read-qsNEHEaF.js";
6
6
  import { WorkGraphRepository, detectCycles } from "./work-graph-repository-DZyJv5pV.js";
7
7
  import { deriveExitCode, routeDecision } from "./decision-router-BAPpON_C.js";
8
- import { runInteractivePrompt } from "./interactive-prompt-CT_vtUGk.js";
8
+ import { runInteractivePrompt } from "./interactive-prompt-qTo2iuop.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";
@@ -1075,7 +1075,7 @@ const PIPELINE_EVENT_METADATA = [
1075
1075
  {
1076
1076
  name: "reason",
1077
1077
  type: "string",
1078
- description: "Escalation reason. Common values: review-cycles-exhausted (default review-loop max hit); create-story-no-file (create-story phase did not write a story artifact); dev-story-no-commit (substrate auto-commit found no committable changes — agent produced nothing or all changes were outside the worktree); dev-story-commit-failed (substrate auto-commit failed — typically a pre-commit hook rejected the commit; stderr captured in issues); merge-to-main-error (unexpected error in the merge-to-main phase); merge-conflict-detected (story branch could not be merged due to conflicts); parent-tree-dirtied-by-run (uncommitted parent changes intersect the story diff — merge refused, H3.3); ff-only-merge-not-possible (base moved and merge_strategy is ff-only — set finalization.merge_strategy: three-way or integrate manually, H3.3); epic-gate-failed (finalization.epic_gate_command exited non-zero before the last story of an epic integrated, H3.4); story-file-missing (story artifact gone from working tree AND branch HEAD — check wip/feat commits on the story branch, H5.5); undisclosed-files-in-merge (a committed implementation file was never in the dev agent's files_modified, so no review cycle inspected it — inspect the branch, then re-dispatch with accurate files_modified or merge manually, H7); journey-unclaimed (acceptance.mode: blocking — a registered journey has NO story claiming it at epic close; wire it or defer via `substrate acceptance defer`, A0.3); journey-unwalked (acceptance.mode: blocking — a claimed journey was never walked by the acceptance gate at epic close, A0.3); acceptance-unrunnable (acceptance.mode: blocking — a journey registry exists but the committed acceptance contract/registry is absent or invalid, so claimed journeys can never be walked; declare an acceptance: block in the project profile, A1.1). v0.20.87+."
1078
+ description: "Escalation reason. Common values: review-cycles-exhausted (default review-loop max hit); create-story-no-file (create-story phase did not write a story artifact); dev-story-no-commit (substrate auto-commit found no committable changes — agent produced nothing or all changes were outside the worktree); dev-story-commit-failed (substrate auto-commit failed — typically a pre-commit hook rejected the commit; stderr captured in issues); merge-to-main-error (unexpected error in the merge-to-main phase); merge-conflict-detected (story branch could not be merged due to conflicts); parent-tree-dirtied-by-run (uncommitted parent changes intersect the story diff — merge refused, H3.3); ff-only-merge-not-possible (base moved and merge_strategy is ff-only — set finalization.merge_strategy: three-way or integrate manually, H3.3); epic-gate-failed (finalization.epic_gate_command exited non-zero before the last story of an epic integrated, H3.4); story-file-missing (story artifact gone from working tree AND branch HEAD — check wip/feat commits on the story branch, H5.5); undisclosed-files-in-merge (a committed implementation file was never in the dev agent's files_modified, so no review cycle inspected it — inspect the branch, then re-dispatch with accurate files_modified or merge manually, H7); journey-unclaimed (acceptance.mode: blocking — a registered journey has NO story claiming it at epic close; wire it or defer via `substrate acceptance defer`, A0.3); journey-unwalked (acceptance.mode: blocking — a claimed journey was never walked by the acceptance gate at epic close, A0.3); acceptance-unrunnable (acceptance.mode: blocking — a journey registry exists but the committed acceptance contract/registry is absent or invalid, so claimed journeys can never be walked; declare an acceptance: block in the project profile, A1.1); acceptance-fail (acceptance.mode: blocking — a journey-critical acceptance verdict FAILED: the rendered product does not deliver the journey end-states; inspect acceptance:verdict evidence, fix the wiring, re-dispatch, A4.1). v0.20.87+."
1079
1079
  },
1080
1080
  {
1081
1081
  name: "cycles",
@@ -14293,19 +14293,20 @@ function createImplementationOrchestrator(deps) {
14293
14293
  return join$1(homedir(), ".substrate", "acceptance", `${basename$1(root)}-${hash}`, config.pipelineRunId ?? "adhoc");
14294
14294
  }
14295
14295
  async function runAcceptanceStage(storyKey, worktreeDir) {
14296
+ const outcomes = [];
14296
14297
  const mode = config.acceptanceMode ?? "advisory";
14297
- if (mode === "off" || projectRoot === void 0) return;
14298
+ if (mode === "off" || projectRoot === void 0) return outcomes;
14298
14299
  const journeyIds = _stories.get(storyKey)?.journeys ?? [];
14299
- if (journeyIds.length === 0) return;
14300
+ if (journeyIds.length === 0) return outcomes;
14300
14301
  const registryLoad = await loadJourneyRegistryFromTrustedTree(projectRoot);
14301
- if (registryLoad.status !== "ok") return;
14302
+ if (registryLoad.status !== "ok") return outcomes;
14302
14303
  const contractLoad = await loadAcceptanceContractFromTrustedTree(projectRoot);
14303
14304
  if (contractLoad.status !== "ok") {
14304
14305
  logger$28.warn({
14305
14306
  storyKey,
14306
14307
  status: contractLoad.status
14307
14308
  }, "A2.3: no usable acceptance contract — claimed journeys stay unwalked (acceptance-unrunnable at audit)");
14308
- return;
14309
+ return outcomes;
14309
14310
  }
14310
14311
  const contract = contractLoad.contract;
14311
14312
  eventBus.emit("orchestrator:acceptance-started", {
@@ -14315,6 +14316,13 @@ function createImplementationOrchestrator(deps) {
14315
14316
  for (const journeyId of journeyIds) {
14316
14317
  const journey = registryLoad.registry.journeys.find((j$1) => j$1.id === journeyId);
14317
14318
  if (journey === void 0) continue;
14319
+ const outcome = {
14320
+ journeyId,
14321
+ criticality: journey.criticality,
14322
+ judged: false,
14323
+ pass: false
14324
+ };
14325
+ outcomes.push(outcome);
14318
14326
  const journeyDir = join$1(acceptanceArtifactsBase(), storyKey, journeyId);
14319
14327
  const artifacts = [];
14320
14328
  let renderFailed = false;
@@ -14363,8 +14371,25 @@ function createImplementationOrchestrator(deps) {
14363
14371
  artifacts,
14364
14372
  storyKey
14365
14373
  });
14374
+ if (config.pipelineRunId !== void 0 && judge.tokenUsage !== void 0) Promise.resolve().then(() => addTokenUsage(db, config.pipelineRunId, {
14375
+ phase: "acceptance-judge",
14376
+ agent: "acceptance-judge",
14377
+ input_tokens: judge.tokenUsage.input,
14378
+ output_tokens: judge.tokenUsage.output,
14379
+ cost_usd: estimateDispatchCost(judge.tokenUsage.input, judge.tokenUsage.output),
14380
+ metadata: JSON.stringify({
14381
+ storyKey,
14382
+ journeyId
14383
+ })
14384
+ })).catch((tokenErr) => logger$28.warn({
14385
+ storyKey,
14386
+ journeyId,
14387
+ err: tokenErr
14388
+ }, "A4.3: acceptance-judge token usage record failed"));
14366
14389
  if (judge.result === "success" && judge.verdicts !== void 0) {
14367
14390
  _journeyVerdicts.set(journeyId, judge.verdicts);
14391
+ outcome.judged = true;
14392
+ outcome.pass = judge.verdicts.every((v) => v.verdict === "PASS");
14368
14393
  eventBus.emit("orchestrator:acceptance-verdict", {
14369
14394
  storyKey,
14370
14395
  journeyId,
@@ -14382,6 +14407,7 @@ function createImplementationOrchestrator(deps) {
14382
14407
  details: judge.details
14383
14408
  }, "A2.3: judge failed — journey stays unwalked");
14384
14409
  }
14410
+ return outcomes;
14385
14411
  }
14386
14412
  async function auditJourneyCoverage(scope, opts) {
14387
14413
  const mode = config.acceptanceMode ?? "advisory";
@@ -16855,15 +16881,65 @@ function createImplementationOrchestrator(deps) {
16855
16881
  return "terminal";
16856
16882
  }
16857
16883
  }
16884
+ let acceptanceOutcomes = [];
16858
16885
  try {
16859
- await runAcceptanceStage(storyKey, effectiveProjectRoot ?? projectRoot ?? process.cwd());
16886
+ acceptanceOutcomes = await runAcceptanceStage(storyKey, effectiveProjectRoot ?? projectRoot ?? process.cwd());
16860
16887
  } catch (stageErr) {
16861
16888
  logger$28.warn({
16862
16889
  storyKey,
16863
16890
  err: stageErr
16864
16891
  }, "A2.3: acceptance stage threw (best-effort) — claimed journeys stay unwalked");
16865
16892
  }
16866
- const finalizationMode = config.finalizationMode ?? "merge";
16893
+ let finalizationMode = config.finalizationMode ?? "merge";
16894
+ if ((config.acceptanceMode ?? "advisory") === "blocking" && acceptanceOutcomes.length > 0) {
16895
+ const criticalFailed = acceptanceOutcomes.filter((o) => o.criticality === "critical" && o.judged && !o.pass);
16896
+ if (criticalFailed.length > 0) {
16897
+ const failedIds = criticalFailed.map((o) => o.journeyId);
16898
+ logger$28.error({
16899
+ storyKey,
16900
+ journeys: failedIds
16901
+ }, "A4.1: journey-critical acceptance FAIL — blocking integration; branch preserved");
16902
+ updateStory(storyKey, {
16903
+ phase: "ESCALATED",
16904
+ error: "acceptance-fail",
16905
+ completedAt: new Date().toISOString()
16906
+ });
16907
+ await emitEscalation({
16908
+ storyKey,
16909
+ lastVerdict: "acceptance-fail",
16910
+ reviewCycles: completedReviewCycles,
16911
+ issues: [`journey-critical acceptance verdicts FAILED for: ${failedIds.join(", ")} — the rendered product does not deliver the journey's end-states.`, "Inspect the verdict evidence (acceptance:verdict events / run report), fix the wiring, and re-dispatch. The story branch is preserved."]
16912
+ });
16913
+ await persistState();
16914
+ return "terminal";
16915
+ }
16916
+ const standardFailed = acceptanceOutcomes.filter((o) => o.criticality === "standard" && o.judged && !o.pass);
16917
+ if (standardFailed.length > 0) {
16918
+ logger$28.warn({
16919
+ storyKey,
16920
+ journeys: standardFailed.map((o) => o.journeyId)
16921
+ }, "A4.1: standard-tier acceptance FAIL — run continues; fix-story proposal filed (best-effort)");
16922
+ if (runManifest !== null && typeof runManifest.appendProposal === "function") await runManifest.appendProposal({
16923
+ id: `acceptance-fail-${storyKey}-${Date.now()}`,
16924
+ created_at: new Date().toISOString(),
16925
+ description: `standard-tier journey acceptance FAILED (${standardFailed.map((o) => o.journeyId).join(", ")}) — file a fix story to wire the journey end-states`,
16926
+ type: "fix",
16927
+ story_key: storyKey
16928
+ }).catch((err) => logger$28.warn({
16929
+ err,
16930
+ storyKey
16931
+ }, "A4.1: proposal append failed — pipeline continues"));
16932
+ }
16933
+ const critical = acceptanceOutcomes.filter((o) => o.criticality === "critical");
16934
+ if (finalizationMode === "merge" && critical.length > 0 && critical.every((o) => o.judged && o.pass)) {
16935
+ finalizationMode = config.acceptanceCriticalPassFinalization ?? "branch";
16936
+ logger$28.info({
16937
+ storyKey,
16938
+ journeys: critical.map((o) => o.journeyId),
16939
+ finalizationMode
16940
+ }, "A4.2: journey-critical PASS — integration downgraded for human-held merge (verdict artifact in the run report)");
16941
+ }
16942
+ }
16867
16943
  {
16868
16944
  const acceptanceModeCfg = config.acceptanceMode ?? "advisory";
16869
16945
  if (acceptanceModeCfg !== "off") {
@@ -47307,6 +47383,7 @@ async function runRunAction(options) {
47307
47383
  let configMergeStrategy;
47308
47384
  let configEpicGateCommand;
47309
47385
  let configAcceptanceMode;
47386
+ let configAcceptanceCriticalPassFinalization;
47310
47387
  let configPermissionProfile;
47311
47388
  let configWorktreeCopyFiles;
47312
47389
  try {
@@ -47338,6 +47415,7 @@ async function runRunAction(options) {
47338
47415
  if (cfg.finalization?.merge_strategy !== void 0) configMergeStrategy = cfg.finalization.merge_strategy;
47339
47416
  if (cfg.finalization?.epic_gate_command !== void 0) configEpicGateCommand = cfg.finalization.epic_gate_command;
47340
47417
  if (cfg.acceptance?.mode !== void 0) configAcceptanceMode = cfg.acceptance.mode;
47418
+ if (cfg.acceptance?.critical_pass_finalization !== void 0) configAcceptanceCriticalPassFinalization = cfg.acceptance.critical_pass_finalization;
47341
47419
  if (cfg.dispatch?.permission_profile !== void 0) configPermissionProfile = cfg.dispatch.permission_profile;
47342
47420
  if (Array.isArray(cfg.worktree?.copy_files) && cfg.worktree.copy_files.length > 0) {
47343
47421
  configWorktreeCopyFiles = [...cfg.worktree.copy_files];
@@ -47442,6 +47520,7 @@ async function runRunAction(options) {
47442
47520
  ...configMergeStrategy !== void 0 ? { mergeStrategy: configMergeStrategy } : {},
47443
47521
  ...configEpicGateCommand !== void 0 ? { epicGateCommand: configEpicGateCommand } : {},
47444
47522
  ...configAcceptanceMode !== void 0 ? { acceptanceMode: configAcceptanceMode } : {},
47523
+ ...configAcceptanceCriticalPassFinalization !== void 0 ? { acceptanceCriticalPassFinalization: configAcceptanceCriticalPassFinalization } : {},
47445
47524
  ...configPermissionProfile !== void 0 ? { permissionProfile: configPermissionProfile } : {},
47446
47525
  ...configWorktreeCopyFiles !== void 0 ? { worktreeCopyFiles: configWorktreeCopyFiles } : {}
47447
47526
  });
@@ -48011,6 +48090,7 @@ async function runRunAction(options) {
48011
48090
  ...configMergeStrategy !== void 0 ? { mergeStrategy: configMergeStrategy } : {},
48012
48091
  ...configEpicGateCommand !== void 0 ? { epicGateCommand: configEpicGateCommand } : {},
48013
48092
  ...configAcceptanceMode !== void 0 ? { acceptanceMode: configAcceptanceMode } : {},
48093
+ ...configAcceptanceCriticalPassFinalization !== void 0 ? { acceptanceCriticalPassFinalization: configAcceptanceCriticalPassFinalization } : {},
48014
48094
  ...configWorktreeCopyFiles !== void 0 ? { worktreeCopyFiles: configWorktreeCopyFiles } : {}
48015
48095
  },
48016
48096
  projectRoot,
@@ -48234,7 +48314,7 @@ async function runRunAction(options) {
48234
48314
  }
48235
48315
  }
48236
48316
  async function runFullPipeline(options) {
48237
- const { packName, packPath, dbDir, dbPath, startPhase, stopAfter, concept, concurrency, outputFormat, projectRoot, events: eventsFlag, skipUx, research: researchFlag, skipResearch: skipResearchFlag, skipPreflight, skipVerification, maxReviewCycles = 2, retryBudget, registry: injectedRegistry, tokenCeilings, stories: explicitStories, telemetryEnabled: fullTelemetryEnabled, telemetryPort: fullTelemetryPort, agentId, meshUrl: fpMeshUrl, meshProjectId: fpMeshProjectId, engineType: fpEngineType, probeAuthor, probeAuthorStateIntegrating: fpProbeAuthorStateIntegrating, noWorktree, worktreeCopyFiles: fpWorktreeCopyFiles, finalizationMode: fpFinalizationMode, mergeStrategy: fpMergeStrategy, epicGateCommand: fpEpicGateCommand, acceptanceMode: fpAcceptanceMode, permissionProfile: fpPermissionProfile } = options;
48317
+ const { packName, packPath, dbDir, dbPath, startPhase, stopAfter, concept, concurrency, outputFormat, projectRoot, events: eventsFlag, skipUx, research: researchFlag, skipResearch: skipResearchFlag, skipPreflight, skipVerification, maxReviewCycles = 2, retryBudget, registry: injectedRegistry, tokenCeilings, stories: explicitStories, telemetryEnabled: fullTelemetryEnabled, telemetryPort: fullTelemetryPort, agentId, meshUrl: fpMeshUrl, meshProjectId: fpMeshProjectId, engineType: fpEngineType, probeAuthor, probeAuthorStateIntegrating: fpProbeAuthorStateIntegrating, noWorktree, worktreeCopyFiles: fpWorktreeCopyFiles, finalizationMode: fpFinalizationMode, mergeStrategy: fpMergeStrategy, epicGateCommand: fpEpicGateCommand, acceptanceMode: fpAcceptanceMode, acceptanceCriticalPassFinalization: fpAcceptanceCriticalPassFinalization, permissionProfile: fpPermissionProfile } = options;
48238
48318
  if (!existsSync$1(dbDir)) mkdirSync$1(dbDir, { recursive: true });
48239
48319
  let doltServerFull = null;
48240
48320
  try {
@@ -48551,6 +48631,7 @@ async function runFullPipeline(options) {
48551
48631
  ...fpMergeStrategy !== void 0 ? { mergeStrategy: fpMergeStrategy } : {},
48552
48632
  ...fpEpicGateCommand !== void 0 ? { epicGateCommand: fpEpicGateCommand } : {},
48553
48633
  ...fpAcceptanceMode !== void 0 ? { acceptanceMode: fpAcceptanceMode } : {},
48634
+ ...fpAcceptanceCriticalPassFinalization !== void 0 ? { acceptanceCriticalPassFinalization: fpAcceptanceCriticalPassFinalization } : {},
48554
48635
  ...fpWorktreeCopyFiles !== void 0 ? { worktreeCopyFiles: fpWorktreeCopyFiles } : {}
48555
48636
  },
48556
48637
  projectRoot,
@@ -48721,7 +48802,7 @@ async function runFullPipeline(options) {
48721
48802
  */
48722
48803
  async function emitPreDispatchVersionAdvisory(currentVersion) {
48723
48804
  if (process.env["SUBSTRATE_NO_UPDATE_CHECK"] === "1") return;
48724
- const { createVersionManager } = await import("./version-manager-impl-Cc7yx4i5.js");
48805
+ const { createVersionManager } = await import("./version-manager-impl-DSK9i3Xk.js");
48725
48806
  const vm = createVersionManager();
48726
48807
  const result = await vm.checkForUpdates(true);
48727
48808
  const gap = classifyVersionGap(currentVersion, result.latestVersion);
@@ -48828,4 +48909,4 @@ function registerRunCommand(program, version = "0.0.0", projectRoot = process.cw
48828
48909
 
48829
48910
  //#endregion
48830
48911
  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, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape$1 as escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, resolveStoryKeys, runAcceptanceJudge, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runRunAction, runSolutioningPhase, unescape$1 as unescape, validateStopAfterFromConflict, wireNdjsonEmitter };
48831
- //# sourceMappingURL=run-iZqvCT-f.js.map
48912
+ //# sourceMappingURL=run-nda59MmG.js.map
@@ -1,4 +1,4 @@
1
- import { CoreEvents, DatabaseAdapter, TypedEventBus } from "../../../index-C31XtSMn.js";
1
+ import { CoreEvents, DatabaseAdapter, TypedEventBus } from "../../../index-s7wBSfVT.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-DeyV_vqU.js";
1
+ import "./dist-CO4BbTu3.js";
2
2
  import "./version-manager-impl-qFBiO4Eh.js";
3
- import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-lE_GIvWv.js";
3
+ import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-DGpQdA9A.js";
4
4
 
5
5
  export { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand };
@@ -1,4 +1,4 @@
1
- import { createVersionManager } from "./dist-DeyV_vqU.js";
1
+ import { createVersionManager } from "./dist-CO4BbTu3.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-lE_GIvWv.js.map
126
+ //# sourceMappingURL=upgrade-DGpQdA9A.js.map
@@ -1,4 +1,4 @@
1
- import { VersionManagerImpl, createVersionManager } from "./dist-DeyV_vqU.js";
1
+ import { VersionManagerImpl, createVersionManager } from "./dist-CO4BbTu3.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.21.8",
3
+ "version": "0.21.9",
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-DeyV_vqU.js";
2
- import "./adapter-registry-DXLMTmfD.js";
3
-
4
- export { AdapterRegistry };