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,5 +1,194 @@
1
- var gruvboxLight = {};
1
+ import { __export } from "./index.es56.js";
2
+ import { BaseTracer } from "./index.es128.js";
3
+ import styles from "./index.es266.js";
4
+ var console_exports = {};
5
+ __export(console_exports, { ConsoleCallbackHandler: () => ConsoleCallbackHandler });
6
+ function wrap(style, text) {
7
+ return `${style.open}${text}${style.close}`;
8
+ }
9
+ function tryJsonStringify(obj, fallback) {
10
+ try {
11
+ return JSON.stringify(obj, null, 2);
12
+ } catch {
13
+ return fallback;
14
+ }
15
+ }
16
+ function formatKVMapItem(value) {
17
+ if (typeof value === "string") return value.trim();
18
+ if (value === null || value === void 0) return value;
19
+ return tryJsonStringify(value, value.toString());
20
+ }
21
+ function elapsed(run) {
22
+ if (!run.end_time) return "";
23
+ const elapsed$1 = run.end_time - run.start_time;
24
+ if (elapsed$1 < 1e3) return `${elapsed$1}ms`;
25
+ return `${(elapsed$1 / 1e3).toFixed(2)}s`;
26
+ }
27
+ const { color } = styles;
28
+ var ConsoleCallbackHandler = class extends BaseTracer {
29
+ name = "console_callback_handler";
30
+ /**
31
+ * Method used to persist the run. In this case, it simply returns a
32
+ * resolved promise as there's no persistence logic.
33
+ * @param _run The run to persist.
34
+ * @returns A resolved promise.
35
+ */
36
+ persistRun(_run) {
37
+ return Promise.resolve();
38
+ }
39
+ /**
40
+ * Method used to get all the parent runs of a given run.
41
+ * @param run The run whose parents are to be retrieved.
42
+ * @returns An array of parent runs.
43
+ */
44
+ getParents(run) {
45
+ const parents = [];
46
+ let currentRun = run;
47
+ while (currentRun.parent_run_id) {
48
+ const parent = this.runMap.get(currentRun.parent_run_id);
49
+ if (parent) {
50
+ parents.push(parent);
51
+ currentRun = parent;
52
+ } else break;
53
+ }
54
+ return parents;
55
+ }
56
+ /**
57
+ * Method used to get a string representation of the run's lineage, which
58
+ * is used in logging.
59
+ * @param run The run whose lineage is to be retrieved.
60
+ * @returns A string representation of the run's lineage.
61
+ */
62
+ getBreadcrumbs(run) {
63
+ const parents = this.getParents(run).reverse();
64
+ const string = [...parents, run].map((parent, i, arr) => {
65
+ const name = `${parent.execution_order}:${parent.run_type}:${parent.name}`;
66
+ return i === arr.length - 1 ? wrap(styles.bold, name) : name;
67
+ }).join(" > ");
68
+ return wrap(color.grey, string);
69
+ }
70
+ /**
71
+ * Method used to log the start of a chain run.
72
+ * @param run The chain run that has started.
73
+ * @returns void
74
+ */
75
+ onChainStart(run) {
76
+ const crumbs = this.getBreadcrumbs(run);
77
+ console.log(`${wrap(color.green, "[chain/start]")} [${crumbs}] Entering Chain run with input: ${tryJsonStringify(run.inputs, "[inputs]")}`);
78
+ }
79
+ /**
80
+ * Method used to log the end of a chain run.
81
+ * @param run The chain run that has ended.
82
+ * @returns void
83
+ */
84
+ onChainEnd(run) {
85
+ const crumbs = this.getBreadcrumbs(run);
86
+ console.log(`${wrap(color.cyan, "[chain/end]")} [${crumbs}] [${elapsed(run)}] Exiting Chain run with output: ${tryJsonStringify(run.outputs, "[outputs]")}`);
87
+ }
88
+ /**
89
+ * Method used to log any errors of a chain run.
90
+ * @param run The chain run that has errored.
91
+ * @returns void
92
+ */
93
+ onChainError(run) {
94
+ const crumbs = this.getBreadcrumbs(run);
95
+ console.log(`${wrap(color.red, "[chain/error]")} [${crumbs}] [${elapsed(run)}] Chain run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
96
+ }
97
+ /**
98
+ * Method used to log the start of an LLM run.
99
+ * @param run The LLM run that has started.
100
+ * @returns void
101
+ */
102
+ onLLMStart(run) {
103
+ const crumbs = this.getBreadcrumbs(run);
104
+ const inputs = "prompts" in run.inputs ? { prompts: run.inputs.prompts.map((p) => p.trim()) } : run.inputs;
105
+ console.log(`${wrap(color.green, "[llm/start]")} [${crumbs}] Entering LLM run with input: ${tryJsonStringify(inputs, "[inputs]")}`);
106
+ }
107
+ /**
108
+ * Method used to log the end of an LLM run.
109
+ * @param run The LLM run that has ended.
110
+ * @returns void
111
+ */
112
+ onLLMEnd(run) {
113
+ const crumbs = this.getBreadcrumbs(run);
114
+ console.log(`${wrap(color.cyan, "[llm/end]")} [${crumbs}] [${elapsed(run)}] Exiting LLM run with output: ${tryJsonStringify(run.outputs, "[response]")}`);
115
+ }
116
+ /**
117
+ * Method used to log any errors of an LLM run.
118
+ * @param run The LLM run that has errored.
119
+ * @returns void
120
+ */
121
+ onLLMError(run) {
122
+ const crumbs = this.getBreadcrumbs(run);
123
+ console.log(`${wrap(color.red, "[llm/error]")} [${crumbs}] [${elapsed(run)}] LLM run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
124
+ }
125
+ /**
126
+ * Method used to log the start of a tool run.
127
+ * @param run The tool run that has started.
128
+ * @returns void
129
+ */
130
+ onToolStart(run) {
131
+ const crumbs = this.getBreadcrumbs(run);
132
+ console.log(`${wrap(color.green, "[tool/start]")} [${crumbs}] Entering Tool run with input: "${formatKVMapItem(run.inputs.input)}"`);
133
+ }
134
+ /**
135
+ * Method used to log the end of a tool run.
136
+ * @param run The tool run that has ended.
137
+ * @returns void
138
+ */
139
+ onToolEnd(run) {
140
+ const crumbs = this.getBreadcrumbs(run);
141
+ console.log(`${wrap(color.cyan, "[tool/end]")} [${crumbs}] [${elapsed(run)}] Exiting Tool run with output: "${formatKVMapItem(run.outputs?.output)}"`);
142
+ }
143
+ /**
144
+ * Method used to log any errors of a tool run.
145
+ * @param run The tool run that has errored.
146
+ * @returns void
147
+ */
148
+ onToolError(run) {
149
+ const crumbs = this.getBreadcrumbs(run);
150
+ console.log(`${wrap(color.red, "[tool/error]")} [${crumbs}] [${elapsed(run)}] Tool run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
151
+ }
152
+ /**
153
+ * Method used to log the start of a retriever run.
154
+ * @param run The retriever run that has started.
155
+ * @returns void
156
+ */
157
+ onRetrieverStart(run) {
158
+ const crumbs = this.getBreadcrumbs(run);
159
+ console.log(`${wrap(color.green, "[retriever/start]")} [${crumbs}] Entering Retriever run with input: ${tryJsonStringify(run.inputs, "[inputs]")}`);
160
+ }
161
+ /**
162
+ * Method used to log the end of a retriever run.
163
+ * @param run The retriever run that has ended.
164
+ * @returns void
165
+ */
166
+ onRetrieverEnd(run) {
167
+ const crumbs = this.getBreadcrumbs(run);
168
+ console.log(`${wrap(color.cyan, "[retriever/end]")} [${crumbs}] [${elapsed(run)}] Exiting Retriever run with output: ${tryJsonStringify(run.outputs, "[outputs]")}`);
169
+ }
170
+ /**
171
+ * Method used to log any errors of a retriever run.
172
+ * @param run The retriever run that has errored.
173
+ * @returns void
174
+ */
175
+ onRetrieverError(run) {
176
+ const crumbs = this.getBreadcrumbs(run);
177
+ console.log(`${wrap(color.red, "[retriever/error]")} [${crumbs}] [${elapsed(run)}] Retriever run errored with error: ${tryJsonStringify(run.error, "[error]")}`);
178
+ }
179
+ /**
180
+ * Method used to log the action selected by the agent.
181
+ * @param run The run in which the agent action occurred.
182
+ * @returns void
183
+ */
184
+ onAgentAction(run) {
185
+ const agentRun = run;
186
+ const crumbs = this.getBreadcrumbs(run);
187
+ console.log(`${wrap(color.blue, "[agent/action]")} [${crumbs}] Agent selected action: ${tryJsonStringify(agentRun.actions[agentRun.actions.length - 1], "[action]")}`);
188
+ }
189
+ };
2
190
  export {
3
- gruvboxLight as __exports
191
+ ConsoleCallbackHandler,
192
+ console_exports
4
193
  };
5
194
  //# sourceMappingURL=index.es238.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es238.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.es238.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/tracers/console.js"],"sourcesContent":["import { __export } from \"../_virtual/rolldown_runtime.js\";\nimport { BaseTracer } from \"./base.js\";\nimport styles from \"ansi-styles\";\n\n//#region src/tracers/console.ts\nvar console_exports = {};\n__export(console_exports, { ConsoleCallbackHandler: () => ConsoleCallbackHandler });\nfunction wrap(style, text) {\n\treturn `${style.open}${text}${style.close}`;\n}\nfunction tryJsonStringify(obj, fallback) {\n\ttry {\n\t\treturn JSON.stringify(obj, null, 2);\n\t} catch {\n\t\treturn fallback;\n\t}\n}\nfunction formatKVMapItem(value) {\n\tif (typeof value === \"string\") return value.trim();\n\tif (value === null || value === void 0) return value;\n\treturn tryJsonStringify(value, value.toString());\n}\nfunction elapsed(run) {\n\tif (!run.end_time) return \"\";\n\tconst elapsed$1 = run.end_time - run.start_time;\n\tif (elapsed$1 < 1e3) return `${elapsed$1}ms`;\n\treturn `${(elapsed$1 / 1e3).toFixed(2)}s`;\n}\nconst { color } = styles;\n/**\n* A tracer that logs all events to the console. It extends from the\n* `BaseTracer` class and overrides its methods to provide custom logging\n* functionality.\n* @example\n* ```typescript\n*\n* const llm = new ChatAnthropic({\n* temperature: 0,\n* tags: [\"example\", \"callbacks\", \"constructor\"],\n* callbacks: [new ConsoleCallbackHandler()],\n* });\n*\n* ```\n*/\nvar ConsoleCallbackHandler = class extends BaseTracer {\n\tname = \"console_callback_handler\";\n\t/**\n\t* Method used to persist the run. In this case, it simply returns a\n\t* resolved promise as there's no persistence logic.\n\t* @param _run The run to persist.\n\t* @returns A resolved promise.\n\t*/\n\tpersistRun(_run) {\n\t\treturn Promise.resolve();\n\t}\n\t/**\n\t* Method used to get all the parent runs of a given run.\n\t* @param run The run whose parents are to be retrieved.\n\t* @returns An array of parent runs.\n\t*/\n\tgetParents(run) {\n\t\tconst parents = [];\n\t\tlet currentRun = run;\n\t\twhile (currentRun.parent_run_id) {\n\t\t\tconst parent = this.runMap.get(currentRun.parent_run_id);\n\t\t\tif (parent) {\n\t\t\t\tparents.push(parent);\n\t\t\t\tcurrentRun = parent;\n\t\t\t} else break;\n\t\t}\n\t\treturn parents;\n\t}\n\t/**\n\t* Method used to get a string representation of the run's lineage, which\n\t* is used in logging.\n\t* @param run The run whose lineage is to be retrieved.\n\t* @returns A string representation of the run's lineage.\n\t*/\n\tgetBreadcrumbs(run) {\n\t\tconst parents = this.getParents(run).reverse();\n\t\tconst string = [...parents, run].map((parent, i, arr) => {\n\t\t\tconst name = `${parent.execution_order}:${parent.run_type}:${parent.name}`;\n\t\t\treturn i === arr.length - 1 ? wrap(styles.bold, name) : name;\n\t\t}).join(\" > \");\n\t\treturn wrap(color.grey, string);\n\t}\n\t/**\n\t* Method used to log the start of a chain run.\n\t* @param run The chain run that has started.\n\t* @returns void\n\t*/\n\tonChainStart(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.green, \"[chain/start]\")} [${crumbs}] Entering Chain run with input: ${tryJsonStringify(run.inputs, \"[inputs]\")}`);\n\t}\n\t/**\n\t* Method used to log the end of a chain run.\n\t* @param run The chain run that has ended.\n\t* @returns void\n\t*/\n\tonChainEnd(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.cyan, \"[chain/end]\")} [${crumbs}] [${elapsed(run)}] Exiting Chain run with output: ${tryJsonStringify(run.outputs, \"[outputs]\")}`);\n\t}\n\t/**\n\t* Method used to log any errors of a chain run.\n\t* @param run The chain run that has errored.\n\t* @returns void\n\t*/\n\tonChainError(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.red, \"[chain/error]\")} [${crumbs}] [${elapsed(run)}] Chain run errored with error: ${tryJsonStringify(run.error, \"[error]\")}`);\n\t}\n\t/**\n\t* Method used to log the start of an LLM run.\n\t* @param run The LLM run that has started.\n\t* @returns void\n\t*/\n\tonLLMStart(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconst inputs = \"prompts\" in run.inputs ? { prompts: run.inputs.prompts.map((p) => p.trim()) } : run.inputs;\n\t\tconsole.log(`${wrap(color.green, \"[llm/start]\")} [${crumbs}] Entering LLM run with input: ${tryJsonStringify(inputs, \"[inputs]\")}`);\n\t}\n\t/**\n\t* Method used to log the end of an LLM run.\n\t* @param run The LLM run that has ended.\n\t* @returns void\n\t*/\n\tonLLMEnd(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.cyan, \"[llm/end]\")} [${crumbs}] [${elapsed(run)}] Exiting LLM run with output: ${tryJsonStringify(run.outputs, \"[response]\")}`);\n\t}\n\t/**\n\t* Method used to log any errors of an LLM run.\n\t* @param run The LLM run that has errored.\n\t* @returns void\n\t*/\n\tonLLMError(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.red, \"[llm/error]\")} [${crumbs}] [${elapsed(run)}] LLM run errored with error: ${tryJsonStringify(run.error, \"[error]\")}`);\n\t}\n\t/**\n\t* Method used to log the start of a tool run.\n\t* @param run The tool run that has started.\n\t* @returns void\n\t*/\n\tonToolStart(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.green, \"[tool/start]\")} [${crumbs}] Entering Tool run with input: \"${formatKVMapItem(run.inputs.input)}\"`);\n\t}\n\t/**\n\t* Method used to log the end of a tool run.\n\t* @param run The tool run that has ended.\n\t* @returns void\n\t*/\n\tonToolEnd(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.cyan, \"[tool/end]\")} [${crumbs}] [${elapsed(run)}] Exiting Tool run with output: \"${formatKVMapItem(run.outputs?.output)}\"`);\n\t}\n\t/**\n\t* Method used to log any errors of a tool run.\n\t* @param run The tool run that has errored.\n\t* @returns void\n\t*/\n\tonToolError(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.red, \"[tool/error]\")} [${crumbs}] [${elapsed(run)}] Tool run errored with error: ${tryJsonStringify(run.error, \"[error]\")}`);\n\t}\n\t/**\n\t* Method used to log the start of a retriever run.\n\t* @param run The retriever run that has started.\n\t* @returns void\n\t*/\n\tonRetrieverStart(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.green, \"[retriever/start]\")} [${crumbs}] Entering Retriever run with input: ${tryJsonStringify(run.inputs, \"[inputs]\")}`);\n\t}\n\t/**\n\t* Method used to log the end of a retriever run.\n\t* @param run The retriever run that has ended.\n\t* @returns void\n\t*/\n\tonRetrieverEnd(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.cyan, \"[retriever/end]\")} [${crumbs}] [${elapsed(run)}] Exiting Retriever run with output: ${tryJsonStringify(run.outputs, \"[outputs]\")}`);\n\t}\n\t/**\n\t* Method used to log any errors of a retriever run.\n\t* @param run The retriever run that has errored.\n\t* @returns void\n\t*/\n\tonRetrieverError(run) {\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.red, \"[retriever/error]\")} [${crumbs}] [${elapsed(run)}] Retriever run errored with error: ${tryJsonStringify(run.error, \"[error]\")}`);\n\t}\n\t/**\n\t* Method used to log the action selected by the agent.\n\t* @param run The run in which the agent action occurred.\n\t* @returns void\n\t*/\n\tonAgentAction(run) {\n\t\tconst agentRun = run;\n\t\tconst crumbs = this.getBreadcrumbs(run);\n\t\tconsole.log(`${wrap(color.blue, \"[agent/action]\")} [${crumbs}] Agent selected action: ${tryJsonStringify(agentRun.actions[agentRun.actions.length - 1], \"[action]\")}`);\n\t}\n};\n\n//#endregion\nexport { ConsoleCallbackHandler, console_exports };\n//# sourceMappingURL=console.js.map"],"names":[],"mappings":";;;AAKG,IAAC,kBAAkB,CAAA;AACtB,SAAS,iBAAiB,EAAE,wBAAwB,MAAM,uBAAsB,CAAE;AAClF,SAAS,KAAK,OAAO,MAAM;AAC1B,SAAO,GAAG,MAAM,IAAI,GAAG,IAAI,GAAG,MAAM,KAAK;AAC1C;AACA,SAAS,iBAAiB,KAAK,UAAU;AACxC,MAAI;AACH,WAAO,KAAK,UAAU,KAAK,MAAM,CAAC;AAAA,EACnC,QAAQ;AACP,WAAO;AAAA,EACR;AACD;AACA,SAAS,gBAAgB,OAAO;AAC/B,MAAI,OAAO,UAAU,SAAU,QAAO,MAAM,KAAI;AAChD,MAAI,UAAU,QAAQ,UAAU,OAAQ,QAAO;AAC/C,SAAO,iBAAiB,OAAO,MAAM,SAAQ,CAAE;AAChD;AACA,SAAS,QAAQ,KAAK;AACrB,MAAI,CAAC,IAAI,SAAU,QAAO;AAC1B,QAAM,YAAY,IAAI,WAAW,IAAI;AACrC,MAAI,YAAY,IAAK,QAAO,GAAG,SAAS;AACxC,SAAO,IAAI,YAAY,KAAK,QAAQ,CAAC,CAAC;AACvC;AACA,MAAM,EAAE,MAAK,IAAK;AAgBf,IAAC,yBAAyB,cAAc,WAAW;AAAA,EACrD,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAOP,WAAW,MAAM;AAChB,WAAO,QAAQ,QAAO;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,WAAW,KAAK;AACf,UAAM,UAAU,CAAA;AAChB,QAAI,aAAa;AACjB,WAAO,WAAW,eAAe;AAChC,YAAM,SAAS,KAAK,OAAO,IAAI,WAAW,aAAa;AACvD,UAAI,QAAQ;AACX,g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ACtK;AACD;","x_google_ignoreList":[0]}
@@ -1,5 +1,113 @@
1
- var holiTheme = {};
1
+ import { __export } from "./index.es56.js";
2
+ import { mergeUsageMetadata } from "./index.es59.js";
3
+ import { AIMessage } from "./index.es47.js";
4
+ import { BaseTracer } from "./index.es128.js";
5
+ import { getDefaultLangChainClientSingleton } from "./index.es267.js";
6
+ import { getCurrentRunTree } from "./index.es112.js";
7
+ import { RunTree } from "./index.es125.js";
8
+ import "uuid";
9
+ import "./index.es122.js";
10
+ import "./index.es123.js";
11
+ import "./index.es124.js";
12
+ import { getDefaultProjectName } from "./index.es268.js";
13
+ var tracer_langchain_exports = {};
14
+ __export(tracer_langchain_exports, { LangChainTracer: () => LangChainTracer });
15
+ function _getUsageMetadataFromGenerations(generations) {
16
+ let output = void 0;
17
+ for (const generationBatch of generations) for (const generation of generationBatch) if (AIMessage.isInstance(generation.message) && generation.message.usage_metadata !== void 0) output = mergeUsageMetadata(output, generation.message.usage_metadata);
18
+ return output;
19
+ }
20
+ var LangChainTracer = class LangChainTracer2 extends BaseTracer {
21
+ name = "langchain_tracer";
22
+ projectName;
23
+ exampleId;
24
+ client;
25
+ replicas;
26
+ usesRunTreeMap = true;
27
+ constructor(fields = {}) {
28
+ super(fields);
29
+ const { exampleId, projectName, client, replicas } = fields;
30
+ this.projectName = projectName ?? getDefaultProjectName();
31
+ this.replicas = replicas;
32
+ this.exampleId = exampleId;
33
+ this.client = client ?? getDefaultLangChainClientSingleton();
34
+ const traceableTree = LangChainTracer2.getTraceableRunTree();
35
+ if (traceableTree) this.updateFromRunTree(traceableTree);
36
+ }
37
+ async persistRun(_run) {
38
+ }
39
+ async onRunCreate(run) {
40
+ if (!run.extra?.lc_defers_inputs) {
41
+ const runTree = this.getRunTreeWithTracingConfig(run.id);
42
+ await runTree?.postRun();
43
+ }
44
+ }
45
+ async onRunUpdate(run) {
46
+ const runTree = this.getRunTreeWithTracingConfig(run.id);
47
+ if (run.extra?.lc_defers_inputs) await runTree?.postRun();
48
+ else await runTree?.patchRun();
49
+ }
50
+ onLLMEnd(run) {
51
+ const outputs = run.outputs;
52
+ if (outputs?.generations) {
53
+ const usageMetadata = _getUsageMetadataFromGenerations(outputs.generations);
54
+ if (usageMetadata !== void 0) {
55
+ run.extra = run.extra ?? {};
56
+ const metadata = run.extra.metadata ?? {};
57
+ metadata.usage_metadata = usageMetadata;
58
+ run.extra.metadata = metadata;
59
+ }
60
+ }
61
+ }
62
+ getRun(id) {
63
+ return this.runTreeMap.get(id);
64
+ }
65
+ updateFromRunTree(runTree) {
66
+ this.runTreeMap.set(runTree.id, runTree);
67
+ let rootRun = runTree;
68
+ const visited = /* @__PURE__ */ new Set();
69
+ while (rootRun.parent_run) {
70
+ if (visited.has(rootRun.id)) break;
71
+ visited.add(rootRun.id);
72
+ if (!rootRun.parent_run) break;
73
+ rootRun = rootRun.parent_run;
74
+ }
75
+ visited.clear();
76
+ const queue = [rootRun];
77
+ while (queue.length > 0) {
78
+ const current = queue.shift();
79
+ if (!current || visited.has(current.id)) continue;
80
+ visited.add(current.id);
81
+ this.runTreeMap.set(current.id, current);
82
+ if (current.child_runs) queue.push(...current.child_runs);
83
+ }
84
+ this.client = runTree.client ?? this.client;
85
+ this.replicas = runTree.replicas ?? this.replicas;
86
+ this.projectName = runTree.project_name ?? this.projectName;
87
+ this.exampleId = runTree.reference_example_id ?? this.exampleId;
88
+ }
89
+ getRunTreeWithTracingConfig(id) {
90
+ const runTree = this.runTreeMap.get(id);
91
+ if (!runTree) return void 0;
92
+ return new RunTree({
93
+ ...runTree,
94
+ client: this.client,
95
+ project_name: this.projectName,
96
+ replicas: this.replicas,
97
+ reference_example_id: this.exampleId,
98
+ tracingEnabled: true
99
+ });
100
+ }
101
+ static getTraceableRunTree() {
102
+ try {
103
+ return getCurrentRunTree(true);
104
+ } catch {
105
+ return void 0;
106
+ }
107
+ }
108
+ };
2
109
  export {
3
- holiTheme as __exports
110
+ LangChainTracer,
111
+ tracer_langchain_exports
4
112
  };
5
113
  //# sourceMappingURL=index.es239.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es239.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.es239.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/tracers/tracer_langchain.js"],"sourcesContent":["import { __export } from \"../_virtual/rolldown_runtime.js\";\nimport { mergeUsageMetadata } from \"../messages/metadata.js\";\nimport { AIMessage } from \"../messages/ai.js\";\nimport { BaseTracer } from \"./base.js\";\nimport { getDefaultLangChainClientSingleton } from \"../singletons/tracer.js\";\nimport { getCurrentRunTree } from \"langsmith/singletons/traceable\";\nimport { RunTree } from \"langsmith/run_trees\";\nimport { getDefaultProjectName } from \"langsmith\";\n\n//#region src/tracers/tracer_langchain.ts\nvar tracer_langchain_exports = {};\n__export(tracer_langchain_exports, { LangChainTracer: () => LangChainTracer });\n/**\n* Extract usage_metadata from chat generations.\n*\n* Iterates through generations to find and aggregates all usage_metadata\n* found in chat messages. This is typically present in chat model outputs.\n*/\nfunction _getUsageMetadataFromGenerations(generations) {\n\tlet output = void 0;\n\tfor (const generationBatch of generations) for (const generation of generationBatch) if (AIMessage.isInstance(generation.message) && generation.message.usage_metadata !== void 0) output = mergeUsageMetadata(output, generation.message.usage_metadata);\n\treturn output;\n}\nvar LangChainTracer = class LangChainTracer extends BaseTracer {\n\tname = \"langchain_tracer\";\n\tprojectName;\n\texampleId;\n\tclient;\n\treplicas;\n\tusesRunTreeMap = true;\n\tconstructor(fields = {}) {\n\t\tsuper(fields);\n\t\tconst { exampleId, projectName, client, replicas } = fields;\n\t\tthis.projectName = projectName ?? getDefaultProjectName();\n\t\tthis.replicas = replicas;\n\t\tthis.exampleId = exampleId;\n\t\tthis.client = client ?? getDefaultLangChainClientSingleton();\n\t\tconst traceableTree = LangChainTracer.getTraceableRunTree();\n\t\tif (traceableTree) this.updateFromRunTree(traceableTree);\n\t}\n\tasync persistRun(_run) {}\n\tasync onRunCreate(run) {\n\t\tif (!run.extra?.lc_defers_inputs) {\n\t\t\tconst runTree = this.getRunTreeWithTracingConfig(run.id);\n\t\t\tawait runTree?.postRun();\n\t\t}\n\t}\n\tasync onRunUpdate(run) {\n\t\tconst runTree = this.getRunTreeWithTracingConfig(run.id);\n\t\tif (run.extra?.lc_defers_inputs) await runTree?.postRun();\n\t\telse await runTree?.patchRun();\n\t}\n\tonLLMEnd(run) {\n\t\tconst outputs = run.outputs;\n\t\tif (outputs?.generations) {\n\t\t\tconst usageMetadata = _getUsageMetadataFromGenerations(outputs.generations);\n\t\t\tif (usageMetadata !== void 0) {\n\t\t\t\trun.extra = run.extra ?? {};\n\t\t\t\tconst metadata = run.extra.metadata ?? {};\n\t\t\t\tmetadata.usage_metadata = usageMetadata;\n\t\t\t\trun.extra.metadata = metadata;\n\t\t\t}\n\t\t}\n\t}\n\tgetRun(id) {\n\t\treturn this.runTreeMap.get(id);\n\t}\n\tupdateFromRunTree(runTree) {\n\t\tthis.runTreeMap.set(runTree.id, runTree);\n\t\tlet rootRun = runTree;\n\t\tconst visited = /* @__PURE__ */ new Set();\n\t\twhile (rootRun.parent_run) {\n\t\t\tif (visited.has(rootRun.id)) break;\n\t\t\tvisited.add(rootRun.id);\n\t\t\tif (!rootRun.parent_run) break;\n\t\t\trootRun = rootRun.parent_run;\n\t\t}\n\t\tvisited.clear();\n\t\tconst queue = [rootRun];\n\t\twhile (queue.length > 0) {\n\t\t\tconst current = queue.shift();\n\t\t\tif (!current || visited.has(current.id)) continue;\n\t\t\tvisited.add(current.id);\n\t\t\tthis.runTreeMap.set(current.id, current);\n\t\t\tif (current.child_runs) queue.push(...current.child_runs);\n\t\t}\n\t\tthis.client = runTree.client ?? this.client;\n\t\tthis.replicas = runTree.replicas ?? this.replicas;\n\t\tthis.projectName = runTree.project_name ?? this.projectName;\n\t\tthis.exampleId = runTree.reference_example_id ?? this.exampleId;\n\t}\n\tgetRunTreeWithTracingConfig(id) {\n\t\tconst runTree = this.runTreeMap.get(id);\n\t\tif (!runTree) return void 0;\n\t\treturn new RunTree({\n\t\t\t...runTree,\n\t\t\tclient: this.client,\n\t\t\tproject_name: this.projectName,\n\t\t\treplicas: this.replicas,\n\t\t\treference_example_id: this.exampleId,\n\t\t\ttracingEnabled: true\n\t\t});\n\t}\n\tstatic getTraceableRunTree() {\n\t\ttry {\n\t\t\treturn getCurrentRunTree(true);\n\t\t} catch {\n\t\t\treturn void 0;\n\t\t}\n\t}\n};\n\n//#endregion\nexport { LangChainTracer, tracer_langchain_exports };\n//# sourceMappingURL=tracer_langchain.js.map"],"names":["LangChainTracer"],"mappings":";;;;;;;;;;;;AAUG,IAAC,2BAA2B,CAAA;AAC/B,SAAS,0BAA0B,EAAE,iBAAiB,MAAM,gBAAe,CAAE;AAO7E,SAAS,iCAAiC,aAAa;AACtD,MAAI,SAAS;AACb,aAAW,mBAAmB,YAAa,YAAW,cAAc,gBAAiB,KAAI,UAAU,WAAW,WAAW,OAAO,KAAK,WAAW,QAAQ,mBAAmB,OAAQ,UAAS,mBAAmB,QAAQ,WAAW,QAAQ,cAAc;AACxP,SAAO;AACR;AACG,IAAC,kBAAkB,MAAMA,yBAAwB,WAAW;AAAA,EAC9D,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,iBAAiB;AAAA,EACjB,YAAY,SAAS,IAAI;AACxB,UAAM,MAAM;AACZ,UAAM,EAAE,WAAW,aAAa,QAAQ,SAAQ,IAAK;AACrD,SAAK,cAAc,eAAe,sBAAqB;AACvD,SAAK,WAAW;AAChB,SAAK,YAAY;AACjB,SAAK,SAAS,UAAU,mCAAkC;AAC1D,UAAM,gBAAgBA,iBAAgB,oBAAmB;AACzD,QAAI,cAAe,MAAK,kBAAkB,aAAa;AAAA,EACxD;AAAA,EACA,MAAM,WAAW,MAAM;AAAA,EAAC;AAAA,EACxB,MAAM,YAAY,KAAK;AACtB,QAAI,CAAC,IAAI,OAAO,kBAAkB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AACA,SAAK,SAAS,QAAQ,UAAU,KAAK;AACrC,SAAK,WAAW,QAAQ,YAAY,KAAK;AACzC,SAAK,cAAc,QAAQ,gBAAgB,KAAK;AAChD,SAAK,YAAY,QAAQ,wBAAwB,KAAK;AAAA,EACvD;AAAA,EACA,4BAA4B,IAAI;AAC/B,UAAM,UAAU,KAAK,WAAW,IAAI,EAAE;AACtC,QAAI,CAAC,QAAS,QAAO;AACrB,WAAO,IAAI,QAAQ;AAAA,MAClB,GAAG;AAAA,MACH,QAAQ,KAAK;AAAA,MACb,cAAc,KAAK;AAAA,MACnB,UAAU,KAAK;AAAA,MACf,sBAAsB,KAAK;AAAA,MAC3B,gBAAgB;AAAA,IACnB,CAAG;AAAA,EACF;AAAA,EACA,OAAO,sBAAsB;AAC5B,QAAI;AACH,aAAO,kBAAkB,IAAI;AAAA,IAC9B,QAAQ;AACP,aAAO;AAAA,IACR;AAAA,EACD;AACD;","x_google_ignoreList":[0]}
@@ -1,71 +1,37 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
- import { getContentString } from "./index.es23.js";
3
- import { BotMessageSquare, Loader2 } from "lucide-react";
1
+ import { jsx, Fragment } from "react/jsx-runtime";
2
+ import { useStreamContext } from "./index.es7.js";
3
+ import { useCustomComponents } from "./index.es9.js";
4
+ import "./index.es20.js";
4
5
  import React__default from "react";
5
- import { AgentMarkdown } from "./index.es52.js";
6
- import { BranchSwitcher } from "./index.es53.js";
7
- import { MessageActions } from "./index.es54.js";
8
- function AgentMessage({
9
- agentName,
6
+ import { LoadExternalComponent } from "./index.es30.js";
7
+ function CustomComponentRender({
10
8
  message,
11
- isStreaming = false,
12
- onRegenerate,
13
- feedback,
14
- onFeedback,
15
- branch,
16
- branchOptions,
17
- onBranchSelect
9
+ thread
18
10
  }) {
19
- const content = getContentString(message?.content);
20
- return /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1 w-full group", children: [
21
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-3 w-full", children: [
22
- /* @__PURE__ */ jsx(
23
- "div",
24
- {
25
- className: "rounded-full size-8 shrink-0 bg-zinc-800 flex items-center justify-center p-2",
26
- "data-alt": "AI Avatar",
27
- children: /* @__PURE__ */ jsx(BotMessageSquare, { className: "text-xs", color: "white" })
28
- }
29
- ),
30
- /* @__PURE__ */ jsx("span", { className: "text-zinc-500 text-sm", children: agentName || "Agent" })
31
- ] }),
32
- /* @__PURE__ */ jsxs("div", { className: "flex flex-1 flex-col gap-1 items-start min-w-0", children: [
33
- /* @__PURE__ */ jsx("div", { className: "text-sm font-normal leading-relaxed px-2 text-left text-zinc-200 shadow-sm max-w-full break-words overflow-wrap-anywhere markdown-content", children: content ? /* @__PURE__ */ jsx(AgentMarkdown, { content }) : /* @__PURE__ */ jsxs(Fragment, { children: [
34
- /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-zinc-500", children: [
35
- /* @__PURE__ */ jsx(Loader2, { className: "animate-spin", size: 16 }),
36
- /* @__PURE__ */ jsx("span", { children: "Thinking..." })
37
- ] }),
38
- isStreaming && content && /* @__PURE__ */ jsx("span", { className: "inline-block w-2 h-4 ml-1 bg-zinc-400 animate-pulse" })
39
- ] }) }),
40
- !isStreaming && branch && branchOptions && onBranchSelect && branchOptions.length > 1 && /* @__PURE__ */ jsx(
41
- BranchSwitcher,
42
- {
43
- branch,
44
- branchOptions,
45
- onSelect: onBranchSelect,
46
- isLoading: isStreaming
47
- }
48
- ),
49
- !isStreaming && content && /* @__PURE__ */ jsx(
50
- MessageActions,
51
- {
52
- message,
53
- onRegenerate,
54
- feedback,
55
- onFeedback,
56
- className: ""
57
- }
58
- )
59
- ] })
60
- ] });
11
+ const { values } = useStreamContext();
12
+ const { components } = useCustomComponents();
13
+ const customComponents = React__default.useMemo(() => {
14
+ return values.ui?.filter(
15
+ (ui) => ui?.metadata?.id === message.id || ui?.metadata?.message_id === message.id || ui?.id === message.id
16
+ );
17
+ }, [values.ui, message.id]);
18
+ if (!customComponents?.length) return null;
19
+ return /* @__PURE__ */ jsx(Fragment, { children: customComponents?.filter((c) => !!components?.[c.name]).map((customComponent, index) => {
20
+ const componentProps = customComponent.props || {};
21
+ return /* @__PURE__ */ jsx(
22
+ LoadExternalComponent,
23
+ {
24
+ stream: thread,
25
+ message: customComponent,
26
+ components,
27
+ meta: { ...componentProps, ui: customComponent }
28
+ },
29
+ customComponent._key || `${message.id}-${customComponent.id || index}`
30
+ );
31
+ }) });
61
32
  }
