{"version":3,"file":"messages.cjs","names":["z","ReducedValue","messagesStateReducer","DeltaValue","messagesDeltaReducer"],"sources":["../../../src/state/prebuilt/messages.ts"],"sourcesContent":["import type { BaseMessage } from \"@langchain/core/messages\";\nimport { z } from \"zod/v4\";\n\nimport { ReducedValue } from \"../values/reduced.js\";\nimport { DeltaValue } from \"../values/delta.js\";\nimport {\n  messagesStateReducer,\n  messagesDeltaReducer,\n  type Messages,\n} from \"../../graph/messages_reducer.js\";\n\nconst messagesValueSchema = z.custom<BaseMessage[]>().default(() => []);\nconst messagesInputSchema = z.custom<Messages>();\n\nexport const MessagesValue = new ReducedValue(\n  // Value schema: array of BaseMessage\n  messagesValueSchema,\n  {\n    // Input schema: accepts flexible message types\n    inputSchema: messagesInputSchema,\n    // Use the existing messagesStateReducer\n    reducer: messagesStateReducer,\n    // JSON schema extras for Studio\n    jsonSchemaExtra: {\n      langgraph_type: \"messages\",\n      description: \"A list of chat messages\",\n    },\n  }\n);\n\n/**\n * **Experimental.** A messages state field backed by a `DeltaChannel`.\n *\n * A drop-in alternative to {@link MessagesValue} that persists only per-step\n * message deltas (plus periodic snapshots) instead of the full accumulated\n * history in every checkpoint blob. Useful for long-running threads where\n * re-serializing the entire message list on each step is costly.\n *\n * @example\n * ```ts\n * import { StateSchema, MessagesDeltaValue } from \"@langchain/langgraph\";\n *\n * const State = new StateSchema({ messages: MessagesDeltaValue });\n * ```\n */\nexport const MessagesDeltaValue = new DeltaValue(messagesValueSchema, {\n  inputSchema: messagesInputSchema,\n  reducer: messagesDeltaReducer,\n  jsonSchemaExtra: {\n    langgraph_type: \"messages\",\n    description: \"A list of chat messages\",\n  },\n});\n"],"mappings":";;;;;AAWA,MAAM,sBAAsBA,OAAAA,EAAE,QAAuB,CAAC,cAAc,EAAE,CAAC;AACvE,MAAM,sBAAsBA,OAAAA,EAAE,QAAkB;AAEhD,MAAa,gBAAgB,IAAIC,gBAAAA,aAE/B,qBACA;CAEE,aAAa;CAEb,SAASC,yBAAAA;CAET,iBAAiB;EACf,gBAAgB;EAChB,aAAa;EACd;CACF,CACF;;;;;;;;;;;;;;;;AAiBD,MAAa,qBAAqB,IAAIC,cAAAA,WAAW,qBAAqB;CACpE,aAAa;CACb,SAASC,yBAAAA;CACT,iBAAiB;EACf,gBAAgB;EAChB,aAAa;EACd;CACF,CAAC"}