substrate-ai 0.19.11 → 0.19.12
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, 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, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-adzGUKPc.js";
|
|
6
6
|
import "../adapter-registry-DXLMTmfD.js";
|
|
7
|
-
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-
|
|
7
|
+
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runSolutioningPhase, validateStopAfterFromConflict } from "../run-1Ywys7Fy.js";
|
|
8
8
|
import "../errors-CZdr5Wqb.js";
|
|
9
9
|
import "../routing-CcBOCuC9.js";
|
|
10
10
|
import "../decisions-C0pz9Clx.js";
|
|
@@ -2678,7 +2678,7 @@ function mapInternalPhaseToEventPhase(internalPhase) {
|
|
|
2678
2678
|
}
|
|
2679
2679
|
}
|
|
2680
2680
|
async function runResumeAction(options) {
|
|
2681
|
-
const { runId: specifiedRunId, stopAfter, outputFormat, projectRoot, concurrency, pack: packName, events: eventsFlag, registry, maxReviewCycles = 2, agent: agentId
|
|
2681
|
+
const { runId: specifiedRunId, stopAfter, outputFormat, projectRoot, concurrency, pack: packName, events: eventsFlag, registry, maxReviewCycles = 2, agent: agentId } = options;
|
|
2682
2682
|
if (stopAfter !== void 0 && !VALID_PHASES.includes(stopAfter)) {
|
|
2683
2683
|
const errorMsg = `Invalid phase: "${stopAfter}". Valid phases: ${VALID_PHASES.join(", ")}`;
|
|
2684
2684
|
if (outputFormat === "json") process.stdout.write(formatOutput(null, "json", false, errorMsg) + "\n");
|
|
@@ -2762,7 +2762,8 @@ async function runResumeAction(options) {
|
|
|
2762
2762
|
existingRunId: runId,
|
|
2763
2763
|
projectRoot,
|
|
2764
2764
|
registry,
|
|
2765
|
-
stories: options.stories ?? scopedStories
|
|
2765
|
+
stories: options.stories ?? scopedStories,
|
|
2766
|
+
agentId
|
|
2766
2767
|
});
|
|
2767
2768
|
} catch (err) {
|
|
2768
2769
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -2777,7 +2778,7 @@ async function runResumeAction(options) {
|
|
|
2777
2778
|
}
|
|
2778
2779
|
}
|
|
2779
2780
|
async function runFullPipelineFromPhase(options) {
|
|
2780
|
-
const { packName, packPath, dbDir, dbPath, startPhase, stopAfter, concept, concurrency, outputFormat, events: eventsFlag, existingRunId, projectRoot, registry: injectedRegistry, stories: explicitStories, maxReviewCycles = 2 } = options;
|
|
2781
|
+
const { packName, packPath, dbDir, dbPath, startPhase, stopAfter, concept, concurrency, outputFormat, events: eventsFlag, existingRunId, projectRoot, registry: injectedRegistry, stories: explicitStories, maxReviewCycles = 2, agentId } = options;
|
|
2781
2782
|
if (!existsSync$1(dbDir)) mkdirSync$1(dbDir, { recursive: true });
|
|
2782
2783
|
const adapter = createDatabaseAdapter({
|
|
2783
2784
|
backend: "auto",
|
|
@@ -2807,7 +2808,8 @@ async function runFullPipelineFromPhase(options) {
|
|
|
2807
2808
|
db: adapter,
|
|
2808
2809
|
pack,
|
|
2809
2810
|
contextCompiler,
|
|
2810
|
-
dispatcher
|
|
2811
|
+
dispatcher,
|
|
2812
|
+
agentId
|
|
2811
2813
|
};
|
|
2812
2814
|
const phaseOrchestrator = createPhaseOrchestrator({
|
|
2813
2815
|
db: adapter,
|
|
@@ -3750,7 +3752,7 @@ async function runPostPhaseSupersessionDetection(adapter, amendmentRunId, curren
|
|
|
3750
3752
|
}
|
|
3751
3753
|
}
|
|
3752
3754
|
async function runAmendAction(options) {
|
|
3753
|
-
const { concept: conceptArg, conceptFile, runId: specifiedRunId, stopAfter, from: startPhase, projectRoot, pack: packName, registry: injectedRegistry, agent: agentId
|
|
3755
|
+
const { concept: conceptArg, conceptFile, runId: specifiedRunId, stopAfter, from: startPhase, projectRoot, pack: packName, registry: injectedRegistry, agent: agentId } = options;
|
|
3754
3756
|
let concept;
|
|
3755
3757
|
if (conceptFile !== void 0 && conceptFile !== "") try {
|
|
3756
3758
|
concept = await readFile(conceptFile, "utf-8");
|
|
@@ -3849,7 +3851,7 @@ async function runAmendAction(options) {
|
|
|
3849
3851
|
pack,
|
|
3850
3852
|
contextCompiler,
|
|
3851
3853
|
dispatcher,
|
|
3852
|
-
agentId
|
|
3854
|
+
agentId
|
|
3853
3855
|
};
|
|
3854
3856
|
const phaseOrder = [
|
|
3855
3857
|
"analysis",
|
|
@@ -3893,7 +3895,7 @@ async function runAmendAction(options) {
|
|
|
3893
3895
|
const costUsd = (result.tokenUsage.input * 3 + result.tokenUsage.output * 15) / 1e6;
|
|
3894
3896
|
await addTokenUsage(adapter, amendmentRunId, {
|
|
3895
3897
|
phase: "analysis",
|
|
3896
|
-
agent: agentId
|
|
3898
|
+
agent: agentId ?? "claude-code",
|
|
3897
3899
|
input_tokens: result.tokenUsage.input,
|
|
3898
3900
|
output_tokens: result.tokenUsage.output,
|
|
3899
3901
|
cost_usd: costUsd
|
|
@@ -3915,7 +3917,7 @@ async function runAmendAction(options) {
|
|
|
3915
3917
|
const costUsd = (result.tokenUsage.input * 3 + result.tokenUsage.output * 15) / 1e6;
|
|
3916
3918
|
await addTokenUsage(adapter, amendmentRunId, {
|
|
3917
3919
|
phase: "planning",
|
|
3918
|
-
agent: agentId
|
|
3920
|
+
agent: agentId ?? "claude-code",
|
|
3919
3921
|
input_tokens: result.tokenUsage.input,
|
|
3920
3922
|
output_tokens: result.tokenUsage.output,
|
|
3921
3923
|
cost_usd: costUsd
|
|
@@ -3937,7 +3939,7 @@ async function runAmendAction(options) {
|
|
|
3937
3939
|
const costUsd = (result.tokenUsage.input * 3 + result.tokenUsage.output * 15) / 1e6;
|
|
3938
3940
|
await addTokenUsage(adapter, amendmentRunId, {
|
|
3939
3941
|
phase: "solutioning",
|
|
3940
|
-
agent: agentId
|
|
3942
|
+
agent: agentId ?? "claude-code",
|
|
3941
3943
|
input_tokens: result.tokenUsage.input,
|
|
3942
3944
|
output_tokens: result.tokenUsage.output,
|
|
3943
3945
|
cost_usd: costUsd
|
|
@@ -4553,7 +4555,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
4553
4555
|
await initSchema(expAdapter);
|
|
4554
4556
|
const { runRunAction: runPipeline } = await import(
|
|
4555
4557
|
/* @vite-ignore */
|
|
4556
|
-
"../run-
|
|
4558
|
+
"../run-zc3SEWY1.js"
|
|
4557
4559
|
);
|
|
4558
4560
|
const runStoryFn = async (opts) => {
|
|
4559
4561
|
const exitCode = await runPipeline({
|
|
@@ -7165,7 +7167,7 @@ function registerBrainstormCommand(program, _version = "0.0.0", projectRoot = pr
|
|
|
7165
7167
|
//#region src/cli/commands/retry-escalated.ts
|
|
7166
7168
|
const logger$3 = createLogger("retry-escalated-cmd");
|
|
7167
7169
|
async function runRetryEscalatedAction(options) {
|
|
7168
|
-
const { runId, dryRun, force, outputFormat, projectRoot, concurrency, pack: packName, registry: injectedRegistry, agent: agentId
|
|
7170
|
+
const { runId, dryRun, force, outputFormat, projectRoot, concurrency, pack: packName, registry: injectedRegistry, agent: agentId } = options;
|
|
7169
7171
|
const dbRoot = await resolveMainRepoRoot(projectRoot);
|
|
7170
7172
|
const dbPath = join(dbRoot, ".substrate", "substrate.db");
|
|
7171
7173
|
const doltDir = join(dbRoot, ".substrate", "state", ".dolt");
|
|
@@ -7269,7 +7271,7 @@ async function runRetryEscalatedAction(options) {
|
|
|
7269
7271
|
...Object.keys(perStoryContextCeilings).length > 0 ? { perStoryContextCeilings } : {}
|
|
7270
7272
|
},
|
|
7271
7273
|
projectRoot,
|
|
7272
|
-
agentId
|
|
7274
|
+
agentId
|
|
7273
7275
|
});
|
|
7274
7276
|
eventBus.on("orchestrator:story-phase-complete", (payload) => {
|
|
7275
7277
|
try {
|
|
@@ -7279,7 +7281,7 @@ async function runRetryEscalatedAction(options) {
|
|
|
7279
7281
|
const costUsd = (input * 3 + output * 15) / 1e6;
|
|
7280
7282
|
addTokenUsage(adapter, pipelineRun.id, {
|
|
7281
7283
|
phase: payload.phase,
|
|
7282
|
-
agent: agentId
|
|
7284
|
+
agent: agentId ?? "claude-code",
|
|
7283
7285
|
input_tokens: input,
|
|
7284
7286
|
output_tokens: output,
|
|
7285
7287
|
cost_usd: costUsd
|
|
@@ -10540,7 +10540,7 @@ function checkProfileStaleness(projectRoot) {
|
|
|
10540
10540
|
* @returns A fully-configured ImplementationOrchestrator ready to call run()
|
|
10541
10541
|
*/
|
|
10542
10542
|
function createImplementationOrchestrator(deps) {
|
|
10543
|
-
const { db, pack, contextCompiler, dispatcher, eventBus, config, projectRoot, tokenCeilings, stateStore, telemetryPersistence, ingestionServer, repoMapInjector, maxRepoMapTokens } = deps;
|
|
10543
|
+
const { db, pack, contextCompiler, dispatcher, eventBus, config, projectRoot, tokenCeilings, stateStore, telemetryPersistence, ingestionServer, repoMapInjector, maxRepoMapTokens, agentId } = deps;
|
|
10544
10544
|
const logger$22 = createLogger("implementation-orchestrator");
|
|
10545
10545
|
const telemetryAdvisor = db !== void 0 ? createTelemetryAdvisor({ db }) : void 0;
|
|
10546
10546
|
const wgRepo = new WorkGraphRepository(db);
|
|
@@ -11096,7 +11096,8 @@ function createImplementationOrchestrator(deps) {
|
|
|
11096
11096
|
dispatcher,
|
|
11097
11097
|
projectRoot,
|
|
11098
11098
|
tokenCeilings,
|
|
11099
|
-
otlpEndpoint: _otlpEndpoint
|
|
11099
|
+
otlpEndpoint: _otlpEndpoint,
|
|
11100
|
+
agentId
|
|
11100
11101
|
}, {
|
|
11101
11102
|
epicId: storyKey.split("-")[0] ?? storyKey,
|
|
11102
11103
|
storyKey,
|
|
@@ -11274,7 +11275,8 @@ function createImplementationOrchestrator(deps) {
|
|
|
11274
11275
|
dispatcher,
|
|
11275
11276
|
projectRoot,
|
|
11276
11277
|
tokenCeilings,
|
|
11277
|
-
otlpEndpoint: _otlpEndpoint
|
|
11278
|
+
otlpEndpoint: _otlpEndpoint,
|
|
11279
|
+
agentId
|
|
11278
11280
|
}, {
|
|
11279
11281
|
storyKey,
|
|
11280
11282
|
storyFilePath: storyFilePath ?? "",
|
|
@@ -11382,6 +11384,7 @@ function createImplementationOrchestrator(deps) {
|
|
|
11382
11384
|
otlpEndpoint: _otlpEndpoint,
|
|
11383
11385
|
repoMapInjector,
|
|
11384
11386
|
maxRepoMapTokens,
|
|
11387
|
+
agentId,
|
|
11385
11388
|
...config.perStoryContextCeilings?.[storyKey] !== void 0 ? { maxContextTokens: config.perStoryContextCeilings[storyKey] } : {},
|
|
11386
11389
|
...storyOptions?.optimizationDirectives !== void 0 ? { optimizationDirectives: storyOptions.optimizationDirectives } : {}
|
|
11387
11390
|
}, {
|
|
@@ -11467,6 +11470,7 @@ function createImplementationOrchestrator(deps) {
|
|
|
11467
11470
|
otlpEndpoint: _otlpEndpoint,
|
|
11468
11471
|
repoMapInjector,
|
|
11469
11472
|
maxRepoMapTokens,
|
|
11473
|
+
agentId,
|
|
11470
11474
|
...config.perStoryContextCeilings?.[storyKey] !== void 0 ? { maxContextTokens: config.perStoryContextCeilings[storyKey] } : {},
|
|
11471
11475
|
...storyOptions?.optimizationDirectives !== void 0 ? { optimizationDirectives: storyOptions.optimizationDirectives } : {}
|
|
11472
11476
|
}, {
|
|
@@ -12029,6 +12033,7 @@ function createImplementationOrchestrator(deps) {
|
|
|
12029
12033
|
otlpEndpoint: _otlpEndpoint,
|
|
12030
12034
|
repoMapInjector,
|
|
12031
12035
|
maxRepoMapTokens,
|
|
12036
|
+
agentId,
|
|
12032
12037
|
...config.perStoryContextCeilings?.[storyKey] !== void 0 ? { maxContextTokens: config.perStoryContextCeilings[storyKey] } : {}
|
|
12033
12038
|
}, {
|
|
12034
12039
|
storyKey,
|
|
@@ -12073,6 +12078,7 @@ function createImplementationOrchestrator(deps) {
|
|
|
12073
12078
|
otlpEndpoint: _otlpEndpoint,
|
|
12074
12079
|
repoMapInjector,
|
|
12075
12080
|
maxRepoMapTokens,
|
|
12081
|
+
agentId,
|
|
12076
12082
|
...config.perStoryContextCeilings?.[storyKey] !== void 0 ? { maxContextTokens: config.perStoryContextCeilings[storyKey] } : {}
|
|
12077
12083
|
}, {
|
|
12078
12084
|
storyKey,
|
|
@@ -12280,7 +12286,8 @@ function createImplementationOrchestrator(deps) {
|
|
|
12280
12286
|
dispatcher,
|
|
12281
12287
|
projectRoot,
|
|
12282
12288
|
tokenCeilings,
|
|
12283
|
-
otlpEndpoint: _otlpEndpoint
|
|
12289
|
+
otlpEndpoint: _otlpEndpoint,
|
|
12290
|
+
agentId
|
|
12284
12291
|
}, {
|
|
12285
12292
|
storyKey,
|
|
12286
12293
|
storyFilePath: storyFilePath ?? "",
|
|
@@ -41641,4 +41648,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
|
|
|
41641
41648
|
|
|
41642
41649
|
//#endregion
|
|
41643
41650
|
export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GitClient, GrammarLoader, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict };
|
|
41644
|
-
//# sourceMappingURL=run-
|
|
41651
|
+
//# sourceMappingURL=run-1Ywys7Fy.js.map
|
|
@@ -2,7 +2,7 @@ import "./health-DJgGZhW-.js";
|
|
|
2
2
|
import "./logger-KeHncl-f.js";
|
|
3
3
|
import "./helpers-CElYrONe.js";
|
|
4
4
|
import "./dist-adzGUKPc.js";
|
|
5
|
-
import { normalizeGraphSummaryToStatus, registerRunCommand, runRunAction } from "./run-
|
|
5
|
+
import { normalizeGraphSummaryToStatus, registerRunCommand, runRunAction } from "./run-1Ywys7Fy.js";
|
|
6
6
|
import "./routing-CcBOCuC9.js";
|
|
7
7
|
import "./decisions-C0pz9Clx.js";
|
|
8
8
|
|