62
- const AgentMessage$1 = React__default.memo(AgentMessage, (prevProps, nextProps) => {
63
- if (nextProps.isStreaming) {
64
- return false;
65
- }
66
- return prevProps.message.id === nextProps.message.id && prevProps.isStreaming === nextProps.isStreaming && prevProps.feedback === nextProps.feedback && prevProps.onRegenerate === nextProps.onRegenerate && prevProps.onFeedback === nextProps.onFeedback && prevProps.branch === nextProps.branch && prevProps.branchOptions?.length === nextProps.branchOptions?.length && prevProps.onBranchSelect === nextProps.onBranchSelect;
67
- });
33
+ const CustomComponentRender$1 = React__default.memo(CustomComponentRender);
68
34
  export {
69
- AgentMessage$1 as default
35
+ CustomComponentRender$1 as default
70
36
  };
71
37
  //# sourceMappingURL=index.es24.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es24.js","sources":["../src/components/messages/AgentMessage.tsx"],"sourcesContent":["import { getContentString } from \"@/utils/utils\";\nimport type { Message } from \"@langchain/langgraph-sdk\";\nimport { BotMessageSquare, Loader2 } from \"lucide-react\";\nimport React from \"react\";\nimport { AgentMarkdown } from \"../ui/AgentMarkdown\";\nimport { BranchSwitcher } from \"./BranchSwitcher\";\nimport { MessageActions, type MessageFeedback } from \"./MessageActions\";\n\nfunction AgentMessage({\n agentName,\n message,\n isStreaming = false,\n onRegenerate,\n feedback,\n onFeedback,\n branch,\n branchOptions,\n onBranchSelect,\n}: {\n agentName?: string;\n message: Message;\n isStreaming?: boolean;\n onRegenerate?: (parentCheckpoint: any | null | undefined, messageId: string, currentMessage: any) => void;\n feedback?: MessageFeedback;\n onFeedback?: (messageId: string, feedback: MessageFeedback) => void;\n branch?: string;\n branchOptions?: string[];\n onBranchSelect?: (branch: string) => void;\n}) {\n const content = getContentString(message?.content);\n\n return (\n <div className=\"flex flex-col gap-1 w-full group\">\n <div className=\"flex items-center gap-3 w-full\">\n <div\n className=\"rounded-full size-8 shrink-0 bg-zinc-800 flex items-center justify-center p-2\"\n data-alt=\"AI Avatar\"\n >\n <BotMessageSquare className=\"text-xs\" color=\"white\" />\n </div>\n <span className=\"text-zinc-500 text-sm\">{agentName || \"Agent\"}</span>\n </div>\n <div className=\"flex flex-1 flex-col gap-1 items-start min-w-0\">\n <div className=\"text-sm font-normal leading-relaxed px-2 text-left text-zinc-200 shadow-sm max-w-full break-words overflow-wrap-anywhere markdown-content\">\n {content ? (<AgentMarkdown content={content} />) : (\n <>\n <div className=\"flex items-center gap-2 text-zinc-500\">\n <Loader2 className=\"animate-spin\" size={16} />\n <span>Thinking...</span>\n </div>\n {isStreaming && content && (\n <span className=\"inline-block w-2 h-4 ml-1 bg-zinc-400 animate-pulse\" />\n )}\n </>\n )}\n </div>\n\n {/* Branch switcher - show when multiple branches exist */}\n {!isStreaming && branch && branchOptions && onBranchSelect && branchOptions.length > 1 && (\n <BranchSwitcher\n branch={branch}\n branchOptions={branchOptions}\n onSelect={onBranchSelect}\n isLoading={isStreaming}\n />\n )}\n\n {/* Show actions only when not streaming and content exists */}\n {!isStreaming && content && (\n <MessageActions\n message={message}\n onRegenerate={onRegenerate}\n feedback={feedback}\n onFeedback={onFeedback}\n className=\"\"\n />\n )}\n </div>\n </div>\n );\n}\n\n// Memoize - only re-render if message ID changes or streaming state changes\nexport default React.memo(AgentMessage, (prevProps, nextProps) => {\n // If it's streaming, we need to re-render to show updates\n if (nextProps.isStreaming) {\n return false; // Always re-render when streaming\n }\n\n // Otherwise, only re-render if the message ID, feedback, branch, or callbacks changed\n return (\n prevProps.message.id === nextProps.message.id &&\n prevProps.isStreaming === nextProps.isStreaming &&\n prevProps.feedback === nextProps.feedback &&\n prevProps.onRegenerate === nextProps.onRegenerate &&\n prevProps.onFeedback === nextProps.onFeedback &&\n prevProps.branch === nextProps.branch &&\n prevProps.branchOptions?.length === nextProps.branchOptions?.length &&\n prevProps.onBranchSelect === nextProps.onBranchSelect\n );\n});\n"],"names":["React"],"mappings":";;;;;;;AAQA,SAAS,aAAa;AAAA,EACpB;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAUG;AACD,QAAM,UAAU,iBAAiB,SAAS,OAAO;AAEjD,SACE,qBAAC,OAAA,EAAI,WAAU,oCACb,UAAA;AAAA,IAAA,qBAAC,OAAA,EAAI,WAAU,kCACb,UAAA;AAAA,MAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UACV,YAAS;AAAA,UAET,UAAA,oBAAC,kBAAA,EAAiB,WAAU,WAAU,OAAM,QAAA,CAAQ;AAAA,QAAA;AAAA,MAAA;AAAA,MAEtD,oBAAC,QAAA,EAAK,WAAU,yBAAyB,uBAAa,QAAA,CAAQ;AAAA,IAAA,GAChE;AAAA,IACA,qBAAC,OAAA,EAAI,WAAU,kDACb,UAAA;AAAA,MAAA,oBAAC,OAAA,EAAI,WAAU,6IACZ,UAAA,8BAAY,eAAA,EAAc,QAAA,CAAkB,IAC3C,qBAAA,UAAA,EACE,UAAA;AAAA,QAAA,qBAAC,OAAA,EAAI,WAAU,yCACb,UAAA;AAAA,UAAA,oBAAC,SAAA,EAAQ,WAAU,gBAAe,MAAM,IAAI;AAAA,UAC5C,oBAAC,UAAK,UAAA,cAAA,CAAW;AAAA,QAAA,GACnB;AAAA,QACC,eAAe,WACd,oBAAC,QAAA,EAAK,WAAU,sDAAA,CAAsD;AAAA,MAAA,EAAA,CAE1E,EAAA,CAEJ;AAAA,MAGC,CAAC,eAAe,UAAU,iBAAiB,kBAAkB,cAAc,SAAS,KACnF;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA,UAAU;AAAA,UACV,WAAW;AAAA,QAAA;AAAA,MAAA;AAAA,MAKd,CAAC,eAAe,WACf;AAAA,QAAC;AAAA,QAAA;AAAA,UACC;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA,WAAU;AAAA,QAAA;AAAA,MAAA;AAAA,IACZ,EAAA,CAEJ;AAAA,EAAA,GACF;AAEJ;AAGA,MAAA,iBAAeA,eAAM,KAAK,cAAc,CAAC,WAAW,cAAc;AAEhE,MAAI,UAAU,aAAa;AACzB,WAAO;AAAA,EACT;AAGA,SACE,UAAU,QAAQ,OAAO,UAAU,QAAQ,MAC3C,UAAU,gBAAgB,UAAU,eACpC,UAAU,aAAa,UAAU,YACjC,UAAU,iBAAiB,UAAU,gBACrC,UAAU,eAAe,UAAU,cACnC,UAAU,WAAW,UAAU,UAC/B,UAAU,eAAe,WAAW,UAAU,eAAe,UAC7D,UAAU,mBAAmB,UAAU;AAE3C,CAAC;"}
