@arcgis/ai-components 5.2.0-next.59 → 5.2.0-next.60

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.
Files changed (61) hide show
  1. package/dist/agent-utils/LLMAgent.js +1 -1
  2. package/dist/cdn/{YZVPURIK.js → 242OOJML.js} +1 -1
  3. package/dist/cdn/{OGMMYFHR.js → 2WDZIJQR.js} +1 -1
  4. package/dist/cdn/{VPFIUEKT.js → 3YCSUTGV.js} +2 -2
  5. package/dist/cdn/{UK7PR2FE.js → 3ZPPYCNL.js} +1 -1
  6. package/dist/cdn/{MS5EA2KY.js → 5L7VPEQM.js} +1 -1
  7. package/dist/cdn/{CMG2NY3K.js → 7NP7WGR5.js} +1 -1
  8. package/dist/cdn/{O5TONDCH.js → AHLLB5QW.js} +1 -1
  9. package/dist/cdn/{QWYDMY6J.js → BI3LK5D3.js} +1 -1
  10. package/dist/cdn/{4G5XCUE5.js → BSP6IJY4.js} +1 -1
  11. package/dist/cdn/{SJR4IR57.js → CWZEQ4R6.js} +1 -1
  12. package/dist/cdn/{A3BRNO6B.js → EF7OV7SR.js} +1 -1
  13. package/dist/cdn/{JSIGEUX7.js → FC45FF2D.js} +2 -2
  14. package/dist/cdn/{Z6I6JACX.js → FNPLHH4E.js} +1 -1
  15. package/dist/cdn/{EQLRFZVU.js → FVDFPK3V.js} +2 -2
  16. package/dist/cdn/{WF35K3KN.js → GLOALVJR.js} +1 -1
  17. package/dist/cdn/{F5SUU35Z.js → HLO655UO.js} +1 -1
  18. package/dist/cdn/{DMLRWHBA.js → HPSVZVAR.js} +1 -1
  19. package/dist/cdn/{EW6AYEUX.js → HWBVWBDF.js} +2 -2
  20. package/dist/cdn/{A4JLOAOH.js → JHFOZPBP.js} +1 -1
  21. package/dist/cdn/{7FY4G4K2.js → L4SS54EZ.js} +1 -1
  22. package/dist/cdn/MSDNERUF.js +2 -0
  23. package/dist/cdn/{SPVOBZAL.js → OI7EGYZU.js} +1 -1
  24. package/dist/cdn/{PNFBQ6JV.js → OY2P2O47.js} +2 -2
  25. package/dist/cdn/{TOX55UYN.js → PDKH5ED3.js} +2 -2
  26. package/dist/cdn/{ZB57WYHC.js → PJ3UN2RU.js} +1 -1
  27. package/dist/cdn/{S4AW6SXT.js → QBINZNXI.js} +1 -1
  28. package/dist/cdn/{FYW633VX.js → QZLE7B6X.js} +1 -1
  29. package/dist/cdn/{43C4YGLR.js → RAAV47KU.js} +2 -2
  30. package/dist/cdn/{YYSMCB4A.js → SLXOVE7Y.js} +1 -1
  31. package/dist/cdn/{BMGQJYTE.js → U4Z5XNJ5.js} +1 -1
  32. package/dist/cdn/{GYVSHAUI.js → VCXSQWGA.js} +1 -1
  33. package/dist/cdn/{5I35MJXT.js → WHOZT5H5.js} +16 -16
  34. package/dist/cdn/{7YIRK2E3.js → WY7B6IMH.js} +1 -1
  35. package/dist/cdn/{JEL5M7FA.js → XVPBO2JC.js} +1 -1
  36. package/dist/cdn/{GDCYIUV3.js → YIA7O2XZ.js} +1 -1
  37. package/dist/cdn/{JSJ4RMOE.js → YZIUJNAR.js} +1 -1
  38. package/dist/cdn/agent-utils/index.js +1 -1
  39. package/dist/cdn/index.js +1 -1
  40. package/dist/chunks/adapter.js +1 -1
  41. package/dist/chunks/arcgisKnowledgeGraph.js +1 -1
  42. package/dist/chunks/dataExplorationGraph.js +1 -1
  43. package/dist/chunks/generateLayerDescriptions.js +157 -155
  44. package/dist/chunks/helpGraph.js +1 -1
  45. package/dist/chunks/layerStylingGraph.js +1 -1
  46. package/dist/chunks/navigationGraph.js +1 -1
  47. package/dist/chunks/toolCallResponse.js +1 -1
  48. package/dist/components/arcgis-assistant/customElement.js +1 -0
  49. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
  50. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -1
  51. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -1
  52. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
  53. package/dist/components/arcgis-assistant-message-loading/customElement.js +4 -4
  54. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
  55. package/dist/components/arcgis-assistant-speech-input/customElement.js +29 -46
  56. package/dist/docs/api.json +1 -1
  57. package/dist/docs/docs.json +1 -1
  58. package/dist/docs/web-types.json +1 -1
  59. package/package.json +4 -4
  60. package/dist/cdn/JVYPIWEU.js +0 -2
  61. /package/dist/cdn/{NAKAZDJ7.js → 2XQAM2Q3.js} +0 -0
