langchain 1.0.4 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (108) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/agents/ReactAgent.cjs +56 -54
  3. package/dist/agents/ReactAgent.cjs.map +1 -1
  4. package/dist/agents/ReactAgent.d.cts +3 -3
  5. package/dist/agents/ReactAgent.d.cts.map +1 -1
  6. package/dist/agents/ReactAgent.d.ts +3 -3
  7. package/dist/agents/ReactAgent.d.ts.map +1 -1
  8. package/dist/agents/ReactAgent.js +58 -56
  9. package/dist/agents/ReactAgent.js.map +1 -1
  10. package/dist/agents/middleware/contextEditing.cjs +302 -33
  11. package/dist/agents/middleware/contextEditing.cjs.map +1 -1
  12. package/dist/agents/middleware/contextEditing.d.cts +125 -41
  13. package/dist/agents/middleware/contextEditing.d.cts.map +1 -1
  14. package/dist/agents/middleware/contextEditing.d.ts +125 -41
  15. package/dist/agents/middleware/contextEditing.d.ts.map +1 -1
  16. package/dist/agents/middleware/contextEditing.js +302 -33
  17. package/dist/agents/middleware/contextEditing.js.map +1 -1
  18. package/dist/agents/middleware/dynamicSystemPrompt.d.cts.map +1 -1
  19. package/dist/agents/middleware/dynamicSystemPrompt.d.ts.map +1 -1
  20. package/dist/agents/middleware/hitl.d.cts.map +1 -1
  21. package/dist/agents/middleware/hitl.d.ts.map +1 -1
  22. package/dist/agents/middleware/index.cjs +2 -0
  23. package/dist/agents/middleware/index.js +2 -0
  24. package/dist/agents/middleware/llmToolSelector.d.cts +4 -4
  25. package/dist/agents/middleware/llmToolSelector.d.cts.map +1 -1
  26. package/dist/agents/middleware/modelCallLimit.cjs +6 -2
  27. package/dist/agents/middleware/modelCallLimit.cjs.map +1 -1
  28. package/dist/agents/middleware/modelCallLimit.d.cts +8 -8
  29. package/dist/agents/middleware/modelCallLimit.d.cts.map +1 -1
  30. package/dist/agents/middleware/modelCallLimit.d.ts +8 -8
  31. package/dist/agents/middleware/modelCallLimit.d.ts.map +1 -1
  32. package/dist/agents/middleware/modelCallLimit.js +6 -2
  33. package/dist/agents/middleware/modelCallLimit.js.map +1 -1
  34. package/dist/agents/middleware/modelFallback.cjs +2 -2
  35. package/dist/agents/middleware/modelFallback.cjs.map +1 -1
  36. package/dist/agents/middleware/modelFallback.d.cts +2 -2
  37. package/dist/agents/middleware/modelFallback.d.cts.map +1 -1
  38. package/dist/agents/middleware/modelFallback.d.ts +2 -2
  39. package/dist/agents/middleware/modelFallback.d.ts.map +1 -1
  40. package/dist/agents/middleware/modelFallback.js +2 -2
  41. package/dist/agents/middleware/modelFallback.js.map +1 -1
  42. package/dist/agents/middleware/pii.cjs +445 -0
  43. package/dist/agents/middleware/pii.cjs.map +1 -0
  44. package/dist/agents/middleware/pii.d.cts +216 -0
  45. package/dist/agents/middleware/pii.d.cts.map +1 -0
  46. package/dist/agents/middleware/pii.d.ts +216 -0
  47. package/dist/agents/middleware/pii.d.ts.map +1 -0
  48. package/dist/agents/middleware/pii.js +436 -0
  49. package/dist/agents/middleware/pii.js.map +1 -0
  50. package/dist/agents/middleware/piiRedaction.cjs +2 -1
  51. package/dist/agents/middleware/piiRedaction.cjs.map +1 -1
  52. package/dist/agents/middleware/piiRedaction.d.cts +4 -1
  53. package/dist/agents/middleware/piiRedaction.d.cts.map +1 -1
  54. package/dist/agents/middleware/piiRedaction.d.ts +4 -1
  55. package/dist/agents/middleware/piiRedaction.d.ts.map +1 -1
  56. package/dist/agents/middleware/piiRedaction.js +2 -1
  57. package/dist/agents/middleware/piiRedaction.js.map +1 -1
  58. package/dist/agents/middleware/promptCaching.d.cts.map +1 -1
  59. package/dist/agents/middleware/promptCaching.d.ts.map +1 -1
  60. package/dist/agents/middleware/summarization.cjs +15 -24
  61. package/dist/agents/middleware/summarization.cjs.map +1 -1
  62. package/dist/agents/middleware/summarization.d.cts +72 -9
  63. package/dist/agents/middleware/summarization.d.cts.map +1 -1
  64. package/dist/agents/middleware/summarization.d.ts +65 -2
  65. package/dist/agents/middleware/summarization.d.ts.map +1 -1
  66. package/dist/agents/middleware/summarization.js +13 -25
  67. package/dist/agents/middleware/summarization.js.map +1 -1
  68. package/dist/agents/middleware/todoListMiddleware.d.cts.map +1 -1
  69. package/dist/agents/middleware/todoListMiddleware.d.ts.map +1 -1
  70. package/dist/agents/middleware/toolCallLimit.d.cts.map +1 -1
  71. package/dist/agents/middleware/toolCallLimit.d.ts.map +1 -1
  72. package/dist/agents/middleware/toolEmulator.cjs +118 -0
  73. package/dist/agents/middleware/toolEmulator.cjs.map +1 -0
  74. package/dist/agents/middleware/toolEmulator.d.cts +76 -0
  75. package/dist/agents/middleware/toolEmulator.d.cts.map +1 -0
  76. package/dist/agents/middleware/toolEmulator.d.ts +76 -0
  77. package/dist/agents/middleware/toolEmulator.d.ts.map +1 -0
  78. package/dist/agents/middleware/toolEmulator.js +117 -0
  79. package/dist/agents/middleware/toolEmulator.js.map +1 -0
  80. package/dist/agents/middleware/utils.cjs +4 -0
  81. package/dist/agents/middleware/utils.cjs.map +1 -1
  82. package/dist/agents/middleware/utils.d.cts.map +1 -1
  83. package/dist/agents/middleware/utils.d.ts.map +1 -1
  84. package/dist/agents/middleware/utils.js +4 -0
  85. package/dist/agents/middleware/utils.js.map +1 -1
  86. package/dist/agents/nodes/AgentNode.cjs +23 -7
  87. package/dist/agents/nodes/AgentNode.cjs.map +1 -1
  88. package/dist/agents/nodes/AgentNode.js +23 -8
  89. package/dist/agents/nodes/AgentNode.js.map +1 -1
  90. package/dist/agents/nodes/ToolNode.cjs +5 -0
  91. package/dist/agents/nodes/ToolNode.cjs.map +1 -1
  92. package/dist/agents/nodes/ToolNode.js +5 -1
  93. package/dist/agents/nodes/ToolNode.js.map +1 -1
  94. package/dist/agents/responses.cjs.map +1 -1
  95. package/dist/agents/responses.d.cts +2 -0
  96. package/dist/agents/responses.d.cts.map +1 -1
  97. package/dist/agents/responses.d.ts +2 -0
  98. package/dist/agents/responses.d.ts.map +1 -1
  99. package/dist/agents/responses.js.map +1 -1
  100. package/dist/agents/runtime.d.cts +5 -5
  101. package/dist/agents/runtime.d.cts.map +1 -1
  102. package/dist/agents/runtime.d.ts +5 -5
  103. package/dist/agents/runtime.d.ts.map +1 -1
  104. package/dist/index.cjs +22 -0
  105. package/dist/index.d.cts +5 -3
  106. package/dist/index.d.ts +5 -3
  107. package/dist/index.js +13 -1
  108. package/package.json +9 -8
