@akagilnc/pi-workflow-roles 0.1.4802 → 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.
- package/dist/acp-host/production-host.js +19434 -18218
- package/dist/analyst-book-key.js +63 -0
- package/dist/analyst-cohort.js +167 -0
- package/dist/analyst-entry.js +320 -0
- package/dist/analyst-index.js +247 -0
- package/dist/analyst-ledger.js +561 -0
- package/dist/analyst-median.js +16 -0
- package/dist/analyst-metric-families/acceptance-success-rework.js +249 -0
- package/dist/analyst-metric-families/b2-frame-buckets-actions.js +189 -0
- package/dist/analyst-metric-families/gate-cycles.js +77 -0
- package/dist/analyst-metric-families/leg-wall-clock.js +56 -0
- package/dist/analyst-metric-families/round-timeline.js +126 -0
- package/dist/analyst-metric-families.js +23 -0
- package/dist/analyst-metric-family.js +11 -0
- package/dist/analyst-model-groups.js +135 -0
- package/dist/analyst-page.js +182 -0
- package/dist/atomic-write.js +23 -0
- package/dist/auditor-soul.js +1 -1
- package/dist/countersign-contracts.js +0 -2
- package/dist/diarist-contracts.js +0 -1
- package/dist/doctor-contracts.js +2 -2
- package/dist/gatekeeper-role.js +15 -16
- package/dist/gleaner-left-contracts.js +0 -2
- package/dist/headless-host/production-host.js +16967 -15749
- package/dist/host-contracts.js +0 -4
- package/dist/inspector-contracts.js +0 -2
- package/dist/institutional-resolution.js +4 -2
- package/dist/merger-contracts.js +0 -2
- package/dist/migrate-book-topology.js +3908 -3089
- package/dist/navigator-public-session.js +4 -3
- package/dist/notary-contracts.js +0 -2
- package/dist/package-contracts/auditor-output.js +0 -1
- package/dist/package-contracts/collector-output.js +0 -2
- package/dist/package-contracts/fixer-output.js +0 -2
- package/dist/package-contracts/gatekeeper-output.js +0 -2
- package/dist/package-contracts/judge-output.js +0 -2
- package/dist/package-contracts/navigator-output.js +0 -2
- package/dist/package-contracts/reviewer-output.js +0 -2
- package/dist/package-contracts/terminating-tools.js +32 -92
- package/dist/package-contracts/worker-output.js +0 -4
- package/dist/packaged-role-registry.js +518 -36
- package/dist/pi/role-turn-host.js +2 -1
- package/dist/public-cli/analyst-run.js +185 -0
- package/dist/public-cli/cli.js +885 -0
- package/dist/public-cli/config.js +12 -9
- package/dist/public-cli/countersign-run.js +4 -311
- package/dist/public-cli/instruction-seat-run.js +628 -158
- package/dist/public-cli/invocation.js +806 -1550
- package/dist/public-cli/main.js +6962 -9882
- package/dist/public-cli/option-definitions.js +51 -99
- package/dist/public-cli/post-admission.js +30 -2
- package/dist/public-cli/run-lifecycle.js +234 -353
- package/dist/public-cli/seat-ticket-binding.js +6 -0
- package/dist/public-cli/settlement.js +261 -675
- package/dist/public-cli/turn-request.js +76 -0
- package/dist/public-role-summons.js +38 -112
- package/dist/role-activation-flags.js +23 -45
- package/dist/secretariat-contracts.js +0 -2
- package/dist/session-identity.js +17 -8
- package/dist/session-opening-materials.js +3 -2
- package/extensions/role-runtime.ts +6 -80
- package/package.json +1 -1
- package/src/acp-host/role-turn-host.ts +4 -1
- package/src/analyst-metric-families/acceptance-success-rework.ts +3 -2
- package/src/auditor-role.ts +1 -2
- package/src/auditor-soul.ts +1 -1
- package/src/collector-role.ts +2 -2
- package/src/countersign-contracts.ts +0 -1
- package/src/countersign-role.ts +1 -1
- package/src/diarist-contracts.ts +0 -1
- package/src/diarist-role.ts +0 -1
- package/src/doctor-auditor.ts +1 -2
- package/src/doctor-contracts.ts +1 -1
- package/src/doctor-role.ts +3 -2
- package/src/external-host-turn-loop.ts +1 -1
- package/src/factory-board.ts +10 -7
- package/src/gatekeeper-role.ts +16 -10
- package/src/gleaner-left-contracts.ts +0 -1
- package/src/gleaner-left-role.ts +0 -1
- package/src/headless-host/role-turn-host.ts +7 -1
- package/src/host-contracts.ts +10 -6
- package/src/inspector-contracts.ts +0 -1
- package/src/inspector-role.ts +0 -2
- package/src/institutional-resolution.ts +6 -4
- package/src/judge-role.ts +3 -3
- package/src/merger-contracts.ts +0 -1
- package/src/merger-role.ts +2 -2
- package/src/navigator-public-session.ts +7 -6
- package/src/navigator-work-context.ts +6 -8
- package/src/notary-contracts.ts +0 -1
- package/src/notary-role.ts +2 -3
- package/src/package-contracts/auditor-output.ts +0 -1
- package/src/package-contracts/collector-output.ts +0 -1
- package/src/package-contracts/fixer-output.ts +0 -1
- package/src/package-contracts/gatekeeper-output.ts +0 -1
- package/src/package-contracts/judge-output.ts +0 -1
- package/src/package-contracts/navigator-output.ts +0 -1
- package/src/package-contracts/reviewer-output.ts +0 -1
- package/src/package-contracts/terminating-tools.ts +27 -99
- package/src/package-contracts/worker-output.ts +0 -2
- package/src/packaged-role-registry.ts +604 -35
- package/src/pi/role-turn-host.ts +2 -1
- package/src/public-cli/cli.ts +64 -259
- package/src/public-cli/config.ts +18 -10
- package/src/public-cli/countersign-run.ts +14 -449
- package/src/public-cli/instruction-seat-run.ts +758 -277
- package/src/public-cli/invocation.ts +1097 -2051
- package/src/public-cli/option-definitions.ts +62 -127
- package/src/public-cli/post-admission.ts +47 -2
- package/src/public-cli/run-lifecycle.ts +303 -613
- package/src/public-cli/seat-ticket-binding.ts +6 -0
- package/src/public-cli/settlement.ts +399 -1185
- package/src/public-cli/turn-request.ts +92 -1
- package/src/public-role-summons.ts +44 -128
- package/src/reviewer-role.ts +3 -2
- package/src/role-activation-flags.ts +20 -41
- package/src/role-runtime-dependencies.ts +25 -26
- package/src/role-runtime.ts +121 -232
- package/src/secretariat-contracts.ts +0 -1
- package/src/secretariat-role.ts +0 -2
- package/src/session-identity.ts +23 -8
- package/src/session-opening-materials.ts +2 -1
- package/src/worker-role.ts +3 -4
- package/dist/doctor-auditor.js +0 -25
- package/dist/public-cli/diarist-run.js +0 -130
- package/dist/public-cli/doctor-run.js +0 -87
- package/dist/public-cli/inspector-run.js +0 -151
- package/dist/public-cli/judge-run.js +0 -114
- package/dist/public-cli/notary-run.js +0 -174
- package/dist/public-cli/reviewer-run.js +0 -339
- package/src/public-cli/coder-run.ts +0 -255
- package/src/public-cli/collector-run.ts +0 -189
- package/src/public-cli/diarist-run.ts +0 -233
- package/src/public-cli/doctor-run.ts +0 -167
- package/src/public-cli/fixer-run.ts +0 -265
- package/src/public-cli/gleaner-left-run.ts +0 -167
- package/src/public-cli/inspector-run.ts +0 -261
- package/src/public-cli/judge-run.ts +0 -196
- package/src/public-cli/merger-run.ts +0 -294
- package/src/public-cli/notary-run.ts +0 -279
- package/src/public-cli/reviewer-run.ts +0 -480
- package/src/public-cli/secretariat-run.ts +0 -265
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Public Secretariat (中书省) Role run: admit → 起居郎 typed identity → bind/relocate
|
|
3
|
-
* → shared post-admission (dossier delivery) → settle (#924).
|
|
4
|
-
* Instruction-seat face like Judge; nested countersign is role-tool driven.
|
|
5
|
-
* Ticket identity reuses the court diarist seam (no prose regex; no second lifecycle).
|
|
6
|
-
*/
|
|
7
|
-
import type { DurablePrincipalAuthority, RoleTurnRequest } from "../host-contracts.ts";
|
|
8
|
-
import { engineSessionMaterialFromOptions, pickEngineAxis } from "../package-resources/engine-material.ts";
|
|
9
|
-
import { CliUsageError } from "./cli-errors.ts";
|
|
10
|
-
import {
|
|
11
|
-
admitSecretariatInvocation,
|
|
12
|
-
bindAdmittedTicketNumber,
|
|
13
|
-
buildSecretariatTransportPrompt,
|
|
14
|
-
relocateAdmittedRunToTicket,
|
|
15
|
-
type AdmittedSecretariatInvocation,
|
|
16
|
-
type ParseSecretariatArgvResult,
|
|
17
|
-
} from "./invocation.ts";
|
|
18
|
-
import {
|
|
19
|
-
invokeCourtDiarist,
|
|
20
|
-
type CourtDiaristSummonEnv,
|
|
21
|
-
} from "./countersign-run.ts";
|
|
22
|
-
import {
|
|
23
|
-
presentControlledFailure,
|
|
24
|
-
runPostAdmissionOneShot,
|
|
25
|
-
type PostAdmissionEnv,
|
|
26
|
-
runPostAdmissionSeatResume,
|
|
27
|
-
resumeTurnRequestProjectionOptions,
|
|
28
|
-
} from "./post-admission.ts";
|
|
29
|
-
import {
|
|
30
|
-
loadResumableSecretariatRun,
|
|
31
|
-
markRunAdmitted,
|
|
32
|
-
type PublicResumeRequest,
|
|
33
|
-
} from "./run-lifecycle.ts";
|
|
34
|
-
import {
|
|
35
|
-
presentStructuralRejection,
|
|
36
|
-
trySettleSecretariatTerminalResult,
|
|
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 SecretariatRunEnv = PostAdmissionEnv & {
|
|
46
|
-
principalAuthority: DurablePrincipalAuthority;
|
|
47
|
-
createRunId?: () => string;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/** Project admitted invocation onto the host-neutral turn request. */
|
|
51
|
-
export function buildSecretariatTurnRequest(
|
|
52
|
-
admitted: AdmittedSecretariatInvocation,
|
|
53
|
-
options: RoleTurnRequestProjectionOptions,
|
|
54
|
-
): RoleTurnRequest {
|
|
55
|
-
return projectRoleTurnRequest(
|
|
56
|
-
admitted,
|
|
57
|
-
{
|
|
58
|
-
activation: {
|
|
59
|
-
role: "secretariat" as const,
|
|
60
|
-
...(admitted.ticketNumber === undefined
|
|
61
|
-
? {}
|
|
62
|
-
: { ticketNumber: admitted.ticketNumber }),
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
options,
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function diaristEnv(env: SecretariatRunEnv): CourtDiaristSummonEnv {
|
|
70
|
-
return {
|
|
71
|
-
cwd: env.cwd,
|
|
72
|
-
home: env.home,
|
|
73
|
-
agentDir: env.agentDir,
|
|
74
|
-
packageRoot: env.packageRoot,
|
|
75
|
-
...(env.credentials === undefined ? {} : { credentials: env.credentials }),
|
|
76
|
-
...(env.signal === undefined ? {} : { signal: env.signal }),
|
|
77
|
-
...(env.hostAdapters === undefined ? {} : { hostAdapters: env.hostAdapters }),
|
|
78
|
-
};
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
export async function runPublicSecretariat(
|
|
82
|
-
argv: readonly string[],
|
|
83
|
-
env: SecretariatRunEnv,
|
|
84
|
-
io: CliIo,
|
|
85
|
-
parseSecretariatArgv: (args: readonly string[]) => ParseSecretariatArgvResult,
|
|
86
|
-
): Promise<{
|
|
87
|
-
exitCode: number;
|
|
88
|
-
admitted?: AdmittedSecretariatInvocation;
|
|
89
|
-
terminal?: TerminalResult;
|
|
90
|
-
}> {
|
|
91
|
-
let parsed: ParseSecretariatArgvResult;
|
|
92
|
-
try {
|
|
93
|
-
parsed = parseSecretariatArgv(argv);
|
|
94
|
-
} catch (error) {
|
|
95
|
-
if (error instanceof CliUsageError) {
|
|
96
|
-
presentStructuralRejection(error, io);
|
|
97
|
-
return { exitCode: 2 };
|
|
98
|
-
}
|
|
99
|
-
throw error;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
let admitted: AdmittedSecretariatInvocation;
|
|
103
|
-
try {
|
|
104
|
-
admitted = await admitSecretariatInvocation({
|
|
105
|
-
home: env.home,
|
|
106
|
-
principalAuthority: env.principalAuthority,
|
|
107
|
-
cwd: env.cwd,
|
|
108
|
-
instruction: parsed.instruction,
|
|
109
|
-
attachmentPaths: parsed.attachmentPaths,
|
|
110
|
-
...(parsed.project === undefined ? {} : { project: parsed.project }),
|
|
111
|
-
...(env.createRunId === undefined ? {} : { createRunId: env.createRunId }),
|
|
112
|
-
...(env.model === undefined ? {} : { model: env.model }),
|
|
113
|
-
...(env.correlationId === undefined ? {} : { correlationId: env.correlationId }),
|
|
114
|
-
});
|
|
115
|
-
} catch (error) {
|
|
116
|
-
if (error instanceof CliUsageError) {
|
|
117
|
-
presentStructuralRejection(error, io);
|
|
118
|
-
return { exitCode: 2 };
|
|
119
|
-
}
|
|
120
|
-
throw error;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
await markRunAdmitted(admitted, env.principalAuthority);
|
|
124
|
-
|
|
125
|
-
// #924 G3 / ADR 0075 / 0081: ticket identity is 起居郎 typed assertion — never
|
|
126
|
-
// prose regex. escalate / real station failure → controlled failure; lawful
|
|
127
|
-
// true-unbound continues unbound (ADR 0075 真无票→无录; 第 0 条不拒收);
|
|
128
|
-
// ticket → bind + relocate so post-admission can deliver 起居录.
|
|
129
|
-
const outcome = await invokeCourtDiarist(
|
|
130
|
-
{
|
|
131
|
-
instruction: parsed.instruction,
|
|
132
|
-
projectRoot: admitted.projectRoot,
|
|
133
|
-
failureLabel: "secretariat unbound summons",
|
|
134
|
-
attachmentPaths: admitted.attachments.map((attachment) => attachment.frozenPath),
|
|
135
|
-
correlationId: admitted.runId,
|
|
136
|
-
},
|
|
137
|
-
diaristEnv(env),
|
|
138
|
-
io,
|
|
139
|
-
);
|
|
140
|
-
|
|
141
|
-
if (outcome.identity.kind === "escalate") {
|
|
142
|
-
// Diagnostic relays diarist escalate payload facts (#953) — never invent 认不出.
|
|
143
|
-
return await presentControlledFailure(
|
|
144
|
-
admitted,
|
|
145
|
-
{
|
|
146
|
-
timedOut: false,
|
|
147
|
-
code: null,
|
|
148
|
-
stderr: "",
|
|
149
|
-
thrown: new Error(outcome.identity.diagnostic),
|
|
150
|
-
},
|
|
151
|
-
secretariatAdapters(),
|
|
152
|
-
env.principalAuthority,
|
|
153
|
-
io,
|
|
154
|
-
);
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
if (outcome.failedWithoutEscalate !== undefined) {
|
|
158
|
-
return await presentControlledFailure(
|
|
159
|
-
admitted,
|
|
160
|
-
{
|
|
161
|
-
timedOut: false,
|
|
162
|
-
code: null,
|
|
163
|
-
stderr: "",
|
|
164
|
-
thrown: new Error(outcome.failedWithoutEscalate.diagnostic),
|
|
165
|
-
},
|
|
166
|
-
secretariatAdapters(),
|
|
167
|
-
env.principalAuthority,
|
|
168
|
-
io,
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (outcome.identity.kind === "ticket") {
|
|
173
|
-
try {
|
|
174
|
-
await bindAdmittedTicketNumber(admitted, outcome.identity.ticketNumber);
|
|
175
|
-
await relocateAdmittedRunToTicket(admitted, env.principalAuthority);
|
|
176
|
-
} catch (error) {
|
|
177
|
-
return await presentControlledFailure(
|
|
178
|
-
admitted,
|
|
179
|
-
{
|
|
180
|
-
timedOut: false,
|
|
181
|
-
code: null,
|
|
182
|
-
stderr: "",
|
|
183
|
-
thrown: error,
|
|
184
|
-
},
|
|
185
|
-
secretariatAdapters(),
|
|
186
|
-
env.principalAuthority,
|
|
187
|
-
io,
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
const turnRequest = buildSecretariatTurnRequest(admitted, {
|
|
193
|
-
packageRoot: env.packageRoot,
|
|
194
|
-
home: env.home,
|
|
195
|
-
agentDir: env.agentDir,
|
|
196
|
-
...(env.model === undefined ? {} : { model: env.model }),
|
|
197
|
-
...pickEngineAxis(env),
|
|
198
|
-
...(env.timeoutMs === undefined ? {} : { timeoutMs: env.timeoutMs }),
|
|
199
|
-
...(env.correlationId === undefined || env.correlationId.trim() === ""
|
|
200
|
-
? {}
|
|
201
|
-
: { correlationId: env.correlationId }),
|
|
202
|
-
continuation: {
|
|
203
|
-
kind: "initial",
|
|
204
|
-
prompt: buildSecretariatTransportPrompt(
|
|
205
|
-
admitted,
|
|
206
|
-
engineSessionMaterialFromOptions({
|
|
207
|
-
...pickEngineAxis(env),
|
|
208
|
-
packageRoot: env.packageRoot,
|
|
209
|
-
}),
|
|
210
|
-
),
|
|
211
|
-
},
|
|
212
|
-
});
|
|
213
|
-
|
|
214
|
-
return await runPostAdmissionOneShot({
|
|
215
|
-
admitted,
|
|
216
|
-
env,
|
|
217
|
-
io,
|
|
218
|
-
request: turnRequest,
|
|
219
|
-
adapters: secretariatAdapters(),
|
|
220
|
-
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
function secretariatAdapters() {
|
|
225
|
-
return {
|
|
226
|
-
trySettle: (
|
|
227
|
-
admitted: AdmittedSecretariatInvocation,
|
|
228
|
-
authority: DurablePrincipalAuthority,
|
|
229
|
-
scope?: { readonly courtAttemptId?: string },
|
|
230
|
-
) => trySettleSecretariatTerminalResult(admitted, authority, scope),
|
|
231
|
-
shouldPresentSettled: () => true,
|
|
232
|
-
};
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
/**
|
|
236
|
-
* Resume a previously admitted Secretariat run (#599).
|
|
237
|
-
*/
|
|
238
|
-
export async function runPublicSecretariatResume(
|
|
239
|
-
request: PublicResumeRequest,
|
|
240
|
-
env: SecretariatRunEnv,
|
|
241
|
-
io: CliIo,
|
|
242
|
-
): Promise<{
|
|
243
|
-
exitCode: number;
|
|
244
|
-
admitted?: AdmittedSecretariatInvocation;
|
|
245
|
-
terminal?: TerminalResult;
|
|
246
|
-
}> {
|
|
247
|
-
return await runPostAdmissionSeatResume({
|
|
248
|
-
request,
|
|
249
|
-
env,
|
|
250
|
-
io,
|
|
251
|
-
load: (effective) =>
|
|
252
|
-
loadResumableSecretariatRun(
|
|
253
|
-
env.home,
|
|
254
|
-
effective.runId,
|
|
255
|
-
env.principalAuthority,
|
|
256
|
-
),
|
|
257
|
-
buildTurnRequest: (admitted, effective) =>
|
|
258
|
-
buildSecretariatTurnRequest(
|
|
259
|
-
admitted,
|
|
260
|
-
resumeTurnRequestProjectionOptions(admitted, effective, env),
|
|
261
|
-
),
|
|
262
|
-
adapters: secretariatAdapters(),
|
|
263
|
-
...(env.engine === undefined ? {} : { effectiveEngine: env.engine }),
|
|
264
|
-
});
|
|
265
|
-
}
|