UNPKG

eve

Version:

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

109 lines (108 loc) 4.5 kB
import { z } from "#compiled/zod/index.js"; /** * One selectable option presented to the user in an input request. */ export type InputOption = z.infer<typeof inputOptionSchema>; /** * Zod schema for one input option. * * Includes descriptions because the `ask_question` tool input embeds this * schema and exposes it directly to the model. */ export declare const inputOptionSchema: 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>; /** * Framework-owned source of an input request. * * Consumers use this discriminator for behavior. The action tool name and * request id are presentation and identity fields, not request semantics. */ export type InputRequestKind = z.infer<typeof inputRequestKindSchema>; /** Zod schema for the framework-owned source of an input request. */ export declare const inputRequestKindSchema: z.ZodEnum<{ question: "question"; "session-limit": "session-limit"; "tool-approval": "tool-approval"; }>; /** Unified input request surfaced when the agent needs user input. */ export type InputRequest = z.infer<typeof inputRequestSchema>; /** * Zod schema for one input request. */ export declare const inputRequestSchema: z.ZodObject<{ action: z.ZodObject<{ callId: z.ZodString; input: z.ZodType<import("./json.ts").JsonObject, unknown, z.core.$ZodTypeInternals<import("./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>; /** * Unified input response submitted by the client for a pending request. */ export type InputResponse = z.infer<typeof inputResponseSchema>; declare const validatedInputResponseBrand: unique symbol; /** Input response proven to match the strict durable wire schema. */ export type ValidatedInputResponse = InputResponse & { readonly [validatedInputResponseBrand]: true; }; /** * Zod schema for one input response. */ export declare const inputResponseSchema: z.ZodObject<{ optionId: z.ZodOptional<z.ZodString>; requestId: z.ZodString; text: z.ZodOptional<z.ZodString>; }, z.core.$strict>; /** Parses one response and preserves schema validation in its static type. */ export declare function parseInputResponse(value: unknown): ValidatedInputResponse; /** Parses response arrays whose element types were widened before delivery. */ export declare function parseInputResponses(value: unknown): readonly ValidatedInputResponse[]; type IsWidenedInputResponse<TResponse extends InputResponse> = keyof TResponse extends keyof InputResponse ? keyof InputResponse extends keyof TResponse ? InputResponse extends TResponse ? true : false : false : false; type StrictInputResponse<TResponse extends InputResponse> = TResponse extends ValidatedInputResponse ? TResponse : IsWidenedInputResponse<TResponse> extends true ? never : TResponse & { readonly [TKey in Exclude<keyof TResponse, keyof InputResponse>]: never; }; /** Rejects extra response keys and imprecise arrays not proven by the strict schema. */ export type StrictInputResponses<TResponses extends readonly InputResponse[]> = TResponses & { readonly [TIndex in keyof TResponses]: TResponses[TIndex] extends InputResponse ? StrictInputResponse<TResponses[TIndex]> : TResponses[TIndex]; }; /** * Returns true when a value matches the input request contract. */ export declare function isInputRequest(value: unknown): value is InputRequest; /** * Returns true when a value matches the input response contract. */ export declare function isInputResponse(value: unknown): value is ValidatedInputResponse; export {};