@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.
Files changed (75) hide show
  1. package/dist/agent-utils/LLMAgent.js +1 -0
  2. package/dist/cdn/{5CV7R5IS.js → 22IT5TDB.js} +2 -2
  3. package/dist/cdn/{EBISDZ5H.js → 4UDYY3HL.js} +1 -1
  4. package/dist/cdn/7PANDHIL.js +16 -0
  5. package/dist/cdn/ADYIXCSG.js +2 -0
  6. package/dist/cdn/CAECQD75.js +2 -0
  7. package/dist/cdn/{34SG44C3.js → CE6VDP2D.js} +1 -1
  8. package/dist/cdn/CI3QSFPS.js +2 -0
  9. package/dist/cdn/DEAYZ3MK.js +2 -0
  10. package/dist/cdn/{YLN2BZ5J.js → E2HENO3T.js} +1 -1
  11. package/dist/cdn/FWU6DFIB.js +2 -0
  12. package/dist/cdn/GBYLKQIL.js +2 -0
  13. package/dist/cdn/GPYYAQVI.js +2 -0
  14. package/dist/cdn/{ERL2CB2Y.js → I2Y67HBL.js} +5 -5
  15. package/dist/cdn/JG2BIENI.js +3 -0
  16. package/dist/cdn/JN744CAW.js +2 -0
  17. package/dist/cdn/K475UT3E.js +2 -0
  18. package/dist/cdn/{JLKGS6Y5.js → L4XF4H6V.js} +1 -1
  19. package/dist/cdn/M3SWPT3M.js +2 -0
  20. package/dist/cdn/MAV3DW27.js +4 -0
  21. package/dist/cdn/PB2ODJC7.js +2 -0
  22. package/dist/cdn/{QCSN44H4.js → QSA4T3BU.js} +1 -1
  23. package/dist/cdn/{R56X6ZKR.js → QYR3NSF2.js} +3 -3
  24. package/dist/cdn/RMLXVQZ5.js +2 -0
  25. package/dist/cdn/{T43LEBBE.js → S75VFYR4.js} +18 -18
  26. package/dist/cdn/SBHLUL3Q.js +2 -0
  27. package/dist/cdn/{X2ZDYHCG.js → TNMXWUXU.js} +9 -4
  28. package/dist/cdn/WH6QQK6N.js +2 -0
  29. package/dist/cdn/XBW4MWQR.js +2 -0
  30. package/dist/cdn/{Z2G7MP5L.js → XU6NCSE2.js} +1 -1
  31. package/dist/cdn/Z7UWJ4AI.js +3 -0
  32. package/dist/cdn/ZOSUDIJH.js +2 -0
  33. package/dist/cdn/ZPLFFLPF.js +2 -0
  34. package/dist/cdn/agent-utils/index.js +1 -1
  35. package/dist/cdn/index.js +1 -1
  36. package/dist/chunks/adapter.js +170 -169
  37. package/dist/chunks/arcgisKnowledgeGraph.js +8 -7
  38. package/dist/chunks/dataExplorationGraph.js +88 -76
  39. package/dist/chunks/data_explore_query_prompt.js +9 -4
  40. package/dist/chunks/generateLayerDescriptions.js +161 -159
  41. package/dist/chunks/helpGraph.js +3 -2
  42. package/dist/chunks/layerStylingGraph.js +1 -0
  43. package/dist/chunks/navigationGraph.js +3 -2
  44. package/dist/chunks/orchestrator.js +108 -107
  45. package/dist/chunks/toolCallResponse.js +10 -9
  46. package/dist/components/arcgis-assistant/customElement.js +136 -124
  47. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +3 -2
  48. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
  49. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +4 -3
  50. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
  51. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
  52. package/dist/docs/api.json +1 -1
  53. package/dist/docs/docs.json +1 -1
  54. package/dist/docs/web-types.json +1 -1
  55. package/package.json +5 -5
  56. package/dist/cdn/24QNMEFG.js +0 -2
  57. package/dist/cdn/3NBDVZ2I.js +0 -2
  58. package/dist/cdn/53NTYC4I.js +0 -2
  59. package/dist/cdn/AZGGTNA3.js +0 -2
  60. package/dist/cdn/B7WJFBOZ.js +0 -2
  61. package/dist/cdn/DZ2QWNUA.js +0 -3
  62. package/dist/cdn/F6QHMKF5.js +0 -2
  63. package/dist/cdn/H2CHHGGH.js +0 -2
  64. package/dist/cdn/HWKDNS4K.js +0 -4
  65. package/dist/cdn/IMQ4TVHF.js +0 -16
  66. package/dist/cdn/IRZDTYO2.js +0 -2
  67. package/dist/cdn/KHXUWZHB.js +0 -2
  68. package/dist/cdn/LIFK3QSD.js +0 -2
  69. package/dist/cdn/O3EN27N5.js +0 -2
  70. package/dist/cdn/PBO6FZN6.js +0 -2
  71. package/dist/cdn/Q3ZW4FYA.js +0 -3
  72. package/dist/cdn/UPEEHMSY.js +0 -2
  73. package/dist/cdn/WAIFKDR3.js +0 -2
  74. package/dist/cdn/XON27U6U.js +0 -2
  75. 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 p } from "@langchain/langgraph/web";
