@arcgis/ai-agents 5.0.0-next.139 → 5.0.0-next.141

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/index.js CHANGED
@@ -1,46 +1,46 @@
1
- import { Annotation as g, messagesStateReducer as j, StateGraph as _, START as M, END as x, NodeInterrupt as Oe } from "@langchain/langgraph/web";
2
- import { invokeToolPrompt as N, sendTraceMessage as m, invokeStructuredPrompt as we, invokeTextPrompt as be, sendUXSuggestion as E } from "@arcgis/ai-orchestrator";
1
+ import { Annotation as g, messagesStateReducer as A, StateGraph as N, START as k, END as x, NodeInterrupt as Pe } from "@langchain/langgraph/web";
2
+ import { invokeToolPrompt as _, sendTraceMessage as m, invokeStructuredPrompt as be, invokeTextPrompt as J, sendUXSuggestion as $ } from "@arcgis/ai-orchestrator";
3
3
  import { tool as f } from "@langchain/core/tools";
4
- import Pe from "@arcgis/core/Graphic.js";
5
- import J from "@arcgis/core/geometry/Point.js";
4
+ import We from "@arcgis/core/Graphic.js";
5
+ import Y from "@arcgis/core/geometry/Point.js";
6
6
  import Se from "@arcgis/core/geometry/Extent.js";
7
- import Be from "@arcgis/core/symbols/SimpleMarkerSymbol.js";
8
- import { addressToLocations as Ge } from "@arcgis/core/rest/locator.js";
7
+ import Ge from "@arcgis/core/symbols/SimpleMarkerSymbol.js";
8
+ import { addressToLocations as Be } from "@arcgis/core/rest/locator.js";
9
9
  import i, { z as q } from "zod";
10
- import { HumanMessage as ve, AIMessage as B } from "@langchain/core/messages";
11
- import { ToolNode as A } from "@langchain/langgraph/prebuilt";
10
+ import { HumanMessage as ve, AIMessage as Q } from "@langchain/core/messages";
11
+ import { ToolNode as j } from "@langchain/langgraph/prebuilt";
12
12
  import Te from "@arcgis/core/layers/support/FeatureEffect.js";
13
- import V from "@arcgis/core/layers/support/FeatureFilter.js";
14
- import * as Y from "@arcgis/core/geometry/operators/unionOperator.js";
15
- import X from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
16
- import ee from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
13
+ import D from "@arcgis/core/layers/support/FeatureFilter.js";
14
+ import * as X from "@arcgis/core/geometry/operators/unionOperator.js";
15
+ import ee from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
16
+ import te from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
17
17
  import xe from "@arcgis/core/rest/support/TopFeaturesQuery.js";
18
18
  import Ee from "@arcgis/core/rest/support/TopFilter.js";
