@arcgis/ai-components 5.2.0-next.9 → 5.2.0-next.91

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 (315) 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 +4 -2
  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 +109 -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 +52 -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 +154 -0
  60. package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
  61. package/dist/agents/tools/query/getTopFeatures/adapter.js +141 -0
  62. package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
  63. package/dist/agents/tools/query/queryFeatures/adapter.js +127 -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/2EY3BQQX.js +2 -0
  69. package/dist/cdn/2PTPBAIN.js +2 -0
  70. package/dist/cdn/34O57OGV.js +2 -0
  71. package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
  72. package/dist/cdn/434TAA3J.js +2 -0
  73. package/dist/cdn/4EBLRHYE.js +2 -0
  74. package/dist/cdn/4HDDRBIY.js +2 -0
  75. package/dist/cdn/4KOV2NEI.js +9 -0
  76. package/dist/cdn/4NJ2FF7H.js +2 -0
  77. package/dist/cdn/4OGR5QKS.js +2 -0
  78. package/dist/cdn/4WIDLQUH.js +2 -0
  79. package/dist/cdn/5FL5BTTX.js +66 -0
  80. package/dist/cdn/5WYRJMBW.js +2 -0
  81. package/dist/cdn/5X7EG7D2.js +2 -0
  82. package/dist/cdn/5ZFUGNRN.js +2 -0
  83. package/dist/cdn/6HF36IKA.js +2 -0
  84. package/dist/cdn/6KFMRBAA.js +2 -0
  85. package/dist/cdn/6VJXUIXY.js +3 -0
  86. package/dist/cdn/7BCQMK6D.js +2 -0
  87. package/dist/cdn/7DFXYMEA.js +2 -0
  88. package/dist/cdn/7M6VKBTK.js +6 -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/7ZFAFKJT.js +2 -0
  93. package/dist/cdn/ACJTJLZN.js +2 -0
  94. package/dist/cdn/AI6DYOKR.js +181 -0
  95. package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
  96. package/dist/cdn/APFZY4PI.js +2 -0
  97. package/dist/cdn/AT4XVTJR.js +44 -0
  98. package/dist/cdn/AZCIDPML.js +2 -0
  99. package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
  100. package/dist/cdn/C5ZL5Z52.js +18 -0
  101. package/dist/cdn/CCC6LBMY.js +2 -0
  102. package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
  103. package/dist/cdn/CJMUJXPL.js +2 -0
  104. package/dist/cdn/COL6QYGQ.js +2 -0
  105. package/dist/cdn/CP5BVGJU.js +2 -0
  106. package/dist/cdn/CZM4URK7.js +2 -0
  107. package/dist/cdn/DP6O6PMH.js +2 -0
  108. package/dist/cdn/{V2P4AIGG.js → EKB7CAMM.js} +1 -1
  109. package/dist/cdn/EWLXNGKH.js +208 -0
  110. package/dist/cdn/EYNEYD34.js +2 -0
  111. package/dist/cdn/FDDQ67BG.js +2 -0
  112. package/dist/cdn/FDOMMK2M.js +2 -0
  113. package/dist/cdn/FQH3HOFH.js +2 -0
  114. package/dist/cdn/{GGSZM7KV.js → FUZ77UGP.js} +6 -4
  115. package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
  116. package/dist/cdn/GFEOVHJK.js +2 -0
  117. package/dist/cdn/HHFNQR6Z.js +2 -0
  118. package/dist/cdn/HIPQ3VRW.js +2 -0
  119. package/dist/cdn/HKSFWTWK.js +14 -0
  120. package/dist/cdn/HMUWQCXU.js +2 -0
  121. package/dist/cdn/IBZ2NEAO.js +2 -0
  122. package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
  123. package/dist/cdn/IHP25JWI.js +99 -0
  124. package/dist/cdn/J6A4AS7E.js +22 -0
  125. package/dist/cdn/J6SZIQJA.js +2 -0
  126. package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
  127. package/dist/cdn/JJJZ7FOM.js +2 -0
  128. package/dist/cdn/JKIESH74.js +2 -0
  129. package/dist/cdn/JO5ETMPS.js +2 -0
  130. package/dist/cdn/K2R6XVK3.js +2 -0
  131. package/dist/cdn/KCU4FWF7.js +2 -0
  132. package/dist/cdn/KITIP6J2.js +2 -0
  133. package/dist/cdn/KWD2ECTM.js +2 -0
  134. package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
  135. package/dist/cdn/LLUGJKAQ.js +2 -0
  136. package/dist/cdn/LPR72QZF.js +36 -0
  137. package/dist/cdn/{DHOVCT6R.js → MKOQJXQQ.js} +1 -1
  138. package/dist/cdn/MWYBF3F3.js +66 -0
  139. package/dist/cdn/NEV6OZN3.js +71 -0
  140. package/dist/cdn/OAKRPM7D.js +2 -0
  141. package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
  142. package/dist/cdn/OL5656NI.js +2 -0
  143. package/dist/cdn/ONQ6JSBJ.js +2 -0
  144. package/dist/cdn/OWTGH34K.js +2 -0
  145. package/dist/cdn/OYSPNIJI.js +156 -0
  146. package/dist/cdn/PEYYWXFE.js +2 -0
  147. package/dist/cdn/PKUDO2RC.js +3 -0
  148. package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
  149. package/dist/cdn/PSYRZMX2.js +2 -0
  150. package/dist/cdn/PUHRBGKB.js +2 -0
  151. package/dist/cdn/Q57QWN5W.js +2 -0
  152. package/dist/cdn/QCFICJ7U.js +3 -0
  153. package/dist/cdn/QNNGPA3Q.js +2 -0
  154. package/dist/cdn/R74ZHFA6.js +2 -0
  155. package/dist/cdn/RBE55SWR.js +2 -0
  156. package/dist/cdn/RHYNE5OE.js +2 -0
  157. package/dist/cdn/RLEHNAIA.js +2 -0
  158. package/dist/cdn/RSNGZQCQ.js +2 -0
  159. package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
  160. package/dist/cdn/SHD6YFSR.js +2 -0
  161. package/dist/cdn/SUYWKYWI.js +22 -0
  162. package/dist/cdn/SZ2QSSB3.js +2 -0
  163. package/dist/cdn/T4RIGOXB.js +2 -0
  164. package/dist/cdn/{3PKJWIC3.js → TMZ6DF22.js} +1 -1
  165. package/dist/cdn/TPULIO6I.js +34 -0
  166. package/dist/cdn/U2D53TAX.js +14 -0
  167. package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
  168. package/dist/cdn/UHZG7SKO.js +2 -0
  169. package/dist/cdn/UZLQALHY.js +2 -0
  170. package/dist/cdn/V52XWEGV.js +11 -0
  171. package/dist/cdn/V6F3HEK7.js +2 -0
  172. package/dist/cdn/V6HOUZPZ.js +2 -0
  173. package/dist/cdn/VAXH6RUQ.js +134 -0
  174. package/dist/cdn/VLLZ2FFU.js +2 -0
  175. package/dist/cdn/VNJMTA6O.js +2 -0
  176. package/dist/cdn/VOKXKU7M.js +56 -0
  177. package/dist/cdn/VXFQANGJ.js +2 -0
  178. package/dist/cdn/W5JPJWMM.js +2 -0
  179. package/dist/cdn/WKTQVBFJ.js +2 -0
  180. package/dist/cdn/WNNMKCKS.js +2 -0
  181. package/dist/cdn/WP7ORLSB.js +6 -0
  182. package/dist/cdn/WR2SQX3J.js +2 -0
  183. package/dist/cdn/X3COUAXY.js +4 -0
  184. package/dist/cdn/Y7XD7ZRD.js +2 -0
  185. package/dist/cdn/YEZ3AMNX.js +2 -0
  186. package/dist/cdn/YLVJA4ZE.js +2 -0
  187. package/dist/cdn/YQSU6IUO.js +2 -0
  188. package/dist/cdn/Z5W4V7RC.js +2 -0
  189. package/dist/cdn/ZLWWWTH4.js +2 -0
  190. package/dist/cdn/ZOEMBHRF.js +2 -0
  191. package/dist/cdn/ZQMBJ6MI.js +2 -0
  192. package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
  193. package/dist/cdn/ZVGUAOXE.js +2 -0
  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/chunks/adapter.js +1299 -2113
  205. package/dist/chunks/arcgisKnowledgeGraph.js +128 -72
  206. package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
  207. package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
  208. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
  209. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
  210. package/dist/chunks/baseAgentState.js +56 -0
  211. package/dist/chunks/converterUtils.js +66 -41
  212. package/dist/chunks/dataExplorationGraph.js +133 -177
  213. package/dist/chunks/data_explore_query_prompt.js +9 -4
  214. package/dist/chunks/fetchAgentContext.js +13 -0
  215. package/dist/chunks/fetchService.js +10 -0
  216. package/dist/chunks/fieldStatistics.js +79 -0
  217. package/dist/chunks/formatFeatureAttributes.js +132 -0
  218. package/dist/chunks/generateLayerDescriptions.js +259 -282
  219. package/dist/chunks/helpGraph.js +35 -25
  220. package/dist/chunks/help_prompt.js +34 -17
  221. package/dist/chunks/index.js +11 -0
  222. package/dist/chunks/intent_prompt.js +16 -0
  223. package/dist/chunks/layerStylingGraph.js +37 -31
  224. package/dist/chunks/mergeWhereClauses.js +15 -0
  225. package/dist/chunks/navigationGraph.js +124 -103
  226. package/dist/chunks/navigation_intent_prompt.js +8 -2
  227. package/dist/chunks/orchestrator.js +298 -139
  228. package/dist/chunks/slottableRequestUtils.js +3 -7
  229. package/dist/chunks/state.js +21 -27
  230. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  231. package/dist/chunks/toolCallResponse.js +14 -10
  232. package/dist/chunks/types.js +59 -0
  233. package/dist/chunks/utils2.js +11 -11
  234. package/dist/components/arcgis-assistant/customElement.d.ts +72 -0
  235. package/dist/components/arcgis-assistant/customElement.js +416 -172
  236. package/dist/components/arcgis-assistant/index.js +2 -3
  237. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  238. package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
  239. package/dist/components/arcgis-assistant-agent/customElement.js +614 -10
  240. package/dist/components/arcgis-assistant-chat/customElement.d.ts +2 -1
  241. package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
  242. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -0
  243. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  244. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +20 -4
  245. package/dist/components/arcgis-assistant-help-agent/customElement.js +29 -7
  246. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -0
  247. package/dist/components/arcgis-assistant-interrupt/customElement.js +17 -14
  248. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +24 -0
  249. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  250. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  251. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +40 -16
  252. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +30 -7
  253. package/dist/components/arcgis-assistant-message/customElement.d.ts +5 -0
  254. package/dist/components/arcgis-assistant-message/customElement.js +29 -26
  255. package/dist/components/arcgis-assistant-message/index.js +2 -0
  256. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  257. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  258. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +7 -0
  259. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -7
  260. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  261. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
  262. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  263. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +18 -4
  264. package/dist/components/arcgis-assistant-speech-input/customElement.js +34 -52
  265. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  266. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
  267. package/dist/components/arcgis-assistant-user-message/customElement.js +15 -10
  268. package/dist/docs/api.json +1 -1
  269. package/dist/docs/docs.json +1 -1
  270. package/dist/docs/vscode.html-custom-data.json +1 -1
  271. package/dist/docs/web-types.json +1 -1
  272. package/dist/loader.js +9 -8
  273. package/dist/oauth-callback.html +1 -1
  274. package/dist/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
  275. package/dist/types/lumina.d.ts +10 -8
  276. package/dist/types/preact.d.ts +10 -8
  277. package/dist/types/react.d.ts +10 -8
  278. package/dist/types/stencil.d.ts +12 -10
  279. package/dist/utils/index.d.ts +8 -8
  280. package/dist/utils/index.js +56 -55
  281. package/package.json +32 -12
  282. package/dist/cdn/2AXF774U.js +0 -2
  283. package/dist/cdn/462JBSEV.js +0 -422
  284. package/dist/cdn/53ZCUPKK.js +0 -22
  285. package/dist/cdn/5QAHYX7Y.js +0 -5
  286. package/dist/cdn/5XRDJL7R.js +0 -14
  287. package/dist/cdn/7BCR6TUO.js +0 -2
  288. package/dist/cdn/7GH7VSB2.js +0 -2
  289. package/dist/cdn/7PLV4QH6.js +0 -2
  290. package/dist/cdn/AXDZBBNL.js +0 -45
  291. package/dist/cdn/DDLZOMUY.js +0 -2
  292. package/dist/cdn/EECZLT6C.js +0 -166
  293. package/dist/cdn/ETRWZ3MS.js +0 -108
  294. package/dist/cdn/F2AHA4GB.js +0 -54
  295. package/dist/cdn/FX5JFRDL.js +0 -2
  296. package/dist/cdn/H7422XUG.js +0 -2
  297. package/dist/cdn/HB5A5R2E.js +0 -2
  298. package/dist/cdn/I6HNBTWY.js +0 -2
  299. package/dist/cdn/I7SRZPVS.js +0 -72
  300. package/dist/cdn/IG6YKZH3.js +0 -3
  301. package/dist/cdn/JVIKKZND.js +0 -3
  302. package/dist/cdn/KMQ3SP4I.js +0 -5
  303. package/dist/cdn/MH5RPXHM.js +0 -2
  304. package/dist/cdn/NVI3I46B.js +0 -2
  305. package/dist/cdn/OAVEHGB6.js +0 -2
  306. package/dist/cdn/OH64RMOR.js +0 -4
  307. package/dist/cdn/P26NON3Z.js +0 -16
  308. package/dist/cdn/QR54T33D.js +0 -2
  309. package/dist/cdn/RVOAPUBN.js +0 -2
  310. package/dist/cdn/S3VPZFWQ.js +0 -36
  311. package/dist/cdn/SXDLXCIM.js +0 -2
  312. package/dist/cdn/TR7RL3IK.js +0 -2
  313. package/dist/cdn/USMDJUFS.js +0 -2
  314. package/dist/cdn/Y333DGV6.js +0 -2
  315. package/dist/cdn/YIMNOUTF.js +0 -2
