@akagilnc/pi-workflow-roles 0.1.3637 → 0.1.3644
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 +45 -69
- 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 +133 -163
- package/dist/public-cli/notary-run.js +5 -20
- package/dist/public-cli/option-definitions.js +1 -1
- package/dist/public-cli/post-admission.js +30 -23
- package/dist/public-cli/run-lifecycle.js +6 -14
- package/dist/public-cli/settlement.js +3 -3
- 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/notary-run.ts +6 -18
- package/src/public-cli/option-definitions.ts +1 -1
- package/src/public-cli/post-admission.ts +31 -37
- package/src/public-cli/run-lifecycle.ts +6 -17
- package/src/public-cli/settlement.ts +4 -4
|
@@ -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
|
};
|
|
@@ -4226,13 +4226,6 @@ function instructResumeHandbookRead(prompt, engineMaterial) {
|
|
|
4226
4226
|
return line2;
|
|
4227
4227
|
}).join("\n");
|
|
4228
4228
|
}
|
|
4229
|
-
function appendResumeMaterialReread(prompt, materialPath) {
|
|
4230
|
-
const instruction = resumeRereadInstruction(materialPath, false);
|
|
4231
|
-
const lines = prompt.split("\n");
|
|
4232
|
-
if (lines.includes(instruction)) return prompt;
|
|
4233
|
-
return prompt.length === 0 ? instruction : `${prompt}
|
|
4234
|
-
${instruction}`;
|
|
4235
|
-
}
|
|
4236
4229
|
function selectResumeContinuationPrompt(message, engineMaterial) {
|
|
4237
4230
|
const base = message !== void 0 ? message : RESUME_TRANSPORT_ENVELOPE;
|
|
4238
4231
|
return instructResumeHandbookRead(
|
|
@@ -6152,7 +6145,7 @@ var init_option_definitions = __esm({
|
|
|
6152
6145
|
},
|
|
6153
6146
|
auditor: {
|
|
6154
6147
|
command: "auditor",
|
|
6155
|
-
summary: "Direct Auditor (\u5BA1\u5211\u9662) compliance audit: pass,
|
|
6148
|
+
summary: "Direct Auditor (\u5BA1\u5211\u9662) compliance audit: pass, bounce, or escalate.",
|
|
6156
6149
|
usage: ["ak-role auditor --subject <judge|doctor> --source-run <runId@role|path> [options] [instruction]"],
|
|
6157
6150
|
examples: [
|
|
6158
6151
|
'ak-role auditor --subject judge --source-run 01abc\u2026@judge --attach ./dossier "\u5BA1\uFF1A\u672C run \u662F\u5426\u5408\u89C4\u3002"',
|
|
@@ -15611,14 +15604,14 @@ async function settleLawfulAuditorTerminalResult(admitted, authority, scope) {
|
|
|
15611
15604
|
return settleLawfulSeatAcceptedTerminalResult(admitted, authority, {
|
|
15612
15605
|
role: "auditor",
|
|
15613
15606
|
toolName: AUDITOR_OUTPUT_TOOL_NAME,
|
|
15614
|
-
nonUsableDiagnostic: "\u5BA1\u5211\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/
|
|
15615
|
-
// Only pass/
|
|
15607
|
+
nonUsableDiagnostic: "\u5BA1\u5211\u9662\u56DE\u6267\u65E0\u663E\u5F0F pass/bounce/escalate",
|
|
15608
|
+
// Only pass/bounce/escalate are lawful releases. Unreadable mystery status
|
|
15616
15609
|
// fails closed with candidate retained for parent ComplianceCandidateUnreadableError.
|
|
15617
15610
|
tryAcceptDetails: (details) => projectLawfulAuditorOutput(details) !== void 0,
|
|
15618
15611
|
projectAccepted: (sealed) => {
|
|
15619
15612
|
const lawful = projectLawfulAuditorOutput(sealed.decisiveFacts);
|
|
15620
15613
|
if (lawful === void 0) {
|
|
15621
|
-
throw new Error("auditor projectAccepted requires lawful pass/
|
|
15614
|
+
throw new Error("auditor projectAccepted requires lawful pass/bounce/escalate");
|
|
15622
15615
|
}
|
|
15623
15616
|
const accepted = {
|
|
15624
15617
|
kind: "accepted",
|
|
@@ -16592,24 +16585,16 @@ async function dispatchPostAdmissionTurn(input) {
|
|
|
16592
16585
|
}
|
|
16593
16586
|
}
|
|
16594
16587
|
function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepared) {
|
|
16595
|
-
const engineMaterial = engineSessionMaterialFromOptions({
|
|
16596
|
-
...env.engine === void 0 ? {} : { engine: env.engine },
|
|
16597
|
-
packageRoot: env.packageRoot
|
|
16598
|
-
});
|
|
16599
16588
|
let prompt;
|
|
16600
16589
|
if (request.message !== void 0) {
|
|
16601
|
-
if (summonsPrepared !== void 0
|
|
16602
|
-
prompt =
|
|
16603
|
-
|
|
16604
|
-
|
|
16605
|
-
|
|
16606
|
-
|
|
16607
|
-
|
|
16608
|
-
|
|
16609
|
-
engineMaterial
|
|
16610
|
-
),
|
|
16611
|
-
engineMaterial
|
|
16612
|
-
);
|
|
16590
|
+
if (summonsPrepared !== void 0) {
|
|
16591
|
+
prompt = buildInstructionTransportPrompt({
|
|
16592
|
+
instruction: request.message,
|
|
16593
|
+
instructionEmpty: false,
|
|
16594
|
+
attachments: summonsPrepared.attachments
|
|
16595
|
+
});
|
|
16596
|
+
} else if (request.summons !== void 0) {
|
|
16597
|
+
prompt = request.message;
|
|
16613
16598
|
} else {
|
|
16614
16599
|
prompt = buildResumeContinuationPrompt({
|
|
16615
16600
|
packageRoot: env.packageRoot,
|
|
@@ -16618,10 +16603,9 @@ function resumeTurnRequestProjectionOptions(admitted, request, env, summonsPrepa
|
|
|
16618
16603
|
});
|
|
16619
16604
|
}
|
|
16620
16605
|
} else if (summonsPrepared !== void 0) {
|
|
16621
|
-
prompt =
|
|
16622
|
-
|
|
16623
|
-
|
|
16624
|
-
);
|
|
16606
|
+
prompt = buildInstructionTransportPrompt(summonsPrepared);
|
|
16607
|
+
} else if (request.summons !== void 0) {
|
|
16608
|
+
prompt = RESUME_TRANSPORT_ENVELOPE;
|
|
16625
16609
|
} else {
|
|
16626
16610
|
prompt = buildResumeContinuationPrompt({
|
|
16627
16611
|
packageRoot: env.packageRoot,
|
|
@@ -16936,7 +16920,6 @@ var init_post_admission = __esm({
|
|
|
16936
16920
|
init_cli_errors();
|
|
16937
16921
|
init_invocation();
|
|
16938
16922
|
init_activation_ledger_topology();
|
|
16939
|
-
init_engine_material();
|
|
16940
16923
|
init_host_transition_prior_native();
|
|
16941
16924
|
init_public_run_credentials();
|
|
16942
16925
|
init_run_lifecycle();
|
|
@@ -16981,7 +16964,6 @@ __export(notary_run_exports, {
|
|
|
16981
16964
|
runPublicNotary: () => runPublicNotary,
|
|
16982
16965
|
runPublicNotaryResume: () => runPublicNotaryResume
|
|
16983
16966
|
});
|
|
16984
|
-
import { existsSync as existsSync9 } from "node:fs";
|
|
16985
16967
|
function buildNotaryTurnRequest(admitted, options) {
|
|
16986
16968
|
return projectRoleTurnRequest(
|
|
16987
16969
|
admitted,
|
|
@@ -17123,19 +17105,14 @@ async function runPublicNotaryResume(request, env, io) {
|
|
|
17123
17105
|
}
|
|
17124
17106
|
return loaded;
|
|
17125
17107
|
},
|
|
17126
|
-
buildTurnRequest: (admitted, effective) =>
|
|
17127
|
-
|
|
17108
|
+
buildTurnRequest: (admitted, effective) => (
|
|
17109
|
+
// #755: review continuation is plain dialogue / resume envelope — no
|
|
17110
|
+
//「重新读」candidate line, no engine handbook packaging.
|
|
17111
|
+
buildNotaryTurnRequest(
|
|
17128
17112
|
admitted,
|
|
17129
|
-
effective,
|
|
17130
|
-
|
|
17131
|
-
|
|
17132
|
-
const candidatePath = gateSubmissionCandidatePath(admitted.sourceRunPath);
|
|
17133
|
-
const prompt = existsSync9(candidatePath) ? appendResumeMaterialReread(projection.continuation.prompt, candidatePath) : projection.continuation.prompt;
|
|
17134
|
-
return buildNotaryTurnRequest(admitted, {
|
|
17135
|
-
...projection,
|
|
17136
|
-
continuation: { kind: "resume", prompt }
|
|
17137
|
-
});
|
|
17138
|
-
},
|
|
17113
|
+
resumeTurnRequestProjectionOptions(admitted, effective, env)
|
|
17114
|
+
)
|
|
17115
|
+
),
|
|
17139
17116
|
adapters: notaryAdapters(),
|
|
17140
17117
|
...env.engine === void 0 ? {} : { effectiveEngine: env.engine }
|
|
17141
17118
|
});
|
|
@@ -17143,7 +17120,6 @@ async function runPublicNotaryResume(request, env, io) {
|
|
|
17143
17120
|
var init_notary_run = __esm({
|
|
17144
17121
|
"src/public-cli/notary-run.ts"() {
|
|
17145
17122
|
"use strict";
|
|
17146
|
-
init_auditor_dossier_tool();
|
|
17147
17123
|
init_notary_source_run();
|
|
17148
17124
|
init_engine_material();
|
|
17149
17125
|
init_cli_errors();
|
|
@@ -17840,7 +17816,7 @@ __export(public_role_summons_exports, {
|
|
|
17840
17816
|
summonGateOfficer: () => summonGateOfficer,
|
|
17841
17817
|
summonPublicRole: () => summonPublicRole
|
|
17842
17818
|
});
|
|
17843
|
-
import { existsSync as
|
|
17819
|
+
import { existsSync as existsSync9 } from "node:fs";
|
|
17844
17820
|
import { join as join27 } from "node:path";
|
|
17845
17821
|
function createCapturingIo() {
|
|
17846
17822
|
const chunks = [];
|
|
@@ -17864,7 +17840,7 @@ function parentDir(path) {
|
|
|
17864
17840
|
function walkPackageRoot(start) {
|
|
17865
17841
|
let dir = start;
|
|
17866
17842
|
for (let i = 0; i < 12; i += 1) {
|
|
17867
|
-
if (
|
|
17843
|
+
if (existsSync9(join27(dir, "package.json")) && existsSync9(join27(dir, "souls"))) {
|
|
17868
17844
|
return dir;
|
|
17869
17845
|
}
|
|
17870
17846
|
const parent = parentDir(dir);
|
|
@@ -18154,7 +18130,7 @@ function tryReadComplianceCandidate(arguments_, usage) {
|
|
|
18154
18130
|
const args = arguments_;
|
|
18155
18131
|
const status = args.status;
|
|
18156
18132
|
if (status === "pass") return { status, ...usage === void 0 ? {} : { usage } };
|
|
18157
|
-
if (status === "
|
|
18133
|
+
if (status === "bounce") return { status, violations: readListField(args.violations), ...usage === void 0 ? {} : { usage } };
|
|
18158
18134
|
if (status === "escalate") {
|
|
18159
18135
|
return {
|
|
18160
18136
|
status,
|
|
@@ -18258,7 +18234,7 @@ var init_compliance_transport = __esm({
|
|
|
18258
18234
|
AUDITOR_DOSSIER_PROMPT = "\u672C run \u5377\u5B97\u5DF2\u5C31\u7EEA\u3002";
|
|
18259
18235
|
nonblank2 = Type15.String({ minLength: 1, pattern: "\\S" });
|
|
18260
18236
|
decisionGateSchema = Type15.Object({ question: nonblank2, options: Type15.Array(nonblank2, { minItems: 1 }) }, { additionalProperties: false });
|
|
18261
|
-
complianceDecisionSchema = Type15.Object({ status: Type15.Unknown({ description: "pass |
|
|
18237
|
+
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
18238
|
AUDITOR_PARENT_ATTEMPT_BINDING_ENTRY_TYPE = "ak_auditor_parent_attempt_binding";
|
|
18263
18239
|
AUDITOR_COMPLIANCE_FAILURE_ENTRY_TYPE = "ak_auditor_compliance_failure";
|
|
18264
18240
|
ComplianceResponseRetentionError = class extends Error {
|
|
@@ -18325,7 +18301,7 @@ __export(archivist_record_entry_exports, {
|
|
|
18325
18301
|
createRecordSessionOpen: () => createRecordSessionOpen,
|
|
18326
18302
|
subjectKeyedRecordDirectory: () => subjectKeyedRecordDirectory
|
|
18327
18303
|
});
|
|
18328
|
-
import { existsSync as
|
|
18304
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync4, readFileSync as readFileSync5, realpathSync as realpathSync2, writeFileSync as writeFileSync5 } from "node:fs";
|
|
18329
18305
|
import { dirname as dirname13, resolve as resolve13, join as join29 } from "node:path";
|
|
18330
18306
|
import { SessionManager } from "@earendil-works/pi-coding-agent";
|
|
18331
18307
|
function readCurrentSession(sessionDir) {
|
|
@@ -18408,7 +18384,7 @@ function createRecordSessionOpen(options) {
|
|
|
18408
18384
|
sessionDir = physicallyContainedIn(ledgerHome, parentResolved) ? join29(dirname13(parentResolved), options.kind) : join29(activationBookDirectory(ledgerHome, resolveBookKeyFromGit(cwd)), options.kind);
|
|
18409
18385
|
parentSession = parentFile;
|
|
18410
18386
|
}
|
|
18411
|
-
const nestAlreadyExists =
|
|
18387
|
+
const nestAlreadyExists = existsSync10(sessionDir);
|
|
18412
18388
|
ensureRealDirectoryTree(ledgerHome, sessionDir);
|
|
18413
18389
|
const mayResumeSameNest = options.subject !== void 0 || options.kind === WORKER_SUBMISSION_GATE_KIND;
|
|
18414
18390
|
if (mayResumeSameNest && nestAlreadyExists) {
|
|
@@ -18426,7 +18402,7 @@ function createRecordSessionOpen(options) {
|
|
|
18426
18402
|
);
|
|
18427
18403
|
if (session.isPersisted()) {
|
|
18428
18404
|
const file = session.getSessionFile();
|
|
18429
|
-
if (file !== void 0 && !
|
|
18405
|
+
if (file !== void 0 && !existsSync10(file)) {
|
|
18430
18406
|
const header = session.getHeader();
|
|
18431
18407
|
if (header !== null && header.type === "session") {
|
|
18432
18408
|
writeFileSync5(file, `${JSON.stringify(header)}
|
|
@@ -21240,7 +21216,7 @@ function createDoctorRoleRuntime(pi, dependencies, host) {
|
|
|
21240
21216
|
}
|
|
21241
21217
|
const details = testimony.status === "completed" ? { ...testimony, cost: activation.patient.cost } : testimony;
|
|
21242
21218
|
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 }),
|
|
21219
|
+
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
21220
|
throw new Error(`\u592A\u533B\u7F72\u56DE\u6267\u8FDD soul\uFF1A${violations.join("; ")}`);
|
|
21245
21221
|
}, escalate: (result) => result }, acceptedDetails);
|
|
21246
21222
|
} });
|
|
@@ -21551,7 +21527,7 @@ init_auditor_output();
|
|
|
21551
21527
|
var AUDITOR_TOOL_SPEC = {
|
|
21552
21528
|
name: AUDITOR_OUTPUT_TOOL_NAME,
|
|
21553
21529
|
label: "\u5BA1\u5211\u9662\u8F93\u51FA",
|
|
21554
|
-
description: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267\uFF0C\u72B6\u6001\u4E3A pass\
|
|
21530
|
+
description: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267\uFF0C\u72B6\u6001\u4E3A pass\u3001bounce \u6216 escalate\u3002",
|
|
21555
21531
|
promptSnippet: "\u5BA1\u5211\u9662\u7EC8\u5C40\u56DE\u6267",
|
|
21556
21532
|
parameters: auditorOutputSchema
|
|
21557
21533
|
};
|
|
@@ -21676,7 +21652,7 @@ function createJudgeRoleRuntime(pi, dependencies, hostActions) {
|
|
|
21676
21652
|
terminate: true,
|
|
21677
21653
|
...usageProjection
|
|
21678
21654
|
}),
|
|
21679
|
-
|
|
21655
|
+
bounce: (violations) => {
|
|
21680
21656
|
throw new Error(
|
|
21681
21657
|
`\u5927\u7406\u5BFA\u56DE\u6267\u8FDD soul\uFF1A${violations.join("; ")}`
|
|
21682
21658
|
);
|
|
@@ -22076,7 +22052,7 @@ init_sitian_facade();
|
|
|
22076
22052
|
init_submission_errors();
|
|
22077
22053
|
init_submission_errors();
|
|
22078
22054
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
22079
|
-
import { existsSync as
|
|
22055
|
+
import { existsSync as existsSync11, lstatSync as lstatSync3, readdirSync as readdirSync2, readFileSync as readFileSync6, rmdirSync, rmSync } from "node:fs";
|
|
22080
22056
|
import { resolve as resolve18 } from "node:path";
|
|
22081
22057
|
var WORKER_SUBMISSION_GATE_RECORD_KIND = WORKER_SUBMISSION_GATE_KIND;
|
|
22082
22058
|
var WORKER_COMMIT_BASELINE_ENTRY_TYPE = "commit-baseline";
|
|
@@ -22107,7 +22083,7 @@ function statusOf(error) {
|
|
|
22107
22083
|
return typeof error === "object" && error !== null && "status" in error ? error.status : void 0;
|
|
22108
22084
|
}
|
|
22109
22085
|
function tryGetAll(file, key) {
|
|
22110
|
-
if (!
|
|
22086
|
+
if (!existsSync11(file)) return [];
|
|
22111
22087
|
try {
|
|
22112
22088
|
const out = gitFile(file, ["--get-all", key]);
|
|
22113
22089
|
return out.length === 0 ? [] : out.split("\n");
|
|
@@ -22117,7 +22093,7 @@ function tryGetAll(file, key) {
|
|
|
22117
22093
|
}
|
|
22118
22094
|
}
|
|
22119
22095
|
function ownedHook(path) {
|
|
22120
|
-
if (!
|
|
22096
|
+
if (!existsSync11(path)) return false;
|
|
22121
22097
|
return readFileSync6(path, "utf8").includes(HOOK_MARKER);
|
|
22122
22098
|
}
|
|
22123
22099
|
function escapeGitConfigValueRegex(value) {
|
|
@@ -22144,11 +22120,11 @@ function rmOwnedDir(dir) {
|
|
|
22144
22120
|
const hookPath = resolve18(dir, HOOK_FILE);
|
|
22145
22121
|
if (!ownedHook(hookPath)) return;
|
|
22146
22122
|
rmSync(hookPath, { force: true });
|
|
22147
|
-
if (
|
|
22123
|
+
if (existsSync11(dir) && readdirSync2(dir).length === 0) rmdirSync(dir);
|
|
22148
22124
|
}
|
|
22149
22125
|
function linkedGitDirs(commonDir) {
|
|
22150
22126
|
const root = resolve18(commonDir, "worktrees");
|
|
22151
|
-
if (!
|
|
22127
|
+
if (!existsSync11(root)) return [];
|
|
22152
22128
|
return readdirSync2(root).map((name) => resolve18(root, name)).filter((dir) => lstatSync3(dir).isDirectory());
|
|
22153
22129
|
}
|
|
22154
22130
|
function uninstallPackageWorkerHooks(cwd) {
|
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
|
};
|