@akagilnc/pi-workflow-roles 0.1.5583 → 0.1.5598

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 (41) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +2 -0
  3. package/dist/acp-host/production-host.js +393 -854
  4. package/dist/collector-config.js +0 -44
  5. package/dist/headless-host/production-host.js +361 -822
  6. package/dist/merger-contracts.js +6 -2
  7. package/dist/migrate-book-topology.js +4855 -10472
  8. package/dist/package-contracts/worker-output.js +1 -6
  9. package/dist/packaged-role-registry.js +5 -4
  10. package/dist/public-cli/instruction-seat-run.js +8 -8
  11. package/dist/public-cli/invocation.js +93 -236
  12. package/dist/public-cli/main.js +18409 -18786
  13. package/dist/public-cli/option-definitions.js +7 -7
  14. package/dist/public-cli/post-admission.js +11 -40
  15. package/dist/public-cli/run-lifecycle.js +11 -43
  16. package/dist/public-role-summons.js +1 -1
  17. package/dist/role-run-relocation.js +14 -23
  18. package/package.json +1 -1
  19. package/scripts/build-package.mjs +0 -1
  20. package/src/collector-config.ts +0 -42
  21. package/src/collector-role.ts +10 -20
  22. package/src/host-contracts.ts +0 -3
  23. package/src/merger-contracts.ts +6 -2
  24. package/src/merger-role.ts +11 -1
  25. package/src/navigator-attendance.ts +2 -2
  26. package/src/package-contracts/worker-output.ts +0 -8
  27. package/src/packaged-role-registry.ts +4 -3
  28. package/src/public-cli/instruction-seat-run.ts +7 -8
  29. package/src/public-cli/invocation.ts +113 -351
  30. package/src/public-cli/option-definitions.ts +7 -7
  31. package/src/public-cli/post-admission.ts +12 -56
  32. package/src/public-cli/run-lifecycle.ts +11 -55
  33. package/src/public-role-summons.ts +1 -1
  34. package/src/role-run-placement.ts +0 -1
  35. package/src/role-run-relocation.ts +14 -25
  36. package/src/role-runtime-dependencies.ts +0 -2
  37. package/src/role-runtime.ts +0 -16
  38. package/src/worker-role.ts +11 -78
  39. package/dist/package-contracts/fixer-packet.js +0 -77
  40. package/packets/fixer-prerequisites.json +0 -6
  41. package/src/package-contracts/fixer-packet.ts +0 -91
@@ -733,85 +733,8 @@ var init_fixer_output = __esm({
733
733
  }
734
734
  });
735
735
 
736
- // src/package-contracts/fixer-packet.ts
737
- import { Type as Type8 } from "typebox";
738
- import { Value } from "typebox/value";
739
- function causeMessage(cause) {
740
- if (cause instanceof Error) return cause.message;
741
- if (typeof cause === "string") return cause;
742
- try {
743
- return JSON.stringify(cause) ?? String(cause);
744
- } catch {
745
- return String(cause);
746
- }
747
- }
748
- function fail(cause) {
749
- throw new FixerPacketValidationError(cause);
750
- }
751
- function parseFailure(value) {
752
- if (!Array.isArray(value)) fail(new Error("Fixer prerequisites must be a JSON array"));
753
- for (const entry of value) {
754
- if (!isRecord(entry)) {
755
- fail(new Error("Fixer prerequisite entry must be an object with id and requirement fields"));
756
- }
757
- if (typeof entry.id !== "string" || !new RegExp(FIXER_PREREQUISITE_ID_PATTERN).test(entry.id)) {
758
- fail(new Error(`Fixer prerequisite id violates pattern ${FIXER_PREREQUISITE_ID_PATTERN}`));
759
- }
760
- if (typeof entry.requirement !== "string" || !/\S/.test(entry.requirement)) {
761
- fail(new Error("Fixer prerequisite requirement must be nonblank"));
762
- }
763
- }
764
- fail(new Error("Fixer prerequisites violate the attachment schema"));
765
- }
766
- function validateFixerPrerequisites(value) {
767
- if (!Value.Check(fixerPrerequisitesSchema, value)) parseFailure(value);
768
- const entries = value;
769
- const ids = /* @__PURE__ */ new Set();
770
- const prerequisites = entries.map((entry) => {
771
- if (ids.has(entry.id)) {
772
- fail(new Error(`Fixer prerequisites contain duplicate id: ${entry.id}`));
773
- }
774
- ids.add(entry.id);
775
- return Object.freeze({ id: entry.id, requirement: entry.requirement });
776
- });
777
- return Object.freeze(prerequisites);
778
- }
779
- function parseFixerPrerequisites(source) {
780
- let decoded;
781
- try {
782
- decoded = JSON.parse(source);
783
- } catch (error) {
784
- fail(error);
785
- }
786
- return validateFixerPrerequisites(decoded);
787
- }
788
- var FIXER_PREREQUISITE_ID_PATTERN, fixerPrerequisiteSchema, fixerPrerequisitesSchema, FixerPacketValidationError;
789
- var init_fixer_packet = __esm({
790
- "src/package-contracts/fixer-packet.ts"() {
791
- "use strict";
792
- init_unknown_value();
793
- FIXER_PREREQUISITE_ID_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._-]*$";
794
- fixerPrerequisiteSchema = Type8.Object({
795
- id: Type8.String({ pattern: FIXER_PREREQUISITE_ID_PATTERN }),
796
- requirement: Type8.String({ pattern: "\\S" })
797
- });
798
- fixerPrerequisitesSchema = Type8.Array(fixerPrerequisiteSchema);
799
- FixerPacketValidationError = class extends Error {
800
- code = "AK_INVALID_FIX_PACKET";
801
- constructor(cause) {
802
- const prefix = "Fixer prerequisites or instructions violate the invocation contract";
803
- super(
804
- cause === void 0 ? prefix : `${prefix}: ${causeMessage(cause)}`,
805
- cause === void 0 ? void 0 : { cause }
806
- );
807
- this.name = "FixerPacketValidationError";
808
- }
809
- };
810
- }
811
- });
812
-
813
736
  // src/package-contracts/worker-output.ts
814
- import { Type as Type9 } from "typebox";
737
+ import { Type as Type8 } from "typebox";
815
738
  function validateAcceptedCoderDetails(output) {
816
739
  return output;
817
740
  }
@@ -824,15 +747,14 @@ var init_worker_output = __esm({
824
747
  "use strict";
825
748
  init_open_tool_schema();
826
749
  init_fixer_output();
827
- init_fixer_packet();
828
750
  init_terminating_infrastructure();
829
751
  CODER_OUTPUT_TOOL_NAME = "ak_coder_output";
830
752
  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}`;
831
- coderOutputObject = Type9.Object({
832
- status: Type9.Unknown({ description: CODER_STATUS_DESCRIPTION }),
833
- report: Type9.Unknown({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
834
- remainingScope: Type9.Unknown({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }),
835
- reason: Type9.Unknown({
753
+ coderOutputObject = Type8.Object({
754
+ status: Type8.Unknown({ description: CODER_STATUS_DESCRIPTION }),
755
+ report: Type8.Unknown({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
756
+ remainingScope: Type8.Unknown({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }),
757
+ reason: Type8.Unknown({
836
758
  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"
837
759
  })
838
760
  });
@@ -850,7 +772,7 @@ var init_canonical_json = __esm({
850
772
  });
851
773
 
852
774
  // src/doctor-contracts.ts
853
- import { Type as Type10 } from "typebox";
775
+ import { Type as Type9 } from "typebox";
854
776
  function validateDoctorSubmissionShape(value) {
855
777
  return value;
856
778
  }
@@ -876,25 +798,25 @@ var init_doctor_contracts = __esm({
876
798
  biteNone = "noRealBite";
877
799
  DOCTOR_BITE_KINDS = [biteActual, biteNone];
878
800
  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";
879
- doctorSubmissionObject = Type10.Object({
880
- status: Type10.Unknown({ description: DOCTOR_STATUS_DESCRIPTION }),
881
- case: Type10.Unknown({
801
+ doctorSubmissionObject = Type9.Object({
802
+ status: Type9.Unknown({ description: DOCTOR_STATUS_DESCRIPTION }),
803
+ case: Type9.Unknown({
882
804
  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"
883
805
  }),
884
- findings: Type10.Unknown({
806
+ findings: Type9.Unknown({
885
807
  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`
886
808
  }),
887
- reason: Type10.Unknown({
809
+ reason: Type9.Unknown({
888
810
  description: "\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u8BC1\u8BCD\u7684\u539F\u56E0\uFF1B\u4EC5 refused \u65F6\u7528\u3002"
889
811
  }),
890
- missingEvidence: Type10.Unknown({
812
+ missingEvidence: Type9.Unknown({
891
813
  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"
892
814
  })
893
815
  });
894
816
  doctorSubmissionSchema = withTerminatingOutputDeclarations(
895
817
  openToolObject(doctorSubmissionObject)
896
818
  );
897
- 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 });
819
+ 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 });
898
820
  DoctorEvidenceStore = class {
899
821
  constructor(patient) {
900
822
  this.patient = patient;
@@ -963,8 +885,8 @@ var init_exact_utf8 = __esm({
963
885
  });
964
886
 
965
887
  // src/merger-contracts.ts
966
- import { Type as Type11 } from "typebox";
967
- function fail2(message = "Merger input violates its exact contract") {
888
+ import { Type as Type10 } from "typebox";
889
+ function fail(message = "Merger input violates its exact contract") {
968
890
  throw new MergerInputContractError(message);
969
891
  }
970
892
  function deepFreeze(value) {
@@ -975,14 +897,17 @@ function deepFreeze(value) {
975
897
  return value;
976
898
  }
977
899
  function readMaterial(value, label) {
978
- if (!isRecord(value) || typeof value.bytesBase64 !== "string") fail2(`Merger ${label} material is malformed`);
900
+ if (!isRecord(value) || typeof value.bytesBase64 !== "string") fail(`Merger ${label} material is malformed`);
979
901
  exactUtf8(Buffer.from(value.bytesBase64, "base64"), `Merger ${label} material`);
980
902
  return { bytesBase64: value.bytesBase64, sha256: typeof value.sha256 === "string" ? value.sha256 : "" };
981
903
  }
982
904
  function validateMergerInput(value) {
983
- if (!isRecord(value) || blank(value.attemptId)) fail2("Merger input requires a non-empty attemptId for accounting");
984
- if (!isRecord(value.materials)) fail2("Merger materials are missing");
985
- 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") };
905
+ if (!isRecord(value) || blank(value.attemptId)) fail("Merger input requires a non-empty attemptId for accounting");
906
+ if (!isRecord(value.materials)) fail("Merger materials are missing");
907
+ const materials = {
908
+ targetIntent: readMaterial(value.materials.targetIntent, "targetIntent"),
909
+ sourceIntent: readMaterial(value.materials.sourceIntent, "sourceIntent")
910
+ };
986
911
  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) : [];
987
912
  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 }));
988
913
  }
