substrate-ai 0.20.106 → 0.20.107

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,9 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { FileStateStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createDatabaseAdapter, createDoltOperatorReader, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion } from "../health-C5ASRMDX.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-DlPF4Mfk.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, 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-CiMN31df.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-BaEjWFS6.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-CvxO6ipT.js";
7
7
  import "../adapter-registry-DIcrxjH8.js";
8
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-6GF2dThG.js";
9
9
  import "../errors-BaUaJmz9.js";
@@ -6891,7 +6891,7 @@ async function runStatusAction(options) {
6891
6891
  logger$15.debug({ err }, "Work graph query failed, continuing without work graph data");
6892
6892
  }
6893
6893
  if (run === void 0) {
6894
- const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-CrS1fVlc.js");
6894
+ const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-3r75oi42.js");
6895
6895
  const substrateDirPath = join(projectRoot, ".substrate");
6896
6896
  const processInfo = inspectProcessTree$1({
6897
6897
  projectRoot,
@@ -8420,7 +8420,7 @@ async function runSupervisorAction(options, deps = {}) {
8420
8420
  await initSchema(expAdapter);
8421
8421
  const { runRunAction: runPipeline } = await import(
8422
8422
  /* @vite-ignore */
8423
- "../run-BPqjp1vn.js"
8423
+ "../run-B8bQ5RCl.js"
8424
8424
  );
8425
8425
  const runStoryFn = async (opts) => {
8426
8426
  const exitCode = await runPipeline({
@@ -8928,10 +8928,7 @@ async function runMetricsAction(options) {
8928
8928
  if (routingRecommendations === true) {
8929
8929
  const dbRoot$1 = await resolveMainRepoRoot(projectRoot);
8930
8930
  const dbDir = join(dbRoot$1, ".substrate");
8931
- const stateStore = createStateStore({
8932
- backend: "file",
8933
- basePath: dbDir
8934
- });
8931
+ const stateStore = new FileKvStore({ basePath: dbDir });
8935
8932
  await stateStore.initialize();
8936
8933
  try {
8937
8934
  const runIndexRaw = await stateStore.getMetric("__global__", "phase_token_breakdown_runs");
@@ -9152,7 +9149,7 @@ async function runMetricsAction(options) {
9152
9149
  });
9153
9150
  const phaseBreakdownMap = {};
9154
9151
  try {
9155
- const kvStore = new FileStateStore({ basePath: join(dbRoot, ".substrate") });
9152
+ const kvStore = new FileKvStore({ basePath: join(dbRoot, ".substrate") });
9156
9153
  for (const run$1 of runs) {
9157
9154
  const raw = await kvStore.getMetric(run$1.run_id, "phase_token_breakdown");
9158
9155
  phaseBreakdownMap[run$1.run_id] = raw !== void 0 ? raw : null;
@@ -11784,7 +11781,7 @@ const logger$3 = createLogger("cli:routing");
11784
11781
  function registerRoutingCommand(program) {
11785
11782
  program.command("routing").description("Show routing configuration and auto-tune history").option("--history", "Show the routing auto-tune log (model changes applied)").option("--output-format <format>", "Output format: text or json", "text").action(async (options) => {
11786
11783
  const dbRoot = await resolveMainRepoRoot(process.cwd());
11787
- const store = new FileStateStore({ basePath: join$1(dbRoot, ".substrate") });
11784
+ const store = new FileKvStore({ basePath: join$1(dbRoot, ".substrate") });
11788
11785
  try {
11789
11786
  await store.initialize();
11790
11787
  if (options.history === true) {
@@ -1,4 +1,4 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-C5ASRMDX.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-DlPF4Mfk.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./dist-CiMN31df.js";
4
4
  import "./manifest-read-6GF2dThG.js";
@@ -402,44 +402,15 @@ function formatPipelineSummary(run, tokenSummary, decisionsCount, storiesCount,
402
402
 
403
403
  //#endregion
404
404
  //#region src/modules/state/file-store.ts
405
- var FileStateStore = class {
405
+ var FileKvStore = class {
406
406
  _basePath;
407
- _stories = new Map();
408
- _metrics = [];
409
- _contracts = new Map();
410
- _contractVerifications = new Map();
411
- /** Key-value metrics store: outer key = runId, inner key = metric key */
407
+ /** Key-value store: outer key = runId (or '__global__'), inner key = metric key. */
412
408
  _kvMetrics = new Map();
413
409
  constructor(options = {}) {
414
410
  this._basePath = options.basePath;
415
411
  }
416
412
  async initialize() {}
417
413
  async close() {}
418
- async setStoryState(storyKey, state) {
419
- this._stories.set(storyKey, {
420
- ...state,
421
- storyKey
422
- });
423
- }
424
- async queryStories(filter) {
425
- const all = Array.from(this._stories.values());
426
- return all.filter((record) => {
427
- if (filter.phase !== void 0) {
428
- const phases = Array.isArray(filter.phase) ? filter.phase : [filter.phase];
429
- if (!phases.includes(record.phase)) return false;
430
- }
431
- if (filter.sprint !== void 0 && record.sprint !== filter.sprint) return false;
432
- if (filter.storyKey !== void 0 && record.storyKey !== filter.storyKey) return false;
433
- return true;
434
- });
435
- }
436
- async recordMetric(metric) {
437
- const record = {
438
- ...metric,
439
- recordedAt: metric.recordedAt ?? new Date().toISOString()
440
- };
441
- this._metrics.push(record);
442
- }
443
414
  async setMetric(runId, key, value) {
444
415
  let runMap = this._kvMetrics.get(runId);
445
416
  if (runMap === void 0) {
@@ -470,30 +441,6 @@ var FileStateStore = class {
470
441
  const filePath = join$1(this._basePath, "kv-metrics.json");
471
442
  await writeFile(filePath, JSON.stringify(serialized, null, 2), "utf-8");
472
443
  }
473
- async setContracts(storyKey, contracts) {
474
- this._contracts.set(storyKey, contracts.map((c) => ({ ...c })));
475
- }
476
- async queryContracts(filter) {
477
- const all = [];
478
- for (const records of this._contracts.values()) for (const r of records) all.push(r);
479
- return all.filter((r) => {
480
- if (filter?.storyKey !== void 0 && r.storyKey !== filter.storyKey) return false;
481
- if (filter?.direction !== void 0 && r.direction !== filter.direction) return false;
482
- return true;
483
- });
484
- }
485
- async setContractVerification(storyKey, results) {
486
- this._contractVerifications.set(storyKey, results.map((r) => ({ ...r })));
487
- if (this._basePath !== void 0) {
488
- const serialized = {};
489
- for (const [key, records] of this._contractVerifications) serialized[key] = records;
490
- const filePath = join$1(this._basePath, "contract-verifications.json");
491
- await writeFile(filePath, JSON.stringify(serialized, null, 2), "utf-8");
492
- }
493
- }
494
- async getHistory(_limit) {
495
- return [];
496
- }
497
444
  };
498
445
 
499
446
  //#endregion
@@ -557,14 +504,6 @@ var DoltStateStore = class {
557
504
  //#endregion
558
505
  //#region src/modules/state/index.ts
559
506
  /**
560
- * Create a StateStore for orchestrator use. Returns a FileStateStore — the
561
- * Dolt backend is no longer routed through this factory (use
562
- * `createDoltOperatorReader` for operator-side Dolt reads).
563
- */
564
- function createStateStore(config = {}) {
565
- return new FileStateStore({ basePath: config.basePath });
566
- }
567
- /**
568
507
  * Create a DoltOperatorReader for CLI operator commands (history, routing,
569
508
  * metrics, health). Constructs a DoltClient against `<basePath>/.dolt/` and
570
509
  * exposes only the read-side surface meaningful for operators.
@@ -1060,5 +999,5 @@ function registerHealthCommand(program, _version = "0.0.0", projectRoot = proces
1060
999
  }
1061
1000
 
1062
1001
  //#endregion
1063
- export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, FileStateStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createDoltOperatorReader, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, runHealthAction, validateStoryKey };
1064
- //# sourceMappingURL=health-C5ASRMDX.js.map
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-DlPF4Mfk.js.map
@@ -1,8 +1,8 @@
1
- import "./health-C5ASRMDX.js";
1
+ import "./health-DlPF4Mfk.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
4
  import "./dist-CiMN31df.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-BaEjWFS6.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-CvxO6ipT.js";
6
6
  import "./manifest-read-6GF2dThG.js";
7
7
  import "./routing-DFxoKHDt.js";
8
8
  import "./work-graph-repository-DZyJv5pV.js";
@@ -1,4 +1,4 @@
1
- import { BMAD_BASELINE_TOKENS_FULL, FileStateStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, validateStoryKey } from "./health-C5ASRMDX.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-DlPF4Mfk.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, 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-CiMN31df.js";
@@ -45852,7 +45852,7 @@ async function runRunAction(options) {
45852
45852
  }
45853
45853
  let routingTuner;
45854
45854
  if (routingConfig !== void 0) {
45855
- const kvStateStore = new FileStateStore({ basePath: join(dbRoot, ".substrate") });
45855
+ const kvStateStore = new FileKvStore({ basePath: join(dbRoot, ".substrate") });
45856
45856
  routingTokenAccumulator = new RoutingTokenAccumulator(routingConfig, kvStateStore, logger);
45857
45857
  eventBus.on("routing:model-selected", (payload) => {
45858
45858
  routingTokenAccumulator.onRoutingSelected({
@@ -47051,4 +47051,4 @@ function registerRunCommand(program, version = "0.0.0", projectRoot = process.cw
47051
47051
 
47052
47052
  //#endregion
47053
47053
  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 };
47054
- //# sourceMappingURL=run-BaEjWFS6.js.map
47054
+ //# sourceMappingURL=run-CvxO6ipT.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.20.106",
3
+ "version": "0.20.107",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",