@@ -1 +1 @@
1
- {"version":3,"file":"responses.d.ts","names":["InteropZodObject","InteropZodType","AIMessage","LanguageModelLike","FunctionDefinition","StructuredOutputParsingError","MultipleStructuredOutputsError","ResponseFormatUndefined","ToolStrategy","Record","ToolStrategyOptions","S","U","ProviderStrategy","T","ResponseFormat","transformResponseFormat","JsonSchemaFormat","TypedToolStrategy","Array","ToolStrategyError","Promise","toolStrategy","K","providerStrategy","hasSupportForJsonSchemaOutput"],"sources":["../../src/agents/responses.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-instanceof/no-instanceof */\nimport { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport { type AIMessage } from \"@langchain/core/messages\";\nimport { type LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { type FunctionDefinition } from \"@langchain/core/language_models/base\";\nimport { StructuredOutputParsingError, MultipleStructuredOutputsError } from \"./errors.js\";\n/**\n * Special type to indicate that no response format is provided.\n * When this type is used, the structuredResponse property should not be present in the result.\n */\nexport type ResponseFormatUndefined = {\n __responseFormatUndefined: true;\n};\n/**\n * Information for tracking structured output tool metadata.\n * This contains all necessary information to handle structured responses generated\n * via tool calls, including the original schema, its type classification, and the\n * corresponding tool implementation used by the tools strategy.\n */\nexport declare class ToolStrategy<_T = unknown> {\n readonly schema: Record<string, unknown>;\n readonly tool: {\n type: \"function\";\n function: FunctionDefinition;\n };\n readonly options?: ToolStrategyOptions | undefined;\n private constructor();\n get name(): string;\n static fromSchema<S extends InteropZodObject>(schema: S, outputOptions?: ToolStrategyOptions): ToolStrategy<S extends InteropZodType<infer U> ? U : unknown>;\n static fromSchema(schema: Record<string, unknown>, outputOptions?: ToolStrategyOptions): ToolStrategy<Record<string, unknown>>;\n /**\n * Parse tool arguments according to the schema.\n *\n * @throws {StructuredOutputParsingError} if the response is not valid\n * @param toolArgs - The arguments from the tool call\n * @returns The parsed response according to the schema type\n */\n parse(toolArgs: Record<string, unknown>): Record<string, unknown>;\n}\nexport declare class ProviderStrategy<T = unknown> {\n readonly schema: Record<string, unknown>;\n // @ts-expect-error - _schemaType is used only for type inference\n private _schemaType?;\n private constructor();\n static fromSchema<T>(schema: InteropZodType<T>): ProviderStrategy<T>;\n static fromSchema(schema: Record<string, unknown>): ProviderStrategy<Record<string, unknown>>;\n /**\n * Parse tool arguments according to the schema. If the response is not valid, return undefined.\n *\n * @param toolArgs - The arguments from the tool call\n * @returns The parsed response according to the schema type\n */\n parse(response: AIMessage): any;\n}\nexport type ResponseFormat = ToolStrategy<any> | ProviderStrategy<any>;\n/**\n * Handle user input for `responseFormat` parameter of `CreateAgentParams`.\n * This function defines the default behavior for the `responseFormat` parameter, which is:\n *\n * - if value is a Zod schema, default to structured output via tool calling\n * - if value is a JSON schema, default to structured output via tool calling\n * - if value is a custom response format, return it as is\n * - if value is an array, ensure all array elements are instance of `ToolStrategy`\n * @param responseFormat - The response format to transform, provided by the user\n * @param options - The response format options for tool strategy\n * @param model - The model to check if it supports JSON schema output\n * @returns\n */\nexport declare function transformResponseFormat(responseFormat?: InteropZodType<any> | InteropZodType<any>[] | JsonSchemaFormat | JsonSchemaFormat[] | ResponseFormat | ToolStrategy<any>[] | ResponseFormatUndefined, options?: ToolStrategyOptions, model?: LanguageModelLike | string): ResponseFormat[];\n/**\n * Branded type for ToolStrategy arrays that preserves type information\n */\nexport interface TypedToolStrategy<T = unknown> extends Array<ToolStrategy<any>> {\n _schemaType?: T;\n}\nexport type ToolStrategyError = StructuredOutputParsingError | MultipleStructuredOutputsError;\nexport interface ToolStrategyOptions {\n /**\n * Allows you to customize the message that appears in the conversation history when structured\n * output is generated.\n */\n toolMessageContent?: string;\n /**\n * Handle errors from the structured output tool call. Using tools to generate structured output\n * can cause errors, e.g. if:\n * - you provide multiple structured output schemas and the model calls multiple structured output tools\n * - if the structured output generated by the tool call doesn't match provided schema\n *\n * This property allows to handle these errors in different ways:\n * - `true` - retry the tool call\n * - `false` - throw an error\n * - `string` - retry the tool call with the provided message\n * - `(error: ToolStrategyError) => Promise<string> | string` - retry with the provided message or throw the error\n */\n handleError?: boolean | string | ((error: ToolStrategyError) => Promise<string> | string);\n}\nexport declare function toolStrategy<T extends InteropZodType<any>>(responseFormat: T, options?: ToolStrategyOptions): TypedToolStrategy<T extends InteropZodType<infer U> ? U : never>;\nexport declare function toolStrategy<T extends readonly InteropZodType<any>[]>(responseFormat: T, options?: ToolStrategyOptions): TypedToolStrategy<{\n [K in keyof T]: T[K] extends InteropZodType<infer U> ? U : never;\n}[number]>;\nexport declare function toolStrategy(responseFormat: JsonSchemaFormat, options?: ToolStrategyOptions): TypedToolStrategy<Record<string, unknown>>;\nexport declare function toolStrategy(responseFormat: JsonSchemaFormat[], options?: ToolStrategyOptions): TypedToolStrategy<Record<string, unknown>>;\nexport declare function providerStrategy<T extends InteropZodType<any>>(responseFormat: T): ProviderStrategy<T extends InteropZodType<infer U> ? U : never>;\nexport declare function providerStrategy(responseFormat: JsonSchemaFormat): ProviderStrategy<Record<string, unknown>>;\n/**\n * Type representing a JSON Schema object format.\n * This is a strict type that excludes ToolStrategy and ProviderStrategy instances.\n */\nexport type JsonSchemaFormat = {\n type: \"null\" | \"boolean\" | \"object\" | \"array\" | \"number\" | \"string\" | \"integer\";\n properties?: Record<string, unknown>;\n required?: string[];\n additionalProperties?: boolean;\n [key: string]: unknown;\n} & {\n // Brand to ensure this is not a ToolStrategy or ProviderStrategy\n __brand?: never;\n};\n/**\n * Identifies the models that support JSON schema output\n * @param model - The model to check\n * @returns True if the model supports JSON schema output, false otherwise\n */\nexport declare function hasS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D,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA;;;;;AAAoD,KAKhFQ,gBAAAA,GALgF;EAKhFA,IAAAA,EAAAA,MAAAA,GAAAA,SAAgB,GAAA,QAEXR,GAAM,OAAA,GAAA,QAAA,GAAA,QAAA,GAAA,SAAA;eAANA"}
1
+ {"version":3,"file":"responses.d.ts","names":["InteropZodObject","InteropZodType","AIMessage","LanguageModelLike","FunctionDefinition","StructuredOutputParsingError","MultipleStructuredOutputsError","ResponseFormatUndefined","ToolStrategy","Record","ToolStrategyOptions","S","U","ProviderStrategy","T","ResponseFormat","transformResponseFormat","JsonSchemaFormat","TypedToolStrategy","Array","ToolStrategyError","Promise","toolStrategy","K","providerStrategy","hasSupportForJsonSchemaOutput"],"sources":["../../src/agents/responses.d.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-instanceof/no-instanceof */\nimport { InteropZodObject, InteropZodType } from \"@langchain/core/utils/types\";\nimport { type AIMessage } from \"@langchain/core/messages\";\nimport { type LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { type FunctionDefinition } from \"@langchain/core/language_models/base\";\nimport { StructuredOutputParsingError, MultipleStructuredOutputsError } from \"./errors.js\";\n/**\n * Special type to indicate that no response format is provided.\n * When this type is used, the structuredResponse property should not be present in the result.\n */\nexport type ResponseFormatUndefined = {\n __responseFormatUndefined: true;\n};\n/**\n * Information for tracking structured output tool metadata.\n * This contains all necessary information to handle structured responses generated\n * via tool calls, including the original schema, its type classification, and the\n * corresponding tool implementation used by the tools strategy.\n */\nexport declare class ToolStrategy<_T = unknown> {\n readonly schema: Record<string, unknown>;\n readonly tool: {\n type: \"function\";\n function: FunctionDefinition;\n };\n readonly options?: ToolStrategyOptions | undefined;\n private constructor();\n get name(): string;\n static fromSchema<S extends InteropZodObject>(schema: S, outputOptions?: ToolStrategyOptions): ToolStrategy<S extends InteropZodType<infer U> ? U : unknown>;\n static fromSchema(schema: Record<string, unknown>, outputOptions?: ToolStrategyOptions): ToolStrategy<Record<string, unknown>>;\n /**\n * Parse tool arguments according to the schema.\n *\n * @throws {StructuredOutputParsingError} if the response is not valid\n * @param toolArgs - The arguments from the tool call\n * @returns The parsed response according to the schema type\n */\n parse(toolArgs: Record<string, unknown>): Record<string, unknown>;\n}\nexport declare class ProviderStrategy<T = unknown> {\n readonly schema: Record<string, unknown>;\n // @ts-expect-error - _schemaType is used only for type inference\n private _schemaType?;\n private constructor();\n static fromSchema<T>(schema: InteropZodType<T>): ProviderStrategy<T>;\n static fromSchema(schema: Record<string, unknown>): ProviderStrategy<Record<string, unknown>>;\n /**\n * Parse tool arguments according to the schema. If the response is not valid, return undefined.\n *\n * @param toolArgs - The arguments from the tool call\n * @returns The parsed response according to the schema type\n */\n parse(response: AIMessage): any;\n}\nexport type ResponseFormat = ToolStrategy<any> | ProviderStrategy<any>;\n/**\n * Handle user input for `responseFormat` parameter of `CreateAgentParams`.\n * This function defines the default behavior for the `responseFormat` parameter, which is:\n *\n * - if value is a Zod schema, default to structured output via tool calling\n * - if value is a JSON schema, default to structured output via tool calling\n * - if value is a custom response format, return it as is\n * - if value is an array, ensure all array elements are instance of `ToolStrategy`\n * @param responseFormat - The response format to transform, provided by the user\n * @param options - The response format options for tool strategy\n * @param model - The model to check if it supports JSON schema output\n * @returns\n */\nexport declare function transformResponseFormat(responseFormat?: InteropZodType<any> | InteropZodType<any>[] | JsonSchemaFormat | JsonSchemaFormat[] | ResponseFormat | ToolStrategy<any>[] | ResponseFormatUndefined, options?: ToolStrategyOptions, model?: LanguageModelLike | string): ResponseFormat[];\n/**\n * Branded type for ToolStrategy arrays that preserves type information\n */\nexport interface TypedToolStrategy<T = unknown> extends Array<ToolStrategy<any>> {\n _schemaType?: T;\n}\nexport type ToolStrategyError = StructuredOutputParsingError | MultipleStructuredOutputsError;\nexport interface ToolStrategyOptions {\n /**\n * Allows you to customize the message that appears in the conversation history when structured\n * output is generated.\n */\n toolMessageContent?: string;\n /**\n * Handle errors from the structured output tool call. Using tools to generate structured output\n * can cause errors, e.g. if:\n * - you provide multiple structured output schemas and the model calls multiple structured output tools\n * - if the structured output generated by the tool call doesn't match provided schema\n *\n * This property allows to handle these errors in different ways:\n * - `true` - retry the tool call\n * - `false` - throw an error\n * - `string` - retry the tool call with the provided message\n * - `(error: ToolStrategyError) => Promise<string> | string` - retry with the provided message or throw the error\n *\n * @default true\n */\n handleError?: boolean | string | ((error: ToolStrategyError) => Promise<string> | string);\n}\nexport declare function toolStrategy<T extends InteropZodType<any>>(responseFormat: T, options?: ToolStrategyOptions): TypedToolStrategy<T extends InteropZodType<infer U> ? U : never>;\nexport declare function toolStrategy<T extends readonly InteropZodType<any>[]>(responseFormat: T, options?: ToolStrategyOptions): TypedToolStrategy<{\n [K in keyof T]: T[K] extends InteropZodType<infer U> ? U : never;\n}[number]>;\nexport declare function toolStrategy(responseFormat: JsonSchemaFormat, options?: ToolStrategyOptions): TypedToolStrategy<Record<string, unknown>>;\nexport declare function toolStrategy(responseFormat: JsonSchemaFormat[], options?: ToolStrategyOptions): TypedToolStrategy<Record<string, unknown>>;\nexport declare function providerStrategy<T extends InteropZodType<any>>(responseFormat: T): ProviderStrategy<T extends InteropZodType<infer U> ? U : never>;\nexport declare function providerStrategy(responseFormat: JsonSchemaFormat): ProviderStrategy<Record<string, unknown>>;\n/**\n * Type representing a JSON Schema object format.\n * This is a strict type that excludes ToolStrategy and ProviderStrategy instances.\n */\nexport type JsonSchemaFormat = {\n type: \"null\" | \"boolean\" | \"object\" | \"array\" | \"number\" | \"string\" | \"integer\";\n properties?: Record<string, unknown>;\n required?: string[];\n additionalProperties?: boolean;\n [key: string]: unknown;\n} & {\n // Brand to ensure this is not a ToolStrategy or ProviderStrategy\n __brand?: never;\n};\n/**\n * Identifies the models that support JSON schema output\n * @param model - The model to check\n * @returns True if the model supports JSON schema output, false otherwise\n */\nexport declare function hasSupportForJsonSchemaOutput(model?: LanguageModelLike | string): boolean;\n"],"mappings":";;;;;;;AAoBA;;;;AA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AEKR"}
@@ -1 +1 @@
1
- {"version":3,"file":"responses.js","names":["schema: Record<string, unknown>","tool: {\n type: \"function\";\n function: FunctionDefinition;\n }","options?: ToolStrategyOptions","schema: InteropZodObject | Record<string, unknown>","outputOptions?: ToolStrategyOptions","name?: string","asJsonSchema","tool","functionDefinition: FunctionDefinition","toolArgs: Record<string, unknown>","schema: InteropZodType<T> | Record<string, unknown>","response: AIMessage","responseFormat?:\n | InteropZodType<any>\n | InteropZodType<any>[]\n | JsonSchemaFormat\n | JsonSchemaFormat[]\n | ResponseFormat\n | ToolStrategy<any>[]\n | ResponseFormatUndefined","model?: LanguageModelLike | string","responseFormat:\n | InteropZodType<any>\n | InteropZodType<any>[]\n | JsonSchemaFormat\n | JsonSchemaFormat[]","responseFormat: InteropZodType<any> | JsonSchemaFormat"],"sources":["../../src/agents/responses.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-instanceof/no-instanceof */\nimport {\n InteropZodObject,\n isInteropZodSchema,\n InteropZodType,\n isInteropZodObject,\n} from \"@langchain/core/utils/types\";\nimport { type AIMessage } from \"@langchain/core/messages\";\nimport { type LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { toJsonSchema, Validator } from \"@langchain/core/utils/json_schema\";\nimport { type FunctionDefinition } from \"@langchain/core/language_models/base\";\n\nimport {\n StructuredOutputParsingError,\n MultipleStructuredOutputsError,\n} from \"./errors.js\";\nimport { isConfigurableModel, isBaseChatModel } from \"./model.js\";\n\n/**\n * Special type to indicate that no response format is provided.\n * When this type is used, the structuredResponse property should not be present in the result.\n */\nexport type ResponseFormatUndefined = {\n __responseFormatUndefined: true;\n};\n\n/**\n * This is a global counter for generating unique names for tools.\n */\nlet bindingIdentifier = 0;\n\n/**\n * Information for tracking structured output tool metadata.\n * This contains all necessary information to handle structured responses generated\n * via tool calls, including the original schema, its type classification, and the\n * corresponding tool implementation used by the tools strategy.\n */\nexport class ToolStrategy<_T = unknown> {\n private constructor(\n /**\n * The original JSON Schema provided for structured output\n */\n public readonly schema: Record<string, unknown>,\n\n /**\n * The tool that will be used to parse the tool call arguments.\n */\n public readonly tool: {\n type: \"function\";\n function: FunctionDefinition;\n },\n\n /**\n * The options to use for the tool output.\n */\n public readonly options?: ToolStrategyOptions\n ) {}\n\n get name() {\n return this.tool.function.name;\n }\n\n static fromSchema<S extends InteropZodObject>(\n schema: S,\n outputOptions?: ToolStrategyOptions\n ): ToolStrategy<S extends InteropZodType<infer U> ? U : unknown>;\n\n static fromSchema(\n schema: Record<string, unknown>,\n outputOptions?: ToolStrategyOptions\n ): ToolStrategy<Record<string, unknown>>;\n\n static fromSchema(\n schema: InteropZodObject | Record<string, unknown>,\n outputOptions?: ToolStrategyOptions\n ): ToolStrategy<any> {\n /**\n * It is required for tools to have a name so we can map the tool call to the correct tool\n * when parsing the response.\n */\n function getFunctionName(name?: string) {\n return name ?? `extract-${++bindingIdentifier}`;\n }\n\n if (isInteropZodSchema(schema)) {\n const asJsonSchema = toJsonSchema(schema);\n const tool = {\n type: \"function\" as const,\n function: {\n name: getFunctionName(),\n strict: false,\n description:\n asJsonSchema.description ??\n \"Tool for extracting structured output from the model's response.\",\n parameters: asJsonSchema,\n },\n };\n return new ToolStrategy(asJsonSchema, tool, outputOptions);\n }\n\n let functionDefinition: FunctionDefinition;\n if (\n typeof schema.name === \"string\" &&\n typeof schema.parameters === \"object\" &&\n schema.parameters != null\n ) {\n functionDefinition = schema as unknown as FunctionDefinition;\n } else {\n functionDefinition = {\n name: getFunctionName(schema.title as string),\n description: (schema.description as string) ?? \"\",\n parameters: schema.schema || (schema as Record<string, unknown>),\n };\n }\n const asJsonSchema = toJsonSchema(schema);\n const tool = {\n type: \"function\" as const,\n function: functionDefinition,\n };\n return new ToolStrategy(asJsonSchema, tool, outputOptions);\n }\n\n /**\n * Parse tool arguments according to the schema.\n *\n * @throws {StructuredOutputParsingError} if the response is not valid\n * @param toolArgs - The arguments from the tool call\n * @returns The parsed response according to the schema type\n */\n parse(toolArgs: Record<string, unknown>): Record<string, unknown> {\n const validator = new Validator(this.schema);\n const result = validator.validate(toolArgs);\n if (!result.valid) {\n throw new StructuredOutputParsingError(\n this.name,\n result.errors.map((e) => e.error)\n );\n }\n return toolArgs;\n }\n}\n\nexport class ProviderStrategy<T = unknown> {\n // @ts-expect-error - _schemaType is used only for type inference\n private _schemaType?: T;\n\n private constructor(public readonly schema: Record<string, unknown>) {}\n\n static fromSchema<T>(schema: InteropZodType<T>): ProviderStrategy<T>;\n\n static fromSchema(\n schema: Record<string, unknown>\n ): ProviderStrategy<Record<string, unknown>>;\n\n static fromSchema<T = unknown>(\n schema: InteropZodType<T> | Record<string, unknown>\n ): ProviderStrategy<T> | ProviderStrategy<Record<string, unknown>> {\n const asJsonSchema = toJsonSchema(schema);\n return new ProviderStrategy(asJsonSchema) as\n | ProviderStrategy<T>\n | ProviderStrategy<Record<string, unknown>>;\n }\n\n /**\n * Parse tool arguments according to the schema. If the response is not valid, return undefined.\n *\n * @param toolArgs - The arguments from the tool call\n * @returns The parsed response according to the schema type\n */\n parse(response: AIMessage) {\n /**\n * return if the response doesn't contain valid content\n */\n if (typeof response.content !== \"string\" || response.content === \"\") {\n return;\n }\n\n try {\n const content = JSON.parse(response.content);\n const validator = new Validator(this.schema);\n const result = validator.validate(content);\n if (!result.valid) {\n return;\n }\n\n return content;\n } catch {\n // no-op\n }\n }\n}\n\nexport type ResponseFormat = ToolStrategy<any> | ProviderStrategy<any>;\n\n/**\n * Handle user input for `responseFormat` parameter of `CreateAgentParams`.\n * This function defines the default behavior for the `responseFormat` parameter, which is:\n *\n * - if value is a Zod schema, default to structured output via tool calling\n * - if value is a JSON schema, default to structured output via tool calling\n * - if value is a custom response format, return it as is\n * - if value is an array, ensure all array elements are instance of `ToolStrategy`\n * @param responseFormat - The response format to transform, provided by the user\n * @param options - The response format options for tool strategy\n * @param model - The model to check if it supports JSON schema output\n * @returns\n */\nexport function transformResponseFormat(\n responseFormat?:\n | InteropZodType<any>\n | InteropZodType<any>[]\n | JsonSchemaFormat\n | JsonSchemaFormat[]\n | ResponseFormat\n | ToolStrategy<any>[]\n | ResponseFormatUndefined,\n options?: ToolStrategyOptions,\n model?: LanguageModelLike | string\n): ResponseFormat[] {\n if (!responseFormat) {\n return [];\n }\n\n // Handle ResponseFormatUndefined case\n if (\n typeof responseFormat === \"object\" &&\n responseFormat !== null &&\n \"__responseFormatUndefined\" in responseFormat\n ) {\n return [];\n }\n\n /**\n * If users provide an array, it should only contain raw schemas (Zod or JSON schema),\n * not ToolStrategy or ProviderStrategy instances.\n */\n if (Array.isArray(responseFormat)) {\n /**\n * if every entry is a ToolStrategy or ProviderStrategy instance, return the array as is\n */\n if (\n responseFormat.every(\n (item) =>\n item instanceof ToolStrategy || item instanceof ProviderStrategy\n )\n ) {\n return responseFormat as unknown as ResponseFormat[];\n }\n\n /**\n * Check if all items are Zod schemas\n */\n if (responseFormat.every((item) => isInteropZodObject(item))) {\n return responseFormat.map((item) =>\n ToolStrategy.fromSchema(item as InteropZodObject, options)\n );\n }\n\n /**\n * Check if all items are plain objects (JSON schema)\n */\n if (\n responseFormat.every(\n (item) =>\n typeof item === \"object\" && item !== null && !isInteropZodObject(item)\n )\n ) {\n return responseFormat.map((item) =>\n ToolStrategy.fromSchema(item as JsonSchemaFormat, options)\n );\n }\n\n throw new Error(\n `Invalid response format: list contains mixed types.\\n` +\n `All items must be either InteropZodObject or plain JSON schema objects.`\n );\n }\n\n if (\n responseFormat instanceof ToolStrategy ||\n responseFormat instanceof ProviderStrategy\n ) {\n return [responseFormat];\n }\n\n const useProviderStrategy = hasSupportForJsonSchemaOutput(model);\n\n /**\n * `responseFormat` is a Zod schema\n */\n if (isInteropZodObject(responseFormat)) {\n return useProviderStrategy\n ? [ProviderStrategy.fromSchema(responseFormat)]\n : [ToolStrategy.fromSchema(responseFormat, options)];\n }\n\n /**\n * Handle plain object (JSON schema)\n */\n if (\n typeof responseFormat === \"object\" &&\n responseFormat !== null &&\n \"properties\" in responseFormat\n ) {\n return useProviderStrategy\n ? [ProviderStrategy.fromSchema(responseFormat as JsonSchemaFormat)]\n : [ToolStrategy.fromSchema(responseFormat as JsonSchemaFormat, options)];\n }\n\n throw new Error(`Invalid response format: ${String(responseFormat)}`);\n}\n\n/**\n * Branded type for ToolStrategy arrays that preserves type information\n */\nexport interface TypedToolStrategy<T = unknown>\n extends Array<ToolStrategy<any>> {\n _schemaType?: T;\n}\nexport type ToolStrategyError =\n | StructuredOutputParsingError\n | MultipleStructuredOutputsError;\nexport interface ToolStrategyOptions {\n /**\n * Allows you to customize the message that appears in the conversation history when structured\n * output is generated.\n */\n toolMessageContent?: string;\n /**\n * Handle errors from the structured output tool call. Using tools to generate structured output\n * can cause errors, e.g. if:\n * - you provide multiple structured output schemas and the model calls multiple structured output tools\n * - if the structured output generated by the tool call doesn't match provided schema\n *\n * This property allows to handle these errors in different ways:\n * - `true` - retry the tool call\n * - `false` - throw an error\n * - `string` - retry the tool call with the provided message\n * - `(error: ToolStrategyError) => Promise<string> | string` - retry with the provided message or throw the error\n */\n handleError?:\n | boolean\n | string\n | ((error: ToolStrategyError) => Promise<string> | string);\n}\n\nexport function toolStrategy<T extends InteropZodType<any>>(\n responseFormat: T,\n options?: ToolStrategyOptions\n): TypedToolStrategy<T extends InteropZodType<infer U> ? U : never>;\nexport function toolStrategy<T extends readonly InteropZodType<any>[]>(\n responseFormat: T,\n options?: ToolStrategyOptions\n): TypedToolStrategy<\n { [K in keyof T]: T[K] extends InteropZodType<infer U> ? U : never }[number]\n>;\nexport function toolStrategy(\n responseFormat: JsonSchemaFormat,\n options?: ToolStrategyOptions\n): TypedToolStrategy<Record<string, unknown>>;\nexport function toolStrategy(\n responseFormat: JsonSchemaFormat[],\n options?: ToolStrategyOptions\n): TypedToolStrategy<Record<string, unknown>>;\n\n/**\n * Define how to transform the response format from a tool call.\n *\n * @param responseFormat - The response format to transform\n * @param options - The options to use for the transformation\n * @param options.handleError - Whether to handle errors from the tool call\n * @returns The transformed response format\n */\nexport function toolStrategy(\n responseFormat:\n | InteropZodType<any>\n | InteropZodType<any>[]\n | JsonSchemaFormat\n | JsonSchemaFormat[],\n options?: ToolStrategyOptions\n): TypedToolStrategy {\n return transformResponseFormat(responseFormat, options) as TypedToolStrategy;\n}\n\nexport function providerStrategy<T extends InteropZodType<any>>(\n responseFormat: T\n): ProviderStrategy<T extends InteropZodType<infer U> ? U : never>;\nexport function providerStrategy(\n responseFormat: JsonSchemaFormat\n): ProviderStrategy<Record<string, unknown>>;\nexport function providerStrategy(\n responseFormat: InteropZodType<any> | JsonSchemaFormat\n): ProviderStrategy<any> {\n return ProviderStrategy.fromSchema(\n responseFormat as any\n ) as ProviderStrategy<any>;\n}\n\n/**\n * Type representing a JSON Schema object format.\n * This is a strict type that excludes ToolStrategy and ProviderStrategy instances.\n */\nexport type JsonSchemaFormat = {\n type:\n | \"null\"\n | \"boolean\"\n | \"object\"\n | \"array\"\n | \"number\"\n | \"string\"\n | \"integer\";\n properties?: Record<string, unknown>;\n required?: string[];\n additionalProperties?: boolean;\n [key: string]: unknown;\n} & {\n // Brand to ensure this is not a ToolStrategy or ProviderStrategy\n __brand?: never;\n};\n\nconst CHAT_MODELS_THAT_SUPPORT_JSON_SCHEMA_OUTPUT = [\"ChatOpenAI\", \"ChatXAI\"];\nconst MODEL_NAMES_THAT_SUPPORT_JSON_SCHEMA_OUTPUT = [\n \"grok\",\n \"gpt-5\",\n \"gpt-4.1\",\n \"gpt-4o\",\n \"gpt-oss\",\n \"o3-pro\",\n \"o3-mini\",\n];\n\n/**\n * Identifies the models that support JSON schema output\n * @param model - The model to check\n * @returns True if the model supports JSON schema output, false otherwise\n */\nexport function hasSupportForJsonSchemaOutput(\n model?: LanguageModelLike | string\n): boolean {\n if (!model) {\n return false;\n }\n\n if (typeof model === \"string\") {\n const modelName = model.split(\":\").pop() as string;\n return MODEL_NAMES_THAT_SUPPORT_JSON_SCHEMA_OUTPUT.some(\n (modelNameSnippet) => modelName.includes(modelNameSnippet)\n );\n }\n\n if (isConfigurableModel(model)) {\n const configurableModel = model as unknown as {\n _defaultConfig: { model: string };\n };\n return hasSupportForJsonSchemaOutput(\n configurableModel._defaultConfig.model\n );\n }\n\n if (!isBaseChatModel(model)) {\n return false;\n }\n\n const chatModelClass = model.getName();\n\n /**\n * for testing purposes only\n */\n if (chatModelClass === \"FakeToolCallingChatModel\") {\n return true;\n }\n\n if (\n CHAT_MODELS_THAT_SUPPORT_JSON_SCHEMA_OUTPUT.includes(chatModelClass) &&\n /**\n * OpenAI models\n */ ((\"model\" in model &&\n MODEL_NAMES_THAT_SUPPORT_JSON_SCHEMA_OUTPUT.some(\n (modelNameSnippet) =>\n typeof model.model === \"string\" &&\n model.model.includes(modelNameSnippet)\n )) ||\n /**\n * for testing purposes only\n */\n (chatModelClass === \"FakeToolCallingModel\" &&\n \"structuredResponse\" in model))\n ) {\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;AA8BA,IAAI,oBAAoB;;;;;;;AAQxB,IAAa,eAAb,MAAa,aAA2B;CACtC,AAAQ,YAIUA,QAKAC,MAQAC,SAChB;EAdgB;EAKA;EAQA;CACd;CAEJ,IAAI,OAAO;AACT,SAAO,KAAK,KAAK,SAAS;CAC3B;CAYD,OAAO,WACLC,QACAC,eACmB;;;;;EAKnB,SAAS,gBAAgBC,MAAe;AACtC,UAAO,QAAQ,CAAC,QAAQ,EAAE,EAAE,mBAAmB;EAChD;AAED,MAAI,mBAAmB,OAAO,EAAE;GAC9B,MAAMC,iBAAe,aAAa,OAAO;GACzC,MAAMC,SAAO;IACX,MAAM;IACN,UAAU;KACR,MAAM,iBAAiB;KACvB,QAAQ;KACR,aACED,eAAa,eACb;KACF,YAAYA;IACb;GACF;AACD,UAAO,IAAI,aAAaA,gBAAcC,QAAM;EAC7C;EAED,IAAIC;AACJ,MACE,OAAO,OAAO,SAAS,YACvB,OAAO,OAAO,eAAe,YAC7B,OAAO,cAAc,MAErB,qBAAqB;OAErB,qBAAqB;GAC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AAM,oBAAoB;AAG1B,SAAO,8BACL,kBAAkB,eAAe,MAClC;CACF;AAED,KAAI,CAAC,gBAAgB,MAAM,CACzB,QAAO;CAGT,MAAM,iBAAiB,MAAM,SAAS;;;;AAKtC,KAAI,mBAAmB,2BACrB,QAAO;AAGT,KACE,4CAA4C,SAAS,eAAe,KAG9D,WAAW,SACf,4CAA4C,KAC1C,CAAC,qBACC,OAAO,MAAM,UAAU,YACvB,MAAM,MAAM,SAAS,iBAAiB,CACzC,IAIA,mBAAmB,0BAClB,wBAAwB,OAE5B,QAAO;AAGT,QAAO;AACR"}
1
+ {"version":3,"file":"responses.js","names":["schema: Record<string, unknown>","tool: {\n type: \"function\";\n function: FunctionDefinition;\n }","options?: ToolStrategyOptions","schema: InteropZodObject | Record<string, unknown>","outputOptions?: ToolStrategyOptions","name?: string","asJsonSchema","tool","functionDefinition: FunctionDefinition","toolArgs: Record<string, unknown>","schema: InteropZodType<T> | Record<string, unknown>","response: AIMessage","responseFormat?:\n | InteropZodType<any>\n | InteropZodType<any>[]\n | JsonSchemaFormat\n | JsonSchemaFormat[]\n | ResponseFormat\n | ToolStrategy<any>[]\n | ResponseFormatUndefined","model?: LanguageModelLike | string","responseFormat:\n | InteropZodType<any>\n | InteropZodType<any>[]\n | JsonSchemaFormat\n | JsonSchemaFormat[]","responseFormat: InteropZodType<any> | JsonSchemaFormat"],"sources":["../../src/agents/responses.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable no-instanceof/no-instanceof */\nimport {\n InteropZodObject,\n isInteropZodSchema,\n InteropZodType,\n isInteropZodObject,\n} from \"@langchain/core/utils/types\";\nimport { type AIMessage } from \"@langchain/core/messages\";\nimport { type LanguageModelLike } from \"@langchain/core/language_models/base\";\nimport { toJsonSchema, Validator } from \"@langchain/core/utils/json_schema\";\nimport { type FunctionDefinition } from \"@langchain/core/language_models/base\";\n\nimport {\n StructuredOutputParsingError,\n MultipleStructuredOutputsError,\n} from \"./errors.js\";\nimport { isConfigurableModel, isBaseChatModel } from \"./model.js\";\n\n/**\n * Special type to indicate that no response format is provided.\n * When this type is used, the structuredResponse property should not be present in the result.\n */\nexport type ResponseFormatUndefined = {\n __responseFormatUndefined: true;\n};\n\n/**\n * This is a global counter for generating unique names for tools.\n */\nlet bindingIdentifier = 0;\n\n/**\n * Information for tracking structured output tool metadata.\n * This contains all necessary information to handle structured responses generated\n * via tool calls, including the original schema, its type classification, and the\n * corresponding tool implementation used by the tools strategy.\n */\nexport class ToolStrategy<_T = unknown> {\n private constructor(\n /**\n * The original JSON Schema provided for structured output\n */\n public readonly schema: Record<string, unknown>,\n\n /**\n * The tool that will be used to parse the tool call arguments.\n */\n public readonly tool: {\n type: \"function\";\n function: FunctionDefinition;\n },\n\n /**\n * The options to use for the tool output.\n */\n public readonly options?: ToolStrategyOptions\n ) {}\n\n get name() {\n return this.tool.function.name;\n }\n\n static fromSchema<S extends InteropZodObject>(\n schema: S,\n outputOptions?: ToolStrategyOptions\n ): ToolStrategy<S extends InteropZodType<infer U> ? U : unknown>;\n\n static fromSchema(\n schema: Record<string, unknown>,\n outputOptions?: ToolStrategyOptions\n ): ToolStrategy<Record<string, unknown>>;\n\n static fromSchema(\n schema: InteropZodObject | Record<string, unknown>,\n outputOptions?: ToolStrategyOptions\n ): ToolStrategy<any> {\n /**\n * It is required for tools to have a name so we can map the tool call to the correct tool\n * when parsing the response.\n */\n function getFunctionName(name?: string) {\n return name ?? `extract-${++bindingIdentifier}`;\n }\n\n if (isInteropZodSchema(schema)) {\n const asJsonSchema = toJsonSchema(schema);\n const tool = {\n type: \"function\" as const,\n function: {\n name: getFunctionName(),\n strict: false,\n description:\n asJsonSchema.description ??\n \"Tool for extracting structured output from the model's response.\",\n parameters: asJsonSchema,\n },\n };\n return new ToolStrategy(asJsonSchema, tool, outputOptions);\n }\n\n let functionDefinition: FunctionDefinition;\n if (\n typeof schema.name === \"string\" &&\n typeof schema.parameters === \"object\" &&\n schema.parameters != null\n ) {\n functionDefinition = schema as unknown as FunctionDefinition;\n } else {\n functionDefinition = {\n name: getFunctionName(schema.title as string),\n description: (schema.description as string) ?? \"\",\n parameters: schema.schema || (schema as Record<string, unknown>),\n };\n }\n const asJsonSchema = toJsonSchema(schema);\n const tool = {\n type: \"function\" as const,\n function: functionDefinition,\n };\n return new ToolStrategy(asJsonSchema, tool, outputOptions);\n }\n\n /**\n * Parse tool arguments according to the schema.\n *\n * @throws {StructuredOutputParsingError} if the response is not valid\n * @param toolArgs - The arguments from the tool call\n * @returns The parsed response according to the schema type\n */\n parse(toolArgs: Record<string, unknown>): Record<string, unknown> {\n const validator = new Validator(this.schema);\n const result = validator.validate(toolArgs);\n if (!result.valid) {\n throw new StructuredOutputParsingError(\n this.name,\n result.errors.map((e) => e.error)\n );\n }\n return toolArgs;\n }\n}\n\nexport class ProviderStrategy<T = unknown> {\n // @ts-expect-error - _schemaType is used only for type inference\n private _schemaType?: T;\n\n private constructor(public readonly schema: Record<string, unknown>) {}\n\n static fromSchema<T>(schema: InteropZodType<T>): ProviderStrategy<T>;\n\n static fromSchema(\n schema: Record<string, unknown>\n ): ProviderStrategy<Record<string, unknown>>;\n\n static fromSchema<T = unknown>(\n schema: InteropZodType<T> | Record<string, unknown>\n ): ProviderStrategy<T> | ProviderStrategy<Record<string, unknown>> {\n const asJsonSchema = toJsonSchema(schema);\n return new ProviderStrategy(asJsonSchema) as\n | ProviderStrategy<T>\n | ProviderStrategy<Record<string, unknown>>;\n }\n\n /**\n * Parse tool arguments according to the schema. If the response is not valid, return undefined.\n *\n * @param toolArgs - The arguments from the tool call\n * @returns The parsed response according to the schema type\n */\n parse(response: AIMessage) {\n /**\n * return if the response doesn't contain valid content\n */\n if (typeof response.content !== \"string\" || response.content === \"\") {\n return;\n }\n\n try {\n const content = JSON.parse(response.content);\n const validator = new Validator(this.schema);\n const result = validator.validate(content);\n if (!result.valid) {\n return;\n }\n\n return content;\n } catch {\n // no-op\n }\n }\n}\n\nexport type ResponseFormat = ToolStrategy<any> | ProviderStrategy<any>;\n\n/**\n * Handle user input for `responseFormat` parameter of `CreateAgentParams`.\n * This function defines the default behavior for the `responseFormat` parameter, which is:\n *\n * - if value is a Zod schema, default to structured output via tool calling\n * - if value is a JSON schema, default to structured output via tool calling\n * - if value is a custom response format, return it as is\n * - if value is an array, ensure all array elements are instance of `ToolStrategy`\n * @param responseFormat - The response format to transform, provided by the user\n * @param options - The response format options for tool strategy\n * @param model - The model to check if it supports JSON schema output\n * @returns\n */\nexport function transformResponseFormat(\n responseFormat?:\n | InteropZodType<any>\n | InteropZodType<any>[]\n | JsonSchemaFormat\n | JsonSchemaFormat[]\n | ResponseFormat\n | ToolStrategy<any>[]\n | ResponseFormatUndefined,\n options?: ToolStrategyOptions,\n model?: LanguageModelLike | string\n): ResponseFormat[] {\n if (!responseFormat) {\n return [];\n }\n\n // Handle ResponseFormatUndefined case\n if (\n typeof responseFormat === \"object\" &&\n responseFormat !== null &&\n \"__responseFormatUndefined\" in responseFormat\n ) {\n return [];\n }\n\n /**\n * If users provide an array, it should only contain raw schemas (Zod or JSON schema),\n * not ToolStrategy or ProviderStrategy instances.\n */\n if (Array.isArray(responseFormat)) {\n /**\n * if every entry is a ToolStrategy or ProviderStrategy instance, return the array as is\n */\n if (\n responseFormat.every(\n (item) =>\n item instanceof ToolStrategy || item instanceof ProviderStrategy\n )\n ) {\n return responseFormat as unknown as ResponseFormat[];\n }\n\n /**\n * Check if all items are Zod schemas\n */\n if (responseFormat.every((item) => isInteropZodObject(item))) {\n return responseFormat.map((item) =>\n ToolStrategy.fromSchema(item as InteropZodObject, options)\n );\n }\n\n /**\n * Check if all items are plain objects (JSON schema)\n */\n if (\n responseFormat.every(\n (item) =>\n typeof item === \"object\" && item !== null && !isInteropZodObject(item)\n )\n ) {\n return responseFormat.map((item) =>\n ToolStrategy.fromSchema(item as JsonSchemaFormat, options)\n );\n }\n\n throw new Error(\n `Invalid response format: list contains mixed types.\\n` +\n `All items must be either InteropZodObject or plain JSON schema objects.`\n );\n }\n\n if (\n responseFormat instanceof ToolStrategy ||\n responseFormat instanceof ProviderStrategy\n ) {\n return [responseFormat];\n }\n\n const useProviderStrategy = hasSupportForJsonSchemaOutput(model);\n\n /**\n * `responseFormat` is a Zod schema\n */\n if (isInteropZodObject(responseFormat)) {\n return useProviderStrategy\n ? [ProviderStrategy.fromSchema(responseFormat)]\n : [ToolStrategy.fromSchema(responseFormat, options)];\n }\n\n /**\n * Handle plain object (JSON schema)\n */\n if (\n typeof responseFormat === \"object\" &&\n responseFormat !== null &&\n \"properties\" in responseFormat\n ) {\n return useProviderStrategy\n ? [ProviderStrategy.fromSchema(responseFormat as JsonSchemaFormat)]\n : [ToolStrategy.fromSchema(responseFormat as JsonSchemaFormat, options)];\n }\n\n throw new Error(`Invalid response format: ${String(responseFormat)}`);\n}\n\n/**\n * Branded type for ToolStrategy arrays that preserves type information\n */\nexport interface TypedToolStrategy<T = unknown>\n extends Array<ToolStrategy<any>> {\n _schemaType?: T;\n}\nexport type ToolStrategyError =\n | StructuredOutputParsingError\n | MultipleStructuredOutputsError;\nexport interface ToolStrategyOptions {\n /**\n * Allows you to customize the message that appears in the conversation history when structured\n * output is generated.\n */\n toolMessageContent?: string;\n /**\n * Handle errors from the structured output tool call. Using tools to generate structured output\n * can cause errors, e.g. if:\n * - you provide multiple structured output schemas and the model calls multiple structured output tools\n * - if the structured output generated by the tool call doesn't match provided schema\n *\n * This property allows to handle these errors in different ways:\n * - `true` - retry the tool call\n * - `false` - throw an error\n * - `string` - retry the tool call with the provided message\n * - `(error: ToolStrategyError) => Promise<string> | string` - retry with the provided message or throw the error\n *\n * @default true\n */\n handleError?:\n | boolean\n | string\n | ((error: ToolStrategyError) => Promise<string> | string);\n}\n\nexport function toolStrategy<T extends InteropZodType<any>>(\n responseFormat: T,\n options?: ToolStrategyOptions\n): TypedToolStrategy<T extends InteropZodType<infer U> ? U : never>;\nexport function toolStrategy<T extends readonly InteropZodType<any>[]>(\n responseFormat: T,\n options?: ToolStrategyOptions\n): TypedToolStrategy<\n { [K in keyof T]: T[K] extends InteropZodType<infer U> ? U : never }[number]\n>;\nexport function toolStrategy(\n responseFormat: JsonSchemaFormat,\n options?: ToolStrategyOptions\n): TypedToolStrategy<Record<string, unknown>>;\nexport function toolStrategy(\n responseFormat: JsonSchemaFormat[],\n options?: ToolStrategyOptions\n): TypedToolStrategy<Record<string, unknown>>;\n\n/**\n * Define how to transform the response format from a tool call.\n *\n * @param responseFormat - The response format to transform\n * @param options - The options to use for the transformation\n * @param options.handleError - Whether to handle errors from the tool call\n * @returns The transformed response format\n */\nexport function toolStrategy(\n responseFormat:\n | InteropZodType<any>\n | InteropZodType<any>[]\n | JsonSchemaFormat\n | JsonSchemaFormat[],\n options?: ToolStrategyOptions\n): TypedToolStrategy {\n return transformResponseFormat(responseFormat, options) as TypedToolStrategy;\n}\n\nexport function providerStrategy<T extends InteropZodType<any>>(\n responseFormat: T\n): ProviderStrategy<T extends InteropZodType<infer U> ? U : never>;\nexport function providerStrategy(\n responseFormat: JsonSchemaFormat\n): ProviderStrategy<Record<string, unknown>>;\nexport function providerStrategy(\n responseFormat: InteropZodType<any> | JsonSchemaFormat\n): ProviderStrategy<any> {\n return ProviderStrategy.fromSchema(\n responseFormat as any\n ) as ProviderStrategy<any>;\n}\n\n/**\n * Type representing a JSON Schema object format.\n * This is a strict type that excludes ToolStrategy and ProviderStrategy instances.\n */\nexport type JsonSchemaFormat = {\n type:\n | \"null\"\n | \"boolean\"\n | \"object\"\n | \"array\"\n | \"number\"\n | \"string\"\n | \"integer\";\n properties?: Record<string, unknown>;\n required?: string[];\n additionalProperties?: boolean;\n [key: string]: unknown;\n} & {\n // Brand to ensure this is not a ToolStrategy or ProviderStrategy\n __brand?: never;\n};\n\nconst CHAT_MODELS_THAT_SUPPORT_JSON_SCHEMA_OUTPUT = [\"ChatOpenAI\", \"ChatXAI\"];\nconst MODEL_NAMES_THAT_SUPPORT_JSON_SCHEMA_OUTPUT = [\n \"grok\",\n \"gpt-5\",\n \"gpt-4.1\",\n \"gpt-4o\",\n \"gpt-oss\",\n \"o3-pro\",\n \"o3-mini\",\n];\n\n/**\n * Identifies the models that support JSON schema output\n * @param model - The model to check\n * @returns True if the model supports JSON schema output, false otherwise\n */\nexport function hasSupportForJsonSchemaOutput(\n model?: LanguageModelLike | string\n): boolean {\n if (!model) {\n return false;\n }\n\n if (typeof model === \"string\") {\n const modelName = model.split(\":\").pop() as string;\n return MODEL_NAMES_THAT_SUPPORT_JSON_SCHEMA_OUTPUT.some(\n (modelNameSnippet) => modelName.includes(modelNameSnippet)\n );\n }\n\n if (isConfigurableModel(model)) {\n const configurableModel = model as unknown as {\n _defaultConfig: { model: string };\n };\n return hasSupportForJsonSchemaOutput(\n configurableModel._defaultConfig.model\n );\n }\n\n if (!isBaseChatModel(model)) {\n return false;\n }\n\n const chatModelClass = model.getName();\n\n /**\n * for testing purposes only\n */\n if (chatModelClass === \"FakeToolCallingChatModel\") {\n return true;\n }\n\n if (\n CHAT_MODELS_THAT_SUPPORT_JSON_SCHEMA_OUTPUT.includes(chatModelClass) &&\n /**\n * OpenAI models\n */ ((\"model\" in model &&\n MODEL_NAMES_THAT_SUPPORT_JSON_SCHEMA_OUTPUT.some(\n (modelNameSnippet) =>\n typeof model.model === \"string\" &&\n model.model.includes(modelNameSnippet)\n )) ||\n /**\n * for testing purposes only\n */\n (chatModelClass === \"FakeToolCallingModel\" &&\n \"structuredResponse\" in model))\n ) {\n return true;\n }\n\n return false;\n}\n"],"mappings":";;;;;;;;;AA8BA,IAAI,oBAAoB;;;;;;;AAQxB,IAAa,eAAb,MAAa,aAA2B;CACtC,AAAQ,YAIUA,QAKAC,MAQAC,SAChB;EAdgB;EAKA;EAQA;CACd;CAEJ,IAAI,OAAO;AACT,SAAO,KAAK,KAAK,SAAS;CAC3B;CAYD,OAAO,WACLC,QACAC,eACmB;;;;;EAKnB,SAAS,gBAAgBC,MAAe;AACtC,UAAO,QAAQ,CAAC,QAAQ,EAAE,EAAE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ACF;AAwBD,MAAM,8CAA8C,CAAC,cAAc,SAAU;AAC7E,MAAM,8CAA8C;CAClD;CACA;CACA;CACA;CACA;CACA;CACA;AACD;;;;;;AAOD,SAAgB,8BACdF,OACS;AACT,KAAI,CAAC,MACH,QAAO;AAGT,KAAI,OAAO,UAAU,UAAU;EAC7B,MAAM,YAAY,MAAM,MAAM,IAAI,CAAC,KAAK;AACxC,SAAO,4CAA4C,KACjD,CAAC,qBAAqB,UAAU,SAAS,iBAAiB,CAC3D;CACF;AAED,KAAI,oBAAoB,MAAM,EAAE;EAC9B,MAAM,oBAAoB;AAG1B,SAAO,8BACL,kBAAkB,eAAe,MAClC;CACF;AAED,KAAI,CAAC,gBAAgB,MAAM,CACzB,QAAO;CAGT,MAAM,iBAAiB,MAAM,SAAS;;;;AAKtC,KAAI,mBAAmB,2BACrB,QAAO;AAGT,KACE,4CAA4C,SAAS,eAAe,KAG9D,WAAW,SACf,4CAA4C,KAC1C,CAAC,qBACC,OAAO,MAAM,UAAU,YACvB,MAAM,MAAM,SAAS,iBAAiB,CACzC,IAIA,mBAAmB,0BAClB,wBAAwB,OAE5B,QAAO;AAGT,QAAO;AACR"}
@@ -1,7 +1,7 @@
1
1
  import { BaseMessage } from "@langchain/core/messages";
2
2
  import { BaseCallbackConfig } from "@langchain/core/callbacks/manager";
3
3
  import { InteropZodDefault, InteropZodOptional } from "@langchain/core/utils/types";
4
- import { PregelOptions, Runtime } from "@langchain/langgraph";
4
+ import { PregelOptions, Runtime, StreamMode } from "@langchain/langgraph";
5
5
 
6
6
  //#region src/agents/runtime.d.ts
7
7
 
@@ -93,15 +93,15 @@ ContextSchema extends InteropZodDefault<any> ? BaseCallbackConfig & Partial<Pick
93
93
  } : IsAllOptional<ContextSchema> extends true ? BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
94
94
  context?: Partial<ContextSchema>;
95
95
  } : BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;