1
+ {"version":3,"file":"index.es24.js","sources":["../src/components/messages/CustomComponentRender.tsx"],"sourcesContent":["import { useStreamContext } from \"@/providers/Stream\";\nimport { useCustomComponents } from \"@/providers/CustomComponentProvider\";\nimport type { Message } from \"@langchain/langgraph-sdk\";\nimport { LoadExternalComponent } from \"@langchain/langgraph-sdk/react-ui\";\nimport { Fragment } from \"react/jsx-runtime\";\nimport React from \"react\";\nimport { logger } from \"@/utils/logger\";\n\nfunction CustomComponentRender({\n message,\n thread,\n}: {\n message: Message;\n thread: ReturnType<typeof useStreamContext>;\n}) {\n const { values } = useStreamContext();\n const { components } = useCustomComponents();\n \n // Memoize filtered components to prevent unnecessary re-renders\n const customComponents = React.useMemo(() => {\n return values.ui?.filter((ui) =>\n ui?.metadata?.id === message.id || ui?.metadata?.message_id === message.id || ui?.id === message.id\n );\n }, [values.ui, message.id]);\n\n logger.debug(\"CustomComponentRender - customComponents:\", message);\n logger.debug(\"CustomComponentRender - available components:\", values);\n\n\n if (!customComponents?.length) return null;\n \n return (\n <Fragment>\n {customComponents\n ?.filter((c) => !!components?.[c.name as keyof typeof components])\n .map((customComponent, index) => {\n // Extract props from the UI message to pass to the component\n const componentProps = (customComponent as any).props || {};\n\n return (\n <LoadExternalComponent\n key={(customComponent as any)._key || `${message.id}-${customComponent.id || index}`}\n stream={thread}\n message={customComponent}\n components={components}\n meta={{ ...componentProps, ui: customComponent }}\n />\n );\n })}\n </Fragment>\n );\n}\n\nexport default React.memo(CustomComponentRender);"],"names":["React"],"mappings":";;;;;;AAQA,SAAS,sBAAsB;AAAA,EAC7B;AAAA,EACA;AACF,GAGG;AACD,QAAM,EAAE,OAAA,IAAW,iBAAA;AACnB,QAAM,EAAE,WAAA,IAAe,oBAAA;AAGvB,QAAM,mBAAmBA,eAAM,QAAQ,MAAM;AAC3C,WAAO,OAAO,IAAI;AAAA,MAAO,CAAC,OACxB,IAAI,UAAU,OAAO,QAAQ,MAAM,IAAI,UAAU,eAAe,QAAQ,MAAM,IAAI,OAAO,QAAQ;AAAA,IAAA;AAAA,EAErG,GAAG,CAAC,OAAO,IAAI,QAAQ,EAAE,CAAC;AAM1B,MAAI,CAAC,kBAAkB,OAAQ,QAAO;AAEtC,6BACG,UAAA,EACE,UAAA,kBACG,OAAO,CAAC,MAAM,CAAC,CAAC,aAAa,EAAE,IAA+B,CAAC,EAChE,IAAI,CAAC,iBAAiB,UAAU;AAE/B,UAAM,iBAAkB,gBAAwB,SAAS,CAAA;AAEzD,WACE;AAAA,MAAC;AAAA,MAAA;AAAA,QAEC,QAAQ;AAAA,QACR,SAAS;AAAA,QACT;AAAA,QACA,MAAM,EAAE,GAAG,gBAAgB,IAAI,gBAAA;AAAA,MAAgB;AAAA,MAJzC,gBAAwB,QAAQ,GAAG,QAAQ,EAAE,IAAI,gBAAgB,MAAM,KAAK;AAAA,IAAA;AAAA,EAOxF,CAAC,EAAA,CACL;AAEJ;AAEA,MAAA,0BAAeA,eAAM,KAAK,qBAAqB;"}
@@ -1,5 +1,38 @@
1
- var hopscotch = {};
1
+ import { getDefaultLangChainClientSingleton } from "./index.es267.js";
2
+ import { getGlobalAsyncLocalStorageInstance } from "./index.es120.js";
3
+ import PQueueMod from "./index.es122.js";
4
+ let queue;
5
+ function createQueue() {
6
+ const PQueue = "default" in PQueueMod ? PQueueMod.default : PQueueMod;
7
+ return new PQueue({
8
+ autoStart: true,
9
+ concurrency: 1
10
+ });
11
+ }
12
+ function getQueue() {
13
+ if (typeof queue === "undefined") queue = createQueue();
14
+ return queue;
15
+ }
16
+ async function consumeCallback(promiseFn, wait) {
17
+ if (wait === true) {
18
+ const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();
19
+ if (asyncLocalStorageInstance !== void 0) await asyncLocalStorageInstance.run(void 0, async () => promiseFn());
20
+ else await promiseFn();
21
+ } else {
22
+ queue = getQueue();
23
+ queue.add(async () => {
24
+ const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();
25
+ if (asyncLocalStorageInstance !== void 0) await asyncLocalStorageInstance.run(void 0, async () => promiseFn());
26
+ else await promiseFn();
27
+ });
28
+ }
29
+ }
30
+ async function awaitAllCallbacks() {
31
+ const defaultClient = getDefaultLangChainClientSingleton();
32
+ await Promise.allSettled([typeof queue !== "undefined" ? queue.onIdle() : Promise.resolve(), defaultClient.awaitPendingTraceBatches()]);
33
+ }
2
34
  export {
3
- hopscotch as __exports
35
+ awaitAllCallbacks,
36
+ consumeCallback
4
37
  };
