@langchain/langgraph-sdk 1.3.1 → 1.4.5

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 (152) hide show
  1. package/dist/_virtual/rolldown_runtime.cjs +10 -6
  2. package/dist/auth/error.cjs.map +1 -1
  3. package/dist/auth/error.d.cts.map +1 -1
  4. package/dist/auth/error.d.ts.map +1 -1
  5. package/dist/auth/error.js.map +1 -1
  6. package/dist/auth/index.cjs.map +1 -1
  7. package/dist/auth/index.d.cts +1 -3
  8. package/dist/auth/index.d.cts.map +1 -1
  9. package/dist/auth/index.d.ts +1 -3
  10. package/dist/auth/index.d.ts.map +1 -1
  11. package/dist/auth/index.js.map +1 -1
  12. package/dist/auth/types.d.cts +1 -1
  13. package/dist/auth/types.d.cts.map +1 -1
  14. package/dist/auth/types.d.ts +1 -1
  15. package/dist/auth/types.d.ts.map +1 -1
  16. package/dist/client.cjs +15 -24
  17. package/dist/client.cjs.map +1 -1
  18. package/dist/client.d.cts +2 -6
  19. package/dist/client.d.cts.map +1 -1
  20. package/dist/client.d.ts +2 -6
  21. package/dist/client.d.ts.map +1 -1
  22. package/dist/client.js +15 -24
  23. package/dist/client.js.map +1 -1
  24. package/dist/index.d.cts +2 -1
  25. package/dist/index.d.ts +2 -1
  26. package/dist/logging/index.cjs.map +1 -1
  27. package/dist/logging/index.d.cts +0 -1
  28. package/dist/logging/index.d.cts.map +1 -1
  29. package/dist/logging/index.d.ts +0 -1
  30. package/dist/logging/index.d.ts.map +1 -1
  31. package/dist/logging/index.js.map +1 -1
  32. package/dist/react/index.d.cts +3 -2
  33. package/dist/react/index.d.ts +3 -2
  34. package/dist/react/stream.cjs +1 -1
  35. package/dist/react/stream.cjs.map +1 -1
  36. package/dist/react/stream.custom.cjs +12 -6
  37. package/dist/react/stream.custom.cjs.map +1 -1
  38. package/dist/react/stream.custom.d.cts +3 -2
  39. package/dist/react/stream.custom.d.cts.map +1 -1
  40. package/dist/react/stream.custom.d.ts +3 -2
  41. package/dist/react/stream.custom.d.ts.map +1 -1
  42. package/dist/react/stream.custom.js +11 -5
  43. package/dist/react/stream.custom.js.map +1 -1
  44. package/dist/react/stream.d.cts +116 -34
  45. package/dist/react/stream.d.cts.map +1 -1
  46. package/dist/react/stream.d.ts +116 -34
  47. package/dist/react/stream.d.ts.map +1 -1
  48. package/dist/react/stream.js.map +1 -1
  49. package/dist/react/stream.lgp.cjs +15 -13
  50. package/dist/react/stream.lgp.cjs.map +1 -1
  51. package/dist/react/stream.lgp.js +14 -12
  52. package/dist/react/stream.lgp.js.map +1 -1
  53. package/dist/react/thread.cjs +1 -2
  54. package/dist/react/thread.cjs.map +1 -1
  55. package/dist/react/thread.js +0 -1
  56. package/dist/react/thread.js.map +1 -1
  57. package/dist/react/types.d.cts +73 -284
  58. package/dist/react/types.d.cts.map +1 -1
  59. package/dist/react/types.d.ts +73 -284
  60. package/dist/react/types.d.ts.map +1 -1
  61. package/dist/react-ui/client.cjs +8 -7
  62. package/dist/react-ui/client.cjs.map +1 -1
  63. package/dist/react-ui/client.d.cts +4 -21
  64. package/dist/react-ui/client.d.cts.map +1 -1
  65. package/dist/react-ui/client.d.ts +4 -21
  66. package/dist/react-ui/client.d.ts.map +1 -1
  67. package/dist/react-ui/client.js +2 -4
  68. package/dist/react-ui/client.js.map +1 -1
  69. package/dist/react-ui/index.cjs.map +1 -1
  70. package/dist/react-ui/index.js.map +1 -1
  71. package/dist/react-ui/server/server.cjs +1 -1
  72. package/dist/react-ui/server/server.cjs.map +1 -1
  73. package/dist/react-ui/server/server.d.cts.map +1 -1
  74. package/dist/react-ui/server/server.d.ts.map +1 -1
  75. package/dist/react-ui/server/server.js.map +1 -1
  76. package/dist/react-ui/types.cjs.map +1 -1
  77. package/dist/react-ui/types.d.cts.map +1 -1
  78. package/dist/react-ui/types.d.ts.map +1 -1
  79. package/dist/react-ui/types.js.map +1 -1
  80. package/dist/schema.d.cts +6 -6
  81. package/dist/schema.d.cts.map +1 -1
  82. package/dist/schema.d.ts +6 -6
  83. package/dist/schema.d.ts.map +1 -1
  84. package/dist/singletons/fetch.cjs.map +1 -1
  85. package/dist/singletons/fetch.js.map +1 -1
  86. package/dist/types.d.cts +1 -1
  87. package/dist/types.d.cts.map +1 -1
  88. package/dist/types.d.ts +1 -1
  89. package/dist/types.d.ts.map +1 -1
  90. package/dist/types.messages.d.cts +207 -34
  91. package/dist/types.messages.d.cts.map +1 -1
  92. package/dist/types.messages.d.ts +207 -34
  93. package/dist/types.messages.d.ts.map +1 -1
  94. package/dist/types.stream.d.cts +1 -3
  95. package/dist/types.stream.d.cts.map +1 -1
  96. package/dist/types.stream.d.ts +1 -3
  97. package/dist/types.stream.d.ts.map +1 -1
  98. package/dist/types.template.d.cts +19 -0
  99. package/dist/types.template.d.cts.map +1 -0
  100. package/dist/types.template.d.ts +19 -0
  101. package/dist/types.template.d.ts.map +1 -0
  102. package/dist/ui/branching.cjs.map +1 -1
  103. package/dist/ui/branching.d.cts +0 -3
  104. package/dist/ui/branching.d.cts.map +1 -1
  105. package/dist/ui/branching.d.ts +0 -3
  106. package/dist/ui/branching.d.ts.map +1 -1
  107. package/dist/ui/branching.js.map +1 -1
  108. package/dist/ui/errors.cjs.map +1 -1
  109. package/dist/ui/errors.js.map +1 -1
  110. package/dist/ui/manager.cjs +8 -2
  111. package/dist/ui/manager.cjs.map +1 -1
  112. package/dist/ui/manager.js +8 -2
  113. package/dist/ui/manager.js.map +1 -1
  114. package/dist/ui/messages.cjs +10 -10
  115. package/dist/ui/messages.cjs.map +1 -1
  116. package/dist/ui/messages.js.map +1 -1
  117. package/dist/ui/types.d.cts +420 -0
  118. package/dist/ui/types.d.cts.map +1 -0
  119. package/dist/ui/types.d.ts +420 -0
  120. package/dist/ui/types.d.ts.map +1 -0
  121. package/dist/ui/utils.cjs +0 -1
  122. package/dist/ui/utils.cjs.map +1 -1
  123. package/dist/ui/utils.js +0 -1
  124. package/dist/ui/utils.js.map +1 -1
  125. package/dist/utils/async_caller.cjs +12 -4
  126. package/dist/utils/async_caller.cjs.map +1 -1
  127. package/dist/utils/async_caller.d.cts +1 -3
  128. package/dist/utils/async_caller.d.cts.map +1 -1
  129. package/dist/utils/async_caller.d.ts +1 -3
  130. package/dist/utils/async_caller.d.ts.map +1 -1
  131. package/dist/utils/async_caller.js +8 -2
  132. package/dist/utils/async_caller.js.map +1 -1
  133. package/dist/utils/env.cjs +1 -1
  134. package/dist/utils/env.cjs.map +1 -1
  135. package/dist/utils/env.js +1 -1
  136. package/dist/utils/env.js.map +1 -1
  137. package/dist/utils/error.cjs.map +1 -1
  138. package/dist/utils/error.js.map +1 -1
  139. package/dist/utils/signals.cjs.map +1 -1
  140. package/dist/utils/signals.js.map +1 -1
  141. package/dist/utils/sse.cjs.map +1 -1
  142. package/dist/utils/sse.js.map +1 -1
  143. package/dist/utils/stream.cjs +1 -3
  144. package/dist/utils/stream.cjs.map +1 -1
  145. package/dist/utils/stream.js +1 -3
  146. package/dist/utils/stream.js.map +1 -1
  147. package/dist/utils/tools.cjs +52 -0
  148. package/dist/utils/tools.cjs.map +1 -0
  149. package/dist/utils/tools.js +51 -0
  150. package/dist/utils/tools.js.map +1 -0
  151. package/package.json +5 -5
  152. package/CHANGELOG.md +0 -281
@@ -1,39 +1,22 @@
1
+ import { BagTemplate } from "../types.template.cjs";
2
+ import { UseStream, UseStreamCustom } from "../react/types.cjs";
1
3
  import { UIMessage } from "./types.cjs";
2
- import { UseStream } from "../react/types.cjs";
3
4
  import { useStream } from "../react/stream.cjs";
4
5
  import * as React from "react";
5
6
  import * as JsxRuntime from "react/jsx-runtime";
6
7
 
7
8
  //#region src/react-ui/client.d.ts
8
9
  declare const UseStreamContext: React.Context<{
9
- stream: UseStream<Record<string, unknown>, {
10
- ConfigurableType?: Record<string, unknown> | undefined;
11
- InterruptType?: unknown;
12
- CustomEventType?: unknown;
13
- UpdateType?: unknown;
14
- }>;
10
+ stream: UseStreamCustom<Record<string, unknown>, BagTemplate>;
15
11
  meta: unknown;
16
12
  }>;
17
- type BagTemplate = {
18
- ConfigurableType?: Record<string, unknown>;
19
- InterruptType?: unknown;
20
- CustomEventType?: unknown;
21
- UpdateType?: unknown;
22
- MetaType?: unknown;
23
- };
24
13
  type GetMetaType<Bag extends BagTemplate> = Bag extends {
25
14
  MetaType: unknown;
26
15
  } ? Bag["MetaType"] : unknown;
27
16
  interface UseStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> extends UseStream<StateType, Bag> {
28
17
  meta?: GetMetaType<Bag>;
29
18
  }
30
- declare function useStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends {
31
- ConfigurableType?: Record<string, unknown>;
32
- InterruptType?: unknown;
33
- CustomEventType?: unknown;
34
- UpdateType?: unknown;
35
- MetaType?: unknown;
36
- } = BagTemplate>(): UseStreamContext<StateType, Bag>;
19
+ declare function useStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate>(): UseStreamContext<StateType, Bag>;
37
20
  interface ComponentTarget {
38
21
  comp: React.FunctionComponent | React.ComponentClass;
39
22
  target: HTMLElement;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.cts","names":["React","JsxRuntime","UIMessage","useStream","UseStream","UseStreamContext","Record","Context","BagTemplate","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\";\ndeclare const UseStreamContext: React.Context<{\n stream: UseStream<Record<string, unknown>, {\n ConfigurableType?: Record<string, unknown> | undefined;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n }>;\n meta: unknown;\n}>;\ntype BagTemplate = {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: 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 {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: unknown;\n} = 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":";;;;;;;cAKcK,kBAAkBL,KAAAA,CAAMO;UAC1BH,UAAUE;IADRD,gBAQZ,CAAA,EANyBC,MAMzB,CAAA,MAAA,EAAA,OAAA,CAAA,GAAA,SAAA;IAAA,aAAA,CAAA,EAAA,OAAA;IAPoBA,eAAAA,CAAAA,EAAAA,OAAAA;IACKA,UAAAA,CAAAA,EAAAA,OAAAA;;MAFKN,EAAAA,OAAMO;;AAAO,KASxCC,WAAAA,GAAW;EAOXC,gBAAW,CAAA,EANOH,MAMP,CAAA,MAAA,EAAA,OAAA,CAAA;EAAA,aAAA,CAAA,EAAA,OAAA;iBAAaE,CAAAA,EAAAA,OAAAA;YAAeE,CAAAA,EAAAA,OAAAA;UAExCA,CAAAA,EAAAA,OAAAA;;AAAG,KAFFD,WAGKJ,CAAAA,YAHmBG,WAGH,CAAA,GAHkBE,GAGlB,SAAA;EAAA,QAAA,EAAA,OAAA;IADtBA,GACyCJ,CAAAA,UAAAA,CAAAA,GAAAA,OAAAA;UAAnCD,gBAA6DC,CAAAA,kBAA1BA,MAA0BA,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAAAA,MAAAA,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,YAAqCE,WAArCF,GAAmDE,WAAnDF,CAAAA,SAAwEF,SAAxEE,CAAkFK,SAAlFL,EAA6FI,GAA7FJ,CA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,CAAAA,EAAAA,OAAAA;EAA0B;UAAmCC,CAAAA,EAUxDtB,KAAAA,CAAMyB,SAVkDH,GAUtChB,MAVsCgB,CAAAA,MAAAA,EAUvBtB,KAAAA,CAAMyB,SAViBH,CAAAA;;;;;YAUlDG,CAAAA,EAKJnB,MALImB,CAAAA,MAAAA,EAKWzB,KAAAA,CAAMc,iBALjBW,GAKqCzB,KAAAA,CAAMe,cAL3CU,CAAAA;;AAAYnB,iBAOTqB,qBAAAA,CAPSrB;EAAAA,MAAAA;EAAAA,SAAAA;EAAAA,OAAAA;EAAAA,IAAAA;EAAAA,QAAAA;EAAAA,UAAAA;EAAAA,GAAAA;AAAAA,CAAAA,EAOmFe,0BAPnFf,CAAAA,EAOgHL,UAAAA,CAAWiC,GAAAA,CAAIC,OAP/H7B;QAKDN,MAAMc,CAAAA;YAA0BC,MAAAA,CAAAA;IAA/CT,CAKRY,gBAAAA,CALQZ,EAKWW,cALXX;IAf4BoB,CAqBpCP,cAAAA,CArBoCO,EAAAA,CAAAA,IAAAA,EAAAA,MAAAA,EAAAA,GAAAA,OAAAA;KAsBpCN,oBAAAA,GAAuBd;EALRqB;;AAAwBC,iBAQxBU,sBAAAA,CARwBV,IAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA"}
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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EA0BsEO,0BA1BtEP,CAAAA,EA0BmGf,UAAAA,CAAWmC,GAAAA,CAAIC,OA1BlHrB;QAAoBhB,MAAMiB,CAAAA;YAA+BC,MAAAA,CAAAA;IAG5EH,CA0BlBK,gBAAAA,CA1BkBL,EA0BCI,cA1BDJ;IAAe,CA2BjCM,cAAAA,CA3BiC,EAAA,CAAA,IAAA,EAAA,MAAA,EAAA,GAAA,OAAA;IAG5BD,CAyBLE,oBAAAA,CAzBoC,EAyBbf,MAzBa,CAAA,MAAA,EAAA,OAAA,CAAA;EAC/Bc;AAA6B;AAEjCE,iBAyBciB,sBAAAA,CAzBY,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,IAAA"}
@@ -1,39 +1,22 @@
1
+ import { BagTemplate } from "../types.template.js";
2
+ import { UseStream, UseStreamCustom } from "../react/types.js";
1
3
  import { UIMessage } from "./types.js";
