substrate-ai 0.16.1 → 0.16.3

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, EXPERIMENT_RESULT, 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, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRequirements, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-CLvAwmT7.js";
6
6
  import "../adapter-registry-DXLMTmfD.js";
7
- import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-C7m0gTBv.js";
7
+ import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-OxbO6gfq.js";
8
8
  import "../errors-D1LU8CZ9.js";
9
9
  import "../routing-CcBOCuC9.js";
10
10
  import "../decisions-C0pz9Clx.js";
@@ -4359,7 +4359,7 @@ async function runSupervisorAction(options, deps = {}) {
4359
4359
  await initSchema(expAdapter);
4360
4360
  const { runRunAction: runPipeline } = await import(
4361
4361
  /* @vite-ignore */
4362
- "../run-Cfm9wW8m.js"
4362
+ "../run-gmxBhQFJ.js"
4363
4363
  );
4364
4364
  const runStoryFn = async (opts) => {
4365
4365
  const exitCode = await runPipeline({
@@ -8647,6 +8647,15 @@ function registerEpicStatusCommand(program) {
8647
8647
  });
8648
8648
  }
8649
8649
 
8650
+ //#endregion
8651
+ //#region src/cli/commands/factory.ts
8652
+ function registerFactoryCommand$1(program) {
8653
+ registerFactoryCommand(program, { createAdapter: (basePath) => createDatabaseAdapter({
8654
+ backend: "auto",
8655
+ basePath
8656
+ }) });
8657
+ }
8658
+
8650
8659
  //#endregion
8651
8660
  //#region src/cli/index.ts
8652
8661
  process.setMaxListeners(20);
@@ -8710,7 +8719,7 @@ async function createProgram() {
8710
8719
  registerIngestEpicCommand(program);
8711
8720
  registerEpicStatusCommand(program);
8712
8721
  registerScenariosCommand(program);
8713
- registerFactoryCommand(program);
8722
+ registerFactoryCommand$1(program);
8714
8723
  registerUpgradeCommand(program);
8715
8724
  return program;
8716
8725
  }
@@ -16648,6 +16648,22 @@ function createSdlcPhaseHandler(deps) {
16648
16648
  };
16649
16649
  const runId = context.getString("runId");
16650
16650
  const concept = phaseName === "analysis" ? context.getString("concept", "") : "";
16651
+ const PHASE_ARTIFACT_TYPES = {
16652
+ analysis: "product-brief",
16653
+ planning: "prd",
16654
+ solutioning: "stories"
16655
+ };
16656
+ const artifactType = PHASE_ARTIFACT_TYPES[phaseName];
16657
+ if (artifactType !== void 0) try {
16658
+ const db = deps.phaseDeps.db;
16659
+ if (db) {
16660
+ const rows = await db.query("SELECT id FROM artifacts WHERE phase = ? AND type = ? LIMIT 1", [phaseName, artifactType]);
16661
+ if (Array.isArray(rows) && rows.length > 0) return {
16662
+ status: "SUCCESS",
16663
+ notes: `Phase ${phaseName} already complete — artifact '${artifactType}' exists, skipping dispatch`
16664
+ };
16665
+ }
16666
+ } catch {}
16651
16667
  const params = phaseName === "analysis" ? {
16652
16668
  runId,
16653
16669
  concept
@@ -28564,14 +28580,14 @@ function registerScenariosCommand(program) {
28564
28580
  const runner = createScenarioRunner();
28565
28581
  const manifest = await store.discover(process.cwd());
28566
28582
  const results = await runner.run(manifest, process.cwd());
28567
- if (opts.format === "json") console.log(JSON.stringify(results));
28583
+ if (opts.format === "json") process.stdout.write(JSON.stringify(results) + "\n");
28568
28584
  else {
28569
28585
  const { total, passed, failed } = results.summary;
28570
- console.log(`Scenarios: ${passed} passed, ${failed} failed, ${total} total`);
28586
+ process.stdout.write(`Scenarios: ${passed} passed, ${failed} failed, ${total} total\n`);
28571
28587
  for (const scenario of results.scenarios) {
28572
28588
  const statusMark = scenario.status === "pass" ? "PASS" : "FAIL";
28573
- console.log(` [${statusMark}] ${scenario.name} (${scenario.durationMs}ms)`);
28574
- if (scenario.status === "fail" && scenario.stderr) console.log(` Error: ${scenario.stderr}`);
28589
+ process.stdout.write(` [${statusMark}] ${scenario.name} (${scenario.durationMs}ms)\n`);
28590
+ if (scenario.status === "fail" && scenario.stderr) process.stdout.write(` Error: ${scenario.stderr}\n`);
28575
28591
  }
28576
28592
  }
28577
28593
  });
@@ -28579,10 +28595,10 @@ function registerScenariosCommand(program) {
28579
28595
  const store = new ScenarioStore();
28580
28596
  const manifest = await store.discover(process.cwd());
28581
28597
  if (manifest.scenarios.length === 0) {
28582
- console.log("No scenarios found in .substrate/scenarios/");
28598
+ process.stdout.write("No scenarios found in .substrate/scenarios/\n");
28583
28599
  return;
28584
28600
  }
28585
- for (const entry of manifest.scenarios) console.log(`${entry.name}\t${entry.checksum}`);
28601
+ for (const entry of manifest.scenarios) process.stdout.write(`${entry.name}\t${entry.checksum}\n`);
28586
28602
  });
28587
28603
  }
