@arcgis/ai-components 5.2.0-next.1 → 5.2.0-next.100

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 (325) hide show
  1. package/LICENSE.md +4 -2
  2. package/README.md +2 -2
  3. package/dist/agent-utils/FunctionAgent.d.ts +2 -2
  4. package/dist/agent-utils/LLMAgent.d.ts +7 -4
  5. package/dist/agent-utils/LLMAgent.js +26 -24
  6. package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
  7. package/dist/agent-utils/WorkflowAgent.js +14 -15
  8. package/dist/agent-utils/index.d.ts +177 -0
  9. package/dist/agent-utils/index.js +167 -0
  10. package/dist/agent-utils/middlewares/trace.d.ts +2 -0
  11. package/dist/agent-utils/middlewares/trace.js +25 -33
  12. package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
  13. package/dist/agent-utils/types.d.ts +37 -8
  14. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
  15. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
  16. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
  17. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
  18. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
  19. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
  20. package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
  21. package/dist/agentic-workflow/Edge.d.ts +16 -0
  22. package/dist/agentic-workflow/WebAgent.d.ts +39 -0
  23. package/dist/agentic-workflow/jsonTypes.d.ts +189 -0
  24. package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -0
  25. package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
  26. package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
  27. package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
  28. package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
  29. package/dist/agentic-workflow/types.d.ts +29 -0
  30. package/dist/agents/tools/filter/clearFilters/adapter.d.ts +8 -0
  31. package/dist/agents/tools/filter/clearFilters/adapter.js +22 -0
  32. package/dist/agents/tools/filter/resetMap/adapter.d.ts +8 -0
  33. package/dist/agents/tools/filter/resetMap/adapter.js +22 -0
  34. package/dist/agents/tools/filter/setFeatureEffect/adapter.d.ts +8 -0
  35. package/dist/agents/tools/filter/setFeatureEffect/adapter.js +121 -0
  36. package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
  37. package/dist/agents/tools/help/listFields/adapter.js +30 -0
  38. package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
  39. package/dist/agents/tools/navigation/goToAddress/adapter.js +60 -0
  40. package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
  41. package/dist/agents/tools/navigation/goToBookmark/adapter.js +30 -0
  42. package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
  43. package/dist/agents/tools/navigation/goToFeatures/adapter.js +50 -0
  44. package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
  45. package/dist/agents/tools/navigation/goToFullExtent/adapter.js +27 -0
  46. package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
  47. package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +24 -0
  48. package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
  49. package/dist/agents/tools/navigation/goToLayer/adapter.js +26 -0
  50. package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
  51. package/dist/agents/tools/navigation/goToScale/adapter.js +21 -0
  52. package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
  53. package/dist/agents/tools/navigation/goToViewpoint/adapter.js +42 -0
  54. package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
  55. package/dist/agents/tools/navigation/goToZoom/adapter.js +21 -0
  56. package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
  57. package/dist/agents/tools/query/getAttribute/adapter.js +40 -0
  58. package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
  59. package/dist/agents/tools/query/getStatistics/adapter.js +157 -0
  60. package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
  61. package/dist/agents/tools/query/getTopFeatures/adapter.js +144 -0
  62. package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
  63. package/dist/agents/tools/query/queryFeatures/adapter.js +130 -0
  64. package/dist/agents/tools/search/findRelevantFields/adapter.d.ts +8 -0
  65. package/dist/agents/tools/search/findRelevantFields/adapter.js +57 -0
  66. package/dist/agents/tools/search/findRelevantLayers/adapter.d.ts +8 -0
  67. package/dist/agents/tools/search/findRelevantLayers/adapter.js +38 -0
  68. package/dist/cdn/22KHSDJI.js +2 -0
  69. package/dist/cdn/2EY3BQQX.js +2 -0
  70. package/dist/cdn/2O4DON37.js +2 -0
  71. package/dist/cdn/34O57OGV.js +2 -0
  72. package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
  73. package/dist/cdn/434TAA3J.js +2 -0
  74. package/dist/cdn/4OGR5QKS.js +2 -0
  75. package/dist/cdn/5FL5BTTX.js +66 -0
  76. package/dist/cdn/5HBAJ57P.js +2 -0
  77. package/dist/cdn/5K5ZY267.js +2 -0
  78. package/dist/cdn/5MK44FNO.js +2 -0
  79. package/dist/cdn/5WYRJMBW.js +2 -0
  80. package/dist/cdn/5X7EG7D2.js +2 -0
  81. package/dist/cdn/5XZLS7UO.js +2 -0
  82. package/dist/cdn/5ZFUGNRN.js +2 -0
  83. package/dist/cdn/655YIKL3.js +11 -0
  84. package/dist/cdn/6ECRQVHY.js +2 -0
  85. package/dist/cdn/6OOZSZRJ.js +2 -0
  86. package/dist/cdn/{3PKJWIC3.js → 6P44KOKX.js} +1 -1
  87. package/dist/cdn/6YYPVU7H.js +3 -0
  88. package/dist/cdn/7BCQMK6D.js +2 -0
  89. package/dist/cdn/7SRLZQVC.js +5 -0
  90. package/dist/cdn/7V6OSTFC.js +2 -0
  91. package/dist/cdn/7VAQUCBU.js +9 -0
  92. package/dist/cdn/7VUSIGEM.js +2 -0
  93. package/dist/cdn/ACJTJLZN.js +2 -0
  94. package/dist/cdn/AI6DYOKR.js +181 -0
  95. package/dist/cdn/AKD5UOVX.js +2 -0
  96. package/dist/cdn/ANRQWYU2.js +2 -0
  97. package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
  98. package/dist/cdn/APFZY4PI.js +2 -0
  99. package/dist/cdn/B2JDVLA6.js +2 -0
  100. package/dist/cdn/BE7BRJZD.js +2 -0
  101. package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
  102. package/dist/cdn/C4FEETBZ.js +2 -0
  103. package/dist/cdn/C4JT4S5E.js +2 -0
  104. package/dist/cdn/CCC6LBMY.js +2 -0
  105. package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
  106. package/dist/cdn/CJMUJXPL.js +2 -0
  107. package/dist/cdn/COH3QXWG.js +4 -0
  108. package/dist/cdn/CP5BVGJU.js +2 -0
  109. package/dist/cdn/D5UFYQHN.js +44 -0
  110. package/dist/cdn/EWLXNGKH.js +208 -0
  111. package/dist/cdn/EYOWRGDP.js +2 -0
  112. package/dist/cdn/F5NIRETW.js +2 -0
  113. package/dist/cdn/FDOMMK2M.js +2 -0
  114. package/dist/cdn/FG647IP6.js +2 -0
  115. package/dist/cdn/FJO4KNOZ.js +2 -0
  116. package/dist/cdn/FUF3NAU7.js +2 -0
  117. package/dist/cdn/FXP5UIQU.js +156 -0
  118. package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
  119. package/dist/cdn/G2EGT3CF.js +6 -0
  120. package/dist/cdn/G3SF6U2U.js +2 -0
  121. package/dist/cdn/G7OMHU2B.js +2 -0
  122. package/dist/cdn/HAEFC2SJ.js +2 -0
  123. package/dist/cdn/HDACNIZF.js +2 -0
  124. package/dist/cdn/HHFNQR6Z.js +2 -0
  125. package/dist/cdn/HHUQXL3R.js +2 -0
  126. package/dist/cdn/IBZ2NEAO.js +2 -0
  127. package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
  128. package/dist/cdn/ICQCK5D3.js +2 -0
  129. package/dist/cdn/IHP25JWI.js +99 -0
  130. package/dist/cdn/IJVMUS2L.js +14 -0
  131. package/dist/cdn/J6A4AS7E.js +22 -0
  132. package/dist/cdn/J6SZIQJA.js +2 -0
  133. package/dist/cdn/JCOA24UH.js +3 -0
  134. package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
  135. package/dist/cdn/JO5ETMPS.js +2 -0
  136. package/dist/cdn/K2R6XVK3.js +2 -0
  137. package/dist/cdn/KITIP6J2.js +2 -0
  138. package/dist/cdn/KWD2ECTM.js +2 -0
  139. package/dist/cdn/{4HU7735A.js → LAYVGCPL.js} +6 -4
  140. package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
  141. package/dist/cdn/LLUGJKAQ.js +2 -0
  142. package/dist/cdn/MWYBF3F3.js +66 -0
  143. package/dist/cdn/{V2P4AIGG.js → MXTXJKFE.js} +1 -1
  144. package/dist/cdn/MY47B3CE.js +3 -0
  145. package/dist/cdn/NEV6OZN3.js +71 -0
  146. package/dist/cdn/NNXISHCA.js +14 -0
  147. package/dist/cdn/NZSOJ726.js +2 -0
  148. package/dist/cdn/O4NVW75A.js +2 -0
  149. package/dist/cdn/OE3GW5LE.js +2 -0
  150. package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
  151. package/dist/cdn/ONQ6JSBJ.js +2 -0
  152. package/dist/cdn/OX64WOEL.js +22 -0
  153. package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
  154. package/dist/cdn/PUHRBGKB.js +2 -0
  155. package/dist/cdn/Q57QWN5W.js +2 -0
  156. package/dist/cdn/QUKNPVAF.js +2 -0
  157. package/dist/cdn/R2PQVY4O.js +2 -0
  158. package/dist/cdn/R74ZHFA6.js +2 -0
  159. package/dist/cdn/RBE55SWR.js +2 -0
  160. package/dist/cdn/RHYNE5OE.js +2 -0
  161. package/dist/cdn/RLEHNAIA.js +2 -0
  162. package/dist/cdn/RVSTAUQS.js +2 -0
  163. package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
  164. package/dist/cdn/SXM4NUT5.js +2 -0
  165. package/dist/cdn/SZ2QSSB3.js +2 -0
  166. package/dist/cdn/T4RIGOXB.js +2 -0
  167. package/dist/cdn/TCH5I5LS.js +2 -0
  168. package/dist/cdn/TEPP7YPR.js +2 -0
  169. package/dist/cdn/TMVF2W5N.js +36 -0
  170. package/dist/cdn/TPULIO6I.js +34 -0
  171. package/dist/cdn/UDRKUVZP.js +2 -0
  172. package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
  173. package/dist/cdn/UHNVDALX.js +18 -0
  174. package/dist/cdn/UZLQALHY.js +2 -0
  175. package/dist/cdn/V6HOUZPZ.js +2 -0
  176. package/dist/cdn/VAXH6RUQ.js +134 -0
  177. package/dist/cdn/VLLZ2FFU.js +2 -0
  178. package/dist/cdn/VOKXKU7M.js +56 -0
  179. package/dist/cdn/VXFQANGJ.js +2 -0
  180. package/dist/cdn/WGO5SER7.js +6 -0
  181. package/dist/cdn/WJXXOKGA.js +9 -0
  182. package/dist/cdn/WKTQVBFJ.js +2 -0
  183. package/dist/cdn/{DHOVCT6R.js → WSWB3B7B.js} +1 -1
  184. package/dist/cdn/XX6GHMNR.js +2 -0
  185. package/dist/cdn/Y7XD7ZRD.js +2 -0
  186. package/dist/cdn/YEZ3AMNX.js +2 -0
  187. package/dist/cdn/YLVJA4ZE.js +2 -0
  188. package/dist/cdn/Z5HWPSZN.js +2 -0
  189. package/dist/cdn/Z5W4V7RC.js +2 -0
  190. package/dist/cdn/ZDV4K4WG.js +2 -0
  191. package/dist/cdn/ZOEMBHRF.js +2 -0
  192. package/dist/cdn/ZRVZMPFN.js +2 -0
  193. package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
  194. package/dist/cdn/agent-utils/index.js +2 -0
  195. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  196. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  197. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  198. package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
  199. package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
  200. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.en.json +1 -0
  201. package/dist/cdn/assets/assistant-message/t9n/messages.en.json +1 -0
  202. package/dist/cdn/assets/assistant-message-loading/t9n/messages.en.json +1 -0
  203. package/dist/cdn/index.js +1 -1
  204. package/dist/cdn/main.css +1 -1
  205. package/dist/chunks/adapter.js +1299 -2113
  206. package/dist/chunks/arcgisKnowledgeGraph.js +128 -72
  207. package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
  208. package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
  209. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
  210. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
  211. package/dist/chunks/baseAgentState.js +58 -0
  212. package/dist/chunks/converterUtils.js +66 -41
  213. package/dist/chunks/dataExplorationGraph.js +135 -179
  214. package/dist/chunks/data_explore_query_prompt.js +9 -4
  215. package/dist/chunks/fetchAgentContext.js +13 -0
  216. package/dist/chunks/fetchService.js +10 -0
  217. package/dist/chunks/fieldStatistics.js +79 -0
  218. package/dist/chunks/formatFeatureAttributes.js +132 -0
  219. package/dist/chunks/generateLayerDescriptions.js +250 -246
  220. package/dist/chunks/helpGraph.js +35 -25
  221. package/dist/chunks/help_prompt.js +34 -17
  222. package/dist/chunks/index.js +11 -0
  223. package/dist/chunks/intent_prompt.js +16 -0
  224. package/dist/chunks/layerStylingGraph.js +37 -31
  225. package/dist/chunks/mergeWhereClauses.js +15 -0
  226. package/dist/chunks/navigationGraph.js +135 -111
  227. package/dist/chunks/navigation_intent_prompt.js +8 -2
  228. package/dist/chunks/orchestrator.js +530 -280
  229. package/dist/chunks/resolvePointGeometryFilter.js +92 -0
  230. package/dist/chunks/slottableRequestUtils.js +3 -7
  231. package/dist/chunks/state.js +21 -27
  232. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  233. package/dist/chunks/toolCallResponse.js +14 -10
  234. package/dist/chunks/utils2.js +11 -11
  235. package/dist/components/arcgis-assistant/customElement.d.ts +96 -0
  236. package/dist/components/arcgis-assistant/customElement.js +398 -149
  237. package/dist/components/arcgis-assistant/index.js +2 -3
  238. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  239. package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
  240. package/dist/components/arcgis-assistant-agent/customElement.js +614 -10
  241. package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
  242. package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
  243. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
  244. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  245. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +20 -4
  246. package/dist/components/arcgis-assistant-help-agent/customElement.js +29 -7
  247. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +8 -1
  248. package/dist/components/arcgis-assistant-interrupt/customElement.js +17 -14
  249. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +24 -0
  250. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  251. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  252. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +40 -16
  253. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +30 -7
  254. package/dist/components/arcgis-assistant-message/customElement.d.ts +26 -0
  255. package/dist/components/arcgis-assistant-message/customElement.js +29 -26
  256. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  257. package/dist/components/arcgis-assistant-message/index.js +2 -0
  258. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  259. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  260. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  261. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  262. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  263. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +11 -1
  264. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -7
  265. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  266. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  267. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  268. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +5 -1
  269. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  270. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +18 -4
  271. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  272. package/dist/components/arcgis-assistant-speech-input/customElement.js +34 -52
  273. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  274. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  275. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +6 -1
  276. package/dist/components/arcgis-assistant-user-message/customElement.js +15 -10
  277. package/dist/docs/api.json +1 -1
  278. package/dist/docs/docs.json +1 -1
  279. package/dist/docs/vscode.html-custom-data.json +1 -1
  280. package/dist/docs/web-types.json +1 -1
  281. package/dist/index.d.ts +4 -0
  282. package/dist/loader.js +9 -8
  283. package/dist/oauth-callback.html +1 -1
  284. package/dist/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
  285. package/dist/types/lumina.d.ts +14 -7
  286. package/dist/types/preact.d.ts +15 -7
  287. package/dist/types/react.d.ts +16 -7
  288. package/dist/types/stencil.d.ts +16 -9
  289. package/dist/utils/index.d.ts +135 -65
  290. package/dist/utils/index.js +55 -50
  291. package/package.json +32 -12
  292. package/dist/cdn/2AXF774U.js +0 -2
  293. package/dist/cdn/462JBSEV.js +0 -422
  294. package/dist/cdn/5QAHYX7Y.js +0 -5
  295. package/dist/cdn/7BCR6TUO.js +0 -2
  296. package/dist/cdn/7GH7VSB2.js +0 -2
  297. package/dist/cdn/7PLV4QH6.js +0 -2
  298. package/dist/cdn/AO7BQHKC.js +0 -2
  299. package/dist/cdn/AXDZBBNL.js +0 -45
  300. package/dist/cdn/DDLZOMUY.js +0 -2
  301. package/dist/cdn/F2AHA4GB.js +0 -54
  302. package/dist/cdn/FHVXO2WG.js +0 -166
  303. package/dist/cdn/FX5JFRDL.js +0 -2
  304. package/dist/cdn/GSEPHN3A.js +0 -106
  305. package/dist/cdn/H7422XUG.js +0 -2
  306. package/dist/cdn/HB5A5R2E.js +0 -2
  307. package/dist/cdn/JY6LLOUJ.js +0 -22
  308. package/dist/cdn/KMQ3SP4I.js +0 -5
  309. package/dist/cdn/MDVYQQUG.js +0 -14
  310. package/dist/cdn/MH5RPXHM.js +0 -2
  311. package/dist/cdn/NAUXSHIE.js +0 -72
  312. package/dist/cdn/NVI3I46B.js +0 -2
  313. package/dist/cdn/OAVEHGB6.js +0 -2
  314. package/dist/cdn/OH64RMOR.js +0 -4
  315. package/dist/cdn/ON2V5XI2.js +0 -3
  316. package/dist/cdn/P6OPJQMC.js +0 -3
  317. package/dist/cdn/QR54T33D.js +0 -2
  318. package/dist/cdn/RVOAPUBN.js +0 -2
  319. package/dist/cdn/S6W6HV4T.js +0 -36
  320. package/dist/cdn/SXDLXCIM.js +0 -2
  321. package/dist/cdn/USMDJUFS.js +0 -2
  322. package/dist/cdn/V5YEZSRY.js +0 -16
  323. package/dist/cdn/Y333DGV6.js +0 -2
  324. package/dist/cdn/YIMNOUTF.js +0 -2
  325. package/dist/cdn/YY2SBO3V.js +0 -2
