@akagilnc/pi-workflow-roles 0.1.3685 → 0.1.3702

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 (54) hide show
  1. package/dist/acp-host/production-host.js +499 -559
  2. package/dist/analyst-gate-cycles-read.js +11 -1
  3. package/dist/archivist-record-entry.js +1 -1
  4. package/dist/auditor-dossier-tool.js +12 -0
  5. package/dist/dossier-resolution.js +0 -35
  6. package/dist/gatekeeper-pass-envelope.js +39 -34
  7. package/dist/gatekeeper-role.js +70 -77
  8. package/dist/judge-auditor.js +5 -24
  9. package/dist/judge-role.js +39 -42
  10. package/dist/notary-contracts.js +2 -17
  11. package/dist/notary-role.js +3 -6
  12. package/dist/package-contracts/judge-output.js +0 -2
  13. package/dist/package-contracts/terminating-tools.js +2 -2
  14. package/dist/public-cli/inspector-run.js +16 -2
  15. package/dist/public-cli/instruction-seat-run.js +14 -2
  16. package/dist/public-cli/main.js +189 -214
  17. package/dist/public-cli/notary-run.js +23 -20
  18. package/dist/public-cli/post-admission.js +30 -23
  19. package/dist/public-cli/run-lifecycle.js +6 -14
  20. package/dist/public-role-summons.js +38 -11
  21. package/dist/role-runtime.js +28 -3
  22. package/dist/submission-correctable-error.js +2 -1
  23. package/dist/submission-errors.js +26 -11
  24. package/dist/submission-ledger.js +7 -23
  25. package/extensions/role-runtime.ts +0 -2
  26. package/package.json +1 -1
  27. package/souls/countersign.md +12 -11
  28. package/souls/notary.md +5 -0
  29. package/src/acp-host/production-host.ts +1 -4
  30. package/src/acp-host/role-envelope.ts +1 -1
  31. package/src/analyst-gate-cycles-read.ts +10 -1
  32. package/src/archivist-record-entry.ts +7 -3
  33. package/src/auditor-dossier-tool.ts +21 -0
  34. package/src/dossier-resolution.ts +0 -39
  35. package/src/gatekeeper-pass-envelope.ts +59 -43
  36. package/src/gatekeeper-role.ts +114 -113
  37. package/src/host-contracts.ts +3 -3
  38. package/src/judge-auditor.ts +5 -43
  39. package/src/judge-role.ts +41 -54
  40. package/src/notary-contracts.ts +8 -27
  41. package/src/notary-role.ts +2 -7
  42. package/src/package-contracts/judge-output.ts +0 -1
  43. package/src/package-contracts/terminating-tools.ts +2 -2
  44. package/src/public-cli/inspector-run.ts +32 -2
  45. package/src/public-cli/instruction-seat-run.ts +30 -2
  46. package/src/public-cli/notary-run.ts +48 -16
  47. package/src/public-cli/post-admission.ts +31 -37
  48. package/src/public-cli/run-lifecycle.ts +6 -17
  49. package/src/public-role-summons.ts +76 -12
  50. package/src/role-runtime.ts +34 -9
  51. package/src/submission-correctable-error.ts +2 -0
  52. package/src/submission-errors.ts +28 -11
  53. package/src/submission-ledger.ts +8 -32
  54. package/dist/shape-unreadable-failure.js +0 -34
