@langchain/langgraph-sdk 1.8.9 → 1.9.0

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 (444) hide show
  1. package/README.md +90 -43
  2. package/dist/client/assistants/index.cjs +180 -0
  3. package/dist/client/assistants/index.cjs.map +1 -0
  4. package/dist/client/assistants/index.d.cts +155 -0
  5. package/dist/client/assistants/index.d.cts.map +1 -0
  6. package/dist/client/assistants/index.d.ts +155 -0
  7. package/dist/client/assistants/index.d.ts.map +1 -0
  8. package/dist/client/assistants/index.js +180 -0
  9. package/dist/client/assistants/index.js.map +1 -0
  10. package/dist/client/base.cjs +190 -0
  11. package/dist/client/base.cjs.map +1 -0
  12. package/dist/client/base.d.cts +84 -0
  13. package/dist/client/base.d.cts.map +1 -0
  14. package/dist/client/base.d.ts +84 -0
  15. package/dist/client/base.d.ts.map +1 -0
  16. package/dist/client/base.js +188 -0
  17. package/dist/client/base.js.map +1 -0
  18. package/dist/client/crons/index.cjs +159 -0
  19. package/dist/client/crons/index.cjs.map +1 -0
  20. package/dist/client/crons/index.d.cts +71 -0
  21. package/dist/client/crons/index.d.cts.map +1 -0
  22. package/dist/client/crons/index.d.ts +71 -0
  23. package/dist/client/crons/index.d.ts.map +1 -0
  24. package/dist/client/crons/index.js +159 -0
  25. package/dist/client/crons/index.js.map +1 -0
  26. package/dist/client/index.cjs +84 -0
  27. package/dist/client/index.cjs.map +1 -0
  28. package/dist/client/index.d.cts +63 -0
  29. package/dist/client/index.d.cts.map +1 -0
  30. package/dist/client/index.d.ts +63 -0
  31. package/dist/client/index.d.ts.map +1 -0
  32. package/dist/client/index.js +83 -0
  33. package/dist/client/index.js.map +1 -0
  34. package/dist/client/runs/index.cjs +275 -0
  35. package/dist/client/runs/index.cjs.map +1 -0
  36. package/dist/client/runs/index.d.cts +123 -0
  37. package/dist/client/runs/index.d.cts.map +1 -0
  38. package/dist/client/runs/index.d.ts +123 -0
  39. package/dist/client/runs/index.d.ts.map +1 -0
  40. package/dist/client/runs/index.js +275 -0
  41. package/dist/client/runs/index.js.map +1 -0
  42. package/dist/client/store/index.cjs +128 -0
  43. package/dist/client/store/index.cjs.map +1 -0
  44. package/dist/client/store/index.d.cts +75 -0
  45. package/dist/client/store/index.d.cts.map +1 -0
  46. package/dist/client/store/index.d.ts +75 -0
  47. package/dist/client/store/index.d.ts.map +1 -0
  48. package/dist/client/store/index.js +128 -0
  49. package/dist/client/store/index.js.map +1 -0
  50. package/dist/client/stream/error.cjs +18 -0
  51. package/dist/client/stream/error.cjs.map +1 -0
  52. package/dist/client/stream/error.d.cts +14 -0
  53. package/dist/client/stream/error.d.cts.map +1 -0
  54. package/dist/client/stream/error.d.ts +14 -0
  55. package/dist/client/stream/error.d.ts.map +1 -0
  56. package/dist/client/stream/error.js +18 -0
  57. package/dist/client/stream/error.js.map +1 -0
  58. package/dist/client/stream/handles/index.cjs +3 -0
  59. package/dist/client/stream/handles/index.d.ts +3 -0
  60. package/dist/client/stream/handles/index.js +4 -0
  61. package/dist/client/stream/handles/subagents.cjs +263 -0
  62. package/dist/client/stream/handles/subagents.cjs.map +1 -0
  63. package/dist/client/stream/handles/subagents.d.cts +45 -0
  64. package/dist/client/stream/handles/subagents.d.cts.map +1 -0
  65. package/dist/client/stream/handles/subagents.d.ts +45 -0
  66. package/dist/client/stream/handles/subagents.d.ts.map +1 -0
  67. package/dist/client/stream/handles/subagents.js +262 -0
  68. package/dist/client/stream/handles/subagents.js.map +1 -0
  69. package/dist/client/stream/handles/subgraphs.cjs +352 -0
  70. package/dist/client/stream/handles/subgraphs.cjs.map +1 -0
  71. package/dist/client/stream/handles/subgraphs.d.cts +82 -0
  72. package/dist/client/stream/handles/subgraphs.d.cts.map +1 -0
  73. package/dist/client/stream/handles/subgraphs.d.ts +82 -0
  74. package/dist/client/stream/handles/subgraphs.d.ts.map +1 -0
  75. package/dist/client/stream/handles/subgraphs.js +351 -0
  76. package/dist/client/stream/handles/subgraphs.js.map +1 -0
  77. package/dist/client/stream/handles/tools.cjs +92 -0
  78. package/dist/client/stream/handles/tools.cjs.map +1 -0
  79. package/dist/client/stream/handles/tools.d.cts +26 -0
  80. package/dist/client/stream/handles/tools.d.cts.map +1 -0
  81. package/dist/client/stream/handles/tools.d.ts +26 -0
  82. package/dist/client/stream/handles/tools.d.ts.map +1 -0
  83. package/dist/client/stream/handles/tools.js +92 -0
  84. package/dist/client/stream/handles/tools.js.map +1 -0
  85. package/dist/client/stream/index.cjs +1368 -0
  86. package/dist/client/stream/index.cjs.map +1 -0
  87. package/dist/client/stream/index.d.cts +238 -0
  88. package/dist/client/stream/index.d.cts.map +1 -0
  89. package/dist/client/stream/index.d.ts +238 -0
  90. package/dist/client/stream/index.d.ts.map +1 -0
  91. package/dist/client/stream/index.js +1367 -0
  92. package/dist/client/stream/index.js.map +1 -0
  93. package/dist/client/stream/media.cjs +506 -0
  94. package/dist/client/stream/media.cjs.map +1 -0
  95. package/dist/client/stream/media.d.cts +164 -0
  96. package/dist/client/stream/media.d.cts.map +1 -0
  97. package/dist/client/stream/media.d.ts +164 -0
  98. package/dist/client/stream/media.d.ts.map +1 -0
  99. package/dist/client/stream/media.js +505 -0
  100. package/dist/client/stream/media.js.map +1 -0
  101. package/dist/client/stream/messages.cjs +635 -0
  102. package/dist/client/stream/messages.cjs.map +1 -0
  103. package/dist/client/stream/messages.d.cts +139 -0
  104. package/dist/client/stream/messages.d.cts.map +1 -0
  105. package/dist/client/stream/messages.d.ts +139 -0
  106. package/dist/client/stream/messages.d.ts.map +1 -0
  107. package/dist/client/stream/messages.js +631 -0
  108. package/dist/client/stream/messages.js.map +1 -0
  109. package/dist/client/stream/multi-cursor-buffer.cjs +55 -0
  110. package/dist/client/stream/multi-cursor-buffer.cjs.map +1 -0
  111. package/dist/client/stream/multi-cursor-buffer.js +55 -0
  112. package/dist/client/stream/multi-cursor-buffer.js.map +1 -0
  113. package/dist/client/stream/subscription.cjs +85 -0
  114. package/dist/client/stream/subscription.cjs.map +1 -0
  115. package/dist/client/stream/subscription.d.cts +22 -0
  116. package/dist/client/stream/subscription.d.cts.map +1 -0
  117. package/dist/client/stream/subscription.d.ts +22 -0
  118. package/dist/client/stream/subscription.d.ts.map +1 -0
  119. package/dist/client/stream/subscription.js +84 -0
  120. package/dist/client/stream/subscription.js.map +1 -0
  121. package/dist/client/stream/transport/agent-server.cjs +45 -0
  122. package/dist/client/stream/transport/agent-server.cjs.map +1 -0
  123. package/dist/client/stream/transport/agent-server.d.cts +39 -0
  124. package/dist/client/stream/transport/agent-server.d.cts.map +1 -0
  125. package/dist/client/stream/transport/agent-server.d.ts +39 -0
  126. package/dist/client/stream/transport/agent-server.d.ts.map +1 -0
  127. package/dist/client/stream/transport/agent-server.js +45 -0
  128. package/dist/client/stream/transport/agent-server.js.map +1 -0
  129. package/dist/client/stream/transport/constants.cjs +10 -0
  130. package/dist/client/stream/transport/constants.cjs.map +1 -0
  131. package/dist/client/stream/transport/constants.js +10 -0
  132. package/dist/client/stream/transport/constants.js.map +1 -0
  133. package/dist/client/stream/transport/decoder.cjs +115 -0
  134. package/dist/client/stream/transport/decoder.cjs.map +1 -0
  135. package/dist/client/stream/transport/decoder.js +114 -0
  136. package/dist/client/stream/transport/decoder.js.map +1 -0
  137. package/dist/client/stream/transport/http.cjs +183 -0
  138. package/dist/client/stream/transport/http.cjs.map +1 -0
  139. package/dist/client/stream/transport/http.d.cts +45 -0
  140. package/dist/client/stream/transport/http.d.cts.map +1 -0
  141. package/dist/client/stream/transport/http.d.ts +45 -0
  142. package/dist/client/stream/transport/http.d.ts.map +1 -0
  143. package/dist/client/stream/transport/http.js +183 -0
  144. package/dist/client/stream/transport/http.js.map +1 -0
  145. package/dist/client/stream/transport/index.cjs +3 -0
  146. package/dist/client/stream/transport/index.js +4 -0
  147. package/dist/client/stream/transport/queue.cjs +55 -0
  148. package/dist/client/stream/transport/queue.cjs.map +1 -0
  149. package/dist/client/stream/transport/queue.js +55 -0
  150. package/dist/client/stream/transport/queue.js.map +1 -0
  151. package/dist/client/stream/transport/stream.cjs +79 -0
  152. package/dist/client/stream/transport/stream.cjs.map +1 -0
  153. package/dist/client/stream/transport/stream.js +79 -0
  154. package/dist/client/stream/transport/stream.js.map +1 -0
  155. package/dist/client/stream/transport/types.d.cts +29 -0
  156. package/dist/client/stream/transport/types.d.cts.map +1 -0
  157. package/dist/client/stream/transport/types.d.ts +29 -0
  158. package/dist/client/stream/transport/types.d.ts.map +1 -0
  159. package/dist/client/stream/transport/utils.cjs +45 -0
  160. package/dist/client/stream/transport/utils.cjs.map +1 -0
  161. package/dist/client/stream/transport/utils.js +39 -0
  162. package/dist/client/stream/transport/utils.js.map +1 -0
  163. package/dist/client/stream/transport/websocket.cjs +155 -0
  164. package/dist/client/stream/transport/websocket.cjs.map +1 -0
  165. package/dist/client/stream/transport/websocket.d.cts +36 -0
  166. package/dist/client/stream/transport/websocket.d.cts.map +1 -0
  167. package/dist/client/stream/transport/websocket.d.ts +36 -0
  168. package/dist/client/stream/transport/websocket.d.ts.map +1 -0
  169. package/dist/client/stream/transport/websocket.js +155 -0
  170. package/dist/client/stream/transport/websocket.js.map +1 -0
  171. package/dist/client/stream/transport.d.cts +104 -0
  172. package/dist/client/stream/transport.d.cts.map +1 -0
  173. package/dist/client/stream/transport.d.ts +104 -0
  174. package/dist/client/stream/transport.d.ts.map +1 -0
  175. package/dist/client/stream/types.d.cts +208 -0
  176. package/dist/client/stream/types.d.cts.map +1 -0
  177. package/dist/client/stream/types.d.ts +208 -0
  178. package/dist/client/stream/types.d.ts.map +1 -0
  179. package/dist/client/threads/index.cjs +271 -0
  180. package/dist/client/threads/index.cjs.map +1 -0
  181. package/dist/client/threads/index.d.cts +235 -0
  182. package/dist/client/threads/index.d.cts.map +1 -0
  183. package/dist/client/threads/index.d.ts +235 -0
  184. package/dist/client/threads/index.d.ts.map +1 -0
  185. package/dist/client/threads/index.js +270 -0
  186. package/dist/client/threads/index.js.map +1 -0
  187. package/dist/client/ui-internal/index.cjs +29 -0
  188. package/dist/client/ui-internal/index.cjs.map +1 -0
  189. package/dist/client/ui-internal/index.d.cts +11 -0
  190. package/dist/client/ui-internal/index.d.cts.map +1 -0
  191. package/dist/client/ui-internal/index.d.ts +11 -0
  192. package/dist/client/ui-internal/index.d.ts.map +1 -0
  193. package/dist/client/ui-internal/index.js +29 -0
  194. package/dist/client/ui-internal/index.js.map +1 -0
  195. package/dist/client.cjs +35 -1308
  196. package/dist/client.d.cts +19 -857
  197. package/dist/client.d.ts +19 -857
  198. package/dist/client.js +16 -1301
  199. package/dist/index.cjs +25 -4
  200. package/dist/index.d.cts +15 -3
  201. package/dist/index.d.ts +15 -3
  202. package/dist/index.js +14 -3
  203. package/dist/react/stream.cjs.map +1 -1
  204. package/dist/react/stream.custom.cjs +1 -1
  205. package/dist/react/stream.custom.js +1 -1
  206. package/dist/react/stream.d.cts +2 -1
  207. package/dist/react/stream.d.cts.map +1 -1
  208. package/dist/react/stream.d.ts +2 -1
  209. package/dist/react/stream.d.ts.map +1 -1
  210. package/dist/react/stream.js.map +1 -1
  211. package/dist/react/stream.lgp.cjs +8 -6
  212. package/dist/react/stream.lgp.cjs.map +1 -1
  213. package/dist/react/stream.lgp.js +6 -4
  214. package/dist/react/stream.lgp.js.map +1 -1
  215. package/dist/react/types.d.cts +1 -1
  216. package/dist/react/types.d.ts +1 -1
  217. package/dist/react/types.d.ts.map +1 -1
  218. package/dist/react-ui/server/server.cjs +1 -1
  219. package/dist/react-ui/server/server.cjs.map +1 -1
  220. package/dist/react-ui/server/server.js +1 -1
  221. package/dist/react-ui/server/server.js.map +1 -1
  222. package/dist/react-ui/types.cjs.map +1 -1
  223. package/dist/react-ui/types.d.cts +1 -1
  224. package/dist/react-ui/types.d.cts.map +1 -1
  225. package/dist/react-ui/types.d.ts +1 -1
  226. package/dist/react-ui/types.d.ts.map +1 -1
  227. package/dist/react-ui/types.js.map +1 -1
  228. package/dist/stream/assembled-to-message.cjs +121 -0
  229. package/dist/stream/assembled-to-message.cjs.map +1 -0
  230. package/dist/stream/assembled-to-message.d.cts +35 -0
  231. package/dist/stream/assembled-to-message.d.cts.map +1 -0
  232. package/dist/stream/assembled-to-message.d.ts +35 -0
  233. package/dist/stream/assembled-to-message.d.ts.map +1 -0
  234. package/dist/stream/assembled-to-message.js +119 -0
  235. package/dist/stream/assembled-to-message.js.map +1 -0
  236. package/dist/stream/channel-registry.cjs +224 -0
  237. package/dist/stream/channel-registry.cjs.map +1 -0
  238. package/dist/stream/channel-registry.d.cts +102 -0
  239. package/dist/stream/channel-registry.d.cts.map +1 -0
  240. package/dist/stream/channel-registry.d.ts +102 -0
  241. package/dist/stream/channel-registry.d.ts.map +1 -0
  242. package/dist/stream/channel-registry.js +224 -0
  243. package/dist/stream/channel-registry.js.map +1 -0
  244. package/dist/stream/constants.cjs +11 -0
  245. package/dist/stream/constants.cjs.map +1 -0
  246. package/dist/stream/constants.d.cts +10 -0
  247. package/dist/stream/constants.d.cts.map +1 -0
  248. package/dist/stream/constants.d.ts +10 -0
  249. package/dist/stream/constants.d.ts.map +1 -0
  250. package/dist/stream/constants.js +11 -0
  251. package/dist/stream/constants.js.map +1 -0
  252. package/dist/stream/controller.cjs +933 -0
  253. package/dist/stream/controller.cjs.map +1 -0
  254. package/dist/stream/controller.d.cts +135 -0
  255. package/dist/stream/controller.d.cts.map +1 -0
  256. package/dist/stream/controller.d.ts +135 -0
  257. package/dist/stream/controller.d.ts.map +1 -0
  258. package/dist/stream/controller.js +910 -0
  259. package/dist/stream/controller.js.map +1 -0
  260. package/dist/stream/discovery/index.d.ts +2 -0
  261. package/dist/stream/discovery/subagents.cjs +235 -0
  262. package/dist/stream/discovery/subagents.cjs.map +1 -0
  263. package/dist/stream/discovery/subagents.d.cts +18 -0
  264. package/dist/stream/discovery/subagents.d.cts.map +1 -0
  265. package/dist/stream/discovery/subagents.d.ts +18 -0
  266. package/dist/stream/discovery/subagents.d.ts.map +1 -0
  267. package/dist/stream/discovery/subagents.js +235 -0
  268. package/dist/stream/discovery/subagents.js.map +1 -0
  269. package/dist/stream/discovery/subgraphs.cjs +153 -0
  270. package/dist/stream/discovery/subgraphs.cjs.map +1 -0
  271. package/dist/stream/discovery/subgraphs.d.cts +19 -0
  272. package/dist/stream/discovery/subgraphs.d.cts.map +1 -0
  273. package/dist/stream/discovery/subgraphs.d.ts +19 -0
  274. package/dist/stream/discovery/subgraphs.d.ts.map +1 -0
  275. package/dist/stream/discovery/subgraphs.js +153 -0
  276. package/dist/stream/discovery/subgraphs.js.map +1 -0
  277. package/dist/stream/index.cjs +36 -0
  278. package/dist/stream/index.d.cts +25 -0
  279. package/dist/stream/index.d.ts +25 -0
  280. package/dist/stream/index.js +16 -0
  281. package/dist/stream/lifecycle-loading-tracker.cjs +83 -0
  282. package/dist/stream/lifecycle-loading-tracker.cjs.map +1 -0
  283. package/dist/stream/lifecycle-loading-tracker.js +83 -0
  284. package/dist/stream/lifecycle-loading-tracker.js.map +1 -0
  285. package/dist/stream/message-metadata-tracker.cjs +165 -0
  286. package/dist/stream/message-metadata-tracker.cjs.map +1 -0
  287. package/dist/stream/message-metadata-tracker.d.cts +24 -0
  288. package/dist/stream/message-metadata-tracker.d.cts.map +1 -0
  289. package/dist/stream/message-metadata-tracker.d.ts +24 -0
  290. package/dist/stream/message-metadata-tracker.d.ts.map +1 -0
  291. package/dist/stream/message-metadata-tracker.js +165 -0
  292. package/dist/stream/message-metadata-tracker.js.map +1 -0
  293. package/dist/stream/message-reconciliation.cjs +118 -0
  294. package/dist/stream/message-reconciliation.cjs.map +1 -0
  295. package/dist/stream/message-reconciliation.js +115 -0
  296. package/dist/stream/message-reconciliation.js.map +1 -0
  297. package/dist/stream/namespace.cjs +54 -0
  298. package/dist/stream/namespace.cjs.map +1 -0
  299. package/dist/stream/namespace.js +49 -0
  300. package/dist/stream/namespace.js.map +1 -0
  301. package/dist/stream/projections/channel.cjs +53 -0
  302. package/dist/stream/projections/channel.cjs.map +1 -0
  303. package/dist/stream/projections/channel.d.cts +22 -0
  304. package/dist/stream/projections/channel.d.cts.map +1 -0
  305. package/dist/stream/projections/channel.d.ts +22 -0
  306. package/dist/stream/projections/channel.d.ts.map +1 -0
  307. package/dist/stream/projections/channel.js +53 -0
  308. package/dist/stream/projections/channel.js.map +1 -0
  309. package/dist/stream/projections/extension.cjs +29 -0
  310. package/dist/stream/projections/extension.cjs.map +1 -0
  311. package/dist/stream/projections/extension.d.cts +7 -0
  312. package/dist/stream/projections/extension.d.cts.map +1 -0
  313. package/dist/stream/projections/extension.d.ts +7 -0
  314. package/dist/stream/projections/extension.d.ts.map +1 -0
  315. package/dist/stream/projections/extension.js +29 -0
  316. package/dist/stream/projections/extension.js.map +1 -0
  317. package/dist/stream/projections/index.cjs +6 -0
  318. package/dist/stream/projections/index.d.ts +6 -0
  319. package/dist/stream/projections/index.js +7 -0
  320. package/dist/stream/projections/media.cjs +81 -0
  321. package/dist/stream/projections/media.cjs.map +1 -0
  322. package/dist/stream/projections/media.d.cts +18 -0
  323. package/dist/stream/projections/media.d.cts.map +1 -0
  324. package/dist/stream/projections/media.d.ts +18 -0
  325. package/dist/stream/projections/media.d.ts.map +1 -0
  326. package/dist/stream/projections/media.js +78 -0
  327. package/dist/stream/projections/media.js.map +1 -0
  328. package/dist/stream/projections/messages.cjs +121 -0
  329. package/dist/stream/projections/messages.cjs.map +1 -0
  330. package/dist/stream/projections/messages.d.cts +8 -0
  331. package/dist/stream/projections/messages.d.cts.map +1 -0
  332. package/dist/stream/projections/messages.d.ts +8 -0
  333. package/dist/stream/projections/messages.d.ts.map +1 -0
  334. package/dist/stream/projections/messages.js +121 -0
  335. package/dist/stream/projections/messages.js.map +1 -0
  336. package/dist/stream/projections/runtime.cjs +44 -0
  337. package/dist/stream/projections/runtime.cjs.map +1 -0
  338. package/dist/stream/projections/runtime.js +44 -0
  339. package/dist/stream/projections/runtime.js.map +1 -0
  340. package/dist/stream/projections/tool-calls.cjs +50 -0
  341. package/dist/stream/projections/tool-calls.cjs.map +1 -0
  342. package/dist/stream/projections/tool-calls.d.cts +8 -0
  343. package/dist/stream/projections/tool-calls.d.cts.map +1 -0
  344. package/dist/stream/projections/tool-calls.d.ts +8 -0
  345. package/dist/stream/projections/tool-calls.d.ts.map +1 -0
  346. package/dist/stream/projections/tool-calls.js +50 -0
  347. package/dist/stream/projections/tool-calls.js.map +1 -0
  348. package/dist/stream/projections/values.cjs +52 -0
  349. package/dist/stream/projections/values.cjs.map +1 -0
  350. package/dist/stream/projections/values.d.cts +7 -0
  351. package/dist/stream/projections/values.d.cts.map +1 -0
  352. package/dist/stream/projections/values.d.ts +6 -0
  353. package/dist/stream/projections/values.d.ts.map +1 -0
  354. package/dist/stream/projections/values.js +52 -0
  355. package/dist/stream/projections/values.js.map +1 -0
  356. package/dist/stream/root-message-projection.cjs +256 -0
  357. package/dist/stream/root-message-projection.cjs.map +1 -0
  358. package/dist/stream/root-message-projection.js +256 -0
  359. package/dist/stream/root-message-projection.js.map +1 -0
  360. package/dist/stream/store.cjs +32 -0
  361. package/dist/stream/store.cjs.map +1 -0
  362. package/dist/stream/store.d.cts +37 -0
  363. package/dist/stream/store.d.cts.map +1 -0
  364. package/dist/stream/store.d.ts +37 -0
  365. package/dist/stream/store.d.ts.map +1 -0
  366. package/dist/stream/store.js +32 -0
  367. package/dist/stream/store.js.map +1 -0
  368. package/dist/stream/submit-coordinator.cjs +399 -0
  369. package/dist/stream/submit-coordinator.cjs.map +1 -0
  370. package/dist/stream/submit-coordinator.d.cts +27 -0
  371. package/dist/stream/submit-coordinator.d.cts.map +1 -0
  372. package/dist/stream/submit-coordinator.d.ts +27 -0
  373. package/dist/stream/submit-coordinator.d.ts.map +1 -0
  374. package/dist/stream/submit-coordinator.js +397 -0
  375. package/dist/stream/submit-coordinator.js.map +1 -0
  376. package/dist/stream/tool-calls.cjs +15 -0
  377. package/dist/stream/tool-calls.cjs.map +1 -0
  378. package/dist/stream/tool-calls.js +15 -0
  379. package/dist/stream/tool-calls.js.map +1 -0
  380. package/dist/stream/types-inference.d.cts +43 -0
  381. package/dist/stream/types-inference.d.cts.map +1 -0
  382. package/dist/stream/types-inference.d.ts +43 -0
  383. package/dist/stream/types-inference.d.ts.map +1 -0
  384. package/dist/stream/types.d.cts +354 -0
  385. package/dist/stream/types.d.cts.map +1 -0
  386. package/dist/stream/types.d.ts +354 -0
  387. package/dist/stream/types.d.ts.map +1 -0
  388. package/dist/types.d.cts +2 -1
  389. package/dist/types.d.cts.map +1 -1
  390. package/dist/types.d.ts +2 -1
  391. package/dist/types.d.ts.map +1 -1
  392. package/dist/ui/index.cjs +1 -1
  393. package/dist/ui/index.d.cts +3 -3
  394. package/dist/ui/index.d.ts +3 -3
  395. package/dist/ui/index.js +1 -1
  396. package/dist/ui/manager.cjs +2 -2
  397. package/dist/ui/manager.cjs.map +1 -1
  398. package/dist/ui/manager.d.cts +1 -0
  399. package/dist/ui/manager.d.cts.map +1 -1
  400. package/dist/ui/manager.d.ts +1 -0
  401. package/dist/ui/manager.d.ts.map +1 -1
  402. package/dist/ui/manager.js +2 -2
  403. package/dist/ui/manager.js.map +1 -1
  404. package/dist/ui/messages.cjs +50 -7
  405. package/dist/ui/messages.cjs.map +1 -1
  406. package/dist/ui/messages.d.cts.map +1 -1
  407. package/dist/ui/messages.d.ts.map +1 -1
  408. package/dist/ui/messages.js +51 -9
  409. package/dist/ui/messages.js.map +1 -1
  410. package/dist/ui/orchestrator-custom.cjs +1 -1
  411. package/dist/ui/orchestrator-custom.js +1 -1
  412. package/dist/ui/orchestrator.cjs +4 -3
  413. package/dist/ui/orchestrator.cjs.map +1 -1
  414. package/dist/ui/orchestrator.d.cts +1 -1
  415. package/dist/ui/orchestrator.d.cts.map +1 -1
  416. package/dist/ui/orchestrator.d.ts +1 -1
  417. package/dist/ui/orchestrator.d.ts.map +1 -1
  418. package/dist/ui/orchestrator.js +4 -3
  419. package/dist/ui/orchestrator.js.map +1 -1
  420. package/dist/ui/stream/agent.d.cts +1 -1
  421. package/dist/ui/stream/agent.d.cts.map +1 -1
  422. package/dist/ui/stream/agent.d.ts +1 -1
  423. package/dist/ui/stream/agent.d.ts.map +1 -1
  424. package/dist/ui/stream/base.d.cts +7 -6
  425. package/dist/ui/stream/base.d.cts.map +1 -1
  426. package/dist/ui/stream/base.d.ts +7 -6
  427. package/dist/ui/stream/base.d.ts.map +1 -1
  428. package/dist/ui/stream/deep-agent.d.cts +1 -1
  429. package/dist/ui/stream/deep-agent.d.cts.map +1 -1
  430. package/dist/ui/stream/deep-agent.d.ts +1 -1
  431. package/dist/ui/stream/deep-agent.d.ts.map +1 -1
  432. package/dist/ui/stream/index.d.cts +4 -4
  433. package/dist/ui/stream/index.d.cts.map +1 -1
  434. package/dist/ui/stream/index.d.ts +4 -4
  435. package/dist/ui/stream/index.d.ts.map +1 -1
  436. package/dist/ui/types.d.cts +3 -2
  437. package/dist/ui/types.d.cts.map +1 -1
  438. package/dist/ui/types.d.ts +2 -1
  439. package/dist/ui/types.d.ts.map +1 -1
  440. package/package.json +18 -8
  441. package/dist/client.cjs.map +0 -1
  442. package/dist/client.d.cts.map +0 -1
  443. package/dist/client.d.ts.map +0 -1
  444. package/dist/client.js.map +0 -1
