import { z } from "zod"; import { type IsoDateTime, type RunId } from "./ids.js"; /** 01-core §11 */ export type TriggerSource = { kind: "schedule"; cron?: string; every?: string; at?: IsoDateTime; } | { kind: "host-event"; event: string; } | { kind: "external"; connector: string; event?: string; config?: unknown; }; /** 01-core §3. Lives beside TriggerSource (not in run-context.ts) so grants, * audit, AND run-context can all import it without a runtime module cycle. */ export interface TriggerRef { runId: RunId; kind: TriggerSource["kind"]; /** * WHICH automation is firing. An automation is a record consented to on its * own, so this — not an app id — is what the guard matches an away grant on * (`PermissionGrant.automationId`). Absent on a run that is nobody's * automation, which then holds no away authority at all. */ automationId?: string; /** * The FIRING this run belongs to, as opposed to the run itself: the id of the * first run of it. A re-run inherits it; a run that is nobody's re-run has its * own id here or nothing at all. * * It exists because the effect ledger (Build contract §7) has to answer "has * this effect already happened", and the honest unit of that question is the * firing, not the run. "Fail loudly, then run it again" mints a FRESH run of * the same trigger on the same event, so keying receipts on `runId` meant the * re-run missed every receipt the failed run wrote and repeated work that had * already landed. * * Deliberately NOT `runId` itself: a `task`-duration grant and every audit row * key off `runId`, and both must keep meaning THIS run — one run's task grant * may not authorize its re-run, and the trail may not claim one run did * another's work. */ lineageId?: RunId; } /** 01-core §3 */ export declare const triggerRefSchema: z.ZodObject<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ runId: z.ZodString; kind: z.ZodEnum<["schedule", "host-event", "external"]>; automationId: z.ZodOptional; lineageId: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; /** 01-core §11 */ export declare const triggerSourceSchema: z.ZodEffects; cron: z.ZodOptional; every: z.ZodOptional; at: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodLiteral<"schedule">; cron: z.ZodOptional; every: z.ZodOptional; at: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodLiteral<"schedule">; cron: z.ZodOptional; every: z.ZodOptional; at: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{ kind: z.ZodLiteral<"host-event">; event: z.ZodString; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodLiteral<"host-event">; event: z.ZodString; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodLiteral<"host-event">; event: z.ZodString; }, z.ZodTypeAny, "passthrough">>, z.ZodObject<{ kind: z.ZodLiteral<"external">; connector: z.ZodString; event: z.ZodOptional; config: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ kind: z.ZodLiteral<"external">; connector: z.ZodString; event: z.ZodOptional; config: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodLiteral<"external">; connector: z.ZodString; event: z.ZodOptional; config: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>]>, z.objectOutputType<{ kind: z.ZodLiteral<"schedule">; cron: z.ZodOptional; every: z.ZodOptional; at: z.ZodOptional; }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{ kind: z.ZodLiteral<"host-event">; event: z.ZodString; }, z.ZodTypeAny, "passthrough"> | z.objectOutputType<{ kind: z.ZodLiteral<"external">; connector: z.ZodString; event: z.ZodOptional; config: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ kind: z.ZodLiteral<"schedule">; cron: z.ZodOptional; every: z.ZodOptional; at: z.ZodOptional; }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{ kind: z.ZodLiteral<"host-event">; event: z.ZodString; }, z.ZodTypeAny, "passthrough"> | z.objectInputType<{ kind: z.ZodLiteral<"external">; connector: z.ZodString; event: z.ZodOptional; config: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>; /** 01-core §11 */ export interface Step { id: string; tool: string; args?: Record; if?: string; forEach?: string; } /** 01-core §11 */ export declare const stepSchema: z.ZodObject<{ id: z.ZodString; tool: z.ZodString; args: z.ZodOptional>; if: z.ZodOptional; forEach: z.ZodOptional; }, "passthrough", z.ZodTypeAny, z.objectOutputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodOptional>; if: z.ZodOptional; forEach: z.ZodOptional; }, z.ZodTypeAny, "passthrough">, z.objectInputType<{ id: z.ZodString; tool: z.ZodString; args: z.ZodOptional>; if: z.ZodOptional; forEach: z.ZodOptional; }, z.ZodTypeAny, "passthrough">>;