@akagilnc/pi-workflow-roles 0.1.4782 → 0.1.4802

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.
Files changed (35) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/dist/acp-host/production-host.js +104 -215
  4. package/dist/headless-host/production-host.js +149 -229
  5. package/dist/migrate-book-topology.js +1 -1
  6. package/dist/pi/role-turn-host.js +1 -1
  7. package/dist/public-cli/auto-resume.js +9 -15
  8. package/dist/public-cli/countersign-run.js +75 -87
  9. package/dist/public-cli/diarist-run.js +6 -26
  10. package/dist/public-cli/inspector-run.js +1 -1
  11. package/dist/public-cli/main.js +64 -177
  12. package/dist/public-cli/notary-run.js +0 -3
  13. package/dist/public-cli/option-definitions.js +1 -1
  14. package/dist/public-cli/post-admission.js +35 -65
  15. package/dist/public-cli/reviewer-run.js +1 -1
  16. package/dist/public-cli/run-lifecycle.js +14 -46
  17. package/dist/public-cli/seat-ticket-binding.js +11 -25
  18. package/dist/public-role-summons.js +2 -0
  19. package/package.json +1 -1
  20. package/souls/coder.md +1 -2
  21. package/src/headless-host/role-turn-host.ts +49 -12
  22. package/src/pi/role-turn-host.ts +1 -1
  23. package/src/public-cli/auto-resume.ts +19 -18
  24. package/src/public-cli/countersign-run.ts +76 -129
  25. package/src/public-cli/diarist-run.ts +6 -33
  26. package/src/public-cli/inspector-run.ts +1 -1
  27. package/src/public-cli/invocation.ts +5 -0
  28. package/src/public-cli/notary-run.ts +3 -7
  29. package/src/public-cli/option-definitions.ts +1 -1
  30. package/src/public-cli/post-admission.ts +37 -69
  31. package/src/public-cli/reviewer-run.ts +1 -1
  32. package/src/public-cli/run-lifecycle.ts +18 -66
  33. package/src/public-cli/seat-ticket-binding.ts +12 -28
  34. package/src/public-role-summons.ts +15 -6
  35. package/src/role-runtime.ts +9 -0
@@ -16630,7 +16630,7 @@ function piUserDialogueBody(request) {
16630
16630
  const _exhaustive = request.continuation;
16631
16631
  return _exhaustive;
16632
16632
  })();
16633
- return request.continuation.kind === "resume" && request.activation.role === "reviewer" ? rawPrompt : applyPiNativeSkillInvocation(request.methods, rawPrompt);
16633
+ return request.continuation.kind === "resume" ? rawPrompt : applyPiNativeSkillInvocation(request.methods, rawPrompt);
16634
16634
  }
