@arcgis/ai-components 5.2.0-next.8 → 5.2.0-next.84

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 (313) 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 +3 -2
  6. package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
  7. package/dist/agent-utils/index.d.ts +177 -0
  8. package/dist/agent-utils/index.js +167 -0
  9. package/dist/agent-utils/middlewares/trace.d.ts +2 -0
  10. package/dist/agent-utils/middlewares/trace.js +25 -33
  11. package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
  12. package/dist/agent-utils/types.d.ts +37 -8
  13. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
  14. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
  15. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
  16. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
  17. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
  18. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
  19. package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
  20. package/dist/agentic-workflow/Edge.d.ts +16 -0
  21. package/dist/agentic-workflow/WebAgent.d.ts +39 -0
  22. package/dist/agentic-workflow/jsonTypes.d.ts +183 -0
  23. package/dist/agentic-workflow/nodes/AgentNode.d.ts +27 -0
  24. package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
  25. package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
  26. package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
  27. package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
  28. package/dist/agentic-workflow/types.d.ts +29 -0
  29. package/dist/agents/tools/filter/clearFilters/adapter.d.ts +8 -0
  30. package/dist/agents/tools/filter/clearFilters/adapter.js +22 -0
  31. package/dist/agents/tools/filter/resetMap/adapter.d.ts +8 -0
  32. package/dist/agents/tools/filter/resetMap/adapter.js +22 -0
  33. package/dist/agents/tools/filter/setFeatureEffect/adapter.d.ts +8 -0
  34. package/dist/agents/tools/filter/setFeatureEffect/adapter.js +109 -0
  35. package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
  36. package/dist/agents/tools/help/listFields/adapter.js +30 -0
  37. package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
  38. package/dist/agents/tools/navigation/goToAddress/adapter.js +52 -0
  39. package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
  40. package/dist/agents/tools/navigation/goToBookmark/adapter.js +30 -0
  41. package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
  42. package/dist/agents/tools/navigation/goToFeatures/adapter.js +50 -0
  43. package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
  44. package/dist/agents/tools/navigation/goToFullExtent/adapter.js +27 -0
  45. package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
  46. package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +24 -0
  47. package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
  48. package/dist/agents/tools/navigation/goToLayer/adapter.js +26 -0
  49. package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
  50. package/dist/agents/tools/navigation/goToScale/adapter.js +21 -0
  51. package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
  52. package/dist/agents/tools/navigation/goToViewpoint/adapter.js +42 -0
  53. package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
  54. package/dist/agents/tools/navigation/goToZoom/adapter.js +21 -0
  55. package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
  56. package/dist/agents/tools/query/getAttribute/adapter.js +40 -0
  57. package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
  58. package/dist/agents/tools/query/getStatistics/adapter.js +154 -0
  59. package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
  60. package/dist/agents/tools/query/getTopFeatures/adapter.js +141 -0
  61. package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
  62. package/dist/agents/tools/query/queryFeatures/adapter.js +127 -0
  63. package/dist/agents/tools/search/findRelevantFields/adapter.d.ts +8 -0
  64. package/dist/agents/tools/search/findRelevantFields/adapter.js +57 -0
  65. package/dist/agents/tools/search/findRelevantLayers/adapter.d.ts +8 -0
  66. package/dist/agents/tools/search/findRelevantLayers/adapter.js +38 -0
  67. package/dist/cdn/2EY3BQQX.js +2 -0
  68. package/dist/cdn/34O57OGV.js +2 -0
  69. package/dist/cdn/3POGAH2X.js +2 -0
  70. package/dist/cdn/3SEKXQVK.js +9 -0
  71. package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
  72. package/dist/cdn/434TAA3J.js +2 -0
  73. package/dist/cdn/4HDDRBIY.js +2 -0
  74. package/dist/cdn/4NJ2FF7H.js +2 -0
  75. package/dist/cdn/4OGR5QKS.js +2 -0
  76. package/dist/cdn/4QGVOLW6.js +22 -0
  77. package/dist/cdn/4WIDLQUH.js +2 -0
  78. package/dist/cdn/5WYRJMBW.js +2 -0
  79. package/dist/cdn/5X7EG7D2.js +2 -0
  80. package/dist/cdn/5ZFUGNRN.js +2 -0
  81. package/dist/cdn/6HF36IKA.js +2 -0
  82. package/dist/cdn/6KFMRBAA.js +2 -0
  83. package/dist/cdn/6NHYXISD.js +2 -0
  84. package/dist/cdn/6U4GTCLJ.js +66 -0
  85. package/dist/cdn/7BCQMK6D.js +2 -0
  86. package/dist/cdn/7FY7WAA5.js +2 -0
  87. package/dist/cdn/7GMCLVSZ.js +2 -0
  88. package/dist/cdn/7M6VKBTK.js +6 -0
  89. package/dist/cdn/{GGSZM7KV.js → 7Q5EESAR.js} +6 -4
  90. package/dist/cdn/7SRLZQVC.js +5 -0
  91. package/dist/cdn/7TXR75RG.js +2 -0
  92. package/dist/cdn/7V6OSTFC.js +2 -0
  93. package/dist/cdn/7VAQUCBU.js +9 -0
  94. package/dist/cdn/7ZFAFKJT.js +2 -0
  95. package/dist/cdn/ACJTJLZN.js +2 -0
  96. package/dist/cdn/AI6DYOKR.js +181 -0
  97. package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
  98. package/dist/cdn/APFZY4PI.js +2 -0
  99. package/dist/cdn/AT4XVTJR.js +44 -0
  100. package/dist/cdn/AZ5G7YZH.js +3 -0
  101. package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
  102. package/dist/cdn/BM3WFHJG.js +2 -0
  103. package/dist/cdn/{DHOVCT6R.js → BPCBE7J6.js} +1 -1
  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/CP5BVGJU.js +2 -0
  108. package/dist/cdn/CZM4URK7.js +2 -0
  109. package/dist/cdn/DPALM2OW.js +2 -0
  110. package/dist/cdn/E7JZ7GUW.js +18 -0
  111. package/dist/cdn/EMLOVMD4.js +2 -0
  112. package/dist/cdn/EWLXNGKH.js +208 -0
  113. package/dist/cdn/F2J6BMMX.js +36 -0
  114. package/dist/cdn/FAR3DFFK.js +2 -0
  115. package/dist/cdn/FDOMMK2M.js +2 -0
  116. package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
  117. package/dist/cdn/GFEOVHJK.js +2 -0
  118. package/dist/cdn/HDM2D2GD.js +2 -0
  119. package/dist/cdn/HHFNQR6Z.js +2 -0
  120. package/dist/cdn/HMUWQCXU.js +2 -0
  121. package/dist/cdn/I3ONG4AX.js +2 -0
  122. package/dist/cdn/IBZ2NEAO.js +2 -0
  123. package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
  124. package/dist/cdn/IFJM5XEQ.js +2 -0
  125. package/dist/cdn/IHP25JWI.js +99 -0
  126. package/dist/cdn/J6A4AS7E.js +22 -0
  127. package/dist/cdn/J6SZIQJA.js +2 -0
  128. package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
  129. package/dist/cdn/JKIESH74.js +2 -0
  130. package/dist/cdn/JO5ETMPS.js +2 -0
  131. package/dist/cdn/JWIE3YK3.js +2 -0
  132. package/dist/cdn/K2R6XVK3.js +2 -0
  133. package/dist/cdn/KITIP6J2.js +2 -0
  134. package/dist/cdn/KPO4XX6J.js +2 -0
  135. package/dist/cdn/KWD2ECTM.js +2 -0
  136. package/dist/cdn/L7XTRDFM.js +3 -0
  137. package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
  138. package/dist/cdn/LLUGJKAQ.js +2 -0
  139. package/dist/cdn/LMPNXXTQ.js +2 -0
  140. package/dist/cdn/LYKCYBGB.js +2 -0
  141. package/dist/cdn/{3PKJWIC3.js → M2L5R4LA.js} +1 -1
  142. package/dist/cdn/{V2P4AIGG.js → M4URMXDS.js} +1 -1
  143. package/dist/cdn/MDAKBX7N.js +2 -0
  144. package/dist/cdn/MWYBF3F3.js +66 -0
  145. package/dist/cdn/NEV6OZN3.js +71 -0
  146. package/dist/cdn/NQDOAPE3.js +2 -0
  147. package/dist/cdn/OAKRPM7D.js +2 -0
  148. package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
  149. package/dist/cdn/ONMNQBPO.js +2 -0
  150. package/dist/cdn/ONQ6JSBJ.js +2 -0
  151. package/dist/cdn/OWTGH34K.js +2 -0
  152. package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
  153. package/dist/cdn/PSYRZMX2.js +2 -0
  154. package/dist/cdn/PUHRBGKB.js +2 -0
  155. package/dist/cdn/Q57QWN5W.js +2 -0
  156. package/dist/cdn/QNNGPA3Q.js +2 -0
  157. package/dist/cdn/R74ZHFA6.js +2 -0
  158. package/dist/cdn/RBE55SWR.js +2 -0
  159. package/dist/cdn/RHYNE5OE.js +2 -0
  160. package/dist/cdn/RLEHNAIA.js +2 -0
  161. package/dist/cdn/RV55GABG.js +2 -0
  162. package/dist/cdn/RWWOOC7S.js +2 -0
  163. package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
  164. package/dist/cdn/T4RIGOXB.js +2 -0
  165. package/dist/cdn/TACBKKBI.js +2 -0
  166. package/dist/cdn/TMJMDCSA.js +4 -0
  167. package/dist/cdn/TPULIO6I.js +34 -0
  168. package/dist/cdn/U2D53TAX.js +14 -0
  169. package/dist/cdn/UEEH5ZQK.js +156 -0
  170. package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
  171. package/dist/cdn/UHZG7SKO.js +2 -0
  172. package/dist/cdn/UZLQALHY.js +2 -0
  173. package/dist/cdn/V52XWEGV.js +11 -0
  174. package/dist/cdn/V6HOUZPZ.js +2 -0
  175. package/dist/cdn/VAXH6RUQ.js +134 -0
  176. package/dist/cdn/VLLZ2FFU.js +2 -0
  177. package/dist/cdn/VNJMTA6O.js +2 -0
  178. package/dist/cdn/VOKXKU7M.js +56 -0
  179. package/dist/cdn/VXFQANGJ.js +2 -0
  180. package/dist/cdn/WKTQVBFJ.js +2 -0
  181. package/dist/cdn/WLH47YFC.js +14 -0
  182. package/dist/cdn/WP7ORLSB.js +6 -0
  183. package/dist/cdn/Y7XD7ZRD.js +2 -0
  184. package/dist/cdn/YEZ3AMNX.js +2 -0
  185. package/dist/cdn/YLVJA4ZE.js +2 -0
  186. package/dist/cdn/Z5W4V7RC.js +2 -0
  187. package/dist/cdn/ZLWWWTH4.js +2 -0
  188. package/dist/cdn/ZOEMBHRF.js +2 -0
  189. package/dist/cdn/ZQMBJ6MI.js +2 -0
  190. package/dist/cdn/ZRESBCJL.js +2 -0
  191. package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
  192. package/dist/cdn/ZUNLFO6M.js +3 -0
  193. package/dist/cdn/agent-utils/index.js +2 -0
  194. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  195. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  196. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  197. package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
  198. package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
  199. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.en.json +1 -0
  200. package/dist/cdn/assets/assistant-message/t9n/messages.en.json +1 -0
  201. package/dist/cdn/assets/assistant-message-loading/t9n/messages.en.json +1 -0
  202. package/dist/cdn/index.js +1 -1
  203. package/dist/chunks/adapter.js +1294 -2112
  204. package/dist/chunks/arcgisKnowledgeGraph.js +127 -72
  205. package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
  206. package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
  207. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
  208. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
  209. package/dist/chunks/baseAgentState.js +56 -0
  210. package/dist/chunks/converterUtils.js +66 -41
  211. package/dist/chunks/dataExplorationGraph.js +132 -177
  212. package/dist/chunks/data_explore_query_prompt.js +9 -4
  213. package/dist/chunks/fetchAgentContext.js +13 -0
  214. package/dist/chunks/fetchService.js +10 -0
  215. package/dist/chunks/fieldStatistics.js +79 -0
  216. package/dist/chunks/formatFeatureAttributes.js +132 -0
  217. package/dist/chunks/generateLayerDescriptions.js +259 -282
  218. package/dist/chunks/helpGraph.js +34 -25
  219. package/dist/chunks/help_prompt.js +34 -17
  220. package/dist/chunks/index.js +11 -0
  221. package/dist/chunks/intent_prompt.js +16 -0
  222. package/dist/chunks/layerStylingGraph.js +36 -31
  223. package/dist/chunks/mergeWhereClauses.js +15 -0
  224. package/dist/chunks/navigationGraph.js +123 -103
  225. package/dist/chunks/navigation_intent_prompt.js +8 -2
  226. package/dist/chunks/orchestrator.js +205 -175
  227. package/dist/chunks/slottableRequestUtils.js +3 -7
  228. package/dist/chunks/state.js +21 -27
  229. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  230. package/dist/chunks/toolCallResponse.js +13 -10
  231. package/dist/chunks/types.js +59 -0
  232. package/dist/chunks/utils2.js +11 -11
  233. package/dist/components/arcgis-assistant/customElement.d.ts +56 -0
  234. package/dist/components/arcgis-assistant/customElement.js +387 -155
  235. package/dist/components/arcgis-assistant/index.js +2 -3
  236. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  237. package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
  238. package/dist/components/arcgis-assistant-agent/customElement.js +608 -10
  239. package/dist/components/arcgis-assistant-chat/customElement.d.ts +2 -1
  240. package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
  241. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -0
  242. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  243. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +19 -3
  244. package/dist/components/arcgis-assistant-help-agent/customElement.js +28 -6
  245. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -0
  246. package/dist/components/arcgis-assistant-interrupt/customElement.js +17 -14
  247. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +24 -0
  248. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  249. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  250. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +39 -16
  251. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +29 -6
  252. package/dist/components/arcgis-assistant-message/customElement.d.ts +5 -0
  253. package/dist/components/arcgis-assistant-message/customElement.js +29 -26
  254. package/dist/components/arcgis-assistant-message/index.js +2 -0
  255. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  256. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  257. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +7 -0
  258. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -7
  259. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  260. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
  261. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  262. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +17 -3
  263. package/dist/components/arcgis-assistant-speech-input/customElement.js +29 -46
  264. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  265. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
  266. package/dist/components/arcgis-assistant-user-message/customElement.js +15 -10
  267. package/dist/docs/api.json +1 -1
  268. package/dist/docs/docs.json +1 -1
  269. package/dist/docs/vscode.html-custom-data.json +1 -1
  270. package/dist/docs/web-types.json +1 -1
  271. package/dist/loader.js +9 -8
  272. package/dist/oauth-callback.html +1 -1
  273. package/dist/types/lumina.d.ts +9 -8
  274. package/dist/types/preact.d.ts +9 -8
  275. package/dist/types/react.d.ts +9 -8
  276. package/dist/types/stencil.d.ts +11 -10
  277. package/dist/utils/index.d.ts +10 -10
  278. package/dist/utils/index.js +56 -55
  279. package/package.json +32 -12
  280. package/dist/cdn/2AXF774U.js +0 -2
  281. package/dist/cdn/462JBSEV.js +0 -422
  282. package/dist/cdn/53ZCUPKK.js +0 -22
  283. package/dist/cdn/5QAHYX7Y.js +0 -5
  284. package/dist/cdn/5XRDJL7R.js +0 -14
  285. package/dist/cdn/7BCR6TUO.js +0 -2
  286. package/dist/cdn/7GH7VSB2.js +0 -2
  287. package/dist/cdn/7PLV4QH6.js +0 -2
  288. package/dist/cdn/AO7BQHKC.js +0 -2
  289. package/dist/cdn/AXDZBBNL.js +0 -45
  290. package/dist/cdn/DDLZOMUY.js +0 -2
  291. package/dist/cdn/EECZLT6C.js +0 -166
  292. package/dist/cdn/ETRWZ3MS.js +0 -108
  293. package/dist/cdn/F2AHA4GB.js +0 -54
  294. package/dist/cdn/FX5JFRDL.js +0 -2
  295. package/dist/cdn/H7422XUG.js +0 -2
  296. package/dist/cdn/HB5A5R2E.js +0 -2
  297. package/dist/cdn/I6HNBTWY.js +0 -2
  298. package/dist/cdn/IG6YKZH3.js +0 -3
  299. package/dist/cdn/KMQ3SP4I.js +0 -5
  300. package/dist/cdn/MH5RPXHM.js +0 -2
  301. package/dist/cdn/NAUXSHIE.js +0 -72
  302. package/dist/cdn/NVI3I46B.js +0 -2
  303. package/dist/cdn/OAVEHGB6.js +0 -2
  304. package/dist/cdn/OH64RMOR.js +0 -4
  305. package/dist/cdn/P26NON3Z.js +0 -16
  306. package/dist/cdn/P6OPJQMC.js +0 -3
  307. package/dist/cdn/QR54T33D.js +0 -2
  308. package/dist/cdn/RVOAPUBN.js +0 -2
  309. package/dist/cdn/S3VPZFWQ.js +0 -36
  310. package/dist/cdn/SXDLXCIM.js +0 -2
  311. package/dist/cdn/USMDJUFS.js +0 -2
  312. package/dist/cdn/Y333DGV6.js +0 -2
  313. package/dist/cdn/YIMNOUTF.js +0 -2
