@arcgis/ai-components 5.2.0-next.10 → 5.2.0-next.11
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/FunctionAgent.d.ts +2 -2
- package/dist/agent-utils/LLMAgent.d.ts +2 -2
- package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
- package/dist/agent-utils/index.d.ts +99 -0
- package/dist/agent-utils/index.js +148 -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 +30 -1
- 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/{VMXLYWUK.js → 24QNMEFG.js} +1 -1
- package/dist/cdn/{D2N2NSRQ.js → 34SG44C3.js} +1 -1
- package/dist/cdn/3JGWGKT6.js +2 -0
- package/dist/cdn/{CCY4TSBO.js → 3NBDVZ2I.js} +1 -1
- package/dist/cdn/3VOQD2MR.js +2 -0
- package/dist/cdn/{BIV2IPHH.js → 53NTYC4I.js} +1 -1
- package/dist/cdn/{MODWHY3R.js → 5CV7R5IS.js} +6 -4
- package/dist/cdn/{FL4W4VYN.js → 6ZW7Z36F.js} +16 -0
- package/dist/cdn/7CYGX4F4.js +2 -0
- package/dist/cdn/{2SJAOYZT.js → AZGGTNA3.js} +1 -1
- package/dist/cdn/{EGHBXLNG.js → B7WJFBOZ.js} +1 -1
- package/dist/cdn/BX7FSMUU.js +56 -0
- package/dist/cdn/CHPQM77M.js +181 -0
- package/dist/cdn/DHKUXLU3.js +179 -0
- package/dist/cdn/DQSEBKOX.js +2 -0
- package/dist/cdn/DXVU45KM.js +2 -0
- package/dist/cdn/{XER22VYQ.js → DZ2QWNUA.js} +1 -1
- package/dist/cdn/EBISDZ5H.js +2 -0
- package/dist/cdn/{VNQN5ZQO.js → ERL2CB2Y.js} +5 -5
- package/dist/cdn/{SWOXSJ62.js → F6QHMKF5.js} +1 -1
- package/dist/cdn/FUIGPHBH.js +2 -0
- package/dist/cdn/{CTSALWEP.js → H2CHHGGH.js} +1 -1
- package/dist/cdn/{6AWNQHCO.js → HWKDNS4K.js} +1 -1
- package/dist/cdn/IMQ4TVHF.js +16 -0
- package/dist/cdn/IOD3GDA7.js +2 -0
- package/dist/cdn/IR7PTESF.js +2 -0
- package/dist/cdn/{EEUCKMU7.js → IRZDTYO2.js} +1 -1
- package/dist/cdn/JIWK6QK6.js +2 -0
- package/dist/cdn/{EWI4V3GQ.js → JLKGS6Y5.js} +11 -11
- package/dist/cdn/K3JCH4XW.js +2 -0
- package/dist/cdn/{WIDTPVSU.js → KHXUWZHB.js} +1 -1
- package/dist/cdn/LIFK3QSD.js +2 -0
- package/dist/cdn/{JOFUPKIB.js → O3EN27N5.js} +1 -1
- package/dist/cdn/O3RFFPU3.js +6 -0
- package/dist/cdn/P7DG5T3Z.js +9 -0
- package/dist/cdn/{OIVRK7HT.js → PBO6FZN6.js} +1 -1
- package/dist/cdn/Q3ZW4FYA.js +3 -0
- package/dist/cdn/Q6LRANX6.js +2 -0
- package/dist/cdn/Q7TL5Q5N.js +2 -0
- package/dist/cdn/{KUEOKIQR.js → QCSN44H4.js} +1 -1
- package/dist/cdn/R56X6ZKR.js +161 -0
- package/dist/cdn/T43LEBBE.js +47 -0
- package/dist/cdn/TR4GFL7X.js +2 -0
- package/dist/cdn/{D3TNNRP4.js → UPEEHMSY.js} +1 -1
- package/dist/cdn/{GTLS44GI.js → WAIFKDR3.js} +1 -1
- package/dist/cdn/WNS5ZUF5.js +2 -0
- package/dist/cdn/X4XY5HIE.js +2 -0
- package/dist/cdn/XOH56EQ2.js +2 -0
- package/dist/cdn/{64PJB5NU.js → XON27U6U.js} +1 -1
- package/dist/cdn/{DOV5ZJ7M.js → YLN2BZ5J.js} +1 -1
- package/dist/cdn/{OBUZ7HBN.js → YUKR4AZW.js} +1 -1
- package/dist/cdn/{TSZPHE7L.js → Z2G7MP5L.js} +3 -3
- package/dist/cdn/ZEYIBYSF.js +66 -0
- 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 +1379 -1307
- package/dist/chunks/arcgisKnowledgeGraph.js +109 -72
- package/dist/chunks/dataExplorationGraph.js +8 -3
- package/dist/chunks/generateLayerDescriptions.js +228 -217
- package/dist/chunks/helpGraph.js +14 -11
- package/dist/chunks/index.js +11 -0
- package/dist/chunks/intent_prompt.js +16 -0
- package/dist/chunks/layerStylingGraph.js +25 -22
- package/dist/chunks/navigationGraph.js +7 -3
- package/dist/chunks/orchestrator.js +9 -8
- package/dist/chunks/toolCallResponse.js +5 -3
- package/dist/components/arcgis-assistant/customElement.js +1 -0
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/orchestrator/registry/agentRegistry.d.ts +33 -0
- package/dist/utils/index.d.ts +5 -4
- package/dist/utils/index.js +48 -47
- package/package.json +5 -4
- package/dist/cdn/462JBSEV.js +0 -422
- package/dist/cdn/ETRWZ3MS.js +0 -108
- package/dist/cdn/I6HNBTWY.js +0 -2
- package/dist/cdn/JBHNHHWO.js +0 -3
- package/dist/cdn/LKRAPK4A.js +0 -165
- package/dist/cdn/RVOAPUBN.js +0 -2
- package/dist/cdn/VAZNJSKA.js +0 -16
package/dist/chunks/helpGraph.js
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
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 c } from "./adapter.js";
|
|
4
4
|
import "@arcgis/core/identity/IdentityManager.js";
|
|
5
5
|
import "@arcgis/core/portal/Portal.js";
|
|
6
|
-
import {
|
|
6
|
+
import { h as S } from "./generateLayerDescriptions.js";
|
|
7
7
|
import "@langchain/core/messages";
|
|
8
8
|
import "@langchain/core/callbacks/dispatch/web";
|
|
9
9
|
import "@langchain/openai";
|
|
10
|
+
import "@arcgis/core/config.js";
|
|
10
11
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
11
12
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
12
13
|
import "@arcgis/core/request.js";
|
|
13
14
|
import { ToolNode as E } from "@langchain/langgraph/prebuilt";
|
|
15
|
+
import { s as m } from "./index.js";
|
|
14
16
|
import "@langchain/core/prompts";
|
|
15
|
-
const
|
|
17
|
+
const u = [h], v = (e) => {
|
|
16
18
|
if (!e || e.size === 0)
|
|
17
19
|
return "No layers available in this map.";
|
|
18
20
|
const t = Array.from(e.values()).map(({ layerItem: r, fieldRegistry: s }, l) => {
|
|
@@ -36,7 +38,8 @@ async function _(e, t) {
|
|
|
36
38
|
const a = await S({
|
|
37
39
|
promptText: r,
|
|
38
40
|
modelTier: "fast",
|
|
39
|
-
|
|
41
|
+
config: t,
|
|
42
|
+
tools: u,
|
|
40
43
|
inputVariables: {
|
|
41
44
|
layerSummary: v(s),
|
|
42
45
|
agents: T(l),
|
|
@@ -67,14 +70,14 @@ async function _(e, t) {
|
|
|
67
70
|
}
|
|
68
71
|
const C = (e, t) => x(["agentRegistry"], "Help Agent")(e, t);
|
|
69
72
|
async function H(e, t) {
|
|
70
|
-
const r = new E(
|
|
73
|
+
const r = new E(u, { handleToolErrors: !1 });
|
|
71
74
|
try {
|
|
72
75
|
const s = e.helpInternalState.toolCallMessage;
|
|
73
76
|
if (!s)
|
|
74
77
|
throw new Error("helpToolCalling: missing helpInternalState.toolCallMessage");
|
|
75
78
|
const a = (await r.invoke({ messages: [s] }, t)).messages.map((o) => o.text).join(`
|
|
76
79
|
`);
|
|
77
|
-
return await
|
|
80
|
+
return await m({ text: `Finished executing help tool: ${a}` }, t), {
|
|
78
81
|
...e,
|
|
79
82
|
outputMessage: a,
|
|
80
83
|
status: "success",
|
|
@@ -86,7 +89,7 @@ async function H(e, t) {
|
|
|
86
89
|
};
|
|
87
90
|
} catch (s) {
|
|
88
91
|
const l = s instanceof Error ? s.message : String(s);
|
|
89
|
-
return await
|
|
92
|
+
return await m({ text: `Help tool execution failed: ${l}` }, t), {
|
|
90
93
|
...e,
|
|
91
94
|
outputMessage: `Help tool execution failed: ${l}`,
|
|
92
95
|
status: "failed",
|
|
@@ -98,7 +101,7 @@ async function H(e, t) {
|
|
|
98
101
|
};
|
|
99
102
|
}
|
|
100
103
|
}
|
|
101
|
-
const b = () => new d(
|
|
104
|
+
const b = () => new d(c).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.
|
|
102
105
|
|
|
103
106
|
_Example: “Tell me about this map”_
|
|
104
107
|
_Example: “List all layers in this map”_
|
|
@@ -111,13 +114,13 @@ const b = () => new d(u).addNode("requireHelpServices", C).addNode("agent", _).a
|
|
|
111
114
|
|
|
112
115
|
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.
|
|
113
116
|
_Example: "Create a chart"_
|
|
114
|
-
_Example: "Create a table"_`,
|
|
117
|
+
_Example: "Create a table"_`, G = {
|
|
115
118
|
id: "help",
|
|
116
119
|
name: "Help Agent",
|
|
117
120
|
description: M,
|
|
118
121
|
createGraph: b,
|
|
119
|
-
workspace:
|
|
122
|
+
workspace: c
|
|
120
123
|
};
|
|
121
124
|
export {
|
|
122
|
-
|
|
125
|
+
G as H
|
|
123
126
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { dispatchCustomEvent as e } from "@langchain/core/callbacks/dispatch/web";
|
|
3
|
+
const n = async (s, a) => {
|
|
4
|
+
await e("trace_message", s, a);
|
|
5
|
+
}, o = async (s, a) => {
|
|
6
|
+
await e("graph_ux_suggestion", s, a);
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
o as a,
|
|
10
|
+
n as s
|
|
11
|
+
};
|
|
@@ -97,6 +97,20 @@ Do not reinterpret the request into a different form.
|
|
|
97
97
|
|
|
98
98
|
---
|
|
99
99
|
|
|
100
|
+
## Follow-up Reference Resolution
|
|
101
|
+
|
|
102
|
+
If the latest user request refers to prior results or prior context using a referential phrase such as "these", "those", "them", "that set", or "the previous results", then the request depends on earlier context.
|
|
103
|
+
|
|
104
|
+
This also applies to equivalent referential wording in other languages.
|
|
105
|
+
|
|
106
|
+
Resolve the reference using the most recent relevant chat history or successful prior step.
|
|
107
|
+
|
|
108
|
+
In this case, the \`assignedTask\` should be standalone and should preserve the referenced prior constraints while adding only the new constraint or question from the latest user request.
|
|
109
|
+
|
|
110
|
+
Do not leave ambiguous references like "these", "those", or "them" in \`assignedTask\` when they can be resolved from context.
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
100
114
|
## Assigned Task Guidelines (IMPORTANT)
|
|
101
115
|
|
|
102
116
|
- The \`assignedTask\` must match the user’s request exactly in meaning
|
|
@@ -106,6 +120,8 @@ Do not reinterpret the request into a different form.
|
|
|
106
120
|
|
|
107
121
|
- Keep the task short, specific, and directly executable
|
|
108
122
|
- Keep wording close to the user’s request with minimal transformation
|
|
123
|
+
- When resolving follow-up references, only replace the ambiguous reference with the resolved prior context; keep the rest of the user’s wording as close as possible.
|
|
124
|
+
|
|
109
125
|
- Use only information explicitly present in the user request or provided context
|
|
110
126
|
|
|
111
127
|
- The \`assignedTask\` may represent only part of the user’s request when multiple steps are necessary
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { NodeInterrupt as E, StateGraph as L, START as w, END as
|
|
2
|
+
import { NodeInterrupt as E, StateGraph as L, START as w, END as m } from "@langchain/langgraph/web";
|
|
3
3
|
import "@arcgis/core/identity/IdentityManager.js";
|
|
4
4
|
import "@arcgis/core/portal/Portal.js";
|
|
5
|
-
import {
|
|
5
|
+
import { h as I } from "./generateLayerDescriptions.js";
|
|
6
6
|
import "@langchain/core/messages";
|
|
7
|
+
import { s as i } from "./index.js";
|
|
7
8
|
import "@langchain/openai";
|
|
9
|
+
import "@arcgis/core/config.js";
|
|
8
10
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
9
11
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
10
12
|
import "@arcgis/core/request.js";
|
|
11
13
|
import "@langchain/core/prompts";
|
|
12
|
-
import { f as
|
|
13
|
-
import { h as
|
|
14
|
-
import { ToolNode as
|
|
15
|
-
const
|
|
14
|
+
import { f as g, z as v, A as T, B as R, C as F, D as C, E as A, F as $, I as N, J as b, K as q, L as M, g as _, r as k, M as S } from "./adapter.js";
|
|
15
|
+
import { h as V } from "./toolCallResponse.js";
|
|
16
|
+
import { ToolNode as j } from "@langchain/langgraph/prebuilt";
|
|
17
|
+
const h = 0.7, z = 10, D = async (t, e) => {
|
|
16
18
|
try {
|
|
17
19
|
await i({ text: "Similarity search to find fields" }, e);
|
|
18
|
-
const r =
|
|
20
|
+
const r = g(e, "fieldSearch"), a = g(e, "layersAndFieldsRegistry"), o = g(e, "embeddingCache"), n = await r.searchFields({
|
|
19
21
|
text: t.agentExecutionContext.assignedTask,
|
|
20
22
|
layerIds: t.vectorSearchLayerIds,
|
|
21
|
-
minScore:
|
|
23
|
+
minScore: h,
|
|
22
24
|
topResults: z,
|
|
23
25
|
embeddingCache: o
|
|
24
|
-
}), c = n.map(({ layerId: d, results:
|
|
25
|
-
const y =
|
|
26
|
+
}), c = n.map(({ layerId: d, results: p }) => {
|
|
27
|
+
const y = p.map((s) => ` - ${s.name} (${s.score.toFixed(2)})`).join(`
|
|
26
28
|
`);
|
|
27
29
|
return `${a.get(d)?.layerItem.name ?? d}:
|
|
28
30
|
${y}`;
|
|
@@ -30,7 +32,7 @@ ${y}`;
|
|
|
30
32
|
`);
|
|
31
33
|
let l;
|
|
32
34
|
return n.length > 0 ? l = `Vector search completed. Matching layers and fields with scores:
|
|
33
|
-
${c}` : l = `No vector search results found for score over ${
|
|
35
|
+
${c}` : l = `No vector search results found for score over ${h}.`, await i({ text: l }, e), {
|
|
34
36
|
...t,
|
|
35
37
|
vectorSearchFieldResults: n
|
|
36
38
|
};
|
|
@@ -46,10 +48,10 @@ ${c}` : l = `No vector search results found for score over ${m}.`, await i({ tex
|
|
|
46
48
|
{ text: `Similarity search to find layers: ${t.agentExecutionContext.assignedTask}` },
|
|
47
49
|
e
|
|
48
50
|
);
|
|
49
|
-
const r =
|
|
51
|
+
const r = g(e, "layerSearch"), a = g(e, "layersAndFieldsRegistry"), o = await r.searchLayers({
|
|
50
52
|
text: t.agentExecutionContext.assignedTask,
|
|
51
53
|
minScore: P
|
|
52
|
-
}), n = o.map((d) => d.id), c = o.map(({ id: d, score:
|
|
54
|
+
}), n = o.map((d) => d.id), c = o.map(({ id: d, score: p }) => `${a.get(d)?.layerItem.name ?? d} (${p.toFixed(2)})`).join(`
|
|
53
55
|
`);
|
|
54
56
|
let l;
|
|
55
57
|
return n.length > 0 ? l = `Vector search completed. Matching layers with scores:
|
|
@@ -91,11 +93,12 @@ ${c}` : l = "Vector search completed. No matching layers found.", await i({ text
|
|
|
91
93
|
}, o = await I({
|
|
92
94
|
promptText: r,
|
|
93
95
|
modelTier: "advanced",
|
|
96
|
+
config: e,
|
|
94
97
|
messages: x(t.agentExecutionContext.messages),
|
|
95
98
|
inputVariables: a,
|
|
96
99
|
tools: f
|
|
97
100
|
});
|
|
98
|
-
return await
|
|
101
|
+
return await V(o, e), {
|
|
99
102
|
...t,
|
|
100
103
|
agentExecutionContext: {
|
|
101
104
|
...t.agentExecutionContext,
|
|
@@ -104,7 +107,7 @@ ${c}` : l = "Vector search completed. No matching layers found.", await i({ text
|
|
|
104
107
|
};
|
|
105
108
|
};
|
|
106
109
|
async function B(t, e) {
|
|
107
|
-
const a = await new
|
|
110
|
+
const a = await new j(f, { handleToolErrors: !1 }).invoke(
|
|
108
111
|
{
|
|
109
112
|
messages: x(t.agentExecutionContext.messages)
|
|
110
113
|
},
|
|
@@ -129,18 +132,18 @@ const U = async (t, e) => (await i({ text: "Exiting Layer Styling agent" }, e),
|
|
|
129
132
|
s.description && `Description: ${s.description}`
|
|
130
133
|
].filter(Boolean).join(" | ") : y;
|
|
131
134
|
};
|
|
132
|
-
const { layerId: n, results: c } = a, l =
|
|
135
|
+
const { layerId: n, results: c } = a, l = g(e, "layersAndFieldsRegistry"), d = l.get(n)?.fieldRegistry;
|
|
133
136
|
if (!d)
|
|
134
137
|
continue;
|
|
135
|
-
let
|
|
136
|
-
|
|
138
|
+
let p = r.find((y) => y.layerId === n);
|
|
139
|
+
p || (p = {
|
|
137
140
|
layerId: n,
|
|
138
141
|
layerSummary: o(n),
|
|
139
142
|
fieldInfos: []
|
|
140
|
-
}, r.push(
|
|
143
|
+
}, r.push(p));
|
|
141
144
|
for (const y of c) {
|
|
142
145
|
const s = d.get(y.name);
|
|
143
|
-
s &&
|
|
146
|
+
s && p.fieldInfos.push(s);
|
|
144
147
|
}
|
|
145
148
|
}
|
|
146
149
|
return await i({ text: "Populated layerFieldInfo" }, e), { ...t, layerFieldInfo: r };
|
|
@@ -167,13 +170,13 @@ const U = async (t, e) => (await i({ text: "Exiting Layer Styling agent" }, e),
|
|
|
167
170
|
...t,
|
|
168
171
|
selectedLayerId: o ?? t.vectorSearchLayerIds[0]
|
|
169
172
|
};
|
|
170
|
-
}, O = (t, e) =>
|
|
173
|
+
}, O = (t, e) => k(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(t, e), Q = () => new L(S).addNode("requireLayerStylingServices", O).addNode("vectorSearchLayers", H).addNode("layerSelectionHITL", K).addNode("vectorSearchFields", D).addNode("populateLayerFieldInfo", J).addNode("agent", G).addNode("tools", B).addNode("earlyExit", U).addEdge(w, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
|
|
171
174
|
"layerSelectionHITL",
|
|
172
175
|
(e) => e.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
|
|
173
176
|
).addConditionalEdges(
|
|
174
177
|
"vectorSearchFields",
|
|
175
178
|
(e) => e.vectorSearchFieldResults.length ? "populateLayerFieldInfo" : "earlyExit"
|
|
176
|
-
).addEdge("populateLayerFieldInfo", "agent").addEdge("agent", "tools").addEdge("tools",
|
|
179
|
+
).addEdge("populateLayerFieldInfo", "agent").addEdge("agent", "tools").addEdge("tools", m).addEdge("earlyExit", m), W = 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.
|
|
177
180
|
_Example: “Color points by sales amount”_
|
|
178
181
|
_Example: “Show population density with a color gradient”_
|
|
179
182
|
_Example: “Create a relationship map between height and depth”_
|
|
@@ -3,13 +3,15 @@ import { StateGraph as b, 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 { h as V, i as z } from "./generateLayerDescriptions.js";
|
|
7
7
|
import "@langchain/core/messages";
|
|
8
8
|
import "@langchain/core/callbacks/dispatch/web";
|
|
9
9
|
import "@langchain/openai";
|
|
10
|
+
import "@arcgis/core/config.js";
|
|
10
11
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
11
12
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
12
13
|
import "@arcgis/core/request.js";
|
|
14
|
+
import { s as h } from "./index.js";
|
|
13
15
|
import "@langchain/core/prompts";
|
|
14
16
|
import { ToolNode as G } from "@langchain/langgraph/prebuilt";
|
|
15
17
|
import x from "zod";
|
|
@@ -44,6 +46,7 @@ ${c}` : "", y = {
|
|
|
44
46
|
}, n = await V({
|
|
45
47
|
promptText: o,
|
|
46
48
|
modelTier: "fast",
|
|
49
|
+
config: t,
|
|
47
50
|
inputVariables: y,
|
|
48
51
|
tools: S
|
|
49
52
|
}), m = (n.tool_calls?.length ?? 0) > 0, v = typeof n.text == "string" ? n.text.trim() : "", N = v.length > 0;
|
|
@@ -133,6 +136,7 @@ ${l.map((n) => `- ${n}`).join(`
|
|
|
133
136
|
intent: x.string()
|
|
134
137
|
}), d = await z({
|
|
135
138
|
promptText: o,
|
|
139
|
+
config: t,
|
|
136
140
|
inputVariables: a,
|
|
137
141
|
schema: r,
|
|
138
142
|
modelTier: "fast"
|
|
@@ -254,7 +258,7 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
254
258
|
_Example: “Center the map on San Francisco at scale 50000”_
|
|
255
259
|
_Example: “Zoom to the features in the schools layer where city = 'Austin'”_
|
|
256
260
|
_Example: “Go to the Downtown bookmark”_
|
|
257
|
-
_Example: “Where is Mount Rainier?”_`,
|
|
261
|
+
_Example: “Where is Mount Rainier?”_`, ye = {
|
|
258
262
|
id: "navigation",
|
|
259
263
|
name: "Navigation Agent",
|
|
260
264
|
description: Y,
|
|
@@ -262,5 +266,5 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
262
266
|
workspace: w
|
|
263
267
|
};
|
|
264
268
|
export {
|
|
265
|
-
|
|
269
|
+
ye as N
|
|
266
270
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import R from "@arcgis/core/identity/IdentityManager.js";
|
|
3
3
|
import C from "@arcgis/core/portal/Portal.js";
|
|
4
|
-
import {
|
|
4
|
+
import { n as I, o as v, D as k, p as A, q as M, W as F } from "./generateLayerDescriptions.js";
|
|
5
5
|
import { isGraphInterrupt as D, StateGraph as L, START as W, END as $, MemorySaver as j } from "@langchain/langgraph/web";
|
|
6
6
|
import { HumanMessage as q, AIMessage as H } from "@langchain/core/messages";
|
|
7
|
+
import { s as l } from "./index.js";
|
|
7
8
|
import * as P from "@arcgis/core/core/reactiveUtils.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
const
|
|
9
|
+
import U from "@arcgis/core/layers/FeatureLayer.js";
|
|
10
|
+
import O from "@arcgis/core/request.js";
|
|
11
|
+
const T = async (t) => {
|
|
11
12
|
const e = await N(), r = await I("default"), s = C.getDefault(), a = (await R.getCredential(`${s.url}/sharing`)).token, i = {
|
|
12
13
|
type: "generateEmbeddings",
|
|
13
14
|
webmapEmbeddings: t,
|
|
@@ -330,7 +331,7 @@ const ie = (t) => {
|
|
|
330
331
|
}, oe = (t, e) => {
|
|
331
332
|
const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
|
|
332
333
|
if (e.allLayers.forEach((n) => {
|
|
333
|
-
n instanceof
|
|
334
|
+
n instanceof U && s.set(n.id, n);
|
|
334
335
|
}), t.length !== s.size)
|
|
335
336
|
throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");
|
|
336
337
|
for (const n of t) {
|
|
@@ -371,7 +372,7 @@ const ie = (t) => {
|
|
|
371
372
|
return r;
|
|
372
373
|
}, ce = async (t) => {
|
|
373
374
|
try {
|
|
374
|
-
return (await
|
|
375
|
+
return (await O(t, {
|
|
375
376
|
responseType: "json"
|
|
376
377
|
})).data;
|
|
377
378
|
} catch (e) {
|
|
@@ -405,7 +406,7 @@ class x {
|
|
|
405
406
|
s.layers,
|
|
406
407
|
e.view.map
|
|
407
408
|
);
|
|
408
|
-
r.layersAndFieldsRegistry = n, r.embeddingsWorker = await
|
|
409
|
+
r.layersAndFieldsRegistry = n, r.embeddingsWorker = await T(s);
|
|
409
410
|
}
|
|
410
411
|
return e.agents?.forEach((s) => {
|
|
411
412
|
r.agentRegistry.register(s);
|
|
@@ -429,7 +430,7 @@ class x {
|
|
|
429
430
|
throw new Error("Orchestrator has no registered agents.");
|
|
430
431
|
if (++this.streamEpoch, !e.trim())
|
|
431
432
|
return;
|
|
432
|
-
const r =
|
|
433
|
+
const r = crypto.randomUUID();
|
|
433
434
|
this.activeRunId = r, this.activeAbortController = new AbortController(), this.graph || (this.graph = Y().compile({ checkpointer: new j() }));
|
|
434
435
|
const s = this.embeddingsWorker ? ne({ worker: this.embeddingsWorker }) : void 0, n = this.embeddingsWorker ? ae({ worker: this.embeddingsWorker }) : void 0, a = /* @__PURE__ */ new Map(), c = {
|
|
435
436
|
version: "v2",
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
import "@arcgis/core/identity/IdentityManager.js";
|
|
3
3
|
import "@arcgis/core/portal/Portal.js";
|
|
4
4
|
import "@langchain/langgraph/web";
|
|
5
|
-
import
|
|
5
|
+
import "./generateLayerDescriptions.js";
|
|
6
6
|
import "@langchain/core/messages";
|
|
7
|
+
import { s as r } from "./index.js";
|
|
7
8
|
import "@langchain/openai";
|
|
9
|
+
import "@arcgis/core/config.js";
|
|
8
10
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
9
11
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
10
12
|
import "@arcgis/core/request.js";
|
|
11
13
|
import "@langchain/core/prompts";
|
|
12
|
-
const
|
|
14
|
+
const y = async (t, o) => {
|
|
13
15
|
const a = t.tool_calls ?? [];
|
|
14
16
|
if (a.length === 0) {
|
|
15
17
|
await r({ text: `LLM did not request any tool calls: ${String(t?.content)}` }, o);
|
|
@@ -25,5 +27,5 @@ const u = async (t, o) => {
|
|
|
25
27
|
);
|
|
26
28
|
};
|
|
27
29
|
export {
|
|
28
|
-
|
|
30
|
+
y as h
|
|
29
31
|
};
|
|
@@ -13,6 +13,7 @@ import "@langchain/core/callbacks/dispatch/web";
|
|
|
13
13
|
import "@langchain/core/prompts";
|
|
14
14
|
import "@langchain/openai";
|
|
15
15
|
import T from "@arcgis/core/identity/IdentityManager.js";
|
|
16
|
+
import "@arcgis/core/config.js";
|
|
16
17
|
import "@langchain/core/messages";
|
|
17
18
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
18
19
|
import "../../chunks/generateLayerDescriptions.js";
|
|
@@ -9,6 +9,7 @@ import "../../chunks/generateLayerDescriptions.js";
|
|
|
9
9
|
import "@langchain/core/messages";
|
|
10
10
|
import "@langchain/core/callbacks/dispatch/web";
|
|
11
11
|
import "@langchain/openai";
|
|
12
|
+
import "@arcgis/core/config.js";
|
|
12
13
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
13
14
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
14
15
|
import "@arcgis/core/request.js";
|
|
@@ -9,6 +9,7 @@ import "../../chunks/generateLayerDescriptions.js";
|
|
|
9
9
|
import "@langchain/core/messages";
|
|
10
10
|
import "@langchain/core/callbacks/dispatch/web";
|
|
11
11
|
import "@langchain/openai";
|
|
12
|
+
import "@arcgis/core/config.js";
|
|
12
13
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
13
14
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
14
15
|
import "@arcgis/core/request.js";
|
|
@@ -106,12 +106,12 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
106
106
|
*/
|
|
107
107
|
export abstract class ArcgisAssistantKnowledgeAgent extends LitElement {
|
|
108
108
|
/**
|
|
109
|
-
*
|
|
110
|
-
* a
|
|
109
|
+
* Optional context for the knowledge agent. If the agent does not have a view or kg service url provided via reference element or serviceUrl property
|
|
110
|
+
* a knowledge graph can be provided directly via context to enable Knowledge Service related capabilties.
|
|
111
111
|
*
|
|
112
112
|
* Depending on the context provided, different capabilities will be available.
|
|
113
113
|
*/
|
|
114
|
-
accessor context:
|
|
114
|
+
accessor context: ArcgisKnowledgeAssistantContext | undefined;
|
|
115
115
|
/**
|
|
116
116
|
* The reference element to the map that provides context for the navigation agent. Currently,
|
|
117
117
|
* this is only scoped to `arcgis-map` elements. This shows the navigation agent which map on which to
|
|
@@ -149,10 +149,10 @@ export abstract class ArcgisAssistantKnowledgeAgent extends LitElement {
|
|
|
149
149
|
* Context required by the Knowledge Link Chart agent.
|
|
150
150
|
* Supplied by the application via an agent `getContext()` provider.
|
|
151
151
|
*/
|
|
152
|
-
export type
|
|
153
|
-
knowledgeGraph: KnowledgeGraph;
|
|
154
|
-
view?: never;
|
|
155
|
-
} | {
|
|
152
|
+
export type ArcgisKnowledgeAssistantContext = {
|
|
156
153
|
view: LinkChartView | MapView;
|
|
157
154
|
knowledgeGraph?: never;
|
|
155
|
+
} | {
|
|
156
|
+
knowledgeGraph: KnowledgeGraph;
|
|
157
|
+
view?: never;
|
|
158
158
|
};
|
|
@@ -9,6 +9,7 @@ import "../../chunks/generateLayerDescriptions.js";
|
|
|
9
9
|
import "@langchain/core/messages";
|
|
10
10
|
import "@langchain/core/callbacks/dispatch/web";
|
|
11
11
|
import "@langchain/openai";
|
|
12
|
+
import "@arcgis/core/config.js";
|
|
12
13
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
13
14
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
14
15
|
import "@arcgis/core/request.js";
|
|
@@ -9,6 +9,7 @@ import "../../chunks/generateLayerDescriptions.js";
|
|
|
9
9
|
import "@langchain/core/messages";
|
|
10
10
|
import "@langchain/core/callbacks/dispatch/web";
|
|
11
11
|
import "@langchain/openai";
|
|
12
|
+
import "@arcgis/core/config.js";
|
|
12
13
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
13
14
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
14
15
|
import "@arcgis/core/request.js";
|
|
@@ -10,6 +10,7 @@ import "../../chunks/generateLayerDescriptions.js";
|
|
|
10
10
|
import "@langchain/core/messages";
|
|
11
11
|
import "@langchain/core/callbacks/dispatch/web";
|
|
12
12
|
import "@langchain/openai";
|
|
13
|
+
import "@arcgis/core/config.js";
|
|
13
14
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
14
15
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
15
16
|
import "@arcgis/core/request.js";
|