96
- type StreamConfiguration<ContextSchema extends Record<string, any>> =
96
+ type StreamConfiguration<ContextSchema extends Record<string, any>, TStreamMode extends StreamMode | StreamMode[] | undefined, TEncoding extends "text/event-stream" | undefined> =
97
97
  /**
98
98
  * If the context schema is a default object, `context` can be optional
99
99
  */
100
- ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
100
+ ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any, TStreamMode, boolean, TEncoding>, CreateAgentPregelOptions>> & {
101
101
  context?: Partial<ContextSchema>;
102
- } : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & {
102
+ } : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any, TStreamMode, boolean, TEncoding>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & {
103
103
  context?: Partial<ContextSchema>;
104
- } : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & WithMaybeContext<ContextSchema>;
104
+ } : Partial<Pick<PregelOptions<any, any, any, TStreamMode, boolean, TEncoding>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & WithMaybeContext<ContextSchema>;
105
105
  //#endregion
106
106
  export { AgentBuiltInState, InvokeConfiguration, Runtime$1 as Runtime, StreamConfiguration };
107
107
  //# sourceMappingURL=runtime.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.cts","names":["InteropZodOptional","InteropZodDefault","Runtime","LangGraphRuntime","PregelOptions","BaseMessage","BaseCallbackConfig","ResponseFormatUndefined","AgentBuiltInState","Record","IsOptionalZodObject","T","IsDefaultZodObject","WithMaybeContext","TContext","Omit","Partial","InternalAgentState","StructuredResponseType","IsOptionalType","ExtractNonUndefined","IsAllOptional","CreateAgentPregelOptions","CreateAgentPregelStreamOptions","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 { 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> = \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 * 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>> = \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 | CreateAgentPregelStreamOptions>> & {\n context?: Partial<ContextSchema>;\n} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & WithMaybeContext<ContextSchema>;\nexport {};\n"],"mappings":";;;;;;;;;;AAoC+B,KA1BnBQ,iBAAAA,GA0BmB;EAK1BE;;;;AAAqD;AAAA;;;;AACF;AACxD;;EAA4B,QAA+BI,EApB7CT,WAoB6CS,EAAAA;EAAQ;;;;;;;;AAOrC;AAK9B;;;EAAgF,kBAAzBX,CAAAA,EAnB9BM,MAmB8BN,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;CAAgB;;;;AAA2D,KAd7HO,mBAc6H,CAAA,CAAA,CAAA,GAdpGC,CAcoG,SAd1FX,kBAc0F,CAAA,GAAA,CAAA,GAAA,IAAA,GAAA,KAAA;AAU/H,KAvBEY,kBA2Bc,CAAA,CAAA,CAAA,GA3BUD,CA2BV,SA3BoBV,iBA2BK,CAAA,GAAA,CAAA,GAAA,IAAA,GAAA,KAAA;AAIvCmB,KA9BOP,gBA8BY,CAAA,QAAA,CAAA,GAAA,SAAA,SA9BmCC,QA8BnC,GAAA;EAAA,SAAA,OAAA,CAAA,EA7BDA,QA6BC;CAAA,GA5BpBJ,mBA4B0BC,CA5BNG,QA4BMH,CAAAA,SAAAA,IAAAA,GAAAA;EAAC,SAA6BA,OAAAA,CAAAA,EA3BrCG,QA2BqCH;AAAC,CAAA,GA1BzDC,kBA0ByD,CA1BtCE,QA0BsC,CAAA,SAAA,IAAA,GAAA;EAIjDO,SAAAA,OAAa,CAAA,EA7BFP,QA6BE;CAAA,GAAA;EAAA,SAEPH,OAAAA,EA7BIG,QA6BJH;CAAC;;;;AAAiFF,KA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AAAA,GAA3CN,OAA2CM,CAAnCI,IAAmCJ,CAA9BlB,aAA8BkB,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAAAA,wBAAAA,GAA2BC,8BAA3BD,CAAAA,CAAAA,GAAAA;EAAwB,OAAGC,CAAAA,EACxGP,OADwGO,CAChGE,aADgGF,CAAAA;CAA8B,GAEhJP,OAFoDU,CAE5CA,IAF4CA,CAEvCtB,aAFuCsB,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,CAAAA,EAETJ,wBAFSI,GAEkBH,8BAFlBG,CAAAA,CAAAA,GAEqDb,gBAFrDa,CAEsED,aAFtEC,CAAAA"}
