@resolveio/server-lib 22.3.133 → 22.3.135
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/package.json +1 -1
- package/util/ai-runner-manager-policy.d.ts +37 -0
- package/util/ai-runner-manager-policy.js +149 -13
- package/util/ai-runner-manager-policy.js.map +1 -1
- package/util/aicoder-runner-v6.d.ts +3 -1
- package/util/aicoder-runner-v6.js +26 -111
- package/util/aicoder-runner-v6.js.map +1 -1
- package/util/support-runner-v5.d.ts +4 -1
- package/util/support-runner-v5.js +42 -103
- package/util/support-runner-v5.js.map +1 -1
package/package.json
CHANGED
|
@@ -53,6 +53,36 @@ export interface ResolveIOAIManagerRecoveryCheckpoint {
|
|
|
53
53
|
createdAt: string;
|
|
54
54
|
updatedAt: string;
|
|
55
55
|
}
|
|
56
|
+
export type ResolveIOAIManagerRecoveryEvidenceProbeStepKind = 'read_only_diagnosis' | 'rerun_same_gate' | 'infra_preflight' | 'compile_check' | 'route_probe' | 'business_assertion' | 'journey_validation' | 'release_status' | 'diff_scope_check' | 'operator_review';
|
|
57
|
+
export interface ResolveIOAIManagerRecoveryEvidenceProbeStep {
|
|
58
|
+
id: string;
|
|
59
|
+
kind: ResolveIOAIManagerRecoveryEvidenceProbeStepKind;
|
|
60
|
+
label: string;
|
|
61
|
+
objective: string;
|
|
62
|
+
required: boolean;
|
|
63
|
+
commandHint?: string;
|
|
64
|
+
artifactExpectation: string;
|
|
65
|
+
successSignal: string;
|
|
66
|
+
}
|
|
67
|
+
export interface ResolveIOAIManagerRecoveryEvidenceProbe {
|
|
68
|
+
probeId: string;
|
|
69
|
+
checkpointId: string;
|
|
70
|
+
recoveryClass: ResolveIOAIManagerRecoveryClass;
|
|
71
|
+
lane: string;
|
|
72
|
+
stepType: string;
|
|
73
|
+
objective: string;
|
|
74
|
+
evidenceOnly: boolean;
|
|
75
|
+
productRepairAllowed: boolean;
|
|
76
|
+
expensiveModelAllowed: boolean;
|
|
77
|
+
evidenceHashBefore: string;
|
|
78
|
+
blockerFingerprint: string;
|
|
79
|
+
steps: ResolveIOAIManagerRecoveryEvidenceProbeStep[];
|
|
80
|
+
requiredArtifacts: string[];
|
|
81
|
+
acceptanceEvidence: string[];
|
|
82
|
+
stopConditions: string[];
|
|
83
|
+
loopResetEvidence: string[];
|
|
84
|
+
createdAt: string;
|
|
85
|
+
}
|
|
56
86
|
export interface ResolveIOAIManagerRecoveryCheckpointInput {
|
|
57
87
|
plan: ResolveIOAIManagerRecoveryPlan;
|
|
58
88
|
current?: ResolveIOAIManagerFailureRecord;
|
|
@@ -80,6 +110,11 @@ export interface ResolveIOAIManagerRecoveryGateDecision {
|
|
|
80
110
|
missingEvidence: string[];
|
|
81
111
|
checkpoint: ResolveIOAIManagerRecoveryCheckpoint;
|
|
82
112
|
}
|
|
113
|
+
export interface ResolveIOAIManagerRecoveryEvidenceProbeInput {
|
|
114
|
+
checkpoint: ResolveIOAIManagerRecoveryCheckpoint;
|
|
115
|
+
current?: ResolveIOAIManagerFailureRecord;
|
|
116
|
+
now?: Date | string;
|
|
117
|
+
}
|
|
83
118
|
export interface ResolveIOAIManagerRecoveryPlanInput {
|
|
84
119
|
action?: ResolveIOAIManagerAction | string;
|
|
85
120
|
reason?: string;
|
|
@@ -116,11 +151,13 @@ export interface ResolveIOAIManagerPolicyDecision {
|
|
|
116
151
|
productRepairFailure: boolean;
|
|
117
152
|
recoveryPlan: ResolveIOAIManagerRecoveryPlan;
|
|
118
153
|
recoveryCheckpoint: ResolveIOAIManagerRecoveryCheckpoint;
|
|
154
|
+
recoveryEvidenceProbe: ResolveIOAIManagerRecoveryEvidenceProbe;
|
|
119
155
|
}
|
|
120
156
|
export declare function normalizeResolveIOAIManagerFailureClass(value: any): string;
|
|
121
157
|
export declare function fingerprintResolveIOAIManagerBlocker(value: any): string;
|
|
122
158
|
export declare function hashResolveIOAIManagerEvidence(record: ResolveIOAIManagerFailureRecord | undefined): string;
|
|
123
159
|
export declare function buildResolveIOAIManagerRecoveryCheckpoint(input: ResolveIOAIManagerRecoveryCheckpointInput): ResolveIOAIManagerRecoveryCheckpoint;
|
|
160
|
+
export declare function buildResolveIOAIManagerRecoveryEvidenceProbe(input: ResolveIOAIManagerRecoveryEvidenceProbeInput): ResolveIOAIManagerRecoveryEvidenceProbe;
|
|
124
161
|
export declare function decideResolveIOAIManagerRecoveryGate(input: ResolveIOAIManagerRecoveryGateInput): ResolveIOAIManagerRecoveryGateDecision;
|
|
125
162
|
export declare function buildResolveIOAIManagerRecoveryPlan(input?: ResolveIOAIManagerRecoveryPlanInput): ResolveIOAIManagerRecoveryPlan;
|
|
126
163
|
export declare function decideResolveIOAIManagerPolicy(input: ResolveIOAIManagerPolicyInput): ResolveIOAIManagerPolicyDecision;
|
|
@@ -21,11 +21,37 @@ var __values = (this && this.__values) || function(o) {
|
|
|
21
21
|
};
|
|
22
22
|
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
23
|
};
|
|
24
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
25
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
26
|
+
if (!m) return o;
|
|
27
|
+
var i = m.call(o), r, ar = [], e;
|
|
28
|
+
try {
|
|
29
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
30
|
+
}
|
|
31
|
+
catch (error) { e = { error: error }; }
|
|
32
|
+
finally {
|
|
33
|
+
try {
|
|
34
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
35
|
+
}
|
|
36
|
+
finally { if (e) throw e.error; }
|
|
37
|
+
}
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
41
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
42
|
+
if (ar || !(i in from)) {
|
|
43
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
44
|
+
ar[i] = from[i];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
48
|
+
};
|
|
24
49
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
50
|
exports.normalizeResolveIOAIManagerFailureClass = normalizeResolveIOAIManagerFailureClass;
|
|
26
51
|
exports.fingerprintResolveIOAIManagerBlocker = fingerprintResolveIOAIManagerBlocker;
|
|
27
52
|
exports.hashResolveIOAIManagerEvidence = hashResolveIOAIManagerEvidence;
|
|
28
53
|
exports.buildResolveIOAIManagerRecoveryCheckpoint = buildResolveIOAIManagerRecoveryCheckpoint;
|
|
54
|
+
exports.buildResolveIOAIManagerRecoveryEvidenceProbe = buildResolveIOAIManagerRecoveryEvidenceProbe;
|
|
29
55
|
exports.decideResolveIOAIManagerRecoveryGate = decideResolveIOAIManagerRecoveryGate;
|
|
30
56
|
exports.buildResolveIOAIManagerRecoveryPlan = buildResolveIOAIManagerRecoveryPlan;
|
|
31
57
|
exports.decideResolveIOAIManagerPolicy = decideResolveIOAIManagerPolicy;
|
|
@@ -111,6 +137,17 @@ function fingerprintResolveIOAIManagerBlocker(value) {
|
|
|
111
137
|
.trim();
|
|
112
138
|
return stableHash('mgr-blocker', normalized);
|
|
113
139
|
}
|
|
140
|
+
function resolveResolveIOAIManagerBlockerFingerprint(record, fallback) {
|
|
141
|
+
var blockerText = cleanText((record === null || record === void 0 ? void 0 : record.blocker) || (record === null || record === void 0 ? void 0 : record.summary), 4000);
|
|
142
|
+
if (blockerText) {
|
|
143
|
+
return fingerprintResolveIOAIManagerBlocker(blockerText);
|
|
144
|
+
}
|
|
145
|
+
var explicit = cleanText(record === null || record === void 0 ? void 0 : record.blockerFingerprint, 120);
|
|
146
|
+
if (explicit) {
|
|
147
|
+
return explicit;
|
|
148
|
+
}
|
|
149
|
+
return fingerprintResolveIOAIManagerBlocker(fallback || '');
|
|
150
|
+
}
|
|
114
151
|
function hashResolveIOAIManagerEvidence(record) {
|
|
115
152
|
if (!record) {
|
|
116
153
|
return stableHash('mgr-evidence', '');
|
|
@@ -129,8 +166,7 @@ function hashResolveIOAIManagerEvidence(record) {
|
|
|
129
166
|
function buildResolveIOAIManagerRecoveryCheckpoint(input) {
|
|
130
167
|
var plan = input.plan;
|
|
131
168
|
var current = input.current || {};
|
|
132
|
-
var blockerFingerprint =
|
|
133
|
-
|| fingerprintResolveIOAIManagerBlocker(current.blocker || current.summary || plan.objective || '');
|
|
169
|
+
var blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current, plan.objective);
|
|
134
170
|
var evidenceHash = hashResolveIOAIManagerEvidence(current);
|
|
135
171
|
var changedFiles = cleanList(current.changedFiles, 80, 500);
|
|
136
172
|
var artifactPaths = cleanList(current.artifactPaths, 80, 500);
|
|
@@ -182,6 +218,102 @@ function buildResolveIOAIManagerRecoveryCheckpoint(input) {
|
|
|
182
218
|
updatedAt: now
|
|
183
219
|
};
|
|
184
220
|
}
|
|
221
|
+
function makeRecoveryEvidenceProbeStep(id, kind, label, objective, artifactExpectation, successSignal, options) {
|
|
222
|
+
if (options === void 0) { options = {}; }
|
|
223
|
+
return __assign(__assign({ id: id, kind: kind, label: label, objective: cleanText(objective, 1000), required: options.required !== false }, (options.commandHint ? { commandHint: cleanText(options.commandHint, 500) } : {})), { artifactExpectation: cleanText(artifactExpectation, 500), successSignal: cleanText(successSignal, 500) });
|
|
224
|
+
}
|
|
225
|
+
function recoveryEvidenceProbeStepsFor(checkpoint) {
|
|
226
|
+
var base = [
|
|
227
|
+
makeRecoveryEvidenceProbeStep('snapshot_current_blocker', 'rerun_same_gate', 'Snapshot Current Blocker', 'Capture the current blocker, failure class, evidence hash, changed files, and artifact paths before any new repair.', 'runner-evidence/current-blocker.json', 'Snapshot includes the same checkpointId, blockerFingerprint, and evidenceHashBefore.')
|
|
228
|
+
];
|
|
229
|
+
if (checkpoint.recoveryClass === 'diagnosis_only' || checkpoint.recoveryClass === 'diagnosis_revision') {
|
|
230
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
231
|
+
makeRecoveryEvidenceProbeStep('collect_read_only_root_cause_evidence', 'read_only_diagnosis', 'Collect Read-Only Root-Cause Evidence', checkpoint.recoveryClass === 'diagnosis_revision'
|
|
232
|
+
? 'Collect new evidence that proves the current owner_files or failing_path is wrong before broadening scope.'
|
|
233
|
+
: 'Reproduce or classify the issue and record the exact customer complaint, expected result, observed result, route/module, and account context.', 'runner-evidence/diagnosis-readonly.md', 'Evidence supports one falsifiable accepted hypothesis and at least one rejected alternative.'),
|
|
234
|
+
makeRecoveryEvidenceProbeStep('validate_diagnosis_gate', 'read_only_diagnosis', 'Validate Diagnosis Gate', 'Validate issue_case, accepted_hypothesis, rejected_alternatives, failing_path, owner_files, and before/action/after proof_plan.', 'runner-evidence/diagnosis-gate.json', 'Diagnosis gate validates before product-code repair is allowed.')
|
|
235
|
+
], false);
|
|
236
|
+
}
|
|
237
|
+
if (checkpoint.recoveryClass === 'infra_repair') {
|
|
238
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
239
|
+
makeRecoveryEvidenceProbeStep('run_infra_preflight', 'infra_preflight', 'Run Infra Preflight', 'Check Puppeteer/Chrome, ports, Mongo/settings, cache state, startup commands, and server/client process health.', 'runner-evidence/infra-preflight.log', 'The same infra gate either passes or returns a new infra blocker hash.', { commandHint: 'runner preflight: puppeteer/chrome/mongo/ports/startup' })
|
|
240
|
+
], false);
|
|
241
|
+
}
|
|
242
|
+
if (checkpoint.recoveryClass === 'compile_repair') {
|
|
243
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
244
|
+
makeRecoveryEvidenceProbeStep('rerun_compile_gate', 'compile_check', 'Rerun Compile Gate', 'Rerun the same deterministic compile/build command and capture the first actionable error.', 'runner-evidence/compile.log', 'Compile passes or the first failing error changes.', { commandHint: 'same finite build/compile command from the failed gate' })
|
|
245
|
+
], false);
|
|
246
|
+
}
|
|
247
|
+
if (checkpoint.recoveryClass === 'journey_contract_repair') {
|
|
248
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
249
|
+
makeRecoveryEvidenceProbeStep('validate_journey_contract', 'journey_validation', 'Validate Journey Contract', 'Validate docs/APP_JOURNEY_CONTRACT.md has first/next/last workflow, route/action/method mapping, seeded data story, completion states, and QA assertions.', 'runner-evidence/journey-contract-validation.json', 'Journey contract validates before build tasks continue.'),
|
|
250
|
+
makeRecoveryEvidenceProbeStep('verify_hub_workflow_mapping', 'journey_validation', 'Verify Hub Workflow Mapping', 'Confirm the hub CTA and screen sequence implement the journey contract instead of link-only navigation.', 'runner-evidence/hub-workflow-map.json', 'Primary hub action maps to a real route/action/method/calculation and next state.')
|
|
251
|
+
], false);
|
|
252
|
+
}
|
|
253
|
+
if (checkpoint.recoveryClass === 'business_proof_repair' || checkpoint.recoveryClass === 'product_code_repair') {
|
|
254
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
255
|
+
makeRecoveryEvidenceProbeStep('rerun_business_assertion', 'business_assertion', 'Rerun Business Assertion', 'Run the exact issue/app promise proof and capture before/action/after DOM/data evidence.', 'runner-evidence/business-assertion.json', 'Business assertion passes, or the observed failure changes with a new artifact path.'),
|
|
256
|
+
makeRecoveryEvidenceProbeStep('check_diff_scope', 'diff_scope_check', 'Check Diff Scope', 'Compare changed files against the current diagnosis/journey owner scope before another code repair.', 'runner-evidence/diff-scope.json', 'Changed files are in scope, or diagnosis/journey scope is revised with evidence.')
|
|
257
|
+
], false);
|
|
258
|
+
}
|
|
259
|
+
if (checkpoint.recoveryClass === 'release_repair') {
|
|
260
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
261
|
+
makeRecoveryEvidenceProbeStep('collect_release_status', 'release_status', 'Collect Release Status', 'Collect publish/deploy/build-instance/domain/CloudFront status and the last actionable deploy error.', 'runner-evidence/release-status.json', 'Release gate passes or returns a new release blocker hash without product-code repair.')
|
|
262
|
+
], false);
|
|
263
|
+
}
|
|
264
|
+
if (checkpoint.recoveryClass === 'manual_handoff') {
|
|
265
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
266
|
+
makeRecoveryEvidenceProbeStep('operator_review_checkpoint', 'operator_review', 'Operator Review Checkpoint', 'Expose budget, blocker, evidence hash, and the minimum policy/scope change needed before another expensive loop.', 'runner-evidence/operator-review.json', 'Operator approves a new scope/policy or provides new external evidence.')
|
|
267
|
+
], false);
|
|
268
|
+
}
|
|
269
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
270
|
+
makeRecoveryEvidenceProbeStep('rerun_same_deterministic_gate', 'rerun_same_gate', 'Rerun Same Deterministic Gate', 'Rerun the exact failed check and capture new logs/artifacts without changing product code first.', 'runner-evidence/retry-gate.log', 'Gate passes, or evidenceHash/blockerFingerprint/artifactPaths change.')
|
|
271
|
+
], false);
|
|
272
|
+
}
|
|
273
|
+
function buildResolveIOAIManagerRecoveryEvidenceProbe(input) {
|
|
274
|
+
var checkpoint = input.checkpoint;
|
|
275
|
+
var now = isoNow(input.now);
|
|
276
|
+
var steps = recoveryEvidenceProbeStepsFor(checkpoint);
|
|
277
|
+
var requiredArtifacts = Array.from(new Set(steps
|
|
278
|
+
.filter(function (step) { return step.required; })
|
|
279
|
+
.map(function (step) { return step.artifactExpectation; })
|
|
280
|
+
.filter(Boolean)));
|
|
281
|
+
return {
|
|
282
|
+
probeId: stableHash('mgr-probe', {
|
|
283
|
+
checkpointId: checkpoint.checkpointId,
|
|
284
|
+
recoveryClass: checkpoint.recoveryClass,
|
|
285
|
+
evidenceHash: checkpoint.evidenceHash,
|
|
286
|
+
blockerFingerprint: checkpoint.blockerFingerprint
|
|
287
|
+
}),
|
|
288
|
+
checkpointId: checkpoint.checkpointId,
|
|
289
|
+
recoveryClass: checkpoint.recoveryClass,
|
|
290
|
+
lane: checkpoint.lane,
|
|
291
|
+
stepType: checkpoint.stepType,
|
|
292
|
+
objective: checkpoint.status === 'parked'
|
|
293
|
+
? 'Collect new evidence before any additional expensive model/code repair.'
|
|
294
|
+
: cleanText(checkpoint.objective, 1000),
|
|
295
|
+
evidenceOnly: checkpoint.status === 'parked'
|
|
296
|
+
|| checkpoint.recoveryClass === 'diagnosis_only'
|
|
297
|
+
|| checkpoint.recoveryClass === 'diagnosis_revision'
|
|
298
|
+
|| checkpoint.recoveryClass === 'infra_repair'
|
|
299
|
+
|| checkpoint.recoveryClass === 'compile_repair'
|
|
300
|
+
|| checkpoint.recoveryClass === 'release_repair',
|
|
301
|
+
productRepairAllowed: checkpoint.productRepairAllowed && checkpoint.status !== 'parked',
|
|
302
|
+
expensiveModelAllowed: checkpoint.expensiveModelAllowed && checkpoint.status !== 'parked',
|
|
303
|
+
evidenceHashBefore: checkpoint.evidenceHash,
|
|
304
|
+
blockerFingerprint: checkpoint.blockerFingerprint,
|
|
305
|
+
steps: steps,
|
|
306
|
+
requiredArtifacts: requiredArtifacts,
|
|
307
|
+
acceptanceEvidence: Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(checkpoint.requiredEvidence), false), __read(checkpoint.loopResetEvidence), false), __read(steps.map(function (step) { return step.successSignal; })), false).map(function (entry) { return cleanText(entry, 500); }).filter(Boolean))).slice(0, 30),
|
|
308
|
+
stopConditions: Array.from(new Set(__spreadArray(__spreadArray([], __read(checkpoint.forbiddenActions), false), [
|
|
309
|
+
'no new evidence hash',
|
|
310
|
+
'no new artifact path',
|
|
311
|
+
'product-code repair requested while evidenceOnly is true'
|
|
312
|
+
], false).map(function (entry) { return cleanText(entry, 500); }).filter(Boolean))).slice(0, 30),
|
|
313
|
+
loopResetEvidence: checkpoint.loopResetEvidence,
|
|
314
|
+
createdAt: now
|
|
315
|
+
};
|
|
316
|
+
}
|
|
185
317
|
function listHasNewEntry(current, previous) {
|
|
186
318
|
var existing = new Set(previous.map(function (entry) { return cleanText(entry, 500); }).filter(Boolean));
|
|
187
319
|
return current.some(function (entry) {
|
|
@@ -196,12 +328,14 @@ function proposedActionIsProductRepair(value) {
|
|
|
196
328
|
}
|
|
197
329
|
function decideResolveIOAIManagerRecoveryGate(input) {
|
|
198
330
|
var checkpoint = input.checkpoint;
|
|
331
|
+
var hasCurrent = !!input.current;
|
|
199
332
|
var current = input.current || {};
|
|
200
|
-
var blockerFingerprint =
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
var
|
|
204
|
-
var
|
|
333
|
+
var blockerFingerprint = hasCurrent
|
|
334
|
+
? resolveResolveIOAIManagerBlockerFingerprint(current, checkpoint.objective)
|
|
335
|
+
: checkpoint.blockerFingerprint;
|
|
336
|
+
var evidenceHash = hasCurrent ? hashResolveIOAIManagerEvidence(current) : checkpoint.evidenceHash;
|
|
337
|
+
var changedFiles = hasCurrent ? cleanList(current.changedFiles, 80, 500) : checkpoint.changedFiles;
|
|
338
|
+
var artifactPaths = hasCurrent ? cleanList(current.artifactPaths, 80, 500) : checkpoint.artifactPaths;
|
|
205
339
|
var evidenceChanged = evidenceHash !== checkpoint.evidenceHash
|
|
206
340
|
|| blockerFingerprint !== checkpoint.blockerFingerprint
|
|
207
341
|
|| listHasNewEntry(changedFiles, checkpoint.changedFiles)
|
|
@@ -277,8 +411,7 @@ function failureKey(record) {
|
|
|
277
411
|
return '';
|
|
278
412
|
}
|
|
279
413
|
var failureClass = normalizeResolveIOAIManagerFailureClass(record.failureClass);
|
|
280
|
-
var blockerFingerprint =
|
|
281
|
-
|| fingerprintResolveIOAIManagerBlocker(record.blocker || record.summary || '');
|
|
414
|
+
var blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(record);
|
|
282
415
|
return "".concat(cleanText(record.lane, 80), ":").concat(cleanText(record.stepType, 80), ":").concat(failureClass, ":").concat(blockerFingerprint);
|
|
283
416
|
}
|
|
284
417
|
function failureEvidenceKey(record) {
|
|
@@ -474,8 +607,7 @@ function decideResolveIOAIManagerPolicy(input) {
|
|
|
474
607
|
var history = Array.isArray(input.history) ? input.history : [];
|
|
475
608
|
var current = input.current || history[history.length - 1] || {};
|
|
476
609
|
var failureClass = normalizeResolveIOAIManagerFailureClass(current.failureClass);
|
|
477
|
-
var blockerFingerprint =
|
|
478
|
-
|| fingerprintResolveIOAIManagerBlocker(current.blocker || current.summary || '');
|
|
610
|
+
var blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current);
|
|
479
611
|
var evidenceHash = hashResolveIOAIManagerEvidence(current);
|
|
480
612
|
var previous = history.length > 1 ? history[history.length - 2] : undefined;
|
|
481
613
|
var previousSameFailure = previous && failureKey(previous) === failureKey(current);
|
|
@@ -515,8 +647,12 @@ function decideResolveIOAIManagerPolicy(input) {
|
|
|
515
647
|
artifactPaths: current.artifactPaths,
|
|
516
648
|
maxSameFailureRepeats: maxSameFailureRepeats
|
|
517
649
|
});
|
|
518
|
-
|
|
519
|
-
|
|
650
|
+
var recoveryCheckpoint = buildResolveIOAIManagerRecoveryCheckpoint({
|
|
651
|
+
plan: recoveryPlan,
|
|
652
|
+
current: current
|
|
653
|
+
});
|
|
654
|
+
return __assign(__assign({}, merged), { action: action, reason: reason, recoveryPlan: recoveryPlan, recoveryCheckpoint: recoveryCheckpoint, recoveryEvidenceProbe: buildResolveIOAIManagerRecoveryEvidenceProbe({
|
|
655
|
+
checkpoint: recoveryCheckpoint,
|
|
520
656
|
current: current
|
|
521
657
|
}) });
|
|
522
658
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/util/ai-runner-manager-policy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AA0MA,0FAiBC;AAED,oFAUC;AAED,wEAcC;AAED,8FAyDC;AAgBD,oFAiGC;AAwBD,kFA2RC;AAuDD,wEA0FC;AAxsBD,SAAS,SAAS,CAAC,KAAU,EAAE,GAAU;IAAV,oBAAA,EAAA,UAAU;IACxC,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACtE,CA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E,CAAC","file":"ai-runner-manager-policy.js","sourcesContent":["export type ResolveIOAIManagerAction =\n\t| 'continue'\n\t| 'retry_infra'\n\t| 'reset_loop_budget'\n\t| 'park_repeated_failure'\n\t| 'park_ping_pong'\n\t| 'manual_handoff';\n\nexport interface ResolveIOAIManagerFailureRecord {\n\toutcome?: string;\n\tlane?: string;\n\tstepType?: string;\n\tfailureClass?: string;\n\tblocker?: string;\n\tblockerFingerprint?: string;\n\tevidenceHash?: string;\n\tchangedFiles?: string[];\n\tartifactPaths?: string[];\n\tsummary?: string;\n\trecordedAt?: Date | string;\n}\n\nexport type ResolveIOAIManagerRecoveryClass =\n\t| 'advance_after_proof'\n\t| 'diagnosis_only'\n\t| 'diagnosis_revision'\n\t| 'infra_repair'\n\t| 'compile_repair'\n\t| 'journey_contract_repair'\n\t| 'business_proof_repair'\n\t| 'release_repair'\n\t| 'product_code_repair'\n\t| 'blocked_until_new_evidence'\n\t| 'manual_handoff'\n\t| 'continue';\n\nexport interface ResolveIOAIManagerRecoveryPlan {\n\trecoveryClass: ResolveIOAIManagerRecoveryClass;\n\tlane: string;\n\tstepType: string;\n\tnextActionLabel: string;\n\tobjective: string;\n\tallowedAction: string;\n\tproductRepairAllowed: boolean;\n\texpensiveModelAllowed: boolean;\n\tmaxAttemptsBeforePark: number;\n\tfiniteSteps: string[];\n\trequiredEvidence: string[];\n\tloopResetEvidence: string[];\n\tforbiddenActions: string[];\n\tnotes: string[];\n}\n\nexport type ResolveIOAIManagerRecoveryCheckpointStatus =\n\t| 'active'\n\t| 'parked'\n\t| 'manual_handoff'\n\t| 'complete';\n\nexport interface ResolveIOAIManagerRecoveryCheckpoint {\n\tcheckpointId: string;\n\trecoveryClass: ResolveIOAIManagerRecoveryClass;\n\tstatus: ResolveIOAIManagerRecoveryCheckpointStatus;\n\tlane: string;\n\tstepType: string;\n\tallowedAction: string;\n\tproductRepairAllowed: boolean;\n\texpensiveModelAllowed: boolean;\n\tattempts: number;\n\tmaxAttemptsBeforePark: number;\n\tblockerFingerprint: string;\n\tevidenceHash: string;\n\tchangedFiles: string[];\n\tartifactPaths: string[];\n\trequiredEvidence: string[];\n\tloopResetEvidence: string[];\n\tforbiddenActions: string[];\n\tobjective: string;\n\tnextActionLabel: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport interface ResolveIOAIManagerRecoveryCheckpointInput {\n\tplan: ResolveIOAIManagerRecoveryPlan;\n\tcurrent?: ResolveIOAIManagerFailureRecord;\n\tpreviousCheckpoint?: ResolveIOAIManagerRecoveryCheckpoint;\n\tnow?: Date | string;\n}\n\nexport type ResolveIOAIManagerRecoveryGateAction =\n\t| 'allow'\n\t| 'collect_new_evidence'\n\t| 'reject_action'\n\t| 'manual_handoff'\n\t| 'complete';\n\nexport interface ResolveIOAIManagerRecoveryGateInput {\n\tcheckpoint: ResolveIOAIManagerRecoveryCheckpoint;\n\tcurrent?: ResolveIOAIManagerFailureRecord;\n\tproposedAction?: string;\n\toperatorApproved?: boolean;\n\tnow?: Date | string;\n}\n\nexport interface ResolveIOAIManagerRecoveryGateDecision {\n\taction: ResolveIOAIManagerRecoveryGateAction;\n\treason: string;\n\tcanRunProductRepair: boolean;\n\tcanRunExpensiveModel: boolean;\n\tshouldResetLoopBudget: boolean;\n\tshouldIncrementAttempt: boolean;\n\tnewEvidence: boolean;\n\tblockerFingerprint: string;\n\tevidenceHash: string;\n\tmissingEvidence: string[];\n\tcheckpoint: ResolveIOAIManagerRecoveryCheckpoint;\n}\n\nexport interface ResolveIOAIManagerRecoveryPlanInput {\n\taction?: ResolveIOAIManagerAction | string;\n\treason?: string;\n\tfailureClass?: string;\n\tlane?: string;\n\tstepType?: string;\n\tblocker?: string;\n\tsameFailureCount?: number;\n\tpingPongCount?: number;\n\tnewEvidence?: boolean;\n\tproductRepairFailure?: boolean;\n\tchangedFiles?: string[];\n\tartifactPaths?: string[];\n\tmaxSameFailureRepeats?: number;\n}\n\nexport interface ResolveIOAIManagerPolicyInput {\n\thistory?: ResolveIOAIManagerFailureRecord[];\n\tcurrent?: ResolveIOAIManagerFailureRecord;\n\tmaxSameFailureRepeats?: number;\n\tmaxPingPongTransitions?: number;\n\tinfraFailureClasses?: string[];\n\tignoredFailureClasses?: string[];\n}\n\nexport interface ResolveIOAIManagerPolicyDecision {\n\taction: ResolveIOAIManagerAction;\n\treason: string;\n\tfailureClass: string;\n\tblockerFingerprint: string;\n\tevidenceHash: string;\n\tsameFailureCount: number;\n\tpingPongCount: number;\n\tnewEvidence: boolean;\n\tloopBudgetShouldReset: boolean;\n\tproductRepairFailure: boolean;\n\trecoveryPlan: ResolveIOAIManagerRecoveryPlan;\n\trecoveryCheckpoint: ResolveIOAIManagerRecoveryCheckpoint;\n}\n\nfunction cleanText(value: any, max = 2000): string {\n\treturn String(value || '').replace(/\\s+/g, ' ').trim().slice(0, max);\n}\n\nfunction cleanList(values: any, limit = 40, max = 500): string[] {\n\tif (!Array.isArray(values)) {\n\t\treturn [];\n\t}\n\tconst result: string[] = [];\n\tfor (const value of values) {\n\t\tconst normalized = cleanText(value, max);\n\t\tif (normalized && !result.includes(normalized)) {\n\t\t\tresult.push(normalized);\n\t\t}\n\t\tif (result.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn result;\n}\n\nfunction isoNow(value?: Date | string): string {\n\tif (value instanceof Date) {\n\t\treturn value.toISOString();\n\t}\n\tconst parsed = value ? new Date(value) : new Date();\n\tif (Number.isFinite(parsed.getTime())) {\n\t\treturn parsed.toISOString();\n\t}\n\treturn new Date().toISOString();\n}\n\nfunction stableHash(prefix: string, value: any): string {\n\tconst normalized = typeof value === 'string'\n\t\t? cleanText(value, 12000)\n\t\t: JSON.stringify(value || {});\n\tlet hash = 0;\n\tfor (let index = 0; index < normalized.length; index += 1) {\n\t\thash = ((hash << 5) - hash + normalized.charCodeAt(index)) | 0;\n\t}\n\treturn `${prefix}-${Math.abs(hash).toString(36) || '0'}`;\n}\n\nexport function normalizeResolveIOAIManagerFailureClass(value: any): string {\n\tconst normalized = cleanText(value, 80)\n\t\t.toLowerCase()\n\t\t.replace(/[\\s-]+/g, '_');\n\tif (!normalized) {\n\t\treturn 'unknown';\n\t}\n\tif (/^(qa_infra|infrastructure|harness|puppeteer|chrome|mongo|port|startup)$/.test(normalized)) {\n\t\treturn 'infra';\n\t}\n\tif (/^(build|compile|typescript|tsc|angular_build|ng_build)$/.test(normalized)) {\n\t\treturn 'compile';\n\t}\n\tif (/^(false_pass|route_only|missing_business_proof)$/.test(normalized)) {\n\t\treturn 'business';\n\t}\n\treturn normalized.slice(0, 80);\n}\n\nexport function fingerprintResolveIOAIManagerBlocker(value: any): string {\n\tconst normalized = cleanText(value, 4000)\n\t\t.toLowerCase()\n\t\t.replace(/[a-f0-9]{16,}/g, '<id>')\n\t\t.replace(/\\b\\d{2,}\\b/g, '<n>')\n\t\t.replace(/\\bline\\s+<n>\\b/g, 'line <n>')\n\t\t.replace(/https?:\\/\\/\\S+/g, '<url>')\n\t\t.replace(/\\s+/g, ' ')\n\t\t.trim();\n\treturn stableHash('mgr-blocker', normalized);\n}\n\nexport function hashResolveIOAIManagerEvidence(record: ResolveIOAIManagerFailureRecord | undefined): string {\n\tif (!record) {\n\t\treturn stableHash('mgr-evidence', '');\n\t}\n\tconst explicit = cleanText(record.evidenceHash, 120);\n\tif (explicit) {\n\t\treturn explicit;\n\t}\n\treturn stableHash('mgr-evidence', {\n\t\tfailureClass: normalizeResolveIOAIManagerFailureClass(record.failureClass),\n\t\tblocker: cleanText(record.blocker || record.summary, 2000),\n\t\tchangedFiles: cleanList(record.changedFiles, 80, 500).sort(),\n\t\tartifactPaths: cleanList(record.artifactPaths, 80, 500).sort()\n\t});\n}\n\nexport function buildResolveIOAIManagerRecoveryCheckpoint(\n\tinput: ResolveIOAIManagerRecoveryCheckpointInput\n): ResolveIOAIManagerRecoveryCheckpoint {\n\tconst plan = input.plan;\n\tconst current = input.current || {};\n\tconst blockerFingerprint = cleanText(current.blockerFingerprint, 120)\n\t\t|| fingerprintResolveIOAIManagerBlocker(current.blocker || current.summary || plan.objective || '');\n\tconst evidenceHash = hashResolveIOAIManagerEvidence(current);\n\tconst changedFiles = cleanList(current.changedFiles, 80, 500);\n\tconst artifactPaths = cleanList(current.artifactPaths, 80, 500);\n\tconst previous = input.previousCheckpoint;\n\tconst sameCheckpointBase = previous\n\t\t&& previous.recoveryClass === plan.recoveryClass\n\t\t&& previous.lane === plan.lane\n\t\t&& previous.stepType === plan.stepType\n\t\t&& previous.blockerFingerprint === blockerFingerprint\n\t\t&& previous.evidenceHash === evidenceHash;\n\tconst attempts = sameCheckpointBase ? Math.max(0, Number(previous.attempts || 0)) + 1 : 1;\n\tconst status: ResolveIOAIManagerRecoveryCheckpointStatus = plan.recoveryClass === 'manual_handoff'\n\t\t? 'manual_handoff'\n\t\t: plan.recoveryClass === 'blocked_until_new_evidence'\n\t\t\t? 'parked'\n\t\t\t: plan.recoveryClass === 'advance_after_proof'\n\t\t\t\t? 'complete'\n\t\t\t\t: 'active';\n\tconst now = isoNow(input.now);\n\tconst checkpointId = stableHash('mgr-recovery', {\n\t\trecoveryClass: plan.recoveryClass,\n\t\tlane: plan.lane,\n\t\tstepType: plan.stepType,\n\t\tallowedAction: plan.allowedAction,\n\t\tblockerFingerprint,\n\t\tevidenceHash\n\t});\n\treturn {\n\t\tcheckpointId,\n\t\trecoveryClass: plan.recoveryClass,\n\t\tstatus,\n\t\tlane: plan.lane,\n\t\tstepType: plan.stepType,\n\t\tallowedAction: plan.allowedAction,\n\t\tproductRepairAllowed: plan.productRepairAllowed,\n\t\texpensiveModelAllowed: plan.expensiveModelAllowed,\n\t\tattempts,\n\t\tmaxAttemptsBeforePark: plan.maxAttemptsBeforePark,\n\t\tblockerFingerprint,\n\t\tevidenceHash,\n\t\tchangedFiles,\n\t\tartifactPaths,\n\t\trequiredEvidence: cleanList(plan.requiredEvidence, 40, 500),\n\t\tloopResetEvidence: cleanList(plan.loopResetEvidence, 40, 500),\n\t\tforbiddenActions: cleanList(plan.forbiddenActions, 40, 500),\n\t\tobjective: cleanText(plan.objective, 1000),\n\t\tnextActionLabel: cleanText(plan.nextActionLabel, 160),\n\t\tcreatedAt: sameCheckpointBase && previous?.createdAt ? previous.createdAt : now,\n\t\tupdatedAt: now\n\t};\n}\n\nfunction listHasNewEntry(current: string[], previous: string[]): boolean {\n\tconst existing = new Set(previous.map((entry) => cleanText(entry, 500)).filter(Boolean));\n\treturn current.some((entry) => {\n\t\tconst normalized = cleanText(entry, 500);\n\t\treturn !!normalized && !existing.has(normalized);\n\t});\n}\n\nfunction proposedActionIsProductRepair(value: any): boolean {\n\tconst normalized = cleanText(value, 120);\n\treturn /product|code|repair|build|business|journey|workflow/i.test(normalized)\n\t\t&& !/infra|compile|diagnosis|manual|evidence|release|publish/i.test(normalized);\n}\n\nexport function decideResolveIOAIManagerRecoveryGate(\n\tinput: ResolveIOAIManagerRecoveryGateInput\n): ResolveIOAIManagerRecoveryGateDecision {\n\tconst checkpoint = input.checkpoint;\n\tconst current = input.current || {};\n\tconst blockerFingerprint = cleanText(current.blockerFingerprint, 120)\n\t\t|| fingerprintResolveIOAIManagerBlocker(current.blocker || current.summary || checkpoint.objective || '');\n\tconst evidenceHash = hashResolveIOAIManagerEvidence(current);\n\tconst changedFiles = cleanList(current.changedFiles, 80, 500);\n\tconst artifactPaths = cleanList(current.artifactPaths, 80, 500);\n\tconst evidenceChanged = evidenceHash !== checkpoint.evidenceHash\n\t\t|| blockerFingerprint !== checkpoint.blockerFingerprint\n\t\t|| listHasNewEntry(changedFiles, checkpoint.changedFiles)\n\t\t|| listHasNewEntry(artifactPaths, checkpoint.artifactPaths);\n\tconst proposedAction = cleanText(input.proposedAction || checkpoint.allowedAction, 120);\n\tconst productRepairRequested = proposedActionIsProductRepair(proposedAction);\n\tconst missingEvidence = checkpoint.requiredEvidence.filter((required) => {\n\t\tconst normalized = cleanText(required, 120).toLowerCase();\n\t\tif (!normalized) {\n\t\t\treturn false;\n\t\t}\n\t\tif (/artifact|log|proof|gate|evidence/.test(normalized)) {\n\t\t\treturn !artifactPaths.length && !current.evidenceHash;\n\t\t}\n\t\tif (/diff|changed files|owner|scope|file/.test(normalized)) {\n\t\t\treturn !changedFiles.length;\n\t\t}\n\t\treturn false;\n\t});\n\tconst makeDecision = (\n\t\taction: ResolveIOAIManagerRecoveryGateAction,\n\t\treason: string,\n\t\toverrides: Partial<ResolveIOAIManagerRecoveryGateDecision> = {}\n\t): ResolveIOAIManagerRecoveryGateDecision => ({\n\t\taction,\n\t\treason,\n\t\tcanRunProductRepair: checkpoint.productRepairAllowed,\n\t\tcanRunExpensiveModel: checkpoint.expensiveModelAllowed,\n\t\tshouldResetLoopBudget: false,\n\t\tshouldIncrementAttempt: action === 'allow',\n\t\tnewEvidence: evidenceChanged,\n\t\tblockerFingerprint,\n\t\tevidenceHash,\n\t\tmissingEvidence,\n\t\tcheckpoint: {\n\t\t\t...checkpoint,\n\t\t\tupdatedAt: isoNow(input.now)\n\t\t},\n\t\t...overrides\n\t});\n\n\tif (checkpoint.status === 'complete') {\n\t\treturn makeDecision('complete', 'recovery_gate_checkpoint_already_complete', {\n\t\t\tcanRunProductRepair: false,\n\t\t\tcanRunExpensiveModel: false,\n\t\t\tshouldIncrementAttempt: false\n\t\t});\n\t}\n\tif (checkpoint.status === 'manual_handoff' && input.operatorApproved !== true) {\n\t\treturn makeDecision('manual_handoff', 'recovery_gate_manual_handoff_requires_operator_approval', {\n\t\t\tcanRunProductRepair: false,\n\t\t\tcanRunExpensiveModel: false,\n\t\t\tshouldIncrementAttempt: false\n\t\t});\n\t}\n\tif (productRepairRequested && !checkpoint.productRepairAllowed) {\n\t\treturn makeDecision('reject_action', 'recovery_gate_product_repair_not_allowed_for_checkpoint', {\n\t\t\tcanRunProductRepair: false,\n\t\t\tcanRunExpensiveModel: false,\n\t\t\tshouldIncrementAttempt: false\n\t\t});\n\t}\n\tif (checkpoint.status === 'parked' && !evidenceChanged) {\n\t\treturn makeDecision('collect_new_evidence', 'recovery_gate_parked_until_new_evidence', {\n\t\t\tcanRunProductRepair: false,\n\t\t\tcanRunExpensiveModel: false,\n\t\t\tshouldIncrementAttempt: false\n\t\t});\n\t}\n\tif (checkpoint.attempts >= checkpoint.maxAttemptsBeforePark && !evidenceChanged) {\n\t\treturn makeDecision('collect_new_evidence', 'recovery_gate_attempt_limit_requires_new_evidence', {\n\t\t\tcanRunProductRepair: false,\n\t\t\tcanRunExpensiveModel: false,\n\t\t\tshouldIncrementAttempt: false\n\t\t});\n\t}\n\tif (evidenceChanged) {\n\t\tconst currentFailureClass = normalizeResolveIOAIManagerFailureClass(current.failureClass);\n\t\tconst currentCanRunProductRepair = checkpoint.productRepairAllowed\n\t\t\t|| !/^(infra|compile|diagnosis|release)$/i.test(currentFailureClass);\n\t\treturn makeDecision('allow', 'recovery_gate_new_evidence_unblocks_retry', {\n\t\t\tcanRunProductRepair: currentCanRunProductRepair,\n\t\t\tcanRunExpensiveModel: checkpoint.expensiveModelAllowed || currentCanRunProductRepair,\n\t\t\tshouldResetLoopBudget: true\n\t\t});\n\t}\n\treturn makeDecision('allow', 'recovery_gate_action_allowed');\n}\n\nfunction failureKey(record: ResolveIOAIManagerFailureRecord | undefined): string {\n\tif (!record) {\n\t\treturn '';\n\t}\n\tconst failureClass = normalizeResolveIOAIManagerFailureClass(record.failureClass);\n\tconst blockerFingerprint = cleanText(record.blockerFingerprint, 120)\n\t\t|| fingerprintResolveIOAIManagerBlocker(record.blocker || record.summary || '');\n\treturn `${cleanText(record.lane, 80)}:${cleanText(record.stepType, 80)}:${failureClass}:${blockerFingerprint}`;\n}\n\nfunction failureEvidenceKey(record: ResolveIOAIManagerFailureRecord | undefined): string {\n\treturn `${failureKey(record)}:${hashResolveIOAIManagerEvidence(record)}`;\n}\n\nfunction isPassingOutcome(record: ResolveIOAIManagerFailureRecord | undefined): boolean {\n\treturn /^(pass|accepted|ready_to_publish|published|ready_for_merge|complete|completed)$/i.test(cleanText(record?.outcome, 80));\n}\n\nfunction isManualOutcome(record: ResolveIOAIManagerFailureRecord | undefined): boolean {\n\treturn /^(manual_handoff|park_manual|stopped)$/i.test(cleanText(record?.outcome, 80));\n}\n\nexport function buildResolveIOAIManagerRecoveryPlan(input: ResolveIOAIManagerRecoveryPlanInput = {}): ResolveIOAIManagerRecoveryPlan {\n\tconst action = cleanText(input.action, 80) || 'continue';\n\tconst reason = cleanText(input.reason, 240);\n\tconst failureClass = normalizeResolveIOAIManagerFailureClass(input.failureClass);\n\tconst lane = cleanText(input.lane, 80) || 'supervisor';\n\tconst stepType = cleanText(input.stepType, 80) || 'unknown';\n\tconst blocker = cleanText(input.blocker, 700);\n\tconst changedFiles = cleanList(input.changedFiles, 12, 240);\n\tconst artifactPaths = cleanList(input.artifactPaths, 12, 240);\n\tconst maxAttemptsBeforePark = Math.max(1, Number(input.maxSameFailureRepeats || 3) || 3);\n\tconst commonNotes = [\n\t\treason ? `policy_reason=${reason}` : '',\n\t\tblocker ? `blocker=${blocker}` : '',\n\t\tchangedFiles.length ? `changed_files=${changedFiles.join(', ')}` : '',\n\t\tartifactPaths.length ? `artifacts=${artifactPaths.join(', ')}` : ''\n\t].filter(Boolean);\n\tconst base: Omit<ResolveIOAIManagerRecoveryPlan, 'recoveryClass' | 'nextActionLabel' | 'objective' | 'allowedAction' | 'productRepairAllowed' | 'expensiveModelAllowed' | 'finiteSteps' | 'requiredEvidence' | 'loopResetEvidence' | 'forbiddenActions'> = {\n\t\tlane,\n\t\tstepType,\n\t\tmaxAttemptsBeforePark,\n\t\tnotes: commonNotes\n\t};\n\tconst makePlan = (\n\t\trecoveryClass: ResolveIOAIManagerRecoveryClass,\n\t\tnextActionLabel: string,\n\t\tobjective: string,\n\t\tallowedAction: string,\n\t\tproductRepairAllowed: boolean,\n\t\texpensiveModelAllowed: boolean,\n\t\tfiniteSteps: string[],\n\t\trequiredEvidence: string[],\n\t\tloopResetEvidence: string[],\n\t\tforbiddenActions: string[]\n\t): ResolveIOAIManagerRecoveryPlan => ({\n\t\t...base,\n\t\trecoveryClass,\n\t\tnextActionLabel,\n\t\tobjective,\n\t\tallowedAction,\n\t\tproductRepairAllowed,\n\t\texpensiveModelAllowed,\n\t\tfiniteSteps,\n\t\trequiredEvidence,\n\t\tloopResetEvidence,\n\t\tforbiddenActions\n\t});\n\tif (action === 'reset_loop_budget') {\n\t\treturn makePlan(\n\t\t\t'advance_after_proof',\n\t\t\t'Advance After Proof',\n\t\t\t'Checkpoint the passing evidence and move to the next required gate.',\n\t\t\t'advance_to_next_gate',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t[\n\t\t\t\t'Record the passing artifact, changed files, and gate result.',\n\t\t\t\t'Reset the loop counter because a real gate passed.',\n\t\t\t\t'Select the next unmet deterministic gate instead of repeating the previous repair.'\n\t\t\t],\n\t\t\t['passing gate record', 'artifact or log proving the passed check'],\n\t\t\t['new passing gate result', 'new business proof artifact'],\n\t\t\t['rerun the same repair after a pass', 'mark accepted without the required downstream gate']\n\t\t);\n\t}\n\tif (action === 'manual_handoff') {\n\t\treturn makePlan(\n\t\t\t'manual_handoff',\n\t\t\t'Manual Review',\n\t\t\t'Stop autonomous repair and expose the blocker, evidence, and last safe state.',\n\t\t\t'manual_review_only',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t[\n\t\t\t\t'Freeze further product-code edits.',\n\t\t\t\t'Show the blocker fingerprint, evidence hash, and prior attempts.',\n\t\t\t\t'Require a human edit to classification, scope, or retry policy before another model/code loop.'\n\t\t\t],\n\t\t\t['blocker fingerprint', 'evidence hash', 'attempt history'],\n\t\t\t['manual policy change', 'new external evidence'],\n\t\t\t['start another automatic model repair', 'hide the failed evidence']\n\t\t);\n\t}\n\tif (action === 'budget_stop') {\n\t\treturn makePlan(\n\t\t\t'manual_handoff',\n\t\t\t'Budget Stop Review',\n\t\t\t'Stop autonomous model/code loops until a cheaper scoped next action is selected.',\n\t\t\t'budget_review_only',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t[\n\t\t\t\t'Freeze further model repair loops.',\n\t\t\t\t'Show the prompt/token/runtime budget that tripped the guard.',\n\t\t\t\t'Select a cheaper deterministic gate, infra repair, diagnosis revision, or manual scope edit before resuming.'\n\t\t\t],\n\t\t\t['budget guard reason', 'latest prompt estimate', 'last blocker/evidence hash'],\n\t\t\t['manual scope reduction', 'new deterministic evidence', 'approved budget policy change'],\n\t\t\t['start another broad model prompt', 'reset budget without new evidence', 'hide cost context']\n\t\t);\n\t}\n\tif (failureClass === 'diagnosis' || stepType === 'diagnosis_gate') {\n\t\treturn makePlan(\n\t\t\t'diagnosis_only',\n\t\t\t'Run Diagnosis Gate',\n\t\t\t'Produce a falsifiable root-cause diagnosis before any repair.',\n\t\t\t'read_only_diagnosis',\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t\t[\n\t\t\t\t'Reproduce or explicitly classify the customer issue.',\n\t\t\t\t'Accept one falsifiable hypothesis and record rejected alternatives.',\n\t\t\t\t'Identify the frontend/backend/shared failing path.',\n\t\t\t\t'Select a small owner_files set.',\n\t\t\t\t'Define exact before/action/after business proof.'\n\t\t\t],\n\t\t\t['issue_case', 'accepted_hypothesis', 'rejected_alternatives', 'failing_path', 'owner_files', 'proof_plan'],\n\t\t\t['new reproduction artifact', 'new query/log/code evidence', 'validated diagnosis gate'],\n\t\t\t['edit product code', 'run broad repo repair', 'accept route-load evidence as success']\n\t\t);\n\t}\n\tif (failureClass === 'owner_scope' || failureClass === 'out_of_scope' || /out.?of.?scope|owner_files/i.test(reason)) {\n\t\treturn makePlan(\n\t\t\t'diagnosis_revision',\n\t\t\t'Revise Diagnosis Scope',\n\t\t\t'Revise owner_files only when new evidence proves the current scope is wrong.',\n\t\t\t'diagnosis_revision_only',\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t\t[\n\t\t\t\t'Compare changed files against the diagnosis owner_files.',\n\t\t\t\t'Collect evidence proving why the new file is in the failing path.',\n\t\t\t\t'Update accepted_hypothesis, failing_path, owner_files, and proof_plan together.',\n\t\t\t\t'Resume repair only after the revised gate validates.'\n\t\t\t],\n\t\t\t['out-of-scope file list', 'new failing-path evidence', 'revalidated diagnosis gate'],\n\t\t\t['revised owner_files with evidence', 'new business proof requirement'],\n\t\t\t['keep broad edits without diagnosis', 'add convenience refactors', 'continue repair outside owner_files']\n\t\t);\n\t}\n\tif (action === 'retry_infra') {\n\t\tconst isCompile = failureClass === 'compile';\n\t\treturn makePlan(\n\t\t\tisCompile ? 'compile_repair' : 'infra_repair',\n\t\t\tisCompile ? 'Repair Compile Gate' : 'Repair Infra Gate',\n\t\t\tisCompile\n\t\t\t\t? 'Fix the deterministic compile/build blocker before spending another product repair loop.'\n\t\t\t\t: 'Fix the deterministic harness/browser/server/Mongo blocker before product repair.',\n\t\t\tisCompile ? 'compile_repair_only' : 'infra_repair_only',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\tisCompile\n\t\t\t\t? [\n\t\t\t\t\t'Read the exact compile/build log and identify the first actionable error.',\n\t\t\t\t\t'Fix missing dependency, stale artifact, command, cache, or type wiring required by the compile gate.',\n\t\t\t\t\t'Rerun the same finite compile command.',\n\t\t\t\t\t'Return the compile log artifact and status.'\n\t\t\t\t]\n\t\t\t\t: [\n\t\t\t\t\t'Run preflight for Puppeteer, Chrome executable, ports, Mongo/settings, and startup command.',\n\t\t\t\t\t'Repair only the failing harness/environment item.',\n\t\t\t\t\t'Rerun the same infra check.',\n\t\t\t\t\t'Return the infra log and pass/fail status.'\n\t\t\t\t],\n\t\t\tisCompile\n\t\t\t\t? ['compile command', 'compile log artifact', 'first failing error fixed or still failing']\n\t\t\t\t: ['preflight command', 'infra log artifact', 'specific repaired environment item'],\n\t\t\t['same check now passes', 'new infra/compile blocker hash'],\n\t\t\t['run product-code model repair', 'count this as product failure', 'accept route/business success without the compile/infra gate']\n\t\t);\n\t}\n\tif (action === 'park_repeated_failure' || action === 'park_ping_pong') {\n\t\treturn makePlan(\n\t\t\t'blocked_until_new_evidence',\n\t\t\taction === 'park_ping_pong' ? 'Park Ping-Pong Loop' : 'Park Repeated Failure',\n\t\t\t'Stop the current loop until new evidence changes the diagnosis, route, or repair target.',\n\t\t\t'collect_new_evidence_only',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t[\n\t\t\t\t'Do not rerun the same prompt or same repair.',\n\t\t\t\t'Show the repeated blocker and evidence hash.',\n\t\t\t\t'Collect a new artifact: failing DOM state, stack trace, network response, Mongo delta, compile log, or revised diagnosis.',\n\t\t\t\t'Reset the loop only after the new evidence hash changes.'\n\t\t\t],\n\t\t\t['same failure count', 'blocker fingerprint', 'evidence hash'],\n\t\t\t['changed evidence hash', 'new artifact path', 'revised diagnosis or journey contract'],\n\t\t\t['alternate between two failed patches', 'increase loop budget without evidence', 'hide the park reason']\n\t\t);\n\t}\n\tif (failureClass === 'journey') {\n\t\treturn makePlan(\n\t\t\t'journey_contract_repair',\n\t\t\t'Repair Journey Contract',\n\t\t\t'Fix the first/next/last workflow contract before app code work continues.',\n\t\t\t'journey_contract_repair',\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t\t[\n\t\t\t\t'Open docs/APP_JOURNEY_CONTRACT.md.',\n\t\t\t\t'Define first_screen, north_star_workflow, screen_sequence, data_story, completion_states, and qa_assertions.',\n\t\t\t\t'Ensure each CTA maps to an action, route, method, calculation, or state transition.',\n\t\t\t\t'Validate that sample data can drive the promised workflow.'\n\t\t\t],\n\t\t\t['validated journey_contract JSON', 'CTA-to-action mapping', 'workflow QA assertions'],\n\t\t\t['journey validation passes', 'new workflow QA rows generated'],\n\t\t\t['build empty routes', 'add link-only dashboard actions', 'defer workflow design to wow pass']\n\t\t);\n\t}\n\tif (failureClass === 'release') {\n\t\treturn makePlan(\n\t\t\t'release_repair',\n\t\t\t'Repair Release Gate',\n\t\t\t'Repair deploy/publish/sample-data release evidence without rewriting working app flow.',\n\t\t\t'release_repair_only',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t[\n\t\t\t\t'Read the deploy/publish/sample-data log.',\n\t\t\t\t'Identify whether the blocker is domain, asset, seed data, route, permission, or CDN.',\n\t\t\t\t'Repair the release artifact/config/seed issue.',\n\t\t\t\t'Rerun only the failed release gate.'\n\t\t\t],\n\t\t\t['deploy or publish log', 'sample-data status', 'failed release gate rerun'],\n\t\t\t['release gate passes', 'new release blocker hash'],\n\t\t\t['change core workflow after business QA passed', 'mark accepted from scorecard only', 'rerun full builder loop']\n\t\t);\n\t}\n\tif (failureClass === 'business' || failureClass === 'qa_evidence' || failureClass === 'route') {\n\t\treturn makePlan(\n\t\t\t'business_proof_repair',\n\t\t\t'Repair Business Proof',\n\t\t\t'Fix the exact failing workflow assertion and prove before/action/after behavior.',\n\t\t\t'business_repair',\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\t[\n\t\t\t\t'Open the failing QA row or proof_plan.',\n\t\t\t\t'Trace the UI action to method/publication/query/calculation.',\n\t\t\t\t'Patch the smallest owner or workflow files.',\n\t\t\t\t'Rerun only the failed business assertion.',\n\t\t\t\t'Record DOM/data/Mongo/artifact proof.'\n\t\t\t],\n\t\t\t['failing assertion', 'action trace', 'business proof artifact'],\n\t\t\t['business assertion passes', 'new failed assertion with new evidence'],\n\t\t\t['treat route load as success', 'rerun unrelated QA rows first', 'accept scorecard-only evidence']\n\t\t);\n\t}\n\tif (input.productRepairFailure !== false || failureClass === 'product_code') {\n\t\treturn makePlan(\n\t\t\t'product_code_repair',\n\t\t\t'Run Targeted Product Repair',\n\t\t\t'Repair the current product-code blocker with the smallest scoped edit and immediate proof.',\n\t\t\t'targeted_product_repair',\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\t[\n\t\t\t\t'Inspect the current blocker, artifacts, changed files, and owner/workflow scope.',\n\t\t\t\t'Form one small repair hypothesis.',\n\t\t\t\t'Patch only files justified by the active diagnosis or journey contract.',\n\t\t\t\t'Rerun the smallest failed gate.',\n\t\t\t\t'Record new evidence before any additional loop.'\n\t\t\t],\n\t\t\t['owner/workflow scope', 'repair diff', 'failed gate rerun artifact'],\n\t\t\t['new evidence hash', 'same gate passes'],\n\t\t\t['broad repo search-and-edit', 'rerun the same prompt without inspecting artifacts', 'change unrelated UI polish']\n\t\t);\n\t}\n\treturn makePlan(\n\t\t'continue',\n\t\t'Continue Current Gate',\n\t\t'Continue the current lane because no blocking loop or infra condition was detected.',\n\t\t'continue',\n\t\tfalse,\n\t\tfalse,\n\t\t[\n\t\t\t'Use the active lane memory.',\n\t\t\t'Run the next finite gate.',\n\t\t\t'Record artifacts and evidence hash.'\n\t\t],\n\t\t['active lane memory', 'finite gate artifact'],\n\t\t['new gate result', 'new artifact path'],\n\t\t['spawn duplicate runners', 'advance without evidence']\n\t);\n}\n\nfunction collectOpenTail(records: ResolveIOAIManagerFailureRecord[]): ResolveIOAIManagerFailureRecord[] {\n\tconst tail: ResolveIOAIManagerFailureRecord[] = [];\n\tfor (let index = records.length - 1; index >= 0; index -= 1) {\n\t\tconst record = records[index];\n\t\tif (isPassingOutcome(record)) {\n\t\t\tbreak;\n\t\t}\n\t\ttail.unshift(record);\n\t}\n\treturn tail;\n}\n\nfunction countSameFailure(records: ResolveIOAIManagerFailureRecord[], current: ResolveIOAIManagerFailureRecord): number {\n\tconst currentKey = failureEvidenceKey(current);\n\tlet count = 0;\n\tfor (let index = records.length - 1; index >= 0; index -= 1) {\n\t\tconst record = records[index];\n\t\tif (isPassingOutcome(record)) {\n\t\t\tbreak;\n\t\t}\n\t\tif (failureEvidenceKey(record) !== currentKey) {\n\t\t\tbreak;\n\t\t}\n\t\tcount += 1;\n\t}\n\treturn count;\n}\n\nfunction countPingPong(records: ResolveIOAIManagerFailureRecord[], current: ResolveIOAIManagerFailureRecord): number {\n\tconst tail = collectOpenTail(records).filter((record) => {\n\t\treturn cleanText(record.lane, 80) === cleanText(current.lane, 80)\n\t\t\t&& cleanText(record.stepType, 80) === cleanText(current.stepType, 80);\n\t});\n\tif (tail.length < 4) {\n\t\treturn 0;\n\t}\n\tconst keys = tail.map(failureKey).filter(Boolean);\n\tconst last = keys.slice(-6);\n\tif (last.length < 4) {\n\t\treturn 0;\n\t}\n\tconst distinct = Array.from(new Set(last));\n\tif (distinct.length !== 2) {\n\t\treturn 0;\n\t}\n\tfor (let index = 2; index < last.length; index += 1) {\n\t\tif (last[index] !== last[index - 2]) {\n\t\t\treturn 0;\n\t\t}\n\t}\n\treturn last.length - 1;\n}\n\nexport function decideResolveIOAIManagerPolicy(input: ResolveIOAIManagerPolicyInput): ResolveIOAIManagerPolicyDecision {\n\tconst history = Array.isArray(input.history) ? input.history : [];\n\tconst current = input.current || history[history.length - 1] || {};\n\tconst failureClass = normalizeResolveIOAIManagerFailureClass(current.failureClass);\n\tconst blockerFingerprint = cleanText(current.blockerFingerprint, 120)\n\t\t|| fingerprintResolveIOAIManagerBlocker(current.blocker || current.summary || '');\n\tconst evidenceHash = hashResolveIOAIManagerEvidence(current);\n\tconst previous = history.length > 1 ? history[history.length - 2] : undefined;\n\tconst previousSameFailure = previous && failureKey(previous) === failureKey(current);\n\tconst previousEvidenceHash = previousSameFailure ? hashResolveIOAIManagerEvidence(previous) : '';\n\tconst newEvidence = !!previousSameFailure && !!previousEvidenceHash && previousEvidenceHash !== evidenceHash;\n\tconst sameFailureCount = countSameFailure(history, current);\n\tconst pingPongCount = countPingPong(history, current);\n\tconst maxSameFailureRepeats = Math.max(1, Number(input.maxSameFailureRepeats || 3) || 3);\n\tconst maxPingPongTransitions = Math.max(3, Number(input.maxPingPongTransitions || 3) || 3);\n\tconst infraClasses = new Set((input.infraFailureClasses || ['infra', 'compile']).map(normalizeResolveIOAIManagerFailureClass));\n\tconst ignoredClasses = new Set((input.ignoredFailureClasses || []).map(normalizeResolveIOAIManagerFailureClass));\n\tconst base = {\n\t\tfailureClass,\n\t\tblockerFingerprint,\n\t\tevidenceHash,\n\t\tsameFailureCount,\n\t\tpingPongCount,\n\t\tnewEvidence,\n\t\tloopBudgetShouldReset: false,\n\t\tproductRepairFailure: !infraClasses.has(failureClass) && !ignoredClasses.has(failureClass)\n\t};\n\tconst withPlan = (\n\t\taction: ResolveIOAIManagerAction,\n\t\treason: string,\n\t\toverrides: Partial<Omit<ResolveIOAIManagerPolicyDecision, 'action' | 'reason' | 'recoveryPlan' | 'recoveryCheckpoint'>> = {}\n\t): ResolveIOAIManagerPolicyDecision => {\n\t\tconst merged = {\n\t\t\t...base,\n\t\t\t...overrides\n\t\t};\n\t\tconst recoveryPlan = buildResolveIOAIManagerRecoveryPlan({\n\t\t\taction,\n\t\t\treason,\n\t\t\tfailureClass: merged.failureClass,\n\t\t\tlane: current.lane,\n\t\t\tstepType: current.stepType,\n\t\t\tblocker: current.blocker || current.summary,\n\t\t\tsameFailureCount: merged.sameFailureCount,\n\t\t\tpingPongCount: merged.pingPongCount,\n\t\t\tnewEvidence: merged.newEvidence,\n\t\t\tproductRepairFailure: merged.productRepairFailure,\n\t\t\tchangedFiles: current.changedFiles,\n\t\t\tartifactPaths: current.artifactPaths,\n\t\t\tmaxSameFailureRepeats\n\t\t});\n\t\treturn {\n\t\t\t...merged,\n\t\t\taction,\n\t\t\treason,\n\t\t\trecoveryPlan,\n\t\t\trecoveryCheckpoint: buildResolveIOAIManagerRecoveryCheckpoint({\n\t\t\t\tplan: recoveryPlan,\n\t\t\t\tcurrent\n\t\t\t})\n\t\t};\n\t};\n\tif (isPassingOutcome(current)) {\n\t\treturn withPlan('reset_loop_budget', 'manager_policy_progress_passed', {\n\t\t\tloopBudgetShouldReset: true,\n\t\t\tproductRepairFailure: false\n\t\t});\n\t}\n\tif (isManualOutcome(current)) {\n\t\treturn withPlan('manual_handoff', 'manager_policy_manual_or_stopped');\n\t}\n\tif (infraClasses.has(failureClass)) {\n\t\treturn withPlan('retry_infra', 'manager_policy_infra_failure_routes_to_infra_repair', {\n\t\t\tproductRepairFailure: false\n\t\t});\n\t}\n\tif (pingPongCount >= maxPingPongTransitions) {\n\t\treturn withPlan('park_ping_pong', 'manager_policy_ping_pong_failure_loop');\n\t}\n\tif (sameFailureCount >= maxSameFailureRepeats && !newEvidence) {\n\t\treturn withPlan('park_repeated_failure', 'manager_policy_same_failure_without_new_evidence');\n\t}\n\tif (newEvidence || !previousSameFailure) {\n\t\treturn withPlan('continue', newEvidence\n\t\t\t\t? 'manager_policy_new_evidence_resets_loop_budget'\n\t\t\t\t: 'manager_policy_new_failure_or_lane', {\n\t\t\tloopBudgetShouldReset: true\n\t\t});\n\t}\n\treturn withPlan('continue', 'manager_policy_retry_below_repeat_limit');\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../../src/util/ai-runner-manager-policy.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4PA,0FAiBC;AAED,oFAUC;AAiBD,wEAcC;AAED,8FAwDC;AAwKD,oGAkDC;AAgBD,oFAmGC;AAuBD,kFA2RC;AAuDD,wEA8FC;AAr7BD,SAAS,SAAS,CAAC,KAAU,EAAE,GAAU;IAAV,oBAAA,EAAA,UAAU;IACxC,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,SAAS,CAAC,MAAW,EAAE,KAAU,EAAE,GAAS;;IAArB,sBAAA,EAAA,UAAU;IAAE,oBAAA,EAAA,SAAS;IACpD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC;IACX,CAAC;IACD,IAAM,MAAM,GAAa,EAAE,CAAC;;QAC5B,KAAoB,IAAA,WAAA,SAAA,MAAM,CAAA,8BAAA,kDAAE,CAAC;YAAxB,IAAM,KAAK,mBAAA;YACf,IAAM,UAAU,GAAG,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YACzC,IAAI,UAAU,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;gBAChD,M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D,CAAC,CAAC;IAC9F,CAAC;IACD,IAAI,WAAW,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzC,OAAO,QAAQ,CAAC,UAAU,EAAE,WAAW;YACrC,CAAC,CAAC,gDAAgD;YAClD,CAAC,CAAC,oCAAoC,EAAE;YACzC,qBAAqB,EAAE,IAAI;SAC3B,CAAC,CAAC;IACJ,CAAC;IACD,OAAO,QAAQ,CAAC,UAAU,EAAE,yCAAyC,CAAC,CAAC;AACxE,CAAC","file":"ai-runner-manager-policy.js","sourcesContent":["export type ResolveIOAIManagerAction =\n\t| 'continue'\n\t| 'retry_infra'\n\t| 'reset_loop_budget'\n\t| 'park_repeated_failure'\n\t| 'park_ping_pong'\n\t| 'manual_handoff';\n\nexport interface ResolveIOAIManagerFailureRecord {\n\toutcome?: string;\n\tlane?: string;\n\tstepType?: string;\n\tfailureClass?: string;\n\tblocker?: string;\n\tblockerFingerprint?: string;\n\tevidenceHash?: string;\n\tchangedFiles?: string[];\n\tartifactPaths?: string[];\n\tsummary?: string;\n\trecordedAt?: Date | string;\n}\n\nexport type ResolveIOAIManagerRecoveryClass =\n\t| 'advance_after_proof'\n\t| 'diagnosis_only'\n\t| 'diagnosis_revision'\n\t| 'infra_repair'\n\t| 'compile_repair'\n\t| 'journey_contract_repair'\n\t| 'business_proof_repair'\n\t| 'release_repair'\n\t| 'product_code_repair'\n\t| 'blocked_until_new_evidence'\n\t| 'manual_handoff'\n\t| 'continue';\n\nexport interface ResolveIOAIManagerRecoveryPlan {\n\trecoveryClass: ResolveIOAIManagerRecoveryClass;\n\tlane: string;\n\tstepType: string;\n\tnextActionLabel: string;\n\tobjective: string;\n\tallowedAction: string;\n\tproductRepairAllowed: boolean;\n\texpensiveModelAllowed: boolean;\n\tmaxAttemptsBeforePark: number;\n\tfiniteSteps: string[];\n\trequiredEvidence: string[];\n\tloopResetEvidence: string[];\n\tforbiddenActions: string[];\n\tnotes: string[];\n}\n\nexport type ResolveIOAIManagerRecoveryCheckpointStatus =\n\t| 'active'\n\t| 'parked'\n\t| 'manual_handoff'\n\t| 'complete';\n\nexport interface ResolveIOAIManagerRecoveryCheckpoint {\n\tcheckpointId: string;\n\trecoveryClass: ResolveIOAIManagerRecoveryClass;\n\tstatus: ResolveIOAIManagerRecoveryCheckpointStatus;\n\tlane: string;\n\tstepType: string;\n\tallowedAction: string;\n\tproductRepairAllowed: boolean;\n\texpensiveModelAllowed: boolean;\n\tattempts: number;\n\tmaxAttemptsBeforePark: number;\n\tblockerFingerprint: string;\n\tevidenceHash: string;\n\tchangedFiles: string[];\n\tartifactPaths: string[];\n\trequiredEvidence: string[];\n\tloopResetEvidence: string[];\n\tforbiddenActions: string[];\n\tobjective: string;\n\tnextActionLabel: string;\n\tcreatedAt: string;\n\tupdatedAt: string;\n}\n\nexport type ResolveIOAIManagerRecoveryEvidenceProbeStepKind =\n\t| 'read_only_diagnosis'\n\t| 'rerun_same_gate'\n\t| 'infra_preflight'\n\t| 'compile_check'\n\t| 'route_probe'\n\t| 'business_assertion'\n\t| 'journey_validation'\n\t| 'release_status'\n\t| 'diff_scope_check'\n\t| 'operator_review';\n\nexport interface ResolveIOAIManagerRecoveryEvidenceProbeStep {\n\tid: string;\n\tkind: ResolveIOAIManagerRecoveryEvidenceProbeStepKind;\n\tlabel: string;\n\tobjective: string;\n\trequired: boolean;\n\tcommandHint?: string;\n\tartifactExpectation: string;\n\tsuccessSignal: string;\n}\n\nexport interface ResolveIOAIManagerRecoveryEvidenceProbe {\n\tprobeId: string;\n\tcheckpointId: string;\n\trecoveryClass: ResolveIOAIManagerRecoveryClass;\n\tlane: string;\n\tstepType: string;\n\tobjective: string;\n\tevidenceOnly: boolean;\n\tproductRepairAllowed: boolean;\n\texpensiveModelAllowed: boolean;\n\tevidenceHashBefore: string;\n\tblockerFingerprint: string;\n\tsteps: ResolveIOAIManagerRecoveryEvidenceProbeStep[];\n\trequiredArtifacts: string[];\n\tacceptanceEvidence: string[];\n\tstopConditions: string[];\n\tloopResetEvidence: string[];\n\tcreatedAt: string;\n}\n\nexport interface ResolveIOAIManagerRecoveryCheckpointInput {\n\tplan: ResolveIOAIManagerRecoveryPlan;\n\tcurrent?: ResolveIOAIManagerFailureRecord;\n\tpreviousCheckpoint?: ResolveIOAIManagerRecoveryCheckpoint;\n\tnow?: Date | string;\n}\n\nexport type ResolveIOAIManagerRecoveryGateAction =\n\t| 'allow'\n\t| 'collect_new_evidence'\n\t| 'reject_action'\n\t| 'manual_handoff'\n\t| 'complete';\n\nexport interface ResolveIOAIManagerRecoveryGateInput {\n\tcheckpoint: ResolveIOAIManagerRecoveryCheckpoint;\n\tcurrent?: ResolveIOAIManagerFailureRecord;\n\tproposedAction?: string;\n\toperatorApproved?: boolean;\n\tnow?: Date | string;\n}\n\nexport interface ResolveIOAIManagerRecoveryGateDecision {\n\taction: ResolveIOAIManagerRecoveryGateAction;\n\treason: string;\n\tcanRunProductRepair: boolean;\n\tcanRunExpensiveModel: boolean;\n\tshouldResetLoopBudget: boolean;\n\tshouldIncrementAttempt: boolean;\n\tnewEvidence: boolean;\n\tblockerFingerprint: string;\n\tevidenceHash: string;\n\tmissingEvidence: string[];\n\tcheckpoint: ResolveIOAIManagerRecoveryCheckpoint;\n}\n\nexport interface ResolveIOAIManagerRecoveryEvidenceProbeInput {\n\tcheckpoint: ResolveIOAIManagerRecoveryCheckpoint;\n\tcurrent?: ResolveIOAIManagerFailureRecord;\n\tnow?: Date | string;\n}\n\nexport interface ResolveIOAIManagerRecoveryPlanInput {\n\taction?: ResolveIOAIManagerAction | string;\n\treason?: string;\n\tfailureClass?: string;\n\tlane?: string;\n\tstepType?: string;\n\tblocker?: string;\n\tsameFailureCount?: number;\n\tpingPongCount?: number;\n\tnewEvidence?: boolean;\n\tproductRepairFailure?: boolean;\n\tchangedFiles?: string[];\n\tartifactPaths?: string[];\n\tmaxSameFailureRepeats?: number;\n}\n\nexport interface ResolveIOAIManagerPolicyInput {\n\thistory?: ResolveIOAIManagerFailureRecord[];\n\tcurrent?: ResolveIOAIManagerFailureRecord;\n\tmaxSameFailureRepeats?: number;\n\tmaxPingPongTransitions?: number;\n\tinfraFailureClasses?: string[];\n\tignoredFailureClasses?: string[];\n}\n\nexport interface ResolveIOAIManagerPolicyDecision {\n\taction: ResolveIOAIManagerAction;\n\treason: string;\n\tfailureClass: string;\n\tblockerFingerprint: string;\n\tevidenceHash: string;\n\tsameFailureCount: number;\n\tpingPongCount: number;\n\tnewEvidence: boolean;\n\tloopBudgetShouldReset: boolean;\n\tproductRepairFailure: boolean;\n\trecoveryPlan: ResolveIOAIManagerRecoveryPlan;\n\trecoveryCheckpoint: ResolveIOAIManagerRecoveryCheckpoint;\n\trecoveryEvidenceProbe: ResolveIOAIManagerRecoveryEvidenceProbe;\n}\n\nfunction cleanText(value: any, max = 2000): string {\n\treturn String(value || '').replace(/\\s+/g, ' ').trim().slice(0, max);\n}\n\nfunction cleanList(values: any, limit = 40, max = 500): string[] {\n\tif (!Array.isArray(values)) {\n\t\treturn [];\n\t}\n\tconst result: string[] = [];\n\tfor (const value of values) {\n\t\tconst normalized = cleanText(value, max);\n\t\tif (normalized && !result.includes(normalized)) {\n\t\t\tresult.push(normalized);\n\t\t}\n\t\tif (result.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn result;\n}\n\nfunction isoNow(value?: Date | string): string {\n\tif (value instanceof Date) {\n\t\treturn value.toISOString();\n\t}\n\tconst parsed = value ? new Date(value) : new Date();\n\tif (Number.isFinite(parsed.getTime())) {\n\t\treturn parsed.toISOString();\n\t}\n\treturn new Date().toISOString();\n}\n\nfunction stableHash(prefix: string, value: any): string {\n\tconst normalized = typeof value === 'string'\n\t\t? cleanText(value, 12000)\n\t\t: JSON.stringify(value || {});\n\tlet hash = 0;\n\tfor (let index = 0; index < normalized.length; index += 1) {\n\t\thash = ((hash << 5) - hash + normalized.charCodeAt(index)) | 0;\n\t}\n\treturn `${prefix}-${Math.abs(hash).toString(36) || '0'}`;\n}\n\nexport function normalizeResolveIOAIManagerFailureClass(value: any): string {\n\tconst normalized = cleanText(value, 80)\n\t\t.toLowerCase()\n\t\t.replace(/[\\s-]+/g, '_');\n\tif (!normalized) {\n\t\treturn 'unknown';\n\t}\n\tif (/^(qa_infra|infrastructure|harness|puppeteer|chrome|mongo|port|startup)$/.test(normalized)) {\n\t\treturn 'infra';\n\t}\n\tif (/^(build|compile|typescript|tsc|angular_build|ng_build)$/.test(normalized)) {\n\t\treturn 'compile';\n\t}\n\tif (/^(false_pass|route_only|missing_business_proof)$/.test(normalized)) {\n\t\treturn 'business';\n\t}\n\treturn normalized.slice(0, 80);\n}\n\nexport function fingerprintResolveIOAIManagerBlocker(value: any): string {\n\tconst normalized = cleanText(value, 4000)\n\t\t.toLowerCase()\n\t\t.replace(/[a-f0-9]{16,}/g, '<id>')\n\t\t.replace(/\\b\\d{2,}\\b/g, '<n>')\n\t\t.replace(/\\bline\\s+<n>\\b/g, 'line <n>')\n\t\t.replace(/https?:\\/\\/\\S+/g, '<url>')\n\t\t.replace(/\\s+/g, ' ')\n\t\t.trim();\n\treturn stableHash('mgr-blocker', normalized);\n}\n\nfunction resolveResolveIOAIManagerBlockerFingerprint(\n\trecord: ResolveIOAIManagerFailureRecord | undefined,\n\tfallback?: any\n): string {\n\tconst blockerText = cleanText(record?.blocker || record?.summary, 4000);\n\tif (blockerText) {\n\t\treturn fingerprintResolveIOAIManagerBlocker(blockerText);\n\t}\n\tconst explicit = cleanText(record?.blockerFingerprint, 120);\n\tif (explicit) {\n\t\treturn explicit;\n\t}\n\treturn fingerprintResolveIOAIManagerBlocker(fallback || '');\n}\n\nexport function hashResolveIOAIManagerEvidence(record: ResolveIOAIManagerFailureRecord | undefined): string {\n\tif (!record) {\n\t\treturn stableHash('mgr-evidence', '');\n\t}\n\tconst explicit = cleanText(record.evidenceHash, 120);\n\tif (explicit) {\n\t\treturn explicit;\n\t}\n\treturn stableHash('mgr-evidence', {\n\t\tfailureClass: normalizeResolveIOAIManagerFailureClass(record.failureClass),\n\t\tblocker: cleanText(record.blocker || record.summary, 2000),\n\t\tchangedFiles: cleanList(record.changedFiles, 80, 500).sort(),\n\t\tartifactPaths: cleanList(record.artifactPaths, 80, 500).sort()\n\t});\n}\n\nexport function buildResolveIOAIManagerRecoveryCheckpoint(\n\tinput: ResolveIOAIManagerRecoveryCheckpointInput\n): ResolveIOAIManagerRecoveryCheckpoint {\n\tconst plan = input.plan;\n\tconst current = input.current || {};\n\tconst blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current, plan.objective);\n\tconst evidenceHash = hashResolveIOAIManagerEvidence(current);\n\tconst changedFiles = cleanList(current.changedFiles, 80, 500);\n\tconst artifactPaths = cleanList(current.artifactPaths, 80, 500);\n\tconst previous = input.previousCheckpoint;\n\tconst sameCheckpointBase = previous\n\t\t&& previous.recoveryClass === plan.recoveryClass\n\t\t&& previous.lane === plan.lane\n\t\t&& previous.stepType === plan.stepType\n\t\t&& previous.blockerFingerprint === blockerFingerprint\n\t\t&& previous.evidenceHash === evidenceHash;\n\tconst attempts = sameCheckpointBase ? Math.max(0, Number(previous.attempts || 0)) + 1 : 1;\n\tconst status: ResolveIOAIManagerRecoveryCheckpointStatus = plan.recoveryClass === 'manual_handoff'\n\t\t? 'manual_handoff'\n\t\t: plan.recoveryClass === 'blocked_until_new_evidence'\n\t\t\t? 'parked'\n\t\t\t: plan.recoveryClass === 'advance_after_proof'\n\t\t\t\t? 'complete'\n\t\t\t\t: 'active';\n\tconst now = isoNow(input.now);\n\tconst checkpointId = stableHash('mgr-recovery', {\n\t\trecoveryClass: plan.recoveryClass,\n\t\tlane: plan.lane,\n\t\tstepType: plan.stepType,\n\t\tallowedAction: plan.allowedAction,\n\t\tblockerFingerprint,\n\t\tevidenceHash\n\t});\n\treturn {\n\t\tcheckpointId,\n\t\trecoveryClass: plan.recoveryClass,\n\t\tstatus,\n\t\tlane: plan.lane,\n\t\tstepType: plan.stepType,\n\t\tallowedAction: plan.allowedAction,\n\t\tproductRepairAllowed: plan.productRepairAllowed,\n\t\texpensiveModelAllowed: plan.expensiveModelAllowed,\n\t\tattempts,\n\t\tmaxAttemptsBeforePark: plan.maxAttemptsBeforePark,\n\t\tblockerFingerprint,\n\t\tevidenceHash,\n\t\tchangedFiles,\n\t\tartifactPaths,\n\t\trequiredEvidence: cleanList(plan.requiredEvidence, 40, 500),\n\t\tloopResetEvidence: cleanList(plan.loopResetEvidence, 40, 500),\n\t\tforbiddenActions: cleanList(plan.forbiddenActions, 40, 500),\n\t\tobjective: cleanText(plan.objective, 1000),\n\t\tnextActionLabel: cleanText(plan.nextActionLabel, 160),\n\t\tcreatedAt: sameCheckpointBase && previous?.createdAt ? previous.createdAt : now,\n\t\tupdatedAt: now\n\t};\n}\n\nfunction makeRecoveryEvidenceProbeStep(\n\tid: string,\n\tkind: ResolveIOAIManagerRecoveryEvidenceProbeStepKind,\n\tlabel: string,\n\tobjective: string,\n\tartifactExpectation: string,\n\tsuccessSignal: string,\n\toptions: Partial<Pick<ResolveIOAIManagerRecoveryEvidenceProbeStep, 'required' | 'commandHint'>> = {}\n): ResolveIOAIManagerRecoveryEvidenceProbeStep {\n\treturn {\n\t\tid,\n\t\tkind,\n\t\tlabel,\n\t\tobjective: cleanText(objective, 1000),\n\t\trequired: options.required !== false,\n\t\t...(options.commandHint ? { commandHint: cleanText(options.commandHint, 500) } : {}),\n\t\tartifactExpectation: cleanText(artifactExpectation, 500),\n\t\tsuccessSignal: cleanText(successSignal, 500)\n\t};\n}\n\nfunction recoveryEvidenceProbeStepsFor(\n\tcheckpoint: ResolveIOAIManagerRecoveryCheckpoint\n): ResolveIOAIManagerRecoveryEvidenceProbeStep[] {\n\tconst base = [\n\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t'snapshot_current_blocker',\n\t\t\t'rerun_same_gate',\n\t\t\t'Snapshot Current Blocker',\n\t\t\t'Capture the current blocker, failure class, evidence hash, changed files, and artifact paths before any new repair.',\n\t\t\t'runner-evidence/current-blocker.json',\n\t\t\t'Snapshot includes the same checkpointId, blockerFingerprint, and evidenceHashBefore.'\n\t\t)\n\t];\n\tif (checkpoint.recoveryClass === 'diagnosis_only' || checkpoint.recoveryClass === 'diagnosis_revision') {\n\t\treturn [\n\t\t\t...base,\n\t\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t\t'collect_read_only_root_cause_evidence',\n\t\t\t\t'read_only_diagnosis',\n\t\t\t\t'Collect Read-Only Root-Cause Evidence',\n\t\t\t\tcheckpoint.recoveryClass === 'diagnosis_revision'\n\t\t\t\t\t? 'Collect new evidence that proves the current owner_files or failing_path is wrong before broadening scope.'\n\t\t\t\t\t: 'Reproduce or classify the issue and record the exact customer complaint, expected result, observed result, route/module, and account context.',\n\t\t\t\t'runner-evidence/diagnosis-readonly.md',\n\t\t\t\t'Evidence supports one falsifiable accepted hypothesis and at least one rejected alternative.'\n\t\t\t),\n\t\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t\t'validate_diagnosis_gate',\n\t\t\t\t'read_only_diagnosis',\n\t\t\t\t'Validate Diagnosis Gate',\n\t\t\t\t'Validate issue_case, accepted_hypothesis, rejected_alternatives, failing_path, owner_files, and before/action/after proof_plan.',\n\t\t\t\t'runner-evidence/diagnosis-gate.json',\n\t\t\t\t'Diagnosis gate validates before product-code repair is allowed.'\n\t\t\t)\n\t\t];\n\t}\n\tif (checkpoint.recoveryClass === 'infra_repair') {\n\t\treturn [\n\t\t\t...base,\n\t\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t\t'run_infra_preflight',\n\t\t\t\t'infra_preflight',\n\t\t\t\t'Run Infra Preflight',\n\t\t\t\t'Check Puppeteer/Chrome, ports, Mongo/settings, cache state, startup commands, and server/client process health.',\n\t\t\t\t'runner-evidence/infra-preflight.log',\n\t\t\t\t'The same infra gate either passes or returns a new infra blocker hash.',\n\t\t\t\t{ commandHint: 'runner preflight: puppeteer/chrome/mongo/ports/startup' }\n\t\t\t)\n\t\t];\n\t}\n\tif (checkpoint.recoveryClass === 'compile_repair') {\n\t\treturn [\n\t\t\t...base,\n\t\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t\t'rerun_compile_gate',\n\t\t\t\t'compile_check',\n\t\t\t\t'Rerun Compile Gate',\n\t\t\t\t'Rerun the same deterministic compile/build command and capture the first actionable error.',\n\t\t\t\t'runner-evidence/compile.log',\n\t\t\t\t'Compile passes or the first failing error changes.',\n\t\t\t\t{ commandHint: 'same finite build/compile command from the failed gate' }\n\t\t\t)\n\t\t];\n\t}\n\tif (checkpoint.recoveryClass === 'journey_contract_repair') {\n\t\treturn [\n\t\t\t...base,\n\t\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t\t'validate_journey_contract',\n\t\t\t\t'journey_validation',\n\t\t\t\t'Validate Journey Contract',\n\t\t\t\t'Validate docs/APP_JOURNEY_CONTRACT.md has first/next/last workflow, route/action/method mapping, seeded data story, completion states, and QA assertions.',\n\t\t\t\t'runner-evidence/journey-contract-validation.json',\n\t\t\t\t'Journey contract validates before build tasks continue.'\n\t\t\t),\n\t\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t\t'verify_hub_workflow_mapping',\n\t\t\t\t'journey_validation',\n\t\t\t\t'Verify Hub Workflow Mapping',\n\t\t\t\t'Confirm the hub CTA and screen sequence implement the journey contract instead of link-only navigation.',\n\t\t\t\t'runner-evidence/hub-workflow-map.json',\n\t\t\t\t'Primary hub action maps to a real route/action/method/calculation and next state.'\n\t\t\t)\n\t\t];\n\t}\n\tif (checkpoint.recoveryClass === 'business_proof_repair' || checkpoint.recoveryClass === 'product_code_repair') {\n\t\treturn [\n\t\t\t...base,\n\t\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t\t'rerun_business_assertion',\n\t\t\t\t'business_assertion',\n\t\t\t\t'Rerun Business Assertion',\n\t\t\t\t'Run the exact issue/app promise proof and capture before/action/after DOM/data evidence.',\n\t\t\t\t'runner-evidence/business-assertion.json',\n\t\t\t\t'Business assertion passes, or the observed failure changes with a new artifact path.'\n\t\t\t),\n\t\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t\t'check_diff_scope',\n\t\t\t\t'diff_scope_check',\n\t\t\t\t'Check Diff Scope',\n\t\t\t\t'Compare changed files against the current diagnosis/journey owner scope before another code repair.',\n\t\t\t\t'runner-evidence/diff-scope.json',\n\t\t\t\t'Changed files are in scope, or diagnosis/journey scope is revised with evidence.'\n\t\t\t)\n\t\t];\n\t}\n\tif (checkpoint.recoveryClass === 'release_repair') {\n\t\treturn [\n\t\t\t...base,\n\t\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t\t'collect_release_status',\n\t\t\t\t'release_status',\n\t\t\t\t'Collect Release Status',\n\t\t\t\t'Collect publish/deploy/build-instance/domain/CloudFront status and the last actionable deploy error.',\n\t\t\t\t'runner-evidence/release-status.json',\n\t\t\t\t'Release gate passes or returns a new release blocker hash without product-code repair.'\n\t\t\t)\n\t\t];\n\t}\n\tif (checkpoint.recoveryClass === 'manual_handoff') {\n\t\treturn [\n\t\t\t...base,\n\t\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t\t'operator_review_checkpoint',\n\t\t\t\t'operator_review',\n\t\t\t\t'Operator Review Checkpoint',\n\t\t\t\t'Expose budget, blocker, evidence hash, and the minimum policy/scope change needed before another expensive loop.',\n\t\t\t\t'runner-evidence/operator-review.json',\n\t\t\t\t'Operator approves a new scope/policy or provides new external evidence.'\n\t\t\t)\n\t\t];\n\t}\n\treturn [\n\t\t...base,\n\t\tmakeRecoveryEvidenceProbeStep(\n\t\t\t'rerun_same_deterministic_gate',\n\t\t\t'rerun_same_gate',\n\t\t\t'Rerun Same Deterministic Gate',\n\t\t\t'Rerun the exact failed check and capture new logs/artifacts without changing product code first.',\n\t\t\t'runner-evidence/retry-gate.log',\n\t\t\t'Gate passes, or evidenceHash/blockerFingerprint/artifactPaths change.'\n\t\t)\n\t];\n}\n\nexport function buildResolveIOAIManagerRecoveryEvidenceProbe(\n\tinput: ResolveIOAIManagerRecoveryEvidenceProbeInput\n): ResolveIOAIManagerRecoveryEvidenceProbe {\n\tconst checkpoint = input.checkpoint;\n\tconst now = isoNow(input.now);\n\tconst steps = recoveryEvidenceProbeStepsFor(checkpoint);\n\tconst requiredArtifacts = Array.from(new Set(steps\n\t\t.filter((step) => step.required)\n\t\t.map((step) => step.artifactExpectation)\n\t\t.filter(Boolean)));\n\treturn {\n\t\tprobeId: stableHash('mgr-probe', {\n\t\t\tcheckpointId: checkpoint.checkpointId,\n\t\t\trecoveryClass: checkpoint.recoveryClass,\n\t\t\tevidenceHash: checkpoint.evidenceHash,\n\t\t\tblockerFingerprint: checkpoint.blockerFingerprint\n\t\t}),\n\t\tcheckpointId: checkpoint.checkpointId,\n\t\trecoveryClass: checkpoint.recoveryClass,\n\t\tlane: checkpoint.lane,\n\t\tstepType: checkpoint.stepType,\n\t\tobjective: checkpoint.status === 'parked'\n\t\t\t? 'Collect new evidence before any additional expensive model/code repair.'\n\t\t\t: cleanText(checkpoint.objective, 1000),\n\t\tevidenceOnly: checkpoint.status === 'parked'\n\t\t\t|| checkpoint.recoveryClass === 'diagnosis_only'\n\t\t\t|| checkpoint.recoveryClass === 'diagnosis_revision'\n\t\t\t|| checkpoint.recoveryClass === 'infra_repair'\n\t\t\t|| checkpoint.recoveryClass === 'compile_repair'\n\t\t\t|| checkpoint.recoveryClass === 'release_repair',\n\t\tproductRepairAllowed: checkpoint.productRepairAllowed && checkpoint.status !== 'parked',\n\t\texpensiveModelAllowed: checkpoint.expensiveModelAllowed && checkpoint.status !== 'parked',\n\t\tevidenceHashBefore: checkpoint.evidenceHash,\n\t\tblockerFingerprint: checkpoint.blockerFingerprint,\n\t\tsteps,\n\t\trequiredArtifacts,\n\t\tacceptanceEvidence: Array.from(new Set([\n\t\t\t...checkpoint.requiredEvidence,\n\t\t\t...checkpoint.loopResetEvidence,\n\t\t\t...steps.map((step) => step.successSignal)\n\t\t].map((entry) => cleanText(entry, 500)).filter(Boolean))).slice(0, 30),\n\t\tstopConditions: Array.from(new Set([\n\t\t\t...checkpoint.forbiddenActions,\n\t\t\t'no new evidence hash',\n\t\t\t'no new artifact path',\n\t\t\t'product-code repair requested while evidenceOnly is true'\n\t\t].map((entry) => cleanText(entry, 500)).filter(Boolean))).slice(0, 30),\n\t\tloopResetEvidence: checkpoint.loopResetEvidence,\n\t\tcreatedAt: now\n\t};\n}\n\nfunction listHasNewEntry(current: string[], previous: string[]): boolean {\n\tconst existing = new Set(previous.map((entry) => cleanText(entry, 500)).filter(Boolean));\n\treturn current.some((entry) => {\n\t\tconst normalized = cleanText(entry, 500);\n\t\treturn !!normalized && !existing.has(normalized);\n\t});\n}\n\nfunction proposedActionIsProductRepair(value: any): boolean {\n\tconst normalized = cleanText(value, 120);\n\treturn /product|code|repair|build|business|journey|workflow/i.test(normalized)\n\t\t&& !/infra|compile|diagnosis|manual|evidence|release|publish/i.test(normalized);\n}\n\nexport function decideResolveIOAIManagerRecoveryGate(\n\tinput: ResolveIOAIManagerRecoveryGateInput\n): ResolveIOAIManagerRecoveryGateDecision {\n\tconst checkpoint = input.checkpoint;\n\tconst hasCurrent = !!input.current;\n\tconst current = input.current || {};\n\tconst blockerFingerprint = hasCurrent\n\t\t? resolveResolveIOAIManagerBlockerFingerprint(current, checkpoint.objective)\n\t\t: checkpoint.blockerFingerprint;\n\tconst evidenceHash = hasCurrent ? hashResolveIOAIManagerEvidence(current) : checkpoint.evidenceHash;\n\tconst changedFiles = hasCurrent ? cleanList(current.changedFiles, 80, 500) : checkpoint.changedFiles;\n\tconst artifactPaths = hasCurrent ? cleanList(current.artifactPaths, 80, 500) : checkpoint.artifactPaths;\n\tconst evidenceChanged = evidenceHash !== checkpoint.evidenceHash\n\t\t|| blockerFingerprint !== checkpoint.blockerFingerprint\n\t\t|| listHasNewEntry(changedFiles, checkpoint.changedFiles)\n\t\t|| listHasNewEntry(artifactPaths, checkpoint.artifactPaths);\n\tconst proposedAction = cleanText(input.proposedAction || checkpoint.allowedAction, 120);\n\tconst productRepairRequested = proposedActionIsProductRepair(proposedAction);\n\tconst missingEvidence = checkpoint.requiredEvidence.filter((required) => {\n\t\tconst normalized = cleanText(required, 120).toLowerCase();\n\t\tif (!normalized) {\n\t\t\treturn false;\n\t\t}\n\t\tif (/artifact|log|proof|gate|evidence/.test(normalized)) {\n\t\t\treturn !artifactPaths.length && !current.evidenceHash;\n\t\t}\n\t\tif (/diff|changed files|owner|scope|file/.test(normalized)) {\n\t\t\treturn !changedFiles.length;\n\t\t}\n\t\treturn false;\n\t});\n\tconst makeDecision = (\n\t\taction: ResolveIOAIManagerRecoveryGateAction,\n\t\treason: string,\n\t\toverrides: Partial<ResolveIOAIManagerRecoveryGateDecision> = {}\n\t): ResolveIOAIManagerRecoveryGateDecision => ({\n\t\taction,\n\t\treason,\n\t\tcanRunProductRepair: checkpoint.productRepairAllowed,\n\t\tcanRunExpensiveModel: checkpoint.expensiveModelAllowed,\n\t\tshouldResetLoopBudget: false,\n\t\tshouldIncrementAttempt: action === 'allow',\n\t\tnewEvidence: evidenceChanged,\n\t\tblockerFingerprint,\n\t\tevidenceHash,\n\t\tmissingEvidence,\n\t\tcheckpoint: {\n\t\t\t...checkpoint,\n\t\t\tupdatedAt: isoNow(input.now)\n\t\t},\n\t\t...overrides\n\t});\n\n\tif (checkpoint.status === 'complete') {\n\t\treturn makeDecision('complete', 'recovery_gate_checkpoint_already_complete', {\n\t\t\tcanRunProductRepair: false,\n\t\t\tcanRunExpensiveModel: false,\n\t\t\tshouldIncrementAttempt: false\n\t\t});\n\t}\n\tif (checkpoint.status === 'manual_handoff' && input.operatorApproved !== true) {\n\t\treturn makeDecision('manual_handoff', 'recovery_gate_manual_handoff_requires_operator_approval', {\n\t\t\tcanRunProductRepair: false,\n\t\t\tcanRunExpensiveModel: false,\n\t\t\tshouldIncrementAttempt: false\n\t\t});\n\t}\n\tif (productRepairRequested && !checkpoint.productRepairAllowed) {\n\t\treturn makeDecision('reject_action', 'recovery_gate_product_repair_not_allowed_for_checkpoint', {\n\t\t\tcanRunProductRepair: false,\n\t\t\tcanRunExpensiveModel: false,\n\t\t\tshouldIncrementAttempt: false\n\t\t});\n\t}\n\tif (checkpoint.status === 'parked' && !evidenceChanged) {\n\t\treturn makeDecision('collect_new_evidence', 'recovery_gate_parked_until_new_evidence', {\n\t\t\tcanRunProductRepair: false,\n\t\t\tcanRunExpensiveModel: false,\n\t\t\tshouldIncrementAttempt: false\n\t\t});\n\t}\n\tif (checkpoint.attempts >= checkpoint.maxAttemptsBeforePark && !evidenceChanged) {\n\t\treturn makeDecision('collect_new_evidence', 'recovery_gate_attempt_limit_requires_new_evidence', {\n\t\t\tcanRunProductRepair: false,\n\t\t\tcanRunExpensiveModel: false,\n\t\t\tshouldIncrementAttempt: false\n\t\t});\n\t}\n\tif (evidenceChanged) {\n\t\tconst currentFailureClass = normalizeResolveIOAIManagerFailureClass(current.failureClass);\n\t\tconst currentCanRunProductRepair = checkpoint.productRepairAllowed\n\t\t\t|| !/^(infra|compile|diagnosis|release)$/i.test(currentFailureClass);\n\t\treturn makeDecision('allow', 'recovery_gate_new_evidence_unblocks_retry', {\n\t\t\tcanRunProductRepair: currentCanRunProductRepair,\n\t\t\tcanRunExpensiveModel: checkpoint.expensiveModelAllowed || currentCanRunProductRepair,\n\t\t\tshouldResetLoopBudget: true\n\t\t});\n\t}\n\treturn makeDecision('allow', 'recovery_gate_action_allowed');\n}\n\nfunction failureKey(record: ResolveIOAIManagerFailureRecord | undefined): string {\n\tif (!record) {\n\t\treturn '';\n\t}\n\tconst failureClass = normalizeResolveIOAIManagerFailureClass(record.failureClass);\n\tconst blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(record);\n\treturn `${cleanText(record.lane, 80)}:${cleanText(record.stepType, 80)}:${failureClass}:${blockerFingerprint}`;\n}\n\nfunction failureEvidenceKey(record: ResolveIOAIManagerFailureRecord | undefined): string {\n\treturn `${failureKey(record)}:${hashResolveIOAIManagerEvidence(record)}`;\n}\n\nfunction isPassingOutcome(record: ResolveIOAIManagerFailureRecord | undefined): boolean {\n\treturn /^(pass|accepted|ready_to_publish|published|ready_for_merge|complete|completed)$/i.test(cleanText(record?.outcome, 80));\n}\n\nfunction isManualOutcome(record: ResolveIOAIManagerFailureRecord | undefined): boolean {\n\treturn /^(manual_handoff|park_manual|stopped)$/i.test(cleanText(record?.outcome, 80));\n}\n\nexport function buildResolveIOAIManagerRecoveryPlan(input: ResolveIOAIManagerRecoveryPlanInput = {}): ResolveIOAIManagerRecoveryPlan {\n\tconst action = cleanText(input.action, 80) || 'continue';\n\tconst reason = cleanText(input.reason, 240);\n\tconst failureClass = normalizeResolveIOAIManagerFailureClass(input.failureClass);\n\tconst lane = cleanText(input.lane, 80) || 'supervisor';\n\tconst stepType = cleanText(input.stepType, 80) || 'unknown';\n\tconst blocker = cleanText(input.blocker, 700);\n\tconst changedFiles = cleanList(input.changedFiles, 12, 240);\n\tconst artifactPaths = cleanList(input.artifactPaths, 12, 240);\n\tconst maxAttemptsBeforePark = Math.max(1, Number(input.maxSameFailureRepeats || 3) || 3);\n\tconst commonNotes = [\n\t\treason ? `policy_reason=${reason}` : '',\n\t\tblocker ? `blocker=${blocker}` : '',\n\t\tchangedFiles.length ? `changed_files=${changedFiles.join(', ')}` : '',\n\t\tartifactPaths.length ? `artifacts=${artifactPaths.join(', ')}` : ''\n\t].filter(Boolean);\n\tconst base: Omit<ResolveIOAIManagerRecoveryPlan, 'recoveryClass' | 'nextActionLabel' | 'objective' | 'allowedAction' | 'productRepairAllowed' | 'expensiveModelAllowed' | 'finiteSteps' | 'requiredEvidence' | 'loopResetEvidence' | 'forbiddenActions'> = {\n\t\tlane,\n\t\tstepType,\n\t\tmaxAttemptsBeforePark,\n\t\tnotes: commonNotes\n\t};\n\tconst makePlan = (\n\t\trecoveryClass: ResolveIOAIManagerRecoveryClass,\n\t\tnextActionLabel: string,\n\t\tobjective: string,\n\t\tallowedAction: string,\n\t\tproductRepairAllowed: boolean,\n\t\texpensiveModelAllowed: boolean,\n\t\tfiniteSteps: string[],\n\t\trequiredEvidence: string[],\n\t\tloopResetEvidence: string[],\n\t\tforbiddenActions: string[]\n\t): ResolveIOAIManagerRecoveryPlan => ({\n\t\t...base,\n\t\trecoveryClass,\n\t\tnextActionLabel,\n\t\tobjective,\n\t\tallowedAction,\n\t\tproductRepairAllowed,\n\t\texpensiveModelAllowed,\n\t\tfiniteSteps,\n\t\trequiredEvidence,\n\t\tloopResetEvidence,\n\t\tforbiddenActions\n\t});\n\tif (action === 'reset_loop_budget') {\n\t\treturn makePlan(\n\t\t\t'advance_after_proof',\n\t\t\t'Advance After Proof',\n\t\t\t'Checkpoint the passing evidence and move to the next required gate.',\n\t\t\t'advance_to_next_gate',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t[\n\t\t\t\t'Record the passing artifact, changed files, and gate result.',\n\t\t\t\t'Reset the loop counter because a real gate passed.',\n\t\t\t\t'Select the next unmet deterministic gate instead of repeating the previous repair.'\n\t\t\t],\n\t\t\t['passing gate record', 'artifact or log proving the passed check'],\n\t\t\t['new passing gate result', 'new business proof artifact'],\n\t\t\t['rerun the same repair after a pass', 'mark accepted without the required downstream gate']\n\t\t);\n\t}\n\tif (action === 'manual_handoff') {\n\t\treturn makePlan(\n\t\t\t'manual_handoff',\n\t\t\t'Manual Review',\n\t\t\t'Stop autonomous repair and expose the blocker, evidence, and last safe state.',\n\t\t\t'manual_review_only',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t[\n\t\t\t\t'Freeze further product-code edits.',\n\t\t\t\t'Show the blocker fingerprint, evidence hash, and prior attempts.',\n\t\t\t\t'Require a human edit to classification, scope, or retry policy before another model/code loop.'\n\t\t\t],\n\t\t\t['blocker fingerprint', 'evidence hash', 'attempt history'],\n\t\t\t['manual policy change', 'new external evidence'],\n\t\t\t['start another automatic model repair', 'hide the failed evidence']\n\t\t);\n\t}\n\tif (action === 'budget_stop') {\n\t\treturn makePlan(\n\t\t\t'manual_handoff',\n\t\t\t'Budget Stop Review',\n\t\t\t'Stop autonomous model/code loops until a cheaper scoped next action is selected.',\n\t\t\t'budget_review_only',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t[\n\t\t\t\t'Freeze further model repair loops.',\n\t\t\t\t'Show the prompt/token/runtime budget that tripped the guard.',\n\t\t\t\t'Select a cheaper deterministic gate, infra repair, diagnosis revision, or manual scope edit before resuming.'\n\t\t\t],\n\t\t\t['budget guard reason', 'latest prompt estimate', 'last blocker/evidence hash'],\n\t\t\t['manual scope reduction', 'new deterministic evidence', 'approved budget policy change'],\n\t\t\t['start another broad model prompt', 'reset budget without new evidence', 'hide cost context']\n\t\t);\n\t}\n\tif (failureClass === 'diagnosis' || stepType === 'diagnosis_gate') {\n\t\treturn makePlan(\n\t\t\t'diagnosis_only',\n\t\t\t'Run Diagnosis Gate',\n\t\t\t'Produce a falsifiable root-cause diagnosis before any repair.',\n\t\t\t'read_only_diagnosis',\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t\t[\n\t\t\t\t'Reproduce or explicitly classify the customer issue.',\n\t\t\t\t'Accept one falsifiable hypothesis and record rejected alternatives.',\n\t\t\t\t'Identify the frontend/backend/shared failing path.',\n\t\t\t\t'Select a small owner_files set.',\n\t\t\t\t'Define exact before/action/after business proof.'\n\t\t\t],\n\t\t\t['issue_case', 'accepted_hypothesis', 'rejected_alternatives', 'failing_path', 'owner_files', 'proof_plan'],\n\t\t\t['new reproduction artifact', 'new query/log/code evidence', 'validated diagnosis gate'],\n\t\t\t['edit product code', 'run broad repo repair', 'accept route-load evidence as success']\n\t\t);\n\t}\n\tif (failureClass === 'owner_scope' || failureClass === 'out_of_scope' || /out.?of.?scope|owner_files/i.test(reason)) {\n\t\treturn makePlan(\n\t\t\t'diagnosis_revision',\n\t\t\t'Revise Diagnosis Scope',\n\t\t\t'Revise owner_files only when new evidence proves the current scope is wrong.',\n\t\t\t'diagnosis_revision_only',\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t\t[\n\t\t\t\t'Compare changed files against the diagnosis owner_files.',\n\t\t\t\t'Collect evidence proving why the new file is in the failing path.',\n\t\t\t\t'Update accepted_hypothesis, failing_path, owner_files, and proof_plan together.',\n\t\t\t\t'Resume repair only after the revised gate validates.'\n\t\t\t],\n\t\t\t['out-of-scope file list', 'new failing-path evidence', 'revalidated diagnosis gate'],\n\t\t\t['revised owner_files with evidence', 'new business proof requirement'],\n\t\t\t['keep broad edits without diagnosis', 'add convenience refactors', 'continue repair outside owner_files']\n\t\t);\n\t}\n\tif (action === 'retry_infra') {\n\t\tconst isCompile = failureClass === 'compile';\n\t\treturn makePlan(\n\t\t\tisCompile ? 'compile_repair' : 'infra_repair',\n\t\t\tisCompile ? 'Repair Compile Gate' : 'Repair Infra Gate',\n\t\t\tisCompile\n\t\t\t\t? 'Fix the deterministic compile/build blocker before spending another product repair loop.'\n\t\t\t\t: 'Fix the deterministic harness/browser/server/Mongo blocker before product repair.',\n\t\t\tisCompile ? 'compile_repair_only' : 'infra_repair_only',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\tisCompile\n\t\t\t\t? [\n\t\t\t\t\t'Read the exact compile/build log and identify the first actionable error.',\n\t\t\t\t\t'Fix missing dependency, stale artifact, command, cache, or type wiring required by the compile gate.',\n\t\t\t\t\t'Rerun the same finite compile command.',\n\t\t\t\t\t'Return the compile log artifact and status.'\n\t\t\t\t]\n\t\t\t\t: [\n\t\t\t\t\t'Run preflight for Puppeteer, Chrome executable, ports, Mongo/settings, and startup command.',\n\t\t\t\t\t'Repair only the failing harness/environment item.',\n\t\t\t\t\t'Rerun the same infra check.',\n\t\t\t\t\t'Return the infra log and pass/fail status.'\n\t\t\t\t],\n\t\t\tisCompile\n\t\t\t\t? ['compile command', 'compile log artifact', 'first failing error fixed or still failing']\n\t\t\t\t: ['preflight command', 'infra log artifact', 'specific repaired environment item'],\n\t\t\t['same check now passes', 'new infra/compile blocker hash'],\n\t\t\t['run product-code model repair', 'count this as product failure', 'accept route/business success without the compile/infra gate']\n\t\t);\n\t}\n\tif (action === 'park_repeated_failure' || action === 'park_ping_pong') {\n\t\treturn makePlan(\n\t\t\t'blocked_until_new_evidence',\n\t\t\taction === 'park_ping_pong' ? 'Park Ping-Pong Loop' : 'Park Repeated Failure',\n\t\t\t'Stop the current loop until new evidence changes the diagnosis, route, or repair target.',\n\t\t\t'collect_new_evidence_only',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t[\n\t\t\t\t'Do not rerun the same prompt or same repair.',\n\t\t\t\t'Show the repeated blocker and evidence hash.',\n\t\t\t\t'Collect a new artifact: failing DOM state, stack trace, network response, Mongo delta, compile log, or revised diagnosis.',\n\t\t\t\t'Reset the loop only after the new evidence hash changes.'\n\t\t\t],\n\t\t\t['same failure count', 'blocker fingerprint', 'evidence hash'],\n\t\t\t['changed evidence hash', 'new artifact path', 'revised diagnosis or journey contract'],\n\t\t\t['alternate between two failed patches', 'increase loop budget without evidence', 'hide the park reason']\n\t\t);\n\t}\n\tif (failureClass === 'journey') {\n\t\treturn makePlan(\n\t\t\t'journey_contract_repair',\n\t\t\t'Repair Journey Contract',\n\t\t\t'Fix the first/next/last workflow contract before app code work continues.',\n\t\t\t'journey_contract_repair',\n\t\t\tfalse,\n\t\t\ttrue,\n\t\t\t[\n\t\t\t\t'Open docs/APP_JOURNEY_CONTRACT.md.',\n\t\t\t\t'Define first_screen, north_star_workflow, screen_sequence, data_story, completion_states, and qa_assertions.',\n\t\t\t\t'Ensure each CTA maps to an action, route, method, calculation, or state transition.',\n\t\t\t\t'Validate that sample data can drive the promised workflow.'\n\t\t\t],\n\t\t\t['validated journey_contract JSON', 'CTA-to-action mapping', 'workflow QA assertions'],\n\t\t\t['journey validation passes', 'new workflow QA rows generated'],\n\t\t\t['build empty routes', 'add link-only dashboard actions', 'defer workflow design to wow pass']\n\t\t);\n\t}\n\tif (failureClass === 'release') {\n\t\treturn makePlan(\n\t\t\t'release_repair',\n\t\t\t'Repair Release Gate',\n\t\t\t'Repair deploy/publish/sample-data release evidence without rewriting working app flow.',\n\t\t\t'release_repair_only',\n\t\t\tfalse,\n\t\t\tfalse,\n\t\t\t[\n\t\t\t\t'Read the deploy/publish/sample-data log.',\n\t\t\t\t'Identify whether the blocker is domain, asset, seed data, route, permission, or CDN.',\n\t\t\t\t'Repair the release artifact/config/seed issue.',\n\t\t\t\t'Rerun only the failed release gate.'\n\t\t\t],\n\t\t\t['deploy or publish log', 'sample-data status', 'failed release gate rerun'],\n\t\t\t['release gate passes', 'new release blocker hash'],\n\t\t\t['change core workflow after business QA passed', 'mark accepted from scorecard only', 'rerun full builder loop']\n\t\t);\n\t}\n\tif (failureClass === 'business' || failureClass === 'qa_evidence' || failureClass === 'route') {\n\t\treturn makePlan(\n\t\t\t'business_proof_repair',\n\t\t\t'Repair Business Proof',\n\t\t\t'Fix the exact failing workflow assertion and prove before/action/after behavior.',\n\t\t\t'business_repair',\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\t[\n\t\t\t\t'Open the failing QA row or proof_plan.',\n\t\t\t\t'Trace the UI action to method/publication/query/calculation.',\n\t\t\t\t'Patch the smallest owner or workflow files.',\n\t\t\t\t'Rerun only the failed business assertion.',\n\t\t\t\t'Record DOM/data/Mongo/artifact proof.'\n\t\t\t],\n\t\t\t['failing assertion', 'action trace', 'business proof artifact'],\n\t\t\t['business assertion passes', 'new failed assertion with new evidence'],\n\t\t\t['treat route load as success', 'rerun unrelated QA rows first', 'accept scorecard-only evidence']\n\t\t);\n\t}\n\tif (input.productRepairFailure !== false || failureClass === 'product_code') {\n\t\treturn makePlan(\n\t\t\t'product_code_repair',\n\t\t\t'Run Targeted Product Repair',\n\t\t\t'Repair the current product-code blocker with the smallest scoped edit and immediate proof.',\n\t\t\t'targeted_product_repair',\n\t\t\ttrue,\n\t\t\ttrue,\n\t\t\t[\n\t\t\t\t'Inspect the current blocker, artifacts, changed files, and owner/workflow scope.',\n\t\t\t\t'Form one small repair hypothesis.',\n\t\t\t\t'Patch only files justified by the active diagnosis or journey contract.',\n\t\t\t\t'Rerun the smallest failed gate.',\n\t\t\t\t'Record new evidence before any additional loop.'\n\t\t\t],\n\t\t\t['owner/workflow scope', 'repair diff', 'failed gate rerun artifact'],\n\t\t\t['new evidence hash', 'same gate passes'],\n\t\t\t['broad repo search-and-edit', 'rerun the same prompt without inspecting artifacts', 'change unrelated UI polish']\n\t\t);\n\t}\n\treturn makePlan(\n\t\t'continue',\n\t\t'Continue Current Gate',\n\t\t'Continue the current lane because no blocking loop or infra condition was detected.',\n\t\t'continue',\n\t\tfalse,\n\t\tfalse,\n\t\t[\n\t\t\t'Use the active lane memory.',\n\t\t\t'Run the next finite gate.',\n\t\t\t'Record artifacts and evidence hash.'\n\t\t],\n\t\t['active lane memory', 'finite gate artifact'],\n\t\t['new gate result', 'new artifact path'],\n\t\t['spawn duplicate runners', 'advance without evidence']\n\t);\n}\n\nfunction collectOpenTail(records: ResolveIOAIManagerFailureRecord[]): ResolveIOAIManagerFailureRecord[] {\n\tconst tail: ResolveIOAIManagerFailureRecord[] = [];\n\tfor (let index = records.length - 1; index >= 0; index -= 1) {\n\t\tconst record = records[index];\n\t\tif (isPassingOutcome(record)) {\n\t\t\tbreak;\n\t\t}\n\t\ttail.unshift(record);\n\t}\n\treturn tail;\n}\n\nfunction countSameFailure(records: ResolveIOAIManagerFailureRecord[], current: ResolveIOAIManagerFailureRecord): number {\n\tconst currentKey = failureEvidenceKey(current);\n\tlet count = 0;\n\tfor (let index = records.length - 1; index >= 0; index -= 1) {\n\t\tconst record = records[index];\n\t\tif (isPassingOutcome(record)) {\n\t\t\tbreak;\n\t\t}\n\t\tif (failureEvidenceKey(record) !== currentKey) {\n\t\t\tbreak;\n\t\t}\n\t\tcount += 1;\n\t}\n\treturn count;\n}\n\nfunction countPingPong(records: ResolveIOAIManagerFailureRecord[], current: ResolveIOAIManagerFailureRecord): number {\n\tconst tail = collectOpenTail(records).filter((record) => {\n\t\treturn cleanText(record.lane, 80) === cleanText(current.lane, 80)\n\t\t\t&& cleanText(record.stepType, 80) === cleanText(current.stepType, 80);\n\t});\n\tif (tail.length < 4) {\n\t\treturn 0;\n\t}\n\tconst keys = tail.map(failureKey).filter(Boolean);\n\tconst last = keys.slice(-6);\n\tif (last.length < 4) {\n\t\treturn 0;\n\t}\n\tconst distinct = Array.from(new Set(last));\n\tif (distinct.length !== 2) {\n\t\treturn 0;\n\t}\n\tfor (let index = 2; index < last.length; index += 1) {\n\t\tif (last[index] !== last[index - 2]) {\n\t\t\treturn 0;\n\t\t}\n\t}\n\treturn last.length - 1;\n}\n\nexport function decideResolveIOAIManagerPolicy(input: ResolveIOAIManagerPolicyInput): ResolveIOAIManagerPolicyDecision {\n\tconst history = Array.isArray(input.history) ? input.history : [];\n\tconst current = input.current || history[history.length - 1] || {};\n\tconst failureClass = normalizeResolveIOAIManagerFailureClass(current.failureClass);\n\tconst blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current);\n\tconst evidenceHash = hashResolveIOAIManagerEvidence(current);\n\tconst previous = history.length > 1 ? history[history.length - 2] : undefined;\n\tconst previousSameFailure = previous && failureKey(previous) === failureKey(current);\n\tconst previousEvidenceHash = previousSameFailure ? hashResolveIOAIManagerEvidence(previous) : '';\n\tconst newEvidence = !!previousSameFailure && !!previousEvidenceHash && previousEvidenceHash !== evidenceHash;\n\tconst sameFailureCount = countSameFailure(history, current);\n\tconst pingPongCount = countPingPong(history, current);\n\tconst maxSameFailureRepeats = Math.max(1, Number(input.maxSameFailureRepeats || 3) || 3);\n\tconst maxPingPongTransitions = Math.max(3, Number(input.maxPingPongTransitions || 3) || 3);\n\tconst infraClasses = new Set((input.infraFailureClasses || ['infra', 'compile']).map(normalizeResolveIOAIManagerFailureClass));\n\tconst ignoredClasses = new Set((input.ignoredFailureClasses || []).map(normalizeResolveIOAIManagerFailureClass));\n\tconst base = {\n\t\tfailureClass,\n\t\tblockerFingerprint,\n\t\tevidenceHash,\n\t\tsameFailureCount,\n\t\tpingPongCount,\n\t\tnewEvidence,\n\t\tloopBudgetShouldReset: false,\n\t\tproductRepairFailure: !infraClasses.has(failureClass) && !ignoredClasses.has(failureClass)\n\t};\n\tconst withPlan = (\n\t\taction: ResolveIOAIManagerAction,\n\t\treason: string,\n\t\toverrides: Partial<Omit<ResolveIOAIManagerPolicyDecision, 'action' | 'reason' | 'recoveryPlan' | 'recoveryCheckpoint'>> = {}\n\t): ResolveIOAIManagerPolicyDecision => {\n\t\tconst merged = {\n\t\t\t...base,\n\t\t\t...overrides\n\t\t};\n\t\tconst recoveryPlan = buildResolveIOAIManagerRecoveryPlan({\n\t\t\taction,\n\t\t\treason,\n\t\t\tfailureClass: merged.failureClass,\n\t\t\tlane: current.lane,\n\t\t\tstepType: current.stepType,\n\t\t\tblocker: current.blocker || current.summary,\n\t\t\tsameFailureCount: merged.sameFailureCount,\n\t\t\tpingPongCount: merged.pingPongCount,\n\t\t\tnewEvidence: merged.newEvidence,\n\t\t\tproductRepairFailure: merged.productRepairFailure,\n\t\t\tchangedFiles: current.changedFiles,\n\t\t\tartifactPaths: current.artifactPaths,\n\t\t\tmaxSameFailureRepeats\n\t\t});\n\t\tconst recoveryCheckpoint = buildResolveIOAIManagerRecoveryCheckpoint({\n\t\t\tplan: recoveryPlan,\n\t\t\tcurrent\n\t\t});\n\t\treturn {\n\t\t\t...merged,\n\t\t\taction,\n\t\t\treason,\n\t\t\trecoveryPlan,\n\t\t\trecoveryCheckpoint,\n\t\t\trecoveryEvidenceProbe: buildResolveIOAIManagerRecoveryEvidenceProbe({\n\t\t\t\tcheckpoint: recoveryCheckpoint,\n\t\t\t\tcurrent\n\t\t\t})\n\t\t};\n\t};\n\tif (isPassingOutcome(current)) {\n\t\treturn withPlan('reset_loop_budget', 'manager_policy_progress_passed', {\n\t\t\tloopBudgetShouldReset: true,\n\t\t\tproductRepairFailure: false\n\t\t});\n\t}\n\tif (isManualOutcome(current)) {\n\t\treturn withPlan('manual_handoff', 'manager_policy_manual_or_stopped');\n\t}\n\tif (infraClasses.has(failureClass)) {\n\t\treturn withPlan('retry_infra', 'manager_policy_infra_failure_routes_to_infra_repair', {\n\t\t\tproductRepairFailure: false\n\t\t});\n\t}\n\tif (pingPongCount >= maxPingPongTransitions) {\n\t\treturn withPlan('park_ping_pong', 'manager_policy_ping_pong_failure_loop');\n\t}\n\tif (sameFailureCount >= maxSameFailureRepeats && !newEvidence) {\n\t\treturn withPlan('park_repeated_failure', 'manager_policy_same_failure_without_new_evidence');\n\t}\n\tif (newEvidence || !previousSameFailure) {\n\t\treturn withPlan('continue', newEvidence\n\t\t\t\t? 'manager_policy_new_evidence_resets_loop_budget'\n\t\t\t\t: 'manager_policy_new_failure_or_lane', {\n\t\t\tloopBudgetShouldReset: true\n\t\t});\n\t}\n\treturn withPlan('continue', 'manager_policy_retry_below_repeat_limit');\n}\n"]}
|