@akagilnc/pi-workflow-roles 0.1.4021 → 0.1.4062
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 +682 -355
- package/dist/doctor-auditor.js +1 -1
- package/dist/dossier-resolution.js +21 -8
- package/dist/gatekeeper-role.js +34 -27
- package/dist/headless-host/description.js +7 -8
- package/dist/headless-host/production-host.js +709 -369
- package/dist/host-contracts.js +16 -0
- package/dist/inspector-contracts.js +8 -0
- package/dist/navigator-attendance.js +2 -0
- package/dist/navigator-public-session.js +18 -34
- package/dist/navigator-session-contracts.js +19 -0
- package/dist/packaged-role-registry.js +1 -1
- package/dist/pi/known-failure.js +3 -4
- package/dist/pi/role-turn-host.js +43 -13
- package/dist/public-cli/auto-resume.js +20 -7
- package/dist/public-cli/case-dossier-delivery.js +60 -1
- package/dist/public-cli/diarist-run.js +9 -23
- package/dist/public-cli/inspector-run.js +17 -3
- package/dist/public-cli/instruction-seat-run.js +12 -7
- package/dist/public-cli/judge-run.js +3 -1
- package/dist/public-cli/main.js +440 -222
- package/dist/public-cli/notary-run.js +7 -4
- package/dist/public-cli/post-admission.js +66 -59
- package/dist/public-cli/run-lifecycle.js +3 -0
- package/dist/public-cli/settlement.js +78 -58
- package/dist/public-cli/terminal.js +1 -11
- package/dist/public-role-summons.js +8 -0
- package/dist/submission-ledger.js +139 -19
- package/dist/user-dialogue-stdin.js +33 -0
- package/extensions/role-runtime.ts +1 -0
- package/package.json +1 -1
- package/resources/836-deleted-machine-instruction-inventory.md +1 -1
- package/src/doctor-auditor.ts +1 -1
- package/src/dossier-resolution.ts +26 -8
- package/src/external-host-turn-loop.ts +9 -0
- package/src/gatekeeper-pass-envelope.ts +6 -0
- package/src/gatekeeper-role.ts +47 -28
- package/src/headless-host/description.ts +8 -11
- package/src/headless-host/role-turn-host.ts +20 -5
- package/src/host-contracts.ts +30 -7
- package/src/inspector-contracts.ts +7 -0
- package/src/judge-role.ts +4 -0
- package/src/navigator-attendance.ts +2 -0
- package/src/navigator-public-session.ts +19 -55
- package/src/navigator-session-contracts.ts +39 -0
- package/src/navigator-work-context.ts +3 -4
- package/src/notary-role.ts +1 -0
- package/src/packaged-role-registry.ts +1 -1
- package/src/pi/adapter.ts +19 -4
- package/src/pi/known-failure.ts +3 -4
- package/src/pi/role-turn-host.ts +48 -14
- package/src/public-cli/auto-resume.ts +57 -20
- package/src/public-cli/case-dossier-delivery.ts +86 -1
- package/src/public-cli/cli.ts +2 -2
- package/src/public-cli/collector-run.ts +3 -1
- package/src/public-cli/countersign-run.ts +34 -27
- package/src/public-cli/diarist-run.ts +10 -27
- package/src/public-cli/inspector-run.ts +26 -2
- package/src/public-cli/instruction-seat-run.ts +20 -10
- package/src/public-cli/invocation.ts +2 -0
- package/src/public-cli/judge-run.ts +3 -1
- package/src/public-cli/notary-run.ts +13 -4
- package/src/public-cli/post-admission.ts +74 -65
- package/src/public-cli/reviewer-run.ts +3 -1
- package/src/public-cli/run-lifecycle.ts +3 -0
- package/src/public-cli/settlement.ts +105 -80
- package/src/public-cli/terminal.ts +7 -16
- package/src/public-role-summons.ts +31 -7
- package/src/role-envelope.ts +9 -30
- package/src/role-runtime-dependencies.ts +1 -0
- package/src/role-runtime.ts +95 -19
- package/src/submission-ledger.ts +195 -26
- package/src/user-dialogue-stdin.ts +37 -0
- package/src/worker-role.ts +4 -0
|
@@ -69,6 +69,11 @@ export type InstructionSeatRunEnv = PostAdmissionEnv & {
|
|
|
69
69
|
* Never a public CLI argv — must not pollute the --source-run parent lookup key (#747).
|
|
70
70
|
*/
|
|
71
71
|
reviewReask?: string;
|
|
72
|
+
/**
|
|
73
|
+
* #879 gate summons: verbatim parent-submission body for officer dialogue content.
|
|
74
|
+
* Rides summons.instruction / first-mint prompt when reviewReask is absent.
|
|
75
|
+
*/
|
|
76
|
+
gateReviewInstruction?: string;
|
|
72
77
|
};
|
|
73
78
|
|
|
74
79
|
/** Project an admitted instruction-seat invocation onto the host-neutral turn request. */
|
|
@@ -122,7 +127,9 @@ function instructionSeatAdapters(options?: {
|
|
|
122
127
|
return infrastructureFailure === undefined
|
|
123
128
|
? result.knownFailure
|
|
124
129
|
: {
|
|
125
|
-
|
|
130
|
+
...(infrastructureFailure.cause === undefined
|
|
131
|
+
? {}
|
|
132
|
+
: { cause: infrastructureFailure.cause }),
|
|
126
133
|
diagnostic: infrastructureFailure.diagnostic,
|
|
127
134
|
...(infrastructureFailure.identity === undefined
|
|
128
135
|
? {}
|
|
@@ -289,8 +296,9 @@ export async function runPublicInstructionSeat(
|
|
|
289
296
|
}
|
|
290
297
|
}
|
|
291
298
|
|
|
292
|
-
// #756/#
|
|
293
|
-
|
|
299
|
+
// #756/#879: auditor reask / verbatim submission body ride summons.instruction.
|
|
300
|
+
// Binding pointer stays --source-run / argv 卷宗指针; content is body or reask.
|
|
301
|
+
const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
|
|
294
302
|
const summons: SameTicketSummonsMaterials = {
|
|
295
303
|
...(resumeInstruction === undefined
|
|
296
304
|
? {
|
|
@@ -370,13 +378,15 @@ export async function runPublicInstructionSeat(
|
|
|
370
378
|
: { correlationId: env.correlationId }),
|
|
371
379
|
continuation: {
|
|
372
380
|
kind: "initial",
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
381
|
+
// #879: gate first mint uses parent payload as content when present.
|
|
382
|
+
prompt: (env.reviewReask ?? env.gateReviewInstruction)
|
|
383
|
+
?? buildInstructionTransportPrompt(
|
|
384
|
+
admitted,
|
|
385
|
+
engineSessionMaterialFromOptions({
|
|
386
|
+
...pickEngineAxis(env),
|
|
387
|
+
packageRoot: env.packageRoot,
|
|
388
|
+
}),
|
|
389
|
+
),
|
|
380
390
|
},
|
|
381
391
|
});
|
|
382
392
|
|
|
@@ -131,6 +131,8 @@ export type AdmittedGleanerLeftInvocation = AdmittedRoleInvocationBase & {
|
|
|
131
131
|
|
|
132
132
|
export type AdmittedInspectorInvocation = AdmittedRoleInvocationBase & {
|
|
133
133
|
readonly role: "inspector";
|
|
134
|
+
/** Parent run directory (#747 / #879); independent of dialogue instruction. */
|
|
135
|
+
readonly sourceRunPath?: string;
|
|
134
136
|
};
|
|
135
137
|
|
|
136
138
|
export type AdmittedGatekeeperInvocation = AdmittedRoleInvocationBase & {
|
|
@@ -63,7 +63,9 @@ function judgeAdapters(): PostAdmissionAdapters<AdmittedJudgeInvocation> {
|
|
|
63
63
|
(infrastructureFailure === undefined
|
|
64
64
|
? undefined
|
|
65
65
|
: {
|
|
66
|
-
|
|
66
|
+
...(infrastructureFailure.cause === undefined
|
|
67
|
+
? {}
|
|
68
|
+
: { cause: infrastructureFailure.cause }),
|
|
67
69
|
diagnostic: infrastructureFailure.diagnostic,
|
|
68
70
|
...(infrastructureFailure.identity === undefined
|
|
69
71
|
? {}
|
|
@@ -52,6 +52,12 @@ export type NotaryRunEnv = PostAdmissionEnv & {
|
|
|
52
52
|
* Never a public CLI argv — external callers still have zero prompt.
|
|
53
53
|
*/
|
|
54
54
|
reviewReask?: string;
|
|
55
|
+
/**
|
|
56
|
+
* #879 gate summons: verbatim parent-submission body for officer dialogue content.
|
|
57
|
+
* Rides summons.instruction / first-mint prompt when reviewReask is absent.
|
|
58
|
+
* Binding pointer stays --source-run (independent machine material).
|
|
59
|
+
*/
|
|
60
|
+
gateReviewInstruction?: string;
|
|
55
61
|
};
|
|
56
62
|
|
|
57
63
|
/** Project admitted invocation onto the host-neutral turn request. */
|
|
@@ -115,10 +121,10 @@ export async function runPublicNotary(
|
|
|
115
121
|
throw error;
|
|
116
122
|
}
|
|
117
123
|
// #747: officer resume key is this parent source-run path (not ticket number).
|
|
118
|
-
// #753/#
|
|
119
|
-
// (reask wins when both present; no parallel stack).
|
|
124
|
+
// #753/#879: gate re-ask and verbatim submission body share summons.instruction
|
|
125
|
+
// (reask wins when both present; no parallel stack). Binding stays sourceRunPath.
|
|
120
126
|
{
|
|
121
|
-
const resumeInstruction = env.reviewReask;
|
|
127
|
+
const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
|
|
122
128
|
const summons: SameTicketSummonsMaterials = {
|
|
123
129
|
sourceRunPath: source.runDirectory,
|
|
124
130
|
sourceRun: source,
|
|
@@ -181,7 +187,10 @@ export async function runPublicNotary(
|
|
|
181
187
|
: { correlationId: env.correlationId }),
|
|
182
188
|
continuation: {
|
|
183
189
|
kind: "initial",
|
|
184
|
-
|
|
190
|
+
// #879: gate path first mint carries parent payload as dialogue content;
|
|
191
|
+
// external zero-prompt kickoff unchanged when no body/reask.
|
|
192
|
+
prompt: (env.reviewReask ?? env.gateReviewInstruction)
|
|
193
|
+
?? buildNotaryTransportPrompt(admitted, engineMaterial),
|
|
185
194
|
},
|
|
186
195
|
});
|
|
187
196
|
|
|
@@ -11,7 +11,6 @@ import { isAbsolute, join, resolve } from "node:path";
|
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
buildResumeContinuationPrompt,
|
|
14
|
-
GATE_DOSSIER_POINTER_PREFIX,
|
|
15
14
|
RESUME_TRANSPORT_ENVELOPE,
|
|
16
15
|
type PublicResumeRequest,
|
|
17
16
|
type SameTicketSummonsMaterials,
|
|
@@ -37,7 +36,11 @@ import type {
|
|
|
37
36
|
RoleTurnResult,
|
|
38
37
|
SessionCustomEntryAppender,
|
|
39
38
|
} from "../host-contracts.ts";
|
|
40
|
-
import {
|
|
39
|
+
import { isOfficerReviewSeat } from "../host-contracts.ts";
|
|
40
|
+
import {
|
|
41
|
+
deliverCaseDossierAsAttachment,
|
|
42
|
+
projectCaseDossierPointerSection,
|
|
43
|
+
} from "./case-dossier-delivery.ts";
|
|
41
44
|
|
|
42
45
|
/** Original error bytes, never relabeled — a secondary fact riding beside a classified cause. */
|
|
43
46
|
function describeCaughtError(error: unknown): { name?: string; message: string; code?: string | number } {
|
|
@@ -58,6 +61,18 @@ function appendContinuationSection(
|
|
|
58
61
|
? { kind: "initial", prompt }
|
|
59
62
|
: { kind: "resume", prompt };
|
|
60
63
|
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Nested gate summons (station child) on an officer seat: dialogue content is
|
|
67
|
+
* peer words only (#879). ADR 0081 case dossier still hangs via the existing
|
|
68
|
+
* attachments freeze seam — never into the peer body, never RoleTurnRequest.materials.
|
|
69
|
+
*/
|
|
70
|
+
function isStationChildOfficerDialogue(
|
|
71
|
+
role: string,
|
|
72
|
+
env: { readonly stationChild?: boolean },
|
|
73
|
+
): boolean {
|
|
74
|
+
return env.stationChild === true && isOfficerReviewSeat(role);
|
|
75
|
+
}
|
|
61
76
|
import { projectHostTransitionPriorNative } from "../host-transition-prior-native.ts";
|
|
62
77
|
import type { CredentialProviders, SeatModelConfig } from "./config.ts";
|
|
63
78
|
import {
|
|
@@ -654,9 +669,9 @@ export async function dispatchPostAdmissionTurn<
|
|
|
654
669
|
// Turn request is assembled after beforeDispatch so this turn sees whatever it
|
|
655
670
|
// settled — the seat's ticket bind re-projection and any court diarist station
|
|
656
671
|
// writes (#742). Case dossier delivery (ADR 0081 / #709) rides here once for
|
|
657
|
-
// every public entry:
|
|
658
|
-
//
|
|
659
|
-
//
|
|
672
|
+
// every public entry. #879: station-child officer dialogue keeps peer body
|
|
673
|
+
// intact — 起居录 hangs via existing attachments freeze (not prompt wrap,
|
|
674
|
+
// not RoleTurnRequest.materials). Other entries keep the neutral prompt section.
|
|
660
675
|
let turnRequest: RoleTurnRequest =
|
|
661
676
|
env.signal === undefined ? request : { ...request, signal: env.signal };
|
|
662
677
|
if (env.stationChild !== undefined) {
|
|
@@ -665,19 +680,33 @@ export async function dispatchPostAdmissionTurn<
|
|
|
665
680
|
if (hostTransition !== undefined) {
|
|
666
681
|
turnRequest = { ...turnRequest, hostTransition };
|
|
667
682
|
}
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
683
|
+
if (isStationChildOfficerDialogue(admitted.role, env)) {
|
|
684
|
+
// 0081 non-body face: freeze pointer section under run/attachments/.
|
|
685
|
+
// Peer dialogue continuation.prompt stays parent payload only — the seat
|
|
686
|
+
// consumes the freeze via loadCaseDossierReadingMaterial → existing
|
|
687
|
+
// agent-start readingMaterial / systemPrompt.materials fold (not prompt splice,
|
|
688
|
+
// not RoleTurnRequest.materials).
|
|
689
|
+
await deliverCaseDossierAsAttachment({
|
|
690
|
+
ticketNumber: admitted.ticketNumber,
|
|
691
|
+
projectRoot: admitted.projectRoot,
|
|
692
|
+
home: env.home,
|
|
693
|
+
runDirectory: admitted.runDirectory,
|
|
694
|
+
});
|
|
695
|
+
} else {
|
|
696
|
+
const dossierSection = await projectCaseDossierPointerSection({
|
|
697
|
+
ticketNumber: admitted.ticketNumber,
|
|
698
|
+
projectRoot: admitted.projectRoot,
|
|
699
|
+
home: env.home,
|
|
700
|
+
});
|
|
701
|
+
if (dossierSection !== undefined) {
|
|
702
|
+
turnRequest = {
|
|
703
|
+
...turnRequest,
|
|
704
|
+
continuation: appendContinuationSection(
|
|
705
|
+
turnRequest.continuation,
|
|
706
|
+
dossierSection,
|
|
707
|
+
),
|
|
708
|
+
};
|
|
709
|
+
}
|
|
681
710
|
}
|
|
682
711
|
|
|
683
712
|
// Authoritative host write happens here, at the real dispatch boundary —
|
|
@@ -1065,16 +1094,16 @@ export async function dispatchPostAdmissionTurn<
|
|
|
1065
1094
|
}
|
|
1066
1095
|
|
|
1067
1096
|
/**
|
|
1068
|
-
* Shared resume continuation projection (#471 / #600 / #633 / #637 / #755):
|
|
1097
|
+
* Shared resume continuation projection (#471 / #600 / #633 / #637 / #755 / #879):
|
|
1069
1098
|
* seat-table model/engine/timeout axes, restored correlation, and either
|
|
1070
1099
|
* - manual resume (no same-ticket summons): package envelope / optional caller
|
|
1071
1100
|
* message, with engine-axis handbook via buildResumeContinuationPrompt, or
|
|
1072
1101
|
* - same-ticket summons (审核循环续话): caller/peer words + optional frozen
|
|
1073
|
-
* attachment paths only — no
|
|
1074
|
-
* (#750/#755)
|
|
1102
|
+
* attachment paths only — no「请重读」、no code-authored content substitute,
|
|
1103
|
+
* no engine handbook packaging (#750/#755/#879).
|
|
1075
1104
|
* Caller message wins as prompt base when supplied (bytes unchanged, including
|
|
1076
|
-
* blank/whitespace); else summons instruction
|
|
1077
|
-
*
|
|
1105
|
+
* blank/whitespace); else summons instruction (parent payload or reask).
|
|
1106
|
+
* Binding pointer stays on summons.sourceRunPath / activation — not dialogue content.
|
|
1078
1107
|
* Seats add only their activation projection. Call prepareSummonsResumeMaterials
|
|
1079
1108
|
* first when request.summons carries instruction or attachment paths.
|
|
1080
1109
|
*/
|
|
@@ -1088,32 +1117,25 @@ export function resumeTurnRequestProjectionOptions(
|
|
|
1088
1117
|
readonly attachments: readonly { frozenPath: string }[];
|
|
1089
1118
|
},
|
|
1090
1119
|
): RoleTurnRequestProjectionOptions {
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|| (admitted.role !== "notary"
|
|
1096
|
-
&& admitted.role !== "inspector"
|
|
1097
|
-
&& admitted.role !== "auditor")
|
|
1098
|
-
) {
|
|
1099
|
-
return body;
|
|
1100
|
-
}
|
|
1101
|
-
if (body.startsWith("请重读")) return body;
|
|
1102
|
-
return `请重读\n${body}`;
|
|
1103
|
-
};
|
|
1120
|
+
// #879: officer dialogue content is caller/peer words only — no「请重读」,
|
|
1121
|
+
// no code-authored constant substitute, no attachment-list wrap of peer body.
|
|
1122
|
+
// Binding pointer stays on summons sourceRunPath / activation / attachments.
|
|
1123
|
+
const officerDialogue = isStationChildOfficerDialogue(admitted.role, env);
|
|
1104
1124
|
let prompt: string;
|
|
1105
1125
|
if (request.message !== undefined) {
|
|
1106
1126
|
if (summonsPrepared !== undefined) {
|
|
1107
|
-
// #755: same-ticket review / open-court — caller words
|
|
1108
|
-
//
|
|
1109
|
-
prompt =
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1127
|
+
// #755: same-ticket review / open-court — caller words.
|
|
1128
|
+
// #879 station-child officer: words only (attachments are independent freeze).
|
|
1129
|
+
prompt = officerDialogue
|
|
1130
|
+
? request.message
|
|
1131
|
+
: buildInstructionTransportPrompt({
|
|
1132
|
+
instruction: request.message,
|
|
1133
|
+
instructionEmpty: false,
|
|
1134
|
+
attachments: summonsPrepared.attachments,
|
|
1135
|
+
});
|
|
1114
1136
|
} else if (request.summons !== undefined) {
|
|
1115
1137
|
// #755: same-ticket summons without prepared materials — caller words only.
|
|
1116
|
-
prompt =
|
|
1138
|
+
prompt = request.message;
|
|
1117
1139
|
} else {
|
|
1118
1140
|
// Bare manual resume — outsourcing engine axis keeps handbook (#600/#736).
|
|
1119
1141
|
prompt = buildResumeContinuationPrompt({
|
|
@@ -1123,28 +1145,15 @@ export function resumeTurnRequestProjectionOptions(
|
|
|
1123
1145
|
});
|
|
1124
1146
|
}
|
|
1125
1147
|
} else if (summonsPrepared !== undefined) {
|
|
1126
|
-
// #
|
|
1127
|
-
|
|
1148
|
+
// #879 station-child officer: instruction bytes === peer body/reask (no wrap).
|
|
1149
|
+
// Other seats keep #755 instruction + optional attachment path listing.
|
|
1150
|
+
prompt = officerDialogue
|
|
1151
|
+
? (summonsPrepared.instructionEmpty ? "" : summonsPrepared.instruction)
|
|
1152
|
+
: buildInstructionTransportPrompt(summonsPrepared);
|
|
1128
1153
|
} else if (request.summons !== undefined) {
|
|
1129
|
-
// #
|
|
1130
|
-
//
|
|
1131
|
-
|
|
1132
|
-
if (
|
|
1133
|
-
path !== undefined &&
|
|
1134
|
-
(admitted.role === "notary" ||
|
|
1135
|
-
admitted.role === "inspector" ||
|
|
1136
|
-
admitted.role === "auditor")
|
|
1137
|
-
) {
|
|
1138
|
-
prompt = `请重读\n${GATE_DOSSIER_POINTER_PREFIX}${path}`;
|
|
1139
|
-
} else if (
|
|
1140
|
-
admitted.role === "notary" ||
|
|
1141
|
-
admitted.role === "inspector" ||
|
|
1142
|
-
admitted.role === "auditor"
|
|
1143
|
-
) {
|
|
1144
|
-
prompt = "请重读";
|
|
1145
|
-
} else {
|
|
1146
|
-
prompt = "";
|
|
1147
|
-
}
|
|
1154
|
+
// #879: same-ticket summons with no instruction (e.g. notary source-run binding
|
|
1155
|
+
// only). Pointer is activation/sourceRun material — not dialogue content.
|
|
1156
|
+
prompt = "";
|
|
1148
1157
|
} else {
|
|
1149
1158
|
// Bare manual resume — outsourcing engine axis keeps handbook (#600/#736).
|
|
1150
1159
|
prompt = buildResumeContinuationPrompt({
|
|
@@ -104,7 +104,9 @@ function reviewerAdapters(
|
|
|
104
104
|
return infrastructureFailure === undefined
|
|
105
105
|
? result.knownFailure
|
|
106
106
|
: {
|
|
107
|
-
|
|
107
|
+
...(infrastructureFailure.cause === undefined
|
|
108
|
+
? {}
|
|
109
|
+
: { cause: infrastructureFailure.cause }),
|
|
108
110
|
diagnostic: infrastructureFailure.diagnostic,
|
|
109
111
|
...(infrastructureFailure.identity === undefined
|
|
110
112
|
? {}
|
|
@@ -2007,6 +2007,9 @@ export async function loadResumableInspectorRun(
|
|
|
2007
2007
|
const admitted: AdmittedInspectorInvocation = {
|
|
2008
2008
|
role: "inspector",
|
|
2009
2009
|
...resumedBaseAdmitted(loaded),
|
|
2010
|
+
...(loaded.admittedFields.sourceRunPath === undefined
|
|
2011
|
+
? {}
|
|
2012
|
+
: { sourceRunPath: loaded.admittedFields.sourceRunPath }),
|
|
2010
2013
|
};
|
|
2011
2014
|
return seatLoadedResult(loaded, admitted);
|
|
2012
2015
|
}
|