substrate-ai 0.16.2 → 0.16.4
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-CTgERHIt.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-fic7JEAv.js"
|
|
4363
4363
|
);
|
|
4364
4364
|
const runStoryFn = async (opts) => {
|
|
4365
4365
|
const exitCode = await runPipeline({
|
|
@@ -7,7 +7,7 @@ import { access, readFile, readdir, stat } from "fs/promises";
|
|
|
7
7
|
import { EventEmitter } from "node:events";
|
|
8
8
|
import yaml from "js-yaml";
|
|
9
9
|
import * as actualFS from "node:fs";
|
|
10
|
-
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
10
|
+
import { accessSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, unwatchFile, watchFile, writeFileSync } from "node:fs";
|
|
11
11
|
import { execFile, execSync, spawn } from "node:child_process";
|
|
12
12
|
import path, { dirname as dirname$1, extname as extname$1, join as join$1, posix, resolve as resolve$1, win32 } from "node:path";
|
|
13
13
|
import { tmpdir } from "node:os";
|
|
@@ -28580,14 +28580,14 @@ function registerScenariosCommand(program) {
|
|
|
28580
28580
|
const runner = createScenarioRunner();
|
|
28581
28581
|
const manifest = await store.discover(process.cwd());
|
|
28582
28582
|
const results = await runner.run(manifest, process.cwd());
|
|
28583
|
-
if (opts.format === "json")
|
|
28583
|
+
if (opts.format === "json") process.stdout.write(JSON.stringify(results) + "\n");
|
|
28584
28584
|
else {
|
|
28585
28585
|
const { total, passed, failed } = results.summary;
|
|
28586
|
-
|
|
28586
|
+
process.stdout.write(`Scenarios: ${passed} passed, ${failed} failed, ${total} total\n`);
|
|
28587
28587
|
for (const scenario of results.scenarios) {
|
|
28588
28588
|
const statusMark = scenario.status === "pass" ? "PASS" : "FAIL";
|
|
28589
|
-
|
|
28590
|
-
if (scenario.status === "fail" && 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`);
|
|
28591
28591
|
}
|
|
28592
28592
|
}
|
|
28593
28593
|
});
|
|
@@ -28595,10 +28595,10 @@ function registerScenariosCommand(program) {
|
|
|
28595
28595
|
const store = new ScenarioStore();
|
|
28596
28596
|
const manifest = await store.discover(process.cwd());
|
|
28597
28597
|
if (manifest.scenarios.length === 0) {
|
|
28598
|
-
|
|
28598
|
+
process.stdout.write("No scenarios found in .substrate/scenarios/\n");
|
|
28599
28599
|
return;
|
|
28600
28600
|
}
|
|
28601
|
-
for (const entry of manifest.scenarios)
|
|
28601
|
+
for (const entry of manifest.scenarios) process.stdout.write(`${entry.name}\t${entry.checksum}\n`);
|
|
28602
28602
|
});
|
|
28603
28603
|
}
|
|
28604
28604
|
|
|
@@ -29094,6 +29094,20 @@ const FactoryExtendedConfigSchema = SubstrateConfigSchema.extend({ factory: Fact
|
|
|
29094
29094
|
* @param explicitConfigPath - Optional explicit path to the config file (e.g. from `--config` flag).
|
|
29095
29095
|
* @returns Parsed and validated `FactoryExtendedConfig` with all defaults applied.
|
|
29096
29096
|
*/
|
|
29097
|
+
/**
|
|
29098
|
+
* Resolve the config file path without loading it.
|
|
29099
|
+
* Returns the first existing path, or null if no config file found.
|
|
29100
|
+
*/
|
|
29101
|
+
function resolveConfigPath(projectDir, explicitConfigPath) {
|
|
29102
|
+
const candidates = explicitConfigPath ? [explicitConfigPath] : [path.join(projectDir, ".substrate", "config.yaml"), path.join(projectDir, "config.yaml")];
|
|
29103
|
+
for (const candidate of candidates) try {
|
|
29104
|
+
accessSync(candidate);
|
|
29105
|
+
return candidate;
|
|
29106
|
+
} catch {
|
|
29107
|
+
continue;
|
|
29108
|
+
}
|
|
29109
|
+
return null;
|
|
29110
|
+
}
|
|
29097
29111
|
async function loadFactoryConfig(projectDir, explicitConfigPath) {
|
|
29098
29112
|
const configPaths = explicitConfigPath ? [explicitConfigPath] : [path.join(projectDir, ".substrate", "config.yaml"), path.join(projectDir, "config.yaml")];
|
|
29099
29113
|
for (const configPath of configPaths) try {
|
|
@@ -29287,7 +29301,7 @@ function registerFactoryCommand(program, options) {
|
|
|
29287
29301
|
});
|
|
29288
29302
|
await factorySchema(adapter);
|
|
29289
29303
|
const executor = createGraphExecutor();
|
|
29290
|
-
|
|
29304
|
+
const executorConfig = {
|
|
29291
29305
|
runId,
|
|
29292
29306
|
logsRoot,
|
|
29293
29307
|
handlerRegistry: createDefaultRegistry(),
|
|
@@ -29300,7 +29314,33 @@ function registerFactoryCommand(program, options) {
|
|
|
29300
29314
|
plateauThreshold: factoryConfig.factory?.plateau_threshold ?? .05,
|
|
29301
29315
|
satisfactionThreshold: factoryConfig.factory?.satisfaction_threshold ?? .8,
|
|
29302
29316
|
qualityMode: factoryConfig.factory?.quality_mode ?? "dual-signal"
|
|
29303
|
-
}
|
|
29317
|
+
};
|
|
29318
|
+
const configPath = resolveConfigPath(projectDir, opts.config);
|
|
29319
|
+
let watchingConfig = false;
|
|
29320
|
+
if (configPath) try {
|
|
29321
|
+
watchFile(configPath, { interval: 2e3 }, async () => {
|
|
29322
|
+
try {
|
|
29323
|
+
const updated = await loadFactoryConfig(projectDir, opts.config);
|
|
29324
|
+
const newThreshold = updated.factory?.satisfaction_threshold ?? .8;
|
|
29325
|
+
if (newThreshold !== executorConfig.satisfactionThreshold) {
|
|
29326
|
+
const oldThreshold = executorConfig.satisfactionThreshold;
|
|
29327
|
+
executorConfig.satisfactionThreshold = newThreshold;
|
|
29328
|
+
process.stderr.write(`[hot-reload] satisfaction_threshold changed: ${oldThreshold} → ${newThreshold}\n`);
|
|
29329
|
+
}
|
|
29330
|
+
} catch {}
|
|
29331
|
+
});
|
|
29332
|
+
watchingConfig = true;
|
|
29333
|
+
} catch {}
|
|
29334
|
+
let result;
|
|
29335
|
+
try {
|
|
29336
|
+
result = await executor.run(graph, executorConfig);
|
|
29337
|
+
} finally {
|
|
29338
|
+
if (watchingConfig && configPath) try {
|
|
29339
|
+
unwatchFile(configPath);
|
|
29340
|
+
} catch {}
|
|
29341
|
+
}
|
|
29342
|
+
if (result.status === "SUCCESS") process.stdout.write("Pipeline completed successfully.\n");
|
|
29343
|
+
else process.stderr.write("Pipeline failed: " + (result.failureReason ?? result.status) + "\n");
|
|
29304
29344
|
} catch (err) {
|
|
29305
29345
|
const msg = err instanceof Error ? err.message : String(err);
|
|
29306
29346
|
process.stderr.write(`Error: ${msg}\n`);
|
|
@@ -30983,4 +31023,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
|
|
|
30983
31023
|
|
|
30984
31024
|
//#endregion
|
|
30985
31025
|
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 };
|
|
30986
|
-
//# sourceMappingURL=run-
|
|
31026
|
+
//# sourceMappingURL=run-CTgERHIt.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-
|
|
5
|
+
import { normalizeGraphSummaryToStatus, registerRunCommand, runRunAction } from "./run-CTgERHIt.js";
|
|
6
6
|
import "./routing-CcBOCuC9.js";
|
|
7
7
|
import "./decisions-C0pz9Clx.js";
|
|
8
8
|
|