substrate-ai 0.20.20 → 0.20.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -4,7 +4,7 @@ import { createLogger } from "../logger-KeHncl-f.js";
4
4
  import { createEventBus } from "../helpers-CElYrONe.js";
5
5
  import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, GlobalSettingsSchema, 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, tagRunAsBaseline, updatePipelineRun } from "../dist-CqtWS9wF.js";
6
6
  import "../adapter-registry-DXLMTmfD.js";
7
- import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-BLObh_Ou.js";
7
+ import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-DrJWCS63.js";
8
8
  import "../errors-1uLGqnvr.js";
9
9
  import "../routing-CcBOCuC9.js";
10
10
  import "../decisions-C0pz9Clx.js";
@@ -5198,7 +5198,7 @@ async function runSupervisorAction(options, deps = {}) {
5198
5198
  await initSchema(expAdapter);
5199
5199
  const { runRunAction: runPipeline } = await import(
5200
5200
  /* @vite-ignore */
5201
- "../run-DPhVpqrX.js"
5201
+ "../run-C46Xfny6.js"
5202
5202
  );
5203
5203
  const runStoryFn = async (opts) => {
5204
5204
  const exitCode = await runPipeline({
@@ -2,7 +2,7 @@ import "./health-ZGa9E0D2.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
4
  import "./dist-CqtWS9wF.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction, wireNdjsonEmitter } from "./run-BLObh_Ou.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction, wireNdjsonEmitter } from "./run-DrJWCS63.js";
6
6
  import "./routing-CcBOCuC9.js";
7
7
  import "./decisions-C0pz9Clx.js";
8
8
 
@@ -5708,7 +5708,7 @@ function hashSourceAcSection(section) {
5708
5708
  * @returns Promise resolving to CreateStoryResult
5709
5709
  */
5710
5710
  async function runCreateStory(deps, params) {
5711
- const { epicId, storyKey, pipelineRunId, source_ac_hash } = params;
5711
+ const { epicId, storyKey, pipelineRunId, source_ac_hash, priorDriftFeedback } = params;
5712
5712
  logger$18.debug({
5713
5713
  epicId,
5714
5714
  storyKey,
@@ -5797,7 +5797,16 @@ async function runCreateStory(deps, params) {
5797
5797
  name: "source_ac_hash",
5798
5798
  content: effectiveSourceAcHash,
5799
5799
  priority: "required"
5800
- }] : []
5800
+ }] : [],
5801
+ ...priorDriftFeedback !== void 0 && priorDriftFeedback.length > 0 ? [{
5802
+ name: "prior_drift_feedback",
5803
+ content: priorDriftFeedback,
5804
+ priority: "required"
5805
+ }] : [{
5806
+ name: "prior_drift_feedback",
5807
+ content: "",
5808
+ priority: "optional"
5809
+ }]
5801
5810
  ], TOKEN_CEILING);
5802
5811
  logger$18.debug({
5803
5812
  tokenCount,
@@ -8848,6 +8857,7 @@ async function seedEpicShards(db, projectRoot) {
8848
8857
  }
8849
8858
  const shards = parseEpicShards(content);
8850
8859
  let count = 0;
8860
+ const seenKeys = new Set();
8851
8861
  for (const shard of shards) {
8852
8862
  const subsections = parseStorySubsections(shard.epicId, shard.content);
8853
8863
  for (const subsection of subsections) {
@@ -8858,6 +8868,15 @@ async function seedEpicShards(db, projectRoot) {
8858
8868
  truncatedLength: MAX_EPIC_SHARD_CHARS,
8859
8869
  droppedChars: subsection.content.length - MAX_EPIC_SHARD_CHARS
8860
8870
  }, `Epic shard for ${subsection.key} exceeded ${MAX_EPIC_SHARD_CHARS}-char cap and was truncated; tail content lost from decisions store. Consider splitting the story or raising MAX_EPIC_SHARD_CHARS.`);
8871
+ if (seenKeys.has(subsection.key)) {
8872
+ logger$11.warn({
8873
+ epicId: shard.epicId,
8874
+ storyKey: subsection.key,
8875
+ droppedContentLength: subsection.content.length
8876
+ }, `Epic shard parser produced duplicate key '${subsection.key}' (parser regression?); skipping additional insert. First entry retained.`);
8877
+ continue;
8878
+ }
8879
+ seenKeys.add(subsection.key);
8861
8880
  await createDecision(db, {
8862
8881
  pipeline_run_id: null,
8863
8882
  phase: "implementation",
@@ -12246,6 +12265,7 @@ function createImplementationOrchestrator(deps) {
12246
12265
  return;
12247
12266
  }
12248
12267
  let fidelityRetries = 0;
12268
+ let priorDriftFeedback;
12249
12269
  while (storyFilePath === void 0) {
12250
12270
  try {
12251
12271
  incrementDispatches(storyKey);
@@ -12263,7 +12283,8 @@ function createImplementationOrchestrator(deps) {
12263
12283
  epicId: storyKey.split("-")[0] ?? storyKey,
12264
12284
  storyKey,
12265
12285
  pipelineRunId: config.pipelineRunId,
12266
- source_ac_hash: sourceAcHash
12286
+ source_ac_hash: sourceAcHash,
12287
+ ...priorDriftFeedback !== void 0 ? { priorDriftFeedback } : {}
12267
12288
  });
12268
12289
  endPhase(storyKey, "create-story");
12269
12290
  eventBus.emit("orchestrator:story-phase-complete", {
@@ -12527,6 +12548,17 @@ function createImplementationOrchestrator(deps) {
12527
12548
  storyKey,
12528
12549
  msg: `create-story drift detected (${fidelity.missing.length}/${namedPaths.length} named paths missing); retry ${fidelityRetries}/${MAX_FIDELITY_RETRIES}`
12529
12550
  });
12551
+ priorDriftFeedback = [
12552
+ `### Prior Dispatch Drift Detected (retry ${fidelityRetries}/${MAX_FIDELITY_RETRIES})`,
12553
+ "",
12554
+ `A previous create-story dispatch for this story produced an artifact that omitted ${fidelity.missing.length} of ${namedPaths.length} named files/paths from the source AC. The previous artifact has been moved to \`${stalePath}\` and you are being re-dispatched to produce a corrected artifact.`,
12555
+ "",
12556
+ "**Named paths from the source AC that were missing in the prior dispatch:**",
12557
+ "",
12558
+ ...fidelity.missing.map((p) => `- \`${p}\``),
12559
+ "",
12560
+ "These names appear in the Epic Scope above and are part of the source AC contract. Preserve them verbatim in your rendered artifact (file lists, paths, named identifiers in Tasks/Subtasks). Do not substitute alternative names from training priors. If the source AC says `adjacency-store.ts`, the rendered story file says `adjacency-store.ts` — not `LinkStore`, `AdjacencyManager`, or any other re-conceptualization."
12561
+ ].join("\n");
12530
12562
  storyFilePath = void 0;
12531
12563
  continue;
12532
12564
  } catch (renameErr) {
@@ -44299,4 +44331,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
44299
44331
 
44300
44332
  //#endregion
44301
44333
  export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveMaxReviewCycles, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict, wireNdjsonEmitter };
44302
- //# sourceMappingURL=run-BLObh_Ou.js.map
44334
+ //# sourceMappingURL=run-DrJWCS63.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.20.20",
3
+ "version": "0.20.21",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -19,6 +19,8 @@
19
19
  ### Story Definition (from Solutioning Phase)
20
20
  {{story_definition}}
21
21
 
22
+ {{prior_drift_feedback}}
23
+
22
24
  ---
23
25
 
24
26
  ## Mission