@arcgis/ai-components 5.1.0-next.98 → 5.2.0-next.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (375) hide show
  1. package/README.md +2 -2
  2. package/dist/agent-utils/BaseAgent.d.ts +90 -0
  3. package/dist/agent-utils/BaseAgent.js +87 -0
  4. package/dist/agent-utils/FunctionAgent.d.ts +64 -0
  5. package/dist/agent-utils/FunctionAgent.js +98 -0
  6. package/dist/agent-utils/LLMAgent.d.ts +65 -0
  7. package/dist/agent-utils/LLMAgent.js +139 -0
  8. package/dist/agent-utils/WorkflowAgent.d.ts +44 -0
  9. package/dist/agent-utils/WorkflowAgent.js +70 -0
  10. package/dist/agent-utils/middlewares/humanInTheLoop.d.ts +152 -0
  11. package/dist/agent-utils/middlewares/humanInTheLoop.js +94 -0
  12. package/dist/agent-utils/middlewares/middleware.d.ts +25 -0
  13. package/dist/agent-utils/middlewares/middleware.js +44 -0
  14. package/dist/agent-utils/middlewares/trace.d.ts +25 -0
  15. package/dist/agent-utils/middlewares/trace.js +50 -0
  16. package/dist/agent-utils/middlewares/types.d.ts +123 -0
  17. package/dist/agent-utils/middlewares/types.js +2 -0
  18. package/dist/agent-utils/tools/FunctionTool.d.ts +127 -0
  19. package/dist/agent-utils/tools/FunctionTool.js +80 -0
  20. package/dist/agent-utils/types.d.ts +152 -0
  21. package/dist/agent-utils/workflows/BaseWorkflow.d.ts +87 -0
  22. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +72 -0
  23. package/dist/agent-utils/workflows/ConditionalWorkflow.js +61 -0
  24. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +58 -0
  25. package/dist/agent-utils/workflows/LoopWorkflow.js +56 -0
  26. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +68 -0
  27. package/dist/agent-utils/workflows/ParallelWorkflow.js +129 -0
  28. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +63 -0
  29. package/dist/agent-utils/workflows/RouterWorkflow.js +75 -0
  30. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +56 -0
  31. package/dist/agent-utils/workflows/SequentialWorkflow.js +69 -0
  32. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +74 -0
  33. package/dist/agent-utils/workflows/SwitchWorkflow.js +84 -0
  34. package/dist/assets/embeddings.worker-k9_Ou679.js +1 -0
  35. package/dist/cdn/{24MYCR6F.js → 23EQTPO3.js} +2 -2
  36. package/dist/cdn/{Z3DVGFEE.js → 2AXF774U.js} +2 -2
  37. package/dist/cdn/{UK6CP7BR.js → 3PKJWIC3.js} +2 -2
  38. package/dist/cdn/462JBSEV.js +422 -0
  39. package/dist/cdn/5QAHYX7Y.js +5 -0
  40. package/dist/cdn/{YVTKUITE.js → 5ZZGKP7N.js} +2 -2
  41. package/dist/cdn/{VHOF6SUZ.js → 6MAINSY5.js} +4 -3
  42. package/dist/cdn/6R6AY3D3.js +42 -0
  43. package/dist/cdn/{DMLSCJAM.js → 6YMR4QSD.js} +2 -2
  44. package/dist/cdn/{LXFCO34K.js → 7BCR6TUO.js} +2 -2
  45. package/dist/cdn/{EUNEQNYC.js → 7GH7VSB2.js} +1 -1
  46. package/dist/cdn/{YNJYG2RG.js → 7PLV4QH6.js} +2 -2
  47. package/dist/cdn/{JDL3HFFX.js → 7RCQFLPP.js} +2 -2
  48. package/dist/cdn/AMP6IALT.js +2 -0
  49. package/dist/cdn/{Y3AUHNRX.js → AO7BQHKC.js} +2 -2
  50. package/dist/cdn/AXDZBBNL.js +45 -0
  51. package/dist/cdn/{WBRZZ4FB.js → DDLZOMUY.js} +2 -2
  52. package/dist/cdn/DHOVCT6R.js +2 -0
  53. package/dist/cdn/EF453FJ2.js +3 -0
  54. package/dist/cdn/{ESTSYVJP.js → F2AHA4GB.js} +2 -2
  55. package/dist/cdn/FB5DRKEB.js +14 -0
  56. package/dist/cdn/FX5JFRDL.js +2 -0
  57. package/dist/cdn/{CFT5BBC6.js → FX7UOGHP.js} +2 -2
  58. package/dist/cdn/{5PT7ZFXF.js → GM3QP65I.js} +2 -2
  59. package/dist/cdn/H7422XUG.js +2 -0
  60. package/dist/cdn/HB5A5R2E.js +2 -0
  61. package/dist/cdn/{LSGRWCAO.js → KMQ3SP4I.js} +2 -2
  62. package/dist/cdn/{7EXACS27.js → LBVX2JYG.js} +2 -2
  63. package/dist/cdn/{MZJGADGH.js → LQ6R5YRN.js} +2 -2
  64. package/dist/cdn/METXWS7V.js +166 -0
  65. package/dist/cdn/{3QC3BRZP.js → MH5RPXHM.js} +2 -2
  66. package/dist/cdn/N2VQD46V.js +106 -0
  67. package/dist/cdn/{54ATSQPS.js → NAUXSHIE.js} +18 -18
  68. package/dist/cdn/{SFREIREB.js → NE7E52YR.js} +2 -2
  69. package/dist/cdn/{2YEKZADB.js → NVI3I46B.js} +2 -2
  70. package/dist/cdn/{YGW7TUNX.js → OAVEHGB6.js} +1 -1
  71. package/dist/cdn/{DSEMD4M2.js → OH64RMOR.js} +3 -3
  72. package/dist/cdn/{PTGKT5P6.js → P6OPJQMC.js} +2 -2
  73. package/dist/cdn/QDO2AO53.js +36 -0
  74. package/dist/cdn/{TRDKA5Y6.js → QR54T33D.js} +2 -2
  75. package/dist/cdn/{457RLS3H.js → RVOAPUBN.js} +2 -2
  76. package/dist/cdn/{5JBT3YNY.js → SXDLXCIM.js} +2 -2
  77. package/dist/cdn/SZOVY2QU.js +2 -0
  78. package/dist/cdn/U3QQW6VA.js +16 -0
  79. package/dist/cdn/{G4SVCCJH.js → USMDJUFS.js} +2 -2
  80. package/dist/cdn/{Q5D5LJS5.js → V2P4AIGG.js} +2 -2
  81. package/dist/cdn/Y333DGV6.js +2 -0
  82. package/dist/cdn/Y67XAMT4.js +22 -0
  83. package/dist/cdn/{CFDTXKJ6.js → YIMNOUTF.js} +1 -1
  84. package/dist/cdn/ZS2TZ6BF.js +31 -0
  85. package/dist/cdn/{W5CHGOOR.js → ZTBA5PM7.js} +2 -2
  86. package/dist/cdn/assets/assistant/t9n/messages.ar.json +1 -1
  87. package/dist/cdn/assets/assistant/t9n/messages.bg.json +1 -1
  88. package/dist/cdn/assets/assistant/t9n/messages.bs.json +1 -1
  89. package/dist/cdn/assets/assistant/t9n/messages.ca.json +1 -1
  90. package/dist/cdn/assets/assistant/t9n/messages.cs.json +1 -1
  91. package/dist/cdn/assets/assistant/t9n/messages.da.json +1 -1
  92. package/dist/cdn/assets/assistant/t9n/messages.de.json +1 -1
  93. package/dist/cdn/assets/assistant/t9n/messages.el.json +1 -1
  94. package/dist/cdn/assets/assistant/t9n/messages.es.json +1 -1
  95. package/dist/cdn/assets/assistant/t9n/messages.et.json +1 -1
  96. package/dist/cdn/assets/assistant/t9n/messages.fi.json +1 -1
  97. package/dist/cdn/assets/assistant/t9n/messages.fr.json +1 -1
  98. package/dist/cdn/assets/assistant/t9n/messages.he.json +1 -1
  99. package/dist/cdn/assets/assistant/t9n/messages.hr.json +1 -1
  100. package/dist/cdn/assets/assistant/t9n/messages.hu.json +1 -1
  101. package/dist/cdn/assets/assistant/t9n/messages.id.json +1 -1
  102. package/dist/cdn/assets/assistant/t9n/messages.it.json +1 -1
  103. package/dist/cdn/assets/assistant/t9n/messages.ja.json +1 -1
  104. package/dist/cdn/assets/assistant/t9n/messages.ko.json +1 -1
  105. package/dist/cdn/assets/assistant/t9n/messages.lt.json +1 -1
  106. package/dist/cdn/assets/assistant/t9n/messages.lv.json +1 -1
  107. package/dist/cdn/assets/assistant/t9n/messages.nl.json +1 -1
  108. package/dist/cdn/assets/assistant/t9n/messages.no.json +1 -1
  109. package/dist/cdn/assets/assistant/t9n/messages.pl.json +1 -1
  110. package/dist/cdn/assets/assistant/t9n/messages.pt-BR.json +1 -1
  111. package/dist/cdn/assets/assistant/t9n/messages.pt-PT.json +1 -1
  112. package/dist/cdn/assets/assistant/t9n/messages.ro.json +1 -1
  113. package/dist/cdn/assets/assistant/t9n/messages.ru.json +1 -1
  114. package/dist/cdn/assets/assistant/t9n/messages.sk.json +1 -1
  115. package/dist/cdn/assets/assistant/t9n/messages.sl.json +1 -1
  116. package/dist/cdn/assets/assistant/t9n/messages.sr.json +1 -1
  117. package/dist/cdn/assets/assistant/t9n/messages.sv.json +1 -1
  118. package/dist/cdn/assets/assistant/t9n/messages.th.json +1 -1
  119. package/dist/cdn/assets/assistant/t9n/messages.tr.json +1 -1
  120. package/dist/cdn/assets/assistant/t9n/messages.uk.json +1 -1
  121. package/dist/cdn/assets/assistant/t9n/messages.vi.json +1 -1
  122. package/dist/cdn/assets/assistant/t9n/messages.zh-CN.json +1 -1
  123. package/dist/cdn/assets/assistant/t9n/messages.zh-HK.json +1 -1
  124. package/dist/cdn/assets/assistant/t9n/messages.zh-TW.json +1 -1
  125. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ar.json +1 -1
  126. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.bg.json +1 -1
  127. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.bs.json +1 -1
  128. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ca.json +1 -1
  129. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.cs.json +1 -1
  130. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.da.json +1 -1
  131. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.de.json +1 -1
  132. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.el.json +1 -1
  133. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.es.json +1 -1
  134. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.et.json +1 -1
  135. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.fi.json +1 -1
  136. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.fr.json +1 -1
  137. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.he.json +1 -1
  138. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.hr.json +1 -1
  139. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.hu.json +1 -1
  140. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.id.json +1 -1
  141. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.it.json +1 -1
  142. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ja.json +1 -1
  143. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ko.json +1 -1
  144. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.lt.json +1 -1
  145. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.lv.json +1 -1
  146. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.nl.json +1 -1
  147. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.no.json +1 -1
  148. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pl.json +1 -1
  149. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pt-BR.json +1 -1
  150. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.pt-PT.json +1 -1
  151. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ro.json +1 -1
  152. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.ru.json +1 -1
  153. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sk.json +1 -1
  154. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sl.json +1 -1
  155. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sr.json +1 -1
  156. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.sv.json +1 -1
  157. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.th.json +1 -1
  158. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.tr.json +1 -1
  159. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.uk.json +1 -1
  160. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.vi.json +1 -1
  161. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-CN.json +1 -1
  162. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-HK.json +1 -1
  163. package/dist/cdn/assets/assistant-message-feedback/t9n/messages.zh-TW.json +1 -1
  164. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ar.json +1 -1
  165. package/dist/cdn/assets/assistant-message-footer/t9n/messages.bg.json +1 -1
  166. package/dist/cdn/assets/assistant-message-footer/t9n/messages.bs.json +1 -1
  167. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ca.json +1 -1
  168. package/dist/cdn/assets/assistant-message-footer/t9n/messages.cs.json +1 -1
  169. package/dist/cdn/assets/assistant-message-footer/t9n/messages.da.json +1 -1
  170. package/dist/cdn/assets/assistant-message-footer/t9n/messages.de.json +1 -1
  171. package/dist/cdn/assets/assistant-message-footer/t9n/messages.el.json +1 -1
  172. package/dist/cdn/assets/assistant-message-footer/t9n/messages.es.json +1 -1
  173. package/dist/cdn/assets/assistant-message-footer/t9n/messages.et.json +1 -1
  174. package/dist/cdn/assets/assistant-message-footer/t9n/messages.fi.json +1 -1
  175. package/dist/cdn/assets/assistant-message-footer/t9n/messages.fr.json +1 -1
  176. package/dist/cdn/assets/assistant-message-footer/t9n/messages.he.json +1 -1
  177. package/dist/cdn/assets/assistant-message-footer/t9n/messages.hr.json +1 -1
  178. package/dist/cdn/assets/assistant-message-footer/t9n/messages.hu.json +1 -1
  179. package/dist/cdn/assets/assistant-message-footer/t9n/messages.id.json +1 -1
  180. package/dist/cdn/assets/assistant-message-footer/t9n/messages.it.json +1 -1
  181. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ja.json +1 -1
  182. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ko.json +1 -1
  183. package/dist/cdn/assets/assistant-message-footer/t9n/messages.lt.json +1 -1
  184. package/dist/cdn/assets/assistant-message-footer/t9n/messages.lv.json +1 -1
  185. package/dist/cdn/assets/assistant-message-footer/t9n/messages.nl.json +1 -1
  186. package/dist/cdn/assets/assistant-message-footer/t9n/messages.no.json +1 -1
  187. package/dist/cdn/assets/assistant-message-footer/t9n/messages.pl.json +1 -1
  188. package/dist/cdn/assets/assistant-message-footer/t9n/messages.pt-BR.json +1 -1
  189. package/dist/cdn/assets/assistant-message-footer/t9n/messages.pt-PT.json +1 -1
  190. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ro.json +1 -1
  191. package/dist/cdn/assets/assistant-message-footer/t9n/messages.ru.json +1 -1
  192. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sk.json +1 -1
  193. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sl.json +1 -1
  194. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sr.json +1 -1
  195. package/dist/cdn/assets/assistant-message-footer/t9n/messages.sv.json +1 -1
  196. package/dist/cdn/assets/assistant-message-footer/t9n/messages.th.json +1 -1
  197. package/dist/cdn/assets/assistant-message-footer/t9n/messages.tr.json +1 -1
  198. package/dist/cdn/assets/assistant-message-footer/t9n/messages.uk.json +1 -1
  199. package/dist/cdn/assets/assistant-message-footer/t9n/messages.vi.json +1 -1
  200. package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-CN.json +1 -1
  201. package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-HK.json +1 -1
  202. package/dist/cdn/assets/assistant-message-footer/t9n/messages.zh-TW.json +1 -1
  203. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ar.json +1 -1
  204. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.bg.json +1 -1
  205. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.bs.json +1 -1
  206. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ca.json +1 -1
  207. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.cs.json +1 -1
  208. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.da.json +1 -1
  209. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.de.json +1 -1
  210. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.el.json +1 -1
  211. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.es.json +1 -1
  212. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.et.json +1 -1
  213. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.fi.json +1 -1
  214. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.fr.json +1 -1
  215. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.he.json +1 -1
  216. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.hr.json +1 -1
  217. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.hu.json +1 -1
  218. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.id.json +1 -1
  219. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.it.json +1 -1
  220. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ja.json +1 -1
  221. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ko.json +1 -1
  222. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.lt.json +1 -1
  223. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.lv.json +1 -1
  224. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.nl.json +1 -1
  225. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.no.json +1 -1
  226. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pl.json +1 -1
  227. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pt-BR.json +1 -1
  228. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.pt-PT.json +1 -1
  229. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ro.json +1 -1
  230. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.ru.json +1 -1
  231. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sk.json +1 -1
  232. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sl.json +1 -1
  233. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sr.json +1 -1
  234. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.sv.json +1 -1
  235. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.th.json +1 -1
  236. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.tr.json +1 -1
  237. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.uk.json +1 -1
  238. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.vi.json +1 -1
  239. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-CN.json +1 -1
  240. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-HK.json +1 -1
  241. package/dist/cdn/assets/assistant-message-read-aloud/t9n/messages.zh-TW.json +1 -1
  242. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ar.json +1 -1
  243. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.bg.json +1 -1
  244. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.bs.json +1 -1
  245. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ca.json +1 -1
  246. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.cs.json +1 -1
  247. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.da.json +1 -1
  248. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.de.json +1 -1
  249. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.el.json +1 -1
  250. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.es.json +1 -1
  251. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.et.json +1 -1
  252. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.fi.json +1 -1
  253. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.fr.json +1 -1
  254. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.he.json +1 -1
  255. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.hr.json +1 -1
  256. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.hu.json +1 -1
  257. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.id.json +1 -1
  258. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.it.json +1 -1
  259. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ja.json +1 -1
  260. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ko.json +1 -1
  261. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.lt.json +1 -1
  262. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.lv.json +1 -1
  263. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.nl.json +1 -1
  264. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.no.json +1 -1
  265. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pl.json +1 -1
  266. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pt-BR.json +1 -1
  267. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.pt-PT.json +1 -1
  268. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ro.json +1 -1
  269. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.ru.json +1 -1
  270. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sk.json +1 -1
  271. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sl.json +1 -1
  272. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sr.json +1 -1
  273. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.sv.json +1 -1
  274. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.th.json +1 -1
  275. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.tr.json +1 -1
  276. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.uk.json +1 -1
  277. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.vi.json +1 -1
  278. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-CN.json +1 -1
  279. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-HK.json +1 -1
  280. package/dist/cdn/assets/assistant-suggested-prompts/t9n/messages.zh-TW.json +1 -1
  281. package/dist/cdn/index.js +2 -2
  282. package/dist/cdn/main.css +1 -1
  283. package/dist/chunks/BaseWorkflow.js +107 -0
  284. package/dist/chunks/adapter.js +2964 -0
  285. package/dist/chunks/arcgisKnowledgeGraph.js +174 -0
  286. package/dist/chunks/arcgis_knowledge_current_lc_context.js +8 -0
  287. package/dist/chunks/arcgis_knowledge_current_map_context.js +8 -0
  288. package/dist/chunks/arcgis_knowledge_lucene_generation_prompt.js +101 -0
  289. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +48 -0
  290. package/dist/chunks/arcgis_knowledge_tool_prompt.js +34 -0
  291. package/dist/chunks/converterUtils.js +1 -1
  292. package/dist/chunks/dataExplorationGraph.js +289 -0
  293. package/dist/chunks/data_explore_filter_prompt.js +125 -0
  294. package/dist/chunks/data_explore_query_prompt.js +131 -0
  295. package/dist/chunks/embeddings.worker.js +25 -0
  296. package/dist/chunks/field_descriptions_prompt.js +112 -0
  297. package/dist/chunks/generateLayerDescriptions.js +413 -0
  298. package/dist/chunks/graph.js +86 -0
  299. package/dist/chunks/helpGraph.js +123 -0
  300. package/dist/chunks/help_prompt.js +57 -0
  301. package/dist/chunks/intent_prompt.js +124 -0
  302. package/dist/chunks/layerStylingGraph.js +189 -0
  303. package/dist/chunks/layer_descriptions_prompt.js +59 -0
  304. package/dist/chunks/layer_styling_prompt.js +72 -0
  305. package/dist/chunks/navigationGraph.js +266 -0
  306. package/dist/chunks/navigation_intent_prompt.js +46 -0
  307. package/dist/chunks/navigation_tool_prompt.js +39 -0
  308. package/dist/chunks/orchestrator.js +528 -0
  309. package/dist/chunks/runtime.js +2 -2
  310. package/dist/chunks/slottableRequestUtils.js +1 -1
  311. package/dist/chunks/state.js +71 -0
  312. package/dist/chunks/summarize_query_response_prompt.js +77 -0
  313. package/dist/chunks/toolCallResponse.js +29 -0
  314. package/dist/chunks/useT9n.js +1 -1
  315. package/dist/chunks/utils.js +47 -29
  316. package/dist/chunks/utils2.js +42 -7
  317. package/dist/chunks/utils3.js +16 -0
  318. package/dist/components/arcgis-assistant/customElement.d.ts +60 -8
  319. package/dist/components/arcgis-assistant/customElement.js +32 -24
  320. package/dist/components/arcgis-assistant/types.d.ts +1 -1
  321. package/dist/components/arcgis-assistant-agent/customElement.d.ts +1 -1
  322. package/dist/components/arcgis-assistant-agent/customElement.js +2 -2
  323. package/dist/components/arcgis-assistant-chat/customElement.js +1 -1
  324. package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -1
  325. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +25 -9
  326. package/dist/components/arcgis-assistant-help-agent/customElement.js +28 -9
  327. package/dist/components/arcgis-assistant-interrupt/customElement.js +8 -12
  328. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +158 -0
  329. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +68 -0
  330. package/dist/components/arcgis-assistant-knowledge-agent/index.d.ts +1 -0
  331. package/dist/components/arcgis-assistant-knowledge-agent/index.js +1 -0
  332. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +28 -9
  333. package/dist/components/arcgis-assistant-message/customElement.js +1 -1
  334. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  335. package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
  336. package/dist/components/arcgis-assistant-message-feedback/customElement.js +1 -1
  337. package/dist/components/arcgis-assistant-message-footer/customElement.js +1 -1
  338. package/dist/components/arcgis-assistant-message-loading/customElement.js +1 -1
  339. package/dist/components/arcgis-assistant-message-log/customElement.js +1 -1
  340. package/dist/components/arcgis-assistant-message-read-aloud/customElement.js +24 -28
  341. package/dist/components/arcgis-assistant-message-text/customElement.js +1 -1
  342. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +26 -8
  343. package/dist/components/arcgis-assistant-speech-input/customElement.js +1 -1
  344. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +1 -1
  345. package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
  346. package/dist/docs/api.json +1 -1
  347. package/dist/docs/docs.json +1 -1
  348. package/dist/docs/vscode.html-custom-data.json +1 -1
  349. package/dist/docs/web-types.json +1 -1
  350. package/dist/index.d.ts +4 -0
  351. package/dist/index.js +1 -1
  352. package/dist/loader.js +2 -1
  353. package/dist/types/lumina.d.ts +6 -1
  354. package/dist/types/preact.d.ts +7 -1
  355. package/dist/types/react.d.ts +8 -1
  356. package/dist/types/stencil.d.ts +6 -1
  357. package/dist/utils/index.d.ts +203 -9
  358. package/dist/utils/index.js +109 -11
  359. package/package.json +26 -11
  360. package/dist/cdn/4CPZZBYD.js +0 -2
  361. package/dist/cdn/5JS65BCP.js +0 -29
  362. package/dist/cdn/7EHQLXMU.js +0 -2
  363. package/dist/cdn/AKOWC7YT.js +0 -18
  364. package/dist/cdn/ARCP5UZY.js +0 -2
  365. package/dist/cdn/B4DEC7PH.js +0 -2
  366. package/dist/cdn/D7WNBUVK.js +0 -106
  367. package/dist/cdn/I2KPFZDL.js +0 -2
  368. package/dist/cdn/KVH3PDVW.js +0 -2
  369. package/dist/cdn/M73KKJSM.js +0 -2
  370. package/dist/cdn/O62HTIOD.js +0 -2
  371. package/dist/cdn/R5FWFRWW.js +0 -2
  372. package/dist/cdn/YW52XJMM.js +0 -396
  373. package/dist/cdn/Z4N6N4OZ.js +0 -271
  374. package/dist/cdn/ZLO73NU6.js +0 -2
  375. package/dist/cdn/ZPNJGIAF.js +0 -2
