@akagilnc/pi-workflow-roles 0.1.3644 → 0.1.3648
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 +97 -364
- package/dist/audit-escalation.js +5 -5
- package/dist/compliance-transport.js +11 -57
- package/dist/diarist-contracts.js +0 -12
- package/dist/doctor-contracts.js +0 -2
- package/dist/gleaner-left-contracts.js +0 -7
- package/dist/inspector-contracts.js +0 -4
- package/dist/navigator-public-session.js +1 -5
- package/dist/notary-contracts.js +0 -18
- package/dist/package-contracts/auditor-output.js +0 -13
- package/dist/package-contracts/evidence-child-output.js +0 -3
- package/dist/package-contracts/gatekeeper-output.js +0 -10
- package/dist/package-contracts/judge-output.js +0 -2
- package/dist/package-contracts/navigator-output.js +0 -4
- package/dist/public-cli/main.js +46 -546
- package/dist/public-cli/settlement.js +67 -528
- package/package.json +1 -1
- package/src/audit-escalation.ts +9 -9
- package/src/compliance-transport.ts +28 -94
- package/src/diarist-contracts.ts +0 -12
- package/src/doctor-contracts.ts +0 -1
- package/src/doctor-role.ts +2 -2
- package/src/gleaner-left-contracts.ts +0 -9
- package/src/inspector-contracts.ts +0 -8
- package/src/judge-role.ts +4 -5
- package/src/navigator-public-session.ts +4 -5
- package/src/notary-contracts.ts +0 -18
- package/src/package-contracts/auditor-output.ts +0 -11
- package/src/package-contracts/evidence-child-output.ts +0 -5
- package/src/package-contracts/gatekeeper-output.ts +0 -11
- package/src/package-contracts/judge-output.ts +0 -1
- package/src/package-contracts/navigator-output.ts +0 -3
- package/src/public-cli/settlement.ts +58 -540
|
@@ -589,36 +589,6 @@ var init_auditor_dossier_tool = __esm({
|
|
|
589
589
|
}
|
|
590
590
|
});
|
|
591
591
|
|
|
592
|
-
// src/shape-unreadable-failure.ts
|
|
593
|
-
function isRecord3(value) {
|
|
594
|
-
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
595
|
-
}
|
|
596
|
-
function stampShapeUnreadableDetails(candidate) {
|
|
597
|
-
return {
|
|
598
|
-
[SHAPE_UNREADABLE_KEY]: true,
|
|
599
|
-
candidate,
|
|
600
|
-
acceptedReceipt: false
|
|
601
|
-
};
|
|
602
|
-
}
|
|
603
|
-
function retainedShapeUnreadable(decisiveFacts) {
|
|
604
|
-
if (!isRecord3(decisiveFacts)) return void 0;
|
|
605
|
-
if (decisiveFacts[SHAPE_UNREADABLE_KEY] === true) {
|
|
606
|
-
return { candidate: decisiveFacts.candidate };
|
|
607
|
-
}
|
|
608
|
-
const secondary = isRecord3(decisiveFacts.secondaryEvidence) ? decisiveFacts.secondaryEvidence : void 0;
|
|
609
|
-
if (secondary !== void 0 && secondary[SHAPE_UNREADABLE_KEY] === true) {
|
|
610
|
-
return { candidate: secondary.candidate };
|
|
611
|
-
}
|
|
612
|
-
return void 0;
|
|
613
|
-
}
|
|
614
|
-
var SHAPE_UNREADABLE_KEY;
|
|
615
|
-
var init_shape_unreadable_failure = __esm({
|
|
616
|
-
"src/shape-unreadable-failure.ts"() {
|
|
617
|
-
"use strict";
|
|
618
|
-
SHAPE_UNREADABLE_KEY = "shapeUnreadable";
|
|
619
|
-
}
|
|
620
|
-
});
|
|
621
|
-
|
|
622
592
|
// src/session-assistant-usage.ts
|
|
623
593
|
var session_assistant_usage_exports = {};
|
|
624
594
|
__export(session_assistant_usage_exports, {
|
|
@@ -1378,7 +1348,7 @@ import {
|
|
|
1378
1348
|
writeFileSync as writeFileSync2
|
|
1379
1349
|
} from "node:fs";
|
|
1380
1350
|
import { basename as basename3, dirname as dirname5, join as join6, resolve as resolve5 } from "node:path";
|
|
1381
|
-
function
|
|
1351
|
+
function isRecord3(value) {
|
|
1382
1352
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1383
1353
|
}
|
|
1384
1354
|
function errorCodeOf(error) {
|
|
@@ -1406,7 +1376,7 @@ function findIdentityPointer(recordFile, identity, kind, level) {
|
|
|
1406
1376
|
if (!trimmed) continue;
|
|
1407
1377
|
try {
|
|
1408
1378
|
const parsed = JSON.parse(trimmed);
|
|
1409
|
-
if (
|
|
1379
|
+
if (isRecord3(parsed) && parsed.identity === identity) {
|
|
1410
1380
|
return { identity, recordFile, kind, level };
|
|
1411
1381
|
}
|
|
1412
1382
|
} catch {
|
|
@@ -1594,7 +1564,7 @@ var init_sitian_appender = __esm({
|
|
|
1594
1564
|
// src/sitian-reader.ts
|
|
1595
1565
|
import { existsSync as existsSync2 } from "node:fs";
|
|
1596
1566
|
import { readFile as readFile2 } from "node:fs/promises";
|
|
1597
|
-
function
|
|
1567
|
+
function isRecord4(value) {
|
|
1598
1568
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
1599
1569
|
}
|
|
1600
1570
|
async function readSitianRecords(recordFile) {
|
|
@@ -1610,7 +1580,7 @@ async function readSitianRecords(recordFile) {
|
|
|
1610
1580
|
if (!line2.trim()) continue;
|
|
1611
1581
|
try {
|
|
1612
1582
|
const parsed = JSON.parse(line2);
|
|
1613
|
-
if (
|
|
1583
|
+
if (isRecord4(parsed)) {
|
|
1614
1584
|
records2.push(parsed);
|
|
1615
1585
|
} else {
|
|
1616
1586
|
const typeDesc = parsed === null ? "null" : Array.isArray(parsed) ? "array" : typeof parsed;
|
|
@@ -2154,23 +2124,22 @@ function validateAcceptedJudgeDetails(verdict) {
|
|
|
2154
2124
|
}
|
|
2155
2125
|
throw new Error("Judge verdict has no execution discriminator");
|
|
2156
2126
|
}
|
|
2157
|
-
var JUDGE_OUTPUT_TOOL_NAME, JUDGE_ACCEPTED_TEXT, JUDGE_ACCEPTED_AUDIT_NO_RECEIPT_TEXT
|
|
2127
|
+
var JUDGE_OUTPUT_TOOL_NAME, JUDGE_ACCEPTED_TEXT, JUDGE_ACCEPTED_AUDIT_NO_RECEIPT_TEXT;
|
|
2158
2128
|
var init_judge_output = __esm({
|
|
2159
2129
|
"src/package-contracts/judge-output.ts"() {
|
|
2160
2130
|
"use strict";
|
|
2161
2131
|
JUDGE_OUTPUT_TOOL_NAME = "ak_judge_output";
|
|
2162
2132
|
JUDGE_ACCEPTED_TEXT = "\u5927\u7406\u5BFA\u56DE\u6267\u5DF2\u63A5\u53D7";
|
|
2163
2133
|
JUDGE_ACCEPTED_AUDIT_NO_RECEIPT_TEXT = "\u5927\u7406\u5BFA\u56DE\u6267\u5DF2\u63A5\u53D7\uFF1B\u5BA1\u8BA1\u65E0\u56DE\u6267";
|
|
2164
|
-
JUDGE_ACCEPTED_AUDIT_UNREADABLE_TEXT = "\u5927\u7406\u5BFA\u56DE\u6267\u5DF2\u63A5\u53D7\uFF1B\u5BA1\u8BA1\u5F62\u72B6\u4E0D\u53EF\u8BFB";
|
|
2165
2134
|
}
|
|
2166
2135
|
});
|
|
2167
2136
|
|
|
2168
2137
|
// src/package-contracts/reviewer-output.ts
|
|
2169
|
-
function
|
|
2138
|
+
function isRecord5(value) {
|
|
2170
2139
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2171
2140
|
}
|
|
2172
2141
|
function read(value, key) {
|
|
2173
|
-
if (!
|
|
2142
|
+
if (!isRecord5(value)) return void 0;
|
|
2174
2143
|
try {
|
|
2175
2144
|
return value[key];
|
|
2176
2145
|
} catch {
|
|
@@ -2179,7 +2148,7 @@ function read(value, key) {
|
|
|
2179
2148
|
}
|
|
2180
2149
|
function readAmendments(output) {
|
|
2181
2150
|
const amendments = read(output, "amendments");
|
|
2182
|
-
if (!
|
|
2151
|
+
if (!isRecord5(amendments)) return void 0;
|
|
2183
2152
|
const slots = {};
|
|
2184
2153
|
for (const axis of ["standards", "spec"]) {
|
|
2185
2154
|
const value = read(amendments, axis);
|
|
@@ -2209,25 +2178,25 @@ function validateRuntimeReviewerReceipt(output) {
|
|
|
2209
2178
|
const outcomes = read(output, "outcomes");
|
|
2210
2179
|
const legs = read(acceptedBatch, "legs");
|
|
2211
2180
|
if (acceptedBatch !== void 0 || construction !== void 0 || target !== void 0) {
|
|
2212
|
-
if (!
|
|
2181
|
+
if (!isRecord5(acceptedBatch) || !isRecord5(construction) || !isRecord5(target) || !Array.isArray(legs))
|
|
2213
2182
|
throw new Error("Incomplete Reviewer accepted-batch identity");
|
|
2214
2183
|
const objectFormat = read(target, "objectFormat");
|
|
2215
2184
|
const objectId = (value) => typeof value === "string" && new RegExp(objectFormat === "sha1" ? "^[0-9a-f]{40}$" : "^[0-9a-f]{64}$").test(value);
|
|
2216
2185
|
const refs = read(target, "refs");
|
|
2217
2186
|
const skillText = read(read(identities, "canonicalSkill"), "text");
|
|
2218
|
-
if (typeof skillText !== "string" || read(construction, "recipe") !== "reviewer-common-bundle-v1" || objectFormat !== "sha1" && objectFormat !== "sha256" || !objectId(read(target, "targetHead")) || !
|
|
2187
|
+
if (typeof skillText !== "string" || read(construction, "recipe") !== "reviewer-common-bundle-v1" || objectFormat !== "sha1" && objectFormat !== "sha256" || !objectId(read(target, "targetHead")) || !isRecord5(refs) || Object.values(refs).some((ref) => !isRecord5(ref) || !objectId(read(ref, "objectId")) || read(ref, "peeledCommitId") !== null && !objectId(read(ref, "peeledCommitId"))))
|
|
2219
2188
|
throw new Error("Invalid Reviewer construction or target identity");
|
|
2220
2189
|
const expectedAxes = legs.map((leg) => read(leg, "axis"));
|
|
2221
2190
|
if (expectedAxes[0] !== "standards" || expectedAxes.length === 2 && expectedAxes[1] !== "spec" || expectedAxes.length < 1 || expectedAxes.length > 2)
|
|
2222
2191
|
throw new Error("Invalid Reviewer accepted-leg projection");
|
|
2223
|
-
if (!
|
|
2192
|
+
if (!isRecord5(outcomes) || !isRecord5(reports)) throw new Error("Accepted Reviewer batch lacks outcomes or reports");
|
|
2224
2193
|
const outcomeAxes = Object.keys(outcomes).filter((axis) => axis === "standards" || axis === "spec");
|
|
2225
2194
|
if (outcomeAxes.length !== expectedAxes.length || outcomeAxes.some((axis, index) => axis !== expectedAxes[index]))
|
|
2226
2195
|
throw new Error("Reviewer outcomes must exactly cover accepted legs in canonical order");
|
|
2227
2196
|
for (const [index, axisValue] of expectedAxes.entries()) {
|
|
2228
2197
|
const axis = axisValue;
|
|
2229
2198
|
const outcome = read(outcomes, axis);
|
|
2230
|
-
if (!
|
|
2199
|
+
if (!isRecord5(outcome)) throw new Error("Reviewer accepted leg lacks outcome");
|
|
2231
2200
|
const expectedPrompt = read(read(legs[index], "prompt"), "text");
|
|
2232
2201
|
const actualPrompt = read(read(outcome, "prompt"), "text");
|
|
2233
2202
|
if (expectedPrompt !== actualPrompt) throw new Error("Reviewer outcome prompt disagrees with accepted leg");
|
|
@@ -2351,11 +2320,11 @@ async function disposeComplianceDecision(decision, handlers, deliveredOutput) {
|
|
|
2351
2320
|
decision,
|
|
2352
2321
|
decision.usage === void 0 ? {} : { usage: decision.usage }
|
|
2353
2322
|
);
|
|
2354
|
-
case "
|
|
2355
|
-
if (handlers.
|
|
2356
|
-
throw new Error("Compliance
|
|
2323
|
+
case "received":
|
|
2324
|
+
if (handlers.received === void 0) {
|
|
2325
|
+
throw new Error("Compliance received projection handler is unavailable");
|
|
2357
2326
|
}
|
|
2358
|
-
return await handlers.
|
|
2327
|
+
return await handlers.received(
|
|
2359
2328
|
decision,
|
|
2360
2329
|
decision.usage === void 0 ? {} : { usage: decision.usage }
|
|
2361
2330
|
);
|
|
@@ -2636,11 +2605,11 @@ var init_terminating_infrastructure = __esm({
|
|
|
2636
2605
|
|
|
2637
2606
|
// src/doctor-contracts.ts
|
|
2638
2607
|
import { Type as Type5 } from "typebox";
|
|
2639
|
-
function
|
|
2608
|
+
function isRecord6(value) {
|
|
2640
2609
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2641
2610
|
}
|
|
2642
2611
|
function read2(value, key) {
|
|
2643
|
-
if (!
|
|
2612
|
+
if (!isRecord6(value)) return void 0;
|
|
2644
2613
|
try {
|
|
2645
2614
|
return value[key];
|
|
2646
2615
|
} catch {
|
|
@@ -2686,7 +2655,7 @@ function validateDoctorOutput(value, patient, store) {
|
|
|
2686
2655
|
const targetKey = read2(finding2, "targetKey");
|
|
2687
2656
|
readCitations(read2(finding2, "evidenceIds"), "finding");
|
|
2688
2657
|
const assetEvidence = read2(finding2, "assetEvidence");
|
|
2689
|
-
if (!
|
|
2658
|
+
if (!isRecord6(assetEvidence)) {
|
|
2690
2659
|
assertTarget(targetKey);
|
|
2691
2660
|
continue;
|
|
2692
2661
|
}
|
|
@@ -2718,7 +2687,7 @@ function validateDoctorOutput(value, patient, store) {
|
|
|
2718
2687
|
}
|
|
2719
2688
|
return output;
|
|
2720
2689
|
}
|
|
2721
|
-
var DOCTOR_EVIDENCE_TOOL_NAME, DOCTOR_OUTPUT_TOOL_NAME, DOCTOR_ACCEPTED_TEXT, DOCTOR_ACCEPTED_AUDIT_NO_RECEIPT_TEXT,
|
|
2690
|
+
var DOCTOR_EVIDENCE_TOOL_NAME, DOCTOR_OUTPUT_TOOL_NAME, DOCTOR_ACCEPTED_TEXT, DOCTOR_ACCEPTED_AUDIT_NO_RECEIPT_TEXT, DOCTOR_OUTPUT_TOOL_DESCRIPTION, DOCTOR_TARGET_KINDS, nonblank, count, evidenceIds, guardrail, lastRealBite, assetKinds, findingBody, finding, caseIdentity, cost, doctorSubmissionVariants, doctorSubmissionSchema, doctorOutputSchema, doctorEvidenceReadSchema, DoctorSubmissionContractError, DoctorEvidenceStore;
|
|
2722
2691
|
var init_doctor_contracts = __esm({
|
|
2723
2692
|
"src/doctor-contracts.ts"() {
|
|
2724
2693
|
"use strict";
|
|
@@ -2729,7 +2698,6 @@ var init_doctor_contracts = __esm({
|
|
|
2729
2698
|
DOCTOR_OUTPUT_TOOL_NAME = "ak_doctor_output";
|
|
2730
2699
|
DOCTOR_ACCEPTED_TEXT = "\u592A\u533B\u7F72\u56DE\u6267\u5DF2\u63A5\u53D7";
|
|
2731
2700
|
DOCTOR_ACCEPTED_AUDIT_NO_RECEIPT_TEXT = "\u592A\u533B\u7F72\u56DE\u6267\u5DF2\u63A5\u53D7\uFF1B\u5BA1\u8BA1\u65E0\u56DE\u6267";
|
|
2732
|
-
DOCTOR_ACCEPTED_AUDIT_UNREADABLE_TEXT = "\u592A\u533B\u7F72\u56DE\u6267\u5DF2\u63A5\u53D7\uFF1B\u5BA1\u8BA1\u5F62\u72B6\u4E0D\u53EF\u8BFB";
|
|
2733
2701
|
DOCTOR_OUTPUT_TOOL_DESCRIPTION = "\u63D0\u4EA4\u552F\u4E00\u7EC8\u5C40\u5355\u6848\u8BC1\u8BCD\uFF1Bcompleted \u5141\u8BB8\u7A7A findings\uFF1Bruntime \u8865\u8BB0\u6D3E\u751F\u6210\u672C\u5165\u56DE\u6267\u3002";
|
|
2734
2702
|
DOCTOR_TARGET_KINDS = ["law", "gate", "template", "station", "seat"];
|
|
2735
2703
|
nonblank = Type5.String({ minLength: 1, pattern: "\\S" });
|
|
@@ -2829,7 +2797,7 @@ var init_doctor_contracts = __esm({
|
|
|
2829
2797
|
|
|
2830
2798
|
// src/package-contracts/gatekeeper-output.ts
|
|
2831
2799
|
import { Type as Type6 } from "typebox";
|
|
2832
|
-
function
|
|
2800
|
+
function isRecord7(value) {
|
|
2833
2801
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2834
2802
|
}
|
|
2835
2803
|
function asStringArray(value) {
|
|
@@ -2837,7 +2805,7 @@ function asStringArray(value) {
|
|
|
2837
2805
|
return value.filter((item) => typeof item === "string");
|
|
2838
2806
|
}
|
|
2839
2807
|
function projectLawfulGatekeeperOutput(value) {
|
|
2840
|
-
if (!
|
|
2808
|
+
if (!isRecord7(value)) return void 0;
|
|
2841
2809
|
if (value.status === "pass") {
|
|
2842
2810
|
return Array.isArray(value.findings) ? { status: "pass", findings: asStringArray(value.findings) } : { status: "pass" };
|
|
2843
2811
|
}
|
|
@@ -2853,15 +2821,6 @@ function validateRecordedGatekeeperOutput(value) {
|
|
|
2853
2821
|
}
|
|
2854
2822
|
return projected;
|
|
2855
2823
|
}
|
|
2856
|
-
function gatekeeperDecisiveFacts(output) {
|
|
2857
|
-
const facts = { status: output.status };
|
|
2858
|
-
if (output.status === "dispatch") {
|
|
2859
|
-
facts.officer = output.officer;
|
|
2860
|
-
} else if (Array.isArray(output.findings)) {
|
|
2861
|
-
facts.findingsCount = output.findings.length;
|
|
2862
|
-
}
|
|
2863
|
-
return facts;
|
|
2864
|
-
}
|
|
2865
2824
|
var GATEKEEPER_OUTPUT_TOOL_NAME, GATEKEEPER_ACCEPTED_TEXT, gatekeeperDecisionSchema, gatekeeperOutputSchema;
|
|
2866
2825
|
var init_gatekeeper_output = __esm({
|
|
2867
2826
|
"src/package-contracts/gatekeeper-output.ts"() {
|
|
@@ -2891,13 +2850,13 @@ var init_gatekeeper_output = __esm({
|
|
|
2891
2850
|
|
|
2892
2851
|
// src/package-contracts/navigator-output.ts
|
|
2893
2852
|
import { Type as Type7 } from "typebox";
|
|
2894
|
-
function
|
|
2853
|
+
function isRecord8(value) {
|
|
2895
2854
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2896
2855
|
}
|
|
2897
2856
|
function projectLawfulNavigatorOutput(value) {
|
|
2898
|
-
if (!
|
|
2857
|
+
if (!isRecord8(value) || !Array.isArray(value.candidates)) return void 0;
|
|
2899
2858
|
if (value.status !== "advice") return void 0;
|
|
2900
|
-
return { status: "advice", candidates: value.candidates.filter(
|
|
2859
|
+
return { status: "advice", candidates: value.candidates.filter(isRecord8) };
|
|
2901
2860
|
}
|
|
2902
2861
|
function validateRecordedNavigatorOutput(value) {
|
|
2903
2862
|
const projected = projectLawfulNavigatorOutput(value);
|
|
@@ -2906,9 +2865,6 @@ function validateRecordedNavigatorOutput(value) {
|
|
|
2906
2865
|
}
|
|
2907
2866
|
return projected;
|
|
2908
2867
|
}
|
|
2909
|
-
function navigatorDecisiveFacts(output) {
|
|
2910
|
-
return { status: "advice", candidates: output.candidates };
|
|
2911
|
-
}
|
|
2912
2868
|
var NAVIGATOR_OUTPUT_TOOL_NAME, NAVIGATOR_ACCEPTED_TEXT, navigatorOutputSchema;
|
|
2913
2869
|
var init_navigator_output = __esm({
|
|
2914
2870
|
"src/package-contracts/navigator-output.ts"() {
|
|
@@ -2934,11 +2890,11 @@ var init_navigator_output = __esm({
|
|
|
2934
2890
|
|
|
2935
2891
|
// src/package-contracts/auditor-output.ts
|
|
2936
2892
|
import { Type as Type8 } from "typebox";
|
|
2937
|
-
function
|
|
2893
|
+
function isRecord9(value) {
|
|
2938
2894
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2939
2895
|
}
|
|
2940
2896
|
function projectLawfulAuditorOutput(value) {
|
|
2941
|
-
if (!
|
|
2897
|
+
if (!isRecord9(value)) return void 0;
|
|
2942
2898
|
if (value.status === "pass") return { status: "pass" };
|
|
2943
2899
|
if (value.status === "bounce") {
|
|
2944
2900
|
return {
|
|
@@ -2962,17 +2918,6 @@ function validateRecordedAuditorOutput(value) {
|
|
|
2962
2918
|
}
|
|
2963
2919
|
return projected;
|
|
2964
2920
|
}
|
|
2965
|
-
function auditorDecisiveFacts(output) {
|
|
2966
|
-
const facts = { status: output.status };
|
|
2967
|
-
if (output.status === "bounce" && output.violations !== void 0) {
|
|
2968
|
-
facts.violations = output.violations;
|
|
2969
|
-
}
|
|
2970
|
-
if (output.status === "escalate") {
|
|
2971
|
-
if (output.conflicts !== void 0) facts.conflicts = output.conflicts;
|
|
2972
|
-
if (output.decisionGate !== void 0) facts.decisionGate = output.decisionGate;
|
|
2973
|
-
}
|
|
2974
|
-
return facts;
|
|
2975
|
-
}
|
|
2976
2921
|
var AUDITOR_OUTPUT_TOOL_NAME, AUDITOR_ACCEPTED_TEXT, auditorOutputSchema;
|
|
2977
2922
|
var init_auditor_output = __esm({
|
|
2978
2923
|
"src/package-contracts/auditor-output.ts"() {
|
|
@@ -3004,11 +2949,11 @@ var init_auditor_output = __esm({
|
|
|
3004
2949
|
|
|
3005
2950
|
// src/package-contracts/evidence-child-output.ts
|
|
3006
2951
|
import { Type as Type9 } from "typebox";
|
|
3007
|
-
function
|
|
2952
|
+
function isRecord10(value) {
|
|
3008
2953
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3009
2954
|
}
|
|
3010
2955
|
function projectLawfulEvidenceChildOutput(value) {
|
|
3011
|
-
if (!
|
|
2956
|
+
if (!isRecord10(value)) return void 0;
|
|
3012
2957
|
return { report: Object.hasOwn(value, "report") ? value.report : value };
|
|
3013
2958
|
}
|
|
3014
2959
|
function validateRecordedEvidenceChildOutput(value) {
|
|
@@ -3018,9 +2963,6 @@ function validateRecordedEvidenceChildOutput(value) {
|
|
|
3018
2963
|
}
|
|
3019
2964
|
return projected;
|
|
3020
2965
|
}
|
|
3021
|
-
function evidenceChildDecisiveFacts(output) {
|
|
3022
|
-
return { report: output.report };
|
|
3023
|
-
}
|
|
3024
2966
|
var EVIDENCE_CHILD_OUTPUT_TOOL_NAME, EVIDENCE_CHILD_ACCEPTED_TEXT, evidenceChildOutputSchema;
|
|
3025
2967
|
var init_evidence_child_output = __esm({
|
|
3026
2968
|
"src/package-contracts/evidence-child-output.ts"() {
|
|
@@ -3160,7 +3102,7 @@ var init_merger_contracts = __esm({
|
|
|
3160
3102
|
|
|
3161
3103
|
// src/notary-contracts.ts
|
|
3162
3104
|
import { Type as Type11 } from "typebox";
|
|
3163
|
-
function
|
|
3105
|
+
function isRecord11(value) {
|
|
3164
3106
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3165
3107
|
}
|
|
3166
3108
|
function asStringArray2(value) {
|
|
@@ -3168,7 +3110,7 @@ function asStringArray2(value) {
|
|
|
3168
3110
|
return value.filter((item) => typeof item === "string");
|
|
3169
3111
|
}
|
|
3170
3112
|
function projectLawfulNotaryOutput(value) {
|
|
3171
|
-
if (!
|
|
3113
|
+
if (!isRecord11(value)) return void 0;
|
|
3172
3114
|
const status = typeof value.status === "string" ? value.status : void 0;
|
|
3173
3115
|
if (status === "bounce") {
|
|
3174
3116
|
const clone = structuredClone(value);
|
|
@@ -3201,23 +3143,6 @@ function validateRecordedNotaryOutput(value) {
|
|
|
3201
3143
|
}
|
|
3202
3144
|
return projected;
|
|
3203
3145
|
}
|
|
3204
|
-
function notaryDecisiveFacts(output) {
|
|
3205
|
-
const status = String(output.status);
|
|
3206
|
-
const facts = { status, officer: "notary" };
|
|
3207
|
-
if (status === "pass" || status === "bounce") {
|
|
3208
|
-
const findings = output.findings;
|
|
3209
|
-
facts.findingsCount = Array.isArray(findings) ? findings.length : 0;
|
|
3210
|
-
facts.findings = Array.isArray(findings) ? findings : [];
|
|
3211
|
-
}
|
|
3212
|
-
if (status === "bounce") {
|
|
3213
|
-
facts.disposition = "rewrite";
|
|
3214
|
-
}
|
|
3215
|
-
if (status === "escalate") {
|
|
3216
|
-
const reason = output.reason;
|
|
3217
|
-
if (reason !== void 0) facts.reason = reason;
|
|
3218
|
-
}
|
|
3219
|
-
return facts;
|
|
3220
|
-
}
|
|
3221
3146
|
var NOTARY_OUTPUT_TOOL_NAME, NOTARY_ACCEPTED_TEXT, NOTARY_SOURCE_RUN_FLAG, NOTARY_TICKET_FLAG, NOTARY_FIXED_KICKOFF, notaryOutputSchema;
|
|
3222
3147
|
var init_notary_contracts = __esm({
|
|
3223
3148
|
"src/notary-contracts.ts"() {
|
|
@@ -3335,9 +3260,6 @@ function validateRecordedInspectorOutput(value) {
|
|
|
3335
3260
|
}
|
|
3336
3261
|
throw new Error("Inspector output has no execution discriminator");
|
|
3337
3262
|
}
|
|
3338
|
-
function inspectorDecisiveFacts(output) {
|
|
3339
|
-
return { ...output };
|
|
3340
|
-
}
|
|
3341
3263
|
var INSPECTOR_OUTPUT_TOOL_NAME, INSPECTOR_ACCEPTED_TEXT;
|
|
3342
3264
|
var init_inspector_contracts = __esm({
|
|
3343
3265
|
"src/inspector-contracts.ts"() {
|
|
@@ -10039,11 +9961,11 @@ var init_reviewer_pinned_git = __esm({
|
|
|
10039
9961
|
});
|
|
10040
9962
|
|
|
10041
9963
|
// src/ticket-provenance-contracts.ts
|
|
10042
|
-
function
|
|
9964
|
+
function isRecord12(value) {
|
|
10043
9965
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10044
9966
|
}
|
|
10045
9967
|
function projectTicketProvenanceDiagnostic(value) {
|
|
10046
|
-
if (!
|
|
9968
|
+
if (!isRecord12(value)) return void 0;
|
|
10047
9969
|
if (value.recordClass !== TICKET_PROVENANCE_RECORD_CLASS_DIAGNOSTIC) {
|
|
10048
9970
|
return void 0;
|
|
10049
9971
|
}
|
|
@@ -10065,18 +9987,18 @@ function projectTicketProvenanceDiagnostic(value) {
|
|
|
10065
9987
|
};
|
|
10066
9988
|
}
|
|
10067
9989
|
function projectTicketProvenanceEntry(value) {
|
|
10068
|
-
if (!
|
|
9990
|
+
if (!isRecord12(value)) return void 0;
|
|
10069
9991
|
if (value.recordClass === TICKET_PROVENANCE_RECORD_CLASS_DIAGNOSTIC) {
|
|
10070
9992
|
return void 0;
|
|
10071
9993
|
}
|
|
10072
|
-
if (!
|
|
9994
|
+
if (!isRecord12(value.basis)) return void 0;
|
|
10073
9995
|
if (typeof value.basis.method !== "string" || !BASIS_METHODS.has(value.basis.method)) {
|
|
10074
9996
|
return void 0;
|
|
10075
9997
|
}
|
|
10076
9998
|
if (typeof value.sourceKind !== "string" || !SOURCE_KINDS.has(value.sourceKind)) {
|
|
10077
9999
|
return void 0;
|
|
10078
10000
|
}
|
|
10079
|
-
if (!
|
|
10001
|
+
if (!isRecord12(value.sourceRef)) return void 0;
|
|
10080
10002
|
if (typeof value.transcript !== "string" || value.transcript.length === 0) {
|
|
10081
10003
|
return void 0;
|
|
10082
10004
|
}
|
|
@@ -10703,6 +10625,29 @@ var init_public_run_credentials = __esm({
|
|
|
10703
10625
|
}
|
|
10704
10626
|
});
|
|
10705
10627
|
|
|
10628
|
+
// src/shape-unreadable-failure.ts
|
|
10629
|
+
function isRecord13(value) {
|
|
10630
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
10631
|
+
}
|
|
10632
|
+
function retainedShapeUnreadable(decisiveFacts) {
|
|
10633
|
+
if (!isRecord13(decisiveFacts)) return void 0;
|
|
10634
|
+
if (decisiveFacts[SHAPE_UNREADABLE_KEY] === true) {
|
|
10635
|
+
return { candidate: decisiveFacts.candidate };
|
|
10636
|
+
}
|
|
10637
|
+
const secondary = isRecord13(decisiveFacts.secondaryEvidence) ? decisiveFacts.secondaryEvidence : void 0;
|
|
10638
|
+
if (secondary !== void 0 && secondary[SHAPE_UNREADABLE_KEY] === true) {
|
|
10639
|
+
return { candidate: secondary.candidate };
|
|
10640
|
+
}
|
|
10641
|
+
return void 0;
|
|
10642
|
+
}
|
|
10643
|
+
var SHAPE_UNREADABLE_KEY;
|
|
10644
|
+
var init_shape_unreadable_failure = __esm({
|
|
10645
|
+
"src/shape-unreadable-failure.ts"() {
|
|
10646
|
+
"use strict";
|
|
10647
|
+
SHAPE_UNREADABLE_KEY = "shapeUnreadable";
|
|
10648
|
+
}
|
|
10649
|
+
});
|
|
10650
|
+
|
|
10706
10651
|
// src/gatekeeper-role.ts
|
|
10707
10652
|
function gateSeatLabel(stage) {
|
|
10708
10653
|
return stage === "inspector" ? "\u5BDF\u9662" : "\u7B26\u5B9D\u90CE";
|
|
@@ -13755,9 +13700,6 @@ function classifyPackagedRoleTerminalResult(message) {
|
|
|
13755
13700
|
}
|
|
13756
13701
|
return { kind: "nonterminal" };
|
|
13757
13702
|
}
|
|
13758
|
-
function isAcceptedPackagedRoleTerminalResult(message) {
|
|
13759
|
-
return classifyPackagedRoleTerminalResult(message).kind === "accepted";
|
|
13760
|
-
}
|
|
13761
13703
|
function durableTerminalAt(entries, index) {
|
|
13762
13704
|
const entry = entries[index];
|
|
13763
13705
|
const message = entry?.type === "custom" && entry.customType === "ak-role-submission-closure" ? typeof entry.data === "object" && entry.data !== null ? entry.data : void 0 : entry?.type === "message" && entry.message?.role === "toolResult" ? entry.message : void 0;
|
|
@@ -14834,91 +14776,11 @@ function auditNoReceiptDecisiveFact(candidate) {
|
|
|
14834
14776
|
return {};
|
|
14835
14777
|
}
|
|
14836
14778
|
}
|
|
14837
|
-
function
|
|
14838
|
-
|
|
14839
|
-
|
|
14840
|
-
|
|
14841
|
-
return { auditUnreadable: projected.value };
|
|
14842
|
-
}
|
|
14843
|
-
return { auditUnreadable: projected.value };
|
|
14844
|
-
}
|
|
14845
|
-
function judgeDecisiveFacts(verdict, judgeStatus) {
|
|
14846
|
-
const facts = {
|
|
14847
|
-
judgeStatus,
|
|
14848
|
-
...auditNoReceiptDecisiveFact(verdict),
|
|
14849
|
-
...auditUnreadableDecisiveFact(verdict)
|
|
14850
|
-
};
|
|
14851
|
-
const statusBase = judgeStatus;
|
|
14852
|
-
if (statusBase === "continue") {
|
|
14853
|
-
const fix = safelyRead(verdict, "fix");
|
|
14854
|
-
if (fix.readable && isRecord20(fix.value)) {
|
|
14855
|
-
const summary = safelyRead(fix.value, "summary");
|
|
14856
|
-
if (summary.readable && typeof summary.value === "string") {
|
|
14857
|
-
facts.fixSummary = summary.value;
|
|
14858
|
-
}
|
|
14859
|
-
}
|
|
14860
|
-
const classes = safelyRead(verdict, "classes");
|
|
14861
|
-
if (classes.readable && Array.isArray(classes.value)) {
|
|
14862
|
-
try {
|
|
14863
|
-
facts.classes = classes.value.map((entry) => {
|
|
14864
|
-
if (!isRecord20(entry)) throw new Error("unreadable Judge class");
|
|
14865
|
-
return {
|
|
14866
|
-
name: entry.name,
|
|
14867
|
-
owner: entry.owner,
|
|
14868
|
-
boundary: entry.boundary,
|
|
14869
|
-
disposition: entry.disposition
|
|
14870
|
-
};
|
|
14871
|
-
});
|
|
14872
|
-
facts.classCount = classes.value.length;
|
|
14873
|
-
} catch {
|
|
14874
|
-
}
|
|
14875
|
-
}
|
|
14876
|
-
}
|
|
14877
|
-
if (statusBase === "escalate") {
|
|
14878
|
-
const gate = safelyRead(verdict, "decisionGate");
|
|
14879
|
-
if (gate.readable && isRecord20(gate.value)) {
|
|
14880
|
-
const question = safelyRead(gate.value, "question");
|
|
14881
|
-
const options = safelyRead(gate.value, "options");
|
|
14882
|
-
if (question.readable && typeof question.value === "string") {
|
|
14883
|
-
facts.decisionQuestion = question.value;
|
|
14884
|
-
}
|
|
14885
|
-
if (options.readable && Array.isArray(options.value)) {
|
|
14886
|
-
facts.decisionOptions = [...options.value];
|
|
14887
|
-
}
|
|
14888
|
-
}
|
|
14889
|
-
}
|
|
14890
|
-
const note = safelyRead(verdict, "note");
|
|
14891
|
-
if (note.readable && note.value !== void 0) facts.note = note.value;
|
|
14892
|
-
const evidence = safelyRead(verdict, "evidence");
|
|
14893
|
-
if (evidence.readable && evidence.value !== void 0) facts.evidence = evidence.value;
|
|
14894
|
-
return facts;
|
|
14895
|
-
}
|
|
14896
|
-
function doctorDecisiveFacts(output) {
|
|
14897
|
-
const candidate = output;
|
|
14898
|
-
const status = safelyRead(candidate, "status");
|
|
14899
|
-
const facts = {
|
|
14900
|
-
...auditNoReceiptDecisiveFact(candidate),
|
|
14901
|
-
...auditUnreadableDecisiveFact(candidate)
|
|
14779
|
+
function withAuditNoReceiptFacts(candidate) {
|
|
14780
|
+
return {
|
|
14781
|
+
...candidate,
|
|
14782
|
+
...auditNoReceiptDecisiveFact(candidate)
|
|
14902
14783
|
};
|
|
14903
|
-
if (status.readable && typeof status.value === "string") facts.doctorStatus = status.value;
|
|
14904
|
-
const statusBase = status.readable && typeof status.value === "string" ? status.value : void 0;
|
|
14905
|
-
if (statusBase === "refused") {
|
|
14906
|
-
const reason = safelyRead(candidate, "reason");
|
|
14907
|
-
if (reason.readable && reason.value !== void 0) facts.reason = reason.value;
|
|
14908
|
-
const missing = safelyRead(candidate, "missingEvidence");
|
|
14909
|
-
if (missing.readable && Array.isArray(missing.value)) facts.missingEvidenceCount = missing.value.length;
|
|
14910
|
-
return facts;
|
|
14911
|
-
}
|
|
14912
|
-
const caseValue = safelyRead(candidate, "case");
|
|
14913
|
-
if (caseValue.readable && isRecord20(caseValue.value)) {
|
|
14914
|
-
const issueNumber = safelyRead(caseValue.value, "issueNumber");
|
|
14915
|
-
const runsPath = safelyRead(caseValue.value, "runsPath");
|
|
14916
|
-
if (issueNumber.readable && issueNumber.value !== void 0) facts.issueNumber = issueNumber.value;
|
|
14917
|
-
if (runsPath.readable && runsPath.value !== void 0) facts.runsPath = runsPath.value;
|
|
14918
|
-
}
|
|
14919
|
-
const findings = safelyRead(candidate, "findings");
|
|
14920
|
-
if (findings.readable && Array.isArray(findings.value)) facts.findingsCount = findings.value.length;
|
|
14921
|
-
return facts;
|
|
14922
14784
|
}
|
|
14923
14785
|
function toolResultText(message) {
|
|
14924
14786
|
const content = message.content;
|
|
@@ -15287,7 +15149,8 @@ async function readLawfulJudgeRoleOutcome(admitted, authority) {
|
|
|
15287
15149
|
kind: "accepted",
|
|
15288
15150
|
role: "judge",
|
|
15289
15151
|
status: sealed.status,
|
|
15290
|
-
|
|
15152
|
+
// #757: sealed details pass through (judgeStatus already on the receipt).
|
|
15153
|
+
decisiveFacts: withAuditNoReceiptFacts(details)
|
|
15291
15154
|
};
|
|
15292
15155
|
}
|
|
15293
15156
|
return auditEscalationLedgerOutcome(admitted, "judge");
|
|
@@ -15385,12 +15248,12 @@ async function settleLawfulDoctorTerminalResult(admitted, authority) {
|
|
|
15385
15248
|
sessionDirectory
|
|
15386
15249
|
);
|
|
15387
15250
|
}
|
|
15388
|
-
const output =
|
|
15251
|
+
const output = sealed.decisiveFacts;
|
|
15389
15252
|
const roleOutcome = {
|
|
15390
15253
|
kind: "accepted",
|
|
15391
15254
|
role: "doctor",
|
|
15392
15255
|
status: sealed.status,
|
|
15393
|
-
decisiveFacts:
|
|
15256
|
+
decisiveFacts: { ...sealed.decisiveFacts }
|
|
15394
15257
|
};
|
|
15395
15258
|
if (String(output.status) === "completed") {
|
|
15396
15259
|
const completedCase = output.case;
|
|
@@ -15451,7 +15314,6 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
15451
15314
|
}
|
|
15452
15315
|
if (roleOutcome?.role !== spec.role) {
|
|
15453
15316
|
const scanStart = currentAttemptStartIndex(entries);
|
|
15454
|
-
let acceptedNonUsable;
|
|
15455
15317
|
for (let index = entries.length - 1; index >= scanStart; index -= 1) {
|
|
15456
15318
|
const message = entries[index]?.message;
|
|
15457
15319
|
if (message?.role !== "toolResult") continue;
|
|
@@ -15462,39 +15324,17 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
15462
15324
|
spec.toolName
|
|
15463
15325
|
);
|
|
15464
15326
|
if (residual !== void 0) {
|
|
15327
|
+
const details = isRecord20(residual.candidate) ? residual.candidate : { candidate: residual.candidate };
|
|
15465
15328
|
return settleFailureTerminalResult(admitted, {
|
|
15466
15329
|
cause: "output",
|
|
15467
15330
|
diagnostic: residual.diagnostic,
|
|
15468
|
-
details
|
|
15331
|
+
details
|
|
15469
15332
|
}, authority);
|
|
15470
15333
|
}
|
|
15471
|
-
if (acceptedNonUsable === void 0 && message.toolName === spec.toolName && isAcceptedPackagedRoleTerminalResult(message)) {
|
|
15472
|
-
if (!spec.tryAcceptDetails(message.details)) {
|
|
15473
|
-
acceptedNonUsable = message.details;
|
|
15474
|
-
}
|
|
15475
|
-
}
|
|
15476
|
-
}
|
|
15477
|
-
if (acceptedNonUsable !== void 0) {
|
|
15478
|
-
return settleFailureTerminalResult(admitted, {
|
|
15479
|
-
cause: "output",
|
|
15480
|
-
diagnostic: spec.nonUsableDiagnostic,
|
|
15481
|
-
details: stampShapeUnreadableDetails(acceptedNonUsable)
|
|
15482
|
-
}, authority);
|
|
15483
15334
|
}
|
|
15484
15335
|
return void 0;
|
|
15485
15336
|
}
|
|
15486
|
-
|
|
15487
|
-
return settleFailureTerminalResult(
|
|
15488
|
-
admitted,
|
|
15489
|
-
{
|
|
15490
|
-
cause: "output",
|
|
15491
|
-
diagnostic: spec.nonUsableDiagnostic,
|
|
15492
|
-
details: stampShapeUnreadableDetails(roleOutcome.decisiveFacts)
|
|
15493
|
-
},
|
|
15494
|
-
authority
|
|
15495
|
-
);
|
|
15496
|
-
}
|
|
15497
|
-
const acceptedOutcome = spec.projectAccepted(roleOutcome);
|
|
15337
|
+
const acceptedOutcome = roleOutcome;
|
|
15498
15338
|
const navigator = extractNavigatorFact(entries);
|
|
15499
15339
|
return withOptionalGateProjection(
|
|
15500
15340
|
{
|
|
@@ -15506,32 +15346,10 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
15506
15346
|
sessionDirectory
|
|
15507
15347
|
);
|
|
15508
15348
|
}
|
|
15509
|
-
function tryAcceptWithValidator(validate) {
|
|
15510
|
-
return (details) => {
|
|
15511
|
-
try {
|
|
15512
|
-
validate(details);
|
|
15513
|
-
return true;
|
|
15514
|
-
} catch {
|
|
15515
|
-
return false;
|
|
15516
|
-
}
|
|
15517
|
-
};
|
|
15518
|
-
}
|
|
15519
15349
|
async function settleLawfulNotaryTerminalResult(admitted, authority, scope) {
|
|
15520
15350
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
15521
15351
|
role: "notary",
|
|
15522
|
-
toolName: NOTARY_OUTPUT_TOOL_NAME
|
|
15523
|
-
nonUsableDiagnostic: "\u7B26\u5B9D\u90CE\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
|
|
15524
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedNotaryOutput),
|
|
15525
|
-
projectAccepted: (sealed) => {
|
|
15526
|
-
const output = validateRecordedNotaryOutput(sealed.decisiveFacts);
|
|
15527
|
-
const accepted = {
|
|
15528
|
-
kind: "accepted",
|
|
15529
|
-
role: "notary",
|
|
15530
|
-
status: sealed.status,
|
|
15531
|
-
decisiveFacts: notaryDecisiveFacts(output)
|
|
15532
|
-
};
|
|
15533
|
-
return accepted;
|
|
15534
|
-
}
|
|
15352
|
+
toolName: NOTARY_OUTPUT_TOOL_NAME
|
|
15535
15353
|
}, scope);
|
|
15536
15354
|
}
|
|
15537
15355
|
async function trySettleNotaryTerminalResult(admitted, authority, scope) {
|
|
@@ -15540,19 +15358,7 @@ async function trySettleNotaryTerminalResult(admitted, authority, scope) {
|
|
|
15540
15358
|
async function settleLawfulInspectorTerminalResult(admitted, authority, scope) {
|
|
15541
15359
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
15542
15360
|
role: "inspector",
|
|
15543
|
-
toolName: INSPECTOR_OUTPUT_TOOL_NAME
|
|
15544
|
-
nonUsableDiagnostic: "\u5BDF\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
|
|
15545
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedInspectorOutput),
|
|
15546
|
-
projectAccepted: (sealed) => {
|
|
15547
|
-
const output = validateRecordedInspectorOutput(sealed.decisiveFacts);
|
|
15548
|
-
const accepted = {
|
|
15549
|
-
kind: "accepted",
|
|
15550
|
-
role: "inspector",
|
|
15551
|
-
status: sealed.status,
|
|
15552
|
-
decisiveFacts: inspectorDecisiveFacts(output)
|
|
15553
|
-
};
|
|
15554
|
-
return accepted;
|
|
15555
|
-
}
|
|
15361
|
+
toolName: INSPECTOR_OUTPUT_TOOL_NAME
|
|
15556
15362
|
}, scope);
|
|
15557
15363
|
}
|
|
15558
15364
|
async function trySettleInspectorTerminalResult(admitted, authority, scope) {
|
|
@@ -15561,19 +15367,7 @@ async function trySettleInspectorTerminalResult(admitted, authority, scope) {
|
|
|
15561
15367
|
async function settleLawfulGatekeeperTerminalResult(admitted, authority, scope) {
|
|
15562
15368
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
15563
15369
|
role: "gatekeeper",
|
|
15564
|
-
toolName: GATEKEEPER_OUTPUT_TOOL_NAME
|
|
15565
|
-
nonUsableDiagnostic: "\u95E8\u4E0B\u7701\u51B3\u8BAE\u65E0\u663E\u5F0F dispatch/pass",
|
|
15566
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedGatekeeperOutput),
|
|
15567
|
-
projectAccepted: (sealed) => {
|
|
15568
|
-
const output = validateRecordedGatekeeperOutput(sealed.decisiveFacts);
|
|
15569
|
-
const accepted = {
|
|
15570
|
-
kind: "accepted",
|
|
15571
|
-
role: "gatekeeper",
|
|
15572
|
-
status: output.status,
|
|
15573
|
-
decisiveFacts: gatekeeperDecisiveFacts(output)
|
|
15574
|
-
};
|
|
15575
|
-
return accepted;
|
|
15576
|
-
}
|
|
15370
|
+
toolName: GATEKEEPER_OUTPUT_TOOL_NAME
|
|
15577
15371
|
}, scope);
|
|
15578
15372
|
}
|
|
15579
15373
|
async function trySettleGatekeeperTerminalResult(admitted, authority, scope) {
|
|
@@ -15582,19 +15376,7 @@ async function trySettleGatekeeperTerminalResult(admitted, authority, scope) {
|
|
|
15582
15376
|
async function settleLawfulNavigatorTerminalResult(admitted, authority, scope) {
|
|
15583
15377
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
15584
15378
|
role: "navigator",
|
|
15585
|
-
toolName: NAVIGATOR_OUTPUT_TOOL_NAME
|
|
15586
|
-
nonUsableDiagnostic: "\u6E38\u5955\u4F7F\u56DE\u6267\u65E0\u663E\u5F0F\u8DEF\u7EBF\u5EFA\u8BAE",
|
|
15587
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedNavigatorOutput),
|
|
15588
|
-
projectAccepted: (sealed) => {
|
|
15589
|
-
const output = validateRecordedNavigatorOutput(sealed.decisiveFacts);
|
|
15590
|
-
const accepted = {
|
|
15591
|
-
kind: "accepted",
|
|
15592
|
-
role: "navigator",
|
|
15593
|
-
status: "advice",
|
|
15594
|
-
decisiveFacts: navigatorDecisiveFacts(output)
|
|
15595
|
-
};
|
|
15596
|
-
return accepted;
|
|
15597
|
-
}
|
|
15379
|
+
toolName: NAVIGATOR_OUTPUT_TOOL_NAME
|
|
15598
15380
|
}, scope);
|
|
15599
15381
|
}
|
|
15600
15382
|
async function trySettleNavigatorTerminalResult(admitted, authority, scope) {
|
|
@@ -15603,24 +15385,7 @@ async function trySettleNavigatorTerminalResult(admitted, authority, scope) {
|
|
|
15603
15385
|
async function settleLawfulAuditorTerminalResult(admitted, authority, scope) {
|
|
15604
15386
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
15605
15387
|
role: "auditor",
|
|
15606
|
-
toolName: AUDITOR_OUTPUT_TOOL_NAME
|
|
15607
|
-
nonUsableDiagnostic: "\u5BA1\u5211\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
|
|
15608
|
-
// Only pass/bounce/escalate are lawful releases. Unreadable mystery status
|
|
15609
|
-
// fails closed with candidate retained for parent ComplianceCandidateUnreadableError.
|
|
15610
|
-
tryAcceptDetails: (details) => projectLawfulAuditorOutput(details) !== void 0,
|
|
15611
|
-
projectAccepted: (sealed) => {
|
|
15612
|
-
const lawful = projectLawfulAuditorOutput(sealed.decisiveFacts);
|
|
15613
|
-
if (lawful === void 0) {
|
|
15614
|
-
throw new Error("auditor projectAccepted requires lawful pass/bounce/escalate");
|
|
15615
|
-
}
|
|
15616
|
-
const accepted = {
|
|
15617
|
-
kind: "accepted",
|
|
15618
|
-
role: "auditor",
|
|
15619
|
-
status: lawful.status,
|
|
15620
|
-
decisiveFacts: auditorDecisiveFacts(lawful)
|
|
15621
|
-
};
|
|
15622
|
-
return accepted;
|
|
15623
|
-
}
|
|
15388
|
+
toolName: AUDITOR_OUTPUT_TOOL_NAME
|
|
15624
15389
|
}, scope);
|
|
15625
15390
|
}
|
|
15626
15391
|
async function trySettleAuditorTerminalResult(admitted, authority, scope) {
|
|
@@ -15629,19 +15394,7 @@ async function trySettleAuditorTerminalResult(admitted, authority, scope) {
|
|
|
15629
15394
|
async function settleLawfulEvidenceChildTerminalResult(admitted, authority, scope) {
|
|
15630
15395
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
15631
15396
|
role: "evidence-child",
|
|
15632
|
-
toolName: EVIDENCE_CHILD_OUTPUT_TOOL_NAME
|
|
15633
|
-
nonUsableDiagnostic: "\u53D6\u8BC1\u56DE\u6267\u65E0\u62A5\u544A\u6B63\u6587",
|
|
15634
|
-
tryAcceptDetails: tryAcceptWithValidator(validateRecordedEvidenceChildOutput),
|
|
15635
|
-
projectAccepted: (sealed) => {
|
|
15636
|
-
const output = validateRecordedEvidenceChildOutput(sealed.decisiveFacts);
|
|
15637
|
-
const accepted = {
|
|
15638
|
-
kind: "accepted",
|
|
15639
|
-
role: "evidence-child",
|
|
15640
|
-
status: "report",
|
|
15641
|
-
decisiveFacts: evidenceChildDecisiveFacts(output)
|
|
15642
|
-
};
|
|
15643
|
-
return accepted;
|
|
15644
|
-
}
|
|
15397
|
+
toolName: EVIDENCE_CHILD_OUTPUT_TOOL_NAME
|
|
15645
15398
|
}, scope);
|
|
15646
15399
|
}
|
|
15647
15400
|
async function trySettleEvidenceChildTerminalResult(admitted, authority, scope) {
|
|
@@ -15982,7 +15735,6 @@ var init_settlement = __esm({
|
|
|
15982
15735
|
init_auditor_soul();
|
|
15983
15736
|
init_doctor_auditor();
|
|
15984
15737
|
init_judge_auditor();
|
|
15985
|
-
init_shape_unreadable_failure();
|
|
15986
15738
|
init_known_failure();
|
|
15987
15739
|
init_reviewer_dispatch_rejection();
|
|
15988
15740
|
init_run_lifecycle();
|
|
@@ -18141,31 +17893,19 @@ function tryReadComplianceCandidate(arguments_, usage) {
|
|
|
18141
17893
|
}
|
|
18142
17894
|
return void 0;
|
|
18143
17895
|
}
|
|
18144
|
-
|
|
18145
|
-
const
|
|
18146
|
-
|
|
18147
|
-
}
|
|
18148
|
-
function observationFromUnreadableCandidate(candidate) {
|
|
18149
|
-
if (typeof candidate !== "object" || candidate === null || Array.isArray(candidate)) {
|
|
18150
|
-
return {
|
|
18151
|
-
kind: "non-object-arguments",
|
|
18152
|
-
type: candidate === null ? "null" : Array.isArray(candidate) ? "array" : typeof candidate
|
|
18153
|
-
};
|
|
18154
|
-
}
|
|
18155
|
-
const status = candidate.status;
|
|
18156
|
-
return {
|
|
18157
|
-
kind: "object-status-unreadable",
|
|
18158
|
-
status: status === void 0 ? "missing" : "unknown"
|
|
18159
|
-
};
|
|
18160
|
-
}
|
|
18161
|
-
function unreadableDecision(candidate, usage) {
|
|
17896
|
+
function readComplianceCandidate(arguments_, usage) {
|
|
17897
|
+
const projected = tryReadComplianceCandidate(arguments_, usage);
|
|
17898
|
+
if (projected !== void 0) return projected;
|
|
18162
17899
|
return {
|
|
18163
|
-
status: "
|
|
18164
|
-
|
|
18165
|
-
candidate,
|
|
17900
|
+
status: "received",
|
|
17901
|
+
reply: arguments_,
|
|
18166
17902
|
...usage === void 0 ? {} : { usage }
|
|
18167
17903
|
};
|
|
18168
17904
|
}
|
|
17905
|
+
async function usageFromSummonedSession(summoned) {
|
|
17906
|
+
const { usageFromPublicSummon: usageFromPublicSummon2 } = await Promise.resolve().then(() => (init_session_assistant_usage(), session_assistant_usage_exports));
|
|
17907
|
+
return usageFromPublicSummon2(summoned);
|
|
17908
|
+
}
|
|
18169
17909
|
async function projectAuditorTerminal(summoned) {
|
|
18170
17910
|
const outcome = summoned.terminal?.roleOutcome;
|
|
18171
17911
|
if (outcome === void 0) {
|
|
@@ -18181,10 +17921,6 @@ async function projectAuditorTerminal(summoned) {
|
|
|
18181
17921
|
};
|
|
18182
17922
|
}
|
|
18183
17923
|
if (outcome.kind === "failure") {
|
|
18184
|
-
const shape = retainedShapeUnreadable(outcome.decisiveFacts);
|
|
18185
|
-
if (shape !== void 0) {
|
|
18186
|
-
return unreadableDecision(shape.candidate, usage);
|
|
18187
|
-
}
|
|
18188
17924
|
throw new Error(outcome.diagnostic);
|
|
18189
17925
|
}
|
|
18190
17926
|
if (outcome.kind === "accepted") {
|
|
@@ -18192,11 +17928,13 @@ async function projectAuditorTerminal(summoned) {
|
|
|
18192
17928
|
status: outcome.status,
|
|
18193
17929
|
...outcome.decisiveFacts
|
|
18194
17930
|
};
|
|
18195
|
-
|
|
18196
|
-
if (projected !== void 0) return projected;
|
|
18197
|
-
return unreadableDecision(candidate, usage);
|
|
17931
|
+
return readComplianceCandidate(candidate, usage);
|
|
18198
17932
|
}
|
|
18199
|
-
|
|
17933
|
+
return {
|
|
17934
|
+
status: "received",
|
|
17935
|
+
reply: outcome,
|
|
17936
|
+
...usage === void 0 ? {} : { usage }
|
|
17937
|
+
};
|
|
18200
17938
|
}
|
|
18201
17939
|
async function runComplianceAudit(options) {
|
|
18202
17940
|
const runDirectory = options.runDirectory ?? auditorRunDirectory(options.context);
|
|
@@ -18230,7 +17968,6 @@ var init_compliance_transport = __esm({
|
|
|
18230
17968
|
"src/compliance-transport.ts"() {
|
|
18231
17969
|
"use strict";
|
|
18232
17970
|
init_auditor_dossier_tool();
|
|
18233
|
-
init_shape_unreadable_failure();
|
|
18234
17971
|
AUDITOR_DOSSIER_PROMPT = "\u672C run \u5377\u5B97\u5DF2\u5C31\u7EEA\u3002";
|
|
18235
17972
|
nonblank2 = Type15.String({ minLength: 1, pattern: "\\S" });
|
|
18236
17973
|
decisionGateSchema = Type15.Object({ question: nonblank2, options: Type15.Array(nonblank2, { minItems: 1 }) }, { additionalProperties: false });
|
|
@@ -18804,11 +18541,7 @@ function createNativeNavigatorSessionFactory() {
|
|
|
18804
18541
|
return;
|
|
18805
18542
|
}
|
|
18806
18543
|
if (outcome.kind !== "accepted") {
|
|
18807
|
-
|
|
18808
|
-
throw navigatorUnavailableError(
|
|
18809
|
-
"session",
|
|
18810
|
-
new Error("Navigator public summon returned unusable terminal")
|
|
18811
|
-
);
|
|
18544
|
+
return;
|
|
18812
18545
|
}
|
|
18813
18546
|
const candidates = outcome.decisiveFacts.candidates;
|
|
18814
18547
|
if (!Array.isArray(candidates)) {
|
|
@@ -21216,7 +20949,7 @@ function createDoctorRoleRuntime(pi, dependencies, host) {
|
|
|
21216
20949
|
}
|
|
21217
20950
|
const details = testimony.status === "completed" ? { ...testimony, cost: activation.patient.cost } : testimony;
|
|
21218
20951
|
const acceptedDetails = details;
|
|
21219
|
-
return disposeComplianceDecision(audit, { pass: (usage) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_TEXT }], details: acceptedDetails, terminate: true, ...usage === void 0 ? {} : { usage } }), noReceipt: (auditNoReceipt, usageProjection) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_AUDIT_NO_RECEIPT_TEXT }], details: { ...acceptedDetails, auditNoReceipt }, terminate: true, ...usageProjection }),
|
|
20952
|
+
return disposeComplianceDecision(audit, { pass: (usage) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_TEXT }], details: acceptedDetails, terminate: true, ...usage === void 0 ? {} : { usage } }), noReceipt: (auditNoReceipt, usageProjection) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_AUDIT_NO_RECEIPT_TEXT }], details: { ...acceptedDetails, auditNoReceipt }, terminate: true, ...usageProjection }), received: (auditReceived, usageProjection) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_TEXT }], details: { ...acceptedDetails, audit: auditReceived.reply }, terminate: true, ...usageProjection }), bounce: (violations) => {
|
|
21220
20953
|
throw new Error(`\u592A\u533B\u7F72\u56DE\u6267\u8FDD soul\uFF1A${violations.join("; ")}`);
|
|
21221
20954
|
}, escalate: (result) => result }, acceptedDetails);
|
|
21222
20955
|
} });
|
|
@@ -21645,10 +21378,10 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
21645
21378
|
terminate: true,
|
|
21646
21379
|
...usageProjection
|
|
21647
21380
|
}),
|
|
21648
|
-
//
|
|
21649
|
-
|
|
21650
|
-
content: [{ type: "text", text:
|
|
21651
|
-
details: { ...acceptedDetails,
|
|
21381
|
+
// #757: parent stands with auditor raw reply — no unreadable judgment.
|
|
21382
|
+
received: (auditReceived, usageProjection) => ({
|
|
21383
|
+
content: [{ type: "text", text: JUDGE_ACCEPTED_TEXT }],
|
|
21384
|
+
details: { ...acceptedDetails, audit: auditReceived.reply },
|
|
21652
21385
|
terminate: true,
|
|
21653
21386
|
...usageProjection
|
|
21654
21387
|
}),
|