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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (300) 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 +121 -0
  36. package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
  37. package/dist/agents/tools/help/listFields/adapter.js +30 -0
  38. package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
  39. package/dist/agents/tools/navigation/goToAddress/adapter.js +60 -0
  40. package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
  41. package/dist/agents/tools/navigation/goToBookmark/adapter.js +30 -0
  42. package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
  43. package/dist/agents/tools/navigation/goToFeatures/adapter.js +50 -0
  44. package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
  45. package/dist/agents/tools/navigation/goToFullExtent/adapter.js +27 -0
  46. package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
  47. package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +24 -0
  48. package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
  49. package/dist/agents/tools/navigation/goToLayer/adapter.js +26 -0
  50. package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
  51. package/dist/agents/tools/navigation/goToScale/adapter.js +21 -0
  52. package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
  53. package/dist/agents/tools/navigation/goToViewpoint/adapter.js +42 -0
  54. package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
  55. package/dist/agents/tools/navigation/goToZoom/adapter.js +21 -0
  56. package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
  57. package/dist/agents/tools/query/getAttribute/adapter.js +40 -0
  58. package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
  59. package/dist/agents/tools/query/getStatistics/adapter.js +157 -0
  60. package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
  61. package/dist/agents/tools/query/getTopFeatures/adapter.js +144 -0
  62. package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
  63. package/dist/agents/tools/query/queryFeatures/adapter.js +130 -0
  64. package/dist/agents/tools/search/findRelevantFields/adapter.d.ts +8 -0
  65. package/dist/agents/tools/search/findRelevantFields/adapter.js +57 -0
  66. package/dist/agents/tools/search/findRelevantLayers/adapter.d.ts +8 -0
  67. package/dist/agents/tools/search/findRelevantLayers/adapter.js +38 -0
  68. package/dist/cdn/22KHSDJI.js +2 -0
  69. package/dist/cdn/2EY3BQQX.js +2 -0
  70. package/dist/cdn/{SWOXSJ62.js → 2O4DON37.js} +1 -1
  71. package/dist/cdn/34O57OGV.js +2 -0
  72. package/dist/cdn/{5W7S2RS4.js → 3UEKINYC.js} +1 -1
  73. package/dist/cdn/4OGR5QKS.js +2 -0
  74. package/dist/cdn/5FL5BTTX.js +66 -0
  75. package/dist/cdn/5HBAJ57P.js +2 -0
  76. package/dist/cdn/5K5ZY267.js +2 -0
  77. package/dist/cdn/5MK44FNO.js +2 -0
  78. package/dist/cdn/5WYRJMBW.js +2 -0
  79. package/dist/cdn/5X7EG7D2.js +2 -0
  80. package/dist/cdn/5XZLS7UO.js +2 -0
  81. package/dist/cdn/5ZFUGNRN.js +2 -0
  82. package/dist/cdn/655YIKL3.js +11 -0
  83. package/dist/cdn/6ECRQVHY.js +2 -0
  84. package/dist/cdn/6OOZSZRJ.js +2 -0
  85. package/dist/cdn/{D3TNNRP4.js → 6P44KOKX.js} +1 -1
  86. package/dist/cdn/6YYPVU7H.js +3 -0
  87. package/dist/cdn/7BCQMK6D.js +2 -0
  88. package/dist/cdn/7SRLZQVC.js +5 -0
  89. package/dist/cdn/7V6OSTFC.js +2 -0
  90. package/dist/cdn/7VAQUCBU.js +9 -0
  91. package/dist/cdn/7VUSIGEM.js +2 -0
  92. package/dist/cdn/ACJTJLZN.js +2 -0
  93. package/dist/cdn/AI6DYOKR.js +181 -0
  94. package/dist/cdn/AKD5UOVX.js +2 -0
  95. package/dist/cdn/ANRQWYU2.js +2 -0
  96. package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
  97. package/dist/cdn/APFZY4PI.js +2 -0
  98. package/dist/cdn/B2JDVLA6.js +2 -0
  99. package/dist/cdn/BE7BRJZD.js +2 -0
  100. package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
  101. package/dist/cdn/C4FEETBZ.js +2 -0
  102. package/dist/cdn/C4JT4S5E.js +2 -0
  103. package/dist/cdn/CCC6LBMY.js +2 -0
  104. package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
  105. package/dist/cdn/CJMUJXPL.js +2 -0
  106. package/dist/cdn/COH3QXWG.js +4 -0
  107. package/dist/cdn/CP5BVGJU.js +2 -0
  108. package/dist/cdn/D5UFYQHN.js +44 -0
  109. package/dist/cdn/EWLXNGKH.js +208 -0
  110. package/dist/cdn/EYOWRGDP.js +2 -0
  111. package/dist/cdn/F5NIRETW.js +2 -0
  112. package/dist/cdn/FDOMMK2M.js +2 -0
  113. package/dist/cdn/FG647IP6.js +2 -0
  114. package/dist/cdn/FJO4KNOZ.js +2 -0
  115. package/dist/cdn/FUF3NAU7.js +2 -0
  116. package/dist/cdn/FXP5UIQU.js +156 -0
  117. package/dist/cdn/{T537PKP4.js → FYZATVB3.js} +1 -1
  118. package/dist/cdn/G2EGT3CF.js +6 -0
  119. package/dist/cdn/G3SF6U2U.js +2 -0
  120. package/dist/cdn/G7OMHU2B.js +2 -0
  121. package/dist/cdn/HAEFC2SJ.js +2 -0
  122. package/dist/cdn/HDACNIZF.js +2 -0
  123. package/dist/cdn/HHFNQR6Z.js +2 -0
  124. package/dist/cdn/HHUQXL3R.js +2 -0
  125. package/dist/cdn/IBZ2NEAO.js +2 -0
  126. package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
  127. package/dist/cdn/ICQCK5D3.js +2 -0
  128. package/dist/cdn/IHP25JWI.js +99 -0
  129. package/dist/cdn/IJVMUS2L.js +14 -0
  130. package/dist/cdn/J6A4AS7E.js +22 -0
  131. package/dist/cdn/J6SZIQJA.js +2 -0
  132. package/dist/cdn/JCOA24UH.js +3 -0
  133. package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
  134. package/dist/cdn/JO5ETMPS.js +2 -0
  135. package/dist/cdn/K2R6XVK3.js +2 -0
  136. package/dist/cdn/KITIP6J2.js +2 -0
  137. package/dist/cdn/KWD2ECTM.js +2 -0
  138. package/dist/cdn/{MODWHY3R.js → LAYVGCPL.js} +6 -4
  139. package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
  140. package/dist/cdn/LLUGJKAQ.js +2 -0
  141. package/dist/cdn/MWYBF3F3.js +66 -0
  142. package/dist/cdn/{VMXLYWUK.js → MXTXJKFE.js} +1 -1
  143. package/dist/cdn/MY47B3CE.js +3 -0
  144. package/dist/cdn/NEV6OZN3.js +71 -0
  145. package/dist/cdn/NNXISHCA.js +14 -0
  146. package/dist/cdn/NZSOJ726.js +2 -0
  147. package/dist/cdn/O4NVW75A.js +2 -0
  148. package/dist/cdn/OE3GW5LE.js +2 -0
  149. package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
  150. package/dist/cdn/ONQ6JSBJ.js +2 -0
  151. package/dist/cdn/OX64WOEL.js +22 -0
  152. package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
  153. package/dist/cdn/PUHRBGKB.js +2 -0
  154. package/dist/cdn/Q57QWN5W.js +2 -0
  155. package/dist/cdn/QUKNPVAF.js +2 -0
  156. package/dist/cdn/R2PQVY4O.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/RVSTAUQS.js +2 -0
  162. package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
  163. package/dist/cdn/{GTLS44GI.js → SXM4NUT5.js} +1 -1
  164. package/dist/cdn/SZ2QSSB3.js +2 -0
  165. package/dist/cdn/T4RIGOXB.js +2 -0
  166. package/dist/cdn/TCH5I5LS.js +2 -0
  167. package/dist/cdn/TEPP7YPR.js +2 -0
  168. package/dist/cdn/TMVF2W5N.js +36 -0
  169. package/dist/cdn/TPULIO6I.js +34 -0
  170. package/dist/cdn/UDRKUVZP.js +2 -0
  171. package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
  172. package/dist/cdn/UHNVDALX.js +18 -0
  173. package/dist/cdn/UZLQALHY.js +2 -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/VOKXKU7M.js +56 -0
  178. package/dist/cdn/VXFQANGJ.js +2 -0
  179. package/dist/cdn/WGO5SER7.js +6 -0
  180. package/dist/cdn/WJXXOKGA.js +9 -0
  181. package/dist/cdn/WKTQVBFJ.js +2 -0
  182. package/dist/cdn/{2SJAOYZT.js → WSWB3B7B.js} +1 -1
  183. package/dist/cdn/XX6GHMNR.js +2 -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/Z5HWPSZN.js +2 -0
  188. package/dist/cdn/Z5W4V7RC.js +2 -0
  189. package/dist/cdn/ZDV4K4WG.js +2 -0
  190. package/dist/cdn/ZOEMBHRF.js +2 -0
  191. package/dist/cdn/ZRVZMPFN.js +2 -0
  192. package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
  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 +1295 -2104
  204. package/dist/chunks/arcgisKnowledgeGraph.js +128 -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 +58 -0
  210. package/dist/chunks/converterUtils.js +66 -41
  211. package/dist/chunks/dataExplorationGraph.js +131 -182
  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 +35 -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 +39 -33
  223. package/dist/chunks/mergeWhereClauses.js +15 -0
  224. package/dist/chunks/navigationGraph.js +140 -116
  225. package/dist/chunks/navigation_intent_prompt.js +8 -2
  226. package/dist/chunks/orchestrator.js +444 -233
  227. package/dist/chunks/resolvePointGeometryFilter.js +92 -0
  228. package/dist/chunks/state.js +21 -27
  229. package/dist/chunks/toolCallResponse.js +14 -10
  230. package/dist/chunks/utils2.js +11 -11
  231. package/dist/components/arcgis-assistant/customElement.d.ts +82 -1
  232. package/dist/components/arcgis-assistant/customElement.js +332 -183
  233. package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
  234. package/dist/components/arcgis-assistant-agent/customElement.js +614 -10
  235. package/dist/components/arcgis-assistant-chat/customElement.js +22 -17
  236. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +20 -4
  237. package/dist/components/arcgis-assistant-help-agent/customElement.js +29 -7
  238. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -0
  239. package/dist/components/arcgis-assistant-interrupt/customElement.js +11 -12
  240. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +12 -8
  241. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  242. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +40 -16
  243. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +30 -7
  244. package/dist/components/arcgis-assistant-message/customElement.d.ts +3 -0
  245. package/dist/components/arcgis-assistant-message/customElement.js +9 -8
  246. package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
  247. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +3 -0
  248. package/dist/components/arcgis-assistant-message-loading/customElement.js +11 -10
  249. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
  250. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  251. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +18 -4
  252. package/dist/components/arcgis-assistant-speech-input/customElement.js +34 -52
  253. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
  254. package/dist/components/arcgis-assistant-user-message/customElement.js +15 -10
  255. package/dist/docs/api.json +1 -1
  256. package/dist/docs/docs.json +1 -1
  257. package/dist/docs/vscode.html-custom-data.json +1 -1
  258. package/dist/docs/web-types.json +1 -1
  259. package/dist/loader.js +6 -6
  260. package/dist/oauth-callback.html +1 -1
  261. package/dist/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
  262. package/dist/types/lumina.d.ts +5 -4
  263. package/dist/types/preact.d.ts +5 -4
  264. package/dist/types/react.d.ts +5 -4
  265. package/dist/types/stencil.d.ts +7 -6
  266. package/dist/utils/index.d.ts +65 -38
  267. package/dist/utils/index.js +56 -55
  268. package/package.json +32 -12
  269. package/dist/cdn/462JBSEV.js +0 -422
  270. package/dist/cdn/5QAHYX7Y.js +0 -5
  271. package/dist/cdn/64PJB5NU.js +0 -2
  272. package/dist/cdn/6AWNQHCO.js +0 -4
  273. package/dist/cdn/AXDZBBNL.js +0 -45
  274. package/dist/cdn/BIV2IPHH.js +0 -2
  275. package/dist/cdn/CCY4TSBO.js +0 -2
  276. package/dist/cdn/CTSALWEP.js +0 -2
  277. package/dist/cdn/D2N2NSRQ.js +0 -72
  278. package/dist/cdn/DOV5ZJ7M.js +0 -2
  279. package/dist/cdn/EEUCKMU7.js +0 -2
  280. package/dist/cdn/EGHBXLNG.js +0 -2
  281. package/dist/cdn/ETRWZ3MS.js +0 -108
  282. package/dist/cdn/EWI4V3GQ.js +0 -36
  283. package/dist/cdn/F2AHA4GB.js +0 -54
  284. package/dist/cdn/I6HNBTWY.js +0 -2
  285. package/dist/cdn/JBHNHHWO.js +0 -3
  286. package/dist/cdn/JOFUPKIB.js +0 -2
  287. package/dist/cdn/KMQ3SP4I.js +0 -5
  288. package/dist/cdn/KUEOKIQR.js +0 -2
  289. package/dist/cdn/LKRAPK4A.js +0 -165
  290. package/dist/cdn/NXKKG5TK.js +0 -2
  291. package/dist/cdn/OBUZ7HBN.js +0 -2
  292. package/dist/cdn/OIVRK7HT.js +0 -2
  293. package/dist/cdn/RUURNLTP.js +0 -2
  294. package/dist/cdn/RVOAPUBN.js +0 -2
  295. package/dist/cdn/TSZPHE7L.js +0 -22
  296. package/dist/cdn/VAZNJSKA.js +0 -16
  297. package/dist/cdn/VNQN5ZQO.js +0 -14
  298. package/dist/cdn/WIDTPVSU.js +0 -2
  299. package/dist/cdn/XER22VYQ.js +0 -3
  300. 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,53 +1,60 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { StateGraph as I, START as k, END as v } from "@langchain/langgraph/web";
