substrate-ai 0.20.131 → 0.20.133

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-BUDAiEaH.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-BodUSLte.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-DAb4BgAO.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-CKmTZKA5.js";
9
9
  import "../errors-pJaYVCUJ.js";
@@ -1840,6 +1840,7 @@ function syncCommandsAsPrompts(commandsDir, promptsDir, ownershipPrefixes, nameP
1840
1840
  *
1841
1841
  * Returns the number of skill directories copied.
1842
1842
  */
1843
+ /** Exported for testing. */
1843
1844
  function syncSkillsToTarget(srcSkillsDir, destSkillsDir, ownershipPrefixes, namePrefix) {
1844
1845
  if (!existsSync$1(srcSkillsDir)) return 0;
1845
1846
  mkdirSync$1(destSkillsDir, { recursive: true });
@@ -1863,15 +1864,41 @@ function syncSkillsToTarget(srcSkillsDir, destSkillsDir, ownershipPrefixes, name
1863
1864
  }, "Failed to prune stale skills");
1864
1865
  }
1865
1866
  let count = 0;
1867
+ const failures = [];
1866
1868
  for (const entry of sourceEntries) {
1867
1869
  const destName = namePrefix && !entry.name.startsWith(namePrefix) ? `${namePrefix}${entry.name}` : entry.name;
1868
1870
  const dest = join(destSkillsDir, destName);
1869
- rmSync$1(dest, {
1870
- recursive: true,
1871
- force: true
1872
- });
1873
- cpSync(join(srcSkillsDir, entry.name), dest, { recursive: true });
1874
- count++;
1871
+ let stage = "rm";
1872
+ try {
1873
+ rmSync$1(dest, {
1874
+ recursive: true,
1875
+ force: true
1876
+ });
1877
+ stage = "cp";
1878
+ cpSync(join(srcSkillsDir, entry.name), dest, { recursive: true });
1879
+ count++;
1880
+ } catch (err) {
1881
+ const msg = err instanceof Error ? err.message : String(err);
1882
+ failures.push({
1883
+ skill: entry.name,
1884
+ op: stage,
1885
+ err: msg
1886
+ });
1887
+ logger$18.warn({
1888
+ skill: entry.name,
1889
+ dest,
1890
+ stage,
1891
+ err: msg
1892
+ }, `Skipped skill (${stage} failed): ${msg}`);
1893
+ }
1894
+ }
1895
+ if (failures.length > 0 && count === 0) {
1896
+ const dominantErr = failures[0].err;
1897
+ logger$18.warn({
1898
+ destSkillsDir,
1899
+ attempted: failures.length,
1900
+ dominantErr
1901
+ }, `All ${String(failures.length)} skills failed under ${destSkillsDir} (e.g. ${dominantErr}). Check that the directory and its parent are writable by the current user.`);
1875
1902
  }
1876
1903
  return count;
1877
1904
  }
