@akagilnc/pi-workflow-roles 0.1.4673 → 0.1.4698
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 +496 -518
- package/dist/compliance-transport.js +6 -2
- package/dist/gatekeeper-role.js +6 -7
- package/dist/headless-host/production-host.js +492 -514
- package/dist/migrate-book-topology.js +8 -0
- package/dist/public-cli/countersign-run.js +63 -18
- package/dist/public-cli/main.js +488 -513
- package/dist/public-cli/settlement.js +316 -247
- package/dist/public-cli/terminal.js +36 -9
- package/dist/run-terminal-artifacts.js +71 -32
- package/package.json +1 -1
- package/souls/audit-law.md +7 -2
- package/souls/countersign.md +1 -1
- package/souls/gleaner-left.md +1 -1
- package/souls/notary.md +1 -1
- package/souls/quality-law.md +9 -0
- package/souls/reviewer.md +1 -1
- package/src/compliance-transport.ts +8 -2
- package/src/gatekeeper-role.ts +6 -6
- package/src/public-cli/countersign-run.ts +75 -26
- package/src/public-cli/secretariat-run.ts +2 -3
- package/src/public-cli/settlement.ts +380 -355
- package/src/public-cli/terminal.ts +48 -13
- package/src/role-runtime.ts +9 -11
- package/src/run-terminal-artifacts.ts +81 -28
- package/src/secretariat-role.ts +9 -4
|
@@ -8203,6 +8203,13 @@ var init_gatekeeper_role = __esm({
|
|
|
8203
8203
|
}
|
|
8204
8204
|
});
|
|
8205
8205
|
|
|
8206
|
+
// src/public-cli/terminal.ts
|
|
8207
|
+
var init_terminal = __esm({
|
|
8208
|
+
"src/public-cli/terminal.ts"() {
|
|
8209
|
+
"use strict";
|
|
8210
|
+
}
|
|
8211
|
+
});
|
|
8212
|
+
|
|
8206
8213
|
// src/compliance-transport.ts
|
|
8207
8214
|
var AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE;
|
|
8208
8215
|
var init_compliance_transport = __esm({
|
|
@@ -8210,6 +8217,7 @@ var init_compliance_transport = __esm({
|
|
|
8210
8217
|
"use strict";
|
|
8211
8218
|
init_auditor_dossier_tool();
|
|
8212
8219
|
init_gatekeeper_role();
|
|
8220
|
+
init_terminal();
|
|
8213
8221
|
AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE = "ak_auditor_parent_attempt_binding";
|
|
8214
8222
|
}
|
|
8215
8223
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { engineSessionMaterialFromOptions, pickEngineAxis, } from "../package-resources/engine-material.js";
|
|
2
2
|
import { CliUsageError } from "./cli-errors.js";
|
|
3
3
|
import { projectCourtTicketNumbers } from "../diarist-contracts.js";
|
|
4
|
+
import { readableGateItem } from "../readable-gate-item.js";
|
|
4
5
|
import { isSafePositiveTicketNumber } from "../run-ticket-number.js";
|
|
5
6
|
import { admitCountersignInvocation, bindAdmittedTicketNumber, bindCourtTicketNumbersOnAdmitted, buildCountersignTransportPrompt, freezePreparedAttachmentsIntoRun, materializeCountersignInvocation, relocateAdmittedRunToTicket, withPreparedAttachments, } from "./invocation.js";
|
|
6
7
|
import { prepareSummonsResumeMaterials, presentControlledFailure, runPostAdmissionOneShot, runPostAdmissionSeatResume, resumeTurnRequestProjectionOptions, StationChildExhaustedError, } from "./post-admission.js";
|
|
@@ -20,6 +21,56 @@ export function buildCountersignTurnRequest(admitted, options) {
|
|
|
20
21
|
},
|
|
21
22
|
}, options);
|
|
22
23
|
}
|
|
24
|
+
function isRecord(value) {
|
|
25
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
26
|
+
}
|
|
27
|
+
function isEscalatePayload(payload) {
|
|
28
|
+
if (!isRecord(payload))
|
|
29
|
+
return false;
|
|
30
|
+
return (payload.status === "escalate" || payload.countersignStatus === "escalate");
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Rows a parent may read from a nested diarist terminal (#836 / #953).
|
|
34
|
+
* Accepted/audit use role result payloads; failure history is submissions only.
|
|
35
|
+
*/
|
|
36
|
+
function courtDiaristPayloadRows(roleOutcome, submissions) {
|
|
37
|
+
if (roleOutcome === undefined)
|
|
38
|
+
return submissions ?? [];
|
|
39
|
+
if (roleOutcome.kind === "accepted" || roleOutcome.kind === "audit_escalation") {
|
|
40
|
+
return roleOutcome.payloads ?? [];
|
|
41
|
+
}
|
|
42
|
+
if (roleOutcome.kind === "failure")
|
|
43
|
+
return submissions ?? [];
|
|
44
|
+
return [];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Parent diagnostic for court-diarist escalate (#953 / 失败诚实 / 传话).
|
|
48
|
+
* Relays diarist escalate payload(s) via readableGateItem — never invents
|
|
49
|
+
* "cannot identify court target" when a payload already carries other facts
|
|
50
|
+
* (e.g. ticketNumber present with a different reason).
|
|
51
|
+
*
|
|
52
|
+
* Multiple escalate payloads remain reachable after the run (ADR 0003/0041;
|
|
53
|
+
* no courtAttempt sole-filter on diarist). Same law as secretariat parent face:
|
|
54
|
+
* every escalate receipt as-is, last = currentConclusion.
|
|
55
|
+
*/
|
|
56
|
+
function courtDiaristEscalateDiagnostic(roleOutcome, submissions) {
|
|
57
|
+
const payloads = courtDiaristPayloadRows(roleOutcome, submissions);
|
|
58
|
+
const escalatePayloads = [];
|
|
59
|
+
for (const payload of payloads) {
|
|
60
|
+
if (isEscalatePayload(payload))
|
|
61
|
+
escalatePayloads.push(payload);
|
|
62
|
+
}
|
|
63
|
+
if (escalatePayloads.length === 0)
|
|
64
|
+
return "court diarist station escalated";
|
|
65
|
+
// Single escalate: prior carrier (payload body only) — no shape churn.
|
|
66
|
+
if (escalatePayloads.length === 1) {
|
|
67
|
+
return `court diarist station escalated: ${readableGateItem(escalatePayloads[0])}`;
|
|
68
|
+
}
|
|
69
|
+
return `court diarist station escalated: ${readableGateItem({
|
|
70
|
+
receipts: escalatePayloads,
|
|
71
|
+
currentConclusion: escalatePayloads[escalatePayloads.length - 1],
|
|
72
|
+
})}`;
|
|
73
|
+
}
|
|
23
74
|
/**
|
|
24
75
|
* Read #871 set from preserved diarist payloads.
|
|
25
76
|
* - Field absent / null / non-array → undefined (no new set; resume keeps store).
|
|
@@ -30,14 +81,10 @@ export function buildCountersignTurnRequest(admitted, options) {
|
|
|
30
81
|
* - Multiple submissions: last qualifying set wins.
|
|
31
82
|
* Live path never shape-rejects the role turn; durable damage is a separate seam.
|
|
32
83
|
*/
|
|
33
|
-
function courtTicketNumbersFromOutcome(roleOutcome, principalTicket) {
|
|
84
|
+
function courtTicketNumbersFromOutcome(roleOutcome, principalTicket, submissions) {
|
|
34
85
|
if (roleOutcome === undefined)
|
|
35
86
|
return undefined;
|
|
36
|
-
const payloads = roleOutcome
|
|
37
|
-
roleOutcome.kind === "audit_escalation" ||
|
|
38
|
-
roleOutcome.kind === "failure"
|
|
39
|
-
? (roleOutcome.payloads ?? [])
|
|
40
|
-
: [];
|
|
87
|
+
const payloads = courtDiaristPayloadRows(roleOutcome, submissions);
|
|
41
88
|
let latest;
|
|
42
89
|
for (const payload of payloads) {
|
|
43
90
|
if (typeof payload !== "object" ||
|
|
@@ -76,14 +123,7 @@ function courtDiaristEscalated(roleOutcome) {
|
|
|
76
123
|
return true;
|
|
77
124
|
if (roleOutcome.kind !== "accepted")
|
|
78
125
|
return false;
|
|
79
|
-
return (roleOutcome.payloads ?? []).some(
|
|
80
|
-
if (typeof payload !== "object" ||
|
|
81
|
-
payload === null ||
|
|
82
|
-
Array.isArray(payload))
|
|
83
|
-
return false;
|
|
84
|
-
const record = payload;
|
|
85
|
-
return (record.status === "escalate" || record.countersignStatus === "escalate");
|
|
86
|
-
});
|
|
126
|
+
return (roleOutcome.payloads ?? []).some(isEscalatePayload);
|
|
87
127
|
}
|
|
88
128
|
/**
|
|
89
129
|
* Invoke public 起居郎 under the court-pipeline quiet face.
|
|
@@ -133,11 +173,15 @@ export async function invokeCourtDiarist(input, env, io) {
|
|
|
133
173
|
: { hostAdapters: env.hostAdapters }),
|
|
134
174
|
});
|
|
135
175
|
const roleOutcome = result.terminal?.roleOutcome;
|
|
176
|
+
const submissions = result.terminal?.submissions;
|
|
136
177
|
// Escalate routing is a boolean over the preserved sequence (#881). Reasons and
|
|
137
178
|
// payload bodies stay on roleOutcome — never rewritten into a sole identity reason.
|
|
138
179
|
if (courtDiaristEscalated(roleOutcome)) {
|
|
139
180
|
return {
|
|
140
|
-
identity: {
|
|
181
|
+
identity: {
|
|
182
|
+
kind: "escalate",
|
|
183
|
+
diagnostic: courtDiaristEscalateDiagnostic(roleOutcome, submissions),
|
|
184
|
+
},
|
|
141
185
|
};
|
|
142
186
|
}
|
|
143
187
|
if (result.exitCode !== 0) {
|
|
@@ -154,7 +198,7 @@ export async function invokeCourtDiarist(input, env, io) {
|
|
|
154
198
|
const asserted = result.admitted
|
|
155
199
|
?.ticketNumber;
|
|
156
200
|
if (isSafePositiveTicketNumber(asserted)) {
|
|
157
|
-
const courtTicketNumbers = courtTicketNumbersFromOutcome(roleOutcome, asserted);
|
|
201
|
+
const courtTicketNumbers = courtTicketNumbersFromOutcome(roleOutcome, asserted, submissions);
|
|
158
202
|
return {
|
|
159
203
|
identity: {
|
|
160
204
|
kind: "ticket",
|
|
@@ -211,7 +255,7 @@ export async function runCountersignCourtDiaristStation(admitted, env, io) {
|
|
|
211
255
|
boundTicketNumber: ticketNumber,
|
|
212
256
|
}, env, io);
|
|
213
257
|
if (outcome.identity.kind === "escalate") {
|
|
214
|
-
throw new StationChildExhaustedError(
|
|
258
|
+
throw new StationChildExhaustedError(outcome.identity.diagnostic);
|
|
215
259
|
}
|
|
216
260
|
if (outcome.failedWithoutEscalate !== undefined) {
|
|
217
261
|
throw new StationChildExhaustedError(outcome.failedWithoutEscalate.diagnostic);
|
|
@@ -302,13 +346,14 @@ export async function runPublicCountersign(argv, env, io, parseCountersignArgv)
|
|
|
302
346
|
identityDiaristRan = true;
|
|
303
347
|
if (outcome.identity.kind === "escalate") {
|
|
304
348
|
// 御批: 识别不了就上抛 — materialize and settle this countersign run.
|
|
349
|
+
// Diagnostic relays diarist escalate payload facts (#953).
|
|
305
350
|
await materializeAdmission();
|
|
306
351
|
await markRunAdmitted(admitted, env.principalAuthority);
|
|
307
352
|
return await presentControlledFailure(admitted, {
|
|
308
353
|
timedOut: false,
|
|
309
354
|
code: null,
|
|
310
355
|
stderr: "",
|
|
311
|
-
thrown: new Error(
|
|
356
|
+
thrown: new Error(outcome.identity.diagnostic),
|
|
312
357
|
}, countersignAdapters(), env.principalAuthority, io);
|
|
313
358
|
}
|
|
314
359
|
// Typed failure terminal (verification / infra / non-zero without escalate)
|