substrate-ai 0.20.125 → 0.20.127

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
@@ -3,7 +3,7 @@ import { FileKvStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipeline
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, createPipelineRun, createStderrLogger, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initWorkGraphSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, swallowDebug, tagRunAsBaseline, updatePipelineRun } from "../dist-Bc0-6VcX.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-DKrGXAOH.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-Bz9isnn_.js";
7
7
  import "../adapter-registry-DIcrxjH8.js";
8
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-CDjNmdVW.js";
9
9
  import "../errors-CwQM_6Yk.js";
@@ -8419,7 +8419,7 @@ async function runSupervisorAction(options, deps = {}) {
8419
8419
  await initSchema(expAdapter);
8420
8420
  const { runRunAction: runPipeline } = await import(
8421
8421
  /* @vite-ignore */
8422
- "../run-IWXFDemI.js"
8422
+ "../run-BjR_gPu6.js"
8423
8423
  );
8424
8424
  const runStoryFn = async (opts) => {
8425
8425
  const exitCode = await runPipeline({
@@ -2,7 +2,7 @@ import "./health-B4NhX--T.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
4
  import "./dist-Bc0-6VcX.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-DKrGXAOH.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-Bz9isnn_.js";
6
6
  import "./manifest-read-CDjNmdVW.js";
7
7
  import "./routing-DFxoKHDt.js";
8
8
  import "./work-graph-repository-DZyJv5pV.js";
@@ -5848,6 +5848,16 @@ function runBuildVerification(options) {
5848
5848
  reason: "pep-668-externally-managed"
5849
5849
  };
5850
5850
  }
5851
+ const pythonEnvNotProvisionedPattern = /\bpython3?:?\s*command not found|command not found:\s*python3?\b|\bpip3?:?\s*command not found|No module named pip\b/i;
5852
+ if (pythonEnvNotProvisionedPattern.test(combinedOutput)) {
5853
+ logger$24.warn("Python environment not provisioned (interpreter or pip missing) — skipping build pre-flight. Provide a venv (or a project-profile buildCommand that activates one) to verify Python packages.");
5854
+ return {
5855
+ status: "skipped",
5856
+ exitCode,
5857
+ output: combinedOutput,
5858
+ reason: "python-env-not-provisioned"
5859
+ };
5860
+ }
5851
5861
  return {
5852
5862
  status: "failed",
5853
5863
  exitCode,
@@ -6804,7 +6814,14 @@ function extractStorySection(shardContent, storyKey) {
6804
6814
  const rest = shardContent.slice(startIdx + match$2[0].length);
6805
6815
  const nextStoryPattern = new RegExp(`(?:^#{2,4}\\s+Story\\s+[\\d]|^Story\\s+[\\d][\\d.\\-_a-z]*:|^\\*\\*[\\d][\\d.\\-_a-z]*\\*\\*|^[\\d][\\d.\\-_a-z]*:)`, "mi");
6806
6816
  const nextMatch = nextStoryPattern.exec(rest);
6807
- const endIdx = nextMatch !== null ? startIdx + match$2[0].length + nextMatch.index : shardContent.length;
6817
+ const headingLevel = /^(#{1,6})/.exec(match$2[0].trimStart())?.[1].length;
6818
+ let nextSectionIdx = null;
6819
+ if (headingLevel !== void 0) {
6820
+ const nextSectionMatch = new RegExp(`^#{1,${headingLevel}}\\s`, "m").exec(rest);
6821
+ if (nextSectionMatch !== null) nextSectionIdx = nextSectionMatch.index;
6822
+ }
6823
+ const boundaryOffsets = [nextMatch?.index, nextSectionIdx].filter((i) => typeof i === "number");
6824
+ const endIdx = boundaryOffsets.length > 0 ? startIdx + match$2[0].length + Math.min(...boundaryOffsets) : shardContent.length;
6808
6825
  const section = shardContent.slice(startIdx, endIdx).trim();
6809
6826
  return section.length > 0 ? section : null;
6810
6827
  }
@@ -13074,6 +13091,24 @@ function sanitizeStoryTitle(raw) {
13074
13091
  return cleaned.length > 120 ? `${cleaned.slice(0, 117)}...` : cleaned;
13075
13092
  }
13076
13093
  /**
13094
+ * obs_2026-05-26_028: detect whether a dev-story's output landed in the MAIN
13095
+ * checkout instead of its per-story worktree (a cwd misroute). Returns the
13096
+ * uncommitted files in the main checkout when running in worktree mode (the
13097
+ * main tree should be clean during a worktree dispatch), else an empty list.
13098
+ * Used to enrich the zero-diff escalation with an actionable cause rather than
13099
+ * the opaque verdict. Best-effort: a probe failure yields an empty list (never
13100
+ * blocks escalation). Exported for unit testing.
13101
+ */
13102
+ function detectWorkOutsideWorktree(effectiveProjectRoot, projectRoot, checkDiff) {
13103
+ const inWorktreeMode = effectiveProjectRoot !== void 0 && projectRoot !== void 0 && effectiveProjectRoot !== projectRoot;
13104
+ if (!inWorktreeMode) return [];
13105
+ try {
13106
+ return checkDiff(projectRoot);
13107
+ } catch {
13108
+ return [];
13109
+ }
13110
+ }
13111
+ /**
13077
13112
  * obs_2026-05-26_027: capture the reconstruction phase-input. Reads the story
13078
13113
  * file the producing phase consumed, copies it to a durable sidecar under the
13079
13114
  * run manifest's directory (`inputs/<run-id>/<story-key>.md`), and returns the
@@ -14376,7 +14411,7 @@ function createImplementationOrchestrator(deps) {
14376
14411
  const fidelityImplDecisions = await getDecisionsByPhase(db, "implementation");
14377
14412
  let fidelitySourceContent;
14378
14413
  const fidelityPerStoryShard = fidelityImplDecisions.find((d) => d.category === "epic-shard" && d.key === storyKey);
14379
- if (fidelityPerStoryShard?.value) fidelitySourceContent = fidelityPerStoryShard.value;
14414
+ if (fidelityPerStoryShard?.value) fidelitySourceContent = extractStorySection(fidelityPerStoryShard.value, storyKey) ?? fidelityPerStoryShard.value;
14380
14415
  else {
14381
14416
  const epicShardForFidelity = fidelityImplDecisions.find((d) => d.category === "epic-shard" && d.key === epicId);
14382
14417
  if (epicShardForFidelity?.value) fidelitySourceContent = extractStorySection(epicShardForFidelity.value, storyKey) ?? void 0;
@@ -15170,7 +15205,13 @@ function createImplementationOrchestrator(deps) {
15170
15205
  committedFileCount: gitDiffFiles?.length ?? 0
15171
15206
  }, "Working tree clean but new commits detected since dispatch — skipping zero-diff escalation");
15172
15207
  } else {
15173
- logger$27.warn({ storyKey }, "Zero-diff detected after COMPLETE dev-story — no file changes and no new commits");
15208
+ const outsideWorktreeFiles = detectWorkOutsideWorktree(effectiveProjectRoot, projectRoot, checkGitDiffFiles);
15209
+ const misrouted = outsideWorktreeFiles.length > 0;
15210
+ logger$27.warn({
15211
+ storyKey,
15212
+ misrouteSuspected: misrouted,
15213
+ outsideWorktreeFileCount: outsideWorktreeFiles.length
15214
+ }, misrouted ? "Zero-diff in worktree, but the MAIN checkout has uncommitted changes — dev-story output likely landed outside the story worktree (cwd misroute)" : "Zero-diff detected after COMPLETE dev-story — no file changes and no new commits");
15174
15215
  eventBus.emit("orchestrator:zero-diff-escalation", {
15175
15216
  storyKey,
15176
15217
  reason: "zero-diff-on-complete"
@@ -15182,11 +15223,13 @@ function createImplementationOrchestrator(deps) {
15182
15223
  completedAt: new Date().toISOString()
15183
15224
  });
15184
15225
  await writeStoryMetricsBestEffort(storyKey, "escalated", 0);
15226
+ const zeroDiffIssues = ["dev-story completed with COMPLETE verdict but no file changes detected in git diff"];
15227
+ if (misrouted) zeroDiffIssues.push(`Work appears to have landed in the MAIN checkout instead of the story worktree (${outsideWorktreeFiles.length} uncommitted file(s) at ${projectRoot}; e.g. ${outsideWorktreeFiles.slice(0, 5).join(", ")}). The output is not lost — inspect \`git -C ${projectRoot} status\`. reconcile-from-disk inspects the branch/worktree, not main, so it will not pick this up.`);
15185
15228
  await emitEscalation({
15186
15229
  storyKey,
15187
15230
  lastVerdict: "zero-diff-on-complete",
15188
15231
  reviewCycles: 0,
15189
- issues: ["dev-story completed with COMPLETE verdict but no file changes detected in git diff"]
15232
+ issues: zeroDiffIssues
15190
15233
  });
15191
15234
  await persistState();
15192
15235
  return;
@@ -47302,4 +47345,4 @@ function registerRunCommand(program, version = "0.0.0", projectRoot = process.cw
47302
47345
 
47303
47346
  //#endregion
47304
47347
  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 };
47305
- //# sourceMappingURL=run-DKrGXAOH.js.map
47348
+ //# sourceMappingURL=run-Bz9isnn_.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.20.125",
3
+ "version": "0.20.127",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",