@akagilnc/pi-workflow-roles 0.1.3623 → 0.1.3629

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