illuma-agents 1.0.2

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 (437) hide show
  1. package/LICENSE +21 -0
  2. package/dist/cjs/common/enum.cjs +163 -0
  3. package/dist/cjs/common/enum.cjs.map +1 -0
  4. package/dist/cjs/events.cjs +143 -0
  5. package/dist/cjs/events.cjs.map +1 -0
  6. package/dist/cjs/graphs/Graph.cjs +581 -0
  7. package/dist/cjs/graphs/Graph.cjs.map +1 -0
  8. package/dist/cjs/instrumentation.cjs +21 -0
  9. package/dist/cjs/instrumentation.cjs.map +1 -0
  10. package/dist/cjs/llm/anthropic/index.cjs +292 -0
  11. package/dist/cjs/llm/anthropic/index.cjs.map +1 -0
  12. package/dist/cjs/llm/anthropic/types.cjs +50 -0
  13. package/dist/cjs/llm/anthropic/types.cjs.map +1 -0
  14. package/dist/cjs/llm/anthropic/utils/message_inputs.cjs +553 -0
  15. package/dist/cjs/llm/anthropic/utils/message_inputs.cjs.map +1 -0
  16. package/dist/cjs/llm/anthropic/utils/message_outputs.cjs +218 -0
  17. package/dist/cjs/llm/anthropic/utils/message_outputs.cjs.map +1 -0
  18. package/dist/cjs/llm/anthropic/utils/tools.cjs +29 -0
  19. package/dist/cjs/llm/anthropic/utils/tools.cjs.map +1 -0
  20. package/dist/cjs/llm/fake.cjs +97 -0
  21. package/dist/cjs/llm/fake.cjs.map +1 -0
  22. package/dist/cjs/llm/google/index.cjs +147 -0
  23. package/dist/cjs/llm/google/index.cjs.map +1 -0
  24. package/dist/cjs/llm/google/utils/common.cjs +490 -0
  25. package/dist/cjs/llm/google/utils/common.cjs.map +1 -0
  26. package/dist/cjs/llm/ollama/index.cjs +70 -0
  27. package/dist/cjs/llm/ollama/index.cjs.map +1 -0
  28. package/dist/cjs/llm/ollama/utils.cjs +158 -0
  29. package/dist/cjs/llm/ollama/utils.cjs.map +1 -0
  30. package/dist/cjs/llm/openai/index.cjs +613 -0
  31. package/dist/cjs/llm/openai/index.cjs.map +1 -0
  32. package/dist/cjs/llm/openai/utils/index.cjs +677 -0
  33. package/dist/cjs/llm/openai/utils/index.cjs.map +1 -0
  34. package/dist/cjs/llm/openrouter/index.cjs +29 -0
  35. package/dist/cjs/llm/openrouter/index.cjs.map +1 -0
  36. package/dist/cjs/llm/providers.cjs +47 -0
  37. package/dist/cjs/llm/providers.cjs.map +1 -0
  38. package/dist/cjs/llm/text.cjs +69 -0
  39. package/dist/cjs/llm/text.cjs.map +1 -0
  40. package/dist/cjs/llm/vertexai/index.cjs +330 -0
  41. package/dist/cjs/llm/vertexai/index.cjs.map +1 -0
  42. package/dist/cjs/main.cjs +127 -0
  43. package/dist/cjs/main.cjs.map +1 -0
  44. package/dist/cjs/messages/core.cjs +359 -0
  45. package/dist/cjs/messages/core.cjs.map +1 -0
  46. package/dist/cjs/messages/format.cjs +455 -0
  47. package/dist/cjs/messages/format.cjs.map +1 -0
  48. package/dist/cjs/messages/ids.cjs +23 -0
  49. package/dist/cjs/messages/ids.cjs.map +1 -0
  50. package/dist/cjs/messages/prune.cjs +398 -0
  51. package/dist/cjs/messages/prune.cjs.map +1 -0
  52. package/dist/cjs/run.cjs +264 -0
  53. package/dist/cjs/run.cjs.map +1 -0
  54. package/dist/cjs/splitStream.cjs +210 -0
  55. package/dist/cjs/splitStream.cjs.map +1 -0
  56. package/dist/cjs/stream.cjs +504 -0
  57. package/dist/cjs/stream.cjs.map +1 -0
  58. package/dist/cjs/tools/CodeExecutor.cjs +192 -0
  59. package/dist/cjs/tools/CodeExecutor.cjs.map +1 -0
  60. package/dist/cjs/tools/ToolNode.cjs +125 -0
  61. package/dist/cjs/tools/ToolNode.cjs.map +1 -0
  62. package/dist/cjs/tools/handlers.cjs +250 -0
  63. package/dist/cjs/tools/handlers.cjs.map +1 -0
  64. package/dist/cjs/tools/search/anthropic.cjs +40 -0
  65. package/dist/cjs/tools/search/anthropic.cjs.map +1 -0
  66. package/dist/cjs/tools/search/content.cjs +140 -0
  67. package/dist/cjs/tools/search/content.cjs.map +1 -0
  68. package/dist/cjs/tools/search/firecrawl.cjs +179 -0
  69. package/dist/cjs/tools/search/firecrawl.cjs.map +1 -0
  70. package/dist/cjs/tools/search/format.cjs +203 -0
  71. package/dist/cjs/tools/search/format.cjs.map +1 -0
  72. package/dist/cjs/tools/search/highlights.cjs +245 -0
  73. package/dist/cjs/tools/search/highlights.cjs.map +1 -0
  74. package/dist/cjs/tools/search/rerankers.cjs +174 -0
  75. package/dist/cjs/tools/search/rerankers.cjs.map +1 -0
  76. package/dist/cjs/tools/search/schema.cjs +70 -0
  77. package/dist/cjs/tools/search/schema.cjs.map +1 -0
  78. package/dist/cjs/tools/search/search.cjs +561 -0
  79. package/dist/cjs/tools/search/search.cjs.map +1 -0
  80. package/dist/cjs/tools/search/serper-scraper.cjs +132 -0
  81. package/dist/cjs/tools/search/serper-scraper.cjs.map +1 -0
  82. package/dist/cjs/tools/search/tool.cjs +331 -0
  83. package/dist/cjs/tools/search/tool.cjs.map +1 -0
  84. package/dist/cjs/tools/search/utils.cjs +66 -0
  85. package/dist/cjs/tools/search/utils.cjs.map +1 -0
  86. package/dist/cjs/utils/graph.cjs +16 -0
  87. package/dist/cjs/utils/graph.cjs.map +1 -0
  88. package/dist/cjs/utils/llm.cjs +28 -0
  89. package/dist/cjs/utils/llm.cjs.map +1 -0
  90. package/dist/cjs/utils/misc.cjs +56 -0
  91. package/dist/cjs/utils/misc.cjs.map +1 -0
  92. package/dist/cjs/utils/run.cjs +69 -0
  93. package/dist/cjs/utils/run.cjs.map +1 -0
  94. package/dist/cjs/utils/title.cjs +111 -0
  95. package/dist/cjs/utils/title.cjs.map +1 -0
  96. package/dist/cjs/utils/tokens.cjs +65 -0
  97. package/dist/cjs/utils/tokens.cjs.map +1 -0
  98. package/dist/esm/common/enum.mjs +163 -0
  99. package/dist/esm/common/enum.mjs.map +1 -0
  100. package/dist/esm/events.mjs +135 -0
  101. package/dist/esm/events.mjs.map +1 -0
  102. package/dist/esm/graphs/Graph.mjs +578 -0
  103. package/dist/esm/graphs/Graph.mjs.map +1 -0
  104. package/dist/esm/instrumentation.mjs +19 -0
  105. package/dist/esm/instrumentation.mjs.map +1 -0
  106. package/dist/esm/llm/anthropic/index.mjs +290 -0
  107. package/dist/esm/llm/anthropic/index.mjs.map +1 -0
  108. package/dist/esm/llm/anthropic/types.mjs +48 -0
  109. package/dist/esm/llm/anthropic/types.mjs.map +1 -0
  110. package/dist/esm/llm/anthropic/utils/message_inputs.mjs +550 -0
  111. package/dist/esm/llm/anthropic/utils/message_inputs.mjs.map +1 -0
  112. package/dist/esm/llm/anthropic/utils/message_outputs.mjs +216 -0
  113. package/dist/esm/llm/anthropic/utils/message_outputs.mjs.map +1 -0
  114. package/dist/esm/llm/anthropic/utils/tools.mjs +27 -0
  115. package/dist/esm/llm/anthropic/utils/tools.mjs.map +1 -0
  116. package/dist/esm/llm/fake.mjs +94 -0
  117. package/dist/esm/llm/fake.mjs.map +1 -0
  118. package/dist/esm/llm/google/index.mjs +145 -0
  119. package/dist/esm/llm/google/index.mjs.map +1 -0
  120. package/dist/esm/llm/google/utils/common.mjs +484 -0
  121. package/dist/esm/llm/google/utils/common.mjs.map +1 -0
  122. package/dist/esm/llm/ollama/index.mjs +68 -0
  123. package/dist/esm/llm/ollama/index.mjs.map +1 -0
  124. package/dist/esm/llm/ollama/utils.mjs +155 -0
  125. package/dist/esm/llm/ollama/utils.mjs.map +1 -0
  126. package/dist/esm/llm/openai/index.mjs +604 -0
  127. package/dist/esm/llm/openai/index.mjs.map +1 -0
  128. package/dist/esm/llm/openai/utils/index.mjs +671 -0
  129. package/dist/esm/llm/openai/utils/index.mjs.map +1 -0
  130. package/dist/esm/llm/openrouter/index.mjs +27 -0
  131. package/dist/esm/llm/openrouter/index.mjs.map +1 -0
  132. package/dist/esm/llm/providers.mjs +43 -0
  133. package/dist/esm/llm/providers.mjs.map +1 -0
  134. package/dist/esm/llm/text.mjs +67 -0
  135. package/dist/esm/llm/text.mjs.map +1 -0
  136. package/dist/esm/llm/vertexai/index.mjs +328 -0
  137. package/dist/esm/llm/vertexai/index.mjs.map +1 -0
  138. package/dist/esm/main.mjs +20 -0
  139. package/dist/esm/main.mjs.map +1 -0
  140. package/dist/esm/messages/core.mjs +351 -0
  141. package/dist/esm/messages/core.mjs.map +1 -0
  142. package/dist/esm/messages/format.mjs +447 -0
  143. package/dist/esm/messages/format.mjs.map +1 -0
  144. package/dist/esm/messages/ids.mjs +21 -0
  145. package/dist/esm/messages/ids.mjs.map +1 -0
  146. package/dist/esm/messages/prune.mjs +393 -0
  147. package/dist/esm/messages/prune.mjs.map +1 -0
  148. package/dist/esm/run.mjs +261 -0
  149. package/dist/esm/run.mjs.map +1 -0
  150. package/dist/esm/splitStream.mjs +207 -0
  151. package/dist/esm/splitStream.mjs.map +1 -0
  152. package/dist/esm/stream.mjs +500 -0
  153. package/dist/esm/stream.mjs.map +1 -0
  154. package/dist/esm/tools/CodeExecutor.mjs +188 -0
  155. package/dist/esm/tools/CodeExecutor.mjs.map +1 -0
  156. package/dist/esm/tools/ToolNode.mjs +122 -0
  157. package/dist/esm/tools/ToolNode.mjs.map +1 -0
  158. package/dist/esm/tools/handlers.mjs +245 -0
  159. package/dist/esm/tools/handlers.mjs.map +1 -0
  160. package/dist/esm/tools/search/anthropic.mjs +37 -0
  161. package/dist/esm/tools/search/anthropic.mjs.map +1 -0
  162. package/dist/esm/tools/search/content.mjs +119 -0
  163. package/dist/esm/tools/search/content.mjs.map +1 -0
  164. package/dist/esm/tools/search/firecrawl.mjs +176 -0
  165. package/dist/esm/tools/search/firecrawl.mjs.map +1 -0
  166. package/dist/esm/tools/search/format.mjs +201 -0
  167. package/dist/esm/tools/search/format.mjs.map +1 -0
  168. package/dist/esm/tools/search/highlights.mjs +243 -0
  169. package/dist/esm/tools/search/highlights.mjs.map +1 -0
  170. package/dist/esm/tools/search/rerankers.mjs +168 -0
  171. package/dist/esm/tools/search/rerankers.mjs.map +1 -0
  172. package/dist/esm/tools/search/schema.mjs +61 -0
  173. package/dist/esm/tools/search/schema.mjs.map +1 -0
  174. package/dist/esm/tools/search/search.mjs +558 -0
  175. package/dist/esm/tools/search/search.mjs.map +1 -0
  176. package/dist/esm/tools/search/serper-scraper.mjs +129 -0
  177. package/dist/esm/tools/search/serper-scraper.mjs.map +1 -0
  178. package/dist/esm/tools/search/tool.mjs +329 -0
  179. package/dist/esm/tools/search/tool.mjs.map +1 -0
  180. package/dist/esm/tools/search/utils.mjs +61 -0
  181. package/dist/esm/tools/search/utils.mjs.map +1 -0
  182. package/dist/esm/utils/graph.mjs +13 -0
  183. package/dist/esm/utils/graph.mjs.map +1 -0
  184. package/dist/esm/utils/llm.mjs +25 -0
  185. package/dist/esm/utils/llm.mjs.map +1 -0
  186. package/dist/esm/utils/misc.mjs +53 -0
  187. package/dist/esm/utils/misc.mjs.map +1 -0
  188. package/dist/esm/utils/run.mjs +66 -0
  189. package/dist/esm/utils/run.mjs.map +1 -0
  190. package/dist/esm/utils/title.mjs +108 -0
  191. package/dist/esm/utils/title.mjs.map +1 -0
  192. package/dist/esm/utils/tokens.mjs +62 -0
  193. package/dist/esm/utils/tokens.mjs.map +1 -0
  194. package/dist/types/common/enum.d.ts +128 -0
  195. package/dist/types/common/index.d.ts +1 -0
  196. package/dist/types/events.d.ts +29 -0
  197. package/dist/types/graphs/Graph.d.ts +122 -0
  198. package/dist/types/graphs/index.d.ts +1 -0
  199. package/dist/types/index.d.ts +13 -0
  200. package/dist/types/instrumentation.d.ts +1 -0
  201. package/dist/types/llm/anthropic/index.d.ts +39 -0
  202. package/dist/types/llm/anthropic/types.d.ts +37 -0
  203. package/dist/types/llm/anthropic/utils/message_inputs.d.ts +14 -0
  204. package/dist/types/llm/anthropic/utils/message_outputs.d.ts +14 -0
  205. package/dist/types/llm/anthropic/utils/output_parsers.d.ts +22 -0
  206. package/dist/types/llm/anthropic/utils/tools.d.ts +3 -0
  207. package/dist/types/llm/fake.d.ts +31 -0
  208. package/dist/types/llm/google/index.d.ts +14 -0
  209. package/dist/types/llm/google/types.d.ts +32 -0
  210. package/dist/types/llm/google/utils/common.d.ts +19 -0
  211. package/dist/types/llm/google/utils/tools.d.ts +10 -0
  212. package/dist/types/llm/google/utils/zod_to_genai_parameters.d.ts +14 -0
  213. package/dist/types/llm/ollama/index.d.ts +8 -0
  214. package/dist/types/llm/ollama/utils.d.ts +7 -0
  215. package/dist/types/llm/openai/index.d.ts +103 -0
  216. package/dist/types/llm/openai/types.d.ts +10 -0
  217. package/dist/types/llm/openai/utils/index.d.ts +20 -0
  218. package/dist/types/llm/openrouter/index.d.ts +12 -0
  219. package/dist/types/llm/providers.d.ts +5 -0
  220. package/dist/types/llm/text.d.ts +21 -0
  221. package/dist/types/llm/vertexai/index.d.ts +293 -0
  222. package/dist/types/messages/core.d.ts +14 -0
  223. package/dist/types/messages/format.d.ts +113 -0
  224. package/dist/types/messages/ids.d.ts +3 -0
  225. package/dist/types/messages/index.d.ts +4 -0
  226. package/dist/types/messages/prune.d.ts +51 -0
  227. package/dist/types/mockStream.d.ts +32 -0
  228. package/dist/types/prompts/collab.d.ts +1 -0
  229. package/dist/types/prompts/index.d.ts +2 -0
  230. package/dist/types/prompts/taskmanager.d.ts +41 -0
  231. package/dist/types/run.d.ts +30 -0
  232. package/dist/types/scripts/abort.d.ts +1 -0
  233. package/dist/types/scripts/ant_web_search.d.ts +1 -0
  234. package/dist/types/scripts/args.d.ts +7 -0
  235. package/dist/types/scripts/caching.d.ts +1 -0
  236. package/dist/types/scripts/cli.d.ts +1 -0
  237. package/dist/types/scripts/cli2.d.ts +1 -0
  238. package/dist/types/scripts/cli3.d.ts +1 -0
  239. package/dist/types/scripts/cli4.d.ts +1 -0
  240. package/dist/types/scripts/cli5.d.ts +1 -0
  241. package/dist/types/scripts/code_exec.d.ts +1 -0
  242. package/dist/types/scripts/code_exec_files.d.ts +1 -0
  243. package/dist/types/scripts/code_exec_simple.d.ts +1 -0
  244. package/dist/types/scripts/content.d.ts +1 -0
  245. package/dist/types/scripts/empty_input.d.ts +1 -0
  246. package/dist/types/scripts/image.d.ts +1 -0
  247. package/dist/types/scripts/memory.d.ts +1 -0
  248. package/dist/types/scripts/search.d.ts +1 -0
  249. package/dist/types/scripts/simple.d.ts +1 -0
  250. package/dist/types/scripts/stream.d.ts +1 -0
  251. package/dist/types/scripts/thinking.d.ts +1 -0
  252. package/dist/types/scripts/tools.d.ts +1 -0
  253. package/dist/types/specs/spec.utils.d.ts +1 -0
  254. package/dist/types/splitStream.d.ts +37 -0
  255. package/dist/types/stream.d.ts +14 -0
  256. package/dist/types/tools/CodeExecutor.d.ts +23 -0
  257. package/dist/types/tools/ToolNode.d.ts +22 -0
  258. package/dist/types/tools/example.d.ts +78 -0
  259. package/dist/types/tools/handlers.d.ts +19 -0
  260. package/dist/types/tools/search/anthropic.d.ts +16 -0
  261. package/dist/types/tools/search/content.d.ts +4 -0
  262. package/dist/types/tools/search/firecrawl.d.ts +54 -0
  263. package/dist/types/tools/search/format.d.ts +5 -0
  264. package/dist/types/tools/search/highlights.d.ts +13 -0
  265. package/dist/types/tools/search/index.d.ts +2 -0
  266. package/dist/types/tools/search/rerankers.d.ts +38 -0
  267. package/dist/types/tools/search/schema.d.ts +16 -0
  268. package/dist/types/tools/search/search.d.ts +8 -0
  269. package/dist/types/tools/search/serper-scraper.d.ts +59 -0
  270. package/dist/types/tools/search/test.d.ts +1 -0
  271. package/dist/types/tools/search/tool.d.ts +54 -0
  272. package/dist/types/tools/search/types.d.ts +591 -0
  273. package/dist/types/tools/search/utils.d.ts +10 -0
  274. package/dist/types/types/graph.d.ts +138 -0
  275. package/dist/types/types/index.d.ts +5 -0
  276. package/dist/types/types/llm.d.ts +102 -0
  277. package/dist/types/types/run.d.ts +74 -0
  278. package/dist/types/types/stream.d.ts +293 -0
  279. package/dist/types/types/tools.d.ts +61 -0
  280. package/dist/types/utils/graph.d.ts +2 -0
  281. package/dist/types/utils/index.d.ts +5 -0
  282. package/dist/types/utils/llm.d.ts +3 -0
  283. package/dist/types/utils/llmConfig.d.ts +3 -0
  284. package/dist/types/utils/logging.d.ts +1 -0
  285. package/dist/types/utils/misc.d.ts +7 -0
  286. package/dist/types/utils/run.d.ts +27 -0
  287. package/dist/types/utils/title.d.ts +4 -0
  288. package/dist/types/utils/tokens.d.ts +3 -0
  289. package/package.json +145 -0
  290. package/src/common/enum.ts +176 -0
  291. package/src/common/index.ts +2 -0
  292. package/src/events.ts +191 -0
  293. package/src/graphs/Graph.ts +846 -0
  294. package/src/graphs/index.ts +1 -0
  295. package/src/index.ts +24 -0
  296. package/src/instrumentation.ts +22 -0
  297. package/src/llm/anthropic/Jacob_Lee_Resume_2023.pdf +0 -0
  298. package/src/llm/anthropic/index.ts +413 -0
  299. package/src/llm/anthropic/llm.spec.ts +1442 -0
  300. package/src/llm/anthropic/types.ts +140 -0
  301. package/src/llm/anthropic/utils/message_inputs.ts +660 -0
  302. package/src/llm/anthropic/utils/message_outputs.ts +289 -0
  303. package/src/llm/anthropic/utils/output_parsers.ts +133 -0
  304. package/src/llm/anthropic/utils/tools.ts +29 -0
  305. package/src/llm/fake.ts +133 -0
  306. package/src/llm/google/index.ts +222 -0
  307. package/src/llm/google/types.ts +43 -0
  308. package/src/llm/google/utils/common.ts +660 -0
  309. package/src/llm/google/utils/tools.ts +160 -0
  310. package/src/llm/google/utils/zod_to_genai_parameters.ts +88 -0
  311. package/src/llm/ollama/index.ts +92 -0
  312. package/src/llm/ollama/utils.ts +193 -0
  313. package/src/llm/openai/index.ts +853 -0
  314. package/src/llm/openai/types.ts +24 -0
  315. package/src/llm/openai/utils/index.ts +918 -0
  316. package/src/llm/openai/utils/isReasoningModel.test.ts +90 -0
  317. package/src/llm/openrouter/index.ts +60 -0
  318. package/src/llm/providers.ts +57 -0
  319. package/src/llm/text.ts +94 -0
  320. package/src/llm/vertexai/index.ts +360 -0
  321. package/src/messages/core.ts +463 -0
  322. package/src/messages/format.ts +625 -0
  323. package/src/messages/formatAgentMessages.test.ts +917 -0
  324. package/src/messages/formatAgentMessages.tools.test.ts +400 -0
  325. package/src/messages/formatMessage.test.ts +693 -0
  326. package/src/messages/ids.ts +26 -0
  327. package/src/messages/index.ts +4 -0
  328. package/src/messages/prune.ts +567 -0
  329. package/src/messages/shiftIndexTokenCountMap.test.ts +81 -0
  330. package/src/mockStream.ts +99 -0
  331. package/src/prompts/collab.ts +6 -0
  332. package/src/prompts/index.ts +2 -0
  333. package/src/prompts/taskmanager.ts +61 -0
  334. package/src/proto/CollabGraph.ts +269 -0
  335. package/src/proto/TaskManager.ts +243 -0
  336. package/src/proto/collab.ts +200 -0
  337. package/src/proto/collab_design.ts +184 -0
  338. package/src/proto/collab_design_v2.ts +224 -0
  339. package/src/proto/collab_design_v3.ts +255 -0
  340. package/src/proto/collab_design_v4.ts +220 -0
  341. package/src/proto/collab_design_v5.ts +251 -0
  342. package/src/proto/collab_graph.ts +181 -0
  343. package/src/proto/collab_original.ts +123 -0
  344. package/src/proto/example.ts +93 -0
  345. package/src/proto/example_new.ts +68 -0
  346. package/src/proto/example_old.ts +201 -0
  347. package/src/proto/example_test.ts +152 -0
  348. package/src/proto/example_test_anthropic.ts +100 -0
  349. package/src/proto/log_stream.ts +202 -0
  350. package/src/proto/main_collab_community_event.ts +133 -0
  351. package/src/proto/main_collab_design_v2.ts +96 -0
  352. package/src/proto/main_collab_design_v4.ts +100 -0
  353. package/src/proto/main_collab_design_v5.ts +135 -0
  354. package/src/proto/main_collab_global_analysis.ts +122 -0
  355. package/src/proto/main_collab_hackathon_event.ts +153 -0
  356. package/src/proto/main_collab_space_mission.ts +153 -0
  357. package/src/proto/main_philosophy.ts +210 -0
  358. package/src/proto/original_script.ts +126 -0
  359. package/src/proto/standard.ts +100 -0
  360. package/src/proto/stream.ts +56 -0
  361. package/src/proto/tasks.ts +118 -0
  362. package/src/proto/tools/global_analysis_tools.ts +86 -0
  363. package/src/proto/tools/space_mission_tools.ts +60 -0
  364. package/src/proto/vertexai.ts +54 -0
  365. package/src/run.ts +381 -0
  366. package/src/scripts/abort.ts +138 -0
  367. package/src/scripts/ant_web_search.ts +158 -0
  368. package/src/scripts/args.ts +48 -0
  369. package/src/scripts/caching.ts +124 -0
  370. package/src/scripts/cli.ts +167 -0
  371. package/src/scripts/cli2.ts +125 -0
  372. package/src/scripts/cli3.ts +178 -0
  373. package/src/scripts/cli4.ts +184 -0
  374. package/src/scripts/cli5.ts +184 -0
  375. package/src/scripts/code_exec.ts +214 -0
  376. package/src/scripts/code_exec_files.ts +193 -0
  377. package/src/scripts/code_exec_simple.ts +129 -0
  378. package/src/scripts/content.ts +120 -0
  379. package/src/scripts/empty_input.ts +137 -0
  380. package/src/scripts/image.ts +178 -0
  381. package/src/scripts/memory.ts +97 -0
  382. package/src/scripts/search.ts +150 -0
  383. package/src/scripts/simple.ts +225 -0
  384. package/src/scripts/stream.ts +122 -0
  385. package/src/scripts/thinking.ts +150 -0
  386. package/src/scripts/tools.ts +155 -0
  387. package/src/specs/anthropic.simple.test.ts +317 -0
  388. package/src/specs/azure.simple.test.ts +316 -0
  389. package/src/specs/openai.simple.test.ts +316 -0
  390. package/src/specs/prune.test.ts +763 -0
  391. package/src/specs/reasoning.test.ts +165 -0
  392. package/src/specs/spec.utils.ts +3 -0
  393. package/src/specs/thinking-prune.test.ts +703 -0
  394. package/src/specs/token-distribution-edge-case.test.ts +316 -0
  395. package/src/specs/tool-error.test.ts +193 -0
  396. package/src/splitStream.test.ts +691 -0
  397. package/src/splitStream.ts +234 -0
  398. package/src/stream.test.ts +94 -0
  399. package/src/stream.ts +651 -0
  400. package/src/tools/CodeExecutor.ts +220 -0
  401. package/src/tools/ToolNode.ts +170 -0
  402. package/src/tools/example.ts +129 -0
  403. package/src/tools/handlers.ts +336 -0
  404. package/src/tools/search/anthropic.ts +51 -0
  405. package/src/tools/search/content.test.ts +173 -0
  406. package/src/tools/search/content.ts +147 -0
  407. package/src/tools/search/firecrawl.ts +210 -0
  408. package/src/tools/search/format.ts +250 -0
  409. package/src/tools/search/highlights.ts +320 -0
  410. package/src/tools/search/index.ts +2 -0
  411. package/src/tools/search/jina-reranker.test.ts +126 -0
  412. package/src/tools/search/output.md +2775 -0
  413. package/src/tools/search/rerankers.ts +242 -0
  414. package/src/tools/search/schema.ts +63 -0
  415. package/src/tools/search/search.ts +759 -0
  416. package/src/tools/search/serper-scraper.ts +155 -0
  417. package/src/tools/search/test.html +884 -0
  418. package/src/tools/search/test.md +643 -0
  419. package/src/tools/search/test.ts +159 -0
  420. package/src/tools/search/tool.ts +471 -0
  421. package/src/tools/search/types.ts +687 -0
  422. package/src/tools/search/utils.ts +79 -0
  423. package/src/types/graph.ts +185 -0
  424. package/src/types/index.ts +6 -0
  425. package/src/types/llm.ts +140 -0
  426. package/src/types/run.ts +89 -0
  427. package/src/types/stream.ts +400 -0
  428. package/src/types/tools.ts +80 -0
  429. package/src/utils/graph.ts +11 -0
  430. package/src/utils/index.ts +5 -0
  431. package/src/utils/llm.ts +27 -0
  432. package/src/utils/llmConfig.ts +183 -0
  433. package/src/utils/logging.ts +48 -0
  434. package/src/utils/misc.ts +57 -0
  435. package/src/utils/run.ts +101 -0
  436. package/src/utils/title.ts +165 -0
  437. package/src/utils/tokens.ts +70 -0