5
38
  //# sourceMappingURL=index.es240.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es240.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.es240.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/singletons/callbacks.js"],"sourcesContent":["import { getDefaultLangChainClientSingleton } from \"./tracer.js\";\nimport { getGlobalAsyncLocalStorageInstance } from \"./async_local_storage/globals.js\";\nimport PQueueMod from \"p-queue\";\n\n//#region src/singletons/callbacks.ts\nlet queue;\n/**\n* Creates a queue using the p-queue library. The queue is configured to\n* auto-start and has a concurrency of 1, meaning it will process tasks\n* one at a time.\n*/\nfunction createQueue() {\n\tconst PQueue = \"default\" in PQueueMod ? PQueueMod.default : PQueueMod;\n\treturn new PQueue({\n\t\tautoStart: true,\n\t\tconcurrency: 1\n\t});\n}\nfunction getQueue() {\n\tif (typeof queue === \"undefined\") queue = createQueue();\n\treturn queue;\n}\n/**\n* Consume a promise, either adding it to the queue or waiting for it to resolve\n* @param promiseFn Promise to consume\n* @param wait Whether to wait for the promise to resolve or resolve immediately\n*/\nasync function consumeCallback(promiseFn, wait) {\n\tif (wait === true) {\n\t\tconst asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n\t\tif (asyncLocalStorageInstance !== void 0) await asyncLocalStorageInstance.run(void 0, async () => promiseFn());\n\t\telse await promiseFn();\n\t} else {\n\t\tqueue = getQueue();\n\t\tqueue.add(async () => {\n\t\t\tconst asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n\t\t\tif (asyncLocalStorageInstance !== void 0) await asyncLocalStorageInstance.run(void 0, async () => promiseFn());\n\t\t\telse await promiseFn();\n\t\t});\n\t}\n}\n/**\n* Waits for all promises in the queue to resolve. If the queue is\n* undefined, it immediately resolves a promise.\n*/\nasync function awaitAllCallbacks() {\n\tconst defaultClient = getDefaultLangChainClientSingleton();\n\tawait Promise.allSettled([typeof queue !== \"undefined\" ? queue.onIdle() : Promise.resolve(), defaultClient.awaitPendingTraceBatches()]);\n}\n\n//#endregion\nexport { awaitAllCallbacks, consumeCallback };\n//# sourceMappingURL=callbacks.js.map"],"names":[],"mappings":";;;AAKA,IAAI;AAMJ,SAAS,cAAc;AACtB,QAAM,SAAS,aAAa,YAAY,UAAU,UAAU;AAC5D,SAAO,IAAI,OAAO;AAAA,IACjB,WAAW;AAAA,IACX,aAAa;AAAA,EACf,CAAE;AACF;AACA,SAAS,WAAW;AACnB,MAAI,OAAO,UAAU,YAAa,SAAQ,YAAW;AACrD,SAAO;AACR;AAMA,eAAe,gBAAgB,WAAW,MAAM;AAC/C,MAAI,SAAS,MAAM;AAClB,UAAM,4BAA4B,mCAAkC;AACpE,QAAI,8BAA8B,OAAQ,OAAM,0BAA0B,IAAI,QAAQ,YAAY,WAAW;AAAA,QACxG,OAAM,UAAS;AAAA,EACrB,OAAO;AACN,YAAQ,SAAQ;AAChB,UAAM,IAAI,YAAY;AACrB,YAAM,4BAA4B,mCAAkC;AACpE,UAAI,8BAA8B,OAAQ,OAAM,0BAA0B,IAAI,QAAQ,YAAY,WAAW;AAAA,UACxG,OAAM,UAAS;AAAA,IACrB,CAAC;AAAA,EACF;AACD;AAKA,eAAe,oBAAoB;AAClC,QAAM,gBAAgB,mCAAkC;AACxD,QAAM,QAAQ,WAAW,CAAC,OAAO,UAAU,cAAc,MAAM,OAAM,IAAK,QAAQ,QAAO,GAAI,cAAc,yBAAwB,CAAE,CAAC;AACvI;","x_google_ignoreList":[0]}
