substrate-ai 0.16.0 → 0.16.2
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-
|
|
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-kMR_WxuS.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-
|
|
4362
|
+
"../run-iWTnlU1d.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
|
}
|
|
@@ -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-
|
|
5
|
+
import { normalizeGraphSummaryToStatus, registerRunCommand, runRunAction } from "./run-kMR_WxuS.js";
|
|
6
6
|
import "./routing-CcBOCuC9.js";
|
|
7
7
|
import "./decisions-C0pz9Clx.js";
|
|
8
8
|
|
|
@@ -15,6 +15,7 @@ import { createHash, randomUUID } from "node:crypto";
|
|
|
15
15
|
import { z } from "zod";
|
|
16
16
|
import { access as access$1, lstat, mkdir as mkdir$1, readFile as readFile$1, readdir as readdir$1, readlink, realpath, stat as stat$1, unlink, writeFile as writeFile$1 } from "node:fs/promises";
|
|
17
17
|
import { existsSync as existsSync$1, lstatSync, mkdirSync as mkdirSync$1, readFileSync as readFileSync$1, readdir as readdir$2, readdirSync as readdirSync$1, readlinkSync, realpathSync, unlinkSync, writeFileSync as writeFileSync$1 } from "fs";
|
|
18
|
+
import { createRequire } from "node:module";
|
|
18
19
|
import { fileURLToPath } from "node:url";
|
|
19
20
|
import { createHash as createHash$1 } from "crypto";
|
|
20
21
|
import { spawn as spawn$1 } from "child_process";
|
|
@@ -16647,6 +16648,22 @@ function createSdlcPhaseHandler(deps) {
|
|
|
16647
16648
|
};
|
|
16648
16649
|
const runId = context.getString("runId");
|
|
16649
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 {}
|
|
16650
16667
|
const params = phaseName === "analysis" ? {
|
|
16651
16668
|
runId,
|
|
16652
16669
|
concept
|
|
@@ -17036,12 +17053,26 @@ const __dirname = dirname$1(fileURLToPath(import.meta.url));
|
|
|
17036
17053
|
/**
|
|
17037
17054
|
* Returns the absolute path to the bundled SDLC pipeline DOT file.
|
|
17038
17055
|
*
|
|
17039
|
-
*
|
|
17040
|
-
*
|
|
17041
|
-
*
|
|
17056
|
+
* Resolution order:
|
|
17057
|
+
* 1. Relative to __dirname (works in source/unbundled: __dirname = packages/sdlc/src/orchestrator/)
|
|
17058
|
+
* 2. Via createRequire to locate @substrate-ai/sdlc package.json, then graphs/ relative to it
|
|
17059
|
+
* (works when bundled: __dirname points to dist/ but createRequire finds the real package)
|
|
17060
|
+
*
|
|
17061
|
+
* @throws {Error} if the DOT file cannot be found by any method.
|
|
17042
17062
|
*/
|
|
17043
17063
|
function resolveGraphPath$1() {
|
|
17044
|
-
|
|
17064
|
+
const candidates = [
|
|
17065
|
+
join$1(__dirname, "../../graphs/sdlc-pipeline.dot"),
|
|
17066
|
+
join$1(__dirname, "../graphs/sdlc-pipeline.dot"),
|
|
17067
|
+
join$1(__dirname, "graphs/sdlc-pipeline.dot")
|
|
17068
|
+
];
|
|
17069
|
+
try {
|
|
17070
|
+
const require$1 = createRequire(import.meta.url);
|
|
17071
|
+
const sdlcPkgPath = require$1.resolve("@substrate-ai/sdlc/package.json");
|
|
17072
|
+
candidates.push(join$1(dirname$1(sdlcPkgPath), "graphs", "sdlc-pipeline.dot"));
|
|
17073
|
+
} catch {}
|
|
17074
|
+
for (const candidate of candidates) if (existsSync(candidate)) return candidate;
|
|
17075
|
+
throw new Error(`Cannot locate sdlc-pipeline.dot. Searched:\n${candidates.map((c) => ` ${c}`).join("\n")}`);
|
|
17045
17076
|
}
|
|
17046
17077
|
/** Thrown by `createGraphOrchestrator` when the supplied graph is structurally invalid. */
|
|
17047
17078
|
var GraphOrchestratorInitError = class extends Error {
|
|
@@ -17067,7 +17098,11 @@ function createGraphOrchestrator(config) {
|
|
|
17067
17098
|
const initialContext = {
|
|
17068
17099
|
storyKey,
|
|
17069
17100
|
projectRoot: config.projectRoot,
|
|
17070
|
-
methodologyPack: config.methodologyPack
|
|
17101
|
+
methodologyPack: config.methodologyPack,
|
|
17102
|
+
...config.pipelineRunId !== void 0 ? {
|
|
17103
|
+
runId: config.pipelineRunId,
|
|
17104
|
+
pipelineRunId: config.pipelineRunId
|
|
17105
|
+
} : {}
|
|
17071
17106
|
};
|
|
17072
17107
|
const factoryBus = new EventEmitter();
|
|
17073
17108
|
const bridge = config.eventBus != null ? createSdlcEventBridge({
|
|
@@ -22956,7 +22991,7 @@ function createGraphExecutor() {
|
|
|
22956
22991
|
};
|
|
22957
22992
|
let completedNodes = [];
|
|
22958
22993
|
let nodeRetries = {};
|
|
22959
|
-
let context = new GraphContext();
|
|
22994
|
+
let context = new GraphContext(config.initialContext);
|
|
22960
22995
|
let step = 0;
|
|
22961
22996
|
const visitCount = new Map();
|
|
22962
22997
|
let resumeCompletedSet = null;
|
|
@@ -29203,7 +29238,7 @@ const TOTAL_RULE_COUNT = 13;
|
|
|
29203
29238
|
* Story 44-9: registers the `run` subcommand.
|
|
29204
29239
|
* Story 46-7: registers the `validate` subcommand.
|
|
29205
29240
|
*/
|
|
29206
|
-
function registerFactoryCommand(program) {
|
|
29241
|
+
function registerFactoryCommand(program, options) {
|
|
29207
29242
|
const factoryCmd = program.command("factory").description("Factory pipeline and scenario management commands");
|
|
29208
29243
|
registerScenariosCommand(factoryCmd);
|
|
29209
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) => {
|
|
@@ -29246,7 +29281,7 @@ function registerFactoryCommand(program) {
|
|
|
29246
29281
|
await stateManager.initRun(dotSource);
|
|
29247
29282
|
/** wallClockCapMs: FactoryConfig.wall_clock_cap_seconds × 1000 (story 45-10) */
|
|
29248
29283
|
const factoryConfig = await loadFactoryConfig(projectDir, opts.config);
|
|
29249
|
-
const adapter = createDatabaseAdapter$1({
|
|
29284
|
+
const adapter = options?.createAdapter ? options.createAdapter(projectDir) : createDatabaseAdapter$1({
|
|
29250
29285
|
backend: "auto",
|
|
29251
29286
|
basePath: projectDir
|
|
29252
29287
|
});
|
|
@@ -29499,7 +29534,7 @@ function registerFactoryCommand(program) {
|
|
|
29499
29534
|
* @returns A HandlerRegistry with all four SDLC handlers registered.
|
|
29500
29535
|
*/
|
|
29501
29536
|
function buildSdlcHandlerRegistry(deps) {
|
|
29502
|
-
const registry =
|
|
29537
|
+
const registry = createDefaultRegistry();
|
|
29503
29538
|
registry.register("sdlc.phase", createSdlcPhaseHandler(deps.phaseHandlerDeps));
|
|
29504
29539
|
registry.register("sdlc.create-story", createSdlcCreateStoryHandler(deps.createStoryOptions));
|
|
29505
29540
|
registry.register("sdlc.dev-story", createSdlcDevStoryHandler(deps.devStoryOptions));
|
|
@@ -30948,4 +30983,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
|
|
|
30948
30983
|
|
|
30949
30984
|
//#endregion
|
|
30950
30985
|
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 };
|
|
30951
|
-
//# sourceMappingURL=run-
|
|
30986
|
+
//# sourceMappingURL=run-kMR_WxuS.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "substrate-ai",
|
|
3
|
-
"version": "0.16.
|
|
3
|
+
"version": "0.16.2",
|
|
4
4
|
"description": "Substrate — multi-agent orchestration daemon for AI coding agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"scripts": {
|
|
50
50
|
"agent-memory:bootstrap": "node scripts/bootstrap-agent-memory.mjs",
|
|
51
51
|
"build": "tsc --build packages/core packages/sdlc packages/factory && tsdown",
|
|
52
|
-
"postbuild": "cp -r src/cli/templates dist/cli/templates && cp src/modules/state/schema.sql dist/schema.sql",
|
|
52
|
+
"postbuild": "cp -r src/cli/templates dist/cli/templates && cp src/modules/state/schema.sql dist/schema.sql && mkdir -p dist/graphs && cp packages/sdlc/graphs/sdlc-pipeline.dot dist/graphs/",
|
|
53
53
|
"check:circular": "dpdm --no-warning --exit-code circular:1 packages/core/src/index.ts packages/sdlc/src/index.ts packages/factory/src/index.ts",
|
|
54
54
|
"dev": "tsx watch src/cli/index.ts",
|
|
55
55
|
"test": "vitest run --coverage",
|