@@ -2099,9 +2126,15 @@ async function runInitAction(options) {
2099
2126
  const routingPolicy = deriveRoutingPolicy(DEFAULT_ROUTING_POLICY, configProviders);
2100
2127
  await mkdir(substrateDir, { recursive: true });
2101
2128
  const configHeader = "# Substrate Configuration\n# Generated by `substrate init`\n# Edit this file to customize your AI agent orchestration settings.\n# API keys must be set as environment variables — never stored here.\n#\n# Provider API key env vars:\n" + Object.entries(PROVIDER_KEY_ENV).map(([p, env]) => `# ${p}: ${env}`).join("\n") + "\n\n";
2102
- await writeFile(configPath, configHeader + yaml.dump(config), "utf-8");
2129
+ const configExists = existsSync$1(configPath);
2130
+ if (configExists && !force && nonInteractive) {
2131
+ if (outputFormat !== "json") process.stdout.write(" .substrate/config.yaml already exists — preserving (use --force to overwrite)\n");
2132
+ } else await writeFile(configPath, configHeader + yaml.dump(config), "utf-8");
2103
2133
  const routingHeader = "# Substrate Routing Policy\n# Defines how tasks are routed to AI providers.\n# Customize rules to match your workflow and available agents.\n\n";
2104
- await writeFile(routingPolicyPath, routingHeader + yaml.dump(routingPolicy), "utf-8");
2134
+ const routingExists = existsSync$1(routingPolicyPath);
2135
+ if (routingExists && !force && nonInteractive) {
2136
+ if (outputFormat !== "json") process.stdout.write(" .substrate/routing-policy.yaml already exists — preserving (use --force to overwrite)\n");
2137
+ } else await writeFile(routingPolicyPath, routingHeader + yaml.dump(routingPolicy), "utf-8");
2105
2138
  const projectProfilePath = join(substrateDir, "project-profile.yaml");
2106
2139
  let detectedProfile = null;
2107
2140
  let projectProfileWritten = false;
@@ -8507,7 +8540,7 @@ async function runSupervisorAction(options, deps = {}) {
8507
8540
  await initSchema(expAdapter);
8508
8541
  const { runRunAction: runPipeline } = await import(
8509
8542
  /* @vite-ignore */
8510
- "../run-NJIX3S8-.js"
8543
+ "../run-BMx6kY0E.js"
8511
8544
  );
8512
8545
  const runStoryFn = async (opts) => {
8513
8546
  const exitCode = await runPipeline({
@@ -2,7 +2,7 @@ import "./health-BtNrnj3J.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
4
  import "./dist-BUDAiEaH.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-BodUSLte.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-DAb4BgAO.js";
6
6
  import "./manifest-read-CKmTZKA5.js";
7
7
  import "./routing-DFxoKHDt.js";
8
8
  import "./work-graph-repository-DZyJv5pV.js";
@@ -46265,7 +46265,7 @@ async function runRunAction(options) {
46265
46265
  })
46266
46266
  });
46267
46267
  try {
46268
- const runsDir = join(dbDir, "runs");
46268
+ const runsDir$1 = join(dbDir, "runs");
46269
46269
  const cliFlags = {
46270
46270
  ...parsedStoryKeys.length > 0 ? { stories: parsedStoryKeys } : {},
46271
46271
  halt_on: haltOn ?? "critical",
@@ -46276,7 +46276,7 @@ async function runRunAction(options) {
46276
46276
  ...nonInteractive === true ? { non_interactive: true } : {},
46277
46277
  ...noWorktree === true ? { no_worktree: true } : {}
46278
46278
  };
46279
- const manifest = RunManifest.open(pipelineRun.id, runsDir);
46279
+ const manifest = RunManifest.open(pipelineRun.id, runsDir$1);
46280
46280
  await manifest.patchCLIFlags(cliFlags);
46281
46281
  await manifest.update({ run_status: "running" });
46282
46282
  } catch (err) {
@@ -46411,6 +46411,11 @@ async function runRunAction(options) {
46411
46411
  } catch (err) {
46412
46412
  logger.debug({ err }, "Failed to finalize dry-run manifest (non-fatal)");
46413
46413
  }
46414
+ try {
46415
+ await updatePipelineRun(adapter, pipelineRun.id, { status: "completed" });
46416
+ } catch (err) {
46417
+ logger.debug({ err }, "Failed to finalize dry-run Dolt pipeline_runs (non-fatal)");
46418
+ }
46414
46419
  return 0;
46415
46420
  }
46416
46421
  const dispatcher = createDispatcher({
@@ -46799,11 +46804,16 @@ async function runRunAction(options) {
46799
46804
  } catch (metricsErr) {
46800
46805
  logger.warn({ err: metricsErr }, "Failed to write run metrics (best-effort)");
46801
46806
  }
46807
+ const runsDir = join(dbDir, "runs");
46808
+ const terminalStatus = failedKeys.length > 0 || escalatedKeys.length > 0 ? "failed" : "completed";
46802
46809
  try {
46803
- const runsDir = join(dbDir, "runs");
46804
- const terminalStatus = failedKeys.length > 0 || escalatedKeys.length > 0 ? "failed" : "completed";
46805
46810
  await RunManifest.open(pipelineRun.id, runsDir).update({ run_status: terminalStatus });
46806
46811
  } catch {}
46812
+ try {
46813
+ await updatePipelineRun(adapter, pipelineRun.id, { status: terminalStatus });
46814
+ } catch (err) {
46815
+ logger.debug({ err }, "Failed to finalize Dolt pipeline_runs status (non-fatal)");
46816
+ }
46807
46817
  if (progressRenderer !== void 0) progressRenderer.render({
46808
46818
  type: "pipeline:complete",
46809
46819
  ts: new Date().toISOString(),
@@ -46861,8 +46871,8 @@ async function runRunAction(options) {
46861
46871
  reason: "non-interactive: stdin prompt suppressed"
46862
46872
  });
46863
46873
  try {
46864
- const runsDir = join(dbDir, "runs");
46865
- const runManifestForHalt = RunManifest.open(pipelineRun.id, runsDir);
46874
+ const runsDir$1 = join(dbDir, "runs");
46875
+ const runManifestForHalt = RunManifest.open(pipelineRun.id, runsDir$1);
46866
46876
  await runManifestForHalt.update({ cli_flags: {
46867
46877
  halt_on: haltPolicy,
46868
46878
  halt_skipped: true,
@@ -46889,8 +46899,8 @@ async function runRunAction(options) {
46889
46899
  return derivedCode;
46890
46900
  }
46891
46901
  if (verifyAc === true) try {
46892
- const runsDir = join(dbDir, "runs");
46893
- const runManifestForAc = RunManifest.open(pipelineRun.id, runsDir);
46902
+ const runsDir$1 = join(dbDir, "runs");
46903
+ const runManifestForAc = RunManifest.open(pipelineRun.id, runsDir$1);
46894
46904
  const manifestData = await runManifestForAc.read();
46895
46905
  const artifactsDir = join(dbRoot, "_bmad-output", "implementation-artifacts");
46896
46906
  const acResults = {};
@@ -47528,4 +47538,4 @@ function registerRunCommand(program, version = "0.0.0", projectRoot = process.cw
47528
47538
 
47529
47539
  //#endregion
47530
47540
  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 };
47531
- //# sourceMappingURL=run-BodUSLte.js.map
47541
+ //# sourceMappingURL=run-DAb4BgAO.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.20.131",
3
+ "version": "0.20.133",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",