@@ -1,5 +1,13 @@
1
- var lucario = {};
1
+ import { __export } from "./index.es56.js";
2
+ import { consumeCallback, awaitAllCallbacks } from "./index.es240.js";
3
+ var promises_exports = {};
4
+ __export(promises_exports, {
5
+ awaitAllCallbacks: () => awaitAllCallbacks,
6
+ consumeCallback: () => consumeCallback
7
+ });
2
8
  export {
3
- lucario as __exports
9
+ awaitAllCallbacks,
10
+ consumeCallback,
11
+ promises_exports
4
12
  };
5
13
  //# sourceMappingURL=index.es241.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es241.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.es241.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/callbacks/promises.js"],"sourcesContent":["import { __export } from \"../_virtual/rolldown_runtime.js\";\nimport { awaitAllCallbacks, consumeCallback } from \"../singletons/callbacks.js\";\n\n//#region src/callbacks/promises.ts\nvar promises_exports = {};\n__export(promises_exports, {\n\tawaitAllCallbacks: () => awaitAllCallbacks,\n\tconsumeCallback: () => consumeCallback\n});\n\n//#endregion\nexport { awaitAllCallbacks, consumeCallback, promises_exports };\n//# sourceMappingURL=promises.js.map"],"names":[],"mappings":";;AAIG,IAAC,mBAAmB,CAAA;AACvB,SAAS,kBAAkB;AAAA,EAC1B,mBAAmB,MAAM;AAAA,EACzB,iBAAiB,MAAM;AACxB,CAAC;","x_google_ignoreList":[0]}
