@resolveio/server-lib 22.3.138 → 22.3.140

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "22.3.138",
3
+ "version": "22.3.140",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
package/public_api.d.ts CHANGED
@@ -98,6 +98,7 @@ export * from './util/ai-run-evidence';
98
98
  export * from './util/ai-run-evidence-adapters';
99
99
  export * from './util/ai-run-evidence-dashboard';
100
100
  export * from './util/ai-run-evidence-eval';
101
+ export * from './util/ai-runner-manager-autopilot';
101
102
  export * from './util/ai-runner-manager-policy';
102
103
  export * from './util/ai-runner-artifacts';
103
104
  export * from './util/ai-runner-qa-auth';
package/public_api.js CHANGED
@@ -114,6 +114,7 @@ __exportStar(require("./util/ai-run-evidence"), exports);
114
114
  __exportStar(require("./util/ai-run-evidence-adapters"), exports);
115
115
  __exportStar(require("./util/ai-run-evidence-dashboard"), exports);
116
116
  __exportStar(require("./util/ai-run-evidence-eval"), exports);
117
+ __exportStar(require("./util/ai-runner-manager-autopilot"), exports);
117
118
  __exportStar(require("./util/ai-runner-manager-policy"), exports);
118
119
  __exportStar(require("./util/ai-runner-artifacts"), exports);
119
120
  __exportStar(require("./util/ai-runner-qa-auth"), exports);
