substrate-ai 0.19.19 → 0.19.21

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-DmhbWZ0f.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, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot } from "../health-CkQncTB5.js";
2
+ import { FileStateStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot } from "../health-Cw21tMNg.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, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-CtFYOaeA.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, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-DmhbWZ0f.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-v7BddUfv.js";
8
- import "../errors-CWSATPPa.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-CjaZyR8x.js";
8
+ import "../errors-CrFWBvB4.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-UCMt4b7A.js";
12
+ import { registerUpgradeCommand } from "../upgrade-o__Q1Kdc.js";
13
13
  import { Command } from "commander";
14
14
  import { fileURLToPath } from "url";
15
15
  import { dirname, join, resolve } from "path";
@@ -3215,7 +3215,7 @@ async function runStatusAction(options) {
3215
3215
  if (run === void 0) run = await getLatestRun(adapter);
3216
3216
  }
3217
3217
  if (run === void 0) {
3218
- const { inspectProcessTree } = await import("../health-DlKuVhQH.js");
3218
+ const { inspectProcessTree } = await import("../health-BQgWJ1Kf.js");
3219
3219
  const substrateDirPath = join(projectRoot, ".substrate");
3220
3220
  const processInfo = inspectProcessTree({
3221
3221
  projectRoot,
@@ -4102,7 +4102,7 @@ function defaultSupervisorDeps() {
4102
4102
  if (cached === null) {
4103
4103
  const { AdapterRegistry: AR } = await import(
4104
4104
  /* @vite-ignore */
4105
- "../adapter-registry-BDvUQgG3.js"
4105
+ "../adapter-registry-CHFfvph6.js"
4106
4106
  );
4107
4107
  cached = new AR();
4108
4108
  await cached.discoverAndRegister();
@@ -4544,11 +4544,11 @@ async function runSupervisorAction(options, deps = {}) {
4544
4544
  try {
4545
4545
  const { createExperimenter } = await import(
4546
4546
  /* @vite-ignore */
4547
- "../experimenter-ChKZzonq.js"
4547
+ "../experimenter-BzWRPx13.js"
4548
4548
  );
4549
4549
  const { getLatestRun: getLatest } = await import(
4550
4550
  /* @vite-ignore */
4551
- "../decisions-BEAzpqOy.js"
4551
+ "../decisions-B9fESQQz.js"
4552
4552
  );
4553
4553
  const expAdapter = createDatabaseAdapter({
4554
4554
  backend: "auto",
@@ -4558,7 +4558,7 @@ async function runSupervisorAction(options, deps = {}) {
4558
4558
  await initSchema(expAdapter);
4559
4559
  const { runRunAction: runPipeline } = await import(
4560
4560
  /* @vite-ignore */
4561
- "../run-D4ujU2Jw.js"
4561
+ "../run-IuX7h-wp.js"
4562
4562
  );
4563
4563
  const runStoryFn = async (opts) => {
4564
4564
  const exitCode = await runPipeline({
@@ -5088,7 +5088,7 @@ async function runMetricsAction(options) {
5088
5088
  const routingConfigPath = join(dbDir, "routing.yml");
5089
5089
  let routingConfig = null;
5090
5090
  if (existsSync$1(routingConfigPath)) try {
5091
- const { loadModelRoutingConfig } = await import("../routing-DXoZWjBO.js");
5091
+ const { loadModelRoutingConfig } = await import("../routing-CLiOXDct.js");
5092
5092
  routingConfig = loadModelRoutingConfig(routingConfigPath);
5093
5093
  } catch {}
5094
5094
  if (routingConfig === null) routingConfig = {
@@ -8248,8 +8248,8 @@ async function createProgram() {
8248
8248
  /** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
8249
8249
  function checkForUpdatesInBackground(currentVersion) {
8250
8250
  if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
8251
- import("../upgrade-D_od33Mu.js").then(async () => {
8252
- const { createVersionManager } = await import("../version-manager-impl-DA5apVDT.js");
8251
+ import("../upgrade-BPh0o_3L.js").then(async () => {
8252
+ const { createVersionManager } = await import("../version-manager-impl-BO2Gvy5R.js");
8253
8253
  const vm = createVersionManager();
8254
8254
  const result = await vm.checkForUpdates();
8255
8255
  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-CtFYOaeA.js";
1
+ import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-DmhbWZ0f.js";
2
2
  import "./decisions-C0pz9Clx.js";
3
3
 
4
4
  export { getLatestRun };
@@ -516,12 +516,15 @@ const CHARS_PER_TOKEN$3 = 4;
516
516
  /**
517
517
  * Extract top-level field names from a Zod schema for prompt injection.
518
518
  * Returns field names with type hints (e.g., "result: <string>", "files_modified: <list>").
519
+ * Exported for testing.
519
520
  */
520
521
  function extractSchemaFields(schema) {
521
522
  let current = schema;
522
523
  let def = current?._def;
523
- while (def?.typeName === "ZodEffects" && def?.schema != null) {
524
- current = def.schema;
524
+ while (true) {
525
+ if (def?.typeName === "ZodEffects" && def?.schema != null) current = def.schema;
526
+ else if (def?.type === "pipe" && def?.in != null) current = def.in;
527
+ else break;
525
528
  def = current?._def;
526
529
  }
527
530
  const shape = current?.shape;
@@ -538,20 +541,26 @@ function extractSchemaFields(schema) {
538
541
  */
539
542
  function resolveZodTypeName(fieldDef) {
540
543
  const d = fieldDef;
541
- const typeName = d?._def?.typeName;
542
- if (typeName === "ZodOptional" || typeName === "ZodDefault") return d._def?.innerType != null ? resolveZodTypeName(d._def.innerType) : "<value>";
544
+ const typeName = d?._def?.typeName ?? d?._def?.type;
545
+ if (typeName === "ZodOptional" || typeName === "optional" || typeName === "ZodDefault" || typeName === "default") return d._def?.innerType != null ? resolveZodTypeName(d._def.innerType) : "<value>";
543
546
  if (typeName === "ZodEffects") return d._def?.schema != null ? resolveZodTypeName(d._def.schema) : "<value>";
544
- if (typeName === "ZodString") return "<string>";
545
- if (typeName === "ZodNumber") return "<number>";
546
- if (typeName === "ZodBoolean") return "<boolean>";
547
- if (typeName === "ZodEnum") {
547
+ if (typeName === "transform") return "<value>";
548
+ if (typeName === "pipe") return d._def?.out != null ? resolveZodTypeName(d._def.out) : "<value>";
549
+ if (typeName === "ZodString" || typeName === "string") return "<string>";
550
+ if (typeName === "ZodNumber" || typeName === "number") return "<number>";
551
+ if (typeName === "ZodBoolean" || typeName === "boolean") return "<boolean>";
552
+ if (typeName === "ZodEnum" || typeName === "enum") {
548
553
  const values = d._def?.values;
549
- return values != null ? values.join(" | ") : "<enum>";
554
+ const entries = d._def?.entries;
555
+ if (values != null) return values.join(" | ");
556
+ if (entries != null) return Object.keys(entries).join(" | ");
557
+ return "<enum>";
550
558
  }
551
- if (typeName === "ZodArray") return "<list>";
552
- if (typeName === "ZodObject") return "<object>";
559
+ if (typeName === "ZodArray" || typeName === "array") return "<list>";
560
+ if (typeName === "ZodObject" || typeName === "object") return "<object>";
553
561
  return "<value>";
554
562
  }
563
+ /** Exported for testing. */
555
564
  function buildYamlOutputSuffix(outputSchema) {
556
565
  const fields = outputSchema != null ? extractSchemaFields(outputSchema) : [];
557
566
  const fieldLines = fields.length > 0 ? fields.map((f) => ` ${f}`).join("\n") : " result: success\n # ... additional fields as specified in the task above";
@@ -10442,4 +10451,4 @@ async function callLLM(params) {
10442
10451
 
10443
10452
  //#endregion
10444
10453
  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, 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 };
10445
- //# sourceMappingURL=dist-CtFYOaeA.js.map
10454
+ //# sourceMappingURL=dist-DmhbWZ0f.js.map
@@ -1,4 +1,4 @@
1
- import { AdtError } from "./dist-CtFYOaeA.js";
1
+ import { AdtError } from "./dist-DmhbWZ0f.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-CWSATPPa.js.map
74
+ //# sourceMappingURL=errors-CrFWBvB4.js.map
@@ -1,3 +1,3 @@
1
- import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-CtFYOaeA.js";
1
+ import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-DmhbWZ0f.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-CkQncTB5.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-Cw21tMNg.js";
2
2
  import "./logger-KeHncl-f.js";
3
- import "./dist-CtFYOaeA.js";
3
+ import "./dist-DmhbWZ0f.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, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-CtFYOaeA.js";
2
+ import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-DmhbWZ0f.js";
3
3
  import { createRequire } from "module";
4
4
  import { dirname, join } from "path";
5
5
  import { existsSync, readFileSync } from "node:fs";
@@ -1930,4 +1930,4 @@ function registerHealthCommand(program, _version = "0.0.0", projectRoot = proces
1930
1930
 
1931
1931
  //#endregion
1932
1932
  export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, DoltMergeConflict, FileStateStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN$1 as STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, WorkGraphRepository, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createStateStore, detectCycles, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, runHealthAction, validateStoryKey };
1933
- //# sourceMappingURL=health-CkQncTB5.js.map
1933
+ //# sourceMappingURL=health-Cw21tMNg.js.map
package/dist/index.d.ts CHANGED
@@ -147,6 +147,28 @@ interface StoryDoneEvent {
147
147
  /** Number of review cycles completed */
148
148
  review_cycles: number;
149
149
  }
150
+ /**
151
+ * Emitted when the orchestrator auto-approves a story after exhausting
152
+ * review cycles with only minor issues remaining. Provides transparency
153
+ * about why a NEEDS_MINOR_FIXES verdict resulted in COMPLETE status.
154
+ */
155
+ interface StoryAutoApprovedEvent {
156
+ type: 'story:auto-approved';
157
+ /** ISO-8601 timestamp generated at emit time */
158
+ ts: string;
159
+ /** Story key (e.g., "10-1") */
160
+ key: string;
161
+ /** Final review verdict (always NEEDS_MINOR_FIXES for auto-approve) */
162
+ verdict: string;
163
+ /** Number of review cycles completed */
164
+ review_cycles: number;
165
+ /** Maximum review cycles configured */
166
+ max_review_cycles: number;
167
+ /** Number of remaining issues at auto-approve time */
168
+ issue_count: number;
169
+ /** Human-readable reason for auto-approval */
170
+ reason: string;
171
+ }
150
172
  /**
151
173
  * An individual issue from a code review, included in escalation events.
152
174
  */
@@ -620,7 +642,7 @@ interface PipelinePhaseCompleteEvent {
620
642
  * }
621
643
  * ```
622
644
  */
623
- type PipelineEvent = PipelineStartEvent | PipelineCompleteEvent | PipelinePreFlightFailureEvent | PipelineProfileStaleEvent | PipelineContractMismatchEvent | PipelineContractVerificationSummaryEvent | StoryPhaseEvent | StoryDoneEvent | StoryEscalationEvent | StoryWarnEvent | StoryLogEvent | PipelineHeartbeatEvent | StoryStallEvent | StoryZeroDiffEscalationEvent | StoryBuildVerificationFailedEvent | StoryBuildVerificationPassedEvent | StoryInterfaceChangeWarningEvent | StoryMetricsEvent | SupervisorPollEvent | SupervisorKillEvent | SupervisorRestartEvent | SupervisorAbortEvent | SupervisorSummaryEvent | SupervisorAnalysisCompleteEvent | SupervisorAnalysisErrorEvent | SupervisorExperimentStartEvent | SupervisorExperimentSkipEvent | SupervisorExperimentRecommendationsEvent | SupervisorExperimentCompleteEvent | SupervisorExperimentErrorEvent | RoutingModelSelectedEvent | PipelinePhaseStartEvent | PipelinePhaseCompleteEvent; //#endregion
645
+ type PipelineEvent = PipelineStartEvent | PipelineCompleteEvent | PipelinePreFlightFailureEvent | PipelineProfileStaleEvent | PipelineContractMismatchEvent | PipelineContractVerificationSummaryEvent | StoryPhaseEvent | StoryDoneEvent | StoryEscalationEvent | StoryWarnEvent | StoryLogEvent | PipelineHeartbeatEvent | StoryStallEvent | StoryZeroDiffEscalationEvent | StoryBuildVerificationFailedEvent | StoryBuildVerificationPassedEvent | StoryInterfaceChangeWarningEvent | StoryMetricsEvent | SupervisorPollEvent | SupervisorKillEvent | SupervisorRestartEvent | SupervisorAbortEvent | SupervisorSummaryEvent | SupervisorAnalysisCompleteEvent | SupervisorAnalysisErrorEvent | SupervisorExperimentStartEvent | SupervisorExperimentSkipEvent | SupervisorExperimentRecommendationsEvent | SupervisorExperimentCompleteEvent | SupervisorExperimentErrorEvent | RoutingModelSelectedEvent | PipelinePhaseStartEvent | PipelinePhaseCompleteEvent | StoryAutoApprovedEvent; //#endregion
624
646
  //#region packages/core/dist/types.d.ts
625
647
 
626
648
  /**
@@ -1951,6 +1973,15 @@ interface OrchestratorEvents {
1951
1973
  rationale: string;
1952
1974
  };
1953
1975
  };
1976
+ /** Story auto-approved after exhausting review cycles with only minor issues */
1977
+ 'story:auto-approved': {
1978
+ storyKey: string;
1979
+ verdict: string;
1980
+ reviewCycles: number;
1981
+ maxReviewCycles: number;
1982
+ issueCount: number;
1983
+ reason: string;
1984
+ };
1954
1985
  /** A non-fatal warning occurred during story processing */
1955
1986
  'orchestrator:story-warn': {
1956
1987
  storyKey: string;
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-CtFYOaeA.js";
3
+ import { AdapterRegistry, AdtError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter } from "./dist-DmhbWZ0f.js";
4
4
  import "./adapter-registry-DXLMTmfD.js";
5
- import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-CWSATPPa.js";
5
+ import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-CrFWBvB4.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-CtFYOaeA.js";
1
+ import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-DmhbWZ0f.js";
2
2
  import "./routing-CcBOCuC9.js";
3
3
 
4
4
  export { loadModelRoutingConfig };
@@ -1,7 +1,7 @@
1
- import { BMAD_BASELINE_TOKENS_FULL, DoltMergeConflict, FileStateStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, WorkGraphRepository, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter, detectCycles, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, resolveMainRepoRoot, validateStoryKey } from "./health-CkQncTB5.js";
1
+ import { BMAD_BASELINE_TOKENS_FULL, DoltMergeConflict, FileStateStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, WorkGraphRepository, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter, detectCycles, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, resolveMainRepoRoot, validateStoryKey } from "./health-Cw21tMNg.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, 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, createConfigSystem, createDatabaseAdapter$1, createDecision, createPipelineRun, createRequirement, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, listRequirements, loadModelRoutingConfig, registerArtifact, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-CtFYOaeA.js";
4
+ import { ADVISORY_NOTES, 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, createConfigSystem, createDatabaseAdapter$1, createDecision, createPipelineRun, createRequirement, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, listRequirements, loadModelRoutingConfig, registerArtifact, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-DmhbWZ0f.js";
5
5
  import { basename, dirname, extname, join } from "path";
6
6
  import { access, readFile, readdir, stat } from "fs/promises";
7
7
  import { EventEmitter } from "node:events";
@@ -1247,6 +1247,48 @@ const PIPELINE_EVENT_METADATA = [
1247
1247
  }
1248
1248
  ]
1249
1249
  },
1250
+ {
1251
+ type: "story:auto-approved",
1252
+ description: "Story auto-approved after exhausting review cycles with only minor issues.",
1253
+ when: "When review cycles reach the maximum and the final verdict is NEEDS_MINOR_FIXES (not MAJOR_REWORK).",
1254
+ fields: [
1255
+ {
1256
+ name: "ts",
1257
+ type: "string",
1258
+ description: "Timestamp."
1259
+ },
1260
+ {
1261
+ name: "key",
1262
+ type: "string",
1263
+ description: "Story key."
1264
+ },
1265
+ {
1266
+ name: "verdict",
1267
+ type: "string",
1268
+ description: "Final review verdict (NEEDS_MINOR_FIXES)."
1269
+ },
1270
+ {
1271
+ name: "review_cycles",
1272
+ type: "number",
1273
+ description: "Review cycles completed."
1274
+ },
1275
+ {
1276
+ name: "max_review_cycles",
1277
+ type: "number",
1278
+ description: "Maximum review cycles configured."
1279
+ },
1280
+ {
1281
+ name: "issue_count",
1282
+ type: "number",
1283
+ description: "Remaining issues at auto-approve time."
1284
+ },
1285
+ {
1286
+ name: "reason",
1287
+ type: "string",
1288
+ description: "Human-readable reason for auto-approval."
1289
+ }
1290
+ ]
1291
+ },
1250
1292
  {
1251
1293
  type: "routing:model-selected",
1252
1294
  description: "Model routing resolver selected a model for a dispatch.",
@@ -40275,6 +40317,7 @@ const logger = createLogger("run-cmd");
40275
40317
  * Resolve effective max review cycles by checking the adapter's default.
40276
40318
  * Uses Math.max so the adapter's recommendation is a floor, not an override.
40277
40319
  */
40320
+ /** Exported for testing. */
40278
40321
  function resolveMaxReviewCycles(cliValue, agentId, registry) {
40279
40322
  if (agentId == null || registry == null) return cliValue;
40280
40323
  const adapter = registry.get(agentId);
@@ -41776,5 +41819,5 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
41776
41819
  }
41777
41820
 
41778
41821
  //#endregion
41779
- export { 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, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
41780
- //# sourceMappingURL=run-v7BddUfv.js.map
41822
+ export { 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, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveMaxReviewCycles, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
41823
+ //# sourceMappingURL=run-CjaZyR8x.js.map
@@ -0,0 +1,9 @@
1
+ import "./health-Cw21tMNg.js";
2
+ import "./logger-KeHncl-f.js";
3
+ import "./helpers-CElYrONe.js";
4
+ import "./dist-DmhbWZ0f.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction } from "./run-CjaZyR8x.js";
6
+ import "./routing-CcBOCuC9.js";
7
+ import "./decisions-C0pz9Clx.js";
8
+
9
+ export { runRunAction };
@@ -1,5 +1,5 @@
1
- import "./dist-CtFYOaeA.js";
1
+ import "./dist-DmhbWZ0f.js";
2
2
  import "./version-manager-impl-BmOWu8ml.js";
3
- import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-UCMt4b7A.js";
3
+ import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-o__Q1Kdc.js";
4
4
 
5
5
  export { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand };
@@ -1,4 +1,4 @@
1
- import { createVersionManager } from "./dist-CtFYOaeA.js";
1
+ import { createVersionManager } from "./dist-DmhbWZ0f.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-UCMt4b7A.js.map
126
+ //# sourceMappingURL=upgrade-o__Q1Kdc.js.map
@@ -1,4 +1,4 @@
1
- import { VersionManagerImpl, createVersionManager } from "./dist-CtFYOaeA.js";
1
+ import { VersionManagerImpl, createVersionManager } from "./dist-DmhbWZ0f.js";
2
2
  import "./version-manager-impl-BmOWu8ml.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.19.19",
3
+ "version": "0.19.21",
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-CtFYOaeA.js";
2
- import "./adapter-registry-DXLMTmfD.js";
3
-
4
- export { AdapterRegistry };
@@ -1,9 +0,0 @@
1
- import "./health-CkQncTB5.js";
2
- import "./logger-KeHncl-f.js";
3
- import "./helpers-CElYrONe.js";
4
- import "./dist-CtFYOaeA.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, runRunAction } from "./run-v7BddUfv.js";
6
- import "./routing-CcBOCuC9.js";
7
- import "./decisions-C0pz9Clx.js";
8
-
9
- export { runRunAction };