19
- import te from "@arcgis/core/rest/support/Query.js";
20
- import * as We from "@arcgis/core/geometry/operators/bufferOperator.js";
21
- import { createRenderer as Ue } from "@arcgis/core/smartMapping/renderers/pieChart.js";
22
- import { getSchemesByTag as He, getSchemes as Ze } from "@arcgis/core/smartMapping/symbology/pieChart.js";
23
- import { getBackgroundColorTheme as de } from "@arcgis/core/views/support/colorUtils.js";
24
- import { createAgeRenderer as Ke, createContinuousRenderer as Je } from "@arcgis/core/smartMapping/renderers/color.js";
25
- import { getSchemesByTag as re } from "@arcgis/core/smartMapping/symbology/color.js";
26
- import { createContinuousRenderer as Ye } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
27
- import { createRenderer as Xe } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
28
- import { getSchemesByTag as et } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
29
- import { createRenderer as tt } from "@arcgis/core/smartMapping/renderers/heatmap.js";
30
- import { getSchemesByTag as rt } from "@arcgis/core/smartMapping/symbology/heatmap.js";
31
- import { createRenderer as at } from "@arcgis/core/smartMapping/renderers/predominance.js";
32
- import { getSchemesByTag as ot } from "@arcgis/core/smartMapping/symbology/predominance.js";
33
- import { createRenderer as st } from "@arcgis/core/smartMapping/renderers/relationship.js";
34
- import { getSchemesByTag as it } from "@arcgis/core/smartMapping/symbology/relationship.js";
35
- import { createAgeRenderer as nt, createContinuousRenderer as lt } from "@arcgis/core/smartMapping/renderers/size.js";
36
- import { createRenderer as ct } from "@arcgis/core/smartMapping/renderers/type.js";
37
- import { getSchemesByTag as dt } from "@arcgis/core/smartMapping/symbology/type.js";
19
+ import re from "@arcgis/core/rest/support/Query.js";
20
+ import * as Ue from "@arcgis/core/geometry/operators/bufferOperator.js";
21
+ import { createRenderer as He } from "@arcgis/core/smartMapping/renderers/pieChart.js";
22
+ import { getSchemesByTag as Ze, getSchemes as Ke } from "@arcgis/core/smartMapping/symbology/pieChart.js";
23
+ import { getBackgroundColorTheme as ue } from "@arcgis/core/views/support/colorUtils.js";
24
+ import { createAgeRenderer as Je, createContinuousRenderer as Ye } from "@arcgis/core/smartMapping/renderers/color.js";
25
+ import { getSchemesByTag as ae } from "@arcgis/core/smartMapping/symbology/color.js";
26
+ import { createContinuousRenderer as Xe } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
27
+ import { createRenderer as et } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
28
+ import { getSchemesByTag as tt } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
29
+ import { createRenderer as rt } from "@arcgis/core/smartMapping/renderers/heatmap.js";
30
+ import { getSchemesByTag as at } from "@arcgis/core/smartMapping/symbology/heatmap.js";
31
+ import { createRenderer as ot } from "@arcgis/core/smartMapping/renderers/predominance.js";
32
+ import { getSchemesByTag as st } from "@arcgis/core/smartMapping/symbology/predominance.js";
33
+ import { createRenderer as it } from "@arcgis/core/smartMapping/renderers/relationship.js";
34
+ import { getSchemesByTag as nt } from "@arcgis/core/smartMapping/symbology/relationship.js";
35
+ import { createAgeRenderer as lt, createContinuousRenderer as ct } from "@arcgis/core/smartMapping/renderers/size.js";
36
+ import { createRenderer as dt } from "@arcgis/core/smartMapping/renderers/type.js";
37
+ import { getSchemesByTag as ut } from "@arcgis/core/smartMapping/symbology/type.js";
38
38
  const $e = g.Root({
39
39
  // messages: comes from global chat history.
40
40
  // It is safe to append new messages locally, but existing message objects
41
41
  // must be treated as read-only and never mutated.
42
42
  messages: g({
43
- reducer: j,
43
+ reducer: A,
44
44
  default: () => []
45
45
  }),
46
46
  // Accumulates user-visible output across graph nodes.
@@ -77,10 +77,10 @@ ${t}`;
77
77
  reducer: (e, r) => r
78
78
  })
79
79
  });
80
- async function ut(e, r) {
80
+ async function ht(e, r) {
81
81
  const t = "https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer";
82
82
  console.log(`[goToAddress] Geocoding: ${e}`);
83
- const o = (await Ge(t, {
83
+ const o = (await Be(t, {
84
84
  address: { SingleLine: e },
85
85
  outFields: ["Match_addr"]
86
86
  }))?.[0];
@@ -92,42 +92,42 @@ async function ut(e, r) {
92
92
  xmax: n,
93
93
  ymax: c,
94
94
  spatialReference: d
95
- }), h = (s + n) / 2, p = (l + c) / 2, y = new J({
95
+ }), h = (s + n) / 2, p = (l + c) / 2, y = new Y({
96
96
  x: h,
97
97
  y: p,
98
98
  spatialReference: d
99
- }), w = new Be({
99
+ }), w = new Ge({
100
100
  style: "circle",
101
101
  color: "red",
102
102
  size: 12
103
- }), b = new Pe({
103
+ }), S = new We({
104
104
  geometry: y,
105
105
  symbol: w
106
106
  });
107
- return r.graphics.removeAll(), r.graphics.add(b), await r.goTo(u), `Successfully zoomed to: ${o.address}. Location coordinates: x=${h}, y=${p}, wkid=${d.wkid}`;
107
+ return r.graphics.removeAll(), r.graphics.add(S), await r.goTo(u), `Successfully zoomed to: ${o.address}. Location coordinates: x=${h}, y=${p}, wkid=${d.wkid}`;
108
108
  }
109
- const ht = ["mapView"];
109
+ const mt = ["mapView"];
110
110
  function R(e) {
111
111
  const t = e?.configurable?.context;
112
112
  if (!t || typeof t != "object")
113
113
  throw new Error("NavigationAgent context missing");
114
- const a = ht.filter((o) => !(o in t));
114
+ const a = mt.filter((o) => !(o in t));
115
115
  if (a.length)
116
116
  throw new Error(`NavigationAgent context missing: ${a.join(", ")}`);
117
117
  return t;
118
118
  }
119
- async function mt({ address: e }, r) {
119
+ async function yt({ address: e }, r) {
120
120
  const { mapView: t } = R(r);
121
- return await ut(e, t);
121
+ return await ht(e, t);
122
122
  }
123
- const yt = i.object({
123
+ const pt = i.object({
124
124
  address: i.string().describe("The full address or place name to locate.")
125
- }), pt = f(mt, {
125
+ }), gt = f(yt, {
126
126
  name: "goToAddress",
127
127
  description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
128
- schema: yt
128
+ schema: pt
129
129
  });
130
- async function gt(e, r) {
130
+ async function ft(e, r) {
131
131
  const a = r.map.bookmarks;
132
132
  if (!a || a.length === 0)
133
133
  throw new Error("No bookmarks found in the map.");
@@ -139,18 +139,18 @@ async function gt(e, r) {
139
139
  throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
140
140
  return await r.goTo(s), `Navigated to bookmark: ${e}`;
141
141
  }
142
- async function ft({ bookmarkName: e }, r) {
142
+ async function wt({ bookmarkName: e }, r) {
143
143
  const { mapView: t } = R(r);
144
- return await Promise.resolve(gt(e, t));
144
+ return await Promise.resolve(ft(e, t));
145
145
  }
146
- const wt = q.object({
146
+ const bt = q.object({
147
147
  bookmarkName: q.string().describe("The name of the bookmark to navigate to.")
148
- }), bt = f(ft, {
148
+ }), St = f(wt, {
149
149
  name: "goToBookmark",
150
150
  description: "Go to the extent of the bookmark with the given name.",
151
- schema: wt
151
+ schema: bt
152
152
  });
153
- async function St(e, r, t) {
153
+ async function vt(e, r, t) {
154
154
  const a = t.map?.allLayers.find((s) => s.id === e);
155
155
  if (!a)
156
156
  return `Error: Layer with id ${e} not found`;
@@ -169,19 +169,19 @@ async function St(e, r, t) {
169
169
  return console.error("Error in goToFeatures:", s), `Error: ${s instanceof Error ? s.message : "Unknown error"}`;
170
170
  }
171
171
  }
172
- async function vt({ layerId: e, where: r }, t) {
172
+ async function Tt({ layerId: e, where: r }, t) {
173
173
  const { mapView: a } = R(t);
174
- return await St(e, r, a);
174
+ return await vt(e, r, a);
175
175
  }
176
- const Tt = q.object({
176
+ const xt = q.object({
177
177
  layerId: q.string().describe("The layerId of the layer to zoom to."),
178
178
  where: q.string().describe("The sql-92 where clause used to query features to zoom to")
179
- }), xt = f(vt, {
179
+ }), Et = f(Tt, {
180
180
  name: "goToFeatures",
181
181
  description: "Go to the features that match the given filter related to the given layerId.",
182
- schema: Tt
182
+ schema: xt
183
183
  });
184
- async function Et(e) {
184
+ async function $t(e) {
185
185
  const t = new Se({
186
186
  xmin: -180,
187
187
  ymin: -90,
@@ -191,16 +191,16 @@ async function Et(e) {
191
191
  }).expand(0.7);
192
192
  return await e.goTo(t), "Successfully zoomed to world extent";
193
193
  }
194
- async function $t(e, r) {
194
+ async function Ft(e, r) {
195
195
  const { mapView: t } = R(r);
196
- return await Et(t);
196
+ return await $t(t);
197
197
  }
198
- const Ft = q.object({}), Rt = f($t, {
198
+ const Rt = q.object({}), Lt = f(Ft, {
199
199
  name: "goToFullExtent",
200
200
  description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
201
- schema: Ft
201
+ schema: Rt
202
202
  });
203
- async function Lt(e) {
203
+ async function It(e) {
204
204
  const t = e.map.initialViewProperties?.viewpoint?.targetGeometry;
205
205
  if (t)
206
206
  await e.goTo(t);
@@ -208,16 +208,16 @@ async function Lt(e) {
208
208
  throw new Error("Initial extent is undefined");
209
209
  return "Successfully zoomed to home extent";
210
210
  }
211
- async function It(e, r) {
211
+ async function qt(e, r) {
212
212
  const { mapView: t } = R(r);
213
- return await Lt(t);
213
+ return await It(t);
214
214
  }
215
- const qt = i.object({}), Ct = f(It, {
215
+ const zt = i.object({}), Ct = f(qt, {
216
216
  name: "goToHomeExtent",
217
217
  description: "Go to the initial web map view extent",
218
- schema: qt
218
+ schema: zt
219
219
  });
220
- async function zt(e, r) {
220
+ async function At(e, r) {
221
221
  await r.when();
222
222
  const t = r.map?.allLayers.find((o) => o.id === e);
223
223
  if (!t)
@@ -228,32 +228,32 @@ async function zt(e, r) {
228
228
  }
229
229
  async function Nt({ layerId: e }, r) {
230
230
  const { mapView: t } = R(r);
231
- return await zt(e, t);
231
+ return await At(e, t);
232
232
  }
233
- const At = q.object({
233
+ const kt = q.object({
234
234
  layerId: q.string().describe("The id of the layer to navigate to")
235
- }), kt = f(Nt, {
235
+ }), _t = f(Nt, {
236
236
  name: "goToLayer",
237
237
  description: "Zooms the map view to the full extent of the top matching layer.",
238
- schema: At
238
+ schema: kt
239
239
  });
240
240
  async function jt(e, r) {
241
241
  return await r.goTo({ scale: e }), `Successfully zoomed to: ${e}`;
242
242
  }
243
- async function _t({ scale: e }, r) {
243
+ async function Mt({ scale: e }, r) {
244
244
  const { mapView: t } = R(r);
245
245
  return await jt(e, t);
246
246
  }
247
- const Mt = i.object({
247
+ const Vt = i.object({
248
248
  scale: i.number().describe("The map scale of the view to go to.")
249
- }), Vt = f(_t, {
249
+ }), Dt = f(Mt, {
250
250
  name: "goToScale",
251
251
  description: "Go to the specified view scale.",
252
- schema: Mt
252
+ schema: Vt
253
253
  });
254
- async function Dt(e, r, t) {
254
+ async function Qt(e, r, t) {
255
255
  const o = {
256
- target: new J({
256
+ target: new Y({
257
257
  longitude: e.longitude,
258
258
  latitude: e.latitude,
259
259
  spatialReference: { wkid: 4326 }
@@ -265,52 +265,54 @@ async function Dt(e, r, t) {
265
265
  t?.scale !== void 0 ? `scale 1:${t.scale}` : ""
266
266
  ].filter(Boolean).join(", ")}`;
267
267
  }
268
- async function Qt({
268
+ async function Ot({
269
269
  center: e,
270
270
  zoom: r,
271
271
  scale: t
272
272
  }, a) {
273
273
  const { mapView: o } = R(a);
274
- return await Dt(e, o, { zoom: r, scale: t });
274
+ return await Qt(e, o, { zoom: r, scale: t });
275
275
  }
276
- const Ot = i.object({
276
+ const Pt = i.object({
277
277
  center: i.object({
278
278
  longitude: i.number().describe("The longitude (x-coordinate) of the point to navigate to."),
279
279
  latitude: i.number().describe("The latitude (y-coordinate) of the point to navigate to.")
280
280
  }),
281
281
  zoom: i.number().optional().describe("The zoom level. Higher values = more zoomed in."),
282
282
  scale: i.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
283
- }), Pt = f(Qt, {
283
+ }), Wt = f(Ot, {
284
284
  name: "goToViewpoint",
285
285
  description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
286
- schema: Ot
286
+ schema: Pt
287
287
  });
288
- async function Bt(e, r) {
288
+ async function Gt(e, r) {
289
289
  return await r.goTo({ zoom: e }), `Successfully zoomed to: ${e}`;
290
290
  }
291
- async function Gt({ zoom: e }, r) {
291
+ async function Bt({ zoom: e }, r) {
292
292
  const { mapView: t } = R(r);
293
- return await Bt(e, t);
293
+ return await Gt(e, t);
294
294
  }
295
- const Wt = i.object({
295
+ const Ut = i.object({
296
296
  zoom: i.number().min(1).max(20).describe("The zoom level of the view to go to.")
297
- }), Ut = f(Gt, {
297
+ }), Ht = f(Bt, {
298
298
  name: "goToZoom",
299
299
  description: 'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',
300
- schema: Wt
301
- }), ae = [
302
- pt,
303
- bt,
304
- xt,
305
- Rt,
300
+ schema: Ut
301
+ }), oe = [
302
+ gt,
303
+ St,
304
+ Et,
305
+ Lt,
306
306
  Ct,
307
- kt,
308
- Vt,
309
- Pt,
310
- Ut
311
- ], ue = /* @__PURE__ */ Object.assign({
307
+ _t,
308
+ Dt,
309
+ Wt,
310
+ Ht
311
+ ], he = /* @__PURE__ */ Object.assign({
312
312
  "../agents/dataExploration/prompts/data_explore_filter_prompt.md": () => import("./data_explore_filter_prompt-CpgEu_mo.js").then((e) => e.default),
313
313
  "../agents/dataExploration/prompts/data_explore_query_prompt.md": () => import("./data_explore_query_prompt-CtSDS9l_.js").then((e) => e.default),
314
+ "../agents/dataExploration/prompts/summarize_query_response_prompt.md": () => import("./summarize_query_response_prompt-CeugxjZK.js").then((e) => e.default),
315
+ "../agents/help/prompts/help_prompt.md": () => import("./help_prompt-wgcBcna5.js").then((e) => e.default),
314
316
  "../agents/layerFilter/prompts/layer_filter_prompt.md": () => import("./layer_filter_prompt-0ujK87_y.js").then((e) => e.default),
315
317
  "../agents/layerQuery/prompts/data_query_prompt.md": () => import("./data_query_prompt-N4YzctpM.js").then((e) => e.default),
316
318
  "../agents/layerQuery/prompts/summarize_query_response_prompt.md": () => import("./summarize_query_response_prompt-DBJy1AAu.js").then((e) => e.default),
@@ -320,25 +322,25 @@ const Wt = i.object({
320
322
  "../agents/navigation/prompts/navigation_intent_prompt.md": () => import("./navigation_intent_prompt-DEERQeWD.js").then((e) => e.default),
321
323
  "../agents/navigation/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt-C2jIBkeu.js").then((e) => e.default)
322
324
  });
323
- async function $(e) {
324
- const r = Object.entries(ue).find(([t]) => t.endsWith(`/${e}.md`));
325
+ async function E(e) {
326
+ const r = Object.entries(he).find(([t]) => t.endsWith(`/${e}.md`));
325
327
  if (console.log(`entry for prompt "${e}":`, r), !r)
326
328
  throw new Error(`Prompt not found: ${e}
327
329
  Available prompts:
328
- ${Object.keys(ue).join(`
330
+ ${Object.keys(he).join(`
329
331
  `)}`);
330
332
  return await r[1]();
331
333
  }
332
- const Ht = (e, r = 3) => e.filter((t) => t instanceof ve).slice(-r), v = (e, r = 3) => {
334
+ const Zt = (e, r = 3) => e.filter((t) => t instanceof ve).slice(-r), v = (e, r = 3) => {
333
335
  const t = e.map((o, s) => o instanceof ve ? s : -1).filter((o) => o !== -1);
334
336
  if (t.length === 0)
335
337
  return [];
336
338
  const a = t.length > r ? t[t.length - r] : t[0];
337
339
  return e.slice(a);
338
- }, L = (e, r = " ") => Ht(e).map((o) => o.content).join(r).trim();
339
- async function Zt(e, r) {
340
- const t = await $("navigation_tool_prompt"), { mapView: a } = R(r), o = a.map, s = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
341
- (b, T) => `${T + 1}. layerId=${b.id} | title=${b.title ?? ""} | name=${b.name ?? ""} | score=${b.score.toFixed(2)}`
340
+ }, L = (e, r = " ") => Zt(e).map((o) => o.content).join(r).trim();
341
+ async function Kt(e, r) {
342
+ const t = await E("navigation_tool_prompt"), { mapView: a } = R(r), o = a.map, s = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
343
+ (S, T) => `${T + 1}. layerId=${S.id} | title=${S.title ?? ""} | name=${S.name ?? ""} | score=${S.score.toFixed(2)}`
342
344
  ).join(`
343
345
  `) : "", l = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", n = e.intent === "goToBookmark" && o.bookmarks?.length ? `Available bookmarks:
344
346
  ${JSON.stringify(o.bookmarks, null, 2)}` : "", c = (e.intent === "goToLayer" || e.intent === "goToFeatures") && e.vectorSearchLayerResults?.length ? `Candidate layers:
@@ -349,16 +351,16 @@ ${l}` : "", u = {
349
351
  layersSection: c,
350
352
  fieldsSection: d,
351
353
  currentZoom: a.zoom
352
- }, h = await N({
354
+ }, h = await _({
353
355
  promptText: t,
354
356
  messages: v(e.messages),
355
357
  inputVariables: u,
356
- tools: ae
358
+ tools: oe
357
359
  }), p = [...e.messages, h], w = (h.tool_calls?.length ?? 0) > 0 ? [...p] : [...p, h];
358
360
  return { ...e, messages: w };
359
361
  }
360
- async function Kt(e, r) {
361
- const a = await new A(ae).invoke(
362
+ async function Jt(e, r) {
363
+ const a = await new j(oe).invoke(
362
364
  {
363
365
  messages: v(e.messages)
364
366
  },
@@ -370,9 +372,9 @@ async function Kt(e, r) {
370
372
  `);
371
373
  return { ...e, messages: s, outputMessage: l };
372
374
  }
373
- async function Jt(e) {
374
- const r = await $("navigation_intent_prompt"), a = {
375
- tools: ae.map((n) => ({
375
+ async function Yt(e) {
376
+ const r = await E("navigation_intent_prompt"), a = {
377
+ tools: oe.map((n) => ({
376
378
  name: n.name,
377
379
  description: n.description,
378
380
  schema: n.schema
@@ -380,7 +382,7 @@ async function Jt(e) {
380
382
  `)
381
383
  }, o = i.object({
382
384
  intent: i.string()
383
- }), s = await we({
385
+ }), s = await be({
384
386
  promptText: r,
385
387
  modelTier: "fast",
386
388
  messages: v(e.messages),
@@ -389,18 +391,18 @@ async function Jt(e) {
389
391
  }), l = typeof s.intent == "string" ? s.intent.trim().replace(/^"|"$/gu, "") : "";
390
392
  return { ...e, intent: l || "" };
391
393
  }
392
- const S = (e, r) => {
394
+ const b = (e, r) => {
393
395
  const a = e?.configurable?.services?.[r];
394
396
  if (a == null)
395
397
  throw new Error(`${r} missing in config.configurable.services`);
396
398
  return a;
397
- }, Yt = 0.7, Xt = async (e, r) => {
399
+ }, Xt = 0.7, er = async (e, r) => {
398
400
  try {
399
401
  const t = L(e.messages);
400
402
  await m({ text: `Similarity search to find layers: ${t}` }, r);
401
- const a = S(r, "layerSearch"), o = S(r, "layersAndFieldsRegistry"), l = (await a.searchLayers({
403
+ const a = b(r, "layerSearch"), o = b(r, "layersAndFieldsRegistry"), l = (await a.searchLayers({
402
404
  text: t,
403
- minScore: Yt
405
+ minScore: Xt
404
406
  })).map(({ id: c, score: d }) => {
405
407
  const u = o.get(c)?.layerItem;
406
408
  return {
@@ -423,18 +425,18 @@ ${l.map((c) => `- layerId=${c.id} | title=${c.title ?? ""} | name=${c.name ?? ""
423
425
  r
424
426
  ), t;
425
427
  }
426
- }, he = 0.7, er = 10, tr = async (e, r) => {
428
+ }, me = 0.7, tr = 10, rr = async (e, r) => {
427
429
  try {
428
430
  const t = L(e.messages);
429
431
  await m({ text: "Similarity search to find fields" }, r);
430
- const a = S(r, "fieldSearch"), o = S(r, "layersAndFieldsRegistry"), s = e.vectorSearchLayerResults?.map((d) => d.id) ?? [];
432
+ const a = b(r, "fieldSearch"), o = b(r, "layersAndFieldsRegistry"), s = e.vectorSearchLayerResults?.map((d) => d.id) ?? [];
431
433
  if (s.length === 0)
432
434
  return await m({ text: "No candidate layers for field search" }, r), e;
433
435
  const n = (await a.searchFields({
434
436
  text: t,
435
437
  layerIds: s,
436
- minScore: he,
437
- topResults: er
438
+ minScore: me,
439
+ topResults: tr
438
440
  })).map(({ layerId: d, results: u }) => {
439
441
  const h = o.get(d)?.fieldRegistry;
440
442
  return {
@@ -460,7 +462,7 @@ ${n.map(
460
462
  ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
461
463
  `)}`
462
464
  ).join(`
463
- `)}` : c = `No vector search field results found for score over ${he}.`, await m({ text: c }, r), {
465
+ `)}` : c = `No vector search field results found for score over ${me}.`, await m({ text: c }, r), {
464
466
  ...e,
465
467
  vectorSearchFieldResults: n
466
468
  };
@@ -470,13 +472,13 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
470
472
  r
471
473
  ), t;
472
474
  }
473
- }, D = (e, r) => (t, a) => {
475
+ }, M = (e, r) => (t, a) => {
474
476
  const o = a?.configurable?.services;
475
477
  for (const s of e)
476
478
  if (!o?.[s])
477
479
  throw new Error(`${r} requires services.${s} to be available.`);
478
480
  return t;
479
- }, rr = (e, r) => D(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, r), ar = () => new _($e).addNode("requireNavigationServices", rr).addNode("intentLLM", Jt).addNode("vectorSearchLayers", Xt).addNode("vectorSearchFields", tr).addNode("agent", Zt).addNode("tools", Kt).addEdge(M, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
481
+ }, ar = (e, r) => M(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, r), or = () => new N($e).addNode("requireNavigationServices", ar).addNode("intentLLM", Yt).addNode("vectorSearchLayers", er).addNode("vectorSearchFields", rr).addNode("agent", Kt).addNode("tools", Jt).addEdge(k, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
480
482
  "intentLLM",
481
483
  (r) => r.intent === "goToLayer" || r.intent === "goToFeatures" ? "vectorSearchLayers" : "agent",
482
484
  {
@@ -490,7 +492,7 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
490
492
  vectorSearchFields: "vectorSearchFields",
491
493
  agent: "agent"
492
494
  }
493
- ).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", x), or = String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
495
+ ).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", x), sr = String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
494
496
  This includes zooming, panning, centering, or geocoding based on user input. The agent is designed to handle explicit map movement requests. NOTE: DO NOT call this agent if the user asks "where is... " or "show me...", that is meant to be handled by another agent.
495
497
 
496
498
  Supported actions:
@@ -508,16 +510,16 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
508
510
  _Example: “Center the map on San Francisco at scale 50000”_
509
511
  _Example: “Zoom to the features in the schools layer where city = 'Austin'”_
510
512
  _Example: “Go to the Downtown bookmark”_
511
- _Example: “Zoom to 1600 Pennsylvania Ave”_`, $i = {
513
+ _Example: “Zoom to 1600 Pennsylvania Ave”_`, Ci = {
512
514
  id: "navigation",
513
515
  name: "Navigation Agent",
514
- description: or,
515
- createGraph: ar,
516
+ description: sr,
517
+ createGraph: or,
516
518
  workspace: $e
517
519
  }, Fe = g.Root({
518
520
  // Inputs coming from global context
519
521
  messages: g({
520
- reducer: j,
522
+ reducer: A,
521
523
  default: () => []
522
524
  }),
523
525
  // Accumulates user-visible output across graph nodes.
@@ -547,7 +549,7 @@ ${t}`;
547
549
  vectorSearchFieldResults: g(),
548
550
  layerFieldInfo: g(),
549
551
  queryResponse: g()
550
- }), sr = async (e, r) => (await m({ text: "Exiting Data Exploration agent" }, r), e), Q = async (e, r) => {
552
+ }), ir = async (e, r) => (await m({ text: "Exiting Data Exploration agent" }, r), e), O = async (e, r) => {
551
553
  const t = e.tool_calls ?? [];
552
554
  if (t.length === 0) {
553
555
  await m({ text: `LLM did not request any tool calls: ${String(e?.content)}` }, r);
@@ -561,7 +563,7 @@ ${t}`;
561
563
  )
562
564
  )
563
565
  ), console.log("LLM response:", JSON.stringify(e.tool_calls, null, 2));
564
- }, oe = async (e, r, t) => {
566
+ }, se = async (e, r, t) => {
565
567
  const a = e.map?.allLayers.find((s) => s.id === r), o = a.createQuery();
566
568
  o.where = t ?? "1=1";
567
569
  try {
@@ -576,36 +578,36 @@ ${t}`;
576
578
  error: s instanceof Error ? s.message : String(s)
577
579
  };
578
580
  }
579
- }, ir = async (e, r, t) => {
581
+ }, nr = async (e, r, t) => {
580
582
  const a = t.map?.allLayers.find((l) => l.id === e);
581
583
  if (!a)
582
584
  return `Could not find layer with ID: ${e}`;
583
585
  a.definitionExpression = r, a.visible = !0;
584
- const o = await oe(t, e, r), s = a.title ?? a.layerId;
586
+ const o = await se(t, e, r), s = a.title ?? a.layerId;
585
587
  return o.success ? `Applied definition expression to layer "${a.title ?? e}": ${r}` : `Applied filter to "${s}" but no features matched. ${o.error}`;
586
- }, nr = ["mapView"];
587
- function C(e) {
588
+ }, lr = ["mapView"];
589
+ function z(e) {
588
590
  const t = e?.configurable?.context;
589
591
  if (!t || typeof t != "object")
590
592
  throw new Error("DataExplorationAgent context missing");
591
- const a = nr.filter((o) => !(o in t));
593
+ const a = lr.filter((o) => !(o in t));
592
594
  if (a.length)
593
595
  throw new Error(`DataExplorationAgent context missing: ${a.join(", ")}`);
594
596
  return t;
595
597
  }
596
- const lr = async ({
598
+ const cr = async ({
597
599
  layerId: e,
598
600
  definitionExpression: r
599
601
  }, t) => {
600
- const { mapView: a } = C(t);
601
- return await ir(e, r, a);
602
- }, cr = i.object({
602
+ const { mapView: a } = z(t);
603
+ return await nr(e, r, a);
604
+ }, dr = i.object({
603
605
  layerId: i.string().describe("The layerId of the layer on which to set a definitionExpression."),
604
606
  definitionExpression: i.string().describe("The SQL-92 where clause used to set a definition expression on the layer.")
605
- }), dr = f(lr, {
607
+ }), ur = f(cr, {
606
608
  name: "setDefinitionExpression",
607
609
  description: "Set a SQL-92 where clause to the definition expression of a layer (i.e. a server-side filter). This filters features at the server level, affecting all views of the layer. Do not prioritize this tool unless specifically asked for or implied for server level, affecting all views of the layer.",
608
- schema: cr
610
+ schema: dr
609
611
  });
610
612
  function H(e) {
611
613
  return "point" in e && e.point !== void 0;
@@ -613,10 +615,10 @@ function H(e) {
613
615
  function Z(e) {
614
616
  return "layerId" in e && e.layerId !== void 0;
615
617
  }
616
- const O = async (e, r) => {
618
+ const P = async (e, r) => {
617
619
  if (H(e)) {
618
620
  const { point: t } = e;
619
- return { geometry: new J({
621
+ return { geometry: new Y({
620
622
  x: t.x,
621
623
  y: t.y,
622
624
  spatialReference: t.spatialReference ? { wkid: t.spatialReference.wkid } : r.spatialReference
@@ -645,7 +647,7 @@ const O = async (e, r) => {
645
647
  return { error: "The geometry of the first feature is undefined or null." };
646
648
  o = s;
647
649
  } else {
648
- const s = a.features.map((n) => n.geometry), l = Y.executeMany(s);
650
+ const s = a.features.map((n) => n.geometry), l = X.executeMany(s);
649
651
  if (!l)
650
652
  return { error: "Failed to create a combined geometry." };
651
653
  o = l;
@@ -656,7 +658,7 @@ const O = async (e, r) => {
656
658
  }
657
659
  }
658
660
  return { error: "Invalid geometry configuration provided" };
659
- }, ur = async (e, r, t, a, o) => {
661
+ }, hr = async (e, r, t, a, o) => {
660
662
  const s = r.map?.allLayers.find(
661
663
  (d) => d.id === e.layerId
662
664
  );
@@ -664,13 +666,13 @@ const O = async (e, r) => {
664
666
  return `Could not find target layer with ID: ${e.layerId}`;
665
667
  let l;
666
668
  if (o) {
667
- const d = await O(o, r);
669
+ const d = await P(o, r);
668
670
  if ("error" in d)
669
671
  return d.error;
670
672
  l = d.geometry;
671
673
  }
672
674
  s.featureEffect = null, s.featureEffect = new Te({
673
- filter: new V({
675
+ filter: new D({
674
676
  where: e.where,
675
677
  geometry: l,
676
678
  spatialRelationship: "intersects",
@@ -680,21 +682,21 @@ const O = async (e, r) => {
680
682
  includedEffect: t,
681
683
  excludedEffect: a
682
684
  }), s.visible = !0;
683
- const n = await oe(
685
+ const n = await se(
684
686
  r,
685
687
  o ? o.layerId : e.layerId,
686
688
  o ? o.where : e.where
687
689
  ), c = s.title ?? e.layerId;
688
690
  return n.success ? `Applied feature effects to target layer "${s.title ?? e.layerId}"${o ? ` using geometry from layer "${o.layerId}"` : ""}.` : `Applied filter to "${c}" but no features matched. ${n.error}`;
689
- }, hr = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], z = i.enum(hr), mr = async ({
691
+ }, mr = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], C = i.enum(mr), yr = async ({
690
692
  targetLayer: e,
691
693
  geometryLayer: r,
692
694
  includedEffect: t = "drop-shadow(2px, 2px, 2px, gray)",
693
695
  excludedEffect: a = "grayscale(100%) opacity(60%) blur(2px)"
694
696
  }, o) => {
695
- const { mapView: s } = C(o);
696
- return await ur(e, s, t, a, r);
697
- }, yr = i.object({
697
+ const { mapView: s } = z(o);
698
+ return await hr(e, s, t, a, r);
699
+ }, pr = i.object({
698
700
  targetLayer: i.object({
699
701
  layerId: i.string().describe("The layerId of the layer on which to set a feature effect."),
700
702
  where: i.string().describe("The SQL-92 where clause representing the features to emphasize.")
@@ -705,7 +707,7 @@ const O = async (e, r) => {
705
707
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
706
708
  ),
707
709
  distance: i.number().describe("The distance by which to filter the input geometry."),
708
- units: z.describe("The units used to filter by geometry and distance.")
710
+ units: C.describe("The units used to filter by geometry and distance.")
709
711
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
710
712
  includedEffect: i.string().optional().default("drop-shadow(2px, 2px, 2px, gray)").describe(
711
713
  "The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."
@@ -713,11 +715,11 @@ const O = async (e, r) => {
713
715
  excludedEffect: i.string().optional().default("grayscale(100%) opacity(60%) blur(2px)").describe(
714
716
  "The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."
715
717
  )
716
- }), pr = f(mr, {
718
+ }), gr = f(yr, {
717
719
  name: "setFeatureEffect",
718
720
  description: "Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",
719
- schema: yr
720
- }), gr = async (e, r, t) => {
721
+ schema: pr
722
+ }), fr = async (e, r, t) => {
721
723
  const a = r.map?.allLayers.find(
722
724
  (c) => c.id === e.layerId
723
725
  );
@@ -725,32 +727,32 @@ const O = async (e, r) => {
725
727
  return `Could not find target layer with ID: ${e.layerId}`;
726
728
  let o;
727
729
  if (t) {
728
- const c = await O(t, r);
730
+ const c = await P(t, r);
729
731
  if ("error" in c)
730
732
  return c.error;
731
733
  o = c.geometry;
732
734
  }
733
735
  const s = await r.whenLayerView(a);
734
- s.filter = null, s.filter = new V({
736
+ s.filter = null, s.filter = new D({
735
737
  where: e.where,
736
738
  geometry: o,
737
739
  spatialRelationship: "intersects",
738
740
  distance: t?.distance,
739
741
  units: t?.units
740
742
  }), a.visible = !0;
741
- const l = await oe(
743
+ const l = await se(
742
744
  r,
743
745
  t ? t.layerId : e.layerId,
744
746
  t ? t.where : e.where
745
747
  ), n = a.title ?? e.layerId;
746
748
  return l.success ? `Applied feature filter to layer "${a.title ?? e.layerId}"${t ? ` using geometry from layer "${t.layerId}"` : ""}.` : `Applied filter to "${n}" but no features matched. ${l.error}`;
747
- }, fr = async ({
749
+ }, wr = async ({
748
750
  targetLayer: e,
749
751
  geometryLayer: r
750
752
  }, t) => {
751
- const { mapView: a } = C(t);
752
- return await gr(e, a, r);
753
- }, wr = i.object({
753
+ const { mapView: a } = z(t);
754
+ return await fr(e, a, r);
755
+ }, br = i.object({
754
756
  targetLayer: i.object({
755
757
  layerId: i.string().describe("The layerId of the layer on which to set a filter."),
756
758
  where: i.string().describe("The SQL-92 where clause representing the features to display.")
@@ -761,12 +763,12 @@ const O = async (e, r) => {
761
763
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
762
764
  ),
763
765
  distance: i.number().describe("The distance by which to filter the input geometry."),
764
- units: z.describe("The units used to filter by geometry and distance.")
766
+ units: C.describe("The units used to filter by geometry and distance.")
765
767
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries.")
766
- }), br = f(fr, {
768
+ }), Sr = f(wr, {
767
769
  name: "setFeatureFilter",
768
770
  description: "Sets a client-side filter using a where clause, geometry filter, or both on a target layer. This filters features at the client level in the view.",
769
- schema: wr
771
+ schema: br
770
772
  }), K = (e, r, t) => {
771
773
  if (e && typeof e != "function") {
772
774
  const a = "getField" in t && t.getField?.(e), o = a && "getFieldDomain" in t && t.getFieldDomain ? t.getFieldDomain(a.name) : null;
@@ -776,11 +778,11 @@ const O = async (e, r) => {
776
778
  }
777
779
  }
778
780
  return null;
779
- }, Sr = (e, r, t) => {
781
+ }, vr = (e, r, t) => {
780
782
  const a = e.createQuery();
781
783
  return a.outFields = [r], a.where = t || "1=1", a.num = 1, a;
782
- }, vr = async (e, r, t, a) => {
783
- const o = a.map?.allLayers.find((h) => h.id === e), s = Sr(o, r, t.where), n = (await o.queryFeatures(s)).features[0], c = n ? n.attributes[r] : null, d = K(r, c, o) || c;
784
+ }, Tr = async (e, r, t, a) => {
785
+ const o = a.map?.allLayers.find((h) => h.id === e), s = vr(o, r, t.where), n = (await o.queryFeatures(s)).features[0], c = n ? n.attributes[r] : null, d = K(r, c, o) || c;
784
786
  return {
785
787
  tool: "getAttribute",
786
788
  layerName: o.title ?? e,
@@ -792,21 +794,21 @@ const O = async (e, r) => {
792
794
  }
793
795
  };
794
796
  };
795
- async function Tr({ layerId: e, fieldName: r, query: t }, a) {
796
- const { mapView: o } = C(a), s = await vr(e, r, t, o);
797
+ async function xr({ layerId: e, fieldName: r, query: t }, a) {
798
+ const { mapView: o } = z(a), s = await Tr(e, r, t, o);
797
799
  return JSON.stringify(s, null, 2);
798
800
  }
799
- const xr = i.object({
801
+ const Er = i.object({
800
802
  layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
801
803
  fieldName: i.string().describe("The name of the field/attribute from which to get a field value."),
802
804
  query: i.object({
803
805
  where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
804
806
  })
805
- }), Er = f(Tr, {
807
+ }), $r = f(xr, {
806
808
  name: "getAttribute",
807
809
  description: "Returns an attribute value for a given feature.",
808
- schema: xr
809
- }), se = (e, r) => r ? e.hasAllFeaturesInView : e.hasAllFeatures, $r = async (e) => {
810
+ schema: Er
811
+ }), ie = (e, r) => r ? e.hasAllFeaturesInView : e.hasAllFeatures, Fr = async (e) => {
810
812
  const { targetLayer: r, fieldName: t, statisticType: a, mapView: o, layersAndFieldsRegistry: s, geometryLayer: l } = e, n = o.map?.allLayers.find((I) => I.id === r.layerId);
811
813
  if (!n)
812
814
  throw new Error(`Layer '${r.layerId}' not found.`);
@@ -815,7 +817,7 @@ const xr = i.object({
815
817
  throw new Error(`Field '${t}' not found.`);
816
818
  let h, p;
817
819
  if (l) {
818
- const I = await O(l, o);
820
+ const I = await P(l, o);
819
821
  if ("error" in I)
820
822
  throw new Error(I.error);
821
823
  if (!I.geometry)
@@ -826,19 +828,19 @@ const xr = i.object({
826
828
  distance: l.distance,
827
829
  units: l.units,
828
830
  applied: !0
829
- }, p = new V({
831
+ }, p = new D({
830
832
  geometry: I.geometry,
831
833
  distance: l.distance,
832
834
  units: l.units,
833
835
  spatialRelationship: "intersects"
834
836
  });
835
837
  }
836
- const y = se(c, !1);
837
- let w = null, b = null;
838
+ const y = ie(c, !1);
839
+ let w = null, S = null;
838
840
  const T = 10;
839
841
  if (u.type !== "geometry" && u.type !== "oid" && u.type !== "global-id")
840
842
  try {
841
- w = await X({
843
+ w = await ee({
842
844
  layer: n,
843
845
  useFeaturesInView: y,
844
846
  view: y ? o : void 0,
@@ -846,14 +848,14 @@ const xr = i.object({
846
848
  sqlWhere: r.where,
847
849
  ...p && { filter: p },
848
850
  outStatisticTypes: { include: [a] }
849
- }), ["string", "small-integer", "integer"].includes(u.type) && (b = (await ee({
851
+ }), ["string", "small-integer", "integer"].includes(u.type) && (S = (await te({
850
852
  layer: n,
851
853
  useFeaturesInView: y,
852
854
  view: y ? o : void 0,
853
855
  field: t,
854
856
  sqlWhere: r.where,
855
857
  ...p && { filter: p }
856
- })).uniqueValueInfos.sort((De, Qe) => Qe.count - De.count).slice(0, T));
858
+ })).uniqueValueInfos.sort((Qe, Oe) => Oe.count - Qe.count).slice(0, T));
857
859
  } catch (I) {
858
860
  console.error("Statistics error:", I);
859
861
  }
@@ -866,19 +868,19 @@ const xr = i.object({
866
868
  statisticType: a,
867
869
  statistic: w?.[a] ?? null,
868
870
  summaryStatistics: w,
869
- uniqueValues: b,
871
+ uniqueValues: S,
870
872
  where: r.where,
871
873
  spatialFilterInfo: h
872
874
  }
873
875
  };
874
876
  };
875
- async function Fr({
877
+ async function Rr({
876
878
  targetLayer: e,
877
879
  fieldName: r,
878
880
  statisticType: t,
879
881
  geometryLayer: a
880
882
  }, o) {
881
- const s = S(o, "layersAndFieldsRegistry"), { mapView: l } = C(o), n = await $r({
883
+ const s = b(o, "layersAndFieldsRegistry"), { mapView: l } = z(o), n = await Fr({
882
884
  targetLayer: e,
883
885
  fieldName: r,
884
886
  statisticType: t,
@@ -888,7 +890,7 @@ async function Fr({
888
890
  });
889
891
  return JSON.stringify(n, null, 2);
890
892
  }
891
- const Rr = i.object({
893
+ const Lr = i.object({
892
894
  targetLayer: i.object({
893
895
  layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
894
896
  where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
@@ -900,21 +902,21 @@ const Rr = i.object({
900
902
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
901
903
  ),
902
904
  distance: i.number().optional().describe("The distance by which to query from the input geometry."),
903
- units: z.optional().describe("The units used to query by geometry and distance.")
905
+ units: C.optional().describe("The units used to query by geometry and distance.")
904
906
  }),
905
907
  i.object({}).strict()
906
908
  ]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
907
909
  fieldName: i.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
908
910
  statisticType: i.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
909
- }), Lr = f(Fr, {
911
+ }), Ir = f(Rr, {
910
912
  name: "getStatistics",
911
913
  description: 'Returns one or more summary statistics for the given field. Statistic types include: count, maximum, minimum, average, median, standard deviation, variance, mode, sum, nullcount (number of features without a value for a given field), unique values. For "most common/frequent" questions: Use statisticType "count" on a categorical field. The response includes uniqueValues sorted by frequency (most common first). Statistics can be returned for number, date, and string fields. Also returns frequency analysis for string fields - unique values sorted by occurrence count (most frequent first). Use this for "most common", "most frequent", or "how many of each" questions. Only call this tool when the question requires filtering (e.g. a WHERE clause or spatial constraint) that cannot be satisfied by precomputed stats.',
912
- schema: Rr
913
- }), Ir = async (e, r, t, a) => {
914
+ schema: Lr
915
+ }), qr = async (e, r, t, a) => {
914
916
  const o = t.map?.allLayers.find((u) => u.id === e.layerId), s = await t.whenLayerView(o), l = o.title ?? e.layerId;
915
917
  let n;
916
918
  if (a) {
917
- const u = await O(a, t);
919
+ const u = await P(a, t);
918
920
  if ("error" in u)
919
921
  return {
920
922
  tool: "getTopFeatures",
@@ -951,7 +953,7 @@ const Rr = i.object({
951
953
  });
952
954
  u = await o.queryTopFeatures(p);
953
955
  } else {
954
- const p = new te({
956
+ const p = new re({
955
957
  where: e.where || "1=1",
956
958
  outFields: c,
957
959
  orderByFields: r.orderByFields,
@@ -961,7 +963,7 @@ const Rr = i.object({
961
963
  distance: a?.distance,
962
964
  units: a?.units,
963
965
  outSpatialReference: t.spatialReference
964
- }), y = se(s, !1);
966
+ }), y = ie(s, !1);
965
967
  try {
966
968
  u = y ? await s.queryFeatures(p) : await o.queryFeatures(p);
967
969
  } catch (w) {
@@ -989,12 +991,12 @@ const Rr = i.object({
989
991
  details: { error: u instanceof Error ? u.message : String(u) }
990
992
  };
991
993
  }
992
- }, qr = async ({
994
+ }, zr = async ({
993
995
  targetLayer: e,
994
996
  topFilter: r,
995
997
  geometryLayer: t
996
998
  }, a) => {
997
- const { mapView: o } = C(a), s = await Ir(e, r, o, t);
999
+ const { mapView: o } = z(a), s = await qr(e, r, o, t);
998
1000
  return JSON.stringify(s, null, 2);
999
1001
  }, Cr = i.object({
1000
1002
  targetLayer: i.object({
@@ -1013,7 +1015,7 @@ const Rr = i.object({
1013
1015
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
1014
1016
  ),
1015
1017
  distance: i.number().optional().describe("The distance by which to query from the input geometry."),
1016
- units: z.describe("The units used to query by geometry and distance.").optional()
1018
+ units: C.describe("The units used to query by geometry and distance.").optional()
1017
1019
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1018
1020
  topFilter: i.object({
1019
1021
  topCount: i.number().describe("Number of top features to return per group."),
@@ -1022,7 +1024,7 @@ const Rr = i.object({
1022
1024
  ),
1023
1025
  groupByFields: i.array(i.string().describe("Field(s) to group results by. Returns top N per group."))
1024
1026
  })
1025
- }), zr = f(qr, {
1027
+ }), Ar = f(zr, {
1026
1028
  name: "getTopFeatures",
1027
1029
  description: 'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',
1028
1030
  schema: Cr
@@ -1030,7 +1032,7 @@ const Rr = i.object({
1030
1032
  const o = r.map?.allLayers.find((y) => y.id === e.layerId), s = await r.whenLayerView(o), l = o.title ?? e.layerId;
1031
1033
  let n;
1032
1034
  if (t) {
1033
- const y = await O(t, r);
1035
+ const y = await P(t, r);
1034
1036
  if ("error" in y) {
1035
1037
  const w = { error: y.error };
1036
1038
  return Z(t) ? (w.geometryLayerId = t.layerId, w.geometryWhere = t.where) : H(t) && (w.point = t.point), {
@@ -1051,7 +1053,7 @@ const Rr = i.object({
1051
1053
  }
1052
1054
  n = y.geometry;
1053
1055
  } else a && (n = r.extent.clone());
1054
- const c = se(s, a ?? !1), d = new te({
1056
+ const c = ie(s, a ?? !1), d = new re({
1055
1057
  where: e.where || "1=1",
1056
1058
  outFields: e.outFields.length ? e.outFields : ["*"],
1057
1059
  orderByFields: e.orderByFields,
@@ -1064,16 +1066,16 @@ const Rr = i.object({
1064
1066
  try {
1065
1067
  u = c ? await s.queryFeatureCount(d) : await o.queryFeatureCount(d), u > 0 && u <= U && (h = c ? await s.queryFeatures(d) : await o.queryFeatures(d), h && h.features.forEach((y) => {
1066
1068
  const w = y.attributes;
1067
- o.fields.forEach((b) => {
1068
- const T = w[b.name], k = K(b.name, T, o);
1069
- k && (w[b.name] = k);
1069
+ o.fields.forEach((S) => {
1070
+ const T = w[S.name], V = K(S.name, T, o);
1071
+ V && (w[S.name] = V);
1070
1072
  });
1071
1073
  }));
1072
1074
  } catch (y) {
1073
1075
  console.warn("Client-side query failed, falling back to server:", y), u = await o.queryFeatureCount(d), u > 0 && u <= U && (h = await o.queryFeatures(d), h && h.features.forEach((w) => {
1074
- o.fields.forEach((b) => {
1075
- const T = w.attributes[b.name], k = K(b.name, T, o);
1076
- k && (w.attributes[b.name] = k);
1076
+ o.fields.forEach((S) => {
1077
+ const T = w.attributes[S.name], V = K(S.name, T, o);
1078
+ V && (w.attributes[S.name] = V);
1077
1079
  });
1078
1080
  }));
1079
1081
  }
@@ -1092,19 +1094,19 @@ const Rr = i.object({
1092
1094
  }
1093
1095
  };
1094
1096
  };
1095
- async function Ar({
1097
+ async function kr({
1096
1098
  targetLayer: e,
1097
1099
  geometryFilter: r,
1098
1100
  useCurrentExtent: t
1099
1101
  }, a) {
1100
- const { mapView: o } = C(a), s = await Nr(e, o, r, t);
1102
+ const { mapView: o } = z(a), s = await Nr(e, o, r, t);
1101
1103
  return JSON.stringify(s, null, 2);
1102
1104
  }
1103
- const kr = i.object({
1105
+ const _r = i.object({
1104
1106
  layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1105
1107
  where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1106
1108
  distance: i.number().optional().describe("The buffer distance around the geometry."),
1107
- units: z.optional().describe("The units for the distance buffer.")
1109
+ units: C.optional().describe("The units for the distance buffer.")
1108
1110
  }), jr = i.object({
1109
1111
  point: i.object({
1110
1112
  x: i.number().describe("X coordinate (longitude) from navigation result"),
@@ -1114,8 +1116,8 @@ const kr = i.object({
1114
1116
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1115
1117
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1116
1118
  distance: i.number().optional().describe("Optional buffer distance around the point."),
1117
- units: z.optional().describe("The units for the distance buffer.")
1118
- }), _r = i.object({
1119
+ units: C.optional().describe("The units for the distance buffer.")
1120
+ }), Mr = i.object({
1119
1121
  targetLayer: i.object({
1120
1122
  layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1121
1123
  where: i.string().describe(
@@ -1128,61 +1130,61 @@ const kr = i.object({
1128
1130
  ).default("*")
1129
1131
  )
1130
1132
  }),
1131
- geometryFilter: i.union([kr, jr]).optional().describe(
1133
+ geometryFilter: i.union([_r, jr]).optional().describe(
1132
1134
  "Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
1133
1135
  ),
1134
1136
  useCurrentExtent: i.boolean().optional().describe(
1135
1137
  "Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at'. Default is false (queries entire layer)."
1136
1138
  )
1137
- }), Mr = f(Ar, {
1139
+ }), Vr = f(kr, {
1138
1140
  name: "queryFeatures",
1139
1141
  description: "Queries features from a layer. Returns count and attributes (if ≤25 features). Use for listing features, finding features matching conditions, or spatial queries.",
1140
- schema: _r
1141
- }), Re = [Er, Lr, zr, Mr], Le = [dr, pr, br], G = () => {
1142
+ schema: Mr
1143
+ }), Re = [$r, Ir, Ar, Vr], Le = [ur, gr, Sr], G = () => {
1142
1144
  const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), r = e <= 0 ? "+" : "-", t = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), a = (Math.abs(e) % 60).toString().padStart(2, "0"), o = `${r}${t}:${a}`;
1143
1145
  return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
1144
- }, Vr = async (e, r) => {
1146
+ }, Dr = async (e, r) => {
1145
1147
  await m({ text: "Requesting LLM for layer filter results" }, r);
1146
- const a = await $("data_explore_filter_prompt");
1148
+ const a = await E("data_explore_filter_prompt");
1147
1149
  if (!r?.configurable)
1148
1150
  throw new Error("config.configurable is required for layer filter tools");
1149
1151
  const { userTimezone: o, userTimezoneOffset: s } = G(), l = {
1150
1152
  layerFieldInfo: e.layerFieldInfo,
1151
1153
  userTimezone: o,
1152
1154
  userTimezoneOffset: s
1153
- }, n = await N({
1155
+ }, n = await _({
1154
1156
  promptText: a,
1155
1157
  messages: v(e.messages),
1156
1158
  inputVariables: l,
1157
1159
  tools: Le
1158
1160
  }), c = [...e.messages, n], u = (n.tool_calls?.length ?? 0) > 0 ? c : [...c, n], h = n.content.toString();
1159
- return await Q(n, r), { ...e, messages: u, outputMessage: h };
1160
- }, Dr = async (e, r) => {
1161
+ return await O(n, r), { ...e, messages: u, outputMessage: h };
1162
+ }, Qr = async (e, r) => {
1161
1163
  await m({ text: "Requesting LLM for layer query results" }, r);
1162
- const a = await $("data_explore_query_prompt");
1164
+ const a = await E("data_explore_query_prompt");
1163
1165
  if (!r?.configurable)
1164
1166
  throw new Error("config.configurable is required for layer query tools");
1165
1167
  const { userTimezone: o, userTimezoneOffset: s } = G(), l = {
1166
1168
  layerFieldInfo: e.layerFieldInfo,
1167
1169
  userTimezone: o,
1168
1170
  userTimezoneOffset: s
1169
- }, n = await N({
1171
+ }, n = await _({
1170
1172
  promptText: a,
1171
1173
  messages: v(e.messages),
1172
1174
  inputVariables: l,
1173
1175
  tools: Re
1174
1176
  }), c = [...e.messages, n], d = n.content.toString();
1175
- return await Q(n, r), { ...e, messages: c, outputMessage: d };
1176
- }, Qr = async (e, r) => {
1177
+ return await O(n, r), { ...e, messages: c, outputMessage: d };
1178
+ }, Or = async (e, r) => {
1177
1179
  try {
1178
1180
  await m({ text: "Requesting LLM for summary on query results" }, r);
1179
- const a = await $("summarize_query_response_prompt"), o = {
1181
+ const a = await E("summarize_query_response_prompt"), o = {
1180
1182
  queryResponse: e.queryResponse
1181
- }, s = await be({
1183
+ }, s = await J({
1182
1184
  promptText: a,
1183
1185
  messages: v(e.messages),
1184
1186
  inputVariables: o
1185
- }), l = typeof s == "string" ? s : s.content, n = new B(l);
1187
+ }), l = typeof s == "string" ? s : s.content, n = new Q(l);
1186
1188
  return await m({ text: `Received response from LLM: ${l}` }, r), {
1187
1189
  ...e,
1188
1190
  outputMessage: l,
@@ -1192,14 +1194,14 @@ const kr = i.object({
1192
1194
  throw await m({ text: "Error during filter LLM request" }, r), new Error(`Error during filter LLM request: ${t instanceof Error ? t.message : String(t)}`);
1193
1195
  }
1194
1196
  };
1195
- async function Or(e, r) {
1196
- const a = await new A(Le).invoke(
1197
+ async function Pr(e, r) {
1198
+ const a = await new j(Le).invoke(
1197
1199
  {
1198
1200
  messages: v(e.messages)
1199
1201
  },
1200
1202
  r
1201
1203
  ), o = [...e.messages, ...a.messages], s = a.messages.map(
1202
- (c) => new B({
1204
+ (c) => new Q({
1203
1205
  content: c.content,
1204
1206
  // eslint-disable-next-line @typescript-eslint/naming-convention
1205
1207
  additional_kwargs: c.additional_kwargs
@@ -1214,9 +1216,9 @@ async function Or(e, r) {
1214
1216
  `);
1215
1217
  return { ...e, messages: l, outputMessage: n };
1216
1218
  }
1217
- const Pr = new A(Re);
1218
- async function Br(e, r) {
1219
- const { messages: t } = await Pr.invoke({ messages: v(e.messages) }, r), a = [], o = [];
1219
+ const Wr = new j(Re);
1220
+ async function Gr(e, r) {
1221
+ const { messages: t } = await Wr.invoke({ messages: v(e.messages) }, r), a = [], o = [];
1220
1222
  for (const l of t) {
1221
1223
  const n = l.content;
1222
1224
  let c;
@@ -1248,10 +1250,10 @@ async function Br(e, r) {
1248
1250
  queryResponse: a
1249
1251
  };
1250
1252
  }
1251
- const Gr = 10, Wr = async (e, r) => {
1253
+ const Br = 10, Ur = async (e, r) => {
1252
1254
  let t = null, a = null;
1253
1255
  try {
1254
- r.type !== "geometry" && r.type !== "oid" && r.type !== "global-id" && (t = await X({ layer: e, field: r.name }), r.type === "string" && (a = (await ee({ layer: e, field: r.name })).uniqueValueInfos.sort((o, s) => s.count - o.count).slice(0, Gr)));
1256
+ r.type !== "geometry" && r.type !== "oid" && r.type !== "global-id" && (t = await ee({ layer: e, field: r.name }), r.type === "string" && (a = (await te({ layer: e, field: r.name })).uniqueValueInfos.sort((o, s) => s.count - o.count).slice(0, Br)));
1255
1257
  } catch (o) {
1256
1258
  console.error(`Error fetching statistics for field ${r.name}:`, o);
1257
1259
  }
@@ -1260,7 +1262,7 @@ const Gr = 10, Wr = async (e, r) => {
1260
1262
  uniqueValues: a
1261
1263
  };
1262
1264
  };
1263
- async function ie(e, r, t) {
1265
+ async function ne(e, r, t) {
1264
1266
  const a = [], o = [];
1265
1267
  for (const s of e) {
1266
1268
  let l = function(p) {
@@ -1285,33 +1287,33 @@ async function ie(e, r, t) {
1285
1287
  if (!y)
1286
1288
  continue;
1287
1289
  if (!y.statistics) {
1288
- const b = Wr(d, y).then((T) => {
1290
+ const S = Ur(d, y).then((T) => {
1289
1291
  u.set(y.name, { ...y, statistics: T }), y.statistics = T;
1290
1292
  });
1291
- o.push(b);
1293
+ o.push(S);
1292
1294
  }
1293
1295
  h.fieldInfos.push(y);
1294
1296
  }
1295
1297
  }
1296
1298
  return await Promise.all(o), a;
1297
1299
  }
1298
- const Ur = async (e, r) => {
1300
+ const Hr = async (e, r) => {
1299
1301
  try {
1300
1302
  await m({ text: "Getting statistics for vector search results" }, r);
1301
- const t = S(r, "layersAndFieldsRegistry"), { mapView: a } = C(r), o = await ie(e.vectorSearchFieldResults, t, a);
1303
+ const t = b(r, "layersAndFieldsRegistry"), { mapView: a } = z(r), o = await ne(e.vectorSearchFieldResults, t, a);
1302
1304
  return console.log("Field statistics retrieved:", o), await m({ text: "Statistics retrieved" }, r), { ...e, layerFieldInfo: o };
1303
1305
  } catch (t) {
1304
1306
  throw await m({ text: "Error during fetching statistics" }, r), new Error(`Error during fetching statistics: ${t instanceof Error ? t.message : String(t)}`);
1305
1307
  }
1306
- }, me = 0.7, Hr = 10, Zr = async (e, r) => {
1308
+ }, ye = 0.7, Zr = 10, Kr = async (e, r) => {
1307
1309
  try {
1308
1310
  const t = L(e.messages);
1309
1311
  await m({ text: "Similarity search to find fields" }, r);
1310
- const a = S(r, "fieldSearch"), o = S(r, "layersAndFieldsRegistry"), s = await a.searchFields({
1312
+ const a = b(r, "fieldSearch"), o = b(r, "layersAndFieldsRegistry"), s = await a.searchFields({
1311
1313
  text: t,
1312
1314
  layerIds: e.vectorSearchLayerIds,
1313
- minScore: me,
1314
- topResults: Hr
1315
+ minScore: ye,
1316
+ topResults: Zr
1315
1317
  }), l = s.map(({ layerId: c, results: d }) => {
1316
1318
  const u = d.map((h) => ` - ${h.name} (${h.score.toFixed(2)})`).join(`
1317
1319
  `);
@@ -1321,7 +1323,7 @@ ${u}`;
1321
1323
  `);
1322
1324
  let n;
1323
1325
  return s.length > 0 ? n = `Vector search completed. Matching layers and fields with scores:
1324
- ${l}` : n = `No vector search results found for score over ${me}.`, await m({ text: n }, r), {
1326
+ ${l}` : n = `No vector search results found for score over ${ye}.`, await m({ text: n }, r), {
1325
1327
  ...e,
1326
1328
  vectorSearchFieldResults: s
1327
1329
  };
@@ -1331,13 +1333,13 @@ ${l}` : n = `No vector search results found for score over ${me}.`, await m({ te
1331
1333
  r
1332
1334
  ), new Error(`Vector search failed: ${t instanceof Error ? t.message : String(t)}`);
1333
1335
  }
1334
- }, Kr = 0.7, Jr = async (e, r) => {
1336
+ }, Jr = 0.7, Yr = async (e, r) => {
1335
1337
  try {
1336
1338
  const t = L(e.messages);
1337
1339
  await m({ text: `Similarity search to find layers: ${t}` }, r);
1338
- const a = S(r, "layerSearch"), o = S(r, "layersAndFieldsRegistry"), s = await a.searchLayers({
1340
+ const a = b(r, "layerSearch"), o = b(r, "layersAndFieldsRegistry"), s = await a.searchLayers({
1339
1341
  text: t,
1340
- minScore: Kr
1342
+ minScore: Jr
1341
1343
  }), l = s.map((d) => d.id), n = s.map(({ id: d, score: u }) => `${o.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1342
1344
  `);
1343
1345
  let c;
@@ -1352,10 +1354,10 @@ ${n}` : c = "Vector search completed. No matching layers found.", await m({ text
1352
1354
  r
1353
1355
  ), new Error(`Vector search failed: ${t instanceof Error ? t.message : String(t)}`);
1354
1356
  }
1355
- }, Yr = (e, r) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
1357
+ }, Xr = (e, r) => M(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
1356
1358
  e,
1357
1359
  r
1358
- ), Xr = () => new _(Fe).addNode("requireDataExplorationServices", Yr).addNode("vectorSearchLayers", Jr).addNode("vectorSearchFields", Zr).addNode("fieldStatistics", Ur).addNode("queryAgent", Dr).addNode("queryTools", Br).addNode("summarizeQueryResponseLLM", Qr).addNode("filterAgent", Vr).addNode("filterTools", Or).addNode("earlyExit", sr).addEdge(M, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1360
+ ), ea = () => new N(Fe).addNode("requireDataExplorationServices", Xr).addNode("vectorSearchLayers", Yr).addNode("vectorSearchFields", Kr).addNode("fieldStatistics", Hr).addNode("queryAgent", Qr).addNode("queryTools", Gr).addNode("summarizeQueryResponseLLM", Or).addNode("filterAgent", Dr).addNode("filterTools", Pr).addNode("earlyExit", ir).addEdge(k, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1359
1361
  "vectorSearchLayers",
1360
1362
  (r) => r.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
1361
1363
  ).addConditionalEdges(
@@ -1364,7 +1366,7 @@ ${n}` : c = "Vector search completed. No matching layers found.", await m({ text
1364
1366
  ).addEdge("fieldStatistics", "queryAgent").addConditionalEdges("queryAgent", (r) => (r.messages[r.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "queryTools" : "filterAgent").addConditionalEdges(
1365
1367
  "queryTools",
1366
1368
  (r) => r.queryResponse.length ? "summarizeQueryResponseLLM" : "filterAgent"
1367
- ).addEdge("summarizeQueryResponseLLM", "filterAgent").addEdge("filterAgent", "filterTools").addEdge("filterTools", x).addEdge("summarizeQueryResponseLLM", x).addEdge("earlyExit", x), ea = String.raw`- **data exploration** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. And/Or user wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
1369
+ ).addEdge("summarizeQueryResponseLLM", "filterAgent").addEdge("filterAgent", "filterTools").addEdge("filterTools", x).addEdge("summarizeQueryResponseLLM", x).addEdge("earlyExit", x), ta = String.raw`- **data exploration** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. And/Or user wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
1368
1370
  The Data Exploration Agent will automatically zoom to the affected features for action taken by this agent. In this case, no need to call navigation tool separately.
1369
1371
  _Example: “Only show stations where Brand is Shell”_
1370
1372
  _Example: “Make Shell stations stand out on the map”_
@@ -1372,21 +1374,21 @@ ${n}` : c = "Vector search completed. No matching layers found.", await m({ text
1372
1374
  This also includes questions that ask which feature meets a given condition or where a particular feature in the data is located (e.g., “Where is the spring with the highest elevation?”).
1373
1375
  _Example: “How many features are there?”_
1374
1376
  _Example: “What’s the average population?”_
1375
- _Example: “Which values are in the status field?”_`, Fi = {
1377
+ _Example: “Which values are in the status field?”_`, Ai = {
1376
1378
  id: "dataExploration",
1377
1379
  name: "Data Exploration Agent",
1378
- description: ea,
1379
- createGraph: Xr,
1380
+ description: ta,
1381
+ createGraph: ea,
1380
1382
  workspace: Fe
1381
- }, ye = 0.7, ta = 10, ra = async (e, r) => {
1383
+ }, pe = 0.7, ra = 10, aa = async (e, r) => {
1382
1384
  try {
1383
1385
  const t = L(e.messages);
1384
1386
  await m({ text: "Similarity search to find fields" }, r);
1385
- const a = S(r, "fieldSearch"), o = S(r, "layersAndFieldsRegistry"), s = await a.searchFields({
1387
+ const a = b(r, "fieldSearch"), o = b(r, "layersAndFieldsRegistry"), s = await a.searchFields({
1386
1388
  text: t,
1387
1389
  layerIds: e.vectorSearchLayerIds,
1388
- minScore: ye,
1389
- topResults: ta
1390
+ minScore: pe,
1391
+ topResults: ra
1390
1392
  }), l = s.map(({ layerId: c, results: d }) => {
1391
1393
  const u = d.map((h) => ` - ${h.name} (${h.score.toFixed(2)})`).join(`
1392
1394
  `);
@@ -1396,7 +1398,7 @@ ${u}`;
1396
1398
  `);
1397
1399
  let n;
1398
1400
  return s.length > 0 ? n = `Vector search completed. Matching layers and fields with scores:
1399
- ${l}` : n = `No vector search results found for score over ${ye}.`, await m({ text: n }, r), {
1401
+ ${l}` : n = `No vector search results found for score over ${pe}.`, await m({ text: n }, r), {
1400
1402
  ...e,
1401
1403
  vectorSearchFieldResults: s
1402
1404
  };
@@ -1406,11 +1408,11 @@ ${l}` : n = `No vector search results found for score over ${ye}.`, await m({ te
1406
1408
  r
1407
1409
  ), new Error(`Vector search failed: ${t instanceof Error ? t.message : String(t)}`);
1408
1410
  }
1409
- }, aa = 0.7, oa = async (e, r) => {
1411
+ }, oa = 0.7, sa = async (e, r) => {
1410
1412
  try {
1411
1413
  const t = L(e.messages);
1412
1414
  await m({ text: `Similarity search to find layers: ${t}` }, r);
1413
- const a = S(r, "layerSearch"), o = S(r, "layersAndFieldsRegistry"), s = await a.searchLayers({ text: t, minScore: aa }), l = s.map((d) => d.id), n = s.map(({ id: d, score: u }) => `${o.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1415
+ const a = b(r, "layerSearch"), o = b(r, "layersAndFieldsRegistry"), s = await a.searchLayers({ text: t, minScore: oa }), l = s.map((d) => d.id), n = s.map(({ id: d, score: u }) => `${o.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1414
1416
  `);
1415
1417
  let c;
1416
1418
  return l.length > 0 ? c = `Vector search completed. Matching layers with scores:
@@ -1425,7 +1427,7 @@ ${n}` : c = "Vector search completed. No matching layers found.", await m({ text
1425
1427
  ), new Error(`Vector search failed: ${t instanceof Error ? t.message : String(t)}`);
1426
1428
  }
1427
1429
  }, Ie = ["mapView"];
1428
- function W(e) {
1430
+ function B(e) {
1429
1431
  const t = e?.configurable?.context;
1430
1432
  if (!t || typeof t != "object")
1431
1433
  throw new Error("LayerFilterAgent context missing");
@@ -1434,35 +1436,35 @@ function W(e) {
1434
1436
  throw new Error(`LayerFilterAgent context missing: ${a.join(", ")}`);
1435
1437
  return t;
1436
1438
  }
1437
- const sa = async (e, r) => {
1439
+ const ia = async (e, r) => {
1438
1440
  try {
1439
1441
  await m({ text: "Getting statistics for vector search results" }, r);
1440
- const t = S(r, "layersAndFieldsRegistry"), { mapView: a } = W(r), o = await ie(e.vectorSearchFieldResults, t, a);
1442
+ const t = b(r, "layersAndFieldsRegistry"), { mapView: a } = B(r), o = await ne(e.vectorSearchFieldResults, t, a);
1441
1443
  return console.log("Field statistics retrieved:", o), await m({ text: "Statistics retrieved" }, r), { ...e, layerFieldInfo: o };
1442
1444
  } catch (t) {
1443
1445
  throw await m({ text: "Error during fetching statistics" }, r), new Error(`Error during fetching statistics: ${t instanceof Error ? t.message : String(t)}`);
1444
1446
  }
1445
- }, ne = async (e, r, t) => {
1447
+ }, le = async (e, r, t) => {
1446
1448
  const a = e.map?.allLayers.find((l) => l.id === r), o = a.createQuery();
1447
1449
  o.where = t ?? "1=1";
1448
1450
  const { features: s } = await a.queryFeatures(o);
1449
1451
  e.goTo(s);
1450
- }, ia = (e, r, t) => {
1452
+ }, na = (e, r, t) => {
1451
1453
  const a = t.map?.allLayers.find((o) => o.id === e);
1452
- return a ? (a.definitionExpression = r, a.visible = !0, ne(t, e, r), `Applied definition expression to layer "${a.title ?? e}": ${r}`) : `Could not find layer with ID: ${e}`;
1453
- }, na = ({
1454
+ return a ? (a.definitionExpression = r, a.visible = !0, le(t, e, r), `Applied definition expression to layer "${a.title ?? e}": ${r}`) : `Could not find layer with ID: ${e}`;
1455
+ }, la = ({
1454
1456
  layerId: e,
1455
1457
  definitionExpression: r
1456
1458
  }, t) => {
1457
- const { mapView: a } = W(t);
1458
- return ia(e, r, a);
1459
- }, la = i.object({
1459
+ const { mapView: a } = B(t);
1460
+ return na(e, r, a);
1461
+ }, ca = i.object({
1460
1462
  layerId: i.string().describe("The layerId of the layer on which to set a definitionExpression."),
1461
1463
  definitionExpression: i.string().describe("The SQL-92 where clause used to set a definition expression on the layer.")
1462
- }), ca = f(na, {
1464
+ }), da = f(la, {
1463
1465
  name: "setDefinitionExpression",
1464
1466
  description: "Set a SQL-92 where clause to the definition expression of a layer (i.e. a server-side filter). This filters features at the server level, affecting all views of the layer. Do not prioritize this tool unless specifically asked for or implied for server level, affecting all views of the layer.",
1465
- schema: la
1467
+ schema: ca
1466
1468
  }), qe = async (e, r) => {
1467
1469
  const t = r.map?.allLayers.find(
1468
1470
  (s) => s.id === e.layerId
@@ -1482,13 +1484,13 @@ const sa = async (e, r) => {
1482
1484
  return { error: "The geometry of the first feature is undefined or null." };
1483
1485
  o = s;
1484
1486
  } else {
1485
- const s = a.features.map((n) => n.geometry), l = Y.executeMany(s);
1487
+ const s = a.features.map((n) => n.geometry), l = X.executeMany(s);
1486
1488
  if (!l)
1487
1489
  return { error: "Failed to create a combined geometry." };
1488
1490
  o = l;
1489
1491
  }
1490
1492
  return { geometry: o };
1491
- }, da = async (e, r, t, a, o) => {
1493
+ }, ua = async (e, r, t, a, o) => {
1492
1494
  const s = r.map?.allLayers.find(
1493
1495
  (n) => n.id === e.layerId
1494
1496
  );
@@ -1503,7 +1505,7 @@ const sa = async (e, r) => {
1503
1505
  l = n.geometry;
1504
1506
  }
1505
1507
  return s.featureEffect = new Te({
1506
- filter: new V({
1508
+ filter: new D({
1507
1509
  where: e.where,
1508
1510
  geometry: l,
1509
1511
  spatialRelationship: "intersects",
@@ -1512,20 +1514,20 @@ const sa = async (e, r) => {
1512
1514
  }),
1513
1515
  includedEffect: t,
1514
1516
  excludedEffect: a
1515
- }), s.visible = !0, ne(
1517
+ }), s.visible = !0, le(
1516
1518
  r,
1517
1519
  o ? o.layerId : e.layerId,
1518
1520
  o ? o.where : e.where
1519
1521
  ), `Applied feature effects to target layer "${s.title ?? e.layerId}"${o ? ` using geometry from layer "${o.layerId}"` : ""}.`;
1520
- }, ua = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], Ce = i.enum(ua), ha = async ({
1522
+ }, ha = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], ze = i.enum(ha), ma = async ({
1521
1523
  targetLayer: e,
1522
1524
  geometryLayer: r,
1523
1525
  includedEffect: t = "drop-shadow(2px, 2px, 2px, gray)",
1524
1526
  excludedEffect: a = "grayscale(100%) opacity(60%) blur(2px)"
1525
1527
  }, o) => {
1526
- const { mapView: s } = W(o);
1527
- return await da(e, s, t, a, r);
1528
- }, ma = i.object({
1528
+ const { mapView: s } = B(o);
1529
+ return await ua(e, s, t, a, r);
1530
+ }, ya = i.object({
1529
1531
  targetLayer: i.object({
1530
1532
  layerId: i.string().describe("The layerId of the layer on which to set a feature effect."),
1531
1533
  where: i.string().describe("The SQL-92 where clause representing the features to emphasize.")
@@ -1536,7 +1538,7 @@ const sa = async (e, r) => {
1536
1538
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
1537
1539
  ),
1538
1540
  distance: i.number().describe("The distance by which to filter the input geometry."),
1539
- units: Ce.describe("The units used to filter by geometry and distance.")
1541
+ units: ze.describe("The units used to filter by geometry and distance.")
1540
1542
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1541
1543
  includedEffect: i.string().optional().default("drop-shadow(2px, 2px, 2px, gray)").describe(
1542
1544
  "The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."
@@ -1544,11 +1546,11 @@ const sa = async (e, r) => {
1544
1546
  excludedEffect: i.string().optional().default("grayscale(100%) opacity(60%) blur(2px)").describe(
1545
1547
  "The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."
1546
1548
  )
1547
- }), ya = f(ha, {
1549
+ }), pa = f(ma, {
1548
1550
  name: "setFeatureEffect",
1549
1551
  description: "Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",
1550
- schema: ma
1551
- }), pa = async (e, r, t) => {
1552
+ schema: ya
1553
+ }), ga = async (e, r, t) => {
1552
1554
  const a = r.map?.allLayers.find(
1553
1555
  (l) => l.id === e.layerId
1554
1556
  );
@@ -1562,24 +1564,24 @@ const sa = async (e, r) => {
1562
1564
  o = l.geometry;
1563
1565
  }
1564
1566
  const s = await r.whenLayerView(a);
1565
- return s.filter = new V({
1567
+ return s.filter = new D({
1566
1568
  where: e.where,
1567
1569
  geometry: o,
1568
1570
  spatialRelationship: "intersects",
1569
1571
  distance: t?.distance,
1570
1572
  units: t?.units
1571
- }), a.visible = !0, ne(
1573
+ }), a.visible = !0, le(
1572
1574
  r,
1573
1575
  t ? t.layerId : e.layerId,
1574
1576
  t ? t.where : e.where
1575
1577
  ), `Applied feature filter to layer "${a.title ?? e.layerId}"${t ? ` using geometry from layer "${t.layerId}"` : ""}.`;
1576
- }, ga = async ({
1578
+ }, fa = async ({
1577
1579
  targetLayer: e,
1578
1580
  geometryLayer: r
1579
1581
  }, t) => {
1580
- const { mapView: a } = W(t);
1581
- return await pa(e, a, r);
1582
- }, fa = i.object({
1582
+ const { mapView: a } = B(t);
1583
+ return await ga(e, a, r);
1584
+ }, wa = i.object({
1583
1585
  targetLayer: i.object({
1584
1586
  layerId: i.string().describe("The layerId of the layer on which to set a filter."),
1585
1587
  where: i.string().describe("The SQL-92 where clause representing the features to display.")
@@ -1590,31 +1592,31 @@ const sa = async (e, r) => {
1590
1592
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
1591
1593
  ),
1592
1594
  distance: i.number().describe("The distance by which to filter the input geometry."),
1593
- units: Ce.describe("The units used to filter by geometry and distance.")
1595
+ units: ze.describe("The units used to filter by geometry and distance.")
1594
1596
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries.")
1595
- }), wa = f(ga, {
1597
+ }), ba = f(fa, {
1596
1598
  name: "setFeatureFilter",
1597
1599
  description: "Sets a client-side filter using a where clause, geometry filter, or both on a target layer. This filters features at the client level in the view.",
1598
- schema: fa
1599
- }), ze = [ca, ya, wa], ba = async (e, r) => {
1600
+ schema: wa
1601
+ }), Ce = [da, pa, ba], Sa = async (e, r) => {
1600
1602
  await m({ text: "Requesting LLM for layer filter results" }, r);
1601
- const a = await $("layer_filter_prompt");
1603
+ const a = await E("layer_filter_prompt");
1602
1604
  if (!r?.configurable)
1603
1605
  throw new Error("config.configurable is required for layer filter tools");
1604
1606
  const { userTimezone: o, userTimezoneOffset: s } = G(), l = {
1605
1607
  layerFieldInfo: e.layerFieldInfo,
1606
1608
  userTimezone: o,
1607
1609
  userTimezoneOffset: s
1608
- }, n = await N({
1610
+ }, n = await _({
1609
1611
  promptText: a,
1610
1612
  messages: v(e.messages),
1611
1613
  inputVariables: l,
1612
- tools: ze
1614
+ tools: Ce
1613
1615
  }), c = n.content.toString();
1614
- return await Q(n, r), { ...e, messages: [...e.messages, n], outputMessage: c };
1616
+ return await O(n, r), { ...e, messages: [...e.messages, n], outputMessage: c };
1615
1617
  };
1616
- async function Sa(e, r) {
1617
- const a = await new A(ze).invoke(
1618
+ async function va(e, r) {
1619
+ const a = await new j(Ce).invoke(
1618
1620
  {
1619
1621
  messages: v(e.messages)
1620
1622
  },
@@ -1626,10 +1628,10 @@ async function Sa(e, r) {
1626
1628
  `);
1627
1629
  return { ...e, outputMessage: l, messages: s };
1628
1630
  }
1629
- const Ne = g.Root({
1631
+ const Ae = g.Root({
1630
1632
  // Inputs coming from global context
1631
1633
  messages: g({
1632
- reducer: j,
1634
+ reducer: A,
1633
1635
  default: () => []
1634
1636
  }),
1635
1637
  // Accumulates user-visible output across graph nodes.
@@ -1658,26 +1660,26 @@ ${t}`;
1658
1660
  vectorSearchLayerIds: g(),
1659
1661
  vectorSearchFieldResults: g(),
1660
1662
  layerFieldInfo: g()
1661
- }), va = async (e, r) => (await m({ text: "Exiting Layer Filter agent" }, r), e), Ta = (e, r) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Filter Agent")(e, r), xa = () => new _(Ne).addNode("requireLayerFilterServices", Ta).addNode("vectorSearchLayers", oa).addNode("vectorSearchFields", ra).addNode("fieldStatistics", sa).addNode("agent", ba).addNode("tools", Sa).addNode("earlyExit", va).addEdge(M, "requireLayerFilterServices").addEdge("requireLayerFilterServices", "vectorSearchLayers").addConditionalEdges(
1663
+ }), Ta = async (e, r) => (await m({ text: "Exiting Layer Filter agent" }, r), e), xa = (e, r) => M(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Filter Agent")(e, r), Ea = () => new N(Ae).addNode("requireLayerFilterServices", xa).addNode("vectorSearchLayers", sa).addNode("vectorSearchFields", aa).addNode("fieldStatistics", ia).addNode("agent", Sa).addNode("tools", va).addNode("earlyExit", Ta).addEdge(k, "requireLayerFilterServices").addEdge("requireLayerFilterServices", "vectorSearchLayers").addConditionalEdges(
1662
1664
  "vectorSearchLayers",
1663
1665
  (r) => r.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
1664
1666
  ).addConditionalEdges(
1665
1667
  "vectorSearchFields",
1666
1668
  (r) => r.vectorSearchFieldResults.length ? "fieldStatistics" : "earlyExit"
1667
- ).addEdge("fieldStatistics", "agent").addConditionalEdges("agent", (r) => (r.messages[r.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : "earlyExit").addEdge("tools", "earlyExit").addEdge("earlyExit", x), Ea = String.raw`- **layer filter** — User wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
1669
+ ).addEdge("fieldStatistics", "agent").addConditionalEdges("agent", (r) => (r.messages[r.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : "earlyExit").addEdge("tools", "earlyExit").addEdge("earlyExit", x), $a = String.raw`- **layer filter** — User wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
1668
1670
  The Layer Filter Agent will automatically zoom to the affected features for action taken by this agent. In this case, no need to call navigation tool separately.
1669
1671
  _Example: “Only show stations where Brand is Shell”_
1670
1672
  _Example: “Make Shell stations stand out on the map”_
1671
- _Example: “Gray out all stations that aren’t Shell”_`, Ri = {
1673
+ _Example: “Gray out all stations that aren’t Shell”_`, Ni = {
1672
1674
  id: "layerFilter",
1673
1675
  name: "Layer Filter Agent",
1674
- description: Ea,
1675
- createGraph: xa,
1676
- workspace: Ne
1677
- }, Ae = g.Root({
1676
+ description: $a,
1677
+ createGraph: Ea,
1678
+ workspace: Ae
1679
+ }, Ne = g.Root({
1678
1680
  // Inputs coming from global context
1679
1681
  messages: g({
1680
- reducer: j,
1682
+ reducer: A,
1681
1683
  default: () => []
1682
1684
  }),
1683
1685
  // Accumulates user-visible output across graph nodes.
@@ -1707,8 +1709,8 @@ ${t}`;
1707
1709
  vectorSearchFieldResults: g(),
1708
1710
  layerFieldInfo: g(),
1709
1711
  queryResponses: g()
1710
- }), $a = async (e, r) => (await m({ text: "Exiting Layer Query agent" }, r), e);
1711
- function P(e) {
1712
+ }), Fa = async (e, r) => (await m({ text: "Exiting Layer Query agent" }, r), e);
1713
+ function W(e) {
1712
1714
  const t = e?.configurable?.context;
1713
1715
  if (!t || typeof t != "object")
1714
1716
  throw new Error("LayerQueryAgent context missing");
@@ -1717,23 +1719,23 @@ function P(e) {
1717
1719
  throw new Error(`LayerQueryAgent context missing: ${a.join(", ")}`);
1718
1720
  return t;
1719
1721
  }
1720
- const Fa = async (e, r) => {
1722
+ const Ra = async (e, r) => {
1721
1723
  try {
1722
1724
  await m({ text: "Getting statistics for vector search results" }, r);
1723
- const t = S(r, "layersAndFieldsRegistry"), { mapView: a } = P(r), o = await ie(e.vectorSearchFieldResults, t, a);
1725
+ const t = b(r, "layersAndFieldsRegistry"), { mapView: a } = W(r), o = await ne(e.vectorSearchFieldResults, t, a);
1724
1726
  return console.log("Field statistics retrieved:", o), await m({ text: "Statistics retrieved" }, r), { ...e, layerFieldInfo: o };
1725
1727
  } catch (t) {
1726
1728
  throw await m({ text: "Error during fetching statistics" }, r), new Error(`Error during fetching statistics: ${t instanceof Error ? t.message : String(t)}`);
1727
1729
  }
1728
- }, pe = 0.7, Ra = 10, La = async (e, r) => {
1730
+ }, ge = 0.7, La = 10, Ia = async (e, r) => {
1729
1731
  try {
1730
1732
  const t = L(e.messages);
1731
1733
  await m({ text: "Similarity search to find fields" }, r);
1732
- const a = S(r, "fieldSearch"), o = S(r, "layersAndFieldsRegistry"), s = await a.searchFields({
1734
+ const a = b(r, "fieldSearch"), o = b(r, "layersAndFieldsRegistry"), s = await a.searchFields({
1733
1735
  text: t,
1734
1736
  layerIds: e.vectorSearchLayerIds,
1735
- minScore: pe,
1736
- topResults: Ra
1737
+ minScore: ge,
1738
+ topResults: La
1737
1739
  }), l = s.map(({ layerId: c, results: d }) => {
1738
1740
  const u = d.map((h) => ` - ${h.name} (${h.score.toFixed(2)})`).join(`
1739
1741
  `);
@@ -1743,7 +1745,7 @@ ${u}`;
1743
1745
  `);
1744
1746
  let n;
1745
1747
  return s.length > 0 ? n = `Vector search completed. Matching layers and fields with scores:
1746
- ${l}` : n = `No vector search results found for score over ${pe}.`, await m({ text: n }, r), {
1748
+ ${l}` : n = `No vector search results found for score over ${ge}.`, await m({ text: n }, r), {
1747
1749
  ...e,
1748
1750
  vectorSearchFieldResults: s
1749
1751
  };
@@ -1753,13 +1755,13 @@ ${l}` : n = `No vector search results found for score over ${pe}.`, await m({ te
1753
1755
  r
1754
1756
  ), new Error(`Vector search failed: ${t instanceof Error ? t.message : String(t)}`);
1755
1757
  }
1756
- }, Ia = 0.7, qa = async (e, r) => {
1758
+ }, qa = 0.7, za = async (e, r) => {
1757
1759
  try {
1758
1760
  const t = L(e.messages);
1759
1761
  await m({ text: `Similarity search to find layers: ${t}` }, r);
1760
- const a = S(r, "layerSearch"), o = S(r, "layersAndFieldsRegistry"), s = await a.searchLayers({
1762
+ const a = b(r, "layerSearch"), o = b(r, "layersAndFieldsRegistry"), s = await a.searchLayers({
1761
1763
  text: t,
1762
- minScore: Ia
1764
+ minScore: qa
1763
1765
  }), l = s.map((d) => d.id), n = s.map(({ id: d, score: u }) => `${o.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1764
1766
  `);
1765
1767
  let c;
@@ -1777,7 +1779,7 @@ ${n}` : c = "Vector search completed. No matching layers found.", await m({ text
1777
1779
  }, Ca = (e, r, t) => {
1778
1780
  const a = e.createQuery();
1779
1781
  return a.outFields = [r], a.where = t || "1=1", a.num = 1, a;
1780
- }, za = async (e, r, t, a) => {
1782
+ }, Aa = async (e, r, t, a) => {
1781
1783
  const o = a.map?.allLayers.find((u) => u.id === e), s = Ca(o, r, t.where), n = (await o.queryFeatures(s)).features[0], c = n ? n.attributes[r] : null;
1782
1784
  return {
1783
1785
  tool: "getAttribute",
@@ -1791,20 +1793,20 @@ ${n}` : c = "Vector search completed. No matching layers found.", await m({ text
1791
1793
  };
1792
1794
  };
1793
1795
  async function Na({ layerId: e, fieldName: r, query: t }, a) {
1794
- const { mapView: o } = P(a), s = await za(e, r, t, o);
1796
+ const { mapView: o } = W(a), s = await Aa(e, r, t, o);
1795
1797
  return JSON.stringify(s, null, 2);
1796
1798
  }
1797
- const Aa = i.object({
1799
+ const ka = i.object({
1798
1800
  layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1799
1801
  fieldName: i.string().describe("The name of the field/attribute from which to get a field value."),
1800
1802
  query: i.object({
1801
1803
  where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1802
1804
  })
1803
- }), ka = f(Na, {
1805
+ }), _a = f(Na, {
1804
1806
  name: "getAttribute",
1805
1807
  description: "Returns an attribute value for a given feature.",
1806
- schema: Aa
1807
- }), le = async (e, r) => {
1808
+ schema: ka
1809
+ }), ce = async (e, r) => {
1808
1810
  const t = r.map?.allLayers.find(
1809
1811
  (s) => s.id === e.layerId
1810
1812
  );
@@ -1823,14 +1825,14 @@ const Aa = i.object({
1823
1825
  return { error: "The geometry of the first feature is undefined or null." };
1824
1826
  o = s;
1825
1827
  } else {
1826
- const s = a.features.map((n) => n.geometry), l = Y.executeMany(s);
1828
+ const s = a.features.map((n) => n.geometry), l = X.executeMany(s);
1827
1829
  if (!l)
1828
1830
  return { error: "Failed to create a combined geometry." };
1829
1831
  o = l;
1830
1832
  }
1831
1833
  return { geometry: o };
1832
1834
  }, ja = async (e) => {
1833
- const { targetLayer: r, fieldName: t, statisticType: a, mapView: o, layersAndFieldsRegistry: s, geometryLayer: l } = e, n = o.map?.allLayers.find((b) => b.id === r.layerId);
1835
+ const { targetLayer: r, fieldName: t, statisticType: a, mapView: o, layersAndFieldsRegistry: s, geometryLayer: l } = e, n = o.map?.allLayers.find((S) => S.id === r.layerId);
1834
1836
  if (!n)
1835
1837
  throw new Error(`Layer '${r.layerId}' not found.`);
1836
1838
  const d = s.get(r.layerId)?.fieldRegistry.get(t);
@@ -1838,37 +1840,37 @@ const Aa = i.object({
1838
1840
  throw new Error(`Field '${t}' not found.`);
1839
1841
  let u;
1840
1842
  if (l) {
1841
- const b = await le(l, o);
1842
- if ("error" in b)
1843
- throw new Error(b.error);
1844
- if (u = b.geometry, l.distance && l.units) {
1845
- const T = We.execute(u, l.distance, {
1843
+ const S = await ce(l, o);
1844
+ if ("error" in S)
1845
+ throw new Error(S.error);
1846
+ if (u = S.geometry, l.distance && l.units) {
1847
+ const T = Ue.execute(u, l.distance, {
1846
1848
  unit: l.units === "us-nautical-miles" ? "nautical-miles" : l.units
1847
1849
  });
1848
1850
  T && (u = T);
1849
1851
  }
1850
1852
  } else
1851
1853
  u = o.extent.clone();
1852
- const h = new V({
1854
+ const h = new D({
1853
1855
  geometry: u,
1854
1856
  spatialRelationship: "intersects"
1855
1857
  });
1856
1858
  let p = null, y = null;
1857
1859
  try {
1858
- p = await X({
1860
+ p = await ee({
1859
1861
  layer: n,
1860
1862
  field: t,
1861
1863
  sqlWhere: r.where,
1862
1864
  filter: h,
1863
1865
  outStatisticTypes: { include: [a] }
1864
- }), d.type === "string" && (y = (await ee({
1866
+ }), d.type === "string" && (y = (await te({
1865
1867
  layer: n,
1866
1868
  field: t,
1867
1869
  sqlWhere: r.where,
1868
1870
  filter: h
1869
1871
  })).uniqueValueInfos);
1870
- } catch (b) {
1871
- console.error("Statistics error:", b);
1872
+ } catch (S) {
1873
+ console.error("Statistics error:", S);
1872
1874
  }
1873
1875
  return {
1874
1876
  tool: "getStatistics",
@@ -1883,14 +1885,14 @@ const Aa = i.object({
1883
1885
  where: r.where
1884
1886
  }
1885
1887
  };
1886
- }, _a = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], Ma = i.enum(_a);
1887
- async function Va({
1888
+ }, Ma = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], Va = i.enum(Ma);
1889
+ async function Da({
1888
1890
  targetLayer: e,
1889
1891
  fieldName: r,
1890
1892
  statisticType: t,
1891
1893
  geometryLayer: a
1892
1894
  }, o) {
1893
- const s = S(o, "layersAndFieldsRegistry"), { mapView: l } = P(o), n = await ja({
1895
+ const s = b(o, "layersAndFieldsRegistry"), { mapView: l } = W(o), n = await ja({
1894
1896
  targetLayer: e,
1895
1897
  fieldName: r,
1896
1898
  statisticType: t,
@@ -1900,7 +1902,7 @@ async function Va({
1900
1902
  });
1901
1903
  return console.log(n), JSON.stringify(n, null, 2);
1902
1904
  }
1903
- const Da = i.object({
1905
+ const Qa = i.object({
1904
1906
  targetLayer: i.object({
1905
1907
  layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1906
1908
  where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
@@ -1912,19 +1914,19 @@ const Da = i.object({
1912
1914
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
1913
1915
  ),
1914
1916
  distance: i.number().optional().describe("The distance by which to query from the input geometry."),
1915
- units: Ma.optional().describe("The units used to query by geometry and distance.")
1917
+ units: Va.optional().describe("The units used to query by geometry and distance.")
1916
1918
  }),
1917
1919
  i.object({}).strict()
1918
1920
  // <-- Allows `{}` without throwing
1919
1921
  ]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1920
1922
  fieldName: i.string().describe("The name of the field for which to get statistics."),
1921
1923
  statisticType: i.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1922
- }), Qa = f(Va, {
1924
+ }), Oa = f(Da, {
1923
1925
  name: "getStatistics",
1924
1926
  description: "Returns one or more summary statistics for the given field. Statistic types include: count, maximum, minimum, average, median, standard deviation, variance, mode, sum, nullcount (number of features without a value for a given field), unique values. Statistics can be returned for number, date, and string fields. Only call this tool when the question requires filtering (e.g. a WHERE clause or spatial constraint) that cannot be satisfied by precomputed stats.",
1925
- schema: Da
1926
- }), Oa = async (e, r, t, a) => {
1927
- const o = t.map?.allLayers.find((u) => u.id === e.layerId), s = a ? await le(a, t) : { geometry: void 0 }, l = "geometry" in s ? s.geometry : void 0, n = new xe({
1927
+ schema: Qa
1928
+ }), Pa = async (e, r, t, a) => {
1929
+ const o = t.map?.allLayers.find((u) => u.id === e.layerId), s = a ? await ce(a, t) : { geometry: void 0 }, l = "geometry" in s ? s.geometry : void 0, n = new xe({
1928
1930
  where: e.where || "1=1",
1929
1931
  outFields: e.outFields.length ? e.outFields : ["*"],
1930
1932
  orderByFields: e.orderByFields,
@@ -1948,14 +1950,14 @@ const Da = i.object({
1948
1950
  where: e.where
1949
1951
  }
1950
1952
  };
1951
- }, Pa = async ({
1953
+ }, Wa = async ({
1952
1954
  targetLayer: e,
1953
1955
  topFilter: r,
1954
1956
  geometryLayer: t
1955
1957
  }, a) => {
1956
- const { mapView: o } = P(a), s = await Oa(e, r, o, t);
1958
+ const { mapView: o } = W(a), s = await Pa(e, r, o, t);
1957
1959
  return JSON.stringify(s, null, 2);
1958
- }, Ba = i.object({
1960
+ }, Ga = i.object({
1959
1961
  targetLayer: i.object({
1960
1962
  layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1961
1963
  where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
@@ -1972,19 +1974,19 @@ const Da = i.object({
1972
1974
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
1973
1975
  ),
1974
1976
  distance: i.number().describe("The distance by which to query from the input geometry."),
1975
- units: z.describe("The units used to query by geometry and distance.")
1977
+ units: C.describe("The units used to query by geometry and distance.")
1976
1978
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1977
1979
  topFilter: i.object({
1978
1980
  topCount: i.number().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
1979
1981
  orderByFields: i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),
1980
1982
  groupByFields: i.array(i.string().describe("The field(s) for which to group by the top features."))
1981
1983
  })
1982
- }), Ga = f(Pa, {
1984
+ }), Ba = f(Wa, {
1983
1985
  name: "getTopFeatures",
1984
1986
  description: "Returns the top n features from a layer",
1985
- schema: Ba
1986
- }), Wa = async (e, r, t) => {
1987
- const a = r.map?.allLayers.find((d) => d.id === e.layerId), o = t ? await le(t, r) : { geometry: void 0 }, s = "geometry" in o ? o.geometry : void 0, l = new te({
1987
+ schema: Ga
1988
+ }), Ua = async (e, r, t) => {
1989
+ const a = r.map?.allLayers.find((d) => d.id === e.layerId), o = t ? await ce(t, r) : { geometry: void 0 }, s = "geometry" in o ? o.geometry : void 0, l = new re({
1988
1990
  where: e.where || "1=1",
1989
1991
  outFields: e.outFields.length ? e.outFields : ["*"],
1990
1992
  orderByFields: e.orderByFields,
@@ -2004,14 +2006,14 @@ const Da = i.object({
2004
2006
  }
2005
2007
  };
2006
2008
  };
2007
- async function Ua({
2009
+ async function Ha({
2008
2010
  targetLayer: e,
2009
2011
  geometryLayer: r
2010
2012
  }, t) {
2011
- const { mapView: a } = P(t), o = await Wa(e, a, r);
2013
+ const { mapView: a } = W(t), o = await Ua(e, a, r);
2012
2014
  return JSON.stringify(o, null, 2);
2013
2015
  }
2014
- const Ha = i.object({
2016
+ const Za = i.object({
2015
2017
  targetLayer: i.object({
2016
2018
  layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
2017
2019
  where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
@@ -2028,22 +2030,22 @@ const Ha = i.object({
2028
2030
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
2029
2031
  ),
2030
2032
  distance: i.number().describe("The distance by which to query from the input geometry."),
2031
- units: z.describe("The units used to query by geometry and distance.")
2033
+ units: C.describe("The units used to query by geometry and distance.")
2032
2034
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries.")
2033
- }), Za = f(Ua, {
2035
+ }), Ka = f(Ha, {
2034
2036
  name: "queryFeatures",
2035
2037
  description: "Queries for one or more features from a given layer.",
2036
- schema: Ha
2037
- }), ke = [Za, Qa, ka, Ga], Ka = async (e, r) => {
2038
+ schema: Za
2039
+ }), ke = [Ka, Oa, _a, Ba], Ja = async (e, r) => {
2038
2040
  await m({ text: "Requesting LLM for layer query results" }, r);
2039
- const t = await $("data_query_prompt");
2041
+ const t = await E("data_query_prompt");
2040
2042
  if (!r?.configurable)
2041
2043
  throw new Error("config.configurable is required for layer query tools");
2042
2044
  const { userTimezone: a, userTimezoneOffset: o } = G(), s = {
2043
2045
  layerFieldInfo: e.layerFieldInfo,
2044
2046
  userTimezone: a,
2045
2047
  userTimezoneOffset: o
2046
- }, l = await N({
2048
+ }, l = await _({
2047
2049
  promptText: t,
2048
2050
  messages: v(e.messages),
2049
2051
  inputVariables: s,
@@ -2055,10 +2057,10 @@ const Ha = i.object({
2055
2057
  messages: [...e.messages, l]
2056
2058
  };
2057
2059
  const c = l.content.toString() || "LLM requested tool calls.";
2058
- return await Q(l, r), { ...e, outputMessage: c, messages: [...e.messages, l] };
2059
- }, Ja = new A(ke);
2060
- async function Ya(e, r) {
2061
- const { messages: t } = await Ja.invoke(
2060
+ return await O(l, r), { ...e, outputMessage: c, messages: [...e.messages, l] };
2061
+ }, Ya = new j(ke);
2062
+ async function Xa(e, r) {
2063
+ const { messages: t } = await Ya.invoke(
2062
2064
  { messages: v(e.messages) },
2063
2065
  r
2064
2066
  ), a = [], o = [];
@@ -2079,7 +2081,7 @@ async function Ya(e, r) {
2079
2081
  }
2080
2082
  if (o.length === 0)
2081
2083
  return { ...e, queryResponses: a };
2082
- const s = new B({
2084
+ const s = new Q({
2083
2085
  content: `Query results:
2084
2086
  ${o.join(`
2085
2087
  `)}`
@@ -2093,45 +2095,45 @@ ${o.join(`
2093
2095
  queryResponses: a
2094
2096
  };
2095
2097
  }
2096
- const Xa = async (e, r) => {
2098
+ const eo = async (e, r) => {
2097
2099
  try {
2098
2100
  await m({ text: "Requesting LLM for summary on query results" }, r);
2099
- const a = await $("summarize_query_response_prompt"), o = {
2101
+ const a = await E("summarize_query_response_prompt"), o = {
2100
2102
  queryResponse: e.queryResponses
2101
- }, s = await be({
2103
+ }, s = await J({
2102
2104
  promptText: a,
2103
2105
  messages: v(e.messages),
2104
2106
  inputVariables: o
2105
2107
  }), l = typeof s == "string" ? s : s.content;
2106
- return e.messages = [...e.messages, new B(l)], e.outputMessage = l, await m({ text: `Received response from LLM: ${l}` }, r), e;
2108
+ return e.messages = [...e.messages, new Q(l)], e.outputMessage = l, await m({ text: `Received response from LLM: ${l}` }, r), e;
2107
2109
  } catch (t) {
2108
2110
  throw await m({ text: "Error during filter LLM request" }, r), new Error(`Error during filter LLM request: ${t instanceof Error ? t.message : String(t)}`);
2109
2111
  }
2110
- }, eo = (e, r) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Query Agent")(e, r), to = () => new _(Ae).addNode("requireLayerQueryServices", eo).addNode("vectorSearchLayers", qa).addNode("vectorSearchFields", La).addNode("fieldStatistics", Fa).addNode("agent", Ka).addNode("tools", Ya).addNode("summarizeQueryResponseLLM", Xa).addNode("earlyExit", $a).addEdge(M, "requireLayerQueryServices").addEdge("requireLayerQueryServices", "vectorSearchLayers").addConditionalEdges(
2112
+ }, to = (e, r) => M(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Query Agent")(e, r), ro = () => new N(Ne).addNode("requireLayerQueryServices", to).addNode("vectorSearchLayers", za).addNode("vectorSearchFields", Ia).addNode("fieldStatistics", Ra).addNode("agent", Ja).addNode("tools", Xa).addNode("summarizeQueryResponseLLM", eo).addNode("earlyExit", Fa).addEdge(k, "requireLayerQueryServices").addEdge("requireLayerQueryServices", "vectorSearchLayers").addConditionalEdges(
2111
2113
  "vectorSearchLayers",
2112
2114
  (r) => r.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
2113
2115
  ).addConditionalEdges(
2114
2116
  "vectorSearchFields",
2115
2117
  (r) => r.vectorSearchFieldResults.length ? "fieldStatistics" : "earlyExit"
2116
- ).addEdge("fieldStatistics", "agent").addEdge("agent", "tools").addConditionalEdges("tools", (r) => r.queryResponses.length ? "summarizeQueryResponseLLM" : "earlyExit").addEdge("summarizeQueryResponseLLM", x).addEdge("earlyExit", x), ro = String.raw`- **layerQuery** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. CRITICAL: Always call the Layer Filter Agent after this agent.
2118
+ ).addEdge("fieldStatistics", "agent").addEdge("agent", "tools").addConditionalEdges("tools", (r) => r.queryResponses.length ? "summarizeQueryResponseLLM" : "earlyExit").addEdge("summarizeQueryResponseLLM", x).addEdge("earlyExit", x), ao = String.raw`- **layerQuery** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. CRITICAL: Always call the Layer Filter Agent after this agent.
2117
2119
  This also includes questions that ask which feature meets a given condition or where a particular feature in the data is located (e.g., “Where is the spring with the highest elevation?”).
2118
2120
  _Example: “How many features are there?”_
2119
2121
  _Example: “What’s the average population?”_
2120
- _Example: “Which values are in the status field?”_`, Li = {
2122
+ _Example: “Which values are in the status field?”_`, ki = {
2121
2123
  id: "layerQuery",
2122
2124
  name: "Layer Query Agent",
2123
- description: ro,
2124
- createGraph: to,
2125
- workspace: Ae
2126
- }, ge = 0.7, ao = 10, oo = async (e, r) => {
2125
+ description: ao,
2126
+ createGraph: ro,
2127
+ workspace: Ne
2128
+ }, fe = 0.7, oo = 10, so = async (e, r) => {
2127
2129
  try {
2128
2130
  const t = L(e.messages);
2129
2131
  await m({ text: "Similarity search to find fields" }, r);
2130
- const a = S(r, "fieldSearch"), o = S(r, "layersAndFieldsRegistry"), s = await a.searchFields({
2132
+ const a = b(r, "fieldSearch"), o = b(r, "layersAndFieldsRegistry"), s = await a.searchFields({
2131
2133
  text: t,
2132
2134
  layerIds: e.vectorSearchLayerIds,
2133
- minScore: ge,
2134
- topResults: ao
2135
+ minScore: fe,
2136
+ topResults: oo
2135
2137
  }), l = s.map(({ layerId: c, results: d }) => {
2136
2138
  const u = d.map((h) => ` - ${h.name} (${h.score.toFixed(2)})`).join(`
2137
2139
  `);
@@ -2141,7 +2143,7 @@ ${u}`;
2141
2143
  `);
2142
2144
  let n;
2143
2145
  return s.length > 0 ? n = `Vector search completed. Matching layers and fields with scores:
2144
- ${l}` : n = `No vector search results found for score over ${ge}.`, await m({ text: n }, r), {
2146
+ ${l}` : n = `No vector search results found for score over ${fe}.`, await m({ text: n }, r), {
2145
2147
  ...e,
2146
2148
  vectorSearchFieldResults: s
2147
2149
  };
@@ -2151,13 +2153,13 @@ ${l}` : n = `No vector search results found for score over ${ge}.`, await m({ te
2151
2153
  r
2152
2154
  ), new Error(`Vector search failed: ${t instanceof Error ? t.message : String(t)}`);
2153
2155
  }
2154
- }, so = 0.7, io = async (e, r) => {
2156
+ }, io = 0.7, no = async (e, r) => {
2155
2157
  try {
2156
2158
  const t = L(e.messages);
2157
2159
  await m({ text: `Similarity search to find layers: ${t}` }, r);
2158
- const a = S(r, "layerSearch"), o = S(r, "layersAndFieldsRegistry"), s = await a.searchLayers({
2160
+ const a = b(r, "layerSearch"), o = b(r, "layersAndFieldsRegistry"), s = await a.searchLayers({
2159
2161
  text: t,
2160
- minScore: so
2162
+ minScore: io
2161
2163
  }), l = s.map((d) => d.id), n = s.map(({ id: d, score: u }) => `${o.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
2162
2164
  `);
2163
2165
  let c;
@@ -2173,16 +2175,16 @@ ${n}` : c = "Vector search completed. No matching layers found.", await m({ text
2173
2175
  ), new Error(`Vector search failed: ${t instanceof Error ? t.message : String(t)}`);
2174
2176
  }
2175
2177
  };
2176
- async function no(e) {
2178
+ async function lo(e) {
2177
2179
  const { fields: r, layer: t, view: a, styleName: o, colorSchemeTags: s } = e;
2178
2180
  let l;
2179
- return s ? l = He({
2180
- basemapTheme: await de(a),
2181
+ return s ? l = Ze({
2182
+ basemapTheme: await ue(a),
2181
2183
  geometryType: t.geometryType,
2182
2184
  includedTags: s,
2183
2185
  numColors: Math.min(r.length, 8)
2184
- })[0] : l = Ze({
2185
- basemapTheme: await de(a),
2186
+ })[0] : l = Ke({
2187
+ basemapTheme: await ue(a),
2186
2188
  geometryType: t.geometryType,
2187
2189
  numColors: Math.min(r.length, 8)
2188
2190
  }).primaryScheme, {
@@ -2198,10 +2200,10 @@ async function no(e) {
2198
2200
  pieChartScheme: l
2199
2201
  };
2200
2202
  }
2201
- async function lo(e) {
2202
- return await Ue(e);
2203
+ async function co(e) {
2204
+ return await He(e);
2203
2205
  }
2204
- async function co({
2206
+ async function uo({
2205
2207
  arcgisMap: e,
2206
2208
  arcgisMapView: r,
2207
2209
  layerId: t,
@@ -2220,30 +2222,30 @@ async function co({
2220
2222
  colorSchemeTags: o
2221
2223
  };
2222
2224
  try {
2223
- const u = await no(d), h = await lo(u);
2225
+ const u = await lo(d), h = await co(u);
2224
2226
  return n.renderer = h.renderer, n.visible = !0, `Chart renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
2225
2227
  } catch (u) {
2226
2228
  return `Error applying chart renderer: ${u instanceof Error ? u.message : String(u)}`;
2227
2229
  }
2228
2230
  }
2229
- const uo = ["mapView"];
2231
+ const ho = ["mapView"];
2230
2232
  function F(e) {
2231
2233
  const t = e?.configurable?.context;
2232
2234
  if (!t || typeof t != "object")
2233
2235
  throw new Error("LayerStylingAgent context missing");
2234
- const a = uo.filter((o) => !(o in t));
2236
+ const a = ho.filter((o) => !(o in t));
2235
2237
  if (a.length)
2236
2238
  throw new Error(`LayerStylingAgent context missing: ${a.join(", ")}`);
2237
2239
  return t;
2238
2240
  }
2239
- async function ho({
2241
+ async function mo({
2240
2242
  layerId: e,
2241
2243
  fields: r,
2242
2244
  colorSchemes: t,
2243
2245
  includeSize: a
2244
2246
  }, o) {
2245
2247
  const { mapView: s } = F(o);
2246
- return await E({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await co({
2248
+ return await $({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await uo({
2247
2249
  arcgisMap: s.map,
2248
2250
  arcgisMapView: s,
2249
2251
  layerId: e,
@@ -2252,12 +2254,12 @@ async function ho({
2252
2254
  includeSize: a
2253
2255
  });
2254
2256
  }
2255
- const mo = i.object({
2257
+ const yo = i.object({
2256
2258
  layerId: i.string().describe("The id of the layer to apply the chart renderer to"),
2257
2259
  fields: i.array(i.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
2258
2260
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
2259
2261
  includeSize: i.boolean().optional().describe("Whether to vary the chart size (chart-size)")
2260
- }), yo = f(ho, {
2262
+ }), po = f(mo, {
2261
2263
  name: "chart",
2262
2264
  description: `Label: Charts
2263
2265
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
@@ -2270,12 +2272,12 @@ const mo = i.object({
2270
2272
  Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
2271
2273
  Example: Show the total number of homes built in each decade using a pie chart for each feature and vary the size of each chart based on the total of all categories.
2272
2274
  Fields: This style requires 2-8 number fields.`,
2273
- schema: mo
2275
+ schema: yo
2274
2276
  });
2275
- function po(e) {
2277
+ function go(e) {
2276
2278
  const { fields: r, layer: t, view: a, theme: o, colorSchemeTags: s } = e, l = r[0];
2277
2279
  let n;
2278
- return s && (n = re({
2280
+ return s && (n = ae({
2279
2281
  geometryType: t.geometryType,
2280
2282
  includedTags: s,
2281
2283
  theme: o || "high-to-low"
@@ -2290,10 +2292,10 @@ function po(e) {
2290
2292
  colorScheme: n
2291
2293
  };
2292
2294
  }
2293
- async function go(e) {
2294
- return await Ke(e);
2295
+ async function fo(e) {
2296
+ return await Je(e);
2295
2297
  }
2296
- async function fo({
2298
+ async function wo({
2297
2299
  arcgisMap: e,
2298
2300
  arcgisMapView: r,
2299
2301
  layerId: t,
@@ -2313,20 +2315,20 @@ async function fo({
2313
2315
  theme: s
2314
2316
  };
2315
2317
  try {
2316
- const d = po(c), u = await go(d);
2318
+ const d = go(c), u = await fo(d);
2317
2319
  return n.renderer = u.renderer, n.visible = !0, `Color-age renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
2318
2320
  } catch (d) {
2319
2321
  return `Error applying color-age renderer: ${d instanceof Error ? d.message : String(d)}`;
2320
2322
  }
2321
2323
  }
2322
- async function wo({
2324
+ async function bo({
2323
2325
  layerId: e,
2324
2326
  fields: r,
2325
2327
  colorSchemes: t,
2326
2328
  theme: a
2327
2329
  }, o) {
2328
2330
  const { mapView: s } = F(o);
2329
- return await E({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await fo({
2331
+ return await $({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await wo({
2330
2332
  arcgisMap: s.map,
2331
2333
  arcgisMapView: s,
2332
2334
  layerId: e,
@@ -2335,26 +2337,26 @@ async function wo({
2335
2337
  theme: a
2336
2338
  });
2337
2339
  }
2338
- const bo = i.object({
2340
+ const So = i.object({
2339
2341
  layerId: i.string().describe("The id of the layer to apply the color-age renderer to"),
2340
2342
  fields: i.array(i.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
2341
2343
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
2342
2344
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
2343
- }), So = f(wo, {
2345
+ }), vo = f(bo, {
2344
2346
  name: "color-age",
2345
2347
  description: `Label: Age (color)
2346
2348
  Description: Use colors along a continuous color ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
2347
2349
  Keywords: since, age, how old, how long
2348
2350
  Example: Show the age of each feature based on its reported date.
2349
2351
  Fields: This style requires at least one field with a date type.`,
2350
- schema: bo
2352
+ schema: So
2351
2353
  });
2352
- function vo(e) {
2354
+ function To(e) {
2353
2355
  const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
2354
2356
  let { theme: s } = e, l = r[1];
2355
2357
  const n = r[0];
2356
2358
  let c;
2357
- return o && (c = re({
2359
+ return o && (c = ae({
2358
2360
  geometryType: t.geometryType,
2359
2361
  includedTags: o,
2360
2362
  theme: s || "high-to-low"
@@ -2369,10 +2371,10 @@ function vo(e) {
2369
2371
  colorScheme: c
2370
2372
  };
2371
2373
  }
2372
- async function To(e) {
2373
- return await Je(e);
2374
+ async function xo(e) {
2375
+ return await Ye(e);
2374
2376
  }
2375
- async function xo({
2377
+ async function Eo({
2376
2378
  arcgisMap: e,
2377
2379
  arcgisMapView: r,
2378
2380
  layerId: t,
@@ -2392,20 +2394,20 @@ async function xo({
2392
2394
  theme: s
2393
2395
  };
2394
2396
  try {
2395
- const d = vo(c), u = await To(d);
2397
+ const d = To(c), u = await xo(d);
2396
2398
  return n.renderer = u.renderer, n.visible = !0, `Color renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
2397
2399
  } catch (d) {
2398
2400
  return `Error applying color renderer: ${d instanceof Error ? d.message : String(d)}`;
2399
2401
  }
2400
2402
  }
2401
- async function Eo({
2403
+ async function $o({
2402
2404
  layerId: e,
2403
2405
  fields: r,
2404
2406
  colorSchemes: t,
2405
2407
  theme: a
2406
2408
  }, o) {
2407
2409
  const { mapView: s } = F(o);
2408
- return await E({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await xo({
2410
+ return await $({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Eo({
2409
2411
  arcgisMap: s.map,
2410
2412
  arcgisMapView: s,
2411
2413
  layerId: e,
@@ -2414,25 +2416,25 @@ async function Eo({
2414
2416
  theme: a
2415
2417
  });
2416
2418
  }
2417
- const $o = i.object({
2419
+ const Fo = i.object({
2418
2420
  layerId: i.string().describe("The id of the layer to apply the color renderer to"),
2419
2421
  fields: i.array(i.string()).describe("The field(s) to use for the color renderer"),
2420
2422
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
2421
2423
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
2422
- }), Fo = f(Eo, {
2424
+ }), Ro = f($o, {
2423
2425
  name: "color",
2424
2426
  description: `Label: Counts and Amounts (color)
2425
2427
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
2426
2428
  Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
2427
2429
  Example: Color each feature based on the population density.
2428
2430
  Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.`,
2429
- schema: $o
2431
+ schema: Fo
2430
2432
  });
2431
- function Ro(e) {
2433
+ function Lo(e) {
2432
2434
  const { fields: r, layer: t, view: a, colorSchemeTags: o, theme: s } = e;
2433
2435
  let l, n;
2434
2436
  const c = r[0];
2435
- return o && (n = re({
2437
+ return o && (n = ae({
2436
2438
  geometryType: t.geometryType,
2437
2439
  includedTags: o,
2438
2440
  theme: s || "high-to-low"
@@ -2447,10 +2449,10 @@ function Ro(e) {
2447
2449
  }
2448
2450
  };
2449
2451
  }
2450
- async function Lo(e) {
2451
- return await Ye(e);
2452
+ async function Io(e) {
2453
+ return await Xe(e);
2452
2454
  }
2453
- async function Io({
2455
+ async function qo({
2454
2456
  arcgisMap: e,
2455
2457
  arcgisMapView: r,
2456
2458
  layerId: t,
@@ -2470,20 +2472,20 @@ async function Io({
2470
2472
  theme: s
2471
2473
  };
2472
2474
  try {
2473
- const d = Ro(c), u = await Lo(d);
2475
+ const d = Lo(c), u = await Io(d);
2474
2476
  return n.renderer = u.renderer, n.visible = !0, `Color-size-univariate renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
2475
2477
  } catch (d) {
2476
2478
  return `Error applying color-size-univariate renderer: ${d instanceof Error ? d.message : String(d)}`;
2477
2479
  }
2478
2480
  }
2479
- async function qo({
2481
+ async function zo({
2480
2482
  layerId: e,
2481
2483
  fields: r,
2482
2484
  colorSchemes: t,
2483
2485
  theme: a
2484
2486
  }, o) {
2485
2487
  const { mapView: s } = F(o);
2486
- return await E({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Io({
2488
+ return await $({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await qo({
2487
2489
  arcgisMap: s.map,
2488
2490
  arcgisMapView: s,
2489
2491
  layerId: e,
@@ -2497,7 +2499,7 @@ const Co = i.object({
2497
2499
  fields: i.array(i.string()).describe("The fields to use for the color-size univariate renderer"),
2498
2500
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
2499
2501
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
2500
- }), zo = f(qo, {
2502
+ }), Ao = f(zo, {
2501
2503
  name: "color-size-univariate",
2502
2504
  description: `Label: Color and Size (univariate)
2503
2505
  Description: Vary symbol size and color based on the values of two numeric attributes.
@@ -2509,7 +2511,7 @@ const Co = i.object({
2509
2511
  function No(e) {
2510
2512
  const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
2511
2513
  let s;
2512
- return o && (s = et({
2514
+ return o && (s = tt({
2513
2515
  includedTags: o,
2514
2516
  numColors: Math.min(r.length, 8)
2515
2517
  })[0]), {
@@ -2526,10 +2528,10 @@ function No(e) {
2526
2528
  dotDensityScheme: s
2527
2529
  };
2528
2530
  }
2529
- async function Ao(e) {
2530
- return await Xe(e);
2531
+ async function ko(e) {
2532
+ return await et(e);
2531
2533
  }
2532
- async function ko({
2534
+ async function _o({
2533
2535
  arcgisMap: e,
2534
2536
  arcgisMapView: r,
2535
2537
  layerId: t,
@@ -2547,7 +2549,7 @@ async function ko({
2547
2549
  colorSchemeTags: o
2548
2550
  };
2549
2551
  try {
2550
- const c = No(n), d = await Ao(c);
2552
+ const c = No(n), d = await ko(c);
2551
2553
  return l.renderer = d.renderer, l.visible = !0, `Dot Density renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
2552
2554
  } catch (c) {
2553
2555
  return `Error applying dot density renderer: ${c instanceof Error ? c.message : String(c)}`;
@@ -2559,7 +2561,7 @@ async function jo({
2559
2561
  colorSchemes: t
2560
2562
  }, a) {
2561
2563
  const { mapView: o } = F(a);
2562
- return await E({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await ko({
2564
+ return await $({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await _o({
2563
2565
  arcgisMap: o.map,
2564
2566
  arcgisMapView: o,
2565
2567
  layerId: e,
@@ -2567,11 +2569,11 @@ async function jo({
2567
2569
  colorSchemes: t
2568
2570
  });
2569
2571
  }
2570
- const _o = i.object({
2572
+ const Mo = i.object({
2571
2573
  layerId: i.string().describe("The id of the layer to apply the dot density renderer to"),
2572
2574
  fields: i.array(i.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
2573
2575
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
2574
- }), Mo = f(jo, {
2576
+ }), Vo = f(jo, {
2575
2577
  name: "dot-density",
2576
2578
  description: `Dot Density
2577
2579
  Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
@@ -2585,13 +2587,13 @@ const _o = i.object({
2585
2587
  - Display demographic patterns within census tracts
2586
2588
  **Fields:** Requires 2-8 number fields.
2587
2589
  **Keywords:** density, how much, how many, total, number, amount`,
2588
- schema: _o
2590
+ schema: Mo
2589
2591
  });
2590
- function Vo(e) {
2592
+ function Do(e) {
2591
2593
  const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
2592
2594
  let s;
2593
2595
  const l = r[0];
2594
- return o && (s = rt({
2596
+ return o && (s = at({
2595
2597
  includedTags: o,
2596
2598
  basemap: a.map?.basemap || "topo"
2597
2599
  })[0]), {
@@ -2601,10 +2603,10 @@ function Vo(e) {
2601
2603
  heatmapScheme: s
2602
2604
  };
2603
2605
  }
2604
- async function Do(e) {
2605
- return await tt(e);
2606
+ async function Qo(e) {
2607
+ return await rt(e);
2606
2608
  }
2607
- async function Qo({
2609
+ async function Oo({
2608
2610
  arcgisMap: e,
2609
2611
  arcgisMapView: r,
2610
2612
  layerId: t,
@@ -2622,19 +2624,19 @@ async function Qo({
2622
2624
  colorSchemeTags: o
2623
2625
  };
2624
2626
  try {
2625
- const c = Vo(n), d = await Do(c);
2627
+ const c = Do(n), d = await Qo(c);
2626
2628
  return l.renderer = d.renderer, l.visible = !0, `Heatmap renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
2627
2629
  } catch (c) {
2628
2630
  return `Error applying heatmap renderer: ${c instanceof Error ? c.message : String(c)}`;
2629
2631
  }
2630
2632
  }
2631
- async function Oo({
2633
+ async function Po({
2632
2634
  layerId: e,
2633
2635
  fields: r,
2634
2636
  colorSchemes: t
2635
2637
  }, a) {
2636
2638
  const { mapView: o } = F(a);
2637
- return await E({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await Qo({
2639
+ return await $({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await Oo({
2638
2640
  arcgisMap: o.map,
2639
2641
  arcgisMapView: o,
2640
2642
  layerId: e,
@@ -2642,23 +2644,23 @@ async function Oo({
2642
2644
  colorSchemes: t
2643
2645
  });
2644
2646
  }
2645
- const Po = i.object({
2647
+ const Wo = i.object({
2646
2648
  layerId: i.string().describe("The id of the layer to apply the heatmap renderer to"),
2647
2649
  fields: i.array(i.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
2648
2650
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
2649
- }), Bo = f(Oo, {
2651
+ }), Go = f(Po, {
2650
2652
  name: "heatmap",
2651
2653
  description: `Label: Heat Map
2652
2654
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
2653
2655
  Keywords: density, heatmap, hot spots, pattern, cluster
2654
2656
  Example: Create a heatmap
2655
2657
  Fields: This typically requires zero or one field of type number.`,
2656
- schema: Po
2658
+ schema: Wo
2657
2659
  });
2658
- function Go(e) {
2660
+ function Bo(e) {
2659
2661
  const { fields: r, layer: t, view: a, styleName: o, colorSchemeTags: s } = e;
2660
2662
  let l;
2661
- return s && (l = ot({
2663
+ return s && (l = st({
2662
2664
  geometryType: t.geometryType,
2663
2665
  includedTags: s,
2664
2666
  numColors: Math.min(r.length, 10)
@@ -2672,10 +2674,10 @@ function Go(e) {
2672
2674
  predominanceScheme: l
2673
2675
  };
2674
2676
  }
2675
- async function Wo(e) {
2676
- return await at(e);
2677
+ async function Uo(e) {
2678
+ return await ot(e);
2677
2679
  }
2678
- async function Uo({
2680
+ async function Ho({
2679
2681
  arcgisMap: e,
2680
2682
  arcgisMapView: r,
2681
2683
  layerId: t,
@@ -2694,20 +2696,20 @@ async function Uo({
2694
2696
  colorSchemeTags: o
2695
2697
  };
2696
2698
  try {
2697
- const u = Go(d), h = await Wo(u);
2699
+ const u = Bo(d), h = await Uo(u);
2698
2700
  return n.renderer = h.renderer, n.visible = !0, `Predominance renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
2699
2701
  } catch (u) {
2700
2702
  return `Error applying predominance renderer: ${u instanceof Error ? u.message : String(u)}`;
2701
2703
  }
2702
2704
  }
2703
- async function Ho({
2705
+ async function Zo({
2704
2706
  layerId: e,
2705
2707
  fields: r,
2706
2708
  colorSchemes: t,
2707
2709
  includeSize: a
2708
2710
  }, o) {
2709
2711
  const { mapView: s } = F(o);
2710
- return await E({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Uo({
2712
+ return await $({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Ho({
2711
2713
  arcgisMap: s.map,
2712
2714
  arcgisMapView: s,
2713
2715
  layerId: e,
@@ -2716,12 +2718,12 @@ async function Ho({
2716
2718
  includeSize: a
2717
2719
  });
2718
2720
  }
2719
- const Zo = i.object({
2721
+ const Ko = i.object({
2720
2722
  layerId: i.string().describe("The id of the layer to apply the predominance renderer to"),
2721
2723
  fields: i.array(i.string()).describe("The fields to use for the predominance renderer (competing categories)"),
2722
2724
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
2723
2725
  includeSize: i.boolean().optional().describe("Whether to include size visualization (predominance-size)")
2724
- }), Ko = f(Ho, {
2726
+ }), Jo = f(Zo, {
2725
2727
  name: "predominance",
2726
2728
  description: `Label: Predominant category
2727
2729
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
@@ -2734,9 +2736,9 @@ const Zo = i.object({
2734
2736
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
2735
2737
  Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
2736
2738
  Fields: This style relies on 2-10 number fields.`,
2737
- schema: Zo
2739
+ schema: Ko
2738
2740
  });
2739
- function Jo(e) {
2741
+ function Yo(e) {
2740
2742
  const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
2741
2743
  let s;
2742
2744
  const l = {
@@ -2744,7 +2746,7 @@ function Jo(e) {
2744
2746
  }, n = {
2745
2747
  field: r[1]
2746
2748
  };
2747
- return o && (s = it({
2749
+ return o && (s = nt({
2748
2750
  geometryType: t.geometryType,
2749
2751
  includedTags: o
2750
2752
  })[0]), {
@@ -2757,10 +2759,10 @@ function Jo(e) {
2757
2759
  relationshipScheme: s
2758
2760
  };
2759
2761
  }
2760
- async function Yo(e) {
2761
- return await st(e);
2762
+ async function Xo(e) {
2763
+ return await it(e);
2762
2764
  }
2763
- async function Xo({
2765
+ async function es({
2764
2766
  arcgisMap: e,
2765
2767
  arcgisMapView: r,
2766
2768
  layerId: t,
@@ -2778,19 +2780,19 @@ async function Xo({
2778
2780
  colorSchemeTags: o
2779
2781
  };
2780
2782
  try {
2781
- const c = Jo(n), d = await Yo(c);
2783
+ const c = Yo(n), d = await Xo(c);
2782
2784
  return l.renderer = d.renderer, l.visible = !0, `Relationship renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
2783
2785
  } catch (c) {
2784
2786
  return `Error applying relationship renderer: ${c instanceof Error ? c.message : String(c)}`;
2785
2787
  }
2786
2788
  }
2787
- async function es({
2789
+ async function ts({
2788
2790
  layerId: e,
2789
2791
  fields: r,
2790
2792
  colorSchemes: t
2791
2793
  }, a) {
2792
2794
  const { mapView: o } = F(a);
2793
- return await E({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await Xo({
2795
+ return await $({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await es({
2794
2796
  arcgisMap: o.map,
2795
2797
  arcgisMapView: o,
2796
2798
  layerId: e,
@@ -2798,20 +2800,20 @@ async function es({
2798
2800
  colorSchemes: t
2799
2801
  });
2800
2802
  }
2801
- const ts = i.object({
2803
+ const rs = i.object({
2802
2804
  layerId: i.string().describe("The id of the layer to apply the relationship renderer to"),
2803
2805
  fields: i.array(i.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
2804
2806
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
2805
- }), rs = f(es, {
2807
+ }), as = f(ts, {
2806
2808
  name: "relationship",
2807
2809
  description: `Label: Relationship
2808
2810
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
2809
2811
  Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
2810
2812
  Example: Show the relationship between tree height and carbon storage
2811
2813
  Fields: This style requires two number fields.`,
2812
- schema: ts
2814
+ schema: rs
2813
2815
  });
2814
- function as(e) {
2816
+ function os(e) {
2815
2817
  const { fields: r, layer: t, view: a, theme: o } = e, s = r[0];
2816
2818
  return {
2817
2819
  layer: t,
@@ -2823,10 +2825,10 @@ function as(e) {
2823
2825
  outlineOptimizationEnabled: !0
2824
2826
  };
2825
2827
  }
2826
- async function os(e) {
2827
- return await nt(e);
2828
+ async function ss(e) {
2829
+ return await lt(e);
2828
2830
  }
2829
- async function ss({
2831
+ async function is({
2830
2832
  arcgisMap: e,
2831
2833
  arcgisMapView: r,
2832
2834
  layerId: t,
@@ -2846,20 +2848,20 @@ async function ss({
2846
2848
  theme: s
2847
2849
  };
2848
2850
  try {
2849
- const d = as(c), u = await os(d);
2851
+ const d = os(c), u = await ss(d);
2850
2852
  return n.renderer = u.renderer, n.visible = !0, `Size-age renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
2851
2853
  } catch (d) {
2852
2854
  return `Error applying size-age renderer: ${d instanceof Error ? d.message : String(d)}`;
2853
2855
  }
2854
2856
  }
2855
- async function is({
2857
+ async function ns({
2856
2858
  layerId: e,
2857
2859
  fields: r,
2858
2860
  colorSchemes: t,
2859
2861
  theme: a
2860
2862
  }, o) {
2861
2863
  const { mapView: s } = F(o);
2862
- return await E({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await ss({
2864
+ return await $({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await is({
2863
2865
  arcgisMap: s.map,
2864
2866
  arcgisMapView: s,
2865
2867
  layerId: e,
@@ -2868,21 +2870,21 @@ async function is({
2868
2870
  theme: a
2869
2871
  });
2870
2872
  }
2871
- const ns = i.object({
2873
+ const ls = i.object({
2872
2874
  layerId: i.string().describe("The id of the layer to apply the size-age renderer to"),
2873
2875
  fields: i.array(i.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
2874
2876
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
2875
2877
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2876
- }), ls = f(is, {
2878
+ }), cs = f(ns, {
2877
2879
  name: "size-age",
2878
2880
  description: `Label: Age (size)
2879
2881
  Description: Vary symbol sizes along a continuous ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
2880
2882
  Keywords: since, age, how old, how long
2881
2883
  Example: Change the size of features so older features are larger than new features.
2882
2884
  Fields: This style requires at least one field with a date type.`,
2883
- schema: ns
2885
+ schema: ls
2884
2886
  });
2885
- function cs(e) {
2887
+ function ds(e) {
2886
2888
  const { fields: r, layer: t, view: a } = e;
2887
2889
  let { theme: o } = e, s = r[1];
2888
2890
  const l = r[0];
@@ -2896,10 +2898,10 @@ function cs(e) {
2896
2898
  outlineOptimizationEnabled: !0
2897
2899
  };
2898
2900
  }
2899
- async function ds(e) {
2900
- return await lt(e);
2901
+ async function us(e) {
2902
+ return await ct(e);
2901
2903
  }
2902
- async function us({
2904
+ async function hs({
2903
2905
  arcgisMap: e,
2904
2906
  arcgisMapView: r,
2905
2907
  layerId: t,
@@ -2919,20 +2921,20 @@ async function us({
2919
2921
  theme: s
2920
2922
  };
2921
2923
  try {
2922
- const d = cs(c), u = await ds(d);
2924
+ const d = ds(c), u = await us(d);
2923
2925
  return n.renderer = u.renderer, n.visible = !0, `Size renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
2924
2926
  } catch (d) {
2925
2927
  return `Error applying size renderer: ${d instanceof Error ? d.message : String(d)}`;
2926
2928
  }
2927
2929
  }
2928
- async function hs({
2930
+ async function ms({
2929
2931
  layerId: e,
2930
2932
  fields: r,
2931
2933
  colorSchemes: t,
2932
2934
  theme: a
2933
2935
  }, o) {
2934
2936
  const { mapView: s } = F(o);
2935
- return await E({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await us({
2937
+ return await $({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await hs({
2936
2938
  arcgisMap: s.map,
2937
2939
  arcgisMapView: s,
2938
2940
  layerId: e,
@@ -2941,12 +2943,12 @@ async function hs({
2941
2943
  theme: a
2942
2944
  });
2943
2945
  }
2944
- const ms = i.object({
2946
+ const ys = i.object({
2945
2947
  layerId: i.string().describe("The id of the layer to apply the size renderer to"),
2946
2948
  fields: i.array(i.string()).describe("The field(s) to use for the size renderer (numeric data)"),
2947
2949
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
2948
2950
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2949
- }), ys = f(hs, {
2951
+ }), ps = f(ms, {
2950
2952
  name: "size",
2951
2953
  description: `Label: Counts and Amounts (size)
2952
2954
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
@@ -2959,14 +2961,14 @@ const ms = i.object({
2959
2961
  Keywords: graduated size, proportional size, classed size, how much, total, number, when
2960
2962
  Example: Vary the size of each feature based on the date a ticket was completed.
2961
2963
  Fields: This style requires a single field with a date type.`,
2962
- schema: ms
2964
+ schema: ys
2963
2965
  });
2964
- function ps(e) {
2966
+ function gs(e) {
2965
2967
  const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
2966
2968
  console.log("processTypeRendererParams", e);
2967
2969
  const s = r[0], l = r[1], n = r[2];
2968
2970
  let c;
2969
- return o && (c = dt({
2971
+ return o && (c = ut({
2970
2972
  geometryType: t.geometryType,
2971
2973
  includedTags: o
2972
2974
  })[0]), {
@@ -2980,10 +2982,10 @@ function ps(e) {
2980
2982
  typeScheme: c
2981
2983
  };
2982
2984
  }
2983
- async function gs(e) {
2984
- return await ct(e);
2985
+ async function fs(e) {
2986
+ return await dt(e);
2985
2987
  }
2986
- async function fs({
2988
+ async function ws({
2987
2989
  arcgisMap: e,
2988
2990
  arcgisMapView: r,
2989
2991
  layerId: t,
@@ -3003,20 +3005,20 @@ async function fs({
3003
3005
  theme: s
3004
3006
  };
3005
3007
  try {
3006
- const d = ps(c), u = await gs(d);
3008
+ const d = gs(c), u = await fs(d);
3007
3009
  return n.renderer = u.renderer, n.visible = !0, `Type renderer applied to layer: ${n.title ?? n.id} using fields ${a.join(", ")}`;
3008
3010
  } catch (d) {
3009
3011
  return `Error applying type renderer: ${d instanceof Error ? d.message : String(d)}`;
3010
3012
  }
3011
3013
  }
3012
- async function ws({
3014
+ async function bs({
3013
3015
  layerId: e,
3014
3016
  fields: r,
3015
3017
  colorSchemes: t,
3016
3018
  theme: a
3017
3019
  }, o) {
3018
3020
  const { mapView: s } = F(o);
3019
- return await E({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await fs({
3021
+ return await $({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await ws({
3020
3022
  arcgisMap: s.map,
3021
3023
  arcgisMapView: s,
3022
3024
  layerId: e,
@@ -3025,48 +3027,48 @@ async function ws({
3025
3027
  theme: a
3026
3028
  });
3027
3029
  }
3028
- const bs = i.object({
3030
+ const Ss = i.object({
3029
3031
  layerId: i.string().describe("The id of the layer to apply the type renderer to"),
3030
3032
  fields: i.array(i.string()).describe("The field(s) to use for the type renderer (categorical data)"),
3031
3033
  colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
3032
3034
  theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
3033
- }), Ss = f(ws, {
3035
+ }), vs = f(bs, {
3034
3036
  name: "type",
3035
3037
  description: `Label: Types (unique symbols)
3036
3038
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
3037
3039
  Keywords: categorical, category, type, unique, discrete, point of interest, region, group
3038
3040
  Example: Color each feature based on the region it belongs to
3039
3041
  Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
3040
- schema: bs
3041
- }), je = [
3042
- yo,
3043
- So,
3044
- Fo,
3045
- zo,
3046
- Mo,
3047
- Bo,
3048
- Ko,
3049
- rs,
3050
- ls,
3051
- ys,
3052
- Ss
3053
- ], vs = async (e, r) => {
3042
+ schema: Ss
3043
+ }), _e = [
3044
+ po,
3045
+ vo,
3046
+ Ro,
3047
+ Ao,
3048
+ Vo,
3049
+ Go,
3050
+ Jo,
3051
+ as,
3052
+ cs,
3053
+ ps,
3054
+ vs
3055
+ ], Ts = async (e, r) => {
3054
3056
  await m({ text: "Requesting LLM for layer query results" }, r);
3055
- const t = await $("navigation_intent_prompt");
3057
+ const t = await E("navigation_intent_prompt");
3056
3058
  if (!r?.configurable)
3057
3059
  throw new Error("config.configurable is required for layer query tools");
3058
3060
  const a = {
3059
3061
  layerFieldInfo: e.layerFieldInfo
3060
- }, o = await N({
3062
+ }, o = await _({
3061
3063
  promptText: t,
3062
3064
  messages: v(e.messages),
3063
3065
  inputVariables: a,
3064
- tools: je
3066
+ tools: _e
3065
3067
  });
3066
- return await Q(o, r), { ...e, messages: [...e.messages, o] };
3068
+ return await O(o, r), { ...e, messages: [...e.messages, o] };
3067
3069
  };
3068
- async function Ts(e, r) {
3069
- const a = await new A(je).invoke(
3070
+ async function xs(e, r) {
3071
+ const a = await new j(_e).invoke(
3070
3072
  {
3071
3073
  messages: v(e.messages)
3072
3074
  },
@@ -3078,10 +3080,10 @@ async function Ts(e, r) {
3078
3080
  `);
3079
3081
  return { ...e, outputMessage: s };
3080
3082
  }
3081
- const _e = g.Root({
3083
+ const je = g.Root({
3082
3084
  // Inputs coming from global context
3083
3085
  messages: g({
3084
- reducer: j,
3086
+ reducer: A,
3085
3087
  default: () => []
3086
3088
  }),
3087
3089
  // Accumulates user-visible output across graph nodes.
@@ -3111,7 +3113,7 @@ ${t}`;
3111
3113
  vectorSearchFieldResults: g(),
3112
3114
  layerFieldInfo: g(),
3113
3115
  selectedLayerId: g()
3114
- }), xs = async (e, r) => (await m({ text: "Exiting Layer Styling agent" }, r), e), Es = async (e, r) => {
3116
+ }), Es = async (e, r) => (await m({ text: "Exiting Layer Styling agent" }, r), e), $s = async (e, r) => {
3115
3117
  try {
3116
3118
  await m({ text: "Populating layer and field info" }, r);
3117
3119
  const t = [];
@@ -3124,7 +3126,7 @@ ${t}`;
3124
3126
  h.description && `Description: ${h.description}`
3125
3127
  ].filter(Boolean).join(" | ") : u;
3126
3128
  };
3127
- const { layerId: s, results: l } = a, n = S(r, "layersAndFieldsRegistry"), c = n.get(s)?.fieldRegistry;
3129
+ const { layerId: s, results: l } = a, n = b(r, "layersAndFieldsRegistry"), c = n.get(s)?.fieldRegistry;
3128
3130
  if (!c)
3129
3131
  continue;
3130
3132
  let d = t.find((u) => u.layerId === s);
@@ -3142,48 +3144,133 @@ ${t}`;
3142
3144
  } catch (t) {
3143
3145
  throw await m({ text: "Error populating layerFieldInfo" }, r), new Error(`Error populating layerFieldInfo: ${t instanceof Error ? t.message : String(t)}`);
3144
3146
  }
3145
- }, $s = (e, r) => {
3147
+ }, Fs = (e, r) => {
3146
3148
  const t = e.vectorSearchLayerIds ?? [];
3147
3149
  if (t.length <= 1)
3148
3150
  return { ...e, selectedLayerId: e.vectorSearchLayerIds[0] };
3149
3151
  const { hitlResponse: a } = r.configurable;
3150
- if (console.log("hitlResponse:", a), !a || a.agentId !== fe.id || a.id !== "reviewLayerSelection") {
3152
+ if (console.log("hitlResponse:", a), !a || a.agentId !== we.id || a.id !== "reviewLayerSelection") {
3151
3153
  const s = {
3152
- agentId: fe.id,
3154
+ agentId: we.id,
3153
3155
  id: "reviewLayerSelection",
3154
3156
  kind: "singleSelection",
3155
3157
  message: "Choose a layer to apply the styles.",
3156
3158
  metadata: [...t]
3157
3159
  };
3158
- throw new Oe(s);
3160
+ throw new Pe(s);
3159
3161
  }
3160
3162
  let o = null;
3161
3163
  return Array.isArray(a.payload) && a.payload.length > 0 && (o = a.payload[0]), {
3162
3164
  ...e,
3163
3165
  selectedLayerId: o ?? e.vectorSearchLayerIds[0]
3164
3166
  };
3165
- }, Fs = (e, r) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(e, r), Rs = () => new _(_e).addNode("requireLayerStylingServices", Fs).addNode("vectorSearchLayers", io).addNode("layerSelectionHITL", $s).addNode("vectorSearchFields", oo).addNode("populateLayerFieldInfo", Es).addNode("agent", vs).addNode("tools", Ts).addNode("earlyExit", xs).addEdge(M, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
3167
+ }, Rs = (e, r) => M(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(e, r), Ls = () => new N(je).addNode("requireLayerStylingServices", Rs).addNode("vectorSearchLayers", no).addNode("layerSelectionHITL", Fs).addNode("vectorSearchFields", so).addNode("populateLayerFieldInfo", $s).addNode("agent", Ts).addNode("tools", xs).addNode("earlyExit", Es).addEdge(k, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
3166
3168
  "layerSelectionHITL",
3167
3169
  (r) => r.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
3168
3170
  ).addConditionalEdges(
3169
3171
  "vectorSearchFields",
3170
3172
  (r) => r.vectorSearchFieldResults.length ? "populateLayerFieldInfo" : "earlyExit"
3171
- ).addEdge("populateLayerFieldInfo", "agent").addEdge("agent", "tools").addEdge("tools", x).addEdge("earlyExit", x), Ls = 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.
3173
+ ).addEdge("populateLayerFieldInfo", "agent").addEdge("agent", "tools").addEdge("tools", x).addEdge("earlyExit", x), Is = 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.
3172
3174
  _Example: “Color points by sales amount”_
3173
3175
  _Example: “Show population density with a color gradient”_
3174
3176
  _Example: “Create a relationship map between height and depth”_
3175
- _Example: “Vary circle sizes according to population”_`, fe = {
3177
+ _Example: “Vary circle sizes according to population”_`, we = {
3176
3178
  id: "layerStyling",
3177
3179
  name: "Layer Styling Agent",
3178
- description: Ls,
3179
- createGraph: Rs,
3180
- workspace: _e
3180
+ description: Is,
3181
+ createGraph: Ls,
3182
+ workspace: je
3181
3183
  }, Me = g.Root({
3182
3184
  // messages: comes from global chat history.
3183
3185
  // It is safe to append new messages locally, but existing message objects
3184
3186
  // must be treated as read-only and never mutated.
3185
3187
  messages: g({
3186
- reducer: j,
3188
+ reducer: A,
3189
+ default: () => []
3190
+ }),
3191
+ // Accumulates user-visible output across graph nodes.
3192
+ // Uses append semantics, but de-duplicates identical consecutive writes.
3193
+ // This avoids duplicate output when tool nodes and final LLM nodes
3194
+ // emit the same text during a single agent turn.
3195
+ outputMessage: g({
3196
+ reducer: (e = "", r) => {
3197
+ const t = typeof r == "string" ? r.trim() : "";
3198
+ if (!t)
3199
+ return e;
3200
+ const a = e.trim();
3201
+ if (!a)
3202
+ return t;
3203
+ if (a === t)
3204
+ return e;
3205
+ const o = a.split(`
3206
+
3207
+ `);
3208
+ return o[o.length - 1]?.trim() === t ? e : `${e}
3209
+
3210
+ ${t}`;
3211
+ },
3212
+ default: () => ""
3213
+ })
3214
+ }), qs = (e) => {
3215
+ if (!e || e.size === 0)
3216
+ return "No layers available in this map.";
3217
+ const r = Array.from(e.values()).map(({ layerItem: t, fieldRegistry: a }, o) => {
3218
+ const s = Array.from(a.values()).map((n) => n.name).slice(0, 10).join(", "), l = a.size > 10 ? ` (and ${a.size - 10} more)` : "";
3219
+ return `${o + 1}. "${t.title}". Description: ${t.description}
3220
+ Fields: ${s}${l}`;
3221
+ }).join(`
3222
+
3223
+ `);
3224
+ return `This map contains ${e.size} layer(s):
3225
+
3226
+ ${r}`;
3227
+ }, zs = (e) => {
3228
+ const r = e?.list() ?? [];
3229
+ return r.length ? r.map((t) => `- ${t.agent.name}: ${t.agent.description}`).join(`
3230
+ `) : "No agents currently available.";
3231
+ };
3232
+ async function Cs(e, r) {
3233
+ const t = await E("help_prompt"), a = b(r, "layersAndFieldsRegistry"), o = b(r, "agentRegistry"), s = {
3234
+ layerSummary: qs(a),
3235
+ agents: zs(o)
3236
+ }, l = await J({
3237
+ promptText: t,
3238
+ messages: v(e.messages),
3239
+ inputVariables: s
3240
+ }), n = new Q(l), c = [...e.messages, n], d = `${e.outputMessage}
3241
+
3242
+ ${l}`.trim();
3243
+ return {
3244
+ ...e,
3245
+ messages: c,
3246
+ outputMessage: d
3247
+ };
3248
+ }
3249
+ const As = (e, r) => M(["agentRegistry"], "Help Agent")(e, r), Ns = () => new N(Me).addNode("requireHelpServices", As).addNode("agent", Cs).addEdge(k, "requireHelpServices").addEdge("requireHelpServices", "agent").addEdge("agent", x), ks = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
3250
+
3251
+ _Example: “Tell me about this map”_
3252
+ _Example: “List all layers in this map”_
3253
+ _Example: “List fields in protected areas layer”_
3254
+ _Example: “What agents are available to me?”_
3255
+ _Example: “What can you do?”_
3256
+ _Example: “What can I ask”_
3257
+
3258
+ Even if the user asks unrelated queries like "What are the vowels in English alphabet" or "How to cook", call this agent.
3259
+
3260
+ 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.
3261
+ _Example: "Create a chart"_
3262
+ _Example: "Create a table"_`, _i = {
3263
+ id: "help",
3264
+ name: "Help Agent",
3265
+ description: ks,
3266
+ createGraph: Ns,
3267
+ workspace: Me
3268
+ }, Ve = g.Root({
3269
+ // messages: comes from global chat history.
3270
+ // It is safe to append new messages locally, but existing message objects
3271
+ // must be treated as read-only and never mutated.
3272
+ messages: g({
3273
+ reducer: A,
3187
3274
  default: () => []
3188
3275
  }),
3189
3276
  // Accumulates user-visible output across graph nodes.
@@ -3212,24 +3299,24 @@ ${t}`;
3212
3299
  intent: g({
3213
3300
  reducer: (e, r) => r
3214
3301
  })
3215
- }), Is = ["linkChartView"];
3216
- function Ve(e) {
3302
+ }), _s = ["linkChartView"];
3303
+ function De(e) {
3217
3304
  const t = e?.configurable?.context;
3218
3305
  if (!t || typeof t != "object")
3219
3306
  throw new Error("LinkChartAgent context missing");
3220
- const a = Is.filter((o) => !(o in t));
3307
+ const a = _s.filter((o) => !(o in t));
3221
3308
  if (a.length)
3222
3309
  throw new Error(`Link Chart context missing: ${a.join(", ")}`);
3223
3310
  return t;
3224
3311
  }
3225
- async function qs(e, r) {
3312
+ async function js(e, r) {
3226
3313
  return await r.map.applyLayout(e), `Successfully applied layout: ${e}.`;
3227
3314
  }
3228
- async function Cs({ layout: e }, r) {
3229
- const { linkChartView: t } = Ve(r);
3230
- return await qs(e, t);
3315
+ async function Ms({ layout: e }, r) {
3316
+ const { linkChartView: t } = De(r);
3317
+ return await js(e, t);
3231
3318
  }
3232
- const zs = i.object({
3319
+ const Vs = i.object({
3233
3320
  layout: i.enum([
3234
3321
  "organic-standard",
3235
3322
  "organic-community",
@@ -3243,38 +3330,38 @@ const zs = i.object({
3243
3330
  ]).describe(
3244
3331
  "The layout mode to apply to the link chart. The value must be one of the following: organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline, chronological-multi-timeline"
3245
3332
  )
3246
- }), Ns = f(Cs, {
3333
+ }), Ds = f(Ms, {
3247
3334
  name: "applyLayout",
3248
3335
  description: "Apply a diagram layout to the link chart",
3249
- schema: zs
3336
+ schema: Vs
3250
3337
  });
3251
- function As(e, r) {
3338
+ function Qs(e, r) {
3252
3339
  return r.map.changeNonspatialDataDisplay(e), `Successfully applied nonspatial visibility setting: ${e}.`;
3253
3340
  }
3254
- function ks({ setting: e }, r) {
3255
- const { linkChartView: t } = Ve(r);
3256
- return As(e, t);
3341
+ function Os({ setting: e }, r) {
3342
+ const { linkChartView: t } = De(r);
3343
+ return Qs(e, t);
3257
3344
  }
3258
- const js = i.object({
3345
+ const Ps = i.object({
3259
3346
  setting: i.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
3260
- }), _s = f(ks, {
3347
+ }), Ws = f(Os, {
3261
3348
  name: "changeNonspatialVisibility",
3262
3349
  description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
3263
- schema: js
3264
- }), ce = [Ns, _s];
3265
- async function Ms(e, r) {
3266
- const t = await $("link_chart_tool_prompt"), a = {
3350
+ schema: Ps
3351
+ }), de = [Ds, Ws];
3352
+ async function Gs(e, r) {
3353
+ const t = await E("link_chart_tool_prompt"), a = {
3267
3354
  intent: e.intent
3268
- }, o = await N({
3355
+ }, o = await _({
3269
3356
  promptText: t,
3270
3357
  messages: v(e.messages),
3271
3358
  inputVariables: a,
3272
- tools: ce
3359
+ tools: de
3273
3360
  }), s = [...e.messages, o], n = (o.tool_calls?.length ?? 0) > 0 ? [...s] : [...s, o];
3274
3361
  return { ...e, messages: n };
3275
3362
  }
3276
- async function Vs(e, r) {
3277
- const a = await new A(ce).invoke(
3363
+ async function Bs(e, r) {
3364
+ const a = await new j(de).invoke(
3278
3365
  {
3279
3366
  messages: v(e.messages)
3280
3367
  },
@@ -3286,9 +3373,9 @@ async function Vs(e, r) {
3286
3373
  `);
3287
3374
  return { ...e, messages: s, outputMessage: l };
3288
3375
  }
3289
- async function Ds(e) {
3290
- const r = await $("link_chart_intent_prompt"), a = {
3291
- tools: ce.map((n) => ({
3376
+ async function Us(e) {
3377
+ const r = await E("link_chart_intent_prompt"), a = {
3378
+ tools: de.map((n) => ({
3292
3379
  name: n.name,
3293
3380
  description: n.description,
3294
3381
  schema: n.schema
@@ -3296,7 +3383,7 @@ async function Ds(e) {
3296
3383
  `)
3297
3384
  }, o = i.object({
3298
3385
  intent: i.string()
3299
- }), s = await we({
3386
+ }), s = await be({
3300
3387
  promptText: r,
3301
3388
  messages: v(e.messages),
3302
3389
  inputVariables: a,
@@ -3304,13 +3391,13 @@ async function Ds(e) {
3304
3391
  }), l = typeof s.intent == "string" ? s.intent.trim().replace(/^"|"$/gu, "") : "";
3305
3392
  return { ...e, intent: l || "" };
3306
3393
  }
3307
- const Qs = (e, r) => (
3394
+ const Hs = (e, r) => (
3308
3395
  //agent services (ex: embeddingsWorker) would go in the array below, if required.
3309
- D([], "LinkChart Agent")(e, r)
3310
- ), Os = () => new _(Me).addNode("requireLinkChartServices", Qs).addNode("intentLLM", Ds).addNode("agent", Ms).addNode("tools", Vs).addEdge(M, "requireLinkChartServices").addEdge("requireLinkChartServices", "intentLLM").addEdge("intentLLM", "agent").addConditionalEdges("agent", (r) => {
3396
+ M([], "LinkChart Agent")(e, r)
3397
+ ), Zs = () => new N(Ve).addNode("requireLinkChartServices", Hs).addNode("intentLLM", Us).addNode("agent", Gs).addNode("tools", Bs).addEdge(k, "requireLinkChartServices").addEdge("requireLinkChartServices", "intentLLM").addEdge("intentLLM", "agent").addConditionalEdges("agent", (r) => {
3311
3398
  const t = r.messages[r.messages.length - 1];
3312
3399
  return t?.getType() === "ai" && "tool_calls" in t && Array.isArray(t.tool_calls) && t.tool_calls.length > 0 ? "tools" : x;
3313
- }).addEdge("tools", x), Ps = String.raw`Enables users to interact with a link chart by adding new entities (also called nodes) or relationships (also called edges), removing existing entities or relationships,
3400
+ }).addEdge("tools", x), Ks = String.raw`Enables users to interact with a link chart by adding new entities (also called nodes) or relationships (also called edges), removing existing entities or relationships,
3314
3401
  expanding the graph from particular entities, finding relationships between specified entities on the link chart and adding them to the link chart, finding all relationships
3315
3402
  that exist out from specified entities and adding those to the link chart, changing whether or not nonspatial data is visible, or changing the layout of the link chart.
3316
3403
  This agent is designed to handle requests that manipulate the specific link chart.
@@ -3328,18 +3415,19 @@ _example: "Change the layout to hierarchical-bottom-to-top"_
3328
3415
  _example: "Apply radial-root-centric layout"_
3329
3416
  _example: "Show nonspatial data"_
3330
3417
  _example: "Hide nonspatial data"_
3331
- _example: "Turn off nonspatial visibility"_`, Ii = {
3418
+ _example: "Turn off nonspatial visibility"_`, ji = {
3332
3419
  id: "linkChart",
3333
3420
  name: "LinkChart Agent",
3334
- description: Ps,
3335
- createGraph: Os,
3336
- workspace: Me
3421
+ description: Ks,
3422
+ createGraph: Zs,
3423
+ workspace: Ve
3337
3424
  };
3338
3425
  export {
3339
- Fi as DataExplorationAgent,
3340
- Ri as LayerFilterAgent,
3341
- Li as LayerQueryAgent,
3342
- fe as LayerStylingAgent,
3343
- Ii as LinkChartAgent,
3344
- $i as NavigationAgent
3426
+ Ai as DataExplorationAgent,
3427
+ _i as HelpAgent,
3428
+ Ni as LayerFilterAgent,
3429
+ ki as LayerQueryAgent,
3430
+ we as LayerStylingAgent,
3431
+ ji as LinkChartAgent,
3432
+ Ci as NavigationAgent
3345
3433
  };