@arcgis/ai-components 6.0.0-next.0 → 6.0.0-next.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 (374) hide show
  1. package/dist/agent-utils/BaseAgent.js +1 -1
  2. package/dist/agent-utils/FunctionAgent.js +1 -1
  3. package/dist/agent-utils/LLMAgent.d.ts +9 -2
  4. package/dist/agent-utils/LLMAgent.js +46 -37
  5. package/dist/agent-utils/SkillAgent.js +1 -1
  6. package/dist/agent-utils/WorkflowAgent.js +1 -1
  7. package/dist/agent-utils/createSchema.js +1 -1
  8. package/dist/agent-utils/middlewares/humanInTheLoop.js +1 -1
  9. package/dist/agent-utils/middlewares/middleware.js +1 -1
  10. package/dist/agent-utils/middlewares/trace.js +1 -1
  11. package/dist/agent-utils/middlewares/types.js +1 -1
  12. package/dist/agent-utils/tools/FunctionTool.d.ts +12 -1
  13. package/dist/agent-utils/tools/FunctionTool.js +16 -15
  14. package/dist/agent-utils/tools/MCPToolProvider.d.ts +54 -0
  15. package/dist/agent-utils/tools/MCPToolProvider.js +120 -0
  16. package/dist/agent-utils/tools/ToolProvider.d.ts +13 -0
  17. package/dist/agent-utils/tools/WebMCPToolProvider.d.ts +37 -0
  18. package/dist/agent-utils/tools/WebMCPToolProvider.js +71 -0
  19. package/dist/agent-utils/workflows/ConditionalWorkflow.js +1 -1
  20. package/dist/agent-utils/workflows/LoopWorkflow.js +1 -1
  21. package/dist/agent-utils/workflows/ParallelWorkflow.js +1 -1
  22. package/dist/agent-utils/workflows/RouterWorkflow.js +1 -1
  23. package/dist/agent-utils/workflows/SequentialWorkflow.js +1 -1
  24. package/dist/agent-utils/workflows/SwitchWorkflow.js +1 -1
  25. package/dist/agents/agents/arcgisKnowledge/graph/arcgisKnowledgeGraph.js +1 -1
  26. package/dist/agents/agents/dataExploration/dataExplorationAgent.js +1 -1
  27. package/dist/agents/agents/dataExplorationGraph/graph/dataExplorationGraph.js +1 -1
  28. package/dist/agents/agents/help/helpAgent.js +1 -1
  29. package/dist/agents/agents/helpGraph/graph/helpGraph.js +1 -1
  30. package/dist/agents/agents/layerStyling/context/layerStylingContext.js +1 -1
  31. package/dist/agents/agents/layerStyling/graph/layerStylingGraph.js +1 -1
  32. package/dist/agents/agents/navigation/navigationAgent.js +1 -1
  33. package/dist/agents/agents/navigationGraph/graph/navigationGraph.js +1 -1
  34. package/dist/agents/tools/filter/clearFilters/adapter.js +1 -1
  35. package/dist/agents/tools/filter/resetMap/adapter.js +1 -1
  36. package/dist/agents/tools/filter/setFeatureEffect/adapter.js +1 -1
  37. package/dist/agents/tools/help/listFields/adapter.js +1 -1
  38. package/dist/agents/tools/navigation/goToAddress/adapter.js +1 -1
  39. package/dist/agents/tools/navigation/goToBookmark/adapter.js +1 -1
  40. package/dist/agents/tools/navigation/goToFeatures/adapter.js +1 -1
  41. package/dist/agents/tools/navigation/goToFullExtent/adapter.js +1 -1
  42. package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +1 -1
  43. package/dist/agents/tools/navigation/goToLayer/adapter.js +1 -1
  44. package/dist/agents/tools/navigation/goToScale/adapter.js +1 -1
  45. package/dist/agents/tools/navigation/goToViewpoint/adapter.js +1 -1
  46. package/dist/agents/tools/navigation/goToZoom/adapter.js +1 -1
  47. package/dist/agents/tools/query/getAttribute/adapter.js +29 -25
  48. package/dist/agents/tools/query/getStatistics/adapter.js +71 -67
  49. package/dist/agents/tools/query/getTopFeatures/adapter.js +75 -71
  50. package/dist/agents/tools/query/queryFeatures/adapter.js +41 -37
  51. package/dist/agents/tools/search/findRelevantFields/adapter.js +1 -1
  52. package/dist/agents/tools/search/findRelevantLayers/adapter.js +1 -1
  53. package/dist/agents/tools/shared/resolveToolArtifact.js +1 -1
  54. package/dist/agents/tools/shared/types.js +1 -1
  55. package/dist/cdn/24KEZCPF.js +2 -0
  56. package/dist/cdn/{2UKFCF2J.js → 272R36XK.js} +2 -2
  57. package/dist/cdn/{FX4LV2S3.js → 2H32MDP2.js} +1 -1
  58. package/dist/cdn/{VAXH6RUQ.js → 2HNGMLFD.js} +2 -2
  59. package/dist/cdn/{3HV6OXCZ.js → 2JD3G7IW.js} +2 -2
  60. package/dist/cdn/2NOLMOEP.js +9 -0
  61. package/dist/cdn/{ZU2FHVNK.js → 2OW3DCUT.js} +2 -2
  62. package/dist/cdn/2PGZDONH.js +2 -0
  63. package/dist/cdn/2WY5MPMY.js +2 -0
  64. package/dist/cdn/{4OLV5LA7.js → 3COVQI26.js} +2 -2
  65. package/dist/cdn/{VIJVRJHL.js → 3UVQLYUK.js} +2 -2
  66. package/dist/cdn/{BIEX4MVV.js → 5HNKH5OK.js} +2 -2
  67. package/dist/cdn/{46DT6BIG.js → 5INBG23U.js} +1 -1
  68. package/dist/cdn/{MHUEU6MR.js → 5LBUP33F.js} +2 -2
  69. package/dist/cdn/{UZLQALHY.js → 5PV2GUZW.js} +1 -1
  70. package/dist/cdn/{UYEF3IKE.js → 5SRRG7WG.js} +2 -2
  71. package/dist/cdn/{AMFZY5QK.js → 5XZ5VL42.js} +2 -2
  72. package/dist/cdn/{IEAHAC6B.js → 63OF33IL.js} +2 -2
  73. package/dist/cdn/{7OQA4GCM.js → 6ELWX4W5.js} +2 -2
  74. package/dist/cdn/{OKVLGJAG.js → 6J3J7VLW.js} +2 -2
  75. package/dist/cdn/{AOVJ34QE.js → 6QOSUG64.js} +2 -2
  76. package/dist/cdn/{GVFJHADC.js → 6UGT2UG5.js} +2 -2
  77. package/dist/cdn/{VVWKEN53.js → 7APXFHDF.js} +3 -3
  78. package/dist/cdn/{QJOO6IIX.js → 7GDMXAF5.js} +2 -2
  79. package/dist/cdn/7JIXXYZR.js +2 -0
  80. package/dist/cdn/{2ZH5JNHL.js → 7OQK2F7O.js} +2 -2
  81. package/dist/cdn/{I7PHDOEQ.js → 7XVIZ7HK.js} +2 -2
  82. package/dist/cdn/{TRZJYWEB.js → A4ZVCRVF.js} +3 -3
  83. package/dist/cdn/{OVIQ5NSE.js → AGDGDULE.js} +2 -2
  84. package/dist/cdn/{TPULIO6I.js → AMA67DVI.js} +2 -2
  85. package/dist/cdn/AO42IPOX.js +2 -0
  86. package/dist/cdn/AOT3PM2Q.js +2 -0
  87. package/dist/cdn/{YO3L3XIH.js → AQ7KG25Q.js} +2 -2
  88. package/dist/cdn/{KKXOSV62.js → AWH4VDPD.js} +2 -2
  89. package/dist/cdn/AY2ZONWQ.js +2 -0
  90. package/dist/cdn/{B2JRBDJZ.js → BMVPOFHU.js} +2 -2
  91. package/dist/cdn/BWUQRZPK.js +2 -0
  92. package/dist/cdn/{EXIA3APU.js → C3VLDYS2.js} +2 -2
  93. package/dist/cdn/{PQ2DPOFM.js → C5Q6E7UC.js} +2 -2
  94. package/dist/cdn/{FDOMMK2M.js → CETIZ4IQ.js} +1 -1
  95. package/dist/cdn/{W3OJTTVX.js → COANVCKH.js} +2 -2
  96. package/dist/cdn/D7CRICBG.js +2 -0
  97. package/dist/cdn/D7FEOAW3.js +2 -0
  98. package/dist/cdn/{37EJSNE3.js → DY6MO2CA.js} +2 -2
  99. package/dist/cdn/EKMCGN6R.js +2 -0
  100. package/dist/cdn/EUIURCPS.js +2 -0
  101. package/dist/cdn/{NN6MELJ7.js → FGQH46Z2.js} +2 -2
  102. package/dist/cdn/FIZMK7GS.js +1 -0
  103. package/dist/cdn/FONIQ7VF.js +2 -0
  104. package/dist/cdn/G3KILEGJ.js +2 -0
  105. package/dist/cdn/{FYZATVB3.js → G7MCIFV2.js} +2 -2
  106. package/dist/cdn/{SDWWUWAF.js → GGAXXX5X.js} +2 -2
  107. package/dist/cdn/GS5JDPZH.js +2 -0
  108. package/dist/cdn/{KJZVYKWL.js → H4QWVTEZ.js} +2 -2
  109. package/dist/cdn/{HWNPZ4CF.js → H6J65TWL.js} +2 -2
  110. package/dist/cdn/{UHEYPSOR.js → HCPI2RJE.js} +2 -2
  111. package/dist/cdn/{TPMZRJEC.js → HJOWCZPL.js} +2 -2
  112. package/dist/cdn/HOMSK66Q.js +2 -0
  113. package/dist/cdn/{SBIYXWXZ.js → HTNKDDEV.js} +2 -2
  114. package/dist/cdn/{OFM2S6U7.js → HU527DML.js} +2 -2
  115. package/dist/cdn/I37ZJHTM.js +2 -0
  116. package/dist/cdn/{7DRHB24Z.js → I724KIFI.js} +2 -2
  117. package/dist/cdn/IH5P2PWJ.js +2 -0
  118. package/dist/cdn/{ZBRZU4XB.js → J3T5HB77.js} +2 -2
  119. package/dist/cdn/{ZMMUAYDN.js → JCWFLYB4.js} +2 -2
  120. package/dist/cdn/{IHP25JWI.js → JSRNLNOE.js} +2 -2
  121. package/dist/cdn/{MPWEXYYB.js → KDA5VPLO.js} +2 -2
  122. package/dist/cdn/KRPPMEOF.js +2 -0
  123. package/dist/cdn/{W6TS2TIE.js → KURNYULZ.js} +2 -2
  124. package/dist/cdn/{YOQCQAKT.js → L46O52F7.js} +2 -2
  125. package/dist/cdn/{W3ZLMBEE.js → L5OYOLWV.js} +3 -3
  126. package/dist/cdn/{M7TMD2HP.js → LDDP7NSY.js} +2 -2
  127. package/dist/cdn/{ZQTCPJUV.js → LGIXZLOP.js} +2 -2
  128. package/dist/cdn/{ENVTUTY6.js → LMAIOLS2.js} +2 -2
  129. package/dist/cdn/{CFAC4FN3.js → LWEKPFV6.js} +2 -2
  130. package/dist/cdn/M52LKZN7.js +2 -0
  131. package/dist/cdn/{6GQCLDLJ.js → M5UMOOL2.js} +2 -2
  132. package/dist/cdn/MHXM37QI.js +2 -0
  133. package/dist/cdn/{XI4BPYGB.js → MR3R5YHQ.js} +2 -2
  134. package/dist/cdn/{H7WJUUJT.js → MUSLUFKI.js} +2 -2
  135. package/dist/cdn/MYLY2ABI.js +2 -0
  136. package/dist/cdn/{2XXM52PS.js → N2GN5WOI.js} +3 -3
  137. package/dist/cdn/{2FUTKTNO.js → NAVK5JJ2.js} +3 -3
  138. package/dist/cdn/NDSYDURO.js +2 -0
  139. package/dist/cdn/{EU6YSCZL.js → NK2QRPS6.js} +2 -2
  140. package/dist/cdn/{GMZUN5SF.js → NYFL2F5L.js} +2 -2
  141. package/dist/cdn/{O62IJLTZ.js → OKDXM5D4.js} +2 -2
  142. package/dist/cdn/{I5OBL24F.js → OMUWBY75.js} +2 -2
  143. package/dist/cdn/{34O57OGV.js → OPQCY33W.js} +1 -1
  144. package/dist/cdn/{R74ZHFA6.js → OUMTV5H5.js} +1 -1
  145. package/dist/cdn/OZDRETY2.js +5 -0
  146. package/dist/cdn/{DYSPEU7W.js → PR4VMSKD.js} +1 -1
  147. package/dist/cdn/{V7ERVXIO.js → PXBS2FXE.js} +2 -2
  148. package/dist/cdn/{B4C7NIB5.js → Q7BJGEFH.js} +3 -3
  149. package/dist/cdn/QAVDW7A7.js +2 -0
  150. package/dist/cdn/{ONQ6JSBJ.js → QBZP6XOE.js} +1 -1
  151. package/dist/cdn/{OT5ECP4V.js → RFIN7KO6.js} +2 -2
  152. package/dist/cdn/RNJ7T5GF.js +2 -0
  153. package/dist/cdn/{Q6PCXSZT.js → S6OUM5X2.js} +2 -2
  154. package/dist/cdn/SG6PAUVR.js +2 -0
  155. package/dist/cdn/{U53SVXZK.js → SRXUC4QB.js} +2 -2
  156. package/dist/cdn/SUMXIUIS.js +2 -0
  157. package/dist/cdn/SW3D6QD4.js +2 -0
  158. package/dist/cdn/{GEFFWUB2.js → T2OYUOSO.js} +1 -1
  159. package/dist/cdn/T7LYQ56H.js +2 -0
  160. package/dist/cdn/{T2FKFOHE.js → TFXK2POV.js} +2 -2
  161. package/dist/cdn/{XQ3NBBQ3.js → TIQUULA4.js} +1 -1
  162. package/dist/cdn/{LCI5MEDN.js → TOUYGIGK.js} +2 -2
  163. package/dist/cdn/{DWMZ23QK.js → UJMM5QA4.js} +2 -2
  164. package/dist/cdn/UMTRLI63.js +2 -0
  165. package/dist/cdn/{MQSOVP27.js → UP7RW5K2.js} +2 -2
  166. package/dist/cdn/{J37GSI7C.js → UR2S7L6Z.js} +2 -2
  167. package/dist/cdn/{CEKOEHB3.js → UWHRBGWN.js} +2 -2
  168. package/dist/cdn/UXDRYDOD.js +11 -0
  169. package/dist/cdn/UZ7XFHYI.js +2 -0
  170. package/dist/cdn/V66TS2BB.js +2 -0
  171. package/dist/cdn/{AAUVOBPS.js → VINKTQFR.js} +1 -1
  172. package/dist/cdn/{U3ZTF2BC.js → VU7IOGNS.js} +2 -2
  173. package/dist/cdn/W2SIOY2B.js +3 -0
  174. package/dist/cdn/{WVMQ3I6F.js → W36IUEUB.js} +2 -2
  175. package/dist/cdn/{V6AQFRUC.js → WEBAQIUT.js} +2 -2
  176. package/dist/cdn/{WSIZ2OTL.js → WHIWOYHN.js} +1 -1
  177. package/dist/cdn/WOL5YMJ2.js +2 -0
  178. package/dist/cdn/{RBRHDEOB.js → X3YFCWQZ.js} +2 -2
  179. package/dist/cdn/{ICBIUFK7.js → X4EQEKM7.js} +2 -2
  180. package/dist/cdn/{UPSFL6U3.js → XBWGOD6I.js} +2 -2
  181. package/dist/cdn/XGDXTTYW.js +2 -0
  182. package/dist/cdn/{FFWPUYGD.js → XLHYQNAM.js} +2 -2
  183. package/dist/cdn/{NEV6OZN3.js → XMQJWPXI.js} +2 -2
  184. package/dist/cdn/{FXRZCD5Y.js → XQUKC4YK.js} +2 -2
  185. package/dist/cdn/{JEBRN3EU.js → XSH4B7FP.js} +2 -2
  186. package/dist/cdn/{LK7ZIQW6.js → XVWSIDZV.js} +2 -2
  187. package/dist/cdn/{J6A4AS7E.js → XYMIFFBW.js} +2 -2
  188. package/dist/cdn/{645SDZBB.js → Y3ZKMD47.js} +2 -2
  189. package/dist/cdn/{2GSHUAQ2.js → YAANCUW2.js} +2 -2
  190. package/dist/cdn/{XJUYG2M3.js → YD5LVM7V.js} +2 -2
  191. package/dist/cdn/{TTPTZBCM.js → YGI277SH.js} +2 -2
  192. package/dist/cdn/YGSDJ4V3.js +14 -0
  193. package/dist/cdn/YJEARDAZ.js +2 -0
  194. package/dist/cdn/{DXCDVRGL.js → YSEHJQ4L.js} +2 -2
  195. package/dist/cdn/Z44NI2YQ.js +2 -0
  196. package/dist/cdn/{74CVYM72.js → ZEDDYT24.js} +2 -2
  197. package/dist/cdn/{ZBBI5M2X.js → ZROI63CW.js} +2 -2
  198. package/dist/cdn/{ZKDCEL6K.js → ZUKM4DGB.js} +2 -2
  199. package/dist/cdn/ZVVNATCX.js +2 -0
  200. package/dist/cdn/agent-utils/BaseAgent.js +2 -2
  201. package/dist/cdn/agent-utils/FunctionAgent.js +2 -2
  202. package/dist/cdn/agent-utils/LLMAgent.js +2 -2
  203. package/dist/cdn/agent-utils/SkillAgent.js +2 -2
  204. package/dist/cdn/agent-utils/WorkflowAgent.js +2 -2
  205. package/dist/cdn/agent-utils/createSchema.js +2 -2
  206. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +2 -2
  207. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -2
  208. package/dist/cdn/agent-utils/middlewares/trace.js +2 -2
  209. package/dist/cdn/agent-utils/tools/FunctionTool.js +2 -2
  210. package/dist/cdn/agent-utils/tools/MCPToolProvider.js +15 -0
  211. package/dist/cdn/agent-utils/tools/WebMCPToolProvider.js +2 -0
  212. package/dist/cdn/agent-utils/workflows/ConditionalWorkflow.js +2 -2
  213. package/dist/cdn/agent-utils/workflows/LoopWorkflow.js +2 -2
  214. package/dist/cdn/agent-utils/workflows/ParallelWorkflow.js +2 -2
  215. package/dist/cdn/agent-utils/workflows/RouterWorkflow.js +2 -2
  216. package/dist/cdn/agent-utils/workflows/SequentialWorkflow.js +2 -2
  217. package/dist/cdn/agent-utils/workflows/SwitchWorkflow.js +2 -2
  218. package/dist/cdn/index.js +2 -2
  219. package/dist/cdn/orchestrator/embeddings/getEmbeddings.js +2 -2
  220. package/dist/cdn/orchestrator/models/chatModel.js +2 -2
  221. package/dist/cdn/orchestrator/models/prompts.js +2 -2
  222. package/dist/cdn/orchestrator/signals.js +2 -2
  223. package/dist/cdn/orchestrator/state/runtime.js +2 -2
  224. package/dist/chunks/BaseWorkflow.js +1 -1
  225. package/dist/chunks/SKILL.js +1 -1
  226. package/dist/chunks/SKILL2.js +1 -1
  227. package/dist/chunks/SKILL3.js +1 -1
  228. package/dist/chunks/SKILL4.js +1 -1
  229. package/dist/chunks/adapter.js +1 -1
  230. package/dist/chunks/adapter2.js +1 -1
  231. package/dist/chunks/aiFactory.js +1 -1
  232. package/dist/chunks/aiUtilityService.js +1 -1
  233. package/dist/chunks/arcgisToolRegistry.js +1 -1
  234. package/dist/chunks/arcgis_knowledge_current_lc_context.js +1 -1
  235. package/dist/chunks/arcgis_knowledge_current_map_context.js +1 -1
  236. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +1 -1
  237. package/dist/chunks/arcgis_knowledge_lucene_generation_prompt.js +1 -1
  238. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +1 -1
  239. package/dist/chunks/arcgis_knowledge_tool_prompt.js +1 -1
  240. package/dist/chunks/converterUtils.js +66 -110
  241. package/dist/chunks/createSkillAgent.js +1 -1
  242. package/dist/chunks/data_explore_filter_prompt.js +1 -1
  243. package/dist/chunks/data_explore_query_prompt.js +1 -1
  244. package/dist/chunks/embeddings.worker.js +1 -1
  245. package/dist/chunks/fetchAgentContext.js +1 -1
  246. package/dist/chunks/fetchService.js +1 -1
  247. package/dist/chunks/fetchUtils.js +1 -1
  248. package/dist/chunks/fieldStatistics.js +1 -1
  249. package/dist/chunks/field_descriptions_prompt.js +1 -1
  250. package/dist/chunks/formatFeatureAttributes.js +1 -1
  251. package/dist/chunks/getPrompt.js +1 -1
  252. package/dist/chunks/graph.js +1 -1
  253. package/dist/chunks/helpState.js +1 -1
  254. package/dist/chunks/help_prompt.js +1 -1
  255. package/dist/chunks/intent_prompt.js +1 -1
  256. package/dist/chunks/layerQueryToolCalling.js +1 -1
  257. package/dist/chunks/layerStylingState.js +1 -1
  258. package/dist/chunks/layer_descriptions_prompt.js +1 -1
  259. package/dist/chunks/layer_styling_prompt.js +1 -1
  260. package/dist/chunks/localization.js +1 -1
  261. package/dist/chunks/mergeWhereClauses.js +1 -1
  262. package/dist/chunks/modelConfig.js +1 -1
  263. package/dist/chunks/modelPricing.js +1 -1
  264. package/dist/chunks/navigationState.js +1 -1
  265. package/dist/chunks/navigation_intent_prompt.js +1 -1
  266. package/dist/chunks/navigation_tool_prompt.js +1 -1
  267. package/dist/chunks/observationSnapshot.js +1 -1
  268. package/dist/chunks/reducers.js +1 -1
  269. package/dist/chunks/requireAgentServices.js +1 -1
  270. package/dist/chunks/resolveFieldNames.js +9 -0
  271. package/dist/chunks/resolveGeometryFilter.js +1 -1
  272. package/dist/chunks/runtime.js +2 -2
  273. package/dist/chunks/runtime2.js +1 -1
  274. package/dist/chunks/runtimeSpans.js +1 -1
  275. package/dist/chunks/schema.js +1 -1
  276. package/dist/chunks/slottableRequestUtils.js +1 -1
  277. package/dist/chunks/state.js +1 -1
  278. package/dist/chunks/summarize_query_response_prompt.js +1 -1
  279. package/dist/chunks/textFormatters.js +1 -1
  280. package/dist/chunks/toolCallResponse.js +1 -1
  281. package/dist/chunks/useT9n.js +1 -1
  282. package/dist/chunks/utils.js +1 -1
  283. package/dist/chunks/utils2.js +1 -1
  284. package/dist/chunks/utils3.js +1 -1
  285. package/dist/chunks/webmapSchema.js +1 -1
  286. package/dist/components/arcgis-assistant/customElement.js +1 -1
  287. package/dist/components/arcgis-assistant-agent/customElement.js +1 -1
  288. package/dist/components/arcgis-assistant-chat/customElement.js +1 -1
  289. package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -1
  290. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
  291. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -1
  292. package/dist/components/arcgis-assistant-interrupt/customElement.js +1 -1
  293. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +1 -1
  294. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -1
  295. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
  296. package/dist/components/arcgis-assistant-message/customElement.js +1 -1
  297. package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
  298. package/dist/components/arcgis-assistant-message-feedback/customElement.js +1 -1
  299. package/dist/components/arcgis-assistant-message-footer/customElement.js +1 -1
  300. package/dist/components/arcgis-assistant-message-loading/customElement.js +1 -1
  301. package/dist/components/arcgis-assistant-message-log/customElement.js +5 -6
  302. package/dist/components/arcgis-assistant-message-log/index.js +5 -0
  303. package/dist/components/arcgis-assistant-message-read-aloud/customElement.js +1 -1
  304. package/dist/components/arcgis-assistant-message-text/customElement.js +11 -12
  305. package/dist/components/arcgis-assistant-message-text/index.js +5 -0
  306. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
  307. package/dist/components/arcgis-assistant-observation-inspector/customElement.js +1 -1
  308. package/dist/components/arcgis-assistant-observation-latency/customElement.js +1 -1
  309. package/dist/components/arcgis-assistant-observation-panel/customElement.js +1 -1
  310. package/dist/components/arcgis-assistant-observation-run/customElement.js +1 -1
  311. package/dist/components/arcgis-assistant-observation-usage/customElement.js +1 -1
  312. package/dist/components/arcgis-assistant-speech-input/customElement.js +1 -1
  313. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +1 -1
  314. package/dist/components/arcgis-assistant-user-message/customElement.js +8 -9
  315. package/dist/components/arcgis-assistant-user-message/index.js +5 -0
  316. package/dist/docs/api.json +1 -1
  317. package/dist/docs/docs.json +1 -1
  318. package/dist/docs/web-types.json +1 -1
  319. package/dist/index.js +1 -1
  320. package/dist/loader.js +1 -1
  321. package/dist/orchestrator/embeddings/cosineSimilarity.js +1 -1
  322. package/dist/orchestrator/embeddings/getEmbeddings.js +1 -1
  323. package/dist/orchestrator/embeddings/webmapEmbeddings.js +1 -1
  324. package/dist/orchestrator/models/chatModel.js +1 -1
  325. package/dist/orchestrator/models/prompts.js +1 -1
  326. package/dist/orchestrator/orchestrator/orchestrator.js +1 -1
  327. package/dist/orchestrator/orchestrator/orchestratorEvents.js +1 -1
  328. package/dist/orchestrator/signals.js +1 -1
  329. package/dist/orchestrator/state/runtime.js +1 -1
  330. package/dist/orchestrator/state/types.js +1 -1
  331. package/dist/orchestrator/types.js +1 -1
  332. package/dist/utils/index.js +1 -1
  333. package/package.json +8 -5
  334. package/dist/cdn/25CQLMB4.js +0 -2
  335. package/dist/cdn/34HKOU3T.js +0 -2
  336. package/dist/cdn/3WS4DSWD.js +0 -2
  337. package/dist/cdn/434TAA3J.js +0 -2
  338. package/dist/cdn/43OJZMBB.js +0 -2
  339. package/dist/cdn/4BRIOLDJ.js +0 -2
  340. package/dist/cdn/4KFTUBFL.js +0 -2
  341. package/dist/cdn/4ZPGFIE2.js +0 -2
  342. package/dist/cdn/6JCDY4FL.js +0 -2
  343. package/dist/cdn/7GQCNR4P.js +0 -11
  344. package/dist/cdn/A3KIOUWB.js +0 -2
  345. package/dist/cdn/BKKLQUK2.js +0 -2
  346. package/dist/cdn/CADNOKIK.js +0 -2
  347. package/dist/cdn/DQRKGYR3.js +0 -2
  348. package/dist/cdn/EOSKJPQV.js +0 -2
  349. package/dist/cdn/F7VQ3WH2.js +0 -2
  350. package/dist/cdn/FBIPIDP7.js +0 -2
  351. package/dist/cdn/GOET2CH4.js +0 -2
  352. package/dist/cdn/ISDNOFHU.js +0 -3
  353. package/dist/cdn/JZS6ZSWH.js +0 -2
  354. package/dist/cdn/KEBMHD4R.js +0 -9
  355. package/dist/cdn/KPHHXMRK.js +0 -2
  356. package/dist/cdn/LVSIZRTB.js +0 -2
  357. package/dist/cdn/OJP56R5R.js +0 -2
  358. package/dist/cdn/OYHYHALE.js +0 -2
  359. package/dist/cdn/QQPVN5MG.js +0 -2
  360. package/dist/cdn/QUZTFUWM.js +0 -1
  361. package/dist/cdn/REE4K4J7.js +0 -2
  362. package/dist/cdn/RFKOCMMT.js +0 -2
  363. package/dist/cdn/RKHDRUX5.js +0 -2
  364. package/dist/cdn/TGI7QCB2.js +0 -2
  365. package/dist/cdn/UALF45Q2.js +0 -2
  366. package/dist/cdn/WB5AFS42.js +0 -2
  367. package/dist/cdn/WC6SHIEX.js +0 -2
  368. package/dist/cdn/XPSPAZUD.js +0 -2
  369. package/dist/cdn/YAUQJ6NV.js +0 -2
  370. package/dist/cdn/YD3DLETZ.js +0 -2
  371. package/dist/cdn/YKKIJTJY.js +0 -2
  372. package/dist/cdn/ZCNCYKXW.js +0 -14
  373. package/dist/cdn/ZESTW6HJ.js +0 -2
  374. package/dist/cdn/ZS5P7NRI.js +0 -2
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { a } from "../chunks/state.js";
3
3
  const t = () => {
4
4
  throw new Error("createGraph method not implemented.");
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { isGraphInterrupt as o } from "@langchain/langgraph/web";
3
3
  import { BaseAgent as c } from "./BaseAgent.js";
4
4
  import { c as u } from "../chunks/graph.js";
@@ -2,10 +2,11 @@ import type { StructuredToolInterface } from "@langchain/core/tools";
2
2
  import type { BaseAgent } from "./BaseAgent.js";
3
3
  import type { AgentMiddleware } from "./middlewares/types.js";
4
4
  import type { FunctionToolLike } from "./tools/FunctionTool.js";
5
+ import type { ToolProvider } from "./tools/ToolProvider.js";
5
6
  import type { AgentCustomState, AgentData, ZodObjectSchema } from "./types.js";
6
7
  import type { ChatModelTier } from "../orchestrator/models/chatModel.js";
7
8
 
8
- export type LLMAgentTool = FunctionToolLike | StructuredToolInterface;
9
+ export type LLMAgentTool = FunctionToolLike | StructuredToolInterface | ToolProvider;
9
10
 
10
11
  /**
11
12
  * LLMAgent uses a language model to generate its output based on a provided prompt template and optional tools.
@@ -45,8 +46,14 @@ export class LLMAgent<TInput extends AgentData = AgentData, TOutput extends Agen
45
46
  * @required
46
47
  */
47
48
  prompt: string;
48
- /** The tools property is an optional array of tools that the agent can use during execution. */
49
+ /**
50
+ * The tools property is an optional array of tools and tool providers that the agent can use during execution.
51
+ * Passing a provider transfers ownership to this agent. Providers must not be shared between agents.
52
+ * Providers are destroyed when this agent is destroyed. Ordinary tools remain caller-owned.
53
+ * Keep tools fixed for the agent's lifetime. To replace them, destroy this agent and create a new one.
54
+ */
49
55
  tools?: LLMAgentTool[];
56
+ destroy(): void;
50
57
  /**
51
58
  * Rebuilds internal workspace and createGraph wiring. Concrete agent constructors call this after assigning their
52
59
  * configuration. Call it manually after changing graph-defining properties.
@@ -1,70 +1,77 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { ChatPromptTemplate as c } from "@langchain/core/prompts";
3
3
  import { ToolMessage as l } from "@langchain/core/messages";
4
4
  import { isGraphInterrupt as g } from "@langchain/langgraph/web";
5
- import { createAgent as m, providerStrategy as f } from "langchain";
5
+ import { createAgent as d, providerStrategy as f } from "langchain";
6
6
  import { BaseAgent as w } from "./BaseAgent.js";
7
- import { convertToLangChainMiddlewares as d } from "./middlewares/middleware.js";
8
- import { c as T } from "../chunks/graph.js";
9
- import { c as A } from "../chunks/state.js";
10
- import { c as u, h as y } from "../chunks/utils.js";
7
+ import { convertToLangChainMiddlewares as m } from "./middlewares/middleware.js";
8
+ import { c as y } from "../chunks/graph.js";
9
+ import { c as T } from "../chunks/state.js";
10
+ import { c as u, h as A } from "../chunks/utils.js";
11
11
  class L extends w {
12
12
  //#region Lifecycle
13
13
  constructor(t) {
14
- super(), this.middlewares = [], this.modelTier = "default", Object.assign(this, t), this.generate();
14
+ super(), this.middlewares = [], this.modelTier = "default", this._destroyed = !1, Object.assign(this, t), this.generate();
15
+ }
16
+ destroy() {
17
+ if (!this._destroyed) {
18
+ this._destroyed = !0;
19
+ for (const t of new Set(this.tools))
20
+ "getTools" in t && t.destroy();
21
+ }
15
22
  }
16
23
  //#endregion
17
24
  //#region Public Methods
18
25
  generate() {
19
- const t = this.prompt ? c.fromTemplate(this.prompt).inputVariables : [], s = A(
26
+ const t = this.prompt ? c.fromTemplate(this.prompt).inputVariables : [], e = T(
20
27
  [this.inputSchema, this.outputSchema].filter(Boolean),
21
28
  t
22
- ), e = this.id, o = { [e]: this._invoke.bind(this) }, r = [{ from: e, decide: () => {
29
+ ), s = this.id, o = { [s]: this._invoke.bind(this) }, r = [{ from: s, decide: () => {
23
30
  } }];
24
- this.workspace = s, this.createGraph = () => T(o, r, s, {
31
+ this.workspace = e, this.createGraph = () => y(o, r, e, {
25
32
  agent: this,
26
- entryNode: e,
33
+ entryNode: s,
27
34
  middlewares: this.middlewares
28
35
  });
29
36
  }
30
37
  //#endregion
31
38
  //#region Private Methods
32
- async _invoke(t, s) {
39
+ async _invoke(t, e) {
33
40
  try {
34
- return this.outputSchema ? await this._invokeStructured(t, s) : await this._invokeUnstructured(t, s);
35
- } catch (e) {
36
- if (g(e) || s?.signal?.aborted || e instanceof Error && e.name === "AbortError")
37
- throw e;
38
- const o = e instanceof Error ? e.message : String(e);
41
+ return this.outputSchema ? await this._invokeStructured(t, e) : await this._invokeUnstructured(t, e);
42
+ } catch (s) {
43
+ if (g(s) || e?.signal?.aborted || s instanceof Error && s.name === "AbortError")
44
+ throw s;
45
+ const o = s instanceof Error ? s.message : String(s);
39
46
  return u({ outputMessage: o }, "failed", o);
40
47
  }
41
48
  }
42
- async _invokeStructured(t, s) {
49
+ async _invokeStructured(t, e) {
43
50
  if (!this.outputSchema)
44
51
  throw new Error("Output schema is required for structured invocation.");
45
- const { createChatModel: e } = await import("../orchestrator/models/chatModel.js"), r = await m({
46
- model: await e({ modelTier: this.modelTier }),
52
+ const { createChatModel: s } = await import("../orchestrator/models/chatModel.js"), r = await d({
53
+ model: await s({ modelTier: this.modelTier }),
47
54
  systemPrompt: await this._getPromptWithInputVariables(t),
48
- tools: this._getTools(),
55
+ tools: await this._getTools(),
49
56
  checkpointer: !0,
50
- middleware: d(this.middlewares),
57
+ middleware: m(this.middlewares),
51
58
  responseFormat: f(this.outputSchema)
52
- }).invoke({ messages: t.agentExecutionContext.messages }, s);
59
+ }).invoke({ messages: t.agentExecutionContext.messages }, e);
53
60
  if (!("structuredResponse" in r) || r.structuredResponse === void 0)
54
61
  throw new Error("LLMAgent did not receive structured output from createAgent.");
55
62
  return {
56
- ...y(r.structuredResponse, this.outputSchema, r.messages),
63
+ ...A(r.structuredResponse, this.outputSchema, r.messages),
57
64
  sharedResourceAdditions: p(r.messages)
58
65
  };
59
66
  }
60
- async _invokeUnstructured(t, s) {
61
- const { createChatModel: e } = await import("../orchestrator/models/chatModel.js"), a = (await m({
62
- model: await e({ modelTier: this.modelTier }),
67
+ async _invokeUnstructured(t, e) {
68
+ const { createChatModel: s } = await import("../orchestrator/models/chatModel.js"), a = (await d({
69
+ model: await s({ modelTier: this.modelTier }),
63
70
  systemPrompt: await this._getPromptWithInputVariables(t),
64
- tools: this._getTools(),
71
+ tools: await this._getTools(),
65
72
  checkpointer: !0,
66
- middleware: d(this.middlewares)
67
- }).invoke({ messages: t.agentExecutionContext.messages }, s)).messages, n = a.at(-1)?.text ?? "", h = n.trim() || "LLMAgent completed.";
73
+ middleware: m(this.middlewares)
74
+ }).invoke({ messages: t.agentExecutionContext.messages }, e)).messages, n = a.at(-1)?.text ?? "", h = n.trim() || "LLMAgent completed.";
68
75
  return u(
69
76
  {
70
77
  agentExecutionContext: { ...t.agentExecutionContext, messages: a },
@@ -78,18 +85,20 @@ class L extends w {
78
85
  async _getPromptWithInputVariables(t) {
79
86
  return await c.fromTemplate(this.prompt).format(t);
80
87
  }
81
- _getTools() {
82
- return this.tools?.map((t) => "getTool" in t ? t.getTool() : t) ?? [];
88
+ async _getTools() {
89
+ return (await Promise.all(
90
+ (this.tools ?? []).map(async (e) => "getTools" in e ? await e.getTools() : ["getTool" in e ? e.getTool() : e])
91
+ )).flat();
83
92
  }
84
93
  //#endregion
85
94
  }
86
95
  function p(i) {
87
96
  const t = [];
88
- for (const s of i)
89
- if (l.isInstance(s) && s.status !== "error") {
90
- const e = s.artifact;
91
- if (typeof e == "object" && e !== null && "sharedResourceAdditions" in e) {
92
- const o = e.sharedResourceAdditions;
97
+ for (const e of i)
98
+ if (l.isInstance(e) && e.status !== "error") {
99
+ const s = e.artifact;
100
+ if (typeof s == "object" && s !== null && "sharedResourceAdditions" in s) {
101
+ const o = s.sharedResourceAdditions;
93
102
  if (Array.isArray(o))
94
103
  for (const r of o)
95
104
  t.push({
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { BaseAgent as r } from "./BaseAgent.js";
3
3
  import { c as a } from "../chunks/createSkillAgent.js";
4
4
  class d extends r {
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { BaseAgent as h } from "./BaseAgent.js";
3
3
  import { c as n } from "../chunks/graph.js";
4
4
  class l extends h {
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  async function c(e) {
3
3
  const { createZodObjectSchema: t } = await import("../chunks/schema.js");
4
4
  return t(e);
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { NodeInterrupt as s } from "@langchain/langgraph/web";
3
3
  import { createAgentMiddleware as f, createToolMiddleware as I } from "./middleware.js";
4
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";
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { createMiddleware as p } from "langchain";
3
3
  function g(e, t, r) {
4
4
  return {
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { sendTraceMessage as n } from "../../orchestrator/signals.js";
3
3
  import { AIMessage as i, ToolMessage as c } from "@langchain/core/messages";
4
4
  import { createAgentMiddleware as s, createToolMiddleware as d } from "./middleware.js";
@@ -1,2 +1,2 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
 
@@ -100,8 +100,19 @@ export class FunctionTool<TInput extends AgentData, TOutput = unknown> {
100
100
  * The output schema defines the expected structure of the result returned by the tool.
101
101
  * This should be a Zod schema object.
102
102
  * The agent will validate the output against this schema after execution.
103
+ * With `content-and-artifact`, the schema validates the entire tuple, including the artifact.
103
104
  */
104
105
  outputSchema?: z.ZodType<TOutput>;
106
+ /**
107
+ * The format of the tool's response. With `content`, the result is interpreted as message content.
108
+ * With `content-and-artifact`, execute must return a two-item tuple containing message content
109
+ * and an artifact. Only the content is sent to the model; the artifact is available to the application.
110
+ * String results from middleware are treated as content with no artifact.
111
+ *
112
+ * @default "content"
113
+ * @since 5.2
114
+ */
115
+ responseFormat: "content-and-artifact" | "content";
105
116
  /**
106
117
  * The result mode determines how the agent should treat the output of this tool.
107
118
  * If set to `terminal`, the agent will
@@ -122,5 +133,5 @@ export interface FunctionToolMiddlewareTool {
122
133
  resultMode: ToolResultMode;
123
134
  }
124
135
 
125
- export type FunctionToolConstructProperties<TInput extends AgentData, TOutput> = Partial<Pick<FunctionTool<TInput, TOutput>, "inputSchema" | "middlewares" | "outputSchema" | "resultMode">>
136
+ export type FunctionToolConstructProperties<TInput extends AgentData, TOutput> = Partial<Pick<FunctionTool<TInput, TOutput>, "inputSchema" | "middlewares" | "outputSchema" | "responseFormat" | "resultMode">>
126
137
  & Pick<FunctionTool<TInput, TOutput>, "description" | "execute" | "name">;
@@ -1,9 +1,9 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { tool as n } from "@langchain/core/tools";
3
- class d {
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import { tool as c } from "@langchain/core/tools";
3
+ class h {
4
4
  //#region Lifecycle
5
5
  constructor(t) {
6
- this.resultMode = "continue", this.middlewares = [], Object.assign(this, t);
6
+ this.resultMode = "continue", this.responseFormat = "content", this.middlewares = [], Object.assign(this, t);
7
7
  }
8
8
  //#endregion
9
9
  //#region Public Methods
@@ -11,24 +11,25 @@ class d {
11
11
  * Builds the LangChain tool adapter used by LLM agents.
12
12
  */
13
13
  getTool() {
14
- return n(this._executeWithMiddlewares.bind(this), {
14
+ return c(this._executeWithMiddlewares.bind(this), {
15
15
  name: this.name,
16
16
  description: this.description,
17
17
  returnDirect: this.resultMode === "terminal",
18
- schema: this.inputSchema
18
+ schema: this.inputSchema,
19
+ responseFormat: this.responseFormat === "content-and-artifact" ? "content_and_artifact" : "content"
19
20
  });
20
21
  }
21
22
  //#endregion
22
23
  //#region Private Methods
23
24
  async _executeWithMiddlewares(t, e) {
24
- const a = async (i) => {
25
- const s = await this.execute(i.input, i.config);
26
- return this._validateOutput(s);
27
- };
28
- return await this.middlewares.reduceRight(
29
- (i, s) => async (r) => await s.handler(r, i),
25
+ const a = async (o) => {
26
+ const i = await this.execute(o.input, o.config);
27
+ return this._validateOutput(i);
28
+ }, s = await this.middlewares.reduceRight(
29
+ (o, i) => async (r) => await i.handler(r, o),
30
30
  a
31
31
  )({ config: e, input: t, tool: this, toolCallId: l(e) });
32
+ return this.responseFormat === "content-and-artifact" && typeof s == "string" ? [s, void 0] : s;
32
33
  }
33
34
  _validateOutput(t) {
34
35
  if (!this.outputSchema)
@@ -40,10 +41,10 @@ class d {
40
41
  }
41
42
  //#endregion
42
43
  }
43
- function l(o) {
44
- const t = o?.toolCall;
44
+ function l(n) {
45
+ const t = n?.toolCall;
45
46
  return typeof t?.id == "string" ? t.id : void 0;
46
47
  }
47
48
  export {
48
- d as FunctionTool
49
+ h as FunctionTool
49
50
  };
@@ -0,0 +1,54 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+ import type { ToolResultMode } from "./FunctionTool.js";
3
+
4
+ /** @internal */
5
+ export type MCPToolProviderConstructProperties = Partial<Pick<MCPToolProvider, "allowedTools" | "headers" | "resultModes">>
6
+ & Pick<MCPToolProvider, "serverUrl">;
7
+
8
+ /**
9
+ * Discovers tools hosted by a remote Streamable HTTP MCP server and adapts them for use by LLM agents.
10
+ *
11
+ * @internal
12
+ */
13
+ export class MCPToolProvider {
14
+ constructor(properties?: MCPToolProviderConstructProperties);
15
+ /**
16
+ * Names of the advertised tools to expose. All advertised tools are exposed when this property is undefined.
17
+ *
18
+ * @internal
19
+ */
20
+ allowedTools?: string[];
21
+ /**
22
+ * Request headers sent to the MCP server, for example an authorization header.
23
+ *
24
+ * @internal
25
+ */
26
+ headers?: Record<string, string>;
27
+ /**
28
+ * Result modes keyed by tool name. Tools without an entry default to "continue".
29
+ * "continue" lets the agent process the result; "terminal" ends the run with the tool result.
30
+ *
31
+ * @internal
32
+ */
33
+ resultModes?: Partial<Record<string, ToolResultMode>>;
34
+ /**
35
+ * Streamable HTTP endpoint for the MCP server.
36
+ *
37
+ * @required
38
+ * @internal
39
+ */
40
+ serverUrl: string;
41
+ /**
42
+ * Closes the MCP connection when the provider is no longer needed.
43
+ *
44
+ * @internal
45
+ */
46
+ close(): Promise<void>;
47
+ destroy(): void;
48
+ /**
49
+ * Discovers the tools advertised by the MCP server and builds their LangChain adapters.
50
+ *
51
+ * @internal
52
+ */
53
+ getTools(): Promise<StructuredToolInterface[]>;
54
+ }
@@ -0,0 +1,120 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import { DynamicStructuredTool as a } from "@langchain/core/tools";
3
+ import { Client as c, StreamableHTTPClientTransport as l } from "@modelcontextprotocol/client";
4
+ class u {
5
+ //#region Lifecycle
6
+ constructor(t) {
7
+ Object.assign(this, t);
8
+ }
9
+ destroy() {
10
+ this.close();
11
+ }
12
+ //#endregion
13
+ //#region Public Methods
14
+ /**
15
+ * Discovers the tools advertised by the MCP server and builds their LangChain adapters.
16
+ *
17
+ * @internal
18
+ */
19
+ async getTools() {
20
+ const t = await this._getClient();
21
+ try {
22
+ const e = await this._getToolDefinitions(t), o = this.allowedTools;
23
+ if (o) {
24
+ const n = new Set(e.map(({ name: i }) => i)), r = o.filter((i) => !n.has(i));
25
+ if (r.length > 0)
26
+ throw new Error(`MCP server did not advertise the following allowed tools: ${r.join(", ")}`);
27
+ }
28
+ const s = o ? new Set(o) : void 0;
29
+ return e.filter(({ name: n }) => !s || s.has(n)).map((n) => this._createTool(n));
30
+ } finally {
31
+ await this._closeConnection();
32
+ }
33
+ }
34
+ /**
35
+ * Closes the MCP connection when the provider is no longer needed.
36
+ *
37
+ * @internal
38
+ */
39
+ async close() {
40
+ this._toolDefinitions = void 0, await this._closeConnection();
41
+ }
42
+ //#endregion
43
+ //#region Private Methods
44
+ _createTool(t) {
45
+ return new a({
46
+ description: t.description ?? t.title ?? t.name,
47
+ func: async (e, o, s) => await this._invoke(t.name, e, s),
48
+ name: t.name,
49
+ returnDirect: this.resultModes?.[t.name] === "terminal",
50
+ schema: t.inputSchema
51
+ });
52
+ }
53
+ async _invoke(t, e, o) {
54
+ const s = await this._getClient();
55
+ try {
56
+ const n = await s.callTool(
57
+ { arguments: e, name: t },
58
+ o?.signal ? { requestSignal: o.signal } : void 0
59
+ );
60
+ if ("toolResult" in n)
61
+ return JSON.stringify(n.toolResult);
62
+ const r = n.content.map((i) => i.type === "text" ? i.text : JSON.stringify(i)).join(`
63
+ `);
64
+ if (n.isError)
65
+ throw new Error(r);
66
+ return r;
67
+ } finally {
68
+ await this._closeConnection();
69
+ }
70
+ }
71
+ async _listTools(t) {
72
+ const e = [];
73
+ let o;
74
+ do {
75
+ const s = await t.listTools(o ? { cursor: o } : void 0);
76
+ e.push(...s.tools), o = s.nextCursor;
77
+ } while (o);
78
+ return e;
79
+ }
80
+ async _getToolDefinitions(t) {
81
+ return this._toolDefinitions ??= this._listTools(t).catch((e) => {
82
+ throw this._toolDefinitions = void 0, e;
83
+ }), await this._toolDefinitions;
84
+ }
85
+ async _getClient() {
86
+ if (this._client)
87
+ return this._client;
88
+ this._connection ??= this._connect();
89
+ try {
90
+ return await this._connection;
91
+ } catch (t) {
92
+ throw this._connection = void 0, t;
93
+ }
94
+ }
95
+ async _closeConnection() {
96
+ const t = this._transport;
97
+ this._client = void 0, this._connection = void 0, this._transport = void 0, t && await t.close();
98
+ }
99
+ async _connect() {
100
+ const t = new c(
101
+ { name: "@arcgis/ai-components", version: "5.2" },
102
+ { versionNegotiation: { mode: "auto" } }
103
+ ), e = new l(new URL(this.serverUrl), {
104
+ requestInit: { headers: this.headers }
105
+ });
106
+ this._transport = e;
107
+ try {
108
+ return await t.connect(e), this._client = t, t;
109
+ } catch (o) {
110
+ throw this._transport = void 0, await e.close(), o instanceof TypeError ? new Error(
111
+ "Could not connect to the MCP server. Check the URL, network connection, and server's CORS settings. See the browser console for details.",
112
+ { cause: o }
113
+ ) : o;
114
+ }
115
+ }
116
+ //#endregion
117
+ }
118
+ export {
119
+ u as MCPToolProvider
120
+ };
@@ -0,0 +1,13 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Supplies tools owned by an LLM agent. Provider instances must not be shared between agents.
5
+ *
6
+ * @since 5.2
7
+ */
8
+ export interface ToolProvider {
9
+ /** Resolves the tools available for an agent invocation. */
10
+ getTools: () => Promise<StructuredToolInterface[]>;
11
+ /** Releases provider resources when the owning agent is destroyed. */
12
+ destroy: () => void;
13
+ }
@@ -0,0 +1,37 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+ import type { ToolResultMode } from "./FunctionTool.js";
3
+
4
+ /** @internal */
5
+ export type WebMCPToolProviderConstructProperties = Partial<Pick<WebMCPToolProvider, "allowedTools" | "resultModes">>;
6
+
7
+ /**
8
+ * Adapts tools exposed to the current document by the experimental WebMCP API for use by LLM agents.
9
+ * Requires the draft document.modelContext.getTools() and executeTool() APIs in a secure context.
10
+ * Discovery uses the browser's default same-origin scope; page-owned registrations are never removed.
11
+ *
12
+ * @see https://webmachinelearning.github.io/webmcp/#model-context-container
13
+ * @internal
14
+ */
15
+ export class WebMCPToolProvider {
16
+ constructor(properties?: WebMCPToolProviderConstructProperties);
17
+ /**
18
+ * Names of tools to expose. All discovered tools are exposed when undefined.
19
+ *
20
+ * @internal
21
+ */
22
+ allowedTools?: string[];
23
+ /**
24
+ * Result modes keyed by tool name. Tools without an entry default to "continue".
25
+ * "continue" lets the agent process the result; "terminal" ends the run with the tool result.
26
+ *
27
+ * @internal
28
+ */
29
+ resultModes?: Partial<Record<string, ToolResultMode>>;
30
+ destroy(): void;
31
+ /**
32
+ * Discovers currently available WebMCP tools and builds their LangChain adapters.
33
+ *
34
+ * @internal
35
+ */
36
+ getTools(): Promise<StructuredToolInterface[]>;
37
+ }
@@ -0,0 +1,71 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
+ import { DynamicStructuredTool as c } from "@langchain/core/tools";
3
+ function u(n) {
4
+ return n instanceof Error && /^Failed to parse (?:input|arguments)/u.test(n.message);
5
+ }
6
+ class p {
7
+ //#region Lifecycle
8
+ constructor(e) {
9
+ this._abortController = new AbortController(), Object.assign(this, e);
10
+ }
11
+ destroy() {
12
+ this._abortController.abort();
13
+ }
14
+ //#endregion
15
+ //#region Public Methods
16
+ /**
17
+ * Discovers currently available WebMCP tools and builds their LangChain adapters.
18
+ *
19
+ * @internal
20
+ */
21
+ async getTools() {
22
+ const e = this._abortController.signal;
23
+ e.throwIfAborted();
24
+ const t = typeof document > "u" ? void 0 : document.modelContext;
25
+ if (typeof t?.getTools != "function" || typeof t.executeTool != "function")
26
+ throw new Error("WebMCP tools are unavailable because WebMCP is unsupported or disabled on this page.");
27
+ const s = await t.getTools();
28
+ if (e.throwIfAborted(), this.allowedTools) {
29
+ const o = new Set(s.map(({ name: a }) => a)), r = this.allowedTools.filter((a) => !o.has(a));
30
+ if (r.length > 0)
31
+ throw new Error(`WebMCP did not expose the following allowed tools: ${r.join(", ")}`);
32
+ }
33
+ const l = this.allowedTools ? new Set(this.allowedTools) : void 0;
34
+ return s.filter(({ name: o }) => !l || l.has(o)).map((o) => this._createTool(o, t));
35
+ }
36
+ //#endregion
37
+ //#region Private Methods
38
+ _createTool(e, t) {
39
+ return new c({
40
+ name: e.name,
41
+ description: e.description,
42
+ func: async (s, l, i) => {
43
+ const o = i?.signal ? AbortSignal.any([this._abortController.signal, i.signal]) : this._abortController.signal;
44
+ o.throwIfAborted();
45
+ let r;
46
+ try {
47
+ r = await t.executeTool(e, JSON.stringify(s), { signal: o });
48
+ } catch (a) {
49
+ if (!u(a) || !s || typeof s != "object")
50
+ throw a;
51
+ r = await t.executeTool(e, s, { signal: o });
52
+ }
53
+ return typeof r == "string" ? r : JSON.stringify(r) ?? String(r);
54
+ },
55
+ returnDirect: this.resultModes?.[e.name] === "terminal",
56
+ schema: this._parseInputSchema(e)
57
+ });
58
+ }
59
+ _parseInputSchema(e) {
60
+ if (!e.inputSchema)
61
+ return { properties: {}, type: "object" };
62
+ let t = e.inputSchema;
63
+ if (typeof t == "string" && (t = JSON.parse(t)), typeof t != "object" || t === null || Array.isArray(t))
64
+ throw new TypeError(`WebMCP tool "${e.name}" has an invalid input schema.`);
65
+ return t;
66
+ }
67
+ //#endregion
68
+ }
69
+ export {
70
+ p as WebMCPToolProvider
71
+ };
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { B as l, g as r } from "../../chunks/BaseWorkflow.js";
3
3
  class g extends l {
4
4
  //#region Lifecycle
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { c as d } from "../../chunks/graph.js";
3
3
  import { B as l } from "../../chunks/BaseWorkflow.js";
4
4
  class m extends l {
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { c as M } from "../../chunks/graph.js";
3
3
  import { a as R } from "../../chunks/state.js";
4
4
  import { B as k, c as P, g as m, a as F } from "../../chunks/BaseWorkflow.js";
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { B as u, g as n } from "../../chunks/BaseWorkflow.js";
3
3
  class g extends u {
4
4
  //#region Lifecycle
@@ -1,4 +1,4 @@
1
- /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
2
2
  import { B as u, g as s, a as l } from "../../chunks/BaseWorkflow.js";
3
3
  class m extends u {
4
4
  //#region Lifecycle