1
+ {"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":["/* 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, 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> = \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 * 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"],"mappings":";;;;;;;;;;AAoC+B,KA1BnBS,iBAAAA,GA0BmB;EAK1BE;;;;AAAqD;AAAA;;;;AACF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CAAa,GAE3BT,OAFAK,CAEQK,IAFRL,CAEalB,aAFbkB,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,EAE0CO,WAF1CP,EAAAA,OAAAA,EAEgEQ,SAFhER,CAAAA,EAE4EC,wBAF5ED,GAEuGE,8BAFvGF,CAAAA,CAAAA,GAE0IR,gBAF1IQ,CAE2JI,aAF3JJ,CAAAA"}
@@ -1,5 +1,5 @@
1
1
  import { BaseMessage } from "@langchain/core/messages";
2
- import { PregelOptions, Runtime } from "@langchain/langgraph";
2
+ import { PregelOptions, Runtime, StreamMode } from "@langchain/langgraph";
3
3
  import { InteropZodDefault, InteropZodOptional } from "@langchain/core/utils/types";
4
4
  import { BaseCallbackConfig } from "@langchain/core/callbacks/manager";
5
5
 
@@ -93,15 +93,15 @@ ContextSchema extends InteropZodDefault<any> ? BaseCallbackConfig & Partial<Pick
93
93
  } : IsAllOptional<ContextSchema> extends true ? BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