package/public_api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/public_api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAoD;AACpD,uEAAqD;AACrD,uEAAqD;AACrD,8EAA4D;AAC5D,qFAAmE;AACnE,oFAAkE;AAClE,oFAAkE;AAClE,+EAA6D;AAC7D,kEAAgD;AAChD,mEAAiD;AACjD,oFAAkE;AAClE,iFAA+D;AAC/D,gFAA8D;AAC9D,4EAA0D;AAC1D,oEAAkD;AAClD,yEAAuD;AACvD,0EAAwD;AACxD,gEAA8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kEAAgD;AAChD,6DAA2C;AAC3C,2DAAyC;AACzC,4DAA0C;AAC1C,2DAAyC;AACzC,gEAA8C;AAC9C,2DAAyC;AACzC,mDAAiC","file":"public_api.js","sourcesContent":["export * from './collections/app-status.collection';\nexport * from './collections/app-setting.collection';\nexport * from './ai/resolveio-platform-intelligence';\nexport * from './ai/resolveio-platform-intelligence-memory';\nexport * from './ai/resolveio-platform-intelligence-memory-corpus';\nexport * from './collections/ai-terminal-issue-report.collection';\nexport * from './collections/ai-terminal-conversation.collection';\nexport * from './collections/ai-terminal-message.collection';\nexport * from './collections/ai-run.collection';\nexport * from './collections/counter.collection';\nexport * from './collections/customer-portal-password.collection';\nexport * from './collections/customer-notification.collection';\nexport * from './collections/communication-metric.collection';\nexport * from './collections/cron-job-history.collection';\nexport * from './collections/cron-job.collection';\nexport * from './collections/email-history.collection';\nexport * from './collections/email-verified.collection';\nexport * from './collections/file.collection';\nexport * from './collections/flag-update.collection';\nexport * from './collections/flag.collection';\nexport * from './collections/log-method-latency.collection';\nexport * from './collections/log-subscription.collection';\nexport * from './collections/log.collection';\nexport * from './collections/logged-in-users.collection';\nexport * from './collections/monitor-cpu.collection';\nexport * from './collections/monitor-function.collection';\nexport * from './collections/monitor-memory.collection';\nexport * from './collections/monitor-mongo.collection';\nexport * from './collections/notification.collection';\nexport * from './collections/openai-usage-ledger.collection';\nexport * from './collections/report-builder-library.collection';\nexport * from './collections/report-builder-report.collection';\nexport * from './collections/user-group.collection';\nexport * from './collections/user-guide.collection';\nexport * from './collections/user.collection';\nexport * from './managers/mongo.manager';\nexport * from './managers/error-auto-fix.manager';\nexport * from './managers/ai-run-evidence.manager';\nexport * from './managers/ai-assistant-codex-manager.manager';\nexport * from './managers/slow-query-verifier.manager';\nexport * from './managers/slow-query.manager';\nexport * from './managers/customer-notification-content.manager';\nexport * from './managers/diagnostic-manager-bootstrap';\nexport * from './models/app-status.model';\nexport * from './models/app-setting.model';\nexport * from './models/ai-terminal-issue-report.model';\nexport * from './models/ai-terminal-conversation.model';\nexport * from './models/ai-terminal-message.model';\nexport * from './models/ai-run.model';\nexport * from './models/billing-logged-in-users.model';\nexport * from './models/collection-document.model';\nexport * from './models/communication-metric.model';\nexport * from './models/counter.model';\nexport * from './models/customer-portal-password.model';\nexport * from './models/customer-notification.model';\nexport * from './models/cron-job-history.model';\nexport * from './models/cron-job.model';\nexport * from './models/dialog.model';\nexport * from './models/email-history.model';\nexport * from './models/email-verified.model';\nexport * from './models/file.model';\nexport * from './models/flag-update.model';\nexport * from './models/flag.model';\nexport * from './models/log-method-latency.model';\nexport * from './models/log-subscription.model';\nexport * from './models/log.model';\nexport * from './models/logged-in-users.model';\nexport * from './models/method-response.model';\nexport * from './models/method.model';\nexport * from './models/monitor-cpu.model';\nexport * from './models/monitor-memory.model';\nexport * from './models/monitor-mongo.model';\nexport * from './models/notification.model';\nexport * from './models/openai-usage-ledger.model';\nexport * from './models/pagination.model';\nexport * from './models/permission.model';\nexport * from './models/report-builder-library.model';\nexport * from './models/report-builder-report.model';\nexport * from './models/report-builder.model';\nexport * from './models/select-data-label.model';\nexport * from './models/server-message.model';\nexport * from './models/subscription.model';\nexport * from './models/support-ticket.model';\nexport * from './models/user-group.model';\nexport * from './models/user-guide.model';\nexport * from './models/user.model';\nexport * from './types/error-report';\nexport * from './types/slow-query-report';\nexport * from './managers/openai-usage-ledger.manager';\nexport * from './managers/communication-metric.manager';\nexport * from './resolveio-server-app';\nexport * from './services/openai-client';\nexport * from './services/codex-client';\nexport * from './util/common';\nexport * from './util/customer-portal-password';\nexport * from './util/ai-qa-policy';\nexport * from './util/ai-run-evidence';\nexport * from './util/ai-run-evidence-adapters';\nexport * from './util/ai-run-evidence-dashboard';\nexport * from './util/ai-run-evidence-eval';\nexport * from './util/ai-runner-manager-policy';\nexport * from './util/ai-runner-artifacts';\nexport * from './util/ai-runner-qa-auth';\nexport * from './util/ai-runner-qa-tools';\nexport * from './util/aicoder-runner-v6';\nexport * from './util/runner-process-janitor';\nexport * from './util/support-runner-v5';\nexport * from './util/tokenizer';\n"]}
1
+ {"version":3,"sources":["../../src/public_api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sEAAoD;AACpD,uEAAqD;AACrD,uEAAqD;AACrD,8EAA4D;AAC5D,qFAAmE;AACnE,oFAAkE;AAClE,oFAAkE;AAClE,+EAA6D;AAC7D,kEAAgD;AAChD,mEAAiD;AACjD,oFAAkE;AAClE,iFAA+D;AAC/D,gFAA8D;AAC9D,4EAA0D;AAC1D,oEAAkD;AAClD,yEAAuD;AACvD,0EAAwD;AACxD,gEAA8C;AAC9C,uEAAqD;AACrD,gEAA8C;AAC9C,8EAA4D;AAC5D,4EAA0D;AAC1D,+DAA6C;AAC7C,2EAAyD;AACzD,uEAAqD;AACrD,4EAA0D;AAC1D,0EAAwD;AACxD,yEAAuD;AACvD,wEAAsD;AACtD,+EAA6D;AAC7D,kFAAgE;AAChE,iFAA+D;AAC/D,sEAAoD;AACpD,sEAAoD;AACpD,gEAA8C;AAC9C,2DAAyC;AACzC,oEAAkD;AAClD,qEAAmD;AACnD,gFAA8D;AAC9D,yEAAuD;AACvD,gEAA8C;AAC9C,mFAAiE;AACjE,0EAAwD;AACxD,4DAA0C;AAC1C,6DAA2C;AAC3C,0EAAwD;AACxD,0EAAwD;AACxD,qEAAmD;AACnD,wDAAsC;AACtC,yEAAuD;AACvD,qEAAmD;AACnD,sEAAoD;AACpD,yDAAuC;AACvC,0EAAwD;AACxD,uEAAqD;AACrD,kEAAgD;AAChD,0DAAwC;AACxC,wDAAsC;AACtC,+DAA6C;AAC7C,gEAA8C;AAC9C,sDAAoC;AACpC,6DAA2C;AAC3C,sDAAoC;AACpC,oEAAkD;AAClD,kEAAgD;AAChD,qDAAmC;AACnC,iEAA+C;AAC/C,iEAA+C;AAC/C,wDAAsC;AACtC,6DAA2C;AAC3C,gEAA8C;AAC9C,+DAA6C;AAC7C,8DAA4C;AAC5C,qEAAmD;AACnD,4DAA0C;AAC1C,4DAA0C;AAC1C,wEAAsD;AACtD,uEAAqD;AACrD,gEAA8C;AAC9C,mEAAiD;AACjD,gEAA8C;AAC9C,8DAA4C;AAC5C,gEAA8C;AAC9C,4DAA0C;AAC1C,4DAA0C;AAC1C,sDAAoC;AACpC,uDAAqC;AACrC,4DAA0C;AAC1C,yEAAuD;AACvD,0EAAwD;AACxD,yDAAuC;AACvC,2DAAyC;AACzC,0DAAwC;AACxC,gDAA8B;AAC9B,kEAAgD;AAChD,sDAAoC;AACpC,yDAAuC;AACvC,kEAAgD;AAChD,mEAAiD;AACjD,8DAA4C;AAC5C,qEAAmD;AACnD,kEAAgD;AAChD,6DAA2C;AAC3C,2DAAyC;AACzC,4DAA0C;AAC1C,2DAAyC;AACzC,gEAA8C;AAC9C,2DAAyC;AACzC,mDAAiC","file":"public_api.js","sourcesContent":["export * from './collections/app-status.collection';\nexport * from './collections/app-setting.collection';\nexport * from './ai/resolveio-platform-intelligence';\nexport * from './ai/resolveio-platform-intelligence-memory';\nexport * from './ai/resolveio-platform-intelligence-memory-corpus';\nexport * from './collections/ai-terminal-issue-report.collection';\nexport * from './collections/ai-terminal-conversation.collection';\nexport * from './collections/ai-terminal-message.collection';\nexport * from './collections/ai-run.collection';\nexport * from './collections/counter.collection';\nexport * from './collections/customer-portal-password.collection';\nexport * from './collections/customer-notification.collection';\nexport * from './collections/communication-metric.collection';\nexport * from './collections/cron-job-history.collection';\nexport * from './collections/cron-job.collection';\nexport * from './collections/email-history.collection';\nexport * from './collections/email-verified.collection';\nexport * from './collections/file.collection';\nexport * from './collections/flag-update.collection';\nexport * from './collections/flag.collection';\nexport * from './collections/log-method-latency.collection';\nexport * from './collections/log-subscription.collection';\nexport * from './collections/log.collection';\nexport * from './collections/logged-in-users.collection';\nexport * from './collections/monitor-cpu.collection';\nexport * from './collections/monitor-function.collection';\nexport * from './collections/monitor-memory.collection';\nexport * from './collections/monitor-mongo.collection';\nexport * from './collections/notification.collection';\nexport * from './collections/openai-usage-ledger.collection';\nexport * from './collections/report-builder-library.collection';\nexport * from './collections/report-builder-report.collection';\nexport * from './collections/user-group.collection';\nexport * from './collections/user-guide.collection';\nexport * from './collections/user.collection';\nexport * from './managers/mongo.manager';\nexport * from './managers/error-auto-fix.manager';\nexport * from './managers/ai-run-evidence.manager';\nexport * from './managers/ai-assistant-codex-manager.manager';\nexport * from './managers/slow-query-verifier.manager';\nexport * from './managers/slow-query.manager';\nexport * from './managers/customer-notification-content.manager';\nexport * from './managers/diagnostic-manager-bootstrap';\nexport * from './models/app-status.model';\nexport * from './models/app-setting.model';\nexport * from './models/ai-terminal-issue-report.model';\nexport * from './models/ai-terminal-conversation.model';\nexport * from './models/ai-terminal-message.model';\nexport * from './models/ai-run.model';\nexport * from './models/billing-logged-in-users.model';\nexport * from './models/collection-document.model';\nexport * from './models/communication-metric.model';\nexport * from './models/counter.model';\nexport * from './models/customer-portal-password.model';\nexport * from './models/customer-notification.model';\nexport * from './models/cron-job-history.model';\nexport * from './models/cron-job.model';\nexport * from './models/dialog.model';\nexport * from './models/email-history.model';\nexport * from './models/email-verified.model';\nexport * from './models/file.model';\nexport * from './models/flag-update.model';\nexport * from './models/flag.model';\nexport * from './models/log-method-latency.model';\nexport * from './models/log-subscription.model';\nexport * from './models/log.model';\nexport * from './models/logged-in-users.model';\nexport * from './models/method-response.model';\nexport * from './models/method.model';\nexport * from './models/monitor-cpu.model';\nexport * from './models/monitor-memory.model';\nexport * from './models/monitor-mongo.model';\nexport * from './models/notification.model';\nexport * from './models/openai-usage-ledger.model';\nexport * from './models/pagination.model';\nexport * from './models/permission.model';\nexport * from './models/report-builder-library.model';\nexport * from './models/report-builder-report.model';\nexport * from './models/report-builder.model';\nexport * from './models/select-data-label.model';\nexport * from './models/server-message.model';\nexport * from './models/subscription.model';\nexport * from './models/support-ticket.model';\nexport * from './models/user-group.model';\nexport * from './models/user-guide.model';\nexport * from './models/user.model';\nexport * from './types/error-report';\nexport * from './types/slow-query-report';\nexport * from './managers/openai-usage-ledger.manager';\nexport * from './managers/communication-metric.manager';\nexport * from './resolveio-server-app';\nexport * from './services/openai-client';\nexport * from './services/codex-client';\nexport * from './util/common';\nexport * from './util/customer-portal-password';\nexport * from './util/ai-qa-policy';\nexport * from './util/ai-run-evidence';\nexport * from './util/ai-run-evidence-adapters';\nexport * from './util/ai-run-evidence-dashboard';\nexport * from './util/ai-run-evidence-eval';\nexport * from './util/ai-runner-manager-autopilot';\nexport * from './util/ai-runner-manager-policy';\nexport * from './util/ai-runner-artifacts';\nexport * from './util/ai-runner-qa-auth';\nexport * from './util/ai-runner-qa-tools';\nexport * from './util/aicoder-runner-v6';\nexport * from './util/runner-process-janitor';\nexport * from './util/support-runner-v5';\nexport * from './util/tokenizer';\n"]}
@@ -0,0 +1,92 @@
1
+ import { ResolveIOAIManagerFailureRecord, ResolveIOAIManagerRecoveryActionDispatchRecord, ResolveIOAIManagerRecoveryActionPacket, ResolveIOAIManagerRecoveryCheckpoint, ResolveIOAIManagerRecoveryExecutionDirective, ResolveIOAIManagerRecoveryEvidenceProbe, ResolveIOAIManagerRecoveryPlan } from './ai-runner-manager-policy';
2
+ export type ResolveIOAIManagerAutopilotSafetyLevel = 'low' | 'medium' | 'high' | 'blocked';
3
+ export interface ResolveIOAIManagerAutopilotRecommendedAction {
4
+ action: string;
5
+ label: string;
6
+ reason: string;
7
+ safety: ResolveIOAIManagerAutopilotSafetyLevel;
8
+ enabled: boolean;
9
+ autoRunnable: boolean;
10
+ expectedResult: string;
11
+ requiresNewEvidence: boolean;
12
+ canRunProductRepair: boolean;
13
+ canRunExpensiveModel: boolean;
14
+ canResetLoopAfterEvidence: boolean;
15
+ dispatchAction?: string;
16
+ }
17
+ export interface ResolveIOAIManagerAutopilotLoopGuard {
18
+ state: 'clear' | 'collecting_evidence' | 'parked' | 'manual_handoff' | 'complete';
19
+ blocked: boolean;
20
+ reason: string;
21
+ failureClass: string;
22
+ blocker: string;
23
+ blockerFingerprint: string;
24
+ evidenceHash: string;
25
+ sameEvidenceDispatchCount: number;
26
+ sameEvidenceAlreadyAttempted: boolean;
27
+ loopCount: number;
28
+ maxLoopCount: number;
29
+ attempts: number;
30
+ maxAttemptsBeforePark: number;
31
+ canResetLoopAfterEvidence: boolean;
32
+ resetRequires: string[];
33
+ }
34
+ export interface ResolveIOAIManagerAutopilotSnapshot {
35
+ surface: string;
36
+ runId: string;
37
+ title: string;
38
+ status: string;
39
+ phase: string;
40
+ lane: string;
41
+ stepType: string;
42
+ runKind: string;
43
+ recommendedAction: ResolveIOAIManagerAutopilotRecommendedAction;
44
+ loopGuard: ResolveIOAIManagerAutopilotLoopGuard;
45
+ recovery: {
46
+ checkpointId: string;
47
+ recoveryClass: string;
48
+ dispatchAction: string;
49
+ directiveAllowed: boolean;
50
+ evidenceOnly: boolean;
51
+ productRepairAllowed: boolean;
52
+ expensiveModelAllowed: boolean;
53
+ requiredArtifacts: string[];
54
+ nextCommands: string[];
55
+ successCriteria: string[];
56
+ forbiddenActions: string[];
57
+ };
58
+ cost: {
59
+ currentRunUsd: number;
60
+ totalUsd: number;
61
+ currentRunTokens: number;
62
+ totalTokens: number;
63
+ untrackedWarning: string;
64
+ };
65
+ updatedAt: string;
66
+ }
67
+ export interface ResolveIOAIManagerAutopilotSnapshotInput {
68
+ surface: string;
69
+ runId?: string;
70
+ title?: string;
71
+ status?: string;
72
+ phase?: string;
73
+ lane?: string;
74
+ stepType?: string;
75
+ runKind?: string;
76
+ current?: ResolveIOAIManagerFailureRecord;
77
+ recoveryPlan?: ResolveIOAIManagerRecoveryPlan;
78
+ recoveryCheckpoint?: ResolveIOAIManagerRecoveryCheckpoint;
79
+ recoveryEvidenceProbe?: ResolveIOAIManagerRecoveryEvidenceProbe;
80
+ recoveryAction?: ResolveIOAIManagerRecoveryActionPacket;
81
+ recoveryDirective?: ResolveIOAIManagerRecoveryExecutionDirective;
82
+ recoveryDispatchHistory?: ResolveIOAIManagerRecoveryActionDispatchRecord[];
83
+ loopCount?: number;
84
+ maxLoopCount?: number;
85
+ currentRunUsd?: number;
86
+ totalUsd?: number;
87
+ currentRunTokens?: number;
88
+ totalTokens?: number;
89
+ untrackedCostWarning?: string;
90
+ updatedAt?: Date | string;
91
+ }
92
+ export declare function buildResolveIOAIManagerAutopilotSnapshot(input: ResolveIOAIManagerAutopilotSnapshotInput): ResolveIOAIManagerAutopilotSnapshot;
@@ -0,0 +1,281 @@
1
+ "use strict";
2
+ var __values = (this && this.__values) || function(o) {
3
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
4
+ if (m) return m.call(o);
5
+ if (o && typeof o.length === "number") return {
6
+ next: function () {
7
+ if (o && i >= o.length) o = void 0;
8
+ return { value: o && o[i++], done: !o };
9
+ }
10
+ };
11
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.buildResolveIOAIManagerAutopilotSnapshot = buildResolveIOAIManagerAutopilotSnapshot;
15
+ function cleanText(value, max) {
16
+ if (max === void 0) { max = 1000; }
17
+ return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
18
+ }
19
+ function cleanList(value, limit, max) {
20
+ var e_1, _a;
21
+ if (limit === void 0) { limit = 20; }
22
+ if (max === void 0) { max = 500; }
23
+ var raw = Array.isArray(value) ? value : [];
24
+ var output = [];
25
+ try {
26
+ for (var raw_1 = __values(raw), raw_1_1 = raw_1.next(); !raw_1_1.done; raw_1_1 = raw_1.next()) {
27
+ var entry = raw_1_1.value;
28
+ var cleaned = cleanText(entry, max);
29
+ if (cleaned && !output.includes(cleaned)) {
30
+ output.push(cleaned);
31
+ }
32
+ if (output.length >= limit) {
33
+ break;
34
+ }
35
+ }
36
+ }
37
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
38
+ finally {
39
+ try {
40
+ if (raw_1_1 && !raw_1_1.done && (_a = raw_1.return)) _a.call(raw_1);
41
+ }
42
+ finally { if (e_1) throw e_1.error; }
43
+ }
44
+ return output;
45
+ }
46
+ function cleanNumber(value) {
47
+ var parsed = Number(value);
48
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
49
+ }
50
+ function isoNow(value) {
51
+ if (value instanceof Date) {
52
+ return value.toISOString();
53
+ }
54
+ var parsed = value ? new Date(value) : new Date();
55
+ return Number.isFinite(parsed.getTime()) ? parsed.toISOString() : new Date().toISOString();
56
+ }
57
+ function defaultLabelForAction(action) {
58
+ switch (action) {
59
+ case 'run_evidence_probe':
60
+ return 'Collect New Evidence';
61
+ case 'run_read_only_diagnosis':
62
+ return 'Run Diagnosis';
63
+ case 'run_infra_repair':
64
+ return 'Repair Infra';
65
+ case 'run_compile_repair':
66
+ return 'Repair Compile';
67
+ case 'run_journey_contract_repair':
68
+ return 'Repair Journey';
69
+ case 'run_business_assertion_repair':
70
+ return 'Repair Business Proof';
71
+ case 'run_release_repair':
72
+ return 'Repair Release';
73
+ case 'run_targeted_product_repair':
74
+ return 'Run Targeted Repair';
75
+ case 'advance':
76
+ return 'Advance';
77
+ case 'continue_gate':
78
+ return 'Continue Gate';
79
+ case 'park_manual':
80
+ return 'Attach New Evidence';
81
+ default:
82
+ return action ? cleanText(action.replace(/_/g, ' '), 120) : 'Review Manager State';
83
+ }
84
+ }
85
+ function expectedResultForAction(action, evidenceOnly) {
86
+ if (action === 'park_manual') {
87
+ return 'Runner stays parked until new evidence, operator approval, or a changed blocker is recorded.';
88
+ }
89
+ if (evidenceOnly || action === 'run_evidence_probe' || action === 'run_read_only_diagnosis') {
90
+ return 'Runner records a new artifact path or changed evidence hash before any more product repair.';
91
+ }
92
+ if (action === 'run_infra_repair' || action === 'run_compile_repair' || action === 'run_release_repair') {
93
+ return 'Runner repairs only the named deterministic gate and reruns that gate.';
94
+ }
95
+ if (action === 'run_targeted_product_repair') {
96
+ return 'Runner performs one bounded owner-scope repair and then returns to deterministic proof.';
97
+ }
98
+ return 'Runner advances only after the current gate has proof.';
99
+ }
100
+ function safetyFor(input) {
101
+ if (!input.enabled || input.action === 'park_manual') {
102
+ return 'blocked';
103
+ }
104
+ if (input.evidenceOnly || input.action === 'run_evidence_probe' || input.action === 'run_read_only_diagnosis') {
105
+ return 'low';
106
+ }
107
+ if (input.expensiveModelAllowed || input.action === 'run_targeted_product_repair') {
108
+ return 'high';
109
+ }
110
+ if (input.productRepairAllowed) {
111
+ return 'medium';
112
+ }
113
+ return 'medium';
114
+ }
115
+ function resolveDispatchAction(input) {
116
+ var _a, _b, _c;
117
+ var directiveAction = cleanText((_a = input.recoveryDirective) === null || _a === void 0 ? void 0 : _a.dispatchAction, 120);
118
+ if (directiveAction) {
119
+ return directiveAction;
120
+ }
121
+ var actionMode = cleanText((_b = input.recoveryAction) === null || _b === void 0 ? void 0 : _b.mode, 120);
122
+ switch (actionMode) {
123
+ case 'collect_evidence':
124
+ return 'run_evidence_probe';
125
+ case 'read_only_diagnosis':
126
+ return 'run_read_only_diagnosis';
127
+ case 'repair_infra':
128
+ return 'run_infra_repair';
129
+ case 'repair_compile':
130
+ return 'run_compile_repair';
131
+ case 'repair_journey_contract':
132
+ return 'run_journey_contract_repair';
133
+ case 'repair_business_assertion':
134
+ return 'run_business_assertion_repair';
135
+ case 'repair_release':
136
+ return 'run_release_repair';
137
+ case 'targeted_product_repair':
138
+ return 'run_targeted_product_repair';
139
+ case 'advance':
140
+ return 'advance';
141
+ case 'continue_gate':
142
+ return 'continue_gate';
143
+ case 'manual_review':
144
+ return 'park_manual';
145
+ default:
146
+ return ((_c = input.recoveryCheckpoint) === null || _c === void 0 ? void 0 : _c.status) === 'parked' ? 'run_evidence_probe' : 'continue_gate';
147
+ }
148
+ }
149
+ function countSameEvidenceDispatches(input, dispatchAction) {
150
+ var _a, _b, _c, _d, _e, _f, _g;
151
+ var checkpointId = cleanText(((_a = input.recoveryCheckpoint) === null || _a === void 0 ? void 0 : _a.checkpointId) || ((_b = input.recoveryAction) === null || _b === void 0 ? void 0 : _b.checkpointId), 160);
152
+ var actionId = cleanText((_c = input.recoveryAction) === null || _c === void 0 ? void 0 : _c.actionId, 160);
153
+ var evidenceHash = cleanText(((_d = input.current) === null || _d === void 0 ? void 0 : _d.evidenceHash) || ((_e = input.recoveryCheckpoint) === null || _e === void 0 ? void 0 : _e.evidenceHash), 160);
154
+ var blockerFingerprint = cleanText(((_f = input.current) === null || _f === void 0 ? void 0 : _f.blockerFingerprint) || ((_g = input.recoveryCheckpoint) === null || _g === void 0 ? void 0 : _g.blockerFingerprint), 160);
155
+ var history = Array.isArray(input.recoveryDispatchHistory) ? input.recoveryDispatchHistory : [];
156
+ return history.filter(function (entry) {
157
+ var sameCheckpoint = checkpointId && cleanText(entry === null || entry === void 0 ? void 0 : entry.checkpointId, 160) === checkpointId;
158
+ var sameAction = actionId && cleanText(entry === null || entry === void 0 ? void 0 : entry.actionId, 160) === actionId;
159
+ var sameEvidence = !evidenceHash || cleanText(entry === null || entry === void 0 ? void 0 : entry.evidenceHash, 160) === evidenceHash;
160
+ var sameBlocker = !blockerFingerprint || cleanText(entry === null || entry === void 0 ? void 0 : entry.blockerFingerprint, 160) === blockerFingerprint;
161
+ var sameDispatchAction = !dispatchAction
162
+ || dispatchAction === 'park_manual'
163
+ || cleanText(entry === null || entry === void 0 ? void 0 : entry.dispatchAction, 120) === dispatchAction
164
+ || cleanText(entry === null || entry === void 0 ? void 0 : entry.dispatchAction, 120) === 'park_manual';
165
+ return (sameCheckpoint || sameAction) && sameEvidence && sameBlocker && sameDispatchAction;
166
+ }).length;
167
+ }
168
+ function buildResolveIOAIManagerAutopilotSnapshot(input) {
169
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51;
170
+ var dispatchAction = resolveDispatchAction(input);
171
+ var directiveAllowed = input.recoveryDirective
172
+ ? input.recoveryDirective.allowed === true
173
+ : ((_a = input.recoveryAction) === null || _a === void 0 ? void 0 : _a.autoRunnable) === true;
174
+ var evidenceOnly = ((_b = input.recoveryDirective) === null || _b === void 0 ? void 0 : _b.evidenceOnly) === true
175
+ || ((_c = input.recoveryAction) === null || _c === void 0 ? void 0 : _c.evidenceOnly) === true
176
+ || ((_d = input.recoveryEvidenceProbe) === null || _d === void 0 ? void 0 : _d.evidenceOnly) === true
177
+ || ((_e = input.recoveryCheckpoint) === null || _e === void 0 ? void 0 : _e.status) === 'parked';
178
+ var productRepairAllowed = ((_l = (_j = (_g = (_f = input.recoveryDirective) === null || _f === void 0 ? void 0 : _f.canRunProductRepair) !== null && _g !== void 0 ? _g : (_h = input.recoveryDirective) === null || _h === void 0 ? void 0 : _h.productRepairAllowed) !== null && _j !== void 0 ? _j : (_k = input.recoveryAction) === null || _k === void 0 ? void 0 : _k.productRepairAllowed) !== null && _l !== void 0 ? _l : (_m = input.recoveryCheckpoint) === null || _m === void 0 ? void 0 : _m.productRepairAllowed) === true;
179
+ var expensiveModelAllowed = ((_t = (_r = (_p = (_o = input.recoveryDirective) === null || _o === void 0 ? void 0 : _o.canRunExpensiveModel) !== null && _p !== void 0 ? _p : (_q = input.recoveryDirective) === null || _q === void 0 ? void 0 : _q.expensiveModelAllowed) !== null && _r !== void 0 ? _r : (_s = input.recoveryAction) === null || _s === void 0 ? void 0 : _s.expensiveModelAllowed) !== null && _t !== void 0 ? _t : (_u = input.recoveryCheckpoint) === null || _u === void 0 ? void 0 : _u.expensiveModelAllowed) === true;
180
+ var requiresNewEvidence = ((_v = input.recoveryDirective) === null || _v === void 0 ? void 0 : _v.requiresNewEvidence) === true
181
+ || ((_x = (_w = input.recoveryAction) === null || _w === void 0 ? void 0 : _w.retryPolicy) === null || _x === void 0 ? void 0 : _x.requireNewEvidence) === true
182
+ || ((_y = input.recoveryCheckpoint) === null || _y === void 0 ? void 0 : _y.status) === 'parked';
183
+ var sameEvidenceDispatchCount = countSameEvidenceDispatches(input, dispatchAction);
184
+ var sameEvidenceAlreadyAttempted = requiresNewEvidence && sameEvidenceDispatchCount > 0 && ((_z = input.recoveryDirective) === null || _z === void 0 ? void 0 : _z.newEvidence) !== true;
185
+ var checkpointStatus = cleanText((_0 = input.recoveryCheckpoint) === null || _0 === void 0 ? void 0 : _0.status, 80);
186
+ var loopState = checkpointStatus === 'manual_handoff'
187
+ ? 'manual_handoff'
188
+ : checkpointStatus === 'complete'
189
+ ? 'complete'
190
+ : sameEvidenceAlreadyAttempted || ((_1 = input.recoveryDirective) === null || _1 === void 0 ? void 0 : _1.allowed) === false
191
+ ? 'parked'
192
+ : evidenceOnly && requiresNewEvidence
193
+ ? 'collecting_evidence'
194
+ : 'clear';
195
+ var enabled = directiveAllowed && !sameEvidenceAlreadyAttempted && loopState !== 'manual_handoff';
196
+ var recommendedAction = sameEvidenceAlreadyAttempted || ((_2 = input.recoveryDirective) === null || _2 === void 0 ? void 0 : _2.allowed) === false
197
+ ? 'park_manual'
198
+ : dispatchAction;
199
+ var label = cleanText(sameEvidenceAlreadyAttempted
200
+ ? 'Attach New Evidence'
201
+ : ((_3 = input.recoveryDirective) === null || _3 === void 0 ? void 0 : _3.nextActionLabel) || ((_4 = input.recoveryAction) === null || _4 === void 0 ? void 0 : _4.label) || defaultLabelForAction(recommendedAction), 140);
202
+ var reason = cleanText(sameEvidenceAlreadyAttempted
203
+ ? 'The same recovery action already ran against the same evidence; a new artifact path or changed evidence hash is required.'
204
+ : ((_5 = input.recoveryDirective) === null || _5 === void 0 ? void 0 : _5.reason) || ((_6 = input.recoveryAction) === null || _6 === void 0 ? void 0 : _6.blockedReason) || ((_7 = input.recoveryPlan) === null || _7 === void 0 ? void 0 : _7.objective) || ((_8 = input.current) === null || _8 === void 0 ? void 0 : _8.blocker) || 'Manager can continue the current gate.', 1000);
205
+ var canResetLoopAfterEvidence = ((_9 = input.recoveryDirective) === null || _9 === void 0 ? void 0 : _9.canResetLoopAfterEvidence) === true
206
+ || ((_10 = input.recoveryAction) === null || _10 === void 0 ? void 0 : _10.canResetLoopAfterEvidence) === true
207
+ || cleanList((_11 = input.recoveryCheckpoint) === null || _11 === void 0 ? void 0 : _11.loopResetEvidence, 20, 500).length > 0;
208
+ var resetRequires = cleanList(((_14 = (_13 = (_12 = input.recoveryAction) === null || _12 === void 0 ? void 0 : _12.retryPolicy) === null || _13 === void 0 ? void 0 : _13.resetLoopWhen) === null || _14 === void 0 ? void 0 : _14.length)
209
+ ? input.recoveryAction.retryPolicy.resetLoopWhen
210
+ : (_15 = input.recoveryCheckpoint) === null || _15 === void 0 ? void 0 : _15.loopResetEvidence, 20, 500);
211
+ return {
212
+ surface: cleanText(input.surface || 'unknown', 120),
213
+ runId: cleanText(input.runId, 160),
214
+ title: cleanText(input.title, 240),
215
+ status: cleanText(input.status || ((_16 = input.recoveryCheckpoint) === null || _16 === void 0 ? void 0 : _16.status), 80),
216
+ phase: cleanText(input.phase || ((_17 = input.recoveryDirective) === null || _17 === void 0 ? void 0 : _17.phase), 80),
217
+ lane: cleanText(input.lane || ((_18 = input.recoveryDirective) === null || _18 === void 0 ? void 0 : _18.lane) || ((_19 = input.recoveryCheckpoint) === null || _19 === void 0 ? void 0 : _19.lane) || ((_20 = input.current) === null || _20 === void 0 ? void 0 : _20.lane), 120),
218
+ stepType: cleanText(input.stepType || ((_21 = input.recoveryDirective) === null || _21 === void 0 ? void 0 : _21.stepType) || ((_22 = input.recoveryCheckpoint) === null || _22 === void 0 ? void 0 : _22.stepType) || ((_23 = input.current) === null || _23 === void 0 ? void 0 : _23.stepType), 120),
219
+ runKind: cleanText(input.runKind, 120),
220
+ recommendedAction: {
221
+ action: recommendedAction,
222
+ label: label,
223
+ reason: reason,
224
+ safety: safetyFor({
225
+ action: recommendedAction,
226
+ enabled: enabled,
227
+ evidenceOnly: evidenceOnly,
228
+ productRepairAllowed: productRepairAllowed,
229
+ expensiveModelAllowed: expensiveModelAllowed
230
+ }),
231
+ enabled: enabled,
232
+ autoRunnable: enabled && ((_24 = input.recoveryAction) === null || _24 === void 0 ? void 0 : _24.autoRunnable) !== false,
233
+ expectedResult: expectedResultForAction(recommendedAction, evidenceOnly),
234
+ requiresNewEvidence: requiresNewEvidence,
235
+ canRunProductRepair: enabled && productRepairAllowed,
236
+ canRunExpensiveModel: enabled && expensiveModelAllowed,
237
+ canResetLoopAfterEvidence: canResetLoopAfterEvidence,
238
+ dispatchAction: dispatchAction
239
+ },
240
+ loopGuard: {
241
+ state: loopState,
242
+ blocked: loopState === 'parked' || loopState === 'manual_handoff',
243
+ reason: reason,
244
+ failureClass: cleanText((_25 = input.current) === null || _25 === void 0 ? void 0 : _25.failureClass, 120),
245
+ blocker: cleanText(((_26 = input.current) === null || _26 === void 0 ? void 0 : _26.blocker) || ((_27 = input.current) === null || _27 === void 0 ? void 0 : _27.summary), 1000),
246
+ blockerFingerprint: cleanText(((_28 = input.current) === null || _28 === void 0 ? void 0 : _28.blockerFingerprint) || ((_29 = input.recoveryCheckpoint) === null || _29 === void 0 ? void 0 : _29.blockerFingerprint), 160),
247
+ evidenceHash: cleanText(((_30 = input.current) === null || _30 === void 0 ? void 0 : _30.evidenceHash) || ((_31 = input.recoveryCheckpoint) === null || _31 === void 0 ? void 0 : _31.evidenceHash), 160),
248
+ sameEvidenceDispatchCount: sameEvidenceDispatchCount,
249
+ sameEvidenceAlreadyAttempted: sameEvidenceAlreadyAttempted,
250
+ loopCount: cleanNumber(input.loopCount),
251
+ maxLoopCount: cleanNumber(input.maxLoopCount),
252
+ attempts: cleanNumber((_32 = input.recoveryCheckpoint) === null || _32 === void 0 ? void 0 : _32.attempts),
253
+ maxAttemptsBeforePark: cleanNumber((_33 = input.recoveryCheckpoint) === null || _33 === void 0 ? void 0 : _33.maxAttemptsBeforePark),
254
+ canResetLoopAfterEvidence: canResetLoopAfterEvidence,
255
+ resetRequires: resetRequires
256
+ },
257
+ recovery: {
258
+ checkpointId: cleanText(((_34 = input.recoveryCheckpoint) === null || _34 === void 0 ? void 0 : _34.checkpointId) || ((_35 = input.recoveryAction) === null || _35 === void 0 ? void 0 : _35.checkpointId), 160),
259
+ recoveryClass: cleanText(((_36 = input.recoveryCheckpoint) === null || _36 === void 0 ? void 0 : _36.recoveryClass) || ((_37 = input.recoveryAction) === null || _37 === void 0 ? void 0 : _37.recoveryClass) || ((_38 = input.recoveryPlan) === null || _38 === void 0 ? void 0 : _38.recoveryClass), 120),
260
+ dispatchAction: dispatchAction,
261
+ directiveAllowed: directiveAllowed,
262
+ evidenceOnly: evidenceOnly,
263
+ productRepairAllowed: productRepairAllowed,
264
+ expensiveModelAllowed: expensiveModelAllowed,
265
+ requiredArtifacts: cleanList(((_40 = (_39 = input.recoveryDirective) === null || _39 === void 0 ? void 0 : _39.requiredArtifacts) === null || _40 === void 0 ? void 0 : _40.length) ? input.recoveryDirective.requiredArtifacts : (_41 = input.recoveryAction) === null || _41 === void 0 ? void 0 : _41.requiredArtifacts, 20, 500),
266
+ nextCommands: cleanList(((_43 = (_42 = input.recoveryDirective) === null || _42 === void 0 ? void 0 : _42.nextCommands) === null || _43 === void 0 ? void 0 : _43.length) ? input.recoveryDirective.nextCommands : (_44 = input.recoveryAction) === null || _44 === void 0 ? void 0 : _44.nextCommands, 20, 500),
267
+ successCriteria: cleanList(((_46 = (_45 = input.recoveryDirective) === null || _45 === void 0 ? void 0 : _45.successCriteria) === null || _46 === void 0 ? void 0 : _46.length) ? input.recoveryDirective.successCriteria : (_47 = input.recoveryAction) === null || _47 === void 0 ? void 0 : _47.successCriteria, 20, 500),
268
+ forbiddenActions: cleanList(((_49 = (_48 = input.recoveryDirective) === null || _48 === void 0 ? void 0 : _48.forbiddenActions) === null || _49 === void 0 ? void 0 : _49.length) ? input.recoveryDirective.forbiddenActions : (_51 = (_50 = input.recoveryAction) === null || _50 === void 0 ? void 0 : _50.retryPolicy) === null || _51 === void 0 ? void 0 : _51.stopWhen, 20, 500)
269
+ },
270
+ cost: {
271
+ currentRunUsd: cleanNumber(input.currentRunUsd),
272
+ totalUsd: cleanNumber(input.totalUsd),
273
+ currentRunTokens: cleanNumber(input.currentRunTokens),
274
+ totalTokens: cleanNumber(input.totalTokens),
275
+ untrackedWarning: cleanText(input.untrackedCostWarning || 'Manual Codex sessions outside this runner are not included unless recorded in the usage ledger.', 500)
276
+ },
277
+ updatedAt: isoNow(input.updatedAt)
278
+ };
279
+ }
280
+
281
+ //# sourceMappingURL=ai-runner-manager-autopilot.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/util/ai-runner-manager-autopilot.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAiQA,4FA0HC;AAlRD,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,KAAU,EAAE,KAAU,EAAE,GAAS;;IAArB,sBAAA,EAAA,UAAU;IAAE,oBAAA,EAAA,SAAS;IACnD,IAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9C,IAAM,MAAM,GAAa,EAAE,CAAC;;QAC5B,KAAoB,IAAA,QAAA,SAAA,GAAG,CAAA,wBAAA,yCAAE,CAAC;YAArB,IAAM,KAAK,gBAAA;YACf,IAAM,OAAO,GAAG,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;YACtC,IAAI,OAAO,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACtB,CAAC;YACD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,EAAE,SAAS,CAAC,CAAA,OAAA,OAAA,KAAK,CAAC,iBAAiB,4CAAE,gBAAgB,4CAAE,MAAM,EAAC,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC,CAAC,OAAA,OAAA,KAAK,CAAC,cAAc,4CAAE,WAAW,4CAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,CAAC;SAChL;QACD,IAAI,EAAE;YACL,aAAa,EAAE,WAAW,CAAC,KAAK,CAAC,aAAa,CAAC;YAC/C,QAAQ,EAAE,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC;YACrC,gBAAgB,EAAE,WAAW,CAAC,KAAK,CAAC,gBAAgB,CAAC;YACrD,WAAW,EAAE,WAAW,CAAC,KAAK,CAAC,WAAW,CAAC;YAC3C,gBAAgB,EAAE,SAAS,CAAC,KAAK,CAAC,oBAAoB,IAAI,iGAAiG,EAAE,GAAG,CAAC;SACjK;QACD,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;KAClC,CAAC;AACH,CAAC","file":"ai-runner-manager-autopilot.js","sourcesContent":["import {\n\tResolveIOAIManagerFailureRecord,\n\tResolveIOAIManagerRecoveryActionDispatchRecord,\n\tResolveIOAIManagerRecoveryActionPacket,\n\tResolveIOAIManagerRecoveryCheckpoint,\n\tResolveIOAIManagerRecoveryExecutionDirective,\n\tResolveIOAIManagerRecoveryEvidenceProbe,\n\tResolveIOAIManagerRecoveryPlan\n} from './ai-runner-manager-policy';\n\nexport type ResolveIOAIManagerAutopilotSafetyLevel = 'low' | 'medium' | 'high' | 'blocked';\n\nexport interface ResolveIOAIManagerAutopilotRecommendedAction {\n\taction: string;\n\tlabel: string;\n\treason: string;\n\tsafety: ResolveIOAIManagerAutopilotSafetyLevel;\n\tenabled: boolean;\n\tautoRunnable: boolean;\n\texpectedResult: string;\n\trequiresNewEvidence: boolean;\n\tcanRunProductRepair: boolean;\n\tcanRunExpensiveModel: boolean;\n\tcanResetLoopAfterEvidence: boolean;\n\tdispatchAction?: string;\n}\n\nexport interface ResolveIOAIManagerAutopilotLoopGuard {\n\tstate: 'clear' | 'collecting_evidence' | 'parked' | 'manual_handoff' | 'complete';\n\tblocked: boolean;\n\treason: string;\n\tfailureClass: string;\n\tblocker: string;\n\tblockerFingerprint: string;\n\tevidenceHash: string;\n\tsameEvidenceDispatchCount: number;\n\tsameEvidenceAlreadyAttempted: boolean;\n\tloopCount: number;\n\tmaxLoopCount: number;\n\tattempts: number;\n\tmaxAttemptsBeforePark: number;\n\tcanResetLoopAfterEvidence: boolean;\n\tresetRequires: string[];\n}\n\nexport interface ResolveIOAIManagerAutopilotSnapshot {\n\tsurface: string;\n\trunId: string;\n\ttitle: string;\n\tstatus: string;\n\tphase: string;\n\tlane: string;\n\tstepType: string;\n\trunKind: string;\n\trecommendedAction: ResolveIOAIManagerAutopilotRecommendedAction;\n\tloopGuard: ResolveIOAIManagerAutopilotLoopGuard;\n\trecovery: {\n\t\tcheckpointId: string;\n\t\trecoveryClass: string;\n\t\tdispatchAction: string;\n\t\tdirectiveAllowed: boolean;\n\t\tevidenceOnly: boolean;\n\t\tproductRepairAllowed: boolean;\n\t\texpensiveModelAllowed: boolean;\n\t\trequiredArtifacts: string[];\n\t\tnextCommands: string[];\n\t\tsuccessCriteria: string[];\n\t\tforbiddenActions: string[];\n\t};\n\tcost: {\n\t\tcurrentRunUsd: number;\n\t\ttotalUsd: number;\n\t\tcurrentRunTokens: number;\n\t\ttotalTokens: number;\n\t\tuntrackedWarning: string;\n\t};\n\tupdatedAt: string;\n}\n\nexport interface ResolveIOAIManagerAutopilotSnapshotInput {\n\tsurface: string;\n\trunId?: string;\n\ttitle?: string;\n\tstatus?: string;\n\tphase?: string;\n\tlane?: string;\n\tstepType?: string;\n\trunKind?: string;\n\tcurrent?: ResolveIOAIManagerFailureRecord;\n\trecoveryPlan?: ResolveIOAIManagerRecoveryPlan;\n\trecoveryCheckpoint?: ResolveIOAIManagerRecoveryCheckpoint;\n\trecoveryEvidenceProbe?: ResolveIOAIManagerRecoveryEvidenceProbe;\n\trecoveryAction?: ResolveIOAIManagerRecoveryActionPacket;\n\trecoveryDirective?: ResolveIOAIManagerRecoveryExecutionDirective;\n\trecoveryDispatchHistory?: ResolveIOAIManagerRecoveryActionDispatchRecord[];\n\tloopCount?: number;\n\tmaxLoopCount?: number;\n\tcurrentRunUsd?: number;\n\ttotalUsd?: number;\n\tcurrentRunTokens?: number;\n\ttotalTokens?: number;\n\tuntrackedCostWarning?: string;\n\tupdatedAt?: Date | string;\n}\n\nfunction cleanText(value: any, max = 1000): string {\n\treturn String(value || '').replace(/\\s+/g, ' ').trim().slice(0, max);\n}\n\nfunction cleanList(value: any, limit = 20, max = 500): string[] {\n\tconst raw = Array.isArray(value) ? value : [];\n\tconst output: string[] = [];\n\tfor (const entry of raw) {\n\t\tconst cleaned = cleanText(entry, max);\n\t\tif (cleaned && !output.includes(cleaned)) {\n\t\t\toutput.push(cleaned);\n\t\t}\n\t\tif (output.length >= limit) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn output;\n}\n\nfunction cleanNumber(value: any): number {\n\tconst parsed = Number(value);\n\treturn Number.isFinite(parsed) && parsed > 0 ? parsed : 0;\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\treturn Number.isFinite(parsed.getTime()) ? parsed.toISOString() : new Date().toISOString();\n}\n\nfunction defaultLabelForAction(action: string): string {\n\tswitch (action) {\n\t\tcase 'run_evidence_probe':\n\t\t\treturn 'Collect New Evidence';\n\t\tcase 'run_read_only_diagnosis':\n\t\t\treturn 'Run Diagnosis';\n\t\tcase 'run_infra_repair':\n\t\t\treturn 'Repair Infra';\n\t\tcase 'run_compile_repair':\n\t\t\treturn 'Repair Compile';\n\t\tcase 'run_journey_contract_repair':\n\t\t\treturn 'Repair Journey';\n\t\tcase 'run_business_assertion_repair':\n\t\t\treturn 'Repair Business Proof';\n\t\tcase 'run_release_repair':\n\t\t\treturn 'Repair Release';\n\t\tcase 'run_targeted_product_repair':\n\t\t\treturn 'Run Targeted Repair';\n\t\tcase 'advance':\n\t\t\treturn 'Advance';\n\t\tcase 'continue_gate':\n\t\t\treturn 'Continue Gate';\n\t\tcase 'park_manual':\n\t\t\treturn 'Attach New Evidence';\n\t\tdefault:\n\t\t\treturn action ? cleanText(action.replace(/_/g, ' '), 120) : 'Review Manager State';\n\t}\n}\n\nfunction expectedResultForAction(action: string, evidenceOnly: boolean): string {\n\tif (action === 'park_manual') {\n\t\treturn 'Runner stays parked until new evidence, operator approval, or a changed blocker is recorded.';\n\t}\n\tif (evidenceOnly || action === 'run_evidence_probe' || action === 'run_read_only_diagnosis') {\n\t\treturn 'Runner records a new artifact path or changed evidence hash before any more product repair.';\n\t}\n\tif (action === 'run_infra_repair' || action === 'run_compile_repair' || action === 'run_release_repair') {\n\t\treturn 'Runner repairs only the named deterministic gate and reruns that gate.';\n\t}\n\tif (action === 'run_targeted_product_repair') {\n\t\treturn 'Runner performs one bounded owner-scope repair and then returns to deterministic proof.';\n\t}\n\treturn 'Runner advances only after the current gate has proof.';\n}\n\nfunction safetyFor(input: {\n\taction: string;\n\tenabled: boolean;\n\tevidenceOnly: boolean;\n\tproductRepairAllowed: boolean;\n\texpensiveModelAllowed: boolean;\n}): ResolveIOAIManagerAutopilotSafetyLevel {\n\tif (!input.enabled || input.action === 'park_manual') {\n\t\treturn 'blocked';\n\t}\n\tif (input.evidenceOnly || input.action === 'run_evidence_probe' || input.action === 'run_read_only_diagnosis') {\n\t\treturn 'low';\n\t}\n\tif (input.expensiveModelAllowed || input.action === 'run_targeted_product_repair') {\n\t\treturn 'high';\n\t}\n\tif (input.productRepairAllowed) {\n\t\treturn 'medium';\n\t}\n\treturn 'medium';\n}\n\nfunction resolveDispatchAction(input: ResolveIOAIManagerAutopilotSnapshotInput): string {\n\tconst directiveAction = cleanText(input.recoveryDirective?.dispatchAction, 120);\n\tif (directiveAction) {\n\t\treturn directiveAction;\n\t}\n\tconst actionMode = cleanText(input.recoveryAction?.mode, 120);\n\tswitch (actionMode) {\n\t\tcase 'collect_evidence':\n\t\t\treturn 'run_evidence_probe';\n\t\tcase 'read_only_diagnosis':\n\t\t\treturn 'run_read_only_diagnosis';\n\t\tcase 'repair_infra':\n\t\t\treturn 'run_infra_repair';\n\t\tcase 'repair_compile':\n\t\t\treturn 'run_compile_repair';\n\t\tcase 'repair_journey_contract':\n\t\t\treturn 'run_journey_contract_repair';\n\t\tcase 'repair_business_assertion':\n\t\t\treturn 'run_business_assertion_repair';\n\t\tcase 'repair_release':\n\t\t\treturn 'run_release_repair';\n\t\tcase 'targeted_product_repair':\n\t\t\treturn 'run_targeted_product_repair';\n\t\tcase 'advance':\n\t\t\treturn 'advance';\n\t\tcase 'continue_gate':\n\t\t\treturn 'continue_gate';\n\t\tcase 'manual_review':\n\t\t\treturn 'park_manual';\n\t\tdefault:\n\t\t\treturn input.recoveryCheckpoint?.status === 'parked' ? 'run_evidence_probe' : 'continue_gate';\n\t}\n}\n\nfunction countSameEvidenceDispatches(input: ResolveIOAIManagerAutopilotSnapshotInput, dispatchAction: string): number {\n\tconst checkpointId = cleanText(input.recoveryCheckpoint?.checkpointId || input.recoveryAction?.checkpointId, 160);\n\tconst actionId = cleanText(input.recoveryAction?.actionId, 160);\n\tconst evidenceHash = cleanText(input.current?.evidenceHash || input.recoveryCheckpoint?.evidenceHash, 160);\n\tconst blockerFingerprint = cleanText(input.current?.blockerFingerprint || input.recoveryCheckpoint?.blockerFingerprint, 160);\n\tconst history = Array.isArray(input.recoveryDispatchHistory) ? input.recoveryDispatchHistory : [];\n\treturn history.filter((entry) => {\n\t\tconst sameCheckpoint = checkpointId && cleanText(entry?.checkpointId, 160) === checkpointId;\n\t\tconst sameAction = actionId && cleanText(entry?.actionId, 160) === actionId;\n\t\tconst sameEvidence = !evidenceHash || cleanText(entry?.evidenceHash, 160) === evidenceHash;\n\t\tconst sameBlocker = !blockerFingerprint || cleanText(entry?.blockerFingerprint, 160) === blockerFingerprint;\n\t\tconst sameDispatchAction = !dispatchAction\n\t\t\t|| dispatchAction === 'park_manual'\n\t\t\t|| cleanText(entry?.dispatchAction, 120) === dispatchAction\n\t\t\t|| cleanText(entry?.dispatchAction, 120) === 'park_manual';\n\t\treturn (sameCheckpoint || sameAction) && sameEvidence && sameBlocker && sameDispatchAction;\n\t}).length;\n}\n\nexport function buildResolveIOAIManagerAutopilotSnapshot(\n\tinput: ResolveIOAIManagerAutopilotSnapshotInput\n): ResolveIOAIManagerAutopilotSnapshot {\n\tconst dispatchAction = resolveDispatchAction(input);\n\tconst directiveAllowed = input.recoveryDirective\n\t\t? input.recoveryDirective.allowed === true\n\t\t: input.recoveryAction?.autoRunnable === true;\n\tconst evidenceOnly = input.recoveryDirective?.evidenceOnly === true\n\t\t|| input.recoveryAction?.evidenceOnly === true\n\t\t|| input.recoveryEvidenceProbe?.evidenceOnly === true\n\t\t|| input.recoveryCheckpoint?.status === 'parked';\n\tconst productRepairAllowed = (input.recoveryDirective?.canRunProductRepair ?? input.recoveryDirective?.productRepairAllowed ?? input.recoveryAction?.productRepairAllowed ?? input.recoveryCheckpoint?.productRepairAllowed) === true;\n\tconst expensiveModelAllowed = (input.recoveryDirective?.canRunExpensiveModel ?? input.recoveryDirective?.expensiveModelAllowed ?? input.recoveryAction?.expensiveModelAllowed ?? input.recoveryCheckpoint?.expensiveModelAllowed) === true;\n\tconst requiresNewEvidence = input.recoveryDirective?.requiresNewEvidence === true\n\t\t|| input.recoveryAction?.retryPolicy?.requireNewEvidence === true\n\t\t|| input.recoveryCheckpoint?.status === 'parked';\n\tconst sameEvidenceDispatchCount = countSameEvidenceDispatches(input, dispatchAction);\n\tconst sameEvidenceAlreadyAttempted = requiresNewEvidence && sameEvidenceDispatchCount > 0 && input.recoveryDirective?.newEvidence !== true;\n\tconst checkpointStatus = cleanText(input.recoveryCheckpoint?.status, 80);\n\tconst loopState = checkpointStatus === 'manual_handoff'\n\t\t? 'manual_handoff'\n\t\t: checkpointStatus === 'complete'\n\t\t\t? 'complete'\n\t\t\t: sameEvidenceAlreadyAttempted || input.recoveryDirective?.allowed === false\n\t\t\t\t? 'parked'\n\t\t\t\t: evidenceOnly && requiresNewEvidence\n\t\t\t\t\t? 'collecting_evidence'\n\t\t\t\t\t: 'clear';\n\tconst enabled = directiveAllowed && !sameEvidenceAlreadyAttempted && loopState !== 'manual_handoff';\n\tconst recommendedAction = sameEvidenceAlreadyAttempted || input.recoveryDirective?.allowed === false\n\t\t? 'park_manual'\n\t\t: dispatchAction;\n\tconst label = cleanText(\n\t\tsameEvidenceAlreadyAttempted\n\t\t\t? 'Attach New Evidence'\n\t\t\t: input.recoveryDirective?.nextActionLabel || input.recoveryAction?.label || defaultLabelForAction(recommendedAction),\n\t\t140\n\t);\n\tconst reason = cleanText(\n\t\tsameEvidenceAlreadyAttempted\n\t\t\t? 'The same recovery action already ran against the same evidence; a new artifact path or changed evidence hash is required.'\n\t\t\t: input.recoveryDirective?.reason || input.recoveryAction?.blockedReason || input.recoveryPlan?.objective || input.current?.blocker || 'Manager can continue the current gate.',\n\t\t1000\n\t);\n\tconst canResetLoopAfterEvidence = input.recoveryDirective?.canResetLoopAfterEvidence === true\n\t\t|| input.recoveryAction?.canResetLoopAfterEvidence === true\n\t\t|| cleanList(input.recoveryCheckpoint?.loopResetEvidence, 20, 500).length > 0;\n\tconst resetRequires = cleanList(\n\t\tinput.recoveryAction?.retryPolicy?.resetLoopWhen?.length\n\t\t\t? input.recoveryAction.retryPolicy.resetLoopWhen\n\t\t\t: input.recoveryCheckpoint?.loopResetEvidence,\n\t\t20,\n\t\t500\n\t);\n\treturn {\n\t\tsurface: cleanText(input.surface || 'unknown', 120),\n\t\trunId: cleanText(input.runId, 160),\n\t\ttitle: cleanText(input.title, 240),\n\t\tstatus: cleanText(input.status || input.recoveryCheckpoint?.status, 80),\n\t\tphase: cleanText(input.phase || input.recoveryDirective?.phase, 80),\n\t\tlane: cleanText(input.lane || input.recoveryDirective?.lane || input.recoveryCheckpoint?.lane || input.current?.lane, 120),\n\t\tstepType: cleanText(input.stepType || input.recoveryDirective?.stepType || input.recoveryCheckpoint?.stepType || input.current?.stepType, 120),\n\t\trunKind: cleanText(input.runKind, 120),\n\t\trecommendedAction: {\n\t\t\taction: recommendedAction,\n\t\t\tlabel,\n\t\t\treason,\n\t\t\tsafety: safetyFor({\n\t\t\t\taction: recommendedAction,\n\t\t\t\tenabled,\n\t\t\t\tevidenceOnly,\n\t\t\t\tproductRepairAllowed,\n\t\t\t\texpensiveModelAllowed\n\t\t\t}),\n\t\t\tenabled,\n\t\t\tautoRunnable: enabled && input.recoveryAction?.autoRunnable !== false,\n\t\t\texpectedResult: expectedResultForAction(recommendedAction, evidenceOnly),\n\t\t\trequiresNewEvidence,\n\t\t\tcanRunProductRepair: enabled && productRepairAllowed,\n\t\t\tcanRunExpensiveModel: enabled && expensiveModelAllowed,\n\t\t\tcanResetLoopAfterEvidence,\n\t\t\tdispatchAction\n\t\t},\n\t\tloopGuard: {\n\t\t\tstate: loopState,\n\t\t\tblocked: loopState === 'parked' || loopState === 'manual_handoff',\n\t\t\treason,\n\t\t\tfailureClass: cleanText(input.current?.failureClass, 120),\n\t\t\tblocker: cleanText(input.current?.blocker || input.current?.summary, 1000),\n\t\t\tblockerFingerprint: cleanText(input.current?.blockerFingerprint || input.recoveryCheckpoint?.blockerFingerprint, 160),\n\t\t\tevidenceHash: cleanText(input.current?.evidenceHash || input.recoveryCheckpoint?.evidenceHash, 160),\n\t\t\tsameEvidenceDispatchCount,\n\t\t\tsameEvidenceAlreadyAttempted,\n\t\t\tloopCount: cleanNumber(input.loopCount),\n\t\t\tmaxLoopCount: cleanNumber(input.maxLoopCount),\n\t\t\tattempts: cleanNumber(input.recoveryCheckpoint?.attempts),\n\t\t\tmaxAttemptsBeforePark: cleanNumber(input.recoveryCheckpoint?.maxAttemptsBeforePark),\n\t\t\tcanResetLoopAfterEvidence,\n\t\t\tresetRequires\n\t\t},\n\t\trecovery: {\n\t\t\tcheckpointId: cleanText(input.recoveryCheckpoint?.checkpointId || input.recoveryAction?.checkpointId, 160),\n\t\t\trecoveryClass: cleanText(input.recoveryCheckpoint?.recoveryClass || input.recoveryAction?.recoveryClass || input.recoveryPlan?.recoveryClass, 120),\n\t\t\tdispatchAction,\n\t\t\tdirectiveAllowed,\n\t\t\tevidenceOnly,\n\t\t\tproductRepairAllowed,\n\t\t\texpensiveModelAllowed,\n\t\t\trequiredArtifacts: cleanList(input.recoveryDirective?.requiredArtifacts?.length ? input.recoveryDirective.requiredArtifacts : input.recoveryAction?.requiredArtifacts, 20, 500),\n\t\t\tnextCommands: cleanList(input.recoveryDirective?.nextCommands?.length ? input.recoveryDirective.nextCommands : input.recoveryAction?.nextCommands, 20, 500),\n\t\t\tsuccessCriteria: cleanList(input.recoveryDirective?.successCriteria?.length ? input.recoveryDirective.successCriteria : input.recoveryAction?.successCriteria, 20, 500),\n\t\t\tforbiddenActions: cleanList(input.recoveryDirective?.forbiddenActions?.length ? input.recoveryDirective.forbiddenActions : input.recoveryAction?.retryPolicy?.stopWhen, 20, 500)\n\t\t},\n\t\tcost: {\n\t\t\tcurrentRunUsd: cleanNumber(input.currentRunUsd),\n\t\t\ttotalUsd: cleanNumber(input.totalUsd),\n\t\t\tcurrentRunTokens: cleanNumber(input.currentRunTokens),\n\t\t\ttotalTokens: cleanNumber(input.totalTokens),\n\t\t\tuntrackedWarning: cleanText(input.untrackedCostWarning || 'Manual Codex sessions outside this runner are not included unless recorded in the usage ledger.', 500)\n\t\t},\n\t\tupdatedAt: isoNow(input.updatedAt)\n\t};\n}\n"]}
@@ -153,6 +153,43 @@ export interface ResolveIOAIManagerRecoveryActionDispatchDecision {
153
153
  newEvidence: boolean;
154
154
  dispatchRecord?: ResolveIOAIManagerRecoveryActionDispatchRecord;
155
155
  }
156
+ export type ResolveIOAIManagerRecoveryExecutionPhase = 'evidence' | 'diagnosis' | 'infra' | 'compile' | 'journey' | 'business_proof' | 'release' | 'product_repair' | 'advance' | 'manual';
157
+ export interface ResolveIOAIManagerRecoveryExecutionDirectiveInput {
158
+ action?: ResolveIOAIManagerRecoveryActionPacket;
159
+ dispatchDecision?: ResolveIOAIManagerRecoveryActionDispatchDecision;
160
+ current?: ResolveIOAIManagerFailureRecord;
161
+ surface?: string;
162
+ now?: Date | string;
163
+ }
164
+ export interface ResolveIOAIManagerRecoveryExecutionDirective {
165
+ directiveId: string;
166
+ surface: string;
167
+ dispatchAction: ResolveIOAIManagerRecoveryActionDispatchAction;
168
+ phase: ResolveIOAIManagerRecoveryExecutionPhase;
169
+ allowed: boolean;
170
+ status: ResolveIOAIManagerRecoveryActionDispatchStatus;
171
+ reason: string;
172
+ lane: string;
173
+ stepType: string;
174
+ nextActionLabel: string;
175
+ rerunReason: string;
176
+ evidenceOnly: boolean;
177
+ autoRunnable: boolean;
178
+ productRepairAllowed: boolean;
179
+ expensiveModelAllowed: boolean;
180
+ canRunProductRepair: boolean;
181
+ canRunExpensiveModel: boolean;
182
+ canResetLoopAfterEvidence: boolean;
183
+ requiresNewEvidence: boolean;
184
+ newEvidence: boolean;
185
+ maxAttemptsBeforePark: number;
186
+ requiredArtifacts: string[];
187
+ nextCommands: string[];
188
+ successCriteria: string[];
189
+ forbiddenActions: string[];
190
+ dispatchRecord?: ResolveIOAIManagerRecoveryActionDispatchRecord;
191
+ createdAt: string;
192
+ }
156
193
  export interface ResolveIOAIManagerRecoveryCheckpointInput {
157
194
  plan: ResolveIOAIManagerRecoveryPlan;
158
195
  current?: ResolveIOAIManagerFailureRecord;
@@ -239,6 +276,7 @@ export declare function buildResolveIOAIManagerRecoveryEvidenceProbe(input: Reso
239
276
  export declare function buildResolveIOAIManagerRecoveryActionPacket(input: ResolveIOAIManagerRecoveryActionPacketInput): ResolveIOAIManagerRecoveryActionPacket;
240
277
  export declare function decideResolveIOAIManagerRecoveryActionDispatch(input: ResolveIOAIManagerRecoveryActionDispatchInput): ResolveIOAIManagerRecoveryActionDispatchDecision;
241
278
  export declare function appendResolveIOAIManagerRecoveryActionDispatch(history: ResolveIOAIManagerRecoveryActionDispatchRecord[] | undefined, record: ResolveIOAIManagerRecoveryActionDispatchRecord | undefined, limit?: number): ResolveIOAIManagerRecoveryActionDispatchRecord[];
279
+ export declare function buildResolveIOAIManagerRecoveryExecutionDirective(input: ResolveIOAIManagerRecoveryExecutionDirectiveInput): ResolveIOAIManagerRecoveryExecutionDirective;
242
280
  export declare function decideResolveIOAIManagerRecoveryGate(input: ResolveIOAIManagerRecoveryGateInput): ResolveIOAIManagerRecoveryGateDecision;
243
281
  export declare function buildResolveIOAIManagerRecoveryPlan(input?: ResolveIOAIManagerRecoveryPlanInput): ResolveIOAIManagerRecoveryPlan;
244
282
  export declare function decideResolveIOAIManagerPolicy(input: ResolveIOAIManagerPolicyInput): ResolveIOAIManagerPolicyDecision;
@@ -55,6 +55,7 @@ exports.buildResolveIOAIManagerRecoveryEvidenceProbe = buildResolveIOAIManagerRe
55
55
  exports.buildResolveIOAIManagerRecoveryActionPacket = buildResolveIOAIManagerRecoveryActionPacket;
56
56
  exports.decideResolveIOAIManagerRecoveryActionDispatch = decideResolveIOAIManagerRecoveryActionDispatch;
57
57
  exports.appendResolveIOAIManagerRecoveryActionDispatch = appendResolveIOAIManagerRecoveryActionDispatch;
58
+ exports.buildResolveIOAIManagerRecoveryExecutionDirective = buildResolveIOAIManagerRecoveryExecutionDirective;
58
59
  exports.decideResolveIOAIManagerRecoveryGate = decideResolveIOAIManagerRecoveryGate;
59
60
  exports.buildResolveIOAIManagerRecoveryPlan = buildResolveIOAIManagerRecoveryPlan;
60
61
  exports.decideResolveIOAIManagerPolicy = decideResolveIOAIManagerPolicy;
@@ -562,6 +563,59 @@ function appendResolveIOAIManagerRecoveryActionDispatch(history, record, limit)
562
563
  var deduped = existing.filter(function (entry) { return entry.dispatchId !== record.dispatchId; });
563
564
  return __spreadArray(__spreadArray([], __read(deduped), false), [record], false).slice(-limit);
564
565
  }
566
+ function recoveryExecutionPhaseForDispatch(dispatchAction) {
567
+ var map = {
568
+ run_evidence_probe: 'evidence',
569
+ run_read_only_diagnosis: 'diagnosis',
570
+ run_infra_repair: 'infra',
571
+ run_compile_repair: 'compile',
572
+ run_journey_contract_repair: 'journey',
573
+ run_business_assertion_repair: 'business_proof',
574
+ run_release_repair: 'release',
575
+ run_targeted_product_repair: 'product_repair',
576
+ advance: 'advance',
577
+ continue_gate: 'advance',
578
+ park_manual: 'manual'
579
+ };
580
+ return map[dispatchAction] || 'manual';
581
+ }
582
+ function recoveryDirectiveReason(action, decision, current) {
583
+ var blocker = cleanText((current === null || current === void 0 ? void 0 : current.blocker) || (current === null || current === void 0 ? void 0 : current.summary) || '', 260);
584
+ var label = cleanText(action === null || action === void 0 ? void 0 : action.label, 120) || decision.dispatchAction;
585
+ var objective = cleanText(action === null || action === void 0 ? void 0 : action.objective, 260);
586
+ return [
587
+ "MANAGER_RECOVERY:".concat(decision.dispatchAction),
588
+ "label=".concat(label),
589
+ decision.reason ? "reason=".concat(decision.reason) : '',
590
+ blocker ? "blocker=".concat(blocker) : '',
591
+ objective ? "objective=".concat(objective) : ''
592
+ ].filter(Boolean).join(' | ');
593
+ }
594
+ function buildResolveIOAIManagerRecoveryExecutionDirective(input) {
595
+ var _a, _b, _c, _d;
596
+ var action = input.action;
597
+ var dispatchDecision = input.dispatchDecision || decideResolveIOAIManagerRecoveryActionDispatch({
598
+ action: action,
599
+ current: input.current,
600
+ now: input.now
601
+ });
602
+ var dispatchAction = dispatchDecision.dispatchAction;
603
+ var now = isoNow(input.now);
604
+ var phase = recoveryExecutionPhaseForDispatch(dispatchAction);
605
+ var lane = cleanText((action === null || action === void 0 ? void 0 : action.lane) || ((_a = input.current) === null || _a === void 0 ? void 0 : _a.lane) || '', 120);
606
+ var stepType = cleanText((action === null || action === void 0 ? void 0 : action.stepType) || ((_b = input.current) === null || _b === void 0 ? void 0 : _b.stepType) || '', 120);
607
+ var rerunReason = recoveryDirectiveReason(action, dispatchDecision, input.current);
608
+ var surface = cleanText(input.surface || 'runner', 120);
609
+ return __assign(__assign({ directiveId: stableHash('mgr-directive', {
610
+ surface: surface,
611
+ actionId: (action === null || action === void 0 ? void 0 : action.actionId) || '',
612
+ dispatchAction: dispatchAction,
613
+ reason: dispatchDecision.reason,
614
+ evidenceHash: ((_c = dispatchDecision.dispatchRecord) === null || _c === void 0 ? void 0 : _c.evidenceHash) || ((_d = input.current) === null || _d === void 0 ? void 0 : _d.evidenceHash) || ''
615
+ }), surface: surface, dispatchAction: dispatchAction, phase: phase, allowed: dispatchDecision.allowed, status: dispatchDecision.status, reason: dispatchDecision.reason, lane: lane, stepType: stepType, nextActionLabel: cleanText(action === null || action === void 0 ? void 0 : action.label, 160) || dispatchAction, rerunReason: rerunReason, evidenceOnly: (action === null || action === void 0 ? void 0 : action.evidenceOnly) !== false || dispatchAction === 'run_evidence_probe', autoRunnable: (action === null || action === void 0 ? void 0 : action.autoRunnable) === true, productRepairAllowed: (action === null || action === void 0 ? void 0 : action.productRepairAllowed) === true, expensiveModelAllowed: (action === null || action === void 0 ? void 0 : action.expensiveModelAllowed) === true, canRunProductRepair: dispatchDecision.canRunProductRepair, canRunExpensiveModel: dispatchDecision.canRunExpensiveModel, canResetLoopAfterEvidence: (action === null || action === void 0 ? void 0 : action.canResetLoopAfterEvidence) === true, requiresNewEvidence: dispatchDecision.requiresNewEvidence, newEvidence: dispatchDecision.newEvidence, maxAttemptsBeforePark: Math.max(1, Number((action === null || action === void 0 ? void 0 : action.maxAttemptsBeforePark) || 1) || 1), requiredArtifacts: cleanList(action === null || action === void 0 ? void 0 : action.requiredArtifacts, 20, 500), nextCommands: cleanList(action === null || action === void 0 ? void 0 : action.nextCommands, 20, 500), successCriteria: cleanList(action === null || action === void 0 ? void 0 : action.successCriteria, 20, 500), forbiddenActions: (action === null || action === void 0 ? void 0 : action.productRepairAllowed) === true
616
+ ? []
617
+ : ['Do not run product-code repair from this directive unless canRunProductRepair is true.'] }, (dispatchDecision.dispatchRecord ? { dispatchRecord: dispatchDecision.dispatchRecord } : {})), { createdAt: now });
618
+ }
565
619
  function listHasNewEntry(current, previous) {
566
620
  var existing = new Set(previous.map(function (entry) { return cleanText(entry, 500); }).filter(Boolean));
567
621
  return current.some(function (entry) {