@@ -1,5 +1,14 @@
1
- var materialDark = {};
1
+ import { getEnvironmentVariable } from "./index.es236.js";
2
+ const isTracingEnabled = (tracingEnabled) => {
3
+ const envVars = [
4
+ "LANGSMITH_TRACING_V2",
5
+ "LANGCHAIN_TRACING_V2",
6
+ "LANGSMITH_TRACING",
7
+ "LANGCHAIN_TRACING"
8
+ ];
9
+ return !!envVars.find((envVar) => getEnvironmentVariable(envVar) === "true");
10
+ };
2
11
  export {
3
- materialDark as __exports
12
+ isTracingEnabled
4
13
  };
5
14
  //# sourceMappingURL=index.es242.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es242.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.es242.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/utils/callbacks.js"],"sourcesContent":["import { getEnvironmentVariable } from \"./env.js\";\n\n//#region src/utils/callbacks.ts\nconst isTracingEnabled = (tracingEnabled) => {\n\tif (tracingEnabled !== void 0) return tracingEnabled;\n\tconst envVars = [\n\t\t\"LANGSMITH_TRACING_V2\",\n\t\t\"LANGCHAIN_TRACING_V2\",\n\t\t\"LANGSMITH_TRACING\",\n\t\t\"LANGCHAIN_TRACING\"\n\t];\n\treturn !!envVars.find((envVar) => getEnvironmentVariable(envVar) === \"true\");\n};\n\n//#endregion\nexport { isTracingEnabled };\n//# sourceMappingURL=callbacks.js.map"],"names":[],"mappings":";AAGK,MAAC,mBAAmB,CAAC,mBAAmB;AAE5C,QAAM,UAAU;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACC,SAAO,CAAC,CAAC,QAAQ,KAAK,CAAC,WAAW,uBAAuB,MAAM,MAAM,MAAM;AAC5E;","x_google_ignoreList":[0]}
