@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
@@ -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,229 @@
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";
11
+ import "@langchain/core/callbacks/base";
8
12
  import "@langchain/openai";
13
+ import "@arcgis/core/config.js";
9
14
  import "@arcgis/core/core/reactiveUtils.js";
10
15
  import "@arcgis/core/layers/FeatureLayer.js";
11
- import "@arcgis/core/request.js";
12
16
  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");
17
+ import { h as L } from "./toolCallResponse.js";
18
+ import { b as q } from "./formatFeatureAttributes.js";
19
+ import { ToolNode as k } from "@langchain/langgraph/prebuilt";
20
+ import { b as $ } from "./fieldStatistics.js";
21
+ import { f as D } from "./fetchAgentContext.js";
22
+ import { f as m } from "./fetchService.js";
23
+ const I = async (t, e) => (await s({ text: "Exiting Data Exploration agent" }, e), t), z = async (t, e) => {
24
+ await s({ text: "Requesting LLM for layer filter results" }, e);
25
+ const l = await x("data_explore_filter_prompt");
20
26
  if (!e?.configurable)
21
27
  throw new Error("config.configurable is required for layer filter tools");
22
- const { userTimezone: n, userTimezoneOffset: r } = R(), o = {
28
+ const { userTimezone: d, userTimezoneOffset: r } = q(), o = {
23
29
  layerFieldInfo: t.layerFieldInfo,
24
- userTimezone: n,
30
+ userTimezone: d,
25
31
  userTimezoneOffset: r,
26
32
  queryResponse: t.queryResponse,
27
33
  assignedTask: t.agentExecutionContext.assignedTask,
28
34
  userRequest: t.agentExecutionContext.userRequest,
29
35
  priorSteps: t.agentExecutionContext.priorSteps
30
- }, s = await A({
31
- promptText: d,
36
+ }, i = await M({
37
+ promptText: l,
32
38
  modelTier: "advanced",
39
+ config: e,
33
40
  messages: t.dataExplorationMessages,
34
41
  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), {
42
+ tools: w
43
+ }), n = [...t.dataExplorationMessages, i];
44
+ if (!((i.tool_calls?.length ?? 0) > 0))
45
+ return await s({ text: "LLM determined no filter changes needed" }, e), {
39
46
  ...t,
40
- dataExplorationMessages: i
47
+ dataExplorationMessages: n
41
48
  // Don't overwrite outputMessage if query already set it
42
49
  };
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");
50
+ const u = n, p = i.content.toString();
51
+ return await L(i, e), { ...t, dataExplorationMessages: u, outputMessage: p };
52
+ }, Q = async (t, e) => {
53
+ await s({ text: "Requesting LLM for layer query results" }, e);
54
+ const l = await x("data_explore_query_prompt");
48
55
  if (!e?.configurable)
49
56
  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";
57
+ const { userTimezone: d, userTimezoneOffset: r } = q(), o = t.agentExecutionContext.sharedState, i = o.lastNavigatedFeatures?.value, n = o.lastResolvedLocation?.value;
58
+ let c = "none";
52
59
  if (i != null)
53
60
  try {
54
- l = JSON.stringify(i);
61
+ c = JSON.stringify(i);
62
+ } catch {
63
+ c = "none";
64
+ }
65
+ let u = "none";
66
+ if (n != null)
67
+ try {
68
+ u = JSON.stringify({
69
+ address: n.address,
70
+ location: n.location
71
+ });
55
72
  } catch {
56
- l = "none";
73
+ u = "none";
57
74
  }
58
- const m = {
75
+ const p = {
59
76
  layerFieldInfo: t.layerFieldInfo,
60
- userTimezone: n,
77
+ userTimezone: d,
61
78
  userTimezoneOffset: r,
62
79
  assignedTask: t.agentExecutionContext.assignedTask,
63
80
  userRequest: t.agentExecutionContext.userRequest,
64
81
  priorSteps: t.agentExecutionContext.priorSteps,
65
- lastNavigatedFeatures: l
66
- }, p = await A({
67
- promptText: d,
82
+ lastNavigatedFeatures: c,
83
+ lastResolvedLocation: u
84
+ }, g = await M({
85
+ promptText: l,
68
86
  modelTier: "advanced",
87
+ config: e,
69
88
  messages: t.dataExplorationMessages,
70
- inputVariables: m,
71
- tools: k
72
- }), y = p.content.toString();
73
- return await I(p, e), {
89
+ inputVariables: p,
90
+ tools: C
91
+ }), f = (g.tool_calls?.length ?? 0) > 0, h = g.content.toString();
92
+ return await L(g, e), {
74
93
  ...t,
75
- dataExplorationMessages: [...t.dataExplorationMessages, p],
76
- outputMessage: y,
94
+ dataExplorationMessages: [...t.dataExplorationMessages, g],
95
+ // Only emit output here when no tools are being called.
96
+ // For tool-calling flows, downstream summarizer nodes provide the final user-facing message.
97
+ ...f ? {} : { outputMessage: h },
77
98
  status: "success",
78
- summary: y ? N(y) : "Query executed."
99
+ summary: h && !f ? v(h) : "Query planning completed."
79
100
  };
80
- }, J = async (t, e) => {
101
+ }, V = async (t, e) => {
81
102
  try {
82
- await c({ text: "Requesting LLM for summary on query results" }, e);
83
- const d = await T("summarize_query_response_prompt"), n = {
103
+ await s({ text: "Requesting LLM for summary on query results" }, e);
104
+ const l = await x("summarize_query_response_prompt"), d = {
84
105
  queryResponse: t.queryResponse,
85
106
  assignedTask: t.agentExecutionContext.assignedTask,
86
107
  userRequest: t.agentExecutionContext.userRequest,
87
108
  priorSteps: t.agentExecutionContext.priorSteps
88
- }, r = await Q({
89
- promptText: d,
109
+ }, r = await A({
110
+ promptText: l,
90
111
  modelTier: "fast",
112
+ config: e,
91
113
  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;
114
+ inputVariables: d
115
+ }), o = typeof r == "string" ? r : r.content, i = new _(o);
116
+ await s({ text: `Received response from LLM: ${o}` }, e);
117
+ const n = o;
96
118
  return {
97
119
  ...t,
98
- outputMessage: i,
120
+ outputMessage: n,
99
121
  status: "success",
100
- summary: i ? N(i) : "Summary generated.",
101
- dataExplorationMessages: [...t.dataExplorationMessages, s]
122
+ summary: n ? v(n) : "Summary generated.",
123
+ dataExplorationMessages: [...t.dataExplorationMessages, i]
102
124
  };
103
125
  } 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)}`);
126
+ 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
127
  }
106
128
  };
107
- async function K(t, e) {
108
- const d = await new O(C).invoke(
129
+ async function O(t, e) {
130
+ if ((t.queryResponse ?? []).some((r) => {
131
+ const o = r.details;
132
+ return typeof o == "object" && o !== null && "error" in o;
133
+ }))
134
+ return await s({ text: "Skipping layer filter tool because query response contains an error." }, e), { ...t };
135
+ const d = await new k(w, { handleToolErrors: !1 }).invoke(
109
136
  {
110
137
  messages: t.dataExplorationMessages
111
138
  },
112
139
  e
113
140
  );
114
- return await c(
115
- { text: `Finished executing layer filter tool: ${d.messages.map((n) => n.content).join(", ")}` },
141
+ return await s(
142
+ { text: `Finished executing layer filter tool: ${d.messages.map((r) => r.content).join(", ")}` },
116
143
  e
117
144
  ), { ...t };
118
145
  }
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);
146
+ 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;
147
+ function P(t, e) {
148
+ return E.test(t) || E.test(e);
195
149
  }
196
- const se = async (t, e) => {
150
+ const j = async (t, e) => {
197
151
  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(
152
+ await s({ text: "Preparing field information for vector search results" }, e);
153
+ 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
154
  t.vectorSearchFieldResults,
201
155
  a,
202
- d,
156
+ l,
203
157
  o
204
158
  );
205
- i ? await c({ text: "Statistics fetched" }, e) : await c({ text: "Statistics skipped" }, e);
206
- for (const m of l)
207
- await c(
159
+ n ? await s({ text: "Statistics fetched" }, e) : await s({ text: "Statistics skipped" }, e);
160
+ for (const u of c)
161
+ await s(
208
162
  {
209
- text: ` - ${m.fieldName} - stats ${m.didFetchStatistics ? "fetched" : "skipped"}`
163
+ text: ` - ${u.fieldName} - stats ${u.didFetchStatistics ? "fetched" : "skipped"}`
210
164
  },
211
165
  e
212
166
  );
213
- return await c({ text: "Field information prepared" }, e), { ...t, layerFieldInfo: s };
167
+ return await s({ text: "Field information prepared" }, e), { ...t, layerFieldInfo: i };
214
168
  } 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)}`);
169
+ throw await s({ text: "Error during fetching statistics" }, e), new Error(`Error during fetching statistics: ${a instanceof Error ? a.message : String(a)}`);
216
170
  }
217
- }, L = 0.7, re = 10, oe = async (t, e) => {
171
+ }, S = 0.7, G = 10, W = async (t, e) => {
218
172
  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({
173
+ await s({ text: "Similarity search to find fields" }, e);
174
+ const a = m(e, "fieldSearch"), l = m(e, "layersAndFieldsRegistry"), d = m(e, "embeddingCache"), r = await a.searchFields({
221
175
  text: t.agentExecutionContext.assignedTask,
222
176
  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(`
177
+ minScore: S,
178
+ topResults: G,
179
+ embeddingCache: d
180
+ }), o = r.map(({ layerId: n, results: c }) => {
181
+ const u = c.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
228
182
  `);
229
- return `${d.get(i)?.layerItem.name ?? i}:
230
- ${m}`;
183
+ return `${l.get(n)?.layerItem.name ?? n}:
184
+ ${u}`;
231
185
  }).join(`
232
186
  `);
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), {
187
+ let i;
188
+ return r.length > 0 ? i = `Vector search completed. Matching layers and fields with scores:
189
+ ${o}` : i = `No vector search results found for score over ${S}.`, await s({ text: i }, e), {
236
190
  ...t,
237
191
  vectorSearchFieldResults: r
238
192
  };
239
193
  } catch (a) {
240
- throw await c(
194
+ throw await s(
241
195
  { text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
242
196
  e
243
197
  ), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
244
198
  }
245
- }, ie = 0.7, ne = async (t, e) => {
199
+ }, H = 0.7, J = async (t, e) => {
246
200
  try {
247
- await c(
201
+ await s(
248
202
  { text: `Similarity search to find layers: ${t.agentExecutionContext.assignedTask}` },
249
203
  e
250
204
  );
251
- const a = h(e, "layerSearch"), d = h(e, "layersAndFieldsRegistry"), n = h(e, "embeddingCache"), r = await a.searchLayers({
205
+ const a = m(e, "layerSearch"), l = m(e, "layersAndFieldsRegistry"), d = m(e, "embeddingCache"), r = await a.searchLayers({
252
206
  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(`
207
+ minScore: H,
208
+ embeddingCache: d
209
+ }), o = r.map((c) => c.id), i = r.map(({ id: c, score: u }) => `${l.get(c)?.layerItem.name ?? c} (${u.toFixed(2)})`).join(`
256
210
  `);
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), {
211
+ let n;
212
+ return o.length > 0 ? n = `Vector search completed. Matching layers with scores:
213
+ ${i}` : n = "Vector search completed. No matching layers found.", await s({ text: n }, e), {
260
214
  ...t,
261
215
  vectorSearchLayerIds: o
262
216
  };
263
217
  } catch (a) {
264
- throw await c(
218
+ throw await s(
265
219
  { text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
266
220
  e
267
221
  ), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
268
222
  }
269
- }, le = (t, e) => z(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
223
+ }, U = (t, e) => N(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
270
224
  t,
271
225
  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(
226
+ ), 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
227
  "vectorSearchLayers",
274
228
  (e) => e.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
275
229
  ).addConditionalEdges(
@@ -278,7 +232,7 @@ ${s}` : i = "Vector search completed. No matching layers found.", await c({ text
278
232
  ).addEdge("fieldStatistics", "queryAgent").addConditionalEdges("queryAgent", (e) => (e.dataExplorationMessages[e.dataExplorationMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "queryTools" : "filterAgent").addConditionalEdges(
279
233
  "queryTools",
280
234
  (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).
235
+ ).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
236
  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
237
  _Example: “Only show stations where Brand is Shell”_
284
238
  _Example: “Make Shell stations stand out on the map”_
@@ -286,13 +240,15 @@ ${s}` : i = "Vector search completed. No matching layers found.", await c({ text
286
240
  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
241
  _Example: “How many features are there?”_
288
242
  _Example: “What’s the average population?”_
289
- _Example: “Which values are in the status field?”_`, Me = {
243
+ _Example: “Which values are in the status field?”_
244
+
245
+ This agent does NOT handle help/metadata requests such as listing available layers, listing field names/columns/attributes for a layer, or capability guidance.`, fe = {
290
246
  id: "dataExploration",
291
247
  name: "Data Exploration Agent",
292
- description: de,
293
- createGraph: ce,
294
- workspace: $
248
+ description: K,
249
+ createGraph: B,
250
+ workspace: T
295
251
  };
296
252
  export {
297
- Me as D
253
+ fe as D
298
254
  };
@@ -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