substrate-ai 0.20.111 → 0.20.113

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-CW4d4JMj.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-B-K-bN-0.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-DI5inO7P.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-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";
5
+ import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, GlobalSettingsSchema, InMemoryDatabaseAdapter, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createPipelineRun, createStderrLogger, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initWorkGraphSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, swallowDebug, tagRunAsBaseline, updatePipelineRun } from "../dist-CW4d4JMj.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-BEXmYJob.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-DcGYzUFh.js";
9
- import "../errors-BzUiyd5I.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-DwpffChw.js";
9
+ import "../errors-Da7Izmsw.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-B1mN4QPJ.js";
14
+ import "../interactive-prompt-Cpke493f.js";
15
15
  import "../recovery-engine-BKGBeBnW.js";
16
16
  import "../version-manager-impl-qFBiO4Eh.js";
17
- import { registerUpgradeCommand } from "../upgrade-BL3czSQv.js";
17
+ import { registerUpgradeCommand } from "../upgrade-W9n0n39E.js";
18
18
  import { Command } from "commander";
19
19
  import { fileURLToPath } from "url";
20
20
  import { dirname, join, resolve } from "path";
@@ -40,10 +40,6 @@ import { randomUUID as randomUUID$1 } from "crypto";
40
40
  import { createInterface as createInterface$1 } from "readline";
41
41
 
42
42
  //#region packages/core/dist/monitor/recommendation-engine.js
43
- /**
44
- * RecommendationEngine — generates routing recommendations from performance aggregates.
45
- * Migrated to @substrate-ai/core (Story 41-7)
46
- */
47
43
  var RecommendationEngine = class {
48
44
  _monitorDb;
49
45
  _filters;
@@ -56,7 +52,7 @@ var RecommendationEngine = class {
56
52
  min_sample_size: config.min_sample_size ?? 10
57
53
  };
58
54
  this._historyDays = config.recommendation_history_days ?? 90;
59
- this._logger = logger$19 ?? console;
55
+ this._logger = logger$19 ?? createStderrLogger("monitor:recommendation-engine");
60
56
  }
