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(),