substrate-ai 0.20.39 → 0.20.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { FileStateStore, RunManifest, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, ZERO_FINDING_COUNTS, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, parseRuntimeProbes, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts } from "../health-R9GiVIiQ.js";
2
+ import { FileStateStore, RunManifest, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, ZERO_FINDING_COUNTS, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, parseRuntimeProbes, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts } from "../health-qUCPCz1O.js";
3
3
  import { createLogger } from "../logger-KeHncl-f.js";
4
4
  import { createEventBus } from "../helpers-CElYrONe.js";
5
5
  import { AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError, CostTrackerConfigSchema, DEFAULT_CONFIG, DoltClient, DoltNotInstalled, GlobalSettingsSchema, InMemoryDatabaseAdapter, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, 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-VcMmfo2w.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, runProbeAuthor, runSolutioningPhase, validateStopAfterFromConflict } from "../run-Dm70k8bR.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, runProbeAuthor, runSolutioningPhase, validateStopAfterFromConflict } from "../run-Dhxrf7Nj.js";
8
8
  import "../errors-CogpxBUg.js";
9
9
  import "../routing-CcBOCuC9.js";
10
10
  import "../decisions-C0pz9Clx.js";
@@ -3667,7 +3667,7 @@ async function runStatusAction(options) {
3667
3667
  logger$13.debug({ err }, "Work graph query failed, continuing without work graph data");
3668
3668
  }
