substrate-ai 0.20.95 → 0.20.96

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-Wnxr9Iv7.js";
2
+ import "./adapter-registry-DIcrxjH8.js";
3
+
4
+ export { AdapterRegistry };
package/dist/cli/index.js CHANGED
@@ -1,20 +1,20 @@
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-CzZ2Ki-b.js";
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-BxmI1iiM.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, 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, swallowDebug, tagRunAsBaseline, updatePipelineRun } from "../dist-C_NE40jY.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-COnbF6By.js";
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, swallowDebug, tagRunAsBaseline, updatePipelineRun } from "../dist-Wnxr9Iv7.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-alLrJMOI.js";
7
7
  import "../adapter-registry-DIcrxjH8.js";
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-BSsjVG96.js";
9
- import "../errors-D531Z8FW.js";
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-BQ0o-M0u.js";
9
+ import "../errors-B7lyO1vu.js";
10
10
  import "../routing-DFxoKHDt.js";
11
11
  import { WorkGraphRepository } from "../work-graph-repository-DZyJv5pV.js";
12
12
  import "../decisions-CzSIEeGP.js";
13
13
  import "../decision-router-DblHY8se.js";
14
- import "../interactive-prompt-DF-PL5ia.js";
14
+ import "../interactive-prompt-B92MvP8c.js";
15
15
  import "../recovery-engine-BKGBeBnW.js";
16
16
  import "../version-manager-impl-qFBiO4Eh.js";
17
- import { registerUpgradeCommand } from "../upgrade-C1KzAZQE.js";
17
+ import { registerUpgradeCommand } from "../upgrade-Cm0n0duM.js";
18
18
  import { Command } from "commander";
19
19
  import { fileURLToPath } from "url";
20
20
  import { dirname, join, resolve } from "path";
@@ -6887,7 +6887,7 @@ async function runStatusAction(options) {
6887
6887
  logger$15.debug({ err }, "Work graph query failed, continuing without work graph data");
6888
6888
  }
