@akagilnc/pi-workflow-roles 0.1.4956 → 0.1.4980
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/README.zh-CN.md +4 -4
- package/dist/acp-host/production-host.js +157 -266
- package/dist/audit-escalation.js +19 -3
- package/dist/compliance-transport.js +6 -11
- package/dist/doctor-contracts.js +0 -2
- package/dist/gatekeeper-role.js +5 -3
- package/dist/headless-host/production-host.js +157 -266
- package/dist/migrate-book-topology.js +1 -16
- package/dist/packaged-role-registry.js +0 -24
- package/dist/public-cli/main.js +16 -28
- package/dist/public-cli/settlement.js +8 -1
- package/dist/public-cli/terminal.js +2 -2
- package/dist/secretariat-contracts.js +1 -3
- package/dist/submission-ledger.js +11 -0
- package/package.json +1 -1
- package/src/audit-escalation.ts +26 -5
- package/src/collector-role.ts +1 -5
- package/src/compliance-transport.ts +10 -12
- package/src/doctor-auditor.ts +2 -0
- package/src/doctor-contracts.ts +0 -1
- package/src/doctor-role.ts +4 -4
- package/src/gatekeeper-pass-envelope.ts +7 -10
- package/src/gatekeeper-role.ts +5 -3
- package/src/judge-role.ts +45 -31
- package/src/merger-role.ts +1 -2
- package/src/notary-role.ts +1 -2
- package/src/packaged-role-registry.ts +0 -25
- package/src/public-cli/settlement.ts +10 -1
- package/src/public-cli/terminal.ts +2 -2
- package/src/reviewer-role.ts +1 -2
- package/src/role-runtime.ts +59 -156
- package/src/secretariat-contracts.ts +0 -2
- package/src/secretariat-role.ts +3 -162
- package/src/submission-ledger.ts +18 -0
- package/src/worker-role.ts +42 -24
package/dist/audit-escalation.js
CHANGED
|
@@ -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,14 +51,28 @@ 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: [
|
|
55
|
+
content: [],
|
|
55
56
|
details,
|
|
56
57
|
terminate: true,
|
|
57
58
|
...(decision.usage === undefined ? {} : { usage: decision.usage }),
|
|
58
59
|
};
|
|
59
60
|
}
|
|
61
|
+
/** Preserve the escalating officer's own gate alongside the raw receipt. */
|
|
62
|
+
export function projectGatekeeperEscalation(result, deliveredOutput) {
|
|
63
|
+
const receipt = result.receipt;
|
|
64
|
+
const record = receipt !== null && typeof receipt === "object" && !Array.isArray(receipt)
|
|
65
|
+
? receipt
|
|
66
|
+
: undefined;
|
|
67
|
+
return projectAuditEscalation({
|
|
68
|
+
status: "escalate",
|
|
69
|
+
officer: result.officer,
|
|
70
|
+
conflicts: receipt,
|
|
71
|
+
...(record !== undefined && Object.hasOwn(record, "decisionGate")
|
|
72
|
+
? { decisionGate: record.decisionGate }
|
|
73
|
+
: {}),
|
|
74
|
+
}, deliveredOutput);
|
|
75
|
+
}
|
|
60
76
|
/**
|
|
61
77
|
* Discriminator-only recognition (ADR 0040). Shape of conflicts/options/gate
|
|
62
78
|
* is not a reject gate — element types and cardinality are delivery content.
|
|
@@ -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
|
-
|
|
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;
|
package/dist/doctor-contracts.js
CHANGED
|
@@ -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,
|
package/dist/gatekeeper-role.js
CHANGED
|
@@ -214,13 +214,15 @@ 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:
|
|
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") {
|
|
221
223
|
// outcome.status is the fixture/compat leaf: production settlement leaves
|
|
222
|
-
// it undefined once payloads are recorded
|
|
223
|
-
//
|
|
224
|
+
// it undefined once payloads are recorded. It may interpret a receipt
|
|
225
|
+
// lacking its own status, never substitute for a missing receipt.
|
|
224
226
|
return withOfficerRunId(projectOfficerPayloads(officer, thisCourt, outcome.status), summoned);
|
|
225
227
|
}
|
|
226
228
|
return withOfficerRunId({
|