16635
16635
  async function resolveSelectedPi(command, cwd, env) {
16636
16636
  const searchPath = env.PATH ?? (platform === "win32" ? process.env.PATH ?? "" : "/usr/bin:/bin");
@@ -17711,7 +17711,7 @@ async function listPullRequestNumbersByCommit(runner, input) {
17711
17711
  function createGhApiRunner(options = {}) {
17712
17712
  const spawnImpl = options.spawnImpl ?? spawn2;
17713
17713
  return async (args, runOptions = {}) => {
17714
- return await new Promise((resolve11, reject) => {
17714
+ return await new Promise((resolve12, reject) => {
17715
17715
  const signal = runOptions.signal;
17716
17716
  if (signal?.aborted) {
17717
17717
  reject(signal.reason ?? new Error("aborted"));
@@ -17784,11 +17784,11 @@ function createGhApiRunner(options = {}) {
17784
17784
  const value = line2.slice(idx + 1).trim();
17785
17785
  headers[name] = value;
17786
17786
  }
17787
- resolve11({ status, headers, bodyText });
17787
+ resolve12({ status, headers, bodyText });
17788
17788
  return;
17789
17789
  }
17790
17790
  if (code === 0) {
17791
- resolve11({ status: 200, headers: {}, bodyText: stdout });
17791
+ resolve12({ status: 200, headers: {}, bodyText: stdout });
17792
17792
  return;
17793
17793
  }
17794
17794
  const failure = new Error(
@@ -18169,27 +18169,14 @@ var init_typed_provider_http = __esm({
18169
18169
  // src/public-cli/run-lifecycle.ts
18170
18170
  import { chmod, lstat as lstat2, open, readdir as readdir4, readFile as readFile10, unlink as unlink2, writeFile as writeFile3 } from "node:fs/promises";
18171
18171
  import { basename as basename5, join as join14 } from "node:path";
18172
- function selectResumeContinuationPrompt(message, engineMaterial) {
18173
- const lines = message !== void 0 ? [message] : [];
18174
- return appendEngineSessionMaterial(lines, engineMaterial).join("\n");
18175
- }
18176
- function buildResumeContinuationPrompt(options) {
18177
- return selectResumeContinuationPrompt(
18178
- options.message,
18179
- engineSessionMaterialFromOptions({
18180
- packageRoot: options.packageRoot,
18181
- ...pickEngineAxis(options)
18182
- })
18183
- );
18184
- }
18185
18172
  function buildAutoResumeContinuationPrompt(options) {
18186
- return selectResumeContinuationPrompt(
18187
- RESUME_TRANSPORT_ENVELOPE,
18173
+ return appendEngineSessionMaterial(
18174
+ [RESUME_TRANSPORT_ENVELOPE],
18188
18175
  engineSessionMaterialFromOptions({
18189
18176
  packageRoot: options.packageRoot,
18190
18177
  ...pickEngineAxis(options)
18191
18178
  })
18192
- );
18179
+ ).join("\n");
18193
18180
  }
18194
18181
  function isV1ResumableProvider(provider) {
18195
18182
  return V1_RESUMABLE_PROVIDERS.includes(provider);
@@ -18729,7 +18716,7 @@ async function runHasFormedSessionPrincipal(runDirectory) {
18729
18716
  }
18730
18717
  }
18731
18718
  async function findLatestRunIdForSeatTicket(input) {
18732
- if (input.ticketNumber === void 0 && input.parentRunPath === void 0) {
18719
+ if (input.parentRunPath.trim() === "") {
18733
18720
  return void 0;
18734
18721
  }
18735
18722
  const ledgerHome = resolveActivationLedgerHome(input.home);
@@ -18748,13 +18735,8 @@ async function findLatestRunIdForSeatTicket(input) {
18748
18735
  if (!entry.endsWith(suffix)) continue;
18749
18736
  const runId = entry.slice(0, entry.length - suffix.length);
18750
18737
  if (runId.length === 0) continue;
18751
- if (input.parentRunPath !== void 0) {
18752
- const parentPath = await readRunParentPath(runDirectory);
18753
- if (parentPath !== input.parentRunPath) continue;
18754
- } else if (input.ticketNumber !== void 0) {
18755
- const ticketNumber = await readBoardTicketNumber(runDirectory);
18756
- if (ticketNumber !== input.ticketNumber) continue;
18757
- }
18738
+ const parentPath = await readRunParentPath(runDirectory);
18739
+ if (parentPath !== input.parentRunPath) continue;
18758
18740
  if (!await runHasFormedSessionPrincipal(runDirectory)) continue;
18759
18741
  if (best === void 0 || runId > best) best = runId;
18760
18742
  }
@@ -20677,7 +20659,7 @@ var init_option_definitions = __esm({
20677
20659
  },
20678
20660
  resume: {
20679
20661
  command: "resume",
20680
- summary: "Resume a role run under the live seat table (model/host/engine); session principal must still exist. [message] applies only to seats that accept caller instruction; Notary/\u7B26\u5B9D\u90CE must omit message and derives evidence from the existing source-run/dossier binding. 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).",
20662
+ 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).",
20681
20663
  usage: ["ak-role resume <runId> [message]"],
20682
20664
  examples: [
20683
20665
  "ak-role resume 01abc\u2026",
@@ -27219,10 +27201,10 @@ function presentFailureTerminal(terminal, io) {
27219
27201
  }
27220
27202
  function defaultNavigatorGraceSleep() {
27221
27203
  let timer;
27222
- const sleep2 = ((ms) => new Promise((resolve11) => {
27204
+ const sleep2 = ((ms) => new Promise((resolve12) => {
27223
27205
  timer = setTimeout(() => {
27224
27206
  timer = void 0;
27225
- resolve11();
27207
+ resolve12();
27226
27208
  }, ms);
27227
27209
  }));
27228
27210
  sleep2.cancel = () => {
@@ -27234,7 +27216,7 @@ function defaultNavigatorGraceSleep() {
27234
27216
  return sleep2;
27235
27217
  }
27236
27218
  function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2 = defaultNavigatorGraceSleep()) {
27237
- return new Promise((resolve11, reject) => {
27219
+ return new Promise((resolve12, reject) => {
27238
27220
  let settled = false;
27239
27221
  const finish = (action) => {
27240
27222
  if (settled) return;
@@ -27243,11 +27225,11 @@ function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2
27243
27225
  action();
27244
27226
  };
27245
27227
  void work.then(
27246
- (value) => finish(() => resolve11({ status: "done", value })),
27228
+ (value) => finish(() => resolve12({ status: "done", value })),
27247
27229
  (error) => finish(() => reject(error))
27248
27230
  );
27249
27231
  void sleep2(graceMs).then(() => {
27250
- finish(() => resolve11({ status: "timeout" }));
27232
+ finish(() => resolve12({ status: "timeout" }));
27251
27233
  });
27252
27234
  });
27253
27235
  }
@@ -27843,22 +27825,10 @@ async function runWithAutoResumeLoop(options) {
27843
27825
  let everyAttemptThrew = true;
27844
27826
  const retainedErrorFiles = [];
27845
27827
  while (true) {
27846
- let lease;
27847
- try {
27848
- lease = await acquireRunWriterLease(
27849
- options.admitted.runDirectory,
27850
- (diagnostic) => options.io.stderr(diagnostic)
27851
- );
27852
- } catch (error) {
27853
- if (error instanceof RunWriterLeaseHeldError) {
27854
- presentStructuralRejection(error, options.io);
27855
- return { exitCode: 2 };
27856
- }
27857
- throw error;
27858
- }
27859
27828
  let result;
27860
27829
  let turnStartedBeforeThrow = false;
27861
27830
  try {
27831
+ const lease = isFirst ? await acquireRunWriterLease(options.admitted.runDirectory) : void 0;
27862
27832
  result = await options.dispatch(currentPayload, lease, isFirst, dummyIo);
27863
27833
  } catch (error) {
27864
27834
  lastThrownError = error;
@@ -27992,8 +27962,8 @@ async function runWithAutoResumeLoop(options) {
27992
27962
  autoResumeAttempts++;
27993
27963
  if (result?.turnDispatched === true || turnStartedBeforeThrow) {
27994
27964
  currentPayload = options.buildResumePayload();
27965
+ isFirst = false;
27995
27966
  }
27996
- isFirst = false;
27997
27967
  }
27998
27968
  }
27999
27969
  var dummyIo, TurnDispatchedFailure, DISPATCH_ERROR_RETENTION_ENTRY_TYPE;
@@ -28483,7 +28453,7 @@ async function dispatchPostAdmissionTurn(input) {
28483
28453
  await recordBestEffortPostDispatchDiagnostic(
28484
28454
  admitted,
28485
28455
  env,
28486
- `current-court cleanup failed after accepted settlement (best-effort continue, self-heals on next resume): ${describeErrorIdentity(error)}`,
28456
+ `current-court cleanup failed after accepted settlement (best-effort continue): ${describeErrorIdentity(error)}`,
28487
28457
  io
28488
28458
  );
28489
28459
  }
@@ -28659,21 +28629,14 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
28659
28629
  } else if (request.summons !== void 0) {
28660
28630
  prompt = request.message;
28661
28631
  } else {
28662
- prompt = buildResumeContinuationPrompt({
28663
- packageRoot: env.packageRoot,
28664
- ...pickEngineAxis(env),
28665
- message: request.message
28666
- });
28632
+ prompt = request.message;
28667
28633
  }
28668
28634
  } else if (summonsPrepared !== void 0) {
28669
28635
  prompt = officerDialogue ? summonsPrepared.instructionEmpty ? "" : summonsPrepared.instruction : buildInstructionTransportPrompt(summonsPrepared);
28670
28636
  } else if (request.summons !== void 0) {
28671
28637
  prompt = "";
28672
28638
  } else {
28673
- prompt = buildResumeContinuationPrompt({
28674
- packageRoot: env.packageRoot,
28675
- ...pickEngineAxis(env)
28676
- });
28639
+ prompt = "";
28677
28640
  }
28678
28641
  return {
28679
28642
  packageRoot: env.packageRoot,
@@ -28698,7 +28661,7 @@ async function dispatchAfterWriterLease(input) {
28698
28661
  handedOffToDispatch = true;
28699
28662
  return await input.dispatch(request);
28700
28663
  } finally {
28701
- if (!handedOffToDispatch) {
28664
+ if (!handedOffToDispatch && input.lease !== void 0) {
28702
28665
  await input.lease.release();
28703
28666
  }
28704
28667
  }
@@ -28751,20 +28714,11 @@ async function runPostAdmissionSeatResume(input) {
28751
28714
  let preparedCleanup;
28752
28715
  const buildRequestAfterLease = async () => {
28753
28716
  let openCourtAttemptId;
28754
- let admittedForBuild = loaded.admitted;
28717
+ const admittedForBuild = loaded.admitted;
28755
28718
  if (request.summons === void 0) {
28756
28719
  const openCourt = await readCurrentCourt(admittedForBuild.runDirectory);
28757
28720
  if (openCourt !== void 0) {
28758
28721
  openCourtAttemptId = openCourt.courtAttemptId;
28759
- request = {
28760
- runId: request.runId,
28761
- ...request.message === void 0 ? {} : { message: request.message },
28762
- ...openCourt.summons === void 0 ? {} : { summons: openCourt.summons }
28763
- };
28764
- if (openCourt.summons !== void 0) {
28765
- const reloaded = await input.load(request);
28766
- admittedForBuild = reloaded.admitted;
28767
- }
28768
28722
  }
28769
28723
  }
28770
28724
  if (request.summons !== void 0) {
@@ -28826,7 +28780,7 @@ async function runPostAdmissionSeatResume(input) {
28826
28780
  // Same as public manual resume: prior-court sealed acceptance is not a
28827
28781
  // redispatch brake (#833). New-court station-child turns still auto-resume.
28828
28782
  dispatch: async (payload, lease, _isFirst, attemptIo) => dispatchAfterWriterLease({
28829
- lease,
28783
+ ...lease === void 0 ? {} : { lease },
28830
28784
  build: async () => {
28831
28785
  if (payload.resumeTurn && firstTurn !== void 0) {
28832
28786
  return {
@@ -28850,7 +28804,7 @@ async function runPostAdmissionSeatResume(input) {
28850
28804
  env,
28851
28805
  io: attemptIo,
28852
28806
  request: turnRequest,
28853
- lease,
28807
+ ...lease === void 0 ? {} : { lease },
28854
28808
  adapters: stationAdapters,
28855
28809
  persistRunState: false,
28856
28810
  ...input.effectiveEngine === void 0 ? {} : { effectiveEngine: input.effectiveEngine }
@@ -28936,7 +28890,7 @@ async function runPostAdmissionResumable(input) {
28936
28890
  },
28937
28891
  io: attemptIo,
28938
28892
  request,
28939
- lease,
28893
+ ...lease === void 0 ? {} : { lease },
28940
28894
  adapters,
28941
28895
  persistRunState: false,
28942
28896
  // #600: every attempt (initial + auto-resume) writes seat engine when present.
@@ -29180,15 +29134,12 @@ var init_coder_run = __esm({
29180
29134
  // src/public-cli/seat-ticket-binding.ts
29181
29135
  async function tryResumeSameTicketSeatRun(input) {
29182
29136
  if (input.freshSummons === true) return void 0;
29183
- if (input.parentRunPath === void 0 && input.ticketNumber === void 0) {
29184
- return void 0;
29185
- }
29137
+ if (input.parentRunPath.trim() === "") return void 0;
29186
29138
  const previousRunId = await findLatestRunIdForSeatTicket({
29187
29139
  home: input.home,
29188
29140
  bookKey: resolveBookKeyFromGit(input.projectRoot),
29189
29141
  role: input.role,
29190
- ...input.parentRunPath === void 0 ? {} : { parentRunPath: input.parentRunPath },
29191
- ...input.ticketNumber === void 0 ? {} : { ticketNumber: input.ticketNumber }
29142
+ parentRunPath: input.parentRunPath
29192
29143
  });
29193
29144
  if (previousRunId === void 0) return void 0;
29194
29145
  return await input.resume(previousRunId, input.summons);
@@ -29712,11 +29663,6 @@ async function runPublicNotaryResume(request, env, io) {
29712
29663
  env,
29713
29664
  io,
29714
29665
  load: async (effective) => {
29715
- if (effective.message !== void 0) {
29716
- throw new CliUsageError(
29717
- "notary rejects caller prompt/instruction; only zero caller-prompt continuation admitted"
29718
- );
29719
- }
29720
29666
  const loaded = await loadResumableNotaryRun(
29721
29667
  env.home,
29722
29668
  effective.runId,
@@ -30205,29 +30151,7 @@ async function runPublicDiarist(argv2, env, io, parseDiaristArgv2) {
30205
30151
  }
30206
30152
  throw error;
30207
30153
  }
30208
- const projectRoot = parsed.project ?? env.cwd;
30209
30154
  const handoffTicket = env.boundTicketNumber;
30210
- if (typeof handoffTicket === "number" && Number.isSafeInteger(handoffTicket) && handoffTicket >= 1) {
30211
- const summons = {
30212
- instruction: parsed.instruction,
30213
- instructionEmpty: parsed.instruction.trim() === "",
30214
- attachmentPaths: parsed.attachmentPaths
30215
- };
30216
- const resumed = await tryResumeSameTicketSeatRun({
30217
- home: env.home,
30218
- projectRoot,
30219
- role: "diarist",
30220
- ticketNumber: handoffTicket,
30221
- freshSummons: env.freshSummons,
30222
- summons,
30223
- resume: (runId, materials) => runPublicDiaristResume(
30224
- { runId, ...materials === void 0 ? {} : { summons: materials } },
30225
- env,
30226
- io
30227
- )
30228
- });
30229
- if (resumed !== void 0) return resumed;
30230
- }
30231
30155
  let admitted;
30232
30156
  try {
30233
30157
  admitted = await admitDiaristInvocation({
@@ -30312,7 +30236,6 @@ var init_diarist_run = __esm({
30312
30236
  init_invocation();
30313
30237
  init_post_admission();
30314
30238
  init_run_lifecycle();
30315
- init_seat_ticket_binding();
30316
30239
  init_settlement();
30317
30240
  init_turn_request();
30318
30241
  init_run_ticket_number();
@@ -30591,7 +30514,7 @@ async function runPublicReviewerResume(request, env, io) {
30591
30514
  ...sandbox.executionCwd === void 0 ? {} : { cwd: sandbox.executionCwd },
30592
30515
  continuation: {
30593
30516
  kind: "resume",
30594
- prompt: reviewerResumePrompt(activeEnv, effective.message)
30517
+ prompt: effective.message ?? ""
30595
30518
  }
30596
30519
  });
30597
30520
  },
@@ -30857,6 +30780,7 @@ async function summonPublicRole(options) {
30857
30780
  ...options.reviewReask === void 0 ? {} : { reviewReask: options.reviewReask },
30858
30781
  ...options.gateReviewInstruction === void 0 ? {} : { gateReviewInstruction: options.gateReviewInstruction },
30859
30782
  ...options.boundTicketNumber === void 0 ? {} : { boundTicketNumber: options.boundTicketNumber },
30783
+ ...options.parentRunPath === void 0 || options.parentRunPath.trim() === "" ? {} : { parentRunPath: options.parentRunPath },
30860
30784
  ...options.correlationId === void 0 || options.correlationId.trim() === "" ? {} : { correlationId: options.correlationId },
30861
30785
  ...options.createRunId === void 0 ? {} : { createRunId: options.createRunId },
30862
30786
  ...options.executionCwd === void 0 ? {} : { executionCwd: options.executionCwd }
@@ -31359,6 +31283,7 @@ async function summonGateOfficer(options) {
31359
31283
  argv: ["--project", options.cwd, "--", instruction],
31360
31284
  ...common,
31361
31285
  correlationId,
31286
+ parentRunPath: options.sourceRunDirectory,
31362
31287
  ...parentTicket === void 0 ? {} : { boundTicketNumber: parentTicket }
31363
31288
  });
31364
31289
  }
@@ -31387,6 +31312,7 @@ __export(countersign_run_exports, {
31387
31312
  runPublicCountersign: () => runPublicCountersign,
31388
31313
  runPublicCountersignResume: () => runPublicCountersignResume
31389
31314
  });
31315
+ import { resolve as resolve10 } from "node:path";
31390
31316
  function buildCountersignTurnRequest(admitted, options) {
31391
31317
  return projectRoleTurnRequest(
31392
31318
  admitted,
@@ -31581,6 +31507,28 @@ async function runPublicCountersign(argv2, env, io, parseCountersignArgv2) {
31581
31507
  throw error;
31582
31508
  }
31583
31509
  let admitted;
31510
+ const gateParentRunPath = typeof env.parentRunPath === "string" && env.parentRunPath.trim() !== "" ? env.parentRunPath : void 0;
31511
+ if (gateParentRunPath !== void 0) {
31512
+ const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction ?? parsed.instruction;
31513
+ const resumed = await tryResumeSameTicketSeatRun({
31514
+ home: env.home,
31515
+ projectRoot: resolve10(parsed.project ?? env.cwd),
31516
+ role: "countersign",
31517
+ parentRunPath: gateParentRunPath,
31518
+ freshSummons: env.freshSummons,
31519
+ summons: {
31520
+ sourceRunPath: gateParentRunPath,
31521
+ instruction: resumeInstruction,
31522
+ instructionEmpty: resumeInstruction.trim() === ""
31523
+ },
31524
+ resume: (runId, materials) => runPublicCountersignResume(
31525
+ { runId, ...materials === void 0 ? {} : { summons: materials } },
31526
+ env,
31527
+ io
31528
+ )
31529
+ });
31530
+ if (resumed !== void 0) return resumed;
31531
+ }
31584
31532
  try {
31585
31533
  admitted = await admitCountersignInvocation({
31586
31534
  home: env.home,
@@ -31624,7 +31572,7 @@ async function runPublicCountersign(argv2, env, io, parseCountersignArgv2) {
31624
31572
  instruction: parsed.instruction,
31625
31573
  projectRoot: admitted.projectRoot,
31626
31574
  failureLabel: "unbound summons",
31627
- // #969: parent durable ticket is the resume/bind key (ADR 0079).
31575
+ // #969: parent durable ticket is the bind key (not a resume lookup).
31628
31576
  ...env.boundTicketNumber === void 0 ? {} : { boundTicketNumber: env.boundTicketNumber }
31629
31577
  },
31630
31578
  env,
@@ -31680,59 +31628,13 @@ async function runPublicCountersign(argv2, env, io, parseCountersignArgv2) {
31680
31628
  } else if (isSafePositiveTicketNumber(env.boundTicketNumber)) {
31681
31629
  typedTicket = env.boundTicketNumber;
31682
31630
  }
31683
- if (typedTicket !== void 0) {
31684
- const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction ?? parsed.instruction;
31685
- const summons = {
31686
- instruction: resumeInstruction,
31687
- instructionEmpty: resumeInstruction.trim() === ""
31688
- };
31689
- const resumed = await tryResumeSameTicketSeatRun({
31690
- home: env.home,
31691
- projectRoot: admitted.projectRoot,
31692
- role: "countersign",
31693
- ticketNumber: typedTicket,
31694
- freshSummons: env.freshSummons,
31695
- summons,
31696
- resume: async (runId, materials) => {
31697
- const retained = await loadResumableCountersignRun(
31698
- env.home,
31699
- runId,
31700
- env.principalAuthority
31701
- );
31702
- if (retained.admitted === void 0) {
31703
- throw new Error(
31704
- `retained countersign run disappeared before resume: ${runId}`
31705
- );
31706
- }
31707
- const frozenPaths = (await freezePreparedAttachmentsIntoRun(
31708
- preparedAttachments,
31709
- retained.admitted.runDirectory,
31710
- `s-${Date.now().toString(36)}`
31711
- )).map((attachment) => attachment.frozenPath);
31712
- const preparedMaterials = {
31713
- ...materials ?? {},
31714
- ...frozenPaths.length === 0 ? {} : { attachmentPaths: frozenPaths }
31715
- };
31716
- return await runPublicCountersignResume(
31717
- {
31718
- runId,
31719
- summons: preparedMaterials
31720
- },
31721
- {
31722
- ...env,
31723
- ...typedCourtTicketNumbers === void 0 ? {} : { pendingCourtTicketNumbers: typedCourtTicketNumbers }
31724
- },
31725
- io
31726
- );
31727
- }
31728
- });
31729
- if (resumed !== void 0) {
31730
- return resumed;
31731
- }
31732
- }
31733
31631
  }
31734
31632
  await materializeAdmission();
31735
31633
  await markRunAdmitted(admitted, env.principalAuthority);
31634
+ if (gateParentRunPath !== void 0) {
31635
+ await persistAdmittedSourceRunPath(admitted, gateParentRunPath);
31636
+ admitted = { ...admitted, sourceRunPath: gateParentRunPath };
31637
+ }
31736
31638
  if (identityDiaristRan && typedTicket !== void 0) {
31737
31639
  try {
31738
31640
  await bindAdmittedTicketNumber(admitted, typedTicket);
@@ -31851,22 +31753,7 @@ async function runPublicCountersignResume(request, env, io) {
31851
31753
  )
31852
31754
  );
31853
31755
  },
31854
- adapters: countersignAdapters({
31855
- beforeDispatch: async (admitted) => {
31856
- if (admitted.courtTicketNumbersDamage !== void 0) {
31857
- throw new StationChildExhaustedError(
31858
- admitted.courtTicketNumbersDamage
31859
- );
31860
- }
31861
- if (env.pendingCourtTicketNumbers !== void 0) {
31862
- await bindCourtTicketNumbersOnAdmitted(
31863
- admitted,
31864
- env.pendingCourtTicketNumbers
31865
- );
31866
- }
31867
- await runCountersignCourtDiaristStation(admitted, env, io);
31868
- }
31869
- }),
31756
+ adapters: countersignAdapters(),
31870
31757
  ...env.engine === void 0 ? {} : { effectiveEngine: env.engine }
31871
31758
  });
31872
31759
  }
@@ -32569,8 +32456,8 @@ var init_atomic_write = __esm({
32569
32456
  import { open as open3, readFile as readFile18, unlink as unlink4 } from "node:fs/promises";
32570
32457
  import { dirname as dirname17, join as join32 } from "node:path";
32571
32458
  function sleep(ms) {
32572
- return new Promise((resolve11) => {
32573
- setTimeout(resolve11, ms);
32459
+ return new Promise((resolve12) => {
32460
+ setTimeout(resolve12, ms);
32574
32461
  });
32575
32462
  }
32576
32463
  async function withAnalystLibraryIndexLock(ledgerHome, fn) {
@@ -34523,7 +34410,7 @@ var init_analyst_entry = __esm({
34523
34410
 
34524
34411
  // src/public-cli/analyst-run.ts
34525
34412
  import { readFile as readFile21 } from "node:fs/promises";
34526
- import { isAbsolute as isAbsolute10, resolve as resolve10 } from "node:path";
34413
+ import { isAbsolute as isAbsolute10, resolve as resolve11 } from "node:path";
34527
34414
  function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
34528
34415
  try {
34529
34416
  return resolveBookKeyFromGit(cwd);
@@ -34572,7 +34459,7 @@ async function buildAnalystSweepModeInputFromAttachmentPaths(attachmentPaths) {
34572
34459
  );
34573
34460
  }
34574
34461
  const sourcePath = attachmentPaths[0];
34575
- const absolute = isAbsolute10(sourcePath) ? sourcePath : resolve10(sourcePath);
34462
+ const absolute = isAbsolute10(sourcePath) ? sourcePath : resolve11(sourcePath);
34576
34463
  let bytes;
34577
34464
  try {
34578
34465
  bytes = await readFile21(absolute);
@@ -145,9 +145,6 @@ export async function runPublicNotaryResume(request, env, io) {
145
145
  env,
146
146
  io,
147
147
  load: async (effective) => {
148
- if (effective.message !== undefined) {
149
- throw new CliUsageError("notary rejects caller prompt/instruction; only zero caller-prompt continuation admitted");
150
- }
151
148
  const loaded = await loadResumableNotaryRun(env.home, effective.runId, env.principalAuthority);
152
149
  const summons = effective.summons;
153
150
  if (summons?.sourceRunPath !== undefined &&
@@ -1145,7 +1145,7 @@ const SUPPORT_COMMAND_HELP = {
1145
1145
  },
1146
1146
  resume: {
1147
1147
  command: "resume",
1148
- summary: "Resume a role run under the live seat table (model/host/engine); session principal must still exist. [message] applies only to seats that accept caller instruction; Notary/符宝郎 must omit message and derives evidence from the existing source-run/dossier binding. 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).",
1148
+ summary: "Resume a role run under the live seat table (model/host/engine); session principal must still exist. Every callable seat, including Notary/符宝郎, 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).",
1149
1149
  usage: ["ak-role resume <runId> [message]"],
1150
1150
  examples: [
1151
1151
  "ak-role resume 01abc…",