@akagilnc/pi-workflow-roles 0.1.5593 → 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.
- package/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/dist/acp-host/production-host.js +168 -394
- package/dist/headless-host/production-host.js +168 -394
- package/dist/merger-contracts.js +6 -2
- package/dist/migrate-book-topology.js +4846 -10449
- package/dist/package-contracts/worker-output.js +1 -6
- package/dist/packaged-role-registry.js +5 -4
- package/dist/public-cli/invocation.js +20 -53
- package/dist/public-cli/main.js +18046 -18197
- package/dist/public-cli/option-definitions.js +2 -2
- package/dist/public-cli/post-admission.js +2 -2
- package/dist/public-cli/run-lifecycle.js +2 -29
- package/dist/role-run-relocation.js +3 -4
- package/package.json +1 -1
- package/scripts/build-package.mjs +0 -1
- package/src/host-contracts.ts +0 -3
- package/src/merger-contracts.ts +6 -2
- package/src/merger-role.ts +11 -1
- package/src/navigator-attendance.ts +2 -2
- package/src/package-contracts/worker-output.ts +0 -8
- package/src/packaged-role-registry.ts +4 -3
- package/src/public-cli/invocation.ts +25 -72
- package/src/public-cli/option-definitions.ts +2 -2
- package/src/public-cli/post-admission.ts +2 -2
- package/src/public-cli/run-lifecycle.ts +2 -39
- package/src/role-run-relocation.ts +3 -4
- package/src/role-runtime-dependencies.ts +0 -2
- package/src/role-runtime.ts +0 -16
- package/src/worker-role.ts +11 -78
- package/dist/package-contracts/fixer-packet.js +0 -77
- package/packets/fixer-prerequisites.json +0 -6
- 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
|
|
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 =
|
|
832
|
-
status:
|
|
833
|
-
report:
|
|
834
|
-
remainingScope:
|
|
835
|
-
reason:
|
|
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
|
|
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 =
|
|
880
|
-
status:
|
|
881
|
-
case:
|
|
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:
|
|
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:
|
|
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:
|
|
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 =
|
|
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
|
|
967
|
-
function
|
|
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")
|
|
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))
|
|
984
|
-
if (!isRecord(value.materials))
|
|
985
|
-
const materials = {
|
|
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 =
|
|
998
|
-
checkSchema =
|
|
999
|
-
mergerInputSchema =
|
|
1000
|
-
attemptId:
|
|
1001
|
-
targetObjectId:
|
|
1002
|
-
sourceObjectId:
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
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 =
|
|
1010
|
-
status:
|
|
1011
|
-
attemptId:
|
|
1012
|
-
report:
|
|
1013
|
-
mergeCommitId:
|
|
1014
|
-
diagnosis:
|
|
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
|
|
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
|
-
|
|
1081
|
-
status:
|
|
1006
|
+
Type11.Object({
|
|
1007
|
+
status: Type11.Unknown({
|
|
1082
1008
|
description: "completed"
|
|
1083
1009
|
}),
|
|
1084
|
-
findings:
|
|
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
|
|
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
|
-
|
|
1962
|
-
status:
|
|
1887
|
+
Type12.Object({
|
|
1888
|
+
status: Type12.Unknown({
|
|
1963
1889
|
description: "completed | escalate"
|
|
1964
1890
|
}),
|
|
1965
|
-
ticketNumber:
|
|
1966
|
-
|
|
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:
|
|
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:
|
|
1974
|
-
ticketSessions:
|
|
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
|
|
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
|
-
|
|
1918
|
+
Type13.Object(
|
|
1993
1919
|
{
|
|
1994
|
-
secretariatStatus:
|
|
1920
|
+
secretariatStatus: Type13.Unknown({
|
|
1995
1921
|
description: "converged | escalate"
|
|
1996
1922
|
}),
|
|
1997
|
-
ticketNumber:
|
|
1998
|
-
|
|
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:
|
|
2001
|
-
evidence:
|
|
2002
|
-
decisionGate:
|
|
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: "
|
|
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,7 +4363,7 @@ var init_durable_principal = __esm({
|
|
|
4436
4363
|
});
|
|
4437
4364
|
|
|
4438
4365
|
// src/collector-config.ts
|
|
4439
|
-
function
|
|
4366
|
+
function fail2(message, cause) {
|
|
4440
4367
|
throw new Error(message, cause === void 0 ? void 0 : { cause });
|
|
4441
4368
|
}
|
|
4442
4369
|
function conservativeAscii(input) {
|
|
@@ -4447,20 +4374,20 @@ function conservativeAscii(input) {
|
|
|
4447
4374
|
return true;
|
|
4448
4375
|
}
|
|
4449
4376
|
function parseCollectorRepository(raw) {
|
|
4450
|
-
if (typeof raw !== "string" || raw.trim() !== raw || raw.length === 0)
|
|
4451
|
-
if (!conservativeAscii(raw) || raw.includes("://") || /[?#@%\\ ]/.test(raw))
|
|
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");
|
|
4452
4379
|
const parts = raw.split("/");
|
|
4453
|
-
if (parts.length !== 2)
|
|
4380
|
+
if (parts.length !== 2) fail2("Collector repository must contain exactly one '/' separating owner and repo");
|
|
4454
4381
|
const [ownerDisplay, repoDisplay] = parts;
|
|
4455
|
-
if (!COLLECTOR_OWNER_PATTERN.test(ownerDisplay) || !COLLECTOR_REPO_PATTERN.test(repoDisplay))
|
|
4382
|
+
if (!COLLECTOR_OWNER_PATTERN.test(ownerDisplay) || !COLLECTOR_REPO_PATTERN.test(repoDisplay)) fail2("Collector repository does not match the conservative owner/repo grammar");
|
|
4456
4383
|
const owner = ownerDisplay.toLowerCase();
|
|
4457
4384
|
const repo = repoDisplay.toLowerCase();
|
|
4458
4385
|
return { display: raw, canonical: `${owner}/${repo}`, owner, repo };
|
|
4459
4386
|
}
|
|
4460
4387
|
function parseCollectorPrNumber(raw) {
|
|
4461
|
-
if (typeof raw !== "string" && typeof raw !== "number")
|
|
4388
|
+
if (typeof raw !== "string" && typeof raw !== "number") fail2("Collector pull request number is required");
|
|
4462
4389
|
const value = parseTicketNumber(raw);
|
|
4463
|
-
if (value === void 0)
|
|
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");
|
|
4464
4391
|
return value;
|
|
4465
4392
|
}
|
|
4466
4393
|
var COLLECTOR_OWNER_PATTERN, COLLECTOR_REPO_PATTERN;
|
|
@@ -4481,7 +4408,7 @@ __export(auditor_dossier_tool_exports, {
|
|
|
4481
4408
|
createAuditorDossierTool: () => createAuditorDossierTool
|
|
4482
4409
|
});
|
|
4483
4410
|
import { join as join12, resolve as resolve6 } from "node:path";
|
|
4484
|
-
import { Type as
|
|
4411
|
+
import { Type as Type15 } from "typebox";
|
|
4485
4412
|
function auditorRunDirectory(context) {
|
|
4486
4413
|
const sessionFile = context.sessionManager?.getSessionFile?.();
|
|
4487
4414
|
if (sessionFile === void 0) return void 0;
|
|
@@ -4493,7 +4420,7 @@ function createAuditorDossierTool(runDirectory) {
|
|
|
4493
4420
|
description: "\u5B9A\u4F4D\u672C\u5BA1\u8BA1\u5E2D\u7ED1\u5B9A\u7684 run \u5377\u5B97\u53CA\u5176\u8BC1\u636E\u5165\u53E3\u3002",
|
|
4494
4421
|
// #836 r16 class 3: execute() ignores `_params` entirely — a closed root
|
|
4495
4422
|
// only rejects the role for saying more.
|
|
4496
|
-
parameters:
|
|
4423
|
+
parameters: Type15.Object({}, { additionalProperties: true }),
|
|
4497
4424
|
async execute(_id, _params) {
|
|
4498
4425
|
if (runDirectory === void 0) {
|
|
4499
4426
|
return {
|
|
@@ -4527,7 +4454,7 @@ var init_auditor_dossier_tool = __esm({
|
|
|
4527
4454
|
});
|
|
4528
4455
|
|
|
4529
4456
|
// src/collector-tool-schemas.ts
|
|
4530
|
-
import { Type as
|
|
4457
|
+
import { Type as Type16 } from "typebox";
|
|
4531
4458
|
var collectorOutputBaseSchema, collectorOutputArgsSchema;
|
|
4532
4459
|
var init_collector_tool_schemas = __esm({
|
|
4533
4460
|
"src/collector-tool-schemas.ts"() {
|
|
@@ -4535,11 +4462,11 @@ var init_collector_tool_schemas = __esm({
|
|
|
4535
4462
|
init_open_tool_schema();
|
|
4536
4463
|
init_terminating_infrastructure();
|
|
4537
4464
|
collectorOutputBaseSchema = openToolObject(
|
|
4538
|
-
|
|
4539
|
-
groups:
|
|
4465
|
+
Type16.Object({
|
|
4466
|
+
groups: Type16.Unsafe({
|
|
4540
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"
|
|
4541
4468
|
}),
|
|
4542
|
-
unfinishedReasons:
|
|
4469
|
+
unfinishedReasons: Type16.Unknown({
|
|
4543
4470
|
description: "\u672A\u5B8C\u6210\u539F\u56E0\uFF1B\u53D6\u8BC1\u53D7\u9650\u65F6\u5982\u5B9E\u62A5\u544A\u3002"
|
|
4544
4471
|
})
|
|
4545
4472
|
})
|
|
@@ -5614,7 +5541,7 @@ async function runEngineDetourOnce(input) {
|
|
|
5614
5541
|
child.stderr.setEncoding("utf8").on("data", (chunk) => {
|
|
5615
5542
|
stderr += chunk;
|
|
5616
5543
|
});
|
|
5617
|
-
const
|
|
5544
|
+
const fail3 = (error) => {
|
|
5618
5545
|
if (settled) return;
|
|
5619
5546
|
settled = true;
|
|
5620
5547
|
if (signal !== void 0) {
|
|
@@ -5631,7 +5558,7 @@ async function runEngineDetourOnce(input) {
|
|
|
5631
5558
|
resolve21(result);
|
|
5632
5559
|
};
|
|
5633
5560
|
const onAbort = () => {
|
|
5634
|
-
|
|
5561
|
+
fail3(signal !== void 0 ? abortReasonError(signal) : new Error("aborted"));
|
|
5635
5562
|
try {
|
|
5636
5563
|
child.kill("SIGTERM");
|
|
5637
5564
|
} catch {
|
|
@@ -5644,7 +5571,7 @@ async function runEngineDetourOnce(input) {
|
|
|
5644
5571
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
5645
5572
|
}
|
|
5646
5573
|
}
|
|
5647
|
-
child.on("error", (error) =>
|
|
5574
|
+
child.on("error", (error) => fail3(error));
|
|
5648
5575
|
child.on("close", (code) => {
|
|
5649
5576
|
succeed({ code: code ?? 1, stdout, stderr });
|
|
5650
5577
|
});
|
|
@@ -7500,8 +7427,8 @@ var init_option_definitions = __esm({
|
|
|
7500
7427
|
repeatable: false,
|
|
7501
7428
|
form: "option",
|
|
7502
7429
|
description: {
|
|
7503
|
-
en: "
|
|
7504
|
-
zh: "
|
|
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"
|
|
7505
7432
|
}
|
|
7506
7433
|
}
|
|
7507
7434
|
];
|
|
@@ -8242,9 +8169,6 @@ async function relocateAdmittedRunToTicket(admitted, authority, heldLease) {
|
|
|
8242
8169
|
admittedRecord,
|
|
8243
8170
|
[
|
|
8244
8171
|
"runDirectory",
|
|
8245
|
-
"taskPath",
|
|
8246
|
-
"packetPath",
|
|
8247
|
-
"prerequisitesPath",
|
|
8248
8172
|
"mergerInputPath"
|
|
8249
8173
|
],
|
|
8250
8174
|
oldRunDirectory,
|
|
@@ -8377,7 +8301,7 @@ function assignPublicSeatOption(owner, taken, fields) {
|
|
|
8377
8301
|
fields.authorityRefs.push(requireAuthorityRef(value));
|
|
8378
8302
|
return;
|
|
8379
8303
|
case "prerequisites":
|
|
8380
|
-
fields.prerequisitesPath =
|
|
8304
|
+
fields.prerequisitesPath = requireProvidedOptionValue(taken.def.canonical, value);
|
|
8381
8305
|
return;
|
|
8382
8306
|
case "pr":
|
|
8383
8307
|
fields.prNumber = parsePositivePrOption(value);
|
|
@@ -8627,11 +8551,7 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
8627
8551
|
instruction,
|
|
8628
8552
|
attachmentPaths,
|
|
8629
8553
|
...project,
|
|
8630
|
-
placedFields: async (
|
|
8631
|
-
const taskPath = join15(placed.runDirectory, "task.md");
|
|
8632
|
-
await writeFile3(taskPath, instruction, "utf8");
|
|
8633
|
-
return { phase, taskPath };
|
|
8634
|
-
}
|
|
8554
|
+
placedFields: async () => ({ phase })
|
|
8635
8555
|
});
|
|
8636
8556
|
}
|
|
8637
8557
|
case "worker-packet": {
|
|
@@ -8642,52 +8562,15 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
8642
8562
|
if (!record.phases.some((item) => item === phase)) {
|
|
8643
8563
|
throw new CliUsageError("fixer phase must be plan or apply");
|
|
8644
8564
|
}
|
|
8645
|
-
let prerequisites = Object.freeze([]);
|
|
8646
|
-
let prerequisitesSource;
|
|
8647
|
-
if (parsed.prerequisitesPath !== void 0) {
|
|
8648
|
-
const absolutePrereq = isAbsolute5(parsed.prerequisitesPath) ? parsed.prerequisitesPath : resolve11(parsed.prerequisitesPath);
|
|
8649
|
-
try {
|
|
8650
|
-
prerequisitesSource = await readFile9(absolutePrereq, "utf8");
|
|
8651
|
-
} catch (error) {
|
|
8652
|
-
throw new CliUsageError(
|
|
8653
|
-
`fixer prerequisites path is unreadable: ${parsed.prerequisitesPath}`,
|
|
8654
|
-
{ cause: error }
|
|
8655
|
-
);
|
|
8656
|
-
}
|
|
8657
|
-
try {
|
|
8658
|
-
prerequisites = parseFixerPrerequisites(prerequisitesSource);
|
|
8659
|
-
} catch (error) {
|
|
8660
|
-
if (error instanceof FixerPacketValidationError) {
|
|
8661
|
-
throw new CliUsageError(error.message, { cause: error });
|
|
8662
|
-
}
|
|
8663
|
-
throw error;
|
|
8664
|
-
}
|
|
8665
|
-
}
|
|
8666
8565
|
return admitStandardMaterialInvocation("fixer", {
|
|
8667
8566
|
...shared,
|
|
8668
8567
|
instruction,
|
|
8669
8568
|
attachmentPaths,
|
|
8670
8569
|
...project,
|
|
8671
|
-
placedFields: async (
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
await writeFile3(
|
|
8676
|
-
prerequisitesPath,
|
|
8677
|
-
`${JSON.stringify(prerequisites, null, 2)}
|
|
8678
|
-
`,
|
|
8679
|
-
"utf8"
|
|
8680
|
-
);
|
|
8681
|
-
}
|
|
8682
|
-
const packetPath = join15(placed.runDirectory, "fix-packet.md");
|
|
8683
|
-
await writeFile3(packetPath, instruction, "utf8");
|
|
8684
|
-
return {
|
|
8685
|
-
phase,
|
|
8686
|
-
packetPath,
|
|
8687
|
-
prerequisites,
|
|
8688
|
-
...prerequisitesPath === void 0 ? {} : { prerequisitesPath }
|
|
8689
|
-
};
|
|
8690
|
-
}
|
|
8570
|
+
placedFields: async () => ({
|
|
8571
|
+
phase,
|
|
8572
|
+
...parsed.prerequisitesPath === void 0 ? {} : { prerequisitesPath: parsed.prerequisitesPath }
|
|
8573
|
+
})
|
|
8691
8574
|
});
|
|
8692
8575
|
}
|
|
8693
8576
|
case "collect-target": {
|
|
@@ -8874,8 +8757,6 @@ async function admitPublicRole(role, parsed, env, override) {
|
|
|
8874
8757
|
targetObjectId: derived.targetObjectId,
|
|
8875
8758
|
sourceObjectId: derived.sourceObjectId,
|
|
8876
8759
|
materials: {
|
|
8877
|
-
task: mergerMaterialFromUtf8(instruction),
|
|
8878
|
-
authority: mergerMaterialFromUtf8(instruction),
|
|
8879
8760
|
targetIntent: mergerMaterialFromUtf8(
|
|
8880
8761
|
`Investigate primary sources for target parent ${targetLabel}. Do not invent intent.`
|
|
8881
8762
|
),
|
|
@@ -9060,7 +8941,8 @@ function buildInstructionTransportPrompt(admitted) {
|
|
|
9060
8941
|
const lines = [admitted.instruction];
|
|
9061
8942
|
const flaggedPaths = [
|
|
9062
8943
|
...admitted.attachments.map((attachment) => `--attach ${attachment.path}`),
|
|
9063
|
-
...admitted.requestManifestPath === void 0 ? [] : [`--request-manifest ${admitted.requestManifestPath}`]
|
|
8944
|
+
...admitted.requestManifestPath === void 0 ? [] : [`--request-manifest ${admitted.requestManifestPath}`],
|
|
8945
|
+
...admitted.prerequisitesPath === void 0 ? [] : [`--prerequisites ${admitted.prerequisitesPath}`]
|
|
9064
8946
|
];
|
|
9065
8947
|
if (flaggedPaths.length > 0) {
|
|
9066
8948
|
lines.push("");
|
|
@@ -9460,7 +9342,6 @@ var init_invocation = __esm({
|
|
|
9460
9342
|
init_doctor_evidence();
|
|
9461
9343
|
init_collector_config();
|
|
9462
9344
|
init_github_remote();
|
|
9463
|
-
init_fixer_packet();
|
|
9464
9345
|
init_merger_git_state();
|
|
9465
9346
|
init_merger_contracts();
|
|
9466
9347
|
init_sha256();
|
|
@@ -12486,7 +12367,7 @@ function projectRelocatedTurnIdentity(request, result, admitted, relocation) {
|
|
|
12486
12367
|
mutableRequest.principal = admitted.principal;
|
|
12487
12368
|
const activation = mutableRequest.activation;
|
|
12488
12369
|
if (isRecord(activation)) {
|
|
12489
|
-
for (const field of ["
|
|
12370
|
+
for (const field of ["inputPath"]) {
|
|
12490
12371
|
const record = activation;
|
|
12491
12372
|
if (field in record) record[field] = rewrite(record[field]);
|
|
12492
12373
|
}
|
|
@@ -16797,7 +16678,7 @@ var init_analyst_model_groups = __esm({
|
|
|
16797
16678
|
|
|
16798
16679
|
// src/analyst-entry.ts
|
|
16799
16680
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
16800
|
-
import { Type as
|
|
16681
|
+
import { Type as Type17 } from "typebox";
|
|
16801
16682
|
function cachedPageMatchesRequestedScope(page, input) {
|
|
16802
16683
|
if (page.bookKey !== input.bookKey) return false;
|
|
16803
16684
|
const requestedTicket = input.ticketNumber ?? input.issueNumber;
|
|
@@ -17002,16 +16883,16 @@ var init_analyst_entry = __esm({
|
|
|
17002
16883
|
}
|
|
17003
16884
|
}
|
|
17004
16885
|
};
|
|
17005
|
-
analystSweepModeInputSchema =
|
|
16886
|
+
analystSweepModeInputSchema = Type17.Object(
|
|
17006
16887
|
{
|
|
17007
|
-
mode:
|
|
17008
|
-
mergedPullRequests:
|
|
17009
|
-
|
|
16888
|
+
mode: Type17.Literal("sweep"),
|
|
16889
|
+
mergedPullRequests: Type17.Array(
|
|
16890
|
+
Type17.Object(
|
|
17010
16891
|
{
|
|
17011
|
-
projectRoot:
|
|
16892
|
+
projectRoot: Type17.String(),
|
|
17012
16893
|
/** 排除后改动行数 — omit or 0 → typed 空缺; finite ≥ 0 only. */
|
|
17013
|
-
changedLines:
|
|
17014
|
-
|
|
16894
|
+
changedLines: Type17.Optional(
|
|
16895
|
+
Type17.Number({ minimum: 0, maximum: Number.MAX_VALUE })
|
|
17015
16896
|
)
|
|
17016
16897
|
}
|
|
17017
16898
|
)
|
|
@@ -17024,7 +16905,7 @@ var init_analyst_entry = __esm({
|
|
|
17024
16905
|
// src/public-cli/analyst-run.ts
|
|
17025
16906
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
17026
16907
|
import { isAbsolute as isAbsolute8, resolve as resolve14 } from "node:path";
|
|
17027
|
-
import { Value as
|
|
16908
|
+
import { Value as Value2 } from "typebox/value";
|
|
17028
16909
|
function resolveAnalystIssueBookKeyFromCwd(cwd = process.cwd()) {
|
|
17029
16910
|
try {
|
|
17030
16911
|
return resolveBookKeyFromGit(cwd);
|
|
@@ -17059,7 +16940,7 @@ async function buildAnalystIssueModeInputFromPublicArgv(parsed, _ledgerHome) {
|
|
|
17059
16940
|
};
|
|
17060
16941
|
}
|
|
17061
16942
|
function parseAnalystSweepModeInputFromJsonValue(value) {
|
|
17062
|
-
if (!
|
|
16943
|
+
if (!Value2.Check(analystSweepModeInputSchema, value)) {
|
|
17063
16944
|
throw new CliUsageError(
|
|
17064
16945
|
"analyst sweep attachment must match AnalystSweepModeInput"
|
|
17065
16946
|
);
|
|
@@ -18843,10 +18724,9 @@ var init_role_run_relocation = __esm({
|
|
|
18843
18724
|
// pre-#1161 pages only
|
|
18844
18725
|
"sessionDirectory",
|
|
18845
18726
|
"sessionFile",
|
|
18846
|
-
|
|
18847
|
-
|
|
18848
|
-
|
|
18849
|
-
// #1165: requestManifestPath is a caller path — never rewrite.
|
|
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.
|
|
18850
18730
|
"mergerInputPath",
|
|
18851
18731
|
"sourceRunPath"
|
|
18852
18732
|
];
|
|
@@ -19379,10 +19259,7 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
19379
19259
|
let instructionEmpty = true;
|
|
19380
19260
|
let attachments = [];
|
|
19381
19261
|
let phase;
|
|
19382
|
-
let taskPath;
|
|
19383
|
-
let packetPath;
|
|
19384
19262
|
let prerequisitesPath;
|
|
19385
|
-
let prerequisites;
|
|
19386
19263
|
let baseRevision;
|
|
19387
19264
|
let lens;
|
|
19388
19265
|
let authorityRefs;
|
|
@@ -19421,18 +19298,9 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
19421
19298
|
if (record.phase === "plan" || record.phase === "apply") {
|
|
19422
19299
|
phase = record.phase;
|
|
19423
19300
|
}
|
|
19424
|
-
if (typeof record.
|
|
19425
|
-
taskPath = record.taskPath;
|
|
19426
|
-
}
|
|
19427
|
-
if (typeof record.packetPath === "string" && record.packetPath.trim() !== "") {
|
|
19428
|
-
packetPath = record.packetPath;
|
|
19429
|
-
}
|
|
19430
|
-
if (typeof record.prerequisitesPath === "string" && record.prerequisitesPath.trim() !== "") {
|
|
19301
|
+
if (typeof record.prerequisitesPath === "string") {
|
|
19431
19302
|
prerequisitesPath = record.prerequisitesPath;
|
|
19432
19303
|
}
|
|
19433
|
-
if (Array.isArray(record.prerequisites)) {
|
|
19434
|
-
prerequisites = record.prerequisites;
|
|
19435
|
-
}
|
|
19436
19304
|
if (typeof record.baseRevision === "string" && record.baseRevision.trim() !== "") {
|
|
19437
19305
|
baseRevision = record.baseRevision;
|
|
19438
19306
|
}
|
|
@@ -19569,10 +19437,7 @@ async function loadResumableRunRecord(home, runId, authority) {
|
|
|
19569
19437
|
instructionEmpty,
|
|
19570
19438
|
attachments,
|
|
19571
19439
|
...phase === void 0 ? {} : { phase },
|
|
19572
|
-
...taskPath === void 0 ? {} : { taskPath },
|
|
19573
|
-
...packetPath === void 0 ? {} : { packetPath },
|
|
19574
19440
|
...prerequisitesPath === void 0 ? {} : { prerequisitesPath },
|
|
19575
|
-
...prerequisites === void 0 ? {} : { prerequisites },
|
|
19576
19441
|
...baseRevision === void 0 ? {} : { baseRevision },
|
|
19577
19442
|
...lens === void 0 ? {} : { lens },
|
|
19578
19443
|
...authorityRefs === void 0 ? {} : { authorityRefs },
|
|
@@ -19657,12 +19522,6 @@ function admitResumedRole(loaded) {
|
|
|
19657
19522
|
}
|
|
19658
19523
|
case "worker-task": {
|
|
19659
19524
|
const phase = resumedWorkerPhase(fields.phase ?? loaded.run.phase, record.phases, role, runId);
|
|
19660
|
-
const taskPath = fields.taskPath;
|
|
19661
|
-
if (taskPath === void 0) {
|
|
19662
|
-
throw new CliUsageError(
|
|
19663
|
-
`role run admitted coder task path is missing: ${runId}`
|
|
19664
|
-
);
|
|
19665
|
-
}
|
|
19666
19525
|
if (fields.instruction.trim() === "") {
|
|
19667
19526
|
throw new CliUsageError(
|
|
19668
19527
|
`role run admitted coder task is blank: ${runId}`
|
|
@@ -19672,33 +19531,23 @@ function admitResumedRole(loaded) {
|
|
|
19672
19531
|
role: "coder",
|
|
19673
19532
|
phase,
|
|
19674
19533
|
...base,
|
|
19675
|
-
instructionEmpty: false
|
|
19676
|
-
taskPath
|
|
19534
|
+
instructionEmpty: false
|
|
19677
19535
|
};
|
|
19678
19536
|
return admitted;
|
|
19679
19537
|
}
|
|
19680
19538
|
case "worker-packet": {
|
|
19681
19539
|
const phase = resumedWorkerPhase(fields.phase ?? loaded.run.phase, record.phases, role, runId);
|
|
19682
|
-
const packetPath = fields.packetPath;
|
|
19683
|
-
if (packetPath === void 0) {
|
|
19684
|
-
throw new CliUsageError(
|
|
19685
|
-
`role run admitted fixer packet path is missing: ${runId}`
|
|
19686
|
-
);
|
|
19687
|
-
}
|
|
19688
19540
|
if (fields.instruction.trim() === "") {
|
|
19689
19541
|
throw new CliUsageError(
|
|
19690
19542
|
`role run admitted fixer instruction is blank: ${runId}`
|
|
19691
19543
|
);
|
|
19692
19544
|
}
|
|
19693
|
-
const prerequisites = fields.prerequisites ?? Object.freeze([]);
|
|
19694
19545
|
const admitted = {
|
|
19695
19546
|
role: "fixer",
|
|
19696
19547
|
phase,
|
|
19697
19548
|
...base,
|
|
19698
19549
|
instructionEmpty: false,
|
|
19699
|
-
|
|
19700
|
-
...fields.prerequisitesPath === void 0 ? {} : { prerequisitesPath: fields.prerequisitesPath },
|
|
19701
|
-
prerequisites
|
|
19550
|
+
...fields.prerequisitesPath === void 0 ? {} : { prerequisitesPath: fields.prerequisitesPath }
|
|
19702
19551
|
};
|
|
19703
19552
|
return admitted;
|
|
19704
19553
|
}
|
|
@@ -20276,7 +20125,7 @@ init_packaged_role_registry();
|
|
|
20276
20125
|
init_activation_ledger_topology();
|
|
20277
20126
|
import { resolve as resolve16 } from "node:path";
|
|
20278
20127
|
import "@earendil-works/pi-coding-agent";
|
|
20279
|
-
import { Type as
|
|
20128
|
+
import { Type as Type18 } from "typebox";
|
|
20280
20129
|
|
|
20281
20130
|
// src/navigator-public-session.ts
|
|
20282
20131
|
init_host_session_record();
|
|
@@ -20285,8 +20134,8 @@ import { basename as basename13 } from "node:path";
|
|
|
20285
20134
|
|
|
20286
20135
|
// src/navigator-session-contracts.ts
|
|
20287
20136
|
init_unknown_value();
|
|
20288
|
-
import { Type as
|
|
20289
|
-
import { Value
|
|
20137
|
+
import { Type as Type14 } from "typebox";
|
|
20138
|
+
import { Value } from "typebox/value";
|
|
20290
20139
|
var NAVIGATOR_PREPARE_TOOL_NAME = "ak_navigator_prepare";
|
|
20291
20140
|
var NAVIGATOR_UNAVAILABLE_KEYS = /* @__PURE__ */ new Set([
|
|
20292
20141
|
"context",
|
|
@@ -20390,26 +20239,26 @@ function navigatorProviderFailureFromPublicTerminal(outcome) {
|
|
|
20390
20239
|
if (typed !== void 0) return { source: typed, cause: typed };
|
|
20391
20240
|
return { source: "unknown", cause: "unknown" };
|
|
20392
20241
|
}
|
|
20393
|
-
var navigatorProviderFailureSchema =
|
|
20394
|
-
source:
|
|
20395
|
-
|
|
20396
|
-
|
|
20397
|
-
|
|
20398
|
-
|
|
20399
|
-
|
|
20400
|
-
|
|
20401
|
-
|
|
20402
|
-
|
|
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")
|
|
20403
20252
|
]),
|
|
20404
|
-
cause:
|
|
20405
|
-
|
|
20406
|
-
|
|
20407
|
-
|
|
20408
|
-
|
|
20409
|
-
|
|
20410
|
-
|
|
20411
|
-
|
|
20412
|
-
|
|
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")
|
|
20413
20262
|
])
|
|
20414
20263
|
}, { additionalProperties: false });
|
|
20415
20264
|
function parseNavigatorModelSetting(value) {
|
|
@@ -20787,8 +20636,8 @@ function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
|
|
|
20787
20636
|
return void 0;
|
|
20788
20637
|
}
|
|
20789
20638
|
var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
|
|
20790
|
-
var prepareSchema =
|
|
20791
|
-
prose:
|
|
20639
|
+
var prepareSchema = Type18.Object({
|
|
20640
|
+
prose: Type18.Optional(Type18.Unknown({
|
|
20792
20641
|
description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7ED3\u6784\u3002"
|
|
20793
20642
|
}))
|
|
20794
20643
|
}, { additionalProperties: true });
|
|
@@ -21330,21 +21179,21 @@ init_filed_submission();
|
|
|
21330
21179
|
import { randomUUID as randomUUID7 } from "node:crypto";
|
|
21331
21180
|
import { writeSync as writeSync2 } from "node:fs";
|
|
21332
21181
|
import { join as join34 } from "node:path";
|
|
21333
|
-
import { Value as
|
|
21182
|
+
import { Value as Value3 } from "typebox/value";
|
|
21334
21183
|
|
|
21335
21184
|
// src/activation-trace.ts
|
|
21336
|
-
import { Type as
|
|
21337
|
-
var causeSchema =
|
|
21338
|
-
identity:
|
|
21339
|
-
name:
|
|
21340
|
-
message:
|
|
21341
|
-
evidenceId:
|
|
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 }))
|
|
21342
21191
|
}, { additionalProperties: false });
|
|
21343
|
-
var activationTraceRecordSchema =
|
|
21344
|
-
role:
|
|
21345
|
-
stageId:
|
|
21346
|
-
status:
|
|
21347
|
-
timestamp:
|
|
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" }),
|
|
21348
21197
|
cause: causeSchema
|
|
21349
21198
|
}, { additionalProperties: false });
|
|
21350
21199
|
var activationCauseEvidence = 0;
|
|
@@ -21509,10 +21358,10 @@ init_engine_material();
|
|
|
21509
21358
|
init_engine_detour();
|
|
21510
21359
|
init_engine_detour_usage();
|
|
21511
21360
|
init_run_terminal_artifacts();
|
|
21512
|
-
import { Type as
|
|
21513
|
-
var engineDetourArgsSchema =
|
|
21361
|
+
import { Type as Type20 } from "typebox";
|
|
21362
|
+
var engineDetourArgsSchema = Type20.Object(
|
|
21514
21363
|
{
|
|
21515
|
-
argv:
|
|
21364
|
+
argv: Type20.Array(Type20.String({ minLength: 1 }), {
|
|
21516
21365
|
minItems: 1,
|
|
21517
21366
|
description: "\u9996\u9879\u4E3A PATH \u4E2D\u7684\u53EF\u6267\u884C\u6587\u4EF6\uFF0C\u5176\u4F59\u9879\u4E3A\u53C2\u6570\u3002"
|
|
21518
21367
|
})
|
|
@@ -22033,7 +21882,6 @@ init_worker_output();
|
|
|
22033
21882
|
init_fixer_output();
|
|
22034
21883
|
init_filed_submission();
|
|
22035
21884
|
init_role_submission_declarations();
|
|
22036
|
-
init_fixer_packet();
|
|
22037
21885
|
|
|
22038
21886
|
// src/worker-submission-gates.ts
|
|
22039
21887
|
init_archivist_record_entry();
|
|
@@ -22323,20 +22171,6 @@ function fixerBashSeatbeltDenyReason(matched) {
|
|
|
22323
22171
|
init_unknown_value();
|
|
22324
22172
|
init_worker_output();
|
|
22325
22173
|
var FIXER_FLAG_DEFINITIONS = {
|
|
22326
|
-
packet: {
|
|
22327
|
-
name: "ak-fix-packet",
|
|
22328
|
-
definition: {
|
|
22329
|
-
description: "Path to opaque prose instructions for the Fixer",
|
|
22330
|
-
type: "string"
|
|
22331
|
-
}
|
|
22332
|
-
},
|
|
22333
|
-
prerequisites: {
|
|
22334
|
-
name: "ak-fixer-prerequisites",
|
|
22335
|
-
definition: {
|
|
22336
|
-
description: "Optional path to a JSON array of typed Fixer prerequisites",
|
|
22337
|
-
type: "string"
|
|
22338
|
-
}
|
|
22339
|
-
},
|
|
22340
22174
|
phase: {
|
|
22341
22175
|
name: "ak-fixer-phase",
|
|
22342
22176
|
definition: {
|
|
@@ -22395,22 +22229,11 @@ function assertAcceptableThroughHost(submissionGate, status, details, hostAction
|
|
|
22395
22229
|
}
|
|
22396
22230
|
function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
|
|
22397
22231
|
let soul;
|
|
22398
|
-
let packet;
|
|
22399
|
-
let packetPath;
|
|
22400
|
-
let prerequisitesPath;
|
|
22401
22232
|
let phase;
|
|
22402
22233
|
let lifecycleRegistered = false;
|
|
22403
22234
|
const submissionGate = createWorkerSubmissionGate({
|
|
22404
22235
|
unfinishedReasonBounceLimit: options?.unfinishedReasonBounceLimit ?? deliveryLimitFromEnv(process.env)
|
|
22405
22236
|
});
|
|
22406
|
-
pi.registerFlag(
|
|
22407
|
-
FIXER_FLAG_DEFINITIONS.packet.name,
|
|
22408
|
-
FIXER_FLAG_DEFINITIONS.packet.definition
|
|
22409
|
-
);
|
|
22410
|
-
pi.registerFlag(
|
|
22411
|
-
FIXER_FLAG_DEFINITIONS.prerequisites.name,
|
|
22412
|
-
FIXER_FLAG_DEFINITIONS.prerequisites.definition
|
|
22413
|
-
);
|
|
22414
22237
|
pi.registerFlag(
|
|
22415
22238
|
FIXER_FLAG_DEFINITIONS.phase.name,
|
|
22416
22239
|
FIXER_FLAG_DEFINITIONS.phase.definition
|
|
@@ -22426,29 +22249,11 @@ function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
|
|
|
22426
22249
|
);
|
|
22427
22250
|
}
|
|
22428
22251
|
phase = selectedPhase;
|
|
22429
|
-
const resolvedPacketPath = pi.getFlag(FIXER_FLAG_DEFINITIONS.packet.name);
|
|
22430
|
-
if (typeof resolvedPacketPath !== "string" || resolvedPacketPath.trim().length === 0) {
|
|
22431
|
-
throw new Error("Fixer role requires --ak-fix-packet");
|
|
22432
|
-
}
|
|
22433
|
-
packetPath = resolvedPacketPath;
|
|
22434
|
-
const instructions = await dependencies.loadPacket(packetPath);
|
|
22435
|
-
if (instructions.trim().length === 0) {
|
|
22436
|
-
throw new FixerPacketValidationError(
|
|
22437
|
-
new Error("Fixer instructions must be nonblank")
|
|
22438
|
-
);
|
|
22439
|
-
}
|
|
22440
|
-
const resolvedPrerequisitesPath = pi.getFlag(FIXER_FLAG_DEFINITIONS.prerequisites.name);
|
|
22441
|
-
if (resolvedPrerequisitesPath !== void 0 && (typeof resolvedPrerequisitesPath !== "string" || resolvedPrerequisitesPath.trim().length === 0)) {
|
|
22442
|
-
throw new Error("Fixer --ak-fixer-prerequisites path must be nonblank when supplied");
|
|
22443
|
-
}
|
|
22444
|
-
prerequisitesPath = typeof resolvedPrerequisitesPath === "string" ? resolvedPrerequisitesPath : void 0;
|
|
22445
|
-
const prerequisites = prerequisitesPath !== void 0 ? parseFixerPrerequisites(await dependencies.loadPacket(prerequisitesPath)) : Object.freeze([]);
|
|
22446
|
-
packet = Object.freeze({ instructions, prerequisites });
|
|
22447
22252
|
if (!lifecycleRegistered) {
|
|
22448
22253
|
lifecycleRegistered = true;
|
|
22449
22254
|
registerWorkerSubmission(pi, "fixer", {
|
|
22450
|
-
notReady: "\u4FEE\u5185\u53F8\
|
|
22451
|
-
ready: () =>
|
|
22255
|
+
notReady: "\u4FEE\u5185\u53F8\u9636\u6BB5\u672A\u88C5\u8F7D",
|
|
22256
|
+
ready: () => phase !== void 0,
|
|
22452
22257
|
phase: () => phase,
|
|
22453
22258
|
project: (parameters, current) => deepFreeze2(validateFixerOutput(parameters, current)),
|
|
22454
22259
|
submissionGate,
|
|
@@ -22467,12 +22272,6 @@ function createFixerRoleRuntime(pi, dependencies, hostActions, options) {
|
|
|
22467
22272
|
});
|
|
22468
22273
|
pi.on("before_agent_start", (event) => {
|
|
22469
22274
|
if (soul === void 0) throw new Error("\u4FEE\u5185\u53F8\u804C\u5206\u672A\u88C5\u8F7D");
|
|
22470
|
-
if (packetPath === void 0) throw new Error("\u4FEE\u5185\u53F8\u4FEE\u7406\u5305\u8DEF\u5F84\u672A\u88C5\u8F7D");
|
|
22471
|
-
const prerequisitesBlock = prerequisitesPath === void 0 ? "" : `
|
|
22472
|
-
|
|
22473
|
-
<fixer_prerequisites_path>
|
|
22474
|
-
${prerequisitesPath}
|
|
22475
|
-
</fixer_prerequisites_path>`;
|
|
22476
22275
|
return {
|
|
22477
22276
|
systemPrompt: `${event.systemPrompt}
|
|
22478
22277
|
|
|
@@ -22482,11 +22281,7 @@ ${soul}
|
|
|
22482
22281
|
|
|
22483
22282
|
<fixer_phase>
|
|
22484
22283
|
${phase ?? ""}
|
|
22485
|
-
</fixer_phase
|
|
22486
|
-
|
|
22487
|
-
<fix_packet_path>
|
|
22488
|
-
${packetPath}
|
|
22489
|
-
</fix_packet_path>${prerequisitesBlock}`
|
|
22284
|
+
</fixer_phase>`
|
|
22490
22285
|
};
|
|
22491
22286
|
});
|
|
22492
22287
|
}
|
|
@@ -22498,22 +22293,17 @@ ${packetPath}
|
|
|
22498
22293
|
}
|
|
22499
22294
|
function createCoderRoleRuntime(pi, dependencies, hostActions, options) {
|
|
22500
22295
|
let soul;
|
|
22501
|
-
let task;
|
|
22502
22296
|
let phase;
|
|
22503
22297
|
let lifecycleRegistered = false;
|
|
22504
22298
|
const submissionGate = createWorkerSubmissionGate({
|
|
22505
22299
|
unfinishedReasonBounceLimit: options?.unfinishedReasonBounceLimit ?? deliveryLimitFromEnv(process.env)
|
|
22506
22300
|
});
|
|
22507
|
-
pi.registerFlag("ak-coder-task", {
|
|
22508
|
-
description: "Markdown task assigned to the coder role",
|
|
22509
|
-
type: "string"
|
|
22510
|
-
});
|
|
22511
22301
|
pi.registerFlag("ak-coder-phase", {
|
|
22512
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)",
|
|
22513
22303
|
type: "string"
|
|
22514
22304
|
});
|
|
22515
22305
|
return {
|
|
22516
|
-
async activate(
|
|
22306
|
+
async activate() {
|
|
22517
22307
|
soul = (await dependencies.loadSoul()).trim();
|
|
22518
22308
|
if (soul.length === 0) throw new Error("Coder soul is empty");
|
|
22519
22309
|
const selectedPhase = pi.getFlag("ak-coder-phase");
|
|
@@ -22523,23 +22313,17 @@ function createCoderRoleRuntime(pi, dependencies, hostActions, options) {
|
|
|
22523
22313
|
);
|
|
22524
22314
|
}
|
|
22525
22315
|
phase = selectedPhase;
|
|
22526
|
-
const taskPath = pi.getFlag("ak-coder-task");
|
|
22527
|
-
if (typeof taskPath !== "string" || taskPath.trim().length === 0) {
|
|
22528
|
-
throw new Error("Coder role requires --ak-coder-task");
|
|
22529
|
-
}
|
|
22530
|
-
task = (await dependencies.loadTask(taskPath)).trim();
|
|
22531
|
-
if (task.length === 0) throw new Error("Coder task is empty");
|
|
22532
22316
|
if (!lifecycleRegistered) {
|
|
22533
22317
|
lifecycleRegistered = true;
|
|
22534
22318
|
registerWorkerSubmission(pi, "coder", {
|
|
22535
|
-
notReady: "\u5C06\u4F5C\u76D1\
|
|
22536
|
-
ready: () =>
|
|
22319
|
+
notReady: "\u5C06\u4F5C\u76D1\u9636\u6BB5\u672A\u88C5\u8F7D",
|
|
22320
|
+
ready: () => phase !== void 0,
|
|
22537
22321
|
phase: () => phase,
|
|
22538
22322
|
project: (parameters, current) => validateWorkerOutput(parameters, current, "Coder"),
|
|
22539
22323
|
submissionGate,
|
|
22540
22324
|
hostActions
|
|
22541
22325
|
});
|
|
22542
|
-
pi.on("before_agent_start", (event
|
|
22326
|
+
pi.on("before_agent_start", (event) => {
|
|
22543
22327
|
if (soul === void 0) throw new Error("\u5C06\u4F5C\u76D1\u804C\u5206\u672A\u88C5\u8F7D");
|
|
22544
22328
|
return {
|
|
22545
22329
|
systemPrompt: `${event.systemPrompt}
|
|
@@ -22550,11 +22334,7 @@ ${soul}
|
|
|
22550
22334
|
|
|
22551
22335
|
<coder_phase>
|
|
22552
22336
|
${phase ?? ""}
|
|
22553
|
-
</coder_phase
|
|
22554
|
-
|
|
22555
|
-
<coder_task>
|
|
22556
|
-
${task ?? ""}
|
|
22557
|
-
</coder_task>`
|
|
22337
|
+
</coder_phase>`
|
|
22558
22338
|
};
|
|
22559
22339
|
});
|
|
22560
22340
|
}
|
|
@@ -22599,7 +22379,16 @@ function createMergerRoleRuntime(pi, dependencies) {
|
|
|
22599
22379
|
});
|
|
22600
22380
|
pi.on("before_agent_start", (event) => {
|
|
22601
22381
|
if (!activation) throw new Error("\u6821\u4E66\u90CE\u672A\u6FC0\u6D3B");
|
|
22602
|
-
const admitted = {
|
|
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
|
+
};
|
|
22603
22392
|
return { systemPrompt: `${event.systemPrompt}
|
|
22604
22393
|
|
|
22605
22394
|
<merger_soul>
|
|
@@ -22630,7 +22419,6 @@ init_doctor_evidence();
|
|
|
22630
22419
|
init_judge_role();
|
|
22631
22420
|
init_engine_detour();
|
|
22632
22421
|
init_fixer_output();
|
|
22633
|
-
init_fixer_packet();
|
|
22634
22422
|
init_auditor_soul();
|
|
22635
22423
|
init_judge_auditor();
|
|
22636
22424
|
init_doctor_auditor();
|
|
@@ -22742,7 +22530,7 @@ function activationStage(role, activate) {
|
|
|
22742
22530
|
};
|
|
22743
22531
|
}
|
|
22744
22532
|
function validateActivationTraceRecord(record) {
|
|
22745
|
-
if (!
|
|
22533
|
+
if (!Value3.Check(activationTraceRecordSchema, record)) {
|
|
22746
22534
|
throw new TypeError("Activation trace record does not match its closed contract");
|
|
22747
22535
|
}
|
|
22748
22536
|
return record;
|
|
@@ -23525,13 +23313,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
|
|
|
23525
23313
|
const fixer = createFixerRoleRuntime(
|
|
23526
23314
|
roleHost,
|
|
23527
23315
|
{
|
|
23528
|
-
loadSoul: () => requireRoleSoul("fixer")
|
|
23529
|
-
async loadPacket(path) {
|
|
23530
|
-
if (dependencies.loadFixPacket === void 0) {
|
|
23531
|
-
throw new Error("Fixer packet loader is not configured");
|
|
23532
|
-
}
|
|
23533
|
-
return dependencies.loadFixPacket(path);
|
|
23534
|
-
}
|
|
23316
|
+
loadSoul: () => requireRoleSoul("fixer")
|
|
23535
23317
|
},
|
|
23536
23318
|
hostActions,
|
|
23537
23319
|
{ unfinishedReasonBounceLimit: deliveryLimit }
|
|
@@ -23539,13 +23321,7 @@ function createRoleRuntimeExtension(dependencies, deliveryRequestLimit) {
|
|
|
23539
23321
|
const coder = createCoderRoleRuntime(
|
|
23540
23322
|
roleHost,
|
|
23541
23323
|
{
|
|
23542
|
-
loadSoul: () => requireRoleSoul("coder")
|
|
23543
|
-
async loadTask(path) {
|
|
23544
|
-
if (dependencies.loadCoderTask === void 0) {
|
|
23545
|
-
throw new Error("Coder task loader is not configured");
|
|
23546
|
-
}
|
|
23547
|
-
return dependencies.loadCoderTask(path);
|
|
23548
|
-
}
|
|
23324
|
+
loadSoul: () => requireRoleSoul("coder")
|
|
23549
23325
|
},
|
|
23550
23326
|
hostActions,
|
|
23551
23327
|
{ unfinishedReasonBounceLimit: deliveryLimit }
|
|
@@ -23860,8 +23636,6 @@ function createRoleRuntimeDependencies(packageRoot) {
|
|
|
23860
23636
|
packageRoot,
|
|
23861
23637
|
loadRoleReferenceMaterials: loadPackagedRoleReferenceMaterials,
|
|
23862
23638
|
loadRoleSoul: loadRegisteredRoleSoul,
|
|
23863
|
-
loadFixPacket: (path) => readFile17(path, "utf8"),
|
|
23864
|
-
loadCoderTask: (path) => readFile17(path, "utf8"),
|
|
23865
23639
|
loadDoctorCase,
|
|
23866
23640
|
loadNotarySourceRun: loadNotarySourceRunLocator,
|
|
23867
23641
|
loadMergerInput: async (path) => JSON.parse(await readFile17(path, "utf8")),
|