@akagilnc/pi-workflow-roles 0.1.5593 → 0.1.5614

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 (58) hide show
  1. package/README.md +1 -1
  2. package/README.zh-CN.md +1 -1
  3. package/dist/acp-host/production-host.js +521 -707
  4. package/dist/compliance-transport.js +2 -5
  5. package/dist/doctor-auditor.js +1 -1
  6. package/dist/gatekeeper-role.js +1 -1
  7. package/dist/headless-host/production-host.js +505 -691
  8. package/dist/merger-contracts.js +6 -2
  9. package/dist/migrate-book-topology.js +5142 -10735
  10. package/dist/navigator-public-session.js +4 -4
  11. package/dist/navigator-work-base.js +5 -30
  12. package/dist/package-contracts/worker-output.js +1 -6
  13. package/dist/packaged-role-registry.js +9 -6
  14. package/dist/pi/role-turn-host.js +10 -1
  15. package/dist/public-cli/instruction-seat-run.js +133 -38
  16. package/dist/public-cli/invocation.js +38 -74
  17. package/dist/public-cli/main.js +18155 -18235
  18. package/dist/public-cli/option-definitions.js +21 -2
  19. package/dist/public-cli/post-admission.js +25 -24
  20. package/dist/public-cli/run-lifecycle.js +4 -43
  21. package/dist/public-cli/turn-request.js +4 -9
  22. package/dist/public-role-summons.js +5 -3
  23. package/dist/role-run-placement.js +7 -1
  24. package/dist/role-run-relocation.js +3 -4
  25. package/package.json +1 -1
  26. package/scripts/build-package.mjs +2 -4
  27. package/src/audited-run-identity.ts +30 -0
  28. package/src/compliance-transport.ts +1 -4
  29. package/src/doctor-auditor.ts +1 -1
  30. package/src/gatekeeper-role.ts +1 -1
  31. package/src/host-contracts.ts +6 -4
  32. package/src/merger-contracts.ts +6 -2
  33. package/src/merger-role.ts +11 -1
  34. package/src/navigator-attendance.ts +2 -2
  35. package/src/navigator-public-session.ts +9 -5
  36. package/src/navigator-work-base.ts +19 -34
  37. package/src/notary-role.ts +12 -21
  38. package/src/package-contracts/worker-output.ts +0 -8
  39. package/src/packaged-role-registry.ts +8 -7
  40. package/src/pi/role-turn-host.ts +11 -1
  41. package/src/public-cli/instruction-seat-run.ts +162 -42
  42. package/src/public-cli/invocation.ts +55 -93
  43. package/src/public-cli/option-definitions.ts +22 -2
  44. package/src/public-cli/post-admission.ts +30 -24
  45. package/src/public-cli/run-lifecycle.ts +4 -56
  46. package/src/public-cli/turn-request.ts +9 -8
  47. package/src/public-role-summons.ts +17 -6
  48. package/src/role-envelope.ts +4 -0
  49. package/src/role-run-placement.ts +10 -1
  50. package/src/role-run-relocation.ts +3 -4
  51. package/src/role-runtime-dependencies.ts +0 -2
  52. package/src/role-runtime.ts +54 -47
  53. package/src/worker-role.ts +11 -78
  54. package/dist/auditor-dossier-tool.js +0 -47
  55. package/dist/package-contracts/fixer-packet.js +0 -77
  56. package/packets/fixer-prerequisites.json +0 -6
  57. package/src/auditor-dossier-tool.ts +0 -63
  58. package/src/package-contracts/fixer-packet.ts +0 -91
