@langchain/langgraph-sdk 1.4.4 → 1.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/README.md +2 -2
  2. package/dist/_virtual/rolldown_runtime.cjs +29 -0
  3. package/dist/auth/error.cjs +79 -0
  4. package/dist/auth/error.cjs.map +1 -0
  5. package/dist/auth/error.d.cts +13 -0
  6. package/dist/auth/error.d.cts.map +1 -0
  7. package/dist/auth/error.d.ts +13 -0
  8. package/dist/auth/error.d.ts.map +1 -0
  9. package/dist/auth/error.js +78 -0
  10. package/dist/auth/error.js.map +1 -0
  11. package/dist/auth/index.cjs +39 -0
  12. package/dist/auth/index.cjs.map +1 -0
  13. package/dist/auth/index.d.cts +29 -0
  14. package/dist/auth/index.d.cts.map +1 -0
  15. package/dist/auth/index.d.ts +29 -0
  16. package/dist/auth/index.d.ts.map +1 -0
  17. package/dist/auth/index.js +37 -0
  18. package/dist/auth/index.js.map +1 -0
  19. package/dist/auth/types.d.cts +294 -0
  20. package/dist/auth/types.d.cts.map +1 -0
  21. package/dist/auth/types.d.ts +294 -0
  22. package/dist/auth/types.d.ts.map +1 -0
  23. package/dist/client.cjs +1210 -0
  24. package/dist/client.cjs.map +1 -0
  25. package/dist/client.d.cts +799 -0
  26. package/dist/client.d.cts.map +1 -0
  27. package/dist/client.d.ts +799 -0
  28. package/dist/client.d.ts.map +1 -0
  29. package/dist/client.js +1203 -0
  30. package/dist/client.js.map +1 -0
  31. package/dist/index.cjs +6 -0
  32. package/dist/index.d.cts +8 -0
  33. package/dist/index.d.ts +8 -0
  34. package/dist/index.js +4 -0
  35. package/dist/logging/index.cjs +35 -0
  36. package/dist/logging/index.cjs.map +1 -0
  37. package/dist/logging/index.d.cts +46 -0
  38. package/dist/logging/index.d.cts.map +1 -0
  39. package/dist/logging/index.d.ts +46 -0
  40. package/dist/logging/index.d.ts.map +1 -0
  41. package/dist/logging/index.js +34 -0
  42. package/dist/logging/index.js.map +1 -0
  43. package/dist/react/index.cjs +5 -0
  44. package/dist/react/index.d.cts +5 -0
  45. package/dist/react/index.d.ts +5 -0
  46. package/dist/react/index.js +4 -0
  47. package/dist/react/stream.cjs +18 -0
  48. package/dist/react/stream.cjs.map +1 -0
  49. package/dist/react/stream.custom.cjs +135 -0
  50. package/dist/react/stream.custom.cjs.map +1 -0
  51. package/dist/react/stream.custom.d.cts +40 -0
  52. package/dist/react/stream.custom.d.cts.map +1 -0
  53. package/dist/react/stream.custom.d.ts +40 -0
  54. package/dist/react/stream.custom.d.ts.map +1 -0
  55. package/dist/react/stream.custom.js +133 -0
  56. package/dist/react/stream.custom.js.map +1 -0
  57. package/dist/react/stream.d.cts +155 -0
  58. package/dist/react/stream.d.cts.map +1 -0
  59. package/dist/react/stream.d.ts +155 -0
  60. package/dist/react/stream.d.ts.map +1 -0
  61. package/dist/react/stream.js +17 -0
  62. package/dist/react/stream.js.map +1 -0
  63. package/dist/react/stream.lgp.cjs +448 -0
  64. package/dist/react/stream.lgp.cjs.map +1 -0
  65. package/dist/react/stream.lgp.js +447 -0
  66. package/dist/react/stream.lgp.js.map +1 -0
  67. package/dist/react/thread.cjs +21 -0
  68. package/dist/react/thread.cjs.map +1 -0
  69. package/dist/react/thread.js +20 -0
  70. package/dist/react/thread.js.map +1 -0
  71. package/dist/react/types.d.cts +152 -0
  72. package/dist/react/types.d.cts.map +1 -0
  73. package/dist/react/types.d.ts +152 -0
  74. package/dist/react/types.d.ts.map +1 -0
  75. package/dist/react-ui/client.cjs +138 -0
  76. package/dist/react-ui/client.cjs.map +1 -0
  77. package/dist/react-ui/client.d.cts +73 -0
  78. package/dist/react-ui/client.d.cts.map +1 -0
  79. package/dist/react-ui/client.d.ts +73 -0
  80. package/dist/react-ui/client.d.ts.map +1 -0
  81. package/dist/react-ui/client.js +132 -0
  82. package/dist/react-ui/client.js.map +1 -0
  83. package/dist/react-ui/index.cjs +14 -0
  84. package/dist/react-ui/index.cjs.map +1 -0
  85. package/dist/react-ui/index.d.cts +3 -0
  86. package/dist/react-ui/index.d.ts +3 -0
  87. package/dist/react-ui/index.js +9 -0
  88. package/dist/react-ui/index.js.map +1 -0
  89. package/dist/react-ui/server/index.cjs +5 -0
  90. package/dist/react-ui/server/index.d.cts +3 -0
  91. package/dist/react-ui/server/index.d.ts +3 -0
  92. package/dist/react-ui/server/index.js +4 -0
  93. package/dist/react-ui/server/server.cjs +57 -0
  94. package/dist/react-ui/server/server.cjs.map +1 -0
  95. package/dist/react-ui/server/server.d.cts +55 -0
  96. package/dist/react-ui/server/server.d.cts.map +1 -0
  97. package/dist/react-ui/server/server.d.ts +55 -0
  98. package/dist/react-ui/server/server.d.ts.map +1 -0
  99. package/dist/react-ui/server/server.js +56 -0
  100. package/dist/react-ui/server/server.js.map +1 -0
  101. package/dist/react-ui/types.cjs +38 -0
  102. package/dist/react-ui/types.cjs.map +1 -0
  103. package/dist/react-ui/types.d.cts +25 -0
  104. package/dist/react-ui/types.d.cts.map +1 -0
  105. package/dist/react-ui/types.d.ts +25 -0
  106. package/dist/react-ui/types.d.ts.map +1 -0
  107. package/dist/react-ui/types.js +35 -0
  108. package/dist/react-ui/types.js.map +1 -0
  109. package/dist/schema.d.cts +284 -0
  110. package/dist/schema.d.cts.map +1 -0
  111. package/dist/schema.d.ts +284 -0
  112. package/dist/schema.d.ts.map +1 -0
  113. package/dist/singletons/fetch.cjs +24 -0
  114. package/dist/singletons/fetch.cjs.map +1 -0
  115. package/dist/singletons/fetch.d.cts +14 -0
  116. package/dist/singletons/fetch.d.cts.map +1 -0
  117. package/dist/singletons/fetch.d.ts +14 -0
  118. package/dist/singletons/fetch.d.ts.map +1 -0
  119. package/dist/singletons/fetch.js +22 -0
  120. package/dist/singletons/fetch.js.map +1 -0
  121. package/dist/types.d.cts +187 -0
  122. package/dist/types.d.cts.map +1 -0
  123. package/dist/types.d.ts +187 -0
  124. package/dist/types.d.ts.map +1 -0
  125. package/dist/types.messages.d.cts +264 -0
  126. package/dist/types.messages.d.cts.map +1 -0
  127. package/dist/types.messages.d.ts +264 -0
  128. package/dist/types.messages.d.ts.map +1 -0
  129. package/dist/types.stream.d.cts +233 -0
  130. package/dist/types.stream.d.cts.map +1 -0
  131. package/dist/types.stream.d.ts +233 -0
  132. package/dist/types.stream.d.ts.map +1 -0
  133. package/dist/types.template.d.cts +19 -0
  134. package/dist/types.template.d.cts.map +1 -0
  135. package/dist/types.template.d.ts +19 -0
  136. package/dist/types.template.d.ts.map +1 -0
  137. package/dist/ui/branching.cjs +153 -0
  138. package/dist/ui/branching.cjs.map +1 -0
  139. package/dist/ui/branching.d.cts +19 -0
  140. package/dist/ui/branching.d.cts.map +1 -0
  141. package/dist/ui/branching.d.ts +19 -0
  142. package/dist/ui/branching.d.ts.map +1 -0
  143. package/dist/ui/branching.js +152 -0
  144. package/dist/ui/branching.js.map +1 -0
  145. package/dist/ui/errors.cjs +15 -0
  146. package/dist/ui/errors.cjs.map +1 -0
  147. package/dist/ui/errors.js +14 -0
  148. package/dist/ui/errors.js.map +1 -0
  149. package/dist/ui/manager.cjs +188 -0
  150. package/dist/ui/manager.cjs.map +1 -0
  151. package/dist/ui/manager.js +188 -0
  152. package/dist/ui/manager.js.map +1 -0
  153. package/dist/ui/messages.cjs +70 -0
  154. package/dist/ui/messages.cjs.map +1 -0
  155. package/dist/ui/messages.js +68 -0
  156. package/dist/ui/messages.js.map +1 -0
  157. package/dist/ui/types.d.cts +420 -0
  158. package/dist/ui/types.d.cts.map +1 -0
  159. package/dist/ui/types.d.ts +420 -0
  160. package/dist/ui/types.d.ts.map +1 -0
  161. package/dist/ui/utils.cjs +13 -0
  162. package/dist/ui/utils.cjs.map +1 -0
  163. package/dist/ui/utils.js +11 -0
  164. package/dist/ui/utils.js.map +1 -0
  165. package/dist/utils/async_caller.cjs +119 -0
  166. package/dist/utils/async_caller.cjs.map +1 -0
  167. package/dist/utils/async_caller.d.cts +51 -0
  168. package/dist/utils/async_caller.d.cts.map +1 -0
  169. package/dist/utils/async_caller.d.ts +51 -0
  170. package/dist/utils/async_caller.d.ts.map +1 -0
  171. package/dist/utils/async_caller.js +116 -0
  172. package/dist/utils/async_caller.js.map +1 -0
  173. package/dist/utils/env.cjs +13 -0
  174. package/dist/utils/env.cjs.map +1 -0
  175. package/dist/utils/env.js +12 -0
  176. package/dist/utils/env.js.map +1 -0
  177. package/dist/utils/error.cjs +17 -0
  178. package/dist/utils/error.cjs.map +1 -0
  179. package/dist/utils/error.js +16 -0
  180. package/dist/utils/error.js.map +1 -0
  181. package/dist/utils/signals.cjs +20 -0
  182. package/dist/utils/signals.cjs.map +1 -0
  183. package/dist/utils/signals.js +19 -0
  184. package/dist/utils/signals.js.map +1 -0
  185. package/dist/utils/sse.cjs +124 -0
  186. package/dist/utils/sse.cjs.map +1 -0
  187. package/dist/utils/sse.js +122 -0
  188. package/dist/utils/sse.js.map +1 -0
  189. package/dist/utils/stream.cjs +174 -0
  190. package/dist/utils/stream.cjs.map +1 -0
  191. package/dist/utils/stream.js +173 -0
  192. package/dist/utils/stream.js.map +1 -0
  193. package/dist/utils/tools.cjs +52 -0
  194. package/dist/utils/tools.cjs.map +1 -0
  195. package/dist/utils/tools.js +51 -0
  196. package/dist/utils/tools.js.map +1 -0
  197. package/package.json +15 -15
