langgraph-ui-components 0.0.17 → 0.0.18

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 (316) hide show
  1. package/dist/index.es100.js +20 -354
  2. package/dist/index.es100.js.map +1 -1
  3. package/dist/index.es101.js +172 -127
  4. package/dist/index.es101.js.map +1 -1
  5. package/dist/index.es102.js +231 -60
  6. package/dist/index.es102.js.map +1 -1
  7. package/dist/index.es103.js +352 -34
  8. package/dist/index.es103.js.map +1 -1
  9. package/dist/index.es104.js +134 -34
  10. package/dist/index.es104.js.map +1 -1
  11. package/dist/index.es105.js +65 -161
  12. package/dist/index.es105.js.map +1 -1
  13. package/dist/index.es106.js +30 -196
  14. package/dist/index.es106.js.map +1 -1
  15. package/dist/index.es107.js +36 -13
  16. package/dist/index.es107.js.map +1 -1
  17. package/dist/index.es108.js +162 -26
  18. package/dist/index.es108.js.map +1 -1
  19. package/dist/index.es109.js +196 -27
  20. package/dist/index.es109.js.map +1 -1
  21. package/dist/index.es110.js +13 -3156
  22. package/dist/index.es110.js.map +1 -1
  23. package/dist/index.es111.js +27 -34
  24. package/dist/index.es111.js.map +1 -1
  25. package/dist/index.es112.js +34 -5
  26. package/dist/index.es112.js.map +1 -1
  27. package/dist/index.es113.js +3145 -61
  28. package/dist/index.es113.js.map +1 -1
  29. package/dist/index.es114.js +33 -33
  30. package/dist/index.es114.js.map +1 -1
  31. package/dist/index.es115.js +5 -21
  32. package/dist/index.es115.js.map +1 -1
  33. package/dist/index.es116.js +69 -64
  34. package/dist/index.es116.js.map +1 -1
  35. package/dist/index.es117.js +37 -3
  36. package/dist/index.es117.js.map +1 -1
  37. package/dist/index.es12.js +1 -1
  38. package/dist/index.es121.js +9 -9
  39. package/dist/index.es122.js +1 -1
  40. package/dist/index.es126.js +1 -1
  41. package/dist/index.es128.js +2 -2
  42. package/dist/index.es13.js +9 -3
  43. package/dist/index.es13.js.map +1 -1
  44. package/dist/index.es136.js +1 -1
  45. package/dist/index.es137.js +6 -6
  46. package/dist/index.es139.js +1 -1
  47. package/dist/index.es14.js +6 -6
  48. package/dist/index.es140.js +1 -1
  49. package/dist/index.es143.js +1 -1
  50. package/dist/index.es144.js +1 -1
  51. package/dist/index.es145.js +1 -1
  52. package/dist/index.es146.js +1 -1
  53. package/dist/index.es147.js +1 -1
  54. package/dist/index.es148.js +1 -1
  55. package/dist/index.es149.js +1 -1
  56. package/dist/index.es150.js +1 -1
  57. package/dist/index.es151.js +1 -1
  58. package/dist/index.es152.js +1 -1
  59. package/dist/index.es153.js +1 -1
  60. package/dist/index.es154.js +1 -1
  61. package/dist/index.es155.js +1 -1
  62. package/dist/index.es156.js +1 -1
  63. package/dist/index.es157.js +1 -1
  64. package/dist/index.es158.js +1 -1
  65. package/dist/index.es159.js +1 -1
  66. package/dist/index.es16.js +10 -5
  67. package/dist/index.es16.js.map +1 -1
  68. package/dist/index.es160.js +1 -1
  69. package/dist/index.es161.js +1 -1
  70. package/dist/index.es162.js +1 -1
  71. package/dist/index.es163.js +1 -1
  72. package/dist/index.es164.js +1 -1
  73. package/dist/index.es165.js +1 -1
  74. package/dist/index.es166.js +1 -1
  75. package/dist/index.es167.js +1 -1
  76. package/dist/index.es168.js +1 -1
  77. package/dist/index.es169.js +1 -1
  78. package/dist/index.es170.js +1 -1
  79. package/dist/index.es171.js +1 -1
  80. package/dist/index.es172.js +1 -1
  81. package/dist/index.es173.js +1 -1
  82. package/dist/index.es174.js +1 -1
  83. package/dist/index.es175.js +1 -1
  84. package/dist/index.es176.js +1 -1
  85. package/dist/index.es177.js +1 -1
  86. package/dist/index.es178.js +1 -1
  87. package/dist/index.es179.js +1 -1
  88. package/dist/index.es18.js +7 -7
  89. package/dist/index.es180.js +1 -1
  90. package/dist/index.es181.js +1 -1
  91. package/dist/index.es182.js +1 -1
  92. package/dist/index.es183.js +1 -1
  93. package/dist/index.es184.js +1 -1
  94. package/dist/index.es185.js +1 -1
  95. package/dist/index.es186.js +1 -1
  96. package/dist/index.es187.js +1 -1
  97. package/dist/index.es191.js +2 -56
  98. package/dist/index.es191.js.map +1 -1
  99. package/dist/index.es192.js +2 -100
  100. package/dist/index.es192.js.map +1 -1
  101. package/dist/index.es193.js +2 -191
  102. package/dist/index.es193.js.map +1 -1
  103. package/dist/index.es194.js +2 -110
  104. package/dist/index.es194.js.map +1 -1
  105. package/dist/index.es195.js +2 -35
  106. package/dist/index.es195.js.map +1 -1
  107. package/dist/index.es196.js +2 -10
  108. package/dist/index.es196.js.map +1 -1
  109. package/dist/index.es197.js +2 -11
  110. package/dist/index.es197.js.map +1 -1
  111. package/dist/index.es198.js +2 -12
  112. package/dist/index.es198.js.map +1 -1
  113. package/dist/index.es199.js +2 -91
  114. package/dist/index.es199.js.map +1 -1
  115. package/dist/index.es2.js +96 -11
  116. package/dist/index.es2.js.map +1 -1
  117. package/dist/index.es20.js +2 -2
  118. package/dist/index.es200.js +2 -275
  119. package/dist/index.es200.js.map +1 -1
  120. package/dist/index.es201.js +2 -2
  121. package/dist/index.es202.js +2 -164
  122. package/dist/index.es202.js.map +1 -1
  123. package/dist/index.es203.js +2 -51
  124. package/dist/index.es203.js.map +1 -1
  125. package/dist/index.es204.js +2 -40
  126. package/dist/index.es204.js.map +1 -1
  127. package/dist/index.es205.js +2 -35
  128. package/dist/index.es205.js.map +1 -1
  129. package/dist/index.es206.js +2 -40
  130. package/dist/index.es206.js.map +1 -1
  131. package/dist/index.es207.js +2 -24
  132. package/dist/index.es207.js.map +1 -1
  133. package/dist/index.es208.js +2 -591
  134. package/dist/index.es208.js.map +1 -1
  135. package/dist/index.es209.js +2 -125
  136. package/dist/index.es209.js.map +1 -1
  137. package/dist/index.es210.js +2 -164
  138. package/dist/index.es210.js.map +1 -1
  139. package/dist/index.es211.js +2 -2
  140. package/dist/index.es212.js +2 -2
  141. package/dist/index.es213.js +2 -2
  142. package/dist/index.es214.js +2 -2
  143. package/dist/index.es215.js +2 -2
  144. package/dist/index.es216.js +2 -2
  145. package/dist/index.es217.js +2 -2
  146. package/dist/index.es218.js +2 -2
  147. package/dist/index.es219.js +2 -2
  148. package/dist/index.es22.js +35 -119
  149. package/dist/index.es22.js.map +1 -1
  150. package/dist/index.es220.js +2 -2
  151. package/dist/index.es221.js +2 -2
  152. package/dist/index.es222.js +2 -2
  153. package/dist/index.es223.js +2 -2
  154. package/dist/index.es224.js +2 -2
  155. package/dist/index.es225.js +2 -2
  156. package/dist/index.es226.js +2 -2
  157. package/dist/index.es227.js +2 -2
  158. package/dist/index.es228.js +2 -2
  159. package/dist/index.es229.js +2 -2
  160. package/dist/index.es23.js +66 -36
  161. package/dist/index.es23.js.map +1 -1
  162. package/dist/index.es230.js +2 -2
  163. package/dist/index.es231.js +2 -2
  164. package/dist/index.es232.js +2 -2
  165. package/dist/index.es233.js +2 -2
  166. package/dist/index.es234.js +2 -2
  167. package/dist/index.es235.js +2 -2
  168. package/dist/index.es236.js +56 -2
  169. package/dist/index.es236.js.map +1 -1
  170. package/dist/index.es237.js +100 -2
  171. package/dist/index.es237.js.map +1 -1
  172. package/dist/index.es238.js +191 -2
  173. package/dist/index.es238.js.map +1 -1
  174. package/dist/index.es239.js +110 -2
  175. package/dist/index.es239.js.map +1 -1
  176. package/dist/index.es24.js +30 -64
  177. package/dist/index.es24.js.map +1 -1
  178. package/dist/index.es240.js +35 -2
  179. package/dist/index.es240.js.map +1 -1
  180. package/dist/index.es241.js +10 -2
  181. package/dist/index.es241.js.map +1 -1
  182. package/dist/index.es242.js +11 -2
  183. package/dist/index.es242.js.map +1 -1
  184. package/dist/index.es243.js +12 -2
  185. package/dist/index.es243.js.map +1 -1
  186. package/dist/index.es244.js +91 -2
  187. package/dist/index.es244.js.map +1 -1
  188. package/dist/index.es245.js +275 -2
  189. package/dist/index.es245.js.map +1 -1
  190. package/dist/index.es246.js +2 -2
  191. package/dist/index.es247.js +164 -2
  192. package/dist/index.es247.js.map +1 -1
  193. package/dist/index.es248.js +51 -2
  194. package/dist/index.es248.js.map +1 -1
  195. package/dist/index.es249.js +40 -2
  196. package/dist/index.es249.js.map +1 -1
  197. package/dist/index.es25.js +120 -29
  198. package/dist/index.es25.js.map +1 -1
  199. package/dist/index.es250.js +35 -2
  200. package/dist/index.es250.js.map +1 -1
  201. package/dist/index.es251.js +40 -2
  202. package/dist/index.es251.js.map +1 -1
  203. package/dist/index.es252.js +24 -2
  204. package/dist/index.es252.js.map +1 -1
  205. package/dist/index.es253.js +591 -2
  206. package/dist/index.es253.js.map +1 -1
  207. package/dist/index.es254.js +125 -2
  208. package/dist/index.es254.js.map +1 -1
  209. package/dist/index.es255.js +164 -2
  210. package/dist/index.es255.js.map +1 -1
  211. package/dist/index.es256.js +2 -2
  212. package/dist/index.es26.js +102 -123
  213. package/dist/index.es26.js.map +1 -1
  214. package/dist/index.es267.js +1 -1
  215. package/dist/index.es27.js +66 -101
  216. package/dist/index.es27.js.map +1 -1
  217. package/dist/index.es28.js +139 -66
  218. package/dist/index.es28.js.map +1 -1
  219. package/dist/index.es29.js +295 -131
  220. package/dist/index.es29.js.map +1 -1
  221. package/dist/index.es30.js +114 -298
  222. package/dist/index.es30.js.map +1 -1
  223. package/dist/index.es305.js +1 -1
  224. package/dist/index.es307.js +1 -1
  225. package/dist/index.es319.js +1 -1
  226. package/dist/index.es32.js +7 -7
  227. package/dist/index.es33.js +1 -1
  228. package/dist/index.es339.js +2 -2
  229. package/dist/index.es36.js +4 -4
  230. package/dist/index.es37.js +289 -114
  231. package/dist/index.es37.js.map +1 -1
  232. package/dist/index.es38.js +44 -70
  233. package/dist/index.es38.js.map +1 -1
  234. package/dist/index.es39.js +145 -19
  235. package/dist/index.es39.js.map +1 -1
  236. package/dist/index.es40.js +5 -261
  237. package/dist/index.es40.js.map +1 -1
  238. package/dist/index.es41.js +247 -38
  239. package/dist/index.es41.js.map +1 -1
  240. package/dist/index.es42.js +110 -207
  241. package/dist/index.es42.js.map +1 -1
  242. package/dist/index.es43.js +68 -64
  243. package/dist/index.es43.js.map +1 -1
  244. package/dist/index.es44.js +17 -141
  245. package/dist/index.es44.js.map +1 -1
  246. package/dist/index.es45.js +251 -14
  247. package/dist/index.es45.js.map +1 -1
  248. package/dist/index.es46.js +36 -223
  249. package/dist/index.es46.js.map +1 -1
  250. package/dist/index.es47.js +213 -7
  251. package/dist/index.es47.js.map +1 -1
  252. package/dist/index.es48.js +55 -1180
  253. package/dist/index.es48.js.map +1 -1
  254. package/dist/index.es49.js +141 -6
  255. package/dist/index.es49.js.map +1 -1
  256. package/dist/index.es50.js +21 -144
  257. package/dist/index.es50.js.map +1 -1
  258. package/dist/index.es51.js +230 -5
  259. package/dist/index.es51.js.map +1 -1
  260. package/dist/index.es52.js +8 -292
  261. package/dist/index.es52.js.map +1 -1
  262. package/dist/index.es53.js +1190 -43
  263. package/dist/index.es53.js.map +1 -1
  264. package/dist/index.es54.js +7 -144
  265. package/dist/index.es54.js.map +1 -1
  266. package/dist/index.es55.js +136 -241
  267. package/dist/index.es55.js.map +1 -1
  268. package/dist/index.es59.js +1 -1
  269. package/dist/index.es6.js +21 -8
  270. package/dist/index.es6.js.map +1 -1
  271. package/dist/index.es60.js +1 -1
  272. package/dist/index.es61.js +1 -1
  273. package/dist/index.es62.js +7 -7
  274. package/dist/index.es67.js +3 -3
  275. package/dist/index.es69.js +2 -2
  276. package/dist/index.es70.js +1 -1
  277. package/dist/index.es71.js +1 -1
  278. package/dist/index.es72.js +1 -1
  279. package/dist/index.es77.js +7 -7
  280. package/dist/index.es78.js +17 -17
  281. package/dist/index.es82.js +1 -1
  282. package/dist/index.es83.js +4 -4
  283. package/dist/index.es84.js +20 -11
  284. package/dist/index.es84.js.map +1 -1
  285. package/dist/index.es85.js +66 -38
  286. package/dist/index.es85.js.map +1 -1
  287. package/dist/index.es86.js +3 -34
  288. package/dist/index.es86.js.map +1 -1
  289. package/dist/index.es87.js +10 -230
  290. package/dist/index.es87.js.map +1 -1
  291. package/dist/index.es88.js +39 -29
  292. package/dist/index.es88.js.map +1 -1
  293. package/dist/index.es89.js +32 -73
  294. package/dist/index.es89.js.map +1 -1
  295. package/dist/index.es90.js +200 -44
  296. package/dist/index.es90.js.map +1 -1
  297. package/dist/index.es91.js +15 -37
  298. package/dist/index.es91.js.map +1 -1
  299. package/dist/index.es92.js +71 -26
  300. package/dist/index.es92.js.map +1 -1
  301. package/dist/index.es93.js +72 -39
  302. package/dist/index.es93.js.map +1 -1
  303. package/dist/index.es94.js +48 -53
  304. package/dist/index.es94.js.map +1 -1
  305. package/dist/index.es95.js +30 -13
  306. package/dist/index.es95.js.map +1 -1
  307. package/dist/index.es96.js +40 -134
  308. package/dist/index.es96.js.map +1 -1
  309. package/dist/index.es97.js +56 -20
  310. package/dist/index.es97.js.map +1 -1
  311. package/dist/index.es98.js +11 -180
  312. package/dist/index.es98.js.map +1 -1
  313. package/dist/index.es99.js +129 -233
  314. package/dist/index.es99.js.map +1 -1
  315. package/dist/styles.css +1 -1
  316. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"index.es104.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/runnables/utils.js"],"sourcesContent":["//#region src/runnables/utils.ts\nfunction isRunnableInterface(thing) {\n\treturn thing ? thing.lc_runnable : false;\n}\n/**\n* Utility to filter the root event in the streamEvents implementation.\n* This is simply binding the arguments to the namespace to make save on\n* a bit of typing in the streamEvents implementation.\n*\n* TODO: Refactor and remove.\n*/\nvar _RootEventFilter = class {\n\tincludeNames;\n\tincludeTypes;\n\tincludeTags;\n\texcludeNames;\n\texcludeTypes;\n\texcludeTags;\n\tconstructor(fields) {\n\t\tthis.includeNames = fields.includeNames;\n\t\tthis.includeTypes = fields.includeTypes;\n\t\tthis.includeTags = fields.includeTags;\n\t\tthis.excludeNames = fields.excludeNames;\n\t\tthis.excludeTypes = fields.excludeTypes;\n\t\tthis.excludeTags = fields.excludeTags;\n\t}\n\tincludeEvent(event, rootType) {\n\t\tlet include = this.includeNames === void 0 && this.includeTypes === void 0 && this.includeTags === void 0;\n\t\tconst eventTags = event.tags ?? [];\n\t\tif (this.includeNames !== void 0) include = include || this.includeNames.includes(event.name);\n\t\tif (this.includeTypes !== void 0) include = include || this.includeTypes.includes(rootType);\n\t\tif (this.includeTags !== void 0) include = include || eventTags.some((tag) => this.includeTags?.includes(tag));\n\t\tif (this.excludeNames !== void 0) include = include && !this.excludeNames.includes(event.name);\n\t\tif (this.excludeTypes !== void 0) include = include && !this.excludeTypes.includes(rootType);\n\t\tif (this.excludeTags !== void 0) include = include && eventTags.every((tag) => !this.excludeTags?.includes(tag));\n\t\treturn include;\n\t}\n};\nconst toBase64Url = (str) => {\n\tconst encoded = btoa(str);\n\treturn encoded.replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/, \"\");\n};\n\n//#endregion\nexport { _RootEventFilter, isRunnableInterface, toBase64Url };\n//# sourceMappingURL=utils.js.map"],"names":[],"mappings":"AACA,SAAS,oBAAoB,OAAO;AACnC,SAAO,QAAQ,MAAM,cAAc;AACpC;AAQG,IAAC,mBAAmB,MAAM;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,QAAQ;AACnB,SAAK,eAAe,OAAO;AAC3B,SAAK,eAAe,OAAO;AAC3B,SAAK,cAAc,OAAO;AAC1B,SAAK,eAAe,OAAO;AAC3B,SAAK,eAAe,OAAO;AAC3B,SAAK,cAAc,OAAO;AAAA,EAC3B;AAAA,EACA,aAAa,OAAO,UAAU;AAC7B,QAAI,UAAU,KAAK,iBAAiB,UAAU,KAAK,iBAAiB,UAAU,KAAK,gBAAgB;AACnG,UAAM,YAAY,MAAM,QAAQ,CAAA;AAChC,QAAI,KAAK,iBAAiB,OAAQ,WAAU,WAAW,KAAK,aAAa,SAAS,MAAM,IAAI;AAC5F,QAAI,KAAK,iBAAiB,OAAQ,WAAU,WAAW,KAAK,aAAa,SAAS,QAAQ;AAC1F,QAAI,KAAK,gBAAgB,OAAQ,WAAU,WAAW,UAAU,KAAK,CAAC,QAAQ,KAAK,aAAa,SAAS,GAAG,CAAC;AAC7G,QAAI,KAAK,iBAAiB,OAAQ,WAAU,WAAW,CAAC,KAAK,aAAa,SAAS,MAAM,IAAI;AAC7F,QAAI,KAAK,iBAAiB,OAAQ,WAAU,WAAW,CAAC,KAAK,aAAa,SAAS,QAAQ;AAC3F,QAAI,KAAK,gBAAgB,OAAQ,WAAU,WAAW,UAAU,MAAM,CAAC,QAAQ,CAAC,KAAK,aAAa,SAAS,GAAG,CAAC;AAC/G,WAAO;AAAA,EACR;AACD;AACK,MAAC,cAAc,CAAC,QAAQ;AAC5B,QAAM,UAAU,KAAK,GAAG;AACxB,SAAO,QAAQ,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,EAAE;AACzE;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.es104.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/p-retry/index.js"],"sourcesContent":["import { isNetworkError } from \"../is-network-error/index.js\";\n\n//#region src/utils/p-retry/index.js\nfunction validateRetries(retries) {\n\tif (typeof retries === \"number\") {\n\t\tif (retries < 0) throw new TypeError(\"Expected `retries` to be a non-negative number.\");\n\t\tif (Number.isNaN(retries)) throw new TypeError(\"Expected `retries` to be a valid number or Infinity, got NaN.\");\n\t} else if (retries !== void 0) throw new TypeError(\"Expected `retries` to be a number or Infinity.\");\n}\nfunction validateNumberOption(name, value, { min = 0, allowInfinity = false } = {}) {\n\tif (value === void 0) return;\n\tif (typeof value !== \"number\" || Number.isNaN(value)) throw new TypeError(`Expected \\`${name}\\` to be a number${allowInfinity ? \" or Infinity\" : \"\"}.`);\n\tif (!allowInfinity && !Number.isFinite(value)) throw new TypeError(`Expected \\`${name}\\` to be a finite number.`);\n\tif (value < min) throw new TypeError(`Expected \\`${name}\\` to be \\u2265 ${min}.`);\n}\nvar AbortError = class extends Error {\n\tconstructor(message) {\n\t\tsuper();\n\t\tif (message instanceof Error) {\n\t\t\tthis.originalError = message;\n\t\t\t({message} = message);\n\t\t} else {\n\t\t\tthis.originalError = new Error(message);\n\t\t\tthis.originalError.stack = this.stack;\n\t\t}\n\t\tthis.name = \"AbortError\";\n\t\tthis.message = message;\n\t}\n};\nfunction calculateDelay(retriesConsumed, options) {\n\tconst attempt = Math.max(1, retriesConsumed + 1);\n\tconst random = options.randomize ? Math.random() + 1 : 1;\n\tlet timeout = Math.round(random * options.minTimeout * options.factor ** (attempt - 1));\n\ttimeout = Math.min(timeout, options.maxTimeout);\n\treturn timeout;\n}\nfunction calculateRemainingTime(start, max) {\n\tif (!Number.isFinite(max)) return max;\n\treturn max - (performance.now() - start);\n}\nasync function onAttemptFailure({ error, attemptNumber, retriesConsumed, startTime, options }) {\n\tconst normalizedError = error instanceof Error ? error : /* @__PURE__ */ new TypeError(`Non-error was thrown: \"${error}\". You should only throw errors.`);\n\tif (normalizedError instanceof AbortError) throw normalizedError.originalError;\n\tconst retriesLeft = Number.isFinite(options.retries) ? Math.max(0, options.retries - retriesConsumed) : options.retries;\n\tconst maxRetryTime = options.maxRetryTime ?? Number.POSITIVE_INFINITY;\n\tconst context = Object.freeze({\n\t\terror: normalizedError,\n\t\tattemptNumber,\n\t\tretriesLeft,\n\t\tretriesConsumed\n\t});\n\tawait options.onFailedAttempt(context);\n\tif (calculateRemainingTime(startTime, maxRetryTime) <= 0) throw normalizedError;\n\tconst consumeRetry = await options.shouldConsumeRetry(context);\n\tconst remainingTime = calculateRemainingTime(startTime, maxRetryTime);\n\tif (remainingTime <= 0 || retriesLeft <= 0) throw normalizedError;\n\tif (normalizedError instanceof TypeError && !isNetworkError(normalizedError)) {\n\t\tif (consumeRetry) throw normalizedError;\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\tif (!await options.shouldRetry(context)) throw normalizedError;\n\tif (!consumeRetry) {\n\t\toptions.signal?.throwIfAborted();\n\t\treturn false;\n\t}\n\tconst delayTime = calculateDelay(retriesConsumed, options);\n\tconst finalDelay = Math.min(delayTime, remainingTime);\n\tif (finalDelay > 0) await new Promise((resolve, reject) => {\n\t\tconst onAbort = () => {\n\t\t\tclearTimeout(timeoutToken);\n\t\t\toptions.signal?.removeEventListener(\"abort\", onAbort);\n\t\t\treject(options.signal.reason);\n\t\t};\n\t\tconst timeoutToken = setTimeout(() => {\n\t\t\toptions.signal?.removeEventListener(\"abort\", onAbort);\n\t\t\tresolve();\n\t\t}, finalDelay);\n\t\tif (options.unref) timeoutToken.unref?.();\n\t\toptions.signal?.addEventListener(\"abort\", onAbort, { once: true });\n\t});\n\toptions.signal?.throwIfAborted();\n\treturn true;\n}\nasync function pRetry(input, options = {}) {\n\toptions = { ...options };\n\tvalidateRetries(options.retries);\n\tif (Object.hasOwn(options, \"forever\")) throw new Error(\"The `forever` option is no longer supported. For many use-cases, you can set `retries: Infinity` instead.\");\n\toptions.retries ??= 10;\n\toptions.factor ??= 2;\n\toptions.minTimeout ??= 1e3;\n\toptions.maxTimeout ??= Number.POSITIVE_INFINITY;\n\toptions.maxRetryTime ??= Number.POSITIVE_INFINITY;\n\toptions.randomize ??= false;\n\toptions.onFailedAttempt ??= () => {};\n\toptions.shouldRetry ??= () => true;\n\toptions.shouldConsumeRetry ??= () => true;\n\tvalidateNumberOption(\"factor\", options.factor, {\n\t\tmin: 0,\n\t\tallowInfinity: false\n\t});\n\tvalidateNumberOption(\"minTimeout\", options.minTimeout, {\n\t\tmin: 0,\n\t\tallowInfinity: false\n\t});\n\tvalidateNumberOption(\"maxTimeout\", options.maxTimeout, {\n\t\tmin: 0,\n\t\tallowInfinity: true\n\t});\n\tvalidateNumberOption(\"maxRetryTime\", options.maxRetryTime, {\n\t\tmin: 0,\n\t\tallowInfinity: true\n\t});\n\tif (!(options.factor > 0)) options.factor = 1;\n\toptions.signal?.throwIfAborted();\n\tlet attemptNumber = 0;\n\tlet retriesConsumed = 0;\n\tconst startTime = performance.now();\n\twhile (Number.isFinite(options.retries) ? retriesConsumed <= options.retries : true) {\n\t\tattemptNumber++;\n\t\ttry {\n\t\t\toptions.signal?.throwIfAborted();\n\t\t\tconst result = await input(attemptNumber);\n\t\t\toptions.signal?.throwIfAborted();\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tif (await onAttemptFailure({\n\t\t\t\terror,\n\t\t\t\tattemptNumber,\n\t\t\t\tretriesConsumed,\n\t\t\t\tstartTime,\n\t\t\t\toptions\n\t\t\t})) retriesConsumed++;\n\t\t}\n\t}\n\tthrow new Error(\"Retry attempts exhausted without throwing an error.\");\n}\n\n//#endregion\nexport { pRetry };\n//# sourceMappingURL=index.js.map"],"names":[],"mappings":";AAGA,SAAS,gBAAgB,SAAS;AACjC,MAAI,OAAO,YAAY,UAAU;AAChC,QAAI,UAAU,EAAG,OAAM,IAAI,UAAU,iDAAiD;AACtF,QAAI,OAAO,MAAM,OAAO,EAAG,OAAM,IAAI,UAAU,+DAA+D;AAAA,EAC/G,WAAW,YAAY,OAAQ,OAAM,IAAI,UAAU,gDAAgD;AACpG;AACA,SAAS,qBAAqB,MAAM,OAAO,EAAE,MAAM,GAAG,gBAAgB,MAAK,IAAK,IAAI;AACnF,MAAI,UAAU,OAAQ;AACtB,MAAI,OAAO,UAAU,YAAY,OAAO,MAAM,KAAK,EAAG,OAAM,IAAI,UAAU,cAAc,IAAI,oBAAoB,gBAAgB,iBAAiB,EAAE,GAAG;AACtJ,MAAI,CAAC,iBAAiB,CAAC,OAAO,SAAS,KAAK,EAAG,OAAM,IAAI,UAAU,cAAc,IAAI,2BAA2B;AAChH,MAAI,QAAQ,IAAK,OAAM,IAAI,UAAU,cAAc,IAAI,cAAmB,GAAG,GAAG;AACjF;AACA,IAAI,aAAa,cAAc,MAAM;AAAA,EACpC,YAAY,SAAS;AACpB,UAAK;AACL,QAAI,mBAAmB,OAAO;AAC7B,WAAK,gBAAgB;AACrB,OAAC,EAAC,QAAO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AqB,cAAc,QAAQ,YAAY;AAAA,IACtD,KAAK;AAAA,IACL,eAAe;AAAA,EACjB,CAAE;AACD,uBAAqB,cAAc,QAAQ,YAAY;AAAA,IACtD,KAAK;AAAA,IACL,eAAe;AAAA,EACjB,CAAE;AACD,uBAAqB,gBAAgB,QAAQ,cAAc;AAAA,IAC1D,KAAK;AAAA,IACL,eAAe;AAAA,EACjB,CAAE;AACD,MAAI,EAAE,QAAQ,SAAS,GAAI,SAAQ,SAAS;AAC5C,UAAQ,QAAQ,eAAc;AAC9B,MAAI,gBAAgB;AACpB,MAAI,kBAAkB;AACtB,QAAM,YAAY,YAAY,IAAG;AACjC,SAAO,OAAO,SAAS,QAAQ,OAAO,IAAI,mBAAmB,QAAQ,UAAU,MAAM;AACpF;AACA,QAAI;AACH,cAAQ,QAAQ,eAAc;AAC9B,YAAM,SAAS,MAAM,MAAM,aAAa;AACxC,cAAQ,QAAQ,eAAc;AAC9B,aAAO;AAAA,IACR,SAAS,OAAO;AACf,UAAI,MAAM,iBAAiB;AAAA,QAC1B;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MACJ,CAAI,EAAG;AAAA,IACL;AAAA,EACD;AACA,QAAM,IAAI,MAAM,qDAAqD;AACtE;","x_google_ignoreList":[0]}