@@ -1058,7 +1058,7 @@ var init_run_ticket_number = __esm({
1058
1058
 
1059
1059
  // src/role-run-placement.ts
1060
1060
  import { readdir } from "node:fs/promises";
1061
- import { basename as basename5, dirname as dirname4, join as join6 } from "node:path";
1061
+ import { basename as basename5, dirname as dirname4, join as join6, resolve as resolve3 } from "node:path";
1062
1062
  function formatRunLeaf(runId, role) {
1063
1063
  return `${runId}@${role}`;
1064
1064
  }
@@ -1079,6 +1079,11 @@ function sessionFileOf(runDirectory) {
1079
1079
  function runDirectoryOfSessionFile(sessionFile) {
1080
1080
  return dirname4(dirname4(sessionFile));
1081
1081
  }
1082
+ function auditorRunDirectory(context) {
1083
+ const sessionFile = context.sessionManager?.getSessionFile?.();
1084
+ if (sessionFile === void 0) return void 0;
1085
+ return resolve3(runDirectoryOfSessionFile(sessionFile));
1086
+ }
1082
1087
  function runDirectoryFromSessionDirectory(sessionDirectory) {
1083
1088
  return dirname4(sessionDirectory);
1084
1089
  }
@@ -1216,7 +1221,7 @@ async function runEngineDetourOnce(input) {
1216
1221
  child.stderr.setEncoding("utf8").on("data", (chunk) => {
1217
1222
  stderr += chunk;
1218
1223
  });
1219
- const fail4 = (error) => {
1224
+ const fail3 = (error) => {
1220
1225
  if (settled) return;
1221
1226
  settled = true;
1222
1227
  if (signal !== void 0) {
@@ -1233,7 +1238,7 @@ async function runEngineDetourOnce(input) {
1233
1238
  resolve21(result);
1234
1239
  };
1235
1240
  const onAbort = () => {
1236
- fail4(signal !== void 0 ? abortReasonError(signal) : new Error("aborted"));
1241
+ fail3(signal !== void 0 ? abortReasonError(signal) : new Error("aborted"));
1237
1242
  try {
1238
1243
  child.kill("SIGTERM");
1239
1244
  } catch {
@@ -1246,7 +1251,7 @@ async function runEngineDetourOnce(input) {
1246
1251
  signal.addEventListener("abort", onAbort, { once: true });
1247
1252
  }
1248
1253
  }
1249
- child.on("error", (error) => fail4(error));
1254
+ child.on("error", (error) => fail3(error));
1250
1255
  child.on("close", (code) => {
1251
1256
  succeed({ code: code ?? 1, stdout, stderr });
1252
1257
  });
@@ -1608,85 +1613,8 @@ var init_fixer_output = __esm({
1608
1613
  }
1609
1614
  });
1610
1615
 
1611
- // src/package-contracts/fixer-packet.ts
1612
- import { Type as Type8 } from "typebox";
1613
- import { Value } from "typebox/value";
1614
- function causeMessage(cause) {
1615
- if (cause instanceof Error) return cause.message;
1616
- if (typeof cause === "string") return cause;
1617
- try {
1618
- return JSON.stringify(cause) ?? String(cause);
1619
- } catch {
1620
- return String(cause);
1621
- }
1622
- }
1623
- function fail(cause) {
1624
- throw new FixerPacketValidationError(cause);
1625
- }
1626
- function parseFailure(value) {
1627
- if (!Array.isArray(value)) fail(new Error("Fixer prerequisites must be a JSON array"));
1628
- for (const entry of value) {
1629
- if (!isRecord(entry)) {
1630
- fail(new Error("Fixer prerequisite entry must be an object with id and requirement fields"));
1631
- }
1632
- if (typeof entry.id !== "string" || !new RegExp(FIXER_PREREQUISITE_ID_PATTERN).test(entry.id)) {
1633
- fail(new Error(`Fixer prerequisite id violates pattern ${FIXER_PREREQUISITE_ID_PATTERN}`));
1634
- }
1635
- if (typeof entry.requirement !== "string" || !/\S/.test(entry.requirement)) {
1636
- fail(new Error("Fixer prerequisite requirement must be nonblank"));
1637
- }
1638
- }
1639
- fail(new Error("Fixer prerequisites violate the attachment schema"));
1640
- }
1641
- function validateFixerPrerequisites(value) {
1642
- if (!Value.Check(fixerPrerequisitesSchema, value)) parseFailure(value);
1643
- const entries = value;
1644
- const ids = /* @__PURE__ */ new Set();
1645
- const prerequisites = entries.map((entry) => {
1646
- if (ids.has(entry.id)) {
1647
- fail(new Error(`Fixer prerequisites contain duplicate id: ${entry.id}`));
1648
- }
1649
- ids.add(entry.id);
1650
- return Object.freeze({ id: entry.id, requirement: entry.requirement });
1651
- });
1652
- return Object.freeze(prerequisites);
1653
- }
1654
- function parseFixerPrerequisites(source) {
1655
- let decoded;
1656
- try {
1657
- decoded = JSON.parse(source);
1658
- } catch (error) {
1659
- fail(error);
1660
- }
1661
- return validateFixerPrerequisites(decoded);
1662
- }
1663
- var FIXER_PREREQUISITE_ID_PATTERN, fixerPrerequisiteSchema, fixerPrerequisitesSchema, FixerPacketValidationError;
1664
- var init_fixer_packet = __esm({
1665
- "src/package-contracts/fixer-packet.ts"() {
1666
- "use strict";
1667
- init_unknown_value();
1668
- FIXER_PREREQUISITE_ID_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._-]*$";
1669
- fixerPrerequisiteSchema = Type8.Object({
1670
- id: Type8.String({ pattern: FIXER_PREREQUISITE_ID_PATTERN }),
1671
- requirement: Type8.String({ pattern: "\\S" })
1672
- });
1673
- fixerPrerequisitesSchema = Type8.Array(fixerPrerequisiteSchema);
1674
- FixerPacketValidationError = class extends Error {
1675
- code = "AK_INVALID_FIX_PACKET";
1676
- constructor(cause) {
1677
- const prefix = "Fixer prerequisites or instructions violate the invocation contract";
1678
- super(
1679
- cause === void 0 ? prefix : `${prefix}: ${causeMessage(cause)}`,
1680
- cause === void 0 ? void 0 : { cause }
1681
- );
1682
- this.name = "FixerPacketValidationError";
1683
- }
1684
- };
1685
- }
1686
- });
1687
-
1688
1616
  // src/package-contracts/worker-output.ts
1689
- import { Type as Type9 } from "typebox";
1617
+ import { Type as Type8 } from "typebox";
1690
1618
  function validateAcceptedCoderDetails(output) {
1691
1619
  return output;
1692
1620
  }
@@ -1699,15 +1627,14 @@ var init_worker_output = __esm({
1699
1627
  "use strict";
1700
1628
  init_open_tool_schema();
1701
1629
  init_fixer_output();
1702
- init_fixer_packet();
1703
1630
  init_terminating_infrastructure();
1704
1631
  CODER_OUTPUT_TOOL_NAME = "ak_coder_output";
1705
1632
  CODER_STATUS_DESCRIPTION = `planned | completed | refused | partially_completed | unfinished\u3002unfinished\uFF1A\u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u81F4\u672C\u5C40\u672A\u5B8C\u6210\u3002${PARTIALLY_COMPLETED_DEFINITION}`;
1706
- coderOutputObject = Type9.Object({
1707
- status: Type9.Unknown({ description: CODER_STATUS_DESCRIPTION }),
1708
- report: Type9.Unknown({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
1709
- remainingScope: Type9.Unknown({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }),
1710
- reason: Type9.Unknown({
1633
+ coderOutputObject = Type8.Object({
1634
+ status: Type8.Unknown({ description: CODER_STATUS_DESCRIPTION }),
1635
+ report: Type8.Unknown({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
1636
+ remainingScope: Type8.Unknown({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }),
1637
+ reason: Type8.Unknown({
1711
1638
  description: "\u963B\u65AD\u539F\u56E0\uFF1A\u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u3002\u7F3A\u5F85\u51B3 owner \u51B3\u5B9A\u6216\u7B54\u590D\u5C5E\u7F3A\u524D\u7F6E\u3002"
1712
1639
  })
1713
1640
  });
@@ -1725,7 +1652,7 @@ var init_canonical_json = __esm({
1725
1652
  });
1726
1653
 
1727
1654
  // src/doctor-contracts.ts
1728
- import { Type as Type10 } from "typebox";
1655
+ import { Type as Type9 } from "typebox";
1729
1656
  function validateDoctorSubmissionShape(value) {
1730
1657
  return value;
1731
1658
  }
@@ -1751,25 +1678,25 @@ var init_doctor_contracts = __esm({
1751
1678
  biteNone = "noRealBite";
1752
1679
  DOCTOR_BITE_KINDS = [biteActual, biteNone];
1753
1680
  DOCTOR_STATUS_DESCRIPTION = "completed | refused\u3002completed \u5141\u8BB8\u7A7A findings\uFF1Brefused \u4EC5\u5F53\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u6848\u8BC1\u8BCD";
1754
- doctorSubmissionObject = Type10.Object({
1755
- status: Type10.Unknown({ description: DOCTOR_STATUS_DESCRIPTION }),
1756
- case: Type10.Unknown({
1681
+ doctorSubmissionObject = Type9.Object({
1682
+ status: Type9.Unknown({ description: DOCTOR_STATUS_DESCRIPTION }),
1683
+ case: Type9.Unknown({
1757
1684
  description: "\u7559\u5B58\u592A\u533B\u7F72\u6848\u8EAB\u4EFD\uFF0C\u539F\u6837\u7559\u5B58\uFF08\u5982 issueNumber\u3001runsPath\uFF09\u3002\u673A\u68B0\u5C42\u53E6\u6309\u7ED1\u5B9A run \u6295\u5F71\u6848\u8EAB\u4EFD\uFF0C\u4E0D\u5728\u672C\u5B57\u6BB5\u91CD\u5224\u3002"
1758
1685
  }),
1759
- findings: Type10.Unknown({
1686
+ findings: Type9.Unknown({
1760
1687
  description: `\u9010\u6761\u8D44\u4EA7\u89C2\u5BDF\u4E0E\u5904\u65B9\uFF0C\u539F\u6837\u7559\u5B58\u3002\u4E00\u6761\u53EF\u542B targetKey\u3001targetKind\uFF08${DOCTOR_TARGET_KINDS.join(" | ")}\uFF09\u3001observation\u3001evidenceIds\u3001disposition\uFF08${DOCTOR_DISPOSITIONS.join(" | ")}\uFF09\u3001assetEvidence\uFF08targetKey\u3001targetKind\u3001evidenceId\uFF09\u3001guardrails\uFF08reproducibleFailure\u3001owningSeamOrInvariant\u3001deletionOrSimplificationSuffices\uFF0C\u5404\u9879\u53EF\u542B answer\u3001evidenceIds\u3001explanation\uFF09\u3001prescription\uFF08kind \u4E3A ${DOCTOR_PRESCRIPTION_KINDS.join(" | ")}\uFF0C\u53E6\u53EF\u5199 recommendation\u3001necessityExplanation\uFF09\u3001lastRealBite\uFF08kind \u4E3A ${DOCTOR_BITE_KINDS.join(" | ")}\uFF0C\u53E6\u53EF\u5199 targetKey\u3001evidenceId\u3001eligibleEvidenceIds\uFF09\u3002\u4E0D\u8981\u6C42\u4EFB\u4F55\u5904\u65B9\u6216\u53EF\u590D\u7528 finding\uFF1B\u7F3A\u53EF\u590D\u7528\u8D44\u4EA7\u6216 bounded-bite \u8BC1\u636E\u53EA\u6392\u9664\u5BF9\u5E94\u8D44\u4EA7\u5904\u65B9\u3002\u673A\u5668\u4E0D\u6838\u9A8C\u3002`
1761
1688
  }),
1762
- reason: Type10.Unknown({
1689
+ reason: Type9.Unknown({
1763
1690
  description: "\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u8BC1\u8BCD\u7684\u539F\u56E0\uFF1B\u4EC5 refused \u65F6\u7528\u3002"
1764
1691
  }),
1765
- missingEvidence: Type10.Unknown({
1692
+ missingEvidence: Type9.Unknown({
1766
1693
  description: "\u5982\u5B9E\u8BC1\u8BCD\u6240\u9700\u800C\u5C1A\u7F3A\u7684\u8BC1\u636E\uFF0C\u539F\u6837\u7559\u5B58\uFF08\u5982\u6BCF\u9879 need\u3001targetKeys\uFF09\u3002"
1767
1694
  })
1768
1695
  });
1769
1696
  doctorSubmissionSchema = withTerminatingOutputDeclarations(
1770
1697
  openToolObject(doctorSubmissionObject)
1771
1698
  );
1772
- doctorEvidenceReadSchema = Type10.Object({ evidenceId: Type10.String({ minLength: 1, description: "\u5F85\u8BFB\u7559\u5B58\u8BC1\u636E\u6807\u8BC6" }), offset: Type10.Optional(Type10.Integer({ minimum: 0, description: "\u8D77\u59CB\u5B57\u8282\u504F\u79FB\uFF08\u4ECE 0 \u8BA1\uFF09" })), limit: Type10.Optional(Type10.Integer({ minimum: 1, description: "\u8FD4\u56DE\u5B57\u8282\u6570\uFF08\u65E0\u4E0A\u9650\uFF09" })) }, { additionalProperties: true });
1699
+ doctorEvidenceReadSchema = Type9.Object({ evidenceId: Type9.String({ minLength: 1, description: "\u5F85\u8BFB\u7559\u5B58\u8BC1\u636E\u6807\u8BC6" }), offset: Type9.Optional(Type9.Integer({ minimum: 0, description: "\u8D77\u59CB\u5B57\u8282\u504F\u79FB\uFF08\u4ECE 0 \u8BA1\uFF09" })), limit: Type9.Optional(Type9.Integer({ minimum: 1, description: "\u8FD4\u56DE\u5B57\u8282\u6570\uFF08\u65E0\u4E0A\u9650\uFF09" })) }, { additionalProperties: true });
1773
1700
  DoctorEvidenceStore = class {
1774
1701
  constructor(patient) {
1775
1702
  this.patient = patient;
@@ -1838,8 +1765,8 @@ var init_exact_utf8 = __esm({
1838
1765
  });
1839
1766
 
1840
1767
  // src/merger-contracts.ts
1841
- import { Type as Type11 } from "typebox";
1842
- function fail2(message = "Merger input violates its exact contract") {
1768
+ import { Type as Type10 } from "typebox";
1769
+ function fail(message = "Merger input violates its exact contract") {
1843
1770
  throw new MergerInputContractError(message);
1844
1771
  }
1845
1772
  function deepFreeze(value) {
@@ -1850,14 +1777,17 @@ function deepFreeze(value) {
1850
1777
  return value;
1851
1778
  }
1852
1779
  function readMaterial(value, label) {
1853
- if (!isRecord(value) || typeof value.bytesBase64 !== "string") fail2(`Merger ${label} material is malformed`);
1780
+ if (!isRecord(value) || typeof value.bytesBase64 !== "string") fail(`Merger ${label} material is malformed`);
1854
1781
  exactUtf8(Buffer.from(value.bytesBase64, "base64"), `Merger ${label} material`);
1855
1782
  return { bytesBase64: value.bytesBase64, sha256: typeof value.sha256 === "string" ? value.sha256 : "" };
1856
1783
  }
1857
1784
  function validateMergerInput(value) {
1858
- if (!isRecord(value) || blank(value.attemptId)) fail2("Merger input requires a non-empty attemptId for accounting");
1859
- if (!isRecord(value.materials)) fail2("Merger materials are missing");
1860
- const materials = { task: readMaterial(value.materials.task, "task"), authority: readMaterial(value.materials.authority, "authority"), targetIntent: readMaterial(value.materials.targetIntent, "targetIntent"), sourceIntent: readMaterial(value.materials.sourceIntent, "sourceIntent") };
1785
+ if (!isRecord(value) || blank(value.attemptId)) fail("Merger input requires a non-empty attemptId for accounting");
1786
+ if (!isRecord(value.materials)) fail("Merger materials are missing");
1787
+ const materials = {
1788
+ targetIntent: readMaterial(value.materials.targetIntent, "targetIntent"),
1789
+ sourceIntent: readMaterial(value.materials.sourceIntent, "sourceIntent")
1790
+ };
1861
1791
  const authorizedChecks = Array.isArray(value.authorizedChecks) ? value.authorizedChecks.filter((check) => isRecord(check)).map((c) => ({ name: asString(c.name), argv: asStringArray(c.argv).filter((a) => a.trim().length > 0) })).filter((c) => c.name.trim().length > 0 && c.argv.length > 0) : [];
1862
1792
  return deepFreeze(structuredClone({ attemptId: value.attemptId.trim(), targetObjectId: asString(value.targetObjectId), sourceObjectId: asString(value.sourceObjectId), materials, expectedConflictPaths: asStringArray(value.expectedConflictPaths), resolutionScope: asStringArray(value.resolutionScope), authorizedChecks }));
1863
1793
  }
@@ -1869,24 +1799,25 @@ var init_merger_contracts = __esm({
1869
1799
  init_open_tool_schema();
1870
1800
  init_terminating_infrastructure();
1871
1801
  init_unknown_value();
1872
- materialSchema = Type11.Object({ bytesBase64: Type11.String(), sha256: Type11.String() });
1873
- checkSchema = Type11.Object({ name: Type11.String({ minLength: 1 }), argv: Type11.Array(Type11.String({ minLength: 1 }), { minItems: 1 }) });
1874
- mergerInputSchema = Type11.Object({
1875
- attemptId: Type11.String({ minLength: 1, description: "\u5BF9\u8D26 attempt \u8EAB\u4EFD\uFF08transport\uFF09" }),
1876
- targetObjectId: Type11.String({ description: "\u6750\u6599\uFF1Atarget parent OID\uFF1B\u53EF\u7A7A" }),
1877
- sourceObjectId: Type11.String({ description: "\u6750\u6599\uFF1Asource parent OID\uFF1B\u53EF\u7A7A" }),
1878
- materials: Type11.Object({ task: materialSchema, authority: materialSchema, targetIntent: materialSchema, sourceIntent: materialSchema }),
1879
- expectedConflictPaths: Type11.Array(Type11.String(), { description: "\u6750\u6599\uFF1A\u5F53\u524D\u672A\u5408\u5E76\u8DEF\u5F84\uFF1B\u53EF\u7A7A" }),
1880
- resolutionScope: Type11.Array(Type11.String(), { description: "\u6750\u6599\uFF1A\u89E3\u6790\u8303\u56F4\u63D0\u793A\uFF1B\u53EF\u7A7A" }),
1881
- authorizedChecks: Type11.Array(checkSchema)
1802
+ materialSchema = Type10.Object({ bytesBase64: Type10.String(), sha256: Type10.String() });
1803
+ checkSchema = Type10.Object({ name: Type10.String({ minLength: 1 }), argv: Type10.Array(Type10.String({ minLength: 1 }), { minItems: 1 }) });
1804
+ mergerInputSchema = Type10.Object({
1805
+ attemptId: Type10.String({ minLength: 1, description: "\u5BF9\u8D26 attempt \u8EAB\u4EFD\uFF08transport\uFF09" }),
1806
+ targetObjectId: Type10.String({ description: "\u6750\u6599\uFF1Atarget parent OID\uFF1B\u53EF\u7A7A" }),
1807
+ sourceObjectId: Type10.String({ description: "\u6750\u6599\uFF1Asource parent OID\uFF1B\u53EF\u7A7A" }),
1808
+ // #1168: task/authority dispatch copies removed; git-fact intents remain.
1809
+ materials: Type10.Object({ targetIntent: materialSchema, sourceIntent: materialSchema }),
1810
+ expectedConflictPaths: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u5F53\u524D\u672A\u5408\u5E76\u8DEF\u5F84\uFF1B\u53EF\u7A7A" }),
1811
+ resolutionScope: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u89E3\u6790\u8303\u56F4\u63D0\u793A\uFF1B\u53EF\u7A7A" }),
1812
+ authorizedChecks: Type10.Array(checkSchema)
1882
1813
  });
1883
1814
  MERGER_STATUS_DESCRIPTION = "completed | escalate";
1884
- mergerOutputObject = Type11.Object({
1885
- status: Type11.Unknown({ description: MERGER_STATUS_DESCRIPTION }),
1886
- attemptId: Type11.Unknown({ description: "\u5DF2\u53D7\u7406\u5408\u5E76 attempt \u8EAB\u4EFD" }),
1887
- report: Type11.Unknown({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
1888
- mergeCommitId: Type11.Unknown({ description: "\u5B8C\u6210\u5408\u5E76 commit object ID" }),
1889
- diagnosis: Type11.Unknown({
1815
+ mergerOutputObject = Type10.Object({
1816
+ status: Type10.Unknown({ description: MERGER_STATUS_DESCRIPTION }),
1817
+ attemptId: Type10.Unknown({ description: "\u5DF2\u53D7\u7406\u5408\u5E76 attempt \u8EAB\u4EFD" }),
1818
+ report: Type10.Unknown({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
1819
+ mergeCommitId: Type10.Unknown({ description: "\u5B8C\u6210\u5408\u5E76 commit object ID" }),
1820
+ diagnosis: Type10.Unknown({
1890
1821
  description: "\u5408\u5E76\u65E0\u6CD5\u6216\u4E0D\u5E94\u7531\u672C\u5E2D\u5B8C\u6210\u7684\u539F\u56E0\uFF08\u542B\u65E0\u8FDB\u884C\u4E2D\u5408\u5E76\u3001\u65E0\u6D3B\u53EF\u5E72\u3001\u9700\u65B0\u7684\u4EA7\u54C1/\u6743\u529B\u51B3\u5B9A\uFF09"
1891
1822
  })
1892
1823
  });
@@ -1941,7 +1872,7 @@ var init_countersign_contracts = __esm({
1941
1872
  });
1942
1873
 
1943
1874
  // src/gleaner-left-contracts.ts
1944
- import { Type as Type12 } from "typebox";
1875
+ import { Type as Type11 } from "typebox";
1945
1876
  var GLEANER_LEFT_OUTPUT_TOOL_NAME, gleanerLeftOutputSchema, GLEANER_LEFT_BASE_FLAG;
1946
1877
  var init_gleaner_left_contracts = __esm({
1947
1878
  "src/gleaner-left-contracts.ts"() {
@@ -1952,11 +1883,11 @@ var init_gleaner_left_contracts = __esm({
1952
1883
  GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
1953
1884
  gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
1954
1885
  openToolObject(
1955
- Type12.Object({
1956
- status: Type12.Unknown({
1886
+ Type11.Object({
1887
+ status: Type11.Unknown({
1957
1888
  description: "completed"
1958
1889
  }),
1959
- findings: Type12.Unknown({
1890
+ findings: Type11.Unknown({
1960
1891
  description: "\u5F39\u7AE0\u5217\u8868\uFF1B\u6BCF\u6761\u53EF\u542B pointer\uFF08\u6587\u4EF6/\u884C\u6307\u9488\uFF09\u4E0E statement\uFF08\u7591\u70B9\u9648\u8FF0\uFF09\uFF0C\u539F\u6837\u7559\u5B58\u3002\u7A7A\u5217\u8868\u5408\u6CD5\u5B8C\u5C40\uFF1B\u673A\u5668\u4E0D\u5224\u5F39\u7AE0\u662F\u5426\u6210\u7ACB\u3002"
1961
1892
  })
1962
1893
  })
@@ -2044,7 +1975,7 @@ var init_ticket_provenance_contracts = __esm({
2044
1975
  });
2045
1976
 
2046
1977
  // src/diarist-contracts.ts
2047
- import { Type as Type13 } from "typebox";
1978
+ import { Type as Type12 } from "typebox";
2048
1979
  function projectDiaristSessions(value) {
2049
1980
  const raw = value?.sessions;
2050
1981
  if (raw === void 0) return [];
@@ -2077,20 +2008,20 @@ var init_diarist_contracts = __esm({
2077
2008
  DIARIST_SESSIONS_DESCRIPTION = "\u5BF9\u8BDD\u8FB9\u754C\u3002\u6BCF\u5377\u542B path\uFF08\u4F1A\u8BDD\u5377\u7EDD\u5BF9\u6216\u53EF\u8BFB\u8DEF\u5F84\uFF09\u4E0E ranges\uFF08\u672C\u5377\u672C\u8F6E\u5404\u533A\u95F4\uFF09\u3002\u6BCF\u6BB5\u533A\u95F4\u542B from / to\uFF1B\u8D77\u70B9\u4E0E\u7EC8\u70B9\u5404\u5199 id\uFF08\u539F\u751F id\uFF09\u6216 line\uFF08\u672C\u8F6E\u884C\u53F7\uFF09\uFF0C\u4E8C\u9009\u4E00\u3002\u7A7A\u5217\u8868\uFF1D\u672C\u8F6E\u65E0\u5BF9\u8BDD\u53EF\u5212\u3002\u7AEF\u70B9\u65E0\u6CD5\u6307\u540D\u65F6\u8D70 reask\uFF0C\u4E0D\u4E2D\u6B62\u3002";
2078
2009
  diaristOutputSchema = withTerminatingOutputDeclarations(
2079
2010
  openToolObject(
2080
- Type13.Object({
2081
- status: Type13.Unknown({
2011
+ Type12.Object({
2012
+ status: Type12.Unknown({
2082
2013
  description: "completed | escalate"
2083
2014
  }),
2084
- ticketNumber: Type13.Optional(
2085
- Type13.Unknown({
2015
+ ticketNumber: Type12.Optional(
2016
+ Type12.Unknown({
2086
2017
  description: "\u672C\u5EAD\u5BF9\u8C61\u7968\u53F7\uFF08\u6B63\u6574\u6570\uFF09\u6216 null/\u7701\u7565\uFF1D\u771F\u65E0\u7968\uFF1B\u4E0B\u6E38\u8D70 typed \u952E\uFF1B\u8BA4\u4E0D\u51FA\u7528 status=escalate\uFF0C\u4E0D\u6D17\u6210\u65E0\u5F55\u3002\u673A\u68B0\u5C42\u4E0D\u91CD\u5224\u3002"
2087
2018
  })
2088
2019
  ),
2089
- reason: Type13.Unknown({
2020
+ reason: Type12.Unknown({
2090
2021
  description: "status \u4E3A escalate \u65F6\uFF1A\u8BA4\u4E0D\u51FA\u672C\u5EAD\u5BF9\u8C61\u7684\u539F\u56E0"
2091
2022
  }),
2092
- sessions: Type13.Optional(Type13.Unknown({ description: DIARIST_SESSIONS_DESCRIPTION })),
2093
- ticketSessions: Type13.Unknown({
2023
+ sessions: Type12.Optional(Type12.Unknown({ description: DIARIST_SESSIONS_DESCRIPTION })),
2024
+ ticketSessions: Type12.Unknown({
2094
2025
  description: `\u591A\u7968\u5EAD\u9010\u7968\u5BF9\u8BDD\u8FB9\u754C\uFF1B\u6BCF\u7968\u542B ticketNumber\uFF08\u672C\u6761\u8FB9\u754C\u6240\u5F52\u7968\u53F7\uFF0C\u6B63\u6574\u6570\uFF09\u4E0E sessions\uFF08${DIARIST_SESSIONS_DESCRIPTION}\uFF09\u3002\u4E00\u6B21\u4EA4\u5377\u5404\u7968\u5404\u81EA\u5206\u5F55\u3002\u4E0E\u5355\u7968 sessions \u4E8C\u9009\u4E00\u3002`
2095
2026
  })
2096
2027
  })
@@ -2100,7 +2031,7 @@ var init_diarist_contracts = __esm({
2100
2031
  });
2101
2032
 
2102
2033
  // src/secretariat-contracts.ts
2103
- import { Type as Type14 } from "typebox";
2034
+ import { Type as Type13 } from "typebox";
2104
2035
  var SECRETARIAT_OUTPUT_TOOL_NAME, secretariatVerdictSchema, SECRETARIAT_GATE_OFFICER_ENTRY_TYPE, SECRETARIAT_COUNTERSIGN_TERMINAL_FACT_KEY;
2105
2036
  var init_secretariat_contracts = __esm({
2106
2037
  "src/secretariat-contracts.ts"() {
@@ -2108,17 +2039,17 @@ var init_secretariat_contracts = __esm({
2108
2039
  init_terminating_infrastructure();
2109
2040
  SECRETARIAT_OUTPUT_TOOL_NAME = "ak_secretariat_output";
2110
2041
  secretariatVerdictSchema = withTerminatingOutputDeclarations(
2111
- Type14.Object(
2042
+ Type13.Object(
2112
2043
  {
2113
- secretariatStatus: Type14.Unknown({
2044
+ secretariatStatus: Type13.Unknown({
2114
2045
  description: "converged | escalate"
2115
2046
  }),
2116
- ticketNumber: Type14.Optional(
2117
- Type14.Unknown({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
2047
+ ticketNumber: Type13.Optional(
2048
+ Type13.Unknown({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
2118
2049
  ),
2119
- note: Type14.Unknown({ description: "\u9644\u6CE8" }),
2120
- evidence: Type14.Optional(Type14.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
2121
- decisionGate: Type14.Unknown({
2050
+ note: Type13.Unknown({ description: "\u9644\u6CE8" }),
2051
+ evidence: Type13.Optional(Type13.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
2052
+ decisionGate: Type13.Unknown({
2122
2053
  description: "\u9700\u965B\u4E0B\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879\uFF1B\u53EF\u5199 question \u4E0E options\uFF0C\u539F\u6837\u7559\u5B58\u3002"
2123
2054
  })
2124
2055
  },
@@ -2426,10 +2357,10 @@ var init_packaged_role_registry = __esm({
2426
2357
  reportPhase: true
2427
2358
  },
2428
2359
  boardPlacement: "marshal",
2360
+ /** #1168: dispatch is first message; navigator reads admitted instruction. */
2361
+ navigatorSubject: "public-instruction",
2429
2362
  activationFlags: [
2430
- { field: "packetPath", flag: "ak-fix-packet", binds: "input" },
2431
- { field: "phase", flag: "ak-fixer-phase", binds: "phase" },
2432
- { field: "prerequisitesPath", flag: "ak-fixer-prerequisites" }
2363
+ { field: "phase", flag: "ak-fixer-phase", binds: "phase" }
2433
2364
  ],
2434
2365
  activationStage: "load-and-install",
2435
2366
  sessionMaterials: [
@@ -2456,8 +2387,9 @@ var init_packaged_role_registry = __esm({
2456
2387
  artifactFace: {
2457
2388
  reportPhase: true
2458
2389
  },
2390
+ /** #1168: dispatch is first message; navigator reads admitted instruction. */
2391
+ navigatorSubject: "public-instruction",
2459
2392
  activationFlags: [
2460
- { field: "taskPath", flag: "ak-coder-task", binds: "input" },
2461
2393
  { field: "phase", flag: "ak-coder-phase", binds: "phase" }
2462
2394
  ],
2463
2395
  activationStage: "load-and-install",
@@ -2697,7 +2629,8 @@ var init_packaged_role_registry = __esm({
2697
2629
  presentSettled: "always",
2698
2630
  summonResume: false,
2699
2631
  admission: "instruction",
2700
- sameParent: "gate-pointer",
2632
+ /** Structured --source-run only; instruction stays opaque caller/peer bytes (#1166). */
2633
+ sameParent: "source-run",
2701
2634
  /** Resume restores an optional source-run path onto the admitted face. */
2702
2635
  resumeSourcePath: true,
2703
2636
  /** 台院 is a review officer and inherits the gatekeeper model. */
@@ -2710,11 +2643,12 @@ var init_packaged_role_registry = __esm({
2710
2643
  /** Court reask replaces the initial prompt. */
2711
2644
  reaskPrompt: true,
2712
2645
  gateStageLabel: "\u53F0\u9662",
2646
+ /** Gate summon binds --source-run; identity is startup material (#1166). */
2647
+ gateSummon: "source-run",
2713
2648
  activationFlags: [
2714
2649
  {
2715
2650
  field: "sourceRun",
2716
2651
  from: "sourceRunPath",
2717
- fallback: "gate-pointer",
2718
2652
  flag: "ak-inspector-source-run",
2719
2653
  binds: "input"
2720
2654
  }
@@ -2826,7 +2760,7 @@ var init_cli_errors = __esm({
2826
2760
  });
2827
2761
 
2828
2762
  // src/collector-config.ts
2829
- function fail3(message, cause) {
2763
+ function fail2(message, cause) {
2830
2764
  throw new Error(message, cause === void 0 ? void 0 : { cause });
2831
2765
  }
2832
2766
  function conservativeAscii(input) {
@@ -2837,20 +2771,20 @@ function conservativeAscii(input) {
2837
2771
  return true;
2838
2772
  }
2839
2773
  function parseCollectorRepository(raw) {
2840
- if (typeof raw !== "string" || raw.trim() !== raw || raw.length === 0) fail3("Collector repository must be a string owner/repo");
2841
- if (!conservativeAscii(raw) || raw.includes("://") || /[?#@%\\ ]/.test(raw)) fail3("Collector repository rejects URL syntax and non-identity bytes");
2774
+ if (typeof raw !== "string" || raw.trim() !== raw || raw.length === 0) fail2("Collector repository must be a string owner/repo");
2775
+ if (!conservativeAscii(raw) || raw.includes("://") || /[?#@%\\ ]/.test(raw)) fail2("Collector repository rejects URL syntax and non-identity bytes");
2842
2776
  const parts = raw.split("/");
2843
- if (parts.length !== 2) fail3("Collector repository must contain exactly one '/' separating owner and repo");
2777
+ if (parts.length !== 2) fail2("Collector repository must contain exactly one '/' separating owner and repo");
2844
2778
  const [ownerDisplay, repoDisplay] = parts;
2845
- if (!COLLECTOR_OWNER_PATTERN.test(ownerDisplay) || !COLLECTOR_REPO_PATTERN.test(repoDisplay)) fail3("Collector repository does not match the conservative owner/repo grammar");
2779
+ if (!COLLECTOR_OWNER_PATTERN.test(ownerDisplay) || !COLLECTOR_REPO_PATTERN.test(repoDisplay)) fail2("Collector repository does not match the conservative owner/repo grammar");
2846
2780
  const owner = ownerDisplay.toLowerCase();
2847
2781
  const repo = repoDisplay.toLowerCase();
2848
2782
  return { display: raw, canonical: `${owner}/${repo}`, owner, repo };
2849
2783
  }
2850
2784
  function parseCollectorPrNumber(raw) {
2851
- if (typeof raw !== "string" && typeof raw !== "number") fail3("Collector pull request number is required");
2785
+ if (typeof raw !== "string" && typeof raw !== "number") fail2("Collector pull request number is required");
2852
2786
  const value = parseTicketNumber(raw);
2853
- if (value === void 0) fail3(typeof raw === "string" && !isTicketNumberString(raw) ? "Collector pull request number must be a positive safe integer string" : "Collector pull request number must be a positive safe integer");
2787
+ if (value === void 0) fail2(typeof raw === "string" && !isTicketNumberString(raw) ? "Collector pull request number must be a positive safe integer string" : "Collector pull request number must be a positive safe integer");
2854
2788
  return value;
2855
2789
  }
2856
2790
  var COLLECTOR_OWNER_PATTERN, COLLECTOR_REPO_PATTERN;
@@ -2863,59 +2797,6 @@ var init_collector_config = __esm({
2863
2797
  }
2864
2798
  });
2865
2799
 
2866
- // src/auditor-dossier-tool.ts
2867
- var auditor_dossier_tool_exports = {};
2868
- __export(auditor_dossier_tool_exports, {
2869
- AUDITOR_DOSSIER_TOOL_NAME: () => AUDITOR_DOSSIER_TOOL_NAME,
2870
- auditorRunDirectory: () => auditorRunDirectory,
2871
- createAuditorDossierTool: () => createAuditorDossierTool
2872
- });
2873
- import { join as join7, resolve as resolve3 } from "node:path";
2874
- import { Type as Type15 } from "typebox";
2875
- function auditorRunDirectory(context) {
2876
- const sessionFile = context.sessionManager?.getSessionFile?.();
2877
- if (sessionFile === void 0) return void 0;
2878
- return resolve3(runDirectoryOfSessionFile(sessionFile));
2879
- }
2880
- function createAuditorDossierTool(runDirectory) {
2881
- return {
2882
- name: AUDITOR_DOSSIER_TOOL_NAME,
2883
- description: "\u5B9A\u4F4D\u672C\u5BA1\u8BA1\u5E2D\u7ED1\u5B9A\u7684 run \u5377\u5B97\u53CA\u5176\u8BC1\u636E\u5165\u53E3\u3002",
2884
- // #836 r16 class 3: execute() ignores `_params` entirely — a closed root
2885
- // only rejects the role for saying more.
2886
- parameters: Type15.Object({}, { additionalProperties: true }),
2887
- async execute(_id, _params) {
2888
- if (runDirectory === void 0) {
2889
- return {
2890
- content: [{ type: "text", text: "\u672C\u5BA1\u8BA1\u5E2D\u65E0\u7ED1\u5B9A run \u5377\u5B97\u8BB0\u5F55\u3002" }],
2891
- details: void 0
2892
- };
2893
- }
2894
- const details = {
2895
- runDirectory,
2896
- current: runCurrentPath(runDirectory),
2897
- parentSessionCandidate: sessionFileOf(runDirectory),
2898
- attachments: join7(runDirectory, "attachments"),
2899
- log: join7(runDirectory, RUN_LOG_FILE),
2900
- history: join7(runDirectory, RUN_HISTORY_FILE)
2901
- };
2902
- return {
2903
- content: [{ type: "text", text: JSON.stringify(details) }],
2904
- details
2905
- };
2906
- }
2907
- };
2908
- }
2909
- var AUDITOR_DOSSIER_TOOL_NAME;
2910
- var init_auditor_dossier_tool = __esm({
2911
- "src/auditor-dossier-tool.ts"() {
2912
- "use strict";
2913
- init_run_dossier();
2914
- init_role_run_placement();
2915
- AUDITOR_DOSSIER_TOOL_NAME = "ak_get_run_dossier";
2916
- }
2917
- });
2918
-
2919
2800
  // src/readable-gate-item.ts
2920
2801
  var readable_gate_item_exports = {};
2921
2802
  __export(readable_gate_item_exports, {
@@ -3007,7 +2888,7 @@ var init_submission_errors = __esm({
3007
2888
  });
3008
2889
 
3009
2890
  // src/collector-tool-schemas.ts
3010
- import { Type as Type16 } from "typebox";
2891
+ import { Type as Type14 } from "typebox";
3011
2892
  var collectorOutputBaseSchema, collectorOutputArgsSchema;
3012
2893
  var init_collector_tool_schemas = __esm({
3013
2894
  "src/collector-tool-schemas.ts"() {
@@ -3015,11 +2896,11 @@ var init_collector_tool_schemas = __esm({
3015
2896
  init_open_tool_schema();
3016
2897
  init_terminating_infrastructure();
3017
2898
  collectorOutputBaseSchema = openToolObject(
3018
- Type16.Object({
3019
- groups: Type16.Unsafe({
2899
+ Type14.Object({
2900
+ groups: Type14.Unsafe({
3020
2901
  description: "\u6309\u673A\u5668\u8EAB\u4EFD\u5F52\u7EC4\u7684\u51FA\u5E2D\u3001\u6750\u6599\u4E0E\u9010\u6761 findings\uFF08LLM \u81EA\u884C\u4ECE\u5BBF\u4E3B CLI \u53D6\u8BC1\u6574\u7406\uFF1B\u4EE3\u7801\u4E0D\u4EE3\u6536\u4E0D\u5F52\u5E76\uFF09\u3002"
3021
2902
  }),
3022
- unfinishedReasons: Type16.Unknown({
2903
+ unfinishedReasons: Type14.Unknown({
3023
2904
  description: "\u672A\u5B8C\u6210\u539F\u56E0\uFF1B\u53D6\u8BC1\u53D7\u9650\u65F6\u5982\u5B9E\u62A5\u544A\u3002"
3024
2905
  })
3025
2906
  })
@@ -3505,7 +3386,7 @@ var GATE_OFFICER_BY_SUBJECT, GATEKEEPER_TOOL_SPEC;
3505
3386
  var init_gatekeeper_role = __esm({
3506
3387
  "src/gatekeeper-role.ts"() {
3507
3388
  "use strict";
3508
- init_auditor_dossier_tool();
3389
+ init_role_run_placement();
3509
3390
  init_packaged_role_registry();
3510
3391
  init_submission_errors();
3511
3392
  init_inspector_contracts();
@@ -4001,7 +3882,7 @@ import {
4001
3882
  statSync as statSync3
4002
3883
  } from "node:fs";
4003
3884
  import { homedir } from "node:os";
4004
- import { dirname as dirname5, join as join8 } from "node:path";
3885
+ import { dirname as dirname5, join as join7 } from "node:path";
4005
3886
  function declareHostSessionFailure(error) {
4006
3887
  const message = error instanceof Error ? error.stack || error.message : String(error);
4007
3888
  process.stderr.write(`[host-session] Dossier record failure: ${message}
@@ -4026,7 +3907,7 @@ function findCodexRollout(sessionsDir, sessionId) {
4026
3907
  throw error;
4027
3908
  }
4028
3909
  for (const entry of entries) {
4029
- const fullPath = join8(dir, entry.name);
3910
+ const fullPath = join7(dir, entry.name);
4030
3911
  if (entry.isDirectory()) {
4031
3912
  scan(fullPath, depth + 1);
4032
3913
  } else if (entry.isFile() && entry.name.endsWith(".jsonl") && entry.name.includes(sessionId)) {
@@ -4056,24 +3937,24 @@ function sanitizeClaudeCwd(cwd) {
4056
3937
  function resolveNativeSessionPath(options) {
4057
3938
  const home = options.home || homedir();
4058
3939
  if (options.host === "claude") {
4059
- const configDir = process.env.CLAUDE_CONFIG_DIR || join8(home, ".claude");
3940
+ const configDir = process.env.CLAUDE_CONFIG_DIR || join7(home, ".claude");
4060
3941
  const sanitizedCwd = sanitizeClaudeCwd(options.cwd);
4061
- return join8(configDir, "projects", sanitizedCwd, `${options.sessionId}.jsonl`);
3942
+ return join7(configDir, "projects", sanitizedCwd, `${options.sessionId}.jsonl`);
4062
3943
  }
4063
3944
  if (options.host === "codex") {
4064
3945
  return findCodexRollout(codexSessionsDirectory(home), options.sessionId);
4065
3946
  }
4066
3947
  if (options.host === "grok-build") {
4067
- const grokHome = process.env.GROK_HOME || join8(home, ".grok");
4068
- return join8(grokHome, "sessions", encodeURIComponent(options.cwd), options.sessionId);
3948
+ const grokHome = process.env.GROK_HOME || join7(home, ".grok");
3949
+ return join7(grokHome, "sessions", encodeURIComponent(options.cwd), options.sessionId);
4069
3950
  }
4070
3951
  return void 0;
4071
3952
  }
4072
3953
  function codexSessionsDirectory(home) {
4073
- return join8(process.env.CODEX_HOME || join8(home || homedir(), ".codex"), "sessions");
3954
+ return join7(process.env.CODEX_HOME || join7(home || homedir(), ".codex"), "sessions");
4074
3955
  }
4075
3956
  function resolveHostDossierLandingPath(options) {
4076
- return options.host === "grok-build" ? join8(options.sessionDirectory, options.host) : join8(options.sessionDirectory, `${options.host}.jsonl`);
3957
+ return options.host === "grok-build" ? join7(options.sessionDirectory, options.host) : join7(options.sessionDirectory, `${options.host}.jsonl`);
4077
3958
  }
4078
3959
  function recordNativeSessionPointer(options) {
4079
3960
  if (options.host === "pi" || options.host === "hermes") {
@@ -4106,8 +3987,8 @@ function copyFileCloneOrFallback(src, dest) {
4106
3987
  }
4107
3988
  function copyGrokDossier(srcDir, destDir) {
4108
3989
  mkdirSync2(destDir, { recursive: true });
4109
- copyFileCloneOrFallback(join8(srcDir, "chat_history.jsonl"), join8(destDir, "chat_history.jsonl"));
4110
- copyFileCloneOrFallback(join8(srcDir, "usage.json"), join8(destDir, "usage.json"));
3990
+ copyFileCloneOrFallback(join7(srcDir, "chat_history.jsonl"), join7(destDir, "chat_history.jsonl"));
3991
+ copyFileCloneOrFallback(join7(srcDir, "usage.json"), join7(destDir, "usage.json"));
4111
3992
  }
4112
3993
  function copyAndRecordHostDossier(options) {
4113
3994
  if (options.host === "hermes") {
@@ -5428,13 +5309,13 @@ var init_session_dialogue = __esm({
5428
5309
 
5429
5310
  // src/ticket-provenance.ts
5430
5311
  import { readFile as readFile6 } from "node:fs/promises";
5431
- import { join as join9, resolve as resolve7 } from "node:path";
5312
+ import { join as join8, resolve as resolve7 } from "node:path";
5432
5313
  function dialogueSessionSourceRoots(home) {
5433
5314
  const machineHome = typeof home === "string" && home.trim() !== "" ? home : packageMachineHome();
5434
5315
  return [
5435
- join9(machineHome, ".claude", "projects"),
5436
- join9(machineHome, ".codex", "sessions"),
5437
- join9(machineHome, ".pi", "agent", "sessions")
5316
+ join8(machineHome, ".claude", "projects"),
5317
+ join8(machineHome, ".codex", "sessions"),
5318
+ join8(machineHome, ".pi", "agent", "sessions")
5438
5319
  ];
5439
5320
  }
5440
5321
  function isLedgerRoleSessionFile(absolute, home) {
@@ -5475,7 +5356,7 @@ async function rehomeUnboundTicketProvenance(runDirectory, ticketNumber, cwd, ho
5475
5356
  const ticketInput = ticketProvenanceRecordInput(ticketNumber, cwd, home);
5476
5357
  let history;
5477
5358
  try {
5478
- history = await readFile6(join9(runDirectory, RUN_HISTORY_FILE), "utf8");
5359
+ history = await readFile6(join8(runDirectory, RUN_HISTORY_FILE), "utf8");
5479
5360
  } catch (error) {
5480
5361
  if (errnoCode(error) === "ENOENT") return;
5481
5362
  throw error;
@@ -5692,7 +5573,7 @@ var init_uuidv7 = __esm({
5692
5573
  });
5693
5574
 
5694
5575
  // src/notary-source-run.ts
5695
- import { dirname as dirname7, isAbsolute as isAbsolute4, join as join10, resolve as resolve8, basename as basename7 } from "node:path";
5576
+ import { dirname as dirname7, isAbsolute as isAbsolute4, join as join9, resolve as resolve8, basename as basename7 } from "node:path";
5696
5577
  import { lstat, realpath as realpath2 } from "node:fs/promises";
5697
5578
  async function readRetainedIdentity(runDirectory) {
5698
5579
  try {
@@ -5744,11 +5625,11 @@ async function resolveNotarySourceRunLocator(options) {
5744
5625
  const ledgerHome = resolveActivationLedgerHome(options.home);
5745
5626
  const bookKey = resolveBookKeyFromGit(options.projectRoot);
5746
5627
  const bookDirectory = activationBookDirectory(ledgerHome, bookKey);
5747
- const bookRunsRoot = join10(bookDirectory, "runs");
5628
+ const bookRunsRoot = join9(bookDirectory, "runs");
5748
5629
  let candidate;
5749
5630
  const bare = parseRunLeaf(raw);
5750
5631
  if (bare !== void 0 && !raw.includes("/") && !raw.includes("\\")) {
5751
- candidate = await findRunDirectoryById(options.home, bare.runId, bookKey, bare.role) ?? join10(bookRunsRoot, formatRunLeaf(bare.runId, bare.role));
5632
+ candidate = await findRunDirectoryById(options.home, bare.runId, bookKey, bare.role) ?? join9(bookRunsRoot, formatRunLeaf(bare.runId, bare.role));
5752
5633
  } else {
5753
5634
  candidate = isAbsolute4(raw) ? raw : resolve8(options.projectRoot, raw);
5754
5635
  const identity2 = parseRunLeaf(basename7(candidate));
@@ -6182,7 +6063,7 @@ function renderHumanOwnerOptionLines(owner, locale = "en") {
6182
6063
  }
6183
6064
  return lines;
6184
6065
  }
6185
- var ANALYST_REQUIRE_ANY_OF, ANALYST_DEFAULT_MODE, REJECTED_PUBLIC_SPELLINGS, GLOBAL_OPTIONS, SHARED_PROJECT_SEMANTICS, SHARED_ATTACH_SEMANTICS, SHARED_PHASE_SEMANTICS, GLEANER_LEFT_OPTIONS, AUDITOR_OPTIONS, CODER_OPTIONS, FIXER_OPTIONS, REVIEWER_OPTIONS, COLLECTOR_OPTIONS, DOCTOR_OPTIONS, NOTARY_OPTIONS, MERGER_OPTIONS, ANALYST_OPTIONS, SEAT_OPTION_ROWS, PUBLIC_OPTION_TABLE, PUBLIC_ROLE_OPTION_OWNERS, PUBLIC_NAVIGATOR_HELP_NOTE, TOP_LEVEL_HELP, ROLE_COMMAND_HELP, SUPPORT_COMMAND_HELP, PUBLIC_COMMAND_HELP;
6066
+ var ANALYST_REQUIRE_ANY_OF, ANALYST_DEFAULT_MODE, REJECTED_PUBLIC_SPELLINGS, GLOBAL_OPTIONS, SHARED_PROJECT_SEMANTICS, SHARED_ATTACH_SEMANTICS, SHARED_PHASE_SEMANTICS, GLEANER_LEFT_OPTIONS, AUDITOR_OPTIONS, CODER_OPTIONS, FIXER_OPTIONS, REVIEWER_OPTIONS, COLLECTOR_OPTIONS, DOCTOR_OPTIONS, NOTARY_OPTIONS, INSPECTOR_OPTIONS, MERGER_OPTIONS, ANALYST_OPTIONS, SEAT_OPTION_ROWS, PUBLIC_OPTION_TABLE, PUBLIC_ROLE_OPTION_OWNERS, PUBLIC_NAVIGATOR_HELP_NOTE, TOP_LEVEL_HELP, ROLE_COMMAND_HELP, SUPPORT_COMMAND_HELP, PUBLIC_COMMAND_HELP;
6186
6067
  var init_option_definitions = __esm({
6187
6068
  "src/public-cli/option-definitions.ts"() {
6188
6069
  "use strict";
@@ -6403,8 +6284,8 @@ var init_option_definitions = __esm({
6403
6284
  repeatable: false,
6404
6285
  form: "option",
6405
6286
  description: {
6406
- en: "JSON array of {id, requirement} prerequisite objects.",
6407
- zh: "{id, requirement} \u524D\u7F6E\u6761\u4EF6 JSON \u6570\u7EC4\u8DEF\u5F84\u3002"
6287
+ en: "Caller prerequisites path passed as-is to the role. Package does not read, copy, or validate; use an absolute path when cwd differs from --project.",
6288
+ zh: "\u8C03\u7528\u65B9\u524D\u7F6E\u6761\u4EF6\u6587\u4EF6\u8DEF\u5F84\u539F\u6837\u9012\u7ED9\u8859\u95E8\u3002\u5305\u4E0D\u8BFB\u3001\u4E0D\u590D\u5236\u3001\u4E0D\u6821\u9A8C\uFF1B\u8C03\u7528\u65B9\u5F53\u524D\u76EE\u5F55\u4E0E --project \u4E0D\u540C\u65F6\u8BF7\u7ED9\u7EDD\u5BF9\u8DEF\u5F84\u3002"
6408
6289
  }
6409
6290
  }
6410
6291
  ];
@@ -6547,6 +6428,23 @@ var init_option_definitions = __esm({
6547
6428
  }
6548
6429
  }
6549
6430
  ];
6431
+ INSPECTOR_OPTIONS = [
6432
+ ...projectAndAttach("inspector"),
6433
+ {
6434
+ id: "source-run",
6435
+ owner: "inspector",
6436
+ canonical: "--source-run",
6437
+ aliases: [],
6438
+ valueMetavar: "runId@role|path",
6439
+ required: false,
6440
+ repeatable: false,
6441
+ form: "option",
6442
+ description: {
6443
+ en: "Optional audited source-run locator (runId@role or path). Gate summons always supply it; identity rides startup materials.",
6444
+ zh: "\u53EF\u9009\u88AB\u5BA1\u817F\u5B9A\u4F4D\u7B26\uFF08runId@role \u6216\u8DEF\u5F84\uFF09\u3002\u95F8\u4F20\u53EC\u5FC5\u5E26\uFF1B\u8EAB\u4EFD\u5728\u542F\u52A8\u6750\u6599\u91CC\u3002"
6445
+ }
6446
+ }
6447
+ ];
6550
6448
  MERGER_OPTIONS = [
6551
6449
  // Merger project face: worktree whose Git materials are handed to the role.
6552
6450
  {
@@ -6705,7 +6603,8 @@ var init_option_definitions = __esm({
6705
6603
  doctor: DOCTOR_OPTIONS,
6706
6604
  merger: MERGER_OPTIONS,
6707
6605
  notary: NOTARY_OPTIONS,
6708
- auditor: AUDITOR_OPTIONS
6606
+ auditor: AUDITOR_OPTIONS,
6607
+ inspector: INSPECTOR_OPTIONS
6709
6608
  };
6710
6609
  PUBLIC_OPTION_TABLE = publicOptionTable();
6711
6610
  PUBLIC_ROLE_OPTION_OWNERS = [
@@ -6959,7 +6858,7 @@ import {
6959
6858
  rename,
6960
6859
  writeFile
6961
6860
  } from "node:fs/promises";
6962
- import { dirname as dirname8, isAbsolute as isAbsolute5, join as join11, resolve as resolve9 } from "node:path";
6861
+ import { dirname as dirname8, isAbsolute as isAbsolute5, join as join10, resolve as resolve9 } from "node:path";
6963
6862
  function normalizeAdmittedAttachment(raw) {
6964
6863
  if (typeof raw !== "object" || raw === null) return void 0;
6965
6864
  const record = raw;
@@ -7112,7 +7011,7 @@ async function relocateAdmittedRunToTicket(admitted, authority, heldLease) {
7112
7011
  const childRunIds = readPageSync(oldRunDirectory, "admitted")?.childDiaristRunIds;
7113
7012
  for (const childRunId of Array.isArray(childRunIds) ? childRunIds : []) {
7114
7013
  if (typeof childRunId !== "string") continue;
7115
- const childDirectory = join11(dirname8(oldRunDirectory), formatRunLeaf(childRunId, "diarist"));
7014
+ const childDirectory = join10(dirname8(oldRunDirectory), formatRunLeaf(childRunId, "diarist"));
7116
7015
  if (!existsSync3(childDirectory)) continue;
7117
7016
  const childTarget = roleRunPlacement(ledgerHome, {
7118
7017
  bookKey: admitted.bookKey,
@@ -7145,9 +7044,6 @@ async function relocateAdmittedRunToTicket(admitted, authority, heldLease) {
7145
7044
  admittedRecord,
7146
7045
  [
7147
7046
  "runDirectory",
7148
- "taskPath",
7149
- "packetPath",
7150
- "prerequisitesPath",
7151
7047
  "mergerInputPath"
7152
7048
  ],
7153
7049
  oldRunDirectory,
@@ -7189,7 +7085,7 @@ async function recordLaunchedPiIdentity(runDirectory, identity) {
7189
7085
  async function observeLaunchedRolePackageIdentity(packageRoot, selectedRoleEntry) {
7190
7086
  const rolePackageRoot = packageRoot;
7191
7087
  const raw = JSON.parse(
7192
- await readFile7(join11(rolePackageRoot, "package.json"), "utf8")
7088
+ await readFile7(join10(rolePackageRoot, "package.json"), "utf8")
7193
7089
  );
7194
7090
  if (typeof raw.version !== "string" || raw.version.trim() === "") {
7195
7091
  throw new Error(
@@ -7280,7 +7176,7 @@ function assignPublicSeatOption(owner, taken, fields) {
7280
7176
  fields.authorityRefs.push(requireAuthorityRef(value));
7281
7177
  return;
7282
7178
  case "prerequisites":
7283
- fields.prerequisitesPath = requireOptionPath(taken.def.canonical, value);
7179
+ fields.prerequisitesPath = requireProvidedOptionValue(taken.def.canonical, value);
7284
7180
  return;
7285
7181
  case "pr":
7286
7182
  fields.prNumber = parsePositivePrOption(value);
@@ -7530,11 +7426,7 @@ async function admitPublicRole(role, parsed, env, override) {
7530
7426
  instruction,
7531
7427
  attachmentPaths,
7532
7428
  ...project,
7533
- placedFields: async (placed) => {
7534
- const taskPath = join11(placed.runDirectory, "task.md");
7535
- await writeFile(taskPath, instruction, "utf8");
7536
- return { phase, taskPath };
7537
- }
7429
+ placedFields: async () => ({ phase })
7538
7430
  });
7539
7431
  }
7540
7432
  case "worker-packet": {
@@ -7545,52 +7437,15 @@ async function admitPublicRole(role, parsed, env, override) {
7545
7437
  if (!record.phases.some((item) => item === phase)) {
7546
7438
  throw new CliUsageError("fixer phase must be plan or apply");
7547
7439
  }
7548
- let prerequisites = Object.freeze([]);
7549
- let prerequisitesSource;
7550
- if (parsed.prerequisitesPath !== void 0) {
7551
- const absolutePrereq = isAbsolute5(parsed.prerequisitesPath) ? parsed.prerequisitesPath : resolve9(parsed.prerequisitesPath);
7552
- try {
7553
- prerequisitesSource = await readFile7(absolutePrereq, "utf8");
7554
- } catch (error) {
7555
- throw new CliUsageError(
7556
- `fixer prerequisites path is unreadable: ${parsed.prerequisitesPath}`,
7557
- { cause: error }
7558
- );
7559
- }
7560
- try {
7561
- prerequisites = parseFixerPrerequisites(prerequisitesSource);
7562
- } catch (error) {
7563
- if (error instanceof FixerPacketValidationError) {
7564
- throw new CliUsageError(error.message, { cause: error });
7565
- }
7566
- throw error;
7567
- }
7568
- }
7569
7440
  return admitStandardMaterialInvocation("fixer", {
7570
7441
  ...shared,
7571
7442
  instruction,
7572
7443
  attachmentPaths,
7573
7444
  ...project,
7574
- placedFields: async (placed) => {
7575
- let prerequisitesPath;
7576
- if (prerequisitesSource !== void 0) {
7577
- prerequisitesPath = join11(placed.runDirectory, "prerequisites.json");
7578
- await writeFile(
7579
- prerequisitesPath,
7580
- `${JSON.stringify(prerequisites, null, 2)}
7581
- `,
7582
- "utf8"
7583
- );
7584
- }
7585
- const packetPath = join11(placed.runDirectory, "fix-packet.md");
7586
- await writeFile(packetPath, instruction, "utf8");
7587
- return {
7588
- phase,
7589
- packetPath,
7590
- prerequisites,
7591
- ...prerequisitesPath === void 0 ? {} : { prerequisitesPath }
7592
- };
7593
- }
7445
+ placedFields: async () => ({
7446
+ phase,
7447
+ ...parsed.prerequisitesPath === void 0 ? {} : { prerequisitesPath: parsed.prerequisitesPath }
7448
+ })
7594
7449
  });
7595
7450
  }
7596
7451
  case "collect-target": {
@@ -7777,8 +7632,6 @@ async function admitPublicRole(role, parsed, env, override) {
7777
7632
  targetObjectId: derived.targetObjectId,
7778
7633
  sourceObjectId: derived.sourceObjectId,
7779
7634
  materials: {
7780
- task: mergerMaterialFromUtf8(instruction),
7781
- authority: mergerMaterialFromUtf8(instruction),
7782
7635
  targetIntent: mergerMaterialFromUtf8(
7783
7636
  `Investigate primary sources for target parent ${targetLabel}. Do not invent intent.`
7784
7637
  ),
@@ -7790,7 +7643,7 @@ async function admitPublicRole(role, parsed, env, override) {
7790
7643
  resolutionScope: [...derived.resolutionScope],
7791
7644
  authorizedChecks: []
7792
7645
  });
7793
- const mergerInputPath = join11(placed.runDirectory, "merger-input.json");
7646
+ const mergerInputPath = join10(placed.runDirectory, "merger-input.json");
7794
7647
  await writeFile(
7795
7648
  mergerInputPath,
7796
7649
  `${JSON.stringify(mergerInput, null, 2)}
@@ -7928,51 +7781,50 @@ function admittedTransportPromptKind(admitted) {
7928
7781
  if (record !== void 0 && "transportPrompt" in record) return record.transportPrompt;
7929
7782
  return "instruction";
7930
7783
  }
7784
+ function appendCallerFileFlagPaths(body, attachments, requestManifestPath, prerequisitesPath) {
7785
+ const flaggedPaths = [
7786
+ ...attachments.map((attachment) => `--attach ${attachment.path}`),
7787
+ ...requestManifestPath === void 0 ? [] : [`--request-manifest ${requestManifestPath}`],
7788
+ ...prerequisitesPath === void 0 ? [] : [`--prerequisites ${prerequisitesPath}`]
7789
+ ];
7790
+ if (flaggedPaths.length === 0) return body;
7791
+ return [body, "", ...flaggedPaths].join("\n");
7792
+ }
7931
7793
  function buildInstructionTransportPrompt(admitted) {
7932
7794
  const kind = admittedTransportPromptKind(admitted);
7933
7795
  if (kind === "fixed-kickoff") {
7934
- if (admitted.sourceRunPath === void 0 || admitted.sourceRunPath.trim() === "") {
7935
- throw new Error("fixed-kickoff transport prompt is missing the source run pointer");
7936
- }
7937
- return admitted.sourceRunPath;
7796
+ return "";
7938
7797
  }
7939
7798
  if (kind === "baseline") {
7940
7799
  if (admitted.baseRevision === void 0) {
7941
7800
  throw new Error("baseline transport prompt is missing the bound revision");
7942
7801
  }
7943
- const lines2 = [admitted.baseRevision];
7802
+ const lines = [admitted.baseRevision];
7944
7803
  if (admitted.instruction.length > 0) {
7945
- lines2.push("", admitted.instruction);
7804
+ lines.push("", admitted.instruction);
7946
7805
  }
7947
- return lines2.join("\n");
7806
+ return lines.join("\n");
7948
7807
  }
7949
7808
  if (kind === "skill-args") {
7950
7809
  if (admitted.baseRevision === void 0 || admitted.lens === void 0 || admitted.authorityRefs === void 0) {
7951
7810
  throw new Error("skill-args transport prompt is missing frozen skill args");
7952
7811
  }
7953
- const lines2 = [buildReviewerSkillArgProjection({
7812
+ const lines = [buildReviewerSkillArgProjection({
7954
7813
  baseRevision: admitted.baseRevision,
7955
7814
  lens: admitted.lens,
7956
7815
  authorityRefs: admitted.authorityRefs
7957
7816
  })];
7958
7817
  if (admitted.instruction.length > 0) {
7959
- lines2.push("", admitted.instruction);
7960
- }
7961
- return lines2.join("\n");
7962
- }
7963
- const lines = [admitted.instruction];
7964
- const flaggedPaths = [
7965
- ...admitted.attachments.map((attachment) => `--attach ${attachment.path}`),
7966
- ...admitted.requestManifestPath === void 0 ? [] : [`--request-manifest ${admitted.requestManifestPath}`]
7967
- ];
7968
- if (flaggedPaths.length > 0) {
7969
- lines.push("");
7970
- lines.push("\u5DF2\u53D7\u7406\u9644\u4EF6\uFF1A");
7971
- for (const entry of flaggedPaths) {
7972
- lines.push(`- ${entry}`);
7818
+ lines.push("", admitted.instruction);
7973
7819
  }
7820
+ return lines.join("\n");
7974
7821
  }
7975
- return lines.join("\n");
7822
+ return appendCallerFileFlagPaths(
7823
+ admitted.instruction,
7824
+ admitted.attachments,
7825
+ admitted.requestManifestPath,
7826
+ admitted.prerequisitesPath
7827
+ );
7976
7828
  }
7977
7829
  async function materializeCountersignInvocation(admitted, options) {
7978
7830
  const placed = await placeRoleAdmission({
@@ -8082,7 +7934,7 @@ function parseDoctorIssueNumber(raw) {
8082
7934
  }
8083
7935
  async function resolveDoctorCaseRunsPath(options) {
8084
7936
  const ledgerHome = resolveActivationLedgerHome(options.home);
8085
- const defaultRuns = join11(
7937
+ const defaultRuns = join10(
8086
7938
  activationBookDirectory(ledgerHome, options.bookKey),
8087
7939
  String(options.issueNumber),
8088
7940
  "runs"
@@ -8363,7 +8215,6 @@ var init_invocation = __esm({
8363
8215
  init_doctor_evidence();
8364
8216
  init_collector_config();
8365
8217
  init_github_remote();
8366
- init_fixer_packet();
8367
8218
  init_merger_git_state();
8368
8219
  init_merger_contracts();
8369
8220
  init_sha256();
@@ -9727,7 +9578,7 @@ var init_settlement = __esm({
9727
9578
  });
9728
9579
 
9729
9580
  // src/session-identity.ts
9730
- import { dirname as dirname9, join as join12 } from "node:path";
9581
+ import { dirname as dirname9, join as join11 } from "node:path";
9731
9582
  function createSessionIdentityAuthority(authority, hostName) {
9732
9583
  const runDirectoryOf = (principal) => dirname9(authority.decode(principal).sessionDirectory);
9733
9584
  return {
@@ -9736,7 +9587,7 @@ function createSessionIdentityAuthority(authority, hostName) {
9736
9587
  },
9737
9588
  async load(principal) {
9738
9589
  const runDirectory = runDirectoryOf(principal);
9739
- const { records, diagnostics } = await readSitianRecords(join12(runDirectory, RUN_STATE_FILE));
9590
+ const { records, diagnostics } = await readSitianRecords(join11(runDirectory, RUN_STATE_FILE));
9740
9591
  if (diagnostics.length > 0) {
9741
9592
  throw new Error(
9742
9593
  `${RUN_STATE_FILE} has ${diagnostics.length} malformed row(s); refusing stale session binding: ${runDirectory}`
@@ -9806,12 +9657,12 @@ __export(role_turn_host_exports, {
9806
9657
  import { execFile as execFile2, spawn as spawn2 } from "node:child_process";
9807
9658
  import { constants } from "node:fs";
9808
9659
  import { access as access2, appendFile, realpath as realpath4 } from "node:fs/promises";
9809
- import { delimiter, dirname as dirname10, isAbsolute as isAbsolute6, join as join13, resolve as resolve11 } from "node:path";
9660
+ import { delimiter, dirname as dirname10, isAbsolute as isAbsolute6, join as join12, resolve as resolve11 } from "node:path";
9810
9661
  import { platform } from "node:process";
9811
9662
  import { promisify as promisify2 } from "node:util";
9812
9663
  import { randomUUID as randomUUID4 } from "node:crypto";
9813
9664
  function resolveInternalRoleEntrypoint(packageRoot) {
9814
- return join13(packageRoot, INTERNAL_ROLE_ENTRYPOINT_RELATIVE2);
9665
+ return join12(packageRoot, INTERNAL_ROLE_ENTRYPOINT_RELATIVE2);
9815
9666
  }
9816
9667
  function buildExplicitInternalActivationArgs(selectedRoleEntry, extraArgs = []) {
9817
9668
  return ["--no-extensions", "-e", selectedRoleEntry, ...extraArgs];
@@ -10052,6 +9903,11 @@ function createPiRoleTurnHost(config) {
10052
9903
  if (typeof process.env.AK_ROLE_AUDITOR_SUBJECT === "string" && process.env.AK_ROLE_AUDITOR_SUBJECT.trim() !== "") {
10053
9904
  env.AK_ROLE_AUDITOR_SUBJECT = process.env.AK_ROLE_AUDITOR_SUBJECT;
10054
9905
  }
9906
+ if (typeof request.navigatorWorkContextPath === "string" && request.navigatorWorkContextPath.trim() !== "") {
9907
+ env.AK_ROLE_NAVIGATOR_WORK_CONTEXT = request.navigatorWorkContextPath.trim();
9908
+ } else {
9909
+ delete env.AK_ROLE_NAVIGATOR_WORK_CONTEXT;
9910
+ }
10055
9911
  if (config.recordLaunchedRolePackageIdentity !== void 0 && config.observeLaunchedRolePackageIdentity !== void 0) {
10056
9912
  await config.recordLaunchedRolePackageIdentity(
10057
9913
  request.runDirectory,
@@ -10174,7 +10030,7 @@ var init_role_turn_host = __esm({
10174
10030
 
10175
10031
  // src/package-resources/engine-material.ts
10176
10032
  import { existsSync as existsSync4, readdirSync as readdirSync2, readFileSync as readFileSync2 } from "node:fs";
10177
- import { join as join14 } from "node:path";
10033
+ import { join as join13 } from "node:path";
10178
10034
  function pickEngineAxis(source) {
10179
10035
  return {
10180
10036
  ...source.engine === void 0 ? {} : { engine: source.engine },
@@ -10195,14 +10051,14 @@ function isEngineNameSyntax(name) {
10195
10051
  return true;
10196
10052
  }
10197
10053
  function resolveEngineMaterialDirectory(packageRoot) {
10198
- return join14(packageRoot, ENGINE_MATERIAL_RELATIVE_ROOT);
10054
+ return join13(packageRoot, ENGINE_MATERIAL_RELATIVE_ROOT);
10199
10055
  }
10200
10056
  function resolveEngineDispatchMaterialPath(packageRoot) {
10201
- return join14(packageRoot, ENGINE_DISPATCH_RELATIVE_PATH);
10057
+ return join13(packageRoot, ENGINE_DISPATCH_RELATIVE_PATH);
10202
10058
  }
10203
10059
  function resolveEngineMaterialPath(packageRoot, name) {
10204
10060
  const legal = assertLegalEngineName(name);
10205
- return join14(resolveEngineMaterialDirectory(packageRoot), `${legal}.md`);
10061
+ return join13(resolveEngineMaterialDirectory(packageRoot), `${legal}.md`);
10206
10062
  }
10207
10063
  function assertLegalEngineName(name) {
10208
10064
  if (!isEngineNameSyntax(name)) {
@@ -10301,7 +10157,7 @@ __export(config_exports, {
10301
10157
  validatePublicCliConfigAxes: () => validatePublicCliConfigAxes
10302
10158
  });
10303
10159
  import { mkdir, readFile as readFile8, writeFile as writeFile2 } from "node:fs/promises";
10304
- import { dirname as dirname11, join as join15 } from "node:path";
10160
+ import { dirname as dirname11, join as join14 } from "node:path";
10305
10161
  function isGateOfficerSeat(value) {
10306
10162
  return packagedProvinceConfig(value);
10307
10163
  }
@@ -10309,7 +10165,7 @@ function publicCliConfigPath(home) {
10309
10165
  if (typeof home !== "string" || home.trim() === "") {
10310
10166
  throw new Error("home must be explicitly provided");
10311
10167
  }
10312
- return join15(home, ".ak-roles", "public-cli.json");
10168
+ return join14(home, ".ak-roles", "public-cli.json");
10313
10169
  }
10314
10170
  async function loadPublicCliConfig(home) {
10315
10171
  const path = publicCliConfigPath(home);
@@ -10769,11 +10625,11 @@ function credentialProvidersFromAuthData(data) {
10769
10625
  };
10770
10626
  }
10771
10627
  function resolvePublicAgentDir(explicit, home) {
10772
- return explicit ?? process.env.PI_CODING_AGENT_DIR ?? join15(home, ".pi", "agent");
10628
+ return explicit ?? process.env.PI_CODING_AGENT_DIR ?? join14(home, ".pi", "agent");
10773
10629
  }
10774
10630
  async function loadCredentialProviders(agentDir) {
10775
10631
  try {
10776
- const raw = await readFile8(join15(agentDir, "auth.json"), "utf8");
10632
+ const raw = await readFile8(join14(agentDir, "auth.json"), "utf8");
10777
10633
  return credentialProvidersFromAuthData(JSON.parse(raw));
10778
10634
  } catch (error) {
10779
10635
  if (isEnoent(error)) return { "openai-codex": false, xai: false };
@@ -10798,15 +10654,15 @@ var init_config = __esm({
10798
10654
 
10799
10655
  // src/public-cli/host-providers.ts
10800
10656
  import { readFileSync as readFileSync3 } from "node:fs";
10801
- import { join as join16 } from "node:path";
10657
+ import { join as join15 } from "node:path";
10802
10658
  function hostProvidersPath(home) {
10803
10659
  if (typeof home !== "string" || home.trim() === "") {
10804
10660
  throw new Error("home must be explicitly provided");
10805
10661
  }
10806
- return join16(home, ".ak-roles", "host-providers.json");
10662
+ return join15(home, ".ak-roles", "host-providers.json");
10807
10663
  }
10808
10664
  function hermesProviderModelsCachePath(home) {
10809
- return join16(home, ".hermes", "provider_models_cache.json");
10665
+ return join15(home, ".hermes", "provider_models_cache.json");
10810
10666
  }
10811
10667
  function parseHostProvidersTable(value) {
10812
10668
  if (!isRecord(value)) {
@@ -10957,15 +10813,15 @@ var init_host_providers = __esm({
10957
10813
 
10958
10814
  // src/public-cli/load-production-acp-host.ts
10959
10815
  import { existsSync as existsSync5 } from "node:fs";
10960
- import { join as join17 } from "node:path";
10816
+ import { join as join16 } from "node:path";
10961
10817
  import { pathToFileURL } from "node:url";
10962
10818
  async function loadProductionAcpHostFactory(packageRoot, host) {
10963
10819
  const description = lookupHostDescription(host);
10964
10820
  if (description === void 0) {
10965
10821
  throw new Error(`unregistered host: ${host}`);
10966
10822
  }
10967
- const built = join17(packageRoot, "dist/acp-host/production-host.js");
10968
- const source = join17(packageRoot, "src/acp-host/production-host.ts");
10823
+ const built = join16(packageRoot, "dist/acp-host/production-host.js");
10824
+ const source = join16(packageRoot, "src/acp-host/production-host.ts");
10969
10825
  const target = existsSync5(built) ? built : source;
10970
10826
  const href = pathToFileURL(target).href;
10971
10827
  const mod = await import(href);
@@ -10981,15 +10837,15 @@ var init_load_production_acp_host = __esm({
10981
10837
 
10982
10838
  // src/public-cli/load-production-headless-host.ts
10983
10839
  import { existsSync as existsSync6 } from "node:fs";
10984
- import { join as join18 } from "node:path";
10840
+ import { join as join17 } from "node:path";
10985
10841
  import { pathToFileURL as pathToFileURL2 } from "node:url";
10986
10842
  async function loadProductionHeadlessHostFactory(packageRoot, host) {
10987
10843
  const description = lookupHeadlessHostDescription(host);
10988
10844
  if (description === void 0) {
10989
10845
  throw new Error(`unregistered headless host: ${host}`);
10990
10846
  }
10991
- const built = join18(packageRoot, "dist/headless-host/production-host.js");
10992
- const source = join18(packageRoot, "src/headless-host/production-host.ts");
10847
+ const built = join17(packageRoot, "dist/headless-host/production-host.js");
10848
+ const source = join17(packageRoot, "src/headless-host/production-host.ts");
10993
10849
  const target = existsSync6(built) ? built : source;
10994
10850
  const href = pathToFileURL2(target).href;
10995
10851
  const mod = await import(href);
@@ -11157,7 +11013,7 @@ var init_role_seat_runtime = __esm({
11157
11013
  });
11158
11014
 
11159
11015
  // src/archivist-record-pointer.ts
11160
- import { basename as basename8, join as join19 } from "node:path";
11016
+ import { basename as basename8, join as join18 } from "node:path";
11161
11017
  function bookDirectOfficerRunPointer(options) {
11162
11018
  const submissionToolCallId = options.submissionToolCallId?.trim() ?? "";
11163
11019
  const pointer = {
@@ -11206,7 +11062,7 @@ async function resolveOfficerPointer(raw, parentRunDirectory) {
11206
11062
  };
11207
11063
  }
11208
11064
  async function readBookedOfficerPointers(parentRunDirectory) {
11209
- const { records, diagnostics } = await readSitianRecords(join19(parentRunDirectory, RUN_HISTORY_FILE));
11065
+ const { records, diagnostics } = await readSitianRecords(join18(parentRunDirectory, RUN_HISTORY_FILE));
11210
11066
  if (diagnostics.length > 0) {
11211
11067
  throw new Error(
11212
11068
  `${RUN_HISTORY_FILE} has ${diagnostics.length} malformed row(s); officer pointers unreadable: ${parentRunDirectory}`
@@ -11270,7 +11126,7 @@ function createPiDoctorAuditor() {
11270
11126
  var init_doctor_auditor = __esm({
11271
11127
  "src/doctor-auditor.ts"() {
11272
11128
  "use strict";
11273
- init_auditor_dossier_tool();
11129
+ init_role_run_placement();
11274
11130
  init_compliance_transport();
11275
11131
  init_dossier_resolution();
11276
11132
  init_doctor_contracts();
@@ -11545,12 +11401,12 @@ var init_submission_gate = __esm({
11545
11401
  // src/session-opening-materials.ts
11546
11402
  import { existsSync as existsSync7 } from "node:fs";
11547
11403
  import { readFile as readFile9 } from "node:fs/promises";
11548
- import { dirname as dirname12, join as join20 } from "node:path";
11404
+ import { dirname as dirname12, join as join19 } from "node:path";
11549
11405
  import { fileURLToPath, pathToFileURL as pathToFileURL3 } from "node:url";
11550
11406
  function resolvePackageRootDir(moduleUrl = import.meta.url) {
11551
11407
  let dir = dirname12(fileURLToPath(moduleUrl));
11552
11408
  for (let i = 0; i < 8; i += 1) {
11553
- if (existsSync7(join20(dir, "package.json")) && existsSync7(join20(dir, "souls"))) {
11409
+ if (existsSync7(join19(dir, "package.json")) && existsSync7(join19(dir, "souls"))) {
11554
11410
  return dir;
11555
11411
  }
11556
11412
  const parent = dirname12(dir);
@@ -11695,16 +11551,16 @@ var init_auditor_soul = __esm({
11695
11551
  // src/public-cli/machine-method-skills.ts
11696
11552
  import { accessSync, constants as constants2, statSync as statSync5 } from "node:fs";
11697
11553
  import { lstat as lstat2, mkdir as mkdir2, symlink } from "node:fs/promises";
11698
- import { join as join22 } from "node:path";
11554
+ import { join as join21 } from "node:path";
11699
11555
  import { spawnSync as spawnSync2 } from "node:child_process";
11700
11556
  function skillRoot(home) {
11701
- return join22(home, ".agents/skills");
11557
+ return join21(home, ".agents/skills");
11702
11558
  }
11703
11559
  function installedMethodSkillPath(home, name) {
11704
11560
  return installedSkillPath(skillRoot(home), name);
11705
11561
  }
11706
11562
  function installedSkillPath(root, name) {
11707
- const path = join22(root, name, "SKILL.md");
11563
+ const path = join21(root, name, "SKILL.md");
11708
11564
  try {
11709
11565
  if (!statSync5(path).isFile()) return void 0;
11710
11566
  accessSync(path, constants2.R_OK);
@@ -11717,9 +11573,9 @@ function installedSkillPath(root, name) {
11717
11573
  }
11718
11574
  function linkedSkillRoot(home, host) {
11719
11575
  if (host === "claude" || host === "claude-code") {
11720
- return join22(process.env.CLAUDE_CONFIG_DIR?.trim() || join22(home, ".claude"), "skills");
11576
+ return join21(process.env.CLAUDE_CONFIG_DIR?.trim() || join21(home, ".claude"), "skills");
11721
11577
  }
11722
- if (host === "hermes") return join22(home, ".hermes/skills");
11578
+ if (host === "hermes") return join21(home, ".hermes/skills");
11723
11579
  return void 0;
11724
11580
  }
11725
11581
  async function occupied(path) {
@@ -11776,7 +11632,7 @@ async function runMachineSkillSetup(home, stdout) {
11776
11632
  const missingBySource = /* @__PURE__ */ new Map();
11777
11633
  let unsourced = false;
11778
11634
  for (const name of packagedMethodSkillNames()) {
11779
- const path = join22(canonical, name);
11635
+ const path = join21(canonical, name);
11780
11636
  if (await occupied(path)) {
11781
11637
  warnOccupied(path, stdout);
11782
11638
  continue;
@@ -11806,9 +11662,9 @@ async function runMachineSkillSetup(home, stdout) {
11806
11662
  throw error;
11807
11663
  }
11808
11664
  for (const name of packagedMethodSkillNames()) {
11809
- const target = join22(canonical, name);
11665
+ const target = join21(canonical, name);
11810
11666
  if (installedMethodSkillPath(home, name) === void 0) continue;
11811
- const link = join22(root, name);
11667
+ const link = join21(root, name);
11812
11668
  if (await occupied(link)) {
11813
11669
  warnOccupied(link, stdout);
11814
11670
  continue;
@@ -11867,7 +11723,8 @@ function projectRoleTurnRequest(admitted, roleDetails, options) {
11867
11723
  ...options.courtAttemptId === void 0 || options.courtAttemptId.length === 0 ? {} : { courtAttemptId: options.courtAttemptId },
11868
11724
  ...options.invocationScopeId === void 0 || options.invocationScopeId.length === 0 ? {} : { invocationScopeId: options.invocationScopeId },
11869
11725
  ...options.stationChild === void 0 ? {} : { stationChild: options.stationChild },
11870
- ...options.deliveryRequestLimit === void 0 ? {} : { deliveryRequestLimit: options.deliveryRequestLimit }
11726
+ ...options.deliveryRequestLimit === void 0 ? {} : { deliveryRequestLimit: options.deliveryRequestLimit },
11727
+ ...options.navigatorWorkContextPath === void 0 || options.navigatorWorkContextPath.trim() === "" ? {} : { navigatorWorkContextPath: options.navigatorWorkContextPath }
11871
11728
  };
11872
11729
  }
11873
11730
  function packagedSettleSkill(admitted) {
@@ -11894,11 +11751,6 @@ function activationForAdmitted(admitted) {
11894
11751
  const activation = { role: admitted.role };
11895
11752
  for (const spec of packagedRoleActivationFlags(admitted.role)) {
11896
11753
  let value = readAdmittedPath(admitted, spec.from ?? spec.field);
11897
- if (spec.fallback === "gate-pointer") {
11898
- const trimmed = typeof value === "string" ? value.trim() : "";
11899
- value = trimmed !== "" ? trimmed : parentRunPathFromGatePointerInstruction(admitted.instruction);
11900
- if (typeof value !== "string" || value === "") continue;
11901
- }
11902
11754
  if (value === void 0) continue;
11903
11755
  if (spec.text === true) {
11904
11756
  if (typeof value !== "number") continue;
@@ -11940,7 +11792,6 @@ var init_turn_request = __esm({
11940
11792
  init_engine_material();
11941
11793
  init_packaged_role_registry();
11942
11794
  init_machine_method_skills();
11943
- init_run_lifecycle();
11944
11795
  }
11945
11796
  });
11946
11797
 
@@ -12242,7 +12093,7 @@ function projectRelocatedTurnIdentity(request, result, admitted, relocation) {
12242
12093
  mutableRequest.principal = admitted.principal;
12243
12094
  const activation = mutableRequest.activation;
12244
12095
  if (isRecord(activation)) {
12245
- for (const field of ["taskPath", "packetPath", "prerequisitesPath", "inputPath"]) {
12096
+ for (const field of ["inputPath"]) {
12246
12097
  const record = activation;
12247
12098
  if (field in record) record[field] = rewrite(record[field]);
12248
12099
  }
@@ -12961,21 +12812,19 @@ async function dispatchPostAdmissionTurn(input) {
12961
12812
  }
12962
12813
  function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepared) {
12963
12814
  const officerDialogue = isStationChildOfficerDialogue(admitted.role, env);
12815
+ const fileFlags = summonsPrepared?.attachments ?? [];
12964
12816
  let prompt;
12965
12817
  if (request.message !== void 0) {
12966
12818
  if (summonsPrepared !== void 0) {
12967
- prompt = officerDialogue ? request.message : buildInstructionTransportPrompt({
12968
- instruction: request.message,
12969
- instructionEmpty: false,
12970
- attachments: summonsPrepared.attachments
12971
- });
12819
+ prompt = officerDialogue && fileFlags.length === 0 ? request.message : appendCallerFileFlagPaths(request.message, fileFlags);
12972
12820
  } else if (request.summons !== void 0) {
12973
12821
  prompt = request.message;
12974
12822
  } else {
12975
12823
  prompt = request.message;
12976
12824
  }
12977
12825
  } else if (summonsPrepared !== void 0) {
12978
- prompt = officerDialogue ? summonsPrepared.instruction : buildInstructionTransportPrompt(summonsPrepared);
12826
+ const body = summonsPrepared.instruction;
12827
+ prompt = officerDialogue && fileFlags.length === 0 ? body : appendCallerFileFlagPaths(body, fileFlags);
12979
12828
  } else if (request.summons !== void 0) {
12980
12829
  prompt = "";
12981
12830
  } else {
@@ -12991,7 +12840,8 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
12991
12840
  },
12992
12841
  ...env.stationChild === void 0 ? {} : { stationChild: env.stationChild },
12993
12842
  // #1132: one configured ceiling, already resolved by the caller (#422).
12994
- deliveryRequestLimit: deliveryLimitFromConfig(env.autoResumeLimit)
12843
+ deliveryRequestLimit: deliveryLimitFromConfig(env.autoResumeLimit),
12844
+ ...env.navigatorWorkContextPath === void 0 || env.navigatorWorkContextPath.trim() === "" ? {} : { navigatorWorkContextPath: env.navigatorWorkContextPath }
12995
12845
  };
12996
12846
  }
12997
12847
  function roleTurnOptions(env, admitted, continuation) {
@@ -13003,7 +12853,8 @@ function roleTurnOptions(env, admitted, continuation) {
13003
12853
  continuation,
13004
12854
  ...env.stationChild === void 0 ? {} : { stationChild: env.stationChild },
13005
12855
  // #1132: one configured ceiling, already resolved by the caller (#422).
13006
- deliveryRequestLimit: deliveryLimitFromConfig(env.autoResumeLimit)
12856
+ deliveryRequestLimit: deliveryLimitFromConfig(env.autoResumeLimit),
12857
+ ...env.navigatorWorkContextPath === void 0 || env.navigatorWorkContextPath.trim() === "" ? {} : { navigatorWorkContextPath: env.navigatorWorkContextPath }
13007
12858
  };
13008
12859
  }
13009
12860
  async function dispatchAfterWriterLease(input) {
@@ -13585,11 +13436,44 @@ function buildInstructionSeatTurnRequest(admitted, options) {
13585
13436
  options
13586
13437
  );
13587
13438
  }
13588
- function initialPrompt(admitted, env) {
13439
+ async function loadLedgerPeerBody(sourceRunDirectory, projectRoot, home) {
13440
+ const runId = runIdFromRunDirectory(sourceRunDirectory);
13441
+ if (runId === void 0) return void 0;
13442
+ const rows = await readRecordedSubmissionRows(projectRoot, runId, {
13443
+ home,
13444
+ sessionParent: sessionFileOf(sourceRunDirectory)
13445
+ });
13446
+ const latest = rows.at(-1);
13447
+ if (latest === void 0) return void 0;
13448
+ return readableGateItem(latest.accepted);
13449
+ }
13450
+ async function resolveReviewSeatDialogueBody(input) {
13451
+ const reask = input.reask;
13452
+ if (reask !== void 0 && reask.length > 0) return reask;
13453
+ const caller = input.callerInstruction ?? "";
13454
+ if (caller.length > 0) return caller;
13455
+ const sourceRunPath = input.sourceRunPath?.trim() ?? "";
13456
+ if (sourceRunPath === "") return void 0;
13457
+ return await loadLedgerPeerBody(sourceRunPath, input.projectRoot, input.home);
13458
+ }
13459
+ function admittedSourceRunPath(admitted) {
13460
+ return "sourceRunPath" in admitted && typeof admitted.sourceRunPath === "string" ? admitted.sourceRunPath.trim() : "";
13461
+ }
13462
+ async function resolveInitialPrompt(admitted, env) {
13589
13463
  const record = roleRecord(admitted.role);
13590
- const reask = env.reviewReask ?? env.gateReviewInstruction;
13591
- if (reask !== void 0 && "reaskPrompt" in record && record.reaskPrompt === true) {
13592
- return reask;
13464
+ if ("reaskPrompt" in record && record.reaskPrompt === true) {
13465
+ const sourceRunPath = admittedSourceRunPath(admitted);
13466
+ const reask = env.reviewReask ?? env.gateReviewInstruction;
13467
+ const body = await resolveReviewSeatDialogueBody({
13468
+ ...reask === void 0 ? {} : { reask },
13469
+ callerInstruction: admitted.instruction,
13470
+ ...sourceRunPath === "" ? {} : { sourceRunPath },
13471
+ projectRoot: admitted.projectRoot,
13472
+ home: env.home
13473
+ });
13474
+ if (body !== void 0) {
13475
+ return appendCallerFileFlagPaths(body, admitted.attachments);
13476
+ }
13593
13477
  }
13594
13478
  return buildInstructionTransportPrompt(admitted);
13595
13479
  }
@@ -13671,6 +13555,7 @@ async function dispatchAdmitted(admitted, env, io) {
13671
13555
  if (activeEnv.correlationId !== void 0 && activeEnv.correlationId.trim() !== "") {
13672
13556
  await recordAdmittedCorrelation(admitted, activeEnv.correlationId);
13673
13557
  }
13558
+ const initialPromptText = await resolveInitialPrompt(admitted, activeEnv);
13674
13559
  const auto = "inCallAutoResume" in record && record.inCallAutoResume === true;
13675
13560
  if (auto) {
13676
13561
  return await runPostAdmissionResumable({
@@ -13679,7 +13564,10 @@ async function dispatchAdmitted(admitted, env, io) {
13679
13564
  io: turnIo,
13680
13565
  buildInitialRequest: () => buildInstructionSeatTurnRequest(
13681
13566
  admitted,
13682
- roleTurnOptions(activeEnv, admitted, { kind: "initial", prompt: initialPrompt(admitted, activeEnv) })
13567
+ roleTurnOptions(activeEnv, admitted, {
13568
+ kind: "initial",
13569
+ prompt: initialPromptText
13570
+ })
13683
13571
  ),
13684
13572
  buildResumeRequest: () => buildInstructionSeatTurnRequest(
13685
13573
  admitted,
@@ -13698,7 +13586,10 @@ async function dispatchAdmitted(admitted, env, io) {
13698
13586
  io: turnIo,
13699
13587
  request: buildInstructionSeatTurnRequest(
13700
13588
  admitted,
13701
- roleTurnOptions(activeEnv, admitted, { kind: "initial", prompt: initialPrompt(admitted, activeEnv) })
13589
+ roleTurnOptions(activeEnv, admitted, {
13590
+ kind: "initial",
13591
+ prompt: initialPromptText
13592
+ })
13702
13593
  ),
13703
13594
  adapters,
13704
13595
  ...activeEnv.engine === void 0 ? {} : { effectiveEngine: activeEnv.engine }
@@ -13798,10 +13689,19 @@ function resumeSameParentInstructionSeat(input) {
13798
13689
  )
13799
13690
  });
13800
13691
  }
13801
- function sameParentInstruction(env, fallback) {
13802
- const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
13803
- if (resumeInstruction === void 0) return fallback;
13804
- return { instruction: resumeInstruction, instructionEmpty: false };
13692
+ async function sameParentDialogue(env, fallback, sourceRunPath, projectRoot) {
13693
+ const reask = env.reviewReask ?? env.gateReviewInstruction;
13694
+ const body = await resolveReviewSeatDialogueBody({
13695
+ ...reask === void 0 ? {} : { reask },
13696
+ callerInstruction: fallback.instruction,
13697
+ sourceRunPath,
13698
+ projectRoot,
13699
+ home: env.home
13700
+ });
13701
+ if (body !== void 0) {
13702
+ return { instruction: body, instructionEmpty: false };
13703
+ }
13704
+ return fallback;
13805
13705
  }
13806
13706
  async function runCountersignBody(parsed, env, io) {
13807
13707
  const gateParentRunPath = typeof env.parentRunPath === "string" && env.parentRunPath.trim() !== "" ? env.parentRunPath : void 0;
@@ -13817,7 +13717,10 @@ async function runCountersignBody(parsed, env, io) {
13817
13717
  summons: {
13818
13718
  sourceRunPath: gateParentRunPath,
13819
13719
  instruction: resumeInstruction,
13820
- instructionEmpty: resumeInstruction.length === 0
13720
+ instructionEmpty: resumeInstruction.length === 0,
13721
+ // #1166 J11: same-parent resume delivers this call's file-flag paths
13722
+ // through the shared summons → appendCallerFileFlagPaths rule.
13723
+ attachmentPaths: parsed.attachmentPaths ?? []
13821
13724
  }
13822
13725
  });
13823
13726
  if (resumed != null) return resumed;
@@ -13849,9 +13752,10 @@ async function runCountersignBody(parsed, env, io) {
13849
13752
  await persistAdmittedSourceRunPath(admitted, gateParentRunPath);
13850
13753
  admitted = { ...admitted, sourceRunPath: gateParentRunPath };
13851
13754
  }
13755
+ const reviewBody = env.reviewReask ?? env.gateReviewInstruction;
13852
13756
  const turnProjection = roleTurnOptions(env, admitted, {
13853
13757
  kind: "initial",
13854
- prompt: env.reviewReask ?? env.gateReviewInstruction ?? buildInstructionTransportPrompt(admitted)
13758
+ prompt: reviewBody !== void 0 ? appendCallerFileFlagPaths(reviewBody, admitted.attachments) : buildInstructionTransportPrompt(admitted)
13855
13759
  });
13856
13760
  const turnRequest = buildInstructionSeatTurnRequest(admitted, turnProjection);
13857
13761
  const result = await runPostAdmissionOneShot({
@@ -13934,10 +13838,15 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
13934
13838
  if (auditorSource === void 0) return { exitCode: 2 };
13935
13839
  const sourceDirectory = auditorSource;
13936
13840
  const summons = {
13937
- ...sameParentInstruction(env, {
13938
- instruction: parsed.instruction ?? "",
13939
- instructionEmpty: (parsed.instruction ?? "").length === 0
13940
- }),
13841
+ ...await sameParentDialogue(
13842
+ env,
13843
+ {
13844
+ instruction: parsed.instruction ?? "",
13845
+ instructionEmpty: (parsed.instruction ?? "").length === 0
13846
+ },
13847
+ sourceDirectory,
13848
+ projectRoot
13849
+ ),
13941
13850
  attachmentPaths: parsed.attachmentPaths ?? []
13942
13851
  };
13943
13852
  const resumed = await withAuditorSoulEnv({
@@ -13954,15 +13863,33 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
13954
13863
  });
13955
13864
  if (resumed != null) return resumed;
13956
13865
  }
13957
- if (record.sameParent === "gate-pointer") {
13958
- const parentRunPath = parentRunPathFromGatePointerInstruction(parsed.instruction ?? "");
13959
- if (parentRunPath !== void 0) {
13866
+ if (record.sameParent === "source-run") {
13867
+ if (parsed.sourceRun !== void 0) {
13868
+ let parentRunPath;
13869
+ try {
13870
+ parentRunPath = (await resolveNotarySourceRunLocator({
13871
+ projectRoot,
13872
+ sourceRun: parsed.sourceRun,
13873
+ home: env.home
13874
+ })).runDirectory;
13875
+ } catch (error) {
13876
+ if (error instanceof NotarySourceRunError) {
13877
+ presentStructuralRejection(new CliUsageError(error.message, { cause: error }), io);
13878
+ return { exitCode: 2 };
13879
+ }
13880
+ throw error;
13881
+ }
13960
13882
  const summons = {
13961
13883
  sourceRunPath: parentRunPath,
13962
- ...sameParentInstruction(env, {
13963
- instruction: parsed.instruction ?? "",
13964
- instructionEmpty: (parsed.instruction ?? "").length === 0
13965
- }),
13884
+ ...await sameParentDialogue(
13885
+ env,
13886
+ {
13887
+ instruction: parsed.instruction ?? "",
13888
+ instructionEmpty: (parsed.instruction ?? "").length === 0
13889
+ },
13890
+ parentRunPath,
13891
+ projectRoot
13892
+ ),
13966
13893
  attachmentPaths: parsed.attachmentPaths ?? []
13967
13894
  };
13968
13895
  const resumed = await resumeSameParentInstructionSeat({
@@ -13991,11 +13918,15 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
13991
13918
  }
13992
13919
  throw error;
13993
13920
  }
13994
- const resumeInstruction = env.reviewReask ?? env.gateReviewInstruction;
13995
13921
  const summons = {
13996
13922
  sourceRunPath: source.runDirectory,
13997
13923
  sourceRun: source,
13998
- ...resumeInstruction === void 0 ? {} : { instruction: resumeInstruction, instructionEmpty: false }
13924
+ ...await sameParentDialogue(
13925
+ env,
13926
+ { instruction: "", instructionEmpty: true },
13927
+ source.runDirectory,
13928
+ projectRoot
13929
+ )
13999
13930
  };
14000
13931
  resolvedNotarySource = source;
14001
13932
  const resumed = await resumeSameParentInstructionSeat({
@@ -14025,16 +13956,18 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
14025
13956
  if (rejected !== void 0) return rejected;
14026
13957
  throw error;
14027
13958
  }
14028
- if (record.sameParent === "gate-pointer") {
14029
- const parentRunPath = parentRunPathFromGatePointerInstruction(parsed.instruction ?? "");
14030
- if (parentRunPath !== void 0) {
14031
- await persistAdmittedSourceRunPath(admitted, parentRunPath);
14032
- const sourcePatch = { sourceRunPath: parentRunPath };
14033
- admitted = { ...admitted, ...sourcePatch };
14034
- }
13959
+ if (record.sameParent === "source-run" && parsed.sourceRun !== void 0) {
13960
+ const parentRunPath = (await resolveNotarySourceRunLocator({
13961
+ projectRoot,
13962
+ sourceRun: parsed.sourceRun,
13963
+ home: env.home
13964
+ })).runDirectory;
13965
+ await persistAdmittedSourceRunPath(admitted, parentRunPath);
13966
+ admitted = { ...admitted, sourceRunPath: parentRunPath };
14035
13967
  }
14036
13968
  if (record.sameParent === "subject-source" && auditorSource !== void 0) {
14037
13969
  await persistAdmittedSourceRunPath(admitted, auditorSource, auditorSubject);
13970
+ admitted = { ...admitted, sourceRunPath: auditorSource };
14038
13971
  }
14039
13972
  const runAdmitted = async () => {
14040
13973
  await markRunAdmitted(admitted, env.principalAuthority);
@@ -14363,13 +14296,7 @@ async function auditSubmittedRole(turn, env, io, resumedOfficer, passedReceipt)
14363
14296
  summonAuditor: async (subject, sourceRunDirectory, signal, reask, submission) => {
14364
14297
  const summoned = await summonPublicRole({
14365
14298
  role: "auditor",
14366
- argv: [
14367
- "--subject",
14368
- subject,
14369
- "--source-run",
14370
- sourceRunDirectory,
14371
- `${AUDITOR_DOSSIER_PROMPT}${sourceRunDirectory}`
14372
- ],
14299
+ argv: ["--subject", subject, "--source-run", sourceRunDirectory],
14373
14300
  cwd: admitted.projectRoot,
14374
14301
  home: env.home,
14375
14302
  packageRoot: env.packageRoot,
@@ -14529,7 +14456,6 @@ var init_instruction_seat_run = __esm({
14529
14456
  "src/public-cli/instruction-seat-run.ts"() {
14530
14457
  "use strict";
14531
14458
  init_role_run_placement();
14532
- init_compliance_transport();
14533
14459
  init_archivist_record_pointer();
14534
14460
  init_doctor_auditor();
14535
14461
  init_gatekeeper_role();
@@ -14639,10 +14565,10 @@ var init_analyst_book_key = __esm({
14639
14565
  // src/atomic-write.ts
14640
14566
  import { randomUUID as randomUUID6 } from "node:crypto";
14641
14567
  import { rename as rename2, rm, writeFile as writeFile3 } from "node:fs/promises";
14642
- import { dirname as dirname14, join as join23 } from "node:path";
14568
+ import { dirname as dirname14, join as join22 } from "node:path";
14643
14569
  async function writeFileAtomically(destination, contents, options) {
14644
14570
  const parent = dirname14(destination);
14645
- const temporary = join23(parent, `.atomic-write-${randomUUID6()}.tmp`);
14571
+ const temporary = join22(parent, `.atomic-write-${randomUUID6()}.tmp`);
14646
14572
  try {
14647
14573
  await writeFile3(temporary, contents, options);
14648
14574
  await rename2(temporary, destination);
@@ -14659,12 +14585,12 @@ var init_atomic_write = __esm({
14659
14585
 
14660
14586
  // src/analyst-index.ts
14661
14587
  import { open, readFile as readFile10, unlink } from "node:fs/promises";
14662
- import { dirname as dirname15, join as join24 } from "node:path";
14588
+ import { dirname as dirname15, join as join23 } from "node:path";
14663
14589
  import { setTimeout as sleep } from "node:timers/promises";
14664
14590
  async function withAnalystLibraryIndexLock(ledgerHome, fn) {
14665
14591
  const indexPath = analystLibraryIndexPath(ledgerHome);
14666
14592
  ensureRealDirectoryTree(ledgerHome, dirname15(indexPath));
14667
- const lockPath = join24(dirname15(indexPath), LIBRARY_INDEX_LOCK_NAME);
14593
+ const lockPath = join23(dirname15(indexPath), LIBRARY_INDEX_LOCK_NAME);
14668
14594
  assertLedgerFileInsideHome(lockPath, ledgerHome);
14669
14595
  const startedAt = Date.now();
14670
14596
  while (true) {
@@ -14691,7 +14617,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
14691
14617
  }
14692
14618
  }
14693
14619
  function analystLibraryIndexPath(ledgerHome) {
14694
- return join24(ledgerHome, "analyst", "library-index.json");
14620
+ return join23(ledgerHome, "analyst", "library-index.json");
14695
14621
  }
14696
14622
  function rowFromIssueMetricsPage(page) {
14697
14623
  return {
@@ -15237,7 +15163,7 @@ var init_analyst_gate_cycles_read = __esm({
15237
15163
 
15238
15164
  // src/analyst-ledger.ts
15239
15165
  import { readdir as readdir3 } from "node:fs/promises";
15240
- import { basename as basename10, join as join25 } from "node:path";
15166
+ import { basename as basename10, join as join24 } from "node:path";
15241
15167
  async function readExistingRunLifecycleState(runDirectory) {
15242
15168
  return (await readRoleRunIdentity(runDirectory))?.state;
15243
15169
  }
@@ -15257,7 +15183,7 @@ function ghostLeaseCheckFromAutopsy(autopsy) {
15257
15183
  }
15258
15184
  }
15259
15185
  async function classifyGhostCandidate(input) {
15260
- const autopsy = await autopsyWriterLock(join25(input.runDirectory, "writer.lock"));
15186
+ const autopsy = await autopsyWriterLock(join24(input.runDirectory, "writer.lock"));
15261
15187
  const leaseCheck = ghostLeaseCheckFromAutopsy(autopsy);
15262
15188
  if (leaseCheck === void 0) return { kind: "live" };
15263
15189
  return {
@@ -15547,7 +15473,7 @@ async function classifyScopedRun(input) {
15547
15473
  async function scanAnalystIssueRuns(input) {
15548
15474
  const ledgerHome = resolveActivationLedgerHome(input.home);
15549
15475
  const scopeTicketNumber = input.ticketNumber;
15550
- const booksRoot = join25(ledgerHome, "books");
15476
+ const booksRoot = join24(ledgerHome, "books");
15551
15477
  let wholeBook = false;
15552
15478
  let scopeRootIdentity;
15553
15479
  let bookNames;
@@ -15580,7 +15506,7 @@ async function scanAnalystIssueRuns(input) {
15580
15506
  const ghostLegs = [];
15581
15507
  const scopeConflicts = [];
15582
15508
  for (const book of bookNames) {
15583
- const bookDir = join25(booksRoot, book);
15509
+ const bookDir = join24(booksRoot, book);
15584
15510
  let runDirectories;
15585
15511
  try {
15586
15512
  runDirectories = await listBookRunDirectories(bookDir);
@@ -16326,7 +16252,7 @@ var init_analyst_metric_family = __esm({
16326
16252
  });
16327
16253
 
16328
16254
  // src/analyst-page.ts
16329
- import { dirname as dirname16, join as join26 } from "node:path";
16255
+ import { dirname as dirname16, join as join25 } from "node:path";
16330
16256
  function analystIssuePageKey(address) {
16331
16257
  const parts = ["book", address.bookKey];
16332
16258
  if (address.issueNumber !== void 0) {
@@ -16337,7 +16263,7 @@ function analystIssuePageKey(address) {
16337
16263
  return sha256Hex(parts.join("\0")).slice(0, 32);
16338
16264
  }
16339
16265
  function analystIssuePagePath(ledgerHome, address) {
16340
- return join26(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
16266
+ return join25(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
16341
16267
  }
16342
16268
  function analystIssuePageAddressFromPage(page) {
16343
16269
  return {
@@ -16574,7 +16500,7 @@ var init_analyst_model_groups = __esm({
16574
16500
 
16575
16501
  // src/analyst-entry.ts
16576
16502
  import { readFile as readFile12 } from "node:fs/promises";
16577
- import { Type as Type17 } from "typebox";
16503
+ import { Type as Type15 } from "typebox";
16578
16504
  function cachedPageMatchesRequestedScope(page, input) {
16579
16505
  if (page.bookKey !== input.bookKey) return false;
16580
16506
  const requestedTicket = input.ticketNumber ?? input.issueNumber;
@@ -16779,16 +16705,16 @@ var init_analyst_entry = __esm({
16779
16705
  }
16780
16706
  }
16781
16707
  };
16782
- analystSweepModeInputSchema = Type17.Object(
16708
+ analystSweepModeInputSchema = Type15.Object(
16783
16709
  {
16784
- mode: Type17.Literal("sweep"),
16785
- mergedPullRequests: Type17.Array(
16786
- Type17.Object(
16710
+ mode: Type15.Literal("sweep"),
16711
+ mergedPullRequests: Type15.Array(
16712
+ Type15.Object(
16787
16713
  {
16788
- projectRoot: Type17.String(),
16714
+ projectRoot: Type15.String(),
16789
16715
  /** 排除后改动行数 — omit or 0 → typed 空缺; finite ≥ 0 only. */
16790
- changedLines: Type17.Optional(
16791
- Type17.Number({ minimum: 0, maximum: Number.MAX_VALUE })
16716
+ changedLines: Type15.Optional(
16717
+ Type15.Number({ minimum: 0, maximum: Number.MAX_VALUE })
16792
16718
  )
16793
16719
  }
16794
16720
  )
@@ -16801,7 +16727,7 @@ var init_analyst_entry = __esm({
16801
16727
  // src/public-cli/analyst-run.ts
16802
16728
  import { readFile as readFile13 } from "node:fs/promises";
16803
16729
  import { isAbsolute as isAbsolute8, resolve as resolve13 } from "node:path";
16804
- import { Value as Value2 } from "typebox/value";
16730
+ import { Value } from "typebox/value";
16805
16731
  function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
16806
16732
  try {
16807
16733
  return resolveBookKeyFromGit(cwd);
@@ -16836,7 +16762,7 @@ async function buildAnalystIssueModeInputFromPublicArgv(parsed, _ledgerHome) {
16836
16762
  };
16837
16763
  }
16838
16764
  function parseAnalystSweepModeInputFromJsonValue(value) {
16839
- if (!Value2.Check(analystSweepModeInputSchema, value)) {
16765
+ if (!Value.Check(analystSweepModeInputSchema, value)) {
16840
16766
  throw new CliUsageError(
16841
16767
  "analyst sweep attachment must match AnalystSweepModeInput"
16842
16768
  );
@@ -17883,7 +17809,7 @@ __export(public_role_summons_exports, {
17883
17809
  import { execFile as execFile3 } from "node:child_process";
17884
17810
  import { existsSync as existsSync8 } from "node:fs";
17885
17811
  import { realpath as realpath6 } from "node:fs/promises";
17886
- import { join as join27 } from "node:path";
17812
+ import { join as join26 } from "node:path";
17887
17813
  import { promisify as promisify3 } from "node:util";
17888
17814
  function createCapturingIo() {
17889
17815
  const chunks = [];
@@ -17907,7 +17833,7 @@ function parentDir(path) {
17907
17833
  function walkPackageRoot(start) {
17908
17834
  let dir = start;
17909
17835
  for (let i = 0; i < 12; i += 1) {
17910
- if (existsSync8(join27(dir, "package.json")) && existsSync8(join27(dir, "souls"))) {
17836
+ if (existsSync8(join26(dir, "package.json")) && existsSync8(join26(dir, "souls"))) {
17911
17837
  return dir;
17912
17838
  }
17913
17839
  const parent = parentDir(dir);
@@ -18075,7 +18001,8 @@ async function summonPublicRole(options) {
18075
18001
  ...options.boundTicketNumber === void 0 ? {} : { boundTicketNumber: options.boundTicketNumber },
18076
18002
  ...options.parentRunPath === void 0 || options.parentRunPath.trim() === "" ? {} : { parentRunPath: options.parentRunPath },
18077
18003
  ...options.correlationId === void 0 || options.correlationId.trim() === "" ? {} : { correlationId: options.correlationId },
18078
- ...options.createRunId === void 0 ? {} : { createRunId: options.createRunId }
18004
+ ...options.createRunId === void 0 ? {} : { createRunId: options.createRunId },
18005
+ ...options.navigatorWorkContextPath === void 0 || options.navigatorWorkContextPath.trim() === "" ? {} : { navigatorWorkContextPath: options.navigatorWorkContextPath }
18079
18006
  }
18080
18007
  };
18081
18008
  } catch (error) {
@@ -18332,7 +18259,8 @@ async function summonGateOfficer(options) {
18332
18259
  "judge",
18333
18260
  "--source-run",
18334
18261
  options.sourceRunDirectory,
18335
- `\u5377\u5B97\u6307\u9488\uFF1A${options.sourceRunDirectory}`
18262
+ "--project",
18263
+ options.cwd
18336
18264
  ],
18337
18265
  ...common
18338
18266
  });
@@ -18360,7 +18288,7 @@ async function summonGateOfficer(options) {
18360
18288
  }
18361
18289
  return summonPublicRole({
18362
18290
  role: options.officer,
18363
- argv: [`\u5377\u5B97\u6307\u9488\uFF1A${options.sourceRunDirectory}`],
18291
+ argv: ["--source-run", options.sourceRunDirectory, "--project", options.cwd],
18364
18292
  ...common
18365
18293
  });
18366
18294
  }
@@ -18468,8 +18396,7 @@ async function runComplianceAudit(options) {
18468
18396
  "--subject",
18469
18397
  auditSubject,
18470
18398
  "--source-run",
18471
- sourceRunDirectory,
18472
- `${AUDITOR_DOSSIER_PROMPT}${sourceRunDirectory}`
18399
+ sourceRunDirectory
18473
18400
  ],
18474
18401
  cwd: options.context.cwd ?? process.cwd(),
18475
18402
  home,
@@ -18493,18 +18420,17 @@ async function runComplianceAudit(options) {
18493
18420
  return decision;
18494
18421
  }
18495
18422
  }
18496
- var AUDITOR_DOSSIER_PROMPT, AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE, ComplianceResponseRetentionError;
18423
+ var AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE, ComplianceResponseRetentionError;
18497
18424
  var init_compliance_transport = __esm({
18498
18425
  "src/compliance-transport.ts"() {
18499
18426
  "use strict";
18500
- init_auditor_dossier_tool();
18427
+ init_role_run_placement();
18501
18428
  init_gatekeeper_role();
18502
18429
  init_submission_errors();
18503
18430
  init_terminal();
18504
18431
  init_readable_gate_item();
18505
18432
  init_receipt_delivery_policy();
18506
18433
  init_unknown_value();
18507
- AUDITOR_DOSSIER_PROMPT = "\u5377\u5B97\u6307\u9488\uFF1A";
18508
18434
  AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE = "ak_auditor_parent_attempt_binding";
18509
18435
  ComplianceResponseRetentionError = class extends Error {
18510
18436
  constructor(message, options) {
@@ -18516,7 +18442,7 @@ var init_compliance_transport = __esm({
18516
18442
  });
18517
18443
 
18518
18444
  // src/role-run-relocation.ts
18519
- import { dirname as dirname17, join as join28, sep as sep4 } from "node:path";
18445
+ import { dirname as dirname17, join as join27, sep as sep4 } from "node:path";
18520
18446
  function rewriteRunDirectoryPathValue(value, oldRunDirectory, newRunDirectory) {
18521
18447
  if (typeof value !== "string") return value;
18522
18448
  if (value === oldRunDirectory) return newRunDirectory;
@@ -18620,10 +18546,9 @@ var init_role_run_relocation = __esm({
18620
18546
  // pre-#1161 pages only
18621
18547
  "sessionDirectory",
18622
18548
  "sessionFile",
18623
- "taskPath",
18624
- "packetPath",
18625
- "prerequisitesPath",
18626
- // #1165: requestManifestPath is a caller path — never rewrite.
18549
+ // #1165/#1168: caller file-flag paths (requestManifestPath, prerequisitesPath)
18550
+ // stay as given. Obsolete copy fields (taskPath/packetPath) are not rewritten —
18551
+ // stock volumes keep their bytes; live relocate no longer maintains them.
18627
18552
  "mergerInputPath",
18628
18553
  "sourceRunPath"
18629
18554
  ];
@@ -18635,7 +18560,6 @@ var init_role_run_relocation = __esm({
18635
18560
  var run_lifecycle_exports = {};
18636
18561
  __export(run_lifecycle_exports, {
18637
18562
  AUTO_RESUME_LIMIT: () => AUTO_RESUME_LIMIT,
18638
- GATE_DOSSIER_POINTER_PREFIX: () => GATE_DOSSIER_POINTER_PREFIX,
18639
18563
  RESUME_TRANSPORT_ENVELOPE: () => RESUME_TRANSPORT_ENVELOPE,
18640
18564
  RunWriterLeaseHeldError: () => RunWriterLeaseHeldError,
18641
18565
  acquireRunWriterLease: () => acquireRunWriterLease,
@@ -18649,7 +18573,6 @@ __export(run_lifecycle_exports, {
18649
18573
  markRunAdmitted: () => markRunAdmitted,
18650
18574
  markRunRunning: () => markRunRunning,
18651
18575
  markRunTerminal: () => markRunTerminal,
18652
- parentRunPathFromGatePointerInstruction: () => parentRunPathFromGatePointerInstruction,
18653
18576
  peekRoleRunRole: () => peekRoleRunRole,
18654
18577
  readCurrentCourt: () => readCurrentCourt,
18655
18578
  readRoleRunIdentity: () => readRoleRunIdentity,
@@ -18659,7 +18582,7 @@ __export(run_lifecycle_exports, {
18659
18582
  writeRoleRunState: () => writeRoleRunState
18660
18583
  });
18661
18584
  import { chmod, lstat as lstat3, open as open2, readdir as readdir4, readFile as readFile14, unlink as unlink2 } from "node:fs/promises";
18662
- import { basename as basename11, join as join29 } from "node:path";
18585
+ import { basename as basename11, join as join28 } from "node:path";
18663
18586
  function buildAutoResumeContinuationPrompt() {
18664
18587
  return RESUME_TRANSPORT_ENVELOPE;
18665
18588
  }
@@ -18956,7 +18879,7 @@ async function createWriterLease(lockPath, runDirectory, reportCleanupFailure) {
18956
18879
  },
18957
18880
  relocate(nextRunDirectory) {
18958
18881
  currentRunDirectory = nextRunDirectory;
18959
- currentLockPath = join29(nextRunDirectory, WRITER_LOCK_FILE);
18882
+ currentLockPath = join28(nextRunDirectory, WRITER_LOCK_FILE);
18960
18883
  },
18961
18884
  async release() {
18962
18885
  if (released) return;
@@ -18995,10 +18918,10 @@ async function acquireRunWriterLease(runDirectory, onCleanupFailure) {
18995
18918
  };
18996
18919
  const reportReadFailure = (error) => {
18997
18920
  reportDiagnostic(
18998
- `writer lease lock read failed (holder liveness unverifiable; lock left in place) at ${join29(runDirectory, WRITER_LOCK_FILE)}: ${describeErrorIdentity(error)}`
18921
+ `writer lease lock read failed (holder liveness unverifiable; lock left in place) at ${join28(runDirectory, WRITER_LOCK_FILE)}: ${describeErrorIdentity(error)}`
18999
18922
  );
19000
18923
  };
19001
- const lockPath = join29(runDirectory, WRITER_LOCK_FILE);
18924
+ const lockPath = join28(runDirectory, WRITER_LOCK_FILE);
19002
18925
  let lastAutopsy = { verdict: "absent" };
19003
18926
  let lastReclaimFailure;
19004
18927
  for (let reclaimsLeft = WRITER_LEASE_RECLAIM_ROUNDS; ; reclaimsLeft -= 1) {
@@ -19055,7 +18978,7 @@ async function acquireRunWriterLease(runDirectory, onCleanupFailure) {
19055
18978
  async function findRunDirectoryById(home, runId, onlyBookKey, onlyRole) {
19056
18979
  if (runId.trim() === "") return void 0;
19057
18980
  const ledgerHome = resolveActivationLedgerHome(home);
19058
- const booksRoot = join29(ledgerHome, "books");
18981
+ const booksRoot = join28(ledgerHome, "books");
19059
18982
  let bookKeys;
19060
18983
  try {
19061
18984
  bookKeys = await readdir4(booksRoot);
@@ -19069,20 +18992,12 @@ async function findRunDirectoryById(home, runId, onlyBookKey, onlyRole) {
19069
18992
  onlyRole
19070
18993
  );
19071
18994
  }
19072
- function parentRunPathFromGatePointerInstruction(instruction) {
19073
- if (!instruction.startsWith(GATE_DOSSIER_POINTER_PREFIX)) return void 0;
19074
- const path = instruction.slice(GATE_DOSSIER_POINTER_PREFIX.length).trim();
19075
- return path === "" ? void 0 : path;
19076
- }
19077
18995
  async function readRunParentPath(runDirectory) {
19078
18996
  const record = readPageSync(runDirectory, "admitted");
19079
18997
  if (record === void 0) return void 0;
19080
18998
  if (typeof record.sourceRunPath === "string" && record.sourceRunPath.trim() !== "") {
19081
18999
  return record.sourceRunPath;
19082
19000
  }
19083
- if (typeof record.instruction === "string") {
19084
- return parentRunPathFromGatePointerInstruction(record.instruction);
19085
- }
19086
19001
  return void 0;
19087
19002
  }
19088
19003
  async function runHasFormedSessionPrincipal(runDirectory) {
@@ -19106,7 +19021,7 @@ async function findLatestRunIdForSeatTicket(input) {
19106
19021
  let runDirectories;
19107
19022
  try {
19108
19023
  runDirectories = await listBookRunDirectories(
19109
- input.ticketNumber === void 0 ? bookDir : join29(bookDir, String(input.ticketNumber))
19024
+ input.ticketNumber === void 0 ? bookDir : join28(bookDir, String(input.ticketNumber))
19110
19025
  );
19111
19026
  } catch (error) {
19112
19027
  if (errorCodeOf(error) === "ENOENT") return void 0;
@@ -19156,10 +19071,7 @@ async function loadResumableRunRecord(home, runId, authority) {
19156
19071
  let instructionEmpty = true;
19157
19072
  let attachments = [];
19158
19073
  let phase;
19159
- let taskPath;
19160
- let packetPath;
19161
19074
  let prerequisitesPath;
19162
- let prerequisites;
19163
19075
  let baseRevision;
19164
19076
  let lens;
19165
19077
  let authorityRefs;
@@ -19198,18 +19110,9 @@ async function loadResumableRunRecord(home, runId, authority) {
19198
19110
  if (record.phase === "plan" || record.phase === "apply") {
19199
19111
  phase = record.phase;
19200
19112
  }
19201
- if (typeof record.taskPath === "string" && record.taskPath.trim() !== "") {
19202
- taskPath = record.taskPath;
19203
- }
19204
- if (typeof record.packetPath === "string" && record.packetPath.trim() !== "") {
19205
- packetPath = record.packetPath;
19206
- }
19207
- if (typeof record.prerequisitesPath === "string" && record.prerequisitesPath.trim() !== "") {
19113
+ if (typeof record.prerequisitesPath === "string") {
19208
19114
  prerequisitesPath = record.prerequisitesPath;
19209
19115
  }
19210
- if (Array.isArray(record.prerequisites)) {
19211
- prerequisites = record.prerequisites;
19212
- }
19213
19116
  if (typeof record.baseRevision === "string" && record.baseRevision.trim() !== "") {
19214
19117
  baseRevision = record.baseRevision;
19215
19118
  }
@@ -19346,10 +19249,7 @@ async function loadResumableRunRecord(home, runId, authority) {
19346
19249
  instructionEmpty,
19347
19250
  attachments,
19348
19251
  ...phase === void 0 ? {} : { phase },
19349
- ...taskPath === void 0 ? {} : { taskPath },
19350
- ...packetPath === void 0 ? {} : { packetPath },
19351
19252
  ...prerequisitesPath === void 0 ? {} : { prerequisitesPath },
19352
- ...prerequisites === void 0 ? {} : { prerequisites },
19353
19253
  ...baseRevision === void 0 ? {} : { baseRevision },
19354
19254
  ...lens === void 0 ? {} : { lens },
19355
19255
  ...authorityRefs === void 0 ? {} : { authorityRefs },
@@ -19434,12 +19334,6 @@ function admitResumedRole(loaded) {
19434
19334
  }
19435
19335
  case "worker-task": {
19436
19336
  const phase = resumedWorkerPhase(fields.phase ?? loaded.run.phase, record.phases, role, runId);
19437
- const taskPath = fields.taskPath;
19438
- if (taskPath === void 0) {
19439
- throw new CliUsageError(
19440
- `role run admitted coder task path is missing: ${runId}`
19441
- );
19442
- }
19443
19337
  if (fields.instruction.trim() === "") {
19444
19338
  throw new CliUsageError(
19445
19339
  `role run admitted coder task is blank: ${runId}`
@@ -19449,33 +19343,23 @@ function admitResumedRole(loaded) {
19449
19343
  role: "coder",
19450
19344
  phase,
19451
19345
  ...base,
19452
- instructionEmpty: false,
19453
- taskPath
19346
+ instructionEmpty: false
19454
19347
  };
19455
19348
  return admitted;
19456
19349
  }
19457
19350
  case "worker-packet": {
19458
19351
  const phase = resumedWorkerPhase(fields.phase ?? loaded.run.phase, record.phases, role, runId);
19459
- const packetPath = fields.packetPath;
19460
- if (packetPath === void 0) {
19461
- throw new CliUsageError(
19462
- `role run admitted fixer packet path is missing: ${runId}`
19463
- );
19464
- }
19465
19352
  if (fields.instruction.trim() === "") {
19466
19353
  throw new CliUsageError(
19467
19354
  `role run admitted fixer instruction is blank: ${runId}`
19468
19355
  );
19469
19356
  }
19470
- const prerequisites = fields.prerequisites ?? Object.freeze([]);
19471
19357
  const admitted = {
19472
19358
  role: "fixer",
19473
19359
  phase,
19474
19360
  ...base,
19475
19361
  instructionEmpty: false,
19476
- packetPath,
19477
- ...fields.prerequisitesPath === void 0 ? {} : { prerequisitesPath: fields.prerequisitesPath },
19478
- prerequisites
19362
+ ...fields.prerequisitesPath === void 0 ? {} : { prerequisitesPath: fields.prerequisitesPath }
19479
19363
  };
19480
19364
  return admitted;
19481
19365
  }
@@ -19619,7 +19503,7 @@ function resumedWorkerPhase(phase, phases, role, runId) {
19619
19503
  }
19620
19504
  throw new CliUsageError(`role run admitted ${role} phase is missing: ${runId}`);
19621
19505
  }
19622
- var AUTO_RESUME_LIMIT, RESUME_TRANSPORT_ENVELOPE, WRITER_LOCK_FILE, RunWriterLeaseHeldError, WRITER_LEASE_RECLAIM_ROUNDS, GATE_DOSSIER_POINTER_PREFIX;
19506
+ var AUTO_RESUME_LIMIT, RESUME_TRANSPORT_ENVELOPE, WRITER_LOCK_FILE, RunWriterLeaseHeldError, WRITER_LEASE_RECLAIM_ROUNDS;
19623
19507
  var init_run_lifecycle = __esm({
19624
19508
  "src/public-cli/run-lifecycle.ts"() {
19625
19509
  "use strict";
@@ -19652,7 +19536,6 @@ var init_run_lifecycle = __esm({
19652
19536
  }
19653
19537
  };
19654
19538
  WRITER_LEASE_RECLAIM_ROUNDS = 3;
19655
- GATE_DOSSIER_POINTER_PREFIX = "\u5377\u5B97\u6307\u9488\uFF1A";
19656
19539
  }
19657
19540
  });
19658
19541
 
@@ -19880,7 +19763,7 @@ var init_receipt_delivery_policy = __esm({
19880
19763
  });
19881
19764
 
19882
19765
  // src/archivist-record-topology.ts
19883
- import { join as join31 } from "node:path";
19766
+ import { join as join30 } from "node:path";
19884
19767
  function resolveNavigatorWorkSubjectPlacement(input) {
19885
19768
  let ledgerHome;
19886
19769
  if (input.parentSessionFile !== void 0 && input.parentSessionFile.length > 0) {
@@ -19893,7 +19776,7 @@ function resolveNavigatorWorkSubjectPlacement(input) {
19893
19776
  const digest = sha256Hex(input.subject).slice(0, 32);
19894
19777
  return {
19895
19778
  ledgerHome,
19896
- sessionDir: join31(
19779
+ sessionDir: join30(
19897
19780
  activationBookDirectory(ledgerHome, resolveBookKeyFromGit(input.cwd)),
19898
19781
  NAVIGATOR_RECORD_KIND,
19899
19782
  digest
@@ -19966,7 +19849,7 @@ import {
19966
19849
  statSync as statSync8,
19967
19850
  writeFileSync as writeFileSync3
19968
19851
  } from "node:fs";
19969
- import { dirname as dirname19, resolve as resolve16, join as join32 } from "node:path";
19852
+ import { dirname as dirname19, resolve as resolve16, join as join31 } from "node:path";
19970
19853
  import { StringDecoder } from "node:string_decoder";
19971
19854
  function readCurrentSession(sessionDir) {
19972
19855
  const ledger = currentSessionLedgerPath(sessionDir);
@@ -20000,7 +19883,7 @@ function isCurrentSessionClaimRace(error) {
20000
19883
  return errnoCode(error.cause) === "EEXIST";
20001
19884
  }
20002
19885
  function currentSessionLedgerPath(sessionDir) {
20003
- return join32(sessionDir, CURRENT_SESSION_LEDGER);
19886
+ return join31(sessionDir, CURRENT_SESSION_LEDGER);
20004
19887
  }
20005
19888
  function readBoundedSessionHeader(filePath) {
20006
19889
  const fd = openSync(filePath, "r");
@@ -20087,7 +19970,7 @@ function mostRecentNavigatorSessionFile(sessionDir, cwd) {
20087
19970
  const matched = [];
20088
19971
  for (const name of names) {
20089
19972
  if (!name.endsWith(".jsonl")) continue;
20090
- const filePath = join32(absoluteSessionDir, name);
19973
+ const filePath = join31(absoluteSessionDir, name);
20091
19974
  let st;
20092
19975
  try {
20093
19976
  st = statSync8(filePath);
@@ -20286,22 +20169,22 @@ init_submission_ledger();
20286
20169
  init_filed_submission();
20287
20170
  import { randomUUID as randomUUID7 } from "node:crypto";
20288
20171
  import { writeSync as writeSync2 } from "node:fs";
20289
- import { join as join34 } from "node:path";
20290
- import { Value as Value4 } from "typebox/value";
20172
+ import { join as join33 } from "node:path";
20173
+ import { Value as Value3 } from "typebox/value";
20291
20174
 
20292
20175
  // src/activation-trace.ts
20293
- import { Type as Type18 } from "typebox";
20294
- var causeSchema = Type18.Object({
20295
- identity: Type18.String({ minLength: 1 }),
20296
- name: Type18.String({ minLength: 1 }),
20297
- message: Type18.String(),
20298
- evidenceId: Type18.Optional(Type18.String({ minLength: 1 }))
20176
+ import { Type as Type16 } from "typebox";
20177
+ var causeSchema = Type16.Object({
20178
+ identity: Type16.String({ minLength: 1 }),
20179
+ name: Type16.String({ minLength: 1 }),
20180
+ message: Type16.String(),
20181
+ evidenceId: Type16.Optional(Type16.String({ minLength: 1 }))
20299
20182
  }, { additionalProperties: false });
20300
- var activationTraceRecordSchema = Type18.Object({
20301
- role: Type18.String({ minLength: 1 }),
20302
- stageId: Type18.String({ pattern: "^[a-z][a-z0-9-]*$" }),
20303
- status: Type18.Literal("failed"),
20304
- timestamp: Type18.String({ format: "date-time" }),
20183
+ var activationTraceRecordSchema = Type16.Object({
20184
+ role: Type16.String({ minLength: 1 }),
20185
+ stageId: Type16.String({ pattern: "^[a-z][a-z0-9-]*$" }),
20186
+ status: Type16.Literal("failed"),
20187
+ timestamp: Type16.String({ format: "date-time" }),
20305
20188
  cause: causeSchema
20306
20189
  }, { additionalProperties: false });
20307
20190
  var activationCauseEvidence = 0;
@@ -20466,10 +20349,10 @@ init_engine_material();
20466
20349
  init_engine_detour();
20467
20350
  init_engine_detour_usage();
20468
20351
  init_run_terminal_artifacts();
20469
- import { Type as Type19 } from "typebox";
20470
- var engineDetourArgsSchema = Type19.Object(
20352
+ import { Type as Type17 } from "typebox";
20353
+ var engineDetourArgsSchema = Type17.Object(
20471
20354
  {
20472
- argv: Type19.Array(Type19.String({ minLength: 1 }), {
20355
+ argv: Type17.Array(Type17.String({ minLength: 1 }), {
20473
20356
  minItems: 1,
20474
20357
  description: "\u9996\u9879\u4E3A PATH \u4E2D\u7684\u53EF\u6267\u884C\u6587\u4EF6\uFF0C\u5176\u4F59\u9879\u4E3A\u53C2\u6570\u3002"
20475
20358
  })
@@ -20790,6 +20673,24 @@ ${JSON.stringify(catalog)}
20790
20673
  init_filed_submission();
20791
20674
  init_role_submission_declarations();
20792
20675
  init_run_ticket_number();
20676
+
20677
+ // src/audited-run-identity.ts
20678
+ init_role_run_placement();
20679
+ import { basename as basename12 } from "node:path";
20680
+ var AUDITED_RUN_IDENTITY_KIND = "audited-run-identity";
20681
+ function auditedRunIdentityFromDirectory(runDirectory) {
20682
+ const parsed = parseRunLeaf(basename12(runDirectory));
20683
+ if (parsed === void 0) return void 0;
20684
+ return formatRunLeaf(parsed.runId, parsed.role);
20685
+ }
20686
+ function auditedRunIdentityMaterial(identity) {
20687
+ return { kind: AUDITED_RUN_IDENTITY_KIND, identity };
20688
+ }
20689
+ function auditedRunIdentityFromParts(runId, role) {
20690
+ return formatRunLeaf(runId, role);
20691
+ }
20692
+
20693
+ // src/notary-role.ts
20793
20694
  init_notary_contracts();
20794
20695
  function readNotaryTicketFlag(flag) {
20795
20696
  if (flag === void 0) return void 0;
@@ -20807,11 +20708,10 @@ function readNotaryTicketFlag(flag) {
20807
20708
  }
20808
20709
  return n;
20809
20710
  }
20810
- function projectNotarySessionBound(input) {
20811
- return {
20812
- sourceRun: input.sourceRun,
20813
- ...input.ticketNumber === void 0 ? {} : { ticketNumber: input.ticketNumber }
20814
- };
20711
+ function projectNotaryAuditedRunIdentity(input) {
20712
+ return auditedRunIdentityMaterial(
20713
+ auditedRunIdentityFromParts(input.sourceRun.runId, input.sourceRun.role)
20714
+ );
20815
20715
  }
20816
20716
  var NOTARY_SESSION_BOUND_ENTRY = "notary-session-bound";
20817
20717
  function projectNotaryBoundFromFlags(getFlag) {
@@ -20869,9 +20769,8 @@ function createNotaryRoleRuntime(pi, dependencies, host) {
20869
20769
  baseSystemPrompt: event.systemPrompt,
20870
20770
  soul: activation.soul
20871
20771
  }),
20872
- readingMaterial: projectNotarySessionBound({
20873
- sourceRun: activation.sourceRun,
20874
- ...activation.ticketNumber === void 0 ? {} : { ticketNumber: activation.ticketNumber }
20772
+ readingMaterial: projectNotaryAuditedRunIdentity({
20773
+ sourceRun: activation.sourceRun
20875
20774
  })
20876
20775
  };
20877
20776
  });
@@ -20956,17 +20855,17 @@ init_packaged_role_registry();
20956
20855
  init_activation_ledger_topology();
20957
20856
  import { resolve as resolve17 } from "node:path";
20958
20857
  import "@earendil-works/pi-coding-agent";
20959
- import { Type as Type21 } from "typebox";
20858
+ import { Type as Type19 } from "typebox";
20960
20859
 
20961
20860
  // src/navigator-public-session.ts
20962
20861
  init_host_session_record();
20963
20862
  import { existsSync as existsSync12 } from "node:fs";
20964
- import { basename as basename13 } from "node:path";
20863
+ import { basename as basename14 } from "node:path";
20965
20864
 
20966
20865
  // src/navigator-session-contracts.ts
20967
20866
  init_unknown_value();
20968
- import { Type as Type20 } from "typebox";
20969
- import { Value as Value3 } from "typebox/value";
20867
+ import { Type as Type18 } from "typebox";
20868
+ import { Value as Value2 } from "typebox/value";
20970
20869
  var NAVIGATOR_PREPARE_TOOL_NAME = "ak_navigator_prepare";
20971
20870
  var NAVIGATOR_UNAVAILABLE_KEYS = /* @__PURE__ */ new Set([
20972
20871
  "context",
@@ -21070,26 +20969,26 @@ function navigatorProviderFailureFromPublicTerminal(outcome) {
21070
20969
  if (typed !== void 0) return { source: typed, cause: typed };
21071
20970
  return { source: "unknown", cause: "unknown" };
21072
20971
  }
21073
- var navigatorProviderFailureSchema = Type20.Object({
21074
- source: Type20.Union([
21075
- Type20.Literal("context"),
21076
- Type20.Literal("session"),
21077
- Type20.Literal("model"),
21078
- Type20.Literal("thinking"),
21079
- Type20.Literal("auth"),
21080
- Type20.Literal("quota"),
21081
- Type20.Literal("transport"),
21082
- Type20.Literal("unknown")
20972
+ var navigatorProviderFailureSchema = Type18.Object({
20973
+ source: Type18.Union([
20974
+ Type18.Literal("context"),
20975
+ Type18.Literal("session"),
20976
+ Type18.Literal("model"),
20977
+ Type18.Literal("thinking"),
20978
+ Type18.Literal("auth"),
20979
+ Type18.Literal("quota"),
20980
+ Type18.Literal("transport"),
20981
+ Type18.Literal("unknown")
21083
20982
  ]),
21084
- cause: Type20.Union([
21085
- Type20.Literal("context"),
21086
- Type20.Literal("session"),
21087
- Type20.Literal("model"),
21088
- Type20.Literal("thinking"),
21089
- Type20.Literal("auth"),
21090
- Type20.Literal("quota"),
21091
- Type20.Literal("transport"),
21092
- Type20.Literal("unknown")
20983
+ cause: Type18.Union([
20984
+ Type18.Literal("context"),
20985
+ Type18.Literal("session"),
20986
+ Type18.Literal("model"),
20987
+ Type18.Literal("thinking"),
20988
+ Type18.Literal("auth"),
20989
+ Type18.Literal("quota"),
20990
+ Type18.Literal("transport"),
20991
+ Type18.Literal("unknown")
21093
20992
  ])
21094
20993
  }, { additionalProperties: false });
21095
20994
  function parseNavigatorModelSetting(value) {
@@ -21156,17 +21055,18 @@ init_atomic_write();
21156
21055
  init_unknown_value();
21157
21056
  import { existsSync as existsSync9, realpathSync as realpathSync3 } from "node:fs";
21158
21057
  import { readFile as readFile15 } from "node:fs/promises";
21159
- import { basename as basename12, dirname as dirname18, join as join30, resolve as resolve15 } from "node:path";
21058
+ import { basename as basename13, dirname as dirname18, join as join29, resolve as resolve15 } from "node:path";
21160
21059
  var NAVIGATOR_WORK_CONTEXT_BASENAME = "work-context.json";
21060
+ var AK_ROLE_NAVIGATOR_WORK_CONTEXT_ENV = "AK_ROLE_NAVIGATOR_WORK_CONTEXT";
21161
21061
  function navigatorWorkContextFile(sessionDir) {
21162
- return join30(sessionDir, NAVIGATOR_WORK_CONTEXT_BASENAME);
21062
+ return join29(sessionDir, NAVIGATOR_WORK_CONTEXT_BASENAME);
21163
21063
  }
21164
21064
  function isNavigatorWorkContextFile(path) {
21165
21065
  const resolved = resolve15(path);
21166
- if (basename12(resolved) !== NAVIGATOR_WORK_CONTEXT_BASENAME) return false;
21066
+ if (basename13(resolved) !== NAVIGATOR_WORK_CONTEXT_BASENAME) return false;
21167
21067
  const nest = dirname18(resolved);
21168
- if (!/^[0-9a-f]{32}$/.test(basename12(nest))) return false;
21169
- return basename12(dirname18(nest)) === "navigator";
21068
+ if (!/^[0-9a-f]{32}$/.test(basename13(nest))) return false;
21069
+ return basename13(dirname18(nest)) === "navigator";
21170
21070
  }
21171
21071
  function canonicalNavigatorWorkContextFile(path) {
21172
21072
  if (!isNavigatorWorkContextFile(path)) return void 0;
@@ -21214,33 +21114,8 @@ async function readNavigatorWorkBase(path) {
21214
21114
  if (record.authority.trim() === "") return void 0;
21215
21115
  return { subject: record.subject, authority: record.authority };
21216
21116
  }
21217
- function jsonObjectFromPrompt(prompt) {
21218
- const head = prompt.trimStart().split("\n\n", 1)[0] ?? "";
21219
- if (!head.startsWith("{")) return void 0;
21220
- try {
21221
- const parsed = JSON.parse(head);
21222
- if (!isRecord(parsed)) return void 0;
21223
- return parsed;
21224
- } catch {
21225
- return void 0;
21226
- }
21227
- }
21228
- function workContextPathFromPrompt(prompt) {
21229
- const record = jsonObjectFromPrompt(prompt);
21230
- const path = record?.workContextPath;
21231
- if (typeof path !== "string" || path.trim() === "") return void 0;
21232
- return isNavigatorWorkContextFile(path) ? path : void 0;
21233
- }
21234
- function attachWorkContextPointer(text, workContextPath) {
21235
- const record = jsonObjectFromPrompt(text);
21236
- if (record === void 0) return text;
21237
- if (typeof record.workContextPath === "string" && record.workContextPath.trim() !== "") return text;
21238
- const head = text.trimStart().split("\n\n", 1)[0] ?? "";
21239
- const rest = text.trimStart().slice(head.length);
21240
- return `${JSON.stringify({ ...record, workContextPath })}${rest}`;
21241
- }
21242
- async function loadNavigatorWorkBaseSuffix(prompt) {
21243
- const path = workContextPathFromPrompt(prompt);
21117
+ async function loadNavigatorWorkBaseSuffix(sessionDir, locatorPath) {
21118
+ const path = typeof locatorPath === "string" && locatorPath.trim() !== "" ? locatorPath.trim() : typeof process.env[AK_ROLE_NAVIGATOR_WORK_CONTEXT_ENV] === "string" && process.env[AK_ROLE_NAVIGATOR_WORK_CONTEXT_ENV].trim() !== "" ? process.env[AK_ROLE_NAVIGATOR_WORK_CONTEXT_ENV].trim() : sessionDir !== void 0 && sessionDir.trim() !== "" ? navigatorWorkContextFile(sessionDir) : void 0;
21244
21119
  if (path === void 0) return void 0;
21245
21120
  const body = await readNavigatorWorkBase(path);
21246
21121
  if (body === void 0) return void 0;
@@ -21271,7 +21146,7 @@ async function resolveNavigatorLedgerHome(context) {
21271
21146
  }
21272
21147
  var NAVIGATOR_HOST_RUN_POINTER_ENTRY = "ak-navigator-host-run";
21273
21148
  function runIdFromNavigatorDirectory(runDirectory) {
21274
- const parsed = parseRunLeaf(basename13(runDirectory));
21149
+ const parsed = parseRunLeaf(basename14(runDirectory));
21275
21150
  if (parsed === void 0 || parsed.role !== "navigator") return void 0;
21276
21151
  return parsed.runId;
21277
21152
  }
@@ -21333,13 +21208,14 @@ function createNativeNavigatorSessionFactory(deps) {
21333
21208
  if (disposed) return;
21334
21209
  const resumeRunId = hostRunId;
21335
21210
  const workContextPath = navigatorWorkContextFile(sessionManager.getSessionDir());
21336
- const argvText = existsSync12(workContextPath) ? attachWorkContextPointer(text, workContextPath) : text;
21211
+ const workContextLocator = existsSync12(workContextPath) ? workContextPath : void 0;
21337
21212
  const baseSummon = {
21338
21213
  role: "navigator",
21339
- argv: [argvText],
21214
+ argv: [text],
21340
21215
  cwd: context.cwd,
21341
21216
  ...summonHome === void 0 ? {} : { home: summonHome },
21342
- ...context.signal === void 0 ? {} : { signal: context.signal }
21217
+ ...context.signal === void 0 ? {} : { signal: context.signal },
21218
+ ...workContextLocator === void 0 ? {} : { navigatorWorkContextPath: workContextLocator }
21343
21219
  };
21344
21220
  const resumable = deps?.hostRunResumable ?? navigatorHostRunResumable;
21345
21221
  let summoned;
@@ -21467,8 +21343,8 @@ function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
21467
21343
  return void 0;
21468
21344
  }
21469
21345
  var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
21470
- var prepareSchema = Type21.Object({
21471
- prose: Type21.Optional(Type21.Unknown({
21346
+ var prepareSchema = Type19.Object({
21347
+ prose: Type19.Optional(Type19.Unknown({
21472
21348
  description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7ED3\u6784\u3002"
21473
21349
  }))
21474
21350
  }, { additionalProperties: true });
@@ -21901,6 +21777,7 @@ function createNavigatorAttendance(options) {
21901
21777
  }
21902
21778
 
21903
21779
  // src/role-runtime.ts
21780
+ init_auditor_soul();
21904
21781
  init_navigator_invocation_identity();
21905
21782
  init_settlement();
21906
21783
  init_packaged_role_registry();
@@ -21940,7 +21817,6 @@ init_worker_output();
21940
21817
  init_fixer_output();
21941
21818
  init_filed_submission();
21942
21819
  init_role_submission_declarations();
21943
- init_fixer_packet();
21944
21820
 
21945
21821
  // src/worker-submission-gates.ts
21946
21822
  init_archivist_record_entry();
@@ -22230,20 +22106,6 @@ function fixerBashSeatbeltDenyReason(matched) {
22230
22106
  init_unknown_value();
22231
22107
  init_worker_output();
22232
22108
  var FIXER_FLAG_DEFINITIONS = {
22233
- packet: {
22234
- name: "ak-fix-packet",
22235
- definition: {
22236
- description: "Path to opaque prose instructions for the Fixer",
22237
- type: "string"
22238
- }
22239
- },
22240
- prerequisites: {
22241
- name: "ak-fixer-prerequisites",
22242
- definition: {
22243
- description: "Optional path to a JSON array of typed Fixer prerequisites",
22244
- type: "string"
22245
- }
22246
- },
22247
22109
  phase: {
22248
22110
  name: "ak-fixer-phase",
22249
22111
  definition: {
@@ -22302,22 +22164,11 @@ function assertAcceptableThroughHost(submissionGate, status, details, hostAction
22302
22164
  }
22303
22165
  function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
22304
22166
  let soul;
22305
- let packet;
22306
- let packetPath;
22307
- let prerequisitesPath;
22308
22167
  let phase;
22309
22168
  let lifecycleRegistered = false;
22310
22169
  const submissionGate = createWorkerSubmissionGate({
22311
22170
  unfinishedReasonBounceLimit: options?.unfinishedReasonBounceLimit ?? deliveryLimitFromEnv(process.env)
22312
22171
  });
22313
- pi.registerFlag(
22314
- FIXER_FLAG_DEFINITIONS.packet.name,
22315
- FIXER_FLAG_DEFINITIONS.packet.definition
22316
- );
22317
- pi.registerFlag(
22318
- FIXER_FLAG_DEFINITIONS.prerequisites.name,
22319
- FIXER_FLAG_DEFINITIONS.prerequisites.definition
22320
- );
22321
22172
  pi.registerFlag(
22322
22173
  FIXER_FLAG_DEFINITIONS.phase.name,
22323
22174
  FIXER_FLAG_DEFINITIONS.phase.definition
@@ -22333,29 +22184,11 @@ function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
22333
22184
  );
22334
22185
  }
22335
22186
  phase = selectedPhase;
22336
- const resolvedPacketPath = pi.getFlag(FIXER_FLAG_DEFINITIONS.packet.name);
22337
- if (typeof resolvedPacketPath !== "string" || resolvedPacketPath.trim().length === 0) {
22338
- throw new Error("Fixer role requires --ak-fix-packet");
22339
- }
22340
- packetPath = resolvedPacketPath;
22341
- const instructions = await dependencies.loadPacket(packetPath);
22342
- if (instructions.trim().length === 0) {
22343
- throw new FixerPacketValidationError(
22344
- new Error("Fixer instructions must be nonblank")
22345
- );
22346
- }
22347
- const resolvedPrerequisitesPath = pi.getFlag(FIXER_FLAG_DEFINITIONS.prerequisites.name);
22348
- if (resolvedPrerequisitesPath !== void 0 && (typeof resolvedPrerequisitesPath !== "string" || resolvedPrerequisitesPath.trim().length === 0)) {
22349
- throw new Error("Fixer --ak-fixer-prerequisites path must be nonblank when supplied");
22350
- }
22351
- prerequisitesPath = typeof resolvedPrerequisitesPath === "string" ? resolvedPrerequisitesPath : void 0;
22352
- const prerequisites = prerequisitesPath !== void 0 ? parseFixerPrerequisites(await dependencies.loadPacket(prerequisitesPath)) : Object.freeze([]);
22353
- packet = Object.freeze({ instructions, prerequisites });
22354
22187
  if (!lifecycleRegistered) {
22355
22188
  lifecycleRegistered = true;
22356
22189
  registerWorkerSubmission(pi, "fixer", {
22357
- notReady: "\u4FEE\u5185\u53F8\u4FEE\u7406\u5305\u4E0E\u9636\u6BB5\u672A\u88C5\u8F7D",
22358
- ready: () => packet !== void 0 && phase !== void 0,
22190
+ notReady: "\u4FEE\u5185\u53F8\u9636\u6BB5\u672A\u88C5\u8F7D",
22191
+ ready: () => phase !== void 0,
22359
22192
  phase: () => phase,
22360
22193
  project: (parameters, current) => deepFreeze2(validateFixerOutput(parameters, current)),
22361
22194
  submissionGate,
@@ -22374,12 +22207,6 @@ function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
22374
22207
  });
22375
22208
  pi.on("before_agent_start", (event) => {
22376
22209
  if (soul === void 0) throw new Error("\u4FEE\u5185\u53F8\u804C\u5206\u672A\u88C5\u8F7D");
22377
- if (packetPath === void 0) throw new Error("\u4FEE\u5185\u53F8\u4FEE\u7406\u5305\u8DEF\u5F84\u672A\u88C5\u8F7D");
22378
- const prerequisitesBlock = prerequisitesPath === void 0 ? "" : `
22379
-
22380
- <fixer_prerequisites_path>
22381
- ${prerequisitesPath}
22382
- </fixer_prerequisites_path>`;
22383
22210
  return {
22384
22211
  systemPrompt: `${event.systemPrompt}
22385
22212
 
@@ -22389,11 +22216,7 @@ ${soul}
22389
22216
 
22390
22217
  <fixer_phase>
22391
22218
  ${phase ?? ""}
22392
- </fixer_phase>
22393
-
22394
- <fix_packet_path>
22395
- ${packetPath}
22396
- </fix_packet_path>${prerequisitesBlock}`
22219
+ </fixer_phase>`
22397
22220
  };
22398
22221
  });
22399
22222
  }
@@ -22405,22 +22228,17 @@ ${packetPath}
22405
22228
  }
22406
22229
  function createCoderRoleRuntime(pi, dependencies, hostActions, options) {
22407
22230
  let soul;
22408
- let task;
22409
22231
  let phase;
22410
22232
  let lifecycleRegistered = false;
22411
22233
  const submissionGate = createWorkerSubmissionGate({
22412
22234
  unfinishedReasonBounceLimit: options?.unfinishedReasonBounceLimit ?? deliveryLimitFromEnv(process.env)
22413
22235
  });
22414
- pi.registerFlag("ak-coder-task", {
22415
- description: "Markdown task assigned to the coder role",
22416
- type: "string"
22417
- });
22418
22236
  pi.registerFlag("ak-coder-phase", {
22419
22237
  description: "Coder phase: plan (inspect and propose an implementation plan; no edits or commits) or apply (execute the approved plan and verify the first implementation)",
22420
22238
  type: "string"
22421
22239
  });
22422
22240
  return {
22423
- async activate(ctx) {
22241
+ async activate() {
22424
22242
  soul = (await dependencies.loadSoul()).trim();
22425
22243
  if (soul.length === 0) throw new Error("Coder soul is empty");
22426
22244
  const selectedPhase = pi.getFlag("ak-coder-phase");
@@ -22430,23 +22248,17 @@ function createCoderRoleRuntime(pi, dependencies, hostActions, options) {
22430
22248
  );
22431
22249
  }
22432
22250
  phase = selectedPhase;
22433
- const taskPath = pi.getFlag("ak-coder-task");
22434
- if (typeof taskPath !== "string" || taskPath.trim().length === 0) {
22435
- throw new Error("Coder role requires --ak-coder-task");
22436
- }
22437
- task = (await dependencies.loadTask(taskPath)).trim();
22438
- if (task.length === 0) throw new Error("Coder task is empty");
22439
22251
  if (!lifecycleRegistered) {
22440
22252
  lifecycleRegistered = true;
22441
22253
  registerWorkerSubmission(pi, "coder", {
22442
- notReady: "\u5C06\u4F5C\u76D1\u4EFB\u52A1\u4E0E\u9636\u6BB5\u672A\u88C5\u8F7D",
22443
- ready: () => task !== void 0 && phase !== void 0,
22254
+ notReady: "\u5C06\u4F5C\u76D1\u9636\u6BB5\u672A\u88C5\u8F7D",
22255
+ ready: () => phase !== void 0,
22444
22256
  phase: () => phase,
22445
22257
  project: (parameters, current) => validateWorkerOutput(parameters, current, "Coder"),
22446
22258
  submissionGate,
22447
22259
  hostActions
22448
22260
  });
22449
- pi.on("before_agent_start", (event, ctx2) => {
22261
+ pi.on("before_agent_start", (event) => {
22450
22262
  if (soul === void 0) throw new Error("\u5C06\u4F5C\u76D1\u804C\u5206\u672A\u88C5\u8F7D");
22451
22263
  return {
22452
22264
  systemPrompt: `${event.systemPrompt}
@@ -22457,11 +22269,7 @@ ${soul}
22457
22269
 
22458
22270
  <coder_phase>
22459
22271
  ${phase ?? ""}
22460
- </coder_phase>
22461
-
22462
- <coder_task>
22463
- ${task ?? ""}
22464
- </coder_task>`
22272
+ </coder_phase>`
22465
22273
  };
22466
22274
  });
22467
22275
  }
@@ -22506,7 +22314,16 @@ function createMergerRoleRuntime(pi, dependencies) {
22506
22314
  });
22507
22315
  pi.on("before_agent_start", (event) => {
22508
22316
  if (!activation) throw new Error("\u6821\u4E66\u90CE\u672A\u6FC0\u6D3B");
22509
- const admitted = { attemptId: activation.input.attemptId, targetObjectId: activation.input.targetObjectId, sourceObjectId: activation.input.sourceObjectId, task: materialText(activation.input, "task"), authority: materialText(activation.input, "authority"), targetIntent: materialText(activation.input, "targetIntent"), sourceIntent: materialText(activation.input, "sourceIntent"), expectedConflictPaths: activation.input.expectedConflictPaths, resolutionScope: activation.input.resolutionScope, authorizedChecks: activation.input.authorizedChecks };
22317
+ const admitted = {
22318
+ attemptId: activation.input.attemptId,
22319
+ targetObjectId: activation.input.targetObjectId,
22320
+ sourceObjectId: activation.input.sourceObjectId,
22321
+ targetIntent: materialText(activation.input, "targetIntent"),
22322
+ sourceIntent: materialText(activation.input, "sourceIntent"),
22323
+ expectedConflictPaths: activation.input.expectedConflictPaths,
22324
+ resolutionScope: activation.input.resolutionScope,
22325
+ authorizedChecks: activation.input.authorizedChecks
22326
+ };
22510
22327
  return { systemPrompt: `${event.systemPrompt}
22511
22328
 
22512
22329
  <merger_soul>
@@ -22537,7 +22354,6 @@ init_doctor_evidence();
22537
22354
  init_judge_role();
22538
22355
  init_engine_detour();
22539
22356
  init_fixer_output();
22540
- init_fixer_packet();
22541
22357
  init_auditor_soul();
22542
22358
  init_judge_auditor();
22543
22359
  init_doctor_auditor();
@@ -22649,7 +22465,7 @@ function activationStage(role, activate) {
22649
22465
  };
22650
22466
  }
22651
22467
  function validateActivationTraceRecord(record) {
22652
- if (!Value4.Check(activationTraceRecordSchema, record)) {
22468
+ if (!Value3.Check(activationTraceRecordSchema, record)) {
22653
22469
  throw new TypeError("Activation trace record does not match its closed contract");
22654
22470
  }
22655
22471
  return record;
@@ -22851,7 +22667,7 @@ function createNavigatorRoleRuntime(roleHost, dependencies) {
22851
22667
  playbookBound = true;
22852
22668
  const loadRoutePlaybook = dependencies.loadRoutePlaybook ?? (() => readPackageMaterial("resources/navigator-route-playbook.md"));
22853
22669
  let playbookRead;
22854
- roleHost.on("before_agent_start", async (event) => {
22670
+ roleHost.on("before_agent_start", async (event, ctx) => {
22855
22671
  const basePrompt = typeof event.systemPrompt === "string" ? event.systemPrompt : "";
22856
22672
  const parts = [];
22857
22673
  try {
@@ -22866,8 +22682,10 @@ function createNavigatorRoleRuntime(roleHost, dependencies) {
22866
22682
  parts.push(message);
22867
22683
  }
22868
22684
  }
22869
- const prompt = typeof event.prompt === "string" ? event.prompt : "";
22870
- const work = await loadNavigatorWorkBaseSuffix(prompt);
22685
+ const work = await loadNavigatorWorkBaseSuffix(
22686
+ ctx.sessionManager?.getSessionDir?.(),
22687
+ ctx.navigatorWorkContextPath
22688
+ );
22871
22689
  if (work !== void 0 && work.trim() !== "") parts.push(work);
22872
22690
  if (parts.length === 0) return;
22873
22691
  const text = parts.join("\n\n");
@@ -22881,7 +22699,7 @@ ${text}`
22881
22699
  };
22882
22700
  }
22883
22701
  function createAuditorRoleRuntime(roleHost, dependencies) {
22884
- const base = createFiledOfficerRuntime(
22702
+ return createFiledOfficerRuntime(
22885
22703
  roleHost,
22886
22704
  {
22887
22705
  role: "auditor",
@@ -22890,17 +22708,27 @@ function createAuditorRoleRuntime(roleHost, dependencies) {
22890
22708
  },
22891
22709
  dependencies
22892
22710
  );
22893
- return {
22894
- async activate() {
22895
- await base.activate();
22896
- const { createAuditorDossierTool: createAuditorDossierTool2, AUDITOR_DOSSIER_TOOL_NAME: AUDITOR_DOSSIER_TOOL_NAME2 } = await Promise.resolve().then(() => (init_auditor_dossier_tool(), auditor_dossier_tool_exports));
22897
- const { AK_ROLE_AUDITOR_SOURCE_RUN_ENV: AK_ROLE_AUDITOR_SOURCE_RUN_ENV2 } = await Promise.resolve().then(() => (init_auditor_soul(), auditor_soul_exports));
22898
- const already = roleHost.getAllTools().some((tool) => tool.name === AUDITOR_DOSSIER_TOOL_NAME2);
22899
- if (already) return;
22900
- const sourceRun = typeof process.env[AK_ROLE_AUDITOR_SOURCE_RUN_ENV2] === "string" && process.env[AK_ROLE_AUDITOR_SOURCE_RUN_ENV2].trim() !== "" ? process.env[AK_ROLE_AUDITOR_SOURCE_RUN_ENV2].trim() : void 0;
22901
- roleHost.registerTool(createAuditorDossierTool2(sourceRun));
22711
+ }
22712
+ function isAuditedIdentitySeat(role) {
22713
+ return role === "notary" || role === "inspector" || role === "auditor" || role === "countersign";
22714
+ }
22715
+ function resolveAuditedSourceRunDirectory(roleHost, ctx, role) {
22716
+ const notary = roleHost.getFlag(NOTARY_SOURCE_RUN_FLAG.name);
22717
+ if (typeof notary === "string" && notary.trim() !== "") return notary.trim();
22718
+ const inspector = roleHost.getFlag(INSPECTOR_SOURCE_RUN_FLAG.name);
22719
+ if (typeof inspector === "string" && inspector.trim() !== "") return inspector.trim();
22720
+ const runDirectory = runDirectoryFromHostContext(ctx);
22721
+ if (runDirectory !== void 0) {
22722
+ const admitted = readPageSync(runDirectory, "admitted");
22723
+ if (typeof admitted?.sourceRunPath === "string" && admitted.sourceRunPath.trim() !== "") {
22724
+ return admitted.sourceRunPath.trim();
22902
22725
  }
22903
- };
22726
+ }
22727
+ if (role === "auditor") {
22728
+ const auditor = typeof process.env[AK_ROLE_AUDITOR_SOURCE_RUN_ENV] === "string" ? process.env[AK_ROLE_AUDITOR_SOURCE_RUN_ENV].trim() : "";
22729
+ if (auditor !== "") return auditor;
22730
+ }
22731
+ return void 0;
22904
22732
  }
22905
22733
  function readDiaristTicketAssertion(submitted) {
22906
22734
  if (submitted === void 0 || !("ticketNumber" in submitted)) {
@@ -22917,7 +22745,7 @@ function readRoleRunCoordinates(ctx, label) {
22917
22745
  if (runDirectory === void 0) throw new Error(`${label} requires AK_ROLE_RUN_DIR`);
22918
22746
  const admitted = readPageSync(runDirectory, "admitted");
22919
22747
  if (typeof admitted?.projectRoot !== "string" || admitted.projectRoot.trim() === "") {
22920
- throw new Error(`${label} state.jsonl admitted-request row missing projectRoot (${join34(runDirectory, RUN_STATE_FILE)})`);
22748
+ throw new Error(`${label} state.jsonl admitted-request row missing projectRoot (${join33(runDirectory, RUN_STATE_FILE)})`);
22921
22749
  }
22922
22750
  return {
22923
22751
  runDirectory,
@@ -23242,15 +23070,14 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23242
23070
  if (reading === void 0) return;
23243
23071
  return { readingMaterial: reading };
23244
23072
  });
23245
- roleHost.on("before_agent_start", () => {
23246
- const path = roleHost.getFlag(INSPECTOR_SOURCE_RUN_FLAG.name);
23247
- if (typeof path !== "string" || path.trim() === "") return;
23248
- return {
23249
- readingMaterial: {
23250
- kind: "inspector-parent-binding",
23251
- sourceRunPath: path
23252
- }
23253
- };
23073
+ roleHost.on("before_agent_start", (_event, ctx) => {
23074
+ const role = selectedRole ?? roleHost.getFlag(ROLE_FLAG.name);
23075
+ if (typeof role !== "string" || !isAuditedIdentitySeat(role) || role === "notary") return;
23076
+ const sourceDirectory = resolveAuditedSourceRunDirectory(roleHost, ctx, role);
23077
+ if (sourceDirectory === void 0) return;
23078
+ const identity = auditedRunIdentityFromDirectory(sourceDirectory);
23079
+ if (identity === void 0) return;
23080
+ return { readingMaterial: auditedRunIdentityMaterial(identity) };
23254
23081
  });
23255
23082
  roleHost.on("tool_result", async (event, ctx) => {
23256
23083
  const role = selectedRole;
@@ -23432,13 +23259,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23432
23259
  const fixer = createFixerRoleRuntime(
23433
23260
  roleHost,
23434
23261
  {
23435
- loadSoul: () => requireRoleSoul("fixer"),
23436
- async loadPacket(path) {
23437
- if (dependencies.loadFixPacket === void 0) {
23438
- throw new Error("Fixer packet loader is not configured");
23439
- }
23440
- return dependencies.loadFixPacket(path);
23441
- }
23262
+ loadSoul: () => requireRoleSoul("fixer")
23442
23263
  },
23443
23264
  hostActions,
23444
23265
  { unfinishedReasonBounceLimit: deliveryLimit }
@@ -23446,13 +23267,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23446
23267
  const coder = createCoderRoleRuntime(
23447
23268
  roleHost,
23448
23269
  {
23449
- loadSoul: () => requireRoleSoul("coder"),
23450
- async loadTask(path) {
23451
- if (dependencies.loadCoderTask === void 0) {
23452
- throw new Error("Coder task loader is not configured");
23453
- }
23454
- return dependencies.loadCoderTask(path);
23455
- }
23270
+ loadSoul: () => requireRoleSoul("coder")
23456
23271
  },
23457
23272
  hostActions,
23458
23273
  { unfinishedReasonBounceLimit: deliveryLimit }
@@ -23842,6 +23657,7 @@ async function prepareRoleEnvelope(options) {
23842
23657
  ...request.courtAttemptId === void 0 ? {} : { courtAttemptId: request.courtAttemptId },
23843
23658
  ...request.invocationScopeId === void 0 ? {} : { invocationScopeId: request.invocationScopeId },
23844
23659
  ...request.host === void 0 || request.host.trim() === "" ? {} : { host: request.host.trim() },
23660
+ ...request.navigatorWorkContextPath === void 0 || request.navigatorWorkContextPath.trim() === "" ? {} : { navigatorWorkContextPath: request.navigatorWorkContextPath },
23845
23661
  sessionManager: {
23846
23662
  getLeafEntry: () => sessionEntries.at(-1),
23847
23663
  getLeafId: () => runId,
@@ -24440,8 +24256,6 @@ function createRoleRuntimeDependencies(packageRoot) {
24440
24256
  packageRoot,
24441
24257
  loadRoleReferenceMaterials: loadPackagedRoleReferenceMaterials,
24442
24258
  loadRoleSoul: loadRegisteredRoleSoul,
24443
- loadFixPacket: (path) => readFile17(path, "utf8"),
24444
- loadCoderTask: (path) => readFile17(path, "utf8"),
24445
24259
  loadDoctorCase,
24446
24260
  loadNotarySourceRun: loadNotarySourceRunLocator,
24447
24261
  loadMergerInput: async (path) => JSON.parse(await readFile17(path, "utf8")),
@@ -25098,12 +24912,12 @@ function createAcpRoleTurnHost(config) {
25098
24912
  // src/acp-host/seat-profile-soul.ts
25099
24913
  import { constants as constants3 } from "node:fs";
25100
24914
  import { access as access3, copyFile, lstat as lstat4, mkdir as mkdir4, readlink, symlink as symlink2, unlink as unlink3 } from "node:fs/promises";
25101
- import { dirname as dirname22, join as join35, relative as relative3, resolve as resolve20 } from "node:path";
24915
+ import { dirname as dirname22, join as join34, relative as relative3, resolve as resolve20 } from "node:path";
25102
24916
  function seatProfileName(spec, role) {
25103
24917
  return `${spec.namePrefix}${role}`;
25104
24918
  }
25105
24919
  function packageRoleSoulPath(packageRoot, role) {
25106
- return join35(packageRoot, "souls", `${role}.md`);
24920
+ return join34(packageRoot, "souls", `${role}.md`);
25107
24921
  }
25108
24922
  async function pathExists2(path) {
25109
24923
  try {
@@ -25120,16 +24934,16 @@ async function ensureSeatProfileSoul(options) {
25120
24934
  if (!await pathExists2(soulTarget)) {
25121
24935
  throw new Error(`packaged role soul missing: ${soulTarget}`);
25122
24936
  }
25123
- const profilesRoot = join35(operatorHome, ...spec.profilesRootFromHome);
25124
- const profileDir = join35(profilesRoot, profileName);
24937
+ const profilesRoot = join34(operatorHome, ...spec.profilesRootFromHome);
24938
+ const profileDir = join34(profilesRoot, profileName);
25125
24939
  const hostRoot = dirname22(profilesRoot);
25126
- const soulPath = join35(profileDir, spec.soulFileName);
24940
+ const soulPath = join34(profileDir, spec.soulFileName);
25127
24941
  if (!await pathExists2(profileDir)) {
25128
24942
  await mkdir4(profileDir, { recursive: true });
25129
24943
  for (const name of ["auth.json", ".env", "config.yaml"]) {
25130
- const source = join35(hostRoot, name);
24944
+ const source = join34(hostRoot, name);
25131
24945
  if (!await pathExists2(source)) continue;
25132
- await copyFile(source, join35(profileDir, name));
24946
+ await copyFile(source, join34(profileDir, name));
25133
24947
  }
25134
24948
  } else {
25135
24949
  await mkdir4(profileDir, { recursive: true });