package/dist/client.d.ts CHANGED
@@ -1,857 +1,19 @@
1
- import { Assistant, AssistantGraph, AssistantSelectField, AssistantSortBy, AssistantVersion, AssistantsSearchResponse, CancelAction, Checkpoint, Config, Cron, CronCreateForThreadResponse, CronCreateResponse, CronSelectField, CronSortBy, DefaultValues, GraphSchema, Item, ListNamespaceResponse, Metadata, Run, RunSelectField, RunStatus, SearchItemsResponse, SortOrder, Subgraphs, Thread, ThreadSelectField, ThreadSortBy, ThreadState, ThreadStatus, ThreadValuesFilter } from "./schema.js";
2
- import { StreamMode, ThreadStreamMode, TypedAsyncGenerator } from "./types.stream.js";
3
- import { Command, CronsCreatePayload, CronsUpdatePayload, OnConflictBehavior, RunsCreatePayload, RunsStreamPayload, RunsWaitPayload, StreamEvent } from "./types.js";
4
- import { AsyncCaller, AsyncCallerParams } from "./utils/async_caller.js";
5
-
6
- //#region src/client.d.ts
7
- type HeaderValue = string | undefined | null;
8
- /**
9
- * Get the API key from the environment.
10
- * Precedence:
11
- * 1. explicit argument (if string)
12
- * 2. LANGGRAPH_API_KEY
13
- * 3. LANGSMITH_API_KEY
14
- * 4. LANGCHAIN_API_KEY
15
- *
16
- * @param apiKey - API key provided as an argument. If null, skips environment lookup. If undefined, tries environment.
17
- * @returns The API key if found, otherwise undefined
18
- */
19
- declare function getApiKey(apiKey?: string | null): string | undefined;
20
- type RequestHook = (url: URL, init: RequestInit) => Promise<RequestInit> | RequestInit;
21
- interface ClientConfig {
22
- apiUrl?: string;
23
- /**
24
- * API key for authentication.
25
- * - If a string is provided, that key will be used
26
- * - If undefined (default), the key will be auto-loaded from environment variables (LANGGRAPH_API_KEY, LANGSMITH_API_KEY, or LANGCHAIN_API_KEY)
27
- * - If null, no API key will be set (skips auto-loading)
28
- */
29
- apiKey?: string | null;
30
- callerOptions?: AsyncCallerParams;
31
- timeoutMs?: number;
32
- defaultHeaders?: Record<string, HeaderValue>;
33
- onRequest?: RequestHook;
34
- }
35
- declare class BaseClient {
36
- protected asyncCaller: AsyncCaller;
37
- protected timeoutMs: number | undefined;
38
- protected apiUrl: string;
39
- protected defaultHeaders: Record<string, HeaderValue>;
40
- protected onRequest?: RequestHook;
41
- constructor(config?: ClientConfig);
42
- protected prepareFetchOptions(path: string, options?: RequestInit & {
43
- json?: unknown;
44
- params?: Record<string, unknown>;
45
- timeoutMs?: number | null;
46
- withResponse?: boolean;
47
- }): [url: URL, init: RequestInit];
48
- protected fetch<T>(path: string, options: RequestInit & {
49
- json?: unknown;
50
- params?: Record<string, unknown>;
51
- timeoutMs?: number | null;
52
- signal: AbortSignal | undefined;
53
- withResponse: true;
54
- }): Promise<[T, Response]>;
55
- protected fetch<T>(path: string, options?: RequestInit & {
56
- json?: unknown;
57
- params?: Record<string, unknown>;
58
- timeoutMs?: number | null;
59
- signal: AbortSignal | undefined;
60
- withResponse?: false;
61
- }): Promise<T>;
62
- /**
63
- * Protected helper for streaming with automatic retry logic.
64
- * Handles both initial requests and reconnections with SSE.
65
- */
66
- protected streamWithRetry<T extends {
67
- id?: string;
68
- event: string;
69
- data: unknown;
70
- }>(config: {
71
- endpoint: string;
72
- method?: string;
73
- signal?: AbortSignal;
74
- headers?: Record<string, string>;
75
- params?: Record<string, unknown>;
76
- json?: unknown;
77
- maxRetries?: number;
78
- onReconnect?: (options: {
79
- attempt: number;
80
- lastEventId?: string;
81
- cause: unknown;
82
- }) => void;
83
- onInitialResponse?: (response: Response) => void | Promise<void>;
84
- }): AsyncGenerator<T>;
85
- }
86
- declare class CronsClient extends BaseClient {
87
- /**
88
- *
89
- * @param threadId The ID of the thread.
90
- * @param assistantId Assistant ID to use for this cron job.
91
- * @param payload Payload for creating a cron job.
92
- * @returns The created background run.
93
- */
94
- createForThread(threadId: string, assistantId: string, payload?: CronsCreatePayload): Promise<CronCreateForThreadResponse>;
95
- /**
96
- *
97
- * @param assistantId Assistant ID to use for this cron job.
98
- * @param payload Payload for creating a cron job.
99
- * @returns
100
- */
101
- create(assistantId: string, payload?: CronsCreatePayload): Promise<CronCreateResponse>;
102
- /**
103
- * Update a cron job by ID.
104
- *
105
- * @param cronId The cron ID to update.
106
- * @param payload Payload for updating a cron job.
107
- * @returns The updated cron job.
108
- * ```
109
- */
110
- update(cronId: string, payload?: CronsUpdatePayload): Promise<Cron>;
111
- /**
112
- * Delete a cron job by ID.
113
- *
114
- * @param cronId Cron ID of Cron job to delete.
115
- * @param options Optional parameters for the request.
116
- */
117
- delete(cronId: string, options?: {
118
- signal?: AbortSignal;
119
- }): Promise<void>;
120
- /**
121
- *
122
- * @param query Query options.
123
- * @returns List of crons.
124
- */
125
- search(query?: {
126
- assistantId?: string;
127
- threadId?: string;
128
- enabled?: boolean;
129
- limit?: number;
130
- offset?: number;
131
- sortBy?: CronSortBy;
132
- sortOrder?: SortOrder;
133
- select?: CronSelectField[];
134
- signal?: AbortSignal;
135
- }): Promise<Cron[]>;
136
- /**
137
- * Count cron jobs matching filters.
138
- *
139
- * @param query.assistantId Assistant ID to filter by.
140
- * @param query.threadId Thread ID to filter by.
141
- * @returns Number of cron jobs matching the criteria.
142
- */
143
- count(query?: {
144
- assistantId?: string;
145
- threadId?: string;
146
- signal?: AbortSignal;
147
- }): Promise<number>;
148
- }
149
- declare class AssistantsClient extends BaseClient {
150
- /**
151
- * Get an assistant by ID.
152
- *
153
- * @param assistantId The ID of the assistant.
154
- * @returns Assistant
155
- */
156
- get(assistantId: string, options?: {
157
- signal?: AbortSignal;
158
- }): Promise<Assistant>;
159
- /**
160
- * Get the JSON representation of the graph assigned to a runnable
161
- * @param assistantId The ID of the assistant.
162
- * @param options.xray Whether to include subgraphs in the serialized graph representation. If an integer value is provided, only subgraphs with a depth less than or equal to the value will be included.
163
- * @returns Serialized graph
164
- */
165
- getGraph(assistantId: string, options?: {
166
- xray?: boolean | number;
167
- signal?: AbortSignal;
168
- }): Promise<AssistantGraph>;
169
- /**
170
- * Get the state and config schema of the graph assigned to a runnable
171
- * @param assistantId The ID of the assistant.
172
- * @returns Graph schema
173
- */
174
- getSchemas(assistantId: string, options?: {
175
- signal?: AbortSignal;
176
- }): Promise<GraphSchema>;
177
- /**
178
- * Get the schemas of an assistant by ID.
179
- *
180
- * @param assistantId The ID of the assistant to get the schema of.
181
- * @param options Additional options for getting subgraphs, such as namespace or recursion extraction.
182
- * @returns The subgraphs of the assistant.
183
- */
184
- getSubgraphs(assistantId: string, options?: {
185
- namespace?: string;
186
- recurse?: boolean;
187
- signal?: AbortSignal;
188
- }): Promise<Subgraphs>;
189
- /**
190
- * Create a new assistant.
191
- * @param payload Payload for creating an assistant.
192
- * @returns The created assistant.
193
- */
194
- create(payload: {
195
- graphId: string;
196
- config?: Config;
197
- context?: unknown;
198
- metadata?: Metadata;
199
- assistantId?: string;
200
- ifExists?: OnConflictBehavior;
201
- name?: string;
202
- description?: string;
203
- signal?: AbortSignal;
204
- }): Promise<Assistant>;
205
- /**
206
- * Update an assistant.
207
- * @param assistantId ID of the assistant.
208
- * @param payload Payload for updating the assistant.
209
- * @returns The updated assistant.
210
- */
211
- update(assistantId: string, payload: {
212
- graphId?: string;
213
- config?: Config;
214
- context?: unknown;
215
- metadata?: Metadata;
216
- name?: string;
217
- description?: string;
218
- signal?: AbortSignal;
219
- }): Promise<Assistant>;
220
- /**
221
- * Delete an assistant.
222
- *
223
- * @param assistantId ID of the assistant.
224
- * @param deleteThreads If true, delete all threads with `metadata.assistant_id` equal to `assistantId`. Defaults to false.
225
- */
226
- delete(assistantId: string, options?: {
227
- signal?: AbortSignal;
228
- deleteThreads?: boolean;
229
- }): Promise<void>;
230
- /**
231
- * List assistants.
232
- * @param query Query options.
233
- * @returns List of assistants or, when includePagination is true, a mapping with the assistants and next cursor.
234
- */
235
- search(query: {
236
- graphId?: string;
237
- name?: string;
238
- metadata?: Metadata;
239
- limit?: number;
240
- offset?: number;
241
- sortBy?: AssistantSortBy;
242
- sortOrder?: SortOrder;
243
- select?: AssistantSelectField[];
244
- includePagination: true;
245
- signal?: AbortSignal;
246
- }): Promise<AssistantsSearchResponse>;
247
- search(query?: {
248
- graphId?: string;
249
- name?: string;
250
- metadata?: Metadata;
251
- limit?: number;
252
- offset?: number;
253
- sortBy?: AssistantSortBy;
254
- sortOrder?: SortOrder;
255
- select?: AssistantSelectField[];
256
- includePagination?: false;
257
- signal?: AbortSignal;
258
- }): Promise<Assistant[]>;
259
- /**
260
- * Count assistants matching filters.
261
- *
262
- * @param query.metadata Metadata to filter by. Exact match for each key/value.
263
- * @param query.graphId Optional graph id to filter by.
264
- * @param query.name Optional name to filter by.
265
- * @returns Number of assistants matching the criteria.
266
- */
267
- count(query?: {
268
- metadata?: Metadata;
269
- graphId?: string;
270
- name?: string;
271
- signal?: AbortSignal;
272
- }): Promise<number>;
273
- /**
274
- * List all versions of an assistant.
275
- *
276
- * @param assistantId ID of the assistant.
277
- * @returns List of assistant versions.
278
- */
279
- getVersions(assistantId: string, payload?: {
280
- metadata?: Metadata;
281
- limit?: number;
282
- offset?: number;
283
- signal?: AbortSignal;
284
- }): Promise<AssistantVersion[]>;
285
- /**
286
- * Change the version of an assistant.
287
- *
288
- * @param assistantId ID of the assistant.
289
- * @param version The version to change to.
290
- * @returns The updated assistant.
291
- */
292
- setLatest(assistantId: string, version: number, options?: {
293
- signal?: AbortSignal;
294
- }): Promise<Assistant>;
295
- }
296
- declare class ThreadsClient<TStateType = DefaultValues, TUpdateType = TStateType> extends BaseClient {
297
- /**
298
- * Get a thread by ID.
299
- *
300
- * @param threadId ID of the thread.
301
- * @returns The thread.
302
- */
303
- get<ValuesType = TStateType>(threadId: string, options?: {
304
- signal?: AbortSignal;
305
- include?: string[];
306
- }): Promise<Thread<ValuesType>>;
307
- /**
308
- * Create a new thread.
309
- *
310
- * @param payload Payload for creating a thread.
311
- * @returns The created thread.
312
- */
313
- create(payload?: {
314
- /**
315
- * Metadata for the thread.
316
- */
317
- metadata?: Metadata;
318
- /**
319
- * ID of the thread to create.
320
- *
321
- * If not provided, a random UUID will be generated.
322
- */
323
- threadId?: string;
324
- /**
325
- * How to handle duplicate creation.
326
- *
327
- * @default "raise"
328
- */
329
- ifExists?: OnConflictBehavior;
330
- /**
331
- * Graph ID to associate with the thread.
332
- */
333
- graphId?: string;
334
- /**
335
- * Apply a list of supersteps when creating a thread, each containing a sequence of updates.
336
- *
337
- * Used for copying a thread between deployments.
338
- */
339
- supersteps?: Array<{
340
- updates: Array<{
341
- values: unknown;
342
- command?: Command;
343
- asNode: string;
344
- }>;
345
- }>;
346
- /**
347
- * Optional time-to-live in minutes for the thread.
348
- * If a number is provided, it is treated as minutes and defaults to strategy "delete".
349
- * You may also provide an object { ttl: number, strategy?: "delete" }.
350
- */
351
- ttl?: number | {
352
- ttl: number;
353
- strategy?: "delete";
354
- };
355
- /**
356
- * Signal to abort the request.
357
- */
358
- signal?: AbortSignal;
359
- }): Promise<Thread<TStateType>>;
360
- /**
361
- * Copy an existing thread
362
- * @param threadId ID of the thread to be copied
363
- * @returns Newly copied thread
364
- */
365
- copy(threadId: string, options?: {
366
- signal?: AbortSignal;
367
- }): Promise<Thread<TStateType>>;
368
- /**
369
- * Update a thread.
370
- *
371
- * @param threadId ID of the thread.
372
- * @param payload Payload for updating the thread.
373
- * @returns The updated thread.
374
- */
375
- update(threadId: string, payload?: {
376
- /**
377
- * Metadata for the thread.
378
- */
379
- metadata?: Metadata;
380
- /**
381
- * Optional time-to-live in minutes for the thread.
382
- * If a number is provided, it is treated as minutes and defaults to strategy "delete".
383
- * You may also provide an object { ttl: number, strategy?: "delete" }.
384
- */
385
- ttl?: number | {
386
- ttl: number;
387
- strategy?: "delete";
388
- };
389
- /**
390
- * Signal to abort the request.
391
- */
392
- signal?: AbortSignal;
393
- }): Promise<Thread>;
394
- /**
395
- * Delete a thread.
396
- *
397
- * @param threadId ID of the thread.
398
- */
399
- delete(threadId: string, options?: {
400
- signal?: AbortSignal;
401
- }): Promise<void>;
402
- /**
403
- * Prune threads by ID. The 'delete' strategy removes threads entirely.
404
- * The 'keep_latest' strategy prunes old checkpoints but keeps threads
405
- * and their latest state.
406
- *
407
- * @param threadIds List of thread IDs to prune.
408
- * @param options Additional options for pruning.
409
- * @param options.strategy The prune strategy. Defaults to 'delete'.
410
- * @param options.signal Signal to abort the request.
411
- * @returns An object containing `pruned_count`.
412
- */
413
- prune(threadIds: string[], options?: {
414
- strategy?: "delete" | "keep_latest";
415
- signal?: AbortSignal;
416
- }): Promise<{
417
- pruned_count: number;
418
- }>;
419
- /**
420
- * List threads
421
- *
422
- * @param query Query options
423
- * @returns List of threads
424
- */
425
- search<ValuesType = TStateType>(query?: {
426
- /**
427
- * Metadata to filter threads by.
428
- */
429
- metadata?: Metadata;
430
- /**
431
- * Filter by specific thread IDs.
432
- */
433
- ids?: string[];
434
- /**
435
- * Maximum number of threads to return.
436
- * Defaults to 10
437
- */
438
- limit?: number;
439
- /**
440
- * Offset to start from.
441
- */
442
- offset?: number;
443
- /**
444
- * Thread status to filter on.
445
- */
446
- status?: ThreadStatus;
447
- /**
448
- * Sort by.
449
- */
450
- sortBy?: ThreadSortBy;
451
- /**
452
- * Sort order.
453
- * Must be one of 'asc' or 'desc'.
454
- */
455
- sortOrder?: SortOrder;
456
- /**
457
- * Array of fields to select.
458
- * Elements or array must be one of 'thread_id, 'created_at', 'updated_at', 'metadata', 'config', 'context', 'status', 'values', or 'interrupts'.
459
- */
460
- select?: ThreadSelectField[];
461
- /**
462
- * Values to filter threads by.
463
- */
464
- values?: ThreadValuesFilter;
465
- /**
466
- * Dictionary mapping aliases to JSONB paths to extract from thread data.
467
- * Paths use dot notation for nested keys and bracket notation for array
468
- * indices (e.g., `{"last_msg": "values.messages[-1]"}`). Extracted values
469
- * are returned in an `extracted` field on each thread. Maximum 10 paths.
470
- */
471
- extract?: Record<string, string>;
472
- /**
473
- * Signal to abort the request.
474
- */
475
- signal?: AbortSignal;
476
- }): Promise<Thread<ValuesType>[]>;
477
- /**
478
- * Count threads matching filters.
479
- *
480
- * @param query.metadata Thread metadata to filter on.
481
- * @param query.values State values to filter on.
482
- * @param query.status Thread status to filter on.
483
- * @returns Number of threads matching the criteria.
484
- */
485
- count<ValuesType = TStateType>(query?: {
486
- metadata?: Metadata;
487
- values?: ValuesType;
488
- status?: ThreadStatus;
489
- signal?: AbortSignal;
490
- }): Promise<number>;
491
- /**
492
- * Get state for a thread.
493
- *
494
- * @param threadId ID of the thread.
495
- * @returns Thread state.
496
- */
497
- getState<ValuesType = TStateType>(threadId: string, checkpoint?: Checkpoint | string, options?: {
498
- subgraphs?: boolean;
499
- signal?: AbortSignal;
500
- }): Promise<ThreadState<ValuesType>>;
501
- /**
502
- * Add state to a thread.
503
- *
504
- * @param threadId The ID of the thread.
505
- * @returns
506
- */
507
- updateState<ValuesType = TUpdateType>(threadId: string, options: {
508
- values: ValuesType;
509
- checkpoint?: Checkpoint;
510
- checkpointId?: string;
511
- asNode?: string;
512
- signal?: AbortSignal;
513
- }): Promise<Pick<Config, "configurable">>;
514
- /**
515
- * Patch the metadata of a thread.
516
- *
517
- * @param threadIdOrConfig Thread ID or config to patch the state of.
518
- * @param metadata Metadata to patch the state with.
519
- */
520
- patchState(threadIdOrConfig: string | Config, metadata: Metadata, options?: {
521
- signal?: AbortSignal;
522
- }): Promise<void>;
523
- /**
524
- * Get all past states for a thread.
525
- *
526
- * @param threadId ID of the thread.
527
- * @param options Additional options.
528
- * @returns List of thread states.
529
- */
530
- getHistory<ValuesType = TStateType>(threadId: string, options?: {
531
- limit?: number;
532
- before?: Config;
533
- checkpoint?: Partial<Omit<Checkpoint, "thread_id">>;
534
- metadata?: Metadata;
535
- signal?: AbortSignal;
536
- }): Promise<ThreadState<ValuesType>[]>;
537
- joinStream(threadId: string, options?: {
538
- lastEventId?: string;
539
- streamMode?: ThreadStreamMode | ThreadStreamMode[];
540
- signal?: AbortSignal;
541
- }): AsyncGenerator<{
542
- id?: string;
543
- event: StreamEvent;
544
- data: any;
545
- }>;
546
- }
547
- declare class RunsClient<TStateType = DefaultValues, TUpdateType = TStateType, TCustomEventType = unknown> extends BaseClient {
548
- stream<TStreamMode extends StreamMode | StreamMode[] = StreamMode, TSubgraphs extends boolean = false>(threadId: null, assistantId: string, payload?: Omit<RunsStreamPayload<TStreamMode, TSubgraphs>, "multitaskStrategy" | "onCompletion">): TypedAsyncGenerator<TStreamMode, TSubgraphs, TStateType, TUpdateType, TCustomEventType>;
549
- stream<TStreamMode extends StreamMode | StreamMode[] = StreamMode, TSubgraphs extends boolean = false>(threadId: string, assistantId: string, payload?: RunsStreamPayload<TStreamMode, TSubgraphs>): TypedAsyncGenerator<TStreamMode, TSubgraphs, TStateType, TUpdateType, TCustomEventType>;
550
- /**
551
- * Create a run.
552
- *
553
- * @param threadId The ID of the thread.
554
- * @param assistantId Assistant ID to use for this run.
555
- * @param payload Payload for creating a run.
556
- * @returns The created run.
557
- */
558
- create(threadId: string | null, assistantId: string, payload?: RunsCreatePayload): Promise<Run>;
559
- /**
560
- * Create a batch of stateless background runs.
561
- *
562
- * @param payloads An array of payloads for creating runs.
563
- * @returns An array of created runs.
564
- */
565
- createBatch(payloads: (Omit<RunsCreatePayload, "signal"> & {
566
- assistantId: string;
567
- })[], options?: {
568
- signal?: AbortSignal;
569
- }): Promise<Run[]>;
570
- wait(threadId: null, assistantId: string, payload?: Omit<RunsWaitPayload, "multitaskStrategy" | "onCompletion">): Promise<ThreadState["values"]>;
571
- wait(threadId: string, assistantId: string, payload?: RunsWaitPayload): Promise<ThreadState["values"]>;
572
- /**
573
- * List all runs for a thread.
574
- *
575
- * @param threadId The ID of the thread.
576
- * @param options Filtering and pagination options.
577
- * @returns List of runs.
578
- */
579
- list(threadId: string, options?: {
580
- /**
581
- * Maximum number of runs to return.
582
- * Defaults to 10
583
- */
584
- limit?: number;
585
- /**
586
- * Offset to start from.
587
- * Defaults to 0.
588
- */
589
- offset?: number;
590
- /**
591
- * Status of the run to filter by.
592
- */
593
- status?: RunStatus;
594
- select?: RunSelectField[];
595
- /**
596
- * Signal to abort the request.
597
- */
598
- signal?: AbortSignal;
599
- }): Promise<Run[]>;
600
- /**
601
- * Get a run by ID.
602
- *
603
- * @param threadId The ID of the thread.
604
- * @param runId The ID of the run.
605
- * @returns The run.
606
- */
607
- get(threadId: string, runId: string, options?: {
608
- signal?: AbortSignal;
609
- }): Promise<Run>;
610
- /**
611
- * Cancel a run.
612
- *
613
- * @param threadId The ID of the thread.
614
- * @param runId The ID of the run.
615
- * @param wait Whether to block when canceling
616
- * @param action Action to take when cancelling the run. Possible values are `interrupt` or `rollback`. Default is `interrupt`.
617
- * @returns
618
- */
619
- cancel(threadId: string, runId: string, wait?: boolean, action?: CancelAction, options?: {
620
- signal?: AbortSignal;
621
- }): Promise<void>;
622
- /**
623
- * Cancel one or more runs. Can cancel runs by thread ID and run IDs, or by status filter.
624
- *
625
- * @param options Options for cancelling runs.
626
- * @param options.threadId The ID of the thread containing runs to cancel.
627
- * @param options.runIds List of run IDs to cancel.
628
- * @param options.status Filter runs by status to cancel. Must be one of 'pending', 'running', or 'all'.
629
- * @param options.action Action to take when cancelling the run. Possible values are `interrupt` or `rollback`. Default is `interrupt`.
630
- * @param options.signal AbortSignal for cancelling the request.
631
- * @returns
632
- */
633
- cancelMany(options: {
634
- threadId?: string;
635
- runIds?: string[];
636
- status?: "pending" | "running" | "all";
637
- action?: CancelAction;
638
- signal?: AbortSignal;
639
- }): Promise<void>;
640
- /**
641
- * Block until a run is done.
642
- *
643
- * @param threadId The ID of the thread.
644
- * @param runId The ID of the run.
645
- * @returns
646
- */
647
- join(threadId: string, runId: string, options?: {
648
- cancelOnDisconnect?: boolean;
649
- signal?: AbortSignal;
650
- }): Promise<TStateType>;
651
- /**
652
- * Stream output from a run in real-time, until the run is done.
653
- *
654
- * @param threadId The ID of the thread. Can be set to `null` | `undefined` for stateless runs.
655
- * @param runId The ID of the run.
656
- * @param options Additional options for controlling the stream behavior:
657
- * - signal: An AbortSignal that can be used to cancel the stream request
658
- * - lastEventId: The ID of the last event received. Can be used to reconnect to a stream without losing events.
659
- * - cancelOnDisconnect: When true, automatically cancels the run if the client disconnects from the stream
660
- * - streamMode: Controls what types of events to receive from the stream (can be a single mode or array of modes)
661
- * Must be a subset of the stream modes passed when creating the run. Background runs default to having the union of all
662
- * stream modes enabled.
663
- * @returns An async generator yielding stream parts.
664
- */
665
- joinStream(threadId: string | undefined | null, runId: string, options?: {
666
- signal?: AbortSignal;
667
- cancelOnDisconnect?: boolean;
668
- lastEventId?: string;
669
- streamMode?: StreamMode | StreamMode[];
670
- } | AbortSignal): AsyncGenerator<{
671
- id?: string;
672
- event: StreamEvent;
673
- data: any;
674
- }>;
675
- /**
676
- * Delete a run.
677
- *
678
- * @param threadId The ID of the thread.
679
- * @param runId The ID of the run.
680
- * @returns
681
- */
682
- delete(threadId: string, runId: string, options?: {
683
- signal?: AbortSignal;
684
- }): Promise<void>;
685
- }
686
- declare class StoreClient extends BaseClient {
687
- /**
688
- * Store or update an item.
689
- *
690
- * @param namespace A list of strings representing the namespace path.
691
- * @param key The unique identifier for the item within the namespace.
692
- * @param value A dictionary containing the item's data.
693
- * @param options.index Controls search indexing - null (use defaults), false (disable), or list of field paths to index.
694
- * @param options.ttl Optional time-to-live in minutes for the item, or null for no expiration.
695
- * @returns Promise<void>
696
- *
697
- * @example
698
- * ```typescript
699
- * await client.store.putItem(
700
- * ["documents", "user123"],
701
- * "item456",
702
- * { title: "My Document", content: "Hello World" },
703
- * { ttl: 60 } // expires in 60 minutes
704
- * );
705
- * ```
706
- */
707
- putItem(namespace: string[], key: string, value: Record<string, unknown>, options?: {
708
- index?: false | string[] | null;
709
- ttl?: number | null;
710
- signal?: AbortSignal;
711
- }): Promise<void>;
712
- /**
713
- * Retrieve a single item.
714
- *
715
- * @param namespace A list of strings representing the namespace path.
716
- * @param key The unique identifier for the item.
717
- * @param options.refreshTtl Whether to refresh the TTL on this read operation. If null, uses the store's default behavior.
718
- * @returns Promise<Item>
719
- *
720
- * @example
721
- * ```typescript
722
- * const item = await client.store.getItem(
723
- * ["documents", "user123"],
724
- * "item456",
725
- * { refreshTtl: true }
726
- * );
727
- * console.log(item);
728
- * // {
729
- * // namespace: ["documents", "user123"],
730
- * // key: "item456",
731
- * // value: { title: "My Document", content: "Hello World" },
732
- * // createdAt: "2024-07-30T12:00:00Z",
733
- * // updatedAt: "2024-07-30T12:00:00Z"
734
- * // }
735
- * ```
736
- */
737
- getItem(namespace: string[], key: string, options?: {
738
- refreshTtl?: boolean | null;
739
- signal?: AbortSignal;
740
- }): Promise<Item | null>;
741
- /**
742
- * Delete an item.
743
- *
744
- * @param namespace A list of strings representing the namespace path.
745
- * @param key The unique identifier for the item.
746
- * @returns Promise<void>
747
- */
748
- deleteItem(namespace: string[], key: string, options?: {
749
- signal?: AbortSignal;
750
- }): Promise<void>;
751
- /**
752
- * Search for items within a namespace prefix.
753
- *
754
- * @param namespacePrefix List of strings representing the namespace prefix.
755
- * @param options.filter Optional dictionary of key-value pairs to filter results.
756
- * @param options.limit Maximum number of items to return (default is 10).
757
- * @param options.offset Number of items to skip before returning results (default is 0).
758
- * @param options.query Optional search query.
759
- * @param options.refreshTtl Whether to refresh the TTL on items returned by this search. If null, uses the store's default behavior.
760
- * @returns Promise<SearchItemsResponse>
761
- *
762
- * @example
763
- * ```typescript
764
- * const results = await client.store.searchItems(
765
- * ["documents"],
766
- * {
767
- * filter: { author: "John Doe" },
768
- * limit: 5,
769
- * refreshTtl: true
770
- * }
771
- * );
772
- * console.log(results);
773
- * // {
774
- * // items: [
775
- * // {
776
- * // namespace: ["documents", "user123"],
777
- * // key: "item789",
778
- * // value: { title: "Another Document", author: "John Doe" },
779
- * // createdAt: "2024-07-30T12:00:00Z",
780
- * // updatedAt: "2024-07-30T12:00:00Z"
781
- * // },
782
- * // // ... additional items ...
783
- * // ]
784
- * // }
785
- * ```
786
- */
787
- searchItems(namespacePrefix: string[], options?: {
788
- filter?: Record<string, unknown>;
789
- limit?: number;
790
- offset?: number;
791
- query?: string;
792
- refreshTtl?: boolean | null;
793
- signal?: AbortSignal;
794
- }): Promise<SearchItemsResponse>;
795
- /**
796
- * List namespaces with optional match conditions.
797
- *
798
- * @param options.prefix Optional list of strings representing the prefix to filter namespaces.
799
- * @param options.suffix Optional list of strings representing the suffix to filter namespaces.
800
- * @param options.maxDepth Optional integer specifying the maximum depth of namespaces to return.
801
- * @param options.limit Maximum number of namespaces to return (default is 100).
802
- * @param options.offset Number of namespaces to skip before returning results (default is 0).
803
- * @returns Promise<ListNamespaceResponse>
804
- */
805
- listNamespaces(options?: {
806
- prefix?: string[];
807
- suffix?: string[];
808
- maxDepth?: number;
809
- limit?: number;
810
- offset?: number;
811
- signal?: AbortSignal;
812
- }): Promise<ListNamespaceResponse>;
813
- }
814
- declare class UiClient extends BaseClient {
815
- private static promiseCache;
816
- private static getOrCached;
817
- getComponent(assistantId: string, agentName: string): Promise<string>;
818
- }
819
- declare class Client<TStateType = DefaultValues, TUpdateType = TStateType, TCustomEventType = unknown> {
820
- /**
821
- * The client for interacting with assistants.
822
- */
823
- assistants: AssistantsClient;
824
- /**
825
- * The client for interacting with threads.
826
- */
827
- threads: ThreadsClient<TStateType, TUpdateType>;
828
- /**
829
- * The client for interacting with runs.
830
- */
831
- runs: RunsClient<TStateType, TUpdateType, TCustomEventType>;
832
- /**
833
- * The client for interacting with cron runs.
834
- */
835
- crons: CronsClient;
836
- /**
837
- * The client for interacting with the KV store.
838
- */
839
- store: StoreClient;
840
- /**
841
- * The client for interacting with the UI.
842
- * @internal Used by LoadExternalComponent and the API might change in the future.
843
- */
844
- "~ui": UiClient;
845
- /**
846
- * @internal Used to obtain a stable key representing the client.
847
- */
848
- private "~configHash";
849
- constructor(config?: ClientConfig);
850
- }
851
- /**
852
- * @internal Used to obtain a stable key representing the client.
853
- */
854
- declare function getClientConfigHash(client: Client): string | undefined;
855
- //#endregion
856
- export { AssistantsClient, Client, ClientConfig, CronsClient, RequestHook, RunsClient, StoreClient, ThreadsClient, getApiKey, getClientConfigHash };
857
- //# sourceMappingURL=client.d.ts.map
1
+ import { BaseClient, ClientConfig, HeaderValue, RequestHook, getApiKey } from "./client/base.js";
2
+ import { AssistantsClient } from "./client/assistants/index.js";
3
+ import { AssembledMessage, MessageAssembler, MessageAssemblyUpdate } from "./client/stream/messages.js";
4
+ import { AnyMediaHandle, AudioMedia, FileMedia, ImageMedia, MediaAssembler, MediaAssemblerCallbacks, MediaAssemblerOptions, MediaAssemblyError, MediaAssemblyErrorKind, MediaBase, MediaBlockType, VideoMedia } from "./client/stream/media.js";
5
+ import { AgentServerAdapter, TransportAdapter } from "./client/stream/transport.js";
6
+ import { EventForChannel, EventForChannels, EventMethodByChannel, EventSubscription, InputModule, MessageSubscription, SessionOrderingState, StateModule, SubscribeOptions, ThreadExtension, ThreadExtensions, ThreadModules, ThreadStreamOptions, ThreadStreamTransport, ThreadStreamTransportKind, UnwrapExtension } from "./client/stream/types.js";
7
+ import { inferChannel, matchesSubscription } from "./client/stream/subscription.js";
8
+ import { ProtocolError } from "./client/stream/error.js";
9
+ import { SubscriptionHandle, ThreadStream } from "./client/stream/index.js";
10
+ import { ThreadsClient } from "./client/threads/index.js";
11
+ import { RunsClient } from "./client/runs/index.js";
12
+ import { CronsClient } from "./client/crons/index.js";
13
+ import { StoreClient } from "./client/store/index.js";
14
+ import { HeaderValue as HeaderValue$1, ProtocolRequestHook, ProtocolSseTransportOptions, ProtocolTransportPaths, ProtocolWebSocketTransportOptions } from "./client/stream/transport/types.js";
15
+ import { ProtocolSseTransportAdapter } from "./client/stream/transport/http.js";
16
+ import { ProtocolWebSocketTransportAdapter } from "./client/stream/transport/websocket.js";
17
+ import { HttpAgentServerAdapter, HttpAgentServerAdapterOptions } from "./client/stream/transport/agent-server.js";
18
+ import { Client, getClientConfigHash } from "./client/index.js";
19
+ export { type AgentServerAdapter, type AnyMediaHandle, type AssembledMessage, AssistantsClient, type AudioMedia, BaseClient, Client, type ClientConfig, CronsClient, type EventForChannel, type EventForChannels, type EventMethodByChannel, type EventSubscription, type FileMedia, type HeaderValue, HttpAgentServerAdapter, type HttpAgentServerAdapterOptions, type ImageMedia, type InputModule, MediaAssembler, type MediaAssemblerCallbacks, type MediaAssemblerOptions, MediaAssemblyError, type MediaAssemblyErrorKind, type MediaBase, type MediaBlockType, MessageAssembler, type MessageAssemblyUpdate, type MessageSubscription, ProtocolError, type HeaderValue$1 as ProtocolHeaderValue, type ProtocolRequestHook, ProtocolSseTransportAdapter, type ProtocolSseTransportOptions, type ProtocolTransportPaths, ProtocolWebSocketTransportAdapter, type ProtocolWebSocketTransportOptions, type RequestHook, RunsClient, type SessionOrderingState, type StateModule, StoreClient, type SubscribeOptions, SubscriptionHandle, type ThreadExtension, type ThreadExtensions, type ThreadModules, ThreadStream, type ThreadStreamOptions, type ThreadStreamTransport, type ThreadStreamTransportKind, ThreadsClient, type TransportAdapter, type UnwrapExtension, type VideoMedia, getApiKey, getClientConfigHash, inferChannel, matchesSubscription };