@arcgis/ai-components 5.2.0-next.12 → 5.2.0-next.14
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/LLMAgent.js +1 -0
- package/dist/cdn/{5CV7R5IS.js → 22IT5TDB.js} +2 -2
- package/dist/cdn/{EBISDZ5H.js → 4UDYY3HL.js} +1 -1
- package/dist/cdn/7PANDHIL.js +16 -0
- package/dist/cdn/ADYIXCSG.js +2 -0
- package/dist/cdn/CAECQD75.js +2 -0
- package/dist/cdn/{34SG44C3.js → CE6VDP2D.js} +1 -1
- package/dist/cdn/CI3QSFPS.js +2 -0
- package/dist/cdn/DEAYZ3MK.js +2 -0
- package/dist/cdn/{YLN2BZ5J.js → E2HENO3T.js} +1 -1
- package/dist/cdn/FWU6DFIB.js +2 -0
- package/dist/cdn/GBYLKQIL.js +2 -0
- package/dist/cdn/GPYYAQVI.js +2 -0
- package/dist/cdn/{ERL2CB2Y.js → I2Y67HBL.js} +5 -5
- package/dist/cdn/JG2BIENI.js +3 -0
- package/dist/cdn/JN744CAW.js +2 -0
- package/dist/cdn/K475UT3E.js +2 -0
- package/dist/cdn/{JLKGS6Y5.js → L4XF4H6V.js} +1 -1
- package/dist/cdn/M3SWPT3M.js +2 -0
- package/dist/cdn/MAV3DW27.js +4 -0
- package/dist/cdn/PB2ODJC7.js +2 -0
- package/dist/cdn/{QCSN44H4.js → QSA4T3BU.js} +1 -1
- package/dist/cdn/{R56X6ZKR.js → QYR3NSF2.js} +3 -3
- package/dist/cdn/RMLXVQZ5.js +2 -0
- package/dist/cdn/{T43LEBBE.js → S75VFYR4.js} +18 -18
- package/dist/cdn/SBHLUL3Q.js +2 -0
- package/dist/cdn/{X2ZDYHCG.js → TNMXWUXU.js} +9 -4
- package/dist/cdn/WH6QQK6N.js +2 -0
- package/dist/cdn/XBW4MWQR.js +2 -0
- package/dist/cdn/{Z2G7MP5L.js → XU6NCSE2.js} +1 -1
- package/dist/cdn/Z7UWJ4AI.js +3 -0
- package/dist/cdn/ZOSUDIJH.js +2 -0
- package/dist/cdn/ZPLFFLPF.js +2 -0
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +170 -169
- package/dist/chunks/arcgisKnowledgeGraph.js +8 -7
- package/dist/chunks/dataExplorationGraph.js +88 -76
- package/dist/chunks/data_explore_query_prompt.js +9 -4
- package/dist/chunks/generateLayerDescriptions.js +161 -159
- package/dist/chunks/helpGraph.js +3 -2
- package/dist/chunks/layerStylingGraph.js +1 -0
- package/dist/chunks/navigationGraph.js +3 -2
- package/dist/chunks/orchestrator.js +108 -107
- package/dist/chunks/toolCallResponse.js +10 -9
- package/dist/components/arcgis-assistant/customElement.js +136 -124
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +3 -2
- package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +4 -3
- 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/package.json +5 -5
- package/dist/cdn/24QNMEFG.js +0 -2
- package/dist/cdn/3NBDVZ2I.js +0 -2
- package/dist/cdn/53NTYC4I.js +0 -2
- package/dist/cdn/AZGGTNA3.js +0 -2
- package/dist/cdn/B7WJFBOZ.js +0 -2
- package/dist/cdn/DZ2QWNUA.js +0 -3
- package/dist/cdn/F6QHMKF5.js +0 -2
- package/dist/cdn/H2CHHGGH.js +0 -2
- package/dist/cdn/HWKDNS4K.js +0 -4
- package/dist/cdn/IMQ4TVHF.js +0 -16
- package/dist/cdn/IRZDTYO2.js +0 -2
- package/dist/cdn/KHXUWZHB.js +0 -2
- package/dist/cdn/LIFK3QSD.js +0 -2
- package/dist/cdn/O3EN27N5.js +0 -2
- package/dist/cdn/PBO6FZN6.js +0 -2
- package/dist/cdn/Q3ZW4FYA.js +0 -3
- package/dist/cdn/UPEEHMSY.js +0 -2
- package/dist/cdn/WAIFKDR3.js +0 -2
- package/dist/cdn/XON27U6U.js +0 -2
- package/dist/cdn/YUKR4AZW.js +0 -2
|
@@ -1,44 +1,45 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { Annotation as
|
|
3
|
-
import
|
|
2
|
+
import { Annotation as m } from "@langchain/langgraph/web";
|
|
3
|
+
import u, { z as r } from "zod";
|
|
4
4
|
import { ChatPromptTemplate as D, SystemMessagePromptTemplate as K } from "@langchain/core/prompts";
|
|
5
5
|
import { s as f } from "./index.js";
|
|
6
6
|
import { AIMessage as B, isAIMessage as W, isToolMessage as X } from "@langchain/core/messages";
|
|
7
|
-
import { createAgent as
|
|
7
|
+
import { createAgent as G, summarizationMiddleware as H, modelCallLimitMiddleware as J } from "langchain";
|
|
8
8
|
import { ChatOpenAI as Q, OpenAIEmbeddings as Y } from "@langchain/openai";
|
|
9
|
-
import
|
|
9
|
+
import q from "@arcgis/core/portal/Portal.js";
|
|
10
10
|
import Z from "@arcgis/core/identity/IdentityManager.js";
|
|
11
|
-
import ee from "@arcgis/
|
|
12
|
-
|
|
11
|
+
import { generateGuid as ee } from "@arcgis/toolkit/string";
|
|
12
|
+
import te from "@arcgis/core/config.js";
|
|
13
|
+
const F = {
|
|
13
14
|
advanced: "gpt-5.2",
|
|
14
15
|
default: "gpt-5-mini",
|
|
15
16
|
fast: "gpt-5.4-nano"
|
|
16
|
-
},
|
|
17
|
+
}, I = {
|
|
17
18
|
default: "text-embedding-ada-002"
|
|
18
|
-
},
|
|
19
|
-
let
|
|
20
|
-
const
|
|
21
|
-
const t =
|
|
19
|
+
}, T = /* @__PURE__ */ new Map();
|
|
20
|
+
let M = null;
|
|
21
|
+
const ne = () => {
|
|
22
|
+
const t = q.getDefault().helperServices;
|
|
22
23
|
if (!t?.aiModels?.url)
|
|
23
24
|
throw new Error("AI Models Service URL is not defined in the portal's helper services.");
|
|
24
25
|
return t.aiModels.url;
|
|
25
26
|
}, U = async (e) => {
|
|
26
|
-
const t =
|
|
27
|
-
|
|
27
|
+
const t = ne();
|
|
28
|
+
T.size === 0 && (M || (M = (async () => {
|
|
28
29
|
try {
|
|
29
30
|
const n = await fetch(`${t}/models`);
|
|
30
31
|
if (!n.ok)
|
|
31
32
|
throw new Error("Failed to fetch AI service discovery data.");
|
|
32
|
-
(await n.json()).models.forEach((o) =>
|
|
33
|
+
(await n.json()).models.forEach((o) => T.set(o.name, o));
|
|
33
34
|
} catch (n) {
|
|
34
|
-
throw
|
|
35
|
+
throw M = null, n;
|
|
35
36
|
}
|
|
36
|
-
})()), await
|
|
37
|
-
const s =
|
|
37
|
+
})()), await M);
|
|
38
|
+
const s = T.get(e);
|
|
38
39
|
if (!s)
|
|
39
40
|
throw new Error(`Model '${e}' is not available in the discovery service.`);
|
|
40
41
|
return s.endpoint;
|
|
41
|
-
},
|
|
42
|
+
}, se = async (e = "default") => await U(F[e]), ie = async (e = "default") => await U(I[e]), h = (e, t) => t, P = (e, t) => ({
|
|
42
43
|
...e,
|
|
43
44
|
...t
|
|
44
45
|
}), _ = (e = "", t) => {
|
|
@@ -62,66 +63,66 @@ ${s}`;
|
|
|
62
63
|
messages: [],
|
|
63
64
|
priorSteps: [],
|
|
64
65
|
sharedState: {}
|
|
65
|
-
}),
|
|
66
|
-
agentExecutionContext:
|
|
66
|
+
}), oe = () => ({
|
|
67
|
+
agentExecutionContext: m({
|
|
67
68
|
reducer: P,
|
|
68
69
|
default: j
|
|
69
70
|
}),
|
|
70
|
-
outputMessage:
|
|
71
|
+
outputMessage: m({
|
|
71
72
|
reducer: _,
|
|
72
73
|
default: () => ""
|
|
73
74
|
}),
|
|
74
|
-
summary:
|
|
75
|
+
summary: m({
|
|
75
76
|
reducer: h,
|
|
76
77
|
default: () => ""
|
|
77
78
|
}),
|
|
78
|
-
status:
|
|
79
|
+
status: m({
|
|
79
80
|
reducer: h
|
|
80
81
|
})
|
|
81
|
-
}),
|
|
82
|
-
...
|
|
83
|
-
sharedStatePatch:
|
|
82
|
+
}), $e = () => ({
|
|
83
|
+
...oe(),
|
|
84
|
+
sharedStatePatch: m({
|
|
84
85
|
reducer: h
|
|
85
86
|
})
|
|
86
|
-
}),
|
|
87
|
-
agentExecutionContext:
|
|
87
|
+
}), Ne = m.Root({
|
|
88
|
+
agentExecutionContext: m({
|
|
88
89
|
default: j,
|
|
89
90
|
reducer: P
|
|
90
91
|
}),
|
|
91
|
-
currentIntent:
|
|
92
|
+
currentIntent: m({
|
|
92
93
|
default: () => "none",
|
|
93
94
|
reducer: h
|
|
94
95
|
}),
|
|
95
|
-
lastExecutedAgent:
|
|
96
|
+
lastExecutedAgent: m({
|
|
96
97
|
default: () => "",
|
|
97
98
|
reducer: h
|
|
98
99
|
}),
|
|
99
|
-
requiresFollowUp:
|
|
100
|
+
requiresFollowUp: m({
|
|
100
101
|
default: () => !0,
|
|
101
102
|
reducer: h
|
|
102
103
|
}),
|
|
103
|
-
stepCount:
|
|
104
|
+
stepCount: m({
|
|
104
105
|
default: () => 0,
|
|
105
106
|
reducer: (e, t) => t ?? e + 1
|
|
106
107
|
}),
|
|
107
|
-
finalOutputMessage:
|
|
108
|
+
finalOutputMessage: m({
|
|
108
109
|
default: () => "",
|
|
109
110
|
reducer: _
|
|
110
111
|
})
|
|
111
|
-
}),
|
|
112
|
+
}), re = (e) => {
|
|
112
113
|
if (!e || typeof e != "object" || !("services" in e))
|
|
113
114
|
return !1;
|
|
114
115
|
const t = e.services;
|
|
115
116
|
return !!t && typeof t == "object" && "agentRegistry" in t;
|
|
116
|
-
},
|
|
117
|
+
}, ae = (e) => {
|
|
117
118
|
const t = e?.configurable;
|
|
118
|
-
return
|
|
119
|
-
},
|
|
119
|
+
return re(t) ? t : void 0;
|
|
120
|
+
}, ce = (e, t, s) => {
|
|
120
121
|
const n = e[t];
|
|
121
122
|
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, o) => {
|
|
122
123
|
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(o.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== s ? ". Note that variables only represent file names one level deep." : ""))));
|
|
123
124
|
});
|
|
124
|
-
},
|
|
125
|
+
}, k = async (e) => (await ce(/* @__PURE__ */ Object.assign({ "./field_descriptions_prompt.md": () => import("./field_descriptions_prompt.js"), "./intent_prompt.md": () => import("./intent_prompt.js"), "./layer_descriptions_prompt.md": () => import("./layer_descriptions_prompt.js") }), `./${e}.md`, 2)).default, le = async (e) => {
|
|
125
126
|
const { agent: t, messages: s, config: n } = e;
|
|
126
127
|
return { structuredResponse: (await t.invoke(
|
|
127
128
|
{
|
|
@@ -129,27 +130,28 @@ ${s}`;
|
|
|
129
130
|
},
|
|
130
131
|
n
|
|
131
132
|
)).structuredResponse };
|
|
132
|
-
},
|
|
133
|
+
}, de = (e) => typeof e == "string" && e.length > 0 ? e : void 0, pe = () => ee(), me = (e) => typeof e != "string" || e.trim().length === 0 ? "MapsSDK" : `MapsSDK - ${e.trim()}`, ue = (e) => {
|
|
133
134
|
const t = e?.configurable;
|
|
134
135
|
return {
|
|
135
|
-
conversationId:
|
|
136
|
-
abortSignal:
|
|
137
|
-
requestId:
|
|
136
|
+
conversationId: de(t?.thread_id),
|
|
137
|
+
abortSignal: e?.signal,
|
|
138
|
+
requestId: pe(),
|
|
139
|
+
requestSource: me(te.applicationName)
|
|
138
140
|
};
|
|
139
|
-
},
|
|
140
|
-
const t =
|
|
141
|
+
}, $ = async ({ config: e }) => {
|
|
142
|
+
const t = q.getDefault(), n = (await Z.getCredential(`${t.url}/sharing`))?.token;
|
|
141
143
|
return async (i, o) => {
|
|
142
|
-
const { conversationId: a, abortSignal:
|
|
143
|
-
|
|
144
|
-
const
|
|
144
|
+
const { conversationId: a, abortSignal: c, requestId: l, requestSource: p } = ue(e), d = new Headers(o?.headers);
|
|
145
|
+
d.delete("Authorization"), d.delete("api-key"), n && n.length > 0 && (d.set("X-Esri-Authorization", `Bearer ${n}`), d.set("X-Esri-Request-Source", p)), a && a.length > 0 && d.set("X-Esri-Conversation-Id", a), l.length > 0 && d.set("X-Esri-Request-Id", l);
|
|
146
|
+
const y = c && o?.signal ? AbortSignal.any([c, o.signal]) : o?.signal ?? c;
|
|
145
147
|
return await fetch(i, {
|
|
146
148
|
...o,
|
|
147
|
-
headers:
|
|
148
|
-
signal:
|
|
149
|
+
headers: d,
|
|
150
|
+
signal: y
|
|
149
151
|
});
|
|
150
152
|
};
|
|
151
|
-
},
|
|
152
|
-
const { modelTier: t = "default", temperature: s = 0, config: n } = e, i =
|
|
153
|
+
}, v = async (e = {}) => {
|
|
154
|
+
const { modelTier: t = "default", temperature: s = 0, config: n } = e, i = F[t], o = await se(t);
|
|
153
155
|
return new Q({
|
|
154
156
|
modelName: i,
|
|
155
157
|
apiKey: "dummy-key",
|
|
@@ -157,37 +159,37 @@ ${s}`;
|
|
|
157
159
|
...t !== "default" && { temperature: s },
|
|
158
160
|
configuration: {
|
|
159
161
|
baseURL: o,
|
|
160
|
-
fetch: await
|
|
162
|
+
fetch: await $({ config: n })
|
|
161
163
|
}
|
|
162
164
|
});
|
|
163
|
-
},
|
|
164
|
-
const { tier: t = "default", config: s } = e, n =
|
|
165
|
+
}, Oe = async (e = {}) => {
|
|
166
|
+
const { tier: t = "default", config: s } = e, n = I[t], i = await ie(t);
|
|
165
167
|
return new Y({
|
|
166
168
|
modelName: n,
|
|
167
169
|
apiKey: "dummy-key",
|
|
168
170
|
configuration: {
|
|
169
171
|
baseURL: i,
|
|
170
|
-
fetch: await
|
|
172
|
+
fetch: await $({ config: s })
|
|
171
173
|
},
|
|
172
174
|
batchSize: 2048,
|
|
173
175
|
maxConcurrency: 10
|
|
174
176
|
});
|
|
175
|
-
},
|
|
177
|
+
}, ge = r.object({
|
|
176
178
|
id: r.string().min(1),
|
|
177
179
|
name: r.string().min(1),
|
|
178
180
|
description: r.string().min(1)
|
|
179
181
|
});
|
|
180
|
-
r.array(
|
|
181
|
-
const
|
|
182
|
+
r.array(ge);
|
|
183
|
+
const R = (e) => JSON.stringify(e, null, 2), fe = (e) => {
|
|
182
184
|
const t = e.map((n) => n.id), s = r.enum(t);
|
|
183
185
|
return r.object({
|
|
184
186
|
intent: s.nullable(),
|
|
185
187
|
assignedTask: r.string().nullable(),
|
|
186
188
|
requiresFollowUp: r.boolean()
|
|
187
189
|
});
|
|
188
|
-
},
|
|
189
|
-
const s =
|
|
190
|
-
if (
|
|
190
|
+
}, Ve = async (e, t) => {
|
|
191
|
+
const s = ae(t);
|
|
192
|
+
if (t?.signal?.aborted)
|
|
191
193
|
return await f({ text: "Run cancelled; skipping intent routing" }, t), {
|
|
192
194
|
...e,
|
|
193
195
|
currentIntent: "none",
|
|
@@ -207,24 +209,24 @@ const C = (e) => JSON.stringify(e, null, 2), ue = (e) => {
|
|
|
207
209
|
currentIntent: "none",
|
|
208
210
|
finalOutputMessage: "No agents registered; skipping intent detection."
|
|
209
211
|
};
|
|
210
|
-
const a = await
|
|
211
|
-
registeredAgents:
|
|
212
|
-
priorSteps:
|
|
212
|
+
const a = await k("intent_prompt"), c = R(o), l = fe(o), p = {
|
|
213
|
+
registeredAgents: c,
|
|
214
|
+
priorSteps: R(e.agentExecutionContext.priorSteps),
|
|
213
215
|
userRequest: e.agentExecutionContext.userRequest
|
|
214
|
-
},
|
|
215
|
-
model: await
|
|
216
|
+
}, y = await D.fromTemplate(a).format(p), E = G({
|
|
217
|
+
model: await v({
|
|
216
218
|
modelTier: "fast",
|
|
217
219
|
config: t
|
|
218
220
|
}),
|
|
219
221
|
tools: [],
|
|
220
|
-
systemPrompt:
|
|
221
|
-
responseFormat:
|
|
222
|
+
systemPrompt: y,
|
|
223
|
+
responseFormat: l,
|
|
222
224
|
middleware: [
|
|
223
225
|
// Preserve recent conversation context while summarizing older messages
|
|
224
226
|
// to control token usage without losing important intent signals.
|
|
225
227
|
// The trigger and keep parameters can be tuned based on token limits and behavior.
|
|
226
|
-
|
|
227
|
-
model: await
|
|
228
|
+
H({
|
|
229
|
+
model: await v({
|
|
228
230
|
modelTier: "fast",
|
|
229
231
|
config: t
|
|
230
232
|
}),
|
|
@@ -233,30 +235,30 @@ const C = (e) => JSON.stringify(e, null, 2), ue = (e) => {
|
|
|
233
235
|
}),
|
|
234
236
|
// Enforce no loop/retry.
|
|
235
237
|
// 1 usual LLM call and 1 optional summarization call.
|
|
236
|
-
|
|
238
|
+
J({ runLimit: 2 })
|
|
237
239
|
]
|
|
238
|
-
}), { structuredResponse: V } = await
|
|
240
|
+
}), { structuredResponse: V } = await le({
|
|
239
241
|
agent: E,
|
|
240
242
|
messages: e.agentExecutionContext.messages,
|
|
241
243
|
config: t
|
|
242
|
-
}),
|
|
244
|
+
}), w = l.parse(
|
|
243
245
|
V ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
|
|
244
|
-
),
|
|
246
|
+
), x = w.intent ?? "none", z = {
|
|
245
247
|
...e,
|
|
246
|
-
currentIntent:
|
|
247
|
-
requiresFollowUp:
|
|
248
|
+
currentIntent: x,
|
|
249
|
+
requiresFollowUp: w.requiresFollowUp,
|
|
248
250
|
agentExecutionContext: {
|
|
249
251
|
...e.agentExecutionContext,
|
|
250
|
-
assignedTask:
|
|
252
|
+
assignedTask: w.assignedTask ?? ""
|
|
251
253
|
}
|
|
252
254
|
};
|
|
253
|
-
if (
|
|
255
|
+
if (x === "none") {
|
|
254
256
|
const g = `I could not find an agent that can handle that request. I have access to the following agents: ${i.map(({ agent: L }) => L.name).join(", ")}.
|
|
255
257
|
|
|
256
258
|
Please ask a question that can be answered by one of these agents.`;
|
|
257
259
|
return await f({ text: "LLM did not identify a clear intent." }, t), {
|
|
258
260
|
...e,
|
|
259
|
-
currentIntent:
|
|
261
|
+
currentIntent: x,
|
|
260
262
|
requiresFollowUp: !1,
|
|
261
263
|
finalOutputMessage: g,
|
|
262
264
|
agentExecutionContext: {
|
|
@@ -277,29 +279,29 @@ Please ask a question that can be answered by one of these agents.`;
|
|
|
277
279
|
}
|
|
278
280
|
return await f(
|
|
279
281
|
{
|
|
280
|
-
text: `Agent picked: ${
|
|
281
|
-
Task Assigned: ${
|
|
282
|
-
Requires Follow-Up: ${
|
|
282
|
+
text: `Agent picked: ${x}
|
|
283
|
+
Task Assigned: ${w.assignedTask ?? ""}
|
|
284
|
+
Requires Follow-Up: ${w.requiresFollowUp}`
|
|
283
285
|
},
|
|
284
286
|
t
|
|
285
287
|
), z;
|
|
286
288
|
} catch (n) {
|
|
287
289
|
throw await f({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
|
|
288
290
|
}
|
|
289
|
-
},
|
|
291
|
+
}, he = "0.1", b = 1536, ye = "openai", we = I.default, be = `Name: {name}
|
|
290
292
|
Title: {title}
|
|
291
|
-
Description: {description}`,
|
|
293
|
+
Description: {description}`, ve = `Name: {name}
|
|
292
294
|
Alias: {alias}
|
|
293
|
-
Description: {description}`,
|
|
294
|
-
schemaVersion: r.literal(
|
|
295
|
+
Description: {description}`, ze = r.object({
|
|
296
|
+
schemaVersion: r.literal(he),
|
|
295
297
|
modified: r.number().int().nonnegative(),
|
|
296
298
|
embeddings: r.object({
|
|
297
|
-
modelProvider: r.literal(
|
|
298
|
-
model: r.literal(
|
|
299
|
-
dimensions: r.literal(
|
|
299
|
+
modelProvider: r.literal(ye),
|
|
300
|
+
model: r.literal(we),
|
|
301
|
+
dimensions: r.literal(b),
|
|
300
302
|
templates: r.object({
|
|
301
|
-
layer: r.string().default(
|
|
302
|
-
field: r.string().default(
|
|
303
|
+
layer: r.string().default(be),
|
|
304
|
+
field: r.string().default(ve)
|
|
303
305
|
})
|
|
304
306
|
}),
|
|
305
307
|
layers: r.array(
|
|
@@ -308,22 +310,22 @@ Description: {description}`, $e = r.object({
|
|
|
308
310
|
name: r.string().min(1),
|
|
309
311
|
title: r.string().catch(""),
|
|
310
312
|
description: r.string().catch(""),
|
|
311
|
-
vector: r.array(r.number()).length(
|
|
312
|
-
message: `Layer vector must be exactly ${
|
|
313
|
+
vector: r.array(r.number()).length(b, {
|
|
314
|
+
message: `Layer vector must be exactly ${b} dimensions`
|
|
313
315
|
}),
|
|
314
316
|
fields: r.array(
|
|
315
317
|
r.object({
|
|
316
318
|
name: r.string().min(1),
|
|
317
319
|
alias: r.string().catch(""),
|
|
318
320
|
description: r.string().catch(""),
|
|
319
|
-
vector: r.array(r.number()).length(
|
|
320
|
-
message: `Field vector must be exactly ${
|
|
321
|
+
vector: r.array(r.number()).length(b, {
|
|
322
|
+
message: `Field vector must be exactly ${b} dimensions`
|
|
321
323
|
})
|
|
322
324
|
})
|
|
323
325
|
)
|
|
324
326
|
})
|
|
325
327
|
).default([])
|
|
326
|
-
}),
|
|
328
|
+
}), xe = (e) => {
|
|
327
329
|
const t = /* @__PURE__ */ new Set();
|
|
328
330
|
for (const n of e)
|
|
329
331
|
if (W(n)) {
|
|
@@ -342,42 +344,42 @@ Description: {description}`, $e = r.object({
|
|
|
342
344
|
}, A = (e, t) => {
|
|
343
345
|
const s = K.fromTemplate(e);
|
|
344
346
|
return D.fromMessages([s, ...t]);
|
|
345
|
-
},
|
|
346
|
-
const { promptText: t, modelTier: s, temperature: n, messages: i, config: o } = e, a = A(t, i ?? []),
|
|
347
|
-
return a.pipe(
|
|
348
|
-
},
|
|
349
|
-
const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, config: a } = e,
|
|
347
|
+
}, Me = async (e) => {
|
|
348
|
+
const { promptText: t, modelTier: s, temperature: n, messages: i, config: o } = e, a = A(t, i ?? []), c = await v({ modelTier: s, temperature: n, config: o });
|
|
349
|
+
return a.pipe(c);
|
|
350
|
+
}, Le = async (e) => {
|
|
351
|
+
const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, config: a } = e, l = await (await Me({
|
|
350
352
|
promptText: t,
|
|
351
353
|
modelTier: s,
|
|
352
354
|
temperature: n,
|
|
353
355
|
messages: i,
|
|
354
356
|
config: a
|
|
355
|
-
})).invoke(o ?? {});
|
|
356
|
-
if (typeof
|
|
357
|
-
return
|
|
358
|
-
const
|
|
359
|
-
return typeof
|
|
360
|
-
},
|
|
361
|
-
const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, schema: a, config:
|
|
362
|
-
return await
|
|
363
|
-
},
|
|
364
|
-
const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, tools: a, config:
|
|
365
|
-
return await
|
|
366
|
-
},
|
|
367
|
-
name:
|
|
368
|
-
description:
|
|
369
|
-
valueType:
|
|
370
|
-
alias:
|
|
371
|
-
}),
|
|
372
|
-
fields:
|
|
373
|
-
}), O = (e, t) => e.getFieldAlias(t) ?? void 0, S = (e, t) => O(e, t.name) ?? t.alias ?? "",
|
|
357
|
+
})).invoke(o ?? {}, a);
|
|
358
|
+
if (typeof l == "string")
|
|
359
|
+
return l;
|
|
360
|
+
const p = l.content;
|
|
361
|
+
return typeof p == "string" ? p : JSON.stringify(p);
|
|
362
|
+
}, N = async (e) => {
|
|
363
|
+
const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, schema: a, config: c } = e, l = A(t, i ?? []), d = (await v({ modelTier: s, temperature: n, config: c })).withStructuredOutput(a);
|
|
364
|
+
return await l.pipe(d).invoke(o ?? {}, c);
|
|
365
|
+
}, Ke = async (e) => {
|
|
366
|
+
const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, tools: a, config: c } = e, l = a.length > 0 ? xe(i ?? []) : i ?? [], p = A(t, l), d = await v({ modelTier: s, temperature: n, config: c });
|
|
367
|
+
return await p.pipe(d.bindTools(a)).invoke(o ?? {}, c);
|
|
368
|
+
}, Te = u.object({
|
|
369
|
+
name: u.string(),
|
|
370
|
+
description: u.string(),
|
|
371
|
+
valueType: u.string(),
|
|
372
|
+
alias: u.string()
|
|
373
|
+
}), Se = u.object({
|
|
374
|
+
fields: u.array(Te)
|
|
375
|
+
}), O = (e, t) => e.getFieldAlias(t) ?? void 0, S = (e, t) => O(e, t.name) ?? t.alias ?? "", Ie = (e, t) => {
|
|
374
376
|
const s = O(e, t.name);
|
|
375
377
|
return !!(s && s !== (t.alias ?? ""));
|
|
376
378
|
};
|
|
377
|
-
function
|
|
379
|
+
function C(e, t) {
|
|
378
380
|
const s = /* @__PURE__ */ new Map();
|
|
379
381
|
for (const n of e.fields) {
|
|
380
|
-
const i = t.fields.find((
|
|
382
|
+
const i = t.fields.find((l) => l.name === n.name), o = S(e, n), a = Ie(e, n), c = {
|
|
381
383
|
name: n.name,
|
|
382
384
|
type: n.type,
|
|
383
385
|
alias: a ? o : i?.alias ?? o,
|
|
@@ -385,67 +387,67 @@ function R(e, t) {
|
|
|
385
387
|
valueType: i?.valueType ?? n.valueType ?? "",
|
|
386
388
|
domain: e.getFieldDomain(n.name) ?? void 0
|
|
387
389
|
};
|
|
388
|
-
s.set(n.name,
|
|
390
|
+
s.set(n.name, c);
|
|
389
391
|
}
|
|
390
392
|
return s;
|
|
391
393
|
}
|
|
392
|
-
const
|
|
393
|
-
const s = await
|
|
394
|
-
const { name:
|
|
395
|
-
return [`Name: ${
|
|
394
|
+
const Be = async (e) => {
|
|
395
|
+
const s = await k("field_descriptions_prompt"), n = e.fields.filter((a) => !(S(e, a) && a.description)).map((a) => {
|
|
396
|
+
const { name: c, type: l, description: p } = a, d = S(e, a);
|
|
397
|
+
return [`Name: ${c}`, `Type: ${l}`, `Alias: ${d}`, `Description: ${p ?? "N/A"}`].join(", ");
|
|
396
398
|
}).join(`
|
|
397
399
|
`);
|
|
398
400
|
if (n.length === 0)
|
|
399
|
-
return
|
|
401
|
+
return C(e, { fields: [] });
|
|
400
402
|
const i = {
|
|
401
403
|
existingItemTitle: e.portalItem?.title,
|
|
402
404
|
existingItemDescription: e.portalItem?.description,
|
|
403
405
|
existingLayerTitle: e.title,
|
|
404
406
|
existingLayerDescription: e.portalItem?.description,
|
|
405
407
|
fieldInformation: n
|
|
406
|
-
}, o = await
|
|
408
|
+
}, o = await N({
|
|
407
409
|
promptText: s,
|
|
408
|
-
schema:
|
|
410
|
+
schema: Se,
|
|
409
411
|
inputVariables: i
|
|
410
412
|
});
|
|
411
|
-
return
|
|
412
|
-
},
|
|
413
|
-
title:
|
|
414
|
-
description:
|
|
415
|
-
name:
|
|
416
|
-
}),
|
|
417
|
-
const n = await
|
|
413
|
+
return C(e, o);
|
|
414
|
+
}, ke = u.object({
|
|
415
|
+
title: u.string(),
|
|
416
|
+
description: u.string(),
|
|
417
|
+
name: u.string().nullable()
|
|
418
|
+
}), We = async (e, t) => {
|
|
419
|
+
const n = await k("layer_descriptions_prompt"), i = Array.from(t.values()), o = {
|
|
418
420
|
fieldInformation: JSON.stringify(i, null, 2),
|
|
419
421
|
existingLayerTitle: e.title,
|
|
420
422
|
existingLayerDescription: e.portalItem?.description,
|
|
421
423
|
existingLayerSnippet: e.portalItem?.snippet,
|
|
422
424
|
layerGeometryType: e.geometryType
|
|
423
425
|
};
|
|
424
|
-
return { ...await
|
|
426
|
+
return { ...await N({
|
|
425
427
|
promptText: n,
|
|
426
|
-
schema:
|
|
428
|
+
schema: ke,
|
|
427
429
|
inputVariables: o
|
|
428
430
|
}), name: e.title ?? null };
|
|
429
431
|
};
|
|
430
432
|
export {
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
433
|
+
Ne as D,
|
|
434
|
+
ze as W,
|
|
435
|
+
We as a,
|
|
436
|
+
ye as b,
|
|
437
|
+
v as c,
|
|
438
|
+
b as d,
|
|
439
|
+
Le as e,
|
|
440
|
+
ve as f,
|
|
441
|
+
Be as g,
|
|
442
|
+
Ke as h,
|
|
443
|
+
N as i,
|
|
444
|
+
oe as j,
|
|
445
|
+
$e as k,
|
|
446
|
+
be as l,
|
|
447
|
+
we as m,
|
|
448
|
+
ie as n,
|
|
449
|
+
ae as o,
|
|
450
|
+
Ve as p,
|
|
451
|
+
Oe as q,
|
|
452
|
+
he as s
|
|
451
453
|
};
|
package/dist/chunks/helpGraph.js
CHANGED
|
@@ -3,6 +3,7 @@ import { StateGraph as d, START as g, END as i } from "@langchain/langgraph/web"
|
|
|
3
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 "@arcgis/toolkit/string";
|
|
6
7
|
import { h as S } from "./generateLayerDescriptions.js";
|
|
7
8
|
import "@langchain/core/messages";
|
|
8
9
|
import "@langchain/core/callbacks/dispatch/web";
|
|
@@ -114,7 +115,7 @@ const b = () => new d(c).addNode("requireHelpServices", C).addNode("agent", _).a
|
|
|
114
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 accordingly.
|
|
116
117
|
_Example: "Create a chart"_
|
|
117
|
-
_Example: "Create a table"_`,
|
|
118
|
+
_Example: "Create a table"_`, V = {
|
|
118
119
|
id: "help",
|
|
119
120
|
name: "Help Agent",
|
|
120
121
|
description: M,
|
|
@@ -122,5 +123,5 @@ const b = () => new d(c).addNode("requireHelpServices", C).addNode("agent", _).a
|
|
|
122
123
|
workspace: c
|
|
123
124
|
};
|
|
124
125
|
export {
|
|
125
|
-
|
|
126
|
+
V as H
|
|
126
127
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
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 "@arcgis/toolkit/string";
|
|
5
6
|
import { h as I } from "./generateLayerDescriptions.js";
|
|
6
7
|
import "@langchain/core/messages";
|
|
7
8
|
import { s as i } from "./index.js";
|
|
@@ -3,6 +3,7 @@ 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 "@arcgis/toolkit/string";
|
|
6
7
|
import { h as V, i as z } from "./generateLayerDescriptions.js";
|
|
7
8
|
import "@langchain/core/messages";
|
|
8
9
|
import "@langchain/core/callbacks/dispatch/web";
|
|
@@ -258,7 +259,7 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
258
259
|
_Example: “Center the map on San Francisco at scale 50000”_
|
|
259
260
|
_Example: “Zoom to the features in the schools layer where city = 'Austin'”_
|
|
260
261
|
_Example: “Go to the Downtown bookmark”_
|
|
261
|
-
_Example: “Where is Mount Rainier?”_`,
|
|
262
|
+
_Example: “Where is Mount Rainier?”_`, ve = {
|
|
262
263
|
id: "navigation",
|
|
263
264
|
name: "Navigation Agent",
|
|
264
265
|
description: Y,
|
|
@@ -266,5 +267,5 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
266
267
|
workspace: w
|
|
267
268
|
};
|
|
268
269
|
export {
|
|
269
|
-
|
|
270
|
+
ve as N
|
|
270
271
|
};
|