6889
6889
  if (run === void 0) {
6890
- const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-C0bSSccV.js");
6890
+ const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-9KV5kVc6.js");
6891
6891
  const substrateDirPath = join(projectRoot, ".substrate");
6892
6892
  const processInfo = inspectProcessTree$1({
6893
6893
  projectRoot,
@@ -7835,7 +7835,7 @@ function defaultSupervisorDeps() {
7835
7835
  if (cached === null) {
7836
7836
  const { AdapterRegistry: AR } = await import(
7837
7837
  /* @vite-ignore */
7838
- "../adapter-registry-Bvox1eRm.js"
7838
+ "../adapter-registry-vPF5Y1yp.js"
7839
7839
  );
7840
7840
  cached = new AR();
7841
7841
  await cached.discoverAndRegister();
@@ -8402,11 +8402,11 @@ async function runSupervisorAction(options, deps = {}) {
8402
8402
  try {
8403
8403
  const { createExperimenter } = await import(
8404
8404
  /* @vite-ignore */
8405
- "../experimenter-Cg2fBeVq.js"
8405
+ "../experimenter-CUgfDVXi.js"
8406
8406
  );
8407
8407
  const { getLatestRun: getLatest } = await import(
8408
8408
  /* @vite-ignore */
8409
- "../decisions-CNe9RlcE.js"
8409
+ "../decisions-x2lbWuTV.js"
8410
8410
  );
8411
8411
  const expAdapter = createDatabaseAdapter({
8412
8412
  backend: "auto",
@@ -8416,7 +8416,7 @@ async function runSupervisorAction(options, deps = {}) {
8416
8416
  await initSchema(expAdapter);
8417
8417
  const { runRunAction: runPipeline } = await import(
8418
8418
  /* @vite-ignore */
8419
- "../run-Bmrjp1QI.js"
8419
+ "../run-5iG8suoO.js"
8420
8420
  );
8421
8421
  const runStoryFn = async (opts) => {
8422
8422
  const exitCode = await runPipeline({
@@ -8944,7 +8944,7 @@ async function runMetricsAction(options) {
8944
8944
  const routingConfigPath = join(dbDir, "routing.yml");
8945
8945
  let routingConfig = null;
8946
8946
  if (existsSync$1(routingConfigPath)) try {
8947
- const { loadModelRoutingConfig } = await import("../routing-Cptl6Ali.js");
8947
+ const { loadModelRoutingConfig } = await import("../routing-Ih1er-pc.js");
8948
8948
  routingConfig = loadModelRoutingConfig(routingConfigPath);
8949
8949
  } catch {}
8950
8950
  if (routingConfig === null) routingConfig = {
@@ -11959,10 +11959,18 @@ function registerRoutingCommand(program) {
11959
11959
  //#endregion
11960
11960
  //#region src/modules/work-graph/schema.ts
11961
11961
  /**
11962
- * Work-graph schema DDL constants.
11962
+ * Work-graph schema — legacy DDL constant exports.
11963
11963
  *
11964
- * Aligned with the authoritative schema in src/modules/state/schema.sql.
11965
- * Table names use `wg_stories` and `story_dependencies`.
11964
+ * The canonical DDL lives in packages/core/src/persistence/work-graph-schema.ts
11965
+ * as `initWorkGraphSchema(adapter)`. This file is preserved as a thin shim
11966
+ * so the existing callers in `ingest-epic.ts` and `epic-status.ts` keep
11967
+ * working — they `await adapter.exec(CREATE_STORIES_TABLE)` directly rather
11968
+ * than invoking the function form.
11969
+ *
11970
+ * Post-Ship-5 (2026-05): the legacy constants here MUST stay in sync with
11971
+ * the function form in @substrate-ai/core. Future ports should consider
11972
+ * migrating callers to `initWorkGraphSchema(adapter)` and deleting this file
11973
+ * entirely.
11966
11974
  */
11967
11975
  const CREATE_STORIES_TABLE = `
11968
11976
  CREATE TABLE IF NOT EXISTS wg_stories (
@@ -13318,8 +13326,8 @@ async function createProgram() {
13318
13326
  /** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
13319
13327
  function checkForUpdatesInBackground(currentVersion) {
13320
13328
  if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
13321
- import("../upgrade--vRnNB3V.js").then(async () => {
13322
- const { createVersionManager } = await import("../version-manager-impl-9J_JCJPu.js");
13329
+ import("../upgrade-BjTy8F3p.js").then(async () => {
13330
+ const { createVersionManager } = await import("../version-manager-impl-C27Gxmkt.js");
13323
13331
  const vm = createVersionManager();
13324
13332
  const result = await vm.checkForUpdates();
13325
13333
  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-C_NE40jY.js";
1
+ import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-Wnxr9Iv7.js";
2
2
  import "./decisions-CzSIEeGP.js";
3
3
 
4
4
  export { getLatestRun };
@@ -2569,31 +2569,19 @@ function createDatabaseAdapter(config = { backend: "auto" }, doltClientFactory)
2569
2569
  }
2570
2570
 
2571
2571
  //#endregion
2572
- //#region packages/core/dist/persistence/schema.js
2572
+ //#region packages/core/dist/persistence/core-schema.js
2573
2573
  /**
2574
- * Consolidated schema DDL for all persistence tables.
2575
- *
2576
- * Replaces the 11 separate SQLite migration files with a single
2577
- * async function that creates all tables via DatabaseAdapter.
2574
+ * Core schema orchestrator session/task execution model.
2578
2575
  *
2579
- * All tables use CREATE TABLE IF NOT EXISTS for idempotency.
2580
- * Indexes and views use IF NOT EXISTS.
2576
+ * Owns: sessions, tasks, task_dependencies, execution_log, cost_entries,
2577
+ * session_signals, plans, plan_versions, schema_migrations + ready_tasks view
2578
+ * + session_cost_summary view.
2581
2579
  *
2582
- * Schema covers:
2583
- * - Core: sessions, tasks, task_dependencies, execution_log
2584
- * - Cost: cost_entries
2585
- * - Pipeline: pipeline_runs, decisions, requirements, constraints, artifacts, token_usage
2586
- * - Plans: plans, plan_versions
2587
- * - Signals: session_signals
2588
- * - Metrics: run_metrics, story_metrics
2589
- * - Monitor: task_metrics, performance_aggregates, routing_recommendations
2590
- * - Telemetry: turn_analysis, efficiency_scores, recommendations, category_stats, consumer_stats
2591
- */
2592
- /**
2593
- * Initialize all persistence tables on the given adapter.
2594
- * Idempotent — safe to call multiple times.
2580
+ * Extracted from `schema.ts` in Ship 5 (2026-05). DDL preserved byte-for-byte
2581
+ * from the pre-split version any column/type/default change must be a
2582
+ * deliberate migration, not an accidental drift.
2595
2583
  */
2596
- async function initSchema(adapter) {
2584
+ async function initCoreSchema(adapter) {
2597
2585
  await adapter.exec(`
2598
2586
  CREATE TABLE IF NOT EXISTS sessions (
2599
2587
  id VARCHAR(255) PRIMARY KEY,
@@ -2743,6 +2731,66 @@ async function initSchema(adapter) {
2743
2731
  `);
2744
2732
  await adapter.exec("CREATE INDEX IF NOT EXISTS idx_plan_versions_plan_id ON plan_versions(plan_id)");
2745
2733
  await adapter.exec(`
2734
+ CREATE TABLE IF NOT EXISTS schema_migrations (
2735
+ version INTEGER PRIMARY KEY,
2736
+ name TEXT NOT NULL,
2737
+ applied_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
2738
+ )
2739
+ `);
2740
+ }
2741
+ /**
2742
+ * Initialize the views that depend on core tables (`tasks`, `task_dependencies`,
2743
+ * `sessions`). Must be called AFTER `initCoreSchema` (defines the tables).
2744
+ *
2745
+ * NOTE: Views use JOINs/aggregation. Dolt supports them; InMemoryDatabaseAdapter
2746
+ * silently no-ops `CREATE VIEW`, so the same DDL works on both backends without
2747
+ * a try/catch wrapper.
2748
+ */
2749
+ async function initCoreViews(adapter) {
2750
+ await adapter.exec(`
2751
+ CREATE VIEW IF NOT EXISTS ready_tasks AS
2752
+ SELECT t.* FROM tasks t
2753
+ WHERE t.status = 'pending'
2754
+ AND NOT EXISTS (
2755
+ SELECT 1 FROM task_dependencies td
2756
+ JOIN tasks dep ON dep.id = td.depends_on
2757
+ WHERE td.task_id = t.id
2758
+ AND dep.status NOT IN ('completed', 'cancelled')
2759
+ )
2760
+ `);
2761
+ await adapter.exec(`
2762
+ CREATE VIEW IF NOT EXISTS session_cost_summary AS
2763
+ SELECT
2764
+ s.id AS session_id,
2765
+ s.name AS session_name,
2766
+ COUNT(DISTINCT t.id) AS total_tasks,
2767
+ SUM(CASE WHEN t.status = 'completed' THEN 1 ELSE 0 END) AS completed_tasks,
2768
+ SUM(CASE WHEN t.status = 'failed' THEN 1 ELSE 0 END) AS failed_tasks,
2769
+ SUM(CASE WHEN t.status = 'running' THEN 1 ELSE 0 END) AS running_tasks,
2770
+ COALESCE(SUM(t.cost_usd), 0) AS total_cost_usd,
2771
+ SUM(CASE WHEN t.billing_mode = 'subscription' THEN t.cost_usd ELSE 0 END) AS subscription_cost_usd,
2772
+ SUM(CASE WHEN t.billing_mode = 'api' THEN t.cost_usd ELSE 0 END) AS api_cost_usd,
2773
+ s.planning_cost_usd
2774
+ FROM sessions s
2775
+ LEFT JOIN tasks t ON t.session_id = s.id
2776
+ GROUP BY s.id
2777
+ `);
2778
+ }
2779
+
2780
+ //#endregion
2781
+ //#region packages/core/dist/persistence/pipeline-schema.js
2782
+ /**
2783
+ * Pipeline schema — pipeline-run state and metrics.
2784
+ *
2785
+ * Owns: pipeline_runs, decisions, requirements, constraints, artifacts,
2786
+ * token_usage, run_metrics, story_metrics + the mesh-telemetry ALTER for
2787
+ * story_metrics.agent/model/dispatch columns.
2788
+ *
2789
+ * Extracted from `schema.ts` in Ship 5 (2026-05). DDL preserved byte-for-byte
2790
+ * from the pre-split version.
2791
+ */
2792
+ async function initPipelineSchema(adapter) {
2793
+ await adapter.exec(`
2746
2794
  CREATE TABLE IF NOT EXISTS pipeline_runs (
2747
2795
  id VARCHAR(255) PRIMARY KEY,
2748
2796
  methodology VARCHAR(128) NOT NULL,
@@ -2876,6 +2924,23 @@ async function initSchema(adapter) {
2876
2924
  ]) try {
2877
2925
  await adapter.exec(`ALTER TABLE story_metrics ADD COLUMN ${col}`);
2878
2926
  } catch {}
2927
+ }
2928
+
2929
+ //#endregion
2930
+ //#region packages/core/dist/persistence/monitor-schema.js
2931
+ /**
2932
+ * Monitor schema — task-level metrics + routing recommendations.
2933
+ *
2934
+ * Owns: task_metrics, performance_aggregates, routing_recommendations.
2935
+ *
2936
+ * Note: these same tables are ALSO defined by `monitor-database.ts` for a
2937
+ * SEPARATE database (`.substrate/monitor.db`). That instance is managed
2938
+ * independently via the synchronous SyncAdapter API; the DDL here applies
2939
+ * to the main persistence DB only.
2940
+ *
2941
+ * Extracted from `schema.ts` in Ship 5 (2026-05). DDL preserved byte-for-byte.
2942
+ */
2943
+ async function initMonitorSchema(adapter) {
2879
2944
  await adapter.exec(`
2880
2945
  CREATE TABLE IF NOT EXISTS task_metrics (
2881
2946
  task_id VARCHAR(255) NOT NULL,
@@ -2927,6 +2992,178 @@ async function initSchema(adapter) {
2927
2992
  expires_at TEXT
2928
2993
  )
2929
2994
  `);
2995
+ }
2996
+
2997
+ //#endregion
2998
+ //#region packages/core/dist/persistence/state-schema.js
2999
+ /**
3000
+ * Legacy state schema — pre-2026-Q1 orchestrator state tables.
3001
+ *
3002
+ * Owns: stories, contracts, metrics, dispatch_log, build_results,
3003
+ * review_verdicts, _schema_version + the 9 INSERT IGNORE seed rows.
3004
+ *
3005
+ * Empirical status: these tables had ZERO rows in every audited production
3006
+ * project (ynab, quant). The orchestrator wires `FileStateStore` (in-memory),
3007
+ * not DoltStateStore — so the write code paths that target these tables never
3008
+ * fired in production. Ship 1 excised the corresponding DoltStateStore CRUD
3009
+ * methods; Ship 3 ported the DDL out of schema.sql into initSchema; Ship 5
3010
+ * (this module) moves them to a dedicated file.
3011
+ *
3012
+ * Ship 7 will decide their final fate (keep, delete, or repurpose).
3013
+ */
3014
+ async function initStateSchema(adapter) {
3015
+ await adapter.exec(`
3016
+ CREATE TABLE IF NOT EXISTS stories (
3017
+ story_key VARCHAR(100) NOT NULL,
3018
+ sprint VARCHAR(50),
3019
+ status VARCHAR(30) NOT NULL DEFAULT 'PENDING',
3020
+ phase VARCHAR(30) NOT NULL DEFAULT 'PENDING',
3021
+ ac_results JSON,
3022
+ error_message TEXT,
3023
+ created_at DATETIME,
3024
+ updated_at DATETIME,
3025
+ completed_at DATETIME,
3026
+ PRIMARY KEY (story_key)
3027
+ )
3028
+ `);
3029
+ await adapter.exec(`
3030
+ CREATE TABLE IF NOT EXISTS contracts (
3031
+ story_key VARCHAR(100) NOT NULL,
3032
+ name VARCHAR(200) NOT NULL,
3033
+ direction VARCHAR(20) NOT NULL,
3034
+ schema_path VARCHAR(500),
3035
+ transport VARCHAR(200),
3036
+ recorded_at DATETIME,
3037
+ PRIMARY KEY (story_key, name, direction)
3038
+ )
3039
+ `);
3040
+ await adapter.exec(`
3041
+ CREATE TABLE IF NOT EXISTS metrics (
3042
+ story_key VARCHAR(100) NOT NULL,
3043
+ task_type VARCHAR(100) NOT NULL,
3044
+ recorded_at DATETIME NOT NULL,
3045
+ model VARCHAR(100),
3046
+ tokens_in BIGINT NOT NULL DEFAULT 0,
3047
+ tokens_out BIGINT NOT NULL DEFAULT 0,
3048
+ cache_read_tokens BIGINT NOT NULL DEFAULT 0,
3049
+ cost_usd DECIMAL(10,6) NOT NULL DEFAULT 0,
3050
+ wall_clock_ms BIGINT NOT NULL DEFAULT 0,
3051
+ review_cycles INT NOT NULL DEFAULT 0,
3052
+ stall_count INT NOT NULL DEFAULT 0,
3053
+ result VARCHAR(30),
3054
+ PRIMARY KEY (story_key, task_type, recorded_at)
3055
+ )
3056
+ `);
3057
+ await adapter.exec(`
3058
+ CREATE TABLE IF NOT EXISTS dispatch_log (
3059
+ story_key VARCHAR(100) NOT NULL,
3060
+ dispatched_at DATETIME NOT NULL,
3061
+ branch VARCHAR(200),
3062
+ worker_id VARCHAR(100),
3063
+ result VARCHAR(30),
3064
+ PRIMARY KEY (story_key, dispatched_at)
3065
+ )
3066
+ `);
3067
+ await adapter.exec(`
3068
+ CREATE TABLE IF NOT EXISTS build_results (
3069
+ story_key VARCHAR(100) NOT NULL,
3070
+ timestamp DATETIME NOT NULL,
3071
+ command VARCHAR(500),
3072
+ exit_code INT,
3073
+ stdout_hash VARCHAR(64),
3074
+ PRIMARY KEY (story_key, timestamp)
3075
+ )
3076
+ `);
3077
+ await adapter.exec(`
3078
+ CREATE TABLE IF NOT EXISTS review_verdicts (
3079
+ story_key VARCHAR(100) NOT NULL,
3080
+ timestamp DATETIME NOT NULL,
3081
+ verdict VARCHAR(30),
3082
+ issues_count INT NOT NULL DEFAULT 0,
3083
+ notes TEXT,
3084
+ PRIMARY KEY (story_key, timestamp)
3085
+ )
3086
+ `);
3087
+ await adapter.exec(`
3088
+ CREATE TABLE IF NOT EXISTS _schema_version (
3089
+ version INT NOT NULL,
3090
+ applied_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
3091
+ description VARCHAR(500),
3092
+ PRIMARY KEY (version)
3093
+ )
3094
+ `);
3095
+ const seeds = [
3096
+ [1, "Initial substrate state schema"],
3097
+ [2, "Add turn_analysis table (Epic 27-4)"],
3098
+ [3, "Add category_stats and consumer_stats tables (Epic 27-5)"],
3099
+ [4, "Add recommendations table (Epic 27-7)"],
3100
+ [5, "Add repo_map_symbols and repo_map_meta tables (Epic 28-2)"],
3101
+ [6, "Add dependencies JSON column to repo_map_symbols (Epic 28-3)"],
3102
+ [7, "Add wg_stories, story_dependencies tables and ready_stories view (Epic 31-1)"],
3103
+ [8, "Add task_type, phase, dispatch_id columns to turn_analysis (Story 30-1)"],
3104
+ [9, "Add dispatch_id, task_type, phase columns to efficiency_scores (Story 30-3)"]
3105
+ ];
3106
+ for (const [version, description] of seeds) try {
3107
+ await adapter.exec(`INSERT IGNORE INTO _schema_version (version, description) VALUES (${version}, '${description.replace(/'/g, "''")}')`);
3108
+ } catch {}
3109
+ }
3110
+
3111
+ //#endregion
3112
+ //#region packages/core/dist/persistence/repo-map-schema.js
3113
+ /**
3114
+ * Repo-map schema — code-symbol index used by the context-engineering layer.
3115
+ *
3116
+ * Owns: repo_map_symbols, repo_map_meta + their indexes.
3117
+ *
3118
+ * Consumed by `src/modules/repo-map/storage.ts` (~10 query sites). Production
3119
+ * runtime DDL was previously in `dolt-store.ts._runMigrations` (the v5→v6
3120
+ * dependencies-column ALTER, which still runs there for repos predating
3121
+ * v0.20.94 — Ship 3 ported the CREATE TABLE here from schema.sql).
3122
+ *
3123
+ * Extracted from `schema.ts` in Ship 5 (2026-05).
3124
+ */
3125
+ async function initRepoMapSchema(adapter) {
3126
+ await adapter.exec(`
3127
+ CREATE TABLE IF NOT EXISTS repo_map_symbols (
3128
+ id BIGINT AUTO_INCREMENT NOT NULL,
3129
+ file_path VARCHAR(1000) NOT NULL,
3130
+ symbol_name VARCHAR(500) NOT NULL,
3131
+ symbol_kind VARCHAR(20) NOT NULL,
3132
+ signature TEXT,
3133
+ line_number INT NOT NULL DEFAULT 0,
3134
+ exported TINYINT(1) NOT NULL DEFAULT 0,
3135
+ file_hash VARCHAR(64) NOT NULL,
3136
+ dependencies JSON,
3137
+ PRIMARY KEY (id)
3138
+ )
3139
+ `);
3140
+ await adapter.exec("CREATE INDEX IF NOT EXISTS idx_repo_map_symbols_file ON repo_map_symbols (file_path)");
3141
+ await adapter.exec("CREATE INDEX IF NOT EXISTS idx_repo_map_symbols_kind ON repo_map_symbols (symbol_kind)");
3142
+ await adapter.exec(`
3143
+ CREATE TABLE IF NOT EXISTS repo_map_meta (
3144
+ id INT NOT NULL DEFAULT 1,
3145
+ commit_sha VARCHAR(64),
3146
+ updated_at DATETIME,
3147
+ file_count INT NOT NULL DEFAULT 0,
3148
+ PRIMARY KEY (id)
3149
+ )
3150
+ `);
3151
+ }
3152
+
3153
+ //#endregion
3154
+ //#region packages/core/dist/persistence/telemetry-schema.js
3155
+ /**
3156
+ * Telemetry schema — per-turn analysis + efficiency scoring + recommendations.
3157
+ *
3158
+ * Owns: turn_analysis, efficiency_scores, recommendations, category_stats,
3159
+ * consumer_stats + their indexes + the Story 30-1/30-3 ALTER migrations
3160
+ * (task_type/phase/dispatch_id columns on turn_analysis and efficiency_scores).
3161
+ *
3162
+ * Extracted from `schema.ts` in Ship 5 (2026-05). Pre-Ship-4 these tables had
3163
+ * DDL in 3 places (schema.sql, schema.ts, adapter-persistence.ts). Ship 4
3164
+ * consolidated to schema.ts; Ship 5 moves them to this dedicated module.
3165
+ */
3166
+ async function initTelemetrySchema(adapter) {
2930
3167
  await adapter.exec(`
2931
3168
  CREATE TABLE IF NOT EXISTS turn_analysis (
2932
3169
  story_key VARCHAR(64) NOT NULL,
@@ -2982,6 +3219,7 @@ async function initSchema(adapter) {
2982
3219
  PRIMARY KEY (story_key, timestamp)
2983
3220
  )
2984
3221
  `);
3222
+ await adapter.exec("CREATE INDEX IF NOT EXISTS idx_efficiency_story ON efficiency_scores (story_key, timestamp DESC)");
2985
3223
  for (const col of [
2986
3224
  "dispatch_id",
2987
3225
  "task_type",
@@ -3005,6 +3243,7 @@ async function initSchema(adapter) {
3005
3243
  PRIMARY KEY (id)
3006
3244
  )
3007
3245
  `);
3246
+ await adapter.exec("CREATE INDEX IF NOT EXISTS idx_recommendations_story ON recommendations (story_key, severity)");
3008
3247
  await adapter.exec(`
3009
3248
  CREATE TABLE IF NOT EXISTS category_stats (
3010
3249
  story_key VARCHAR(100) NOT NULL,
@@ -3017,6 +3256,7 @@ async function initSchema(adapter) {
3017
3256
  PRIMARY KEY (story_key, category)
3018
3257
  )
3019
3258
  `);
3259
+ await adapter.exec("CREATE INDEX IF NOT EXISTS idx_category_stats_story ON category_stats (story_key, total_tokens)");
3020
3260
  await adapter.exec(`
3021
3261
  CREATE TABLE IF NOT EXISTS consumer_stats (
3022
3262
  story_key VARCHAR(100) NOT NULL,
@@ -3029,6 +3269,30 @@ async function initSchema(adapter) {
3029
3269
  PRIMARY KEY (story_key, consumer_key)
3030
3270
  )
3031
3271
  `);
3272
+ await adapter.exec("CREATE INDEX IF NOT EXISTS idx_consumer_stats_story ON consumer_stats (story_key, total_tokens)");
3273
+ }
3274
+
3275
+ //#endregion
3276
+ //#region packages/core/dist/persistence/work-graph-schema.js
3277
+ /**
3278
+ * Work-graph schema — planning-level story nodes + dependencies + ready view.
3279
+ *
3280
+ * Owns: wg_stories, story_dependencies, ready_stories (view) + the v0.12.0
3281
+ * `created_at` idempotent ALTER migration.
3282
+ *
3283
+ * Extracted from `schema.ts` in Ship 5 (2026-05). Previously the schema lived
3284
+ * in BOTH `packages/core/src/persistence/schema.ts` (initSchema) AND
3285
+ * `src/modules/work-graph/schema.ts` (exported DDL constants). Ship 5
3286
+ * consolidates to this single module; the legacy constants file is now a
3287
+ * thin re-export shim.
3288
+ *
3289
+ * Composition root in initSchema MUST call this AFTER all dependent tables
3290
+ * exist (currently no dependencies — wg_stories and story_dependencies are
3291
+ * standalone). The `ready_stories` view depends on wg_stories +
3292
+ * story_dependencies, both created in this module, so the function is
3293
+ * fully self-contained.
3294
+ */
3295
+ async function initWorkGraphSchema(adapter) {
3032
3296
  await adapter.exec(`
3033
3297
  CREATE TABLE IF NOT EXISTS wg_stories (
3034
3298
  story_key VARCHAR(20) NOT NULL,
@@ -3068,177 +3332,23 @@ async function initSchema(adapter) {
3068
3332
  AND dep.status <> 'complete'
3069
3333
  )
3070
3334
  `);
3071
- await adapter.exec(`
3072
- CREATE VIEW IF NOT EXISTS ready_tasks AS
3073
- SELECT t.* FROM tasks t
3074
- WHERE t.status = 'pending'
3075
- AND NOT EXISTS (
3076
- SELECT 1 FROM task_dependencies td
3077
- JOIN tasks dep ON dep.id = td.depends_on
3078
- WHERE td.task_id = t.id
3079
- AND dep.status NOT IN ('completed', 'cancelled')
3080
- )
3081
- `);
3082
- await adapter.exec(`
3083
- CREATE VIEW IF NOT EXISTS session_cost_summary AS
3084
- SELECT
3085
- s.id AS session_id,
3086
- s.name AS session_name,
3087
- COUNT(DISTINCT t.id) AS total_tasks,
3088
- SUM(CASE WHEN t.status = 'completed' THEN 1 ELSE 0 END) AS completed_tasks,
3089
- SUM(CASE WHEN t.status = 'failed' THEN 1 ELSE 0 END) AS failed_tasks,
3090
- SUM(CASE WHEN t.status = 'running' THEN 1 ELSE 0 END) AS running_tasks,
3091
- COALESCE(SUM(t.cost_usd), 0) AS total_cost_usd,
3092
- SUM(CASE WHEN t.billing_mode = 'subscription' THEN t.cost_usd ELSE 0 END) AS subscription_cost_usd,
3093
- SUM(CASE WHEN t.billing_mode = 'api' THEN t.cost_usd ELSE 0 END) AS api_cost_usd,
3094
- s.planning_cost_usd
3095
- FROM sessions s
3096
- LEFT JOIN tasks t ON t.session_id = s.id
3097
- GROUP BY s.id
3098
- `);
3099
- await adapter.exec(`
3100
- CREATE TABLE IF NOT EXISTS schema_migrations (
3101
- version INTEGER PRIMARY KEY,
3102
- name TEXT NOT NULL,
3103
- applied_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
3104
- )
3105
- `);
3106
- await adapter.exec(`
3107
- CREATE TABLE IF NOT EXISTS stories (
3108
- story_key VARCHAR(100) NOT NULL,
3109
- sprint VARCHAR(50),
3110
- status VARCHAR(30) NOT NULL DEFAULT 'PENDING',
3111
- phase VARCHAR(30) NOT NULL DEFAULT 'PENDING',
3112
- ac_results JSON,
3113
- error_message TEXT,
3114
- created_at DATETIME,
3115
- updated_at DATETIME,
3116
- completed_at DATETIME,
3117
- PRIMARY KEY (story_key)
3118
- )
3119
- `);
3120
- await adapter.exec(`
3121
- CREATE TABLE IF NOT EXISTS contracts (
3122
- story_key VARCHAR(100) NOT NULL,
3123
- name VARCHAR(200) NOT NULL,
3124
- direction VARCHAR(20) NOT NULL,
3125
- schema_path VARCHAR(500),
3126
- transport VARCHAR(200),
3127
- recorded_at DATETIME,
3128
- PRIMARY KEY (story_key, name, direction)
3129
- )
3130
- `);
3131
- await adapter.exec(`
3132
- CREATE TABLE IF NOT EXISTS metrics (
3133
- story_key VARCHAR(100) NOT NULL,
3134
- task_type VARCHAR(100) NOT NULL,
3135
- recorded_at DATETIME NOT NULL,
3136
- model VARCHAR(100),
3137
- tokens_in BIGINT NOT NULL DEFAULT 0,
3138
- tokens_out BIGINT NOT NULL DEFAULT 0,
3139
- cache_read_tokens BIGINT NOT NULL DEFAULT 0,
3140
- cost_usd DECIMAL(10,6) NOT NULL DEFAULT 0,
3141
- wall_clock_ms BIGINT NOT NULL DEFAULT 0,
3142
- review_cycles INT NOT NULL DEFAULT 0,
3143
- stall_count INT NOT NULL DEFAULT 0,
3144
- result VARCHAR(30),
3145
- PRIMARY KEY (story_key, task_type, recorded_at)
3146
- )
3147
- `);
3148
- await adapter.exec(`
3149
- CREATE TABLE IF NOT EXISTS dispatch_log (
3150
- story_key VARCHAR(100) NOT NULL,
3151
- dispatched_at DATETIME NOT NULL,
3152
- branch VARCHAR(200),
3153
- worker_id VARCHAR(100),
3154
- result VARCHAR(30),
3155
- PRIMARY KEY (story_key, dispatched_at)
3156
- )
3157
- `);
3158
- await adapter.exec(`
3159
- CREATE TABLE IF NOT EXISTS build_results (
3160
- story_key VARCHAR(100) NOT NULL,
3161
- timestamp DATETIME NOT NULL,
3162
- command VARCHAR(500),
3163
- exit_code INT,
3164
- stdout_hash VARCHAR(64),
3165
- PRIMARY KEY (story_key, timestamp)
3166
- )
3167
- `);
3168
- await adapter.exec(`
3169
- CREATE TABLE IF NOT EXISTS review_verdicts (
3170
- story_key VARCHAR(100) NOT NULL,
3171
- timestamp DATETIME NOT NULL,
3172
- verdict VARCHAR(30),
3173
- issues_count INT NOT NULL DEFAULT 0,
3174
- notes TEXT,
3175
- PRIMARY KEY (story_key, timestamp)
3176
- )
3177
- `);
3178
- await adapter.exec(`
3179
- CREATE TABLE IF NOT EXISTS _schema_version (
3180
- version INT NOT NULL,
3181
- applied_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
3182
- description VARCHAR(500),
3183
- PRIMARY KEY (version)
3184
- )
3185
- `);
3186
- try {
3187
- await adapter.exec(`INSERT IGNORE INTO _schema_version (version, description) VALUES (1, 'Initial substrate state schema')`);
3188
- } catch {}
3189
- try {
3190
- await adapter.exec(`INSERT IGNORE INTO _schema_version (version, description) VALUES (2, 'Add turn_analysis table (Epic 27-4)')`);
3191
- } catch {}
3192
- try {
3193
- await adapter.exec(`INSERT IGNORE INTO _schema_version (version, description) VALUES (3, 'Add category_stats and consumer_stats tables (Epic 27-5)')`);
3194
- } catch {}
3195
- try {
3196
- await adapter.exec(`INSERT IGNORE INTO _schema_version (version, description) VALUES (4, 'Add recommendations table (Epic 27-7)')`);
3197
- } catch {}
3198
- try {
3199
- await adapter.exec(`INSERT IGNORE INTO _schema_version (version, description) VALUES (5, 'Add repo_map_symbols and repo_map_meta tables (Epic 28-2)')`);
3200
- } catch {}
3201
- try {
3202
- await adapter.exec(`INSERT IGNORE INTO _schema_version (version, description) VALUES (6, 'Add dependencies JSON column to repo_map_symbols (Epic 28-3)')`);
3203
- } catch {}
3204
- try {
3205
- await adapter.exec(`INSERT IGNORE INTO _schema_version (version, description) VALUES (7, 'Add wg_stories, story_dependencies tables and ready_stories view (Epic 31-1)')`);
3206
- } catch {}
3207
- try {
3208
- await adapter.exec(`INSERT IGNORE INTO _schema_version (version, description) VALUES (8, 'Add task_type, phase, dispatch_id columns to turn_analysis (Story 30-1)')`);
3209
- } catch {}
3210
- try {
3211
- await adapter.exec(`INSERT IGNORE INTO _schema_version (version, description) VALUES (9, 'Add dispatch_id, task_type, phase columns to efficiency_scores (Story 30-3)')`);
3212
- } catch {}
3213
- await adapter.exec(`
3214
- CREATE TABLE IF NOT EXISTS repo_map_symbols (
3215
- id BIGINT AUTO_INCREMENT NOT NULL,
3216
- file_path VARCHAR(1000) NOT NULL,
3217
- symbol_name VARCHAR(500) NOT NULL,
3218
- symbol_kind VARCHAR(20) NOT NULL,
3219
- signature TEXT,
3220
- line_number INT NOT NULL DEFAULT 0,
3221
- exported TINYINT(1) NOT NULL DEFAULT 0,
3222
- file_hash VARCHAR(64) NOT NULL,
3223
- dependencies JSON,
3224
- PRIMARY KEY (id)
3225
- )
3226
- `);
3227
- await adapter.exec("CREATE INDEX IF NOT EXISTS idx_repo_map_symbols_file ON repo_map_symbols (file_path)");
3228
- await adapter.exec("CREATE INDEX IF NOT EXISTS idx_repo_map_symbols_kind ON repo_map_symbols (symbol_kind)");
3229
- await adapter.exec(`
3230
- CREATE TABLE IF NOT EXISTS repo_map_meta (
3231
- id INT NOT NULL DEFAULT 1,
3232
- commit_sha VARCHAR(64),
3233
- updated_at DATETIME,
3234
- file_count INT NOT NULL DEFAULT 0,
3235
- PRIMARY KEY (id)
3236
- )
3237
- `);
3238
- await adapter.exec("CREATE INDEX IF NOT EXISTS idx_efficiency_story ON efficiency_scores (story_key, timestamp DESC)");
3239
- await adapter.exec("CREATE INDEX IF NOT EXISTS idx_recommendations_story ON recommendations (story_key, severity)");
3240
- await adapter.exec("CREATE INDEX IF NOT EXISTS idx_category_stats_story ON category_stats (story_key, total_tokens)");
3241
- await adapter.exec("CREATE INDEX IF NOT EXISTS idx_consumer_stats_story ON consumer_stats (story_key, total_tokens)");
3335
+ }
3336
+
3337
+ //#endregion
3338
+ //#region packages/core/dist/persistence/schema.js
3339
+ /**
3340
+ * Initialize all persistence tables on the given adapter.
3341
+ * Idempotent safe to call multiple times.
3342
+ */
3343
+ async function initSchema(adapter) {
3344
+ await initCoreSchema(adapter);
3345
+ await initPipelineSchema(adapter);
3346
+ await initMonitorSchema(adapter);
3347
+ await initStateSchema(adapter);
3348
+ await initRepoMapSchema(adapter);
3349
+ await initTelemetrySchema(adapter);
3350
+ await initWorkGraphSchema(adapter);
3351
+ await initCoreViews(adapter);
3242
3352
  }
3243
3353
 
3244
3354
  //#endregion
@@ -11291,4 +11401,4 @@ async function callLLM(params) {
11291
11401
 
11292
11402
  //#endregion
11293
11403
  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, InMemoryDatabaseAdapter, IngestionServer, LEARNING_FINDING, 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, classifyVersionGap, 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, swallowDebug, tagRunAsBaseline, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics };
11294
- //# sourceMappingURL=dist-C_NE40jY.js.map
11404
+ //# sourceMappingURL=dist-Wnxr9Iv7.js.map
@@ -1,4 +1,4 @@
1
- import { AdtError } from "./dist-C_NE40jY.js";
1
+ import { AdtError } from "./dist-Wnxr9Iv7.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-D531Z8FW.js.map
74
+ //# sourceMappingURL=errors-B7lyO1vu.js.map
@@ -1,3 +1,3 @@
1
- import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-C_NE40jY.js";
1
+ import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-Wnxr9Iv7.js";
2
2
 
3
3
  export { createExperimenter };
@@ -1,7 +1,7 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-CzZ2Ki-b.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-BxmI1iiM.js";
2
2
  import "./logger-KeHncl-f.js";
3
- import "./dist-C_NE40jY.js";
4
- import "./manifest-read-BSsjVG96.js";
3
+ import "./dist-Wnxr9Iv7.js";
4
+ import "./manifest-read-BQ0o-M0u.js";
5
5
  import "./work-graph-repository-DZyJv5pV.js";
6
6
  import "./decisions-CzSIEeGP.js";
7
7
 
@@ -1,6 +1,6 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-C_NE40jY.js";
3
- import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-BSsjVG96.js";
2
+ import { DoltClient, DoltQueryError, createDatabaseAdapter$1 as createDatabaseAdapter, getLatestRun, getPipelineRunById, initSchema } from "./dist-Wnxr9Iv7.js";
3
+ import { resolveMainRepoRoot, resolveRunManifest } from "./manifest-read-BQ0o-M0u.js";
4
4
  import { createRequire } from "module";
5
5
  import { dirname, join } from "path";
6
6
  import { existsSync, readFileSync } from "node:fs";
@@ -1231,4 +1231,4 @@ function registerHealthCommand(program, _version = "0.0.0", projectRoot = proces
1231
1231
 
1232
1232
  //#endregion
1233
1233
  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, __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 };
1234
- //# sourceMappingURL=health-CzZ2Ki-b.js.map
1234
+ //# sourceMappingURL=health-BxmI1iiM.js.map
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-C_NE40jY.js";
3
+ import { AdapterRegistry, AdtError, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, GeminiCLIAdapter } from "./dist-Wnxr9Iv7.js";
4
4
  import "./adapter-registry-DIcrxjH8.js";
5
- import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-D531Z8FW.js";
5
+ import { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError } from "./errors-B7lyO1vu.js";
6
6
 
7
7
  //#region src/core/di.ts
8
8
  /**
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { readCurrentRunId, resolveMainRepoRoot } from "./manifest-read-BSsjVG96.js";
2
+ import { readCurrentRunId, resolveMainRepoRoot } from "./manifest-read-BQ0o-M0u.js";
3
3
  import { join } from "node:path";
4
4
  import { mkdir, readFile, writeFile } from "node:fs/promises";
5
5
  import * as readline from "node:readline";
@@ -180,4 +180,4 @@ async function runInteractivePrompt(decisionContext) {
180
180
 
181
181
  //#endregion
182
182
  export { runInteractivePrompt };
183
- //# sourceMappingURL=interactive-prompt-DF-PL5ia.js.map
183
+ //# sourceMappingURL=interactive-prompt-B92MvP8c.js.map
@@ -1,5 +1,5 @@
1
1
  import { createLogger } from "./logger-KeHncl-f.js";
2
- import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-C_NE40jY.js";
2
+ import { LEARNING_FINDING, createDecision, getDecisionsByCategory } from "./dist-Wnxr9Iv7.js";
3
3
  import * as path$1 from "path";
4
4
  import { join } from "path";
5
5
  import { readFile } from "fs/promises";
@@ -5845,4 +5845,4 @@ async function resolveRunManifest(dbRoot, runId) {
5845
5845
 
5846
5846
  //#endregion
5847
5847
  export { FindingsInjector, RunManifest, RuntimeProbeListSchema, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, applyConfigToGraph, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, parseRuntimeProbes, readCurrentRunId, renderFindings, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck, runStaleVerificationRecovery };
5848
- //# sourceMappingURL=manifest-read-BSsjVG96.js.map
5848
+ //# sourceMappingURL=manifest-read-BQ0o-M0u.js.map
@@ -1,6 +1,6 @@
1
1
  import "../../logger-KeHncl-f.js";
2
- import "../../dist-C_NE40jY.js";
3
- import "../../manifest-read-BSsjVG96.js";
4
- import { runInteractivePrompt } from "../../interactive-prompt-DF-PL5ia.js";
2
+ import "../../dist-Wnxr9Iv7.js";
3
+ import "../../manifest-read-BQ0o-M0u.js";
4
+ import { runInteractivePrompt } from "../../interactive-prompt-B92MvP8c.js";
5
5
 
6
6
  export { runInteractivePrompt };
@@ -1,4 +1,4 @@
1
- import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-C_NE40jY.js";
1
+ import { ModelRoutingConfigSchema, ProviderPolicySchema, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, TASK_TYPE_PHASE_MAP, getModelTier, loadModelRoutingConfig } from "./dist-Wnxr9Iv7.js";
2
2
  import "./routing-DFxoKHDt.js";
3
3
 
4
4
  export { loadModelRoutingConfig };
@@ -1,14 +1,14 @@
1
- import "./health-CzZ2Ki-b.js";
1
+ import "./health-BxmI1iiM.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
- import "./dist-C_NE40jY.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-COnbF6By.js";
6
- import "./manifest-read-BSsjVG96.js";
4
+ import "./dist-Wnxr9Iv7.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-alLrJMOI.js";
6
+ import "./manifest-read-BQ0o-M0u.js";
7
7
  import "./routing-DFxoKHDt.js";
8
8
  import "./work-graph-repository-DZyJv5pV.js";
9
9
  import "./decisions-CzSIEeGP.js";
10
10
  import "./decision-router-DblHY8se.js";
11
- import "./interactive-prompt-DF-PL5ia.js";
11
+ import "./interactive-prompt-B92MvP8c.js";
12
12
  import "./recovery-engine-BKGBeBnW.js";
13
13
 
14
14
  export { runRunAction };
@@ -1,11 +1,11 @@
1
- import { BMAD_BASELINE_TOKENS_FULL, DoltMergeConflict, FileStateStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, validateStoryKey } from "./health-CzZ2Ki-b.js";
1
+ import { BMAD_BASELINE_TOKENS_FULL, DoltMergeConflict, FileStateStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, validateStoryKey } from "./health-BxmI1iiM.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, 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-C_NE40jY.js";
5
- import { FindingsInjector, RunManifest, RuntimeProbeListSchema, applyConfigToGraph, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, renderFindings, resolveGraphPath, resolveMainRepoRoot, runAcTraceabilityCheck, runStaleVerificationRecovery } from "./manifest-read-BSsjVG96.js";
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-Wnxr9Iv7.js";
5
+ import { FindingsInjector, RunManifest, RuntimeProbeListSchema, applyConfigToGraph, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectsEventDrivenAC, detectsStateIntegratingAC, extractTargetFilesFromStoryContent, renderFindings, resolveGraphPath, resolveMainRepoRoot, runAcTraceabilityCheck, runStaleVerificationRecovery } from "./manifest-read-BQ0o-M0u.js";
6
6
  import { WorkGraphRepository, detectCycles } from "./work-graph-repository-DZyJv5pV.js";
7
7
  import { deriveExitCode, routeDecision } from "./decision-router-DblHY8se.js";
8
- import { runInteractivePrompt } from "./interactive-prompt-DF-PL5ia.js";
8
+ import { runInteractivePrompt } from "./interactive-prompt-B92MvP8c.js";
9
9
  import { runRecoveryEngine } from "./recovery-engine-BKGBeBnW.js";
10
10
  import { basename, dirname, extname, join } from "path";
11
11
  import { access, readFile, readdir, stat } from "fs/promises";
@@ -47137,7 +47137,7 @@ async function runFullPipeline(options) {
47137
47137
  */
47138
47138
  async function emitPreDispatchVersionAdvisory(currentVersion) {
47139
47139
  if (process.env["SUBSTRATE_NO_UPDATE_CHECK"] === "1") return;
47140
- const { createVersionManager } = await import("./version-manager-impl-9J_JCJPu.js");
47140
+ const { createVersionManager } = await import("./version-manager-impl-C27Gxmkt.js");
47141
47141
  const vm = createVersionManager();
47142
47142
  const result = await vm.checkForUpdates(true);
47143
47143
  const gap = classifyVersionGap(currentVersion, result.latestVersion);
@@ -47234,4 +47234,4 @@ function registerRunCommand(program, version = "0.0.0", projectRoot = process.cw
47234
47234
 
47235
47235
  //#endregion
47236
47236
  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 };
47237
- //# sourceMappingURL=run-COnbF6By.js.map
47237
+ //# sourceMappingURL=run-alLrJMOI.js.map
@@ -1,5 +1,5 @@
1
- import "./dist-C_NE40jY.js";
1
+ import "./dist-Wnxr9Iv7.js";
2
2
  import "./version-manager-impl-qFBiO4Eh.js";
3
- import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-C1KzAZQE.js";
3
+ import { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand } from "./upgrade-Cm0n0duM.js";
4
4
 
5
5
  export { isGlobalInstall, registerUpgradeCommand, runUpgradeCommand };
@@ -1,4 +1,4 @@
1
- import { createVersionManager } from "./dist-C_NE40jY.js";
1
+ import { createVersionManager } from "./dist-Wnxr9Iv7.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-C1KzAZQE.js.map
126
+ //# sourceMappingURL=upgrade-Cm0n0duM.js.map
@@ -1,4 +1,4 @@
1
- import { VersionManagerImpl, createVersionManager } from "./dist-C_NE40jY.js";
1
+ import { VersionManagerImpl, createVersionManager } from "./dist-Wnxr9Iv7.js";
2
2
  import "./version-manager-impl-qFBiO4Eh.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.20.95",
3
+ "version": "0.20.96",
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-C_NE40jY.js";
2
- import "./adapter-registry-DIcrxjH8.js";
3
-
4
- export { AdapterRegistry };