@@ -1,169 +1,73 @@
1
- import { clone } from "./index.es131.js";
2
- import { $ZodNever } from "./index.es132.js";
3
- import { globalRegistry } from "./index.es133.js";
4
- import { _never } from "./index.es134.js";
5
- import { parseAsync } from "./index.es135.js";
6
- function isZodSchemaV4(schema) {
7
- if (typeof schema !== "object" || schema === null) return false;
8
- const obj = schema;
9
- if (!("_zod" in obj)) return false;
10
- const zod = obj._zod;
11
- return typeof zod === "object" && zod !== null && "def" in zod;
12
- }
13
- function isZodSchemaV3(schema) {
14
- if (typeof schema !== "object" || schema === null) return false;
15
- const obj = schema;
16
- if (!("_def" in obj) || "_zod" in obj) return false;
17
- const def = obj._def;
18
- return typeof def === "object" && def != null && "typeName" in def;
19
- }
20
- function isInteropZodSchema(input) {
21
- if (!input) return false;
22
- if (typeof input !== "object") return false;
23
- if (Array.isArray(input)) return false;
24
- if (isZodSchemaV4(input) || isZodSchemaV3(input)) return true;
25
- return false;
26
- }
27
- async function interopParseAsync(schema, input) {
28
- if (isZodSchemaV4(schema)) return await parseAsync(schema, input);
29
- if (isZodSchemaV3(schema)) return await schema.parseAsync(input);
30
- throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType");
31
- }
32
- function getSchemaDescription(schema) {
33
- if (isZodSchemaV4(schema)) return globalRegistry.get(schema)?.description;
34
- if (isZodSchemaV3(schema)) return schema.description;
35
- if ("description" in schema && typeof schema.description === "string") return schema.description;
36
- return void 0;
37
- }
38
- function isSimpleStringZodSchema(schema) {
39
- if (!isInteropZodSchema(schema)) return false;
40
- if (isZodSchemaV3(schema)) {
41
- const def = schema._def;
42
- return def.typeName === "ZodString";
1
+ import { __export } from "./index.es56.js";
2
+ import { getAbortSignalError } from "./index.es100.js";
3
+ import { pRetry } from "./index.es104.js";
4
+ import PQueueMod from "./index.es122.js";
5
+ var async_caller_exports = {};
6
+ __export(async_caller_exports, { AsyncCaller: () => AsyncCaller });
7
+ const STATUS_NO_RETRY = [
8
+ 400,
9
+ 401,
10
+ 402,
11
+ 403,
12
+ 404,
13
+ 405,
14
+ 406,
15
+ 407,
16
+ 409
17
+ ];
18
+ const defaultFailedAttemptHandler = (error) => {
19
+ if (error.message.startsWith("Cancel") || error.message.startsWith("AbortError") || error.name === "AbortError") throw error;
20
+ if (error?.code === "ECONNABORTED") throw error;
21
+ const status = error?.response?.status ?? error?.status;
22
+ if (status && STATUS_NO_RETRY.includes(+status)) throw error;
23
+ if (error?.error?.code === "insufficient_quota") {
24
+ const err = new Error(error?.message);
25
+ err.name = "InsufficientQuotaError";
26
+ throw err;
43
27
  }
44
- if (isZodSchemaV4(schema)) {
45
- const def = schema._zod.def;
46
- return def.type === "string";
47
- }
48
- return false;
49
- }
50
- function isZodObjectV4(obj) {
51
- if (!isZodSchemaV4(obj)) return false;
52
- if (typeof obj === "object" && obj !== null && "_zod" in obj && typeof obj._zod === "object" && obj._zod !== null && "def" in obj._zod && typeof obj._zod.def === "object" && obj._zod.def !== null && "type" in obj._zod.def && obj._zod.def.type === "object") return true;
53
- return false;
54
- }
55
- function isZodArrayV4(obj) {
56
- if (!isZodSchemaV4(obj)) return false;
57
- if (typeof obj === "object" && obj !== null && "_zod" in obj && typeof obj._zod === "object" && obj._zod !== null && "def" in obj._zod && typeof obj._zod.def === "object" && obj._zod.def !== null && "type" in obj._zod.def && obj._zod.def.type === "array") return true;
58
- return false;
59
- }
60
- function isZodOptionalV4(obj) {
61
- if (!isZodSchemaV4(obj)) return false;
62
- if (typeof obj === "object" && obj !== null && "_zod" in obj && typeof obj._zod === "object" && obj._zod !== null && "def" in obj._zod && typeof obj._zod.def === "object" && obj._zod.def !== null && "type" in obj._zod.def && obj._zod.def.type === "optional") return true;
63
- return false;
64
- }
65
- function isZodNullableV4(obj) {
66
- if (!isZodSchemaV4(obj)) return false;
67
- if (typeof obj === "object" && obj !== null && "_zod" in obj && typeof obj._zod === "object" && obj._zod !== null && "def" in obj._zod && typeof obj._zod.def === "object" && obj._zod.def !== null && "type" in obj._zod.def && obj._zod.def.type === "nullable") return true;
68
- return false;
69
- }
70
- function interopZodObjectStrict(schema, recursive = false) {
71
- if (isZodSchemaV3(schema)) return schema.strict();
72
- if (isZodObjectV4(schema)) {
73
- const outputShape = schema._zod.def.shape;
74
- if (recursive) for (const [key, keySchema] of Object.entries(schema._zod.def.shape)) {
75
- if (isZodObjectV4(keySchema)) {
76
- const outputSchema = interopZodObjectStrict(keySchema, recursive);
77
- outputShape[key] = outputSchema;
78
- } else if (isZodArrayV4(keySchema)) {
79
- let elementSchema = keySchema._zod.def.element;
80
- if (isZodObjectV4(elementSchema)) elementSchema = interopZodObjectStrict(elementSchema, recursive);
81
- outputShape[key] = clone(keySchema, {
82
- ...keySchema._zod.def,
83
- element: elementSchema
84
- });
85
- } else outputShape[key] = keySchema;
86
- const meta$1 = globalRegistry.get(keySchema);
87
- if (meta$1) globalRegistry.add(outputShape[key], meta$1);
88
- }
89
- const modifiedSchema = clone(schema, {
90
- ...schema._zod.def,
91
- shape: outputShape,
92
- catchall: _never($ZodNever)
93
- });
94
- const meta = globalRegistry.get(schema);
95
- if (meta) globalRegistry.add(modifiedSchema, meta);
96
- return modifiedSchema;
28
+ };
29
+ var AsyncCaller = class {
30
+ maxConcurrency;
31
+ maxRetries;
32
+ onFailedAttempt;
33
+ queue;
34
+ constructor(params) {
35
+ this.maxConcurrency = params.maxConcurrency ?? Infinity;
36
+ this.maxRetries = params.maxRetries ?? 6;
37
+ this.onFailedAttempt = params.onFailedAttempt ?? defaultFailedAttemptHandler;
38
+ const PQueue = "default" in PQueueMod ? PQueueMod.default : PQueueMod;
39
+ this.queue = new PQueue({ concurrency: this.maxConcurrency });
97
40
  }
98
- throw new Error("Schema must be an instance of z3.ZodObject or z4.$ZodObject");
99
- }
100
- function isZodTransformV3(schema) {
101
- return isZodSchemaV3(schema) && "typeName" in schema._def && schema._def.typeName === "ZodEffects";
102
- }
103
- function isZodTransformV4(schema) {
104
- return isZodSchemaV4(schema) && schema._zod.def.type === "pipe";
105
- }
106
- function interopZodTransformInputSchemaImpl(schema, recursive, cache) {
107
- const cached = cache.get(schema);
108
- if (cached !== void 0) return cached;
109
- if (isZodSchemaV3(schema)) {
110
- if (isZodTransformV3(schema)) return interopZodTransformInputSchemaImpl(schema._def.schema, recursive, cache);
111
- return schema;
41
+ async call(callable, ...args) {
42
+ return this.queue.add(() => pRetry(() => callable(...args).catch((error) => {
43
+ if (error instanceof Error) throw error;
44
+ else throw new Error(error);
45
+ }), {
46
+ onFailedAttempt: ({ error }) => this.onFailedAttempt?.(error),
47
+ retries: this.maxRetries,
48
+ randomize: true
49
+ }), { throwOnTimeout: true });
112
50
  }
113
- if (isZodSchemaV4(schema)) {
114
- let outputSchema = schema;
115
- if (isZodTransformV4(schema)) outputSchema = interopZodTransformInputSchemaImpl(schema._zod.def.in, recursive, cache);
116
- if (recursive) {
117
- if (isZodObjectV4(outputSchema)) {
118
- const outputShape = {};
119
- for (const [key, keySchema] of Object.entries(outputSchema._zod.def.shape)) outputShape[key] = interopZodTransformInputSchemaImpl(keySchema, recursive, cache);
120
- outputSchema = clone(outputSchema, {
121
- ...outputSchema._zod.def,
122
- shape: outputShape
123
- });
124
- } else if (isZodArrayV4(outputSchema)) {
125
- const elementSchema = interopZodTransformInputSchemaImpl(outputSchema._zod.def.element, recursive, cache);
126
- outputSchema = clone(outputSchema, {
127
- ...outputSchema._zod.def,
128
- element: elementSchema
129
- });
130
- } else if (isZodOptionalV4(outputSchema)) {
131
- const innerSchema = interopZodTransformInputSchemaImpl(outputSchema._zod.def.innerType, recursive, cache);
132
- outputSchema = clone(outputSchema, {
133
- ...outputSchema._zod.def,
134
- innerType: innerSchema
135
- });
136
- } else if (isZodNullableV4(outputSchema)) {
137
- const innerSchema = interopZodTransformInputSchemaImpl(outputSchema._zod.def.innerType, recursive, cache);
138
- outputSchema = clone(outputSchema, {
139
- ...outputSchema._zod.def,
140
- innerType: innerSchema
141
- });
142
- }
51
+ callWithOptions(options, callable, ...args) {
52
+ if (options.signal) {
53
+ let listener;
54
+ return Promise.race([this.call(callable, ...args), new Promise((_, reject) => {
55
+ listener = () => {
56
+ reject(getAbortSignalError(options.signal));
57
+ };
58
+ options.signal?.addEventListener("abort", listener);
59
+ })]).finally(() => {
60
+ if (options.signal && listener) options.signal.removeEventListener("abort", listener);
61
+ });
143
62
  }
144
- const meta = globalRegistry.get(schema);
145
- if (meta) globalRegistry.add(outputSchema, meta);
146
- cache.set(schema, outputSchema);
147
- return outputSchema;
63
+ return this.call(callable, ...args);
148
64
  }
149
- throw new Error("Schema must be an instance of z3.ZodType or z4.$ZodType");
150
- }
151
- function interopZodTransformInputSchema(schema, recursive = false) {
152
- const cache = /* @__PURE__ */ new WeakMap();
153
- return interopZodTransformInputSchemaImpl(schema, recursive, cache);
154
- }
65
+ fetch(...args) {
66
+ return this.call(() => fetch(...args).then((res) => res.ok ? res : Promise.reject(res)));
67
+ }
68
+ };
155
69
  export {
156
- getSchemaDescription,
157
- interopParseAsync,
158
- interopZodObjectStrict,
159
- interopZodTransformInputSchema,
160
- isInteropZodSchema,
161
- isSimpleStringZodSchema,
162
- isZodArrayV4,
163
- isZodNullableV4,
164
- isZodObjectV4,
165
- isZodOptionalV4,
166
- isZodSchemaV3,
167
- isZodSchemaV4
70
+ AsyncCaller,
71
+ async_caller_exports
168
72
  };
169
73
  //# sourceMappingURL=index.es105.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es105.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/types/zod.js"],"sourcesContent":["import { $ZodNever, $ZodOptional, $ZodUnknown, _never, _unknown, clone, globalRegistry, parse, parseAsync, util } from \"zod/v4/core\";\n\n//#region src/utils/types/zod.ts\nfunction isZodSchemaV4(schema) {\n\tif (typeof schema !== \"object\" || schema === null) return false;\n\tconst obj = schema;\n\tif (!(\"_zod\" in obj)) return false;\n\tconst zod = obj._zod;\n\treturn typeof zod === \"object\" && zod !== null && \"def\" in zod;\n}\nfunction isZodSchemaV3(schema) {\n\tif (typeof schema !== \"object\" || schema === null) return false;\n\tconst obj = schema;\n\tif (!(\"_def\" in obj) || \"_zod\" in obj) return false;\n\tconst def = obj._def;\n\treturn typeof def === \"object\" && def != null && \"typeName\" in def;\n}\n/** Backward compatible isZodSchema for Zod 3 */\nfunction isZodSchema(schema) {\n\tif (isZodSchemaV4(schema)) console.warn(\"[WARNING] Attempting to use Zod 4 schema in a context where Zod 3 schema is expected. This may cause unexpected behavior.\");\n\treturn isZodSchemaV3(schema);\n}\n/**\n* Given either a Zod schema, or plain object, determine if the input is a Zod schema.\n*\n* @param {unknown} input\n* @returns {boolean} Whether or not the provided input is a Zod schema.\n*/\nfunction isInteropZodSchema(input) {\n\tif (!input) return false;\n\tif (typeof input !== \"object\") return false;\n\tif (Array.isArray(input)) return false;\n\tif (isZodSchemaV4(input) || isZodSchemaV3(input)) return true;\n\treturn false;\n}\nfunction isZodLiteralV3(obj) {\n\tif (typeof obj === \"object\" && obj !== null && \"_def\" in obj && typeof obj._def === \"object\" && obj._def !== null && \"typeName\" in obj._def && obj._def.typeName === \"ZodLiteral\") return true;\n\treturn false;\n}\nfunction isZodLiteralV4(obj) {\n\tif (!isZodSchemaV4(obj)) return false;\n\tif (typeof obj === \"object\" && obj !== null && \"_zod\" in obj && typeof obj._zod === \"object\" && obj._zod !== null && \"def\" in obj._zod && typeof obj._zod.def === \"object\" && obj._zod.def !== null && \"type\" in obj._zod.def && obj._zod.def.type === \"literal\") return true;\n\treturn false;\n}\n/**\n* Determines if the provided value is an InteropZodLiteral (Zod v3 or v4 literal schema).\n*\n* @param obj The value to check.\n* @returns {boolean} True if the value is a Zod v3 or v4 literal schema, false otherwise.\n*/\nfunction isInteropZodLiteral(obj) {\n\tif (isZodLiteralV3(obj)) return true;\n\tif (isZodLiteralV4(obj)) return true;\n\treturn false;\n}\n/**\n* Asynchronously parses the input using the provided Zod schema (v3 or v4) and returns a safe parse result.\n* This function handles both Zod v3 and v4 schemas, returning a result object indicating success or failure.\n*\n* @template T - The expected output type of the schema.\n* @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n* @param {unknown} input - The input value to parse.\n* @returns {Promise<InteropZodSafeParseResult<T>>} A promise that resolves to a safe parse result object.\n* @throws {Error} If the schema is not a recognized Zod v3 or v4 schema.\n*/\nasync function interopSafeParseAsync(schema, input) {\n\tif (isZodSchemaV4(schema)) try {\n\t\tconst data = await parseAsync(schema, input);\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror\n\t\t};\n\t}\n\tif (isZodSchemaV3(schema)) return await schema.safeParseAsync(input);\n\tthrow new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n/**\n* Asynchronously parses the input using the provided Zod schema (v3 or v4) and returns the parsed value.\n* Throws an error if parsing fails or if the schema is not a recognized Zod v3 or v4 schema.\n*\n* @template T - The expected output type of the schema.\n* @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n* @param {unknown} input - The input value to parse.\n* @returns {Promise<T>} A promise that resolves to the parsed value.\n* @throws {Error} If parsing fails or the schema is not a recognized Zod v3 or v4 schema.\n*/\nasync function interopParseAsync(schema, input) {\n\tif (isZodSchemaV4(schema)) return await parseAsync(schema, input);\n\tif (isZodSchemaV3(schema)) return await schema.parseAsync(input);\n\tthrow new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n/**\n* Safely parses the input using the provided Zod schema (v3 or v4) and returns a result object\n* indicating success or failure. This function is compatible with both Zod v3 and v4 schemas.\n*\n* @template T - The expected output type of the schema.\n* @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n* @param {unknown} input - The input value to parse.\n* @returns {InteropZodSafeParseResult<T>} An object with either the parsed data (on success)\n* or the error (on failure).\n* @throws {Error} If the schema is not a recognized Zod v3 or v4 schema.\n*/\nfunction interopSafeParse(schema, input) {\n\tif (isZodSchemaV4(schema)) try {\n\t\tconst data = parse(schema, input);\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata\n\t\t};\n\t} catch (error) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\terror\n\t\t};\n\t}\n\tif (isZodSchemaV3(schema)) return schema.safeParse(input);\n\tthrow new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n/**\n* Parses the input using the provided Zod schema (v3 or v4) and returns the parsed value.\n* Throws an error if parsing fails or if the schema is not a recognized Zod v3 or v4 schema.\n*\n* @template T - The expected output type of the schema.\n* @param {InteropZodType<T>} schema - The Zod schema (v3 or v4) to use for parsing.\n* @param {unknown} input - The input value to parse.\n* @returns {T} The parsed value.\n* @throws {Error} If parsing fails or the schema is not a recognized Zod v3 or v4 schema.\n*/\nfunction interopParse(schema, input) {\n\tif (isZodSchemaV4(schema)) return parse(schema, input);\n\tif (isZodSchemaV3(schema)) return schema.parse(input);\n\tthrow new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n/**\n* Retrieves the description from a schema definition (v3, v4, or plain object), if available.\n*\n* @param {unknown} schema - The schema to extract the description from.\n* @returns {string | undefined} The description of the schema, or undefined if not present.\n*/\nfunction getSchemaDescription(schema) {\n\tif (isZodSchemaV4(schema)) return globalRegistry.get(schema)?.description;\n\tif (isZodSchemaV3(schema)) return schema.description;\n\tif (\"description\" in schema && typeof schema.description === \"string\") return schema.description;\n\treturn void 0;\n}\n/**\n* Determines if the provided Zod schema is \"shapeless\".\n* A shapeless schema is one that does not define any object shape,\n* such as ZodString, ZodNumber, ZodBoolean, ZodAny, etc.\n* For ZodObject, it must have no shape keys to be considered shapeless.\n* ZodRecord schemas are considered shapeless since they define dynamic\n* key-value mappings without fixed keys.\n*\n* @param schema The Zod schema to check.\n* @returns {boolean} True if the schema is shapeless, false otherwise.\n*/\nfunction isShapelessZodSchema(schema) {\n\tif (!isInteropZodSchema(schema)) return false;\n\tif (isZodSchemaV3(schema)) {\n\t\tconst def = schema._def;\n\t\tif (def.typeName === \"ZodObject\") {\n\t\t\tconst obj = schema;\n\t\t\treturn !obj.shape || Object.keys(obj.shape).length === 0;\n\t\t}\n\t\tif (def.typeName === \"ZodRecord\") return true;\n\t}\n\tif (isZodSchemaV4(schema)) {\n\t\tconst def = schema._zod.def;\n\t\tif (def.type === \"object\") {\n\t\t\tconst obj = schema;\n\t\t\treturn !obj.shape || Object.keys(obj.shape).length === 0;\n\t\t}\n\t\tif (def.type === \"record\") return true;\n\t}\n\tif (typeof schema === \"object\" && schema !== null && !(\"shape\" in schema)) return true;\n\treturn false;\n}\n/**\n* Determines if the provided Zod schema should be treated as a simple string schema\n* that maps to DynamicTool. This aligns with the type-level constraint of\n* InteropZodType<string | undefined> which only matches basic string schemas.\n* If the provided schema is just z.string(), we can make the determination that\n* the tool is just a generic string tool that doesn't require any input validation.\n*\n* This function only returns true for basic ZodString schemas, including:\n* - Basic string schemas (z.string())\n* - String schemas with validations (z.string().min(1), z.string().email(), etc.)\n*\n* This function returns false for everything else, including:\n* - String schemas with defaults (z.string().default(\"value\"))\n* - Branded string schemas (z.string().brand<\"UserId\">())\n* - String schemas with catch operations (z.string().catch(\"default\"))\n* - Optional/nullable string schemas (z.string().optional())\n* - Transformed schemas (z.string().transform() or z.object().transform())\n* - Object or record schemas, even if they're empty\n* - Any other schema type\n*\n* @param schema The Zod schema to check.\n* @returns {boolean} True if the schema is a basic ZodString, false otherwise.\n*/\nfunction isSimpleStringZodSchema(schema) {\n\tif (!isInteropZodSchema(schema)) return false;\n\tif (isZodSchemaV3(schema)) {\n\t\tconst def = schema._def;\n\t\treturn def.typeName === \"ZodString\";\n\t}\n\tif (isZodSchemaV4(schema)) {\n\t\tconst def = schema._zod.def;\n\t\treturn def.type === \"string\";\n\t}\n\treturn false;\n}\nfunction isZodObjectV3(obj) {\n\tif (typeof obj === \"object\" && obj !== null && \"_def\" in obj && typeof obj._def === \"object\" && obj._def !== null && \"typeName\" in obj._def && obj._def.typeName === \"ZodObject\") return true;\n\treturn false;\n}\nfunction isZodObjectV4(obj) {\n\tif (!isZodSchemaV4(obj)) return false;\n\tif (typeof obj === \"object\" && obj !== null && \"_zod\" in obj && typeof obj._zod === \"object\" && obj._zod !== null && \"def\" in obj._zod && typeof obj._zod.def === \"object\" && obj._zod.def !== null && \"type\" in obj._zod.def && obj._zod.def.type === \"object\") return true;\n\treturn false;\n}\nfunction isZodArrayV4(obj) {\n\tif (!isZodSchemaV4(obj)) return false;\n\tif (typeof obj === \"object\" && obj !== null && \"_zod\" in obj && typeof obj._zod === \"object\" && obj._zod !== null && \"def\" in obj._zod && typeof obj._zod.def === \"object\" && obj._zod.def !== null && \"type\" in obj._zod.def && obj._zod.def.type === \"array\") return true;\n\treturn false;\n}\nfunction isZodOptionalV4(obj) {\n\tif (!isZodSchemaV4(obj)) return false;\n\tif (typeof obj === \"object\" && obj !== null && \"_zod\" in obj && typeof obj._zod === \"object\" && obj._zod !== null && \"def\" in obj._zod && typeof obj._zod.def === \"object\" && obj._zod.def !== null && \"type\" in obj._zod.def && obj._zod.def.type === \"optional\") return true;\n\treturn false;\n}\nfunction isZodNullableV4(obj) {\n\tif (!isZodSchemaV4(obj)) return false;\n\tif (typeof obj === \"object\" && obj !== null && \"_zod\" in obj && typeof obj._zod === \"object\" && obj._zod !== null && \"def\" in obj._zod && typeof obj._zod.def === \"object\" && obj._zod.def !== null && \"type\" in obj._zod.def && obj._zod.def.type === \"nullable\") return true;\n\treturn false;\n}\n/**\n* Determines if the provided value is an InteropZodObject (Zod v3 or v4 object schema).\n*\n* @param obj The value to check.\n* @returns {boolean} True if the value is a Zod v3 or v4 object schema, false otherwise.\n*/\nfunction isInteropZodObject(obj) {\n\tif (isZodObjectV3(obj)) return true;\n\tif (isZodObjectV4(obj)) return true;\n\treturn false;\n}\n/**\n* Retrieves the shape (fields) of a Zod object schema, supporting both Zod v3 and v4.\n*\n* @template T - The type of the Zod object schema.\n* @param {T} schema - The Zod object schema instance (either v3 or v4).\n* @returns {InteropZodObjectShape<T>} The shape of the object schema.\n* @throws {Error} If the schema is not a Zod v3 or v4 object.\n*/\nfunction getInteropZodObjectShape(schema) {\n\tif (isZodSchemaV3(schema)) return schema.shape;\n\tif (isZodSchemaV4(schema)) return schema._zod.def.shape;\n\tthrow new Error(\"Schema must be an instance of z3.ZodObject or z4.$ZodObject\");\n}\n/**\n* Extends a Zod object schema with additional fields, supporting both Zod v3 and v4.\n*\n* @template T - The type of the Zod object schema.\n* @param {T} schema - The Zod object schema instance (either v3 or v4).\n* @param {InteropZodObjectShape} extension - The fields to add to the schema.\n* @returns {InteropZodObject} The extended Zod object schema.\n* @throws {Error} If the schema is not a Zod v3 or v4 object.\n*/\nfunction extendInteropZodObject(schema, extension) {\n\tif (isZodSchemaV3(schema)) return schema.extend(extension);\n\tif (isZodSchemaV4(schema)) return util.extend(schema, extension);\n\tthrow new Error(\"Schema must be an instance of z3.ZodObject or z4.$ZodObject\");\n}\n/**\n* Returns a partial version of a Zod object schema, making all fields optional.\n* Supports both Zod v3 and v4.\n*\n* @template T - The type of the Zod object schema.\n* @param {T} schema - The Zod object schema instance (either v3 or v4).\n* @returns {InteropZodObject} The partial Zod object schema.\n* @throws {Error} If the schema is not a Zod v3 or v4 object.\n*/\nfunction interopZodObjectPartial(schema) {\n\tif (isZodSchemaV3(schema)) return schema.partial();\n\tif (isZodSchemaV4(schema)) return util.partial($ZodOptional, schema, void 0);\n\tthrow new Error(\"Schema must be an instance of z3.ZodObject or z4.$ZodObject\");\n}\n/**\n* Returns a strict version of a Zod object schema, disallowing unknown keys.\n* Supports both Zod v3 and v4 object schemas. If `recursive` is true, applies strictness\n* recursively to all nested object schemas and arrays of object schemas.\n*\n* @template T - The type of the Zod object schema.\n* @param {T} schema - The Zod object schema instance (either v3 or v4).\n* @param {boolean} [recursive=false] - Whether to apply strictness recursively to nested objects/arrays.\n* @returns {InteropZodObject} The strict Zod object schema.\n* @throws {Error} If the schema is not a Zod v3 or v4 object.\n*/\nfunction interopZodObjectStrict(schema, recursive = false) {\n\tif (isZodSchemaV3(schema)) return schema.strict();\n\tif (isZodObjectV4(schema)) {\n\t\tconst outputShape = schema._zod.def.shape;\n\t\tif (recursive) for (const [key, keySchema] of Object.entries(schema._zod.def.shape)) {\n\t\t\tif (isZodObjectV4(keySchema)) {\n\t\t\t\tconst outputSchema = interopZodObjectStrict(keySchema, recursive);\n\t\t\t\toutputShape[key] = outputSchema;\n\t\t\t} else if (isZodArrayV4(keySchema)) {\n\t\t\t\tlet elementSchema = keySchema._zod.def.element;\n\t\t\t\tif (isZodObjectV4(elementSchema)) elementSchema = interopZodObjectStrict(elementSchema, recursive);\n\t\t\t\toutputShape[key] = clone(keySchema, {\n\t\t\t\t\t...keySchema._zod.def,\n\t\t\t\t\telement: elementSchema\n\t\t\t\t});\n\t\t\t} else outputShape[key] = keySchema;\n\t\t\tconst meta$1 = globalRegistry.get(keySchema);\n\t\t\tif (meta$1) globalRegistry.add(outputShape[key], meta$1);\n\t\t}\n\t\tconst modifiedSchema = clone(schema, {\n\t\t\t...schema._zod.def,\n\t\t\tshape: outputShape,\n\t\t\tcatchall: _never($ZodNever)\n\t\t});\n\t\tconst meta = globalRegistry.get(schema);\n\t\tif (meta) globalRegistry.add(modifiedSchema, meta);\n\t\treturn modifiedSchema;\n\t}\n\tthrow new Error(\"Schema must be an instance of z3.ZodObject or z4.$ZodObject\");\n}\n/**\n* Returns a passthrough version of a Zod object schema, allowing unknown keys.\n* Supports both Zod v3 and v4 object schemas. If `recursive` is true, applies passthrough\n* recursively to all nested object schemas and arrays of object schemas.\n*\n* @template T - The type of the Zod object schema.\n* @param {T} schema - The Zod object schema instance (either v3 or v4).\n* @param {boolean} [recursive=false] - Whether to apply passthrough recursively to nested objects/arrays.\n* @returns {InteropZodObject} The passthrough Zod object schema.\n* @throws {Error} If the schema is not a Zod v3 or v4 object.\n*/\nfunction interopZodObjectPassthrough(schema, recursive = false) {\n\tif (isZodObjectV3(schema)) return schema.passthrough();\n\tif (isZodObjectV4(schema)) {\n\t\tconst outputShape = schema._zod.def.shape;\n\t\tif (recursive) for (const [key, keySchema] of Object.entries(schema._zod.def.shape)) {\n\t\t\tif (isZodObjectV4(keySchema)) {\n\t\t\t\tconst outputSchema = interopZodObjectPassthrough(keySchema, recursive);\n\t\t\t\toutputShape[key] = outputSchema;\n\t\t\t} else if (isZodArrayV4(keySchema)) {\n\t\t\t\tlet elementSchema = keySchema._zod.def.element;\n\t\t\t\tif (isZodObjectV4(elementSchema)) elementSchema = interopZodObjectPassthrough(elementSchema, recursive);\n\t\t\t\toutputShape[key] = clone(keySchema, {\n\t\t\t\t\t...keySchema._zod.def,\n\t\t\t\t\telement: elementSchema\n\t\t\t\t});\n\t\t\t} else outputShape[key] = keySchema;\n\t\t\tconst meta$1 = globalRegistry.get(keySchema);\n\t\t\tif (meta$1) globalRegistry.add(outputShape[key], meta$1);\n\t\t}\n\t\tconst modifiedSchema = clone(schema, {\n\t\t\t...schema._zod.def,\n\t\t\tshape: outputShape,\n\t\t\tcatchall: _unknown($ZodUnknown)\n\t\t});\n\t\tconst meta = globalRegistry.get(schema);\n\t\tif (meta) globalRegistry.add(modifiedSchema, meta);\n\t\treturn modifiedSchema;\n\t}\n\tthrow new Error(\"Schema must be an instance of z3.ZodObject or z4.$ZodObject\");\n}\n/**\n* Returns a getter function for the default value of a Zod schema, if one is defined.\n* Supports both Zod v3 and v4 schemas. If the schema has a default value,\n* the returned function will return that value when called. If no default is defined,\n* returns undefined.\n*\n* @template T - The type of the Zod schema.\n* @param {T} schema - The Zod schema instance (either v3 or v4).\n* @returns {(() => InferInteropZodOutput<T>) | undefined} A function that returns the default value, or undefined if no default is set.\n*/\nfunction getInteropZodDefaultGetter(schema) {\n\tif (isZodSchemaV3(schema)) try {\n\t\tconst defaultValue = schema.parse(void 0);\n\t\treturn () => defaultValue;\n\t} catch {\n\t\treturn void 0;\n\t}\n\tif (isZodSchemaV4(schema)) try {\n\t\tconst defaultValue = parse(schema, void 0);\n\t\treturn () => defaultValue;\n\t} catch {\n\t\treturn void 0;\n\t}\n\treturn void 0;\n}\nfunction isZodTransformV3(schema) {\n\treturn isZodSchemaV3(schema) && \"typeName\" in schema._def && schema._def.typeName === \"ZodEffects\";\n}\nfunction isZodTransformV4(schema) {\n\treturn isZodSchemaV4(schema) && schema._zod.def.type === \"pipe\";\n}\nfunction interopZodTransformInputSchemaImpl(schema, recursive, cache) {\n\tconst cached = cache.get(schema);\n\tif (cached !== void 0) return cached;\n\tif (isZodSchemaV3(schema)) {\n\t\tif (isZodTransformV3(schema)) return interopZodTransformInputSchemaImpl(schema._def.schema, recursive, cache);\n\t\treturn schema;\n\t}\n\tif (isZodSchemaV4(schema)) {\n\t\tlet outputSchema = schema;\n\t\tif (isZodTransformV4(schema)) outputSchema = interopZodTransformInputSchemaImpl(schema._zod.def.in, recursive, cache);\n\t\tif (recursive) {\n\t\t\tif (isZodObjectV4(outputSchema)) {\n\t\t\t\tconst outputShape = {};\n\t\t\t\tfor (const [key, keySchema] of Object.entries(outputSchema._zod.def.shape)) outputShape[key] = interopZodTransformInputSchemaImpl(keySchema, recursive, cache);\n\t\t\t\toutputSchema = clone(outputSchema, {\n\t\t\t\t\t...outputSchema._zod.def,\n\t\t\t\t\tshape: outputShape\n\t\t\t\t});\n\t\t\t} else if (isZodArrayV4(outputSchema)) {\n\t\t\t\tconst elementSchema = interopZodTransformInputSchemaImpl(outputSchema._zod.def.element, recursive, cache);\n\t\t\t\toutputSchema = clone(outputSchema, {\n\t\t\t\t\t...outputSchema._zod.def,\n\t\t\t\t\telement: elementSchema\n\t\t\t\t});\n\t\t\t} else if (isZodOptionalV4(outputSchema)) {\n\t\t\t\tconst innerSchema = interopZodTransformInputSchemaImpl(outputSchema._zod.def.innerType, recursive, cache);\n\t\t\t\toutputSchema = clone(outputSchema, {\n\t\t\t\t\t...outputSchema._zod.def,\n\t\t\t\t\tinnerType: innerSchema\n\t\t\t\t});\n\t\t\t} else if (isZodNullableV4(outputSchema)) {\n\t\t\t\tconst innerSchema = interopZodTransformInputSchemaImpl(outputSchema._zod.def.innerType, recursive, cache);\n\t\t\t\toutputSchema = clone(outputSchema, {\n\t\t\t\t\t...outputSchema._zod.def,\n\t\t\t\t\tinnerType: innerSchema\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\tconst meta = globalRegistry.get(schema);\n\t\tif (meta) globalRegistry.add(outputSchema, meta);\n\t\tcache.set(schema, outputSchema);\n\t\treturn outputSchema;\n\t}\n\tthrow new Error(\"Schema must be an instance of z3.ZodType or z4.$ZodType\");\n}\n/**\n* Returns the input type of a Zod transform schema, for both v3 and v4.\n* If the schema is not a transform, returns undefined. If `recursive` is true,\n* recursively processes nested object schemas and arrays of object schemas.\n*\n* @param schema - The Zod schema instance (v3 or v4)\n* @param {boolean} [recursive=false] - Whether to recursively process nested objects/arrays.\n* @returns The input Zod schema of the transform, or undefined if not a transform\n*/\nfunction interopZodTransformInputSchema(schema, recursive = false) {\n\tconst cache = /* @__PURE__ */ new WeakMap();\n\treturn interopZodTransformInputSchemaImpl(schema, recursive, cache);\n}\n/**\n* Creates a modified version of a Zod object schema where fields matching a predicate are made optional.\n* Supports both Zod v3 and v4 schemas and preserves the original schema version.\n*\n* @template T - The type of the Zod object schema.\n* @param {T} schema - The Zod object schema instance (either v3 or v4).\n* @param {(key: string, value: InteropZodType) => boolean} predicate - Function to determine which fields should be optional.\n* @returns {InteropZodObject} The modified Zod object schema.\n* @throws {Error} If the schema is not a Zod v3 or v4 object.\n*/\nfunction interopZodObjectMakeFieldsOptional(schema, predicate) {\n\tif (isZodSchemaV3(schema)) {\n\t\tconst shape = getInteropZodObjectShape(schema);\n\t\tconst modifiedShape = {};\n\t\tfor (const [key, value] of Object.entries(shape)) if (predicate(key, value)) modifiedShape[key] = value.optional();\n\t\telse modifiedShape[key] = value;\n\t\treturn schema.extend(modifiedShape);\n\t}\n\tif (isZodSchemaV4(schema)) {\n\t\tconst shape = getInteropZodObjectShape(schema);\n\t\tconst outputShape = { ...schema._zod.def.shape };\n\t\tfor (const [key, value] of Object.entries(shape)) if (predicate(key, value)) outputShape[key] = new $ZodOptional({\n\t\t\ttype: \"optional\",\n\t\t\tinnerType: value\n\t\t});\n\t\tconst modifiedSchema = clone(schema, {\n\t\t\t...schema._zod.def,\n\t\t\tshape: outputShape\n\t\t});\n\t\tconst meta = globalRegistry.get(schema);\n\t\tif (meta) globalRegistry.add(modifiedSchema, meta);\n\t\treturn modifiedSchema;\n\t}\n\tthrow new Error(\"Schema must be an instance of z3.ZodObject or z4.$ZodObject\");\n}\nfunction isInteropZodError(e) {\n\treturn e instanceof Error && (e.constructor.name === \"ZodError\" || e.constructor.name === \"$ZodError\");\n}\n\n//#endregion\nexport { extendInteropZodObject, getInteropZodDefaultGetter, getInteropZodObjectShape, getSchemaDescription, interopParse, interopParseAsync, interopSafeParse, interopSafeParseAsync, interopZodObjectMakeFieldsOptional, interopZodObjectPartial, interopZodObjectPassthrough, interopZodObjectStrict, interopZodTransformInputSchema, isInteropZodError, isInteropZodLiteral, isInteropZodObject, isInteropZodSchema, isShapelessZodSchema, isSimpleStringZodSchema, isZodArrayV4, isZodLiteralV3, isZodLiteralV4, isZodNullableV4, isZodObjectV3, isZodObjectV4, isZodOptionalV4, isZodSchema, isZodSchemaV3, isZodSchemaV4 };\n//# sourceMappingURL=zod.js.map"],"names":[],"mappings":";;;;;AAGA,SAAS,cAAc,QAAQ;AAC9B,MAAI,OAAO,WAAW,YAAY,WAAW,KAAM,QAAO;AAC1D,QAAM,MAAM;AACZ,MAAI,EAAE,UAAU,KAAM,QAAO;AAC7B,QAAM,MAAM,IAAI;AAChB,SAAO,OAAO,QAAQ,YAAY,QAAQ,QAAQ,SAAS;AAC5D;AACA,SAAS,cAAc,QAAQ;AAC9B,MAAI,OAAO,WAAW,YAAY,WAAW,KAAM,QAAO;AAC1D,QAAM,MAAM;AACZ,MAAI,EAAE,UAAU,QAAQ,UAAU,IAAK,QAAO;AAC9C,QAAM,MAAM,IAAI;AAChB,SAAO,OAAO,QAAQ,YAAY,OAAO,QAAQ,cAAc;AAChE;AAYA,SAAS,mBAAmB,OAAO;AAClC,MAAI,CAAC,MAAO,QAAO;AACnB,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI,MAAM,QAAQ,KAAK,EAAG,QAAO;AACjC,MAAI,cAAc,KAAK,KAAK,cAAc,KAAK,EAAG,QAAO;AACzD,SAAO;AACR;AAyDA,eAAe,kBAAkB,QAAQ,OAAO;AAC/C,MAAI,cAAc,MAAM,EAAG,QAAO,MAAM,WAAW,QAAQ,KAAK;AAChE,MAAI,cAAc,MAAM,EAAG,QAAO,MAAM,OAAO,WAAW,KAAK;AAC/D,QAAM,IAA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tC,cAAM,gBAAgB,mCAAmC,aAAa,KAAK,IAAI,SAAS,WAAW,KAAK;AACxG,uBAAe,MAAM,cAAc;AAAA,UAClC,GAAG,aAAa,KAAK;AAAA,UACrB,SAAS;AAAA,QACd,CAAK;AAAA,MACF,WAAW,gBAAgB,YAAY,GAAG;AACzC,cAAM,cAAc,mCAAmC,aAAa,KAAK,IAAI,WAAW,WAAW,KAAK;AACxG,uBAAe,MAAM,cAAc;AAAA,UAClC,GAAG,aAAa,KAAK;AAAA,UACrB,WAAW;AAAA,QAChB,CAAK;AAAA,MACF,WAAW,gBAAgB,YAAY,GAAG;AACzC,cAAM,cAAc,mCAAmC,aAAa,KAAK,IAAI,WAAW,WAAW,KAAK;AACxG,uBAAe,MAAM,cAAc;AAAA,UAClC,GAAG,aAAa,KAAK;AAAA,UACrB,WAAW;AAAA,QAChB,CAAK;AAAA,MACF;AAAA,IACD;AACA,UAAM,OAAO,eAAe,IAAI,MAAM;AACtC,QAAI,KAAM,gBAAe,IAAI,cAAc,IAAI;AAC/C,UAAM,IAAI,QAAQ,YAAY;AAC9B,WAAO;AAAA,EACR;AACA,QAAM,IAAI,MAAM,yDAAyD;AAC1E;AAUA,SAAS,+BAA+B,QAAQ,YAAY,OAAO;AAClE,QAAM,QAAwB,oBAAI,QAAO;AACzC,SAAO,mCAAmC,QAAQ,WAAW,KAAK;AACnE;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index.es105.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/async_caller.js"],"sourcesContent":["import { __export } from \"../_virtual/rolldown_runtime.js\";\nimport { getAbortSignalError } from \"./signal.js\";\nimport { pRetry } from \"./p-retry/index.js\";\nimport PQueueMod from \"p-queue\";\n\n//#region src/utils/async_caller.ts\nvar async_caller_exports = {};\n__export(async_caller_exports, { AsyncCaller: () => AsyncCaller });\nconst STATUS_NO_RETRY = [\n\t400,\n\t401,\n\t402,\n\t403,\n\t404,\n\t405,\n\t406,\n\t407,\n\t409\n];\nconst defaultFailedAttemptHandler = (error) => {\n\tif (error.message.startsWith(\"Cancel\") || error.message.startsWith(\"AbortError\") || error.name === \"AbortError\") throw error;\n\tif (error?.code === \"ECONNABORTED\") throw error;\n\tconst status = error?.response?.status ?? error?.status;\n\tif (status && STATUS_NO_RETRY.includes(+status)) throw error;\n\tif (error?.error?.code === \"insufficient_quota\") {\n\t\tconst err = new Error(error?.message);\n\t\terr.name = \"InsufficientQuotaError\";\n\t\tthrow err;\n\t}\n};\n/**\n* A class that can be used to make async calls with concurrency and retry logic.\n*\n* This is useful for making calls to any kind of \"expensive\" external resource,\n* be it because it's rate-limited, subject to network issues, etc.\n*\n* Concurrent calls are limited by the `maxConcurrency` parameter, which defaults\n* to `Infinity`. This means that by default, all calls will be made in parallel.\n*\n* Retries are limited by the `maxRetries` parameter, which defaults to 6. This\n* means that by default, each call will be retried up to 6 times, with an\n* exponential backoff between each attempt.\n*/\nvar AsyncCaller = class {\n\tmaxConcurrency;\n\tmaxRetries;\n\tonFailedAttempt;\n\tqueue;\n\tconstructor(params) {\n\t\tthis.maxConcurrency = params.maxConcurrency ?? Infinity;\n\t\tthis.maxRetries = params.maxRetries ?? 6;\n\t\tthis.onFailedAttempt = params.onFailedAttempt ?? defaultFailedAttemptHandler;\n\t\tconst PQueue = \"default\" in PQueueMod ? PQueueMod.default : PQueueMod;\n\t\tthis.queue = new PQueue({ concurrency: this.maxConcurrency });\n\t}\n\tasync call(callable, ...args) {\n\t\treturn this.queue.add(() => pRetry(() => callable(...args).catch((error) => {\n\t\t\tif (error instanceof Error) throw error;\n\t\t\telse throw new Error(error);\n\t\t}), {\n\t\t\tonFailedAttempt: ({ error }) => this.onFailedAttempt?.(error),\n\t\t\tretries: this.maxRetries,\n\t\t\trandomize: true\n\t\t}), { throwOnTimeout: true });\n\t}\n\tcallWithOptions(options, callable, ...args) {\n\t\tif (options.signal) {\n\t\t\tlet listener;\n\t\t\treturn Promise.race([this.call(callable, ...args), new Promise((_, reject) => {\n\t\t\t\tlistener = () => {\n\t\t\t\t\treject(getAbortSignalError(options.signal));\n\t\t\t\t};\n\t\t\t\toptions.signal?.addEventListener(\"abort\", listener);\n\t\t\t})]).finally(() => {\n\t\t\t\tif (options.signal && listener) options.signal.removeEventListener(\"abort\", listener);\n\t\t\t});\n\t\t}\n\t\treturn this.call(callable, ...args);\n\t}\n\tfetch(...args) {\n\t\treturn this.call(() => fetch(...args).then((res) => res.ok ? res : Promise.reject(res)));\n\t}\n};\n\n//#endregion\nexport { AsyncCaller, async_caller_exports };\n//# sourceMappingURL=async_caller.js.map"],"names":[],"mappings":";;;;AAMG,IAAC,uBAAuB,CAAA;AAC3B,SAAS,sBAAsB,EAAE,aAAa,MAAM,YAAW,CAAE;AACjE,MAAM,kBAAkB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AACA,MAAM,8BAA8B,CAAC,UAAU;AAC9C,MAAI,MAAM,QAAQ,WAAW,QAAQ,KAAK,MAAM,QAAQ,WAAW,YAAY,KAAK,MAAM,SAAS,aAAc,OAAM;AACvH,MAAI,OAAO,SAAS,eAAgB,OAAM;AAC1C,QAAM,SAAS,OAAO,UAAU,UAAU,OAAO;AACjD,MAAI,UAAU,gBAAgB,SAAS,CAAC,MAAM,EAAG,OAAM;AACvD,MAAI,OAAO,OAAO,SAAS,sBAAsB;AAChD,UAAM,MAAM,IAAI,MAAM,OAAO,OAAO;AACpC,QAAI,OAAO;AACX,UAAM;AAAA,EACP;AACD;AAcG,IAAC,cAAc,MAAM;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY,QAAQ;AACnB,SAAK,iBAAiB,OAAO,kBAAkB;AAC/C,SAAK,aAAa,OAAO,cAAc;AACvC,SAAK,kBAAkB,OAAO,mBAAmB;AACjD,UAAM,SAAS,aAAa,YAA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ermaidImage } from "./index.es136.js";
4
- import { toJsonSchema } from "./index.es137.js";
5
- import { validate, v4 } from "uuid";
6
- var graph_exports = {};
7
- __export(graph_exports, { Graph: () => Graph });
8
- function nodeDataStr(id, data) {
9
- if (id !== void 0 && !validate(id)) return id;
10
- else if (isRunnableInterface(data)) try {
11
- let dataStr = data.getName();
12
- dataStr = dataStr.startsWith("Runnable") ? dataStr.slice(8) : dataStr;
13
- return dataStr;
14
- } catch {
15
- return data.getName();
16
- }
17
- else return data.name ?? "UnknownSchema";
18
- }
19
- function nodeDataJson(node) {
20
- if (isRunnableInterface(node.data)) return {
21
- type: "runnable",
22
- data: {
23
- id: node.data.lc_id,
24
- name: node.data.getName()
25
- }
26
- };
27
- else return {
28
- type: "schema",
29
- data: {
30
- ...toJsonSchema(node.data.schema),
31
- title: node.data.name
32
- }
33
- };
34
- }
35
- var Graph = class Graph2 {
36
- nodes = {};
37
- edges = [];
38
- constructor(params) {
39
- this.nodes = params?.nodes ?? this.nodes;
40
- this.edges = params?.edges ?? this.edges;
41
- }
42
- toJSON() {
43
- const stableNodeIds = {};
44
- Object.values(this.nodes).forEach((node, i) => {
45
- stableNodeIds[node.id] = validate(node.id) ? i : node.id;
46
- });
47
- return {
48
- nodes: Object.values(this.nodes).map((node) => ({
49
- id: stableNodeIds[node.id],
50
- ...nodeDataJson(node)
51
- })),
52
- edges: this.edges.map((edge) => {
53
- const item = {
54
- source: stableNodeIds[edge.source],
55
- target: stableNodeIds[edge.target]
56
- };
57
- if (typeof edge.data !== "undefined") item.data = edge.data;
58
- if (typeof edge.conditional !== "undefined") item.conditional = edge.conditional;
59
- return item;
60
- })
61
- };
62
- }
63
- addNode(data, id, metadata) {
64
- if (id !== void 0 && this.nodes[id] !== void 0) throw new Error(`Node with id ${id} already exists`);
65
- const nodeId = id ?? v4();
66
- const node = {
67
- id: nodeId,
68
- data,
69
- name: nodeDataStr(id, data),
70
- metadata
71
- };
72
- this.nodes[nodeId] = node;
73
- return node;
74
- }
75
- removeNode(node) {
76
- delete this.nodes[node.id];
77
- this.edges = this.edges.filter((edge) => edge.source !== node.id && edge.target !== node.id);
78
- }
79
- addEdge(source, target, data, conditional) {
80
- if (this.nodes[source.id] === void 0) throw new Error(`Source node ${source.id} not in graph`);
81
- if (this.nodes[target.id] === void 0) throw new Error(`Target node ${target.id} not in graph`);
82
- const edge = {
83
- source: source.id,
84
- target: target.id,
85
- data,
86
- conditional
87
- };
88
- this.edges.push(edge);
89
- return edge;
90
- }
91
- firstNode() {
92
- return _firstNode(this);
93
- }
94
- lastNode() {
95
- return _lastNode(this);
96
- }
97
- /**
98
- * Add all nodes and edges from another graph.
99
- * Note this doesn't check for duplicates, nor does it connect the graphs.
100
- */
101
- extend(graph, prefix = "") {
102
- let finalPrefix = prefix;
103
- const nodeIds = Object.values(graph.nodes).map((node) => node.id);
104
- if (nodeIds.every(validate)) finalPrefix = "";
105
- const prefixed = (id) => {
106
- return finalPrefix ? `${finalPrefix}:${id}` : id;
107
- };
108
- Object.entries(graph.nodes).forEach(([key, value]) => {
109
- this.nodes[prefixed(key)] = {
110
- ...value,
111
- id: prefixed(key)
112
- };
113
- });
114
- const newEdges = graph.edges.map((edge) => {
115
- return {
116
- ...edge,
117
- source: prefixed(edge.source),
118
- target: prefixed(edge.target)
119
- };
120
- });
121
- this.edges = [...this.edges, ...newEdges];
122
- const first = graph.firstNode();
123
- const last = graph.lastNode();
124
- return [first ? {
125
- id: prefixed(first.id),
126
- data: first.data
127
- } : void 0, last ? {
128
- id: prefixed(last.id),
129
- data: last.data
130
- } : void 0];
131
- }
132
- trimFirstNode() {
133
- const firstNode = this.firstNode();
134
- if (firstNode && _firstNode(this, [firstNode.id])) this.removeNode(firstNode);
135
- }
136
- trimLastNode() {
137
- const lastNode = this.lastNode();
138
- if (lastNode && _lastNode(this, [lastNode.id])) this.removeNode(lastNode);
1
+ import { BaseTracer } from "./index.es128.js";
2
+ var RootListenersTracer = class extends BaseTracer {
3
+ name = "RootListenersTracer";
4
+ /** The Run's ID. Type UUID */
5
+ rootId;
6
+ config;
7
+ argOnStart;
8
+ argOnEnd;
9
+ argOnError;
10
+ constructor({ config, onStart, onEnd, onError }) {
11
+ super({ _awaitHandler: true });
12
+ this.config = config;
13
+ this.argOnStart = onStart;
14
+ this.argOnEnd = onEnd;
15
+ this.argOnError = onError;
139
16
  }
140
17
  /**
141
- * Return a new graph with all nodes re-identified,
142
- * using their unique, readable names where possible.
18
+ * This is a legacy method only called once for an entire run tree
19
+ * therefore not useful here
20
+ * @param {Run} _ Not used
143
21
  */
144
- reid() {
145
- const nodeLabels = Object.fromEntries(Object.values(this.nodes).map((node) => [node.id, node.name]));
146
- const nodeLabelCounts = /* @__PURE__ */ new Map();
147
- Object.values(nodeLabels).forEach((label) => {
148
- nodeLabelCounts.set(label, (nodeLabelCounts.get(label) || 0) + 1);
149
- });
150
- const getNodeId = (nodeId) => {
151
- const label = nodeLabels[nodeId];
152
- if (validate(nodeId) && nodeLabelCounts.get(label) === 1) return label;
153
- else return nodeId;
154
- };
155
- return new Graph2({
156
- nodes: Object.fromEntries(Object.entries(this.nodes).map(([id, node]) => [getNodeId(id), {
157
- ...node,
158
- id: getNodeId(id)
159
- }])),
160
- edges: this.edges.map((edge) => ({
161
- ...edge,
162
- source: getNodeId(edge.source),
163
- target: getNodeId(edge.target)
164
- }))
165
- });
22
+ persistRun(_) {
23
+ return Promise.resolve();
166
24
  }
167
- drawMermaid(params) {
168
- const { withStyles, curveStyle, nodeColors = {
169
- default: "fill:#f2f0ff,line-height:1.2",
170
- first: "fill-opacity:0",
171
- last: "fill:#bfb6fc"
172
- }, wrapLabelNWords } = params ?? {};
173
- const graph = this.reid();
174
- const firstNode = graph.firstNode();
175
- const lastNode = graph.lastNode();
176
- return drawMermaid(graph.nodes, graph.edges, {
177
- firstNode: firstNode?.id,
178
- lastNode: lastNode?.id,
179
- withStyles,
180
- curveStyle,
181
- nodeColors,
182
- wrapLabelNWords
183
- });
25
+ async onRunCreate(run) {
26
+ if (this.rootId) return;
27
+ this.rootId = run.id;
28
+ if (this.argOnStart) await this.argOnStart(run, this.config);
184
29
  }
185
- async drawMermaidPng(params) {
186
- const mermaidSyntax = this.drawMermaid(params);
187
- return drawMermaidImage(mermaidSyntax, { backgroundColor: params?.backgroundColor });
30
+ async onRunUpdate(run) {
31
+ if (run.id !== this.rootId) return;
32
+ if (!run.error) {
33
+ if (this.argOnEnd) await this.argOnEnd(run, this.config);
34
+ } else if (this.argOnError) await this.argOnError(run, this.config);
188
35
  }
189
36
  };
190
- function _firstNode(graph, exclude = []) {
191
- const targets = new Set(graph.edges.filter((edge) => !exclude.includes(edge.source)).map((edge) => edge.target));
192
- const found = [];
193
- for (const node of Object.values(graph.nodes)) if (!exclude.includes(node.id) && !targets.has(node.id)) found.push(node);
194
- return found.length === 1 ? found[0] : void 0;
195
- }
196
- function _lastNode(graph, exclude = []) {
197
- const sources = new Set(graph.edges.filter((edge) => !exclude.includes(edge.target)).map((edge) => edge.source));
198
- const found = [];
199
- for (const node of Object.values(graph.nodes)) if (!exclude.includes(node.id) && !sources.has(node.id)) found.push(node);
200
- return found.length === 1 ? found[0] : void 0;
201
- }
202
37
  export {
203
- Graph,
204
- graph_exports
38
+ RootListenersTracer
205
39
  };
206
40
  //# sourceMappingURL=index.es106.js.map