@akagilnc/pi-workflow-roles 0.1.4802 → 0.1.4874
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
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* tokens or add parallel repeatability / requiredness branches.
|
|
12
12
|
*/
|
|
13
13
|
import { CliUsageError } from "./cli-errors.js";
|
|
14
|
+
import { PUBLIC_CALLABLE_ROLES } from "./registry.js";
|
|
14
15
|
/**
|
|
15
16
|
* Cross-field at-least-one rules for analyst modes.
|
|
16
17
|
* #399: issue bare call is lawful (whole book from cwd) — no require-any-of on issue.
|
|
@@ -281,10 +282,28 @@ const SHARED_ATTACH_SEMANTICS = {
|
|
|
281
282
|
function bindOwner(owner, semantics) {
|
|
282
283
|
return { ...semantics, owner };
|
|
283
284
|
}
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
285
|
+
/** Seats whose public face is only project + attach. Unique rows stay explicit. */
|
|
286
|
+
function projectAndAttach(owner) {
|
|
287
|
+
return [
|
|
288
|
+
bindOwner(owner, SHARED_PROJECT_SEMANTICS),
|
|
289
|
+
bindOwner(owner, SHARED_ATTACH_SEMANTICS),
|
|
290
|
+
];
|
|
291
|
+
}
|
|
292
|
+
const SHARED_PHASE_SEMANTICS = {
|
|
293
|
+
id: "phase",
|
|
294
|
+
canonical: "plan|apply",
|
|
295
|
+
aliases: ["plan", "apply"],
|
|
296
|
+
valueMetavar: null,
|
|
297
|
+
required: false,
|
|
298
|
+
repeatable: false,
|
|
299
|
+
defaultValue: "apply",
|
|
300
|
+
form: "positional",
|
|
301
|
+
phases: ["plan", "apply"],
|
|
302
|
+
description: {
|
|
303
|
+
en: "Optional phase token before the instruction; defaults to apply.",
|
|
304
|
+
zh: "指令前可选 phase 词元;默认 apply。",
|
|
305
|
+
},
|
|
306
|
+
};
|
|
288
307
|
const GLEANER_LEFT_OPTIONS = [
|
|
289
308
|
bindOwner("gleaner-left", SHARED_PROJECT_SEMANTICS),
|
|
290
309
|
// Unanchored seat: no --attach face (self-fetches the merge-candidate diff).
|
|
@@ -303,21 +322,8 @@ const GLEANER_LEFT_OPTIONS = [
|
|
|
303
322
|
},
|
|
304
323
|
},
|
|
305
324
|
];
|
|
306
|
-
const INSPECTOR_OPTIONS = [
|
|
307
|
-
bindOwner("inspector", SHARED_PROJECT_SEMANTICS),
|
|
308
|
-
bindOwner("inspector", SHARED_ATTACH_SEMANTICS),
|
|
309
|
-
];
|
|
310
|
-
const GATEKEEPER_OPTIONS = [
|
|
311
|
-
bindOwner("gatekeeper", SHARED_PROJECT_SEMANTICS),
|
|
312
|
-
bindOwner("gatekeeper", SHARED_ATTACH_SEMANTICS),
|
|
313
|
-
];
|
|
314
|
-
const NAVIGATOR_OPTIONS = [
|
|
315
|
-
bindOwner("navigator", SHARED_PROJECT_SEMANTICS),
|
|
316
|
-
bindOwner("navigator", SHARED_ATTACH_SEMANTICS),
|
|
317
|
-
];
|
|
318
325
|
const AUDITOR_OPTIONS = [
|
|
319
|
-
|
|
320
|
-
bindOwner("auditor", SHARED_ATTACH_SEMANTICS),
|
|
326
|
+
...projectAndAttach("auditor"),
|
|
321
327
|
{
|
|
322
328
|
id: "subject",
|
|
323
329
|
owner: "auditor",
|
|
@@ -347,57 +353,13 @@ const AUDITOR_OPTIONS = [
|
|
|
347
353
|
},
|
|
348
354
|
},
|
|
349
355
|
];
|
|
350
|
-
const COUNTERSIGN_OPTIONS = [
|
|
351
|
-
bindOwner("countersign", SHARED_PROJECT_SEMANTICS),
|
|
352
|
-
bindOwner("countersign", SHARED_ATTACH_SEMANTICS),
|
|
353
|
-
];
|
|
354
|
-
const DIARIST_OPTIONS = [
|
|
355
|
-
bindOwner("diarist", SHARED_PROJECT_SEMANTICS),
|
|
356
|
-
bindOwner("diarist", SHARED_ATTACH_SEMANTICS),
|
|
357
|
-
];
|
|
358
|
-
const SECRETARIAT_OPTIONS = [
|
|
359
|
-
bindOwner("secretariat", SHARED_PROJECT_SEMANTICS),
|
|
360
|
-
bindOwner("secretariat", SHARED_ATTACH_SEMANTICS),
|
|
361
|
-
];
|
|
362
356
|
const CODER_OPTIONS = [
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
owner: "coder",
|
|
366
|
-
canonical: "plan|apply",
|
|
367
|
-
aliases: ["plan", "apply"],
|
|
368
|
-
valueMetavar: null,
|
|
369
|
-
required: false,
|
|
370
|
-
repeatable: false,
|
|
371
|
-
defaultValue: "apply",
|
|
372
|
-
form: "positional",
|
|
373
|
-
phases: ["plan", "apply"],
|
|
374
|
-
description: {
|
|
375
|
-
en: "Optional phase token before the instruction; defaults to apply.",
|
|
376
|
-
zh: "指令前可选 phase 词元;默认 apply。",
|
|
377
|
-
},
|
|
378
|
-
},
|
|
379
|
-
bindOwner("coder", SHARED_PROJECT_SEMANTICS),
|
|
380
|
-
bindOwner("coder", SHARED_ATTACH_SEMANTICS),
|
|
357
|
+
bindOwner("coder", SHARED_PHASE_SEMANTICS),
|
|
358
|
+
...projectAndAttach("coder"),
|
|
381
359
|
];
|
|
382
360
|
const FIXER_OPTIONS = [
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
owner: "fixer",
|
|
386
|
-
canonical: "plan|apply",
|
|
387
|
-
aliases: ["plan", "apply"],
|
|
388
|
-
valueMetavar: null,
|
|
389
|
-
required: false,
|
|
390
|
-
repeatable: false,
|
|
391
|
-
defaultValue: "apply",
|
|
392
|
-
form: "positional",
|
|
393
|
-
phases: ["plan", "apply"],
|
|
394
|
-
description: {
|
|
395
|
-
en: "Optional phase token before the instruction; defaults to apply.",
|
|
396
|
-
zh: "指令前可选 phase 词元;默认 apply。",
|
|
397
|
-
},
|
|
398
|
-
},
|
|
399
|
-
bindOwner("fixer", SHARED_PROJECT_SEMANTICS),
|
|
400
|
-
bindOwner("fixer", SHARED_ATTACH_SEMANTICS),
|
|
361
|
+
bindOwner("fixer", SHARED_PHASE_SEMANTICS),
|
|
362
|
+
...projectAndAttach("fixer"),
|
|
401
363
|
{
|
|
402
364
|
id: "prerequisites",
|
|
403
365
|
owner: "fixer",
|
|
@@ -460,8 +422,7 @@ const REVIEWER_OPTIONS = [
|
|
|
460
422
|
},
|
|
461
423
|
];
|
|
462
424
|
const COLLECTOR_OPTIONS = [
|
|
463
|
-
|
|
464
|
-
bindOwner("collector", SHARED_ATTACH_SEMANTICS),
|
|
425
|
+
...projectAndAttach("collector"),
|
|
465
426
|
{
|
|
466
427
|
id: "pr",
|
|
467
428
|
owner: "collector",
|
|
@@ -521,8 +482,7 @@ const COLLECTOR_OPTIONS = [
|
|
|
521
482
|
},
|
|
522
483
|
];
|
|
523
484
|
const DOCTOR_OPTIONS = [
|
|
524
|
-
|
|
525
|
-
bindOwner("doctor", SHARED_ATTACH_SEMANTICS),
|
|
485
|
+
...projectAndAttach("doctor"),
|
|
526
486
|
{
|
|
527
487
|
id: "issue",
|
|
528
488
|
owner: "doctor",
|
|
@@ -719,13 +679,10 @@ const ANALYST_OPTIONS = [
|
|
|
719
679
|
},
|
|
720
680
|
];
|
|
721
681
|
/**
|
|
722
|
-
*
|
|
723
|
-
*
|
|
682
|
+
* Seats whose public rows are not the shared project+attach face.
|
|
683
|
+
* A new project+attach seat needs no entry here.
|
|
724
684
|
*/
|
|
725
|
-
|
|
726
|
-
global: GLOBAL_OPTIONS,
|
|
727
|
-
judge: JUDGE_OPTIONS,
|
|
728
|
-
countersign: COUNTERSIGN_OPTIONS,
|
|
685
|
+
const SEAT_OPTION_ROWS = {
|
|
729
686
|
"gleaner-left": GLEANER_LEFT_OPTIONS,
|
|
730
687
|
coder: CODER_OPTIONS,
|
|
731
688
|
fixer: FIXER_OPTIONS,
|
|
@@ -734,32 +691,27 @@ export const PUBLIC_OPTION_TABLE = {
|
|
|
734
691
|
doctor: DOCTOR_OPTIONS,
|
|
735
692
|
merger: MERGER_OPTIONS,
|
|
736
693
|
notary: NOTARY_OPTIONS,
|
|
737
|
-
inspector: INSPECTOR_OPTIONS,
|
|
738
|
-
gatekeeper: GATEKEEPER_OPTIONS,
|
|
739
|
-
navigator: NAVIGATOR_OPTIONS,
|
|
740
694
|
auditor: AUDITOR_OPTIONS,
|
|
741
|
-
diarist: DIARIST_OPTIONS,
|
|
742
|
-
secretariat: SECRETARIAT_OPTIONS,
|
|
743
|
-
analyst: ANALYST_OPTIONS,
|
|
744
695
|
};
|
|
745
|
-
|
|
696
|
+
function seatOptionRows(role) {
|
|
697
|
+
return SEAT_OPTION_ROWS[role] ?? projectAndAttach(role);
|
|
698
|
+
}
|
|
699
|
+
/**
|
|
700
|
+
* Sole production option tables keyed by PUBLIC_ROLE_ARGV / global owner.
|
|
701
|
+
* Rows are readonly definition lists — parsers look up spellings here.
|
|
702
|
+
* Callable seats come from the composition root; only a different face is listed above.
|
|
703
|
+
*/
|
|
704
|
+
function publicOptionTable() {
|
|
705
|
+
const roles = {};
|
|
706
|
+
for (const role of PUBLIC_CALLABLE_ROLES) {
|
|
707
|
+
roles[role] = seatOptionRows(role);
|
|
708
|
+
}
|
|
709
|
+
return { global: GLOBAL_OPTIONS, ...roles, analyst: ANALYST_OPTIONS };
|
|
710
|
+
}
|
|
711
|
+
export const PUBLIC_OPTION_TABLE = publicOptionTable();
|
|
712
|
+
/** Role/deterministic owners that appear on PUBLIC_ROLE_ARGV. Roles follow the composition root; analyst is the deterministic command. */
|
|
746
713
|
export const PUBLIC_ROLE_OPTION_OWNERS = [
|
|
747
|
-
|
|
748
|
-
"countersign",
|
|
749
|
-
"gleaner-left",
|
|
750
|
-
"coder",
|
|
751
|
-
"fixer",
|
|
752
|
-
"reviewer",
|
|
753
|
-
"collector",
|
|
754
|
-
"doctor",
|
|
755
|
-
"merger",
|
|
756
|
-
"notary",
|
|
757
|
-
"inspector",
|
|
758
|
-
"gatekeeper",
|
|
759
|
-
"navigator",
|
|
760
|
-
"auditor",
|
|
761
|
-
"diarist",
|
|
762
|
-
"secretariat",
|
|
714
|
+
...PUBLIC_CALLABLE_ROLES,
|
|
763
715
|
"analyst",
|
|
764
716
|
];
|
|
765
717
|
export function optionsForOwner(owner) {
|
|
@@ -14,9 +14,9 @@ import { bindAdmittedTicketNumber, buildInstructionTransportPrompt, freezeAttach
|
|
|
14
14
|
import { readRecordedSubmissionRows } from "../submission-ledger.js";
|
|
15
15
|
import { pathContainedIn } from "../activation-ledger-topology.js";
|
|
16
16
|
import { pickEngineAxis } from "../package-resources/engine-material.js";
|
|
17
|
-
import { resolveHostAwareSessionAvailability } from "../session-identity.js";
|
|
17
|
+
import { readStoredHostSessionId, resolveHostAwareSessionAvailability } from "../session-identity.js";
|
|
18
18
|
import { rewriteRunDirectoryPathValue } from "../role-run-relocation.js";
|
|
19
|
-
import { isOfficerReviewSeat } from "../
|
|
19
|
+
import { isOfficerReviewSeat } from "../packaged-role-registry.js";
|
|
20
20
|
import { deliverCaseDossierAsAttachment } from "./case-dossier-delivery.js";
|
|
21
21
|
/** Original error bytes, never relabeled — a secondary fact riding beside a classified cause. */
|
|
22
22
|
function describeCaughtError(error) {
|
|
@@ -875,6 +875,24 @@ export function resumeTurnRequestProjectionOptions(admitted, request, env, summo
|
|
|
875
875
|
...(env.stationChild === undefined ? {} : { stationChild: env.stationChild }),
|
|
876
876
|
};
|
|
877
877
|
}
|
|
878
|
+
/** Shared new-turn and in-call auto-resume projection. Seat code supplies prompt and activation. */
|
|
879
|
+
export function roleTurnOptions(env, admitted, continuation, extra) {
|
|
880
|
+
const correlationId = admitted.correlationId ?? env.correlationId;
|
|
881
|
+
return {
|
|
882
|
+
packageRoot: env.packageRoot,
|
|
883
|
+
home: env.home,
|
|
884
|
+
agentDir: env.agentDir,
|
|
885
|
+
...(env.model === undefined ? {} : { model: env.model }),
|
|
886
|
+
...pickEngineAxis(env),
|
|
887
|
+
...(env.timeoutMs === undefined ? {} : { timeoutMs: env.timeoutMs }),
|
|
888
|
+
...(correlationId === undefined || correlationId.trim() === ""
|
|
889
|
+
? {}
|
|
890
|
+
: { correlationId }),
|
|
891
|
+
continuation,
|
|
892
|
+
...(extra?.cwd === undefined ? {} : { cwd: extra.cwd }),
|
|
893
|
+
...(env.stationChild === undefined ? {} : { stationChild: env.stationChild }),
|
|
894
|
+
};
|
|
895
|
+
}
|
|
878
896
|
/**
|
|
879
897
|
* Build the turn request, then hand off to dispatch. When a writer lease is
|
|
880
898
|
* held, release it if build throws before handoff — dispatch's finally only
|
|
@@ -994,6 +1012,16 @@ export async function runPostAdmissionSeatResume(input) {
|
|
|
994
1012
|
}
|
|
995
1013
|
}
|
|
996
1014
|
let turnRequest = await input.buildTurnRequest(admittedForBuild, request);
|
|
1015
|
+
if (turnRequest.continuation.kind === "resume"
|
|
1016
|
+
&& turnRequest.continuation.hostSessionId === undefined) {
|
|
1017
|
+
const hostSessionId = await readStoredHostSessionId(env.host, env.principalAuthority, admittedForBuild.principal);
|
|
1018
|
+
if (hostSessionId !== undefined) {
|
|
1019
|
+
turnRequest = {
|
|
1020
|
+
...turnRequest,
|
|
1021
|
+
continuation: { ...turnRequest.continuation, hostSessionId },
|
|
1022
|
+
};
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
997
1025
|
// Open court continue, or new court for summons / message re-review
|
|
998
1026
|
// (clause 0 新庭可再交卷; #833). Bare resume without open court omits id.
|
|
999
1027
|
if (openCourtAttemptId !== undefined ||
|