@akagilnc/pi-workflow-roles 0.1.4800 → 0.1.4870

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.
Files changed (143) hide show
  1. package/dist/acp-host/production-host.js +19434 -18218
  2. package/dist/analyst-book-key.js +63 -0
  3. package/dist/analyst-cohort.js +167 -0
  4. package/dist/analyst-entry.js +320 -0
  5. package/dist/analyst-index.js +247 -0
  6. package/dist/analyst-ledger.js +561 -0
  7. package/dist/analyst-median.js +16 -0
  8. package/dist/analyst-metric-families/acceptance-success-rework.js +249 -0
  9. package/dist/analyst-metric-families/b2-frame-buckets-actions.js +189 -0
  10. package/dist/analyst-metric-families/gate-cycles.js +77 -0
  11. package/dist/analyst-metric-families/leg-wall-clock.js +56 -0
  12. package/dist/analyst-metric-families/round-timeline.js +126 -0
  13. package/dist/analyst-metric-families.js +23 -0
  14. package/dist/analyst-metric-family.js +11 -0
  15. package/dist/analyst-model-groups.js +135 -0
  16. package/dist/analyst-page.js +182 -0
  17. package/dist/atomic-write.js +23 -0
  18. package/dist/auditor-soul.js +1 -1
  19. package/dist/countersign-contracts.js +0 -2
  20. package/dist/diarist-contracts.js +0 -1
  21. package/dist/doctor-contracts.js +2 -2
  22. package/dist/gatekeeper-role.js +15 -16
  23. package/dist/gleaner-left-contracts.js +0 -2
  24. package/dist/headless-host/production-host.js +16967 -15749
  25. package/dist/host-contracts.js +0 -4
  26. package/dist/inspector-contracts.js +0 -2
  27. package/dist/institutional-resolution.js +4 -2
  28. package/dist/merger-contracts.js +0 -2
  29. package/dist/migrate-book-topology.js +3908 -3089
  30. package/dist/navigator-public-session.js +4 -3
  31. package/dist/notary-contracts.js +0 -2
  32. package/dist/package-contracts/auditor-output.js +0 -1
  33. package/dist/package-contracts/collector-output.js +0 -2
  34. package/dist/package-contracts/fixer-output.js +0 -2
  35. package/dist/package-contracts/gatekeeper-output.js +0 -2
  36. package/dist/package-contracts/judge-output.js +0 -2
  37. package/dist/package-contracts/navigator-output.js +0 -2
  38. package/dist/package-contracts/reviewer-output.js +0 -2
  39. package/dist/package-contracts/terminating-tools.js +32 -92
  40. package/dist/package-contracts/worker-output.js +0 -4
  41. package/dist/packaged-role-registry.js +518 -36
  42. package/dist/pi/role-turn-host.js +2 -1
  43. package/dist/public-cli/analyst-run.js +185 -0
  44. package/dist/public-cli/cli.js +885 -0
  45. package/dist/public-cli/config.js +12 -9
  46. package/dist/public-cli/countersign-run.js +4 -311
  47. package/dist/public-cli/instruction-seat-run.js +628 -158
  48. package/dist/public-cli/invocation.js +806 -1550
  49. package/dist/public-cli/main.js +6962 -9882
  50. package/dist/public-cli/option-definitions.js +51 -99
  51. package/dist/public-cli/post-admission.js +30 -2
  52. package/dist/public-cli/run-lifecycle.js +234 -353
  53. package/dist/public-cli/seat-ticket-binding.js +6 -0
  54. package/dist/public-cli/settlement.js +261 -675
  55. package/dist/public-cli/turn-request.js +76 -0
  56. package/dist/public-role-summons.js +38 -112
  57. package/dist/role-activation-flags.js +23 -45
  58. package/dist/secretariat-contracts.js +0 -2
  59. package/dist/session-identity.js +17 -8
  60. package/dist/session-opening-materials.js +3 -2
  61. package/extensions/role-runtime.ts +6 -80
  62. package/package.json +1 -1
  63. package/souls/coder.md +1 -2
  64. package/src/acp-host/role-turn-host.ts +4 -1
  65. package/src/analyst-metric-families/acceptance-success-rework.ts +3 -2
  66. package/src/auditor-role.ts +1 -2
  67. package/src/auditor-soul.ts +1 -1
  68. package/src/collector-role.ts +2 -2
  69. package/src/countersign-contracts.ts +0 -1
  70. package/src/countersign-role.ts +1 -1
  71. package/src/diarist-contracts.ts +0 -1
  72. package/src/diarist-role.ts +0 -1
  73. package/src/doctor-auditor.ts +1 -2
  74. package/src/doctor-contracts.ts +1 -1
  75. package/src/doctor-role.ts +3 -2
  76. package/src/external-host-turn-loop.ts +1 -1
  77. package/src/factory-board.ts +10 -7
  78. package/src/gatekeeper-role.ts +16 -10
  79. package/src/gleaner-left-contracts.ts +0 -1
  80. package/src/gleaner-left-role.ts +0 -1
  81. package/src/headless-host/role-turn-host.ts +7 -1
  82. package/src/host-contracts.ts +10 -6
  83. package/src/inspector-contracts.ts +0 -1
  84. package/src/inspector-role.ts +0 -2
  85. package/src/institutional-resolution.ts +6 -4
  86. package/src/judge-role.ts +3 -3
  87. package/src/merger-contracts.ts +0 -1
  88. package/src/merger-role.ts +2 -2
  89. package/src/navigator-public-session.ts +7 -6
  90. package/src/navigator-work-context.ts +6 -8
  91. package/src/notary-contracts.ts +0 -1
  92. package/src/notary-role.ts +2 -3
  93. package/src/package-contracts/auditor-output.ts +0 -1
  94. package/src/package-contracts/collector-output.ts +0 -1
  95. package/src/package-contracts/fixer-output.ts +0 -1
  96. package/src/package-contracts/gatekeeper-output.ts +0 -1
  97. package/src/package-contracts/judge-output.ts +0 -1
  98. package/src/package-contracts/navigator-output.ts +0 -1
  99. package/src/package-contracts/reviewer-output.ts +0 -1
  100. package/src/package-contracts/terminating-tools.ts +27 -99
  101. package/src/package-contracts/worker-output.ts +0 -2
  102. package/src/packaged-role-registry.ts +604 -35
  103. package/src/pi/role-turn-host.ts +2 -1
  104. package/src/public-cli/cli.ts +64 -259
  105. package/src/public-cli/config.ts +18 -10
  106. package/src/public-cli/countersign-run.ts +14 -449
  107. package/src/public-cli/instruction-seat-run.ts +758 -277
  108. package/src/public-cli/invocation.ts +1097 -2051
  109. package/src/public-cli/option-definitions.ts +62 -127
  110. package/src/public-cli/post-admission.ts +47 -2
  111. package/src/public-cli/run-lifecycle.ts +303 -613
  112. package/src/public-cli/seat-ticket-binding.ts +6 -0
  113. package/src/public-cli/settlement.ts +399 -1185
  114. package/src/public-cli/turn-request.ts +92 -1
  115. package/src/public-role-summons.ts +44 -128
  116. package/src/reviewer-role.ts +3 -2
  117. package/src/role-activation-flags.ts +20 -41
  118. package/src/role-runtime-dependencies.ts +25 -26
  119. package/src/role-runtime.ts +121 -232
  120. package/src/secretariat-contracts.ts +0 -1
  121. package/src/secretariat-role.ts +0 -2
  122. package/src/session-identity.ts +23 -8
  123. package/src/session-opening-materials.ts +2 -1
  124. package/src/worker-role.ts +3 -4
  125. package/dist/doctor-auditor.js +0 -25
  126. package/dist/public-cli/diarist-run.js +0 -130
  127. package/dist/public-cli/doctor-run.js +0 -87
  128. package/dist/public-cli/inspector-run.js +0 -151
  129. package/dist/public-cli/judge-run.js +0 -114
  130. package/dist/public-cli/notary-run.js +0 -174
  131. package/dist/public-cli/reviewer-run.js +0 -339
  132. package/src/public-cli/coder-run.ts +0 -255
  133. package/src/public-cli/collector-run.ts +0 -189
  134. package/src/public-cli/diarist-run.ts +0 -233
  135. package/src/public-cli/doctor-run.ts +0 -167
  136. package/src/public-cli/fixer-run.ts +0 -265
  137. package/src/public-cli/gleaner-left-run.ts +0 -167
  138. package/src/public-cli/inspector-run.ts +0 -261
  139. package/src/public-cli/judge-run.ts +0 -196
  140. package/src/public-cli/merger-run.ts +0 -294
  141. package/src/public-cli/notary-run.ts +0 -279
  142. package/src/public-cli/reviewer-run.ts +0 -480
  143. package/src/public-cli/secretariat-run.ts +0 -265