@@ -1,48 +1,46 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { Annotation as m } from "@langchain/langgraph/web";
2
+ import { Annotation as p } from "@langchain/langgraph/web";
3
3
  import u, { z as r } from "zod";
4
- import { ChatPromptTemplate as D, SystemMessagePromptTemplate as K } from "@langchain/core/prompts";
4
+ import { ChatPromptTemplate as q, SystemMessagePromptTemplate as K } from "@langchain/core/prompts";
5
5
  import { s as f } from "./index.js";
6
- import { AIMessage as B, isAIMessage as W, isToolMessage as X } from "@langchain/core/messages";
6
+ import { AIMessage as W, isAIMessage as B, isToolMessage as X } from "@langchain/core/messages";
7
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 q from "@arcgis/core/portal/Portal.js";
10
- import Z from "@arcgis/core/identity/IdentityManager.js";
11
- import { generateGuid as ee } from "@arcgis/toolkit/string";
12
- import te from "@arcgis/core/config.js";
13
- const F = {
9
+ import F from "@arcgis/core/portal/Portal.js";
10
+ import Z from "@arcgis/core/request.js";
11
+ import ee from "@arcgis/core/identity/IdentityManager.js";
12
+ import { generateGuid as te } from "@arcgis/toolkit/string";
13
+ import ne from "@arcgis/core/config.js";
14
+ const U = {
14
15
  advanced: "gpt-5.2",
15
16
  default: "gpt-5-mini",
16
17
  fast: "gpt-5.4-nano"
17
- }, I = {
18
+ }, E = {
18
19
  default: "text-embedding-ada-002"
19
- }, T = /* @__PURE__ */ new Map();
20
- let M = null;
21
- const ne = () => {
22
- const t = q.getDefault().helperServices;
20
+ }, k = /* @__PURE__ */ new Map();
21
+ let S = null;
22
+ const se = () => {
23
+ const t = F.getDefault().helperServices;
23
24
  if (!t?.aiModels?.url)
24
25
  throw new Error("AI Models Service URL is not defined in the portal's helper services.");
25
26
  return t.aiModels.url;
26
- }, U = async (e) => {
27
- const t = ne();
28
- T.size === 0 && (M || (M = (async () => {
27
+ }, P = async (e) => {
28
+ const t = se();
29
+ k.size === 0 && (S || (S = (async () => {
29
30
  try {
30
- const n = await fetch(`${t}/models`);
31
- if (!n.ok)
32
- throw new Error("Failed to fetch AI service discovery data.");
33
- (await n.json()).models.forEach((o) => T.set(o.name, o));
31
+ (await Z(`${t}/models`)).data.models.forEach((o) => k.set(o.name, o));
34
32
  } catch (n) {
35
- throw M = null, n;
33
+ throw S = null, n;
36
34
  }
37
- })()), await M);
38
- const s = T.get(e);
35
+ })()), await S);
36
+ const s = k.get(e);
39
37
  if (!s)
40
38
  throw new Error(`Model '${e}' is not available in the discovery service.`);
41
39
  return s.endpoint;
42
- }, se = async (e = "default") => await U(F[e]), ie = async (e = "default") => await U(I[e]), h = (e, t) => t, P = (e, t) => ({
40
+ }, ie = async (e = "default") => await P(U[e]), oe = async (e = "default") => await P(E[e]), h = (e, t) => t, _ = (e, t) => ({
43
41
  ...e,
44
42
  ...t
45
- }), _ = (e = "", t) => {
43
+ }), $ = (e = "", t) => {
46
44
  const s = typeof t == "string" ? t.trim() : "";
47
45
  if (!s)
48
46
  return e;
@@ -63,66 +61,66 @@ ${s}`;
63
61
  messages: [],
64
62
  priorSteps: [],
65
63
  sharedState: {}
66
- }), oe = () => ({
67
- agentExecutionContext: m({
68
- reducer: P,
64
+ }), re = () => ({
65
+ agentExecutionContext: p({
66
+ reducer: _,
69
67
  default: j
70
68
  }),
71
- outputMessage: m({
72
- reducer: _,
69
+ outputMessage: p({
70
+ reducer: $,
73
71
  default: () => ""
74
72
  }),
75
- summary: m({
73
+ summary: p({
76
74
  reducer: h,
77
75
  default: () => ""
78
76
  }),
79
- status: m({
77
+ status: p({
80
78
  reducer: h
81
79
  })
82
- }), $e = () => ({
83
- ...oe(),
84
- sharedStatePatch: m({
80
+ }), Oe = () => ({
81
+ ...re(),
82
+ sharedStatePatch: p({
85
83
  reducer: h
86
84
  })
87
- }), Ne = m.Root({
88
- agentExecutionContext: m({
85
+ }), ze = p.Root({
86
+ agentExecutionContext: p({
89
87
  default: j,
90
- reducer: P
88
+ reducer: _
91
89
  }),
92
- currentIntent: m({
90
+ currentIntent: p({
93
91
  default: () => "none",
94
92
  reducer: h
95
93
  }),
96
- lastExecutedAgent: m({
94
+ lastExecutedAgent: p({
97
95
  default: () => "",
98
96
  reducer: h
99
97
  }),
100
- requiresFollowUp: m({
98
+ requiresFollowUp: p({
101
99
  default: () => !0,
102
100
  reducer: h
103
101
  }),
104
- stepCount: m({
102
+ stepCount: p({
105
103
  default: () => 0,
106
104
  reducer: (e, t) => t ?? e + 1
107
105
  }),
108
- finalOutputMessage: m({
106
+ finalOutputMessage: p({
109
107
  default: () => "",
110
- reducer: _
108
+ reducer: $
111
109
  })
112
- }), re = (e) => {
110
+ }), ae = (e) => {
113
111
  if (!e || typeof e != "object" || !("services" in e))
114
112
  return !1;
115
113
  const t = e.services;
116
114
  return !!t && typeof t == "object" && "agentRegistry" in t;
117
- }, ae = (e) => {
115
+ }, ce = (e) => {
118
116
  const t = e?.configurable;
119
- return re(t) ? t : void 0;
120
- }, ce = (e, t, s) => {
117
+ return ae(t) ? t : void 0;
118
+ }, le = (e, t, s) => {
121
119
  const n = e[t];
122
120
  return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, o) => {
123
121
  (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." : ""))));
124
122
  });
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) => {
123
+ }, R = async (e) => (await le(/* @__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, de = async (e) => {
126
124
  const { agent: t, messages: s, config: n } = e;
127
125
  return { structuredResponse: (await t.invoke(
128
126
  {
@@ -130,28 +128,32 @@ ${s}`;
130
128
  },
131
129
  n
132
130
  )).structuredResponse };
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) => {
131
+ }, me = (e) => typeof e == "string" && e.length > 0 ? e : void 0, pe = () => te(), ue = (e) => typeof e != "string" || e.trim().length === 0 ? "MapsSDK" : `MapsSDK - ${e.trim()}`, ge = (e) => {
134
132
  const t = e?.configurable;
135
133
  return {
136
- conversationId: de(t?.thread_id),
134
+ conversationId: me(t?.thread_id),
137
135
  abortSignal: e?.signal,
138
136
  requestId: pe(),
139
- requestSource: me(te.applicationName)
137
+ requestSource: ue(ne.applicationName)
140
138
  };
141
- }, $ = async ({ config: e }) => {
142
- const t = q.getDefault(), n = (await Z.getCredential(`${t.url}/sharing`))?.token;
139
+ }, N = async ({ config: e }) => {
140
+ const t = F.getDefault(), n = (await ee.getCredential(`${t.url}/sharing`))?.token;
143
141
  return async (i, o) => {
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);
142
+ const { conversationId: a, abortSignal: c, requestId: l, requestSource: d } = ge(e), m = new Headers(o?.headers);
143
+ for (const w of [...m.keys()]) {
144
+ const b = w.toLowerCase();
145
+ (b === "authorization" || b === "api-key" || b.startsWith("x-stainless-")) && m.delete(w);
146
+ }
147
+ n && n.length > 0 && m.set("X-Esri-Authorization", `Bearer ${n}`), t.isPortal || (d && d.length > 0 && m.set("X-Esri-Request-Source", d), a && a.length > 0 && m.set("X-Esri-Conversation-Id", a), l.length > 0 && m.set("X-Esri-Request-Id", l));
146
148
  const y = c && o?.signal ? AbortSignal.any([c, o.signal]) : o?.signal ?? c;
147
149
  return await fetch(i, {
148
150
  ...o,
149
- headers: d,
151
+ headers: m,
150
152
  signal: y
151
153
  });
152
154
  };
