@arcgis/ai-components 5.2.0-next.7 → 5.2.0-next.70
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/README.md +2 -2
- package/dist/agent-utils/FunctionAgent.d.ts +2 -2
- package/dist/agent-utils/LLMAgent.d.ts +2 -2
- package/dist/agent-utils/LLMAgent.js +2 -1
- package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
- 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 +36 -7
- 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/cdn/{H7422XUG.js → 2GH3K5JP.js} +1 -1
- package/dist/cdn/2Y4DTOGT.js +2 -0
- package/dist/cdn/3DJDRAGV.js +2 -0
- package/dist/cdn/3S5G5SIX.js +2 -0
- package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
- package/dist/cdn/3ZPPYCNL.js +2 -0
- package/dist/cdn/434TAA3J.js +2 -0
- package/dist/cdn/4CEMUECT.js +2 -0
- package/dist/cdn/4PCAK3ET.js +2 -0
- package/dist/cdn/57OMVTIU.js +2 -0
- package/dist/cdn/5TI2F5XX.js +2 -0
- package/dist/cdn/6TA5KFAQ.js +4 -0
- package/dist/cdn/6U7TEAAJ.js +2 -0
- package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
- package/dist/cdn/APFZY4PI.js +2 -0
- package/dist/cdn/B6CJG5UH.js +66 -0
- package/dist/cdn/BE7ZN5FZ.js +2 -0
- package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
- package/dist/cdn/BNSJO6X2.js +2 -0
- package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
- package/dist/cdn/CMDRED5H.js +2 -0
- package/dist/cdn/CXW5URTF.js +14 -0
- package/dist/cdn/DCSZPL7R.js +2 -0
- package/dist/cdn/DTIVDIDY.js +2 -0
- package/dist/cdn/DUSILSNJ.js +9 -0
- package/dist/cdn/E5ZKBC24.js +36 -0
- package/dist/cdn/FSGIG7UN.js +2 -0
- package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
- package/dist/cdn/GLBE7OW2.js +2 -0
- package/dist/cdn/GP6NDTUE.js +18 -0
- package/dist/cdn/HBLRVXEB.js +2 -0
- package/dist/cdn/HJG7QM2R.js +9 -0
- package/dist/cdn/HQXPPYMD.js +2 -0
- package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
- package/dist/cdn/ICYUPLZM.js +56 -0
- package/dist/cdn/IEHPNCTL.js +2 -0
- package/dist/cdn/IHP25JWI.js +99 -0
- package/dist/cdn/J6A4AS7E.js +22 -0
- package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
- package/dist/cdn/KKLAQF3Z.js +2 -0
- package/dist/cdn/KLYNL2ZT.js +2 -0
- package/dist/cdn/KQHLOYKL.js +3 -0
- package/dist/cdn/LHLO6PTD.js +2 -0
- package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
- package/dist/cdn/LUY6V4TP.js +181 -0
- package/dist/cdn/M3MRIGDZ.js +2 -0
- package/dist/cdn/{VOQX4AVB.js → MW5S2XCB.js} +6 -4
- package/dist/cdn/MWYBF3F3.js +66 -0
- package/dist/cdn/NEV6OZN3.js +71 -0
- package/dist/cdn/OKMZQXBQ.js +2 -0
- package/dist/cdn/OKTBWKNG.js +2 -0
- package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
- package/dist/cdn/OWXCOUIQ.js +2 -0
- package/dist/cdn/OYNIFMCJ.js +2 -0
- package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
- package/dist/cdn/PUFTYLJ2.js +22 -0
- package/dist/cdn/PVE7Q43N.js +2 -0
- package/dist/cdn/R74ZHFA6.js +2 -0
- package/dist/cdn/RLEHNAIA.js +2 -0
- package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
- package/dist/cdn/ST5FQYT7.js +180 -0
- package/dist/cdn/SXHH575T.js +48 -0
- package/dist/cdn/T4ECSHM7.js +2 -0
- package/dist/cdn/TFT6HK3O.js +208 -0
- package/dist/cdn/TPULIO6I.js +34 -0
- package/dist/cdn/U3XIDLHO.js +3 -0
- package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
- package/dist/cdn/UZLQALHY.js +2 -0
- package/dist/cdn/V6HOUZPZ.js +2 -0
- package/dist/cdn/VAXH6RUQ.js +134 -0
- package/dist/cdn/VXFQANGJ.js +2 -0
- package/dist/cdn/WQGJATNJ.js +2 -0
- package/dist/cdn/WSHWQDO2.js +2 -0
- package/dist/cdn/WUNCZOGU.js +2 -0
- package/dist/cdn/WVPU4QOO.js +2 -0
- package/dist/cdn/WXWO5D3W.js +2 -0
- package/dist/cdn/XCRR2EEG.js +6 -0
- package/dist/cdn/XETNZW4D.js +3 -0
- package/dist/cdn/XRE5USHA.js +2 -0
- package/dist/cdn/YHQJ66WJ.js +2 -0
- package/dist/cdn/ZCEMEUP7.js +2 -0
- package/dist/cdn/ZS6SXJP2.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/index.js +1 -1
- package/dist/chunks/adapter.js +1795 -1598
- package/dist/chunks/arcgisKnowledgeGraph.js +127 -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/converterUtils.js +39 -32
- package/dist/chunks/dataExplorationGraph.js +140 -114
- package/dist/chunks/data_explore_query_prompt.js +9 -4
- package/dist/chunks/generateLayerDescriptions.js +265 -240
- package/dist/chunks/helpGraph.js +30 -23
- 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 +25 -21
- package/dist/chunks/navigationGraph.js +79 -70
- package/dist/chunks/navigation_intent_prompt.js +8 -2
- package/dist/chunks/orchestrator.js +205 -175
- package/dist/chunks/slottableRequestUtils.js +3 -7
- package/dist/chunks/state.js +1 -1
- package/dist/chunks/summarize_query_response_prompt.js +9 -7
- package/dist/chunks/toolCallResponse.js +13 -10
- package/dist/chunks/utils2.js +8 -8
- package/dist/components/arcgis-assistant/customElement.d.ts +27 -0
- package/dist/components/arcgis-assistant/customElement.js +386 -152
- package/dist/components/arcgis-assistant/index.js +2 -3
- package/dist/components/arcgis-assistant/types.d.ts +14 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +5 -1
- package/dist/components/arcgis-assistant-chat/customElement.d.ts +2 -1
- package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
- package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -0
- package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +12 -6
- package/dist/components/arcgis-assistant-help-agent/customElement.js +9 -3
- package/dist/components/arcgis-assistant-interrupt/customElement.js +12 -8
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
- package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +18 -12
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +11 -5
- package/dist/components/arcgis-assistant-message/customElement.d.ts +2 -0
- package/dist/components/arcgis-assistant-message/customElement.js +28 -26
- package/dist/components/arcgis-assistant-message/index.js +2 -0
- package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
- package/dist/components/arcgis-assistant-message-block/index.js +1 -0
- package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +4 -0
- package/dist/components/arcgis-assistant-message-loading/customElement.js +10 -10
- package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
- 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 +12 -6
- package/dist/components/arcgis-assistant-speech-input/customElement.js +29 -46
- package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
- package/dist/components/arcgis-assistant-user-message/customElement.js +10 -8
- 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 +7 -6
- package/dist/oauth-callback.html +1 -1
- package/dist/types/lumina.d.ts +7 -6
- package/dist/types/preact.d.ts +7 -6
- package/dist/types/react.d.ts +7 -6
- package/dist/types/stencil.d.ts +7 -6
- package/dist/utils/index.d.ts +95 -47
- package/dist/utils/index.js +80 -65
- package/package.json +12 -11
- package/dist/cdn/2AXF774U.js +0 -2
- package/dist/cdn/3NI46YCE.js +0 -2
- package/dist/cdn/3PKJWIC3.js +0 -2
- package/dist/cdn/462JBSEV.js +0 -422
- package/dist/cdn/47FWPQ2A.js +0 -16
- package/dist/cdn/5QAHYX7Y.js +0 -5
- package/dist/cdn/7BCR6TUO.js +0 -2
- package/dist/cdn/7GH7VSB2.js +0 -2
- package/dist/cdn/7PLV4QH6.js +0 -2
- package/dist/cdn/AEJHYRGT.js +0 -166
- package/dist/cdn/AO7BQHKC.js +0 -2
- package/dist/cdn/AXDZBBNL.js +0 -45
- package/dist/cdn/BFZJNJL6.js +0 -22
- package/dist/cdn/DDLZOMUY.js +0 -2
- package/dist/cdn/DHOVCT6R.js +0 -2
- package/dist/cdn/F2AHA4GB.js +0 -54
- package/dist/cdn/FX5JFRDL.js +0 -2
- package/dist/cdn/GCQLVNNC.js +0 -14
- package/dist/cdn/HB5A5R2E.js +0 -2
- package/dist/cdn/JV4SI65E.js +0 -108
- package/dist/cdn/KMQ3SP4I.js +0 -5
- package/dist/cdn/MH5RPXHM.js +0 -2
- package/dist/cdn/NAUXSHIE.js +0 -72
- package/dist/cdn/NVI3I46B.js +0 -2
- package/dist/cdn/OAVEHGB6.js +0 -2
- package/dist/cdn/OH64RMOR.js +0 -4
- package/dist/cdn/P6OPJQMC.js +0 -3
- package/dist/cdn/QR54T33D.js +0 -2
- package/dist/cdn/R6HV42YW.js +0 -3
- package/dist/cdn/RVOAPUBN.js +0 -2
- package/dist/cdn/SXDLXCIM.js +0 -2
- package/dist/cdn/USMDJUFS.js +0 -2
- package/dist/cdn/V2P4AIGG.js +0 -2
- package/dist/cdn/V7OJRG26.js +0 -36
- package/dist/cdn/Y333DGV6.js +0 -2
- package/dist/cdn/YIMNOUTF.js +0 -2
|
@@ -3,15 +3,19 @@ import { StateGraph as E, START as $, END as C } from "@langchain/langgraph/web"
|
|
|
3
3
|
import { k as F, m as R, n as L, o as M, p as A, u as _, v as I, w as q, x as Z, g as T, y as k, t as j, f as u, r as P, N as w } from "./adapter.js";
|
|
4
4
|
import "@arcgis/core/identity/IdentityManager.js";
|
|
5
5
|
import "@arcgis/core/portal/Portal.js";
|
|
6
|
-
import
|
|
6
|
+
import "@arcgis/core/request.js";
|
|
7
|
+
import "@arcgis/toolkit/string";
|
|
8
|
+
import { h as V, i as z } from "./generateLayerDescriptions.js";
|
|
7
9
|
import "@langchain/core/messages";
|
|
8
10
|
import "@langchain/core/callbacks/dispatch/web";
|
|
9
11
|
import "@langchain/openai";
|
|
12
|
+
import "@arcgis/core/config.js";
|
|
10
13
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
11
14
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
12
|
-
import "
|
|
15
|
+
import { h as G } from "./toolCallResponse.js";
|
|
16
|
+
import { s as h } from "./index.js";
|
|
13
17
|
import "@langchain/core/prompts";
|
|
14
|
-
import { ToolNode as
|
|
18
|
+
import { ToolNode as O } from "@langchain/langgraph/prebuilt";
|
|
15
19
|
import x from "zod";
|
|
16
20
|
const S = [
|
|
17
21
|
F,
|
|
@@ -24,19 +28,19 @@ const S = [
|
|
|
24
28
|
q,
|
|
25
29
|
Z
|
|
26
30
|
];
|
|
27
|
-
async function
|
|
28
|
-
const o = await T("navigation_tool_prompt"), { mapView: s } = k(t), i = s.map.bookmarks?.map((p) => p.name).filter(Boolean) ?? [],
|
|
31
|
+
async function B(e, t) {
|
|
32
|
+
const o = await T("navigation_tool_prompt"), { mapView: s } = k(t), i = s.map.bookmarks?.map((p) => p.name).filter(Boolean) ?? [], l = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
|
|
29
33
|
(p, b) => `${b + 1}. layerId=${p.id} | title=${p.title ?? ""} | name=${p.name ?? ""} | score=${p.score.toFixed(2)}`
|
|
30
34
|
).join(`
|
|
31
|
-
`) : "",
|
|
35
|
+
`) : "", c = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", a = e.intent === "goToBookmark" && i.length ? `Available bookmarks:
|
|
32
36
|
${i.map((p) => `- ${p}`).join(`
|
|
33
37
|
`)}` : "", r = (e.intent === "goToLayer" || e.intent === "goToFeatures") && e.vectorSearchLayerResults?.length ? `Candidate layers:
|
|
34
|
-
${
|
|
35
|
-
${
|
|
38
|
+
${l}` : "", m = e.intent === "goToFeatures" && e.vectorSearchFieldResults?.length ? `Candidate fields:
|
|
39
|
+
${c}` : "", y = {
|
|
36
40
|
intent: e.intent,
|
|
37
41
|
bookmarksSection: a,
|
|
38
42
|
layersSection: r,
|
|
39
|
-
fieldsSection:
|
|
43
|
+
fieldsSection: m,
|
|
40
44
|
currentZoom: s.zoom,
|
|
41
45
|
assignedTask: e.agentExecutionContext.assignedTask,
|
|
42
46
|
userRequest: e.agentExecutionContext.userRequest,
|
|
@@ -44,21 +48,24 @@ ${l}` : "", y = {
|
|
|
44
48
|
}, n = await V({
|
|
45
49
|
promptText: o,
|
|
46
50
|
modelTier: "fast",
|
|
51
|
+
config: t,
|
|
47
52
|
inputVariables: y,
|
|
48
53
|
tools: S
|
|
49
|
-
})
|
|
54
|
+
});
|
|
55
|
+
await G(n, t);
|
|
56
|
+
const g = (n.tool_calls?.length ?? 0) > 0, v = typeof n.text == "string" ? n.text.trim() : "", N = v.length > 0;
|
|
50
57
|
return {
|
|
51
58
|
...e,
|
|
52
59
|
navigationInternalState: {
|
|
53
60
|
...e.navigationInternalState,
|
|
54
|
-
toolCallMessage:
|
|
61
|
+
toolCallMessage: g ? n : void 0
|
|
55
62
|
},
|
|
56
63
|
// No tool call => surface fallback text now. Tool call => tool node will set output.
|
|
57
|
-
outputMessage:
|
|
58
|
-
status:
|
|
64
|
+
outputMessage: g ? e.outputMessage : v,
|
|
65
|
+
status: g ? e.status : N ? "success" : "failed"
|
|
59
66
|
};
|
|
60
67
|
}
|
|
61
|
-
const
|
|
68
|
+
const D = (e) => {
|
|
62
69
|
const t = typeof e == "string" ? e : String(e);
|
|
63
70
|
try {
|
|
64
71
|
const o = JSON.parse(t);
|
|
@@ -69,31 +76,31 @@ const B = (e) => {
|
|
|
69
76
|
}
|
|
70
77
|
return { text: t };
|
|
71
78
|
};
|
|
72
|
-
async function
|
|
73
|
-
const o = new
|
|
79
|
+
async function J(e, t) {
|
|
80
|
+
const o = new O(S, { handleToolErrors: !1 });
|
|
74
81
|
try {
|
|
75
82
|
const s = e.navigationInternalState.toolCallMessage;
|
|
76
83
|
if (!s)
|
|
77
84
|
throw new Error("navigationToolCalling: missing navigationInternalState.toolCallMessage");
|
|
78
|
-
const { messages:
|
|
85
|
+
const { messages: d } = await o.invoke(
|
|
79
86
|
{
|
|
80
87
|
messages: [s]
|
|
81
88
|
},
|
|
82
89
|
t
|
|
83
90
|
);
|
|
84
|
-
let i = "",
|
|
85
|
-
for (const
|
|
86
|
-
const a =
|
|
91
|
+
let i = "", l;
|
|
92
|
+
for (const c of d) {
|
|
93
|
+
const a = D(c.content);
|
|
87
94
|
a.text && (i += `${a.text}
|
|
88
|
-
`), a.sharedStatePatch && (
|
|
89
|
-
...
|
|
95
|
+
`), a.sharedStatePatch && (l = {
|
|
96
|
+
...l,
|
|
90
97
|
...a.sharedStatePatch
|
|
91
98
|
});
|
|
92
99
|
}
|
|
93
100
|
return await h({ text: `Finished executing navigation tool: ${i}` }, t), {
|
|
94
101
|
...e,
|
|
95
102
|
outputMessage: i,
|
|
96
|
-
sharedStatePatch:
|
|
103
|
+
sharedStatePatch: l,
|
|
97
104
|
status: "success",
|
|
98
105
|
summary: i ? j(i) : "Navigation executed.",
|
|
99
106
|
navigationInternalState: {
|
|
@@ -102,12 +109,12 @@ async function D(e, t) {
|
|
|
102
109
|
}
|
|
103
110
|
};
|
|
104
111
|
} catch (s) {
|
|
105
|
-
const
|
|
106
|
-
return await h({ text: `Navigation tool execution failed: ${
|
|
112
|
+
const d = s instanceof Error ? s.message : String(s);
|
|
113
|
+
return await h({ text: `Navigation tool execution failed: ${d}` }, t), {
|
|
107
114
|
...e,
|
|
108
|
-
outputMessage: `Navigation tool execution failed: ${
|
|
115
|
+
outputMessage: `Navigation tool execution failed: ${d}`,
|
|
109
116
|
status: "failed",
|
|
110
|
-
summary: `Navigation tool execution failed: ${
|
|
117
|
+
summary: `Navigation tool execution failed: ${d}`,
|
|
111
118
|
navigationInternalState: {
|
|
112
119
|
...e.navigationInternalState,
|
|
113
120
|
toolCallMessage: void 0
|
|
@@ -115,55 +122,56 @@ async function D(e, t) {
|
|
|
115
122
|
};
|
|
116
123
|
}
|
|
117
124
|
}
|
|
118
|
-
async function
|
|
119
|
-
const o = await T("navigation_intent_prompt"), { mapView: s } = k(t),
|
|
125
|
+
async function H(e, t) {
|
|
126
|
+
const o = await T("navigation_intent_prompt"), { mapView: s } = k(t), d = S.map((n) => ({
|
|
120
127
|
name: n.name,
|
|
121
128
|
description: n.description,
|
|
122
129
|
schema: n.schema
|
|
123
|
-
})),
|
|
124
|
-
${
|
|
125
|
-
`)}` : "", a = {
|
|
126
|
-
tools:
|
|
130
|
+
})), l = s.map.bookmarks?.map((n) => n.name).filter(Boolean) ?? [], c = l.length ? `Available bookmarks:
|
|
131
|
+
${l.map((n) => `- ${n}`).join(`
|
|
132
|
+
`)}` : "No bookmarks are available in this map.", a = {
|
|
133
|
+
tools: d.map(({ name: n, description: g, schema: v }) => `${n}: ${g}, ${JSON.stringify(v)}`).join(`
|
|
127
134
|
`),
|
|
128
|
-
bookmarks:
|
|
135
|
+
bookmarks: c,
|
|
129
136
|
assignedTask: e.agentExecutionContext.assignedTask,
|
|
130
137
|
userRequest: e.agentExecutionContext.userRequest,
|
|
131
138
|
priorSteps: e.agentExecutionContext.priorSteps
|
|
132
139
|
}, r = x.object({
|
|
133
140
|
intent: x.string()
|
|
134
|
-
}),
|
|
141
|
+
}), m = await z({
|
|
135
142
|
promptText: o,
|
|
143
|
+
config: t,
|
|
136
144
|
inputVariables: a,
|
|
137
145
|
schema: r,
|
|
138
146
|
modelTier: "fast"
|
|
139
|
-
}), y = typeof
|
|
147
|
+
}), y = typeof m.intent == "string" ? m.intent.trim().replace(/^"|"$/gu, "") : "";
|
|
140
148
|
return { ...e, intent: y || "" };
|
|
141
149
|
}
|
|
142
|
-
const
|
|
150
|
+
const U = 0.7, W = async (e, t) => {
|
|
143
151
|
try {
|
|
144
152
|
await h(
|
|
145
153
|
{ text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
|
|
146
154
|
t
|
|
147
155
|
);
|
|
148
|
-
const o = u(t, "layerSearch"), s = u(t, "layersAndFieldsRegistry"),
|
|
156
|
+
const o = u(t, "layerSearch"), s = u(t, "layersAndFieldsRegistry"), d = u(t, "embeddingCache"), l = (await o.searchLayers({
|
|
149
157
|
text: e.agentExecutionContext.assignedTask,
|
|
150
|
-
minScore:
|
|
151
|
-
embeddingCache:
|
|
158
|
+
minScore: U,
|
|
159
|
+
embeddingCache: d
|
|
152
160
|
})).map(({ id: a, score: r }) => {
|
|
153
|
-
const
|
|
161
|
+
const m = s.get(a)?.layerItem;
|
|
154
162
|
return {
|
|
155
163
|
id: a,
|
|
156
|
-
title:
|
|
157
|
-
name:
|
|
164
|
+
title: m?.title,
|
|
165
|
+
name: m?.name ?? void 0,
|
|
158
166
|
score: r
|
|
159
167
|
};
|
|
160
168
|
});
|
|
161
|
-
let
|
|
162
|
-
return
|
|
163
|
-
${
|
|
164
|
-
`)}` :
|
|
169
|
+
let c;
|
|
170
|
+
return l.length > 0 ? c = `Vector search completed. Matching layers:
|
|
171
|
+
${l.map((a) => `- layerId=${a.id} | title=${a.title ?? ""} | name=${a.name ?? ""} | score=${a.score.toFixed(2)}`).join(`
|
|
172
|
+
`)}` : c = "Vector search completed. No matching layers found.", await h({ text: c }, t), {
|
|
165
173
|
...e,
|
|
166
|
-
vectorSearchLayerResults:
|
|
174
|
+
vectorSearchLayerResults: l
|
|
167
175
|
};
|
|
168
176
|
} catch (o) {
|
|
169
177
|
throw await h(
|
|
@@ -171,49 +179,50 @@ ${c.map((a) => `- layerId=${a.id} | title=${a.title ?? ""} | name=${a.name ?? ""
|
|
|
171
179
|
t
|
|
172
180
|
), o;
|
|
173
181
|
}
|
|
174
|
-
}, f = 0.7,
|
|
182
|
+
}, f = 0.7, K = 10, Q = async (e, t) => {
|
|
175
183
|
try {
|
|
176
184
|
await h(
|
|
177
185
|
{ text: `Similarity search to find fields: ${e.agentExecutionContext.assignedTask}` },
|
|
178
186
|
t
|
|
179
187
|
);
|
|
180
|
-
const o = u(t, "fieldSearch"), s = u(t, "layersAndFieldsRegistry"),
|
|
188
|
+
const o = u(t, "fieldSearch"), s = u(t, "layersAndFieldsRegistry"), d = u(t, "embeddingCache"), i = e.vectorSearchLayerResults?.map((r) => r.id) ?? [];
|
|
181
189
|
if (i.length === 0)
|
|
182
190
|
return await h({ text: "No candidate layers for field search" }, t), e;
|
|
183
|
-
const
|
|
191
|
+
const c = (await o.searchFields({
|
|
184
192
|
text: e.agentExecutionContext.assignedTask,
|
|
185
193
|
layerIds: i,
|
|
186
194
|
minScore: f,
|
|
187
|
-
topResults:
|
|
188
|
-
embeddingCache:
|
|
189
|
-
})).map(({ layerId: r, results:
|
|
195
|
+
topResults: K,
|
|
196
|
+
embeddingCache: d
|
|
197
|
+
})).map(({ layerId: r, results: m }) => {
|
|
190
198
|
const y = s.get(r)?.fieldRegistry;
|
|
191
199
|
return {
|
|
192
200
|
layerId: r,
|
|
193
201
|
layerName: s.get(r)?.layerItem.name,
|
|
194
|
-
results:
|
|
195
|
-
const
|
|
202
|
+
results: m.map((n) => {
|
|
203
|
+
const g = y?.get(n.name);
|
|
196
204
|
return {
|
|
197
205
|
name: n.name,
|
|
198
206
|
score: n.score,
|
|
199
|
-
type:
|
|
200
|
-
alias:
|
|
201
|
-
description:
|
|
202
|
-
statistics:
|
|
207
|
+
type: g?.type,
|
|
208
|
+
alias: g?.alias,
|
|
209
|
+
description: g?.description,
|
|
210
|
+
statistics: g?.statistics,
|
|
211
|
+
domain: g?.domain
|
|
203
212
|
};
|
|
204
213
|
})
|
|
205
214
|
};
|
|
206
215
|
});
|
|
207
216
|
let a;
|
|
208
|
-
return
|
|
209
|
-
${
|
|
217
|
+
return c.length > 0 ? a = `Vector search completed. Matching layers and fields:
|
|
218
|
+
${c.map(
|
|
210
219
|
(r) => `${r.layerName ?? r.layerId}:
|
|
211
|
-
${r.results.map((
|
|
220
|
+
${r.results.map((m) => ` - ${m.name} (${m.score.toFixed(2)})`).join(`
|
|
212
221
|
`)}`
|
|
213
222
|
).join(`
|
|
214
223
|
`)}` : a = `No vector search field results found for score over ${f}.`, await h({ text: a }, t), {
|
|
215
224
|
...e,
|
|
216
|
-
vectorSearchFieldResults:
|
|
225
|
+
vectorSearchFieldResults: c
|
|
217
226
|
};
|
|
218
227
|
} catch (o) {
|
|
219
228
|
throw await h(
|
|
@@ -221,7 +230,7 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
221
230
|
t
|
|
222
231
|
), o;
|
|
223
232
|
}
|
|
224
|
-
},
|
|
233
|
+
}, X = (e, t) => P(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), Y = () => new E(w).addNode("requireNavigationServices", X).addNode("intentLLM", H).addNode("vectorSearchLayers", W).addNode("vectorSearchFields", Q).addNode("agent", B).addNode("tools", J).addEdge($, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
|
|
225
234
|
"intentLLM",
|
|
226
235
|
(t) => t.intent === "goToLayer" || t.intent === "goToFeatures" ? "vectorSearchLayers" : "agent",
|
|
227
236
|
{
|
|
@@ -235,7 +244,7 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
235
244
|
vectorSearchFields: "vectorSearchFields",
|
|
236
245
|
agent: "agent"
|
|
237
246
|
}
|
|
238
|
-
).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", C),
|
|
247
|
+
).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", C), ee = String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
|
|
239
248
|
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 "show me...", that is meant to be handled by another agent. If the query is about where a certain address is, call this agent.
|
|
240
249
|
|
|
241
250
|
Supported actions:
|
|
@@ -254,13 +263,13 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
254
263
|
_Example: “Center the map on San Francisco at scale 50000”_
|
|
255
264
|
_Example: “Zoom to the features in the schools layer where city = 'Austin'”_
|
|
256
265
|
_Example: “Go to the Downtown bookmark”_
|
|
257
|
-
_Example: “Where is Mount Rainier?”_`,
|
|
266
|
+
_Example: “Where is Mount Rainier?”_`, xe = {
|
|
258
267
|
id: "navigation",
|
|
259
268
|
name: "Navigation Agent",
|
|
260
|
-
description:
|
|
261
|
-
createGraph:
|
|
269
|
+
description: ee,
|
|
270
|
+
createGraph: Y,
|
|
262
271
|
workspace: w
|
|
263
272
|
};
|
|
264
273
|
export {
|
|
265
|
-
|
|
274
|
+
xe as N
|
|
266
275
|
};
|
|
@@ -36,8 +36,14 @@ This is the order of preference in case of overlap:
|
|
|
36
36
|
|
|
37
37
|
For example, "Where is Yosemite National Park". This is an address, but:
|
|
38
38
|
A map that contains a bookmark with Yosemite National Park should prefer the bookmark.
|
|
39
|
-
|
|
40
|
-
If these do not exist, geocode and go to that address.
|
|
39
|
+
If bookmark does not exist, a map that has the National Parks layer, for example, should prefer the feature.
|
|
40
|
+
If both of these do not exist, geocode and go to that address.
|
|
41
|
+
|
|
42
|
+
Additional mapping guidance:
|
|
43
|
+
|
|
44
|
+
- "zoom/go to [layer]" with no filter → prefer \`goToLayer\`.
|
|
45
|
+
- "zoom/go to [features] where/with ..." (has a condition/filter) → prefer \`goToFeatures\`.
|
|
46
|
+
- Explicit numeric zoom/scale/viewpoint requests → prefer the matching zoom/scale/viewpoint tool.
|
|
41
47
|
|
|
42
48
|
Return the name of the tool as a string.
|
|
43
49
|
`;
|