import nunjucks, { type Callback, type LoaderSource } from "nunjucks"; import { z } from "zod"; import type { ChatModelInputMessage, ChatModelInputMessageContent, ChatModelOutputToolCall } from "../agents/chat-model.js"; export interface FormatOptions { workingDir?: string; } export declare class PromptTemplate { template: string; static from(template: string): PromptTemplate; constructor(template: string); format(variables?: Record, options?: FormatOptions): Promise; } export declare class CustomLoader extends nunjucks.Loader { options: { workingDir: string; }; constructor(options: { workingDir: string; }); async: boolean; isRelative(filename: string): boolean; resolve(from: string, to: string): string; getSource(name: string, callback: Callback): LoaderSource; } export declare class ChatMessageTemplate { role: "system" | "user" | "agent" | "tool"; content?: ChatModelInputMessage["content"]; name?: string | undefined; options?: FormatOptions | undefined; cacheControl?: ChatModelInputMessage["cacheControl"]; constructor(role: "system" | "user" | "agent" | "tool", content?: ChatModelInputMessage["content"], name?: string | undefined, options?: FormatOptions | undefined, cacheControl?: ChatModelInputMessage["cacheControl"]); format(variables?: Record, options?: FormatOptions): Promise; } export declare class SystemMessageTemplate extends ChatMessageTemplate { static from(content: string, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): SystemMessageTemplate; } export declare class UserMessageTemplate extends ChatMessageTemplate { static from(template: ChatModelInputMessageContent, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): UserMessageTemplate; } export declare class AgentMessageTemplate extends ChatMessageTemplate { toolCalls?: ChatModelOutputToolCall[] | undefined; static from(template?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[], name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): AgentMessageTemplate; constructor(content?: ChatModelInputMessage["content"], toolCalls?: ChatModelOutputToolCall[] | undefined, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]); format(_variables?: Record, _options?: FormatOptions): Promise<{ role: "agent" | "user" | "system" | "tool"; name: string | undefined; content: ChatModelInputMessageContent | undefined; toolCalls: ChatModelOutputToolCall[] | undefined; cacheControl: import("../index.js").CacheControl | undefined; }>; } export declare class ToolMessageTemplate extends ChatMessageTemplate { toolCallId: string; static from(content: object | string, toolCallId: string, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]): ToolMessageTemplate; constructor(content: object | string, toolCallId: string, name?: string, options?: FormatOptions, cacheControl?: ChatModelInputMessage["cacheControl"]); format(_variables?: Record, _options?: FormatOptions): Promise<{ role: "agent" | "user" | "system" | "tool"; name: string | undefined; content: ChatModelInputMessageContent | undefined; toolCallId: string; cacheControl: import("../index.js").CacheControl | undefined; }>; } export declare class ChatMessagesTemplate { messages: ChatMessageTemplate[]; static from(messages: ChatMessageTemplate[] | string): ChatMessagesTemplate; constructor(messages: ChatMessageTemplate[]); copy(): ChatMessagesTemplate; format(variables?: Record, options?: FormatOptions): Promise; } declare const chatMessageSchema: z.ZodUnion<[z.ZodObject<{ role: z.ZodLiteral<"system">; content: z.ZodString; name: z.ZodOptional; cacheControl: z.ZodOptional; ttl: z.ZodOptional, z.ZodLiteral<"1h">]>>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; }, { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; }>>; }, "strip", z.ZodTypeAny, { role: "system"; content: string; name?: string | undefined; cacheControl?: { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; } | undefined; }, { role: "system"; content: string; name?: string | undefined; cacheControl?: { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; } | undefined; }>, z.ZodObject<{ role: z.ZodLiteral<"user">; content: z.ZodString; name: z.ZodOptional; cacheControl: z.ZodOptional; ttl: z.ZodOptional, z.ZodLiteral<"1h">]>>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; }, { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; }>>; }, "strip", z.ZodTypeAny, { role: "user"; content: string; name?: string | undefined; cacheControl?: { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; } | undefined; }, { role: "user"; content: string; name?: string | undefined; cacheControl?: { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; } | undefined; }>, z.ZodObject<{ role: z.ZodLiteral<"agent">; content: z.ZodOptional; toolCalls: z.ZodOptional; function: z.ZodObject<{ name: z.ZodString; arguments: z.ZodRecord; }, "strip", z.ZodTypeAny, { name: string; arguments: Record; }, { name: string; arguments: Record; }>; }, "strip", z.ZodTypeAny, { function: { name: string; arguments: Record; }; type: "function"; id: string; }, { function: { name: string; arguments: Record; }; type: "function"; id: string; }>, "many">>; name: z.ZodOptional; cacheControl: z.ZodOptional; ttl: z.ZodOptional, z.ZodLiteral<"1h">]>>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; }, { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; }>>; }, "strip", z.ZodTypeAny, { role: "agent"; name?: string | undefined; content?: string | undefined; cacheControl?: { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; } | undefined; toolCalls?: { function: { name: string; arguments: Record; }; type: "function"; id: string; }[] | undefined; }, { role: "agent"; name?: string | undefined; content?: string | undefined; cacheControl?: { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; } | undefined; toolCalls?: { function: { name: string; arguments: Record; }; type: "function"; id: string; }[] | undefined; }>, z.ZodObject<{ role: z.ZodLiteral<"tool">; content: z.ZodEffects]>, string, string | Record>; toolCallId: z.ZodString; name: z.ZodOptional; cacheControl: z.ZodOptional; ttl: z.ZodOptional, z.ZodLiteral<"1h">]>>; }, "strip", z.ZodTypeAny, { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; }, { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; }>>; }, "strip", z.ZodTypeAny, { role: "tool"; content: string; toolCallId: string; name?: string | undefined; cacheControl?: { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; } | undefined; }, { role: "tool"; content: string | Record; toolCallId: string; name?: string | undefined; cacheControl?: { type: "ephemeral"; ttl?: "5m" | "1h" | undefined; } | undefined; }>]>; export declare function safeParseChatMessages(messages: unknown): ChatMessageTemplate[] | undefined; export declare function parseChatMessages(messages: (z.infer & { options?: FormatOptions; })[]): ChatMessageTemplate[]; export {};