3
- import m, { z as r } from "zod";
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 H, summarizationMiddleware as J, modelCallLimitMiddleware as G } from "langchain";
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 F from "@arcgis/core/portal/Portal.js";
9
+ import q from "@arcgis/core/portal/Portal.js";
10
10
  import Z from "@arcgis/core/identity/IdentityManager.js";
11
- import ee from "@arcgis/core/config.js";
12
- const q = {
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
- }, k = {
17
+ }, I = {
17
18
  default: "text-embedding-ada-002"
18
- }, M = /* @__PURE__ */ new Map();
19
- let x = null;
20
- const te = () => {
21
- const t = F.getDefault().helperServices;
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 = te();
27
- M.size === 0 && (x || (x = (async () => {
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) => M.set(o.name, o));
33
+ (await n.json()).models.forEach((o) => T.set(o.name, o));
33
34
  } catch (n) {
34
- throw x = null, n;
35
+ throw M = null, n;
35
36
  }
36
- })()), await x);
37
- const s = M.get(e);
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
- }, ne = async (e = "default") => await U(q[e]), se = async (e = "default") => await U(k[e]), h = (e, t) => t, P = (e, t) => ({
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
- }), ie = () => ({
66
- agentExecutionContext: p({
66
+ }), oe = () => ({
67
+ agentExecutionContext: m({
67
68
  reducer: P,
68
69
  default: j
69
70
  }),
70
- outputMessage: p({
71
+ outputMessage: m({
71
72
  reducer: _,
72
73
  default: () => ""
73
74
  }),
74
- summary: p({
75
+ summary: m({
75
76
  reducer: h,
76
77
  default: () => ""
77
78
  }),
78
- status: p({
79
+ status: m({
79
80
  reducer: h
80
81
  })
81
- }), Pe = () => ({
82
- ...ie(),
83
- sharedStatePatch: p({
82
+ }), $e = () => ({
83
+ ...oe(),
84
+ sharedStatePatch: m({
84
85
  reducer: h
85
86
  })
86
- }), _e = p.Root({
87
- agentExecutionContext: p({
87
+ }), Ne = m.Root({
88
+ agentExecutionContext: m({
88
89
  default: j,
89
90
  reducer: P
90
91
  }),
91
- currentIntent: p({
92
+ currentIntent: m({
92
93
  default: () => "none",
93
94
  reducer: h
94
95
  }),
95
- lastExecutedAgent: p({
96
+ lastExecutedAgent: m({
96
97
  default: () => "",
97
98
  reducer: h
98
99
  }),
99
- requiresFollowUp: p({
100
+ requiresFollowUp: m({
100
101
  default: () => !0,
101
102
  reducer: h
102
103
  }),
103
- stepCount: p({
104
+ stepCount: m({
104
105
  default: () => 0,
105
106
  reducer: (e, t) => t ?? e + 1
106
107
  }),
107
- finalOutputMessage: p({
108
+ finalOutputMessage: m({
108
109
  default: () => "",
109
110
  reducer: _
110
111
  })
111
- }), oe = (e) => {
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
- }, re = (e) => {
117
+ }, ae = (e) => {
117
118
  const t = e?.configurable;
118
- return oe(t) ? t : void 0;
119
- }, ae = (e, t, s) => {
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
- }, I = async (e) => (await ae(/* @__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, ce = async (e) => {
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
- }, le = (e) => typeof e == "string" && e.length > 0 ? e : void 0, de = (e) => e && typeof e == "object" && "aborted" in e ? e : void 0, pe = (e) => {
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: le(t?.thread_id),
136
- abortSignal: de(t?.abortSignal),
137
- requestId: ee.applicationName
136
+ conversationId: de(t?.thread_id),
137
+ abortSignal: e?.signal,
138
+ requestId: pe(),
139
+ requestSource: me(te.applicationName)
138
140
  };
139
- }, N = async ({ config: e }) => {
140
- const t = F.getDefault(), n = (await Z.getCredential(`${t.url}/sharing`))?.token;
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: d, requestId: c } = pe(e), l = new Headers(o?.headers);
143
- l.delete("Authorization"), l.delete("api-key"), n && n.length > 0 && (l.set("X-Esri-Authorization", `Bearer ${n}`), l.set("X-Esri-Request-Source", "MapsSDK")), a && a.length > 0 && l.set("X-Esri-Conversation-Id", a), c && c.length > 0 && l.set("X-Esri-Request-Id", c);
144
- const u = d && o?.signal ? AbortSignal.any([d, o.signal]) : o?.signal ?? d;
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: l,
148
- signal: u
149
+ headers: d,
150
+ signal: y
149
151
  });
150
152
  };
151
- }, b = async (e = {}) => {
152
- const { modelTier: t = "default", temperature: s = 0, config: n } = e, i = q[t], o = await ne(t);
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 N({ config: n })
162
+ fetch: await $({ config: n })
161
163
  }
162
164
  });
163
- }, je = async (e = {}) => {
164
- const { tier: t = "default", config: s } = e, n = k[t], i = await se(t);
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 N({ config: s })
172
+ fetch: await $({ config: s })
171
173
  },
172
174
  batchSize: 2048,
173
175
  maxConcurrency: 10
174
176
  });
175
- }, me = r.object({
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(me);
181
- const C = (e) => JSON.stringify(e, null, 2), ue = (e) => {
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
- }, Ne = async (e, t) => {
189
- const s = re(t);
190
- if (s.abortSignal?.aborted)
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 I("intent_prompt"), d = C(o), c = ue(o), l = {
211
- registeredAgents: d,
212
- priorSteps: C(e.agentExecutionContext.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
- }, T = await D.fromTemplate(a).format(l), E = H({
215
- model: await b({
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: T,
221
- responseFormat: c,
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
- J({
227
- model: await b({
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
- G({ runLimit: 2 })
238
+ J({ runLimit: 2 })
237
239
  ]
238
- }), { structuredResponse: V } = await ce({
240
+ }), { structuredResponse: V } = await le({
239
241
  agent: E,
240
242
  messages: e.agentExecutionContext.messages,
241
243
  config: t
242
- }), y = c.parse(
244
+ }), w = l.parse(
243
245
  V ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
244
- ), v = y.intent ?? "none", z = {
246
+ ), x = w.intent ?? "none", z = {
245
247
  ...e,
246
- currentIntent: v,
247
- requiresFollowUp: y.requiresFollowUp,
248
+ currentIntent: x,
249
+ requiresFollowUp: w.requiresFollowUp,
248
250
  agentExecutionContext: {
249
251
  ...e.agentExecutionContext,
250
- assignedTask: y.assignedTask ?? ""
252
+ assignedTask: w.assignedTask ?? ""
251
253
  }
252
254
  };
253
- if (v === "none") {
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: v,
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: ${v}
281
- Task Assigned: ${y.assignedTask ?? ""}
282
- Requires Follow-Up: ${y.requiresFollowUp}`
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
- }, ge = "0.1", w = 1536, fe = "openai", he = k.default, ye = `Name: {name}
291
+ }, he = "0.1", b = 1536, ye = "openai", we = I.default, be = `Name: {name}
290
292
  Title: {title}
291
- Description: {description}`, we = `Name: {name}
293
+ Description: {description}`, ve = `Name: {name}
292
294
  Alias: {alias}
293
- Description: {description}`, $e = r.object({
294
- schemaVersion: r.literal(ge),
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(fe),
298
- model: r.literal(he),
299
- dimensions: r.literal(w),
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(ye),
302
- field: r.string().default(we)
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(w, {
312
- message: `Layer vector must be exactly ${w} dimensions`
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(w, {
320
- message: `Field vector must be exactly ${w} dimensions`
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
- }), be = (e) => {
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
- }, ve = async (e) => {
346
- const { promptText: t, modelTier: s, temperature: n, messages: i, config: o } = e, a = A(t, i ?? []), d = await b({ modelTier: s, temperature: n, config: o });
347
- return a.pipe(d);
348
- }, Oe = async (e) => {
349
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, config: a } = e, c = await (await ve({
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 c == "string")
357
- return c;
358
- const l = c.content;
359
- return typeof l == "string" ? l : JSON.stringify(l);
360
- }, $ = async (e) => {
361
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, schema: a, config: d } = e, c = A(t, i ?? []), u = (await b({ modelTier: s, temperature: n, config: d })).withStructuredOutput(a);
362
- return await c.pipe(u).invoke(o ?? {});
363
- }, Ve = async (e) => {
364
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, tools: a, config: d } = e, c = a.length > 0 ? be(i ?? []) : i ?? [], l = A(t, c), u = await b({ modelTier: s, temperature: n, config: d });
365
- return await l.pipe(u.bindTools(a)).invoke(o ?? {});
366
- }, xe = m.object({
367
- name: m.string(),
368
- description: m.string(),
369
- valueType: m.string(),
370
- alias: m.string()
371
- }), Te = m.object({
372
- fields: m.array(xe)
373
- }), O = (e, t) => e.getFieldAlias(t) ?? void 0, S = (e, t) => O(e, t.name) ?? t.alias ?? "", Me = (e, t) => {
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 R(e, t) {
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((c) => c.name === n.name), o = S(e, n), a = Me(e, n), d = {
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, d);
390
+ s.set(n.name, c);
389
391
  }
390
392
  return s;
391
393
  }
392
- const ze = async (e) => {
393
- const s = await I("field_descriptions_prompt"), n = e.fields.filter((a) => !(S(e, a) && a.description)).map((a) => {
394
- const { name: d, type: c, description: l } = a, u = S(e, a);
395
- return [`Name: ${d}`, `Type: ${c}`, `Alias: ${u}`, `Description: ${l ?? "N/A"}`].join(", ");
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 R(e, { fields: [] });
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: Te,
410
+ schema: Se,
409
411
  inputVariables: i
410
412
  });
411
- return R(e, o);
412
- }, Se = m.object({
413
- title: m.string(),
414
- description: m.string(),
415
- name: m.string().nullable()
416
- }), Le = async (e, t) => {
417
- const n = await I("layer_descriptions_prompt"), i = Array.from(t.values()), o = {
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: Se,
428
+ schema: ke,
427
429
  inputVariables: o
428
430
  }), name: e.title ?? null };
429
431
  };
430
432
  export {
431
- _e as D,
432
- $e as W,
433
- Le as a,
434
- fe as b,
435
- b as c,
436
- w as d,
437
- Oe as e,
438
- we as f,
439
- ze as g,
440
- Ve as h,
441
- $ as i,
442
- ie as j,
443
- Pe as k,
444
- ye as l,
445
- he as m,
446
- se as n,
447
- re as o,
448
- Ne as p,
449
- je as q,
450
- ge as s
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
  };
@@ -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"_`, G = {
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
- G as H
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?”_`, ye = {
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
- ye as N
270
+ ve as N
270
271
  };