94
94
  context?: Partial<ContextSchema>;
95
95
  } : BaseCallbackConfig & Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & WithMaybeContext<ContextSchema>;
96
- type StreamConfiguration<ContextSchema extends Record<string, any>> =
96
+ type StreamConfiguration<ContextSchema extends Record<string, any>, TStreamMode extends StreamMode | StreamMode[] | undefined, TEncoding extends "text/event-stream" | undefined> =
97
97
  /**
98
98
  * If the context schema is a default object, `context` can be optional
99
99
  */
100
- ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions>> & {
100
+ ContextSchema extends InteropZodDefault<any> ? Partial<Pick<PregelOptions<any, any, any, TStreamMode, boolean, TEncoding>, CreateAgentPregelOptions>> & {
101
101
  context?: Partial<ContextSchema>;
102
- } : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & {
102
+ } : IsAllOptional<ContextSchema> extends true ? Partial<Pick<PregelOptions<any, any, any, TStreamMode, boolean, TEncoding>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & {
103
103
  context?: Partial<ContextSchema>;
104
- } : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & WithMaybeContext<ContextSchema>;
104
+ } : Partial<Pick<PregelOptions<any, any, any, TStreamMode, boolean, TEncoding>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & WithMaybeContext<ContextSchema>;
105
105
  //#endregion
