import { z } from '#compiled/zod/index.js'; import type { SerializedData } from './serialization.js'; import type { PaginationOptions, ResolveData } from './shared.js'; /** * Minimal, immutable slice of a hook's owning run needed to resume it — * enough for encryption-key resolution, serialization/compression capability * selection, queue routing, and trace linking, without fetching the full run. * * Persisted on new hook records (workflow-server) and also returned inline by * `getByToken`, so a resume can skip the separate `runs.get`. Deliberately * excludes the run's mutable state (e.g. status), inputs/outputs, attributes, * and any secret — only fields that are fixed at hook-creation time. */ export declare const HookResumeContextSchema: z.ZodObject<{ deploymentId: z.ZodString; workflowName: z.ZodString; runSpecVersion: z.ZodOptional; workflowCoreVersion: z.ZodOptional; traceCarrier: z.ZodOptional>; encryptionPublicKey: z.ZodOptional; hookResumeInputVersion: z.ZodOptional; }, z.core.$strip>; export type HookResumeContext = z.infer; /** * Current version of the lazy-hook-resume consumer protocol. A run's creating * deployment stamps this into its execution context (and the server mirrors it * onto `HookResumeContext.hookResumeInputVersion`) to attest that its * `@workflow/core` re-ensures the `hook_received` event from a queue message's * `hookInput`. `resumeHook()`'s parallel fast path requires the target run's * marker to be at least this value. Bump only on a breaking change to the * `hookInput` re-ensure contract. */ export declare const HOOK_RESUME_INPUT_VERSION = 1; /** * Current version of the backend lazy-hook-resume dedup contract: the live * backend enforces a `(runId, resumeId)` constraint so the direct write and the * queue consumer's re-ensure converge on exactly one `hook_received`. * `resumeHook()`'s parallel fast path requires the backend to attest at least * this version. Bump only on a breaking change to the constraint semantics. */ export declare const HOOK_RESUME_DEDUP_VERSION = 1; /** * Backend-attested capabilities for lazy hook resume, computed FRESH on every * by-token hook lookup and returned inline on {@link HookSchema.resumeCapabilities}. * * Response-only and transient: NEVER persisted on the hook entity and NEVER * part of {@link HookResumeContextSchema}. Recomputing it per response is what * makes a server rollback or kill switch take effect immediately — a rolled-back * or kill-switched server simply stops emitting it, dropping new resumes to the * sequential path with no stranded hooks. (Contrast with the per-run, persisted * `hookResumeInputVersion`, which attests the *consumer* and is fixed at run * creation.) */ export declare const HookResumeCapabilitiesSchema: z.ZodObject<{ hookResumeDedupVersion: z.ZodNumber; }, z.core.$strip>; export type HookResumeCapabilities = z.infer; /** * Schema for workflow hooks. * * Note: metadata uses SerializedDataSchema to support both: * - specVersion >= 2: Uint8Array (binary devalue format) * - specVersion 1: any (legacy JSON format) */ export declare const HookSchema: z.ZodObject<{ runId: z.ZodString; hookId: z.ZodString; token: z.ZodString; ownerId: z.ZodString; projectId: z.ZodString; environment: z.ZodString; metadata: z.ZodOptional>, z.ZodType>]>>; createdAt: z.ZodCoercedDate; specVersion: z.ZodOptional; isWebhook: z.ZodOptional; isSystem: z.ZodOptional; tokenRetentionUntil: z.ZodOptional>; resumeContext: z.ZodOptional; workflowCoreVersion: z.ZodOptional; traceCarrier: z.ZodOptional>; encryptionPublicKey: z.ZodOptional; hookResumeInputVersion: z.ZodOptional; }, z.core.$strip>>; resumeCapabilities: z.ZodOptional>; }, z.core.$strip>; /** * Represents a Hook. Hooks kept by minimum retention remain readable after * their workflow runs end, but cannot be resumed. * * Note: metadata type is SerializedData to support both: * - specVersion >= 2: Uint8Array (binary devalue format) * - specVersion 1: unknown (legacy JSON format) */ export type Hook = z.infer; export interface CreateHookRequest { hookId: string; token: string; metadata?: SerializedData; isWebhook?: boolean; } export interface GetHookByTokenParams { token: string; } export interface ListHooksParams { runId?: string; pagination?: PaginationOptions; resolveData?: ResolveData; } export interface GetHookParams { resolveData?: ResolveData; } //# sourceMappingURL=hooks.d.ts.map