UNPKG

eve

Version:

Filesystem-first framework for durable backend AI agents that run anywhere.

481 lines (480 loc) 22.5 kB
import { z } from "#compiled/zod/index.js"; import type { DeliverHookPayload, SessionCommand, SessionTimeoutHookPayload } from "#channel/types.js"; /** Version 3 adds the trusted deployment that accepted each channel delivery. */ export declare const sessionInboxWireV3Schema: z.ZodDiscriminatedUnion<[z.ZodObject<{ auth: z.ZodOptional<z.ZodNullable<z.ZodObject<{ attributes: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>; authenticator: z.ZodString; issuer: z.ZodOptional<z.ZodString>; principalId: z.ZodString; principalType: z.ZodString; subject: z.ZodOptional<z.ZodString>; }, z.core.$strict>>>; kind: z.ZodLiteral<"deliver">; payloads: z.ZodArray<z.ZodObject<{ context: z.ZodOptional<z.ZodArray<z.ZodString>>; inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{ optionId: z.ZodOptional<z.ZodString>; requestId: z.ZodString; text: z.ZodOptional<z.ZodString>; }, z.core.$strict>>>; message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>; text: z.ZodString; type: z.ZodLiteral<"text">; }, z.core.$strict>, z.ZodObject<{ image: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>; mediaType: z.ZodOptional<z.ZodString>; providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>; type: z.ZodLiteral<"image">; }, z.core.$strict>, z.ZodObject<{ data: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>; filename: z.ZodOptional<z.ZodString>; mediaType: z.ZodString; providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>; type: z.ZodLiteral<"file">; }, z.core.$strict>], "type">>]>>; outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>; task: z.ZodOptional<z.ZodObject<{ authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{ hookPayload: z.ZodObject<{ callId: z.ZodString; childSessionId: z.ZodString; event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>; kind: z.ZodLiteral<"subagent-authorization-event">; subagentName: z.ZodString; }, z.core.$strict>; taskId: z.ZodString; }, z.core.$strict>>>; inputRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{ hookPayload: z.ZodObject<{ callId: z.ZodString; childContinuationToken: z.ZodString; childSessionId: z.ZodString; event: z.ZodObject<{ requests: z.ZodArray<z.ZodObject<{ action: z.ZodObject<{ callId: z.ZodString; input: z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>; kind: z.ZodLiteral<"tool-call">; toolName: z.ZodString; }, z.core.$strict>; allowFreeform: z.ZodOptional<z.ZodBoolean>; display: z.ZodOptional<z.ZodEnum<{ confirmation: "confirmation"; select: "select"; text: "text"; }>>; kind: z.ZodEnum<{ question: "question"; "session-limit": "session-limit"; "tool-approval": "tool-approval"; }>; options: z.ZodOptional<z.ZodArray<z.ZodObject<{ description: z.ZodOptional<z.ZodString>; id: z.ZodString; label: z.ZodString; style: z.ZodOptional<z.ZodEnum<{ danger: "danger"; default: "default"; primary: "primary"; }>>; }, z.core.$strict>>>; prompt: z.ZodString; requestId: z.ZodString; }, z.core.$strict>>; sequence: z.ZodNumber; stepIndex: z.ZodNumber; turnId: z.ZodString; }, z.core.$strict>; kind: z.ZodLiteral<"subagent-input-request">; subagentName: z.ZodString; }, z.core.$strict>; taskId: z.ZodString; }, z.core.$strict>>>; views: z.ZodOptional<z.ZodArray<z.ZodType<import("../../tasks/types.ts").TaskView, unknown, z.core.$ZodTypeInternals<import("../../tasks/types.ts").TaskView, unknown>>>>; }, z.core.$strict>>; }, z.core.$loose>>; requestId: z.ZodOptional<z.ZodString>; taskDeliveryId: z.ZodOptional<z.ZodString>; turnPolicy: z.ZodOptional<z.ZodEnum<{ queue: "queue"; steer: "steer"; }>>; caller: z.ZodOptional<z.ZodObject<{ callId: z.ZodString; replyTo: z.ZodDiscriminatedUnion<[z.ZodObject<{ kind: z.ZodLiteral<"hook">; token: z.ZodString; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"callback">; token: z.ZodString; url: z.ZodString; }, z.core.$strict>], "kind">; subagentName: z.ZodString; taskId: z.ZodOptional<z.ZodString>; activityObserver: z.ZodOptional<z.ZodObject<{ sink: z.ZodObject<{ url: z.ZodString; version: z.ZodLiteral<1>; }, z.core.$strict>; workIdentity: z.ZodOptional<z.ZodObject<{ callId: z.ZodOptional<z.ZodString>; id: z.ZodString; kind: z.ZodEnum<{ "remote-agent": "remote-agent"; "root-turn": "root-turn"; subagent: "subagent"; task: "task"; }>; name: z.ZodOptional<z.ZodString>; parentId: z.ZodOptional<z.ZodString>; rootSessionId: z.ZodString; rootTurnId: z.ZodString; sessionId: z.ZodOptional<z.ZodString>; turnId: z.ZodOptional<z.ZodString>; }, z.core.$strict>>; }, z.core.$strict>>; }, z.core.$strict>>; payload: z.ZodObject<{ context: z.ZodOptional<z.ZodArray<z.ZodString>>; inputResponses: z.ZodOptional<z.ZodArray<z.ZodObject<{ optionId: z.ZodOptional<z.ZodString>; requestId: z.ZodString; text: z.ZodOptional<z.ZodString>; }, z.core.$strict>>>; message: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{ providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>; text: z.ZodString; type: z.ZodLiteral<"text">; }, z.core.$strict>, z.ZodObject<{ image: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>; mediaType: z.ZodOptional<z.ZodString>; providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>; type: z.ZodLiteral<"image">; }, z.core.$strict>, z.ZodObject<{ data: z.ZodCustom<URL | import("ai").DataContent, URL | import("ai").DataContent>; filename: z.ZodOptional<z.ZodString>; mediaType: z.ZodString; providerOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>>; type: z.ZodLiteral<"file">; }, z.core.$strict>], "type">>]>>; outputSchema: z.ZodOptional<z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>>; task: z.ZodOptional<z.ZodObject<{ authorizationEvents: z.ZodOptional<z.ZodArray<z.ZodObject<{ hookPayload: z.ZodObject<{ callId: z.ZodString; childSessionId: z.ZodString; event: z.ZodCustom<Record<string, unknown>, Record<string, unknown>>; kind: z.ZodLiteral<"subagent-authorization-event">; subagentName: z.ZodString; }, z.core.$strict>; taskId: z.ZodString; }, z.core.$strict>>>; inputRequests: z.ZodOptional<z.ZodArray<z.ZodObject<{ hookPayload: z.ZodObject<{ callId: z.ZodString; childContinuationToken: z.ZodString; childSessionId: z.ZodString; event: z.ZodObject<{ requests: z.ZodArray<z.ZodObject<{ action: z.ZodObject<{ callId: z.ZodString; input: z.ZodType<import("../../shared/json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("../../shared/json.ts").JsonObject, unknown>>; kind: z.ZodLiteral<"tool-call">; toolName: z.ZodString; }, z.core.$strict>; allowFreeform: z.ZodOptional<z.ZodBoolean>; display: z.ZodOptional<z.ZodEnum<{ confirmation: "confirmation"; select: "select"; text: "text"; }>>; kind: z.ZodEnum<{ question: "question"; "session-limit": "session-limit"; "tool-approval": "tool-approval"; }>; options: z.ZodOptional<z.ZodArray<z.ZodObject<{ description: z.ZodOptional<z.ZodString>; id: z.ZodString; label: z.ZodString; style: z.ZodOptional<z.ZodEnum<{ danger: "danger"; default: "default"; primary: "primary"; }>>; }, z.core.$strict>>>; prompt: z.ZodString; requestId: z.ZodString; }, z.core.$strict>>; sequence: z.ZodNumber; stepIndex: z.ZodNumber; turnId: z.ZodString; }, z.core.$strict>; kind: z.ZodLiteral<"subagent-input-request">; subagentName: z.ZodString; }, z.core.$strict>; taskId: z.ZodString; }, z.core.$strict>>>; views: z.ZodOptional<z.ZodArray<z.ZodType<import("../../tasks/types.ts").TaskView, unknown, z.core.$ZodTypeInternals<import("../../tasks/types.ts").TaskView, unknown>>>>; }, z.core.$strict>>; }, z.core.$loose>; deliveryMetadata: z.ZodOptional<z.ZodArray<z.ZodObject<{ channelKind: z.ZodString; channelName: z.ZodString; deliveryId: z.ZodString; payloadIndex: z.ZodNumber; requestId: z.ZodOptional<z.ZodString>; requestTraceContext: z.ZodOptional<z.ZodObject<{ spanId: z.ZodString; traceFlags: z.ZodNumber; traceId: z.ZodString; }, z.core.$strict>>; acceptedDeploymentId: z.ZodOptional<z.ZodString>; }, z.core.$strict>>>; version: z.ZodLiteral<3>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"session-timeout">; version: z.ZodLiteral<3>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"clear">; version: z.ZodLiteral<3>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"compact">; version: z.ZodLiteral<3>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"reset">; reason: z.ZodOptional<z.ZodString>; version: z.ZodLiteral<3>; }, z.core.$strict>, z.ZodObject<{ kind: z.ZodLiteral<"cancel">; taskId: z.ZodOptional<z.ZodString>; turnId: z.ZodOptional<z.ZodString>; version: z.ZodLiteral<3>; }, z.core.$strict>], "kind">; export type SessionInboxWireV3 = z.infer<typeof sessionInboxWireV3Schema>; export declare function parseSessionInboxWireV3(value: unknown): z.ZodSafeParseResult<{ auth?: { attributes: Record<string, string | string[]>; authenticator: string; issuer?: string | undefined; principalId: string; principalType: string; subject?: string | undefined; } | null | undefined; kind: "deliver"; payloads: { [x: string]: unknown; context?: string[] | undefined; inputResponses?: { optionId?: string | undefined; requestId: string; text?: string | undefined; }[] | undefined; message?: string | ({ providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined; text: string; type: "text"; } | { image: URL | import("ai").DataContent; mediaType?: string | undefined; providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined; type: "image"; } | { data: URL | import("ai").DataContent; filename?: string | undefined; mediaType: string; providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined; type: "file"; })[] | undefined; outputSchema?: import("../../shared/json.ts").JsonObject | undefined; task?: { authorizationEvents?: { hookPayload: { callId: string; childSessionId: string; event: Record<string, unknown>; kind: "subagent-authorization-event"; subagentName: string; }; taskId: string; }[] | undefined; inputRequests?: { hookPayload: { callId: string; childContinuationToken: string; childSessionId: string; event: { requests: { action: { callId: string; input: import("../../shared/json.ts").JsonObject; kind: "tool-call"; toolName: string; }; allowFreeform?: boolean | undefined; display?: "confirmation" | "select" | "text" | undefined; kind: "question" | "session-limit" | "tool-approval"; options?: { description?: string | undefined; id: string; label: string; style?: "danger" | "default" | "primary" | undefined; }[] | undefined; prompt: string; requestId: string; }[]; sequence: number; stepIndex: number; turnId: string; }; kind: "subagent-input-request"; subagentName: string; }; taskId: string; }[] | undefined; views?: import("../../tasks/types.ts").TaskView[] | undefined; } | undefined; }[]; requestId?: string | undefined; taskDeliveryId?: string | undefined; turnPolicy?: "queue" | "steer" | undefined; caller?: { callId: string; replyTo: { kind: "hook"; token: string; } | { kind: "callback"; token: string; url: string; }; subagentName: string; taskId?: string | undefined; activityObserver?: { sink: { url: string; version: 1; }; workIdentity?: { callId?: string | undefined; id: string; kind: "remote-agent" | "root-turn" | "subagent" | "task"; name?: string | undefined; parentId?: string | undefined; rootSessionId: string; rootTurnId: string; sessionId?: string | undefined; turnId?: string | undefined; } | undefined; } | undefined; } | undefined; payload: { [x: string]: unknown; context?: string[] | undefined; inputResponses?: { optionId?: string | undefined; requestId: string; text?: string | undefined; }[] | undefined; message?: string | ({ providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined; text: string; type: "text"; } | { image: URL | import("ai").DataContent; mediaType?: string | undefined; providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined; type: "image"; } | { data: URL | import("ai").DataContent; filename?: string | undefined; mediaType: string; providerOptions?: Record<string, import("../../shared/json.ts").JsonObject> | undefined; type: "file"; })[] | undefined; outputSchema?: import("../../shared/json.ts").JsonObject | undefined; task?: { authorizationEvents?: { hookPayload: { callId: string; childSessionId: string; event: Record<string, unknown>; kind: "subagent-authorization-event"; subagentName: string; }; taskId: string; }[] | undefined; inputRequests?: { hookPayload: { callId: string; childContinuationToken: string; childSessionId: string; event: { requests: { action: { callId: string; input: import("../../shared/json.ts").JsonObject; kind: "tool-call"; toolName: string; }; allowFreeform?: boolean | undefined; display?: "confirmation" | "select" | "text" | undefined; kind: "question" | "session-limit" | "tool-approval"; options?: { description?: string | undefined; id: string; label: string; style?: "danger" | "default" | "primary" | undefined; }[] | undefined; prompt: string; requestId: string; }[]; sequence: number; stepIndex: number; turnId: string; }; kind: "subagent-input-request"; subagentName: string; }; taskId: string; }[] | undefined; views?: import("../../tasks/types.ts").TaskView[] | undefined; } | undefined; }; deliveryMetadata?: { channelKind: string; channelName: string; deliveryId: string; payloadIndex: number; requestId?: string | undefined; requestTraceContext?: { spanId: string; traceFlags: number; traceId: string; } | undefined; acceptedDeploymentId?: string | undefined; }[] | undefined; version: 3; } | { kind: "session-timeout"; version: 3; } | { kind: "clear"; version: 3; } | { kind: "compact"; version: 3; } | { kind: "reset"; reason?: string | undefined; version: 3; } | { kind: "cancel"; taskId?: string | undefined; turnId?: string | undefined; version: 3; }>; /** Builds and validates one complete version-3 wire value. */ export declare function encodeSessionCommandV3(command: DeliverHookPayload | SessionCommand | SessionTimeoutHookPayload): SessionInboxWireV3;