substrate-ai 0.13.0 → 0.13.1

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-CLvAwmT7.js";
2
+ import "./adapter-registry-DXLMTmfD.js";
3
+
4
+ export { AdapterRegistry };
package/dist/cli/index.js CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { FileStateStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, detectCycles, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot } from "../health-BR5GD5Ge.js";
2
+ import { FileStateStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, WorkGraphRepository, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, detectCycles, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot } from "../health-DswaC1q5.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, EXPERIMENT_RESULT, GlobalSettingsSchema, 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, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRequirements, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-DKG5lyUw.js";
5
+ import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, EXPERIMENT_RESULT, GlobalSettingsSchema, 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, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRequirements, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-CLvAwmT7.js";
6
6
  import "../adapter-registry-DXLMTmfD.js";
7
- import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-zWACyS3w.js";
8
- import "../errors-CQKOiaYV.js";
7
+ import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-DDUeFC-I.js";
8
+ import "../errors-D1LU8CZ9.js";
9
9
  import "../routing-CcBOCuC9.js";
10
10
  import "../decisions-C0pz9Clx.js";
11
11
  import "../version-manager-impl-BmOWu8ml.js";
12
- import { registerUpgradeCommand } from "../upgrade-CBE6JaxX.js";
12
+ import { registerUpgradeCommand } from "../upgrade-DT0I_-1E.js";
13
13
  import { Command } from "commander";
14
14
  import { fileURLToPath } from "url";
15
15
  import { dirname, join, resolve } from "path";
@@ -3025,7 +3025,7 @@ async function runStatusAction(options) {
3025
3025
  if (run === void 0) run = await getLatestRun(adapter);
3026
3026
  }
