substrate-ai 0.20.109 → 0.20.111

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-BGZiFI9J.js";
2
+ import "./adapter-registry-DIcrxjH8.js";
3
+
4
+ export { AdapterRegistry };
package/dist/cli/index.js CHANGED
@@ -1,20 +1,20 @@
1
1
  #!/usr/bin/env node
2
- import { FileKvStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createDatabaseAdapter, createDoltOperatorReader, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion } from "../health-DbdOKMYr.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-B-K-bN-0.js";
3
3
  import { createLogger } from "../logger-KeHncl-f.js";
4
4
  import { createEventBus } from "../helpers-CElYrONe.js";
5
- import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, GlobalSettingsSchema, InMemoryDatabaseAdapter, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createPipelineRun, 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-sltQk3gU.js";
6
- import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-B8RHheJ5.js";
5
+ import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, GlobalSettingsSchema, InMemoryDatabaseAdapter, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createPipelineRun, 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-BGZiFI9J.js";
6
+ import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-7A1EUUHU.js";
7
7
  import "../adapter-registry-DIcrxjH8.js";
8
- import { RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck } from "../manifest-read-BqOSfq3H.js";
9
- import "../errors-B6wYX9Xl.js";
8
+ import { RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck } from "../manifest-read-DcGYzUFh.js";
9
+ import "../errors-BzUiyd5I.js";
10
10
  import "../routing-DFxoKHDt.js";
11
11
  import { WorkGraphRepository } from "../work-graph-repository-DZyJv5pV.js";
12
12
  import "../decisions-CzSIEeGP.js";
13
13
  import "../decision-router-DblHY8se.js";
14
- import "../interactive-prompt-CfF042kK.js";
14
+ import "../interactive-prompt-B1mN4QPJ.js";
15
15
  import "../recovery-engine-BKGBeBnW.js";
16
16
  import "../version-manager-impl-qFBiO4Eh.js";
17
- import { registerUpgradeCommand } from "../upgrade-BEzt7Xsf.js";
17
+ import { registerUpgradeCommand } from "../upgrade-BL3czSQv.js";
18
18
  import { Command } from "commander";
19
19
  import { fileURLToPath } from "url";
20
20
  import { dirname, join, resolve } from "path";
@@ -6894,7 +6894,7 @@ async function runStatusAction(options) {
6894
6894
  logger$15.debug({ err }, "Work graph query failed, continuing without work graph data");
6895
6895
  }