@@ -994,24 +919,25 @@ var init_merger_contracts = __esm({
994
919
  init_open_tool_schema();
995
920
  init_terminating_infrastructure();
996
921
  init_unknown_value();
997
- materialSchema = Type11.Object({ bytesBase64: Type11.String(), sha256: Type11.String() });
998
- checkSchema = Type11.Object({ name: Type11.String({ minLength: 1 }), argv: Type11.Array(Type11.String({ minLength: 1 }), { minItems: 1 }) });
999
- mergerInputSchema = Type11.Object({
1000
- attemptId: Type11.String({ minLength: 1, description: "\u5BF9\u8D26 attempt \u8EAB\u4EFD\uFF08transport\uFF09" }),
1001
- targetObjectId: Type11.String({ description: "\u6750\u6599\uFF1Atarget parent OID\uFF1B\u53EF\u7A7A" }),
1002
- sourceObjectId: Type11.String({ description: "\u6750\u6599\uFF1Asource parent OID\uFF1B\u53EF\u7A7A" }),
1003
- materials: Type11.Object({ task: materialSchema, authority: materialSchema, targetIntent: materialSchema, sourceIntent: materialSchema }),
1004
- expectedConflictPaths: Type11.Array(Type11.String(), { description: "\u6750\u6599\uFF1A\u5F53\u524D\u672A\u5408\u5E76\u8DEF\u5F84\uFF1B\u53EF\u7A7A" }),
1005
- resolutionScope: Type11.Array(Type11.String(), { description: "\u6750\u6599\uFF1A\u89E3\u6790\u8303\u56F4\u63D0\u793A\uFF1B\u53EF\u7A7A" }),
1006
- authorizedChecks: Type11.Array(checkSchema)
922
+ materialSchema = Type10.Object({ bytesBase64: Type10.String(), sha256: Type10.String() });
923
+ checkSchema = Type10.Object({ name: Type10.String({ minLength: 1 }), argv: Type10.Array(Type10.String({ minLength: 1 }), { minItems: 1 }) });
924
+ mergerInputSchema = Type10.Object({
925
+ attemptId: Type10.String({ minLength: 1, description: "\u5BF9\u8D26 attempt \u8EAB\u4EFD\uFF08transport\uFF09" }),
926
+ targetObjectId: Type10.String({ description: "\u6750\u6599\uFF1Atarget parent OID\uFF1B\u53EF\u7A7A" }),
927
+ sourceObjectId: Type10.String({ description: "\u6750\u6599\uFF1Asource parent OID\uFF1B\u53EF\u7A7A" }),
928
+ // #1168: task/authority dispatch copies removed; git-fact intents remain.
929
+ materials: Type10.Object({ targetIntent: materialSchema, sourceIntent: materialSchema }),
930
+ expectedConflictPaths: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u5F53\u524D\u672A\u5408\u5E76\u8DEF\u5F84\uFF1B\u53EF\u7A7A" }),
931
+ resolutionScope: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u89E3\u6790\u8303\u56F4\u63D0\u793A\uFF1B\u53EF\u7A7A" }),
932
+ authorizedChecks: Type10.Array(checkSchema)
1007
933
  });
1008
934
  MERGER_STATUS_DESCRIPTION = "completed | escalate";
1009
- mergerOutputObject = Type11.Object({
1010
- status: Type11.Unknown({ description: MERGER_STATUS_DESCRIPTION }),
1011
- attemptId: Type11.Unknown({ description: "\u5DF2\u53D7\u7406\u5408\u5E76 attempt \u8EAB\u4EFD" }),
1012
- report: Type11.Unknown({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
1013
- mergeCommitId: Type11.Unknown({ description: "\u5B8C\u6210\u5408\u5E76 commit object ID" }),
1014
- diagnosis: Type11.Unknown({
935
+ mergerOutputObject = Type10.Object({
936
+ status: Type10.Unknown({ description: MERGER_STATUS_DESCRIPTION }),
937
+ attemptId: Type10.Unknown({ description: "\u5DF2\u53D7\u7406\u5408\u5E76 attempt \u8EAB\u4EFD" }),
938
+ report: Type10.Unknown({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
939
+ mergeCommitId: Type10.Unknown({ description: "\u5B8C\u6210\u5408\u5E76 commit object ID" }),
940
+ diagnosis: Type10.Unknown({
1015
941
  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"
1016
942
  })
1017
943
  });
@@ -1066,7 +992,7 @@ var init_countersign_contracts = __esm({
1066
992
  });
1067
993
 
1068
994
  // src/gleaner-left-contracts.ts
1069
- import { Type as Type12 } from "typebox";
995
+ import { Type as Type11 } from "typebox";
1070
996
  var GLEANER_LEFT_OUTPUT_TOOL_NAME, gleanerLeftOutputSchema, GLEANER_LEFT_BASE_FLAG;
1071
997
  var init_gleaner_left_contracts = __esm({
1072
998
  "src/gleaner-left-contracts.ts"() {
@@ -1077,11 +1003,11 @@ var init_gleaner_left_contracts = __esm({
1077
1003
  GLEANER_LEFT_OUTPUT_TOOL_NAME = "ak_gleaner_left_output";
1078
1004
  gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
1079
1005
  openToolObject(
1080
- Type12.Object({
1081
- status: Type12.Unknown({
1006
+ Type11.Object({
1007
+ status: Type11.Unknown({
1082
1008
  description: "completed"
1083
1009
  }),
1084
- findings: Type12.Unknown({
1010
+ findings: Type11.Unknown({
1085
1011
  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"
1086
1012
  })
1087
1013
  })
@@ -1925,7 +1851,7 @@ var init_ticket_provenance_contracts = __esm({
1925
1851
  });
1926
1852
 
1927
1853
  // src/diarist-contracts.ts
1928
- import { Type as Type13 } from "typebox";
1854
+ import { Type as Type12 } from "typebox";
1929
1855
  function projectDiaristSessions(value) {
1930
1856
  const raw = value?.sessions;
1931
1857
  if (raw === void 0) return [];
@@ -1958,20 +1884,20 @@ var init_diarist_contracts = __esm({
1958
1884
  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";
1959
1885
  diaristOutputSchema = withTerminatingOutputDeclarations(
1960
1886
  openToolObject(
1961
- Type13.Object({
1962
- status: Type13.Unknown({
1887
+ Type12.Object({
1888
+ status: Type12.Unknown({
1963
1889
  description: "completed | escalate"
1964
1890
  }),
1965
- ticketNumber: Type13.Optional(
1966
- Type13.Unknown({
1891
+ ticketNumber: Type12.Optional(
1892
+ Type12.Unknown({
1967
1893
  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"
1968
1894
  })
1969
1895
  ),
1970
- reason: Type13.Unknown({
1896
+ reason: Type12.Unknown({
1971
1897
  description: "status \u4E3A escalate \u65F6\uFF1A\u8BA4\u4E0D\u51FA\u672C\u5EAD\u5BF9\u8C61\u7684\u539F\u56E0"
1972
1898
  }),
1973
- sessions: Type13.Optional(Type13.Unknown({ description: DIARIST_SESSIONS_DESCRIPTION })),
1974
- ticketSessions: Type13.Unknown({
1899
+ sessions: Type12.Optional(Type12.Unknown({ description: DIARIST_SESSIONS_DESCRIPTION })),
1900
+ ticketSessions: Type12.Unknown({
1975
1901
  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`
1976
1902
  })
1977
1903
  })
@@ -1981,7 +1907,7 @@ var init_diarist_contracts = __esm({
1981
1907
  });
1982
1908
 
1983
1909
  // src/secretariat-contracts.ts
1984
- import { Type as Type14 } from "typebox";
1910
+ import { Type as Type13 } from "typebox";
1985
1911
  var SECRETARIAT_OUTPUT_TOOL_NAME, secretariatVerdictSchema, SECRETARIAT_GATE_OFFICER_ENTRY_TYPE, SECRETARIAT_COUNTERSIGN_TERMINAL_FACT_KEY;
1986
1912
  var init_secretariat_contracts = __esm({
1987
1913
  "src/secretariat-contracts.ts"() {
@@ -1989,17 +1915,17 @@ var init_secretariat_contracts = __esm({
1989
1915
  init_terminating_infrastructure();
1990
1916
  SECRETARIAT_OUTPUT_TOOL_NAME = "ak_secretariat_output";
1991
1917
  secretariatVerdictSchema = withTerminatingOutputDeclarations(
1992
- Type14.Object(
1918
+ Type13.Object(
1993
1919
  {
1994
- secretariatStatus: Type14.Unknown({
1920
+ secretariatStatus: Type13.Unknown({
1995
1921
  description: "converged | escalate"
1996
1922
  }),
1997
- ticketNumber: Type14.Optional(
1998
- Type14.Unknown({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
1923
+ ticketNumber: Type13.Optional(
1924
+ Type13.Unknown({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
1999
1925
  ),
2000
- note: Type14.Unknown({ description: "\u9644\u6CE8" }),
2001
- evidence: Type14.Optional(Type14.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
2002
- decisionGate: Type14.Unknown({
1926
+ note: Type13.Unknown({ description: "\u9644\u6CE8" }),
1927
+ evidence: Type13.Optional(Type13.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
1928
+ decisionGate: Type13.Unknown({
2003
1929
  description: "\u9700\u965B\u4E0B\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879\uFF1B\u53EF\u5199 question \u4E0E options\uFF0C\u539F\u6837\u7559\u5B58\u3002"
2004
1930
  })
2005
1931
  },
@@ -2307,10 +2233,10 @@ var init_packaged_role_registry = __esm({
2307
2233
  reportPhase: true
2308
2234
  },
2309
2235
  boardPlacement: "marshal",
2236
+ /** #1168: dispatch is first message; navigator reads admitted instruction. */
2237
+ navigatorSubject: "public-instruction",
2310
2238
  activationFlags: [
2311
- { field: "packetPath", flag: "ak-fix-packet", binds: "input" },
2312
- { field: "phase", flag: "ak-fixer-phase", binds: "phase" },
2313
- { field: "prerequisitesPath", flag: "ak-fixer-prerequisites" }
2239
+ { field: "phase", flag: "ak-fixer-phase", binds: "phase" }
2314
2240
  ],
2315
2241
  activationStage: "load-and-install",
2316
2242
  sessionMaterials: [
@@ -2337,8 +2263,9 @@ var init_packaged_role_registry = __esm({
2337
2263
  artifactFace: {
2338
2264
  reportPhase: true
2339
2265
  },
2266
+ /** #1168: dispatch is first message; navigator reads admitted instruction. */
2267
+ navigatorSubject: "public-instruction",
2340
2268
  activationFlags: [
2341
- { field: "taskPath", flag: "ak-coder-task", binds: "input" },
2342
2269
  { field: "phase", flag: "ak-coder-phase", binds: "phase" }
2343
2270
  ],
2344
2271
  activationStage: "load-and-install",
@@ -4436,8 +4363,7 @@ var init_durable_principal = __esm({
4436
4363
  });
4437
4364
 
4438
4365
  // src/collector-config.ts
4439
- import { readFile as readFile6 } from "node:fs/promises";
4440
- function fail3(message, cause) {
4366
+ function fail2(message, cause) {
4441
4367
  throw new Error(message, cause === void 0 ? void 0 : { cause });
4442
4368
  }
4443
4369
  function conservativeAscii(input) {
@@ -4448,63 +4374,26 @@ function conservativeAscii(input) {
4448
4374
  return true;
4449
4375
  }
4450
4376
  function parseCollectorRepository(raw) {
4451
- if (typeof raw !== "string" || raw.trim() !== raw || raw.length === 0) fail3("Collector repository must be a string owner/repo");
4452
- if (!conservativeAscii(raw) || raw.includes("://") || /[?#@%\\ ]/.test(raw)) fail3("Collector repository rejects URL syntax and non-identity bytes");
4377
+ if (typeof raw !== "string" || raw.trim() !== raw || raw.length === 0) fail2("Collector repository must be a string owner/repo");
4378
+ if (!conservativeAscii(raw) || raw.includes("://") || /[?#@%\\ ]/.test(raw)) fail2("Collector repository rejects URL syntax and non-identity bytes");
4453
4379
  const parts = raw.split("/");
4454
- if (parts.length !== 2) fail3("Collector repository must contain exactly one '/' separating owner and repo");
4380
+ if (parts.length !== 2) fail2("Collector repository must contain exactly one '/' separating owner and repo");
4455
4381
  const [ownerDisplay, repoDisplay] = parts;
4456
- if (!COLLECTOR_OWNER_PATTERN.test(ownerDisplay) || !COLLECTOR_REPO_PATTERN.test(repoDisplay)) fail3("Collector repository does not match the conservative owner/repo grammar");
4382
+ if (!COLLECTOR_OWNER_PATTERN.test(ownerDisplay) || !COLLECTOR_REPO_PATTERN.test(repoDisplay)) fail2("Collector repository does not match the conservative owner/repo grammar");
4457
4383
  const owner = ownerDisplay.toLowerCase();
4458
4384
  const repo = repoDisplay.toLowerCase();
4459
4385
  return { display: raw, canonical: `${owner}/${repo}`, owner, repo };
4460
4386
  }
4461
4387
  function parseCollectorPrNumber(raw) {
4462
- if (typeof raw !== "string" && typeof raw !== "number") fail3("Collector pull request number is required");
4388
+ if (typeof raw !== "string" && typeof raw !== "number") fail2("Collector pull request number is required");
4463
4389
  const value = parseTicketNumber(raw);
4464
- 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");
4390
+ 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");
4465
4391
  return value;
4466
4392
  }
4467
- function canonicalManifest(requests) {
4468
- return `${JSON.stringify({ requests: requests.map((request) => ({ id: request.id, body: request.requestBody })) })}
4469
- `;
4470
- }
4471
- function emptyCollectorManifest() {
4472
- const canonicalJson2 = canonicalManifest([]);
4473
- return { requests: [], canonicalJson: canonicalJson2, digest: sha256Hex(canonicalJson2) };
4474
- }
4475
- async function loadCollectorManifest(path) {
4476
- let bytes;
4477
- try {
4478
- bytes = await readFile6(path);
4479
- } catch (error) {
4480
- fail3(`Collector request manifest is unreadable at ${path}`, error);
4481
- }
4482
- let parsed;
4483
- try {
4484
- parsed = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
4485
- } catch (error) {
4486
- fail3("Collector request manifest must be UTF-8 JSON", error);
4487
- }
4488
- if (!isRecord(parsed)) fail3("Collector request manifest must be an object");
4489
- const rawRequests = parsed.requests ?? [];
4490
- if (!Array.isArray(rawRequests)) fail3("Collector request manifest requests must be an array");
4491
- const requests = [];
4492
- const ids = /* @__PURE__ */ new Set();
4493
- for (const [index, item] of rawRequests.entries()) {
4494
- if (!isRecord(item) || typeof item.id !== "string" || item.id.length === 0 || typeof item.body !== "string" || item.body.trim() === "") fail3(`Collector request manifest requests[${index}] is invalid`);
4495
- if (ids.has(item.id)) fail3(`Collector request manifest has duplicate request id "${item.id}"`);
4496
- ids.add(item.id);
4497
- requests.push({ id: item.id, requestBody: item.body });
4498
- }
4499
- const canonicalJson2 = canonicalManifest(requests);
4500
- return { requests, canonicalJson: canonicalJson2, digest: sha256Hex(canonicalJson2), sourcePath: path };
4501
- }
4502
4393
  var COLLECTOR_OWNER_PATTERN, COLLECTOR_REPO_PATTERN;
4503
4394
  var init_collector_config = __esm({
4504
4395
  "src/collector-config.ts"() {
4505
4396
  "use strict";
4506
- init_sha256();
4507
- init_unknown_value();
4508
4397
  init_run_ticket_number();
4509
4398
  COLLECTOR_OWNER_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/;
4510
4399
  COLLECTOR_REPO_PATTERN = /^[A-Za-z0-9](?:[A-Za-z0-9._-]{0,98}[A-Za-z0-9])?$/;
@@ -4519,7 +4408,7 @@ __export(auditor_dossier_tool_exports, {
4519
4408
  createAuditorDossierTool: () => createAuditorDossierTool
4520
4409
  });
4521
4410
  import { join as join12, resolve as resolve6 } from "node:path";
4522
- import { Type as Type16 } from "typebox";
4411
+ import { Type as Type15 } from "typebox";
4523
4412
  function auditorRunDirectory(context) {
4524
4413
  const sessionFile = context.sessionManager?.getSessionFile?.();
4525
4414
  if (sessionFile === void 0) return void 0;
@@ -4531,7 +4420,7 @@ function createAuditorDossierTool(runDirectory) {
4531
4420
  description: "\u5B9A\u4F4D\u672C\u5BA1\u8BA1\u5E2D\u7ED1\u5B9A\u7684 run \u5377\u5B97\u53CA\u5176\u8BC1\u636E\u5165\u53E3\u3002",
4532
4421
  // #836 r16 class 3: execute() ignores `_params` entirely — a closed root
4533
4422
  // only rejects the role for saying more.
4534
- parameters: Type16.Object({}, { additionalProperties: true }),
4423
+ parameters: Type15.Object({}, { additionalProperties: true }),
4535
4424
  async execute(_id, _params) {
4536
4425
  if (runDirectory === void 0) {
4537
4426
  return {
@@ -4565,7 +4454,7 @@ var init_auditor_dossier_tool = __esm({
4565
4454
  });
4566
4455
 
4567
4456
  // src/collector-tool-schemas.ts
4568
- import { Type as Type17 } from "typebox";
4457
+ import { Type as Type16 } from "typebox";
4569
4458
  var collectorOutputBaseSchema, collectorOutputArgsSchema;
4570
4459
  var init_collector_tool_schemas = __esm({
4571
4460
  "src/collector-tool-schemas.ts"() {
@@ -4573,11 +4462,11 @@ var init_collector_tool_schemas = __esm({
4573
4462
  init_open_tool_schema();
4574
4463
  init_terminating_infrastructure();
4575
4464
  collectorOutputBaseSchema = openToolObject(
4576
- Type17.Object({
4577
- groups: Type17.Unsafe({
4465
+ Type16.Object({
4466
+ groups: Type16.Unsafe({
4578
4467
  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"
4579
4468
  }),
4580
- unfinishedReasons: Type17.Unknown({
4469
+ unfinishedReasons: Type16.Unknown({
4581
4470
  description: "\u672A\u5B8C\u6210\u539F\u56E0\uFF1B\u53D6\u8BC1\u53D7\u9650\u65F6\u5982\u5B9E\u62A5\u544A\u3002"
4582
4471
  })
4583
4472
  })
@@ -5310,13 +5199,13 @@ var init_receipt_delivery_policy = __esm({
5310
5199
  });
5311
5200
 
5312
5201
  // src/ledger-session-read.ts
5313
- import { readFile as readFile7 } from "node:fs/promises";
5202
+ import { readFile as readFile6 } from "node:fs/promises";
5314
5203
  async function readStrictPiSessionJsonl(path) {
5315
- const text = await readFile7(path, "utf8");
5204
+ const text = await readFile6(path, "utf8");
5316
5205
  return text.trim().split("\n").filter(Boolean).map((line2) => JSON.parse(line2));
5317
5206
  }
5318
5207
  async function readLedgerSessionJsonlLines(path) {
5319
- const text = await readFile7(path, "utf8");
5208
+ const text = await readFile6(path, "utf8");
5320
5209
  const lines = text.split("\n");
5321
5210
  const out = [];
5322
5211
  for (let index = 0; index < lines.length; index += 1) {
@@ -5636,7 +5525,7 @@ async function runEngineDetourOnce(input) {
5636
5525
  }
5637
5526
  const command = input.argv[0];
5638
5527
  const args = input.argv.slice(1);
5639
- return await new Promise((resolve22, reject) => {
5528
+ return await new Promise((resolve21, reject) => {
5640
5529
  let settled = false;
5641
5530
  const signal = input.signal;
5642
5531
  const child = spawn(command, args, {
@@ -5652,7 +5541,7 @@ async function runEngineDetourOnce(input) {
5652
5541
  child.stderr.setEncoding("utf8").on("data", (chunk) => {
5653
5542
  stderr += chunk;
5654
5543
  });
5655
- const fail4 = (error) => {
5544
+ const fail3 = (error) => {
5656
5545
  if (settled) return;
5657
5546
  settled = true;
5658
5547
  if (signal !== void 0) {
@@ -5666,10 +5555,10 @@ async function runEngineDetourOnce(input) {
5666
5555
  if (signal !== void 0) {
5667
5556
  signal.removeEventListener("abort", onAbort);
5668
5557
  }
5669
- resolve22(result);
5558
+ resolve21(result);
5670
5559
  };
5671
5560
  const onAbort = () => {
5672
- fail4(signal !== void 0 ? abortReasonError(signal) : new Error("aborted"));
5561
+ fail3(signal !== void 0 ? abortReasonError(signal) : new Error("aborted"));
5673
5562
  try {
5674
5563
  child.kill("SIGTERM");
5675
5564
  } catch {
@@ -5682,7 +5571,7 @@ async function runEngineDetourOnce(input) {
5682
5571
  signal.addEventListener("abort", onAbort, { once: true });
5683
5572
  }
5684
5573
  }
5685
- child.on("error", (error) => fail4(error));
5574
+ child.on("error", (error) => fail3(error));
5686
5575
  child.on("close", (code) => {
5687
5576
  succeed({ code: code ?? 1, stdout, stderr });
5688
5577
  });
@@ -6445,7 +6334,7 @@ var init_git_object_id = __esm({
6445
6334
 
6446
6335
  // src/merger-git-state.ts
6447
6336
  import { execFile } from "node:child_process";
6448
- import { access, readFile as readFile8 } from "node:fs/promises";
6337
+ import { access, readFile as readFile7 } from "node:fs/promises";
6449
6338
  import { constants as fsConstants } from "node:fs";
6450
6339
  import { isAbsolute as isAbsolute3, resolve as resolve8 } from "node:path";
6451
6340
  import { promisify } from "node:util";
@@ -6515,7 +6404,7 @@ function createProductionMergerGitState(repositoryRoot = process.cwd()) {
6515
6404
  const mergeHeadPath = isAbsolute3(mergeHeadReported) ? mergeHeadReported : resolve8(repositoryRoot, mergeHeadReported);
6516
6405
  let sourceObjectId = "";
6517
6406
  if (await pathExists(mergeHeadPath)) {
6518
- const raw = exactUtf8(await readFile8(mergeHeadPath), "Git MERGE_HEAD");
6407
+ const raw = exactUtf8(await readFile7(mergeHeadPath), "Git MERGE_HEAD");
6519
6408
  const mergeHeads = raw.trim().split(/\r?\n/).map((row) => row.trim()).filter(Boolean);
6520
6409
  if (mergeHeads.length === 0) throw new Error("Git MERGE_HEAD is empty");
6521
6410
  if (mergeHeads.length !== 1) throw new Error("Assigned repository does not have one ordinary in-progress merge");
@@ -6661,7 +6550,7 @@ var init_session_dialogue = __esm({
6661
6550
  });
6662
6551
 
6663
6552
  // src/ticket-provenance.ts
6664
- import { readFile as readFile9 } from "node:fs/promises";
6553
+ import { readFile as readFile8 } from "node:fs/promises";
6665
6554
  import { join as join13, resolve as resolve9 } from "node:path";
6666
6555
  function dialogueSessionSourceRoots(home) {
6667
6556
  const machineHome = typeof home === "string" && home.trim() !== "" ? home : packageMachineHome();
@@ -6709,7 +6598,7 @@ async function rehomeUnboundTicketProvenance(runDirectory, ticketNumber, cwd, ho
6709
6598
  const ticketInput = ticketProvenanceRecordInput(ticketNumber, cwd, home);
6710
6599
  let history;
6711
6600
  try {
6712
- history = await readFile9(join13(runDirectory, RUN_HISTORY_FILE), "utf8");
6601
+ history = await readFile8(join13(runDirectory, RUN_HISTORY_FILE), "utf8");
6713
6602
  } catch (error) {
6714
6603
  if (errnoCode(error) === "ENOENT") return;
6715
6604
  throw error;
@@ -7453,8 +7342,8 @@ var init_option_definitions = __esm({
7453
7342
  repeatable: true,
7454
7343
  form: "option",
7455
7344
  description: {
7456
- en: "Attach a regular file; frozen at admission (repeatable).",
7457
- zh: "\u9644\u52A0\u666E\u901A\u6587\u4EF6\uFF1B\u53D7\u7406\u5373\u51BB\u7ED3\uFF08\u53EF\u91CD\u590D\uFF09\u3002"
7345
+ en: "Caller file path passed as-is to the role (repeatable). Package does not read, copy, or validate; use an absolute path when cwd differs from --project.",
7346
+ zh: "\u8C03\u7528\u65B9\u6587\u4EF6\u8DEF\u5F84\u539F\u6837\u9012\u7ED9\u8859\u95E8\uFF08\u53EF\u91CD\u590D\uFF09\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"
7458
7347
  }
7459
7348
  };
7460
7349
  SHARED_PHASE_SEMANTICS = {
@@ -7538,8 +7427,8 @@ var init_option_definitions = __esm({
7538
7427
  repeatable: false,
7539
7428
  form: "option",
7540
7429
  description: {
7541
- en: "JSON array of {id, requirement} prerequisite objects.",
7542
- zh: "{id, requirement} \u524D\u7F6E\u6761\u4EF6 JSON \u6570\u7EC4\u8DEF\u5F84\u3002"
7430
+ 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.",
7431
+ 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"
7543
7432
  }
7544
7433
  }
7545
7434
  ];
@@ -7629,8 +7518,8 @@ var init_option_definitions = __esm({
7629
7518
  repeatable: false,
7630
7519
  form: "option",
7631
7520
  description: {
7632
- en: "Optional request manifest JSON path ({requests:[{id,body}]}). Parsed for semantics and passed to the Collector as materials \u2014 not a machine collection directive.",
7633
- zh: "\u53EF\u9009 request manifest JSON \u8DEF\u5F84\uFF08{requests:[{id,body}]}\uFF09\u3002\u6309\u8BED\u4E49\u89E3\u6790\u540E\u4F5C\u4E3A\u6750\u6599\u9012\u7ED9\u901A\u8FDB\u53F8\uFF0C\u4E0D\u662F\u673A\u5668\u4EE3\u6536 finding \u7684\u6307\u4EE4\u3002"
7521
+ en: "Caller path to a request manifest JSON file, passed as-is. Package does not read, copy, or validate; use an absolute path when cwd differs from --project.",
7522
+ zh: "\u8C03\u7528\u65B9 request manifest JSON \u8DEF\u5F84\uFF0C\u539F\u6837\u4F20\u9012\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"
7634
7523
  }
7635
7524
  }
7636
7525
  ];
@@ -8089,16 +7978,22 @@ var init_option_definitions = __esm({
8089
7978
  import { execFileSync as execFileSync2 } from "node:child_process";
8090
7979
  import { existsSync as existsSync5 } from "node:fs";
8091
7980
  import {
8092
- lstat as lstat2,
8093
- mkdtemp,
8094
- readFile as readFile10,
7981
+ readFile as readFile9,
8095
7982
  realpath as realpath3,
8096
7983
  rename as rename2,
8097
- rm as rm2,
8098
7984
  writeFile as writeFile3
8099
7985
  } from "node:fs/promises";
8100
- import { tmpdir } from "node:os";
8101
- import { basename as basename9, dirname as dirname11, isAbsolute as isAbsolute5, join as join15, resolve as resolve11 } from "node:path";
7986
+ import { dirname as dirname11, isAbsolute as isAbsolute5, join as join15, resolve as resolve11 } from "node:path";
7987
+ function normalizeAdmittedAttachment(raw) {
7988
+ if (typeof raw !== "object" || raw === null) return void 0;
7989
+ const record = raw;
7990
+ const path = record.path;
7991
+ if (typeof path === "string") return { path };
7992
+ return void 0;
7993
+ }
7994
+ function admitCallerAttachments(attachmentPaths) {
7995
+ return attachmentPaths.map((path) => ({ path }));
7996
+ }
8102
7997
  function issueAdmissionPlacement(authority, request) {
8103
7998
  const ledgerHome = resolveActivationLedgerHome(request.home);
8104
7999
  const bookKey = resolveBookKeyFromGit(request.cwd);
@@ -8274,22 +8169,11 @@ async function relocateAdmittedRunToTicket(admitted, authority, heldLease) {
8274
8169
  admittedRecord,
8275
8170
  [
8276
8171
  "runDirectory",
8277
- "taskPath",
8278
- "packetPath",
8279
- "prerequisitesPath",
8280
- "requestManifestPath",
8281
8172
  "mergerInputPath"
8282
8173
  ],
8283
8174
  oldRunDirectory,
8284
8175
  target.runDirectory
8285
8176
  );
8286
- for (const attachment of admitted.attachments) {
8287
- attachment.frozenPath = rewriteRunDirectoryPathValue(
8288
- attachment.frozenPath,
8289
- oldRunDirectory,
8290
- target.runDirectory
8291
- );
8292
- }
8293
8177
  admitted.principal = principal;
8294
8178
  renderCurrentSync(target.runDirectory);
8295
8179
  return { oldRunDirectory, newRunDirectory: target.runDirectory };
@@ -8326,7 +8210,7 @@ async function recordLaunchedPiIdentity(runDirectory, identity) {
8326
8210
  async function observeLaunchedRolePackageIdentity(packageRoot, selectedRoleEntry) {
8327
8211
  const rolePackageRoot = packageRoot;
8328
8212
  const raw = JSON.parse(
8329
- await readFile10(join15(rolePackageRoot, "package.json"), "utf8")
8213
+ await readFile9(join15(rolePackageRoot, "package.json"), "utf8")
8330
8214
  );
8331
8215
  if (typeof raw.version !== "string" || raw.version.trim() === "") {
8332
8216
  throw new Error(
@@ -8382,7 +8266,7 @@ function assignPublicSeatOption(owner, taken, fields) {
8382
8266
  const value = taken.value;
8383
8267
  switch (taken.def.id) {
8384
8268
  case "attach":
8385
- fields.attachmentPaths.push(requireOptionPath(taken.def.canonical, value));
8269
+ fields.attachmentPaths.push(requireProvidedOptionValue(taken.def.canonical, value));
8386
8270
  return;
8387
8271
  case "project":
8388
8272
  fields.project = requireOptionPath(taken.def.canonical, value);
@@ -8417,7 +8301,7 @@ function assignPublicSeatOption(owner, taken, fields) {
8417
8301
  fields.authorityRefs.push(requireAuthorityRef(value));
8418
8302
  return;
8419
8303
  case "prerequisites":
8420
- fields.prerequisitesPath = requireOptionPath(taken.def.canonical, value);
8304
+ fields.prerequisitesPath = requireProvidedOptionValue(taken.def.canonical, value);
8421
8305
  return;
8422
8306
  case "pr":
8423
8307
  fields.prNumber = parsePositivePrOption(value);
@@ -8426,7 +8310,7 @@ function assignPublicSeatOption(owner, taken, fields) {
8426
8310
  fields.repo = parseRepoOption(value);
8427
8311
  return;
8428
8312
  case "request-manifest":
8429
- fields.requestManifestPath = requireOptionPath(taken.def.canonical, value);
8313
+ fields.requestManifestPath = requireProvidedOptionValue(taken.def.canonical, value);
8430
8314
  return;
8431
8315
  case "issue": {
8432
8316
  if (value === void 0 || value.trim() === "") {
@@ -8541,6 +8425,12 @@ function requireOptionPath(flag, value) {
8541
8425
  }
8542
8426
  return value;
8543
8427
  }
8428
+ function requireProvidedOptionValue(flag, value) {
8429
+ if (value === void 0) {
8430
+ throw new CliUsageError(`${flag} requires a path`);
8431
+ }
8432
+ return value;
8433
+ }
8544
8434
  function skillArgTokenFault(value) {
8545
8435
  if (value === void 0 || value.trim() === "") return "empty";
8546
8436
  if (/\s/.test(value)) return "whitespace";
@@ -8593,124 +8483,6 @@ function requireAuthorityRef(value) {
8593
8483
  optionLike: "--authority-ref requires a durable reference, not inline Spec prose"
8594
8484
  });
8595
8485
  }
8596
- async function readRegularFileAttachment(sourcePath) {
8597
- const absolute = isAbsolute5(sourcePath) ? sourcePath : resolve11(sourcePath);
8598
- let st;
8599
- try {
8600
- st = await lstat2(absolute);
8601
- } catch (error) {
8602
- throw new CliUsageError(
8603
- `attachment is not a readable regular file: ${sourcePath}`,
8604
- { cause: error }
8605
- );
8606
- }
8607
- if (!st.isFile() || st.isSymbolicLink()) {
8608
- throw new CliUsageError(
8609
- `attachment must be a regular file (not a directory or symlink): ${sourcePath}`
8610
- );
8611
- }
8612
- try {
8613
- return { absolute, bytes: await readFile10(absolute) };
8614
- } catch (error) {
8615
- throw new CliUsageError(
8616
- `attachment is not a readable regular file: ${sourcePath}`,
8617
- { cause: error }
8618
- );
8619
- }
8620
- }
8621
- async function removePreparedAttachmentDirectory(stagingDirectory) {
8622
- await rm2(stagingDirectory, { recursive: true, force: true });
8623
- }
8624
- async function withPreparedAttachments(attachmentPaths, use) {
8625
- if (attachmentPaths.length === 0) return await use([]);
8626
- const stagingDirectory = await mkdtemp(join15(tmpdir(), "ak-role-attachments-"));
8627
- const prepared = [];
8628
- let result;
8629
- try {
8630
- for (let index = 0; index < attachmentPaths.length; index += 1) {
8631
- const { absolute, bytes } = await readRegularFileAttachment(attachmentPaths[index]);
8632
- const snapshotPath = join15(stagingDirectory, String(index).padStart(6, "0"));
8633
- await writeFile3(snapshotPath, bytes);
8634
- prepared.push({ absolute, snapshotPath });
8635
- }
8636
- result = await use(prepared);
8637
- } catch (primary) {
8638
- try {
8639
- await removePreparedAttachmentDirectory(stagingDirectory);
8640
- } catch (cleanup) {
8641
- throw new AggregateError(
8642
- [primary, cleanup],
8643
- "attachment snapshot operation failed and cleanup also failed",
8644
- { cause: primary }
8645
- );
8646
- }
8647
- throw primary;
8648
- }
8649
- await removePreparedAttachmentDirectory(stagingDirectory);
8650
- return result;
8651
- }
8652
- async function freezeAttachmentBytes(provenancePath, bytes, destinationDir, index) {
8653
- const frozenPath = join15(
8654
- destinationDir,
8655
- `${String(index).padStart(2, "0")}-${basename9(provenancePath)}`
8656
- );
8657
- await writeFile3(frozenPath, bytes);
8658
- return {
8659
- provenancePath,
8660
- frozenPath,
8661
- byteLength: bytes.byteLength,
8662
- sha256: sha256Hex(bytes),
8663
- mediaKind: "regular-file"
8664
- };
8665
- }
8666
- async function freezePreparedAttachment(prepared, destinationDir, index) {
8667
- return freezeAttachmentBytes(
8668
- prepared.absolute,
8669
- await readFile10(prepared.snapshotPath),
8670
- destinationDir,
8671
- index
8672
- );
8673
- }
8674
- async function freezeRegularFileAttachment(sourcePath, destinationDir, index) {
8675
- const { absolute, bytes } = await readRegularFileAttachment(sourcePath);
8676
- return {
8677
- attachment: await freezeAttachmentBytes(absolute, bytes, destinationDir, index),
8678
- body: bytes
8679
- };
8680
- }
8681
- async function freezeAttachments(ledgerHome, attachmentPaths, attachmentsDirectory) {
8682
- const attachments = [];
8683
- if (attachmentPaths.length > 0) {
8684
- ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
8685
- }
8686
- for (let i = 0; i < attachmentPaths.length; i += 1) {
8687
- const frozen = await freezeRegularFileAttachment(
8688
- attachmentPaths[i],
8689
- attachmentsDirectory,
8690
- i
8691
- );
8692
- attachments.push(frozen.attachment);
8693
- }
8694
- return attachments;
8695
- }
8696
- async function freezeAttachmentsIntoRun(attachmentPaths, runDirectory, summonsKey = `s-${Date.now().toString(36)}`) {
8697
- if (attachmentPaths.length === 0) return [];
8698
- const ledgerHome = resolveActivationLedgerHome(homeFromRunDirectory(runDirectory));
8699
- const attachmentsDirectory = join15(runDirectory, "attachments", summonsKey);
8700
- ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
8701
- return freezeAttachments(ledgerHome, attachmentPaths, attachmentsDirectory);
8702
- }
8703
- async function freezePreparedAttachmentsIntoRun(prepared, runDirectory, summonsKey) {
8704
- if (prepared.length === 0) return [];
8705
- const ledgerHome = resolveActivationLedgerHome(homeFromRunDirectory(runDirectory));
8706
- const attachmentsDirectory = summonsKey === void 0 ? join15(runDirectory, "attachments") : join15(runDirectory, "attachments", summonsKey);
8707
- ensureRealDirectoryTree(ledgerHome, attachmentsDirectory);
8708
- const attachments = [];
8709
- for (let index = 0; index < prepared.length; index += 1) {
8710
- attachments.push(await freezePreparedAttachment(prepared[index], attachmentsDirectory, index));
8711
- }
8712
- return attachments;
8713
- }
8714
8486
  function ticketAdmissionFields(ticketNumber) {
8715
8487
  if (ticketNumber === void 0) return {};
8716
8488
  return {
@@ -8779,11 +8551,7 @@ async function admitPublicRole(role, parsed, env, override) {
8779
8551
  instruction,
8780
8552
  attachmentPaths,
8781
8553
  ...project,
8782
- placedFields: async (placed) => {
8783
- const taskPath = join15(placed.runDirectory, "task.md");
8784
- await writeFile3(taskPath, instruction, "utf8");
8785
- return { phase, taskPath };
8786
- }
8554
+ placedFields: async () => ({ phase })
8787
8555
  });
8788
8556
  }
8789
8557
  case "worker-packet": {
@@ -8794,52 +8562,15 @@ async function admitPublicRole(role, parsed, env, override) {
8794
8562
  if (!record.phases.some((item) => item === phase)) {
8795
8563
  throw new CliUsageError("fixer phase must be plan or apply");
8796
8564
  }
8797
- let prerequisites = Object.freeze([]);
8798
- let prerequisitesSource;
8799
- if (parsed.prerequisitesPath !== void 0) {
8800
- const absolutePrereq = isAbsolute5(parsed.prerequisitesPath) ? parsed.prerequisitesPath : resolve11(parsed.prerequisitesPath);
8801
- try {
8802
- prerequisitesSource = await readFile10(absolutePrereq, "utf8");
8803
- } catch (error) {
8804
- throw new CliUsageError(
8805
- `fixer prerequisites path is unreadable: ${parsed.prerequisitesPath}`,
8806
- { cause: error }
8807
- );
8808
- }
8809
- try {
8810
- prerequisites = parseFixerPrerequisites(prerequisitesSource);
8811
- } catch (error) {
8812
- if (error instanceof FixerPacketValidationError) {
8813
- throw new CliUsageError(error.message, { cause: error });
8814
- }
8815
- throw error;
8816
- }
8817
- }
8818
8565
  return admitStandardMaterialInvocation("fixer", {
8819
8566
  ...shared,
8820
8567
  instruction,
8821
8568
  attachmentPaths,
8822
8569
  ...project,
8823
- placedFields: async (placed) => {
8824
- let prerequisitesPath;
8825
- if (prerequisitesSource !== void 0) {
8826
- prerequisitesPath = join15(placed.runDirectory, "prerequisites.json");
8827
- await writeFile3(
8828
- prerequisitesPath,
8829
- `${JSON.stringify(prerequisites, null, 2)}
8830
- `,
8831
- "utf8"
8832
- );
8833
- }
8834
- const packetPath = join15(placed.runDirectory, "fix-packet.md");
8835
- await writeFile3(packetPath, instruction, "utf8");
8836
- return {
8837
- phase,
8838
- packetPath,
8839
- prerequisites,
8840
- ...prerequisitesPath === void 0 ? {} : { prerequisitesPath }
8841
- };
8842
- }
8570
+ placedFields: async () => ({
8571
+ phase,
8572
+ ...parsed.prerequisitesPath === void 0 ? {} : { prerequisitesPath: parsed.prerequisitesPath }
8573
+ })
8843
8574
  });
8844
8575
  }
8845
8576
  case "collect-target": {
@@ -8856,37 +8587,17 @@ async function admitPublicRole(role, parsed, env, override) {
8856
8587
  } else {
8857
8588
  repository = resolveGitHubRemoteRepository(projectRoot);
8858
8589
  }
8859
- let manifest = emptyCollectorManifest();
8860
- let manifestCanonicalJson;
8861
- if (parsed.requestManifestPath !== void 0) {
8862
- try {
8863
- manifest = await loadCollectorManifest(parsed.requestManifestPath);
8864
- manifestCanonicalJson = manifest.canonicalJson;
8865
- } catch (error) {
8866
- throw new CliUsageError(
8867
- errorText(error),
8868
- { cause: error }
8869
- );
8870
- }
8871
- }
8872
- const manifestDigest = manifest.digest;
8873
8590
  const admittedCollector = await admitStandardMaterialInvocation("collector", {
8874
8591
  ...shared,
8875
8592
  instruction,
8876
8593
  attachmentPaths,
8877
8594
  ...project,
8878
- placedFields: async (placed) => {
8879
- let requestManifestPath;
8880
- if (manifestCanonicalJson !== void 0) {
8881
- requestManifestPath = join15(placed.runDirectory, "request-manifest.json");
8882
- await writeFile3(requestManifestPath, manifestCanonicalJson, "utf8");
8883
- }
8595
+ placedFields: async () => {
8884
8596
  return {
8885
8597
  ...explicitPrNumber === void 0 ? {} : { prNumber: explicitPrNumber },
8886
8598
  repository: repository.canonical,
8887
8599
  repositoryDisplay: repository.display,
8888
- ...requestManifestPath === void 0 ? {} : { requestManifestPath },
8889
- manifestDigest
8600
+ ...parsed.requestManifestPath === void 0 ? {} : { requestManifestPath: parsed.requestManifestPath }
8890
8601
  };
8891
8602
  }
8892
8603
  });
@@ -8899,12 +8610,10 @@ async function admitPublicRole(role, parsed, env, override) {
8899
8610
  );
8900
8611
  }
8901
8612
  const issueNumber = parsed.issueNumber;
8902
- let frozenAttachments = [];
8903
- const admittedDoctor = await admitStandardMaterialInvocation("doctor", {
8613
+ return admitStandardMaterialInvocation("doctor", {
8904
8614
  ...shared,
8905
8615
  instruction,
8906
- attachmentPaths: [],
8907
- freezeAttachments: false,
8616
+ attachmentPaths,
8908
8617
  ...project,
8909
8618
  placedFields: async (placed) => {
8910
8619
  let caseRunsPath;
@@ -8945,16 +8654,13 @@ async function admitPublicRole(role, parsed, env, override) {
8945
8654
  { cause: error }
8946
8655
  );
8947
8656
  }
8948
- frozenAttachments = await freezeAttachments(placed.ledgerHome, attachmentPaths, placed.attachmentsDirectory);
8949
8657
  return {
8950
8658
  issueNumber,
8951
8659
  caseRunsPath,
8952
- caseIdentity,
8953
- attachments: persistedAttachmentRefs(frozenAttachments)
8660
+ caseIdentity
8954
8661
  };
8955
8662
  }
8956
8663
  });
8957
- return { ...admittedDoctor, attachments: frozenAttachments };
8958
8664
  }
8959
8665
  case "source-locator": {
8960
8666
  const projectRoot = resolve11(parsed.project ?? shared.cwd);
@@ -8981,7 +8687,7 @@ async function admitPublicRole(role, parsed, env, override) {
8981
8687
  instruction: "",
8982
8688
  attachmentPaths: [],
8983
8689
  ...project,
8984
- freezeAttachments: false,
8690
+ recordAttachments: false,
8985
8691
  admittedFields: {
8986
8692
  sourceRunPath: sourceRun.runDirectory,
8987
8693
  sourceRun
@@ -8998,7 +8704,7 @@ async function admitPublicRole(role, parsed, env, override) {
8998
8704
  instruction,
8999
8705
  attachmentPaths: [],
9000
8706
  ...project,
9001
- freezeAttachments: false,
8707
+ recordAttachments: false,
9002
8708
  admittedFields: { baseRevision }
9003
8709
  });
9004
8710
  }
@@ -9051,8 +8757,6 @@ async function admitPublicRole(role, parsed, env, override) {
9051
8757
  targetObjectId: derived.targetObjectId,
9052
8758
  sourceObjectId: derived.sourceObjectId,
9053
8759
  materials: {
9054
- task: mergerMaterialFromUtf8(instruction),
9055
- authority: mergerMaterialFromUtf8(instruction),
9056
8760
  targetIntent: mergerMaterialFromUtf8(
9057
8761
  `Investigate primary sources for target parent ${targetLabel}. Do not invent intent.`
9058
8762
  ),
@@ -9110,7 +8814,7 @@ async function placeRoleAdmission(options) {
9110
8814
  home: options.home,
9111
8815
  ...options.materialize === void 0 ? {} : { materialize: options.materialize }
9112
8816
  });
9113
- const attachments = options.freezeAttachments === false ? [] : await freezeAttachments(ledgerHome, options.attachmentPaths, attachmentsDirectory);
8817
+ const attachments = options.recordAttachments === false ? [] : admitCallerAttachments(options.attachmentPaths);
9114
8818
  return {
9115
8819
  runId,
9116
8820
  bookKey,
@@ -9126,13 +8830,7 @@ async function placeRoleAdmission(options) {
9126
8830
  };
9127
8831
  }
9128
8832
  function persistedAttachmentRefs(attachments) {
9129
- return attachments.map((attachment) => ({
9130
- provenancePath: attachment.provenancePath,
9131
- frozenPath: attachment.frozenPath,
9132
- byteLength: attachment.byteLength,
9133
- sha256: attachment.sha256,
9134
- mediaKind: attachment.mediaKind
9135
- }));
8833
+ return attachments.map((attachment) => ({ path: attachment.path }));
9136
8834
  }
9137
8835
  async function persistPlacedAdmission(admitted, placed, model) {
9138
8836
  writeAdmittedRequestPersistence(placed.runDirectory, admitted, {
@@ -9151,14 +8849,14 @@ async function persistPlacedAdmission(admitted, placed, model) {
9151
8849
  }
9152
8850
  async function admitStandardMaterialInvocation(role, options) {
9153
8851
  const defer = options.deferPersistence === true;
9154
- const skipFreeze = defer || options.freezeAttachments === false;
8852
+ const skipAttachments = defer || options.recordAttachments === false;
9155
8853
  const placed = await placeRoleAdmission({
9156
8854
  role,
9157
8855
  home: options.home,
9158
8856
  principalAuthority: options.principalAuthority,
9159
8857
  cwd: options.cwd,
9160
8858
  attachmentPaths: options.attachmentPaths,
9161
- ...skipFreeze ? { freezeAttachments: false } : {},
8859
+ ...skipAttachments ? { recordAttachments: false } : {},
9162
8860
  ...defer ? { materialize: false } : {},
9163
8861
  ...options.project === void 0 ? {} : { project: options.project },
9164
8862
  ...options.createRunId === void 0 ? {} : { createRunId: options.createRunId },
@@ -9166,7 +8864,7 @@ async function admitStandardMaterialInvocation(role, options) {
9166
8864
  });
9167
8865
  const correlationFields = options.correlationId === void 0 ? {} : { correlationId: options.correlationId };
9168
8866
  const instruction = options.instruction;
9169
- const instructionEmpty = instruction.trim() === "";
8867
+ const instructionEmpty = instruction.length === 0;
9170
8868
  const placedExtra = options.placedFields === void 0 ? void 0 : await options.placedFields(placed);
9171
8869
  const admittedFields = {
9172
8870
  ...options.admittedFields ?? {},
@@ -9221,7 +8919,7 @@ function buildInstructionTransportPrompt(admitted) {
9221
8919
  throw new Error("baseline transport prompt is missing the bound revision");
9222
8920
  }
9223
8921
  const lines2 = [admitted.baseRevision];
9224
- if (!admitted.instructionEmpty) {
8922
+ if (admitted.instruction.length > 0) {
9225
8923
  lines2.push("", admitted.instruction);
9226
8924
  }
9227
8925
  return lines2.join("\n");
@@ -9235,17 +8933,22 @@ function buildInstructionTransportPrompt(admitted) {
9235
8933
  lens: admitted.lens,
9236
8934
  authorityRefs: admitted.authorityRefs
9237
8935
  })];
9238
- if (!admitted.instructionEmpty && admitted.instruction.trim() !== "") {
8936
+ if (admitted.instruction.length > 0) {
9239
8937
  lines2.push("", admitted.instruction);
9240
8938
  }
9241
8939
  return lines2.join("\n");
9242
8940
  }
9243
- const lines = [admitted.instructionEmpty ? "" : admitted.instruction];
9244
- if (admitted.attachments.length > 0) {
8941
+ const lines = [admitted.instruction];
8942
+ const flaggedPaths = [
8943
+ ...admitted.attachments.map((attachment) => `--attach ${attachment.path}`),
8944
+ ...admitted.requestManifestPath === void 0 ? [] : [`--request-manifest ${admitted.requestManifestPath}`],
8945
+ ...admitted.prerequisitesPath === void 0 ? [] : [`--prerequisites ${admitted.prerequisitesPath}`]
8946
+ ];
8947
+ if (flaggedPaths.length > 0) {
9245
8948
  lines.push("");
9246
- lines.push("\u5DF2\u53D7\u7406\u9644\u4EF6\uFF08\u51BB\u7ED3\u5FEB\u7167\u8DEF\u5F84\uFF09\uFF1A");
9247
- for (const attachment of admitted.attachments) {
9248
- lines.push(`- ${attachment.frozenPath}`);
8949
+ lines.push("\u5DF2\u53D7\u7406\u9644\u4EF6\uFF1A");
8950
+ for (const entry of flaggedPaths) {
8951
+ lines.push(`- ${entry}`);
9249
8952
  }
9250
8953
  }
9251
8954
  return lines.join("\n");
@@ -9256,8 +8959,7 @@ async function materializeCountersignInvocation(admitted, options) {
9256
8959
  home: options.home,
9257
8960
  principalAuthority: options.principalAuthority,
9258
8961
  cwd: admitted.projectRoot,
9259
- attachmentPaths: [],
9260
- freezeAttachments: false,
8962
+ attachmentPaths: options.attachmentPaths,
9261
8963
  runId: admitted.runId,
9262
8964
  ...options.ticketNumber === void 0 ? {} : { assertedTicketNumber: options.ticketNumber }
9263
8965
  });
@@ -9268,11 +8970,7 @@ async function materializeCountersignInvocation(admitted, options) {
9268
8970
  if (ticketFields.ticketNumber !== void 0) {
9269
8971
  admitted.ticketNumber = ticketFields.ticketNumber;
9270
8972
  }
9271
- const attachments = await freezePreparedAttachmentsIntoRun(
9272
- options.preparedAttachments,
9273
- admitted.runDirectory
9274
- );
9275
- admitted.attachments = attachments;
8973
+ admitted.attachments = placement.attachments;
9276
8974
  writeAdmittedRequestPersistence(admitted.runDirectory, admitted, {
9277
8975
  sessionDirectory: placement.sessionDirectory,
9278
8976
  sessionFile: placement.sessionFile
@@ -9291,10 +8989,11 @@ async function loadAdmittedJudgeRequest(runDirectory) {
9291
8989
  if (typeof record.instruction !== "string") return void 0;
9292
8990
  if (typeof record.instructionEmpty !== "boolean") return void 0;
9293
8991
  if (!Array.isArray(record.attachments)) return void 0;
8992
+ const attachments = record.attachments.map((item) => normalizeAdmittedAttachment(item)).filter((item) => item !== void 0);
9294
8993
  return {
9295
8994
  instruction: record.instruction,
9296
8995
  instructionEmpty: record.instructionEmpty,
9297
- attachments: record.attachments
8996
+ attachments
9298
8997
  };
9299
8998
  } catch {
9300
8999
  return void 0;
@@ -9529,7 +9228,7 @@ function parseAnalystArgv(args) {
9529
9228
  if (taken.def.id === "attach") {
9530
9229
  pushValue(
9531
9230
  "attach",
9532
- requireOptionPath(taken.def.canonical, taken.value)
9231
+ requireProvidedOptionValue(taken.def.canonical, taken.value)
9533
9232
  );
9534
9233
  return;
9535
9234
  }
@@ -9643,7 +9342,6 @@ var init_invocation = __esm({
9643
9342
  init_doctor_evidence();
9644
9343
  init_collector_config();
9645
9344
  init_github_remote();
9646
- init_fixer_packet();
9647
9345
  init_merger_git_state();
9648
9346
  init_merger_contracts();
9649
9347
  init_sha256();
@@ -10706,10 +10404,10 @@ function presentFailureTerminal(terminal, io) {
10706
10404
  }
10707
10405
  function defaultNavigatorGraceSleep() {
10708
10406
  let timer;
10709
- const sleep2 = ((ms) => new Promise((resolve22) => {
10407
+ const sleep2 = ((ms) => new Promise((resolve21) => {
10710
10408
  timer = setTimeout(() => {
10711
10409
  timer = void 0;
10712
- resolve22();
10410
+ resolve21();
10713
10411
  }, ms);
10714
10412
  }));
10715
10413
  sleep2.cancel = () => {
@@ -10721,7 +10419,7 @@ function defaultNavigatorGraceSleep() {
10721
10419
  return sleep2;
10722
10420
  }
10723
10421
  function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2 = defaultNavigatorGraceSleep()) {
10724
- return new Promise((resolve22, reject) => {
10422
+ return new Promise((resolve21, reject) => {
10725
10423
  let settled = false;
10726
10424
  const finish = (action) => {
10727
10425
  if (settled) return;
@@ -10730,11 +10428,11 @@ function raceNavigatorGrace(work, graceMs = NAVIGATOR_POST_ROLE_GRACE_MS, sleep2
10730
10428
  action();
10731
10429
  };
10732
10430
  void work.then(
10733
- (value) => finish(() => resolve22({ status: "done", value })),
10431
+ (value) => finish(() => resolve21({ status: "done", value })),
10734
10432
  (error) => finish(() => reject(error))
10735
10433
  );
10736
10434
  void sleep2(graceMs).then(() => {
10737
- finish(() => resolve22({ status: "timeout" }));
10435
+ finish(() => resolve21({ status: "timeout" }));
10738
10436
  });
10739
10437
  });
10740
10438
  }
@@ -11584,7 +11282,7 @@ var init_role_seat_runtime = __esm({
11584
11282
  });
11585
11283
 
11586
11284
  // src/archivist-record-pointer.ts
11587
- import { basename as basename10, join as join21 } from "node:path";
11285
+ import { basename as basename9, join as join21 } from "node:path";
11588
11286
  function bookDirectOfficerRunPointer(options) {
11589
11287
  const submissionToolCallId = options.submissionToolCallId?.trim() ?? "";
11590
11288
  const pointer = {
@@ -11610,7 +11308,7 @@ async function resolveOfficerPointer(raw, parentRunDirectory) {
11610
11308
  let runDirectory = typeof raw.runDirectory === "string" && raw.runDirectory.trim() !== "" ? raw.runDirectory : void 0;
11611
11309
  let sessionFile = raw.sessionFile;
11612
11310
  const recordedRunDirectory = runDirectory ?? runDirectoryOfSessionFile(sessionFile);
11613
- const leaf = parseRunLeaf(basename10(recordedRunDirectory));
11311
+ const leaf = parseRunLeaf(basename9(recordedRunDirectory));
11614
11312
  const parentIdentity = await readRoleRunIdentity(parentRunDirectory);
11615
11313
  if (leaf !== void 0 && parentIdentity !== void 0) {
11616
11314
  const currentRunDirectory = await findRunDirectoryById(
@@ -11971,7 +11669,7 @@ var init_submission_gate = __esm({
11971
11669
 
11972
11670
  // src/session-opening-materials.ts
11973
11671
  import { existsSync as existsSync8 } from "node:fs";
11974
- import { readFile as readFile11 } from "node:fs/promises";
11672
+ import { readFile as readFile10 } from "node:fs/promises";
11975
11673
  import { dirname as dirname14, join as join22 } from "node:path";
11976
11674
  import { fileURLToPath, pathToFileURL as pathToFileURL3 } from "node:url";
11977
11675
  function resolvePackageRootDir(moduleUrl = import.meta.url) {
@@ -11987,7 +11685,7 @@ function resolvePackageRootDir(moduleUrl = import.meta.url) {
11987
11685
  return fileURLToPath(new URL("..", moduleUrl));
11988
11686
  }
11989
11687
  async function readPackageMaterial(relativePath) {
11990
- return readFile11(fileURLToPath(new URL(relativePath, packageRootUrl)), "utf8");
11688
+ return readFile10(fileURLToPath(new URL(relativePath, packageRootUrl)), "utf8");
11991
11689
  }
11992
11690
  async function joinPackageMaterials(relativePaths) {
11993
11691
  const chunks = [];
@@ -12045,7 +11743,7 @@ __export(auditor_soul_exports, {
12045
11743
  readAuditorResumeBinding: () => readAuditorResumeBinding,
12046
11744
  resolveAuditorSubject: () => resolveAuditorSubject
12047
11745
  });
12048
- import { basename as basename11 } from "node:path";
11746
+ import { basename as basename10 } from "node:path";
12049
11747
  function auditorSoulRelativePath(role) {
12050
11748
  return `souls/${role}-auditor.md`;
12051
11749
  }
@@ -12081,7 +11779,7 @@ function loadAuditorReferenceMaterialsFromSubjectInput(raw) {
12081
11779
  return loadAuditorReferenceMaterials(resolveAuditorSubject(raw));
12082
11780
  }
12083
11781
  function subjectFromSourceDirectory(sourceRunDirectory) {
12084
- const role = parseRunLeaf(basename11(sourceRunDirectory))?.role;
11782
+ const role = parseRunLeaf(basename10(sourceRunDirectory))?.role;
12085
11783
  return isAuditorSoulRole(role) ? role : void 0;
12086
11784
  }
12087
11785
  async function readAuditorResumeBinding(runDirectory) {
@@ -12121,7 +11819,7 @@ var init_auditor_soul = __esm({
12121
11819
 
12122
11820
  // src/public-cli/machine-method-skills.ts
12123
11821
  import { accessSync, constants as constants2, statSync as statSync5 } from "node:fs";
12124
- import { lstat as lstat3, mkdir as mkdir2, symlink } from "node:fs/promises";
11822
+ import { lstat as lstat2, mkdir as mkdir2, symlink } from "node:fs/promises";
12125
11823
  import { join as join24 } from "node:path";
12126
11824
  import { spawnSync as spawnSync2 } from "node:child_process";
12127
11825
  function skillRoot(home) {
@@ -12151,7 +11849,7 @@ function linkedSkillRoot(home, host) {
12151
11849
  }
12152
11850
  async function occupied(path) {
12153
11851
  try {
12154
- await lstat3(path);
11852
+ await lstat2(path);
12155
11853
  return true;
12156
11854
  } catch (error) {
12157
11855
  if (error.code !== "ENOENT") throw error;
@@ -12648,7 +12346,6 @@ var init_auto_resume = __esm({
12648
12346
 
12649
12347
  // src/public-cli/post-admission.ts
12650
12348
  import { randomUUID as randomUUID6 } from "node:crypto";
12651
- import { isAbsolute as isAbsolute7, join as join25, resolve as resolve13 } from "node:path";
12652
12349
  function describeCaughtError(error) {
12653
12350
  if (error instanceof Error) {
12654
12351
  const code = error.code;
@@ -12670,7 +12367,7 @@ function projectRelocatedTurnIdentity(request, result, admitted, relocation) {
12670
12367
  mutableRequest.principal = admitted.principal;
12671
12368
  const activation = mutableRequest.activation;
12672
12369
  if (isRecord(activation)) {
12673
- for (const field of ["taskPath", "packetPath", "prerequisitesPath", "inputPath", "requestManifestPath"]) {
12370
+ for (const field of ["inputPath"]) {
12674
12371
  const record = activation;
12675
12372
  if (field in record) record[field] = rewrite(record[field]);
12676
12373
  }
@@ -13403,7 +13100,7 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
13403
13100
  prompt = request.message;
13404
13101
  }
13405
13102
  } else if (summonsPrepared !== void 0) {
13406
- prompt = officerDialogue ? summonsPrepared.instructionEmpty ? "" : summonsPrepared.instruction : buildInstructionTransportPrompt(summonsPrepared);
13103
+ prompt = officerDialogue ? summonsPrepared.instruction : buildInstructionTransportPrompt(summonsPrepared);
13407
13104
  } else if (request.summons !== void 0) {
13408
13105
  prompt = "";
13409
13106
  } else {
@@ -13484,24 +13181,14 @@ async function runSettledAutoResumeLoop(input) {
13484
13181
  })
13485
13182
  });
13486
13183
  }
13487
- function isAlreadyFrozenSummonsAttachment(runDirectory, attachmentPath) {
13488
- const absolute = isAbsolute7(attachmentPath) ? attachmentPath : resolve13(attachmentPath);
13489
- return pathContainedIn(join25(runDirectory, "attachments"), absolute);
13490
- }
13491
- async function prepareSummonsResumeMaterials(runDirectory, summons) {
13184
+ async function prepareSummonsResumeMaterials(_runDirectory, summons) {
13492
13185
  if (summons === void 0) return void 0;
13493
13186
  if (summons.instruction === void 0 && (summons.attachmentPaths?.length ?? 0) === 0) {
13494
13187
  return void 0;
13495
13188
  }
13496
13189
  const instruction = summons.instruction ?? "";
13497
- const instructionEmpty = summons.instructionEmpty ?? instruction.trim() === "";
13498
- let attachments = [];
13499
- if (summons.attachmentPaths !== void 0 && summons.attachmentPaths.length > 0) {
13500
- const alreadyFrozen = summons.attachmentPaths.every(
13501
- (path) => isAlreadyFrozenSummonsAttachment(runDirectory, path)
13502
- );
13503
- attachments = alreadyFrozen ? summons.attachmentPaths.map((frozenPath) => ({ frozenPath })) : await freezeAttachmentsIntoRun(summons.attachmentPaths, runDirectory);
13504
- }
13190
+ const instructionEmpty = summons.instructionEmpty ?? instruction.length === 0;
13191
+ const attachments = (summons.attachmentPaths ?? []).map((path) => ({ path }));
13505
13192
  return { instruction, instructionEmpty, attachments };
13506
13193
  }
13507
13194
  async function runPostAdmissionSeatResume(input) {
@@ -13550,23 +13237,6 @@ async function runPostAdmissionSeatResume(input) {
13550
13237
  openCourtAttemptId = openCourt.courtAttemptId;
13551
13238
  }
13552
13239
  }
13553
- if (request.summons !== void 0) {
13554
- const prepared = await prepareSummonsResumeMaterials(
13555
- admittedForBuild.runDirectory,
13556
- request.summons
13557
- );
13558
- if (prepared !== void 0 && (request.summons.attachmentPaths?.length ?? 0) > 0) {
13559
- request = {
13560
- ...request,
13561
- summons: {
13562
- ...request.summons,
13563
- attachmentPaths: prepared.attachments.map(
13564
- (attachment) => attachment.frozenPath
13565
- )
13566
- }
13567
- };
13568
- }
13569
- }
13570
13240
  let turnRequest = await input.buildTurnRequest(admittedForBuild, request);
13571
13241
  if (turnRequest.continuation.kind === "resume" && turnRequest.continuation.hostSessionId === void 0) {
13572
13242
  const hostSessionId = await readStoredHostSessionId(
@@ -13816,7 +13486,6 @@ var init_post_admission = __esm({
13816
13486
  init_invocation();
13817
13487
  init_submission_ledger();
13818
13488
  init_run_ticket_number();
13819
- init_activation_ledger_topology();
13820
13489
  init_session_identity();
13821
13490
  init_sitian_facade();
13822
13491
  init_receipt_delivery_policy();
@@ -13956,7 +13625,7 @@ __export(instruction_seat_run_exports, {
13956
13625
  runPublicInstructionSeat: () => runPublicInstructionSeat,
13957
13626
  runPublicInstructionSeatResume: () => runPublicInstructionSeatResume
13958
13627
  });
13959
- import { dirname as dirname15, resolve as resolve14 } from "node:path";
13628
+ import { dirname as dirname15, resolve as resolve13 } from "node:path";
13960
13629
  function unreadablePostSubmissionStatus(admitted, terminal) {
13961
13630
  if (terminal?.roleOutcome.kind !== "accepted") return void 0;
13962
13631
  const route = POST_SUBMISSION_ROUTING[admitted.role];
@@ -14184,7 +13853,7 @@ async function runOmittedLensBatch(argv, parsed, env, io) {
14184
13853
  const children = await summonParallelReviewerLenses2({
14185
13854
  argv,
14186
13855
  cwd: env.cwd,
14187
- projectRoot: resolve14(parsed.project ?? env.cwd),
13856
+ projectRoot: resolve13(parsed.project ?? env.cwd),
14188
13857
  baseRevision: parsed.baseRevision ?? "",
14189
13858
  home: env.home,
14190
13859
  agentDir: env.agentDir,
@@ -14266,14 +13935,14 @@ async function runCountersignBody(parsed, env, io) {
14266
13935
  const resumed = await resumeSameParentInstructionSeat({
14267
13936
  env,
14268
13937
  io,
14269
- projectRoot: resolve14(parsed.project ?? env.cwd),
13938
+ projectRoot: resolve13(parsed.project ?? env.cwd),
14270
13939
  role: "countersign",
14271
13940
  parentRunPath: gateParentRunPath,
14272
13941
  ...isSafePositiveTicketNumber(env.boundTicketNumber) ? { ticketNumber: env.boundTicketNumber } : {},
14273
13942
  summons: {
14274
13943
  sourceRunPath: gateParentRunPath,
14275
13944
  instruction: resumeInstruction,
14276
- instructionEmpty: resumeInstruction.trim() === ""
13945
+ instructionEmpty: resumeInstruction.length === 0
14277
13946
  }
14278
13947
  });
14279
13948
  if (resumed != null) return resumed;
@@ -14287,12 +13956,12 @@ async function runCountersignBody(parsed, env, io) {
14287
13956
  throw error;
14288
13957
  }
14289
13958
  try {
14290
- return await withPreparedAttachments(parsed.attachmentPaths ?? [], async (preparedAttachments) => {
13959
+ {
14291
13960
  const materializeAdmission = async (ticketNumber) => {
14292
13961
  await materializeCountersignInvocation(admitted, {
14293
13962
  home: env.home,
14294
13963
  principalAuthority: env.principalAuthority,
14295
- preparedAttachments,
13964
+ attachmentPaths: parsed.attachmentPaths ?? [],
14296
13965
  ...env.model === void 0 ? {} : { model: env.model },
14297
13966
  ...ticketNumber === void 0 ? {} : { ticketNumber }
14298
13967
  });
@@ -14327,7 +13996,7 @@ async function runCountersignBody(parsed, env, io) {
14327
13996
  });
14328
13997
  await relocateAdmittedRunToTicket(admitted, env.principalAuthority);
14329
13998
  return result;
14330
- });
13999
+ }
14331
14000
  } catch (error) {
14332
14001
  const rejected = usageExit(error, io);
14333
14002
  if (rejected !== void 0) return rejected;
@@ -14392,7 +14061,7 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
14392
14061
  const summons = {
14393
14062
  ...sameParentInstruction(env, {
14394
14063
  instruction: parsed.instruction ?? "",
14395
- instructionEmpty: (parsed.instruction ?? "").trim() === ""
14064
+ instructionEmpty: (parsed.instruction ?? "").length === 0
14396
14065
  }),
14397
14066
  attachmentPaths: parsed.attachmentPaths ?? []
14398
14067
  };
@@ -14417,7 +14086,7 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
14417
14086
  sourceRunPath: parentRunPath,
14418
14087
  ...sameParentInstruction(env, {
14419
14088
  instruction: parsed.instruction ?? "",
14420
- instructionEmpty: (parsed.instruction ?? "").trim() === ""
14089
+ instructionEmpty: (parsed.instruction ?? "").length === 0
14421
14090
  }),
14422
14091
  attachmentPaths: parsed.attachmentPaths ?? []
14423
14092
  };
@@ -14501,7 +14170,7 @@ async function runPublicInstructionSeat(argv, env, io, role, parseArgv2) {
14501
14170
  instruction: parsed.instruction ?? "",
14502
14171
  projectRoot: admitted.projectRoot,
14503
14172
  failureLabel: "secretariat unbound summons",
14504
- attachmentPaths: admitted.attachments.map((attachment) => attachment.frozenPath),
14173
+ attachmentPaths: admitted.attachments.map((attachment) => attachment.path),
14505
14174
  correlationId: admitted.runId
14506
14175
  }, env, io);
14507
14176
  } catch (error) {
@@ -15060,7 +14729,7 @@ var init_instruction_seat_run = __esm({
15060
14729
 
15061
14730
  // src/analyst-book-key.ts
15062
14731
  import { statSync as statSync6 } from "node:fs";
15063
- import { isAbsolute as isAbsolute8 } from "node:path";
14732
+ import { isAbsolute as isAbsolute7 } from "node:path";
15064
14733
  function resolveAnalystBookKey(projectRoot) {
15065
14734
  const identity = physicalPathIdentity(projectRoot);
15066
14735
  let stats;
@@ -15082,7 +14751,7 @@ function resolveAnalystBookKey(projectRoot) {
15082
14751
  }
15083
14752
  }
15084
14753
  function isSyntheticAnalystBookKey(bookKey) {
15085
- return bookKey.startsWith("root:") && isAbsolute8(bookKey.slice("root:".length));
14754
+ return bookKey.startsWith("root:") && isAbsolute7(bookKey.slice("root:".length));
15086
14755
  }
15087
14756
  var init_analyst_book_key = __esm({
15088
14757
  "src/analyst-book-key.ts"() {
@@ -15093,13 +14762,13 @@ var init_analyst_book_key = __esm({
15093
14762
  });
15094
14763
 
15095
14764
  // src/analyst-index.ts
15096
- import { open, readFile as readFile12, unlink } from "node:fs/promises";
15097
- import { dirname as dirname16, join as join26 } from "node:path";
14765
+ import { open, readFile as readFile11, unlink } from "node:fs/promises";
14766
+ import { dirname as dirname16, join as join25 } from "node:path";
15098
14767
  import { setTimeout as sleep } from "node:timers/promises";
15099
14768
  async function withAnalystLibraryIndexLock(ledgerHome, fn) {
15100
14769
  const indexPath = analystLibraryIndexPath(ledgerHome);
15101
14770
  ensureRealDirectoryTree(ledgerHome, dirname16(indexPath));
15102
- const lockPath = join26(dirname16(indexPath), LIBRARY_INDEX_LOCK_NAME);
14771
+ const lockPath = join25(dirname16(indexPath), LIBRARY_INDEX_LOCK_NAME);
15103
14772
  assertLedgerFileInsideHome(lockPath, ledgerHome);
15104
14773
  const startedAt = Date.now();
15105
14774
  while (true) {
@@ -15126,7 +14795,7 @@ async function withAnalystLibraryIndexLock(ledgerHome, fn) {
15126
14795
  }
15127
14796
  }
15128
14797
  function analystLibraryIndexPath(ledgerHome) {
15129
- return join26(ledgerHome, "analyst", "library-index.json");
14798
+ return join25(ledgerHome, "analyst", "library-index.json");
15130
14799
  }
15131
14800
  function rowFromIssueMetricsPage(page) {
15132
14801
  return {
@@ -15217,7 +14886,7 @@ async function readAnalystLibraryIndexPage(ledgerHome) {
15217
14886
  const path = analystLibraryIndexPath(ledgerHome);
15218
14887
  let raw;
15219
14888
  try {
15220
- raw = await readFile12(path, "utf8");
14889
+ raw = await readFile11(path, "utf8");
15221
14890
  } catch (error) {
15222
14891
  if (isMissingPathError(error)) return void 0;
15223
14892
  throw error;
@@ -15672,7 +15341,7 @@ var init_analyst_gate_cycles_read = __esm({
15672
15341
 
15673
15342
  // src/analyst-ledger.ts
15674
15343
  import { readdir as readdir3 } from "node:fs/promises";
15675
- import { basename as basename12, join as join27 } from "node:path";
15344
+ import { basename as basename11, join as join26 } from "node:path";
15676
15345
  async function readExistingRunLifecycleState(runDirectory) {
15677
15346
  return (await readRoleRunIdentity(runDirectory))?.state;
15678
15347
  }
@@ -15692,7 +15361,7 @@ function ghostLeaseCheckFromAutopsy(autopsy) {
15692
15361
  }
15693
15362
  }
15694
15363
  async function classifyGhostCandidate(input) {
15695
- const autopsy = await autopsyWriterLock(join27(input.runDirectory, "writer.lock"));
15364
+ const autopsy = await autopsyWriterLock(join26(input.runDirectory, "writer.lock"));
15696
15365
  const leaseCheck = ghostLeaseCheckFromAutopsy(autopsy);
15697
15366
  if (leaseCheck === void 0) return { kind: "live" };
15698
15367
  return {
@@ -15982,7 +15651,7 @@ async function classifyScopedRun(input) {
15982
15651
  async function scanAnalystIssueRuns(input) {
15983
15652
  const ledgerHome = resolveActivationLedgerHome(input.home);
15984
15653
  const scopeTicketNumber = input.ticketNumber;
15985
- const booksRoot = join27(ledgerHome, "books");
15654
+ const booksRoot = join26(ledgerHome, "books");
15986
15655
  let wholeBook = false;
15987
15656
  let scopeRootIdentity;
15988
15657
  let bookNames;
@@ -16015,7 +15684,7 @@ async function scanAnalystIssueRuns(input) {
16015
15684
  const ghostLegs = [];
16016
15685
  const scopeConflicts = [];
16017
15686
  for (const book of bookNames) {
16018
- const bookDir = join27(booksRoot, book);
15687
+ const bookDir = join26(booksRoot, book);
16019
15688
  let runDirectories;
16020
15689
  try {
16021
15690
  runDirectories = await listBookRunDirectories(bookDir);
@@ -16024,7 +15693,7 @@ async function scanAnalystIssueRuns(input) {
16024
15693
  throw error;
16025
15694
  }
16026
15695
  for (const runDirectory of runDirectories) {
16027
- const runName = basename12(runDirectory);
15696
+ const runName = basename11(runDirectory);
16028
15697
  const parsed = parseRunLeaf(runName);
16029
15698
  if (parsed === void 0) continue;
16030
15699
  let scopeFields;
@@ -16761,7 +16430,7 @@ var init_analyst_metric_family = __esm({
16761
16430
  });
16762
16431
 
16763
16432
  // src/analyst-page.ts
16764
- import { dirname as dirname17, join as join28 } from "node:path";
16433
+ import { dirname as dirname17, join as join27 } from "node:path";
16765
16434
  function analystIssuePageKey(address) {
16766
16435
  const parts = ["book", address.bookKey];
16767
16436
  if (address.issueNumber !== void 0) {
@@ -16772,7 +16441,7 @@ function analystIssuePageKey(address) {
16772
16441
  return sha256Hex(parts.join("\0")).slice(0, 32);
16773
16442
  }
16774
16443
  function analystIssuePagePath(ledgerHome, address) {
16775
- return join28(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
16444
+ return join27(ledgerHome, "analyst", "issues", `${analystIssuePageKey(address)}.json`);
16776
16445
  }
16777
16446
  function analystIssuePageAddressFromPage(page) {
16778
16447
  return {
@@ -17008,8 +16677,8 @@ var init_analyst_model_groups = __esm({
17008
16677
  });
17009
16678
 
17010
16679
  // src/analyst-entry.ts
17011
- import { readFile as readFile14 } from "node:fs/promises";
17012
- import { Type as Type18 } from "typebox";
16680
+ import { readFile as readFile13 } from "node:fs/promises";
16681
+ import { Type as Type17 } from "typebox";
17013
16682
  function cachedPageMatchesRequestedScope(page, input) {
17014
16683
  if (page.bookKey !== input.bookKey) return false;
17015
16684
  const requestedTicket = input.ticketNumber ?? input.issueNumber;
@@ -17036,7 +16705,7 @@ async function readOrComputeAnalystIssuePage(input, options) {
17036
16705
  ...issueNumber === void 0 && input.bookKey === void 0 ? { scopeRootIdentity: projectRoot } : {}
17037
16706
  });
17038
16707
  try {
17039
- const raw = await readFile14(pagePath, "utf8");
16708
+ const raw = await readFile13(pagePath, "utf8");
17040
16709
  const page = JSON.parse(raw);
17041
16710
  if (cachedPageMatchesRequestedScope(page, { bookKey, ...input })) {
17042
16711
  const ghostScan = await scanAnalystIssueRuns({
@@ -17137,7 +16806,7 @@ async function runAnalystModelGroupsMode(input, home) {
17137
16806
  scopeRootIdentity: projectRoot
17138
16807
  });
17139
16808
  try {
17140
- const raw = await readFile14(pagePath, "utf8");
16809
+ const raw = await readFile13(pagePath, "utf8");
17141
16810
  JSON.parse(raw);
17142
16811
  } catch (error) {
17143
16812
  if (!isMissingPathError(error)) {
@@ -17214,16 +16883,16 @@ var init_analyst_entry = __esm({
17214
16883
  }
17215
16884
  }
17216
16885
  };
17217
- analystSweepModeInputSchema = Type18.Object(
16886
+ analystSweepModeInputSchema = Type17.Object(
17218
16887
  {
17219
- mode: Type18.Literal("sweep"),
17220
- mergedPullRequests: Type18.Array(
17221
- Type18.Object(
16888
+ mode: Type17.Literal("sweep"),
16889
+ mergedPullRequests: Type17.Array(
16890
+ Type17.Object(
17222
16891
  {
17223
- projectRoot: Type18.String(),
16892
+ projectRoot: Type17.String(),
17224
16893
  /** 排除后改动行数 — omit or 0 → typed 空缺; finite ≥ 0 only. */
17225
- changedLines: Type18.Optional(
17226
- Type18.Number({ minimum: 0, maximum: Number.MAX_VALUE })
16894
+ changedLines: Type17.Optional(
16895
+ Type17.Number({ minimum: 0, maximum: Number.MAX_VALUE })
17227
16896
  )
17228
16897
  }
17229
16898
  )
@@ -17234,9 +16903,9 @@ var init_analyst_entry = __esm({
17234
16903
  });
17235
16904
 
17236
16905
  // src/public-cli/analyst-run.ts
17237
- import { readFile as readFile15 } from "node:fs/promises";
17238
- import { isAbsolute as isAbsolute9, resolve as resolve15 } from "node:path";
17239
- import { Value as Value3 } from "typebox/value";
16906
+ import { readFile as readFile14 } from "node:fs/promises";
16907
+ import { isAbsolute as isAbsolute8, resolve as resolve14 } from "node:path";
16908
+ import { Value as Value2 } from "typebox/value";
17240
16909
  function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
17241
16910
  try {
17242
16911
  return resolveBookKeyFromGit(cwd);
@@ -17271,7 +16940,7 @@ async function buildAnalystIssueModeInputFromPublicArgv(parsed, _ledgerHome) {
17271
16940
  };
17272
16941
  }
17273
16942
  function parseAnalystSweepModeInputFromJsonValue(value) {
17274
- if (!Value3.Check(analystSweepModeInputSchema, value)) {
16943
+ if (!Value2.Check(analystSweepModeInputSchema, value)) {
17275
16944
  throw new CliUsageError(
17276
16945
  "analyst sweep attachment must match AnalystSweepModeInput"
17277
16946
  );
@@ -17285,10 +16954,10 @@ async function buildAnalystSweepModeInputFromAttachmentPaths(attachmentPaths) {
17285
16954
  );
17286
16955
  }
17287
16956
  const sourcePath = attachmentPaths[0];
17288
- const absolute = isAbsolute9(sourcePath) ? sourcePath : resolve15(sourcePath);
16957
+ const absolute = isAbsolute8(sourcePath) ? sourcePath : resolve14(sourcePath);
17289
16958
  let bytes;
17290
16959
  try {
17291
- bytes = await readFile15(absolute);
16960
+ bytes = await readFile14(absolute);
17292
16961
  } catch (error) {
17293
16962
  throw new CliUsageError(
17294
16963
  `analyst sweep attachment is not a readable regular file: ${sourcePath}`,
@@ -18318,7 +17987,7 @@ __export(public_role_summons_exports, {
18318
17987
  import { execFile as execFile3 } from "node:child_process";
18319
17988
  import { existsSync as existsSync9 } from "node:fs";
18320
17989
  import { realpath as realpath6 } from "node:fs/promises";
18321
- import { join as join29 } from "node:path";
17990
+ import { join as join28 } from "node:path";
18322
17991
  import { promisify as promisify3 } from "node:util";
18323
17992
  function createCapturingIo() {
18324
17993
  const chunks = [];
@@ -18342,7 +18011,7 @@ function parentDir(path) {
18342
18011
  function walkPackageRoot(start) {
18343
18012
  let dir = start;
18344
18013
  for (let i = 0; i < 12; i += 1) {
18345
- if (existsSync9(join29(dir, "package.json")) && existsSync9(join29(dir, "souls"))) {
18014
+ if (existsSync9(join28(dir, "package.json")) && existsSync9(join28(dir, "souls"))) {
18346
18015
  return dir;
18347
18016
  }
18348
18017
  const parent = parentDir(dir);
@@ -18562,7 +18231,7 @@ async function summonPublicRole(options) {
18562
18231
  runId: resumeRunId,
18563
18232
  summons: {
18564
18233
  instruction,
18565
- instructionEmpty: instruction.trim() === ""
18234
+ instructionEmpty: instruction.length === 0
18566
18235
  }
18567
18236
  },
18568
18237
  env,
@@ -18951,7 +18620,7 @@ var init_compliance_transport = __esm({
18951
18620
  });
18952
18621
 
18953
18622
  // src/role-run-relocation.ts
18954
- import { dirname as dirname18, join as join30, sep as sep4 } from "node:path";
18623
+ import { dirname as dirname18, join as join29, sep as sep4 } from "node:path";
18955
18624
  function rewriteRunDirectoryPathValue(value, oldRunDirectory, newRunDirectory) {
18956
18625
  if (typeof value !== "string") return value;
18957
18626
  if (value === oldRunDirectory) return newRunDirectory;
@@ -19031,13 +18700,6 @@ function rewriteSourceRunLocator(value, rewrites) {
19031
18700
  function rewriteAdmittedRoleRunPage(page, rewrites) {
19032
18701
  rewriteRunDirectoryPathFieldsAgainstRewrites(page, ADMITTED_PAGE_FIELDS, rewrites);
19033
18702
  rewriteSourceRunLocator(page.sourceRun, rewrites);
19034
- if (Array.isArray(page.attachments)) {
19035
- for (const attachment of page.attachments) {
19036
- if (isRecord(attachment)) {
19037
- rewriteRunDirectoryPathFieldsAgainstRewrites(attachment, ["frozenPath"], rewrites);
19038
- }
19039
- }
19040
- }
19041
18703
  if (isRecord(page.principal)) {
19042
18704
  rewriteRunDirectoryPathFieldsAgainstRewrites(
19043
18705
  page.principal,
@@ -19062,10 +18724,9 @@ var init_role_run_relocation = __esm({
19062
18724
  // pre-#1161 pages only
19063
18725
  "sessionDirectory",
19064
18726
  "sessionFile",
19065
- "taskPath",
19066
- "packetPath",
19067
- "prerequisitesPath",
19068
- "requestManifestPath",
18727
+ // #1165/#1168: caller file-flag paths (requestManifestPath, prerequisitesPath)
18728
+ // stay as given. Obsolete copy fields (taskPath/packetPath) are not rewritten —
18729
+ // stock volumes keep their bytes; live relocate no longer maintains them.
19069
18730
  "mergerInputPath",
19070
18731
  "sourceRunPath"
19071
18732
  ];
@@ -19100,8 +18761,8 @@ __export(run_lifecycle_exports, {
19100
18761
  recordCurrentCourt: () => recordCurrentCourt,
19101
18762
  writeRoleRunState: () => writeRoleRunState
19102
18763
  });
19103
- import { chmod, lstat as lstat4, open as open2, readdir as readdir4, readFile as readFile16, unlink as unlink2 } from "node:fs/promises";
19104
- import { basename as basename13, join as join31 } from "node:path";
18764
+ import { chmod, lstat as lstat3, open as open2, readdir as readdir4, readFile as readFile15, unlink as unlink2 } from "node:fs/promises";
18765
+ import { basename as basename12, join as join30 } from "node:path";
19105
18766
  function buildAutoResumeContinuationPrompt() {
19106
18767
  return RESUME_TRANSPORT_ENVELOPE;
19107
18768
  }
@@ -19114,7 +18775,7 @@ function parseSameTicketSummonsMaterials(raw) {
19114
18775
  const record = raw;
19115
18776
  const instruction = typeof record.instruction === "string" ? record.instruction : void 0;
19116
18777
  const instructionEmpty = typeof record.instructionEmpty === "boolean" ? record.instructionEmpty : void 0;
19117
- const attachmentPaths = Array.isArray(record.attachmentPaths) ? record.attachmentPaths.filter((p) => typeof p === "string" && p.length > 0) : void 0;
18778
+ const attachmentPaths = Array.isArray(record.attachmentPaths) ? record.attachmentPaths.filter((p) => typeof p === "string") : void 0;
19118
18779
  const sourceRunPath = typeof record.sourceRunPath === "string" && record.sourceRunPath.trim() !== "" ? record.sourceRunPath : void 0;
19119
18780
  let sourceRun;
19120
18781
  if (isRecord(record.sourceRun)) {
@@ -19339,7 +19000,7 @@ function isProcessAlive(pid) {
19339
19000
  async function autopsyWriterLock(lockPath) {
19340
19001
  let content;
19341
19002
  try {
19342
- content = await readFile16(lockPath, "utf8");
19003
+ content = await readFile15(lockPath, "utf8");
19343
19004
  } catch (error) {
19344
19005
  if (errorCodeOf(error) === "ENOENT") return { verdict: "absent" };
19345
19006
  return { verdict: "unknown", reason: "unreadable", readFailure: error };
@@ -19398,7 +19059,7 @@ async function createWriterLease(lockPath, runDirectory, reportCleanupFailure) {
19398
19059
  },
19399
19060
  relocate(nextRunDirectory) {
19400
19061
  currentRunDirectory = nextRunDirectory;
19401
- currentLockPath = join31(nextRunDirectory, WRITER_LOCK_FILE);
19062
+ currentLockPath = join30(nextRunDirectory, WRITER_LOCK_FILE);
19402
19063
  },
19403
19064
  async release() {
19404
19065
  if (released) return;
@@ -19437,10 +19098,10 @@ async function acquireRunWriterLease(runDirectory, onCleanupFailure) {
19437
19098
  };
19438
19099
  const reportReadFailure = (error) => {
19439
19100
  reportDiagnostic(
19440
- `writer lease lock read failed (holder liveness unverifiable; lock left in place) at ${join31(runDirectory, WRITER_LOCK_FILE)}: ${describeErrorIdentity(error)}`
19101
+ `writer lease lock read failed (holder liveness unverifiable; lock left in place) at ${join30(runDirectory, WRITER_LOCK_FILE)}: ${describeErrorIdentity(error)}`
19441
19102
  );
19442
19103
  };
19443
- const lockPath = join31(runDirectory, WRITER_LOCK_FILE);
19104
+ const lockPath = join30(runDirectory, WRITER_LOCK_FILE);
19444
19105
  let lastAutopsy = { verdict: "absent" };
19445
19106
  let lastReclaimFailure;
19446
19107
  for (let reclaimsLeft = WRITER_LEASE_RECLAIM_ROUNDS; ; reclaimsLeft -= 1) {
@@ -19497,7 +19158,7 @@ async function acquireRunWriterLease(runDirectory, onCleanupFailure) {
19497
19158
  async function findRunDirectoryById(home, runId, onlyBookKey, onlyRole) {
19498
19159
  if (runId.trim() === "") return void 0;
19499
19160
  const ledgerHome = resolveActivationLedgerHome(home);
19500
- const booksRoot = join31(ledgerHome, "books");
19161
+ const booksRoot = join30(ledgerHome, "books");
19501
19162
  let bookKeys;
19502
19163
  try {
19503
19164
  bookKeys = await readdir4(booksRoot);
@@ -19532,7 +19193,7 @@ async function runHasFormedSessionPrincipal(runDirectory) {
19532
19193
  if (disk === void 0) return false;
19533
19194
  const sessionFile = typeof disk.principalWire.sessionFile === "string" && disk.principalWire.sessionFile.trim() !== "" ? disk.principalWire.sessionFile : sessionFileIn(disk.principalWire.sessionDirectory);
19534
19195
  try {
19535
- const stat2 = await lstat4(sessionFile);
19196
+ const stat2 = await lstat3(sessionFile);
19536
19197
  return stat2.isFile() && !stat2.isSymbolicLink();
19537
19198
  } catch (error) {
19538
19199
  if (errorCodeOf(error) === "ENOENT") return false;
@@ -19548,7 +19209,7 @@ async function findLatestRunIdForSeatTicket(input) {
19548
19209
  let runDirectories;
19549
19210
  try {
19550
19211
  runDirectories = await listBookRunDirectories(
19551
- input.ticketNumber === void 0 ? bookDir : join31(bookDir, String(input.ticketNumber))
19212
+ input.ticketNumber === void 0 ? bookDir : join30(bookDir, String(input.ticketNumber))
19552
19213
  );
19553
19214
  } catch (error) {
19554
19215
  if (errorCodeOf(error) === "ENOENT") return void 0;
@@ -19556,7 +19217,7 @@ async function findLatestRunIdForSeatTicket(input) {
19556
19217
  }
19557
19218
  let best;
19558
19219
  for (const runDirectory of runDirectories) {
19559
- const parsed = parseRunLeaf(basename13(runDirectory));
19220
+ const parsed = parseRunLeaf(basename12(runDirectory));
19560
19221
  if (parsed === void 0 || parsed.role !== input.role) continue;
19561
19222
  const runId = parsed.runId;
19562
19223
  const parentPath = await readRunParentPath(runDirectory);
@@ -19598,10 +19259,7 @@ async function loadResumableRunRecord(home, runId, authority) {
19598
19259
  let instructionEmpty = true;
19599
19260
  let attachments = [];
19600
19261
  let phase;
19601
- let taskPath;
19602
- let packetPath;
19603
19262
  let prerequisitesPath;
19604
- let prerequisites;
19605
19263
  let baseRevision;
19606
19264
  let lens;
19607
19265
  let authorityRefs;
@@ -19613,7 +19271,6 @@ async function loadResumableRunRecord(home, runId, authority) {
19613
19271
  let repository;
19614
19272
  let repositoryDisplay;
19615
19273
  let requestManifestPath;
19616
- let manifestDigest;
19617
19274
  let waitWindowMs;
19618
19275
  let issueNumber;
19619
19276
  let caseRunsPath;
@@ -19636,23 +19293,14 @@ async function loadResumableRunRecord(home, runId, authority) {
19636
19293
  instructionEmpty = record.instructionEmpty;
19637
19294
  }
19638
19295
  if (Array.isArray(record.attachments)) {
19639
- attachments = record.attachments;
19296
+ attachments = record.attachments.map((item) => normalizeAdmittedAttachment(item)).filter((item) => item !== void 0);
19640
19297
  }
19641
19298
  if (record.phase === "plan" || record.phase === "apply") {
19642
19299
  phase = record.phase;
19643
19300
  }
19644
- if (typeof record.taskPath === "string" && record.taskPath.trim() !== "") {
19645
- taskPath = record.taskPath;
19646
- }
19647
- if (typeof record.packetPath === "string" && record.packetPath.trim() !== "") {
19648
- packetPath = record.packetPath;
19649
- }
19650
- if (typeof record.prerequisitesPath === "string" && record.prerequisitesPath.trim() !== "") {
19301
+ if (typeof record.prerequisitesPath === "string") {
19651
19302
  prerequisitesPath = record.prerequisitesPath;
19652
19303
  }
19653
- if (Array.isArray(record.prerequisites)) {
19654
- prerequisites = record.prerequisites;
19655
- }
19656
19304
  if (typeof record.baseRevision === "string" && record.baseRevision.trim() !== "") {
19657
19305
  baseRevision = record.baseRevision;
19658
19306
  }
@@ -19668,12 +19316,9 @@ async function loadResumableRunRecord(home, runId, authority) {
19668
19316
  if (typeof record.repositoryDisplay === "string" && record.repositoryDisplay.trim() !== "") {
19669
19317
  repositoryDisplay = record.repositoryDisplay;
19670
19318
  }
19671
- if (typeof record.requestManifestPath === "string" && record.requestManifestPath.trim() !== "") {
19319
+ if (typeof record.requestManifestPath === "string") {
19672
19320
  requestManifestPath = record.requestManifestPath;
19673
19321
  }
19674
- if (typeof record.manifestDigest === "string" && record.manifestDigest.trim() !== "") {
19675
- manifestDigest = record.manifestDigest;
19676
- }
19677
19322
  if (typeof record.waitWindowMs === "number" && Number.isSafeInteger(record.waitWindowMs) && record.waitWindowMs >= 1) {
19678
19323
  waitWindowMs = record.waitWindowMs;
19679
19324
  }
@@ -19767,7 +19412,7 @@ async function loadResumableRunRecord(home, runId, authority) {
19767
19412
  );
19768
19413
  }
19769
19414
  }
19770
- const sourceRunLeaf = parseRunLeaf(basename13(sourceRunPath ?? ""));
19415
+ const sourceRunLeaf = parseRunLeaf(basename12(sourceRunPath ?? ""));
19771
19416
  const referencedRunId = sourceRun?.runId ?? sourceRunLeaf?.runId;
19772
19417
  const referencedRole = sourceRun?.role ?? sourceRunLeaf?.role;
19773
19418
  if (referencedRunId !== void 0 && referencedRunId !== "") {
@@ -19792,10 +19437,7 @@ async function loadResumableRunRecord(home, runId, authority) {
19792
19437
  instructionEmpty,
19793
19438
  attachments,
19794
19439
  ...phase === void 0 ? {} : { phase },
19795
- ...taskPath === void 0 ? {} : { taskPath },
19796
- ...packetPath === void 0 ? {} : { packetPath },
19797
19440
  ...prerequisitesPath === void 0 ? {} : { prerequisitesPath },
19798
- ...prerequisites === void 0 ? {} : { prerequisites },
19799
19441
  ...baseRevision === void 0 ? {} : { baseRevision },
19800
19442
  ...lens === void 0 ? {} : { lens },
19801
19443
  ...authorityRefs === void 0 ? {} : { authorityRefs },
@@ -19807,7 +19449,6 @@ async function loadResumableRunRecord(home, runId, authority) {
19807
19449
  ...repository === void 0 ? {} : { repository },
19808
19450
  ...repositoryDisplay === void 0 ? {} : { repositoryDisplay },
19809
19451
  ...requestManifestPath === void 0 ? {} : { requestManifestPath },
19810
- ...manifestDigest === void 0 ? {} : { manifestDigest },
19811
19452
  ...waitWindowMs === void 0 ? {} : { waitWindowMs },
19812
19453
  ...issueNumber === void 0 ? {} : { issueNumber },
19813
19454
  ...caseRunsPath === void 0 ? {} : { caseRunsPath },
@@ -19881,12 +19522,6 @@ function admitResumedRole(loaded) {
19881
19522
  }
19882
19523
  case "worker-task": {
19883
19524
  const phase = resumedWorkerPhase(fields.phase ?? loaded.run.phase, record.phases, role, runId);
19884
- const taskPath = fields.taskPath;
19885
- if (taskPath === void 0) {
19886
- throw new CliUsageError(
19887
- `role run admitted coder task path is missing: ${runId}`
19888
- );
19889
- }
19890
19525
  if (fields.instruction.trim() === "") {
19891
19526
  throw new CliUsageError(
19892
19527
  `role run admitted coder task is blank: ${runId}`
@@ -19896,33 +19531,23 @@ function admitResumedRole(loaded) {
19896
19531
  role: "coder",
19897
19532
  phase,
19898
19533
  ...base,
19899
- instructionEmpty: false,
19900
- taskPath
19534
+ instructionEmpty: false
19901
19535
  };
19902
19536
  return admitted;
19903
19537
  }
19904
19538
  case "worker-packet": {
19905
19539
  const phase = resumedWorkerPhase(fields.phase ?? loaded.run.phase, record.phases, role, runId);
19906
- const packetPath = fields.packetPath;
19907
- if (packetPath === void 0) {
19908
- throw new CliUsageError(
19909
- `role run admitted fixer packet path is missing: ${runId}`
19910
- );
19911
- }
19912
19540
  if (fields.instruction.trim() === "") {
19913
19541
  throw new CliUsageError(
19914
19542
  `role run admitted fixer instruction is blank: ${runId}`
19915
19543
  );
19916
19544
  }
19917
- const prerequisites = fields.prerequisites ?? Object.freeze([]);
19918
19545
  const admitted = {
19919
19546
  role: "fixer",
19920
19547
  phase,
19921
19548
  ...base,
19922
19549
  instructionEmpty: false,
19923
- packetPath,
19924
- ...fields.prerequisitesPath === void 0 ? {} : { prerequisitesPath: fields.prerequisitesPath },
19925
- prerequisites
19550
+ ...fields.prerequisitesPath === void 0 ? {} : { prerequisitesPath: fields.prerequisitesPath }
19926
19551
  };
19927
19552
  return admitted;
19928
19553
  }
@@ -19997,8 +19622,8 @@ function admitResumedRole(loaded) {
19997
19622
  return admitted;
19998
19623
  }
19999
19624
  case "collect-target": {
20000
- const { prNumber, repository, repositoryDisplay, manifestDigest } = fields;
20001
- if (repository === void 0 || repositoryDisplay === void 0 || manifestDigest === void 0) {
19625
+ const { prNumber, repository, repositoryDisplay } = fields;
19626
+ if (repository === void 0 || repositoryDisplay === void 0) {
20002
19627
  throw new CliUsageError(
20003
19628
  `role run admitted collector repository identity is missing: ${runId}`
20004
19629
  );
@@ -20021,8 +19646,7 @@ function admitResumedRole(loaded) {
20021
19646
  ...prNumber === void 0 ? {} : { prNumber },
20022
19647
  repository: parsedRepository,
20023
19648
  ...fields.requestManifestPath === void 0 ? {} : { requestManifestPath: fields.requestManifestPath },
20024
- ...fields.waitWindowMs === void 0 ? {} : { waitWindowMs: fields.waitWindowMs },
20025
- manifestDigest
19649
+ ...fields.waitWindowMs === void 0 ? {} : { waitWindowMs: fields.waitWindowMs }
20026
19650
  };
20027
19651
  return admitted;
20028
19652
  }
@@ -20105,7 +19729,7 @@ var init_run_lifecycle = __esm({
20105
19729
  });
20106
19730
 
20107
19731
  // src/archivist-record-topology.ts
20108
- import { join as join32 } from "node:path";
19732
+ import { join as join31 } from "node:path";
20109
19733
  function resolveNavigatorWorkSubjectPlacement(input) {
20110
19734
  let ledgerHome;
20111
19735
  if (input.parentSessionFile !== void 0 && input.parentSessionFile.length > 0) {
@@ -20118,7 +19742,7 @@ function resolveNavigatorWorkSubjectPlacement(input) {
20118
19742
  const digest = sha256Hex(input.subject).slice(0, 32);
20119
19743
  return {
20120
19744
  ledgerHome,
20121
- sessionDir: join32(
19745
+ sessionDir: join31(
20122
19746
  activationBookDirectory(ledgerHome, resolveBookKeyFromGit(input.cwd)),
20123
19747
  NAVIGATOR_RECORD_KIND,
20124
19748
  digest
@@ -20191,7 +19815,7 @@ import {
20191
19815
  statSync as statSync7,
20192
19816
  writeFileSync as writeFileSync2
20193
19817
  } from "node:fs";
20194
- import { dirname as dirname19, resolve as resolve16, join as join33 } from "node:path";
19818
+ import { dirname as dirname19, resolve as resolve15, join as join32 } from "node:path";
20195
19819
  import { StringDecoder } from "node:string_decoder";
20196
19820
  function readCurrentSession(sessionDir) {
20197
19821
  const ledger = currentSessionLedgerPath(sessionDir);
@@ -20225,7 +19849,7 @@ function isCurrentSessionClaimRace(error) {
20225
19849
  return errnoCode(error.cause) === "EEXIST";
20226
19850
  }
20227
19851
  function currentSessionLedgerPath(sessionDir) {
20228
- return join33(sessionDir, CURRENT_SESSION_LEDGER);
19852
+ return join32(sessionDir, CURRENT_SESSION_LEDGER);
20229
19853
  }
20230
19854
  function readBoundedSessionHeader(filePath) {
20231
19855
  const fd = openSync(filePath, "r");
@@ -20298,8 +19922,8 @@ function parseSessionHeaderLine(line2) {
20298
19922
  };
20299
19923
  }
20300
19924
  function mostRecentNavigatorSessionFile(sessionDir, cwd) {
20301
- const absoluteSessionDir = resolve16(sessionDir);
20302
- const absoluteCwd = resolve16(cwd);
19925
+ const absoluteSessionDir = resolve15(sessionDir);
19926
+ const absoluteCwd = resolve15(cwd);
20303
19927
  let names;
20304
19928
  try {
20305
19929
  names = readdirSync3(absoluteSessionDir);
@@ -20312,7 +19936,7 @@ function mostRecentNavigatorSessionFile(sessionDir, cwd) {
20312
19936
  const matched = [];
20313
19937
  for (const name of names) {
20314
19938
  if (!name.endsWith(".jsonl")) continue;
20315
- const filePath = join33(absoluteSessionDir, name);
19939
+ const filePath = join32(absoluteSessionDir, name);
20316
19940
  let st;
20317
19941
  try {
20318
19942
  st = statSync7(filePath);
@@ -20334,7 +19958,7 @@ function mostRecentNavigatorSessionFile(sessionDir, cwd) {
20334
19958
  }
20335
19959
  if (header === void 0) continue;
20336
19960
  if (typeof header.cwd !== "string" || header.cwd.length === 0) continue;
20337
- if (resolve16(header.cwd) !== absoluteCwd) continue;
19961
+ if (resolve15(header.cwd) !== absoluteCwd) continue;
20338
19962
  matched.push({ path: filePath, mtimeMs: st.mtimeMs });
20339
19963
  }
20340
19964
  if (matched.length === 0) return void 0;
@@ -20364,8 +19988,8 @@ function resolveNavigatorNestContinuation(sessionDir, cwd) {
20364
19988
  }
20365
19989
  }
20366
19990
  function assertRecentFinalFileUnderSessionDir(sessionDir, recentFile) {
20367
- const absoluteSessionDir = resolve16(sessionDir);
20368
- const absoluteFile = resolve16(recentFile);
19991
+ const absoluteSessionDir = resolve15(sessionDir);
19992
+ const absoluteFile = resolve15(recentFile);
20369
19993
  if (absoluteFile !== absoluteSessionDir && !pathContainedIn(absoluteSessionDir, absoluteFile)) {
20370
19994
  throw new ActivationLedgerError(
20371
19995
  `archivist record session must be under the authorized nest (${sessionDir}): ${recentFile}`
@@ -20420,7 +20044,7 @@ function createRecordSessionOpen(options, host = piRecordSessionHost) {
20420
20044
  throw new Error("Durable record ownership requires a parent session inside the ledger home");
20421
20045
  } else {
20422
20046
  ledgerHome = resolveActivationLedgerHomeForPath(parentFile);
20423
- const parentResolved = resolve16(parentFile);
20047
+ const parentResolved = resolve15(parentFile);
20424
20048
  if (!physicallyContainedIn(ledgerHome, parentResolved)) {
20425
20049
  throw new Error("Durable record ownership requires a parent session inside the ledger home");
20426
20050
  }
@@ -20492,26 +20116,26 @@ init_host_descriptions();
20492
20116
  import { randomUUID as randomUUID10 } from "node:crypto";
20493
20117
 
20494
20118
  // src/role-runtime-dependencies.ts
20495
- import { readFile as readFile18 } from "node:fs/promises";
20119
+ import { readFile as readFile17 } from "node:fs/promises";
20496
20120
  init_doctor_evidence();
20497
20121
 
20498
20122
  // src/navigator-attendance.ts
20499
20123
  init_navigator_invocation_identity();
20500
20124
  init_packaged_role_registry();
20501
20125
  init_activation_ledger_topology();
20502
- import { resolve as resolve17 } from "node:path";
20126
+ import { resolve as resolve16 } from "node:path";
20503
20127
  import "@earendil-works/pi-coding-agent";
20504
- import { Type as Type19 } from "typebox";
20128
+ import { Type as Type18 } from "typebox";
20505
20129
 
20506
20130
  // src/navigator-public-session.ts
20507
20131
  init_host_session_record();
20508
20132
  import { existsSync as existsSync12 } from "node:fs";
20509
- import { basename as basename14 } from "node:path";
20133
+ import { basename as basename13 } from "node:path";
20510
20134
 
20511
20135
  // src/navigator-session-contracts.ts
20512
20136
  init_unknown_value();
20513
- import { Type as Type15 } from "typebox";
20514
- import { Value as Value2 } from "typebox/value";
20137
+ import { Type as Type14 } from "typebox";
20138
+ import { Value } from "typebox/value";
20515
20139
  var NAVIGATOR_PREPARE_TOOL_NAME = "ak_navigator_prepare";
20516
20140
  var NAVIGATOR_UNAVAILABLE_KEYS = /* @__PURE__ */ new Set([
20517
20141
  "context",
@@ -20615,26 +20239,26 @@ function navigatorProviderFailureFromPublicTerminal(outcome) {
20615
20239
  if (typed !== void 0) return { source: typed, cause: typed };
20616
20240
  return { source: "unknown", cause: "unknown" };
20617
20241
  }
20618
- var navigatorProviderFailureSchema = Type15.Object({
20619
- source: Type15.Union([
20620
- Type15.Literal("context"),
20621
- Type15.Literal("session"),
20622
- Type15.Literal("model"),
20623
- Type15.Literal("thinking"),
20624
- Type15.Literal("auth"),
20625
- Type15.Literal("quota"),
20626
- Type15.Literal("transport"),
20627
- Type15.Literal("unknown")
20242
+ var navigatorProviderFailureSchema = Type14.Object({
20243
+ source: Type14.Union([
20244
+ Type14.Literal("context"),
20245
+ Type14.Literal("session"),
20246
+ Type14.Literal("model"),
20247
+ Type14.Literal("thinking"),
20248
+ Type14.Literal("auth"),
20249
+ Type14.Literal("quota"),
20250
+ Type14.Literal("transport"),
20251
+ Type14.Literal("unknown")
20628
20252
  ]),
20629
- cause: Type15.Union([
20630
- Type15.Literal("context"),
20631
- Type15.Literal("session"),
20632
- Type15.Literal("model"),
20633
- Type15.Literal("thinking"),
20634
- Type15.Literal("auth"),
20635
- Type15.Literal("quota"),
20636
- Type15.Literal("transport"),
20637
- Type15.Literal("unknown")
20253
+ cause: Type14.Union([
20254
+ Type14.Literal("context"),
20255
+ Type14.Literal("session"),
20256
+ Type14.Literal("model"),
20257
+ Type14.Literal("thinking"),
20258
+ Type14.Literal("auth"),
20259
+ Type14.Literal("quota"),
20260
+ Type14.Literal("transport"),
20261
+ Type14.Literal("unknown")
20638
20262
  ])
20639
20263
  }, { additionalProperties: false });
20640
20264
  function parseNavigatorModelSetting(value) {
@@ -20816,7 +20440,7 @@ async function resolveNavigatorLedgerHome(context) {
20816
20440
  }
20817
20441
  var NAVIGATOR_HOST_RUN_POINTER_ENTRY = "ak-navigator-host-run";
20818
20442
  function runIdFromNavigatorDirectory(runDirectory) {
20819
- const parsed = parseRunLeaf(basename14(runDirectory));
20443
+ const parsed = parseRunLeaf(basename13(runDirectory));
20820
20444
  if (parsed === void 0 || parsed.role !== "navigator") return void 0;
20821
20445
  return parsed.runId;
20822
20446
  }
@@ -21012,8 +20636,8 @@ function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
21012
20636
  return void 0;
21013
20637
  }
21014
20638
  var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
21015
- var prepareSchema = Type19.Object({
21016
- prose: Type19.Optional(Type19.Unknown({
20639
+ var prepareSchema = Type18.Object({
20640
+ prose: Type18.Optional(Type18.Unknown({
21017
20641
  description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7ED3\u6784\u3002"
21018
20642
  }))
21019
20643
  }, { additionalProperties: true });
@@ -21053,7 +20677,7 @@ function navigatorSubjectKey(subjectRoot, subject, provenance = "role_input") {
21053
20677
  }
21054
20678
  function navigatorSubjectKeyForInput(subjectRoot, reference, cwd = process.cwd()) {
21055
20679
  if (issueRoot(subjectRoot) !== void 0 || !subjectRoot.includes("/.ak/work/")) return subjectRoot;
21056
- const resolvedReference = resolve17(cwd, reference);
20680
+ const resolvedReference = resolve16(cwd, reference);
21057
20681
  const marker = "/runs/";
21058
20682
  if (resolvedReference.includes(marker)) {
21059
20683
  return subjectRoot;
@@ -21450,8 +21074,8 @@ init_role_run_placement();
21450
21074
  init_doctor_evidence();
21451
21075
  init_unknown_value();
21452
21076
  init_host_contracts();
21453
- import { readFile as readFile17 } from "node:fs/promises";
21454
- import { resolve as resolve18 } from "node:path";
21077
+ import { readFile as readFile16 } from "node:fs/promises";
21078
+ import { resolve as resolve17 } from "node:path";
21455
21079
  init_notary_source_run();
21456
21080
  init_packaged_role_registry();
21457
21081
  init_invocation();
@@ -21459,12 +21083,12 @@ function navigatorInputReference(getFlag, role) {
21459
21083
  if (getFlag === void 0) return void 0;
21460
21084
  const name = packagedRoleInputFlag(role);
21461
21085
  const value = name === void 0 ? void 0 : getFlag(name);
21462
- return typeof value === "string" && value !== "" ? resolve18(value) : void 0;
21086
+ return typeof value === "string" && value !== "" ? resolve17(value) : void 0;
21463
21087
  }
21464
21088
  async function loadNavigatorWorkContext(options) {
21465
21089
  const reference = navigatorInputReference(options.getFlag, options.role);
21466
21090
  const subjectMode = packagedNavigatorSubject(options.role);
21467
- const input = reference === void 0 || subjectMode === "case" || subjectMode === "source-run" ? void 0 : await readFile17(reference, "utf8");
21091
+ const input = reference === void 0 || subjectMode === "case" || subjectMode === "source-run" ? void 0 : await readFile16(reference, "utf8");
21468
21092
  const subjectRoot = subjectPath(reference ?? options.context.sessionManager.getSessionDir(), options.context.cwd);
21469
21093
  let subjectKey = reference === void 0 ? subjectRoot : navigatorSubjectKeyForInput(subjectRoot, reference, options.context.cwd);
21470
21094
  let subject = input ?? `work subject: ${subjectKey}`;
@@ -21481,7 +21105,7 @@ async function loadNavigatorWorkContext(options) {
21481
21105
  }
21482
21106
  const publicRunDir = runDirectoryFromHostContext(options.context);
21483
21107
  const currentSessionDir = options.context.sessionManager.getSessionDir();
21484
- const isBoundPublicRun = publicRunDir !== void 0 && resolve18(currentSessionDir) === resolve18(sessionDirectoryOf(publicRunDir));
21108
+ const isBoundPublicRun = publicRunDir !== void 0 && resolve17(currentSessionDir) === resolve17(sessionDirectoryOf(publicRunDir));
21485
21109
  if (subjectMode === "public-instruction" && isBoundPublicRun) {
21486
21110
  let admitted;
21487
21111
  try {
@@ -21514,14 +21138,14 @@ async function loadNavigatorWorkContext(options) {
21514
21138
  }
21515
21139
  const workRoot = subjectRoot.includes("/.ak/work/") ? subjectRoot : void 0;
21516
21140
  const authorityFiles = workRoot === void 0 ? [] : [
21517
- resolve18(workRoot, "authority.md"),
21518
- resolve18(workRoot, "authority.txt"),
21519
- resolve18(workRoot, "design-v2/owner-direction.md")
21141
+ resolve17(workRoot, "authority.md"),
21142
+ resolve17(workRoot, "authority.txt"),
21143
+ resolve17(workRoot, "design-v2/owner-direction.md")
21520
21144
  ];
21521
21145
  let authorityMaterial;
21522
21146
  for (const path of authorityFiles) {
21523
21147
  try {
21524
- const content = await readFile17(path, "utf8");
21148
+ const content = await readFile16(path, "utf8");
21525
21149
  if (content.trim() !== "") {
21526
21150
  authorityMaterial = content;
21527
21151
  break;
@@ -21554,22 +21178,22 @@ init_submission_ledger();
21554
21178
  init_filed_submission();
21555
21179
  import { randomUUID as randomUUID7 } from "node:crypto";
21556
21180
  import { writeSync as writeSync2 } from "node:fs";
21557
- import { join as join35 } from "node:path";
21558
- import { Value as Value4 } from "typebox/value";
21181
+ import { join as join34 } from "node:path";
21182
+ import { Value as Value3 } from "typebox/value";
21559
21183
 
21560
21184
  // src/activation-trace.ts
21561
- import { Type as Type20 } from "typebox";
21562
- var causeSchema = Type20.Object({
21563
- identity: Type20.String({ minLength: 1 }),
21564
- name: Type20.String({ minLength: 1 }),
21565
- message: Type20.String(),
21566
- evidenceId: Type20.Optional(Type20.String({ minLength: 1 }))
21185
+ import { Type as Type19 } from "typebox";
21186
+ var causeSchema = Type19.Object({
21187
+ identity: Type19.String({ minLength: 1 }),
21188
+ name: Type19.String({ minLength: 1 }),
21189
+ message: Type19.String(),
21190
+ evidenceId: Type19.Optional(Type19.String({ minLength: 1 }))
21567
21191
  }, { additionalProperties: false });
21568
- var activationTraceRecordSchema = Type20.Object({
21569
- role: Type20.String({ minLength: 1 }),
21570
- stageId: Type20.String({ pattern: "^[a-z][a-z0-9-]*$" }),
21571
- status: Type20.Literal("failed"),
21572
- timestamp: Type20.String({ format: "date-time" }),
21192
+ var activationTraceRecordSchema = Type19.Object({
21193
+ role: Type19.String({ minLength: 1 }),
21194
+ stageId: Type19.String({ pattern: "^[a-z][a-z0-9-]*$" }),
21195
+ status: Type19.Literal("failed"),
21196
+ timestamp: Type19.String({ format: "date-time" }),
21573
21197
  cause: causeSchema
21574
21198
  }, { additionalProperties: false });
21575
21199
  var activationCauseEvidence = 0;
@@ -21606,7 +21230,7 @@ import {
21606
21230
  statSync as statSync8,
21607
21231
  writeFileSync as writeFileSync3
21608
21232
  } from "node:fs";
21609
- import { isAbsolute as isAbsolute11, resolve as resolve19 } from "node:path";
21233
+ import { isAbsolute as isAbsolute10, resolve as resolve18 } from "node:path";
21610
21234
  var ActivationSessionFileMissingError = class extends Error {
21611
21235
  code = "AK_ACTIVATION_SESSION_FILE_MISSING";
21612
21236
  path;
@@ -21646,12 +21270,12 @@ function durableSessionPointer(sessionManager) {
21646
21270
  "Workflow role activation requires a durable Pi session file principal (getSessionFile); directory-only or --no-session invocations are rejected"
21647
21271
  );
21648
21272
  }
21649
- if (!isAbsolute11(file)) {
21273
+ if (!isAbsolute10(file)) {
21650
21274
  throw new Error(
21651
21275
  `Workflow role activation requires an absolute durable session file path; got relative path: ${file}`
21652
21276
  );
21653
21277
  }
21654
- const resolvedFile = resolve19(file);
21278
+ const resolvedFile = resolve18(file);
21655
21279
  try {
21656
21280
  lstatSync2(resolvedFile);
21657
21281
  } catch (error) {
@@ -21734,10 +21358,10 @@ init_engine_material();
21734
21358
  init_engine_detour();
21735
21359
  init_engine_detour_usage();
21736
21360
  init_run_terminal_artifacts();
21737
- import { Type as Type21 } from "typebox";
21738
- var engineDetourArgsSchema = Type21.Object(
21361
+ import { Type as Type20 } from "typebox";
21362
+ var engineDetourArgsSchema = Type20.Object(
21739
21363
  {
21740
- argv: Type21.Array(Type21.String({ minLength: 1 }), {
21364
+ argv: Type20.Array(Type20.String({ minLength: 1 }), {
21741
21365
  minItems: 1,
21742
21366
  description: "\u9996\u9879\u4E3A PATH \u4E2D\u7684\u53EF\u6267\u884C\u6587\u4EF6\uFF0C\u5176\u4F59\u9879\u4E3A\u53C2\u6570\u3002"
21743
21367
  })
@@ -21895,7 +21519,7 @@ var COLLECTOR_TRANSPORT_FLAGS = Object.freeze([
21895
21519
  Object.freeze({
21896
21520
  name: "ak-collector-request-manifest",
21897
21521
  definition: Object.freeze({
21898
- description: "Path to the Collector v1 request manifest JSON file (caller guidance; not a machine collection directive).",
21522
+ description: "Caller path to a request manifest JSON file (passed as-is; package does not read or validate).",
21899
21523
  type: "string"
21900
21524
  })
21901
21525
  })
@@ -21906,19 +21530,9 @@ function buildMethodContext(activation) {
21906
21530
  `host: github.com`,
21907
21531
  `repository: ${activation.repository.canonical}`,
21908
21532
  `prNumber: ${activation.prNumber === void 0 ? "\u672A\u7ED1\u5B9A" : String(activation.prNumber)}`,
21909
- `requests: ${JSON.stringify(activation.manifest.requests.map((request) => ({ id: request.id })))}`,
21910
- `manifestDigest: ${activation.manifest.digest}`,
21533
+ ...activation.requestManifestPath === void 0 ? [] : [`requestManifestPath: ${activation.requestManifestPath}`],
21911
21534
  "</collector_method>"
21912
21535
  ];
21913
- if (activation.manifest.requests.length > 0) {
21914
- const payload = JSON.stringify({
21915
- requests: activation.manifest.requests.map((request) => ({
21916
- id: request.id,
21917
- body: request.requestBody
21918
- }))
21919
- }).replaceAll("<", "\\u003c");
21920
- lines.push("", "<collector_request_manifest>", payload, "</collector_request_manifest>");
21921
- }
21922
21536
  return lines.join("\n");
21923
21537
  }
21924
21538
  function createCollectorRoleRuntime(pi, dependencies) {
@@ -21940,12 +21554,12 @@ function createCollectorRoleRuntime(pi, dependencies) {
21940
21554
  } else if (typeof prFlag === "number") {
21941
21555
  prNumber = parseCollectorPrNumber(prFlag);
21942
21556
  }
21943
- const manifest = typeof requestManifestFlag === "string" && requestManifestFlag.trim().length > 0 ? await loadCollectorManifest(requestManifestFlag) : emptyCollectorManifest();
21557
+ const requestManifestPath = typeof requestManifestFlag === "string" ? requestManifestFlag : void 0;
21944
21558
  return {
21945
21559
  soul,
21946
21560
  repository,
21947
21561
  prNumber,
21948
- manifest
21562
+ ...requestManifestPath === void 0 ? {} : { requestManifestPath }
21949
21563
  };
21950
21564
  },
21951
21565
  assembleMaterials(activation, baseSystemPrompt) {
@@ -22268,7 +21882,6 @@ init_worker_output();
22268
21882
  init_fixer_output();
22269
21883
  init_filed_submission();
22270
21884
  init_role_submission_declarations();
22271
- init_fixer_packet();
22272
21885
 
22273
21886
  // src/worker-submission-gates.ts
22274
21887
  init_archivist_record_entry();
@@ -22281,7 +21894,7 @@ init_submission_errors();
22281
21894
  init_worker_submission_contracts();
22282
21895
  import { execFileSync as execFileSync3 } from "node:child_process";
22283
21896
  import { existsSync as existsSync13, lstatSync as lstatSync3, readdirSync as readdirSync4, readFileSync as readFileSync5, rmdirSync, rmSync as rmSync3 } from "node:fs";
22284
- import { resolve as resolve20 } from "node:path";
21897
+ import { resolve as resolve19 } from "node:path";
22285
21898
  var WORKER_SUBMISSION_GATE_RECORD_KIND = WORKER_SUBMISSION_GATE_KIND;
22286
21899
  var WORKER_COMMIT_BASELINE_ENTRY_TYPE = "commit-baseline";
22287
21900
  var WORKER_COMMIT_REMINDER_BOUNCE_ENTRY_TYPE = "commit-reminder-bounce";
@@ -22329,7 +21942,7 @@ function escapeGitConfigValueRegex(value) {
22329
21942
  function unsetOwnedHooksPath(file) {
22330
21943
  const owned = [];
22331
21944
  for (const value of tryGetAll(file, "core.hooksPath")) {
22332
- if (!ownedHook(resolve20(value, HOOK_FILE))) continue;
21945
+ if (!ownedHook(resolve19(value, HOOK_FILE))) continue;
22333
21946
  try {
22334
21947
  gitFile(file, [
22335
21948
  "--unset-all",
@@ -22344,15 +21957,15 @@ function unsetOwnedHooksPath(file) {
22344
21957
  return owned;
22345
21958
  }
22346
21959
  function rmOwnedDir(dir) {
22347
- const hookPath = resolve20(dir, HOOK_FILE);
21960
+ const hookPath = resolve19(dir, HOOK_FILE);
22348
21961
  if (!ownedHook(hookPath)) return;
22349
21962
  rmSync3(hookPath, { force: true });
22350
21963
  if (existsSync13(dir) && readdirSync4(dir).length === 0) rmdirSync(dir);
22351
21964
  }
22352
21965
  function linkedGitDirs(commonDir) {
22353
- const root = resolve20(commonDir, "worktrees");
21966
+ const root = resolve19(commonDir, "worktrees");
22354
21967
  if (!existsSync13(root)) return [];
22355
- return readdirSync4(root).map((name) => resolve20(root, name)).filter((dir) => lstatSync3(dir).isDirectory());
21968
+ return readdirSync4(root).map((name) => resolve19(root, name)).filter((dir) => lstatSync3(dir).isDirectory());
22356
21969
  }
22357
21970
  function uninstallPackageWorkerHooks(cwd) {
22358
21971
  let inside;
@@ -22366,14 +21979,14 @@ function uninstallPackageWorkerHooks(cwd) {
22366
21979
  const clear = (configFile) => {
22367
21980
  for (const hooks of unsetOwnedHooksPath(configFile)) rmOwnedDir(hooks);
22368
21981
  };
22369
- clear(resolve20(commonDir, "config"));
22370
- clear(resolve20(commonDir, "config.worktree"));
22371
- rmOwnedDir(resolve20(commonDir, HOOKS_DIR));
22372
- const legacy = resolve20(commonDir, "hooks", HOOK_FILE);
21982
+ clear(resolve19(commonDir, "config"));
21983
+ clear(resolve19(commonDir, "config.worktree"));
21984
+ rmOwnedDir(resolve19(commonDir, HOOKS_DIR));
21985
+ const legacy = resolve19(commonDir, "hooks", HOOK_FILE);
22373
21986
  if (ownedHook(legacy)) rmSync3(legacy, { force: true });
22374
21987
  for (const gitDir of linkedGitDirs(commonDir)) {
22375
- clear(resolve20(gitDir, "config.worktree"));
22376
- rmOwnedDir(resolve20(gitDir, HOOKS_DIR));
21988
+ clear(resolve19(gitDir, "config.worktree"));
21989
+ rmOwnedDir(resolve19(gitDir, HOOKS_DIR));
22377
21990
  }
22378
21991
  }
22379
21992
  function containsWrittenReason(value) {
@@ -22558,20 +22171,6 @@ function fixerBashSeatbeltDenyReason(matched) {
22558
22171
  init_unknown_value();
22559
22172
  init_worker_output();
22560
22173
  var FIXER_FLAG_DEFINITIONS = {
22561
- packet: {
22562
- name: "ak-fix-packet",
22563
- definition: {
22564
- description: "Path to opaque prose instructions for the Fixer",
22565
- type: "string"
22566
- }
22567
- },
22568
- prerequisites: {
22569
- name: "ak-fixer-prerequisites",
22570
- definition: {
22571
- description: "Optional path to a JSON array of typed Fixer prerequisites",
22572
- type: "string"
22573
- }
22574
- },
22575
22174
  phase: {
22576
22175
  name: "ak-fixer-phase",
22577
22176
  definition: {
@@ -22630,22 +22229,11 @@ function assertAcceptableThroughHost(submissionGate, status, details, hostAction
22630
22229
  }
22631
22230
  function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
22632
22231
  let soul;
22633
- let packet;
22634
- let packetPath;
22635
- let prerequisitesPath;
22636
22232
  let phase;
22637
22233
  let lifecycleRegistered = false;
22638
22234
  const submissionGate = createWorkerSubmissionGate({
22639
22235
  unfinishedReasonBounceLimit: options?.unfinishedReasonBounceLimit ?? deliveryLimitFromEnv(process.env)
22640
22236
  });
22641
- pi.registerFlag(
22642
- FIXER_FLAG_DEFINITIONS.packet.name,
22643
- FIXER_FLAG_DEFINITIONS.packet.definition
22644
- );
22645
- pi.registerFlag(
22646
- FIXER_FLAG_DEFINITIONS.prerequisites.name,
22647
- FIXER_FLAG_DEFINITIONS.prerequisites.definition
22648
- );
22649
22237
  pi.registerFlag(
22650
22238
  FIXER_FLAG_DEFINITIONS.phase.name,
22651
22239
  FIXER_FLAG_DEFINITIONS.phase.definition
@@ -22661,29 +22249,11 @@ function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
22661
22249
  );
22662
22250
  }
22663
22251
  phase = selectedPhase;
22664
- const resolvedPacketPath = pi.getFlag(FIXER_FLAG_DEFINITIONS.packet.name);
22665
- if (typeof resolvedPacketPath !== "string" || resolvedPacketPath.trim().length === 0) {
22666
- throw new Error("Fixer role requires --ak-fix-packet");
22667
- }
22668
- packetPath = resolvedPacketPath;
22669
- const instructions = await dependencies.loadPacket(packetPath);
22670
- if (instructions.trim().length === 0) {
22671
- throw new FixerPacketValidationError(
22672
- new Error("Fixer instructions must be nonblank")
22673
- );
22674
- }
22675
- const resolvedPrerequisitesPath = pi.getFlag(FIXER_FLAG_DEFINITIONS.prerequisites.name);
22676
- if (resolvedPrerequisitesPath !== void 0 && (typeof resolvedPrerequisitesPath !== "string" || resolvedPrerequisitesPath.trim().length === 0)) {
22677
- throw new Error("Fixer --ak-fixer-prerequisites path must be nonblank when supplied");
22678
- }
22679
- prerequisitesPath = typeof resolvedPrerequisitesPath === "string" ? resolvedPrerequisitesPath : void 0;
22680
- const prerequisites = prerequisitesPath !== void 0 ? parseFixerPrerequisites(await dependencies.loadPacket(prerequisitesPath)) : Object.freeze([]);
22681
- packet = Object.freeze({ instructions, prerequisites });
22682
22252
  if (!lifecycleRegistered) {
22683
22253
  lifecycleRegistered = true;
22684
22254
  registerWorkerSubmission(pi, "fixer", {
22685
- notReady: "\u4FEE\u5185\u53F8\u4FEE\u7406\u5305\u4E0E\u9636\u6BB5\u672A\u88C5\u8F7D",
22686
- ready: () => packet !== void 0 && phase !== void 0,
22255
+ notReady: "\u4FEE\u5185\u53F8\u9636\u6BB5\u672A\u88C5\u8F7D",
22256
+ ready: () => phase !== void 0,
22687
22257
  phase: () => phase,
22688
22258
  project: (parameters, current) => deepFreeze2(validateFixerOutput(parameters, current)),
22689
22259
  submissionGate,
@@ -22702,12 +22272,6 @@ function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
22702
22272
  });
22703
22273
  pi.on("before_agent_start", (event) => {
22704
22274
  if (soul === void 0) throw new Error("\u4FEE\u5185\u53F8\u804C\u5206\u672A\u88C5\u8F7D");
22705
- if (packetPath === void 0) throw new Error("\u4FEE\u5185\u53F8\u4FEE\u7406\u5305\u8DEF\u5F84\u672A\u88C5\u8F7D");
22706
- const prerequisitesBlock = prerequisitesPath === void 0 ? "" : `
22707
-
22708
- <fixer_prerequisites_path>
22709
- ${prerequisitesPath}
22710
- </fixer_prerequisites_path>`;
22711
22275
  return {
22712
22276
  systemPrompt: `${event.systemPrompt}
22713
22277
 
@@ -22717,11 +22281,7 @@ ${soul}
22717
22281
 
22718
22282
  <fixer_phase>
22719
22283
  ${phase ?? ""}
22720
- </fixer_phase>
22721
-
22722
- <fix_packet_path>
22723
- ${packetPath}
22724
- </fix_packet_path>${prerequisitesBlock}`
22284
+ </fixer_phase>`
22725
22285
  };
22726
22286
  });
22727
22287
  }
@@ -22733,22 +22293,17 @@ ${packetPath}
22733
22293
  }
22734
22294
  function createCoderRoleRuntime(pi, dependencies, hostActions, options) {
22735
22295
  let soul;
22736
- let task;
22737
22296
  let phase;
22738
22297
  let lifecycleRegistered = false;
22739
22298
  const submissionGate = createWorkerSubmissionGate({
22740
22299
  unfinishedReasonBounceLimit: options?.unfinishedReasonBounceLimit ?? deliveryLimitFromEnv(process.env)
22741
22300
  });
22742
- pi.registerFlag("ak-coder-task", {
22743
- description: "Markdown task assigned to the coder role",
22744
- type: "string"
22745
- });
22746
22301
  pi.registerFlag("ak-coder-phase", {
22747
22302
  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)",
22748
22303
  type: "string"
22749
22304
  });
22750
22305
  return {
22751
- async activate(ctx) {
22306
+ async activate() {
22752
22307
  soul = (await dependencies.loadSoul()).trim();
22753
22308
  if (soul.length === 0) throw new Error("Coder soul is empty");
22754
22309
  const selectedPhase = pi.getFlag("ak-coder-phase");
@@ -22758,23 +22313,17 @@ function createCoderRoleRuntime(pi, dependencies, hostActions, options) {
22758
22313
  );
22759
22314
  }
22760
22315
  phase = selectedPhase;
22761
- const taskPath = pi.getFlag("ak-coder-task");
22762
- if (typeof taskPath !== "string" || taskPath.trim().length === 0) {
22763
- throw new Error("Coder role requires --ak-coder-task");
22764
- }
22765
- task = (await dependencies.loadTask(taskPath)).trim();
22766
- if (task.length === 0) throw new Error("Coder task is empty");
22767
22316
  if (!lifecycleRegistered) {
22768
22317
  lifecycleRegistered = true;
22769
22318
  registerWorkerSubmission(pi, "coder", {
22770
- notReady: "\u5C06\u4F5C\u76D1\u4EFB\u52A1\u4E0E\u9636\u6BB5\u672A\u88C5\u8F7D",
22771
- ready: () => task !== void 0 && phase !== void 0,
22319
+ notReady: "\u5C06\u4F5C\u76D1\u9636\u6BB5\u672A\u88C5\u8F7D",
22320
+ ready: () => phase !== void 0,
22772
22321
  phase: () => phase,
22773
22322
  project: (parameters, current) => validateWorkerOutput(parameters, current, "Coder"),
22774
22323
  submissionGate,
22775
22324
  hostActions
22776
22325
  });
22777
- pi.on("before_agent_start", (event, ctx2) => {
22326
+ pi.on("before_agent_start", (event) => {
22778
22327
  if (soul === void 0) throw new Error("\u5C06\u4F5C\u76D1\u804C\u5206\u672A\u88C5\u8F7D");
22779
22328
  return {
22780
22329
  systemPrompt: `${event.systemPrompt}
@@ -22785,11 +22334,7 @@ ${soul}
22785
22334
 
22786
22335
  <coder_phase>
22787
22336
  ${phase ?? ""}
22788
- </coder_phase>
22789
-
22790
- <coder_task>
22791
- ${task ?? ""}
22792
- </coder_task>`
22337
+ </coder_phase>`
22793
22338
  };
22794
22339
  });
22795
22340
  }
@@ -22834,7 +22379,16 @@ function createMergerRoleRuntime(pi, dependencies) {
22834
22379
  });
22835
22380
  pi.on("before_agent_start", (event) => {
22836
22381
  if (!activation) throw new Error("\u6821\u4E66\u90CE\u672A\u6FC0\u6D3B");
22837
- 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 };
22382
+ const admitted = {
22383
+ attemptId: activation.input.attemptId,
22384
+ targetObjectId: activation.input.targetObjectId,
22385
+ sourceObjectId: activation.input.sourceObjectId,
22386
+ targetIntent: materialText(activation.input, "targetIntent"),
22387
+ sourceIntent: materialText(activation.input, "sourceIntent"),
22388
+ expectedConflictPaths: activation.input.expectedConflictPaths,
22389
+ resolutionScope: activation.input.resolutionScope,
22390
+ authorizedChecks: activation.input.authorizedChecks
22391
+ };
22838
22392
  return { systemPrompt: `${event.systemPrompt}
22839
22393
 
22840
22394
  <merger_soul>
@@ -22865,7 +22419,6 @@ init_doctor_evidence();
22865
22419
  init_judge_role();
22866
22420
  init_engine_detour();
22867
22421
  init_fixer_output();
22868
- init_fixer_packet();
22869
22422
  init_auditor_soul();
22870
22423
  init_judge_auditor();
22871
22424
  init_doctor_auditor();
@@ -22977,7 +22530,7 @@ function activationStage(role, activate) {
22977
22530
  };
22978
22531
  }
22979
22532
  function validateActivationTraceRecord(record) {
22980
- if (!Value4.Check(activationTraceRecordSchema, record)) {
22533
+ if (!Value3.Check(activationTraceRecordSchema, record)) {
22981
22534
  throw new TypeError("Activation trace record does not match its closed contract");
22982
22535
  }
22983
22536
  return record;
@@ -23245,7 +22798,7 @@ function readRoleRunCoordinates(ctx, label) {
23245
22798
  if (runDirectory === void 0) throw new Error(`${label} requires AK_ROLE_RUN_DIR`);
23246
22799
  const admitted = readPageSync(runDirectory, "admitted");
23247
22800
  if (typeof admitted?.projectRoot !== "string" || admitted.projectRoot.trim() === "") {
23248
- throw new Error(`${label} state.jsonl admitted-request row missing projectRoot (${join35(runDirectory, RUN_STATE_FILE)})`);
22801
+ throw new Error(`${label} state.jsonl admitted-request row missing projectRoot (${join34(runDirectory, RUN_STATE_FILE)})`);
23249
22802
  }
23250
22803
  return {
23251
22804
  runDirectory,
@@ -23760,13 +23313,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23760
23313
  const fixer = createFixerRoleRuntime(
23761
23314
  roleHost,
23762
23315
  {
23763
- loadSoul: () => requireRoleSoul("fixer"),
23764
- async loadPacket(path) {
23765
- if (dependencies.loadFixPacket === void 0) {
23766
- throw new Error("Fixer packet loader is not configured");
23767
- }
23768
- return dependencies.loadFixPacket(path);
23769
- }
23316
+ loadSoul: () => requireRoleSoul("fixer")
23770
23317
  },
23771
23318
  hostActions,
23772
23319
  { unfinishedReasonBounceLimit: deliveryLimit }
@@ -23774,13 +23321,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
23774
23321
  const coder = createCoderRoleRuntime(
23775
23322
  roleHost,
23776
23323
  {
23777
- loadSoul: () => requireRoleSoul("coder"),
23778
- async loadTask(path) {
23779
- if (dependencies.loadCoderTask === void 0) {
23780
- throw new Error("Coder task loader is not configured");
23781
- }
23782
- return dependencies.loadCoderTask(path);
23783
- }
23324
+ loadSoul: () => requireRoleSoul("coder")
23784
23325
  },
23785
23326
  hostActions,
23786
23327
  { unfinishedReasonBounceLimit: deliveryLimit }
@@ -24095,11 +23636,9 @@ function createRoleRuntimeDependencies(packageRoot) {
24095
23636
  packageRoot,
24096
23637
  loadRoleReferenceMaterials: loadPackagedRoleReferenceMaterials,
24097
23638
  loadRoleSoul: loadRegisteredRoleSoul,
24098
- loadFixPacket: (path) => readFile18(path, "utf8"),
24099
- loadCoderTask: (path) => readFile18(path, "utf8"),
24100
23639
  loadDoctorCase,
24101
23640
  loadNotarySourceRun: loadNotarySourceRunLocator,
24102
- loadMergerInput: async (path) => JSON.parse(await readFile18(path, "utf8")),
23641
+ loadMergerInput: async (path) => JSON.parse(await readFile17(path, "utf8")),
24103
23642
  loadNavigatorWorkContext: (options) => loadNavigatorWorkContext({
24104
23643
  context: options.context,
24105
23644
  role: options.role,
@@ -24139,11 +23678,11 @@ init_settlement();
24139
23678
  init_run_lifecycle();
24140
23679
  init_unknown_value();
24141
23680
  async function listen(server, path) {
24142
- await new Promise((resolve22, reject) => {
23681
+ await new Promise((resolve21, reject) => {
24143
23682
  server.once("error", reject);
24144
23683
  server.listen(path, () => {
24145
23684
  server.off("error", reject);
24146
- resolve22();
23685
+ resolve21();
24147
23686
  });
24148
23687
  });
24149
23688
  }
@@ -24568,8 +24107,8 @@ async function prepareRoleEnvelope(options) {
24568
24107
  try {
24569
24108
  const closeAll = server.closeAllConnections;
24570
24109
  if (typeof closeAll === "function") closeAll.call(server);
24571
- await new Promise((resolve22, reject) => {
24572
- server.close((error) => error ? reject(error) : resolve22());
24110
+ await new Promise((resolve21, reject) => {
24111
+ server.close((error) => error ? reject(error) : resolve21());
24573
24112
  });
24574
24113
  } catch (error) {
24575
24114
  await retainPackageFault({
@@ -24709,9 +24248,9 @@ init_role_run_placement();
24709
24248
  import { spawn as spawn3, spawnSync as spawnSync3 } from "node:child_process";
24710
24249
  import { randomUUID as randomUUID9 } from "node:crypto";
24711
24250
  import { existsSync as existsSync14 } from "node:fs";
24712
- import { mkdtemp as mkdtemp2, rm as rm3, writeFile as writeFile6 } from "node:fs/promises";
24713
- import { tmpdir as tmpdir2 } from "node:os";
24714
- import { dirname as dirname22, isAbsolute as isAbsolute12, join as join36, resolve as resolve21 } from "node:path";
24251
+ import { mkdtemp, rm as rm2, writeFile as writeFile6 } from "node:fs/promises";
24252
+ import { tmpdir } from "node:os";
24253
+ import { dirname as dirname22, isAbsolute as isAbsolute11, join as join35, resolve as resolve20 } from "node:path";
24715
24254
 
24716
24255
  // src/external-host-turn-loop.ts
24717
24256
  init_settlement();
@@ -25250,7 +24789,7 @@ function formatCodexFailurePayload(payload) {
25250
24789
  function cwdIsGitWorkTree(cwd) {
25251
24790
  let dir = cwd;
25252
24791
  for (; ; ) {
25253
- if (existsSync14(join36(dir, ".git"))) return true;
24792
+ if (existsSync14(join35(dir, ".git"))) return true;
25254
24793
  const parent = dirname22(dir);
25255
24794
  if (parent === dir) return false;
25256
24795
  dir = parent;
@@ -25279,10 +24818,10 @@ function resolveGitCommonDir(cwd) {
25279
24818
  if (raw === "") {
25280
24819
  throw new Error("git rev-parse --git-common-dir returned empty stdout");
25281
24820
  }
25282
- return isAbsolute12(raw) ? raw : resolve21(cwd, raw);
24821
+ return isAbsolute11(raw) ? raw : resolve20(cwd, raw);
25283
24822
  }
25284
24823
  function spawnHeadlessTurn(options) {
25285
- return new Promise((resolve22, reject) => {
24824
+ return new Promise((resolve21, reject) => {
25286
24825
  if (options.signal?.aborted) {
25287
24826
  reject(hostAbortedError("headless host aborted"));
25288
24827
  return;
@@ -25348,7 +24887,7 @@ function spawnHeadlessTurn(options) {
25348
24887
  if (timer !== void 0) clearTimeout(timer);
25349
24888
  options.signal?.removeEventListener("abort", onAbort);
25350
24889
  if (stdinDeliveryError !== void 0) packageErrors.push(stdinDeliveryError);
25351
- resolve22({
24890
+ resolve21({
25352
24891
  packageErrors,
25353
24892
  code,
25354
24893
  stdout: resultStdout,
@@ -25468,8 +25007,8 @@ function createHeadlessRoleTurnHost(config) {
25468
25007
  }
25469
25008
  const env = { ...process.env, ...config.env ?? {} };
25470
25009
  const sessionParent = config.sessionIdentity.resolveSessionFile(request.principal);
25471
- const inputsDirectory = await mkdtemp2(join36(tmpdir2(), "ak-role-headless-"));
25472
- const systemPromptPath = join36(inputsDirectory, "system-prompt.txt");
25010
+ const inputsDirectory = await mkdtemp(join35(tmpdir(), "ak-role-headless-"));
25011
+ const systemPromptPath = join35(inputsDirectory, "system-prompt.txt");
25473
25012
  let mcpConfigPath;
25474
25013
  let outputSchemaPath;
25475
25014
  let startedWithSchema;
@@ -25478,13 +25017,13 @@ function createHeadlessRoleTurnHost(config) {
25478
25017
  let deliveredSchema;
25479
25018
  if (codex) {
25480
25019
  if (prepared.terminatingToolName !== NAVIGATOR_OUTPUT_TOOL_NAME) {
25481
- outputSchemaPath = join36(inputsDirectory, "output-schema.json");
25020
+ outputSchemaPath = join35(inputsDirectory, "output-schema.json");
25482
25021
  deliveredSchema = closeJsonSchemaForCodex(prepared.jsonSchema);
25483
25022
  await writeFile6(outputSchemaPath, `${JSON.stringify(deliveredSchema, null, 2)}
25484
25023
  `, "utf8");
25485
25024
  }
25486
25025
  } else {
25487
- mcpConfigPath = join36(inputsDirectory, "mcp-config.json");
25026
+ mcpConfigPath = join35(inputsDirectory, "mcp-config.json");
25488
25027
  await writeFile6(
25489
25028
  mcpConfigPath,
25490
25029
  `${JSON.stringify(headlessMcpConfigDocument(prepared.mcpServers), null, 2)}
@@ -25496,7 +25035,7 @@ function createHeadlessRoleTurnHost(config) {
25496
25035
  startedWithSchema = deliveredSchema;
25497
25036
  } catch (setupError) {
25498
25037
  try {
25499
- await rm3(inputsDirectory, { recursive: true, force: true });
25038
+ await rm2(inputsDirectory, { recursive: true, force: true });
25500
25039
  } catch (cleanupError) {
25501
25040
  await retainPackageFault({
25502
25041
  runDirectory: request.runDirectory,
@@ -25707,7 +25246,7 @@ function createHeadlessRoleTurnHost(config) {
25707
25246
  });
25708
25247
  } finally {
25709
25248
  try {
25710
- await rm3(inputsDirectory, { recursive: true, force: true });
25249
+ await rm2(inputsDirectory, { recursive: true, force: true });
25711
25250
  } catch (error) {
25712
25251
  await retainPackageFault({
25713
25252
  runDirectory: request.runDirectory,