@arcgis/ai-components 5.2.0-next.16 → 5.2.0-next.18
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/agent-utils/index.d.ts +78 -0
- package/dist/agent-utils/index.js +116 -97
- package/dist/agent-utils/types.d.ts +12 -12
- package/dist/cdn/27NEUQN3.js +2 -0
- package/dist/cdn/{IR7PTESF.js → 2NMR43NW.js} +1 -1
- package/dist/cdn/4I4MCV7V.js +71 -0
- package/dist/cdn/{P7DG5T3Z.js → 4RZPOYZ7.js} +1 -1
- package/dist/cdn/5SBLS4NW.js +2 -0
- package/dist/cdn/{BX7FSMUU.js → 6LZ6GOHF.js} +1 -1
- package/dist/cdn/{K3JCH4XW.js → C7E7MJSR.js} +1 -1
- package/dist/cdn/{JIWK6QK6.js → CIW3QMKV.js} +1 -1
- package/dist/cdn/{DHKUXLU3.js → CJIV4KJZ.js} +1 -1
- package/dist/cdn/CVHJMR5X.js +2 -0
- package/dist/cdn/ETD76QRC.js +14 -0
- package/dist/cdn/FC2ZX3SS.js +2 -0
- package/dist/cdn/{4UDYY3HL.js → HOCTVCHH.js} +1 -1
- package/dist/cdn/I64KIZG3.js +2 -0
- package/dist/cdn/{S75VFYR4.js → I76F57I2.js} +19 -18
- package/dist/cdn/IB4WTK74.js +2 -0
- package/dist/cdn/{3JGWGKT6.js → IC5P5NYY.js} +1 -1
- package/dist/cdn/{QYR3NSF2.js → IDZTJLVN.js} +2 -2
- package/dist/cdn/IW43UAIS.js +3 -0
- package/dist/cdn/{22IT5TDB.js → JBNITHPO.js} +5 -5
- package/dist/cdn/{7CYGX4F4.js → JEIMRNYM.js} +1 -1
- package/dist/cdn/K37GTMOF.js +18 -0
- package/dist/cdn/{NE7E52YR.js → KTK4HNL2.js} +8 -2
- package/dist/cdn/{TR4GFL7X.js → L77BTGXY.js} +1 -1
- package/dist/cdn/{XOH56EQ2.js → LODKJRS4.js} +1 -1
- package/dist/cdn/LSNMNSYS.js +2 -0
- package/dist/cdn/NNC3UYMR.js +2 -0
- package/dist/cdn/NOJYPREL.js +3 -0
- package/dist/cdn/{Q6LRANX6.js → O3F47IO5.js} +1 -1
- package/dist/cdn/{O3RFFPU3.js → O7TGCM5P.js} +1 -1
- package/dist/cdn/PBTINZTK.js +65 -0
- package/dist/cdn/PSWI3MFB.js +2 -0
- package/dist/cdn/RNLQZV6U.js +36 -0
- package/dist/cdn/RX45PCYB.js +9 -0
- package/dist/cdn/SLNLQG3A.js +2 -0
- package/dist/cdn/{X4XY5HIE.js → SMADRJ67.js} +1 -1
- package/dist/cdn/{GBYLKQIL.js → T7CQZ27H.js} +1 -1
- package/dist/cdn/UNFG4ZJ5.js +3 -0
- package/dist/cdn/V6TM3MTN.js +22 -0
- package/dist/cdn/{IOD3GDA7.js → VKU4WAQV.js} +1 -1
- package/dist/cdn/{RUURNLTP.js → W2JAKE2M.js} +1 -1
- package/dist/cdn/{3VOQD2MR.js → WAVKMZA6.js} +1 -1
- package/dist/cdn/WQQRLD5F.js +2 -0
- package/dist/cdn/XAI6OR2N.js +2 -0
- package/dist/cdn/{DXVU45KM.js → XVQJBUMY.js} +1 -1
- package/dist/cdn/YJ3QQXF6.js +2 -0
- package/dist/cdn/{DQSEBKOX.js → YYY7HKYX.js} +1 -1
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
- package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
- package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/converterUtils.js +39 -32
- package/dist/chunks/dataExplorationGraph.js +12 -10
- package/dist/chunks/helpGraph.js +8 -8
- package/dist/chunks/help_prompt.js +34 -17
- package/dist/chunks/navigationGraph.js +4 -4
- package/dist/chunks/navigation_intent_prompt.js +8 -2
- package/dist/chunks/state.js +1 -1
- package/dist/chunks/utils2.js +8 -8
- package/dist/components/arcgis-assistant/customElement.d.ts +7 -0
- package/dist/components/arcgis-assistant/customElement.js +301 -181
- package/dist/components/arcgis-assistant-agent/customElement.js +5 -1
- package/dist/components/arcgis-assistant-chat/customElement.js +22 -17
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +9 -5
- package/dist/components/arcgis-assistant-help-agent/customElement.js +6 -2
- package/dist/components/arcgis-assistant-interrupt/customElement.js +4 -4
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +16 -12
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +8 -4
- package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
- 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 +9 -5
- 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 +2 -2
- package/dist/types/lumina.d.ts +2 -2
- package/dist/types/preact.d.ts +2 -2
- package/dist/types/react.d.ts +2 -2
- package/dist/types/stencil.d.ts +2 -2
- package/dist/utils/index.d.ts +1 -2
- package/package.json +4 -4
- package/dist/cdn/7PANDHIL.js +0 -16
- package/dist/cdn/CE6VDP2D.js +0 -72
- package/dist/cdn/CI3QSFPS.js +0 -2
- package/dist/cdn/F2AHA4GB.js +0 -54
- package/dist/cdn/FUIGPHBH.js +0 -2
- package/dist/cdn/GPYYAQVI.js +0 -2
- package/dist/cdn/I2Y67HBL.js +0 -14
- package/dist/cdn/JG2BIENI.js +0 -3
- package/dist/cdn/K475UT3E.js +0 -2
- package/dist/cdn/L4XF4H6V.js +0 -36
- package/dist/cdn/PB2ODJC7.js +0 -2
- package/dist/cdn/SBHLUL3Q.js +0 -2
- package/dist/cdn/XBW4MWQR.js +0 -2
- package/dist/cdn/XU6NCSE2.js +0 -22
- package/dist/cdn/Z7UWJ4AI.js +0 -3
- package/dist/orchestrator/registry/agentRegistry.d.ts +0 -33
- /package/dist/cdn/{CHPQM77M.js → IKEF7ZHH.js} +0 -0
package/dist/chunks/helpGraph.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { StateGraph as d, START as g, END as i } from "@langchain/langgraph/web";
|
|
3
|
-
import { l as h, g as f, f as p, r as x, t as y, H as
|
|
3
|
+
import { l as h, g as f, f as p, r as x, t as y, H as u } from "./adapter.js";
|
|
4
4
|
import "@arcgis/core/identity/IdentityManager.js";
|
|
5
5
|
import "@arcgis/core/portal/Portal.js";
|
|
6
6
|
import "@arcgis/toolkit/string";
|
|
@@ -15,7 +15,7 @@ import "@arcgis/core/request.js";
|
|
|
15
15
|
import { ToolNode as E } from "@langchain/langgraph/prebuilt";
|
|
16
16
|
import { s as m } from "./index.js";
|
|
17
17
|
import "@langchain/core/prompts";
|
|
18
|
-
const
|
|
18
|
+
const c = [h], v = (e) => {
|
|
19
19
|
if (!e || e.size === 0)
|
|
20
20
|
return "No layers available in this map.";
|
|
21
21
|
const t = Array.from(e.values()).map(({ layerItem: r, fieldRegistry: s }, l) => {
|
|
@@ -40,7 +40,7 @@ async function _(e, t) {
|
|
|
40
40
|
promptText: r,
|
|
41
41
|
modelTier: "fast",
|
|
42
42
|
config: t,
|
|
43
|
-
tools:
|
|
43
|
+
tools: c,
|
|
44
44
|
inputVariables: {
|
|
45
45
|
layerSummary: v(s),
|
|
46
46
|
agents: T(l),
|
|
@@ -71,7 +71,7 @@ async function _(e, t) {
|
|
|
71
71
|
}
|
|
72
72
|
const C = (e, t) => x(["agentRegistry"], "Help Agent")(e, t);
|
|
73
73
|
async function H(e, t) {
|
|
74
|
-
const r = new E(
|
|
74
|
+
const r = new E(c, { handleToolErrors: !1 });
|
|
75
75
|
try {
|
|
76
76
|
const s = e.helpInternalState.toolCallMessage;
|
|
77
77
|
if (!s)
|
|
@@ -102,7 +102,7 @@ async function H(e, t) {
|
|
|
102
102
|
};
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
|
-
const b = () => new d(
|
|
105
|
+
const b = () => new d(u).addNode("requireHelpServices", C).addNode("agent", _).addNode("tools", H).addEdge(g, "requireHelpServices").addEdge("requireHelpServices", "agent").addConditionalEdges("agent", (t) => t.helpInternalState.toolCallMessage ? "tools" : i).addEdge("tools", i), M = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
|
|
106
106
|
|
|
107
107
|
_Example: “Tell me about this map”_
|
|
108
108
|
_Example: “List all layers in this map”_
|
|
@@ -111,16 +111,16 @@ const b = () => new d(c).addNode("requireHelpServices", C).addNode("agent", _).a
|
|
|
111
111
|
_Example: “What can you do?”_
|
|
112
112
|
_Example: “What can I ask”_
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
If the user asks unrelated queries like "What are the vowels in English alphabet" or "How to cook", call this agent so it can politely refuse and redirect to map-related questions.
|
|
115
115
|
|
|
116
|
-
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
|
|
116
|
+
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 that the requested action is not supported.
|
|
117
117
|
_Example: "Create a chart"_
|
|
118
118
|
_Example: "Create a table"_`, V = {
|
|
119
119
|
id: "help",
|
|
120
120
|
name: "Help Agent",
|
|
121
121
|
description: M,
|
|
122
122
|
createGraph: b,
|
|
123
|
-
workspace:
|
|
123
|
+
workspace: u
|
|
124
124
|
};
|
|
125
125
|
export {
|
|
126
126
|
V as H
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const n = `## Who you are
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
You are a map assistant embedded inside a GIS application. You have no knowledge of history, science, people, events, cooking, or anything outside of this map and its data. You only know what is described in the Map Context below.
|
|
5
|
+
|
|
6
|
+
If asked anything outside of that context, you simply don't have that information — respond naturally and redirect to something you _can_ help with, using specific layer and field names from the map context.
|
|
7
|
+
|
|
8
|
+
Example of how to handle unknown topics:
|
|
9
|
+
"I don't have information on that — I only know about this map. You could ask me to list all layers in the map, or capabilities of this assistant."
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Your capabilities
|
|
14
|
+
|
|
15
|
+
You can help users with:
|
|
16
|
+
|
|
17
|
+
- Listing the layers in this map
|
|
18
|
+
- Listing the fields in a specific layer (use the tool)
|
|
19
|
+
- Suggesting specific queries using actual layer and field names
|
|
20
|
+
- Summarizing what this map contains and what users can do with it
|
|
21
|
+
- Letting users know when a map-related action isn't supported (e.g. charts, tables), and that it may be added in the future
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Input
|
|
5
26
|
|
|
6
27
|
Assigned task:
|
|
7
28
|
{assignedTask}
|
|
@@ -12,11 +33,13 @@ Latest user request:
|
|
|
12
33
|
Prior steps:
|
|
13
34
|
{priorSteps}
|
|
14
35
|
|
|
15
|
-
Use the assigned task as the primary instruction
|
|
16
|
-
Use the latest user request as supporting context
|
|
17
|
-
Use prior steps only
|
|
36
|
+
Use the assigned task as the primary instruction. The question will **not** be restated again here.
|
|
37
|
+
Use the latest user request as supporting context.
|
|
38
|
+
Use prior steps only to explain a previous result, failure, or likely next action.
|
|
39
|
+
|
|
40
|
+
---
|
|
18
41
|
|
|
19
|
-
|
|
42
|
+
## Map Context
|
|
20
43
|
|
|
21
44
|
{layerSummary}
|
|
22
45
|
|
|
@@ -24,15 +47,6 @@ Use prior steps only when needed to explain a previous result, failure, or likel
|
|
|
24
47
|
|
|
25
48
|
{agents}
|
|
26
49
|
|
|
27
|
-
### Rules
|
|
28
|
-
|
|
29
|
-
- "What layers are in this map?" → List the layer names
|
|
30
|
-
- "What fields are in this layer?" → Call the tool to list the field names for that layer
|
|
31
|
-
- "What can you do?" / "What can I ask?" → Suggest specific queries using EXACT layer and field names from the context above
|
|
32
|
-
- "Tell me about this map" → Summarize layers and capabilities
|
|
33
|
-
- "Create a chart of all wells ans their depth" → If a question is map related but not supported by available capabilities, say so. Add that support for this might be added in the future.
|
|
34
|
-
- Questions completely unrelated to maps/GIS → Politely explain you only help with the map |
|
|
35
|
-
|
|
36
50
|
### Response Guidelines
|
|
37
51
|
|
|
38
52
|
When suggesting what users can ask, be SPECIFIC using actual layer names:
|
|
@@ -46,12 +60,15 @@ For "what can I ask" responses, provide 3-5 specific example queries using field
|
|
|
46
60
|
For off-topic questions:
|
|
47
61
|
"I can only help with this map. Try asking me to filter [LayerName] by [FieldName], or zoom to a location."
|
|
48
62
|
|
|
49
|
-
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Format
|
|
50
66
|
|
|
51
67
|
- Keep responses concise
|
|
52
68
|
- Use bullet points for lists
|
|
53
69
|
- Use new lines (\\n) and appropriate formatting in your response
|
|
70
|
+
- Use actual layer and field names from the map context in any suggestions
|
|
54
71
|
`;
|
|
55
72
|
export {
|
|
56
|
-
|
|
73
|
+
n as default
|
|
57
74
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { StateGraph as
|
|
2
|
+
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";
|
|
@@ -29,7 +29,7 @@ const S = [
|
|
|
29
29
|
];
|
|
30
30
|
async function O(e, t) {
|
|
31
31
|
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(
|
|
32
|
-
(p,
|
|
32
|
+
(p, b) => `${b + 1}. layerId=${p.id} | title=${p.title ?? ""} | name=${p.name ?? ""} | score=${p.score.toFixed(2)}`
|
|
33
33
|
).join(`
|
|
34
34
|
`) : "", c = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", a = e.intent === "goToBookmark" && i.length ? `Available bookmarks:
|
|
35
35
|
${i.map((p) => `- ${p}`).join(`
|
|
@@ -126,7 +126,7 @@ async function J(e, t) {
|
|
|
126
126
|
schema: n.schema
|
|
127
127
|
})), l = s.map.bookmarks?.map((n) => n.name).filter(Boolean) ?? [], c = l.length ? `Available bookmarks:
|
|
128
128
|
${l.map((n) => `- ${n}`).join(`
|
|
129
|
-
`)}` : "", a = {
|
|
129
|
+
`)}` : "No bookmarks are available in this map.", a = {
|
|
130
130
|
tools: g.map(({ name: n, description: m, schema: v }) => `${n}: ${m}, ${JSON.stringify(v)}`).join(`
|
|
131
131
|
`),
|
|
132
132
|
bookmarks: c,
|
|
@@ -226,7 +226,7 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
226
226
|
t
|
|
227
227
|
), o;
|
|
228
228
|
}
|
|
229
|
-
}, Q = (e, t) => P(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), X = () => new
|
|
229
|
+
}, Q = (e, t) => P(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), X = () => new E(w).addNode("requireNavigationServices", Q).addNode("intentLLM", J).addNode("vectorSearchLayers", U).addNode("vectorSearchFields", K).addNode("agent", O).addNode("tools", D).addEdge($, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
|
|
230
230
|
"intentLLM",
|
|
231
231
|
(t) => t.intent === "goToLayer" || t.intent === "goToFeatures" ? "vectorSearchLayers" : "agent",
|
|
232
232
|
{
|
|
@@ -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
|
`;
|
package/dist/chunks/state.js
CHANGED
|
@@ -13,7 +13,7 @@ function u() {
|
|
|
13
13
|
function i(r) {
|
|
14
14
|
const n = [...new Set([...r].filter((t) => c.has(t)))];
|
|
15
15
|
if (n.length !== 0)
|
|
16
|
-
throw new Error(`
|
|
16
|
+
throw new Error(`custom state cannot define reserved runtime fields: ${n.join(", ")}.`);
|
|
17
17
|
}
|
|
18
18
|
function f(r) {
|
|
19
19
|
const n = Object.entries(r);
|
package/dist/chunks/utils2.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { getClosestElement as i } from "@arcgis/toolkit/dom";
|
|
3
|
-
import { g as
|
|
3
|
+
import { g as s, a as o } from "./utils3.js";
|
|
4
4
|
function c(e, t) {
|
|
5
|
-
const
|
|
6
|
-
if (
|
|
7
|
-
return
|
|
8
|
-
const n = i(e.el, "arcgis-assistant"), a =
|
|
5
|
+
const r = s(e.el, e.referenceElement);
|
|
6
|
+
if (r)
|
|
7
|
+
return r;
|
|
8
|
+
const n = i(e.el, "arcgis-assistant"), a = s(e.el, n?.referenceElement);
|
|
9
9
|
if (a)
|
|
10
10
|
return a;
|
|
11
11
|
throw new Error(`${t}: Reference element not found`);
|
|
@@ -23,16 +23,16 @@ function g(e) {
|
|
|
23
23
|
const t = i(e.el, "arcgis-assistant");
|
|
24
24
|
if (t === void 0)
|
|
25
25
|
throw new Error("arcgis-assistant-agent must be used within an arcgis-assistant element");
|
|
26
|
-
t.register({
|
|
26
|
+
return t.register({
|
|
27
27
|
agent: e.agent,
|
|
28
28
|
getContext: async () => await e.getContext?.() ?? e.context ?? {}
|
|
29
|
-
});
|
|
29
|
+
}), t;
|
|
30
30
|
}
|
|
31
31
|
function l(e) {
|
|
32
32
|
const t = o(e.el, e.referenceElement);
|
|
33
33
|
if (t)
|
|
34
34
|
return t;
|
|
35
|
-
const
|
|
35
|
+
const r = i(e.el, "arcgis-assistant"), n = s(e.el, r?.referenceElement);
|
|
36
36
|
return n || null;
|
|
37
37
|
}
|
|
38
38
|
function v(e) {
|
|
@@ -277,6 +277,13 @@ export abstract class ArcgisAssistant extends LitElement {
|
|
|
277
277
|
* ```
|
|
278
278
|
*/
|
|
279
279
|
accessor referenceElement: ArcgisMap | string | null;
|
|
280
|
+
/**
|
|
281
|
+
* When `true`, assistant text responses render after completion instead of streaming progressively.
|
|
282
|
+
*
|
|
283
|
+
* @default false
|
|
284
|
+
* @since 5.1
|
|
285
|
+
*/
|
|
286
|
+
accessor streamingDisabled: boolean;
|
|
280
287
|
/**
|
|
281
288
|
* Prompts to suggest to the end user on load. These are intended to help users understand which questions they can ask.
|
|
282
289
|
* This property should be set to establish boundaries for the end user. As all agents have limitations and LLMs can
|