2
- import { UseStream } from "../react/types.js";
3
4
  import { useStream } from "../react/stream.js";
4
5
  import * as React from "react";
5
6
  import * as JsxRuntime from "react/jsx-runtime";
6
7
 
7
8
  //#region src/react-ui/client.d.ts
8
9
  declare const UseStreamContext: React.Context<{
9
- stream: UseStream<Record<string, unknown>, {
10
- ConfigurableType?: Record<string, unknown> | undefined;
11
- InterruptType?: unknown;
12
- CustomEventType?: unknown;
13
- UpdateType?: unknown;
14
- }>;
10
+ stream: UseStreamCustom<Record<string, unknown>, BagTemplate>;
15
11
  meta: unknown;
16
12
  }>;
17
- type BagTemplate = {
18
- ConfigurableType?: Record<string, unknown>;
19
- InterruptType?: unknown;
20
- CustomEventType?: unknown;
21
- UpdateType?: unknown;
22
- MetaType?: unknown;
23
- };
24
13
  type GetMetaType<Bag extends BagTemplate> = Bag extends {
25
14
  MetaType: unknown;
26
15
  } ? Bag["MetaType"] : unknown;
27
16
  interface UseStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate> extends UseStream<StateType, Bag> {
28
17
  meta?: GetMetaType<Bag>;
29
18
  }
30
- declare function useStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends {
31
- ConfigurableType?: Record<string, unknown>;
32
- InterruptType?: unknown;
33
- CustomEventType?: unknown;
34
- UpdateType?: unknown;
35
- MetaType?: unknown;
36
- } = BagTemplate>(): UseStreamContext<StateType, Bag>;
19
+ declare function useStreamContext<StateType extends Record<string, unknown> = Record<string, unknown>, Bag extends BagTemplate = BagTemplate>(): UseStreamContext<StateType, Bag>;
37
20
  interface ComponentTarget {
38
21
  comp: React.FunctionComponent | React.ComponentClass;
39
22
  target: HTMLElement;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","names":["React","JsxRuntime","UIMessage","useStream","UseStream","UseStreamContext","Record","Context","BagTemplate","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\";\ndeclare const UseStreamContext: React.Context<{\n stream: UseStream<Record<string, unknown>, {\n ConfigurableType?: Record<string, unknown> | undefined;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n }>;\n meta: unknown;\n}>;\ntype BagTemplate = {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: 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 {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: unknown;\n} = 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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EAAAA,OAAAA;EAAAA,IAAAA;EAAAA,QAAAA;EAAAA,UAAAA;EAAAA,GAAAA;AAAAA,CAAAA,EAOmFe,0BAPnFf,CAAAA,EAOgHL,UAAAA,CAAWiC,GAAAA,CAAIC,OAP/H7B;QAKDN,MAAMc,CAAAA;YAA0BC,MAAAA,CAAAA;IAA/CT,CAKRY,gBAAAA,CALQZ,EAKWW,cALXX;IAf4BoB,CAqBpCP,cAAAA,CArBoCO,EAAAA,CAAAA,IAAAA,EAAAA,MAAAA,EAAAA,GAAAA,OAAAA;KAsBpCN,oBAAAA,GAAuBd;EALRqB;;AAAwBC,iBAQxBU,sBAAAA,CARwBV,IAAAA,EAAAA,MAAAA,EAAAA,MAAAA,EAAAA,OAAAA,CAAAA,EAAAA,IAAAA"}
1
+ {"version":3,"file":"client.d.ts","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,gBA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A;EAC/Bc;AAA6B;AAEjCE,iBAyBciB,sBAAAA,CAzBY,IAAA,EAAA,MAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAAA,IAAA"}
@@ -1,6 +1,5 @@
1
1
  "use client";
2
2
 
3
-
4
3
  import { useStream } from "../react/stream.js";
5
4
  import "../react/index.js";
6
5
  import * as React from "react";
@@ -57,10 +56,9 @@ const isReactNode = (value) => {
57
56
  if (isPromise(value)) return true;
58
57
  return false;
59
58
  };
60
- function LoadExternalComponent({ stream, namespace, message, meta, fallback, components,...props }) {
59
+ function LoadExternalComponent({ stream, namespace, message, meta, fallback, components, ...props }) {
61
60
  const ref = React.useRef(null);
62
- const id = React.useId();
63
- const shadowRootId = `child-shadow-${id}`;
61
+ const shadowRootId = `child-shadow-${React.useId()}`;
64
62
  const store = React.useMemo(() => COMPONENT_STORE.getBoundStore(shadowRootId), [shadowRootId]);
65
63
  const state = React.useSyncExternalStore(store.subscribe, store.getSnapshot);
66
64
  const clientComponent = components?.[message.name];
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","names":[],"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\";\n\nconst UseStreamContext = React.createContext<{\n stream: ReturnType<typeof useStream>;\n meta: unknown;\n}>(null!);\n\ntype BagTemplate = {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: unknown;\n};\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 {\n ConfigurableType?: Record<string, unknown>;\n InterruptType?: unknown;\n CustomEventType?: unknown;\n UpdateType?: unknown;\n MetaType?: unknown;\n } = 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":";;;;;;;;;;;AASA,MAAM,mBAAmB,MAAM,cAG5B;AAqBH,SAAgB,mBASsB;CACpC,MAAM,MAAM,MAAM,WAAW;AAC7B,KAAI,CAAC,IACH,OAAM,IAAI,MACR;AAIJ,QAAO,IAAI,MAAM,KAAK,EACpB,IAAI,QAAQ,MAA8C;AACxD,MAAI,SAAS,OAAQ,QAAO,OAAO;AACnC,SAAO,OAAO,OAAO;;;AAU3B,IAAM,iBAAN,MAAqB;CACnB,AAAQ,QAAyC;CAEjD,AAAQ,aAMJ;CAEJ,AAAQ,YAMJ;CAEJ,QACE,cACA,MACA,eACA;AACA,OAAK,MAAM,gBAAgB;GAAE;GAAM,QAAQ;;AAC3C,OAAK,UAAU,eAAe,SAAS,MAAM,EAAE,MAAM;;CAGvD,cAAc,cAAsB;AAClC,OAAK,WAAW,kBAAkB;GAChC,YAAY,kBAA8B;AACxC,SAAK,UAAU,kBAAkB;AACjC,SAAK,UAAU,cAAc,KAAK;AAClC,iBAAa;AACX,UAAK,UAAU,gBAAgB,KAAK,UAAU,cAAc,QACzD,MAAM,MAAM;;;GAInB,mBAAmB,KAAK,MAAM;;AAGhC,SAAO,KAAK,WAAW;;;AAI3B,MAAM,kBAAkB,IAAI;AAC5B,MAAM,mBAAmB,OAAO,IAAI;AACpC,MAAM,iBAAiB,OAAO,IAAI;AAClC,MAAM,uBAAuB,OAAO,IAAI;AA0BxC,MAAM,cAAc,UAClB,SAAS,QAAQ,OAAO,UAAU,YAAY,OAAO,YAAY;AAEnE,MAAM,aAAa,UACjB,SAAS,QACT,OAAO,UAAU,YACjB,UAAU,SACV,OAAO,MAAM,SAAS;AAExB,MAAM,eAAe,UAA6C;AAChE,KAAI,MAA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E;GAAQ;;YACzC,OAAO,UAAU,OACd,SAAS,aACP,MAAM,cAAc,MAAM,MAAM,QAAQ,QACxC,MAAM,UAER;;;AAcZ,SAAgB,uBAAuB,MAAc,QAAiB;AACpE,KAAI,OAAO,WAAW,YAAa;AAEnC,QAAO,0BAA0B;AACjC,QAAO,sBAAsB,QAAQ;;AAGvC,SAAgB,qBAAqB;AACnC,KAAI,OAAO,WAAW,YACpB;AAGF,QAAO,oBAAoB;AAC3B,QAAO,mBAAmB,SAAiB;AACzC,MAAI,SAAS,QAAS,QAAO;AAC7B,MAAI,SAAS,YAAa,QAAO;AACjC,MAAI,SAAS,oBAAqB,QAAO;AACzC,MAAI,SAAS,iCAAkC,QAAO,EAAE;AACxD,MAAI,SAAS,oCACX,QAAO;GACL;GACA,6BAA6B;AAC3B,UAAM,IAAI,MAAM;;;AAKtB,MACE,OAAO,yBAAyB,QAChC,OAAO,OAAO,0BAA0B,YACxC,QAAQ,OAAO,sBAEf,QAAO,OAAO,sBAAsB;AAGtC,QAAM,IAAI,MAAM,sBAAsB"}
1
+ {"version":3,"file":"client.js","names":[],"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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E,4CACE,oBAAC;EAAI,IAAI;EAAmB;EAAK,GAAI;GAAS,EAE9C,oBAAC,iBAAiB;EAAS,OAAO;GAAE;GAAQ;GAAM;YAC/C,OAAO,UAAU,OACd,SAAS,aACP,MAAM,cAAc,MAAM,MAAM,QAAQ,MAAM,EAC9C,MAAM,OACP,GACD;GACsB,IAC3B;;AAYP,SAAgB,uBAAuB,MAAc,QAAiB;AACpE,KAAI,OAAO,WAAW,YAAa;AAEnC,QAAO,0BAA0B,EAAE;AACnC,QAAO,sBAAsB,QAAQ;;AAGvC,SAAgB,qBAAqB;AACnC,KAAI,OAAO,WAAW,YACpB;AAGF,QAAO,oBAAoB;AAC3B,QAAO,mBAAmB,SAAiB;AACzC,MAAI,SAAS,QAAS,QAAO;AAC7B,MAAI,SAAS,YAAa,QAAO;AACjC,MAAI,SAAS,oBAAqB,QAAO;AACzC,MAAI,SAAS,iCAAkC,QAAO,EAAE,WAAW;AACnE,MAAI,SAAS,oCACX,QAAO;GACL;GACA,6BAA6B;AAC3B,UAAM,IAAI,MAAM,iDAAiD;;GAEpE;AAGH,MACE,OAAO,yBAAyB,QAChC,OAAO,OAAO,0BAA0B,YACxC,QAAQ,OAAO,sBAEf,QAAO,OAAO,sBAAsB;AAGtC,QAAM,IAAI,MAAM,sBAAsB,OAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["bootstrapUiContext"],"sources":["../../src/react-ui/index.ts"],"sourcesContent":["import { bootstrapUiContext } from \"./client.js\";\n\nbootstrapUiContext();\n\nexport {\n useStreamContext,\n LoadExternalComponent,\n experimental_loadShare,\n} from \"./client.js\";\nexport {\n uiMessageReducer,\n isUIMessage,\n isRemoveUIMessage,\n type UIMessage,\n type RemoveUIMessage,\n} from \"./types.js\";\n"],"mappings":";;;;AAEAA"}
1
+ {"version":3,"file":"index.cjs","names":["bootstrapUiContext"],"sources":["../../src/react-ui/index.ts"],"sourcesContent":["import { bootstrapUiContext } from \"./client.js\";\n\nbootstrapUiContext();\n\nexport {\n useStreamContext,\n LoadExternalComponent,\n experimental_loadShare,\n} from \"./client.js\";\nexport {\n uiMessageReducer,\n isUIMessage,\n isRemoveUIMessage,\n type UIMessage,\n type RemoveUIMessage,\n} from \"./types.js\";\n"],"mappings":";;;;AAEAA,mCAAoB"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../../src/react-ui/index.ts"],"sourcesContent":["import { bootstrapUiContext } from \"./client.js\";\n\nbootstrapUiContext();\n\nexport {\n useStreamContext,\n LoadExternalComponent,\n experimental_loadShare,\n} from \"./client.js\";\nexport {\n uiMessageReducer,\n isUIMessage,\n isRemoveUIMessage,\n type UIMessage,\n type RemoveUIMessage,\n} from \"./types.js\";\n"],"mappings":";;;;AAEA"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["../../src/react-ui/index.ts"],"sourcesContent":["import { bootstrapUiContext } from \"./client.js\";\n\nbootstrapUiContext();\n\nexport {\n useStreamContext,\n LoadExternalComponent,\n experimental_loadShare,\n} from \"./client.js\";\nexport {\n uiMessageReducer,\n isUIMessage,\n isRemoveUIMessage,\n type UIMessage,\n type RemoveUIMessage,\n} from \"./types.js\";\n"],"mappings":";;;;AAEA,oBAAoB"}
@@ -1,5 +1,5 @@
1
1
  const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
