@akagilnc/pi-workflow-roles 0.1.3625 → 0.1.3631

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.
@@ -14902,6 +14902,7 @@ function notaryDecisiveFacts(output) {
14902
14902
  if (status === "pass" || status === "bounce") {
14903
14903
  const findings = output.findings;
14904
14904
  facts.findingsCount = Array.isArray(findings) ? findings.length : 0;
14905
+ facts.findings = Array.isArray(findings) ? findings : [];
14905
14906
  }
14906
14907
  if (status === "bounce") {
14907
14908
  facts.disposition = "rewrite";
@@ -16128,7 +16129,7 @@ async function spawnEngineDetourOnce(input) {
16128
16129
  }
16129
16130
  const command = input.argv[0];
16130
16131
  const args = input.argv.slice(1);
16131
- return await new Promise((resolve12, reject) => {
16132
+ return await new Promise((resolve13, reject) => {
16132
16133
  let settled = false;
16133
16134
  const signal = input.signal;
16134
16135
  const child = spawn(command, args, {
@@ -16158,7 +16159,7 @@ async function spawnEngineDetourOnce(input) {
16158
16159
  if (signal !== void 0) {
16159
16160
  signal.removeEventListener("abort", onAbort);
16160
16161
  }
16161
- resolve12(result2);
16162
+ resolve13(result2);
16162
16163
  };
16163
16164
  const onAbort = () => {
16164
16165
  fail4(signal !== void 0 ? abortReasonError(signal) : new Error("aborted"));
@@ -17503,10 +17504,35 @@ var init_typed_provider_http = __esm({
17503
17504
 
17504
17505
  // src/public-cli/run-lifecycle.ts
17505
17506
  import { chmod, open, readdir as readdir2, readFile as readFile8, unlink as unlink2, writeFile as writeFile4 } from "node:fs/promises";
17506
- import { join as join12 } from "node:path";
17507
+ import { isAbsolute as isAbsolute4, join as join12 } from "node:path";
17508
+ function resumeRereadInstruction(materialPath, handbook) {
17509
+ return handbook ? `\u91CD\u65B0\u8BFB ${materialPath}\uFF0C\u518D\u7EC4\u88C5\u5916\u5305 argv` : `\u91CD\u65B0\u8BFB ${materialPath}`;
17510
+ }
17511
+ function instructResumeHandbookRead(prompt, engineMaterial) {
17512
+ const handbookPath = engineMaterial?.materialPath;
17513
+ return prompt.split("\n").map((line2) => {
17514
+ if (!line2.startsWith("- ")) return line2;
17515
+ const value = line2.slice(2);
17516
+ if (handbookPath !== void 0 && value === handbookPath) {
17517
+ return resumeRereadInstruction(handbookPath, true);
17518
+ }
17519
+ if (isAbsolute4(value)) return resumeRereadInstruction(value, false);
17520
+ return line2;
17521
+ }).join("\n");
17522
+ }
17523
+ function appendResumeMaterialReread(prompt, materialPath) {
17524
+ const instruction = resumeRereadInstruction(materialPath, false);
17525
+ const lines = prompt.split("\n");
17526
+ if (lines.includes(instruction)) return prompt;
17527
+ return prompt.length === 0 ? instruction : `${prompt}
17528
+ ${instruction}`;
17529
+ }
17507
17530
  function selectResumeContinuationPrompt(message, engineMaterial) {
17508
17531
  const base = message !== void 0 ? message : RESUME_TRANSPORT_ENVELOPE;
17509
- return appendEngineSessionMaterial([base], engineMaterial).join("\n");
17532
+ return instructResumeHandbookRead(
17533
+ appendEngineSessionMaterial([base], engineMaterial).join("\n"),
17534
+ engineMaterial
17535
+ );
17510
17536
  }
17511
17537
  function buildResumeContinuationPrompt(options) {
17512
17538
  return selectResumeContinuationPrompt(
@@ -18587,7 +18613,7 @@ __export(notary_source_run_exports, {
18587
18613
  loadNotarySourceRunLocator: () => loadNotarySourceRunLocator,
18588
18614
  resolveNotarySourceRunLocator: () => resolveNotarySourceRunLocator
18589
18615
  });
18590
- import { dirname as dirname7, isAbsolute as isAbsolute4, join as join13, resolve as resolve6, basename as basename4 } from "node:path";
18616
+ import { dirname as dirname7, isAbsolute as isAbsolute5, join as join13, resolve as resolve6, basename as basename4 } from "node:path";
18591
18617
  import { lstat as lstat2, realpath as realpath3 } from "node:fs/promises";
18592
18618
  function parseRunDirectoryName(name) {
18593
18619
  const match = RUN_DIR_NAME.exec(name);
@@ -18639,7 +18665,7 @@ async function resolveNotarySourceRunLocator(options) {
18639
18665
  if (bare !== void 0 && !raw.includes("/") && !raw.includes("\\")) {
18640
18666
  candidate = join13(bookRunsRoot, `${bare.runId}@${bare.role}`);
18641
18667
  } else {
18642
- candidate = isAbsolute4(raw) ? raw : resolve6(options.projectRoot, raw);
18668
+ candidate = isAbsolute5(raw) ? raw : resolve6(options.projectRoot, raw);
18643
18669
  }
18644
18670
  const real = await requireRunDirectory(candidate, raw);
18645
18671
  const identity = parseRunDirectoryName(basename4(real));
@@ -19774,7 +19800,7 @@ import {
19774
19800
  realpath as realpath4,
19775
19801
  writeFile as writeFile5
19776
19802
  } from "node:fs/promises";
19777
- import { basename as basename5, isAbsolute as isAbsolute5, join as join14, resolve as resolve7, sep as sep3 } from "node:path";
19803
+ import { basename as basename5, isAbsolute as isAbsolute6, join as join14, resolve as resolve7, sep as sep3 } from "node:path";
19778
19804
  function issueAdmissionPlacement(authority, request) {
19779
19805
  const principal = authority.issue(request);
19780
19806
  const { sessionDirectory, sessionFile } = authority.decode(principal);
@@ -20161,7 +20187,7 @@ function parseFixerArgv(args) {
20161
20187
  };
20162
20188
  }
20163
20189
  async function freezeRegularFileAttachment(sourcePath, destinationDir, index) {
20164
- const absolute = isAbsolute5(sourcePath) ? sourcePath : resolve7(sourcePath);
20190
+ const absolute = isAbsolute6(sourcePath) ? sourcePath : resolve7(sourcePath);
20165
20191
  let st;
20166
20192
  try {
20167
20193
  st = await lstat3(absolute);
@@ -20491,7 +20517,7 @@ async function admitFixerInvocation(options) {
20491
20517
  let prerequisites = Object.freeze([]);
20492
20518
  let prerequisitesSource;
20493
20519
  if (options.prerequisitesPath !== void 0) {
20494
- const absolutePrereq = isAbsolute5(options.prerequisitesPath) ? options.prerequisitesPath : resolve7(options.prerequisitesPath);
20520
+ const absolutePrereq = isAbsolute6(options.prerequisitesPath) ? options.prerequisitesPath : resolve7(options.prerequisitesPath);
20495
20521
  try {
20496
20522
  prerequisitesSource = await readFile9(absolutePrereq, "utf8");
20497
20523
  } catch (error) {
@@ -20916,7 +20942,7 @@ async function resolveDoctorCaseRunsPath(options) {
20916
20942
  if (raw === "") {
20917
20943
  throw new CliUsageError("doctor --runs requires a path");
20918
20944
  }
20919
- if (isAbsolute5(raw)) {
20945
+ if (isAbsolute6(raw)) {
20920
20946
  throw new CliUsageError(
20921
20947
  "doctor --runs must be a project-relative path"
20922
20948
  );
@@ -22257,7 +22283,7 @@ function normalizeReviewComment(raw) {
22257
22283
  function createGhApiRunner(options = {}) {
22258
22284
  const spawnImpl = options.spawnImpl ?? spawn3;
22259
22285
  return async (args, runOptions = {}) => {
22260
- return await new Promise((resolve12, reject) => {
22286
+ return await new Promise((resolve13, reject) => {
22261
22287
  const signal = runOptions.signal;
22262
22288
  if (signal?.aborted) {
22263
22289
  reject(signal.reason ?? new Error("aborted"));
@@ -22330,11 +22356,11 @@ function createGhApiRunner(options = {}) {
22330
22356
  const value = line2.slice(idx + 1).trim();
22331
22357
  headers[name] = value;
22332
22358
  }
22333
- resolve12({ status, headers, bodyText });
22359
+ resolve13({ status, headers, bodyText });
22334
22360
  return;
22335
22361
  }
22336
22362
  if (code === 0) {
22337
- resolve12({ status: 200, headers: {}, bodyText: stdout });
22363
+ resolve13({ status: 200, headers: {}, bodyText: stdout });
22338
22364
  return;
22339
22365
  }
22340
22366
  const failure = new Error(
@@ -23778,10 +23804,16 @@ var init_seat_ticket_binding = __esm({
23778
23804
  });
23779
23805
 
23780
23806
  // src/auditor-dossier-tool.ts
23807
+ import { dirname as dirname8, join as join19, resolve as resolve9 } from "node:path";
23808
+ function gateSubmissionCandidatePath(runDirectory) {
23809
+ return join19(runDirectory, "artifacts", GATE_SUBMISSION_CANDIDATE_FILE);
23810
+ }
23811
+ var GATE_SUBMISSION_CANDIDATE_FILE;
23781
23812
  var init_auditor_dossier_tool = __esm({
23782
23813
  "src/auditor-dossier-tool.ts"() {
23783
23814
  "use strict";
23784
23815
  init_build();
23816
+ GATE_SUBMISSION_CANDIDATE_FILE = "gate-submission-candidate.json";
23785
23817
  }
23786
23818
  });
23787
23819
 
@@ -23998,7 +24030,7 @@ var init_ledger_session_read = __esm({
23998
24030
 
23999
24031
  // src/analyst-gate-cycles-read.ts
24000
24032
  import { readdir as readdir3 } from "node:fs/promises";
24001
- import { join as join19 } from "node:path";
24033
+ import { join as join20 } from "node:path";
24002
24034
  function isRecord15(value) {
24003
24035
  return typeof value === "object" && value !== null && !Array.isArray(value);
24004
24036
  }
@@ -24259,7 +24291,7 @@ async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, opti
24259
24291
  throw error;
24260
24292
  }
24261
24293
  for (const name of names) {
24262
- const path = join19(directory, name);
24294
+ const path = join20(directory, name);
24263
24295
  const sessionPath = name.endsWith(".pointer.json") ? await resolveOfficerSessionFromPointerFile(path) : path;
24264
24296
  if (sessionPath === void 0) continue;
24265
24297
  const classified = await classifyAuditorVolume(sessionPath);
@@ -24312,7 +24344,7 @@ var init_gatekeeper_role = __esm({
24312
24344
 
24313
24345
  // src/run-terminal-artifacts.ts
24314
24346
  import { readdir as readdir4, readFile as readFile12 } from "node:fs/promises";
24315
- import { basename as basename7, dirname as dirname8, join as join20 } from "node:path";
24347
+ import { basename as basename7, dirname as dirname9, join as join21 } from "node:path";
24316
24348
  function isMissingPathError2(error) {
24317
24349
  return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
24318
24350
  }
@@ -24387,7 +24419,7 @@ async function listUniqueErrorFallbackPaths(directories) {
24387
24419
  }
24388
24420
  for (const name of names.sort((a, b) => a.localeCompare(b))) {
24389
24421
  if (!UNIQUE_ERROR_FALLBACK_NAME.test(name)) continue;
24390
- found.push(join20(dir, name));
24422
+ found.push(join21(dir, name));
24391
24423
  }
24392
24424
  }
24393
24425
  return found;
@@ -24403,14 +24435,14 @@ function presentUniqueFallbackBoundToRun(body, expectedRunId) {
24403
24435
  return typeof body.runId === "string" && body.runId === expectedRunId;
24404
24436
  }
24405
24437
  async function readRunTerminalArtifact(runDirectory) {
24406
- const artifactsDir = join20(runDirectory, "artifacts");
24438
+ const artifactsDir = join21(runDirectory, "artifacts");
24407
24439
  for (const file of RUN_TERMINAL_ARTIFACT_FILES) {
24408
- const path = join20(artifactsDir, file);
24440
+ const path = join21(artifactsDir, file);
24409
24441
  const read3 = await readTerminalArtifactAtPath(path, file);
24410
24442
  if (read3 !== void 0) return read3;
24411
24443
  }
24412
24444
  for (const relative3 of RUN_TERMINAL_ERROR_FALLBACK_RELATIVE_PATHS) {
24413
- const path = join20(runDirectory, relative3);
24445
+ const path = join21(runDirectory, relative3);
24414
24446
  const read3 = await readTerminalArtifactAtPath(path, "error.json");
24415
24447
  if (read3 !== void 0) return read3;
24416
24448
  }
@@ -24419,7 +24451,7 @@ async function readRunTerminalArtifact(runDirectory) {
24419
24451
  if (read3 !== void 0) return read3;
24420
24452
  }
24421
24453
  const expectedRunId = runIdFromRunDirectory(runDirectory);
24422
- for (const path of await listUniqueErrorFallbackPaths([dirname8(runDirectory)])) {
24454
+ for (const path of await listUniqueErrorFallbackPaths([dirname9(runDirectory)])) {
24423
24455
  const read3 = await readTerminalArtifactAtPath(path, "error.json");
24424
24456
  if (read3 === void 0) continue;
24425
24457
  if (read3.status === "present") {
@@ -24551,15 +24583,15 @@ var init_submission_ledger = __esm({
24551
24583
  // src/session-opening-materials.ts
24552
24584
  import { existsSync as existsSync9 } from "node:fs";
24553
24585
  import { readFile as readFile13 } from "node:fs/promises";
24554
- import { dirname as dirname9, join as join21 } from "node:path";
24586
+ import { dirname as dirname10, join as join22 } from "node:path";
24555
24587
  import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
24556
24588
  function resolvePackageRootDir(moduleUrl = import.meta.url) {
24557
- let dir = dirname9(fileURLToPath2(moduleUrl));
24589
+ let dir = dirname10(fileURLToPath2(moduleUrl));
24558
24590
  for (let i = 0; i < 8; i += 1) {
24559
- if (existsSync9(join21(dir, "package.json")) && existsSync9(join21(dir, "souls"))) {
24591
+ if (existsSync9(join22(dir, "package.json")) && existsSync9(join22(dir, "souls"))) {
24560
24592
  return dir;
24561
24593
  }
24562
- const parent = dirname9(dir);
24594
+ const parent = dirname10(dir);
24563
24595
  if (parent === dir) break;
24564
24596
  dir = parent;
24565
24597
  }
@@ -24805,12 +24837,12 @@ var init_reviewer_dispatch = __esm({
24805
24837
 
24806
24838
  // src/public-cli/reviewer-dispatch-rejection.ts
24807
24839
  import { readFile as readFile14, unlink as unlink3 } from "node:fs/promises";
24808
- import { join as join22 } from "node:path";
24840
+ import { join as join23 } from "node:path";
24809
24841
  function isReviewerPreflightViolation(value) {
24810
24842
  return typeof value === "string" && REVIEWER_PREFLIGHT_VIOLATIONS.includes(value);
24811
24843
  }
24812
24844
  function reviewerDispatchRejectionPath(runDirectory) {
24813
- return join22(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
24845
+ return join23(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
24814
24846
  }
24815
24847
  async function clearReviewerDispatchRejection(runDirectory) {
24816
24848
  try {
@@ -25222,7 +25254,7 @@ var init_terminal = __esm({
25222
25254
  // src/public-cli/settlement.ts
25223
25255
  import { randomUUID as randomUUID3 } from "node:crypto";
25224
25256
  import { appendFile as appendFile2, readFile as readFile15, readdir as readdir5, writeFile as writeFile6 } from "node:fs/promises";
25225
- import { dirname as dirname10, join as join23 } from "node:path";
25257
+ import { dirname as dirname11, join as join24 } from "node:path";
25226
25258
  function sealedLedgerHome(admitted) {
25227
25259
  return homeFromRunDirectory(admitted.runDirectory);
25228
25260
  }
@@ -25597,7 +25629,7 @@ async function readSitianRetainedAuditorProviderStop(sessionFile) {
25597
25629
  kind: "auditor",
25598
25630
  sessionParent: sessionFile,
25599
25631
  // Path is driven by sessionParent when under ledger home; cwd is a fallback only.
25600
- cwd: dirname10(sessionFile)
25632
+ cwd: dirname11(sessionFile)
25601
25633
  });
25602
25634
  const { records: records2 } = await readSitianRecords(recordFile);
25603
25635
  for (let i = records2.length - 1; i >= 0; i -= 1) {
@@ -25623,7 +25655,7 @@ async function readSessionProviderStop(sessionFile) {
25623
25655
  }
25624
25656
  }
25625
25657
  async function readBoundEvidenceChildKnownFailure(sessionFile) {
25626
- const childDirectory = join23(dirname10(sessionFile), "evidence-children");
25658
+ const childDirectory = join24(dirname11(sessionFile), "evidence-children");
25627
25659
  let names;
25628
25660
  try {
25629
25661
  names = await readdir5(childDirectory);
@@ -25634,7 +25666,7 @@ async function readBoundEvidenceChildKnownFailure(sessionFile) {
25634
25666
  for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
25635
25667
  let entries;
25636
25668
  try {
25637
- entries = await readBoundSessionEntries(join23(childDirectory, file));
25669
+ entries = await readBoundSessionEntries(join24(childDirectory, file));
25638
25670
  } catch (error) {
25639
25671
  throw sessionReadFailure(error, "failed to read discovered evidence-child session");
25640
25672
  }
@@ -25688,7 +25720,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
25688
25720
  latestParentUserIndex = i;
25689
25721
  break;
25690
25722
  }
25691
- const childDirectories = [join23(dirname10(sessionFile), "auditor-roles")];
25723
+ const childDirectories = [join24(dirname11(sessionFile), "auditor-roles")];
25692
25724
  const valid = [];
25693
25725
  let sawAnyDirectory = false;
25694
25726
  for (const childDirectory of childDirectories) {
@@ -25703,7 +25735,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
25703
25735
  for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
25704
25736
  let entries;
25705
25737
  try {
25706
- entries = await readBoundSessionEntries(join23(childDirectory, file));
25738
+ entries = await readBoundSessionEntries(join24(childDirectory, file));
25707
25739
  } catch (error) {
25708
25740
  throw sessionReadFailure(error, "failed to read discovered auditor session");
25709
25741
  }
@@ -26481,8 +26513,8 @@ function projectTerminalGateFact(rounds) {
26481
26513
  };
26482
26514
  }
26483
26515
  async function extractGateFactFromSessionDirectory(sessionDirectory, options = {}) {
26484
- const directories = [join23(sessionDirectory, "auditor-roles")];
26485
- const parentSessionFile = options.parentSessionFile ?? join23(sessionDirectory, "session.jsonl");
26516
+ const directories = [join24(sessionDirectory, "auditor-roles")];
26517
+ const parentSessionFile = options.parentSessionFile ?? join24(sessionDirectory, "session.jsonl");
26486
26518
  const rounds = await readAnalystGateCyclesFromAuditorRoles(directories, {
26487
26519
  parentSessionFile
26488
26520
  });
@@ -26580,8 +26612,8 @@ async function extractNavigatorFactFromAdmittedSession(sessionFile) {
26580
26612
  async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
26581
26613
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26582
26614
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26583
- const reportPath = join23(artifactsDir, "report.json");
26584
- const evidencePath = join23(artifactsDir, "evidence.json");
26615
+ const reportPath = join24(artifactsDir, "report.json");
26616
+ const evidencePath = join24(artifactsDir, "evidence.json");
26585
26617
  await writeFile6(
26586
26618
  reportPath,
26587
26619
  `${JSON.stringify(
@@ -26625,8 +26657,8 @@ async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
26625
26657
  async function publishCoderArtifacts(admitted, roleOutcome, coordinates, options = {}) {
26626
26658
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26627
26659
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26628
- const reportPath = join23(artifactsDir, "report.json");
26629
- const evidencePath = join23(artifactsDir, "evidence.json");
26660
+ const reportPath = join24(artifactsDir, "report.json");
26661
+ const evidencePath = join24(artifactsDir, "evidence.json");
26630
26662
  await writeFile6(
26631
26663
  reportPath,
26632
26664
  `${JSON.stringify(
@@ -26785,8 +26817,8 @@ function extractFixerMethodInvocations(entries, options) {
26785
26817
  async function publishFixerArtifacts(admitted, roleOutcome, coordinates, options) {
26786
26818
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26787
26819
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26788
- const reportPath = join23(artifactsDir, "report.json");
26789
- const evidencePath = join23(artifactsDir, "evidence.json");
26820
+ const reportPath = join24(artifactsDir, "report.json");
26821
+ const evidencePath = join24(artifactsDir, "evidence.json");
26790
26822
  await writeFile6(
26791
26823
  reportPath,
26792
26824
  `${JSON.stringify(
@@ -26885,8 +26917,8 @@ async function settleLawfulFixerTerminalResult(admitted, authority, options) {
26885
26917
  async function publishCollectorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
26886
26918
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26887
26919
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26888
- const reportPath = join23(artifactsDir, "report.json");
26889
- const evidencePath = join23(artifactsDir, "evidence.json");
26920
+ const reportPath = join24(artifactsDir, "report.json");
26921
+ const evidencePath = join24(artifactsDir, "evidence.json");
26890
26922
  await writeFile6(
26891
26923
  reportPath,
26892
26924
  `${JSON.stringify(
@@ -26993,8 +27025,8 @@ async function trySettleCollectorTerminalResult(admitted, authority) {
26993
27025
  async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
26994
27026
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26995
27027
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26996
- const reportPath = join23(artifactsDir, "report.json");
26997
- const evidencePath = join23(artifactsDir, "evidence.json");
27028
+ const reportPath = join24(artifactsDir, "report.json");
27029
+ const evidencePath = join24(artifactsDir, "evidence.json");
26998
27030
  await writeFile6(
26999
27031
  reportPath,
27000
27032
  `${JSON.stringify(
@@ -27409,8 +27441,8 @@ function extractReviewerMethodInvocations(entries, options) {
27409
27441
  async function publishReviewerArtifacts(admitted, roleOutcome, coordinates, options) {
27410
27442
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
27411
27443
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
27412
- const reportPath = join23(artifactsDir, "report.json");
27413
- const evidencePath = join23(artifactsDir, "evidence.json");
27444
+ const reportPath = join24(artifactsDir, "report.json");
27445
+ const evidencePath = join24(artifactsDir, "evidence.json");
27414
27446
  await writeFile6(
27415
27447
  reportPath,
27416
27448
  `${JSON.stringify(
@@ -27537,8 +27569,8 @@ function extractMergerMethodInvocations(entries, options) {
27537
27569
  async function publishMergerArtifacts(admitted, roleOutcome, coordinates, options) {
27538
27570
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
27539
27571
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
27540
- const reportPath = join23(artifactsDir, "report.json");
27541
- const evidencePath = join23(artifactsDir, "evidence.json");
27572
+ const reportPath = join24(artifactsDir, "report.json");
27573
+ const evidencePath = join24(artifactsDir, "evidence.json");
27542
27574
  await writeFile6(
27543
27575
  reportPath,
27544
27576
  `${JSON.stringify(
@@ -27681,13 +27713,13 @@ function publicationAttemptFromError(path, error) {
27681
27713
  }
27682
27714
  function uniqueFailureFallbackDirs(runDirectory, baseDir) {
27683
27715
  const dirs = [];
27684
- for (const dir of [baseDir, runDirectory, dirname10(runDirectory)]) {
27716
+ for (const dir of [baseDir, runDirectory, dirname11(runDirectory)]) {
27685
27717
  if (!dirs.includes(dir)) dirs.push(dir);
27686
27718
  }
27687
27719
  return dirs;
27688
27720
  }
27689
27721
  async function resolveFailureArtifactsBase(runDirectory) {
27690
- const artifactsDir = join23(runDirectory, "artifacts");
27722
+ const artifactsDir = join24(runDirectory, "artifacts");
27691
27723
  try {
27692
27724
  await ensureRunArtifactsDir(runDirectory);
27693
27725
  return { baseDir: artifactsDir };
@@ -27703,7 +27735,7 @@ async function writeFailureJsonRetainingCause(preferredCandidates, uniqueFallbac
27703
27735
  const candidates = [
27704
27736
  ...preferredCandidates,
27705
27737
  // One unique name per fallback dir — collisions on fixed names cannot exhaust this.
27706
- ...uniqueFallbackDirs.map((dir) => join23(dir, `${stem}.${randomUUID3()}.json`))
27738
+ ...uniqueFallbackDirs.map((dir) => join24(dir, `${stem}.${randomUUID3()}.json`))
27707
27739
  ];
27708
27740
  for (let i = 0; i < candidates.length; i += 1) {
27709
27741
  const path = candidates[i];
@@ -27748,26 +27780,26 @@ async function publishFailureArtifacts(admitted, failure, authority) {
27748
27780
  } catch (error) {
27749
27781
  priorIssues.push(publicationAttemptFromError(sessionFile, error));
27750
27782
  }
27751
- const underArtifacts = baseDir === join23(admitted.runDirectory, "artifacts");
27783
+ const underArtifacts = baseDir === join24(admitted.runDirectory, "artifacts");
27752
27784
  const uniqueFallbackDirs = uniqueFailureFallbackDirs(
27753
27785
  admitted.runDirectory,
27754
27786
  baseDir
27755
27787
  );
27756
27788
  const errorCandidates = underArtifacts ? [
27757
- join23(baseDir, "error.json"),
27758
- join23(baseDir, "error.settlement.json"),
27759
- join23(admitted.runDirectory, "error.settlement.json")
27789
+ join24(baseDir, "error.json"),
27790
+ join24(baseDir, "error.settlement.json"),
27791
+ join24(admitted.runDirectory, "error.settlement.json")
27760
27792
  ] : [
27761
- join23(baseDir, "error.settlement.json"),
27762
- join23(baseDir, "error.json")
27793
+ join24(baseDir, "error.settlement.json"),
27794
+ join24(baseDir, "error.json")
27763
27795
  ];
27764
27796
  const evidenceCandidates = underArtifacts ? [
27765
- join23(baseDir, "evidence.json"),
27766
- join23(baseDir, "evidence.settlement.json"),
27767
- join23(admitted.runDirectory, "evidence.settlement.json")
27797
+ join24(baseDir, "evidence.json"),
27798
+ join24(baseDir, "evidence.settlement.json"),
27799
+ join24(admitted.runDirectory, "evidence.settlement.json")
27768
27800
  ] : [
27769
- join23(baseDir, "evidence.settlement.json"),
27770
- join23(baseDir, "evidence.json")
27801
+ join24(baseDir, "evidence.settlement.json"),
27802
+ join24(baseDir, "evidence.json")
27771
27803
  ];
27772
27804
  const errorPayloadBase = {
27773
27805
  kind: "error",
@@ -28043,7 +28075,7 @@ var init_turn_request = __esm({
28043
28075
 
28044
28076
  // src/host-transition-prior-native.ts
28045
28077
  import { access as access2, readdir as readdir6 } from "node:fs/promises";
28046
- import { dirname as dirname11, join as join24 } from "node:path";
28078
+ import { dirname as dirname12, join as join25 } from "node:path";
28047
28079
  function isEnoent2(error) {
28048
28080
  return typeof error === "object" && error !== null && error.code === "ENOENT";
28049
28081
  }
@@ -28057,7 +28089,7 @@ async function listPiNativeRecordPaths(sessionFile) {
28057
28089
  }
28058
28090
  }
28059
28091
  async function listSitianRecordPaths(sessionParent) {
28060
- const sessionRoot = dirname11(sessionParent);
28092
+ const sessionRoot = dirname12(sessionParent);
28061
28093
  let entries;
28062
28094
  try {
28063
28095
  entries = await readdir6(sessionRoot, { withFileTypes: true });
@@ -28068,7 +28100,7 @@ async function listSitianRecordPaths(sessionParent) {
28068
28100
  const recordPaths = [];
28069
28101
  for (const entry of entries) {
28070
28102
  if (!entry.isDirectory()) continue;
28071
- const recordFile = join24(sessionRoot, entry.name, "records.jsonl");
28103
+ const recordFile = join25(sessionRoot, entry.name, "records.jsonl");
28072
28104
  try {
28073
28105
  await access2(recordFile);
28074
28106
  recordPaths.push(recordFile);
@@ -28138,7 +28170,7 @@ var init_public_run_credentials = __esm({
28138
28170
  import { constants as fsConstants } from "node:fs";
28139
28171
  import { randomUUID as randomUUID4 } from "node:crypto";
28140
28172
  import { lstat as lstat5, mkdir as mkdir4, open as open2 } from "node:fs/promises";
28141
- import { join as join25 } from "node:path";
28173
+ import { join as join26 } from "node:path";
28142
28174
  function presentTerminal(terminal, io) {
28143
28175
  if (terminal.roleOutcome.kind === "failure" || terminal.roleOutcome.kind === "no_receipt") {
28144
28176
  presentFailureTerminal(terminal, io);
@@ -28157,7 +28189,7 @@ async function finalizeExceptionRunBestEffort(runDirectory, io) {
28157
28189
  }
28158
28190
  }
28159
28191
  function runArtifactsDirectory(runDirectory) {
28160
- return join25(runDirectory, "artifacts");
28192
+ return join26(runDirectory, "artifacts");
28161
28193
  }
28162
28194
  async function ensureRealArtifactsDirectory(runDirectory) {
28163
28195
  const runStat = await lstat5(runDirectory);
@@ -28240,7 +28272,7 @@ function jsonSafeReplacer() {
28240
28272
  }
28241
28273
  async function retainDispatchError(admitted, principalAuthority, sessionAppender, attempt, error) {
28242
28274
  const artifactsDir = await ensureRealArtifactsDirectory(admitted.runDirectory);
28243
- const filePath = join25(
28275
+ const filePath = join26(
28244
28276
  artifactsDir,
28245
28277
  `dispatch-error-attempt-${attempt}-${randomUUID4()}.json`
28246
28278
  );
@@ -28489,10 +28521,10 @@ var init_auto_resume = __esm({
28489
28521
  // src/public-cli/post-admission.ts
28490
28522
  import { randomUUID as randomUUID5 } from "node:crypto";
28491
28523
  import { readFile as readFile16, writeFile as writeFile7 } from "node:fs/promises";
28492
- import { isAbsolute as isAbsolute6, join as join26, resolve as resolve9 } from "node:path";
28524
+ import { isAbsolute as isAbsolute7, join as join27, resolve as resolve10 } from "node:path";
28493
28525
  async function readInvocationHost(runDirectory) {
28494
28526
  try {
28495
- const raw = JSON.parse(await readFile16(join26(runDirectory, "invocation.json"), "utf8"));
28527
+ const raw = JSON.parse(await readFile16(join27(runDirectory, "invocation.json"), "utf8"));
28496
28528
  return typeof raw.host === "string" && raw.host.trim() !== "" ? raw.host : void 0;
28497
28529
  } catch (error) {
28498
28530
  if (error.code === "ENOENT") return void 0;
@@ -28632,7 +28664,7 @@ async function dispatchPostAdmissionTurn(input) {
28632
28664
  }
28633
28665
  try {
28634
28666
  await writeFile7(
28635
- join26(admitted.runDirectory, "stderr.log"),
28667
+ join27(admitted.runDirectory, "stderr.log"),
28636
28668
  result2.stderr,
28637
28669
  "utf8"
28638
28670
  );
@@ -28705,12 +28737,15 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
28705
28737
  let prompt;
28706
28738
  if (request.message !== void 0) {
28707
28739
  if (summonsPrepared !== void 0 && summonsPrepared.attachments.length > 0) {
28708
- prompt = buildInstructionTransportPrompt(
28709
- {
28710
- instruction: request.message,
28711
- instructionEmpty: false,
28712
- attachments: summonsPrepared.attachments
28713
- },
28740
+ prompt = instructResumeHandbookRead(
28741
+ buildInstructionTransportPrompt(
28742
+ {
28743
+ instruction: request.message,
28744
+ instructionEmpty: false,
28745
+ attachments: summonsPrepared.attachments
28746
+ },
28747
+ engineMaterial
28748
+ ),
28714
28749
  engineMaterial
28715
28750
  );
28716
28751
  } else {
@@ -28721,7 +28756,10 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
28721
28756
  });
28722
28757
  }
28723
28758
  } else if (summonsPrepared !== void 0) {
28724
- prompt = buildInstructionTransportPrompt(summonsPrepared, engineMaterial);
28759
+ prompt = instructResumeHandbookRead(
28760
+ buildInstructionTransportPrompt(summonsPrepared, engineMaterial),
28761
+ engineMaterial
28762
+ );
28725
28763
  } else {
28726
28764
  prompt = buildResumeContinuationPrompt({
28727
28765
  packageRoot: env.packageRoot,
@@ -28743,8 +28781,8 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
28743
28781
  };
28744
28782
  }
28745
28783
  function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
28746
- const absolute = isAbsolute6(attachmentPath) ? attachmentPath : resolve9(attachmentPath);
28747
- return pathContainedIn(join26(runDirectory, "attachments"), absolute);
28784
+ const absolute = isAbsolute7(attachmentPath) ? attachmentPath : resolve10(attachmentPath);
28785
+ return pathContainedIn(join27(runDirectory, "attachments"), absolute);
28748
28786
  }
28749
28787
  async function prepareSummonsResumeMaterials(runDirectory, summons) {
28750
28788
  if (summons === void 0) return void 0;
@@ -29775,7 +29813,7 @@ var init_countersign_run = __esm({
29775
29813
  // src/public-cli/diarist-run.ts
29776
29814
  import { existsSync as existsSync10 } from "node:fs";
29777
29815
  import { writeFile as writeFile8 } from "node:fs/promises";
29778
- import { join as join27 } from "node:path";
29816
+ import { join as join28 } from "node:path";
29779
29817
  function withDiaristCatalogPath(prompt, sourcesPath) {
29780
29818
  if (sourcesPath === void 0 || sourcesPath.trim() === "") return prompt;
29781
29819
  return `${prompt}
@@ -29801,7 +29839,7 @@ function buildDiaristTurnRequest(admitted, options, sourcesPath) {
29801
29839
  }
29802
29840
  async function freezeDiaristSourceCatalog(admitted, env) {
29803
29841
  if (admitted.ticketNumber === void 0) return void 0;
29804
- const path = join27(admitted.runDirectory, DIARIST_SOURCE_CATALOG_FILE);
29842
+ const path = join28(admitted.runDirectory, DIARIST_SOURCE_CATALOG_FILE);
29805
29843
  if (existsSync10(path)) {
29806
29844
  const identity = await readRoleRunIdentity(admitted.runDirectory);
29807
29845
  if (identity !== void 0 && identity.state !== "terminal") return path;
@@ -30349,6 +30387,7 @@ var init_fixer_run = __esm({
30349
30387
  });
30350
30388
 
30351
30389
  // src/public-cli/notary-run.ts
30390
+ import { existsSync as existsSync11 } from "node:fs";
30352
30391
  function buildNotaryTurnRequest(admitted, options) {
30353
30392
  return projectRoleTurnRequest(
30354
30393
  admitted,
@@ -30491,10 +30530,19 @@ async function runPublicNotaryResume(request, env, io) {
30491
30530
  }
30492
30531
  return loaded;
30493
30532
  },
30494
- buildTurnRequest: (admitted, effective) => buildNotaryTurnRequest(
30495
- admitted,
30496
- resumeTurnRequestProjectionOptions(admitted, effective, env)
30497
- ),
30533
+ buildTurnRequest: (admitted, effective) => {
30534
+ const projection = resumeTurnRequestProjectionOptions(
30535
+ admitted,
30536
+ effective,
30537
+ env
30538
+ );
30539
+ const candidatePath = gateSubmissionCandidatePath(admitted.sourceRunPath);
30540
+ const prompt = existsSync11(candidatePath) ? appendResumeMaterialReread(projection.continuation.prompt, candidatePath) : projection.continuation.prompt;
30541
+ return buildNotaryTurnRequest(admitted, {
30542
+ ...projection,
30543
+ continuation: { kind: "resume", prompt }
30544
+ });
30545
+ },
30498
30546
  adapters: notaryAdapters(),
30499
30547
  ...env.engine === void 0 ? {} : { effectiveEngine: env.engine }
30500
30548
  });
@@ -30502,6 +30550,7 @@ async function runPublicNotaryResume(request, env, io) {
30502
30550
  var init_notary_run = __esm({
30503
30551
  "src/public-cli/notary-run.ts"() {
30504
30552
  "use strict";
30553
+ init_auditor_dossier_tool();
30505
30554
  init_notary_source_run();
30506
30555
  init_engine_material();
30507
30556
  init_run_ticket_number();
@@ -30784,7 +30833,7 @@ var init_judge_run = __esm({
30784
30833
 
30785
30834
  // src/public-cli/merger-run.ts
30786
30835
  import { mkdir as mkdir5, writeFile as writeFile9 } from "node:fs/promises";
30787
- import { join as join28, resolve as resolve10 } from "node:path";
30836
+ import { join as join29, resolve as resolve11 } from "node:path";
30788
30837
  function mergerMethods(packageRoot2) {
30789
30838
  return [
30790
30839
  {
@@ -30826,7 +30875,7 @@ async function loadMergerMethodMaterial(packageRoot2) {
30826
30875
  );
30827
30876
  }
30828
30877
  async function admitMergerShellForActivationFailure(options) {
30829
- const projectRoot = resolve10(options.project ?? options.cwd);
30878
+ const projectRoot = resolve11(options.project ?? options.cwd);
30830
30879
  const runId = (options.createRunId ?? uuidv7)();
30831
30880
  const {
30832
30881
  principal,
@@ -30850,8 +30899,8 @@ async function admitMergerShellForActivationFailure(options) {
30850
30899
  expectedConflictPaths: [],
30851
30900
  resolutionScope: []
30852
30901
  };
30853
- const admittedRequestPath = join28(runDirectory, "admitted-request.json");
30854
- const mergerInputPath = join28(runDirectory, "merger-input.json");
30902
+ const admittedRequestPath = join29(runDirectory, "admitted-request.json");
30903
+ const mergerInputPath = join29(runDirectory, "merger-input.json");
30855
30904
  await writeFile9(
30856
30905
  admittedRequestPath,
30857
30906
  `${JSON.stringify(
@@ -31256,7 +31305,7 @@ var init_reviewer_run = __esm({
31256
31305
 
31257
31306
  // src/analyst-book-key.ts
31258
31307
  import { statSync as statSync3 } from "node:fs";
31259
- import { isAbsolute as isAbsolute7 } from "node:path";
31308
+ import { isAbsolute as isAbsolute8 } from "node:path";
31260
31309
  function resolveAnalystBookKey(projectRoot) {
31261
31310
  const identity = physicalPathIdentity(projectRoot);
31262
31311
  let stats;
@@ -31278,7 +31327,7 @@ function resolveAnalystBookKey(projectRoot) {
31278
31327
  }
31279
31328
  }
31280
31329
  function isSyntheticAnalystBookKey(bookKey) {
31281
- return bookKey.startsWith("root:") && isAbsolute7(bookKey.slice("root:".length));
31330
+ return bookKey.startsWith("root:") && isAbsolute8(bookKey.slice("root:".length));
31282
31331
  }
31283
31332
  var init_analyst_book_key = __esm({
31284
31333
  "src/analyst-book-key.ts"() {
@@ -31291,10 +31340,10 @@ var init_analyst_book_key = __esm({
31291
31340
  // src/atomic-write.ts
31292
31341
  import { randomUUID as randomUUID6 } from "node:crypto";
31293
31342
  import { rename, rm as rm2, writeFile as writeFile10 } from "node:fs/promises";
31294
- import { dirname as dirname12, join as join29 } from "node:path";
31343
+ import { dirname as dirname13, join as join30 } from "node:path";
31295
31344
  async function writeFileAtomically(destination, contents) {
31296
- const parent = dirname12(destination);
31297
- const temporary = join29(parent, `.atomic-write-${randomUUID6()}.tmp`);
31345
+ const parent = dirname13(destination);
31346
+ const temporary = join30(parent, `.atomic-write-${randomUUID6()}.tmp`);
31298
31347
  try {
31299
31348
  await writeFile10(temporary, contents);
31300
31349
  await rename(temporary, destination);
@@ -31311,16 +31360,16 @@ var init_atomic_write = __esm({
31311
31360
 
31312
31361
  // src/analyst-index.ts
31313
31362
  import { open as open3, readFile as readFile17, unlink as unlink4 } from "node:fs/promises";
31314
- import { dirname as dirname13, join as join30 } from "node:path";
31363
+ import { dirname as dirname14, join as join31 } from "node:path";
31315
31364
  function sleep(ms) {
31316
- return new Promise((resolve12) => {
31317
- setTimeout(resolve12, ms);
31365
+ return new Promise((resolve13) => {
31366
+ setTimeout(resolve13, ms);
31318
31367
  });
31319
31368
  }
31320
31369
  async function withAnalystLibraryIndexLock(ledgerHome, fn) {
31321
31370
  const indexPath = analystLibraryIndexPath(ledgerHome);
31322
- ensureRealDirectoryTree(ledgerHome, dirname13(indexPath));
31323
- const lockPath = join30(dirname13(indexPath), LIBRARY_INDEX_LOCK_NAME);
31371
+ ensureRealDirectoryTree(ledgerHome, dirname14(indexPath));
31372
+ const lockPath = join31(dirname14(indexPath), LIBRARY_INDEX_LOCK_NAME);
31324
31373
  assertLedgerFileInsideHome(lockPath, ledgerHome);
31325
31374
  const startedAt = Date.now();
31326
31375
  while (true) {
@@ -31347,7 +31396,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
31347
31396
  }
31348
31397
  }
31349
31398
  function analystLibraryIndexPath(ledgerHome) {
31350
- return join30(ledgerHome, "analyst", "library-index.json");
31399
+ return join31(ledgerHome, "analyst", "library-index.json");
31351
31400
  }
31352
31401
  function rowFromIssueMetricsPage(page) {
31353
31402
  return {
@@ -31456,7 +31505,7 @@ async function readAnalystLibraryIndexPage(ledgerHome) {
31456
31505
  }
31457
31506
  async function writeAnalystLibraryIndexPage(ledgerHome, page) {
31458
31507
  const path = analystLibraryIndexPath(ledgerHome);
31459
- ensureRealDirectoryTree(ledgerHome, dirname13(path));
31508
+ ensureRealDirectoryTree(ledgerHome, dirname14(path));
31460
31509
  assertLedgerFileInsideHome(path, ledgerHome);
31461
31510
  await writeFileAtomically(path, `${JSON.stringify(page, null, 2)}
31462
31511
  `);
@@ -31643,7 +31692,7 @@ var init_analyst_cohort = __esm({
31643
31692
 
31644
31693
  // src/analyst-ledger.ts
31645
31694
  import { readdir as readdir7, readFile as readFile18 } from "node:fs/promises";
31646
- import { join as join31 } from "node:path";
31695
+ import { join as join32 } from "node:path";
31647
31696
  function isMissingPathError5(error) {
31648
31697
  return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
31649
31698
  }
@@ -31656,7 +31705,7 @@ function isRecord19(value) {
31656
31705
  async function readExistingRunLifecycleState(runDirectory) {
31657
31706
  try {
31658
31707
  const raw = JSON.parse(
31659
- await readFile18(join31(runDirectory, "run-state.json"), "utf8")
31708
+ await readFile18(join32(runDirectory, "run-state.json"), "utf8")
31660
31709
  );
31661
31710
  if (!isRecord19(raw) || typeof raw.state !== "string") return void 0;
31662
31711
  return raw.state;
@@ -31688,7 +31737,7 @@ async function listLedgerBookNames(booksRoot) {
31688
31737
  async function readInvocationScopeFields(runDirectory) {
31689
31738
  let raw;
31690
31739
  try {
31691
- raw = await readFile18(join31(runDirectory, "invocation.json"), "utf8");
31740
+ raw = await readFile18(join32(runDirectory, "invocation.json"), "utf8");
31692
31741
  } catch (error) {
31693
31742
  if (isMissingPathError5(error)) return void 0;
31694
31743
  throw error;
@@ -31720,7 +31769,7 @@ function decideIssueScope(input) {
31720
31769
  }
31721
31770
  async function resolveSessionFile(runDirectory) {
31722
31771
  try {
31723
- const raw = await readFile18(join31(runDirectory, "invocation.json"), "utf8");
31772
+ const raw = await readFile18(join32(runDirectory, "invocation.json"), "utf8");
31724
31773
  const parsed = JSON.parse(raw);
31725
31774
  if (isRecord19(parsed) && typeof parsed.sessionFile === "string" && parsed.sessionFile.trim() !== "") {
31726
31775
  return parsed.sessionFile;
@@ -31728,7 +31777,7 @@ async function resolveSessionFile(runDirectory) {
31728
31777
  } catch (error) {
31729
31778
  if (!isMissingPathError5(error)) throw error;
31730
31779
  }
31731
- return join31(runDirectory, "session", "session.jsonl");
31780
+ return join32(runDirectory, "session", "session.jsonl");
31732
31781
  }
31733
31782
  function attributeSessionRowsForRun(input) {
31734
31783
  if (pathContainedIn(input.runDirectory, input.sessionFile)) {
@@ -31900,9 +31949,9 @@ async function classifyScopedRun(input) {
31900
31949
  }
31901
31950
  let gateCycles;
31902
31951
  try {
31903
- const parentSessionFile = join31(input.runDirectory, "session", "session.jsonl");
31952
+ const parentSessionFile = join32(input.runDirectory, "session", "session.jsonl");
31904
31953
  gateCycles = await readAnalystGateCyclesFromAuditorRoles(
31905
- join31(input.runDirectory, "session", "auditor-roles"),
31954
+ join32(input.runDirectory, "session", "auditor-roles"),
31906
31955
  { parentSessionFile }
31907
31956
  );
31908
31957
  } catch (error) {
@@ -31935,7 +31984,7 @@ async function classifyScopedRun(input) {
31935
31984
  async function scanAnalystIssueRuns(input) {
31936
31985
  const ledgerHome = resolveActivationLedgerHome(input.home);
31937
31986
  const scopeTicketNumber = input.ticketNumber;
31938
- const booksRoot = join31(ledgerHome, "books");
31987
+ const booksRoot = join32(ledgerHome, "books");
31939
31988
  let wholeBook = false;
31940
31989
  let scopeRootIdentity;
31941
31990
  let bookNames;
@@ -31967,7 +32016,7 @@ async function scanAnalystIssueRuns(input) {
31967
32016
  const unreadable = [];
31968
32017
  const scopeConflicts = [];
31969
32018
  for (const book of bookNames) {
31970
- const runsDir = join31(booksRoot, book, "runs");
32019
+ const runsDir = join32(booksRoot, book, "runs");
31971
32020
  let runNames;
31972
32021
  try {
31973
32022
  const entries = await readdir7(runsDir, { withFileTypes: true });
@@ -31979,7 +32028,7 @@ async function scanAnalystIssueRuns(input) {
31979
32028
  for (const runName of runNames) {
31980
32029
  const parsed = parseRunDirectoryName2(runName);
31981
32030
  if (parsed === void 0) continue;
31982
- const runDirectory = join31(runsDir, runName);
32031
+ const runDirectory = join32(runsDir, runName);
31983
32032
  let scopeFields;
31984
32033
  try {
31985
32034
  scopeFields = await readInvocationScopeFields(runDirectory);
@@ -32833,7 +32882,7 @@ var init_analyst_metric_family = __esm({
32833
32882
 
32834
32883
  // src/analyst-page.ts
32835
32884
  import { createHash as createHash7 } from "node:crypto";
32836
- import { dirname as dirname14, join as join32 } from "node:path";
32885
+ import { dirname as dirname15, join as join33 } from "node:path";
32837
32886
  function analystIssuePageKey(address) {
32838
32887
  const parts = ["book", address.bookKey];
32839
32888
  if (address.issueNumber !== void 0) {
@@ -32844,7 +32893,7 @@ function analystIssuePageKey(address) {
32844
32893
  return createHash7("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
32845
32894
  }
32846
32895
  function analystIssuePagePath(ledgerHome, address) {
32847
- return join32(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
32896
+ return join33(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
32848
32897
  }
32849
32898
  function analystIssuePageAddressFromPage(page) {
32850
32899
  return {
@@ -32963,7 +33012,7 @@ async function buildAnalystIssueMetricsPage(input) {
32963
33012
  }
32964
33013
  async function writeAnalystIssueMetricsPage(ledgerHome, page) {
32965
33014
  const path = analystIssuePagePath(ledgerHome, analystIssuePageAddressFromPage(page));
32966
- ensureRealDirectoryTree(ledgerHome, dirname14(path));
33015
+ ensureRealDirectoryTree(ledgerHome, dirname15(path));
32967
33016
  assertLedgerFileInsideHome(path, ledgerHome);
32968
33017
  await writeFileAtomically(path, `${JSON.stringify(page, null, 2)}
32969
33018
  `);
@@ -33205,7 +33254,7 @@ var init_analyst_entry = __esm({
33205
33254
 
33206
33255
  // src/public-cli/analyst-run.ts
33207
33256
  import { readFile as readFile20 } from "node:fs/promises";
33208
- import { isAbsolute as isAbsolute8, resolve as resolve11 } from "node:path";
33257
+ import { isAbsolute as isAbsolute9, resolve as resolve12 } from "node:path";
33209
33258
  function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
33210
33259
  try {
33211
33260
  return resolveBookKeyFromGit(cwd);
@@ -33254,7 +33303,7 @@ async function buildAnalystSweepModeInputFromAttachmentPaths(attachmentPaths) {
33254
33303
  );
33255
33304
  }
33256
33305
  const sourcePath = attachmentPaths[0];
33257
- const absolute = isAbsolute8(sourcePath) ? sourcePath : resolve11(sourcePath);
33306
+ const absolute = isAbsolute9(sourcePath) ? sourcePath : resolve12(sourcePath);
33258
33307
  let bytes;
33259
33308
  try {
33260
33309
  bytes = await readFile20(absolute);
@@ -33377,7 +33426,7 @@ __export(cli_exports, {
33377
33426
  runAkRole: () => runAkRole
33378
33427
  });
33379
33428
  import { realpath as realpath6 } from "node:fs/promises";
33380
- import { join as join33 } from "node:path";
33429
+ import { join as join34 } from "node:path";
33381
33430
  function takePublicGlobalFlag(argv, index, options) {
33382
33431
  const tokens = argv.slice(index);
33383
33432
  const taken = options.takeDashed(tokens);
@@ -33509,7 +33558,7 @@ function resolveHome(env) {
33509
33558
  return env.home ?? packageMachineHome();
33510
33559
  }
33511
33560
  function resolveAgentDir(env, home) {
33512
- return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join33(home, ".pi", "agent");
33561
+ return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join34(home, ".pi", "agent");
33513
33562
  }
33514
33563
  function parseThinking(value) {
33515
33564
  return value;
@@ -34466,8 +34515,8 @@ var init_cli = __esm({
34466
34515
  });
34467
34516
 
34468
34517
  // src/public-cli/main.ts
34469
- import { existsSync as existsSync11 } from "node:fs";
34470
- import { dirname as dirname15, join as join34 } from "node:path";
34518
+ import { existsSync as existsSync12 } from "node:fs";
34519
+ import { dirname as dirname16, join as join35 } from "node:path";
34471
34520
  import { fileURLToPath as fileURLToPath3 } from "node:url";
34472
34521
 
34473
34522
  // src/public-cli/host-pi-runtime.ts
@@ -34554,10 +34603,10 @@ function linkPackage(packageRoot2, name, targetDir) {
34554
34603
  }
34555
34604
 
34556
34605
  // src/public-cli/main.ts
34557
- var here = dirname15(fileURLToPath3(import.meta.url));
34606
+ var here = dirname16(fileURLToPath3(import.meta.url));
34558
34607
  function resolvePackageRoot(binDir) {
34559
- const canonical = join34(binDir, "..", "..");
34560
- if (existsSync11(join34(canonical, "package.json"))) {
34608
+ const canonical = join35(binDir, "..", "..");
34609
+ if (existsSync12(join35(canonical, "package.json"))) {
34561
34610
  return canonical;
34562
34611
  }
34563
34612
  return binDir;