@akagilnc/pi-workflow-roles 0.1.4035 → 0.1.4193
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 +2368 -1155
- package/dist/archivist-record-entry.js +204 -20
- package/dist/archivist-record-topology.js +36 -16
- package/dist/auditor-dossier-tool.js +2 -1
- package/dist/diarist-contracts.js +96 -0
- package/dist/doctor-auditor.js +1 -1
- package/dist/doctor-evidence.js +3 -2
- 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 +2375 -1149
- package/dist/host-contracts.js +16 -0
- package/dist/inspector-contracts.js +8 -0
- package/dist/migrate-book-topology.js +278917 -0
- package/dist/navigator-public-session.js +22 -25
- package/dist/notary-source-run.js +7 -4
- package/dist/packaged-role-registry.js +1 -1
- package/dist/pi/durable-principal.js +9 -6
- package/dist/pi/role-turn-host.js +43 -13
- package/dist/public-cli/auto-resume.js +2 -5
- package/dist/public-cli/case-dossier-delivery.js +60 -1
- package/dist/public-cli/diarist-run.js +27 -25
- package/dist/public-cli/inspector-run.js +17 -3
- package/dist/public-cli/instruction-seat-run.js +17 -17
- package/dist/public-cli/invocation.js +127 -63
- package/dist/public-cli/main.js +1685 -696
- package/dist/public-cli/notary-run.js +7 -4
- package/dist/public-cli/option-definitions.js +2 -2
- package/dist/public-cli/post-admission.js +113 -71
- package/dist/public-cli/run-lifecycle.js +209 -58
- package/dist/public-cli/seat-ticket-binding.js +3 -6
- package/dist/public-cli/settlement.js +29 -10
- package/dist/public-role-summons.js +8 -0
- package/dist/role-run-placement.js +84 -0
- package/dist/role-run-relocation.js +358 -0
- package/dist/run-terminal-artifacts.js +2 -1
- package/dist/run-ticket-number.js +51 -32
- package/dist/sitian-appender.js +11 -26
- package/dist/submission-ledger.js +106 -25
- package/dist/ticket-provenance.js +3 -1
- package/dist/user-dialogue-stdin.js +33 -0
- package/extensions/role-runtime.ts +1 -0
- package/package.json +3 -2
- package/resources/836-deleted-machine-instruction-inventory.md +1 -1
- package/scripts/build-package.mjs +34 -2
- package/souls/fixer.md +3 -2
- package/src/analyst-ledger.ts +14 -15
- package/src/archivist-record-entry.ts +285 -38
- package/src/archivist-record-topology.ts +43 -18
- package/src/auditor-dossier-tool.ts +2 -1
- package/src/book-topology-migration-placement.ts +493 -0
- package/src/book-topology-migration.ts +220 -0
- package/src/book-topology-migrators-t11.ts +856 -0
- package/src/book-topology-mixed-volume-migrators.ts +470 -0
- package/src/book-topology-partition-migrators.ts +25 -0
- package/src/book-topology-record-class-migrators.ts +779 -0
- package/src/book-topology-runs-migrator.ts +244 -0
- package/src/diarist-contracts.ts +116 -0
- package/src/diarist-role.ts +6 -0
- package/src/diarist.ts +2 -0
- package/src/doctor-auditor.ts +1 -1
- package/src/doctor-evidence.ts +4 -1
- package/src/doctor-role.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 +22 -3
- package/src/inspector-contracts.ts +7 -0
- package/src/judge-role.ts +4 -0
- package/src/navigator-public-session.ts +33 -30
- package/src/navigator-work-context.ts +3 -4
- package/src/notary-role.ts +1 -0
- package/src/notary-source-run.ts +9 -4
- package/src/packaged-role-registry.ts +1 -1
- package/src/pi/adapter.ts +19 -4
- package/src/pi/durable-principal.ts +9 -13
- package/src/pi/role-turn-host.ts +48 -14
- package/src/public-cli/auto-resume.ts +2 -6
- package/src/public-cli/case-dossier-delivery.ts +86 -1
- package/src/public-cli/countersign-run.ts +182 -32
- package/src/public-cli/diarist-run.ts +34 -26
- package/src/public-cli/inspector-run.ts +26 -2
- package/src/public-cli/instruction-seat-run.ts +24 -20
- package/src/public-cli/invocation.ts +194 -58
- package/src/public-cli/notary-run.ts +13 -4
- package/src/public-cli/option-definitions.ts +2 -2
- package/src/public-cli/post-admission.ts +147 -78
- package/src/public-cli/run-lifecycle.ts +258 -65
- package/src/public-cli/seat-ticket-binding.ts +3 -6
- package/src/public-cli/settlement.ts +38 -10
- package/src/public-role-summons.ts +31 -7
- package/src/role-envelope.ts +9 -30
- package/src/role-run-placement.ts +128 -0
- package/src/role-run-relocation.ts +491 -0
- package/src/role-runtime-dependencies.ts +1 -0
- package/src/role-runtime.ts +106 -24
- package/src/run-terminal-artifacts.ts +3 -1
- package/src/run-ticket-number.ts +80 -20
- package/src/sitian-appender.ts +25 -28
- package/src/submission-ledger.ts +148 -30
- package/src/ticket-provenance.ts +4 -1
- package/src/ticket-trajectory.ts +22 -35
- package/src/user-dialogue-stdin.ts +37 -0
- package/src/worker-role.ts +8 -4
- package/src/worker-submission-gates.ts +6 -6
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
admitDiaristInvocation,
|
|
13
13
|
bindAdmittedTicketNumber,
|
|
14
14
|
buildInstructionTransportPrompt,
|
|
15
|
+
relocateAdmittedRunToTicket,
|
|
15
16
|
type AdmittedDiaristInvocation,
|
|
16
17
|
type ParseDiaristArgvResult,
|
|
17
18
|
} from "./invocation.ts";
|
|
@@ -27,6 +28,7 @@ import {
|
|
|
27
28
|
loadResumableDiaristRun,
|
|
28
29
|
markRunAdmitted,
|
|
29
30
|
type PublicResumeRequest,
|
|
31
|
+
type RunWriterLease,
|
|
30
32
|
type SameTicketSummonsMaterials,
|
|
31
33
|
} from "./run-lifecycle.ts";
|
|
32
34
|
import { tryResumeSameTicketSeatRun } from "./seat-ticket-binding.ts";
|
|
@@ -40,7 +42,7 @@ import {
|
|
|
40
42
|
projectRoleTurnRequest,
|
|
41
43
|
type RoleTurnRequestProjectionOptions,
|
|
42
44
|
} from "./turn-request.ts";
|
|
43
|
-
import {
|
|
45
|
+
import { readBoardTicketNumber } from "../run-ticket-number.ts";
|
|
44
46
|
|
|
45
47
|
export type DiaristRunEnv = PostAdmissionEnv & {
|
|
46
48
|
principalAuthority: DurablePrincipalAuthority;
|
|
@@ -66,11 +68,38 @@ export function buildDiaristTurnRequest(
|
|
|
66
68
|
);
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Board-bound ticket on pages → memory bind + unbound→ticket relocate under lease.
|
|
73
|
+
* Shared by resume (interrupted board-bound unbound) and post-turn first assert.
|
|
74
|
+
*/
|
|
75
|
+
async function bindAndRelocateDiaristIfBoardBound(
|
|
76
|
+
admitted: AdmittedDiaristInvocation,
|
|
77
|
+
authority: DiaristRunEnv["principalAuthority"],
|
|
78
|
+
lease: RunWriterLease,
|
|
79
|
+
): Promise<void> {
|
|
80
|
+
const boardTicket = await readBoardTicketNumber(admitted.runDirectory);
|
|
81
|
+
if (boardTicket === undefined) return;
|
|
82
|
+
if (admitted.ticketNumber === undefined) {
|
|
83
|
+
await bindAdmittedTicketNumber(admitted, boardTicket);
|
|
84
|
+
}
|
|
85
|
+
await relocateAdmittedRunToTicket(admitted, authority, lease);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
function diaristAdapters(
|
|
89
|
+
env: DiaristRunEnv,
|
|
90
|
+
): PostAdmissionAdapters<AdmittedDiaristInvocation> {
|
|
70
91
|
return {
|
|
71
92
|
trySettle: (admitted, authority, scope) =>
|
|
72
93
|
trySettleDiaristTerminalResult(admitted, authority, scope),
|
|
73
94
|
shouldPresentSettled: () => true,
|
|
95
|
+
// Resume interrupted state: board ticket already on pages, run still under unbound/.
|
|
96
|
+
beforeDispatch: async (admitted, lease) => {
|
|
97
|
+
await bindAndRelocateDiaristIfBoardBound(admitted, env.principalAuthority, lease);
|
|
98
|
+
},
|
|
99
|
+
// First post-turn assert: accept hook wrote board pages; relocate before lease release.
|
|
100
|
+
afterDispatch: async (admitted, lease) => {
|
|
101
|
+
await bindAndRelocateDiaristIfBoardBound(admitted, env.principalAuthority, lease);
|
|
102
|
+
},
|
|
74
103
|
};
|
|
75
104
|
}
|
|
76
105
|
|
|
@@ -141,6 +170,7 @@ export async function runPublicDiarist(
|
|
|
141
170
|
...(env.createRunId === undefined ? {} : { createRunId: env.createRunId }),
|
|
142
171
|
...(env.model === undefined ? {} : { model: env.model }),
|
|
143
172
|
...(env.correlationId === undefined ? {} : { correlationId: env.correlationId }),
|
|
173
|
+
...(handoffTicket === undefined ? {} : { assertedTicketNumber: handoffTicket }),
|
|
144
174
|
});
|
|
145
175
|
} catch (error) {
|
|
146
176
|
if (error instanceof CliUsageError) {
|
|
@@ -152,14 +182,6 @@ export async function runPublicDiarist(
|
|
|
152
182
|
|
|
153
183
|
await markRunAdmitted(admitted, env.principalAuthority);
|
|
154
184
|
|
|
155
|
-
// Typed handoff: bind before the turn so identity is on durable pages.
|
|
156
|
-
if (
|
|
157
|
-
typeof handoffTicket === "number" &&
|
|
158
|
-
Number.isSafeInteger(handoffTicket) &&
|
|
159
|
-
handoffTicket >= 1
|
|
160
|
-
) {
|
|
161
|
-
await bindAdmittedTicketNumber(admitted, handoffTicket);
|
|
162
|
-
}
|
|
163
185
|
|
|
164
186
|
const turnProjection: RoleTurnRequestProjectionOptions = {
|
|
165
187
|
packageRoot: env.packageRoot,
|
|
@@ -189,22 +211,8 @@ export async function runPublicDiarist(
|
|
|
189
211
|
env,
|
|
190
212
|
io,
|
|
191
213
|
request: turnRequest,
|
|
192
|
-
adapters: diaristAdapters(),
|
|
214
|
+
adapters: diaristAdapters(env),
|
|
193
215
|
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
194
|
-
}).then(async (result) => {
|
|
195
|
-
// Accept hook binds ticket onto durable pages (#771). Mirror that page fact
|
|
196
|
-
// onto the caller-visible admitted object — never pick a ticketNumber out of
|
|
197
|
-
// the payload sequence (#881 sole-collapse ban on ticket/escalate).
|
|
198
|
-
if (admitted.ticketNumber === undefined && result.admitted !== undefined) {
|
|
199
|
-
const fromPages = await readRunTicketNumber(admitted.runDirectory);
|
|
200
|
-
if (fromPages !== undefined) {
|
|
201
|
-
await bindAdmittedTicketNumber(admitted, fromPages);
|
|
202
|
-
if (result.admitted.ticketNumber === undefined) {
|
|
203
|
-
(result.admitted as { ticketNumber?: number }).ticketNumber = fromPages;
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
return result;
|
|
208
216
|
});
|
|
209
217
|
}
|
|
210
218
|
|
|
@@ -242,7 +250,7 @@ export async function runPublicDiaristResume(
|
|
|
242
250
|
),
|
|
243
251
|
);
|
|
244
252
|
},
|
|
245
|
-
adapters: diaristAdapters(),
|
|
253
|
+
adapters: diaristAdapters(env),
|
|
246
254
|
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
247
255
|
});
|
|
248
256
|
}
|
|
@@ -12,6 +12,7 @@ import { tryResumeSameTicketSeatRun } from "./seat-ticket-binding.ts";
|
|
|
12
12
|
import {
|
|
13
13
|
admitInspectorInvocation,
|
|
14
14
|
buildInspectorTransportPrompt,
|
|
15
|
+
persistAdmittedSourceRunPath,
|
|
15
16
|
type AdmittedInspectorInvocation,
|
|
16
17
|
type ParseInspectorArgvResult,
|
|
17
18
|
} from "./invocation.ts";
|
|
@@ -50,18 +51,35 @@ export type InspectorRunEnv = PostAdmissionEnv & {
|
|
|
50
51
|
* Never a public CLI argv — must not pollute the 卷宗指针 parentRunPath key (#747).
|
|
51
52
|
*/
|
|
52
53
|
reviewReask?: string;
|
|
54
|
+
/**
|
|
55
|
+
* #879 gate summons: verbatim parent-submission body for officer dialogue content.
|
|
56
|
+
* Rides summons.instruction / first-mint prompt when reviewReask is absent.
|
|
57
|
+
* Argv 卷宗指针 stays the binding/lookup key only.
|
|
58
|
+
*/
|
|
59
|
+
gateReviewInstruction?: string;
|
|
53
60
|
};
|
|
54
61
|
|
|
62
|
+
function inspectorParentRunPath(
|
|
63
|
+
admitted: AdmittedInspectorInvocation,
|
|
64
|
+
): string | undefined {
|
|
65
|
+
if (typeof admitted.sourceRunPath === "string" && admitted.sourceRunPath.trim() !== "") {
|
|
66
|
+
return admitted.sourceRunPath;
|
|
67
|
+
}
|
|
68
|
+
return parentRunPathFromGatePointerInstruction(admitted.instruction);
|
|
69
|
+
}
|
|
70
|
+
|
|
55
71
|
/** Project admitted invocation onto the host-neutral turn request. */
|
|
56
72
|
export function buildInspectorTurnRequest(
|
|
57
73
|
admitted: AdmittedInspectorInvocation,
|
|
58
74
|
options: RoleTurnRequestProjectionOptions,
|
|
59
75
|
): RoleTurnRequest {
|
|
76
|
+
const sourceRun = inspectorParentRunPath(admitted);
|
|
60
77
|
return projectRoleTurnRequest(
|
|
61
78
|
admitted,
|
|
62
79
|
{
|
|
63
80
|
activation: {
|
|
64
81
|
role: "inspector" as const,
|
|
82
|
+
...(sourceRun === undefined ? {} : { sourceRun }),
|
|
65
83
|
},
|
|
66
84
|
},
|
|
67
85
|
options,
|
|
@@ -97,7 +115,7 @@ export async function runPublicInspector(
|
|
|
97
115
|
// #753/#786: gate re-ask / verbatim submission body ride summons.instruction on resume.
|
|
98
116
|
const parentRunPath = parentRunPathFromGatePointerInstruction(parsed.instruction);
|
|
99
117
|
if (parentRunPath !== undefined) {
|
|
100
|
-
const resumeInstruction = env.reviewReask;
|
|
118
|
+
const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
|
|
101
119
|
const summons: SameTicketSummonsMaterials = {
|
|
102
120
|
sourceRunPath: parentRunPath,
|
|
103
121
|
...(resumeInstruction === undefined
|
|
@@ -147,6 +165,10 @@ export async function runPublicInspector(
|
|
|
147
165
|
}
|
|
148
166
|
|
|
149
167
|
await markRunAdmitted(admitted, env.principalAuthority);
|
|
168
|
+
if (parentRunPath !== undefined) {
|
|
169
|
+
await persistAdmittedSourceRunPath(admitted, parentRunPath);
|
|
170
|
+
admitted = { ...admitted, sourceRunPath: parentRunPath };
|
|
171
|
+
}
|
|
150
172
|
|
|
151
173
|
const engineMaterial = engineSessionMaterialFromOptions({
|
|
152
174
|
...pickEngineAxis(env),
|
|
@@ -164,7 +186,9 @@ export async function runPublicInspector(
|
|
|
164
186
|
: { correlationId: env.correlationId }),
|
|
165
187
|
continuation: {
|
|
166
188
|
kind: "initial",
|
|
167
|
-
|
|
189
|
+
// #879: gate first mint uses parent payload as content; binding stays typed activation.
|
|
190
|
+
prompt: (env.reviewReask ?? env.gateReviewInstruction)
|
|
191
|
+
?? buildInspectorTransportPrompt(admitted, engineMaterial),
|
|
168
192
|
},
|
|
169
193
|
});
|
|
170
194
|
|
|
@@ -7,13 +7,12 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import type { DurablePrincipalAuthority, RoleTurnRequest } from "../host-contracts.ts";
|
|
9
9
|
import { engineSessionMaterialFromOptions, pickEngineAxis } from "../package-resources/engine-material.ts";
|
|
10
|
-
import {
|
|
10
|
+
import { readBoardTicketNumber } from "../run-ticket-number.ts";
|
|
11
11
|
import { CliUsageError } from "./cli-errors.ts";
|
|
12
12
|
import {
|
|
13
13
|
admitAuditorInvocation,
|
|
14
14
|
admitGatekeeperInvocation,
|
|
15
15
|
admitNavigatorInvocation,
|
|
16
|
-
bindAdmittedTicketNumber,
|
|
17
16
|
buildInstructionTransportPrompt,
|
|
18
17
|
persistAdmittedSourceRunPath,
|
|
19
18
|
type AdmittedAuditorInvocation,
|
|
@@ -69,6 +68,11 @@ export type InstructionSeatRunEnv = PostAdmissionEnv & {
|
|
|
69
68
|
* Never a public CLI argv — must not pollute the --source-run parent lookup key (#747).
|
|
70
69
|
*/
|
|
71
70
|
reviewReask?: string;
|
|
71
|
+
/**
|
|
72
|
+
* #879 gate summons: verbatim parent-submission body for officer dialogue content.
|
|
73
|
+
* Rides summons.instruction / first-mint prompt when reviewReask is absent.
|
|
74
|
+
*/
|
|
75
|
+
gateReviewInstruction?: string;
|
|
72
76
|
};
|
|
73
77
|
|
|
74
78
|
/** Project an admitted instruction-seat invocation onto the host-neutral turn request. */
|
|
@@ -281,7 +285,8 @@ export async function runPublicInstructionSeat(
|
|
|
281
285
|
home: env.home,
|
|
282
286
|
});
|
|
283
287
|
auditorSourceRun = resolved.runDirectory;
|
|
284
|
-
|
|
288
|
+
// Auditor inherits board identity only — migration-derived is display, not admission.
|
|
289
|
+
auditorSourceTicket = await readBoardTicketNumber(resolved.runDirectory);
|
|
285
290
|
} catch (error) {
|
|
286
291
|
presentStructuralRejection(
|
|
287
292
|
new CliUsageError(error instanceof Error ? error.message : String(error)),
|
|
@@ -291,8 +296,9 @@ export async function runPublicInstructionSeat(
|
|
|
291
296
|
}
|
|
292
297
|
}
|
|
293
298
|
|
|
294
|
-
// #756/#
|
|
295
|
-
|
|
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;
|
|
296
302
|
const summons: SameTicketSummonsMaterials = {
|
|
297
303
|
...(resumeInstruction === undefined
|
|
298
304
|
? {
|
|
@@ -339,6 +345,9 @@ export async function runPublicInstructionSeat(
|
|
|
339
345
|
...(env.createRunId === undefined ? {} : { createRunId: env.createRunId }),
|
|
340
346
|
...(env.model === undefined ? {} : { model: env.model }),
|
|
341
347
|
...(env.correlationId === undefined ? {} : { correlationId: env.correlationId }),
|
|
348
|
+
...(auditorSourceTicket === undefined
|
|
349
|
+
? {}
|
|
350
|
+
: { assertedTicketNumber: auditorSourceTicket }),
|
|
342
351
|
});
|
|
343
352
|
} catch (error) {
|
|
344
353
|
if (error instanceof CliUsageError) {
|
|
@@ -372,13 +381,15 @@ export async function runPublicInstructionSeat(
|
|
|
372
381
|
: { correlationId: env.correlationId }),
|
|
373
382
|
continuation: {
|
|
374
383
|
kind: "initial",
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
384
|
+
// #879: gate first mint uses parent payload as content when present.
|
|
385
|
+
prompt: (env.reviewReask ?? env.gateReviewInstruction)
|
|
386
|
+
?? buildInstructionTransportPrompt(
|
|
387
|
+
admitted,
|
|
388
|
+
engineSessionMaterialFromOptions({
|
|
389
|
+
...pickEngineAxis(env),
|
|
390
|
+
packageRoot: env.packageRoot,
|
|
391
|
+
}),
|
|
392
|
+
),
|
|
382
393
|
},
|
|
383
394
|
});
|
|
384
395
|
|
|
@@ -387,14 +398,7 @@ export async function runPublicInstructionSeat(
|
|
|
387
398
|
env,
|
|
388
399
|
io,
|
|
389
400
|
request: turnRequest,
|
|
390
|
-
adapters: instructionSeatAdapters(
|
|
391
|
-
beforeDispatch: async (admittedSeat) => {
|
|
392
|
-
// Auditor inherits source-run ticket (notary face) — typed, not prose match.
|
|
393
|
-
if (auditorSourceTicket !== undefined) {
|
|
394
|
-
await bindAdmittedTicketNumber(admittedSeat, auditorSourceTicket);
|
|
395
|
-
}
|
|
396
|
-
},
|
|
397
|
-
}),
|
|
401
|
+
adapters: instructionSeatAdapters(),
|
|
398
402
|
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
399
403
|
});
|
|
400
404
|
},
|