106
106
  export { AgentBuiltInState, InvokeConfiguration, Runtime$1 as Runtime, StreamConfiguration };
107
107
  //# sourceMappingURL=runtime.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"runtime.d.ts","names":["InteropZodOptional","InteropZodDefault","Runtime","LangGraphRuntime","PregelOptions","BaseMessage","BaseCallbackConfig","ResponseFormatUndefined","AgentBuiltInState","Record","IsOptionalZodObject","T","IsDefaultZodObject","WithMaybeContext","TContext","Omit","Partial","InternalAgentState","StructuredResponseType","IsOptionalType","ExtractNonUndefined","IsAllOptional","CreateAgentPregelOptions","CreateAgentPregelStreamOptions","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 { 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> = \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 * 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>> = \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 | CreateAgentPregelStreamOptions>> & {\n context?: Partial<ContextSchema>;\n} : Partial<Pick<PregelOptions<any, any, any>, CreateAgentPregelOptions | CreateAgentPregelStreamOptions>> & WithMaybeContext<ContextSchema>;\nexport {};\n"],"mappings":";;;;;;;;;;AAoC+B,KA1BnBQ,iBAAAA,GA0BmB;EAK1BE;;;;AAAqD;AAAA;;;;AACF;AACxD;;EAA4B,QAA+BI,EApB7CT,WAoB6CS,EAAAA;EAAQ;;;;;;;;AAOrC;AAK9B;;;EAAgF,kBAAzBX,CAAAA,EAnB9BM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ode","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":["/* 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, 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> = \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 * 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"],"mappings":";;;;;;;;;;AAoC+B,KA1BnBS,iBAAAA,GA0BmB;EAK1BE;;;;AAAqD;AAAA;;;;AACF;AACxD;;EAA4B,QAA+BI,EApB7CT,WAoB6CS,EAAAA;EAAQ;;;;;;;;AAOrC;AAK9B;;;EAAgF,kBAAzBZ,CAAAA,EAnB9BO,MAmB8BP,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA;CAAgB;;;;AAA2D,KAd7HQ,mBAc6H,CAAA,CAAA,CAAA,GAdpGC,CAcoG,SAd1FZ,kBAc0F,CAAA,GAAA,CAAA,GAAA,IAAA,GAAA,KAAA;AAU/H,KAvBEa,kBA2Bc,CAAA,CAAA,CAAA,GA3BUD,CA2BV,SA3BoBX,iBA2BK,CAAA,GAAA,CAAA,GAAA,IAAA,GAAA,KAAA;AAIvCoB,KA9BOP,gBA8BY,CAAA,QAAA,CAAA,GAAA,SAAA,SA9BmCC,QA8BnC,GAAA;EAAA,SAAA,OAAA,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AAA,EAAAA,oBAJhBzB,UAIgByB,GAJHzB,UAIGyB,EAAAA,GAAAA,SAAAA,EAAAA,kBAAAA,mBAAAA,GAAAA,SAAAA,CAAAA;;;;AAA/GJ,aAA+CT,SAAzBhB,iBAAyBgB,CAAAA,GAAAA,CAAAA,GAAAA,OAAAA,CAAQU,IAARV,CAAab,aAAba,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,EAA0CY,WAA1CZ,EAAAA,OAAAA,EAAgEa,SAAhEb,CAAAA,EAA4EM,wBAA5EN,CAAAA,CAAAA,GAAAA;EAAO,OAChCS,CAAAA,EAART,OAAQS,CAAAA,aAAAA,CAAAA;CAAa,GAC/BJ,aADUL,CACIS,aADJT,CAAAA,SAAAA,IAAAA,GACkCA,OADlCA,CAC0CU,IAD1CV,CAC+Cb,aAD/Ca,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,EAC4EY,WAD5EZ,EAAAA,OAAAA,EACkGa,SADlGb,CAAAA,EAC8GM,wBAD9GN,GACyIO,8BADzIP,CAAAA,CAAAA,GAAAA;EAAO,OACHS,CAAAA,EACJT,OADIS,CACIA,aADJA,CAAAA;CAAa,GAE3BT,OAFAK,CAEQK,IAFRL,CAEalB,aAFbkB,CAAAA,GAAAA,EAAAA,GAAAA,EAAAA,GAAAA,EAE0CO,WAF1CP,EAAAA,OAAAA,EAEgEQ,SAFhER,CAAAA,EAE4EC,wBAF5ED,GAEuGE,8BAFvGF,CAAAA,CAAAA,GAE0IR,gBAF1IQ,CAE2JI,aAF3JJ,CAAAA"}
package/dist/index.cjs CHANGED
@@ -11,6 +11,7 @@ const require_hitl = require('./agents/middleware/hitl.cjs');
11
11
  const require_promptCaching = require('./agents/middleware/promptCaching.cjs');
12
12
  const require_dynamicSystemPrompt = require('./agents/middleware/dynamicSystemPrompt.cjs');
13
13
  const require_llmToolSelector = require('./agents/middleware/llmToolSelector.cjs');
14
+ const require_pii = require('./agents/middleware/pii.cjs');
14
15
  const require_piiRedaction = require('./agents/middleware/piiRedaction.cjs');
15
16
  const require_contextEditing = require('./agents/middleware/contextEditing.cjs');
16
17
  const require_toolCallLimit = require('./agents/middleware/toolCallLimit.cjs');