@@ -1,12 +1,12 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import g from "@esri/arcgis-html-sanitizer";
2
+ import w from "@esri/arcgis-html-sanitizer";
3
3
  import { marked as S } from "marked";
4
4
  S.use({
5
5
  gfm: !0,
6
6
  breaks: !0,
7
7
  async: !1
8
8
  });
9
- const C = new g(
9
+ const C = new w(
10
10
  {
11
11
  whiteList: {
12
12
  // LLMs sometimes return lists like "- 2) Foo". `marked` parses that into a nested ordered list
@@ -17,6 +17,7 @@ const C = new g(
17
17
  "calcite-table-row": ["slot", "class"],
18
18
  "calcite-table-header": ["heading", "alignment", "description", "class"],
19
19
  "calcite-table-cell": ["alignment", "colspan", "rowspan", "class"],
20
+ "calcite-link": ["href", "target", "rel", "title"],
20
21
  // Allow markdown code blocks to render as <pre><code>…</code></pre>.
21
22
  pre: ["class"],
22
23
  code: ["class"]
@@ -27,44 +28,67 @@ const C = new g(
27
28
  function T(e) {
28
29
  return C.sanitize(e);
29
30
  }
31
+ function k(e) {
32
+ if (!e || typeof DOMParser > "u")
33
+ return e;
34
+ try {
35
+ const t = new DOMParser().parseFromString(e, "text/html");
36
+ return t.querySelectorAll("a").forEach((r) => {
37
+ const n = t.createElement("calcite-link");
38
+ for (const l of ["href", "target", "rel", "title"]) {
39
+ const a = r.getAttribute(l);
40
+ a !== null && n.setAttribute(l, a);
41
+ }
42
+ n.append(...r.childNodes), r.replaceWith(n);
43
+ }), t.body.innerHTML;
44
+ } catch {
45
+ return e;
46
+ }
47
+ }
30
48
  function A(e, t) {
31
- const r = e.indexOf("{", t), a = e.indexOf("[", t);
32
- return r === -1 ? a : a === -1 ? r : Math.min(r, a);
49
+ const r = e.indexOf("{", t), n = e.indexOf("[", t);
50
+ return r === -1 ? n : n === -1 ? r : Math.min(r, n);
33
51
  }
34
52
  function x(e) {
35
53
  if (e.trimStart().startsWith("```"))
36
54
  return null;
37
55
  for (let r = A(e, 0); r !== -1; r = A(e, r + 1)) {
38
- let a = 0, c = 0;
39
- for (let l = r; l < e.length; l++) {
40
- const n = e[l];
41
- if (n === "{" ? a++ : n === "}" ? a-- : n === "[" ? c++ : n === "]" && c--, a < 0 || c < 0)
56
+ let n = 0, l = 0;
57
+ for (let a = r; a < e.length; a++) {
58
+ const c = e[a];
59
+ if (c === "{" ? n++ : c === "}" ? n-- : c === "[" ? l++ : c === "]" && l--, n < 0 || l < 0)
42
60
  break;
43
- if (a === 0 && c === 0 && l > r)
44
- return e.slice(r, l + 1);
61
+ if (n === 0 && l === 0 && a > r)
62
+ return e.slice(r, a + 1);
45
63
  }
46
64
  }
47
65
  return null;
48
66
  }
49
- function H(e) {
67
+ function z(e) {
50
68
  if (!e)
51
69
  return "";
52
70
  let t = e;
53
71
  const r = x(e);
54
72
  if (r)
55
73
  try {
56
- const l = JSON.parse(r), f = `
74
+ const l = JSON.parse(r), c = `
57
75
 
58
76
  \`\`\`json
59
77
  ${JSON.stringify(l, null, 2)}
60
78
  \`\`\`
61
79
 
62
80
  `;
63
- t = e.replace(r, f);
81
+ t = e.replace(r, c);
64
82
  } catch {
65
83
  }
66
- const a = q(t), c = E(a);
67
- return T(c);
84
+ const n = q(t);
85
+ return M(n);
86
+ }
87
+ function M(e) {
88
+ if (!e)
89
+ return "";
90
+ const t = E(e), r = k(t);
91
+ return T(r);
68
92
  }
69
93
  function q(e) {
70
94
  return e ? S.parse(e, { async: !1 }) : "";
@@ -74,44 +98,45 @@ function E(e) {
74
98
  return e;
75
99
  try {
76
100
  const t = new DOMParser().parseFromString(e, "text/html");
77
- return Array.from(t.querySelectorAll("table")).forEach((a, c) => {
78
- const l = t.createElement("calcite-table");
79
- l.setAttribute("caption", `Table ${c + 1}`), l.setAttribute("striped", "true");
80
- const n = a.querySelector("thead");
81
- if (n) {
82
- const d = Array.from(n.querySelectorAll("tr"));
83
- for (const h of d) {
101
+ return Array.from(t.querySelectorAll("table")).forEach((n, l) => {
102
+ const a = t.createElement("calcite-table");
103
+ a.setAttribute("caption", `Table ${l + 1}`), a.setAttribute("striped", "true");
104
+ const c = n.querySelector("thead");
105
+ if (c) {
106
+ const f = Array.from(c.querySelectorAll("tr"));
107
+ for (const u of f) {
84
108
  const o = t.createElement("calcite-table-row");
85
109
  o.setAttribute("slot", "table-header");
86
- const u = Array.from(h.querySelectorAll("th, td"));
87
- for (const b of u) {
88
- const s = (b.textContent ?? "").trim(), i = t.createElement("calcite-table-header");
89
- i.setAttribute("heading", s), o.appendChild(i);
110
+ const d = Array.from(u.querySelectorAll("th, td"));
111
+ for (const h of d) {
112
+ const i = (h.textContent ?? "").trim(), s = t.createElement("calcite-table-header");
113
+ s.setAttribute("heading", i), o.appendChild(s);
90
114
  }
91
- l.appendChild(o);
115
+ a.appendChild(o);
92
116
  }
93
117
  }
94
- const f = a.querySelector("tbody");
95
- (f ? Array.from(f.querySelectorAll("tr")) : Array.from(a.querySelectorAll("tr")).filter((d) => !n?.contains(d))).forEach((d, h) => {
96
- const o = t.createElement("calcite-table-row"), u = !n && h === 0 && d.querySelectorAll("th").length > 0;
97
- u && o.setAttribute("slot", "table-header");
98
- const b = Array.from(d.querySelectorAll("th, td"));
99
- for (const s of b) {
100
- if (u && s.localName === "th") {
101
- const w = (s.textContent ?? "").trim(), y = t.createElement("calcite-table-header");
102
- y.setAttribute("heading", w), o.appendChild(y);
118
+ const b = n.querySelector("tbody");
119
+ (b ? Array.from(b.querySelectorAll("tr")) : Array.from(n.querySelectorAll("tr")).filter((f) => !c?.contains(f))).forEach((f, u) => {
120
+ const o = t.createElement("calcite-table-row"), d = !c && u === 0 && f.querySelectorAll("th").length > 0;
121
+ d && o.setAttribute("slot", "table-header");
122
+ const h = Array.from(f.querySelectorAll("th, td"));
123
+ for (const i of h) {
124
+ if (d && i.localName === "th") {
125
+ const g = (i.textContent ?? "").trim(), y = t.createElement("calcite-table-header");
126
+ y.setAttribute("heading", g), o.appendChild(y);
103
127
  return;
104
128
  }
105
- const i = t.createElement("calcite-table-cell"), p = s.getAttribute("colspan"), m = s.getAttribute("rowspan");
106
- p && i.setAttribute("colspan", p), m && i.setAttribute("rowspan", m), i.innerHTML = s.innerHTML, o.appendChild(i);
129
+ const s = t.createElement("calcite-table-cell"), p = i.getAttribute("colspan"), m = i.getAttribute("rowspan");
130
+ p && s.setAttribute("colspan", p), m && s.setAttribute("rowspan", m), s.innerHTML = i.innerHTML, o.appendChild(s);
107
131
  }
108
- l.appendChild(o);
109
- }), a.replaceWith(l);
132
+ a.appendChild(o);
133
+ }), n.replaceWith(a);
110
134
  }), t.body.innerHTML;
111
135
  } catch {
112
136
  return e;
113
137
  }
114
138
  }
115
139
  export {
116
- H as p
140
+ M as a,
141
+ z as p
117
142
  };
@@ -1,275 +1,228 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { StateGraph as b, START as V, END as v } from "@langchain/langgraph/web";
3
- import { g as T, O as R, P as C, t as N, Q as k, f as h, R as D, r as z, S as $, T as P } from "./adapter.js";
2
+ import { StateGraph as R, START as F, END as y } from "@langchain/langgraph/web";
3
+ import { g as x, j as w, t as v, k as C, r as N, D as T, l as b } from "./adapter.js";
4
4
  import "@arcgis/core/identity/IdentityManager.js";
5
5
  import "@arcgis/core/portal/Portal.js";
6
- import { s as c, j as A, h as Q } from "./generateLayerDescriptions.js";
7
- import { AIMessage as j } from "@langchain/core/messages";
6
+ import "@arcgis/core/request.js";
7
+ import "@arcgis/toolkit/string";
8
+ import { h as M, e as A } from "./generateLayerDescriptions.js";
9
+ import { AIMessage as _ } from "@langchain/core/messages";
10
+ import { s } from "./index.js";
8
11
  import "@langchain/openai";
12
+ import "@arcgis/core/config.js";
9
13
  import "@arcgis/core/core/reactiveUtils.js";
10
14
  import "@arcgis/core/layers/FeatureLayer.js";
11
- import "@arcgis/core/request.js";
12
15
  import "@langchain/core/prompts";
13
- import { h as I } from "./toolCallResponse.js";
14
- import { ToolNode as O } from "@langchain/langgraph/prebuilt";
15
- import G from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
16
- import U from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
17
- const W = async (t, e) => (await c({ text: "Exiting Data Exploration agent" }, e), t), B = async (t, e) => {
18
- await c({ text: "Requesting LLM for layer filter results" }, e);
19
- const d = await T("data_explore_filter_prompt");
16
+ import { h as L } from "./toolCallResponse.js";
17
+ import { b as q } from "./formatFeatureAttributes.js";
18
+ import { ToolNode as k } from "@langchain/langgraph/prebuilt";
19
+ import { b as $ } from "./fieldStatistics.js";
20
+ import { f as D } from "./fetchAgentContext.js";
21
+ import { f as m } from "./fetchService.js";
22
+ const I = async (t, e) => (await s({ text: "Exiting Data Exploration agent" }, e), t), z = async (t, e) => {
23
+ await s({ text: "Requesting LLM for layer filter results" }, e);
24
+ const l = await x("data_explore_filter_prompt");
20
25
  if (!e?.configurable)
21
26
  throw new Error("config.configurable is required for layer filter tools");
22
- const { userTimezone: n, userTimezoneOffset: r } = R(), o = {
27
+ const { userTimezone: d, userTimezoneOffset: r } = q(), o = {
23
28
  layerFieldInfo: t.layerFieldInfo,
24
- userTimezone: n,
29
+ userTimezone: d,
25
30
  userTimezoneOffset: r,
26
31
  queryResponse: t.queryResponse,
27
32
  assignedTask: t.agentExecutionContext.assignedTask,
28
33
  userRequest: t.agentExecutionContext.userRequest,
29
34
  priorSteps: t.agentExecutionContext.priorSteps
30
- }, s = await A({
31
- promptText: d,
35
+ }, i = await M({
36
+ promptText: l,
32
37
  modelTier: "advanced",
38
+ config: e,
33
39
  messages: t.dataExplorationMessages,
34
40
  inputVariables: o,
35
- tools: C
36
- }), i = [...t.dataExplorationMessages, s];
37
- if (!((s.tool_calls?.length ?? 0) > 0))
38
- return await c({ text: "LLM determined no filter changes needed" }, e), {
41
+ tools: w
42
+ }), n = [...t.dataExplorationMessages, i];
43
+ if (!((i.tool_calls?.length ?? 0) > 0))
44
+ return await s({ text: "LLM determined no filter changes needed" }, e), {
39
45
  ...t,
40
- dataExplorationMessages: i
46
+ dataExplorationMessages: n
41
47
  // Don't overwrite outputMessage if query already set it
42
48
  };
43
- const m = [...i, s], p = s.content.toString();
44
- return await I(s, e), { ...t, dataExplorationMessages: m, outputMessage: p };
45
- }, H = async (t, e) => {
46
- await c({ text: "Requesting LLM for layer query results" }, e);
47
- const d = await T("data_explore_query_prompt");
49
+ const u = n, p = i.content.toString();
50
+ return await L(i, e), { ...t, dataExplorationMessages: u, outputMessage: p };
51
+ }, Q = async (t, e) => {
52
+ await s({ text: "Requesting LLM for layer query results" }, e);
53
+ const l = await x("data_explore_query_prompt");
48
54
  if (!e?.configurable)
49
55
  throw new Error("config.configurable is required for layer query tools");
50
- const { userTimezone: n, userTimezoneOffset: r } = R(), s = t.agentExecutionContext.sharedState.lastNavigatedFeatures, i = s && typeof s == "object" && "value" in s ? s.value : s;
51
- let l = "none";
56
+ const { userTimezone: d, userTimezoneOffset: r } = q(), o = t.agentExecutionContext.sharedState, i = o.lastNavigatedFeatures?.value, n = o.lastResolvedLocation?.value;
57
+ let c = "none";
52
58
  if (i != null)
53
59
  try {
54
- l = JSON.stringify(i);
60
+ c = JSON.stringify(i);
61
+ } catch {
62
+ c = "none";
63
+ }
64
+ let u = "none";
65
+ if (n != null)
66
+ try {
67
+ u = JSON.stringify({
68
+ address: n.address,
69
+ location: n.location
70
+ });
55
71
  } catch {
56
- l = "none";
72
+ u = "none";
57
73
  }
58
- const m = {
74
+ const p = {
59
75
  layerFieldInfo: t.layerFieldInfo,
60
- userTimezone: n,
76
+ userTimezone: d,
61
77
  userTimezoneOffset: r,
62
78
  assignedTask: t.agentExecutionContext.assignedTask,
63
79
  userRequest: t.agentExecutionContext.userRequest,
64
80
  priorSteps: t.agentExecutionContext.priorSteps,
65
- lastNavigatedFeatures: l
66
- }, p = await A({
67
- promptText: d,
81
+ lastNavigatedFeatures: c,
82
+ lastResolvedLocation: u
83
+ }, g = await M({
84
+ promptText: l,
68
85
  modelTier: "advanced",
86
+ config: e,
69
87
  messages: t.dataExplorationMessages,
70
- inputVariables: m,
71
- tools: k
72
- }), y = p.content.toString();
73
- return await I(p, e), {
88
+ inputVariables: p,
89
+ tools: C
90
+ }), f = (g.tool_calls?.length ?? 0) > 0, h = g.content.toString();
91
+ return await L(g, e), {
74
92
  ...t,
75
- dataExplorationMessages: [...t.dataExplorationMessages, p],
76
- outputMessage: y,
93
+ dataExplorationMessages: [...t.dataExplorationMessages, g],
94
+ // Only emit output here when no tools are being called.
95
+ // For tool-calling flows, downstream summarizer nodes provide the final user-facing message.
96
+ ...f ? {} : { outputMessage: h },
77
97
  status: "success",
78
- summary: y ? N(y) : "Query executed."
98
+ summary: h && !f ? v(h) : "Query planning completed."
79
99
  };
80
- }, J = async (t, e) => {
100
+ }, V = async (t, e) => {
81
101
  try {
82
- await c({ text: "Requesting LLM for summary on query results" }, e);
83
- const d = await T("summarize_query_response_prompt"), n = {
102
+ await s({ text: "Requesting LLM for summary on query results" }, e);
103
+ const l = await x("summarize_query_response_prompt"), d = {
84
104
  queryResponse: t.queryResponse,
85
105
  assignedTask: t.agentExecutionContext.assignedTask,
86
106
  userRequest: t.agentExecutionContext.userRequest,
87
107
  priorSteps: t.agentExecutionContext.priorSteps
88
- }, r = await Q({
89
- promptText: d,
108
+ }, r = await A({
109
+ promptText: l,
90
110
  modelTier: "fast",
111
+ config: e,
91
112
  messages: t.dataExplorationMessages,
92
- inputVariables: n
93
- }), o = typeof r == "string" ? r : r.content, s = new j(o);
94
- await c({ text: `Received response from LLM: ${o}` }, e);
95
- const i = o;
113
+ inputVariables: d
114
+ }), o = typeof r == "string" ? r : r.content, i = new _(o);
115
+ await s({ text: `Received response from LLM: ${o}` }, e);
116
+ const n = o;
96
117
  return {
97
118
  ...t,
98
- outputMessage: i,
119
+ outputMessage: n,
99
120
  status: "success",
100
- summary: i ? N(i) : "Summary generated.",
101
- dataExplorationMessages: [...t.dataExplorationMessages, s]
121
+ summary: n ? v(n) : "Summary generated.",
122
+ dataExplorationMessages: [...t.dataExplorationMessages, i]
102
123
  };
103
124
  } catch (a) {
104
- throw await c({ text: "Error during filter LLM request" }, e), new Error(`Error during filter LLM request: ${a instanceof Error ? a.message : String(a)}`);
125
+ throw await s({ text: "Error during filter LLM request" }, e), new Error(`Error during filter LLM request: ${a instanceof Error ? a.message : String(a)}`);
105
126
  }
106
127
  };
107
- async function K(t, e) {
108
- const d = await new O(C).invoke(
128
+ async function O(t, e) {
129
+ if ((t.queryResponse ?? []).some((r) => {
130
+ const o = r.details;
131
+ return typeof o == "object" && o !== null && "error" in o;
132
+ }))
133
+ return await s({ text: "Skipping layer filter tool because query response contains an error." }, e), { ...t };
134
+ const d = await new k(w, { handleToolErrors: !1 }).invoke(
109
135
  {
110
136
  messages: t.dataExplorationMessages
111
137
  },
112
138
  e
113
139
  );
114
- return await c(
115
- { text: `Finished executing layer filter tool: ${d.messages.map((n) => n.content).join(", ")}` },
140
+ return await s(
141
+ { text: `Finished executing layer filter tool: ${d.messages.map((r) => r.content).join(", ")}` },
116
142
  e
117
143
  ), { ...t };
118
144
  }
119
- const X = 10, Y = ["string", "small-integer", "integer"], Z = async (t, e, { includeSummaryStatistics: a = !0, includeUniqueValues: d = !0 } = {}) => {
120
- let n = null, r = null;
121
- try {
122
- if (e.type !== "geometry" && e.type !== "oid" && e.type !== "global-id") {
123
- a && (n = await G({ layer: t, field: e.name }));
124
- const o = e.domain?.type === "coded-value" ? e.domain : null;
125
- d && (Y.includes(e.type) || o) && (r = (await U({ layer: t, field: e.name })).uniqueValueInfos.sort((s, i) => i.count - s.count).slice(0, X), o && (r = r.map((s) => ({
126
- ...s,
127
- value: o.getName(s.value) ?? s.value
128
- }))));
129
- }
130
- } catch (o) {
131
- console.error(`Error fetching statistics for field ${e.name}:`, o);
132
- }
133
- return {
134
- summaryStatistics: n,
135
- uniqueValues: r
136
- };
137
- };
138
- function ee(t, e) {
139
- return ["string", "small-integer", "integer"].includes(t) || e === "coded-value";
140
- }
141
- async function te(t, e, a, d = !0) {
142
- const n = [], r = [], o = [];
143
- for (const s of t) {
144
- let i = function(g) {
145
- const u = e.get(g)?.layerItem;
146
- return u ? [
147
- u.name && `Name: ${u.name}`,
148
- u.title && `Title: ${u.title}`,
149
- u.description && `Description: ${u.description}`
150
- ].filter(Boolean).join(" | ") : g;
151
- };
152
- const { layerId: l, results: m } = s, p = a.map?.allLayers.find((g) => g.id === l), y = e.get(l)?.fieldRegistry;
153
- if (!y)
154
- continue;
155
- let f = n.find((g) => g.layerId === l);
156
- f || (f = {
157
- layerId: l,
158
- layerSummary: i(l),
159
- fieldInfos: []
160
- }, n.push(f));
161
- for (const g of m) {
162
- const u = y.get(g.name);
163
- if (!u)
164
- continue;
165
- const x = u.statistics, E = d && !x?.summaryStatistics, w = ee(u.type, u.domain?.type) && !x?.uniqueValues, q = E || w;
166
- if (o.push({
167
- layerId: l,
168
- fieldName: u.name,
169
- didFetchStatistics: q
170
- }), q) {
171
- const _ = Z(p, u, {
172
- includeSummaryStatistics: E,
173
- includeUniqueValues: w
174
- }).then((F) => {
175
- const S = {
176
- summaryStatistics: x?.summaryStatistics ?? null,
177
- uniqueValues: x?.uniqueValues ?? null
178
- };
179
- E && (S.summaryStatistics = F.summaryStatistics), w && (S.uniqueValues = F.uniqueValues), y.set(u.name, { ...u, statistics: S }), u.statistics = S;
180
- });
181
- r.push(_);
182
- }
183
- f.fieldInfos.push(u);
184
- }
185
- }
186
- return await Promise.all(r), {
187
- layerFieldInfo: n,
188
- didFetchStatistics: r.length > 0,
189
- fieldStatisticsFetchStatus: o
190
- };
191
- }
192
- const M = /\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;
193
- function ae(t, e) {
194
- return M.test(t) || M.test(e);
145
+ const E = /\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;
146
+ function P(t, e) {
147
+ return E.test(t) || E.test(e);
195
148
  }
196
- const se = async (t, e) => {
149
+ const j = async (t, e) => {
197
150
  try {
198
- await c({ text: "Preparing field information for vector search results" }, e);
199
- const a = h(e, "layersAndFieldsRegistry"), { mapView: d } = D(e), { assignedTask: n, userRequest: r } = t.agentExecutionContext, o = ae(n, r), { layerFieldInfo: s, didFetchStatistics: i, fieldStatisticsFetchStatus: l } = await te(
151
+ await s({ text: "Preparing field information for vector search results" }, e);
152
+ const a = m(e, "layersAndFieldsRegistry"), { mapView: l } = D(e, ["mapView"]), { assignedTask: d, userRequest: r } = t.agentExecutionContext, o = P(d, r), { layerFieldInfo: i, didFetchStatistics: n, fieldStatisticsFetchStatus: c } = await $(
200
153
  t.vectorSearchFieldResults,
201
154
  a,
202
- d,
155
+ l,
203
156
  o
204
157
  );
205
- i ? await c({ text: "Statistics fetched" }, e) : await c({ text: "Statistics skipped" }, e);
206
- for (const m of l)
207
- await c(
158
+ n ? await s({ text: "Statistics fetched" }, e) : await s({ text: "Statistics skipped" }, e);
159
+ for (const u of c)
160
+ await s(
208
161
  {
209
- text: ` - ${m.fieldName} - stats ${m.didFetchStatistics ? "fetched" : "skipped"}`
162
+ text: ` - ${u.fieldName} - stats ${u.didFetchStatistics ? "fetched" : "skipped"}`
210
163
  },
211
164
  e
212
165
  );
213
- return await c({ text: "Field information prepared" }, e), { ...t, layerFieldInfo: s };
166
+ return await s({ text: "Field information prepared" }, e), { ...t, layerFieldInfo: i };
214
167
  } catch (a) {
215
- throw await c({ text: "Error during fetching statistics" }, e), new Error(`Error during fetching statistics: ${a instanceof Error ? a.message : String(a)}`);
168
+ throw await s({ text: "Error during fetching statistics" }, e), new Error(`Error during fetching statistics: ${a instanceof Error ? a.message : String(a)}`);
216
169
  }
217
- }, L = 0.7, re = 10, oe = async (t, e) => {
170
+ }, S = 0.7, G = 10, W = async (t, e) => {
218
171
  try {
219
- await c({ text: "Similarity search to find fields" }, e);
220
- const a = h(e, "fieldSearch"), d = h(e, "layersAndFieldsRegistry"), n = h(e, "embeddingCache"), r = await a.searchFields({
172
+ await s({ text: "Similarity search to find fields" }, e);
173
+ const a = m(e, "fieldSearch"), l = m(e, "layersAndFieldsRegistry"), d = m(e, "embeddingCache"), r = await a.searchFields({
221
174
  text: t.agentExecutionContext.assignedTask,
222
175
  layerIds: t.vectorSearchLayerIds,
223
- minScore: L,
224
- topResults: re,
225
- embeddingCache: n
226
- }), o = r.map(({ layerId: i, results: l }) => {
227
- const m = l.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
176
+ minScore: S,
177
+ topResults: G,
178
+ embeddingCache: d
179
+ }), o = r.map(({ layerId: n, results: c }) => {
180
+ const u = c.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
228
181
  `);
229
- return `${d.get(i)?.layerItem.name ?? i}:
230
- ${m}`;
182
+ return `${l.get(n)?.layerItem.name ?? n}:
183
+ ${u}`;
231
184
  }).join(`
232
185
  `);
233
- let s;
234
- return r.length > 0 ? s = `Vector search completed. Matching layers and fields with scores:
235
- ${o}` : s = `No vector search results found for score over ${L}.`, await c({ text: s }, e), {
186
+ let i;
187
+ return r.length > 0 ? i = `Vector search completed. Matching layers and fields with scores:
188
+ ${o}` : i = `No vector search results found for score over ${S}.`, await s({ text: i }, e), {
236
189
  ...t,
237
190
  vectorSearchFieldResults: r
238
191
  };
239
192
  } catch (a) {
240
- throw await c(
193
+ throw await s(
241
194
  { text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
242
195
  e
243
196
  ), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
244
197
  }
245
- }, ie = 0.7, ne = async (t, e) => {
198
+ }, H = 0.7, J = async (t, e) => {
246
199
  try {
247
- await c(
200
+ await s(
248
201
  { text: `Similarity search to find layers: ${t.agentExecutionContext.assignedTask}` },
249
202
  e
250
203
  );
251
- const a = h(e, "layerSearch"), d = h(e, "layersAndFieldsRegistry"), n = h(e, "embeddingCache"), r = await a.searchLayers({
204
+ const a = m(e, "layerSearch"), l = m(e, "layersAndFieldsRegistry"), d = m(e, "embeddingCache"), r = await a.searchLayers({
252
205
  text: t.agentExecutionContext.assignedTask,
253
- minScore: ie,
254
- embeddingCache: n
255
- }), o = r.map((l) => l.id), s = r.map(({ id: l, score: m }) => `${d.get(l)?.layerItem.name ?? l} (${m.toFixed(2)})`).join(`
206
+ minScore: H,
207
+ embeddingCache: d
208
+ }), o = r.map((c) => c.id), i = r.map(({ id: c, score: u }) => `${l.get(c)?.layerItem.name ?? c} (${u.toFixed(2)})`).join(`
256
209
  `);
257
- let i;
258
- return o.length > 0 ? i = `Vector search completed. Matching layers with scores:
259
- ${s}` : i = "Vector search completed. No matching layers found.", await c({ text: i }, e), {
210
+ let n;
211
+ return o.length > 0 ? n = `Vector search completed. Matching layers with scores:
212
+ ${i}` : n = "Vector search completed. No matching layers found.", await s({ text: n }, e), {
260
213
  ...t,
261
214
  vectorSearchLayerIds: o
262
215
  };
263
216
  } catch (a) {
264
- throw await c(
217
+ throw await s(
265
218
  { text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
266
219
  e
267
220
  ), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
268
221
  }
269
- }, le = (t, e) => z(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
222
+ }, U = (t, e) => N(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
270
223
  t,
271
224
  e
272
- ), ce = () => new b($).addNode("requireDataExplorationServices", le).addNode("vectorSearchLayers", ne).addNode("vectorSearchFields", oe).addNode("fieldStatistics", se).addNode("queryAgent", H).addNode("queryTools", P).addNode("summarizeQueryResponseLLM", J).addNode("filterAgent", B).addNode("filterTools", K).addNode("earlyExit", W).addEdge(V, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
225
+ ), B = () => new R(T).addNode("requireDataExplorationServices", U).addNode("vectorSearchLayers", J).addNode("vectorSearchFields", W).addNode("fieldStatistics", j).addNode("queryAgent", Q).addNode("queryTools", b).addNode("summarizeQueryResponseLLM", V).addNode("filterAgent", z).addNode("filterTools", O).addNode("earlyExit", I).addEdge(F, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
273
226
  "vectorSearchLayers",
274
227
  (e) => e.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
275
228
  ).addConditionalEdges(
@@ -278,7 +231,7 @@ ${s}` : i = "Vector search completed. No matching layers found.", await c({ text
278
231
  ).addEdge("fieldStatistics", "queryAgent").addConditionalEdges("queryAgent", (e) => (e.dataExplorationMessages[e.dataExplorationMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "queryTools" : "filterAgent").addConditionalEdges(
279
232
  "queryTools",
280
233
  (e) => e.queryResponse.length ? "summarizeQueryResponseLLM" : "filterAgent"
281
- ).addEdge("summarizeQueryResponseLLM", "filterAgent").addConditionalEdges("filterAgent", (e) => (e.dataExplorationMessages[e.dataExplorationMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "filterTools" : v).addEdge("filterTools", v).addEdge("earlyExit", v), de = String.raw`- **data exploration** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. And/Or user wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
234
+ ).addEdge("summarizeQueryResponseLLM", "filterAgent").addConditionalEdges("filterAgent", (e) => (e.dataExplorationMessages[e.dataExplorationMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "filterTools" : y).addEdge("filterTools", y).addEdge("earlyExit", y), K = String.raw`- **data exploration** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. And/Or user wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
282
235
  The Data Exploration Agent will automatically zoom to the affected features for action taken by this agent. In this case, no need to call navigation tool separately.
283
236
  _Example: “Only show stations where Brand is Shell”_
284
237
  _Example: “Make Shell stations stand out on the map”_
@@ -286,13 +239,15 @@ ${s}` : i = "Vector search completed. No matching layers found.", await c({ text
286
239
  This also includes questions that ask which feature meets a given condition or where a particular feature in the data is located (e.g., “Where is the spring with the highest elevation?”). However, this agent does not handle addresses.
287
240
  _Example: “How many features are there?”_
288
241
  _Example: “What’s the average population?”_
289
- _Example: “Which values are in the status field?”_`, Me = {
242
+ _Example: “Which values are in the status field?”_
243
+
244
+ This agent does NOT handle help/metadata requests such as listing available layers, listing field names/columns/attributes for a layer, or capability guidance.`, xe = {
290
245
  id: "dataExploration",
291
246
  name: "Data Exploration Agent",
292
- description: de,
293
- createGraph: ce,
294
- workspace: $
247
+ description: K,
248
+ createGraph: B,
249
+ workspace: T
295
250
  };
296
251
  export {
297
- Me as D
252
+ xe as D
298
253
  };
@@ -39,10 +39,13 @@ Prior steps:
39
39
  Last navigated features from shared state (if available):
40
40
  {lastNavigatedFeatures}
41
41
 
42
+ Last resolved location from shared state (if available):
43
+ {lastResolvedLocation}
44
+
42
45
  Use the assigned task as the primary instruction for the current query.
43
46
  Use the latest user request as supporting context when needed.
44
47
  Use prior steps only when the assigned task or user request clearly depends on earlier results.
45
- Use lastNavigatedFeatures as authoritative context for map-navigation references when present.
48
+ Use shared-state context (\`lastResolvedLocation\`, \`lastNavigatedFeatures\`) for referential follow-ups when relevant.
46
49
  Use chat history only when necessary to understand conversational references, and do not override the assigned task.
47
50
 
48
51
  ### Anchor selection rule (strict, single source of truth)
@@ -50,8 +53,9 @@ Use chat history only when necessary to understand conversational references, an
50
53
  When the request is referential (for example: "this", "it", "that", "those", "them", "of those", "the same one(s)"), choose exactly one anchor using this priority order:
51
54
 
52
55
  1. Explicit entity named in the current request (if present)
53
- 2. \`lastNavigatedFeatures\` (if present)
54
- 3. The immediately previous successful relevant step from \`priorSteps\`
56
+ 2. \`lastResolvedLocation\` (if present and the request refers to a place/location)
57
+ 3. \`lastNavigatedFeatures\` (if present)
58
+ 4. The immediately previous successful relevant step from \`priorSteps\`
55
59
 
56
60
  After selecting the anchor, keep that anchor for this query and do not switch to an older entity.
57
61
  If \`lastNavigatedFeatures\` is used as the anchor, reuse its \`layerId\` and \`where\` for query scope unless the current request explicitly overrides it.
@@ -78,7 +82,8 @@ Start with a fresh WHERE clause for each new question. Do not inherit filters fr
78
82
 
79
83
  This is an exception to the "fresh WHERE clause" rule above.
80
84
 
81
- - If the anchored context indicates \`useCurrentExtent: true\`, use \`useCurrentExtent: true\` with \`where: "1=1"\`.
85
+ - If the anchored context is \`lastResolvedLocation\` with a point, prefer \`geometryFilter.point\` and use \`where: "1=1"\` unless the user asked for additional attribute filters.
86
+ - Only use \`useCurrentExtent: true\` when the user explicitly asks about the current view/map extent (for example: "in my view", "on my map", "visible now").
82
87
  - If the anchored context includes specific feature IDs/objectIds, scope to those IDs.
83
88
  - Otherwise, use the anchored \`layerId\` + \`where\` combination.
84
89