2
- const uuid = require_rolldown_runtime.__toESM(require("uuid"));
2
+ let uuid = require("uuid");
3
3
 
4
4
  //#region src/react-ui/server/server.ts
5
5
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"server.cjs","names":["items: (UIMessage | RemoveUIMessage)[]","evt: UIMessage<K, PropMap[K] | Partial<PropMap[K]>>","options","evt: RemoveUIMessage"],"sources":["../../../src/react-ui/server/server.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\nimport type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\n\ninterface MessageLike {\n id?: string;\n}\n\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport const typedUi = <Decl extends Record<string, ElementType>>(\n config: {\n writer?: (chunk: unknown) => void;\n runId?: string;\n metadata?: Record<string, unknown>;\n tags?: string[];\n runName?: string;\n configurable?: {\n __pregel_send?: (writes_: [string, unknown][]) => void;\n [key: string]: unknown;\n };\n },\n options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string;\n }\n) => {\n type PropMap = { [K in keyof Decl]: ComponentPropsWithoutRef<Decl[K]> };\n const items: (UIMessage | RemoveUIMessage)[] = [];\n const stateKey = options?.stateKey ?? \"ui\";\n\n const runId = (config.metadata?.run_id as string | undefined) ?? config.runId;\n if (!runId) throw new Error(\"run_id is required\");\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K];\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K]>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options: { message?: MessageLike; merge: true }\n ): UIMessage<K, Partial<PropMap[K]>>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K] | Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K] | Partial<PropMap[K]>> {\n const evt: UIMessage<K, PropMap[K] | Partial<PropMap[K]>> = {\n type: \"ui\" as const,\n id: message?.id ?? uuidv4(),\n name: message?.name,\n props: message?.props,\n metadata: {\n merge: options?.merge || undefined,\n run_id: runId,\n tags: config.tags,\n name: config.runName,\n ...message?.metadata,\n ...(options?.message ? { message_id: options.message.id } : null),\n },\n };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n }\n\n const handleDelete = (id: string): RemoveUIMessage => {\n const evt: RemoveUIMessage = { type: \"remove-ui\", id };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n };\n\n return { push: handlePush, delete: handleDelete, items };\n};\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,WACX,QAWA,YAIG;CAEH,MAAMA,QAAyC;CAC/C,MAAM,WAAW,SAAS,YAAY;CAEtC,MAAM,QAAS,OAAO,UAAU,UAAiC,OAAO;AACxE,KAAI,CAAC,MAAO,OAAM,IAAI,MAAM;CAsB5B,SAAS,WACP,SAMA,WACgD;EAChD,MAAMC,MAAsD;GAC1D,MAAM;GACN,IAAI,SAAS;GACb,MAAM,SAAS;GACf,OAAO,SAAS;GAChB,UAAU;IACR,OAAOC,WAAS,SAAS;IACzB,QAAQ;IACR,MAAM,OAAO;IACb,MAAM,OAAO;IACb,GAAG,SAAS;IACZ,GAAIA,WAAS,UAAU,EAAE,YAAYA,UAAQ,QAAQ,OAAO;;;AAGhE,QAAM,KAAK;AACX,SAAO,SAAS;AAChB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU;AACjD,SAAO;;CAGT,MAAM,gBAAgB,OAAgC;EACpD,MAAMC,MAAuB;GAAE,MAAM;GAAa;;AAClD,QAAM,KAAK;AACX,SAAO,SAAS;AAChB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU;AACjD,SAAO;;AAGT,QAAO;EAAE,MAAM;EAAY,QAAQ;EAAc"}
1
+ {"version":3,"file":"server.cjs","names":["options"],"sources":["../../../src/react-ui/server/server.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\nimport type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\n\ninterface MessageLike {\n id?: string;\n}\n\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport const typedUi = <Decl extends Record<string, ElementType>>(\n config: {\n writer?: (chunk: unknown) => void;\n runId?: string;\n metadata?: Record<string, unknown>;\n tags?: string[];\n runName?: string;\n configurable?: {\n __pregel_send?: (writes_: [string, unknown][]) => void;\n [key: string]: unknown;\n };\n },\n options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string;\n }\n) => {\n type PropMap = { [K in keyof Decl]: ComponentPropsWithoutRef<Decl[K]> };\n const items: (UIMessage | RemoveUIMessage)[] = [];\n const stateKey = options?.stateKey ?? \"ui\";\n\n const runId = (config.metadata?.run_id as string | undefined) ?? config.runId;\n if (!runId) throw new Error(\"run_id is required\");\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K];\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K]>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options: { message?: MessageLike; merge: true }\n ): UIMessage<K, Partial<PropMap[K]>>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K] | Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K] | Partial<PropMap[K]>> {\n const evt: UIMessage<K, PropMap[K] | Partial<PropMap[K]>> = {\n type: \"ui\" as const,\n id: message?.id ?? uuidv4(),\n name: message?.name,\n props: message?.props,\n metadata: {\n merge: options?.merge || undefined,\n run_id: runId,\n tags: config.tags,\n name: config.runName,\n ...message?.metadata,\n ...(options?.message ? { message_id: options.message.id } : null),\n },\n };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n }\n\n const handleDelete = (id: string): RemoveUIMessage => {\n const evt: RemoveUIMessage = { type: \"remove-ui\", id };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n };\n\n return { push: handlePush, delete: handleDelete, items };\n};\n"],"mappings":";;;;;;;;;;;;AAgBA,MAAa,WACX,QAWA,YAIG;CAEH,MAAM,QAAyC,EAAE;CACjD,MAAM,WAAW,SAAS,YAAY;CAEtC,MAAM,QAAS,OAAO,UAAU,UAAiC,OAAO;AACxE,KAAI,CAAC,MAAO,OAAM,IAAI,MAAM,qBAAqB;CAsBjD,SAAS,WACP,SAMA,WACgD;EAChD,MAAM,MAAsD;GAC1D,MAAM;GACN,IAAI,SAAS,oBAAc;GAC3B,MAAM,SAAS;GACf,OAAO,SAAS;GAChB,UAAU;IACR,OAAOA,WAAS,SAAS;IACzB,QAAQ;IACR,MAAM,OAAO;IACb,MAAM,OAAO;IACb,GAAG,SAAS;IACZ,GAAIA,WAAS,UAAU,EAAE,YAAYA,UAAQ,QAAQ,IAAI,GAAG;IAC7D;GACF;AACD,QAAM,KAAK,IAAI;AACf,SAAO,SAAS,IAAI;AACpB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC;AACvD,SAAO;;CAGT,MAAM,gBAAgB,OAAgC;EACpD,MAAM,MAAuB;GAAE,MAAM;GAAa;GAAI;AACtD,QAAM,KAAK,IAAI;AACf,SAAO,SAAS,IAAI;AACpB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC;AACvD,SAAO;;AAGT,QAAO;EAAE,MAAM;EAAY,QAAQ;EAAc;EAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.cts","names":["ComponentPropsWithoutRef","ElementType","RemoveUIMessage","UIMessage","MessageLike","typedUi","Record","Decl","K","K_1","Partial"],"sources":["../../../src/react-ui/server/server.d.ts"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\ninterface MessageLike {\n id?: string;\n}\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport declare const typedUi: <Decl extends Record<string, ElementType>>(config: {\n writer?: ((chunk: unknown) => void) | undefined;\n runId?: string | undefined;\n metadata?: Record<string, unknown> | undefined;\n tags?: string[] | undefined;\n runName?: string | undefined;\n configurable?: {\n [key: string]: unknown;\n __pregel_send?: ((writes_: [string, unknown][]) => void) | undefined;\n } | undefined;\n}, options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string | undefined;\n} | undefined) => {\n push: {\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K];\n metadata?: Record<string, unknown> | undefined;\n }, options?: {\n message?: MessageLike | undefined;\n merge?: boolean | undefined;\n } | undefined): UIMessage<K, { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n metadata?: Record<string, unknown> | undefined;\n }, options: {\n message?: MessageLike | undefined;\n merge: true;\n }): UIMessage<K, Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>>;\n };\n delete: (id: string) => RemoveUIMessage;\n items: (RemoveUIMessage | UIMessage<string, Record<string, unknown>>)[];\n};\nexport {};\n"],"mappings":";;;;UAEUI,WAAAA;;AADoD;AAY9D;;;;;;;;AAkBmEG,cAlB9CF,OAkB8CE,EAAAA,CAAAA,aAlBvBD,MAkBuBC,CAAAA,MAAAA,EAlBRN,WAkBQM,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA;QA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L,SASFK,CATYA,CASZA,EAAAA,UAAAA,MAT+BD,IAS/BC,GATsCR,wBAStCQ,CAT+DD,IAS/DC,CAToEC,GASpED,CAAAA,CAAAA,EAAAA,CAT6EA,CAS7EA,CAAAA,CAAAA;IAA2BD,CAAAA,UAAAA,MARxBA,IAQwBA,GAAAA,MAAAA,CAAAA,CAAAA,OAAAA,EAAAA;MAAgCA,EAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;MAAKE,IAAAA,EANpED,CAMoEC;MAA9BT,KAAAA,EALrCU,OAKqCV,CAAAA,UAAAA,MALbO,IAKaP,GALNA,wBAKMA,CALmBO,IAKnBP,CALwBS,GAKxBT,CAAAA,CAAAA,EAAAA,CALiCQ,CAKjCR,CAAAA,CAAAA;MAAuCQ,QAAAA,CAAAA,EAJxEF,MAIwEE,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;IAAtEE,CAAAA,EAAAA,OAAAA,EAAAA;MAAbP,OAAAA,CAAAA,EAFUC,WAEVD,GAAAA,SAAAA;MAEgBD,KAAAA,EAAAA,IAAAA;IAChBA,CAAAA,CAAAA,EAHAC,SAGAD,CAHUM,CAGVN,EAHaQ,OAGbR,CAAAA,UAAAA,MAHqCK,IAGrCL,GAH4CF,wBAG5CE,CAHqEK,IAGrEL,CAH0EO,GAG1EP,CAAAA,CAAAA,EAAAA,CAHmFM,CAGnFN,CAAAA,CAAAA,CAAAA;;QAAkBC,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,GADFD,eACEC;UAAlBD,kBAAkBC,kBAAkBG"}
1
+ {"version":3,"file":"server.d.cts","names":["ComponentPropsWithoutRef","ElementType","RemoveUIMessage","UIMessage","MessageLike","typedUi","Record","Decl","K","K_1","Partial"],"sources":["../../../src/react-ui/server/server.d.ts"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\ninterface MessageLike {\n id?: string;\n}\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport declare const typedUi: <Decl extends Record<string, ElementType>>(config: {\n writer?: ((chunk: unknown) => void) | undefined;\n runId?: string | undefined;\n metadata?: Record<string, unknown> | undefined;\n tags?: string[] | undefined;\n runName?: string | undefined;\n configurable?: {\n [key: string]: unknown;\n __pregel_send?: ((writes_: [string, unknown][]) => void) | undefined;\n } | undefined;\n}, options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string | undefined;\n} | undefined) => {\n push: {\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K];\n metadata?: Record<string, unknown> | undefined;\n }, options?: {\n message?: MessageLike | undefined;\n merge?: boolean | undefined;\n } | undefined): UIMessage<K, { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n metadata?: Record<string, unknown> | undefined;\n }, options: {\n message?: MessageLike | undefined;\n merge: true;\n }): UIMessage<K, Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>>;\n };\n delete: (id: string) => RemoveUIMessage;\n items: (RemoveUIMessage | UIMessage<string, Record<string, unknown>>)[];\n};\nexport {};\n"],"mappings":";;;;UAEUI,WAAAA;;AADoD;AAY9D;;;;;;;;AAkBmEG,cAlB9CF,OAkB8CE,EAAAA,CAAAA,aAlBvBD,MAkBuBC,CAAAA,MAAAA,EAlBRN,WAkBQM,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA;QAAKE,CAAAA,EAAAA,CAAAA,CAAAA,KAAAA,EAAAA,OAAAA,EAAAA,GAAAA,IA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+DD,IAS/DC,CAToEC,GASpED,CAAAA,CAAAA,EAAAA,CAT6EA,CAS7EA,CAAAA,CAAAA;IAA2BD,CAAAA,UAAAA,MARxBA,IAQwBA,GAAAA,MAAAA,CAAAA,CAAAA,OAAAA,EAAAA;MAAgCA,EAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;MAAKE,IAAAA,EANpED,CAMoEC;MAA9BT,KAAAA,EALrCU,OAKqCV,CAAAA,UAAAA,MALbO,IAKaP,GALNA,wBAKMA,CALmBO,IAKnBP,CALwBS,GAKxBT,CAAAA,CAAAA,EAAAA,CALiCQ,CAKjCR,CAAAA,CAAAA;MAAuCQ,QAAAA,CAAAA,EAJxEF,MAIwEE,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;IAAtEE,CAAAA,EAAAA,OAAAA,EAAAA;MAAbP,OAAAA,CAAAA,EAFUC,WAEVD,GAAAA,SAAAA;MAEgBD,KAAAA,EAAAA,IAAAA;IAChBA,CAAAA,CAAAA,EAHAC,SAGAD,CAHUM,CAGVN,EAHaQ,OAGbR,CAAAA,UAAAA,MAHqCK,IAGrCL,GAH4CF,wBAG5CE,CAHqEK,IAGrEL,CAH0EO,GAG1EP,CAAAA,CAAAA,EAAAA,CAHmFM,CAGnFN,CAAAA,CAAAA,CAAAA;;QAAkBC,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,GADFD,eACEC;EAAS,KAAA,EAAA,CAA3BD,eAA2B,GAATC,SAAS,CAAA,MAAA,EAASG,MAAT,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","names":["ComponentPropsWithoutRef","ElementType","RemoveUIMessage","UIMessage","MessageLike","typedUi","Record","Decl","K","K_1","Partial"],"sources":["../../../src/react-ui/server/server.d.ts"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\ninterface MessageLike {\n id?: string;\n}\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport declare const typedUi: <Decl extends Record<string, ElementType>>(config: {\n writer?: ((chunk: unknown) => void) | undefined;\n runId?: string | undefined;\n metadata?: Record<string, unknown> | undefined;\n tags?: string[] | undefined;\n runName?: string | undefined;\n configurable?: {\n [key: string]: unknown;\n __pregel_send?: ((writes_: [string, unknown][]) => void) | undefined;\n } | undefined;\n}, options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string | undefined;\n} | undefined) => {\n push: {\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K];\n metadata?: Record<string, unknown> | undefined;\n }, options?: {\n message?: MessageLike | undefined;\n merge?: boolean | undefined;\n } | undefined): UIMessage<K, { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n metadata?: Record<string, unknown> | undefined;\n }, options: {\n message?: MessageLike | undefined;\n merge: true;\n }): UIMessage<K, Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>>;\n };\n delete: (id: string) => RemoveUIMessage;\n items: (RemoveUIMessage | UIMessage<string, Record<string, unknown>>)[];\n};\nexport {};\n"],"mappings":";;;;UAEUI,WAAAA;;AADoD;AAY9D;;;;;;;;AAkBmEG,cAlB9CF,OAkB8CE,EAAAA,CAAAA,aAlBvBD,MAkBuBC,CAAAA,MAAAA,EAlBRN,WAkBQM,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA;QAAKE,CAAAA,EAAAA,CAAAA,CAAAA,KAAAA,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D,IAS/BC,GATsCR,wBAStCQ,CAT+DD,IAS/DC,CAToEC,GASpED,CAAAA,CAAAA,EAAAA,CAT6EA,CAS7EA,CAAAA,CAAAA;IAA2BD,CAAAA,UAAAA,MARxBA,IAQwBA,GAAAA,MAAAA,CAAAA,CAAAA,OAAAA,EAAAA;MAAgCA,EAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;MAAKE,IAAAA,EANpED,CAMoEC;MAA9BT,KAAAA,EALrCU,OAKqCV,CAAAA,UAAAA,MALbO,IAKaP,GALNA,wBAKMA,CALmBO,IAKnBP,CALwBS,GAKxBT,CAAAA,CAAAA,EAAAA,CALiCQ,CAKjCR,CAAAA,CAAAA;MAAuCQ,QAAAA,CAAAA,EAJxEF,MAIwEE,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;IAAtEE,CAAAA,EAAAA,OAAAA,EAAAA;MAAbP,OAAAA,CAAAA,EAFUC,WAEVD,GAAAA,SAAAA;MAEgBD,KAAAA,EAAAA,IAAAA;IAChBA,CAAAA,CAAAA,EAHAC,SAGAD,CAHUM,CAGVN,EAHaQ,OAGbR,CAAAA,UAAAA,MAHqCK,IAGrCL,GAH4CF,wBAG5CE,CAHqEK,IAGrEL,CAH0EO,GAG1EP,CAAAA,CAAAA,EAAAA,CAHmFM,CAGnFN,CAAAA,CAAAA,CAAAA;;QAAkBC,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,GADFD,eACEC;UAAlBD,kBAAkBC,kBAAkBG"}
1
+ {"version":3,"file":"server.d.ts","names":["ComponentPropsWithoutRef","ElementType","RemoveUIMessage","UIMessage","MessageLike","typedUi","Record","Decl","K","K_1","Partial"],"sources":["../../../src/react-ui/server/server.d.ts"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\ninterface MessageLike {\n id?: string;\n}\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport declare const typedUi: <Decl extends Record<string, ElementType>>(config: {\n writer?: ((chunk: unknown) => void) | undefined;\n runId?: string | undefined;\n metadata?: Record<string, unknown> | undefined;\n tags?: string[] | undefined;\n runName?: string | undefined;\n configurable?: {\n [key: string]: unknown;\n __pregel_send?: ((writes_: [string, unknown][]) => void) | undefined;\n } | undefined;\n}, options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string | undefined;\n} | undefined) => {\n push: {\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K];\n metadata?: Record<string, unknown> | undefined;\n }, options?: {\n message?: MessageLike | undefined;\n merge?: boolean | undefined;\n } | undefined): UIMessage<K, { [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n <K extends keyof Decl & string>(message: {\n id?: string | undefined;\n name: K;\n props: Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>;\n metadata?: Record<string, unknown> | undefined;\n }, options: {\n message?: MessageLike | undefined;\n merge: true;\n }): UIMessage<K, Partial<{ [K_1 in keyof Decl]: ComponentPropsWithoutRef<Decl[K_1]>; }[K]>>;\n };\n delete: (id: string) => RemoveUIMessage;\n items: (RemoveUIMessage | UIMessage<string, Record<string, unknown>>)[];\n};\nexport {};\n"],"mappings":";;;;UAEUI,WAAAA;;AADoD;AAY9D;;;;;;;;AAkBmEG,cAlB9CF,OAkB8CE,EAAAA,CAAAA,aAlBvBD,MAkBuBC,CAAAA,MAAAA,EAlBRN,WAkBQM,CAAAA,CAAAA,CAAAA,MAAAA,EAAAA;QAAKE,CAAAA,EAAAA,CAAAA,CAAAA,KAAAA,EAAAA,OAAAA,EAAAA,GAAAA,IAAAA,CAAAA,GAAAA,SAAAA;OAA9BT,CAAAA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EAAAA,CAT6EA,CAS7EA,CAAAA,CAAAA;IAA2BD,CAAAA,UAAAA,MARxBA,IAQwBA,GAAAA,MAAAA,CAAAA,CAAAA,OAAAA,EAAAA;MAAgCA,EAAAA,CAAAA,EAAAA,MAAAA,GAAAA,SAAAA;MAAKE,IAAAA,EANpED,CAMoEC;MAA9BT,KAAAA,EALrCU,OAKqCV,CAAAA,UAAAA,MALbO,IAKaP,GALNA,wBAKMA,CALmBO,IAKnBP,CALwBS,GAKxBT,CAAAA,CAAAA,EAAAA,CALiCQ,CAKjCR,CAAAA,CAAAA;MAAuCQ,QAAAA,CAAAA,EAJxEF,MAIwEE,CAAAA,MAAAA,EAAAA,OAAAA,CAAAA,GAAAA,SAAAA;IAAtEE,CAAAA,EAAAA,OAAAA,EAAAA;MAAbP,OAAAA,CAAAA,EAFUC,WAEVD,GAAAA,SAAAA;MAEgBD,KAAAA,EAAAA,IAAAA;IAChBA,CAAAA,CAAAA,EAHAC,SAGAD,CAHUM,CAGVN,EAHaQ,OAGbR,CAAAA,UAAAA,MAHqCK,IAGrCL,GAH4CF,wBAG5CE,CAHqEK,IAGrEL,CAH0EO,GAG1EP,CAAAA,CAAAA,EAAAA,CAHmFM,CAGnFN,CAAAA,CAAAA,CAAAA;;QAAkBC,EAAAA,CAAAA,EAAAA,EAAAA,MAAAA,EAAAA,GADFD,eACEC;EAAS,KAAA,EAAA,CAA3BD,eAA2B,GAATC,SAAS,CAAA,MAAA,EAASG,MAAT,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,CAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","names":["items: (UIMessage | RemoveUIMessage)[]","evt: UIMessage<K, PropMap[K] | Partial<PropMap[K]>>","uuidv4","options","evt: RemoveUIMessage"],"sources":["../../../src/react-ui/server/server.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\nimport type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\n\ninterface MessageLike {\n id?: string;\n}\n\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport const typedUi = <Decl extends Record<string, ElementType>>(\n config: {\n writer?: (chunk: unknown) => void;\n runId?: string;\n metadata?: Record<string, unknown>;\n tags?: string[];\n runName?: string;\n configurable?: {\n __pregel_send?: (writes_: [string, unknown][]) => void;\n [key: string]: unknown;\n };\n },\n options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string;\n }\n) => {\n type PropMap = { [K in keyof Decl]: ComponentPropsWithoutRef<Decl[K]> };\n const items: (UIMessage | RemoveUIMessage)[] = [];\n const stateKey = options?.stateKey ?? \"ui\";\n\n const runId = (config.metadata?.run_id as string | undefined) ?? config.runId;\n if (!runId) throw new Error(\"run_id is required\");\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K];\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K]>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options: { message?: MessageLike; merge: true }\n ): UIMessage<K, Partial<PropMap[K]>>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K] | Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K] | Partial<PropMap[K]>> {\n const evt: UIMessage<K, PropMap[K] | Partial<PropMap[K]>> = {\n type: \"ui\" as const,\n id: message?.id ?? uuidv4(),\n name: message?.name,\n props: message?.props,\n metadata: {\n merge: options?.merge || undefined,\n run_id: runId,\n tags: config.tags,\n name: config.runName,\n ...message?.metadata,\n ...(options?.message ? { message_id: options.message.id } : null),\n },\n };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n }\n\n const handleDelete = (id: string): RemoveUIMessage => {\n const evt: RemoveUIMessage = { type: \"remove-ui\", id };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n };\n\n return { push: handlePush, delete: handleDelete, items };\n};\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,WACX,QAWA,YAIG;CAEH,MAAMA,QAAyC;CAC/C,MAAM,WAAW,SAAS,YAAY;CAEtC,MAAM,QAAS,OAAO,UAAU,UAAiC,OAAO;AACxE,KAAI,CAAC,MAAO,OAAM,IAAI,MAAM;CAsB5B,SAAS,WACP,SAMA,WACgD;EAChD,MAAMC,MAAsD;GAC1D,MAAM;GACN,IAAI,SAAS,MAAMC;GACnB,MAAM,SAAS;GACf,OAAO,SAAS;GAChB,UAAU;IACR,OAAOC,WAAS,SAAS;IACzB,QAAQ;IACR,MAAM,OAAO;IACb,MAAM,OAAO;IACb,GAAG,SAAS;IACZ,GAAIA,WAAS,UAAU,EAAE,YAAYA,UAAQ,QAAQ,OAAO;;;AAGhE,QAAM,KAAK;AACX,SAAO,SAAS;AAChB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU;AACjD,SAAO;;CAGT,MAAM,gBAAgB,OAAgC;EACpD,MAAMC,MAAuB;GAAE,MAAM;GAAa;;AAClD,QAAM,KAAK;AACX,SAAO,SAAS;AAChB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU;AACjD,SAAO;;AAGT,QAAO;EAAE,MAAM;EAAY,QAAQ;EAAc"}
1
+ {"version":3,"file":"server.js","names":["uuidv4","options"],"sources":["../../../src/react-ui/server/server.ts"],"sourcesContent":["import { v4 as uuidv4 } from \"uuid\";\nimport type { ComponentPropsWithoutRef, ElementType } from \"react\";\nimport type { RemoveUIMessage, UIMessage } from \"../types.js\";\n\ninterface MessageLike {\n id?: string;\n}\n\n/**\n * Helper to send and persist UI messages. Accepts a map of component names to React components\n * as type argument to provide type safety. Will also write to the `options?.stateKey` state.\n *\n * @param config LangGraphRunnableConfig\n * @param options\n * @returns\n */\nexport const typedUi = <Decl extends Record<string, ElementType>>(\n config: {\n writer?: (chunk: unknown) => void;\n runId?: string;\n metadata?: Record<string, unknown>;\n tags?: string[];\n runName?: string;\n configurable?: {\n __pregel_send?: (writes_: [string, unknown][]) => void;\n [key: string]: unknown;\n };\n },\n options?: {\n /** The key to write the UI messages to. Defaults to `ui`. */\n stateKey?: string;\n }\n) => {\n type PropMap = { [K in keyof Decl]: ComponentPropsWithoutRef<Decl[K]> };\n const items: (UIMessage | RemoveUIMessage)[] = [];\n const stateKey = options?.stateKey ?? \"ui\";\n\n const runId = (config.metadata?.run_id as string | undefined) ?? config.runId;\n if (!runId) throw new Error(\"run_id is required\");\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K];\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K]>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options: { message?: MessageLike; merge: true }\n ): UIMessage<K, Partial<PropMap[K]>>;\n\n function handlePush<K extends keyof PropMap & string>(\n message: {\n id?: string;\n name: K;\n props: PropMap[K] | Partial<PropMap[K]>;\n metadata?: Record<string, unknown>;\n },\n options?: { message?: MessageLike; merge?: boolean }\n ): UIMessage<K, PropMap[K] | Partial<PropMap[K]>> {\n const evt: UIMessage<K, PropMap[K] | Partial<PropMap[K]>> = {\n type: \"ui\" as const,\n id: message?.id ?? uuidv4(),\n name: message?.name,\n props: message?.props,\n metadata: {\n merge: options?.merge || undefined,\n run_id: runId,\n tags: config.tags,\n name: config.runName,\n ...message?.metadata,\n ...(options?.message ? { message_id: options.message.id } : null),\n },\n };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n }\n\n const handleDelete = (id: string): RemoveUIMessage => {\n const evt: RemoveUIMessage = { type: \"remove-ui\", id };\n items.push(evt);\n config.writer?.(evt);\n config.configurable?.__pregel_send?.([[stateKey, evt]]);\n return evt;\n };\n\n return { push: handlePush, delete: handleDelete, items };\n};\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,WACX,QAWA,YAIG;CAEH,MAAM,QAAyC,EAAE;CACjD,MAAM,WAAW,SAAS,YAAY;CAEtC,MAAM,QAAS,OAAO,UAAU,UAAiC,OAAO;AACxE,KAAI,CAAC,MAAO,OAAM,IAAI,MAAM,qBAAqB;CAsBjD,SAAS,WACP,SAMA,WACgD;EAChD,MAAM,MAAsD;GAC1D,MAAM;GACN,IAAI,SAAS,MAAMA,IAAQ;GAC3B,MAAM,SAAS;GACf,OAAO,SAAS;GAChB,UAAU;IACR,OAAOC,WAAS,SAAS;IACzB,QAAQ;IACR,MAAM,OAAO;IACb,MAAM,OAAO;IACb,GAAG,SAAS;IACZ,GAAIA,WAAS,UAAU,EAAE,YAAYA,UAAQ,QAAQ,IAAI,GAAG;IAC7D;GACF;AACD,QAAM,KAAK,IAAI;AACf,SAAO,SAAS,IAAI;AACpB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC;AACvD,SAAO;;CAGT,MAAM,gBAAgB,OAAgC;EACpD,MAAM,MAAuB;GAAE,MAAM;GAAa;GAAI;AACtD,QAAM,KAAK,IAAI;AACf,SAAO,SAAS,IAAI;AACpB,SAAO,cAAc,gBAAgB,CAAC,CAAC,UAAU,IAAI,CAAC,CAAC;AACvD,SAAO;;AAGT,QAAO;EAAE,MAAM;EAAY,QAAQ;EAAc;EAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.cjs","names":[],"sources":["../../src/react-ui/types.ts"],"sourcesContent":["export interface UIMessage<\n TName extends string = string,\n TProps extends Record<string, unknown> = Record<string, unknown>\n> {\n type: \"ui\";\n\n id: string;\n name: TName;\n props: TProps;\n metadata?: {\n merge?: boolean;\n run_id?: string;\n name?: string;\n tags?: string[];\n message_id?: string;\n [key: string]: unknown;\n };\n}\n\nexport interface RemoveUIMessage {\n type: \"remove-ui\";\n id: string;\n}\n\nexport function isUIMessage(message: unknown): message is UIMessage {\n if (typeof message !== \"object\" || message == null) return false;\n if (!(\"type\" in message)) return false;\n return message.type === \"ui\";\n}\n\nexport function isRemoveUIMessage(\n message: unknown\n): message is RemoveUIMessage {\n if (typeof message !== \"object\" || message == null) return false;\n if (!(\"type\" in message)) return false;\n return message.type === \"remove-ui\";\n}\n\nexport function uiMessageReducer(\n state: UIMessage[],\n update: UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]\n) {\n const events = Array.isArray(update) ? update : [update];\n let newState = state.slice();\n\n for (const event of events) {\n if (event.type === \"remove-ui\") {\n newState = newState.filter((ui) => ui.id !== event.id);\n continue;\n }\n\n const index = state.findIndex((ui) => ui.id === event.id);\n if (index !== -1) {\n newState[index] =\n typeof event.metadata === \"object\" &&\n event.metadata != null &&\n event.metadata.merge\n ? { ...event, props: { ...state[index].props, ...event.props } }\n : event;\n } else {\n newState.push(event);\n }\n }\n\n return newState;\n}\n"],"mappings":";;AAwBA,SAAgB,YAAY,SAAwC;AAClE,KAAI,OAAO,YAAY,YAAY,WAAW,KAAM,QAAO;AAC3D,KAAI,EAAE,UAAU,SAAU,QAAO;AACjC,QAAO,QAAQ,SAAS;;AAG1B,SAAgB,kBACd,SAC4B;AAC5B,KAAI,OAAO,YAAY,YAAY,WAAW,KAAM,QAAO;AAC3D,KAAI,EAAE,UAAU,SAAU,QAAO;AACjC,QAAO,QAAQ,SAAS;;AAG1B,SAAgB,iBACd,OACA,QACA;CACA,MAAM,SAAS,MAAM,QAAQ,UAAU,SAAS,CAAC;CACjD,IAAI,WAAW,MAAM;AAErB,MAAK,MAAM,SAAS,QAAQ;AAC1B,MAAI,MAAM,SAAS,aAAa;AAC9B,cAAW,SAAS,QAAQ,OAAO,GAAG,OAAO,MAAM;AACnD;;EAGF,MAAM,QAAQ,MAAM,WAAW,OAAO,GAAG,OAAO,MAAM;AACtD,MAAI,UAAU,GACZ,UAAS,SACP,OAAO,MAAM,aAAa,YAC1B,MAAM,YAAY,QAClB,MAAM,SAAS,QACX;GAAE,GAAG;GAAO,OAAO;IAAE,GAAG,MAAM,OAAO;IAAO,GAAG,MAAM;;MACrD;MAEN,UAAS,KAAK;;AAIlB,QAAO"}
1
+ {"version":3,"file":"types.cjs","names":[],"sources":["../../src/react-ui/types.ts"],"sourcesContent":["export interface UIMessage<\n TName extends string = string,\n TProps extends Record<string, unknown> = Record<string, unknown>\n> {\n type: \"ui\";\n\n id: string;\n name: TName;\n props: TProps;\n metadata?: {\n merge?: boolean;\n run_id?: string;\n name?: string;\n tags?: string[];\n message_id?: string;\n [key: string]: unknown;\n };\n}\n\nexport interface RemoveUIMessage {\n type: \"remove-ui\";\n id: string;\n}\n\nexport function isUIMessage(message: unknown): message is UIMessage {\n if (typeof message !== \"object\" || message == null) return false;\n if (!(\"type\" in message)) return false;\n return message.type === \"ui\";\n}\n\nexport function isRemoveUIMessage(\n message: unknown\n): message is RemoveUIMessage {\n if (typeof message !== \"object\" || message == null) return false;\n if (!(\"type\" in message)) return false;\n return message.type === \"remove-ui\";\n}\n\nexport function uiMessageReducer(\n state: UIMessage[],\n update: UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]\n) {\n const events = Array.isArray(update) ? update : [update];\n let newState = state.slice();\n\n for (const event of events) {\n if (event.type === \"remove-ui\") {\n newState = newState.filter((ui) => ui.id !== event.id);\n continue;\n }\n\n const index = state.findIndex((ui) => ui.id === event.id);\n if (index !== -1) {\n newState[index] =\n typeof event.metadata === \"object\" &&\n event.metadata != null &&\n event.metadata.merge\n ? { ...event, props: { ...state[index].props, ...event.props } }\n : event;\n } else {\n newState.push(event);\n }\n }\n\n return newState;\n}\n"],"mappings":";;AAwBA,SAAgB,YAAY,SAAwC;AAClE,KAAI,OAAO,YAAY,YAAY,WAAW,KAAM,QAAO;AAC3D,KAAI,EAAE,UAAU,SAAU,QAAO;AACjC,QAAO,QAAQ,SAAS;;AAG1B,SAAgB,kBACd,SAC4B;AAC5B,KAAI,OAAO,YAAY,YAAY,WAAW,KAAM,QAAO;AAC3D,KAAI,EAAE,UAAU,SAAU,QAAO;AACjC,QAAO,QAAQ,SAAS;;AAG1B,SAAgB,iBACd,OACA,QACA;CACA,MAAM,SAAS,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO;CACxD,IAAI,WAAW,MAAM,OAAO;AAE5B,MAAK,MAAM,SAAS,QAAQ;AAC1B,MAAI,MAAM,SAAS,aAAa;AAC9B,cAAW,SAAS,QAAQ,OAAO,GAAG,OAAO,MAAM,GAAG;AACtD;;EAGF,MAAM,QAAQ,MAAM,WAAW,OAAO,GAAG,OAAO,MAAM,GAAG;AACzD,MAAI,UAAU,GACZ,UAAS,SACP,OAAO,MAAM,aAAa,YAC1B,MAAM,YAAY,QAClB,MAAM,SAAS,QACX;GAAE,GAAG;GAAO,OAAO;IAAE,GAAG,MAAM,OAAO;IAAO,GAAG,MAAM;IAAO;GAAE,GAC9D;MAEN,UAAS,KAAK,MAAM;;AAIxB,QAAO"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.cts","names":["UIMessage","Record","TName","TProps","RemoveUIMessage","isUIMessage","isRemoveUIMessage","uiMessageReducer"],"sources":["../../src/react-ui/types.d.ts"],"sourcesContent":["export interface UIMessage<TName extends string = string, TProps extends Record<string, unknown> = Record<string, unknown>> {\n type: \"ui\";\n id: string;\n name: TName;\n props: TProps;\n metadata?: {\n merge?: boolean;\n run_id?: string;\n name?: string;\n tags?: string[];\n message_id?: string;\n [key: string]: unknown;\n };\n}\nexport interface RemoveUIMessage {\n type: \"remove-ui\";\n id: string;\n}\nexport declare function isUIMessage(message: unknown): message is UIMessage;\nexport declare function isRemoveUIMessage(message: unknown): message is RemoveUIMessage;\nexport declare function uiMessageReducer(state: UIMessage[], update: UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]): UIMessage<string, Record<string, unknown>>[];\n"],"mappings":";UAAiBA,wDAAwDC,0BAA0BA;EAAlFD,IAAAA,EAAAA,IAAAA;EAAS,EAAA,EAAA,MAAA;MAA+CC,EAG/DC,KAH+DD;OAA0BA,EAIxFE,MAJwFF;UAGzFC,CAAAA,EAAAA;IACCC,KAAAA,CAAAA,EAAAA,OAAAA;;IAUMC,IAAAA,CAAAA,EAAAA,MAAAA;IAIOC,IAAAA,CAAAA,EAAAA,MAAW,EAAA;IACXC,UAAAA,CAAAA,EAAAA,MAAiB;IACjBC,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAAgB,OAAA;EAAA,CAAA;;AAA6BP,UANpDI,eAAAA,CAMoDJ;MAAYI,EAAAA,WAAAA;MAAmBJ,MAAAA;;AAAmDC,iBAF/HI,WAAAA,CAE+HJ,OAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,IAFrFD,SAEqFC;AAAlBD,iBAD7GM,iBAAAA,CAC6GN,OAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,IAD7DI,eAC6DJ;iBAA7GO,gBAAAA,QAAwBP,qBAAqBA,YAAYI,mBAAmBJ,YAAYI,qBAAqBJ,kBAAkBC"}
1
+ {"version":3,"file":"types.d.cts","names":["UIMessage","Record","TName","TProps","RemoveUIMessage","isUIMessage","isRemoveUIMessage","uiMessageReducer"],"sources":["../../src/react-ui/types.d.ts"],"sourcesContent":["export interface UIMessage<TName extends string = string, TProps extends Record<string, unknown> = Record<string, unknown>> {\n type: \"ui\";\n id: string;\n name: TName;\n props: TProps;\n metadata?: {\n merge?: boolean;\n run_id?: string;\n name?: string;\n tags?: string[];\n message_id?: string;\n [key: string]: unknown;\n };\n}\nexport interface RemoveUIMessage {\n type: \"remove-ui\";\n id: string;\n}\nexport declare function isUIMessage(message: unknown): message is UIMessage;\nexport declare function isRemoveUIMessage(message: unknown): message is RemoveUIMessage;\nexport declare function uiMessageReducer(state: UIMessage[], update: UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]): UIMessage<string, Record<string, unknown>>[];\n"],"mappings":";UAAiBA,wDAAwDC,0BAA0BA;EAAlFD,IAAAA,EAAAA,IAAAA;EAAS,EAAA,EAAA,MAAA;MAA+CC,EAG/DC,KAH+DD;OAA0BA,EAIxFE,MAJwFF;UAGzFC,CAAAA,EAAAA;IACCC,KAAAA,CAAAA,EAAAA,OAAAA;IAAM,MAAA,CAAA,EAAA,MAAA;IAUAC,IAAAA,CAAAA,EAAAA,MAAAA;IAIOC,IAAAA,CAAAA,EAAAA,MAAW,EAAA;IACXC,UAAAA,CAAAA,EAAAA,MAAiB;IACjBC,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAAgB,OAAA;EAAA,CAAA;;AAA6BP,UANpDI,eAAAA,CAMoDJ;MAAYI,EAAAA,WAAAA;MAAmBJ,MAAAA;;AAAmDC,iBAF/HI,WAAAA,CAE+HJ,OAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,IAFrFD,SAEqFC;AAAlBD,iBAD7GM,iBAAAA,CAC6GN,OAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,IAD7DI,eAC6DJ;AAAS,iBAAtHO,gBAAAA,CAAsH,KAAA,EAA9FP,SAA8F,EAAA,EAAA,MAAA,EAAzEA,SAAyE,GAA7DI,eAA6D,GAAA,CAA1CJ,SAA0C,GAA9BI,eAA8B,CAAA,EAAA,CAAA,EAATJ,SAAS,CAAA,MAAA,EAASC,MAAT,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":["UIMessage","Record","TName","TProps","RemoveUIMessage","isUIMessage","isRemoveUIMessage","uiMessageReducer"],"sources":["../../src/react-ui/types.d.ts"],"sourcesContent":["export interface UIMessage<TName extends string = string, TProps extends Record<string, unknown> = Record<string, unknown>> {\n type: \"ui\";\n id: string;\n name: TName;\n props: TProps;\n metadata?: {\n merge?: boolean;\n run_id?: string;\n name?: string;\n tags?: string[];\n message_id?: string;\n [key: string]: unknown;\n };\n}\nexport interface RemoveUIMessage {\n type: \"remove-ui\";\n id: string;\n}\nexport declare function isUIMessage(message: unknown): message is UIMessage;\nexport declare function isRemoveUIMessage(message: unknown): message is RemoveUIMessage;\nexport declare function uiMessageReducer(state: UIMessage[], update: UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]): UIMessage<string, Record<string, unknown>>[];\n"],"mappings":";UAAiBA,wDAAwDC,0BAA0BA;EAAlFD,IAAAA,EAAAA,IAAAA;EAAS,EAAA,EAAA,MAAA;MAA+CC,EAG/DC,KAH+DD;OAA0BA,EAIxFE,MAJwFF;UAGzFC,CAAAA,EAAAA;IACCC,KAAAA,CAAAA,EAAAA,OAAAA;;IAUMC,IAAAA,CAAAA,EAAAA,MAAAA;IAIOC,IAAAA,CAAAA,EAAAA,MAAW,EAAA;IACXC,UAAAA,CAAAA,EAAAA,MAAiB;IACjBC,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAAgB,OAAA;EAAA,CAAA;;AAA6BP,UANpDI,eAAAA,CAMoDJ;MAAYI,EAAAA,WAAAA;MAAmBJ,MAAAA;;AAAmDC,iBAF/HI,WAAAA,CAE+HJ,OAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,IAFrFD,SAEqFC;AAAlBD,iBAD7GM,iBAAAA,CAC6GN,OAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,IAD7DI,eAC6DJ;iBAA7GO,gBAAAA,QAAwBP,qBAAqBA,YAAYI,mBAAmBJ,YAAYI,qBAAqBJ,kBAAkBC"}
1
+ {"version":3,"file":"types.d.ts","names":["UIMessage","Record","TName","TProps","RemoveUIMessage","isUIMessage","isRemoveUIMessage","uiMessageReducer"],"sources":["../../src/react-ui/types.d.ts"],"sourcesContent":["export interface UIMessage<TName extends string = string, TProps extends Record<string, unknown> = Record<string, unknown>> {\n type: \"ui\";\n id: string;\n name: TName;\n props: TProps;\n metadata?: {\n merge?: boolean;\n run_id?: string;\n name?: string;\n tags?: string[];\n message_id?: string;\n [key: string]: unknown;\n };\n}\nexport interface RemoveUIMessage {\n type: \"remove-ui\";\n id: string;\n}\nexport declare function isUIMessage(message: unknown): message is UIMessage;\nexport declare function isRemoveUIMessage(message: unknown): message is RemoveUIMessage;\nexport declare function uiMessageReducer(state: UIMessage[], update: UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]): UIMessage<string, Record<string, unknown>>[];\n"],"mappings":";UAAiBA,wDAAwDC,0BAA0BA;EAAlFD,IAAAA,EAAAA,IAAAA;EAAS,EAAA,EAAA,MAAA;MAA+CC,EAG/DC,KAH+DD;OAA0BA,EAIxFE,MAJwFF;UAGzFC,CAAAA,EAAAA;IACCC,KAAAA,CAAAA,EAAAA,OAAAA;IAAM,MAAA,CAAA,EAAA,MAAA;IAUAC,IAAAA,CAAAA,EAAAA,MAAAA;IAIOC,IAAAA,CAAAA,EAAAA,MAAW,EAAA;IACXC,UAAAA,CAAAA,EAAAA,MAAiB;IACjBC,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAAgB,OAAA;EAAA,CAAA;;AAA6BP,UANpDI,eAAAA,CAMoDJ;MAAYI,EAAAA,WAAAA;MAAmBJ,MAAAA;;AAAmDC,iBAF/HI,WAAAA,CAE+HJ,OAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,IAFrFD,SAEqFC;AAAlBD,iBAD7GM,iBAAAA,CAC6GN,OAAAA,EAAAA,OAAAA,CAAAA,EAAAA,OAAAA,IAD7DI,eAC6DJ;AAAS,iBAAtHO,gBAAAA,CAAsH,KAAA,EAA9FP,SAA8F,EAAA,EAAA,MAAA,EAAzEA,SAAyE,GAA7DI,eAA6D,GAAA,CAA1CJ,SAA0C,GAA9BI,eAA8B,CAAA,EAAA,CAAA,EAATJ,SAAS,CAAA,MAAA,EAASC,MAAT,CAAA,MAAA,EAAA,OAAA,CAAA,CAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","names":[],"sources":["../../src/react-ui/types.ts"],"sourcesContent":["export interface UIMessage<\n TName extends string = string,\n TProps extends Record<string, unknown> = Record<string, unknown>\n> {\n type: \"ui\";\n\n id: string;\n name: TName;\n props: TProps;\n metadata?: {\n merge?: boolean;\n run_id?: string;\n name?: string;\n tags?: string[];\n message_id?: string;\n [key: string]: unknown;\n };\n}\n\nexport interface RemoveUIMessage {\n type: \"remove-ui\";\n id: string;\n}\n\nexport function isUIMessage(message: unknown): message is UIMessage {\n if (typeof message !== \"object\" || message == null) return false;\n if (!(\"type\" in message)) return false;\n return message.type === \"ui\";\n}\n\nexport function isRemoveUIMessage(\n message: unknown\n): message is RemoveUIMessage {\n if (typeof message !== \"object\" || message == null) return false;\n if (!(\"type\" in message)) return false;\n return message.type === \"remove-ui\";\n}\n\nexport function uiMessageReducer(\n state: UIMessage[],\n update: UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]\n) {\n const events = Array.isArray(update) ? update : [update];\n let newState = state.slice();\n\n for (const event of events) {\n if (event.type === \"remove-ui\") {\n newState = newState.filter((ui) => ui.id !== event.id);\n continue;\n }\n\n const index = state.findIndex((ui) => ui.id === event.id);\n if (index !== -1) {\n newState[index] =\n typeof event.metadata === \"object\" &&\n event.metadata != null &&\n event.metadata.merge\n ? { ...event, props: { ...state[index].props, ...event.props } }\n : event;\n } else {\n newState.push(event);\n }\n }\n\n return newState;\n}\n"],"mappings":";AAwBA,SAAgB,YAAY,SAAwC;AAClE,KAAI,OAAO,YAAY,YAAY,WAAW,KAAM,QAAO;AAC3D,KAAI,EAAE,UAAU,SAAU,QAAO;AACjC,QAAO,QAAQ,SAAS;;AAG1B,SAAgB,kBACd,SAC4B;AAC5B,KAAI,OAAO,YAAY,YAAY,WAAW,KAAM,QAAO;AAC3D,KAAI,EAAE,UAAU,SAAU,QAAO;AACjC,QAAO,QAAQ,SAAS;;AAG1B,SAAgB,iBACd,OACA,QACA;CACA,MAAM,SAAS,MAAM,QAAQ,UAAU,SAAS,CAAC;CACjD,IAAI,WAAW,MAAM;AAErB,MAAK,MAAM,SAAS,QAAQ;AAC1B,MAAI,MAAM,SAAS,aAAa;AAC9B,cAAW,SAAS,QAAQ,OAAO,GAAG,OAAO,MAAM;AACnD;;EAGF,MAAM,QAAQ,MAAM,WAAW,OAAO,GAAG,OAAO,MAAM;AACtD,MAAI,UAAU,GACZ,UAAS,SACP,OAAO,MAAM,aAAa,YAC1B,MAAM,YAAY,QAClB,MAAM,SAAS,QACX;GAAE,GAAG;GAAO,OAAO;IAAE,GAAG,MAAM,OAAO;IAAO,GAAG,MAAM;;MACrD;MAEN,UAAS,KAAK;;AAIlB,QAAO"}
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../src/react-ui/types.ts"],"sourcesContent":["export interface UIMessage<\n TName extends string = string,\n TProps extends Record<string, unknown> = Record<string, unknown>\n> {\n type: \"ui\";\n\n id: string;\n name: TName;\n props: TProps;\n metadata?: {\n merge?: boolean;\n run_id?: string;\n name?: string;\n tags?: string[];\n message_id?: string;\n [key: string]: unknown;\n };\n}\n\nexport interface RemoveUIMessage {\n type: \"remove-ui\";\n id: string;\n}\n\nexport function isUIMessage(message: unknown): message is UIMessage {\n if (typeof message !== \"object\" || message == null) return false;\n if (!(\"type\" in message)) return false;\n return message.type === \"ui\";\n}\n\nexport function isRemoveUIMessage(\n message: unknown\n): message is RemoveUIMessage {\n if (typeof message !== \"object\" || message == null) return false;\n if (!(\"type\" in message)) return false;\n return message.type === \"remove-ui\";\n}\n\nexport function uiMessageReducer(\n state: UIMessage[],\n update: UIMessage | RemoveUIMessage | (UIMessage | RemoveUIMessage)[]\n) {\n const events = Array.isArray(update) ? update : [update];\n let newState = state.slice();\n\n for (const event of events) {\n if (event.type === \"remove-ui\") {\n newState = newState.filter((ui) => ui.id !== event.id);\n continue;\n }\n\n const index = state.findIndex((ui) => ui.id === event.id);\n if (index !== -1) {\n newState[index] =\n typeof event.metadata === \"object\" &&\n event.metadata != null &&\n event.metadata.merge\n ? { ...event, props: { ...state[index].props, ...event.props } }\n : event;\n } else {\n newState.push(event);\n }\n }\n\n return newState;\n}\n"],"mappings":";AAwBA,SAAgB,YAAY,SAAwC;AAClE,KAAI,OAAO,YAAY,YAAY,WAAW,KAAM,QAAO;AAC3D,KAAI,EAAE,UAAU,SAAU,QAAO;AACjC,QAAO,QAAQ,SAAS;;AAG1B,SAAgB,kBACd,SAC4B;AAC5B,KAAI,OAAO,YAAY,YAAY,WAAW,KAAM,QAAO;AAC3D,KAAI,EAAE,UAAU,SAAU,QAAO;AACjC,QAAO,QAAQ,SAAS;;AAG1B,SAAgB,iBACd,OACA,QACA;CACA,MAAM,SAAS,MAAM,QAAQ,OAAO,GAAG,SAAS,CAAC,OAAO;CACxD,IAAI,WAAW,MAAM,OAAO;AAE5B,MAAK,MAAM,SAAS,QAAQ;AAC1B,MAAI,MAAM,SAAS,aAAa;AAC9B,cAAW,SAAS,QAAQ,OAAO,GAAG,OAAO,MAAM,GAAG;AACtD;;EAGF,MAAM,QAAQ,MAAM,WAAW,OAAO,GAAG,OAAO,MAAM,GAAG;AACzD,MAAI,UAAU,GACZ,UAAS,SACP,OAAO,MAAM,aAAa,YAC1B,MAAM,YAAY,QAClB,MAAM,SAAS,QACX;GAAE,GAAG;GAAO,OAAO;IAAE,GAAG,MAAM,OAAO;IAAO,GAAG,MAAM;IAAO;GAAE,GAC9D;MAEN,UAAS,KAAK,MAAM;;AAIxB,QAAO"}
package/dist/schema.d.cts CHANGED
@@ -65,7 +65,7 @@ interface GraphSchema {
65
65
  }
