substrate-ai 0.20.63 → 0.20.65
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/adapter-registry-BbVWH3Yv.js +4 -0
- package/dist/cli/index.js +93 -23
- package/dist/decision-router-DblHY8se.js +97 -0
- package/dist/{decisions-4F91LrVD.js → decisions-DilHo99V.js} +2 -2
- package/dist/{dist-W2emvN3F.js → dist-K_RRWnBX.js} +2 -2
- package/dist/{errors-CKFu8YI9.js → errors-pSiZbn6e.js} +2 -2
- package/dist/{experimenter-DxxwicpK.js → experimenter-DT9v2Pto.js} +1 -1
- package/dist/health-DC3y-sR6.js +1715 -0
- package/dist/health-qhtWYh49.js +8 -0
- package/dist/index-c924O9mj.d.ts +1432 -0
- package/dist/index.d.ts +132 -736
- package/dist/index.js +2 -2
- package/dist/interactive-prompt-C7wpE4z4.js +183 -0
- package/dist/{health-C-KOZrFJ.js → manifest-read-DDkXC3L_.js} +130 -2013
- package/dist/modules/interactive-prompt/index.d.ts +86 -0
- package/dist/modules/interactive-prompt/index.js +6 -0
- package/dist/recovery-engine-BKGBeBnW.js +281 -0
- package/dist/{routing-0ykvBl_4.js → routing-CzF0p6lI.js} +2 -2
- package/dist/run-DX95j4_D.js +14 -0
- package/dist/{run-CHUFlRbH.js → run-DzB4rgkj.js} +391 -31
- package/dist/src/modules/decision-router/index.d.ts +88 -0
- package/dist/src/modules/decision-router/index.js +3 -0
- package/dist/src/modules/recovery-engine/index.d.ts +1101 -0
- package/dist/src/modules/recovery-engine/index.js +5 -0
- package/dist/{upgrade-C8LAnB6W.js → upgrade-DxzQ1nss.js} +3 -3
- package/dist/{upgrade-CAqLkNUP.js → upgrade-MP9XzrI6.js} +2 -2
- package/dist/version-manager-impl-GZDUBt0Q.js +4 -0
- package/dist/work-graph-repository-DZyJv5pV.js +265 -0
- package/package.json +1 -1
- package/dist/adapter-registry-k7ZX3Bz6.js +0 -4
- package/dist/health-CJqd1FzY.js +0 -6
- package/dist/run-Z_-caE_i.js +0 -9
- package/dist/version-manager-impl-DaA_ALYK.js +0 -4
- /package/dist/{decisions-C0pz9Clx.js → decisions-CzSIEeGP.js} +0 -0
- /package/dist/{routing-CcBOCuC9.js → routing-DFxoKHDt.js} +0 -0
- /package/dist/{version-manager-impl-BmOWu8ml.js → version-manager-impl-qFBiO4Eh.js} +0 -0
package/dist/cli/index.js
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { FileStateStore,
|
|
2
|
+
import { FileStateStore, SUBSTRATE_OWNED_SETTINGS_KEYS, VALID_PHASES, buildPipelineStatusOutput, createDatabaseAdapter, createStateStore, findPackageRoot, formatOutput, formatPipelineStatusHuman, formatPipelineSummary, formatTokenTelemetry, getAllDescendantPids, getAutoHealthData, getSubstrateDefaultSettings, inspectProcessTree, parseDbTimestampAsUtc, registerHealthCommand, resolveBmadMethodSrcPath, resolveBmadMethodVersion } from "../health-DC3y-sR6.js";
|
|
3
3
|
import { createLogger } from "../logger-KeHncl-f.js";
|
|
4
4
|
import { createEventBus } from "../helpers-CElYrONe.js";
|
|
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, createDoltClient, createPipelineRun, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-
|
|
5
|
+
import { AdapterRegistry$1 as AdapterRegistry, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, ConfigError$1 as 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, createDoltClient, createPipelineRun, getActiveDecisions, getAllCostEntriesFiltered, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-K_RRWnBX.js";
|
|
6
6
|
import "../adapter-registry-DXLMTmfD.js";
|
|
7
|
-
import {
|
|
8
|
-
import "../
|
|
9
|
-
import "../
|
|
10
|
-
import "../
|
|
11
|
-
import "../
|
|
12
|
-
import
|
|
7
|
+
import { RunManifest, SupervisorLock, ZERO_FINDINGS_BY_AUTHOR, ZERO_FINDING_COUNTS, ZERO_PROBE_AUTHOR_METRICS, aggregateProbeAuthorMetrics, parseRuntimeProbes, readCurrentRunId, resolveMainRepoRoot, resolveRunManifest, rollupFindingCounts, rollupFindingsByAuthor, rollupProbeAuthorByClass, rollupProbeAuthorMetrics } from "../manifest-read-DDkXC3L_.js";
|
|
8
|
+
import { AdapterTelemetryPersistence, AppError, DoltRepoMapMetaRepository, DoltSymbolRepository, ERR_REPO_MAP_STORAGE_WRITE, EpicIngester, GLOBSTAR, GitClient, GrammarLoader, Minimatch, Minipass, RepoMapInjector, RepoMapModule, RepoMapQueryEngine, RepoMapStorage, SymbolParser, createContextCompiler, createDispatcher, createEventEmitter, createImplementationOrchestrator, createPackLoader, createPhaseOrchestrator, createStopAfterGate, createTelemetryAdvisor, escape, formatPhaseCompletionSummary, getFactoryRunSummaries, getScenarioResultsForRun, getTwinRunsForRun, listGraphRuns, registerExportCommand, registerFactoryCommand, registerRunCommand, registerScenariosCommand, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runProbeAuthor, runSolutioningPhase, unescape, validateStopAfterFromConflict } from "../run-DzB4rgkj.js";
|
|
9
|
+
import "../errors-pSiZbn6e.js";
|
|
10
|
+
import "../routing-DFxoKHDt.js";
|
|
11
|
+
import { WorkGraphRepository } from "../work-graph-repository-DZyJv5pV.js";
|
|
12
|
+
import "../decisions-CzSIEeGP.js";
|
|
13
|
+
import "../decision-router-DblHY8se.js";
|
|
14
|
+
import "../interactive-prompt-C7wpE4z4.js";
|
|
15
|
+
import "../recovery-engine-BKGBeBnW.js";
|
|
16
|
+
import "../version-manager-impl-qFBiO4Eh.js";
|
|
17
|
+
import { registerUpgradeCommand } from "../upgrade-MP9XzrI6.js";
|
|
13
18
|
import { Command } from "commander";
|
|
14
19
|
import { fileURLToPath } from "url";
|
|
15
20
|
import { dirname, join, resolve } from "path";
|
|
16
|
-
import { access, mkdir, readFile, readdir, writeFile } from "fs/promises";
|
|
21
|
+
import { access, mkdir, readFile, readdir, unlink, writeFile } from "fs/promises";
|
|
17
22
|
import { EventEmitter } from "node:events";
|
|
18
23
|
import yaml from "js-yaml";
|
|
19
24
|
import * as actualFS from "node:fs";
|
|
@@ -7486,7 +7491,7 @@ async function runStatusAction(options) {
|
|
|
7486
7491
|
logger$15.debug({ err }, "Work graph query failed, continuing without work graph data");
|
|
7487
7492
|
}
|
|
7488
7493
|
if (run === void 0) {
|
|
7489
|
-
const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-
|
|
7494
|
+
const { inspectProcessTree: inspectProcessTree$1 } = await import("../health-qhtWYh49.js");
|
|
7490
7495
|
const substrateDirPath = join(projectRoot, ".substrate");
|
|
7491
7496
|
const processInfo = inspectProcessTree$1({
|
|
7492
7497
|
projectRoot,
|
|
@@ -8451,7 +8456,7 @@ function defaultSupervisorDeps() {
|
|
|
8451
8456
|
if (cached === null) {
|
|
8452
8457
|
const { AdapterRegistry: AR } = await import(
|
|
8453
8458
|
/* @vite-ignore */
|
|
8454
|
-
"../adapter-registry-
|
|
8459
|
+
"../adapter-registry-BbVWH3Yv.js"
|
|
8455
8460
|
);
|
|
8456
8461
|
cached = new AR();
|
|
8457
8462
|
await cached.discoverAndRegister();
|
|
@@ -9018,11 +9023,11 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
9018
9023
|
try {
|
|
9019
9024
|
const { createExperimenter } = await import(
|
|
9020
9025
|
/* @vite-ignore */
|
|
9021
|
-
"../experimenter-
|
|
9026
|
+
"../experimenter-DT9v2Pto.js"
|
|
9022
9027
|
);
|
|
9023
9028
|
const { getLatestRun: getLatest } = await import(
|
|
9024
9029
|
/* @vite-ignore */
|
|
9025
|
-
"../decisions-
|
|
9030
|
+
"../decisions-DilHo99V.js"
|
|
9026
9031
|
);
|
|
9027
9032
|
const expAdapter = createDatabaseAdapter({
|
|
9028
9033
|
backend: "auto",
|
|
@@ -9032,7 +9037,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
9032
9037
|
await initSchema(expAdapter);
|
|
9033
9038
|
const { runRunAction: runPipeline } = await import(
|
|
9034
9039
|
/* @vite-ignore */
|
|
9035
|
-
"../run-
|
|
9040
|
+
"../run-DX95j4_D.js"
|
|
9036
9041
|
);
|
|
9037
9042
|
const runStoryFn = async (opts) => {
|
|
9038
9043
|
const exitCode = await runPipeline({
|
|
@@ -9564,7 +9569,7 @@ async function runMetricsAction(options) {
|
|
|
9564
9569
|
const routingConfigPath = join(dbDir, "routing.yml");
|
|
9565
9570
|
let routingConfig = null;
|
|
9566
9571
|
if (existsSync$1(routingConfigPath)) try {
|
|
9567
|
-
const { loadModelRoutingConfig } = await import("../routing-
|
|
9572
|
+
const { loadModelRoutingConfig } = await import("../routing-CzF0p6lI.js");
|
|
9568
9573
|
routingConfig = loadModelRoutingConfig(routingConfigPath);
|
|
9569
9574
|
} catch {}
|
|
9570
9575
|
if (routingConfig === null) routingConfig = {
|
|
@@ -13639,6 +13644,50 @@ function enrichEscalation(storyKey, state, runId, manifest) {
|
|
|
13639
13644
|
blast_radius
|
|
13640
13645
|
};
|
|
13641
13646
|
}
|
|
13647
|
+
/**
|
|
13648
|
+
* Read all halt notification files for a given run from
|
|
13649
|
+
* .substrate/notifications/<runId>-*.json and delete them after reading (AC6).
|
|
13650
|
+
*
|
|
13651
|
+
* Returns an empty array if the notifications directory is absent or
|
|
13652
|
+
* no notifications exist for the given run ID.
|
|
13653
|
+
*
|
|
13654
|
+
* ENOENT is swallowed for each file (external monitors may delete files
|
|
13655
|
+
* between listing and reading — AC7 tolerance).
|
|
13656
|
+
*/
|
|
13657
|
+
async function readNotificationsForRun(runId, dbRoot) {
|
|
13658
|
+
const notifDir = join(dbRoot, ".substrate", "notifications");
|
|
13659
|
+
let entries;
|
|
13660
|
+
try {
|
|
13661
|
+
entries = await readdir(notifDir);
|
|
13662
|
+
} catch {
|
|
13663
|
+
return [];
|
|
13664
|
+
}
|
|
13665
|
+
const matching = entries.filter((f) => f.startsWith(`${runId}-`) && f.endsWith(".json"));
|
|
13666
|
+
const notifications = [];
|
|
13667
|
+
for (const filename of matching) {
|
|
13668
|
+
const filePath = join(notifDir, filename);
|
|
13669
|
+
try {
|
|
13670
|
+
const raw = await readFile(filePath, "utf-8");
|
|
13671
|
+
const parsed = JSON.parse(raw);
|
|
13672
|
+
notifications.push(parsed);
|
|
13673
|
+
} catch (err) {
|
|
13674
|
+
if (err.code !== "ENOENT") logger$1.warn({
|
|
13675
|
+
err,
|
|
13676
|
+
filePath
|
|
13677
|
+
}, "failed to read notification file — skipping");
|
|
13678
|
+
continue;
|
|
13679
|
+
}
|
|
13680
|
+
try {
|
|
13681
|
+
await unlink(filePath);
|
|
13682
|
+
} catch (err) {
|
|
13683
|
+
if (err.code !== "ENOENT") logger$1.warn({
|
|
13684
|
+
err,
|
|
13685
|
+
filePath
|
|
13686
|
+
}, "failed to delete notification file — continuing");
|
|
13687
|
+
}
|
|
13688
|
+
}
|
|
13689
|
+
return notifications;
|
|
13690
|
+
}
|
|
13642
13691
|
/** Pad a string to a fixed width, truncating with '…' if necessary. */
|
|
13643
13692
|
function padCell(value, width) {
|
|
13644
13693
|
if (value.length > width) return value.slice(0, width - 1) + "…";
|
|
@@ -13663,7 +13712,7 @@ function wallClockMs(state) {
|
|
|
13663
13712
|
}
|
|
13664
13713
|
function renderHuman(output, manifest) {
|
|
13665
13714
|
const lines = [];
|
|
13666
|
-
const { runId, summary, stories, escalations, cost, duration } = output;
|
|
13715
|
+
const { runId, summary, stories, escalations, cost, duration, halts } = output;
|
|
13667
13716
|
const durationStr = duration.wall_clock_ms != null ? formatDurationMs(duration.wall_clock_ms) : "unknown";
|
|
13668
13717
|
const costStr = `$${cost.spent.toFixed(4)}`;
|
|
13669
13718
|
const ceilingStr = cost.ceiling != null ? ` / $${cost.ceiling.toFixed(4)} ceiling (${cost.utilization ?? "?"}) ${cost.overCeiling ? "[OVER CEILING]" : ""}` : "";
|
|
@@ -13727,6 +13776,17 @@ function renderHuman(output, manifest) {
|
|
|
13727
13776
|
}
|
|
13728
13777
|
lines.push("");
|
|
13729
13778
|
}
|
|
13779
|
+
if (halts && halts.length > 0) {
|
|
13780
|
+
lines.push("──── Operator Halts ────");
|
|
13781
|
+
for (const halt of halts) {
|
|
13782
|
+
lines.push("");
|
|
13783
|
+
lines.push(` Timestamp: ${halt.timestamp}`);
|
|
13784
|
+
lines.push(` Decision type: ${halt.decisionType}`);
|
|
13785
|
+
lines.push(` Severity: ${halt.severity}`);
|
|
13786
|
+
lines.push(` Operator choice: ${halt.operatorChoice ?? "(none — non-interactive)"}`);
|
|
13787
|
+
}
|
|
13788
|
+
lines.push("");
|
|
13789
|
+
}
|
|
13730
13790
|
return lines.join("\n");
|
|
13731
13791
|
}
|
|
13732
13792
|
function renderJson(output) {
|
|
@@ -13734,8 +13794,12 @@ function renderJson(output) {
|
|
|
13734
13794
|
}
|
|
13735
13795
|
/**
|
|
13736
13796
|
* Build ReportOutput from a raw manifest.
|
|
13797
|
+
*
|
|
13798
|
+
* @param runId - Pipeline run ID.
|
|
13799
|
+
* @param manifest - Raw manifest data.
|
|
13800
|
+
* @param halts - Optional operator halt notifications (Story 73-2, AC12).
|
|
13737
13801
|
*/
|
|
13738
|
-
function assembleReport(runId, manifest) {
|
|
13802
|
+
function assembleReport(runId, manifest, halts) {
|
|
13739
13803
|
const perStoryState = manifest.per_story_state ?? {};
|
|
13740
13804
|
const storyKeys = Object.keys(perStoryState);
|
|
13741
13805
|
const startedAt = manifest.created_at ?? "";
|
|
@@ -13796,7 +13860,8 @@ function assembleReport(runId, manifest) {
|
|
|
13796
13860
|
stories,
|
|
13797
13861
|
escalations,
|
|
13798
13862
|
cost,
|
|
13799
|
-
duration
|
|
13863
|
+
duration,
|
|
13864
|
+
halts
|
|
13800
13865
|
};
|
|
13801
13866
|
}
|
|
13802
13867
|
/**
|
|
@@ -13935,7 +14000,11 @@ async function runReportAction(options) {
|
|
|
13935
14000
|
} catch (err) {
|
|
13936
14001
|
logger$1.debug({ err }, "Dolt enrichment unavailable — using manifest-only data (degraded mode)");
|
|
13937
14002
|
}
|
|
13938
|
-
const
|
|
14003
|
+
const halts = await readNotificationsForRun(resolvedRunId, dbRoot).catch((err) => {
|
|
14004
|
+
logger$1.debug({ err }, "notification read failed — continuing without halt data");
|
|
14005
|
+
return [];
|
|
14006
|
+
});
|
|
14007
|
+
const output = assembleReport(resolvedRunId, manifest, halts);
|
|
13939
14008
|
if (outputFormat === "json") process.stdout.write(renderJson(output) + "\n");
|
|
13940
14009
|
else process.stdout.write(renderHuman(output, manifest));
|
|
13941
14010
|
return 0;
|
|
@@ -13948,12 +14017,13 @@ async function runReportAction(options) {
|
|
|
13948
14017
|
* uniformity even though this command does not use it.
|
|
13949
14018
|
*/
|
|
13950
14019
|
function registerReportCommand(program, _version = "0.0.0", projectRoot = process.cwd(), _registry) {
|
|
13951
|
-
program.command("report").description("Read run manifest and produce a structured completion report").option("--run <id|latest>", "Run ID to report on, or \"latest\" (default: current-run-id file, then Dolt getLatestRun fallback)").option("--output-format <format>", "Output format: human (default) or json", "human").action(async (opts) => {
|
|
14020
|
+
program.command("report").description("Read run manifest and produce a structured completion report").option("--run <id|latest>", "Run ID to report on, or \"latest\" (default: current-run-id file, then Dolt getLatestRun fallback)").option("--output-format <format>", "Output format: human (default) or json", "human").option("--basePath <path>", "Base path override for .substrate directory (used by probes and tests)").action(async (opts) => {
|
|
13952
14021
|
const outputFormat = opts.outputFormat === "json" ? "json" : "human";
|
|
13953
14022
|
const exitCode = await runReportAction({
|
|
13954
14023
|
run: opts.run,
|
|
13955
14024
|
outputFormat,
|
|
13956
|
-
projectRoot
|
|
14025
|
+
projectRoot,
|
|
14026
|
+
_dbRoot: opts.basePath
|
|
13957
14027
|
});
|
|
13958
14028
|
process.exitCode = exitCode;
|
|
13959
14029
|
});
|
|
@@ -14035,8 +14105,8 @@ async function createProgram() {
|
|
|
14035
14105
|
/** Fire-and-forget startup version check (story 8.3, AC3/AC5) */
|
|
14036
14106
|
function checkForUpdatesInBackground(currentVersion) {
|
|
14037
14107
|
if (process.env.SUBSTRATE_NO_UPDATE_CHECK === "1") return;
|
|
14038
|
-
import("../upgrade-
|
|
14039
|
-
const { createVersionManager } = await import("../version-manager-impl-
|
|
14108
|
+
import("../upgrade-DxzQ1nss.js").then(async () => {
|
|
14109
|
+
const { createVersionManager } = await import("../version-manager-impl-GZDUBt0Q.js");
|
|
14040
14110
|
const vm = createVersionManager();
|
|
14041
14111
|
const result = await vm.checkForUpdates();
|
|
14042
14112
|
if (result.updateAvailable) {
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
//#region src/modules/decision-router/index.ts
|
|
2
|
+
/**
|
|
3
|
+
* Maps each known decision type to its severity level.
|
|
4
|
+
*
|
|
5
|
+
* Epic 70: cross-story-race-recovered (info — log only, no halt) and
|
|
6
|
+
* cross-story-race-still-failed (critical — recovery exhausted, halt for operator)
|
|
7
|
+
* motivate the registry pattern. Epic 73 (Recovery Engine) will register
|
|
8
|
+
* additional decision types here.
|
|
9
|
+
*/
|
|
10
|
+
const DECISION_SEVERITY_MAP = {
|
|
11
|
+
"cost-ceiling-exhausted": "critical",
|
|
12
|
+
"build-verification-failure": "critical",
|
|
13
|
+
"recovery-retry-attempt": "info",
|
|
14
|
+
"re-scope-proposal": "warning",
|
|
15
|
+
"scope-violation": "fatal",
|
|
16
|
+
"cross-story-race-recovered": "info",
|
|
17
|
+
"cross-story-race-still-failed": "critical",
|
|
18
|
+
"pipeline-escalation": "warning"
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Default action to apply when a decision does NOT trigger a halt.
|
|
22
|
+
* Caller invokes the returned defaultAction string autonomously.
|
|
23
|
+
*/
|
|
24
|
+
const DEFAULT_ACTION_MAP = {
|
|
25
|
+
"cost-ceiling-exhausted": "skip-remaining",
|
|
26
|
+
"build-verification-failure": "escalate-without-halt",
|
|
27
|
+
"recovery-retry-attempt": "continue-autonomous",
|
|
28
|
+
"re-scope-proposal": "escalate-without-halt",
|
|
29
|
+
"scope-violation": "abort-pipeline",
|
|
30
|
+
"cross-story-race-recovered": "continue-autonomous",
|
|
31
|
+
"cross-story-race-still-failed": "escalate-without-halt",
|
|
32
|
+
"pipeline-escalation": "escalate-without-halt"
|
|
33
|
+
};
|
|
34
|
+
/** Fallback default action for unknown decision types. */
|
|
35
|
+
const DEFAULT_DEFAULT_ACTION = "escalate-without-halt";
|
|
36
|
+
/**
|
|
37
|
+
* Route a halt-able decision through the autonomy policy.
|
|
38
|
+
*
|
|
39
|
+
* Pure function — no I/O, no side effects. All orchestrator state interactions
|
|
40
|
+
* remain in orchestrator-impl.ts.
|
|
41
|
+
*
|
|
42
|
+
* Halt policy logic (AC4):
|
|
43
|
+
* - 'all': halts on info | warning | critical | fatal
|
|
44
|
+
* - 'critical': halts on critical | fatal (default)
|
|
45
|
+
* - 'none': halts ONLY on fatal (scope violations bypass the autonomy-gradient
|
|
46
|
+
* policy — they are always halts regardless of the chosen policy)
|
|
47
|
+
*
|
|
48
|
+
* Fatal always halts regardless of policy — hard safety invariant, not configurable.
|
|
49
|
+
*
|
|
50
|
+
* Unknown decision types default to severity 'critical' (safe default, AC9e).
|
|
51
|
+
*
|
|
52
|
+
* @param decision - The decision type string to route
|
|
53
|
+
* @param policy - The autonomy policy from the --halt-on CLI flag
|
|
54
|
+
* @returns { halt: boolean, defaultAction: string, severity: Severity }
|
|
55
|
+
*/
|
|
56
|
+
function routeDecision(decision, policy) {
|
|
57
|
+
const severity = DECISION_SEVERITY_MAP[decision] ?? "critical";
|
|
58
|
+
let halt;
|
|
59
|
+
switch (policy) {
|
|
60
|
+
case "all":
|
|
61
|
+
halt = true;
|
|
62
|
+
break;
|
|
63
|
+
case "critical":
|
|
64
|
+
halt = severity === "critical" || severity === "fatal";
|
|
65
|
+
break;
|
|
66
|
+
case "none":
|
|
67
|
+
halt = severity === "fatal";
|
|
68
|
+
break;
|
|
69
|
+
default: halt = severity === "critical" || severity === "fatal";
|
|
70
|
+
}
|
|
71
|
+
if (severity === "fatal") halt = true;
|
|
72
|
+
const defaultAction = DEFAULT_ACTION_MAP[decision] ?? DEFAULT_DEFAULT_ACTION;
|
|
73
|
+
return {
|
|
74
|
+
halt,
|
|
75
|
+
defaultAction,
|
|
76
|
+
severity
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Derive the machine-readable exit code from pipeline completion results.
|
|
81
|
+
*
|
|
82
|
+
* - Exit `0` when all stories succeeded (or recovered cleanly)
|
|
83
|
+
* - Exit `1` when some stories escalated; run completed
|
|
84
|
+
* - Exit `2` when run-level failure (cost ceiling, fatal halt, orchestrator died, stories failed)
|
|
85
|
+
*
|
|
86
|
+
* @param outcome - Pipeline completion outcome data
|
|
87
|
+
* @returns 0 (success), 1 (escalated), or 2 (failure)
|
|
88
|
+
*/
|
|
89
|
+
function deriveExitCode(outcome) {
|
|
90
|
+
if (outcome.failed.length > 0 || outcome.costCeilingExhausted === true || outcome.fatalHaltReached === true || outcome.orchestratorDied === true) return 2;
|
|
91
|
+
if (outcome.escalated.length > 0 && outcome.failed.length === 0) return 1;
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
//#endregion
|
|
96
|
+
export { DECISION_SEVERITY_MAP, deriveExitCode, routeDecision };
|
|
97
|
+
//# sourceMappingURL=decision-router-DblHY8se.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-
|
|
2
|
-
import "./decisions-
|
|
1
|
+
import { addTokenUsage, createDecision, createPipelineRun, createRequirement, getArtifactByTypeForRun, getArtifactsByRun, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestRun, getPipelineRunById, getRunningPipelineRuns, getTokenUsageSummary, listRequirements, registerArtifact, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision } from "./dist-K_RRWnBX.js";
|
|
2
|
+
import "./decisions-CzSIEeGP.js";
|
|
3
3
|
|
|
4
4
|
export { getLatestRun };
|
|
@@ -11041,5 +11041,5 @@ async function callLLM(params) {
|
|
|
11041
11041
|
}
|
|
11042
11042
|
|
|
11043
11043
|
//#endregion
|
|
11044
|
-
export { ADVISORY_NOTES, AdapterRegistry, AdtError, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, Categorizer, ClaudeCodeAdapter, CodexCLIAdapter, ConfigError, ConfigIncompatibleFormatError, ConsumerAnalyzer, CostTrackerConfigSchema, DEFAULT_CONFIG, DEFAULT_GLOBAL_SETTINGS, DispatcherImpl, DoltClient, DoltNotInstalled, DoltQueryError, ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, EfficiencyScorer, GeminiCLIAdapter, GlobalSettingsSchema, InMemoryDatabaseAdapter, IngestionServer, LEARNING_FINDING, LogTurnAnalyzer, ModelRoutingConfigSchema, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProviderPolicySchema, ProvidersSchema, Recommender, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, STORY_METRICS, STORY_OUTCOME, SubstrateConfigSchema, TASK_TYPE_PHASE_MAP, TEST_EXPANSION_FINDING, TEST_PLAN, TelemetryConfigSchema, TelemetryNormalizer, TelemetryPipeline, TurnAnalyzer, VersionManagerImpl, addTokenUsage, aggregateTokenUsageForRun, aggregateTokenUsageForStory, buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, callLLM, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDatabaseAdapter as createDatabaseAdapter$1, createDecision, createDoltClient, createExperimenter, createPipelineRun, createRequirement, createVersionManager, detectInterfaceChanges, determineVerdict, getActiveDecisions, getAllCostEntriesFiltered, getArtifactByTypeForRun, getArtifactsByRun, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getModelTier, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRequirements, listRunMetrics, loadModelRoutingConfig, loadParentRunDecisions, registerArtifact, resolvePromptFile, supersedeDecision, tagRunAsBaseline, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics };
|
|
11045
|
-
//# sourceMappingURL=dist-
|
|
11044
|
+
export { ADVISORY_NOTES, AdapterRegistry as AdapterRegistry$1, AdtError as AdtError$1, BudgetConfigSchema, CURRENT_CONFIG_FORMAT_VERSION, CURRENT_TASK_GRAPH_VERSION, Categorizer, ClaudeCodeAdapter as ClaudeCodeAdapter$1, CodexCLIAdapter as CodexCLIAdapter$1, ConfigError as ConfigError$1, ConfigIncompatibleFormatError as ConfigIncompatibleFormatError$1, ConsumerAnalyzer, CostTrackerConfigSchema, DEFAULT_CONFIG, DEFAULT_GLOBAL_SETTINGS, DispatcherImpl, DoltClient, DoltNotInstalled, DoltQueryError, ESCALATION_DIAGNOSIS, EXPERIMENT_RESULT, EfficiencyScorer, GeminiCLIAdapter as GeminiCLIAdapter$1, GlobalSettingsSchema, InMemoryDatabaseAdapter, IngestionServer, LEARNING_FINDING, LogTurnAnalyzer, ModelRoutingConfigSchema, MonitorDatabaseImpl, OPERATIONAL_FINDING, PartialGlobalSettingsSchema, PartialProviderConfigSchema, ProviderPolicySchema, ProvidersSchema, Recommender, RoutingConfigError, RoutingRecommender, RoutingResolver, RoutingTelemetry, RoutingTokenAccumulator, RoutingTuner, STORY_METRICS, STORY_OUTCOME, SubstrateConfigSchema, TASK_TYPE_PHASE_MAP, TEST_EXPANSION_FINDING, TEST_PLAN, TelemetryConfigSchema, TelemetryNormalizer, TelemetryPipeline, TurnAnalyzer, VersionManagerImpl, addTokenUsage, aggregateTokenUsageForRun, aggregateTokenUsageForStory, buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, callLLM, checkDoltInstalled, compareRunMetrics, createAmendmentRun, createConfigSystem, createDatabaseAdapter as createDatabaseAdapter$1, createDecision, createDoltClient, createExperimenter, createPipelineRun, createRequirement, createVersionManager, detectInterfaceChanges, determineVerdict, getActiveDecisions, getAllCostEntriesFiltered, getArtifactByTypeForRun, getArtifactsByRun, getBaselineRunMetrics, getDecisionsByCategory, getDecisionsByPhase, getDecisionsByPhaseForRun, getLatestCompletedRun, getLatestRun, getModelTier, getPipelineRunById, getPlanningCostTotal, getRetryableEscalations, getRunMetrics, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRequirements, listRunMetrics, loadModelRoutingConfig, loadParentRunDecisions, registerArtifact, resolvePromptFile, supersedeDecision, tagRunAsBaseline, updateDecision, updatePipelineRun, updatePipelineRunConfig, upsertDecision, writeRunMetrics, writeStoryMetrics };
|
|
11045
|
+
//# sourceMappingURL=dist-K_RRWnBX.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AdtError } from "./dist-
|
|
1
|
+
import { AdtError$1 as AdtError } from "./dist-K_RRWnBX.js";
|
|
2
2
|
|
|
3
3
|
//#region src/core/errors.ts
|
|
4
4
|
/** Error thrown when task configuration is invalid */
|
|
@@ -71,4 +71,4 @@ var TaskGraphIncompatibleFormatError = class extends AdtError {
|
|
|
71
71
|
|
|
72
72
|
//#endregion
|
|
73
73
|
export { BudgetExceededError, GitError, RecoveryError, TaskConfigError, TaskGraphCycleError, TaskGraphError, TaskGraphIncompatibleFormatError, WorkerError, WorkerNotFoundError };
|
|
74
|
-
//# sourceMappingURL=errors-
|
|
74
|
+
//# sourceMappingURL=errors-pSiZbn6e.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-
|
|
1
|
+
import { buildAuditLogEntry, buildBranchName, buildModificationDirective, buildPRBody, buildWorktreePath, createExperimenter, determineVerdict, resolvePromptFile } from "./dist-K_RRWnBX.js";
|
|
2
2
|
|
|
3
3
|
export { createExperimenter };
|