@akagilnc/pi-workflow-roles 0.1.4977 → 0.1.4980
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/acp-host/production-host.js +22 -6
- package/dist/audit-escalation.js +15 -0
- package/dist/gatekeeper-role.js +2 -2
- package/dist/headless-host/production-host.js +22 -6
- package/dist/public-cli/main.js +5 -1
- package/dist/public-cli/settlement.js +4 -1
- package/dist/submission-ledger.js +2 -0
- package/package.json +1 -1
- package/src/audit-escalation.ts +21 -1
- package/src/gatekeeper-role.ts +2 -2
- package/src/judge-role.ts +2 -2
- package/src/public-cli/settlement.ts +5 -1
- package/src/submission-ledger.ts +5 -0
- package/src/worker-role.ts +3 -3
|
@@ -13493,7 +13493,8 @@ __export(audit_escalation_exports, {
|
|
|
13493
13493
|
disposeComplianceDecision: () => disposeComplianceDecision,
|
|
13494
13494
|
isAuditEscalationProjection: () => isAuditEscalationProjection,
|
|
13495
13495
|
isAuditEscalationResult: () => isAuditEscalationResult,
|
|
13496
|
-
projectAuditEscalation: () => projectAuditEscalation
|
|
13496
|
+
projectAuditEscalation: () => projectAuditEscalation,
|
|
13497
|
+
projectGatekeeperEscalation: () => projectGatekeeperEscalation
|
|
13497
13498
|
});
|
|
13498
13499
|
function buildAuditEscalationResult(decision, deliveredOutput) {
|
|
13499
13500
|
const auditOwned = {
|
|
@@ -13538,6 +13539,16 @@ function projectAuditEscalation(decision, deliveredOutput) {
|
|
|
13538
13539
|
...decision.usage === void 0 ? {} : { usage: decision.usage }
|
|
13539
13540
|
};
|
|
13540
13541
|
}
|
|
13542
|
+
function projectGatekeeperEscalation(result, deliveredOutput) {
|
|
13543
|
+
const receipt = result.receipt;
|
|
13544
|
+
const record4 = receipt !== null && typeof receipt === "object" && !Array.isArray(receipt) ? receipt : void 0;
|
|
13545
|
+
return projectAuditEscalation({
|
|
13546
|
+
status: "escalate",
|
|
13547
|
+
officer: result.officer,
|
|
13548
|
+
conflicts: receipt,
|
|
13549
|
+
...record4 !== void 0 && Object.hasOwn(record4, "decisionGate") ? { decisionGate: record4.decisionGate } : {}
|
|
13550
|
+
}, deliveredOutput);
|
|
13551
|
+
}
|
|
13541
13552
|
function isAuditEscalationResult(value) {
|
|
13542
13553
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
13543
13554
|
return false;
|
|
@@ -13701,6 +13712,7 @@ function rowFromPayload(kind, payload, accepted, roleFallback) {
|
|
|
13701
13712
|
kind,
|
|
13702
13713
|
accepted,
|
|
13703
13714
|
...Object.hasOwn(payload, "auditReceipt") ? { auditReceipt: payload.auditReceipt } : {},
|
|
13715
|
+
...Object.hasOwn(payload, "auditOfficer") ? { auditOfficer: payload.auditOfficer } : {},
|
|
13704
13716
|
...typeof payload.toolCallId === "string" && payload.toolCallId.length > 0 ? { toolCallId: payload.toolCallId } : {}
|
|
13705
13717
|
};
|
|
13706
13718
|
}
|
|
@@ -13978,7 +13990,8 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
13978
13990
|
outcome: "audit-escalation",
|
|
13979
13991
|
role,
|
|
13980
13992
|
accepted: params,
|
|
13981
|
-
...audit !== void 0 && (Object.hasOwn(audit, "receipt") || Object.hasOwn(audit, "conflicts")) ? { auditReceipt: Object.hasOwn(audit, "receipt") ? audit.receipt : audit.conflicts } : {}
|
|
13993
|
+
...audit !== void 0 && (Object.hasOwn(audit, "receipt") || Object.hasOwn(audit, "conflicts")) ? { auditReceipt: Object.hasOwn(audit, "receipt") ? audit.receipt : audit.conflicts } : {},
|
|
13994
|
+
...audit !== void 0 && Object.hasOwn(audit, "officer") ? { auditOfficer: audit.officer } : {}
|
|
13982
13995
|
});
|
|
13983
13996
|
await projectClosure(closed2, context);
|
|
13984
13997
|
return result;
|
|
@@ -15100,7 +15113,10 @@ function roleOutcomeFromRows(role, rows) {
|
|
|
15100
15113
|
role,
|
|
15101
15114
|
status: "audit_escalation",
|
|
15102
15115
|
payloads,
|
|
15103
|
-
...audited === void 0 ? {} : { decisiveFacts: {
|
|
15116
|
+
...audited === void 0 ? {} : { decisiveFacts: {
|
|
15117
|
+
auditEscalationReceipt: audited.auditReceipt,
|
|
15118
|
+
...Object.hasOwn(audited, "auditOfficer") ? { auditEscalationOfficer: audited.auditOfficer } : {}
|
|
15119
|
+
} }
|
|
15104
15120
|
};
|
|
15105
15121
|
}
|
|
15106
15122
|
return { kind: "accepted", role, payloads };
|
|
@@ -26100,7 +26116,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26100
26116
|
};
|
|
26101
26117
|
} catch (error) {
|
|
26102
26118
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
26103
|
-
return
|
|
26119
|
+
return projectGatekeeperEscalation(error.result, verdict);
|
|
26104
26120
|
}
|
|
26105
26121
|
throw error;
|
|
26106
26122
|
}
|
|
@@ -26624,7 +26640,7 @@ function createFixerRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26624
26640
|
}) : void 0;
|
|
26625
26641
|
} catch (error) {
|
|
26626
26642
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
26627
|
-
return
|
|
26643
|
+
return projectGatekeeperEscalation(error.result, output);
|
|
26628
26644
|
}
|
|
26629
26645
|
throw error;
|
|
26630
26646
|
}
|
|
@@ -26768,7 +26784,7 @@ function createCoderRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26768
26784
|
}) : void 0;
|
|
26769
26785
|
} catch (error) {
|
|
26770
26786
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
26771
|
-
return
|
|
26787
|
+
return projectGatekeeperEscalation(error.result, output);
|
|
26772
26788
|
}
|
|
26773
26789
|
throw error;
|
|
26774
26790
|
}
|
package/dist/audit-escalation.js
CHANGED
|
@@ -58,6 +58,21 @@ export function projectAuditEscalation(decision, deliveredOutput) {
|
|
|
58
58
|
...(decision.usage === undefined ? {} : { usage: decision.usage }),
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
|
+
/** Preserve the escalating officer's own gate alongside the raw receipt. */
|
|
62
|
+
export function projectGatekeeperEscalation(result, deliveredOutput) {
|
|
63
|
+
const receipt = result.receipt;
|
|
64
|
+
const record = receipt !== null && typeof receipt === "object" && !Array.isArray(receipt)
|
|
65
|
+
? receipt
|
|
66
|
+
: undefined;
|
|
67
|
+
return projectAuditEscalation({
|
|
68
|
+
status: "escalate",
|
|
69
|
+
officer: result.officer,
|
|
70
|
+
conflicts: receipt,
|
|
71
|
+
...(record !== undefined && Object.hasOwn(record, "decisionGate")
|
|
72
|
+
? { decisionGate: record.decisionGate }
|
|
73
|
+
: {}),
|
|
74
|
+
}, deliveredOutput);
|
|
75
|
+
}
|
|
61
76
|
/**
|
|
62
77
|
* Discriminator-only recognition (ADR 0040). Shape of conflicts/options/gate
|
|
63
78
|
* is not a reject gate — element types and cardinality are delivery content.
|
package/dist/gatekeeper-role.js
CHANGED
|
@@ -221,8 +221,8 @@ function projectOfficerTerminal(officer, summoned) {
|
|
|
221
221
|
}
|
|
222
222
|
if (outcome.kind === "accepted") {
|
|
223
223
|
// outcome.status is the fixture/compat leaf: production settlement leaves
|
|
224
|
-
// it undefined once payloads are recorded
|
|
225
|
-
//
|
|
224
|
+
// it undefined once payloads are recorded. It may interpret a receipt
|
|
225
|
+
// lacking its own status, never substitute for a missing receipt.
|
|
226
226
|
return withOfficerRunId(projectOfficerPayloads(officer, thisCourt, outcome.status), summoned);
|
|
227
227
|
}
|
|
228
228
|
return withOfficerRunId({
|
|
@@ -12955,7 +12955,8 @@ __export(audit_escalation_exports, {
|
|
|
12955
12955
|
disposeComplianceDecision: () => disposeComplianceDecision,
|
|
12956
12956
|
isAuditEscalationProjection: () => isAuditEscalationProjection,
|
|
12957
12957
|
isAuditEscalationResult: () => isAuditEscalationResult,
|
|
12958
|
-
projectAuditEscalation: () => projectAuditEscalation
|
|
12958
|
+
projectAuditEscalation: () => projectAuditEscalation,
|
|
12959
|
+
projectGatekeeperEscalation: () => projectGatekeeperEscalation
|
|
12959
12960
|
});
|
|
12960
12961
|
function buildAuditEscalationResult(decision, deliveredOutput) {
|
|
12961
12962
|
const auditOwned = {
|
|
@@ -13000,6 +13001,16 @@ function projectAuditEscalation(decision, deliveredOutput) {
|
|
|
13000
13001
|
...decision.usage === void 0 ? {} : { usage: decision.usage }
|
|
13001
13002
|
};
|
|
13002
13003
|
}
|
|
13004
|
+
function projectGatekeeperEscalation(result, deliveredOutput) {
|
|
13005
|
+
const receipt = result.receipt;
|
|
13006
|
+
const record4 = receipt !== null && typeof receipt === "object" && !Array.isArray(receipt) ? receipt : void 0;
|
|
13007
|
+
return projectAuditEscalation({
|
|
13008
|
+
status: "escalate",
|
|
13009
|
+
officer: result.officer,
|
|
13010
|
+
conflicts: receipt,
|
|
13011
|
+
...record4 !== void 0 && Object.hasOwn(record4, "decisionGate") ? { decisionGate: record4.decisionGate } : {}
|
|
13012
|
+
}, deliveredOutput);
|
|
13013
|
+
}
|
|
13003
13014
|
function isAuditEscalationResult(value) {
|
|
13004
13015
|
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
13005
13016
|
return false;
|
|
@@ -13163,6 +13174,7 @@ function rowFromPayload(kind, payload, accepted, roleFallback) {
|
|
|
13163
13174
|
kind,
|
|
13164
13175
|
accepted,
|
|
13165
13176
|
...Object.hasOwn(payload, "auditReceipt") ? { auditReceipt: payload.auditReceipt } : {},
|
|
13177
|
+
...Object.hasOwn(payload, "auditOfficer") ? { auditOfficer: payload.auditOfficer } : {},
|
|
13166
13178
|
...typeof payload.toolCallId === "string" && payload.toolCallId.length > 0 ? { toolCallId: payload.toolCallId } : {}
|
|
13167
13179
|
};
|
|
13168
13180
|
}
|
|
@@ -13440,7 +13452,8 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
13440
13452
|
outcome: "audit-escalation",
|
|
13441
13453
|
role,
|
|
13442
13454
|
accepted: params,
|
|
13443
|
-
...audit !== void 0 && (Object.hasOwn(audit, "receipt") || Object.hasOwn(audit, "conflicts")) ? { auditReceipt: Object.hasOwn(audit, "receipt") ? audit.receipt : audit.conflicts } : {}
|
|
13455
|
+
...audit !== void 0 && (Object.hasOwn(audit, "receipt") || Object.hasOwn(audit, "conflicts")) ? { auditReceipt: Object.hasOwn(audit, "receipt") ? audit.receipt : audit.conflicts } : {},
|
|
13456
|
+
...audit !== void 0 && Object.hasOwn(audit, "officer") ? { auditOfficer: audit.officer } : {}
|
|
13444
13457
|
});
|
|
13445
13458
|
await projectClosure(closed2, context);
|
|
13446
13459
|
return result;
|
|
@@ -14562,7 +14575,10 @@ function roleOutcomeFromRows(role, rows) {
|
|
|
14562
14575
|
role,
|
|
14563
14576
|
status: "audit_escalation",
|
|
14564
14577
|
payloads,
|
|
14565
|
-
...audited === void 0 ? {} : { decisiveFacts: {
|
|
14578
|
+
...audited === void 0 ? {} : { decisiveFacts: {
|
|
14579
|
+
auditEscalationReceipt: audited.auditReceipt,
|
|
14580
|
+
...Object.hasOwn(audited, "auditOfficer") ? { auditEscalationOfficer: audited.auditOfficer } : {}
|
|
14581
|
+
} }
|
|
14566
14582
|
};
|
|
14567
14583
|
}
|
|
14568
14584
|
return { kind: "accepted", role, payloads };
|
|
@@ -26058,7 +26074,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26058
26074
|
};
|
|
26059
26075
|
} catch (error) {
|
|
26060
26076
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
26061
|
-
return
|
|
26077
|
+
return projectGatekeeperEscalation(error.result, verdict);
|
|
26062
26078
|
}
|
|
26063
26079
|
throw error;
|
|
26064
26080
|
}
|
|
@@ -26582,7 +26598,7 @@ function createFixerRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26582
26598
|
}) : void 0;
|
|
26583
26599
|
} catch (error) {
|
|
26584
26600
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
26585
|
-
return
|
|
26601
|
+
return projectGatekeeperEscalation(error.result, output);
|
|
26586
26602
|
}
|
|
26587
26603
|
throw error;
|
|
26588
26604
|
}
|
|
@@ -26726,7 +26742,7 @@ function createCoderRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26726
26742
|
}) : void 0;
|
|
26727
26743
|
} catch (error) {
|
|
26728
26744
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
26729
|
-
return
|
|
26745
|
+
return projectGatekeeperEscalation(error.result, output);
|
|
26730
26746
|
}
|
|
26731
26747
|
throw error;
|
|
26732
26748
|
}
|
package/dist/public-cli/main.js
CHANGED
|
@@ -23611,6 +23611,7 @@ function rowFromPayload(kind, payload, accepted, roleFallback) {
|
|
|
23611
23611
|
kind,
|
|
23612
23612
|
accepted,
|
|
23613
23613
|
...Object.hasOwn(payload, "auditReceipt") ? { auditReceipt: payload.auditReceipt } : {},
|
|
23614
|
+
...Object.hasOwn(payload, "auditOfficer") ? { auditOfficer: payload.auditOfficer } : {},
|
|
23614
23615
|
...typeof payload.toolCallId === "string" && payload.toolCallId.length > 0 ? { toolCallId: payload.toolCallId } : {}
|
|
23615
23616
|
};
|
|
23616
23617
|
}
|
|
@@ -24689,7 +24690,10 @@ function roleOutcomeFromRows(role, rows) {
|
|
|
24689
24690
|
role,
|
|
24690
24691
|
status: "audit_escalation",
|
|
24691
24692
|
payloads,
|
|
24692
|
-
...audited === void 0 ? {} : { decisiveFacts: {
|
|
24693
|
+
...audited === void 0 ? {} : { decisiveFacts: {
|
|
24694
|
+
auditEscalationReceipt: audited.auditReceipt,
|
|
24695
|
+
...Object.hasOwn(audited, "auditOfficer") ? { auditEscalationOfficer: audited.auditOfficer } : {}
|
|
24696
|
+
} }
|
|
24693
24697
|
};
|
|
24694
24698
|
}
|
|
24695
24699
|
return { kind: "accepted", role, payloads };
|
|
@@ -60,7 +60,10 @@ function roleOutcomeFromRows(role, rows) {
|
|
|
60
60
|
const audited = terminal.slice().reverse().find((row) => row.kind === "audit-escalation" && Object.hasOwn(row, "auditReceipt"));
|
|
61
61
|
return {
|
|
62
62
|
kind: "audit_escalation", role, status: "audit_escalation", payloads,
|
|
63
|
-
...(audited === undefined ? {} : { decisiveFacts: {
|
|
63
|
+
...(audited === undefined ? {} : { decisiveFacts: {
|
|
64
|
+
auditEscalationReceipt: audited.auditReceipt,
|
|
65
|
+
...(Object.hasOwn(audited, "auditOfficer") ? { auditEscalationOfficer: audited.auditOfficer } : {}),
|
|
66
|
+
} }),
|
|
64
67
|
};
|
|
65
68
|
}
|
|
66
69
|
return { kind: "accepted", role, payloads };
|
|
@@ -161,6 +161,7 @@ function rowFromPayload(kind, payload, accepted, roleFallback) {
|
|
|
161
161
|
kind,
|
|
162
162
|
accepted,
|
|
163
163
|
...(Object.hasOwn(payload, "auditReceipt") ? { auditReceipt: payload.auditReceipt } : {}),
|
|
164
|
+
...(Object.hasOwn(payload, "auditOfficer") ? { auditOfficer: payload.auditOfficer } : {}),
|
|
164
165
|
...(typeof payload.toolCallId === "string" && payload.toolCallId.length > 0
|
|
165
166
|
? { toolCallId: payload.toolCallId }
|
|
166
167
|
: {}),
|
|
@@ -526,6 +527,7 @@ export function createSubmissionLedgerHost(host, outputTools, failInfrastructure
|
|
|
526
527
|
...(audit !== undefined && (Object.hasOwn(audit, "receipt") || Object.hasOwn(audit, "conflicts"))
|
|
527
528
|
? { auditReceipt: Object.hasOwn(audit, "receipt") ? audit.receipt : audit.conflicts }
|
|
528
529
|
: {}),
|
|
530
|
+
...(audit !== undefined && Object.hasOwn(audit, "officer") ? { auditOfficer: audit.officer } : {}),
|
|
529
531
|
});
|
|
530
532
|
await projectClosure(closed, context);
|
|
531
533
|
return result;
|
package/package.json
CHANGED
package/src/audit-escalation.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type {
|
|
|
4
4
|
ComplianceDecision,
|
|
5
5
|
} from "./compliance-transport.ts";
|
|
6
6
|
import { GatekeeperDecisionError } from "./submission-errors.ts";
|
|
7
|
+
import type { GatekeeperNonPassResult } from "./gatekeeper-role.ts";
|
|
7
8
|
|
|
8
9
|
export const AUDIT_ESCALATION_KIND = "audit_escalation" as const;
|
|
9
10
|
|
|
@@ -37,7 +38,7 @@ export type AuditEscalationToolResult = {
|
|
|
37
38
|
|
|
38
39
|
export type OfficerAuditEscalationDecision = {
|
|
39
40
|
readonly status: "escalate";
|
|
40
|
-
readonly officer?: "inspector" | "notary" | "countersign";
|
|
41
|
+
readonly officer?: "inspector" | "notary" | "auditor" | "countersign";
|
|
41
42
|
readonly reason?: unknown;
|
|
42
43
|
readonly findings?: unknown;
|
|
43
44
|
readonly conflicts?: unknown;
|
|
@@ -113,6 +114,25 @@ export function projectAuditEscalation(
|
|
|
113
114
|
};
|
|
114
115
|
}
|
|
115
116
|
|
|
117
|
+
/** Preserve the escalating officer's own gate alongside the raw receipt. */
|
|
118
|
+
export function projectGatekeeperEscalation(
|
|
119
|
+
result: Extract<GatekeeperNonPassResult, { status: "escalate" }>,
|
|
120
|
+
deliveredOutput?: unknown,
|
|
121
|
+
): AuditEscalationToolResult {
|
|
122
|
+
const receipt = result.receipt;
|
|
123
|
+
const record = receipt !== null && typeof receipt === "object" && !Array.isArray(receipt)
|
|
124
|
+
? receipt as Record<string, unknown>
|
|
125
|
+
: undefined;
|
|
126
|
+
return projectAuditEscalation({
|
|
127
|
+
status: "escalate",
|
|
128
|
+
officer: result.officer,
|
|
129
|
+
conflicts: receipt,
|
|
130
|
+
...(record !== undefined && Object.hasOwn(record, "decisionGate")
|
|
131
|
+
? { decisionGate: record.decisionGate }
|
|
132
|
+
: {}),
|
|
133
|
+
}, deliveredOutput);
|
|
134
|
+
}
|
|
135
|
+
|
|
116
136
|
/**
|
|
117
137
|
* Discriminator-only recognition (ADR 0040). Shape of conflicts/options/gate
|
|
118
138
|
* is not a reject gate — element types and cardinality are delivery content.
|
package/src/gatekeeper-role.ts
CHANGED
|
@@ -382,8 +382,8 @@ function projectOfficerTerminal(
|
|
|
382
382
|
}
|
|
383
383
|
if (outcome.kind === "accepted") {
|
|
384
384
|
// outcome.status is the fixture/compat leaf: production settlement leaves
|
|
385
|
-
// it undefined once payloads are recorded
|
|
386
|
-
//
|
|
385
|
+
// it undefined once payloads are recorded. It may interpret a receipt
|
|
386
|
+
// lacking its own status, never substitute for a missing receipt.
|
|
387
387
|
return withOfficerRunId(
|
|
388
388
|
projectOfficerPayloads(officer, thisCourt, outcome.status),
|
|
389
389
|
summoned,
|
package/src/judge-role.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { Type, type Static } from "typebox";
|
|
|
3
3
|
|
|
4
4
|
import { withTerminatingOutputDeclarations } from "./package-contracts/terminating-infrastructure.ts";
|
|
5
5
|
import { GatekeeperDecisionError, ParentQueueReaskError } from "./submission-errors.ts";
|
|
6
|
-
import {
|
|
6
|
+
import { projectGatekeeperEscalation } from "./audit-escalation.ts";
|
|
7
7
|
|
|
8
8
|
import { readableGateItem } from "./readable-gate-item.ts";
|
|
9
9
|
import {
|
|
@@ -152,7 +152,7 @@ export function createJudgeRoleRuntime(
|
|
|
152
152
|
};
|
|
153
153
|
} catch (error) {
|
|
154
154
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
155
|
-
return
|
|
155
|
+
return projectGatekeeperEscalation(error.result, verdict);
|
|
156
156
|
}
|
|
157
157
|
throw error;
|
|
158
158
|
}
|
|
@@ -170,6 +170,7 @@ function roleOutcomeFromRows(
|
|
|
170
170
|
readonly kind: "accepted" | "audit-escalation" | "correctable-rejection" | "infrastructure" | "candidate";
|
|
171
171
|
readonly accepted: unknown;
|
|
172
172
|
readonly auditReceipt?: unknown;
|
|
173
|
+
readonly auditOfficer?: unknown;
|
|
173
174
|
}[],
|
|
174
175
|
): Extract<TerminalRoleOutcome, { kind: "accepted" | "audit_escalation" }> | undefined {
|
|
175
176
|
const mine = rows.filter((row) => row.role === role);
|
|
@@ -185,7 +186,10 @@ function roleOutcomeFromRows(
|
|
|
185
186
|
const audited = terminal.slice().reverse().find((row) => row.kind === "audit-escalation" && Object.hasOwn(row, "auditReceipt"));
|
|
186
187
|
return {
|
|
187
188
|
kind: "audit_escalation", role, status: "audit_escalation", payloads,
|
|
188
|
-
...(audited === undefined ? {} : { decisiveFacts: {
|
|
189
|
+
...(audited === undefined ? {} : { decisiveFacts: {
|
|
190
|
+
auditEscalationReceipt: audited.auditReceipt,
|
|
191
|
+
...(Object.hasOwn(audited, "auditOfficer") ? { auditEscalationOfficer: audited.auditOfficer } : {}),
|
|
192
|
+
} }),
|
|
189
193
|
};
|
|
190
194
|
}
|
|
191
195
|
return { kind: "accepted", role, payloads };
|
package/src/submission-ledger.ts
CHANGED
|
@@ -52,6 +52,7 @@ export type SubmissionLedgerEvent =
|
|
|
52
52
|
readonly accepted?: unknown;
|
|
53
53
|
/** Audit-owned escalation verdict, separate from the original role submission. */
|
|
54
54
|
readonly auditReceipt?: unknown;
|
|
55
|
+
readonly auditOfficer?: unknown;
|
|
55
56
|
}
|
|
56
57
|
| {
|
|
57
58
|
readonly type: "sealed";
|
|
@@ -105,6 +106,7 @@ export type RecordedSubmissionRow = {
|
|
|
105
106
|
readonly kind: "accepted" | "audit-escalation" | "correctable-rejection" | "infrastructure" | "candidate";
|
|
106
107
|
readonly accepted: unknown;
|
|
107
108
|
readonly auditReceipt?: unknown;
|
|
109
|
+
readonly auditOfficer?: unknown;
|
|
108
110
|
/** Present when the ledger row names the tool call — used to dedupe candidate+outcome. */
|
|
109
111
|
readonly toolCallId?: string;
|
|
110
112
|
};
|
|
@@ -285,6 +287,7 @@ function rowFromPayload(
|
|
|
285
287
|
params?: unknown;
|
|
286
288
|
toolCallId?: unknown;
|
|
287
289
|
auditReceipt?: unknown;
|
|
290
|
+
auditOfficer?: unknown;
|
|
288
291
|
},
|
|
289
292
|
accepted: unknown,
|
|
290
293
|
roleFallback?: TerminalRoleName,
|
|
@@ -295,6 +298,7 @@ function rowFromPayload(
|
|
|
295
298
|
kind,
|
|
296
299
|
accepted,
|
|
297
300
|
...(Object.hasOwn(payload, "auditReceipt") ? { auditReceipt: payload.auditReceipt } : {}),
|
|
301
|
+
...(Object.hasOwn(payload, "auditOfficer") ? { auditOfficer: payload.auditOfficer } : {}),
|
|
298
302
|
...(typeof payload.toolCallId === "string" && payload.toolCallId.length > 0
|
|
299
303
|
? { toolCallId: payload.toolCallId }
|
|
300
304
|
: {}),
|
|
@@ -726,6 +730,7 @@ export function createSubmissionLedgerHost(
|
|
|
726
730
|
...(audit !== undefined && (Object.hasOwn(audit, "receipt") || Object.hasOwn(audit, "conflicts"))
|
|
727
731
|
? { auditReceipt: Object.hasOwn(audit, "receipt") ? audit.receipt : audit.conflicts }
|
|
728
732
|
: {}),
|
|
733
|
+
...(audit !== undefined && Object.hasOwn(audit, "officer") ? { auditOfficer: audit.officer } : {}),
|
|
729
734
|
});
|
|
730
735
|
await projectClosure(closed, context);
|
|
731
736
|
return result;
|
package/src/worker-role.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
CanonicalSkillBinding,
|
|
10
10
|
} from "./canonical-skill-binding.ts";
|
|
11
11
|
import { readableGateItem } from "./readable-gate-item.ts";
|
|
12
|
-
import {
|
|
12
|
+
import { projectGatekeeperEscalation } from "./audit-escalation.ts";
|
|
13
13
|
import { GatekeeperDecisionError } from "./submission-errors.ts";
|
|
14
14
|
import {
|
|
15
15
|
CODER_OUTPUT_TOOL_NAME,
|
|
@@ -299,7 +299,7 @@ export function createFixerRoleRuntime(
|
|
|
299
299
|
: undefined;
|
|
300
300
|
} catch (error) {
|
|
301
301
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
302
|
-
return
|
|
302
|
+
return projectGatekeeperEscalation(error.result, output);
|
|
303
303
|
}
|
|
304
304
|
throw error;
|
|
305
305
|
}
|
|
@@ -447,7 +447,7 @@ export function createCoderRoleRuntime(
|
|
|
447
447
|
: undefined;
|
|
448
448
|
} catch (error) {
|
|
449
449
|
if (error instanceof GatekeeperDecisionError && error.result.status === "escalate") {
|
|
450
|
-
return
|
|
450
|
+
return projectGatekeeperEscalation(error.result, output);
|
|
451
451
|
}
|
|
452
452
|
throw error;
|
|
453
453
|
}
|