langchain
Version:
Typescript bindings for langchain
1 lines • 9.81 kB
Source Map (JSON)
{"version":3,"file":"runtime.d.cts","names":["InteropZodOptional","InteropZodDefault","Runtime","LangGraphRuntime","PregelOptions","StreamMode","BaseMessage","BaseCallbackConfig","ResponseFormatUndefined","AgentBuiltInState","Record","IsOptionalZodObject","T","IsDefaultZodObject","WithMaybeContext","TContext","Omit","Partial","InternalAgentState","StructuredResponseType","IsOptionalType","ExtractNonUndefined","IsAllOptional","CreateAgentPregelOptions","CreateAgentPregelStreamOptions","InvokeConfiguration","ContextSchema","Pick","StreamConfiguration","TStreamMode","TEncoding"],"sources":["../../src/agents/runtime.d.ts"],"sourcesContent":["import type { InteropZodOptional } from \"@langchain/core/utils/types\";\nimport type { InteropZodDefault } from \"@langchain/core/utils/types\";\nimport type { Runtime as LangGraphRuntime, PregelOptions, StreamMode } from \"@langchain/langgraph\";\nimport type { BaseMessage } from \"@langchain/core/messages\";\nimport type { BaseCallbackConfig } from \"@langchain/core/callbacks/manager\";\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> & {\n configurable?: {\n thread_id?: string;\n [key: string]: unknown;\n };\n};\nexport type InternalAgentState<StructuredResponseType extends Record<string, unknown> | undefined = Record<string, unknown>> = {\n messages: BaseMessage[];\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> = undefined 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\" | \"callbacks\";\n/**\n * Pregel stream options that are propagated to the agent\n */\ntype CreateAgentPregelStreamOptions = \"encoding\" | \"streamMode\";\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> ? BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : IsAllOptional<ContextSchema> extends true ? BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;\nexport type StreamConfiguration<ContextSchema extends Record<string, any>, TStreamMode extends StreamMode | StreamMode[] | undefined, TEncoding extends \"text/event-stream\" | undefined> = \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, TStreamMode, boolean, TEncoding>, CreateAgentPregelOptions>> & {\n context?: Partial<ContextSchema>;\n} : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any, TStreamMode, boolean, TEncoding>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & {\n context?: Partial<ContextSchema>;\n} : Partial<Pick<PregelOptions<any, any, any, TStreamMode, boolean, TEncoding>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & WithMaybeContext<ContextSchema>;\nexport {};\n//# sourceMappingURL=runtime.d.ts.map"],"mappings":";;;;;;;AASA;AA2BE;AAIwD;AAE9Cc,KAjCAL,iBAAAA,GAiCgBM;EAA+BA;;;;;;;;;AAO7B;AAK9B;;EAAuDZ,QAAAA,EAhCzCG,WAgCyCH,EAAAA;EAALa;;;;AAAgF;AAU/H;AAIyC;AAQ5C;;;;;EAAoGK,kBAAAA,CAAAA,EAzC3EX,MAyC2EW,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;CAA+BX;;;;KApC9HC,mBAoCuMS,CAAAA,CAAAA,CAAAA,GApC9KR,CAoC8KQ,SApCpKpB,kBAoCoKoB,CAAAA,GAAAA,CAAAA,GAAAA,IAAAA,GAAAA,KAAAA;AAAc,KAnCrNP,kBAmCqN,CAAA,CAAA,CAAA,GAnC7LD,CAmC6L,SAnCnLX,iBAmCmL,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