{"version":3,"file":"runtime.d.ts","names":["InteropZodOptional","InteropZodDefault","Runtime","LangGraphRuntime","PregelOptions","BaseMessage","ResponseFormatUndefined","AgentBuiltInState","Record","IsOptionalZodObject","T","IsDefaultZodObject","WithMaybeContext","TContext","Omit","Partial","PrivateState","RunLevelPrivateState","ThreadLevelPrivateState","InternalAgentState","StructuredResponseType","IsOptionalType","ExtractNonUndefined","IsAllOptional","CreateAgentPregelOptions","InvokeConfiguration","ContextSchema","Pick","StreamConfiguration"],"sources":["../../src/agents/runtime.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { InteropZodOptional } from \"@langchain/core/utils/types\";\nimport type { InteropZodDefault } from \"@langchain/core/utils/types\";\nimport type { Runtime as LangGraphRuntime, PregelOptions } from \"@langchain/langgraph\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { ResponseFormatUndefined } from \"./responses.js\";\n/**\n * Type for the agent's built-in state properties.\n */\nexport type AgentBuiltInState = {\n    /**\n     * Array of messages representing the conversation history.\n     *\n     * This includes all messages exchanged during the agent's execution:\n     * - Human messages: Input from the user\n     * - AI messages: Responses from the language model\n     * - Tool messages: Results from tool executions\n     * - System messages: System-level instructions or information\n     *\n     * Messages are accumulated throughout the agent's lifecycle and can be\n     * accessed or modified by middleware hooks during execution.\n     */\n    messages: BaseMessage[];\n    /**\n     * Structured response data returned by the agent when a `responseFormat` is configured.\n     *\n     * This property is only populated when you provide a `responseFormat` schema\n     * (as Zod or JSON schema) to the agent configuration. The agent will format\n     * its final output to match the specified schema and store it in this property.\n     *\n     * Note: The type is specified as `Record<string, unknown>` because TypeScript cannot\n     * infer the actual response format type in contexts like middleware, where the agent's\n     * generic type parameters are not accessible. You may need to cast this to your specific\n     * response type when accessing it.\n     */\n    structuredResponse?: Record<string, unknown>;\n};\n/**\n * Type helper to check if TContext is an optional Zod schema\n */\ntype IsOptionalZodObject<T> = T extends InteropZodOptional<any> ? true : false;\ntype IsDefaultZodObject<T> = T extends InteropZodDefault<any> ? true : false;\nexport type WithMaybeContext<TContext> = undefined extends TContext ? {\n    readonly context?: TContext;\n} : IsOptionalZodObject<TContext> extends true ? {\n    readonly context?: TContext;\n} : IsDefaultZodObject<TContext> extends true ? {\n    readonly context?: TContext;\n} : {\n    readonly context: TContext;\n};\n/**\n * Runtime information available to middleware (readonly).\n */\nexport type Runtime<TContext = unknown> = Partial<Omit<LangGraphRuntime<TContext>, \"context\" | \"configurable\">> & WithMaybeContext<TContext> & PrivateState & {\n    configurable?: {\n        thread_id?: string;\n        [key: string]: unknown;\n    };\n};\nexport interface RunLevelPrivateState {\n    /**\n     * The number of times the model has been called at the run level.\n     * This includes multiple agent invocations.\n     */\n    runModelCallCount: number;\n}\nexport interface ThreadLevelPrivateState {\n    /**\n     * The number of times the model has been called at the thread level.\n     * This includes multiple agent invocations within different environments\n     * using the same thread.\n     */\n    threadLevelCallCount: number;\n}\n/**\n * As private state we consider all information we want to track within\n * the lifecycle of the agent, without exposing it to the user. These informations\n * are propagated to the user as _readonly_ runtime properties.\n */\nexport interface PrivateState extends ThreadLevelPrivateState, RunLevelPrivateState {\n}\nexport type InternalAgentState<StructuredResponseType extends Record<string, unknown> | undefined = Record<string, unknown>> = {\n    messages: BaseMessage[];\n    _privateState?: PrivateState;\n} & (StructuredResponseType extends ResponseFormatUndefined ? Record<string, never> : {\n    structuredResponse: StructuredResponseType;\n});\n/**\n * Helper type to check if a type is optional (includes undefined)\n */\ntype IsOptionalType<T> = undefined extends T ? true : false;\n/**\n * Extract non-undefined part of a union that includes undefined\n */\ntype ExtractNonUndefined<T> = T extends undefined ? never : T;\n/**\n * Helper type to check if all properties of a type are optional\n */\nexport type IsAllOptional<T> = \n// If T includes undefined, then it's optional (can be omitted entirely)\nundefined extends T ? true : IsOptionalType<T> extends true ? true : ExtractNonUndefined<T> extends Record<string, any> ? {} extends ExtractNonUndefined<T> ? true : false : IsOptionalType<T>;\n/**\n * Pregel options that are propagated to the agent\n */\ntype CreateAgentPregelOptions = \"configurable\" | \"durability\" | \"store\" | \"cache\" | \"signal\" | \"recursionLimit\" | \"maxConcurrency\" | \"timeout\";\n/**\n * Decide whether provided configuration requires a context\n */\nexport type InvokeConfiguration<ContextSchema extends Record<string, any>> = \n/**\n * If the context schema is a default object, `context` can be optional\n */\nContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n    context?: Partial<ContextSchema>;\n} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n    context?: Partial<ContextSchema>;\n} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;\nexport type StreamConfiguration<ContextSchema extends Record<string, any>> = \n/**\n * If the context schema is a default object, `context` can be optional\n */\nContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n    context?: Partial<ContextSchema>;\n} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | \"streamMode\">> & {\n    context?: Partial<ContextSchema>;\n} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | \"streamMode\">> & WithMaybeContext<ContextSchema>;\nexport {};\n"],"mappings":";;;;;;;;;AAmC+B,KA1BnBO,iBAAAA,GA0BmB;EAK1BE;;;;AAAqD;AAAA;;;;AACF;AACxD;;EAA4B,QAA+BI,EApB7CR,WAoB6CQ,EAAAA;EAAQ;;;;;;;;AAOrC;AAK9B;;;EAAgF,kBAAzBV,CAAAA,EAnB9BK,MAmB8BL,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;CAAgB;;;;KAdlEM,mBAc0IO,CAAAA,CAAAA,CAAAA,GAdjHN,CAciHM,SAdvGhB,kBAcuGgB,CAAAA,GAAAA,CAAAA,GAAAA,IAAAA,GAAAA,KAAAA;AAAY,KAbtJL,kBAasJ,CAAA,CAAA,CAAA,G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