substrate-ai 0.20.20 → 0.20.22
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, getRunningPipelineRuns, getSessionCostSummary, getSessionCostSummaryFiltered, getStoryMetricsForRun, getTokenUsageSummary, incrementRunRestarts, initSchema, initializeDolt, listRunMetrics, loadParentRunDecisions, supersedeDecision, tagRunAsBaseline, updatePipelineRun } from "../dist-CqtWS9wF.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-CzjafT8Q.js";
|
|
8
8
|
import "../errors-1uLGqnvr.js";
|
|
9
9
|
import "../routing-CcBOCuC9.js";
|
|
10
10
|
import "../decisions-C0pz9Clx.js";
|
|
@@ -5198,7 +5198,7 @@ async function runSupervisorAction(options, deps = {}) {
|
|
|
5198
5198
|
await initSchema(expAdapter);
|
|
5199
5199
|
const { runRunAction: runPipeline } = await import(
|
|
5200
5200
|
/* @vite-ignore */
|
|
5201
|
-
"../run-
|
|
5201
|
+
"../run-CeqtVM7r.js"
|
|
5202
5202
|
);
|
|
5203
5203
|
const runStoryFn = async (opts) => {
|
|
5204
5204
|
const exitCode = await runPipeline({
|
|
@@ -2,7 +2,7 @@ import "./health-ZGa9E0D2.js";
|
|
|
2
2
|
import "./logger-KeHncl-f.js";
|
|
3
3
|
import "./helpers-CElYrONe.js";
|
|
4
4
|
import "./dist-CqtWS9wF.js";
|
|
5
|
-
import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction, wireNdjsonEmitter } from "./run-
|
|
5
|
+
import { normalizeGraphSummaryToStatus, registerRunCommand, resolveMaxReviewCycles, runRunAction, wireNdjsonEmitter } from "./run-CzjafT8Q.js";
|
|
6
6
|
import "./routing-CcBOCuC9.js";
|
|
7
7
|
import "./decisions-C0pz9Clx.js";
|
|
8
8
|
|
|
@@ -5708,7 +5708,7 @@ function hashSourceAcSection(section) {
|
|
|
5708
5708
|
* @returns Promise resolving to CreateStoryResult
|
|
5709
5709
|
*/
|
|
5710
5710
|
async function runCreateStory(deps, params) {
|
|
5711
|
-
const { epicId, storyKey, pipelineRunId, source_ac_hash } = params;
|
|
5711
|
+
const { epicId, storyKey, pipelineRunId, source_ac_hash, priorDriftFeedback } = params;
|
|
5712
5712
|
logger$18.debug({
|
|
5713
5713
|
epicId,
|
|
5714
5714
|
storyKey,
|
|
@@ -5797,7 +5797,16 @@ async function runCreateStory(deps, params) {
|
|
|
5797
5797
|
name: "source_ac_hash",
|
|
5798
5798
|
content: effectiveSourceAcHash,
|
|
5799
5799
|
priority: "required"
|
|
5800
|
-
}] : []
|
|
5800
|
+
}] : [],
|
|
5801
|
+
...priorDriftFeedback !== void 0 && priorDriftFeedback.length > 0 ? [{
|
|
5802
|
+
name: "prior_drift_feedback",
|
|
5803
|
+
content: priorDriftFeedback,
|
|
5804
|
+
priority: "required"
|
|
5805
|
+
}] : [{
|
|
5806
|
+
name: "prior_drift_feedback",
|
|
5807
|
+
content: "",
|
|
5808
|
+
priority: "optional"
|
|
5809
|
+
}]
|
|
5801
5810
|
], TOKEN_CEILING);
|
|
5802
5811
|
logger$18.debug({
|
|
5803
5812
|
tokenCount,
|
|
@@ -6021,6 +6030,95 @@ function computeStoryFileFidelity(storyFileContent, namedPaths) {
|
|
|
6021
6030
|
drift: missing.length / namedPaths.length
|
|
6022
6031
|
};
|
|
6023
6032
|
}
|
|
6033
|
+
const WORD_TO_NUMBER = {
|
|
6034
|
+
one: 1,
|
|
6035
|
+
two: 2,
|
|
6036
|
+
three: 3,
|
|
6037
|
+
four: 4,
|
|
6038
|
+
five: 5,
|
|
6039
|
+
six: 6,
|
|
6040
|
+
seven: 7,
|
|
6041
|
+
eight: 8,
|
|
6042
|
+
nine: 9,
|
|
6043
|
+
ten: 10
|
|
6044
|
+
};
|
|
6045
|
+
function extractBehavioralAssertions(content) {
|
|
6046
|
+
if (content.length === 0) return {
|
|
6047
|
+
whenClauseCount: 0,
|
|
6048
|
+
whenOrAcCount: 0,
|
|
6049
|
+
numericQuantifiers: []
|
|
6050
|
+
};
|
|
6051
|
+
const whenMatches = content.match(/\*\*When\*\*/gi);
|
|
6052
|
+
const whenClauseCount = whenMatches?.length ?? 0;
|
|
6053
|
+
const acHeadings = content.match(/^#{2,4}\s+AC\d+\b/gim);
|
|
6054
|
+
const acCount = acHeadings?.length ?? 0;
|
|
6055
|
+
const whenOrAcCount = Math.max(whenClauseCount, acCount);
|
|
6056
|
+
const numericQuantifiers = [];
|
|
6057
|
+
const seen = new Set();
|
|
6058
|
+
const wordNum = "(?:one|two|three|four|five|six|seven|eight|nine|ten)";
|
|
6059
|
+
const pattern = new RegExp(`\\b(exactly|all|both)\\s+(?:(${wordNum}|\\d+)\\s+)?(?:[a-z][a-z_-]*\\s+){0,2}([a-z][a-z_-]+s)\\b`, "gi");
|
|
6060
|
+
let match$2;
|
|
6061
|
+
while ((match$2 = pattern.exec(content)) !== null) {
|
|
6062
|
+
const determiner = match$2[1]?.toLowerCase() ?? "";
|
|
6063
|
+
const numStr = match$2[2]?.toLowerCase() ?? "";
|
|
6064
|
+
const noun = match$2[3]?.toLowerCase() ?? "";
|
|
6065
|
+
let count;
|
|
6066
|
+
if (numStr === "") if (determiner === "both") count = 2;
|
|
6067
|
+
else continue;
|
|
6068
|
+
else if (WORD_TO_NUMBER[numStr] !== void 0) count = WORD_TO_NUMBER[numStr];
|
|
6069
|
+
else {
|
|
6070
|
+
const parsed = Number.parseInt(numStr, 10);
|
|
6071
|
+
if (Number.isNaN(parsed)) continue;
|
|
6072
|
+
count = parsed;
|
|
6073
|
+
}
|
|
6074
|
+
if (noun.length < 3) continue;
|
|
6075
|
+
const phrase = `${determiner} ${numStr || (determiner === "both" ? "" : "")} ${noun}`.trim().replace(/\s+/g, " ");
|
|
6076
|
+
const dedupKey = `${count}|${noun}`;
|
|
6077
|
+
if (seen.has(dedupKey)) continue;
|
|
6078
|
+
seen.add(dedupKey);
|
|
6079
|
+
numericQuantifiers.push({
|
|
6080
|
+
phrase,
|
|
6081
|
+
count,
|
|
6082
|
+
noun
|
|
6083
|
+
});
|
|
6084
|
+
}
|
|
6085
|
+
return {
|
|
6086
|
+
whenClauseCount,
|
|
6087
|
+
whenOrAcCount,
|
|
6088
|
+
numericQuantifiers
|
|
6089
|
+
};
|
|
6090
|
+
}
|
|
6091
|
+
function computeClauseFidelity(storyFileContent, sourceContent) {
|
|
6092
|
+
const sourceSignals = extractBehavioralAssertions(sourceContent);
|
|
6093
|
+
const renderedSignals = extractBehavioralAssertions(storyFileContent);
|
|
6094
|
+
const sourceCount = sourceSignals.whenOrAcCount;
|
|
6095
|
+
const renderedCount = renderedSignals.whenOrAcCount;
|
|
6096
|
+
const clauseRatio = sourceCount === 0 ? 1 : Math.min(1, renderedCount / sourceCount);
|
|
6097
|
+
const sourceNounCounts = new Map();
|
|
6098
|
+
for (const q of sourceSignals.numericQuantifiers) sourceNounCounts.set(q.noun, Math.max(sourceNounCounts.get(q.noun) ?? 0, q.count));
|
|
6099
|
+
const renderedNounCounts = new Map();
|
|
6100
|
+
for (const q of renderedSignals.numericQuantifiers) renderedNounCounts.set(q.noun, Math.max(renderedNounCounts.get(q.noun) ?? 0, q.count));
|
|
6101
|
+
const numericMismatches = [];
|
|
6102
|
+
for (const [noun, sourceCnt] of sourceNounCounts.entries()) {
|
|
6103
|
+
const renderedCnt = renderedNounCounts.get(noun) ?? 0;
|
|
6104
|
+
if (renderedCnt < sourceCnt) numericMismatches.push({
|
|
6105
|
+
noun,
|
|
6106
|
+
sourceCount: sourceCnt,
|
|
6107
|
+
renderedCount: renderedCnt
|
|
6108
|
+
});
|
|
6109
|
+
}
|
|
6110
|
+
const numericDriftComponent = numericMismatches.length > 0 ? 1 : 0;
|
|
6111
|
+
const CLAUSE_RATIO_FLOOR = .7;
|
|
6112
|
+
const clauseDriftComponent = clauseRatio >= CLAUSE_RATIO_FLOOR ? 0 : Math.min(1, (CLAUSE_RATIO_FLOOR - clauseRatio) / CLAUSE_RATIO_FLOOR);
|
|
6113
|
+
const drift = Math.max(numericDriftComponent, clauseDriftComponent);
|
|
6114
|
+
return {
|
|
6115
|
+
clauseRatio,
|
|
6116
|
+
sourceClauseCount: sourceCount,
|
|
6117
|
+
renderedClauseCount: renderedCount,
|
|
6118
|
+
numericMismatches,
|
|
6119
|
+
drift
|
|
6120
|
+
};
|
|
6121
|
+
}
|
|
6024
6122
|
/**
|
|
6025
6123
|
* Retrieve the epic shard from the pre-fetched implementation decisions.
|
|
6026
6124
|
*
|
|
@@ -8848,6 +8946,7 @@ async function seedEpicShards(db, projectRoot) {
|
|
|
8848
8946
|
}
|
|
8849
8947
|
const shards = parseEpicShards(content);
|
|
8850
8948
|
let count = 0;
|
|
8949
|
+
const seenKeys = new Set();
|
|
8851
8950
|
for (const shard of shards) {
|
|
8852
8951
|
const subsections = parseStorySubsections(shard.epicId, shard.content);
|
|
8853
8952
|
for (const subsection of subsections) {
|
|
@@ -8858,6 +8957,15 @@ async function seedEpicShards(db, projectRoot) {
|
|
|
8858
8957
|
truncatedLength: MAX_EPIC_SHARD_CHARS,
|
|
8859
8958
|
droppedChars: subsection.content.length - MAX_EPIC_SHARD_CHARS
|
|
8860
8959
|
}, `Epic shard for ${subsection.key} exceeded ${MAX_EPIC_SHARD_CHARS}-char cap and was truncated; tail content lost from decisions store. Consider splitting the story or raising MAX_EPIC_SHARD_CHARS.`);
|
|
8960
|
+
if (seenKeys.has(subsection.key)) {
|
|
8961
|
+
logger$11.warn({
|
|
8962
|
+
epicId: shard.epicId,
|
|
8963
|
+
storyKey: subsection.key,
|
|
8964
|
+
droppedContentLength: subsection.content.length
|
|
8965
|
+
}, `Epic shard parser produced duplicate key '${subsection.key}' (parser regression?); skipping additional insert. First entry retained.`);
|
|
8966
|
+
continue;
|
|
8967
|
+
}
|
|
8968
|
+
seenKeys.add(subsection.key);
|
|
8861
8969
|
await createDecision(db, {
|
|
8862
8970
|
pipeline_run_id: null,
|
|
8863
8971
|
phase: "implementation",
|
|
@@ -12246,6 +12354,7 @@ function createImplementationOrchestrator(deps) {
|
|
|
12246
12354
|
return;
|
|
12247
12355
|
}
|
|
12248
12356
|
let fidelityRetries = 0;
|
|
12357
|
+
let priorDriftFeedback;
|
|
12249
12358
|
while (storyFilePath === void 0) {
|
|
12250
12359
|
try {
|
|
12251
12360
|
incrementDispatches(storyKey);
|
|
@@ -12263,7 +12372,8 @@ function createImplementationOrchestrator(deps) {
|
|
|
12263
12372
|
epicId: storyKey.split("-")[0] ?? storyKey,
|
|
12264
12373
|
storyKey,
|
|
12265
12374
|
pipelineRunId: config.pipelineRunId,
|
|
12266
|
-
source_ac_hash: sourceAcHash
|
|
12375
|
+
source_ac_hash: sourceAcHash,
|
|
12376
|
+
...priorDriftFeedback !== void 0 ? { priorDriftFeedback } : {}
|
|
12267
12377
|
});
|
|
12268
12378
|
endPhase(storyKey, "create-story");
|
|
12269
12379
|
eventBus.emit("orchestrator:story-phase-complete", {
|
|
@@ -12499,67 +12609,114 @@ function createImplementationOrchestrator(deps) {
|
|
|
12499
12609
|
}
|
|
12500
12610
|
if (fidelitySourceContent !== void 0) {
|
|
12501
12611
|
const namedPaths = extractNamedPathsFromSource(fidelitySourceContent);
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12511
|
-
|
|
12512
|
-
|
|
12513
|
-
|
|
12514
|
-
|
|
12515
|
-
|
|
12516
|
-
|
|
12517
|
-
|
|
12518
|
-
|
|
12519
|
-
|
|
12520
|
-
|
|
12521
|
-
|
|
12522
|
-
|
|
12523
|
-
|
|
12524
|
-
|
|
12525
|
-
|
|
12526
|
-
|
|
12527
|
-
|
|
12528
|
-
|
|
12529
|
-
|
|
12530
|
-
|
|
12531
|
-
continue;
|
|
12532
|
-
} catch (renameErr) {
|
|
12533
|
-
logger$24.warn({
|
|
12534
|
-
storyKey,
|
|
12535
|
-
err: renameErr,
|
|
12536
|
-
stalePath
|
|
12537
|
-
}, "failed to rename drifting artifact for retry; proceeding with current artifact");
|
|
12538
|
-
}
|
|
12539
|
-
} else {
|
|
12540
|
-
const errMsg = `create-story output drifted from source AC after ${MAX_FIDELITY_RETRIES} retries; ${fidelity.missing.length} of ${namedPaths.length} named paths missing: ` + fidelity.missing.join(", ");
|
|
12541
|
-
logger$24.error({
|
|
12612
|
+
const storyContentForFidelity = await readFile$1(storyFilePath, "utf-8");
|
|
12613
|
+
const pathFidelity = namedPaths.length >= MIN_NAMED_PATHS_FOR_FIDELITY_GATE ? computeStoryFileFidelity(storyContentForFidelity, namedPaths) : null;
|
|
12614
|
+
const clauseFidelity = computeClauseFidelity(storyContentForFidelity, fidelitySourceContent);
|
|
12615
|
+
const pathDrift = pathFidelity?.drift ?? 0;
|
|
12616
|
+
const clauseDrift = clauseFidelity.drift;
|
|
12617
|
+
const overallDrift = Math.max(pathDrift, clauseDrift);
|
|
12618
|
+
logger$24.debug({
|
|
12619
|
+
storyKey,
|
|
12620
|
+
pathDrift,
|
|
12621
|
+
clauseDrift,
|
|
12622
|
+
overallDrift,
|
|
12623
|
+
pathMissing: pathFidelity?.missing ?? [],
|
|
12624
|
+
numericMismatches: clauseFidelity.numericMismatches,
|
|
12625
|
+
clauseRatio: clauseFidelity.clauseRatio
|
|
12626
|
+
}, "create-story output fidelity check (path + clause)");
|
|
12627
|
+
if (overallDrift > FIDELITY_DRIFT_THRESHOLD) {
|
|
12628
|
+
fidelityRetries++;
|
|
12629
|
+
if (fidelityRetries <= MAX_FIDELITY_RETRIES) {
|
|
12630
|
+
const stalePath = storyFilePath.replace(/\.md$/, `.stale-${Date.now()}.md`);
|
|
12631
|
+
try {
|
|
12632
|
+
renameSync(storyFilePath, stalePath);
|
|
12633
|
+
const driftPct = Math.round(overallDrift * 100);
|
|
12634
|
+
const pathMissing = pathFidelity?.missing ?? [];
|
|
12635
|
+
const numericMismatches = clauseFidelity.numericMismatches;
|
|
12636
|
+
const reasons = [];
|
|
12637
|
+
if (pathMissing.length > 0) reasons.push(`${pathMissing.length} named path(s) missing`);
|
|
12638
|
+
if (numericMismatches.length > 0) reasons.push(`${numericMismatches.length} numeric quantifier mismatch(es) (e.g., "${numericMismatches[0].noun}" source=${numericMismatches[0].sourceCount} rendered=${numericMismatches[0].renderedCount})`);
|
|
12639
|
+
if (clauseFidelity.clauseRatio < .7) reasons.push(`clause shortfall (rendered ${clauseFidelity.renderedClauseCount}/${clauseFidelity.sourceClauseCount} = ${Math.round(clauseFidelity.clauseRatio * 100)}%)`);
|
|
12640
|
+
logger$24.warn({
|
|
12542
12641
|
storyKey,
|
|
12543
|
-
|
|
12544
|
-
|
|
12545
|
-
|
|
12546
|
-
|
|
12547
|
-
|
|
12548
|
-
|
|
12549
|
-
|
|
12550
|
-
|
|
12551
|
-
|
|
12552
|
-
});
|
|
12553
|
-
await writeStoryMetricsBestEffort(storyKey, "failed", 0);
|
|
12554
|
-
await emitEscalation({
|
|
12642
|
+
pathDrift,
|
|
12643
|
+
clauseDrift,
|
|
12644
|
+
pathMissing,
|
|
12645
|
+
numericMismatches,
|
|
12646
|
+
clauseRatio: clauseFidelity.clauseRatio,
|
|
12647
|
+
retries: fidelityRetries,
|
|
12648
|
+
stalePath
|
|
12649
|
+
}, `create-story output drifted from source AC (${driftPct}% drift, ${reasons.join("; ")}); renamed to ${stalePath} and retrying (${fidelityRetries}/${MAX_FIDELITY_RETRIES})`);
|
|
12650
|
+
eventBus.emit("orchestrator:story-warn", {
|
|
12555
12651
|
storyKey,
|
|
12556
|
-
|
|
12557
|
-
reviewCycles: 0,
|
|
12558
|
-
issues: [errMsg]
|
|
12652
|
+
msg: `create-story drift detected (${reasons.join("; ")}); retry ${fidelityRetries}/${MAX_FIDELITY_RETRIES}`
|
|
12559
12653
|
});
|
|
12560
|
-
|
|
12561
|
-
|
|
12654
|
+
const feedbackParts = [
|
|
12655
|
+
`### Prior Dispatch Drift Detected (retry ${fidelityRetries}/${MAX_FIDELITY_RETRIES})`,
|
|
12656
|
+
"",
|
|
12657
|
+
`A previous create-story dispatch produced an artifact that drifted from the source AC. The previous artifact has been moved to \`${stalePath}\`.`,
|
|
12658
|
+
"",
|
|
12659
|
+
"**Specific drift findings:**",
|
|
12660
|
+
""
|
|
12661
|
+
];
|
|
12662
|
+
if (pathMissing.length > 0) {
|
|
12663
|
+
feedbackParts.push("Named paths/files from source AC that were missing in the prior dispatch:");
|
|
12664
|
+
feedbackParts.push("");
|
|
12665
|
+
feedbackParts.push(...pathMissing.map((p) => `- \`${p}\``));
|
|
12666
|
+
feedbackParts.push("");
|
|
12667
|
+
}
|
|
12668
|
+
if (numericMismatches.length > 0) {
|
|
12669
|
+
feedbackParts.push("Numeric quantifiers from source AC that were reduced in the prior dispatch:");
|
|
12670
|
+
feedbackParts.push("");
|
|
12671
|
+
feedbackParts.push(...numericMismatches.map((m) => `- source AC says "**${m.sourceCount}** ${m.noun}"; rendered artifact says "${m.renderedCount}" — restore the original count and the named items`));
|
|
12672
|
+
feedbackParts.push("");
|
|
12673
|
+
}
|
|
12674
|
+
if (clauseFidelity.clauseRatio < .7) {
|
|
12675
|
+
feedbackParts.push(`The source AC has ${clauseFidelity.sourceClauseCount} behavioral clauses (Given/When/Then triples or numbered ACs); the prior rendered artifact had only ${clauseFidelity.renderedClauseCount}. You dropped clauses without authorization. Either preserve all source clauses verbatim, OR if the scope is genuinely too large for a single story, emit \`result: failure, error: source scope exceeds single-story capacity — split upstream\` per the prompt's Scope Cap Guidance — silently reducing scope is forbidden.`);
|
|
12676
|
+
feedbackParts.push("");
|
|
12677
|
+
}
|
|
12678
|
+
feedbackParts.push("Preserve the source AC contract verbatim: every named file/path, every numeric quantifier (`exactly N`, `all N`, `both`), and every behavioral clause. Do not substitute names from training priors. Do not silently reduce scope. If the scope cannot fit, emit `result: failure, error: source scope exceeds single-story capacity — split upstream` instead of partially rendering.");
|
|
12679
|
+
priorDriftFeedback = feedbackParts.join("\n");
|
|
12680
|
+
storyFilePath = void 0;
|
|
12681
|
+
continue;
|
|
12682
|
+
} catch (renameErr) {
|
|
12683
|
+
logger$24.warn({
|
|
12684
|
+
storyKey,
|
|
12685
|
+
err: renameErr,
|
|
12686
|
+
stalePath
|
|
12687
|
+
}, "failed to rename drifting artifact for retry; proceeding with current artifact");
|
|
12562
12688
|
}
|
|
12689
|
+
} else {
|
|
12690
|
+
const pathMissing = pathFidelity?.missing ?? [];
|
|
12691
|
+
const numericMismatches = clauseFidelity.numericMismatches;
|
|
12692
|
+
const reasons = [];
|
|
12693
|
+
if (pathMissing.length > 0) reasons.push(`paths missing: ${pathMissing.join(", ")}`);
|
|
12694
|
+
if (numericMismatches.length > 0) reasons.push(`numeric mismatches: ${numericMismatches.map((m) => `${m.noun} (source=${m.sourceCount}, rendered=${m.renderedCount})`).join("; ")}`);
|
|
12695
|
+
if (clauseFidelity.clauseRatio < .7) reasons.push(`clause shortfall: source=${clauseFidelity.sourceClauseCount}, rendered=${clauseFidelity.renderedClauseCount}`);
|
|
12696
|
+
const errMsg = `create-story output drifted from source AC after ${MAX_FIDELITY_RETRIES} retries; ` + reasons.join("; ");
|
|
12697
|
+
logger$24.error({
|
|
12698
|
+
storyKey,
|
|
12699
|
+
pathDrift,
|
|
12700
|
+
clauseDrift,
|
|
12701
|
+
pathMissing,
|
|
12702
|
+
numericMismatches,
|
|
12703
|
+
clauseRatio: clauseFidelity.clauseRatio
|
|
12704
|
+
}, errMsg);
|
|
12705
|
+
endPhase(storyKey, "create-story");
|
|
12706
|
+
updateStory(storyKey, {
|
|
12707
|
+
phase: "ESCALATED",
|
|
12708
|
+
error: errMsg,
|
|
12709
|
+
completedAt: new Date().toISOString()
|
|
12710
|
+
});
|
|
12711
|
+
await writeStoryMetricsBestEffort(storyKey, "failed", 0);
|
|
12712
|
+
await emitEscalation({
|
|
12713
|
+
storyKey,
|
|
12714
|
+
lastVerdict: "create-story-source-ac-drift",
|
|
12715
|
+
reviewCycles: 0,
|
|
12716
|
+
issues: [errMsg]
|
|
12717
|
+
});
|
|
12718
|
+
await persistState();
|
|
12719
|
+
return;
|
|
12563
12720
|
}
|
|
12564
12721
|
}
|
|
12565
12722
|
}
|
|
@@ -44299,4 +44456,4 @@ function registerRunCommand(program, _version = "0.0.0", projectRoot = process.c
|
|
|
44299
44456
|
|
|
44300
44457
|
//#endregion
|
|
44301
44458
|
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, resolveMaxReviewCycles, resolveStoryKeys, runAnalysisPhase, runPlanningPhase, runRunAction, runSolutioningPhase, validateStopAfterFromConflict, wireNdjsonEmitter };
|
|
44302
|
-
//# sourceMappingURL=run-
|
|
44459
|
+
//# sourceMappingURL=run-CzjafT8Q.js.map
|
package/package.json
CHANGED