substrate-ai 0.2.9 → 0.2.11
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
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { createLogger, deepMask } from "../logger-C6n1g8uP.js";
|
|
3
3
|
import { AdapterRegistry, createEventBus } from "../event-bus-J-bw-pkp.js";
|
|
4
4
|
import { CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, PartialSubstrateConfigSchema, SUPPORTED_CONFIG_FORMAT_VERSIONS, SubstrateConfigSchema, defaultConfigMigrator } from "../version-manager-impl-BpVx2DkY.js";
|
|
5
|
-
import { DatabaseWrapper, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createContextCompiler, createDispatcher, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, runAnalysisPhase, runMigrations, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-
|
|
5
|
+
import { DatabaseWrapper, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createContextCompiler, createDispatcher, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, runAnalysisPhase, runMigrations, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-L-R_XYNT.js";
|
|
6
6
|
import { ConfigError, ConfigIncompatibleFormatError } from "../errors-BPqtzQ4U.js";
|
|
7
7
|
import { addTokenUsage, createDecision, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getTokenUsageSummary, listRequirements, updatePipelineRun } from "../decisions-DNYByk0U.js";
|
|
8
8
|
import { aggregateTokenUsageForRun, compareRunMetrics, getBaselineRunMetrics, getRunMetrics, getStoryMetricsForRun, incrementRunRestarts, listRunMetrics, tagRunAsBaseline } from "../metrics-BSg8VIHd.js";
|
|
@@ -2833,7 +2833,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
2833
2833
|
const expDb = expDbWrapper.db;
|
|
2834
2834
|
const { runRunAction: runPipeline } = await import(
|
|
2835
2835
|
/* @vite-ignore */
|
|
2836
|
-
"../run-
|
|
2836
|
+
"../run-C8aOWnKG.js"
|
|
2837
2837
|
);
|
|
2838
2838
|
const runStoryFn = async (opts) => {
|
|
2839
2839
|
const exitCode = await runPipeline({
|
|
@@ -2973,6 +2973,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
2973
2973
|
function registerSupervisorCommand(program, _version = "0.0.0", projectRoot = process.cwd()) {
|
|
2974
2974
|
program.command("supervisor").description("Monitor a pipeline run and automatically recover from stalls").option("--poll-interval <seconds>", "Health poll interval in seconds", (v) => parseInt(v, 10), 60).option("--stall-threshold <seconds>", "Staleness in seconds before killing a stalled pipeline", (v) => parseInt(v, 10), 600).option("--max-restarts <n>", "Maximum automatic restarts before aborting", (v) => parseInt(v, 10), 3).option("--run-id <id>", "Pipeline run ID to monitor (defaults to latest)").option("--pack <name>", "Methodology pack name", "bmad").option("--project-root <path>", "Project root directory", projectRoot).option("--output-format <format>", "Output format: human (default) or json", "human").option("--experiment", "After post-run analysis, enter experiment mode: create branches, apply modifications, run single-story experiments, and report verdicts (Story 17-4)", false).option("--max-experiments <n>", "Maximum number of experiments to run per analysis cycle (default: 2, Story 17-4 AC6)", (v) => parseInt(v, 10), 2).action(async (opts) => {
|
|
2975
2975
|
const outputFormat = opts.outputFormat === "json" ? "json" : "human";
|
|
2976
|
+
if (opts.stallThreshold < 120) console.warn(`Warning: --stall-threshold ${opts.stallThreshold}s is below 120s. Agent steps typically take 45-90s. This may cause false stall detections and wasted restarts.`);
|
|
2976
2977
|
const exitCode = await runSupervisorAction({
|
|
2977
2978
|
pollInterval: opts.pollInterval,
|
|
2978
2979
|
stallThreshold: opts.stallThreshold,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./logger-C6n1g8uP.js";
|
|
2
2
|
import "./event-bus-J-bw-pkp.js";
|
|
3
|
-
import { registerRunCommand, runRunAction } from "./run-
|
|
3
|
+
import { registerRunCommand, runRunAction } from "./run-L-R_XYNT.js";
|
|
4
4
|
import "./decisions-DNYByk0U.js";
|
|
5
5
|
import "./metrics-BSg8VIHd.js";
|
|
6
6
|
|
|
@@ -874,6 +874,7 @@ function createPackLoader() {
|
|
|
874
874
|
*/
|
|
875
875
|
/** Canonical pipeline phase names. This is the single source of truth for all phase lists. */
|
|
876
876
|
const VALID_PHASES = [
|
|
877
|
+
"research",
|
|
877
878
|
"analysis",
|
|
878
879
|
"planning",
|
|
879
880
|
"solutioning",
|
|
@@ -2214,10 +2215,14 @@ Options:
|
|
|
2214
2215
|
- \`--stories <keys>\` — Comma-separated story keys to process (e.g., \`7-1,7-2\`)
|
|
2215
2216
|
- \`--verbose\` — Enable verbose logging output
|
|
2216
2217
|
- \`--pack <name>\` — Methodology pack name (default: bmad)
|
|
2217
|
-
- \`--from <phase>\` — Start from this phase: analysis, planning, solutioning, implementation
|
|
2218
|
+
- \`--from <phase>\` — Start from this phase: research, analysis, planning, solutioning, implementation
|
|
2218
2219
|
- \`--stop-after <phase>\` — Stop pipeline after this phase completes
|
|
2219
2220
|
- \`--concurrency <n>\` — Maximum parallel conflict groups (default: 3)
|
|
2220
2221
|
- \`--output-format <format>\` — Output format: human (default) or json
|
|
2222
|
+
- \`--concept <text>\` — Inline concept text (required when --from analysis)
|
|
2223
|
+
- \`--research\` — Enable the research phase even if not set in the pack config
|
|
2224
|
+
- \`--skip-research\` — Skip the research phase even if enabled in the pack config
|
|
2225
|
+
- \`--skip-ux\` — Skip the UX design phase even if enabled in the pack config
|
|
2221
2226
|
- \`--help-agent\` — Print this agent instruction fragment and exit
|
|
2222
2227
|
|
|
2223
2228
|
Examples:
|
|
@@ -2284,12 +2289,51 @@ Options:
|
|
|
2284
2289
|
- \`--analysis <run-id>\` — Read and output the analysis report with optimization recommendations for a specific run
|
|
2285
2290
|
- \`--output-format <format>\` — Output format: human (default) or json
|
|
2286
2291
|
|
|
2292
|
+
### substrate export
|
|
2293
|
+
Export decision store contents as human-readable markdown files.
|
|
2294
|
+
|
|
2295
|
+
\`\`\`
|
|
2296
|
+
substrate export [options]
|
|
2297
|
+
\`\`\`
|
|
2298
|
+
|
|
2299
|
+
Options:
|
|
2300
|
+
- \`--run-id <id>\` — Pipeline run ID to export (defaults to latest run)
|
|
2301
|
+
- \`--output-dir <path>\` — Directory to write exported files to (default: _bmad-output/planning-artifacts/)
|
|
2302
|
+
- \`--output-format <format>\` — Output format: human (default) or json
|
|
2303
|
+
|
|
2287
2304
|
### substrate health
|
|
2288
2305
|
Check pipeline health, stall detection, and process status.
|
|
2289
2306
|
|
|
2290
2307
|
\`\`\`
|
|
2291
2308
|
substrate health [--output-format json]
|
|
2292
2309
|
\`\`\`
|
|
2310
|
+
|
|
2311
|
+
### substrate cost
|
|
2312
|
+
Show cost breakdown for the current session.
|
|
2313
|
+
|
|
2314
|
+
\`\`\`
|
|
2315
|
+
substrate cost [--output-format json]
|
|
2316
|
+
\`\`\`
|
|
2317
|
+
|
|
2318
|
+
### substrate amend
|
|
2319
|
+
Run an amendment pipeline against a completed run.
|
|
2320
|
+
|
|
2321
|
+
\`\`\`
|
|
2322
|
+
substrate amend [options]
|
|
2323
|
+
\`\`\`
|
|
2324
|
+
|
|
2325
|
+
### substrate brainstorm
|
|
2326
|
+
Interactive multi-persona brainstorm session with Pragmatic Engineer, Product Thinker, and Devil's Advocate.
|
|
2327
|
+
|
|
2328
|
+
\`\`\`
|
|
2329
|
+
substrate brainstorm [options]
|
|
2330
|
+
\`\`\`
|
|
2331
|
+
|
|
2332
|
+
Session commands: \`!wrap\` (save & exit), \`!quit\` (exit without saving), \`!help\`
|
|
2333
|
+
|
|
2334
|
+
## Environment Variables
|
|
2335
|
+
|
|
2336
|
+
- \`SUBSTRATE_MEMORY_THRESHOLD_MB\` — Override the free-memory threshold (in MB) for agent dispatch. Default: 512. On macOS, the conservative memory detection may report low availability even when ample RAM exists. Lower this (e.g., 256) if pipelines stall due to memory pressure false positives.
|
|
2293
2337
|
`;
|
|
2294
2338
|
}
|
|
2295
2339
|
/**
|
|
@@ -2841,7 +2885,14 @@ const logger$12 = createLogger("agent-dispatch");
|
|
|
2841
2885
|
const SHUTDOWN_GRACE_MS = 1e4;
|
|
2842
2886
|
const SHUTDOWN_MAX_WAIT_MS = 3e4;
|
|
2843
2887
|
const CHARS_PER_TOKEN = 4;
|
|
2844
|
-
const MIN_FREE_MEMORY_BYTES =
|
|
2888
|
+
const MIN_FREE_MEMORY_BYTES = (() => {
|
|
2889
|
+
const envMB = process.env.SUBSTRATE_MEMORY_THRESHOLD_MB;
|
|
2890
|
+
if (envMB) {
|
|
2891
|
+
const parsed = parseInt(envMB, 10);
|
|
2892
|
+
if (!isNaN(parsed) && parsed >= 0) return parsed * 1024 * 1024;
|
|
2893
|
+
}
|
|
2894
|
+
return 512 * 1024 * 1024;
|
|
2895
|
+
})();
|
|
2845
2896
|
const MEMORY_PRESSURE_POLL_MS = 1e4;
|
|
2846
2897
|
/**
|
|
2847
2898
|
* Get available system memory in bytes, accounting for platform differences.
|
|
@@ -10281,7 +10332,7 @@ async function runRunAction(options) {
|
|
|
10281
10332
|
}
|
|
10282
10333
|
}
|
|
10283
10334
|
let concept;
|
|
10284
|
-
if (startPhase === "analysis" || startPhase === void 0) {
|
|
10335
|
+
if (startPhase === "research" || startPhase === "analysis" || startPhase === void 0) {
|
|
10285
10336
|
if (conceptFile !== void 0 && conceptFile !== "") try {
|
|
10286
10337
|
concept = await readFile(conceptFile, "utf-8");
|
|
10287
10338
|
} catch (err) {
|
|
@@ -10292,8 +10343,8 @@ async function runRunAction(options) {
|
|
|
10292
10343
|
return 1;
|
|
10293
10344
|
}
|
|
10294
10345
|
else if (conceptArg !== void 0 && conceptArg !== "") concept = conceptArg;
|
|
10295
|
-
else if (startPhase === "analysis") {
|
|
10296
|
-
const errorMsg = "--concept or --concept-file required when starting from analysis phase";
|
|
10346
|
+
else if (startPhase === "research" || startPhase === "analysis") {
|
|
10347
|
+
const errorMsg = "--concept or --concept-file required when starting from research or analysis phase";
|
|
10297
10348
|
if (outputFormat === "json") process.stdout.write(formatOutput(null, "json", false, errorMsg) + "\n");
|
|
10298
10349
|
else process.stderr.write(`Error: ${errorMsg}\n`);
|
|
10299
10350
|
return 1;
|
|
@@ -11102,4 +11153,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
|
|
|
11102
11153
|
|
|
11103
11154
|
//#endregion
|
|
11104
11155
|
export { DatabaseWrapper, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createContextCompiler, createDispatcher, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, findPackageRoot, formatOutput, formatPhaseCompletionSummary, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getSubstrateDefaultSettings, parseDbTimestampAsUtc, registerRunCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, resolveMainRepoRoot, runAnalysisPhase, runMigrations, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
|
|
11105
|
-
//# sourceMappingURL=run-
|
|
11156
|
+
//# sourceMappingURL=run-L-R_XYNT.js.map
|