@akagilnc/pi-workflow-roles 0.1.5762 → 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.
@@ -2796,9 +2796,8 @@ var init_packaged_role_registry = __esm({
2796
2796
  bareCommand: false,
2797
2797
  outputTool: NOTARY_OUTPUT_TOOL_NAME,
2798
2798
  settlement: "accepted",
2799
- /** Court reask replaces the initial prompt. Otherwise the fixed kickoff. */
2799
+ /** Dialogue via shared resolveReviewSeatDialogueBody (review = fixed dispatch). */
2800
2800
  reaskPrompt: true,
2801
- transportPrompt: "fixed-kickoff",
2802
2801
  gateStageLabel: "\u7B26\u5B9D\u90CE",
2803
2802
  /** Gate summon binds --source-run and keeps dialogue off the argv. */
2804
2803
  gateSummon: "source-run",
@@ -2821,6 +2820,8 @@ var init_packaged_role_registry = __esm({
2821
2820
  phases: [null],
2822
2821
  outputTool: COUNTERSIGN_OUTPUT_TOOL_NAME,
2823
2822
  settlement: "accepted",
2823
+ /** Same shared dialogue resolver as other review seats (#1208 C1). */
2824
+ reaskPrompt: true,
2824
2825
  gateStageLabel: "\u7ED9\u4E8B\u4E2D",
2825
2826
  /** Gate summon carries the parent payload as the instruction and a parent run id. */
2826
2827
  gateSummon: "parent-instruction",
@@ -3421,7 +3422,6 @@ var run_terminal_artifacts_exports = {};
3421
3422
  __export(run_terminal_artifacts_exports, {
3422
3423
  ATTEMPT_HISTORY_IDENTITY_FIELD: () => ATTEMPT_HISTORY_IDENTITY_FIELD,
3423
3424
  TERMINAL_COURT_ATTEMPT_FIELD: () => TERMINAL_COURT_ATTEMPT_FIELD,
3424
- isTicketCourtCountersignSource: () => isTicketCourtCountersignSource,
3425
3425
  readRunTerminal: () => readRunTerminal,
3426
3426
  roleFromRunDirectory: () => roleFromRunDirectory,
3427
3427
  runIdFromRunDirectory: () => runIdFromRunDirectory,
@@ -3482,9 +3482,6 @@ function runIdFromRunDirectory(runDirectory) {
3482
3482
  function roleFromRunDirectory(runDirectory) {
3483
3483
  return parseRunLeaf(basename6(runDirectory))?.role;
3484
3484
  }
3485
- function isTicketCourtCountersignSource(runDirectory) {
3486
- return roleFromRunDirectory(runDirectory) === "countersign";
3487
- }
3488
3485
  var ATTEMPT_HISTORY_IDENTITY_FIELD, TERMINAL_COURT_ATTEMPT_FIELD;
3489
3486
  var init_run_terminal_artifacts = __esm({
3490
3487
  "src/run-terminal-artifacts.ts"() {
@@ -6077,8 +6074,8 @@ var init_option_definitions = __esm({
6077
6074
  repeatable: false,
6078
6075
  form: "option",
6079
6076
  description: {
6080
- en: "Required source run locator (runId@role under the book home, or path to that run directory). Zero prompt/attachment projection.",
6081
- zh: "\u5FC5\u586B\u6E90 run \u5B9A\u4F4D\u7B26\uFF08\u7C3F\u5185 runId@role\uFF0C\u6216\u8BE5 run \u76EE\u5F55\u8DEF\u5F84\uFF09\u3002\u96F6 prompt/\u9644\u4EF6\u6295\u5F71\u3002"
6077
+ 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.",
6078
+ 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"
6082
6079
  }
6083
6080
  }
6084
6081
  ];
@@ -6413,7 +6410,7 @@ var init_option_definitions = __esm({
6413
6410
  },
6414
6411
  notary: {
6415
6412
  command: "notary",
6416
- summary: "Direct Notary summons; duties: souls/notary.md. Zero prompt/attachment.",
6413
+ 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.",
6417
6414
  usage: ["ak-role notary --source-run <runId@role|path> [options]"],
6418
6415
  examples: [
6419
6416
  "ak-role notary --source-run 01a034f1-75bf-71a6-bcf5-d1299145b1a5@judge",
@@ -6474,7 +6471,7 @@ var init_option_definitions = __esm({
6474
6471
  },
6475
6472
  resume: {
6476
6473
  command: "resume",
6477
- summary: "Resume a role run under the live seat table (model/host/engine); session principal must still exist. Every callable seat, including Notary/\u7B26\u5B9D\u90CE, accepts the optional caller message and passes it through unchanged as the continuation prompt. Notary explicit new still accepts only its source-run locator, not a caller prompt. 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).",
6474
+ 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).",
6478
6475
  usage: ["ak-role resume <runId> [message]"],
6479
6476
  examples: [
6480
6477
  "ak-role resume 01abc\u2026",
@@ -7460,9 +7457,6 @@ function appendCallerFileFlagPaths(body, attachments, requestManifestPath, prere
7460
7457
  }
7461
7458
  function buildInstructionTransportPrompt(admitted) {
7462
7459
  const kind = admittedTransportPromptKind(admitted);
7463
- if (kind === "fixed-kickoff") {
7464
- return "";
7465
- }
7466
7460
  if (kind === "baseline") {
7467
7461
  if (admitted.baseRevision === void 0) {
7468
7462
  throw new Error("baseline transport prompt is missing the bound revision");
@@ -12861,10 +12855,7 @@ function buildReceiptDeliveryRequest(input) {
12861
12855
  ...request,
12862
12856
  continuation: {
12863
12857
  kind: "resume",
12864
- prompt: JSON.stringify({
12865
- ...receiptDelivery.deliveryState(),
12866
- deliveryTurns: receiptDelivery.issuedDeliveryRequests() + 1
12867
- })
12858
+ prompt: request.continuation.prompt
12868
12859
  },
12869
12860
  deliveryRequestLimit: receiptDelivery.limit
12870
12861
  };
@@ -13627,7 +13618,7 @@ async function runPostAdmissionSeatResume(input) {
13627
13618
  ...firstTurn,
13628
13619
  continuation: {
13629
13620
  kind: "resume",
13630
- prompt: RESUME_TRANSPORT_ENVELOPE
13621
+ prompt: firstTurn.continuation.prompt
13631
13622
  }
13632
13623
  };
13633
13624
  }
@@ -13746,7 +13737,7 @@ async function runPostAdmissionOneShot(input) {
13746
13737
  ...input.request,
13747
13738
  continuation: {
13748
13739
  kind: "resume",
13749
- prompt: buildAutoResumeContinuationPrompt()
13740
+ prompt: input.request.continuation.prompt
13750
13741
  }
13751
13742
  }),
13752
13743
  adapters: input.adapters,
@@ -13967,6 +13958,7 @@ __export(instruction_seat_run_exports, {
13967
13958
  NOTARY_FIXED_DISPATCH: () => NOTARY_FIXED_DISPATCH,
13968
13959
  buildInstructionSeatTurnRequest: () => buildInstructionSeatTurnRequest,
13969
13960
  continueParentAfterChild: () => continueParentAfterChild,
13961
+ resolveReviewSeatDialogueBody: () => resolveReviewSeatDialogueBody,
13970
13962
  runPublicInstructionSeat: () => runPublicInstructionSeat,
13971
13963
  runPublicInstructionSeatResume: () => runPublicInstructionSeatResume
13972
13964
  });
@@ -14037,7 +14029,8 @@ async function reaskUnreadablePostSubmissionStatus(admitted, terminal, env, io,
14037
14029
  {
14038
14030
  runId: admitted.runId,
14039
14031
  runDirectory: admitted.runDirectory,
14040
- summons: { instruction: message }
14032
+ message,
14033
+ summons: { instructionEmpty: true }
14041
14034
  },
14042
14035
  next,
14043
14036
  io
@@ -14064,7 +14057,8 @@ async function reaskMissingTicketOnce(admitted, terminal, env, io) {
14064
14057
  {
14065
14058
  runId: admitted.runId,
14066
14059
  runDirectory: admitted.runDirectory,
14067
- summons: { instruction }
14060
+ message: instruction,
14061
+ summons: { instructionEmpty: true }
14068
14062
  },
14069
14063
  softReaskEnv,
14070
14064
  io
@@ -14177,26 +14171,26 @@ async function loadLedgerPeerBody(sourceRunDirectory, projectRoot, home) {
14177
14171
  return readableGateItem(latest.accepted);
14178
14172
  }
14179
14173
  async function resolveReviewSeatDialogueBody(input) {
14180
- const reask = input.reask;
14181
- if (reask !== void 0 && reask.length > 0) return reask;
14174
+ if (input.role === "notary") {
14175
+ if (input.reviewReask !== void 0) return input.reviewReask;
14176
+ return NOTARY_FIXED_DISPATCH;
14177
+ }
14178
+ const preferred = input.reviewReask ?? input.gateReviewInstruction;
14179
+ if (preferred !== void 0 && preferred.length > 0) return preferred;
14182
14180
  const caller = input.callerInstruction ?? "";
14183
14181
  if (caller.length > 0) return caller;
14184
14182
  const sourceRunPath = admittedSourceRunPath(input)?.trim();
14185
14183
  if (sourceRunPath === void 0) return void 0;
14186
- if (input.role === "notary") {
14187
- const { isTicketCourtCountersignSource: isTicketCourtCountersignSource2 } = await Promise.resolve().then(() => (init_run_terminal_artifacts(), run_terminal_artifacts_exports));
14188
- if (isTicketCourtCountersignSource2(sourceRunPath)) return NOTARY_FIXED_DISPATCH;
14189
- }
14190
14184
  return await loadLedgerPeerBody(sourceRunPath, input.projectRoot, input.home);
14191
14185
  }
14192
14186
  async function resolveInitialPrompt(admitted, env) {
14193
14187
  const record = roleRecord(admitted.role);
14194
14188
  if ("reaskPrompt" in record && record.reaskPrompt === true) {
14195
14189
  const sourceRunPath = admittedSourceRunPath(admitted);
14196
- const reask = env.reviewReask ?? env.gateReviewInstruction;
14197
14190
  const body = await resolveReviewSeatDialogueBody({
14198
14191
  role: admitted.role,
14199
- ...reask === void 0 ? {} : { reask },
14192
+ ...env.reviewReask === void 0 ? {} : { reviewReask: env.reviewReask },
14193
+ ...env.gateReviewInstruction === void 0 ? {} : { gateReviewInstruction: env.gateReviewInstruction },
14200
14194
  callerInstruction: admitted.instruction,
14201
14195
  ...sourceRunPath === void 0 ? {} : { sourceRunPath },
14202
14196
  projectRoot: admitted.projectRoot,
@@ -14304,7 +14298,7 @@ async function dispatchAdmitted(admitted, env, io) {
14304
14298
  admitted,
14305
14299
  roleTurnOptions(activeEnv, admitted, {
14306
14300
  kind: "resume",
14307
- prompt: buildAutoResumeContinuationPrompt()
14301
+ prompt: initialPromptText
14308
14302
  })
14309
14303
  ),
14310
14304
  adapters,
@@ -14404,22 +14398,26 @@ function resumeSameParentInstructionSeat(input) {
14404
14398
  ...input.ticketNumber === void 0 ? {} : { ticketNumber: input.ticketNumber },
14405
14399
  freshSummons: input.env.freshSummons,
14406
14400
  summons: input.summons,
14407
- resume: (runId, materials, runDirectory) => runPublicInstructionSeatResume(
14408
- {
14409
- runId,
14410
- runDirectory,
14411
- ...materials === void 0 ? {} : { summons: materials }
14412
- },
14413
- input.env,
14414
- input.io
14415
- )
14401
+ resume: (runId, materials, runDirectory) => {
14402
+ const reask = input.env.reviewReask;
14403
+ return runPublicInstructionSeatResume(
14404
+ {
14405
+ runId,
14406
+ runDirectory,
14407
+ ...reask === void 0 ? {} : { message: reask },
14408
+ ...materials === void 0 ? {} : { summons: materials }
14409
+ },
14410
+ input.env,
14411
+ input.io
14412
+ );
14413
+ }
14416
14414
  });
14417
14415
  }
14418
14416
  async function sameParentDialogue(env, fallback, sourceRunPath, projectRoot, role) {
14419
- const reask = env.reviewReask ?? env.gateReviewInstruction;
14420
14417
  const body = await resolveReviewSeatDialogueBody({
14421
14418
  role,
14422
- ...reask === void 0 ? {} : { reask },
14419
+ ...env.reviewReask === void 0 ? {} : { reviewReask: env.reviewReask },
14420
+ ...env.gateReviewInstruction === void 0 ? {} : { gateReviewInstruction: env.gateReviewInstruction },
14423
14421
  callerInstruction: fallback.instruction,
14424
14422
  sourceRunPath,
14425
14423
  projectRoot,
@@ -14431,20 +14429,30 @@ async function sameParentDialogue(env, fallback, sourceRunPath, projectRoot, rol
14431
14429
  return fallback;
14432
14430
  }
14433
14431
  async function runCountersignBody(parsed, env, io) {
14432
+ const projectRoot = resolve12(parsed.project ?? env.cwd);
14434
14433
  const gateParentRunPath = typeof env.parentRunPath === "string" && env.parentRunPath.trim() !== "" ? env.parentRunPath : void 0;
14435
14434
  if (gateParentRunPath !== void 0) {
14436
- const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction ?? parsed.instruction ?? "";
14435
+ const dialogue = await sameParentDialogue(
14436
+ env,
14437
+ {
14438
+ instruction: parsed.instruction ?? "",
14439
+ instructionEmpty: (parsed.instruction ?? "").length === 0
14440
+ },
14441
+ gateParentRunPath,
14442
+ projectRoot,
14443
+ "countersign"
14444
+ );
14437
14445
  const resumed = await resumeSameParentInstructionSeat({
14438
14446
  env,
14439
14447
  io,
14440
- projectRoot: resolve12(parsed.project ?? env.cwd),
14448
+ projectRoot,
14441
14449
  role: "countersign",
14442
14450
  parentRunPath: gateParentRunPath,
14443
14451
  ...isSafePositiveTicketNumber(env.boundTicketNumber) ? { ticketNumber: env.boundTicketNumber } : {},
14444
14452
  summons: {
14445
14453
  sourceRunPath: gateParentRunPath,
14446
- instruction: resumeInstruction,
14447
- instructionEmpty: resumeInstruction.length === 0,
14454
+ instruction: dialogue.instruction,
14455
+ instructionEmpty: dialogue.instructionEmpty,
14448
14456
  // #1166 J11: same-parent resume delivers this call's file-flag paths
14449
14457
  // through the shared summons → appendCallerFileFlagPaths rule.
14450
14458
  attachmentPaths: parsed.attachmentPaths ?? []
@@ -14479,10 +14487,9 @@ async function runCountersignBody(parsed, env, io) {
14479
14487
  await persistAdmittedSourceRunPath(admitted, gateParentRunPath);
14480
14488
  admitted = { ...admitted, sourceRunPath: gateParentRunPath };
14481
14489
  }
14482
- const reviewBody = env.reviewReask ?? env.gateReviewInstruction;
14483
14490
  const turnProjection = roleTurnOptions(env, admitted, {
14484
14491
  kind: "initial",
14485
- prompt: reviewBody !== void 0 ? appendCallerFileFlagPaths(reviewBody, admitted.attachments) : buildInstructionTransportPrompt(admitted)
14492
+ prompt: await resolveInitialPrompt(admitted, env)
14486
14493
  });
14487
14494
  const turnRequest = buildInstructionSeatTurnRequest(admitted, turnProjection);
14488
14495
  const result = await runPostAdmissionOneShot({
@@ -14693,6 +14700,7 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
14693
14700
  await persistAdmittedSourceRunPath(admitted, auditorSource, auditorSubject);
14694
14701
  admitted = { ...admitted, sourceRunPath: auditorSource };
14695
14702
  }
14703
+ admitted = await inheritKnownTicketFromSource(admitted, env.principalAuthority);
14696
14704
  const runAdmitted = async () => {
14697
14705
  await markRunAdmitted(admitted, env.principalAuthority);
14698
14706
  if (role === "secretariat") {
@@ -14755,6 +14763,16 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
14755
14763
  }
14756
14764
  return runAdmitted();
14757
14765
  }
14766
+ async function inheritKnownTicketFromSource(admitted, authority) {
14767
+ if (admitted.ticketNumber !== void 0) return admitted;
14768
+ const sourcePath = admittedSourceRunPath(admitted);
14769
+ if (sourcePath === void 0) return admitted;
14770
+ const sourceTicket = await readBoardTicketNumber(sourcePath);
14771
+ if (sourceTicket === void 0) return admitted;
14772
+ await bindAdmittedTicketNumber(admitted, sourceTicket);
14773
+ await relocateAdmittedRunToTicket(admitted, authority);
14774
+ return admitted;
14775
+ }
14758
14776
  async function runPublicInstructionSeatResume(request, env, io) {
14759
14777
  let selectedRequest = request;
14760
14778
  const resume = async () => {
@@ -14774,26 +14792,45 @@ async function runPublicInstructionSeatResume(request, env, io) {
14774
14792
  env.principalAuthority,
14775
14793
  effective.runDirectory === void 0 ? void 0 : { runDirectory: effective.runDirectory }
14776
14794
  );
14777
- if (packagedRebindSourceOnResume(loaded.admitted.role) && effective.summons?.sourceRunPath !== void 0 && effective.summons.sourceRun !== void 0) {
14778
- return {
14779
- ...loaded,
14780
- admitted: {
14781
- ...loaded.admitted,
14782
- sourceRunPath: effective.summons.sourceRunPath,
14783
- sourceRun: effective.summons.sourceRun
14784
- }
14795
+ let admitted = loaded.admitted;
14796
+ if (packagedRebindSourceOnResume(admitted.role) && effective.summons?.sourceRunPath !== void 0 && effective.summons.sourceRun !== void 0) {
14797
+ admitted = {
14798
+ ...admitted,
14799
+ sourceRunPath: effective.summons.sourceRunPath,
14800
+ sourceRun: effective.summons.sourceRun
14785
14801
  };
14786
14802
  }
14787
- return loaded;
14803
+ admitted = await inheritKnownTicketFromSource(admitted, env.principalAuthority);
14804
+ return { ...loaded, admitted };
14788
14805
  },
14789
14806
  buildTurnRequest: async (admitted, effective) => {
14790
14807
  const summonsPrepared = await prepareSummonsResumeMaterials(admitted.runDirectory, effective.summons);
14791
- return buildInstructionSeatTurnRequest(
14808
+ const projection = resumeTurnRequestProjectionOptions(
14792
14809
  admitted,
14793
- {
14794
- ...resumeTurnRequestProjectionOptions(admitted, effective, env, summonsPrepared)
14795
- }
14810
+ effective,
14811
+ env,
14812
+ summonsPrepared
14796
14813
  );
14814
+ if (effective.summons === void 0 || effective.message !== void 0) {
14815
+ return buildInstructionSeatTurnRequest(admitted, { ...projection });
14816
+ }
14817
+ const sourceRunPath = admittedSourceRunPath(admitted);
14818
+ const body = await resolveReviewSeatDialogueBody({
14819
+ role: admitted.role,
14820
+ callerInstruction: summonsPrepared?.instruction ?? "",
14821
+ ...sourceRunPath === void 0 ? {} : { sourceRunPath },
14822
+ projectRoot: admitted.projectRoot,
14823
+ home: env.home
14824
+ });
14825
+ if (body === void 0) {
14826
+ return buildInstructionSeatTurnRequest(admitted, { ...projection });
14827
+ }
14828
+ const fileFlags = summonsPrepared?.attachments ?? [];
14829
+ const prompt = fileFlags.length === 0 ? body : appendCallerFileFlagPaths(body, fileFlags);
14830
+ return buildInstructionSeatTurnRequest(admitted, {
14831
+ ...projection,
14832
+ continuation: { kind: "resume", prompt }
14833
+ });
14797
14834
  },
14798
14835
  adapters: {
14799
14836
  trySettle: async () => void 0
@@ -14988,7 +15025,8 @@ async function auditSubmittedRole(turn, env, io, resumedOfficer, passedReceipt)
14988
15025
  return runPublicInstructionSeatResume({
14989
15026
  runId: admitted.runId,
14990
15027
  runDirectory: admitted.runDirectory,
14991
- summons: { instruction: SECRETARIAT_STATUS_REASK }
15028
+ message: SECRETARIAT_STATUS_REASK,
15029
+ summons: { instructionEmpty: true }
14992
15030
  }, next, io);
14993
15031
  }
14994
15032
  if (admitted.role === "countersign" && (typeof status !== "string" || !REVIEW_QUEUE_STATUSES.has(status))) {
@@ -15002,7 +15040,8 @@ async function auditSubmittedRole(turn, env, io, resumedOfficer, passedReceipt)
15002
15040
  return runPublicInstructionSeatResume({
15003
15041
  runId: admitted.runId,
15004
15042
  runDirectory: admitted.runDirectory,
15005
- summons: { instruction: officerConclusionReask(status) }
15043
+ message: officerConclusionReask(status),
15044
+ summons: { instructionEmpty: true }
15006
15045
  }, next, io);
15007
15046
  }
15008
15047
  const selfEscalationSkipsAudit = status === "escalate" && (admitted.role === "judge" || admitted.role === "secretariat" || admitted.role === "countersign");
@@ -15257,6 +15296,20 @@ var init_instruction_seat_run = __esm({
15257
15296
  judge: {
15258
15297
  statuses: REVIEW_QUEUE_STATUSES
15259
15298
  },
15299
+ // #1208 C1 / ADR 0055: every review-queue seat uses the shared
15300
+ // unreadable-status seam (officerConclusionReask). Independent public
15301
+ // entry for notary/auditor/inspector was the same miss — route here, do
15302
+ // not invent a parallel loop. Gate summons still own the outer budget
15303
+ // via nestedIncomplete when this seat exhausts unsettled.
15304
+ notary: {
15305
+ statuses: REVIEW_QUEUE_STATUSES
15306
+ },
15307
+ auditor: {
15308
+ statuses: REVIEW_QUEUE_STATUSES
15309
+ },
15310
+ inspector: {
15311
+ statuses: REVIEW_QUEUE_STATUSES
15312
+ },
15260
15313
  coder: {
15261
15314
  statuses: WORKER_ROUTING_STATUSES,
15262
15315
  reask: WORKER_STATUS_REASK
@@ -18985,13 +19038,9 @@ async function summonGateOfficer(options) {
18985
19038
  home = homeFromRunDirectory2(options.sourceRunDirectory);
18986
19039
  }
18987
19040
  let gateReviewInstruction;
18988
- if (options.reask === void 0 && options.submission !== void 0) {
18989
- const { isTicketCourtCountersignSource: isTicketCourtCountersignSource2 } = await Promise.resolve().then(() => (init_run_terminal_artifacts(), run_terminal_artifacts_exports));
18990
- const blindTicketCourt = options.officer === "notary" && isTicketCourtCountersignSource2(options.sourceRunDirectory);
18991
- if (!blindTicketCourt) {
18992
- const { readableGateItem: readableGateItem2 } = await Promise.resolve().then(() => (init_readable_gate_item(), readable_gate_item_exports));
18993
- gateReviewInstruction = readableGateItem2(options.submission);
18994
- }
19041
+ if (options.reask === void 0 && options.submission !== void 0 && options.officer !== "notary") {
19042
+ const { readableGateItem: readableGateItem2 } = await Promise.resolve().then(() => (init_readable_gate_item(), readable_gate_item_exports));
19043
+ gateReviewInstruction = readableGateItem2(options.submission);
18995
19044
  }
18996
19045
  const { runIdFromRunDirectory: runIdFromRunDirectory2 } = await Promise.resolve().then(() => (init_run_terminal_artifacts(), run_terminal_artifacts_exports));
18997
19046
  const parentRunId = runIdFromRunDirectory2(options.sourceRunDirectory);
@@ -19042,7 +19091,14 @@ async function summonGateOfficer(options) {
19042
19091
  const parentTicket = await readBoardTicketNumber2(options.sourceRunDirectory);
19043
19092
  const submittedTicket = isRecord(options.submission) ? options.submission.ticketNumber : void 0;
19044
19093
  const courtTicket = isSafePositiveTicketNumber3(submittedTicket) ? submittedTicket : parentTicket;
19045
- const instruction = options.reask ?? gateReviewInstruction ?? "";
19094
+ const { resolveReviewSeatDialogueBody: resolveReviewSeatDialogueBody2 } = await Promise.resolve().then(() => (init_instruction_seat_run(), instruction_seat_run_exports));
19095
+ const instruction = await resolveReviewSeatDialogueBody2({
19096
+ role: options.officer,
19097
+ ...options.reask === void 0 ? {} : { reviewReask: options.reask },
19098
+ ...gateReviewInstruction === void 0 ? {} : { gateReviewInstruction },
19099
+ projectRoot: options.cwd,
19100
+ home
19101
+ }) ?? "";
19046
19102
  return summonPublicRole({
19047
19103
  role: options.officer,
19048
19104
  argv: ["--project", options.cwd, "--", instruction],
@@ -19253,11 +19309,9 @@ var init_role_run_relocation = __esm({
19253
19309
  var run_lifecycle_exports = {};
19254
19310
  __export(run_lifecycle_exports, {
19255
19311
  AUTO_RESUME_LIMIT: () => AUTO_RESUME_LIMIT,
19256
- RESUME_TRANSPORT_ENVELOPE: () => RESUME_TRANSPORT_ENVELOPE,
19257
19312
  RunWriterLeaseHeldError: () => RunWriterLeaseHeldError,
19258
19313
  acquireRunWriterLease: () => acquireRunWriterLease,
19259
19314
  autopsyWriterLock: () => autopsyWriterLock,
19260
- buildAutoResumeContinuationPrompt: () => buildAutoResumeContinuationPrompt,
19261
19315
  clearCurrentCourt: () => clearCurrentCourt,
19262
19316
  describeErrorIdentity: () => describeErrorIdentity,
19263
19317
  findLatestRunForSeatTicket: () => findLatestRunForSeatTicket,
@@ -19279,9 +19333,6 @@ __export(run_lifecycle_exports, {
19279
19333
  import { existsSync as existsSync12 } from "node:fs";
19280
19334
  import { chmod, lstat as lstat3, open as open2, readdir as readdir4, readFile as readFile14, unlink as unlink2 } from "node:fs/promises";
19281
19335
  import { basename as basename12, join as join28 } from "node:path";
19282
- function buildAutoResumeContinuationPrompt() {
19283
- return RESUME_TRANSPORT_ENVELOPE;
19284
- }
19285
19336
  async function writeRoleRunState(runDirectory, record) {
19286
19337
  const payload = { ...record, runDirectory };
19287
19338
  writeSectionSync(runDirectory, "runState", { ...payload });
@@ -20212,7 +20263,7 @@ function resumedWorkerPhase(phase, phases, role, runId) {
20212
20263
  }
20213
20264
  throw new CliUsageError(`role run admitted ${role} phase is missing: ${runId}`);
20214
20265
  }
20215
- var AUTO_RESUME_LIMIT, RESUME_TRANSPORT_ENVELOPE, WRITER_LOCK_FILE, RunWriterLeaseHeldError, WRITER_LEASE_RECLAIM_ROUNDS;
20266
+ var AUTO_RESUME_LIMIT, WRITER_LOCK_FILE, RunWriterLeaseHeldError, WRITER_LEASE_RECLAIM_ROUNDS;
20216
20267
  var init_run_lifecycle = __esm({
20217
20268
  "src/public-cli/run-lifecycle.ts"() {
20218
20269
  "use strict";
@@ -20227,7 +20278,6 @@ var init_run_lifecycle = __esm({
20227
20278
  init_run_dossier();
20228
20279
  init_unknown_value();
20229
20280
  AUTO_RESUME_LIMIT = 2;
20230
- RESUME_TRANSPORT_ENVELOPE = "\u7EE7\u7EED\u3002";
20231
20281
  WRITER_LOCK_FILE = "writer.lock";
20232
20282
  RunWriterLeaseHeldError = class extends Error {
20233
20283
  code = "AK_RUN_WRITER_LEASE_HELD";
@@ -21794,7 +21844,7 @@ function createNavigatorAttendance(options) {
21794
21844
  await promptAllowingRejectedPrepare(request);
21795
21845
  while (output === void 0 && prepareBatchRejected && delivery.nextAction() === "request-delivery") {
21796
21846
  delivery.recordDeliveryRequest();
21797
- await promptAllowingRejectedPrepare(JSON.stringify(delivery.deliveryState()));
21847
+ await promptAllowingRejectedPrepare(request);
21798
21848
  }
21799
21849
  if (output === void 0 && delivery.nextAction() === "request-delivery") {
21800
21850
  delivery.closeBudget();
@@ -23119,6 +23169,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23119
23169
  let engineDetourRegistered = false;
23120
23170
  let receiptDelivery = createReceiptDeliveryPolicy(deliveryLimit);
23121
23171
  let noReceiptRecorded = false;
23172
+ let turnDialoguePrompt;
23122
23173
  const disposeNavigatorAttendanceNonBlocking = (attendance) => {
23123
23174
  if (attendance === void 0) return;
23124
23175
  const recordDisposeFailure = (error) => {
@@ -23205,6 +23256,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23205
23256
  roleHost.on("before_agent_start", async (event, ctx) => {
23206
23257
  const role = roleHost.getFlag(ROLE_FLAG.name);
23207
23258
  const prompt = event.prompt;
23259
+ if (typeof prompt === "string") turnDialoguePrompt = prompt;
23208
23260
  if (role === void 0) return;
23209
23261
  if (!admitted || selectedRole !== role) {
23210
23262
  failInfrastructure(new ActivationBarrierError(role), ctx);
@@ -23365,7 +23417,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23365
23417
  });
23366
23418
  envelopeHost.sendMessage({
23367
23419
  customType: "ak-receipt-delivery-prompt",
23368
- content: JSON.stringify(receiptDelivery.deliveryState()),
23420
+ content: turnDialoguePrompt ?? "",
23369
23421
  display: false
23370
23422
  }, { triggerTurn: true, deliverAs: "followUp" });
23371
23423
  } else if (receiptDelivery.nextAction() === "no-receipt" && !noReceiptRecorded) {
@@ -23605,6 +23657,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23605
23657
  activeCollector = void 0;
23606
23658
  receiptDelivery = createReceiptDeliveryPolicy(deliveryLimit);
23607
23659
  noReceiptRecorded = false;
23660
+ turnDialoguePrompt = void 0;
23608
23661
  pendingNavigatorPresentation = void 0;
23609
23662
  navigatorActivation += 1;
23610
23663
  navigatorDeliveryClosed = false;