substrate-ai 0.16.3 → 0.16.5
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-3sUmDFaj.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-CxN4St_1.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";
|
|
@@ -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 {
|
|
@@ -29143,8 +29157,8 @@ async function factorySchema(adapter) {
|
|
|
29143
29157
|
`);
|
|
29144
29158
|
await adapter.exec(`
|
|
29145
29159
|
CREATE TABLE IF NOT EXISTS graph_node_results (
|
|
29146
|
-
id INTEGER PRIMARY KEY
|
|
29147
|
-
run_id VARCHAR(255) NOT NULL
|
|
29160
|
+
id INTEGER PRIMARY KEY AUTO_INCREMENT,
|
|
29161
|
+
run_id VARCHAR(255) NOT NULL ,
|
|
29148
29162
|
node_id VARCHAR(255) NOT NULL,
|
|
29149
29163
|
attempt INTEGER NOT NULL DEFAULT 1,
|
|
29150
29164
|
status VARCHAR(32) NOT NULL,
|
|
@@ -29159,8 +29173,8 @@ async function factorySchema(adapter) {
|
|
|
29159
29173
|
await adapter.exec("CREATE INDEX IF NOT EXISTS idx_graph_node_results_run ON graph_node_results(run_id)");
|
|
29160
29174
|
await adapter.exec(`
|
|
29161
29175
|
CREATE TABLE IF NOT EXISTS scenario_results (
|
|
29162
|
-
id INTEGER PRIMARY KEY
|
|
29163
|
-
run_id VARCHAR(255) NOT NULL
|
|
29176
|
+
id INTEGER PRIMARY KEY AUTO_INCREMENT,
|
|
29177
|
+
run_id VARCHAR(255) NOT NULL ,
|
|
29164
29178
|
node_id VARCHAR(255) NOT NULL,
|
|
29165
29179
|
iteration INTEGER NOT NULL DEFAULT 1,
|
|
29166
29180
|
total_scenarios INTEGER NOT NULL,
|
|
@@ -29178,7 +29192,7 @@ async function factorySchema(adapter) {
|
|
|
29178
29192
|
CREATE TABLE IF NOT EXISTS twin_runs (
|
|
29179
29193
|
id VARCHAR(255) PRIMARY KEY,
|
|
29180
29194
|
run_id VARCHAR(255),
|
|
29181
|
-
twin_name
|
|
29195
|
+
twin_name VARCHAR(255) NOT NULL,
|
|
29182
29196
|
started_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
29183
29197
|
stopped_at DATETIME,
|
|
29184
29198
|
status VARCHAR(32) NOT NULL DEFAULT 'running',
|
|
@@ -29187,8 +29201,8 @@ async function factorySchema(adapter) {
|
|
|
29187
29201
|
`);
|
|
29188
29202
|
await adapter.exec(`
|
|
29189
29203
|
CREATE TABLE IF NOT EXISTS twin_health_failures (
|
|
29190
|
-
id INTEGER PRIMARY KEY
|
|
29191
|
-
twin_name
|
|
29204
|
+
id INTEGER PRIMARY KEY AUTO_INCREMENT,
|
|
29205
|
+
twin_name VARCHAR(255) NOT NULL,
|
|
29192
29206
|
run_id VARCHAR(255),
|
|
29193
29207
|
checked_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
29194
29208
|
error_message TEXT NOT NULL
|
|
@@ -29287,7 +29301,7 @@ function registerFactoryCommand(program, options) {
|
|
|
29287
29301
|
});
|
|
29288
29302
|
await factorySchema(adapter);
|
|
29289
29303
|
const executor = createGraphExecutor();
|
|
29290
|
-
const
|
|
29304
|
+
const executorConfig = {
|
|
29291
29305
|
runId,
|
|
29292
29306
|
logsRoot,
|
|
29293
29307
|
handlerRegistry: createDefaultRegistry(),
|
|
@@ -29300,7 +29314,31 @@ 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
|
+
}
|
|
29304
29342
|
if (result.status === "SUCCESS") process.stdout.write("Pipeline completed successfully.\n");
|
|
29305
29343
|
else process.stderr.write("Pipeline failed: " + (result.failureReason ?? result.status) + "\n");
|
|
29306
29344
|
} catch (err) {
|
|
@@ -30985,4 +31023,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
|
|
|
30985
31023
|
|
|
30986
31024
|
//#endregion
|
|
30987
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 };
|
|
30988
|
-
//# sourceMappingURL=run-
|
|
31026
|
+
//# sourceMappingURL=run-3sUmDFaj.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-3sUmDFaj.js";
|
|
6
6
|
import "./routing-CcBOCuC9.js";
|
|
7
7
|
import "./decisions-C0pz9Clx.js";
|
|
8
8
|
|