@@ -14854,26 +14854,11 @@ var init_merger_contracts = __esm({
14854
14854
  function isRecord5(value) {
14855
14855
  return typeof value === "object" && value !== null && !Array.isArray(value);
14856
14856
  }
14857
- function asStringArray2(value) {
14858
- if (!Array.isArray(value)) return [];
14859
- return value.filter((item) => typeof item === "string");
14860
- }
14861
14857
  function projectLawfulNotaryOutput(value) {
14862
14858
  if (!isRecord5(value)) return void 0;
14863
14859
  const status = typeof value.status === "string" ? value.status : void 0;
14864
- if (status === "bounce") {
14865
- const clone = structuredClone(value);
14866
- if (clone.disposition === void 0) clone.disposition = "rewrite";
14867
- if (!Array.isArray(clone.findings)) clone.findings = asStringArray2(clone.findings);
14868
- return clone;
14869
- }
14870
- if (status === "pass") {
14871
- const clone = structuredClone(value);
14872
- if (!Array.isArray(clone.findings)) clone.findings = asStringArray2(clone.findings);
14873
- return clone;
14874
- }
14875
- if (status === "escalate") {
14876
- return structuredClone(value);
14860
+ if (status === "bounce" || status === "pass" || status === "escalate") {
14861
+ return value;
14877
14862
  }
14878
14863
  return void 0;
14879
14864
  }
@@ -16764,10 +16749,10 @@ function validateAcceptedDetails(toolName, details) {
16764
16749
  [COLLECTOR_OUTPUT_TOOL]: [],
16765
16750
  [DOCTOR_OUTPUT_TOOL_NAME]: ["completed", "refused"],
16766
16751
  [MERGER_OUTPUT_TOOL_NAME]: ["completed", "escalate"],
16767
- [NOTARY_OUTPUT_TOOL_NAME]: ["pass", "bounce"],
16752
+ [NOTARY_OUTPUT_TOOL_NAME]: ["pass", "bounce", "escalate"],
16768
16753
  [COUNTERSIGN_OUTPUT_TOOL_NAME]: ["converged", "continue", "escalate"],
16769
16754
  [GLEANER_LEFT_OUTPUT_TOOL_NAME]: ["completed"],
16770
- [INSPECTOR_OUTPUT_TOOL_NAME]: ["pass", "bounce"],
16755
+ [INSPECTOR_OUTPUT_TOOL_NAME]: ["pass", "bounce", "escalate"],
16771
16756
  [GATEKEEPER_OUTPUT_TOOL_NAME]: ["dispatch", "pass"],
16772
16757
  [NAVIGATOR_OUTPUT_TOOL_NAME]: ["advice"],
16773
16758
  [AUDITOR_OUTPUT_TOOL_NAME]: ["pass", "bounce", "escalate"],
@@ -17284,13 +17269,6 @@ function instructResumeHandbookRead(prompt, engineMaterial) {
17284
17269
  return line2;
17285
17270
  }).join("\n");
17286
17271
  }
17287
- function appendResumeMaterialReread(prompt, materialPath) {
17288
- const instruction = resumeRereadInstruction(materialPath, false);
17289
- const lines = prompt.split("\n");
17290
- if (lines.includes(instruction)) return prompt;
17291
- return prompt.length === 0 ? instruction : `${prompt}
17292
- ${instruction}`;
17293
- }
17294
17272
  function selectResumeContinuationPrompt(message, engineMaterial) {
17295
17273
  const base = message !== void 0 ? message : RESUME_TRANSPORT_ENVELOPE;
17296
17274
  return instructResumeHandbookRead(
@@ -21900,16 +21878,10 @@ var init_method_skill = __esm({
21900
21878
  });
21901
21879
 
21902
21880
  // src/auditor-dossier-tool.ts
21903
- import { dirname as dirname8, join as join15, resolve as resolve8 } from "node:path";
21904
- function gateSubmissionCandidatePath(runDirectory) {
21905
- return join15(runDirectory, "artifacts", GATE_SUBMISSION_CANDIDATE_FILE);
21906
- }
21907
- var GATE_SUBMISSION_CANDIDATE_FILE;
21908
21881
  var init_auditor_dossier_tool = __esm({
21909
21882
  "src/auditor-dossier-tool.ts"() {
21910
21883
  "use strict";
21911
21884
  init_build();
21912
- GATE_SUBMISSION_CANDIDATE_FILE = "gate-submission-candidate.json";
21913
21885
  }
21914
21886
  });
21915
21887
 
@@ -22109,7 +22081,7 @@ var init_ledger_session_read = __esm({
22109
22081
 
22110
22082
  // src/analyst-gate-cycles-read.ts
22111
22083
  import { readdir as readdir3 } from "node:fs/promises";
22112
- import { join as join16 } from "node:path";
22084
+ import { join as join15 } from "node:path";
22113
22085
  function isRecord11(value) {
22114
22086
  return typeof value === "object" && value !== null && !Array.isArray(value);
22115
22087
  }
@@ -22358,6 +22330,7 @@ async function resolveOfficerSessionFromPointerFile(pointerPath) {
22358
22330
  async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, options = {}) {
22359
22331
  const directories = typeof auditorRolesDirectory === "string" ? [auditorRolesDirectory] : auditorRolesDirectory;
22360
22332
  const volumes = [];
22333
+ const classifiedOfficerSessions = /* @__PURE__ */ new Set();
22361
22334
  for (const directory of directories) {
22362
22335
  let names;
22363
22336
  try {
@@ -22370,9 +22343,14 @@ async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, opti
22370
22343
  throw error;
22371
22344
  }
22372
22345
  for (const name of names) {
22373
- const path = join16(directory, name);
22374
- const sessionPath = name.endsWith(".pointer.json") ? await resolveOfficerSessionFromPointerFile(path) : path;
22346
+ const path = join15(directory, name);
22347
+ const fromPointer = name.endsWith(".pointer.json");
22348
+ const sessionPath = fromPointer ? await resolveOfficerSessionFromPointerFile(path) : path;
22375
22349
  if (sessionPath === void 0) continue;
22350
+ if (fromPointer) {
22351
+ if (classifiedOfficerSessions.has(sessionPath)) continue;
22352
+ classifiedOfficerSessions.add(sessionPath);
22353
+ }
22376
22354
  const classified = await classifyAuditorVolume(sessionPath);
22377
22355
  for (const volume of classified) {
22378
22356
  if (options.parentSessionFile !== void 0 && volume.parentSessionFile !== void 0 && volume.parentSessionFile !== options.parentSessionFile) {
@@ -22406,32 +22384,9 @@ var init_analyst_gate_cycles_read = __esm({
22406
22384
  }
22407
22385
  });
22408
22386
 
22409
- // src/shape-unreadable-failure.ts
22410
- var init_shape_unreadable_failure = __esm({
22411
- "src/shape-unreadable-failure.ts"() {
22412
- "use strict";
22413
- }
22414
- });
22415
-
22416
- // src/gatekeeper-role.ts
22417
- var MISSING_ARGUMENTS_SUBMISSION;
22418
- var init_gatekeeper_role = __esm({
22419
- "src/gatekeeper-role.ts"() {
22420
- "use strict";
22421
- init_auditor_dossier_tool();
22422
- init_submission_errors();
22423
- init_readable_gate_item();
22424
- init_inspector_contracts();
22425
- init_gatekeeper_output();
22426
- init_shape_unreadable_failure();
22427
- init_submission_errors();
22428
- MISSING_ARGUMENTS_SUBMISSION = Object.freeze({ missing: "arguments" });
22429
- }
22430
- });
22431
-
22432
22387
  // src/run-terminal-artifacts.ts
22433
22388
  import { readdir as readdir4, readFile as readFile12 } from "node:fs/promises";
22434
- import { basename as basename6, dirname as dirname9, join as join17 } from "node:path";
22389
+ import { basename as basename6, dirname as dirname8, join as join16 } from "node:path";
22435
22390
  function isMissingPathError2(error) {
22436
22391
  return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
22437
22392
  }
@@ -22506,7 +22461,7 @@ async function listUniqueErrorFallbackPaths(directories) {
22506
22461
  }
22507
22462
  for (const name of names.sort((a, b) => a.localeCompare(b))) {
22508
22463
  if (!UNIQUE_ERROR_FALLBACK_NAME.test(name)) continue;
22509
- found.push(join17(dir, name));
22464
+ found.push(join16(dir, name));
22510
22465
  }
22511
22466
  }
22512
22467
  return found;
@@ -22522,14 +22477,14 @@ function presentUniqueFallbackBoundToRun(body, expectedRunId) {
22522
22477
  return typeof body.runId === "string" && body.runId === expectedRunId;
22523
22478
  }
22524
22479
  async function readRunTerminalArtifact(runDirectory) {
22525
- const artifactsDir = join17(runDirectory, "artifacts");
22480
+ const artifactsDir = join16(runDirectory, "artifacts");
22526
22481
  for (const file of RUN_TERMINAL_ARTIFACT_FILES) {
22527
- const path = join17(artifactsDir, file);
22482
+ const path = join16(artifactsDir, file);
22528
22483
  const read3 = await readTerminalArtifactAtPath(path, file);
22529
22484
  if (read3 !== void 0) return read3;
22530
22485
  }
22531
22486
  for (const relative3 of RUN_TERMINAL_ERROR_FALLBACK_RELATIVE_PATHS) {
22532
- const path = join17(runDirectory, relative3);
22487
+ const path = join16(runDirectory, relative3);
22533
22488
  const read3 = await readTerminalArtifactAtPath(path, "error.json");
22534
22489
  if (read3 !== void 0) return read3;
22535
22490
  }
@@ -22538,7 +22493,7 @@ async function readRunTerminalArtifact(runDirectory) {
22538
22493
  if (read3 !== void 0) return read3;
22539
22494
  }
22540
22495
  const expectedRunId = runIdFromRunDirectory(runDirectory);
22541
- for (const path of await listUniqueErrorFallbackPaths([dirname9(runDirectory)])) {
22496
+ for (const path of await listUniqueErrorFallbackPaths([dirname8(runDirectory)])) {
22542
22497
  const read3 = await readTerminalArtifactAtPath(path, "error.json");
22543
22498
  if (read3 === void 0) continue;
22544
22499
  if (read3.status === "present") {
@@ -22658,7 +22613,6 @@ var init_submission_ledger = __esm({
22658
22613
  "use strict";
22659
22614
  init_activation_ledger_topology();
22660
22615
  init_audit_escalation();
22661
- init_gatekeeper_role();
22662
22616
  init_terminating_tools();
22663
22617
  init_run_terminal_artifacts();
22664
22618
  init_sitian_facade();
@@ -22670,15 +22624,15 @@ var init_submission_ledger = __esm({
22670
22624
  // src/session-opening-materials.ts
22671
22625
  import { existsSync as existsSync6 } from "node:fs";
22672
22626
  import { readFile as readFile13 } from "node:fs/promises";
22673
- import { dirname as dirname10, join as join18 } from "node:path";
22627
+ import { dirname as dirname9, join as join17 } from "node:path";
22674
22628
  import { fileURLToPath, pathToFileURL as pathToFileURL2 } from "node:url";
22675
22629
  function resolvePackageRootDir(moduleUrl = import.meta.url) {
22676
- let dir = dirname10(fileURLToPath(moduleUrl));
22630
+ let dir = dirname9(fileURLToPath(moduleUrl));
22677
22631
  for (let i = 0; i < 8; i += 1) {
22678
- if (existsSync6(join18(dir, "package.json")) && existsSync6(join18(dir, "souls"))) {
22632
+ if (existsSync6(join17(dir, "package.json")) && existsSync6(join17(dir, "souls"))) {
22679
22633
  return dir;
22680
22634
  }
22681
- const parent = dirname10(dir);
22635
+ const parent = dirname9(dir);
22682
22636
  if (parent === dir) break;
22683
22637
  dir = parent;
22684
22638
  }
@@ -22780,7 +22734,6 @@ var init_auditor_soul = __esm({
22780
22734
  var init_dossier_resolution = __esm({
22781
22735
  "src/dossier-resolution.ts"() {
22782
22736
  "use strict";
22783
- init_judge_output();
22784
22737
  }
22785
22738
  });
22786
22739
 
@@ -22798,9 +22751,6 @@ var init_doctor_auditor = __esm({
22798
22751
  var init_judge_auditor = __esm({
22799
22752
  "src/judge-auditor.ts"() {
22800
22753
  "use strict";
22801
- init_compliance_transport();
22802
- init_auditor_dossier_tool();
22803
- init_dossier_resolution();
22804
22754
  }
22805
22755
  });
22806
22756
 
@@ -23001,12 +22951,12 @@ var init_reviewer_dispatch = __esm({
23001
22951
 
23002
22952
  // src/public-cli/reviewer-dispatch-rejection.ts
23003
22953
  import { readFile as readFile14, unlink as unlink3 } from "node:fs/promises";
23004
- import { join as join19 } from "node:path";
22954
+ import { join as join18 } from "node:path";
23005
22955
  function isReviewerPreflightViolation(value) {
23006
22956
  return typeof value === "string" && REVIEWER_PREFLIGHT_VIOLATIONS.includes(value);
23007
22957
  }
23008
22958
  function reviewerDispatchRejectionPath(runDirectory) {
23009
- return join19(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
22959
+ return join18(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
23010
22960
  }
23011
22961
  async function clearReviewerDispatchRejection(runDirectory) {
23012
22962
  try {
@@ -23215,7 +23165,7 @@ function normalizeReviewComment(raw) {
23215
23165
  function createGhApiRunner(options = {}) {
23216
23166
  const spawnImpl = options.spawnImpl ?? spawn2;
23217
23167
  return async (args, runOptions = {}) => {
23218
- return await new Promise((resolve13, reject) => {
23168
+ return await new Promise((resolve12, reject) => {
23219
23169
  const signal = runOptions.signal;
23220
23170
  if (signal?.aborted) {
23221
23171
  reject(signal.reason ?? new Error("aborted"));
@@ -23288,11 +23238,11 @@ function createGhApiRunner(options = {}) {
23288
23238
  const value = line2.slice(idx + 1).trim();
23289
23239
  headers[name] = value;
23290
23240
  }
23291
- resolve13({ status, headers, bodyText });
23241
+ resolve12({ status, headers, bodyText });
23292
23242
  return;
23293
23243
  }
23294
23244
  if (code === 0) {
23295
- resolve13({ status: 200, headers: {}, bodyText: stdout });
23245
+ resolve12({ status: 200, headers: {}, bodyText: stdout });
23296
23246
  return;
23297
23247
  }
23298
23248
  const failure = new Error(
@@ -23870,7 +23820,7 @@ var init_terminal = __esm({
23870
23820
  // src/public-cli/settlement.ts
23871
23821
  import { randomUUID as randomUUID3 } from "node:crypto";
23872
23822
  import { appendFile as appendFile2, readFile as readFile15, readdir as readdir5, writeFile as writeFile5 } from "node:fs/promises";
23873
- import { dirname as dirname11, join as join20 } from "node:path";
23823
+ import { dirname as dirname10, join as join19 } from "node:path";
23874
23824
  function sealedLedgerHome(admitted) {
23875
23825
  return homeFromRunDirectory(admitted.runDirectory);
23876
23826
  }
@@ -24245,7 +24195,7 @@ async function readSitianRetainedAuditorProviderStop(sessionFile) {
24245
24195
  kind: "auditor",
24246
24196
  sessionParent: sessionFile,
24247
24197
  // Path is driven by sessionParent when under ledger home; cwd is a fallback only.
24248
- cwd: dirname11(sessionFile)
24198
+ cwd: dirname10(sessionFile)
24249
24199
  });
24250
24200
  const { records: records2 } = await readSitianRecords(recordFile);
24251
24201
  for (let i = records2.length - 1; i >= 0; i -= 1) {
@@ -24271,7 +24221,7 @@ async function readSessionProviderStop(sessionFile) {
24271
24221
  }
24272
24222
  }
24273
24223
  async function readBoundEvidenceChildKnownFailure(sessionFile) {
24274
- const childDirectory = join20(dirname11(sessionFile), "evidence-children");
24224
+ const childDirectory = join19(dirname10(sessionFile), "evidence-children");
24275
24225
  let names;
24276
24226
  try {
24277
24227
  names = await readdir5(childDirectory);
@@ -24282,7 +24232,7 @@ async function readBoundEvidenceChildKnownFailure(sessionFile) {
24282
24232
  for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
24283
24233
  let entries;
24284
24234
  try {
24285
- entries = await readBoundSessionEntries(join20(childDirectory, file));
24235
+ entries = await readBoundSessionEntries(join19(childDirectory, file));
24286
24236
  } catch (error) {
24287
24237
  throw sessionReadFailure(error, "failed to read discovered evidence-child session");
24288
24238
  }
@@ -24336,7 +24286,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
24336
24286
  latestParentUserIndex = i;
24337
24287
  break;
24338
24288
  }
24339
- const childDirectories = [join20(dirname11(sessionFile), "auditor-roles")];
24289
+ const childDirectories = [join19(dirname10(sessionFile), "auditor-roles")];
24340
24290
  const valid = [];
24341
24291
  let sawAnyDirectory = false;
24342
24292
  for (const childDirectory of childDirectories) {
@@ -24351,7 +24301,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
24351
24301
  for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
24352
24302
  let entries;
24353
24303
  try {
24354
- entries = await readBoundSessionEntries(join20(childDirectory, file));
24304
+ entries = await readBoundSessionEntries(join19(childDirectory, file));
24355
24305
  } catch (error) {
24356
24306
  throw sessionReadFailure(error, "failed to read discovered auditor session");
24357
24307
  }
@@ -24883,8 +24833,8 @@ function projectTerminalGateFact(rounds) {
24883
24833
  };
24884
24834
  }
24885
24835
  async function extractGateFactFromSessionDirectory(sessionDirectory, options = {}) {
24886
- const directories = [join20(sessionDirectory, "auditor-roles")];
24887
- const parentSessionFile = options.parentSessionFile ?? join20(sessionDirectory, "session.jsonl");
24836
+ const directories = [join19(sessionDirectory, "auditor-roles")];
24837
+ const parentSessionFile = options.parentSessionFile ?? join19(sessionDirectory, "session.jsonl");
24888
24838
  const rounds = await readAnalystGateCyclesFromAuditorRoles(directories, {
24889
24839
  parentSessionFile
24890
24840
  });
@@ -24982,8 +24932,8 @@ async function extractNavigatorFactFromAdmittedSession(sessionFile) {
24982
24932
  async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
24983
24933
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
24984
24934
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
24985
- const reportPath = join20(artifactsDir, "report.json");
24986
- const evidencePath = join20(artifactsDir, "evidence.json");
24935
+ const reportPath = join19(artifactsDir, "report.json");
24936
+ const evidencePath = join19(artifactsDir, "evidence.json");
24987
24937
  await writeFile5(
24988
24938
  reportPath,
24989
24939
  `${JSON.stringify(
@@ -25027,8 +24977,8 @@ async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
25027
24977
  async function publishCoderArtifacts(admitted, roleOutcome, coordinates, options = {}) {
25028
24978
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
25029
24979
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
25030
- const reportPath = join20(artifactsDir, "report.json");
25031
- const evidencePath = join20(artifactsDir, "evidence.json");
24980
+ const reportPath = join19(artifactsDir, "report.json");
24981
+ const evidencePath = join19(artifactsDir, "evidence.json");
25032
24982
  await writeFile5(
25033
24983
  reportPath,
25034
24984
  `${JSON.stringify(
@@ -25179,8 +25129,8 @@ function extractFixerMethodInvocations(entries, options) {
25179
25129
  async function publishFixerArtifacts(admitted, roleOutcome, coordinates, options) {
25180
25130
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
25181
25131
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
25182
- const reportPath = join20(artifactsDir, "report.json");
25183
- const evidencePath = join20(artifactsDir, "evidence.json");
25132
+ const reportPath = join19(artifactsDir, "report.json");
25133
+ const evidencePath = join19(artifactsDir, "evidence.json");
25184
25134
  await writeFile5(
25185
25135
  reportPath,
25186
25136
  `${JSON.stringify(
@@ -25270,8 +25220,8 @@ async function settleLawfulFixerTerminalResult(admitted, authority, options) {
25270
25220
  async function publishCollectorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
25271
25221
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
25272
25222
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
25273
- const reportPath = join20(artifactsDir, "report.json");
25274
- const evidencePath = join20(artifactsDir, "evidence.json");
25223
+ const reportPath = join19(artifactsDir, "report.json");
25224
+ const evidencePath = join19(artifactsDir, "evidence.json");
25275
25225
  await writeFile5(
25276
25226
  reportPath,
25277
25227
  `${JSON.stringify(
@@ -25378,8 +25328,8 @@ async function trySettleCollectorTerminalResult(admitted, authority) {
25378
25328
  async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
25379
25329
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
25380
25330
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
25381
- const reportPath = join20(artifactsDir, "report.json");
25382
- const evidencePath = join20(artifactsDir, "evidence.json");
25331
+ const reportPath = join19(artifactsDir, "report.json");
25332
+ const evidencePath = join19(artifactsDir, "evidence.json");
25383
25333
  await writeFile5(
25384
25334
  reportPath,
25385
25335
  `${JSON.stringify(
@@ -25639,8 +25589,8 @@ function extractReviewerMethodInvocations(entries, options) {
25639
25589
  async function publishReviewerArtifacts(admitted, roleOutcome, coordinates, options) {
25640
25590
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
25641
25591
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
25642
- const reportPath = join20(artifactsDir, "report.json");
25643
- const evidencePath = join20(artifactsDir, "evidence.json");
25592
+ const reportPath = join19(artifactsDir, "report.json");
25593
+ const evidencePath = join19(artifactsDir, "evidence.json");
25644
25594
  await writeFile5(
25645
25595
  reportPath,
25646
25596
  `${JSON.stringify(
@@ -25754,8 +25704,8 @@ function extractMergerMethodInvocations(entries, options) {
25754
25704
  async function publishMergerArtifacts(admitted, roleOutcome, coordinates, options) {
25755
25705
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
25756
25706
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
25757
- const reportPath = join20(artifactsDir, "report.json");
25758
- const evidencePath = join20(artifactsDir, "evidence.json");
25707
+ const reportPath = join19(artifactsDir, "report.json");
25708
+ const evidencePath = join19(artifactsDir, "evidence.json");
25759
25709
  await writeFile5(
25760
25710
  reportPath,
25761
25711
  `${JSON.stringify(
@@ -25894,13 +25844,13 @@ function publicationAttemptFromError(path, error) {
25894
25844
  }
25895
25845
  function uniqueFailureFallbackDirs(runDirectory, baseDir) {
25896
25846
  const dirs = [];
25897
- for (const dir of [baseDir, runDirectory, dirname11(runDirectory)]) {
25847
+ for (const dir of [baseDir, runDirectory, dirname10(runDirectory)]) {
25898
25848
  if (!dirs.includes(dir)) dirs.push(dir);
25899
25849
  }
25900
25850
  return dirs;
25901
25851
  }
25902
25852
  async function resolveFailureArtifactsBase(runDirectory) {
25903
- const artifactsDir = join20(runDirectory, "artifacts");
25853
+ const artifactsDir = join19(runDirectory, "artifacts");
25904
25854
  try {
25905
25855
  await ensureRunArtifactsDir(runDirectory);
25906
25856
  return { baseDir: artifactsDir };
@@ -25916,7 +25866,7 @@ async function writeFailureJsonRetainingCause(preferredCandidates, uniqueFallbac
25916
25866
  const candidates = [
25917
25867
  ...preferredCandidates,
25918
25868
  // One unique name per fallback dir — collisions on fixed names cannot exhaust this.
25919
- ...uniqueFallbackDirs.map((dir) => join20(dir, `${stem}.${randomUUID3()}.json`))
25869
+ ...uniqueFallbackDirs.map((dir) => join19(dir, `${stem}.${randomUUID3()}.json`))
25920
25870
  ];
25921
25871
  for (let i = 0; i < candidates.length; i += 1) {
25922
25872
  const path = candidates[i];
@@ -25961,26 +25911,26 @@ async function publishFailureArtifacts(admitted, failure, authority) {
25961
25911
  } catch (error) {
25962
25912
  priorIssues.push(publicationAttemptFromError(sessionFile, error));
25963
25913
  }
25964
- const underArtifacts = baseDir === join20(admitted.runDirectory, "artifacts");
25914
+ const underArtifacts = baseDir === join19(admitted.runDirectory, "artifacts");
25965
25915
  const uniqueFallbackDirs = uniqueFailureFallbackDirs(
25966
25916
  admitted.runDirectory,
25967
25917
  baseDir
25968
25918
  );
25969
25919
  const errorCandidates = underArtifacts ? [
25970
- join20(baseDir, "error.json"),
25971
- join20(baseDir, "error.settlement.json"),
25972
- join20(admitted.runDirectory, "error.settlement.json")
25920
+ join19(baseDir, "error.json"),
25921
+ join19(baseDir, "error.settlement.json"),
25922
+ join19(admitted.runDirectory, "error.settlement.json")
25973
25923
  ] : [
25974
- join20(baseDir, "error.settlement.json"),
25975
- join20(baseDir, "error.json")
25924
+ join19(baseDir, "error.settlement.json"),
25925
+ join19(baseDir, "error.json")
25976
25926
  ];
25977
25927
  const evidenceCandidates = underArtifacts ? [
25978
- join20(baseDir, "evidence.json"),
25979
- join20(baseDir, "evidence.settlement.json"),
25980
- join20(admitted.runDirectory, "evidence.settlement.json")
25928
+ join19(baseDir, "evidence.json"),
25929
+ join19(baseDir, "evidence.settlement.json"),
25930
+ join19(admitted.runDirectory, "evidence.settlement.json")
25981
25931
  ] : [
25982
- join20(baseDir, "evidence.settlement.json"),
25983
- join20(baseDir, "evidence.json")
25932
+ join19(baseDir, "evidence.settlement.json"),
25933
+ join19(baseDir, "evidence.json")
25984
25934
  ];
25985
25935
  const errorPayloadBase = {
25986
25936
  kind: "error",
@@ -26346,7 +26296,7 @@ var init_ticket_provenance_contracts = __esm({
26346
26296
  // src/ticket-provenance.ts
26347
26297
  import { createHash as createHash5 } from "node:crypto";
26348
26298
  import { appendFileSync as appendFileSync2, existsSync as existsSync7, mkdirSync as mkdirSync3, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
26349
- import { join as join21 } from "node:path";
26299
+ import { join as join20 } from "node:path";
26350
26300
  function ticketProvenanceSubject(ticketNumber) {
26351
26301
  if (!Number.isSafeInteger(ticketNumber) || ticketNumber < 1) {
26352
26302
  throw new Error(`ticket-provenance subject requires a positive ticket number, got ${String(ticketNumber)}`);
@@ -26380,8 +26330,8 @@ function resolveTicketProvenanceVolume(ticketNumber, cwd, home) {
26380
26330
  return {
26381
26331
  recordFile: path.recordFile,
26382
26332
  volumeDir: path.sessionDir,
26383
- humanViewFile: join21(path.sessionDir, TICKET_PROVENANCE_HUMAN_VIEW),
26384
- offeredWatermarkFile: join21(path.sessionDir, TICKET_PROVENANCE_OFFERED_WATERMARK)
26333
+ humanViewFile: join20(path.sessionDir, TICKET_PROVENANCE_HUMAN_VIEW),
26334
+ offeredWatermarkFile: join20(path.sessionDir, TICKET_PROVENANCE_OFFERED_WATERMARK)
26385
26335
  };
26386
26336
  }
26387
26337
  function readOfferedIdentities(ticketNumber, cwd, home) {
@@ -26618,7 +26568,7 @@ var init_case_dossier_delivery = __esm({
26618
26568
 
26619
26569
  // src/host-transition-prior-native.ts
26620
26570
  import { access as access2, readdir as readdir6 } from "node:fs/promises";
26621
- import { dirname as dirname12, join as join22 } from "node:path";
26571
+ import { dirname as dirname11, join as join21 } from "node:path";
26622
26572
  function isEnoent2(error) {
26623
26573
  return typeof error === "object" && error !== null && error.code === "ENOENT";
26624
26574
  }
@@ -26632,7 +26582,7 @@ async function listPiNativeRecordPaths(sessionFile) {
26632
26582
  }
26633
26583
  }
26634
26584
  async function listSitianRecordPaths(sessionParent) {
26635
- const sessionRoot = dirname12(sessionParent);
26585
+ const sessionRoot = dirname11(sessionParent);
26636
26586
  let entries;
26637
26587
  try {
26638
26588
  entries = await readdir6(sessionRoot, { withFileTypes: true });
@@ -26643,7 +26593,7 @@ async function listSitianRecordPaths(sessionParent) {
26643
26593
  const recordPaths = [];
26644
26594
  for (const entry of entries) {
26645
26595
  if (!entry.isDirectory()) continue;
26646
- const recordFile = join22(sessionRoot, entry.name, "records.jsonl");
26596
+ const recordFile = join21(sessionRoot, entry.name, "records.jsonl");
26647
26597
  try {
26648
26598
  await access2(recordFile);
26649
26599
  recordPaths.push(recordFile);
@@ -26713,7 +26663,7 @@ var init_public_run_credentials = __esm({
26713
26663
  import { constants as fsConstants } from "node:fs";
26714
26664
  import { randomUUID as randomUUID4 } from "node:crypto";
26715
26665
  import { lstat as lstat5, mkdir as mkdir4, open as open2 } from "node:fs/promises";
26716
- import { join as join23 } from "node:path";
26666
+ import { join as join22 } from "node:path";
26717
26667
  function presentTerminal(terminal, io) {
26718
26668
  if (terminal.roleOutcome.kind === "failure" || terminal.roleOutcome.kind === "no_receipt") {
26719
26669
  presentFailureTerminal(terminal, io);
@@ -26732,7 +26682,7 @@ async function finalizeExceptionRunBestEffort(runDirectory, io) {
26732
26682
  }
26733
26683
  }
26734
26684
  function runArtifactsDirectory(runDirectory) {
26735
- return join23(runDirectory, "artifacts");
26685
+ return join22(runDirectory, "artifacts");
26736
26686
  }
26737
26687
  async function ensureRealArtifactsDirectory(runDirectory) {
26738
26688
  const runStat = await lstat5(runDirectory);
@@ -26815,7 +26765,7 @@ function jsonSafeReplacer() {
26815
26765
  }
26816
26766
  async function retainDispatchError(admitted, principalAuthority, sessionAppender, attempt, error) {
26817
26767
  const artifactsDir = await ensureRealArtifactsDirectory(admitted.runDirectory);
26818
- const filePath = join23(
26768
+ const filePath = join22(
26819
26769
  artifactsDir,
26820
26770
  `dispatch-error-attempt-${attempt}-${randomUUID4()}.json`
26821
26771
  );
@@ -27064,7 +27014,7 @@ var init_auto_resume = __esm({
27064
27014
  // src/public-cli/post-admission.ts
27065
27015
  import { randomUUID as randomUUID5 } from "node:crypto";
27066
27016
  import { readFile as readFile16, writeFile as writeFile6 } from "node:fs/promises";
27067
- import { isAbsolute as isAbsolute7, join as join24, resolve as resolve9 } from "node:path";
27017
+ import { isAbsolute as isAbsolute7, join as join23, resolve as resolve8 } from "node:path";
27068
27018
  function appendContinuationSection(continuation, section) {
27069
27019
  const prompt = `${continuation.prompt}
27070
27020
 
@@ -27073,7 +27023,7 @@ ${section}`;
27073
27023
  }
27074
27024
  async function readInvocationHost(runDirectory) {
27075
27025
  try {
27076
- const raw = JSON.parse(await readFile16(join24(runDirectory, "invocation.json"), "utf8"));
27026
+ const raw = JSON.parse(await readFile16(join23(runDirectory, "invocation.json"), "utf8"));
27077
27027
  return typeof raw.host === "string" && raw.host.trim() !== "" ? raw.host : void 0;
27078
27028
  } catch (error) {
27079
27029
  if (error.code === "ENOENT") return void 0;
@@ -27227,7 +27177,7 @@ async function dispatchPostAdmissionTurn(input) {
27227
27177
  }
27228
27178
  try {
27229
27179
  await writeFile6(
27230
- join24(admitted.runDirectory, "stderr.log"),
27180
+ join23(admitted.runDirectory, "stderr.log"),
27231
27181
  result2.stderr,
27232
27182
  "utf8"
27233
27183
  );
@@ -27293,24 +27243,16 @@ async function dispatchPostAdmissionTurn(input) {
27293
27243
  }
27294
27244
  }
27295
27245
  function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepared) {
27296
- const engineMaterial = engineSessionMaterialFromOptions({
27297
- ...env.engine === void 0 ? {} : { engine: env.engine },
27298
- packageRoot: env.packageRoot
27299
- });
27300
27246
  let prompt;
27301
27247
  if (request.message !== void 0) {
27302
- if (summonsPrepared !== void 0 && summonsPrepared.attachments.length > 0) {
27303
- prompt = instructResumeHandbookRead(
27304
- buildInstructionTransportPrompt(
27305
- {
27306
- instruction: request.message,
27307
- instructionEmpty: false,
27308
- attachments: summonsPrepared.attachments
27309
- },
27310
- engineMaterial
27311
- ),
27312
- engineMaterial
27313
- );
27248
+ if (summonsPrepared !== void 0) {
27249
+ prompt = buildInstructionTransportPrompt({
27250
+ instruction: request.message,
27251
+ instructionEmpty: false,
27252
+ attachments: summonsPrepared.attachments
27253
+ });
27254
+ } else if (request.summons !== void 0) {
27255
+ prompt = request.message;
27314
27256
  } else {
27315
27257
  prompt = buildResumeContinuationPrompt({
27316
27258
  packageRoot: env.packageRoot,
@@ -27319,10 +27261,9 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
27319
27261
  });
27320
27262
  }
27321
27263
  } else if (summonsPrepared !== void 0) {
27322
- prompt = instructResumeHandbookRead(
27323
- buildInstructionTransportPrompt(summonsPrepared, engineMaterial),
27324
- engineMaterial
27325
- );
27264
+ prompt = buildInstructionTransportPrompt(summonsPrepared);
27265
+ } else if (request.summons !== void 0) {
27266
+ prompt = RESUME_TRANSPORT_ENVELOPE;
27326
27267
  } else {
27327
27268
  prompt = buildResumeContinuationPrompt({
27328
27269
  packageRoot: env.packageRoot,
@@ -27344,8 +27285,8 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
27344
27285
  };
27345
27286
  }
27346
27287
  function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
27347
- const absolute = isAbsolute7(attachmentPath) ? attachmentPath : resolve9(attachmentPath);
27348
- return pathContainedIn(join24(runDirectory, "attachments"), absolute);
27288
+ const absolute = isAbsolute7(attachmentPath) ? attachmentPath : resolve8(attachmentPath);
27289
+ return pathContainedIn(join23(runDirectory, "attachments"), absolute);
27349
27290
  }
27350
27291
  async function prepareSummonsResumeMaterials(runDirectory, summons) {
27351
27292
  if (summons === void 0) return void 0;
@@ -27637,7 +27578,6 @@ var init_post_admission = __esm({
27637
27578
  init_cli_errors();
27638
27579
  init_invocation();
27639
27580
  init_activation_ledger_topology();
27640
- init_engine_material();
27641
27581
  init_case_dossier_delivery();
27642
27582
  init_host_transition_prior_native();
27643
27583
  init_public_run_credentials();
@@ -28008,9 +27948,12 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
28008
27948
  return { exitCode: 2 };
28009
27949
  }
28010
27950
  }
27951
+ const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
28011
27952
  const summons = {
28012
- instruction: parsed.instruction,
28013
- instructionEmpty: parsed.instruction.trim() === "",
27953
+ ...resumeInstruction === void 0 ? {
27954
+ instruction: parsed.instruction,
27955
+ instructionEmpty: parsed.instruction.trim() === ""
27956
+ } : { instruction: resumeInstruction, instructionEmpty: false },
28014
27957
  attachmentPaths: parsed.attachmentPaths
28015
27958
  };
28016
27959
  if (role === "auditor" && auditorSourceRun !== void 0) {
@@ -28032,6 +27975,15 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
28032
27975
  })
28033
27976
  });
28034
27977
  if (resumed !== void 0) return resumed;
27978
+ if (env.reviewReask !== void 0) {
27979
+ presentStructuralRejection(
27980
+ new CliUsageError(
27981
+ "auditor review reask requires a prior same-parent run to resume"
27982
+ ),
27983
+ io
27984
+ );
27985
+ return { exitCode: 2 };
27986
+ }
28035
27987
  }
28036
27988
  let admitted;
28037
27989
  try {
@@ -28222,7 +28174,7 @@ var init_collector_run = __esm({
28222
28174
  // src/diarist-mechanical.ts
28223
28175
  import { createHash as createHash6 } from "node:crypto";
28224
28176
  import { existsSync as existsSync8, readdirSync as readdirSync2, readFileSync as readFileSync3, realpathSync as realpathSync3, statSync as statSync2 } from "node:fs";
28225
- import { basename as basename7, join as join25, resolve as resolve10 } from "node:path";
28177
+ import { basename as basename7, join as join24, resolve as resolve9 } from "node:path";
28226
28178
  import { homedir } from "node:os";
28227
28179
  function extractCornerQuotes(text, minLength = DEFAULT_QUOTE_MIN) {
28228
28180
  const out = [];
@@ -28302,16 +28254,16 @@ function isNotificationRow(type, text) {
28302
28254
  return false;
28303
28255
  }
28304
28256
  function readCcSessionBlocks(options) {
28305
- const root = options.projectsRoot ?? join25(homedir(), ".claude", "projects");
28257
+ const root = options.projectsRoot ?? join24(homedir(), ".claude", "projects");
28306
28258
  if (!existsSync8(root)) return [];
28307
28259
  const blocks = [];
28308
28260
  const dirs = /* @__PURE__ */ new Set();
28309
28261
  for (const cwd of options.cwds) {
28310
- dirs.add(join25(root, encodeClaudeProjectDir(cwd)));
28262
+ dirs.add(join24(root, encodeClaudeProjectDir(cwd)));
28311
28263
  }
28312
28264
  for (const cwd of options.cwds) {
28313
28265
  if (cwd.includes("projects")) continue;
28314
- const direct = join25(root, cwd);
28266
+ const direct = join24(root, cwd);
28315
28267
  if (existsSync8(direct)) dirs.add(direct);
28316
28268
  }
28317
28269
  for (const dir of dirs) {
@@ -28340,7 +28292,7 @@ function readCcSessionBlocks(options) {
28340
28292
  );
28341
28293
  }
28342
28294
  for (const name of files) {
28343
- const sessionFile = join25(dir, name);
28295
+ const sessionFile = join24(dir, name);
28344
28296
  let text;
28345
28297
  try {
28346
28298
  text = readFileSync3(sessionFile, "utf8");
@@ -28436,11 +28388,11 @@ function readIssueFaceBlocks(input) {
28436
28388
  function readAdrDecisionKeyBlocks(input) {
28437
28389
  const timestamp2 = input.timestamp ?? (/* @__PURE__ */ new Date(0)).toISOString();
28438
28390
  const blocks = [];
28439
- const cwdAbs = resolve10(input.cwd);
28440
- const adrRootAbs = resolve10(cwdAbs, DIARIST_ADR_ROOT_REL);
28391
+ const cwdAbs = resolve9(input.cwd);
28392
+ const adrRootAbs = resolve9(cwdAbs, DIARIST_ADR_ROOT_REL);
28441
28393
  let adrRootReal;
28442
28394
  try {
28443
- adrRootReal = existsSync8(adrRootAbs) ? realpathSync3(adrRootAbs) : resolve10(realpathSync3(cwdAbs), DIARIST_ADR_ROOT_REL);
28395
+ adrRootReal = existsSync8(adrRootAbs) ? realpathSync3(adrRootAbs) : resolve9(realpathSync3(cwdAbs), DIARIST_ADR_ROOT_REL);
28444
28396
  } catch (error) {
28445
28397
  throw new DiaristSourceReadError(
28446
28398
  "adr-unreadable",
@@ -28454,11 +28406,11 @@ function readAdrDecisionKeyBlocks(input) {
28454
28406
  if (segments[0] !== "docs" || segments[1] !== "adr" || segments.length < 3 || segments.some((part) => part === "" || part === "." || part === "..")) {
28455
28407
  throw new DiaristSourceReadError(
28456
28408
  "adr-escape",
28457
- resolve10(cwdAbs, rel),
28409
+ resolve9(cwdAbs, rel),
28458
28410
  `diarist referenced ADR escapes docs/adr (${rel})`
28459
28411
  );
28460
28412
  }
28461
- const abs = resolve10(cwdAbs, rel);
28413
+ const abs = resolve9(cwdAbs, rel);
28462
28414
  if (abs !== adrRootAbs && !pathContainedIn(adrRootAbs, abs)) {
28463
28415
  throw new DiaristSourceReadError(
28464
28416
  "adr-escape",
@@ -28759,7 +28711,7 @@ __export(diarist_run_exports, {
28759
28711
  });
28760
28712
  import { existsSync as existsSync9 } from "node:fs";
28761
28713
  import { writeFile as writeFile7 } from "node:fs/promises";
28762
- import { join as join26 } from "node:path";
28714
+ import { join as join25 } from "node:path";
28763
28715
  function withDiaristCatalogPath(prompt, sourcesPath) {
28764
28716
  if (sourcesPath === void 0 || sourcesPath.trim() === "") return prompt;
28765
28717
  return `${prompt}
@@ -28784,7 +28736,7 @@ function buildDiaristTurnRequest(admitted, options, sourcesPath) {
28784
28736
  );
28785
28737
  }
28786
28738
  async function freezeDiaristSourceCatalog(admitted, env) {
28787
- const path = join26(admitted.runDirectory, DIARIST_SOURCE_CATALOG_FILE);
28739
+ const path = join25(admitted.runDirectory, DIARIST_SOURCE_CATALOG_FILE);
28788
28740
  if (existsSync9(path)) {
28789
28741
  const identity = await readRoleRunIdentity(admitted.runDirectory);
28790
28742
  if (identity !== void 0 && identity.state !== "terminal") return path;
@@ -29638,7 +29590,6 @@ var init_fixer_run = __esm({
29638
29590
  });
29639
29591
 
29640
29592
  // src/public-cli/notary-run.ts
29641
- import { existsSync as existsSync10 } from "node:fs";
29642
29593
  function buildNotaryTurnRequest(admitted, options) {
29643
29594
  return projectRoleTurnRequest(
29644
29595
  admitted,
@@ -29680,9 +29631,11 @@ async function runPublicNotary(argv, env, io, parseNotaryArgv2) {
29680
29631
  throw error;
29681
29632
  }
29682
29633
  {
29634
+ const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
29683
29635
  const summons = {
29684
29636
  sourceRunPath: source.runDirectory,
29685
- sourceRun: source
29637
+ sourceRun: source,
29638
+ ...resumeInstruction === void 0 ? {} : { instruction: resumeInstruction, instructionEmpty: false }
29686
29639
  };
29687
29640
  const resumed = await tryResumeSameTicketSeatRun({
29688
29641
  home: env.home,
@@ -29698,6 +29651,15 @@ async function runPublicNotary(argv, env, io, parseNotaryArgv2) {
29698
29651
  )
29699
29652
  });
29700
29653
  if (resumed !== void 0) return resumed;
29654
+ if (env.reviewReask !== void 0) {
29655
+ presentStructuralRejection(
29656
+ new CliUsageError(
29657
+ "notary review reask requires a prior same-parent run to resume"
29658
+ ),
29659
+ io
29660
+ );
29661
+ return { exitCode: 2 };
29662
+ }
29701
29663
  }
29702
29664
  let admitted;
29703
29665
  try {
@@ -29780,18 +29742,20 @@ async function runPublicNotaryResume(request, env, io) {
29780
29742
  }
29781
29743
  return loaded;
29782
29744
  },
29783
- buildTurnRequest: (admitted, effective) => {
29784
- const projection = resumeTurnRequestProjectionOptions(
29745
+ buildTurnRequest: async (admitted, effective) => {
29746
+ const summonsPrepared = effective.summons === void 0 ? void 0 : await prepareSummonsResumeMaterials(
29747
+ admitted.runDirectory,
29748
+ effective.summons
29749
+ );
29750
+ return buildNotaryTurnRequest(
29785
29751
  admitted,
29786
- effective,
29787
- env
29752
+ resumeTurnRequestProjectionOptions(
29753
+ admitted,
29754
+ effective,
29755
+ env,
29756
+ summonsPrepared
29757
+ )
29788
29758
  );
29789
- const candidatePath = gateSubmissionCandidatePath(admitted.sourceRunPath);
29790
- const prompt = existsSync10(candidatePath) ? appendResumeMaterialReread(projection.continuation.prompt, candidatePath) : projection.continuation.prompt;
29791
- return buildNotaryTurnRequest(admitted, {
29792
- ...projection,
29793
- continuation: { kind: "resume", prompt }
29794
- });
29795
29759
  },
29796
29760
  adapters: notaryAdapters(),
29797
29761
  ...env.engine === void 0 ? {} : { effectiveEngine: env.engine }
@@ -29800,7 +29764,6 @@ async function runPublicNotaryResume(request, env, io) {
29800
29764
  var init_notary_run = __esm({
29801
29765
  "src/public-cli/notary-run.ts"() {
29802
29766
  "use strict";
29803
- init_auditor_dossier_tool();
29804
29767
  init_notary_source_run();
29805
29768
  init_engine_material();
29806
29769
  init_cli_errors();
@@ -29839,9 +29802,12 @@ async function runPublicInspector(argv, env, io, parseInspectorArgv2) {
29839
29802
  const projectRoot = parsed.project ?? env.cwd;
29840
29803
  const parentRunPath = parentRunPathFromGatePointerInstruction(parsed.instruction);
29841
29804
  if (parentRunPath !== void 0) {
29805
+ const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
29842
29806
  const summons = {
29843
- instruction: parsed.instruction,
29844
- instructionEmpty: parsed.instruction.trim() === "",
29807
+ ...resumeInstruction === void 0 ? {
29808
+ instruction: parsed.instruction,
29809
+ instructionEmpty: parsed.instruction.trim() === ""
29810
+ } : { instruction: resumeInstruction, instructionEmpty: false },
29845
29811
  attachmentPaths: parsed.attachmentPaths
29846
29812
  };
29847
29813
  const resumed = await tryResumeSameTicketSeatRun({
@@ -29858,6 +29824,15 @@ async function runPublicInspector(argv, env, io, parseInspectorArgv2) {
29858
29824
  )
29859
29825
  });
29860
29826
  if (resumed !== void 0) return resumed;
29827
+ if (env.reviewReask !== void 0) {
29828
+ presentStructuralRejection(
29829
+ new CliUsageError(
29830
+ "inspector review reask requires a prior same-parent run to resume"
29831
+ ),
29832
+ io
29833
+ );
29834
+ return { exitCode: 2 };
29835
+ }
29861
29836
  }
29862
29837
  let admitted;
29863
29838
  try {
@@ -30067,7 +30042,7 @@ var init_judge_run = __esm({
30067
30042
 
30068
30043
  // src/public-cli/merger-run.ts
30069
30044
  import { mkdir as mkdir5, writeFile as writeFile8 } from "node:fs/promises";
30070
- import { join as join27, resolve as resolve11 } from "node:path";
30045
+ import { join as join26, resolve as resolve10 } from "node:path";
30071
30046
  function mergerMethods(packageRoot2) {
30072
30047
  return [
30073
30048
  {
@@ -30109,7 +30084,7 @@ async function loadMergerMethodMaterial(packageRoot2) {
30109
30084
  );
30110
30085
  }
30111
30086
  async function admitMergerShellForActivationFailure(options) {
30112
- const projectRoot = resolve11(options.project ?? options.cwd);
30087
+ const projectRoot = resolve10(options.project ?? options.cwd);
30113
30088
  const runId = (options.createRunId ?? uuidv7)();
30114
30089
  const {
30115
30090
  principal,
@@ -30133,8 +30108,8 @@ async function admitMergerShellForActivationFailure(options) {
30133
30108
  expectedConflictPaths: [],
30134
30109
  resolutionScope: []
30135
30110
  };
30136
- const admittedRequestPath = join27(runDirectory, "admitted-request.json");
30137
- const mergerInputPath = join27(runDirectory, "merger-input.json");
30111
+ const admittedRequestPath = join26(runDirectory, "admitted-request.json");
30112
+ const mergerInputPath = join26(runDirectory, "merger-input.json");
30138
30113
  await writeFile8(
30139
30114
  admittedRequestPath,
30140
30115
  `${JSON.stringify(
@@ -30574,10 +30549,10 @@ var init_analyst_book_key = __esm({
30574
30549
  // src/atomic-write.ts
30575
30550
  import { randomUUID as randomUUID6 } from "node:crypto";
30576
30551
  import { rename, rm, writeFile as writeFile9 } from "node:fs/promises";
30577
- import { dirname as dirname13, join as join28 } from "node:path";
30552
+ import { dirname as dirname12, join as join27 } from "node:path";
30578
30553
  async function writeFileAtomically(destination, contents) {
30579
- const parent = dirname13(destination);
30580
- const temporary = join28(parent, `.atomic-write-${randomUUID6()}.tmp`);
30554
+ const parent = dirname12(destination);
30555
+ const temporary = join27(parent, `.atomic-write-${randomUUID6()}.tmp`);
30581
30556
  try {
30582
30557
  await writeFile9(temporary, contents);
30583
30558
  await rename(temporary, destination);
@@ -30594,16 +30569,16 @@ var init_atomic_write = __esm({
30594
30569
 
30595
30570
  // src/analyst-index.ts
30596
30571
  import { open as open3, readFile as readFile17, unlink as unlink4 } from "node:fs/promises";
30597
- import { dirname as dirname14, join as join29 } from "node:path";
30572
+ import { dirname as dirname13, join as join28 } from "node:path";
30598
30573
  function sleep(ms) {
30599
- return new Promise((resolve13) => {
30600
- setTimeout(resolve13, ms);
30574
+ return new Promise((resolve12) => {
30575
+ setTimeout(resolve12, ms);
30601
30576
  });
30602
30577
  }
30603
30578
  async function withAnalystLibraryIndexLock(ledgerHome, fn) {
30604
30579
  const indexPath = analystLibraryIndexPath(ledgerHome);
30605
- ensureRealDirectoryTree(ledgerHome, dirname14(indexPath));
30606
- const lockPath = join29(dirname14(indexPath), LIBRARY_INDEX_LOCK_NAME);
30580
+ ensureRealDirectoryTree(ledgerHome, dirname13(indexPath));
30581
+ const lockPath = join28(dirname13(indexPath), LIBRARY_INDEX_LOCK_NAME);
30607
30582
  assertLedgerFileInsideHome(lockPath, ledgerHome);
30608
30583
  const startedAt = Date.now();
30609
30584
  while (true) {
@@ -30630,7 +30605,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
30630
30605
  }
30631
30606
  }
30632
30607
  function analystLibraryIndexPath(ledgerHome) {
30633
- return join29(ledgerHome, "analyst", "library-index.json");
30608
+ return join28(ledgerHome, "analyst", "library-index.json");
30634
30609
  }
30635
30610
  function rowFromIssueMetricsPage(page) {
30636
30611
  return {
@@ -30739,7 +30714,7 @@ async function readAnalystLibraryIndexPage(ledgerHome) {
30739
30714
  }
30740
30715
  async function writeAnalystLibraryIndexPage(ledgerHome, page) {
30741
30716
  const path = analystLibraryIndexPath(ledgerHome);
30742
- ensureRealDirectoryTree(ledgerHome, dirname14(path));
30717
+ ensureRealDirectoryTree(ledgerHome, dirname13(path));
30743
30718
  assertLedgerFileInsideHome(path, ledgerHome);
30744
30719
  await writeFileAtomically(path, `${JSON.stringify(page, null, 2)}
30745
30720
  `);
@@ -30926,7 +30901,7 @@ var init_analyst_cohort = __esm({
30926
30901
 
30927
30902
  // src/analyst-ledger.ts
30928
30903
  import { readdir as readdir7, readFile as readFile18 } from "node:fs/promises";
30929
- import { join as join30 } from "node:path";
30904
+ import { join as join29 } from "node:path";
30930
30905
  function isMissingPathError5(error) {
30931
30906
  return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
30932
30907
  }
@@ -30939,7 +30914,7 @@ function isRecord18(value) {
30939
30914
  async function readExistingRunLifecycleState(runDirectory) {
30940
30915
  try {
30941
30916
  const raw = JSON.parse(
30942
- await readFile18(join30(runDirectory, "run-state.json"), "utf8")
30917
+ await readFile18(join29(runDirectory, "run-state.json"), "utf8")
30943
30918
  );
30944
30919
  if (!isRecord18(raw) || typeof raw.state !== "string") return void 0;
30945
30920
  return raw.state;
@@ -30971,7 +30946,7 @@ async function listLedgerBookNames(booksRoot) {
30971
30946
  async function readInvocationScopeFields(runDirectory) {
30972
30947
  let raw;
30973
30948
  try {
30974
- raw = await readFile18(join30(runDirectory, "invocation.json"), "utf8");
30949
+ raw = await readFile18(join29(runDirectory, "invocation.json"), "utf8");
30975
30950
  } catch (error) {
30976
30951
  if (isMissingPathError5(error)) return void 0;
30977
30952
  throw error;
@@ -31003,7 +30978,7 @@ function decideIssueScope(input) {
31003
30978
  }
31004
30979
  async function resolveSessionFile(runDirectory) {
31005
30980
  try {
31006
- const raw = await readFile18(join30(runDirectory, "invocation.json"), "utf8");
30981
+ const raw = await readFile18(join29(runDirectory, "invocation.json"), "utf8");
31007
30982
  const parsed = JSON.parse(raw);
31008
30983
  if (isRecord18(parsed) && typeof parsed.sessionFile === "string" && parsed.sessionFile.trim() !== "") {
31009
30984
  return parsed.sessionFile;
@@ -31011,7 +30986,7 @@ async function resolveSessionFile(runDirectory) {
31011
30986
  } catch (error) {
31012
30987
  if (!isMissingPathError5(error)) throw error;
31013
30988
  }
31014
- return join30(runDirectory, "session", "session.jsonl");
30989
+ return join29(runDirectory, "session", "session.jsonl");
31015
30990
  }
31016
30991
  function attributeSessionRowsForRun(input) {
31017
30992
  if (pathContainedIn(input.runDirectory, input.sessionFile)) {
@@ -31183,9 +31158,9 @@ async function classifyScopedRun(input) {
31183
31158
  }
31184
31159
  let gateCycles;
31185
31160
  try {
31186
- const parentSessionFile = join30(input.runDirectory, "session", "session.jsonl");
31161
+ const parentSessionFile = join29(input.runDirectory, "session", "session.jsonl");
31187
31162
  gateCycles = await readAnalystGateCyclesFromAuditorRoles(
31188
- join30(input.runDirectory, "session", "auditor-roles"),
31163
+ join29(input.runDirectory, "session", "auditor-roles"),
31189
31164
  { parentSessionFile }
31190
31165
  );
31191
31166
  } catch (error) {
@@ -31218,7 +31193,7 @@ async function classifyScopedRun(input) {
31218
31193
  async function scanAnalystIssueRuns(input) {
31219
31194
  const ledgerHome = resolveActivationLedgerHome(input.home);
31220
31195
  const scopeTicketNumber = input.ticketNumber;
31221
- const booksRoot = join30(ledgerHome, "books");
31196
+ const booksRoot = join29(ledgerHome, "books");
31222
31197
  let wholeBook = false;
31223
31198
  let scopeRootIdentity;
31224
31199
  let bookNames;
@@ -31250,7 +31225,7 @@ async function scanAnalystIssueRuns(input) {
31250
31225
  const unreadable = [];
31251
31226
  const scopeConflicts = [];
31252
31227
  for (const book of bookNames) {
31253
- const runsDir = join30(booksRoot, book, "runs");
31228
+ const runsDir = join29(booksRoot, book, "runs");
31254
31229
  let runNames;
31255
31230
  try {
31256
31231
  const entries = await readdir7(runsDir, { withFileTypes: true });
@@ -31262,7 +31237,7 @@ async function scanAnalystIssueRuns(input) {
31262
31237
  for (const runName of runNames) {
31263
31238
  const parsed = parseRunDirectoryName2(runName);
31264
31239
  if (parsed === void 0) continue;
31265
- const runDirectory = join30(runsDir, runName);
31240
+ const runDirectory = join29(runsDir, runName);
31266
31241
  let scopeFields;
31267
31242
  try {
31268
31243
  scopeFields = await readInvocationScopeFields(runDirectory);
@@ -32116,7 +32091,7 @@ var init_analyst_metric_family = __esm({
32116
32091
 
32117
32092
  // src/analyst-page.ts
32118
32093
  import { createHash as createHash7 } from "node:crypto";
32119
- import { dirname as dirname15, join as join31 } from "node:path";
32094
+ import { dirname as dirname14, join as join30 } from "node:path";
32120
32095
  function analystIssuePageKey(address) {
32121
32096
  const parts = ["book", address.bookKey];
32122
32097
  if (address.issueNumber !== void 0) {
@@ -32127,7 +32102,7 @@ function analystIssuePageKey(address) {
32127
32102
  return createHash7("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
32128
32103
  }
32129
32104
  function analystIssuePagePath(ledgerHome, address) {
32130
- return join31(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
32105
+ return join30(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
32131
32106
  }
32132
32107
  function analystIssuePageAddressFromPage(page) {
32133
32108
  return {
@@ -32246,7 +32221,7 @@ async function buildAnalystIssueMetricsPage(input) {
32246
32221
  }
32247
32222
  async function writeAnalystIssueMetricsPage(ledgerHome, page) {
32248
32223
  const path = analystIssuePagePath(ledgerHome, analystIssuePageAddressFromPage(page));
32249
- ensureRealDirectoryTree(ledgerHome, dirname15(path));
32224
+ ensureRealDirectoryTree(ledgerHome, dirname14(path));
32250
32225
  assertLedgerFileInsideHome(path, ledgerHome);
32251
32226
  await writeFileAtomically(path, `${JSON.stringify(page, null, 2)}
32252
32227
  `);
@@ -32488,7 +32463,7 @@ var init_analyst_entry = __esm({
32488
32463
 
32489
32464
  // src/public-cli/analyst-run.ts
32490
32465
  import { readFile as readFile20 } from "node:fs/promises";
32491
- import { isAbsolute as isAbsolute9, resolve as resolve12 } from "node:path";
32466
+ import { isAbsolute as isAbsolute9, resolve as resolve11 } from "node:path";
32492
32467
  function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
32493
32468
  try {
32494
32469
  return resolveBookKeyFromGit(cwd);
@@ -32537,7 +32512,7 @@ async function buildAnalystSweepModeInputFromAttachmentPaths(attachmentPaths) {
32537
32512
  );
32538
32513
  }
32539
32514
  const sourcePath = attachmentPaths[0];
32540
- const absolute = isAbsolute9(sourcePath) ? sourcePath : resolve12(sourcePath);
32515
+ const absolute = isAbsolute9(sourcePath) ? sourcePath : resolve11(sourcePath);
32541
32516
  let bytes;
32542
32517
  try {
32543
32518
  bytes = await readFile20(absolute);
@@ -32660,7 +32635,7 @@ __export(cli_exports, {
32660
32635
  runAkRole: () => runAkRole
32661
32636
  });
32662
32637
  import { realpath as realpath6 } from "node:fs/promises";
32663
- import { join as join32 } from "node:path";
32638
+ import { join as join31 } from "node:path";
32664
32639
  function takePublicGlobalFlag(argv, index, options) {
32665
32640
  const tokens = argv.slice(index);
32666
32641
  const taken = options.takeDashed(tokens);
@@ -32792,7 +32767,7 @@ function resolveHome(env) {
32792
32767
  return env.home ?? packageMachineHome();
32793
32768
  }
32794
32769
  function resolveAgentDir(env, home) {
32795
- return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join32(home, ".pi", "agent");
32770
+ return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join31(home, ".pi", "agent");
32796
32771
  }
32797
32772
  function parseThinking(value) {
32798
32773
  return value;
@@ -33747,8 +33722,8 @@ var init_cli = __esm({
33747
33722
  });
33748
33723
 
33749
33724
  // src/public-cli/main.ts
33750
- import { existsSync as existsSync11 } from "node:fs";
33751
- import { dirname as dirname16, join as join33 } from "node:path";
33725
+ import { existsSync as existsSync10 } from "node:fs";
33726
+ import { dirname as dirname15, join as join32 } from "node:path";
33752
33727
  import { fileURLToPath as fileURLToPath2 } from "node:url";
33753
33728
 
33754
33729
  // src/public-cli/host-pi-runtime.ts
@@ -33835,10 +33810,10 @@ function linkPackage(packageRoot2, name, targetDir) {
33835
33810
  }
33836
33811
 
33837
33812
  // src/public-cli/main.ts
33838
- var here = dirname16(fileURLToPath2(import.meta.url));
33813
+ var here = dirname15(fileURLToPath2(import.meta.url));
33839
33814
  function resolvePackageRoot(binDir) {
33840
- const canonical = join33(binDir, "..", "..");
33841
- if (existsSync11(join33(canonical, "package.json"))) {
33815
+ const canonical = join32(binDir, "..", "..");
33816
+ if (existsSync10(join32(canonical, "package.json"))) {
33842
33817
  return canonical;
33843
33818
  }
33844
33819
  return binDir;