@akagilnc/pi-workflow-roles 0.1.4980 → 0.1.4992
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/dist/acp-host/production-host.js +438 -456
- package/dist/analyst-gate-cycles-read.js +16 -11
- package/dist/analyst-metric-families/gate-cycles.js +2 -2
- package/dist/audit-escalation.js +4 -4
- package/dist/compliance-transport.js +2 -2
- package/dist/countersign-contracts.js +6 -5
- package/dist/doctor-evidence.js +2 -1
- package/dist/gatekeeper-role.js +20 -41
- package/dist/headless-host/production-host.js +438 -456
- package/dist/inspector-contracts.js +3 -2
- package/dist/migrate-book-topology.js +59 -54
- package/dist/navigator-invocation-identity.js +6 -4
- package/dist/notary-contracts.js +3 -19
- package/dist/package-contracts/auditor-output.js +4 -19
- package/dist/package-contracts/judge-output.js +6 -5
- package/dist/package-contracts/terminating-tools.js +9 -3
- package/dist/packaged-role-registry.js +10 -12
- package/dist/public-cli/countersign-run.js +1 -1
- package/dist/public-cli/main.js +90 -86
- package/dist/public-cli/option-definitions.js +2 -2
- package/dist/public-cli/settlement.js +11 -11
- package/dist/review-submission.js +20 -0
- package/dist/submission-errors.js +2 -2
- package/dist/submission-ledger.js +14 -2
- package/package.json +1 -1
- package/souls/doctor-auditor.md +1 -1
- package/souls/fixer-auditor.md +4 -4
- package/souls/gate-output-guide.md +2 -2
- package/souls/inspector.md +1 -1
- package/souls/judge-auditor.md +2 -2
- package/souls/notary.md +1 -1
- package/souls/quality-law.md +1 -1
- package/souls/secretariat.md +4 -5
- package/src/analyst-gate-cycles-read.ts +17 -9
- package/src/analyst-metric-families/gate-cycles.ts +2 -2
- package/src/audit-escalation.ts +8 -8
- package/src/auditor-role.ts +1 -1
- package/src/compliance-transport.ts +7 -7
- package/src/countersign-contracts.ts +10 -8
- package/src/countersign-role.ts +6 -35
- package/src/doctor-evidence.ts +2 -1
- package/src/doctor-role.ts +1 -2
- package/src/gatekeeper-role.ts +30 -55
- package/src/host-contracts.ts +4 -3
- package/src/inspector-contracts.ts +7 -6
- package/src/inspector-role.ts +3 -20
- package/src/judge-role.ts +29 -49
- package/src/navigator-invocation-identity.ts +16 -4
- package/src/notary-contracts.ts +8 -26
- package/src/notary-role.ts +1 -1
- package/src/package-contracts/auditor-output.ts +6 -27
- package/src/package-contracts/judge-output.ts +10 -8
- package/src/package-contracts/terminating-tools.ts +9 -3
- package/src/packaged-role-registry.ts +12 -13
- package/src/pi/adapter.ts +6 -5
- package/src/public-cli/countersign-run.ts +1 -1
- package/src/public-cli/option-definitions.ts +2 -2
- package/src/public-cli/settlement.ts +13 -14
- package/src/review-submission.ts +29 -0
- package/src/role-envelope.ts +17 -9
- package/src/role-runtime.ts +32 -15
- package/src/submission-errors.ts +6 -6
- package/src/{gatekeeper-pass-envelope.ts → submission-gate.ts} +29 -16
- package/src/submission-ledger.ts +13 -3
- package/src/ticket-trajectory.ts +9 -4
- package/src/worker-role.ts +16 -2
|
@@ -1489,7 +1489,7 @@ function serializeReceipt(receipt) {
|
|
|
1489
1489
|
return readableGateItem(receipt);
|
|
1490
1490
|
}
|
|
1491
1491
|
function gatekeeperNonPassMessage(result) {
|
|
1492
|
-
if (result.status === "
|
|
1492
|
+
if (result.status === "continue" || result.status === "escalate") {
|
|
1493
1493
|
return serializeReceipt(result.receipt);
|
|
1494
1494
|
}
|
|
1495
1495
|
if (result.status === "transport_failure") {
|
|
@@ -2657,19 +2657,49 @@ var init_navigator_output = __esm({
|
|
|
2657
2657
|
}
|
|
2658
2658
|
});
|
|
2659
2659
|
|
|
2660
|
+
// src/review-submission.ts
|
|
2661
|
+
import { Type as Type6 } from "typebox";
|
|
2662
|
+
var REVIEW_SUBMISSION_OUTPUT_TOOL_NAME, reviewSubmissionSchema;
|
|
2663
|
+
var init_review_submission = __esm({
|
|
2664
|
+
"src/review-submission.ts"() {
|
|
2665
|
+
"use strict";
|
|
2666
|
+
init_open_tool_schema();
|
|
2667
|
+
init_terminating_infrastructure();
|
|
2668
|
+
REVIEW_SUBMISSION_OUTPUT_TOOL_NAME = "ak_submission_output";
|
|
2669
|
+
reviewSubmissionSchema = withTerminatingOutputDeclarations(
|
|
2670
|
+
openToolObject(
|
|
2671
|
+
Type6.Object({
|
|
2672
|
+
status: Type6.Optional(Type6.Unknown({
|
|
2673
|
+
description: "converged | continue | escalate \u2014 \u975E\u4E09\u6001\u65F6\u8BF7\u91CD\u8BFB\u540E\u91CD\u4EA4\uFF0C\u52FF\u6539\u6807\u3002"
|
|
2674
|
+
})),
|
|
2675
|
+
findings: Type6.Optional(Type6.Unknown({ description: "\u5BA1\u6838\u53D1\u73B0\uFF0C\u539F\u6837\u7559\u5B58" })),
|
|
2676
|
+
reason: Type6.Optional(Type6.Unknown({ description: "\u4E0A\u5448\u7406\u7531" })),
|
|
2677
|
+
violations: Type6.Optional(Type6.Unknown({ description: "\u8FDD\u89C4\u6761\u76EE" })),
|
|
2678
|
+
conflicts: Type6.Optional(Type6.Unknown({ description: "\u5F85\u51B3\u51B2\u7A81" })),
|
|
2679
|
+
fix: Type6.Optional(Type6.Unknown({ description: "continue \u65F6\u7684\u8865\u6551\u8BF4\u660E\uFF1B\u53EF\u5199 summary \u6458\u8981\uFF0C\u5176\u4F59\u5185\u5BB9\u539F\u6837\u7559\u5B58" })),
|
|
2680
|
+
classes: Type6.Optional(Type6.Unknown({ description: "\u5DF2\u88C1\u51B3 finding \u7C7B\uFF1B\u53EF\u8BF4\u660E name\u3001owner\u3001boundary\u3001disposition\uFF0C\u539F\u6837\u7559\u5B58" })),
|
|
2681
|
+
note: Type6.Optional(Type6.Unknown({ description: "\u88C1\u51B3\u9644\u6CE8" })),
|
|
2682
|
+
evidence: Type6.Optional(Type6.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
|
|
2683
|
+
decisionGate: Type6.Optional(Type6.Unknown({ description: "\u9700\u4EBA\u6743\u5A01\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879\uFF1B\u53EF\u8BF4\u660E question\u3001options\uFF0C\u539F\u6837\u7559\u5B58" }))
|
|
2684
|
+
})
|
|
2685
|
+
)
|
|
2686
|
+
);
|
|
2687
|
+
}
|
|
2688
|
+
});
|
|
2689
|
+
|
|
2660
2690
|
// src/package-contracts/judge-output.ts
|
|
2661
2691
|
function validateAcceptedJudgeDetails(verdict) {
|
|
2662
2692
|
if (verdict === null || typeof verdict !== "object" || Array.isArray(verdict)) throw new Error("Judge verdict has no execution discriminator");
|
|
2663
|
-
let
|
|
2693
|
+
let status;
|
|
2664
2694
|
try {
|
|
2665
|
-
|
|
2695
|
+
status = verdict.status;
|
|
2666
2696
|
} catch {
|
|
2667
2697
|
throw new Error("Judge verdict has no execution discriminator");
|
|
2668
2698
|
}
|
|
2669
|
-
if (typeof
|
|
2699
|
+
if (typeof status !== "string") {
|
|
2670
2700
|
throw new Error("Judge verdict has no execution discriminator");
|
|
2671
2701
|
}
|
|
2672
|
-
if (["converged", "continue", "escalate"].includes(
|
|
2702
|
+
if (["converged", "continue", "escalate"].includes(status)) {
|
|
2673
2703
|
return verdict;
|
|
2674
2704
|
}
|
|
2675
2705
|
throw new Error("Judge verdict has no execution discriminator");
|
|
@@ -2678,7 +2708,8 @@ var JUDGE_OUTPUT_TOOL_NAME;
|
|
|
2678
2708
|
var init_judge_output = __esm({
|
|
2679
2709
|
"src/package-contracts/judge-output.ts"() {
|
|
2680
2710
|
"use strict";
|
|
2681
|
-
|
|
2711
|
+
init_review_submission();
|
|
2712
|
+
JUDGE_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
|
|
2682
2713
|
}
|
|
2683
2714
|
});
|
|
2684
2715
|
|
|
@@ -2692,7 +2723,7 @@ var init_reviewer_output = __esm({
|
|
|
2692
2723
|
});
|
|
2693
2724
|
|
|
2694
2725
|
// src/package-contracts/fixer-output.ts
|
|
2695
|
-
import { Type as
|
|
2726
|
+
import { Type as Type7 } from "typebox";
|
|
2696
2727
|
function validateFixerOutput(value, _phase) {
|
|
2697
2728
|
return value;
|
|
2698
2729
|
}
|
|
@@ -2703,39 +2734,39 @@ var init_fixer_output = __esm({
|
|
|
2703
2734
|
init_open_tool_schema();
|
|
2704
2735
|
init_terminating_infrastructure();
|
|
2705
2736
|
FIXER_OUTPUT_TOOL_NAME = "ak_fixer_output";
|
|
2706
|
-
transportString =
|
|
2707
|
-
authorityBlockerSchema =
|
|
2708
|
-
prerequisiteBlockerSchema =
|
|
2709
|
-
blockerSchema =
|
|
2710
|
-
exceptionSchema =
|
|
2711
|
-
testEvidenceSchema =
|
|
2712
|
-
contract:
|
|
2713
|
-
minimumNecessaryCost:
|
|
2714
|
-
measuredDuration:
|
|
2737
|
+
transportString = Type7.String();
|
|
2738
|
+
authorityBlockerSchema = Type7.Object({ cause: Type7.Optional(Type7.Literal("authority_violation")), evidence: Type7.Optional(transportString) });
|
|
2739
|
+
prerequisiteBlockerSchema = Type7.Object({ cause: Type7.Optional(Type7.Literal("prerequisite_unmet")), prerequisiteId: Type7.Optional(transportString), evidence: Type7.Optional(transportString) });
|
|
2740
|
+
blockerSchema = Type7.Union([authorityBlockerSchema, prerequisiteBlockerSchema]);
|
|
2741
|
+
exceptionSchema = Type7.Object({ where: Type7.Optional(transportString), reason: Type7.Optional(transportString) });
|
|
2742
|
+
testEvidenceSchema = Type7.Object({
|
|
2743
|
+
contract: Type7.Optional(Type7.String({ description: "\u6D4B\u8BD5\u6539\u52A8\u6240\u8BC1\u660E\u7684\u5951\u7EA6" })),
|
|
2744
|
+
minimumNecessaryCost: Type7.Optional(Type7.String({ description: "\u6D4B\u8BD5\u6539\u52A8\u7684\u4E00\u884C\u6700\u5C0F\u5FC5\u8981\u6210\u672C" })),
|
|
2745
|
+
measuredDuration: Type7.Optional(Type7.String({ description: "\u805A\u7126\u9A8C\u8BC1\u5B9E\u6D4B\u65F6\u957F" }))
|
|
2715
2746
|
}, { description: "\u6D4B\u8BD5\u8BC1\u636E\u6761\uFF1Bdiff \u542B\u6D4B\u8BD5\u6539\u52A8\u65F6\u63D0\u4EA4\uFF1B\u673A\u5668\u4E0D\u6838\u9A8C\u3002" });
|
|
2716
|
-
completedClassResultSchema =
|
|
2717
|
-
name:
|
|
2718
|
-
disposition:
|
|
2719
|
-
searchScope:
|
|
2720
|
-
exceptions:
|
|
2721
|
-
commitSha:
|
|
2747
|
+
completedClassResultSchema = Type7.Object({
|
|
2748
|
+
name: Type7.Optional(transportString),
|
|
2749
|
+
disposition: Type7.Optional(Type7.Literal("completed")),
|
|
2750
|
+
searchScope: Type7.Optional(transportString),
|
|
2751
|
+
exceptions: Type7.Optional(Type7.Array(exceptionSchema)),
|
|
2752
|
+
commitSha: Type7.Optional(transportString)
|
|
2722
2753
|
});
|
|
2723
|
-
refusedClassResultSchema =
|
|
2724
|
-
name:
|
|
2725
|
-
disposition:
|
|
2726
|
-
remainingScope:
|
|
2727
|
-
blocker:
|
|
2754
|
+
refusedClassResultSchema = Type7.Object({
|
|
2755
|
+
name: Type7.Optional(transportString),
|
|
2756
|
+
disposition: Type7.Optional(Type7.Literal("refused")),
|
|
2757
|
+
remainingScope: Type7.Optional(transportString),
|
|
2758
|
+
blocker: Type7.Optional(blockerSchema)
|
|
2728
2759
|
});
|
|
2729
|
-
classResultSchema =
|
|
2730
|
-
completedClassResultsSchema =
|
|
2760
|
+
classResultSchema = Type7.Union([completedClassResultSchema, refusedClassResultSchema]);
|
|
2761
|
+
completedClassResultsSchema = Type7.Array(completedClassResultSchema);
|
|
2731
2762
|
FIXER_STATUS_DESCRIPTION = "planned | completed | refused | unfinished | partially_completed \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\uFF1Bunfinished \u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u81F4\u672C\u5C40\u672A\u5B8C\u6210\u65F6\u53EF\u7528\uFF0C\u7F3A\u5F85\u51B3 owner \u51B3\u5B9A\u6216\u7B54\u590D\u5C5E\u7F3A\u524D\u7F6E\u3002";
|
|
2732
|
-
fixerOutputVariants =
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2763
|
+
fixerOutputVariants = Type7.Union([
|
|
2764
|
+
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }) }),
|
|
2765
|
+
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), remainingScope: Type7.String({ description: "\u4F9D\u6CD5\u4E0D\u80FD\u5B8C\u6210\u7684\u5DE5\u4F5C\u8303\u56F4" }), blocker: Type7.Unsafe({ ...blockerSchema, description: "\u5408\u6CD5\u963B\u65AD\u5B8C\u6210\u7684 blocker" }) }),
|
|
2766
|
+
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), remainingScope: Type7.String({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }), reason: Type7.Optional(Type7.String({ minLength: 1, 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" })), classResults: Type7.Optional(Type7.Unsafe({ ...completedClassResultsSchema, description: "\u672C\u5C40\u5DF2\u5B8C\u6210\u7684 class \u7ED3\u7B97" })), testEvidence: Type7.Optional(testEvidenceSchema) }),
|
|
2767
|
+
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), classResults: Type7.Array(classResultSchema, { description: "\u5DF2\u5B8C\u6210\u7684 class \u7ED3\u7B97" }), testEvidence: Type7.Optional(testEvidenceSchema) }),
|
|
2768
|
+
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), classResults: Type7.Array(classResultSchema, { description: "\u5404\u7C7B\u62D2\u7EDD\u7ED3\u7B97" }) }),
|
|
2769
|
+
Type7.Object({ status: Type7.Unknown({ description: FIXER_STATUS_DESCRIPTION }), report: Type7.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), classResults: Type7.Array(classResultSchema, { description: "\u5404\u7C7B\u5B8C\u6210\u6216\u62D2\u7EDD\u7ED3\u7B97" }), testEvidence: Type7.Optional(testEvidenceSchema) })
|
|
2739
2770
|
]);
|
|
2740
2771
|
fixerOutputSchema = withTerminatingOutputDeclarations(
|
|
2741
2772
|
openToolObjectFromUnion(fixerOutputVariants)
|
|
@@ -2744,7 +2775,7 @@ var init_fixer_output = __esm({
|
|
|
2744
2775
|
});
|
|
2745
2776
|
|
|
2746
2777
|
// src/package-contracts/fixer-packet.ts
|
|
2747
|
-
import { Type as
|
|
2778
|
+
import { Type as Type8 } from "typebox";
|
|
2748
2779
|
import { Value } from "typebox/value";
|
|
2749
2780
|
function causeMessage(cause) {
|
|
2750
2781
|
if (cause instanceof Error) return cause.message;
|
|
@@ -2804,11 +2835,11 @@ var init_fixer_packet = __esm({
|
|
|
2804
2835
|
"src/package-contracts/fixer-packet.ts"() {
|
|
2805
2836
|
"use strict";
|
|
2806
2837
|
FIXER_PREREQUISITE_ID_PATTERN = "^[A-Za-z0-9][A-Za-z0-9._-]*$";
|
|
2807
|
-
fixerPrerequisiteSchema =
|
|
2808
|
-
id:
|
|
2809
|
-
requirement:
|
|
2838
|
+
fixerPrerequisiteSchema = Type8.Object({
|
|
2839
|
+
id: Type8.String({ pattern: FIXER_PREREQUISITE_ID_PATTERN }),
|
|
2840
|
+
requirement: Type8.String({ pattern: "\\S" })
|
|
2810
2841
|
}, { additionalProperties: false });
|
|
2811
|
-
fixerPrerequisitesSchema =
|
|
2842
|
+
fixerPrerequisitesSchema = Type8.Array(fixerPrerequisiteSchema);
|
|
2812
2843
|
FixerPacketValidationError = class extends Error {
|
|
2813
2844
|
code = "AK_INVALID_FIX_PACKET";
|
|
2814
2845
|
constructor(cause) {
|
|
@@ -2849,7 +2880,7 @@ var init_canonical_json = __esm({
|
|
|
2849
2880
|
});
|
|
2850
2881
|
|
|
2851
2882
|
// src/doctor-contracts.ts
|
|
2852
|
-
import { Type as
|
|
2883
|
+
import { Type as Type9 } from "typebox";
|
|
2853
2884
|
function validateDoctorSubmissionShape(value) {
|
|
2854
2885
|
return value;
|
|
2855
2886
|
}
|
|
@@ -2868,43 +2899,43 @@ var init_doctor_contracts = __esm({
|
|
|
2868
2899
|
DOCTOR_AUDIT_TOOL_NAME = "ak_doctor_audit_decision";
|
|
2869
2900
|
DOCTOR_OUTPUT_TOOL_DESCRIPTION = "\u63D0\u4EA4\u552F\u4E00\u7EC8\u5C40\u5355\u6848\u8BC1\u8BCD\uFF1Bcompleted \u5141\u8BB8\u7A7A findings\u3002";
|
|
2870
2901
|
DOCTOR_TARGET_KINDS = ["law", "gate", "template", "station", "seat"];
|
|
2871
|
-
nonblank =
|
|
2872
|
-
evidenceIds =
|
|
2873
|
-
guardrail =
|
|
2874
|
-
lastRealBite =
|
|
2875
|
-
|
|
2876
|
-
|
|
2902
|
+
nonblank = Type9.Optional(Type9.String());
|
|
2903
|
+
evidenceIds = Type9.Optional(Type9.Array(Type9.String()));
|
|
2904
|
+
guardrail = Type9.Object({ answer: Type9.Optional(Type9.Boolean()), evidenceIds, explanation: nonblank }, { additionalProperties: true });
|
|
2905
|
+
lastRealBite = Type9.Union([
|
|
2906
|
+
Type9.Object({ kind: Type9.Optional(Type9.Literal("actual")), targetKey: nonblank, evidenceId: nonblank }, { additionalProperties: true }),
|
|
2907
|
+
Type9.Object({ kind: Type9.Optional(Type9.Literal("noRealBite")), targetKey: nonblank, eligibleEvidenceIds: evidenceIds }, { additionalProperties: true })
|
|
2877
2908
|
]);
|
|
2878
2909
|
assetKinds = DOCTOR_TARGET_KINDS;
|
|
2879
2910
|
findingBody = {
|
|
2880
2911
|
evidenceIds,
|
|
2881
|
-
disposition:
|
|
2882
|
-
guardrails:
|
|
2883
|
-
prescription:
|
|
2884
|
-
lastRealBite:
|
|
2912
|
+
disposition: Type9.Optional(Type9.Union([Type9.Literal("keep"), Type9.Literal("thin"), Type9.Literal("delete")])),
|
|
2913
|
+
guardrails: Type9.Optional(Type9.Object({ reproducibleFailure: guardrail, owningSeamOrInvariant: guardrail, deletionOrSimplificationSuffices: guardrail }, { additionalProperties: true })),
|
|
2914
|
+
prescription: Type9.Optional(Type9.Object({ kind: Type9.Optional(Type9.Union([Type9.Literal("retain"), Type9.Literal("delete"), Type9.Literal("simplify"), Type9.Literal("patch"), Type9.Literal("addMechanism")])), recommendation: nonblank, necessityExplanation: nonblank }, { additionalProperties: true })),
|
|
2915
|
+
lastRealBite: Type9.Optional(lastRealBite)
|
|
2885
2916
|
};
|
|
2886
|
-
finding =
|
|
2887
|
-
|
|
2888
|
-
|
|
2917
|
+
finding = Type9.Union([
|
|
2918
|
+
Type9.Object({ targetKey: nonblank, observation: nonblank, evidenceIds }, { additionalProperties: true }),
|
|
2919
|
+
Type9.Object({ targetKey: nonblank, targetKind: Type9.Optional(Type9.Union(assetKinds.map((kind) => Type9.Literal(kind)))), assetEvidence: Type9.Optional(Type9.Object({ targetKey: nonblank, targetKind: Type9.Optional(Type9.Union(assetKinds.map((kind) => Type9.Literal(kind)))), evidenceId: nonblank }, { additionalProperties: true })), ...findingBody }, { additionalProperties: true })
|
|
2889
2920
|
]);
|
|
2890
|
-
caseIdentity =
|
|
2921
|
+
caseIdentity = Type9.Object({ issueNumber: Type9.Optional(Type9.Integer()), runsPath: nonblank }, { additionalProperties: true });
|
|
2891
2922
|
DOCTOR_STATUS_DESCRIPTION = "completed | refused \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\uFF1Bcompleted \u5141\u8BB8\u7A7A findings\uFF1Brefused \u4EC5\u5F53\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u6848\u8BC1\u8BCD";
|
|
2892
|
-
doctorSubmissionVariants =
|
|
2893
|
-
|
|
2894
|
-
status:
|
|
2895
|
-
case:
|
|
2896
|
-
findings:
|
|
2923
|
+
doctorSubmissionVariants = Type9.Union([
|
|
2924
|
+
Type9.Object({
|
|
2925
|
+
status: Type9.Unknown({ description: DOCTOR_STATUS_DESCRIPTION }),
|
|
2926
|
+
case: Type9.Unsafe({ ...caseIdentity, description: "\u7559\u5B58\u592A\u533B\u7F72\u6848\u8EAB\u4EFD" }),
|
|
2927
|
+
findings: Type9.Array(finding, { description: "\u53EF\u7A7A\u6216\u4EC5\u542B\u975E\u5904\u65B9\u6848\u89C2\u5BDF\uFF1B\u7F3A\u53EF\u590D\u7528\u8D44\u4EA7\u6216 bounded-bite \u8BC1\u636E\u53EA\u6392\u9664\u5BF9\u5E94\u8D44\u4EA7\u5904\u65B9" })
|
|
2897
2928
|
}, { additionalProperties: false, description: "\u5355\u6848\u8BC1\u8BCD\uFF0C\u4E0D\u8981\u6C42\u4EFB\u4F55\u5904\u65B9\u6216\u53EF\u590D\u7528 finding" }),
|
|
2898
|
-
|
|
2899
|
-
status:
|
|
2900
|
-
reason:
|
|
2901
|
-
missingEvidence:
|
|
2929
|
+
Type9.Object({
|
|
2930
|
+
status: Type9.Unknown({ description: DOCTOR_STATUS_DESCRIPTION }),
|
|
2931
|
+
reason: Type9.String({ description: "\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u8BC1\u8BCD\u7684\u539F\u56E0" }),
|
|
2932
|
+
missingEvidence: Type9.Array(Type9.Object({ need: nonblank, targetKeys: evidenceIds }, { additionalProperties: true }), { description: "\u5982\u5B9E\u8BC1\u8BCD\u6240\u9700\u800C\u5C1A\u7F3A\u7684\u8BC1\u636E" })
|
|
2902
2933
|
}, { additionalProperties: false, description: "\u8BC1\u636E\u4E0D\u8DB3\u4EE5\u652F\u6491\u5982\u5B9E\u6848\u8BC1\u8BCD" })
|
|
2903
2934
|
]);
|
|
2904
2935
|
doctorSubmissionSchema = withTerminatingOutputDeclarations(
|
|
2905
2936
|
openToolObjectFromUnion(doctorSubmissionVariants)
|
|
2906
2937
|
);
|
|
2907
|
-
doctorEvidenceReadSchema =
|
|
2938
|
+
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 });
|
|
2908
2939
|
DoctorEvidenceStore = class {
|
|
2909
2940
|
constructor(patient) {
|
|
2910
2941
|
this.patient = patient;
|
|
@@ -2973,7 +3004,7 @@ var init_exact_utf8 = __esm({
|
|
|
2973
3004
|
});
|
|
2974
3005
|
|
|
2975
3006
|
// src/merger-contracts.ts
|
|
2976
|
-
import { Type as
|
|
3007
|
+
import { Type as Type10 } from "typebox";
|
|
2977
3008
|
function fail3(message = "Merger input violates its exact contract") {
|
|
2978
3009
|
throw new MergerInputContractError(message);
|
|
2979
3010
|
}
|
|
@@ -3003,21 +3034,21 @@ var init_merger_contracts = __esm({
|
|
|
3003
3034
|
init_exact_utf8();
|
|
3004
3035
|
init_open_tool_schema();
|
|
3005
3036
|
init_terminating_infrastructure();
|
|
3006
|
-
materialSchema =
|
|
3007
|
-
checkSchema =
|
|
3008
|
-
mergerInputSchema =
|
|
3009
|
-
attemptId:
|
|
3010
|
-
targetObjectId:
|
|
3011
|
-
sourceObjectId:
|
|
3012
|
-
materials:
|
|
3013
|
-
expectedConflictPaths:
|
|
3014
|
-
resolutionScope:
|
|
3015
|
-
authorizedChecks:
|
|
3037
|
+
materialSchema = Type10.Object({ bytesBase64: Type10.String(), sha256: Type10.String() }, { additionalProperties: false });
|
|
3038
|
+
checkSchema = Type10.Object({ name: Type10.String({ minLength: 1 }), argv: Type10.Array(Type10.String({ minLength: 1 }), { minItems: 1 }) }, { additionalProperties: false });
|
|
3039
|
+
mergerInputSchema = Type10.Object({
|
|
3040
|
+
attemptId: Type10.String({ minLength: 1, description: "\u5BF9\u8D26 attempt \u8EAB\u4EFD\uFF08transport\uFF09" }),
|
|
3041
|
+
targetObjectId: Type10.String({ description: "\u6750\u6599\uFF1Atarget parent OID\uFF1B\u53EF\u7A7A" }),
|
|
3042
|
+
sourceObjectId: Type10.String({ description: "\u6750\u6599\uFF1Asource parent OID\uFF1B\u53EF\u7A7A" }),
|
|
3043
|
+
materials: Type10.Object({ task: materialSchema, authority: materialSchema, targetIntent: materialSchema, sourceIntent: materialSchema }, { additionalProperties: false }),
|
|
3044
|
+
expectedConflictPaths: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u5F53\u524D\u672A\u5408\u5E76\u8DEF\u5F84\uFF1B\u53EF\u7A7A" }),
|
|
3045
|
+
resolutionScope: Type10.Array(Type10.String(), { description: "\u6750\u6599\uFF1A\u89E3\u6790\u8303\u56F4\u63D0\u793A\uFF1B\u53EF\u7A7A" }),
|
|
3046
|
+
authorizedChecks: Type10.Array(checkSchema)
|
|
3016
3047
|
}, { additionalProperties: false });
|
|
3017
3048
|
MERGER_STATUS_DESCRIPTION = "completed | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8";
|
|
3018
|
-
mergerOutputVariants =
|
|
3019
|
-
|
|
3020
|
-
|
|
3049
|
+
mergerOutputVariants = Type10.Union([
|
|
3050
|
+
Type10.Object({ status: Type10.Unknown({ description: MERGER_STATUS_DESCRIPTION }), attemptId: Type10.String({ description: "\u5DF2\u53D7\u7406\u5408\u5E76 attempt \u8EAB\u4EFD" }), report: Type10.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }), mergeCommitId: Type10.String({ description: "\u5B8C\u6210\u5408\u5E76 commit object ID" }) }, { additionalProperties: false }),
|
|
3051
|
+
Type10.Object({ status: Type10.Unknown({ description: MERGER_STATUS_DESCRIPTION }), attemptId: Type10.String({ description: "\u5DF2\u53D7\u7406\u5408\u5E76 attempt \u8EAB\u4EFD" }), diagnosis: Type10.String({ 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" }), report: Type10.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }) }, { additionalProperties: false })
|
|
3021
3052
|
]);
|
|
3022
3053
|
mergerOutputSchema = withTerminatingOutputDeclarations(openToolObjectFromUnion(mergerOutputVariants));
|
|
3023
3054
|
MERGER_OUTPUT_TOOL_NAME = "ak_merger_output";
|
|
@@ -3035,14 +3066,12 @@ var init_merger_contracts = __esm({
|
|
|
3035
3066
|
});
|
|
3036
3067
|
|
|
3037
3068
|
// src/notary-contracts.ts
|
|
3038
|
-
import { Type as Type10 } from "typebox";
|
|
3039
3069
|
var NOTARY_OUTPUT_TOOL_NAME, NOTARY_SOURCE_RUN_FLAG, NOTARY_TICKET_FLAG, NOTARY_FIXED_KICKOFF, notaryOutputSchema;
|
|
3040
3070
|
var init_notary_contracts = __esm({
|
|
3041
3071
|
"src/notary-contracts.ts"() {
|
|
3042
3072
|
"use strict";
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
NOTARY_OUTPUT_TOOL_NAME = "ak_notary_output";
|
|
3073
|
+
init_review_submission();
|
|
3074
|
+
NOTARY_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
|
|
3046
3075
|
NOTARY_SOURCE_RUN_FLAG = {
|
|
3047
3076
|
name: "ak-notary-source-run",
|
|
3048
3077
|
definition: {
|
|
@@ -3058,21 +3087,7 @@ var init_notary_contracts = __esm({
|
|
|
3058
3087
|
}
|
|
3059
3088
|
};
|
|
3060
3089
|
NOTARY_FIXED_KICKOFF = "\u7B26\u5B9D\u90CE\u6848\u5377\u5DF2\u53D7\u7406\uFF1B\u6765\u6E90 run \u5B9A\u4F4D\u89C1\u4F1A\u8BDD\u6750\u6599\u3002";
|
|
3061
|
-
notaryOutputSchema =
|
|
3062
|
-
openToolObject(
|
|
3063
|
-
Type10.Object({
|
|
3064
|
-
status: Type10.Unknown({
|
|
3065
|
-
description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
3066
|
-
}),
|
|
3067
|
-
findings: Type10.Unknown({
|
|
3068
|
-
description: "string[] findings\uFF0C\u968F pass\u3001bounce \u6216 escalate \u7559\u5B58"
|
|
3069
|
-
}),
|
|
3070
|
-
reason: Type10.Optional(Type10.Unknown({
|
|
3071
|
-
description: "status \u4E3A escalate \u65F6\u7684\u4E0A\u5448\u7406\u7531"
|
|
3072
|
-
}))
|
|
3073
|
-
})
|
|
3074
|
-
)
|
|
3075
|
-
);
|
|
3090
|
+
notaryOutputSchema = reviewSubmissionSchema;
|
|
3076
3091
|
}
|
|
3077
3092
|
});
|
|
3078
3093
|
|
|
@@ -3081,7 +3096,8 @@ var COUNTERSIGN_OUTPUT_TOOL_NAME;
|
|
|
3081
3096
|
var init_countersign_contracts = __esm({
|
|
3082
3097
|
"src/countersign-contracts.ts"() {
|
|
3083
3098
|
"use strict";
|
|
3084
|
-
|
|
3099
|
+
init_review_submission();
|
|
3100
|
+
COUNTERSIGN_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
|
|
3085
3101
|
}
|
|
3086
3102
|
});
|
|
3087
3103
|
|
|
@@ -3106,7 +3122,8 @@ var INSPECTOR_OUTPUT_TOOL_NAME, INSPECTOR_SOURCE_RUN_FLAG;
|
|
|
3106
3122
|
var init_inspector_contracts = __esm({
|
|
3107
3123
|
"src/inspector-contracts.ts"() {
|
|
3108
3124
|
"use strict";
|
|
3109
|
-
|
|
3125
|
+
init_review_submission();
|
|
3126
|
+
INSPECTOR_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
|
|
3110
3127
|
INSPECTOR_SOURCE_RUN_FLAG = {
|
|
3111
3128
|
name: "ak-inspector-source-run",
|
|
3112
3129
|
definition: {
|
|
@@ -3118,32 +3135,13 @@ var init_inspector_contracts = __esm({
|
|
|
3118
3135
|
});
|
|
3119
3136
|
|
|
3120
3137
|
// src/package-contracts/auditor-output.ts
|
|
3121
|
-
import { Type as Type11 } from "typebox";
|
|
3122
3138
|
var AUDITOR_OUTPUT_TOOL_NAME, auditorOutputSchema;
|
|
3123
3139
|
var init_auditor_output = __esm({
|
|
3124
3140
|
"src/package-contracts/auditor-output.ts"() {
|
|
3125
3141
|
"use strict";
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
auditorOutputSchema = withTerminatingOutputDeclarations(
|
|
3130
|
-
openToolObject(
|
|
3131
|
-
Type11.Object({
|
|
3132
|
-
status: Type11.Unknown({
|
|
3133
|
-
description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
3134
|
-
}),
|
|
3135
|
-
violations: Type11.Optional(Type11.Unknown({
|
|
3136
|
-
description: "status \u4E3A bounce \u65F6\u7684\u8FDD\u89C4\u6761\u76EE"
|
|
3137
|
-
})),
|
|
3138
|
-
conflicts: Type11.Optional(Type11.Unknown({
|
|
3139
|
-
description: "status \u4E3A escalate \u65F6\u7684\u51B2\u7A81"
|
|
3140
|
-
})),
|
|
3141
|
-
decisionGate: Type11.Optional(Type11.Unknown({
|
|
3142
|
-
description: "status \u4E3A escalate \u65F6\u7684\u51B3\u7B56\u95F8"
|
|
3143
|
-
}))
|
|
3144
|
-
})
|
|
3145
|
-
)
|
|
3146
|
-
);
|
|
3142
|
+
init_review_submission();
|
|
3143
|
+
AUDITOR_OUTPUT_TOOL_NAME = REVIEW_SUBMISSION_OUTPUT_TOOL_NAME;
|
|
3144
|
+
auditorOutputSchema = reviewSubmissionSchema;
|
|
3147
3145
|
}
|
|
3148
3146
|
});
|
|
3149
3147
|
|
|
@@ -3362,6 +3360,7 @@ var packaged_role_registry_exports = {};
|
|
|
3362
3360
|
__export(packaged_role_registry_exports, {
|
|
3363
3361
|
AUDITOR_PUBLIC_SESSION_MATERIALS: () => AUDITOR_PUBLIC_SESSION_MATERIALS,
|
|
3364
3362
|
INSPECTOR_SESSION_MATERIALS: () => INSPECTOR_SESSION_MATERIALS,
|
|
3363
|
+
LEGACY_REVIEW_OUTPUT_ROLES: () => LEGACY_REVIEW_OUTPUT_ROLES,
|
|
3365
3364
|
NOTARY_SESSION_MATERIALS: () => NOTARY_SESSION_MATERIALS,
|
|
3366
3365
|
PACKAGED_ROLE_REGISTRY: () => PACKAGED_ROLE_REGISTRY,
|
|
3367
3366
|
PUBLIC_ROLE_RECORDS: () => PUBLIC_ROLE_RECORDS,
|
|
@@ -3378,7 +3377,6 @@ __export(packaged_role_registry_exports, {
|
|
|
3378
3377
|
packagedBoardPlacement: () => packagedBoardPlacement,
|
|
3379
3378
|
packagedDurableOfficerEntry: () => packagedDurableOfficerEntry,
|
|
3380
3379
|
packagedEmitsAuthorityRefs: () => packagedEmitsAuthorityRefs,
|
|
3381
|
-
packagedGateDecision: () => packagedGateDecision,
|
|
3382
3380
|
packagedGateStageLabel: () => packagedGateStageLabel,
|
|
3383
3381
|
packagedGateSummon: () => packagedGateSummon,
|
|
3384
3382
|
packagedMethodLoadFailureCause: () => packagedMethodLoadFailureCause,
|
|
@@ -3545,14 +3543,7 @@ function packagedGateSummon(role) {
|
|
|
3545
3543
|
if (record4 !== void 0 && "gateSummon" in record4) return record4.gateSummon;
|
|
3546
3544
|
return "pointer";
|
|
3547
3545
|
}
|
|
3548
|
-
|
|
3549
|
-
const record4 = packagedRoleMetadata(role);
|
|
3550
|
-
if (record4 !== void 0 && "gateDecision" in record4 && record4.gateDecision === "countersign-status") {
|
|
3551
|
-
return "countersign-status";
|
|
3552
|
-
}
|
|
3553
|
-
return "three-state";
|
|
3554
|
-
}
|
|
3555
|
-
var NOTARY_SESSION_MATERIALS, INSPECTOR_SESSION_MATERIALS, AUDITOR_PUBLIC_SESSION_MATERIALS, PUBLIC_ROLE_RECORDS, PACKAGED_ROLE_REGISTRY;
|
|
3546
|
+
var LEGACY_REVIEW_OUTPUT_ROLES, NOTARY_SESSION_MATERIALS, INSPECTOR_SESSION_MATERIALS, AUDITOR_PUBLIC_SESSION_MATERIALS, PUBLIC_ROLE_RECORDS, PACKAGED_ROLE_REGISTRY;
|
|
3556
3547
|
var init_packaged_role_registry = __esm({
|
|
3557
3548
|
"src/packaged-role-registry.ts"() {
|
|
3558
3549
|
"use strict";
|
|
@@ -3573,6 +3564,13 @@ var init_packaged_role_registry = __esm({
|
|
|
3573
3564
|
init_diarist_contracts();
|
|
3574
3565
|
init_secretariat_contracts();
|
|
3575
3566
|
init_judge_auditor();
|
|
3567
|
+
LEGACY_REVIEW_OUTPUT_ROLES = /* @__PURE__ */ new Map([
|
|
3568
|
+
["ak_judge_output", "judge"],
|
|
3569
|
+
["ak_notary_output", "notary"],
|
|
3570
|
+
["ak_countersign_output", "countersign"],
|
|
3571
|
+
["ak_inspector_output", "inspector"],
|
|
3572
|
+
["ak_auditor_output", "auditor"]
|
|
3573
|
+
]);
|
|
3576
3574
|
NOTARY_SESSION_MATERIALS = [
|
|
3577
3575
|
"CLAUDE.md",
|
|
3578
3576
|
"souls/notary.md",
|
|
@@ -3614,7 +3612,7 @@ var init_packaged_role_registry = __esm({
|
|
|
3614
3612
|
/** Navigator subject is the public admitted instruction when the run is bound. */
|
|
3615
3613
|
navigatorSubject: "public-instruction",
|
|
3616
3614
|
activationStage: "load-and-install",
|
|
3617
|
-
receiptStatusKey: "
|
|
3615
|
+
receiptStatusKey: "status",
|
|
3618
3616
|
sessionMaterials: [
|
|
3619
3617
|
"CLAUDE.md",
|
|
3620
3618
|
"souls/judge.md",
|
|
@@ -3896,15 +3894,13 @@ var init_packaged_role_registry = __esm({
|
|
|
3896
3894
|
outputTool: COUNTERSIGN_OUTPUT_TOOL_NAME,
|
|
3897
3895
|
settlement: "accepted",
|
|
3898
3896
|
gateStageLabel: "\u7ED9\u4E8B\u4E2D",
|
|
3899
|
-
/** Gate queue reads countersignStatus, not the shared three-state status. */
|
|
3900
|
-
gateDecision: "countersign-status",
|
|
3901
3897
|
/** Gate summon carries the parent payload as the instruction and a parent run id. */
|
|
3902
3898
|
gateSummon: "parent-instruction",
|
|
3903
3899
|
activationFlags: [
|
|
3904
3900
|
{ field: "ticketNumber" }
|
|
3905
3901
|
],
|
|
3906
3902
|
activationStage: "load-and-install",
|
|
3907
|
-
receiptStatusKey: "
|
|
3903
|
+
receiptStatusKey: "status",
|
|
3908
3904
|
// #924: 公用《票面法》三席同装
|
|
3909
3905
|
sessionMaterials: ["CLAUDE.md", "souls/countersign.md", "souls/ticket-law.md"]
|
|
3910
3906
|
},
|
|
@@ -4270,32 +4266,22 @@ function readRecord(value) {
|
|
|
4270
4266
|
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
4271
4267
|
return value;
|
|
4272
4268
|
}
|
|
4273
|
-
function
|
|
4274
|
-
if (status === "converged") return "
|
|
4275
|
-
if (status === "continue") return "
|
|
4269
|
+
function reviewQueueStatus(status) {
|
|
4270
|
+
if (status === "converged") return "converged";
|
|
4271
|
+
if (status === "continue") return "continue";
|
|
4276
4272
|
if (status === "escalate") return "escalate";
|
|
4277
4273
|
return void 0;
|
|
4278
4274
|
}
|
|
4279
4275
|
function projectOfficerDecision(officer, decision, fallbackStatus) {
|
|
4280
4276
|
const receipt = retainedReceipt(decision);
|
|
4281
4277
|
const record4 = readRecord(decision);
|
|
4282
|
-
if (packagedGateDecision(officer) === "countersign-status") {
|
|
4283
|
-
const countersignStatus = record4 !== void 0 && typeof record4.countersignStatus === "string" ? record4.countersignStatus : void 0;
|
|
4284
|
-
const status2 = typeof countersignStatus === "string" ? gateStatusFromCountersign(countersignStatus) : void 0;
|
|
4285
|
-
if (status2 === "pass") {
|
|
4286
|
-
return { status: "pass", officer, receipt };
|
|
4287
|
-
}
|
|
4288
|
-
if (status2 === "bounce" || status2 === "escalate") {
|
|
4289
|
-
return { status: status2, officer, receipt };
|
|
4290
|
-
}
|
|
4291
|
-
return { status: "needs_reask", officer, receipt };
|
|
4292
|
-
}
|
|
4293
4278
|
const status = (record4 !== void 0 && typeof record4.status === "string" ? record4.status : void 0) ?? fallbackStatus;
|
|
4294
|
-
|
|
4295
|
-
|
|
4279
|
+
const queueStatus = typeof status === "string" ? reviewQueueStatus(status) : void 0;
|
|
4280
|
+
if (queueStatus === "converged") {
|
|
4281
|
+
return { status: "converged", officer, receipt };
|
|
4296
4282
|
}
|
|
4297
|
-
if (
|
|
4298
|
-
return { status, officer, receipt };
|
|
4283
|
+
if (queueStatus === "continue" || queueStatus === "escalate") {
|
|
4284
|
+
return { status: queueStatus, officer, receipt };
|
|
4299
4285
|
}
|
|
4300
4286
|
return { status: "needs_reask", officer, receipt };
|
|
4301
4287
|
}
|
|
@@ -4327,7 +4313,7 @@ function officerRunIdFromSummoned(summoned) {
|
|
|
4327
4313
|
return void 0;
|
|
4328
4314
|
}
|
|
4329
4315
|
function withOfficerRunId(result, summoned) {
|
|
4330
|
-
if (result.status !== "
|
|
4316
|
+
if (result.status !== "converged" && result.status !== "continue" && result.status !== "escalate" && result.status !== "needs_reask") {
|
|
4331
4317
|
return result;
|
|
4332
4318
|
}
|
|
4333
4319
|
if (typeof result.runId === "string" && result.runId.trim() !== "") return result;
|
|
@@ -4394,7 +4380,7 @@ function projectOfficerTerminal(officer, summoned) {
|
|
|
4394
4380
|
);
|
|
4395
4381
|
}
|
|
4396
4382
|
function officerConclusionReask(officer) {
|
|
4397
|
-
return
|
|
4383
|
+
return OFFICER_CONCLUSION_REASK;
|
|
4398
4384
|
}
|
|
4399
4385
|
async function projectGatekeeperRun(options) {
|
|
4400
4386
|
const officer = gateOfficerForSubject(options.subject);
|
|
@@ -4430,7 +4416,7 @@ async function projectGatekeeperRun(options) {
|
|
|
4430
4416
|
summoned
|
|
4431
4417
|
};
|
|
4432
4418
|
}
|
|
4433
|
-
var GATE_OFFICER_BY_SUBJECT, GATEKEEPER_TOOL_SPEC, OFFICER_CONCLUSION_REASK
|
|
4419
|
+
var GATE_OFFICER_BY_SUBJECT, GATEKEEPER_TOOL_SPEC, OFFICER_CONCLUSION_REASK;
|
|
4434
4420
|
var init_gatekeeper_role = __esm({
|
|
4435
4421
|
"src/gatekeeper-role.ts"() {
|
|
4436
4422
|
"use strict";
|
|
@@ -4438,6 +4424,7 @@ var init_gatekeeper_role = __esm({
|
|
|
4438
4424
|
init_packaged_role_registry();
|
|
4439
4425
|
init_submission_errors();
|
|
4440
4426
|
init_inspector_contracts();
|
|
4427
|
+
init_review_submission();
|
|
4441
4428
|
init_gatekeeper_output();
|
|
4442
4429
|
init_run_terminal_artifacts();
|
|
4443
4430
|
init_submission_errors();
|
|
@@ -4455,8 +4442,7 @@ var init_gatekeeper_role = __esm({
|
|
|
4455
4442
|
promptSnippet: "\u95E8\u4E0B\u7701\u51B3\u8BAE",
|
|
4456
4443
|
parameters: gatekeeperOutputSchema
|
|
4457
4444
|
};
|
|
4458
|
-
OFFICER_CONCLUSION_REASK = "\u4E0A\u6B21\u4EA4\u5377\u7684\
|
|
4459
|
-
COUNTERSIGN_CONCLUSION_REASK = "\u4E0A\u6B21\u4EA4\u5377\u7684 countersignStatus \u4E0D\u662F converged\u3001continue\u3001escalate \u4E09\u6001\u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u8F93\u51FA\uFF0CcountersignStatus \u5199\u660E\u5176\u4E00\uFF1B\u5C01\u9A73\u6216\u4E0A\u5448\u7684\u8BDD\u5C31\u662F\u7ED9\u5BF9\u65B9\u770B\u7684\u539F\u6587\u3002";
|
|
4445
|
+
OFFICER_CONCLUSION_REASK = "\u4E0A\u6B21\u4EA4\u5377\u7684 status \u4E0D\u662F converged\u3001continue\u3001escalate \u4E09\u6001\u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u8F93\u51FA\uFF0Cstatus \u5199\u660E\u5176\u4E00\uFF1Bcontinue \u6216 escalate \u7684\u8BDD\u5C31\u662F\u7ED9\u5BF9\u65B9\u770B\u7684\u539F\u6587\u3002";
|
|
4460
4446
|
}
|
|
4461
4447
|
});
|
|
4462
4448
|
|
|
@@ -6061,7 +6047,8 @@ function validateAcceptedDetails(_toolName, details) {
|
|
|
6061
6047
|
function acceptedFacts(toolName, details) {
|
|
6062
6048
|
const record4 = details;
|
|
6063
6049
|
const entry = PACKAGED_ROLE_REGISTRY.find((candidate) => candidate.outputTool === toolName);
|
|
6064
|
-
const
|
|
6050
|
+
const legacyRole = LEGACY_REVIEW_OUTPUT_ROLES.get(toolName);
|
|
6051
|
+
const statusKey = legacyRole === "judge" || legacyRole === "countersign" ? `${legacyRole}Status` : entry !== void 0 && "receiptStatusKey" in entry ? entry.receiptStatusKey : "status";
|
|
6065
6052
|
const status = typeof record4[statusKey] === "string" ? record4[statusKey] : void 0;
|
|
6066
6053
|
const commitKey = entry !== void 0 && "receiptCommitKey" in entry ? entry.receiptCommitKey : void 0;
|
|
6067
6054
|
const commitWhen = entry !== void 0 && "receiptCommitWhen" in entry ? entry.receiptCommitWhen : void 0;
|
|
@@ -6092,7 +6079,10 @@ var init_terminating_tools = __esm({
|
|
|
6092
6079
|
init_diarist_contracts();
|
|
6093
6080
|
init_secretariat_contracts();
|
|
6094
6081
|
init_worker_output();
|
|
6095
|
-
TERMINATING_TOOL_NAMES =
|
|
6082
|
+
TERMINATING_TOOL_NAMES = [.../* @__PURE__ */ new Set([
|
|
6083
|
+
...PACKAGED_ROLE_REGISTRY.map((entry) => entry.outputTool),
|
|
6084
|
+
...LEGACY_REVIEW_OUTPUT_ROLES.keys()
|
|
6085
|
+
])];
|
|
6096
6086
|
AcceptedDetailsContractError = class extends CorrectableSubmissionError {
|
|
6097
6087
|
code = "accepted_details_contract";
|
|
6098
6088
|
constructor(message, options) {
|
|
@@ -6174,6 +6164,7 @@ function deriveSession(content, id) {
|
|
|
6174
6164
|
let accepted, observedCommit, turns = 0, calls = 0, tokens = 0;
|
|
6175
6165
|
const statuses = [], commits = [];
|
|
6176
6166
|
for (const row of rows) {
|
|
6167
|
+
if (row.type === "custom" && row.customType === "ak-role-submission-closure" && record3(row.data) && row.data.isError === false && typeof row.data.toolName === "string" && isTerminatingToolName(row.data.toolName)) accepted = row;
|
|
6177
6168
|
const message = record3(row.message) ? row.message : void 0;
|
|
6178
6169
|
if (message?.role === "assistant") {
|
|
6179
6170
|
for (const part of Array.isArray(message.content) ? message.content : []) if (record3(part) && part.type === "toolCall") calls++;
|
|
@@ -6191,7 +6182,6 @@ function deriveSession(content, id) {
|
|
|
6191
6182
|
if (error instanceof AcceptedDetailsContractError) continue;
|
|
6192
6183
|
throw error;
|
|
6193
6184
|
}
|
|
6194
|
-
accepted = row;
|
|
6195
6185
|
const facts = acceptedFacts(message.toolName, details);
|
|
6196
6186
|
if (facts.commit && facts.commit !== observedCommit) {
|
|
6197
6187
|
commits.push({ source: id, commit: facts.commit });
|
|
@@ -9907,7 +9897,7 @@ var init_option_definitions = __esm({
|
|
|
9907
9897
|
},
|
|
9908
9898
|
inspector: {
|
|
9909
9899
|
command: "inspector",
|
|
9910
|
-
summary: "Direct Inspector (\u53F0\u9662) complexity and test-quality check;
|
|
9900
|
+
summary: "Direct Inspector (\u53F0\u9662) complexity and test-quality check; converged, continue, or escalate.",
|
|
9911
9901
|
usage: ["ak-role inspector [options] [instruction]"],
|
|
9912
9902
|
examples: [
|
|
9913
9903
|
'ak-role inspector --attach ./change.patch "Review this material."'
|
|
@@ -9931,7 +9921,7 @@ var init_option_definitions = __esm({
|
|
|
9931
9921
|
},
|
|
9932
9922
|
auditor: {
|
|
9933
9923
|
command: "auditor",
|
|
9934
|
-
summary: "Direct Auditor (\u5BA1\u5211\u9662) compliance audit:
|
|
9924
|
+
summary: "Direct Auditor (\u5BA1\u5211\u9662) compliance audit: converged, continue, or escalate.",
|
|
9935
9925
|
usage: ["ak-role auditor --subject <judge|doctor> --source-run <runId@role|path> [options] [instruction]"],
|
|
9936
9926
|
examples: [
|
|
9937
9927
|
'ak-role auditor --subject judge --source-run 01abc\u2026@judge --attach ./dossier "\u5BA1\uFF1A\u672C run \u662F\u5426\u5408\u89C4\u3002"',
|
|
@@ -12682,7 +12672,7 @@ function optionalDispatchReason(raw) {
|
|
|
12682
12672
|
return raw;
|
|
12683
12673
|
}
|
|
12684
12674
|
function isGateTerminatingToolName(toolName) {
|
|
12685
|
-
return DISPATCH_TOOLS.has(toolName) || OFFICER_TOOL_TO_FACE[toolName] !== void 0;
|
|
12675
|
+
return toolName === "ak_submission_output" || DISPATCH_TOOLS.has(toolName) || OFFICER_TOOL_TO_FACE[toolName] !== void 0;
|
|
12686
12676
|
}
|
|
12687
12677
|
function acceptedGateReceiptIds(rows) {
|
|
12688
12678
|
const accepted = /* @__PURE__ */ new Set();
|
|
@@ -12757,7 +12747,7 @@ function extractAllAcceptedGateToolCalls(rows) {
|
|
|
12757
12747
|
}
|
|
12758
12748
|
return out;
|
|
12759
12749
|
}
|
|
12760
|
-
function projectAcceptedGateCall(filePath, rows, call) {
|
|
12750
|
+
function projectAcceptedGateCall(filePath, rows, call, pointerOfficer) {
|
|
12761
12751
|
const span = requireAcceptedGateSpan(intervalRowsForGateCall(rows, call.rowIndex), filePath);
|
|
12762
12752
|
const status = readAcceptedGateStatus(call.args);
|
|
12763
12753
|
const findings = asFindings(call.args?.findings);
|
|
@@ -12784,7 +12774,7 @@ function projectAcceptedGateCall(filePath, rows, call) {
|
|
|
12784
12774
|
...bindingFields
|
|
12785
12775
|
};
|
|
12786
12776
|
}
|
|
12787
|
-
const officer = OFFICER_TOOL_TO_FACE[call.toolName];
|
|
12777
|
+
const officer = call.toolName === "ak_submission_output" ? pointerOfficer : OFFICER_TOOL_TO_FACE[call.toolName];
|
|
12788
12778
|
if (officer === void 0) {
|
|
12789
12779
|
throw new Error(
|
|
12790
12780
|
`accepted gate receipt has unknown officer tool ${call.toolName} in ${filePath}`
|
|
@@ -12802,13 +12792,13 @@ function projectAcceptedGateCall(filePath, rows, call) {
|
|
|
12802
12792
|
...bindingFields
|
|
12803
12793
|
};
|
|
12804
12794
|
}
|
|
12805
|
-
async function classifyAuditorVolume(filePath) {
|
|
12795
|
+
async function classifyAuditorVolume(filePath, pointerOfficer) {
|
|
12806
12796
|
const rows = await readLedgerSessionJsonl(filePath);
|
|
12807
12797
|
const accepted = extractAllAcceptedGateToolCalls(rows);
|
|
12808
12798
|
if (accepted.length === 0) return [];
|
|
12809
12799
|
const volumes = [];
|
|
12810
12800
|
for (const call of accepted) {
|
|
12811
|
-
const projected = projectAcceptedGateCall(filePath, rows, call);
|
|
12801
|
+
const projected = call.toolName === "ak_submission_output" && pointerOfficer === void 0 ? void 0 : projectAcceptedGateCall(filePath, rows, call, pointerOfficer);
|
|
12812
12802
|
if (projected !== void 0) volumes.push(projected);
|
|
12813
12803
|
}
|
|
12814
12804
|
return volumes;
|
|
@@ -12888,7 +12878,8 @@ async function resolveOfficerSessionFromPointerFile(pointerPath) {
|
|
|
12888
12878
|
if (typeof sessionFile !== "string" || sessionFile.trim() === "") {
|
|
12889
12879
|
throw new Error(`direct officer run pointer missing sessionFile in ${pointerPath}`);
|
|
12890
12880
|
}
|
|
12891
|
-
|
|
12881
|
+
const officer = raw.officer === "inspector" || raw.officer === "notary" ? raw.officer : void 0;
|
|
12882
|
+
return { sessionFile, ...officer === void 0 ? {} : { officer } };
|
|
12892
12883
|
}
|
|
12893
12884
|
async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, options = {}) {
|
|
12894
12885
|
const directories = typeof auditorRolesDirectory === "string" ? [auditorRolesDirectory] : auditorRolesDirectory;
|
|
@@ -12908,13 +12899,13 @@ async function readAnalystGateCyclesFromAuditorRoles(auditorRolesDirectory, opti
|
|
|
12908
12899
|
for (const name of names) {
|
|
12909
12900
|
const path = join22(directory, name);
|
|
12910
12901
|
const fromPointer = name.endsWith(".pointer.json");
|
|
12911
|
-
const
|
|
12912
|
-
|
|
12902
|
+
const pointer = fromPointer ? await resolveOfficerSessionFromPointerFile(path) : void 0;
|
|
12903
|
+
const sessionPath = pointer?.sessionFile ?? path;
|
|
12913
12904
|
if (fromPointer) {
|
|
12914
12905
|
if (classifiedOfficerSessions.has(sessionPath)) continue;
|
|
12915
12906
|
classifiedOfficerSessions.add(sessionPath);
|
|
12916
12907
|
}
|
|
12917
|
-
const classified = await classifyAuditorVolume(sessionPath);
|
|
12908
|
+
const classified = await classifyAuditorVolume(sessionPath, pointer?.officer);
|
|
12918
12909
|
for (const volume of classified) {
|
|
12919
12910
|
if (options.parentSessionFile !== void 0 && volume.parentSessionFile !== void 0 && volume.parentSessionFile !== options.parentSessionFile) {
|
|
12920
12911
|
continue;
|
|
@@ -13019,8 +13010,8 @@ function isAuditEscalationResult(value) {
|
|
|
13019
13010
|
}
|
|
13020
13011
|
async function disposeComplianceDecision(decision, handlers, deliveredOutput) {
|
|
13021
13012
|
switch (decision.status) {
|
|
13022
|
-
case "
|
|
13023
|
-
return await handlers.
|
|
13013
|
+
case "converged":
|
|
13014
|
+
return await handlers.converged(decision.usage);
|
|
13024
13015
|
case "no-receipt":
|
|
13025
13016
|
if (handlers.noReceipt === void 0) {
|
|
13026
13017
|
throw new Error("Compliance no-receipt projection handler is unavailable");
|
|
@@ -13037,8 +13028,8 @@ async function disposeComplianceDecision(decision, handlers, deliveredOutput) {
|
|
|
13037
13028
|
decision,
|
|
13038
13029
|
decision.usage === void 0 ? {} : { usage: decision.usage }
|
|
13039
13030
|
);
|
|
13040
|
-
case "
|
|
13041
|
-
return await handlers.
|
|
13031
|
+
case "continue":
|
|
13032
|
+
return await handlers.continue(decision.violations);
|
|
13042
13033
|
case "escalate":
|
|
13043
13034
|
return await handlers.escalate(
|
|
13044
13035
|
projectAuditEscalation(decision, deliveredOutput)
|
|
@@ -13380,7 +13371,14 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
13380
13371
|
return {
|
|
13381
13372
|
...host,
|
|
13382
13373
|
registerTool(tool) {
|
|
13383
|
-
const
|
|
13374
|
+
const registeredRole = outputTools.get(tool.name);
|
|
13375
|
+
let role;
|
|
13376
|
+
if (typeof registeredRole === "string") {
|
|
13377
|
+
role = registeredRole;
|
|
13378
|
+
} else if (registeredRole !== void 0) {
|
|
13379
|
+
const activeRole = host.getFlag("ak-role");
|
|
13380
|
+
role = typeof activeRole === "string" && registeredRole.includes(activeRole) ? activeRole : void 0;
|
|
13381
|
+
}
|
|
13384
13382
|
if (role === void 0) return host.registerTool(tool);
|
|
13385
13383
|
host.registerTool({
|
|
13386
13384
|
...tool,
|
|
@@ -13458,6 +13456,7 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
13458
13456
|
await projectClosure(closed2, context);
|
|
13459
13457
|
return result;
|
|
13460
13458
|
}
|
|
13459
|
+
if (result.terminate === false) return result;
|
|
13461
13460
|
const closed = {
|
|
13462
13461
|
role,
|
|
13463
13462
|
kind: "accepted",
|
|
@@ -14313,7 +14312,7 @@ function markerMatchesExpectedIdentity(marker, expected) {
|
|
|
14313
14312
|
}
|
|
14314
14313
|
function classifyPackagedRoleTerminalResult(message) {
|
|
14315
14314
|
if (typeof message.toolName !== "string") return { kind: "nonterminal" };
|
|
14316
|
-
if (!PACKAGED_ROLE_OUTPUT_TOOLS.has(message.toolName)) return { kind: "nonterminal" };
|
|
14315
|
+
if (!PACKAGED_ROLE_OUTPUT_TOOLS.has(message.toolName) && message.toolName !== "ak_submission_output") return { kind: "nonterminal" };
|
|
14317
14316
|
const hasInfraBase = hasNavigatorInfrastructureFailureBase(message.details);
|
|
14318
14317
|
const infraFact = hasInfraBase ? buildNavigatorInfrastructureFailureFact() : void 0;
|
|
14319
14318
|
if (message.isError === true) {
|
|
@@ -14330,12 +14329,14 @@ function durableTerminalAt(entries, index) {
|
|
|
14330
14329
|
const entry = entries[index];
|
|
14331
14330
|
const message = entry?.type === "custom" && entry.customType === "ak-role-submission-closure" ? typeof entry.data === "object" && entry.data !== null ? entry.data : void 0 : entry?.type === "message" && entry.message?.role === "toolResult" ? entry.message : void 0;
|
|
14332
14331
|
if (typeof message?.toolName !== "string") return void 0;
|
|
14333
|
-
const
|
|
14332
|
+
const marker = message.toolName === "ak_submission_output" ? entries.slice(0, index).reverse().find(isInvocationMarkerEntry) : void 0;
|
|
14333
|
+
const role = message.toolName === "ak_submission_output" ? parseInvocationMarkerIdentity(marker?.data)?.role ?? "unknown" : PACKAGED_ROLE_OUTPUT_TOOLS.get(message.toolName);
|
|
14334
14334
|
if (role === void 0) return void 0;
|
|
14335
14335
|
const classification = classifyPackagedRoleTerminalResult(message);
|
|
14336
14336
|
if (classification.kind !== "accepted" && classification.kind !== "infrastructure") {
|
|
14337
14337
|
return void 0;
|
|
14338
14338
|
}
|
|
14339
|
+
if (entry?.type === "message" && classification.kind === "accepted" && !LEGACY_REVIEW_OUTPUT_ROLES.has(message.toolName)) return void 0;
|
|
14339
14340
|
return {
|
|
14340
14341
|
index,
|
|
14341
14342
|
role,
|
|
@@ -14404,7 +14405,7 @@ var init_navigator_invocation_identity = __esm({
|
|
|
14404
14405
|
"reason"
|
|
14405
14406
|
];
|
|
14406
14407
|
PACKAGED_ROLE_OUTPUT_TOOLS = new Map(
|
|
14407
|
-
PACKAGED_ROLE_REGISTRY.map((entry) => [entry.outputTool, entry.role])
|
|
14408
|
+
[...PACKAGED_ROLE_REGISTRY.filter((entry) => entry.outputTool !== "ak_submission_output").map((entry) => [entry.outputTool, entry.role]), ...LEGACY_REVIEW_OUTPUT_ROLES]
|
|
14408
14409
|
);
|
|
14409
14410
|
}
|
|
14410
14411
|
});
|
|
@@ -16015,15 +16016,14 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
16015
16016
|
let thisAttemptHasSeatSuccess = false;
|
|
16016
16017
|
let residual;
|
|
16017
16018
|
for (let index = entries.length - 1; index >= scanStart; index -= 1) {
|
|
16019
|
+
const entry = entries[index];
|
|
16020
|
+
if (entry?.type === "custom" && entry.customType === "ak-role-submission-closure" && isRecord13(entry.data) && entry.data.toolName === spec.toolName && classifyPackagedRoleTerminalResult(entry.data).kind === "accepted") {
|
|
16021
|
+
thisAttemptHasSeatSuccess = true;
|
|
16022
|
+
}
|
|
16018
16023
|
const message = entries[index]?.message;
|
|
16019
16024
|
if (message?.role !== "toolResult") continue;
|
|
16020
16025
|
if (message.toolName !== spec.toolName) continue;
|
|
16021
|
-
if (message.isError === false)
|
|
16022
|
-
if (boundRoleToolCallForResult(entries, index, message, spec.toolName) !== void 0) {
|
|
16023
|
-
thisAttemptHasSeatSuccess = true;
|
|
16024
|
-
}
|
|
16025
|
-
continue;
|
|
16026
|
-
}
|
|
16026
|
+
if (message.isError === false) continue;
|
|
16027
16027
|
if (residual === void 0) {
|
|
16028
16028
|
residual = boundErroredToolCandidate(
|
|
16029
16029
|
entries,
|
|
@@ -16034,7 +16034,7 @@ async function settleLawfulSeatAcceptedTerminalResult(admitted, authority, spec,
|
|
|
16034
16034
|
}
|
|
16035
16035
|
}
|
|
16036
16036
|
const roleOutcome = await sealedLedgerOutcome(admitted, spec.role, scope);
|
|
16037
|
-
if (roleOutcome !== void 0 && (thisAttemptHasSeatSuccess || residual === void 0)) {
|
|
16037
|
+
if (roleOutcome !== void 0 && (thisAttemptHasSeatSuccess || residual === void 0 || scope?.courtAttemptId !== void 0 && scope.courtAttemptId.length > 0)) {
|
|
16038
16038
|
const navigator = extractNavigatorFact(entries);
|
|
16039
16039
|
const artifacts = await publishDeclaredSeatArtifacts(
|
|
16040
16040
|
admitted,
|
|
@@ -18243,7 +18243,7 @@ function isRecord14(value) {
|
|
|
18243
18243
|
}
|
|
18244
18244
|
function isEscalatePayload(payload) {
|
|
18245
18245
|
if (!isRecord14(payload)) return false;
|
|
18246
|
-
return payload.status === "escalate"
|
|
18246
|
+
return payload.status === "escalate";
|
|
18247
18247
|
}
|
|
18248
18248
|
function courtDiaristPayloadRows(roleOutcome, submissions) {
|
|
18249
18249
|
if (roleOutcome === void 0) return submissions ?? [];
|
|
@@ -20475,8 +20475,8 @@ function emptyAccum() {
|
|
|
20475
20475
|
function absorbRound(accum, round) {
|
|
20476
20476
|
accum.rounds += 1;
|
|
20477
20477
|
accum.wallSum += round.officerWallMs;
|
|
20478
|
-
if (round.status === "bounce") accum.bounceCount += 1;
|
|
20479
|
-
if (round.status === "pass") accum.passCount += 1;
|
|
20478
|
+
if (round.status === "bounce" || round.status === "continue") accum.bounceCount += 1;
|
|
20479
|
+
if (round.status === "pass" || round.status === "converged") accum.passCount += 1;
|
|
20480
20480
|
}
|
|
20481
20481
|
function finishOfficer(officer, accum) {
|
|
20482
20482
|
return {
|
|
@@ -20878,7 +20878,7 @@ var init_analyst_page = __esm({
|
|
|
20878
20878
|
|
|
20879
20879
|
// src/analyst-entry.ts
|
|
20880
20880
|
import { readFile as readFile21 } from "node:fs/promises";
|
|
20881
|
-
import { Type as
|
|
20881
|
+
import { Type as Type11 } from "typebox";
|
|
20882
20882
|
function isMissingPathError7(error) {
|
|
20883
20883
|
return error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR");
|
|
20884
20884
|
}
|
|
@@ -21085,16 +21085,16 @@ var init_analyst_entry = __esm({
|
|
|
21085
21085
|
}
|
|
21086
21086
|
}
|
|
21087
21087
|
};
|
|
21088
|
-
analystSweepModeInputSchema =
|
|
21088
|
+
analystSweepModeInputSchema = Type11.Object(
|
|
21089
21089
|
{
|
|
21090
|
-
mode:
|
|
21091
|
-
mergedPullRequests:
|
|
21092
|
-
|
|
21090
|
+
mode: Type11.Literal("sweep"),
|
|
21091
|
+
mergedPullRequests: Type11.Array(
|
|
21092
|
+
Type11.Object(
|
|
21093
21093
|
{
|
|
21094
|
-
projectRoot:
|
|
21094
|
+
projectRoot: Type11.String(),
|
|
21095
21095
|
/** 排除后改动行数 — omit or 0 → typed 空缺; finite ≥ 0 only. */
|
|
21096
|
-
changedLines:
|
|
21097
|
-
|
|
21096
|
+
changedLines: Type11.Optional(
|
|
21097
|
+
Type11.Number({ minimum: 0, maximum: Number.MAX_VALUE })
|
|
21098
21098
|
)
|
|
21099
21099
|
},
|
|
21100
21100
|
{ additionalProperties: false }
|
|
@@ -22654,8 +22654,8 @@ function tryReadComplianceCandidate(arguments_, usage) {
|
|
|
22654
22654
|
}
|
|
22655
22655
|
const args = arguments_;
|
|
22656
22656
|
const status = args.status;
|
|
22657
|
-
if (status === "
|
|
22658
|
-
if (status === "
|
|
22657
|
+
if (status === "converged") return { status, receipt: arguments_, ...usage === void 0 ? {} : { usage } };
|
|
22658
|
+
if (status === "continue") return { status, violations: readListField(args.violations), receipt: arguments_, ...usage === void 0 ? {} : { usage } };
|
|
22659
22659
|
if (status === "escalate") {
|
|
22660
22660
|
return {
|
|
22661
22661
|
status,
|
|
@@ -23222,14 +23222,14 @@ init_packaged_role_registry();
|
|
|
23222
23222
|
init_activation_ledger_topology();
|
|
23223
23223
|
import { resolve as resolve16 } from "node:path";
|
|
23224
23224
|
import "@earendil-works/pi-coding-agent";
|
|
23225
|
-
import { Type as
|
|
23225
|
+
import { Type as Type13 } from "typebox";
|
|
23226
23226
|
|
|
23227
23227
|
// src/navigator-public-session.ts
|
|
23228
23228
|
init_sitian_facade();
|
|
23229
23229
|
import { basename as basename10 } from "node:path";
|
|
23230
23230
|
|
|
23231
23231
|
// src/navigator-session-contracts.ts
|
|
23232
|
-
import { Type as
|
|
23232
|
+
import { Type as Type12 } from "typebox";
|
|
23233
23233
|
import { Value as Value3 } from "typebox/value";
|
|
23234
23234
|
var NAVIGATOR_PREPARE_TOOL_NAME = "ak_navigator_prepare";
|
|
23235
23235
|
var NAVIGATOR_UNAVAILABLE_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -23337,26 +23337,26 @@ function navigatorProviderFailureFromPublicTerminal(outcome) {
|
|
|
23337
23337
|
if (typed !== void 0) return { source: typed, cause: typed };
|
|
23338
23338
|
return { source: "unknown", cause: "unknown" };
|
|
23339
23339
|
}
|
|
23340
|
-
var navigatorProviderFailureSchema =
|
|
23341
|
-
source:
|
|
23342
|
-
|
|
23343
|
-
|
|
23344
|
-
|
|
23345
|
-
|
|
23346
|
-
|
|
23347
|
-
|
|
23348
|
-
|
|
23349
|
-
|
|
23340
|
+
var navigatorProviderFailureSchema = Type12.Object({
|
|
23341
|
+
source: Type12.Union([
|
|
23342
|
+
Type12.Literal("context"),
|
|
23343
|
+
Type12.Literal("session"),
|
|
23344
|
+
Type12.Literal("model"),
|
|
23345
|
+
Type12.Literal("thinking"),
|
|
23346
|
+
Type12.Literal("auth"),
|
|
23347
|
+
Type12.Literal("quota"),
|
|
23348
|
+
Type12.Literal("transport"),
|
|
23349
|
+
Type12.Literal("unknown")
|
|
23350
23350
|
]),
|
|
23351
|
-
cause:
|
|
23352
|
-
|
|
23353
|
-
|
|
23354
|
-
|
|
23355
|
-
|
|
23356
|
-
|
|
23357
|
-
|
|
23358
|
-
|
|
23359
|
-
|
|
23351
|
+
cause: Type12.Union([
|
|
23352
|
+
Type12.Literal("context"),
|
|
23353
|
+
Type12.Literal("session"),
|
|
23354
|
+
Type12.Literal("model"),
|
|
23355
|
+
Type12.Literal("thinking"),
|
|
23356
|
+
Type12.Literal("auth"),
|
|
23357
|
+
Type12.Literal("quota"),
|
|
23358
|
+
Type12.Literal("transport"),
|
|
23359
|
+
Type12.Literal("unknown")
|
|
23360
23360
|
])
|
|
23361
23361
|
}, { additionalProperties: false });
|
|
23362
23362
|
function parseNavigatorModelSetting(value) {
|
|
@@ -23623,8 +23623,8 @@ function resolveNavigatorAuthorityMaterial(roleInput, fileAuthority) {
|
|
|
23623
23623
|
return void 0;
|
|
23624
23624
|
}
|
|
23625
23625
|
var NAVIGATOR_TARGETS = PACKAGED_ROLE_REGISTRY.map(({ role, phases }) => ({ role, phases }));
|
|
23626
|
-
var prepareSchema =
|
|
23627
|
-
prose:
|
|
23626
|
+
var prepareSchema = Type13.Object({
|
|
23627
|
+
prose: Type13.Optional(Type13.Unknown({
|
|
23628
23628
|
description: "\u6E38\u5955\u4F7F\u6563\u6587\u5EFA\u8BAE\uFF0C\u539F\u6837\u5448\u73B0\u3002\u4E0D\u8981\u6C42 candidates/next \u7ED3\u6784\u3002\u975E\u53D7\u7406\u95F8"
|
|
23629
23629
|
}))
|
|
23630
23630
|
}, { additionalProperties: true });
|
|
@@ -24333,18 +24333,18 @@ import { join as join43 } from "node:path";
|
|
|
24333
24333
|
import { Value as Value5 } from "typebox/value";
|
|
24334
24334
|
|
|
24335
24335
|
// src/activation-trace.ts
|
|
24336
|
-
import { Type as
|
|
24337
|
-
var causeSchema =
|
|
24338
|
-
identity:
|
|
24339
|
-
name:
|
|
24340
|
-
message:
|
|
24341
|
-
evidenceId:
|
|
24336
|
+
import { Type as Type14 } from "typebox";
|
|
24337
|
+
var causeSchema = Type14.Object({
|
|
24338
|
+
identity: Type14.String({ minLength: 1 }),
|
|
24339
|
+
name: Type14.String({ minLength: 1 }),
|
|
24340
|
+
message: Type14.String(),
|
|
24341
|
+
evidenceId: Type14.Optional(Type14.String({ minLength: 1 }))
|
|
24342
24342
|
}, { additionalProperties: false });
|
|
24343
|
-
var activationTraceRecordSchema =
|
|
24344
|
-
role:
|
|
24345
|
-
stageId:
|
|
24346
|
-
status:
|
|
24347
|
-
timestamp:
|
|
24343
|
+
var activationTraceRecordSchema = Type14.Object({
|
|
24344
|
+
role: Type14.String({ minLength: 1 }),
|
|
24345
|
+
stageId: Type14.String({ pattern: "^[a-z][a-z0-9-]*$" }),
|
|
24346
|
+
status: Type14.Literal("failed"),
|
|
24347
|
+
timestamp: Type14.String({ format: "date-time" }),
|
|
24348
24348
|
cause: causeSchema
|
|
24349
24349
|
}, { additionalProperties: false });
|
|
24350
24350
|
var activationCauseEvidence = 0;
|
|
@@ -24499,28 +24499,28 @@ function writeStderrJsonlRecord(record4, write = writeSync) {
|
|
|
24499
24499
|
|
|
24500
24500
|
// src/tool-execution-observation.ts
|
|
24501
24501
|
import { writeSync as writeSync2 } from "node:fs";
|
|
24502
|
-
import { Type as
|
|
24502
|
+
import { Type as Type15 } from "typebox";
|
|
24503
24503
|
import { Value as Value4 } from "typebox/value";
|
|
24504
24504
|
var TOOL_EXECUTION_UPDATE_THROTTLE_MS = 3e4;
|
|
24505
24505
|
var observationBase = {
|
|
24506
|
-
role:
|
|
24507
|
-
toolCallId:
|
|
24508
|
-
toolName:
|
|
24509
|
-
timestamp:
|
|
24506
|
+
role: Type15.String({ minLength: 1 }),
|
|
24507
|
+
toolCallId: Type15.String({ minLength: 1 }),
|
|
24508
|
+
toolName: Type15.String({ minLength: 1 }),
|
|
24509
|
+
timestamp: Type15.String({ format: "date-time" })
|
|
24510
24510
|
};
|
|
24511
|
-
var toolExecutionObservationRecordSchema =
|
|
24512
|
-
|
|
24511
|
+
var toolExecutionObservationRecordSchema = Type15.Union([
|
|
24512
|
+
Type15.Object({
|
|
24513
24513
|
...observationBase,
|
|
24514
|
-
event:
|
|
24514
|
+
event: Type15.Literal("tool_execution_start")
|
|
24515
24515
|
}, { additionalProperties: true }),
|
|
24516
|
-
|
|
24516
|
+
Type15.Object({
|
|
24517
24517
|
...observationBase,
|
|
24518
|
-
event:
|
|
24518
|
+
event: Type15.Literal("tool_execution_update")
|
|
24519
24519
|
}, { additionalProperties: true }),
|
|
24520
|
-
|
|
24520
|
+
Type15.Object({
|
|
24521
24521
|
...observationBase,
|
|
24522
|
-
event:
|
|
24523
|
-
isError:
|
|
24522
|
+
event: Type15.Literal("tool_execution_end"),
|
|
24523
|
+
isError: Type15.Boolean()
|
|
24524
24524
|
}, { additionalProperties: true })
|
|
24525
24525
|
]);
|
|
24526
24526
|
function validateToolExecutionObservationRecord(record4) {
|
|
@@ -24617,10 +24617,10 @@ init_engine_material();
|
|
|
24617
24617
|
init_engine_detour();
|
|
24618
24618
|
init_engine_detour_usage();
|
|
24619
24619
|
init_run_terminal_artifacts();
|
|
24620
|
-
import { Type as
|
|
24621
|
-
var engineDetourArgsSchema =
|
|
24620
|
+
import { Type as Type16 } from "typebox";
|
|
24621
|
+
var engineDetourArgsSchema = Type16.Object(
|
|
24622
24622
|
{
|
|
24623
|
-
argv:
|
|
24623
|
+
argv: Type16.Array(Type16.String({ minLength: 1 }), {
|
|
24624
24624
|
minItems: 1,
|
|
24625
24625
|
description: "\u9996\u9879\u4E3A PATH \u4E2D\u7684\u53EF\u6267\u884C\u6587\u4EF6\uFF0C\u5176\u4F59\u9879\u4E3A\u53C2\u6570\u3002"
|
|
24626
24626
|
})
|
|
@@ -24767,63 +24767,63 @@ import { join as join42, sep as sep6 } from "node:path";
|
|
|
24767
24767
|
// src/collector-tool-schemas.ts
|
|
24768
24768
|
init_open_tool_schema();
|
|
24769
24769
|
init_terminating_infrastructure();
|
|
24770
|
-
import { Type as
|
|
24771
|
-
var collectorObserveArgsSchema =
|
|
24772
|
-
var collectorRequestArgsSchema =
|
|
24773
|
-
requestId:
|
|
24770
|
+
import { Type as Type17 } from "typebox";
|
|
24771
|
+
var collectorObserveArgsSchema = Type17.Object({}, { additionalProperties: true });
|
|
24772
|
+
var collectorRequestArgsSchema = Type17.Object({
|
|
24773
|
+
requestId: Type17.String({
|
|
24774
24774
|
minLength: 1,
|
|
24775
24775
|
description: "\u8BF7\u6C42\u8EAB\u4EFD\uFF08\u914D\u7F6E id \u6216\u89D2\u8272\u5224\u5B9A\u7684\u7A33\u5B9A id\uFF1B\u9996\u5C3E\u65E0\u7A7A\u767D\uFF09"
|
|
24776
24776
|
}),
|
|
24777
|
-
snapshotId:
|
|
24777
|
+
snapshotId: Type17.String({ minLength: 1, description: "\u6700\u65B0\u7559\u5B58\u89C2\u5BDF\u5FEB\u7167" }),
|
|
24778
24778
|
// #836 r16 class 3: body.minLength deleted — manifest-configured requestId
|
|
24779
24779
|
// ignores body, and the unknown-requestId non-empty condition is a real
|
|
24780
24780
|
// branch in src/collector-ledger.ts:922-951, not a provider shape gate.
|
|
24781
|
-
body:
|
|
24781
|
+
body: Type17.Optional(Type17.String({
|
|
24782
24782
|
description: "\u89D2\u8272\u5224\u5B9A\u7684\u8BF7\u6C42\u6B63\u6587\uFF1Brequest-manifest \u672A\u6536\u5F55\u8BE5 requestId \u65F6\u5FC5\u586B"
|
|
24783
24783
|
}))
|
|
24784
24784
|
}, { additionalProperties: true });
|
|
24785
24785
|
var COLLECTOR_HANDBOOK_MAX_BYTES = 64 * 1024;
|
|
24786
|
-
var collectorHandbookWriteArgsSchema =
|
|
24787
|
-
scope:
|
|
24788
|
-
|
|
24789
|
-
|
|
24786
|
+
var collectorHandbookWriteArgsSchema = Type17.Object({
|
|
24787
|
+
scope: Type17.Union([
|
|
24788
|
+
Type17.Literal("general"),
|
|
24789
|
+
Type17.Literal("repo")
|
|
24790
24790
|
], { description: "general\uFF1D\u901A\u7528\u624B\u518C\uFF1Brepo\uFF1D\u5F53\u524D\u4ED3\u5E93\u5DEE\u5F02" }),
|
|
24791
|
-
body:
|
|
24791
|
+
body: Type17.String({
|
|
24792
24792
|
description: `\u624B\u518C\u5168\u6587\uFF08opaque \u5DE5\u4F5C\u8BB0\u5FC6\uFF1B\u6574\u4EFD\u66FF\u6362\uFF1BUTF-8 \u81F3\u591A ${COLLECTOR_HANDBOOK_MAX_BYTES} \u5B57\u8282\uFF09`
|
|
24793
24793
|
})
|
|
24794
24794
|
}, { additionalProperties: true });
|
|
24795
|
-
var collectorReadArgsSchema =
|
|
24796
|
-
evidenceId:
|
|
24795
|
+
var collectorReadArgsSchema = Type17.Object({
|
|
24796
|
+
evidenceId: Type17.String({ minLength: 1, description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u8BC1\u636E id\uFF08evidenceId\uFF09" })
|
|
24797
24797
|
}, { additionalProperties: true });
|
|
24798
|
-
var collectorWaitArgsSchema =
|
|
24799
|
-
durationMs:
|
|
24798
|
+
var collectorWaitArgsSchema = Type17.Object({
|
|
24799
|
+
durationMs: Type17.Integer({
|
|
24800
24800
|
minimum: 1,
|
|
24801
24801
|
description: "\u7B49\u5F85\u6BEB\u79D2\uFF1B\u5B9E\u9645\u7761\u7720\u4E0D\u8D85\u8FC7\u5269\u4F59\u7B49\u5F85\u7A97\uFF08#678\uFF1B\u65E0\u5305\u5185\u5355\u6B21\u4EFB\u610F\u4E0A\u9650\uFF09"
|
|
24802
24802
|
})
|
|
24803
24803
|
}, { additionalProperties: true });
|
|
24804
|
-
var collectorOpenWaitWindowArgsSchema =
|
|
24805
|
-
startedAt:
|
|
24804
|
+
var collectorOpenWaitWindowArgsSchema = Type17.Object({
|
|
24805
|
+
startedAt: Type17.Optional(Type17.String({
|
|
24806
24806
|
description: "\u7B49\u5F85\u7A97\u8D77\u70B9 ISO \u65F6\u95F4\uFF1B\u65B0\u5EFA PR \u7528\u521B\u5EFA\u6210\u529F\u65F6\u523B\uFF1B\u7701\u7565\uFF1D\u73B0\u5728\uFF08\u89E6\u53D1\u9636\u6BB5\u7ED3\u675F\uFF09"
|
|
24807
24807
|
}))
|
|
24808
24808
|
}, { additionalProperties: true });
|
|
24809
|
-
var collectorBindTargetArgsSchema =
|
|
24810
|
-
prNumber:
|
|
24809
|
+
var collectorBindTargetArgsSchema = Type17.Object({
|
|
24810
|
+
prNumber: Type17.Optional(Type17.Unknown({
|
|
24811
24811
|
description: "\u89D2\u8272\u5224\u5B9A\u7684\u672C\u4ED3 PR \u53F7\uFF08\u6B63\u6574\u6570\uFF09\u3002\u4E0E issueNumber \u4E8C\u9009\u4E00\u6216\u540C\u6307\u552F\u4E00\u76EE\u6807\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
24812
24812
|
})),
|
|
24813
|
-
issueNumber:
|
|
24813
|
+
issueNumber: Type17.Optional(Type17.Unknown({
|
|
24814
24814
|
description: "\u89D2\u8272\u5224\u5B9A\u7684\u672C\u4ED3 issue \u53F7\uFF08\u6B63\u6574\u6570\uFF09\uFF1Bruntime \u7ECF\u7EBF\u4E0A\u5173\u8054\u89E3\u6790\u552F\u4E00 PR\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
24815
24815
|
}))
|
|
24816
24816
|
}, { additionalProperties: true });
|
|
24817
24817
|
var collectorFindingItemDeclaration = (() => {
|
|
24818
|
-
const item =
|
|
24818
|
+
const item = Type17.Object(
|
|
24819
24819
|
{
|
|
24820
|
-
evidenceId:
|
|
24820
|
+
evidenceId: Type17.Unknown({
|
|
24821
24821
|
description: "observe \u8FD4\u56DE\u7684\u6750\u6599\u6307\u9488\uFF08\u5FC5\u586B\u8BED\u4E49\uFF09"
|
|
24822
24822
|
}),
|
|
24823
|
-
category:
|
|
24823
|
+
category: Type17.Unknown({
|
|
24824
24824
|
description: "\u7B80\u77ED\u5F52\u7C7B\u6807\u7B7E\uFF0C\u4E0D\u662F\u6458\u8981"
|
|
24825
24825
|
}),
|
|
24826
|
-
summary:
|
|
24826
|
+
summary: Type17.Unknown({
|
|
24827
24827
|
description: "\u54EA\u4E2A bot\u3001\u4EC0\u4E48\u95EE\u9898\u7684\u6458\u8981\uFF1B\u4E0D\u8A8A\u6284\u6B63\u6587"
|
|
24828
24828
|
})
|
|
24829
24829
|
},
|
|
@@ -24836,14 +24836,14 @@ var collectorFindingItemDeclaration = (() => {
|
|
|
24836
24836
|
return item;
|
|
24837
24837
|
})();
|
|
24838
24838
|
var collectorOutputBaseSchema = openToolObject(
|
|
24839
|
-
|
|
24839
|
+
Type17.Object({
|
|
24840
24840
|
// No root type:array — host must not shape-reject non-array findings (#676 C).
|
|
24841
24841
|
// Nested item declarations ride `items` for registration preservation (ADR 0057).
|
|
24842
|
-
findings:
|
|
24842
|
+
findings: Type17.Unsafe({
|
|
24843
24843
|
description: "\u672C\u6B21\u6536\u96C6\u5230\u7684\u9010\u6761 findings\uFF08\u6307\u9488\u6570\u7EC4\u4E3A\u89C4\u8303\u5F62\uFF09\u3002\u96F6 finding \u7684\u6A21\u677F\u901A\u77E5\u4E0D\u5F97\u8FDB\u5165\uFF1B\u6B63\u5E38\u5B8C\u5DE5\u65E0 finding \u65F6\u7701\u7565\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002",
|
|
24844
24844
|
items: collectorFindingItemDeclaration
|
|
24845
24845
|
}),
|
|
24846
|
-
unfinishedReasons:
|
|
24846
|
+
unfinishedReasons: Type17.Unknown({
|
|
24847
24847
|
description: "\u672A\u5B8C\u6210\u539F\u56E0\u5B57\u7B26\u4E32\u6570\u7EC4\uFF08\u989D\u5EA6/\u6545\u969C/\u7B49\u5F85\u5C4A\u6EE1\u7B49\u73B0\u573A\u4F9D\u636E\uFF09\uFF1B\u4E0D\u5F97\u628A\u672A\u5B8C\u6210\u8868\u8FF0\u4E3A\u65E0\u95EE\u9898\u3002\u65E0\u53EF\u62A5\u544A\u65F6\u7701\u7565\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
24848
24848
|
})
|
|
24849
24849
|
})
|
|
@@ -25473,7 +25473,6 @@ function createCollectorRoleRuntime(pi, dependencies, hostActions) {
|
|
|
25473
25473
|
// src/doctor-role.ts
|
|
25474
25474
|
init_audit_escalation();
|
|
25475
25475
|
init_compliance_transport();
|
|
25476
|
-
init_submission_errors();
|
|
25477
25476
|
init_dossier_resolution();
|
|
25478
25477
|
init_readable_gate_item();
|
|
25479
25478
|
init_doctor_contracts();
|
|
@@ -25535,7 +25534,7 @@ function createDoctorRoleRuntime(pi, dependencies, host) {
|
|
|
25535
25534
|
host.failInfrastructure(error, ctx, id);
|
|
25536
25535
|
}
|
|
25537
25536
|
const acceptedDetails = testimony;
|
|
25538
|
-
return disposeComplianceDecision(audit, {
|
|
25537
|
+
return disposeComplianceDecision(audit, { converged: (usage) => ({ content: audit.status === "converged" && audit.receipt !== void 0 ? [{ type: "text", text: readableGateItem(audit.receipt) }] : [], details: acceptedDetails, terminate: true, ...usage === void 0 ? {} : { usage } }), noReceipt: (auditNoReceipt, usageProjection) => {
|
|
25539
25538
|
try {
|
|
25540
25539
|
appendCandidate(ctx, { version: 1, testimony, cost: active2.patient.cost, auditNoReceipt, readRecord: active2.store.readRecord(), patientIdentity: active2.patient.identity });
|
|
25541
25540
|
} catch (error) {
|
|
@@ -25544,9 +25543,7 @@ function createDoctorRoleRuntime(pi, dependencies, host) {
|
|
|
25544
25543
|
return { content: [], details: acceptedDetails, terminate: true, ...usageProjection };
|
|
25545
25544
|
}, received: () => {
|
|
25546
25545
|
throw new Error("\u5BA1\u5211\u9662\u975E\u4E09\u6001\u5E94\u4EA4 runComplianceAudit \u91CD\u95EE\u8BF4\u8BDD\u8005");
|
|
25547
|
-
},
|
|
25548
|
-
throw new GatekeeperDecisionError({ status: "bounce", officer: "auditor", receipt: audit.status === "bounce" ? audit.receipt ?? violations : violations });
|
|
25549
|
-
}, escalate: (result) => result, transportFailure: (facts) => {
|
|
25546
|
+
}, continue: (violations) => ({ content: [{ type: "text", text: readableGateItem(audit.status === "continue" ? audit.receipt ?? violations : violations) }], details: acceptedDetails, terminate: false }), escalate: (result) => result, transportFailure: (facts) => {
|
|
25550
25547
|
host.failInfrastructure(Object.assign(new Error(facts.diagnostic), { name: "ComplianceTransportFailure", ...facts.submissions === void 0 && facts.terminal === void 0 ? {} : { submission: facts.submissions ?? facts.terminal } }), ctx, id);
|
|
25551
25548
|
} }, acceptedDetails);
|
|
25552
25549
|
} });
|
|
@@ -25644,7 +25641,7 @@ function createNotaryRoleRuntime(pi, dependencies, host) {
|
|
|
25644
25641
|
pi.registerTool({
|
|
25645
25642
|
name: NOTARY_OUTPUT_TOOL_NAME,
|
|
25646
25643
|
label: "\u7B26\u5B9D\u90CE\u8F93\u51FA",
|
|
25647
|
-
description: "\u63D0\u4EA4\u5F15\u6587\u4FDD\u771F\u4E0E\u7968\u9762\u5BF9\u9F50\u7684
|
|
25644
|
+
description: "\u63D0\u4EA4\u5F15\u6587\u4FDD\u771F\u4E0E\u7968\u9762\u5BF9\u9F50\u7684 converged/continue/escalate \u51B3\u8BAE\u3002",
|
|
25648
25645
|
promptSnippet: "\u63D0\u4EA4\u7B26\u5B9D\u90CE\u51B3\u8BAE",
|
|
25649
25646
|
parameters: notaryOutputSchema,
|
|
25650
25647
|
async execute(toolCallId, parameters, _signal, _onUpdate, ctx) {
|
|
@@ -25688,36 +25685,10 @@ function createNotaryRoleRuntime(pi, dependencies, host) {
|
|
|
25688
25685
|
init_notary_contracts();
|
|
25689
25686
|
|
|
25690
25687
|
// src/countersign-role.ts
|
|
25691
|
-
|
|
25688
|
+
init_review_submission();
|
|
25692
25689
|
init_countersign_contracts();
|
|
25693
25690
|
init_countersign_contracts();
|
|
25694
|
-
|
|
25695
|
-
var countersignVerdictSchema = withTerminatingOutputDeclarations(
|
|
25696
|
-
Type19.Object(
|
|
25697
|
-
{
|
|
25698
|
-
countersignStatus: Type19.Unknown({ description: "converged | continue | escalate\u3002\u975E\u4E09\u6001\u65F6\u8BF7\u91CD\u8BFB\u540E\u91CD\u4EA4\uFF0C\u52FF\u6539\u6807\u3002" }),
|
|
25699
|
-
fix: Type19.Optional(
|
|
25700
|
-
Type19.Object(
|
|
25701
|
-
{ summary: Type19.Optional(Type19.String({ description: "\u9000\u56DE\u6458\u8981" })) },
|
|
25702
|
-
{ additionalProperties: true, description: "\u9000\u56DE\u8BF4\u660E" }
|
|
25703
|
-
)
|
|
25704
|
-
),
|
|
25705
|
-
note: Type19.Optional(Type19.String({ description: "\u9644\u6CE8" })),
|
|
25706
|
-
evidence: Type19.Optional(Type19.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
|
|
25707
|
-
decisionGate: Type19.Optional(
|
|
25708
|
-
Type19.Object(
|
|
25709
|
-
{
|
|
25710
|
-
question: Type19.Optional(Type19.String()),
|
|
25711
|
-
options: Type19.Optional(Type19.Array(Type19.String()))
|
|
25712
|
-
},
|
|
25713
|
-
{ additionalProperties: true, description: "\u9700\u965B\u4E0B\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879" }
|
|
25714
|
-
)
|
|
25715
|
-
)
|
|
25716
|
-
},
|
|
25717
|
-
{ additionalProperties: true }
|
|
25718
|
-
)
|
|
25719
|
-
);
|
|
25720
|
-
countersignVerdictSchema.required = [];
|
|
25691
|
+
var countersignVerdictSchema = reviewSubmissionSchema;
|
|
25721
25692
|
var COUNTERSIGN_TOOL_SPEC = {
|
|
25722
25693
|
name: COUNTERSIGN_OUTPUT_TOOL_NAME,
|
|
25723
25694
|
label: "\u7ED9\u4E8B\u4E2D\u8F93\u51FA",
|
|
@@ -25731,18 +25702,18 @@ init_open_tool_schema();
|
|
|
25731
25702
|
init_terminating_infrastructure();
|
|
25732
25703
|
init_gleaner_left_contracts();
|
|
25733
25704
|
init_gleaner_left_contracts();
|
|
25734
|
-
import { Type as
|
|
25705
|
+
import { Type as Type18 } from "typebox";
|
|
25735
25706
|
var gleanerLeftOutputSchema = withTerminatingOutputDeclarations(
|
|
25736
25707
|
openToolObject(
|
|
25737
|
-
|
|
25738
|
-
status:
|
|
25708
|
+
Type18.Object({
|
|
25709
|
+
status: Type18.Unknown({
|
|
25739
25710
|
description: "completed \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
25740
25711
|
}),
|
|
25741
|
-
findings:
|
|
25742
|
-
|
|
25712
|
+
findings: Type18.Array(
|
|
25713
|
+
Type18.Object(
|
|
25743
25714
|
{
|
|
25744
|
-
pointer:
|
|
25745
|
-
statement:
|
|
25715
|
+
pointer: Type18.Optional(Type18.String({ description: "\u6587\u4EF6/\u884C\u6307\u9488" })),
|
|
25716
|
+
statement: Type18.Optional(Type18.String({ description: "\u7591\u70B9\u9648\u8FF0" }))
|
|
25746
25717
|
},
|
|
25747
25718
|
{ additionalProperties: true, description: "\u4E00\u6761\u5F39\u7AE0" }
|
|
25748
25719
|
),
|
|
@@ -25763,29 +25734,13 @@ var GLEANER_LEFT_TOOL_SPEC = {
|
|
|
25763
25734
|
init_gleaner_left_contracts();
|
|
25764
25735
|
|
|
25765
25736
|
// src/inspector-role.ts
|
|
25766
|
-
|
|
25767
|
-
init_terminating_infrastructure();
|
|
25737
|
+
init_review_submission();
|
|
25768
25738
|
init_inspector_contracts();
|
|
25769
|
-
|
|
25770
|
-
var inspectorOutputSchema = withTerminatingOutputDeclarations(
|
|
25771
|
-
openToolObject(
|
|
25772
|
-
Type21.Object({
|
|
25773
|
-
status: Type21.Unknown({
|
|
25774
|
-
description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
25775
|
-
}),
|
|
25776
|
-
findings: Type21.Unknown({
|
|
25777
|
-
description: "\u968F\u4EA4\u5377\u7559\u5B58\u7684\u95EE\u9898\u8BB0\u5F55"
|
|
25778
|
-
}),
|
|
25779
|
-
reason: Type21.Optional(Type21.Unknown({
|
|
25780
|
-
description: "status \u4E3A escalate \u65F6\u7684\u4E0A\u5448\u7406\u7531"
|
|
25781
|
-
}))
|
|
25782
|
-
})
|
|
25783
|
-
)
|
|
25784
|
-
);
|
|
25739
|
+
var inspectorOutputSchema = reviewSubmissionSchema;
|
|
25785
25740
|
var INSPECTOR_TOOL_SPEC = {
|
|
25786
25741
|
name: INSPECTOR_OUTPUT_TOOL_NAME,
|
|
25787
25742
|
label: "\u53F0\u9662\u8F93\u51FA",
|
|
25788
|
-
description: "\u53F0\u9662\u7EC8\u5C40\u56DE\u6267\uFF0C\u72B6\u6001\u4E3A
|
|
25743
|
+
description: "\u53F0\u9662\u7EC8\u5C40\u56DE\u6267\uFF0C\u72B6\u6001\u4E3A converged\u3001continue \u6216 escalate\u3002",
|
|
25789
25744
|
promptSnippet: "\u53F0\u9662\u7EC8\u5C40\u56DE\u6267",
|
|
25790
25745
|
parameters: inspectorOutputSchema
|
|
25791
25746
|
};
|
|
@@ -25798,44 +25753,44 @@ init_open_tool_schema();
|
|
|
25798
25753
|
init_terminating_infrastructure();
|
|
25799
25754
|
init_diarist_contracts();
|
|
25800
25755
|
init_diarist_contracts();
|
|
25801
|
-
import { Type as
|
|
25756
|
+
import { Type as Type19 } from "typebox";
|
|
25802
25757
|
var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
25803
25758
|
openToolObject(
|
|
25804
|
-
|
|
25805
|
-
status:
|
|
25759
|
+
Type19.Object({
|
|
25760
|
+
status: Type19.Unknown({
|
|
25806
25761
|
description: "completed | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
25807
25762
|
}),
|
|
25808
|
-
ticketNumber:
|
|
25809
|
-
|
|
25763
|
+
ticketNumber: Type19.Optional(
|
|
25764
|
+
Type19.Unknown({
|
|
25810
25765
|
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"
|
|
25811
25766
|
})
|
|
25812
25767
|
),
|
|
25813
|
-
courtTicketNumbers:
|
|
25814
|
-
|
|
25768
|
+
courtTicketNumbers: Type19.Optional(
|
|
25769
|
+
Type19.Unknown({
|
|
25815
25770
|
description: "#871 \u672C\u6B21\u5408\u5BA1\u5E94\u5404\u81EA\u6210\u5F55\u7684\u7968\u53F7\u96C6\u5408\uFF08\u6B63\u6574\u6570\u6570\u7EC4\uFF0C\u542B\u4E3B\u7968\uFF09\uFF1B\u5355\u7968\u53EF\u7701\u7565\u3002\u673A\u68B0\u5C42\u53EA\u505A\u7C7B\u578B/\u53BB\u91CD\u6295\u5F71\uFF0C\u4E0D\u4ECE\u6563\u6587\u731C\u7968\u3002"
|
|
25816
25771
|
})
|
|
25817
25772
|
),
|
|
25818
|
-
reason:
|
|
25819
|
-
|
|
25773
|
+
reason: Type19.Optional(
|
|
25774
|
+
Type19.String({
|
|
25820
25775
|
description: "status \u4E3A escalate \u65F6\uFF1A\u8BA4\u4E0D\u51FA\u672C\u5EAD\u5BF9\u8C61\u7684\u539F\u56E0"
|
|
25821
25776
|
})
|
|
25822
25777
|
),
|
|
25823
|
-
sessions:
|
|
25824
|
-
|
|
25825
|
-
|
|
25778
|
+
sessions: Type19.Optional(
|
|
25779
|
+
Type19.Array(
|
|
25780
|
+
Type19.Object(
|
|
25826
25781
|
{
|
|
25827
|
-
path:
|
|
25828
|
-
|
|
25782
|
+
path: Type19.Optional(
|
|
25783
|
+
Type19.String({ description: "\u4F1A\u8BDD\u5377\u7EDD\u5BF9\u6216\u53EF\u8BFB\u8DEF\u5F84" })
|
|
25829
25784
|
),
|
|
25830
|
-
ranges:
|
|
25831
|
-
|
|
25832
|
-
|
|
25785
|
+
ranges: Type19.Optional(
|
|
25786
|
+
Type19.Array(
|
|
25787
|
+
Type19.Object(
|
|
25833
25788
|
{
|
|
25834
|
-
from:
|
|
25835
|
-
|
|
25789
|
+
from: Type19.Optional(
|
|
25790
|
+
Type19.Object(
|
|
25836
25791
|
{
|
|
25837
|
-
id:
|
|
25838
|
-
line:
|
|
25792
|
+
id: Type19.Optional(Type19.String()),
|
|
25793
|
+
line: Type19.Optional(Type19.Unknown())
|
|
25839
25794
|
},
|
|
25840
25795
|
{
|
|
25841
25796
|
additionalProperties: true,
|
|
@@ -25843,11 +25798,11 @@ var diaristOutputSchema = withTerminatingOutputDeclarations(
|
|
|
25843
25798
|
}
|
|
25844
25799
|
)
|
|
25845
25800
|
),
|
|
25846
|
-
to:
|
|
25847
|
-
|
|
25801
|
+
to: Type19.Optional(
|
|
25802
|
+
Type19.Object(
|
|
25848
25803
|
{
|
|
25849
|
-
id:
|
|
25850
|
-
line:
|
|
25804
|
+
id: Type19.Optional(Type19.String()),
|
|
25805
|
+
line: Type19.Optional(Type19.Unknown())
|
|
25851
25806
|
},
|
|
25852
25807
|
{
|
|
25853
25808
|
additionalProperties: true,
|
|
@@ -25884,23 +25839,23 @@ var DIARIST_TOOL_SPEC = {
|
|
|
25884
25839
|
init_terminating_infrastructure();
|
|
25885
25840
|
init_secretariat_contracts();
|
|
25886
25841
|
init_secretariat_contracts();
|
|
25887
|
-
import { Type as
|
|
25842
|
+
import { Type as Type20 } from "typebox";
|
|
25888
25843
|
var secretariatVerdictSchema = withTerminatingOutputDeclarations(
|
|
25889
|
-
|
|
25844
|
+
Type20.Object(
|
|
25890
25845
|
{
|
|
25891
|
-
secretariatStatus:
|
|
25846
|
+
secretariatStatus: Type20.Unknown({
|
|
25892
25847
|
description: "converged | escalate\uFF08\u7EC8\u5C40\u5F62\u72B6\u6307\u5F15\uFF0C\u975E\u95F8\uFF09"
|
|
25893
25848
|
}),
|
|
25894
|
-
ticketNumber:
|
|
25895
|
-
|
|
25849
|
+
ticketNumber: Type20.Optional(
|
|
25850
|
+
Type20.Number({ description: "\u672C\u7968\u53F7\uFF1B\u7F72\u65F6\u6307\u5411\u6700\u7EC8\u6B63\u6587\u6240\u5728\u7968" })
|
|
25896
25851
|
),
|
|
25897
|
-
note:
|
|
25898
|
-
evidence:
|
|
25899
|
-
decisionGate:
|
|
25900
|
-
|
|
25852
|
+
note: Type20.Optional(Type20.String({ description: "\u9644\u6CE8" })),
|
|
25853
|
+
evidence: Type20.Optional(Type20.Unknown({ description: "\u7559\u5B58\u8BC1\u636E" })),
|
|
25854
|
+
decisionGate: Type20.Optional(
|
|
25855
|
+
Type20.Object(
|
|
25901
25856
|
{
|
|
25902
|
-
question:
|
|
25903
|
-
options:
|
|
25857
|
+
question: Type20.Optional(Type20.String()),
|
|
25858
|
+
options: Type20.Optional(Type20.Array(Type20.String()))
|
|
25904
25859
|
},
|
|
25905
25860
|
{ additionalProperties: true, description: "\u9700\u965B\u4E0B\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879" }
|
|
25906
25861
|
)
|
|
@@ -25959,7 +25914,7 @@ init_auditor_output();
|
|
|
25959
25914
|
var AUDITOR_TOOL_SPEC = {
|
|
25960
25915
|
name: AUDITOR_OUTPUT_TOOL_NAME,
|
|
25961
25916
|
label: "\u5BA1\u5211\u9662\u8F93\u51FA",
|
|
25962
|
-
description: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267\
|
|
25917
|
+
description: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267\uFF0Cstatus \u4E3A converged\u3001continue \u6216 escalate\u3002",
|
|
25963
25918
|
promptSnippet: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267",
|
|
25964
25919
|
parameters: auditorOutputSchema
|
|
25965
25920
|
};
|
|
@@ -25972,46 +25927,14 @@ init_packaged_role_registry();
|
|
|
25972
25927
|
init_audit_escalation();
|
|
25973
25928
|
|
|
25974
25929
|
// src/judge-role.ts
|
|
25975
|
-
|
|
25930
|
+
init_review_submission();
|
|
25976
25931
|
init_submission_errors();
|
|
25977
25932
|
init_audit_escalation();
|
|
25978
25933
|
init_readable_gate_item();
|
|
25979
25934
|
init_judge_output();
|
|
25980
|
-
import { Type as Type24 } from "typebox";
|
|
25981
25935
|
var JUDGE_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "continue", "escalate"]);
|
|
25982
|
-
var JUDGE_STATUS_REASK = "
|
|
25983
|
-
var judgeVerdictSchema =
|
|
25984
|
-
Type24.Object(
|
|
25985
|
-
{
|
|
25986
|
-
judgeStatus: Type24.Unknown({ description: "converged | continue | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }),
|
|
25987
|
-
fix: Type24.Optional(
|
|
25988
|
-
Type24.Object(
|
|
25989
|
-
{ summary: Type24.Optional(Type24.String({ description: "continue \u65F6\u7684\u8865\u6551\u6458\u8981" })) },
|
|
25990
|
-
{ additionalProperties: true, description: "continue \u65F6\u7684\u8865\u6551\u8BF4\u660E" }
|
|
25991
|
-
)
|
|
25992
|
-
),
|
|
25993
|
-
classes: Type24.Optional(Type24.Array(Type24.Object({
|
|
25994
|
-
name: Type24.Optional(Type24.String()),
|
|
25995
|
-
owner: Type24.Optional(Type24.String()),
|
|
25996
|
-
boundary: Type24.Optional(Type24.String()),
|
|
25997
|
-
disposition: Type24.Optional(Type24.String())
|
|
25998
|
-
}, { additionalProperties: true }), { description: "\u5DF2\u88C1\u51B3 finding \u7C7B\u53CA\u5176 owner \u4E0E\u4FEE\u7406\u8FB9\u754C" })),
|
|
25999
|
-
note: Type24.Optional(Type24.String({ description: "\u53EF\u9009\u88C1\u51B3\u9644\u6CE8" })),
|
|
26000
|
-
evidence: Type24.Optional(Type24.Unknown({ description: "\u7559\u5B58\u7684\u88C1\u51B3\u8BC1\u636E" })),
|
|
26001
|
-
decisionGate: Type24.Optional(
|
|
26002
|
-
Type24.Object(
|
|
26003
|
-
{
|
|
26004
|
-
question: Type24.Optional(Type24.String()),
|
|
26005
|
-
options: Type24.Optional(Type24.Array(Type24.String()))
|
|
26006
|
-
},
|
|
26007
|
-
{ additionalProperties: true, description: "\u9700\u4EBA\u6743\u5A01\u5904\u7F6E\u7684\u95EE\u9898\u4E0E\u9009\u9879" }
|
|
26008
|
-
)
|
|
26009
|
-
)
|
|
26010
|
-
},
|
|
26011
|
-
{ additionalProperties: true }
|
|
26012
|
-
)
|
|
26013
|
-
);
|
|
26014
|
-
judgeVerdictSchema.required = [];
|
|
25936
|
+
var JUDGE_STATUS_REASK = "status \u4E0D\u662F converged\u3001continue\u3001escalate \u4E09\u6001\u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
|
|
25937
|
+
var judgeVerdictSchema = reviewSubmissionSchema;
|
|
26015
25938
|
function validateVerdict(verdict) {
|
|
26016
25939
|
return validateAcceptedJudgeDetails(verdict);
|
|
26017
25940
|
}
|
|
@@ -26032,7 +25955,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26032
25955
|
parameters: judgeVerdictSchema,
|
|
26033
25956
|
async execute(toolCallId, parameters, signal, _onUpdate, ctx) {
|
|
26034
25957
|
if (soul === void 0) throw new Error("\u5927\u7406\u5BFA\u804C\u5206\u672A\u88C5\u8F7D");
|
|
26035
|
-
const rawStatus = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) && typeof parameters.
|
|
25958
|
+
const rawStatus = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) && typeof parameters.status === "string" ? parameters.status : void 0;
|
|
26036
25959
|
if (rawStatus === void 0 || !JUDGE_QUEUE_STATUSES.has(rawStatus)) {
|
|
26037
25960
|
throw new ParentQueueReaskError(JUDGE_STATUS_REASK);
|
|
26038
25961
|
}
|
|
@@ -26047,7 +25970,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26047
25970
|
const verdict = validateVerdict(parameters);
|
|
26048
25971
|
let draftPass;
|
|
26049
25972
|
try {
|
|
26050
|
-
const obtainedDraftPass = await pi.
|
|
25973
|
+
const obtainedDraftPass = await pi.requireSubmissionGate({
|
|
26051
25974
|
context: ctx,
|
|
26052
25975
|
subject: { kind: "judge_draft" },
|
|
26053
25976
|
...signal === void 0 ? {} : { signal },
|
|
@@ -26057,8 +25980,15 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26057
25980
|
submission: parameters
|
|
26058
25981
|
});
|
|
26059
25982
|
draftPass = obtainedDraftPass || void 0;
|
|
25983
|
+
if (draftPass?.status === "continue") {
|
|
25984
|
+
return {
|
|
25985
|
+
content: [{ type: "text", text: readableGateItem(draftPass.receipt) }],
|
|
25986
|
+
details: verdict,
|
|
25987
|
+
terminate: false
|
|
25988
|
+
};
|
|
25989
|
+
}
|
|
26060
25990
|
if (draftPass !== void 0) hostActions.bindPriorGatePass(toolCallId, draftPass.receipt);
|
|
26061
|
-
const compliancePass = await pi.
|
|
25991
|
+
const compliancePass = await pi.requireSubmissionGate({
|
|
26062
25992
|
context: ctx,
|
|
26063
25993
|
subject: { kind: "judge_compliance" },
|
|
26064
25994
|
...signal === void 0 ? {} : { signal },
|
|
@@ -26067,6 +25997,13 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26067
25997
|
// #879: same parent payload for 审刑院; not recovered from session latest.
|
|
26068
25998
|
submission: parameters
|
|
26069
25999
|
});
|
|
26000
|
+
if (compliancePass?.status === "continue") {
|
|
26001
|
+
return {
|
|
26002
|
+
content: [draftPass, compliancePass].filter((pass) => pass !== void 0).map((pass) => ({ type: "text", text: readableGateItem(pass.receipt) })),
|
|
26003
|
+
details: verdict,
|
|
26004
|
+
terminate: false
|
|
26005
|
+
};
|
|
26006
|
+
}
|
|
26070
26007
|
return {
|
|
26071
26008
|
content: [draftPass, compliancePass].filter((pass) => pass !== void 0).map((pass) => ({ type: "text", text: readableGateItem(pass.receipt) })),
|
|
26072
26009
|
details: verdict,
|
|
@@ -26099,12 +26036,12 @@ ${soul}
|
|
|
26099
26036
|
init_open_tool_schema();
|
|
26100
26037
|
init_terminating_infrastructure();
|
|
26101
26038
|
init_reviewer_output();
|
|
26102
|
-
import { Type as
|
|
26103
|
-
var reviewerAmendmentsSchema =
|
|
26104
|
-
completeness:
|
|
26039
|
+
import { Type as Type21 } from "typebox";
|
|
26040
|
+
var reviewerAmendmentsSchema = Type21.Object({
|
|
26041
|
+
completeness: Type21.Optional(Type21.String({
|
|
26105
26042
|
description: "completeness lens \u5B8C\u6574\u62A5\u544A\uFF1Acandidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict\uFF1B\u975E\u4EC5 verdict \u4E00\u884C\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u82E5\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u4E8E\u6B64"
|
|
26106
26043
|
})),
|
|
26107
|
-
correctness:
|
|
26044
|
+
correctness: Type21.Optional(Type21.String({
|
|
26108
26045
|
description: "correctness lens \u5B8C\u6574\u62A5\u544A\uFF1Acandidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict\uFF1B\u975E\u4EC5 verdict \u4E00\u884C\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u82E5\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u4E8E\u6B64"
|
|
26109
26046
|
}))
|
|
26110
26047
|
}, {
|
|
@@ -26112,15 +26049,15 @@ var reviewerAmendmentsSchema = Type25.Object({
|
|
|
26112
26049
|
description: "\u5DF2\u8FD0\u884C lens \u7684 amendments \u627F\u8F7D candidates\u3001\u9010\u6761\u5904\u7F6E\u4E0E verdict \u7684\u5B8C\u6574\u62A5\u544A\uFF08\u975E\u4EC5 verdict \u884C\uFF09\uFF1B\u663E\u5F0F\u5355\u8F74\u65F6\u53E6\u4E00\u8F74\u53EF\u7701\u7565\u3002hard-stop\uFF0Fusage error \u4E3A refused \u65F6\uFF0C\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u5BF9\u5E94 lens \u5B57\u6BB5\u3002\u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002"
|
|
26113
26050
|
});
|
|
26114
26051
|
var REVIEWER_STATUS_DESCRIPTION = "completed | refused \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\u3002\u4E24\u79CD\u6B63\u5E38 lens verdict\uFF08completeness / correctness\uFF09\u5747 completed\uFF1Bhard-stop \u4E0E usage error \u4E3A refused\uFF08\u5DF2\u4EA7\u51FA\u62A5\u544A\u4ECD\u7167\u5F55\u8FDB\u6240\u9009 lens amendments\uFF09\u3002";
|
|
26115
|
-
var reviewerOutputVariants =
|
|
26116
|
-
|
|
26117
|
-
status:
|
|
26118
|
-
amendments:
|
|
26052
|
+
var reviewerOutputVariants = Type21.Union([
|
|
26053
|
+
Type21.Object({
|
|
26054
|
+
status: Type21.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
|
|
26055
|
+
amendments: Type21.Optional(reviewerAmendmentsSchema)
|
|
26119
26056
|
}, { additionalProperties: false }),
|
|
26120
|
-
|
|
26121
|
-
status:
|
|
26122
|
-
diagnostic:
|
|
26123
|
-
amendments:
|
|
26057
|
+
Type21.Object({
|
|
26058
|
+
status: Type21.Unknown({ description: REVIEWER_STATUS_DESCRIPTION }),
|
|
26059
|
+
diagnostic: Type21.String({ description: "\u62D2\u7EDD\u8BCA\u65AD\u8BF4\u660E\uFF1Bhard-stop\uFF0Fusage error \u539F\u56E0\u8FDB\u6B64\u5B57\u6BB5\uFF0C\u5DF2\u4EA7\u51FA\u62A5\u544A\u53E6\u7167\u5F55 amendments" }),
|
|
26060
|
+
amendments: Type21.Optional(reviewerAmendmentsSchema)
|
|
26124
26061
|
}, { additionalProperties: false })
|
|
26125
26062
|
]);
|
|
26126
26063
|
var reviewerOutputSchema = withTerminatingOutputDeclarations(
|
|
@@ -26179,7 +26116,7 @@ init_submission_errors();
|
|
|
26179
26116
|
init_worker_output();
|
|
26180
26117
|
init_fixer_output();
|
|
26181
26118
|
init_fixer_packet();
|
|
26182
|
-
import { Type as
|
|
26119
|
+
import { Type as Type22 } from "typebox";
|
|
26183
26120
|
|
|
26184
26121
|
// src/worker-submission-gates.ts
|
|
26185
26122
|
init_archivist_record_entry();
|
|
@@ -26444,20 +26381,20 @@ function fixerBashSeatbeltDenyReason(matched) {
|
|
|
26444
26381
|
|
|
26445
26382
|
// src/worker-role.ts
|
|
26446
26383
|
var CODER_STATUS_DESCRIPTION = "planned | completed | refused | unfinished \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8\uFF1Bcompleted \u56DE\u6267\u542B TDD\u3001\u540C\u6A21\u5F0F\u3001\u5F15\u5165\u56DE\u5F52\u3001\u884C\u4E3A\u4E8B\u5B9E\u56DB\u9879\u8BC1\u636E\uFF1Bunfinished \u7F3A\u524D\u7F6E\u6216\u8FDD\u5BAA\u7EA6\u675F\u81F4\u672C\u5C40\u672A\u5B8C\u6210\u65F6\u53EF\u7528\uFF0C\u7F3A\u5F85\u51B3 owner \u51B3\u5B9A\u6216\u7B54\u590D\u5C5E\u7F3A\u524D\u7F6E\u3002";
|
|
26447
|
-
var coderOutputVariants =
|
|
26448
|
-
|
|
26449
|
-
status:
|
|
26450
|
-
report:
|
|
26384
|
+
var coderOutputVariants = Type22.Union([
|
|
26385
|
+
Type22.Object({
|
|
26386
|
+
status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
26387
|
+
report: Type22.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" })
|
|
26451
26388
|
}, { additionalProperties: false }),
|
|
26452
|
-
|
|
26453
|
-
status:
|
|
26454
|
-
report:
|
|
26389
|
+
Type22.Object({
|
|
26390
|
+
status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
26391
|
+
report: Type22.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" })
|
|
26455
26392
|
}, { additionalProperties: false }),
|
|
26456
|
-
|
|
26457
|
-
status:
|
|
26458
|
-
report:
|
|
26459
|
-
remainingScope:
|
|
26460
|
-
reason:
|
|
26393
|
+
Type22.Object({
|
|
26394
|
+
status: Type22.Unknown({ description: CODER_STATUS_DESCRIPTION }),
|
|
26395
|
+
report: Type22.String({ description: "\u5982\u5B9E\u7ED3\u679C\u62A5\u544A" }),
|
|
26396
|
+
remainingScope: Type22.String({ description: "\u672C\u5C40\u540E\u5269\u4F59\u5DE5\u4F5C" }),
|
|
26397
|
+
reason: Type22.Optional(Type22.String({
|
|
26461
26398
|
minLength: 1,
|
|
26462
26399
|
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"
|
|
26463
26400
|
}))
|
|
@@ -26587,7 +26524,7 @@ function createFixerRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26587
26524
|
);
|
|
26588
26525
|
let pass;
|
|
26589
26526
|
try {
|
|
26590
|
-
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.
|
|
26527
|
+
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.requireSubmissionGate({
|
|
26591
26528
|
context: ctx,
|
|
26592
26529
|
subject: { kind: "worker_completion" },
|
|
26593
26530
|
..._signal === void 0 ? {} : { signal: _signal },
|
|
@@ -26602,6 +26539,13 @@ function createFixerRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26602
26539
|
}
|
|
26603
26540
|
throw error;
|
|
26604
26541
|
}
|
|
26542
|
+
if (pass?.status === "continue") {
|
|
26543
|
+
return {
|
|
26544
|
+
content: [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
26545
|
+
details: output,
|
|
26546
|
+
terminate: false
|
|
26547
|
+
};
|
|
26548
|
+
}
|
|
26605
26549
|
const acceptedDetails = output;
|
|
26606
26550
|
return {
|
|
26607
26551
|
content: pass === void 0 ? [] : [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
@@ -26731,7 +26675,7 @@ function createCoderRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26731
26675
|
);
|
|
26732
26676
|
let pass;
|
|
26733
26677
|
try {
|
|
26734
|
-
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.
|
|
26678
|
+
pass = WORKER_DONE_STATUSES.has(workerStatusOf(output)) ? await pi.requireSubmissionGate({
|
|
26735
26679
|
context: ctx2,
|
|
26736
26680
|
subject: { kind: "worker_completion" },
|
|
26737
26681
|
..._signal === void 0 ? {} : { signal: _signal },
|
|
@@ -26746,6 +26690,13 @@ function createCoderRoleRuntime(pi, dependencies, hostActions) {
|
|
|
26746
26690
|
}
|
|
26747
26691
|
throw error;
|
|
26748
26692
|
}
|
|
26693
|
+
if (pass?.status === "continue") {
|
|
26694
|
+
return {
|
|
26695
|
+
content: [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
26696
|
+
details: output,
|
|
26697
|
+
terminate: false
|
|
26698
|
+
};
|
|
26699
|
+
}
|
|
26749
26700
|
const acceptedDetails = output;
|
|
26750
26701
|
return {
|
|
26751
26702
|
content: pass === void 0 ? [] : [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
@@ -27129,6 +27080,13 @@ function createFiledOfficerRuntime(roleHost, spec, dependencies) {
|
|
|
27129
27080
|
if (isAuditEscalationProjection(projected)) {
|
|
27130
27081
|
return { content: [], details: projected, terminate: true };
|
|
27131
27082
|
}
|
|
27083
|
+
if (projected !== null && typeof projected === "object" && "status" in projected && projected.status === "continue" && "receipt" in projected) {
|
|
27084
|
+
return {
|
|
27085
|
+
content: [{ type: "text", text: readableGateItem(projected.receipt) }],
|
|
27086
|
+
details: projected,
|
|
27087
|
+
terminate: false
|
|
27088
|
+
};
|
|
27089
|
+
}
|
|
27132
27090
|
const pass = spec.relayGatePass === true && projected !== null && typeof projected === "object" && "officer" in projected && "receipt" in projected ? projected : void 0;
|
|
27133
27091
|
return {
|
|
27134
27092
|
content: pass === void 0 || pass.receipt === void 0 ? [] : [{ type: "text", text: readableGateItem(pass.receipt) }],
|
|
@@ -27321,12 +27279,12 @@ ${error.message}`
|
|
|
27321
27279
|
);
|
|
27322
27280
|
}
|
|
27323
27281
|
var COUNTERSIGN_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "continue", "escalate"]);
|
|
27324
|
-
var COUNTERSIGN_STATUS_REASK = "
|
|
27282
|
+
var COUNTERSIGN_STATUS_REASK = "status \u4E0D\u662F converged\u3001continue\u3001escalate \u4E09\u6001\u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
|
|
27325
27283
|
var SECRETARIAT_QUEUE_STATUSES = /* @__PURE__ */ new Set(["converged", "escalate"]);
|
|
27326
27284
|
var SECRETARIAT_STATUS_REASK = "secretariatStatus \u4E0D\u662F converged\u3001escalate \u4E4B\u4E00\u3002\u8BF7\u91CD\u65B0\u4EA4\u5377\uFF0Cstatus \u5199\u660E\u5176\u4E00\u3002";
|
|
27327
27285
|
function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
27328
27286
|
const beforeAccept = hostActions !== void 0 ? async ({ toolCallId, parameters, signal, ctx }) => {
|
|
27329
|
-
if (roleHost.
|
|
27287
|
+
if (roleHost.requireSubmissionGate === void 0) {
|
|
27330
27288
|
const error = new Error("host cannot mount the secretariat submission gate");
|
|
27331
27289
|
error.name = "InfrastructureFailure";
|
|
27332
27290
|
return hostActions.failInfrastructure(error, ctx, toolCallId);
|
|
@@ -27340,7 +27298,7 @@ function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
|
27340
27298
|
return void 0;
|
|
27341
27299
|
}
|
|
27342
27300
|
try {
|
|
27343
|
-
const pass = await roleHost.
|
|
27301
|
+
const pass = await roleHost.requireSubmissionGate({
|
|
27344
27302
|
context: ctx,
|
|
27345
27303
|
subject: { kind: "secretariat_verdict" },
|
|
27346
27304
|
...signal === void 0 ? {} : { signal },
|
|
@@ -27349,7 +27307,7 @@ function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
|
27349
27307
|
// #879: this-turn typed payload — identity-bound at submit site.
|
|
27350
27308
|
submission: parameters
|
|
27351
27309
|
});
|
|
27352
|
-
if (pass !== void 0 && pass !== null && typeof pass === "object" && "receipt" in pass) {
|
|
27310
|
+
if (pass !== void 0 && pass !== null && typeof pass === "object" && pass.status === "converged" && "receipt" in pass) {
|
|
27353
27311
|
const {
|
|
27354
27312
|
SECRETARIAT_GATE_OFFICER_ENTRY_TYPE: SECRETARIAT_GATE_OFFICER_ENTRY_TYPE2
|
|
27355
27313
|
} = await Promise.resolve().then(() => (init_secretariat_contracts(), secretariat_contracts_exports));
|
|
@@ -27427,20 +27385,20 @@ function createSecretariatRoleRuntime(roleHost, dependencies, hostActions) {
|
|
|
27427
27385
|
function createCountersignRoleRuntime(roleHost, dependencies, hostActions) {
|
|
27428
27386
|
const beforeAccept = hostActions !== void 0 ? async ({ toolCallId, parameters, signal, ctx }) => {
|
|
27429
27387
|
const record4 = parameters !== null && typeof parameters === "object" && !Array.isArray(parameters) ? parameters : void 0;
|
|
27430
|
-
const status = record4 !== void 0 && typeof record4.
|
|
27388
|
+
const status = record4 !== void 0 && typeof record4.status === "string" ? record4.status : void 0;
|
|
27431
27389
|
if (status === void 0 || !COUNTERSIGN_QUEUE_STATUSES.has(status)) {
|
|
27432
27390
|
throw new ParentQueueReaskError(COUNTERSIGN_STATUS_REASK);
|
|
27433
27391
|
}
|
|
27434
27392
|
if (status === "escalate") {
|
|
27435
27393
|
return void 0;
|
|
27436
27394
|
}
|
|
27437
|
-
if (roleHost.
|
|
27395
|
+
if (roleHost.requireSubmissionGate === void 0) {
|
|
27438
27396
|
const error = new Error("host cannot mount the countersign gate");
|
|
27439
27397
|
error.name = "InfrastructureFailure";
|
|
27440
27398
|
return hostActions.failInfrastructure(error, ctx, toolCallId);
|
|
27441
27399
|
}
|
|
27442
27400
|
try {
|
|
27443
|
-
return await roleHost.
|
|
27401
|
+
return await roleHost.requireSubmissionGate({
|
|
27444
27402
|
context: ctx,
|
|
27445
27403
|
subject: { kind: "countersign_verdict" },
|
|
27446
27404
|
...signal === void 0 ? {} : { signal },
|
|
@@ -27491,7 +27449,15 @@ function createRoleRuntimeExtension(dependencies) {
|
|
|
27491
27449
|
};
|
|
27492
27450
|
const roleHost = createSubmissionLedgerHost(
|
|
27493
27451
|
envelopeHost.host,
|
|
27494
|
-
new Map(PACKAGED_ROLE_REGISTRY.
|
|
27452
|
+
new Map(PACKAGED_ROLE_REGISTRY.reduce((entries, { role, outputTool }) => {
|
|
27453
|
+
const existingIndex = entries.findIndex(([name]) => name === outputTool);
|
|
27454
|
+
if (existingIndex < 0) entries.push([outputTool, role]);
|
|
27455
|
+
else {
|
|
27456
|
+
const previous = entries[existingIndex][1];
|
|
27457
|
+
entries[existingIndex] = [outputTool, [...Array.isArray(previous) ? previous : [previous], role]];
|
|
27458
|
+
}
|
|
27459
|
+
return entries;
|
|
27460
|
+
}, [])),
|
|
27495
27461
|
failInfrastructure,
|
|
27496
27462
|
async (closed, context) => projectClosedSubmission(closed, context)
|
|
27497
27463
|
);
|
|
@@ -28409,7 +28375,7 @@ import { createServer } from "node:net";
|
|
|
28409
28375
|
import { dirname as dirname25, join as join46 } from "node:path";
|
|
28410
28376
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
28411
28377
|
|
|
28412
|
-
// src/
|
|
28378
|
+
// src/submission-gate.ts
|
|
28413
28379
|
init_archivist_record_entry();
|
|
28414
28380
|
init_gatekeeper_role();
|
|
28415
28381
|
init_session_assistant_usage();
|
|
@@ -28432,7 +28398,7 @@ function createDefaultGateOfficerSummon(options) {
|
|
|
28432
28398
|
};
|
|
28433
28399
|
}
|
|
28434
28400
|
function bookDirectOfficerPointer(context, officer, result, summoned) {
|
|
28435
|
-
if (result.status !== "
|
|
28401
|
+
if (result.status !== "converged" && result.status !== "continue" && result.status !== "escalate" && result.status !== "needs_reask" && result.status !== "transport_failure") {
|
|
28436
28402
|
return;
|
|
28437
28403
|
}
|
|
28438
28404
|
const parentFile = context.sessionManager?.getSessionFile?.();
|
|
@@ -28448,7 +28414,7 @@ function bookDirectOfficerPointer(context, officer, result, summoned) {
|
|
|
28448
28414
|
...typeof summoned.runDirectory === "string" && summoned.runDirectory.trim() !== "" ? { runDirectory: summoned.runDirectory } : {}
|
|
28449
28415
|
});
|
|
28450
28416
|
}
|
|
28451
|
-
async function
|
|
28417
|
+
async function requireSubmissionGate(options) {
|
|
28452
28418
|
let reask;
|
|
28453
28419
|
const summonOfficer = options.summonOfficer ?? createDefaultGateOfficerSummon({
|
|
28454
28420
|
cwd: options.context.cwd ?? process.cwd()
|
|
@@ -28475,8 +28441,17 @@ async function requireGatekeeperPass(options) {
|
|
|
28475
28441
|
options.hostActions.failInfrastructure(error, options.context, options.toolCallId);
|
|
28476
28442
|
}
|
|
28477
28443
|
}
|
|
28478
|
-
if (gatekeeper.status === "
|
|
28444
|
+
if (gatekeeper.status === "converged") {
|
|
28479
28445
|
return {
|
|
28446
|
+
status: "converged",
|
|
28447
|
+
officer: projected.officer,
|
|
28448
|
+
receipt: gatekeeper.receipt,
|
|
28449
|
+
...typeof gatekeeper.runId === "string" && gatekeeper.runId.trim() !== "" ? { runId: gatekeeper.runId } : {}
|
|
28450
|
+
};
|
|
28451
|
+
}
|
|
28452
|
+
if (gatekeeper.status === "continue") {
|
|
28453
|
+
return {
|
|
28454
|
+
status: "continue",
|
|
28480
28455
|
officer: projected.officer,
|
|
28481
28456
|
receipt: gatekeeper.receipt,
|
|
28482
28457
|
...typeof gatekeeper.runId === "string" && gatekeeper.runId.trim() !== "" ? { runId: gatekeeper.runId } : {}
|
|
@@ -28797,9 +28772,9 @@ async function prepareRoleEnvelope(options) {
|
|
|
28797
28772
|
getActiveTools() {
|
|
28798
28773
|
return [...preferredTools];
|
|
28799
28774
|
},
|
|
28800
|
-
async
|
|
28775
|
+
async requireSubmissionGate(gateOptions) {
|
|
28801
28776
|
const packageRoot = typeof options.dependencies.packageRoot === "string" ? options.dependencies.packageRoot : void 0;
|
|
28802
|
-
return
|
|
28777
|
+
return requireSubmissionGate({
|
|
28803
28778
|
context: gateOptions.context,
|
|
28804
28779
|
subject: gateOptions.subject,
|
|
28805
28780
|
...gateOptions.signal === void 0 ? {} : { signal: gateOptions.signal },
|
|
@@ -28853,7 +28828,7 @@ async function prepareRoleEnvelope(options) {
|
|
|
28853
28828
|
const record4 = details;
|
|
28854
28829
|
if (record4.cause === "infrastructure") return;
|
|
28855
28830
|
if (record4.kind === "role_infrastructure_failure") return;
|
|
28856
|
-
const code = typeof record4.code === "string" && record4.code.length > 0 ? record4.code : record4.status === "
|
|
28831
|
+
const code = typeof record4.code === "string" && record4.code.length > 0 ? record4.code : record4.status === "continue" || record4.status === "escalate" || record4.status === "no_receipt" ? record4.status : void 0;
|
|
28857
28832
|
if (code === void 0) return;
|
|
28858
28833
|
rejection = {
|
|
28859
28834
|
code,
|
|
@@ -28862,7 +28837,7 @@ async function prepareRoleEnvelope(options) {
|
|
|
28862
28837
|
};
|
|
28863
28838
|
}
|
|
28864
28839
|
function textDiagnostic(content) {
|
|
28865
|
-
const text = content.
|
|
28840
|
+
const text = content.filter((part) => part.type === "text").map((part) => part.text).join("\n\n");
|
|
28866
28841
|
return text.trim().length > 0 ? text : void 0;
|
|
28867
28842
|
}
|
|
28868
28843
|
function rememberInfrastructureFailure(details, content) {
|
|
@@ -28979,6 +28954,13 @@ async function prepareRoleEnvelope(options) {
|
|
|
28979
28954
|
details: result.details,
|
|
28980
28955
|
isError: false
|
|
28981
28956
|
});
|
|
28957
|
+
if (result.terminate === false) {
|
|
28958
|
+
rejection = {
|
|
28959
|
+
code: "continue",
|
|
28960
|
+
toolCallIds: [toolCallId],
|
|
28961
|
+
message: textDiagnostic(projected.content) ?? "continue"
|
|
28962
|
+
};
|
|
28963
|
+
}
|
|
28982
28964
|
return { content: projected.content, isError: projected.isError };
|
|
28983
28965
|
} catch (error) {
|
|
28984
28966
|
let content;
|