@langchain/langgraph 1.2.5 → 1.2.7
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.
- package/dist/channels/base.cjs.map +1 -1
- package/dist/channels/base.js.map +1 -1
- package/dist/channels/binop.cjs.map +1 -1
- package/dist/channels/binop.js.map +1 -1
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js.map +1 -1
- package/dist/func/types.d.cts.map +1 -1
- package/dist/func/types.d.ts.map +1 -1
- package/dist/graph/annotation.cjs.map +1 -1
- package/dist/graph/annotation.d.cts.map +1 -1
- package/dist/graph/annotation.d.ts.map +1 -1
- package/dist/graph/annotation.js.map +1 -1
- package/dist/graph/graph.cjs +2 -2
- package/dist/graph/graph.cjs.map +1 -1
- package/dist/graph/graph.d.cts.map +1 -1
- package/dist/graph/graph.d.ts.map +1 -1
- package/dist/graph/graph.js +2 -2
- package/dist/graph/graph.js.map +1 -1
- package/dist/graph/state.cjs.map +1 -1
- package/dist/graph/state.d.cts.map +1 -1
- package/dist/graph/state.d.ts.map +1 -1
- package/dist/graph/state.js.map +1 -1
- package/dist/graph/types.cjs.map +1 -1
- package/dist/graph/types.d.cts.map +1 -1
- package/dist/graph/types.d.ts.map +1 -1
- package/dist/graph/types.js.map +1 -1
- package/dist/graph/zod/meta.cjs.map +1 -1
- package/dist/graph/zod/meta.d.cts.map +1 -1
- package/dist/graph/zod/meta.d.ts.map +1 -1
- package/dist/graph/zod/meta.js.map +1 -1
- package/dist/graph/zod/zod-registry.cjs.map +1 -1
- package/dist/graph/zod/zod-registry.d.cts.map +1 -1
- package/dist/graph/zod/zod-registry.d.ts.map +1 -1
- package/dist/graph/zod/zod-registry.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/interrupt.cjs.map +1 -1
- package/dist/interrupt.d.cts.map +1 -1
- package/dist/interrupt.d.ts.map +1 -1
- package/dist/interrupt.js.map +1 -1
- package/dist/prebuilt/react_agent_executor.cjs.map +1 -1
- package/dist/prebuilt/react_agent_executor.d.cts.map +1 -1
- package/dist/prebuilt/react_agent_executor.d.ts.map +1 -1
- package/dist/prebuilt/react_agent_executor.js.map +1 -1
- package/dist/prebuilt/tool_executor.cjs.map +1 -1
- package/dist/prebuilt/tool_executor.d.cts.map +1 -1
- package/dist/prebuilt/tool_executor.d.ts.map +1 -1
- package/dist/prebuilt/tool_executor.js.map +1 -1
- package/dist/pregel/algo.cjs.map +1 -1
- package/dist/pregel/algo.js.map +1 -1
- package/dist/pregel/debug.cjs.map +1 -1
- package/dist/pregel/debug.js.map +1 -1
- package/dist/pregel/index.cjs +8 -6
- package/dist/pregel/index.cjs.map +1 -1
- package/dist/pregel/index.d.cts.map +1 -1
- package/dist/pregel/index.d.ts.map +1 -1
- package/dist/pregel/index.js +8 -6
- package/dist/pregel/index.js.map +1 -1
- package/dist/pregel/loop.cjs +20 -4
- package/dist/pregel/loop.cjs.map +1 -1
- package/dist/pregel/loop.js +20 -4
- package/dist/pregel/loop.js.map +1 -1
- package/dist/pregel/read.cjs.map +1 -1
- package/dist/pregel/read.d.cts.map +1 -1
- package/dist/pregel/read.d.ts.map +1 -1
- package/dist/pregel/read.js.map +1 -1
- package/dist/pregel/remote.cjs.map +1 -1
- package/dist/pregel/remote.d.cts.map +1 -1
- package/dist/pregel/remote.d.ts.map +1 -1
- package/dist/pregel/remote.js.map +1 -1
- package/dist/pregel/retry.cjs.map +1 -1
- package/dist/pregel/retry.js.map +1 -1
- package/dist/pregel/runnable_types.d.cts.map +1 -1
- package/dist/pregel/runnable_types.d.ts.map +1 -1
- package/dist/pregel/stream.cjs +2 -8
- package/dist/pregel/stream.cjs.map +1 -1
- package/dist/pregel/stream.js +2 -8
- package/dist/pregel/stream.js.map +1 -1
- package/dist/pregel/types.cjs.map +1 -1
- package/dist/pregel/types.d.cts.map +1 -1
- package/dist/pregel/types.d.ts.map +1 -1
- package/dist/pregel/types.js.map +1 -1
- package/dist/pregel/utils/index.cjs +1 -12
- package/dist/pregel/utils/index.cjs.map +1 -1
- package/dist/pregel/utils/index.js +1 -12
- package/dist/pregel/utils/index.js.map +1 -1
- package/dist/pregel/validate.cjs.map +1 -1
- package/dist/pregel/validate.js.map +1 -1
- package/dist/pregel/write.cjs.map +1 -1
- package/dist/pregel/write.js.map +1 -1
- package/dist/state/schema.cjs.map +1 -1
- package/dist/state/schema.d.cts.map +1 -1
- package/dist/state/schema.d.ts.map +1 -1
- package/dist/state/schema.js.map +1 -1
- package/dist/state/types.cjs.map +1 -1
- package/dist/state/types.d.cts.map +1 -1
- package/dist/state/types.d.ts.map +1 -1
- package/dist/state/types.js.map +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js.map +1 -1
- package/dist/web.cjs +11 -0
- package/dist/web.d.cts +6 -3
- package/dist/web.d.ts +6 -3
- package/dist/web.js +6 -3
- package/package.json +8 -20
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/state/schema.ts"],"mappings":";;;;;;;;;cAmBM,mBAAA;;;AAFiD;;;;;AA2BvD;;;;;;;;;;;;;;;;KAAY,yBAAA,
|
|
1
|
+
{"version":3,"file":"schema.d.ts","names":[],"sources":["../../src/state/schema.ts"],"mappings":";;;;;;;;;cAmBM,mBAAA;;;AAFiD;;;;;AA2BvD;;;;;;;;;;;;;;;;KAAY,yBAAA,MACV,CAAA,SAAU,YAAA,qBACN,WAAA,CAAY,CAAA,EAAG,cAAA,CAAe,CAAA,IAAK,CAAA,IACnC,CAAA,SAAU,cAAA,YACR,WAAA,CAAY,CAAA,EAAG,CAAA,IACf,CAAA,SAAU,kBAAA,qBACR,WAAA,CAAY,CAAA,EAAG,CAAA,IACf,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+BE,kCAAA,iBACM,iBAAA,kBAEJ,OAAA,GAAU,yBAAA,CAA0B,OAAA,CAAQ,CAAA;AAH1D;;;;AAAA,KAUY,gBAAA,2BAA2C,KAAA,IACnD,YAAA,CAAa,KAAA,EAAO,MAAA,IACpB,cAAA,CAAe,MAAA,IACf,kBAAA,CAAmB,KAAA,EAAO,MAAA;;;;;KAMlB,iBAAA;EAAA,CACT,GAAA,WAAc,gBAAA;AAAA;;;;;;;;AAVjB;KAqBY,qBAAA,iBAAsC,iBAAA,kBACpC,OAAA,GAAU,OAAA,CAAQ,CAAA,UAAW,YAAA,aACrC,OAAA,CAAQ,CAAA,iBACR,OAAA,CAAQ,CAAA,UAAW,cAAA,QACjB,OAAA,CAAQ,CAAA,iBACR,OAAA,CAAQ,CAAA,UAAW,kBAAA,uBACjB,OAAA;;;;;;;;;KAYE,sBAAA,iBAAuC,iBAAA,kBACrC,OAAA,IAAW,OAAA,CAAQ,CAAA,UAAW,YAAA,qBACtC,cAAA,CAAe,CAAA,IAAK,CAAA,GACpB,OAAA,CAAQ,CAAA,UAAW,cAAA,QACjB,OAAA,CAAQ,CAAA,iBACR,OAAA,CAAQ,CAAA,UAAW,kBAAA,sBACjB,MAAA;;;;;;;;;;;;;AApCV;;;;;AAYA;;;;;;;;;;;;;;;;cA6Da,WAAA,iBAA4B,iBAAA;EAAA,SAwClB,MAAA,EAAQ,OAAA;EAhGc;;;;EAAA,kBA8DzB,mBAAA;EAlEN;;;;EAwEJ,KAAA,EAAO,qBAAA,CAAsB,OAAA;EAvEzB;;;;EA6EJ,MAAA,EAAQ,sBAAA,CAAuB,OAAA;EA3EzB;;;;;;;;AAchB;;;;;;;EA8EU,IAAA,EAAM,YAAA,CACZ,qBAAA,CAAsB,OAAA,GACtB,sBAAA,CAAuB,OAAA;EAGzB,WAAA,CAAqB,MAAA,EAAQ,OAAA;EAjFzB;;;;EAuFJ,WAAA,CAAA,GAAe,MAAA,SAAe,WAAA;EArFxB;;;;EA2HN,aAAA,CAAA,GAAiB,UAAA;EA1H0B;;;;EAgL3C,kBAAA,CAAA,GAAsB,UAAA;EApLV;;;EAwNZ,cAAA,CAAA;EAxN6D;;;EA+N7D,UAAA,CAAA;EA9NwB;;;;;;;EAyOlB,aAAA,GAAA,CAAiB,IAAA,EAAM,CAAA,GAAI,OAAA,CAAQ,CAAA;EAtOhB;;;;;AAsC3B;EAtC2B,OA2RlB,UAAA,iBAA2B,iBAAA,CAAA,CAChC,KAAA,EAAO,WAAA,CAAY,OAAA,IAClB,KAAA,IAAS,WAAA,CAAY,OAAA;EAAA,OAEjB,UAAA,CAAW,KAAA,YAAiB,KAAA,IAAS,WAAA;AAAA;AAAA,KAclC,cAAA,GAAiB,WAAA"}
|
package/dist/state/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","names":[],"sources":["../../src/state/schema.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { JSONSchema } from \"@langchain/core/utils/json_schema\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\nimport type { RunnableLike } from \"../pregel/runnable_types.js\";\nimport {\n BaseChannel,\n LastValue,\n BinaryOperatorAggregate,\n} from \"../channels/index.js\";\nimport { UntrackedValueChannel } from \"../channels/untracked_value.js\";\n\nimport type { SerializableSchema } from \"./types.js\";\nimport { isStandardSchema } from \"./types.js\";\nimport { getJsonSchemaFromSchema, getSchemaDefaultGetter } from \"./adapter.js\";\nimport type { OverwriteValue } from \"../constants.js\";\nimport { ReducedValue } from \"./values/reduced.js\";\nimport { UntrackedValue } from \"./values/untracked.js\";\n\nconst STATE_SCHEMA_SYMBOL = Symbol.for(\"langgraph.state.state_schema\");\n\n/**\n * Maps a single StateSchema field definition to its corresponding Channel type.\n *\n * This utility type inspects the type of the field and returns an appropriate\n * `BaseChannel` type, parameterized with the state \"value\" and \"input\" types according to the field's shape.\n *\n * Rules:\n * - If the field (`F`) is a `ReducedValue<V, I>`, the channel will store values of type `V`\n * and accept input of type `I`.\n * - If the field is a `UntrackedValue<V>`, the channel will store and accept values of type `V`.\n * - If the field is a `SerializableSchema<I, O>`, the channel will store values of type `O`\n * (the schema's output/validated value) and accept input of type `I`.\n * - For all other types, a generic `BaseChannel<unknown, unknown>` is used as fallback.\n *\n * @template F - The StateSchema field type to map to a Channel type.\n *\n * @example\n * ```typescript\n * type MyField = ReducedValue<number, string>;\n * type ChannelType = StateSchemaFieldToChannel<MyField>;\n * // ChannelType is BaseChannel<number, string>\n * ```\n */\nexport type StateSchemaFieldToChannel<F> = F extends ReducedValue<\n infer V,\n infer I\n>\n ? BaseChannel<V, OverwriteValue<V> | I>\n : F extends UntrackedValue<infer V>\n ? BaseChannel<V, V>\n : F extends SerializableSchema<infer I, infer O>\n ? BaseChannel<O, I>\n : BaseChannel<unknown, unknown>;\n\n/**\n * Converts StateSchema fields into a strongly-typed\n * State Definition object, where each field is mapped to its channel type.\n *\n * This utility type is used internally to create the shape of the state channels for a given schema,\n * substituting each field with the result of `StateSchemaFieldToChannel`.\n *\n * If you define a state schema as:\n * ```typescript\n * const fields = {\n * a: ReducedValue<number, string>(),\n * b: UntrackedValue<boolean>(),\n * c: SomeSerializableSchemaType, // SerializableSchema<in, out>\n * }\n * ```\n * then `StateSchemaFieldsToStateDefinition<typeof fields>` yields:\n * ```typescript\n * {\n * a: BaseChannel<number, string>;\n * b: BaseChannel<boolean, boolean>;\n * c: BaseChannel<typeof schema's output type, typeof schema's input type>;\n * }\n * ```\n *\n * @template TFields - The mapping of field names to StateSchema field types.\n * @returns An object type mapping field names to channel types.\n *\n * @see StateSchemaFieldToChannel\n */\nexport type StateSchemaFieldsToStateDefinition<\n TFields extends StateSchemaFields\n> = {\n [K in keyof TFields]: StateSchemaFieldToChannel<TFields[K]>;\n};\n\n/**\n * Valid field types for StateSchema.\n * Either a LangGraph state value type or a raw schema (e.g., Zod schema).\n */\nexport type StateSchemaField<Input = unknown, Output = Input> =\n | ReducedValue<Input, Output>\n | UntrackedValue<Output>\n | SerializableSchema<Input, Output>;\n\n/**\n * Init object for StateSchema constructor.\n * Uses `any` to allow variance in generic types (e.g., ReducedValue<string, string[]>).\n */\nexport type StateSchemaFields = {\n [key: string]: StateSchemaField<any, any>;\n};\n\n/**\n * Infer the State type from a StateSchemaFields.\n * This is the type of the full state object.\n *\n * - ReducedValue<Value, Input> → Value (the stored type)\n * - UntrackedValue<Value> → Value\n * - SerializableSchema<Input, Output> → Output (the validated type)\n */\nexport type InferStateSchemaValue<TFields extends StateSchemaFields> = {\n [K in keyof TFields]: TFields[K] extends ReducedValue<any, any>\n ? TFields[K][\"ValueType\"]\n : TFields[K] extends UntrackedValue<any>\n ? TFields[K][\"ValueType\"]\n : TFields[K] extends SerializableSchema<any, infer TOutput>\n ? TOutput\n : never;\n};\n\n/**\n * Infer the Update type from a StateSchemaFields.\n * This is the type for partial updates to state.\n *\n * - ReducedValue<Value, Input> → Input (the reducer input type)\n * - UntrackedValue<Value> → Value\n * - SerializableSchema<Input, Output> → Input (what you provide)\n */\nexport type InferStateSchemaUpdate<TFields extends StateSchemaFields> = {\n [K in keyof TFields]?: TFields[K] extends ReducedValue<infer V, infer I>\n ? OverwriteValue<V> | I\n : TFields[K] extends UntrackedValue<any>\n ? TFields[K][\"ValueType\"]\n : TFields[K] extends SerializableSchema<infer TInput, any>\n ? TInput\n : never;\n};\n\n/**\n * StateSchema provides a unified API for defining LangGraph state schemas.\n *\n * @example\n * ```ts\n * import { z } from \"zod\";\n * import { StateSchema, ReducedValue, MessagesValue } from \"@langchain/langgraph\";\n *\n * const AgentState = new StateSchema({\n * // Prebuilt messages value\n * messages: MessagesValue,\n * // Basic LastValue channel from any standard schema\n * currentStep: z.string(),\n * // LastValue with native default\n * count: z.number().default(0),\n * // ReducedValue for fields needing reducers\n * history: new ReducedValue(\n * z.array(z.string()).default(() => []),\n * {\n * inputSchema: z.string(),\n * reducer: (current, next) => [...current, next],\n * }\n * ),\n * });\n *\n * // Extract types\n * type State = typeof AgentState.State;\n * type Update = typeof AgentState.Update;\n *\n * // Use in StateGraph\n * const graph = new StateGraph(AgentState);\n * ```\n */\nexport class StateSchema<TFields extends StateSchemaFields> {\n /**\n * Symbol for runtime identification.\n * @internal Used by isInstance for runtime type checking\n */\n // @ts-expect-error - Symbol is read via `in` operator in isInstance\n private readonly [STATE_SCHEMA_SYMBOL] = true;\n\n /**\n * Type declaration for the full state type.\n * Use: `typeof myState.State`\n */\n declare State: InferStateSchemaValue<TFields>;\n\n /**\n * Type declaration for the update type.\n * Use: `typeof myState.Update`\n */\n declare Update: InferStateSchemaUpdate<TFields>;\n\n /**\n * Type declaration for node functions.\n * Use: `typeof myState.Node` to type node functions outside the graph builder.\n *\n * @example\n * ```typescript\n * const AgentState = new StateSchema({\n * count: z.number().default(0),\n * });\n *\n * const myNode: typeof AgentState.Node = (state) => {\n * return { count: state.count + 1 };\n * };\n * ```\n */\n declare Node: RunnableLike<\n InferStateSchemaValue<TFields>,\n InferStateSchemaUpdate<TFields>\n >;\n\n constructor(readonly fields: TFields) {}\n\n /**\n * Get the channel definitions for use with StateGraph.\n * This converts the StateSchema fields into BaseChannel instances.\n */\n getChannels(): Record<string, BaseChannel> {\n const channels: Record<string, BaseChannel> = {};\n\n for (const [key, value] of Object.entries(this.fields)) {\n if (ReducedValue.isInstance(value)) {\n // ReducedValue -> BinaryOperatorAggregate\n const defaultGetter = getSchemaDefaultGetter(value.valueSchema);\n channels[key] = new BinaryOperatorAggregate(\n value.reducer,\n defaultGetter\n );\n } else if (UntrackedValue.isInstance(value)) {\n // UntrackedValue -> UntrackedValueChannel\n const defaultGetter = value.schema\n ? getSchemaDefaultGetter(value.schema)\n : undefined;\n channels[key] = new UntrackedValueChannel({\n guard: value.guard,\n initialValueFactory: defaultGetter,\n });\n } else if (isStandardSchema(value)) {\n // Plain schema -> LastValue channel\n const defaultGetter = getSchemaDefaultGetter(value);\n channels[key] = new LastValue(defaultGetter);\n } else {\n throw new Error(\n `Invalid state field \"${key}\": must be a schema, ReducedValue, UntrackedValue, or ManagedValue`\n );\n }\n }\n\n return channels;\n }\n\n /**\n * Get the JSON schema for the full state type.\n * Used by Studio and API for schema introspection.\n */\n getJsonSchema(): JSONSchema {\n const properties: Record<string, JSONSchema> = {};\n const required: string[] = [];\n\n for (const [key, value] of Object.entries(this.fields)) {\n let fieldSchema: JSONSchema | undefined;\n\n if (ReducedValue.isInstance(value)) {\n fieldSchema = getJsonSchemaFromSchema(value.valueSchema) as JSONSchema;\n // Merge jsonSchemaExtra (e.g. langgraph_type) into the field schema,\n // even if base schema is undefined\n if (value.jsonSchemaExtra) {\n fieldSchema = { ...(fieldSchema ?? {}), ...value.jsonSchemaExtra };\n }\n } else if (UntrackedValue.isInstance(value)) {\n fieldSchema = value.schema\n ? (getJsonSchemaFromSchema(value.schema) as JSONSchema)\n : undefined;\n } else if (isStandardSchema(value)) {\n fieldSchema = getJsonSchemaFromSchema(value) as JSONSchema;\n }\n\n if (fieldSchema) {\n properties[key] = fieldSchema;\n\n // Field is required if it doesn't have a default\n let hasDefault = false;\n if (ReducedValue.isInstance(value)) {\n hasDefault = getSchemaDefaultGetter(value.valueSchema) !== undefined;\n } else if (UntrackedValue.isInstance(value)) {\n hasDefault = value.schema\n ? getSchemaDefaultGetter(value.schema) !== undefined\n : false;\n } else {\n hasDefault = getSchemaDefaultGetter(value) !== undefined;\n }\n\n if (!hasDefault) {\n required.push(key);\n }\n }\n }\n\n return {\n type: \"object\",\n properties,\n required: required.length > 0 ? required : undefined,\n };\n }\n\n /**\n * Get the JSON schema for the update/input type.\n * All fields are optional in updates.\n */\n getInputJsonSchema(): JSONSchema {\n const properties: Record<string, JSONSchema> = {};\n\n for (const [key, value] of Object.entries(this.fields)) {\n let fieldSchema: JSONSchema | undefined;\n\n if (ReducedValue.isInstance(value)) {\n // Use input schema for updates\n fieldSchema = getJsonSchemaFromSchema(value.inputSchema) as JSONSchema;\n // Merge jsonSchemaExtra (e.g. langgraph_type) into the field schema,\n // even if base schema is undefined\n if (value.jsonSchemaExtra) {\n fieldSchema = { ...(fieldSchema ?? {}), ...value.jsonSchemaExtra };\n }\n } else if (UntrackedValue.isInstance(value)) {\n fieldSchema = value.schema\n ? (getJsonSchemaFromSchema(value.schema) as JSONSchema)\n : undefined;\n } else if (isStandardSchema(value)) {\n fieldSchema = getJsonSchemaFromSchema(value) as JSONSchema;\n }\n\n if (fieldSchema) {\n properties[key] = fieldSchema;\n }\n }\n\n return {\n type: \"object\",\n properties,\n };\n }\n\n /**\n * Get the list of channel keys (excluding managed values).\n */\n getChannelKeys(): string[] {\n return Object.entries(this.fields).map(([key]) => key);\n }\n\n /**\n * Get all keys (channels + managed values).\n */\n getAllKeys(): string[] {\n return Object.keys(this.fields);\n }\n\n /**\n * Validate input data against the schema.\n * This validates each field using its corresponding schema.\n *\n * @param data - The input data to validate\n * @returns The validated data with coerced types\n */\n async validateInput<T>(data: T): Promise<T> {\n if (data == null || typeof data !== \"object\") {\n return data;\n }\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(data)) {\n const fieldDef = this.fields[key];\n\n if (fieldDef === undefined) {\n // Unknown field, pass through\n result[key] = value;\n continue;\n }\n\n // Get the schema to use for validation\n let schema: StandardSchemaV1 | undefined;\n\n if (ReducedValue.isInstance(fieldDef)) {\n schema = fieldDef.inputSchema;\n } else if (UntrackedValue.isInstance(fieldDef)) {\n schema = fieldDef.schema;\n } else if (isStandardSchema(fieldDef)) {\n schema = fieldDef;\n }\n\n if (schema) {\n // Validate using standard schema\n const validationResult = await schema[\"~standard\"].validate(value);\n if (validationResult.issues) {\n throw new Error(\n `Validation failed for field \"${key}\": ${JSON.stringify(\n validationResult.issues\n )}`\n );\n }\n result[key] = validationResult.value;\n } else {\n // No schema or not a standard schema, pass through\n result[key] = value;\n }\n }\n\n return result as T;\n }\n\n /**\n * Type guard to check if a value is a StateSchema instance.\n *\n * @param value - The value to check.\n * @returns True if the value is a StateSchema instance with the correct runtime tag.\n */\n static isInstance<TFields extends StateSchemaFields>(\n value: StateSchema<TFields>\n ): value is StateSchema<TFields>;\n\n static isInstance(value: unknown): value is StateSchema<any>;\n\n static isInstance<TFields extends StateSchemaFields>(\n value: unknown\n ): value is StateSchema<TFields> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n STATE_SCHEMA_SYMBOL in value &&\n value[STATE_SCHEMA_SYMBOL] === true\n );\n }\n}\n\nexport type AnyStateSchema = StateSchema<any>;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"schema.js","names":[],"sources":["../../src/state/schema.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { JSONSchema } from \"@langchain/core/utils/json_schema\";\nimport type { StandardSchemaV1 } from \"@standard-schema/spec\";\n\nimport type { RunnableLike } from \"../pregel/runnable_types.js\";\nimport {\n BaseChannel,\n LastValue,\n BinaryOperatorAggregate,\n} from \"../channels/index.js\";\nimport { UntrackedValueChannel } from \"../channels/untracked_value.js\";\n\nimport type { SerializableSchema } from \"./types.js\";\nimport { isStandardSchema } from \"./types.js\";\nimport { getJsonSchemaFromSchema, getSchemaDefaultGetter } from \"./adapter.js\";\nimport type { OverwriteValue } from \"../constants.js\";\nimport { ReducedValue } from \"./values/reduced.js\";\nimport { UntrackedValue } from \"./values/untracked.js\";\n\nconst STATE_SCHEMA_SYMBOL = Symbol.for(\"langgraph.state.state_schema\");\n\n/**\n * Maps a single StateSchema field definition to its corresponding Channel type.\n *\n * This utility type inspects the type of the field and returns an appropriate\n * `BaseChannel` type, parameterized with the state \"value\" and \"input\" types according to the field's shape.\n *\n * Rules:\n * - If the field (`F`) is a `ReducedValue<V, I>`, the channel will store values of type `V`\n * and accept input of type `I`.\n * - If the field is a `UntrackedValue<V>`, the channel will store and accept values of type `V`.\n * - If the field is a `SerializableSchema<I, O>`, the channel will store values of type `O`\n * (the schema's output/validated value) and accept input of type `I`.\n * - For all other types, a generic `BaseChannel<unknown, unknown>` is used as fallback.\n *\n * @template F - The StateSchema field type to map to a Channel type.\n *\n * @example\n * ```typescript\n * type MyField = ReducedValue<number, string>;\n * type ChannelType = StateSchemaFieldToChannel<MyField>;\n * // ChannelType is BaseChannel<number, string>\n * ```\n */\nexport type StateSchemaFieldToChannel<F> =\n F extends ReducedValue<infer V, infer I>\n ? BaseChannel<V, OverwriteValue<V> | I>\n : F extends UntrackedValue<infer V>\n ? BaseChannel<V, V>\n : F extends SerializableSchema<infer I, infer O>\n ? BaseChannel<O, I>\n : BaseChannel<unknown, unknown>;\n\n/**\n * Converts StateSchema fields into a strongly-typed\n * State Definition object, where each field is mapped to its channel type.\n *\n * This utility type is used internally to create the shape of the state channels for a given schema,\n * substituting each field with the result of `StateSchemaFieldToChannel`.\n *\n * If you define a state schema as:\n * ```typescript\n * const fields = {\n * a: ReducedValue<number, string>(),\n * b: UntrackedValue<boolean>(),\n * c: SomeSerializableSchemaType, // SerializableSchema<in, out>\n * }\n * ```\n * then `StateSchemaFieldsToStateDefinition<typeof fields>` yields:\n * ```typescript\n * {\n * a: BaseChannel<number, string>;\n * b: BaseChannel<boolean, boolean>;\n * c: BaseChannel<typeof schema's output type, typeof schema's input type>;\n * }\n * ```\n *\n * @template TFields - The mapping of field names to StateSchema field types.\n * @returns An object type mapping field names to channel types.\n *\n * @see StateSchemaFieldToChannel\n */\nexport type StateSchemaFieldsToStateDefinition<\n TFields extends StateSchemaFields,\n> = {\n [K in keyof TFields]: StateSchemaFieldToChannel<TFields[K]>;\n};\n\n/**\n * Valid field types for StateSchema.\n * Either a LangGraph state value type or a raw schema (e.g., Zod schema).\n */\nexport type StateSchemaField<Input = unknown, Output = Input> =\n | ReducedValue<Input, Output>\n | UntrackedValue<Output>\n | SerializableSchema<Input, Output>;\n\n/**\n * Init object for StateSchema constructor.\n * Uses `any` to allow variance in generic types (e.g., ReducedValue<string, string[]>).\n */\nexport type StateSchemaFields = {\n [key: string]: StateSchemaField<any, any>;\n};\n\n/**\n * Infer the State type from a StateSchemaFields.\n * This is the type of the full state object.\n *\n * - ReducedValue<Value, Input> → Value (the stored type)\n * - UntrackedValue<Value> → Value\n * - SerializableSchema<Input, Output> → Output (the validated type)\n */\nexport type InferStateSchemaValue<TFields extends StateSchemaFields> = {\n [K in keyof TFields]: TFields[K] extends ReducedValue<any, any>\n ? TFields[K][\"ValueType\"]\n : TFields[K] extends UntrackedValue<any>\n ? TFields[K][\"ValueType\"]\n : TFields[K] extends SerializableSchema<any, infer TOutput>\n ? TOutput\n : never;\n};\n\n/**\n * Infer the Update type from a StateSchemaFields.\n * This is the type for partial updates to state.\n *\n * - ReducedValue<Value, Input> → Input (the reducer input type)\n * - UntrackedValue<Value> → Value\n * - SerializableSchema<Input, Output> → Input (what you provide)\n */\nexport type InferStateSchemaUpdate<TFields extends StateSchemaFields> = {\n [K in keyof TFields]?: TFields[K] extends ReducedValue<infer V, infer I>\n ? OverwriteValue<V> | I\n : TFields[K] extends UntrackedValue<any>\n ? TFields[K][\"ValueType\"]\n : TFields[K] extends SerializableSchema<infer TInput, any>\n ? TInput\n : never;\n};\n\n/**\n * StateSchema provides a unified API for defining LangGraph state schemas.\n *\n * @example\n * ```ts\n * import { z } from \"zod\";\n * import { StateSchema, ReducedValue, MessagesValue } from \"@langchain/langgraph\";\n *\n * const AgentState = new StateSchema({\n * // Prebuilt messages value\n * messages: MessagesValue,\n * // Basic LastValue channel from any standard schema\n * currentStep: z.string(),\n * // LastValue with native default\n * count: z.number().default(0),\n * // ReducedValue for fields needing reducers\n * history: new ReducedValue(\n * z.array(z.string()).default(() => []),\n * {\n * inputSchema: z.string(),\n * reducer: (current, next) => [...current, next],\n * }\n * ),\n * });\n *\n * // Extract types\n * type State = typeof AgentState.State;\n * type Update = typeof AgentState.Update;\n *\n * // Use in StateGraph\n * const graph = new StateGraph(AgentState);\n * ```\n */\nexport class StateSchema<TFields extends StateSchemaFields> {\n /**\n * Symbol for runtime identification.\n * @internal Used by isInstance for runtime type checking\n */\n // @ts-expect-error - Symbol is read via `in` operator in isInstance\n private readonly [STATE_SCHEMA_SYMBOL] = true;\n\n /**\n * Type declaration for the full state type.\n * Use: `typeof myState.State`\n */\n declare State: InferStateSchemaValue<TFields>;\n\n /**\n * Type declaration for the update type.\n * Use: `typeof myState.Update`\n */\n declare Update: InferStateSchemaUpdate<TFields>;\n\n /**\n * Type declaration for node functions.\n * Use: `typeof myState.Node` to type node functions outside the graph builder.\n *\n * @example\n * ```typescript\n * const AgentState = new StateSchema({\n * count: z.number().default(0),\n * });\n *\n * const myNode: typeof AgentState.Node = (state) => {\n * return { count: state.count + 1 };\n * };\n * ```\n */\n declare Node: RunnableLike<\n InferStateSchemaValue<TFields>,\n InferStateSchemaUpdate<TFields>\n >;\n\n constructor(readonly fields: TFields) {}\n\n /**\n * Get the channel definitions for use with StateGraph.\n * This converts the StateSchema fields into BaseChannel instances.\n */\n getChannels(): Record<string, BaseChannel> {\n const channels: Record<string, BaseChannel> = {};\n\n for (const [key, value] of Object.entries(this.fields)) {\n if (ReducedValue.isInstance(value)) {\n // ReducedValue -> BinaryOperatorAggregate\n const defaultGetter = getSchemaDefaultGetter(value.valueSchema);\n channels[key] = new BinaryOperatorAggregate(\n value.reducer,\n defaultGetter\n );\n } else if (UntrackedValue.isInstance(value)) {\n // UntrackedValue -> UntrackedValueChannel\n const defaultGetter = value.schema\n ? getSchemaDefaultGetter(value.schema)\n : undefined;\n channels[key] = new UntrackedValueChannel({\n guard: value.guard,\n initialValueFactory: defaultGetter,\n });\n } else if (isStandardSchema(value)) {\n // Plain schema -> LastValue channel\n const defaultGetter = getSchemaDefaultGetter(value);\n channels[key] = new LastValue(defaultGetter);\n } else {\n throw new Error(\n `Invalid state field \"${key}\": must be a schema, ReducedValue, UntrackedValue, or ManagedValue`\n );\n }\n }\n\n return channels;\n }\n\n /**\n * Get the JSON schema for the full state type.\n * Used by Studio and API for schema introspection.\n */\n getJsonSchema(): JSONSchema {\n const properties: Record<string, JSONSchema> = {};\n const required: string[] = [];\n\n for (const [key, value] of Object.entries(this.fields)) {\n let fieldSchema: JSONSchema | undefined;\n\n if (ReducedValue.isInstance(value)) {\n fieldSchema = getJsonSchemaFromSchema(value.valueSchema) as JSONSchema;\n // Merge jsonSchemaExtra (e.g. langgraph_type) into the field schema,\n // even if base schema is undefined\n if (value.jsonSchemaExtra) {\n fieldSchema = { ...(fieldSchema ?? {}), ...value.jsonSchemaExtra };\n }\n } else if (UntrackedValue.isInstance(value)) {\n fieldSchema = value.schema\n ? (getJsonSchemaFromSchema(value.schema) as JSONSchema)\n : undefined;\n } else if (isStandardSchema(value)) {\n fieldSchema = getJsonSchemaFromSchema(value) as JSONSchema;\n }\n\n if (fieldSchema) {\n properties[key] = fieldSchema;\n\n // Field is required if it doesn't have a default\n let hasDefault = false;\n if (ReducedValue.isInstance(value)) {\n hasDefault = getSchemaDefaultGetter(value.valueSchema) !== undefined;\n } else if (UntrackedValue.isInstance(value)) {\n hasDefault = value.schema\n ? getSchemaDefaultGetter(value.schema) !== undefined\n : false;\n } else {\n hasDefault = getSchemaDefaultGetter(value) !== undefined;\n }\n\n if (!hasDefault) {\n required.push(key);\n }\n }\n }\n\n return {\n type: \"object\",\n properties,\n required: required.length > 0 ? required : undefined,\n };\n }\n\n /**\n * Get the JSON schema for the update/input type.\n * All fields are optional in updates.\n */\n getInputJsonSchema(): JSONSchema {\n const properties: Record<string, JSONSchema> = {};\n\n for (const [key, value] of Object.entries(this.fields)) {\n let fieldSchema: JSONSchema | undefined;\n\n if (ReducedValue.isInstance(value)) {\n // Use input schema for updates\n fieldSchema = getJsonSchemaFromSchema(value.inputSchema) as JSONSchema;\n // Merge jsonSchemaExtra (e.g. langgraph_type) into the field schema,\n // even if base schema is undefined\n if (value.jsonSchemaExtra) {\n fieldSchema = { ...(fieldSchema ?? {}), ...value.jsonSchemaExtra };\n }\n } else if (UntrackedValue.isInstance(value)) {\n fieldSchema = value.schema\n ? (getJsonSchemaFromSchema(value.schema) as JSONSchema)\n : undefined;\n } else if (isStandardSchema(value)) {\n fieldSchema = getJsonSchemaFromSchema(value) as JSONSchema;\n }\n\n if (fieldSchema) {\n properties[key] = fieldSchema;\n }\n }\n\n return {\n type: \"object\",\n properties,\n };\n }\n\n /**\n * Get the list of channel keys (excluding managed values).\n */\n getChannelKeys(): string[] {\n return Object.entries(this.fields).map(([key]) => key);\n }\n\n /**\n * Get all keys (channels + managed values).\n */\n getAllKeys(): string[] {\n return Object.keys(this.fields);\n }\n\n /**\n * Validate input data against the schema.\n * This validates each field using its corresponding schema.\n *\n * @param data - The input data to validate\n * @returns The validated data with coerced types\n */\n async validateInput<T>(data: T): Promise<T> {\n if (data == null || typeof data !== \"object\") {\n return data;\n }\n\n const result: Record<string, unknown> = {};\n\n for (const [key, value] of Object.entries(data)) {\n const fieldDef = this.fields[key];\n\n if (fieldDef === undefined) {\n // Unknown field, pass through\n result[key] = value;\n continue;\n }\n\n // Get the schema to use for validation\n let schema: StandardSchemaV1 | undefined;\n\n if (ReducedValue.isInstance(fieldDef)) {\n schema = fieldDef.inputSchema;\n } else if (UntrackedValue.isInstance(fieldDef)) {\n schema = fieldDef.schema;\n } else if (isStandardSchema(fieldDef)) {\n schema = fieldDef;\n }\n\n if (schema) {\n // Validate using standard schema\n const validationResult = await schema[\"~standard\"].validate(value);\n if (validationResult.issues) {\n throw new Error(\n `Validation failed for field \"${key}\": ${JSON.stringify(\n validationResult.issues\n )}`\n );\n }\n result[key] = validationResult.value;\n } else {\n // No schema or not a standard schema, pass through\n result[key] = value;\n }\n }\n\n return result as T;\n }\n\n /**\n * Type guard to check if a value is a StateSchema instance.\n *\n * @param value - The value to check.\n * @returns True if the value is a StateSchema instance with the correct runtime tag.\n */\n static isInstance<TFields extends StateSchemaFields>(\n value: StateSchema<TFields>\n ): value is StateSchema<TFields>;\n\n static isInstance(value: unknown): value is StateSchema<any>;\n\n static isInstance<TFields extends StateSchemaFields>(\n value: unknown\n ): value is StateSchema<TFields> {\n return (\n typeof value === \"object\" &&\n value !== null &&\n STATE_SCHEMA_SYMBOL in value &&\n value[STATE_SCHEMA_SYMBOL] === true\n );\n }\n}\n\nexport type AnyStateSchema = StateSchema<any>;\n"],"mappings":"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"}
|
package/dist/state/types.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","names":[],"sources":["../../src/state/types.ts"],"sourcesContent":["import type {\n StandardSchemaV1,\n StandardJSONSchemaV1,\n StandardTypedV1,\n} from \"@standard-schema/spec\";\n\ninterface CombinedProps<Input = unknown, Output = Input>\n extends
|
|
1
|
+
{"version":3,"file":"types.cjs","names":[],"sources":["../../src/state/types.ts"],"sourcesContent":["import type {\n StandardSchemaV1,\n StandardJSONSchemaV1,\n StandardTypedV1,\n} from \"@standard-schema/spec\";\n\ninterface CombinedProps<Input = unknown, Output = Input>\n extends\n StandardSchemaV1.Props<Input, Output>,\n StandardJSONSchemaV1.Props<Input, Output> {}\n\n/**\n * SerializableSchema is the core interface for any schema used by LangGraph state.\n *\n * @template Input - The type of input data the schema can be used to validate.\n * @template Output - The type of output produced after validation, post-refinement/coercion.\n *\n * @remarks\n * - SerializableSchema provides a single property, `~standard`, which must conform to\n * both `StandardSchemaV1.Props` and `StandardJSONSchemaV1.Props`.\n * - This ensures all schemas are compatible with both runtime validation (e.g., type checks,\n * coercion, custom refinements) and structured schema export/generation (e.g., producing\n * a compatible JSON Schema).\n * - A value matching SerializableSchema can be passed directly to LangGraph state\n * definitions, reducers, or other schema-accepting APIs.\n *\n * @example\n * ```ts\n * import { z } from \"zod\";\n *\n * // complies with SerializableSchema\n * const zodSchema = z.object({ x: z.string() });\n *\n * // Use in a StateObject definition:\n * const AgentState = new StateObject({\n * data: schema\n * });\n * ```\n */\nexport interface SerializableSchema<Input = unknown, Output = Input> {\n \"~standard\": CombinedProps<Input, Output>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace SerializableSchema {\n /**\n * Infers the type of input expected by a SerializableSchema.\n *\n * @template T - A SerializableSchema instance.\n * @returns The type of data that may be passed to the schema for validation.\n *\n * @example\n * ```ts\n * type MyInput = SerializableSchema.InferInput<typeof schema>;\n * ```\n */\n export type InferInput<T extends SerializableSchema> =\n StandardTypedV1.InferInput<T>;\n\n /**\n * Infers the output type yielded by a SerializableSchema, after parsing or coercion.\n *\n * @template T - A SerializableSchema instance.\n * @returns The type produced by successfully validating/coercing input data.\n *\n * @example\n * ```ts\n * type MyOutput = SerializableSchema.InferOutput<typeof schema>;\n * ```\n */\n export type InferOutput<T extends SerializableSchema> =\n StandardTypedV1.InferOutput<T>;\n}\n\n/**\n * Type guard to check if a given value is a Standard Schema V1 object.\n *\n * @remarks\n * A Standard Schema object is expected to have a `~standard` property with a `validate` function.\n * This guard does NOT check for JSON schema support.\n *\n * @typeParam Input - The type of input validated by this schema.\n * @typeParam Output - The type of output produced after validation.\n * @param schema - The value to test.\n * @returns True if the schema conforms to the Standard Schema interface.\n *\n * @example\n * ```ts\n * if (isStandardSchema(mySchema)) {\n * const result = mySchema[\"~standard\"].validate(input);\n * }\n * ```\n */\nexport function isStandardSchema<Input = unknown, Output = Input>(\n schema: StandardSchemaV1<Input, Output>\n): schema is StandardSchemaV1<Input, Output>;\nexport function isStandardSchema<Input = unknown, Output = Input>(\n schema: unknown\n): schema is StandardSchemaV1<Input, Output>;\nexport function isStandardSchema<Input = unknown, Output = Input>(\n schema: StandardSchemaV1<Input, Output> | unknown\n): schema is StandardSchemaV1<Input, Output> {\n return (\n typeof schema === \"object\" &&\n schema !== null &&\n \"~standard\" in schema &&\n typeof schema[\"~standard\"] === \"object\" &&\n schema[\"~standard\"] !== null &&\n \"validate\" in schema[\"~standard\"]\n );\n}\n\n/**\n * Type guard to check if a given value is a Standard JSON Schema V1 object.\n *\n * @remarks\n * A Standard JSON Schema object is expected to have a `~standard` property with a `jsonSchema` function.\n * This may be used to generate a JSON Schema (for UI/form tooling, documentation, etc).\n *\n * @typeParam Input - The type of input described by this JSON schema.\n * @typeParam Output - The type of output described by this JSON schema.\n * @param schema - The value to test.\n * @returns True if the schema exposes JSON schema generation.\n *\n * @example\n * ```ts\n * if (isStandardJSONSchema(mySchema)) {\n * const jschema = mySchema[\"~standard\"].jsonSchema();\n * }\n * ```\n */\nexport function isStandardJSONSchema<Input = unknown, Output = Input>(\n schema: StandardJSONSchemaV1<Input, Output>\n): schema is StandardJSONSchemaV1<Input, Output>;\nexport function isStandardJSONSchema<Input = unknown, Output = Input>(\n schema: unknown\n): schema is StandardJSONSchemaV1<Input, Output>;\nexport function isStandardJSONSchema<Input = unknown, Output = Input>(\n schema: StandardJSONSchemaV1<Input, Output> | unknown\n): schema is StandardJSONSchemaV1<Input, Output> {\n return (\n typeof schema === \"object\" &&\n schema !== null &&\n \"~standard\" in schema &&\n typeof schema[\"~standard\"] === \"object\" &&\n schema[\"~standard\"] !== null &&\n \"jsonSchema\" in schema[\"~standard\"]\n );\n}\n\n/**\n * Type guard to check if a given value is a `SerializableSchema`, i.e.\n * both a Standard Schema and a Standard JSON Schema object.\n *\n * @remarks\n * This checks for both the presence of a Standard Schema V1 interface\n * and the ability to generate a JSON schema.\n *\n * @typeParam Input - The type of input described by the schema.\n * @typeParam Output - The type of output described by the schema.\n * @param schema - The value to test.\n * @returns True if the schema is a valid `SerializableSchema`.\n *\n * @example\n * ```ts\n * if (isSerializableSchema(schema)) {\n * schema[\"~standard\"].validate(data);\n * const json = schema[\"~standard\"].jsonSchema();\n * }\n * ```\n */\nexport function isSerializableSchema<Input = unknown, Output = Input>(\n schema: SerializableSchema<Input, Output>\n): schema is SerializableSchema<Input, Output>;\nexport function isSerializableSchema<Input = unknown, Output = Input>(\n schema: unknown\n): schema is SerializableSchema<Input, Output>;\nexport function isSerializableSchema<Input = unknown, Output = Input>(\n schema: SerializableSchema<Input, Output> | unknown\n): schema is SerializableSchema<Input, Output> {\n return isStandardSchema(schema) && isStandardJSONSchema(schema);\n}\n"],"mappings":";AAmGA,SAAgB,iBACd,QAC2C;AAC3C,QACE,OAAO,WAAW,YAClB,WAAW,QACX,eAAe,UACf,OAAO,OAAO,iBAAiB,YAC/B,OAAO,iBAAiB,QACxB,cAAc,OAAO;;AA6BzB,SAAgB,qBACd,QAC+C;AAC/C,QACE,OAAO,WAAW,YAClB,WAAW,QACX,eAAe,UACf,OAAO,OAAO,iBAAiB,YAC/B,OAAO,iBAAiB,QACxB,gBAAgB,OAAO;;AA+B3B,SAAgB,qBACd,QAC6C;AAC7C,QAAO,iBAAiB,OAAO,IAAI,qBAAqB,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/state/types.ts"],"mappings":";;;UAMU,aAAA,2BAAwC,KAAA,
|
|
1
|
+
{"version":3,"file":"types.d.cts","names":[],"sources":["../../src/state/types.ts"],"mappings":";;;UAMU,aAAA,2BAAwC,KAAA,UAE9C,gBAAA,CAAiB,KAAA,CAAM,KAAA,EAAO,MAAA,GAC9B,oBAAA,CAAqB,KAAA,CAAM,KAAA,EAAO,MAAA;AALP;;;;;;;;;;;;;;;;;;;;;;;;;AAmC/B;;;AAnC+B,UAmCd,kBAAA,2BAA6C,KAAA;EAC5D,WAAA,EAAa,aAAA,CAAc,KAAA,EAAO,MAAA;AAAA;AAAA,kBAIX,kBAAA;EAJG;;;;;;;;;;;EAAA,KAgBd,UAAA,WAAqB,kBAAA,IAC/B,eAAA,CAAgB,UAAA,CAAW,CAAA;EAbY;;;;;;;;;;;EAAA,KA0B7B,WAAA,WAAsB,kBAAA,IAChC,eAAA,CAAgB,WAAA,CAAY,CAAA;AAAA;;;;;;;;;;;;AAsBhC;;;;;;;;iBAAgB,gBAAA,2BAA2C,KAAA,CAAA,CACzD,MAAA,EAAQ,gBAAA,CAAiB,KAAA,EAAO,MAAA,IAC/B,MAAA,IAAU,gBAAA,CAAiB,KAAA,EAAO,MAAA;AAAA,iBACrB,gBAAA,2BAA2C,KAAA,CAAA,CACzD,MAAA,YACC,MAAA,IAAU,gBAAA,CAAiB,KAAA,EAAO,MAAA;;;;;;;;;;;;;;AAyErC;;;;;;;;iBAAgB,oBAAA,2BAA+C,KAAA,CAAA,CAC7D,MAAA,EAAQ,kBAAA,CAAmB,KAAA,EAAO,MAAA,IACjC,MAAA,IAAU,kBAAA,CAAmB,KAAA,EAAO,MAAA;AAAA,iBACvB,oBAAA,2BAA+C,KAAA,CAAA,CAC7D,MAAA,YACC,MAAA,IAAU,kBAAA,CAAmB,KAAA,EAAO,MAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/state/types.ts"],"mappings":";;;UAMU,aAAA,2BAAwC,KAAA,
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../src/state/types.ts"],"mappings":";;;UAMU,aAAA,2BAAwC,KAAA,UAE9C,gBAAA,CAAiB,KAAA,CAAM,KAAA,EAAO,MAAA,GAC9B,oBAAA,CAAqB,KAAA,CAAM,KAAA,EAAO,MAAA;AALP;;;;;;;;;;;;;;;;;;;;;;;;;AAmC/B;;;AAnC+B,UAmCd,kBAAA,2BAA6C,KAAA;EAC5D,WAAA,EAAa,aAAA,CAAc,KAAA,EAAO,MAAA;AAAA;AAAA,kBAIX,kBAAA;EAJG;;;;;;;;;;;EAAA,KAgBd,UAAA,WAAqB,kBAAA,IAC/B,eAAA,CAAgB,UAAA,CAAW,CAAA;EAbY;;;;;;;;;;;EAAA,KA0B7B,WAAA,WAAsB,kBAAA,IAChC,eAAA,CAAgB,WAAA,CAAY,CAAA;AAAA;;;;;;;;;;;;AAsBhC;;;;;;;;iBAAgB,gBAAA,2BAA2C,KAAA,CAAA,CACzD,MAAA,EAAQ,gBAAA,CAAiB,KAAA,EAAO,MAAA,IAC/B,MAAA,IAAU,gBAAA,CAAiB,KAAA,EAAO,MAAA;AAAA,iBACrB,gBAAA,2BAA2C,KAAA,CAAA,CACzD,MAAA,YACC,MAAA,IAAU,gBAAA,CAAiB,KAAA,EAAO,MAAA;;;;;;;;;;;;;;AAyErC;;;;;;;;iBAAgB,oBAAA,2BAA+C,KAAA,CAAA,CAC7D,MAAA,EAAQ,kBAAA,CAAmB,KAAA,EAAO,MAAA,IACjC,MAAA,IAAU,kBAAA,CAAmB,KAAA,EAAO,MAAA;AAAA,iBACvB,oBAAA,2BAA+C,KAAA,CAAA,CAC7D,MAAA,YACC,MAAA,IAAU,kBAAA,CAAmB,KAAA,EAAO,MAAA"}
|
package/dist/state/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../../src/state/types.ts"],"sourcesContent":["import type {\n StandardSchemaV1,\n StandardJSONSchemaV1,\n StandardTypedV1,\n} from \"@standard-schema/spec\";\n\ninterface CombinedProps<Input = unknown, Output = Input>\n extends
|
|
1
|
+
{"version":3,"file":"types.js","names":[],"sources":["../../src/state/types.ts"],"sourcesContent":["import type {\n StandardSchemaV1,\n StandardJSONSchemaV1,\n StandardTypedV1,\n} from \"@standard-schema/spec\";\n\ninterface CombinedProps<Input = unknown, Output = Input>\n extends\n StandardSchemaV1.Props<Input, Output>,\n StandardJSONSchemaV1.Props<Input, Output> {}\n\n/**\n * SerializableSchema is the core interface for any schema used by LangGraph state.\n *\n * @template Input - The type of input data the schema can be used to validate.\n * @template Output - The type of output produced after validation, post-refinement/coercion.\n *\n * @remarks\n * - SerializableSchema provides a single property, `~standard`, which must conform to\n * both `StandardSchemaV1.Props` and `StandardJSONSchemaV1.Props`.\n * - This ensures all schemas are compatible with both runtime validation (e.g., type checks,\n * coercion, custom refinements) and structured schema export/generation (e.g., producing\n * a compatible JSON Schema).\n * - A value matching SerializableSchema can be passed directly to LangGraph state\n * definitions, reducers, or other schema-accepting APIs.\n *\n * @example\n * ```ts\n * import { z } from \"zod\";\n *\n * // complies with SerializableSchema\n * const zodSchema = z.object({ x: z.string() });\n *\n * // Use in a StateObject definition:\n * const AgentState = new StateObject({\n * data: schema\n * });\n * ```\n */\nexport interface SerializableSchema<Input = unknown, Output = Input> {\n \"~standard\": CombinedProps<Input, Output>;\n}\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport declare namespace SerializableSchema {\n /**\n * Infers the type of input expected by a SerializableSchema.\n *\n * @template T - A SerializableSchema instance.\n * @returns The type of data that may be passed to the schema for validation.\n *\n * @example\n * ```ts\n * type MyInput = SerializableSchema.InferInput<typeof schema>;\n * ```\n */\n export type InferInput<T extends SerializableSchema> =\n StandardTypedV1.InferInput<T>;\n\n /**\n * Infers the output type yielded by a SerializableSchema, after parsing or coercion.\n *\n * @template T - A SerializableSchema instance.\n * @returns The type produced by successfully validating/coercing input data.\n *\n * @example\n * ```ts\n * type MyOutput = SerializableSchema.InferOutput<typeof schema>;\n * ```\n */\n export type InferOutput<T extends SerializableSchema> =\n StandardTypedV1.InferOutput<T>;\n}\n\n/**\n * Type guard to check if a given value is a Standard Schema V1 object.\n *\n * @remarks\n * A Standard Schema object is expected to have a `~standard` property with a `validate` function.\n * This guard does NOT check for JSON schema support.\n *\n * @typeParam Input - The type of input validated by this schema.\n * @typeParam Output - The type of output produced after validation.\n * @param schema - The value to test.\n * @returns True if the schema conforms to the Standard Schema interface.\n *\n * @example\n * ```ts\n * if (isStandardSchema(mySchema)) {\n * const result = mySchema[\"~standard\"].validate(input);\n * }\n * ```\n */\nexport function isStandardSchema<Input = unknown, Output = Input>(\n schema: StandardSchemaV1<Input, Output>\n): schema is StandardSchemaV1<Input, Output>;\nexport function isStandardSchema<Input = unknown, Output = Input>(\n schema: unknown\n): schema is StandardSchemaV1<Input, Output>;\nexport function isStandardSchema<Input = unknown, Output = Input>(\n schema: StandardSchemaV1<Input, Output> | unknown\n): schema is StandardSchemaV1<Input, Output> {\n return (\n typeof schema === \"object\" &&\n schema !== null &&\n \"~standard\" in schema &&\n typeof schema[\"~standard\"] === \"object\" &&\n schema[\"~standard\"] !== null &&\n \"validate\" in schema[\"~standard\"]\n );\n}\n\n/**\n * Type guard to check if a given value is a Standard JSON Schema V1 object.\n *\n * @remarks\n * A Standard JSON Schema object is expected to have a `~standard` property with a `jsonSchema` function.\n * This may be used to generate a JSON Schema (for UI/form tooling, documentation, etc).\n *\n * @typeParam Input - The type of input described by this JSON schema.\n * @typeParam Output - The type of output described by this JSON schema.\n * @param schema - The value to test.\n * @returns True if the schema exposes JSON schema generation.\n *\n * @example\n * ```ts\n * if (isStandardJSONSchema(mySchema)) {\n * const jschema = mySchema[\"~standard\"].jsonSchema();\n * }\n * ```\n */\nexport function isStandardJSONSchema<Input = unknown, Output = Input>(\n schema: StandardJSONSchemaV1<Input, Output>\n): schema is StandardJSONSchemaV1<Input, Output>;\nexport function isStandardJSONSchema<Input = unknown, Output = Input>(\n schema: unknown\n): schema is StandardJSONSchemaV1<Input, Output>;\nexport function isStandardJSONSchema<Input = unknown, Output = Input>(\n schema: StandardJSONSchemaV1<Input, Output> | unknown\n): schema is StandardJSONSchemaV1<Input, Output> {\n return (\n typeof schema === \"object\" &&\n schema !== null &&\n \"~standard\" in schema &&\n typeof schema[\"~standard\"] === \"object\" &&\n schema[\"~standard\"] !== null &&\n \"jsonSchema\" in schema[\"~standard\"]\n );\n}\n\n/**\n * Type guard to check if a given value is a `SerializableSchema`, i.e.\n * both a Standard Schema and a Standard JSON Schema object.\n *\n * @remarks\n * This checks for both the presence of a Standard Schema V1 interface\n * and the ability to generate a JSON schema.\n *\n * @typeParam Input - The type of input described by the schema.\n * @typeParam Output - The type of output described by the schema.\n * @param schema - The value to test.\n * @returns True if the schema is a valid `SerializableSchema`.\n *\n * @example\n * ```ts\n * if (isSerializableSchema(schema)) {\n * schema[\"~standard\"].validate(data);\n * const json = schema[\"~standard\"].jsonSchema();\n * }\n * ```\n */\nexport function isSerializableSchema<Input = unknown, Output = Input>(\n schema: SerializableSchema<Input, Output>\n): schema is SerializableSchema<Input, Output>;\nexport function isSerializableSchema<Input = unknown, Output = Input>(\n schema: unknown\n): schema is SerializableSchema<Input, Output>;\nexport function isSerializableSchema<Input = unknown, Output = Input>(\n schema: SerializableSchema<Input, Output> | unknown\n): schema is SerializableSchema<Input, Output> {\n return isStandardSchema(schema) && isStandardJSONSchema(schema);\n}\n"],"mappings":";AAmGA,SAAgB,iBACd,QAC2C;AAC3C,QACE,OAAO,WAAW,YAClB,WAAW,QACX,eAAe,UACf,OAAO,OAAO,iBAAiB,YAC/B,OAAO,iBAAiB,QACxB,cAAc,OAAO;;AA6BzB,SAAgB,qBACd,QAC+C;AAC/C,QACE,OAAO,WAAW,YAClB,WAAW,QACX,eAAe,UACf,OAAO,OAAO,iBAAiB,YAC/B,OAAO,iBAAiB,QACxB,gBAAgB,OAAO;;AA+B3B,SAAgB,qBACd,QAC6C;AAC7C,QAAO,iBAAiB,OAAO,IAAI,qBAAqB,OAAO"}
|
package/dist/utils.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.cjs","names":["Runnable","AsyncLocalStorageProviderSingleton","ensureLangGraphConfig"],"sources":["../src/utils.ts"],"sourcesContent":["import { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport {\n mergeConfigs,\n patchConfig,\n Runnable,\n RunnableConfig,\n} from \"@langchain/core/runnables\";\nimport { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { ensureLangGraphConfig } from \"./pregel/utils/config.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface RunnableCallableArgs extends Partial<any> {\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n tags?: string[];\n trace?: boolean;\n recurse?: boolean;\n}\n\nexport class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {\n lc_namespace: string[] = [\"langgraph\"];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n\n tags?: string[];\n\n config?: RunnableConfig;\n\n trace: boolean = true;\n\n recurse: boolean = true;\n\n constructor(fields: RunnableCallableArgs) {\n super();\n this.name = fields.name ?? fields.func.name;\n this.func = fields.func;\n this.config = fields.tags ? { tags: fields.tags } : undefined;\n this.trace = fields.trace ?? this.trace;\n this.recurse = fields.recurse ?? this.recurse;\n }\n\n protected async _tracedInvoke(\n input: I,\n config?: Partial<RunnableConfig>,\n runManager?: CallbackManagerForChainRun\n ) {\n return new Promise<O>((resolve, reject) => {\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n childConfig,\n async () => {\n try {\n const output = await this.func(input, childConfig);\n resolve(output);\n } catch (e) {\n reject(e);\n }\n }\n );\n });\n }\n\n async invoke(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n input: I,\n options?: Partial<RunnableConfig> | undefined\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<O> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let returnValue: any;\n const config = ensureLangGraphConfig(options);\n const mergedConfig = mergeConfigs(this.config, config);\n\n if (this.trace) {\n returnValue = await this._callWithConfig(\n this._tracedInvoke,\n input,\n mergedConfig\n );\n } else {\n returnValue = await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => this.func(input, mergedConfig)\n );\n }\n\n if (Runnable.isRunnable(returnValue) && this.recurse) {\n return await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => returnValue.invoke(input, mergedConfig)\n );\n }\n\n return returnValue;\n }\n}\n\nexport function prefixGenerator<T, Prefix extends string>(\n generator: Generator<T>,\n prefix: Prefix\n): Generator<[Prefix, T]>;\n\nexport function prefixGenerator<T>(\n generator: Generator<T>,\n prefix?: undefined\n): Generator<T>;\n\nexport function prefixGenerator<\n T,\n Prefix extends string | undefined = undefined
|
|
1
|
+
{"version":3,"file":"utils.cjs","names":["Runnable","AsyncLocalStorageProviderSingleton","ensureLangGraphConfig"],"sources":["../src/utils.ts"],"sourcesContent":["import { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport {\n mergeConfigs,\n patchConfig,\n Runnable,\n RunnableConfig,\n} from \"@langchain/core/runnables\";\nimport { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { ensureLangGraphConfig } from \"./pregel/utils/config.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface RunnableCallableArgs extends Partial<any> {\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n tags?: string[];\n trace?: boolean;\n recurse?: boolean;\n}\n\nexport class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {\n lc_namespace: string[] = [\"langgraph\"];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n\n tags?: string[];\n\n config?: RunnableConfig;\n\n trace: boolean = true;\n\n recurse: boolean = true;\n\n constructor(fields: RunnableCallableArgs) {\n super();\n this.name = fields.name ?? fields.func.name;\n this.func = fields.func;\n this.config = fields.tags ? { tags: fields.tags } : undefined;\n this.trace = fields.trace ?? this.trace;\n this.recurse = fields.recurse ?? this.recurse;\n }\n\n protected async _tracedInvoke(\n input: I,\n config?: Partial<RunnableConfig>,\n runManager?: CallbackManagerForChainRun\n ) {\n return new Promise<O>((resolve, reject) => {\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n childConfig,\n async () => {\n try {\n const output = await this.func(input, childConfig);\n resolve(output);\n } catch (e) {\n reject(e);\n }\n }\n );\n });\n }\n\n async invoke(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n input: I,\n options?: Partial<RunnableConfig> | undefined\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<O> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let returnValue: any;\n const config = ensureLangGraphConfig(options);\n const mergedConfig = mergeConfigs(this.config, config);\n\n if (this.trace) {\n returnValue = await this._callWithConfig(\n this._tracedInvoke,\n input,\n mergedConfig\n );\n } else {\n returnValue = await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => this.func(input, mergedConfig)\n );\n }\n\n if (Runnable.isRunnable(returnValue) && this.recurse) {\n return await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => returnValue.invoke(input, mergedConfig)\n );\n }\n\n return returnValue;\n }\n}\n\nexport function prefixGenerator<T, Prefix extends string>(\n generator: Generator<T>,\n prefix: Prefix\n): Generator<[Prefix, T]>;\n\nexport function prefixGenerator<T>(\n generator: Generator<T>,\n prefix?: undefined\n): Generator<T>;\n\nexport function prefixGenerator<\n T,\n Prefix extends string | undefined = undefined,\n>(\n generator: Generator<T>,\n prefix?: Prefix | undefined\n): Generator<Prefix extends string ? [Prefix, T] : T>;\nexport function* prefixGenerator<\n T,\n Prefix extends string | undefined = undefined,\n>(\n generator: Generator<T>,\n prefix?: Prefix | undefined\n): Generator<Prefix extends string ? [Prefix, T] : T> {\n if (prefix === undefined) {\n yield* generator as Generator<Prefix extends string ? [Prefix, T] : T>;\n } else {\n for (const value of generator) {\n yield [prefix, value] as Prefix extends string ? [Prefix, T] : T;\n }\n }\n}\n\n// https://github.com/tc39/proposal-array-from-async\nexport async function gatherIterator<T>(\n i:\n | AsyncIterable<T>\n | Promise<AsyncIterable<T>>\n | Iterable<T>\n | Promise<Iterable<T>>\n): Promise<Array<T>> {\n const out: T[] = [];\n for await (const item of await i) {\n out.push(item);\n }\n return out;\n}\n\nexport function gatherIteratorSync<T>(i: Iterable<T>): Array<T> {\n const out: T[] = [];\n for (const item of i) {\n out.push(item);\n }\n return out;\n}\n\nexport function patchConfigurable(\n config: RunnableConfig | undefined,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n patch: Record<string, any>\n): RunnableConfig {\n if (!config) {\n return {\n configurable: patch,\n };\n } else if (!(\"configurable\" in config)) {\n return {\n ...config,\n configurable: patch,\n };\n } else {\n return {\n ...config,\n configurable: {\n ...config.configurable,\n ...patch,\n },\n };\n }\n}\n\nexport function isAsyncGeneratorFunction(\n val: unknown\n): val is AsyncGeneratorFunction {\n return (\n val != null &&\n typeof val === \"function\" &&\n // eslint-disable-next-line no-instanceof/no-instanceof\n val instanceof Object.getPrototypeOf(async function* () {}).constructor\n );\n}\n\nexport function isGeneratorFunction(val: unknown): val is GeneratorFunction {\n return (\n val != null &&\n typeof val === \"function\" &&\n // eslint-disable-next-line no-instanceof/no-instanceof\n val instanceof Object.getPrototypeOf(function* () {}).constructor\n );\n}\n"],"mappings":";;;;AAoBA,IAAa,mBAAb,cAAgEA,0BAAAA,SAAe;CAC7E,eAAyB,CAAC,YAAY;CAGtC;CAEA;CAEA;CAEA,QAAiB;CAEjB,UAAmB;CAEnB,YAAY,QAA8B;AACxC,SAAO;AACP,OAAK,OAAO,OAAO,QAAQ,OAAO,KAAK;AACvC,OAAK,OAAO,OAAO;AACnB,OAAK,SAAS,OAAO,OAAO,EAAE,MAAM,OAAO,MAAM,GAAG,KAAA;AACpD,OAAK,QAAQ,OAAO,SAAS,KAAK;AAClC,OAAK,UAAU,OAAO,WAAW,KAAK;;CAGxC,MAAgB,cACd,OACA,QACA,YACA;AACA,SAAO,IAAI,SAAY,SAAS,WAAW;GACzC,MAAM,eAAA,GAAA,0BAAA,aAA0B,QAAQ,EACtC,WAAW,YAAY,UAAU,EAClC,CAAC;AACGC,8BAAAA,mCAAmC,cACtC,aACA,YAAY;AACV,QAAI;AAEF,aADe,MAAM,KAAK,KAAK,OAAO,YAAY,CACnC;aACR,GAAG;AACV,YAAO,EAAE;;KAGd;IACD;;CAGJ,MAAM,OAEJ,OACA,SAEY;EAEZ,IAAI;EACJ,MAAM,SAASC,eAAAA,sBAAsB,QAAQ;EAC7C,MAAM,gBAAA,GAAA,0BAAA,cAA4B,KAAK,QAAQ,OAAO;AAEtD,MAAI,KAAK,MACP,eAAc,MAAM,KAAK,gBACvB,KAAK,eACL,OACA,aACD;MAED,eAAc,MAAMD,2BAAAA,mCAAmC,cACrD,cACA,YAAY,KAAK,KAAK,OAAO,aAAa,CAC3C;AAGH,MAAID,0BAAAA,SAAS,WAAW,YAAY,IAAI,KAAK,QAC3C,QAAO,MAAMC,2BAAAA,mCAAmC,cAC9C,cACA,YAAY,YAAY,OAAO,OAAO,aAAa,CACpD;AAGH,SAAO;;;AAqBX,UAAiB,gBAIf,WACA,QACoD;AACpD,KAAI,WAAW,KAAA,EACb,QAAO;KAEP,MAAK,MAAM,SAAS,UAClB,OAAM,CAAC,QAAQ,MAAM;;AAM3B,eAAsB,eACpB,GAKmB;CACnB,MAAM,MAAW,EAAE;AACnB,YAAW,MAAM,QAAQ,MAAM,EAC7B,KAAI,KAAK,KAAK;AAEhB,QAAO;;AAGT,SAAgB,mBAAsB,GAA0B;CAC9D,MAAM,MAAW,EAAE;AACnB,MAAK,MAAM,QAAQ,EACjB,KAAI,KAAK,KAAK;AAEhB,QAAO;;AAGT,SAAgB,kBACd,QAEA,OACgB;AAChB,KAAI,CAAC,OACH,QAAO,EACL,cAAc,OACf;UACQ,EAAE,kBAAkB,QAC7B,QAAO;EACL,GAAG;EACH,cAAc;EACf;KAED,QAAO;EACL,GAAG;EACH,cAAc;GACZ,GAAG,OAAO;GACV,GAAG;GACJ;EACF;;AAIL,SAAgB,yBACd,KAC+B;AAC/B,QACE,OAAO,QACP,OAAO,QAAQ,cAEf,eAAe,OAAO,eAAe,mBAAmB,GAAG,CAAC;;AAIhE,SAAgB,oBAAoB,KAAwC;AAC1E,QACE,OAAO,QACP,OAAO,QAAQ,cAEf,eAAe,OAAO,eAAe,aAAa,GAAG,CAAC"}
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport {\n mergeConfigs,\n patchConfig,\n Runnable,\n RunnableConfig,\n} from \"@langchain/core/runnables\";\nimport { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { ensureLangGraphConfig } from \"./pregel/utils/config.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface RunnableCallableArgs extends Partial<any> {\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n tags?: string[];\n trace?: boolean;\n recurse?: boolean;\n}\n\nexport class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {\n lc_namespace: string[] = [\"langgraph\"];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n\n tags?: string[];\n\n config?: RunnableConfig;\n\n trace: boolean = true;\n\n recurse: boolean = true;\n\n constructor(fields: RunnableCallableArgs) {\n super();\n this.name = fields.name ?? fields.func.name;\n this.func = fields.func;\n this.config = fields.tags ? { tags: fields.tags } : undefined;\n this.trace = fields.trace ?? this.trace;\n this.recurse = fields.recurse ?? this.recurse;\n }\n\n protected async _tracedInvoke(\n input: I,\n config?: Partial<RunnableConfig>,\n runManager?: CallbackManagerForChainRun\n ) {\n return new Promise<O>((resolve, reject) => {\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n childConfig,\n async () => {\n try {\n const output = await this.func(input, childConfig);\n resolve(output);\n } catch (e) {\n reject(e);\n }\n }\n );\n });\n }\n\n async invoke(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n input: I,\n options?: Partial<RunnableConfig> | undefined\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<O> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let returnValue: any;\n const config = ensureLangGraphConfig(options);\n const mergedConfig = mergeConfigs(this.config, config);\n\n if (this.trace) {\n returnValue = await this._callWithConfig(\n this._tracedInvoke,\n input,\n mergedConfig\n );\n } else {\n returnValue = await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => this.func(input, mergedConfig)\n );\n }\n\n if (Runnable.isRunnable(returnValue) && this.recurse) {\n return await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => returnValue.invoke(input, mergedConfig)\n );\n }\n\n return returnValue;\n }\n}\n\nexport function prefixGenerator<T, Prefix extends string>(\n generator: Generator<T>,\n prefix: Prefix\n): Generator<[Prefix, T]>;\n\nexport function prefixGenerator<T>(\n generator: Generator<T>,\n prefix?: undefined\n): Generator<T>;\n\nexport function prefixGenerator<\n T,\n Prefix extends string | undefined = undefined
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"sources":["../src/utils.ts"],"sourcesContent":["import { CallbackManagerForChainRun } from \"@langchain/core/callbacks/manager\";\nimport {\n mergeConfigs,\n patchConfig,\n Runnable,\n RunnableConfig,\n} from \"@langchain/core/runnables\";\nimport { AsyncLocalStorageProviderSingleton } from \"@langchain/core/singletons\";\nimport { ensureLangGraphConfig } from \"./pregel/utils/config.js\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface RunnableCallableArgs extends Partial<any> {\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n tags?: string[];\n trace?: boolean;\n recurse?: boolean;\n}\n\nexport class RunnableCallable<I = unknown, O = unknown> extends Runnable<I, O> {\n lc_namespace: string[] = [\"langgraph\"];\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n func: (...args: any[]) => any;\n\n tags?: string[];\n\n config?: RunnableConfig;\n\n trace: boolean = true;\n\n recurse: boolean = true;\n\n constructor(fields: RunnableCallableArgs) {\n super();\n this.name = fields.name ?? fields.func.name;\n this.func = fields.func;\n this.config = fields.tags ? { tags: fields.tags } : undefined;\n this.trace = fields.trace ?? this.trace;\n this.recurse = fields.recurse ?? this.recurse;\n }\n\n protected async _tracedInvoke(\n input: I,\n config?: Partial<RunnableConfig>,\n runManager?: CallbackManagerForChainRun\n ) {\n return new Promise<O>((resolve, reject) => {\n const childConfig = patchConfig(config, {\n callbacks: runManager?.getChild(),\n });\n void AsyncLocalStorageProviderSingleton.runWithConfig(\n childConfig,\n async () => {\n try {\n const output = await this.func(input, childConfig);\n resolve(output);\n } catch (e) {\n reject(e);\n }\n }\n );\n });\n }\n\n async invoke(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n input: I,\n options?: Partial<RunnableConfig> | undefined\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ): Promise<O> {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let returnValue: any;\n const config = ensureLangGraphConfig(options);\n const mergedConfig = mergeConfigs(this.config, config);\n\n if (this.trace) {\n returnValue = await this._callWithConfig(\n this._tracedInvoke,\n input,\n mergedConfig\n );\n } else {\n returnValue = await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => this.func(input, mergedConfig)\n );\n }\n\n if (Runnable.isRunnable(returnValue) && this.recurse) {\n return await AsyncLocalStorageProviderSingleton.runWithConfig(\n mergedConfig,\n async () => returnValue.invoke(input, mergedConfig)\n );\n }\n\n return returnValue;\n }\n}\n\nexport function prefixGenerator<T, Prefix extends string>(\n generator: Generator<T>,\n prefix: Prefix\n): Generator<[Prefix, T]>;\n\nexport function prefixGenerator<T>(\n generator: Generator<T>,\n prefix?: undefined\n): Generator<T>;\n\nexport function prefixGenerator<\n T,\n Prefix extends string | undefined = undefined,\n>(\n generator: Generator<T>,\n prefix?: Prefix | undefined\n): Generator<Prefix extends string ? [Prefix, T] : T>;\nexport function* prefixGenerator<\n T,\n Prefix extends string | undefined = undefined,\n>(\n generator: Generator<T>,\n prefix?: Prefix | undefined\n): Generator<Prefix extends string ? [Prefix, T] : T> {\n if (prefix === undefined) {\n yield* generator as Generator<Prefix extends string ? [Prefix, T] : T>;\n } else {\n for (const value of generator) {\n yield [prefix, value] as Prefix extends string ? [Prefix, T] : T;\n }\n }\n}\n\n// https://github.com/tc39/proposal-array-from-async\nexport async function gatherIterator<T>(\n i:\n | AsyncIterable<T>\n | Promise<AsyncIterable<T>>\n | Iterable<T>\n | Promise<Iterable<T>>\n): Promise<Array<T>> {\n const out: T[] = [];\n for await (const item of await i) {\n out.push(item);\n }\n return out;\n}\n\nexport function gatherIteratorSync<T>(i: Iterable<T>): Array<T> {\n const out: T[] = [];\n for (const item of i) {\n out.push(item);\n }\n return out;\n}\n\nexport function patchConfigurable(\n config: RunnableConfig | undefined,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n patch: Record<string, any>\n): RunnableConfig {\n if (!config) {\n return {\n configurable: patch,\n };\n } else if (!(\"configurable\" in config)) {\n return {\n ...config,\n configurable: patch,\n };\n } else {\n return {\n ...config,\n configurable: {\n ...config.configurable,\n ...patch,\n },\n };\n }\n}\n\nexport function isAsyncGeneratorFunction(\n val: unknown\n): val is AsyncGeneratorFunction {\n return (\n val != null &&\n typeof val === \"function\" &&\n // eslint-disable-next-line no-instanceof/no-instanceof\n val instanceof Object.getPrototypeOf(async function* () {}).constructor\n );\n}\n\nexport function isGeneratorFunction(val: unknown): val is GeneratorFunction {\n return (\n val != null &&\n typeof val === \"function\" &&\n // eslint-disable-next-line no-instanceof/no-instanceof\n val instanceof Object.getPrototypeOf(function* () {}).constructor\n );\n}\n"],"mappings":";;;;AAoBA,IAAa,mBAAb,cAAgE,SAAe;CAC7E,eAAyB,CAAC,YAAY;CAGtC;CAEA;CAEA;CAEA,QAAiB;CAEjB,UAAmB;CAEnB,YAAY,QAA8B;AACxC,SAAO;AACP,OAAK,OAAO,OAAO,QAAQ,OAAO,KAAK;AACvC,OAAK,OAAO,OAAO;AACnB,OAAK,SAAS,OAAO,OAAO,EAAE,MAAM,OAAO,MAAM,GAAG,KAAA;AACpD,OAAK,QAAQ,OAAO,SAAS,KAAK;AAClC,OAAK,UAAU,OAAO,WAAW,KAAK;;CAGxC,MAAgB,cACd,OACA,QACA,YACA;AACA,SAAO,IAAI,SAAY,SAAS,WAAW;GACzC,MAAM,cAAc,YAAY,QAAQ,EACtC,WAAW,YAAY,UAAU,EAClC,CAAC;AACG,sCAAmC,cACtC,aACA,YAAY;AACV,QAAI;AAEF,aADe,MAAM,KAAK,KAAK,OAAO,YAAY,CACnC;aACR,GAAG;AACV,YAAO,EAAE;;KAGd;IACD;;CAGJ,MAAM,OAEJ,OACA,SAEY;EAEZ,IAAI;EACJ,MAAM,SAAS,sBAAsB,QAAQ;EAC7C,MAAM,eAAe,aAAa,KAAK,QAAQ,OAAO;AAEtD,MAAI,KAAK,MACP,eAAc,MAAM,KAAK,gBACvB,KAAK,eACL,OACA,aACD;MAED,eAAc,MAAM,mCAAmC,cACrD,cACA,YAAY,KAAK,KAAK,OAAO,aAAa,CAC3C;AAGH,MAAI,SAAS,WAAW,YAAY,IAAI,KAAK,QAC3C,QAAO,MAAM,mCAAmC,cAC9C,cACA,YAAY,YAAY,OAAO,OAAO,aAAa,CACpD;AAGH,SAAO;;;AAqBX,UAAiB,gBAIf,WACA,QACoD;AACpD,KAAI,WAAW,KAAA,EACb,QAAO;KAEP,MAAK,MAAM,SAAS,UAClB,OAAM,CAAC,QAAQ,MAAM;;AAM3B,eAAsB,eACpB,GAKmB;CACnB,MAAM,MAAW,EAAE;AACnB,YAAW,MAAM,QAAQ,MAAM,EAC7B,KAAI,KAAK,KAAK;AAEhB,QAAO;;AAGT,SAAgB,mBAAsB,GAA0B;CAC9D,MAAM,MAAW,EAAE;AACnB,MAAK,MAAM,QAAQ,EACjB,KAAI,KAAK,KAAK;AAEhB,QAAO;;AAGT,SAAgB,kBACd,QAEA,OACgB;AAChB,KAAI,CAAC,OACH,QAAO,EACL,cAAc,OACf;UACQ,EAAE,kBAAkB,QAC7B,QAAO;EACL,GAAG;EACH,cAAc;EACf;KAED,QAAO;EACL,GAAG;EACH,cAAc;GACZ,GAAG,OAAO;GACV,GAAG;GACJ;EACF;;AAIL,SAAgB,yBACd,KAC+B;AAC/B,QACE,OAAO,QACP,OAAO,QAAQ,cAEf,eAAe,OAAO,eAAe,mBAAmB,GAAG,CAAC;;AAIhE,SAAgB,oBAAoB,KAAwC;AAC1E,QACE,OAAO,QACP,OAAO,QAAQ,cAEf,eAAe,OAAO,eAAe,aAAa,GAAG,CAAC"}
|
package/dist/web.cjs
CHANGED
|
@@ -4,6 +4,8 @@ const require_errors = require("./errors.cjs");
|
|
|
4
4
|
const require_base = require("./channels/base.cjs");
|
|
5
5
|
const require_binop = require("./channels/binop.cjs");
|
|
6
6
|
const require_annotation = require("./graph/annotation.cjs");
|
|
7
|
+
const require_config = require("./pregel/utils/config.cjs");
|
|
8
|
+
const require_interrupt = require("./interrupt.cjs");
|
|
7
9
|
const require_graph = require("./graph/graph.cjs");
|
|
8
10
|
const require_types = require("./state/types.cjs");
|
|
9
11
|
const require_adapter = require("./state/adapter.cjs");
|
|
@@ -20,6 +22,7 @@ const require_message = require("./graph/message.cjs");
|
|
|
20
22
|
require("./graph/index.cjs");
|
|
21
23
|
const require_index$2 = require("./func/index.cjs");
|
|
22
24
|
const require_messages_annotation = require("./graph/messages_annotation.cjs");
|
|
25
|
+
const require_writer = require("./writer.cjs");
|
|
23
26
|
let _langchain_langgraph_checkpoint = require("@langchain/langgraph-checkpoint");
|
|
24
27
|
exports.Annotation = require_annotation.Annotation;
|
|
25
28
|
Object.defineProperty(exports, "AsyncBatchedStore", {
|
|
@@ -103,9 +106,15 @@ Object.defineProperty(exports, "emptyCheckpoint", {
|
|
|
103
106
|
}
|
|
104
107
|
});
|
|
105
108
|
exports.entrypoint = require_index$2.entrypoint;
|
|
109
|
+
exports.getConfig = require_config.getConfig;
|
|
110
|
+
exports.getCurrentTaskInput = require_config.getCurrentTaskInput;
|
|
106
111
|
exports.getJsonSchemaFromSchema = require_adapter.getJsonSchemaFromSchema;
|
|
112
|
+
exports.getPreviousState = require_index$2.getPreviousState;
|
|
107
113
|
exports.getSchemaDefaultGetter = require_adapter.getSchemaDefaultGetter;
|
|
114
|
+
exports.getStore = require_config.getStore;
|
|
108
115
|
exports.getSubgraphsSeenSet = require_errors.getSubgraphsSeenSet;
|
|
116
|
+
exports.getWriter = require_config.getWriter;
|
|
117
|
+
exports.interrupt = require_interrupt.interrupt;
|
|
109
118
|
exports.isCommand = require_constants.isCommand;
|
|
110
119
|
exports.isGraphBubbleUp = require_errors.isGraphBubbleUp;
|
|
111
120
|
exports.isGraphInterrupt = require_errors.isGraphInterrupt;
|
|
@@ -114,4 +123,6 @@ exports.isParentCommand = require_errors.isParentCommand;
|
|
|
114
123
|
exports.isSerializableSchema = require_types.isSerializableSchema;
|
|
115
124
|
exports.isStandardSchema = require_types.isStandardSchema;
|
|
116
125
|
exports.messagesStateReducer = require_messages_reducer.messagesStateReducer;
|
|
126
|
+
exports.pushMessage = require_message.pushMessage;
|
|
117
127
|
exports.task = require_index$2.task;
|
|
128
|
+
exports.writer = require_writer.writer;
|
package/dist/web.d.cts
CHANGED
|
@@ -15,6 +15,8 @@ import { PregelNode } from "./pregel/read.cjs";
|
|
|
15
15
|
import { GetStateOptions, MultipleChannelSubscriptionOptions, PregelOptions, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./pregel/types.cjs";
|
|
16
16
|
import { Pregel } from "./pregel/index.cjs";
|
|
17
17
|
import { CompiledGraph, Graph } from "./graph/graph.cjs";
|
|
18
|
+
import { InferInterruptInputType, InferInterruptResumeType, interrupt } from "./interrupt.cjs";
|
|
19
|
+
import { InferWriterType, writer } from "./writer.cjs";
|
|
18
20
|
import { isSerializableSchema, isStandardSchema } from "./state/types.cjs";
|
|
19
21
|
import { ReducedValue, ReducedValueInit } from "./state/values/reduced.cjs";
|
|
20
22
|
import { UntrackedValue, UntrackedValueInit } from "./state/values/untracked.cjs";
|
|
@@ -22,11 +24,12 @@ import { InferStateSchemaUpdate, InferStateSchemaValue, StateSchema, StateSchema
|
|
|
22
24
|
import { ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ExtractStateType, ExtractUpdateType, GraphNode, GraphNodeReturnValue, GraphNodeTypes, StateDefinitionInit, StateGraphInit, StateGraphOptions } from "./graph/types.cjs";
|
|
23
25
|
import { CompiledStateGraph, StateGraph, StateGraphArgs } from "./graph/state.cjs";
|
|
24
26
|
import { Messages, REMOVE_ALL_MESSAGES, messagesStateReducer } from "./graph/messages_reducer.cjs";
|
|
25
|
-
import { MessageGraph } from "./graph/message.cjs";
|
|
27
|
+
import { MessageGraph, pushMessage } from "./graph/message.cjs";
|
|
26
28
|
import { BaseLangGraphError, BaseLangGraphErrorFields, EmptyChannelError, EmptyInputError, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, InvalidUpdateError, MultipleSubgraphsError, NodeInterrupt, ParentCommand, RemoteException, StateGraphInputError, UnreachableNodeError, getSubgraphsSeenSet, isGraphBubbleUp, isGraphInterrupt, isParentCommand } from "./errors.cjs";
|
|
27
|
-
import { EntrypointOptions, TaskOptions, entrypoint, task } from "./func/index.cjs";
|
|
29
|
+
import { EntrypointOptions, TaskOptions, entrypoint, getPreviousState, task } from "./func/index.cjs";
|
|
28
30
|
import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/messages_annotation.cjs";
|
|
29
31
|
import { getJsonSchemaFromSchema, getSchemaDefaultGetter } from "./state/adapter.cjs";
|
|
30
32
|
import { MessagesValue } from "./state/prebuilt/messages.cjs";
|
|
33
|
+
import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.cjs";
|
|
31
34
|
import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "@langchain/langgraph-checkpoint";
|
|
32
|
-
export { Annotation, type AnnotationRoot, type AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, type BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, Command, CommandInstance, type CommandParams, type CompiledGraph, CompiledStateGraph, type ConditionalEdgeRouter, type ConditionalEdgeRouterTypes, type ContextSchemaInit, type DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, type EntrypointOptions, type EphemeralValue, type ExtractStateType, type ExtractUpdateType, type GetOperation, type GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, type GraphNode, type GraphNodeReturnValue, type GraphNodeTypes, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, InferStateSchemaUpdate, InferStateSchemaValue, type Interrupt, InvalidUpdateError, type Item, type LangGraphRunnableConfig, type LastValue, type ListNamespacesOperation, type MatchCondition, MemorySaver, MessageGraph, type Messages, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, type MultipleChannelSubscriptionOptions, MultipleSubgraphsError, type NameSpacePath, type NamedBarrierValue, type NamespaceMatchType, NodeInterrupt, type NodeType, type Operation, type OperationResults, Overwrite, type OverwriteValue, ParentCommand, type Pregel, type PregelNode, type PregelOptions, type PregelParams, type PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, type RetryPolicy, type Runtime, START, type SearchOperation, Send, type SingleChannelSubscriptionOptions, type SingleReducer, type StateDefinition, type StateDefinitionInit, StateGraph, type StateGraphArgs, type StateGraphInit, StateGraphInputError, type StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFields, type StateSnapshot, type StateType, type StreamMode, type StreamOutputMap, type TaskOptions, type Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, type UpdateType, type WaitForNames, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getJsonSchemaFromSchema, getSchemaDefaultGetter, getSubgraphsSeenSet, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, task };
|
|
35
|
+
export { Annotation, type AnnotationRoot, type AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, type BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, Command, CommandInstance, type CommandParams, type CompiledGraph, CompiledStateGraph, type ConditionalEdgeRouter, type ConditionalEdgeRouterTypes, type ContextSchemaInit, type DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, type EntrypointOptions, type EphemeralValue, type ExtractStateType, type ExtractUpdateType, type GetOperation, type GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, type GraphNode, type GraphNodeReturnValue, type GraphNodeTypes, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, type InferInterruptInputType, type InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, type InferWriterType, type Interrupt, InvalidUpdateError, type Item, type LangGraphRunnableConfig, type LastValue, type ListNamespacesOperation, type MatchCondition, MemorySaver, MessageGraph, type Messages, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, type MultipleChannelSubscriptionOptions, MultipleSubgraphsError, type NameSpacePath, type NamedBarrierValue, type NamespaceMatchType, NodeInterrupt, type NodeType, type Operation, type OperationResults, Overwrite, type OverwriteValue, ParentCommand, type Pregel, type PregelNode, type PregelOptions, type PregelParams, type PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, type RetryPolicy, type Runtime, START, type SearchOperation, Send, type SingleChannelSubscriptionOptions, type SingleReducer, type StateDefinition, type StateDefinitionInit, StateGraph, type StateGraphArgs, type StateGraphInit, StateGraphInputError, type StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFields, type StateSnapshot, type StateType, type StreamMode, type StreamOutputMap, type TaskOptions, type Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, type UpdateType, type WaitForNames, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
|
package/dist/web.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ import { PregelNode } from "./pregel/read.js";
|
|
|
15
15
|
import { GetStateOptions, MultipleChannelSubscriptionOptions, PregelOptions, PregelParams, SingleChannelSubscriptionOptions, StateSnapshot, StreamMode, StreamOutputMap } from "./pregel/types.js";
|
|
16
16
|
import { Pregel } from "./pregel/index.js";
|
|
17
17
|
import { CompiledGraph, Graph } from "./graph/graph.js";
|
|
18
|
+
import { InferInterruptInputType, InferInterruptResumeType, interrupt } from "./interrupt.js";
|
|
19
|
+
import { InferWriterType, writer } from "./writer.js";
|
|
18
20
|
import { isSerializableSchema, isStandardSchema } from "./state/types.js";
|
|
19
21
|
import { ReducedValue, ReducedValueInit } from "./state/values/reduced.js";
|
|
20
22
|
import { UntrackedValue, UntrackedValueInit } from "./state/values/untracked.js";
|
|
@@ -22,11 +24,12 @@ import { InferStateSchemaUpdate, InferStateSchemaValue, StateSchema, StateSchema
|
|
|
22
24
|
import { ConditionalEdgeRouter, ConditionalEdgeRouterTypes, ContextSchemaInit, ExtractStateType, ExtractUpdateType, GraphNode, GraphNodeReturnValue, GraphNodeTypes, StateDefinitionInit, StateGraphInit, StateGraphOptions } from "./graph/types.js";
|
|
23
25
|
import { CompiledStateGraph, StateGraph, StateGraphArgs } from "./graph/state.js";
|
|
24
26
|
import { Messages, REMOVE_ALL_MESSAGES, messagesStateReducer } from "./graph/messages_reducer.js";
|
|
25
|
-
import { MessageGraph } from "./graph/message.js";
|
|
27
|
+
import { MessageGraph, pushMessage } from "./graph/message.js";
|
|
26
28
|
import { BaseLangGraphError, BaseLangGraphErrorFields, EmptyChannelError, EmptyInputError, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, InvalidUpdateError, MultipleSubgraphsError, NodeInterrupt, ParentCommand, RemoteException, StateGraphInputError, UnreachableNodeError, getSubgraphsSeenSet, isGraphBubbleUp, isGraphInterrupt, isParentCommand } from "./errors.js";
|
|
27
|
-
import { EntrypointOptions, TaskOptions, entrypoint, task } from "./func/index.js";
|
|
29
|
+
import { EntrypointOptions, TaskOptions, entrypoint, getPreviousState, task } from "./func/index.js";
|
|
28
30
|
import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/messages_annotation.js";
|
|
29
31
|
import { getJsonSchemaFromSchema, getSchemaDefaultGetter } from "./state/adapter.js";
|
|
30
32
|
import { MessagesValue } from "./state/prebuilt/messages.js";
|
|
33
|
+
import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.js";
|
|
31
34
|
import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, Checkpoint, CheckpointMetadata, CheckpointTuple, GetOperation, InMemoryStore, Item, ListNamespacesOperation, MatchCondition, MemorySaver, NameSpacePath, NamespaceMatchType, Operation, OperationResults, PutOperation, SearchOperation, copyCheckpoint, emptyCheckpoint } from "@langchain/langgraph-checkpoint";
|
|
32
|
-
export { Annotation, type AnnotationRoot, type AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, type BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, Command, CommandInstance, type CommandParams, type CompiledGraph, CompiledStateGraph, type ConditionalEdgeRouter, type ConditionalEdgeRouterTypes, type ContextSchemaInit, type DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, type EntrypointOptions, type EphemeralValue, type ExtractStateType, type ExtractUpdateType, type GetOperation, type GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, type GraphNode, type GraphNodeReturnValue, type GraphNodeTypes, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, InferStateSchemaUpdate, InferStateSchemaValue, type Interrupt, InvalidUpdateError, type Item, type LangGraphRunnableConfig, type LastValue, type ListNamespacesOperation, type MatchCondition, MemorySaver, MessageGraph, type Messages, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, type MultipleChannelSubscriptionOptions, MultipleSubgraphsError, type NameSpacePath, type NamedBarrierValue, type NamespaceMatchType, NodeInterrupt, type NodeType, type Operation, type OperationResults, Overwrite, type OverwriteValue, ParentCommand, type Pregel, type PregelNode, type PregelOptions, type PregelParams, type PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, type RetryPolicy, type Runtime, START, type SearchOperation, Send, type SingleChannelSubscriptionOptions, type SingleReducer, type StateDefinition, type StateDefinitionInit, StateGraph, type StateGraphArgs, type StateGraphInit, StateGraphInputError, type StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFields, type StateSnapshot, type StateType, type StreamMode, type StreamOutputMap, type TaskOptions, type Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, type UpdateType, type WaitForNames, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getJsonSchemaFromSchema, getSchemaDefaultGetter, getSubgraphsSeenSet, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, task };
|
|
35
|
+
export { Annotation, type AnnotationRoot, type AnyValue, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseLangGraphErrorFields, BaseStore, type BinaryOperator, BinaryOperatorAggregate, COMMAND_SYMBOL, type Checkpoint, type CheckpointMetadata, type CheckpointTuple, Command, CommandInstance, type CommandParams, type CompiledGraph, CompiledStateGraph, type ConditionalEdgeRouter, type ConditionalEdgeRouterTypes, type ContextSchemaInit, type DynamicBarrierValue, END, EmptyChannelError, EmptyInputError, type EntrypointOptions, type EphemeralValue, type ExtractStateType, type ExtractUpdateType, type GetOperation, type GetStateOptions, Graph, GraphBubbleUp, GraphInterrupt, type GraphNode, type GraphNodeReturnValue, type GraphNodeTypes, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, type InferInterruptInputType, type InferInterruptResumeType, InferStateSchemaUpdate, InferStateSchemaValue, type InferWriterType, type Interrupt, InvalidUpdateError, type Item, type LangGraphRunnableConfig, type LastValue, type ListNamespacesOperation, type MatchCondition, MemorySaver, MessageGraph, type Messages, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, type MultipleChannelSubscriptionOptions, MultipleSubgraphsError, type NameSpacePath, type NamedBarrierValue, type NamespaceMatchType, NodeInterrupt, type NodeType, type Operation, type OperationResults, Overwrite, type OverwriteValue, ParentCommand, type Pregel, type PregelNode, type PregelOptions, type PregelParams, type PutOperation, REMOVE_ALL_MESSAGES, ReducedValue, ReducedValueInit, RemoteException, type RetryPolicy, type Runtime, START, type SearchOperation, Send, type SingleChannelSubscriptionOptions, type SingleReducer, type StateDefinition, type StateDefinitionInit, StateGraph, type StateGraphArgs, type StateGraphInit, StateGraphInputError, type StateGraphOptions, StateSchema, StateSchemaField, StateSchemaFields, type StateSnapshot, type StateType, type StreamMode, type StreamOutputMap, type TaskOptions, type Topic, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, UntrackedValueInit, type UpdateType, type WaitForNames, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
|
package/dist/web.js
CHANGED
|
@@ -3,6 +3,8 @@ import { BaseLangGraphError, EmptyChannelError, EmptyInputError, GraphBubbleUp,
|
|
|
3
3
|
import { BaseChannel } from "./channels/base.js";
|
|
4
4
|
import { BinaryOperatorAggregate } from "./channels/binop.js";
|
|
5
5
|
import { Annotation } from "./graph/annotation.js";
|
|
6
|
+
import { getConfig, getCurrentTaskInput, getStore, getWriter } from "./pregel/utils/config.js";
|
|
7
|
+
import { interrupt } from "./interrupt.js";
|
|
6
8
|
import { Graph } from "./graph/graph.js";
|
|
7
9
|
import { isSerializableSchema, isStandardSchema } from "./state/types.js";
|
|
8
10
|
import { getJsonSchemaFromSchema, getSchemaDefaultGetter } from "./state/adapter.js";
|
|
@@ -15,9 +17,10 @@ import { REMOVE_ALL_MESSAGES, messagesStateReducer } from "./graph/messages_redu
|
|
|
15
17
|
import { MessagesValue } from "./state/prebuilt/messages.js";
|
|
16
18
|
import "./state/index.js";
|
|
17
19
|
import { CompiledStateGraph, StateGraph } from "./graph/state.js";
|
|
18
|
-
import { MessageGraph } from "./graph/message.js";
|
|
20
|
+
import { MessageGraph, pushMessage } from "./graph/message.js";
|
|
19
21
|
import "./graph/index.js";
|
|
20
|
-
import { entrypoint, task } from "./func/index.js";
|
|
22
|
+
import { entrypoint, getPreviousState, task } from "./func/index.js";
|
|
21
23
|
import { MessagesAnnotation, MessagesZodMeta, MessagesZodState } from "./graph/messages_annotation.js";
|
|
24
|
+
import { writer } from "./writer.js";
|
|
22
25
|
import { AsyncBatchedStore, BaseCheckpointSaver, BaseStore, InMemoryStore, MemorySaver, copyCheckpoint, emptyCheckpoint } from "@langchain/langgraph-checkpoint";
|
|
23
|
-
export { Annotation, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseStore, BinaryOperatorAggregate, COMMAND_SYMBOL, Command, CommandInstance, CompiledStateGraph, END, EmptyChannelError, EmptyInputError, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, InvalidUpdateError, MemorySaver, MessageGraph, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleSubgraphsError, NodeInterrupt, Overwrite, ParentCommand, REMOVE_ALL_MESSAGES, ReducedValue, RemoteException, START, Send, StateGraph, StateGraphInputError, StateSchema, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getJsonSchemaFromSchema, getSchemaDefaultGetter, getSubgraphsSeenSet, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, task };
|
|
26
|
+
export { Annotation, AsyncBatchedStore, BaseChannel, BaseCheckpointSaver, BaseLangGraphError, BaseStore, BinaryOperatorAggregate, COMMAND_SYMBOL, Command, CommandInstance, CompiledStateGraph, END, EmptyChannelError, EmptyInputError, Graph, GraphBubbleUp, GraphInterrupt, GraphRecursionError, GraphValueError, INTERRUPT, InMemoryStore, InvalidUpdateError, MemorySaver, MessageGraph, MessagesAnnotation, MessagesValue, MessagesZodMeta, MessagesZodState, MultipleSubgraphsError, NodeInterrupt, Overwrite, ParentCommand, REMOVE_ALL_MESSAGES, ReducedValue, RemoteException, START, Send, StateGraph, StateGraphInputError, StateSchema, UnreachableNodeError, UntrackedValue, UntrackedValueChannel, messagesStateReducer as addMessages, copyCheckpoint, emptyCheckpoint, entrypoint, getConfig, getCurrentTaskInput, getJsonSchemaFromSchema, getPreviousState, getSchemaDefaultGetter, getStore, getSubgraphsSeenSet, getWriter, interrupt, isCommand, isGraphBubbleUp, isGraphInterrupt, isInterrupted, isParentCommand, isSerializableSchema, isStandardSchema, messagesStateReducer, pushMessage, task, writer };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@langchain/langgraph",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "LangGraph",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@standard-schema/spec": "1.1.0",
|
|
20
20
|
"uuid": "^10.0.0",
|
|
21
21
|
"@langchain/langgraph-checkpoint": "^1.0.1",
|
|
22
|
-
"@langchain/langgraph-sdk": "~1.8.
|
|
22
|
+
"@langchain/langgraph-sdk": "~1.8.5"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"@langchain/core": "^1.1.16",
|
|
@@ -32,9 +32,9 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
|
-
"@langchain/anthropic": "^1.
|
|
36
|
-
"@langchain/core": "^1.1.
|
|
37
|
-
"@langchain/openai": "^1.
|
|
35
|
+
"@langchain/anthropic": "^1.3.26",
|
|
36
|
+
"@langchain/core": "^1.1.38",
|
|
37
|
+
"@langchain/openai": "^1.4.1",
|
|
38
38
|
"@langchain/scripts": ">=0.1.3 <0.2.0",
|
|
39
39
|
"@langchain/tavily": "^1.0.0",
|
|
40
40
|
"@swc/core": "^1.3.90",
|
|
@@ -42,23 +42,14 @@
|
|
|
42
42
|
"@tsconfig/recommended": "^1.0.3",
|
|
43
43
|
"@types/pg": "^8",
|
|
44
44
|
"@types/uuid": "^10",
|
|
45
|
-
"@typescript-eslint/eslint-plugin": "^6.12.0",
|
|
46
|
-
"@typescript-eslint/parser": "^6.12.0",
|
|
47
45
|
"@vitest/browser": "^3.0.8",
|
|
48
46
|
"@xenova/transformers": "^2.17.2",
|
|
49
47
|
"cheerio": "1.0.0-rc.12",
|
|
50
48
|
"dotenv": "^16.3.1",
|
|
51
49
|
"dpdm": "^3.12.0",
|
|
52
|
-
"
|
|
53
|
-
"eslint-config-airbnb-base": "^15.0.0",
|
|
54
|
-
"eslint-config-prettier": "^8.6.0",
|
|
55
|
-
"eslint-plugin-import": "^2.29.1",
|
|
56
|
-
"eslint-plugin-no-instanceof": "^1.0.1",
|
|
57
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
58
|
-
"langchain": "^1.0.0-alpha",
|
|
50
|
+
"langchain": "^1.3.0",
|
|
59
51
|
"pg": "^8.13.0",
|
|
60
52
|
"playwright": "^1.55.1",
|
|
61
|
-
"prettier": "^2.8.3",
|
|
62
53
|
"rollup": "^4.37.0",
|
|
63
54
|
"tsx": "^4.19.3",
|
|
64
55
|
"typescript": "^4.9.5 || ^5.4.5",
|
|
@@ -74,6 +65,7 @@
|
|
|
74
65
|
},
|
|
75
66
|
"exports": {
|
|
76
67
|
".": {
|
|
68
|
+
"browser": "./dist/web.js",
|
|
77
69
|
"input": "./src/index.ts",
|
|
78
70
|
"typedoc": "./src/index.ts",
|
|
79
71
|
"import": {
|
|
@@ -180,15 +172,11 @@
|
|
|
180
172
|
"clean": "rm -rf dist/ dist-cjs/ .turbo/",
|
|
181
173
|
"lint:eslint": "NODE_OPTIONS=--max-old-space-size=4096 eslint --cache --ext .ts,.js src/",
|
|
182
174
|
"lint:dpdm": "dpdm --exit-code circular:1 --no-warning --no-tree src/*.ts src/**/*.ts",
|
|
183
|
-
"lint": "pnpm lint:eslint && pnpm lint:dpdm",
|
|
184
|
-
"lint:fix": "pnpm lint:eslint --fix && pnpm lint:dpdm",
|
|
185
175
|
"prepublish": "pnpm build",
|
|
186
176
|
"test": "vitest run",
|
|
187
177
|
"test:browser": "vitest run --mode browser",
|
|
188
178
|
"test:watch": "vitest watch",
|
|
189
179
|
"test:int": "vitest run --mode int",
|
|
190
|
-
"bench": "vitest bench --mode bench"
|
|
191
|
-
"format": "prettier --config .prettierrc --write \"src\"",
|
|
192
|
-
"format:check": "prettier --config .prettierrc --check \"src\""
|
|
180
|
+
"bench": "vitest bench --mode bench"
|
|
193
181
|
}
|
|
194
182
|
}
|