substrate-ai 0.20.105 → 0.20.107
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
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
2
|
+
import { FileKvStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createDatabaseAdapter, createDoltOperatorReader, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion } from "../health-DlPF4Mfk.js";
|
|
3
3
|
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, InMemoryDatabaseAdapter, IngestionServer, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProvidersSchema, RoutingRecommender, STORY_METRICS, TelemetryConfigSchema, addTokenUsage, aggregateTokenUsageForRun, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDecision, createPipelineRun, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initWorkGraphSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, swallowDebug, tagRunAsBaseline, updatePipelineRun } from "../dist-CiMN31df.js";
|
|
6
|
-
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-
|
|
6
|
+
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-CvxO6ipT.js";
|
|
7
7
|
import "../adapter-registry-DIcrxjH8.js";
|
|
8
8
|
import { RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics, runAcTraceabilityCheck } from "../manifest-read-6GF2dThG.js";
|
|
9
9
|
import "../errors-BaUaJmz9.js";
|
|
@@ -6891,7 +6891,7 @@ async function runStatusAction(options) {
|
|
|
6891
6891
|
logger$15.debug({ err }, "Work graph query failed, continuing without work graph data");
|
|
6892
6892
|
}
|
|
6893
6893
|
if (run === void 0) {
|
|
6894
|
-
const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-
|
|
6894
|
+
const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-3r75oi42.js");
|
|
6895
6895
|
const substrateDirPath = join(projectRoot, ".substrate");
|
|
6896
6896
|
const processInfo = inspectProcessTree$1({
|
|
6897
6897
|
projectRoot,
|
|
@@ -8420,7 +8420,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
8420
8420
|
await initSchema(expAdapter);
|
|
8421
8421
|
const { runRunAction: runPipeline } = await import(
|
|
8422
8422
|
/* @vite-ignore */
|
|
8423
|
-
"../run-
|
|
8423
|
+
"../run-B8bQ5RCl.js"
|
|
8424
8424
|
);
|
|
8425
8425
|
const runStoryFn = async (opts) => {
|
|
8426
8426
|
const exitCode = await runPipeline({
|
|
@@ -8928,10 +8928,7 @@ async function runMetricsAction(options) {
|
|
|
8928
8928
|
if (routingRecommendations === true) {
|
|
8929
8929
|
const dbRoot$1 = await resolveMainRepoRoot(projectRoot);
|
|
8930
8930
|
const dbDir = join(dbRoot$1, ".substrate");
|
|
8931
|
-
const stateStore =
|
|
8932
|
-
backend: "file",
|
|
8933
|
-
basePath: dbDir
|
|
8934
|
-
});
|
|
8931
|
+
const stateStore = new FileKvStore({ basePath: dbDir });
|
|
8935
8932
|
await stateStore.initialize();
|
|
8936
8933
|
try {
|
|
8937
8934
|
const runIndexRaw = await stateStore.getMetric("__global__", "phase_token_breakdown_runs");
|
|
@@ -9152,7 +9149,7 @@ async function runMetricsAction(options) {
|
|
|
9152
9149
|
});
|
|
9153
9150
|
const phaseBreakdownMap = {};
|
|
9154
9151
|
try {
|
|
9155
|
-
const kvStore = new
|
|
9152
|
+
const kvStore = new FileKvStore({ basePath: join(dbRoot, ".substrate") });
|
|
9156
9153
|
for (const run$1 of runs) {
|
|
9157
9154
|
const raw = await kvStore.getMetric(run$1.run_id, "phase_token_breakdown");
|
|
9158
9155
|
phaseBreakdownMap[run$1.run_id] = raw !== void 0 ? raw : null;
|
|
@@ -11784,7 +11781,7 @@ const logger$3 = createLogger("cli:routing");
|
|
|
11784
11781
|
function registerRoutingCommand(program) {
|
|
11785
11782
|
program.command("routing").description("Show routing configuration and auto-tune history").option("--history", "Show the routing auto-tune log (model changes applied)").option("--output-format <format>", "Output format: text or json", "text").action(async (options) => {
|
|
11786
11783
|
const dbRoot = await resolveMainRepoRoot(process.cwd());
|
|
11787
|
-
const store = new
|
|
11784
|
+
const store = new FileKvStore({ basePath: join$1(dbRoot, ".substrate") });
|
|
11788
11785
|
try {
|
|
11789
11786
|
await store.initialize();
|
|
11790
11787
|
if (options.history === true) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-
|
|
1
|
+
import { DEFAULT_STALL_THRESHOLD_SECONDS, getAllDescendantPids, getAutoHealthData, inspectProcessTree, isOrchestratorProcessLine, registerHealthCommand, runHealthAction } from "./health-DlPF4Mfk.js";
|
|
2
2
|
import "./logger-KeHncl-f.js";
|
|
3
3
|
import "./dist-CiMN31df.js";
|
|
4
4
|
import "./manifest-read-6GF2dThG.js";
|
|
@@ -402,44 +402,15 @@ function formatPipelineSummary(run, tokenSummary, decisionsCount, storiesCount,
|
|
|
402
402
|
|
|
403
403
|
//#endregion
|
|
404
404
|
//#region src/modules/state/file-store.ts
|
|
405
|
-
var
|
|
405
|
+
var FileKvStore = class {
|
|
406
406
|
_basePath;
|
|
407
|
-
|
|
408
|
-
_metrics = [];
|
|
409
|
-
_contracts = new Map();
|
|
410
|
-
_contractVerifications = new Map();
|
|
411
|
-
/** Key-value metrics store: outer key = runId, inner key = metric key */
|
|
407
|
+
/** Key-value store: outer key = runId (or '__global__'), inner key = metric key. */
|
|
412
408
|
_kvMetrics = new Map();
|
|
413
409
|
constructor(options = {}) {
|
|
414
410
|
this._basePath = options.basePath;
|
|
415
411
|
}
|
|
416
412
|
async initialize() {}
|
|
417
413
|
async close() {}
|
|
418
|
-
async setStoryState(storyKey, state) {
|
|
419
|
-
this._stories.set(storyKey, {
|
|
420
|
-
...state,
|
|
421
|
-
storyKey
|
|
422
|
-
});
|
|
423
|
-
}
|
|
424
|
-
async queryStories(filter) {
|
|
425
|
-
const all = Array.from(this._stories.values());
|
|
426
|
-
return all.filter((record) => {
|
|
427
|
-
if (filter.phase !== void 0) {
|
|
428
|
-
const phases = Array.isArray(filter.phase) ? filter.phase : [filter.phase];
|
|
429
|
-
if (!phases.includes(record.phase)) return false;
|
|
430
|
-
}
|
|
431
|
-
if (filter.sprint !== void 0 && record.sprint !== filter.sprint) return false;
|
|
432
|
-
if (filter.storyKey !== void 0 && record.storyKey !== filter.storyKey) return false;
|
|
433
|
-
return true;
|
|
434
|
-
});
|
|
435
|
-
}
|
|
436
|
-
async recordMetric(metric) {
|
|
437
|
-
const record = {
|
|
438
|
-
...metric,
|
|
439
|
-
recordedAt: metric.recordedAt ?? new Date().toISOString()
|
|
440
|
-
};
|
|
441
|
-
this._metrics.push(record);
|
|
442
|
-
}
|
|
443
414
|
async setMetric(runId, key, value) {
|
|
444
415
|
let runMap = this._kvMetrics.get(runId);
|
|
445
416
|
if (runMap === void 0) {
|
|
@@ -470,30 +441,6 @@ var FileStateStore = class {
|
|
|
470
441
|
const filePath = join$1(this._basePath, "kv-metrics.json");
|
|
471
442
|
await writeFile(filePath, JSON.stringify(serialized, null, 2), "utf-8");
|
|
472
443
|
}
|
|
473
|
-
async setContracts(storyKey, contracts) {
|
|
474
|
-
this._contracts.set(storyKey, contracts.map((c) => ({ ...c })));
|
|
475
|
-
}
|
|
476
|
-
async queryContracts(filter) {
|
|
477
|
-
const all = [];
|
|
478
|
-
for (const records of this._contracts.values()) for (const r of records) all.push(r);
|
|
479
|
-
return all.filter((r) => {
|
|
480
|
-
if (filter?.storyKey !== void 0 && r.storyKey !== filter.storyKey) return false;
|
|
481
|
-
if (filter?.direction !== void 0 && r.direction !== filter.direction) return false;
|
|
482
|
-
return true;
|
|
483
|
-
});
|
|
484
|
-
}
|
|
485
|
-
async setContractVerification(storyKey, results) {
|
|
486
|
-
this._contractVerifications.set(storyKey, results.map((r) => ({ ...r })));
|
|
487
|
-
if (this._basePath !== void 0) {
|
|
488
|
-
const serialized = {};
|
|
489
|
-
for (const [key, records] of this._contractVerifications) serialized[key] = records;
|
|
490
|
-
const filePath = join$1(this._basePath, "contract-verifications.json");
|
|
491
|
-
await writeFile(filePath, JSON.stringify(serialized, null, 2), "utf-8");
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
async getHistory(_limit) {
|
|
495
|
-
return [];
|
|
496
|
-
}
|
|
497
444
|
};
|
|
498
445
|
|
|
499
446
|
//#endregion
|
|
@@ -557,14 +504,6 @@ var DoltStateStore = class {
|
|
|
557
504
|
//#endregion
|
|
558
505
|
//#region src/modules/state/index.ts
|
|
559
506
|
/**
|
|
560
|
-
* Create a StateStore for orchestrator use. Returns a FileStateStore — the
|
|
561
|
-
* Dolt backend is no longer routed through this factory (use
|
|
562
|
-
* `createDoltOperatorReader` for operator-side Dolt reads).
|
|
563
|
-
*/
|
|
564
|
-
function createStateStore(config = {}) {
|
|
565
|
-
return new FileStateStore({ basePath: config.basePath });
|
|
566
|
-
}
|
|
567
|
-
/**
|
|
568
507
|
* Create a DoltOperatorReader for CLI operator commands (history, routing,
|
|
569
508
|
* metrics, health). Constructs a DoltClient against `<basePath>/.dolt/` and
|
|
570
509
|
* exposes only the read-side surface meaningful for operators.
|
|
@@ -1060,5 +999,5 @@ function registerHealthCommand(program, _version = "0.0.0", projectRoot = proces
|
|
|
1060
999
|
}
|
|
1061
1000
|
|
|
1062
1001
|
//#endregion
|
|
1063
|
-
export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS,
|
|
1064
|
-
//# sourceMappingURL=health-
|
|
1002
|
+
export { BMAD_BASELINE_TOKENS_FULL, DEFAULT_STALL_THRESHOLD_SECONDS, FileKvStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter$1 as createDatabaseAdapter, createDoltOperatorReader, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, isOrchestratorProcessLine, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion, runHealthAction, validateStoryKey };
|
|
1003
|
+
//# sourceMappingURL=health-DlPF4Mfk.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import "./health-
|
|
1
|
+
import "./health-DlPF4Mfk.js";
|
|
2
2
|
import "./logger-KeHncl-f.js";
|
|
3
3
|
import "./helpers-CElYrONe.js";
|
|
4
4
|
import "./dist-CiMN31df.js";
|
|
5
|
-
import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-
|
|
5
|
+
import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, runRunAction, wireNdjsonEmitter } from "./run-CvxO6ipT.js";
|
|
6
6
|
import "./manifest-read-6GF2dThG.js";
|
|
7
7
|
import "./routing-DFxoKHDt.js";
|
|
8
8
|
import "./work-graph-repository-DZyJv5pV.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BMAD_BASELINE_TOKENS_FULL,
|
|
1
|
+
import { BMAD_BASELINE_TOKENS_FULL, FileKvStore, STOP_AFTER_VALID_PHASES, STORY_KEY_PATTERN, VALID_PHASES, __commonJS, __require, __toESM, buildPipelineStatusOutput, createDatabaseAdapter, formatOutput, formatPipelineSummary, formatTokenTelemetry, inspectProcessTree, parseDbTimestampAsUtc, validateStoryKey } from "./health-DlPF4Mfk.js";
|
|
2
2
|
import { createLogger } from "./logger-KeHncl-f.js";
|
|
3
3
|
import { TypedEventBusImpl, createEventBus, createTuiApp, isTuiCapable, printNonTtyWarning, sleep } from "./helpers-CElYrONe.js";
|
|
4
4
|
import { ADVISORY_NOTES, Categorizer, ConsumerAnalyzer, DEFAULT_GLOBAL_SETTINGS, DispatcherImpl, DoltClient, ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, EfficiencyScorer, IngestionServer, LogTurnAnalyzer, OPERATIONAL_FINDING, Recommender, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, STORY_METRICS, STORY_OUTCOME, SubstrateConfigSchema, TEST_EXPANSION_FINDING, TEST_PLAN, TelemetryNormalizer, TelemetryPipeline, TurnAnalyzer, addTokenUsage, aggregateTokenUsageForRun, aggregateTokenUsageForStory, callLLM, classifyVersionGap, createConfigSystem, createDatabaseAdapter$1, createDecision, createPipelineRun, createRequirement, detectInterfaceChanges, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunMetrics, getRunningPipelineRuns, getStoryMetricsForRun, getTokenUsageSummary, initSchema, listRequirements, loadModelRoutingConfig, registerArtifact, swallowDebug, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics } from "./dist-CiMN31df.js";
|
|
@@ -13275,7 +13275,7 @@ function checkProfileStaleness(projectRoot) {
|
|
|
13275
13275
|
* @returns A fully-configured ImplementationOrchestrator ready to call run()
|
|
13276
13276
|
*/
|
|
13277
13277
|
function createImplementationOrchestrator(deps) {
|
|
13278
|
-
const { db, pack, contextCompiler, dispatcher, eventBus, config, projectRoot, tokenCeilings,
|
|
13278
|
+
const { db, pack, contextCompiler, dispatcher, eventBus, config, projectRoot, tokenCeilings, telemetryPersistence, ingestionServer, repoMapInjector, maxRepoMapTokens, agentId, runManifest = null, worktreeManager } = deps;
|
|
13279
13279
|
const noWorktree = config.noWorktree ?? false;
|
|
13280
13280
|
const _worktreeManager = worktreeManager ?? (projectRoot !== void 0 && !noWorktree ? createGitWorktreeManager({
|
|
13281
13281
|
eventBus: toCoreEventBus(eventBus),
|
|
@@ -13322,7 +13322,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
13322
13322
|
let _probeAuthorEffectiveMode = "enabled";
|
|
13323
13323
|
const verificationStore = new VerificationStore();
|
|
13324
13324
|
const verificationPipeline = createDefaultVerificationPipeline(toSdlcEventBus(eventBus), void 0);
|
|
13325
|
-
const _stateStoreCache = new Map();
|
|
13326
13325
|
const _checkpoints = new Map();
|
|
13327
13326
|
const enqueueMerge = createMergeQueue();
|
|
13328
13327
|
const MEMORY_PRESSURE_BACKOFF_MS = [
|
|
@@ -13432,26 +13431,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
13432
13431
|
primary_agent_id: storyAgentId ?? agentId ?? "claude-code",
|
|
13433
13432
|
dispatch_agents_json: _storyAgents.has(storyKey) ? JSON.stringify(_storyAgents.get(storyKey)) : void 0
|
|
13434
13433
|
});
|
|
13435
|
-
if (stateStore !== void 0) stateStore.recordMetric({
|
|
13436
|
-
storyKey,
|
|
13437
|
-
taskType: "dev-story",
|
|
13438
|
-
model: void 0,
|
|
13439
|
-
tokensIn: tokenAgg.input,
|
|
13440
|
-
tokensOut: tokenAgg.output,
|
|
13441
|
-
cacheReadTokens: void 0,
|
|
13442
|
-
costUsd: tokenAgg.cost,
|
|
13443
|
-
wallClockMs,
|
|
13444
|
-
reviewCycles,
|
|
13445
|
-
stallCount: _storiesWithStall.has(storyKey) ? 1 : 0,
|
|
13446
|
-
result,
|
|
13447
|
-
recordedAt: completedAt,
|
|
13448
|
-
timestamp: completedAt
|
|
13449
|
-
}).catch((storeErr) => {
|
|
13450
|
-
logger$27.warn({
|
|
13451
|
-
err: storeErr,
|
|
13452
|
-
storyKey
|
|
13453
|
-
}, "Failed to record metric to StateStore (best-effort)");
|
|
13454
|
-
});
|
|
13455
13434
|
try {
|
|
13456
13435
|
const runId = config.pipelineRunId ?? "unknown";
|
|
13457
13436
|
await createDecision(db, {
|
|
@@ -13667,15 +13646,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
13667
13646
|
}
|
|
13668
13647
|
function getStatus() {
|
|
13669
13648
|
const stories = {};
|
|
13670
|
-
for (const [key, record] of _stateStoreCache) if (!_stories.has(key)) stories[key] = {
|
|
13671
|
-
phase: record.phase,
|
|
13672
|
-
reviewCycles: record.reviewCycles,
|
|
13673
|
-
lastVerdict: record.lastVerdict,
|
|
13674
|
-
error: record.error,
|
|
13675
|
-
startedAt: record.startedAt,
|
|
13676
|
-
completedAt: record.completedAt,
|
|
13677
|
-
checkpointFilesCount: record.checkpointFilesCount
|
|
13678
|
-
};
|
|
13679
13649
|
for (const [key, s$1] of _stories) stories[key] = { ...s$1 };
|
|
13680
13650
|
const status = {
|
|
13681
13651
|
state: _state,
|
|
@@ -13695,10 +13665,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
13695
13665
|
const existing = _stories.get(storyKey);
|
|
13696
13666
|
if (existing !== void 0) {
|
|
13697
13667
|
Object.assign(existing, updates);
|
|
13698
|
-
persistStoryState(storyKey, existing).catch((err) => logger$27.warn({
|
|
13699
|
-
err,
|
|
13700
|
-
storyKey
|
|
13701
|
-
}, "StateStore write failed after updateStory"));
|
|
13702
13668
|
if (updates.phase !== void 0) {
|
|
13703
13669
|
const targetStatus = wgStatusForPhase(updates.phase);
|
|
13704
13670
|
if (targetStatus !== null) if (targetStatus === "in_progress" && _wgInProgressWritten.has(storyKey)) {} else {
|
|
@@ -13750,34 +13716,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
13750
13716
|
}
|
|
13751
13717
|
}
|
|
13752
13718
|
}
|
|
13753
|
-
/**
|
|
13754
|
-
* Persist a single story's state to the StateStore (Story 26-4, AC2).
|
|
13755
|
-
*
|
|
13756
|
-
* Best-effort: callers should `.catch()` on the returned promise.
|
|
13757
|
-
* Never throws — errors are swallowed so the pipeline is never blocked.
|
|
13758
|
-
*/
|
|
13759
|
-
async function persistStoryState(storyKey, state) {
|
|
13760
|
-
if (stateStore === void 0) return;
|
|
13761
|
-
try {
|
|
13762
|
-
const record = {
|
|
13763
|
-
storyKey,
|
|
13764
|
-
phase: state.phase,
|
|
13765
|
-
reviewCycles: state.reviewCycles,
|
|
13766
|
-
lastVerdict: state.lastVerdict,
|
|
13767
|
-
error: state.error,
|
|
13768
|
-
startedAt: state.startedAt,
|
|
13769
|
-
completedAt: state.completedAt,
|
|
13770
|
-
sprint: config.sprint,
|
|
13771
|
-
checkpointFilesCount: state.checkpointFilesCount
|
|
13772
|
-
};
|
|
13773
|
-
await stateStore.setStoryState(storyKey, record);
|
|
13774
|
-
} catch (err) {
|
|
13775
|
-
logger$27.warn({
|
|
13776
|
-
err,
|
|
13777
|
-
storyKey
|
|
13778
|
-
}, "StateStore.setStoryState failed (best-effort)");
|
|
13779
|
-
}
|
|
13780
|
-
}
|
|
13781
13719
|
async function persistState() {
|
|
13782
13720
|
if (config.pipelineRunId === void 0) return;
|
|
13783
13721
|
recordProgress();
|
|
@@ -13946,10 +13884,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
13946
13884
|
completedAt: new Date().toISOString()
|
|
13947
13885
|
};
|
|
13948
13886
|
_stories.set(storyKey, memPressureState);
|
|
13949
|
-
persistStoryState(storyKey, memPressureState).catch((err) => logger$27.warn({
|
|
13950
|
-
err,
|
|
13951
|
-
storyKey
|
|
13952
|
-
}, "StateStore write failed after memory-pressure escalation"));
|
|
13953
13887
|
await writeStoryMetricsBestEffort(storyKey, "escalated", 0);
|
|
13954
13888
|
await emitEscalation({
|
|
13955
13889
|
storyKey,
|
|
@@ -14452,15 +14386,7 @@ function createImplementationOrchestrator(deps) {
|
|
|
14452
14386
|
const storyContent = await readFile$1(storyFilePath, "utf-8");
|
|
14453
14387
|
const contracts = parseInterfaceContracts(storyContent, storyKey);
|
|
14454
14388
|
if (contracts.length > 0) {
|
|
14455
|
-
const
|
|
14456
|
-
storyKey: d.storyKey,
|
|
14457
|
-
contractName: d.contractName,
|
|
14458
|
-
direction: d.direction,
|
|
14459
|
-
schemaPath: d.filePath,
|
|
14460
|
-
...d.transport !== void 0 ? { transport: d.transport } : {}
|
|
14461
|
-
}));
|
|
14462
|
-
if (stateStore !== void 0) await stateStore.setContracts(storyKey, contractRecords);
|
|
14463
|
-
else for (const contract of contracts) await createDecision(db, {
|
|
14389
|
+
for (const contract of contracts) await createDecision(db, {
|
|
14464
14390
|
pipeline_run_id: config.pipelineRunId ?? null,
|
|
14465
14391
|
phase: "implementation",
|
|
14466
14392
|
category: "interface-contract",
|
|
@@ -14882,18 +14808,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
14882
14808
|
filesCount: timeoutFiles.length,
|
|
14883
14809
|
diffSizeBytes
|
|
14884
14810
|
});
|
|
14885
|
-
if (stateStore !== void 0) stateStore.recordMetric({
|
|
14886
|
-
storyKey,
|
|
14887
|
-
taskType: "dev-story",
|
|
14888
|
-
result: "timeout",
|
|
14889
|
-
recordedAt: new Date().toISOString(),
|
|
14890
|
-
sprint: config.sprint
|
|
14891
|
-
}).catch((storeErr) => {
|
|
14892
|
-
logger$27.warn({
|
|
14893
|
-
err: storeErr,
|
|
14894
|
-
storyKey
|
|
14895
|
-
}, "Failed to record timeout metric to StateStore (best-effort)");
|
|
14896
|
-
});
|
|
14897
14811
|
await persistState();
|
|
14898
14812
|
eventBus.emit("story:checkpoint-retry", {
|
|
14899
14813
|
storyKey,
|
|
@@ -15517,10 +15431,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
15517
15431
|
completedAt: new Date().toISOString(),
|
|
15518
15432
|
error: "recovery-engine-propose"
|
|
15519
15433
|
});
|
|
15520
|
-
persistStoryState(storyKey, _stories.get(storyKey)).catch((err) => logger$27.warn({
|
|
15521
|
-
err,
|
|
15522
|
-
storyKey
|
|
15523
|
-
}, "StateStore write failed after recovery-propose"));
|
|
15524
15434
|
await emitEscalation({
|
|
15525
15435
|
storyKey,
|
|
15526
15436
|
lastVerdict: "recovery-propose",
|
|
@@ -15558,10 +15468,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
15558
15468
|
completedAt: new Date().toISOString(),
|
|
15559
15469
|
error: "recovery-engine-halt"
|
|
15560
15470
|
});
|
|
15561
|
-
persistStoryState(storyKey, _stories.get(storyKey)).catch((err) => logger$27.warn({
|
|
15562
|
-
err,
|
|
15563
|
-
storyKey
|
|
15564
|
-
}, "StateStore write failed after recovery-halt"));
|
|
15565
15471
|
await emitEscalation({
|
|
15566
15472
|
storyKey,
|
|
15567
15473
|
lastVerdict: "recovery-halt",
|
|
@@ -15578,10 +15484,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
15578
15484
|
phase: "VERIFICATION_FAILED",
|
|
15579
15485
|
completedAt: new Date().toISOString()
|
|
15580
15486
|
});
|
|
15581
|
-
persistStoryState(storyKey, _stories.get(storyKey)).catch((err) => logger$27.warn({
|
|
15582
|
-
err,
|
|
15583
|
-
storyKey
|
|
15584
|
-
}, "StateStore write failed after verification-failed"));
|
|
15585
15487
|
await writeStoryMetricsBestEffort(storyKey, "verification-failed", finalReviewCycles);
|
|
15586
15488
|
await persistState();
|
|
15587
15489
|
return "verification-failed";
|
|
@@ -17008,26 +16910,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
17008
16910
|
process.on("SIGTERM", sigtermHandler);
|
|
17009
16911
|
process.on("SIGINT", sigintHandler);
|
|
17010
16912
|
try {
|
|
17011
|
-
if (stateStore !== void 0) {
|
|
17012
|
-
const stateStoreInitStart = Date.now();
|
|
17013
|
-
await stateStore.initialize();
|
|
17014
|
-
_startupTimings.stateStoreInitMs = Date.now() - stateStoreInitStart;
|
|
17015
|
-
for (const key of storyKeys) {
|
|
17016
|
-
const pendingState = _stories.get(key);
|
|
17017
|
-
if (pendingState !== void 0) persistStoryState(key, pendingState).catch((err) => logger$27.warn({
|
|
17018
|
-
err,
|
|
17019
|
-
storyKey: key
|
|
17020
|
-
}, "StateStore write failed during PENDING init"));
|
|
17021
|
-
}
|
|
17022
|
-
try {
|
|
17023
|
-
const queryStoriesStart = Date.now();
|
|
17024
|
-
const existingRecords = await stateStore.queryStories({});
|
|
17025
|
-
_startupTimings.queryStoriesMs = Date.now() - queryStoriesStart;
|
|
17026
|
-
for (const record of existingRecords) _stateStoreCache.set(record.storyKey, record);
|
|
17027
|
-
} catch (err) {
|
|
17028
|
-
logger$27.warn({ err }, "StateStore.queryStories() failed during init — status merge will be empty (best-effort)");
|
|
17029
|
-
}
|
|
17030
|
-
}
|
|
17031
16913
|
if (ingestionServer !== void 0) {
|
|
17032
16914
|
if (telemetryPersistence !== void 0) try {
|
|
17033
16915
|
const pipelineLogger = logger$27;
|
|
@@ -17052,40 +16934,26 @@ function createImplementationOrchestrator(deps) {
|
|
|
17052
16934
|
logger$27.info({ otlpEndpoint: _otlpEndpoint }, "OTLP telemetry ingestion active");
|
|
17053
16935
|
} catch {}
|
|
17054
16936
|
}
|
|
17055
|
-
|
|
17056
|
-
|
|
17057
|
-
|
|
17058
|
-
|
|
17059
|
-
|
|
17060
|
-
|
|
17061
|
-
|
|
17062
|
-
|
|
17063
|
-
|
|
17064
|
-
|
|
17065
|
-
|
|
17066
|
-
|
|
17067
|
-
|
|
17068
|
-
|
|
17069
|
-
|
|
17070
|
-
|
|
17071
|
-
|
|
17072
|
-
|
|
17073
|
-
|
|
17074
|
-
|
|
17075
|
-
const filePath = typeof parsed.filePath === "string" ? parsed.filePath : "";
|
|
17076
|
-
if (!storyKey || !contractName) return null;
|
|
17077
|
-
return {
|
|
17078
|
-
storyKey,
|
|
17079
|
-
contractName,
|
|
17080
|
-
direction,
|
|
17081
|
-
filePath,
|
|
17082
|
-
...typeof parsed.transport === "string" ? { transport: parsed.transport } : {}
|
|
17083
|
-
};
|
|
17084
|
-
} catch {
|
|
17085
|
-
return null;
|
|
17086
|
-
}
|
|
17087
|
-
}).filter((d) => d !== null);
|
|
17088
|
-
}
|
|
16937
|
+
const interfaceContractDecisions = await getDecisionsByCategory(db, "interface-contract");
|
|
16938
|
+
const contractDeclarations = interfaceContractDecisions.map((d) => {
|
|
16939
|
+
try {
|
|
16940
|
+
const parsed = JSON.parse(d.value);
|
|
16941
|
+
const storyKey = typeof parsed.storyKey === "string" ? parsed.storyKey : "";
|
|
16942
|
+
const contractName = typeof parsed.schemaName === "string" ? parsed.schemaName : "";
|
|
16943
|
+
const direction = parsed.direction === "export" ? "export" : "import";
|
|
16944
|
+
const filePath = typeof parsed.filePath === "string" ? parsed.filePath : "";
|
|
16945
|
+
if (!storyKey || !contractName) return null;
|
|
16946
|
+
return {
|
|
16947
|
+
storyKey,
|
|
16948
|
+
contractName,
|
|
16949
|
+
direction,
|
|
16950
|
+
filePath,
|
|
16951
|
+
...typeof parsed.transport === "string" ? { transport: parsed.transport } : {}
|
|
16952
|
+
};
|
|
16953
|
+
} catch {
|
|
16954
|
+
return null;
|
|
16955
|
+
}
|
|
16956
|
+
}).filter((d) => d !== null);
|
|
17089
16957
|
const conflictDetectStart = Date.now();
|
|
17090
16958
|
const { batches, edges: contractEdges } = detectConflictGroupsWithContracts(storyKeys, { moduleMap: pack.manifest.conflictGroups }, contractDeclarations);
|
|
17091
16959
|
_startupTimings.conflictDetectMs = Date.now() - conflictDetectStart;
|
|
@@ -17222,38 +17090,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
17222
17090
|
mismatches: mismatches.length,
|
|
17223
17091
|
verdict: mismatches.length === 0 ? "pass" : "fail"
|
|
17224
17092
|
});
|
|
17225
|
-
if (stateStore !== void 0) try {
|
|
17226
|
-
const currentSprintContracts = (await stateStore.queryContracts()).filter((cr) => storyKeys.includes(cr.storyKey));
|
|
17227
|
-
const verifiedAt = new Date().toISOString();
|
|
17228
|
-
const contractsByStory = new Map();
|
|
17229
|
-
for (const cr of currentSprintContracts) {
|
|
17230
|
-
const existing = contractsByStory.get(cr.storyKey) ?? [];
|
|
17231
|
-
existing.push(cr);
|
|
17232
|
-
contractsByStory.set(cr.storyKey, existing);
|
|
17233
|
-
}
|
|
17234
|
-
for (const [sk, contracts] of contractsByStory) {
|
|
17235
|
-
const records = contracts.map((cr) => {
|
|
17236
|
-
const contractMismatches = (_contractMismatches ?? []).filter((m) => (m.exporter === sk || m.importer === sk) && m.contractName === cr.contractName);
|
|
17237
|
-
if (contractMismatches.length > 0) return {
|
|
17238
|
-
storyKey: sk,
|
|
17239
|
-
contractName: cr.contractName,
|
|
17240
|
-
verdict: "fail",
|
|
17241
|
-
mismatchDescription: contractMismatches[0].mismatchDescription,
|
|
17242
|
-
verifiedAt
|
|
17243
|
-
};
|
|
17244
|
-
return {
|
|
17245
|
-
storyKey: sk,
|
|
17246
|
-
contractName: cr.contractName,
|
|
17247
|
-
verdict: "pass",
|
|
17248
|
-
verifiedAt
|
|
17249
|
-
};
|
|
17250
|
-
});
|
|
17251
|
-
await stateStore.setContractVerification(sk, records);
|
|
17252
|
-
}
|
|
17253
|
-
logger$27.info({ storyCount: contractsByStory.size }, "Contract verification results persisted to StateStore");
|
|
17254
|
-
} catch (persistErr) {
|
|
17255
|
-
logger$27.warn({ err: persistErr }, "Failed to persist contract verification results to StateStore");
|
|
17256
|
-
}
|
|
17257
17093
|
} catch (err) {
|
|
17258
17094
|
logger$27.error({ err }, "Post-sprint contract verification threw an error — skipping");
|
|
17259
17095
|
}
|
|
@@ -17287,7 +17123,6 @@ function createImplementationOrchestrator(deps) {
|
|
|
17287
17123
|
} finally {
|
|
17288
17124
|
process.off("SIGTERM", sigtermHandler);
|
|
17289
17125
|
process.off("SIGINT", sigintHandler);
|
|
17290
|
-
if (stateStore !== void 0) await stateStore.close().catch((err) => logger$27.warn({ err }, "StateStore.close() failed (best-effort)"));
|
|
17291
17126
|
if (ingestionServer !== void 0) await ingestionServer.stop().catch((err) => logger$27.warn({ err }, "IngestionServer.stop() failed (best-effort)"));
|
|
17292
17127
|
}
|
|
17293
17128
|
}
|
|
@@ -46017,7 +45852,7 @@ async function runRunAction(options) {
|
|
|
46017
45852
|
}
|
|
46018
45853
|
let routingTuner;
|
|
46019
45854
|
if (routingConfig !== void 0) {
|
|
46020
|
-
const kvStateStore = new
|
|
45855
|
+
const kvStateStore = new FileKvStore({ basePath: join(dbRoot, ".substrate") });
|
|
46021
45856
|
routingTokenAccumulator = new RoutingTokenAccumulator(routingConfig, kvStateStore, logger);
|
|
46022
45857
|
eventBus.on("routing:model-selected", (payload) => {
|
|
46023
45858
|
routingTokenAccumulator.onRoutingSelected({
|
|
@@ -47216,4 +47051,4 @@ function registerRunCommand(program, version = "0.0.0", projectRoot = process.cw
|
|
|
47216
47051
|
|
|
47217
47052
|
//#endregion
|
|
47218
47053
|
export { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR$1 as GLOBSTAR, GitClient, GrammarLoader, Minimatch$1 as Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createGitWorktreeManager, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape$1 as escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, normalizeGraphSummaryToStatus, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveMaxReviewCycles, resolveProbeAuthorStateIntegrating, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runRunAction, runSolutioningPhase, unescape$1 as unescape, validateStopAfterFromConflict, wireNdjsonEmitter };
|
|
47219
|
-
//# sourceMappingURL=run-
|
|
47054
|
+
//# sourceMappingURL=run-CvxO6ipT.js.map
|