substrate-ai 0.3.3 → 0.3.4

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,3 @@
1
+ import { AdapterRegistry } from "./adapter-registry-DHl0W-YB.js";
2
+
3
+ export { AdapterRegistry };
package/dist/cli/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import { DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DatabaseWrapper, DoltNotInstalled, FileStateStore, SUBSTRATE_OWNED_SETTINGS_KEYS, TelemetryPersistence, VALID_PHASES, buildPipelineStatusOutput, checkDoltInstalled, createConfigSystem, createContextCompiler, createDispatcher, createDoltClient, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStateStore, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initializeDolt, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveStoryKeys, runAnalysisPhase, runMigrations, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-DI9s014E.js";
2
+ import { DEFAULT_CONFIG, DEFAULT_ROUTING_POLICY, DatabaseWrapper, DoltNotInstalled, FileStateStore, SUBSTRATE_OWNED_SETTINGS_KEYS, TelemetryPersistence, VALID_PHASES, buildPipelineStatusOutput, checkDoltInstalled, createConfigSystem, createContextCompiler, createDispatcher, createDoltClient, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStateStore, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, initializeDolt, parseDbTimestampAsUtc, registerHealthCommand, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveStoryKeys, runAnalysisPhase, runMigrations, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-8ygA8hgY.js";
3
3
  import { createLogger } from "../logger-D2fS2ccL.js";
4
4
  import { AdapterRegistry } from "../adapter-registry-DHl0W-YB.js";
5
- import { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema } from "../config-migrator-CQmBdKeG.js";
6
- import { ConfigError, createEventBus } from "../helpers-RL22dYtn.js";
7
- import { addTokenUsage, createDecision, createPipelineRun, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestRun, getTokenUsageSummary, listRequirements, updatePipelineRun } from "../decisions-Dq4cAA2L.js";
8
- import { ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, OPERATIONAL_FINDING, STORY_METRICS, aggregateTokenUsageForRun, compareRunMetrics, getBaselineRunMetrics, getRunMetrics, getStoryMetricsForRun, incrementRunRestarts, listRunMetrics, tagRunAsBaseline } from "../operational-Bovj4fS-.js";
9
- import { abortMerge, createWorktree, getConflictingFiles, getMergedFiles, getOrphanedWorktrees, performMerge, removeBranch, removeWorktree, simulateMerge, verifyGitVersion } from "../git-utils-CtmrZrHS.js";
10
- import "../version-manager-impl-33JYXsqa.js";
11
- import { registerUpgradeCommand } from "../upgrade-DO307rFf.js";
5
+ import { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema } from "../config-migrator-DtZW1maj.js";
6
+ import { ConfigError, createEventBus } from "../helpers-BihqWgVe.js";
7
+ import { addTokenUsage, createDecision, createPipelineRun, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestRun, getTokenUsageSummary, listRequirements, updatePipelineRun } from "../decisions-CdpiJIm5.js";
8
+ import { ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, OPERATIONAL_FINDING, STORY_METRICS, aggregateTokenUsageForRun, compareRunMetrics, getBaselineRunMetrics, getRunMetrics, getStoryMetricsForRun, incrementRunRestarts, listRunMetrics, tagRunAsBaseline } from "../operational-DisxqtjC.js";
9
+ import { abortMerge, createWorktree, getConflictingFiles, getMergedFiles, getOrphanedWorktrees, performMerge, removeBranch, removeWorktree, simulateMerge, verifyGitVersion } from "../git-utils-UbKLSGsD.js";
10
+ import "../version-manager-impl-zsJjBhak.js";
11
+ import { registerUpgradeCommand } from "../upgrade-DTzeenA-.js";
12
12
  import { Command } from "commander";
13
13
  import { fileURLToPath } from "url";
14
14
  import { dirname, join, resolve } from "path";
@@ -2278,6 +2278,20 @@ function defaultSupervisorDeps() {
2278
2278
  }
2279
2279
  },
2280
2280
  getAllDescendants: (rootPids) => getAllDescendantPids(rootPids),
2281
+ getRegistry: (() => {
2282
+ let cached = null;
2283
+ return async () => {
2284
+ if (cached === null) {
2285
+ const { AdapterRegistry: AR } = await import(
2286
+ /* @vite-ignore */
2287
+ "../adapter-registry-eyyVr21J.js"
2288
+ );
2289
+ cached = new AR();
2290
+ await cached.discoverAndRegister();
2291
+ }
2292
+ return cached;
2293
+ };
2294
+ })(),
2281
2295
  writeStallFindings: async (opts) => {
2282
2296
  try {
2283
2297
  const dbRoot = await resolveMainRepoRoot(opts.projectRoot);
@@ -2422,7 +2436,7 @@ function buildTerminalSummary(storyDetails) {
2422
2436
  */
2423
2437
  async function handleStallRecovery(health, state, config, deps, io) {
2424
2438
  const { stallThreshold, maxRestarts, pack, outputFormat } = config;
2425
- const { killPid, resumePipeline, sleep, incrementRestarts, getAllDescendants, writeStallFindings } = deps;
2439
+ const { killPid, resumePipeline, sleep, incrementRestarts, getAllDescendants, writeStallFindings, getRegistry } = deps;
2426
2440
  const { emitEvent, log } = io;
2427
2441
  const { projectRoot } = state;
2428
2442
  if (health.staleness_seconds < stallThreshold) return null;
@@ -2491,12 +2505,14 @@ async function handleStallRecovery(health, state, config, deps, io) {
2491
2505
  });
2492
2506
  log(`Supervisor: Restarting pipeline (attempt ${newRestartCount}/${maxRestarts})`);
2493
2507
  try {
2508
+ const registry = await getRegistry();
2494
2509
  await resumePipeline({
2495
2510
  runId: health.run_id ?? void 0,
2496
2511
  outputFormat,
2497
2512
  projectRoot,
2498
2513
  concurrency: 3,
2499
- pack
2514
+ pack,
2515
+ registry
2500
2516
  });
2501
2517
  if (writeStallFindings) await writeStallFindings({
2502
2518
  runId: health.run_id,
@@ -2651,11 +2667,11 @@ async function runSupervisorAction(options, deps = {}) {
2651
2667
  try {
2652
2668
  const { createExperimenter } = await import(
2653
2669
  /* @vite-ignore */
2654
- "../experimenter-Br1-vzYv.js"
2670
+ "../experimenter-jto3orYl.js"
2655
2671
  );
2656
2672
  const { getLatestRun: getLatest } = await import(
2657
2673
  /* @vite-ignore */
2658
- "../decisions-DxgMpQpz.js"
2674
+ "../decisions-CbysnTi5.js"
2659
2675
  );
2660
2676
  const dbPath = join(projectRoot, ".substrate", "substrate.db");
2661
2677
  const expDbWrapper = new DatabaseWrapper(dbPath);
@@ -2665,7 +2681,7 @@ async function runSupervisorAction(options, deps = {}) {
2665
2681
  const expDb = expDbWrapper.db;
2666
2682
  const { runRunAction: runPipeline } = await import(
2667
2683
  /* @vite-ignore */
2668
- "../run-33J0SBp1.js"
2684
+ "../run-Dul2DU3D.js"
2669
2685
  );
2670
2686
  const runStoryFn = async (opts) => {
2671
2687
  const exitCode = await runPipeline({
@@ -2742,7 +2758,8 @@ async function runSupervisorAction(options, deps = {}) {
2742
2758
  sleep: resolvedDeps.sleep,
2743
2759
  incrementRestarts: resolvedDeps.incrementRestarts,
2744
2760
  getAllDescendants: resolvedDeps.getAllDescendants,
2745
- writeStallFindings: resolvedDeps.writeStallFindings
2761
+ writeStallFindings: resolvedDeps.writeStallFindings,
2762
+ getRegistry: resolvedDeps.getRegistry
2746
2763
  }, {
2747
2764
  emitEvent,
2748
2765
  log
@@ -3029,7 +3046,6 @@ async function runMetricsAction(options) {
3029
3046
  }
3030
3047
  try {
3031
3048
  const telemetryPersistence = new TelemetryPersistence(sqliteDb);
3032
- telemetryPersistence.initSchema();
3033
3049
  if (efficiency === true) {
3034
3050
  const scores = await telemetryPersistence.getEfficiencyScores(20);
3035
3051
  if (outputFormat === "json") process.stdout.write(formatOutput({ efficiency: rowsToEfficiencyScore(scores) }, "json", true) + "\n");
@@ -7456,8 +7472,8 @@ async function createProgram() {
7456
7472
  /** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
7457
7473
  function checkForUpdatesInBackground(currentVersion) {
7458
7474
  if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
7459
- import("../upgrade-Ex1ukwsm.js").then(async () => {
7460
- const { createVersionManager } = await import("../version-manager-impl-Dk3S31y6.js");
7475
+ import("../upgrade-BlJKjr6I.js").then(async () => {
7476
+ const { createVersionManager } = await import("../version-manager-impl-BsHqAeGT.js");
7461
7477
  const vm = createVersionManager();
7462
7478
  const result = await vm.checkForUpdates();
7463
7479
  if (result.updateAvailable) {
@@ -247,4 +247,4 @@ const defaultConfigMigrator = new ConfigMigrator();
247
247
 
248
248
  //#endregion
249
249
  export { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema, SUPPORTED_CONFIG_FORMAT_VERSIONS, SUPPORTED_TASK_GRAPH_VERSIONS, SubstrateConfigSchema, defaultConfigMigrator };
250
- //# sourceMappingURL=config-migrator-CQmBdKeG.js.map
250
+ //# sourceMappingURL=config-migrator-DtZW1maj.js.map
@@ -1,3 +1,3 @@
1
- import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./decisions-Dq4cAA2L.js";
1
+ import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./decisions-CdpiJIm5.js";
2
2
 
3
3
  export { getLatestRun };
@@ -369,4 +369,4 @@ function getTokenUsageSummary(db, runId) {
369
369
 
370
370
  //#endregion
371
371
  export { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision };
372
- //# sourceMappingURL=decisions-Dq4cAA2L.js.map
372
+ //# sourceMappingURL=decisions-CdpiJIm5.js.map
@@ -1,7 +1,7 @@
1
1
  import "./logger-D2fS2ccL.js";
2
- import { createDecision } from "./decisions-Dq4cAA2L.js";
3
- import { EXPERIMENT_RESULT, getRunMetrics, getStoryMetricsForRun } from "./operational-Bovj4fS-.js";
4
- import { spawnGit } from "./git-utils-CtmrZrHS.js";
2
+ import { createDecision } from "./decisions-CdpiJIm5.js";
3
+ import { EXPERIMENT_RESULT, getRunMetrics, getStoryMetricsForRun } from "./operational-DisxqtjC.js";
4
+ import { spawnGit } from "./git-utils-UbKLSGsD.js";
5
5
  import { spawn } from "node:child_process";
6
6
  import { join } from "node:path";
7
7
  import { mkdir, readFile, writeFile } from "node:fs/promises";
@@ -500,4 +500,4 @@ function createExperimenter(config, deps) {
500
500
 
501
501
  //#endregion
502
502
  export { createExperimenter };
503
- //# sourceMappingURL=experimenter-Br1-vzYv.js.map
503
+ //# sourceMappingURL=experimenter-jto3orYl.js.map
@@ -362,4 +362,4 @@ async function getMergedFiles(cwd) {
362
362
 
363
363
  //#endregion
364
364
  export { abortMerge, createWorktree, getConflictingFiles, getMergedFiles, getOrphanedWorktrees, performMerge, removeBranch, removeWorktree, simulateMerge, spawnGit, verifyGitVersion };
365
- //# sourceMappingURL=git-utils-CtmrZrHS.js.map
365
+ //# sourceMappingURL=git-utils-UbKLSGsD.js.map
@@ -917,4 +917,4 @@ async function withRetry(fn, maxRetries = 3, baseDelayMs = 100) {
917
917
 
918
918
  //#endregion
919
919
  export { AdtError, BudgetExceededError, ConfigError, ConfigIncompatibleFormatError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError, assertDefined, createEventBus, createTuiApp, deepClone, formatDuration, generateId, isPlainObject, isTuiCapable, printNonTtyWarning, sleep, withRetry };
920
- //# sourceMappingURL=helpers-RL22dYtn.js.map
920
+ //# sourceMappingURL=helpers-BihqWgVe.js.map
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { childLogger, createLogger, logger } from "./logger-D2fS2ccL.js";
2
2
  import { AdapterRegistry, ClaudeCodeAdapter, CodexCLIAdapter, GeminiCLIAdapter } from "./adapter-registry-DHl0W-YB.js";
3
- import { AdtError, BudgetExceededError, ConfigError, ConfigIncompatibleFormatError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError, assertDefined, createEventBus, createTuiApp, deepClone, formatDuration, generateId, isPlainObject, isTuiCapable, printNonTtyWarning, sleep, withRetry } from "./helpers-RL22dYtn.js";
3
+ import { AdtError, BudgetExceededError, ConfigError, ConfigIncompatibleFormatError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError, assertDefined, createEventBus, createTuiApp, deepClone, formatDuration, generateId, isPlainObject, isTuiCapable, printNonTtyWarning, sleep, withRetry } from "./helpers-BihqWgVe.js";
4
4
 
5
5
  //#region src/core/di.ts
6
6
  /**
@@ -356,4 +356,4 @@ const ADVISORY_NOTES = "advisory-notes";
356
356
 
357
357
  //#endregion
358
358
  export { ADVISORY_NOTES, ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, OPERATIONAL_FINDING, STORY_METRICS, STORY_OUTCOME, TEST_EXPANSION_FINDING, TEST_PLAN, aggregateTokenUsageForRun, aggregateTokenUsageForStory, compareRunMetrics, getBaselineRunMetrics, getRunMetrics, getStoryMetricsForRun, incrementRunRestarts, listRunMetrics, tagRunAsBaseline, writeRunMetrics, writeStoryMetrics };
359
- //# sourceMappingURL=operational-Bovj4fS-.js.map
359
+ //# sourceMappingURL=operational-DisxqtjC.js.map