@@ -18,6 +19,7 @@ const require_todoListMiddleware = require('./agents/middleware/todoListMiddlewa
18
19
  const require_modelCallLimit = require('./agents/middleware/modelCallLimit.cjs');
19
20
  const require_modelFallback = require('./agents/middleware/modelFallback.cjs');
20
21
  const require_toolRetry = require('./agents/middleware/toolRetry.cjs');
22
+ const require_toolEmulator = require('./agents/middleware/toolEmulator.cjs');
21
23
  require('./agents/middleware/index.cjs');
22
24
  const __langchain_core_messages = require_rolldown_runtime.__toESM(require("@langchain/core/messages"));
23
25
  const __langchain_core_tools = require_rolldown_runtime.__toESM(require("@langchain/core/tools"));
@@ -41,6 +43,7 @@ require_rolldown_runtime.__export(src_exports, {
41
43
  InMemoryStore: () => __langchain_core_stores.InMemoryStore,
42
44
  MultipleStructuredOutputsError: () => require_errors.MultipleStructuredOutputsError,
43
45
  MultipleToolsBoundError: () => require_errors.MultipleToolsBoundError,
46
+ PIIDetectionError: () => require_pii.PIIDetectionError,
44
47
  ProviderStrategy: () => require_responses.ProviderStrategy,
45
48
  StructuredOutputParsingError: () => require_errors.StructuredOutputParsingError,
46
49
  StructuredTool: () => __langchain_core_tools.StructuredTool,
@@ -54,10 +57,16 @@ require_rolldown_runtime.__export(src_exports, {
54
57
  ToolMessageChunk: () => __langchain_core_messages.ToolMessageChunk,
55
58
  ToolStrategy: () => require_responses.ToolStrategy,
56
59
  anthropicPromptCachingMiddleware: () => require_promptCaching.anthropicPromptCachingMiddleware,
60
+ applyStrategy: () => require_pii.applyStrategy,
57
61
  contextEditingMiddleware: () => require_contextEditing.contextEditingMiddleware,
58
62
  countTokensApproximately: () => require_utils.countTokensApproximately,
59
63
  createAgent: () => require_index.createAgent,
60
64
  createMiddleware: () => require_middleware.createMiddleware,
65
+ detectCreditCard: () => require_pii.detectCreditCard,
66
+ detectEmail: () => require_pii.detectEmail,
67
+ detectIP: () => require_pii.detectIP,
68
+ detectMacAddress: () => require_pii.detectMacAddress,
69
+ detectUrl: () => require_pii.detectUrl,
61
70
  dynamicSystemPromptMiddleware: () => require_dynamicSystemPrompt.dynamicSystemPromptMiddleware,
62
71
  filterMessages: () => __langchain_core_messages.filterMessages,
63
72
  humanInTheLoopMiddleware: () => require_hitl.humanInTheLoopMiddleware,
@@ -65,12 +74,15 @@ require_rolldown_runtime.__export(src_exports, {
65
74
  llmToolSelectorMiddleware: () => require_llmToolSelector.llmToolSelectorMiddleware,
66
75
  modelCallLimitMiddleware: () => require_modelCallLimit.modelCallLimitMiddleware,
67
76
  modelFallbackMiddleware: () => require_modelFallback.modelFallbackMiddleware,
77
+ piiMiddleware: () => require_pii.piiMiddleware,
68
78
  piiRedactionMiddleware: () => require_piiRedaction.piiRedactionMiddleware,
69
79
  providerStrategy: () => require_responses.providerStrategy,
80
+ resolveRedactionRule: () => require_pii.resolveRedactionRule,
70
81
  summarizationMiddleware: () => require_summarization.summarizationMiddleware,
71
82
  todoListMiddleware: () => require_todoListMiddleware.todoListMiddleware,
72
83
  tool: () => __langchain_core_tools.tool,
73
84
  toolCallLimitMiddleware: () => require_toolCallLimit.toolCallLimitMiddleware,
85
+ toolEmulatorMiddleware: () => require_toolEmulator.toolEmulatorMiddleware,
74
86
  toolRetryMiddleware: () => require_toolRetry.toolRetryMiddleware,
75
87
  toolStrategy: () => require_responses.toolStrategy,
76
88
  trimMessages: () => __langchain_core_messages.trimMessages
@@ -141,6 +153,7 @@ Object.defineProperty(exports, 'InMemoryStore', {
141
153
  });
142
154
  exports.MultipleStructuredOutputsError = require_errors.MultipleStructuredOutputsError;
143
155
  exports.MultipleToolsBoundError = require_errors.MultipleToolsBoundError;
156
+ exports.PIIDetectionError = require_pii.PIIDetectionError;
144
157
  exports.ProviderStrategy = require_responses.ProviderStrategy;
145
158
  exports.StructuredOutputParsingError = require_errors.StructuredOutputParsingError;
146
159
  Object.defineProperty(exports, 'StructuredTool', {
@@ -184,10 +197,16 @@ Object.defineProperty(exports, 'ToolMessageChunk', {
184
197
  });
185
198
  exports.ToolStrategy = require_responses.ToolStrategy;
186
199
  exports.anthropicPromptCachingMiddleware = require_promptCaching.anthropicPromptCachingMiddleware;
200
+ exports.applyStrategy = require_pii.applyStrategy;
187
201
  exports.contextEditingMiddleware = require_contextEditing.contextEditingMiddleware;
188
202
  exports.countTokensApproximately = require_utils.countTokensApproximately;
189
203
  exports.createAgent = require_index.createAgent;
190
204
  exports.createMiddleware = require_middleware.createMiddleware;
205
+ exports.detectCreditCard = require_pii.detectCreditCard;
206
+ exports.detectEmail = require_pii.detectEmail;
207
+ exports.detectIP = require_pii.detectIP;
208
+ exports.detectMacAddress = require_pii.detectMacAddress;
209
+ exports.detectUrl = require_pii.detectUrl;
191
210
  exports.dynamicSystemPromptMiddleware = require_dynamicSystemPrompt.dynamicSystemPromptMiddleware;
192
211
  Object.defineProperty(exports, 'filterMessages', {
193
212
  enumerable: true,
@@ -200,8 +219,10 @@ exports.initChatModel = require_chat_models_universal.initChatModel;
200
219
  exports.llmToolSelectorMiddleware = require_llmToolSelector.llmToolSelectorMiddleware;
201
220
  exports.modelCallLimitMiddleware = require_modelCallLimit.modelCallLimitMiddleware;
202
221
  exports.modelFallbackMiddleware = require_modelFallback.modelFallbackMiddleware;
222
+ exports.piiMiddleware = require_pii.piiMiddleware;
203
223
  exports.piiRedactionMiddleware = require_piiRedaction.piiRedactionMiddleware;
204
224
  exports.providerStrategy = require_responses.providerStrategy;
225
+ exports.resolveRedactionRule = require_pii.resolveRedactionRule;
205
226
  Object.defineProperty(exports, 'src_exports', {
206
227
  enumerable: true,
207
228
  get: function () {
@@ -217,6 +238,7 @@ Object.defineProperty(exports, 'tool', {
217
238
  }
218
239
  });
219
240
  exports.toolCallLimitMiddleware = require_toolCallLimit.toolCallLimitMiddleware;
241
+ exports.toolEmulatorMiddleware = require_toolEmulator.toolEmulatorMiddleware;
220
242
  exports.toolRetryMiddleware = require_toolRetry.toolRetryMiddleware;
221
243
  exports.toolStrategy = require_responses.toolStrategy;
222
244
  Object.defineProperty(exports, 'trimMessages', {
package/dist/index.d.cts CHANGED
@@ -9,21 +9,23 @@ import { ReactAgent } from "./agents/ReactAgent.cjs";
9
9
  import { createMiddleware } from "./agents/middleware.cjs";
10
10
  import { FakeToolCallingModel } from "./agents/tests/utils.cjs";
11
11
  import { createAgent } from "./agents/index.cjs";
12
- import { SummarizationMiddlewareConfig, summarizationMiddleware } from "./agents/middleware/summarization.cjs";
12
+ import { SummarizationMiddlewareConfig, TokenCounter, summarizationMiddleware } from "./agents/middleware/summarization.cjs";
13
13
  import { Action, ActionRequest, ApproveDecision, Decision, DecisionType, DescriptionFactory, EditDecision, HITLRequest, HITLResponse, HumanInTheLoopMiddlewareConfig, InterruptOnConfig, RejectDecision, ReviewConfig, humanInTheLoopMiddleware } from "./agents/middleware/hitl.cjs";
14
14
  import { PromptCachingMiddlewareConfig, anthropicPromptCachingMiddleware } from "./agents/middleware/promptCaching.cjs";
15
15
  import { DynamicSystemPromptMiddlewareConfig, dynamicSystemPromptMiddleware } from "./agents/middleware/dynamicSystemPrompt.cjs";
16
16
  import { LLMToolSelectorConfig, llmToolSelectorMiddleware } from "./agents/middleware/llmToolSelector.cjs";
17
+ import { BuiltInPIIType, PIIDetectionError, PIIDetector, PIIMatch, PIIMiddlewareConfig, PIIStrategy, RedactionRuleConfig, ResolvedRedactionRule, applyStrategy, detectCreditCard, detectEmail, detectIP, detectMacAddress, detectUrl, piiMiddleware, resolveRedactionRule } from "./agents/middleware/pii.cjs";
17
18
  import { PIIRedactionMiddlewareConfig, piiRedactionMiddleware } from "./agents/middleware/piiRedaction.cjs";
18
- import { ClearToolUsesEdit, ClearToolUsesEditConfig, ContextEdit, ContextEditingMiddlewareConfig, TokenCounter, contextEditingMiddleware } from "./agents/middleware/contextEditing.cjs";
19
+ import { ClearToolUsesEdit, ClearToolUsesEditConfig, ContextEdit, ContextEditingMiddlewareConfig, contextEditingMiddleware } from "./agents/middleware/contextEditing.cjs";
19
20
  import { ToolCallLimitConfig, ToolCallLimitExceededError, toolCallLimitMiddleware } from "./agents/middleware/toolCallLimit.cjs";
20
21
  import { TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, TodoListMiddlewareOptions, todoListMiddleware } from "./agents/middleware/todoListMiddleware.cjs";
21
22
  import { ModelCallLimitMiddlewareConfig, modelCallLimitMiddleware } from "./agents/middleware/modelCallLimit.cjs";
22
23
  import { modelFallbackMiddleware } from "./agents/middleware/modelFallback.cjs";
23
24
  import { ToolRetryMiddlewareConfig, toolRetryMiddleware } from "./agents/middleware/toolRetry.cjs";
25
+ import { ToolEmulatorOptions, toolEmulatorMiddleware } from "./agents/middleware/toolEmulator.cjs";
24
26
  import { countTokensApproximately } from "./agents/middleware/utils.cjs";
25
27
  import { AIMessage, AIMessageChunk, BaseMessage, BaseMessageChunk, ContentBlock, HumanMessage, HumanMessageChunk, SystemMessage, SystemMessageChunk, ToolMessage, ToolMessageChunk, filterMessages, trimMessages } from "@langchain/core/messages";
26
28
  import { DynamicStructuredTool, DynamicTool, StructuredTool, Tool, ToolRuntime, tool } from "@langchain/core/tools";
27
29
  import { InMemoryStore } from "@langchain/core/stores";
28
30
  import { Document, DocumentInput } from "@langchain/core/documents";
29
- export { AIMessage, AIMessageChunk, Action, ActionRequest, AgentMiddleware, ApproveDecision, BaseMessage, BaseMessageChunk, BuiltInState, ClearToolUsesEdit, ClearToolUsesEditConfig, type ContentBlock, ContextEdit, ContextEditingMiddlewareConfig, CreateAgentParams, Decision, DecisionType, DescriptionFactory, Document, type DocumentInput, DynamicStructuredTool, DynamicSystemPromptMiddlewareConfig, DynamicTool, EditDecision, ExecutedToolCall, ExtractZodArrayTypes, FakeToolCallingModel, HITLRequest, HITLResponse, HumanInTheLoopMiddlewareConfig, HumanMessage, HumanMessageChunk, InMemoryStore, Interrupt, InterruptOnConfig, JumpTo, JumpToTarget, LLMToolSelectorConfig, ModelCallLimitMiddlewareConfig, MultipleStructuredOutputsError, MultipleToolsBoundError, N, PIIRedactionMiddlewareConfig, PromptCachingMiddlewareConfig, ProviderStrategy, ReactAgent, RejectDecision, ResponseFormat, ResponseFormatUndefined, ReviewConfig, Runtime, StructuredOutputParsingError, StructuredTool, SummarizationMiddlewareConfig, SystemMessage, SystemMessageChunk, TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, TodoListMiddlewareOptions, TokenCounter, Tool, ToolCall, ToolCallHandler, ToolCallLimitConfig, ToolCallLimitExceededError, ToolCallRequest, ToolInvocationError, ToolMessage, ToolMessageChunk, ToolResult, ToolRetryMiddlewareConfig, type ToolRuntime, ToolStrategy, UserInput, WithStateGraphNodes, WrapToolCallHook, anthropicPromptCachingMiddleware, contextEditingMiddleware, countTokensApproximately, createAgent, createMiddleware, dynamicSystemPromptMiddleware, filterMessages, humanInTheLoopMiddleware, initChatModel, llmToolSelectorMiddleware, modelCallLimitMiddleware, modelFallbackMiddleware, piiRedactionMiddleware, providerStrategy, summarizationMiddleware, todoListMiddleware, tool, toolCallLimitMiddleware, toolRetryMiddleware, toolStrategy, trimMessages };
31
+ export { AIMessage, AIMessageChunk, Action, ActionRequest, AgentMiddleware, ApproveDecision, BaseMessage, BaseMessageChunk, BuiltInPIIType, BuiltInState, ClearToolUsesEdit, ClearToolUsesEditConfig, type ContentBlock, ContextEdit, ContextEditingMiddlewareConfig, CreateAgentParams, Decision, DecisionType, DescriptionFactory, Document, type DocumentInput, DynamicStructuredTool, DynamicSystemPromptMiddlewareConfig, DynamicTool, EditDecision, ExecutedToolCall, ExtractZodArrayTypes, FakeToolCallingModel, HITLRequest, HITLResponse, HumanInTheLoopMiddlewareConfig, HumanMessage, HumanMessageChunk, InMemoryStore, Interrupt, InterruptOnConfig, JumpTo, JumpToTarget, LLMToolSelectorConfig, ModelCallLimitMiddlewareConfig, MultipleStructuredOutputsError, MultipleToolsBoundError, N, PIIDetectionError, PIIDetector, PIIMatch, PIIMiddlewareConfig, PIIRedactionMiddlewareConfig, PIIStrategy, PromptCachingMiddlewareConfig, ProviderStrategy, ReactAgent, RedactionRuleConfig, RejectDecision, ResolvedRedactionRule, ResponseFormat, ResponseFormatUndefined, ReviewConfig, Runtime, StructuredOutputParsingError, StructuredTool, SummarizationMiddlewareConfig, SystemMessage, SystemMessageChunk, TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, TodoListMiddlewareOptions, TokenCounter, Tool, ToolCall, ToolCallHandler, ToolCallLimitConfig, ToolCallLimitExceededError, ToolCallRequest, ToolEmulatorOptions, ToolInvocationError, ToolMessage, ToolMessageChunk, ToolResult, ToolRetryMiddlewareConfig, type ToolRuntime, ToolStrategy, UserInput, WithStateGraphNodes, WrapToolCallHook, anthropicPromptCachingMiddleware, applyStrategy, contextEditingMiddleware, countTokensApproximately, createAgent, createMiddleware, detectCreditCard, detectEmail, detectIP, detectMacAddress, detectUrl, dynamicSystemPromptMiddleware, filterMessages, humanInTheLoopMiddleware, initChatModel, llmToolSelectorMiddleware, modelCallLimitMiddleware, modelFallbackMiddleware, piiMiddleware, piiRedactionMiddleware, providerStrategy, resolveRedactionRule, summarizationMiddleware, todoListMiddleware, tool, toolCallLimitMiddleware, toolEmulatorMiddleware, toolRetryMiddleware, toolStrategy, trimMessages };
package/dist/index.d.ts CHANGED
@@ -9,21 +9,23 @@ import { ReactAgent } from "./agents/ReactAgent.js";
9
9
  import { createMiddleware } from "./agents/middleware.js";
10
10
  import { FakeToolCallingModel } from "./agents/tests/utils.js";
11
11
  import { createAgent } from "./agents/index.js";
12
- import { SummarizationMiddlewareConfig, summarizationMiddleware } from "./agents/middleware/summarization.js";
12
+ import { SummarizationMiddlewareConfig, TokenCounter, summarizationMiddleware } from "./agents/middleware/summarization.js";
13
13
  import { Action, ActionRequest, ApproveDecision, Decision, DecisionType, DescriptionFactory, EditDecision, HITLRequest, HITLResponse, HumanInTheLoopMiddlewareConfig, InterruptOnConfig, RejectDecision, ReviewConfig, humanInTheLoopMiddleware } from "./agents/middleware/hitl.js";
14
14
  import { PromptCachingMiddlewareConfig, anthropicPromptCachingMiddleware } from "./agents/middleware/promptCaching.js";
15
15
  import { DynamicSystemPromptMiddlewareConfig, dynamicSystemPromptMiddleware } from "./agents/middleware/dynamicSystemPrompt.js";
16
16
  import { LLMToolSelectorConfig, llmToolSelectorMiddleware } from "./agents/middleware/llmToolSelector.js";
17
+ import { BuiltInPIIType, PIIDetectionError, PIIDetector, PIIMatch, PIIMiddlewareConfig, PIIStrategy, RedactionRuleConfig, ResolvedRedactionRule, applyStrategy, detectCreditCard, detectEmail, detectIP, detectMacAddress, detectUrl, piiMiddleware, resolveRedactionRule } from "./agents/middleware/pii.js";
17
18
  import { PIIRedactionMiddlewareConfig, piiRedactionMiddleware } from "./agents/middleware/piiRedaction.js";
18
- import { ClearToolUsesEdit, ClearToolUsesEditConfig, ContextEdit, ContextEditingMiddlewareConfig, TokenCounter, contextEditingMiddleware } from "./agents/middleware/contextEditing.js";
19
+ import { ClearToolUsesEdit, ClearToolUsesEditConfig, ContextEdit, ContextEditingMiddlewareConfig, contextEditingMiddleware } from "./agents/middleware/contextEditing.js";
19
20
  import { ToolCallLimitConfig, ToolCallLimitExceededError, toolCallLimitMiddleware } from "./agents/middleware/toolCallLimit.js";
20
21
  import { TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, TodoListMiddlewareOptions, todoListMiddleware } from "./agents/middleware/todoListMiddleware.js";
21
22
  import { ModelCallLimitMiddlewareConfig, modelCallLimitMiddleware } from "./agents/middleware/modelCallLimit.js";
22
23
  import { modelFallbackMiddleware } from "./agents/middleware/modelFallback.js";
23
24
  import { ToolRetryMiddlewareConfig, toolRetryMiddleware } from "./agents/middleware/toolRetry.js";
25
+ import { ToolEmulatorOptions, toolEmulatorMiddleware } from "./agents/middleware/toolEmulator.js";
24
26
  import { countTokensApproximately } from "./agents/middleware/utils.js";
25
27
  import { AIMessage, AIMessageChunk, BaseMessage, BaseMessageChunk, ContentBlock, HumanMessage, HumanMessageChunk, SystemMessage, SystemMessageChunk, ToolMessage, ToolMessageChunk, filterMessages, trimMessages } from "@langchain/core/messages";
26
28
  import { DynamicStructuredTool, DynamicTool, StructuredTool, Tool, ToolRuntime, tool } from "@langchain/core/tools";
27
29
  import { InMemoryStore } from "@langchain/core/stores";
28
30
  import { Document, DocumentInput } from "@langchain/core/documents";
29
- export { AIMessage, AIMessageChunk, Action, ActionRequest, AgentMiddleware, ApproveDecision, BaseMessage, BaseMessageChunk, BuiltInState, ClearToolUsesEdit, ClearToolUsesEditConfig, type ContentBlock, ContextEdit, ContextEditingMiddlewareConfig, CreateAgentParams, Decision, DecisionType, DescriptionFactory, Document, type DocumentInput, DynamicStructuredTool, DynamicSystemPromptMiddlewareConfig, DynamicTool, EditDecision, ExecutedToolCall, ExtractZodArrayTypes, FakeToolCallingModel, HITLRequest, HITLResponse, HumanInTheLoopMiddlewareConfig, HumanMessage, HumanMessageChunk, InMemoryStore, Interrupt, InterruptOnConfig, JumpTo, JumpToTarget, LLMToolSelectorConfig, ModelCallLimitMiddlewareConfig, MultipleStructuredOutputsError, MultipleToolsBoundError, N, PIIRedactionMiddlewareConfig, PromptCachingMiddlewareConfig, ProviderStrategy, ReactAgent, RejectDecision, ResponseFormat, ResponseFormatUndefined, ReviewConfig, Runtime, StructuredOutputParsingError, StructuredTool, SummarizationMiddlewareConfig, SystemMessage, SystemMessageChunk, TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, TodoListMiddlewareOptions, TokenCounter, Tool, ToolCall, ToolCallHandler, ToolCallLimitConfig, ToolCallLimitExceededError, ToolCallRequest, ToolInvocationError, ToolMessage, ToolMessageChunk, ToolResult, ToolRetryMiddlewareConfig, type ToolRuntime, ToolStrategy, UserInput, WithStateGraphNodes, WrapToolCallHook, anthropicPromptCachingMiddleware, contextEditingMiddleware, countTokensApproximately, createAgent, createMiddleware, dynamicSystemPromptMiddleware, filterMessages, humanInTheLoopMiddleware, initChatModel, llmToolSelectorMiddleware, modelCallLimitMiddleware, modelFallbackMiddleware, piiRedactionMiddleware, providerStrategy, summarizationMiddleware, todoListMiddleware, tool, toolCallLimitMiddleware, toolRetryMiddleware, toolStrategy, trimMessages };
31
+ export { AIMessage, AIMessageChunk, Action, ActionRequest, AgentMiddleware, ApproveDecision, BaseMessage, BaseMessageChunk, BuiltInPIIType, BuiltInState, ClearToolUsesEdit, ClearToolUsesEditConfig, type ContentBlock, ContextEdit, ContextEditingMiddlewareConfig, CreateAgentParams, Decision, DecisionType, DescriptionFactory, Document, type DocumentInput, DynamicStructuredTool, DynamicSystemPromptMiddlewareConfig, DynamicTool, EditDecision, ExecutedToolCall, ExtractZodArrayTypes, FakeToolCallingModel, HITLRequest, HITLResponse, HumanInTheLoopMiddlewareConfig, HumanMessage, HumanMessageChunk, InMemoryStore, Interrupt, InterruptOnConfig, JumpTo, JumpToTarget, LLMToolSelectorConfig, ModelCallLimitMiddlewareConfig, MultipleStructuredOutputsError, MultipleToolsBoundError, N, PIIDetectionError, PIIDetector, PIIMatch, PIIMiddlewareConfig, PIIRedactionMiddlewareConfig, PIIStrategy, PromptCachingMiddlewareConfig, ProviderStrategy, ReactAgent, RedactionRuleConfig, RejectDecision, ResolvedRedactionRule, ResponseFormat, ResponseFormatUndefined, ReviewConfig, Runtime, StructuredOutputParsingError, StructuredTool, SummarizationMiddlewareConfig, SystemMessage, SystemMessageChunk, TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, TodoListMiddlewareOptions, TokenCounter, Tool, ToolCall, ToolCallHandler, ToolCallLimitConfig, ToolCallLimitExceededError, ToolCallRequest, ToolEmulatorOptions, ToolInvocationError, ToolMessage, ToolMessageChunk, ToolResult, ToolRetryMiddlewareConfig, type ToolRuntime, ToolStrategy, UserInput, WithStateGraphNodes, WrapToolCallHook, anthropicPromptCachingMiddleware, applyStrategy, contextEditingMiddleware, countTokensApproximately, createAgent, createMiddleware, detectCreditCard, detectEmail, detectIP, detectMacAddress, detectUrl, dynamicSystemPromptMiddleware, filterMessages, humanInTheLoopMiddleware, initChatModel, llmToolSelectorMiddleware, modelCallLimitMiddleware, modelFallbackMiddleware, piiMiddleware, piiRedactionMiddleware, providerStrategy, resolveRedactionRule, summarizationMiddleware, todoListMiddleware, tool, toolCallLimitMiddleware, toolEmulatorMiddleware, toolRetryMiddleware, toolStrategy, trimMessages };
package/dist/index.js CHANGED
@@ -11,6 +11,7 @@ import { humanInTheLoopMiddleware } from "./agents/middleware/hitl.js";
11
11
  import { anthropicPromptCachingMiddleware } from "./agents/middleware/promptCaching.js";
12
12
  import { dynamicSystemPromptMiddleware } from "./agents/middleware/dynamicSystemPrompt.js";
13
13
  import { llmToolSelectorMiddleware } from "./agents/middleware/llmToolSelector.js";
14
+ import { PIIDetectionError, applyStrategy, detectCreditCard, detectEmail, detectIP, detectMacAddress, detectUrl, piiMiddleware, resolveRedactionRule } from "./agents/middleware/pii.js";
14
15
  import { piiRedactionMiddleware } from "./agents/middleware/piiRedaction.js";
15
16
  import { ClearToolUsesEdit, contextEditingMiddleware } from "./agents/middleware/contextEditing.js";
16
17
  import { ToolCallLimitExceededError, toolCallLimitMiddleware } from "./agents/middleware/toolCallLimit.js";
@@ -18,6 +19,7 @@ import { TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, todoListMiddleware } from "./agents
18
19
  import { modelCallLimitMiddleware } from "./agents/middleware/modelCallLimit.js";
19
20
  import { modelFallbackMiddleware } from "./agents/middleware/modelFallback.js";
20
21
  import { toolRetryMiddleware } from "./agents/middleware/toolRetry.js";
22
+ import { toolEmulatorMiddleware } from "./agents/middleware/toolEmulator.js";
21
23
  import "./agents/middleware/index.js";
22
24
  import { AIMessage, AIMessageChunk, BaseMessage, BaseMessageChunk, HumanMessage, HumanMessageChunk, SystemMessage, SystemMessageChunk, ToolMessage, ToolMessageChunk, filterMessages, trimMessages } from "@langchain/core/messages";
23
25
  import { DynamicStructuredTool, DynamicTool, StructuredTool, Tool, tool } from "@langchain/core/tools";
@@ -41,6 +43,7 @@ __export(src_exports, {
41
43
  InMemoryStore: () => InMemoryStore,
42
44
  MultipleStructuredOutputsError: () => MultipleStructuredOutputsError,
43
45
  MultipleToolsBoundError: () => MultipleToolsBoundError,
46
+ PIIDetectionError: () => PIIDetectionError,
44
47
  ProviderStrategy: () => ProviderStrategy,
45
48
  StructuredOutputParsingError: () => StructuredOutputParsingError,
46
49
  StructuredTool: () => StructuredTool,
@@ -54,10 +57,16 @@ __export(src_exports, {
54
57
  ToolMessageChunk: () => ToolMessageChunk,
55
58
  ToolStrategy: () => ToolStrategy,
56
59
  anthropicPromptCachingMiddleware: () => anthropicPromptCachingMiddleware,
60
+ applyStrategy: () => applyStrategy,
57
61
  contextEditingMiddleware: () => contextEditingMiddleware,
58
62
  countTokensApproximately: () => countTokensApproximately,
59
63
  createAgent: () => createAgent,
60
64
  createMiddleware: () => createMiddleware,
65
+ detectCreditCard: () => detectCreditCard,
66
+ detectEmail: () => detectEmail,
67
+ detectIP: () => detectIP,
68
+ detectMacAddress: () => detectMacAddress,
69
+ detectUrl: () => detectUrl,
61
70
  dynamicSystemPromptMiddleware: () => dynamicSystemPromptMiddleware,
62
71
  filterMessages: () => filterMessages,
63
72
  humanInTheLoopMiddleware: () => humanInTheLoopMiddleware,
@@ -65,17 +74,20 @@ __export(src_exports, {
65
74
  llmToolSelectorMiddleware: () => llmToolSelectorMiddleware,
66
75
  modelCallLimitMiddleware: () => modelCallLimitMiddleware,
67
76
  modelFallbackMiddleware: () => modelFallbackMiddleware,
77
+ piiMiddleware: () => piiMiddleware,
68
78
  piiRedactionMiddleware: () => piiRedactionMiddleware,
69
79
  providerStrategy: () => providerStrategy,
80
+ resolveRedactionRule: () => resolveRedactionRule,
70
81
  summarizationMiddleware: () => summarizationMiddleware,
71
82
  todoListMiddleware: () => todoListMiddleware,
72
83
  tool: () => tool,
73
84
  toolCallLimitMiddleware: () => toolCallLimitMiddleware,
85
+ toolEmulatorMiddleware: () => toolEmulatorMiddleware,
74
86
  toolRetryMiddleware: () => toolRetryMiddleware,
75
87
  toolStrategy: () => toolStrategy,
76
88
  trimMessages: () => trimMessages
77
89
  });
78
90
 
79
91
  //#endregion
80
- export { AIMessage, AIMessageChunk, BaseMessage, BaseMessageChunk, ClearToolUsesEdit, Document, DynamicStructuredTool, DynamicTool, FakeToolCallingModel, HumanMessage, HumanMessageChunk, InMemoryStore, MultipleStructuredOutputsError, MultipleToolsBoundError, ProviderStrategy, StructuredOutputParsingError, StructuredTool, SystemMessage, SystemMessageChunk, TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, Tool, ToolCallLimitExceededError, ToolInvocationError, ToolMessage, ToolMessageChunk, ToolStrategy, anthropicPromptCachingMiddleware, contextEditingMiddleware, countTokensApproximately, createAgent, createMiddleware, dynamicSystemPromptMiddleware, filterMessages, humanInTheLoopMiddleware, initChatModel, llmToolSelectorMiddleware, modelCallLimitMiddleware, modelFallbackMiddleware, piiRedactionMiddleware, providerStrategy, src_exports, summarizationMiddleware, todoListMiddleware, tool, toolCallLimitMiddleware, toolRetryMiddleware, toolStrategy, trimMessages };
92
+ export { AIMessage, AIMessageChunk, BaseMessage, BaseMessageChunk, ClearToolUsesEdit, Document, DynamicStructuredTool, DynamicTool, FakeToolCallingModel, HumanMessage, HumanMessageChunk, InMemoryStore, MultipleStructuredOutputsError, MultipleToolsBoundError, PIIDetectionError, ProviderStrategy, StructuredOutputParsingError, StructuredTool, SystemMessage, SystemMessageChunk, TODO_LIST_MIDDLEWARE_SYSTEM_PROMPT, Tool, ToolCallLimitExceededError, ToolInvocationError, ToolMessage, ToolMessageChunk, ToolStrategy, anthropicPromptCachingMiddleware, applyStrategy, contextEditingMiddleware, countTokensApproximately, createAgent, createMiddleware, detectCreditCard, detectEmail, detectIP, detectMacAddress, detectUrl, dynamicSystemPromptMiddleware, filterMessages, humanInTheLoopMiddleware, initChatModel, llmToolSelectorMiddleware, modelCallLimitMiddleware, modelFallbackMiddleware, piiMiddleware, piiRedactionMiddleware, providerStrategy, resolveRedactionRule, src_exports, summarizationMiddleware, todoListMiddleware, tool, toolCallLimitMiddleware, toolEmulatorMiddleware, toolRetryMiddleware, toolStrategy, trimMessages };
81
93
  //# sourceMappingURL=index.js.map