From 9052ecbc2a8721c133079d321c83aa2b45a9fcc2 Mon Sep 17 00:00:00 2001 From: sunlei Date: Wed, 24 Jun 2026 23:24:56 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=94=B6=E7=B4=A7NapCat=E5=AE=A1?= =?UTF-8?q?=E8=AE=A1=E8=BE=93=E5=87=BA=E5=A5=91=E7=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/selfTest.ts | 10 ++++++++++ src/tools/napcatAutomation.types.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/selfTest.ts b/src/selfTest.ts index 382f570..be6012c 100644 --- a/src/selfTest.ts +++ b/src/selfTest.ts @@ -73,6 +73,16 @@ export async function runSelfTest(): Promise { if (!napcatAuditSchemaSmoke.success) { throw new Error("NapCat upstream audit schema self-check failed"); } + const napcatAuditExtraPropertySmoke = upstreamAuditOutputSchema.safeParse({ + classification: "manual-review", + reasonCodes: ["HOT_ZONE_CHANGED"], + recommendedAction: "request-human-review", + summary: "Login hot-zone changed.", + unexpectedField: "Codex output schema rejects this.", + }); + if (napcatAuditExtraPropertySmoke.success) { + throw new Error("NapCat upstream audit schema strict self-check failed"); + } if (!napcatAutomationReasonCodes.includes("HOT_ZONE_CHANGED")) { throw new Error("NapCat reason-code list self-check failed"); } diff --git a/src/tools/napcatAutomation.types.ts b/src/tools/napcatAutomation.types.ts index 77022ac..1a513df 100644 --- a/src/tools/napcatAutomation.types.ts +++ b/src/tools/napcatAutomation.types.ts @@ -26,7 +26,7 @@ export const upstreamAuditOutputSchema = z.object({ 'block', ]), summary: z.string().min(1), -}); +}).strict(); export type NapcatAutomationClassification = (typeof napcatAutomationClassifications)[number];