@akagilnc/pi-workflow-roles 0.1.4956 → 0.1.4977

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.
@@ -1,4 +1,3 @@
1
- import { readableGateItem } from "./readable-gate-item.js";
2
1
  import { GatekeeperDecisionError } from "./submission-errors.js";
3
2
  export const AUDIT_ESCALATION_KIND = "audit_escalation";
4
3
  // Live Navigator settlement may consume only the projection produced by this
@@ -18,6 +17,9 @@ export function buildAuditEscalationResult(decision, deliveredOutput) {
18
17
  const auditOwned = {
19
18
  kind: AUDIT_ESCALATION_KIND,
20
19
  };
20
+ if (Object.hasOwn(decision, "receipt")) {
21
+ auditOwned.receipt = decision.receipt;
22
+ }
21
23
  if (Object.hasOwn(decision, "conflicts")) {
22
24
  auditOwned.conflicts = decision.conflicts;
23
25
  }
@@ -49,9 +51,8 @@ export function isAuditEscalationProjection(value) {
49
51
  }
50
52
  export function projectAuditEscalation(decision, deliveredOutput) {
51
53
  const details = buildAuditEscalationResult(decision, deliveredOutput);
52
- const original = deliveredOutput !== undefined ? deliveredOutput : decision;
53
54
  return {
54
- content: [{ type: "text", text: readableGateItem(original) }],
55
+ content: [],
55
56
  details,
56
57
  terminate: true,
57
58
  ...(decision.usage === undefined ? {} : { usage: decision.usage }),
@@ -1,6 +1,7 @@
1
1
  import { auditorRunDirectory } from "./auditor-dossier-tool.js";
2
2
  import { OFFICER_CONCLUSION_REASK } from "./gatekeeper-role.js";
3
3
  import { coalesceSubmissionRows } from "./public-cli/terminal.js";
4
+ import { readableGateItem } from "./readable-gate-item.js";
4
5
  const AUDITOR_DOSSIER_PROMPT = "\u5377\u5B97\u6307\u9488\uFF1A";
5
6
  const COMPLIANCE_RESPONSE_ENTRY_TYPE = "ak_compliance_response";
6
7
  const AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE = "ak_auditor_parent_attempt_binding";
@@ -81,15 +82,7 @@ async function projectAuditorTerminal(summoned) {
81
82
  if (rows.length === 0) {
82
83
  return readComplianceCandidate({}, usage);
83
84
  }
84
- const decision = readComplianceCandidate(rows[rows.length - 1], usage);
85
- if (rows.length === 1) return decision;
86
- if (decision.status === "pass" || decision.status === "bounce" || decision.status === "escalate") {
87
- return { ...decision, receipt: rows };
88
- }
89
- if (decision.status === "received") {
90
- return { ...decision, reply: rows };
91
- }
92
- return decision;
85
+ return readComplianceCandidate(rows[rows.length - 1], usage);
93
86
  }
94
87
  return {
95
88
  status: "received",
@@ -103,6 +96,7 @@ async function runComplianceAudit(options) {
103
96
  throw new Error("Compliance audit requires a parent run directory pointer");
104
97
  }
105
98
  const subject = options.subject;
99
+ const submission = options.submission === void 0 ? void 0 : readableGateItem(options.submission);
106
100
  const summon = options.summonAuditor ?? (async (auditSubject, sourceRunDirectory, auditSignal, reask2) => {
107
101
  const { summonPublicRole } = await import("./public-role-summons.js");
108
102
  const { homeFromRunDirectory } = await import("./activation-ledger-topology.js");
@@ -119,12 +113,13 @@ async function runComplianceAudit(options) {
119
113
  cwd: options.context.cwd ?? process.cwd(),
120
114
  home,
121
115
  ...auditSignal === void 0 ? {} : { signal: auditSignal },
122
- ...reask2 === void 0 ? {} : { reviewReask: reask2 }
116
+ ...reask2 === void 0 ? {} : { reviewReask: reask2 },
117
+ ...submission === void 0 ? {} : { gateReviewInstruction: submission }
123
118
  });
124
119
  });
125
120
  let reask;
126
121
  for (; ; ) {
127
- const summoned = await summon(subject, runDirectory, options.signal, reask);
122
+ const summoned = await summon(subject, runDirectory, options.signal, reask, submission);
128
123
  const decision = await projectAuditorTerminal(summoned);
129
124
  if (decision.status === "received") {
130
125
  reask = OFFICER_CONCLUSION_REASK;
@@ -5,7 +5,6 @@ import { withTerminatingOutputDeclarations } from "./package-contracts/terminati
5
5
  const DOCTOR_EVIDENCE_TOOL_NAME = "ak_doctor_evidence";
6
6
  const DOCTOR_OUTPUT_TOOL_NAME = "ak_doctor_output";
7
7
  const DOCTOR_AUDIT_TOOL_NAME = "ak_doctor_audit_decision";
8
- const DOCTOR_ACCEPTED_AUDIT_NO_RECEIPT_TEXT = "\u592A\u533B\u7F72\u56DE\u6267\u5DF2\u63A5\u53D7\uFF1B\u5BA1\u8BA1\u65E0\u56DE\u6267";
9
8
  const DOCTOR_OUTPUT_TOOL_DESCRIPTION = "\u63D0\u4EA4\u552F\u4E00\u7EC8\u5C40\u5355\u6848\u8BC1\u8BCD\uFF1Bcompleted \u5141\u8BB8\u7A7A findings\u3002";
10
9
  const DOCTOR_TARGET_KINDS = ["law", "gate", "template", "station", "seat"];
11
10
  const nonblank = Type.Optional(Type.String());
@@ -115,7 +114,6 @@ function validateDoctorOutput(value, _patient, _store) {
115
114
  return validateDoctorSubmissionShape(value);
116
115
  }
117
116
  export {
118
- DOCTOR_ACCEPTED_AUDIT_NO_RECEIPT_TEXT,
119
117
  DOCTOR_AUDIT_TOOL_NAME,
120
118
  DOCTOR_EVIDENCE_TOOL_NAME,
121
119
  DOCTOR_OUTPUT_TOOL_DESCRIPTION,
@@ -214,7 +214,9 @@ function projectOfficerTerminal(officer, summoned) {
214
214
  status: "escalate",
215
215
  officer,
216
216
  // This-court receipt only (#879) — historical rows remain on terminal.submissions.
217
- receipt: thisCourt.length > 0 ? thisCourt[thisCourt.length - 1] : retainedReceipt(outcome),
217
+ receipt: outcome.decisiveFacts !== undefined && Object.hasOwn(outcome.decisiveFacts, "auditEscalationReceipt")
218
+ ? outcome.decisiveFacts.auditEscalationReceipt
219
+ : thisCourt.length > 0 ? thisCourt[thisCourt.length - 1] : retainedReceipt(outcome),
218
220
  }, summoned);
219
221
  }
220
222
  if (outcome.kind === "accepted") {