@@ -0,0 +1,42 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import t from "zod";
3
+ import { tool as c } from "@langchain/core/tools";
4
+ import l from "@arcgis/core/geometry/Point.js";
5
+ import { f as r } from "../../../../chunks/fetchAgentContext.js";
6
+ async function m(e, a, o) {
7
+ const i = {
8
+ target: new l({
9
+ longitude: e.longitude,
10
+ latitude: e.latitude,
11
+ spatialReference: { wkid: 4326 }
12
+ })
13
+ };
14
+ return o?.zoom !== void 0 && (i.zoom = o.zoom), o?.scale !== void 0 && (i.scale = o.scale), await a.goTo(i), { text: `Successfully navigated to: ${[
15
+ `(${e.latitude}°, ${e.longitude}°)`,
16
+ o?.zoom !== void 0 ? `zoom ${o.zoom}` : "",
17
+ o?.scale !== void 0 ? `scale 1:${o.scale}` : ""
18
+ ].filter(Boolean).join(", ")}` };
19
+ }
20
+ async function d({
21
+ center: e,
22
+ zoom: a,
23
+ scale: o
24
+ }, n) {
25
+ const { mapView: i } = r(n, ["mapView"]);
26
+ return await m(e, i, { zoom: a, scale: o });
27
+ }
28
+ const s = t.object({
29
+ center: t.object({
30
+ longitude: t.number().describe("The longitude (x-coordinate) of the point to navigate to."),
31
+ latitude: t.number().describe("The latitude (y-coordinate) of the point to navigate to.")
32
+ }),
33
+ zoom: t.number().optional().describe("The zoom level. Higher values = more zoomed in."),
34
+ scale: t.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
35
+ }), T = c(d, {
36
+ name: "goToViewpoint",
37
+ description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
38
+ schema: s
39
+ });
40
+ export {
41
+ T as goToViewpointTool
42
+ };
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Navigates the map to a specified zoom level.
5
+ *
6
+ * @internal
7
+ */
8
+ export const goToZoomTool: StructuredToolInterface;
@@ -0,0 +1,21 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import t from "zod";
3
+ import { tool as m } from "@langchain/core/tools";
4
+ import { f as i } from "../../../../chunks/fetchAgentContext.js";
5
+ async function r(o, e) {
6
+ return await e.goTo({ zoom: o }), { text: `Successfully zoomed to: ${o}` };
7
+ }
8
+ async function a({ zoom: o }, e) {
9
+ const { mapView: n } = i(e, ["mapView"]);
10
+ return await r(o, n);
11
+ }
12
+ const c = t.object({
13
+ zoom: t.number().min(1).max(20).describe("The zoom level of the view to go to.")
14
+ }), l = m(a, {
15
+ name: "goToZoom",
16
+ description: 'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',
17
+ schema: c
18
+ });
19
+ export {
20
+ l as goToZoomTool
21
+ };
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Returns a formatted field value from the first feature matching a query.
5
+ *
6
+ * @internal
7
+ */
8
+ export const getAttributeTool: StructuredToolInterface;
@@ -0,0 +1,40 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { tool as f } from "@langchain/core/tools";
3
+ import i from "zod";
4
+ import { f as h, g } from "../../../../chunks/formatFeatureAttributes.js";
5
+ import { f as y } from "../../../../chunks/fetchAgentContext.js";
6
+ const b = (a, e, o) => {
7
+ const t = a.createQuery();
8
+ return t.outFields = [e], t.where = o || "1=1", t.num = 1, t;
9
+ }, d = async (a, e, o, t) => {
10
+ const r = t.map?.allLayers.find((m) => m.id === a), n = b(r, e, o.where), u = (await r.queryFeatures(n)).features[0], c = u ? u.attributes[e] : null, l = h(r, e, c, t.timeZone), s = g(r, e);
11
+ return {
12
+ tool: "getAttribute",
13
+ layerName: r.title ?? a,
14
+ summary: `${s} = ${l}`,
15
+ details: {
16
+ fieldName: e,
17
+ fieldAlias: s !== e ? s : void 0,
18
+ value: l,
19
+ where: o.where
20
+ }
21
+ };
22
+ };
23
+ async function p({ layerId: a, fieldName: e, query: o }, t) {
24
+ const { mapView: r } = y(t, ["mapView"]), n = await d(a, e, o, r);
25
+ return JSON.stringify(n, null, 2);
26
+ }
27
+ const w = i.object({
28
+ layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
29
+ fieldName: i.string().describe("The name of the field/attribute from which to get a field value."),
30
+ query: i.object({
31
+ where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
32
+ })
33
+ }), Q = f(p, {
34
+ name: "getAttribute",
35
+ description: "Returns an attribute value for a given feature.",
36
+ schema: w
37
+ });
38
+ export {
39
+ Q as getAttributeTool
40
+ };
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Calculates an aggregate statistic for a field with optional spatial filtering.
5
+ *
6
+ * @internal
7
+ */
8
+ export const getStatisticsTool: StructuredToolInterface;
@@ -0,0 +1,157 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { tool as L } from "@langchain/core/tools";
3
+ import t from "zod";
4
+ import E from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
5
+ import R from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
6
+ import V from "@arcgis/core/layers/support/FeatureFilter.js";
7
+ import { c as x, m as v } from "../../../../chunks/mergeWhereClauses.js";
8
+ import { g as O, i as S, a as C, d as I, s as N, r as G } from "../../../../chunks/resolvePointGeometryFilter.js";
9
+ import { f as U } from "../../../../chunks/fetchAgentContext.js";
10
+ import { f as W } from "../../../../chunks/fetchService.js";
11
+ const j = async (h) => {
12
+ const { targetLayer: a, fieldName: n, statisticType: l, mapView: i, layersAndFieldsRegistry: p, geometryFilter: e } = h, s = i.map?.allLayers.find((r) => r.id === a.layerId);
13
+ if (!s)
14
+ throw new Error(`Layer '${a.layerId}' not found.`);
15
+ const w = await i.whenLayerView(s), o = p.get(a.layerId)?.fieldRegistry.get(n), F = o?.alias;
16
+ if (!o)
17
+ throw new Error(`Field '${n}' not found.`);
18
+ let b, u;
19
+ if (e) {
20
+ const r = await O(e, i);
21
+ if ("error" in r)
22
+ throw new Error(r.error);
23
+ if (!r.geometry)
24
+ throw S(e) ? new Error(`No features found matching: ${e.where}`) : new Error("Failed to create geometry");
25
+ if (S(e)) {
26
+ const g = i.map?.allLayers.find((f) => f.id === e.layerId);
27
+ b = {
28
+ geometryLayerName: g?.title ?? g?.id,
29
+ geometryLayerId: e.layerId,
30
+ geometryWhere: e.where,
31
+ distance: e.distance,
32
+ units: e.units,
33
+ applied: !0
34
+ };
35
+ } else C(e) && (b = {
36
+ point: e.point,
37
+ distance: e.distance,
38
+ units: e.units,
39
+ applied: !0
40
+ });
41
+ u = new V({
42
+ geometry: r.geometry,
43
+ distance: e.distance,
44
+ units: e.units,
45
+ spatialRelationship: "intersects"
46
+ });
47
+ }
48
+ const y = x(w, [n], !1);
49
+ let d = null, m = null;
50
+ const T = 10;
51
+ if (o.type !== "geometry" && o.type !== "oid" && o.type !== "global-id")
52
+ try {
53
+ const r = {
54
+ layer: s,
55
+ useFeaturesInView: y,
56
+ view: y ? i : void 0,
57
+ field: n,
58
+ sqlWhere: v(s.definitionExpression, a.where),
59
+ ...u && { filter: u },
60
+ outStatisticTypes: { include: [l] }
61
+ };
62
+ d = await E(r);
63
+ const g = ["string", "small-integer", "integer"], f = o.domain?.type === "coded-value" ? o.domain : null;
64
+ (g.includes(o.type) || f) && (m = (await R({
65
+ layer: s,
66
+ useFeaturesInView: y,
67
+ view: y ? i : void 0,
68
+ field: n,
69
+ sqlWhere: v(s.definitionExpression, a.where),
70
+ ...u && { filter: u }
71
+ })).uniqueValueInfos.sort((c, q) => q.count - c.count).slice(0, T)), m && o.domain?.type === "coded-value" && (m = m.map((c) => ({
72
+ ...c,
73
+ value: f ? f.getName(c.value) ?? c.value : c.value
74
+ })));
75
+ } catch (r) {
76
+ console.error("Statistics error:", r);
77
+ }
78
+ return {
79
+ tool: "getStatistics",
80
+ layerName: s.title ?? a.layerId,
81
+ summary: `${l} = ${typeof d?.[l] == "number" ? d[l] : "N/A"}`,
82
+ details: {
83
+ fieldName: n,
84
+ fieldAlias: F,
85
+ statisticType: l,
86
+ statistic: d?.[l] ?? null,
87
+ summaryStatistics: d,
88
+ uniqueValues: m,
89
+ where: a.where,
90
+ spatialFilterInfo: b
91
+ }
92
+ };
93
+ };
94
+ async function A({
95
+ targetLayer: h,
96
+ fieldName: a,
97
+ statisticType: n,
98
+ geometryFilter: l
99
+ }, i) {
100
+ const p = W(i, "layersAndFieldsRegistry"), { mapView: e } = U(i, ["mapView"]), s = G(
101
+ l,
102
+ i.state?.agentExecutionContext?.sharedResources
103
+ ), w = await j({
104
+ targetLayer: h,
105
+ fieldName: a,
106
+ statisticType: n,
107
+ mapView: e,
108
+ layersAndFieldsRegistry: p,
109
+ geometryFilter: s
110
+ });
111
+ return JSON.stringify(w, null, 2);
112
+ }
113
+ const D = t.object({
114
+ layerId: t.string().describe("The layerId of the layer containing the geometry by which to filter."),
115
+ where: t.string().describe("The SQL-92 where clause representing the features from which to filter."),
116
+ distance: t.number().optional().describe("The buffer distance around the geometry."),
117
+ units: I.optional().describe("The units for the distance buffer.")
118
+ }), P = t.object({
119
+ point: t.object({
120
+ x: t.number().describe("X coordinate (longitude) from navigation result"),
121
+ y: t.number().describe("Y coordinate (latitude) from navigation result"),
122
+ spatialReference: t.object({
123
+ wkid: t.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
124
+ }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
125
+ }).describe("Point coordinates from a previous navigation/geocoding result"),
126
+ distance: t.number().optional().describe("Optional buffer distance around the point."),
127
+ units: I.optional().describe("The units for the distance buffer.")
128
+ }), $ = t.object({
129
+ targetLayer: t.object({
130
+ layerId: t.string().describe("The layerId of the layer containing the field from which to get a value."),
131
+ where: t.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
132
+ }),
133
+ geometryFilter: t.union([D, P, N]).optional().describe(
134
+ "Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."
135
+ ),
136
+ fieldName: t.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
137
+ statisticType: t.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
138
+ }), _ = L(A, {
139
+ name: "getStatistics",
140
+ description: `Computes a single aggregate statistic (max, min, avg, sum, median, stddev, variance) for a numeric field across matching features. Also returns frequency analysis for categorical fields.
141
+
142
+ USE THIS TOOL FOR:
143
+ - "What is the average/maximum/minimum/total [field]?" — aggregate computations
144
+ - "Most common/frequent value of [field]?" — frequency analysis
145
+ - Questions requiring a mathematical aggregation across many features
146
+
147
+ DO NOT USE FOR:
148
+ - "How many features match X?" — use queryFeatures instead (it returns totalCount)
149
+ - "Show / list / find features" — use queryFeatures instead
150
+ - Simple counts of features matching a condition — use queryFeatures instead
151
+
152
+ Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,
153
+ schema: $
154
+ });
155
+ export {
156
+ _ as getStatisticsTool
157
+ };
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Returns top-ranked features based on grouping and ordering criteria.
5
+ *
6
+ * @internal
7
+ */
8
+ export const getTopFeaturesTool: StructuredToolInterface;
@@ -0,0 +1,144 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { tool as S } from "@langchain/core/tools";
3
+ import e from "zod";
4
+ import T from "@arcgis/core/rest/support/TopFeaturesQuery.js";
5
+ import B from "@arcgis/core/rest/support/TopFilter.js";
6
+ import { m as C, c as v } from "../../../../chunks/mergeWhereClauses.js";
7
+ import { a as I } from "../../../../chunks/formatFeatureAttributes.js";
8
+ import { g as q, d as y, s as x, r as G } from "../../../../chunks/resolvePointGeometryFilter.js";
9
+ import { f as N } from "../../../../chunks/fetchAgentContext.js";
10
+ const k = (s) => s.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), R = async (s, t, n, i, l) => {
11
+ const a = n.map?.allLayers.find((o) => o.id === s.layerId), c = await n.whenLayerView(a), u = a.title ?? s.layerId;
12
+ let d;
13
+ if (i) {
14
+ const o = await q(i, n);
15
+ if ("error" in o)
16
+ return {
17
+ tool: "getTopFeatures",
18
+ layerName: u,
19
+ summary: "Geometry lookup failed",
20
+ details: { error: o.error }
21
+ };
22
+ if (!o.geometry)
23
+ return {
24
+ tool: "getTopFeatures",
25
+ layerName: u,
26
+ summary: "No features found for geometry filter",
27
+ details: {
28
+ error: `No features found matching: ${"where" in i ? i.where : "unknown criteria"}`
29
+ }
30
+ };
31
+ d = o.geometry;
32
+ } else l && (d = n.extent.clone());
33
+ const p = t.groupByFields && t.groupByFields.length > 0, f = a.objectIdField, h = s.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...s.outFields, f])];
34
+ try {
35
+ let o;
36
+ if (p) {
37
+ const r = new T({
38
+ where: s.where || "1=1",
39
+ outFields: h,
40
+ orderByFields: s.orderByFields,
41
+ geometry: d,
42
+ spatialRelationship: d ? "intersects" : void 0,
43
+ distance: i?.distance,
44
+ units: i?.units,
45
+ topFilter: new B({
46
+ topCount: t.topCount,
47
+ groupByFields: t.groupByFields,
48
+ orderByFields: t.orderByFields
49
+ })
50
+ });
51
+ o = await a.queryTopFeatures(r);
52
+ } else {
53
+ const r = a.createQuery();
54
+ r.where = C(a.definitionExpression, s.where || "1=1"), r.outFields = h.length ? h : ["*"], r.orderByFields = t.orderByFields, r.returnGeometry = !1, r.num = t.topCount, d && (r.geometry = d, r.spatialRelationship = "intersects"), i?.distance && (r.distance = i.distance), i?.units && (r.units = i.units), r.outSpatialReference = n.spatialReference;
55
+ const m = [
56
+ .../* @__PURE__ */ new Set([...s.outFields, ...k(t.orderByFields)])
57
+ ], w = v(c, m, l ?? !1);
58
+ try {
59
+ o = w ? await c.queryFeatures(r) : await a.queryFeatures(r);
60
+ } catch (F) {
61
+ console.warn("Client-side query failed, falling back to server:", F), o = await a.queryFeatures(r);
62
+ }
63
+ }
64
+ const g = o.features.map((r) => r.attributes[f]), { attributes: b } = I(a, o, n.timeZone);
65
+ return {
66
+ tool: "getTopFeatures",
67
+ layerName: u,
68
+ summary: `Top ${t.topCount} features extracted`,
69
+ details: {
70
+ topCount: t.topCount,
71
+ attributes: b,
72
+ objectIds: g,
73
+ objectIdField: f,
74
+ where: s.where,
75
+ orderByFields: t.orderByFields,
76
+ ...p && { groupByFields: t.groupByFields }
77
+ }
78
+ };
79
+ } catch (o) {
80
+ return {
81
+ tool: "getTopFeatures",
82
+ layerName: u,
83
+ summary: "Query failed",
84
+ details: { error: o instanceof Error ? o.message : String(o) }
85
+ };
86
+ }
87
+ }, j = async ({
88
+ targetLayer: s,
89
+ topFilter: t,
90
+ geometryFilter: n,
91
+ useCurrentExtent: i
92
+ }, l) => {
93
+ const { mapView: a } = N(l, ["mapView"]), c = G(
94
+ n,
95
+ l.state?.agentExecutionContext?.sharedResources
96
+ ), u = await R(s, t, a, c, i);
97
+ return JSON.stringify(u, null, 2);
98
+ }, D = e.object({
99
+ layerId: e.string().describe("The layerId of the layer containing the geometry by which to filter."),
100
+ where: e.string().describe("The SQL-92 where clause representing the features from which to filter."),
101
+ distance: e.number().optional().describe("The buffer distance around the geometry."),
102
+ units: y.optional().describe("The units for the distance buffer.")
103
+ }), Q = e.object({
104
+ point: e.object({
105
+ x: e.number().describe("X coordinate (longitude) from navigation result"),
106
+ y: e.number().describe("Y coordinate (latitude) from navigation result"),
107
+ spatialReference: e.object({
108
+ wkid: e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
109
+ }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
110
+ }).describe("Point coordinates from a previous navigation/geocoding result"),
111
+ distance: e.number().optional().describe("Optional buffer distance around the point."),
112
+ units: y.optional().describe("The units for the distance buffer.")
113
+ }), U = e.object({
114
+ targetLayer: e.object({
115
+ layerId: e.string().describe("The layerId of the layer containing the field from which to get a value."),
116
+ where: e.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
117
+ orderByFields: e.array(e.string().describe("The field(s) and order for which to sort the resulting features.")),
118
+ outFields: e.array(
119
+ e.string().describe(
120
+ 'The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").'
121
+ ).default("*")
122
+ )
123
+ }),
124
+ geometryFilter: e.union([D, Q, x]).optional().describe(
125
+ "Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."
126
+ ),
127
+ topFilter: e.object({
128
+ topCount: e.number().describe("Number of top features to return per group."),
129
+ orderByFields: e.array(
130
+ e.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
131
+ ),
132
+ groupByFields: e.array(e.string().describe("Field(s) to group results by. Returns top N per group."))
133
+ }).required(),
134
+ useCurrentExtent: e.boolean().optional().describe(
135
+ "Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at'. Default is false (queries entire layer)."
136
+ )
137
+ }), J = S(j, {
138
+ name: "getTopFeatures",
139
+ description: 'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',
140
+ schema: U
141
+ });
142
+ export {
143
+ J as getTopFeaturesTool
144
+ };
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Returns the count and attributes of features matching query constraints.
5
+ *
6
+ * @internal
7
+ */
8
+ export const queryFeaturesTool: StructuredToolInterface;
@@ -0,0 +1,130 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { tool as v } from "@langchain/core/tools";
3
+ import { a as C } from "../../../../chunks/formatFeatureAttributes.js";
4
+ import { g as R, i as F, a as I, d as q, s as G, r as O } from "../../../../chunks/resolvePointGeometryFilter.js";
5
+ import { c as j, m as x } from "../../../../chunks/mergeWhereClauses.js";
6
+ import t from "zod";
7
+ import { f as N } from "../../../../chunks/fetchAgentContext.js";
8
+ const p = 25, W = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map((r) => r.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((r) => !!r), B = async (i, r, e, l) => {
9
+ const a = r.map?.allLayers.find((u) => u.id === i.layerId), d = await r.whenLayerView(a), f = a.title ?? i.layerId;
10
+ let h;
11
+ if (e) {
12
+ const u = await R(e, r);
13
+ if ("error" in u) {
14
+ const s = { error: u.error };
15
+ if (F(e)) {
16
+ const c = r.map?.allLayers.find((y) => y.id === e.layerId);
17
+ s.geometryLayerName = c?.title ?? c?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
18
+ } else I(e) && (s.point = e.point);
19
+ return {
20
+ tool: "queryFeatures",
21
+ layerName: f,
22
+ summary: "Geometry lookup failed",
23
+ details: s
24
+ };
25
+ }
26
+ if (!u.geometry) {
27
+ const s = {};
28
+ if (F(e)) {
29
+ const c = r.map?.allLayers.find((y) => y.id === e.layerId);
30
+ s.error = `No features found matching: ${e.where}`, s.geometryLayerName = c?.title ?? c?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
31
+ } else I(e) && (s.error = "Failed to create point geometry", s.point = e.point);
32
+ return {
33
+ tool: "queryFeatures",
34
+ layerName: f,
35
+ summary: "No features found for geometry filter",
36
+ details: s
37
+ };
38
+ }
39
+ h = u.geometry;
40
+ } else l && (h = r.extent.clone());
41
+ const T = [
42
+ .../* @__PURE__ */ new Set([...i.outFields, ...W(i.orderByFields)])
43
+ ], b = j(d, T, l ?? !1), w = a.objectIdField, o = a.createQuery();
44
+ o.where = x(a.definitionExpression, i.where || "1=1"), o.outFields = i.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...i.outFields, w])], o.orderByFields = i.orderByFields, h && (o.geometry = h, o.spatialRelationship = "intersects"), e?.distance && (o.distance = e.distance), e?.units && (o.units = e.units), o.outSpatialReference = r.spatialReference;
45
+ let n, m;
46
+ try {
47
+ n = b ? await d.queryFeatureCount(o) : await a.queryFeatureCount(o), n > 0 && n <= p && (m = b ? await d.queryFeatures(o) : await a.queryFeatures(o));
48
+ } catch (u) {
49
+ console.warn("Client-side query failed, falling back to server:", u), n = await a.queryFeatureCount(o), n > 0 && n <= p && (m = await a.queryFeatures(o));
50
+ }
51
+ const { objectIds: g, attributes: S } = m ? C(a, m, r.timeZone) : { objectIds: void 0, attributes: void 0 };
52
+ return {
53
+ tool: "queryFeatures",
54
+ layerName: f,
55
+ summary: `${n} features found`,
56
+ details: {
57
+ totalCount: n,
58
+ where: i.where,
59
+ orderByFields: i.orderByFields,
60
+ outFields: i.outFields,
61
+ ...g && { objectIds: g, objectIdField: w },
62
+ ...S && { attributes: S },
63
+ ...n > p && {
64
+ note: `${n} features found.`
65
+ }
66
+ }
67
+ };
68
+ };
69
+ async function k({
70
+ targetLayer: i,
71
+ geometryFilter: r,
72
+ useCurrentExtent: e
73
+ }, l) {
74
+ const { mapView: a } = N(l, ["mapView"]), d = O(
75
+ r,
76
+ l.state?.agentExecutionContext?.sharedResources
77
+ ), f = await B(i, a, d, e);
78
+ return JSON.stringify(f, null, 2);
79
+ }
80
+ const D = t.object({
81
+ layerId: t.string().describe("The layerId of the layer containing the geometry by which to filter."),
82
+ where: t.string().describe("The SQL-92 where clause representing the features from which to filter."),
83
+ distance: t.number().optional().describe("The buffer distance around the geometry."),
84
+ units: q.optional().describe("The units for the distance buffer.")
85
+ }), L = t.object({
86
+ point: t.object({
87
+ x: t.number().describe("X coordinate (longitude) from navigation result"),
88
+ y: t.number().describe("Y coordinate (latitude) from navigation result"),
89
+ spatialReference: t.object({
90
+ wkid: t.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
91
+ }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
92
+ }).describe("Point coordinates from a previous navigation/geocoding result"),
93
+ distance: t.number().optional().describe("Optional buffer distance around the point."),
94
+ units: q.optional().describe("The units for the distance buffer.")
95
+ }), U = t.object({
96
+ targetLayer: t.object({
97
+ layerId: t.string().describe("The layerId of the layer containing the field from which to get a value."),
98
+ where: t.string().describe(
99
+ "SQL-92 where clause. IMPORTANT: When using geometryFilter.point or geometryFilter.sharedResourceId for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."
100
+ ),
101
+ orderByFields: t.array(t.string().describe("The field(s) and order for which to sort the resulting features.")),
102
+ outFields: t.array(
103
+ t.string().describe(
104
+ 'The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").'
105
+ ).default("*")
106
+ )
107
+ }),
108
+ geometryFilter: t.union([D, L, G]).optional().describe(
109
+ "Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."
110
+ ),
111
+ useCurrentExtent: t.boolean().optional().describe(
112
+ "Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer)."
113
+ )
114
+ }), H = v(k, {
115
+ name: "queryFeatures",
116
+ description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
117
+
118
+ USE THIS TOOL FOR:
119
+ - "Show / display / list features where..." — finding and listing features
120
+ - "How many X are Y?" — counting features that match a condition
121
+ - "Which features..." / "Find features..." — identifying specific features
122
+ - Spatial queries — finding features near/within/intersecting other features
123
+ - Any question where the user wants to SEE or COUNT matching features
124
+
125
+ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
126
+ schema: U
127
+ });
128
+ export {
129
+ H as queryFeaturesTool
130
+ };
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Finds and enriches fields that are semantically relevant to a task.
5
+ *
6
+ * @internal
7
+ */
8
+ export const findRelevantFieldsTool: StructuredToolInterface;
@@ -0,0 +1,57 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { tool as y } from "@langchain/core/tools";
3
+ import t from "zod";
4
+ import { f as h } from "../../../../chunks/fetchAgentContext.js";
5
+ import { f as r } from "../../../../chunks/fetchService.js";
6
+ import { b as p } from "../../../../chunks/fieldStatistics.js";
7
+ const v = 0.7, S = 10;
8
+ async function R(a) {
9
+ const {
10
+ query: e,
11
+ layerIds: i,
12
+ includeSummaryStatistics: s = !1,
13
+ fieldSearch: l,
14
+ layersAndFieldsRegistry: d,
15
+ embeddingCache: o,
16
+ mapView: c,
17
+ minScore: m = v,
18
+ topResults: f = S
19
+ } = a, n = await l.searchFields({
20
+ text: e,
21
+ layerIds: i,
22
+ minScore: m,
23
+ topResults: f,
24
+ embeddingCache: o
25
+ }), u = await p(
26
+ n,
27
+ d,
28
+ c,
29
+ s
30
+ );
31
+ return { matches: n, ...u };
32
+ }
33
+ const b = t.object({
34
+ query: t.string().describe("A concise semantic description of the fields relevant to the user's task."),
35
+ layerIds: t.array(t.string()).min(1).describe("Layer IDs returned by findRelevantLayers, restricted to layers relevant to the current task."),
36
+ includeSummaryStatistics: t.boolean().optional().default(!1).describe(
37
+ "Set to true only when the task directly asks for numeric summaries such as average, minimum, maximum, total, variance, or range."
38
+ )
39
+ });
40
+ async function F(a, e) {
41
+ const { mapView: i } = h(e, ["mapView"]), s = await R({
42
+ ...a,
43
+ fieldSearch: r(e, "fieldSearch"),
44
+ layersAndFieldsRegistry: r(e, "layersAndFieldsRegistry"),
45
+ embeddingCache: r(e, "embeddingCache"),
46
+ mapView: i
47
+ });
48
+ return JSON.stringify(s, null, 2);
49
+ }
50
+ const C = y(F, {
51
+ name: "findRelevantFields",
52
+ description: "Finds relevant fields within candidate layers. Returns ranked matches, field metadata, categorical values, and optional numeric summary statistics. Call findRelevantLayers first when layer IDs are not already known.",
53
+ schema: b
54
+ });
55
+ export {
56
+ C as findRelevantFieldsTool
57
+ };
@@ -0,0 +1,8 @@
1
+ import type { StructuredToolInterface } from "@langchain/core/tools";
2
+
3
+ /**
4
+ * Finds map layers that are semantically relevant to a task.
5
+ *
6
+ * @internal
7
+ */
8
+ export const findRelevantLayersTool: StructuredToolInterface;