@akagilnc/pi-workflow-roles 0.1.4405 → 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 (59) 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/reviewer.md +1 -1
  26. package/src/archivist-record-entry.ts +1 -1
  27. package/src/canonical-skill-binding.ts +2 -2
  28. package/src/host-contracts.ts +2 -0
  29. package/src/package-contracts/reviewer-output.ts +4 -2
  30. package/src/package-resources/method-skill.ts +7 -2
  31. package/src/pi/role-turn-host.ts +3 -1
  32. package/src/public-cli/invocation.ts +108 -39
  33. package/src/public-cli/option-definitions.ts +23 -6
  34. package/src/public-cli/post-admission.ts +0 -4
  35. package/src/public-cli/reviewer-run.ts +39 -16
  36. package/src/public-cli/run-lifecycle.ts +33 -3
  37. package/src/public-cli/settlement.ts +8 -73
  38. package/src/reviewer-role.ts +27 -16
  39. package/src/role-activation-flags.ts +1 -0
  40. package/src/role-runtime-dependencies.ts +2 -4
  41. package/src/role-runtime.ts +9 -26
  42. package/src/worker-role.ts +1 -1
  43. package/dist/adr-path-refs.js +0 -23
  44. package/dist/public-cli/reviewer-dispatch-rejection.js +0 -77
  45. package/dist/reviewer-dispatch.js +0 -14
  46. package/dist/reviewer-git-snapshot.js +0 -32
  47. package/dist/reviewer-pinned-git.js +0 -308
  48. package/dist/reviewer-preflight-error.js +0 -15
  49. package/dist/reviewer-prompt-identity.js +0 -10
  50. package/resources/methods/code-review/SKILL.md +0 -92
  51. package/resources/methods/code-review/agents/openai.yaml +0 -3
  52. package/resources/methods/code-review/provenance.json +0 -26
  53. package/src/adr-path-refs.ts +0 -25
  54. package/src/public-cli/reviewer-dispatch-rejection.ts +0 -106
  55. package/src/reviewer-dispatch.ts +0 -39
  56. package/src/reviewer-git-snapshot.ts +0 -45
  57. package/src/reviewer-pinned-git.ts +0 -330
  58. package/src/reviewer-preflight-error.ts +0 -14
  59. package/src/reviewer-prompt-identity.ts +0 -17
@@ -1521,10 +1521,10 @@ __export(session_assistant_usage_exports, {
1521
1521
  });
1522
1522
  import { join as join8 } from "node:path";