6896
6896
  if (run === void 0) {
6897
- const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-C2DKOHcb.js");
6897
+ const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-EvY7yEBY.js");
6898
6898
  const substrateDirPath = join(projectRoot, ".substrate");
6899
6899
  const processInfo = inspectProcessTree$1({
6900
6900
  projectRoot,
@@ -7842,7 +7842,7 @@ function defaultSupervisorDeps() {
7842
7842
  if (cached === null) {
7843
7843
  const { AdapterRegistry: AR } = await import(
7844
7844
  /* @vite-ignore */
7845
- "../adapter-registry-BZKRRwIn.js"
7845
+ "../adapter-registry-DVrry2g2.js"
7846
7846
  );
7847
7847
  cached = new AR();
7848
7848
  await cached.discoverAndRegister();
@@ -8409,11 +8409,11 @@ async function runSupervisorAction(options, deps = {}) {
8409
8409
  try {
8410
8410
  const { createExperimenter } = await import(
8411
8411
  /* @vite-ignore */
8412
- "../experimenter-DhbDhGCl.js"
8412
+ "../experimenter-DrnHhYmf.js"
8413
8413
  );
8414
8414
  const { getLatestRun: getLatest } = await import(
8415
8415
  /* @vite-ignore */
8416
- "../decisions-DeTNeNLm.js"
8416
+ "../decisions-wR6KG0UO.js"
8417
8417
  );
8418
8418
  const expAdapter = createDatabaseAdapter({
8419
8419
  backend: "auto",
@@ -8423,7 +8423,7 @@ async function runSupervisorAction(options, deps = {}) {
8423
8423
  await initSchema(expAdapter);
8424
8424
  const { runRunAction: runPipeline } = await import(
8425
8425
  /* @vite-ignore */
8426
- "../run-BiePbt-b.js"
8426
+ "../run-BISlDNAD.js"
8427
8427
  );
8428
8428
  const runStoryFn = async (opts) => {
8429
8429
  const exitCode = await runPipeline({
@@ -8948,7 +8948,7 @@ async function runMetricsAction(options) {
8948
8948
  const routingConfigPath = join(dbDir, "routing.yml");
8949
8949
  let routingConfig = null;
8950
8950
  if (existsSync$1(routingConfigPath)) try {
8951
- const { loadModelRoutingConfig } = await import("../routing-vXEFHM9J.js");
8951
+ const { loadModelRoutingConfig } = await import("../routing-V_E4Ptz-.js");
8952
8952
  routingConfig = loadModelRoutingConfig(routingConfigPath);
8953
8953
  } catch {}
8954
8954
  if (routingConfig === null) routingConfig = {
@@ -12536,6 +12536,13 @@ function registerReconcileFromDiskCommand(program, _version = "0.0.0", projectRo
12536
12536
  //#region src/cli/commands/report.ts
12537
12537
  const logger$1 = createLogger("report");
12538
12538
  /**
12539
+ * v0.20.110: Minimum output_tokens for a verified/recovered story to be
12540
+ * trusted as having actually produced work. Below this, the story is flagged
12541
+ * with `low_output_warning: true` so operators don't trust misleading metrics.
12542
+ * Boardgame backlog Item 3.
12543
+ */
12544
+ const LOW_OUTPUT_TOKEN_THRESHOLD = 100;
12545
+ /**
12539
12546
  * Determine whether verification ran for a story.
12540
12547
  *
12541
12548
  * Handles both real manifest format (checks array) and probe fixture format
@@ -12762,7 +12769,7 @@ function renderHuman(output, manifest) {
12762
12769
  const costCell = s.cost_usd != null ? `$${s.cost_usd.toFixed(4)}` : "-";
12763
12770
  const f = s.verification_findings;
12764
12771
  const findingsCell = `E:${f.error} W:${f.warn} I:${f.info}`;
12765
- const verifiedTag = s.outcome === "verified" ? "✓" : "";
12772
+ const verifiedTag = s.outcome === "verified" ? s.low_output_warning === true ? "⚠ low-out" : "✓" : s.low_output_warning === true ? "⚠ low-out" : "";
12766
12773
  const key = s.story_key.length > 50 ? s.story_key.slice(0, 49) + "…" : s.story_key;
12767
12774
  lines.push(formatRow([
12768
12775
  key,
@@ -12775,6 +12782,12 @@ function renderHuman(output, manifest) {
12775
12782
  ], COL_WIDTHS));
12776
12783
  }
12777
12784
  lines.push("");
12785
+ const lowOutputStories = stories.filter((s) => s.low_output_warning === true);
12786
+ if (lowOutputStories.length > 0) {
12787
+ lines.push(`⚠ ${lowOutputStories.length} story/stories produced fewer than ${LOW_OUTPUT_TOKEN_THRESHOLD} output tokens —`);
12788
+ lines.push(` the "verified" verdict may be misleading. Inspect dispatch artifacts before trusting.`);
12789
+ lines.push("");
12790
+ }
12778
12791
  if (escalations.length > 0) {
12779
12792
  lines.push("──── Escalation Details ────");
12780
12793
  for (const esc of escalations) {
@@ -12848,7 +12861,7 @@ function renderJson(output) {
12848
12861
  * @param manifest - Raw manifest data.
12849
12862
  * @param halts - Optional operator halt notifications (Story 73-2, AC12).
12850
12863
  */
12851
- function assembleReport(runId, manifest, halts) {
12864
+ function assembleReport(runId, manifest, halts, storyOutputTokens) {
12852
12865
  const perStoryState = manifest.per_story_state ?? {};
12853
12866
  const storyKeys = Object.keys(perStoryState);
12854
12867
  const startedAt = manifest.created_at ?? "";
@@ -12889,6 +12902,9 @@ function assembleReport(runId, manifest, halts) {
12889
12902
  const findings = extractVerificationFindings(state);
12890
12903
  const verificationRan = didVerificationRun(state);
12891
12904
  const wc = wallClockMs(state);
12905
+ const outputTokens = storyOutputTokens?.get(key);
12906
+ const trustworthyOutcome = outcome === "verified" || outcome === "recovered";
12907
+ const lowOutputWarning = outputTokens !== void 0 && trustworthyOutcome && outputTokens < LOW_OUTPUT_TOKEN_THRESHOLD;
12892
12908
  const storySummary = {
12893
12909
  story_key: key,
12894
12910
  outcome,
@@ -12896,7 +12912,9 @@ function assembleReport(runId, manifest, halts) {
12896
12912
  review_cycles: state.review_cycles ?? 0,
12897
12913
  cost_usd: state.cost_usd,
12898
12914
  verification_findings: findings,
12899
- verification_ran: verificationRan
12915
+ verification_ran: verificationRan,
12916
+ ...outputTokens !== void 0 ? { output_tokens: outputTokens } : {},
12917
+ ...lowOutputWarning ? { low_output_warning: true } : {}
12900
12918
  };
12901
12919
  stories.push(storySummary);
12902
12920
  summary[outcome]++;
@@ -13060,7 +13078,21 @@ async function runReportAction(options) {
13060
13078
  logger$1.debug({ err }, "notification read failed — continuing without halt data");
13061
13079
  return [];
13062
13080
  });
13063
- const output = assembleReport(resolvedRunId, manifest, halts);
13081
+ const storyOutputTokens = new Map();
13082
+ const metricsAdapter = createDatabaseAdapter({
13083
+ backend: "auto",
13084
+ basePath: dbRoot
13085
+ });
13086
+ try {
13087
+ await initSchema(metricsAdapter);
13088
+ const storyMetricsRows = await getStoryMetricsForRun(metricsAdapter, resolvedRunId);
13089
+ for (const row of storyMetricsRows) if (typeof row.output_tokens === "number") storyOutputTokens.set(row.story_key, row.output_tokens);
13090
+ } catch (err) {
13091
+ logger$1.debug({ err }, "story_metrics read failed — low-output flagging unavailable");
13092
+ } finally {
13093
+ await metricsAdapter.close().catch(swallowDebug("report-metrics-close"));
13094
+ }
13095
+ const output = assembleReport(resolvedRunId, manifest, halts, storyOutputTokens);
13064
13096
  if (verifyAc === true) {
13065
13097
  const artifactsDir = join(dbRoot, "_bmad-output", "implementation-artifacts");
13066
13098
  const acTraceability = {};
@@ -13198,8 +13230,8 @@ async function createProgram() {
13198
13230
  /** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
13199
13231
  function checkForUpdatesInBackground(currentVersion) {
13200
13232
  if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
13201
- import("../upgrade-gRD2ccRE.js").then(async () => {
13202
- const { createVersionManager } = await import("../version-manager-impl-Cvi-dZx8.js");
13233
+ import("../upgrade-Cq0ocGd7.js").then(async () => {
13234
+ const { createVersionManager } = await import("../version-manager-impl-B4cVH5X6.js");
13203
13235
  const vm = createVersionManager();
13204
13236
  const result = await vm.checkForUpdates();
13205
13237
  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-sltQk3gU.js";
1
+ import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-BGZiFI9J.js";
2
2
  import "./decisions-CzSIEeGP.js";
3
3
 
4
4
  export { getLatestRun };
@@ -476,10 +476,7 @@ function detectInterfaceChanges(options) {
476
476
  for (const name of names) allNames.add(name);
477
477
  sourceDirs.push(dirname$1(relPath));
478
478
  } catch {
479
- console.debug("Could not read modified file for interface extraction", {
480
- absPath,
481
- storyKey
482
- });
479
+ process.stderr.write(`[interface-change-detector] Could not read modified file for interface extraction (storyKey=${storyKey}, path=${absPath})\n`);
483
480
  }
484
481
  }
485
482
  if (allNames.size === 0) return {
@@ -2544,27 +2541,30 @@ function isDoltAvailable(basePath) {
2544
2541
  console.warn("[persistence:adapter] Dolt still unavailable after retry — falling back to InMemoryDatabaseAdapter. Telemetry and cost data will NOT persist.");
2545
2542
  return false;
2546
2543
  }
2544
+ function adapterDiag(message) {
2545
+ process.stderr.write("[persistence:adapter] " + message + "\n");
2546
+ }
2547
2547
  function createDatabaseAdapter(config = { backend: "auto" }, doltClientFactory) {
2548
2548
  const backend = config.backend ?? "auto";
2549
2549
  const basePath = config.basePath ?? process.cwd();
2550
2550
  const doltRepoPath = join$1(basePath, ".substrate", "state");
2551
2551
  if (backend === "dolt") {
2552
2552
  if (!doltClientFactory) {
2553
- console.debug("[persistence:adapter] dolt backend requested but no doltClientFactory provided; falling back to memory");
2553
+ adapterDiag("dolt backend requested but no doltClientFactory provided; falling back to memory");
2554
2554
  return new InMemoryDatabaseAdapter();
2555
2555
  }
2556
- console.debug("[persistence:adapter] Using DoltDatabaseAdapter (explicit config)");
2556
+ adapterDiag("Using DoltDatabaseAdapter (explicit config)");
2557
2557
  return new DoltDatabaseAdapter(doltClientFactory(doltRepoPath));
2558
2558
  }
2559
2559
  if (backend === "memory") {
2560
- console.debug("[persistence:adapter] Using InMemoryDatabaseAdapter (explicit config)");
2560
+ adapterDiag("Using InMemoryDatabaseAdapter (explicit config)");
2561
2561
  return new InMemoryDatabaseAdapter();
2562
2562
  }
2563
2563
  if (doltClientFactory && isDoltAvailable(basePath)) {
2564
- console.debug("[persistence:adapter] Dolt detected, using DoltDatabaseAdapter");
2564
+ adapterDiag("Dolt detected, using DoltDatabaseAdapter");
2565
2565
  return new DoltDatabaseAdapter(doltClientFactory(doltRepoPath));
2566
2566
  }
2567
- console.debug("[persistence:adapter] Dolt not available or no factory, using InMemoryDatabaseAdapter");
2567
+ adapterDiag("Dolt not available or no factory, using InMemoryDatabaseAdapter");
2568
2568
  return new InMemoryDatabaseAdapter();
2569
2569
  }
2570
2570
 
@@ -11254,4 +11254,4 @@ async function callLLM(params) {
11254
11254
 
11255
11255
  //#endregion
11256
11256
  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, InMemoryDatabaseAdapter, IngestionServer, LEARNING_FINDING, LogTurnAnalyzer, ModelRoutingConfigSchema, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProviderPolicySchema, ProvidersSchema, Recommender, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, STORY_METRICS, STORY_OUTCOME, SubstrateConfigSchema, TASK_TYPE_PHASE_MAP, TEST_EXPANSION_FINDING, TEST_PLAN, TelemetryConfigSchema, TelemetryNormalizer, TelemetryPipeline, TurnAnalyzer, VersionManagerImpl, addTokenUsage, aggregateTokenUsageForRun, aggregateTokenUsageForStory, buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, callLLM, checkDoltInstalled, classifyVersionGap, compareRunMetrics, createAmendmentRun, createConfigSystem, createDatabaseAdapter as createDatabaseAdapter$1, createDecision, createExperimenter, createPipelineRun, createRequirement, 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, initWorkGraphSchema, initializeDolt, listRequirements, listRunMetrics, loadModelRoutingConfig, loadParentRunDecisions, registerArtifact, resolvePromptFile, supersedeDecision, swallowDebug, tagRunAsBaseline, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics };
11257
- //# sourceMappingURL=dist-sltQk3gU.js.map
11257
+ //# sourceMappingURL=dist-BGZiFI9J.js.map
@@ -1,4 +1,4 @@
1
- import { AdtError } from "./dist-sltQk3gU.js";
1
+ import { AdtError } from "./dist-BGZiFI9J.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-B6wYX9Xl.js.map
74
+ //# sourceMappingURL=errors-BzUiyd5I.js.map
@@ -1,3 +1,3 @@
1
- import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-sltQk3gU.js";
1
+ import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-BGZiFI9J.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-sltQk3gU.js";
3
- import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-BqOSfq3H.js";
2
+ import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-BGZiFI9J.js";
3
+ import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-DcGYzUFh.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-DbdOKMYr.js.map
1003
+ //# sourceMappingURL=health-B-K-bN-0.js.map
@@ -1,7 +1,7 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-DbdOKMYr.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-B-K-bN-0.js";
2
2
  import "./logger-KeHncl-f.js";
3
- import "./dist-sltQk3gU.js";
4
- import "./manifest-read-BqOSfq3H.js";
3
+ import "./dist-BGZiFI9J.js";
4
+ import "./manifest-read-DcGYzUFh.js";
5
5
  import "./work-graph-repository-DZyJv5pV.js";
6
6
  import "./decisions-CzSIEeGP.js";
7
7
 
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-sltQk3gU.js";
3
+ import { AdapterRegistry, AdtError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter } from "./dist-BGZiFI9J.js";
4
4
  import "./adapter-registry-DIcrxjH8.js";
5
- import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-B6wYX9Xl.js";
5
+ import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-BzUiyd5I.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-BqOSfq3H.js";
2
+ import { readCurrentRunId, resolveMainRepoRoot } from "./manifest-read-DcGYzUFh.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-CfF042kK.js.map
183
+ //# sourceMappingURL=interactive-prompt-B1mN4QPJ.js.map
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-sltQk3gU.js";
2
+ import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-BGZiFI9J.js";
3
3
  import * as path$1 from "path";
4
4
  import { join } from "path";
5
5
  import { readFile } from "fs/promises";
@@ -952,7 +952,7 @@ function createSdlcDevStoryHandler(options) {
952
952
  };
953
953
  }
954
954
  } catch {
955
- console.debug("[sdlc-dev-story-handler] DispatchGate.check failed; proceeding with original dispatch");
955
+ process.stderr.write("[sdlc-dev-story-handler] DispatchGate.check failed; proceeding with original dispatch\n");
956
956
  }
957
957
  const devStoryParams = {
958
958
  storyKey,
@@ -5845,4 +5845,4 @@ async function resolveRunManifest(dbRoot, runId) {
5845
5845
 
5846
5846
  //#endregion
5847
5847
  export { FindingsInjector, RunManifest, RuntimeProbeListSchema, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, applyConfigToGraph, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, parseRuntimeProbes, readCurrentRunId, renderFindings, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck, runStaleVerificationRecovery };
5848
- //# sourceMappingURL=manifest-read-BqOSfq3H.js.map
5848
+ //# sourceMappingURL=manifest-read-DcGYzUFh.js.map
@@ -1,6 +1,6 @@
1
1
  import "../../logger-KeHncl-f.js";
2
- import "../../dist-sltQk3gU.js";
3
- import "../../manifest-read-BqOSfq3H.js";
4
- import { runInteractivePrompt } from "../../interactive-prompt-CfF042kK.js";
2
+ import "../../dist-BGZiFI9J.js";
3
+ import "../../manifest-read-DcGYzUFh.js";
4
+ import { runInteractivePrompt } from "../../interactive-prompt-B1mN4QPJ.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-sltQk3gU.js";
1
+ import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-BGZiFI9J.js";
2
2
  import "./routing-DFxoKHDt.js";
3
3
 
4
4
  export { loadModelRoutingConfig };
@@ -1,11 +1,11 @@
1
- import { BMAD_BASELINE_TOKENS_FULL, FileKvStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, validateStoryKey } from "./health-DbdOKMYr.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-B-K-bN-0.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, classifyVersionGap, createConfigSystem, createDatabaseAdapter$1, createDecision, createPipelineRun, createRequirement, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunMetrics, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, listRequirements, loadModelRoutingConfig, registerArtifact, swallowDebug, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-sltQk3gU.js";
5
- import { FindingsInjector, RunManifest, RuntimeProbeListSchema, applyConfigToGraph, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, renderFindings, resolveGraphPath, resolveMainRepoRoot, runAcTraceabilityCheck, runStaleVerificationRecovery } from "./manifest-read-BqOSfq3H.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, classifyVersionGap, createConfigSystem, createDatabaseAdapter$1, createDecision, createPipelineRun, createRequirement, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunMetrics, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, listRequirements, loadModelRoutingConfig, registerArtifact, swallowDebug, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-BGZiFI9J.js";
5
+ import { FindingsInjector, RunManifest, RuntimeProbeListSchema, applyConfigToGraph, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, renderFindings, resolveGraphPath, resolveMainRepoRoot, runAcTraceabilityCheck, runStaleVerificationRecovery } from "./manifest-read-DcGYzUFh.js";
6
6
  import { WorkGraphRepository, detectCycles } from "./work-graph-repository-DZyJv5pV.js";
7
7
  import { deriveExitCode, routeDecision } from "./decision-router-DblHY8se.js";
8
- import { runInteractivePrompt } from "./interactive-prompt-CfF042kK.js";
8
+ import { runInteractivePrompt } from "./interactive-prompt-B1mN4QPJ.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";
@@ -383,6 +383,26 @@ async function getMergedFiles(cwd) {
383
383
  */
384
384
  const BRANCH_PREFIX = "substrate/story-";
385
385
  const DEFAULT_WORKTREE_BASE = ".substrate-worktrees";
386
+ /**
387
+ * Fallback logger when no ILogger is injected.
388
+ *
389
+ * Routes all levels to stderr via process.stderr.write — NOT to `console`.
390
+ * Node's `console.debug` and `console.info` are aliases for console.log, which
391
+ * writes to STDOUT. That contaminates JSON-output streams for any CLI command
392
+ * that constructs a manager without explicitly passing a logger (e.g.
393
+ * `substrate worktrees --output-format json`). v0.20.111 fix surfaced by the
394
+ * post-v0.20.110 e2e smoke pass.
395
+ */
396
+ function emitDiag(level, args) {
397
+ const formatted = args.map((a) => typeof a === "string" ? a : JSON.stringify(a)).join(" ");
398
+ process.stderr.write(`[git-worktree-manager] [${level}] ${formatted}\n`);
399
+ }
400
+ const DEFAULT_STDERR_LOGGER = {
401
+ info: (...args) => emitDiag("info", args),
402
+ warn: (...args) => emitDiag("warn", args),
403
+ error: (...args) => emitDiag("error", args),
404
+ debug: (...args) => emitDiag("debug", args)
405
+ };
386
406
  var GitWorktreeManagerImpl = class {
387
407
  _eventBus;
388
408
  _projectRoot;
@@ -400,7 +420,7 @@ var GitWorktreeManagerImpl = class {
400
420
  this._projectRoot = projectRoot;
401
421
  this._baseDirectory = baseDirectory;
402
422
  this._db = db;
403
- this._logger = logger$27 ?? console;
423
+ this._logger = logger$27 ?? DEFAULT_STDERR_LOGGER;
404
424
  this._copyFiles = copyFiles;
405
425
  this._onTaskReady = ({ taskId }) => {
406
426
  this._handleTaskReady(taskId).catch((err) => {
@@ -46998,7 +47018,7 @@ async function runFullPipeline(options) {
46998
47018
  */
46999
47019
  async function emitPreDispatchVersionAdvisory(currentVersion) {
47000
47020
  if (process.env["SUBSTRATE_NO_UPDATE_CHECK"] === "1") return;
47001
- const { createVersionManager } = await import("./version-manager-impl-Cvi-dZx8.js");
47021
+ const { createVersionManager } = await import("./version-manager-impl-B4cVH5X6.js");
47002
47022
  const vm = createVersionManager();
47003
47023
  const result = await vm.checkForUpdates(true);
47004
47024
  const gap = classifyVersionGap(currentVersion, result.latestVersion);
@@ -47095,4 +47115,4 @@ function registerRunCommand(program, version = "0.0.0", projectRoot = process.cw
47095
47115
 
47096
47116
  //#endregion
47097
47117
  export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR$1 as GLOBSTAR, GitClient, GrammarLoader, Minimatch$1 as Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape$1 as escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runRunAction, runSolutioningPhase, unescape$1 as unescape, validateStopAfterFromConflict, wireNdjsonEmitter };
47098
- //# sourceMappingURL=run-B8RHheJ5.js.map
47118
+ //# sourceMappingURL=run-7A1EUUHU.js.map
@@ -1,14 +1,14 @@
1
- import "./health-DbdOKMYr.js";
1
+ import "./health-B-K-bN-0.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
- import "./dist-sltQk3gU.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-B8RHheJ5.js";
6
- import "./manifest-read-BqOSfq3H.js";
4
+ import "./dist-BGZiFI9J.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-7A1EUUHU.js";
6
+ import "./manifest-read-DcGYzUFh.js";
7
7
  import "./routing-DFxoKHDt.js";
8
8
  import "./work-graph-repository-DZyJv5pV.js";
9
9
  import "./decisions-CzSIEeGP.js";
10
10
  import "./decision-router-DblHY8se.js";
11
- import "./interactive-prompt-CfF042kK.js";
11
+ import "./interactive-prompt-B1mN4QPJ.js";
12
12
  import "./recovery-engine-BKGBeBnW.js";
13
13
 
14
14
  export { runRunAction };
@@ -1,4 +1,4 @@
1
- import { createVersionManager } from "./dist-sltQk3gU.js";
1
+ import { createVersionManager } from "./dist-BGZiFI9J.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-BEzt7Xsf.js.map
126
+ //# sourceMappingURL=upgrade-BL3czSQv.js.map
@@ -1,5 +1,5 @@
1
- import "./dist-sltQk3gU.js";
1
+ import "./dist-BGZiFI9J.js";
2
2
  import "./version-manager-impl-qFBiO4Eh.js";
3
- import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-BEzt7Xsf.js";
3
+ import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-BL3czSQv.js";
4
4
 
5
5
  export { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand };
@@ -1,4 +1,4 @@
1
- import { VersionManagerImpl, createVersionManager } from "./dist-sltQk3gU.js";
1
+ import { VersionManagerImpl, createVersionManager } from "./dist-BGZiFI9J.js";
2
2
  import "./version-manager-impl-qFBiO4Eh.js";
3
3
 
4
4
  export { createVersionManager };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.20.109",
3
+ "version": "0.20.111",
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-sltQk3gU.js";
2
- import "./adapter-registry-DIcrxjH8.js";
3
-
4
- export { AdapterRegistry };