substrate-ai 0.5.8 → 0.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltClient, DoltNotInstalled, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, FileStateStore, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SUBSTRATE_OWNED_SETTINGS_KEYS, SymbolParser, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, checkDoltInstalled, createConfigSystem, createContextCompiler, createDatabaseAdapter, createDispatcher, createDoltClient, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStateStore, createStopAfterGate, createTelemetryAdvisor, detectCycles, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initSchema, initializeDolt, isSyncAdapter, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-CCjGNBpI.js";
2
+ import { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltClient, DoltNotInstalled, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, FileStateStore, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SUBSTRATE_OWNED_SETTINGS_KEYS, SymbolParser, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, checkDoltInstalled, createConfigSystem, createContextCompiler, createDatabaseAdapter, createDispatcher, createDoltClient, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStateStore, createStopAfterGate, createTelemetryAdvisor, detectCycles, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initSchema, initializeDolt, isSyncAdapter, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-DqMnPTZa.js";
3
3
  import { createLogger } from "../logger-D2fS2ccL.js";
4
4
  import { AdapterRegistry } from "../adapter-registry-D2zdMwVu.js";
5
5
  import { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema } from "../config-migrator-DtZW1maj.js";
@@ -2969,7 +2969,7 @@ async function runSupervisorAction(options, deps = {}) {
2969
2969
  await initSchema(expAdapter);
2970
2970
  const { runRunAction: runPipeline } = await import(
2971
2971
  /* @vite-ignore */
2972
- "../run-CqpGVKg6.js"
2972
+ "../run-hr7YMtJF.js"
2973
2973
  );
2974
2974
  const runStoryFn = async (opts) => {
2975
2975
  const exitCode = await runPipeline({
@@ -12680,6 +12680,20 @@ var AdapterTelemetryPersistence = class {
12680
12680
  });
12681
12681
  }
12682
12682
  /**
12683
+ * Delete all telemetry data for a story across all 5 telemetry tables.
12684
+ * Used to purge stale data from prior runs before persisting new data.
12685
+ */
12686
+ async purgeStoryTelemetry(storyKey) {
12687
+ await this._adapter.transaction(async (adapter) => {
12688
+ await adapter.query("DELETE FROM turn_analysis WHERE story_key = ?", [storyKey]);
12689
+ await adapter.query("DELETE FROM efficiency_scores WHERE story_key = ?", [storyKey]);
12690
+ await adapter.query("DELETE FROM recommendations WHERE story_key = ?", [storyKey]);
12691
+ await adapter.query("DELETE FROM category_stats WHERE story_key = ?", [storyKey]);
12692
+ await adapter.query("DELETE FROM consumer_stats WHERE story_key = ?", [storyKey]);
12693
+ });
12694
+ logger$9.debug({ storyKey }, "Purged stale telemetry data for story");
12695
+ }
12696
+ /**
12683
12697
  * Record a named span with arbitrary attributes.
12684
12698
  * Currently logs the span at debug level; no DB persistence.
12685
12699
  */
@@ -12749,6 +12763,9 @@ var TelemetryPersistence = class {
12749
12763
  async getConsumerStats(storyKey) {
12750
12764
  return this._impl.getConsumerStats(storyKey);
12751
12765
  }
12766
+ async purgeStoryTelemetry(storyKey) {
12767
+ return this._impl.purgeStoryTelemetry(storyKey);
12768
+ }
12752
12769
  /**
12753
12770
  * Record a named span with arbitrary attributes.
12754
12771
  * Currently logs the span at debug level; no DB persistence.
@@ -14852,6 +14869,8 @@ var TelemetryPipeline = class {
14852
14869
  _efficiencyScorer;
14853
14870
  _recommender;
14854
14871
  _persistence;
14872
+ /** Stories that have had stale telemetry purged this pipeline lifetime. */
14873
+ _purgedStories = new Set();
14855
14874
  constructor(deps) {
14856
14875
  this._normalizer = deps.normalizer;
14857
14876
  this._turnAnalyzer = deps.turnAnalyzer;
@@ -15091,6 +15110,13 @@ var TelemetryPipeline = class {
15091
15110
  */
15092
15111
  async _persistStoryData(storyKey, data) {
15093
15112
  const { turns, efficiencyScore, categoryStats, consumerStats, recommendations, dispatchScores } = data;
15113
+ if (!this._purgedStories.has(storyKey)) {
15114
+ this._purgedStories.add(storyKey);
15115
+ await this._persistence.purgeStoryTelemetry(storyKey).catch((err) => logger$7.warn({
15116
+ err,
15117
+ storyKey
15118
+ }, "Failed to purge stale telemetry — continuing with persist"));
15119
+ }
15094
15120
  await Promise.all([
15095
15121
  turns.length > 0 ? this._persistence.storeTurnAnalysis(storyKey, turns).catch((err) => logger$7.warn({
15096
15122
  err,
@@ -22679,4 +22705,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
22679
22705
 
22680
22706
  //#endregion
22681
22707
  export { AdapterTelemetryPersistence, AppError, DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DoltClient, DoltNotInstalled, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, FileStateStore, GitClient, GrammarLoader, IngestionServer, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SUBSTRATE_OWNED_SETTINGS_KEYS, SymbolParser, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, checkDoltInstalled, createConfigSystem, createContextCompiler, createDatabaseAdapter, createDispatcher, createDoltClient, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStateStore, createStopAfterGate, createTelemetryAdvisor, detectCycles, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initSchema, initializeDolt, isSyncAdapter, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
22682
- //# sourceMappingURL=run-CCjGNBpI.js.map
22708
+ //# sourceMappingURL=run-DqMnPTZa.js.map
@@ -1,4 +1,4 @@
1
- import { registerRunCommand, runRunAction } from "./run-CCjGNBpI.js";
1
+ import { registerRunCommand, runRunAction } from "./run-DqMnPTZa.js";
2
2
  import "./logger-D2fS2ccL.js";
3
3
  import "./config-migrator-DtZW1maj.js";
4
4
  import "./helpers-BihqWgVe.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.5.8",
3
+ "version": "0.5.9",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",