substrate-ai 0.20.54 → 0.20.55

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.
package/dist/cli/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { FileStateStore, RunManifest, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, parseRuntimeProbes, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorMetrics } from "../health-sQ1X_5_6.js";
2
+ import { FileStateStore, RunManifest, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, parseRuntimeProbes, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics } from "../health-PSnpYDAa.js";
3
3
  import { createLogger } from "../logger-KeHncl-f.js";
4
4
  import { createEventBus } from "../helpers-CElYrONe.js";
5
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, createDoltClient, createPipelineRun, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-VcMmfo2w.js";
6
6
  import "../adapter-registry-DXLMTmfD.js";
7
- import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, validateStopAfterFromConflict } from "../run-DgmoC6HT.js";
7
+ import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, validateStopAfterFromConflict } from "../run-CeaNSnD6.js";
8
8
  import "../errors-CogpxBUg.js";
9
9
  import "../routing-CcBOCuC9.js";
10
10
  import "../decisions-C0pz9Clx.js";
@@ -3667,7 +3667,7 @@ async function runStatusAction(options) {
3667
3667
  logger$13.debug({ err }, "Work graph query failed, continuing without work graph data");
3668
3668
  }
3669
3669
  if (run === void 0) {
3670
- const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-BQ5dj53s.js");
3670
+ const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-BdsvEnfm.js");
3671
3671
  const substrateDirPath = join(projectRoot, ".substrate");
3672
3672
  const processInfo = inspectProcessTree$1({
3673
3673
  projectRoot,
@@ -5204,7 +5204,7 @@ async function runSupervisorAction(options, deps = {}) {
5204
5204
  await initSchema(expAdapter);
5205
5205
  const { runRunAction: runPipeline } = await import(
5206
5206
  /* @vite-ignore */
5207
- "../run-B-SRlzdi.js"
5207
+ "../run-CkFWtcjl.js"
5208
5208
  );
5209
5209
  const runStoryFn = async (opts) => {
5210
5210
  const exitCode = await runPipeline({
@@ -5558,7 +5558,7 @@ function printFactoryRunTable(runs) {
5558
5558
  }
5559
5559
  }
5560
5560
  async function runMetricsAction(options) {
5561
- const { outputFormat, projectRoot, limit = 10, compare, tagBaseline, analysis, sprint, story, taskType, since, aggregate, efficiency, recommendations, turns, consumers, categories, compareStories, routingRecommendations, run, factory, probeAuthorSummary } = options;
5561
+ const { outputFormat, projectRoot, limit = 10, compare, tagBaseline, analysis, sprint, story, taskType, since, aggregate, efficiency, recommendations, turns, consumers, categories, compareStories, routingRecommendations, run, factory, probeAuthorSummary, probeAuthorClassSummary } = options;
5562
5562
  const telemetryModes = [
5563
5563
  efficiency,
5564
5564
  recommendations,
@@ -5970,6 +5970,7 @@ async function runMetricsAction(options) {
5970
5970
  const verificationRanByStoryRun = new Map();
5971
5971
  const probeAuthorByStoryRun = new Map();
5972
5972
  const findingsByAuthorByStoryRun = new Map();
5973
+ const probeAuthorTriggeredByStoryRun = new Map();
5973
5974
  const uniqueRunIds = Array.from(new Set(storyMetrics.map((sm) => sm.run_id).filter((id) => id !== "")));
5974
5975
  for (const uniqueRunId of uniqueRunIds) try {
5975
5976
  const { manifest } = await resolveRunManifest(dbRoot, uniqueRunId);
@@ -5981,6 +5982,7 @@ async function runMetricsAction(options) {
5981
5982
  verificationRanByStoryRun.set(key, entry.verification_result !== void 0 && entry.verification_result !== null);
5982
5983
  probeAuthorByStoryRun.set(key, rollupProbeAuthorMetrics(entry.verification_result));
5983
5984
  findingsByAuthorByStoryRun.set(key, rollupFindingsByAuthor(entry.verification_result));
5985
+ if (entry.probe_author_triggered_by !== void 0) probeAuthorTriggeredByStoryRun.set(key, entry.probe_author_triggered_by);
5984
5986
  }
5985
5987
  } catch {}
5986
5988
  let factoryRuns = [];
@@ -6019,6 +6021,16 @@ async function runMetricsAction(options) {
6019
6021
  const aggregate$1 = aggregateProbeAuthorMetrics(allMetrics, storyMetricsWithFindings.length);
6020
6022
  jsonPayload.probe_author_summary = aggregate$1;
6021
6023
  }
6024
+ if (probeAuthorClassSummary) {
6025
+ const classSummaryEntries = storyMetricsWithFindings.map((sm) => {
6026
+ const key = `${sm.story_key}:${sm.run_id}`;
6027
+ return {
6028
+ metrics: sm.probe_author,
6029
+ triggered_by: probeAuthorTriggeredByStoryRun.get(key)
6030
+ };
6031
+ });
6032
+ jsonPayload.probe_author_class_summary = rollupProbeAuthorByClass(classSummaryEntries);
6033
+ }
6022
6034
  if (doltMetrics !== void 0) if (aggregate) {
6023
6035
  const aggregateResults = doltMetrics.map((m) => ({
6024
6036
  task_type: m.taskType,
@@ -6124,7 +6136,7 @@ async function runMetricsAction(options) {
6124
6136
  }
6125
6137
  }
6126
6138
  function registerMetricsCommand(program, _version = "0.0.0", projectRoot = process.cwd()) {
6127
- program.command("metrics").description("Show historical pipeline run metrics and cross-run comparison").option("--project-root <path>", "Project root directory", projectRoot).option("--output-format <format>", "Output format: human (default) or json", "human").option("--limit <n>", "Number of runs to show (default: 10)", (v) => parseInt(v, 10), 10).option("--compare <run-id-a,run-id-b>", "Compare two runs side-by-side (comma-separated IDs, e.g. abc123,def456)").option("--tag-baseline <run-id>", "Mark a run as the performance baseline").option("--analysis <run-id>", "Read and output the analysis report for the specified run (AC5 of Story 17-3)").option("--sprint <sprint>", "Filter StateStore metrics by sprint (e.g. sprint-1)").option("--story <story-key>", "Filter StateStore metrics by story key (e.g. 26-1)").option("--task-type <type>", "Filter StateStore metrics by task type (e.g. dev-story)").option("--since <iso-date>", "Filter StateStore metrics at or after this ISO timestamp").option("--aggregate", "Aggregate StateStore metrics grouped by task_type").option("--efficiency", "Show telemetry efficiency scores for recent stories").option("--recommendations", "Show all telemetry recommendations across stories").option("--turns <storyKey>", "Show per-turn analysis for a specific story").option("--consumers <storyKey>", "Show consumer stats for a specific story").option("--categories", "Show category stats (optionally scoped by --story <storyKey>)").option("--compare-stories <storyA,storyB>", "Compare efficiency scores of two stories side-by-side (comma-separated keys)").option("--routing-recommendations", "Show routing recommendations derived from phase token breakdown history").option("--run <run-id>", "Show per-iteration score history for a specific factory run").option("--factory", "Show only factory graph run metrics (excludes SDLC runs)").option("--probe-author-summary", "Print cross-run probe-author KPI aggregate (Story 60-15)").action(async (opts) => {
6139
+ program.command("metrics").description("Show historical pipeline run metrics and cross-run comparison").option("--project-root <path>", "Project root directory", projectRoot).option("--output-format <format>", "Output format: human (default) or json", "human").option("--limit <n>", "Number of runs to show (default: 10)", (v) => parseInt(v, 10), 10).option("--compare <run-id-a,run-id-b>", "Compare two runs side-by-side (comma-separated IDs, e.g. abc123,def456)").option("--tag-baseline <run-id>", "Mark a run as the performance baseline").option("--analysis <run-id>", "Read and output the analysis report for the specified run (AC5 of Story 17-3)").option("--sprint <sprint>", "Filter StateStore metrics by sprint (e.g. sprint-1)").option("--story <story-key>", "Filter StateStore metrics by story key (e.g. 26-1)").option("--task-type <type>", "Filter StateStore metrics by task type (e.g. dev-story)").option("--since <iso-date>", "Filter StateStore metrics at or after this ISO timestamp").option("--aggregate", "Aggregate StateStore metrics grouped by task_type").option("--efficiency", "Show telemetry efficiency scores for recent stories").option("--recommendations", "Show all telemetry recommendations across stories").option("--turns <storyKey>", "Show per-turn analysis for a specific story").option("--consumers <storyKey>", "Show consumer stats for a specific story").option("--categories", "Show category stats (optionally scoped by --story <storyKey>)").option("--compare-stories <storyA,storyB>", "Compare efficiency scores of two stories side-by-side (comma-separated keys)").option("--routing-recommendations", "Show routing recommendations derived from phase token breakdown history").option("--run <run-id>", "Show per-iteration score history for a specific factory run").option("--factory", "Show only factory graph run metrics (excludes SDLC runs)").option("--probe-author-summary", "Print cross-run probe-author KPI aggregate (Story 60-15)").option("--probe-author-class-summary", "Print cross-run probe-author KPI aggregate broken down by trigger class (Story 65-6)").action(async (opts) => {
6128
6140
  const outputFormat = opts.outputFormat === "json" ? "json" : "human";
6129
6141
  let compareIds;
6130
6142
  if (opts.compare !== void 0) {
@@ -6162,7 +6174,8 @@ function registerMetricsCommand(program, _version = "0.0.0", projectRoot = proce
6162
6174
  ...opts.routingRecommendations !== void 0 && { routingRecommendations: opts.routingRecommendations },
6163
6175
  ...opts.run !== void 0 && { run: opts.run },
6164
6176
  ...opts.factory !== void 0 && { factory: opts.factory },
6165
- ...opts.probeAuthorSummary !== void 0 && { probeAuthorSummary: opts.probeAuthorSummary }
6177
+ ...opts.probeAuthorSummary !== void 0 && { probeAuthorSummary: opts.probeAuthorSummary },
6178
+ ...opts.probeAuthorClassSummary !== void 0 && { probeAuthorClassSummary: opts.probeAuthorClassSummary }
6166
6179
  };
6167
6180
  const exitCode = await runMetricsAction(metricsOpts);
6168
6181
  process.exitCode = exitCode;
@@ -1,4 +1,4 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-sQ1X_5_6.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-PSnpYDAa.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./dist-VcMmfo2w.js";
4
4
  import "./decisions-C0pz9Clx.js";
@@ -5300,7 +5300,13 @@ const PerStoryStateSchema = z.object({
5300
5300
  review_cycles: z.number().int().nonnegative().optional(),
5301
5301
  dispatches: z.number().int().nonnegative().optional(),
5302
5302
  retry_count: z.number().int().nonnegative().optional(),
5303
- dev_story_signals: StoredDevStorySignalsSchema.optional()
5303
+ dev_story_signals: StoredDevStorySignalsSchema.optional(),
5304
+ probe_author_triggered_by: z.union([
5305
+ z.literal("event-driven"),
5306
+ z.literal("state-integrating"),
5307
+ z.literal("both"),
5308
+ z.string()
5309
+ ]).optional()
5304
5310
  });
5305
5311
 
5306
5312
  //#endregion
@@ -6120,6 +6126,37 @@ function aggregateProbeAuthorMetrics(perStory, totalStories) {
6120
6126
  catchRateByConfirmedDefect: authored > 0 ? confirmed / authored : 0
6121
6127
  };
6122
6128
  }
6129
+ /**
6130
+ * Group entries by `triggered_by` class and compute a `ProbeAuthorAggregate`
6131
+ * for each class. Entries without a `triggered_by` field (legacy/pre-65-6)
6132
+ * default to the `'event-driven'` class per the backward-compat rule.
6133
+ *
6134
+ * Story 65-6: powers `substrate metrics --probe-author-class-summary`.
6135
+ *
6136
+ * @param entries - Array of objects carrying a per-story `metrics` rollup and
6137
+ * an optional `triggered_by` class string (from the manifest's
6138
+ * `probe_author_triggered_by` field).
6139
+ * @returns A record keyed by each of the three known trigger classes, each
6140
+ * value being the `aggregateProbeAuthorMetrics` output for that class's
6141
+ * stories. Classes with no stories still appear with zero aggregates.
6142
+ */
6143
+ function rollupProbeAuthorByClass(entries) {
6144
+ const groups = {
6145
+ "event-driven": [],
6146
+ "state-integrating": [],
6147
+ both: []
6148
+ };
6149
+ for (const entry of entries) {
6150
+ const cls = entry.triggered_by ?? "event-driven";
6151
+ const bucket = cls === "state-integrating" ? "state-integrating" : cls === "both" ? "both" : "event-driven";
6152
+ groups[bucket].push(entry.metrics);
6153
+ }
6154
+ return {
6155
+ "event-driven": aggregateProbeAuthorMetrics(groups["event-driven"], groups["event-driven"].length),
6156
+ "state-integrating": aggregateProbeAuthorMetrics(groups["state-integrating"], groups["state-integrating"].length),
6157
+ both: aggregateProbeAuthorMetrics(groups["both"], groups["both"].length)
6158
+ };
6159
+ }
6123
6160
  /** Extract the probe name from a runtime-probe finding's message. The
6124
6161
  * runtime-probe-check formatter writes `probe "<name>"...` as the leading
6125
6162
  * pattern across all category branches (fail/timeout/assertion-fail/
@@ -6874,5 +6911,5 @@ function registerHealthCommand(program, _version = "0.0.0", projectRoot = proces
6874
6911
  }
6875
6912
 
6876
6913
  //#endregion
6877
- export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, DoltMergeConflict, FileStateStore, FindingsInjector, RunManifest, RuntimeProbeListSchema, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN$1 as STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, __commonJS, __require, __toESM, aggregateProbeAuthorMetrics, applyConfigToGraph, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, createStateStore, detectCycles, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, parseRuntimeProbes, registerHealthCommand, renderFindings, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorMetrics, runHealthAction, validateStoryKey };
6878
- //# sourceMappingURL=health-sQ1X_5_6.js.map
6914
+ export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, DoltMergeConflict, FileStateStore, FindingsInjector, RunManifest, RuntimeProbeListSchema, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN$1 as STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, __commonJS, __require, __toESM, aggregateProbeAuthorMetrics, applyConfigToGraph, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, createStateStore, detectCycles, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, parseRuntimeProbes, registerHealthCommand, renderFindings, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runHealthAction, validateStoryKey };
6915
+ //# sourceMappingURL=health-PSnpYDAa.js.map
package/dist/index.d.ts CHANGED
@@ -2126,13 +2126,19 @@ interface OrchestratorEvents {
2126
2126
  */
2127
2127
  /** Probe-author dispatch completed for a story (success or skip-after-
2128
2128
  * re-read). Existing event emitted by 60-13's runProbeAuthor; 60-15
2129
- * formalizes the schema as part of the lifecycle event family. */
2129
+ * formalizes the schema as part of the lifecycle event family.
2130
+ * Story 65-6: `triggered_by` discriminates event-driven vs. state-integrating
2131
+ * dispatch class. Absent on legacy events — consumers default to
2132
+ * `'event-driven'` per backward-compat rule. */
2130
2133
  'probe-author:dispatched': {
2131
2134
  storyKey: string;
2132
2135
  runId: string;
2133
2136
  probesAuthoredCount: number;
2134
2137
  dispatchDurationMs: number;
2135
2138
  costUsd: number;
2139
+ /** Story 65-6: trigger-class discriminator. Absent on pre-Phase-3 events;
2140
+ * consumers MUST default to `'event-driven'` when absent. */
2141
+ triggered_by?: string;
2136
2142
  };
2137
2143
  /** Probe-author agent's YAML output successfully parsed. Counts probes
2138
2144
  * authored before any append/idempotency check. */
@@ -1,4 +1,4 @@
1
- import { BMAD_BASELINE_TOKENS_FULL, DoltMergeConflict, FileStateStore, FindingsInjector, RunManifest, RuntimeProbeListSchema, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, WorkGraphRepository, __commonJS, __require, __toESM, applyConfigToGraph, buildPipelineStatusOutput, createDatabaseAdapter, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectCycles, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, renderFindings, resolveGraphPath, resolveMainRepoRoot, validateStoryKey } from "./health-sQ1X_5_6.js";
1
+ import { BMAD_BASELINE_TOKENS_FULL, DoltMergeConflict, FileStateStore, FindingsInjector, RunManifest, RuntimeProbeListSchema, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, WorkGraphRepository, __commonJS, __require, __toESM, applyConfigToGraph, buildPipelineStatusOutput, createDatabaseAdapter, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectCycles, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, renderFindings, resolveGraphPath, resolveMainRepoRoot, validateStoryKey } from "./health-PSnpYDAa.js";
2
2
  import { createLogger } from "./logger-KeHncl-f.js";
3
3
  import { TypedEventBusImpl, createEventBus, createTuiApp, isTuiCapable, printNonTtyWarning, sleep } from "./helpers-CElYrONe.js";
4
4
  import { ADVISORY_NOTES, Categorizer, ConsumerAnalyzer, DEFAULT_GLOBAL_SETTINGS, DispatcherImpl, DoltClient, ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, EfficiencyScorer, IngestionServer, LogTurnAnalyzer, OPERATIONAL_FINDING, Recommender, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, STORY_METRICS, STORY_OUTCOME, SubstrateConfigSchema, TEST_EXPANSION_FINDING, TEST_PLAN, TelemetryNormalizer, TelemetryPipeline, TurnAnalyzer, addTokenUsage, aggregateTokenUsageForRun, aggregateTokenUsageForStory, callLLM, createConfigSystem, createDatabaseAdapter$1, createDecision, createPipelineRun, createRequirement, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunMetrics, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, listRequirements, loadModelRoutingConfig, registerArtifact, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-VcMmfo2w.js";
@@ -8448,7 +8448,7 @@ const TIMEOUT_RETRY_MULTIPLIER = 1.5;
8448
8448
  */
8449
8449
  async function runProbeAuthor(deps, params) {
8450
8450
  const start = Date.now();
8451
- const { storyKey, storyFilePath, pipelineRunId, sourceAcContent, epicContent, emitEvent, bypassGates, stateIntegratingEnabled } = params;
8451
+ const { storyKey, storyFilePath, pipelineRunId, sourceAcContent, epicContent, emitEvent, bypassGates, stateIntegratingEnabled, triggerClass } = params;
8452
8452
  const tokenUsage = {
8453
8453
  input: 0,
8454
8454
  output: 0
@@ -8661,7 +8661,8 @@ async function runProbeAuthor(deps, params) {
8661
8661
  runId: pipelineRunId,
8662
8662
  probesAuthoredCount: 0,
8663
8663
  dispatchDurationMs: dispatchDurationMs$1,
8664
- costUsd: estimateDispatchCost$1(tokenUsage.input, tokenUsage.output)
8664
+ costUsd: estimateDispatchCost$1(tokenUsage.input, tokenUsage.output),
8665
+ triggered_by: triggerClass ?? "event-driven"
8665
8666
  });
8666
8667
  return makeSkippedResult(tokenUsage, start);
8667
8668
  }
@@ -8703,7 +8704,8 @@ async function runProbeAuthor(deps, params) {
8703
8704
  runId: pipelineRunId,
8704
8705
  probesAuthoredCount: probes.length,
8705
8706
  dispatchDurationMs,
8706
- costUsd
8707
+ costUsd,
8708
+ triggered_by: triggerClass ?? "event-driven"
8707
8709
  });
8708
8710
  logger$14.info({
8709
8711
  storyKey,
@@ -13469,7 +13471,14 @@ function createImplementationOrchestrator(deps) {
13469
13471
  probeAuthorEpicContent = section ?? epicFull;
13470
13472
  } catch {}
13471
13473
  const stateIntegratingEnabled = config.probeAuthorStateIntegrating !== false;
13472
- if (detectsEventDrivenAC(probeAuthorEpicContent) || stateIntegratingEnabled && detectsStateIntegratingAC(probeAuthorEpicContent)) {
13474
+ const isEventDriven = detectsEventDrivenAC(probeAuthorEpicContent);
13475
+ const isStateIntegrating = stateIntegratingEnabled && detectsStateIntegratingAC(probeAuthorEpicContent);
13476
+ if (isEventDriven || isStateIntegrating) {
13477
+ const triggerClass = isEventDriven && isStateIntegrating ? "both" : isStateIntegrating ? "state-integrating" : "event-driven";
13478
+ if (runManifest !== null && runManifest !== void 0) runManifest.patchStoryState(storyKey, { probe_author_triggered_by: triggerClass }).catch((err) => logger$26.warn({
13479
+ err,
13480
+ storyKey
13481
+ }, "patchStoryState(probe_author_triggered_by) failed — pipeline continues"));
13473
13482
  let artifactHasProbes = false;
13474
13483
  try {
13475
13484
  const artifactContent = readFileSync(storyFilePath, "utf-8");
@@ -13492,6 +13501,7 @@ function createImplementationOrchestrator(deps) {
13492
13501
  sourceAcContent: probeAuthorEpicContent,
13493
13502
  epicContent: probeAuthorEpicContent,
13494
13503
  stateIntegratingEnabled,
13504
+ triggerClass,
13495
13505
  emitEvent: (name, payload) => {
13496
13506
  eventBus.emit("orchestrator:story-warn", {
13497
13507
  storyKey,
@@ -45420,4 +45430,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
45420
45430
 
45421
45431
  //#endregion
45422
45432
  export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runRunAction, runSolutioningPhase, validateStopAfterFromConflict, wireNdjsonEmitter };
45423
- //# sourceMappingURL=run-DgmoC6HT.js.map
45433
+ //# sourceMappingURL=run-CeaNSnD6.js.map
@@ -1,8 +1,8 @@
1
- import "./health-sQ1X_5_6.js";
1
+ import "./health-PSnpYDAa.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
4
  import "./dist-VcMmfo2w.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-DgmoC6HT.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-CeaNSnD6.js";
6
6
  import "./routing-CcBOCuC9.js";
7
7
  import "./decisions-C0pz9Clx.js";
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.20.54",
3
+ "version": "0.20.55",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",