@arcgis/ai-components 5.0.0-next.142 → 5.0.0-next.144
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.
- package/dist/cdn/{CKRH3D7E.js → 2GMCG6SX.js} +1 -3
- package/dist/cdn/{66XCWCWM.js → 2LSVWAZO.js} +1 -3
- package/dist/cdn/{5FL7YQKB.js → 3YA7AYJB.js} +2 -4
- package/dist/cdn/6XEDIXV6.js +2 -0
- package/dist/cdn/{24JCMWKT.js → ASR4DPYD.js} +2 -4
- package/dist/cdn/{OTDBA4XE.js → BN4IYD74.js} +3 -5
- package/dist/cdn/{BFVF7YNW.js → CEXAIP2B.js} +2 -4
- package/dist/cdn/{CSL4ICDD.js → COWIXD4Q.js} +73 -71
- package/dist/cdn/{H6MZ7SFC.js → CSFLVW7O.js} +2 -4
- package/dist/cdn/{IGC2ZG54.js → CSKRXBVL.js} +3 -5
- package/dist/cdn/CYROVXBC.js +2 -0
- package/dist/cdn/DCXWRVNH.js +2 -0
- package/dist/cdn/{NVDFU7VX.js → EFU7HGPY.js} +2 -4
- package/dist/cdn/{RMHWRG4L.js → EU7GHH2Y.js} +2 -4
- package/dist/cdn/{AX3ZST6A.js → G65WIFNI.js} +2 -4
- package/dist/cdn/{JXZMU4IY.js → GXFH7ZNV.js} +2 -4
- package/dist/cdn/{TBYAVPLA.js → IFER6W2B.js} +1 -3
- package/dist/cdn/{OJYNONWN.js → IMPD5HA4.js} +2 -4
- package/dist/cdn/{WRLXN2BN.js → IZ4NSOIH.js} +2 -4
- package/dist/cdn/JPUY3X54.js +2 -0
- package/dist/cdn/{D7FVP573.js → JVPRUGML.js} +2 -4
- package/dist/cdn/{CKTQQHF5.js → KRDVOF7K.js} +2 -4
- package/dist/cdn/{I5QITQB4.js → LDS4EYQM.js} +2 -4
- package/dist/cdn/{U4QZ35DS.js → LSDCO6AG.js} +2 -4
- package/dist/cdn/M32BWJ4D.js +14 -0
- package/dist/cdn/{GOYCKSEC.js → MZPFEXP3.js} +2 -4
- package/dist/cdn/{FOJAQIAN.js → NRKOPZOT.js} +2 -4
- package/dist/cdn/{SXJFFROL.js → OEF6YVL2.js} +2 -4
- package/dist/cdn/OV52XKSU.js +2 -0
- package/dist/cdn/QJ3OZMLS.js +2 -0
- package/dist/cdn/{O7NVXQYW.js → QWJL7VTJ.js} +49 -51
- package/dist/cdn/{ORREZ5IF.js → QWUKKFEV.js} +2 -4
- package/dist/cdn/RPD4TRBP.js +2 -0
- package/dist/cdn/{4JD67FWH.js → TBTPT64L.js} +2 -4
- package/dist/cdn/{T24T4RIA.js → U3AQJYZ7.js} +2 -4
- package/dist/cdn/{DZTBEPPB.js → WACZ5XRA.js} +2 -4
- package/dist/cdn/{VJKYCWAW.js → WE5QPXDZ.js} +2 -4
- package/dist/cdn/WZKKSDIC.js +2 -0
- package/dist/cdn/{LTKZHX3O.js → XOLWLHTD.js} +2 -4
- package/dist/cdn/{IPW732KX.js → Y4325EIX.js} +2 -4
- package/dist/cdn/YRUSAZLS.js +2 -0
- package/dist/cdn/assets/assistant/t9n/messages.ar.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.bg.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.bs.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.ca.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.cs.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.da.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.de.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.el.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.es.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.et.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.fi.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.fr.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.he.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.hr.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.hu.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.id.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.it.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.ja.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.ko.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.lt.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.lv.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.nl.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.no.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.pl.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.pt-BR.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.pt-PT.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.ro.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.ru.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.sk.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.sl.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.sr.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.sv.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.th.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.tr.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.uk.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.vi.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.zh-CN.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.zh-HK.json +1 -0
- package/dist/cdn/assets/assistant/t9n/messages.zh-TW.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.ar.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.bg.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.bs.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.ca.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.cs.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.da.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.de.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.el.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.es.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.et.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.fi.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.fr.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.he.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.hr.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.hu.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.id.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.it.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.ja.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.ko.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.lt.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.lv.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.nl.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.no.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.pl.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.pt-BR.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.pt-PT.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.ro.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.ru.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.sk.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.sl.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.sr.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.sv.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.th.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.tr.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.uk.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.vi.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.zh-CN.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.zh-HK.json +1 -0
- package/dist/cdn/assets/assistant-chat-card/t9n/messages.zh-TW.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ar.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.bg.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.bs.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ca.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.cs.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.da.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.de.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.el.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.es.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.et.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.fi.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.fr.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.he.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.hr.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.hu.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.id.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.it.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ja.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ko.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.lt.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.lv.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.nl.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.no.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pl.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pt-BR.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.pt-PT.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ro.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.ru.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sk.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sl.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sr.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.sv.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.th.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.tr.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.uk.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.vi.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-CN.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-HK.json +1 -0
- package/dist/cdn/assets/assistant-chat-entry/t9n/messages.zh-TW.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.ar.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.bg.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.bs.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.ca.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.cs.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.da.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.de.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.el.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.es.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.et.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.fi.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.fr.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.he.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.hr.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.hu.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.id.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.it.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.ja.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.ko.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.lt.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.lv.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.nl.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.no.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.pl.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.pt-BR.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.pt-PT.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.ro.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.ru.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.sk.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.sl.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.sr.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.sv.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.th.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.tr.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.uk.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.vi.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-CN.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-HK.json +1 -0
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-TW.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.ar.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.bg.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.bs.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.ca.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.cs.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.da.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.de.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.el.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.es.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.et.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.fi.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.fr.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.he.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.hr.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.hu.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.id.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.it.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.ja.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.ko.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.lt.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.lv.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.nl.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.no.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.pl.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.pt-BR.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.pt-PT.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.ro.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.ru.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.sk.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.sl.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.sr.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.sv.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.th.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.tr.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.uk.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.vi.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.zh-CN.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.zh-HK.json +1 -0
- package/dist/cdn/assets/assistant-shell/t9n/messages.zh-TW.json +1 -0
- package/dist/cdn/index.js +2 -4
- package/dist/chunks/runtime.js +1 -3
- package/dist/chunks/useT9n.js +1 -3
- package/dist/chunks/utils.js +1 -3
- package/dist/chunks/utils2.js +1 -3
- package/dist/components/arcgis-assistant/customElement.d.ts +117 -3
- package/dist/components/arcgis-assistant/customElement.js +12 -14
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +120 -2
- package/dist/components/arcgis-assistant-agent/customElement.js +1 -3
- package/dist/components/arcgis-assistant-chat/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-chat/customElement.js +1 -3
- package/dist/components/arcgis-assistant-chat-card/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-chat-card/customElement.js +1 -3
- package/dist/components/arcgis-assistant-chat-card-content/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-chat-card-content/customElement.js +1 -3
- package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +1 -3
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.d.ts +28 -1
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -3
- package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-interrupt/customElement.js +1 -3
- package/dist/components/arcgis-assistant-layer-filter-agent/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-layer-filter-agent/customElement.js +1 -3
- package/dist/components/arcgis-assistant-layer-query-agent/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-layer-query-agent/customElement.js +1 -3
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -3
- package/dist/components/arcgis-assistant-navigation-agent/customElement.d.ts +28 -1
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -3
- package/dist/components/arcgis-assistant-shell/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-shell/customElement.js +1 -3
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -3
- package/dist/loader.js +1 -3
- package/package.json +7 -10
- package/dist/cdn/6TRADBDX.js +0 -4
- package/dist/cdn/AZXT5TQZ.js +0 -4
- package/dist/cdn/C7MRAIMT.js +0 -4
- package/dist/cdn/CGJ7JDHZ.js +0 -4
- package/dist/cdn/NJFAKO5H.js +0 -4
- package/dist/cdn/OZOKZDFZ.js +0 -4
- package/dist/cdn/PJLEYE2O.js +0 -4
- package/dist/cdn/QAZKKZAI.js +0 -4
- package/dist/cdn/RZJUO3P6.js +0 -4
- package/dist/cdn/TXLUBMGN.js +0 -16
|
@@ -1,28 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import a from"./O7NVXQYW.js";import{Fa as N,J as O,M as Z,Q as j,aa as K}from"./IGC2ZG54.js";export default $arcgis.t(([tt,oe,Ne,rt,{addressToLocations:at},Re,V,U,ie,ne,Ae,qe,se,ke,{createRenderer:ot},{getSchemesByTag:it,getSchemes:nt},{getBackgroundColorTheme:Te},{createAgeRenderer:st,createContinuousRenderer:lt},{getSchemesByTag:le},{createContinuousRenderer:ct},{createRenderer:dt},{getSchemesByTag:ut},{createRenderer:mt},{getSchemesByTag:ht},{createRenderer:ft},{getSchemesByTag:gt},{createRenderer:yt},{getSchemesByTag:pt},{createAgeRenderer:wt,createContinuousRenderer:bt},{createRenderer:St},{getSchemesByTag:vt},{a:ge,b:ye,c:p,d:g,e:n,f:R,g:x,h:pe,i:G,j:W,k:we,l:A,m:$,n:m,o:E,p:Y,q:be,r:C}])=>{var ve=e=>Array.isArray(e)&&e.every(O),Ze=e=>typeof e=="object"&&e!=null&&"messages"in e&&ve(e.messages),Ke=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,L=class extends we{constructor(r,t){let{name:a,tags:o,handleToolErrors:i}=t??{};super({name:a,tags:o,func:(s,l)=>this.run(s,l)}),Object.defineProperty(this,"tools",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"handleToolErrors",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"trace",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.tools=r,this.handleToolErrors=i??this.handleToolErrors}async runTool(r,t){let a=this.tools.find(o=>o.name===r.name);try{if(a===void 0)throw new Error(`Tool "${r.name}" not found.`);let o=await a.invoke({...r,type:"tool_call"},t);return O(o)&&o.getType()==="tool"||W(o)?o:new Z({status:"success",name:a.name,content:typeof o=="string"?o:JSON.stringify(o),tool_call_id:r.id})}catch(o){if(!this.handleToolErrors||ye(o))throw o;return new Z({status:"error",content:`Error: ${o.message}
|
|
5
|
-
Please fix your mistakes.`,name:r.name,tool_call_id:r.id??""})}}async run(r,t){let a;if(Ke(r))a=[await this.runTool(r.lg_tool_call,t)];else{let s;if(ve(r))s=r;else if(Ze(r))s=r.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let l=new Set(s.filter(c=>c.getType()==="tool").map(c=>c.tool_call_id)),d;for(let c=s.length-1;c>=0;c-=1){let u=s[c];if(u.getType()==="ai"){d=u;break}}if(d?.getType()!=="ai")throw new Error("ToolNode only accepts AIMessages as input.");a=await Promise.all(d.tool_calls?.filter(c=>c.id==null||!l.has(c.id)).map(c=>this.runTool(c,t))??[])}if(!a.some(W))return Array.isArray(r)?a:{messages:a};let o=[],i=null;for(let s of a)W(s)?s.graph===G.PARENT&&Array.isArray(s.goto)&&s.goto.every(l=>pe(l))?i?i.goto.push(...s.goto):i=new G({graph:G.PARENT,goto:s.goto}):o.push(s):o.push(Array.isArray(r)?[s]:{messages:[s]});return i&&o.push(i),o}};var Rn=g.Root({llmInputMessages:g({reducer:(e,r)=>$([],r),default:()=>[]})});var ze=g.Root({messages:g({reducer:$,default:()=>[]}),outputMessage:g({reducer:(e="",r)=>{let t=typeof r=="string"?r.trim():"";if(!t)return e;let a=e.trim();if(!a)return t;if(a===t)return e;let o=a.split(`
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
+
import a from"./QWJL7VTJ.js";import{Fa as N,J as O,M as J,Q as j,aa as Z}from"./CSKRXBVL.js";export default $arcgis.t(([tt,oe,Ne,rt,{addressToLocations:at},Re,V,K,ie,ne,Ae,qe,se,ze,{createRenderer:ot},{getSchemesByTag:it,getSchemes:nt},{getBackgroundColorTheme:Te},{createAgeRenderer:st,createContinuousRenderer:lt},{getSchemesByTag:le},{createContinuousRenderer:ct},{createRenderer:dt},{getSchemesByTag:ut},{createRenderer:mt},{getSchemesByTag:ht},{createRenderer:ft},{getSchemesByTag:gt},{createRenderer:yt},{getSchemesByTag:pt},{createAgeRenderer:wt,createContinuousRenderer:bt},{createRenderer:vt},{getSchemesByTag:St},{a:ge,b:ye,c:p,d:y,e:s,f:R,g:x,h:pe,i:P,j:W,k:we,l:A,m:$,n:m,o:E,p:Y,q:be,r:C}])=>{var Se=e=>Array.isArray(e)&&e.every(O),Je=e=>typeof e=="object"&&e!=null&&"messages"in e&&Se(e.messages),Ze=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,L=class extends we{constructor(r,t){let{name:a,tags:o,handleToolErrors:i}=t??{};super({name:a,tags:o,func:(n,l)=>this.run(n,l)}),Object.defineProperty(this,"tools",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"handleToolErrors",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"trace",{enumerable:!0,configurable:!0,writable:!0,value:!1}),this.tools=r,this.handleToolErrors=i??this.handleToolErrors}async runTool(r,t){let a=this.tools.find(o=>o.name===r.name);try{if(a===void 0)throw new Error(`Tool "${r.name}" not found.`);let o=await a.invoke({...r,type:"tool_call"},t);return O(o)&&o.getType()==="tool"||W(o)?o:new J({status:"success",name:a.name,content:typeof o=="string"?o:JSON.stringify(o),tool_call_id:r.id})}catch(o){if(!this.handleToolErrors||ye(o))throw o;return new J({status:"error",content:`Error: ${o.message}
|
|
3
|
+
Please fix your mistakes.`,name:r.name,tool_call_id:r.id??""})}}async run(r,t){let a;if(Ze(r))a=[await this.runTool(r.lg_tool_call,t)];else{let n;if(Se(r))n=r;else if(Je(r))n=r.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let l=new Set(n.filter(c=>c.getType()==="tool").map(c=>c.tool_call_id)),d;for(let c=n.length-1;c>=0;c-=1){let u=n[c];if(u.getType()==="ai"){d=u;break}}if(d?.getType()!=="ai")throw new Error("ToolNode only accepts AIMessages as input.");a=await Promise.all(d.tool_calls?.filter(c=>c.id==null||!l.has(c.id)).map(c=>this.runTool(c,t))??[])}if(!a.some(W))return Array.isArray(r)?a:{messages:a};let o=[],i=null;for(let n of a)W(n)?n.graph===P.PARENT&&Array.isArray(n.goto)&&n.goto.every(l=>pe(l))?i?i.goto.push(...n.goto):i=new P({graph:P.PARENT,goto:n.goto}):o.push(n):o.push(Array.isArray(r)?[n]:{messages:[n]});return i&&o.push(i),o}};var kn=y.Root({llmInputMessages:y({reducer:(e,r)=>$([],r),default:()=>[]})});var Me=y.Root({messages:y({reducer:$,default:()=>[]}),outputMessage:y({reducer:(e="",r)=>{let t=typeof r=="string"?r.trim():"";if(!t)return e;let a=e.trim();if(!a)return t;if(a===t)return e;let o=a.split(`
|
|
6
4
|
|
|
7
5
|
`);return o[o.length-1]?.trim()===t?e:`${e}
|
|
8
6
|
|
|
9
|
-
${t}`},default:()=>""}),intent:
|
|
7
|
+
${t}`},default:()=>""}),intent:y({reducer:(e,r)=>r}),vectorSearchLayerResults:y({reducer:(e,r)=>r,default:()=>[]}),vectorSearchFieldResults:y({reducer:(e,r)=>r})});async function Tt(e,r){let t="https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer";console.log(`[goToAddress] Geocoding: ${e}`);let a=(await at(t,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!a?.extent)throw new Error(`Could not find location for: ${e}`);let{xmin:o,ymin:i,xmax:n,ymax:l,spatialReference:d}=a.extent,c=new Ne({xmin:o,ymin:i,xmax:n,ymax:l,spatialReference:d}),u=(o+n)/2,h=(i+l)/2,g=new oe({x:u,y:h,spatialReference:d}),f=new rt({style:"circle",color:"red",size:12}),w=new tt({geometry:g,symbol:f});return r.graphics.removeAll(),r.graphics.add(w),await r.goTo(c),`Successfully zoomed to: ${a.address}. Location coordinates: x=${u}, y=${h}, wkid=${d.wkid}`}var xt=["mapView"];function F(e){let r=e?.configurable?.context;if(!r||typeof r!="object")throw new Error("NavigationAgent context missing");let t=xt.filter(a=>!(a in r));if(t.length)throw new Error(`NavigationAgent context missing: ${t.join(", ")}`);return r}async function Et({address:e},r){let{mapView:t}=F(r);return await Tt(e,t)}var Lt=s.object({address:s.string().describe("The full address or place name to locate.")}),It=p(Et,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:Lt});async function $t(e,r){let t=r.map.bookmarks;if(!t||t.length===0)throw new Error("No bookmarks found in the map.");let a=t.find(i=>i.name===e);if(!a)throw new Error(`Bookmark with name "${e}" not found.`);let o=a.viewpoint;if(!o)throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);return await r.goTo(o),`Navigated to bookmark: ${e}`}async function Ft({bookmarkName:e},r){let{mapView:t}=F(r);return await Promise.resolve($t(e,t))}var _t=N.object({bookmarkName:N.string().describe("The name of the bookmark to navigate to.")}),Nt=p(Ft,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:_t});async function Rt(e,r,t){let a=t.map?.allLayers.find(i=>i.id===e);if(!a)return`Error: Layer with id ${e} not found`;let o=a.createQuery();o.where=r??"1=1";try{let{extent:i,count:n}=await a.queryExtent(o);if(n===0)return`No features found in ${a.title} matching: ${r}`;if(i)await t.goTo(i);else return`Error: Unable to determine extent for ${a.title}`;return`Successfully zoomed to ${n} feature(s) in ${a.title}`}catch(i){return console.error("Error in goToFeatures:",i),`Error: ${i instanceof Error?i.message:"Unknown error"}`}}async function At({layerId:e,where:r},t){let{mapView:a}=F(t);return await Rt(e,r,a)}var qt=N.object({layerId:N.string().describe("The layerId of the layer to zoom to."),where:N.string().describe("The sql-92 where clause used to query features to zoom to")}),zt=p(At,{name:"goToFeatures",description:"Go to the features that match the given filter related to the given layerId.",schema:qt});async function Mt(e){let r=new Ne({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await e.goTo(r),"Successfully zoomed to world extent"}async function kt(e,r){let{mapView:t}=F(r);return await Mt(t)}var Ct=N.object({}),jt=p(kt,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:Ct});async function Vt(e){let r=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(r)await e.goTo(r);else throw new Error("Initial extent is undefined");return"Successfully zoomed to home extent"}async function Ot(e,r){let{mapView:t}=F(r);return await Vt(t)}var Dt=s.object({}),Bt=p(Ot,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:Dt});async function Qt(e,r){await r.when();let t=r.map?.allLayers.find(o=>o.id===e);if(!t)return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`),`Could not find layer for: ${e}`;console.log(`[goToLayer] Zooming to layer: ${t.title}`);let a=t.fullExtent;return a?(await r.goTo(a),t.visible=!0,`Successfully zoomed to: ${t.title??""}`):"Layer has no defined extent. Cannot zoom to layer."}async function Gt({layerId:e},r){let{mapView:t}=F(r);return await Qt(e,t)}var Pt=N.object({layerId:N.string().describe("The id of the layer to navigate to")}),Wt=p(Gt,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:Pt});async function Kt(e,r){return await r.goTo({scale:e}),`Successfully zoomed to: ${e}`}async function Ht({scale:e},r){let{mapView:t}=F(r);return await Kt(e,t)}var Ut=s.object({scale:s.number().describe("The map scale of the view to go to.")}),Jt=p(Ht,{name:"goToScale",description:"Go to the specified view scale.",schema:Ut});async function Zt(e,r,t){let a={target:new oe({longitude:e.longitude,latitude:e.latitude,spatialReference:{wkid:4326}})};return t?.zoom!==void 0&&(a.zoom=t.zoom),t?.scale!==void 0&&(a.scale=t.scale),await r.goTo(a),`Successfully navigated to: ${[`(${e.latitude}\xB0, ${e.longitude}\xB0)`,t?.zoom!==void 0?`zoom ${t.zoom}`:"",t?.scale!==void 0?`scale 1:${t.scale}`:""].filter(Boolean).join(", ")}`}async function Yt({center:e,zoom:r,scale:t},a){let{mapView:o}=F(a);return await Zt(e,o,{zoom:r,scale:t})}var Xt=s.object({center:s.object({longitude:s.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:s.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:s.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:s.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),er=p(Yt,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:Xt});async function tr(e,r){return await r.goTo({zoom:e}),`Successfully zoomed to: ${e}`}async function rr({zoom:e},r){let{mapView:t}=F(r);return await tr(e,t)}var ar=s.object({zoom:s.number().min(1).max(20).describe("The zoom level of the view to go to.")}),or=p(rr,{name:"goToZoom",description:'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',schema:ar}),ce=[It,Nt,zt,jt,Bt,Wt,Jt,er,or],xe=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_intent_prompt.md":()=>import("./BN4IYD74.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./M32BWJ4D.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./GXFH7ZNV.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./G65WIFNI.js").then(e=>e.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./WE5QPXDZ.js").then(e=>e.default),"../agents/help/prompts/help_prompt.md":()=>import("./XOLWLHTD.js").then(e=>e.default),"../agents/layerFilter/prompts/layer_filter_prompt.md":()=>import("./Y4325EIX.js").then(e=>e.default),"../agents/layerQuery/prompts/data_query_prompt.md":()=>import("./3YA7AYJB.js").then(e=>e.default),"../agents/layerQuery/prompts/summarize_query_response_prompt.md":()=>import("./JVPRUGML.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./TBTPT64L.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./LDS4EYQM.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./IMPD5HA4.js").then(e=>e.default)});async function q(e){let r=Object.entries(xe).find(([t])=>t.endsWith(`/${e}.md`));if(console.log(`entry for prompt "${e}":`,r),!r)throw new Error(`Prompt not found: ${e}
|
|
10
8
|
Available prompts:
|
|
11
9
|
${Object.keys(xe).join(`
|
|
12
|
-
`)}`);return await r[1]()}var ir=(e,r=3)=>e.filter(t=>t instanceof
|
|
13
|
-
`):"",
|
|
10
|
+
`)}`);return await r[1]()}var ir=(e,r=3)=>e.filter(t=>t instanceof Z).slice(-r),v=(e,r=3)=>{let t=e.map((o,i)=>o instanceof Z?i:-1).filter(o=>o!==-1);if(t.length===0)return[];let a=t.length>r?t[t.length-r]:t[0];return e.slice(a)},_=(e,r=" ")=>ir(e).map(t=>t.content).join(r).trim();async function nr(e,r){let t=await q("navigation_tool_prompt"),{mapView:a}=F(r),o=a.map,i=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((w,S)=>`${S+1}. layerId=${w.id} | title=${w.title??""} | name=${w.name??""} | score=${w.score.toFixed(2)}`).join(`
|
|
11
|
+
`):"",n=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",l=e.intent==="goToBookmark"&&o.bookmarks?.length?`Available bookmarks:
|
|
14
12
|
${JSON.stringify(o.bookmarks,null,2)}`:"",d=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
|
|
15
13
|
${i}`:"",c=e.intent==="goToFeatures"&&e.vectorSearchFieldResults?.length?`Candidate fields:
|
|
16
|
-
${
|
|
17
|
-
`);await m({text:`Finished executing navigation tool: ${a}`},r);let o=[...e.messages,...t.messages],i=t.messages.map(
|
|
18
|
-
`);return{...e,messages:o,outputMessage:i}}async function lr(e){let r=await q("navigation_intent_prompt"),t={tools:ce.map(
|
|
19
|
-
`)},a=
|
|
20
|
-
${
|
|
21
|
-
`)}`:
|
|
22
|
-
${
|
|
23
|
-
${
|
|
14
|
+
${n}`:"",u={intent:e.intent,bookmarksSection:l,layersSection:d,fieldsSection:c,currentZoom:a.zoom},h=await C({promptText:t,messages:v(e.messages),inputVariables:u,tools:ce}),g=[...e.messages,h],f=(h.tool_calls?.length??0)>0?[...g]:[...g,h];return{...e,messages:f}}async function sr(e,r){let t=await new L(ce).invoke({messages:v(e.messages)},r),a=t.messages.map(n=>n.text).join(`
|
|
15
|
+
`);await m({text:`Finished executing navigation tool: ${a}`},r);let o=[...e.messages,...t.messages],i=t.messages.map(n=>n.text).join(`
|
|
16
|
+
`);return{...e,messages:o,outputMessage:i}}async function lr(e){let r=await q("navigation_intent_prompt"),t={tools:ce.map(n=>({name:n.name,description:n.description,schema:n.schema})).map(({name:n,description:l,schema:d})=>`${n}: ${l}, ${JSON.stringify(d)}`).join(`
|
|
17
|
+
`)},a=s.object({intent:s.string()}),o=await be({promptText:r,modelTier:"fast",messages:v(e.messages),inputVariables:t,schema:a}),i=typeof o.intent=="string"?o.intent.trim().replace(/^"|"$/gu,""):"";return{...e,intent:i||""}}var b=(e,r)=>{let t=e?.configurable?.services?.[r];if(t==null)throw new Error(`${r} missing in config.configurable.services`);return t},cr=.7,dr=async(e,r)=>{try{let t=_(e.messages);await m({text:`Similarity search to find layers: ${t}`},r);let a=b(r,"layerSearch"),o=b(r,"layersAndFieldsRegistry"),i=b(r,"embeddingCache"),n=(await a.searchLayers({text:t,minScore:cr,embeddingCache:i})).map(({id:d,score:c})=>{let u=o.get(d)?.layerItem;return{id:d,title:u?.title,name:u?.name??void 0,score:c}}),l;return n.length>0?l=`Vector search completed. Matching layers:
|
|
18
|
+
${n.map(d=>`- layerId=${d.id} | title=${d.title??""} | name=${d.name??""} | score=${d.score.toFixed(2)}`).join(`
|
|
19
|
+
`)}`:l="Vector search completed. No matching layers found.",await m({text:l},r),{...e,vectorSearchLayerResults:n}}catch(t){throw await m({text:`Error during vector search layers: ${t instanceof Error?t.message:String(t)}`},r),t}},Ee=.7,ur=10,mr=async(e,r)=>{try{let t=_(e.messages);await m({text:"Similarity search to find fields"},r);let a=b(r,"fieldSearch"),o=b(r,"layersAndFieldsRegistry"),i=b(r,"embeddingCache"),n=e.vectorSearchLayerResults?.map(c=>c.id)??[];if(n.length===0)return await m({text:"No candidate layers for field search"},r),e;let l=(await a.searchFields({text:t,layerIds:n,minScore:Ee,topResults:ur,embeddingCache:i})).map(({layerId:c,results:u})=>{let h=o.get(c)?.fieldRegistry;return{layerId:c,layerName:o.get(c)?.layerItem.name,results:u.map(g=>{let f=h?.get(g.name);return{name:g.name,score:g.score,type:f?.type,alias:f?.alias,description:f?.description,statistics:f?.statistics}})}}),d;return l.length>0?d=`Vector search completed. Matching layers and fields:
|
|
20
|
+
${l.map(c=>`${c.layerName??c.layerId}:
|
|
21
|
+
${c.results.map(u=>` - ${u.name} (${u.score.toFixed(2)})`).join(`
|
|
24
22
|
`)}`).join(`
|
|
25
|
-
`)}`:
|
|
23
|
+
`)}`:d=`No vector search field results found for score over ${Ee}.`,await m({text:d},r),{...e,vectorSearchFieldResults:l}}catch(t){throw await m({text:`Error during vector search fields: ${t instanceof Error?t.message:String(t)}`},r),t}},D=(e,r)=>(t,a)=>{let o=a?.configurable?.services;for(let i of e)if(!o?.[i])throw new Error(`${r} requires services.${i} to be available.`);return t},hr=(e,r)=>D(["layerSearch","layersAndFieldsRegistry"],"Navigation Agent")(e,r),fr=()=>new A(Me).addNode("requireNavigationServices",hr).addNode("intentLLM",lr).addNode("vectorSearchLayers",dr).addNode("vectorSearchFields",mr).addNode("agent",nr).addNode("tools",sr).addEdge(R,"requireNavigationServices").addEdge("requireNavigationServices","intentLLM").addConditionalEdges("intentLLM",e=>e.intent==="goToLayer"||e.intent==="goToFeatures"?"vectorSearchLayers":"agent",{vectorSearchLayers:"vectorSearchLayers",agent:"agent"}).addConditionalEdges("vectorSearchLayers",e=>e.intent==="goToFeatures"?"vectorSearchFields":"agent",{vectorSearchFields:"vectorSearchFields",agent:"agent"}).addEdge("vectorSearchFields","agent").addEdge("agent","tools").addEdge("tools",x),gr=String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
|
|
26
24
|
This includes zooming, panning, centering, or geocoding based on user input. The agent is designed to handle explicit map movement requests. NOTE: DO NOT call this agent if the user asks "where is... " or "show me...", that is meant to be handled by another agent.
|
|
27
25
|
|
|
28
26
|
Supported actions:
|
|
@@ -40,19 +38,19 @@ ${d.results.map(c=>` - ${c.name} (${c.score.toFixed(2)})`).join(`
|
|
|
40
38
|
_Example: “Center the map on San Francisco at scale 50000”_
|
|
41
39
|
_Example: “Zoom to the features in the schools layer where city = 'Austin'”_
|
|
42
40
|
_Example: “Go to the Downtown bookmark”_
|
|
43
|
-
_Example: “Zoom to 1600 Pennsylvania Ave”_`,
|
|
41
|
+
_Example: “Zoom to 1600 Pennsylvania Ave”_`,qs={id:"navigation",name:"Navigation Agent",description:gr,createGraph:fr,workspace:Me},ke=y.Root({messages:y({reducer:$,default:()=>[]}),outputMessage:y({reducer:(e="",r)=>{let t=typeof r=="string"?r.trim():"";if(!t)return e;let a=e.trim();if(!a)return t;if(a===t)return e;let o=a.split(`
|
|
44
42
|
|
|
45
43
|
`);return o[o.length-1]?.trim()===t?e:`${e}
|
|
46
44
|
|
|
47
|
-
${t}`},default:()=>""}),vectorSearchLayerIds:g(),vectorSearchFieldResults:g(),layerFieldInfo:g(),queryResponse:g()}),yr=async(e,r)=>(await m({text:"Exiting Data Exploration agent"},r),e),B=async(e,r)=>{let t=e.tool_calls??[];if(t.length===0){await m({text:`LLM did not request any tool calls: ${String(e?.content)}`},r);return}await Promise.all(t.map(async a=>await m({text:`LLM requested tool call with arguments: ${JSON.stringify(a.args,null,2)}`},r))),console.log("LLM response:",JSON.stringify(e.tool_calls,null,2))},de=async(e,r,t)=>{let a=e.map?.allLayers.find(i=>i.id===r),o=a.createQuery();o.where=t??"1=1";try{let{extent:i,count:s}=await a.queryExtent(o);return!i||s===0?{success:!1,error:`No features found for where clause: ${t}`}:(await e.goTo(i),{success:!0})}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}},pr=async(e,r,t)=>{let a=t.map?.allLayers.find(s=>s.id===e);if(!a)return`Could not find layer with ID: ${e}`;a.definitionExpression=r,a.visible=!0;let o=await de(t,e,r),i=a.title??a.layerId;return o.success?`Applied definition expression to layer "${a.title??e}": ${r}`:`Applied filter to "${i}" but no features matched. ${o.error}`},wr=["mapView"];function k(e){let r=e?.configurable?.context;if(!r||typeof r!="object")throw new Error("DataExplorationAgent context missing");let t=wr.filter(a=>!(a in r));if(t.length)throw new Error(`DataExplorationAgent context missing: ${t.join(", ")}`);return r}var br=async({layerId:e,definitionExpression:r},t)=>{let{mapView:a}=k(t);return await pr(e,r,a)},Sr=n.object({layerId:n.string().describe("The layerId of the layer on which to set a definitionExpression."),definitionExpression:n.string().describe("The SQL-92 where clause used to set a definition expression on the layer.")}),vr=p(br,{name:"setDefinitionExpression",description:"Set a SQL-92 where clause to the definition expression of a layer (i.e. a server-side filter). This filters features at the server level, affecting all views of the layer. Do not prioritize this tool unless specifically asked for or implied for server level, affecting all views of the layer.",schema:Sr});function te(e){return"point"in e&&e.point!==void 0}function re(e){return"layerId"in e&&e.layerId!==void 0}var Q=async(e,r)=>{if(te(e)){let{point:t}=e;return{geometry:new oe({x:t.x,y:t.y,spatialReference:t.spatialReference?{wkid:t.spatialReference.wkid}:r.spatialReference})}}if(re(e)){let t=r.map?.allLayers.find(a=>a.id===e.layerId);if(!t)return{error:`Could not find geometry layer with ID: ${e.layerId}`};try{let a=await t.queryFeatures({where:e.where,returnGeometry:!0,outSpatialReference:r.spatialReference});if(!a.features.length)return{error:`No features found in geometry layer with the specified where clause: ${e.where}`};let o;if(a.features.length===1){let i=a.features[0].geometry;if(!i)return{error:"The geometry of the first feature is undefined or null."};o=i}else{let i=a.features.map(l=>l.geometry),s=U.executeMany(i);if(!s)return{error:"Failed to create a combined geometry."};o=s}return o.spatialReference||(o.spatialReference=r.spatialReference),{geometry:o}}catch(a){return{error:`Failed to query geometry: ${String(a)}`}}}return{error:"Invalid geometry configuration provided"}},Tr=async(e,r,t,a,o)=>{let i=r.map?.allLayers.find(c=>c.id===e.layerId);if(!i)return`Could not find target layer with ID: ${e.layerId}`;let s;if(o){let c=await Q(o,r);if("error"in c)return c.error;s=c.geometry}i.featureEffect=null,i.featureEffect=new Re({filter:new V({where:e.where,geometry:s,spatialRelationship:"intersects",distance:o?.distance,units:o?.units}),includedEffect:t,excludedEffect:a}),i.visible=!0;let l=await de(r,o?o.layerId:e.layerId,o?o.where:e.where),d=i.title??e.layerId;return l.success?`Applied feature effects to target layer "${i.title??e.layerId}"${o?` using geometry from layer "${o.layerId}"`:""}.`:`Applied filter to "${d}" but no features matched. ${l.error}`},xr=["feet","kilometers","meters","miles","nautical-miles","us-nautical-miles"],z=n.enum(xr),Er=async({targetLayer:e,geometryLayer:r,includedEffect:t="drop-shadow(2px, 2px, 2px, gray)",excludedEffect:a="grayscale(100%) opacity(60%) blur(2px)"},o)=>{let{mapView:i}=k(o);return await Tr(e,i,t,a,r)},Lr=n.object({targetLayer:n.object({layerId:n.string().describe("The layerId of the layer on which to set a feature effect."),where:n.string().describe("The SQL-92 where clause representing the features to emphasize.")}),geometryLayer:n.object({layerId:n.string().describe("The layerId of the layer containing the geometry by which to filter."),where:n.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:n.number().describe("The distance by which to filter the input geometry."),units:z.describe("The units used to filter by geometry and distance.")}).optional().describe("Optional geometry-based filtering parameters for spatial queries."),includedEffect:n.string().optional().default("drop-shadow(2px, 2px, 2px, gray)").describe("The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."),excludedEffect:n.string().optional().default("grayscale(100%) opacity(60%) blur(2px)").describe("The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified.")}),Ir=p(Er,{name:"setFeatureEffect",description:"Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",schema:Lr}),$r=async(e,r,t)=>{let a=r.map?.allLayers.find(d=>d.id===e.layerId);if(!a)return`Could not find target layer with ID: ${e.layerId}`;let o;if(t){let d=await Q(t,r);if("error"in d)return d.error;o=d.geometry}let i=await r.whenLayerView(a);i.filter=null,i.filter=new V({where:e.where,geometry:o,spatialRelationship:"intersects",distance:t?.distance,units:t?.units}),a.visible=!0;let s=await de(r,t?t.layerId:e.layerId,t?t.where:e.where),l=a.title??e.layerId;return s.success?`Applied feature filter to layer "${a.title??e.layerId}"${t?` using geometry from layer "${t.layerId}"`:""}.`:`Applied filter to "${l}" but no features matched. ${s.error}`},Fr=async({targetLayer:e,geometryLayer:r},t)=>{let{mapView:a}=k(t);return await $r(e,a,r)},_r=n.object({targetLayer:n.object({layerId:n.string().describe("The layerId of the layer on which to set a filter."),where:n.string().describe("The SQL-92 where clause representing the features to display.")}),geometryLayer:n.object({layerId:n.string().describe("The layerId of the layer containing the geometry by which to filter."),where:n.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:n.number().describe("The distance by which to filter the input geometry."),units:z.describe("The units used to filter by geometry and distance.")}).optional().describe("Optional geometry-based filtering parameters for spatial queries.")}),Nr=p(Fr,{name:"setFeatureFilter",description:"Sets a client-side filter using a where clause, geometry filter, or both on a target layer. This filters features at the client level in the view.",schema:_r}),ae=(e,r,t)=>{if(e&&typeof e!="function"){let a="getField"in t&&t.getField?.(e),o=a&&"getFieldDomain"in t&&t.getFieldDomain?t.getFieldDomain(a.name):null;if(o?.type==="coded-value"){let i=o.codedValues.find(s=>s.code===r);return i?i.name:null}}return null},Rr=(e,r,t)=>{let a=e.createQuery();return a.outFields=[r],a.where=t||"1=1",a.num=1,a},Ar=async(e,r,t,a)=>{let o=a.map?.allLayers.find(c=>c.id===e),i=Rr(o,r,t.where),s=(await o.queryFeatures(i)).features[0],l=s?s.attributes[r]:null,d=ae(r,l,o)||l;return{tool:"getAttribute",layerName:o.title??e,summary:`${r} = ${d}`,details:{fieldName:r,value:d,where:t.where}}};async function qr({layerId:e,fieldName:r,query:t},a){let{mapView:o}=k(a),i=await Ar(e,r,t,o);return JSON.stringify(i,null,2)}var kr=n.object({layerId:n.string().describe("The layerId of the layer containing the field from which to get a value."),fieldName:n.string().describe("The name of the field/attribute from which to get a field value."),query:n.object({where:n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")})}),zr=p(qr,{name:"getAttribute",description:"Returns an attribute value for a given feature.",schema:kr}),ue=(e,r)=>r?e.hasAllFeaturesInView:e.hasAllFeatures,Mr=async e=>{let{targetLayer:r,fieldName:t,statisticType:a,mapView:o,layersAndFieldsRegistry:i,geometryLayer:s}=e,l=o.map?.allLayers.find(T=>T.id===r.layerId);if(!l)throw new Error(`Layer '${r.layerId}' not found.`);let d=await o.whenLayerView(l),c=i.get(r.layerId)?.fieldRegistry.get(t);if(!c)throw new Error(`Field '${t}' not found.`);let u,h;if(s){let T=await Q(s,o);if("error"in T)throw new Error(T.error);if(!T.geometry)throw new Error(`No features found matching: ${s.where}`);u={geometryLayerId:s.layerId,geometryWhere:s.where,distance:s.distance,units:s.units,applied:!0},h=new V({geometry:T.geometry,distance:s.distance,units:s.units,spatialRelationship:"intersects"})}let y=ue(d,!1),f=null,w=null,v=10;if(c.type!=="geometry"&&c.type!=="oid"&&c.type!=="global-id")try{f=await ie({layer:l,useFeaturesInView:y,view:y?o:void 0,field:t,sqlWhere:r.where,...h&&{filter:h},outStatisticTypes:{include:[a]}}),["string","small-integer","integer"].includes(c.type)&&(w=(await ne({layer:l,useFeaturesInView:y,view:y?o:void 0,field:t,sqlWhere:r.where,...h&&{filter:h}})).uniqueValueInfos.sort((T,M)=>M.count-T.count).slice(0,v))}catch(T){console.error("Statistics error:",T)}return{tool:"getStatistics",layerName:l.title??r.layerId,summary:`${a} = ${typeof f?.[a]=="number"?f[a]:"N/A"}`,details:{fieldName:t,statisticType:a,statistic:f?.[a]??null,summaryStatistics:f,uniqueValues:w,where:r.where,spatialFilterInfo:u}}};async function Cr({targetLayer:e,fieldName:r,statisticType:t,geometryLayer:a},o){let i=b(o,"layersAndFieldsRegistry"),{mapView:s}=k(o),l=await Mr({targetLayer:e,fieldName:r,statisticType:t,mapView:s,layersAndFieldsRegistry:i,geometryLayer:a});return JSON.stringify(l,null,2)}var jr=n.object({targetLayer:n.object({layerId:n.string().describe("The layerId of the layer containing the field from which to get a value."),where:n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")}),geometryLayer:n.union([n.object({layerId:n.string().describe("The layerId of the layer containing the geometry by which to filter."),where:n.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:n.number().optional().describe("The distance by which to query from the input geometry."),units:z.optional().describe("The units used to query by geometry and distance.")}),n.object({}).strict()]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),fieldName:n.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),statisticType:n.enum(["avg","max","median","min","stddev","sum","variance","nullcount","count"]).describe("The statistic type to calculate.")}),Vr=p(Cr,{name:"getStatistics",description:'Returns one or more summary statistics for the given field. Statistic types include: count, maximum, minimum, average, median, standard deviation, variance, mode, sum, nullcount (number of features without a value for a given field), unique values. For "most common/frequent" questions: Use statisticType "count" on a categorical field. The response includes uniqueValues sorted by frequency (most common first). Statistics can be returned for number, date, and string fields. Also returns frequency analysis for string fields - unique values sorted by occurrence count (most frequent first). Use this for "most common", "most frequent", or "how many of each" questions. Only call this tool when the question requires filtering (e.g. a WHERE clause or spatial constraint) that cannot be satisfied by precomputed stats.',schema:jr}),Or=async(e,r,t,a)=>{let o=t.map?.allLayers.find(u=>u.id===e.layerId),i=await t.whenLayerView(o),s=o.title??e.layerId,l;if(a){let u=await Q(a,t);if("error"in u)return{tool:"getTopFeatures",layerName:s,summary:"Geometry lookup failed",details:{error:u.error}};if(!u.geometry)return{tool:"getTopFeatures",layerName:s,summary:"No features found for geometry filter",details:{error:`No features found matching: ${a.where}`}};l=u.geometry}let d=e.outFields.length>2?e.outFields:["*"],c=r.groupByFields&&r.groupByFields.length>0;try{let u;if(c){let y=new Ae({where:e.where||"1=1",outFields:d,orderByFields:e.orderByFields,geometry:l,spatialRelationship:l?"intersects":void 0,distance:a?.distance,units:a?.units,topFilter:new qe({topCount:r.topCount,groupByFields:r.groupByFields,orderByFields:r.orderByFields})});u=await o.queryTopFeatures(y)}else{let y=new se({where:e.where||"1=1",outFields:d,orderByFields:r.orderByFields,num:r.topCount,geometry:l,spatialRelationship:l?"intersects":void 0,distance:a?.distance,units:a?.units,outSpatialReference:t.spatialReference}),f=ue(i,!1);try{u=f?await i.queryFeatures(y):await o.queryFeatures(y)}catch(w){console.warn("Client-side query failed, falling back to server:",w),u=await o.queryFeatures(y)}}let h=u.features.map(y=>y.attributes);return{tool:"getTopFeatures",layerName:s,summary:`Top ${r.topCount} features extracted`,details:{topCount:r.topCount,attributes:h,where:e.where,orderByFields:r.orderByFields,...c&&{groupByFields:r.groupByFields}}}}catch(u){return{tool:"getTopFeatures",layerName:s,summary:"Query failed",details:{error:u instanceof Error?u.message:String(u)}}}},Dr=async({targetLayer:e,topFilter:r,geometryLayer:t},a)=>{let{mapView:o}=k(a),i=await Or(e,r,o,t);return JSON.stringify(i,null,2)},Br=n.object({targetLayer:n.object({layerId:n.string().describe("The layerId of the layer containing the field from which to get a value."),where:n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:n.array(n.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:n.array(n.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryLayer:n.object({layerId:n.string().describe("The layerId of the layer containing the geometry by which to filter."),where:n.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:n.number().optional().describe("The distance by which to query from the input geometry."),units:z.describe("The units used to query by geometry and distance.").optional()}).optional().describe("Optional geometry-based filtering parameters for spatial queries."),topFilter:n.object({topCount:n.number().describe("Number of top features to return per group."),orderByFields:n.array(n.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")),groupByFields:n.array(n.string().describe("Field(s) to group results by. Returns top N per group."))})}),Qr=p(Dr,{name:"getTopFeatures",description:'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',schema:Br}),ee=25,Pr=async(e,r,t,a)=>{let o=r.map?.allLayers.find(f=>f.id===e.layerId),i=await r.whenLayerView(o),s=o.title??e.layerId,l;if(t){let f=await Q(t,r);if("error"in f){let w={error:f.error};return re(t)?(w.geometryLayerId=t.layerId,w.geometryWhere=t.where):te(t)&&(w.point=t.point),{tool:"queryFeatures",layerName:s,summary:"Geometry lookup failed",details:w}}if(!f.geometry){let w={};return re(t)?(w.error=`No features found matching: ${t.where}`,w.geometryLayerId=t.layerId,w.geometryWhere=t.where):te(t)&&(w.error="Failed to create point geometry",w.point=t.point),{tool:"queryFeatures",layerName:s,summary:"No features found for geometry filter",details:w}}l=f.geometry}else a&&(l=r.extent.clone());let d=ue(i,a??!1),c=new se({where:e.where||"1=1",outFields:e.outFields.length?e.outFields:["*"],orderByFields:e.orderByFields,...l&&{geometry:l,spatialRelationship:"intersects"},...t?.distance&&{distance:t.distance},...t?.units&&{units:t.units},outSpatialReference:r.spatialReference}),u,h;try{u=d?await i.queryFeatureCount(c):await o.queryFeatureCount(c),u>0&&u<=ee&&(h=d?await i.queryFeatures(c):await o.queryFeatures(c),h&&h.features.forEach(f=>{let w=f.attributes;o.fields.forEach(v=>{let T=w[v.name],M=ae(v.name,T,o);M&&(w[v.name]=M)})}))}catch(f){console.warn("Client-side query failed, falling back to server:",f),u=await o.queryFeatureCount(c),u>0&&u<=ee&&(h=await o.queryFeatures(c),h&&h.features.forEach(w=>{o.fields.forEach(v=>{let T=w.attributes[v.name],M=ae(v.name,T,o);M&&(w.attributes[v.name]=M)})}))}let y=h?.features.map(f=>f.attributes);return{tool:"queryFeatures",layerName:s,summary:`${u} features found`,details:{totalCount:u,where:e.where,...y&&{attributes:y},...u>ee&&{note:`${u} features found. Too many to list. Use filters to narrow results.`}}}};async function Gr({targetLayer:e,geometryFilter:r,useCurrentExtent:t},a){let{mapView:o}=k(a),i=await Pr(e,o,r,t);return JSON.stringify(i,null,2)}var Wr=n.object({layerId:n.string().describe("The layerId of the layer containing the geometry by which to filter."),where:n.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:n.number().optional().describe("The buffer distance around the geometry."),units:z.optional().describe("The units for the distance buffer.")}),Ur=n.object({point:n.object({x:n.number().describe("X coordinate (longitude) from navigation result"),y:n.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:n.object({wkid:n.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:n.number().optional().describe("Optional buffer distance around the point."),units:z.optional().describe("The units for the distance buffer.")}),Hr=n.object({targetLayer:n.object({layerId:n.string().describe("The layerId of the layer containing the field from which to get a value."),where:n.string().describe("SQL-92 where clause. IMPORTANT: When using geometryFilter.point for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."),orderByFields:n.array(n.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:n.array(n.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:n.union([Wr,Ur]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),useCurrentExtent:n.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at'. Default is false (queries entire layer).")}),Jr=p(Gr,{name:"queryFeatures",description:"Queries features from a layer. Returns count and attributes (if \u226425 features). Use for listing features, finding features matching conditions, or spatial queries.",schema:Hr}),Ce=[zr,Vr,Qr,Jr],je=[vr,Ir,Nr],H=()=>{let e=new Date().getTimezoneOffset(),r=e<=0?"+":"-",t=Math.floor(Math.abs(e)/60).toString().padStart(2,"0"),a=(Math.abs(e)%60).toString().padStart(2,"0"),o=`${r}${t}:${a}`;return{userTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,userTimezoneOffset:o}},Zr=async(e,r)=>{await m({text:"Requesting LLM for layer filter results"},r);let t=await q("data_explore_filter_prompt");if(!r?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:a,userTimezoneOffset:o}=H(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:a,userTimezoneOffset:o},s=await C({promptText:t,messages:S(e.messages),inputVariables:i,tools:je}),l=[...e.messages,s],d=(s.tool_calls?.length??0)>0?l:[...l,s],c=s.content.toString();return await B(s,r),{...e,messages:d,outputMessage:c}},Kr=async(e,r)=>{await m({text:"Requesting LLM for layer query results"},r);let t=await q("data_explore_query_prompt");if(!r?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:a,userTimezoneOffset:o}=H(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:a,userTimezoneOffset:o},s=await C({promptText:t,messages:S(e.messages),inputVariables:i,tools:Ce}),l=[...e.messages,s],d=s.content.toString();return await B(s,r),{...e,messages:l,outputMessage:d}},Yr=async(e,r)=>{try{await m({text:"Requesting LLM for summary on query results"},r);let t=await q("summarize_query_response_prompt"),a={queryResponse:e.queryResponse},o=await Y({promptText:t,messages:S(e.messages),inputVariables:a}),i=typeof o=="string"?o:o.content,s=new j(i);return await m({text:`Received response from LLM: ${i}`},r),{...e,outputMessage:i,messages:[...e.messages,s]}}catch(t){throw await m({text:"Error during filter LLM request"},r),new Error(`Error during filter LLM request: ${t instanceof Error?t.message:String(t)}`)}};async function Xr(e,r){let t=await new L(je).invoke({messages:S(e.messages)},r),a=[...e.messages,...t.messages],o=t.messages.map(l=>new j({content:l.content,additional_kwargs:l.additional_kwargs}));await m({text:`Finished executing layer filter tool: ${t.messages.map(l=>l.content).join(", ")}`},r);let i=[...a,...o],s=o.map(l=>l.content).join(`
|
|
45
|
+
${t}`},default:()=>""}),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y(),queryResponse:y()}),yr=async(e,r)=>(await m({text:"Exiting Data Exploration agent"},r),e),B=async(e,r)=>{let t=e.tool_calls??[];if(t.length===0){await m({text:`LLM did not request any tool calls: ${String(e?.content)}`},r);return}await Promise.all(t.map(async a=>await m({text:`LLM requested tool call with arguments: ${JSON.stringify(a.args,null,2)}`},r))),console.log("LLM response:",JSON.stringify(e.tool_calls,null,2))},de=async(e,r,t)=>{let a=e.map?.allLayers.find(i=>i.id===r),o=a.createQuery();o.where=t??"1=1";try{let{extent:i,count:n}=await a.queryExtent(o);return!i||n===0?{success:!1,error:`No features found for where clause: ${t}`}:(await e.goTo(i),{success:!0})}catch(i){return{success:!1,error:i instanceof Error?i.message:String(i)}}},pr=async(e,r,t)=>{let a=t.map?.allLayers.find(n=>n.id===e);if(!a)return`Could not find layer with ID: ${e}`;a.definitionExpression=r,a.visible=!0;let o=await de(t,e,r),i=a.title??a.layerId;return o.success?`Applied definition expression to layer "${a.title??e}": ${r}`:`Applied filter to "${i}" but no features matched. ${o.error}`},wr=["mapView"];function z(e){let r=e?.configurable?.context;if(!r||typeof r!="object")throw new Error("DataExplorationAgent context missing");let t=wr.filter(a=>!(a in r));if(t.length)throw new Error(`DataExplorationAgent context missing: ${t.join(", ")}`);return r}var br=async({layerId:e,definitionExpression:r},t)=>{let{mapView:a}=z(t);return await pr(e,r,a)},vr=s.object({layerId:s.string().describe("The layerId of the layer on which to set a definitionExpression."),definitionExpression:s.string().describe("The SQL-92 where clause used to set a definition expression on the layer.")}),Sr=p(br,{name:"setDefinitionExpression",description:"Set a SQL-92 where clause to the definition expression of a layer (i.e. a server-side filter). This filters features at the server level, affecting all views of the layer. Do not prioritize this tool unless specifically asked for or implied for server level, affecting all views of the layer.",schema:vr});function te(e){return"point"in e&&e.point!==void 0}function re(e){return"layerId"in e&&e.layerId!==void 0}var Q=async(e,r)=>{if(te(e)){let{point:t}=e;return{geometry:new oe({x:t.x,y:t.y,spatialReference:t.spatialReference?{wkid:t.spatialReference.wkid}:r.spatialReference})}}if(re(e)){let t=r.map?.allLayers.find(a=>a.id===e.layerId);if(!t)return{error:`Could not find geometry layer with ID: ${e.layerId}`};try{let a=await t.queryFeatures({where:e.where,returnGeometry:!0,outSpatialReference:r.spatialReference});if(!a.features.length)return{error:`No features found in geometry layer with the specified where clause: ${e.where}`};let o;if(a.features.length===1){let i=a.features[0].geometry;if(!i)return{error:"The geometry of the first feature is undefined or null."};o=i}else{let i=a.features.map(l=>l.geometry),n=K.executeMany(i);if(!n)return{error:"Failed to create a combined geometry."};o=n}return o.spatialReference||(o.spatialReference=r.spatialReference),{geometry:o}}catch(a){return{error:`Failed to query geometry: ${String(a)}`}}}return{error:"Invalid geometry configuration provided"}},Tr=async(e,r,t,a,o)=>{let i=r.map?.allLayers.find(c=>c.id===e.layerId);if(!i)return`Could not find target layer with ID: ${e.layerId}`;let n;if(o){let c=await Q(o,r);if("error"in c)return c.error;n=c.geometry}i.featureEffect=null,i.featureEffect=new Re({filter:new V({where:e.where,geometry:n,spatialRelationship:"intersects",distance:o?.distance,units:o?.units}),includedEffect:t,excludedEffect:a}),i.visible=!0;let l=await de(r,o?o.layerId:e.layerId,o?o.where:e.where),d=i.title??e.layerId;return l.success?`Applied feature effects to target layer "${i.title??e.layerId}"${o?` using geometry from layer "${o.layerId}"`:""}.`:`Applied filter to "${d}" but no features matched. ${l.error}`},xr=["feet","kilometers","meters","miles","nautical-miles","us-nautical-miles"],M=s.enum(xr),Er=async({targetLayer:e,geometryLayer:r,includedEffect:t="drop-shadow(2px, 2px, 2px, gray)",excludedEffect:a="grayscale(100%) opacity(60%) blur(2px)"},o)=>{let{mapView:i}=z(o);return await Tr(e,i,t,a,r)},Lr=s.object({targetLayer:s.object({layerId:s.string().describe("The layerId of the layer on which to set a feature effect."),where:s.string().describe("The SQL-92 where clause representing the features to emphasize.")}),geometryLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the geometry by which to filter."),where:s.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:s.number().describe("The distance by which to filter the input geometry."),units:M.describe("The units used to filter by geometry and distance.")}).optional().describe("Optional geometry-based filtering parameters for spatial queries."),includedEffect:s.string().optional().default("drop-shadow(2px, 2px, 2px, gray)").describe("The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."),excludedEffect:s.string().optional().default("grayscale(100%) opacity(60%) blur(2px)").describe("The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified.")}),Ir=p(Er,{name:"setFeatureEffect",description:"Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",schema:Lr}),$r=async(e,r,t)=>{let a=r.map?.allLayers.find(d=>d.id===e.layerId);if(!a)return`Could not find target layer with ID: ${e.layerId}`;let o;if(t){let d=await Q(t,r);if("error"in d)return d.error;o=d.geometry}let i=await r.whenLayerView(a);i.filter=null,i.filter=new V({where:e.where,geometry:o,spatialRelationship:"intersects",distance:t?.distance,units:t?.units}),a.visible=!0;let n=await de(r,t?t.layerId:e.layerId,t?t.where:e.where),l=a.title??e.layerId;return n.success?`Applied feature filter to layer "${a.title??e.layerId}"${t?` using geometry from layer "${t.layerId}"`:""}.`:`Applied filter to "${l}" but no features matched. ${n.error}`},Fr=async({targetLayer:e,geometryLayer:r},t)=>{let{mapView:a}=z(t);return await $r(e,a,r)},_r=s.object({targetLayer:s.object({layerId:s.string().describe("The layerId of the layer on which to set a filter."),where:s.string().describe("The SQL-92 where clause representing the features to display.")}),geometryLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the geometry by which to filter."),where:s.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:s.number().describe("The distance by which to filter the input geometry."),units:M.describe("The units used to filter by geometry and distance.")}).optional().describe("Optional geometry-based filtering parameters for spatial queries.")}),Nr=p(Fr,{name:"setFeatureFilter",description:"Sets a client-side filter using a where clause, geometry filter, or both on a target layer. This filters features at the client level in the view.",schema:_r}),ae=(e,r,t)=>{if(e&&typeof e!="function"){let a="getField"in t&&t.getField?.(e),o=a&&"getFieldDomain"in t&&t.getFieldDomain?t.getFieldDomain(a.name):null;if(o?.type==="coded-value"){let i=o.codedValues.find(n=>n.code===r);return i?i.name:null}}return null},Rr=(e,r,t)=>{let a=e.createQuery();return a.outFields=[r],a.where=t||"1=1",a.num=1,a},Ar=async(e,r,t,a)=>{let o=a.map?.allLayers.find(c=>c.id===e),i=Rr(o,r,t.where),n=(await o.queryFeatures(i)).features[0],l=n?n.attributes[r]:null,d=ae(r,l,o)||l;return{tool:"getAttribute",layerName:o.title??e,summary:`${r} = ${d}`,details:{fieldName:r,value:d,where:t.where}}};async function qr({layerId:e,fieldName:r,query:t},a){let{mapView:o}=z(a),i=await Ar(e,r,t,o);return JSON.stringify(i,null,2)}var zr=s.object({layerId:s.string().describe("The layerId of the layer containing the field from which to get a value."),fieldName:s.string().describe("The name of the field/attribute from which to get a field value."),query:s.object({where:s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")})}),Mr=p(qr,{name:"getAttribute",description:"Returns an attribute value for a given feature.",schema:zr}),ue=(e,r)=>r?e.hasAllFeaturesInView:e.hasAllFeatures,kr=async e=>{let{targetLayer:r,fieldName:t,statisticType:a,mapView:o,layersAndFieldsRegistry:i,geometryLayer:n}=e,l=o.map?.allLayers.find(T=>T.id===r.layerId);if(!l)throw new Error(`Layer '${r.layerId}' not found.`);let d=await o.whenLayerView(l),c=i.get(r.layerId)?.fieldRegistry.get(t);if(!c)throw new Error(`Field '${t}' not found.`);let u,h;if(n){let T=await Q(n,o);if("error"in T)throw new Error(T.error);if(!T.geometry)throw new Error(`No features found matching: ${n.where}`);u={geometryLayerId:n.layerId,geometryWhere:n.where,distance:n.distance,units:n.units,applied:!0},h=new V({geometry:T.geometry,distance:n.distance,units:n.units,spatialRelationship:"intersects"})}let g=ue(d,!1),f=null,w=null,S=10;if(c.type!=="geometry"&&c.type!=="oid"&&c.type!=="global-id")try{f=await ie({layer:l,useFeaturesInView:g,view:g?o:void 0,field:t,sqlWhere:r.where,...h&&{filter:h},outStatisticTypes:{include:[a]}}),["string","small-integer","integer"].includes(c.type)&&(w=(await ne({layer:l,useFeaturesInView:g,view:g?o:void 0,field:t,sqlWhere:r.where,...h&&{filter:h}})).uniqueValueInfos.sort((T,k)=>k.count-T.count).slice(0,S))}catch(T){console.error("Statistics error:",T)}return{tool:"getStatistics",layerName:l.title??r.layerId,summary:`${a} = ${typeof f?.[a]=="number"?f[a]:"N/A"}`,details:{fieldName:t,statisticType:a,statistic:f?.[a]??null,summaryStatistics:f,uniqueValues:w,where:r.where,spatialFilterInfo:u}}};async function Cr({targetLayer:e,fieldName:r,statisticType:t,geometryLayer:a},o){let i=b(o,"layersAndFieldsRegistry"),{mapView:n}=z(o),l=await kr({targetLayer:e,fieldName:r,statisticType:t,mapView:n,layersAndFieldsRegistry:i,geometryLayer:a});return JSON.stringify(l,null,2)}var jr=s.object({targetLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the field from which to get a value."),where:s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")}),geometryLayer:s.union([s.object({layerId:s.string().describe("The layerId of the layer containing the geometry by which to filter."),where:s.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:s.number().optional().describe("The distance by which to query from the input geometry."),units:M.optional().describe("The units used to query by geometry and distance.")}),s.object({}).strict()]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),fieldName:s.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),statisticType:s.enum(["avg","max","median","min","stddev","sum","variance","nullcount","count"]).describe("The statistic type to calculate.")}),Vr=p(Cr,{name:"getStatistics",description:'Returns one or more summary statistics for the given field. Statistic types include: count, maximum, minimum, average, median, standard deviation, variance, mode, sum, nullcount (number of features without a value for a given field), unique values. For "most common/frequent" questions: Use statisticType "count" on a categorical field. The response includes uniqueValues sorted by frequency (most common first). Statistics can be returned for number, date, and string fields. Also returns frequency analysis for string fields - unique values sorted by occurrence count (most frequent first). Use this for "most common", "most frequent", or "how many of each" questions. Only call this tool when the question requires filtering (e.g. a WHERE clause or spatial constraint) that cannot be satisfied by precomputed stats.',schema:jr}),Or=async(e,r,t,a)=>{let o=t.map?.allLayers.find(u=>u.id===e.layerId),i=await t.whenLayerView(o),n=o.title??e.layerId,l;if(a){let u=await Q(a,t);if("error"in u)return{tool:"getTopFeatures",layerName:n,summary:"Geometry lookup failed",details:{error:u.error}};if(!u.geometry)return{tool:"getTopFeatures",layerName:n,summary:"No features found for geometry filter",details:{error:`No features found matching: ${a.where}`}};l=u.geometry}let d=e.outFields.length>2?e.outFields:["*"],c=r.groupByFields&&r.groupByFields.length>0;try{let u;if(c){let g=new Ae({where:e.where||"1=1",outFields:d,orderByFields:e.orderByFields,geometry:l,spatialRelationship:l?"intersects":void 0,distance:a?.distance,units:a?.units,topFilter:new qe({topCount:r.topCount,groupByFields:r.groupByFields,orderByFields:r.orderByFields})});u=await o.queryTopFeatures(g)}else{let g=new se({where:e.where||"1=1",outFields:d,orderByFields:r.orderByFields,num:r.topCount,geometry:l,spatialRelationship:l?"intersects":void 0,distance:a?.distance,units:a?.units,outSpatialReference:t.spatialReference}),f=ue(i,!1);try{u=f?await i.queryFeatures(g):await o.queryFeatures(g)}catch(w){console.warn("Client-side query failed, falling back to server:",w),u=await o.queryFeatures(g)}}let h=u.features.map(g=>g.attributes);return{tool:"getTopFeatures",layerName:n,summary:`Top ${r.topCount} features extracted`,details:{topCount:r.topCount,attributes:h,where:e.where,orderByFields:r.orderByFields,...c&&{groupByFields:r.groupByFields}}}}catch(u){return{tool:"getTopFeatures",layerName:n,summary:"Query failed",details:{error:u instanceof Error?u.message:String(u)}}}},Dr=async({targetLayer:e,topFilter:r,geometryLayer:t},a)=>{let{mapView:o}=z(a),i=await Or(e,r,o,t);return JSON.stringify(i,null,2)},Br=s.object({targetLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the field from which to get a value."),where:s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:s.array(s.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the geometry by which to filter."),where:s.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:s.number().optional().describe("The distance by which to query from the input geometry."),units:M.describe("The units used to query by geometry and distance.").optional()}).optional().describe("Optional geometry-based filtering parameters for spatial queries."),topFilter:s.object({topCount:s.number().describe("Number of top features to return per group."),orderByFields:s.array(s.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")),groupByFields:s.array(s.string().describe("Field(s) to group results by. Returns top N per group."))})}),Qr=p(Dr,{name:"getTopFeatures",description:'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',schema:Br}),ee=25,Gr=async(e,r,t,a)=>{let o=r.map?.allLayers.find(f=>f.id===e.layerId),i=await r.whenLayerView(o),n=o.title??e.layerId,l;if(t){let f=await Q(t,r);if("error"in f){let w={error:f.error};return re(t)?(w.geometryLayerId=t.layerId,w.geometryWhere=t.where):te(t)&&(w.point=t.point),{tool:"queryFeatures",layerName:n,summary:"Geometry lookup failed",details:w}}if(!f.geometry){let w={};return re(t)?(w.error=`No features found matching: ${t.where}`,w.geometryLayerId=t.layerId,w.geometryWhere=t.where):te(t)&&(w.error="Failed to create point geometry",w.point=t.point),{tool:"queryFeatures",layerName:n,summary:"No features found for geometry filter",details:w}}l=f.geometry}else a&&(l=r.extent.clone());let d=ue(i,a??!1),c=new se({where:e.where||"1=1",outFields:e.outFields.length?e.outFields:["*"],orderByFields:e.orderByFields,...l&&{geometry:l,spatialRelationship:"intersects"},...t?.distance&&{distance:t.distance},...t?.units&&{units:t.units},outSpatialReference:r.spatialReference}),u,h;try{u=d?await i.queryFeatureCount(c):await o.queryFeatureCount(c),u>0&&u<=ee&&(h=d?await i.queryFeatures(c):await o.queryFeatures(c),h&&h.features.forEach(f=>{let w=f.attributes;o.fields.forEach(S=>{let T=w[S.name],k=ae(S.name,T,o);k&&(w[S.name]=k)})}))}catch(f){console.warn("Client-side query failed, falling back to server:",f),u=await o.queryFeatureCount(c),u>0&&u<=ee&&(h=await o.queryFeatures(c),h&&h.features.forEach(w=>{o.fields.forEach(S=>{let T=w.attributes[S.name],k=ae(S.name,T,o);k&&(w.attributes[S.name]=k)})}))}let g=h?.features.map(f=>f.attributes);return{tool:"queryFeatures",layerName:n,summary:`${u} features found`,details:{totalCount:u,where:e.where,...g&&{attributes:g},...u>ee&&{note:`${u} features found. Too many to list. Use filters to narrow results.`}}}};async function Pr({targetLayer:e,geometryFilter:r,useCurrentExtent:t},a){let{mapView:o}=z(a),i=await Gr(e,o,r,t);return JSON.stringify(i,null,2)}var Wr=s.object({layerId:s.string().describe("The layerId of the layer containing the geometry by which to filter."),where:s.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:s.number().optional().describe("The buffer distance around the geometry."),units:M.optional().describe("The units for the distance buffer.")}),Kr=s.object({point:s.object({x:s.number().describe("X coordinate (longitude) from navigation result"),y:s.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:s.object({wkid:s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:s.number().optional().describe("Optional buffer distance around the point."),units:M.optional().describe("The units for the distance buffer.")}),Hr=s.object({targetLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the field from which to get a value."),where:s.string().describe("SQL-92 where clause. IMPORTANT: When using geometryFilter.point for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."),orderByFields:s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:s.array(s.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:s.union([Wr,Kr]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),useCurrentExtent:s.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at'. Default is false (queries entire layer).")}),Ur=p(Pr,{name:"queryFeatures",description:"Queries features from a layer. Returns count and attributes (if \u226425 features). Use for listing features, finding features matching conditions, or spatial queries.",schema:Hr}),Ce=[Mr,Vr,Qr,Ur],je=[Sr,Ir,Nr],H=()=>{let e=new Date().getTimezoneOffset(),r=e<=0?"+":"-",t=Math.floor(Math.abs(e)/60).toString().padStart(2,"0"),a=(Math.abs(e)%60).toString().padStart(2,"0"),o=`${r}${t}:${a}`;return{userTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,userTimezoneOffset:o}},Jr=async(e,r)=>{await m({text:"Requesting LLM for layer filter results"},r);let t=await q("data_explore_filter_prompt");if(!r?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:a,userTimezoneOffset:o}=H(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:a,userTimezoneOffset:o},n=await C({promptText:t,messages:v(e.messages),inputVariables:i,tools:je}),l=[...e.messages,n],d=(n.tool_calls?.length??0)>0?l:[...l,n],c=n.content.toString();return await B(n,r),{...e,messages:d,outputMessage:c}},Zr=async(e,r)=>{await m({text:"Requesting LLM for layer query results"},r);let t=await q("data_explore_query_prompt");if(!r?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:a,userTimezoneOffset:o}=H(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:a,userTimezoneOffset:o},n=await C({promptText:t,messages:v(e.messages),inputVariables:i,tools:Ce}),l=[...e.messages,n],d=n.content.toString();return await B(n,r),{...e,messages:l,outputMessage:d}},Yr=async(e,r)=>{try{await m({text:"Requesting LLM for summary on query results"},r);let t=await q("summarize_query_response_prompt"),a={queryResponse:e.queryResponse},o=await Y({promptText:t,messages:v(e.messages),inputVariables:a}),i=typeof o=="string"?o:o.content,n=new j(i);return await m({text:`Received response from LLM: ${i}`},r),{...e,outputMessage:i,messages:[...e.messages,n]}}catch(t){throw await m({text:"Error during filter LLM request"},r),new Error(`Error during filter LLM request: ${t instanceof Error?t.message:String(t)}`)}};async function Xr(e,r){let t=await new L(je).invoke({messages:v(e.messages)},r),a=[...e.messages,...t.messages],o=t.messages.map(l=>new j({content:l.content,additional_kwargs:l.additional_kwargs}));await m({text:`Finished executing layer filter tool: ${t.messages.map(l=>l.content).join(", ")}`},r);let i=[...a,...o],n=o.map(l=>l.content).join(`
|
|
48
46
|
|
|
49
|
-
`);return{...e,messages:i,outputMessage:
|
|
50
|
-
`);return`${o.get(
|
|
51
|
-
${
|
|
52
|
-
`),
|
|
53
|
-
${
|
|
54
|
-
`),
|
|
55
|
-
${
|
|
47
|
+
`);return{...e,messages:i,outputMessage:n}}var ea=new L(Ce);async function ta(e,r){let{messages:t}=await ea.invoke({messages:v(e.messages)},r),a=[],o=[];for(let n of t){let l=n.content,d;if(typeof l!="string"){d={tool:n.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:"Skipping non-string tool output:",raw:l}};continue}try{d=JSON.parse(l)}catch{d={tool:n.name??"unknown",layerName:"unknown",summary:"Query failed",details:{error:l}}}a.push(d),d.details&&typeof d.details=="object"&&"error"in d.details?o.push(`- ${d.tool}: Error - ${String(d.details.error)}`):o.push(`- ${d.layerName}: ${d.summary}`)}let i=[...e.messages,...t];return await m({text:`Finished executing layer query tool: ${o.join(", ")}`},r),{...e,messages:i,queryResponse:a}}var ra=10,aa=async(e,r)=>{let t=null,a=null;try{r.type!=="geometry"&&r.type!=="oid"&&r.type!=="global-id"&&(t=await ie({layer:e,field:r.name}),r.type==="string"&&(a=(await ne({layer:e,field:r.name})).uniqueValueInfos.sort((o,i)=>i.count-o.count).slice(0,ra)))}catch(o){console.error(`Error fetching statistics for field ${r.name}:`,o)}return{summaryStatistics:t,uniqueValues:a}};async function me(e,r,t){let a=[],o=[];for(let i of e){let n=function(g){let f=r.get(g)?.layerItem;return f?[f.name&&`Name: ${f.name}`,f.title&&`Title: ${f.title}`,f.description&&`Description: ${f.description}`].filter(Boolean).join(" | "):g},{layerId:l,results:d}=i,c=t.map?.allLayers.find(g=>g.id===l),u=r.get(l)?.fieldRegistry;if(!u)continue;let h=a.find(g=>g.layerId===l);h||(h={layerId:l,layerSummary:n(l),fieldInfos:[]},a.push(h));for(let g of d){let f=u.get(g.name);if(f){if(!f.statistics){let w=aa(c,f).then(S=>{u.set(f.name,{...f,statistics:S}),f.statistics=S});o.push(w)}h.fieldInfos.push(f)}}}return await Promise.all(o),a}var oa=async(e,r)=>{try{await m({text:"Getting statistics for vector search results"},r);let t=b(r,"layersAndFieldsRegistry"),{mapView:a}=z(r),o=await me(e.vectorSearchFieldResults,t,a);return console.log("Field statistics retrieved:",o),await m({text:"Statistics retrieved"},r),{...e,layerFieldInfo:o}}catch(t){throw await m({text:"Error during fetching statistics"},r),new Error(`Error during fetching statistics: ${t instanceof Error?t.message:String(t)}`)}},Le=.7,ia=10,na=async(e,r)=>{try{let t=_(e.messages);await m({text:"Similarity search to find fields"},r);let a=b(r,"fieldSearch"),o=b(r,"layersAndFieldsRegistry"),i=b(r,"embeddingCache"),n=await a.searchFields({text:t,layerIds:e.vectorSearchLayerIds,minScore:Le,topResults:ia,embeddingCache:i}),l=n.map(({layerId:c,results:u})=>{let h=u.map(g=>` - ${g.name} (${g.score.toFixed(2)})`).join(`
|
|
48
|
+
`);return`${o.get(c)?.layerItem.name??c}:
|
|
49
|
+
${h}`}).join(`
|
|
50
|
+
`),d;return n.length>0?d=`Vector search completed. Matching layers and fields with scores:
|
|
51
|
+
${l}`:d=`No vector search results found for score over ${Le}.`,await m({text:d},r),{...e,vectorSearchFieldResults:n}}catch(t){throw await m({text:`Error during vector search: ${t instanceof Error?t.message:String(t)}`},r),new Error(`Vector search failed: ${t instanceof Error?t.message:String(t)}`)}},sa=.7,la=async(e,r)=>{try{let t=_(e.messages);await m({text:`Similarity search to find layers: ${t}`},r);let a=b(r,"layerSearch"),o=b(r,"layersAndFieldsRegistry"),i=b(r,"embeddingCache"),n=await a.searchLayers({text:t,minScore:sa,embeddingCache:i}),l=n.map(u=>u.id),d=n.map(({id:u,score:h})=>`${o.get(u)?.layerItem.name??u} (${h.toFixed(2)})`).join(`
|
|
52
|
+
`),c;return l.length>0?c=`Vector search completed. Matching layers with scores:
|
|
53
|
+
${d}`:c="Vector search completed. No matching layers found.",await m({text:c},r),{...e,vectorSearchLayerIds:l}}catch(t){throw await m({text:`Error during vector search: ${t instanceof Error?t.message:String(t)}`},r),new Error(`Vector search failed: ${t instanceof Error?t.message:String(t)}`)}},ca=(e,r)=>D(["layerSearch","fieldSearch","layersAndFieldsRegistry"],"Data Exploration Agent")(e,r),da=()=>new A(ke).addNode("requireDataExplorationServices",ca).addNode("vectorSearchLayers",la).addNode("vectorSearchFields",na).addNode("fieldStatistics",oa).addNode("queryAgent",Zr).addNode("queryTools",ta).addNode("summarizeQueryResponseLLM",Yr).addNode("filterAgent",Jr).addNode("filterTools",Xr).addNode("earlyExit",yr).addEdge(R,"requireDataExplorationServices").addEdge("requireDataExplorationServices","vectorSearchLayers").addConditionalEdges("vectorSearchLayers",e=>e.vectorSearchLayerIds.length?"vectorSearchFields":"earlyExit").addConditionalEdges("vectorSearchFields",e=>e.vectorSearchFieldResults.length?"fieldStatistics":"earlyExit").addEdge("fieldStatistics","queryAgent").addConditionalEdges("queryAgent",e=>(e.messages[e.messages.length-1]?.tool_calls?.length??0)>0?"queryTools":"filterAgent").addConditionalEdges("queryTools",e=>e.queryResponse.length?"summarizeQueryResponseLLM":"filterAgent").addEdge("summarizeQueryResponseLLM","filterAgent").addEdge("filterAgent","filterTools").addEdge("filterTools",x).addEdge("summarizeQueryResponseLLM",x).addEdge("earlyExit",x),ua=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).
|
|
56
54
|
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.
|
|
57
55
|
_Example: “Only show stations where Brand is Shell”_
|
|
58
56
|
_Example: “Make Shell stations stand out on the map”_
|
|
@@ -60,47 +58,47 @@ ${l}`:d="Vector search completed. No matching layers found.",await m({text:d},r)
|
|
|
60
58
|
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?”).
|
|
61
59
|
_Example: “How many features are there?”_
|
|
62
60
|
_Example: “What’s the average population?”_
|
|
63
|
-
_Example: “Which values are in the status field?”_`,
|
|
64
|
-
`);return`${o.get(
|
|
65
|
-
${
|
|
66
|
-
`),
|
|
67
|
-
${
|
|
68
|
-
`),d;return
|
|
69
|
-
${l}`:d="Vector search completed. No matching layers found.",await m({text:d},r),{...e,vectorSearchLayerIds:
|
|
70
|
-
`);await m({text:`Finished executing layer filter tool: ${a}`},r);let o=[...e.messages,...t.messages],i=t.messages.map(
|
|
71
|
-
`);return{...e,outputMessage:i,messages:o}}var Qe=
|
|
61
|
+
_Example: “Which values are in the status field?”_`,zs={id:"dataExploration",name:"Data Exploration Agent",description:ua,createGraph:da,workspace:ke},Ie=.7,ma=10,ha=async(e,r)=>{try{let t=_(e.messages);await m({text:"Similarity search to find fields"},r);let a=b(r,"fieldSearch"),o=b(r,"layersAndFieldsRegistry"),i=b(r,"embeddingCache"),n=await a.searchFields({text:t,layerIds:e.vectorSearchLayerIds,minScore:Ie,topResults:ma,embeddingCache:i}),l=n.map(({layerId:c,results:u})=>{let h=u.map(g=>` - ${g.name} (${g.score.toFixed(2)})`).join(`
|
|
62
|
+
`);return`${o.get(c)?.layerItem.name??c}:
|
|
63
|
+
${h}`}).join(`
|
|
64
|
+
`),d;return n.length>0?d=`Vector search completed. Matching layers and fields with scores:
|
|
65
|
+
${l}`:d=`No vector search results found for score over ${Ie}.`,await m({text:d},r),{...e,vectorSearchFieldResults:n}}catch(t){throw await m({text:`Error during vector search: ${t instanceof Error?t.message:String(t)}`},r),new Error(`Vector search failed: ${t instanceof Error?t.message:String(t)}`)}},fa=.7,ga=async(e,r)=>{try{let t=_(e.messages);await m({text:`Similarity search to find layers: ${t}`},r);let a=b(r,"layerSearch"),o=b(r,"layersAndFieldsRegistry"),i=await a.searchLayers({text:t,minScore:fa}),n=i.map(c=>c.id),l=i.map(({id:c,score:u})=>`${o.get(c)?.layerItem.name??c} (${u.toFixed(2)})`).join(`
|
|
66
|
+
`),d;return n.length>0?d=`Vector search completed. Matching layers with scores:
|
|
67
|
+
${l}`:d="Vector search completed. No matching layers found.",await m({text:d},r),{...e,vectorSearchLayerIds:n}}catch(t){throw await m({text:`Error during vector search: ${t instanceof Error?t.message:String(t)}`},r),new Error(`Vector search failed: ${t instanceof Error?t.message:String(t)}`)}},Ve=["mapView"];function U(e){let r=e?.configurable?.context;if(!r||typeof r!="object")throw new Error("LayerFilterAgent context missing");let t=Ve.filter(a=>!(a in r));if(t.length)throw new Error(`LayerFilterAgent context missing: ${t.join(", ")}`);return r}var ya=async(e,r)=>{try{await m({text:"Getting statistics for vector search results"},r);let t=b(r,"layersAndFieldsRegistry"),{mapView:a}=U(r),o=await me(e.vectorSearchFieldResults,t,a);return console.log("Field statistics retrieved:",o),await m({text:"Statistics retrieved"},r),{...e,layerFieldInfo:o}}catch(t){throw await m({text:"Error during fetching statistics"},r),new Error(`Error during fetching statistics: ${t instanceof Error?t.message:String(t)}`)}},he=async(e,r,t)=>{let a=e.map?.allLayers.find(n=>n.id===r),o=a.createQuery();o.where=t??"1=1";let{features:i}=await a.queryFeatures(o);e.goTo(i)},pa=(e,r,t)=>{let a=t.map?.allLayers.find(o=>o.id===e);return a?(a.definitionExpression=r,a.visible=!0,he(t,e,r),`Applied definition expression to layer "${a.title??e}": ${r}`):`Could not find layer with ID: ${e}`},wa=({layerId:e,definitionExpression:r},t)=>{let{mapView:a}=U(t);return pa(e,r,a)},ba=s.object({layerId:s.string().describe("The layerId of the layer on which to set a definitionExpression."),definitionExpression:s.string().describe("The SQL-92 where clause used to set a definition expression on the layer.")}),va=p(wa,{name:"setDefinitionExpression",description:"Set a SQL-92 where clause to the definition expression of a layer (i.e. a server-side filter). This filters features at the server level, affecting all views of the layer. Do not prioritize this tool unless specifically asked for or implied for server level, affecting all views of the layer.",schema:ba}),Oe=async(e,r)=>{let t=r.map?.allLayers.find(i=>i.id===e.layerId);if(!t)return{error:`Could not find geometry layer with ID: ${e.layerId}`};let a=await t.queryFeatures({where:e.where,returnGeometry:!0});if(!a.features.length)return{error:`No features found in geometry layer with the specified where clause: ${e.where}`};let o;if(a.features.length===1){let i=a.features[0].geometry;if(!i)return{error:"The geometry of the first feature is undefined or null."};o=i}else{let i=a.features.map(l=>l.geometry),n=K.executeMany(i);if(!n)return{error:"Failed to create a combined geometry."};o=n}return{geometry:o}},Sa=async(e,r,t,a,o)=>{let i=r.map?.allLayers.find(l=>l.id===e.layerId);if(!i)return`Could not find target layer with ID: ${e.layerId}`;console.log("Layer type:",i.type),console.log("Layer geometryType:",i.geometryType),console.log("Layer renderer:",i.renderer?.type);let n;if(o){let l=await Oe(o,r);if("error"in l)return l.error;n=l.geometry}return i.featureEffect=new Re({filter:new V({where:e.where,geometry:n,spatialRelationship:"intersects",distance:o?.distance,units:o?.units}),includedEffect:t,excludedEffect:a}),i.visible=!0,he(r,o?o.layerId:e.layerId,o?o.where:e.where),`Applied feature effects to target layer "${i.title??e.layerId}"${o?` using geometry from layer "${o.layerId}"`:""}.`},Ta=["feet","kilometers","meters","miles","nautical-miles","us-nautical-miles"],De=s.enum(Ta),xa=async({targetLayer:e,geometryLayer:r,includedEffect:t="drop-shadow(2px, 2px, 2px, gray)",excludedEffect:a="grayscale(100%) opacity(60%) blur(2px)"},o)=>{let{mapView:i}=U(o);return await Sa(e,i,t,a,r)},Ea=s.object({targetLayer:s.object({layerId:s.string().describe("The layerId of the layer on which to set a feature effect."),where:s.string().describe("The SQL-92 where clause representing the features to emphasize.")}),geometryLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the geometry by which to filter."),where:s.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:s.number().describe("The distance by which to filter the input geometry."),units:De.describe("The units used to filter by geometry and distance.")}).optional().describe("Optional geometry-based filtering parameters for spatial queries."),includedEffect:s.string().optional().default("drop-shadow(2px, 2px, 2px, gray)").describe("The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."),excludedEffect:s.string().optional().default("grayscale(100%) opacity(60%) blur(2px)").describe("The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified.")}),La=p(xa,{name:"setFeatureEffect",description:"Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",schema:Ea}),Ia=async(e,r,t)=>{let a=r.map?.allLayers.find(n=>n.id===e.layerId);if(!a)return`Could not find target layer with ID: ${e.layerId}`;let o;if(t){let n=await Oe(t,r);if("error"in n)return n.error;o=n.geometry}let i=await r.whenLayerView(a);return i.filter=new V({where:e.where,geometry:o,spatialRelationship:"intersects",distance:t?.distance,units:t?.units}),a.visible=!0,he(r,t?t.layerId:e.layerId,t?t.where:e.where),`Applied feature filter to layer "${a.title??e.layerId}"${t?` using geometry from layer "${t.layerId}"`:""}.`},$a=async({targetLayer:e,geometryLayer:r},t)=>{let{mapView:a}=U(t);return await Ia(e,a,r)},Fa=s.object({targetLayer:s.object({layerId:s.string().describe("The layerId of the layer on which to set a filter."),where:s.string().describe("The SQL-92 where clause representing the features to display.")}),geometryLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the geometry by which to filter."),where:s.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:s.number().describe("The distance by which to filter the input geometry."),units:De.describe("The units used to filter by geometry and distance.")}).optional().describe("Optional geometry-based filtering parameters for spatial queries.")}),_a=p($a,{name:"setFeatureFilter",description:"Sets a client-side filter using a where clause, geometry filter, or both on a target layer. This filters features at the client level in the view.",schema:Fa}),Be=[va,La,_a],Na=async(e,r)=>{await m({text:"Requesting LLM for layer filter results"},r);let t=await q("layer_filter_prompt");if(!r?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:a,userTimezoneOffset:o}=H(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:a,userTimezoneOffset:o},n=await C({promptText:t,messages:v(e.messages),inputVariables:i,tools:Be}),l=n.content.toString();return await B(n,r),{...e,messages:[...e.messages,n],outputMessage:l}};async function Ra(e,r){let t=await new L(Be).invoke({messages:v(e.messages)},r),a=t.messages.map(n=>n.text).join(`
|
|
68
|
+
`);await m({text:`Finished executing layer filter tool: ${a}`},r);let o=[...e.messages,...t.messages],i=t.messages.map(n=>n.text).join(`
|
|
69
|
+
`);return{...e,outputMessage:i,messages:o}}var Qe=y.Root({messages:y({reducer:$,default:()=>[]}),outputMessage:y({reducer:(e="",r)=>{let t=typeof r=="string"?r.trim():"";if(!t)return e;let a=e.trim();if(!a)return t;if(a===t)return e;let o=a.split(`
|
|
72
70
|
|
|
73
71
|
`);return o[o.length-1]?.trim()===t?e:`${e}
|
|
74
72
|
|
|
75
|
-
${t}`},default:()=>""}),vectorSearchLayerIds:
|
|
73
|
+
${t}`},default:()=>""}),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y()}),Aa=async(e,r)=>(await m({text:"Exiting Layer Filter agent"},r),e),qa=(e,r)=>D(["layerSearch","fieldSearch","layersAndFieldsRegistry"],"Layer Filter Agent")(e,r),za=()=>new A(Qe).addNode("requireLayerFilterServices",qa).addNode("vectorSearchLayers",ga).addNode("vectorSearchFields",ha).addNode("fieldStatistics",ya).addNode("agent",Na).addNode("tools",Ra).addNode("earlyExit",Aa).addEdge(R,"requireLayerFilterServices").addEdge("requireLayerFilterServices","vectorSearchLayers").addConditionalEdges("vectorSearchLayers",e=>e.vectorSearchLayerIds.length?"vectorSearchFields":"earlyExit").addConditionalEdges("vectorSearchFields",e=>e.vectorSearchFieldResults.length?"fieldStatistics":"earlyExit").addEdge("fieldStatistics","agent").addConditionalEdges("agent",e=>(e.messages[e.messages.length-1]?.tool_calls?.length??0)>0?"tools":"earlyExit").addEdge("tools","earlyExit").addEdge("earlyExit",x),Ma=String.raw`- **layer filter** — User wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
|
|
76
74
|
The Layer Filter Agent will automatically zoom to the affected features for action taken by this agent. In this case, no need to call navigation tool separately.
|
|
77
75
|
_Example: “Only show stations where Brand is Shell”_
|
|
78
76
|
_Example: “Make Shell stations stand out on the map”_
|
|
79
|
-
_Example: “Gray out all stations that aren’t Shell”_`,
|
|
77
|
+
_Example: “Gray out all stations that aren’t Shell”_`,Ms={id:"layerFilter",name:"Layer Filter Agent",description:Ma,createGraph:za,workspace:Qe},Ge=y.Root({messages:y({reducer:$,default:()=>[]}),outputMessage:y({reducer:(e="",r)=>{let t=typeof r=="string"?r.trim():"";if(!t)return e;let a=e.trim();if(!a)return t;if(a===t)return e;let o=a.split(`
|
|
80
78
|
|
|
81
79
|
`);return o[o.length-1]?.trim()===t?e:`${e}
|
|
82
80
|
|
|
83
|
-
${t}`},default:()=>""}),vectorSearchLayerIds:
|
|
84
|
-
`);return`${o.get(
|
|
85
|
-
${
|
|
86
|
-
`),
|
|
87
|
-
${
|
|
88
|
-
`),d;return
|
|
89
|
-
${l}`:d="Vector search completed. No matching layers found.",await m({text:d},r),{...e,vectorSearchLayerIds:s}}catch(t){throw await m({text:`Error during vector search: ${t instanceof Error?t.message:String(t)}`},r),new Error(`Vector search failed: ${t instanceof Error?t.message:String(t)}`)}},Ba=(e,r,t)=>{let a=e.createQuery();return a.outFields=[r],a.where=t||"1=1",a.num=1,a},Qa=async(e,r,t,a)=>{let o=a.map?.allLayers.find(d=>d.id===e),i=Ba(o,r,t.where),s=(await o.queryFeatures(i)).features[0],l=s?s.attributes[r]:null;return{tool:"getAttribute",layerName:o.title??e,summary:`${r} = ${l}`,details:{fieldName:r,value:l,where:t.where}}};async function Pa({layerId:e,fieldName:r,query:t},a){let{mapView:o}=P(a),i=await Qa(e,r,t,o);return JSON.stringify(i,null,2)}var Ga=n.object({layerId:n.string().describe("The layerId of the layer containing the field from which to get a value."),fieldName:n.string().describe("The name of the field/attribute from which to get a field value."),query:n.object({where:n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")})}),Wa=p(Pa,{name:"getAttribute",description:"Returns an attribute value for a given feature.",schema:Ga}),fe=async(e,r)=>{let t=r.map?.allLayers.find(i=>i.id===e.layerId);if(!t)return{error:`Could not find geometry layer with ID: ${e.layerId}`};let a=await t.queryFeatures({where:e.where,returnGeometry:!0});if(!a.features.length)return{error:`No features found in geometry layer with the specified where clause: ${e.where}`};let o;if(a.features.length===1){let i=a.features[0].geometry;if(!i)return{error:"The geometry of the first feature is undefined or null."};o=i}else{let i=a.features.map(l=>l.geometry),s=U.executeMany(i);if(!s)return{error:"Failed to create a combined geometry."};o=s}return{geometry:o}},Ua=async e=>{let{targetLayer:r,fieldName:t,statisticType:a,mapView:o,layersAndFieldsRegistry:i,geometryLayer:s}=e,l=o.map?.allLayers.find(f=>f.id===r.layerId);if(!l)throw new Error(`Layer '${r.layerId}' not found.`);let d=i.get(r.layerId)?.fieldRegistry.get(t);if(!d)throw new Error(`Field '${t}' not found.`);let c;if(s){let f=await fe(s,o);if("error"in f)throw new Error(f.error);if(c=f.geometry,s.distance&&s.units){let w=ke.execute(c,s.distance,{unit:s.units==="us-nautical-miles"?"nautical-miles":s.units});w&&(c=w)}}else c=o.extent.clone();let u=new V({geometry:c,spatialRelationship:"intersects"}),h=null,y=null;try{h=await ie({layer:l,field:t,sqlWhere:r.where,filter:u,outStatisticTypes:{include:[a]}}),d.type==="string"&&(y=(await ne({layer:l,field:t,sqlWhere:r.where,filter:u})).uniqueValueInfos)}catch(f){console.error("Statistics error:",f)}return{tool:"getStatistics",layerName:l.title??r.layerId,summary:`${a} = ${typeof h?.[a]=="number"?h[a]:"N/A"}`,details:{fieldName:t,statisticType:a,statistic:h?.[a]??null,summaryStatistics:h,uniqueValues:y,where:r.where}}},Ha=["feet","kilometers","meters","miles","nautical-miles","us-nautical-miles"],Ja=n.enum(Ha);async function Za({targetLayer:e,fieldName:r,statisticType:t,geometryLayer:a},o){let i=b(o,"layersAndFieldsRegistry"),{mapView:s}=P(o),l=await Ua({targetLayer:e,fieldName:r,statisticType:t,mapView:s,layersAndFieldsRegistry:i,geometryLayer:a});return console.log(l),JSON.stringify(l,null,2)}var Ka=n.object({targetLayer:n.object({layerId:n.string().describe("The layerId of the layer containing the field from which to get a value."),where:n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")}),geometryLayer:n.union([n.object({layerId:n.string().describe("The layerId of the layer containing the geometry by which to filter."),where:n.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:n.number().optional().describe("The distance by which to query from the input geometry."),units:Ja.optional().describe("The units used to query by geometry and distance.")}),n.object({}).strict()]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),fieldName:n.string().describe("The name of the field for which to get statistics."),statisticType:n.enum(["avg","max","median","min","stddev","sum","variance","nullcount","count"]).describe("The statistic type to calculate.")}),Ya=p(Za,{name:"getStatistics",description:"Returns one or more summary statistics for the given field. Statistic types include: count, maximum, minimum, average, median, standard deviation, variance, mode, sum, nullcount (number of features without a value for a given field), unique values. Statistics can be returned for number, date, and string fields. Only call this tool when the question requires filtering (e.g. a WHERE clause or spatial constraint) that cannot be satisfied by precomputed stats.",schema:Ka}),Xa=async(e,r,t,a)=>{let o=t.map?.allLayers.find(c=>c.id===e.layerId),i=a?await fe(a,t):{geometry:void 0},s="geometry"in i?i.geometry:void 0,l=new Ae({where:e.where||"1=1",outFields:e.outFields.length?e.outFields:["*"],orderByFields:e.orderByFields,geometry:s,spatialRelationship:s?"intersects":void 0,distance:a?.distance,units:a?.units,topFilter:new qe({topCount:r.topCount,groupByFields:r.groupByFields,orderByFields:r.orderByFields})}),d=await o.queryTopFeatures(l);return{tool:"getTopFeatures",layerName:o.title??e.layerId,summary:`Top ${r.topCount} features extracted`,details:{topCount:r.topCount,features:d.features,where:e.where}}},eo=async({targetLayer:e,topFilter:r,geometryLayer:t},a)=>{let{mapView:o}=P(a),i=await Xa(e,r,o,t);return JSON.stringify(i,null,2)},to=n.object({targetLayer:n.object({layerId:n.string().describe("The layerId of the layer containing the field from which to get a value."),where:n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:n.array(n.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:n.array(n.string().describe("The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output."))}),geometryLayer:n.object({layerId:n.string().describe("The layerId of the layer containing the geometry by which to filter."),where:n.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:n.number().describe("The distance by which to query from the input geometry."),units:z.describe("The units used to query by geometry and distance.")}).optional().describe("Optional geometry-based filtering parameters for spatial queries."),topFilter:n.object({topCount:n.number().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:n.array(n.string().describe("The field(s) and order for which to sort the resulting features.")),groupByFields:n.array(n.string().describe("The field(s) for which to group by the top features."))})}),ro=p(eo,{name:"getTopFeatures",description:"Returns the top n features from a layer",schema:to}),ao=async(e,r,t)=>{let a=r.map?.allLayers.find(d=>d.id===e.layerId),o=t?await fe(t,r):{geometry:void 0},i="geometry"in o?o.geometry:void 0,s=new se({where:e.where||"1=1",outFields:e.outFields.length?e.outFields:["*"],orderByFields:e.orderByFields,geometry:i,spatialRelationship:i?"intersects":void 0,distance:t?.distance,units:t?.units}),l=await a.queryFeatures(s);return{tool:"queryFeatures",layerName:a.title??e.layerId,summary:`${l.features.length} features found`,details:{totalCount:l.features.length,features:l.features.slice(0,10),where:e.where}}};async function oo({targetLayer:e,geometryLayer:r},t){let{mapView:a}=P(t),o=await ao(e,a,r);return JSON.stringify(o,null,2)}var io=n.object({targetLayer:n.object({layerId:n.string().describe("The layerId of the layer containing the field from which to get a value."),where:n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:n.array(n.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:n.array(n.string().describe("The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output."))}),geometryLayer:n.object({layerId:n.string().describe("The layerId of the layer containing the geometry by which to filter."),where:n.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:n.number().describe("The distance by which to query from the input geometry."),units:z.describe("The units used to query by geometry and distance.")}).optional().describe("Optional geometry-based filtering parameters for spatial queries.")}),no=p(oo,{name:"queryFeatures",description:"Queries for one or more features from a given layer.",schema:io}),Ge=[no,Ya,Wa,ro],so=async(e,r)=>{await m({text:"Requesting LLM for layer query results"},r);let t=await q("data_query_prompt");if(!r?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:a,userTimezoneOffset:o}=H(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:a,userTimezoneOffset:o},s=await C({promptText:t,messages:S(e.messages),inputVariables:i,tools:Ge});if(!(s.tool_calls&&Array.isArray(s.tool_calls)&&s.tool_calls.length>0))return{...e,messages:[...e.messages,s]};let l=s.content.toString()||"LLM requested tool calls.";return await B(s,r),{...e,outputMessage:l,messages:[...e.messages,s]}},lo=new L(Ge);async function co(e,r){let{messages:t}=await lo.invoke({messages:S(e.messages)},r),a=[],o=[];for(let l of t){let d=l.content;if(typeof d!="string"){console.warn("Skipping non-string tool output:",d);continue}let c;try{c=JSON.parse(d)}catch{console.warn("Skipping invalid JSON from tool:",d);continue}a.push(c),o.push(`- ${c.layerName}: ${c.summary}`)}if(o.length===0)return{...e,queryResponses:a};let i=new j({content:`Query results:
|
|
81
|
+
${t}`},default:()=>""}),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y(),queryResponses:y()}),ka=async(e,r)=>(await m({text:"Exiting Layer Query agent"},r),e);function G(e){let r=e?.configurable?.context;if(!r||typeof r!="object")throw new Error("LayerQueryAgent context missing");let t=Ve.filter(a=>!(a in r));if(t.length)throw new Error(`LayerQueryAgent context missing: ${t.join(", ")}`);return r}var Ca=async(e,r)=>{try{await m({text:"Getting statistics for vector search results"},r);let t=b(r,"layersAndFieldsRegistry"),{mapView:a}=G(r),o=await me(e.vectorSearchFieldResults,t,a);return console.log("Field statistics retrieved:",o),await m({text:"Statistics retrieved"},r),{...e,layerFieldInfo:o}}catch(t){throw await m({text:"Error during fetching statistics"},r),new Error(`Error during fetching statistics: ${t instanceof Error?t.message:String(t)}`)}},$e=.7,ja=10,Va=async(e,r)=>{try{let t=_(e.messages);await m({text:"Similarity search to find fields"},r);let a=b(r,"fieldSearch"),o=b(r,"layersAndFieldsRegistry"),i=b(r,"embeddingCache"),n=await a.searchFields({text:t,layerIds:e.vectorSearchLayerIds,minScore:$e,topResults:ja,embeddingCache:i}),l=n.map(({layerId:c,results:u})=>{let h=u.map(g=>` - ${g.name} (${g.score.toFixed(2)})`).join(`
|
|
82
|
+
`);return`${o.get(c)?.layerItem.name??c}:
|
|
83
|
+
${h}`}).join(`
|
|
84
|
+
`),d;return n.length>0?d=`Vector search completed. Matching layers and fields with scores:
|
|
85
|
+
${l}`:d=`No vector search results found for score over ${$e}.`,await m({text:d},r),{...e,vectorSearchFieldResults:n}}catch(t){throw await m({text:`Error during vector search: ${t instanceof Error?t.message:String(t)}`},r),new Error(`Vector search failed: ${t instanceof Error?t.message:String(t)}`)}},Oa=.7,Da=async(e,r)=>{try{let t=_(e.messages);await m({text:`Similarity search to find layers: ${t}`},r);let a=b(r,"layerSearch"),o=b(r,"layersAndFieldsRegistry"),i=await a.searchLayers({text:t,minScore:Oa}),n=i.map(c=>c.id),l=i.map(({id:c,score:u})=>`${o.get(c)?.layerItem.name??c} (${u.toFixed(2)})`).join(`
|
|
86
|
+
`),d;return n.length>0?d=`Vector search completed. Matching layers with scores:
|
|
87
|
+
${l}`:d="Vector search completed. No matching layers found.",await m({text:d},r),{...e,vectorSearchLayerIds:n}}catch(t){throw await m({text:`Error during vector search: ${t instanceof Error?t.message:String(t)}`},r),new Error(`Vector search failed: ${t instanceof Error?t.message:String(t)}`)}},Ba=(e,r,t)=>{let a=e.createQuery();return a.outFields=[r],a.where=t||"1=1",a.num=1,a},Qa=async(e,r,t,a)=>{let o=a.map?.allLayers.find(d=>d.id===e),i=Ba(o,r,t.where),n=(await o.queryFeatures(i)).features[0],l=n?n.attributes[r]:null;return{tool:"getAttribute",layerName:o.title??e,summary:`${r} = ${l}`,details:{fieldName:r,value:l,where:t.where}}};async function Ga({layerId:e,fieldName:r,query:t},a){let{mapView:o}=G(a),i=await Qa(e,r,t,o);return JSON.stringify(i,null,2)}var Pa=s.object({layerId:s.string().describe("The layerId of the layer containing the field from which to get a value."),fieldName:s.string().describe("The name of the field/attribute from which to get a field value."),query:s.object({where:s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")})}),Wa=p(Ga,{name:"getAttribute",description:"Returns an attribute value for a given feature.",schema:Pa}),fe=async(e,r)=>{let t=r.map?.allLayers.find(i=>i.id===e.layerId);if(!t)return{error:`Could not find geometry layer with ID: ${e.layerId}`};let a=await t.queryFeatures({where:e.where,returnGeometry:!0});if(!a.features.length)return{error:`No features found in geometry layer with the specified where clause: ${e.where}`};let o;if(a.features.length===1){let i=a.features[0].geometry;if(!i)return{error:"The geometry of the first feature is undefined or null."};o=i}else{let i=a.features.map(l=>l.geometry),n=K.executeMany(i);if(!n)return{error:"Failed to create a combined geometry."};o=n}return{geometry:o}},Ka=async e=>{let{targetLayer:r,fieldName:t,statisticType:a,mapView:o,layersAndFieldsRegistry:i,geometryLayer:n}=e,l=o.map?.allLayers.find(f=>f.id===r.layerId);if(!l)throw new Error(`Layer '${r.layerId}' not found.`);let d=i.get(r.layerId)?.fieldRegistry.get(t);if(!d)throw new Error(`Field '${t}' not found.`);let c;if(n){let f=await fe(n,o);if("error"in f)throw new Error(f.error);if(c=f.geometry,n.distance&&n.units){let w=ze.execute(c,n.distance,{unit:n.units==="us-nautical-miles"?"nautical-miles":n.units});w&&(c=w)}}else c=o.extent.clone();let u=new V({geometry:c,spatialRelationship:"intersects"}),h=null,g=null;try{h=await ie({layer:l,field:t,sqlWhere:r.where,filter:u,outStatisticTypes:{include:[a]}}),d.type==="string"&&(g=(await ne({layer:l,field:t,sqlWhere:r.where,filter:u})).uniqueValueInfos)}catch(f){console.error("Statistics error:",f)}return{tool:"getStatistics",layerName:l.title??r.layerId,summary:`${a} = ${typeof h?.[a]=="number"?h[a]:"N/A"}`,details:{fieldName:t,statisticType:a,statistic:h?.[a]??null,summaryStatistics:h,uniqueValues:g,where:r.where}}},Ha=["feet","kilometers","meters","miles","nautical-miles","us-nautical-miles"],Ua=s.enum(Ha);async function Ja({targetLayer:e,fieldName:r,statisticType:t,geometryLayer:a},o){let i=b(o,"layersAndFieldsRegistry"),{mapView:n}=G(o),l=await Ka({targetLayer:e,fieldName:r,statisticType:t,mapView:n,layersAndFieldsRegistry:i,geometryLayer:a});return console.log(l),JSON.stringify(l,null,2)}var Za=s.object({targetLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the field from which to get a value."),where:s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")}),geometryLayer:s.union([s.object({layerId:s.string().describe("The layerId of the layer containing the geometry by which to filter."),where:s.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:s.number().optional().describe("The distance by which to query from the input geometry."),units:Ua.optional().describe("The units used to query by geometry and distance.")}),s.object({}).strict()]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),fieldName:s.string().describe("The name of the field for which to get statistics."),statisticType:s.enum(["avg","max","median","min","stddev","sum","variance","nullcount","count"]).describe("The statistic type to calculate.")}),Ya=p(Ja,{name:"getStatistics",description:"Returns one or more summary statistics for the given field. Statistic types include: count, maximum, minimum, average, median, standard deviation, variance, mode, sum, nullcount (number of features without a value for a given field), unique values. Statistics can be returned for number, date, and string fields. Only call this tool when the question requires filtering (e.g. a WHERE clause or spatial constraint) that cannot be satisfied by precomputed stats.",schema:Za}),Xa=async(e,r,t,a)=>{let o=t.map?.allLayers.find(c=>c.id===e.layerId),i=a?await fe(a,t):{geometry:void 0},n="geometry"in i?i.geometry:void 0,l=new Ae({where:e.where||"1=1",outFields:e.outFields.length?e.outFields:["*"],orderByFields:e.orderByFields,geometry:n,spatialRelationship:n?"intersects":void 0,distance:a?.distance,units:a?.units,topFilter:new qe({topCount:r.topCount,groupByFields:r.groupByFields,orderByFields:r.orderByFields})}),d=await o.queryTopFeatures(l);return{tool:"getTopFeatures",layerName:o.title??e.layerId,summary:`Top ${r.topCount} features extracted`,details:{topCount:r.topCount,features:d.features,where:e.where}}},eo=async({targetLayer:e,topFilter:r,geometryLayer:t},a)=>{let{mapView:o}=G(a),i=await Xa(e,r,o,t);return JSON.stringify(i,null,2)},to=s.object({targetLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the field from which to get a value."),where:s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:s.array(s.string().describe("The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output."))}),geometryLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the geometry by which to filter."),where:s.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:s.number().describe("The distance by which to query from the input geometry."),units:M.describe("The units used to query by geometry and distance.")}).optional().describe("Optional geometry-based filtering parameters for spatial queries."),topFilter:s.object({topCount:s.number().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),groupByFields:s.array(s.string().describe("The field(s) for which to group by the top features."))})}),ro=p(eo,{name:"getTopFeatures",description:"Returns the top n features from a layer",schema:to}),ao=async(e,r,t)=>{let a=r.map?.allLayers.find(d=>d.id===e.layerId),o=t?await fe(t,r):{geometry:void 0},i="geometry"in o?o.geometry:void 0,n=new se({where:e.where||"1=1",outFields:e.outFields.length?e.outFields:["*"],orderByFields:e.orderByFields,geometry:i,spatialRelationship:i?"intersects":void 0,distance:t?.distance,units:t?.units}),l=await a.queryFeatures(n);return{tool:"queryFeatures",layerName:a.title??e.layerId,summary:`${l.features.length} features found`,details:{totalCount:l.features.length,features:l.features.slice(0,10),where:e.where}}};async function oo({targetLayer:e,geometryLayer:r},t){let{mapView:a}=G(t),o=await ao(e,a,r);return JSON.stringify(o,null,2)}var io=s.object({targetLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the field from which to get a value."),where:s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:s.array(s.string().describe("The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output."))}),geometryLayer:s.object({layerId:s.string().describe("The layerId of the layer containing the geometry by which to filter."),where:s.string().describe("The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."),distance:s.number().describe("The distance by which to query from the input geometry."),units:M.describe("The units used to query by geometry and distance.")}).optional().describe("Optional geometry-based filtering parameters for spatial queries.")}),no=p(oo,{name:"queryFeatures",description:"Queries for one or more features from a given layer.",schema:io}),Pe=[no,Ya,Wa,ro],so=async(e,r)=>{await m({text:"Requesting LLM for layer query results"},r);let t=await q("data_query_prompt");if(!r?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:a,userTimezoneOffset:o}=H(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:a,userTimezoneOffset:o},n=await C({promptText:t,messages:v(e.messages),inputVariables:i,tools:Pe});if(!(n.tool_calls&&Array.isArray(n.tool_calls)&&n.tool_calls.length>0))return{...e,messages:[...e.messages,n]};let l=n.content.toString()||"LLM requested tool calls.";return await B(n,r),{...e,outputMessage:l,messages:[...e.messages,n]}},lo=new L(Pe);async function co(e,r){let{messages:t}=await lo.invoke({messages:v(e.messages)},r),a=[],o=[];for(let l of t){let d=l.content;if(typeof d!="string"){console.warn("Skipping non-string tool output:",d);continue}let c;try{c=JSON.parse(d)}catch{console.warn("Skipping invalid JSON from tool:",d);continue}a.push(c),o.push(`- ${c.layerName}: ${c.summary}`)}if(o.length===0)return{...e,queryResponses:a};let i=new j({content:`Query results:
|
|
90
88
|
${o.join(`
|
|
91
|
-
`)}`}),
|
|
89
|
+
`)}`}),n=`Query results:
|
|
92
90
|
${o.join(`
|
|
93
|
-
`)}`;return{...e,outputMessage:
|
|
91
|
+
`)}`;return{...e,outputMessage:n,messages:[...e.messages,...t,i],queryResponses:a}}var uo=async(e,r)=>{try{await m({text:"Requesting LLM for summary on query results"},r);let t=await q("summarize_query_response_prompt"),a={queryResponse:e.queryResponses},o=await Y({promptText:t,messages:v(e.messages),inputVariables:a}),i=typeof o=="string"?o:o.content;return e.messages=[...e.messages,new j(i)],e.outputMessage=i,await m({text:`Received response from LLM: ${i}`},r),e}catch(t){throw await m({text:"Error during filter LLM request"},r),new Error(`Error during filter LLM request: ${t instanceof Error?t.message:String(t)}`)}},mo=(e,r)=>D(["layerSearch","fieldSearch","layersAndFieldsRegistry"],"Layer Query Agent")(e,r),ho=()=>new A(Ge).addNode("requireLayerQueryServices",mo).addNode("vectorSearchLayers",Da).addNode("vectorSearchFields",Va).addNode("fieldStatistics",Ca).addNode("agent",so).addNode("tools",co).addNode("summarizeQueryResponseLLM",uo).addNode("earlyExit",ka).addEdge(R,"requireLayerQueryServices").addEdge("requireLayerQueryServices","vectorSearchLayers").addConditionalEdges("vectorSearchLayers",e=>e.vectorSearchLayerIds.length?"vectorSearchFields":"earlyExit").addConditionalEdges("vectorSearchFields",e=>e.vectorSearchFieldResults.length?"fieldStatistics":"earlyExit").addEdge("fieldStatistics","agent").addEdge("agent","tools").addConditionalEdges("tools",e=>e.queryResponses.length?"summarizeQueryResponseLLM":"earlyExit").addEdge("summarizeQueryResponseLLM",x).addEdge("earlyExit",x),fo=String.raw`- **layerQuery** — 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. CRITICAL: Always call the Layer Filter Agent after this agent.
|
|
94
92
|
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?”).
|
|
95
93
|
_Example: “How many features are there?”_
|
|
96
94
|
_Example: “What’s the average population?”_
|
|
97
|
-
_Example: “Which values are in the status field?”_`,
|
|
98
|
-
`);return`${o.get(
|
|
99
|
-
${
|
|
100
|
-
`),
|
|
101
|
-
${
|
|
102
|
-
`),d;return
|
|
103
|
-
${l}`:d="Vector search completed. No matching layers found.",await m({text:d},r),{...e,vectorSearchLayerIds:
|
|
95
|
+
_Example: “Which values are in the status field?”_`,ks={id:"layerQuery",name:"Layer Query Agent",description:fo,createGraph:ho,workspace:Ge},Fe=.7,go=10,yo=async(e,r)=>{try{let t=_(e.messages);await m({text:"Similarity search to find fields"},r);let a=b(r,"fieldSearch"),o=b(r,"layersAndFieldsRegistry"),i=b(r,"embeddingCache"),n=await a.searchFields({text:t,layerIds:e.vectorSearchLayerIds,minScore:Fe,topResults:go,embeddingCache:i}),l=n.map(({layerId:c,results:u})=>{let h=u.map(g=>` - ${g.name} (${g.score.toFixed(2)})`).join(`
|
|
96
|
+
`);return`${o.get(c)?.layerItem.name??c}:
|
|
97
|
+
${h}`}).join(`
|
|
98
|
+
`),d;return n.length>0?d=`Vector search completed. Matching layers and fields with scores:
|
|
99
|
+
${l}`:d=`No vector search results found for score over ${Fe}.`,await m({text:d},r),{...e,vectorSearchFieldResults:n}}catch(t){throw await m({text:`Error during vector search: ${t instanceof Error?t.message:String(t)}`},r),new Error(`Vector search failed: ${t instanceof Error?t.message:String(t)}`)}},po=.7,wo=async(e,r)=>{try{let t=_(e.messages);await m({text:`Similarity search to find layers: ${t}`},r);let a=b(r,"layerSearch"),o=b(r,"layersAndFieldsRegistry"),i=await a.searchLayers({text:t,minScore:po}),n=i.map(c=>c.id),l=i.map(({id:c,score:u})=>`${o.get(c)?.layerItem.name??c} (${u.toFixed(2)})`).join(`
|
|
100
|
+
`),d;return n.length>0?d=`Vector search completed. Matching layers with scores:
|
|
101
|
+
${l}`:d="Vector search completed. No matching layers found.",await m({text:d},r),{...e,vectorSearchLayerIds:n}}catch(t){throw await m({text:`Error during vector search: ${t instanceof Error?t.message:String(t)}`},r),new Error(`Vector search failed: ${t instanceof Error?t.message:String(t)}`)}};async function bo(e){let{fields:r,layer:t,view:a,styleName:o,colorSchemeTags:i}=e,n;return i?n=it({basemapTheme:await Te(a),geometryType:t.geometryType,includedTags:i,numColors:Math.min(r.length,8)})[0]:n=nt({basemapTheme:await Te(a),geometryType:t.geometryType,numColors:Math.min(r.length,8)}).primaryScheme,{layer:t,view:a,attributes:r.map(l=>({field:l,label:t.fields.find(d=>d.name===l)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:o.includes("Size"),pieChartScheme:n}}async function vo(e){return await ot(e)}async function So({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o,includeSize:i}){let n=r,l=e?.allLayers.find(c=>c.id===t);if(!l)return`Could not find layer for id: ${t}`;let d={styleName:i?"chart-size":"chart",fields:a,layer:l,view:n,colorSchemeTags:o};try{let c=await bo(d),u=await vo(c);return l.renderer=u.renderer,l.visible=!0,`Chart renderer applied to layer: ${l.title??l.id} using fields ${a.join(", ")}`}catch(c){return`Error applying chart renderer: ${c instanceof Error?c.message:String(c)}`}}var To=["mapView"];function I(e){let r=e?.configurable?.context;if(!r||typeof r!="object")throw new Error("LayerStylingAgent context missing");let t=To.filter(a=>!(a in r));if(t.length)throw new Error(`LayerStylingAgent context missing: ${t.join(", ")}`);return r}async function xo({layerId:e,fields:r,colorSchemes:t,includeSize:a},o){let{mapView:i}=I(o);return await E({id:"show-legend",description:"Show Legend",payload:{layerIds:[e]}},o),await So({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:r,colorSchemes:t,includeSize:a})}var Eo=s.object({layerId:s.string().describe("The id of the layer to apply the chart renderer to"),fields:s.array(s.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use"),includeSize:s.boolean().optional().describe("Whether to vary the chart size (chart-size)")}),Lo=p(xo,{name:"chart",description:`Label: Charts
|
|
104
102
|
Description: Show the values of two or more categories as a proportion of the total using a pie chart.
|
|
105
103
|
Keywords: pie, chart, all categories, breakdown, proportion
|
|
106
104
|
Example: Show the total number of homes built in each decade using a pie chart for each feature.
|
|
@@ -110,19 +108,19 @@ ${l}`:d="Vector search completed. No matching layers found.",await m({text:d},r)
|
|
|
110
108
|
Description: Show the values of two or more categories as a proportion of the total using a pie chart and use size to capture the total amount or magnitude.
|
|
111
109
|
Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
|
|
112
110
|
Example: Show the total number of homes built in each decade using a pie chart for each feature and vary the size of each chart based on the total of all categories.
|
|
113
|
-
Fields: This style requires 2-8 number fields.`,schema:Eo});function Io(e){let{fields:r,layer:t,view:a,theme:o,colorSchemeTags:i}=e,
|
|
111
|
+
Fields: This style requires 2-8 number fields.`,schema:Eo});function Io(e){let{fields:r,layer:t,view:a,theme:o,colorSchemeTags:i}=e,n=r[0],l;return i&&(l=le({geometryType:t.geometryType,includedTags:i,theme:o||"high-to-low"})[0]),{layer:t,view:a,startTime:n,endTime:new Date,theme:o,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:l}}async function $o(e){return await st(e)}async function Fo({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o,theme:i}){let n=r,l=e?.allLayers.find(c=>c.id===t);if(!l)return`Could not find layer for id: ${t}`;let d={styleName:"color-age",fields:a,layer:l,view:n,colorSchemeTags:o,theme:i};try{let c=Io(d),u=await $o(c);return l.renderer=u.renderer,l.visible=!0,`Color-age renderer applied to layer: ${l.title??l.id} using fields ${a.join(", ")}`}catch(c){return`Error applying color-age renderer: ${c instanceof Error?c.message:String(c)}`}}async function _o({layerId:e,fields:r,colorSchemes:t,theme:a},o){let{mapView:i}=I(o);return await E({id:"show-legend",description:"Show Legend",payload:{layerIds:[e]}},o),await Fo({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:r,colorSchemes:t,theme:a})}var No=s.object({layerId:s.string().describe("The id of the layer to apply the color-age renderer to"),fields:s.array(s.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use"),theme:s.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Ro=p(_o,{name:"color-age",description:`Label: Age (color)
|
|
114
112
|
Description: Use colors along a continuous color ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
|
|
115
113
|
Keywords: since, age, how old, how long
|
|
116
114
|
Example: Show the age of each feature based on its reported date.
|
|
117
|
-
Fields: This style requires at least one field with a date type.`,schema:No});function Ao(e){let{fields:r,layer:t,view:a,colorSchemeTags:o}=e,{theme:i}=e,
|
|
115
|
+
Fields: This style requires at least one field with a date type.`,schema:No});function Ao(e){let{fields:r,layer:t,view:a,colorSchemeTags:o}=e,{theme:i}=e,n=r[1],l=r[0],d;return o&&(d=le({geometryType:t.geometryType,includedTags:o,theme:i||"high-to-low"})[0]),{layer:t,view:a,field:l,normalizationField:n,theme:i,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0,colorScheme:d}}async function qo(e){return await lt(e)}async function zo({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o,theme:i}){let n=r,l=e?.allLayers.find(c=>c.id===t);if(!l)return`Could not find layer for id: ${t}`;let d={styleName:"color",fields:a,layer:l,view:n,colorSchemeTags:o,theme:i};try{let c=Ao(d),u=await qo(c);return l.renderer=u.renderer,l.visible=!0,`Color renderer applied to layer: ${l.title??l.id} using fields ${a.join(", ")}`}catch(c){return`Error applying color renderer: ${c instanceof Error?c.message:String(c)}`}}async function Mo({layerId:e,fields:r,colorSchemes:t,theme:a},o){let{mapView:i}=I(o);return await E({id:"show-legend",description:"Show Legend",payload:{layerIds:[e]}},o),await zo({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:r,colorSchemes:t,theme:a})}var ko=s.object({layerId:s.string().describe("The id of the layer to apply the color renderer to"),fields:s.array(s.string()).describe("The field(s) to use for the color renderer"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use"),theme:s.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color ramp")}),Co=p(Mo,{name:"color",description:`Label: Counts and Amounts (color)
|
|
118
116
|
Description: Vary color along a continuous color ramp to represent numeric or ranked data.
|
|
119
117
|
Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
|
|
120
118
|
Example: Color each feature based on the population density.
|
|
121
|
-
Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.`,schema:
|
|
119
|
+
Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.`,schema:ko});function jo(e){let{fields:r,layer:t,view:a,colorSchemeTags:o,theme:i}=e,n,l,d=r[0];return o&&(l=le({geometryType:t.geometryType,includedTags:o,theme:i||"high-to-low"})[0]),{layer:t,view:a,field:d,normalizationField:n,theme:i,colorOptions:{colorScheme:l}}}async function Vo(e){return await ct(e)}async function Oo({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o,theme:i}){let n=r,l=e?.allLayers.find(c=>c.id===t);if(!l)return`Could not find layer for id: ${t}`;let d={styleName:"color-size-univariate",fields:a,layer:l,view:n,colorSchemeTags:o,theme:i};try{let c=jo(d),u=await Vo(c);return l.renderer=u.renderer,l.visible=!0,`Color-size-univariate renderer applied to layer: ${l.title??l.id} using fields ${a.join(", ")}`}catch(c){return`Error applying color-size-univariate renderer: ${c instanceof Error?c.message:String(c)}`}}async function Do({layerId:e,fields:r,colorSchemes:t,theme:a},o){let{mapView:i}=I(o);return await E({id:"show-legend",description:"Show Legend",payload:{layerIds:[e]}},o),await Oo({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:r,colorSchemes:t,theme:a})}var Bo=s.object({layerId:s.string().describe("The id of the layer to apply the color-size univariate renderer to"),fields:s.array(s.string()).describe("The fields to use for the color-size univariate renderer"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use"),theme:s.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color and size ramps")}),Qo=p(Do,{name:"color-size-univariate",description:`Label: Color and Size (univariate)
|
|
122
120
|
Description: Vary symbol size and color based on the values of two numeric attributes.
|
|
123
121
|
Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
|
|
124
122
|
Example: Color each feature based on the percentage of the population that owns a home and vary the size of each point based on total population.
|
|
125
|
-
Fields: This style requires at least two fields: one determining the color of each feature, the other determining the size of each feature. Each field may be normalized by an additional normalization field.`,schema:Bo});function
|
|
123
|
+
Fields: This style requires at least two fields: one determining the color of each feature, the other determining the size of each feature. Each field may be normalized by an additional normalization field.`,schema:Bo});function Go(e){let{fields:r,layer:t,view:a,colorSchemeTags:o}=e,i;return o&&(i=ut({includedTags:o,numColors:Math.min(r.length,8)})[0]),{layer:t,view:a,legendOptions:{unit:"units"},attributes:r.map(n=>({field:n,label:t.fields.find(l=>l.name===n)?.alias??""})).slice(0,8),outlineOptimizationEnabled:!0,dotDensityScheme:i}}async function Po(e){return await dt(e)}async function Wo({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o}){let i=r,n=e?.allLayers.find(d=>d.id===t);if(!n)return`Could not find layer for id: ${t}`;let l={styleName:"dot-density",fields:a,layer:n,view:i,colorSchemeTags:o};try{let d=Go(l),c=await Po(d);return n.renderer=c.renderer,n.visible=!0,`Dot Density renderer applied to layer: ${n.title??n.id} using fields ${a.join(", ")}`}catch(d){return`Error applying dot density renderer: ${d instanceof Error?d.message:String(d)}`}}async function Ko({layerId:e,fields:r,colorSchemes:t},a){let{mapView:o}=I(a);return await E({id:"show-legend",description:"Show Legend",payload:{layerIds:[e]}},a),await Wo({arcgisMap:o.map,arcgisMapView:o,layerId:e,fields:r,colorSchemes:t})}var Ho=s.object({layerId:s.string().describe("The id of the layer to apply the dot density renderer to"),fields:s.array(s.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use")}),Uo=p(Ko,{name:"dot-density",description:`Dot Density
|
|
126
124
|
Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
|
|
127
125
|
**Use cases:**
|
|
128
126
|
- Population distribution visualization
|
|
@@ -133,11 +131,11 @@ ${l}`:d="Vector search completed. No matching layers found.",await m({text:d},r)
|
|
|
133
131
|
- Visualize distribution of different crops across regions
|
|
134
132
|
- Display demographic patterns within census tracts
|
|
135
133
|
**Fields:** Requires 2-8 number fields.
|
|
136
|
-
**Keywords:** density, how much, how many, total, number, amount`,schema:Ho});function
|
|
134
|
+
**Keywords:** density, how much, how many, total, number, amount`,schema:Ho});function Jo(e){let{fields:r,layer:t,view:a,colorSchemeTags:o}=e,i,n=r[0];return o&&(i=ht({includedTags:o,basemap:a.map?.basemap||"topo"})[0]),{layer:t,view:a,field:n,heatmapScheme:i}}async function Zo(e){return await mt(e)}async function Yo({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o}){let i=r,n=e?.allLayers.find(d=>d.id===t);if(!n)return`Could not find layer for id: ${t}`;let l={styleName:"heatmap",fields:a,layer:n,view:i,colorSchemeTags:o};try{let d=Jo(l),c=await Zo(d);return n.renderer=c.renderer,n.visible=!0,`Heatmap renderer applied to layer: ${n.title??n.id} using fields ${a.join(", ")}`}catch(d){return`Error applying heatmap renderer: ${d instanceof Error?d.message:String(d)}`}}async function Xo({layerId:e,fields:r,colorSchemes:t},a){let{mapView:o}=I(a);return await E({id:"show-legend",description:"Show Legend",payload:{layerIds:[e]}},a),await Yo({arcgisMap:o.map,arcgisMapView:o,layerId:e,fields:r,colorSchemes:t})}var ei=s.object({layerId:s.string().describe("The id of the layer to apply the heatmap renderer to"),fields:s.array(s.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use")}),ti=p(Xo,{name:"heatmap",description:`Label: Heat Map
|
|
137
135
|
Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
|
|
138
136
|
Keywords: density, heatmap, hot spots, pattern, cluster
|
|
139
137
|
Example: Create a heatmap
|
|
140
|
-
Fields: This typically requires zero or one field of type number.`,schema:ei});function ri(e){let{fields:r,layer:t,view:a,styleName:o,colorSchemeTags:i}=e,
|
|
138
|
+
Fields: This typically requires zero or one field of type number.`,schema:ei});function ri(e){let{fields:r,layer:t,view:a,styleName:o,colorSchemeTags:i}=e,n;return i&&(n=gt({geometryType:t.geometryType,includedTags:i,numColors:Math.min(r.length,10)})[0]),{layer:t,view:a,fields:r.map(l=>({name:l})).slice(0,9),outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,includeSizeVariable:o.includes("Size"),predominanceScheme:n}}async function ai(e){return await ft(e)}async function oi({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o,includeSize:i}){let n=r,l=e?.allLayers.find(c=>c.id===t);if(!l)return`Could not find layer for id: ${t}`;let d={styleName:i?"predominance-size":"predominance",fields:a,layer:l,view:n,colorSchemeTags:o};try{let c=ri(d),u=await ai(c);return l.renderer=u.renderer,l.visible=!0,`Predominance renderer applied to layer: ${l.title??l.id} using fields ${a.join(", ")}`}catch(c){return`Error applying predominance renderer: ${c instanceof Error?c.message:String(c)}`}}async function ii({layerId:e,fields:r,colorSchemes:t,includeSize:a},o){let{mapView:i}=I(o);return await E({id:"show-legend",description:"Show Legend",payload:{layerIds:[e]}},o),await oi({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:r,colorSchemes:t,includeSize:a})}var ni=s.object({layerId:s.string().describe("The id of the layer to apply the predominance renderer to"),fields:s.array(s.string()).describe("The fields to use for the predominance renderer (competing categories)"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use"),includeSize:s.boolean().optional().describe("Whether to include size visualization (predominance-size)")}),si=p(ii,{name:"predominance",description:`Label: Predominant category
|
|
141
139
|
Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
|
|
142
140
|
Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top
|
|
143
141
|
Example: Using fields for Corn Acres, Wheat Acres, and Cotton Acres, show the predominant crop harvested in each area.
|
|
@@ -147,15 +145,15 @@ Fields: This typically requires zero or one field of type number.`,schema:ei});f
|
|
|
147
145
|
Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value. Also varies the size of each symbol based on the total of all categories.
|
|
148
146
|
Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
|
|
149
147
|
Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
|
|
150
|
-
Fields: This style relies on 2-10 number fields.`,schema:ni});function li(e){let{fields:r,layer:t,view:a,colorSchemeTags:o}=e,i,
|
|
148
|
+
Fields: This style relies on 2-10 number fields.`,schema:ni});function li(e){let{fields:r,layer:t,view:a,colorSchemeTags:o}=e,i,n={field:r[0]},l={field:r[1]};return o&&(i=pt({geometryType:t.geometryType,includedTags:o})[0]),{layer:t,view:a,field1:n,field2:l,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,relationshipScheme:i}}async function ci(e){return await yt(e)}async function di({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o}){let i=r,n=e?.allLayers.find(d=>d.id===t);if(!n)return`Could not find layer for id: ${t}`;let l={styleName:"relationship",fields:a,layer:n,view:i,colorSchemeTags:o};try{let d=li(l),c=await ci(d);return n.renderer=c.renderer,n.visible=!0,`Relationship renderer applied to layer: ${n.title??n.id} using fields ${a.join(", ")}`}catch(d){return`Error applying relationship renderer: ${d instanceof Error?d.message:String(d)}`}}async function ui({layerId:e,fields:r,colorSchemes:t},a){let{mapView:o}=I(a);return await E({id:"show-legend",description:"Show Legend",payload:{layerIds:[e]}},a),await di({arcgisMap:o.map,arcgisMapView:o,layerId:e,fields:r,colorSchemes:t})}var mi=s.object({layerId:s.string().describe("The id of the layer to apply the relationship renderer to"),fields:s.array(s.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use")}),hi=p(ui,{name:"relationship",description:`Label: Relationship
|
|
151
149
|
Description: Overlays two color ramps to represent the relationship between two numeric attributes.
|
|
152
150
|
Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
|
|
153
151
|
Example: Show the relationship between tree height and carbon storage
|
|
154
|
-
Fields: This style requires two number fields.`,schema:mi});function fi(e){let{fields:r,layer:t,view:a,theme:o}=e,i=r[0];return{layer:t,view:a,startTime:i,endTime:new Date,theme:o,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function gi(e){return await wt(e)}async function yi({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o,theme:i}){let
|
|
152
|
+
Fields: This style requires two number fields.`,schema:mi});function fi(e){let{fields:r,layer:t,view:a,theme:o}=e,i=r[0];return{layer:t,view:a,startTime:i,endTime:new Date,theme:o,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function gi(e){return await wt(e)}async function yi({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o,theme:i}){let n=r,l=e?.allLayers.find(c=>c.id===t);if(!l)return`Could not find layer for id: ${t}`;let d={styleName:"size-age",fields:a,layer:l,view:n,colorSchemeTags:o,theme:i};try{let c=fi(d),u=await gi(c);return l.renderer=u.renderer,l.visible=!0,`Size-age renderer applied to layer: ${l.title??l.id} using fields ${a.join(", ")}`}catch(c){return`Error applying size-age renderer: ${c instanceof Error?c.message:String(c)}`}}async function pi({layerId:e,fields:r,colorSchemes:t,theme:a},o){let{mapView:i}=I(o);return await E({id:"show-legend",description:"Show Legend",payload:{layerIds:[e]}},o),await yi({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:r,colorSchemes:t,theme:a})}var wi=s.object({layerId:s.string().describe("The id of the layer to apply the size-age renderer to"),fields:s.array(s.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use"),theme:s.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),bi=p(pi,{name:"size-age",description:`Label: Age (size)
|
|
155
153
|
Description: Vary symbol sizes along a continuous ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
|
|
156
154
|
Keywords: since, age, how old, how long
|
|
157
155
|
Example: Change the size of features so older features are larger than new features.
|
|
158
|
-
Fields: This style requires at least one field with a date type.`,schema:wi});function
|
|
156
|
+
Fields: This style requires at least one field with a date type.`,schema:wi});function vi(e){let{fields:r,layer:t,view:a}=e,{theme:o}=e,i=r[1],n=r[0];return{layer:t,view:a,field:n,normalizationField:i,theme:o,sizeOptimizationEnabled:!0,outlineOptimizationEnabled:!0}}async function Si(e){return await bt(e)}async function Ti({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o,theme:i}){let n=r,l=e?.allLayers.find(c=>c.id===t);if(!l)return`Could not find layer for id: ${t}`;let d={styleName:"size",fields:a,layer:l,view:n,colorSchemeTags:o,theme:i};try{let c=vi(d),u=await Si(c);return l.renderer=u.renderer,l.visible=!0,`Size renderer applied to layer: ${l.title??l.id} using fields ${a.join(", ")}`}catch(c){return`Error applying size renderer: ${c instanceof Error?c.message:String(c)}`}}async function xi({layerId:e,fields:r,colorSchemes:t,theme:a},o){let{mapView:i}=I(o);return await E({id:"show-legend",description:"Show Legend",payload:{layerIds:[e]}},o),await Ti({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:r,colorSchemes:t,theme:a})}var Ei=s.object({layerId:s.string().describe("The id of the layer to apply the size renderer to"),fields:s.array(s.string()).describe("The field(s) to use for the size renderer (numeric data)"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use"),theme:s.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the size ramp")}),Li=p(xi,{name:"size",description:`Label: Counts and Amounts (size)
|
|
159
157
|
Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
|
|
160
158
|
Keywords: graduated size, proportional size, how much, total, number, amount, size
|
|
161
159
|
Example: Vary the size of each point based on the total population.
|
|
@@ -165,25 +163,25 @@ Fields: This typically requires zero or one field of type number.`,schema:ei});f
|
|
|
165
163
|
Description: Vary symbol sizes along a continuous ramp to represent dates.
|
|
166
164
|
Keywords: graduated size, proportional size, classed size, how much, total, number, when
|
|
167
165
|
Example: Vary the size of each feature based on the date a ticket was completed.
|
|
168
|
-
Fields: This style requires a single field with a date type.`,schema:Ei});function Ii(e){let{fields:r,layer:t,view:a,colorSchemeTags:o}=e;console.log("processTypeRendererParams",e);let i=r[0],
|
|
166
|
+
Fields: This style requires a single field with a date type.`,schema:Ei});function Ii(e){let{fields:r,layer:t,view:a,colorSchemeTags:o}=e;console.log("processTypeRendererParams",e);let i=r[0],n=r[1],l=r[2],d;return o&&(d=St({geometryType:t.geometryType,includedTags:o})[0]),{layer:t,view:a,field:i,field2:n,field3:l,outlineOptimizationEnabled:!0,sizeOptimizationEnabled:!0,typeScheme:d}}async function $i(e){return await vt(e)}async function Fi({arcgisMap:e,arcgisMapView:r,layerId:t,fields:a,colorSchemes:o,theme:i}){let n=r,l=e?.allLayers.find(c=>c.id===t);if(!l)return`Could not find layer for id: ${t}`;let d={styleName:"type",fields:a,layer:l,view:n,colorSchemeTags:o,theme:i};try{let c=Ii(d),u=await $i(c);return l.renderer=u.renderer,l.visible=!0,`Type renderer applied to layer: ${l.title??l.id} using fields ${a.join(", ")}`}catch(c){return`Error applying type renderer: ${c instanceof Error?c.message:String(c)}`}}async function _i({layerId:e,fields:r,colorSchemes:t,theme:a},o){let{mapView:i}=I(o);return await E({id:"show-legend",description:"Show Legend",payload:{layerIds:[e]}},o),await Fi({arcgisMap:i.map,arcgisMapView:i,layerId:e,fields:r,colorSchemes:t,theme:a})}var Ni=s.object({layerId:s.string().describe("The id of the layer to apply the type renderer to"),fields:s.array(s.string()).describe("The field(s) to use for the type renderer (categorical data)"),colorSchemes:s.array(s.string()).optional().describe("Optional color scheme tags to use"),theme:s.enum(["above-and-below","above","below","centered-on","extremes","high-to-low"]).optional().describe("Optional theme for the color scheme")}),Ri=p(_i,{name:"type",description:`Label: Types (unique symbols)
|
|
169
167
|
Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
|
|
170
168
|
Keywords: categorical, category, type, unique, discrete, point of interest, region, group
|
|
171
169
|
Example: Color each feature based on the region it belongs to
|
|
172
|
-
Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,schema:Ni}),We=[Lo,Ro,Co,Qo,
|
|
170
|
+
Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,schema:Ni}),We=[Lo,Ro,Co,Qo,Uo,ti,si,hi,bi,Li,Ri],Ai=async(e,r)=>{await m({text:"Requesting LLM for layer query results"},r);let t=await q("navigation_intent_prompt");if(!r?.configurable)throw new Error("config.configurable is required for layer query tools");let a={layerFieldInfo:e.layerFieldInfo},o=await C({promptText:t,messages:v(e.messages),inputVariables:a,tools:We});return await B(o,r),{...e,messages:[...e.messages,o]}};async function qi(e,r){let t=await new L(We).invoke({messages:v(e.messages)},r),a=t.messages.map(i=>i.text).join(`
|
|
173
171
|
`);await m({text:`Finished executing layer filter tool: ${a}`},r);let o=t.messages.map(i=>i.text).join(`
|
|
174
|
-
`);return{...e,outputMessage:o}}var
|
|
172
|
+
`);return{...e,outputMessage:o}}var Ke=y.Root({messages:y({reducer:$,default:()=>[]}),outputMessage:y({reducer:(e="",r)=>{let t=typeof r=="string"?r.trim():"";if(!t)return e;let a=e.trim();if(!a)return t;if(a===t)return e;let o=a.split(`
|
|
175
173
|
|
|
176
174
|
`);return o[o.length-1]?.trim()===t?e:`${e}
|
|
177
175
|
|
|
178
|
-
${t}`},default:()=>""}),vectorSearchLayerIds:
|
|
176
|
+
${t}`},default:()=>""}),vectorSearchLayerIds:y(),vectorSearchFieldResults:y(),layerFieldInfo:y(),selectedLayerId:y()}),zi=async(e,r)=>(await m({text:"Exiting Layer Styling agent"},r),e),Mi=async(e,r)=>{try{await m({text:"Populating layer and field info"},r);let t=[];for(let a of e.vectorSearchFieldResults){let o=function(u){let h=l.get(u)?.layerItem;return h?[h.name&&`Name: ${h.name}`,h.title&&`Title: ${h.title}`,h.description&&`Description: ${h.description}`].filter(Boolean).join(" | "):u},{layerId:i,results:n}=a,l=b(r,"layersAndFieldsRegistry"),d=l.get(i)?.fieldRegistry;if(!d)continue;let c=t.find(u=>u.layerId===i);c||(c={layerId:i,layerSummary:o(i),fieldInfos:[]},t.push(c));for(let u of n){let h=d.get(u.name);h&&c.fieldInfos.push(h)}}return console.log("Populated layerFieldInfo:",t),await m({text:"Populated layerFieldInfo"},r),{...e,layerFieldInfo:t}}catch(t){throw await m({text:"Error populating layerFieldInfo"},r),new Error(`Error populating layerFieldInfo: ${t instanceof Error?t.message:String(t)}`)}},ki=(e,r)=>{let t=e.vectorSearchLayerIds??[];if(t.length<=1)return{...e,selectedLayerId:e.vectorSearchLayerIds[0]};let{hitlResponse:a}=r.configurable;if(console.log("hitlResponse:",a),!a||a.agentId!==_e.id||a.id!=="reviewLayerSelection"){let i={agentId:_e.id,id:"reviewLayerSelection",kind:"singleSelection",message:"Choose a layer to apply the styles.",metadata:[...t]};throw new ge(i)}let o=null;return Array.isArray(a.payload)&&a.payload.length>0&&(o=a.payload[0]),{...e,selectedLayerId:o??e.vectorSearchLayerIds[0]}},Ci=(e,r)=>D(["layerSearch","fieldSearch","layersAndFieldsRegistry"],"Layer Styling Agent")(e,r),ji=()=>new A(Ke).addNode("requireLayerStylingServices",Ci).addNode("vectorSearchLayers",wo).addNode("layerSelectionHITL",ki).addNode("vectorSearchFields",yo).addNode("populateLayerFieldInfo",Mi).addNode("agent",Ai).addNode("tools",qi).addNode("earlyExit",zi).addEdge(R,"requireLayerStylingServices").addEdge("requireLayerStylingServices","vectorSearchLayers").addConditionalEdges("layerSelectionHITL",e=>e.vectorSearchLayerIds.length?"vectorSearchFields":"earlyExit").addConditionalEdges("vectorSearchFields",e=>e.vectorSearchFieldResults.length?"populateLayerFieldInfo":"earlyExit").addEdge("populateLayerFieldInfo","agent").addEdge("agent","tools").addEdge("tools",x).addEdge("earlyExit",x),Vi=String.raw`- **layerStyling** — User wants to change how features are drawn or styled on the map based on their data, such as applying color, size, transparency, symbols, or charts according to field values.
|
|
179
177
|
_Example: “Color points by sales amount”_
|
|
180
178
|
_Example: “Show population density with a color gradient”_
|
|
181
179
|
_Example: “Create a relationship map between height and depth”_
|
|
182
|
-
_Example: “Vary circle sizes according to population”_`,_e={id:"layerStyling",name:"Layer Styling Agent",description:Vi,createGraph:ji,workspace:
|
|
180
|
+
_Example: “Vary circle sizes according to population”_`,_e={id:"layerStyling",name:"Layer Styling Agent",description:Vi,createGraph:ji,workspace:Ke},Cs=y.Root({messages:y({reducer:$,default:()=>[]}),outputMessage:y({reducer:(e="",r)=>{let t=typeof r=="string"?r.trim():"";if(!t)return e;let a=e.trim();if(!a)return t;if(a===t)return e;let o=a.split(`
|
|
183
181
|
|
|
184
182
|
`);return o[o.length-1]?.trim()===t?e:`${e}
|
|
185
183
|
|
|
186
|
-
${t}`},default:()=>""})});var
|
|
184
|
+
${t}`},default:()=>""})});var js=String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
|
|
187
185
|
|
|
188
186
|
_Example: “Tell me about this map”_
|
|
189
187
|
_Example: “List all layers in this map”_
|
|
@@ -196,11 +194,11 @@ ${t}`},default:()=>""})});var qs=String.raw`- **help** — Enables users to ask
|
|
|
196
194
|
|
|
197
195
|
IF the user asks map related queries, but those that are not performed by any of the agents, call this agent so we can respond accordingly.
|
|
198
196
|
_Example: "Create a chart"_
|
|
199
|
-
_Example: "Create a table"_`;var
|
|
197
|
+
_Example: "Create a table"_`;var Vs=y.Root({messages:y({reducer:$,default:()=>[]}),outputMessage:y({reducer:(e="",r)=>{let t=typeof r=="string"?r.trim():"";if(!t)return e;let a=e.trim();if(!a)return t;if(a===t)return e;let o=a.split(`
|
|
200
198
|
|
|
201
199
|
`);return o[o.length-1]?.trim()===t?e:`${e}
|
|
202
200
|
|
|
203
|
-
${t}`},default:()=>""}),intent:
|
|
201
|
+
${t}`},default:()=>""}),intent:y({reducer:(e,r)=>r})});async function Oi(e,r){return await r.map.applyLayout(e),`Successfully applied layout: ${e}.`}var Di=["arcgisKnowledgeView"],Bi=["knowledgeGraph"];function He(e){let r=e?.configurable?.context;if(!r||typeof r!="object")throw new Error("ArcgisKnowledgeAgent context missing");let t=Di.filter(a=>!(a in r));if(t.length)throw new Error(`Link Chart context missing: ${t.join(", ")}`);return r}function Qi(e){let r=e?.configurable?.context;if(!r||typeof r!="object")throw new Error("ArcgisKnowledgeAgent context missing");let t=Bi.filter(a=>!(a in r));if(t.length)throw new Error(`Knowledge Graph context missing: ${t.join(", ")}`);return r}async function Gi({layout:e},r){let{arcgisKnowledgeView:t}=He(r);return await Oi(e,t)}var Pi=s.object({layout:s.enum(["organic-standard","organic-community","basic-grid","hierarchical-bottom-to-top","radial-root-centric","tree-left-to-right","geographic-organic-standard","chronological-mono-timeline","chronological-multi-timeline"]).describe("The layout mode to apply to the link chart. The value must be one of the following: organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline, chronological-multi-timeline")}),Os=p(Gi,{name:"applyLayout",description:"Apply a diagram layout to the link chart",schema:Pi});function Wi(e,r){return r.map.changeNonspatialDataDisplay(e),`Successfully applied nonspatial visibility setting: ${e}.`}function Ki({setting:e},r){let{arcgisKnowledgeView:t}=He(r);return Wi(e,t)}var Hi=s.object({setting:s.enum(["hidden","visible"]).describe("The setting of nonspatial visibility")}),Ds=p(Ki,{name:"changeNonspatialVisibility",description:"Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",schema:Hi});async function Ui(e,r){return console.log("generateCypher called with prompt:",e),""}async function Ji({prompt:e},r){let{knowledgeGraph:t}=Qi(r);return await Ui(e,t.dataModel)}var Zi=s.object({prompt:s.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")}),Bs=p(Ji,{name:"generateCypher",description:"Generates an Open Cypher query based on the user's prompt which represents an inquiry into the data of the knowledge service and its graph database, attempting to filter based on certain conditions and traverse specified relationships. The generated query should be syntactically correct and optimized for performance.",schema:Zi});var Qs=String.raw`Enables users to interact with a link chart by adding new entities (also called nodes) or relationships (also called edges), removing existing entities or relationships,
|
|
204
202
|
expanding the graph from particular entities, finding relationships between specified entities on the link chart and adding them to the link chart, finding all relationships
|
|
205
203
|
that exist out from specified entities and adding those to the link chart, changing whether or not nonspatial data is visible, or changing the layout of the link chart.
|
|
206
204
|
This agent is designed to handle requests that manipulate the specific link chart.
|
|
@@ -208,6 +206,7 @@ This agent is designed to handle requests that manipulate the specific link char
|
|
|
208
206
|
Supported actions:
|
|
209
207
|
- **Change or Apply Layout**: Changes the current layout visualization strategy of the link chart (e.g., "Change the layout to basic-grid", "Apply hierarchical layout"). Valid layout types include organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline. A best effort should be made to transform the user's request into one of these layout types.
|
|
210
208
|
- **Change Nonspatial Data Visibility**: Changes whether or not nonspatial data is visible on the link chart (e.g., "Show nonspatial data", "Hide nonspatial data"). Valid settings are "hidden" and "visible". A best effort should be made to transform the user's request into one of these settings.
|
|
209
|
+
- **Generate a cypher query**: Generates an Open Cypher query based on the user's prompt which represents an inquiry into the data of the knowledge service and its graph database, attempting to filter based on certain conditions and traverse specified relationships. The generated query should be syntactically correct and optimized for performance.
|
|
211
210
|
- **Add Records (entities or relationships)**: NYI
|
|
212
211
|
- **Remove Records (entities or relationships)**: NYI
|
|
213
212
|
- **Expand from Entities**: NYI
|
|
@@ -218,4 +217,7 @@ _example: "Change the layout to hierarchical-bottom-to-top"_
|
|
|
218
217
|
_example: "Apply radial-root-centric layout"_
|
|
219
218
|
_example: "Show nonspatial data"_
|
|
220
219
|
_example: "Hide nonspatial data"_
|
|
221
|
-
_example: "Turn off nonspatial visibility"_
|
|
220
|
+
_example: "Turn off nonspatial visibility"_
|
|
221
|
+
_example: "Generate a cypher query to find all entities connected to 'Entity A' via 'Relationship X' that were created after 2020"_
|
|
222
|
+
_example: "Generate a query to find all employees of Company Esri who joined after 2015 and are located in California"_
|
|
223
|
+
_example: "Tell me how to find all products supplied by Supplier Y that have a price greater than $1000"_`;return{a:qs,b:zs,c:Ms,d:ks,e:_e}},"Graphic","geometry/Point","geometry/Extent","symbols/SimpleMarkerSymbol","rest/locator","layers/support/FeatureEffect","layers/support/FeatureFilter","geometry/operators/unionOperator","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/support/TopFeaturesQuery","rest/support/TopFilter","rest/support/Query","geometry/operators/bufferOperator","smartMapping/renderers/pieChart","smartMapping/symbology/pieChart","views/support/colorUtils","smartMapping/renderers/color","smartMapping/symbology/color","smartMapping/renderers/univariateColorSize","smartMapping/renderers/dotDensity","smartMapping/symbology/dotDensity","smartMapping/renderers/heatmap","smartMapping/symbology/heatmap","smartMapping/renderers/predominance","smartMapping/symbology/predominance","smartMapping/renderers/relationship","smartMapping/symbology/relationship","smartMapping/renderers/size","smartMapping/renderers/type","smartMapping/symbology/type",a)
|