66
66
  type Subgraphs = Record<string, GraphSchema>;
67
67
  type Metadata = Optional<{
68
- source?: "input" | "loop" | "update" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
68
+ source?: "input" | "loop" | "update" | (string & {});
69
69
  step?: number;
70
70
  writes?: Record<string, unknown> | null;
71
71
  parents?: Record<string, string>;
@@ -106,7 +106,6 @@ interface AssistantGraph {
106
106
  nodes: Array<{
107
107
  id: string | number;
108
108
  name?: string;
109
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
110
109
  data?: Record<string, any> | string;
111
110
  metadata?: unknown;
112
111
  }>;
@@ -133,7 +132,7 @@ interface Interrupt<TValue = unknown> {
133
132
  * Will be deprecated in the future.
134
133
  * @deprecated Will be removed in the future.
135
134
  */
136
- when?: "during" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types
135
+ when?: "during" | (string & {});
137
136
  /**
138
137
  * Whether the interrupt can be resumed.
139
138
  * @deprecated Will be removed in the future.
@@ -160,6 +159,10 @@ interface Thread<ValuesType = DefaultValues> {
160
159
  values: ValuesType;
161
160
  /** Interrupts which were thrown in this thread */
162
161
  interrupts: Record<string, Array<Interrupt>>;
162
+ /** The config for the thread */
163
+ config?: Config;
164
+ /** The error for the thread (if status == "error") */
165
+ error?: Optional<string | Record<string, unknown>>;
163
166
  }
164
167
  interface Cron {
165
168
  /** The ID of the cron */
@@ -242,7 +245,6 @@ interface ListNamespaceResponse {
242
245
  interface Item {
243
246
  namespace: string[];
244
247
  key: string;
245
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
246
248
  value: Record<string, any>;
247
249
  createdAt: string;
248
250
  updatedAt: string;
@@ -273,8 +275,6 @@ type AssistantSortBy = "assistant_id" | "graph_id" | "name" | "created_at" | "up
273
275
  type ThreadSortBy = "thread_id" | "status" | "created_at" | "updated_at";
274
276
  type CronSortBy = "cron_id" | "assistant_id" | "thread_id" | "created_at" | "updated_at" | "next_run_date";
275
277
  type SortOrder = "asc" | "desc";
276
- // Select field aliases for client-side typing of `select` parameters.
277
- // These mirror the server's allowed field sets.
278
278
  type AssistantSelectField = "assistant_id" | "graph_id" | "name" | "description" | "config" | "context" | "created_at" | "updated_at" | "metadata" | "version";
279
279
  type ThreadSelectField = "thread_id" | "created_at" | "updated_at" | "metadata" | "config" | "context" | "status" | "values" | "interrupts";
280
280
  type RunSelectField = "run_id" | "thread_id" | "assistant_id" | "created_at" | "updated_at" | "status" | "metadata" | "kwargs" | "multitask_strategy";
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.cts","names":["JSONSchema7","Optional","T","RunStatus","ThreadStatus","MultitaskStrategy","CancelAction","Config","GraphSchema","Subgraphs","Record","Metadata","AssistantBase","AssistantVersion","Assistant","AssistantsSearchResponse","AssistantGraph","Array","Interrupt","TValue","Thread","DefaultValues","ValuesType","Cron","ThreadValuesFilter","ThreadState","Checkpoint","ThreadTask","Run","ListNamespaceResponse","Item","SearchItem","SearchItemsResponse","CronCreateResponse","CronCreateForThreadResponse","Omit","AssistantSortBy","ThreadSortBy","CronSortBy","SortOrder","AssistantSelectField","ThreadSelectField","RunSelectField","CronSelectField"],"sources":["../src/schema.d.ts"],"sourcesContent":["import type { JSONSchema7 } from \"json-schema\";\ntype Optional<T> = T | null | undefined;\nexport type RunStatus = \"pending\" | \"running\" | \"error\" | \"success\" | \"timeout\" | \"interrupted\";\nexport type ThreadStatus = \"idle\" | \"busy\" | \"interrupted\" | \"error\";\ntype MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type CancelAction = \"interrupt\" | \"rollback\";\nexport type Config = {\n /**\n * Tags for this call and any sub-calls (eg. a Chain calling an LLM).\n * You can use these to filter calls.\n */\n tags?: string[];\n /**\n * Maximum number of times a call can recurse.\n * If not provided, defaults to 25.\n */\n recursion_limit?: number;\n /**\n * Runtime values for attributes previously made configurable on this Runnable.\n */\n configurable?: {\n /**\n * ID of the thread\n */\n thread_id?: Optional<string>;\n /**\n * Timestamp of the state checkpoint\n */\n checkpoint_id?: Optional<string>;\n [key: string]: unknown;\n };\n};\nexport interface GraphSchema {\n /**\n * The ID of the graph.\n */\n graph_id: string;\n /**\n * The schema for the input state.\n * Missing if unable to generate JSON schema from graph.\n */\n input_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the output state.\n * Missing if unable to generate JSON schema from graph.\n */\n output_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph state.\n * Missing if unable to generate JSON schema from graph.\n */\n state_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph config.\n * Missing if unable to generate JSON schema from graph.\n */\n config_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph context.\n * Missing if unable to generate JSON schema from graph.\n */\n context_schema?: JSONSchema7 | null | undefined;\n}\nexport type Subgraphs = Record<string, GraphSchema>;\nexport type Metadata = Optional<{\n source?: \"input\" | \"loop\" | \"update\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\n step?: number;\n writes?: Record<string, unknown> | null;\n parents?: Record<string, string>;\n [key: string]: unknown;\n}>;\nexport interface AssistantBase {\n /** The ID of the assistant. */\n assistant_id: string;\n /** The ID of the graph. */\n graph_id: string;\n /** The assistant config. */\n config: Config;\n /** The assistant context. */\n context: unknown;\n /** The time the assistant was created. */\n created_at: string;\n /** The assistant metadata. */\n metadata: Metadata;\n /** The version of the assistant. */\n version: number;\n /** The name of the assistant */\n name: string;\n /** The description of the assistant */\n description?: string;\n}\nexport interface AssistantVersion extends AssistantBase {\n}\nexport interface Assistant extends AssistantBase {\n /** The last time the assistant was updated. */\n updated_at: string;\n}\nexport interface AssistantsSearchResponse {\n /** The assistants returned for the current search page. */\n assistants: Assistant[];\n /** Pagination cursor from the X-Pagination-Next response header. */\n next: string | null;\n}\nexport interface AssistantGraph {\n nodes: Array<{\n id: string | number;\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>;\n edges: Array<{\n source: string;\n target: string;\n data?: string;\n conditional?: boolean;\n }>;\n}\n/**\n * An interrupt thrown inside a thread.\n */\nexport interface Interrupt<TValue = unknown> {\n /**\n * The ID of the interrupt.\n */\n id?: string;\n /**\n * The value of the interrupt.\n */\n value?: TValue;\n /**\n * Will be deprecated in the future.\n * @deprecated Will be removed in the future.\n */\n when?: \"during\" | (string & {}); // eslint-disable-line @typescript-eslint/ban-types\n /**\n * Whether the interrupt can be resumed.\n * @deprecated Will be removed in the future.\n */\n resumable?: boolean;\n /**\n * The namespace of the interrupt.\n * @deprecated Replaced by `interrupt_id`\n */\n ns?: string[];\n}\nexport interface Thread<ValuesType = DefaultValues> {\n /** The ID of the thread. */\n thread_id: string;\n /** The time the thread was created. */\n created_at: string;\n /** The last time the thread was updated. */\n updated_at: string;\n /** The thread metadata. */\n metadata: Metadata;\n /** The status of the thread */\n status: ThreadStatus;\n /** The current state of the thread. */\n values: ValuesType;\n /** Interrupts which were thrown in this thread */\n interrupts: Record<string, Array<Interrupt>>;\n}\nexport interface Cron {\n /** The ID of the cron */\n cron_id: string;\n /** The ID of the assistant */\n assistant_id: string;\n /** The ID of the thread */\n thread_id: Optional<string>;\n /** The end date to stop running the cron. */\n end_time: Optional<string>;\n /** The schedule to run, cron format. */\n schedule: string;\n /** The time the cron was created. */\n created_at: string;\n /** The last time the cron was updated. */\n updated_at: string;\n /** The run payload to use for creating new run. */\n payload: Record<string, unknown>;\n /** The user ID of the cron */\n user_id: Optional<string>;\n /** The next run date of the cron */\n next_run_date: Optional<string>;\n /** The metadata of the cron */\n metadata: Record<string, unknown>;\n}\nexport type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;\nexport type ThreadValuesFilter = Record<string, unknown>;\nexport interface ThreadState<ValuesType = DefaultValues> {\n /** The state values */\n values: ValuesType;\n /** The next nodes to execute. If empty, the thread is done until new input is received */\n next: string[];\n /** Checkpoint of the thread state */\n checkpoint: Checkpoint;\n /** Metadata for this state */\n metadata: Metadata;\n /** Time of state creation */\n created_at: Optional<string>;\n /** The parent checkpoint. If missing, this is the root checkpoint */\n parent_checkpoint: Optional<Checkpoint>;\n /** Tasks to execute in this step. If already attempted, may contain an error */\n tasks: Array<ThreadTask>;\n}\nexport interface ThreadTask {\n id: string;\n name: string;\n result?: unknown;\n error: Optional<string>;\n interrupts: Array<Interrupt>;\n checkpoint: Optional<Checkpoint>;\n state: Optional<ThreadState>;\n}\nexport interface Run {\n /** The ID of the run */\n run_id: string;\n /** The ID of the thread */\n thread_id: string;\n /** The assistant that wwas used for this run */\n assistant_id: string;\n /** The time the run was created */\n created_at: string;\n /** The last time the run was updated */\n updated_at: string;\n /** The status of the run. */\n status: RunStatus;\n /** Run metadata */\n metadata: Metadata;\n /** Strategy to handle concurrent runs on the same thread */\n multitask_strategy: Optional<MultitaskStrategy>;\n}\nexport type Checkpoint = {\n thread_id: string;\n checkpoint_ns: string;\n checkpoint_id: Optional<string>;\n checkpoint_map: Optional<Record<string, unknown>>;\n};\nexport interface ListNamespaceResponse {\n namespaces: string[][];\n}\nexport interface Item {\n namespace: string[];\n key: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value: Record<string, any>;\n createdAt: string;\n updatedAt: string;\n}\nexport interface SearchItem extends Item {\n score?: number;\n}\nexport interface SearchItemsResponse {\n items: SearchItem[];\n}\nexport interface CronCreateResponse {\n cron_id: string;\n assistant_id: string;\n thread_id: string | undefined;\n user_id: string;\n payload: Record<string, unknown>;\n schedule: string;\n next_run_date: string;\n end_time: string | undefined;\n created_at: string;\n updated_at: string;\n metadata: Metadata;\n}\nexport interface CronCreateForThreadResponse extends Omit<CronCreateResponse, \"thread_id\"> {\n thread_id: string;\n}\nexport type AssistantSortBy = \"assistant_id\" | \"graph_id\" | \"name\" | \"created_at\" | \"updated_at\";\nexport type ThreadSortBy = \"thread_id\" | \"status\" | \"created_at\" | \"updated_at\";\nexport type CronSortBy = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"created_at\" | \"updated_at\" | \"next_run_date\";\nexport type SortOrder = \"asc\" | \"desc\";\n// Select field aliases for client-side typing of `select` parameters.\n// These mirror the server's allowed field sets.\nexport type AssistantSelectField = \"assistant_id\" | \"graph_id\" | \"name\" | \"description\" | \"config\" | \"context\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"version\";\nexport type ThreadSelectField = \"thread_id\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"config\" | \"context\" | \"status\" | \"values\" | \"interrupts\";\nexport type RunSelectField = \"run_id\" | \"thread_id\" | \"assistant_id\" | \"created_at\" | \"updated_at\" | \"status\" | \"metadata\" | \"kwargs\" | \"multitask_strategy\";\nexport type CronSelectField = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"end_time\" | \"schedule\" | \"created_at\" | \"updated_at\" | \"user_id\" | \"payload\" | \"next_run_date\" | \"metadata\" | \"now\";\nexport {};\n"],"mappings":";;;KACKC,cAAcC;KACPC,SAAAA;AADPF,KAEOG,YAAAA,GAFOF,MAAAA,GAAAA,MAAAA,GAAAA,aAAAA,GAAAA,OAAAA;AACnB,KAEKG,iBAAAA,GAFgB,QAAA,GAAA,WAAA,GAAA,UAAA,GAAA,SAAA;AACTD,KAEAE,YAAAA,GAFY,WAAA,GAAA,UAAA;AACnBD,KAEOE,MAAAA,GAFPF;EACOC;AACZ;;;MAsBwBL,CAAAA,EAAAA,MAAAA,EAAAA;;AAIxB;;;iBAcoBD,CAAAA,EAAAA,MAAAA;;;;;IAiBRS;;;IAAYC,SAAAA,CAAAA,EAvCJT,QAuCIS,CAAAA,MAAAA,CAAAA;;AACxB;;IAGaA,aAAAA,CAAAA,EAvCWT,QAuCXS,CAAAA,MAAAA,CAAAA;IACCA,CAAAA,GAAAA,EAAAA,MAAAA,CAAAA,EAAAA,OAAAA;;;AAGGE,UAvCAJ,WAAAA,CAuCa;EAAA;;;;EAoBbK;AAEjB;AAIA;AAMA;EAA+B,YAAA,CAAA,EA9DZb,WA8DY,GAAA,IAAA,GAAA,SAAA;;;;;EAkBdkB,aAAS,CAAA,EA3ENlB,WAmFRmB,GAAAA,IAAAA,GAAAA,SAAAA;EAiBKC;;;;cAULhB,CAAAA,EAzGOJ,WAyGPI,GAAAA,IAAAA,GAAAA,SAAAA;;;;;kBApGQJ;EA0GHuB;;;;gBAgBJb,CAAAA,EArHQV,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AA,CAAAA,EAAAA,MAAAA;;EAEGuB,CAAAA,CAAAA;;;;;AAGLE,UArJKlB,SAqJU,CAAA,SAAA,OAAA,CAAA,CAAA;EACfmB;AACZ;AACA;EAGYG,EAAAA,CAAAA,EAAAA,MAAAA;EACAC;AACZ;AACA;UAtJYtB;;;;;;;;;;;;;;;;;UAiBKC,oBAAoBC;;;;;;;;YAQvBV;;UAEFP;;UAEAkB;;cAEIZ,eAAeO,MAAMC;;UAEpBK,IAAAA;;;;;;aAMFtB;;YAEDA;;;;;;;;WAQDS;;WAEAT;;iBAEMA;;YAELS;;KAEFW,aAAAA,GAAgBX,4BAA4BA;KAC5Cc,kBAAAA,GAAqBd;UAChBe,yBAAyBJ;;UAE9BC;;;;cAIII;;YAEFf;;cAEEV;;qBAEOA,SAASyB;;SAErBT,MAAMU;;UAEAA,UAAAA;;;;SAIN1B;cACKgB,MAAMC;cACNjB,SAASyB;SACdzB,SAASwB;;UAEHG,GAAAA;;;;;;;;;;;;UAYLzB;;YAEEQ;;sBAEUV,SAASI;;KAErBqB,UAAAA;;;iBAGOzB;kBACCA,SAASS;;UAEZmB,qBAAAA;;;UAGAC,IAAAA;;;;SAINpB;;;;UAIMqB,UAAAA,SAAmBD;;;UAGnBE,mBAAAA;SACND;;UAEME,kBAAAA;;;;;WAKJvB;;;;;;YAMCC;;UAEGuB,2BAAAA,SAAoCC,KAAKF;;;KAG9CG,eAAAA;KACAC,YAAAA;KACAC,UAAAA;KACAC,SAAAA;;;KAGAC,oBAAAA;KACAC,iBAAAA;KACAC,cAAAA;KACAC,eAAAA"}
1
+ {"version":3,"file":"schema.d.cts","names":["JSONSchema7","Optional","T","RunStatus","ThreadStatus","MultitaskStrategy","CancelAction","Config","GraphSchema","Subgraphs","Record","Metadata","AssistantBase","AssistantVersion","Assistant","AssistantsSearchResponse","AssistantGraph","Array","Interrupt","TValue","Thread","DefaultValues","ValuesType","Cron","ThreadValuesFilter","ThreadState","Checkpoint","ThreadTask","Run","ListNamespaceResponse","Item","SearchItem","SearchItemsResponse","CronCreateResponse","CronCreateForThreadResponse","Omit","AssistantSortBy","ThreadSortBy","CronSortBy","SortOrder","AssistantSelectField","ThreadSelectField","RunSelectField","CronSelectField"],"sources":["../src/schema.d.ts"],"sourcesContent":["import type { JSONSchema7 } from \"json-schema\";\ntype Optional<T> = T | null | undefined;\nexport type RunStatus = \"pending\" | \"running\" | \"error\" | \"success\" | \"timeout\" | \"interrupted\";\nexport type ThreadStatus = \"idle\" | \"busy\" | \"interrupted\" | \"error\";\ntype MultitaskStrategy = \"reject\" | \"interrupt\" | \"rollback\" | \"enqueue\";\nexport type CancelAction = \"interrupt\" | \"rollback\";\nexport type Config = {\n /**\n * Tags for this call and any sub-calls (eg. a Chain calling an LLM).\n * You can use these to filter calls.\n */\n tags?: string[];\n /**\n * Maximum number of times a call can recurse.\n * If not provided, defaults to 25.\n */\n recursion_limit?: number;\n /**\n * Runtime values for attributes previously made configurable on this Runnable.\n */\n configurable?: {\n /**\n * ID of the thread\n */\n thread_id?: Optional<string>;\n /**\n * Timestamp of the state checkpoint\n */\n checkpoint_id?: Optional<string>;\n [key: string]: unknown;\n };\n};\nexport interface GraphSchema {\n /**\n * The ID of the graph.\n */\n graph_id: string;\n /**\n * The schema for the input state.\n * Missing if unable to generate JSON schema from graph.\n */\n input_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the output state.\n * Missing if unable to generate JSON schema from graph.\n */\n output_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph state.\n * Missing if unable to generate JSON schema from graph.\n */\n state_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph config.\n * Missing if unable to generate JSON schema from graph.\n */\n config_schema?: JSONSchema7 | null | undefined;\n /**\n * The schema for the graph context.\n * Missing if unable to generate JSON schema from graph.\n */\n context_schema?: JSONSchema7 | null | undefined;\n}\nexport type Subgraphs = Record<string, GraphSchema>;\nexport type Metadata = Optional<{\n source?: \"input\" | \"loop\" | \"update\" | (string & {});\n step?: number;\n writes?: Record<string, unknown> | null;\n parents?: Record<string, string>;\n [key: string]: unknown;\n}>;\nexport interface AssistantBase {\n /** The ID of the assistant. */\n assistant_id: string;\n /** The ID of the graph. */\n graph_id: string;\n /** The assistant config. */\n config: Config;\n /** The assistant context. */\n context: unknown;\n /** The time the assistant was created. */\n created_at: string;\n /** The assistant metadata. */\n metadata: Metadata;\n /** The version of the assistant. */\n version: number;\n /** The name of the assistant */\n name: string;\n /** The description of the assistant */\n description?: string;\n}\nexport interface AssistantVersion extends AssistantBase {\n}\nexport interface Assistant extends AssistantBase {\n /** The last time the assistant was updated. */\n updated_at: string;\n}\nexport interface AssistantsSearchResponse {\n /** The assistants returned for the current search page. */\n assistants: Assistant[];\n /** Pagination cursor from the X-Pagination-Next response header. */\n next: string | null;\n}\nexport interface AssistantGraph {\n nodes: Array<{\n id: string | number;\n name?: string;\n data?: Record<string, any> | string;\n metadata?: unknown;\n }>;\n edges: Array<{\n source: string;\n target: string;\n data?: string;\n conditional?: boolean;\n }>;\n}\n/**\n * An interrupt thrown inside a thread.\n */\nexport interface Interrupt<TValue = unknown> {\n /**\n * The ID of the interrupt.\n */\n id?: string;\n /**\n * The value of the interrupt.\n */\n value?: TValue;\n /**\n * Will be deprecated in the future.\n * @deprecated Will be removed in the future.\n */\n when?: \"during\" | (string & {});\n /**\n * Whether the interrupt can be resumed.\n * @deprecated Will be removed in the future.\n */\n resumable?: boolean;\n /**\n * The namespace of the interrupt.\n * @deprecated Replaced by `interrupt_id`\n */\n ns?: string[];\n}\nexport interface Thread<ValuesType = DefaultValues> {\n /** The ID of the thread. */\n thread_id: string;\n /** The time the thread was created. */\n created_at: string;\n /** The last time the thread was updated. */\n updated_at: string;\n /** The thread metadata. */\n metadata: Metadata;\n /** The status of the thread */\n status: ThreadStatus;\n /** The current state of the thread. */\n values: ValuesType;\n /** Interrupts which were thrown in this thread */\n interrupts: Record<string, Array<Interrupt>>;\n /** The config for the thread */\n config?: Config;\n /** The error for the thread (if status == \"error\") */\n error?: Optional<string | Record<string, unknown>>;\n}\nexport interface Cron {\n /** The ID of the cron */\n cron_id: string;\n /** The ID of the assistant */\n assistant_id: string;\n /** The ID of the thread */\n thread_id: Optional<string>;\n /** The end date to stop running the cron. */\n end_time: Optional<string>;\n /** The schedule to run, cron format. */\n schedule: string;\n /** The time the cron was created. */\n created_at: string;\n /** The last time the cron was updated. */\n updated_at: string;\n /** The run payload to use for creating new run. */\n payload: Record<string, unknown>;\n /** The user ID of the cron */\n user_id: Optional<string>;\n /** The next run date of the cron */\n next_run_date: Optional<string>;\n /** The metadata of the cron */\n metadata: Record<string, unknown>;\n}\nexport type DefaultValues = Record<string, unknown>[] | Record<string, unknown>;\nexport type ThreadValuesFilter = Record<string, unknown>;\nexport interface ThreadState<ValuesType = DefaultValues> {\n /** The state values */\n values: ValuesType;\n /** The next nodes to execute. If empty, the thread is done until new input is received */\n next: string[];\n /** Checkpoint of the thread state */\n checkpoint: Checkpoint;\n /** Metadata for this state */\n metadata: Metadata;\n /** Time of state creation */\n created_at: Optional<string>;\n /** The parent checkpoint. If missing, this is the root checkpoint */\n parent_checkpoint: Optional<Checkpoint>;\n /** Tasks to execute in this step. If already attempted, may contain an error */\n tasks: Array<ThreadTask>;\n}\nexport interface ThreadTask {\n id: string;\n name: string;\n result?: unknown;\n error: Optional<string>;\n interrupts: Array<Interrupt>;\n checkpoint: Optional<Checkpoint>;\n state: Optional<ThreadState>;\n}\nexport interface Run {\n /** The ID of the run */\n run_id: string;\n /** The ID of the thread */\n thread_id: string;\n /** The assistant that wwas used for this run */\n assistant_id: string;\n /** The time the run was created */\n created_at: string;\n /** The last time the run was updated */\n updated_at: string;\n /** The status of the run. */\n status: RunStatus;\n /** Run metadata */\n metadata: Metadata;\n /** Strategy to handle concurrent runs on the same thread */\n multitask_strategy: Optional<MultitaskStrategy>;\n}\nexport type Checkpoint = {\n thread_id: string;\n checkpoint_ns: string;\n checkpoint_id: Optional<string>;\n checkpoint_map: Optional<Record<string, unknown>>;\n};\nexport interface ListNamespaceResponse {\n namespaces: string[][];\n}\nexport interface Item {\n namespace: string[];\n key: string;\n value: Record<string, any>;\n createdAt: string;\n updatedAt: string;\n}\nexport interface SearchItem extends Item {\n score?: number;\n}\nexport interface SearchItemsResponse {\n items: SearchItem[];\n}\nexport interface CronCreateResponse {\n cron_id: string;\n assistant_id: string;\n thread_id: string | undefined;\n user_id: string;\n payload: Record<string, unknown>;\n schedule: string;\n next_run_date: string;\n end_time: string | undefined;\n created_at: string;\n updated_at: string;\n metadata: Metadata;\n}\nexport interface CronCreateForThreadResponse extends Omit<CronCreateResponse, \"thread_id\"> {\n thread_id: string;\n}\nexport type AssistantSortBy = \"assistant_id\" | \"graph_id\" | \"name\" | \"created_at\" | \"updated_at\";\nexport type ThreadSortBy = \"thread_id\" | \"status\" | \"created_at\" | \"updated_at\";\nexport type CronSortBy = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"created_at\" | \"updated_at\" | \"next_run_date\";\nexport type SortOrder = \"asc\" | \"desc\";\nexport type AssistantSelectField = \"assistant_id\" | \"graph_id\" | \"name\" | \"description\" | \"config\" | \"context\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"version\";\nexport type ThreadSelectField = \"thread_id\" | \"created_at\" | \"updated_at\" | \"metadata\" | \"config\" | \"context\" | \"status\" | \"values\" | \"interrupts\";\nexport type RunSelectField = \"run_id\" | \"thread_id\" | \"assistant_id\" | \"created_at\" | \"updated_at\" | \"status\" | \"metadata\" | \"kwargs\" | \"multitask_strategy\";\nexport type CronSelectField = \"cron_id\" | \"assistant_id\" | \"thread_id\" | \"end_time\" | \"schedule\" | \"created_at\" | \"updated_at\" | \"user_id\" | \"payload\" | \"next_run_date\" | \"metadata\" | \"now\";\nexport {};\n"],"mappings":";;;KACKC,cAAcC;KACPC,SAAAA;AADPF,KAEOG,YAAAA,GAFOF,MAAC,GAAA,MAAA,GAAA,aAAA,GAAA,OAAA;AACpB,KAEKG,iBAAAA,GAFgB,QAAA,GAAA,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