@akagilnc/pi-workflow-roles 0.1.3452 → 0.1.3471
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/CLAUDE.md +2 -0
- package/dist/evidence-child-executor.js +2 -11
- package/dist/grok/production-host.js +196 -205
- package/dist/pi/in-process-session.js +4 -0
- package/dist/public-cli/main.js +998 -920
- package/package.json +1 -1
- package/scripts/build-package.mjs +1 -3
- package/src/analyst-gate-cycles-read.ts +3 -21
- package/src/analyst-ledger.ts +11 -42
- package/src/archivist-record-entry.ts +5 -6
- package/src/evidence-child-executor.ts +5 -15
- package/src/grok/production-host.ts +3 -32
- package/src/grok/role-envelope.ts +10 -4
- package/src/host-contracts.ts +4 -11
- package/src/host-transition-prior-native.ts +3 -7
- package/src/ledger-session-read.ts +1 -17
- package/src/pi/in-process-session.ts +6 -2
- package/src/pi/role-turn-host.ts +9 -0
- package/src/public-cli/collector-run.ts +4 -4
- package/src/public-cli/countersign-run.ts +90 -20
- package/src/public-cli/doctor-run.ts +4 -4
- package/src/public-cli/gleaner-left-run.ts +9 -6
- package/src/public-cli/inspector-run.ts +95 -32
- package/src/public-cli/instruction-seat-run.ts +7 -6
- package/src/public-cli/invocation.ts +14 -8
- package/src/public-cli/judge-run.ts +4 -4
- package/src/public-cli/notary-run.ts +91 -30
- package/src/public-cli/post-admission.ts +424 -360
- package/src/public-cli/run-lifecycle.ts +205 -0
- package/src/public-cli/seat-ticket-binding.ts +136 -16
- package/src/public-cli/settlement.ts +74 -52
- package/src/run-ticket-number.ts +53 -0
- package/src/submission-ledger.ts +86 -18
- package/dist/ledger-session-read.js +0 -241
- package/dist/ticket-seat-memory.js +0 -244
- package/src/ticket-seat-memory.ts +0 -454
|
@@ -23,9 +23,15 @@ import {
|
|
|
23
23
|
type AdmittedCountersignInvocation,
|
|
24
24
|
type ParseCountersignArgvResult,
|
|
25
25
|
} from "./invocation.ts";
|
|
26
|
-
import {
|
|
26
|
+
import {
|
|
27
|
+
applyInstructionTicketProbe,
|
|
28
|
+
probeInstructionTicket,
|
|
29
|
+
ticketNumberFromProbe,
|
|
30
|
+
tryResumeSameTicketSeatRun,
|
|
31
|
+
} from "./seat-ticket-binding.ts";
|
|
27
32
|
import { tryHomeFromAkRolesPath } from "../activation-ledger-topology.ts";
|
|
28
33
|
import {
|
|
34
|
+
prepareSummonsResumeMaterials,
|
|
29
35
|
runPostAdmissionOneShot,
|
|
30
36
|
type PostAdmissionEnv,
|
|
31
37
|
runPostAdmissionSeatResume,
|
|
@@ -35,6 +41,7 @@ import {
|
|
|
35
41
|
loadResumableCountersignRun,
|
|
36
42
|
markRunAdmitted,
|
|
37
43
|
type PublicResumeRequest,
|
|
44
|
+
type SameTicketSummonsMaterials,
|
|
38
45
|
} from "./run-lifecycle.ts";
|
|
39
46
|
import {
|
|
40
47
|
presentStructuralRejection,
|
|
@@ -82,9 +89,52 @@ export async function runPublicCountersign(
|
|
|
82
89
|
admitted?: AdmittedCountersignInvocation;
|
|
83
90
|
terminal?: TerminalResult;
|
|
84
91
|
}> {
|
|
92
|
+
let parsed: ParseCountersignArgvResult;
|
|
93
|
+
try {
|
|
94
|
+
parsed = parseCountersignArgv(argv);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
if (error instanceof CliUsageError) {
|
|
97
|
+
presentStructuralRejection(error, io);
|
|
98
|
+
return { exitCode: 2 };
|
|
99
|
+
}
|
|
100
|
+
throw error;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// #637: same ticket → resume prior countersign run with this summons' materials.
|
|
104
|
+
// Probe captures DiaristTicketResolutionError so admit+beforeDispatch can settle
|
|
105
|
+
// controlled failure (bare pre-admit throw skips terminal settlement).
|
|
106
|
+
// No bare catch→fresh: lookup/resume failures surface; only true absence mints new.
|
|
107
|
+
const projectRoot = parsed.project ?? env.cwd;
|
|
108
|
+
const ticketProbe = await probeInstructionTicket(
|
|
109
|
+
parsed.instruction,
|
|
110
|
+
projectRoot,
|
|
111
|
+
env,
|
|
112
|
+
);
|
|
113
|
+
const probedTicketNumber = ticketNumberFromProbe(ticketProbe);
|
|
114
|
+
if (probedTicketNumber !== undefined) {
|
|
115
|
+
const summons: SameTicketSummonsMaterials = {
|
|
116
|
+
instruction: parsed.instruction,
|
|
117
|
+
instructionEmpty: parsed.instruction.trim() === "",
|
|
118
|
+
attachmentPaths: parsed.attachmentPaths,
|
|
119
|
+
};
|
|
120
|
+
const resumed = await tryResumeSameTicketSeatRun({
|
|
121
|
+
home: env.home,
|
|
122
|
+
projectRoot,
|
|
123
|
+
role: "countersign",
|
|
124
|
+
ticketNumber: probedTicketNumber,
|
|
125
|
+
summons,
|
|
126
|
+
resume: (runId, materials) =>
|
|
127
|
+
runPublicCountersignResume(
|
|
128
|
+
{ runId, ...(materials === undefined ? {} : { summons: materials }) },
|
|
129
|
+
env,
|
|
130
|
+
io,
|
|
131
|
+
),
|
|
132
|
+
});
|
|
133
|
+
if (resumed !== undefined) return resumed;
|
|
134
|
+
}
|
|
135
|
+
|
|
85
136
|
let admitted: AdmittedCountersignInvocation;
|
|
86
137
|
try {
|
|
87
|
-
const parsed = parseCountersignArgv(argv);
|
|
88
138
|
admitted = await admitCountersignInvocation({
|
|
89
139
|
home: env.home,
|
|
90
140
|
principalAuthority: env.principalAuthority,
|
|
@@ -127,7 +177,7 @@ export async function runPublicCountersign(
|
|
|
127
177
|
),
|
|
128
178
|
},
|
|
129
179
|
};
|
|
130
|
-
// Mutable shell:
|
|
180
|
+
// Mutable shell: ticket bind re-projects activation before executeTurn.
|
|
131
181
|
const turnRequest = buildCountersignTurnRequest(admitted, turnProjection);
|
|
132
182
|
|
|
133
183
|
return await runPostAdmissionOneShot({
|
|
@@ -137,8 +187,8 @@ export async function runPublicCountersign(
|
|
|
137
187
|
request: turnRequest,
|
|
138
188
|
adapters: countersignAdapters({
|
|
139
189
|
beforeDispatch: async (admitted) => {
|
|
140
|
-
|
|
141
|
-
|
|
190
|
+
// #635/#637: apply pre-admit probe inside controlled-failure boundary.
|
|
191
|
+
await applyInstructionTicketProbe(admitted, ticketProbe);
|
|
142
192
|
Object.assign(
|
|
143
193
|
turnRequest,
|
|
144
194
|
buildCountersignTurnRequest(admitted, turnProjection),
|
|
@@ -156,8 +206,11 @@ function countersignAdapters(options?: {
|
|
|
156
206
|
) => void | Promise<void>;
|
|
157
207
|
}) {
|
|
158
208
|
return {
|
|
159
|
-
trySettle: (
|
|
160
|
-
|
|
209
|
+
trySettle: (
|
|
210
|
+
admitted: AdmittedCountersignInvocation,
|
|
211
|
+
authority: DurablePrincipalAuthority,
|
|
212
|
+
scope?: { readonly courtAttemptId?: string },
|
|
213
|
+
) => trySettleCountersignTerminalResult(admitted, authority, scope),
|
|
161
214
|
// Accepted receipts and failure terminals both present via shared path.
|
|
162
215
|
shouldPresentSettled: () => true,
|
|
163
216
|
...(options?.beforeDispatch === undefined
|
|
@@ -167,8 +220,11 @@ function countersignAdapters(options?: {
|
|
|
167
220
|
}
|
|
168
221
|
|
|
169
222
|
/**
|
|
170
|
-
* Resume a previously admitted Countersign run (#599 / DK-3).
|
|
171
|
-
* Restores role/ticket/
|
|
223
|
+
* Resume a previously admitted Countersign run (#599 / DK-3 / #637).
|
|
224
|
+
* Restores role/ticket/session identity. Every court re-entry runs the diarist
|
|
225
|
+
* station first (ADR 0075 refresh-every-court). Same-ticket summons deliver this
|
|
226
|
+
* turn's instruction + frozen attachments on the resume prompt; manual resume
|
|
227
|
+
* keeps package-envelope / caller-message semantics and birth attachments.
|
|
172
228
|
*/
|
|
173
229
|
export async function runPublicCountersignResume(
|
|
174
230
|
request: PublicResumeRequest,
|
|
@@ -183,18 +239,32 @@ export async function runPublicCountersignResume(
|
|
|
183
239
|
request,
|
|
184
240
|
env,
|
|
185
241
|
io,
|
|
186
|
-
load: () =>
|
|
242
|
+
load: (effective) =>
|
|
187
243
|
loadResumableCountersignRun(
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
buildTurnRequest: (admitted) =>
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
244
|
+
env.home,
|
|
245
|
+
effective.runId,
|
|
246
|
+
env.principalAuthority,
|
|
247
|
+
),
|
|
248
|
+
buildTurnRequest: async (admitted, effective) => {
|
|
249
|
+
const summonsPrepared = await prepareSummonsResumeMaterials(
|
|
250
|
+
admitted.runDirectory,
|
|
251
|
+
effective.summons,
|
|
252
|
+
);
|
|
253
|
+
return buildCountersignTurnRequest(
|
|
254
|
+
admitted,
|
|
255
|
+
resumeTurnRequestProjectionOptions(
|
|
256
|
+
admitted,
|
|
257
|
+
effective,
|
|
258
|
+
env,
|
|
259
|
+
summonsPrepared,
|
|
260
|
+
),
|
|
261
|
+
);
|
|
262
|
+
},
|
|
263
|
+
adapters: countersignAdapters({
|
|
264
|
+
beforeDispatch: async (admitted) => {
|
|
265
|
+
await runCountersignDiaristStation(admitted, env);
|
|
266
|
+
},
|
|
267
|
+
}),
|
|
198
268
|
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
199
269
|
});
|
|
200
270
|
}
|
|
@@ -143,16 +143,16 @@ export async function runPublicDoctorResume(
|
|
|
143
143
|
request,
|
|
144
144
|
env,
|
|
145
145
|
io,
|
|
146
|
-
load: () =>
|
|
146
|
+
load: (effective) =>
|
|
147
147
|
loadResumableDoctorRun(
|
|
148
148
|
env.home,
|
|
149
|
-
|
|
149
|
+
effective.runId,
|
|
150
150
|
env.principalAuthority,
|
|
151
151
|
),
|
|
152
|
-
buildTurnRequest: (admitted) =>
|
|
152
|
+
buildTurnRequest: (admitted, effective) =>
|
|
153
153
|
buildDoctorTurnRequest(
|
|
154
154
|
admitted,
|
|
155
|
-
resumeTurnRequestProjectionOptions(admitted,
|
|
155
|
+
resumeTurnRequestProjectionOptions(admitted, effective, env),
|
|
156
156
|
),
|
|
157
157
|
adapters: doctorAdapters(),
|
|
158
158
|
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
@@ -124,8 +124,11 @@ export async function runPublicGleanerLeft(
|
|
|
124
124
|
|
|
125
125
|
function gleanerLeftAdapters() {
|
|
126
126
|
return {
|
|
127
|
-
trySettle: (
|
|
128
|
-
|
|
127
|
+
trySettle: (
|
|
128
|
+
admitted: AdmittedGleanerLeftInvocation,
|
|
129
|
+
authority: DurablePrincipalAuthority,
|
|
130
|
+
scope?: { readonly courtAttemptId?: string },
|
|
131
|
+
) => trySettleGleanerLeftTerminalResult(admitted, authority, scope),
|
|
129
132
|
shouldPresentSettled: () => true,
|
|
130
133
|
};
|
|
131
134
|
}
|
|
@@ -147,16 +150,16 @@ export async function runPublicGleanerLeftResume(
|
|
|
147
150
|
request,
|
|
148
151
|
env,
|
|
149
152
|
io,
|
|
150
|
-
load: () =>
|
|
153
|
+
load: (effective) =>
|
|
151
154
|
loadResumableGleanerLeftRun(
|
|
152
155
|
env.home,
|
|
153
|
-
|
|
156
|
+
effective.runId,
|
|
154
157
|
env.principalAuthority,
|
|
155
158
|
),
|
|
156
|
-
buildTurnRequest: (admitted) =>
|
|
159
|
+
buildTurnRequest: (admitted, effective) =>
|
|
157
160
|
buildGleanerLeftTurnRequest(
|
|
158
161
|
admitted,
|
|
159
|
-
resumeTurnRequestProjectionOptions(admitted,
|
|
162
|
+
resumeTurnRequestProjectionOptions(admitted, effective, env),
|
|
160
163
|
),
|
|
161
164
|
adapters: gleanerLeftAdapters(),
|
|
162
165
|
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
@@ -3,12 +3,17 @@
|
|
|
3
3
|
* coordinator → settle Terminal result (#568 / ADR 0074). Lawful releases:
|
|
4
4
|
* pass/bounce/escalate. #633: manual resume continues the exact session. Dual path
|
|
5
5
|
* with gate-province dispatch; this module is the direct command face.
|
|
6
|
+
* #637: same-ticket re-summons resume the seat's previous run (no new run).
|
|
6
7
|
*/
|
|
7
8
|
import type { DurablePrincipalAuthority, RoleTurnRequest } from "../host-contracts.ts";
|
|
8
9
|
import { engineSessionMaterialFromOptions } from "../package-resources/engine-material.ts";
|
|
9
|
-
import { rebindAdmittedToTicketSeatMemory } from "../ticket-seat-memory.ts";
|
|
10
10
|
import { CliUsageError } from "./cli-errors.ts";
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
applyInstructionTicketProbe,
|
|
13
|
+
probeInstructionTicket,
|
|
14
|
+
ticketNumberFromProbe,
|
|
15
|
+
tryResumeSameTicketSeatRun,
|
|
16
|
+
} from "./seat-ticket-binding.ts";
|
|
12
17
|
import {
|
|
13
18
|
admitInspectorInvocation,
|
|
14
19
|
buildInspectorTransportPrompt,
|
|
@@ -16,6 +21,7 @@ import {
|
|
|
16
21
|
type ParseInspectorArgvResult,
|
|
17
22
|
} from "./invocation.ts";
|
|
18
23
|
import {
|
|
24
|
+
prepareSummonsResumeMaterials,
|
|
19
25
|
runPostAdmissionOneShot,
|
|
20
26
|
type PostAdmissionAdapters,
|
|
21
27
|
type PostAdmissionEnv,
|
|
@@ -26,6 +32,7 @@ import {
|
|
|
26
32
|
loadResumableInspectorRun,
|
|
27
33
|
markRunAdmitted,
|
|
28
34
|
type PublicResumeRequest,
|
|
35
|
+
type SameTicketSummonsMaterials,
|
|
29
36
|
} from "./run-lifecycle.ts";
|
|
30
37
|
import {
|
|
31
38
|
presentStructuralRejection,
|
|
@@ -69,9 +76,52 @@ export async function runPublicInspector(
|
|
|
69
76
|
admitted?: AdmittedInspectorInvocation;
|
|
70
77
|
terminal?: TerminalResult;
|
|
71
78
|
}> {
|
|
79
|
+
let parsed: ParseInspectorArgvResult;
|
|
80
|
+
try {
|
|
81
|
+
parsed = parseInspectorArgv(argv);
|
|
82
|
+
} catch (error) {
|
|
83
|
+
if (error instanceof CliUsageError) {
|
|
84
|
+
presentStructuralRejection(error, io);
|
|
85
|
+
return { exitCode: 2 };
|
|
86
|
+
}
|
|
87
|
+
throw error;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// #637: same ticket → resume prior inspector run with this summons' materials.
|
|
91
|
+
// Probe captures DiaristTicketResolutionError so admit+beforeDispatch can settle
|
|
92
|
+
// controlled failure (bare pre-admit throw skips terminal settlement).
|
|
93
|
+
// No bare catch→fresh: lookup/resume failures surface; only true absence mints new.
|
|
94
|
+
const projectRoot = parsed.project ?? env.cwd;
|
|
95
|
+
const ticketProbe = await probeInstructionTicket(
|
|
96
|
+
parsed.instruction,
|
|
97
|
+
projectRoot,
|
|
98
|
+
env,
|
|
99
|
+
);
|
|
100
|
+
const probedTicketNumber = ticketNumberFromProbe(ticketProbe);
|
|
101
|
+
if (probedTicketNumber !== undefined) {
|
|
102
|
+
const summons: SameTicketSummonsMaterials = {
|
|
103
|
+
instruction: parsed.instruction,
|
|
104
|
+
instructionEmpty: parsed.instruction.trim() === "",
|
|
105
|
+
attachmentPaths: parsed.attachmentPaths,
|
|
106
|
+
};
|
|
107
|
+
const resumed = await tryResumeSameTicketSeatRun({
|
|
108
|
+
home: env.home,
|
|
109
|
+
projectRoot,
|
|
110
|
+
role: "inspector",
|
|
111
|
+
ticketNumber: probedTicketNumber,
|
|
112
|
+
summons,
|
|
113
|
+
resume: (runId, materials) =>
|
|
114
|
+
runPublicInspectorResume(
|
|
115
|
+
{ runId, ...(materials === undefined ? {} : { summons: materials }) },
|
|
116
|
+
env,
|
|
117
|
+
io,
|
|
118
|
+
),
|
|
119
|
+
});
|
|
120
|
+
if (resumed !== undefined) return resumed;
|
|
121
|
+
}
|
|
122
|
+
|
|
72
123
|
let admitted: AdmittedInspectorInvocation;
|
|
73
124
|
try {
|
|
74
|
-
const parsed = parseInspectorArgv(argv);
|
|
75
125
|
admitted = await admitInspectorInvocation({
|
|
76
126
|
home: env.home,
|
|
77
127
|
principalAuthority: env.principalAuthority,
|
|
@@ -91,26 +141,12 @@ export async function runPublicInspector(
|
|
|
91
141
|
throw error;
|
|
92
142
|
}
|
|
93
143
|
|
|
94
|
-
// #635 seat self-ticket then #636 ticket+seat memory principal (before admitted mark).
|
|
95
|
-
await resolveSeatTicketBinding(admitted, env);
|
|
96
|
-
const memory = await rebindAdmittedToTicketSeatMemory({
|
|
97
|
-
admitted,
|
|
98
|
-
seat: "inspector",
|
|
99
|
-
principalAuthority: env.principalAuthority,
|
|
100
|
-
});
|
|
101
144
|
await markRunAdmitted(admitted, env.principalAuthority);
|
|
102
145
|
|
|
103
|
-
// Same ticket nest already present → native host resume (not a fresh initial).
|
|
104
|
-
// Prompt is the same officer transport; only continuation kind flips (#636 / ADR 0079).
|
|
105
146
|
const engineMaterial = engineSessionMaterialFromOptions({
|
|
106
147
|
...(env.engine === undefined ? {} : { engine: env.engine }),
|
|
107
148
|
packageRoot: env.packageRoot,
|
|
108
149
|
});
|
|
109
|
-
const continuation = {
|
|
110
|
-
kind: memory?.resumed === true ? ("resume" as const) : ("initial" as const),
|
|
111
|
-
prompt: buildInspectorTransportPrompt(admitted, engineMaterial),
|
|
112
|
-
};
|
|
113
|
-
|
|
114
150
|
const turnRequest = buildInspectorTurnRequest(admitted, {
|
|
115
151
|
packageRoot: env.packageRoot,
|
|
116
152
|
home: env.home,
|
|
@@ -121,7 +157,10 @@ export async function runPublicInspector(
|
|
|
121
157
|
...(env.correlationId === undefined || env.correlationId.trim() === ""
|
|
122
158
|
? {}
|
|
123
159
|
: { correlationId: env.correlationId }),
|
|
124
|
-
continuation
|
|
160
|
+
continuation: {
|
|
161
|
+
kind: "initial",
|
|
162
|
+
prompt: buildInspectorTransportPrompt(admitted, engineMaterial),
|
|
163
|
+
},
|
|
125
164
|
});
|
|
126
165
|
|
|
127
166
|
return await runPostAdmissionOneShot({
|
|
@@ -129,20 +168,34 @@ export async function runPublicInspector(
|
|
|
129
168
|
env,
|
|
130
169
|
io,
|
|
131
170
|
request: turnRequest,
|
|
132
|
-
adapters: inspectorAdapters(
|
|
171
|
+
adapters: inspectorAdapters({
|
|
172
|
+
beforeDispatch: async (admittedSeat) => {
|
|
173
|
+
// #635/#637: apply pre-admit probe inside controlled-failure boundary.
|
|
174
|
+
await applyInstructionTicketProbe(admittedSeat, ticketProbe);
|
|
175
|
+
},
|
|
176
|
+
}),
|
|
133
177
|
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
134
178
|
});
|
|
135
179
|
}
|
|
136
180
|
|
|
137
|
-
function inspectorAdapters(
|
|
181
|
+
function inspectorAdapters(options?: {
|
|
182
|
+
beforeDispatch?: (
|
|
183
|
+
admitted: AdmittedInspectorInvocation,
|
|
184
|
+
) => void | Promise<void>;
|
|
185
|
+
}): PostAdmissionAdapters<AdmittedInspectorInvocation> {
|
|
138
186
|
return {
|
|
139
|
-
trySettle: (admitted, authority) => trySettleInspectorTerminalResult(admitted, authority),
|
|
187
|
+
trySettle: (admitted, authority, scope) => trySettleInspectorTerminalResult(admitted, authority, scope),
|
|
140
188
|
shouldPresentSettled: () => true,
|
|
189
|
+
...(options?.beforeDispatch === undefined
|
|
190
|
+
? {}
|
|
191
|
+
: { beforeDispatch: options.beforeDispatch }),
|
|
141
192
|
};
|
|
142
193
|
}
|
|
143
194
|
|
|
144
195
|
/**
|
|
145
|
-
* Resume a previously admitted Inspector run (#633); the session principal reopens.
|
|
196
|
+
* Resume a previously admitted Inspector run (#633 / #637); the session principal reopens.
|
|
197
|
+
* Same-ticket summons deliver this turn's instruction + frozen attachments; manual
|
|
198
|
+
* resume keeps package-envelope / caller-message semantics and birth attachments.
|
|
146
199
|
*/
|
|
147
200
|
export async function runPublicInspectorResume(
|
|
148
201
|
request: PublicResumeRequest,
|
|
@@ -157,17 +210,27 @@ export async function runPublicInspectorResume(
|
|
|
157
210
|
request,
|
|
158
211
|
env,
|
|
159
212
|
io,
|
|
160
|
-
load: () =>
|
|
213
|
+
load: (effective) =>
|
|
161
214
|
loadResumableInspectorRun(
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
buildTurnRequest: (admitted) =>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
215
|
+
env.home,
|
|
216
|
+
effective.runId,
|
|
217
|
+
env.principalAuthority,
|
|
218
|
+
),
|
|
219
|
+
buildTurnRequest: async (admitted, effective) => {
|
|
220
|
+
const summonsPrepared = await prepareSummonsResumeMaterials(
|
|
221
|
+
admitted.runDirectory,
|
|
222
|
+
effective.summons,
|
|
223
|
+
);
|
|
224
|
+
return buildInspectorTurnRequest(
|
|
225
|
+
admitted,
|
|
226
|
+
resumeTurnRequestProjectionOptions(
|
|
227
|
+
admitted,
|
|
228
|
+
effective,
|
|
229
|
+
env,
|
|
230
|
+
summonsPrepared,
|
|
231
|
+
),
|
|
232
|
+
);
|
|
233
|
+
},
|
|
171
234
|
adapters: inspectorAdapters(),
|
|
172
235
|
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
173
236
|
});
|
|
@@ -70,10 +70,11 @@ function instructionSeatAdapters() {
|
|
|
70
70
|
trySettle: (
|
|
71
71
|
admitted: AdmittedInstructionSeatInvocation,
|
|
72
72
|
authority: DurablePrincipalAuthority,
|
|
73
|
+
scope?: { readonly courtAttemptId?: string },
|
|
73
74
|
) =>
|
|
74
75
|
admitted.role === "gatekeeper"
|
|
75
|
-
? trySettleGatekeeperTerminalResult(admitted, authority)
|
|
76
|
-
: trySettleNavigatorTerminalResult(admitted, authority),
|
|
76
|
+
? trySettleGatekeeperTerminalResult(admitted, authority, scope)
|
|
77
|
+
: trySettleNavigatorTerminalResult(admitted, authority, scope),
|
|
77
78
|
// Accepted receipts and failure terminals both present via shared path.
|
|
78
79
|
shouldPresentSettled: () => true,
|
|
79
80
|
};
|
|
@@ -88,14 +89,14 @@ export async function runPublicInstructionSeatResume(
|
|
|
88
89
|
request,
|
|
89
90
|
env,
|
|
90
91
|
io,
|
|
91
|
-
load: () => loadResumableInstructionSeatRun(
|
|
92
|
+
load: (effective) => loadResumableInstructionSeatRun(
|
|
92
93
|
env.home,
|
|
93
|
-
|
|
94
|
+
effective.runId,
|
|
94
95
|
env.principalAuthority,
|
|
95
96
|
),
|
|
96
|
-
buildTurnRequest: (admitted) => buildInstructionSeatTurnRequest(
|
|
97
|
+
buildTurnRequest: (admitted, effective) => buildInstructionSeatTurnRequest(
|
|
97
98
|
admitted,
|
|
98
|
-
resumeTurnRequestProjectionOptions(admitted,
|
|
99
|
+
resumeTurnRequestProjectionOptions(admitted, effective, env),
|
|
99
100
|
),
|
|
100
101
|
adapters: instructionSeatAdapters(),
|
|
101
102
|
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
@@ -24,7 +24,7 @@ import type {
|
|
|
24
24
|
DurablePrincipal,
|
|
25
25
|
DurablePrincipalAuthority,
|
|
26
26
|
} from "../host-contracts.ts";
|
|
27
|
-
import { readRunTicketNumber } from "../ticket-
|
|
27
|
+
import { readRunTicketNumber } from "../run-ticket-number.ts";
|
|
28
28
|
import {
|
|
29
29
|
loadDoctorCase,
|
|
30
30
|
} from "../doctor-evidence.ts";
|
|
@@ -1004,14 +1004,20 @@ async function freezeAttachments(
|
|
|
1004
1004
|
}
|
|
1005
1005
|
|
|
1006
1006
|
/**
|
|
1007
|
-
*
|
|
1008
|
-
*
|
|
1009
|
-
*
|
|
1007
|
+
* Freeze summons attachments into an already-retained run (#637 same-ticket resume).
|
|
1008
|
+
* Writes under attachments/summons-<key>/ so prior freeze names stay intact.
|
|
1009
|
+
* Manual resume never calls this — birth attachments keep their original semantics.
|
|
1010
1010
|
*/
|
|
1011
|
-
export async function
|
|
1011
|
+
export async function freezeAttachmentsIntoRun(
|
|
1012
|
+
attachmentPaths: readonly string[],
|
|
1012
1013
|
runDirectory: string,
|
|
1013
|
-
|
|
1014
|
-
|
|
1014
|
+
summonsKey: string = `s-${Date.now().toString(36)}`,
|
|
1015
|
+
): Promise<readonly FrozenAttachment[]> {
|
|
1016
|
+
if (attachmentPaths.length === 0) return [];
|
|
1017
|
+
const ledgerHome = resolveActivationLedgerHome(homeFromRunDirectory(runDirectory));
|
|
1018
|
+
const attachmentsDirectory = join(runDirectory, "attachments", summonsKey);
|
|
1019
|
+
ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
|
|
1020
|
+
return freezeAttachments(attachmentPaths, attachmentsDirectory);
|
|
1015
1021
|
}
|
|
1016
1022
|
|
|
1017
1023
|
function ticketAdmissionFields(
|
|
@@ -2332,7 +2338,7 @@ export async function admitNotaryInvocation(options: {
|
|
|
2332
2338
|
});
|
|
2333
2339
|
ensureRealDirectoryTree(ledgerHome, sessionDirectory);
|
|
2334
2340
|
const ticketFields = ticketAdmissionFields(
|
|
2335
|
-
await
|
|
2341
|
+
await readRunTicketNumber(sourceRun.runDirectory),
|
|
2336
2342
|
);
|
|
2337
2343
|
|
|
2338
2344
|
const admitted = {
|
|
@@ -184,12 +184,12 @@ export async function runPublicResume(
|
|
|
184
184
|
request,
|
|
185
185
|
env,
|
|
186
186
|
io,
|
|
187
|
-
load: () =>
|
|
188
|
-
loadResumableJudgeRun(env.home,
|
|
189
|
-
buildTurnRequest: (admitted) =>
|
|
187
|
+
load: (effective) =>
|
|
188
|
+
loadResumableJudgeRun(env.home, effective.runId, env.principalAuthority),
|
|
189
|
+
buildTurnRequest: (admitted, effective) =>
|
|
190
190
|
buildJudgeTurnRequest(
|
|
191
191
|
admitted,
|
|
192
|
-
resumeTurnRequestProjectionOptions(admitted,
|
|
192
|
+
resumeTurnRequestProjectionOptions(admitted, effective, env),
|
|
193
193
|
),
|
|
194
194
|
adapters: judgeAdapters(),
|
|
195
195
|
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|