@akagilnc/pi-workflow-roles 0.1.5756 → 0.1.5775
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 +132 -79
- package/dist/headless-host/production-host.js +132 -79
- package/dist/migrate-book-topology.js +7 -6
- package/dist/navigator-attendance.js +1 -1
- package/dist/packaged-role-registry.js +3 -2
- package/dist/public-cli/instruction-seat-run.js +144 -55
- package/dist/public-cli/invocation.js +3 -7
- package/dist/public-cli/main.js +127 -77
- package/dist/public-cli/option-definitions.js +4 -4
- package/dist/public-cli/post-admission.js +17 -28
- package/dist/public-cli/run-lifecycle.js +0 -17
- package/dist/public-role-summons.js +11 -8
- package/dist/run-terminal-artifacts.js +0 -7
- package/package.json +5 -5
- package/src/navigator-attendance.ts +2 -1
- package/src/packaged-role-registry.ts +3 -2
- package/src/public-cli/instruction-seat-run.ts +158 -63
- package/src/public-cli/invocation.ts +4 -8
- package/src/public-cli/option-definitions.ts +5 -4
- package/src/public-cli/post-admission.ts +16 -29
- package/src/public-cli/run-lifecycle.ts +0 -19
- package/src/public-role-summons.ts +27 -16
- package/src/role-runtime.ts +7 -1
- package/src/run-terminal-artifacts.ts +0 -7
package/dist/public-cli/main.js
CHANGED
|
@@ -10106,9 +10106,8 @@ var init_packaged_role_registry = __esm({
|
|
|
10106
10106
|
bareCommand: false,
|
|
10107
10107
|
outputTool: NOTARY_OUTPUT_TOOL_NAME,
|
|
10108
10108
|
settlement: "accepted",
|
|
10109
|
-
/**
|
|
10109
|
+
/** Dialogue via shared resolveReviewSeatDialogueBody (review = fixed dispatch). */
|
|
10110
10110
|
reaskPrompt: true,
|
|
10111
|
-
transportPrompt: "fixed-kickoff",
|
|
10112
10111
|
gateStageLabel: "\u7B26\u5B9D\u90CE",
|
|
10113
10112
|
/** Gate summon binds --source-run and keeps dialogue off the argv. */
|
|
10114
10113
|
gateSummon: "source-run",
|
|
@@ -10131,6 +10130,8 @@ var init_packaged_role_registry = __esm({
|
|
|
10131
10130
|
phases: [null],
|
|
10132
10131
|
outputTool: COUNTERSIGN_OUTPUT_TOOL_NAME,
|
|
10133
10132
|
settlement: "accepted",
|
|
10133
|
+
/** Same shared dialogue resolver as other review seats (#1208 C1). */
|
|
10134
|
+
reaskPrompt: true,
|
|
10134
10135
|
gateStageLabel: "\u7ED9\u4E8B\u4E2D",
|
|
10135
10136
|
/** Gate summon carries the parent payload as the instruction and a parent run id. */
|
|
10136
10137
|
gateSummon: "parent-instruction",
|
|
@@ -11718,7 +11719,6 @@ var run_terminal_artifacts_exports = {};
|
|
|
11718
11719
|
__export(run_terminal_artifacts_exports, {
|
|
11719
11720
|
ATTEMPT_HISTORY_IDENTITY_FIELD: () => ATTEMPT_HISTORY_IDENTITY_FIELD,
|
|
11720
11721
|
TERMINAL_COURT_ATTEMPT_FIELD: () => TERMINAL_COURT_ATTEMPT_FIELD,
|
|
11721
|
-
isTicketCourtCountersignSource: () => isTicketCourtCountersignSource,
|
|
11722
11722
|
readRunTerminal: () => readRunTerminal,
|
|
11723
11723
|
roleFromRunDirectory: () => roleFromRunDirectory,
|
|
11724
11724
|
runIdFromRunDirectory: () => runIdFromRunDirectory,
|
|
@@ -11779,9 +11779,6 @@ function runIdFromRunDirectory(runDirectory) {
|
|
|
11779
11779
|
function roleFromRunDirectory(runDirectory) {
|
|
11780
11780
|
return parseRunLeaf(basename6(runDirectory))?.role;
|
|
11781
11781
|
}
|
|
11782
|
-
function isTicketCourtCountersignSource(runDirectory) {
|
|
11783
|
-
return roleFromRunDirectory(runDirectory) === "countersign";
|
|
11784
|
-
}
|
|
11785
11782
|
var ATTEMPT_HISTORY_IDENTITY_FIELD, TERMINAL_COURT_ATTEMPT_FIELD;
|
|
11786
11783
|
var init_run_terminal_artifacts = __esm({
|
|
11787
11784
|
"src/run-terminal-artifacts.ts"() {
|
|
@@ -14110,8 +14107,8 @@ var init_option_definitions = __esm({
|
|
|
14110
14107
|
repeatable: false,
|
|
14111
14108
|
form: "option",
|
|
14112
14109
|
description: {
|
|
14113
|
-
en: "Required source run locator (runId@role under the book home, or path to that run directory).
|
|
14114
|
-
zh: "\u5FC5\u586B\u6E90 run \u5B9A\u4F4D\u7B26\uFF08\u7C3F\u5185 runId@role\uFF0C\u6216\u8BE5 run \u76EE\u5F55\u8DEF\u5F84\uFF09\u3002\
|
|
14110
|
+
en: "Required source run locator (runId@role under the book home, or path to that run directory). Binds the audited identity; review dialogue is the fixed Notary dispatch (verdict stays in the ledger). Missing-ticket and unreadable-status reasks keep their existing diagnostic text.",
|
|
14111
|
+
zh: "\u5FC5\u586B\u6E90 run \u5B9A\u4F4D\u7B26\uFF08\u7C3F\u5185 runId@role\uFF0C\u6216\u8BE5 run \u76EE\u5F55\u8DEF\u5F84\uFF09\u3002\u7ED1\u5B9A\u53D7\u5BA1\u8EAB\u4EFD\uFF1B\u5BA1\u7A3F\u5BF9\u8BDD\u4E3A\u7B26\u5B9D\u90CE\u56FA\u5B9A\u6D3E\u5355\u6587\uFF08\u5224\u8BCD\u7559\u5728\u5377\u5B97\u81EA\u884C\u8BFB\u53D6\uFF09\u3002\u7F3A\u7968\u53F7\u4E0E\u8BFB\u4E0D\u51FA status \u7684\u91CD\u4EA4\u4ECD\u9012\u65E2\u6709\u8BCA\u65AD\u539F\u6587\u3002"
|
|
14115
14112
|
}
|
|
14116
14113
|
}
|
|
14117
14114
|
];
|
|
@@ -14446,7 +14443,7 @@ var init_option_definitions = __esm({
|
|
|
14446
14443
|
},
|
|
14447
14444
|
notary: {
|
|
14448
14445
|
command: "notary",
|
|
14449
|
-
summary: "Direct Notary summons; duties: souls/notary.md.
|
|
14446
|
+
summary: "Direct Notary summons; duties: souls/notary.md. Review uses fixed dispatch \u2014 binds --source-run identity; does not accept caller review prompt; verdict stays in the ledger. Missing-ticket (#1171) and unreadable-status reasks deliver their existing diagnostic text on the same seat, not the review sentence.",
|
|
14450
14447
|
usage: ["ak-role notary --source-run <runId@role|path> [options]"],
|
|
14451
14448
|
examples: [
|
|
14452
14449
|
"ak-role notary --source-run 01a034f1-75bf-71a6-bcf5-d1299145b1a5@judge",
|
|
@@ -14507,7 +14504,7 @@ var init_option_definitions = __esm({
|
|
|
14507
14504
|
},
|
|
14508
14505
|
resume: {
|
|
14509
14506
|
command: "resume",
|
|
14510
|
-
summary: "Resume a role run under the live seat table (model/host/engine); session principal must still exist. Every callable seat
|
|
14507
|
+
summary: "Resume a role run under the live seat table (model/host/engine); session principal must still exist. Every callable seat accepts the optional caller message and passes it through unchanged as the continuation prompt. Notary new/direct review calls use only --source-run plus the fixed review dispatch (no caller review prompt); public manual resume still passes the caller message. Global --model/--thinking/--host/--engine must be placed before <runId> (either before `resume` or between `resume` and <runId>); the one argv after <runId> is the opaque message, not a flag position (#471).",
|
|
14511
14508
|
usage: ["ak-role resume <runId> [message]"],
|
|
14512
14509
|
examples: [
|
|
14513
14510
|
"ak-role resume 01abc\u2026",
|
|
@@ -15493,9 +15490,6 @@ function appendCallerFileFlagPaths(body, attachments, requestManifestPath, prere
|
|
|
15493
15490
|
}
|
|
15494
15491
|
function buildInstructionTransportPrompt(admitted) {
|
|
15495
15492
|
const kind = admittedTransportPromptKind(admitted);
|
|
15496
|
-
if (kind === "fixed-kickoff") {
|
|
15497
|
-
return "";
|
|
15498
|
-
}
|
|
15499
15493
|
if (kind === "baseline") {
|
|
15500
15494
|
if (admitted.baseRevision === void 0) {
|
|
15501
15495
|
throw new Error("baseline transport prompt is missing the bound revision");
|
|
@@ -19117,6 +19111,7 @@ __export(instruction_seat_run_exports, {
|
|
|
19117
19111
|
NOTARY_FIXED_DISPATCH: () => NOTARY_FIXED_DISPATCH,
|
|
19118
19112
|
buildInstructionSeatTurnRequest: () => buildInstructionSeatTurnRequest,
|
|
19119
19113
|
continueParentAfterChild: () => continueParentAfterChild,
|
|
19114
|
+
resolveReviewSeatDialogueBody: () => resolveReviewSeatDialogueBody,
|
|
19120
19115
|
runPublicInstructionSeat: () => runPublicInstructionSeat,
|
|
19121
19116
|
runPublicInstructionSeatResume: () => runPublicInstructionSeatResume
|
|
19122
19117
|
});
|
|
@@ -19187,7 +19182,8 @@ async function reaskUnreadablePostSubmissionStatus(admitted, terminal, env, io,
|
|
|
19187
19182
|
{
|
|
19188
19183
|
runId: admitted.runId,
|
|
19189
19184
|
runDirectory: admitted.runDirectory,
|
|
19190
|
-
|
|
19185
|
+
message,
|
|
19186
|
+
summons: { instructionEmpty: true }
|
|
19191
19187
|
},
|
|
19192
19188
|
next,
|
|
19193
19189
|
io
|
|
@@ -19214,7 +19210,8 @@ async function reaskMissingTicketOnce(admitted, terminal, env, io) {
|
|
|
19214
19210
|
{
|
|
19215
19211
|
runId: admitted.runId,
|
|
19216
19212
|
runDirectory: admitted.runDirectory,
|
|
19217
|
-
|
|
19213
|
+
message: instruction,
|
|
19214
|
+
summons: { instructionEmpty: true }
|
|
19218
19215
|
},
|
|
19219
19216
|
softReaskEnv,
|
|
19220
19217
|
io
|
|
@@ -19327,26 +19324,26 @@ async function loadLedgerPeerBody(sourceRunDirectory, projectRoot, home) {
|
|
|
19327
19324
|
return readableGateItem(latest.accepted);
|
|
19328
19325
|
}
|
|
19329
19326
|
async function resolveReviewSeatDialogueBody(input) {
|
|
19330
|
-
|
|
19331
|
-
|
|
19327
|
+
if (input.role === "notary") {
|
|
19328
|
+
if (input.reviewReask !== void 0) return input.reviewReask;
|
|
19329
|
+
return NOTARY_FIXED_DISPATCH;
|
|
19330
|
+
}
|
|
19331
|
+
const preferred = input.reviewReask ?? input.gateReviewInstruction;
|
|
19332
|
+
if (preferred !== void 0 && preferred.length > 0) return preferred;
|
|
19332
19333
|
const caller = input.callerInstruction ?? "";
|
|
19333
19334
|
if (caller.length > 0) return caller;
|
|
19334
19335
|
const sourceRunPath = admittedSourceRunPath(input)?.trim();
|
|
19335
19336
|
if (sourceRunPath === void 0) return void 0;
|
|
19336
|
-
if (input.role === "notary") {
|
|
19337
|
-
const { isTicketCourtCountersignSource: isTicketCourtCountersignSource2 } = await Promise.resolve().then(() => (init_run_terminal_artifacts(), run_terminal_artifacts_exports));
|
|
19338
|
-
if (isTicketCourtCountersignSource2(sourceRunPath)) return NOTARY_FIXED_DISPATCH;
|
|
19339
|
-
}
|
|
19340
19337
|
return await loadLedgerPeerBody(sourceRunPath, input.projectRoot, input.home);
|
|
19341
19338
|
}
|
|
19342
19339
|
async function resolveInitialPrompt(admitted, env) {
|
|
19343
19340
|
const record = roleRecord(admitted.role);
|
|
19344
19341
|
if ("reaskPrompt" in record && record.reaskPrompt === true) {
|
|
19345
19342
|
const sourceRunPath = admittedSourceRunPath(admitted);
|
|
19346
|
-
const reask = env.reviewReask ?? env.gateReviewInstruction;
|
|
19347
19343
|
const body = await resolveReviewSeatDialogueBody({
|
|
19348
19344
|
role: admitted.role,
|
|
19349
|
-
...
|
|
19345
|
+
...env.reviewReask === void 0 ? {} : { reviewReask: env.reviewReask },
|
|
19346
|
+
...env.gateReviewInstruction === void 0 ? {} : { gateReviewInstruction: env.gateReviewInstruction },
|
|
19350
19347
|
callerInstruction: admitted.instruction,
|
|
19351
19348
|
...sourceRunPath === void 0 ? {} : { sourceRunPath },
|
|
19352
19349
|
projectRoot: admitted.projectRoot,
|
|
@@ -19454,7 +19451,7 @@ async function dispatchAdmitted(admitted, env, io) {
|
|
|
19454
19451
|
admitted,
|
|
19455
19452
|
roleTurnOptions(activeEnv, admitted, {
|
|
19456
19453
|
kind: "resume",
|
|
19457
|
-
prompt:
|
|
19454
|
+
prompt: initialPromptText
|
|
19458
19455
|
})
|
|
19459
19456
|
),
|
|
19460
19457
|
adapters,
|
|
@@ -19554,22 +19551,26 @@ function resumeSameParentInstructionSeat(input) {
|
|
|
19554
19551
|
...input.ticketNumber === void 0 ? {} : { ticketNumber: input.ticketNumber },
|
|
19555
19552
|
freshSummons: input.env.freshSummons,
|
|
19556
19553
|
summons: input.summons,
|
|
19557
|
-
resume: (runId, materials, runDirectory) =>
|
|
19558
|
-
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19563
|
-
|
|
19564
|
-
|
|
19565
|
-
|
|
19554
|
+
resume: (runId, materials, runDirectory) => {
|
|
19555
|
+
const reask = input.env.reviewReask;
|
|
19556
|
+
return runPublicInstructionSeatResume(
|
|
19557
|
+
{
|
|
19558
|
+
runId,
|
|
19559
|
+
runDirectory,
|
|
19560
|
+
...reask === void 0 ? {} : { message: reask },
|
|
19561
|
+
...materials === void 0 ? {} : { summons: materials }
|
|
19562
|
+
},
|
|
19563
|
+
input.env,
|
|
19564
|
+
input.io
|
|
19565
|
+
);
|
|
19566
|
+
}
|
|
19566
19567
|
});
|
|
19567
19568
|
}
|
|
19568
19569
|
async function sameParentDialogue(env, fallback, sourceRunPath, projectRoot, role) {
|
|
19569
|
-
const reask = env.reviewReask ?? env.gateReviewInstruction;
|
|
19570
19570
|
const body = await resolveReviewSeatDialogueBody({
|
|
19571
19571
|
role,
|
|
19572
|
-
...
|
|
19572
|
+
...env.reviewReask === void 0 ? {} : { reviewReask: env.reviewReask },
|
|
19573
|
+
...env.gateReviewInstruction === void 0 ? {} : { gateReviewInstruction: env.gateReviewInstruction },
|
|
19573
19574
|
callerInstruction: fallback.instruction,
|
|
19574
19575
|
sourceRunPath,
|
|
19575
19576
|
projectRoot,
|
|
@@ -19581,20 +19582,30 @@ async function sameParentDialogue(env, fallback, sourceRunPath, projectRoot, rol
|
|
|
19581
19582
|
return fallback;
|
|
19582
19583
|
}
|
|
19583
19584
|
async function runCountersignBody(parsed, env, io) {
|
|
19585
|
+
const projectRoot = resolve11(parsed.project ?? env.cwd);
|
|
19584
19586
|
const gateParentRunPath = typeof env.parentRunPath === "string" && env.parentRunPath.trim() !== "" ? env.parentRunPath : void 0;
|
|
19585
19587
|
if (gateParentRunPath !== void 0) {
|
|
19586
|
-
const
|
|
19588
|
+
const dialogue = await sameParentDialogue(
|
|
19589
|
+
env,
|
|
19590
|
+
{
|
|
19591
|
+
instruction: parsed.instruction ?? "",
|
|
19592
|
+
instructionEmpty: (parsed.instruction ?? "").length === 0
|
|
19593
|
+
},
|
|
19594
|
+
gateParentRunPath,
|
|
19595
|
+
projectRoot,
|
|
19596
|
+
"countersign"
|
|
19597
|
+
);
|
|
19587
19598
|
const resumed = await resumeSameParentInstructionSeat({
|
|
19588
19599
|
env,
|
|
19589
19600
|
io,
|
|
19590
|
-
projectRoot
|
|
19601
|
+
projectRoot,
|
|
19591
19602
|
role: "countersign",
|
|
19592
19603
|
parentRunPath: gateParentRunPath,
|
|
19593
19604
|
...isSafePositiveTicketNumber(env.boundTicketNumber) ? { ticketNumber: env.boundTicketNumber } : {},
|
|
19594
19605
|
summons: {
|
|
19595
19606
|
sourceRunPath: gateParentRunPath,
|
|
19596
|
-
instruction:
|
|
19597
|
-
instructionEmpty:
|
|
19607
|
+
instruction: dialogue.instruction,
|
|
19608
|
+
instructionEmpty: dialogue.instructionEmpty,
|
|
19598
19609
|
// #1166 J11: same-parent resume delivers this call's file-flag paths
|
|
19599
19610
|
// through the shared summons → appendCallerFileFlagPaths rule.
|
|
19600
19611
|
attachmentPaths: parsed.attachmentPaths ?? []
|
|
@@ -19629,10 +19640,9 @@ async function runCountersignBody(parsed, env, io) {
|
|
|
19629
19640
|
await persistAdmittedSourceRunPath(admitted, gateParentRunPath);
|
|
19630
19641
|
admitted = { ...admitted, sourceRunPath: gateParentRunPath };
|
|
19631
19642
|
}
|
|
19632
|
-
const reviewBody = env.reviewReask ?? env.gateReviewInstruction;
|
|
19633
19643
|
const turnProjection = roleTurnOptions(env, admitted, {
|
|
19634
19644
|
kind: "initial",
|
|
19635
|
-
prompt:
|
|
19645
|
+
prompt: await resolveInitialPrompt(admitted, env)
|
|
19636
19646
|
});
|
|
19637
19647
|
const turnRequest = buildInstructionSeatTurnRequest(admitted, turnProjection);
|
|
19638
19648
|
const result = await runPostAdmissionOneShot({
|
|
@@ -19843,6 +19853,7 @@ async function runPublicInstructionSeat(argv2, env, io, role, parseArgv2) {
|
|
|
19843
19853
|
await persistAdmittedSourceRunPath(admitted, auditorSource, auditorSubject);
|
|
19844
19854
|
admitted = { ...admitted, sourceRunPath: auditorSource };
|
|
19845
19855
|
}
|
|
19856
|
+
admitted = await inheritKnownTicketFromSource(admitted, env.principalAuthority);
|
|
19846
19857
|
const runAdmitted = async () => {
|
|
19847
19858
|
await markRunAdmitted(admitted, env.principalAuthority);
|
|
19848
19859
|
if (role === "secretariat") {
|
|
@@ -19905,6 +19916,16 @@ async function runPublicInstructionSeat(argv2, env, io, role, parseArgv2) {
|
|
|
19905
19916
|
}
|
|
19906
19917
|
return runAdmitted();
|
|
19907
19918
|
}
|
|
19919
|
+
async function inheritKnownTicketFromSource(admitted, authority) {
|
|
19920
|
+
if (admitted.ticketNumber !== void 0) return admitted;
|
|
19921
|
+
const sourcePath = admittedSourceRunPath(admitted);
|
|
19922
|
+
if (sourcePath === void 0) return admitted;
|
|
19923
|
+
const sourceTicket = await readBoardTicketNumber(sourcePath);
|
|
19924
|
+
if (sourceTicket === void 0) return admitted;
|
|
19925
|
+
await bindAdmittedTicketNumber(admitted, sourceTicket);
|
|
19926
|
+
await relocateAdmittedRunToTicket(admitted, authority);
|
|
19927
|
+
return admitted;
|
|
19928
|
+
}
|
|
19908
19929
|
async function runPublicInstructionSeatResume(request, env, io) {
|
|
19909
19930
|
let selectedRequest = request;
|
|
19910
19931
|
const resume = async () => {
|
|
@@ -19924,26 +19945,45 @@ async function runPublicInstructionSeatResume(request, env, io) {
|
|
|
19924
19945
|
env.principalAuthority,
|
|
19925
19946
|
effective.runDirectory === void 0 ? void 0 : { runDirectory: effective.runDirectory }
|
|
19926
19947
|
);
|
|
19927
|
-
|
|
19928
|
-
|
|
19929
|
-
|
|
19930
|
-
admitted
|
|
19931
|
-
|
|
19932
|
-
|
|
19933
|
-
sourceRun: effective.summons.sourceRun
|
|
19934
|
-
}
|
|
19948
|
+
let admitted = loaded.admitted;
|
|
19949
|
+
if (packagedRebindSourceOnResume(admitted.role) && effective.summons?.sourceRunPath !== void 0 && effective.summons.sourceRun !== void 0) {
|
|
19950
|
+
admitted = {
|
|
19951
|
+
...admitted,
|
|
19952
|
+
sourceRunPath: effective.summons.sourceRunPath,
|
|
19953
|
+
sourceRun: effective.summons.sourceRun
|
|
19935
19954
|
};
|
|
19936
19955
|
}
|
|
19937
|
-
|
|
19956
|
+
admitted = await inheritKnownTicketFromSource(admitted, env.principalAuthority);
|
|
19957
|
+
return { ...loaded, admitted };
|
|
19938
19958
|
},
|
|
19939
19959
|
buildTurnRequest: async (admitted, effective) => {
|
|
19940
19960
|
const summonsPrepared = await prepareSummonsResumeMaterials(admitted.runDirectory, effective.summons);
|
|
19941
|
-
|
|
19961
|
+
const projection = resumeTurnRequestProjectionOptions(
|
|
19942
19962
|
admitted,
|
|
19943
|
-
|
|
19944
|
-
|
|
19945
|
-
|
|
19963
|
+
effective,
|
|
19964
|
+
env,
|
|
19965
|
+
summonsPrepared
|
|
19946
19966
|
);
|
|
19967
|
+
if (effective.summons === void 0 || effective.message !== void 0) {
|
|
19968
|
+
return buildInstructionSeatTurnRequest(admitted, { ...projection });
|
|
19969
|
+
}
|
|
19970
|
+
const sourceRunPath = admittedSourceRunPath(admitted);
|
|
19971
|
+
const body = await resolveReviewSeatDialogueBody({
|
|
19972
|
+
role: admitted.role,
|
|
19973
|
+
callerInstruction: summonsPrepared?.instruction ?? "",
|
|
19974
|
+
...sourceRunPath === void 0 ? {} : { sourceRunPath },
|
|
19975
|
+
projectRoot: admitted.projectRoot,
|
|
19976
|
+
home: env.home
|
|
19977
|
+
});
|
|
19978
|
+
if (body === void 0) {
|
|
19979
|
+
return buildInstructionSeatTurnRequest(admitted, { ...projection });
|
|
19980
|
+
}
|
|
19981
|
+
const fileFlags = summonsPrepared?.attachments ?? [];
|
|
19982
|
+
const prompt = fileFlags.length === 0 ? body : appendCallerFileFlagPaths(body, fileFlags);
|
|
19983
|
+
return buildInstructionSeatTurnRequest(admitted, {
|
|
19984
|
+
...projection,
|
|
19985
|
+
continuation: { kind: "resume", prompt }
|
|
19986
|
+
});
|
|
19947
19987
|
},
|
|
19948
19988
|
adapters: {
|
|
19949
19989
|
trySettle: async () => void 0
|
|
@@ -20138,7 +20178,8 @@ async function auditSubmittedRole(turn, env, io, resumedOfficer, passedReceipt)
|
|
|
20138
20178
|
return runPublicInstructionSeatResume({
|
|
20139
20179
|
runId: admitted.runId,
|
|
20140
20180
|
runDirectory: admitted.runDirectory,
|
|
20141
|
-
|
|
20181
|
+
message: SECRETARIAT_STATUS_REASK,
|
|
20182
|
+
summons: { instructionEmpty: true }
|
|
20142
20183
|
}, next, io);
|
|
20143
20184
|
}
|
|
20144
20185
|
if (admitted.role === "countersign" && (typeof status !== "string" || !REVIEW_QUEUE_STATUSES.has(status))) {
|
|
@@ -20152,7 +20193,8 @@ async function auditSubmittedRole(turn, env, io, resumedOfficer, passedReceipt)
|
|
|
20152
20193
|
return runPublicInstructionSeatResume({
|
|
20153
20194
|
runId: admitted.runId,
|
|
20154
20195
|
runDirectory: admitted.runDirectory,
|
|
20155
|
-
|
|
20196
|
+
message: officerConclusionReask(status),
|
|
20197
|
+
summons: { instructionEmpty: true }
|
|
20156
20198
|
}, next, io);
|
|
20157
20199
|
}
|
|
20158
20200
|
const selfEscalationSkipsAudit = status === "escalate" && (admitted.role === "judge" || admitted.role === "secretariat" || admitted.role === "countersign");
|
|
@@ -20407,6 +20449,20 @@ var init_instruction_seat_run = __esm({
|
|
|
20407
20449
|
judge: {
|
|
20408
20450
|
statuses: REVIEW_QUEUE_STATUSES
|
|
20409
20451
|
},
|
|
20452
|
+
// #1208 C1 / ADR 0055: every review-queue seat uses the shared
|
|
20453
|
+
// unreadable-status seam (officerConclusionReask). Independent public
|
|
20454
|
+
// entry for notary/auditor/inspector was the same miss — route here, do
|
|
20455
|
+
// not invent a parallel loop. Gate summons still own the outer budget
|
|
20456
|
+
// via nestedIncomplete when this seat exhausts unsettled.
|
|
20457
|
+
notary: {
|
|
20458
|
+
statuses: REVIEW_QUEUE_STATUSES
|
|
20459
|
+
},
|
|
20460
|
+
auditor: {
|
|
20461
|
+
statuses: REVIEW_QUEUE_STATUSES
|
|
20462
|
+
},
|
|
20463
|
+
inspector: {
|
|
20464
|
+
statuses: REVIEW_QUEUE_STATUSES
|
|
20465
|
+
},
|
|
20410
20466
|
coder: {
|
|
20411
20467
|
statuses: WORKER_ROUTING_STATUSES,
|
|
20412
20468
|
reask: WORKER_STATUS_REASK
|
|
@@ -20790,13 +20846,9 @@ async function summonGateOfficer(options) {
|
|
|
20790
20846
|
home = homeFromRunDirectory2(options.sourceRunDirectory);
|
|
20791
20847
|
}
|
|
20792
20848
|
let gateReviewInstruction;
|
|
20793
|
-
if (options.reask === void 0 && options.submission !== void 0) {
|
|
20794
|
-
const {
|
|
20795
|
-
|
|
20796
|
-
if (!blindTicketCourt) {
|
|
20797
|
-
const { readableGateItem: readableGateItem2 } = await Promise.resolve().then(() => (init_readable_gate_item(), readable_gate_item_exports));
|
|
20798
|
-
gateReviewInstruction = readableGateItem2(options.submission);
|
|
20799
|
-
}
|
|
20849
|
+
if (options.reask === void 0 && options.submission !== void 0 && options.officer !== "notary") {
|
|
20850
|
+
const { readableGateItem: readableGateItem2 } = await Promise.resolve().then(() => (init_readable_gate_item(), readable_gate_item_exports));
|
|
20851
|
+
gateReviewInstruction = readableGateItem2(options.submission);
|
|
20800
20852
|
}
|
|
20801
20853
|
const { runIdFromRunDirectory: runIdFromRunDirectory2 } = await Promise.resolve().then(() => (init_run_terminal_artifacts(), run_terminal_artifacts_exports));
|
|
20802
20854
|
const parentRunId = runIdFromRunDirectory2(options.sourceRunDirectory);
|
|
@@ -20847,7 +20899,14 @@ async function summonGateOfficer(options) {
|
|
|
20847
20899
|
const parentTicket = await readBoardTicketNumber2(options.sourceRunDirectory);
|
|
20848
20900
|
const submittedTicket = isRecord(options.submission) ? options.submission.ticketNumber : void 0;
|
|
20849
20901
|
const courtTicket = isSafePositiveTicketNumber3(submittedTicket) ? submittedTicket : parentTicket;
|
|
20850
|
-
const
|
|
20902
|
+
const { resolveReviewSeatDialogueBody: resolveReviewSeatDialogueBody2 } = await Promise.resolve().then(() => (init_instruction_seat_run(), instruction_seat_run_exports));
|
|
20903
|
+
const instruction = await resolveReviewSeatDialogueBody2({
|
|
20904
|
+
role: options.officer,
|
|
20905
|
+
...options.reask === void 0 ? {} : { reviewReask: options.reask },
|
|
20906
|
+
...gateReviewInstruction === void 0 ? {} : { gateReviewInstruction },
|
|
20907
|
+
projectRoot: options.cwd,
|
|
20908
|
+
home
|
|
20909
|
+
}) ?? "";
|
|
20851
20910
|
return summonPublicRole({
|
|
20852
20911
|
role: options.officer,
|
|
20853
20912
|
argv: ["--project", options.cwd, "--", instruction],
|
|
@@ -21052,11 +21111,9 @@ var init_role_run_relocation = __esm({
|
|
|
21052
21111
|
var run_lifecycle_exports = {};
|
|
21053
21112
|
__export(run_lifecycle_exports, {
|
|
21054
21113
|
AUTO_RESUME_LIMIT: () => AUTO_RESUME_LIMIT,
|
|
21055
|
-
RESUME_TRANSPORT_ENVELOPE: () => RESUME_TRANSPORT_ENVELOPE,
|
|
21056
21114
|
RunWriterLeaseHeldError: () => RunWriterLeaseHeldError,
|
|
21057
21115
|
acquireRunWriterLease: () => acquireRunWriterLease,
|
|
21058
21116
|
autopsyWriterLock: () => autopsyWriterLock,
|
|
21059
|
-
buildAutoResumeContinuationPrompt: () => buildAutoResumeContinuationPrompt,
|
|
21060
21117
|
clearCurrentCourt: () => clearCurrentCourt,
|
|
21061
21118
|
describeErrorIdentity: () => describeErrorIdentity,
|
|
21062
21119
|
findLatestRunForSeatTicket: () => findLatestRunForSeatTicket,
|
|
@@ -21078,9 +21135,6 @@ __export(run_lifecycle_exports, {
|
|
|
21078
21135
|
import { existsSync as existsSync10 } from "node:fs";
|
|
21079
21136
|
import { chmod, lstat as lstat3, open, readdir as readdir3, readFile as readFile10, unlink } from "node:fs/promises";
|
|
21080
21137
|
import { basename as basename10, join as join22 } from "node:path";
|
|
21081
|
-
function buildAutoResumeContinuationPrompt() {
|
|
21082
|
-
return RESUME_TRANSPORT_ENVELOPE;
|
|
21083
|
-
}
|
|
21084
21138
|
async function writeRoleRunState(runDirectory, record) {
|
|
21085
21139
|
const payload = { ...record, runDirectory };
|
|
21086
21140
|
writeSectionSync(runDirectory, "runState", { ...payload });
|
|
@@ -22011,7 +22065,7 @@ function resumedWorkerPhase(phase, phases, role, runId) {
|
|
|
22011
22065
|
}
|
|
22012
22066
|
throw new CliUsageError(`role run admitted ${role} phase is missing: ${runId}`);
|
|
22013
22067
|
}
|
|
22014
|
-
var AUTO_RESUME_LIMIT,
|
|
22068
|
+
var AUTO_RESUME_LIMIT, WRITER_LOCK_FILE, RunWriterLeaseHeldError, WRITER_LEASE_RECLAIM_ROUNDS;
|
|
22015
22069
|
var init_run_lifecycle = __esm({
|
|
22016
22070
|
"src/public-cli/run-lifecycle.ts"() {
|
|
22017
22071
|
"use strict";
|
|
@@ -22026,7 +22080,6 @@ var init_run_lifecycle = __esm({
|
|
|
22026
22080
|
init_run_dossier();
|
|
22027
22081
|
init_unknown_value();
|
|
22028
22082
|
AUTO_RESUME_LIMIT = 2;
|
|
22029
|
-
RESUME_TRANSPORT_ENVELOPE = "\u7EE7\u7EED\u3002";
|
|
22030
22083
|
WRITER_LOCK_FILE = "writer.lock";
|
|
22031
22084
|
RunWriterLeaseHeldError = class extends Error {
|
|
22032
22085
|
code = "AK_RUN_WRITER_LEASE_HELD";
|
|
@@ -22341,10 +22394,7 @@ function buildReceiptDeliveryRequest(input) {
|
|
|
22341
22394
|
...request,
|
|
22342
22395
|
continuation: {
|
|
22343
22396
|
kind: "resume",
|
|
22344
|
-
prompt:
|
|
22345
|
-
...receiptDelivery.deliveryState(),
|
|
22346
|
-
deliveryTurns: receiptDelivery.issuedDeliveryRequests() + 1
|
|
22347
|
-
})
|
|
22397
|
+
prompt: request.continuation.prompt
|
|
22348
22398
|
},
|
|
22349
22399
|
deliveryRequestLimit: receiptDelivery.limit
|
|
22350
22400
|
};
|
|
@@ -23107,7 +23157,7 @@ async function runPostAdmissionSeatResume(input) {
|
|
|
23107
23157
|
...firstTurn,
|
|
23108
23158
|
continuation: {
|
|
23109
23159
|
kind: "resume",
|
|
23110
|
-
prompt:
|
|
23160
|
+
prompt: firstTurn.continuation.prompt
|
|
23111
23161
|
}
|
|
23112
23162
|
};
|
|
23113
23163
|
}
|
|
@@ -23226,7 +23276,7 @@ async function runPostAdmissionOneShot(input) {
|
|
|
23226
23276
|
...input.request,
|
|
23227
23277
|
continuation: {
|
|
23228
23278
|
kind: "resume",
|
|
23229
|
-
prompt:
|
|
23279
|
+
prompt: input.request.continuation.prompt
|
|
23230
23280
|
}
|
|
23231
23281
|
}),
|
|
23232
23282
|
adapters: input.adapters,
|
|
@@ -509,8 +509,8 @@ const NOTARY_OPTIONS = [
|
|
|
509
509
|
repeatable: false,
|
|
510
510
|
form: "option",
|
|
511
511
|
description: {
|
|
512
|
-
en: "Required source run locator (runId@role under the book home, or path to that run directory).
|
|
513
|
-
zh: "必填源 run 定位符(簿内 runId@role,或该 run
|
|
512
|
+
en: "Required source run locator (runId@role under the book home, or path to that run directory). Binds the audited identity; review dialogue is the fixed Notary dispatch (verdict stays in the ledger). Missing-ticket and unreadable-status reasks keep their existing diagnostic text.",
|
|
513
|
+
zh: "必填源 run 定位符(簿内 runId@role,或该 run 目录路径)。绑定受审身份;审稿对话为符宝郎固定派单文(判词留在卷宗自行读取)。缺票号与读不出 status 的重交仍递既有诊断原文。",
|
|
514
514
|
},
|
|
515
515
|
},
|
|
516
516
|
];
|
|
@@ -1040,7 +1040,7 @@ const ROLE_COMMAND_HELP = {
|
|
|
1040
1040
|
},
|
|
1041
1041
|
notary: {
|
|
1042
1042
|
command: "notary",
|
|
1043
|
-
summary: "Direct Notary summons; duties: souls/notary.md.
|
|
1043
|
+
summary: "Direct Notary summons; duties: souls/notary.md. Review uses fixed dispatch — binds --source-run identity; does not accept caller review prompt; verdict stays in the ledger. Missing-ticket (#1171) and unreadable-status reasks deliver their existing diagnostic text on the same seat, not the review sentence.",
|
|
1044
1044
|
usage: ["ak-role notary --source-run <runId@role|path> [options]"],
|
|
1045
1045
|
examples: [
|
|
1046
1046
|
"ak-role notary --source-run 01a034f1-75bf-71a6-bcf5-d1299145b1a5@judge",
|
|
@@ -1101,7 +1101,7 @@ const SUPPORT_COMMAND_HELP = {
|
|
|
1101
1101
|
},
|
|
1102
1102
|
resume: {
|
|
1103
1103
|
command: "resume",
|
|
1104
|
-
summary: "Resume a role run under the live seat table (model/host/engine); session principal must still exist. Every callable seat
|
|
1104
|
+
summary: "Resume a role run under the live seat table (model/host/engine); session principal must still exist. Every callable seat accepts the optional caller message and passes it through unchanged as the continuation prompt. Notary new/direct review calls use only --source-run plus the fixed review dispatch (no caller review prompt); public manual resume still passes the caller message. Global --model/--thinking/--host/--engine must be placed before <runId> (either before `resume` or between `resume` and <runId>); the one argv after <runId> is the opaque message, not a flag position (#471).",
|
|
1105
1105
|
usage: ["ak-role resume <runId> [message]"],
|
|
1106
1106
|
examples: [
|
|
1107
1107
|
"ak-role resume 01abc…",
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { randomUUID } from "node:crypto";
|
|
9
9
|
import { writeFile } from "node:fs/promises";
|
|
10
|
-
import {
|
|
10
|
+
import { findRunDirectoryById, resolveLiveRunDirectoryPath, readRoleRunState, } from "./run-lifecycle.js";
|
|
11
11
|
import { CliUsageError } from "./cli-errors.js";
|
|
12
12
|
import { projectPublicTurnAxes } from "./turn-request.js";
|
|
13
13
|
import { appendCallerFileFlagPaths, bindAdmittedTicketNumber, relocateAdmittedRunToTicket, } from "./invocation.js";
|
|
@@ -394,17 +394,14 @@ function settlementScopeForTurn(request) {
|
|
|
394
394
|
};
|
|
395
395
|
}
|
|
396
396
|
/**
|
|
397
|
-
* #1132: one 没交卷催交 turn, dispatched through the SAME settlement path
|
|
398
|
-
* first turn.
|
|
397
|
+
* #1132 / #1208: one 没交卷催交 turn, dispatched through the SAME settlement path
|
|
398
|
+
* as the first turn.
|
|
399
399
|
*
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
404
|
-
*
|
|
405
|
-
* `settleCompletedHostTurn` the first turn uses (ADR 0080): the runner/host
|
|
406
|
-
* failure re-read, the shouldPresent gate, the fresh-seal check, open-court
|
|
407
|
-
* cleanup, cancel re-reads, run-state persist, and the stderr mirror.
|
|
400
|
+
* A delivery turn is an ordinary host turn on this same run/session: this builds
|
|
401
|
+
* the host-neutral resume request (the adapter's stored native session id,
|
|
402
|
+
* ADR 0082). #1208: resend this turn's actual prompt — never substitute
|
|
403
|
+
* delivery-state / run-stats JSON for dialogue. Counts, rejections, and
|
|
404
|
+
* no_receipt facts stay on receiptDelivery / lifecycle settlement.
|
|
408
405
|
*
|
|
409
406
|
* The caller owns the live delivery policy; the request projects its next send.
|
|
410
407
|
*/
|
|
@@ -415,10 +412,7 @@ function buildReceiptDeliveryRequest(input) {
|
|
|
415
412
|
...request,
|
|
416
413
|
continuation: {
|
|
417
414
|
kind: "resume",
|
|
418
|
-
prompt:
|
|
419
|
-
...receiptDelivery.deliveryState(),
|
|
420
|
-
deliveryTurns: receiptDelivery.issuedDeliveryRequests() + 1,
|
|
421
|
-
}),
|
|
415
|
+
prompt: request.continuation.prompt,
|
|
422
416
|
},
|
|
423
417
|
deliveryRequestLimit: receiptDelivery.limit,
|
|
424
418
|
};
|
|
@@ -1099,8 +1093,8 @@ export function resumeTurnRequestProjectionOptions(admitted, request, env, summo
|
|
|
1099
1093
|
: appendCallerFileFlagPaths(body, fileFlags);
|
|
1100
1094
|
}
|
|
1101
1095
|
else if (request.summons !== undefined) {
|
|
1102
|
-
//
|
|
1103
|
-
//
|
|
1096
|
+
// Same-ticket summons without prepared dialogue. Notary review fills via
|
|
1097
|
+
// resolveReviewSeatDialogueBody (#1208); other seats carry parent/caller words.
|
|
1104
1098
|
prompt = "";
|
|
1105
1099
|
}
|
|
1106
1100
|
else {
|
|
@@ -1339,21 +1333,15 @@ export async function runPostAdmissionSeatResume(input) {
|
|
|
1339
1333
|
buildInitialPayload: () => ({ resumeTurn: false }),
|
|
1340
1334
|
buildResumePayload: () => ({ resumeTurn: true }),
|
|
1341
1335
|
toRequest: async (payload) => {
|
|
1342
|
-
// #840 r8
|
|
1343
|
-
//
|
|
1344
|
-
//
|
|
1345
|
-
// host-needed resume trigger — never engine handbook material,
|
|
1346
|
-
// which would replace a 审核循环 same-ticket continuation with a bare outsourcing
|
|
1347
|
-
// 「重新读」 envelope (#755 contract, resumeTurnRequestProjectionOptions
|
|
1348
|
-
// above). RESUME_TRANSPORT_ENVELOPE is the same package-owned,
|
|
1349
|
-
// non-semantic trigger that projection already uses for a
|
|
1350
|
-
// same-ticket summons carrying no instruction/attachments.
|
|
1336
|
+
// #840 r8 / #1208: call-local retry keeps this court's frozen summons /
|
|
1337
|
+
// 交卷 body / attachments and resends the same turn prompt — never a
|
|
1338
|
+
// filler phrase or engine handbook substitute.
|
|
1351
1339
|
if (payload.resumeTurn && firstTurn !== undefined) {
|
|
1352
1340
|
return {
|
|
1353
1341
|
...firstTurn,
|
|
1354
1342
|
continuation: {
|
|
1355
1343
|
kind: "resume",
|
|
1356
|
-
prompt:
|
|
1344
|
+
prompt: firstTurn.continuation.prompt,
|
|
1357
1345
|
},
|
|
1358
1346
|
};
|
|
1359
1347
|
}
|
|
@@ -1460,6 +1448,7 @@ async function writeResumeDiagnostic(runDirectory, runId, failure, role) {
|
|
|
1460
1448
|
* entering; manual resume never re-admits.
|
|
1461
1449
|
*/
|
|
1462
1450
|
export async function runPostAdmissionOneShot(input) {
|
|
1451
|
+
// #1208: auto-resume resends this turn's actual prompt, never a filler phrase.
|
|
1463
1452
|
return await runPostAdmissionResumable({
|
|
1464
1453
|
admitted: input.admitted,
|
|
1465
1454
|
env: input.env,
|
|
@@ -1469,7 +1458,7 @@ export async function runPostAdmissionOneShot(input) {
|
|
|
1469
1458
|
...input.request,
|
|
1470
1459
|
continuation: {
|
|
1471
1460
|
kind: "resume",
|
|
1472
|
-
prompt:
|
|
1461
|
+
prompt: input.request.continuation.prompt,
|
|
1473
1462
|
},
|
|
1474
1463
|
}),
|
|
1475
1464
|
adapters: input.adapters,
|
|
@@ -23,23 +23,6 @@ import { isRecord, errorText, isEnoent } from "../unknown-value.js";
|
|
|
23
23
|
* source: runWithAutoResumeLoop receives the effective value once per call.
|
|
24
24
|
*/
|
|
25
25
|
export const AUTO_RESUME_LIMIT = 2;
|
|
26
|
-
/**
|
|
27
|
-
* Package-owned non-empty Chinese neutral resume transport (#959 / ADR 0073).
|
|
28
|
-
* Used by:
|
|
29
|
-
* - auto-resume (all seats via buildAutoResumeContinuationPrompt) — required so
|
|
30
|
-
* hosts that reject empty stdin (codex) still receive a prompt.
|
|
31
|
-
* Public manual resume forwards only the caller's bytes (#987).
|
|
32
|
-
*/
|
|
33
|
-
export const RESUME_TRANSPORT_ENVELOPE = "继续。";
|
|
34
|
-
/**
|
|
35
|
-
* Auto-resume continuation only (#959 / ADR 0080).
|
|
36
|
-
* Always non-empty Chinese neutral envelope. Engine / outsourcing material
|
|
37
|
-
* rides startup readingMaterial (#1167), never this continuation.
|
|
38
|
-
* Never call this from manual `ak-role resume`.
|
|
39
|
-
*/
|
|
40
|
-
export function buildAutoResumeContinuationPrompt() {
|
|
41
|
-
return RESUME_TRANSPORT_ENVELOPE;
|
|
42
|
-
}
|
|
43
26
|
const WRITER_LOCK_FILE = "writer.lock";
|
|
44
27
|
export async function writeRoleRunState(runDirectory, record) {
|
|
45
28
|
const payload = { ...record, runDirectory };
|
|
@@ -351,13 +351,9 @@ async function summonGateOfficer(options) {
|
|
|
351
351
|
home = homeFromRunDirectory(options.sourceRunDirectory);
|
|
352
352
|
}
|
|
353
353
|
let gateReviewInstruction;
|
|
354
|
-
if (options.reask === void 0 && options.submission !== void 0) {
|
|
355
|
-
const {
|
|
356
|
-
|
|
357
|
-
if (!blindTicketCourt) {
|
|
358
|
-
const { readableGateItem } = await import("./readable-gate-item.js");
|
|
359
|
-
gateReviewInstruction = readableGateItem(options.submission);
|
|
360
|
-
}
|
|
354
|
+
if (options.reask === void 0 && options.submission !== void 0 && options.officer !== "notary") {
|
|
355
|
+
const { readableGateItem } = await import("./readable-gate-item.js");
|
|
356
|
+
gateReviewInstruction = readableGateItem(options.submission);
|
|
361
357
|
}
|
|
362
358
|
const { runIdFromRunDirectory } = await import("./run-terminal-artifacts.js");
|
|
363
359
|
const parentRunId = runIdFromRunDirectory(options.sourceRunDirectory);
|
|
@@ -408,7 +404,14 @@ async function summonGateOfficer(options) {
|
|
|
408
404
|
const parentTicket = await readBoardTicketNumber(options.sourceRunDirectory);
|
|
409
405
|
const submittedTicket = isRecord(options.submission) ? options.submission.ticketNumber : void 0;
|
|
410
406
|
const courtTicket = isSafePositiveTicketNumber(submittedTicket) ? submittedTicket : parentTicket;
|
|
411
|
-
const
|
|
407
|
+
const { resolveReviewSeatDialogueBody } = await import("./public-cli/instruction-seat-run.js");
|
|
408
|
+
const instruction = await resolveReviewSeatDialogueBody({
|
|
409
|
+
role: options.officer,
|
|
410
|
+
...options.reask === void 0 ? {} : { reviewReask: options.reask },
|
|
411
|
+
...gateReviewInstruction === void 0 ? {} : { gateReviewInstruction },
|
|
412
|
+
projectRoot: options.cwd,
|
|
413
|
+
home
|
|
414
|
+
}) ?? "";
|
|
412
415
|
return summonPublicRole({
|
|
413
416
|
role: options.officer,
|
|
414
417
|
argv: ["--project", options.cwd, "--", instruction],
|