@akagilnc/pi-workflow-roles 0.1.4403 → 0.1.4419

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/README.md +4 -3
  2. package/README.zh-CN.md +5 -4
  3. package/THIRD_PARTY_NOTICES.md +8 -6
  4. package/dist/acp-host/production-host.js +249 -624
  5. package/dist/headless-host/production-host.js +251 -626
  6. package/dist/migrate-book-topology.js +23 -6
  7. package/dist/package-resources/method-skill.js +6 -1
  8. package/dist/pi/role-turn-host.js +3 -1
  9. package/dist/public-cli/invocation.js +83 -32
  10. package/dist/public-cli/main.js +240 -306
  11. package/dist/public-cli/option-definitions.js +23 -6
  12. package/dist/public-cli/post-admission.js +0 -4
  13. package/dist/public-cli/run-lifecycle.js +25 -4
  14. package/dist/public-cli/settlement.js +6 -77
  15. package/dist/role-activation-flags.js +1 -0
  16. package/extensions/role-runtime.ts +3 -5
  17. package/package.json +1 -1
  18. package/resources/836-deleted-machine-instruction-inventory.md +1 -1
  19. package/resources/methods/ak-cross-m-review/CONTEXT.md +48 -0
  20. package/resources/methods/ak-cross-m-review/LICENSE +21 -0
  21. package/resources/methods/ak-cross-m-review/SKILL.md +170 -0
  22. package/resources/methods/ak-cross-m-review/prompts/cmr-completeness.md +118 -0
  23. package/resources/methods/ak-cross-m-review/prompts/cmr-reviewer.md +128 -0
  24. package/resources/methods/ak-cross-m-review/provenance.json +41 -0
  25. package/souls/judge.md +1 -1
  26. package/souls/reviewer.md +1 -1
  27. package/src/archivist-record-entry.ts +1 -1
  28. package/src/canonical-skill-binding.ts +2 -2
  29. package/src/host-contracts.ts +2 -0
  30. package/src/package-contracts/reviewer-output.ts +4 -2
  31. package/src/package-resources/method-skill.ts +7 -2
  32. package/src/pi/role-turn-host.ts +3 -1
  33. package/src/public-cli/invocation.ts +108 -39
  34. package/src/public-cli/option-definitions.ts +23 -6
  35. package/src/public-cli/post-admission.ts +0 -4
  36. package/src/public-cli/reviewer-run.ts +39 -16
  37. package/src/public-cli/run-lifecycle.ts +33 -3
  38. package/src/public-cli/settlement.ts +8 -73
  39. package/src/reviewer-role.ts +27 -16
  40. package/src/role-activation-flags.ts +1 -0
  41. package/src/role-runtime-dependencies.ts +2 -4
  42. package/src/role-runtime.ts +9 -26
  43. package/src/worker-role.ts +1 -1
  44. package/dist/adr-path-refs.js +0 -23
  45. package/dist/public-cli/reviewer-dispatch-rejection.js +0 -77
  46. package/dist/reviewer-dispatch.js +0 -14
  47. package/dist/reviewer-git-snapshot.js +0 -32
  48. package/dist/reviewer-pinned-git.js +0 -308
  49. package/dist/reviewer-preflight-error.js +0 -15
  50. package/dist/reviewer-prompt-identity.js +0 -10
  51. package/resources/methods/code-review/SKILL.md +0 -92
  52. package/resources/methods/code-review/agents/openai.yaml +0 -3
  53. package/resources/methods/code-review/provenance.json +0 -26
  54. package/src/adr-path-refs.ts +0 -25
  55. package/src/public-cli/reviewer-dispatch-rejection.ts +0 -106
  56. package/src/reviewer-dispatch.ts +0 -39
  57. package/src/reviewer-git-snapshot.ts +0 -45
  58. package/src/reviewer-pinned-git.ts +0 -330
  59. package/src/reviewer-preflight-error.ts +0 -14
  60. package/src/reviewer-prompt-identity.ts +0 -17
@@ -16196,6 +16196,7 @@ function projectActivationFlags(request) {
16196
16196
  }
16197
16197
  if (activation.role === "reviewer") {
16198
16198
  flags.set("ak-review-base", activation.baseRevision);
16199
+ flags.set("ak-review-lens", activation.lens);
16199
16200
  flags.set("ak-review-authority-refs", JSON.stringify(activation.authorityRefs));
16200
16201
  if (activation.ticketNumber !== void 0) {
16201
16202
  flags.set("ak-review-ticket-number", String(activation.ticketNumber));
@@ -16639,7 +16640,7 @@ function piUserDialogueBody(request) {
16639
16640
  const _exhaustive = request.continuation;
16640
16641
  return _exhaustive;
16641
16642
  })();
16642
- return applyPiNativeSkillInvocation(request.methods, rawPrompt);
16643
+ return request.continuation.kind === "resume" && request.activation.role === "reviewer" ? rawPrompt : applyPiNativeSkillInvocation(request.methods, rawPrompt);
16643
16644
  }
