import { z } from "zod/v4"; /** * Scheduled trigger payloads (plan §11.3), carried in the protocol-2 * envelope with `kind: "trigger.schedule"`. Dispatched by the platform's * minute drain with an APP principal — no user is present; capability * calls run app-scoped (install storage, indexing, notifications, net), * and user-ACL-dependent operations fail closed. */ export const TRIGGER_SCHEDULE_KIND = "trigger.schedule" as const; export const triggerSchedulePayloadSchema = z.strictObject({ scheduleId: z.string().min(1).max(120), /** The minute this run fired for, ISO, floored. */ firedAt: z.iso.datetime(), capabilities: z.strictObject({ url: z.url().max(2000), token: z.string().min(16).max(4096), }), }); export type TriggerSchedulePayload = z.infer; export const triggerScheduleResponseSchema = z.union([ z.strictObject({ result: z.strictObject({ ok: z.literal(true) }) }), z.strictObject({ error: z.strictObject({ code: z.string().min(1).max(120), message: z.string().min(1).max(2000), }), }), ]); export type TriggerScheduleResponse = z.infer;