@@ -0,0 +1,154 @@
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 V from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
5
+ import E from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
6
+ import O from "@arcgis/core/layers/support/FeatureFilter.js";
7
+ import { c as x, m as b } from "../../../../chunks/mergeWhereClauses.js";
8
+ import { g as N, i as v, a as C, d as S } from "../../../../chunks/types.js";
9
+ import { f as R } from "../../../../chunks/fetchAgentContext.js";
10
+ import { f as U } from "../../../../chunks/fetchService.js";
11
+ const W = async (h) => {
12
+ const { targetLayer: r, fieldName: n, statisticType: l, mapView: a, layersAndFieldsRegistry: p, geometryFilter: e } = h, s = a.map?.allLayers.find((i) => i.id === r.layerId);
13
+ if (!s)
14
+ throw new Error(`Layer '${r.layerId}' not found.`);
15
+ const T = await a.whenLayerView(s), o = p.get(r.layerId)?.fieldRegistry.get(n), I = o?.alias;
16
+ if (!o)
17
+ throw new Error(`Field '${n}' not found.`);
18
+ let w, u;
19
+ if (e) {
20
+ const i = await N(e, a);
21
+ if ("error" in i)
22
+ throw new Error(i.error);
23
+ if (!i.geometry)
24
+ throw v(e) ? new Error(`No features found matching: ${e.where}`) : new Error("Failed to create geometry");
25
+ if (v(e)) {
26
+ const g = a.map?.allLayers.find((f) => f.id === e.layerId);
27
+ w = {
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) && (w = {
36
+ point: e.point,
37
+ distance: e.distance,
38
+ units: e.units,
39
+ applied: !0
40
+ });
41
+ u = new O({
42
+ geometry: i.geometry,
43
+ distance: e.distance,
44
+ units: e.units,
45
+ spatialRelationship: "intersects"
46
+ });
47
+ }
48
+ const y = x(T, [n], !1);
49
+ let d = null, m = null;
50
+ const F = 10;
51
+ if (o.type !== "geometry" && o.type !== "oid" && o.type !== "global-id")
52
+ try {
53
+ const i = {
54
+ layer: s,
55
+ useFeaturesInView: y,
56
+ view: y ? a : void 0,
57
+ field: n,
58
+ sqlWhere: b(s.definitionExpression, r.where),
59
+ ...u && { filter: u },
60
+ outStatisticTypes: { include: [l] }
61
+ };
62
+ d = await V(i);
63
+ const g = ["string", "small-integer", "integer"], f = o.domain?.type === "coded-value" ? o.domain : null;
64
+ (g.includes(o.type) || f) && (m = (await E({
65
+ layer: s,
66
+ useFeaturesInView: y,
67
+ view: y ? a : void 0,
68
+ field: n,
69
+ sqlWhere: b(s.definitionExpression, r.where),
70
+ ...u && { filter: u }
71
+ })).uniqueValueInfos.sort((c, q) => q.count - c.count).slice(0, F)), 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 (i) {
76
+ console.error("Statistics error:", i);
77
+ }
78
+ return {
79
+ tool: "getStatistics",
80
+ layerName: s.title ?? r.layerId,
81
+ summary: `${l} = ${typeof d?.[l] == "number" ? d[l] : "N/A"}`,
82
+ details: {
83
+ fieldName: n,
84
+ fieldAlias: I,
85
+ statisticType: l,
86
+ statistic: d?.[l] ?? null,
87
+ summaryStatistics: d,
88
+ uniqueValues: m,
89
+ where: r.where,
90
+ spatialFilterInfo: w
91
+ }
92
+ };
93
+ };
94
+ async function j({
95
+ targetLayer: h,
96
+ fieldName: r,
97
+ statisticType: n,
98
+ geometryFilter: l
99
+ }, a) {
100
+ const p = U(a, "layersAndFieldsRegistry"), { mapView: e } = R(a, ["mapView"]), s = await W({
101
+ targetLayer: h,
102
+ fieldName: r,
103
+ statisticType: n,
104
+ mapView: e,
105
+ layersAndFieldsRegistry: p,
106
+ geometryFilter: l
107
+ });
108
+ return JSON.stringify(s, null, 2);
109
+ }
110
+ const A = t.object({
111
+ layerId: t.string().describe("The layerId of the layer containing the geometry by which to filter."),
112
+ where: t.string().describe("The SQL-92 where clause representing the features from which to filter."),
113
+ distance: t.number().optional().describe("The buffer distance around the geometry."),
114
+ units: S.optional().describe("The units for the distance buffer.")
115
+ }), G = t.object({
116
+ point: t.object({
117
+ x: t.number().describe("X coordinate (longitude) from navigation result"),
118
+ y: t.number().describe("Y coordinate (latitude) from navigation result"),
119
+ spatialReference: t.object({
120
+ wkid: t.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
121
+ }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
122
+ }).describe("Point coordinates from a previous navigation/geocoding result"),
123
+ distance: t.number().optional().describe("Optional buffer distance around the point."),
124
+ units: S.optional().describe("The units for the distance buffer.")
125
+ }), D = t.object({
126
+ targetLayer: t.object({
127
+ layerId: t.string().describe("The layerId of the layer containing the field from which to get a value."),
128
+ where: t.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
129
+ }),
130
+ geometryFilter: t.union([A, G]).optional().describe(
131
+ "Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
132
+ ),
133
+ fieldName: t.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
134
+ statisticType: t.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
135
+ }), M = L(j, {
136
+ name: "getStatistics",
137
+ 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.
138
+
139
+ USE THIS TOOL FOR:
140
+ - "What is the average/maximum/minimum/total [field]?" — aggregate computations
141
+ - "Most common/frequent value of [field]?" — frequency analysis
142
+ - Questions requiring a mathematical aggregation across many features
143
+
144
+ DO NOT USE FOR:
145
+ - "How many features match X?" — use queryFeatures instead (it returns totalCount)
146
+ - "Show / list / find features" — use queryFeatures instead
147
+ - Simple counts of features matching a condition — use queryFeatures instead
148
+
149
+ 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.`,
150
+ schema: D
151
+ });
152
+ export {
153
+ M as getStatisticsTool
154
+ };
@@ -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,141 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { tool as T } from "@langchain/core/tools";
3
+ import e from "zod";
4
+ import S 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 } from "../../../../chunks/types.js";
9
+ import { f as N } from "../../../../chunks/fetchAgentContext.js";
10
+ const k = (i) => i.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), x = async (i, t, a, s, l) => {
11
+ const n = a.map?.allLayers.find((o) => o.id === i.layerId), d = await a.whenLayerView(n), c = n.title ?? i.layerId;
12
+ let u;
13
+ if (s) {
14
+ const o = await q(s, a);
15
+ if ("error" in o)
16
+ return {
17
+ tool: "getTopFeatures",
18
+ layerName: c,
19
+ summary: "Geometry lookup failed",
20
+ details: { error: o.error }
21
+ };
22
+ if (!o.geometry)
23
+ return {
24
+ tool: "getTopFeatures",
25
+ layerName: c,
26
+ summary: "No features found for geometry filter",
27
+ details: {
28
+ error: `No features found matching: ${"where" in s ? s.where : "unknown criteria"}`
29
+ }
30
+ };
31
+ u = o.geometry;
32
+ } else l && (u = a.extent.clone());
33
+ const h = t.groupByFields && t.groupByFields.length > 0, f = n.objectIdField, p = i.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...i.outFields, f])];
34
+ try {
35
+ let o;
36
+ if (h) {
37
+ const r = new S({
38
+ where: i.where || "1=1",
39
+ outFields: p,
40
+ orderByFields: i.orderByFields,
41
+ geometry: u,
42
+ spatialRelationship: u ? "intersects" : void 0,
43
+ distance: s?.distance,
44
+ units: s?.units,
45
+ topFilter: new B({
46
+ topCount: t.topCount,
47
+ groupByFields: t.groupByFields,
48
+ orderByFields: t.orderByFields
49
+ })
50
+ });
51
+ o = await n.queryTopFeatures(r);
52
+ } else {
53
+ const r = n.createQuery();
54
+ r.where = C(n.definitionExpression, i.where || "1=1"), r.outFields = p.length ? p : ["*"], r.orderByFields = t.orderByFields, r.returnGeometry = !1, r.num = t.topCount, u && (r.geometry = u, r.spatialRelationship = "intersects"), s?.distance && (r.distance = s.distance), s?.units && (r.units = s.units), r.outSpatialReference = a.spatialReference;
55
+ const m = [
56
+ .../* @__PURE__ */ new Set([...i.outFields, ...k(t.orderByFields)])
57
+ ], w = v(d, m, l ?? !1);
58
+ try {
59
+ o = w ? await d.queryFeatures(r) : await n.queryFeatures(r);
60
+ } catch (F) {
61
+ console.warn("Client-side query failed, falling back to server:", F), o = await n.queryFeatures(r);
62
+ }
63
+ }
64
+ const g = o.features.map((r) => r.attributes[f]), { attributes: b } = I(n, o, a.timeZone);
65
+ return {
66
+ tool: "getTopFeatures",
67
+ layerName: c,
68
+ summary: `Top ${t.topCount} features extracted`,
69
+ details: {
70
+ topCount: t.topCount,
71
+ attributes: b,
72
+ objectIds: g,
73
+ objectIdField: f,
74
+ where: i.where,
75
+ orderByFields: t.orderByFields,
76
+ ...h && { groupByFields: t.groupByFields }
77
+ }
78
+ };
79
+ } catch (o) {
80
+ return {
81
+ tool: "getTopFeatures",
82
+ layerName: c,
83
+ summary: "Query failed",
84
+ details: { error: o instanceof Error ? o.message : String(o) }
85
+ };
86
+ }
87
+ }, j = async ({
88
+ targetLayer: i,
89
+ topFilter: t,
90
+ geometryFilter: a,
91
+ useCurrentExtent: s
92
+ }, l) => {
93
+ const { mapView: n } = N(l, ["mapView"]), d = await x(i, t, n, a, s);
94
+ return JSON.stringify(d, null, 2);
95
+ }, G = e.object({
96
+ layerId: e.string().describe("The layerId of the layer containing the geometry by which to filter."),
97
+ where: e.string().describe("The SQL-92 where clause representing the features from which to filter."),
98
+ distance: e.number().optional().describe("The buffer distance around the geometry."),
99
+ units: y.optional().describe("The units for the distance buffer.")
100
+ }), R = e.object({
101
+ point: e.object({
102
+ x: e.number().describe("X coordinate (longitude) from navigation result"),
103
+ y: e.number().describe("Y coordinate (latitude) from navigation result"),
104
+ spatialReference: e.object({
105
+ wkid: e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
106
+ }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
107
+ }).describe("Point coordinates from a previous navigation/geocoding result"),
108
+ distance: e.number().optional().describe("Optional buffer distance around the point."),
109
+ units: y.optional().describe("The units for the distance buffer.")
110
+ }), Q = e.object({
111
+ targetLayer: e.object({
112
+ layerId: e.string().describe("The layerId of the layer containing the field from which to get a value."),
113
+ where: e.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
114
+ orderByFields: e.array(e.string().describe("The field(s) and order for which to sort the resulting features.")),
115
+ outFields: e.array(
116
+ e.string().describe(
117
+ '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 ("*").'
118
+ ).default("*")
119
+ )
120
+ }),
121
+ geometryFilter: e.union([G, R]).optional().describe(
122
+ "Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
123
+ ),
124
+ topFilter: e.object({
125
+ topCount: e.number().describe("Number of top features to return per group."),
126
+ orderByFields: e.array(
127
+ e.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
128
+ ),
129
+ groupByFields: e.array(e.string().describe("Field(s) to group results by. Returns top N per group."))
130
+ }).required(),
131
+ useCurrentExtent: e.boolean().optional().describe(
132
+ "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)."
133
+ )
134
+ }), z = T(j, {
135
+ name: "getTopFeatures",
136
+ 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.',
137
+ schema: Q
138
+ });
139
+ export {
140
+ z as getTopFeaturesTool
141
+ };
@@ -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,127 @@
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 O, i as S, a as F, d as I } from "../../../../chunks/types.js";
5
+ import { c as j, m as N } from "../../../../chunks/mergeWhereClauses.js";
6
+ import t from "zod";
7
+ import { f as R } from "../../../../chunks/fetchAgentContext.js";
8
+ const p = 25, x = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map((r) => r.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((r) => !!r), W = async (i, r, e, f) => {
9
+ const a = r.map?.allLayers.find((u) => u.id === i.layerId), l = await r.whenLayerView(a), y = a.title ?? i.layerId;
10
+ let c;
11
+ if (e) {
12
+ const u = await O(e, r);
13
+ if ("error" in u) {
14
+ const s = { error: u.error };
15
+ if (S(e)) {
16
+ const d = r.map?.allLayers.find((m) => m.id === e.layerId);
17
+ s.geometryLayerName = d?.title ?? d?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
18
+ } else F(e) && (s.point = e.point);
19
+ return {
20
+ tool: "queryFeatures",
21
+ layerName: y,
22
+ summary: "Geometry lookup failed",
23
+ details: s
24
+ };
25
+ }
26
+ if (!u.geometry) {
27
+ const s = {};
28
+ if (S(e)) {
29
+ const d = r.map?.allLayers.find((m) => m.id === e.layerId);
30
+ s.error = `No features found matching: ${e.where}`, s.geometryLayerName = d?.title ?? d?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
31
+ } else F(e) && (s.error = "Failed to create point geometry", s.point = e.point);
32
+ return {
33
+ tool: "queryFeatures",
34
+ layerName: y,
35
+ summary: "No features found for geometry filter",
36
+ details: s
37
+ };
38
+ }
39
+ c = u.geometry;
40
+ } else f && (c = r.extent.clone());
41
+ const T = [
42
+ .../* @__PURE__ */ new Set([...i.outFields, ...x(i.orderByFields)])
43
+ ], b = j(l, T, f ?? !1), w = a.objectIdField, o = a.createQuery();
44
+ o.where = N(a.definitionExpression, i.where || "1=1"), o.outFields = i.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...i.outFields, w])], o.orderByFields = i.orderByFields, c && (o.geometry = c, o.spatialRelationship = "intersects"), e?.distance && (o.distance = e.distance), e?.units && (o.units = e.units), o.outSpatialReference = r.spatialReference;
45
+ let n, h;
46
+ try {
47
+ n = b ? await l.queryFeatureCount(o) : await a.queryFeatureCount(o), n > 0 && n <= p && (h = b ? await l.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 && (h = await a.queryFeatures(o));
50
+ }
51
+ const { objectIds: g, attributes: q } = h ? C(a, h, r.timeZone) : { objectIds: void 0, attributes: void 0 };
52
+ return {
53
+ tool: "queryFeatures",
54
+ layerName: y,
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
+ ...q && { attributes: q },
63
+ ...n > p && {
64
+ note: `${n} features found.`
65
+ }
66
+ }
67
+ };
68
+ };
69
+ async function B({
70
+ targetLayer: i,
71
+ geometryFilter: r,
72
+ useCurrentExtent: e
73
+ }, f) {
74
+ const { mapView: a } = R(f, ["mapView"]), l = await W(i, a, r, e);
75
+ return JSON.stringify(l, null, 2);
76
+ }
77
+ const G = t.object({
78
+ layerId: t.string().describe("The layerId of the layer containing the geometry by which to filter."),
79
+ where: t.string().describe("The SQL-92 where clause representing the features from which to filter."),
80
+ distance: t.number().optional().describe("The buffer distance around the geometry."),
81
+ units: I.optional().describe("The units for the distance buffer.")
82
+ }), k = t.object({
83
+ point: t.object({
84
+ x: t.number().describe("X coordinate (longitude) from navigation result"),
85
+ y: t.number().describe("Y coordinate (latitude) from navigation result"),
86
+ spatialReference: t.object({
87
+ wkid: t.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
88
+ }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
89
+ }).describe("Point coordinates from a previous navigation/geocoding result"),
90
+ distance: t.number().optional().describe("Optional buffer distance around the point."),
91
+ units: I.optional().describe("The units for the distance buffer.")
92
+ }), L = t.object({
93
+ targetLayer: t.object({
94
+ layerId: t.string().describe("The layerId of the layer containing the field from which to get a value."),
95
+ where: t.string().describe(
96
+ "SQL-92 where clause. IMPORTANT: When using geometryFilter.point 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."
97
+ ),
98
+ orderByFields: t.array(t.string().describe("The field(s) and order for which to sort the resulting features.")),
99
+ outFields: t.array(
100
+ t.string().describe(
101
+ '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 ("*").'
102
+ ).default("*")
103
+ )
104
+ }),
105
+ geometryFilter: t.union([G, k]).optional().describe(
106
+ "Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
107
+ ),
108
+ useCurrentExtent: t.boolean().optional().describe(
109
+ "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)."
110
+ )
111
+ }), P = v(B, {
112
+ name: "queryFeatures",
113
+ description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
114
+
115
+ USE THIS TOOL FOR:
116
+ - "Show / display / list features where..." — finding and listing features
117
+ - "How many X are Y?" — counting features that match a condition
118
+ - "Which features..." / "Find features..." — identifying specific features
119
+ - Spatial queries — finding features near/within/intersecting other features
120
+ - Any question where the user wants to SEE or COUNT matching features
121
+
122
+ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
123
+ schema: L
124
+ });
125
+ export {
126
+ P as queryFeaturesTool
127
+ };
@@ -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;
@@ -0,0 +1,38 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { tool as y } from "@langchain/core/tools";
3
+ import i from "zod";
4
+ import { f as n } from "../../../../chunks/fetchService.js";
5
+ const m = 0.7;
6
+ async function h(r) {
7
+ const { query: e, layerSearch: a, layersAndFieldsRegistry: l, embeddingCache: o, minScore: c = m } = r;
8
+ return (await a.searchLayers({ text: e, minScore: c, embeddingCache: o })).map(({ id: s, score: d }) => {
9
+ const t = l.get(s)?.layerItem;
10
+ return {
11
+ layerId: s,
12
+ score: d,
13
+ name: t?.name ?? void 0,
14
+ title: t?.title,
15
+ description: t?.description
16
+ };
17
+ });
18
+ }
19
+ const f = i.object({
20
+ query: i.string().describe("A concise semantic description of the layers relevant to the user's task.")
21
+ });
22
+ async function p({ query: r }, e) {
23
+ const a = await h({
24
+ query: r,
25
+ layerSearch: n(e, "layerSearch"),
26
+ layersAndFieldsRegistry: n(e, "layersAndFieldsRegistry"),
27
+ embeddingCache: n(e, "embeddingCache")
28
+ });
29
+ return JSON.stringify({ layers: a }, null, 2);
30
+ }
31
+ const S = y(p, {
32
+ name: "findRelevantLayers",
33
+ description: "Finds map layers relevant to a task and returns their layer IDs, similarity scores, names, titles, and descriptions. Call this before finding fields or querying data when layer IDs are not already known.",
34
+ schema: f
35
+ });
36
+ export {
37
+ S as findRelevantLayersTool
38
+ };
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a}from"./Y7XD7ZRD.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{a as goToBookmarkTool};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{b as c}from"./V6F3HEK7.js";import"./RLEHNAIA.js";import{g as i,h as s,n as r,v as a,z as p}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var l=i`:host{display:block;max-width:100%}.group{max-width:100%}.prompt{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-style:normal;cursor:pointer;font-weight:var(--calcite-font-weight-regular)}calcite-chip{max-width:100%}`,e=class extends a{constructor(){super(...arguments),this._messages=c({blocking:!0}),this.prompts=[],this.arcgisPromptSelect=r()}static{this.properties={label:1,prompts:0}}static{this.styles=l}_emitPromptSelect(t){this.arcgisPromptSelect.emit({prompt:t})}render(){return this.prompts.length?s`<calcite-chip-group class="group" .label=${this.label??this._messages.suggestedPromptsLabel}>${this.prompts.map(t=>s`<calcite-chip .value=${t} .label=${t} appearance=outline-fill kind=brand @calciteChipSelect=${()=>this._emitPromptSelect(t)}><div class="prompt">${t}</div></calcite-chip>`)}</calcite-chip-group>`:null}};p("arcgis-assistant-suggested-prompts",e);export{e as ArcgisAssistantSuggestedPrompts};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ var n=(r,e,a)=>{if(!(a?r.hasAllFeaturesInView:r.hasAllFeatures))return!1;let l=new Set((r.availableFields??[]).map(t=>t.toLowerCase()));return l.has("*")?!0:e.every(t=>l.has(t.toLowerCase()))};function s(r,e){let a=r??"";return e!=null&&e&&(a=a?`(${a}) AND (${e})`:e),a||null}export{n as a,s as b};
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{b as r}from"./OAVEHGB6.js";function s(e,n){return n?typeof n=="string"?l(e,n)??null:n:r(e,"arcgis-map")??null}function c(e,n){return n?typeof n=="string"?l(e,n)??null:n:r(e,"arcgis-link-chart")??r(e,"arcgis-map")??null}function l(e,n){let i=n.includes("#")||n.includes(".")||n.includes("["),t=e.getRootNode();return(i?void 0:t.querySelector(`#${n}`))??t.querySelector(n)??void 0}export{s as a,c as b};
2
+ import{c as r}from"./RLEHNAIA.js";function s(e,n){return n?typeof n=="string"?l(e,n)??null:n:r(e,"arcgis-map")??null}function c(e,n){return n?typeof n=="string"?l(e,n)??null:n:r(e,"arcgis-link-chart")??r(e,"arcgis-map")??null}function l(e,n){let i=n.includes("#")||n.includes(".")||n.includes("["),t=e.getRootNode();return(i?void 0:t.querySelector(`#${n}`))??t.querySelector(n)??void 0}export{s as a,c as b};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ function o(e,n){return`block-${e}-${n}`}export{o as a};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import n from"./FUZ77UGP.js";import m from"./OYSPNIJI.js";import{c as s,d as p}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import i from"./OAKRPM7D.js";import h from"./V52XWEGV.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as e,z as o}from"./X3COUAXY.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,{fetchKnowledgeGraph:n},,,,,,,,,,,,,m])=>{var r=class extends e{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1,serviceUrl:3,context:0}}#i;#r;#t;#e;get serviceUrl(){return this.#r}set serviceUrl(t){this.#r=t}async getContext(){let t=this.context?{...this.context,knowledgeGraph:void 0,view:void 0}:{};if(this.#i)return{...t,view:this.#i};if(this.#t)try{let i=await this.#t;return{...t,knowledgeGraph:i}}catch(i){console.error("Failed to load knowledge graph via service URL:",i)}if(!this.context?.knowledgeGraph&&!this.context?.view)throw new Error("arcgis-assistant-knowledge-agent requires either a knowledgeGraph or view in context, and neither were provided");return this.context}willUpdate(t){t.has("serviceUrl")&&this.serviceUrl?this.#t=n(this.serviceUrl):this.#t=void 0}load(){this.#i=p(this)??void 0,this.#e=s(this)}disconnectedCallback(){this.#e?.unregister(this.agent.id),super.disconnectedCallback()}};o("arcgis-assistant-knowledge-agent",r);return r},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,f,g,h,i,j,k,l,m,n)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./VNJMTA6O.js";import{e as l}from"./ZLWWWTH4.js";import"./7M6VKBTK.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:u},{d:w}])=>{var f=Object.defineProperty,m=Object.getOwnPropertyDescriptor,c=(o,r,n,s)=>{for(var e=s>1?void 0:s?m(r,n):r,a=o.length-1,t;a>=0;a--)(t=o[a])&&(e=(s?t(r,n,e):t(e))||e);return s&&e&&f(r,n,e),e},p=class extends w{constructor(o){super(o)}getAgents(){return this.workflow.getAgents()}generate(){let o=this.workflow.generate(),r=o.workspace,n=o.createGraph().compile(),{decideContinue:s}=this,e={[i]:async(t,d)=>await n.invoke(t,d)},a=[{from:i,decide:async(t,d)=>await Promise.resolve(s(t,d))?i:void 0}];return{workspace:r,createGraph:()=>l(e,a,r,{entryNode:i})}}buildEdges(){throw new Error("LoopWorkflow overrides generate(); buildEdges should not be called.")}getEntryNode(){return i}isTerminalAgent(){return!0}};c([g()],p.prototype,"workflow",2);c([g()],p.prototype,"decideContinue",2);p=c([u("LoopWorkflow")],p);var i="__loop_body";return p},"core/accessorSupport/decorators",a)