3027
3027
  if (run === void 0) {
3028
- const { inspectProcessTree } = await import("../health-DXNHn938.js");
3028
+ const { inspectProcessTree } = await import("../health-GEDGgGan.js");
3029
3029
  const substrateDirPath = join(projectRoot, ".substrate");
3030
3030
  const processInfo = inspectProcessTree({
3031
3031
  projectRoot,
@@ -3910,7 +3910,7 @@ function defaultSupervisorDeps() {
3910
3910
  if (cached === null) {
3911
3911
  const { AdapterRegistry: AR } = await import(
3912
3912
  /* @vite-ignore */
3913
- "../adapter-registry-B19pDsb2.js"
3913
+ "../adapter-registry-DbLuI3IA.js"
3914
3914
  );
3915
3915
  cached = new AR();
3916
3916
  await cached.discoverAndRegister();
@@ -4104,6 +4104,10 @@ async function handleStallRecovery(health, state, config, deps, io) {
4104
4104
  const orchestratorIdle = health.process.child_pids.length === 0 && health.stories.active > 0;
4105
4105
  const effectiveThreshold = inReviewPhase && !orchestratorIdle ? stallThreshold * 2 : stallThreshold;
4106
4106
  if (health.staleness_seconds < effectiveThreshold) return null;
4107
+ if (state.runId !== void 0 && health.run_id !== null && health.run_id !== state.runId) {
4108
+ log("Supervisor skipping kill — active pipeline belongs to a different session");
4109
+ return null;
4110
+ }
4107
4111
  const directPids = [...health.process.orchestrator_pid !== null ? [health.process.orchestrator_pid] : [], ...health.process.child_pids];
4108
4112
  const descendantPids = getAllDescendants(directPids);
4109
4113
  const directPidSet = new Set(directPids);
@@ -4341,11 +4345,11 @@ async function runSupervisorAction(options, deps = {}) {
4341
4345
  try {
4342
4346
  const { createExperimenter } = await import(
4343
4347
  /* @vite-ignore */
4344
- "../experimenter-DAIK4Ljm.js"
4348
+ "../experimenter-D0k2wT3I.js"
4345
4349
  );
4346
4350
  const { getLatestRun: getLatest } = await import(
4347
4351
  /* @vite-ignore */
4348
- "../decisions-0VsbM-3Z.js"
4352
+ "../decisions-CGNEausW.js"
4349
4353
  );
4350
4354
  const expAdapter = createDatabaseAdapter({
4351
4355
  backend: "auto",
@@ -4355,7 +4359,7 @@ async function runSupervisorAction(options, deps = {}) {
4355
4359
  await initSchema(expAdapter);
4356
4360
  const { runRunAction: runPipeline } = await import(
4357
4361
  /* @vite-ignore */
4358
- "../run-C3HrjTtt.js"
4362
+ "../run-BV2zNwIC.js"
4359
4363
  );
4360
4364
  const runStoryFn = async (opts) => {
4361
4365
  const exitCode = await runPipeline({
@@ -4871,7 +4875,7 @@ async function runMetricsAction(options) {
4871
4875
  const routingConfigPath = join(dbDir, "routing.yml");
4872
4876
  let routingConfig = null;
4873
4877
  if (existsSync$1(routingConfigPath)) try {
4874
- const { loadModelRoutingConfig } = await import("../routing-h9IhuF0i.js");
4878
+ const { loadModelRoutingConfig } = await import("../routing-B1aoIz7L.js");
4875
4879
  routingConfig = loadModelRoutingConfig(routingConfigPath);
4876
4880
  } catch {}
4877
4881
  if (routingConfig === null) routingConfig = {
@@ -8621,8 +8625,8 @@ async function createProgram() {
8621
8625
  /** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
8622
8626
  function checkForUpdatesInBackground(currentVersion) {
8623
8627
  if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
8624
- import("../upgrade-D0JTv4uQ.js").then(async () => {
8625
- const { createVersionManager } = await import("../version-manager-impl-CxCB4SPB.js");
8628
+ import("../upgrade-DPdh5w4p.js").then(async () => {
8629
+ const { createVersionManager } = await import("../version-manager-impl-BHnUB2tl.js");
8626
8630
  const vm = createVersionManager();
8627
8631
  const result = await vm.checkForUpdates();
8628
8632
  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-DKG5lyUw.js";
1
+ import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-CLvAwmT7.js";
2
2
  import "./decisions-C0pz9Clx.js";
3
3
 
4
4
  export { getLatestRun };
@@ -1871,11 +1871,19 @@ var InMemoryDatabaseAdapter = class {
1871
1871
 
1872
1872
  //#endregion
1873
1873
  //#region packages/core/dist/persistence/adapter.js
1874
- function isDoltAvailable(basePath) {
1874
+ function isDoltBinaryAvailable() {
1875
1875
  const result = spawnSync("dolt", ["version"], { stdio: "ignore" });
1876
- if (result.error != null || result.status !== 0) return false;
1876
+ return result.error == null && result.status === 0;
1877
+ }
1878
+ function isDoltAvailable(basePath) {
1877
1879
  const stateDoltDir = join$1(basePath, ".substrate", "state", ".dolt");
1878
- return existsSync(stateDoltDir);
1880
+ if (!existsSync(stateDoltDir)) return false;
1881
+ if (isDoltBinaryAvailable()) return true;
1882
+ console.warn("[persistence:adapter] Dolt directory found but dolt binary unavailable — retrying once...");
1883
+ spawnSync("sleep", ["1"], { stdio: "ignore" });
1884
+ if (isDoltBinaryAvailable()) return true;
1885
+ console.warn("[persistence:adapter] Dolt still unavailable after retry — falling back to InMemoryDatabaseAdapter. Telemetry and cost data will NOT persist.");
1886
+ return false;
1879
1887
  }
1880
1888
  function createDatabaseAdapter(config = { backend: "auto" }, doltClientFactory) {
1881
1889
  const backend = config.backend ?? "auto";
@@ -10228,4 +10236,4 @@ async function callLLM(params) {
10228
10236
 
10229
10237
  //#endregion
10230
10238
  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, IngestionServer, 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, compareRunMetrics, createAmendmentRun, createConfigSystem, createDatabaseAdapter as createDatabaseAdapter$1, createDecision, createDoltClient, 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, initializeDolt, listRequirements, listRunMetrics, loadModelRoutingConfig, loadParentRunDecisions, registerArtifact, resolvePromptFile, supersedeDecision, tagRunAsBaseline, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics };
10231
- //# sourceMappingURL=dist-DKG5lyUw.js.map
10239
+ //# sourceMappingURL=dist-CLvAwmT7.js.map
@@ -1,4 +1,4 @@
1
- import { AdtError } from "./dist-DKG5lyUw.js";
1
+ import { AdtError } from "./dist-CLvAwmT7.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-CQKOiaYV.js.map
74
+ //# sourceMappingURL=errors-D1LU8CZ9.js.map
@@ -1,3 +1,3 @@
1
- import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-DKG5lyUw.js";
1
+ import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-CLvAwmT7.js";
2
2
 
3
3
  export { createExperimenter };
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-DKG5lyUw.js";
2
+ import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-CLvAwmT7.js";
3
3
  import { createRequire } from "module";
4
4
  import { dirname, join } from "path";
5
5
  import { existsSync, readFileSync } from "node:fs";
@@ -1930,4 +1930,4 @@ function registerHealthCommand(program, _version = "0.0.0", projectRoot = proces
1930
1930
 
1931
1931
  //#endregion
1932
1932
  export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, DoltMergeConflict, FileStateStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN$1 as STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, WorkGraphRepository, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createStateStore, detectCycles, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, runHealthAction, validateStoryKey };
1933
- //# sourceMappingURL=health-BR5GD5Ge.js.map
1933
+ //# sourceMappingURL=health-DswaC1q5.js.map
@@ -1,6 +1,6 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-BR5GD5Ge.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-DswaC1q5.js";
2
2
  import "./logger-KeHncl-f.js";
3
- import "./dist-DKG5lyUw.js";
3
+ import "./dist-CLvAwmT7.js";
4
4
  import "./decisions-C0pz9Clx.js";
5
5
 
6
6
  export { inspectProcessTree };
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-DKG5lyUw.js";
3
+ import { AdapterRegistry, AdtError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter } from "./dist-CLvAwmT7.js";
4
4
  import "./adapter-registry-DXLMTmfD.js";
5
- import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-CQKOiaYV.js";
5
+ import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-D1LU8CZ9.js";
6
6
 
7
7
  //#region src/core/di.ts
8
8
  /**
@@ -1,4 +1,4 @@
1
- import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-DKG5lyUw.js";
1
+ import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-CLvAwmT7.js";
2
2
  import "./routing-CcBOCuC9.js";
3
3
 
4
4
  export { loadModelRoutingConfig };
@@ -0,0 +1,9 @@
1
+ import "./health-DswaC1q5.js";
2
+ import "./logger-KeHncl-f.js";
3
+ import "./helpers-CElYrONe.js";
4
+ import "./dist-CLvAwmT7.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, runRunAction } from "./run-DDUeFC-I.js";
6
+ import "./routing-CcBOCuC9.js";
7
+ import "./decisions-C0pz9Clx.js";
8
+
9
+ export { runRunAction };
@@ -1,7 +1,7 @@
1
- import { BMAD_BASELINE_TOKENS_FULL, DoltMergeConflict, FileStateStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, WorkGraphRepository, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, resolveMainRepoRoot, validateStoryKey } from "./health-BR5GD5Ge.js";
1
+ import { BMAD_BASELINE_TOKENS_FULL, DoltMergeConflict, FileStateStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, WorkGraphRepository, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, resolveMainRepoRoot, validateStoryKey } from "./health-DswaC1q5.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, 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, createDecision, createPipelineRun, createRequirement, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getPipelineRunById, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, loadModelRoutingConfig, registerArtifact, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-DKG5lyUw.js";
4
+ import { ADVISORY_NOTES, Categorizer, ConsumerAnalyzer, DEFAULT_GLOBAL_SETTINGS, DispatcherImpl, DoltClient, ESCALATION_DIAGNOSIS, 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, createDecision, createPipelineRun, createRequirement, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getPipelineRunById, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, loadModelRoutingConfig, registerArtifact, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-CLvAwmT7.js";
5
5
  import { basename, dirname, extname, join } from "path";
6
6
  import { access, readFile, readdir, stat } from "fs/promises";
7
7
  import { EventEmitter } from "node:events";
@@ -10893,11 +10893,23 @@ function createImplementationOrchestrator(deps) {
10893
10893
  checkpointHandled = true;
10894
10894
  }
10895
10895
  if (!checkpointHandled) if (devResult.result === "success") devStoryWasSuccess = true;
10896
- else logger$21.warn({
10897
- storyKey,
10898
- error: devResult.error,
10899
- filesModified: devFilesModified.length
10900
- }, "Dev-story reported failure, proceeding to code review");
10896
+ else {
10897
+ logger$21.warn({
10898
+ storyKey,
10899
+ error: devResult.error,
10900
+ filesModified: devFilesModified.length
10901
+ }, "Dev-story reported failure, proceeding to code review");
10902
+ if (!devResult.error?.startsWith("dispatch_timeout")) {
10903
+ logger$21.warn({
10904
+ storyKey,
10905
+ error: devResult.error
10906
+ }, "Agent process failure (non-timeout) — story will proceed to code review with partial work");
10907
+ eventBus.emit("orchestrator:story-warn", {
10908
+ storyKey,
10909
+ msg: "agent process failure (non-timeout)"
10910
+ });
10911
+ }
10912
+ }
10901
10913
  }
10902
10914
  } catch (err) {
10903
10915
  const errMsg = err instanceof Error ? err.message : String(err);
@@ -10974,9 +10986,12 @@ function createImplementationOrchestrator(deps) {
10974
10986
  if (buildVerifyResult.status === "passed") {
10975
10987
  const resolvedRootForTsc = projectRoot ?? process.cwd();
10976
10988
  const tscBin = join$1(resolvedRootForTsc, "node_modules", ".bin", "tsc");
10977
- const hasTsc = existsSync(tscBin) && existsSync(join$1(resolvedRootForTsc, "tsconfig.json"));
10989
+ const typecheckConfig = join$1(resolvedRootForTsc, "tsconfig.typecheck.json");
10990
+ const defaultConfig = join$1(resolvedRootForTsc, "tsconfig.json");
10991
+ const tscConfigFlag = existsSync(typecheckConfig) ? ` -p ${typecheckConfig}` : "";
10992
+ const hasTsc = existsSync(tscBin) && (existsSync(typecheckConfig) || existsSync(defaultConfig));
10978
10993
  if (hasTsc) try {
10979
- execSync(`"${tscBin}" --noEmit`, {
10994
+ execSync(`"${tscBin}" --noEmit${tscConfigFlag}`, {
10980
10995
  cwd: resolvedRootForTsc,
10981
10996
  timeout: 12e4,
10982
10997
  encoding: "utf-8",
@@ -16735,15 +16750,34 @@ function createSdlcDevStoryHandler(options) {
16735
16750
  };
16736
16751
  try {
16737
16752
  const workflowResult = await options.runDevStory(options.deps, devStoryParams);
16738
- if (workflowResult.result === "success") outcome = {
16739
- status: "SUCCESS",
16740
- contextUpdates: {
16741
- filesModified: workflowResult.files_modified,
16742
- acMet: workflowResult.ac_met,
16743
- devStoryFilesModified: workflowResult.files_modified
16753
+ if (workflowResult.result === "success") {
16754
+ if (options.buildVerifier) {
16755
+ const projectRoot = context.getString("projectRoot", "");
16756
+ if (projectRoot) {
16757
+ const buildResult = options.buildVerifier(projectRoot);
16758
+ if (buildResult.status === "failed" || buildResult.status === "timeout") {
16759
+ outcome = {
16760
+ status: "FAILURE",
16761
+ failureReason: `build verification failed after dev-story: ${buildResult.output?.slice(0, 500) ?? "no output"}`,
16762
+ contextUpdates: {
16763
+ filesModified: workflowResult.files_modified,
16764
+ devStoryFilesModified: workflowResult.files_modified,
16765
+ devStoryAcFailures: ["build-verification"]
16766
+ }
16767
+ };
16768
+ return outcome;
16769
+ }
16770
+ }
16744
16771
  }
16745
- };
16746
- else {
16772
+ outcome = {
16773
+ status: "SUCCESS",
16774
+ contextUpdates: {
16775
+ filesModified: workflowResult.files_modified,
16776
+ acMet: workflowResult.ac_met,
16777
+ devStoryFilesModified: workflowResult.files_modified
16778
+ }
16779
+ };
16780
+ } else {
16747
16781
  const failureReason = workflowResult.error ?? (workflowResult.ac_failures.length > 0 ? `dev-story failed ACs: ${workflowResult.ac_failures.join(", ")}` : "dev-story workflow failed");
16748
16782
  outcome = {
16749
16783
  status: "FAILURE",
@@ -16973,12 +17007,12 @@ function createSdlcEventBridge(opts) {
16973
17007
  });
16974
17008
  };
16975
17009
  const onGoalGateUnsatisfied = (data) => {
16976
- const { nodeId } = data;
16977
- if (nodeId === "dev_story") sdlcBus.emit("orchestrator:story-escalated", {
17010
+ const evt = data;
17011
+ if (evt.nodeId === "dev_story") sdlcBus.emit("orchestrator:story-escalated", {
16978
17012
  storyKey,
16979
- lastVerdict: "NEEDS_MAJOR_REWORK",
16980
- reviewCycles: devStoryRetries,
16981
- issues: []
17013
+ lastVerdict: evt.lastVerdict ?? "NEEDS_MAJOR_REWORK",
17014
+ reviewCycles: evt.reviewCycles ?? devStoryRetries,
17015
+ issues: evt.issues ?? []
16982
17016
  });
16983
17017
  };
16984
17018
  graphEvents.on("graph:node-started", onNodeStarted);
@@ -17041,6 +17075,10 @@ function createGraphOrchestrator(config) {
17041
17075
  sdlcBus: config.eventBus,
17042
17076
  graphEvents: factoryBus
17043
17077
  }) : void 0;
17078
+ let escalated = false;
17079
+ factoryBus.on("graph:goal-gate-unsatisfied", () => {
17080
+ escalated = true;
17081
+ });
17044
17082
  let result;
17045
17083
  try {
17046
17084
  result = await config.executor.run(config.graph, {
@@ -17053,7 +17091,7 @@ function createGraphOrchestrator(config) {
17053
17091
  } catch (err) {
17054
17092
  const errMsg = err instanceof Error ? err.message : String(err);
17055
17093
  summary.stories[storyKey] = {
17056
- outcome: "FAILED",
17094
+ outcome: escalated ? "ESCALATED" : "FAILED",
17057
17095
  error: errMsg
17058
17096
  };
17059
17097
  summary.f++;
@@ -17064,6 +17102,9 @@ function createGraphOrchestrator(config) {
17064
17102
  if (result.status === "SUCCESS") {
17065
17103
  summary.stories[storyKey] = { outcome: "SUCCESS" };
17066
17104
  summary.s++;
17105
+ } else if (escalated) {
17106
+ summary.stories[storyKey] = { outcome: "ESCALATED" };
17107
+ summary.f++;
17067
17108
  } else {
17068
17109
  summary.stories[storyKey] = { outcome: "FAILED" };
17069
17110
  summary.f++;
@@ -28691,7 +28732,12 @@ async function runRunAction(options) {
28691
28732
  devStoryOptions: {
28692
28733
  deps: workflowDeps,
28693
28734
  eventBus: sdlcEventBus,
28694
- runDevStory
28735
+ runDevStory,
28736
+ buildVerifier: (root) => runBuildVerification({
28737
+ verifyCommand: pack.manifest.verifyCommand,
28738
+ verifyTimeoutMs: pack.manifest.verifyTimeoutMs,
28739
+ projectRoot: root
28740
+ })
28695
28741
  },
28696
28742
  codeReviewOptions: {
28697
28743
  deps: workflowDeps,
@@ -29293,5 +29339,5 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
29293
29339
  }
29294
29340
 
29295
29341
  //#endregion
29296
- export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
29297
- //# sourceMappingURL=run-zWACyS3w.js.map
29342
+ export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, normalizeGraphSummaryToStatus, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
29343
+ //# sourceMappingURL=run-DDUeFC-I.js.map
package/dist/schema.sql CHANGED
@@ -274,6 +274,11 @@ CREATE TABLE IF NOT EXISTS story_dependencies (
274
274
  PRIMARY KEY (story_key, depends_on)
275
275
  );
276
276
 
277
+ -- Migration: add created_at to story_dependencies (added in v0.12.0)
278
+ SET @_sd_created_at_exists = (SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'story_dependencies' AND COLUMN_NAME = 'created_at');
279
+ SET @_sql = IF(@_sd_created_at_exists = 0, 'ALTER TABLE story_dependencies ADD COLUMN created_at DATETIME DEFAULT NULL', 'SELECT 1');
280
+ PREPARE _add_col FROM @_sql; EXECUTE _add_col; DEALLOCATE PREPARE _add_col;
281
+
277
282
  -- ---------------------------------------------------------------------------
278
283
  -- ready_stories view (Epic 31-1)
279
284
  -- ---------------------------------------------------------------------------
@@ -1,5 +1,5 @@
1
- import "./dist-DKG5lyUw.js";
1
+ import "./dist-CLvAwmT7.js";
2
2
  import "./version-manager-impl-BmOWu8ml.js";
3
- import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-CBE6JaxX.js";
3
+ import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-DT0I_-1E.js";
4
4
 
5
5
  export { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand };
@@ -1,4 +1,4 @@
1
- import { createVersionManager } from "./dist-DKG5lyUw.js";
1
+ import { createVersionManager } from "./dist-CLvAwmT7.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-CBE6JaxX.js.map
126
+ //# sourceMappingURL=upgrade-DT0I_-1E.js.map
@@ -1,4 +1,4 @@
1
- import { VersionManagerImpl, createVersionManager } from "./dist-DKG5lyUw.js";
1
+ import { VersionManagerImpl, createVersionManager } from "./dist-CLvAwmT7.js";
2
2
  import "./version-manager-impl-BmOWu8ml.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.13.0",
3
+ "version": "0.13.1",
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-DKG5lyUw.js";
2
- import "./adapter-registry-DXLMTmfD.js";
3
-
4
- export { AdapterRegistry };
@@ -1,9 +0,0 @@
1
- import "./health-BR5GD5Ge.js";
2
- import "./logger-KeHncl-f.js";
3
- import "./helpers-CElYrONe.js";
4
- import "./dist-DKG5lyUw.js";
5
- import { registerRunCommand, runRunAction } from "./run-zWACyS3w.js";
6
- import "./routing-CcBOCuC9.js";
7
- import "./decisions-C0pz9Clx.js";
8
-
9
- export { runRunAction };