@akagilnc/pi-workflow-roles 0.1.5365 → 0.1.5375
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 +5585 -5655
- package/dist/activation-ledger-git.js +2 -2
- package/dist/activation-ledger-topology.js +1 -7
- package/dist/analyst-entry.js +4 -8
- package/dist/analyst-gate-cycles-read.js +3 -11
- package/dist/analyst-index.js +3 -9
- package/dist/analyst-ledger.js +1 -11
- package/dist/analyst-metric-families/acceptance-success-rework.js +1 -3
- package/dist/analyst-metric-families/round-timeline.js +1 -3
- package/dist/analyst-page.js +2 -2
- package/dist/archivist-record-topology.js +2 -2
- package/dist/audit-escalation.js +2 -1
- package/dist/auditor-soul.js +2 -1
- package/dist/collector-config.js +6 -8
- package/dist/compliance-transport.js +2 -1
- package/dist/countersign-contracts.js +2 -1
- package/dist/diarist-contracts.js +3 -2
- package/dist/doctor-contracts.js +1 -3
- package/dist/doctor-evidence.js +7 -8
- package/dist/dossier-resolution.js +1 -3
- package/dist/engine-detour-usage.js +1 -3
- package/dist/gatekeeper-role.js +2 -9
- package/dist/gleaner-left-contracts.js +2 -1
- package/dist/headless-host/description.js +14 -17
- package/dist/headless-host/production-host.js +1665 -1737
- package/dist/host-session-record.js +3 -2
- package/dist/inspector-contracts.js +2 -1
- package/dist/ledger-session-read.js +1 -3
- package/dist/merger-contracts.js +9 -9
- package/dist/migrate-book-topology.js +348 -314
- package/dist/navigator-attendance.js +9 -11
- package/dist/navigator-invocation-identity.js +3 -2
- package/dist/navigator-public-session.js +3 -5
- package/dist/navigator-session-contracts.js +8 -10
- package/dist/navigator-work-base.js +5 -8
- package/dist/notary-contracts.js +3 -5
- package/dist/package-contracts/auditor-output.js +1 -3
- package/dist/package-contracts/fixer-packet.js +3 -6
- package/dist/package-contracts/gatekeeper-output.js +1 -3
- package/dist/package-contracts/navigator-output.js +8 -8
- package/dist/package-contracts/terminating-infrastructure.js +5 -9
- package/dist/package-contracts/terminating-tools.js +4 -3
- package/dist/public-cli/analyst-run.js +3 -2
- package/dist/public-cli/auto-resume.js +4 -9
- package/dist/public-cli/cli.js +66 -64
- package/dist/public-cli/config.js +12 -11
- package/dist/public-cli/countersign-run.js +1 -3
- package/dist/public-cli/host-providers.js +7 -14
- package/dist/public-cli/instruction-seat-run.js +69 -43
- package/dist/public-cli/invocation.js +141 -136
- package/dist/public-cli/main.js +1919 -1968
- package/dist/public-cli/post-admission.js +89 -89
- package/dist/public-cli/role-seat-runtime.js +29 -0
- package/dist/public-cli/run-lifecycle.js +20 -32
- package/dist/public-cli/settlement.js +10 -26
- package/dist/public-cli/turn-request.js +14 -0
- package/dist/public-role-summons.js +23 -35
- package/dist/receipt-delivery-policy.js +1 -3
- package/dist/role-run-placement.js +7 -5
- package/dist/role-run-relocation.js +12 -19
- package/dist/run-terminal-artifacts.js +1 -11
- package/dist/run-ticket-number.js +2 -4
- package/dist/session-assistant-usage.js +2 -1
- package/dist/session-dialogue.js +1 -14
- package/dist/sitian-reader.js +2 -4
- package/dist/submission-correctable-error.js +2 -1
- package/dist/submission-errors.js +2 -1
- package/dist/submission-gate.js +2 -1
- package/dist/submission-ledger.js +4 -5
- package/dist/ticket-provenance-contracts.js +1 -3
- package/dist/ticket-provenance.js +2 -1
- package/dist/typed-provider-http.js +4 -7
- package/dist/unknown-value.js +28 -0
- package/dist/user-dialogue-stdin.js +2 -1
- package/package.json +1 -1
- package/src/acp-host/role-turn-host.ts +4 -2
- package/src/activation-ledger-git.ts +3 -2
- package/src/activation-ledger-topology.ts +4 -12
- package/src/analyst-entry.ts +3 -11
- package/src/analyst-gate-cycles-read.ts +3 -15
- package/src/analyst-index.ts +3 -13
- package/src/analyst-ledger.ts +2 -16
- package/src/analyst-metric-families/acceptance-success-rework.ts +2 -4
- package/src/analyst-metric-families/round-timeline.ts +2 -4
- package/src/analyst-page.ts +2 -2
- package/src/archivist-record-topology.ts +2 -2
- package/src/audit-escalation.ts +2 -1
- package/src/auditor-soul.ts +3 -1
- package/src/book-topology-migration-placement.ts +8 -21
- package/src/book-topology-migrators-t11.ts +16 -15
- package/src/book-topology-mixed-volume-migrators.ts +3 -6
- package/src/book-topology-record-class-migrators.ts +7 -10
- package/src/book-topology-runs-migrator.ts +4 -3
- package/src/collector-config.ts +7 -9
- package/src/compliance-transport.ts +2 -1
- package/src/countersign-contracts.ts +2 -1
- package/src/diarist-contracts.ts +3 -2
- package/src/doctor-contracts.ts +3 -1
- package/src/doctor-evidence.ts +8 -7
- package/src/doctor-role.ts +4 -2
- package/src/dossier-resolution.ts +2 -4
- package/src/engine-detour-tool.ts +0 -2
- package/src/engine-detour-usage.ts +2 -4
- package/src/external-host-turn-loop.ts +3 -1
- package/src/factory-board.ts +1 -8
- package/src/gatekeeper-role.ts +2 -10
- package/src/gleaner-left-contracts.ts +3 -1
- package/src/headless-host/description.ts +15 -18
- package/src/headless-host/role-turn-host.ts +10 -9
- package/src/host-session-record.ts +4 -2
- package/src/inspector-contracts.ts +2 -1
- package/src/ledger-session-read.ts +2 -5
- package/src/merger-contracts.ts +10 -9
- package/src/navigator-attendance.ts +10 -12
- package/src/navigator-invocation-identity.ts +3 -2
- package/src/navigator-public-session.ts +4 -6
- package/src/navigator-session-contracts.ts +8 -11
- package/src/navigator-work-base.ts +5 -8
- package/src/navigator-work-context.ts +2 -1
- package/src/notary-contracts.ts +4 -6
- package/src/oauth-keepalive.ts +5 -18
- package/src/package-contracts/auditor-output.ts +2 -4
- package/src/package-contracts/fixer-packet.ts +4 -6
- package/src/package-contracts/gatekeeper-output.ts +2 -4
- package/src/package-contracts/judge-output.ts +0 -1
- package/src/package-contracts/navigator-output.ts +8 -8
- package/src/package-contracts/terminating-infrastructure.ts +6 -20
- package/src/package-contracts/terminating-tools.ts +8 -12
- package/src/pi/adapter.ts +0 -1
- package/src/pi/role-turn-host.ts +0 -1
- package/src/public-cli/analyst-run.ts +4 -2
- package/src/public-cli/auto-resume.ts +5 -12
- package/src/public-cli/cli.ts +77 -83
- package/src/public-cli/config.ts +16 -27
- package/src/public-cli/countersign-run.ts +2 -4
- package/src/public-cli/host-providers.ts +10 -27
- package/src/public-cli/instruction-seat-run.ts +87 -58
- package/src/public-cli/invocation.ts +159 -172
- package/src/public-cli/post-admission.ts +115 -103
- package/src/public-cli/role-seat-runtime.ts +72 -0
- package/src/public-cli/run-lifecycle.ts +27 -67
- package/src/public-cli/settlement.ts +11 -33
- package/src/public-cli/terminal.ts +2 -17
- package/src/public-cli/turn-request.ts +26 -0
- package/src/public-role-summons.ts +24 -48
- package/src/receipt-delivery-policy.ts +1 -4
- package/src/reviewer-role.ts +0 -1
- package/src/role-envelope.ts +5 -3
- package/src/role-run-placement.ts +9 -10
- package/src/role-run-relocation.ts +13 -23
- package/src/role-runtime.ts +9 -15
- package/src/run-terminal-artifacts.ts +2 -16
- package/src/run-ticket-number.ts +4 -10
- package/src/session-assistant-usage.ts +3 -1
- package/src/session-dialogue.ts +1 -4
- package/src/session-identity.ts +0 -1
- package/src/sitian-reader.ts +2 -4
- package/src/submission-correctable-error.ts +3 -1
- package/src/submission-errors.ts +2 -1
- package/src/submission-gate.ts +3 -1
- package/src/submission-ledger.ts +5 -6
- package/src/ticket-provenance-contracts.ts +1 -4
- package/src/ticket-provenance.ts +3 -1
- package/src/ticket-snapshot.ts +2 -4
- package/src/ticket-trajectory.ts +1 -8
- package/src/typed-provider-http.ts +5 -15
- package/src/unknown-value.ts +34 -0
- package/src/user-dialogue-stdin.ts +3 -1
- package/src/worker-role.ts +2 -5
- package/src/worker-submission-gates.ts +5 -7
|
@@ -9,7 +9,7 @@ import { tmpdir } from "node:os";
|
|
|
9
9
|
import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
10
10
|
import { activationBookDirectory, ensureRealDirectoryTree, homeFromRunDirectory, pathContainedIn, resolveActivationLedgerHome, } from "../activation-ledger-topology.js";
|
|
11
11
|
import { resolveBookKeyFromGit } from "../activation-ledger-git.js";
|
|
12
|
-
import { ensureRoleRunDirectory, ensureRoleRunPlacement, listBookRunDirectories, roleRunArtifactsDirectory, roleRunPlacement, } from "../role-run-placement.js";
|
|
12
|
+
import { ensureRoleRunDirectory, ensureRoleRunPlacement, isUnboundRunDirectory, listBookRunDirectories, roleRunArtifactsDirectory, roleRunPlacement, } from "../role-run-placement.js";
|
|
13
13
|
import { packagedAdmittedSubject, packagedArgvResult, packagedBareToken, packagedBaseIsRevision, packagedEmitsAuthorityRefs, packagedPublicInstructionSubject, packagedRoleMetadata, packagedStoresSourceRunRaw, packagedSubjectChoices, } from "../packaged-role-registry.js";
|
|
14
14
|
import { isSafePositiveTicketNumber, readBoardTicketNumber, requireSafePositiveTicketNumber, } from "../run-ticket-number.js";
|
|
15
15
|
import { rewriteRunDirectoryPathFields, rewriteRunDirectoryPathValue, } from "../role-run-relocation.js";
|
|
@@ -27,6 +27,7 @@ import { NotarySourceRunError, resolveNotarySourceRunLocator, } from "../notary-
|
|
|
27
27
|
import { appendEngineSessionMaterial, } from "../package-resources/engine-material.js";
|
|
28
28
|
import { CliUsageError } from "./cli-errors.js";
|
|
29
29
|
import { REJECTED_PUBLIC_SPELLINGS, createTypedOptionConsumer, evaluateAnalystModeOptionContract, optionsForOwner, resolveAnalystMode, } from "./option-definitions.js";
|
|
30
|
+
import { errorText, isRecord } from "../unknown-value.js";
|
|
30
31
|
/** Issue a principal from the single authoritative role-run placement. */
|
|
31
32
|
export function issueAdmissionPlacement(authority, request) {
|
|
32
33
|
const ledgerHome = resolveActivationLedgerHome(request.home);
|
|
@@ -103,44 +104,53 @@ async function writeRoleInvocationLedger(source, role, effectiveModel) {
|
|
|
103
104
|
* Host stays write-if-present (`string` only).
|
|
104
105
|
*/
|
|
105
106
|
export async function recordEffectiveInvocationModel(runDirectory, model, engine, host, engineModel) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
107
|
+
await updateDurableJsonPage(join(runDirectory, "invocation.json"), (current) => {
|
|
108
|
+
const next = { ...current };
|
|
109
|
+
if (model !== undefined) {
|
|
110
|
+
next.provider = model.provider;
|
|
111
|
+
next.model = model.model;
|
|
112
|
+
if (model.thinking === undefined) {
|
|
113
|
+
delete next.thinking;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
next.thinking = model.thinking;
|
|
117
|
+
}
|
|
114
118
|
}
|
|
115
|
-
|
|
116
|
-
next.
|
|
119
|
+
if (engine === null) {
|
|
120
|
+
delete next.engine;
|
|
117
121
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
122
|
+
else if (engine !== undefined) {
|
|
123
|
+
next.engine = engine;
|
|
124
|
+
}
|
|
125
|
+
if (engineModel === null) {
|
|
126
|
+
delete next.engineModel;
|
|
127
|
+
}
|
|
128
|
+
else if (engineModel !== undefined) {
|
|
129
|
+
next.engineModel = engineModel;
|
|
130
|
+
}
|
|
131
|
+
if (host !== undefined) {
|
|
132
|
+
next.host = host;
|
|
133
|
+
}
|
|
134
|
+
return next;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Read one durable JSON object, let the caller keep its field rules, and write
|
|
139
|
+
* the page back. `undefined` means the caller decided not to change the page.
|
|
140
|
+
*/
|
|
141
|
+
async function updateDurableJsonPage(path, update) {
|
|
142
|
+
const current = JSON.parse(await readFile(path, "utf8"));
|
|
143
|
+
const next = update(current);
|
|
144
|
+
if (next === undefined)
|
|
145
|
+
return;
|
|
146
|
+
await writeFile(path, `${JSON.stringify(next, null, 2)}\n`, "utf8");
|
|
135
147
|
}
|
|
136
148
|
/** Merge observed launch-time fields into the single existing invocation.json identity page. */
|
|
137
149
|
async function mergeInvocationIdentityPage(runDirectory, fields) {
|
|
138
|
-
|
|
139
|
-
const current = JSON.parse(await readFile(ledgerPath, "utf8"));
|
|
140
|
-
await writeFile(ledgerPath, `${JSON.stringify({
|
|
150
|
+
await updateDurableJsonPage(join(runDirectory, "invocation.json"), (current) => ({
|
|
141
151
|
...current,
|
|
142
152
|
...fields,
|
|
143
|
-
}
|
|
153
|
+
}));
|
|
144
154
|
}
|
|
145
155
|
/**
|
|
146
156
|
* Persist parent --source-run path onto admitted-request for officer resume lookup (#747).
|
|
@@ -150,19 +160,19 @@ export async function persistAdmittedSourceRunPath(admitted, sourceRunPath, audi
|
|
|
150
160
|
if (sourceRunPath.trim() === "") {
|
|
151
161
|
throw new Error("persistAdmittedSourceRunPath requires a non-empty sourceRunPath");
|
|
152
162
|
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
return
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
}
|
|
163
|
+
await updateDurableJsonPage(admitted.admittedRequestPath, (current) => {
|
|
164
|
+
if (typeof current.sourceRunPath === "string" && current.sourceRunPath !== sourceRunPath) {
|
|
165
|
+
throw new Error(`persistAdmittedSourceRunPath refuses to replace ${current.sourceRunPath} with ${sourceRunPath}`);
|
|
166
|
+
}
|
|
167
|
+
const sameSubject = auditorSubject === undefined || current.auditorSubject === auditorSubject;
|
|
168
|
+
if (current.sourceRunPath === sourceRunPath && sameSubject)
|
|
169
|
+
return undefined;
|
|
170
|
+
return {
|
|
171
|
+
...current,
|
|
172
|
+
sourceRunPath,
|
|
173
|
+
...(auditorSubject === undefined ? {} : { auditorSubject }),
|
|
174
|
+
};
|
|
175
|
+
});
|
|
166
176
|
}
|
|
167
177
|
/**
|
|
168
178
|
* Bind a post-admission resolved ticketNumber onto the in-memory admitted
|
|
@@ -177,17 +187,19 @@ export async function bindAdmittedTicketNumber(admitted, ticketNumber) {
|
|
|
177
187
|
}
|
|
178
188
|
/** Persist each direct caller observed while a retained run is resumed. */
|
|
179
189
|
export async function recordAdmittedCorrelation(admitted, correlationId) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
let correlationIds = [];
|
|
191
|
+
await updateDurableJsonPage(admitted.admittedRequestPath, (current) => {
|
|
192
|
+
const prior = [
|
|
193
|
+
...(Array.isArray(current.correlationIds)
|
|
194
|
+
? current.correlationIds.filter((value) => typeof value === "string" && value.trim() !== "")
|
|
195
|
+
: []),
|
|
196
|
+
...(typeof current.correlationId === "string" && current.correlationId.trim() !== ""
|
|
197
|
+
? [current.correlationId]
|
|
198
|
+
: []),
|
|
199
|
+
];
|
|
200
|
+
correlationIds = [...new Set([...prior, correlationId])];
|
|
201
|
+
return { ...current, correlationId, correlationIds };
|
|
202
|
+
});
|
|
191
203
|
await mergeInvocationIdentityPage(admitted.runDirectory, {
|
|
192
204
|
correlationId,
|
|
193
205
|
correlationIds,
|
|
@@ -198,7 +210,7 @@ export async function recordAdmittedCorrelation(admitted, correlationId) {
|
|
|
198
210
|
}
|
|
199
211
|
/** File a role run under its latest typed ticket identity. */
|
|
200
212
|
export async function relocateAdmittedRunToTicket(admitted, authority, heldLease) {
|
|
201
|
-
if (admitted.ticketNumber === undefined || !admitted.runDirectory
|
|
213
|
+
if (admitted.ticketNumber === undefined || !isUnboundRunDirectory(admitted.runDirectory))
|
|
202
214
|
return undefined;
|
|
203
215
|
const oldRunDirectory = admitted.runDirectory;
|
|
204
216
|
const ledgerHome = resolveActivationLedgerHome(homeFromRunDirectory(oldRunDirectory));
|
|
@@ -264,12 +276,13 @@ export async function relocateAdmittedRunToTicket(admitted, authority, heldLease
|
|
|
264
276
|
}
|
|
265
277
|
/** Persist the exact child identity; later parent binding never inspects siblings. */
|
|
266
278
|
export async function recordChildDiaristRun(parent, childRunId) {
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
279
|
+
await updateDurableJsonPage(parent.admittedRequestPath, (page) => {
|
|
280
|
+
const existing = Array.isArray(page.childDiaristRunIds)
|
|
281
|
+
? page.childDiaristRunIds.filter((runId) => typeof runId === "string")
|
|
282
|
+
: [];
|
|
283
|
+
const childDiaristRunIds = existing.includes(childRunId) ? existing : [...existing, childRunId];
|
|
284
|
+
return { ...page, childDiaristRunIds };
|
|
285
|
+
});
|
|
273
286
|
}
|
|
274
287
|
/**
|
|
275
288
|
* Bind ticket identity onto a run directory's durable pages when the admitted
|
|
@@ -279,10 +292,16 @@ export async function recordChildDiaristRun(parent, childRunId) {
|
|
|
279
292
|
export async function bindTicketNumberOnRunDirectory(runDirectory, ticketNumber) {
|
|
280
293
|
requireSafePositiveTicketNumber(ticketNumber, "bindTicketNumberOnRunDirectory");
|
|
281
294
|
const admittedPath = join(runDirectory, "admitted-request.json");
|
|
282
|
-
|
|
283
|
-
|
|
295
|
+
let unchanged = false;
|
|
296
|
+
await updateDurableJsonPage(admittedPath, (admitted) => {
|
|
297
|
+
if (admitted.ticketNumber === ticketNumber) {
|
|
298
|
+
unchanged = true;
|
|
299
|
+
return undefined;
|
|
300
|
+
}
|
|
301
|
+
return { ...admitted, ticketNumber };
|
|
302
|
+
});
|
|
303
|
+
if (unchanged)
|
|
284
304
|
return;
|
|
285
|
-
await writeFile(admittedPath, `${JSON.stringify({ ...admitted, ticketNumber }, null, 2)}\n`, "utf8");
|
|
286
305
|
await mergeInvocationIdentityPage(runDirectory, { ticketNumber });
|
|
287
306
|
}
|
|
288
307
|
/** Add the identity returned by the production Pi launch seam to its existing ledger page. */
|
|
@@ -528,18 +547,31 @@ function requireOptionPath(flag, value) {
|
|
|
528
547
|
* next option), and a leading `-` (read as the next Skill option). Not a
|
|
529
548
|
* general free-text gate — only the projection admission seam.
|
|
530
549
|
*/
|
|
550
|
+
function skillArgTokenFault(value) {
|
|
551
|
+
if (value === undefined || value.trim() === "")
|
|
552
|
+
return "empty";
|
|
553
|
+
if (/\s/.test(value))
|
|
554
|
+
return "whitespace";
|
|
555
|
+
if (value.startsWith("-"))
|
|
556
|
+
return "optionLike";
|
|
557
|
+
return undefined;
|
|
558
|
+
}
|
|
531
559
|
function requireSkillArgToken(value, messages) {
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
if (/\s/.test(value)) {
|
|
536
|
-
throw new CliUsageError(messages.whitespace);
|
|
537
|
-
}
|
|
538
|
-
if (value.startsWith("-")) {
|
|
539
|
-
throw new CliUsageError(messages.optionLike);
|
|
540
|
-
}
|
|
560
|
+
const fault = skillArgTokenFault(value);
|
|
561
|
+
if (fault !== undefined)
|
|
562
|
+
throw new CliUsageError(messages[fault]);
|
|
541
563
|
return value;
|
|
542
564
|
}
|
|
565
|
+
/**
|
|
566
|
+
* Durable reviewer base on resume. Same token rule as fresh `--base`,
|
|
567
|
+
* with the resume-owned missing/damaged split.
|
|
568
|
+
*/
|
|
569
|
+
export function admittedReviewerBaseFault(value) {
|
|
570
|
+
const fault = skillArgTokenFault(value);
|
|
571
|
+
if (fault === undefined)
|
|
572
|
+
return undefined;
|
|
573
|
+
return fault === "empty" ? "missing" : "damaged";
|
|
574
|
+
}
|
|
543
575
|
/**
|
|
544
576
|
* Reviewer --base admission: nonempty single Skill-arg token (shared rule with
|
|
545
577
|
* requireAuthorityRef). Multi-token / option-like values smuggle extra flags
|
|
@@ -789,9 +821,6 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
789
821
|
});
|
|
790
822
|
}
|
|
791
823
|
case "worker-packet": {
|
|
792
|
-
if (parsed.project !== undefined) {
|
|
793
|
-
requireOptionPath("--project", parsed.project);
|
|
794
|
-
}
|
|
795
824
|
if (instruction.trim() === "") {
|
|
796
825
|
throw new CliUsageError("fixer requires a nonblank repair instruction");
|
|
797
826
|
}
|
|
@@ -844,19 +873,7 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
844
873
|
});
|
|
845
874
|
}
|
|
846
875
|
case "collect-target": {
|
|
847
|
-
|
|
848
|
-
requireOptionPath("--project", parsed.project);
|
|
849
|
-
}
|
|
850
|
-
let explicitPrNumber;
|
|
851
|
-
if (parsed.prNumber !== undefined) {
|
|
852
|
-
try {
|
|
853
|
-
explicitPrNumber = parseCollectorPrNumber(parsed.prNumber);
|
|
854
|
-
}
|
|
855
|
-
catch (error) {
|
|
856
|
-
const detail = error instanceof Error ? error.message : String(error);
|
|
857
|
-
throw new CliUsageError(detail, { cause: error });
|
|
858
|
-
}
|
|
859
|
-
}
|
|
876
|
+
const explicitPrNumber = parsed.prNumber;
|
|
860
877
|
const projectRoot = resolve(parsed.project ?? shared.cwd);
|
|
861
878
|
let repository;
|
|
862
879
|
if (parsed.repo !== undefined) {
|
|
@@ -864,7 +881,7 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
864
881
|
repository = parseCollectorRepository(parsed.repo);
|
|
865
882
|
}
|
|
866
883
|
catch (error) {
|
|
867
|
-
const detail =
|
|
884
|
+
const detail = errorText(error);
|
|
868
885
|
throw new CliUsageError(detail, { cause: error });
|
|
869
886
|
}
|
|
870
887
|
}
|
|
@@ -879,7 +896,7 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
879
896
|
manifestCanonicalJson = manifest.canonicalJson;
|
|
880
897
|
}
|
|
881
898
|
catch (error) {
|
|
882
|
-
throw new CliUsageError(
|
|
899
|
+
throw new CliUsageError(errorText(error), { cause: error });
|
|
883
900
|
}
|
|
884
901
|
}
|
|
885
902
|
const manifestDigest = manifest.digest;
|
|
@@ -907,15 +924,10 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
907
924
|
return { ...admittedCollector, repository };
|
|
908
925
|
}
|
|
909
926
|
case "case-identity": {
|
|
910
|
-
if (parsed.
|
|
911
|
-
|
|
912
|
-
}
|
|
913
|
-
const issueNumber = parsed.issueNumber ?? Number.NaN;
|
|
914
|
-
if (!Number.isInteger(issueNumber) ||
|
|
915
|
-
issueNumber < 1 ||
|
|
916
|
-
!DOCTOR_ISSUE_NUMBER_PATTERN.test(String(issueNumber))) {
|
|
917
|
-
throw new CliUsageError(`doctor --issue must be a positive integer, got ${issueNumber}`);
|
|
927
|
+
if (parsed.issueNumber === undefined) {
|
|
928
|
+
throw new CliUsageError(`doctor --issue must be a positive integer, got ${Number.NaN}`);
|
|
918
929
|
}
|
|
930
|
+
const issueNumber = parsed.issueNumber;
|
|
919
931
|
let frozenAttachments = [];
|
|
920
932
|
const admittedDoctor = await admitStandardMaterialInvocation("doctor", {
|
|
921
933
|
...shared,
|
|
@@ -937,7 +949,7 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
937
949
|
catch (error) {
|
|
938
950
|
if (error instanceof CliUsageError)
|
|
939
951
|
throw error;
|
|
940
|
-
const detail =
|
|
952
|
+
const detail = errorText(error);
|
|
941
953
|
throw new CliUsageError(detail, { cause: error });
|
|
942
954
|
}
|
|
943
955
|
if (parsed.runs === undefined) {
|
|
@@ -955,7 +967,7 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
955
967
|
catch (error) {
|
|
956
968
|
if (error instanceof CliUsageError)
|
|
957
969
|
throw error;
|
|
958
|
-
const detail =
|
|
970
|
+
const detail = errorText(error);
|
|
959
971
|
throw new CliUsageError(`doctor case could not be constructed from retained evidence: ${detail}`, { cause: error });
|
|
960
972
|
}
|
|
961
973
|
frozenAttachments = await freezeAttachments(attachmentPaths, placed.attachmentsDirectory);
|
|
@@ -970,23 +982,22 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
970
982
|
return { ...admittedDoctor, attachments: frozenAttachments };
|
|
971
983
|
}
|
|
972
984
|
case "source-locator": {
|
|
973
|
-
if (parsed.project !== undefined) {
|
|
974
|
-
requireOptionPath("--project", parsed.project);
|
|
975
|
-
}
|
|
976
985
|
const projectRoot = resolve(parsed.project ?? shared.cwd);
|
|
977
|
-
let sourceRun;
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
986
|
+
let sourceRun = override?.resolvedSourceRun;
|
|
987
|
+
if (sourceRun === undefined) {
|
|
988
|
+
try {
|
|
989
|
+
sourceRun = await resolveNotarySourceRunLocator({
|
|
990
|
+
projectRoot,
|
|
991
|
+
sourceRun: parsed.sourceRun ?? "",
|
|
992
|
+
home: shared.home,
|
|
993
|
+
});
|
|
994
|
+
}
|
|
995
|
+
catch (error) {
|
|
996
|
+
if (error instanceof NotarySourceRunError) {
|
|
997
|
+
throw new CliUsageError(error.message, { cause: error });
|
|
998
|
+
}
|
|
999
|
+
throw error;
|
|
988
1000
|
}
|
|
989
|
-
throw error;
|
|
990
1001
|
}
|
|
991
1002
|
// Board ticket on the source run wins; otherwise the summons ticket. Code does not infer one.
|
|
992
1003
|
const inheritedTicketNumber = await readBoardTicketNumber(sourceRun.runDirectory);
|
|
@@ -1007,9 +1018,6 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
1007
1018
|
});
|
|
1008
1019
|
}
|
|
1009
1020
|
case "gleaner": {
|
|
1010
|
-
if (parsed.project !== undefined) {
|
|
1011
|
-
requireOptionPath("--project", parsed.project);
|
|
1012
|
-
}
|
|
1013
1021
|
const baseRevision = parsed.baseRevision ?? "";
|
|
1014
1022
|
if (baseRevision.trim() === "") {
|
|
1015
1023
|
throw new CliUsageError("--base requires a nonempty revision");
|
|
@@ -1024,16 +1032,19 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
1024
1032
|
});
|
|
1025
1033
|
}
|
|
1026
1034
|
case "review-basis": {
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1035
|
+
if (parsed.lens === undefined) {
|
|
1036
|
+
throw new CliUsageError("--lens requires completeness or correctness");
|
|
1037
|
+
}
|
|
1038
|
+
if (parsed.baseRevision === undefined) {
|
|
1039
|
+
throw new CliUsageError("--base requires a nonempty revision");
|
|
1030
1040
|
}
|
|
1031
|
-
const baseRevision = requireReviewerBaseRevision(parsed.baseRevision);
|
|
1032
1041
|
const rawRefs = parsed.authorityRefs ?? [];
|
|
1033
1042
|
if (rawRefs.length === 0) {
|
|
1034
1043
|
throw new CliUsageError("reviewer requires --authority-ref <ref>");
|
|
1035
1044
|
}
|
|
1036
|
-
const
|
|
1045
|
+
const lens = parsed.lens;
|
|
1046
|
+
const baseRevision = parsed.baseRevision;
|
|
1047
|
+
const authorityRefs = Object.freeze([...rawRefs]);
|
|
1037
1048
|
const admittedReviewer = await admitStandardMaterialInvocation("reviewer", {
|
|
1038
1049
|
...shared,
|
|
1039
1050
|
instruction,
|
|
@@ -1048,9 +1059,6 @@ export async function admitPublicRole(role, parsed, env, override) {
|
|
|
1048
1059
|
return { ...admittedReviewer, authorityRefs };
|
|
1049
1060
|
}
|
|
1050
1061
|
case "merge-envelope": {
|
|
1051
|
-
if (parsed.project !== undefined) {
|
|
1052
|
-
requireOptionPath("--project", parsed.project);
|
|
1053
|
-
}
|
|
1054
1062
|
if (instruction.trim() === "") {
|
|
1055
1063
|
throw new CliUsageError("merger requires a nonblank task instruction");
|
|
1056
1064
|
}
|
|
@@ -1106,9 +1114,6 @@ function admissionSubject(ticketNumber) {
|
|
|
1106
1114
|
* Every public seat persists through this function. Seat-only fields are supplied by the caller.
|
|
1107
1115
|
*/
|
|
1108
1116
|
async function placeRoleAdmission(options) {
|
|
1109
|
-
if (options.project !== undefined) {
|
|
1110
|
-
requireOptionPath("--project", options.project);
|
|
1111
|
-
}
|
|
1112
1117
|
const projectRoot = resolve(options.project ?? options.cwd);
|
|
1113
1118
|
const runId = options.runId ?? (options.createRunId ?? uuidv7)();
|
|
1114
1119
|
const ticketFields = ticketAdmissionFields(options.assertedTicketNumber);
|
|
@@ -1318,7 +1323,7 @@ export async function materializeCountersignInvocation(admitted, options) {
|
|
|
1318
1323
|
export async function loadAdmittedJudgeRequest(runDirectory) {
|
|
1319
1324
|
try {
|
|
1320
1325
|
const raw = JSON.parse(await readFile(join(runDirectory, "admitted-request.json"), "utf8"));
|
|
1321
|
-
if (
|
|
1326
|
+
if (!isRecord(raw))
|
|
1322
1327
|
return undefined;
|
|
1323
1328
|
const record = raw;
|
|
1324
1329
|
if (!packagedPublicInstructionSubject(record.role))
|
|
@@ -1350,7 +1355,7 @@ function parsePositivePrOption(raw) {
|
|
|
1350
1355
|
return parseCollectorPrNumber(raw);
|
|
1351
1356
|
}
|
|
1352
1357
|
catch (error) {
|
|
1353
|
-
throw new CliUsageError(
|
|
1358
|
+
throw new CliUsageError(errorText(error), { cause: error });
|
|
1354
1359
|
}
|
|
1355
1360
|
}
|
|
1356
1361
|
function parseRepoOption(raw) {
|
|
@@ -1392,7 +1397,7 @@ export function resolveGitHubRemoteRepository(projectRoot) {
|
|
|
1392
1397
|
return parseCollectorRepository(ownerRepo);
|
|
1393
1398
|
}
|
|
1394
1399
|
catch (error) {
|
|
1395
|
-
const detail =
|
|
1400
|
+
const detail = errorText(error);
|
|
1396
1401
|
throw new CliUsageError(detail, { cause: error });
|
|
1397
1402
|
}
|
|
1398
1403
|
}
|
|
@@ -1452,7 +1457,7 @@ export async function resolveDoctorCaseRunsPath(options) {
|
|
|
1452
1457
|
real = await realpath(resolved);
|
|
1453
1458
|
}
|
|
1454
1459
|
catch (error) {
|
|
1455
|
-
const detail =
|
|
1460
|
+
const detail = errorText(error);
|
|
1456
1461
|
throw new CliUsageError(`doctor --runs is not a readable retained runs root: ${detail}`, { cause: error });
|
|
1457
1462
|
}
|
|
1458
1463
|
const normalized = real.split(sep).join("/");
|