28588
28604
 
@@ -29222,7 +29238,7 @@ const TOTAL_RULE_COUNT = 13;
29222
29238
  * Story 44-9: registers the `run` subcommand.
29223
29239
  * Story 46-7: registers the `validate` subcommand.
29224
29240
  */
29225
- function registerFactoryCommand(program) {
29241
+ function registerFactoryCommand(program, options) {
29226
29242
  const factoryCmd = program.command("factory").description("Factory pipeline and scenario management commands");
29227
29243
  registerScenariosCommand(factoryCmd);
29228
29244
  factoryCmd.command("run").description("Execute a DOT graph pipeline").option("--graph <path>", "Path to DOT graph file").option("--config <path>", "Path to config.yaml (default: auto-detect)").option("--events", "Emit NDJSON events to stdout").action(async (opts) => {
@@ -29265,13 +29281,13 @@ function registerFactoryCommand(program) {
29265
29281
  await stateManager.initRun(dotSource);
29266
29282
  /** wallClockCapMs: FactoryConfig.wall_clock_cap_seconds × 1000 (story 45-10) */
29267
29283
  const factoryConfig = await loadFactoryConfig(projectDir, opts.config);
29268
- const adapter = createDatabaseAdapter$1({
29284
+ const adapter = options?.createAdapter ? options.createAdapter(projectDir) : createDatabaseAdapter$1({
29269
29285
  backend: "auto",
29270
29286
  basePath: projectDir
29271
29287
  });
29272
29288
  await factorySchema(adapter);
29273
29289
  const executor = createGraphExecutor();
29274
- await executor.run(graph, {
29290
+ const result = await executor.run(graph, {
29275
29291
  runId,
29276
29292
  logsRoot,
29277
29293
  handlerRegistry: createDefaultRegistry(),
@@ -29285,6 +29301,8 @@ function registerFactoryCommand(program) {
29285
29301
  satisfactionThreshold: factoryConfig.factory?.satisfaction_threshold ?? .8,
29286
29302
  qualityMode: factoryConfig.factory?.quality_mode ?? "dual-signal"
29287
29303
  });
29304
+ if (result.status === "SUCCESS") process.stdout.write("Pipeline completed successfully.\n");
29305
+ else process.stderr.write("Pipeline failed: " + (result.failureReason ?? result.status) + "\n");
29288
29306
  } catch (err) {
29289
29307
  const msg = err instanceof Error ? err.message : String(err);
29290
29308
  process.stderr.write(`Error: ${msg}\n`);
@@ -30967,4 +30985,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
30967
30985
 
30968
30986
  //#endregion
30969
30987
  export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, normalizeGraphSummaryToStatus, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
30970
- //# sourceMappingURL=run-C7m0gTBv.js.map
30988
+ //# sourceMappingURL=run-OxbO6gfq.js.map
@@ -2,7 +2,7 @@ import "./health-DswaC1q5.js";
2
2
  import "./logger-KeHncl-f.js";
3
3
  import "./helpers-CElYrONe.js";
4
4
  import "./dist-CLvAwmT7.js";
5
- import { normalizeGraphSummaryToStatus, registerRunCommand, runRunAction } from "./run-C7m0gTBv.js";
5
+ import { normalizeGraphSummaryToStatus, registerRunCommand, runRunAction } from "./run-OxbO6gfq.js";
6
6
  import "./routing-CcBOCuC9.js";
7
7
  import "./decisions-C0pz9Clx.js";
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "substrate-ai",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "description": "Substrate — multi-agent orchestration daemon for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",