3669
3669
  if (run === void 0) {
3670
- const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-C-ZrHJwL.js");
3670
+ const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-B54Vy4Ux.js");
3671
3671
  const substrateDirPath = join(projectRoot, ".substrate");
3672
3672
  const processInfo = inspectProcessTree$1({
3673
3673
  projectRoot,
@@ -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-CL1C4M2f.js"
5201
+ "../run-D2xj574m.js"
5202
5202
  );
5203
5203
  const runStoryFn = async (opts) => {
5204
5204
  const exitCode = await runPipeline({
@@ -1,4 +1,4 @@
1
- import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-R9GiVIiQ.js";
1
+ import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-qUCPCz1O.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./dist-VcMmfo2w.js";
4
4
  import "./decisions-C0pz9Clx.js";
@@ -4508,10 +4508,90 @@ function computeTakenOptionPerGroup(hardClauses, workingDir) {
4508
4508
  * 3. The presence of `## Runtime Probes` heading followed by a fenced yaml block
4509
4509
  * (represented as a single "runtime-probes-section" clause)
4510
4510
  */
4511
+ /**
4512
+ * Negation phrases that mark a paragraph as "the paths in this paragraph
4513
+ * are references the dev should NOT deliver/modify". When any of these
4514
+ * phrases appears in a paragraph, every path-clause in that paragraph is
4515
+ * tagged `negation: true` so the verification emit routes them to the
4516
+ * info-severity `source-ac-negation-reference` finding instead of the
4517
+ * under-delivery error path.
4518
+ *
4519
+ * Strata Run 16 (Story 1-16, 2026-04-27): the AC contained
4520
+ *
4521
+ * "the existing test scaffolding is documented (NOT replaced):
4522
+ * `packages/memory` already uses vitest (Story 1.8+);
4523
+ * `packages/memory-mcp` already uses pytest (Story 1.10+); ...
4524
+ * 1.16 does NOT replace or rewrite existing test infrastructure."
4525
+ *
4526
+ * Substrate emitted 6 ERROR-level under-delivery findings on the listed
4527
+ * paths; the dev had correctly NOT modified them. The flood of
4528
+ * false-positive ERRORs masked a real WARN about the missing `## Runtime
4529
+ * Probes` section (which itself would have surfaced two real defects in
4530
+ * the delivery). Detecting the negation context up-front separates the
4531
+ * legitimate "paths the AC mentions but the dev should not modify" case
4532
+ * from genuine under-delivery.
4533
+ *
4534
+ * Patterns are case-sensitive on the keyword (NOT, MUST NOT, gitignored)
4535
+ * because lowercased forms are common in non-imperative prose ("not
4536
+ * really" / "must not exceed" appear in unrelated contexts and
4537
+ * over-trigger). The strata observation enumerates the canonical forms.
4538
+ */
4539
+ const NEGATION_PHRASE_PATTERNS = [
4540
+ /\(NOT\s+\w+/,
4541
+ /documented\s*\(NOT/i,
4542
+ /\bMUST\s+NOT\b|\bSHALL\s+NOT\b/,
4543
+ /\bdo(?:es)?\s+NOT\s+\w+/,
4544
+ /\bdeferred\s+to\b/i,
4545
+ /\b(?:is|are)\s+gitignored\b/i
4546
+ ];
4547
+ /**
4548
+ * Find all line indices that fall within a negation context. The scope of
4549
+ * a single negation context is the line that contains the negation phrase
4550
+ * PLUS any markdown indented-continuation lines following it (so a bullet
4551
+ * that wraps onto multiple indented lines is treated as one logical unit).
4552
+ *
4553
+ * The continuation walk stops at the first of: blank line, next markdown
4554
+ * bullet (`- `, `* `, numbered list), or any non-indented non-blank line.
4555
+ *
4556
+ * Coarser scopes (e.g., paragraph-wide aggregation) over-triggered on
4557
+ * test fixtures like:
4558
+ *
4559
+ * The implementation MUST validate input.
4560
+ * The system MUST NOT skip authentication.
4561
+ * Files SHALL be placed in `src/auth/validator.ts`.
4562
+ *
4563
+ * — three independent statements wrapped without blank-line separators.
4564
+ * The "MUST NOT" on line 2 should not mark the unrelated path on line 3
4565
+ * as a negation reference. Only the bullet's CONTINUATION-LINE structure
4566
+ * constitutes "the same logical reference unit" as the negation phrase.
4567
+ */
4568
+ function detectNegationContextLines(lines) {
4569
+ const result = new Set();
4570
+ for (let i = 0; i < lines.length; i++) {
4571
+ const line = lines[i] ?? "";
4572
+ if (NEGATION_PHRASE_PATTERNS.some((pat) => pat.test(line))) {
4573
+ result.add(i);
4574
+ let j = i + 1;
4575
+ while (j < lines.length) {
4576
+ const next = lines[j] ?? "";
4577
+ if (next.trim() === "") break;
4578
+ if (/^\s*(?:-|\*|\d+\.)\s+/.test(next)) break;
4579
+ if (/^\s+\S/.test(next)) {
4580
+ result.add(j);
4581
+ j++;
4582
+ continue;
4583
+ }
4584
+ break;
4585
+ }
4586
+ }
4587
+ }
4588
+ return result;
4589
+ }
4511
4590
  function extractHardClauses(sectionContent) {
4512
4591
  const clauses = [];
4513
4592
  const lines = sectionContent.split("\n");
4514
4593
  const alternativeOptions = detectAlternativeOptions(lines);
4594
+ const negationContextLines = detectNegationContextLines(lines);
4515
4595
  const mustPattern = /\b(MUST NOT|MUST|SHALL NOT|SHALL)\b/;
4516
4596
  for (const line of lines) {
4517
4597
  const match = mustPattern.exec(line);
@@ -4530,10 +4610,12 @@ function extractHardClauses(sectionContent) {
4530
4610
  let pathMatch;
4531
4611
  while ((pathMatch = pathPattern.exec(line)) !== null) {
4532
4612
  const alt = findOptionForLine(lineIdx, alternativeOptions);
4613
+ const inNegation = negationContextLines.has(lineIdx);
4533
4614
  clauses.push({
4534
4615
  type: "path",
4535
4616
  text: `\`${pathMatch[1]}\``,
4536
- ...alt ? { alternative: alt } : {}
4617
+ ...alt ? { alternative: alt } : {},
4618
+ ...inNegation ? { negation: true } : {}
4537
4619
  });
4538
4620
  }
4539
4621
  }
@@ -4583,15 +4665,24 @@ var SourceAcFidelityCheck = class {
4583
4665
  for (const clause of hardClauses) if (clause.type === "runtime-probes-section") {
4584
4666
  if (!storyContent.includes("## Runtime Probes")) {
4585
4667
  const truncated = clause.text.length > 120 ? clause.text.slice(0, 120) : clause.text;
4668
+ const isEventDrivenAc = detectsEventDrivenAC(context.sourceEpicContent);
4586
4669
  findings.push({
4587
4670
  category: "source-ac-drift",
4588
- severity: "warn",
4589
- message: `runtime-probes-section: "${truncated}" present in epics source but absent in story artifact`
4671
+ severity: isEventDrivenAc ? "error" : "warn",
4672
+ message: isEventDrivenAc ? `runtime-probes-section: "${truncated}" present in epics source but absent in story artifact AND source AC is event-driven (probes are required for event-driven ACs — runtime-probes check will skip without the section)` : `runtime-probes-section: "${truncated}" present in epics source but absent in story artifact`
4590
4673
  });
4591
4674
  }
4592
4675
  } else if (!storyContent.includes(clause.text)) {
4593
4676
  const truncated = clause.text.length > 120 ? clause.text.slice(0, 120) : clause.text;
4594
4677
  if (clause.type === "path") {
4678
+ if (clause.negation === true) {
4679
+ findings.push({
4680
+ category: "source-ac-negation-reference",
4681
+ severity: "info",
4682
+ message: `path: "${truncated}" referenced in source AC inside a negation context (e.g., "(NOT replaced)", "MUST NOT", "deferred to", "documented (NOT", "does NOT replace", "is gitignored") — the AC explicitly directed the dev NOT to deliver/modify this path; treated as reference-only, not a deliverable`
4683
+ });
4684
+ continue;
4685
+ }
4595
4686
  if (isOperationalPath(clause.text)) {
4596
4687
  findings.push({
4597
4688
  category: "source-ac-operational-path-reference",
@@ -6344,4 +6435,4 @@ function registerHealthCommand(program, _version = "0.0.0", projectRoot = proces
6344
6435
 
6345
6436
  //#endregion
6346
6437
  export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, DoltMergeConflict, FileStateStore, FindingsInjector, RunManifest, RuntimeProbeListSchema, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN$1 as STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, SupervisorLock, VALID_PHASES, WorkGraphRepository, ZERO_FINDING_COUNTS, __commonJS, __require, __toESM, applyConfigToGraph, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, createStateStore, detectCycles, detectsEventDrivenAC, extractTargetFilesFromStoryContent, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, parseRuntimeProbes, registerHealthCommand, renderFindings, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveGraphPath, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, runHealthAction, validateStoryKey };
6347
- //# sourceMappingURL=health-R9GiVIiQ.js.map
6438
+ //# sourceMappingURL=health-qUCPCz1O.js.map
@@ -1,8 +1,8 @@
1
- import "./health-R9GiVIiQ.js";
1
+ import "./health-qUCPCz1O.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
4
  import "./dist-VcMmfo2w.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction, wireNdjsonEmitter } from "./run-Dm70k8bR.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction, wireNdjsonEmitter } from "./run-Dhxrf7Nj.js";
6
6
  import "./routing-CcBOCuC9.js";
7
7
  import "./decisions-C0pz9Clx.js";
8
8
 
@@ -1,4 +1,4 @@
1
- import { BMAD_BASELINE_TOKENS_FULL, DoltMergeConflict, FileStateStore, FindingsInjector, RunManifest, RuntimeProbeListSchema, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, WorkGraphRepository, __commonJS, __require, __toESM, applyConfigToGraph, buildPipelineStatusOutput, createDatabaseAdapter, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectCycles, detectsEventDrivenAC, extractTargetFilesFromStoryContent, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, renderFindings, resolveGraphPath, resolveMainRepoRoot, validateStoryKey } from "./health-R9GiVIiQ.js";
1
+ import { BMAD_BASELINE_TOKENS_FULL, DoltMergeConflict, FileStateStore, FindingsInjector, RunManifest, RuntimeProbeListSchema, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, WorkGraphRepository, __commonJS, __require, __toESM, applyConfigToGraph, buildPipelineStatusOutput, createDatabaseAdapter, createDefaultVerificationPipeline, createGraphOrchestrator, createSdlcCodeReviewHandler, createSdlcCreateStoryHandler, createSdlcDevStoryHandler, createSdlcPhaseHandler, detectCycles, detectsEventDrivenAC, extractTargetFilesFromStoryContent, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, renderFindings, resolveGraphPath, resolveMainRepoRoot, validateStoryKey } from "./health-qUCPCz1O.js";
2
2
  import { createLogger } from "./logger-KeHncl-f.js";
3
3
  import { TypedEventBusImpl, createEventBus, createTuiApp, isTuiCapable, printNonTtyWarning, sleep } from "./helpers-CElYrONe.js";
4
4
  import { ADVISORY_NOTES, Categorizer, ConsumerAnalyzer, DEFAULT_GLOBAL_SETTINGS, DispatcherImpl, DoltClient, ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, EfficiencyScorer, IngestionServer, LogTurnAnalyzer, OPERATIONAL_FINDING, Recommender, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, STORY_METRICS, STORY_OUTCOME, SubstrateConfigSchema, TEST_EXPANSION_FINDING, TEST_PLAN, TelemetryNormalizer, TelemetryPipeline, TurnAnalyzer, addTokenUsage, aggregateTokenUsageForRun, aggregateTokenUsageForStory, callLLM, createConfigSystem, createDatabaseAdapter$1, createDecision, createPipelineRun, createRequirement, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunMetrics, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, listRequirements, loadModelRoutingConfig, registerArtifact, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-VcMmfo2w.js";
@@ -45151,4 +45151,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
45151
45151
 
45152
45152
  //#endregion
45153
45153
  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, runProbeAuthor, runRunAction, runSolutioningPhase, validateStopAfterFromConflict, wireNdjsonEmitter };
45154
- //# sourceMappingURL=run-Dm70k8bR.js.map
45154
+ //# sourceMappingURL=run-Dhxrf7Nj.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.20.39",
3
+ "version": "0.20.40",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",