@akagilnc/pi-workflow-roles 0.1.3635 → 0.1.3641
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 +19 -19
- package/dist/audit-escalation.js +2 -2
- package/dist/compliance-transport.js +2 -2
- package/dist/package-contracts/auditor-output.js +7 -7
- package/dist/package-contracts/terminating-tools.js +1 -1
- package/dist/public-cli/main.js +11 -11
- package/dist/public-cli/option-definitions.js +1 -1
- package/dist/public-cli/settlement.js +3 -3
- package/dist/submission-ledger.js +5 -2
- package/package.json +1 -1
- package/souls/doctor-auditor.md +1 -1
- package/souls/fixer-auditor.md +3 -3
- package/souls/judge-auditor.md +1 -1
- package/src/audit-escalation.ts +3 -3
- package/src/auditor-role.ts +1 -1
- package/src/compliance-transport.ts +4 -4
- package/src/doctor-role.ts +1 -1
- package/src/judge-role.ts +1 -1
- package/src/package-contracts/auditor-output.ts +8 -8
- package/src/package-contracts/terminating-tools.ts +1 -1
- package/src/public-cli/option-definitions.ts +1 -1
- package/src/public-cli/settlement.ts +4 -4
- package/src/submission-ledger.ts +5 -2
|
@@ -2359,8 +2359,8 @@ async function disposeComplianceDecision(decision, handlers, deliveredOutput) {
|
|
|
2359
2359
|
decision,
|
|
2360
2360
|
decision.usage === void 0 ? {} : { usage: decision.usage }
|
|
2361
2361
|
);
|
|
2362
|
-
case "
|
|
2363
|
-
return await handlers.
|
|
2362
|
+
case "bounce":
|
|
2363
|
+
return await handlers.bounce(decision.violations);
|
|
2364
2364
|
case "escalate":
|
|
2365
2365
|
return await handlers.escalate(
|
|
2366
2366
|
projectAuditEscalation(decision, deliveredOutput)
|
|
@@ -2940,9 +2940,9 @@ function isRecord10(value) {
|
|
|
2940
2940
|
function projectLawfulAuditorOutput(value) {
|
|
2941
2941
|
if (!isRecord10(value)) return void 0;
|
|
2942
2942
|
if (value.status === "pass") return { status: "pass" };
|
|
2943
|
-
if (value.status === "
|
|
2943
|
+
if (value.status === "bounce") {
|
|
2944
2944
|
return {
|
|
2945
|
-
status: "
|
|
2945
|
+
status: "bounce",
|
|
2946
2946
|
...Object.hasOwn(value, "violations") ? { violations: value.violations } : {}
|
|
2947
2947
|
};
|
|
2948
2948
|
}
|
|
@@ -2964,7 +2964,7 @@ function validateRecordedAuditorOutput(value) {
|
|
|
2964
2964
|
}
|
|
2965
2965
|
function auditorDecisiveFacts(output) {
|
|
2966
2966
|
const facts = { status: output.status };
|
|
2967
|
-
if (output.status === "
|
|
2967
|
+
if (output.status === "bounce" && output.violations !== void 0) {
|
|
2968
2968
|
facts.violations = output.violations;
|
|
2969
2969
|
}
|
|
2970
2970
|
if (output.status === "escalate") {
|
|
@@ -2985,10 +2985,10 @@ var init_auditor_output = __esm({
|
|
|
2985
2985
|
openToolObject(
|
|
2986
2986
|
Type8.Object({
|
|
2987
2987
|
status: Type8.Unknown({
|
|
2988
|
-
description: "pass |
|
|
2988
|
+
description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
2989
2989
|
}),
|
|
2990
2990
|
violations: Type8.Optional(Type8.Unknown({
|
|
2991
|
-
description: "status \u4E3A
|
|
2991
|
+
description: "status \u4E3A bounce \u65F6\u7684\u8FDD\u89C4\u6761\u76EE"
|
|
2992
2992
|
})),
|
|
2993
2993
|
conflicts: Type8.Optional(Type8.Unknown({
|
|
2994
2994
|
description: "status \u4E3A escalate \u65F6\u7684\u51B2\u7A81"
|
|
@@ -3611,7 +3611,7 @@ function validateAcceptedDetails(toolName, details) {
|
|
|
3611
3611
|
[INSPECTOR_OUTPUT_TOOL_NAME]: ["pass", "bounce"],
|
|
3612
3612
|
[GATEKEEPER_OUTPUT_TOOL_NAME]: ["dispatch", "pass"],
|
|
3613
3613
|
[NAVIGATOR_OUTPUT_TOOL_NAME]: ["advice"],
|
|
3614
|
-
[AUDITOR_OUTPUT_TOOL_NAME]: ["pass", "
|
|
3614
|
+
[AUDITOR_OUTPUT_TOOL_NAME]: ["pass", "bounce", "escalate"],
|
|
3615
3615
|
[EVIDENCE_CHILD_OUTPUT_TOOL_NAME]: [],
|
|
3616
3616
|
[DIARIST_OUTPUT_TOOL_NAME]: ["completed"]
|
|
3617
3617
|
};
|
|
@@ -6152,7 +6152,7 @@ var init_option_definitions = __esm({
|
|
|
6152
6152
|
},
|
|
6153
6153
|
auditor: {
|
|
6154
6154
|
command: "auditor",
|
|
6155
|
-
summary: "Direct Auditor (\u5BA1\u5211\u9662) compliance audit: pass,
|
|
6155
|
+
summary: "Direct Auditor (\u5BA1\u5211\u9662) compliance audit: pass, bounce, or escalate.",
|
|
6156
6156
|
usage: ["ak-role auditor --subject <judge|doctor> --source-run <runId@role|path> [options] [instruction]"],
|
|
6157
6157
|
examples: [
|
|
6158
6158
|
'ak-role auditor --subject judge --source-run 01abc\u2026@judge --attach ./dossier "\u5BA1\uFF1A\u672C run \u662F\u5426\u5408\u89C4\u3002"',
|
|
@@ -11177,7 +11177,7 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
11177
11177
|
});
|
|
11178
11178
|
rounds.set(attemptId, candidates2);
|
|
11179
11179
|
return {
|
|
11180
|
-
content:
|
|
11180
|
+
content: result.content,
|
|
11181
11181
|
details: { submissionDisposition: "pending-round-closure" }
|
|
11182
11182
|
};
|
|
11183
11183
|
}
|
|
@@ -11193,7 +11193,7 @@ function createSubmissionLedgerHost(host, outputTools, failInfrastructure2 = (er
|
|
|
11193
11193
|
candidates.push({ toolCallId, toolName: tool.name, role, result, context });
|
|
11194
11194
|
rounds.set(attemptId, candidates);
|
|
11195
11195
|
return {
|
|
11196
|
-
content:
|
|
11196
|
+
content: result.content,
|
|
11197
11197
|
details: { submissionDisposition: "pending-round-closure" }
|
|
11198
11198
|
};
|
|
11199
11199
|
}
|
|
@@ -15611,14 +15611,14 @@ async function settleLawfulAuditorTerminalResult(admitted, authority, scope) {
|
|
|
15611
15611
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
15612
15612
|
role: "auditor",
|
|
15613
15613
|
toolName: AUDITOR_OUTPUT_TOOL_NAME,
|
|
15614
|
-
nonUsableDiagnostic: "\u5BA1\u5211\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/
|
|
15615
|
-
// Only pass/
|
|
15614
|
+
nonUsableDiagnostic: "\u5BA1\u5211\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
|
|
15615
|
+
// Only pass/bounce/escalate are lawful releases. Unreadable mystery status
|
|
15616
15616
|
// fails closed with candidate retained for parent ComplianceCandidateUnreadableError.
|
|
15617
15617
|
tryAcceptDetails: (details) => projectLawfulAuditorOutput(details) !== void 0,
|
|
15618
15618
|
projectAccepted: (sealed) => {
|
|
15619
15619
|
const lawful = projectLawfulAuditorOutput(sealed.decisiveFacts);
|
|
15620
15620
|
if (lawful === void 0) {
|
|
15621
|
-
throw new Error("auditor projectAccepted requires lawful pass/
|
|
15621
|
+
throw new Error("auditor projectAccepted requires lawful pass/bounce/escalate");
|
|
15622
15622
|
}
|
|
15623
15623
|
const accepted = {
|
|
15624
15624
|
kind: "accepted",
|
|
@@ -18154,7 +18154,7 @@ function tryReadComplianceCandidate(arguments_, usage) {
|
|
|
18154
18154
|
const args = arguments_;
|
|
18155
18155
|
const status = args.status;
|
|
18156
18156
|
if (status === "pass") return { status, ...usage === void 0 ? {} : { usage } };
|
|
18157
|
-
if (status === "
|
|
18157
|
+
if (status === "bounce") return { status, violations: readListField(args.violations), ...usage === void 0 ? {} : { usage } };
|
|
18158
18158
|
if (status === "escalate") {
|
|
18159
18159
|
return {
|
|
18160
18160
|
status,
|
|
@@ -18258,7 +18258,7 @@ var init_compliance_transport = __esm({
|
|
|
18258
18258
|
AUDITOR_DOSSIER_PROMPT = "\u672C run \u5377\u5B97\u5DF2\u5C31\u7EEA\u3002";
|
|
18259
18259
|
nonblank2 = Type15.String({ minLength: 1, pattern: "\\S" });
|
|
18260
18260
|
decisionGateSchema = Type15.Object({ question: nonblank2, options: Type15.Array(nonblank2, { minItems: 1 }) }, { additionalProperties: false });
|
|
18261
|
-
complianceDecisionSchema = Type15.Object({ status: Type15.Unknown({ description: "pass |
|
|
18261
|
+
complianceDecisionSchema = Type15.Object({ status: Type15.Unknown({ description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }), violations: Type15.Array(nonblank2, { description: "\u89C2\u5BDF\u5230\u7684\u5408\u89C4\u8FDD\u89C4" }), conflicts: Type15.Array(nonblank2, { description: "\u672A\u51B3\u6743\u5A01\u6216\u6267\u884C\u51B2\u7A81" }), decisionGate: Type15.Union([decisionGateSchema, Type15.Null()], { description: "\u5347\u7EA7\u95EE\u9898\u4E0E\u53EF\u9009\u9009\u9879" }) }, { additionalProperties: true, required: [] });
|
|
18262
18262
|
AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE = "ak_auditor_parent_attempt_binding";
|
|
18263
18263
|
AUDITOR_COMPLIANCE_FAILURE_ENTRY_TYPE = "ak_auditor_compliance_failure";
|
|
18264
18264
|
ComplianceResponseRetentionError = class extends Error {
|
|
@@ -21240,7 +21240,7 @@ function createDoctorRoleRuntime(pi, dependencies, host) {
|
|
|
21240
21240
|
}
|
|
21241
21241
|
const details = testimony.status === "completed" ? { ...testimony, cost: activation.patient.cost } : testimony;
|
|
21242
21242
|
const acceptedDetails = details;
|
|
21243
|
-
return disposeComplianceDecision(audit, { pass: (usage) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_TEXT }], details: acceptedDetails, terminate: true, ...usage === void 0 ? {} : { usage } }), noReceipt: (auditNoReceipt, usageProjection) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_AUDIT_NO_RECEIPT_TEXT }], details: { ...acceptedDetails, auditNoReceipt }, terminate: true, ...usageProjection }), unreadable: (auditUnreadable, usageProjection) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_AUDIT_UNREADABLE_TEXT }], details: { ...acceptedDetails, auditUnreadable }, terminate: true, ...usageProjection }),
|
|
21243
|
+
return disposeComplianceDecision(audit, { pass: (usage) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_TEXT }], details: acceptedDetails, terminate: true, ...usage === void 0 ? {} : { usage } }), noReceipt: (auditNoReceipt, usageProjection) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_AUDIT_NO_RECEIPT_TEXT }], details: { ...acceptedDetails, auditNoReceipt }, terminate: true, ...usageProjection }), unreadable: (auditUnreadable, usageProjection) => ({ content: [{ type: "text", text: DOCTOR_ACCEPTED_AUDIT_UNREADABLE_TEXT }], details: { ...acceptedDetails, auditUnreadable }, terminate: true, ...usageProjection }), bounce: (violations) => {
|
|
21244
21244
|
throw new Error(`\u592A\u533B\u7F72\u56DE\u6267\u8FDD soul\uFF1A${violations.join("; ")}`);
|
|
21245
21245
|
}, escalate: (result) => result }, acceptedDetails);
|
|
21246
21246
|
} });
|
|
@@ -21551,7 +21551,7 @@ init_auditor_output();
|
|
|
21551
21551
|
var AUDITOR_TOOL_SPEC = {
|
|
21552
21552
|
name: AUDITOR_OUTPUT_TOOL_NAME,
|
|
21553
21553
|
label: "\u5BA1\u5211\u9662\u8F93\u51FA",
|
|
21554
|
-
description: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267\uFF0C\u72B6\u6001\u4E3A pass\
|
|
21554
|
+
description: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267\uFF0C\u72B6\u6001\u4E3A pass\u3001bounce \u6216 escalate\u3002",
|
|
21555
21555
|
promptSnippet: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267",
|
|
21556
21556
|
parameters: auditorOutputSchema
|
|
21557
21557
|
};
|
|
@@ -21676,7 +21676,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
21676
21676
|
terminate: true,
|
|
21677
21677
|
...usageProjection
|
|
21678
21678
|
}),
|
|
21679
|
-
|
|
21679
|
+
bounce: (violations) => {
|
|
21680
21680
|
throw new Error(
|
|
21681
21681
|
`\u5927\u7406\u5BFA\u56DE\u6267\u8FDD soul\uFF1A${violations.join("; ")}`
|
|
21682
21682
|
);
|
package/dist/audit-escalation.js
CHANGED
|
@@ -127,8 +127,8 @@ export async function disposeComplianceDecision(decision, handlers, deliveredOut
|
|
|
127
127
|
throw new Error("Compliance unreadable projection handler is unavailable");
|
|
128
128
|
}
|
|
129
129
|
return await handlers.unreadable(decision, decision.usage === undefined ? {} : { usage: decision.usage });
|
|
130
|
-
case "
|
|
131
|
-
return await handlers.
|
|
130
|
+
case "bounce":
|
|
131
|
+
return await handlers.bounce(decision.violations);
|
|
132
132
|
case "escalate":
|
|
133
133
|
return await handlers.escalate(projectAuditEscalation(decision, deliveredOutput));
|
|
134
134
|
}
|
|
@@ -17,7 +17,7 @@ class ComplianceCandidateUnreadableError extends Error {
|
|
|
17
17
|
const AUDITOR_DOSSIER_PROMPT = "\u672C run \u5377\u5B97\u5DF2\u5C31\u7EEA\u3002";
|
|
18
18
|
const nonblank = Type.String({ minLength: 1, pattern: "\\S" });
|
|
19
19
|
const decisionGateSchema = Type.Object({ question: nonblank, options: Type.Array(nonblank, { minItems: 1 }) }, { additionalProperties: false });
|
|
20
|
-
const complianceDecisionSchema = Type.Object({ status: Type.Unknown({ description: "pass |
|
|
20
|
+
const complianceDecisionSchema = Type.Object({ status: Type.Unknown({ description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }), violations: Type.Array(nonblank, { description: "\u89C2\u5BDF\u5230\u7684\u5408\u89C4\u8FDD\u89C4" }), conflicts: Type.Array(nonblank, { description: "\u672A\u51B3\u6743\u5A01\u6216\u6267\u884C\u51B2\u7A81" }), decisionGate: Type.Union([decisionGateSchema, Type.Null()], { description: "\u5347\u7EA7\u95EE\u9898\u4E0E\u53EF\u9009\u9009\u9879" }) }, { additionalProperties: true, required: [] });
|
|
21
21
|
const COMPLIANCE_RESPONSE_ENTRY_TYPE = "ak_compliance_response";
|
|
22
22
|
const AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE = "ak_auditor_parent_attempt_binding";
|
|
23
23
|
const AUDITOR_COMPLIANCE_FAILURE_ENTRY_TYPE = "ak_auditor_compliance_failure";
|
|
@@ -37,7 +37,7 @@ function tryReadComplianceCandidate(arguments_, usage) {
|
|
|
37
37
|
const args = arguments_;
|
|
38
38
|
const status = args.status;
|
|
39
39
|
if (status === "pass") return { status, ...usage === void 0 ? {} : { usage } };
|
|
40
|
-
if (status === "
|
|
40
|
+
if (status === "bounce") return { status, violations: readListField(args.violations), ...usage === void 0 ? {} : { usage } };
|
|
41
41
|
if (status === "escalate") {
|
|
42
42
|
return {
|
|
43
43
|
status,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Public Auditor (审刑院) terminating receipt contracts (#675).
|
|
3
|
-
* Lawful explicit releases: pass |
|
|
2
|
+
* Public Auditor (审刑院) terminating receipt contracts (#675 / #754).
|
|
3
|
+
* Lawful explicit releases: pass | bounce | escalate.
|
|
4
4
|
*/
|
|
5
5
|
import { Type } from "typebox";
|
|
6
6
|
import { openToolObject } from "../open-tool-schema.js";
|
|
@@ -9,10 +9,10 @@ export const AUDITOR_OUTPUT_TOOL_NAME = "ak_auditor_output";
|
|
|
9
9
|
export const AUDITOR_ACCEPTED_TEXT = "审刑院回执已接受";
|
|
10
10
|
export const auditorOutputSchema = withInfrastructureFailureDeclaration(openToolObject(Type.Object({
|
|
11
11
|
status: Type.Unknown({
|
|
12
|
-
description: "pass |
|
|
12
|
+
description: "pass | bounce | escalate — 形状指引,非 schema 闸",
|
|
13
13
|
}),
|
|
14
14
|
violations: Type.Optional(Type.Unknown({
|
|
15
|
-
description: "status 为
|
|
15
|
+
description: "status 为 bounce 时的违规条目",
|
|
16
16
|
})),
|
|
17
17
|
conflicts: Type.Optional(Type.Unknown({
|
|
18
18
|
description: "status 为 escalate 时的冲突",
|
|
@@ -29,9 +29,9 @@ export function projectLawfulAuditorOutput(value) {
|
|
|
29
29
|
return undefined;
|
|
30
30
|
if (value.status === "pass")
|
|
31
31
|
return { status: "pass" };
|
|
32
|
-
if (value.status === "
|
|
32
|
+
if (value.status === "bounce") {
|
|
33
33
|
return {
|
|
34
|
-
status: "
|
|
34
|
+
status: "bounce",
|
|
35
35
|
...(Object.hasOwn(value, "violations") ? { violations: value.violations } : {}),
|
|
36
36
|
};
|
|
37
37
|
}
|
|
@@ -53,7 +53,7 @@ export function validateRecordedAuditorOutput(value) {
|
|
|
53
53
|
}
|
|
54
54
|
export function auditorDecisiveFacts(output) {
|
|
55
55
|
const facts = { status: output.status };
|
|
56
|
-
if (output.status === "
|
|
56
|
+
if (output.status === "bounce" && output.violations !== undefined) {
|
|
57
57
|
facts.violations = output.violations;
|
|
58
58
|
}
|
|
59
59
|
if (output.status === "escalate") {
|
|
@@ -126,7 +126,7 @@ export function validateAcceptedDetails(toolName, details) {
|
|
|
126
126
|
[INSPECTOR_OUTPUT_TOOL_NAME]: ["pass", "bounce"],
|
|
127
127
|
[GATEKEEPER_OUTPUT_TOOL_NAME]: ["dispatch", "pass"],
|
|
128
128
|
[NAVIGATOR_OUTPUT_TOOL_NAME]: ["advice"],
|
|
129
|
-
[AUDITOR_OUTPUT_TOOL_NAME]: ["pass", "
|
|
129
|
+
[AUDITOR_OUTPUT_TOOL_NAME]: ["pass", "bounce", "escalate"],
|
|
130
130
|
[EVIDENCE_CHILD_OUTPUT_TOOL_NAME]: [],
|
|
131
131
|
[DIARIST_OUTPUT_TOOL_NAME]: ["completed"],
|
|
132
132
|
};
|
package/dist/public-cli/main.js
CHANGED
|
@@ -15031,9 +15031,9 @@ function isRecord6(value) {
|
|
|
15031
15031
|
function projectLawfulAuditorOutput(value) {
|
|
15032
15032
|
if (!isRecord6(value)) return void 0;
|
|
15033
15033
|
if (value.status === "pass") return { status: "pass" };
|
|
15034
|
-
if (value.status === "
|
|
15034
|
+
if (value.status === "bounce") {
|
|
15035
15035
|
return {
|
|
15036
|
-
status: "
|
|
15036
|
+
status: "bounce",
|
|
15037
15037
|
...Object.hasOwn(value, "violations") ? { violations: value.violations } : {}
|
|
15038
15038
|
};
|
|
15039
15039
|
}
|
|
@@ -15055,7 +15055,7 @@ function validateRecordedAuditorOutput(value) {
|
|
|
15055
15055
|
}
|
|
15056
15056
|
function auditorDecisiveFacts(output) {
|
|
15057
15057
|
const facts = { status: output.status };
|
|
15058
|
-
if (output.status === "
|
|
15058
|
+
if (output.status === "bounce" && output.violations !== void 0) {
|
|
15059
15059
|
facts.violations = output.violations;
|
|
15060
15060
|
}
|
|
15061
15061
|
if (output.status === "escalate") {
|
|
@@ -15076,10 +15076,10 @@ var init_auditor_output = __esm({
|
|
|
15076
15076
|
openToolObject(
|
|
15077
15077
|
typebox_exports.Object({
|
|
15078
15078
|
status: typebox_exports.Unknown({
|
|
15079
|
-
description: "pass |
|
|
15079
|
+
description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8"
|
|
15080
15080
|
}),
|
|
15081
15081
|
violations: typebox_exports.Optional(typebox_exports.Unknown({
|
|
15082
|
-
description: "status \u4E3A
|
|
15082
|
+
description: "status \u4E3A bounce \u65F6\u7684\u8FDD\u89C4\u6761\u76EE"
|
|
15083
15083
|
})),
|
|
15084
15084
|
conflicts: typebox_exports.Optional(typebox_exports.Unknown({
|
|
15085
15085
|
description: "status \u4E3A escalate \u65F6\u7684\u51B2\u7A81"
|
|
@@ -16998,7 +16998,7 @@ function validateAcceptedDetails(toolName, details) {
|
|
|
16998
16998
|
[INSPECTOR_OUTPUT_TOOL_NAME]: ["pass", "bounce"],
|
|
16999
16999
|
[GATEKEEPER_OUTPUT_TOOL_NAME]: ["dispatch", "pass"],
|
|
17000
17000
|
[NAVIGATOR_OUTPUT_TOOL_NAME]: ["advice"],
|
|
17001
|
-
[AUDITOR_OUTPUT_TOOL_NAME]: ["pass", "
|
|
17001
|
+
[AUDITOR_OUTPUT_TOOL_NAME]: ["pass", "bounce", "escalate"],
|
|
17002
17002
|
[EVIDENCE_CHILD_OUTPUT_TOOL_NAME]: [],
|
|
17003
17003
|
[DIARIST_OUTPUT_TOOL_NAME]: ["completed"]
|
|
17004
17004
|
};
|
|
@@ -19716,7 +19716,7 @@ var init_option_definitions = __esm({
|
|
|
19716
19716
|
},
|
|
19717
19717
|
auditor: {
|
|
19718
19718
|
command: "auditor",
|
|
19719
|
-
summary: "Direct Auditor (\u5BA1\u5211\u9662) compliance audit: pass,
|
|
19719
|
+
summary: "Direct Auditor (\u5BA1\u5211\u9662) compliance audit: pass, bounce, or escalate.",
|
|
19720
19720
|
usage: ["ak-role auditor --subject <judge|doctor> --source-run <runId@role|path> [options] [instruction]"],
|
|
19721
19721
|
examples: [
|
|
19722
19722
|
'ak-role auditor --subject judge --source-run 01abc\u2026@judge --attach ./dossier "\u5BA1\uFF1A\u672C run \u662F\u5426\u5408\u89C4\u3002"',
|
|
@@ -23902,7 +23902,7 @@ var init_compliance_transport = __esm({
|
|
|
23902
23902
|
init_shape_unreadable_failure();
|
|
23903
23903
|
nonblank2 = typebox_exports.String({ minLength: 1, pattern: "\\S" });
|
|
23904
23904
|
decisionGateSchema = typebox_exports.Object({ question: nonblank2, options: typebox_exports.Array(nonblank2, { minItems: 1 }) }, { additionalProperties: false });
|
|
23905
|
-
complianceDecisionSchema = typebox_exports.Object({ status: typebox_exports.Unknown({ description: "pass |
|
|
23905
|
+
complianceDecisionSchema = typebox_exports.Object({ status: typebox_exports.Unknown({ description: "pass | bounce | escalate \u2014 \u5F62\u72B6\u6307\u5F15\uFF0C\u975E schema \u95F8" }), violations: typebox_exports.Array(nonblank2, { description: "\u89C2\u5BDF\u5230\u7684\u5408\u89C4\u8FDD\u89C4" }), conflicts: typebox_exports.Array(nonblank2, { description: "\u672A\u51B3\u6743\u5A01\u6216\u6267\u884C\u51B2\u7A81" }), decisionGate: typebox_exports.Union([decisionGateSchema, typebox_exports.Null()], { description: "\u5347\u7EA7\u95EE\u9898\u4E0E\u53EF\u9009\u9009\u9879" }) }, { additionalProperties: true, required: [] });
|
|
23906
23906
|
AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE = "ak_auditor_parent_attempt_binding";
|
|
23907
23907
|
AUDITOR_COMPLIANCE_FAILURE_ENTRY_TYPE = "ak_auditor_compliance_failure";
|
|
23908
23908
|
}
|
|
@@ -27432,14 +27432,14 @@ async function settleLawfulAuditorTerminalResult(admitted, authority, scope) {
|
|
|
27432
27432
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
27433
27433
|
role: "auditor",
|
|
27434
27434
|
toolName: AUDITOR_OUTPUT_TOOL_NAME,
|
|
27435
|
-
nonUsableDiagnostic: "\u5BA1\u5211\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/
|
|
27436
|
-
// Only pass/
|
|
27435
|
+
nonUsableDiagnostic: "\u5BA1\u5211\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
|
|
27436
|
+
// Only pass/bounce/escalate are lawful releases. Unreadable mystery status
|
|
27437
27437
|
// fails closed with candidate retained for parent ComplianceCandidateUnreadableError.
|
|
27438
27438
|
tryAcceptDetails: (details) => projectLawfulAuditorOutput(details) !== void 0,
|
|
27439
27439
|
projectAccepted: (sealed) => {
|
|
27440
27440
|
const lawful = projectLawfulAuditorOutput(sealed.decisiveFacts);
|
|
27441
27441
|
if (lawful === void 0) {
|
|
27442
|
-
throw new Error("auditor projectAccepted requires lawful pass/
|
|
27442
|
+
throw new Error("auditor projectAccepted requires lawful pass/bounce/escalate");
|
|
27443
27443
|
}
|
|
27444
27444
|
const accepted = {
|
|
27445
27445
|
kind: "accepted",
|
|
@@ -1025,7 +1025,7 @@ const ROLE_COMMAND_HELP = {
|
|
|
1025
1025
|
},
|
|
1026
1026
|
auditor: {
|
|
1027
1027
|
command: "auditor",
|
|
1028
|
-
summary: "Direct Auditor (审刑院) compliance audit: pass,
|
|
1028
|
+
summary: "Direct Auditor (审刑院) compliance audit: pass, bounce, or escalate.",
|
|
1029
1029
|
usage: ["ak-role auditor --subject <judge|doctor> --source-run <runId@role|path> [options] [instruction]"],
|
|
1030
1030
|
examples: [
|
|
1031
1031
|
'ak-role auditor --subject judge --source-run 01abc…@judge --attach ./dossier "审:本 run 是否合规。"',
|
|
@@ -2739,14 +2739,14 @@ async function settleLawfulAuditorTerminalResult(admitted, authority, scope) {
|
|
|
2739
2739
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
2740
2740
|
role: "auditor",
|
|
2741
2741
|
toolName: AUDITOR_OUTPUT_TOOL_NAME,
|
|
2742
|
-
nonUsableDiagnostic: "审刑院回执无显式 pass/
|
|
2743
|
-
// Only pass/
|
|
2742
|
+
nonUsableDiagnostic: "审刑院回执无显式 pass/bounce/escalate",
|
|
2743
|
+
// Only pass/bounce/escalate are lawful releases. Unreadable mystery status
|
|
2744
2744
|
// fails closed with candidate retained for parent ComplianceCandidateUnreadableError.
|
|
2745
2745
|
tryAcceptDetails: (details) => projectLawfulAuditorOutput(details) !== undefined,
|
|
2746
2746
|
projectAccepted: (sealed) => {
|
|
2747
2747
|
const lawful = projectLawfulAuditorOutput(sealed.decisiveFacts);
|
|
2748
2748
|
if (lawful === undefined) {
|
|
2749
|
-
throw new Error("auditor projectAccepted requires lawful pass/
|
|
2749
|
+
throw new Error("auditor projectAccepted requires lawful pass/bounce/escalate");
|
|
2750
2750
|
}
|
|
2751
2751
|
const accepted = {
|
|
2752
2752
|
kind: "accepted",
|
|
@@ -361,8 +361,11 @@ export function createSubmissionLedgerHost(host, outputTools, failInfrastructure
|
|
|
361
361
|
},
|
|
362
362
|
});
|
|
363
363
|
rounds.set(attemptId, candidates);
|
|
364
|
+
// The role's own acceptance text must reach the model: an empty
|
|
365
|
+
// result reads as "nothing happened" on hosts without terminate
|
|
366
|
+
// semantics (grok build kept resubmitting, #750 evidence).
|
|
364
367
|
return {
|
|
365
|
-
content:
|
|
368
|
+
content: result.content,
|
|
366
369
|
details: { submissionDisposition: "pending-round-closure" },
|
|
367
370
|
};
|
|
368
371
|
}
|
|
@@ -378,7 +381,7 @@ export function createSubmissionLedgerHost(host, outputTools, failInfrastructure
|
|
|
378
381
|
candidates.push({ toolCallId, toolName: tool.name, role, result, context });
|
|
379
382
|
rounds.set(attemptId, candidates);
|
|
380
383
|
return {
|
|
381
|
-
content:
|
|
384
|
+
content: result.content,
|
|
382
385
|
details: { submissionDisposition: "pending-round-closure" },
|
|
383
386
|
};
|
|
384
387
|
},
|
package/package.json
CHANGED
package/souls/doctor-auditor.md
CHANGED
package/souls/fixer-auditor.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
存在尚未完成的已授权工作,以及据实提交 unfinished,本身均不构成违规;
|
|
17
17
|
`prerequisite_unmet` 只在处置当下仍缺少已声明的前置产物、决定或状态,
|
|
18
18
|
且该缺失使剩余派工当前无法合法执行时成立;声明和引用本身不能证明缺失或因果。
|
|
19
|
-
若卷宗可证 authority_violation 为假或与仍可合法执行的工作矛盾,则
|
|
19
|
+
若卷宗可证 authority_violation 为假或与仍可合法执行的工作矛盾,则 bounce。
|
|
20
20
|
unfinished 不自动获得 pass;其他 Soul/authority 违反仍照常处置。
|
|
21
21
|
|
|
22
22
|
工作已完成但方法违规时,应如实交付完成结果、披露违规,只声明当前可证明的
|
|
@@ -25,9 +25,9 @@ unfinished 不自动获得 pass;其他 Soul/authority 违反仍照常处置。
|
|
|
25
25
|
复杂度:本次修改是否核过复杂度账(删码/简化优先、三问);该核未核,或核的结论有明确
|
|
26
26
|
事实反证,均为缺证。
|
|
27
27
|
|
|
28
|
-
合规则 `pass`;缺证或明确违反事实 则 `
|
|
28
|
+
合规则 `pass`;缺证或明确违反事实 则 `bounce`,逐条指出违反的条目以及你查到的原因;
|
|
29
29
|
没有具体证据不得连续打回。
|
|
30
|
-
已如实披露且不可逆的方法违规,不构成
|
|
30
|
+
已如实披露且不可逆的方法违规,不构成 bounce 理由——收卷,违规记录在案,处置权归大理寺。bounce 只用于当下可改的缺陷。
|
|
31
31
|
冲突导致无法判断合规时,提交 `escalate` 并写明问题和可选项。
|
|
32
32
|
|
|
33
33
|
输出调用 `ak_fixer_audit_decision`。
|
package/souls/judge-auditor.md
CHANGED
package/src/audit-escalation.ts
CHANGED
|
@@ -183,7 +183,7 @@ export type ComplianceDecisionHandlers<T> = {
|
|
|
183
183
|
facts: Extract<ComplianceDecision, { status: "unreadable" }>,
|
|
184
184
|
usageProjection: { usage?: Usage },
|
|
185
185
|
) => T | PromiseLike<T>;
|
|
186
|
-
|
|
186
|
+
bounce: (violations: readonly unknown[]) => T | PromiseLike<T>;
|
|
187
187
|
escalate: (result: AuditEscalationToolResult) => T | PromiseLike<T>;
|
|
188
188
|
};
|
|
189
189
|
|
|
@@ -218,8 +218,8 @@ export async function disposeComplianceDecision<T>(
|
|
|
218
218
|
decision,
|
|
219
219
|
decision.usage === undefined ? {} : { usage: decision.usage },
|
|
220
220
|
);
|
|
221
|
-
case "
|
|
222
|
-
return await handlers.
|
|
221
|
+
case "bounce":
|
|
222
|
+
return await handlers.bounce(decision.violations);
|
|
223
223
|
case "escalate":
|
|
224
224
|
return await handlers.escalate(
|
|
225
225
|
projectAuditEscalation(decision, deliveredOutput),
|
package/src/auditor-role.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type AuditorRuntimeDependencies = {
|
|
|
16
16
|
export const AUDITOR_TOOL_SPEC = {
|
|
17
17
|
name: AUDITOR_OUTPUT_TOOL_NAME,
|
|
18
18
|
label: "审刑院输出",
|
|
19
|
-
description: "审刑院终局回执,状态为 pass、
|
|
19
|
+
description: "审刑院终局回执,状态为 pass、bounce 或 escalate。",
|
|
20
20
|
promptSnippet: "审刑院终局回执",
|
|
21
21
|
parameters: auditorOutputSchema,
|
|
22
22
|
} as const;
|
|
@@ -23,7 +23,7 @@ export type ComplianceUnreadable = {
|
|
|
23
23
|
};
|
|
24
24
|
export type ComplianceDecision =
|
|
25
25
|
| { status: "pass"; usage?: Usage }
|
|
26
|
-
| { status: "
|
|
26
|
+
| { status: "bounce"; violations: readonly unknown[]; usage?: Usage }
|
|
27
27
|
| { status: "escalate"; conflicts?: unknown; decisionGate?: unknown; usage?: Usage }
|
|
28
28
|
| ComplianceNoReceipt
|
|
29
29
|
| ComplianceUnreadable;
|
|
@@ -58,7 +58,7 @@ export const AUDITOR_DOSSIER_PROMPT = "本 run 卷宗已就绪。" as const;
|
|
|
58
58
|
|
|
59
59
|
const nonblank = Type.String({ minLength: 1, pattern: "\\S" });
|
|
60
60
|
const decisionGateSchema = Type.Object({ question: nonblank, options: Type.Array(nonblank, { minItems: 1 }) }, { additionalProperties: false });
|
|
61
|
-
export const complianceDecisionSchema = Type.Object({ status: Type.Unknown({ description: "pass |
|
|
61
|
+
export const complianceDecisionSchema = Type.Object({ status: Type.Unknown({ description: "pass | bounce | escalate — 形状指引,非 schema 闸" }), violations: Type.Array(nonblank, { description: "观察到的合规违规" }), conflicts: Type.Array(nonblank, { description: "未决权威或执行冲突" }), decisionGate: Type.Union([decisionGateSchema, Type.Null()], { description: "升级问题与可选选项" }) }, { additionalProperties: true, required: [] });
|
|
62
62
|
|
|
63
63
|
export const COMPLIANCE_RESPONSE_ENTRY_TYPE = "ak_compliance_response" as const;
|
|
64
64
|
export const AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE = "ak_auditor_parent_attempt_binding" as const;
|
|
@@ -90,7 +90,7 @@ export function tryReadComplianceCandidate(arguments_: unknown, usage?: Usage):
|
|
|
90
90
|
const args = arguments_ as Record<string, unknown>;
|
|
91
91
|
const status = args.status;
|
|
92
92
|
if (status === "pass") return { status, ...(usage === undefined ? {} : { usage }) };
|
|
93
|
-
if (status === "
|
|
93
|
+
if (status === "bounce") return { status, violations: readListField(args.violations), ...(usage === undefined ? {} : { usage }) };
|
|
94
94
|
if (status === "escalate") {
|
|
95
95
|
return {
|
|
96
96
|
status,
|
|
@@ -180,7 +180,7 @@ function unreadableDecision(
|
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
182
|
* Project a public auditor terminal onto the parent compliance decision.
|
|
183
|
-
* Lawful pass/
|
|
183
|
+
* Lawful pass/bounce/escalate/no-receipt flow through.
|
|
184
184
|
* Shape-unreadable keeps original candidate + typed observation (ADR 0055 / §0) —
|
|
185
185
|
* never forged pass, never parent abort. Real provider/engine/disk failures stay loud.
|
|
186
186
|
* Accepted audits always carry real session usage when present (#675 metering).
|
package/src/doctor-role.ts
CHANGED
|
@@ -35,7 +35,7 @@ export function createDoctorRoleRuntime(pi: RoleHost, dependencies: DoctorRoleDe
|
|
|
35
35
|
let activation: { soul: string; patient: DoctorCase; store: DoctorEvidenceStore } | undefined; let registered = false; pi.registerFlag(DOCTOR_CASE_FLAG.name, DOCTOR_CASE_FLAG.definition);
|
|
36
36
|
return { async activate() { const path = pi.getFlag(DOCTOR_CASE_FLAG.name); if (typeof path !== "string" || !path.trim()) throw new Error("Doctor requires --ak-doctor-case"); const soul = (await dependencies.loadSoul()).trim(); if (!soul) throw new Error("Doctor soul is empty"); const patient = await dependencies.loadCase(path); activation = { soul, patient, store: new DoctorEvidenceStore(patient) };
|
|
37
37
|
if (!registered) { registered = true; pi.registerTool({ name: DOCTOR_EVIDENCE_TOOL_NAME, label: "太医署证据", description: "分页读取留存的 Pi session 字节。", parameters: doctorEvidenceReadSchema, async execute(_id: string, params: { evidenceId: string; offset?: number; limit?: number }) { if (!activation) throw new Error("太医署未激活"); const details = activation.store.read(params.evidenceId, params.offset, params.limit); return { content: [{ type: "text" as const, text: JSON.stringify(details) }], details }; } });
|
|
38
|
-
pi.registerTool({ name: DOCTOR_OUTPUT_TOOL_NAME, label: "太医署输出", description: DOCTOR_OUTPUT_TOOL_DESCRIPTION, parameters: doctorSubmissionSchema, async execute(id: string, params: unknown, signal: AbortSignal | undefined, _update: unknown, ctx: HostContext): Promise<HostToolResult<unknown>> { if (!activation) throw new Error("太医署未激活"); const testimony = validateDoctorOutput(params, activation.patient, activation.store); try { appendCandidate(ctx, { version: 1, testimony, readRecord: activation.store.readRecord(), patientIdentity: activation.patient.identity }); } catch (error) { host.failInfrastructure(error, ctx, id); } let audit: ComplianceDecision; try { audit = await dependencies.auditCompliance(signal === undefined ? { context: ctx } : { context: ctx, signal }); } catch (error) { host.failInfrastructure(error, ctx, id); } const details = testimony.status === "completed" ? { ...testimony, cost: activation.patient.cost } : testimony; const acceptedDetails = details; return disposeComplianceDecision<HostToolResult<unknown>>(audit, { pass: (usage) => ({ content: [{ type: "text" as const, text: DOCTOR_ACCEPTED_TEXT }], details: acceptedDetails, terminate: true as const, ...(usage === undefined ? {} : { usage }) }), noReceipt: (auditNoReceipt, usageProjection) => ({ content: [{ type: "text" as const, text: DOCTOR_ACCEPTED_AUDIT_NO_RECEIPT_TEXT }], details: { ...acceptedDetails, auditNoReceipt }, terminate: true as const, ...usageProjection }), unreadable: (auditUnreadable, usageProjection) => ({ content: [{ type: "text" as const, text: DOCTOR_ACCEPTED_AUDIT_UNREADABLE_TEXT }], details: { ...acceptedDetails, auditUnreadable }, terminate: true as const, ...usageProjection }),
|
|
38
|
+
pi.registerTool({ name: DOCTOR_OUTPUT_TOOL_NAME, label: "太医署输出", description: DOCTOR_OUTPUT_TOOL_DESCRIPTION, parameters: doctorSubmissionSchema, async execute(id: string, params: unknown, signal: AbortSignal | undefined, _update: unknown, ctx: HostContext): Promise<HostToolResult<unknown>> { if (!activation) throw new Error("太医署未激活"); const testimony = validateDoctorOutput(params, activation.patient, activation.store); try { appendCandidate(ctx, { version: 1, testimony, readRecord: activation.store.readRecord(), patientIdentity: activation.patient.identity }); } catch (error) { host.failInfrastructure(error, ctx, id); } let audit: ComplianceDecision; try { audit = await dependencies.auditCompliance(signal === undefined ? { context: ctx } : { context: ctx, signal }); } catch (error) { host.failInfrastructure(error, ctx, id); } const details = testimony.status === "completed" ? { ...testimony, cost: activation.patient.cost } : testimony; const acceptedDetails = details; return disposeComplianceDecision<HostToolResult<unknown>>(audit, { pass: (usage) => ({ content: [{ type: "text" as const, text: DOCTOR_ACCEPTED_TEXT }], details: acceptedDetails, terminate: true as const, ...(usage === undefined ? {} : { usage }) }), noReceipt: (auditNoReceipt, usageProjection) => ({ content: [{ type: "text" as const, text: DOCTOR_ACCEPTED_AUDIT_NO_RECEIPT_TEXT }], details: { ...acceptedDetails, auditNoReceipt }, terminate: true as const, ...usageProjection }), unreadable: (auditUnreadable, usageProjection) => ({ content: [{ type: "text" as const, text: DOCTOR_ACCEPTED_AUDIT_UNREADABLE_TEXT }], details: { ...acceptedDetails, auditUnreadable }, terminate: true as const, ...usageProjection }), bounce: (violations) => { throw new Error(`太医署回执违 soul:${violations.join("; ")}`); }, escalate: (result) => result }, acceptedDetails); } });
|
|
39
39
|
pi.on("before_agent_start", (event) => { if (!activation) throw new Error("太医署未激活"); const catalog = { version: activation.patient.version, identity: activation.patient.identity, admittedMetrics: { provenance: "由留存 session 字节推导,封入受理回执。", cost: activation.patient.cost }, lawfulTargetKeys: ["case", ...activation.patient.cost.invocations.sources], evidence: activation.patient.evidence.map(({ id, kind, sha256, byteLength, contentLength }) => ({ id, kind, sha256, byteLength, contentLength })) }; return { systemPrompt: `${event.systemPrompt}\n\n<doctor_soul>\n${activation.soul}\n</doctor_soul>\n\n<doctor_case>\n${JSON.stringify(catalog)}\n</doctor_case>` }; }); }
|
|
40
40
|
const required = [DOCTOR_EVIDENCE_TOOL_NAME, DOCTOR_OUTPUT_TOOL_NAME]; const names = pi.getAllTools().map((tool) => tool.name); for (const name of required) if (names.filter((item) => item === name).length !== 1) throw new Error(`Doctor required tool collision or missing: ${name}`); pi.setActiveTools(required); const active = pi.getActiveTools?.() ?? required; if (active.length !== 2 || !required.every((name) => active.includes(name))) throw new Error("Doctor active tool narrowing failed"); } };
|
|
41
41
|
}
|
package/src/judge-role.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Public Auditor (审刑院) terminating receipt contracts (#675).
|
|
3
|
-
* Lawful explicit releases: pass |
|
|
2
|
+
* Public Auditor (审刑院) terminating receipt contracts (#675 / #754).
|
|
3
|
+
* Lawful explicit releases: pass | bounce | escalate.
|
|
4
4
|
*/
|
|
5
5
|
import { Type } from "typebox";
|
|
6
6
|
|
|
@@ -14,10 +14,10 @@ export const auditorOutputSchema = withInfrastructureFailureDeclaration(
|
|
|
14
14
|
openToolObject(
|
|
15
15
|
Type.Object({
|
|
16
16
|
status: Type.Unknown({
|
|
17
|
-
description: "pass |
|
|
17
|
+
description: "pass | bounce | escalate — 形状指引,非 schema 闸",
|
|
18
18
|
}),
|
|
19
19
|
violations: Type.Optional(Type.Unknown({
|
|
20
|
-
description: "status 为
|
|
20
|
+
description: "status 为 bounce 时的违规条目",
|
|
21
21
|
})),
|
|
22
22
|
conflicts: Type.Optional(Type.Unknown({
|
|
23
23
|
description: "status 为 escalate 时的冲突",
|
|
@@ -31,7 +31,7 @@ export const auditorOutputSchema = withInfrastructureFailureDeclaration(
|
|
|
31
31
|
|
|
32
32
|
export type AuditorOutput =
|
|
33
33
|
| { readonly status: "pass" }
|
|
34
|
-
| { readonly status: "
|
|
34
|
+
| { readonly status: "bounce"; readonly violations?: unknown }
|
|
35
35
|
| {
|
|
36
36
|
readonly status: "escalate";
|
|
37
37
|
readonly conflicts?: unknown;
|
|
@@ -45,9 +45,9 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
45
45
|
export function projectLawfulAuditorOutput(value: unknown): AuditorOutput | undefined {
|
|
46
46
|
if (!isRecord(value)) return undefined;
|
|
47
47
|
if (value.status === "pass") return { status: "pass" };
|
|
48
|
-
if (value.status === "
|
|
48
|
+
if (value.status === "bounce") {
|
|
49
49
|
return {
|
|
50
|
-
status: "
|
|
50
|
+
status: "bounce",
|
|
51
51
|
...(Object.hasOwn(value, "violations") ? { violations: value.violations } : {}),
|
|
52
52
|
};
|
|
53
53
|
}
|
|
@@ -71,7 +71,7 @@ export function validateRecordedAuditorOutput(value: unknown): AuditorOutput {
|
|
|
71
71
|
|
|
72
72
|
export function auditorDecisiveFacts(output: AuditorOutput): Record<string, unknown> {
|
|
73
73
|
const facts: Record<string, unknown> = { status: output.status };
|
|
74
|
-
if (output.status === "
|
|
74
|
+
if (output.status === "bounce" && output.violations !== undefined) {
|
|
75
75
|
facts.violations = output.violations;
|
|
76
76
|
}
|
|
77
77
|
if (output.status === "escalate") {
|
|
@@ -234,7 +234,7 @@ export function validateAcceptedDetails(
|
|
|
234
234
|
[INSPECTOR_OUTPUT_TOOL_NAME]: ["pass", "bounce"],
|
|
235
235
|
[GATEKEEPER_OUTPUT_TOOL_NAME]: ["dispatch", "pass"],
|
|
236
236
|
[NAVIGATOR_OUTPUT_TOOL_NAME]: ["advice"],
|
|
237
|
-
[AUDITOR_OUTPUT_TOOL_NAME]: ["pass", "
|
|
237
|
+
[AUDITOR_OUTPUT_TOOL_NAME]: ["pass", "bounce", "escalate"],
|
|
238
238
|
[EVIDENCE_CHILD_OUTPUT_TOOL_NAME]: [],
|
|
239
239
|
[DIARIST_OUTPUT_TOOL_NAME]: ["completed"],
|
|
240
240
|
};
|
|
@@ -1255,7 +1255,7 @@ const ROLE_COMMAND_HELP = {
|
|
|
1255
1255
|
},
|
|
1256
1256
|
auditor: {
|
|
1257
1257
|
command: "auditor",
|
|
1258
|
-
summary: "Direct Auditor (审刑院) compliance audit: pass,
|
|
1258
|
+
summary: "Direct Auditor (审刑院) compliance audit: pass, bounce, or escalate.",
|
|
1259
1259
|
usage: ["ak-role auditor --subject <judge|doctor> --source-run <runId@role|path> [options] [instruction]"],
|
|
1260
1260
|
examples: [
|
|
1261
1261
|
'ak-role auditor --subject judge --source-run 01abc…@judge --attach ./dossier "审:本 run 是否合规。"',
|
|
@@ -3850,7 +3850,7 @@ export async function trySettleNavigatorTerminalResult(
|
|
|
3850
3850
|
return settleLawfulNavigatorTerminalResult(admitted, authority, scope);
|
|
3851
3851
|
}
|
|
3852
3852
|
|
|
3853
|
-
/** Lawful Auditor accepted outcome (pass/
|
|
3853
|
+
/** Lawful Auditor accepted outcome (pass/bounce/escalate, #675 / #754). */
|
|
3854
3854
|
export type LawfulAuditorRoleOutcome = {
|
|
3855
3855
|
kind: "accepted";
|
|
3856
3856
|
role: "auditor";
|
|
@@ -3866,14 +3866,14 @@ async function settleLawfulAuditorTerminalResult(
|
|
|
3866
3866
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
3867
3867
|
role: "auditor",
|
|
3868
3868
|
toolName: AUDITOR_OUTPUT_TOOL_NAME,
|
|
3869
|
-
nonUsableDiagnostic: "审刑院回执无显式 pass/
|
|
3870
|
-
// Only pass/
|
|
3869
|
+
nonUsableDiagnostic: "审刑院回执无显式 pass/bounce/escalate",
|
|
3870
|
+
// Only pass/bounce/escalate are lawful releases. Unreadable mystery status
|
|
3871
3871
|
// fails closed with candidate retained for parent ComplianceCandidateUnreadableError.
|
|
3872
3872
|
tryAcceptDetails: (details) => projectLawfulAuditorOutput(details) !== undefined,
|
|
3873
3873
|
projectAccepted: (sealed) => {
|
|
3874
3874
|
const lawful = projectLawfulAuditorOutput(sealed.decisiveFacts);
|
|
3875
3875
|
if (lawful === undefined) {
|
|
3876
|
-
throw new Error("auditor projectAccepted requires lawful pass/
|
|
3876
|
+
throw new Error("auditor projectAccepted requires lawful pass/bounce/escalate");
|
|
3877
3877
|
}
|
|
3878
3878
|
const accepted: LawfulAuditorRoleOutcome = {
|
|
3879
3879
|
kind: "accepted",
|
package/src/submission-ledger.ts
CHANGED
|
@@ -439,8 +439,11 @@ export function createSubmissionLedgerHost(
|
|
|
439
439
|
},
|
|
440
440
|
});
|
|
441
441
|
rounds.set(attemptId, candidates);
|
|
442
|
+
// The role's own acceptance text must reach the model: an empty
|
|
443
|
+
// result reads as "nothing happened" on hosts without terminate
|
|
444
|
+
// semantics (grok build kept resubmitting, #750 evidence).
|
|
442
445
|
return {
|
|
443
|
-
content:
|
|
446
|
+
content: result.content,
|
|
444
447
|
details: { submissionDisposition: "pending-round-closure" },
|
|
445
448
|
};
|
|
446
449
|
}
|
|
@@ -456,7 +459,7 @@ export function createSubmissionLedgerHost(
|
|
|
456
459
|
candidates.push({ toolCallId, toolName: tool.name, role, result, context });
|
|
457
460
|
rounds.set(attemptId, candidates);
|
|
458
461
|
return {
|
|
459
|
-
content:
|
|
462
|
+
content: result.content,
|
|
460
463
|
details: { submissionDisposition: "pending-round-closure" },
|
|
461
464
|
};
|
|
462
465
|
},
|