@@ -0,0 +1,152 @@
1
+ import type { FunctionToolMiddleware, FunctionToolMiddlewareRequest } from "../tools/FunctionTool.js";
2
+ import type { AgentData, AgentExecutionConfig, AgentGraphState } from "../types.js";
3
+ import type { AgentMiddleware, AgentRunRequest } from "./types.js";
4
+ import type { UiInterrupt } from "../../utils/index.js";
5
+
6
+ /** @since 5.1 */
7
+ export interface HumanInTheLoopInterruptRequest<TCustomState extends AgentData = AgentData> extends AgentRunRequest<TCustomState> {
8
+ /**
9
+ * The ID of the agent requesting human intervention. This can be used to correlate the
10
+ * interrupt with a specific agent, especially in cases where
11
+ * multiple agents may be running concurrently and using the same middleware.
12
+ *
13
+ * @since 5.1
14
+ */
15
+ agentId: string;
16
+ }
17
+
18
+ /** @since 5.1 */
19
+ export type HumanInTheLoopInterrupt = Partial<UiInterrupt>;
20
+
21
+ /**
22
+ * Options for configuring the HumanInTheLoopMiddleware.
23
+ *
24
+ * @since 5.1
25
+ */
26
+ export interface HumanInTheLoopMiddlewareOptions<TCustomState extends AgentData = AgentData> {
27
+ /**
28
+ * An optional function that generates a custom interrupt object based on the agent run request. This allows for dynamic messages and
29
+ * metadata to be included in the interrupt, providing context to the user when prompting for input or approval.
30
+ *
31
+ * If not provided, a default interrupt with a generic approval message will be used.
32
+ *
33
+ * @param request - The agent run request that triggered the interrupt, containing details about the agent, node, and execution context.
34
+ * @returns An object containing the interrupt details, which will be thrown as a NodeInterrupt to pause the agent's execution.
35
+ * @since 5.1
36
+ */
37
+ interrupt?(request: HumanInTheLoopInterruptRequest<TCustomState>): HumanInTheLoopInterrupt | Promise<HumanInTheLoopInterrupt>;
38
+ /**
39
+ * An optional key in the agent state where the human response should be stored.
40
+ *
41
+ * @since 5.1
42
+ */
43
+ outputKey?: keyof AgentGraphState<TCustomState>;
44
+ }
45
+
46
+ /** @since 5.1 */
47
+ export interface HumanInTheLoopToolMessageRequest<TInput extends AgentData = AgentData> extends FunctionToolMiddlewareRequest<TInput> {
48
+ /**
49
+ * The arguments passed to the tool that is requesting human intervention.
50
+ *
51
+ * @since 5.1
52
+ */
53
+ args: object;
54
+ /**
55
+ * The id of the tool call that is requesting human intervention.
56
+ *
57
+ * @since 5.1
58
+ */
59
+ toolCallId?: string;
60
+ /**
61
+ * The name of the tool that is requesting human intervention.
62
+ *
63
+ * @since 5.1
64
+ */
65
+ toolName: string;
66
+ }
67
+
68
+ /**
69
+ * This middleware is designed to allow for human intervention during agent execution by throwing an interrupt that can be handled by the orchestrator to pause the agent and
70
+ * prompt the user for input or approval.
71
+ *
72
+ * @since 5.1
73
+ */
74
+ export interface HumanInTheLoopToolMiddlewareOptions<TInput extends AgentData = AgentData> {
75
+ /**
76
+ * An optional function that generates a custom interrupt object based on the tool middleware request. This allows for dynamic messages and
77
+ * metadata to be included in the interrupt, providing context to the user when prompting for input or approval at the tool execution level.
78
+ *
79
+ * @param request - The tool middleware request that triggered the interrupt, containing details about the tool, input arguments, and execution context.
80
+ * @since 5.1
81
+ * @return An object containing the interrupt details, which will be thrown as a NodeInterrupt to pause the tool's execution.
82
+ */
83
+ interrupt?(request: HumanInTheLoopToolMessageRequest<TInput>): HumanInTheLoopInterrupt | Promise<HumanInTheLoopInterrupt>;
84
+ /**
85
+ * An optional key in the tool input where the human response should be stored.
86
+ *
87
+ * @since 5.1
88
+ */
89
+ outputKey?: keyof TInput;
90
+ }
91
+
92
+ /**
93
+ * This middleware allows for human intervention during agent execution by throwing an interrupt
94
+ * to pause the agent and prompt the user for input or approval prior to proceeding. It can be used
95
+ * to implement a human-in-the-loop workflow, where certain decisions or actions require human approval before proceeding.
96
+ *
97
+ * The interrupt includes customizable messages and metadata to provide context to the user.
98
+ *
99
+ * @param options - Configuration options for the middleware, including the interrupt handler and optional output key for storing the human response in
100
+ * the agent state.
101
+ * @returns An agent middleware that can be added to an agent's middleware stack.
102
+ * @since 5.1
103
+ * @example
104
+ * ```ts
105
+ * const agent = new WorkflowAgent({
106
+ * workflow: myWorkflow,
107
+ * middlewares: [
108
+ * createHumanInTheLoopMiddleware({
109
+ * interrupt: async ({ agentId }) => ({
110
+ * message: `Agent ${agentId} is requesting approval to continue. Do you approve?`,
111
+ * }),
112
+ * }),
113
+ * ],
114
+ * });
115
+ * ```
116
+ */
117
+ export function createHumanInTheLoopMiddleware<TCustomState extends AgentData = AgentData>(options?: HumanInTheLoopMiddlewareOptions<TCustomState>): AgentMiddleware<TCustomState>;
118
+
119
+ /**
120
+ * This middleware is designed to wrap tool calls within an agent, allowing for human intervention at the tool execution level. When a tool wrapped with this middleware is invoked,
121
+ * it will throw an interrupt similar to the agent-level middleware, prompting the user for input or approval before the tool executes.
122
+ *
123
+ * @param options - Configuration options for the middleware, including the interrupt handler and optional output key for storing the human response in the tool input.
124
+ * @returns A function tool middleware that can be added to a tool's middleware stack.
125
+ * @since 5.1
126
+ * @example
127
+ * ```ts
128
+ * const myTool = new FunctionTool({
129
+ * name: "sensitiveOperation",
130
+ * execute: async (input) => {
131
+ * // perform sensitive operation
132
+ * },
133
+ * middlewares: [
134
+ * createHumanInTheLoopToolMiddleware({
135
+ * interrupt: async ({ toolName, args }) => ({
136
+ * message: `Tool ${toolName} is requesting approval to execute with arguments: ${JSON.stringify(args)}. Do you approve?`,
137
+ * }),
138
+ * }),
139
+ * ],
140
+ * });
141
+ * ```
142
+ */
143
+ export function createHumanInTheLoopToolMiddleware<TInput extends AgentData = AgentData, TOutput = unknown>(options?: HumanInTheLoopToolMiddlewareOptions<TInput>): FunctionToolMiddleware<TInput, TOutput>;
144
+
145
+ /**
146
+ * This function retrieves the human-in-the-loop (HITL) response payload from the agent execution configuration.
147
+ *
148
+ * @param config - The agent execution configuration that may contain a HITL response.
149
+ * @returns The payload from the HITL response if available; otherwise, undefined.
150
+ * @since 5.1
151
+ */
152
+ export function getHumanInTheLoopPayload<TPayload = unknown>(config: AgentExecutionConfig | undefined): TPayload | undefined;
@@ -0,0 +1,94 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { NodeInterrupt as s } from "@langchain/langgraph/web";
3
+ import { createAgentMiddleware as f, createToolMiddleware as I } from "./middleware.js";
4
+ const m = "human-in-the-loop", w = "Agent execution requires approval", p = "Agent execution rejected by the user.", h = "human-in-the-loop-tool", y = "Tool execution requires approval";
5
+ function k(t = {}) {
6
+ const { outputKey: n } = t;
7
+ return f(
8
+ m,
9
+ {
10
+ wrapAgent: async (e, r) => {
11
+ const a = T(e), o = M(a, e), i = u(e.config?.configurable);
12
+ if (i?.agentId !== a)
13
+ throw new s(await g({ agentId: a, interruptId: o, options: t, request: e }));
14
+ if (i.id !== o) {
15
+ if (b(a, i.id))
16
+ return await r(e);
17
+ throw new s(await g({ agentId: a, interruptId: o, options: t, request: e }));
18
+ }
19
+ if (i.payload === !1)
20
+ return { outputMessage: p, status: "failed", summary: p };
21
+ const l = n ? { ...e.state, [n]: i.payload } : e.state, d = { ...e, state: l };
22
+ return await r(d);
23
+ }
24
+ },
25
+ { outputKey: n }
26
+ );
27
+ }
28
+ function v(t = {}) {
29
+ const { outputKey: n } = t;
30
+ return I(h, {
31
+ wrapToolCall: async (e, r) => {
32
+ const a = e.tool.name, o = A(e.config?.configurable), i = R(o, e.toolCallId ?? a), l = u(e.config?.configurable);
33
+ if (l?.agentId !== o || l.id !== i)
34
+ throw new s(await $({ agentId: o, interruptId: i, options: t, request: e }));
35
+ if (l.payload === !1)
36
+ return `Tool call "${a}" was rejected by the user.`;
37
+ const d = n ? { ...e.input, [n]: l.payload } : e.input, c = { ...e, input: d };
38
+ return await r(c);
39
+ }
40
+ });
41
+ }
42
+ async function g(t) {
43
+ const { agentId: n, interruptId: e, options: r, request: a } = t, o = await r.interrupt?.({ ...a, agentId: n });
44
+ return {
45
+ agentId: n,
46
+ id: e,
47
+ kind: o?.kind ?? "booleanChoice",
48
+ message: o?.message ?? w,
49
+ metadata: o?.metadata
50
+ };
51
+ }
52
+ function T(t) {
53
+ return typeof t.config?.configurable?.agentId == "string" ? t.config.configurable.agentId : t.agent.id;
54
+ }
55
+ function M(t, n) {
56
+ const e = n.config?.configurable?.thread_id, r = typeof e == "string" && e ? `${e}:` : "";
57
+ return `${t}:${r}${n.nodeName}`;
58
+ }
59
+ function b(t, n) {
60
+ return n.startsWith(`${t}:tool:`);
61
+ }
62
+ function A(t) {
63
+ return typeof t?.agentId == "string" ? t.agentId : "llm-agent";
64
+ }
65
+ function R(t, n) {
66
+ return `${t}:tool:${n}`;
67
+ }
68
+ async function $(t) {
69
+ const { agentId: n, interruptId: e, options: r, request: a } = t, { input: o, tool: i, toolCallId: l } = a, d = i.name, c = await r.interrupt?.({ ...a, args: o, toolName: d, toolCallId: l });
70
+ return {
71
+ agentId: n,
72
+ id: e,
73
+ kind: c?.kind ?? "booleanChoice",
74
+ message: c?.message ?? `${y}
75
+ Tool: ${d}`,
76
+ metadata: c?.metadata ?? {
77
+ args: o,
78
+ toolCallId: l,
79
+ toolName: d
80
+ }
81
+ };
82
+ }
83
+ function H(t) {
84
+ return u(t?.configurable)?.payload;
85
+ }
86
+ function u(t) {
87
+ const n = t?.hitlResponse;
88
+ return n && typeof n == "object" && "id" in n && "agentId" in n ? n : null;
89
+ }
90
+ export {
91
+ k as createHumanInTheLoopMiddleware,
92
+ v as createHumanInTheLoopToolMiddleware,
93
+ H as getHumanInTheLoopPayload
94
+ };
@@ -0,0 +1,25 @@
1
+ import type { FunctionToolMiddleware } from "../tools/FunctionTool.js";
2
+ import type { AgentData, AgentGraphState, EmptyAgentData } from "../types.js";
3
+ import type { AgentMiddleware, AgentMiddlewareHooks, ToolMiddlewareHooks } from "./types.js";
4
+
5
+ /**
6
+ * Creates an agent middleware with the specified hooks and options.
7
+ *
8
+ * @param name - The name of the middleware.
9
+ * @param hooks - The hooks to be used in the middleware.
10
+ * @param options - Optional configuration for the middleware, such as the output key.
11
+ * @returns The created agent middleware.
12
+ * @since 5.1
13
+ */
14
+ export function createAgentMiddleware<TCustomState extends AgentData = EmptyAgentData>(name: string, hooks: AgentMiddlewareHooks<TCustomState>, options?: { outputKey?: keyof AgentGraphState<TCustomState>; }): AgentMiddleware<TCustomState>;
15
+
16
+ /**
17
+ * Creates a tool middleware with the specified hooks and options.
18
+ *
19
+ * @param name - The name of the middleware.
20
+ * @param hooks - The hooks to be used in the middleware.
21
+ * @param options - Optional configuration for the middleware, such as the output key.
22
+ * @returns The created function tool middleware.
23
+ * @since 5.1
24
+ */
25
+ export function createToolMiddleware<TInput extends AgentData = AgentData, TOutput = unknown>(name: string, hooks: ToolMiddlewareHooks<TInput, TOutput>, options?: { outputKey?: string; }): FunctionToolMiddleware<TInput, TOutput>;
@@ -0,0 +1,44 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { createMiddleware as p } from "langchain";
3
+ function g(e, t, r) {
4
+ return {
5
+ name: e,
6
+ handler: async (a, n) => {
7
+ const c = async (l) => {
8
+ const d = await t.beforeAgent?.(l), u = d ? {
9
+ ...l,
10
+ state: {
11
+ ...l.state,
12
+ ...d
13
+ }
14
+ } : l, i = await n(u), w = await t.afterAgent?.({ ...u, result: i });
15
+ return w ? { ...i, ...w } : i;
16
+ };
17
+ return t.wrapAgent ? await t.wrapAgent(a, c) : await c(a);
18
+ },
19
+ hooks: t,
20
+ outputKey: r?.outputKey
21
+ };
22
+ }
23
+ function y(e, t, r) {
24
+ return { name: e, handler: async (a, n) => t.wrapToolCall ? await t.wrapToolCall(a, n) : await n(a), outputKey: r?.outputKey };
25
+ }
26
+ function C(e) {
27
+ return e.map((t) => f(t.name, t.hooks ?? {})).filter((t) => !!t);
28
+ }
29
+ function f(e, t) {
30
+ const { afterModel: r, beforeModel: o, wrapModelCall: a, wrapToolCall: n } = t;
31
+ if (!(!r && !o && !a && !n))
32
+ return p({
33
+ afterModel: r,
34
+ beforeModel: o,
35
+ name: e,
36
+ wrapModelCall: a,
37
+ wrapToolCall: n
38
+ });
39
+ }
40
+ export {
41
+ C as convertToLangChainMiddlewares,
42
+ g as createAgentMiddleware,
43
+ y as createToolMiddleware
44
+ };
@@ -0,0 +1,25 @@
1
+ import type { FunctionToolMiddleware } from "../tools/FunctionTool.js";
2
+ import type { AgentMiddleware } from "./types.js";
3
+ import type { AgentData } from "../types.js";
4
+
5
+ /**
6
+ * This middleware is responsible for sending trace messages whenever the agent makes a call to the language model or executes a tool.
7
+ *
8
+ * It uses the `sendTraceMessage` function from the orchestrator to send messages that include
9
+ * details about the model calls and tool
10
+ * executions, which can be useful for debugging and monitoring the agent's behavior.
11
+ *
12
+ * @returns An agent middleware that wraps model calls and sends trace messages.
13
+ * @since 5.1
14
+ */
15
+ export function createAgentTraceMiddleware(): AgentMiddleware;
16
+
17
+ /**
18
+ * This middleware is responsible for sending trace messages whenever a tool is executed by the agent. It wraps tool calls and uses the `sendTraceMessage`
19
+ * function from the orchestrator to send messages that include details about the tool execution, such as the tool name and its result. This can be useful for
20
+ * debugging and monitoring the behavior of tools within the agent's execution.
21
+ *
22
+ * @returns A function tool middleware that wraps tool calls and sends trace messages.
23
+ * @since 5.1
24
+ */
25
+ export function createToolTraceMiddleware<TInput extends AgentData = AgentData, TOutput = unknown>(): FunctionToolMiddleware<TInput, TOutput>;
@@ -0,0 +1,50 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import "@arcgis/core/identity/IdentityManager.js";
3
+ import "@arcgis/core/portal/Portal.js";
4
+ import "@langchain/langgraph/web";
5
+ import { s as n } from "../../chunks/generateLayerDescriptions.js";
6
+ import { AIMessage as l, ToolMessage as s } from "@langchain/core/messages";
7
+ import "@langchain/openai";
8
+ import "@arcgis/core/core/reactiveUtils.js";
9
+ import "@arcgis/core/layers/FeatureLayer.js";
10
+ import "@arcgis/core/request.js";
11
+ import "@langchain/core/prompts";
12
+ import { createAgentMiddleware as c, createToolMiddleware as m } from "./middleware.js";
13
+ const d = "agent-trace", g = "tool-trace";
14
+ function $() {
15
+ return c(d, {
16
+ wrapModelCall: async (t, o) => {
17
+ const e = await o(t), a = t.runtime, i = p(e);
18
+ return await Promise.all(
19
+ i.map(
20
+ async (r) => await n(
21
+ {
22
+ text: `LLM requested tool call "${r.name}" with arguments: ${JSON.stringify(r.args, null, 2)}`
23
+ },
24
+ a
25
+ )
26
+ )
27
+ ), e;
28
+ }
29
+ });
30
+ }
31
+ function h() {
32
+ return m(g, {
33
+ wrapToolCall: async (t, o) => {
34
+ const e = await o(t), a = t.config;
35
+ return await n(
36
+ {
37
+ text: `Finished executing tool: ${s.isInstance(e) ? e.content.toString() : typeof e == "string" ? e : t.tool.name}`
38
+ },
39
+ a
40
+ ), e;
41
+ }
42
+ });
43
+ }
44
+ function p(t) {
45
+ return !l.isInstance(t) || !Array.isArray(t.tool_calls) ? [] : t.tool_calls.filter((o) => typeof o?.name == "string");
46
+ }
47
+ export {
48
+ $ as createAgentTraceMiddleware,
49
+ h as createToolTraceMiddleware
50
+ };
@@ -0,0 +1,123 @@
1
+ import type { FunctionToolMiddlewareHandler } from "../tools/FunctionTool.js";
2
+ import type { AgentData, AgentExecutionConfig, AgentGraphState, EmptyAgentData } from "../types.js";
3
+ import type { AgentMiddleware as LangChainAgentMiddleware } from "langchain";
4
+
5
+ /**
6
+ * Handles a middleware request and returns the resulting value.
7
+ *
8
+ * @param request - The request payload for the current middleware stage.
9
+ */
10
+ export type MiddlewareHandler<TRequest, TResult> = (request: TRequest) => Promise<TResult> | TResult;
11
+
12
+ /**
13
+ * Wraps a middleware request and delegates to the next handler.
14
+ *
15
+ * @param request - The request payload for the current middleware stage.
16
+ * @param handler - The next handler in the middleware chain.
17
+ */
18
+ export type Middleware<TRequest, TResult> = (request: TRequest, handler: MiddlewareHandler<TRequest, TResult>) => Promise<TResult> | TResult;
19
+
20
+ export interface AgentMiddlewareAgent {
21
+ /**
22
+ * Description of the agent, which can be used to provide context in middleware hooks and interrupts.
23
+ *
24
+ * @since 5.1
25
+ */
26
+ description?: string;
27
+ /**
28
+ * Unique identifier for the agent, used for registration and invocation purposes.
29
+ *
30
+ * @since 5.1
31
+ */
32
+ id: string;
33
+ /**
34
+ * Name of the agent, used for display and identification purposes.
35
+ *
36
+ * @since 5.1
37
+ */
38
+ name: string;
39
+ }
40
+
41
+ export interface AgentRunRequest<TCustomState extends AgentData = EmptyAgentData> {
42
+ /**
43
+ * The agent that is being executed. This can be used in middleware hooks to access agent metadata and provide context for interrupts or other middleware behavior.
44
+ *
45
+ * @since 5.1
46
+ */
47
+ agent: AgentMiddlewareAgent;
48
+ /**
49
+ * The current execution configuration for the agent run, which may include configurable parameters, metadata, and other contextual information. This can be used in middleware
50
+ * hooks to make decisions based on the execution context or to store and retrieve information related to the agent run.
51
+ *
52
+ * @since 5.1
53
+ */
54
+ config?: AgentExecutionConfig;
55
+ /**
56
+ * The name of the current node being executed in the agent's workflow. This can be used in middleware hooks to provide context or make decisions based on the specific node.
57
+ *
58
+ * @since 5.1
59
+ */
60
+ nodeName: string;
61
+ /**
62
+ * The current state of the agent's workflow, which may include custom data and intermediate results. This can be used in middleware hooks to access or modify the agent's state during execution.
63
+ *
64
+ * @since 5.1
65
+ */
66
+ state: Partial<AgentGraphState<TCustomState>>;
67
+ }
68
+
69
+ export type AgentMiddlewareHandler<TCustomState extends AgentData = EmptyAgentData> = Middleware<AgentRunRequest<TCustomState>, AgentGraphState<TCustomState>>;
70
+
71
+ export interface AgentMiddleware<TCustomState extends AgentData = EmptyAgentData> {
72
+ name: string;
73
+ handler: AgentMiddlewareHandler<TCustomState>;
74
+ hooks?: AgentMiddlewareHooks<TCustomState>;
75
+ outputKey?: keyof AgentGraphState<TCustomState>;
76
+ }
77
+
78
+ export interface AfterAgentRequest<TCustomState extends AgentData = EmptyAgentData> extends AgentRunRequest<TCustomState> {
79
+ result: AgentGraphState<TCustomState>;
80
+ }
81
+
82
+ export interface AgentMiddlewareHooks<TCustomState extends AgentData = EmptyAgentData> {
83
+ /**
84
+ * An optional hook that is called after the agent has executed, allowing for modification of the result or additional side effects.
85
+ *
86
+ * @param request - The request payload for the afterAgent hook, including the original request and the result of the agent's execution.
87
+ * @returns A partial update to the agent's state or other modifications to be applied to the final result, or a promise that resolves to such an update.
88
+ * @since 5.1
89
+ */
90
+ afterAgent?(request: AfterAgentRequest<TCustomState>): Partial<AgentGraphState<TCustomState>> | Promise<Partial<AgentGraphState<TCustomState>> | void> | void;
91
+ readonly afterModel?: ModelLifecycleHook;
92
+ readonly beforeModel?: ModelLifecycleHook;
93
+ /**
94
+ * An optional hook that is called before the agent executes, allowing for modification of the request or additional side effects.
95
+ *
96
+ * @param request - The request payload for the beforeAgent hook, including the original request.
97
+ * @returns A partial update to the agent's state or other modifications to be applied to the request, or a promise that resolves to such an update.
98
+ * @since 5.1
99
+ */
100
+ beforeAgent?(request: AgentRunRequest<TCustomState>): Partial<AgentGraphState<TCustomState>> | Promise<Partial<AgentGraphState<TCustomState>> | void> | void;
101
+ /**
102
+ * An optional hook that wraps the entire agent execution, allowing for complete control over the execution flow.
103
+ *
104
+ * @since 5.1
105
+ */
106
+ readonly wrapAgent?: AgentMiddlewareHandler<TCustomState>;
107
+ readonly wrapModelCall?: LangChainMiddlewareHooks["wrapModelCall"];
108
+ readonly wrapToolCall?: LangChainMiddlewareHooks["wrapToolCall"];
109
+ }
110
+
111
+ /** @since 5.1 */
112
+ export interface ToolMiddlewareHooks<TInput extends AgentData = AgentData, TOutput = unknown> {
113
+ /**
114
+ * Hook that wraps a tool call, allowing you to intercept and modify the request and response of a tool execution. This can be used for logging, modifying inputs/outputs, or implementing custom behavior around tool calls.
115
+ *
116
+ * @since 5.1
117
+ */
118
+ readonly wrapToolCall?: FunctionToolMiddlewareHandler<TInput, TOutput>;
119
+ }
120
+
121
+ export type LangChainMiddlewareHooks = Pick<LangChainAgentMiddleware, "afterModel" | "beforeModel" | "wrapModelCall" | "wrapToolCall">;
122
+
123
+ export type ModelLifecycleHook = NonNullable<LangChainMiddlewareHooks["beforeModel"]>;
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+
@@ -0,0 +1,127 @@
1
+ import type Accessor from "@arcgis/core/core/Accessor.js";
2
+ import type z from "zod";
3
+ import type { StructuredToolInterface } from "@langchain/core/tools";
4
+ import type { Middleware } from "../middlewares/types.js";
5
+ import type { AgentData, AgentExecutionConfig } from "../types.js";
6
+
7
+ /**
8
+ * Execute function used by `FunctionTool`.
9
+ *
10
+ * @param input - Structured tool input.
11
+ * @param config - Optional execution configuration.
12
+ */
13
+ export type FunctionToolExecute<TInput extends object, TOutput> = (input: TInput, config?: AgentExecutionConfig) => Promise<TOutput> | TOutput;
14
+
15
+ export type FunctionToolResult<TOutput = unknown> = TOutput | string;
16
+
17
+ export interface FunctionToolMiddlewareRequest<TInput extends AgentData = AgentData> {
18
+ config?: AgentExecutionConfig;
19
+ input: TInput;
20
+ tool: FunctionToolMiddlewareTool;
21
+ toolCallId?: string;
22
+ }
23
+
24
+ export type FunctionToolMiddlewareHandler<TInput extends AgentData = AgentData, TOutput = unknown> = Middleware<FunctionToolMiddlewareRequest<TInput>, FunctionToolResult<TOutput>>;
25
+
26
+ export interface FunctionToolMiddleware<TInput extends AgentData = AgentData, TOutput = unknown> {
27
+ name: string;
28
+ handler: FunctionToolMiddlewareHandler<TInput, TOutput>;
29
+ outputKey?: keyof TInput;
30
+ }
31
+
32
+ export type ToolResultMode = "continue" | "terminal";
33
+
34
+ export interface FunctionToolLike {
35
+ /**
36
+ * Name of the tool, used for invocation by agents. This should be unique among the tools available to an agent.
37
+ *
38
+ * @since 5.1
39
+ */
40
+ name?: string;
41
+ /**
42
+ * Result mode determines how the agent should treat the output of this tool. If set to "terminal", the agent will return the tool's output directly as its final response. If set to "continue", the agent will continue processing after invoking the tool, allowing for further reasoning or tool calls.
43
+ *
44
+ * @since 5.1
45
+ */
46
+ resultMode?: ToolResultMode;
47
+ getTool: () => StructuredToolInterface;
48
+ }
49
+
50
+ /**
51
+ * FunctionTool is a tool implementation that allows users to define custom logic through a provided execute function,
52
+ * along with input/output schemas for validation and optional middleware for extensibility.
53
+ *
54
+ * The FunctionTool is passed to LLMAgents as part of their tools array, and can be invoked by the agent during execution
55
+ * based on the agent's prompt and reasoning process. The resultMode property allows the tool to either return
56
+ * a final response directly or continue the agent's processing after execution, providing flexibility in how the tool's
57
+ * output is used within the agent's workflow.
58
+ *
59
+ * @since 5.1
60
+ */
61
+ export class FunctionTool<TInput extends AgentData, TOutput = unknown> extends Accessor {
62
+ constructor(properties?: ConstructProperties<TInput, TOutput>);
63
+ /**
64
+ * A concise, but clear description of the tool's functionality.
65
+ * This should provide enough information for the agent to understand when and why to use the tool.
66
+ * You can include examples of a user's input that would trigger the tool, the values to extract, and
67
+ * sample output to illustrate its purpose.
68
+ *
69
+ * @required
70
+ */
71
+ accessor description: string;
72
+ /**
73
+ * The execute function contains the custom logic that will be executed when the tool is invoked
74
+ * by an agent. It receives
75
+ * the input object and an optional execution configuration, and returns either a result directly
76
+ * or a promise that resolves to the result.
77
+ *
78
+ * The result is validated against the output schema, if provided.
79
+ *
80
+ * @required
81
+ * @since 5.1
82
+ */
83
+ accessor execute: FunctionToolExecute<TInput, TOutput>;
84
+ /**
85
+ * The input schema defines the expected structure of the input object when invoking the tool.
86
+ * This should be a Zod schema object.
87
+ * The agent will validate the input against this schema before execution.
88
+ */
89
+ accessor inputSchema: z.ZodType<TInput> | undefined;
90
+ /** Middleware that can wrap this tool's execution. */
91
+ accessor middlewares: FunctionToolMiddleware<TInput, TOutput>[];
92
+ /**
93
+ * The name of the tool, which will be used to invoke it. This should be unique among the tools
94
+ * available to an agent. It should also be descriptive of the tool's functionality to make it
95
+ * clear to the agent when to use it.
96
+ *
97
+ * @required
98
+ */
99
+ accessor name: string;
100
+ /**
101
+ * The output schema defines the expected structure of the result returned by the tool.
102
+ * This should be a Zod schema object.
103
+ * The agent will validate the output against this schema after execution.
104
+ */
105
+ accessor outputSchema: z.ZodType<TOutput> | undefined;
106
+ /**
107
+ * The result mode determines how the agent should treat the output of this tool.
108
+ * If set to `terminal`, the agent will
109
+ * return the tool's output directly as its final response. If set to `continue`,
110
+ * the agent will continue processing after
111
+ * invoking the tool, allowing for further reasoning or tool calls.
112
+ *
113
+ * @default "continue"
114
+ */
115
+ accessor resultMode: ToolResultMode;
116
+ /** Builds the LangChain tool adapter used by LLM agents. */
117
+ getTool(): StructuredToolInterface;
118
+ }
119
+
120
+ export interface FunctionToolMiddlewareTool {
121
+ description: string;
122
+ name: string;
123
+ resultMode: ToolResultMode;
124
+ }
125
+
126
+ export type ConstructProperties<TInput extends AgentData, TOutput> = Partial<Pick<FunctionTool<TInput, TOutput>, "inputSchema" | "middlewares" | "outputSchema" | "resultMode">>
127
+ & Pick<FunctionTool<TInput, TOutput>, "description" | "execute" | "name">;