3
- import { g as T, O as R, P as C, t as N, Q as V, f as h, R as D, r as z, S as b, 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 n, j as _, 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 $ } 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 n({ text: "Exiting Data Exploration agent" }, e), t), B = async (t, e) => {
18
- await n({ 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: l, userTimezoneOffset: s } = R(), o = {
28
+ const { userTimezone: d, userTimezoneOffset: r } = q(), o = {
23
29
  layerFieldInfo: t.layerFieldInfo,
24
- userTimezone: l,
25
- userTimezoneOffset: s,
30
+ userTimezone: d,
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
- }, r = await _({
31
- promptText: d,
32
- modelTier: "advanced",
36
+ }, i = await M({
37
+ promptText: l,
38
+ modelTier: "default",
39
+ config: e,
33
40
  messages: t.dataExplorationMessages,
34
41
  inputVariables: o,
35
- tools: C
36
- }), i = [...t.dataExplorationMessages, r];
37
- if (!((r.tool_calls?.length ?? 0) > 0))
38
- return await n({ 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, p = r.content.toString();
44
- return await $(r, e), { ...t, dataExplorationMessages: m, outputMessage: p };
45
- }, H = async (t, e) => {
46
- await n({ 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: l, userTimezoneOffset: s } = R(), r = t.agentExecutionContext.sharedState.lastNavigatedFeatures, i = r && typeof r == "object" && "value" in r ? r.value : r;
57
+ const { userTimezone: d, userTimezoneOffset: r } = q(), o = t.agentExecutionContext.sharedState, i = o.lastNavigatedFeatures?.value, n = o.lastResolvedLocation?.value;
51
58
  let c = "none";
52
59
  if (i != null)
53
60
  try {
@@ -55,228 +62,168 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
55
62
  } catch {
56
63
  c = "none";
57
64
  }
58
- const m = {
65
+ let u = "none";
66
+ if (n != null)
67
+ try {
68
+ u = JSON.stringify({
69
+ address: n.address,
70
+ location: n.location
71
+ });
72
+ } catch {
73
+ u = "none";
74
+ }
75
+ const p = {
59
76
  layerFieldInfo: t.layerFieldInfo,
60
- userTimezone: l,
61
- userTimezoneOffset: s,
77
+ userTimezone: d,
78
+ userTimezoneOffset: r,
62
79
  assignedTask: t.agentExecutionContext.assignedTask,
63
80
  userRequest: t.agentExecutionContext.userRequest,
64
81
  priorSteps: t.agentExecutionContext.priorSteps,
65
- lastNavigatedFeatures: c
66
- }, p = await _({
67
- promptText: d,
68
- modelTier: "advanced",
82
+ lastNavigatedFeatures: c,
83
+ lastResolvedLocation: u
84
+ }, g = await M({
85
+ promptText: l,
86
+ modelTier: "default",
87
+ config: e,
69
88
  messages: t.dataExplorationMessages,
70
- inputVariables: m,
71
- tools: V
72
- }), f = (p.tool_calls?.length ?? 0) > 0, g = p.content.toString();
73
- return await $(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],
94
+ dataExplorationMessages: [...t.dataExplorationMessages, g],
76
95
  // Only emit output here when no tools are being called.
77
96
  // For tool-calling flows, downstream summarizer nodes provide the final user-facing message.
78
- ...f ? {} : { outputMessage: g },
97
+ ...f ? {} : { outputMessage: h },
79
98
  status: "success",
80
- summary: g && !f ? N(g) : "Query planning completed."
99
+ summary: h && !f ? v(h) : "Query planning completed."
81
100
  };
82
- }, J = async (t, e) => {
101
+ }, V = async (t, e) => {
83
102
  try {
84
- await n({ text: "Requesting LLM for summary on query results" }, e);
85
- const d = await T("summarize_query_response_prompt"), l = {
103
+ await s({ text: "Requesting LLM for summary on query results" }, e);
104
+ const l = await x("summarize_query_response_prompt"), d = {
86
105
  queryResponse: t.queryResponse,
87
106
  assignedTask: t.agentExecutionContext.assignedTask,
88
107
  userRequest: t.agentExecutionContext.userRequest,
89
108
  priorSteps: t.agentExecutionContext.priorSteps
90
- }, s = await Q({
91
- promptText: d,
109
+ }, r = await A({
110
+ promptText: l,
92
111
  modelTier: "fast",
112
+ config: e,
93
113
  messages: t.dataExplorationMessages,
94
- inputVariables: l
95
- }), o = typeof s == "string" ? s : s.content, r = new j(o);
96
- await n({ text: `Received response from LLM: ${o}` }, e);
97
- 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;
98
118
  return {
99
119
  ...t,
100
- outputMessage: i,
120
+ outputMessage: n,
101
121
  status: "success",
102
- summary: i ? N(i) : "Summary generated.",
103
- dataExplorationMessages: [...t.dataExplorationMessages, r]
122
+ summary: n ? v(n) : "Summary generated.",
123
+ dataExplorationMessages: [...t.dataExplorationMessages, i]
104
124
  };
105
125
  } catch (a) {
106
- throw await n({ 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)}`);
107
127
  }
108
128
  };
109
- async function K(t, e) {
110
- if ((t.queryResponse ?? []).some((s) => {
111
- const o = s.details;
129
+ async function O(t, e) {
130
+ if ((t.queryResponse ?? []).some((r) => {
131
+ const o = r.details;
112
132
  return typeof o == "object" && o !== null && "error" in o;
113
133
  }))
114
- return await n({ text: "Skipping layer filter tool because query response contains an error." }, e), { ...t };
115
- const l = await new O(C, { handleToolErrors: !1 }).invoke(
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(
116
136
  {
117
137
  messages: t.dataExplorationMessages
118
138
  },
119
139
  e
120
140
  );
121
- return await n(
122
- { text: `Finished executing layer filter tool: ${l.messages.map((s) => s.content).join(", ")}` },
141
+ return await s(
142
+ { text: `Finished executing layer filter tool: ${d.messages.map((r) => r.content).join(", ")}` },
123
143
  e
124
144
  ), { ...t };
125
145
  }
126
- const X = 10, Y = ["string", "small-integer", "integer"], Z = async (t, e, { includeSummaryStatistics: a = !0, includeUniqueValues: d = !0 } = {}) => {
127
- let l = null, s = null;
128
- try {
129
- if (e.type !== "geometry" && e.type !== "oid" && e.type !== "global-id") {
130
- a && (l = await G({ layer: t, field: e.name }));
131
- const o = e.domain?.type === "coded-value" ? e.domain : null;
132
- d && (Y.includes(e.type) || o) && (s = (await U({ layer: t, field: e.name })).uniqueValueInfos.sort((r, i) => i.count - r.count).slice(0, X), o && (s = s.map((r) => ({
133
- ...r,
134
- value: o.getName(r.value) ?? r.value
135
- }))));
136
- }
137
- } catch (o) {
138
- console.error(`Error fetching statistics for field ${e.name}:`, o);
139
- }
140
- return {
141
- summaryStatistics: l,
142
- uniqueValues: s
143
- };
144
- };
145
- function ee(t, e) {
146
- return ["string", "small-integer", "integer"].includes(t) || e === "coded-value";
147
- }
148
- async function te(t, e, a, d = !0) {
149
- const l = [], s = [], o = [];
150
- for (const r of t) {
151
- let i = function(y) {
152
- const u = e.get(y)?.layerItem;
153
- return u ? [
154
- u.name && `Name: ${u.name}`,
155
- u.title && `Title: ${u.title}`,
156
- u.description && `Description: ${u.description}`
157
- ].filter(Boolean).join(" | ") : y;
158
- };
159
- const { layerId: c, results: m } = r, p = a.map?.allLayers.find((y) => y.id === c), f = e.get(c)?.fieldRegistry;
160
- if (!f)
161
- continue;
162
- let g = l.find((y) => y.layerId === c);
163
- g || (g = {
164
- layerId: c,
165
- layerSummary: i(c),
166
- fieldInfos: []
167
- }, l.push(g));
168
- for (const y of m) {
169
- const u = f.get(y.name);
170
- if (!u)
171
- continue;
172
- const x = u.statistics, E = d && !x?.summaryStatistics, w = ee(u.type, u.domain?.type) && !x?.uniqueValues, q = E || w;
173
- if (o.push({
174
- layerId: c,
175
- fieldName: u.name,
176
- didFetchStatistics: q
177
- }), q) {
178
- const A = Z(p, u, {
179
- includeSummaryStatistics: E,
180
- includeUniqueValues: w
181
- }).then((F) => {
182
- const S = {
183
- summaryStatistics: x?.summaryStatistics ?? null,
184
- uniqueValues: x?.uniqueValues ?? null
185
- };
186
- E && (S.summaryStatistics = F.summaryStatistics), w && (S.uniqueValues = F.uniqueValues), f.set(u.name, { ...u, statistics: S }), u.statistics = S;
187
- });
188
- s.push(A);
189
- }
190
- g.fieldInfos.push(u);
191
- }
192
- }
193
- return await Promise.all(s), {
194
- layerFieldInfo: l,
195
- didFetchStatistics: s.length > 0,
196
- fieldStatisticsFetchStatus: o
197
- };
198
- }
199
- 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;
200
- function ae(t, e) {
201
- 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);
202
149
  }
203
- const se = async (t, e) => {
150
+ const j = async (t, e) => {
204
151
  try {
205
- await n({ text: "Preparing field information for vector search results" }, e);
206
- const a = h(e, "layersAndFieldsRegistry"), { mapView: d } = D(e), { assignedTask: l, userRequest: s } = t.agentExecutionContext, o = ae(l, s), { layerFieldInfo: r, didFetchStatistics: i, fieldStatisticsFetchStatus: c } = 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 $(
207
154
  t.vectorSearchFieldResults,
208
155
  a,
209
- d,
156
+ l,
210
157
  o
211
158
  );
212
- i ? await n({ text: "Statistics fetched" }, e) : await n({ text: "Statistics skipped" }, e);
213
- for (const m of c)
214
- await n(
159
+ n ? await s({ text: "Statistics fetched" }, e) : await s({ text: "Statistics skipped" }, e);
160
+ for (const u of c)
161
+ await s(
215
162
  {
216
- text: ` - ${m.fieldName} - stats ${m.didFetchStatistics ? "fetched" : "skipped"}`
163
+ text: ` - ${u.fieldName} - stats ${u.didFetchStatistics ? "fetched" : "skipped"}`
217
164
  },
218
165
  e
219
166
  );
220
- return await n({ text: "Field information prepared" }, e), { ...t, layerFieldInfo: r };
167
+ return await s({ text: "Field information prepared" }, e), { ...t, layerFieldInfo: i };
221
168
  } catch (a) {
222
- throw await n({ 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)}`);
223
170
  }
224
- }, L = 0.7, re = 10, oe = async (t, e) => {
171
+ }, S = 0.7, G = 10, W = async (t, e) => {
225
172
  try {
226
- await n({ text: "Similarity search to find fields" }, e);
227
- const a = h(e, "fieldSearch"), d = h(e, "layersAndFieldsRegistry"), l = h(e, "embeddingCache"), s = 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({
228
175
  text: t.agentExecutionContext.assignedTask,
229
176
  layerIds: t.vectorSearchLayerIds,
230
- minScore: L,
231
- topResults: re,
232
- embeddingCache: l
233
- }), o = s.map(({ layerId: i, results: c }) => {
234
- const m = c.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(`
235
182
  `);
236
- return `${d.get(i)?.layerItem.name ?? i}:
237
- ${m}`;
183
+ return `${l.get(n)?.layerItem.name ?? n}:
184
+ ${u}`;
238
185
  }).join(`
239
186
  `);
240
- let r;
241
- return s.length > 0 ? r = `Vector search completed. Matching layers and fields with scores:
242
- ${o}` : r = `No vector search results found for score over ${L}.`, await n({ text: r }, 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), {
243
190
  ...t,
244
- vectorSearchFieldResults: s
191
+ vectorSearchFieldResults: r
245
192
  };
246
193
  } catch (a) {
247
- throw await n(
194
+ throw await s(
248
195
  { text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
249
196
  e
250
197
  ), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
251
198
  }
252
- }, ie = 0.7, ne = async (t, e) => {
199
+ }, H = 0.7, J = async (t, e) => {
253
200
  try {
254
- await n(
201
+ await s(
255
202
  { text: `Similarity search to find layers: ${t.agentExecutionContext.assignedTask}` },
256
203
  e
257
204
  );
258
- const a = h(e, "layerSearch"), d = h(e, "layersAndFieldsRegistry"), l = h(e, "embeddingCache"), s = await a.searchLayers({
205
+ const a = m(e, "layerSearch"), l = m(e, "layersAndFieldsRegistry"), d = m(e, "embeddingCache"), r = await a.searchLayers({
259
206
  text: t.agentExecutionContext.assignedTask,
260
- minScore: ie,
261
- embeddingCache: l
262
- }), o = s.map((c) => c.id), r = s.map(({ id: c, score: m }) => `${d.get(c)?.layerItem.name ?? c} (${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(`
263
210
  `);
264
- let i;
265
- return o.length > 0 ? i = `Vector search completed. Matching layers with scores:
266
- ${r}` : i = "Vector search completed. No matching layers found.", await n({ 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), {
267
214
  ...t,
268
215
  vectorSearchLayerIds: o
269
216
  };
270
217
  } catch (a) {
271
- throw await n(
218
+ throw await s(
272
219
  { text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
273
220
  e
274
221
  ), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
275
222
  }
276
- }, le = (t, e) => z(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
223
+ }, U = (t, e) => N(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
277
224
  t,
278
225
  e
279
- ), ce = () => new I(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(k, "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(
280
227
  "vectorSearchLayers",
281
228
  (e) => e.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
282
229
  ).addConditionalEdges(
@@ -285,7 +232,7 @@ ${r}` : i = "Vector search completed. No matching layers found.", await n({ text
285
232
  ).addEdge("fieldStatistics", "queryAgent").addConditionalEdges("queryAgent", (e) => (e.dataExplorationMessages[e.dataExplorationMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "queryTools" : "filterAgent").addConditionalEdges(
286
233
  "queryTools",
287
234
  (e) => e.queryResponse.length ? "summarizeQueryResponseLLM" : "filterAgent"
288
- ).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).
289
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.
290
237
  _Example: “Only show stations where Brand is Shell”_
291
238
  _Example: “Make Shell stations stand out on the map”_
@@ -293,13 +240,15 @@ ${r}` : i = "Vector search completed. No matching layers found.", await n({ text
293
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.
294
241
  _Example: “How many features are there?”_
295
242
  _Example: “What’s the average population?”_
296
- _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 = {
297
246
  id: "dataExploration",
298
247
  name: "Data Exploration Agent",
299
- description: de,
300
- createGraph: ce,
301
- workspace: b
248
+ description: K,
249
+ createGraph: B,
250
+ workspace: T
302
251
  };
303
252
  export {
304
- Me as D
253
+ fe as D
305
254
  };