61
57
  generateRecommendations() {
62
58
  const sinceDate = new Date(Date.now() - this._historyDays * 24 * 60 * 60 * 1e3).toISOString();
@@ -6894,7 +6890,7 @@ async function runStatusAction(options) {
6894
6890
  logger$15.debug({ err }, "Work graph query failed, continuing without work graph data");
6895
6891
  }
6896
6892
  if (run === void 0) {
6897
- const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-EvY7yEBY.js");
6893
+ const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-Bc0Q5hGJ.js");
6898
6894
  const substrateDirPath = join(projectRoot, ".substrate");
6899
6895
  const processInfo = inspectProcessTree$1({
6900
6896
  projectRoot,
@@ -7842,7 +7838,7 @@ function defaultSupervisorDeps() {
7842
7838
  if (cached === null) {
7843
7839
  const { AdapterRegistry: AR } = await import(
7844
7840
  /* @vite-ignore */
7845
- "../adapter-registry-DVrry2g2.js"
7841
+ "../adapter-registry-Dv83m9Uh.js"
7846
7842
  );
7847
7843
  cached = new AR();
7848
7844
  await cached.discoverAndRegister();
@@ -8409,11 +8405,11 @@ async function runSupervisorAction(options, deps = {}) {
8409
8405
  try {
8410
8406
  const { createExperimenter } = await import(
8411
8407
  /* @vite-ignore */
8412
- "../experimenter-DrnHhYmf.js"
8408
+ "../experimenter-Dvo-LfAe.js"
8413
8409
  );
8414
8410
  const { getLatestRun: getLatest } = await import(
8415
8411
  /* @vite-ignore */
8416
- "../decisions-wR6KG0UO.js"
8412
+ "../decisions-BM12_hm6.js"
8417
8413
  );
8418
8414
  const expAdapter = createDatabaseAdapter({
8419
8415
  backend: "auto",
@@ -8423,7 +8419,7 @@ async function runSupervisorAction(options, deps = {}) {
8423
8419
  await initSchema(expAdapter);
8424
8420
  const { runRunAction: runPipeline } = await import(
8425
8421
  /* @vite-ignore */
8426
- "../run-BISlDNAD.js"
8422
+ "../run-BTr8rP21.js"
8427
8423
  );
8428
8424
  const runStoryFn = async (opts) => {
8429
8425
  const exitCode = await runPipeline({
@@ -8948,7 +8944,7 @@ async function runMetricsAction(options) {
8948
8944
  const routingConfigPath = join(dbDir, "routing.yml");
8949
8945
  let routingConfig = null;
8950
8946
  if (existsSync$1(routingConfigPath)) try {
8951
- const { loadModelRoutingConfig } = await import("../routing-V_E4Ptz-.js");
8947
+ const { loadModelRoutingConfig } = await import("../routing-BiT4IXk2.js");
8952
8948
  routingConfig = loadModelRoutingConfig(routingConfigPath);
8953
8949
  } catch {}
8954
8950
  if (routingConfig === null) routingConfig = {
@@ -13230,8 +13226,8 @@ async function createProgram() {
13230
13226
  /** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
13231
13227
  function checkForUpdatesInBackground(currentVersion) {
13232
13228
  if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
13233
- import("../upgrade-Cq0ocGd7.js").then(async () => {
13234
- const { createVersionManager } = await import("../version-manager-impl-B4cVH5X6.js");
13229
+ import("../upgrade-BciwetMn.js").then(async () => {
13230
+ const { createVersionManager } = await import("../version-manager-impl-G82XqDMV.js");
13235
13231
  const vm = createVersionManager();
13236
13232
  const result = await vm.checkForUpdates();
13237
13233
  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-BGZiFI9J.js";
1
+ import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-CW4d4JMj.js";
2
2
  import "./decisions-CzSIEeGP.js";
3
3
 
4
4
  export { getLatestRun };
@@ -854,6 +854,68 @@ function extractJsonAsYaml(text) {
854
854
  }
855
855
  }
856
856
 
857
+ //#endregion
858
+ //#region packages/core/dist/utils/stderr-logger.js
859
+ /**
860
+ * Stderr-routed ILogger factory.
861
+ *
862
+ * Use this instead of `console` as the default fallback for any class that
863
+ * accepts an optional ILogger. Node's `console.debug` / `console.info` are
864
+ * aliases for `console.log`, which writes to STDOUT — that contaminates
865
+ * any stdout consumer that expects clean output (e.g. `substrate run --events`
866
+ * NDJSON consumers, `--output-format json` commands, downstream parsers).
867
+ *
868
+ * v0.20.110 fixed the adapter.ts leak. v0.20.111 fixed the
869
+ * git-worktree-manager-impl.ts leak. v0.20.112 centralized the discipline:
870
+ * one shared helper, applied at every `logger ?? console` site, so future
871
+ * callers can't reintroduce the bug.
872
+ *
873
+ * Usage:
874
+ * import { createStderrLogger } from '@substrate-ai/core'
875
+ * constructor(..., logger?: ILogger) {
876
+ * this._logger = logger ?? createStderrLogger('my-module')
877
+ * }
878
+ *
879
+ * The prefix is included in every line so stderr remains useful for
880
+ * diagnostic correlation across modules — without polluting stdout.
881
+ */
882
+ /**
883
+ * Format args the same way `console.*` does — strings stay as-is, everything
884
+ * else serializes to JSON. Single-line output (newline appended by the
885
+ * stderr write).
886
+ */
887
+ function formatArgs(args) {
888
+ return args.map((a) => {
889
+ if (typeof a === "string") return a;
890
+ if (a instanceof Error) return a.message;
891
+ try {
892
+ return JSON.stringify(a);
893
+ } catch {
894
+ return String(a);
895
+ }
896
+ }).join(" ");
897
+ }
898
+ /**
899
+ * Create an ILogger that routes every level to stderr via
900
+ * `process.stderr.write`. Each line is prefixed with `[<prefix>] [<level>]`
901
+ * so operators correlating cross-module diagnostics can tell where a line
902
+ * came from.
903
+ *
904
+ * @param prefix - Module identifier used in the stderr prefix
905
+ * (e.g., 'persistence:adapter', 'git-worktree-manager')
906
+ */
907
+ function createStderrLogger(prefix) {
908
+ function emit(level, args) {
909
+ process.stderr.write(`[${prefix}] [${level}] ${formatArgs(args)}\n`);
910
+ }
911
+ return {
912
+ info: (...args) => emit("info", args),
913
+ warn: (...args) => emit("warn", args),
914
+ error: (...args) => emit("error", args),
915
+ debug: (...args) => emit("debug", args)
916
+ };
917
+ }
918
+
857
919
  //#endregion
858
920
  //#region packages/core/dist/dispatch/dispatcher-impl.js
859
921
  const SHUTDOWN_GRACE_MS = 1e4;
@@ -4766,6 +4828,37 @@ const noopLogger = {
4766
4828
  warn: () => {},
4767
4829
  error: () => {}
4768
4830
  };
4831
+ /**
4832
+ * Transient Dolt CLI lock errors. When multiple `dolt sql -q` subprocesses (or
4833
+ * a foreign process) touch the same repo's noms manifest concurrently, the
4834
+ * losers fail with "database is read only" / "cannot update manifest". The lock
4835
+ * releases in ~10-100ms, so a bounded retry-with-backoff recovers cleanly.
4836
+ *
4837
+ * This is substrate's CLI-mode concurrency fix (v0.20.113, F1): under
4838
+ * `concurrency:3` + the telemetry IngestionServer, simultaneous CLI writes to
4839
+ * `.substrate/state` collided 146+ times in one run, breaking wg_stories
4840
+ * updates, telemetry persistence, and the auto-commit step. The per-instance
4841
+ * promise mutex serializes promises but not the OS-level manifest lock release,
4842
+ * and cross-process writers bypass it entirely — so retry is the topology-
4843
+ * independent fix. (Pool/sql-server mode avoids this via MVCC and is unaffected.)
4844
+ */
4845
+ const TRANSIENT_LOCK_RE = /database is read only|cannot update manifest|manifest.*lock|resource temporarily unavailable/i;
4846
+ /** Backoff schedule (ms) for transient-lock retries. Length = max retries. */
4847
+ const CLI_RETRY_BACKOFF_MS = [
4848
+ 50,
4849
+ 150,
4850
+ 400,
4851
+ 800,
4852
+ 1500
4853
+ ];
4854
+ function isTransientLockError(err) {
4855
+ const msg = err instanceof Error ? `${err.message}` : String(err);
4856
+ const stderr = err?.stderr ?? "";
4857
+ return TRANSIENT_LOCK_RE.test(msg) || TRANSIENT_LOCK_RE.test(stderr);
4858
+ }
4859
+ function sleep(ms) {
4860
+ return new Promise((resolve$2) => setTimeout(resolve$2, ms));
4861
+ }
4769
4862
  var DoltClient = class {
4770
4863
  repoPath;
4771
4864
  socketPath;
@@ -4856,13 +4949,13 @@ var DoltClient = class {
4856
4949
  const batchSql = `BEGIN; ${statements.join("; ")}; COMMIT`;
4857
4950
  await this._withCliLock(async () => {
4858
4951
  try {
4859
- await runExecFile("dolt", [
4952
+ await this._runDoltWithRetry([
4860
4953
  "sql",
4861
4954
  "-q",
4862
4955
  batchSql,
4863
4956
  "--result-format",
4864
4957
  "json"
4865
- ], { cwd: this.repoPath });
4958
+ ], "transact");
4866
4959
  } catch (err) {
4867
4960
  throw new DoltQueryError(batchSql, err instanceof Error ? err.message : String(err));
4868
4961
  }
@@ -4905,6 +4998,26 @@ var DoltClient = class {
4905
4998
  return prev.then(fn).finally(() => release());
4906
4999
  }
4907
5000
  /**
5001
+ * Run a `dolt` CLI subprocess, retrying on transient noms-manifest lock
5002
+ * contention ("database is read only" / "cannot update manifest"). See
5003
+ * TRANSIENT_LOCK_RE for the rationale. Non-transient errors throw immediately
5004
+ * on the first attempt. The final attempt's error propagates unchanged so the
5005
+ * caller's DoltQueryError wrapping is preserved. (v0.20.113, F1.)
5006
+ */
5007
+ async _runDoltWithRetry(args, label) {
5008
+ let lastErr;
5009
+ for (let attempt = 0; attempt <= CLI_RETRY_BACKOFF_MS.length; attempt++) try {
5010
+ return await runExecFile("dolt", args, { cwd: this.repoPath });
5011
+ } catch (err) {
5012
+ lastErr = err;
5013
+ if (!isTransientLockError(err) || attempt === CLI_RETRY_BACKOFF_MS.length) throw err;
5014
+ const backoff = CLI_RETRY_BACKOFF_MS[attempt];
5015
+ this._log.warn(`[dolt-client] transient lock on ${label} (attempt ${attempt + 1}/${CLI_RETRY_BACKOFF_MS.length + 1}); retrying in ${backoff}ms`);
5016
+ await sleep(backoff);
5017
+ }
5018
+ throw lastErr;
5019
+ }
5020
+ /**
4908
5021
  * Substitute `?` placeholders in a SQL string with properly escaped literal
4909
5022
  * values from the `params` array. Used by both `_queryCli` and the CLI
4910
5023
  * `transact` path to produce a fully-resolved SQL string for shell execution.
@@ -4931,7 +5044,7 @@ var DoltClient = class {
4931
5044
  "--result-format",
4932
5045
  "json"
4933
5046
  ];
4934
- const { stdout } = await runExecFile("dolt", args, { cwd: this.repoPath });
5047
+ const { stdout } = await this._runDoltWithRetry(args, "query");
4935
5048
  const lines = (stdout || "").trim().split("\n").filter(Boolean);
4936
5049
  const lastLine = lines.length > 0 ? lines[lines.length - 1] : "{\"rows\":[]}";
4937
5050
  const parsed = JSON.parse(lastLine);
@@ -4963,7 +5076,7 @@ var DoltClient = class {
4963
5076
  async execArgs(args) {
4964
5077
  return this._withCliLock(async () => {
4965
5078
  try {
4966
- const { stdout } = await runExecFile("dolt", args, { cwd: this.repoPath });
5079
+ const { stdout } = await this._runDoltWithRetry(args, "exec");
4967
5080
  return stdout;
4968
5081
  } catch (err) {
4969
5082
  const detail = err instanceof Error ? err.message : String(err);
@@ -6514,7 +6627,7 @@ var ConfigSystemImpl = class {
6514
6627
  this._projectConfigDir = options.projectConfigDir ? resolve(options.projectConfigDir) : resolve(process.cwd(), ".substrate");
6515
6628
  this._globalConfigDir = options.globalConfigDir ? resolve(options.globalConfigDir) : resolve(homedir(), ".substrate");
6516
6629
  this._cliOverrides = options.cliOverrides ?? {};
6517
- this._logger = options.logger ?? console;
6630
+ this._logger = options.logger ?? createStderrLogger("config-system");
6518
6631
  }
6519
6632
  get isLoaded() {
6520
6633
  return this._config !== null;
@@ -7484,32 +7597,6 @@ var TelemetryNormalizer = class {
7484
7597
  //#endregion
7485
7598
  //#region packages/core/dist/telemetry/telemetry-pipeline.js
7486
7599
  /**
7487
- * TelemetryPipeline — orchestrates the full telemetry analysis pipeline.
7488
- *
7489
- * Processing flow for each batch of raw OTLP payloads:
7490
- * 1. Normalize raw OTLP → NormalizedSpan[] / NormalizedLog[] (TelemetryNormalizer)
7491
- * 2. Analyze turns via dual-track:
7492
- * a. Span-based: ITurnAnalyzer.analyze(spans) → TurnAnalysis[]
7493
- * b. Log-based: ILogTurnAnalyzer.analyze(logs) → TurnAnalysis[]
7494
- * c. Merge & deduplicate by spanId (prefer span-derived)
7495
- * 3. Compute category stats → CategoryStats[] (ICategorizer)
7496
- * 4. Compute consumer stats → ConsumerStats[] (IConsumerAnalyzer)
7497
- * 5. Score efficiency → EfficiencyScore (IEfficiencyScorer) — from merged turns
7498
- * 6. Generate recommendations → Recommendation[] (IRecommender) — from merged turns
7499
- * 7. Persist all results (ITelemetryPersistence)
7500
- *
7501
- * Design invariants:
7502
- * - Constructor injection for all dependencies
7503
- * - Never throws from processBatch() — errors are caught per-item and logged
7504
- * - Grouping by storyKey; payloads without a storyKey are skipped at the
7505
- * analysis stage (normalised data is still stored)
7506
- * - Log-only path: when no spans are present, ILogTurnAnalyzer produces turns.
7507
- *
7508
- * Duck-typed interfaces for scoring deps (implementations migrate in 41-6b).
7509
- * This allows the core package to be self-contained without importing from
7510
- * the monolith's scoring modules.
7511
- */
7512
- /**
7513
7600
  * Wires together the full OTLP analysis and persistence pipeline.
7514
7601
  *
7515
7602
  * Usage:
@@ -7537,7 +7624,7 @@ var TelemetryPipeline = class {
7537
7624
  this._efficiencyScorer = deps.efficiencyScorer;
7538
7625
  this._recommender = deps.recommender;
7539
7626
  this._persistence = deps.persistence;
7540
- this._logger = deps.logger ?? console;
7627
+ this._logger = deps.logger ?? createStderrLogger("telemetry-pipeline");
7541
7628
  }
7542
7629
  /**
7543
7630
  * Process a batch of raw OTLP payloads through the full analysis pipeline.
@@ -7837,7 +7924,7 @@ var IngestionServer = class {
7837
7924
  this._port = options.port ?? 4318;
7838
7925
  this._batchSize = options.batchSize ?? 100;
7839
7926
  this._flushIntervalMs = options.flushIntervalMs ?? 5e3;
7840
- this._logger = options.logger ?? console;
7927
+ this._logger = options.logger ?? createStderrLogger("telemetry:ingestion-server");
7841
7928
  if (options.pipeline !== void 0) this._initPipeline(options.pipeline);
7842
7929
  }
7843
7930
  /**
@@ -8062,28 +8149,10 @@ var IngestionServer = class {
8062
8149
 
8063
8150
  //#endregion
8064
8151
  //#region packages/core/dist/telemetry/turn-analyzer.js
8065
- /**
8066
- * TurnAnalyzer — computes per-turn token breakdowns from normalized spans.
8067
- *
8068
- * Takes a list of NormalizedSpan records and produces TurnAnalysis[], where
8069
- * each entry represents a root-level span (an agent "turn") with:
8070
- * - Chronological ordering (by startTime)
8071
- * - Sequential turnNumber assignment (1-N)
8072
- * - freshTokens, cacheHitRate, contextSize, contextDelta metrics
8073
- * - childSpans drill-down (tool calls within the turn)
8074
- * - isContextSpike detection (inputTokens > 2× average)
8075
- *
8076
- * Architecture constraints:
8077
- * - Constructor injection: accepts ILogger via constructor (defaults to console)
8078
- * - No external dependencies beyond types from this module
8079
- * - Zero LLM calls — pure statistical computation
8080
- *
8081
- * Migrated to @substrate-ai/core in story 41-6b.
8082
- */
8083
8152
  var TurnAnalyzer = class {
8084
8153
  _logger;
8085
8154
  constructor(logger) {
8086
- this._logger = logger ?? console;
8155
+ this._logger = logger ?? createStderrLogger("telemetry:turn-analyzer");
8087
8156
  }
8088
8157
  /**
8089
8158
  * Analyze a list of NormalizedSpan records and produce TurnAnalysis[].
@@ -8150,29 +8219,10 @@ var TurnAnalyzer = class {
8150
8219
 
8151
8220
  //#endregion
8152
8221
  //#region packages/core/dist/telemetry/log-turn-analyzer.js
8153
- /**
8154
- * LogTurnAnalyzer — computes per-turn token breakdowns from normalized log records.
8155
- *
8156
- * Takes a list of NormalizedLog records and produces TurnAnalysis[], where
8157
- * each entry represents an LLM turn derived from log data with:
8158
- * - Chronological ordering (by timestamp)
8159
- * - Sequential turnNumber assignment (1-N)
8160
- * - freshTokens, cacheHitRate, contextSize, contextDelta metrics
8161
- * - isContextSpike detection (inputTokens > 2× average)
8162
- * - Deduplication by traceId+spanId combination
8163
- *
8164
- * Architecture constraints:
8165
- * - Constructor injection: accepts ILogger via constructor (defaults to console)
8166
- * - No external dependencies beyond types from this module
8167
- * - Zero LLM calls — pure statistical computation
8168
- * - Never throws from public methods
8169
- *
8170
- * Migrated to @substrate-ai/core in story 41-6b.
8171
- */
8172
8222
  var LogTurnAnalyzer = class {
8173
8223
  _logger;
8174
8224
  constructor(logger) {
8175
- this._logger = logger ?? console;
8225
+ this._logger = logger ?? createStderrLogger("telemetry:log-turn-analyzer");
8176
8226
  }
8177
8227
  /**
8178
8228
  * Analyze a list of NormalizedLog records and produce TurnAnalysis[].
@@ -8267,23 +8317,6 @@ var LogTurnAnalyzer = class {
8267
8317
  //#endregion
8268
8318
  //#region packages/core/dist/telemetry/categorizer.js
8269
8319
  /**
8270
- * Categorizer — classifies telemetry spans into semantic categories and
8271
- * computes per-category token statistics with trend detection.
8272
- *
8273
- * Classification proceeds through three tiers:
8274
- * 1. Exact match against a lookup table of known operation names
8275
- * 2. Prefix/regex pattern match
8276
- * 3. Fuzzy case-insensitive substring match
8277
- * 4. Fallback to 'other' (overridden to 'tool_outputs' when toolName present)
8278
- *
8279
- * Architecture constraints:
8280
- * - Constructor injection: accepts ILogger via constructor (defaults to console)
8281
- * - Module-scope lookup tables to avoid recreation on every classify() call
8282
- * - Zero external dependencies beyond types from this module
8283
- *
8284
- * Migrated to @substrate-ai/core in story 41-6b.
8285
- */
8286
- /**
8287
8320
  * Tier 0: task-type to semantic category mapping.
8288
8321
  *
8289
8322
  * When a TurnAnalysis has a known taskType, the category is determined
@@ -8357,7 +8390,7 @@ const ALL_CATEGORIES = [
8357
8390
  var Categorizer = class {
8358
8391
  _logger;
8359
8392
  constructor(logger) {
8360
- this._logger = logger ?? console;
8393
+ this._logger = logger ?? createStderrLogger("telemetry:categorizer");
8361
8394
  }
8362
8395
  /**
8363
8396
  * Classify an operation into a SemanticCategory using tiered logic.
@@ -8557,26 +8590,12 @@ function extractToolNameFromSpan(span) {
8557
8590
 
8558
8591
  //#endregion
8559
8592
  //#region packages/core/dist/telemetry/consumer-analyzer.js
8560
- /**
8561
- * ConsumerAnalyzer — groups telemetry spans by consumer key and ranks by token
8562
- * consumption, producing ConsumerStats for each unique operation+tool combination.
8563
- *
8564
- * A "consumer key" is `operationName|toolName`, stable across runs and safe to
8565
- * store as a VARCHAR(300) primary-key component in Dolt.
8566
- *
8567
- * Architecture constraints:
8568
- * - Constructor injection: accepts Categorizer and ILogger (logger defaults to console)
8569
- * - Delegates classification to the injected Categorizer
8570
- * - Zero external dependencies beyond types and Categorizer from this module
8571
- *
8572
- * Migrated to @substrate-ai/core in story 41-6b.
8573
- */
8574
8593
  var ConsumerAnalyzer = class {
8575
8594
  _categorizer;
8576
8595
  _logger;
8577
8596
  constructor(categorizer, logger) {
8578
8597
  this._categorizer = categorizer;
8579
- this._logger = logger ?? console;
8598
+ this._logger = logger ?? createStderrLogger("telemetry:consumer-analyzer");
8580
8599
  }
8581
8600
  /**
8582
8601
  * Group spans by consumer key, rank by totalTokens descending, and return
@@ -8772,7 +8791,7 @@ const W_TOKEN_DENSITY = .25;
8772
8791
  var EfficiencyScorer = class {
8773
8792
  _logger;
8774
8793
  constructor(logger) {
8775
- this._logger = logger ?? console;
8794
+ this._logger = logger ?? createStderrLogger("telemetry:efficiency-scorer");
8776
8795
  }
8777
8796
  /**
8778
8797
  * Compute an efficiency score for a story given its turn analyses.
@@ -9005,7 +9024,7 @@ var EfficiencyScorer = class {
9005
9024
  var Recommender = class Recommender {
9006
9025
  _logger;
9007
9026
  constructor(logger) {
9008
- this._logger = logger ?? console;
9027
+ this._logger = logger ?? createStderrLogger("telemetry:recommender");
9009
9028
  }
9010
9029
  /**
9011
9030
  * Run all rules against the given context and return sorted recommendations.
@@ -9422,7 +9441,7 @@ var ClaudeCodeAdapter = class {
9422
9441
  adapterVersion = "1.0.0";
9423
9442
  _logger;
9424
9443
  constructor(logger) {
9425
- this._logger = logger ?? console;
9444
+ this._logger = logger ?? createStderrLogger("claude-adapter");
9426
9445
  }
9427
9446
  /**
9428
9447
  * Verify the `claude` binary is installed and responsive.
@@ -9702,7 +9721,7 @@ var CodexCLIAdapter = class {
9702
9721
  adapterVersion = "1.0.0";
9703
9722
  _logger;
9704
9723
  constructor(logger) {
9705
- this._logger = logger ?? console;
9724
+ this._logger = logger ?? createStderrLogger("codex-adapter");
9706
9725
  }
9707
9726
  /**
9708
9727
  * Verify the `codex` binary is installed and responsive.
@@ -9924,7 +9943,7 @@ var GeminiCLIAdapter = class {
9924
9943
  adapterVersion = "1.0.0";
9925
9944
  _logger;
9926
9945
  constructor(logger) {
9927
- this._logger = logger ?? console;
9946
+ this._logger = logger ?? createStderrLogger("gemini-adapter");
9928
9947
  }
9929
9948
  /**
9930
9949
  * Verify the `gemini` binary is installed and responsive.
@@ -11253,5 +11272,5 @@ async function callLLM(params) {
11253
11272
  }
11254
11273
 
11255
11274
  //#endregion
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-BGZiFI9J.js.map
11275
+ 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, createStderrLogger, 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 };
11276
+ //# sourceMappingURL=dist-CW4d4JMj.js.map
@@ -1,4 +1,4 @@
1
- import { AdtError } from "./dist-BGZiFI9J.js";
1
+ import { AdtError } from "./dist-CW4d4JMj.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-BzUiyd5I.js.map
74
+ //# sourceMappingURL=errors-Da7Izmsw.js.map
@@ -1,3 +1,3 @@
1
- import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-BGZiFI9J.js";
1
+ import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-CW4d4JMj.js";
2
2
 
3
3
  export { createExperimenter };
@@ -1,7 +1,7 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-B-K-bN-0.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-DI5inO7P.js";
2
2
  import "./logger-KeHncl-f.js";
3
- import "./dist-BGZiFI9J.js";
4
- import "./manifest-read-DcGYzUFh.js";
3
+ import "./dist-CW4d4JMj.js";
4
+ import "./manifest-read-DwpffChw.js";
5
5
  import "./work-graph-repository-DZyJv5pV.js";
6
6
  import "./decisions-CzSIEeGP.js";
7
7
 
@@ -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-BGZiFI9J.js";
3
- import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-DcGYzUFh.js";
2
+ import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-CW4d4JMj.js";
3
+ import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-DwpffChw.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-B-K-bN-0.js.map
1003
+ //# sourceMappingURL=health-DI5inO7P.js.map
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-BGZiFI9J.js";
3
+ import { AdapterRegistry, AdtError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter } from "./dist-CW4d4JMj.js";
4
4
  import "./adapter-registry-DIcrxjH8.js";
5
- import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-BzUiyd5I.js";
5
+ import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-Da7Izmsw.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-DcGYzUFh.js";
2
+ import { readCurrentRunId, resolveMainRepoRoot } from "./manifest-read-DwpffChw.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-B1mN4QPJ.js.map
183
+ //# sourceMappingURL=interactive-prompt-Cpke493f.js.map
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-BGZiFI9J.js";
2
+ import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-CW4d4JMj.js";
3
3
  import * as path$1 from "path";
4
4
  import { join } from "path";
5
5
  import { readFile } from "fs/promises";
@@ -2868,7 +2868,7 @@ function probesInvokeProductionTrigger(probes) {
2868
2868
  for (const probe of probes) for (const pattern of TRIGGER_COMMAND_PATTERNS) if (pattern.test(probe.command)) return true;
2869
2869
  return false;
2870
2870
  }
2871
- const defaultExecutors = { host: (probe) => executeProbeOnHost(probe, { cwd: process.cwd() }) };
2871
+ const defaultExecutors = { host: (probe, cwd) => executeProbeOnHost(probe, { cwd: cwd ?? process.cwd() }) };
2872
2872
  var RuntimeProbeCheck = class {
2873
2873
  name = "runtime-probes";
2874
2874
  tier = "A";
@@ -2953,7 +2953,7 @@ var RuntimeProbeCheck = class {
2953
2953
  });
2954
2954
  continue;
2955
2955
  }
2956
- const result = await this._executors.host(probe);
2956
+ const result = await this._executors.host(probe, context.workingDir);
2957
2957
  if (result.outcome === "pass") continue;
2958
2958
  const descriptor = probe.description ? ` (${probe.description})` : "";
2959
2959
  if (result.outcome === "timeout") {
@@ -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-DcGYzUFh.js.map
5848
+ //# sourceMappingURL=manifest-read-DwpffChw.js.map
@@ -1,6 +1,6 @@
1
1
  import "../../logger-KeHncl-f.js";
2
- import "../../dist-BGZiFI9J.js";
3
- import "../../manifest-read-DcGYzUFh.js";
4
- import { runInteractivePrompt } from "../../interactive-prompt-B1mN4QPJ.js";
2
+ import "../../dist-CW4d4JMj.js";
3
+ import "../../manifest-read-DwpffChw.js";
4
+ import { runInteractivePrompt } from "../../interactive-prompt-Cpke493f.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-BGZiFI9J.js";
1
+ import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-CW4d4JMj.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-B-K-bN-0.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-DI5inO7P.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-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";
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, createStderrLogger, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunMetrics, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, listRequirements, loadModelRoutingConfig, registerArtifact, swallowDebug, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-CW4d4JMj.js";
5
+ import { FindingsInjector, RunManifest, RuntimeProbeListSchema, applyConfigToGraph, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, renderFindings, resolveGraphPath, resolveMainRepoRoot, runAcTraceabilityCheck, runStaleVerificationRecovery } from "./manifest-read-DwpffChw.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-B1mN4QPJ.js";
8
+ import { runInteractivePrompt } from "./interactive-prompt-Cpke493f.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,26 +383,6 @@ 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
- };
406
386
  var GitWorktreeManagerImpl = class {
407
387
  _eventBus;
408
388
  _projectRoot;
@@ -420,7 +400,7 @@ var GitWorktreeManagerImpl = class {
420
400
  this._projectRoot = projectRoot;
421
401
  this._baseDirectory = baseDirectory;
422
402
  this._db = db;
423
- this._logger = logger$27 ?? DEFAULT_STDERR_LOGGER;
403
+ this._logger = logger$27 ?? createStderrLogger("git-worktree-manager");
424
404
  this._copyFiles = copyFiles;
425
405
  this._onTaskReady = ({ taskId }) => {
426
406
  this._handleTaskReady(taskId).catch((err) => {
@@ -47018,7 +46998,7 @@ async function runFullPipeline(options) {
47018
46998
  */
47019
46999
  async function emitPreDispatchVersionAdvisory(currentVersion) {
47020
47000
  if (process.env["SUBSTRATE_NO_UPDATE_CHECK"] === "1") return;
47021
- const { createVersionManager } = await import("./version-manager-impl-B4cVH5X6.js");
47001
+ const { createVersionManager } = await import("./version-manager-impl-G82XqDMV.js");
47022
47002
  const vm = createVersionManager();
47023
47003
  const result = await vm.checkForUpdates(true);
47024
47004
  const gap = classifyVersionGap(currentVersion, result.latestVersion);
@@ -47115,4 +47095,4 @@ function registerRunCommand(program, version = "0.0.0", projectRoot = process.cw
47115
47095
 
47116
47096
  //#endregion
47117
47097
  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 };
47118
- //# sourceMappingURL=run-7A1EUUHU.js.map
47098
+ //# sourceMappingURL=run-BEXmYJob.js.map
@@ -1,14 +1,14 @@
1
- import "./health-B-K-bN-0.js";
1
+ import "./health-DI5inO7P.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
- import "./dist-BGZiFI9J.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-7A1EUUHU.js";
6
- import "./manifest-read-DcGYzUFh.js";
4
+ import "./dist-CW4d4JMj.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-BEXmYJob.js";
6
+ import "./manifest-read-DwpffChw.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-B1mN4QPJ.js";
11
+ import "./interactive-prompt-Cpke493f.js";
12
12
  import "./recovery-engine-BKGBeBnW.js";
13
13
 
14
14
  export { runRunAction };
@@ -1,5 +1,5 @@
1
- import "./dist-BGZiFI9J.js";
1
+ import "./dist-CW4d4JMj.js";
2
2
  import "./version-manager-impl-qFBiO4Eh.js";
3
- import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-BL3czSQv.js";
3
+ import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-W9n0n39E.js";
4
4
 
5
5
  export { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand };
@@ -1,4 +1,4 @@
1
- import { createVersionManager } from "./dist-BGZiFI9J.js";
1
+ import { createVersionManager } from "./dist-CW4d4JMj.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-BL3czSQv.js.map
126
+ //# sourceMappingURL=upgrade-W9n0n39E.js.map
@@ -1,4 +1,4 @@
1
- import { VersionManagerImpl, createVersionManager } from "./dist-BGZiFI9J.js";
1
+ import { VersionManagerImpl, createVersionManager } from "./dist-CW4d4JMj.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.111",
3
+ "version": "0.20.113",
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-BGZiFI9J.js";
2
- import "./adapter-registry-DIcrxjH8.js";
3
-
4
- export { AdapterRegistry };