@akagilnc/pi-workflow-roles 0.1.3661 → 0.1.3663

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.
@@ -17275,6 +17275,13 @@ function instructResumeHandbookRead(prompt, engineMaterial) {
17275
17275
  return line2;
17276
17276
  }).join("\n");
17277
17277
  }
17278
+ function appendResumeMaterialReread(prompt, materialPath) {
17279
+ const instruction = resumeRereadInstruction(materialPath, false);
17280
+ const lines = prompt.split("\n");
17281
+ if (lines.includes(instruction)) return prompt;
17282
+ return prompt.length === 0 ? instruction : `${prompt}
17283
+ ${instruction}`;
17284
+ }
17278
17285
  function selectResumeContinuationPrompt(message, engineMaterial) {
17279
17286
  const base = message !== void 0 ? message : RESUME_TRANSPORT_ENVELOPE;
17280
17287
  return instructResumeHandbookRead(
@@ -22322,10 +22329,16 @@ var init_seat_ticket_binding = __esm({
22322
22329
  });
22323
22330
 
22324
22331
  // src/auditor-dossier-tool.ts
22332
+ import { dirname as dirname8, join as join16, resolve as resolve8 } from "node:path";
22333
+ function gateSubmissionCandidatePath(runDirectory) {
22334
+ return join16(runDirectory, "artifacts", GATE_SUBMISSION_CANDIDATE_FILE);
22335
+ }
22336
+ var GATE_SUBMISSION_CANDIDATE_FILE;
22325
22337
  var init_auditor_dossier_tool = __esm({
22326
22338
  "src/auditor-dossier-tool.ts"() {
22327
22339
  "use strict";
22328
22340
  init_build();
22341
+ GATE_SUBMISSION_CANDIDATE_FILE = "gate-submission-candidate.json";
22329
22342
  }
22330
22343
  });
22331
22344
 
@@ -22525,7 +22538,7 @@ var init_ledger_session_read = __esm({
22525
22538
 
22526
22539
  // src/analyst-gate-cycles-read.ts
22527
22540
  import { readdir as readdir3 } from "node:fs/promises";
22528
- import { join as join16 } from "node:path";
22541
+ import { join as join17 } from "node:path";
22529
22542
  function isRecord12(value) {
22530
22543
  return typeof value === "object" && value !== null && !Array.isArray(value);
22531
22544
  }
@@ -22786,7 +22799,7 @@ async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, opti
22786
22799
  throw error;
22787
22800
  }
22788
22801
  for (const name of names) {
22789
- const path = join16(directory, name);
22802
+ const path = join17(directory, name);
22790
22803
  const sessionPath = name.endsWith(".pointer.json") ? await resolveOfficerSessionFromPointerFile(path) : path;
22791
22804
  if (sessionPath === void 0) continue;
22792
22805
  const classified = await classifyAuditorVolume(sessionPath);
@@ -22846,7 +22859,7 @@ var init_gatekeeper_role = __esm({
22846
22859
 
22847
22860
  // src/run-terminal-artifacts.ts
22848
22861
  import { readdir as readdir4, readFile as readFile12 } from "node:fs/promises";
22849
- import { basename as basename6, dirname as dirname8, join as join17 } from "node:path";
22862
+ import { basename as basename6, dirname as dirname9, join as join18 } from "node:path";
22850
22863
  function isMissingPathError2(error) {
22851
22864
  return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
22852
22865
  }
@@ -22921,7 +22934,7 @@ async function listUniqueErrorFallbackPaths(directories) {
22921
22934
  }
22922
22935
  for (const name of names.sort((a, b) => a.localeCompare(b))) {
22923
22936
  if (!UNIQUE_ERROR_FALLBACK_NAME.test(name)) continue;
22924
- found.push(join17(dir, name));
22937
+ found.push(join18(dir, name));
22925
22938
  }
22926
22939
  }
22927
22940
  return found;
@@ -22937,14 +22950,14 @@ function presentUniqueFallbackBoundToRun(body, expectedRunId) {
22937
22950
  return typeof body.runId === "string" && body.runId === expectedRunId;
22938
22951
  }
22939
22952
  async function readRunTerminalArtifact(runDirectory) {
22940
- const artifactsDir = join17(runDirectory, "artifacts");
22953
+ const artifactsDir = join18(runDirectory, "artifacts");
22941
22954
  for (const file of RUN_TERMINAL_ARTIFACT_FILES) {
22942
- const path = join17(artifactsDir, file);
22955
+ const path = join18(artifactsDir, file);
22943
22956
  const read3 = await readTerminalArtifactAtPath(path, file);
22944
22957
  if (read3 !== void 0) return read3;
22945
22958
  }
22946
22959
  for (const relative3 of RUN_TERMINAL_ERROR_FALLBACK_RELATIVE_PATHS) {
22947
- const path = join17(runDirectory, relative3);
22960
+ const path = join18(runDirectory, relative3);
22948
22961
  const read3 = await readTerminalArtifactAtPath(path, "error.json");
22949
22962
  if (read3 !== void 0) return read3;
22950
22963
  }
@@ -22953,7 +22966,7 @@ async function readRunTerminalArtifact(runDirectory) {
22953
22966
  if (read3 !== void 0) return read3;
22954
22967
  }
22955
22968
  const expectedRunId = runIdFromRunDirectory(runDirectory);
22956
- for (const path of await listUniqueErrorFallbackPaths([dirname8(runDirectory)])) {
22969
+ for (const path of await listUniqueErrorFallbackPaths([dirname9(runDirectory)])) {
22957
22970
  const read3 = await readTerminalArtifactAtPath(path, "error.json");
22958
22971
  if (read3 === void 0) continue;
22959
22972
  if (read3.status === "present") {
@@ -23085,15 +23098,15 @@ var init_submission_ledger = __esm({
23085
23098
  // src/session-opening-materials.ts
23086
23099
  import { existsSync as existsSync8 } from "node:fs";
23087
23100
  import { readFile as readFile13 } from "node:fs/promises";
23088
- import { dirname as dirname9, join as join18 } from "node:path";
23101
+ import { dirname as dirname10, join as join19 } from "node:path";
23089
23102
  import { fileURLToPath, pathToFileURL as pathToFileURL2 } from "node:url";
23090
23103
  function resolvePackageRootDir(moduleUrl = import.meta.url) {
23091
- let dir = dirname9(fileURLToPath(moduleUrl));
23104
+ let dir = dirname10(fileURLToPath(moduleUrl));
23092
23105
  for (let i = 0; i < 8; i += 1) {
23093
- if (existsSync8(join18(dir, "package.json")) && existsSync8(join18(dir, "souls"))) {
23106
+ if (existsSync8(join19(dir, "package.json")) && existsSync8(join19(dir, "souls"))) {
23094
23107
  return dir;
23095
23108
  }
23096
- const parent = dirname9(dir);
23109
+ const parent = dirname10(dir);
23097
23110
  if (parent === dir) break;
23098
23111
  dir = parent;
23099
23112
  }
@@ -23416,12 +23429,12 @@ var init_reviewer_dispatch = __esm({
23416
23429
 
23417
23430
  // src/public-cli/reviewer-dispatch-rejection.ts
23418
23431
  import { readFile as readFile14, unlink as unlink3 } from "node:fs/promises";
23419
- import { join as join19 } from "node:path";
23432
+ import { join as join20 } from "node:path";
23420
23433
  function isReviewerPreflightViolation(value) {
23421
23434
  return typeof value === "string" && REVIEWER_PREFLIGHT_VIOLATIONS.includes(value);
23422
23435
  }
23423
23436
  function reviewerDispatchRejectionPath(runDirectory) {
23424
- return join19(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
23437
+ return join20(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
23425
23438
  }
23426
23439
  async function clearReviewerDispatchRejection(runDirectory) {
23427
23440
  try {
@@ -23630,7 +23643,7 @@ function normalizeReviewComment(raw) {
23630
23643
  function createGhApiRunner(options = {}) {
23631
23644
  const spawnImpl = options.spawnImpl ?? spawn2;
23632
23645
  return async (args, runOptions = {}) => {
23633
- return await new Promise((resolve12, reject) => {
23646
+ return await new Promise((resolve13, reject) => {
23634
23647
  const signal = runOptions.signal;
23635
23648
  if (signal?.aborted) {
23636
23649
  reject(signal.reason ?? new Error("aborted"));
@@ -23703,11 +23716,11 @@ function createGhApiRunner(options = {}) {
23703
23716
  const value = line2.slice(idx + 1).trim();
23704
23717
  headers[name] = value;
23705
23718
  }
23706
- resolve12({ status, headers, bodyText });
23719
+ resolve13({ status, headers, bodyText });
23707
23720
  return;
23708
23721
  }
23709
23722
  if (code === 0) {
23710
- resolve12({ status: 200, headers: {}, bodyText: stdout });
23723
+ resolve13({ status: 200, headers: {}, bodyText: stdout });
23711
23724
  return;
23712
23725
  }
23713
23726
  const failure = new Error(
@@ -24285,7 +24298,7 @@ var init_terminal = __esm({
24285
24298
  // src/public-cli/settlement.ts
24286
24299
  import { randomUUID as randomUUID3 } from "node:crypto";
24287
24300
  import { appendFile as appendFile2, readFile as readFile15, readdir as readdir5, writeFile as writeFile5 } from "node:fs/promises";
24288
- import { dirname as dirname10, join as join20 } from "node:path";
24301
+ import { dirname as dirname11, join as join21 } from "node:path";
24289
24302
  function sealedLedgerHome(admitted) {
24290
24303
  return homeFromRunDirectory(admitted.runDirectory);
24291
24304
  }
@@ -24660,7 +24673,7 @@ async function readSitianRetainedAuditorProviderStop(sessionFile) {
24660
24673
  kind: "auditor",
24661
24674
  sessionParent: sessionFile,
24662
24675
  // Path is driven by sessionParent when under ledger home; cwd is a fallback only.
24663
- cwd: dirname10(sessionFile)
24676
+ cwd: dirname11(sessionFile)
24664
24677
  });
24665
24678
  const { records: records2 } = await readSitianRecords(recordFile);
24666
24679
  for (let i = records2.length - 1; i >= 0; i -= 1) {
@@ -24686,7 +24699,7 @@ async function readSessionProviderStop(sessionFile) {
24686
24699
  }
24687
24700
  }
24688
24701
  async function readBoundEvidenceChildKnownFailure(sessionFile) {
24689
- const childDirectory = join20(dirname10(sessionFile), "evidence-children");
24702
+ const childDirectory = join21(dirname11(sessionFile), "evidence-children");
24690
24703
  let names;
24691
24704
  try {
24692
24705
  names = await readdir5(childDirectory);
@@ -24697,7 +24710,7 @@ async function readBoundEvidenceChildKnownFailure(sessionFile) {
24697
24710
  for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
24698
24711
  let entries;
24699
24712
  try {
24700
- entries = await readBoundSessionEntries(join20(childDirectory, file));
24713
+ entries = await readBoundSessionEntries(join21(childDirectory, file));
24701
24714
  } catch (error) {
24702
24715
  throw sessionReadFailure(error, "failed to read discovered evidence-child session");
24703
24716
  }
@@ -24751,7 +24764,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
24751
24764
  latestParentUserIndex = i;
24752
24765
  break;
24753
24766
  }
24754
- const childDirectories = [join20(dirname10(sessionFile), "auditor-roles")];
24767
+ const childDirectories = [join21(dirname11(sessionFile), "auditor-roles")];
24755
24768
  const valid = [];
24756
24769
  let sawAnyDirectory = false;
24757
24770
  for (const childDirectory of childDirectories) {
@@ -24766,7 +24779,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
24766
24779
  for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
24767
24780
  let entries;
24768
24781
  try {
24769
- entries = await readBoundSessionEntries(join20(childDirectory, file));
24782
+ entries = await readBoundSessionEntries(join21(childDirectory, file));
24770
24783
  } catch (error) {
24771
24784
  throw sessionReadFailure(error, "failed to read discovered auditor session");
24772
24785
  }
@@ -25298,8 +25311,8 @@ function projectTerminalGateFact(rounds) {
25298
25311
  };
25299
25312
  }
25300
25313
  async function extractGateFactFromSessionDirectory(sessionDirectory, options = {}) {
25301
- const directories = [join20(sessionDirectory, "auditor-roles")];
25302
- const parentSessionFile = options.parentSessionFile ?? join20(sessionDirectory, "session.jsonl");
25314
+ const directories = [join21(sessionDirectory, "auditor-roles")];
25315
+ const parentSessionFile = options.parentSessionFile ?? join21(sessionDirectory, "session.jsonl");
25303
25316
  const rounds = await readAnalystGateCyclesFromAuditorRoles(directories, {
25304
25317
  parentSessionFile
25305
25318
  });
@@ -25397,8 +25410,8 @@ async function extractNavigatorFactFromAdmittedSession(sessionFile) {
25397
25410
  async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
25398
25411
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
25399
25412
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
25400
- const reportPath = join20(artifactsDir, "report.json");
25401
- const evidencePath = join20(artifactsDir, "evidence.json");
25413
+ const reportPath = join21(artifactsDir, "report.json");
25414
+ const evidencePath = join21(artifactsDir, "evidence.json");
25402
25415
  await writeFile5(
25403
25416
  reportPath,
25404
25417
  `${JSON.stringify(
@@ -25442,8 +25455,8 @@ async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
25442
25455
  async function publishCoderArtifacts(admitted, roleOutcome, coordinates, options = {}) {
25443
25456
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
25444
25457
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
25445
- const reportPath = join20(artifactsDir, "report.json");
25446
- const evidencePath = join20(artifactsDir, "evidence.json");
25458
+ const reportPath = join21(artifactsDir, "report.json");
25459
+ const evidencePath = join21(artifactsDir, "evidence.json");
25447
25460
  await writeFile5(
25448
25461
  reportPath,
25449
25462
  `${JSON.stringify(
@@ -25594,8 +25607,8 @@ function extractFixerMethodInvocations(entries, options) {
25594
25607
  async function publishFixerArtifacts(admitted, roleOutcome, coordinates, options) {
25595
25608
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
25596
25609
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
25597
- const reportPath = join20(artifactsDir, "report.json");
25598
- const evidencePath = join20(artifactsDir, "evidence.json");
25610
+ const reportPath = join21(artifactsDir, "report.json");
25611
+ const evidencePath = join21(artifactsDir, "evidence.json");
25599
25612
  await writeFile5(
25600
25613
  reportPath,
25601
25614
  `${JSON.stringify(
@@ -25685,8 +25698,8 @@ async function settleLawfulFixerTerminalResult(admitted, authority, options) {
25685
25698
  async function publishCollectorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
25686
25699
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
25687
25700
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
25688
- const reportPath = join20(artifactsDir, "report.json");
25689
- const evidencePath = join20(artifactsDir, "evidence.json");
25701
+ const reportPath = join21(artifactsDir, "report.json");
25702
+ const evidencePath = join21(artifactsDir, "evidence.json");
25690
25703
  await writeFile5(
25691
25704
  reportPath,
25692
25705
  `${JSON.stringify(
@@ -25793,8 +25806,8 @@ async function trySettleCollectorTerminalResult(admitted, authority) {
25793
25806
  async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
25794
25807
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
25795
25808
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
25796
- const reportPath = join20(artifactsDir, "report.json");
25797
- const evidencePath = join20(artifactsDir, "evidence.json");
25809
+ const reportPath = join21(artifactsDir, "report.json");
25810
+ const evidencePath = join21(artifactsDir, "evidence.json");
25798
25811
  await writeFile5(
25799
25812
  reportPath,
25800
25813
  `${JSON.stringify(
@@ -26054,8 +26067,8 @@ function extractReviewerMethodInvocations(entries, options) {
26054
26067
  async function publishReviewerArtifacts(admitted, roleOutcome, coordinates, options) {
26055
26068
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26056
26069
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26057
- const reportPath = join20(artifactsDir, "report.json");
26058
- const evidencePath = join20(artifactsDir, "evidence.json");
26070
+ const reportPath = join21(artifactsDir, "report.json");
26071
+ const evidencePath = join21(artifactsDir, "evidence.json");
26059
26072
  await writeFile5(
26060
26073
  reportPath,
26061
26074
  `${JSON.stringify(
@@ -26169,8 +26182,8 @@ function extractMergerMethodInvocations(entries, options) {
26169
26182
  async function publishMergerArtifacts(admitted, roleOutcome, coordinates, options) {
26170
26183
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26171
26184
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26172
- const reportPath = join20(artifactsDir, "report.json");
26173
- const evidencePath = join20(artifactsDir, "evidence.json");
26185
+ const reportPath = join21(artifactsDir, "report.json");
26186
+ const evidencePath = join21(artifactsDir, "evidence.json");
26174
26187
  await writeFile5(
26175
26188
  reportPath,
26176
26189
  `${JSON.stringify(
@@ -26309,13 +26322,13 @@ function publicationAttemptFromError(path, error) {
26309
26322
  }
26310
26323
  function uniqueFailureFallbackDirs(runDirectory, baseDir) {
26311
26324
  const dirs = [];
26312
- for (const dir of [baseDir, runDirectory, dirname10(runDirectory)]) {
26325
+ for (const dir of [baseDir, runDirectory, dirname11(runDirectory)]) {
26313
26326
  if (!dirs.includes(dir)) dirs.push(dir);
26314
26327
  }
26315
26328
  return dirs;
26316
26329
  }
26317
26330
  async function resolveFailureArtifactsBase(runDirectory) {
26318
- const artifactsDir = join20(runDirectory, "artifacts");
26331
+ const artifactsDir = join21(runDirectory, "artifacts");
26319
26332
  try {
26320
26333
  await ensureRunArtifactsDir(runDirectory);
26321
26334
  return { baseDir: artifactsDir };
@@ -26331,7 +26344,7 @@ async function writeFailureJsonRetainingCause(preferredCandidates, uniqueFallbac
26331
26344
  const candidates = [
26332
26345
  ...preferredCandidates,
26333
26346
  // One unique name per fallback dir — collisions on fixed names cannot exhaust this.
26334
- ...uniqueFallbackDirs.map((dir) => join20(dir, `${stem}.${randomUUID3()}.json`))
26347
+ ...uniqueFallbackDirs.map((dir) => join21(dir, `${stem}.${randomUUID3()}.json`))
26335
26348
  ];
26336
26349
  for (let i = 0; i < candidates.length; i += 1) {
26337
26350
  const path = candidates[i];
@@ -26376,26 +26389,26 @@ async function publishFailureArtifacts(admitted, failure, authority) {
26376
26389
  } catch (error) {
26377
26390
  priorIssues.push(publicationAttemptFromError(sessionFile, error));
26378
26391
  }
26379
- const underArtifacts = baseDir === join20(admitted.runDirectory, "artifacts");
26392
+ const underArtifacts = baseDir === join21(admitted.runDirectory, "artifacts");
26380
26393
  const uniqueFallbackDirs = uniqueFailureFallbackDirs(
26381
26394
  admitted.runDirectory,
26382
26395
  baseDir
26383
26396
  );
26384
26397
  const errorCandidates = underArtifacts ? [
26385
- join20(baseDir, "error.json"),
26386
- join20(baseDir, "error.settlement.json"),
26387
- join20(admitted.runDirectory, "error.settlement.json")
26398
+ join21(baseDir, "error.json"),
26399
+ join21(baseDir, "error.settlement.json"),
26400
+ join21(admitted.runDirectory, "error.settlement.json")
26388
26401
  ] : [
26389
- join20(baseDir, "error.settlement.json"),
26390
- join20(baseDir, "error.json")
26402
+ join21(baseDir, "error.settlement.json"),
26403
+ join21(baseDir, "error.json")
26391
26404
  ];
26392
26405
  const evidenceCandidates = underArtifacts ? [
26393
- join20(baseDir, "evidence.json"),
26394
- join20(baseDir, "evidence.settlement.json"),
26395
- join20(admitted.runDirectory, "evidence.settlement.json")
26406
+ join21(baseDir, "evidence.json"),
26407
+ join21(baseDir, "evidence.settlement.json"),
26408
+ join21(admitted.runDirectory, "evidence.settlement.json")
26396
26409
  ] : [
26397
- join20(baseDir, "evidence.settlement.json"),
26398
- join20(baseDir, "evidence.json")
26410
+ join21(baseDir, "evidence.settlement.json"),
26411
+ join21(baseDir, "evidence.json")
26399
26412
  ];
26400
26413
  const errorPayloadBase = {
26401
26414
  kind: "error",
@@ -26706,7 +26719,7 @@ var init_case_dossier_delivery = __esm({
26706
26719
 
26707
26720
  // src/host-transition-prior-native.ts
26708
26721
  import { access as access2, readdir as readdir6 } from "node:fs/promises";
26709
- import { dirname as dirname11, join as join21 } from "node:path";
26722
+ import { dirname as dirname12, join as join22 } from "node:path";
26710
26723
  function isEnoent2(error) {
26711
26724
  return typeof error === "object" && error !== null && error.code === "ENOENT";
26712
26725
  }
@@ -26720,7 +26733,7 @@ async function listPiNativeRecordPaths(sessionFile) {
26720
26733
  }
26721
26734
  }
26722
26735
  async function listSitianRecordPaths(sessionParent) {
26723
- const sessionRoot = dirname11(sessionParent);
26736
+ const sessionRoot = dirname12(sessionParent);
26724
26737
  let entries;
26725
26738
  try {
26726
26739
  entries = await readdir6(sessionRoot, { withFileTypes: true });
@@ -26731,7 +26744,7 @@ async function listSitianRecordPaths(sessionParent) {
26731
26744
  const recordPaths = [];
26732
26745
  for (const entry of entries) {
26733
26746
  if (!entry.isDirectory()) continue;
26734
- const recordFile = join21(sessionRoot, entry.name, "records.jsonl");
26747
+ const recordFile = join22(sessionRoot, entry.name, "records.jsonl");
26735
26748
  try {
26736
26749
  await access2(recordFile);
26737
26750
  recordPaths.push(recordFile);
@@ -26801,7 +26814,7 @@ var init_public_run_credentials = __esm({
26801
26814
  import { constants as fsConstants } from "node:fs";
26802
26815
  import { randomUUID as randomUUID4 } from "node:crypto";
26803
26816
  import { lstat as lstat5, mkdir as mkdir4, open as open2 } from "node:fs/promises";
26804
- import { join as join22 } from "node:path";
26817
+ import { join as join23 } from "node:path";
26805
26818
  function presentTerminal(terminal, io) {
26806
26819
  if (terminal.roleOutcome.kind === "failure" || terminal.roleOutcome.kind === "no_receipt") {
26807
26820
  presentFailureTerminal(terminal, io);
@@ -26820,7 +26833,7 @@ async function finalizeExceptionRunBestEffort(runDirectory, io) {
26820
26833
  }
26821
26834
  }
26822
26835
  function runArtifactsDirectory(runDirectory) {
26823
- return join22(runDirectory, "artifacts");
26836
+ return join23(runDirectory, "artifacts");
26824
26837
  }
26825
26838
  async function ensureRealArtifactsDirectory(runDirectory) {
26826
26839
  const runStat = await lstat5(runDirectory);
@@ -26903,7 +26916,7 @@ function jsonSafeReplacer() {
26903
26916
  }
26904
26917
  async function retainDispatchError(admitted, principalAuthority, sessionAppender, attempt, error) {
26905
26918
  const artifactsDir = await ensureRealArtifactsDirectory(admitted.runDirectory);
26906
- const filePath = join22(
26919
+ const filePath = join23(
26907
26920
  artifactsDir,
26908
26921
  `dispatch-error-attempt-${attempt}-${randomUUID4()}.json`
26909
26922
  );
@@ -27152,7 +27165,7 @@ var init_auto_resume = __esm({
27152
27165
  // src/public-cli/post-admission.ts
27153
27166
  import { randomUUID as randomUUID5 } from "node:crypto";
27154
27167
  import { readFile as readFile16, writeFile as writeFile6 } from "node:fs/promises";
27155
- import { isAbsolute as isAbsolute7, join as join23, resolve as resolve8 } from "node:path";
27168
+ import { isAbsolute as isAbsolute7, join as join24, resolve as resolve9 } from "node:path";
27156
27169
  function appendContinuationSection(continuation, section) {
27157
27170
  const prompt = `${continuation.prompt}
27158
27171
 
@@ -27161,7 +27174,7 @@ ${section}`;
27161
27174
  }
27162
27175
  async function readInvocationHost(runDirectory) {
27163
27176
  try {
27164
- const raw = JSON.parse(await readFile16(join23(runDirectory, "invocation.json"), "utf8"));
27177
+ const raw = JSON.parse(await readFile16(join24(runDirectory, "invocation.json"), "utf8"));
27165
27178
  return typeof raw.host === "string" && raw.host.trim() !== "" ? raw.host : void 0;
27166
27179
  } catch (error) {
27167
27180
  if (error.code === "ENOENT") return void 0;
@@ -27315,7 +27328,7 @@ async function dispatchPostAdmissionTurn(input) {
27315
27328
  }
27316
27329
  try {
27317
27330
  await writeFile6(
27318
- join23(admitted.runDirectory, "stderr.log"),
27331
+ join24(admitted.runDirectory, "stderr.log"),
27319
27332
  result2.stderr,
27320
27333
  "utf8"
27321
27334
  );
@@ -27381,16 +27394,24 @@ async function dispatchPostAdmissionTurn(input) {
27381
27394
  }
27382
27395
  }
27383
27396
  function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepared) {
27397
+ const engineMaterial = engineSessionMaterialFromOptions({
27398
+ ...env.engine === void 0 ? {} : { engine: env.engine },
27399
+ packageRoot: env.packageRoot
27400
+ });
27384
27401
  let prompt;
27385
27402
  if (request.message !== void 0) {
27386
- if (summonsPrepared !== void 0) {
27387
- prompt = buildInstructionTransportPrompt({
27388
- instruction: request.message,
27389
- instructionEmpty: false,
27390
- attachments: summonsPrepared.attachments
27391
- });
27392
- } else if (request.summons !== void 0) {
27393
- prompt = request.message;
27403
+ if (summonsPrepared !== void 0 && summonsPrepared.attachments.length > 0) {
27404
+ prompt = instructResumeHandbookRead(
27405
+ buildInstructionTransportPrompt(
27406
+ {
27407
+ instruction: request.message,
27408
+ instructionEmpty: false,
27409
+ attachments: summonsPrepared.attachments
27410
+ },
27411
+ engineMaterial
27412
+ ),
27413
+ engineMaterial
27414
+ );
27394
27415
  } else {
27395
27416
  prompt = buildResumeContinuationPrompt({
27396
27417
  packageRoot: env.packageRoot,
@@ -27399,9 +27420,10 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
27399
27420
  });
27400
27421
  }
27401
27422
  } else if (summonsPrepared !== void 0) {
27402
- prompt = buildInstructionTransportPrompt(summonsPrepared);
27403
- } else if (request.summons !== void 0) {
27404
- prompt = RESUME_TRANSPORT_ENVELOPE;
27423
+ prompt = instructResumeHandbookRead(
27424
+ buildInstructionTransportPrompt(summonsPrepared, engineMaterial),
27425
+ engineMaterial
27426
+ );
27405
27427
  } else {
27406
27428
  prompt = buildResumeContinuationPrompt({
27407
27429
  packageRoot: env.packageRoot,
@@ -27423,8 +27445,8 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
27423
27445
  };
27424
27446
  }
27425
27447
  function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
27426
- const absolute = isAbsolute7(attachmentPath) ? attachmentPath : resolve8(attachmentPath);
27427
- return pathContainedIn(join23(runDirectory, "attachments"), absolute);
27448
+ const absolute = isAbsolute7(attachmentPath) ? attachmentPath : resolve9(attachmentPath);
27449
+ return pathContainedIn(join24(runDirectory, "attachments"), absolute);
27428
27450
  }
27429
27451
  async function prepareSummonsResumeMaterials(runDirectory, summons) {
27430
27452
  if (summons === void 0) return void 0;
@@ -27716,6 +27738,7 @@ var init_post_admission = __esm({
27716
27738
  init_cli_errors();
27717
27739
  init_invocation();
27718
27740
  init_activation_ledger_topology();
27741
+ init_engine_material();
27719
27742
  init_case_dossier_delivery();
27720
27743
  init_host_transition_prior_native();
27721
27744
  init_public_run_credentials();
@@ -28467,7 +28490,7 @@ var init_countersign_run = __esm({
28467
28490
  // src/diarist-mechanical.ts
28468
28491
  import { createHash as createHash6 } from "node:crypto";
28469
28492
  import { existsSync as existsSync9, readdirSync as readdirSync2, readFileSync as readFileSync3, realpathSync as realpathSync3, statSync as statSync2 } from "node:fs";
28470
- import { basename as basename7, join as join24, resolve as resolve9 } from "node:path";
28493
+ import { basename as basename7, join as join25, resolve as resolve10 } from "node:path";
28471
28494
  import { homedir } from "node:os";
28472
28495
  function extractCornerQuotes(text, minLength = DEFAULT_QUOTE_MIN) {
28473
28496
  const out = [];
@@ -28547,16 +28570,16 @@ function isNotificationRow(type, text) {
28547
28570
  return false;
28548
28571
  }
28549
28572
  function readCcSessionBlocks(options) {
28550
- const root = options.projectsRoot ?? join24(homedir(), ".claude", "projects");
28573
+ const root = options.projectsRoot ?? join25(homedir(), ".claude", "projects");
28551
28574
  if (!existsSync9(root)) return [];
28552
28575
  const blocks = [];
28553
28576
  const dirs = /* @__PURE__ */ new Set();
28554
28577
  for (const cwd of options.cwds) {
28555
- dirs.add(join24(root, encodeClaudeProjectDir(cwd)));
28578
+ dirs.add(join25(root, encodeClaudeProjectDir(cwd)));
28556
28579
  }
28557
28580
  for (const cwd of options.cwds) {
28558
28581
  if (cwd.includes("projects")) continue;
28559
- const direct = join24(root, cwd);
28582
+ const direct = join25(root, cwd);
28560
28583
  if (existsSync9(direct)) dirs.add(direct);
28561
28584
  }
28562
28585
  for (const dir of dirs) {
@@ -28585,7 +28608,7 @@ function readCcSessionBlocks(options) {
28585
28608
  );
28586
28609
  }
28587
28610
  for (const name of files) {
28588
- const sessionFile = join24(dir, name);
28611
+ const sessionFile = join25(dir, name);
28589
28612
  let text;
28590
28613
  try {
28591
28614
  text = readFileSync3(sessionFile, "utf8");
@@ -28681,11 +28704,11 @@ function readIssueFaceBlocks(input) {
28681
28704
  function readAdrDecisionKeyBlocks(input) {
28682
28705
  const timestamp2 = input.timestamp ?? (/* @__PURE__ */ new Date(0)).toISOString();
28683
28706
  const blocks = [];
28684
- const cwdAbs = resolve9(input.cwd);
28685
- const adrRootAbs = resolve9(cwdAbs, DIARIST_ADR_ROOT_REL);
28707
+ const cwdAbs = resolve10(input.cwd);
28708
+ const adrRootAbs = resolve10(cwdAbs, DIARIST_ADR_ROOT_REL);
28686
28709
  let adrRootReal;
28687
28710
  try {
28688
- adrRootReal = existsSync9(adrRootAbs) ? realpathSync3(adrRootAbs) : resolve9(realpathSync3(cwdAbs), DIARIST_ADR_ROOT_REL);
28711
+ adrRootReal = existsSync9(adrRootAbs) ? realpathSync3(adrRootAbs) : resolve10(realpathSync3(cwdAbs), DIARIST_ADR_ROOT_REL);
28689
28712
  } catch (error) {
28690
28713
  throw new DiaristSourceReadError(
28691
28714
  "adr-unreadable",
@@ -28699,11 +28722,11 @@ function readAdrDecisionKeyBlocks(input) {
28699
28722
  if (segments[0] !== "docs" || segments[1] !== "adr" || segments.length < 3 || segments.some((part) => part === "" || part === "." || part === "..")) {
28700
28723
  throw new DiaristSourceReadError(
28701
28724
  "adr-escape",
28702
- resolve9(cwdAbs, rel),
28725
+ resolve10(cwdAbs, rel),
28703
28726
  `diarist referenced ADR escapes docs/adr (${rel})`
28704
28727
  );
28705
28728
  }
28706
- const abs = resolve9(cwdAbs, rel);
28729
+ const abs = resolve10(cwdAbs, rel);
28707
28730
  if (abs !== adrRootAbs && !pathContainedIn(adrRootAbs, abs)) {
28708
28731
  throw new DiaristSourceReadError(
28709
28732
  "adr-escape",
@@ -28992,7 +29015,7 @@ var init_diarist = __esm({
28992
29015
  // src/public-cli/diarist-run.ts
28993
29016
  import { existsSync as existsSync10 } from "node:fs";
28994
29017
  import { writeFile as writeFile7 } from "node:fs/promises";
28995
- import { join as join25 } from "node:path";
29018
+ import { join as join26 } from "node:path";
28996
29019
  function withDiaristCatalogPath(prompt, sourcesPath) {
28997
29020
  if (sourcesPath === void 0 || sourcesPath.trim() === "") return prompt;
28998
29021
  return `${prompt}
@@ -29018,7 +29041,7 @@ function buildDiaristTurnRequest(admitted, options, sourcesPath) {
29018
29041
  }
29019
29042
  async function freezeDiaristSourceCatalog(admitted, env) {
29020
29043
  if (admitted.ticketNumber === void 0) return void 0;
29021
- const path = join25(admitted.runDirectory, DIARIST_SOURCE_CATALOG_FILE);
29044
+ const path = join26(admitted.runDirectory, DIARIST_SOURCE_CATALOG_FILE);
29022
29045
  if (existsSync10(path)) {
29023
29046
  const identity = await readRoleRunIdentity(admitted.runDirectory);
29024
29047
  if (identity !== void 0 && identity.state !== "terminal") return path;
@@ -29565,6 +29588,7 @@ var init_fixer_run = __esm({
29565
29588
  });
29566
29589
 
29567
29590
  // src/public-cli/notary-run.ts
29591
+ import { existsSync as existsSync11 } from "node:fs";
29568
29592
  function buildNotaryTurnRequest(admitted, options) {
29569
29593
  return projectRoleTurnRequest(
29570
29594
  admitted,
@@ -29706,14 +29730,19 @@ async function runPublicNotaryResume(request, env, io) {
29706
29730
  }
29707
29731
  return loaded;
29708
29732
  },
29709
- buildTurnRequest: (admitted, effective) => (
29710
- // #755: review continuation is plain dialogue / resume envelope — no
29711
- //「重新读」candidate line, no engine handbook packaging.
29712
- buildNotaryTurnRequest(
29733
+ buildTurnRequest: (admitted, effective) => {
29734
+ const projection = resumeTurnRequestProjectionOptions(
29713
29735
  admitted,
29714
- resumeTurnRequestProjectionOptions(admitted, effective, env)
29715
- )
29716
- ),
29736
+ effective,
29737
+ env
29738
+ );
29739
+ const candidatePath = gateSubmissionCandidatePath(admitted.sourceRunPath);
29740
+ const prompt = existsSync11(candidatePath) ? appendResumeMaterialReread(projection.continuation.prompt, candidatePath) : projection.continuation.prompt;
29741
+ return buildNotaryTurnRequest(admitted, {
29742
+ ...projection,
29743
+ continuation: { kind: "resume", prompt }
29744
+ });
29745
+ },
29717
29746
  adapters: notaryAdapters(),
29718
29747
  ...env.engine === void 0 ? {} : { effectiveEngine: env.engine }
29719
29748
  });
@@ -29721,6 +29750,7 @@ async function runPublicNotaryResume(request, env, io) {
29721
29750
  var init_notary_run = __esm({
29722
29751
  "src/public-cli/notary-run.ts"() {
29723
29752
  "use strict";
29753
+ init_auditor_dossier_tool();
29724
29754
  init_notary_source_run();
29725
29755
  init_engine_material();
29726
29756
  init_cli_errors();
@@ -30002,7 +30032,7 @@ var init_judge_run = __esm({
30002
30032
 
30003
30033
  // src/public-cli/merger-run.ts
30004
30034
  import { mkdir as mkdir5, writeFile as writeFile8 } from "node:fs/promises";
30005
- import { join as join26, resolve as resolve10 } from "node:path";
30035
+ import { join as join27, resolve as resolve11 } from "node:path";
30006
30036
  function mergerMethods(packageRoot2) {
30007
30037
  return [
30008
30038
  {
@@ -30044,7 +30074,7 @@ async function loadMergerMethodMaterial(packageRoot2) {
30044
30074
  );
30045
30075
  }
30046
30076
  async function admitMergerShellForActivationFailure(options) {
30047
- const projectRoot = resolve10(options.project ?? options.cwd);
30077
+ const projectRoot = resolve11(options.project ?? options.cwd);
30048
30078
  const runId = (options.createRunId ?? uuidv7)();
30049
30079
  const {
30050
30080
  principal,
@@ -30068,8 +30098,8 @@ async function admitMergerShellForActivationFailure(options) {
30068
30098
  expectedConflictPaths: [],
30069
30099
  resolutionScope: []
30070
30100
  };
30071
- const admittedRequestPath = join26(runDirectory, "admitted-request.json");
30072
- const mergerInputPath = join26(runDirectory, "merger-input.json");
30101
+ const admittedRequestPath = join27(runDirectory, "admitted-request.json");
30102
+ const mergerInputPath = join27(runDirectory, "merger-input.json");
30073
30103
  await writeFile8(
30074
30104
  admittedRequestPath,
30075
30105
  `${JSON.stringify(
@@ -30509,10 +30539,10 @@ var init_analyst_book_key = __esm({
30509
30539
  // src/atomic-write.ts
30510
30540
  import { randomUUID as randomUUID6 } from "node:crypto";
30511
30541
  import { rename, rm, writeFile as writeFile9 } from "node:fs/promises";
30512
- import { dirname as dirname12, join as join27 } from "node:path";
30542
+ import { dirname as dirname13, join as join28 } from "node:path";
30513
30543
  async function writeFileAtomically(destination, contents) {
30514
- const parent = dirname12(destination);
30515
- const temporary = join27(parent, `.atomic-write-${randomUUID6()}.tmp`);
30544
+ const parent = dirname13(destination);
30545
+ const temporary = join28(parent, `.atomic-write-${randomUUID6()}.tmp`);
30516
30546
  try {
30517
30547
  await writeFile9(temporary, contents);
30518
30548
  await rename(temporary, destination);
@@ -30529,16 +30559,16 @@ var init_atomic_write = __esm({
30529
30559
 
30530
30560
  // src/analyst-index.ts
30531
30561
  import { open as open3, readFile as readFile17, unlink as unlink4 } from "node:fs/promises";
30532
- import { dirname as dirname13, join as join28 } from "node:path";
30562
+ import { dirname as dirname14, join as join29 } from "node:path";
30533
30563
  function sleep(ms) {
30534
- return new Promise((resolve12) => {
30535
- setTimeout(resolve12, ms);
30564
+ return new Promise((resolve13) => {
30565
+ setTimeout(resolve13, ms);
30536
30566
  });
30537
30567
  }
30538
30568
  async function withAnalystLibraryIndexLock(ledgerHome, fn) {
30539
30569
  const indexPath = analystLibraryIndexPath(ledgerHome);
30540
- ensureRealDirectoryTree(ledgerHome, dirname13(indexPath));
30541
- const lockPath = join28(dirname13(indexPath), LIBRARY_INDEX_LOCK_NAME);
30570
+ ensureRealDirectoryTree(ledgerHome, dirname14(indexPath));
30571
+ const lockPath = join29(dirname14(indexPath), LIBRARY_INDEX_LOCK_NAME);
30542
30572
  assertLedgerFileInsideHome(lockPath, ledgerHome);
30543
30573
  const startedAt = Date.now();
30544
30574
  while (true) {
@@ -30565,7 +30595,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
30565
30595
  }
30566
30596
  }
30567
30597
  function analystLibraryIndexPath(ledgerHome) {
30568
- return join28(ledgerHome, "analyst", "library-index.json");
30598
+ return join29(ledgerHome, "analyst", "library-index.json");
30569
30599
  }
30570
30600
  function rowFromIssueMetricsPage(page) {
30571
30601
  return {
@@ -30674,7 +30704,7 @@ async function readAnalystLibraryIndexPage(ledgerHome) {
30674
30704
  }
30675
30705
  async function writeAnalystLibraryIndexPage(ledgerHome, page) {
30676
30706
  const path = analystLibraryIndexPath(ledgerHome);
30677
- ensureRealDirectoryTree(ledgerHome, dirname13(path));
30707
+ ensureRealDirectoryTree(ledgerHome, dirname14(path));
30678
30708
  assertLedgerFileInsideHome(path, ledgerHome);
30679
30709
  await writeFileAtomically(path, `${JSON.stringify(page, null, 2)}
30680
30710
  `);
@@ -30861,7 +30891,7 @@ var init_analyst_cohort = __esm({
30861
30891
 
30862
30892
  // src/analyst-ledger.ts
30863
30893
  import { readdir as readdir7, readFile as readFile18 } from "node:fs/promises";
30864
- import { join as join29 } from "node:path";
30894
+ import { join as join30 } from "node:path";
30865
30895
  function isMissingPathError5(error) {
30866
30896
  return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
30867
30897
  }
@@ -30874,7 +30904,7 @@ function isRecord18(value) {
30874
30904
  async function readExistingRunLifecycleState(runDirectory) {
30875
30905
  try {
30876
30906
  const raw = JSON.parse(
30877
- await readFile18(join29(runDirectory, "run-state.json"), "utf8")
30907
+ await readFile18(join30(runDirectory, "run-state.json"), "utf8")
30878
30908
  );
30879
30909
  if (!isRecord18(raw) || typeof raw.state !== "string") return void 0;
30880
30910
  return raw.state;
@@ -30906,7 +30936,7 @@ async function listLedgerBookNames(booksRoot) {
30906
30936
  async function readInvocationScopeFields(runDirectory) {
30907
30937
  let raw;
30908
30938
  try {
30909
- raw = await readFile18(join29(runDirectory, "invocation.json"), "utf8");
30939
+ raw = await readFile18(join30(runDirectory, "invocation.json"), "utf8");
30910
30940
  } catch (error) {
30911
30941
  if (isMissingPathError5(error)) return void 0;
30912
30942
  throw error;
@@ -30938,7 +30968,7 @@ function decideIssueScope(input) {
30938
30968
  }
30939
30969
  async function resolveSessionFile(runDirectory) {
30940
30970
  try {
30941
- const raw = await readFile18(join29(runDirectory, "invocation.json"), "utf8");
30971
+ const raw = await readFile18(join30(runDirectory, "invocation.json"), "utf8");
30942
30972
  const parsed = JSON.parse(raw);
30943
30973
  if (isRecord18(parsed) && typeof parsed.sessionFile === "string" && parsed.sessionFile.trim() !== "") {
30944
30974
  return parsed.sessionFile;
@@ -30946,7 +30976,7 @@ async function resolveSessionFile(runDirectory) {
30946
30976
  } catch (error) {
30947
30977
  if (!isMissingPathError5(error)) throw error;
30948
30978
  }
30949
- return join29(runDirectory, "session", "session.jsonl");
30979
+ return join30(runDirectory, "session", "session.jsonl");
30950
30980
  }
30951
30981
  function attributeSessionRowsForRun(input) {
30952
30982
  if (pathContainedIn(input.runDirectory, input.sessionFile)) {
@@ -31118,9 +31148,9 @@ async function classifyScopedRun(input) {
31118
31148
  }
31119
31149
  let gateCycles;
31120
31150
  try {
31121
- const parentSessionFile = join29(input.runDirectory, "session", "session.jsonl");
31151
+ const parentSessionFile = join30(input.runDirectory, "session", "session.jsonl");
31122
31152
  gateCycles = await readAnalystGateCyclesFromAuditorRoles(
31123
- join29(input.runDirectory, "session", "auditor-roles"),
31153
+ join30(input.runDirectory, "session", "auditor-roles"),
31124
31154
  { parentSessionFile }
31125
31155
  );
31126
31156
  } catch (error) {
@@ -31153,7 +31183,7 @@ async function classifyScopedRun(input) {
31153
31183
  async function scanAnalystIssueRuns(input) {
31154
31184
  const ledgerHome = resolveActivationLedgerHome(input.home);
31155
31185
  const scopeTicketNumber = input.ticketNumber;
31156
- const booksRoot = join29(ledgerHome, "books");
31186
+ const booksRoot = join30(ledgerHome, "books");
31157
31187
  let wholeBook = false;
31158
31188
  let scopeRootIdentity;
31159
31189
  let bookNames;
@@ -31185,7 +31215,7 @@ async function scanAnalystIssueRuns(input) {
31185
31215
  const unreadable = [];
31186
31216
  const scopeConflicts = [];
31187
31217
  for (const book of bookNames) {
31188
- const runsDir = join29(booksRoot, book, "runs");
31218
+ const runsDir = join30(booksRoot, book, "runs");
31189
31219
  let runNames;
31190
31220
  try {
31191
31221
  const entries = await readdir7(runsDir, { withFileTypes: true });
@@ -31197,7 +31227,7 @@ async function scanAnalystIssueRuns(input) {
31197
31227
  for (const runName of runNames) {
31198
31228
  const parsed = parseRunDirectoryName2(runName);
31199
31229
  if (parsed === void 0) continue;
31200
- const runDirectory = join29(runsDir, runName);
31230
+ const runDirectory = join30(runsDir, runName);
31201
31231
  let scopeFields;
31202
31232
  try {
31203
31233
  scopeFields = await readInvocationScopeFields(runDirectory);
@@ -32051,7 +32081,7 @@ var init_analyst_metric_family = __esm({
32051
32081
 
32052
32082
  // src/analyst-page.ts
32053
32083
  import { createHash as createHash7 } from "node:crypto";
32054
- import { dirname as dirname14, join as join30 } from "node:path";
32084
+ import { dirname as dirname15, join as join31 } from "node:path";
32055
32085
  function analystIssuePageKey(address) {
32056
32086
  const parts = ["book", address.bookKey];
32057
32087
  if (address.issueNumber !== void 0) {
@@ -32062,7 +32092,7 @@ function analystIssuePageKey(address) {
32062
32092
  return createHash7("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
32063
32093
  }
32064
32094
  function analystIssuePagePath(ledgerHome, address) {
32065
- return join30(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
32095
+ return join31(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
32066
32096
  }
32067
32097
  function analystIssuePageAddressFromPage(page) {
32068
32098
  return {
@@ -32181,7 +32211,7 @@ async function buildAnalystIssueMetricsPage(input) {
32181
32211
  }
32182
32212
  async function writeAnalystIssueMetricsPage(ledgerHome, page) {
32183
32213
  const path = analystIssuePagePath(ledgerHome, analystIssuePageAddressFromPage(page));
32184
- ensureRealDirectoryTree(ledgerHome, dirname14(path));
32214
+ ensureRealDirectoryTree(ledgerHome, dirname15(path));
32185
32215
  assertLedgerFileInsideHome(path, ledgerHome);
32186
32216
  await writeFileAtomically(path, `${JSON.stringify(page, null, 2)}
32187
32217
  `);
@@ -32423,7 +32453,7 @@ var init_analyst_entry = __esm({
32423
32453
 
32424
32454
  // src/public-cli/analyst-run.ts
32425
32455
  import { readFile as readFile20 } from "node:fs/promises";
32426
- import { isAbsolute as isAbsolute9, resolve as resolve11 } from "node:path";
32456
+ import { isAbsolute as isAbsolute9, resolve as resolve12 } from "node:path";
32427
32457
  function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
32428
32458
  try {
32429
32459
  return resolveBookKeyFromGit(cwd);
@@ -32472,7 +32502,7 @@ async function buildAnalystSweepModeInputFromAttachmentPaths(attachmentPaths) {
32472
32502
  );
32473
32503
  }
32474
32504
  const sourcePath = attachmentPaths[0];
32475
- const absolute = isAbsolute9(sourcePath) ? sourcePath : resolve11(sourcePath);
32505
+ const absolute = isAbsolute9(sourcePath) ? sourcePath : resolve12(sourcePath);
32476
32506
  let bytes;
32477
32507
  try {
32478
32508
  bytes = await readFile20(absolute);
@@ -32595,7 +32625,7 @@ __export(cli_exports, {
32595
32625
  runAkRole: () => runAkRole
32596
32626
  });
32597
32627
  import { realpath as realpath6 } from "node:fs/promises";
32598
- import { join as join31 } from "node:path";
32628
+ import { join as join32 } from "node:path";
32599
32629
  function takePublicGlobalFlag(argv, index, options) {
32600
32630
  const tokens = argv.slice(index);
32601
32631
  const taken = options.takeDashed(tokens);
@@ -32727,7 +32757,7 @@ function resolveHome(env) {
32727
32757
  return env.home ?? packageMachineHome();
32728
32758
  }
32729
32759
  function resolveAgentDir(env, home) {
32730
- return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join31(home, ".pi", "agent");
32760
+ return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join32(home, ".pi", "agent");
32731
32761
  }
32732
32762
  function parseThinking(value) {
32733
32763
  return value;
@@ -33682,8 +33712,8 @@ var init_cli = __esm({
33682
33712
  });
33683
33713
 
33684
33714
  // src/public-cli/main.ts
33685
- import { existsSync as existsSync11 } from "node:fs";
33686
- import { dirname as dirname15, join as join32 } from "node:path";
33715
+ import { existsSync as existsSync12 } from "node:fs";
33716
+ import { dirname as dirname16, join as join33 } from "node:path";
33687
33717
  import { fileURLToPath as fileURLToPath2 } from "node:url";
33688
33718
 
33689
33719
  // src/public-cli/host-pi-runtime.ts
@@ -33770,10 +33800,10 @@ function linkPackage(packageRoot2, name, targetDir) {
33770
33800
  }
33771
33801
 
33772
33802
  // src/public-cli/main.ts
33773
- var here = dirname15(fileURLToPath2(import.meta.url));
33803
+ var here = dirname16(fileURLToPath2(import.meta.url));
33774
33804
  function resolvePackageRoot(binDir) {
33775
- const canonical = join32(binDir, "..", "..");
33776
- if (existsSync11(join32(canonical, "package.json"))) {
33805
+ const canonical = join33(binDir, "..", "..");
33806
+ if (existsSync12(join33(canonical, "package.json"))) {
33777
33807
  return canonical;
33778
33808
  }
33779
33809
  return binDir;