@@ -0,0 +1,293 @@
1
+ import { ChatGoogle } from '@langchain/google-gauth';
2
+ import type { GoogleAIModelRequestParams, GoogleAbstractedClient } from '@langchain/google-common';
3
+ import type { VertexAIClientOptions } from '@/types';
4
+ /**
5
+ * Integration with Google Vertex AI chat models.
6
+ *
7
+ * Setup:
8
+ * Install `@langchain/google-vertexai` and set your stringified
9
+ * Vertex AI credentials as an environment variable named `GOOGLE_APPLICATION_CREDENTIALS`.
10
+ *
11
+ * ```bash
12
+ * npm install @langchain/google-vertexai
13
+ * export GOOGLE_APPLICATION_CREDENTIALS="path/to/credentials"
14
+ * ```
15
+ *
16
+ * ## [Constructor args](https://api.js.langchain.com/classes/_langchain_google_vertexai.index.ChatVertexAI.html#constructor.new_ChatVertexAI)
17
+ *
18
+ * ## [Runtime args](https://api.js.langchain.com/interfaces/langchain_google_common_types.GoogleAIBaseLanguageModelCallOptions.html)
19
+ *
20
+ * Runtime args can be passed as the second argument to any of the base runnable methods `.invoke`. `.stream`, `.batch`, etc.
21
+ * They can also be passed via `.withConfig`, or the second arg in `.bindTools`, like shown in the examples below:
22
+ *
23
+ * ```typescript
24
+ * // When calling `.withConfig`, call options should be passed via the first argument
25
+ * const llmWithArgsBound = llm.withConfig({
26
+ * stop: ["\n"],
27
+ * tools: [...],
28
+ * });
29
+ *
30
+ * // When calling `.bindTools`, call options should be passed via the second argument
31
+ * const llmWithTools = llm.bindTools(
32
+ * [...],
33
+ * {
34
+ * tool_choice: "auto",
35
+ * }
36
+ * );
37
+ * ```
38
+ *
39
+ * ## Examples
40
+ *
41
+ * <details open>
42
+ * <summary><strong>Instantiate</strong></summary>
43
+ *
44
+ * ```typescript
45
+ * import { ChatVertexAI } from '@langchain/google-vertexai';
46
+ *
47
+ * const llm = new ChatVertexAI({
48
+ * model: "gemini-1.5-pro",
49
+ * temperature: 0,
50
+ * // other params...
51
+ * });
52
+ * ```
53
+ * </details>
54
+ *
55
+ * <br />
56
+ *
57
+ * <details>
58
+ * <summary><strong>Invoking</strong></summary>
59
+ *
60
+ * ```typescript
61
+ * const input = `Translate "I love programming" into French.`;
62
+ *
63
+ * // Models also accept a list of chat messages or a formatted prompt
64
+ * const result = await llm.invoke(input);
65
+ * console.log(result);
66
+ * ```
67
+ *
68
+ * ```txt
69
+ * AIMessageChunk {
70
+ * "content": "\"J'adore programmer\" \n\nHere's why this is the best translation:\n\n* **J'adore** means \"I love\" and conveys a strong passion.\n* **Programmer** is the French verb for \"to program.\"\n\nThis translation is natural and idiomatic in French. \n",
71
+ * "additional_kwargs": {},
72
+ * "response_metadata": {},
73
+ * "tool_calls": [],
74
+ * "tool_call_chunks": [],
75
+ * "invalid_tool_calls": [],
76
+ * "usage_metadata": {
77
+ * "input_tokens": 9,
78
+ * "output_tokens": 63,
79
+ * "total_tokens": 72
80
+ * }
81
+ * }
82
+ * ```
83
+ * </details>
84
+ *
85
+ * <br />
86
+ *
87
+ * <details>
88
+ * <summary><strong>Streaming Chunks</strong></summary>
89
+ *
90
+ * ```typescript
91
+ * for await (const chunk of await llm.stream(input)) {
92
+ * console.log(chunk);
93
+ * }
94
+ * ```
95
+ *
96
+ * ```txt
97
+ * AIMessageChunk {
98
+ * "content": "\"",
99
+ * "additional_kwargs": {},
100
+ * "response_metadata": {},
101
+ * "tool_calls": [],
102
+ * "tool_call_chunks": [],
103
+ * "invalid_tool_calls": []
104
+ * }
105
+ * AIMessageChunk {
106
+ * "content": "J'adore programmer\" \n",
107
+ * "additional_kwargs": {},
108
+ * "response_metadata": {},
109
+ * "tool_calls": [],
110
+ * "tool_call_chunks": [],
111
+ * "invalid_tool_calls": []
112
+ * }
113
+ * AIMessageChunk {
114
+ * "content": "",
115
+ * "additional_kwargs": {},
116
+ * "response_metadata": {},
117
+ * "tool_calls": [],
118
+ * "tool_call_chunks": [],
119
+ * "invalid_tool_calls": []
120
+ * }
121
+ * AIMessageChunk {
122
+ * "content": "",
123
+ * "additional_kwargs": {},
124
+ * "response_metadata": {
125
+ * "finishReason": "stop"
126
+ * },
127
+ * "tool_calls": [],
128
+ * "tool_call_chunks": [],
129
+ * "invalid_tool_calls": [],
130
+ * "usage_metadata": {
131
+ * "input_tokens": 9,
132
+ * "output_tokens": 8,
133
+ * "total_tokens": 17
134
+ * }
135
+ * }
136
+ * ```
137
+ * </details>
138
+ *
139
+ * <br />
140
+ *
141
+ * <details>
142
+ * <summary><strong>Aggregate Streamed Chunks</strong></summary>
143
+ *
144
+ * ```typescript
145
+ * import { AIMessageChunk } from '@langchain/core/messages';
146
+ * import { concat } from '@langchain/core/utils/stream';
147
+ *
148
+ * const stream = await llm.stream(input);
149
+ * let full: AIMessageChunk | undefined;
150
+ * for await (const chunk of stream) {
151
+ * full = !full ? chunk : concat(full, chunk);
152
+ * }
153
+ * console.log(full);
154
+ * ```
155
+ *
156
+ * ```txt
157
+ * AIMessageChunk {
158
+ * "content": "\"J'adore programmer\" \n",
159
+ * "additional_kwargs": {},
160
+ * "response_metadata": {
161
+ * "finishReason": "stop"
162
+ * },
163
+ * "tool_calls": [],
164
+ * "tool_call_chunks": [],
165
+ * "invalid_tool_calls": [],
166
+ * "usage_metadata": {
167
+ * "input_tokens": 9,
168
+ * "output_tokens": 8,
169
+ * "total_tokens": 17
170
+ * }
171
+ * }
172
+ * ```
173
+ * </details>
174
+ *
175
+ * <br />
176
+ *
177
+ * <details>
178
+ * <summary><strong>Bind tools</strong></summary>
179
+ *
180
+ * ```typescript
181
+ * import { z } from 'zod';
182
+ *
183
+ * const GetWeather = {
184
+ * name: "GetWeather",
185
+ * description: "Get the current weather in a given location",
186
+ * schema: z.object({
187
+ * location: z.string().describe("The city and state, e.g. San Francisco, CA")
188
+ * }),
189
+ * }
190
+ *
191
+ * const GetPopulation = {
192
+ * name: "GetPopulation",
193
+ * description: "Get the current population in a given location",
194
+ * schema: z.object({
195
+ * location: z.string().describe("The city and state, e.g. San Francisco, CA")
196
+ * }),
197
+ * }
198
+ *
199
+ * const llmWithTools = llm.bindTools([GetWeather, GetPopulation]);
200
+ * const aiMsg = await llmWithTools.invoke(
201
+ * "Which city is hotter today and which is bigger: LA or NY?"
202
+ * );
203
+ * console.log(aiMsg.tool_calls);
204
+ * ```
205
+ *
206
+ * ```txt
207
+ * [
208
+ * {
209
+ * name: 'GetPopulation',
210
+ * args: { location: 'New York City, NY' },
211
+ * id: '33c1c1f47e2f492799c77d2800a43912',
212
+ * type: 'tool_call'
213
+ * }
214
+ * ]
215
+ * ```
216
+ * </details>
217
+ *
218
+ * <br />
219
+ *
220
+ * <details>
221
+ * <summary><strong>Structured Output</strong></summary>
222
+ *
223
+ * ```typescript
224
+ * import { z } from 'zod';
225
+ *
226
+ * const Joke = z.object({
227
+ * setup: z.string().describe("The setup of the joke"),
228
+ * punchline: z.string().describe("The punchline to the joke"),
229
+ * rating: z.number().optional().describe("How funny the joke is, from 1 to 10")
230
+ * }).describe('Joke to tell user.');
231
+ *
232
+ * const structuredLlm = llm.withStructuredOutput(Joke, { name: "Joke" });
233
+ * const jokeResult = await structuredLlm.invoke("Tell me a joke about cats");
234
+ * console.log(jokeResult);
235
+ * ```
236
+ *
237
+ * ```txt
238
+ * {
239
+ * setup: 'What do you call a cat that loves to bowl?',
240
+ * punchline: 'An alley cat!'
241
+ * }
242
+ * ```
243
+ * </details>
244
+ *
245
+ * <br />
246
+ *
247
+ * <details>
248
+ * <summary><strong>Usage Metadata</strong></summary>
249
+ *
250
+ * ```typescript
251
+ * const aiMsgForMetadata = await llm.invoke(input);
252
+ * console.log(aiMsgForMetadata.usage_metadata);
253
+ * ```
254
+ *
255
+ * ```txt
256
+ * { input_tokens: 9, output_tokens: 8, total_tokens: 17 }
257
+ * ```
258
+ * </details>
259
+ *
260
+ * <br />
261
+ *
262
+ * <details>
263
+ * <summary><strong>Stream Usage Metadata</strong></summary>
264
+ *
265
+ * ```typescript
266
+ * const streamForMetadata = await llm.stream(
267
+ * input,
268
+ * {
269
+ * streamUsage: true
270
+ * }
271
+ * );
272
+ * let fullForMetadata: AIMessageChunk | undefined;
273
+ * for await (const chunk of streamForMetadata) {
274
+ * fullForMetadata = !fullForMetadata ? chunk : concat(fullForMetadata, chunk);
275
+ * }
276
+ * console.log(fullForMetadata?.usage_metadata);
277
+ * ```
278
+ *
279
+ * ```txt
280
+ * { input_tokens: 9, output_tokens: 8, total_tokens: 17 }
281
+ * ```
282
+ * </details>
283
+ *
284
+ * <br />
285
+ */
286
+ export declare class ChatVertexAI extends ChatGoogle {
287
+ lc_namespace: string[];
288
+ dynamicThinkingBudget: boolean;
289
+ static lc_name(): 'IllumaVertexAI';
290
+ constructor(fields?: VertexAIClientOptions);
291
+ invocationParams(options?: this['ParsedCallOptions'] | undefined): GoogleAIModelRequestParams;
292
+ buildConnection(fields: VertexAIClientOptions, client: GoogleAbstractedClient): void;
293
+ }
@@ -0,0 +1,14 @@
1
+ import { AIMessageChunk, HumanMessage, ToolMessage, AIMessage, BaseMessage } from '@langchain/core/messages';
2
+ import type * as t from '@/types';
3
+ import { Providers } from '@/common';
4
+ export declare function getConverseOverrideMessage({ userMessage, lastMessageX, lastMessageY, }: {
5
+ userMessage: string[];
6
+ lastMessageX: AIMessageChunk | null;
7
+ lastMessageY: ToolMessage;
8
+ }): HumanMessage;
9
+ export declare function modifyDeltaProperties(provider: Providers, obj?: AIMessageChunk): AIMessageChunk | undefined;
10
+ export declare function formatAnthropicMessage(message: AIMessageChunk): AIMessage;
11
+ export declare function convertMessagesToContent(messages: BaseMessage[]): t.MessageContentComplex[];
12
+ export declare function formatAnthropicArtifactContent(messages: BaseMessage[]): void;
13
+ export declare function formatArtifactPayload(messages: BaseMessage[]): void;
14
+ export declare function findLastIndex<T>(array: T[], predicate: (value: T) => boolean): number;
@@ -0,0 +1,113 @@
1
+ import { AIMessage, ToolMessage, BaseMessage, HumanMessage, SystemMessage } from '@langchain/core/messages';
2
+ import type { MessageContentImageUrl } from '@langchain/core/messages';
3
+ import type { MessageContentComplex, TPayload } from '@/types';
4
+ import { Providers } from '@/common';
5
+ interface MediaMessageParams {
6
+ message: {
7
+ role: string;
8
+ content: string;
9
+ name?: string;
10
+ [key: string]: any;
11
+ };
12
+ mediaParts: MessageContentComplex[];
13
+ endpoint?: Providers;
14
+ }
15
+ /**
16
+ * Formats a message with media content (images, documents, videos, audios) to API payload format.
17
+ *
18
+ * @param params - The parameters for formatting.
19
+ * @returns - The formatted message.
20
+ */
21
+ export declare const formatMediaMessage: ({ message, endpoint, mediaParts, }: MediaMessageParams) => {
22
+ role: string;
23
+ content: MessageContentComplex[];
24
+ name?: string;
25
+ [key: string]: any;
26
+ };
27
+ interface MessageInput {
28
+ role?: string;
29
+ _name?: string;
30
+ sender?: string;
31
+ text?: string;
32
+ content?: string | MessageContentComplex[];
33
+ image_urls?: MessageContentImageUrl[];
34
+ documents?: MessageContentComplex[];
35
+ videos?: MessageContentComplex[];
36
+ audios?: MessageContentComplex[];
37
+ lc_id?: string[];
38
+ [key: string]: any;
39
+ }
40
+ interface FormatMessageParams {
41
+ message: MessageInput;
42
+ userName?: string;
43
+ assistantName?: string;
44
+ endpoint?: Providers;
45
+ langChain?: boolean;
46
+ }
47
+ interface FormattedMessage {
48
+ role: string;
49
+ content: string | MessageContentComplex[];
50
+ name?: string;
51
+ [key: string]: any;
52
+ }
53
+ /**
54
+ * Formats a message to OpenAI payload format based on the provided options.
55
+ *
56
+ * @param params - The parameters for formatting.
57
+ * @returns - The formatted message.
58
+ */
59
+ export declare const formatMessage: ({ message, userName, endpoint, assistantName, langChain, }: FormatMessageParams) => FormattedMessage | HumanMessage | AIMessage | SystemMessage;
60
+ /**
61
+ * Formats an array of messages for LangChain.
62
+ *
63
+ * @param messages - The array of messages to format.
64
+ * @param formatOptions - The options for formatting each message.
65
+ * @returns - The array of formatted LangChain messages.
66
+ */
67
+ export declare const formatLangChainMessages: (messages: Array<MessageInput>, formatOptions: Omit<FormatMessageParams, "message" | "langChain">) => Array<HumanMessage | AIMessage | SystemMessage>;
68
+ interface LangChainMessage {
69
+ lc_kwargs?: {
70
+ additional_kwargs?: Record<string, any>;
71
+ [key: string]: any;
72
+ };
73
+ kwargs?: {
74
+ additional_kwargs?: Record<string, any>;
75
+ [key: string]: any;
76
+ };
77
+ [key: string]: any;
78
+ }
79
+ /**
80
+ * Formats a LangChain message object by merging properties from `lc_kwargs` or `kwargs` and `additional_kwargs`.
81
+ *
82
+ * @param message - The message object to format.
83
+ * @returns - The formatted LangChain message.
84
+ */
85
+ export declare const formatFromLangChain: (message: LangChainMessage) => Record<string, any>;
86
+ /**
87
+ * Formats an array of messages for LangChain, handling tool calls and creating ToolMessage instances.
88
+ *
89
+ * @param payload - The array of messages to format.
90
+ * @param indexTokenCountMap - Optional map of message indices to token counts.
91
+ * @param tools - Optional set of tool names that are allowed in the request.
92
+ * @returns - Object containing formatted messages and updated indexTokenCountMap if provided.
93
+ */
94
+ export declare const formatAgentMessages: (payload: TPayload, indexTokenCountMap?: Record<number, number>, tools?: Set<string>) => {
95
+ messages: Array<HumanMessage | AIMessage | SystemMessage | ToolMessage>;
96
+ indexTokenCountMap?: Record<number, number>;
97
+ };
98
+ /**
99
+ * Formats an array of messages for LangChain, making sure all content fields are strings
100
+ * @param payload - The array of messages to format.
101
+ * @returns - The array of formatted LangChain messages, including ToolMessages for tool calls.
102
+ */
103
+ export declare const formatContentStrings: (payload: Array<BaseMessage>) => Array<BaseMessage>;
104
+ /**
105
+ * Adds a value at key 0 for system messages and shifts all key indices by one in an indexTokenCountMap.
106
+ * This is useful when adding a system message at the beginning of a conversation.
107
+ *
108
+ * @param indexTokenCountMap - The original map of message indices to token counts
109
+ * @param instructionsTokenCount - The token count for the system message to add at index 0
110
+ * @returns A new map with the system message at index 0 and all other indices shifted by 1
111
+ */
112
+ export declare function shiftIndexTokenCountMap(indexTokenCountMap: Record<number, number>, instructionsTokenCount: number): Record<number, number>;
113
+ export {};
@@ -0,0 +1,3 @@
1
+ import type { Graph } from '@/graphs';
2
+ import type * as t from '@/types';
3
+ export declare const getMessageId: (stepKey: string, graph: Graph<t.BaseGraphState>, returnExistingId?: boolean) => string | undefined;
@@ -0,0 +1,4 @@
1
+ export * from './core';
2
+ export * from './ids';
3
+ export * from './prune';
4
+ export * from './format';
@@ -0,0 +1,51 @@
1
+ import { BaseMessage, UsageMetadata } from '@langchain/core/messages';
2
+ import type { TokenCounter } from '@/types/run';
3
+ import { ContentTypes, Providers } from '@/common';
4
+ export type PruneMessagesFactoryParams = {
5
+ provider?: Providers;
6
+ maxTokens: number;
7
+ startIndex: number;
8
+ tokenCounter: TokenCounter;
9
+ indexTokenCountMap: Record<string, number | undefined>;
10
+ thinkingEnabled?: boolean;
11
+ };
12
+ export type PruneMessagesParams = {
13
+ messages: BaseMessage[];
14
+ usageMetadata?: Partial<UsageMetadata>;
15
+ startType?: ReturnType<BaseMessage['getType']>;
16
+ };
17
+ /**
18
+ * Calculates the total tokens from a single usage object
19
+ *
20
+ * @param usage The usage metadata object containing token information
21
+ * @returns An object containing the total input and output tokens
22
+ */
23
+ export declare function calculateTotalTokens(usage: Partial<UsageMetadata>): UsageMetadata;
24
+ export type PruningResult = {
25
+ context: BaseMessage[];
26
+ remainingContextTokens: number;
27
+ messagesToRefine: BaseMessage[];
28
+ thinkingStartIndex?: number;
29
+ };
30
+ /**
31
+ * Processes an array of messages and returns a context of messages that fit within a specified token limit.
32
+ * It iterates over the messages from newest to oldest, adding them to the context until the token limit is reached.
33
+ *
34
+ * @param options Configuration options for processing messages
35
+ * @returns Object containing the message context, remaining tokens, messages not included, and summary index
36
+ */
37
+ export declare function getMessagesWithinTokenLimit({ messages: _messages, maxContextTokens, indexTokenCountMap, startType: _startType, thinkingEnabled, tokenCounter, thinkingStartIndex: _thinkingStartIndex, reasoningType, }: {
38
+ messages: BaseMessage[];
39
+ maxContextTokens: number;
40
+ indexTokenCountMap: Record<string, number | undefined>;
41
+ startType?: string | string[];
42
+ thinkingEnabled?: boolean;
43
+ tokenCounter: TokenCounter;
44
+ thinkingStartIndex?: number;
45
+ reasoningType?: ContentTypes.THINKING | ContentTypes.REASONING_CONTENT;
46
+ }): PruningResult;
47
+ export declare function checkValidNumber(value: unknown): value is number;
48
+ export declare function createPruneMessages(factoryParams: PruneMessagesFactoryParams): (params: PruneMessagesParams) => {
49
+ context: BaseMessage[];
50
+ indexTokenCountMap: Record<string, number | undefined>;
51
+ };
@@ -0,0 +1,32 @@
1
+ import type * as t from '@/types';
2
+ export declare const createMockStream: (options?: {
3
+ text?: string;
4
+ reasoningText?: string;
5
+ streamRate?: number;
6
+ reasoningKey?: "reasoning" | "reasoning_content";
7
+ }) => () => AsyncGenerator<t.CustomChunk>;
8
+ /**
9
+ (async function testStream(): Promise<void> {
10
+ const runId = nanoid();
11
+
12
+ const streamHandler = new SplitStreamHandler({
13
+ runId,
14
+ handlers: {
15
+ [GraphEvents.ON_RUN_STEP]: (data): void => {
16
+ console.dir(data, { depth: null });
17
+ },
18
+ [GraphEvents.ON_MESSAGE_DELTA]: (): void => {
19
+ // console.dir(data, { depth: null });
20
+ },
21
+ },
22
+ });
23
+ const stream = createMockStream({
24
+ reasoningText: 'This is a test reasoning text.',
25
+ streamRate: 5,
26
+ })();
27
+
28
+ for await (const chunk of stream) {
29
+ streamHandler.handle(chunk);
30
+ }
31
+ })();
32
+ */
@@ -0,0 +1 @@
1
+ export declare const supervisorPrompt = "You are a supervisor tasked with managing a conversation between the\nfollowing workers: {members}. Given the following user request,\nrespond with the worker to act next. Each worker will perform a\ntask and respond with their results and status. Multiple workers can work at once, and they can use multiple tools at once. Each worker can run their tools multiple times per task. When finished,\nrespond with FINISH.";
@@ -0,0 +1,2 @@
1
+ export * from './collab';
2
+ export * from './taskmanager';
@@ -0,0 +1,41 @@
1
+ export declare const taskManagerPrompt = "You are a Task Manager responsible for efficiently coordinating a team of specialized workers: {members}. Your PRIMARY and SOLE OBJECTIVE is to fulfill the user's specific request as quickly and effectively as possible.\n\nCRITICAL GUIDELINES:\n1. The user's request is your CHIEF CONCERN. Every action must directly contribute to fulfilling this request.\n2. Aim to complete the entire task in NO MORE THAN 2-3 TURNS, unless explicitly instructed otherwise.\n3. Eliminate all superfluous activity. Each task must be essential to achieving the user's goal.\n4. Assign no more than 5 tasks per turn, and only if absolutely necessary.\n5. Be concise and direct in your task assignments.\n6. End the process IMMEDIATELY once the user's request is fulfilled by setting 'end' to true and assigning no new tasks.\n\nYour responsibilities:\n1. Analyze the user's request and break it down into the minimum necessary subtasks.\n2. Assign these essential tasks to the most appropriate team members based on their skills and tools.\n3. Prioritize tasks to ensure the most efficient path to completion.\n4. Continuously evaluate if the user's request has been fully addressed.\n5. End the process IMMEDIATELY once the user's request is fulfilled.\n\nTask Assignment Guidelines:\n- Assign only the most crucial tasks required to meet the user's needs.\n- Multiple tasks can be assigned to the same team member if it improves efficiency.\n- Always specify the tool to use if applicable.\n- Consider task dependencies to minimize the number of turns.\n\nAfter each round:\n- Critically assess if the user's request has been fully addressed.\n- If more work is genuinely needed, assign only the most essential remaining tasks.\n- If the user's request has been fulfilled or can be fulfilled with the results at hand, set 'end' to true and assign no new tasks.\n\nREMEMBER: Your success is measured by how quickly and effectively you fulfill the user's request, not by the number of tasks assigned or turns taken. Excessive deliberation or unnecessary tasks are counterproductive. Focus solely on the user's needs and conclude the process as soon as those needs are met.";
2
+ export declare const assignTasksFunctionDescription = "Assign the minimum necessary tasks to team members to fulfill the user's request as quickly as possible. Assign up to 5 tasks maximum per turn, only if absolutely necessary. Each task must specify the team member, a concise description, and the tool to use if applicable.";
3
+ export declare const assignTasksFunctionParameters: {
4
+ type: string;
5
+ properties: {
6
+ tasks: {
7
+ type: string;
8
+ items: {
9
+ type: string;
10
+ properties: {
11
+ member: {
12
+ type: string;
13
+ description: string;
14
+ };
15
+ description: {
16
+ type: string;
17
+ description: string;
18
+ };
19
+ tool: {
20
+ type: string;
21
+ description: string;
22
+ };
23
+ };
24
+ required: string[];
25
+ };
26
+ description: string;
27
+ };
28
+ };
29
+ required: string[];
30
+ };
31
+ export declare const endProcessFunctionDescription = "End the process when the user's request has been fulfilled.";
32
+ export declare const endProcessFunctionParameters: {
33
+ type: string;
34
+ properties: {
35
+ reason: {
36
+ type: string;
37
+ description: string;
38
+ };
39
+ };
40
+ required: string[];
41
+ };
@@ -0,0 +1,30 @@
1
+ import './instrumentation';
2
+ import type { MessageContentComplex, BaseMessage } from '@langchain/core/messages';
3
+ import type { RunnableConfig } from '@langchain/core/runnables';
4
+ import type { ClientCallbacks, SystemCallbacks } from '@/graphs/Graph';
5
+ import type * as t from '@/types';
6
+ import { Providers } from '@/common';
7
+ import { StandardGraph } from '@/graphs/Graph';
8
+ export declare const defaultOmitOptions: Set<string>;
9
+ export declare class Run<T extends t.BaseGraphState> {
10
+ graphRunnable?: t.CompiledWorkflow<T, Partial<T>, string>;
11
+ private handlerRegistry;
12
+ id: string;
13
+ Graph: StandardGraph | undefined;
14
+ provider: Providers | undefined;
15
+ returnContent: boolean;
16
+ private constructor();
17
+ private createStandardGraph;
18
+ static create<T extends t.BaseGraphState>(config: t.RunConfig): Promise<Run<T>>;
19
+ getRunMessages(): BaseMessage[] | undefined;
20
+ processStream(inputs: t.IState, config: Partial<RunnableConfig> & {
21
+ version: 'v1' | 'v2';
22
+ run_id?: string;
23
+ }, streamOptions?: t.EventStreamOptions): Promise<MessageContentComplex[] | undefined>;
24
+ private createSystemCallback;
25
+ getCallbacks(clientCallbacks: ClientCallbacks): SystemCallbacks;
26
+ generateTitle({ provider, inputText, contentParts, titlePrompt, clientOptions, chainOptions, skipLanguage, omitOptions, titleMethod, titlePromptTemplate, }: t.RunTitleOptions): Promise<{
27
+ language?: string;
28
+ title?: string;
29
+ }>;
30
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Providers } from '@/common';
2
+ export declare function getArgs(): Promise<{
3
+ userName: string;
4
+ location: string;
5
+ provider: Providers;
6
+ currentDate: string;
7
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};