@arcgis/ai-components 5.2.0-next.10 → 5.2.0-next.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +4 -2
- package/README.md +2 -2
- package/dist/agent-utils/FunctionAgent.d.ts +2 -2
- package/dist/agent-utils/LLMAgent.d.ts +7 -4
- package/dist/agent-utils/LLMAgent.js +4 -2
- package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
- package/dist/agent-utils/WorkflowAgent.js +14 -15
- package/dist/agent-utils/index.d.ts +177 -0
- package/dist/agent-utils/index.js +167 -0
- package/dist/agent-utils/middlewares/trace.d.ts +2 -0
- package/dist/agent-utils/middlewares/trace.js +25 -33
- package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
- package/dist/agent-utils/types.d.ts +37 -8
- package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
- package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
- package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
- package/dist/agentic-workflow/Edge.d.ts +16 -0
- package/dist/agentic-workflow/WebAgent.d.ts +39 -0
- package/dist/agentic-workflow/jsonTypes.d.ts +189 -0
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -0
- package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
- package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
- package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
- package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
- package/dist/agentic-workflow/types.d.ts +29 -0
- package/dist/agents/tools/filter/clearFilters/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/clearFilters/adapter.js +22 -0
- package/dist/agents/tools/filter/resetMap/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/resetMap/adapter.js +22 -0
- package/dist/agents/tools/filter/setFeatureEffect/adapter.d.ts +8 -0
- package/dist/agents/tools/filter/setFeatureEffect/adapter.js +121 -0
- package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
- package/dist/agents/tools/help/listFields/adapter.js +30 -0
- package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
- package/dist/agents/tools/navigation/goToAddress/adapter.js +60 -0
- package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToBookmark/adapter.js +30 -0
- package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToFeatures/adapter.js +50 -0
- package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToFullExtent/adapter.js +27 -0
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +24 -0
- package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToLayer/adapter.js +26 -0
- package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToScale/adapter.js +21 -0
- package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToViewpoint/adapter.js +42 -0
- package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
- package/dist/agents/tools/navigation/goToZoom/adapter.js +21 -0
- package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getAttribute/adapter.js +40 -0
- package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getStatistics/adapter.js +157 -0
- package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/query/getTopFeatures/adapter.js +144 -0
- package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
- package/dist/agents/tools/query/queryFeatures/adapter.js +130 -0
- package/dist/agents/tools/search/findRelevantFields/adapter.d.ts +8 -0
- package/dist/agents/tools/search/findRelevantFields/adapter.js +57 -0
- package/dist/agents/tools/search/findRelevantLayers/adapter.d.ts +8 -0
- package/dist/agents/tools/search/findRelevantLayers/adapter.js +38 -0
- package/dist/cdn/22KHSDJI.js +2 -0
- package/dist/cdn/2EY3BQQX.js +2 -0
- package/dist/cdn/{SWOXSJ62.js → 2O4DON37.js} +1 -1
- package/dist/cdn/34O57OGV.js +2 -0
- package/dist/cdn/{5W7S2RS4.js → 3UEKINYC.js} +1 -1
- package/dist/cdn/4OGR5QKS.js +2 -0
- package/dist/cdn/5FL5BTTX.js +66 -0
- package/dist/cdn/5HBAJ57P.js +2 -0
- package/dist/cdn/5K5ZY267.js +2 -0
- package/dist/cdn/5MK44FNO.js +2 -0
- package/dist/cdn/5WYRJMBW.js +2 -0
- package/dist/cdn/5X7EG7D2.js +2 -0
- package/dist/cdn/5XZLS7UO.js +2 -0
- package/dist/cdn/5ZFUGNRN.js +2 -0
- package/dist/cdn/655YIKL3.js +11 -0
- package/dist/cdn/6ECRQVHY.js +2 -0
- package/dist/cdn/6OOZSZRJ.js +2 -0
- package/dist/cdn/{D3TNNRP4.js → 6P44KOKX.js} +1 -1
- package/dist/cdn/6YYPVU7H.js +3 -0
- package/dist/cdn/7BCQMK6D.js +2 -0
- package/dist/cdn/7SRLZQVC.js +5 -0
- package/dist/cdn/7V6OSTFC.js +2 -0
- package/dist/cdn/7VAQUCBU.js +9 -0
- package/dist/cdn/7VUSIGEM.js +2 -0
- package/dist/cdn/ACJTJLZN.js +2 -0
- package/dist/cdn/AI6DYOKR.js +181 -0
- package/dist/cdn/AKD5UOVX.js +2 -0
- package/dist/cdn/ANRQWYU2.js +2 -0
- package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
- package/dist/cdn/APFZY4PI.js +2 -0
- package/dist/cdn/B2JDVLA6.js +2 -0
- package/dist/cdn/BE7BRJZD.js +2 -0
- package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
- package/dist/cdn/C4FEETBZ.js +2 -0
- package/dist/cdn/C4JT4S5E.js +2 -0
- package/dist/cdn/CCC6LBMY.js +2 -0
- package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
- package/dist/cdn/CJMUJXPL.js +2 -0
- package/dist/cdn/COH3QXWG.js +4 -0
- package/dist/cdn/CP5BVGJU.js +2 -0
- package/dist/cdn/D5UFYQHN.js +44 -0
- package/dist/cdn/EWLXNGKH.js +208 -0
- package/dist/cdn/EYOWRGDP.js +2 -0
- package/dist/cdn/F5NIRETW.js +2 -0
- package/dist/cdn/FDOMMK2M.js +2 -0
- package/dist/cdn/FG647IP6.js +2 -0
- package/dist/cdn/FJO4KNOZ.js +2 -0
- package/dist/cdn/FUF3NAU7.js +2 -0
- package/dist/cdn/FXP5UIQU.js +156 -0
- package/dist/cdn/{T537PKP4.js → FYZATVB3.js} +1 -1
- package/dist/cdn/G2EGT3CF.js +6 -0
- package/dist/cdn/G3SF6U2U.js +2 -0
- package/dist/cdn/G7OMHU2B.js +2 -0
- package/dist/cdn/HAEFC2SJ.js +2 -0
- package/dist/cdn/HDACNIZF.js +2 -0
- package/dist/cdn/HHFNQR6Z.js +2 -0
- package/dist/cdn/HHUQXL3R.js +2 -0
- package/dist/cdn/IBZ2NEAO.js +2 -0
- package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
- package/dist/cdn/ICQCK5D3.js +2 -0
- package/dist/cdn/IHP25JWI.js +99 -0
- package/dist/cdn/IJVMUS2L.js +14 -0
- package/dist/cdn/J6A4AS7E.js +22 -0
- package/dist/cdn/J6SZIQJA.js +2 -0
- package/dist/cdn/JCOA24UH.js +3 -0
- package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
- package/dist/cdn/JO5ETMPS.js +2 -0
- package/dist/cdn/K2R6XVK3.js +2 -0
- package/dist/cdn/KITIP6J2.js +2 -0
- package/dist/cdn/KWD2ECTM.js +2 -0
- package/dist/cdn/{MODWHY3R.js → LAYVGCPL.js} +6 -4
- package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
- package/dist/cdn/LLUGJKAQ.js +2 -0
- package/dist/cdn/MWYBF3F3.js +66 -0
- package/dist/cdn/{VMXLYWUK.js → MXTXJKFE.js} +1 -1
- package/dist/cdn/MY47B3CE.js +3 -0
- package/dist/cdn/NEV6OZN3.js +71 -0
- package/dist/cdn/NNXISHCA.js +14 -0
- package/dist/cdn/NZSOJ726.js +2 -0
- package/dist/cdn/O4NVW75A.js +2 -0
- package/dist/cdn/OE3GW5LE.js +2 -0
- package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
- package/dist/cdn/ONQ6JSBJ.js +2 -0
- package/dist/cdn/OX64WOEL.js +22 -0
- package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
- package/dist/cdn/PUHRBGKB.js +2 -0
- package/dist/cdn/Q57QWN5W.js +2 -0
- package/dist/cdn/QUKNPVAF.js +2 -0
- package/dist/cdn/R2PQVY4O.js +2 -0
- package/dist/cdn/R74ZHFA6.js +2 -0
- package/dist/cdn/RBE55SWR.js +2 -0
- package/dist/cdn/RHYNE5OE.js +2 -0
- package/dist/cdn/RLEHNAIA.js +2 -0
- package/dist/cdn/RVSTAUQS.js +2 -0
- package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
- package/dist/cdn/{GTLS44GI.js → SXM4NUT5.js} +1 -1
- package/dist/cdn/SZ2QSSB3.js +2 -0
- package/dist/cdn/T4RIGOXB.js +2 -0
- package/dist/cdn/TCH5I5LS.js +2 -0
- package/dist/cdn/TEPP7YPR.js +2 -0
- package/dist/cdn/TMVF2W5N.js +36 -0
- package/dist/cdn/TPULIO6I.js +34 -0
- package/dist/cdn/UDRKUVZP.js +2 -0
- package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
- package/dist/cdn/UHNVDALX.js +18 -0
- package/dist/cdn/UZLQALHY.js +2 -0
- package/dist/cdn/V6HOUZPZ.js +2 -0
- package/dist/cdn/VAXH6RUQ.js +134 -0
- package/dist/cdn/VLLZ2FFU.js +2 -0
- package/dist/cdn/VOKXKU7M.js +56 -0
- package/dist/cdn/VXFQANGJ.js +2 -0
- package/dist/cdn/WGO5SER7.js +6 -0
- package/dist/cdn/WJXXOKGA.js +9 -0
- package/dist/cdn/WKTQVBFJ.js +2 -0
- package/dist/cdn/{2SJAOYZT.js → WSWB3B7B.js} +1 -1
- package/dist/cdn/XX6GHMNR.js +2 -0
- package/dist/cdn/Y7XD7ZRD.js +2 -0
- package/dist/cdn/YEZ3AMNX.js +2 -0
- package/dist/cdn/YLVJA4ZE.js +2 -0
- package/dist/cdn/Z5HWPSZN.js +2 -0
- package/dist/cdn/Z5W4V7RC.js +2 -0
- package/dist/cdn/ZDV4K4WG.js +2 -0
- package/dist/cdn/ZOEMBHRF.js +2 -0
- package/dist/cdn/ZRVZMPFN.js +2 -0
- package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
- package/dist/cdn/agent-utils/index.js +2 -0
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
- package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
- package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
- package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/assistant-message/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/assistant-message-loading/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +1295 -2104
- package/dist/chunks/arcgisKnowledgeGraph.js +128 -72
- package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
- package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
- package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
- package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
- package/dist/chunks/baseAgentState.js +58 -0
- package/dist/chunks/converterUtils.js +66 -41
- package/dist/chunks/dataExplorationGraph.js +131 -182
- package/dist/chunks/data_explore_query_prompt.js +9 -4
- package/dist/chunks/fetchAgentContext.js +13 -0
- package/dist/chunks/fetchService.js +10 -0
- package/dist/chunks/fieldStatistics.js +79 -0
- package/dist/chunks/formatFeatureAttributes.js +132 -0
- package/dist/chunks/generateLayerDescriptions.js +259 -282
- package/dist/chunks/helpGraph.js +35 -25
- package/dist/chunks/help_prompt.js +34 -17
- package/dist/chunks/index.js +11 -0
- package/dist/chunks/intent_prompt.js +16 -0
- package/dist/chunks/layerStylingGraph.js +39 -33
- package/dist/chunks/mergeWhereClauses.js +15 -0
- package/dist/chunks/navigationGraph.js +140 -116
- package/dist/chunks/navigation_intent_prompt.js +8 -2
- package/dist/chunks/orchestrator.js +444 -233
- package/dist/chunks/resolvePointGeometryFilter.js +92 -0
- package/dist/chunks/state.js +21 -27
- package/dist/chunks/toolCallResponse.js +14 -10
- package/dist/chunks/utils2.js +11 -11
- package/dist/components/arcgis-assistant/customElement.d.ts +82 -1
- package/dist/components/arcgis-assistant/customElement.js +332 -183
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +614 -10
- package/dist/components/arcgis-assistant-chat/customElement.js +22 -17
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +20 -4
- package/dist/components/arcgis-assistant-help-agent/customElement.js +29 -7
- package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -0
- package/dist/components/arcgis-assistant-interrupt/customElement.js +11 -12
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +12 -8
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +40 -16
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +30 -7
- package/dist/components/arcgis-assistant-message/customElement.d.ts +3 -0
- package/dist/components/arcgis-assistant-message/customElement.js +9 -8
- package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +3 -0
- package/dist/components/arcgis-assistant-message-loading/customElement.js +11 -10
- package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
- package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +18 -4
- package/dist/components/arcgis-assistant-speech-input/customElement.js +34 -52
- package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
- package/dist/components/arcgis-assistant-user-message/customElement.js +15 -10
- 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/loader.js +6 -6
- package/dist/oauth-callback.html +1 -1
- package/dist/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
- package/dist/types/lumina.d.ts +5 -4
- package/dist/types/preact.d.ts +5 -4
- package/dist/types/react.d.ts +5 -4
- package/dist/types/stencil.d.ts +7 -6
- package/dist/utils/index.d.ts +65 -38
- package/dist/utils/index.js +56 -55
- package/package.json +32 -12
- package/dist/cdn/462JBSEV.js +0 -422
- package/dist/cdn/5QAHYX7Y.js +0 -5
- package/dist/cdn/64PJB5NU.js +0 -2
- package/dist/cdn/6AWNQHCO.js +0 -4
- package/dist/cdn/AXDZBBNL.js +0 -45
- package/dist/cdn/BIV2IPHH.js +0 -2
- package/dist/cdn/CCY4TSBO.js +0 -2
- package/dist/cdn/CTSALWEP.js +0 -2
- package/dist/cdn/D2N2NSRQ.js +0 -72
- package/dist/cdn/DOV5ZJ7M.js +0 -2
- package/dist/cdn/EEUCKMU7.js +0 -2
- package/dist/cdn/EGHBXLNG.js +0 -2
- package/dist/cdn/ETRWZ3MS.js +0 -108
- package/dist/cdn/EWI4V3GQ.js +0 -36
- package/dist/cdn/F2AHA4GB.js +0 -54
- package/dist/cdn/I6HNBTWY.js +0 -2
- package/dist/cdn/JBHNHHWO.js +0 -3
- package/dist/cdn/JOFUPKIB.js +0 -2
- package/dist/cdn/KMQ3SP4I.js +0 -5
- package/dist/cdn/KUEOKIQR.js +0 -2
- package/dist/cdn/LKRAPK4A.js +0 -165
- package/dist/cdn/NXKKG5TK.js +0 -2
- package/dist/cdn/OBUZ7HBN.js +0 -2
- package/dist/cdn/OIVRK7HT.js +0 -2
- package/dist/cdn/RUURNLTP.js +0 -2
- package/dist/cdn/RVOAPUBN.js +0 -2
- package/dist/cdn/TSZPHE7L.js +0 -22
- package/dist/cdn/VAZNJSKA.js +0 -16
- package/dist/cdn/VNQN5ZQO.js +0 -14
- package/dist/cdn/WIDTPVSU.js +0 -2
- package/dist/cdn/XER22VYQ.js +0 -3
- package/dist/cdn/YIMNOUTF.js +0 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import
|
|
2
|
+
import w from "@esri/arcgis-html-sanitizer";
|
|
3
3
|
import { marked as S } from "marked";
|
|
4
4
|
S.use({
|
|
5
5
|
gfm: !0,
|
|
6
6
|
breaks: !0,
|
|
7
7
|
async: !1
|
|
8
8
|
});
|
|
9
|
-
const C = new
|
|
9
|
+
const C = new w(
|
|
10
10
|
{
|
|
11
11
|
whiteList: {
|
|
12
12
|
// LLMs sometimes return lists like "- 2) Foo". `marked` parses that into a nested ordered list
|
|
@@ -17,6 +17,7 @@ const C = new g(
|
|
|
17
17
|
"calcite-table-row": ["slot", "class"],
|
|
18
18
|
"calcite-table-header": ["heading", "alignment", "description", "class"],
|
|
19
19
|
"calcite-table-cell": ["alignment", "colspan", "rowspan", "class"],
|
|
20
|
+
"calcite-link": ["href", "target", "rel", "title"],
|
|
20
21
|
// Allow markdown code blocks to render as <pre><code>…</code></pre>.
|
|
21
22
|
pre: ["class"],
|
|
22
23
|
code: ["class"]
|
|
@@ -27,44 +28,67 @@ const C = new g(
|
|
|
27
28
|
function T(e) {
|
|
28
29
|
return C.sanitize(e);
|
|
29
30
|
}
|
|
31
|
+
function k(e) {
|
|
32
|
+
if (!e || typeof DOMParser > "u")
|
|
33
|
+
return e;
|
|
34
|
+
try {
|
|
35
|
+
const t = new DOMParser().parseFromString(e, "text/html");
|
|
36
|
+
return t.querySelectorAll("a").forEach((r) => {
|
|
37
|
+
const n = t.createElement("calcite-link");
|
|
38
|
+
for (const l of ["href", "target", "rel", "title"]) {
|
|
39
|
+
const a = r.getAttribute(l);
|
|
40
|
+
a !== null && n.setAttribute(l, a);
|
|
41
|
+
}
|
|
42
|
+
n.append(...r.childNodes), r.replaceWith(n);
|
|
43
|
+
}), t.body.innerHTML;
|
|
44
|
+
} catch {
|
|
45
|
+
return e;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
30
48
|
function A(e, t) {
|
|
31
|
-
const r = e.indexOf("{", t),
|
|
32
|
-
return r === -1 ?
|
|
49
|
+
const r = e.indexOf("{", t), n = e.indexOf("[", t);
|
|
50
|
+
return r === -1 ? n : n === -1 ? r : Math.min(r, n);
|
|
33
51
|
}
|
|
34
52
|
function x(e) {
|
|
35
53
|
if (e.trimStart().startsWith("```"))
|
|
36
54
|
return null;
|
|
37
55
|
for (let r = A(e, 0); r !== -1; r = A(e, r + 1)) {
|
|
38
|
-
let
|
|
39
|
-
for (let
|
|
40
|
-
const
|
|
41
|
-
if (
|
|
56
|
+
let n = 0, l = 0;
|
|
57
|
+
for (let a = r; a < e.length; a++) {
|
|
58
|
+
const c = e[a];
|
|
59
|
+
if (c === "{" ? n++ : c === "}" ? n-- : c === "[" ? l++ : c === "]" && l--, n < 0 || l < 0)
|
|
42
60
|
break;
|
|
43
|
-
if (
|
|
44
|
-
return e.slice(r,
|
|
61
|
+
if (n === 0 && l === 0 && a > r)
|
|
62
|
+
return e.slice(r, a + 1);
|
|
45
63
|
}
|
|
46
64
|
}
|
|
47
65
|
return null;
|
|
48
66
|
}
|
|
49
|
-
function
|
|
67
|
+
function z(e) {
|
|
50
68
|
if (!e)
|
|
51
69
|
return "";
|
|
52
70
|
let t = e;
|
|
53
71
|
const r = x(e);
|
|
54
72
|
if (r)
|
|
55
73
|
try {
|
|
56
|
-
const l = JSON.parse(r),
|
|
74
|
+
const l = JSON.parse(r), c = `
|
|
57
75
|
|
|
58
76
|
\`\`\`json
|
|
59
77
|
${JSON.stringify(l, null, 2)}
|
|
60
78
|
\`\`\`
|
|
61
79
|
|
|
62
80
|
`;
|
|
63
|
-
t = e.replace(r,
|
|
81
|
+
t = e.replace(r, c);
|
|
64
82
|
} catch {
|
|
65
83
|
}
|
|
66
|
-
const
|
|
67
|
-
return
|
|
84
|
+
const n = q(t);
|
|
85
|
+
return M(n);
|
|
86
|
+
}
|
|
87
|
+
function M(e) {
|
|
88
|
+
if (!e)
|
|
89
|
+
return "";
|
|
90
|
+
const t = E(e), r = k(t);
|
|
91
|
+
return T(r);
|
|
68
92
|
}
|
|
69
93
|
function q(e) {
|
|
70
94
|
return e ? S.parse(e, { async: !1 }) : "";
|
|
@@ -74,44 +98,45 @@ function E(e) {
|
|
|
74
98
|
return e;
|
|
75
99
|
try {
|
|
76
100
|
const t = new DOMParser().parseFromString(e, "text/html");
|
|
77
|
-
return Array.from(t.querySelectorAll("table")).forEach((
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
if (
|
|
82
|
-
const
|
|
83
|
-
for (const
|
|
101
|
+
return Array.from(t.querySelectorAll("table")).forEach((n, l) => {
|
|
102
|
+
const a = t.createElement("calcite-table");
|
|
103
|
+
a.setAttribute("caption", `Table ${l + 1}`), a.setAttribute("striped", "true");
|
|
104
|
+
const c = n.querySelector("thead");
|
|
105
|
+
if (c) {
|
|
106
|
+
const f = Array.from(c.querySelectorAll("tr"));
|
|
107
|
+
for (const u of f) {
|
|
84
108
|
const o = t.createElement("calcite-table-row");
|
|
85
109
|
o.setAttribute("slot", "table-header");
|
|
86
|
-
const
|
|
87
|
-
for (const
|
|
88
|
-
const
|
|
89
|
-
|
|
110
|
+
const d = Array.from(u.querySelectorAll("th, td"));
|
|
111
|
+
for (const h of d) {
|
|
112
|
+
const i = (h.textContent ?? "").trim(), s = t.createElement("calcite-table-header");
|
|
113
|
+
s.setAttribute("heading", i), o.appendChild(s);
|
|
90
114
|
}
|
|
91
|
-
|
|
115
|
+
a.appendChild(o);
|
|
92
116
|
}
|
|
93
117
|
}
|
|
94
|
-
const
|
|
95
|
-
(
|
|
96
|
-
const o = t.createElement("calcite-table-row"),
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
for (const
|
|
100
|
-
if (
|
|
101
|
-
const
|
|
102
|
-
y.setAttribute("heading",
|
|
118
|
+
const b = n.querySelector("tbody");
|
|
119
|
+
(b ? Array.from(b.querySelectorAll("tr")) : Array.from(n.querySelectorAll("tr")).filter((f) => !c?.contains(f))).forEach((f, u) => {
|
|
120
|
+
const o = t.createElement("calcite-table-row"), d = !c && u === 0 && f.querySelectorAll("th").length > 0;
|
|
121
|
+
d && o.setAttribute("slot", "table-header");
|
|
122
|
+
const h = Array.from(f.querySelectorAll("th, td"));
|
|
123
|
+
for (const i of h) {
|
|
124
|
+
if (d && i.localName === "th") {
|
|
125
|
+
const g = (i.textContent ?? "").trim(), y = t.createElement("calcite-table-header");
|
|
126
|
+
y.setAttribute("heading", g), o.appendChild(y);
|
|
103
127
|
return;
|
|
104
128
|
}
|
|
105
|
-
const
|
|
106
|
-
p &&
|
|
129
|
+
const s = t.createElement("calcite-table-cell"), p = i.getAttribute("colspan"), m = i.getAttribute("rowspan");
|
|
130
|
+
p && s.setAttribute("colspan", p), m && s.setAttribute("rowspan", m), s.innerHTML = i.innerHTML, o.appendChild(s);
|
|
107
131
|
}
|
|
108
|
-
|
|
109
|
-
}),
|
|
132
|
+
a.appendChild(o);
|
|
133
|
+
}), n.replaceWith(a);
|
|
110
134
|
}), t.body.innerHTML;
|
|
111
135
|
} catch {
|
|
112
136
|
return e;
|
|
113
137
|
}
|
|
114
138
|
}
|
|
115
139
|
export {
|
|
116
|
-
|
|
140
|
+
M as a,
|
|
141
|
+
z as p
|
|
117
142
|
};
|
|
@@ -1,53 +1,60 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { StateGraph as
|
|
3
|
-
import { g as
|
|
2
|
+
import { StateGraph as R, START as F, END as y } from "@langchain/langgraph/web";
|
|
3
|
+
import { g as x, j as w, t as v, k as C, r as N, D as T, l as b } from "./adapter.js";
|
|
4
4
|
import "@arcgis/core/identity/IdentityManager.js";
|
|
5
5
|
import "@arcgis/core/portal/Portal.js";
|
|
6
|
-
import
|
|
7
|
-
import
|
|
6
|
+
import "@arcgis/core/request.js";
|
|
7
|
+
import "@arcgis/toolkit/string";
|
|
8
|
+
import { h as M, e as A } from "./generateLayerDescriptions.js";
|
|
9
|
+
import { AIMessage as _ } from "@langchain/core/messages";
|
|
10
|
+
import { s } from "./index.js";
|
|
11
|
+
import "@langchain/core/callbacks/base";
|
|
8
12
|
import "@langchain/openai";
|
|
13
|
+
import "@arcgis/core/config.js";
|
|
9
14
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
10
15
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
11
|
-
import "@arcgis/core/request.js";
|
|
12
16
|
import "@langchain/core/prompts";
|
|
13
|
-
import { h as
|
|
14
|
-
import {
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
import { h as L } from "./toolCallResponse.js";
|
|
18
|
+
import { b as q } from "./formatFeatureAttributes.js";
|
|
19
|
+
import { ToolNode as k } from "@langchain/langgraph/prebuilt";
|
|
20
|
+
import { b as $ } from "./fieldStatistics.js";
|
|
21
|
+
import { f as D } from "./fetchAgentContext.js";
|
|
22
|
+
import { f as m } from "./fetchService.js";
|
|
23
|
+
const I = async (t, e) => (await s({ text: "Exiting Data Exploration agent" }, e), t), z = async (t, e) => {
|
|
24
|
+
await s({ text: "Requesting LLM for layer filter results" }, e);
|
|
25
|
+
const l = await x("data_explore_filter_prompt");
|
|
20
26
|
if (!e?.configurable)
|
|
21
27
|
throw new Error("config.configurable is required for layer filter tools");
|
|
22
|
-
const { userTimezone:
|
|
28
|
+
const { userTimezone: d, userTimezoneOffset: r } = q(), o = {
|
|
23
29
|
layerFieldInfo: t.layerFieldInfo,
|
|
24
|
-
userTimezone:
|
|
25
|
-
userTimezoneOffset:
|
|
30
|
+
userTimezone: d,
|
|
31
|
+
userTimezoneOffset: r,
|
|
26
32
|
queryResponse: t.queryResponse,
|
|
27
33
|
assignedTask: t.agentExecutionContext.assignedTask,
|
|
28
34
|
userRequest: t.agentExecutionContext.userRequest,
|
|
29
35
|
priorSteps: t.agentExecutionContext.priorSteps
|
|
30
|
-
},
|
|
31
|
-
promptText:
|
|
32
|
-
modelTier: "
|
|
36
|
+
}, i = await M({
|
|
37
|
+
promptText: l,
|
|
38
|
+
modelTier: "default",
|
|
39
|
+
config: e,
|
|
33
40
|
messages: t.dataExplorationMessages,
|
|
34
41
|
inputVariables: o,
|
|
35
|
-
tools:
|
|
36
|
-
}),
|
|
37
|
-
if (!((
|
|
38
|
-
return await
|
|
42
|
+
tools: w
|
|
43
|
+
}), n = [...t.dataExplorationMessages, i];
|
|
44
|
+
if (!((i.tool_calls?.length ?? 0) > 0))
|
|
45
|
+
return await s({ text: "LLM determined no filter changes needed" }, e), {
|
|
39
46
|
...t,
|
|
40
|
-
dataExplorationMessages:
|
|
47
|
+
dataExplorationMessages: n
|
|
41
48
|
// Don't overwrite outputMessage if query already set it
|
|
42
49
|
};
|
|
43
|
-
const
|
|
44
|
-
return await
|
|
45
|
-
},
|
|
46
|
-
await
|
|
47
|
-
const
|
|
50
|
+
const u = n, p = i.content.toString();
|
|
51
|
+
return await L(i, e), { ...t, dataExplorationMessages: u, outputMessage: p };
|
|
52
|
+
}, Q = async (t, e) => {
|
|
53
|
+
await s({ text: "Requesting LLM for layer query results" }, e);
|
|
54
|
+
const l = await x("data_explore_query_prompt");
|
|
48
55
|
if (!e?.configurable)
|
|
49
56
|
throw new Error("config.configurable is required for layer query tools");
|
|
50
|
-
const { userTimezone:
|
|
57
|
+
const { userTimezone: d, userTimezoneOffset: r } = q(), o = t.agentExecutionContext.sharedState, i = o.lastNavigatedFeatures?.value, n = o.lastResolvedLocation?.value;
|
|
51
58
|
let c = "none";
|
|
52
59
|
if (i != null)
|
|
53
60
|
try {
|
|
@@ -55,228 +62,168 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
|
|
|
55
62
|
} catch {
|
|
56
63
|
c = "none";
|
|
57
64
|
}
|
|
58
|
-
|
|
65
|
+
let u = "none";
|
|
66
|
+
if (n != null)
|
|
67
|
+
try {
|
|
68
|
+
u = JSON.stringify({
|
|
69
|
+
address: n.address,
|
|
70
|
+
location: n.location
|
|
71
|
+
});
|
|
72
|
+
} catch {
|
|
73
|
+
u = "none";
|
|
74
|
+
}
|
|
75
|
+
const p = {
|
|
59
76
|
layerFieldInfo: t.layerFieldInfo,
|
|
60
|
-
userTimezone:
|
|
61
|
-
userTimezoneOffset:
|
|
77
|
+
userTimezone: d,
|
|
78
|
+
userTimezoneOffset: r,
|
|
62
79
|
assignedTask: t.agentExecutionContext.assignedTask,
|
|
63
80
|
userRequest: t.agentExecutionContext.userRequest,
|
|
64
81
|
priorSteps: t.agentExecutionContext.priorSteps,
|
|
65
|
-
lastNavigatedFeatures: c
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
82
|
+
lastNavigatedFeatures: c,
|
|
83
|
+
lastResolvedLocation: u
|
|
84
|
+
}, g = await M({
|
|
85
|
+
promptText: l,
|
|
86
|
+
modelTier: "default",
|
|
87
|
+
config: e,
|
|
69
88
|
messages: t.dataExplorationMessages,
|
|
70
|
-
inputVariables:
|
|
71
|
-
tools:
|
|
72
|
-
}), f = (
|
|
73
|
-
return await
|
|
89
|
+
inputVariables: p,
|
|
90
|
+
tools: C
|
|
91
|
+
}), f = (g.tool_calls?.length ?? 0) > 0, h = g.content.toString();
|
|
92
|
+
return await L(g, e), {
|
|
74
93
|
...t,
|
|
75
|
-
dataExplorationMessages: [...t.dataExplorationMessages,
|
|
94
|
+
dataExplorationMessages: [...t.dataExplorationMessages, g],
|
|
76
95
|
// Only emit output here when no tools are being called.
|
|
77
96
|
// For tool-calling flows, downstream summarizer nodes provide the final user-facing message.
|
|
78
|
-
...f ? {} : { outputMessage:
|
|
97
|
+
...f ? {} : { outputMessage: h },
|
|
79
98
|
status: "success",
|
|
80
|
-
summary:
|
|
99
|
+
summary: h && !f ? v(h) : "Query planning completed."
|
|
81
100
|
};
|
|
82
|
-
},
|
|
101
|
+
}, V = async (t, e) => {
|
|
83
102
|
try {
|
|
84
|
-
await
|
|
85
|
-
const
|
|
103
|
+
await s({ text: "Requesting LLM for summary on query results" }, e);
|
|
104
|
+
const l = await x("summarize_query_response_prompt"), d = {
|
|
86
105
|
queryResponse: t.queryResponse,
|
|
87
106
|
assignedTask: t.agentExecutionContext.assignedTask,
|
|
88
107
|
userRequest: t.agentExecutionContext.userRequest,
|
|
89
108
|
priorSteps: t.agentExecutionContext.priorSteps
|
|
90
|
-
},
|
|
91
|
-
promptText:
|
|
109
|
+
}, r = await A({
|
|
110
|
+
promptText: l,
|
|
92
111
|
modelTier: "fast",
|
|
112
|
+
config: e,
|
|
93
113
|
messages: t.dataExplorationMessages,
|
|
94
|
-
inputVariables:
|
|
95
|
-
}), o = typeof
|
|
96
|
-
await
|
|
97
|
-
const
|
|
114
|
+
inputVariables: d
|
|
115
|
+
}), o = typeof r == "string" ? r : r.content, i = new _(o);
|
|
116
|
+
await s({ text: `Received response from LLM: ${o}` }, e);
|
|
117
|
+
const n = o;
|
|
98
118
|
return {
|
|
99
119
|
...t,
|
|
100
|
-
outputMessage:
|
|
120
|
+
outputMessage: n,
|
|
101
121
|
status: "success",
|
|
102
|
-
summary:
|
|
103
|
-
dataExplorationMessages: [...t.dataExplorationMessages,
|
|
122
|
+
summary: n ? v(n) : "Summary generated.",
|
|
123
|
+
dataExplorationMessages: [...t.dataExplorationMessages, i]
|
|
104
124
|
};
|
|
105
125
|
} catch (a) {
|
|
106
|
-
throw await
|
|
126
|
+
throw await s({ text: "Error during filter LLM request" }, e), new Error(`Error during filter LLM request: ${a instanceof Error ? a.message : String(a)}`);
|
|
107
127
|
}
|
|
108
128
|
};
|
|
109
|
-
async function
|
|
110
|
-
if ((t.queryResponse ?? []).some((
|
|
111
|
-
const o =
|
|
129
|
+
async function O(t, e) {
|
|
130
|
+
if ((t.queryResponse ?? []).some((r) => {
|
|
131
|
+
const o = r.details;
|
|
112
132
|
return typeof o == "object" && o !== null && "error" in o;
|
|
113
133
|
}))
|
|
114
|
-
return await
|
|
115
|
-
const
|
|
134
|
+
return await s({ text: "Skipping layer filter tool because query response contains an error." }, e), { ...t };
|
|
135
|
+
const d = await new k(w, { handleToolErrors: !1 }).invoke(
|
|
116
136
|
{
|
|
117
137
|
messages: t.dataExplorationMessages
|
|
118
138
|
},
|
|
119
139
|
e
|
|
120
140
|
);
|
|
121
|
-
return await
|
|
122
|
-
{ text: `Finished executing layer filter tool: ${
|
|
141
|
+
return await s(
|
|
142
|
+
{ text: `Finished executing layer filter tool: ${d.messages.map((r) => r.content).join(", ")}` },
|
|
123
143
|
e
|
|
124
144
|
), { ...t };
|
|
125
145
|
}
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (e.type !== "geometry" && e.type !== "oid" && e.type !== "global-id") {
|
|
130
|
-
a && (l = await G({ layer: t, field: e.name }));
|
|
131
|
-
const o = e.domain?.type === "coded-value" ? e.domain : null;
|
|
132
|
-
d && (Y.includes(e.type) || o) && (s = (await U({ layer: t, field: e.name })).uniqueValueInfos.sort((r, i) => i.count - r.count).slice(0, X), o && (s = s.map((r) => ({
|
|
133
|
-
...r,
|
|
134
|
-
value: o.getName(r.value) ?? r.value
|
|
135
|
-
}))));
|
|
136
|
-
}
|
|
137
|
-
} catch (o) {
|
|
138
|
-
console.error(`Error fetching statistics for field ${e.name}:`, o);
|
|
139
|
-
}
|
|
140
|
-
return {
|
|
141
|
-
summaryStatistics: l,
|
|
142
|
-
uniqueValues: s
|
|
143
|
-
};
|
|
144
|
-
};
|
|
145
|
-
function ee(t, e) {
|
|
146
|
-
return ["string", "small-integer", "integer"].includes(t) || e === "coded-value";
|
|
147
|
-
}
|
|
148
|
-
async function te(t, e, a, d = !0) {
|
|
149
|
-
const l = [], s = [], o = [];
|
|
150
|
-
for (const r of t) {
|
|
151
|
-
let i = function(y) {
|
|
152
|
-
const u = e.get(y)?.layerItem;
|
|
153
|
-
return u ? [
|
|
154
|
-
u.name && `Name: ${u.name}`,
|
|
155
|
-
u.title && `Title: ${u.title}`,
|
|
156
|
-
u.description && `Description: ${u.description}`
|
|
157
|
-
].filter(Boolean).join(" | ") : y;
|
|
158
|
-
};
|
|
159
|
-
const { layerId: c, results: m } = r, p = a.map?.allLayers.find((y) => y.id === c), f = e.get(c)?.fieldRegistry;
|
|
160
|
-
if (!f)
|
|
161
|
-
continue;
|
|
162
|
-
let g = l.find((y) => y.layerId === c);
|
|
163
|
-
g || (g = {
|
|
164
|
-
layerId: c,
|
|
165
|
-
layerSummary: i(c),
|
|
166
|
-
fieldInfos: []
|
|
167
|
-
}, l.push(g));
|
|
168
|
-
for (const y of m) {
|
|
169
|
-
const u = f.get(y.name);
|
|
170
|
-
if (!u)
|
|
171
|
-
continue;
|
|
172
|
-
const x = u.statistics, E = d && !x?.summaryStatistics, w = ee(u.type, u.domain?.type) && !x?.uniqueValues, q = E || w;
|
|
173
|
-
if (o.push({
|
|
174
|
-
layerId: c,
|
|
175
|
-
fieldName: u.name,
|
|
176
|
-
didFetchStatistics: q
|
|
177
|
-
}), q) {
|
|
178
|
-
const A = Z(p, u, {
|
|
179
|
-
includeSummaryStatistics: E,
|
|
180
|
-
includeUniqueValues: w
|
|
181
|
-
}).then((F) => {
|
|
182
|
-
const S = {
|
|
183
|
-
summaryStatistics: x?.summaryStatistics ?? null,
|
|
184
|
-
uniqueValues: x?.uniqueValues ?? null
|
|
185
|
-
};
|
|
186
|
-
E && (S.summaryStatistics = F.summaryStatistics), w && (S.uniqueValues = F.uniqueValues), f.set(u.name, { ...u, statistics: S }), u.statistics = S;
|
|
187
|
-
});
|
|
188
|
-
s.push(A);
|
|
189
|
-
}
|
|
190
|
-
g.fieldInfos.push(u);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
return await Promise.all(s), {
|
|
194
|
-
layerFieldInfo: l,
|
|
195
|
-
didFetchStatistics: s.length > 0,
|
|
196
|
-
fieldStatisticsFetchStatus: o
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
const M = /\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;
|
|
200
|
-
function ae(t, e) {
|
|
201
|
-
return M.test(t) || M.test(e);
|
|
146
|
+
const E = /\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;
|
|
147
|
+
function P(t, e) {
|
|
148
|
+
return E.test(t) || E.test(e);
|
|
202
149
|
}
|
|
203
|
-
const
|
|
150
|
+
const j = async (t, e) => {
|
|
204
151
|
try {
|
|
205
|
-
await
|
|
206
|
-
const a =
|
|
152
|
+
await s({ text: "Preparing field information for vector search results" }, e);
|
|
153
|
+
const a = m(e, "layersAndFieldsRegistry"), { mapView: l } = D(e, ["mapView"]), { assignedTask: d, userRequest: r } = t.agentExecutionContext, o = P(d, r), { layerFieldInfo: i, didFetchStatistics: n, fieldStatisticsFetchStatus: c } = await $(
|
|
207
154
|
t.vectorSearchFieldResults,
|
|
208
155
|
a,
|
|
209
|
-
|
|
156
|
+
l,
|
|
210
157
|
o
|
|
211
158
|
);
|
|
212
|
-
|
|
213
|
-
for (const
|
|
214
|
-
await
|
|
159
|
+
n ? await s({ text: "Statistics fetched" }, e) : await s({ text: "Statistics skipped" }, e);
|
|
160
|
+
for (const u of c)
|
|
161
|
+
await s(
|
|
215
162
|
{
|
|
216
|
-
text: ` - ${
|
|
163
|
+
text: ` - ${u.fieldName} - stats ${u.didFetchStatistics ? "fetched" : "skipped"}`
|
|
217
164
|
},
|
|
218
165
|
e
|
|
219
166
|
);
|
|
220
|
-
return await
|
|
167
|
+
return await s({ text: "Field information prepared" }, e), { ...t, layerFieldInfo: i };
|
|
221
168
|
} catch (a) {
|
|
222
|
-
throw await
|
|
169
|
+
throw await s({ text: "Error during fetching statistics" }, e), new Error(`Error during fetching statistics: ${a instanceof Error ? a.message : String(a)}`);
|
|
223
170
|
}
|
|
224
|
-
},
|
|
171
|
+
}, S = 0.7, G = 10, W = async (t, e) => {
|
|
225
172
|
try {
|
|
226
|
-
await
|
|
227
|
-
const a =
|
|
173
|
+
await s({ text: "Similarity search to find fields" }, e);
|
|
174
|
+
const a = m(e, "fieldSearch"), l = m(e, "layersAndFieldsRegistry"), d = m(e, "embeddingCache"), r = await a.searchFields({
|
|
228
175
|
text: t.agentExecutionContext.assignedTask,
|
|
229
176
|
layerIds: t.vectorSearchLayerIds,
|
|
230
|
-
minScore:
|
|
231
|
-
topResults:
|
|
232
|
-
embeddingCache:
|
|
233
|
-
}), o =
|
|
234
|
-
const
|
|
177
|
+
minScore: S,
|
|
178
|
+
topResults: G,
|
|
179
|
+
embeddingCache: d
|
|
180
|
+
}), o = r.map(({ layerId: n, results: c }) => {
|
|
181
|
+
const u = c.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
|
|
235
182
|
`);
|
|
236
|
-
return `${
|
|
237
|
-
${
|
|
183
|
+
return `${l.get(n)?.layerItem.name ?? n}:
|
|
184
|
+
${u}`;
|
|
238
185
|
}).join(`
|
|
239
186
|
`);
|
|
240
|
-
let
|
|
241
|
-
return
|
|
242
|
-
${o}` :
|
|
187
|
+
let i;
|
|
188
|
+
return r.length > 0 ? i = `Vector search completed. Matching layers and fields with scores:
|
|
189
|
+
${o}` : i = `No vector search results found for score over ${S}.`, await s({ text: i }, e), {
|
|
243
190
|
...t,
|
|
244
|
-
vectorSearchFieldResults:
|
|
191
|
+
vectorSearchFieldResults: r
|
|
245
192
|
};
|
|
246
193
|
} catch (a) {
|
|
247
|
-
throw await
|
|
194
|
+
throw await s(
|
|
248
195
|
{ text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
|
|
249
196
|
e
|
|
250
197
|
), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
|
|
251
198
|
}
|
|
252
|
-
},
|
|
199
|
+
}, H = 0.7, J = async (t, e) => {
|
|
253
200
|
try {
|
|
254
|
-
await
|
|
201
|
+
await s(
|
|
255
202
|
{ text: `Similarity search to find layers: ${t.agentExecutionContext.assignedTask}` },
|
|
256
203
|
e
|
|
257
204
|
);
|
|
258
|
-
const a =
|
|
205
|
+
const a = m(e, "layerSearch"), l = m(e, "layersAndFieldsRegistry"), d = m(e, "embeddingCache"), r = await a.searchLayers({
|
|
259
206
|
text: t.agentExecutionContext.assignedTask,
|
|
260
|
-
minScore:
|
|
261
|
-
embeddingCache:
|
|
262
|
-
}), o =
|
|
207
|
+
minScore: H,
|
|
208
|
+
embeddingCache: d
|
|
209
|
+
}), o = r.map((c) => c.id), i = r.map(({ id: c, score: u }) => `${l.get(c)?.layerItem.name ?? c} (${u.toFixed(2)})`).join(`
|
|
263
210
|
`);
|
|
264
|
-
let
|
|
265
|
-
return o.length > 0 ?
|
|
266
|
-
${
|
|
211
|
+
let n;
|
|
212
|
+
return o.length > 0 ? n = `Vector search completed. Matching layers with scores:
|
|
213
|
+
${i}` : n = "Vector search completed. No matching layers found.", await s({ text: n }, e), {
|
|
267
214
|
...t,
|
|
268
215
|
vectorSearchLayerIds: o
|
|
269
216
|
};
|
|
270
217
|
} catch (a) {
|
|
271
|
-
throw await
|
|
218
|
+
throw await s(
|
|
272
219
|
{ text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
|
|
273
220
|
e
|
|
274
221
|
), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
|
|
275
222
|
}
|
|
276
|
-
},
|
|
223
|
+
}, U = (t, e) => N(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
|
|
277
224
|
t,
|
|
278
225
|
e
|
|
279
|
-
),
|
|
226
|
+
), B = () => new R(T).addNode("requireDataExplorationServices", U).addNode("vectorSearchLayers", J).addNode("vectorSearchFields", W).addNode("fieldStatistics", j).addNode("queryAgent", Q).addNode("queryTools", b).addNode("summarizeQueryResponseLLM", V).addNode("filterAgent", z).addNode("filterTools", O).addNode("earlyExit", I).addEdge(F, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
|
|
280
227
|
"vectorSearchLayers",
|
|
281
228
|
(e) => e.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
|
|
282
229
|
).addConditionalEdges(
|
|
@@ -285,7 +232,7 @@ ${r}` : i = "Vector search completed. No matching layers found.", await n({ text
|
|
|
285
232
|
).addEdge("fieldStatistics", "queryAgent").addConditionalEdges("queryAgent", (e) => (e.dataExplorationMessages[e.dataExplorationMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "queryTools" : "filterAgent").addConditionalEdges(
|
|
286
233
|
"queryTools",
|
|
287
234
|
(e) => e.queryResponse.length ? "summarizeQueryResponseLLM" : "filterAgent"
|
|
288
|
-
).addEdge("summarizeQueryResponseLLM", "filterAgent").addConditionalEdges("filterAgent", (e) => (e.dataExplorationMessages[e.dataExplorationMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "filterTools" :
|
|
235
|
+
).addEdge("summarizeQueryResponseLLM", "filterAgent").addConditionalEdges("filterAgent", (e) => (e.dataExplorationMessages[e.dataExplorationMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "filterTools" : y).addEdge("filterTools", y).addEdge("earlyExit", y), K = String.raw`- **data exploration** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. And/Or user wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
|
|
289
236
|
The Data Exploration Agent will automatically zoom to the affected features for action taken by this agent. In this case, no need to call navigation tool separately.
|
|
290
237
|
_Example: “Only show stations where Brand is Shell”_
|
|
291
238
|
_Example: “Make Shell stations stand out on the map”_
|
|
@@ -293,13 +240,15 @@ ${r}` : i = "Vector search completed. No matching layers found.", await n({ text
|
|
|
293
240
|
This also includes questions that ask which feature meets a given condition or where a particular feature in the data is located (e.g., “Where is the spring with the highest elevation?”). However, this agent does not handle addresses.
|
|
294
241
|
_Example: “How many features are there?”_
|
|
295
242
|
_Example: “What’s the average population?”_
|
|
296
|
-
_Example: “Which values are in the status field?”_
|
|
243
|
+
_Example: “Which values are in the status field?”_
|
|
244
|
+
|
|
245
|
+
This agent does NOT handle help/metadata requests such as listing available layers, listing field names/columns/attributes for a layer, or capability guidance.`, fe = {
|
|
297
246
|
id: "dataExploration",
|
|
298
247
|
name: "Data Exploration Agent",
|
|
299
|
-
description:
|
|
300
|
-
createGraph:
|
|
301
|
-
workspace:
|
|
248
|
+
description: K,
|
|
249
|
+
createGraph: B,
|
|
250
|
+
workspace: T
|
|
302
251
|
};
|
|
303
252
|
export {
|
|
304
|
-
|
|
253
|
+
fe as D
|
|
305
254
|
};
|