From da463ddebcecaaf0ab4eec204ab78e1f77e724b8 Mon Sep 17 00:00:00 2001 From: _Kerman Date: Wed, 19 Aug 2026 14:34:00 +0800 Subject: [PATCH] refactor(subagent): normalize optional timing output --- packages/subagent/subagent/src/projection.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/subagent/subagent/src/projection.ts b/packages/subagent/subagent/src/projection.ts index 2020a881a1..c225f71f75 100644 --- a/packages/subagent/subagent/src/projection.ts +++ b/packages/subagent/subagent/src/projection.ts @@ -29,12 +29,13 @@ const activeIntervalSchema = z.object({ through: z.number().int().nonnegative(), }).strict() -// Zod's optional output includes explicit `undefined`; with -// exactOptionalPropertyTypes the public interface permits omission only. -const projectionSchema = z.object({ +const projectionSchema: z.ZodType = z.object({ settledMs: z.number().int().nonnegative(), active: activeIntervalSchema.optional(), -}).strict() as unknown as z.ZodType +}).strict().transform(({ settledMs, active }) => ({ + settledMs, + ...active === undefined ? {} : { active }, +})) const timingStateSchema: z.ZodType = z.object({ settledMs: z.number().int().nonnegative(),