/** * Store pattern for capturing structured LLM output via tool calls * * A store looks like a tool to the LLM. The LLM "stores" a value by calling * this tool with structured arguments matching the schema. After execution, * store.get() returns the fully-typed result. * * @example * ```typescript * const changeLog = store(changelogSchema); * await prompt`... Save the result in ${changeLog}.`(); * const result = changeLog.get(); // fully typed * ``` */ import type { ZodType } from 'zod'; import { TOOL_SYMBOL, type ToolMetadata, type SimpleSchema, type ResolvedSchema } from './types.js'; /** * Symbol marking the return sentinel object */ export declare const RETURN_SYMBOL: unique symbol; /** * Sentinel value used in template literals to mark where structured output should be captured. * When `prompt.return` appears in a template AND a schema is passed, the executor * creates a store tool at that position and stops as soon as it's filled. */ export declare const RETURN_SENTINEL: { readonly [RETURN_SYMBOL]: true; }; /** * A store is a callable (tool) that also exposes .get() for retrieval */ export interface Store { (...args: any[]): string; [TOOL_SYMBOL]: ToolMetadata; get(): T | undefined; } /** Reset store counter (useful for testing) */ export declare function resetStoreCounter(): void; /** * Infer the output type from a SimpleSchema */ type SimpleSchemaOutput = { [K in keyof T as K extends `${infer Base}?` ? Base : K]: string; }; /** * Create a store from a name and resolved schema (shared logic for store() and factory return stores) */ export declare function createStore(name: string, schema: ResolvedSchema): Store; /** * Create a typed store that captures structured LLM output * * @param schema - Zod schema or SimpleSchema describing the expected structure * @returns A Store that acts as a tool and provides .get() for retrieval */ export declare function store(schema: ZodType): Store; export declare function store(schema: T): Store>; export {}; //# sourceMappingURL=store.d.ts.map