@@ -1,261 +0,0 @@
1
- /**
2
- * Public Inspector Role run: admit instruction/attachments → shared post-admission
3
- * coordinator → settle Terminal result (#568 / ADR 0074). Lawful releases:
4
- * pass/bounce/escalate. #633: manual resume continues the exact session. Dual path
5
- * with gate-province dispatch; this module is the direct command face.
6
- * #637 / #747: same-parent (卷宗指针) re-summons resume the seat's previous run.
7
- */
8
- import type { DurablePrincipalAuthority, RoleTurnRequest } from "../host-contracts.ts";
9
- import { engineSessionMaterialFromOptions, pickEngineAxis } from "../package-resources/engine-material.ts";
10
- import { CliUsageError } from "./cli-errors.ts";
11
- import { tryResumeSameTicketSeatRun } from "./seat-ticket-binding.ts";
12
- import {
13
- admitInspectorInvocation,
14
- buildInspectorTransportPrompt,
15
- persistAdmittedSourceRunPath,
16
- type AdmittedInspectorInvocation,
17
- type ParseInspectorArgvResult,
18
- } from "./invocation.ts";
19
- import {
20
- prepareSummonsResumeMaterials,
21
- runPostAdmissionOneShot,
22
- type PostAdmissionAdapters,
23
- type PostAdmissionEnv,
24
- runPostAdmissionSeatResume,
25
- resumeTurnRequestProjectionOptions,
26
- } from "./post-admission.ts";
27
- import {
28
- loadResumableInspectorRun,
29
- markRunAdmitted,
30
- parentRunPathFromGatePointerInstruction,
31
- type PublicResumeRequest,
32
- type SameTicketSummonsMaterials,
33
- } from "./run-lifecycle.ts";
34
- import {
35
- presentStructuralRejection,
36
- trySettleInspectorTerminalResult,
37
- } from "./settlement.ts";
38
- import type { CliIo } from "./cli-io.ts";
39
- import type { TerminalResult } from "./terminal.ts";
40
- import {
41
- projectRoleTurnRequest,
42
- type RoleTurnRequestProjectionOptions,
43
- } from "./turn-request.ts";
44
-
45
- export type InspectorRunEnv = PostAdmissionEnv & {
46
- principalAuthority: DurablePrincipalAuthority;
47
- createRunId?: () => string;
48
- /**
49
- * #753 nested gate re-ask: plain-language instruction on same-ticket resume.
50
- * Only set by summonPublicRole when the prior officer reply was not three-state.
51
- * Never a public CLI argv — must not pollute the 卷宗指针 parentRunPath key (#747).
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;
60
- };
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
-
71
- /** Project admitted invocation onto the host-neutral turn request. */
72
- export function buildInspectorTurnRequest(
73
- admitted: AdmittedInspectorInvocation,
74
- options: RoleTurnRequestProjectionOptions,
75
- ): RoleTurnRequest {
76
- const sourceRun = inspectorParentRunPath(admitted);
77
- return projectRoleTurnRequest(
78
- admitted,
79
- {
80
- activation: {
81
- role: "inspector" as const,
82
- ...(sourceRun === undefined ? {} : { sourceRun }),
83
- },
84
- },
85
- options,
86
- );
87
- }
88
-
89
- export async function runPublicInspector(
90
- argv: readonly string[],
91
- env: InspectorRunEnv,
92
- io: CliIo,
93
- parseInspectorArgv: (args: readonly string[]) => ParseInspectorArgvResult,
94
- ): Promise<{
95
- exitCode: number;
96
- admitted?: AdmittedInspectorInvocation;
97
- terminal?: TerminalResult;
98
- }> {
99
- let parsed: ParseInspectorArgvResult;
100
- try {
101
- parsed = parseInspectorArgv(argv);
102
- } catch (error) {
103
- if (error instanceof CliUsageError) {
104
- presentStructuralRejection(error, io);
105
- return { exitCode: 2 };
106
- }
107
- throw error;
108
- }
109
-
110
- // #747: same parent (卷宗指针) → resume prior inspector run with this summons' materials.
111
- // #771: no mechanical ticket match against instruction text; parent-run path only.
112
- // No bare catch→fresh: lookup/resume failures surface; only true absence mints new.
113
- const projectRoot = parsed.project ?? env.cwd;
114
- // #747: parentRunPath is the pure 卷宗指针 path only — never reask/materials text.
115
- // #753/#786: gate re-ask / verbatim submission body ride summons.instruction on resume.
116
- const parentRunPath = parentRunPathFromGatePointerInstruction(parsed.instruction);
117
- if (parentRunPath !== undefined) {
118
- const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
119
- const summons: SameTicketSummonsMaterials = {
120
- sourceRunPath: parentRunPath,
121
- ...(resumeInstruction === undefined
122
- ? {
123
- instruction: parsed.instruction,
124
- instructionEmpty: parsed.instruction.trim() === "",
125
- }
126
- : { instruction: resumeInstruction, instructionEmpty: false }),
127
- attachmentPaths: parsed.attachmentPaths,
128
- };
129
- const resumed = await tryResumeSameTicketSeatRun({
130
- home: env.home,
131
- projectRoot,
132
- role: "inspector",
133
- parentRunPath,
134
- freshSummons: env.freshSummons,
135
- summons,
136
- resume: (runId, materials) =>
137
- runPublicInspectorResume(
138
- { runId, ...(materials === undefined ? {} : { summons: materials }) },
139
- env,
140
- io,
141
- ),
142
- });
143
- if (resumed !== undefined) return resumed;
144
- }
145
-
146
- let admitted: AdmittedInspectorInvocation;
147
- try {
148
- admitted = await admitInspectorInvocation({
149
- home: env.home,
150
- principalAuthority: env.principalAuthority,
151
- cwd: env.cwd,
152
- instruction: parsed.instruction,
153
- attachmentPaths: parsed.attachmentPaths,
154
- ...(parsed.project === undefined ? {} : { project: parsed.project }),
155
- ...(env.createRunId === undefined ? {} : { createRunId: env.createRunId }),
156
- ...(env.model === undefined ? {} : { model: env.model }),
157
- ...(env.correlationId === undefined ? {} : { correlationId: env.correlationId }),
158
- });
159
- } catch (error) {
160
- if (error instanceof CliUsageError) {
161
- presentStructuralRejection(error, io);
162
- return { exitCode: 2 };
163
- }
164
- throw error;
165
- }
166
-
167
- await markRunAdmitted(admitted, env.principalAuthority);
168
- if (parentRunPath !== undefined) {
169
- await persistAdmittedSourceRunPath(admitted, parentRunPath);
170
- admitted = { ...admitted, sourceRunPath: parentRunPath };
171
- }
172
-
173
- const engineMaterial = engineSessionMaterialFromOptions({
174
- ...pickEngineAxis(env),
175
- packageRoot: env.packageRoot,
176
- });
177
- const turnRequest = buildInspectorTurnRequest(admitted, {
178
- packageRoot: env.packageRoot,
179
- home: env.home,
180
- agentDir: env.agentDir,
181
- ...(env.model === undefined ? {} : { model: env.model }),
182
- ...pickEngineAxis(env),
183
- ...(env.timeoutMs === undefined ? {} : { timeoutMs: env.timeoutMs }),
184
- ...(env.correlationId === undefined || env.correlationId.trim() === ""
185
- ? {}
186
- : { correlationId: env.correlationId }),
187
- continuation: {
188
- kind: "initial",
189
- // #879: gate first mint uses parent payload as content; binding stays typed activation.
190
- prompt: (env.reviewReask ?? env.gateReviewInstruction)
191
- ?? buildInspectorTransportPrompt(admitted, engineMaterial),
192
- },
193
- });
194
-
195
- return await runPostAdmissionOneShot({
196
- admitted,
197
- env,
198
- io,
199
- request: turnRequest,
200
- adapters: inspectorAdapters(),
201
- ...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
202
- });
203
- }
204
-
205
- function inspectorAdapters(options?: {
206
- beforeDispatch?: (
207
- admitted: AdmittedInspectorInvocation,
208
- ) => void | Promise<void>;
209
- }): PostAdmissionAdapters<AdmittedInspectorInvocation> {
210
- return {
211
- trySettle: (admitted, authority, scope) => trySettleInspectorTerminalResult(admitted, authority, scope),
212
- shouldPresentSettled: () => true,
213
- ...(options?.beforeDispatch === undefined
214
- ? {}
215
- : { beforeDispatch: options.beforeDispatch }),
216
- };
217
- }
218
-
219
- /**
220
- * Resume a previously admitted Inspector run (#633 / #637); the session principal reopens.
221
- * Same-ticket summons deliver this turn's instruction + frozen attachments; manual
222
- * resume forwards only caller-supplied message bytes.
223
- */
224
- export async function runPublicInspectorResume(
225
- request: PublicResumeRequest,
226
- env: InspectorRunEnv,
227
- io: CliIo,
228
- ): Promise<{
229
- exitCode: number;
230
- admitted?: AdmittedInspectorInvocation;
231
- terminal?: TerminalResult;
232
- }> {
233
- return await runPostAdmissionSeatResume({
234
- request,
235
- env,
236
- io,
237
- load: (effective) =>
238
- loadResumableInspectorRun(
239
- env.home,
240
- effective.runId,
241
- env.principalAuthority,
242
- ),
243
- buildTurnRequest: async (admitted, effective) => {
244
- const summonsPrepared = await prepareSummonsResumeMaterials(
245
- admitted.runDirectory,
246
- effective.summons,
247
- );
248
- return buildInspectorTurnRequest(
249
- admitted,
250
- resumeTurnRequestProjectionOptions(
251
- admitted,
252
- effective,
253
- env,
254
- summonsPrepared,
255
- ),
256
- );
257
- },
258
- adapters: inspectorAdapters(),
259
- ...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
260
- });
261
- }
@@ -1,196 +0,0 @@
1
- /**
2
- * Public Judge Role run: admit → post-admission coordinator → settle Terminal result (#106 / #517).
3
- * #107: controlled post-admission failures and human decisions settle honestly.
4
- * #108: typed HTTP 429 resume of the exact Pi session.
5
- */
6
- import type {
7
- DurablePrincipalAuthority,
8
- RoleTurnKnownFailure,
9
- RoleTurnRequest,
10
- } from "../host-contracts.ts";
11
- import { engineSessionMaterialFromOptions, pickEngineAxis } from "../package-resources/engine-material.ts";
12
- import { CliUsageError } from "./cli-errors.ts";
13
- import {
14
- admitJudgeInvocation,
15
- buildJudgeTransportPrompt,
16
- type AdmittedJudgeInvocation,
17
- } from "./invocation.ts";
18
- import {
19
- loadResumableJudgeRun,
20
- markRunAdmitted,
21
- buildAutoResumeContinuationPrompt,
22
- type PublicResumeRequest,
23
- } from "./run-lifecycle.ts";
24
- import {
25
- presentStructuralRejection,
26
- readEngineDetourInfrastructureFailure,
27
- trySettleJudgeTerminalResult,
28
- } from "./settlement.ts";
29
- import type { CliIo } from "./cli-io.ts";
30
- import type { TerminalResult } from "./terminal.ts";
31
- import {
32
- projectRoleTurnRequest,
33
- type RoleTurnRequestProjectionOptions,
34
- } from "./turn-request.ts";
35
- import {
36
- runPostAdmissionResumable,
37
- type PostAdmissionAdapters,
38
- type PostAdmissionEnv,
39
- runPostAdmissionSeatResume,
40
- resumeTurnRequestProjectionOptions,
41
- } from "./post-admission.ts";
42
-
43
- export type JudgeRunEnv = PostAdmissionEnv & {
44
- createRunId?: () => string;
45
- };
46
-
47
- /** Project admitted invocation onto the host-neutral turn request. */
48
- export function buildJudgeTurnRequest(
49
- admitted: AdmittedJudgeInvocation,
50
- options: RoleTurnRequestProjectionOptions,
51
- ): RoleTurnRequest {
52
- return projectRoleTurnRequest(admitted, { activation: { role: "judge" as const } }, options);
53
- }
54
-
55
- function judgeAdapters(): PostAdmissionAdapters<AdmittedJudgeInvocation> {
56
- return {
57
- trySettle: (admitted, authority, scope) =>
58
- trySettleJudgeTerminalResult(admitted, authority, scope),
59
- resolveRunnerKnownFailure: async ({ result, sessionFile }) => {
60
- const infrastructureFailure = await readEngineDetourInfrastructureFailure(sessionFile);
61
- return (
62
- result.knownFailure ??
63
- (infrastructureFailure === undefined
64
- ? undefined
65
- : {
66
- ...(infrastructureFailure.cause === undefined
67
- ? {}
68
- : { cause: infrastructureFailure.cause }),
69
- diagnostic: infrastructureFailure.diagnostic,
70
- ...(infrastructureFailure.identity === undefined
71
- ? {}
72
- : { identity: infrastructureFailure.identity }),
73
- })
74
- );
75
- },
76
- };
77
- }
78
-
79
- export async function runPublicJudge(
80
- argv: readonly string[],
81
- env: JudgeRunEnv,
82
- io: CliIo,
83
- parseJudgeArgv: (args: readonly string[]) => {
84
- instruction: string;
85
- attachmentPaths: string[];
86
- project?: string;
87
- },
88
- ): Promise<{
89
- exitCode: number;
90
- admitted?: AdmittedJudgeInvocation;
91
- terminal?: TerminalResult;
92
- }> {
93
- let admitted: AdmittedJudgeInvocation;
94
- try {
95
- const parsed = parseJudgeArgv(argv);
96
- admitted = await admitJudgeInvocation({
97
- home: env.home,
98
- principalAuthority: env.principalAuthority,
99
- cwd: env.cwd,
100
- instruction: parsed.instruction,
101
- attachmentPaths: parsed.attachmentPaths,
102
- ...(parsed.project === undefined ? {} : { project: parsed.project }),
103
- ...(env.createRunId === undefined ? {} : { createRunId: env.createRunId }),
104
- ...(env.model === undefined ? {} : { model: env.model }),
105
- });
106
- } catch (error) {
107
- if (error instanceof CliUsageError) {
108
- presentStructuralRejection(error, io);
109
- return { exitCode: 2 };
110
- }
111
- throw error;
112
- }
113
-
114
- await markRunAdmitted(admitted, env.principalAuthority);
115
-
116
- return await runPostAdmissionResumable({
117
- admitted,
118
- env,
119
- io,
120
- buildInitialRequest: () =>
121
- buildJudgeTurnRequest(admitted, {
122
- packageRoot: env.packageRoot,
123
- home: env.home,
124
- agentDir: env.agentDir,
125
- ...(env.model === undefined ? {} : { model: env.model }),
126
- ...pickEngineAxis(env),
127
- ...(env.timeoutMs === undefined ? {} : { timeoutMs: env.timeoutMs }),
128
- ...(admitted.correlationId === undefined && env.correlationId === undefined
129
- ? {}
130
- : { correlationId: admitted.correlationId ?? env.correlationId }),
131
- continuation: {
132
- kind: "initial",
133
- prompt: buildJudgeTransportPrompt(
134
- admitted,
135
- engineSessionMaterialFromOptions({
136
- ...pickEngineAxis(env),
137
- packageRoot: env.packageRoot,
138
- }),
139
- ),
140
- },
141
- }),
142
- buildResumeRequest: () =>
143
- buildJudgeTurnRequest(admitted, {
144
- packageRoot: env.packageRoot,
145
- home: env.home,
146
- agentDir: env.agentDir,
147
- ...(env.model === undefined ? {} : { model: env.model }),
148
- ...pickEngineAxis(env),
149
- ...(env.timeoutMs === undefined ? {} : { timeoutMs: env.timeoutMs }),
150
- ...(admitted.correlationId === undefined && env.correlationId === undefined
151
- ? {}
152
- : { correlationId: admitted.correlationId ?? env.correlationId }),
153
- continuation: {
154
- kind: "resume",
155
- prompt: buildAutoResumeContinuationPrompt({
156
- packageRoot: env.packageRoot,
157
- ...pickEngineAxis(env),
158
- }),
159
- },
160
- }),
161
- adapters: judgeAdapters(),
162
- ...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
163
- });
164
- }
165
-
166
- /**
167
- * Resume a previously admitted Role run after a typed HTTP 429 interruption.
168
- * Restores role/project/instruction/attachments/session identity; model override
169
- * is temporary for this invocation only.
170
- */
171
- export async function runPublicResume(
172
- request: PublicResumeRequest,
173
- env: JudgeRunEnv,
174
- io: CliIo,
175
- ): Promise<{
176
- exitCode: number;
177
- admitted?: AdmittedJudgeInvocation;
178
- terminal?: TerminalResult;
179
- }> {
180
- return await runPostAdmissionSeatResume({
181
- request,
182
- env,
183
- io,
184
- load: (effective) =>
185
- loadResumableJudgeRun(env.home, effective.runId, env.principalAuthority),
186
- buildTurnRequest: (admitted, effective) =>
187
- buildJudgeTurnRequest(
188
- admitted,
189
- resumeTurnRequestProjectionOptions(admitted, effective, env),
190
- ),
191
- adapters: judgeAdapters(),
192
- ...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
193
- });
194
- }
195
-
196
- export type { RoleTurnKnownFailure };