16644
16645
  async function resolveSelectedPi(command, cwd, env) {
16645
16646
  const searchPath = env.PATH ?? (platform === "win32" ? process.env.PATH ?? "" : "/usr/bin:/bin");
@@ -18822,6 +18823,7 @@ async function loadResumableRunRecord(home, runId, authority) {
18822
18823
  let prerequisitesPath;
18823
18824
  let prerequisites;
18824
18825
  let baseRevision;
18826
+ let lens;
18825
18827
  let authorityRefs;
18826
18828
  let mergerInputPath;
18827
18829
  let derived;
@@ -18875,6 +18877,9 @@ async function loadResumableRunRecord(home, runId, authority) {
18875
18877
  if (typeof record4.baseRevision === "string" && record4.baseRevision.trim() !== "") {
18876
18878
  baseRevision = record4.baseRevision;
18877
18879
  }
18880
+ if (isReviewerLens(record4.lens)) {
18881
+ lens = record4.lens;
18882
+ }
18878
18883
  if (typeof record4.prNumber === "number" && Number.isSafeInteger(record4.prNumber) && record4.prNumber >= 1) {
18879
18884
  prNumber = record4.prNumber;
18880
18885
  }
@@ -19012,6 +19017,7 @@ async function loadResumableRunRecord(home, runId, authority) {
19012
19017
  ...prerequisitesPath === void 0 ? {} : { prerequisitesPath },
19013
19018
  ...prerequisites === void 0 ? {} : { prerequisites },
19014
19019
  ...baseRevision === void 0 ? {} : { baseRevision },
19020
+ ...lens === void 0 ? {} : { lens },
19015
19021
  ...authorityRefs === void 0 ? {} : { authorityRefs },
19016
19022
  ...mergerInputPath === void 0 ? {} : { mergerInputPath },
19017
19023
  ...derived === void 0 ? {} : { derived },
@@ -19145,17 +19151,38 @@ async function loadResumableReviewerRun(home, runId, authority) {
19145
19151
  `role run ${runId} belongs to ${loaded.run.role}, not reviewer`
19146
19152
  );
19147
19153
  }
19148
- const baseRevision = loaded.admittedFields.baseRevision;
19149
- if (baseRevision === void 0 || baseRevision.trim() === "") {
19154
+ const rawBase = loaded.admittedFields.baseRevision;
19155
+ if (rawBase === void 0 || rawBase.trim() === "") {
19150
19156
  throw new CliUsageError(
19151
19157
  `role run admitted reviewer base revision is missing: ${runId}`
19152
19158
  );
19153
19159
  }
19160
+ if (/\s/.test(rawBase) || rawBase.startsWith("-")) {
19161
+ throw new CliUsageError(
19162
+ `role run admitted reviewer base revision is damaged: ${runId}`
19163
+ );
19164
+ }
19165
+ const baseRevision = rawBase;
19166
+ const lens = loaded.admittedFields.lens;
19167
+ if (!isReviewerLens(lens)) {
19168
+ throw new CliUsageError(
19169
+ `role run admitted reviewer lens is missing: ${runId}`
19170
+ );
19171
+ }
19172
+ const authorityRefs = Object.freeze([
19173
+ ...loaded.admittedFields.authorityRefs ?? []
19174
+ ]);
19175
+ if (authorityRefs.length === 0) {
19176
+ throw new CliUsageError(
19177
+ `role run admitted reviewer authority refs are missing: ${runId}`
19178
+ );
19179
+ }
19154
19180
  const admitted = {
19155
19181
  role: "reviewer",
19156
19182
  ...resumedBaseAdmitted(loaded),
19157
19183
  baseRevision,
19158
- authorityRefs: Object.freeze([...loaded.admittedFields.authorityRefs ?? []])
19184
+ lens,
19185
+ authorityRefs
19159
19186
  };
19160
19187
  return seatLoadedResult(loaded, admitted);
19161
19188
  }
@@ -20077,18 +20104,32 @@ var init_option_definitions = __esm({
20077
20104
  zh: "\u5FC5\u586B\uFF1B\u9489\u4F4F\u5BA1\u67E5\u76EE\u6807\u7684 fixed-point revision\u3002"
20078
20105
  }
20079
20106
  },
20107
+ {
20108
+ id: "lens",
20109
+ owner: "reviewer",
20110
+ canonical: "--lens",
20111
+ aliases: [],
20112
+ valueMetavar: "completeness|correctness",
20113
+ required: true,
20114
+ repeatable: false,
20115
+ form: "option",
20116
+ description: {
20117
+ en: "Required single review lens: completeness or correctness (no default).",
20118
+ zh: "\u5FC5\u586B\u5355 lens\uFF1Acompleteness \u6216 correctness\uFF08\u65E0\u9ED8\u8BA4\u503C\uFF09\u3002"
20119
+ }
20120
+ },
20080
20121
  {
20081
20122
  id: "authority-ref",
20082
20123
  owner: "reviewer",
20083
20124
  canonical: "--authority-ref",
20084
20125
  aliases: [],
20085
20126
  valueMetavar: "ref",
20086
- required: false,
20127
+ required: true,
20087
20128
  repeatable: true,
20088
20129
  form: "option",
20089
20130
  description: {
20090
- en: "Durable authority reference/URL (repeatable; refs only, not inline prose).",
20091
- zh: "\u6301\u4E45 authority \u5F15\u7528/URL\uFF08\u53EF\u91CD\u590D\uFF1B\u4EC5 ref\uFF0C\u975E\u5185\u8054\u6563\u6587\uFF09\u3002"
20131
+ en: "Required durable authority reference/URL (repeatable; refs only, not inline prose).",
20132
+ zh: "\u5FC5\u586B\u6301\u4E45 authority \u5F15\u7528/URL\uFF08\u53EF\u91CD\u590D\uFF1B\u4EC5 ref\uFF0C\u975E\u5185\u8054\u6563\u6587\uFF09\u3002"
20092
20133
  }
20093
20134
  }
20094
20135
  ];
@@ -20432,10 +20473,13 @@ var init_option_definitions = __esm({
20432
20473
  },
20433
20474
  reviewer: {
20434
20475
  command: "reviewer",
20435
- summary: "Fixed-target two-axis review (Standards + Spec).",
20436
- usage: ["ak-role reviewer --base <revision> [options] <instruction>"],
20476
+ summary: "Fixed-target single-lens review (completeness or correctness).",
20477
+ usage: [
20478
+ "ak-role reviewer --base <revision> --lens completeness|correctness --authority-ref <ref> [options] <instruction>"
20479
+ ],
20437
20480
  examples: [
20438
- 'ak-role reviewer --base main "Review the branch against the governing issue and repository authority."'
20481
+ 'ak-role reviewer --base main --lens completeness --authority-ref docs/adr/0001.md "Review the branch."',
20482
+ "ak-role reviewer --base main --lens correctness --authority-ref CLAUDE.md --authority-ref docs/adr/0001.md"
20439
20483
  ]
20440
20484
  },
20441
20485
  collector: {
@@ -20639,12 +20683,14 @@ __export(invocation_exports, {
20639
20683
  buildJudgeTransportPrompt: () => buildJudgeTransportPrompt,
20640
20684
  buildMergerTransportPrompt: () => buildMergerTransportPrompt,
20641
20685
  buildNotaryTransportPrompt: () => buildNotaryTransportPrompt,
20686
+ buildReviewerSkillArgProjection: () => buildReviewerSkillArgProjection,
20642
20687
  buildReviewerTransportPrompt: () => buildReviewerTransportPrompt,
20643
20688
  buildSecretariatTransportPrompt: () => buildSecretariatTransportPrompt,
20644
20689
  deriveMergerEnvelopeFromActiveMerge: () => deriveMergerEnvelopeFromActiveMerge,
20645
20690
  ensureRunArtifactsDir: () => ensureRunArtifactsDir,
20646
20691
  freezeAttachmentsIntoRun: () => freezeAttachmentsIntoRun,
20647
20692
  homeFromRunDirectory: () => homeFromRunDirectory,
20693
+ isReviewerLens: () => isReviewerLens,
20648
20694
  issueAdmissionPlacement: () => issueAdmissionPlacement,
20649
20695
  loadAdmittedJudgeRequest: () => loadAdmittedJudgeRequest,
20650
20696
  observeLaunchedRolePackageIdentity: () => observeLaunchedRolePackageIdentity,
@@ -20675,6 +20721,8 @@ __export(invocation_exports, {
20675
20721
  recordLaunchedRolePackageIdentity: () => recordLaunchedRolePackageIdentity,
20676
20722
  relocateAdmittedRunToTicket: () => relocateAdmittedRunToTicket,
20677
20723
  requireAuthorityRef: () => requireAuthorityRef,
20724
+ requireReviewerBaseRevision: () => requireReviewerBaseRevision,
20725
+ requireReviewerLens: () => requireReviewerLens,
20678
20726
  resolveDoctorCaseRunsPath: () => resolveDoctorCaseRunsPath,
20679
20727
  resolveGitHubRemoteRepository: () => resolveGitHubRemoteRepository
20680
20728
  });
@@ -21045,6 +21093,35 @@ function requireOptionPath(flag, value) {
21045
21093
  }
21046
21094
  return value;
21047
21095
  }
21096
+ function requireSkillArgToken(value, messages) {
21097
+ if (value === void 0 || value.trim() === "") {
21098
+ throw new CliUsageError(messages.empty);
21099
+ }
21100
+ if (/\s/.test(value)) {
21101
+ throw new CliUsageError(messages.whitespace);
21102
+ }
21103
+ if (value.startsWith("-")) {
21104
+ throw new CliUsageError(messages.optionLike);
21105
+ }
21106
+ return value;
21107
+ }
21108
+ function requireReviewerBaseRevision(value) {
21109
+ return requireSkillArgToken(value, {
21110
+ empty: "--base requires a nonempty revision",
21111
+ whitespace: "--base requires a single-token revision",
21112
+ optionLike: "--base requires a single-token revision"
21113
+ });
21114
+ }
21115
+ function isReviewerLens(value) {
21116
+ return value === "completeness" || value === "correctness";
21117
+ }
21118
+ function requireReviewerLens(value) {
21119
+ const trimmed = (value ?? "").trim();
21120
+ if (!isReviewerLens(trimmed)) {
21121
+ throw new CliUsageError("--lens requires completeness or correctness");
21122
+ }
21123
+ return trimmed;
21124
+ }
21048
21125
  function isRejectedPublicSpelling(owner, token) {
21049
21126
  for (const entry of REJECTED_PUBLIC_SPELLINGS) {
21050
21127
  if (entry.owner !== owner) continue;
@@ -21058,15 +21135,11 @@ function roleOptions(owner) {
21058
21135
  return optionsForOwner(owner);
21059
21136
  }
21060
21137
  function requireAuthorityRef(value) {
21061
- if (value === void 0 || value.trim() === "") {
21062
- throw new CliUsageError("--authority-ref requires a nonempty durable reference");
21063
- }
21064
- if (/\s/.test(value)) {
21065
- throw new CliUsageError(
21066
- "--authority-ref requires a durable reference, not inline Spec prose"
21067
- );
21068
- }
21069
- return value;
21138
+ return requireSkillArgToken(value, {
21139
+ empty: "--authority-ref requires a nonempty durable reference",
21140
+ whitespace: "--authority-ref requires a durable reference, not inline Spec prose",
21141
+ optionLike: "--authority-ref requires a durable reference, not inline Spec prose"
21142
+ });
21070
21143
  }
21071
21144
  function parseJudgeArgv(args) {
21072
21145
  const dd = args.indexOf("--");
@@ -22370,6 +22443,7 @@ function parseReviewerArgv(args) {
22370
22443
  const authorityRefs = [];
22371
22444
  let project;
22372
22445
  let baseRevision;
22446
+ let lens;
22373
22447
  const positional = [];
22374
22448
  const tokens = [...args];
22375
22449
  const definitions = roleOptions("reviewer");
@@ -22387,7 +22461,11 @@ function parseReviewerArgv(args) {
22387
22461
  continue;
22388
22462
  }
22389
22463
  if (taken.def.id === "base") {
22390
- baseRevision = requireOptionPath(taken.def.canonical, taken.value);
22464
+ baseRevision = requireReviewerBaseRevision(taken.value);
22465
+ continue;
22466
+ }
22467
+ if (taken.def.id === "lens") {
22468
+ lens = requireReviewerLens(taken.value);
22391
22469
  continue;
22392
22470
  }
22393
22471
  if (taken.def.id === "authority-ref") {
@@ -22407,6 +22485,7 @@ function parseReviewerArgv(args) {
22407
22485
  instruction: positional.join(" "),
22408
22486
  attachmentPaths,
22409
22487
  baseRevision,
22488
+ lens,
22410
22489
  authorityRefs,
22411
22490
  ...project === void 0 ? {} : { project }
22412
22491
  };
@@ -22415,11 +22494,13 @@ async function admitReviewerInvocation(options) {
22415
22494
  if (options.project !== void 0) {
22416
22495
  requireOptionPath("--project", options.project);
22417
22496
  }
22418
- if (options.baseRevision.trim() === "") {
22419
- throw new CliUsageError("--base requires a nonempty revision");
22497
+ const baseRevision = requireReviewerBaseRevision(options.baseRevision);
22498
+ const lens = requireReviewerLens(options.lens);
22499
+ if (options.authorityRefs.length === 0) {
22500
+ throw new CliUsageError("reviewer requires --authority-ref <ref>");
22420
22501
  }
22421
22502
  const authorityRefs = Object.freeze(
22422
- (options.authorityRefs ?? []).map((ref) => requireAuthorityRef(ref))
22503
+ options.authorityRefs.map((ref) => requireAuthorityRef(ref))
22423
22504
  );
22424
22505
  const projectRoot = resolve7(options.project ?? options.cwd);
22425
22506
  const runId = (options.createRunId ?? uuidv7)();
@@ -22450,7 +22531,8 @@ async function admitReviewerInvocation(options) {
22450
22531
  principal,
22451
22532
  instruction,
22452
22533
  instructionEmpty,
22453
- baseRevision: options.baseRevision,
22534
+ baseRevision,
22535
+ lens,
22454
22536
  authorityRefs: [...authorityRefs],
22455
22537
  attachments: attachments.map((a) => ({
22456
22538
  provenancePath: a.provenancePath,
@@ -22477,14 +22559,20 @@ async function admitReviewerInvocation(options) {
22477
22559
  runDirectory,
22478
22560
  principal,
22479
22561
  admittedRequestPath,
22480
- baseRevision: options.baseRevision,
22562
+ baseRevision,
22563
+ lens,
22481
22564
  authorityRefs
22482
22565
  };
22483
22566
  }
22567
+ function buildReviewerSkillArgProjection(admitted) {
22568
+ return [
22569
+ `--base ${admitted.baseRevision}`,
22570
+ `--lens ${admitted.lens}`,
22571
+ ...admitted.authorityRefs.map((ref) => `--authority ${ref}`)
22572
+ ].join(" ");
22573
+ }
22484
22574
  function buildReviewerTransportPrompt(admitted, engineMaterial) {
22485
- const lines = [
22486
- `\u672C\u6B21\u5BA1\u67E5\u7684\u56FA\u5B9A\u57FA\u70B9\uFF1A${admitted.baseRevision}`
22487
- ];
22575
+ const lines = [buildReviewerSkillArgProjection(admitted)];
22488
22576
  if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
22489
22577
  lines.push("", admitted.instruction);
22490
22578
  }
@@ -23303,7 +23391,12 @@ var init_method_skill = __esm({
23303
23391
  REQUIRED_COMPANIONS = {
23304
23392
  tdd: ["tests.md", "mocking.md", "agents/openai.yaml"],
23305
23393
  "diagnosing-bugs": ["agents/openai.yaml", "scripts/hitl-loop.template.sh"],
23306
- "code-review": ["agents/openai.yaml"],
23394
+ "ak-cross-m-review": [
23395
+ "CONTEXT.md",
23396
+ "LICENSE",
23397
+ "prompts/cmr-completeness.md",
23398
+ "prompts/cmr-reviewer.md"
23399
+ ],
23307
23400
  "resolving-merge-conflicts": ["agents/openai.yaml"]
23308
23401
  };
23309
23402
  }
@@ -23722,10 +23815,10 @@ function pairGateRounds(volumes) {
23722
23815
  return rounds.sort((a, b) => a.officerStartedAt.localeCompare(b.officerStartedAt)).map((round, index) => ({ ...round, roundIndex: index + 1 }));
23723
23816
  }
23724
23817
  async function resolveOfficerSessionFromPointerFile(pointerPath) {
23725
- const { readFile: readFile24 } = await import("node:fs/promises");
23818
+ const { readFile: readFile23 } = await import("node:fs/promises");
23726
23819
  let raw;
23727
23820
  try {
23728
- raw = JSON.parse(await readFile24(pointerPath, "utf8"));
23821
+ raw = JSON.parse(await readFile23(pointerPath, "utf8"));
23729
23822
  } catch (error) {
23730
23823
  throw new Error(
23731
23824
  `direct officer run pointer unreadable in ${pointerPath}: ${error instanceof Error ? error.message : String(error)}`,
@@ -24336,123 +24429,6 @@ var init_known_failure = __esm({
24336
24429
  }
24337
24430
  });
24338
24431
 
24339
- // src/reviewer-git-snapshot.ts
24340
- var init_reviewer_git_snapshot = __esm({
24341
- "src/reviewer-git-snapshot.ts"() {
24342
- "use strict";
24343
- }
24344
- });
24345
-
24346
- // src/reviewer-preflight-error.ts
24347
- var init_reviewer_preflight_error = __esm({
24348
- "src/reviewer-preflight-error.ts"() {
24349
- "use strict";
24350
- }
24351
- });
24352
-
24353
- // src/reviewer-pinned-git.ts
24354
- import { execFile as execFile3 } from "node:child_process";
24355
- import { promisify as promisify3 } from "node:util";
24356
- var execFileAsync3;
24357
- var init_reviewer_pinned_git = __esm({
24358
- "src/reviewer-pinned-git.ts"() {
24359
- "use strict";
24360
- init_reviewer_git_snapshot();
24361
- init_sha256();
24362
- init_reviewer_preflight_error();
24363
- execFileAsync3 = promisify3(execFile3);
24364
- }
24365
- });
24366
-
24367
- // src/adr-path-refs.ts
24368
- var init_adr_path_refs = __esm({
24369
- "src/adr-path-refs.ts"() {
24370
- "use strict";
24371
- }
24372
- });
24373
-
24374
- // src/reviewer-prompt-identity.ts
24375
- var init_reviewer_prompt_identity = __esm({
24376
- "src/reviewer-prompt-identity.ts"() {
24377
- "use strict";
24378
- }
24379
- });
24380
-
24381
- // src/reviewer-dispatch.ts
24382
- var REVIEWER_PREFLIGHT_VIOLATIONS;
24383
- var init_reviewer_dispatch = __esm({
24384
- "src/reviewer-dispatch.ts"() {
24385
- "use strict";
24386
- init_reviewer_pinned_git();
24387
- init_adr_path_refs();
24388
- init_sha256();
24389
- init_reviewer_prompt_identity();
24390
- REVIEWER_PREFLIGHT_VIOLATIONS = [
24391
- "base-invalid",
24392
- "range-invalid",
24393
- "prompt-identity-invalid",
24394
- "target-drift"
24395
- ];
24396
- }
24397
- });
24398
-
24399
- // src/public-cli/reviewer-dispatch-rejection.ts
24400
- import { readFile as readFile16, unlink as unlink3 } from "node:fs/promises";
24401
- import { join as join23 } from "node:path";
24402
- function isReviewerPreflightViolation(value) {
24403
- return typeof value === "string" && REVIEWER_PREFLIGHT_VIOLATIONS.includes(value);
24404
- }
24405
- function reviewerDispatchRejectionPath(runDirectory) {
24406
- return join23(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
24407
- }
24408
- async function clearReviewerDispatchRejection(runDirectory) {
24409
- try {
24410
- await unlink3(reviewerDispatchRejectionPath(runDirectory));
24411
- } catch (error) {
24412
- if (error instanceof Error && "code" in error && error.code === "ENOENT") {
24413
- return;
24414
- }
24415
- throw error;
24416
- }
24417
- }
24418
- async function readReviewerDispatchRejection(runDirectory) {
24419
- let raw;
24420
- try {
24421
- raw = await readFile16(reviewerDispatchRejectionPath(runDirectory), "utf8");
24422
- } catch (error) {
24423
- if (error instanceof Error && "code" in error && error.code === "ENOENT") {
24424
- return void 0;
24425
- }
24426
- throw error;
24427
- }
24428
- const parsed = JSON.parse(raw);
24429
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
24430
- const error = new Error("Reviewer dispatch rejection page must be a JSON object");
24431
- error.name = "ReviewerDispatchRejectionContractError";
24432
- throw error;
24433
- }
24434
- const record4 = parsed;
24435
- if (typeof record4.diagnostic !== "string" || record4.diagnostic.trim() === "" || !Array.isArray(record4.violations) || record4.violations.length === 0 || record4.violations.some((value) => !isReviewerPreflightViolation(value))) {
24436
- const error = new Error("Reviewer dispatch rejection page has unusable required fields");
24437
- error.name = "ReviewerDispatchRejectionContractError";
24438
- throw error;
24439
- }
24440
- return {
24441
- cause: "activation",
24442
- diagnostic: record4.diagnostic,
24443
- identity: { name: "ReviewerDispatchRejectionError" },
24444
- details: { violations: Object.freeze([...record4.violations]) }
24445
- };
24446
- }
24447
- var REVIEWER_DISPATCH_REJECTION_FILE;
24448
- var init_reviewer_dispatch_rejection = __esm({
24449
- "src/public-cli/reviewer-dispatch-rejection.ts"() {
24450
- "use strict";
24451
- init_reviewer_dispatch();
24452
- REVIEWER_DISPATCH_REJECTION_FILE = "typed-known-failure.json";
24453
- }
24454
- });
24455
-
24456
24432
  // src/collector-evidence.ts
24457
24433
  var COLLECTOR_DEFAULT_WAIT_WINDOW_MS;
24458
24434
  var init_collector_evidence = __esm({
@@ -24490,7 +24466,7 @@ var init_collector_ledger = __esm({
24490
24466
  // src/engine-detour-usage.ts
24491
24467
  import { randomUUID as randomUUID3 } from "node:crypto";
24492
24468
  import { readFileSync as readFileSync3 } from "node:fs";
24493
- import { dirname as dirname12, join as join24 } from "node:path";
24469
+ import { dirname as dirname12, join as join23 } from "node:path";
24494
24470
  function isRecord8(value) {
24495
24471
  return typeof value === "object" && value !== null && !Array.isArray(value);
24496
24472
  }
@@ -24574,7 +24550,7 @@ function projectEngineDetourToolUsageForPublicTerminal(usage, options) {
24574
24550
  function readInvocationRecord(runDirectory) {
24575
24551
  try {
24576
24552
  const raw = JSON.parse(
24577
- readFileSync3(join24(runDirectory, "invocation.json"), "utf8")
24553
+ readFileSync3(join23(runDirectory, "invocation.json"), "utf8")
24578
24554
  );
24579
24555
  return isRecord8(raw) ? raw : void 0;
24580
24556
  } catch (error) {
@@ -24607,7 +24583,7 @@ function runDirectoryFromSessionDirectory(sessionDirectory) {
24607
24583
  return dirname12(sessionDirectory);
24608
24584
  }
24609
24585
  function sessionFileFromSessionDirectory(sessionDirectory) {
24610
- return join24(sessionDirectory, "session.jsonl");
24586
+ return join23(sessionDirectory, "session.jsonl");
24611
24587
  }
24612
24588
  function mintEngineDetourInvocationScope(input) {
24613
24589
  const engine = input.effectiveEngine?.trim();
@@ -24962,7 +24938,6 @@ __export(settlement_exports, {
24962
24938
  publishMergerArtifacts: () => publishMergerArtifacts,
24963
24939
  publishReviewerArtifacts: () => publishReviewerArtifacts,
24964
24940
  raceNavigatorGrace: () => raceNavigatorGrace,
24965
- readBoundEvidenceChildKnownFailure: () => readBoundEvidenceChildKnownFailure,
24966
24941
  readCollectorInfrastructureFailure: () => readCollectorInfrastructureFailure,
24967
24942
  readEngineDetourInfrastructureFailure: () => readEngineDetourInfrastructureFailure,
24968
24943
  readLawfulJudgeRoleOutcome: () => readLawfulJudgeRoleOutcome,
@@ -25003,15 +24978,15 @@ __export(settlement_exports, {
25003
24978
  withSubmissions: () => withSubmissions
25004
24979
  });
25005
24980
  import { randomUUID as randomUUID4 } from "node:crypto";
25006
- import { appendFile as appendFile2, readFile as readFile17, readdir as readdir7, writeFile as writeFile6 } from "node:fs/promises";
25007
- import { dirname as dirname13, join as join25 } from "node:path";
24981
+ import { appendFile as appendFile2, readFile as readFile16, readdir as readdir7, writeFile as writeFile6 } from "node:fs/promises";
24982
+ import { dirname as dirname13, join as join24 } from "node:path";
25008
24983
  function sealedLedgerHome(admitted) {
25009
24984
  return homeFromRunDirectory(admitted.runDirectory);
25010
24985
  }
25011
24986
  function ledgerReadScope(admitted, scope) {
25012
24987
  return {
25013
24988
  home: sealedLedgerHome(admitted),
25014
- sessionParent: join25(admitted.runDirectory, "session", "session.jsonl"),
24989
+ sessionParent: join24(admitted.runDirectory, "session", "session.jsonl"),
25015
24990
  ...scope?.courtAttemptId === void 0 || scope.courtAttemptId.length === 0 ? {} : { attemptId: scope.courtAttemptId }
25016
24991
  };
25017
24992
  }
@@ -25147,7 +25122,7 @@ function presentControlledFailure(failure, io) {
25147
25122
  }
25148
25123
  async function inspectJudgeSession(sessionFile) {
25149
25124
  try {
25150
- await readFile17(sessionFile, "utf8");
25125
+ await readFile16(sessionFile, "utf8");
25151
25126
  return { state: "present" };
25152
25127
  } catch (error) {
25153
25128
  if (isMissingPathError4(error)) return { state: "missing" };
@@ -25379,7 +25354,7 @@ function sessionReadFailure(error, fallbackMessage) {
25379
25354
  return failed;
25380
25355
  }
25381
25356
  async function readBoundSessionEntries(sessionFile) {
25382
- const text = await readFile17(sessionFile, "utf8");
25357
+ const text = await readFile16(sessionFile, "utf8");
25383
25358
  const entries = [];
25384
25359
  for (const line2 of text.trim().split("\n").filter(Boolean)) {
25385
25360
  try {
@@ -25465,37 +25440,6 @@ async function readSessionProviderStop(sessionFile) {
25465
25440
  return void 0;
25466
25441
  }
25467
25442
  }
25468
- async function readBoundEvidenceChildKnownFailure(sessionFile) {
25469
- const childDirectory = join25(dirname13(sessionFile), "evidence-children");
25470
- let names;
25471
- try {
25472
- names = await readdir7(childDirectory);
25473
- } catch (error) {
25474
- if (isMissingPathError4(error)) return void 0;
25475
- throw sessionReadFailure(error, "failed to read bound evidence-child session directory");
25476
- }
25477
- for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
25478
- let entries;
25479
- try {
25480
- entries = await readBoundSessionEntries(join25(childDirectory, file));
25481
- } catch (error) {
25482
- throw sessionReadFailure(error, "failed to read discovered evidence-child session");
25483
- }
25484
- const header = entries.find((entry) => entry.type === "session");
25485
- if (!isRecord10(header) || header.parentSession !== sessionFile) continue;
25486
- const stop = extractSessionProviderStop(entries);
25487
- if (stop === void 0) continue;
25488
- const primary = knownFailureFromProviderStop(stop);
25489
- return {
25490
- ...primary,
25491
- details: {
25492
- ...primary.details ?? {},
25493
- secondaryEvidence: "evidence-child"
25494
- }
25495
- };
25496
- }
25497
- return void 0;
25498
- }
25499
25443
  async function loadBoundAuditorVolumes(sessionFile) {
25500
25444
  let parentEntries;
25501
25445
  try {
@@ -25506,7 +25450,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
25506
25450
  }
25507
25451
  const parentId = parentEntries.find((entry) => entry.type === "session")?.id;
25508
25452
  if (parentId === void 0) return void 0;
25509
- const childDirectories = [join25(dirname13(sessionFile), "auditor-roles")];
25453
+ const childDirectories = [join24(dirname13(sessionFile), "auditor-roles")];
25510
25454
  const valid = [];
25511
25455
  let sawAnyDirectory = false;
25512
25456
  for (const childDirectory of childDirectories) {
@@ -25521,7 +25465,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
25521
25465
  for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
25522
25466
  let entries;
25523
25467
  try {
25524
- entries = await readBoundSessionEntries(join25(childDirectory, file));
25468
+ entries = await readBoundSessionEntries(join24(childDirectory, file));
25525
25469
  } catch (error) {
25526
25470
  throw sessionReadFailure(error, "failed to read discovered auditor session");
25527
25471
  }
@@ -25646,19 +25590,6 @@ function resolutionOf(knownFailure, typedHttp = { settled: false }) {
25646
25590
  }
25647
25591
  async function resolveAuditedRunnerFailureResolution(input) {
25648
25592
  if (input.runner !== void 0) return resolutionOf(input.runner);
25649
- if (input.runDirectory !== void 0) {
25650
- try {
25651
- const rejection = await readReviewerDispatchRejection(input.runDirectory);
25652
- if (rejection !== void 0) return resolutionOf(rejection);
25653
- } catch (error) {
25654
- const failure = error instanceof Error ? error : new Error(String(error));
25655
- return resolutionOf({
25656
- cause: "activation",
25657
- identity: thrownIdentity(failure),
25658
- diagnostic: failure.message || failure.name
25659
- });
25660
- }
25661
- }
25662
25593
  try {
25663
25594
  const auditorCompliance = await readBoundAuditorComplianceFailure(input.sessionFile);
25664
25595
  if (auditorCompliance !== void 0) return resolutionOf(auditorCompliance);
@@ -25696,17 +25627,6 @@ async function resolveAuditedRunnerFailureResolution(input) {
25696
25627
  diagnostic: failure.message || failure.name
25697
25628
  });
25698
25629
  }
25699
- try {
25700
- const evidenceChildFailure = await readBoundEvidenceChildKnownFailure(input.sessionFile);
25701
- if (evidenceChildFailure !== void 0) return resolutionOf(evidenceChildFailure);
25702
- } catch (error) {
25703
- const failure = sessionReadFailure(error, "failed to recover bound evidence-child failure");
25704
- return resolutionOf({
25705
- cause: "session",
25706
- identity: thrownIdentity(failure),
25707
- diagnostic: failure.message || failure.name
25708
- });
25709
- }
25710
25630
  const parentStop = await readSessionProviderStop(input.sessionFile);
25711
25631
  let httpObservation;
25712
25632
  if (input.runDirectory !== void 0) {
@@ -26038,8 +25958,8 @@ function projectTerminalGateFact(rounds) {
26038
25958
  };
26039
25959
  }
26040
25960
  async function extractGateFactFromSessionDirectory(sessionDirectory, options = {}) {
26041
- const directories = [join25(sessionDirectory, "auditor-roles")];
26042
- const parentSessionFile = options.parentSessionFile ?? join25(sessionDirectory, "session.jsonl");
25961
+ const directories = [join24(sessionDirectory, "auditor-roles")];
25962
+ const parentSessionFile = options.parentSessionFile ?? join24(sessionDirectory, "session.jsonl");
26043
25963
  const rounds = await readAnalystGateCyclesFromAuditorRoles(directories, {
26044
25964
  parentSessionFile
26045
25965
  });
@@ -26169,8 +26089,8 @@ async function extractNavigatorFactFromAdmittedSession(sessionFile) {
26169
26089
  async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
26170
26090
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26171
26091
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26172
- const reportPath = join25(artifactsDir, "report.json");
26173
- const evidencePath = join25(artifactsDir, "evidence.json");
26092
+ const reportPath = join24(artifactsDir, "report.json");
26093
+ const evidencePath = join24(artifactsDir, "evidence.json");
26174
26094
  await writeFile6(
26175
26095
  reportPath,
26176
26096
  `${JSON.stringify(
@@ -26214,8 +26134,8 @@ async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
26214
26134
  async function publishCoderArtifacts(admitted, roleOutcome, coordinates, options = {}) {
26215
26135
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26216
26136
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26217
- const reportPath = join25(artifactsDir, "report.json");
26218
- const evidencePath = join25(artifactsDir, "evidence.json");
26137
+ const reportPath = join24(artifactsDir, "report.json");
26138
+ const evidencePath = join24(artifactsDir, "evidence.json");
26219
26139
  await writeFile6(
26220
26140
  reportPath,
26221
26141
  `${JSON.stringify(
@@ -26372,8 +26292,8 @@ function extractFixerMethodInvocations(entries, options) {
26372
26292
  async function publishFixerArtifacts(admitted, roleOutcome, coordinates, options) {
26373
26293
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26374
26294
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26375
- const reportPath = join25(artifactsDir, "report.json");
26376
- const evidencePath = join25(artifactsDir, "evidence.json");
26295
+ const reportPath = join24(artifactsDir, "report.json");
26296
+ const evidencePath = join24(artifactsDir, "evidence.json");
26377
26297
  await writeFile6(
26378
26298
  reportPath,
26379
26299
  `${JSON.stringify(
@@ -26470,8 +26390,8 @@ async function settleFixerTerminalResult(admitted, authority, options, scope) {
26470
26390
  async function publishCollectorArtifacts(admitted, roleOutcome, coordinates) {
26471
26391
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26472
26392
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26473
- const reportPath = join25(artifactsDir, "report.json");
26474
- const evidencePath = join25(artifactsDir, "evidence.json");
26393
+ const reportPath = join24(artifactsDir, "report.json");
26394
+ const evidencePath = join24(artifactsDir, "evidence.json");
26475
26395
  await writeFile6(
26476
26396
  reportPath,
26477
26397
  `${JSON.stringify(
@@ -26603,8 +26523,8 @@ function extractDoctorCandidateAuditNoReceiptFact(entries) {
26603
26523
  async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
26604
26524
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26605
26525
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26606
- const reportPath = join25(artifactsDir, "report.json");
26607
- const evidencePath = join25(artifactsDir, "evidence.json");
26526
+ const reportPath = join24(artifactsDir, "report.json");
26527
+ const evidencePath = join24(artifactsDir, "evidence.json");
26608
26528
  await writeFile6(
26609
26529
  reportPath,
26610
26530
  `${JSON.stringify(
@@ -26898,7 +26818,7 @@ function extractReviewerMethodInvocations(entries, options) {
26898
26818
  const text = sessionMessageText(message);
26899
26819
  if (text.length === 0) continue;
26900
26820
  const hit = observePackagedMethodSkillInvocation(text, {
26901
- name: "code-review",
26821
+ name: "ak-cross-m-review",
26902
26822
  allowedLocations: options.allowedLocations
26903
26823
  });
26904
26824
  if (hit !== void 0) observed.push(hit);
@@ -26908,8 +26828,8 @@ function extractReviewerMethodInvocations(entries, options) {
26908
26828
  async function publishReviewerArtifacts(admitted, roleOutcome, coordinates, options) {
26909
26829
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
26910
26830
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
26911
- const reportPath = join25(artifactsDir, "report.json");
26912
- const evidencePath = join25(artifactsDir, "evidence.json");
26831
+ const reportPath = join24(artifactsDir, "report.json");
26832
+ const evidencePath = join24(artifactsDir, "evidence.json");
26913
26833
  await writeFile6(
26914
26834
  reportPath,
26915
26835
  `${JSON.stringify(
@@ -26934,6 +26854,7 @@ async function publishReviewerArtifacts(admitted, roleOutcome, coordinates, opti
26934
26854
  sessionFile: coordinates.sessionFile,
26935
26855
  admittedRequestPath: admitted.admittedRequestPath,
26936
26856
  baseRevision: admitted.baseRevision,
26857
+ lens: admitted.lens,
26937
26858
  authorityRefs: [...admitted.authorityRefs],
26938
26859
  ...admitted.instructionEmpty ? {} : { callerProvenance: admitted.instruction },
26939
26860
  attachments: admitted.attachments.map((a) => ({
@@ -27023,8 +26944,8 @@ function extractMergerMethodInvocations(entries, options) {
27023
26944
  async function publishMergerArtifacts(admitted, roleOutcome, coordinates, options) {
27024
26945
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
27025
26946
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
27026
- const reportPath = join25(artifactsDir, "report.json");
27027
- const evidencePath = join25(artifactsDir, "evidence.json");
26947
+ const reportPath = join24(artifactsDir, "report.json");
26948
+ const evidencePath = join24(artifactsDir, "evidence.json");
27028
26949
  await writeFile6(
27029
26950
  reportPath,
27030
26951
  `${JSON.stringify(
@@ -27180,7 +27101,7 @@ async function writeFailureJsonRetainingCause(preferredCandidates, uniqueFallbac
27180
27101
  const candidates = [
27181
27102
  ...preferredCandidates,
27182
27103
  // One unique name per fallback dir — collisions on fixed names cannot exhaust this.
27183
- ...uniqueFallbackDirs.map((dir) => join25(dir, `${stem}.${randomUUID4()}.json`))
27104
+ ...uniqueFallbackDirs.map((dir) => join24(dir, `${stem}.${randomUUID4()}.json`))
27184
27105
  ];
27185
27106
  for (let i = 0; i < candidates.length; i += 1) {
27186
27107
  const path = candidates[i];
@@ -27231,20 +27152,20 @@ async function publishFailureArtifacts(admitted, failure, authority) {
27231
27152
  baseDir
27232
27153
  );
27233
27154
  const errorCandidates = underArtifacts ? [
27234
- join25(baseDir, "error.json"),
27235
- join25(baseDir, "error.settlement.json"),
27236
- join25(admitted.runDirectory, "error.settlement.json")
27155
+ join24(baseDir, "error.json"),
27156
+ join24(baseDir, "error.settlement.json"),
27157
+ join24(admitted.runDirectory, "error.settlement.json")
27237
27158
  ] : [
27238
- join25(baseDir, "error.settlement.json"),
27239
- join25(baseDir, "error.json")
27159
+ join24(baseDir, "error.settlement.json"),
27160
+ join24(baseDir, "error.json")
27240
27161
  ];
27241
27162
  const evidenceCandidates = underArtifacts ? [
27242
- join25(baseDir, "evidence.json"),
27243
- join25(baseDir, "evidence.settlement.json"),
27244
- join25(admitted.runDirectory, "evidence.settlement.json")
27163
+ join24(baseDir, "evidence.json"),
27164
+ join24(baseDir, "evidence.settlement.json"),
27165
+ join24(admitted.runDirectory, "evidence.settlement.json")
27245
27166
  ] : [
27246
- join25(baseDir, "evidence.settlement.json"),
27247
- join25(baseDir, "evidence.json")
27167
+ join24(baseDir, "evidence.settlement.json"),
27168
+ join24(baseDir, "evidence.json")
27248
27169
  ];
27249
27170
  const errorPayloadBase = {
27250
27171
  kind: "error",
@@ -27456,7 +27377,6 @@ var init_settlement = __esm({
27456
27377
  init_doctor_auditor();
27457
27378
  init_judge_auditor();
27458
27379
  init_known_failure();
27459
- init_reviewer_dispatch_rejection();
27460
27380
  init_run_lifecycle();
27461
27381
  init_compliance_transport();
27462
27382
  init_collector_ledger();
@@ -27539,17 +27459,17 @@ var init_turn_request = __esm({
27539
27459
  });
27540
27460
 
27541
27461
  // src/session-identity.ts
27542
- import { mkdir as mkdir3, readFile as readFile18, rename as rename2, writeFile as writeFile7 } from "node:fs/promises";
27543
- import { dirname as dirname14, join as join26 } from "node:path";
27462
+ import { mkdir as mkdir3, readFile as readFile17, rename as rename2, writeFile as writeFile7 } from "node:fs/promises";
27463
+ import { dirname as dirname14, join as join25 } from "node:path";
27544
27464
  function createSessionIdentityAuthority(authority, sessionBindingFile) {
27545
- const bindingPath = (principal) => join26(authority.decode(principal).sessionDirectory, sessionBindingFile);
27465
+ const bindingPath = (principal) => join25(authority.decode(principal).sessionDirectory, sessionBindingFile);
27546
27466
  return {
27547
27467
  resolveSessionFile(principal) {
27548
27468
  return authority.decode(principal).sessionFile;
27549
27469
  },
27550
27470
  async load(principal) {
27551
27471
  try {
27552
- const value = JSON.parse(await readFile18(bindingPath(principal), "utf8"));
27472
+ const value = JSON.parse(await readFile17(bindingPath(principal), "utf8"));
27553
27473
  if (typeof value !== "object" || value === null || typeof value.sessionId !== "string") {
27554
27474
  throw new Error("durable session binding is invalid");
27555
27475
  }
@@ -27632,9 +27552,9 @@ var init_ticket_provenance = __esm({
27632
27552
  });
27633
27553
 
27634
27554
  // src/public-cli/case-dossier-delivery.ts
27635
- import { mkdtemp, readFile as readFile19, rm, writeFile as writeFile8 } from "node:fs/promises";
27555
+ import { mkdtemp, readFile as readFile18, rm, writeFile as writeFile8 } from "node:fs/promises";
27636
27556
  import { tmpdir } from "node:os";
27637
- import { join as join27 } from "node:path";
27557
+ import { join as join26 } from "node:path";
27638
27558
  async function projectCaseDossierPointerSection(input) {
27639
27559
  if (input.ticketNumber === void 0) {
27640
27560
  return [
@@ -27661,9 +27581,9 @@ async function deliverCaseDossierAsAttachment(input) {
27661
27581
  projectRoot: input.projectRoot,
27662
27582
  home: input.home
27663
27583
  });
27664
- const stagingDir = await mkdtemp(join27(tmpdir(), "ak-case-dossier-"));
27584
+ const stagingDir = await mkdtemp(join26(tmpdir(), "ak-case-dossier-"));
27665
27585
  try {
27666
- const stagingPath = join27(stagingDir, CASE_DOSSIER_ATTACH_FILE);
27586
+ const stagingPath = join26(stagingDir, CASE_DOSSIER_ATTACH_FILE);
27667
27587
  await writeFile8(stagingPath, `${section}
27668
27588
  `, "utf8");
27669
27589
  return await freezeAttachmentsIntoRun(
@@ -27691,7 +27611,7 @@ var init_case_dossier_delivery = __esm({
27691
27611
 
27692
27612
  // src/host-transition-prior-native.ts
27693
27613
  import { access as access3, readdir as readdir8 } from "node:fs/promises";
27694
- import { dirname as dirname15, join as join28 } from "node:path";
27614
+ import { dirname as dirname15, join as join27 } from "node:path";
27695
27615
  function isEnoent3(error) {
27696
27616
  return typeof error === "object" && error !== null && error.code === "ENOENT";
27697
27617
  }
@@ -27716,7 +27636,7 @@ async function listSitianRecordPaths(sessionParent) {
27716
27636
  const recordPaths = [];
27717
27637
  for (const entry of entries) {
27718
27638
  if (!entry.isDirectory()) continue;
27719
- const recordFile = join28(sessionRoot, entry.name, "records.jsonl");
27639
+ const recordFile = join27(sessionRoot, entry.name, "records.jsonl");
27720
27640
  try {
27721
27641
  await access3(recordFile);
27722
27642
  recordPaths.push(recordFile);
@@ -27786,7 +27706,7 @@ var init_public_run_credentials = __esm({
27786
27706
  import { constants as fsConstants2 } from "node:fs";
27787
27707
  import { randomUUID as randomUUID5 } from "node:crypto";
27788
27708
  import { lstat as lstat6, mkdir as mkdir4, open as open2 } from "node:fs/promises";
27789
- import { join as join29 } from "node:path";
27709
+ import { join as join28 } from "node:path";
27790
27710
  async function persistReturnedRunState(admitted, authority, options) {
27791
27711
  if (options?.lawful === true) {
27792
27712
  await markRunTerminal(admitted.runDirectory);
@@ -27901,7 +27821,7 @@ function jsonSafeReplacer() {
27901
27821
  };
27902
27822
  }
27903
27823
  async function writeHardenedArtifactFile(artifactsDir, namePrefix, payload) {
27904
- const filePath = join29(artifactsDir, `${namePrefix}-${randomUUID5()}.json`);
27824
+ const filePath = join28(artifactsDir, `${namePrefix}-${randomUUID5()}.json`);
27905
27825
  const body = `${JSON.stringify(payload, jsonSafeReplacer(), 2)}
27906
27826
  `;
27907
27827
  const noFollowFlag = typeof fsConstants2.O_NOFOLLOW === "number" ? fsConstants2.O_NOFOLLOW : 0;
@@ -28174,7 +28094,7 @@ var init_auto_resume = __esm({
28174
28094
  // src/public-cli/post-admission.ts
28175
28095
  import { randomUUID as randomUUID6 } from "node:crypto";
28176
28096
  import { writeFile as writeFile9 } from "node:fs/promises";
28177
- import { isAbsolute as isAbsolute8, join as join30, resolve as resolve8 } from "node:path";
28097
+ import { isAbsolute as isAbsolute8, join as join29, resolve as resolve8 } from "node:path";
28178
28098
  function describeCaughtError(error) {
28179
28099
  if (error instanceof Error) {
28180
28100
  const code = error.code;
@@ -28213,7 +28133,7 @@ async function recordBestEffortPostDispatchDiagnostic(admitted, env, diagnostic,
28213
28133
  try {
28214
28134
  const artifactsDir = await ensureRealArtifactsDirectory(admitted.runDirectory);
28215
28135
  await writeFile9(
28216
- join30(artifactsDir, `post-admission-diagnostic-${randomUUID6()}.json`),
28136
+ join29(artifactsDir, `post-admission-diagnostic-${randomUUID6()}.json`),
28217
28137
  `${JSON.stringify({ version: 1, ...payload }, null, 2)}
28218
28138
  `,
28219
28139
  { encoding: "utf8", flag: "wx" }
@@ -28350,7 +28270,7 @@ async function dispatchPostAdmissionTurn(input) {
28350
28270
  const rows = await readRecordedSubmissionRows(
28351
28271
  admitted.projectRoot,
28352
28272
  admitted.runId,
28353
- { home: homeFromRunDirectory(admitted.runDirectory), sessionParent: join30(admitted.runDirectory, "session", "session.jsonl") }
28273
+ { home: homeFromRunDirectory(admitted.runDirectory), sessionParent: join29(admitted.runDirectory, "session", "session.jsonl") }
28354
28274
  );
28355
28275
  const asserted = rows.filter((row) => row.kind === "accepted" && row.role === admitted.role).map((row) => row.accepted).find((payload) => {
28356
28276
  if (payload === null || typeof payload !== "object" || Array.isArray(payload)) return false;
@@ -28441,7 +28361,6 @@ async function dispatchPostAdmissionTurn(input) {
28441
28361
  };
28442
28362
  }
28443
28363
  await clearTypedProviderHttpObservation(admitted.runDirectory);
28444
- await clearReviewerDispatchRejection(admitted.runDirectory);
28445
28364
  if (adapters.beforeDispatch !== void 0) {
28446
28365
  try {
28447
28366
  await adapters.beforeDispatch(admitted, lease);
@@ -28510,7 +28429,7 @@ async function dispatchPostAdmissionTurn(input) {
28510
28429
  let stderrLogWriteFailure;
28511
28430
  try {
28512
28431
  await writeFile9(
28513
- join30(admitted.runDirectory, "stderr.log"),
28432
+ join29(admitted.runDirectory, "stderr.log"),
28514
28433
  result2.stderr,
28515
28434
  "utf8"
28516
28435
  );
@@ -28760,7 +28679,7 @@ async function dispatchAfterWriterLease(input) {
28760
28679
  }
28761
28680
  function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
28762
28681
  const absolute = isAbsolute8(attachmentPath) ? attachmentPath : resolve8(attachmentPath);
28763
- return pathContainedIn(join30(runDirectory, "attachments"), absolute);
28682
+ return pathContainedIn(join29(runDirectory, "attachments"), absolute);
28764
28683
  }
28765
28684
  async function prepareSummonsResumeMaterials(runDirectory, summons) {
28766
28685
  if (summons === void 0) return void 0;
@@ -29076,7 +28995,6 @@ var init_post_admission = __esm({
29076
28995
  init_public_run_credentials();
29077
28996
  init_run_lifecycle();
29078
28997
  init_activation_ledger_topology();
29079
- init_reviewer_dispatch_rejection();
29080
28998
  init_settlement();
29081
28999
  init_terminal();
29082
29000
  init_auto_resume();
@@ -30394,7 +30312,7 @@ __export(public_role_summons_exports, {
30394
30312
  summonPublicRole: () => summonPublicRole
30395
30313
  });
30396
30314
  import { existsSync as existsSync10 } from "node:fs";
30397
- import { join as join31 } from "node:path";
30315
+ import { join as join30 } from "node:path";
30398
30316
  function createCapturingIo() {
30399
30317
  const chunks = [];
30400
30318
  return {
@@ -30417,7 +30335,7 @@ function parentDir(path) {
30417
30335
  function walkPackageRoot(start) {
30418
30336
  let dir = start;
30419
30337
  for (let i = 0; i < 12; i += 1) {
30420
- if (existsSync10(join31(dir, "package.json")) && existsSync10(join31(dir, "souls"))) {
30338
+ if (existsSync10(join30(dir, "package.json")) && existsSync10(join30(dir, "souls"))) {
30421
30339
  return dir;
30422
30340
  }
30423
30341
  const parent = parentDir(dir);
@@ -30528,7 +30446,7 @@ async function createSummonEnv(options, afterHost) {
30528
30446
  async function summonPublicRole(options) {
30529
30447
  const packageRoot2 = resolveSummonsPackageRoot(options.packageRoot);
30530
30448
  const home = await resolveSummonHome(options);
30531
- const agentDir = options.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join31(home, ".pi", "agent");
30449
+ const agentDir = options.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join30(home, ".pi", "agent");
30532
30450
  const {
30533
30451
  loadCredentialProviders: loadCredentialProviders2,
30534
30452
  loadPublicCliConfig: loadPublicCliConfig2,
@@ -31788,7 +31706,7 @@ var init_merger_run = __esm({
31788
31706
 
31789
31707
  // src/public-cli/reviewer-run.ts
31790
31708
  function reviewerMethods(packageRoot2) {
31791
- return [{ kind: "skill", path: resolvePackagedMethodSkillPath(packageRoot2, "code-review") }];
31709
+ return [{ kind: "skill", path: resolvePackagedMethodSkillPath(packageRoot2, "ak-cross-m-review") }];
31792
31710
  }
31793
31711
  function buildReviewerTurnRequest(admitted, options) {
31794
31712
  return projectRoleTurnRequest(
@@ -31797,6 +31715,7 @@ function buildReviewerTurnRequest(admitted, options) {
31797
31715
  activation: {
31798
31716
  role: "reviewer",
31799
31717
  baseRevision: admitted.baseRevision,
31718
+ lens: admitted.lens,
31800
31719
  authorityRefs: admitted.authorityRefs,
31801
31720
  ...admitted.ticketNumber === void 0 ? {} : { ticketNumber: admitted.ticketNumber }
31802
31721
  },
@@ -31815,7 +31734,7 @@ function reviewerAdapters(packageRoot2, methodMaterial) {
31815
31734
  methodSkillPath: methodMaterial.skillPath,
31816
31735
  methodSkillConfiguredPath: resolvePackagedMethodSkillPath(
31817
31736
  packageRoot2,
31818
- "code-review"
31737
+ "ak-cross-m-review"
31819
31738
  )
31820
31739
  },
31821
31740
  scope
@@ -31831,7 +31750,18 @@ function reviewerAdapters(packageRoot2, methodMaterial) {
31831
31750
  };
31832
31751
  }
31833
31752
  async function loadReviewerMethodMaterial(packageRoot2) {
31834
- return await loadPackagedMethodSkillMaterial(packageRoot2, "code-review");
31753
+ return await loadPackagedMethodSkillMaterial(packageRoot2, "ak-cross-m-review");
31754
+ }
31755
+ function reviewerResumePrompt(env, message) {
31756
+ const lines = [RESUME_TRANSPORT_ENVELOPE];
31757
+ if (message !== void 0) lines.push("", message);
31758
+ return appendEngineSessionMaterial(
31759
+ lines,
31760
+ engineSessionMaterialFromOptions({
31761
+ ...pickEngineAxis(env),
31762
+ packageRoot: env.packageRoot
31763
+ })
31764
+ ).join("\n");
31835
31765
  }
31836
31766
  async function runPublicReviewer(argv, env, io, parseReviewerArgv2) {
31837
31767
  let admitted;
@@ -31844,6 +31774,7 @@ async function runPublicReviewer(argv, env, io, parseReviewerArgv2) {
31844
31774
  instruction: parsed.instruction,
31845
31775
  attachmentPaths: parsed.attachmentPaths,
31846
31776
  baseRevision: parsed.baseRevision,
31777
+ lens: parsed.lens,
31847
31778
  authorityRefs: parsed.authorityRefs,
31848
31779
  ...parsed.project === void 0 ? {} : { project: parsed.project },
31849
31780
  ...env.createRunId === void 0 ? {} : { createRunId: env.createRunId },
@@ -31907,10 +31838,7 @@ async function runPublicReviewer(argv, env, io, parseReviewerArgv2) {
31907
31838
  ...admitted.correlationId === void 0 && env.correlationId === void 0 ? {} : { correlationId: admitted.correlationId ?? env.correlationId },
31908
31839
  continuation: {
31909
31840
  kind: "resume",
31910
- prompt: buildResumeContinuationPrompt({
31911
- packageRoot: env.packageRoot,
31912
- ...pickEngineAxis(env)
31913
- })
31841
+ prompt: reviewerResumePrompt(env)
31914
31842
  }
31915
31843
  }),
31916
31844
  adapters: reviewerAdapters(env.packageRoot, methodMaterial),
@@ -31923,10 +31851,16 @@ async function runPublicReviewerResume(request, env, io) {
31923
31851
  env,
31924
31852
  io,
31925
31853
  load: (effective) => loadResumableReviewerRun(env.home, effective.runId, env.principalAuthority),
31926
- buildTurnRequest: (admitted, effective) => buildReviewerTurnRequest(
31927
- admitted,
31928
- resumeTurnRequestProjectionOptions(admitted, effective, env)
31929
- ),
31854
+ buildTurnRequest: (admitted, effective) => {
31855
+ const base = resumeTurnRequestProjectionOptions(admitted, effective, env);
31856
+ return buildReviewerTurnRequest(admitted, {
31857
+ ...base,
31858
+ continuation: {
31859
+ kind: "resume",
31860
+ prompt: reviewerResumePrompt(env, effective.message)
31861
+ }
31862
+ });
31863
+ },
31930
31864
  adapters: reviewerAdapters(env.packageRoot),
31931
31865
  afterAdmittedLoad: (admitted) => resolveResumeMethodMaterialAdapters({
31932
31866
  admitted,
@@ -31990,10 +31924,10 @@ var init_analyst_book_key = __esm({
31990
31924
  // src/atomic-write.ts
31991
31925
  import { randomUUID as randomUUID7 } from "node:crypto";
31992
31926
  import { rename as rename3, rm as rm2, writeFile as writeFile10 } from "node:fs/promises";
31993
- import { dirname as dirname16, join as join32 } from "node:path";
31927
+ import { dirname as dirname16, join as join31 } from "node:path";
31994
31928
  async function writeFileAtomically(destination, contents) {
31995
31929
  const parent = dirname16(destination);
31996
- const temporary = join32(parent, `.atomic-write-${randomUUID7()}.tmp`);
31930
+ const temporary = join31(parent, `.atomic-write-${randomUUID7()}.tmp`);
31997
31931
  try {
31998
31932
  await writeFile10(temporary, contents);
31999
31933
  await rename3(temporary, destination);
@@ -32009,8 +31943,8 @@ var init_atomic_write = __esm({
32009
31943
  });
32010
31944
 
32011
31945
  // src/analyst-index.ts
32012
- import { open as open3, readFile as readFile20, unlink as unlink4 } from "node:fs/promises";
32013
- import { dirname as dirname17, join as join33 } from "node:path";
31946
+ import { open as open3, readFile as readFile19, unlink as unlink3 } from "node:fs/promises";
31947
+ import { dirname as dirname17, join as join32 } from "node:path";
32014
31948
  function sleep(ms) {
32015
31949
  return new Promise((resolve10) => {
32016
31950
  setTimeout(resolve10, ms);
@@ -32019,7 +31953,7 @@ function sleep(ms) {
32019
31953
  async function withAnalystLibraryIndexLock(ledgerHome, fn) {
32020
31954
  const indexPath = analystLibraryIndexPath(ledgerHome);
32021
31955
  ensureRealDirectoryTree(ledgerHome, dirname17(indexPath));
32022
- const lockPath = join33(dirname17(indexPath), LIBRARY_INDEX_LOCK_NAME);
31956
+ const lockPath = join32(dirname17(indexPath), LIBRARY_INDEX_LOCK_NAME);
32023
31957
  assertLedgerFileInsideHome(lockPath, ledgerHome);
32024
31958
  const startedAt = Date.now();
32025
31959
  while (true) {
@@ -32031,7 +31965,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
32031
31965
  return await fn();
32032
31966
  } finally {
32033
31967
  await handle.close().catch(() => void 0);
32034
- await unlink4(lockPath).catch(() => void 0);
31968
+ await unlink3(lockPath).catch(() => void 0);
32035
31969
  }
32036
31970
  } catch (error) {
32037
31971
  const code = error instanceof Error && "code" in error ? error.code : void 0;
@@ -32046,7 +31980,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
32046
31980
  }
32047
31981
  }
32048
31982
  function analystLibraryIndexPath(ledgerHome) {
32049
- return join33(ledgerHome, "analyst", "library-index.json");
31983
+ return join32(ledgerHome, "analyst", "library-index.json");
32050
31984
  }
32051
31985
  function rowFromIssueMetricsPage(page) {
32052
31986
  return {
@@ -32137,7 +32071,7 @@ async function readAnalystLibraryIndexPage(ledgerHome) {
32137
32071
  const path = analystLibraryIndexPath(ledgerHome);
32138
32072
  let raw;
32139
32073
  try {
32140
- raw = await readFile20(path, "utf8");
32074
+ raw = await readFile19(path, "utf8");
32141
32075
  } catch (error) {
32142
32076
  if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR")) {
32143
32077
  return void 0;
@@ -32341,8 +32275,8 @@ var init_analyst_cohort = __esm({
32341
32275
  });
32342
32276
 
32343
32277
  // src/analyst-ledger.ts
32344
- import { readdir as readdir9, readFile as readFile21 } from "node:fs/promises";
32345
- import { basename as basename8, join as join34 } from "node:path";
32278
+ import { readdir as readdir9, readFile as readFile20 } from "node:fs/promises";
32279
+ import { basename as basename8, join as join33 } from "node:path";
32346
32280
  function isMissingPathError6(error) {
32347
32281
  return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
32348
32282
  }
@@ -32355,7 +32289,7 @@ function isRecord11(value) {
32355
32289
  async function readExistingRunLifecycleState(runDirectory) {
32356
32290
  try {
32357
32291
  const raw = JSON.parse(
32358
- await readFile21(join34(runDirectory, "run-state.json"), "utf8")
32292
+ await readFile20(join33(runDirectory, "run-state.json"), "utf8")
32359
32293
  );
32360
32294
  if (!isRecord11(raw) || typeof raw.state !== "string") return void 0;
32361
32295
  return raw.state;
@@ -32387,7 +32321,7 @@ async function listLedgerBookNames(booksRoot) {
32387
32321
  async function readInvocationScopeFields(runDirectory) {
32388
32322
  let raw;
32389
32323
  try {
32390
- raw = await readFile21(join34(runDirectory, "invocation.json"), "utf8");
32324
+ raw = await readFile20(join33(runDirectory, "invocation.json"), "utf8");
32391
32325
  } catch (error) {
32392
32326
  if (isMissingPathError6(error)) return void 0;
32393
32327
  throw error;
@@ -32420,7 +32354,7 @@ function decideIssueScope(input) {
32420
32354
  }
32421
32355
  async function resolveSessionFile(runDirectory) {
32422
32356
  try {
32423
- const raw = await readFile21(join34(runDirectory, "invocation.json"), "utf8");
32357
+ const raw = await readFile20(join33(runDirectory, "invocation.json"), "utf8");
32424
32358
  const parsed = JSON.parse(raw);
32425
32359
  if (isRecord11(parsed) && typeof parsed.sessionFile === "string" && parsed.sessionFile.trim() !== "") {
32426
32360
  return parsed.sessionFile;
@@ -32428,7 +32362,7 @@ async function resolveSessionFile(runDirectory) {
32428
32362
  } catch (error) {
32429
32363
  if (!isMissingPathError6(error)) throw error;
32430
32364
  }
32431
- return join34(runDirectory, "session", "session.jsonl");
32365
+ return join33(runDirectory, "session", "session.jsonl");
32432
32366
  }
32433
32367
  function attributeSessionRowsForRun(input) {
32434
32368
  if (pathContainedIn(input.runDirectory, input.sessionFile)) {
@@ -32600,9 +32534,9 @@ async function classifyScopedRun(input) {
32600
32534
  }
32601
32535
  let gateCycles;
32602
32536
  try {
32603
- const parentSessionFile = join34(input.runDirectory, "session", "session.jsonl");
32537
+ const parentSessionFile = join33(input.runDirectory, "session", "session.jsonl");
32604
32538
  gateCycles = await readAnalystGateCyclesFromAuditorRoles(
32605
- join34(input.runDirectory, "session", "auditor-roles"),
32539
+ join33(input.runDirectory, "session", "auditor-roles"),
32606
32540
  { parentSessionFile }
32607
32541
  );
32608
32542
  } catch (error) {
@@ -32635,7 +32569,7 @@ async function classifyScopedRun(input) {
32635
32569
  async function scanAnalystIssueRuns(input) {
32636
32570
  const ledgerHome = resolveActivationLedgerHome(input.home);
32637
32571
  const scopeTicketNumber = input.ticketNumber;
32638
- const booksRoot = join34(ledgerHome, "books");
32572
+ const booksRoot = join33(ledgerHome, "books");
32639
32573
  let wholeBook = false;
32640
32574
  let scopeRootIdentity;
32641
32575
  let bookNames;
@@ -32667,7 +32601,7 @@ async function scanAnalystIssueRuns(input) {
32667
32601
  const unreadable = [];
32668
32602
  const scopeConflicts = [];
32669
32603
  for (const book of bookNames) {
32670
- const bookDir = join34(booksRoot, book);
32604
+ const bookDir = join33(booksRoot, book);
32671
32605
  let runDirectories;
32672
32606
  try {
32673
32607
  runDirectories = await listBookRunDirectories(bookDir);
@@ -33534,7 +33468,7 @@ var init_analyst_metric_family = __esm({
33534
33468
 
33535
33469
  // src/analyst-page.ts
33536
33470
  import { createHash as createHash5 } from "node:crypto";
33537
- import { dirname as dirname18, join as join35 } from "node:path";
33471
+ import { dirname as dirname18, join as join34 } from "node:path";
33538
33472
  function analystIssuePageKey(address) {
33539
33473
  const parts = ["book", address.bookKey];
33540
33474
  if (address.issueNumber !== void 0) {
@@ -33545,7 +33479,7 @@ function analystIssuePageKey(address) {
33545
33479
  return createHash5("sha256").update(parts.join("\0")).digest("hex").slice(0, 32);
33546
33480
  }
33547
33481
  function analystIssuePagePath(ledgerHome, address) {
33548
- return join35(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
33482
+ return join34(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
33549
33483
  }
33550
33484
  function analystIssuePageAddressFromPage(page) {
33551
33485
  return {
@@ -33681,7 +33615,7 @@ var init_analyst_page = __esm({
33681
33615
  });
33682
33616
 
33683
33617
  // src/analyst-entry.ts
33684
- import { readFile as readFile22 } from "node:fs/promises";
33618
+ import { readFile as readFile21 } from "node:fs/promises";
33685
33619
  function isMissingPathError7(error) {
33686
33620
  return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
33687
33621
  }
@@ -33711,7 +33645,7 @@ async function readOrComputeAnalystIssuePage(input, options) {
33711
33645
  ...issueNumber === void 0 && input.bookKey === void 0 ? { scopeRootIdentity: projectRoot } : {}
33712
33646
  });
33713
33647
  try {
33714
- const raw = await readFile22(pagePath, "utf8");
33648
+ const raw = await readFile21(pagePath, "utf8");
33715
33649
  const page = JSON.parse(raw);
33716
33650
  if (cachedPageMatchesRequestedScope(page, { bookKey, ...input })) {
33717
33651
  return { mode: "issue", page, pagePath };
@@ -33806,7 +33740,7 @@ async function runAnalystModelGroupsMode(input, home) {
33806
33740
  scopeRootIdentity: projectRoot
33807
33741
  });
33808
33742
  try {
33809
- const raw = await readFile22(pagePath, "utf8");
33743
+ const raw = await readFile21(pagePath, "utf8");
33810
33744
  JSON.parse(raw);
33811
33745
  } catch (error) {
33812
33746
  if (!isMissingPathError7(error)) {
@@ -33905,7 +33839,7 @@ var init_analyst_entry = __esm({
33905
33839
  });
33906
33840
 
33907
33841
  // src/public-cli/analyst-run.ts
33908
- import { readFile as readFile23 } from "node:fs/promises";
33842
+ import { readFile as readFile22 } from "node:fs/promises";
33909
33843
  import { isAbsolute as isAbsolute10, resolve as resolve9 } from "node:path";
33910
33844
  function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
33911
33845
  try {
@@ -33958,7 +33892,7 @@ async function buildAnalystSweepModeInputFromAttachmentPaths(attachmentPaths) {
33958
33892
  const absolute = isAbsolute10(sourcePath) ? sourcePath : resolve9(sourcePath);
33959
33893
  let bytes;
33960
33894
  try {
33961
- bytes = await readFile23(absolute);
33895
+ bytes = await readFile22(absolute);
33962
33896
  } catch (error) {
33963
33897
  throw new CliUsageError(
33964
33898
  `analyst sweep attachment is not a readable regular file: ${sourcePath}`,
@@ -34078,7 +34012,7 @@ __export(cli_exports, {
34078
34012
  runAkRole: () => runAkRole
34079
34013
  });
34080
34014
  import { realpath as realpath6 } from "node:fs/promises";
34081
- import { join as join36 } from "node:path";
34015
+ import { join as join35 } from "node:path";
34082
34016
  function takePublicGlobalFlag(argv, index, options) {
34083
34017
  const tokens = argv.slice(index);
34084
34018
  const taken = options.takeDashed(tokens);
@@ -34210,7 +34144,7 @@ function resolveHome(env) {
34210
34144
  return env.home ?? packageMachineHome();
34211
34145
  }
34212
34146
  function resolveAgentDir(env, home) {
34213
- return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join36(home, ".pi", "agent");
34147
+ return env.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join35(home, ".pi", "agent");
34214
34148
  }
34215
34149
  function parseThinking(value) {
34216
34150
  return value;
@@ -35097,7 +35031,7 @@ var init_cli = __esm({
35097
35031
 
35098
35032
  // src/public-cli/main.ts
35099
35033
  import { existsSync as existsSync11 } from "node:fs";
35100
- import { dirname as dirname19, join as join37 } from "node:path";
35034
+ import { dirname as dirname19, join as join36 } from "node:path";
35101
35035
  import { fileURLToPath as fileURLToPath2 } from "node:url";
35102
35036
 
35103
35037
  // src/public-cli/host-pi-runtime.ts
@@ -35186,8 +35120,8 @@ function linkPackage(packageRoot2, name, targetDir) {
35186
35120
  // src/public-cli/main.ts
35187
35121
  var here = dirname19(fileURLToPath2(import.meta.url));
35188
35122
  function resolvePackageRoot(binDir) {
35189
- const canonical = join37(binDir, "..", "..");
35190
- if (existsSync11(join37(canonical, "package.json"))) {
35123
+ const canonical = join36(binDir, "..", "..");
35124
+ if (existsSync11(join36(canonical, "package.json"))) {
35191
35125
  return canonical;
35192
35126
  }
35193
35127
  return binDir;