@@ -0,0 +1,152 @@
1
+ import { Interrupt, ThreadState } from "../schema.cjs";
2
+ import { AIMessage, Message, ToolCallWithResult } from "../types.messages.cjs";
3
+ import { StreamMode } from "../types.stream.cjs";
4
+ import { Client } from "../client.cjs";
5
+ import { BagTemplate } from "../types.template.cjs";
6
+ import { Sequence } from "../ui/branching.cjs";
7
+ import { CustomSubmitOptions, GetConfigurableType, GetInterruptType, GetToolCallsType, GetUpdateType, MessageMetadata, RunCallbackMeta, SubmitOptions, UseStreamCustomOptions, UseStreamOptions, UseStreamThread, UseStreamTransport } from "../ui/types.cjs";
8
+
9
+ //#region src/react/types.d.ts
10
+ interface UseStream<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> {
11
+ /**
12
+ * The current values of the thread.
13
+ */
14
+ values: StateType;
15
+ /**
16
+ * Last seen error from the thread or during streaming.
17
+ */
18
+ error: unknown;
19
+ /**
20
+ * Whether the stream is currently running.
21
+ */
22
+ isLoading: boolean;
23
+ /**
24
+ * Whether the thread is currently being loaded.
25
+ */
26
+ isThreadLoading: boolean;
27
+ /**
28
+ * Stops the stream.
29
+ */
30
+ stop: () => Promise<void>;
31
+ /**
32
+ * Create and stream a run to the thread.
33
+ */
34
+ submit: (values: GetUpdateType<Bag, StateType> | null | undefined, options?: SubmitOptions<StateType, GetConfigurableType<Bag>>) => Promise<void>;
35
+ /**
36
+ * The current branch of the thread.
37
+ */
38
+ branch: string;
39
+ /**
40
+ * Set the branch of the thread.
41
+ */
42
+ setBranch: (branch: string) => void;
43
+ /**
44
+ * Flattened history of thread states of a thread.
45
+ */
46
+ history: ThreadState<StateType>[];
47
+ /**
48
+ * Tree of all branches for the thread.
49
+ * @experimental
50
+ */
51
+ experimental_branchTree: Sequence<StateType>;
52
+ /**
53
+ * Get the interrupt value for the stream if interrupted.
54
+ */
55
+ interrupt: Interrupt<GetInterruptType<Bag>> | undefined;
56
+ /**
57
+ * Messages inferred from the thread.
58
+ * Will automatically update with incoming message chunks.
59
+ * Includes all message types including ToolMessage.
60
+ */
61
+ messages: Message<GetToolCallsType<StateType>>[];
62
+ /**
63
+ * Tool calls paired with their results.
64
+ * Useful for rendering tool invocations and their outputs together.
65
+ *
66
+ * Each item contains the tool call from an AI message paired with its
67
+ * corresponding ToolMessage result (if available), along with lifecycle state.
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * // With type-safe tool calls - embed the type in your messages
72
+ * type MyToolCalls =
73
+ * | { name: "get_weather"; args: { location: string }; id?: string }
74
+ * | { name: "search"; args: { query: string }; id?: string };
75
+ *
76
+ * interface MyState {
77
+ * messages: Message<MyToolCalls>[];
78
+ * }
79
+ *
80
+ * const stream = useStream<MyState>({ ... });
81
+ *
82
+ * {stream.toolCalls.map(({ id, call, result, state }) => {
83
+ * if (call.name === "get_weather") {
84
+ * // call.args is { location: string }
85
+ * return (
86
+ * <WeatherCard
87
+ * key={id}
88
+ * location={call.args.location}
89
+ * result={result?.content}
90
+ * isLoading={state === "pending"}
91
+ * />
92
+ * );
93
+ * }
94
+ * })}
95
+ * ```
96
+ */
97
+ toolCalls: ToolCallWithResult<GetToolCallsType<StateType>>[];
98
+ /**
99
+ * Get tool calls for a specific AI message.
100
+ * Useful when rendering messages and their associated tool calls together.
101
+ *
102
+ * @param message - The AI message to get tool calls for.
103
+ * @returns Array of tool calls initiated by the message.
104
+ *
105
+ * @example
106
+ * ```tsx
107
+ * {stream.uiMessages.map((message) => {
108
+ * if (message.type === "ai") {
109
+ * const toolCalls = stream.getToolCalls(message);
110
+ * if (toolCalls.length > 0) {
111
+ * return (
112
+ * <div key={message.id}>
113
+ * {toolCalls.map(tc => <ToolCard key={tc.id} toolCall={tc} />)}
114
+ * </div>
115
+ * );
116
+ * }
117
+ * }
118
+ * return <MessageBubble key={message.id} message={message} />;
119
+ * })}
120
+ * ```
121
+ */
122
+ getToolCalls: (message: AIMessage<GetToolCallsType<StateType>>) => ToolCallWithResult<GetToolCallsType<StateType>>[];
123
+ /**
124
+ * Get the metadata for a message, such as first thread state the message
125
+ * was seen in and branch information.
126
+ *
127
+ * @param message - The message to get the metadata for.
128
+ * @param index - The index of the message in the thread.
129
+ * @returns The metadata for the message.
130
+ */
131
+ getMessagesMetadata: (message: Message<GetToolCallsType<StateType>>, index?: number) => MessageMetadata<StateType> | undefined;
132
+ /**
133
+ * LangGraph SDK client used to send request and receive responses.
134
+ */
135
+ client: Client;
136
+ /**
137
+ * The ID of the assistant to use.
138
+ */
139
+ assistantId: string;
140
+ /**
141
+ * Join an active stream.
142
+ */
143
+ joinStream: (runId: string, lastEventId?: string, options?: {
144
+ streamMode?: StreamMode | StreamMode[];
145
+ }) => Promise<void>;
146
+ }
147
+ type UseStreamCustom<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> = Pick<UseStream<StateType, Bag>, "values" | "error" | "isLoading" | "stop" | "interrupt" | "messages" | "toolCalls" | "getToolCalls"> & {
148
+ submit: (values: GetUpdateType<Bag, StateType> | null | undefined, options?: CustomSubmitOptions<StateType, GetConfigurableType<Bag>>) => Promise<void>;
149
+ };
150
+ //#endregion
151
+ export { UseStream, UseStreamCustom };
152
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","names":["Client","ThreadState","Interrupt","Message","AIMessage","ToolCallWithResult","StreamMode","Sequence","GetUpdateType","GetConfigurableType","GetInterruptType","GetToolCallsType","MessageMetadata","UseStreamThread","UseStreamOptions","UseStreamTransport","UseStreamCustomOptions","SubmitOptions","CustomSubmitOptions","RunCallbackMeta","BagTemplate","UseStream","Record","StateType","Promise","Bag","UseStreamCustom","Pick"],"sources":["../../src/react/types.d.ts"],"sourcesContent":["import type { Client } from \"../client.js\";\nimport type { ThreadState, Interrupt } from \"../schema.js\";\nimport type { Message, AIMessage, ToolCallWithResult } from \"../types.messages.js\";\nimport type { StreamMode } from \"../types.stream.js\";\nimport type { Sequence } from \"../ui/branching.js\";\nimport type { GetUpdateType, GetConfigurableType, GetInterruptType, GetToolCallsType, MessageMetadata, UseStreamThread, UseStreamOptions, UseStreamTransport, UseStreamCustomOptions, SubmitOptions, CustomSubmitOptions, RunCallbackMeta } from \"../ui/types.js\";\nimport type { BagTemplate } from \"../types.template.js\";\nexport type { GetUpdateType, GetConfigurableType, GetInterruptType, GetToolCallsType, MessageMetadata, UseStreamThread, UseStreamOptions, UseStreamTransport, UseStreamCustomOptions, SubmitOptions, CustomSubmitOptions, RunCallbackMeta, };\nexport interface UseStream<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> {\n /**\n * The current values of the thread.\n */\n values: StateType;\n /**\n * Last seen error from the thread or during streaming.\n */\n error: unknown;\n /**\n * Whether the stream is currently running.\n */\n isLoading: boolean;\n /**\n * Whether the thread is currently being loaded.\n */\n isThreadLoading: boolean;\n /**\n * Stops the stream.\n */\n stop: () => Promise<void>;\n /**\n * Create and stream a run to the thread.\n */\n submit: (values: GetUpdateType<Bag, StateType> | null | undefined, options?: SubmitOptions<StateType, GetConfigurableType<Bag>>) => Promise<void>;\n /**\n * The current branch of the thread.\n */\n branch: string;\n /**\n * Set the branch of the thread.\n */\n setBranch: (branch: string) => void;\n /**\n * Flattened history of thread states of a thread.\n */\n history: ThreadState<StateType>[];\n /**\n * Tree of all branches for the thread.\n * @experimental\n */\n experimental_branchTree: Sequence<StateType>;\n /**\n * Get the interrupt value for the stream if interrupted.\n */\n interrupt: Interrupt<GetInterruptType<Bag>> | undefined;\n /**\n * Messages inferred from the thread.\n * Will automatically update with incoming message chunks.\n * Includes all message types including ToolMessage.\n */\n messages: Message<GetToolCallsType<StateType>>[];\n /**\n * Tool calls paired with their results.\n * Useful for rendering tool invocations and their outputs together.\n *\n * Each item contains the tool call from an AI message paired with its\n * corresponding ToolMessage result (if available), along with lifecycle state.\n *\n * @example\n * ```tsx\n * // With type-safe tool calls - embed the type in your messages\n * type MyToolCalls =\n * | { name: \"get_weather\"; args: { location: string }; id?: string }\n * | { name: \"search\"; args: { query: string }; id?: string };\n *\n * interface MyState {\n * messages: Message<MyToolCalls>[];\n * }\n *\n * const stream = useStream<MyState>({ ... });\n *\n * {stream.toolCalls.map(({ id, call, result, state }) => {\n * if (call.name === \"get_weather\") {\n * // call.args is { location: string }\n * return (\n * <WeatherCard\n * key={id}\n * location={call.args.location}\n * result={result?.content}\n * isLoading={state === \"pending\"}\n * />\n * );\n * }\n * })}\n * ```\n */\n toolCalls: ToolCallWithResult<GetToolCallsType<StateType>>[];\n /**\n * Get tool calls for a specific AI message.\n * Useful when rendering messages and their associated tool calls together.\n *\n * @param message - The AI message to get tool calls for.\n * @returns Array of tool calls initiated by the message.\n *\n * @example\n * ```tsx\n * {stream.uiMessages.map((message) => {\n * if (message.type === \"ai\") {\n * const toolCalls = stream.getToolCalls(message);\n * if (toolCalls.length > 0) {\n * return (\n * <div key={message.id}>\n * {toolCalls.map(tc => <ToolCard key={tc.id} toolCall={tc} />)}\n * </div>\n * );\n * }\n * }\n * return <MessageBubble key={message.id} message={message} />;\n * })}\n * ```\n */\n getToolCalls: (message: AIMessage<GetToolCallsType<StateType>>) => ToolCallWithResult<GetToolCallsType<StateType>>[];\n /**\n * Get the metadata for a message, such as first thread state the message\n * was seen in and branch information.\n *\n * @param message - The message to get the metadata for.\n * @param index - The index of the message in the thread.\n * @returns The metadata for the message.\n */\n getMessagesMetadata: (message: Message<GetToolCallsType<StateType>>, index?: number) => MessageMetadata<StateType> | undefined;\n /**\n * LangGraph SDK client used to send request and receive responses.\n */\n client: Client;\n /**\n * The ID of the assistant to use.\n */\n assistantId: string;\n /**\n * Join an active stream.\n */\n joinStream: (runId: string, lastEventId?: string, options?: {\n streamMode?: StreamMode | StreamMode[];\n }) => Promise<void>;\n}\nexport type UseStreamCustom<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> = Pick<UseStream<StateType, Bag>, \"values\" | \"error\" | \"isLoading\" | \"stop\" | \"interrupt\" | \"messages\" | \"toolCalls\" | \"getToolCalls\"> & {\n submit: (values: GetUpdateType<Bag, StateType> | null | undefined, options?: CustomSubmitOptions<StateType, GetConfigurableType<Bag>>) => Promise<void>;\n};\n"],"mappings":";;;;;;;;;UAQiBqB,4BAA4BC,0BAA0BA,qCAAqCF,cAAcA;EAAzGC;;;QAAsDC,EAI3DC,SAJ2DD;;;;OAoBvDE,EAAAA,OAAAA;;;;WAI+ED,EAAAA,OAAAA;;;;iBAAyCC,EAAAA,OAAAA;;;;MAiB3GjB,EAAAA,GAAAA,GArBbiB,OAqBajB,CAAAA,IAAAA,CAAAA;;;;QAUUgB,EAAAA,CAAAA,MAAAA,EA3BlBf,aA2BkBe,CA3BJE,GA2BIF,EA3BCA,SA2BDA,CAAAA,GAAAA,IAAAA,GAAAA,SAAAA,EAAAA,OAAAA,CAAAA,EA3B0CN,aA2B1CM,CA3BwDA,SA2BxDA,EA3BmEd,mBA2BnEc,CA3BuFE,GA2BvFF,CAAAA,CAAAA,EAAAA,GA3BiGC,OA2BjGD,CAAAA,IAAAA,CAAAA;;;;QAoCLZ,EAAAA,MAAAA;;;;WAyBNP,EAAAA,CAAAA,MAAAA,EAAAA,MAAAA,EAAAA,GAAAA,IAAAA;;;;SASgCmB,EArF/CtB,WAqF+CsB,CArFnCA,SAqFmCA,CAAAA,EAAAA;;;;;yBAIhDvB,EApFiBO,QAoFjBP,CApF0BuB,SAoF1BvB,CAAAA;;;;EAUK,SAAA,EA1FFE,SA0FE,CA1FQQ,gBA0FR,CA1FyBe,GA0FzB,CAAA,CAAA,GAAA,SAAA;EAELC;;;;;UAA+GN,EAtF7GjB,OAsF6GiB,CAtFrGT,gBAsFqGS,CAtFpFG,SAsFoFH,CAAAA,CAAAA,EAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAlD5Gf,mBAAmBM,iBAAiBY;;;;;;;;;;;;;;;;;;;;;;;;;0BAyBvBnB,UAAUO,iBAAiBY,gBAAgBlB,mBAAmBM,iBAAiBY;;;;;;;;;iCASxEpB,QAAQQ,iBAAiBY,gCAAgCX,gBAAgBW;;;;UAIhGvB;;;;;;;;;iBASSM,aAAaA;QACxBkB;;KAEEE,kCAAkCJ,0BAA0BA,qCAAqCF,cAAcA,eAAeO,KAAKN,UAAUE,WAAWE;mBAC/IjB,cAAciB,KAAKF,yCAAyCL,oBAAoBK,WAAWd,oBAAoBgB,UAAUD"}
@@ -0,0 +1,152 @@
1
+ import { Interrupt, ThreadState } from "../schema.js";
2
+ import { AIMessage, Message, ToolCallWithResult } from "../types.messages.js";
3
+ import { StreamMode } from "../types.stream.js";
4
+ import { Client } from "../client.js";
5
+ import { BagTemplate } from "../types.template.js";
6
+ import { Sequence } from "../ui/branching.js";
7
+ import { CustomSubmitOptions, GetConfigurableType, GetInterruptType, GetToolCallsType, GetUpdateType, MessageMetadata, RunCallbackMeta, SubmitOptions, UseStreamCustomOptions, UseStreamOptions, UseStreamThread, UseStreamTransport } from "../ui/types.js";
8
+
9
+ //#region src/react/types.d.ts
10
+ interface UseStream<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> {
11
+ /**
12
+ * The current values of the thread.
13
+ */
14
+ values: StateType;
15
+ /**
16
+ * Last seen error from the thread or during streaming.
17
+ */
18
+ error: unknown;
19
+ /**
20
+ * Whether the stream is currently running.
21
+ */
22
+ isLoading: boolean;
23
+ /**
24
+ * Whether the thread is currently being loaded.
25
+ */
26
+ isThreadLoading: boolean;
27
+ /**
28
+ * Stops the stream.
29
+ */
30
+ stop: () => Promise<void>;
31
+ /**
32
+ * Create and stream a run to the thread.
33
+ */
34
+ submit: (values: GetUpdateType<Bag, StateType> | null | undefined, options?: SubmitOptions<StateType, GetConfigurableType<Bag>>) => Promise<void>;
35
+ /**
36
+ * The current branch of the thread.
37
+ */
38
+ branch: string;
39
+ /**
40
+ * Set the branch of the thread.
41
+ */
42
+ setBranch: (branch: string) => void;
43
+ /**
44
+ * Flattened history of thread states of a thread.
45
+ */
46
+ history: ThreadState<StateType>[];
47
+ /**
48
+ * Tree of all branches for the thread.
49
+ * @experimental
50
+ */
51
+ experimental_branchTree: Sequence<StateType>;
52
+ /**
53
+ * Get the interrupt value for the stream if interrupted.
54
+ */
55
+ interrupt: Interrupt<GetInterruptType<Bag>> | undefined;
56
+ /**
57
+ * Messages inferred from the thread.
58
+ * Will automatically update with incoming message chunks.
59
+ * Includes all message types including ToolMessage.
60
+ */
61
+ messages: Message<GetToolCallsType<StateType>>[];
62
+ /**
63
+ * Tool calls paired with their results.
64
+ * Useful for rendering tool invocations and their outputs together.
65
+ *
66
+ * Each item contains the tool call from an AI message paired with its
67
+ * corresponding ToolMessage result (if available), along with lifecycle state.
68
+ *
69
+ * @example
70
+ * ```tsx
71
+ * // With type-safe tool calls - embed the type in your messages
72
+ * type MyToolCalls =
73
+ * | { name: "get_weather"; args: { location: string }; id?: string }
74
+ * | { name: "search"; args: { query: string }; id?: string };
75
+ *
76
+ * interface MyState {
77
+ * messages: Message<MyToolCalls>[];
78
+ * }
79
+ *
80
+ * const stream = useStream<MyState>({ ... });
81
+ *
82
+ * {stream.toolCalls.map(({ id, call, result, state }) => {
83
+ * if (call.name === "get_weather") {
84
+ * // call.args is { location: string }
85
+ * return (
86
+ * <WeatherCard
87
+ * key={id}
88
+ * location={call.args.location}
89
+ * result={result?.content}
90
+ * isLoading={state === "pending"}
91
+ * />
92
+ * );
93
+ * }
94
+ * })}
95
+ * ```
96
+ */
97
+ toolCalls: ToolCallWithResult<GetToolCallsType<StateType>>[];
98
+ /**
99
+ * Get tool calls for a specific AI message.
100
+ * Useful when rendering messages and their associated tool calls together.
101
+ *
102
+ * @param message - The AI message to get tool calls for.
103
+ * @returns Array of tool calls initiated by the message.
104
+ *
105
+ * @example
106
+ * ```tsx
107
+ * {stream.uiMessages.map((message) => {
108
+ * if (message.type === "ai") {
109
+ * const toolCalls = stream.getToolCalls(message);
110
+ * if (toolCalls.length > 0) {
111
+ * return (
112
+ * <div key={message.id}>
113
+ * {toolCalls.map(tc => <ToolCard key={tc.id} toolCall={tc} />)}
114
+ * </div>
115
+ * );
116
+ * }
117
+ * }
118
+ * return <MessageBubble key={message.id} message={message} />;
119
+ * })}
120
+ * ```
121
+ */
122
+ getToolCalls: (message: AIMessage<GetToolCallsType<StateType>>) => ToolCallWithResult<GetToolCallsType<StateType>>[];
123
+ /**
124
+ * Get the metadata for a message, such as first thread state the message
125
+ * was seen in and branch information.
126
+ *
127
+ * @param message - The message to get the metadata for.
128
+ * @param index - The index of the message in the thread.
129
+ * @returns The metadata for the message.
130
+ */
131
+ getMessagesMetadata: (message: Message<GetToolCallsType<StateType>>, index?: number) => MessageMetadata<StateType> | undefined;
132
+ /**
133
+ * LangGraph SDK client used to send request and receive responses.
134
+ */
135
+ client: Client;
136
+ /**
137
+ * The ID of the assistant to use.
138
+ */
139
+ assistantId: string;
140
+ /**
141
+ * Join an active stream.
142
+ */
143
+ joinStream: (runId: string, lastEventId?: string, options?: {
144
+ streamMode?: StreamMode | StreamMode[];
145
+ }) => Promise<void>;
146
+ }
147
+ type UseStreamCustom<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> = Pick<UseStream<StateType, Bag>, "values" | "error" | "isLoading" | "stop" | "interrupt" | "messages" | "toolCalls" | "getToolCalls"> & {
148
+ submit: (values: GetUpdateType<Bag, StateType> | null | undefined, options?: CustomSubmitOptions<StateType, GetConfigurableType<Bag>>) => Promise<void>;
149
+ };
150
+ //#endregion
151
+ export { UseStream, UseStreamCustom };
152
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","names":["Client","ThreadState","Interrupt","Message","AIMessage","ToolCallWithResult","StreamMode","Sequence","GetUpdateType","GetConfigurableType","GetInterruptType","GetToolCallsType","MessageMetadata","UseStreamThread","UseStreamOptions","UseStreamTransport","UseStreamCustomOptions","SubmitOptions","CustomSubmitOptions","RunCallbackMeta","BagTemplate","UseStream","Record","StateType","Promise","Bag","UseStreamCustom","Pick"],"sources":["../../src/react/types.d.ts"],"sourcesContent":["import type { Client } from \"../client.js\";\nimport type { ThreadState, Interrupt } from \"../schema.js\";\nimport type { Message, AIMessage, ToolCallWithResult } from \"../types.messages.js\";\nimport type { StreamMode } from \"../types.stream.js\";\nimport type { Sequence } from \"../ui/branching.js\";\nimport type { GetUpdateType, GetConfigurableType, GetInterruptType, GetToolCallsType, MessageMetadata, UseStreamThread, UseStreamOptions, UseStreamTransport, UseStreamCustomOptions, SubmitOptions, CustomSubmitOptions, RunCallbackMeta } from \"../ui/types.js\";\nimport type { BagTemplate } from \"../types.template.js\";\nexport type { GetUpdateType, GetConfigurableType, GetInterruptType, GetToolCallsType, MessageMetadata, UseStreamThread, UseStreamOptions, UseStreamTransport, UseStreamCustomOptions, SubmitOptions, CustomSubmitOptions, RunCallbackMeta, };\nexport interface UseStream<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> {\n /**\n * The current values of the thread.\n */\n values: StateType;\n /**\n * Last seen error from the thread or during streaming.\n */\n error: unknown;\n /**\n * Whether the stream is currently running.\n */\n isLoading: boolean;\n /**\n * Whether the thread is currently being loaded.\n */\n isThreadLoading: boolean;\n /**\n * Stops the stream.\n */\n stop: () => Promise<void>;\n /**\n * Create and stream a run to the thread.\n */\n submit: (values: GetUpdateType<Bag, StateType> | null | undefined, options?: SubmitOptions<StateType, GetConfigurableType<Bag>>) => Promise<void>;\n /**\n * The current branch of the thread.\n */\n branch: string;\n /**\n * Set the branch of the thread.\n */\n setBranch: (branch: string) => void;\n /**\n * Flattened history of thread states of a thread.\n */\n history: ThreadState<StateType>[];\n /**\n * Tree of all branches for the thread.\n * @experimental\n */\n experimental_branchTree: Sequence<StateType>;\n /**\n * Get the interrupt value for the stream if interrupted.\n */\n interrupt: Interrupt<GetInterruptType<Bag>> | undefined;\n /**\n * Messages inferred from the thread.\n * Will automatically update with incoming message chunks.\n * Includes all message types including ToolMessage.\n */\n messages: Message<GetToolCallsType<StateType>>[];\n /**\n * Tool calls paired with their results.\n * Useful for rendering tool invocations and their outputs together.\n *\n * Each item contains the tool call from an AI message paired with its\n * corresponding ToolMessage result (if available), along with lifecycle state.\n *\n * @example\n * ```tsx\n * // With type-safe tool calls - embed the type in your messages\n * type MyToolCalls =\n * | { name: \"get_weather\"; args: { location: string }; id?: string }\n * | { name: \"search\"; args: { query: string }; id?: string };\n *\n * interface MyState {\n * messages: Message<MyToolCalls>[];\n * }\n *\n * const stream = useStream<MyState>({ ... });\n *\n * {stream.toolCalls.map(({ id, call, result, state }) => {\n * if (call.name === \"get_weather\") {\n * // call.args is { location: string }\n * return (\n * <WeatherCard\n * key={id}\n * location={call.args.location}\n * result={result?.content}\n * isLoading={state === \"pending\"}\n * />\n * );\n * }\n * })}\n * ```\n */\n toolCalls: ToolCallWithResult<GetToolCallsType<StateType>>[];\n /**\n * Get tool calls for a specific AI message.\n * Useful when rendering messages and their associated tool calls together.\n *\n * @param message - The AI message to get tool calls for.\n * @returns Array of tool calls initiated by the message.\n *\n * @example\n * ```tsx\n * {stream.uiMessages.map((message) => {\n * if (message.type === \"ai\") {\n * const toolCalls = stream.getToolCalls(message);\n * if (toolCalls.length > 0) {\n * return (\n * <div key={message.id}>\n * {toolCalls.map(tc => <ToolCard key={tc.id} toolCall={tc} />)}\n * </div>\n * );\n * }\n * }\n * return <MessageBubble key={message.id} message={message} />;\n * })}\n * ```\n */\n getToolCalls: (message: AIMessage<GetToolCallsType<StateType>>) => ToolCallWithResult<GetToolCallsType<StateType>>[];\n /**\n * Get the metadata for a message, such as first thread state the message\n * was seen in and branch information.\n *\n * @param message - The message to get the metadata for.\n * @param index - The index of the message in the thread.\n * @returns The metadata for the message.\n */\n getMessagesMetadata: (message: Message<GetToolCallsType<StateType>>, index?: number) => MessageMetadata<StateType> | undefined;\n /**\n * LangGraph SDK client used to send request and receive responses.\n */\n client: Client;\n /**\n * The ID of the assistant to use.\n */\n assistantId: string;\n /**\n * Join an active stream.\n */\n joinStream: (runId: string, lastEventId?: string, options?: {\n streamMode?: StreamMode | StreamMode[];\n }) => Promise<void>;\n}\nexport type UseStreamCustom<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> = Pick<UseStream<StateType, Bag>, \"values\" | \"error\" | \"isLoading\" | \"stop\" | \"interrupt\" | \"messages\" | \"toolCalls\" | \"getToolCalls\"> & {\n submit: (values: GetUpdateType<Bag, StateType> | null | undefined, options?: CustomSubmitOptions<StateType, GetConfigurableType<Bag>>) => Promise<void>;\n};\n"],"mappings":";;;;;;;;;UAQiBqB,4BAA4BC,0BAA0BA,qCAAqCF,cAAcA;EAAzGC;;;QAAsDC,EAI3DC,SAJ2DD;;;;OAoBvDE,EA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gB,UAAUD"}
@@ -0,0 +1,138 @@
1
+ "use client";
2
+
3
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
4
+ const require_stream = require('../react/stream.cjs');
5
+ require('../react/index.cjs');
6
+ let react = require("react");
7
+ react = require_rolldown_runtime.__toESM(react);
8
+ let react_dom = require("react-dom");
9
+ react_dom = require_rolldown_runtime.__toESM(react_dom);
10
+ let react_jsx_runtime = require("react/jsx-runtime");
11
+ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
12
+
13
+ //#region src/react-ui/client.tsx
14
+ const UseStreamContext = react.createContext(null);
15
+ function useStreamContext() {
16
+ const ctx = react.useContext(UseStreamContext);
17
+ if (!ctx) throw new Error("useStreamContext must be used within a LoadExternalComponent");
18
+ return new Proxy(ctx, { get(target, prop) {
19
+ if (prop === "meta") return target.meta;
20
+ return target.stream[prop];
21
+ } });
22
+ }
23
+ var ComponentStore = class {
24
+ cache = {};
25
+ boundCache = {};
26
+ callbacks = {};
27
+ respond(shadowRootId, comp, targetElement) {
28
+ this.cache[shadowRootId] = {
29
+ comp,
30
+ target: targetElement
31
+ };
32
+ this.callbacks[shadowRootId]?.forEach((c) => c(comp, targetElement));
33
+ }
34
+ getBoundStore(shadowRootId) {
35
+ this.boundCache[shadowRootId] ??= {
36
+ subscribe: (onStoreChange) => {
37
+ this.callbacks[shadowRootId] ??= [];
38
+ this.callbacks[shadowRootId].push(onStoreChange);
39
+ return () => {
40
+ this.callbacks[shadowRootId] = this.callbacks[shadowRootId].filter((c) => c !== onStoreChange);
41
+ };
42
+ },
43
+ getSnapshot: () => this.cache[shadowRootId]
44
+ };
45
+ return this.boundCache[shadowRootId];
46
+ }
47
+ };
48
+ const COMPONENT_STORE = new ComponentStore();
49
+ const EXT_STORE_SYMBOL = Symbol.for("LGUI_EXT_STORE");
50
+ const REQUIRE_SYMBOL = Symbol.for("LGUI_REQUIRE");
51
+ const REQUIRE_EXTRA_SYMBOL = Symbol.for("LGUI_REQUIRE_EXTRA");
52
+ const isIterable = (value) => value != null && typeof value === "object" && Symbol.iterator in value;
53
+ const isPromise = (value) => value != null && typeof value === "object" && "then" in value && typeof value.then === "function";
54
+ const isReactNode = (value) => {
55
+ if (react.isValidElement(value)) return true;
56
+ if (value == null) return true;
57
+ if (typeof value === "string" || typeof value === "number" || typeof value === "bigint" || typeof value === "boolean") return true;
58
+ if (isIterable(value)) return true;
59
+ if (isPromise(value)) return true;
60
+ return false;
61
+ };
62
+ function LoadExternalComponent({ stream, namespace, message, meta, fallback, components, ...props }) {
63
+ const ref = react.useRef(null);
64
+ const shadowRootId = `child-shadow-${react.useId()}`;
65
+ const store = react.useMemo(() => COMPONENT_STORE.getBoundStore(shadowRootId), [shadowRootId]);
66
+ const state = react.useSyncExternalStore(store.subscribe, store.getSnapshot);
67
+ const clientComponent = components?.[message.name];
68
+ const hasClientComponent = clientComponent != null;
69
+ let fallbackComponent = null;
70
+ if (isReactNode(fallback)) fallbackComponent = fallback;
71
+ else if (typeof fallback === "object" && fallback != null) fallbackComponent = fallback?.[message.name];
72
+ const uiNamespace = namespace ?? stream.assistantId;
73
+ const uiClient = stream.client["~ui"];
74
+ react.useEffect(() => {
75
+ if (hasClientComponent) return;
76
+ uiClient.getComponent(uiNamespace, message.name).then((html) => {
77
+ const dom = ref.current;
78
+ if (!dom) return;
79
+ const root = dom.shadowRoot ?? dom.attachShadow({ mode: "open" });
80
+ const fragment = document.createRange().createContextualFragment(html.replace("{{shadowRootId}}", shadowRootId));
81
+ root.appendChild(fragment);
82
+ });
83
+ }, [
84
+ uiClient,
85
+ uiNamespace,
86
+ message.name,
87
+ shadowRootId,
88
+ hasClientComponent
89
+ ]);
90
+ if (hasClientComponent) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UseStreamContext.Provider, {
91
+ value: {
92
+ stream,
93
+ meta
94
+ },
95
+ children: react.createElement(clientComponent, message.props)
96
+ });
97
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
98
+ id: shadowRootId,
99
+ ref,
100
+ ...props
101
+ }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UseStreamContext.Provider, {
102
+ value: {
103
+ stream,
104
+ meta
105
+ },
106
+ children: state?.target != null ? react_dom.createPortal(react.createElement(state.comp, message.props), state.target) : fallbackComponent
107
+ })] });
108
+ }
109
+ function experimental_loadShare(name, module$1) {
110
+ if (typeof window === "undefined") return;
111
+ window[REQUIRE_EXTRA_SYMBOL] ??= {};
112
+ window[REQUIRE_EXTRA_SYMBOL][name] = module$1;
113
+ }
114
+ function bootstrapUiContext() {
115
+ if (typeof window === "undefined") return;
116
+ window[EXT_STORE_SYMBOL] = COMPONENT_STORE;
117
+ window[REQUIRE_SYMBOL] = (name) => {
118
+ if (name === "react") return react;
119
+ if (name === "react-dom") return react_dom;
120
+ if (name === "react/jsx-runtime") return react_jsx_runtime;
121
+ if (name === "@langchain/langgraph-sdk/react") return { useStream: require_stream.useStream };
122
+ if (name === "@langchain/langgraph-sdk/react-ui") return {
123
+ useStreamContext,
124
+ LoadExternalComponent: () => {
125
+ throw new Error("Nesting LoadExternalComponent is not supported");
126
+ }
127
+ };
128
+ if (window[REQUIRE_EXTRA_SYMBOL] != null && typeof window[REQUIRE_EXTRA_SYMBOL] === "object" && name in window[REQUIRE_EXTRA_SYMBOL]) return window[REQUIRE_EXTRA_SYMBOL][name];
129
+ throw new Error(`Unknown module...: ${name}`);
130
+ };
131
+ }
132
+
133
+ //#endregion
134
+ exports.LoadExternalComponent = LoadExternalComponent;
135
+ exports.bootstrapUiContext = bootstrapUiContext;
136
+ exports.experimental_loadShare = experimental_loadShare;
137
+ exports.useStreamContext = useStreamContext;
138
+ //# sourceMappingURL=client.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.cjs","names":["React","ReactDOM","module","JsxRuntime"],"sources":["../../src/react-ui/client.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as ReactDOM from \"react-dom\";\nimport * as JsxRuntime from \"react/jsx-runtime\";\nimport type { UIMessage } from \"./types.js\";\nimport { useStream } from \"../react/index.js\";\nimport type { UseStream } from \"../react/types.js\";\nimport type { BagTemplate } from \"../types.template.js\";\n\nconst UseStreamContext = React.createContext<{\n stream: ReturnType<typeof useStream>;\n meta: unknown;\n}>(null!);\n\ntype GetMetaType<Bag extends BagTemplate> = Bag extends { MetaType: unknown }\n ? Bag[\"MetaType\"]\n : unknown;\n\ninterface UseStreamContext<\n StateType extends Record<string, unknown> = Record<string, unknown>,\n Bag extends BagTemplate = BagTemplate\n> extends UseStream<StateType, Bag> {\n meta?: GetMetaType<Bag>;\n}\n\nexport function useStreamContext<\n StateType extends Record<string, unknown> = Record<string, unknown>,\n Bag extends BagTemplate = BagTemplate\n>(): UseStreamContext<StateType, Bag> {\n const ctx = React.useContext(UseStreamContext);\n if (!ctx) {\n throw new Error(\n \"useStreamContext must be used within a LoadExternalComponent\"\n );\n }\n\n return new Proxy(ctx, {\n get(target, prop: keyof UseStreamContext<StateType, Bag>) {\n if (prop === \"meta\") return target.meta;\n return target.stream[prop];\n },\n }) as unknown as UseStreamContext<StateType, Bag>;\n}\n\ninterface ComponentTarget {\n comp: React.FunctionComponent | React.ComponentClass;\n target: HTMLElement;\n}\n\nclass ComponentStore {\n private cache: Record<string, ComponentTarget> = {};\n\n private boundCache: Record<\n string,\n {\n subscribe: (onStoreChange: () => void) => () => void;\n getSnapshot: () => ComponentTarget | undefined;\n }\n > = {};\n\n private callbacks: Record<\n string,\n ((\n comp: React.FunctionComponent | React.ComponentClass,\n el: HTMLElement\n ) => void)[]\n > = {};\n\n respond(\n shadowRootId: string,\n comp: React.FunctionComponent | React.ComponentClass,\n targetElement: HTMLElement\n ) {\n this.cache[shadowRootId] = { comp, target: targetElement };\n this.callbacks[shadowRootId]?.forEach((c) => c(comp, targetElement));\n }\n\n getBoundStore(shadowRootId: string) {\n this.boundCache[shadowRootId] ??= {\n subscribe: (onStoreChange: () => void) => {\n this.callbacks[shadowRootId] ??= [];\n this.callbacks[shadowRootId].push(onStoreChange);\n return () => {\n this.callbacks[shadowRootId] = this.callbacks[shadowRootId].filter(\n (c) => c !== onStoreChange\n );\n };\n },\n getSnapshot: () => this.cache[shadowRootId],\n };\n\n return this.boundCache[shadowRootId];\n }\n}\n\nconst COMPONENT_STORE = new ComponentStore();\nconst EXT_STORE_SYMBOL = Symbol.for(\"LGUI_EXT_STORE\");\nconst REQUIRE_SYMBOL = Symbol.for(\"LGUI_REQUIRE\");\nconst REQUIRE_EXTRA_SYMBOL = Symbol.for(\"LGUI_REQUIRE_EXTRA\");\n\ninterface LoadExternalComponentProps\n extends Pick<React.HTMLAttributes<HTMLDivElement>, \"style\" | \"className\"> {\n /** Stream of the assistant */\n stream: ReturnType<typeof useStream>;\n\n /** Namespace of UI components. Defaults to assistant ID. */\n namespace?: string;\n\n /** UI message to be rendered */\n message: UIMessage;\n\n /** Additional context to be passed to the child component */\n meta?: unknown;\n\n /** Fallback to be rendered when the component is loading */\n fallback?: React.ReactNode | Record<string, React.ReactNode>;\n\n /**\n * Map of components that can be rendered directly without fetching the UI code\n * from the server.\n */\n components?: Record<string, React.FunctionComponent | React.ComponentClass>;\n}\n\nconst isIterable = (value: unknown): value is Iterable<unknown> =>\n value != null && typeof value === \"object\" && Symbol.iterator in value;\n\nconst isPromise = (value: unknown): value is Promise<unknown> =>\n value != null &&\n typeof value === \"object\" &&\n \"then\" in value &&\n typeof value.then === \"function\";\n\nconst isReactNode = (value: unknown): value is React.ReactNode => {\n if (React.isValidElement(value)) return true;\n if (value == null) return true;\n if (\n typeof value === \"string\" ||\n typeof value === \"number\" ||\n typeof value === \"bigint\" ||\n typeof value === \"boolean\"\n ) {\n return true;\n }\n\n if (isIterable(value)) return true;\n if (isPromise(value)) return true;\n\n return false;\n};\n\nexport function LoadExternalComponent({\n stream,\n namespace,\n message,\n meta,\n fallback,\n components,\n ...props\n}: LoadExternalComponentProps) {\n const ref = React.useRef<HTMLDivElement>(null);\n const id = React.useId();\n const shadowRootId = `child-shadow-${id}`;\n\n const store = React.useMemo(\n () => COMPONENT_STORE.getBoundStore(shadowRootId),\n [shadowRootId]\n );\n const state = React.useSyncExternalStore(store.subscribe, store.getSnapshot);\n\n const clientComponent = components?.[message.name];\n const hasClientComponent = clientComponent != null;\n\n let fallbackComponent = null;\n if (isReactNode(fallback)) {\n fallbackComponent = fallback;\n } else if (typeof fallback === \"object\" && fallback != null) {\n fallbackComponent = fallback?.[message.name];\n }\n\n const uiNamespace = namespace ?? stream.assistantId;\n const uiClient = stream.client[\"~ui\"];\n React.useEffect(() => {\n if (hasClientComponent) return;\n void uiClient.getComponent(uiNamespace, message.name).then((html) => {\n const dom = ref.current;\n if (!dom) return;\n const root = dom.shadowRoot ?? dom.attachShadow({ mode: \"open\" });\n const fragment = document\n .createRange()\n .createContextualFragment(\n html.replace(\"{{shadowRootId}}\", shadowRootId)\n );\n root.appendChild(fragment);\n });\n }, [uiClient, uiNamespace, message.name, shadowRootId, hasClientComponent]);\n\n if (hasClientComponent) {\n return (\n <UseStreamContext.Provider value={{ stream, meta }}>\n {React.createElement(clientComponent, message.props)}\n </UseStreamContext.Provider>\n );\n }\n\n return (\n <>\n <div id={shadowRootId} ref={ref} {...props} />\n\n <UseStreamContext.Provider value={{ stream, meta }}>\n {state?.target != null\n ? ReactDOM.createPortal(\n React.createElement(state.comp, message.props),\n state.target\n )\n : fallbackComponent}\n </UseStreamContext.Provider>\n </>\n );\n}\n\ndeclare global {\n interface Window {\n [EXT_STORE_SYMBOL]: ComponentStore;\n [REQUIRE_SYMBOL]: (name: string) => unknown;\n [REQUIRE_EXTRA_SYMBOL]: Record<string, unknown>;\n }\n}\n\nexport function experimental_loadShare(name: string, module: unknown) {\n if (typeof window === \"undefined\") return;\n\n window[REQUIRE_EXTRA_SYMBOL] ??= {};\n window[REQUIRE_EXTRA_SYMBOL][name] = module;\n}\n\nexport function bootstrapUiContext() {\n if (typeof window === \"undefined\") {\n return;\n }\n\n window[EXT_STORE_SYMBOL] = COMPONENT_STORE;\n window[REQUIRE_SYMBOL] = (name: string) => {\n if (name === \"react\") return React;\n if (name === \"react-dom\") return ReactDOM;\n if (name === \"react/jsx-runtime\") return JsxRuntime;\n if (name === \"@langchain/langgraph-sdk/react\") return { useStream };\n if (name === \"@langchain/langgraph-sdk/react-ui\") {\n return {\n useStreamContext,\n LoadExternalComponent: () => {\n throw new Error(\"Nesting LoadExternalComponent is not supported\");\n },\n };\n }\n\n if (\n window[REQUIRE_EXTRA_SYMBOL] != null &&\n typeof window[REQUIRE_EXTRA_SYMBOL] === \"object\" &&\n name in window[REQUIRE_EXTRA_SYMBOL]\n ) {\n return window[REQUIRE_EXTRA_SYMBOL][name];\n }\n\n throw new Error(`Unknown module...: ${name}`);\n };\n}\n"],"mappings":";;;;;;;;;;;;;AAUA,MAAM,mBAAmBA,MAAM,cAG5B,KAAM;AAaT,SAAgB,mBAGsB;CACpC,MAAM,MAAMA,MAAM,WAAW,iBAAiB;AAC9C,KAAI,CAAC,IACH,OAAM,IAAI,MACR,+DACD;AAGH,QAAO,IAAI,MAAM,KAAK,EACpB,IAAI,QAAQ,MAA8C;AACxD,MAAI,SAAS,OAAQ,QAAO,OAAO;AACnC,SAAO,OAAO,OAAO;IAExB,CAAC;;AAQJ,IAAM,iBAAN,MAAqB;CACnB,AAAQ,QAAyC,EAAE;CAEnD,AAAQ,aAMJ,EAAE;CAEN,AAAQ,YAMJ,EAAE;CAEN,QACE,cACA,MACA,eACA;AACA,OAAK,MAAM,gBAAgB;GAAE;GAAM,QAAQ;GAAe;AAC1D,OAAK,UAAU,eAAe,SAAS,MAAM,EAAE,MAAM,cAAc,CAAC;;CAGtE,cAAc,cAAsB;AAClC,OAAK,WAAW,kBAAkB;GAChC,YAAY,kBAA8B;AACxC,SAAK,UAAU,kBAAkB,EAAE;AACnC,SAAK,UAAU,cAAc,KAAK,cAAc;AAChD,iBAAa;AACX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BAA0B,YACxC,QAAQ,OAAO,sBAEf,QAAO,OAAO,sBAAsB;AAGtC,QAAM,IAAI,MAAM,sBAAsB,OAAO"}
@@ -0,0 +1,73 @@
1
+ import { BagTemplate } from "../types.template.cjs";
2
+ import { UseStream, UseStreamCustom } from "../react/types.cjs";
3
+ import { UIMessage } from "./types.cjs";
4
+ import { useStream } from "../react/stream.cjs";
5
+ import * as React from "react";
6
+ import * as JsxRuntime from "react/jsx-runtime";
7
+
8
+ //#region src/react-ui/client.d.ts
9
+ declare const UseStreamContext: React.Context<{
10
+ stream: UseStreamCustom<Record<string, unknown>, BagTemplate>;
11
+ meta: unknown;
12
+ }>;
13
+ type GetMetaType<Bag extends BagTemplate> = Bag extends {
14
+ MetaType: unknown;
15
+ } ? Bag["MetaType"] : unknown;
16
+ interface UseStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> extends UseStream<StateType, Bag> {
17
+ meta?: GetMetaType<Bag>;
18
+ }
19
+ declare function useStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate>(): UseStreamContext<StateType, Bag>;
20
+ interface ComponentTarget {
21
+ comp: React.FunctionComponent | React.ComponentClass;
22
+ target: HTMLElement;
23
+ }
24
+ declare class ComponentStore {
25
+ private cache;
26
+ private boundCache;
27
+ private callbacks;
28
+ respond(shadowRootId: string, comp: React.FunctionComponent | React.ComponentClass, targetElement: HTMLElement): void;
29
+ getBoundStore(shadowRootId: string): {
30
+ subscribe: (onStoreChange: () => void) => () => void;
31
+ getSnapshot: () => ComponentTarget | undefined;
32
+ };
33
+ }
34
+ declare const EXT_STORE_SYMBOL: unique symbol;
35
+ declare const REQUIRE_SYMBOL: unique symbol;
36
+ declare const REQUIRE_EXTRA_SYMBOL: unique symbol;
37
+ interface LoadExternalComponentProps extends Pick<React.HTMLAttributes<HTMLDivElement>, "style" | "className"> {
38
+ /** Stream of the assistant */
39
+ stream: ReturnType<typeof useStream>;
40
+ /** Namespace of UI components. Defaults to assistant ID. */
41
+ namespace?: string;
42
+ /** UI message to be rendered */
43
+ message: UIMessage;
44
+ /** Additional context to be passed to the child component */
45
+ meta?: unknown;
46
+ /** Fallback to be rendered when the component is loading */
47
+ fallback?: React.ReactNode | Record<string, React.ReactNode>;
48
+ /**
49
+ * Map of components that can be rendered directly without fetching the UI code
50
+ * from the server.
51
+ */
52
+ components?: Record<string, React.FunctionComponent | React.ComponentClass>;
53
+ }
54
+ declare function LoadExternalComponent({
55
+ stream,
56
+ namespace,
57
+ message,
58
+ meta,
59
+ fallback,
60
+ components,
61
+ ...props
62
+ }: LoadExternalComponentProps): JsxRuntime.JSX.Element;
63
+ declare global {
64
+ interface Window {
65
+ [EXT_STORE_SYMBOL]: ComponentStore;
66
+ [REQUIRE_SYMBOL]: (name: string) => unknown;
67
+ [REQUIRE_EXTRA_SYMBOL]: Record<string, unknown>;
68
+ }
69
+ }
70
+ declare function experimental_loadShare(name: string, module: unknown): void;
71
+ //#endregion
72
+ export { LoadExternalComponent, experimental_loadShare, useStreamContext };
73
+ //# sourceMappingURL=client.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.cts","names":["React","JsxRuntime","UIMessage","useStream","UseStream","BagTemplate","UseStreamContext","Record","___react_types_js0","UseStreamCustom","Context","GetMetaType","Bag","StateType","useStreamContext","ComponentTarget","FunctionComponent","ComponentClass","HTMLElement","ComponentStore","EXT_STORE_SYMBOL","REQUIRE_SYMBOL","REQUIRE_EXTRA_SYMBOL","LoadExternalComponentProps","HTMLDivElement","HTMLAttributes","ReturnType","ReactNode","Pick","LoadExternalComponent","stream","namespace","message","meta","fallback","components","JSX","Element","_0","sideEffect","experimental_loadShare","bootstrapUiContext"],"sources":["../../src/react-ui/client.d.ts"],"sourcesContent":["import * as React from \"react\";\nimport * as JsxRuntime from \"react/jsx-runtime\";\nimport type { UIMessage } from \"./types.js\";\nimport { useStream } from \"../react/index.js\";\nimport type { UseStream } from \"../react/types.js\";\nimport type { BagTemplate } from \"../types.template.js\";\ndeclare const UseStreamContext: React.Context<{\n stream: import(\"../react/types.js\").UseStreamCustom<Record<string, unknown>, BagTemplate>;\n meta: unknown;\n}>;\ntype GetMetaType<Bag extends BagTemplate> = Bag extends {\n MetaType: unknown;\n} ? Bag[\"MetaType\"] : unknown;\ninterface UseStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> extends UseStream<StateType, Bag> {\n meta?: GetMetaType<Bag>;\n}\nexport declare function useStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate>(): UseStreamContext<StateType, Bag>;\ninterface ComponentTarget {\n comp: React.FunctionComponent | React.ComponentClass;\n target: HTMLElement;\n}\ndeclare class ComponentStore {\n private cache;\n private boundCache;\n private callbacks;\n respond(shadowRootId: string, comp: React.FunctionComponent | React.ComponentClass, targetElement: HTMLElement): void;\n getBoundStore(shadowRootId: string): {\n subscribe: (onStoreChange: () => void) => () => void;\n getSnapshot: () => ComponentTarget | undefined;\n };\n}\ndeclare const EXT_STORE_SYMBOL: unique symbol;\ndeclare const REQUIRE_SYMBOL: unique symbol;\ndeclare const REQUIRE_EXTRA_SYMBOL: unique symbol;\ninterface LoadExternalComponentProps extends Pick<React.HTMLAttributes<HTMLDivElement>, \"style\" | \"className\"> {\n /** Stream of the assistant */\n stream: ReturnType<typeof useStream>;\n /** Namespace of UI components. Defaults to assistant ID. */\n namespace?: string;\n /** UI message to be rendered */\n message: UIMessage;\n /** Additional context to be passed to the child component */\n meta?: unknown;\n /** Fallback to be rendered when the component is loading */\n fallback?: React.ReactNode | Record<string, React.ReactNode>;\n /**\n * Map of components that can be rendered directly without fetching the UI code\n * from the server.\n */\n components?: Record<string, React.FunctionComponent | React.ComponentClass>;\n}\nexport declare function LoadExternalComponent({ stream, namespace, message, meta, fallback, components, ...props }: LoadExternalComponentProps): JsxRuntime.JSX.Element;\ndeclare global {\n interface Window {\n [EXT_STORE_SYMBOL]: ComponentStore;\n [REQUIRE_SYMBOL]: (name: string) => unknown;\n [REQUIRE_EXTRA_SYMBOL]: Record<string, unknown>;\n }\n}\nexport declare function experimental_loadShare(name: string, module: unknown): void;\nexport declare function bootstrapUiContext(): void;\nexport {};\n"],"mappings":";;;;;;;;cAMcM,kBAAkBN,KAAAA,CAAMU;UACsDF,gBAApCD,yBAAyBF;EADnEC,IAAAA,EAAAA,OAAAA;CAGZ,CAAA;KACGK,WAHmDJ,CAAAA,YAG3BF,WAH2BE,CAAAA,GAGZK,GAHYL,SAAAA;UAAyBF,EAAAA,OAAAA;IAK7EO,GALwFJ,CAAAA,UAAAA,CAAAA,GAAAA,OAAAA;UAMlFF,gBAP4BI,CAAAA,kBAOOH,MAPPG,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAOiCH,MAPjCG,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,YAOsEL,WAPtEK,GAOoFL,WAPpFK,CAAAA,SAOyGN,SAPzGM,CAOmHG,SAPnHH,EAO8HE,GAP9HF,CAAAA,CAAAA;EAAO,IAAA,CAAA,EAQlCC,WARkC,CAQtBC,GARsB,CAAA;AAAA;AAI7B,iBAMQE,gBANR,CAAA,kBAM2CP,MAN3C,CAAA,MAAA,EAAA,OAAA,CAAA,GAMqEA,MANrE,CAAA,MAAA,EAAA,OAAA,CAAA,EAAA,YAM0GF,WAN1G,GAMwHA,WANxH,CAAA,CAAA,CAAA,EAMwIC,gBANxI,CAMyJO,SANzJ,EAMoKD,GANpK,CAAA;UAONG,eAAAA,CAPmBV;MAAeO,EAQlCZ,KAAAA,CAAMgB,iBAR4BJ,GAQRZ,KAAAA,CAAMiB,cAREL;QAExCA,EAOQM,WAPRN;;AAAG,cASOO,cAAAA,CARY;EAAA,QAAA,KAAA;UAAmBZ,UAAAA;UAA0BA,SAAAA;SAAqCF,CAAAA,YAAAA,EAAAA,MAAAA,EAAAA,IAAAA,EAYpEL,KAAAA,CAAMgB,iBAZ8DX,GAY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