153
- }, v = async (e = {}) => {
154
- const { modelTier: t = "default", temperature: s = 0, config: n } = e, i = F[t], o = await se(t);
155
+ }, M = async (e = {}) => {
156
+ const { modelTier: t = "default", temperature: s = 0, config: n } = e, i = U[t], o = await ie(t);
155
157
  return new Q({
156
158
  modelName: i,
157
159
  apiKey: "dummy-key",
@@ -159,28 +161,28 @@ ${s}`;
159
161
  ...t !== "default" && { temperature: s },
160
162
  configuration: {
161
163
  baseURL: o,
162
- fetch: await $({ config: n })
164
+ fetch: await N({ config: n })
163
165
  }
164
166
  });
165
- }, Oe = async (e = {}) => {
166
- const { tier: t = "default", config: s } = e, n = I[t], i = await ie(t);
167
+ }, Le = async (e = {}) => {
168
+ const { tier: t = "default", config: s } = e, n = E[t], i = await oe(t);
167
169
  return new Y({
168
170
  modelName: n,
169
171
  apiKey: "dummy-key",
170
172
  configuration: {
171
173
  baseURL: i,
172
- fetch: await $({ config: s })
174
+ fetch: await N({ config: s })
173
175
  },
174
176
  batchSize: 2048,
175
177
  maxConcurrency: 10
176
178
  });
177
- }, ge = r.object({
179
+ }, fe = r.object({
178
180
  id: r.string().min(1),
179
181
  name: r.string().min(1),
180
182
  description: r.string().min(1)
181
183
  });
182
- r.array(ge);
183
- const R = (e) => JSON.stringify(e, null, 2), fe = (e) => {
184
+ r.array(fe);
185
+ const C = (e) => JSON.stringify(e, null, 2), he = (e) => {
184
186
  const t = e.map((n) => n.id), s = r.enum(t);
185
187
  return r.object({
186
188
  intent: s.nullable(),
@@ -188,7 +190,7 @@ const R = (e) => JSON.stringify(e, null, 2), fe = (e) => {
188
190
  requiresFollowUp: r.boolean()
189
191
  });
190
192
  }, Ve = async (e, t) => {
191
- const s = ae(t);
193
+ const s = ce(t);
192
194
  if (t?.signal?.aborted)
193
195
  return await f({ text: "Run cancelled; skipping intent routing" }, t), {
194
196
  ...e,
@@ -209,12 +211,12 @@ const R = (e) => JSON.stringify(e, null, 2), fe = (e) => {
209
211
  currentIntent: "none",
210
212
  finalOutputMessage: "No agents registered; skipping intent detection."
211
213
  };
212
- const a = await k("intent_prompt"), c = R(o), l = fe(o), p = {
214
+ const a = await R("intent_prompt"), c = C(o), l = he(o), d = {
213
215
  registeredAgents: c,
214
- priorSteps: R(e.agentExecutionContext.priorSteps),
216
+ priorSteps: C(e.agentExecutionContext.priorSteps),
215
217
  userRequest: e.agentExecutionContext.userRequest
216
- }, y = await D.fromTemplate(a).format(p), E = G({
217
- model: await v({
218
+ }, y = await q.fromTemplate(a).format(d), w = G({
219
+ model: await M({
218
220
  modelTier: "fast",
219
221
  config: t
220
222
  }),
@@ -226,7 +228,7 @@ const R = (e) => JSON.stringify(e, null, 2), fe = (e) => {
226
228
  // to control token usage without losing important intent signals.
227
229
  // The trigger and keep parameters can be tuned based on token limits and behavior.
228
230
  H({
229
- model: await v({
231
+ model: await M({
230
232
  modelTier: "fast",
231
233
  config: t
232
234
  }),
@@ -237,34 +239,34 @@ const R = (e) => JSON.stringify(e, null, 2), fe = (e) => {
237
239
  // 1 usual LLM call and 1 optional summarization call.
238
240
  J({ runLimit: 2 })
239
241
  ]
240
- }), { structuredResponse: V } = await le({
241
- agent: E,
242
+ }), { structuredResponse: b } = await de({
243
+ agent: w,
242
244
  messages: e.agentExecutionContext.messages,
243
245
  config: t
244
- }), w = l.parse(
245
- V ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
246
- ), x = w.intent ?? "none", z = {
246
+ }), v = l.parse(
247
+ b ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
248
+ ), T = v.intent ?? "none", L = {
247
249
  ...e,
248
- currentIntent: x,
249
- requiresFollowUp: w.requiresFollowUp,
250
+ currentIntent: T,
251
+ requiresFollowUp: v.requiresFollowUp,
250
252
  agentExecutionContext: {
251
253
  ...e.agentExecutionContext,
252
- assignedTask: w.assignedTask ?? ""
254
+ assignedTask: v.assignedTask ?? ""
253
255
  }
254
256
  };
255
- if (x === "none") {
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(", ")}.
257
+ if (T === "none") {
258
+ const g = `I could not find an agent that can handle that request. I have access to the following agents: ${i.map(({ agent: V }) => V.name).join(", ")}.
257
259
 
258
260
  Please ask a question that can be answered by one of these agents.`;
259
261
  return await f({ text: "LLM did not identify a clear intent." }, t), {
260
262
  ...e,
261
- currentIntent: x,
263
+ currentIntent: T,
262
264
  requiresFollowUp: !1,
263
265
  finalOutputMessage: g,
264
266
  agentExecutionContext: {
265
267
  ...e.agentExecutionContext,
266
268
  assignedTask: "",
267
- messages: [...e.agentExecutionContext.messages, new B(g)],
269
+ messages: [...e.agentExecutionContext.messages, new W(g)],
268
270
  priorSteps: [
269
271
  ...e.agentExecutionContext.priorSteps ?? [],
270
272
  {
@@ -279,29 +281,29 @@ Please ask a question that can be answered by one of these agents.`;
279
281
  }
280
282
  return await f(
281
283
  {
282
- text: `Agent picked: ${x}
283
- Task Assigned: ${w.assignedTask ?? ""}
284
- Requires Follow-Up: ${w.requiresFollowUp}`
284
+ text: `Agent picked: ${T}
285
+ Task Assigned: ${v.assignedTask ?? ""}
286
+ Requires Follow-Up: ${v.requiresFollowUp}`
285
287
  },
286
288
  t
287
- ), z;
289
+ ), L;
288
290
  } catch (n) {
289
291
  throw await f({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
290
292
  }
291
- }, he = "0.1", b = 1536, ye = "openai", we = I.default, be = `Name: {name}
293
+ }, ye = "0.1", x = 1536, we = "openai", be = E.default, ve = `Name: {name}
292
294
  Title: {title}
293
- Description: {description}`, ve = `Name: {name}
295
+ Description: {description}`, xe = `Name: {name}
294
296
  Alias: {alias}
295
- Description: {description}`, ze = r.object({
296
- schemaVersion: r.literal(he),
297
+ Description: {description}`, Ke = r.object({
298
+ schemaVersion: r.literal(ye),
297
299
  modified: r.number().int().nonnegative(),
298
300
  embeddings: r.object({
299
- modelProvider: r.literal(ye),
300
- model: r.literal(we),
301
- dimensions: r.literal(b),
301
+ modelProvider: r.literal(we),
302
+ model: r.literal(be),
303
+ dimensions: r.literal(x),
302
304
  templates: r.object({
303
- layer: r.string().default(be),
304
- field: r.string().default(ve)
305
+ layer: r.string().default(ve),
306
+ field: r.string().default(xe)
305
307
  })
306
308
  }),
307
309
  layers: r.array(
@@ -310,25 +312,25 @@ Description: {description}`, ze = r.object({
310
312
  name: r.string().min(1),
311
313
  title: r.string().catch(""),
312
314
  description: r.string().catch(""),
313
- vector: r.array(r.number()).length(b, {
314
- message: `Layer vector must be exactly ${b} dimensions`
315
+ vector: r.array(r.number()).length(x, {
316
+ message: `Layer vector must be exactly ${x} dimensions`
315
317
  }),
316
318
  fields: r.array(
317
319
  r.object({
318
320
  name: r.string().min(1),
319
321
  alias: r.string().catch(""),
320
322
  description: r.string().catch(""),
321
- vector: r.array(r.number()).length(b, {
322
- message: `Field vector must be exactly ${b} dimensions`
323
+ vector: r.array(r.number()).length(x, {
324
+ message: `Field vector must be exactly ${x} dimensions`
323
325
  })
324
326
  })
325
327
  )
326
328
  })
327
329
  ).default([])
328
- }), xe = (e) => {
330
+ }), Me = (e) => {
329
331
  const t = /* @__PURE__ */ new Set();
330
332
  for (const n of e)
331
- if (W(n)) {
333
+ if (B(n)) {
332
334
  const i = n;
333
335
  i.tool_calls && i.tool_calls.length > 0 && i.tool_calls.forEach((o) => {
334
336
  o.id && t.add(o.id);
@@ -343,12 +345,12 @@ Description: {description}`, ze = r.object({
343
345
  });
344
346
  }, A = (e, t) => {
345
347
  const s = K.fromTemplate(e);
346
- return D.fromMessages([s, ...t]);
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 });
348
+ return q.fromMessages([s, ...t]);
349
+ }, Te = async (e) => {
350
+ const { promptText: t, modelTier: s, temperature: n, messages: i, config: o } = e, a = A(t, i ?? []), c = await M({ modelTier: s, temperature: n, config: o });
349
351
  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({
352
+ }, We = async (e) => {
353
+ const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, config: a } = e, l = await (await Te({
352
354
  promptText: t,
353
355
  modelTier: s,
354
356
  temperature: n,
@@ -357,29 +359,29 @@ Description: {description}`, ze = r.object({
357
359
  })).invoke(o ?? {}, a);
358
360
  if (typeof l == "string")
359
361
  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({
362
+ const d = l.content;
363
+ return typeof d == "string" ? d : JSON.stringify(d);
364
+ }, O = async (e) => {
365
+ const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, schema: a, config: c } = e, l = A(t, i ?? []), m = (await M({ modelTier: s, temperature: n, config: c })).withStructuredOutput(a);
366
+ return await l.pipe(m).invoke(o ?? {}, c);
367
+ }, Be = async (e) => {
368
+ const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, tools: a, config: c } = e, l = a.length > 0 ? Me(i ?? []) : i ?? [], d = A(t, l), m = await M({ modelTier: s, temperature: n, config: c });
369
+ return await d.pipe(m.bindTools(a)).invoke(o ?? {}, c);
370
+ }, Se = u.object({
369
371
  name: u.string(),
370
372
  description: u.string(),
371
373
  valueType: u.string(),
372
374
  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) => {
376
- const s = O(e, t.name);
375
+ }), ke = u.object({
376
+ fields: u.array(Se)
377
+ }), z = (e, t) => e.getFieldAlias(t) ?? void 0, I = (e, t) => z(e, t.name) ?? t.alias ?? "", Ie = (e, t) => {
378
+ const s = z(e, t.name);
377
379
  return !!(s && s !== (t.alias ?? ""));
378
380
  };
379
- function C(e, t) {
381
+ function D(e, t) {
380
382
  const s = /* @__PURE__ */ new Map();
381
383
  for (const n of e.fields) {
382
- const i = t.fields.find((l) => l.name === n.name), o = S(e, n), a = Ie(e, n), c = {
384
+ const i = t.fields.find((l) => l.name === n.name), o = I(e, n), a = Ie(e, n), c = {
383
385
  name: n.name,
384
386
  type: n.type,
385
387
  alias: a ? o : i?.alias ?? o,
@@ -391,63 +393,63 @@ function C(e, t) {
391
393
  }
392
394
  return s;
393
395
  }
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
+ const Xe = async (e) => {
397
+ const s = await R("field_descriptions_prompt"), n = e.fields.filter((a) => !(I(e, a) && a.description)).map((a) => {
398
+ const { name: c, type: l, description: d } = a, m = I(e, a);
399
+ return [`Name: ${c}`, `Type: ${l}`, `Alias: ${m}`, `Description: ${d ?? "N/A"}`].join(", ");
398
400
  }).join(`
399
401
  `);
400
402
  if (n.length === 0)
401
- return C(e, { fields: [] });
403
+ return D(e, { fields: [] });
402
404
  const i = {
403
405
  existingItemTitle: e.portalItem?.title,
404
406
  existingItemDescription: e.portalItem?.description,
405
407
  existingLayerTitle: e.title,
406
408
  existingLayerDescription: e.portalItem?.description,
407
409
  fieldInformation: n
408
- }, o = await N({
410
+ }, o = await O({
409
411
  promptText: s,
410
- schema: Se,
412
+ schema: ke,
411
413
  inputVariables: i
412
414
  });
413
- return C(e, o);
414
- }, ke = u.object({
415
+ return D(e, o);
416
+ }, Ee = u.object({
415
417
  title: u.string(),
416
418
  description: u.string(),
417
419
  name: u.string().nullable()
418
- }), We = async (e, t) => {
419
- const n = await k("layer_descriptions_prompt"), i = Array.from(t.values()), o = {
420
+ }), Ge = async (e, t) => {
421
+ const n = await R("layer_descriptions_prompt"), i = Array.from(t.values()), o = {
420
422
  fieldInformation: JSON.stringify(i, null, 2),
421
423
  existingLayerTitle: e.title,
422
424
  existingLayerDescription: e.portalItem?.description,
423
425
  existingLayerSnippet: e.portalItem?.snippet,
424
426
  layerGeometryType: e.geometryType
425
427
  };
426
- return { ...await N({
428
+ return { ...await O({
427
429
  promptText: n,
428
- schema: ke,
430
+ schema: Ee,
429
431
  inputVariables: o
430
432
  }), name: e.title ?? null };
431
433
  };
432
434
  export {
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,
435
+ ze as D,
436
+ Ke as W,
437
+ Ge as a,
438
+ we as b,
439
+ M as c,
440
+ x as d,
441
+ We as e,
442
+ xe as f,
443
+ Xe as g,
444
+ Be as h,
445
+ O as i,
446
+ re as j,
447
+ Oe as k,
448
+ ve as l,
449
+ be as m,
450
+ oe as n,
451
+ ce as o,
450
452
  Ve as p,
451
- Oe as q,
452
- he as s
453
+ Le as q,
454
+ ye as s
453
455
  };
@@ -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 m } from "./adapter.js";
4
4
  import "@arcgis/core/identity/IdentityManager.js";
5
5
  import "@arcgis/core/portal/Portal.js";
6
+ import "@arcgis/core/request.js";
6
7
  import "@arcgis/toolkit/string";
7
8
  import { h as S } from "./generateLayerDescriptions.js";
8
9
  import "@langchain/core/messages";
@@ -11,7 +12,6 @@ import "@langchain/openai";
11
12
  import "@arcgis/core/config.js";
12
13
  import "@arcgis/core/core/reactiveUtils.js";
13
14
  import "@arcgis/core/layers/FeatureLayer.js";
14
- import "@arcgis/core/request.js";
15
15
  import { ToolNode as E } from "@langchain/langgraph/prebuilt";
16
16
  import { s as u } from "./index.js";
17
17
  import "@langchain/core/prompts";
@@ -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/core/request.js";
5
6
  import "@arcgis/toolkit/string";
6
7
  import { h as I } from "./generateLayerDescriptions.js";
7
8
  import "@langchain/core/messages";
@@ -10,7 +11,6 @@ import "@langchain/openai";
10
11
  import "@arcgis/core/config.js";
11
12
  import "@arcgis/core/core/reactiveUtils.js";
12
13
  import "@arcgis/core/layers/FeatureLayer.js";
13
- import "@arcgis/core/request.js";
14
14
  import "@langchain/core/prompts";
15
15
  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";
16
16
  import { h as V } from "./toolCallResponse.js";
@@ -3,6 +3,7 @@ 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 "@arcgis/core/request.js";
6
7
  import "@arcgis/toolkit/string";
7
8
  import { h as V, i as z } from "./generateLayerDescriptions.js";
8
9
  import "@langchain/core/messages";
@@ -11,7 +12,6 @@ import "@langchain/openai";
11
12
  import "@arcgis/core/config.js";
12
13
  import "@arcgis/core/core/reactiveUtils.js";
13
14
  import "@arcgis/core/layers/FeatureLayer.js";
14
- import "@arcgis/core/request.js";
15
15
  import { s as h } from "./index.js";
16
16
  import "@langchain/core/prompts";
17
17
  import { ToolNode as G } from "@langchain/langgraph/prebuilt";
@@ -1,6 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import "@arcgis/core/identity/IdentityManager.js";
3
3
  import "@arcgis/core/portal/Portal.js";
4
+ import "@arcgis/core/request.js";
4
5
  import "@langchain/langgraph/web";
5
6
  import "@arcgis/toolkit/string";
6
7
  import "./generateLayerDescriptions.js";
@@ -10,7 +11,6 @@ import "@langchain/openai";
10
11
  import "@arcgis/core/config.js";
11
12
  import "@arcgis/core/core/reactiveUtils.js";
12
13
  import "@arcgis/core/layers/FeatureLayer.js";
13
- import "@arcgis/core/request.js";
14
14
  import "@langchain/core/prompts";
15
15
  const L = async (t, o) => {
16
16
  const i = t.tool_calls ?? [];
@@ -13,6 +13,7 @@ import { O as U } from "../../chunks/orchestrator.js";
13
13
  import "@langchain/core/callbacks/dispatch/web";
14
14
  import "@langchain/core/prompts";
15
15
  import "@langchain/openai";
16
+ import "@arcgis/core/request.js";
16
17
  import V from "@arcgis/core/identity/IdentityManager.js";
17
18
  import "@arcgis/toolkit/string";
18
19
  import "@arcgis/core/config.js";
@@ -5,6 +5,7 @@ import "@langchain/langgraph/web";
5
5
  import "../../chunks/adapter.js";
6
6
  import "@arcgis/core/identity/IdentityManager.js";
7
7
  import "@arcgis/core/portal/Portal.js";
8
+ import "@arcgis/core/request.js";
8
9
  import "@arcgis/toolkit/string";
9
10
  import "../../chunks/generateLayerDescriptions.js";
10
11
  import "@langchain/core/messages";
@@ -13,7 +14,6 @@ import "@langchain/openai";
13
14
  import "@arcgis/core/config.js";
14
15
  import "@arcgis/core/core/reactiveUtils.js";
15
16
  import "@arcgis/core/layers/FeatureLayer.js";
16
- import "@arcgis/core/request.js";
17
17
  import "@langchain/core/prompts";
18
18
  import "@langchain/langgraph/prebuilt";
19
19
  import "zod";