@@ -1,5 +1,15 @@
1
- var materialLight = {};
1
+ import { getGlobalAsyncLocalStorageInstance, _CONTEXT_VARIABLES_KEY } from "./index.es120.js";
2
+ import "./index.es125.js";
3
+ function getContextVariable(name) {
4
+ const asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();
5
+ if (asyncLocalStorageInstance === void 0) return void 0;
6
+ const runTree = asyncLocalStorageInstance.getStore();
7
+ return runTree?.[_CONTEXT_VARIABLES_KEY]?.[name];
8
+ }
9
+ const LC_CONFIGURE_HOOKS_KEY = /* @__PURE__ */ Symbol("lc:configure_hooks");
10
+ const _getConfigureHooks = () => getContextVariable(LC_CONFIGURE_HOOKS_KEY) || [];
2
11
  export {
3
- materialLight as __exports
12
+ _getConfigureHooks,
13
+ getContextVariable
4
14
  };
5
15
  //# sourceMappingURL=index.es243.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.es243.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
1
+ {"version":3,"file":"index.es243.js","sources":["../node_modules/.pnpm/@langchain+core@1.1.13_openai@6.16.0_zod@4.3.5_/node_modules/@langchain/core/dist/singletons/async_local_storage/context.js"],"sourcesContent":["import { _CONTEXT_VARIABLES_KEY, getGlobalAsyncLocalStorageInstance } from \"./globals.js\";\nimport { RunTree, isRunTree } from \"langsmith/run_trees\";\n\n//#region src/singletons/async_local_storage/context.ts\n/**\n* Set a context variable. Context variables are scoped to any\n* child runnables called by the current runnable, or globally if set outside\n* of any runnable.\n*\n* @remarks\n* This function is only supported in environments that support AsyncLocalStorage,\n* including Node.js, Deno, and Cloudflare Workers.\n*\n* @example\n* ```ts\n* import { RunnableLambda } from \"@langchain/core/runnables\";\n* import {\n* getContextVariable,\n* setContextVariable\n* } from \"@langchain/core/context\";\n*\n* const nested = RunnableLambda.from(() => {\n* // \"bar\" because it was set by a parent\n* console.log(getContextVariable(\"foo\"));\n*\n* // Override to \"baz\", but only for child runnables\n* setContextVariable(\"foo\", \"baz\");\n*\n* // Now \"baz\", but only for child runnables\n* return getContextVariable(\"foo\");\n* });\n*\n* const runnable = RunnableLambda.from(async () => {\n* // Set a context variable named \"foo\"\n* setContextVariable(\"foo\", \"bar\");\n*\n* const res = await nested.invoke({});\n*\n* // Still \"bar\" since child changes do not affect parents\n* console.log(getContextVariable(\"foo\"));\n*\n* return res;\n* });\n*\n* // undefined, because context variable has not been set yet\n* console.log(getContextVariable(\"foo\"));\n*\n* // Final return value is \"baz\"\n* const result = await runnable.invoke({});\n* ```\n*\n* @param name The name of the context variable.\n* @param value The value to set.\n*/\nfunction setContextVariable(name, value) {\n\tconst asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n\tif (asyncLocalStorageInstance === void 0) throw new Error(`Internal error: Global shared async local storage instance has not been initialized.`);\n\tconst runTree = asyncLocalStorageInstance.getStore();\n\tconst contextVars = { ...runTree?.[_CONTEXT_VARIABLES_KEY] };\n\tcontextVars[name] = value;\n\tlet newValue = {};\n\tif (isRunTree(runTree)) newValue = new RunTree(runTree);\n\tnewValue[_CONTEXT_VARIABLES_KEY] = contextVars;\n\tasyncLocalStorageInstance.enterWith(newValue);\n}\n/**\n* Get the value of a previously set context variable. Context variables\n* are scoped to any child runnables called by the current runnable,\n* or globally if set outside of any runnable.\n*\n* @remarks\n* This function is only supported in environments that support AsyncLocalStorage,\n* including Node.js, Deno, and Cloudflare Workers.\n*\n* @example\n* ```ts\n* import { RunnableLambda } from \"@langchain/core/runnables\";\n* import {\n* getContextVariable,\n* setContextVariable\n* } from \"@langchain/core/context\";\n*\n* const nested = RunnableLambda.from(() => {\n* // \"bar\" because it was set by a parent\n* console.log(getContextVariable(\"foo\"));\n*\n* // Override to \"baz\", but only for child runnables\n* setContextVariable(\"foo\", \"baz\");\n*\n* // Now \"baz\", but only for child runnables\n* return getContextVariable(\"foo\");\n* });\n*\n* const runnable = RunnableLambda.from(async () => {\n* // Set a context variable named \"foo\"\n* setContextVariable(\"foo\", \"bar\");\n*\n* const res = await nested.invoke({});\n*\n* // Still \"bar\" since child changes do not affect parents\n* console.log(getContextVariable(\"foo\"));\n*\n* return res;\n* });\n*\n* // undefined, because context variable has not been set yet\n* console.log(getContextVariable(\"foo\"));\n*\n* // Final return value is \"baz\"\n* const result = await runnable.invoke({});\n* ```\n*\n* @param name The name of the context variable.\n*/\nfunction getContextVariable(name) {\n\tconst asyncLocalStorageInstance = getGlobalAsyncLocalStorageInstance();\n\tif (asyncLocalStorageInstance === void 0) return void 0;\n\tconst runTree = asyncLocalStorageInstance.getStore();\n\treturn runTree?.[_CONTEXT_VARIABLES_KEY]?.[name];\n}\nconst LC_CONFIGURE_HOOKS_KEY = Symbol(\"lc:configure_hooks\");\nconst _getConfigureHooks = () => getContextVariable(LC_CONFIGURE_HOOKS_KEY) || [];\n/**\n* Register a callback configure hook to automatically add callback handlers to all runs.\n*\n* There are two ways to use this:\n*\n* 1. Using a context variable:\n* - Set `contextVar` to specify the variable name\n* - Use `setContextVariable()` to store your handler instance\n*\n* 2. Using an environment variable:\n* - Set both `envVar` and `handlerClass`\n* - The handler will be instantiated when the env var is set to \"true\".\n*\n* @example\n* ```typescript\n* // Method 1: Using context variable\n* import {\n* registerConfigureHook,\n* setContextVariable\n* } from \"@langchain/core/context\";\n*\n* const tracer = new MyCallbackHandler();\n* registerConfigureHook({\n* contextVar: \"my_tracer\",\n* });\n* setContextVariable(\"my_tracer\", tracer);\n*\n* // ...run code here\n*\n* // Method 2: Using environment variable\n* registerConfigureHook({\n* handlerClass: MyCallbackHandler,\n* envVar: \"MY_TRACER_ENABLED\",\n* });\n* process.env.MY_TRACER_ENABLED = \"true\";\n*\n* // ...run code here\n* ```\n*\n* @param config Configuration object for the hook\n* @param config.contextVar Name of the context variable containing the handler instance\n* @param config.inheritable Whether child runs should inherit this handler\n* @param config.handlerClass Optional callback handler class (required if using envVar)\n* @param config.envVar Optional environment variable name to control handler activation\n*/\nconst registerConfigureHook = (config) => {\n\tif (config.envVar && !config.handlerClass) throw new Error(\"If envVar is set, handlerClass must also be set to a non-None value.\");\n\tsetContextVariable(LC_CONFIGURE_HOOKS_KEY, [..._getConfigureHooks(), config]);\n};\n\n//#endregion\nexport { _getConfigureHooks, getContextVariable, registerConfigureHook, setContextVariable };\n//# sourceMappingURL=context.js.map"],"names":[],"mappings":";;AAkHA,SAAS,mBAAmB,MAAM;AACjC,QAAM,4BAA4B,mCAAkC;AACpE,MAAI,8BAA8B,OAAQ,QAAO;AACjD,QAAM,UAAU,0BAA0B,SAAQ;AAClD,SAAO,UAAU,sBAAsB,IAAI,IAAI;AAChD;AACA,MAAM,yBAAyB,uBAAO,oBAAoB;AACrD,MAAC,qBAAqB,MAAM,mBAAmB,sBAAsB,KAAK,CAAA;","x_google_ignoreList":[0]}