@akagilnc/pi-workflow-roles 0.1.3641 → 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.
Files changed (39) hide show
  1. package/dist/acp-host/production-host.js +125 -416
  2. package/dist/audit-escalation.js +5 -5
  3. package/dist/compliance-transport.js +11 -57
  4. package/dist/diarist-contracts.js +0 -12
  5. package/dist/doctor-contracts.js +0 -2
  6. package/dist/gleaner-left-contracts.js +0 -7
  7. package/dist/inspector-contracts.js +0 -4
  8. package/dist/navigator-public-session.js +1 -5
  9. package/dist/notary-contracts.js +0 -18
  10. package/dist/package-contracts/auditor-output.js +0 -13
  11. package/dist/package-contracts/evidence-child-output.js +0 -3
  12. package/dist/package-contracts/gatekeeper-output.js +0 -10
  13. package/dist/package-contracts/judge-output.js +0 -2
  14. package/dist/package-contracts/navigator-output.js +0 -4
  15. package/dist/public-cli/main.js +168 -698
  16. package/dist/public-cli/notary-run.js +5 -20
  17. package/dist/public-cli/post-admission.js +30 -23
  18. package/dist/public-cli/run-lifecycle.js +6 -14
  19. package/dist/public-cli/settlement.js +67 -528
  20. package/package.json +1 -1
  21. package/src/audit-escalation.ts +9 -9
  22. package/src/compliance-transport.ts +28 -94
  23. package/src/diarist-contracts.ts +0 -12
  24. package/src/doctor-contracts.ts +0 -1
  25. package/src/doctor-role.ts +2 -2
  26. package/src/gleaner-left-contracts.ts +0 -9
  27. package/src/inspector-contracts.ts +0 -8
  28. package/src/judge-role.ts +4 -5
  29. package/src/navigator-public-session.ts +4 -5
  30. package/src/notary-contracts.ts +0 -18
  31. package/src/package-contracts/auditor-output.ts +0 -11
  32. package/src/package-contracts/evidence-child-output.ts +0 -5
  33. package/src/package-contracts/gatekeeper-output.ts +0 -11
  34. package/src/package-contracts/judge-output.ts +0 -1
  35. package/src/package-contracts/navigator-output.ts +0 -3
  36. package/src/public-cli/notary-run.ts +6 -18
  37. package/src/public-cli/post-admission.ts +31 -37
  38. package/src/public-cli/run-lifecycle.ts +6 -17
  39. 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 isRecord4(value) {
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 (isRecord4(parsed) && parsed.identity === identity) {
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 isRecord5(value) {
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 (isRecord5(parsed)) {
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, JUDGE_ACCEPTED_AUDIT_UNREADABLE_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 isRecord6(value) {
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 (!isRecord6(value)) return void 0;
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 (!isRecord6(amendments)) return void 0;
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 (!isRecord6(acceptedBatch) || !isRecord6(construction) || !isRecord6(target) || !Array.isArray(legs))
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")) || !isRecord6(refs) || Object.values(refs).some((ref) => !isRecord6(ref) || !objectId(read(ref, "objectId")) || read(ref, "peeledCommitId") !== null && !objectId(read(ref, "peeledCommitId"))))
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 (!isRecord6(outcomes) || !isRecord6(reports)) throw new Error("Accepted Reviewer batch lacks outcomes or reports");
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 (!isRecord6(outcome)) throw new Error("Reviewer accepted leg lacks outcome");
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 "unreadable":
2355
- if (handlers.unreadable === void 0) {
2356
- throw new Error("Compliance unreadable projection handler is unavailable");
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.unreadable(
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 isRecord7(value) {
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 (!isRecord7(value)) return void 0;
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 (!isRecord7(assetEvidence)) {
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, DOCTOR_ACCEPTED_AUDIT_UNREADABLE_TEXT, DOCTOR_OUTPUT_TOOL_DESCRIPTION, DOCTOR_TARGET_KINDS, nonblank, count, evidenceIds, guardrail, lastRealBite, assetKinds, findingBody, finding, caseIdentity, cost, doctorSubmissionVariants, doctorSubmissionSchema, doctorOutputSchema, doctorEvidenceReadSchema, DoctorSubmissionContractError, DoctorEvidenceStore;
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 isRecord8(value) {
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 (!isRecord8(value)) return void 0;
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 isRecord9(value) {
2853
+ function isRecord8(value) {
2895
2854
  return typeof value === "object" && value !== null && !Array.isArray(value);
2896
2855
  }
2897
2856
  function projectLawfulNavigatorOutput(value) {
2898
- if (!isRecord9(value) || !Array.isArray(value.candidates)) return void 0;
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(isRecord9) };
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 isRecord10(value) {
2893
+ function isRecord9(value) {
2938
2894
  return typeof value === "object" && value !== null && !Array.isArray(value);
2939
2895
  }
2940
2896
  function projectLawfulAuditorOutput(value) {
2941
- if (!isRecord10(value)) return void 0;
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 isRecord11(value) {
2952
+ function isRecord10(value) {
3008
2953
  return typeof value === "object" && value !== null && !Array.isArray(value);
3009
2954
  }
3010
2955
  function projectLawfulEvidenceChildOutput(value) {
3011
- if (!isRecord11(value)) return void 0;
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 isRecord12(value) {
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 (!isRecord12(value)) return void 0;
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"() {
@@ -4226,13 +4148,6 @@ function instructResumeHandbookRead(prompt, engineMaterial) {
4226
4148
  return line2;
4227
4149
  }).join("\n");
4228
4150
  }
4229
- function appendResumeMaterialReread(prompt, materialPath) {
4230
- const instruction = resumeRereadInstruction(materialPath, false);
4231
- const lines = prompt.split("\n");
4232
- if (lines.includes(instruction)) return prompt;
4233
- return prompt.length === 0 ? instruction : `${prompt}
4234
- ${instruction}`;
4235
- }
4236
4151
  function selectResumeContinuationPrompt(message, engineMaterial) {
4237
4152
  const base = message !== void 0 ? message : RESUME_TRANSPORT_ENVELOPE;
4238
4153
  return instructResumeHandbookRead(
@@ -10046,11 +9961,11 @@ var init_reviewer_pinned_git = __esm({
10046
9961
  });
10047
9962
 
10048
9963
  // src/ticket-provenance-contracts.ts
10049
- function isRecord13(value) {
9964
+ function isRecord12(value) {
10050
9965
  return typeof value === "object" && value !== null && !Array.isArray(value);
10051
9966
  }
10052
9967
  function projectTicketProvenanceDiagnostic(value) {
10053
- if (!isRecord13(value)) return void 0;
9968
+ if (!isRecord12(value)) return void 0;
10054
9969
  if (value.recordClass !== TICKET_PROVENANCE_RECORD_CLASS_DIAGNOSTIC) {
10055
9970
  return void 0;
10056
9971
  }
@@ -10072,18 +9987,18 @@ function projectTicketProvenanceDiagnostic(value) {
10072
9987
  };
10073
9988
  }
10074
9989
  function projectTicketProvenanceEntry(value) {
10075
- if (!isRecord13(value)) return void 0;
9990
+ if (!isRecord12(value)) return void 0;
10076
9991
  if (value.recordClass === TICKET_PROVENANCE_RECORD_CLASS_DIAGNOSTIC) {
10077
9992
  return void 0;
10078
9993
  }
10079
- if (!isRecord13(value.basis)) return void 0;
9994
+ if (!isRecord12(value.basis)) return void 0;
10080
9995
  if (typeof value.basis.method !== "string" || !BASIS_METHODS.has(value.basis.method)) {
10081
9996
  return void 0;
10082
9997
  }
10083
9998
  if (typeof value.sourceKind !== "string" || !SOURCE_KINDS.has(value.sourceKind)) {
10084
9999
  return void 0;
10085
10000
  }
10086
- if (!isRecord13(value.sourceRef)) return void 0;
10001
+ if (!isRecord12(value.sourceRef)) return void 0;
10087
10002
  if (typeof value.transcript !== "string" || value.transcript.length === 0) {
10088
10003
  return void 0;
10089
10004
  }
@@ -10710,6 +10625,29 @@ var init_public_run_credentials = __esm({
10710
10625
  }
10711
10626
  });
10712
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
+
10713
10651
  // src/gatekeeper-role.ts
10714
10652
  function gateSeatLabel(stage) {
10715
10653
  return stage === "inspector" ? "\u5BDF\u9662" : "\u7B26\u5B9D\u90CE";
@@ -13762,9 +13700,6 @@ function classifyPackagedRoleTerminalResult(message) {
13762
13700
  }
13763
13701
  return { kind: "nonterminal" };
13764
13702
  }
13765
- function isAcceptedPackagedRoleTerminalResult(message) {
13766
- return classifyPackagedRoleTerminalResult(message).kind === "accepted";
13767
- }
13768
13703
  function durableTerminalAt(entries, index) {
13769
13704
  const entry = entries[index];
13770
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;
@@ -14841,91 +14776,11 @@ function auditNoReceiptDecisiveFact(candidate) {
14841
14776
  return {};
14842
14777
  }
14843
14778
  }
14844
- function auditUnreadableDecisiveFact(candidate) {
14845
- const projected = safelyRead(candidate, "auditUnreadable");
14846
- if (!projected.readable || projected.value === void 0) return {};
14847
- if (typeof projected.value !== "object" || projected.value === null || Array.isArray(projected.value)) {
14848
- return { auditUnreadable: projected.value };
14849
- }
14850
- return { auditUnreadable: projected.value };
14851
- }
14852
- function judgeDecisiveFacts(verdict, judgeStatus) {
14853
- const facts = {
14854
- judgeStatus,
14855
- ...auditNoReceiptDecisiveFact(verdict),
14856
- ...auditUnreadableDecisiveFact(verdict)
14857
- };
14858
- const statusBase = judgeStatus;
14859
- if (statusBase === "continue") {
14860
- const fix = safelyRead(verdict, "fix");
14861
- if (fix.readable && isRecord20(fix.value)) {
14862
- const summary = safelyRead(fix.value, "summary");
14863
- if (summary.readable && typeof summary.value === "string") {
14864
- facts.fixSummary = summary.value;
14865
- }
14866
- }
14867
- const classes = safelyRead(verdict, "classes");
14868
- if (classes.readable && Array.isArray(classes.value)) {
14869
- try {
14870
- facts.classes = classes.value.map((entry) => {
14871
- if (!isRecord20(entry)) throw new Error("unreadable Judge class");
14872
- return {
14873
- name: entry.name,
14874
- owner: entry.owner,
14875
- boundary: entry.boundary,
14876
- disposition: entry.disposition
14877
- };
14878
- });
14879
- facts.classCount = classes.value.length;
14880
- } catch {
14881
- }
14882
- }
14883
- }
14884
- if (statusBase === "escalate") {
14885
- const gate = safelyRead(verdict, "decisionGate");
14886
- if (gate.readable && isRecord20(gate.value)) {
14887
- const question = safelyRead(gate.value, "question");
14888
- const options = safelyRead(gate.value, "options");
14889
- if (question.readable && typeof question.value === "string") {
14890
- facts.decisionQuestion = question.value;
14891
- }
14892
- if (options.readable && Array.isArray(options.value)) {
14893
- facts.decisionOptions = [...options.value];
14894
- }
14895
- }
14896
- }
14897
- const note = safelyRead(verdict, "note");
14898
- if (note.readable && note.value !== void 0) facts.note = note.value;
14899
- const evidence = safelyRead(verdict, "evidence");
14900
- if (evidence.readable && evidence.value !== void 0) facts.evidence = evidence.value;
14901
- return facts;
14902
- }
14903
- function doctorDecisiveFacts(output) {
14904
- const candidate = output;
14905
- const status = safelyRead(candidate, "status");
14906
- const facts = {
14907
- ...auditNoReceiptDecisiveFact(candidate),
14908
- ...auditUnreadableDecisiveFact(candidate)
14779
+ function withAuditNoReceiptFacts(candidate) {
14780
+ return {
14781
+ ...candidate,
14782
+ ...auditNoReceiptDecisiveFact(candidate)
14909
14783
  };
14910
- if (status.readable && typeof status.value === "string") facts.doctorStatus = status.value;
14911
- const statusBase = status.readable && typeof status.value === "string" ? status.value : void 0;
14912
- if (statusBase === "refused") {
14913
- const reason = safelyRead(candidate, "reason");
14914
- if (reason.readable && reason.value !== void 0) facts.reason = reason.value;
14915
- const missing = safelyRead(candidate, "missingEvidence");
14916
- if (missing.readable && Array.isArray(missing.value)) facts.missingEvidenceCount = missing.value.length;
14917
- return facts;
14918
- }
14919
- const caseValue = safelyRead(candidate, "case");
14920
- if (caseValue.readable && isRecord20(caseValue.value)) {
14921
- const issueNumber = safelyRead(caseValue.value, "issueNumber");
14922
- const runsPath = safelyRead(caseValue.value, "runsPath");
14923
- if (issueNumber.readable && issueNumber.value !== void 0) facts.issueNumber = issueNumber.value;
14924
- if (runsPath.readable && runsPath.value !== void 0) facts.runsPath = runsPath.value;
14925
- }
14926
- const findings = safelyRead(candidate, "findings");
14927
- if (findings.readable && Array.isArray(findings.value)) facts.findingsCount = findings.value.length;
14928
- return facts;
14929
14784
  }
14930
14785
  function toolResultText(message) {
14931
14786
  const content = message.content;
@@ -15294,7 +15149,8 @@ async function readLawfulJudgeRoleOutcome(admitted, authority) {
15294
15149
  kind: "accepted",
15295
15150
  role: "judge",
15296
15151
  status: sealed.status,
15297
- decisiveFacts: judgeDecisiveFacts(details, sealed.status)
15152
+ // #757: sealed details pass through (judgeStatus already on the receipt).
15153
+ decisiveFacts: withAuditNoReceiptFacts(details)
15298
15154
  };
15299
15155
  }
15300
15156
  return auditEscalationLedgerOutcome(admitted, "judge");
@@ -15392,12 +15248,12 @@ async function settleLawfulDoctorTerminalResult(admitted, authority) {
15392
15248
  sessionDirectory
15393
15249
  );
15394
15250
  }
15395
- const output = validateRecordedDoctorOutput(sealed.decisiveFacts);
15251
+ const output = sealed.decisiveFacts;
15396
15252
  const roleOutcome = {
15397
15253
  kind: "accepted",
15398
15254
  role: "doctor",
15399
15255
  status: sealed.status,
15400
- decisiveFacts: doctorDecisiveFacts(output)
15256
+ decisiveFacts: { ...sealed.decisiveFacts }
15401
15257
  };
15402
15258
  if (String(output.status) === "completed") {
15403
15259
  const completedCase = output.case;
@@ -15458,7 +15314,6 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
15458
15314
  }
15459
15315
  if (roleOutcome?.role !== spec.role) {
15460
15316
  const scanStart = currentAttemptStartIndex(entries);
15461
- let acceptedNonUsable;
15462
15317
  for (let index = entries.length - 1; index >= scanStart; index -= 1) {
15463
15318
  const message = entries[index]?.message;
15464
15319
  if (message?.role !== "toolResult") continue;
@@ -15469,39 +15324,17 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
15469
15324
  spec.toolName
15470
15325
  );
15471
15326
  if (residual !== void 0) {
15327
+ const details = isRecord20(residual.candidate) ? residual.candidate : { candidate: residual.candidate };
15472
15328
  return settleFailureTerminalResult(admitted, {
15473
15329
  cause: "output",
15474
15330
  diagnostic: residual.diagnostic,
15475
- details: stampShapeUnreadableDetails(residual.candidate)
15331
+ details
15476
15332
  }, authority);
15477
15333
  }
15478
- if (acceptedNonUsable === void 0 && message.toolName === spec.toolName && isAcceptedPackagedRoleTerminalResult(message)) {
15479
- if (!spec.tryAcceptDetails(message.details)) {
15480
- acceptedNonUsable = message.details;
15481
- }
15482
- }
15483
- }
15484
- if (acceptedNonUsable !== void 0) {
15485
- return settleFailureTerminalResult(admitted, {
15486
- cause: "output",
15487
- diagnostic: spec.nonUsableDiagnostic,
15488
- details: stampShapeUnreadableDetails(acceptedNonUsable)
15489
- }, authority);
15490
15334
  }
15491
15335
  return void 0;
15492
15336
  }
15493
- if (!spec.tryAcceptDetails(roleOutcome.decisiveFacts)) {
15494
- return settleFailureTerminalResult(
15495
- admitted,
15496
- {
15497
- cause: "output",
15498
- diagnostic: spec.nonUsableDiagnostic,
15499
- details: stampShapeUnreadableDetails(roleOutcome.decisiveFacts)
15500
- },
15501
- authority
15502
- );
15503
- }
15504
- const acceptedOutcome = spec.projectAccepted(roleOutcome);
15337
+ const acceptedOutcome = roleOutcome;
15505
15338
  const navigator = extractNavigatorFact(entries);
15506
15339
  return withOptionalGateProjection(
15507
15340
  {
@@ -15513,32 +15346,10 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
15513
15346
  sessionDirectory
15514
15347
  );
15515
15348
  }
15516
- function tryAcceptWithValidator(validate) {
15517
- return (details) => {
15518
- try {
15519
- validate(details);
15520
- return true;
15521
- } catch {
15522
- return false;
15523
- }
15524
- };
15525
- }
15526
15349
  async function settleLawfulNotaryTerminalResult(admitted, authority, scope) {
15527
15350
  return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
15528
15351
  role: "notary",
15529
- toolName: NOTARY_OUTPUT_TOOL_NAME,
15530
- nonUsableDiagnostic: "\u7B26\u5B9D\u90CE\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
15531
- tryAcceptDetails: tryAcceptWithValidator(validateRecordedNotaryOutput),
15532
- projectAccepted: (sealed) => {
15533
- const output = validateRecordedNotaryOutput(sealed.decisiveFacts);
15534
- const accepted = {
15535
- kind: "accepted",
15536
- role: "notary",
15537
- status: sealed.status,
15538
- decisiveFacts: notaryDecisiveFacts(output)
15539
- };
15540
- return accepted;
15541
- }
15352
+ toolName: NOTARY_OUTPUT_TOOL_NAME
15542
15353
  }, scope);
15543
15354
  }
15544
15355
  async function trySettleNotaryTerminalResult(admitted, authority, scope) {
@@ -15547,19 +15358,7 @@ async function trySettleNotaryTerminalResult(admitted, authority, scope) {
15547
15358
  async function settleLawfulInspectorTerminalResult(admitted, authority, scope) {
15548
15359
  return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
15549
15360
  role: "inspector",
15550
- toolName: INSPECTOR_OUTPUT_TOOL_NAME,
15551
- nonUsableDiagnostic: "\u5BDF\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
15552
- tryAcceptDetails: tryAcceptWithValidator(validateRecordedInspectorOutput),
15553
- projectAccepted: (sealed) => {
15554
- const output = validateRecordedInspectorOutput(sealed.decisiveFacts);
15555
- const accepted = {
15556
- kind: "accepted",
15557
- role: "inspector",
15558
- status: sealed.status,
15559
- decisiveFacts: inspectorDecisiveFacts(output)
15560
- };
15561
- return accepted;
15562
- }
15361
+ toolName: INSPECTOR_OUTPUT_TOOL_NAME
15563
15362
  }, scope);
15564
15363
  }
15565
15364
  async function trySettleInspectorTerminalResult(admitted, authority, scope) {
@@ -15568,19 +15367,7 @@ async function trySettleInspectorTerminalResult(admitted, authority, scope) {
15568
15367
  async function settleLawfulGatekeeperTerminalResult(admitted, authority, scope) {
15569
15368
  return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
15570
15369
  role: "gatekeeper",
15571
- toolName: GATEKEEPER_OUTPUT_TOOL_NAME,
15572
- nonUsableDiagnostic: "\u95E8\u4E0B\u7701\u51B3\u8BAE\u65E0\u663E\u5F0F dispatch/pass",
15573
- tryAcceptDetails: tryAcceptWithValidator(validateRecordedGatekeeperOutput),
15574
- projectAccepted: (sealed) => {
15575
- const output = validateRecordedGatekeeperOutput(sealed.decisiveFacts);
15576
- const accepted = {
15577
- kind: "accepted",
15578
- role: "gatekeeper",
15579
- status: output.status,
15580
- decisiveFacts: gatekeeperDecisiveFacts(output)
15581
- };
15582
- return accepted;
15583
- }
15370
+ toolName: GATEKEEPER_OUTPUT_TOOL_NAME
15584
15371
  }, scope);
15585
15372
  }
15586
15373
  async function trySettleGatekeeperTerminalResult(admitted, authority, scope) {
@@ -15589,19 +15376,7 @@ async function trySettleGatekeeperTerminalResult(admitted, authority, scope) {
15589
15376
  async function settleLawfulNavigatorTerminalResult(admitted, authority, scope) {
15590
15377
  return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
15591
15378
  role: "navigator",
15592
- toolName: NAVIGATOR_OUTPUT_TOOL_NAME,
15593
- nonUsableDiagnostic: "\u6E38\u5955\u4F7F\u56DE\u6267\u65E0\u663E\u5F0F\u8DEF\u7EBF\u5EFA\u8BAE",
15594
- tryAcceptDetails: tryAcceptWithValidator(validateRecordedNavigatorOutput),
15595
- projectAccepted: (sealed) => {
15596
- const output = validateRecordedNavigatorOutput(sealed.decisiveFacts);
15597
- const accepted = {
15598
- kind: "accepted",
15599
- role: "navigator",
15600
- status: "advice",
15601
- decisiveFacts: navigatorDecisiveFacts(output)
15602
- };
15603
- return accepted;
15604
- }
15379
+ toolName: NAVIGATOR_OUTPUT_TOOL_NAME
15605
15380
  }, scope);
15606
15381
  }
15607
15382
  async function trySettleNavigatorTerminalResult(admitted, authority, scope) {
@@ -15610,24 +15385,7 @@ async function trySettleNavigatorTerminalResult(admitted, authority, scope) {
15610
15385
  async function settleLawfulAuditorTerminalResult(admitted, authority, scope) {
15611
15386
  return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
15612
15387
  role: "auditor",
15613
- toolName: AUDITOR_OUTPUT_TOOL_NAME,
15614
- nonUsableDiagnostic: "\u5BA1\u5211\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
15615
- // Only pass/bounce/escalate are lawful releases. Unreadable mystery status
15616
- // fails closed with candidate retained for parent ComplianceCandidateUnreadableError.
15617
- tryAcceptDetails: (details) => projectLawfulAuditorOutput(details) !== void 0,
15618
- projectAccepted: (sealed) => {
15619
- const lawful = projectLawfulAuditorOutput(sealed.decisiveFacts);
15620
- if (lawful === void 0) {
15621
- throw new Error("auditor projectAccepted requires lawful pass/bounce/escalate");
15622
- }
15623
- const accepted = {
15624
- kind: "accepted",
15625
- role: "auditor",
15626
- status: lawful.status,
15627
- decisiveFacts: auditorDecisiveFacts(lawful)
15628
- };
15629
- return accepted;
15630
- }
15388
+ toolName: AUDITOR_OUTPUT_TOOL_NAME
15631
15389
  }, scope);
15632
15390
  }
15633
15391
  async function trySettleAuditorTerminalResult(admitted, authority, scope) {
@@ -15636,19 +15394,7 @@ async function trySettleAuditorTerminalResult(admitted, authority, scope) {
15636
15394
  async function settleLawfulEvidenceChildTerminalResult(admitted, authority, scope) {
15637
15395
  return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
15638
15396
  role: "evidence-child",
15639
- toolName: EVIDENCE_CHILD_OUTPUT_TOOL_NAME,
15640
- nonUsableDiagnostic: "\u53D6\u8BC1\u56DE\u6267\u65E0\u62A5\u544A\u6B63\u6587",
15641
- tryAcceptDetails: tryAcceptWithValidator(validateRecordedEvidenceChildOutput),
15642
- projectAccepted: (sealed) => {
15643
- const output = validateRecordedEvidenceChildOutput(sealed.decisiveFacts);
15644
- const accepted = {
15645
- kind: "accepted",
15646
- role: "evidence-child",
15647
- status: "report",
15648
- decisiveFacts: evidenceChildDecisiveFacts(output)
15649
- };
15650
- return accepted;
15651
- }
15397
+ toolName: EVIDENCE_CHILD_OUTPUT_TOOL_NAME
15652
15398
  }, scope);
15653
15399
  }
15654
15400
  async function trySettleEvidenceChildTerminalResult(admitted, authority, scope) {
@@ -15989,7 +15735,6 @@ var init_settlement = __esm({
15989
15735
  init_auditor_soul();
15990
15736
  init_doctor_auditor();
15991
15737
  init_judge_auditor();
15992
- init_shape_unreadable_failure();
15993
15738
  init_known_failure();
15994
15739
  init_reviewer_dispatch_rejection();
15995
15740
  init_run_lifecycle();
@@ -16592,24 +16337,16 @@ async function dispatchPostAdmissionTurn(input) {
16592
16337
  }
16593
16338
  }
16594
16339
  function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepared) {
16595
- const engineMaterial = engineSessionMaterialFromOptions({
16596
- ...env.engine === void 0 ? {} : { engine: env.engine },
16597
- packageRoot: env.packageRoot
16598
- });
16599
16340
  let prompt;
16600
16341
  if (request.message !== void 0) {
16601
- if (summonsPrepared !== void 0 && summonsPrepared.attachments.length > 0) {
16602
- prompt = instructResumeHandbookRead(
16603
- buildInstructionTransportPrompt(
16604
- {
16605
- instruction: request.message,
16606
- instructionEmpty: false,
16607
- attachments: summonsPrepared.attachments
16608
- },
16609
- engineMaterial
16610
- ),
16611
- engineMaterial
16612
- );
16342
+ if (summonsPrepared !== void 0) {
16343
+ prompt = buildInstructionTransportPrompt({
16344
+ instruction: request.message,
16345
+ instructionEmpty: false,
16346
+ attachments: summonsPrepared.attachments
16347
+ });
16348
+ } else if (request.summons !== void 0) {
16349
+ prompt = request.message;
16613
16350
  } else {
16614
16351
  prompt = buildResumeContinuationPrompt({
16615
16352
  packageRoot: env.packageRoot,
@@ -16618,10 +16355,9 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
16618
16355
  });
16619
16356
  }
16620
16357
  } else if (summonsPrepared !== void 0) {
16621
- prompt = instructResumeHandbookRead(
16622
- buildInstructionTransportPrompt(summonsPrepared, engineMaterial),
16623
- engineMaterial
16624
- );
16358
+ prompt = buildInstructionTransportPrompt(summonsPrepared);
16359
+ } else if (request.summons !== void 0) {
16360
+ prompt = RESUME_TRANSPORT_ENVELOPE;
16625
16361
  } else {
16626
16362
  prompt = buildResumeContinuationPrompt({
16627
16363
  packageRoot: env.packageRoot,
@@ -16936,7 +16672,6 @@ var init_post_admission = __esm({
16936
16672
  init_cli_errors();
16937
16673
  init_invocation();
16938
16674
  init_activation_ledger_topology();
16939
- init_engine_material();
16940
16675
  init_host_transition_prior_native();
16941
16676
  init_public_run_credentials();
16942
16677
  init_run_lifecycle();
@@ -16981,7 +16716,6 @@ __export(notary_run_exports, {
16981
16716
  runPublicNotary: () => runPublicNotary,
16982
16717
  runPublicNotaryResume: () => runPublicNotaryResume
16983
16718
  });
16984
- import { existsSync as existsSync9 } from "node:fs";
16985
16719
  function buildNotaryTurnRequest(admitted, options) {
16986
16720
  return projectRoleTurnRequest(
16987
16721
  admitted,
@@ -17123,19 +16857,14 @@ async function runPublicNotaryResume(request, env, io) {
17123
16857
  }
17124
16858
  return loaded;
17125
16859
  },
17126
- buildTurnRequest: (admitted, effective) => {
17127
- const projection = resumeTurnRequestProjectionOptions(
16860
+ buildTurnRequest: (admitted, effective) => (
16861
+ // #755: review continuation is plain dialogue / resume envelope — no
16862
+ //「重新读」candidate line, no engine handbook packaging.
16863
+ buildNotaryTurnRequest(
17128
16864
  admitted,
17129
- effective,
17130
- env
17131
- );
17132
- const candidatePath = gateSubmissionCandidatePath(admitted.sourceRunPath);
17133
- const prompt = existsSync9(candidatePath) ? appendResumeMaterialReread(projection.continuation.prompt, candidatePath) : projection.continuation.prompt;
17134
- return buildNotaryTurnRequest(admitted, {
17135
- ...projection,
17136
- continuation: { kind: "resume", prompt }
17137
- });
17138
- },
16865
+ resumeTurnRequestProjectionOptions(admitted, effective, env)
16866
+ )
16867
+ ),
17139
16868
  adapters: notaryAdapters(),
17140
16869
  ...env.engine === void 0 ? {} : { effectiveEngine: env.engine }
17141
16870
  });
@@ -17143,7 +16872,6 @@ async function runPublicNotaryResume(request, env, io) {
17143
16872
  var init_notary_run = __esm({
17144
16873
  "src/public-cli/notary-run.ts"() {
17145
16874
  "use strict";
17146
- init_auditor_dossier_tool();
17147
16875
  init_notary_source_run();
17148
16876
  init_engine_material();
17149
16877
  init_cli_errors();
@@ -17840,7 +17568,7 @@ __export(public_role_summons_exports, {
17840
17568
  summonGateOfficer: () => summonGateOfficer,
17841
17569
  summonPublicRole: () => summonPublicRole
17842
17570
  });
17843
- import { existsSync as existsSync10 } from "node:fs";
17571
+ import { existsSync as existsSync9 } from "node:fs";
17844
17572
  import { join as join27 } from "node:path";
17845
17573
  function createCapturingIo() {
17846
17574
  const chunks = [];
@@ -17864,7 +17592,7 @@ function parentDir(path) {
17864
17592
  function walkPackageRoot(start) {
17865
17593
  let dir = start;
17866
17594
  for (let i = 0; i < 12; i += 1) {
17867
- if (existsSync10(join27(dir, "package.json")) && existsSync10(join27(dir, "souls"))) {
17595
+ if (existsSync9(join27(dir, "package.json")) && existsSync9(join27(dir, "souls"))) {
17868
17596
  return dir;
17869
17597
  }
17870
17598
  const parent = parentDir(dir);
@@ -18165,31 +17893,19 @@ function tryReadComplianceCandidate(arguments_, usage) {
18165
17893
  }
18166
17894
  return void 0;
18167
17895
  }
18168
- async function usageFromSummonedSession(summoned) {
18169
- const { usageFromPublicSummon: usageFromPublicSummon2 } = await Promise.resolve().then(() => (init_session_assistant_usage(), session_assistant_usage_exports));
18170
- return usageFromPublicSummon2(summoned);
18171
- }
18172
- function observationFromUnreadableCandidate(candidate) {
18173
- if (typeof candidate !== "object" || candidate === null || Array.isArray(candidate)) {
18174
- return {
18175
- kind: "non-object-arguments",
18176
- type: candidate === null ? "null" : Array.isArray(candidate) ? "array" : typeof candidate
18177
- };
18178
- }
18179
- const status = candidate.status;
18180
- return {
18181
- kind: "object-status-unreadable",
18182
- status: status === void 0 ? "missing" : "unknown"
18183
- };
18184
- }
18185
- function unreadableDecision(candidate, usage) {
17896
+ function readComplianceCandidate(arguments_, usage) {
17897
+ const projected = tryReadComplianceCandidate(arguments_, usage);
17898
+ if (projected !== void 0) return projected;
18186
17899
  return {
18187
- status: "unreadable",
18188
- observation: observationFromUnreadableCandidate(candidate),
18189
- candidate,
17900
+ status: "received",
17901
+ reply: arguments_,
18190
17902
  ...usage === void 0 ? {} : { usage }
18191
17903
  };
18192
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
+ }
18193
17909
  async function projectAuditorTerminal(summoned) {
18194
17910
  const outcome = summoned.terminal?.roleOutcome;
18195
17911
  if (outcome === void 0) {
@@ -18205,10 +17921,6 @@ async function projectAuditorTerminal(summoned) {
18205
17921
  };
18206
17922
  }
18207
17923
  if (outcome.kind === "failure") {
18208
- const shape = retainedShapeUnreadable(outcome.decisiveFacts);
18209
- if (shape !== void 0) {
18210
- return unreadableDecision(shape.candidate, usage);
18211
- }
18212
17924
  throw new Error(outcome.diagnostic);
18213
17925
  }
18214
17926
  if (outcome.kind === "accepted") {
@@ -18216,11 +17928,13 @@ async function projectAuditorTerminal(summoned) {
18216
17928
  status: outcome.status,
18217
17929
  ...outcome.decisiveFacts
18218
17930
  };
18219
- const projected = tryReadComplianceCandidate(candidate, usage);
18220
- if (projected !== void 0) return projected;
18221
- return unreadableDecision(candidate, usage);
17931
+ return readComplianceCandidate(candidate, usage);
18222
17932
  }
18223
- throw new Error("Auditor public summon returned unusable terminal kind");
17933
+ return {
17934
+ status: "received",
17935
+ reply: outcome,
17936
+ ...usage === void 0 ? {} : { usage }
17937
+ };
18224
17938
  }
18225
17939
  async function runComplianceAudit(options) {
18226
17940
  const runDirectory = options.runDirectory ?? auditorRunDirectory(options.context);
@@ -18254,7 +17968,6 @@ var init_compliance_transport = __esm({
18254
17968
  "src/compliance-transport.ts"() {
18255
17969
  "use strict";
18256
17970
  init_auditor_dossier_tool();
18257
- init_shape_unreadable_failure();
18258
17971
  AUDITOR_DOSSIER_PROMPT = "\u672C run \u5377\u5B97\u5DF2\u5C31\u7EEA\u3002";
18259
17972
  nonblank2 = Type15.String({ minLength: 1, pattern: "\\S" });
18260
17973
  decisionGateSchema = Type15.Object({ question: nonblank2, options: Type15.Array(nonblank2, { minItems: 1 }) }, { additionalProperties: false });
@@ -18325,7 +18038,7 @@ __export(archivist_record_entry_exports, {
18325
18038
  createRecordSessionOpen: () => createRecordSessionOpen,
18326
18039
  subjectKeyedRecordDirectory: () => subjectKeyedRecordDirectory
18327
18040
  });
18328
- import { existsSync as existsSync11, mkdirSync as mkdirSync4, readFileSync as readFileSync5, realpathSync as realpathSync2, writeFileSync as writeFileSync5 } from "node:fs";
18041
+ import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync5, realpathSync as realpathSync2, writeFileSync as writeFileSync5 } from "node:fs";
18329
18042
  import { dirname as dirname13, resolve as resolve13, join as join29 } from "node:path";
18330
18043
  import { SessionManager } from "@earendil-works/pi-coding-agent";
18331
18044
  function readCurrentSession(sessionDir) {
@@ -18408,7 +18121,7 @@ function createRecordSessionOpen(options) {
18408
18121
  sessionDir = physicallyContainedIn(ledgerHome, parentResolved) ? join29(dirname13(parentResolved), options.kind) : join29(activationBookDirectory(ledgerHome, resolveBookKeyFromGit(cwd)), options.kind);
18409
18122
  parentSession = parentFile;
18410
18123
  }
18411
- const nestAlreadyExists = existsSync11(sessionDir);
18124
+ const nestAlreadyExists = existsSync10(sessionDir);
18412
18125
  ensureRealDirectoryTree(ledgerHome, sessionDir);
18413
18126
  const mayResumeSameNest = options.subject !== void 0 || options.kind === WORKER_SUBMISSION_GATE_KIND;
18414
18127
  if (mayResumeSameNest && nestAlreadyExists) {
@@ -18426,7 +18139,7 @@ function createRecordSessionOpen(options) {
18426
18139
  );
18427
18140
  if (session.isPersisted()) {
18428
18141
  const file = session.getSessionFile();
18429
- if (file !== void 0 && !existsSync11(file)) {
18142
+ if (file !== void 0 && !existsSync10(file)) {
18430
18143
  const header = session.getHeader();
18431
18144
  if (header !== null && header.type === "session") {
18432
18145
  writeFileSync5(file, `${JSON.stringify(header)}
@@ -18828,11 +18541,7 @@ function createNativeNavigatorSessionFactory() {
18828
18541
  return;
18829
18542
  }
18830
18543
  if (outcome.kind !== "accepted") {
18831
- providerFailure = { source: "session", cause: "session" };
18832
- throw navigatorUnavailableError(
18833
- "session",
18834
- new Error("Navigator public summon returned unusable terminal")
18835
- );
18544
+ return;
18836
18545
  }
18837
18546
  const candidates = outcome.decisiveFacts.candidates;
18838
18547
  if (!Array.isArray(candidates)) {
@@ -21240,7 +20949,7 @@ function createDoctorRoleRuntime(pi, dependencies, host) {
21240
20949
  }
21241
20950
  const details = testimony.status === "completed" ? { ...testimony, cost: activation.patient.cost } : testimony;
21242
20951
  const acceptedDetails = details;
21243
- 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 }), unreadable: (auditUnreadable, usageProjection) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_AUDIT_UNREADABLE_TEXT }], details: { ...acceptedDetails, auditUnreadable }, terminate: true, ...usageProjection }), bounce: (violations) => {
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) => {
21244
20953
  throw new Error(`\u592A\u533B\u7F72\u56DE\u6267\u8FDD soul\uFF1A${violations.join("; ")}`);
21245
20954
  }, escalate: (result) => result }, acceptedDetails);
21246
20955
  } });
@@ -21669,10 +21378,10 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
21669
21378
  terminate: true,
21670
21379
  ...usageProjection
21671
21380
  }),
21672
- // ADR 0055: parent stands with typed unreadable audit fact — not forged pass.
21673
- unreadable: (auditUnreadable, usageProjection) => ({
21674
- content: [{ type: "text", text: JUDGE_ACCEPTED_AUDIT_UNREADABLE_TEXT }],
21675
- details: { ...acceptedDetails, auditUnreadable },
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 },
21676
21385
  terminate: true,
21677
21386
  ...usageProjection
21678
21387
  }),
@@ -22076,7 +21785,7 @@ init_sitian_facade();
22076
21785
  init_submission_errors();
22077
21786
  init_submission_errors();
22078
21787
  import { execFileSync as execFileSync4 } from "node:child_process";
22079
- import { existsSync as existsSync12, lstatSync as lstatSync3, readdirSync as readdirSync2, readFileSync as readFileSync6, rmdirSync, rmSync } from "node:fs";
21788
+ import { existsSync as existsSync11, lstatSync as lstatSync3, readdirSync as readdirSync2, readFileSync as readFileSync6, rmdirSync, rmSync } from "node:fs";
22080
21789
  import { resolve as resolve18 } from "node:path";
22081
21790
  var WORKER_SUBMISSION_GATE_RECORD_KIND = WORKER_SUBMISSION_GATE_KIND;
22082
21791
  var WORKER_COMMIT_BASELINE_ENTRY_TYPE = "commit-baseline";
@@ -22107,7 +21816,7 @@ function statusOf(error) {
22107
21816
  return typeof error === "object" && error !== null && "status" in error ? error.status : void 0;
22108
21817
  }
22109
21818
  function tryGetAll(file, key) {
22110
- if (!existsSync12(file)) return [];
21819
+ if (!existsSync11(file)) return [];
22111
21820
  try {
22112
21821
  const out = gitFile(file, ["--get-all", key]);
22113
21822
  return out.length === 0 ? [] : out.split("\n");
@@ -22117,7 +21826,7 @@ function tryGetAll(file, key) {
22117
21826
  }
22118
21827
  }
22119
21828
  function ownedHook(path) {
22120
- if (!existsSync12(path)) return false;
21829
+ if (!existsSync11(path)) return false;
22121
21830
  return readFileSync6(path, "utf8").includes(HOOK_MARKER);
22122
21831
  }
22123
21832
  function escapeGitConfigValueRegex(value) {
@@ -22144,11 +21853,11 @@ function rmOwnedDir(dir) {
22144
21853
  const hookPath = resolve18(dir, HOOK_FILE);
22145
21854
  if (!ownedHook(hookPath)) return;
22146
21855
  rmSync(hookPath, { force: true });
22147
- if (existsSync12(dir) && readdirSync2(dir).length === 0) rmdirSync(dir);
21856
+ if (existsSync11(dir) && readdirSync2(dir).length === 0) rmdirSync(dir);
22148
21857
  }
22149
21858
  function linkedGitDirs(commonDir) {
22150
21859
  const root = resolve18(commonDir, "worktrees");
22151
- if (!existsSync12(root)) return [];
21860
+ if (!existsSync11(root)) return [];
22152
21861
  return readdirSync2(root).map((name) => resolve18(root, name)).filter((dir) => lstatSync3(dir).isDirectory());
22153
21862
  }
22154
21863
  function uninstallPackageWorkerHooks(cwd) {