1523
1523
  async function readAssistantUsageFromSessionFile(sessionFile) {
1524
- const { readFile: readFile25 } = await import("node:fs/promises");
1524
+ const { readFile: readFile24 } = await import("node:fs/promises");
1525
1525
  let text;
1526
1526
  try {
1527
- text = await readFile25(sessionFile, "utf8");
1527
+ text = await readFile24(sessionFile, "utf8");
1528
1528
  } catch (error) {
1529
1529
  if (error?.code === "ENOENT") return void 0;
1530
1530
  throw error;
@@ -2801,6 +2801,7 @@ function projectActivationFlags(request) {
2801
2801
  }
2802
2802
  if (activation.role === "reviewer") {
2803
2803
  flags.set("ak-review-base", activation.baseRevision);
2804
+ flags.set("ak-review-lens", activation.lens);
2804
2805
  flags.set("ak-review-authority-refs", JSON.stringify(activation.authorityRefs));
2805
2806
  if (activation.ticketNumber !== void 0) {
2806
2807
  flags.set("ak-review-ticket-number", String(activation.ticketNumber));
@@ -3244,7 +3245,7 @@ function piUserDialogueBody(request) {
3244
3245
  const _exhaustive = request.continuation;
3245
3246
  return _exhaustive;
3246
3247
  })();
3247
- return applyPiNativeSkillInvocation(request.methods, rawPrompt);
3248
+ return request.continuation.kind === "resume" && request.activation.role === "reviewer" ? rawPrompt : applyPiNativeSkillInvocation(request.methods, rawPrompt);
3248
3249
  }
3249
3250
  async function resolveSelectedPi(command, cwd, env) {
3250
3251
  const searchPath = env.PATH ?? (platform === "win32" ? process.env.PATH ?? "" : "/usr/bin:/bin");
@@ -6110,6 +6111,7 @@ async function loadResumableRunRecord(home, runId, authority) {
6110
6111
  let prerequisitesPath;
6111
6112
  let prerequisites;
6112
6113
  let baseRevision;
6114
+ let lens;
6113
6115
  let authorityRefs;
6114
6116
  let mergerInputPath;
6115
6117
  let derived;
@@ -6163,6 +6165,9 @@ async function loadResumableRunRecord(home, runId, authority) {
6163
6165
  if (typeof record4.baseRevision === "string" && record4.baseRevision.trim() !== "") {
6164
6166
  baseRevision = record4.baseRevision;
6165
6167
  }
6168
+ if (isReviewerLens(record4.lens)) {
6169
+ lens = record4.lens;
6170
+ }
6166
6171
  if (typeof record4.prNumber === "number" && Number.isSafeInteger(record4.prNumber) && record4.prNumber >= 1) {
6167
6172
  prNumber = record4.prNumber;
6168
6173
  }
@@ -6300,6 +6305,7 @@ async function loadResumableRunRecord(home, runId, authority) {
6300
6305
  ...prerequisitesPath === void 0 ? {} : { prerequisitesPath },
6301
6306
  ...prerequisites === void 0 ? {} : { prerequisites },
6302
6307
  ...baseRevision === void 0 ? {} : { baseRevision },
6308
+ ...lens === void 0 ? {} : { lens },
6303
6309
  ...authorityRefs === void 0 ? {} : { authorityRefs },
6304
6310
  ...mergerInputPath === void 0 ? {} : { mergerInputPath },
6305
6311
  ...derived === void 0 ? {} : { derived },
@@ -7108,18 +7114,32 @@ var init_option_definitions = __esm({
7108
7114
  zh: "\u5FC5\u586B\uFF1B\u9489\u4F4F\u5BA1\u67E5\u76EE\u6807\u7684 fixed-point revision\u3002"
7109
7115
  }
7110
7116
  },
7117
+ {
7118
+ id: "lens",
7119
+ owner: "reviewer",
7120
+ canonical: "--lens",
7121
+ aliases: [],
7122
+ valueMetavar: "completeness|correctness",
7123
+ required: true,
7124
+ repeatable: false,
7125
+ form: "option",
7126
+ description: {
7127
+ en: "Required single review lens: completeness or correctness (no default).",
7128
+ zh: "\u5FC5\u586B\u5355 lens\uFF1Acompleteness \u6216 correctness\uFF08\u65E0\u9ED8\u8BA4\u503C\uFF09\u3002"
7129
+ }
7130
+ },
7111
7131
  {
7112
7132
  id: "authority-ref",
7113
7133
  owner: "reviewer",
7114
7134
  canonical: "--authority-ref",
7115
7135
  aliases: [],
7116
7136
  valueMetavar: "ref",
7117
- required: false,
7137
+ required: true,
7118
7138
  repeatable: true,
7119
7139
  form: "option",
7120
7140
  description: {
7121
- en: "Durable authority reference/URL (repeatable; refs only, not inline prose).",
7122
- zh: "\u6301\u4E45 authority \u5F15\u7528/URL\uFF08\u53EF\u91CD\u590D\uFF1B\u4EC5 ref\uFF0C\u975E\u5185\u8054\u6563\u6587\uFF09\u3002"
7141
+ en: "Required durable authority reference/URL (repeatable; refs only, not inline prose).",
7142
+ zh: "\u5FC5\u586B\u6301\u4E45 authority \u5F15\u7528/URL\uFF08\u53EF\u91CD\u590D\uFF1B\u4EC5 ref\uFF0C\u975E\u5185\u8054\u6563\u6587\uFF09\u3002"
7123
7143
  }
7124
7144
  }
7125
7145
  ];
@@ -7462,10 +7482,13 @@ var init_option_definitions = __esm({
7462
7482
  },
7463
7483
  reviewer: {
7464
7484
  command: "reviewer",
7465
- summary: "Fixed-target two-axis review (Standards + Spec).",
7466
- usage: ["ak-role reviewer --base <revision> [options] <instruction>"],
7485
+ summary: "Fixed-target single-lens review (completeness or correctness).",
7486
+ usage: [
7487
+ "ak-role reviewer --base <revision> --lens completeness|correctness --authority-ref <ref> [options] <instruction>"
7488
+ ],
7467
7489
  examples: [
7468
- 'ak-role reviewer --base main "Review the branch against the governing issue and repository authority."'
7490
+ 'ak-role reviewer --base main --lens completeness --authority-ref docs/adr/0001.md "Review the branch."',
7491
+ "ak-role reviewer --base main --lens correctness --authority-ref CLAUDE.md --authority-ref docs/adr/0001.md"
7469
7492
  ]
7470
7493
  },
7471
7494
  collector: {
@@ -7669,12 +7692,14 @@ __export(invocation_exports, {
7669
7692
  buildJudgeTransportPrompt: () => buildJudgeTransportPrompt,
7670
7693
  buildMergerTransportPrompt: () => buildMergerTransportPrompt,
7671
7694
  buildNotaryTransportPrompt: () => buildNotaryTransportPrompt,
7695
+ buildReviewerSkillArgProjection: () => buildReviewerSkillArgProjection,
7672
7696
  buildReviewerTransportPrompt: () => buildReviewerTransportPrompt,
7673
7697
  buildSecretariatTransportPrompt: () => buildSecretariatTransportPrompt,
7674
7698
  deriveMergerEnvelopeFromActiveMerge: () => deriveMergerEnvelopeFromActiveMerge,
7675
7699
  ensureRunArtifactsDir: () => ensureRunArtifactsDir,
7676
7700
  freezeAttachmentsIntoRun: () => freezeAttachmentsIntoRun,
7677
7701
  homeFromRunDirectory: () => homeFromRunDirectory,
7702
+ isReviewerLens: () => isReviewerLens,
7678
7703
  issueAdmissionPlacement: () => issueAdmissionPlacement,
7679
7704
  loadAdmittedJudgeRequest: () => loadAdmittedJudgeRequest,
7680
7705
  observeLaunchedRolePackageIdentity: () => observeLaunchedRolePackageIdentity,
@@ -7705,6 +7730,8 @@ __export(invocation_exports, {
7705
7730
  recordLaunchedRolePackageIdentity: () => recordLaunchedRolePackageIdentity,
7706
7731
  relocateAdmittedRunToTicket: () => relocateAdmittedRunToTicket,
7707
7732
  requireAuthorityRef: () => requireAuthorityRef,
7733
+ requireReviewerBaseRevision: () => requireReviewerBaseRevision,
7734
+ requireReviewerLens: () => requireReviewerLens,
7708
7735
  resolveDoctorCaseRunsPath: () => resolveDoctorCaseRunsPath,
7709
7736
  resolveGitHubRemoteRepository: () => resolveGitHubRemoteRepository
7710
7737
  });
@@ -8075,6 +8102,35 @@ function requireOptionPath(flag, value) {
8075
8102
  }
8076
8103
  return value;
8077
8104
  }
8105
+ function requireSkillArgToken(value, messages) {
8106
+ if (value === void 0 || value.trim() === "") {
8107
+ throw new CliUsageError(messages.empty);
8108
+ }
8109
+ if (/\s/.test(value)) {
8110
+ throw new CliUsageError(messages.whitespace);
8111
+ }
8112
+ if (value.startsWith("-")) {
8113
+ throw new CliUsageError(messages.optionLike);
8114
+ }
8115
+ return value;
8116
+ }
8117
+ function requireReviewerBaseRevision(value) {
8118
+ return requireSkillArgToken(value, {
8119
+ empty: "--base requires a nonempty revision",
8120
+ whitespace: "--base requires a single-token revision",
8121
+ optionLike: "--base requires a single-token revision"
8122
+ });
8123
+ }
8124
+ function isReviewerLens(value) {
8125
+ return value === "completeness" || value === "correctness";
8126
+ }
8127
+ function requireReviewerLens(value) {
8128
+ const trimmed = (value ?? "").trim();
8129
+ if (!isReviewerLens(trimmed)) {
8130
+ throw new CliUsageError("--lens requires completeness or correctness");
8131
+ }
8132
+ return trimmed;
8133
+ }
8078
8134
  function isRejectedPublicSpelling(owner, token) {
8079
8135
  for (const entry of REJECTED_PUBLIC_SPELLINGS) {
8080
8136
  if (entry.owner !== owner) continue;
@@ -8088,15 +8144,11 @@ function roleOptions(owner) {
8088
8144
  return optionsForOwner(owner);
8089
8145
  }
8090
8146
  function requireAuthorityRef(value) {
8091
- if (value === void 0 || value.trim() === "") {
8092
- throw new CliUsageError("--authority-ref requires a nonempty durable reference");
8093
- }
8094
- if (/\s/.test(value)) {
8095
- throw new CliUsageError(
8096
- "--authority-ref requires a durable reference, not inline Spec prose"
8097
- );
8098
- }
8099
- return value;
8147
+ return requireSkillArgToken(value, {
8148
+ empty: "--authority-ref requires a nonempty durable reference",
8149
+ whitespace: "--authority-ref requires a durable reference, not inline Spec prose",
8150
+ optionLike: "--authority-ref requires a durable reference, not inline Spec prose"
8151
+ });
8100
8152
  }
8101
8153
  function parseJudgeArgv(args) {
8102
8154
  const dd = args.indexOf("--");
@@ -9400,6 +9452,7 @@ function parseReviewerArgv(args) {
9400
9452
  const authorityRefs = [];
9401
9453
  let project;
9402
9454
  let baseRevision;
9455
+ let lens;
9403
9456
  const positional = [];
9404
9457
  const tokens = [...args];
9405
9458
  const definitions = roleOptions("reviewer");
@@ -9417,7 +9470,11 @@ function parseReviewerArgv(args) {
9417
9470
  continue;
9418
9471
  }
9419
9472
  if (taken.def.id === "base") {
9420
- baseRevision = requireOptionPath(taken.def.canonical, taken.value);
9473
+ baseRevision = requireReviewerBaseRevision(taken.value);
9474
+ continue;
9475
+ }
9476
+ if (taken.def.id === "lens") {
9477
+ lens = requireReviewerLens(taken.value);
9421
9478
  continue;
9422
9479
  }
9423
9480
  if (taken.def.id === "authority-ref") {
@@ -9437,6 +9494,7 @@ function parseReviewerArgv(args) {
9437
9494
  instruction: positional.join(" "),
9438
9495
  attachmentPaths,
9439
9496
  baseRevision,
9497
+ lens,
9440
9498
  authorityRefs,
9441
9499
  ...project === void 0 ? {} : { project }
9442
9500
  };
@@ -9445,11 +9503,13 @@ async function admitReviewerInvocation(options) {
9445
9503
  if (options.project !== void 0) {
9446
9504
  requireOptionPath("--project", options.project);
9447
9505
  }
9448
- if (options.baseRevision.trim() === "") {
9449
- throw new CliUsageError("--base requires a nonempty revision");
9506
+ const baseRevision = requireReviewerBaseRevision(options.baseRevision);
9507
+ const lens = requireReviewerLens(options.lens);
9508
+ if (options.authorityRefs.length === 0) {
9509
+ throw new CliUsageError("reviewer requires --authority-ref <ref>");
9450
9510
  }
9451
9511
  const authorityRefs = Object.freeze(
9452
- (options.authorityRefs ?? []).map((ref) => requireAuthorityRef(ref))
9512
+ options.authorityRefs.map((ref) => requireAuthorityRef(ref))
9453
9513
  );
9454
9514
  const projectRoot = resolve9(options.project ?? options.cwd);
9455
9515
  const runId = (options.createRunId ?? uuidv7)();
@@ -9480,7 +9540,8 @@ async function admitReviewerInvocation(options) {
9480
9540
  principal,
9481
9541
  instruction,
9482
9542
  instructionEmpty,
9483
- baseRevision: options.baseRevision,
9543
+ baseRevision,
9544
+ lens,
9484
9545
  authorityRefs: [...authorityRefs],
9485
9546
  attachments: attachments.map((a) => ({
9486
9547
  provenancePath: a.provenancePath,
@@ -9507,14 +9568,20 @@ async function admitReviewerInvocation(options) {
9507
9568
  runDirectory,
9508
9569
  principal,
9509
9570
  admittedRequestPath,
9510
- baseRevision: options.baseRevision,
9571
+ baseRevision,
9572
+ lens,
9511
9573
  authorityRefs
9512
9574
  };
9513
9575
  }
9576
+ function buildReviewerSkillArgProjection(admitted) {
9577
+ return [
9578
+ `--base ${admitted.baseRevision}`,
9579
+ `--lens ${admitted.lens}`,
9580
+ ...admitted.authorityRefs.map((ref) => `--authority ${ref}`)
9581
+ ].join(" ");
9582
+ }
9514
9583
  function buildReviewerTransportPrompt(admitted, engineMaterial) {
9515
- const lines = [
9516
- `\u672C\u6B21\u5BA1\u67E5\u7684\u56FA\u5B9A\u57FA\u70B9\uFF1A${admitted.baseRevision}`
9517
- ];
9584
+ const lines = [buildReviewerSkillArgProjection(admitted)];
9518
9585
  if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
9519
9586
  lines.push("", admitted.instruction);
9520
9587
  }
@@ -11224,10 +11291,10 @@ function pairGateRounds(volumes) {
11224
11291
  return rounds.sort((a, b) => a.officerStartedAt.localeCompare(b.officerStartedAt)).map((round, index) => ({ ...round, roundIndex: index + 1 }));
11225
11292
  }
11226
11293
  async function resolveOfficerSessionFromPointerFile(pointerPath) {
11227
- const { readFile: readFile25 } = await import("node:fs/promises");
11294
+ const { readFile: readFile24 } = await import("node:fs/promises");
11228
11295
  let raw;
11229
11296
  try {
11230
- raw = JSON.parse(await readFile25(pointerPath, "utf8"));
11297
+ raw = JSON.parse(await readFile24(pointerPath, "utf8"));
11231
11298
  } catch (error) {
11232
11299
  throw new Error(
11233
11300
  `direct officer run pointer unreadable in ${pointerPath}: ${error instanceof Error ? error.message : String(error)}`,
@@ -12083,387 +12150,6 @@ var init_known_failure = __esm({
12083
12150
  }
12084
12151
  });
12085
12152
 
12086
- // src/reviewer-git-snapshot.ts
12087
- function parseReviewerRefSnapshot(raw) {
12088
- const refs = {};
12089
- for (const line2 of raw.split("\n")) {
12090
- if (!line2) continue;
12091
- const fields = line2.split("\0");
12092
- if (fields.length !== 5 || !fields[0] || !fields[1] || !fields[3]) {
12093
- throw new Error(`Malformed Git ref snapshot line: ${line2}`);
12094
- }
12095
- const peeledCommitId = fields[3] === "commit" ? fields[1] : fields[4] === "commit" && fields[2] ? fields[2] : null;
12096
- refs[fields[0]] = Object.freeze({
12097
- objectId: fields[1],
12098
- peeledCommitId
12099
- });
12100
- }
12101
- return refs;
12102
- }
12103
- function reviewerRefSnapshotArgs() {
12104
- return ["for-each-ref", "--format=%(refname)%00%(objectname)%00%(*objectname)%00%(objecttype)%00%(*objecttype)", ...REVIEW_REF_PREFIXES];
12105
- }
12106
- function immutableReviewerRefs(refs) {
12107
- return Object.freeze(Object.fromEntries(Object.entries(refs).sort(([a], [b]) => a.localeCompare(b)).map(([name, entry]) => [name, Object.freeze({ objectId: entry.objectId, peeledCommitId: entry.peeledCommitId })])));
12108
- }
12109
- var REVIEW_REF_PREFIXES;
12110
- var init_reviewer_git_snapshot = __esm({
12111
- "src/reviewer-git-snapshot.ts"() {
12112
- "use strict";
12113
- REVIEW_REF_PREFIXES = ["refs/heads", "refs/tags", "refs/remotes"];
12114
- }
12115
- });
12116
-
12117
- // src/reviewer-preflight-error.ts
12118
- var ReviewerCorrectablePreflightError;
12119
- var init_reviewer_preflight_error = __esm({
12120
- "src/reviewer-preflight-error.ts"() {
12121
- "use strict";
12122
- ReviewerCorrectablePreflightError = class extends Error {
12123
- constructor(code, diagnostic = `${code} constraint failed`, options) {
12124
- super(`${code}: ${diagnostic}`, options);
12125
- this.code = code;
12126
- this.diagnostic = diagnostic;
12127
- this.name = "ReviewerCorrectablePreflightError";
12128
- }
12129
- code;
12130
- diagnostic;
12131
- };
12132
- }
12133
- });
12134
-
12135
- // src/reviewer-pinned-git.ts
12136
- import { execFile as execFile3 } from "node:child_process";
12137
- import { access as access3, realpath as realpath5 } from "node:fs/promises";
12138
- import { promisify as promisify3 } from "node:util";
12139
- async function execGit(args, options) {
12140
- try {
12141
- return await execFileAsync3("git", args, {
12142
- ...options,
12143
- env: { ...process.env, LC_ALL: "C" }
12144
- });
12145
- } catch (error) {
12146
- const source = error;
12147
- const wrapped = new Error("git process failed", { cause: error });
12148
- Object.assign(wrapped, { code: source.code ?? null, signal: source.signal ?? null, timedOut: source.killed === true && source.signal === "SIGTERM", aborted: source.name === "AbortError", stderr: String(source.stderr ?? ""), stdout: String(source.stdout ?? "") });
12149
- throw wrapped;
12150
- }
12151
- }
12152
- function exitCode(error) {
12153
- const code = typeof error === "object" && error !== null ? error.code : void 0;
12154
- return typeof code === "number" ? code : void 0;
12155
- }
12156
- function gitStderr(error) {
12157
- if (typeof error !== "object" || error === null) return "";
12158
- const stderr = error.stderr;
12159
- return typeof stderr === "string" ? stderr : "";
12160
- }
12161
- function isConfirmedMissingOriginRemote(error) {
12162
- return /No such remote ['"]origin['"]/.test(gitStderr(error));
12163
- }
12164
- function isConfirmedPinnedPathAbsent(error, path) {
12165
- const stderr = gitStderr(error);
12166
- const quoted = `'${path}'`;
12167
- return stderr.includes(`path ${quoted} does not exist in `) || stderr.includes(`path ${quoted} exists on disk, but not in `);
12168
- }
12169
- async function repositoryIsAvailable(root) {
12170
- try {
12171
- await access3(`${root}/.git`);
12172
- return { available: true };
12173
- } catch (cause) {
12174
- return { available: false, cause };
12175
- }
12176
- }
12177
- function shortNameFromPinnedRef(refName) {
12178
- const short = refName.startsWith("refs/heads/") ? refName.slice("refs/heads/".length) : refName.startsWith("refs/tags/") ? refName.slice("refs/tags/".length) : refName.startsWith("refs/remotes/") ? refName.slice("refs/remotes/".length).replace(/^[^/]+\//, "") : refName;
12179
- const trimmed = short.trim();
12180
- return trimmed === "" ? void 0 : trimmed;
12181
- }
12182
- async function gitText2(root, args) {
12183
- const { stdout } = await execGit(["-C", root, ...args], { encoding: "utf8" });
12184
- return stdout.trim();
12185
- }
12186
- async function createReviewerPinnedGitReader(root = process.cwd()) {
12187
- const discoveredRoot = await gitText2(root, ["rev-parse", "--show-toplevel"]);
12188
- const repositoryRoot = await realpath5(discoveredRoot);
12189
- const objectFormat = await gitText2(repositoryRoot, ["rev-parse", "--show-object-format"]);
12190
- if (objectFormat !== "sha1" && objectFormat !== "sha256") throw new Error("Unsupported Git object format");
12191
- const oidWidth = objectFormat === "sha1" ? 40 : 64;
12192
- const targetHead = await gitText2(repositoryRoot, ["rev-parse", "HEAD^{commit}"]);
12193
- const reachableCommitIds = Object.freeze((await gitText2(repositoryRoot, ["rev-list", targetHead])).split("\n").filter(Boolean));
12194
- const refs = parseReviewerRefSnapshot(await gitText2(repositoryRoot, reviewerRefSnapshotArgs()));
12195
- const pin = immutableReviewerPin({ repositoryRoot, objectFormat, targetHead, refs });
12196
- const invalid = (code, diagnostic, cause) => {
12197
- throw new ReviewerCorrectablePreflightError(code, diagnostic, cause === void 0 ? void 0 : { cause });
12198
- };
12199
- const symbolic = (base) => {
12200
- const selected = Object.hasOwn(refs, base) ? base : (() => {
12201
- const candidates = [`refs/heads/${base}`, `refs/tags/${base}`, `refs/remotes/${base}`].filter((name) => Object.hasOwn(refs, name));
12202
- if (candidates.length > 1) invalid("base-invalid", "base revision is ambiguous across pinned refs");
12203
- return candidates[0];
12204
- })();
12205
- if (selected === void 0) return void 0;
12206
- const commit = refs[selected]?.peeledCommitId;
12207
- if (commit === null) invalid("base-invalid", "base revision ref must resolve to a commit");
12208
- return commit ?? void 0;
12209
- };
12210
- return Object.freeze({
12211
- pin,
12212
- async snapshot() {
12213
- const liveObjectFormat = await gitText2(repositoryRoot, ["rev-parse", "--show-object-format"]);
12214
- if (liveObjectFormat !== "sha1" && liveObjectFormat !== "sha256") throw new Error("Unsupported Git object format");
12215
- return immutableReviewerPin({ repositoryRoot, objectFormat: liveObjectFormat, targetHead: await gitText2(repositoryRoot, ["rev-parse", "HEAD^{commit}"]), refs: parseReviewerRefSnapshot(await gitText2(repositoryRoot, reviewerRefSnapshotArgs())) });
12216
- },
12217
- async resolve(base) {
12218
- if (!/^[A-Za-z0-9._/~^+-]+$/.test(base) || base.startsWith("-") || base.includes("..") || base.includes("@{")) {
12219
- invalid("base-invalid", "base revision syntax is invalid or uses a forbidden revision form");
12220
- }
12221
- let commit;
12222
- const headExpression = /^HEAD((?:~[0-9]+|\^[0-9]+)*)$/.exec(base);
12223
- if (headExpression) {
12224
- try {
12225
- commit = await gitText2(repositoryRoot, ["rev-parse", "--verify", `${targetHead}${headExpression[1]}^{commit}`]);
12226
- } catch (error) {
12227
- if (exitCode(error) === 128) {
12228
- const repository = await repositoryIsAvailable(repositoryRoot);
12229
- if (repository.available) invalid("base-invalid", "base revision HEAD ancestry expression must resolve to a reachable commit", error);
12230
- }
12231
- throw error;
12232
- }
12233
- } else if (new RegExp(`^[0-9a-f]{${oidWidth}}$`).test(base)) commit = base;
12234
- else if (new RegExp(`^[0-9a-f]{4,${oidWidth - 1}}$`).test(base) && !(objectFormat === "sha256" && base.length === 40)) {
12235
- const matches = reachableCommitIds.filter((candidate) => candidate.startsWith(base));
12236
- if (matches.length !== 1) invalid("base-invalid", "base revision abbreviation must identify exactly one reachable commit");
12237
- commit = matches[0];
12238
- } else commit = symbolic(base);
12239
- if (commit === void 0) invalid("base-invalid", "base revision must name an existing pinned ref or reachable commit");
12240
- try {
12241
- commit = await gitText2(repositoryRoot, ["rev-parse", "--verify", `${commit}^{commit}`]);
12242
- } catch (error) {
12243
- if (exitCode(error) === 128) {
12244
- const repository = await repositoryIsAvailable(repositoryRoot);
12245
- if (repository.available) invalid("base-invalid", "base revision must resolve to an existing commit", error);
12246
- }
12247
- throw error;
12248
- }
12249
- try {
12250
- await gitText2(repositoryRoot, ["merge-base", "--is-ancestor", commit, targetHead]);
12251
- } catch (error) {
12252
- if (exitCode(error) === 1) invalid("base-invalid", "base revision must be an ancestor of the pinned target", error);
12253
- throw error;
12254
- }
12255
- return commit;
12256
- },
12257
- async range(base) {
12258
- let mergeBase;
12259
- try {
12260
- mergeBase = await gitText2(repositoryRoot, ["merge-base", base, targetHead]);
12261
- } catch (error) {
12262
- if (exitCode(error) === 1) {
12263
- invalid("range-invalid", "review range requires a common ancestor for base and pinned target", error);
12264
- }
12265
- throw error;
12266
- }
12267
- if (!mergeBase) invalid("range-invalid", "review range requires a common ancestor for base and pinned target");
12268
- const diffCommand = `git diff ${mergeBase}...${targetHead}`;
12269
- const [{ stdout: diff }, commitsText] = await Promise.all([
12270
- execGit(["-C", repositoryRoot, "diff", `${mergeBase}...${targetHead}`], { encoding: "buffer", maxBuffer: 64 * 1024 * 1024 }),
12271
- gitText2(repositoryRoot, ["rev-list", "--reverse", `${mergeBase}..${targetHead}`])
12272
- ]);
12273
- if (diff.length === 0) invalid("range-invalid", "review range must contain a non-empty diff between base and pinned target");
12274
- return Object.freeze({ base: mergeBase, target: targetHead, diffCommand, diffSha256: sha256Hex(Uint8Array.from(diff)), commits: Object.freeze(commitsText ? commitsText.split("\n") : []) });
12275
- },
12276
- async featureTokens() {
12277
- const names = /* @__PURE__ */ new Set();
12278
- for (const [refName, entry] of Object.entries(pin.refs)) {
12279
- if (entry.peeledCommitId !== targetHead) continue;
12280
- const short = shortNameFromPinnedRef(refName);
12281
- if (short !== void 0) names.add(short);
12282
- }
12283
- return Object.freeze([...names]);
12284
- },
12285
- async listSpecCandidatePaths() {
12286
- const roots = ["docs", "specs", ".scratch"];
12287
- const text = await gitText2(repositoryRoot, [
12288
- "ls-tree",
12289
- "-r",
12290
- "--name-only",
12291
- targetHead,
12292
- "--",
12293
- ...roots
12294
- ]);
12295
- return Object.freeze(text === "" ? [] : text.split("\n").filter((line2) => line2.length > 0));
12296
- },
12297
- async originRepository() {
12298
- let remoteUrl;
12299
- try {
12300
- remoteUrl = await gitText2(repositoryRoot, ["remote", "get-url", "origin"]);
12301
- } catch (error) {
12302
- if (isConfirmedMissingOriginRemote(error)) return void 0;
12303
- throw error;
12304
- }
12305
- return parseGitHubOriginRemote(remoteUrl);
12306
- },
12307
- async commitMessagesNewestFirst(base) {
12308
- const text = await gitText2(repositoryRoot, [
12309
- "log",
12310
- "--format=%s",
12311
- `${base}..${targetHead}`
12312
- ]);
12313
- return Object.freeze(text === "" ? [] : text.split("\n"));
12314
- },
12315
- async readPinnedText(path) {
12316
- if (path.length === 0 || path.startsWith("/") || path.includes("\0") || path.split("/").some((part) => part === ".." || part === "")) {
12317
- return void 0;
12318
- }
12319
- try {
12320
- const { stdout } = await execGit(
12321
- ["-C", repositoryRoot, "show", `${targetHead}:${path}`],
12322
- { encoding: "utf8", maxBuffer: 8 * 1024 * 1024 }
12323
- );
12324
- return stdout;
12325
- } catch (error) {
12326
- if (isConfirmedPinnedPathAbsent(error, path)) return void 0;
12327
- throw error;
12328
- }
12329
- }
12330
- });
12331
- }
12332
- function parseGitHubOriginRemote(remoteUrl) {
12333
- const trimmed = remoteUrl.trim();
12334
- if (trimmed.length === 0) return void 0;
12335
- const scp = /^git@github\.com:([^/\s]+)\/([^/\s]+?)(?:\.git)?$/i.exec(trimmed);
12336
- if (scp) return normalizeOrigin(scp[1], scp[2]);
12337
- const ssh = /^ssh:\/\/git@github\.com\/([^/\s]+)\/([^/\s]+?)(?:\.git)?\/?$/i.exec(trimmed);
12338
- if (ssh) return normalizeOrigin(ssh[1], ssh[2]);
12339
- let parsed;
12340
- try {
12341
- parsed = new URL(trimmed);
12342
- } catch {
12343
- return void 0;
12344
- }
12345
- if (!/^github\.com$/i.test(parsed.hostname)) return void 0;
12346
- if (parsed.search !== "" || parsed.hash !== "") return void 0;
12347
- const parts = parsed.pathname.split("/").filter((p) => p.length > 0);
12348
- if (parts.length !== 2) return void 0;
12349
- return normalizeOrigin(parts[0], parts[1]);
12350
- }
12351
- function normalizeOrigin(ownerRaw, repoRaw) {
12352
- const owner = ownerRaw.trim();
12353
- const repo = stripGitSuffix2(repoRaw.trim());
12354
- if (owner.length === 0 || repo.length === 0) return void 0;
12355
- if (/[/?#@\\]/.test(owner) || /[/?#@\\]/.test(repo)) return void 0;
12356
- return Object.freeze({ owner, repo });
12357
- }
12358
- function stripGitSuffix2(name) {
12359
- return name.toLowerCase().endsWith(".git") ? name.slice(0, -4) : name;
12360
- }
12361
- var execFileAsync3, immutableReviewerPin;
12362
- var init_reviewer_pinned_git = __esm({
12363
- "src/reviewer-pinned-git.ts"() {
12364
- "use strict";
12365
- init_reviewer_git_snapshot();
12366
- init_sha256();
12367
- init_reviewer_preflight_error();
12368
- execFileAsync3 = promisify3(execFile3);
12369
- immutableReviewerPin = (pin) => Object.freeze({
12370
- repositoryRoot: pin.repositoryRoot,
12371
- objectFormat: pin.objectFormat,
12372
- targetHead: pin.targetHead,
12373
- refs: immutableReviewerRefs(pin.refs)
12374
- });
12375
- }
12376
- });
12377
-
12378
- // src/adr-path-refs.ts
12379
- var init_adr_path_refs = __esm({
12380
- "src/adr-path-refs.ts"() {
12381
- "use strict";
12382
- }
12383
- });
12384
-
12385
- // src/reviewer-prompt-identity.ts
12386
- var init_reviewer_prompt_identity = __esm({
12387
- "src/reviewer-prompt-identity.ts"() {
12388
- "use strict";
12389
- }
12390
- });
12391
-
12392
- // src/reviewer-dispatch.ts
12393
- var REVIEWER_PREFLIGHT_VIOLATIONS;
12394
- var init_reviewer_dispatch = __esm({
12395
- "src/reviewer-dispatch.ts"() {
12396
- "use strict";
12397
- init_reviewer_pinned_git();
12398
- init_adr_path_refs();
12399
- init_sha256();
12400
- init_reviewer_prompt_identity();
12401
- REVIEWER_PREFLIGHT_VIOLATIONS = [
12402
- "base-invalid",
12403
- "range-invalid",
12404
- "prompt-identity-invalid",
12405
- "target-drift"
12406
- ];
12407
- }
12408
- });
12409
-
12410
- // src/public-cli/reviewer-dispatch-rejection.ts
12411
- import { readFile as readFile14, unlink as unlink3 } from "node:fs/promises";
12412
- import { join as join26 } from "node:path";
12413
- function isReviewerPreflightViolation(value) {
12414
- return typeof value === "string" && REVIEWER_PREFLIGHT_VIOLATIONS.includes(value);
12415
- }
12416
- function reviewerDispatchRejectionPath(runDirectory) {
12417
- return join26(runDirectory, REVIEWER_DISPATCH_REJECTION_FILE);
12418
- }
12419
- async function clearReviewerDispatchRejection(runDirectory) {
12420
- try {
12421
- await unlink3(reviewerDispatchRejectionPath(runDirectory));
12422
- } catch (error) {
12423
- if (error instanceof Error && "code" in error && error.code === "ENOENT") {
12424
- return;
12425
- }
12426
- throw error;
12427
- }
12428
- }
12429
- async function readReviewerDispatchRejection(runDirectory) {
12430
- let raw;
12431
- try {
12432
- raw = await readFile14(reviewerDispatchRejectionPath(runDirectory), "utf8");
12433
- } catch (error) {
12434
- if (error instanceof Error && "code" in error && error.code === "ENOENT") {
12435
- return void 0;
12436
- }
12437
- throw error;
12438
- }
12439
- const parsed = JSON.parse(raw);
12440
- if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
12441
- const error = new Error("Reviewer dispatch rejection page must be a JSON object");
12442
- error.name = "ReviewerDispatchRejectionContractError";
12443
- throw error;
12444
- }
12445
- const record4 = parsed;
12446
- if (typeof record4.diagnostic !== "string" || record4.diagnostic.trim() === "" || !Array.isArray(record4.violations) || record4.violations.length === 0 || record4.violations.some((value) => !isReviewerPreflightViolation(value))) {
12447
- const error = new Error("Reviewer dispatch rejection page has unusable required fields");
12448
- error.name = "ReviewerDispatchRejectionContractError";
12449
- throw error;
12450
- }
12451
- return {
12452
- cause: "activation",
12453
- diagnostic: record4.diagnostic,
12454
- identity: { name: "ReviewerDispatchRejectionError" },
12455
- details: { violations: Object.freeze([...record4.violations]) }
12456
- };
12457
- }
12458
- var REVIEWER_DISPATCH_REJECTION_FILE;
12459
- var init_reviewer_dispatch_rejection = __esm({
12460
- "src/public-cli/reviewer-dispatch-rejection.ts"() {
12461
- "use strict";
12462
- init_reviewer_dispatch();
12463
- REVIEWER_DISPATCH_REJECTION_FILE = "typed-known-failure.json";
12464
- }
12465
- });
12466
-
12467
12153
  // src/collector-evidence.ts
12468
12154
  import { createHash as createHash6 } from "node:crypto";
12469
12155
  function createSystemCollectorClock() {
@@ -13625,7 +13311,7 @@ var init_collector_ledger = __esm({
13625
13311
  // src/engine-detour-usage.ts
13626
13312
  import { randomUUID as randomUUID3 } from "node:crypto";
13627
13313
  import { readFileSync as readFileSync4 } from "node:fs";
13628
- import { dirname as dirname13, join as join27 } from "node:path";
13314
+ import { dirname as dirname13, join as join26 } from "node:path";
13629
13315
  function engineDetourStdoutByteLength(stdout) {
13630
13316
  return Buffer.byteLength(stdout, "utf8");
13631
13317
  }
@@ -13761,7 +13447,7 @@ function projectEngineDetourToolUsageForPublicTerminal(usage, options) {
13761
13447
  function readInvocationRecord(runDirectory) {
13762
13448
  try {
13763
13449
  const raw = JSON.parse(
13764
- readFileSync4(join27(runDirectory, "invocation.json"), "utf8")
13450
+ readFileSync4(join26(runDirectory, "invocation.json"), "utf8")
13765
13451
  );
13766
13452
  return isRecord8(raw) ? raw : void 0;
13767
13453
  } catch (error) {
@@ -13794,7 +13480,7 @@ function runDirectoryFromSessionDirectory(sessionDirectory) {
13794
13480
  return dirname13(sessionDirectory);
13795
13481
  }
13796
13482
  function sessionFileFromSessionDirectory(sessionDirectory) {
13797
- return join27(sessionDirectory, "session.jsonl");
13483
+ return join26(sessionDirectory, "session.jsonl");
13798
13484
  }
13799
13485
  function mintEngineDetourInvocationScope(input) {
13800
13486
  const engine = input.effectiveEngine?.trim();
@@ -13824,8 +13510,8 @@ var init_engine_detour_usage = __esm({
13824
13510
 
13825
13511
  // src/package-resources/method-skill.ts
13826
13512
  import { createHash as createHash7 } from "node:crypto";
13827
- import { readFile as readFile15, realpath as realpath6 } from "node:fs/promises";
13828
- import { join as join28 } from "node:path";
13513
+ import { readFile as readFile14, realpath as realpath5 } from "node:fs/promises";
13514
+ import { join as join27 } from "node:path";
13829
13515
  function gitBlobOid(bytes) {
13830
13516
  const body = typeof bytes === "string" ? Buffer.from(bytes, "utf8") : Buffer.from(bytes);
13831
13517
  const header = Buffer.from(`blob ${body.byteLength}\0`, "utf8");
@@ -13842,10 +13528,10 @@ function packagedMethodSkillRelativeDirectory(name) {
13842
13528
  return `${METHOD_SKILL_RELATIVE_ROOT}/${name}`;
13843
13529
  }
13844
13530
  function resolvePackagedMethodSkillRoot(packageRoot, name) {
13845
- return join28(packageRoot, packagedMethodSkillRelativeDirectory(name));
13531
+ return join27(packageRoot, packagedMethodSkillRelativeDirectory(name));
13846
13532
  }
13847
13533
  function resolvePackagedMethodSkillPath(packageRoot, name) {
13848
- return join28(resolvePackagedMethodSkillRoot(packageRoot, name), "SKILL.md");
13534
+ return join27(resolvePackagedMethodSkillRoot(packageRoot, name), "SKILL.md");
13849
13535
  }
13850
13536
  function isRecord9(value) {
13851
13537
  return typeof value === "object" && value !== null && !Array.isArray(value);
@@ -13939,11 +13625,11 @@ function parseProvenance(raw, expectedName) {
13939
13625
  }
13940
13626
  async function loadPackagedMethodSkillMaterial(packageRoot, name) {
13941
13627
  const rootDirectory = resolvePackagedMethodSkillRoot(packageRoot, name);
13942
- const skillPathConfigured = join28(rootDirectory, "SKILL.md");
13943
- const provenancePath = join28(rootDirectory, "provenance.json");
13628
+ const skillPathConfigured = join27(rootDirectory, "SKILL.md");
13629
+ const provenancePath = join27(rootDirectory, "provenance.json");
13944
13630
  let provenanceRaw;
13945
13631
  try {
13946
- provenanceRaw = await readFile15(provenancePath, "utf8");
13632
+ provenanceRaw = await readFile14(provenancePath, "utf8");
13947
13633
  } catch (error) {
13948
13634
  throw new PackagedMethodSkillUnavailableError(name, provenancePath, error);
13949
13635
  }
@@ -13957,10 +13643,10 @@ async function loadPackagedMethodSkillMaterial(packageRoot, name) {
13957
13643
  }
13958
13644
  const provenance = parseProvenance(provenanceJson, name);
13959
13645
  for (const [rel, expected] of Object.entries(provenance.files)) {
13960
- const absolute = join28(rootDirectory, rel);
13646
+ const absolute = join27(rootDirectory, rel);
13961
13647
  let bytes;
13962
13648
  try {
13963
- bytes = await readFile15(absolute);
13649
+ bytes = await readFile14(absolute);
13964
13650
  } catch (error) {
13965
13651
  throw new PackagedMethodSkillUnavailableError(name, absolute, error);
13966
13652
  }
@@ -13975,8 +13661,8 @@ async function loadPackagedMethodSkillMaterial(packageRoot, name) {
13975
13661
  let skillPath;
13976
13662
  let raw;
13977
13663
  try {
13978
- skillPath = await realpath6(skillPathConfigured);
13979
- raw = await readFile15(skillPath, "utf8");
13664
+ skillPath = await realpath5(skillPathConfigured);
13665
+ raw = await readFile14(skillPath, "utf8");
13980
13666
  } catch (error) {
13981
13667
  throw new PackagedMethodSkillUnavailableError(name, skillPathConfigured, error);
13982
13668
  }
@@ -14048,7 +13734,12 @@ var init_method_skill = __esm({
14048
13734
  REQUIRED_COMPANIONS = {
14049
13735
  tdd: ["tests.md", "mocking.md", "agents/openai.yaml"],
14050
13736
  "diagnosing-bugs": ["agents/openai.yaml", "scripts/hitl-loop.template.sh"],
14051
- "code-review": ["agents/openai.yaml"],
13737
+ "ak-cross-m-review": [
13738
+ "CONTEXT.md",
13739
+ "LICENSE",
13740
+ "prompts/cmr-completeness.md",
13741
+ "prompts/cmr-reviewer.md"
13742
+ ],
14052
13743
  "resolving-merge-conflicts": ["agents/openai.yaml"]
14053
13744
  };
14054
13745
  }
@@ -14525,7 +14216,6 @@ __export(settlement_exports, {
14525
14216
  publishMergerArtifacts: () => publishMergerArtifacts,
14526
14217
  publishReviewerArtifacts: () => publishReviewerArtifacts,
14527
14218
  raceNavigatorGrace: () => raceNavigatorGrace,
14528
- readBoundEvidenceChildKnownFailure: () => readBoundEvidenceChildKnownFailure,
14529
14219
  readCollectorInfrastructureFailure: () => readCollectorInfrastructureFailure,
14530
14220
  readEngineDetourInfrastructureFailure: () => readEngineDetourInfrastructureFailure,
14531
14221
  readLawfulJudgeRoleOutcome: () => readLawfulJudgeRoleOutcome,
@@ -14566,15 +14256,15 @@ __export(settlement_exports, {
14566
14256
  withSubmissions: () => withSubmissions
14567
14257
  });
14568
14258
  import { randomUUID as randomUUID4 } from "node:crypto";
14569
- import { appendFile as appendFile2, readFile as readFile16, readdir as readdir6, writeFile as writeFile7 } from "node:fs/promises";
14570
- import { dirname as dirname14, join as join29 } from "node:path";
14259
+ import { appendFile as appendFile2, readFile as readFile15, readdir as readdir6, writeFile as writeFile7 } from "node:fs/promises";
14260
+ import { dirname as dirname14, join as join28 } from "node:path";
14571
14261
  function sealedLedgerHome(admitted) {
14572
14262
  return homeFromRunDirectory(admitted.runDirectory);
14573
14263
  }
14574
14264
  function ledgerReadScope(admitted, scope) {
14575
14265
  return {
14576
14266
  home: sealedLedgerHome(admitted),
14577
- sessionParent: join29(admitted.runDirectory, "session", "session.jsonl"),
14267
+ sessionParent: join28(admitted.runDirectory, "session", "session.jsonl"),
14578
14268
  ...scope?.courtAttemptId === void 0 || scope.courtAttemptId.length === 0 ? {} : { attemptId: scope.courtAttemptId }
14579
14269
  };
14580
14270
  }
@@ -14710,7 +14400,7 @@ function presentControlledFailure(failure2, io) {
14710
14400
  }
14711
14401
  async function inspectJudgeSession(sessionFile) {
14712
14402
  try {
14713
- await readFile16(sessionFile, "utf8");
14403
+ await readFile15(sessionFile, "utf8");
14714
14404
  return { state: "present" };
14715
14405
  } catch (error) {
14716
14406
  if (isMissingPathError3(error)) return { state: "missing" };
@@ -14942,7 +14632,7 @@ function sessionReadFailure(error, fallbackMessage) {
14942
14632
  return failed;
14943
14633
  }
14944
14634
  async function readBoundSessionEntries(sessionFile) {
14945
- const text = await readFile16(sessionFile, "utf8");
14635
+ const text = await readFile15(sessionFile, "utf8");
14946
14636
  const entries = [];
14947
14637
  for (const line2 of text.trim().split("\n").filter(Boolean)) {
14948
14638
  try {
@@ -15028,37 +14718,6 @@ async function readSessionProviderStop(sessionFile) {
15028
14718
  return void 0;
15029
14719
  }
15030
14720
  }
15031
- async function readBoundEvidenceChildKnownFailure(sessionFile) {
15032
- const childDirectory = join29(dirname14(sessionFile), "evidence-children");
15033
- let names;
15034
- try {
15035
- names = await readdir6(childDirectory);
15036
- } catch (error) {
15037
- if (isMissingPathError3(error)) return void 0;
15038
- throw sessionReadFailure(error, "failed to read bound evidence-child session directory");
15039
- }
15040
- for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
15041
- let entries;
15042
- try {
15043
- entries = await readBoundSessionEntries(join29(childDirectory, file));
15044
- } catch (error) {
15045
- throw sessionReadFailure(error, "failed to read discovered evidence-child session");
15046
- }
15047
- const header = entries.find((entry) => entry.type === "session");
15048
- if (!isRecord11(header) || header.parentSession !== sessionFile) continue;
15049
- const stop = extractSessionProviderStop(entries);
15050
- if (stop === void 0) continue;
15051
- const primary = knownFailureFromProviderStop(stop);
15052
- return {
15053
- ...primary,
15054
- details: {
15055
- ...primary.details ?? {},
15056
- secondaryEvidence: "evidence-child"
15057
- }
15058
- };
15059
- }
15060
- return void 0;
15061
- }
15062
14721
  async function loadBoundAuditorVolumes(sessionFile) {
15063
14722
  let parentEntries;
15064
14723
  try {
@@ -15069,7 +14728,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
15069
14728
  }
15070
14729
  const parentId = parentEntries.find((entry) => entry.type === "session")?.id;
15071
14730
  if (parentId === void 0) return void 0;
15072
- const childDirectories = [join29(dirname14(sessionFile), "auditor-roles")];
14731
+ const childDirectories = [join28(dirname14(sessionFile), "auditor-roles")];
15073
14732
  const valid = [];
15074
14733
  let sawAnyDirectory = false;
15075
14734
  for (const childDirectory of childDirectories) {
@@ -15084,7 +14743,7 @@ async function loadBoundAuditorVolumes(sessionFile) {
15084
14743
  for (const file of names.filter((name) => name.endsWith(".jsonl")).sort().reverse()) {
15085
14744
  let entries;
15086
14745
  try {
15087
- entries = await readBoundSessionEntries(join29(childDirectory, file));
14746
+ entries = await readBoundSessionEntries(join28(childDirectory, file));
15088
14747
  } catch (error) {
15089
14748
  throw sessionReadFailure(error, "failed to read discovered auditor session");
15090
14749
  }
@@ -15209,19 +14868,6 @@ function resolutionOf(knownFailure, typedHttp = { settled: false }) {
15209
14868
  }
15210
14869
  async function resolveAuditedRunnerFailureResolution(input) {
15211
14870
  if (input.runner !== void 0) return resolutionOf(input.runner);
15212
- if (input.runDirectory !== void 0) {
15213
- try {
15214
- const rejection = await readReviewerDispatchRejection(input.runDirectory);
15215
- if (rejection !== void 0) return resolutionOf(rejection);
15216
- } catch (error) {
15217
- const failure2 = error instanceof Error ? error : new Error(String(error));
15218
- return resolutionOf({
15219
- cause: "activation",
15220
- identity: thrownIdentity(failure2),
15221
- diagnostic: failure2.message || failure2.name
15222
- });
15223
- }
15224
- }
15225
14871
  try {
15226
14872
  const auditorCompliance = await readBoundAuditorComplianceFailure(input.sessionFile);
15227
14873
  if (auditorCompliance !== void 0) return resolutionOf(auditorCompliance);
@@ -15259,17 +14905,6 @@ async function resolveAuditedRunnerFailureResolution(input) {
15259
14905
  diagnostic: failure2.message || failure2.name
15260
14906
  });
15261
14907
  }
15262
- try {
15263
- const evidenceChildFailure = await readBoundEvidenceChildKnownFailure(input.sessionFile);
15264
- if (evidenceChildFailure !== void 0) return resolutionOf(evidenceChildFailure);
15265
- } catch (error) {
15266
- const failure2 = sessionReadFailure(error, "failed to recover bound evidence-child failure");
15267
- return resolutionOf({
15268
- cause: "session",
15269
- identity: thrownIdentity(failure2),
15270
- diagnostic: failure2.message || failure2.name
15271
- });
15272
- }
15273
14908
  const parentStop = await readSessionProviderStop(input.sessionFile);
15274
14909
  let httpObservation;
15275
14910
  if (input.runDirectory !== void 0) {
@@ -15601,8 +15236,8 @@ function projectTerminalGateFact(rounds) {
15601
15236
  };
15602
15237
  }
15603
15238
  async function extractGateFactFromSessionDirectory(sessionDirectory, options = {}) {
15604
- const directories = [join29(sessionDirectory, "auditor-roles")];
15605
- const parentSessionFile = options.parentSessionFile ?? join29(sessionDirectory, "session.jsonl");
15239
+ const directories = [join28(sessionDirectory, "auditor-roles")];
15240
+ const parentSessionFile = options.parentSessionFile ?? join28(sessionDirectory, "session.jsonl");
15606
15241
  const rounds = await readAnalystGateCyclesFromAuditorRoles(directories, {
15607
15242
  parentSessionFile
15608
15243
  });
@@ -15732,8 +15367,8 @@ async function extractNavigatorFactFromAdmittedSession(sessionFile) {
15732
15367
  async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
15733
15368
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
15734
15369
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
15735
- const reportPath = join29(artifactsDir, "report.json");
15736
- const evidencePath = join29(artifactsDir, "evidence.json");
15370
+ const reportPath = join28(artifactsDir, "report.json");
15371
+ const evidencePath = join28(artifactsDir, "evidence.json");
15737
15372
  await writeFile7(
15738
15373
  reportPath,
15739
15374
  `${JSON.stringify(
@@ -15777,8 +15412,8 @@ async function publishJudgeArtifacts(admitted, roleOutcome, coordinates) {
15777
15412
  async function publishCoderArtifacts(admitted, roleOutcome, coordinates, options = {}) {
15778
15413
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
15779
15414
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
15780
- const reportPath = join29(artifactsDir, "report.json");
15781
- const evidencePath = join29(artifactsDir, "evidence.json");
15415
+ const reportPath = join28(artifactsDir, "report.json");
15416
+ const evidencePath = join28(artifactsDir, "evidence.json");
15782
15417
  await writeFile7(
15783
15418
  reportPath,
15784
15419
  `${JSON.stringify(
@@ -15935,8 +15570,8 @@ function extractFixerMethodInvocations(entries, options) {
15935
15570
  async function publishFixerArtifacts(admitted, roleOutcome, coordinates, options) {
15936
15571
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
15937
15572
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
15938
- const reportPath = join29(artifactsDir, "report.json");
15939
- const evidencePath = join29(artifactsDir, "evidence.json");
15573
+ const reportPath = join28(artifactsDir, "report.json");
15574
+ const evidencePath = join28(artifactsDir, "evidence.json");
15940
15575
  await writeFile7(
15941
15576
  reportPath,
15942
15577
  `${JSON.stringify(
@@ -16033,8 +15668,8 @@ async function settleFixerTerminalResult(admitted, authority, options, scope) {
16033
15668
  async function publishCollectorArtifacts(admitted, roleOutcome, coordinates) {
16034
15669
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
16035
15670
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
16036
- const reportPath = join29(artifactsDir, "report.json");
16037
- const evidencePath = join29(artifactsDir, "evidence.json");
15671
+ const reportPath = join28(artifactsDir, "report.json");
15672
+ const evidencePath = join28(artifactsDir, "evidence.json");
16038
15673
  await writeFile7(
16039
15674
  reportPath,
16040
15675
  `${JSON.stringify(
@@ -16166,8 +15801,8 @@ function extractDoctorCandidateAuditNoReceiptFact(entries) {
16166
15801
  async function publishDoctorArtifacts(admitted, roleOutcome, coordinates, options = {}) {
16167
15802
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
16168
15803
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
16169
- const reportPath = join29(artifactsDir, "report.json");
16170
- const evidencePath = join29(artifactsDir, "evidence.json");
15804
+ const reportPath = join28(artifactsDir, "report.json");
15805
+ const evidencePath = join28(artifactsDir, "evidence.json");
16171
15806
  await writeFile7(
16172
15807
  reportPath,
16173
15808
  `${JSON.stringify(
@@ -16461,7 +16096,7 @@ function extractReviewerMethodInvocations(entries, options) {
16461
16096
  const text = sessionMessageText(message);
16462
16097
  if (text.length === 0) continue;
16463
16098
  const hit = observePackagedMethodSkillInvocation(text, {
16464
- name: "code-review",
16099
+ name: "ak-cross-m-review",
16465
16100
  allowedLocations: options.allowedLocations
16466
16101
  });
16467
16102
  if (hit !== void 0) observed.push(hit);
@@ -16471,8 +16106,8 @@ function extractReviewerMethodInvocations(entries, options) {
16471
16106
  async function publishReviewerArtifacts(admitted, roleOutcome, coordinates, options) {
16472
16107
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
16473
16108
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
16474
- const reportPath = join29(artifactsDir, "report.json");
16475
- const evidencePath = join29(artifactsDir, "evidence.json");
16109
+ const reportPath = join28(artifactsDir, "report.json");
16110
+ const evidencePath = join28(artifactsDir, "evidence.json");
16476
16111
  await writeFile7(
16477
16112
  reportPath,
16478
16113
  `${JSON.stringify(
@@ -16497,6 +16132,7 @@ async function publishReviewerArtifacts(admitted, roleOutcome, coordinates, opti
16497
16132
  sessionFile: coordinates.sessionFile,
16498
16133
  admittedRequestPath: admitted.admittedRequestPath,
16499
16134
  baseRevision: admitted.baseRevision,
16135
+ lens: admitted.lens,
16500
16136
  authorityRefs: [...admitted.authorityRefs],
16501
16137
  ...admitted.instructionEmpty ? {} : { callerProvenance: admitted.instruction },
16502
16138
  attachments: admitted.attachments.map((a) => ({
@@ -16586,8 +16222,8 @@ function extractMergerMethodInvocations(entries, options) {
16586
16222
  async function publishMergerArtifacts(admitted, roleOutcome, coordinates, options) {
16587
16223
  await appendRunAttemptHistory({ role: admitted.role, runId: admitted.runId, sessionFile: coordinates.sessionFile }, roleOutcome);
16588
16224
  const artifactsDir = await ensureRunArtifactsDir(admitted.runDirectory);
16589
- const reportPath = join29(artifactsDir, "report.json");
16590
- const evidencePath = join29(artifactsDir, "evidence.json");
16225
+ const reportPath = join28(artifactsDir, "report.json");
16226
+ const evidencePath = join28(artifactsDir, "evidence.json");
16591
16227
  await writeFile7(
16592
16228
  reportPath,
16593
16229
  `${JSON.stringify(
@@ -16743,7 +16379,7 @@ async function writeFailureJsonRetainingCause(preferredCandidates, uniqueFallbac
16743
16379
  const candidates = [
16744
16380
  ...preferredCandidates,
16745
16381
  // One unique name per fallback dir — collisions on fixed names cannot exhaust this.
16746
- ...uniqueFallbackDirs.map((dir) => join29(dir, `${stem}.${randomUUID4()}.json`))
16382
+ ...uniqueFallbackDirs.map((dir) => join28(dir, `${stem}.${randomUUID4()}.json`))
16747
16383
  ];
16748
16384
  for (let i = 0; i < candidates.length; i += 1) {
16749
16385
  const path = candidates[i];
@@ -16794,20 +16430,20 @@ async function publishFailureArtifacts(admitted, failure2, authority) {
16794
16430
  baseDir
16795
16431
  );
16796
16432
  const errorCandidates = underArtifacts ? [
16797
- join29(baseDir, "error.json"),
16798
- join29(baseDir, "error.settlement.json"),
16799
- join29(admitted.runDirectory, "error.settlement.json")
16433
+ join28(baseDir, "error.json"),
16434
+ join28(baseDir, "error.settlement.json"),
16435
+ join28(admitted.runDirectory, "error.settlement.json")
16800
16436
  ] : [
16801
- join29(baseDir, "error.settlement.json"),
16802
- join29(baseDir, "error.json")
16437
+ join28(baseDir, "error.settlement.json"),
16438
+ join28(baseDir, "error.json")
16803
16439
  ];
16804
16440
  const evidenceCandidates = underArtifacts ? [
16805
- join29(baseDir, "evidence.json"),
16806
- join29(baseDir, "evidence.settlement.json"),
16807
- join29(admitted.runDirectory, "evidence.settlement.json")
16441
+ join28(baseDir, "evidence.json"),
16442
+ join28(baseDir, "evidence.settlement.json"),
16443
+ join28(admitted.runDirectory, "evidence.settlement.json")
16808
16444
  ] : [
16809
- join29(baseDir, "evidence.settlement.json"),
16810
- join29(baseDir, "evidence.json")
16445
+ join28(baseDir, "evidence.settlement.json"),
16446
+ join28(baseDir, "evidence.json")
16811
16447
  ];
16812
16448
  const errorPayloadBase = {
16813
16449
  kind: "error",
@@ -17019,7 +16655,6 @@ var init_settlement = __esm({
17019
16655
  init_doctor_auditor();
17020
16656
  init_judge_auditor();
17021
16657
  init_known_failure();
17022
- init_reviewer_dispatch_rejection();
17023
16658
  init_run_lifecycle();
17024
16659
  init_compliance_transport();
17025
16660
  init_collector_ledger();
@@ -17096,17 +16731,17 @@ var init_seat_ticket_binding = __esm({
17096
16731
  });
17097
16732
 
17098
16733
  // src/session-identity.ts
17099
- import { mkdir as mkdir3, readFile as readFile17, rename as rename2, writeFile as writeFile8 } from "node:fs/promises";
17100
- import { dirname as dirname15, join as join30 } from "node:path";
16734
+ import { mkdir as mkdir3, readFile as readFile16, rename as rename2, writeFile as writeFile8 } from "node:fs/promises";
16735
+ import { dirname as dirname15, join as join29 } from "node:path";
17101
16736
  function createSessionIdentityAuthority(authority, sessionBindingFile) {
17102
- const bindingPath = (principal) => join30(authority.decode(principal).sessionDirectory, sessionBindingFile);
16737
+ const bindingPath = (principal) => join29(authority.decode(principal).sessionDirectory, sessionBindingFile);
17103
16738
  return {
17104
16739
  resolveSessionFile(principal) {
17105
16740
  return authority.decode(principal).sessionFile;
17106
16741
  },
17107
16742
  async load(principal) {
17108
16743
  try {
17109
- const value = JSON.parse(await readFile17(bindingPath(principal), "utf8"));
16744
+ const value = JSON.parse(await readFile16(bindingPath(principal), "utf8"));
17110
16745
  if (typeof value !== "object" || value === null || typeof value.sessionId !== "string") {
17111
16746
  throw new Error("durable session binding is invalid");
17112
16747
  }
@@ -17267,14 +16902,14 @@ var init_session_dialogue = __esm({
17267
16902
 
17268
16903
  // src/ticket-provenance.ts
17269
16904
  import { createHash as createHash8 } from "node:crypto";
17270
- import { readFile as readFile18 } from "node:fs/promises";
17271
- import { basename as basename8, dirname as dirname16, join as join31, resolve as resolve12 } from "node:path";
16905
+ import { readFile as readFile17 } from "node:fs/promises";
16906
+ import { basename as basename8, dirname as dirname16, join as join30, resolve as resolve12 } from "node:path";
17272
16907
  function dialogueSessionSourceRoots(home) {
17273
16908
  const machineHome = typeof home === "string" && home.trim() !== "" ? home : packageMachineHome();
17274
16909
  return [
17275
- join31(machineHome, ".claude", "projects"),
17276
- join31(machineHome, ".codex", "sessions"),
17277
- join31(machineHome, ".pi", "agent", "sessions")
16910
+ join30(machineHome, ".claude", "projects"),
16911
+ join30(machineHome, ".codex", "sessions"),
16912
+ join30(machineHome, ".pi", "agent", "sessions")
17278
16913
  ];
17279
16914
  }
17280
16915
  function isLedgerRoleSessionFile(absolute, home) {
@@ -17340,7 +16975,7 @@ async function readTicketProvenance(ticketNumber, cwd, home) {
17340
16975
  const { recordFile } = resolveTicketProvenanceVolume(ticketNumber, cwd, home);
17341
16976
  let text;
17342
16977
  try {
17343
- text = await readFile18(recordFile, "utf8");
16978
+ text = await readFile17(recordFile, "utf8");
17344
16979
  } catch (error) {
17345
16980
  if (error.code === "ENOENT") {
17346
16981
  return { header: void 0, lines: [], unprojectedRaw: [], recordFile };
@@ -17738,9 +17373,9 @@ __export(case_dossier_delivery_exports, {
17738
17373
  loadCaseDossierReadingMaterial: () => loadCaseDossierReadingMaterial,
17739
17374
  projectCaseDossierPointerSection: () => projectCaseDossierPointerSection
17740
17375
  });
17741
- import { mkdtemp as mkdtemp2, readFile as readFile19, rm as rm2, writeFile as writeFile9 } from "node:fs/promises";
17376
+ import { mkdtemp as mkdtemp2, readFile as readFile18, rm as rm2, writeFile as writeFile9 } from "node:fs/promises";
17742
17377
  import { tmpdir as tmpdir2 } from "node:os";
17743
- import { join as join32 } from "node:path";
17378
+ import { join as join31 } from "node:path";
17744
17379
  async function projectCaseDossierPointerSection(input) {
17745
17380
  if (input.ticketNumber === void 0) {
17746
17381
  return [
@@ -17767,9 +17402,9 @@ async function deliverCaseDossierAsAttachment(input) {
17767
17402
  projectRoot: input.projectRoot,
17768
17403
  home: input.home
17769
17404
  });
17770
- const stagingDir = await mkdtemp2(join32(tmpdir2(), "ak-case-dossier-"));
17405
+ const stagingDir = await mkdtemp2(join31(tmpdir2(), "ak-case-dossier-"));
17771
17406
  try {
17772
- const stagingPath = join32(stagingDir, CASE_DOSSIER_ATTACH_FILE);
17407
+ const stagingPath = join31(stagingDir, CASE_DOSSIER_ATTACH_FILE);
17773
17408
  await writeFile9(stagingPath, `${section}
17774
17409
  `, "utf8");
17775
17410
  return await freezeAttachmentsIntoRun(
@@ -17782,7 +17417,7 @@ async function deliverCaseDossierAsAttachment(input) {
17782
17417
  }
17783
17418
  }
17784
17419
  async function loadCaseDossierReadingMaterial(runDirectory) {
17785
- const frozenPath = join32(
17420
+ const frozenPath = join31(
17786
17421
  runDirectory,
17787
17422
  "attachments",
17788
17423
  CASE_DOSSIER_ATTACH_KEY,
@@ -17790,7 +17425,7 @@ async function loadCaseDossierReadingMaterial(runDirectory) {
17790
17425
  );
17791
17426
  let section;
17792
17427
  try {
17793
- section = await readFile19(frozenPath, "utf8");
17428
+ section = await readFile18(frozenPath, "utf8");
17794
17429
  } catch (error) {
17795
17430
  if (error.code === "ENOENT") return void 0;
17796
17431
  throw error;
@@ -17813,14 +17448,14 @@ var init_case_dossier_delivery = __esm({
17813
17448
  });
17814
17449
 
17815
17450
  // src/host-transition-prior-native.ts
17816
- import { access as access4, readdir as readdir7 } from "node:fs/promises";
17817
- import { dirname as dirname17, join as join33 } from "node:path";
17451
+ import { access as access3, readdir as readdir7 } from "node:fs/promises";
17452
+ import { dirname as dirname17, join as join32 } from "node:path";
17818
17453
  function isEnoent3(error) {
17819
17454
  return typeof error === "object" && error !== null && error.code === "ENOENT";
17820
17455
  }
17821
17456
  async function listPiNativeRecordPaths(sessionFile) {
17822
17457
  try {
17823
- await access4(sessionFile);
17458
+ await access3(sessionFile);
17824
17459
  return [sessionFile];
17825
17460
  } catch (error) {
17826
17461
  if (isEnoent3(error)) return [];
@@ -17839,9 +17474,9 @@ async function listSitianRecordPaths(sessionParent) {
17839
17474
  const recordPaths = [];
17840
17475
  for (const entry of entries) {
17841
17476
  if (!entry.isDirectory()) continue;
17842
- const recordFile = join33(sessionRoot, entry.name, "records.jsonl");
17477
+ const recordFile = join32(sessionRoot, entry.name, "records.jsonl");
17843
17478
  try {
17844
- await access4(recordFile);
17479
+ await access3(recordFile);
17845
17480
  recordPaths.push(recordFile);
17846
17481
  } catch (error) {
17847
17482
  if (!isEnoent3(error)) throw error;
@@ -17909,7 +17544,7 @@ var init_public_run_credentials = __esm({
17909
17544
  import { constants as fsConstants2 } from "node:fs";
17910
17545
  import { randomUUID as randomUUID5 } from "node:crypto";
17911
17546
  import { lstat as lstat6, mkdir as mkdir4, open as open2 } from "node:fs/promises";
17912
- import { join as join34 } from "node:path";
17547
+ import { join as join33 } from "node:path";
17913
17548
  async function persistReturnedRunState(admitted, authority, options) {
17914
17549
  if (options?.lawful === true) {
17915
17550
  await markRunTerminal(admitted.runDirectory);
@@ -18024,7 +17659,7 @@ function jsonSafeReplacer() {
18024
17659
  };
18025
17660
  }
18026
17661
  async function writeHardenedArtifactFile(artifactsDir, namePrefix, payload) {
18027
- const filePath = join34(artifactsDir, `${namePrefix}-${randomUUID5()}.json`);
17662
+ const filePath = join33(artifactsDir, `${namePrefix}-${randomUUID5()}.json`);
18028
17663
  const body = `${JSON.stringify(payload, jsonSafeReplacer(), 2)}
18029
17664
  `;
18030
17665
  const noFollowFlag = typeof fsConstants2.O_NOFOLLOW === "number" ? fsConstants2.O_NOFOLLOW : 0;
@@ -18297,7 +17932,7 @@ var init_auto_resume = __esm({
18297
17932
  // src/public-cli/post-admission.ts
18298
17933
  import { randomUUID as randomUUID6 } from "node:crypto";
18299
17934
  import { writeFile as writeFile10 } from "node:fs/promises";
18300
- import { isAbsolute as isAbsolute8, join as join35, resolve as resolve13 } from "node:path";
17935
+ import { isAbsolute as isAbsolute8, join as join34, resolve as resolve13 } from "node:path";
18301
17936
  function describeCaughtError(error) {
18302
17937
  if (error instanceof Error) {
18303
17938
  const code = error.code;
@@ -18336,7 +17971,7 @@ async function recordBestEffortPostDispatchDiagnostic(admitted, env, diagnostic,
18336
17971
  try {
18337
17972
  const artifactsDir = await ensureRealArtifactsDirectory(admitted.runDirectory);
18338
17973
  await writeFile10(
18339
- join35(artifactsDir, `post-admission-diagnostic-${randomUUID6()}.json`),
17974
+ join34(artifactsDir, `post-admission-diagnostic-${randomUUID6()}.json`),
18340
17975
  `${JSON.stringify({ version: 1, ...payload }, null, 2)}
18341
17976
  `,
18342
17977
  { encoding: "utf8", flag: "wx" }
@@ -18449,7 +18084,7 @@ async function dispatchPostAdmissionTurn(input) {
18449
18084
  const rows = await readRecordedSubmissionRows(
18450
18085
  admitted.projectRoot,
18451
18086
  admitted.runId,
18452
- { home: homeFromRunDirectory(admitted.runDirectory), sessionParent: join35(admitted.runDirectory, "session", "session.jsonl") }
18087
+ { home: homeFromRunDirectory(admitted.runDirectory), sessionParent: join34(admitted.runDirectory, "session", "session.jsonl") }
18453
18088
  );
18454
18089
  const asserted = rows.filter((row) => row.kind === "accepted" && row.role === admitted.role).map((row) => row.accepted).find((payload) => {
18455
18090
  if (payload === null || typeof payload !== "object" || Array.isArray(payload)) return false;
@@ -18540,7 +18175,6 @@ async function dispatchPostAdmissionTurn(input) {
18540
18175
  };
18541
18176
  }
18542
18177
  await clearTypedProviderHttpObservation(admitted.runDirectory);
18543
- await clearReviewerDispatchRejection(admitted.runDirectory);
18544
18178
  if (adapters.beforeDispatch !== void 0) {
18545
18179
  try {
18546
18180
  await adapters.beforeDispatch(admitted, lease);
@@ -18609,7 +18243,7 @@ async function dispatchPostAdmissionTurn(input) {
18609
18243
  let stderrLogWriteFailure;
18610
18244
  try {
18611
18245
  await writeFile10(
18612
- join35(admitted.runDirectory, "stderr.log"),
18246
+ join34(admitted.runDirectory, "stderr.log"),
18613
18247
  result.stderr,
18614
18248
  "utf8"
18615
18249
  );
@@ -18859,7 +18493,7 @@ async function dispatchAfterWriterLease(input) {
18859
18493
  }
18860
18494
  function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
18861
18495
  const absolute = isAbsolute8(attachmentPath) ? attachmentPath : resolve13(attachmentPath);
18862
- return pathContainedIn(join35(runDirectory, "attachments"), absolute);
18496
+ return pathContainedIn(join34(runDirectory, "attachments"), absolute);
18863
18497
  }
18864
18498
  async function prepareSummonsResumeMaterials(runDirectory, summons) {
18865
18499
  if (summons === void 0) return void 0;
@@ -19175,7 +18809,6 @@ var init_post_admission = __esm({
19175
18809
  init_public_run_credentials();
19176
18810
  init_run_lifecycle();
19177
18811
  init_activation_ledger_topology();
19178
- init_reviewer_dispatch_rejection();
19179
18812
  init_settlement();
19180
18813
  init_terminal();
19181
18814
  init_auto_resume();
@@ -20633,7 +20266,7 @@ __export(public_role_summons_exports, {
20633
20266
  summonPublicRole: () => summonPublicRole
20634
20267
  });
20635
20268
  import { existsSync as existsSync11 } from "node:fs";
20636
- import { join as join36 } from "node:path";
20269
+ import { join as join35 } from "node:path";
20637
20270
  function createCapturingIo() {
20638
20271
  const chunks = [];
20639
20272
  return {
@@ -20656,7 +20289,7 @@ function parentDir(path) {
20656
20289
  function walkPackageRoot(start) {
20657
20290
  let dir = start;
20658
20291
  for (let i = 0; i < 12; i += 1) {
20659
- if (existsSync11(join36(dir, "package.json")) && existsSync11(join36(dir, "souls"))) {
20292
+ if (existsSync11(join35(dir, "package.json")) && existsSync11(join35(dir, "souls"))) {
20660
20293
  return dir;
20661
20294
  }
20662
20295
  const parent = parentDir(dir);
@@ -20767,7 +20400,7 @@ async function createSummonEnv(options, afterHost) {
20767
20400
  async function summonPublicRole(options) {
20768
20401
  const packageRoot = resolveSummonsPackageRoot(options.packageRoot);
20769
20402
  const home = await resolveSummonHome(options);
20770
- const agentDir = options.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join36(home, ".pi", "agent");
20403
+ const agentDir = options.agentDir ?? process.env.PI_CODING_AGENT_DIR ?? join35(home, ".pi", "agent");
20771
20404
  const {
20772
20405
  loadCredentialProviders: loadCredentialProviders2,
20773
20406
  loadPublicCliConfig: loadPublicCliConfig2,
@@ -20997,9 +20630,9 @@ import { randomUUID as randomUUID9 } from "node:crypto";
20997
20630
  // src/role-envelope.ts
20998
20631
  init_engine_detour();
20999
20632
  import { randomUUID as randomUUID8 } from "node:crypto";
21000
- import { mkdir as mkdir5, readFile as readFile21, writeFile as writeFile12 } from "node:fs/promises";
20633
+ import { mkdir as mkdir5, readFile as readFile20, writeFile as writeFile12 } from "node:fs/promises";
21001
20634
  import { createServer } from "node:net";
21002
- import { basename as basename9, dirname as dirname21, join as join41 } from "node:path";
20635
+ import { basename as basename9, dirname as dirname21, join as join40 } from "node:path";
21003
20636
  import { fileURLToPath as fileURLToPath2 } from "node:url";
21004
20637
 
21005
20638
  // src/gatekeeper-pass-envelope.ts
@@ -21094,7 +20727,7 @@ init_sitian_facade();
21094
20727
  init_submission_ledger();
21095
20728
  init_collector_ledger();
21096
20729
  import { readFileSync as readFileSync6, writeSync as writeSync4 } from "node:fs";
21097
- import { join as join40 } from "node:path";
20730
+ import { join as join39 } from "node:path";
21098
20731
  import { Value as Value4 } from "typebox/value";
21099
20732
 
21100
20733
  // src/activation-trace.ts
@@ -21652,16 +21285,16 @@ init_collector_evidence();
21652
21285
  init_collector_github();
21653
21286
 
21654
21287
  // src/collector-handbook.ts
21655
- import { readFile as readFile20 } from "node:fs/promises";
21656
- import { join as join38, sep as sep5 } from "node:path";
21288
+ import { readFile as readFile19 } from "node:fs/promises";
21289
+ import { join as join37, sep as sep5 } from "node:path";
21657
21290
 
21658
21291
  // src/atomic-write.ts
21659
21292
  import { randomUUID as randomUUID7 } from "node:crypto";
21660
21293
  import { rename as rename3, rm as rm3, writeFile as writeFile11 } from "node:fs/promises";
21661
- import { dirname as dirname19, join as join37 } from "node:path";
21294
+ import { dirname as dirname19, join as join36 } from "node:path";
21662
21295
  async function writeFileAtomically(destination, contents) {
21663
21296
  const parent = dirname19(destination);
21664
- const temporary = join37(parent, `.atomic-write-${randomUUID7()}.tmp`);
21297
+ const temporary = join36(parent, `.atomic-write-${randomUUID7()}.tmp`);
21665
21298
  try {
21666
21299
  await writeFile11(temporary, contents);
21667
21300
  await rename3(temporary, destination);
@@ -21787,7 +21420,7 @@ function resolveCollectorHandbookRoot(sessionPath) {
21787
21420
  throw new Error(`\u901A\u8FDB\u53F8\u624B\u518C\u62D2\u7EDD\u4E0D\u5B89\u5168 bookKey ${JSON.stringify(bookKey)}`);
21788
21421
  }
21789
21422
  const ledgerHome = resolveActivationLedgerHomeForPath(sessionPath);
21790
- const root = join38(activationBookDirectory(ledgerHome, bookKey), "collector-handbook");
21423
+ const root = join37(activationBookDirectory(ledgerHome, bookKey), "collector-handbook");
21791
21424
  return { ledgerHome, bookKey, root };
21792
21425
  }
21793
21426
  function collectorHandbookRepoFileName(repositoryCanonical) {
@@ -21799,9 +21432,9 @@ function collectorHandbookRepoFileName(repositoryCanonical) {
21799
21432
  return `${repositoryCanonical.replaceAll("/", "__")}.md`;
21800
21433
  }
21801
21434
  function createCollectorHandbookStore(input) {
21802
- const generalPath = join38(input.handbookRoot, "general.md");
21803
- const repoDir = join38(input.handbookRoot, "repos");
21804
- const repoPath = join38(repoDir, collectorHandbookRepoFileName(input.repositoryCanonical));
21435
+ const generalPath = join37(input.handbookRoot, "general.md");
21436
+ const repoDir = join37(input.handbookRoot, "repos");
21437
+ const repoPath = join37(repoDir, collectorHandbookRepoFileName(input.repositoryCanonical));
21805
21438
  const assertHandbookBudget = (body, label) => {
21806
21439
  const byteLength = Buffer.byteLength(body, "utf8");
21807
21440
  if (byteLength > COLLECTOR_HANDBOOK_MAX_BYTES) {
@@ -21815,7 +21448,7 @@ function createCollectorHandbookStore(input) {
21815
21448
  ensureRealDirectoryTree(input.ledgerHome, parentDir2);
21816
21449
  assertLedgerFileInsideHome(path, input.ledgerHome);
21817
21450
  try {
21818
- const body = await readFile20(path, "utf8");
21451
+ const body = await readFile19(path, "utf8");
21819
21452
  assertHandbookBudget(body, "\u6B63\u6587");
21820
21453
  return body;
21821
21454
  } catch (error) {
@@ -24076,14 +23709,20 @@ ${soul}
24076
23709
  // src/reviewer-role.ts
24077
23710
  init_open_tool_schema();
24078
23711
  init_terminating_infrastructure();
24079
- init_reviewer_pinned_git();
24080
23712
  init_reviewer_output();
24081
23713
  import { Type as Type24 } from "typebox";
24082
23714
  var reviewerAmendmentsSchema = Type24.Object({
24083
- standards: Type24.Optional(Type24.String({ description: "\u6807\u51C6\u8F74\u5F39\u7AE0\u6B63\u6587" })),
24084
- spec: Type24.Optional(Type24.String({ description: "\u89C4\u683C\u8F74\u5F39\u7AE0\u6B63\u6587" }))
24085
- }, { additionalProperties: true, description: "\u9010\u8F74\u5F39\u7AE0\u6B63\u6587\uFF1B\u65E0\u5F39\u7AE0\u7684\u8F74\u53EF\u7701\u7565\u3002" });
24086
- var REVIEWER_STATUS_DESCRIPTION = "completed | refused \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8";
23715
+ completeness: Type24.Optional(Type24.String({
23716
+ description: "completeness lens \u5B8C\u6574\u62A5\u544A\uFF1Acandidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict\uFF1B\u975E\u4EC5 verdict \u4E00\u884C\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u82E5\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u4E8E\u6B64"
23717
+ })),
23718
+ correctness: Type24.Optional(Type24.String({
23719
+ description: "correctness lens \u5B8C\u6574\u62A5\u544A\uFF1Acandidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict\uFF1B\u975E\u4EC5 verdict \u4E00\u884C\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u82E5\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u4E8E\u6B64"
23720
+ }))
23721
+ }, {
23722
+ additionalProperties: true,
23723
+ description: "\u6240\u9009 lens \u7684 amendments \u627F\u8F7D candidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict \u7684\u5B8C\u6574\u62A5\u544A\uFF08\u975E\u4EC5 verdict \u884C\uFF09\uFF1B\u672A\u9009 lens \u53EF\u7701\u7565\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u8FDB\u6240\u9009 lens \u5B57\u6BB5\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
23724
+ });
23725
+ var REVIEWER_STATUS_DESCRIPTION = "completed | refused \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002\u4E24\u79CD\u6B63\u5E38 lens verdict\uFF08completeness / correctness\uFF09\u5747 completed\uFF1Bhard-stop \u4E0E usage error \u4E3A refused\uFF08\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u8FDB\u6240\u9009 lens amendments\uFF09\u3002";
24087
23726
  var reviewerOutputVariants = Type24.Union([
24088
23727
  Type24.Object({
24089
23728
  status: Type24.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
@@ -24091,7 +23730,7 @@ var reviewerOutputVariants = Type24.Union([
24091
23730
  }, { additionalProperties: false }),
24092
23731
  Type24.Object({
24093
23732
  status: Type24.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
24094
- diagnostic: Type24.String({ description: "\u62D2\u7EDD\u8BCA\u65AD\u8BF4\u660E" }),
23733
+ diagnostic: Type24.String({ description: "\u62D2\u7EDD\u8BCA\u65AD\u8BF4\u660E\uFF1Bhard-stop\uFF0Fusage error \u539F\u56E0\u8FDB\u6B64\u5B57\u6BB5\uFF0C\u5DF2\u4EA7\u51FA\u62A5\u544A\u53E6\u7167\u5F55 amendments" }),
24095
23734
  amendments: Type24.Optional(reviewerAmendmentsSchema)
24096
23735
  }, { additionalProperties: false })
24097
23736
  ]);
@@ -24108,15 +23747,15 @@ function createReviewerRoleRuntime(pi, dependencies, _hostActions) {
24108
23747
  soul = (await dependencies.loadSoul()).trim();
24109
23748
  if (!soul) throw new Error("Reviewer soul is empty");
24110
23749
  fixedBaseRevision = admitted.baseRevision;
24111
- const loaded = await dependencies.loadCanonicalSkillBinding("code-review");
24112
- if (loaded.name !== "code-review") throw new Error("Canonical Skill binding loader returned tdd for code-review");
23750
+ const loaded = await dependencies.loadCanonicalSkillBinding("ak-cross-m-review");
23751
+ if (loaded.name !== "ak-cross-m-review") throw new Error("Canonical Skill binding loader returned tdd for ak-cross-m-review");
24113
23752
  binding = loaded;
24114
23753
  if (!registered) {
24115
23754
  registered = true;
24116
23755
  pi.registerTool({
24117
23756
  name: REVIEWER_OUTPUT_TOOL_NAME,
24118
23757
  label: "\u5FA1\u53F2\u53F0\u8F93\u51FA",
24119
- description: "\u63D0\u4EA4\u5FA1\u53F2\u53F0\u7EC8\u5C40\u56DE\u6267\u3002\u672C\u5E2D\u81EA\u8C03 code-review skill\u3002",
23758
+ description: "\u63D0\u4EA4\u5FA1\u53F2\u53F0\u7EC8\u5C40\u56DE\u6267\u3002\u672C\u5E2D\u81EA\u8C03 ak-cross-m-review skill\u3002",
24120
23759
  promptSnippet: "\u63D0\u4EA4\u5FA1\u53F2\u53F0\u7EC8\u5C40\u56DE\u6267",
24121
23760
  parameters: reviewerOutputSchema,
24122
23761
  async execute(_id, parameters) {
@@ -24662,7 +24301,7 @@ function createCoderRoleRuntime(pi, dependencies, hostActions) {
24662
24301
  const loaded = await dependencies.loadCanonicalSkillBinding("tdd");
24663
24302
  if (loaded.name !== "tdd") {
24664
24303
  throw new Error(
24665
- "Canonical Skill binding loader returned code-review for tdd"
24304
+ "Canonical Skill binding loader returned ak-cross-m-review for tdd"
24666
24305
  );
24667
24306
  }
24668
24307
  binding = loaded;
@@ -24842,16 +24481,16 @@ var REVIEWER_TRANSPORT_FLAGS = Object.freeze([
24842
24481
  })
24843
24482
  }),
24844
24483
  Object.freeze({
24845
- name: "ak-review-scope-keys",
24484
+ name: "ak-review-lens",
24846
24485
  definition: Object.freeze({
24847
- description: "Optional comma-separated exact class keys limiting Reviewer scope",
24486
+ description: "Caller-selected single review lens: completeness or correctness",
24848
24487
  type: "string"
24849
24488
  })
24850
24489
  }),
24851
24490
  Object.freeze({
24852
24491
  name: "ak-review-authority-refs",
24853
24492
  definition: Object.freeze({
24854
- description: "JSON array of durable authority references for Spec-axis material only",
24493
+ description: "JSON array of durable authority references projected as Skill --authority inputs",
24855
24494
  type: "string"
24856
24495
  })
24857
24496
  }),
@@ -24883,18 +24522,6 @@ var STATION_CHILD_FLAG = Object.freeze({
24883
24522
  })
24884
24523
  });
24885
24524
  function decodeReviewerAdmittedInputs(getFlag) {
24886
- let reviewScopeKeys;
24887
- const rawScopeKeys = getFlag("ak-review-scope-keys");
24888
- if (rawScopeKeys !== void 0) {
24889
- if (typeof rawScopeKeys !== "string" || rawScopeKeys.length === 0) {
24890
- throw new Error("Reviewer scope keys must be a nonempty comma-separated string");
24891
- }
24892
- const parsed = rawScopeKeys.split(",");
24893
- if (parsed.some((key) => key.trim().length === 0) || new Set(parsed).size !== parsed.length) {
24894
- throw new Error("Reviewer scope keys contain a blank or exact duplicate key");
24895
- }
24896
- reviewScopeKeys = Object.freeze(parsed);
24897
- }
24898
24525
  let authorityRefs;
24899
24526
  const rawAuthorityRefs = getFlag("ak-review-authority-refs");
24900
24527
  if (rawAuthorityRefs !== void 0) {
@@ -24923,9 +24550,13 @@ function decodeReviewerAdmittedInputs(getFlag) {
24923
24550
  if (typeof baseRevision !== "string" || !baseRevision.trim()) {
24924
24551
  throw new Error("Reviewer role requires --ak-review-base");
24925
24552
  }
24553
+ const rawLens = getFlag("ak-review-lens");
24554
+ if (rawLens !== "completeness" && rawLens !== "correctness") {
24555
+ throw new Error("Reviewer role requires --ak-review-lens completeness|correctness");
24556
+ }
24926
24557
  return Object.freeze({
24927
24558
  baseRevision,
24928
- ...reviewScopeKeys === void 0 ? {} : { reviewScopeKeys },
24559
+ lens: rawLens,
24929
24560
  ...authorityRefs === void 0 ? {} : { authorityRefs },
24930
24561
  ...ticketNumber === void 0 ? {} : { ticketNumber }
24931
24562
  });
@@ -25240,7 +24871,7 @@ function readDiaristTicketAssertion(submitted) {
25240
24871
  function readRoleRunCoordinates(ctx, label) {
25241
24872
  const runDirectory = runDirectoryFromHostContext(ctx);
25242
24873
  if (runDirectory === void 0) throw new Error(`${label} requires AK_ROLE_RUN_DIR`);
25243
- const admittedPath = join40(runDirectory, "admitted-request.json");
24874
+ const admittedPath = join39(runDirectory, "admitted-request.json");
25244
24875
  const admitted = JSON.parse(readFileSync6(admittedPath, "utf8"));
25245
24876
  if (typeof admitted.projectRoot !== "string" || admitted.projectRoot.trim() === "") {
25246
24877
  throw new Error(`${label} admitted-request missing projectRoot (${admittedPath})`);
@@ -25877,10 +25508,6 @@ function createRoleRuntimeExtension(dependencies) {
25877
25508
  }
25878
25509
  return dependencies.loadReviewerSoul();
25879
25510
  },
25880
- async createPinnedGitReader() {
25881
- if (dependencies.createReviewerPinnedGitReader === void 0) throw new Error("Reviewer runtime dependencies are not configured");
25882
- return dependencies.createReviewerPinnedGitReader();
25883
- },
25884
25511
  async loadCanonicalSkillBinding(name) {
25885
25512
  if (dependencies.loadCanonicalSkillBinding === void 0) {
25886
25513
  throw new Error("Reviewer runtime dependencies are not configured");
@@ -26380,10 +26007,10 @@ async function prepareRoleEnvelope(options) {
26380
26007
  for (const method of request.methods) {
26381
26008
  if (method.kind !== "skill") continue;
26382
26009
  const name = basename9(dirname21(method.path));
26383
- const raw = await readFile21(method.path, "utf8");
26010
+ const raw = await readFile20(method.path, "utf8");
26384
26011
  methodSkills.set(name, { path: method.path, body: stripSkillFrontmatter(raw).trim() });
26385
26012
  }
26386
- let sessionFile = options.sessionFile ?? join41(request.runDirectory, "session", "session.jsonl");
26013
+ let sessionFile = options.sessionFile ?? join40(request.runDirectory, "session", "session.jsonl");
26387
26014
  await mkdir5(dirname21(sessionFile), { recursive: true });
26388
26015
  if (request.continuation.kind !== "resume") {
26389
26016
  try {
@@ -26790,7 +26417,7 @@ async function prepareRoleEnvelope(options) {
26790
26417
  message: { role: "user", content: prompt }
26791
26418
  });
26792
26419
  }
26793
- const methodPrompt = (await Promise.all(request.methods.map(({ path }) => readFile21(path, "utf8")))).join("\n\n");
26420
+ const methodPrompt = (await Promise.all(request.methods.map(({ path }) => readFile20(path, "utf8")))).join("\n\n");
26794
26421
  const promptResults = await emit("before_agent_start", {
26795
26422
  prompt,
26796
26423
  systemPrompt: methodPrompt,
@@ -26848,11 +26475,11 @@ async function prepareRoleEnvelope(options) {
26848
26475
  }
26849
26476
 
26850
26477
  // src/role-runtime-dependencies.ts
26851
- import { readFile as readFile24 } from "node:fs/promises";
26478
+ import { readFile as readFile23 } from "node:fs/promises";
26852
26479
  import { fileURLToPath as fileURLToPath3 } from "node:url";
26853
26480
 
26854
26481
  // src/canonical-skill-binding.ts
26855
- import { readFile as readFile22, realpath as realpath7 } from "node:fs/promises";
26482
+ import { readFile as readFile21, realpath as realpath6 } from "node:fs/promises";
26856
26483
  import { homedir } from "node:os";
26857
26484
  import { dirname as dirname22, resolve as resolve18 } from "node:path";
26858
26485
  import { stripFrontmatter } from "@earendil-works/pi-coding-agent";
@@ -26884,8 +26511,8 @@ async function loadCanonicalSkillBinding(name) {
26884
26511
  let path;
26885
26512
  let raw;
26886
26513
  try {
26887
- path = await realpath7(configuredPath);
26888
- raw = await readFile22(path, "utf8");
26514
+ path = await realpath6(configuredPath);
26515
+ raw = await readFile21(path, "utf8");
26889
26516
  } catch (error) {
26890
26517
  throw new CanonicalSkillUnavailableError(name, configuredPath, error);
26891
26518
  }
@@ -26924,7 +26551,7 @@ init_doctor_evidence();
26924
26551
  // src/navigator-work-context.ts
26925
26552
  init_doctor_evidence();
26926
26553
  init_host_contracts();
26927
- import { readFile as readFile23 } from "node:fs/promises";
26554
+ import { readFile as readFile22 } from "node:fs/promises";
26928
26555
  import { resolve as resolve19 } from "node:path";
26929
26556
  init_notary_source_run();
26930
26557
  init_packaged_role_registry();
@@ -26937,7 +26564,7 @@ function navigatorInputReference(getFlag, role) {
26937
26564
  }
26938
26565
  async function loadNavigatorWorkContext(options) {
26939
26566
  const reference = navigatorInputReference(options.getFlag, options.role);
26940
- const input = reference === void 0 || options.role === "doctor" || options.role === "notary" ? void 0 : await readFile23(reference, "utf8");
26567
+ const input = reference === void 0 || options.role === "doctor" || options.role === "notary" ? void 0 : await readFile22(reference, "utf8");
26941
26568
  const subjectRoot = subjectPath(reference ?? options.context.sessionManager.getSessionDir(), options.context.cwd);
26942
26569
  let subjectKey = reference === void 0 ? subjectRoot : navigatorSubjectKeyForInput(subjectRoot, reference, options.context.cwd);
26943
26570
  let subject = input ?? `work subject: ${subjectKey}`;
@@ -26994,7 +26621,7 @@ async function loadNavigatorWorkContext(options) {
26994
26621
  let authorityMaterial;
26995
26622
  for (const path of authorityFiles) {
26996
26623
  try {
26997
- const content = await readFile23(path, "utf8");
26624
+ const content = await readFile22(path, "utf8");
26998
26625
  if (content.trim() !== "") {
26999
26626
  authorityMaterial = content;
27000
26627
  break;
@@ -27048,7 +26675,6 @@ async function loadPackagedCanonicalSkillBinding(packageRoot, name) {
27048
26675
  }
27049
26676
 
27050
26677
  // src/role-runtime-dependencies.ts
27051
- init_reviewer_pinned_git();
27052
26678
  init_auditor_soul();
27053
26679
  init_session_opening_materials();
27054
26680
  var navigatorRoutePlaybookPath = fileURLToPath3(
@@ -27064,13 +26690,12 @@ function createRoleRuntimeDependencies(packageRoot) {
27064
26690
  packageRoot,
27065
26691
  loadJudgeSoul: () => loadMainRoleSessionMaterials("judge"),
27066
26692
  loadFixerSoul: () => loadMainRoleSessionMaterials("fixer"),
27067
- loadFixPacket: (path) => readFile24(path, "utf8"),
26693
+ loadFixPacket: (path) => readFile23(path, "utf8"),
27068
26694
  loadCoderSoul: () => loadMainRoleSessionMaterials("coder"),
27069
- loadCoderTask: (path) => readFile24(path, "utf8"),
26695
+ loadCoderTask: (path) => readFile23(path, "utf8"),
27070
26696
  loadReviewerSoul: () => loadMainRoleSessionMaterials("reviewer"),
27071
- createReviewerPinnedGitReader: () => createReviewerPinnedGitReader(),
27072
26697
  loadCollectorSoul: () => loadMainRoleSessionMaterials("collector"),
27073
- loadCollectorHandbookSeed: () => readFile24(collectorHandbookSeedPath, "utf8"),
26698
+ loadCollectorHandbookSeed: () => readFile23(collectorHandbookSeedPath, "utf8"),
27074
26699
  createCollectorTransport: () => createGhCollectorGitHubTransport(),
27075
26700
  loadDoctorSoul: () => loadMainRoleSessionMaterials("doctor"),
27076
26701
  loadDoctorCase,
@@ -27085,13 +26710,13 @@ function createRoleRuntimeDependencies(packageRoot) {
27085
26710
  loadSecretariatSoul: () => loadMainRoleSessionMaterials("secretariat"),
27086
26711
  loadNotarySourceRun: loadNotarySourceRunLocator,
27087
26712
  loadMergerSoul: () => loadMainRoleSessionMaterials("merger"),
27088
- loadMergerInput: async (path) => JSON.parse(await readFile24(path, "utf8")),
26713
+ loadMergerInput: async (path) => JSON.parse(await readFile23(path, "utf8")),
27089
26714
  async loadCanonicalSkillBinding(name) {
27090
26715
  if (name === "tdd") {
27091
26716
  return loadPackagedCanonicalSkillBinding(packageRoot, "tdd");
27092
26717
  }
27093
- if (name === "code-review") {
27094
- return loadPackagedCanonicalSkillBinding(packageRoot, "code-review");
26718
+ if (name === "ak-cross-m-review") {
26719
+ return loadPackagedCanonicalSkillBinding(packageRoot, "ak-cross-m-review");
27095
26720
  }
27096
26721
  return loadCanonicalSkillBinding(name);
27097
26722
  },
@@ -27111,7 +26736,7 @@ function createRoleRuntimeDependencies(packageRoot) {
27111
26736
  authority: options.authority,
27112
26737
  invocationId: options.invocationId,
27113
26738
  loadSoul: () => loadMainRoleSessionMaterials("navigator"),
27114
- loadRoutePlaybook: () => readFile24(navigatorRoutePlaybookPath, "utf8"),
26739
+ loadRoutePlaybook: () => readFile23(navigatorRoutePlaybookPath, "utf8"),
27115
26740
  loadRoleHelp: async (role) => formatNavigatorRoleHelp(role),
27116
26741
  createSession: navigatorSessionFactory,
27117
26742
  ...options.contextError === void 0 ? {} : { contextError: options.contextError },
@@ -27124,9 +26749,9 @@ function createRoleRuntimeDependencies(packageRoot) {
27124
26749
  init_session_identity();
27125
26750
 
27126
26751
  // src/acp-host/description.ts
27127
- import { join as join42 } from "node:path";
26752
+ import { join as join41 } from "node:path";
27128
26753
  function resolveAcpBinary(description, operatorHome) {
27129
- return join42(operatorHome, ...description.binaryFromHome);
26754
+ return join41(operatorHome, ...description.binaryFromHome);
27130
26755
  }
27131
26756
  function acpStdioArgs(description, model, seat) {
27132
26757
  const { prefix, suffix, modelFlag, thinkingFlag } = description.argv;
@@ -27572,17 +27197,17 @@ function createAcpRoleTurnHost(config) {
27572
27197
 
27573
27198
  // src/acp-host/seat-profile-soul.ts
27574
27199
  import { constants as constants3 } from "node:fs";
27575
- import { access as access5, copyFile, lstat as lstat7, mkdir as mkdir6, readlink, symlink, unlink as unlink4 } from "node:fs/promises";
27576
- import { dirname as dirname24, join as join43, relative as relative3, resolve as resolve20 } from "node:path";
27200
+ import { access as access4, copyFile, lstat as lstat7, mkdir as mkdir6, readlink, symlink, unlink as unlink3 } from "node:fs/promises";
27201
+ import { dirname as dirname24, join as join42, relative as relative3, resolve as resolve20 } from "node:path";
27577
27202
  function seatProfileName(spec, role) {
27578
27203
  return `${spec.namePrefix}${role}`;
27579
27204
  }
27580
27205
  function packageRoleSoulPath(packageRoot, role) {
27581
- return join43(packageRoot, "souls", `${role}.md`);
27206
+ return join42(packageRoot, "souls", `${role}.md`);
27582
27207
  }
27583
27208
  async function pathExists2(path) {
27584
27209
  try {
27585
- await access5(path, constants3.F_OK);
27210
+ await access4(path, constants3.F_OK);
27586
27211
  return true;
27587
27212
  } catch {
27588
27213
  return false;
@@ -27595,16 +27220,16 @@ async function ensureSeatProfileSoul(options) {
27595
27220
  if (!await pathExists2(soulTarget)) {
27596
27221
  throw new Error(`packaged role soul missing: ${soulTarget}`);
27597
27222
  }
27598
- const profilesRoot = join43(operatorHome, ...spec.profilesRootFromHome);
27599
- const profileDir = join43(profilesRoot, profileName);
27223
+ const profilesRoot = join42(operatorHome, ...spec.profilesRootFromHome);
27224
+ const profileDir = join42(profilesRoot, profileName);
27600
27225
  const hostRoot = dirname24(profilesRoot);
27601
- const soulPath = join43(profileDir, spec.soulFileName);
27226
+ const soulPath = join42(profileDir, spec.soulFileName);
27602
27227
  if (!await pathExists2(profileDir)) {
27603
27228
  await mkdir6(profileDir, { recursive: true });
27604
27229
  for (const name of ["auth.json", ".env", "config.yaml"]) {
27605
- const source = join43(hostRoot, name);
27230
+ const source = join42(hostRoot, name);
27606
27231
  if (!await pathExists2(source)) continue;
27607
- await copyFile(source, join43(profileDir, name));
27232
+ await copyFile(source, join42(profileDir, name));
27608
27233
  }
27609
27234
  } else {
27610
27235
  await mkdir6(profileDir, { recursive: true });
@@ -27623,7 +27248,7 @@ async function ensureSeatProfileSoul(options) {
27623
27248
  return profileName;
27624
27249
  }
27625
27250
  if (await pathExists2(soulPath) || current !== void 0) {
27626
- await unlink4(soulPath);
27251
+ await unlink3(soulPath);
27627
27252
  }
27628
27253
  await symlink(desiredLink, soulPath);
27629
27254
  return profileName;