substrate-ai 0.20.131 → 0.20.132

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 });
@@ -1866,12 +1867,20 @@ function syncSkillsToTarget(srcSkillsDir, destSkillsDir, ownershipPrefixes, name
1866
1867
  for (const entry of sourceEntries) {
1867
1868
  const destName = namePrefix && !entry.name.startsWith(namePrefix) ? `${namePrefix}${entry.name}` : entry.name;
1868
1869
  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++;
1870
+ try {
1871
+ rmSync$1(dest, {
1872
+ recursive: true,
1873
+ force: true
1874
+ });
1875
+ cpSync(join(srcSkillsDir, entry.name), dest, { recursive: true });
1876
+ count++;
1877
+ } catch (err) {
1878
+ logger$18.warn({
1879
+ skill: entry.name,
1880
+ dest,
1881
+ err: err instanceof Error ? err.message : String(err)
1882
+ }, "Skipped skill due to copy error; continuing with the rest");
1883
+ }
1875
1884
  }
1876
1885
  return count;
1877
1886
  }
@@ -2099,9 +2108,15 @@ async function runInitAction(options) {
2099
2108
  const routingPolicy = deriveRoutingPolicy(DEFAULT_ROUTING_POLICY, configProviders);
2100
2109
  await mkdir(substrateDir, { recursive: true });
2101
2110
  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");
2111
+ const configExists = existsSync$1(configPath);
2112
+ if (configExists && !force) {
2113
+ if (outputFormat !== "json") process.stdout.write(" .substrate/config.yaml already exists — preserving (use --force to overwrite)\n");
2114
+ } else await writeFile(configPath, configHeader + yaml.dump(config), "utf-8");
2103
2115
  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");
2116
+ const routingExists = existsSync$1(routingPolicyPath);
2117
+ if (routingExists && !force) {
2118
+ if (outputFormat !== "json") process.stdout.write(" .substrate/routing-policy.yaml already exists — preserving (use --force to overwrite)\n");
2119
+ } else await writeFile(routingPolicyPath, routingHeader + yaml.dump(routingPolicy), "utf-8");
2105
2120
  const projectProfilePath = join(substrateDir, "project-profile.yaml");
2106
2121
  let detectedProfile = null;
2107
2122
  let projectProfileWritten = false;
@@ -8507,7 +8522,7 @@ async function runSupervisorAction(options, deps = {}) {
8507
8522
  await initSchema(expAdapter);
8508
8523
  const { runRunAction: runPipeline } = await import(
8509
8524
  /* @vite-ignore */
8510
- "../run-NJIX3S8-.js"
8525
+ "../run-BMx6kY0E.js"
8511
8526
  );
8512
8527
  const runStoryFn = async (opts) => {
8513
8528
  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.132",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",