@arcgis/ai-agents 5.1.0-next.69 → 5.1.0-next.70

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,45 +1,46 @@
1
- import { Annotation as w, StateGraph as V, START as W, END as F, NodeInterrupt as We } from "@langchain/langgraph/web";
2
- import { invokeToolPrompt as j, sendTraceMessage as g, invokeStructuredPrompt as Se, invokeTextPrompt as Ke, sendUXSuggestion as R } from "@arcgis/ai-orchestrator";
1
+ import { Annotation as w, StateGraph as V, START as W, END as q, NodeInterrupt as He } from "@langchain/langgraph/web";
2
+ import { invokeToolPrompt as D, sendTraceMessage as g, invokeStructuredPrompt as Re, invokeTextPrompt as Ze, sendUXSuggestion as $ } from "@arcgis/ai-orchestrator";
3
3
  import { tool as b } from "@langchain/core/tools";
4
- import Be from "@arcgis/core/Graphic.js";
5
- import ae from "@arcgis/core/geometry/Point.js";
6
- import ve from "@arcgis/core/geometry/Extent.js";
7
- import Qe from "@arcgis/core/symbols/PictureMarkerSymbol.js";
8
- import { addressToLocations as Ue } from "@arcgis/core/rest/locator.js";
9
- import z from "@arcgis/core/portal/Portal.js";
10
- import te from "@arcgis/core/config.js";
11
- import s, { z as q } from "zod";
12
- import { AIMessage as Te } from "@langchain/core/messages";
13
- import { ToolNode as M } from "@langchain/langgraph/prebuilt";
14
- import He from "@arcgis/core/layers/support/FeatureEffect.js";
15
- import Ee from "@arcgis/core/layers/support/FeatureFilter.js";
16
- import * as Ze from "@arcgis/core/geometry/operators/unionOperator.js";
17
- import Ce from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
18
- import Re from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
19
- import Je from "@arcgis/core/rest/support/TopFeaturesQuery.js";
20
- import Ye from "@arcgis/core/rest/support/TopFilter.js";
21
- import { createRenderer as Xe } from "@arcgis/core/smartMapping/renderers/pieChart.js";
22
- import { getSchemesByTag as et, getSchemes as tt } from "@arcgis/core/smartMapping/symbology/pieChart.js";
23
- import { getBackgroundColorTheme as he } from "@arcgis/core/views/support/colorUtils.js";
24
- import { createAgeRenderer as rt, createContinuousRenderer as at } from "@arcgis/core/smartMapping/renderers/color.js";
25
- import { getSchemesByTag as oe } from "@arcgis/core/smartMapping/symbology/color.js";
26
- import { createContinuousRenderer as ot } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
27
- import { createRenderer as nt } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
28
- import { getSchemesByTag as it } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
29
- import { createRenderer as st } from "@arcgis/core/smartMapping/renderers/heatmap.js";
30
- import { getSchemesByTag as ct } from "@arcgis/core/smartMapping/symbology/heatmap.js";
31
- import { createRenderer as lt } from "@arcgis/core/smartMapping/renderers/predominance.js";
32
- import { getSchemesByTag as dt } from "@arcgis/core/smartMapping/symbology/predominance.js";
33
- import { createRenderer as ut } from "@arcgis/core/smartMapping/renderers/relationship.js";
34
- import { getSchemesByTag as pt } from "@arcgis/core/smartMapping/symbology/relationship.js";
35
- import { createAgeRenderer as ht, createContinuousRenderer as mt } from "@arcgis/core/smartMapping/renderers/size.js";
36
- import { createRenderer as gt } from "@arcgis/core/smartMapping/renderers/type.js";
37
- import { getSchemesByTag as yt } from "@arcgis/core/smartMapping/symbology/type.js";
38
- import $e from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
39
- import me from "@arcgis/core/request.js";
40
- import ge from "@arcgis/core/identity/IdentityManager.js";
41
- import { executeQueryStreaming as ft } from "@arcgis/core/rest/knowledgeGraphService.js";
42
- import wt from "@arcgis/core/WebLinkChart.js";
4
+ import Je from "@arcgis/core/Graphic.js";
5
+ import ie from "@arcgis/core/geometry/Point.js";
6
+ import $e from "@arcgis/core/geometry/Extent.js";
7
+ import Ye from "@arcgis/core/symbols/PictureMarkerSymbol.js";
8
+ import { addressToLocations as Xe } from "@arcgis/core/rest/locator.js";
9
+ import _ from "@arcgis/core/portal/Portal.js";
10
+ import oe from "@arcgis/core/config.js";
11
+ import i, { z as N } from "zod";
12
+ import { AIMessage as ke } from "@langchain/core/messages";
13
+ import { ToolNode as P } from "@langchain/langgraph/prebuilt";
14
+ import et from "@arcgis/core/layers/support/FeatureEffect.js";
15
+ import Fe from "@arcgis/core/layers/support/FeatureFilter.js";
16
+ import * as tt from "@arcgis/core/geometry/operators/unionOperator.js";
17
+ import { formatDateOnly as rt, convertDateFormatToIntlOptions as U, formatTimeOnly as at, formatDate as fe } from "@arcgis/core/intl.js";
18
+ import qe from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
19
+ import Le from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
20
+ import ot from "@arcgis/core/rest/support/TopFeaturesQuery.js";
21
+ import nt from "@arcgis/core/rest/support/TopFilter.js";
22
+ import { createRenderer as st } from "@arcgis/core/smartMapping/renderers/pieChart.js";
23
+ import { getSchemesByTag as it, getSchemes as ct } from "@arcgis/core/smartMapping/symbology/pieChart.js";
24
+ import { getBackgroundColorTheme as we } from "@arcgis/core/views/support/colorUtils.js";
25
+ import { createAgeRenderer as lt, createContinuousRenderer as dt } from "@arcgis/core/smartMapping/renderers/color.js";
26
+ import { getSchemesByTag as ce } from "@arcgis/core/smartMapping/symbology/color.js";
27
+ import { createContinuousRenderer as ut } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
28
+ import { createRenderer as pt } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
29
+ import { getSchemesByTag as mt } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
30
+ import { createRenderer as ht } from "@arcgis/core/smartMapping/renderers/heatmap.js";
31
+ import { getSchemesByTag as gt } from "@arcgis/core/smartMapping/symbology/heatmap.js";
32
+ import { createRenderer as yt } from "@arcgis/core/smartMapping/renderers/predominance.js";
33
+ import { getSchemesByTag as ft } from "@arcgis/core/smartMapping/symbology/predominance.js";
34
+ import { createRenderer as wt } from "@arcgis/core/smartMapping/renderers/relationship.js";
35
+ import { getSchemesByTag as bt } from "@arcgis/core/smartMapping/symbology/relationship.js";
36
+ import { createAgeRenderer as xt, createContinuousRenderer as St } from "@arcgis/core/smartMapping/renderers/size.js";
37
+ import { createRenderer as vt } from "@arcgis/core/smartMapping/renderers/type.js";
38
+ import { getSchemesByTag as Tt } from "@arcgis/core/smartMapping/symbology/type.js";
39
+ import Ie from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
40
+ import be from "@arcgis/core/request.js";
41
+ import xe from "@arcgis/core/identity/IdentityManager.js";
42
+ import { executeQueryStreaming as Et } from "@arcgis/core/rest/knowledgeGraphService.js";
43
+ import Ct from "@arcgis/core/WebLinkChart.js";
43
44
  const K = (e, t) => ({
44
45
  ...e,
45
46
  ...t
@@ -58,7 +59,7 @@ const K = (e, t) => ({
58
59
  return o[o.length - 1]?.trim() === r ? e : `${e}
59
60
 
60
61
  ${r}`;
61
- }, _ = (e, t) => t ?? e, ke = w.Root({
62
+ }, j = (e, t) => t ?? e, Ne = w.Root({
62
63
  // Execution context provided by the orchestrator for this agent invocation.
63
64
  agentExecutionContext: w({
64
65
  reducer: K,
@@ -75,11 +76,11 @@ ${r}`;
75
76
  default: () => ""
76
77
  }),
77
78
  summary: w({
78
- reducer: _,
79
+ reducer: j,
79
80
  default: () => ""
80
81
  }),
81
82
  status: w({
82
- reducer: _,
83
+ reducer: j,
83
84
  default: () => "success"
84
85
  }),
85
86
  intent: w({
@@ -93,58 +94,58 @@ ${r}`;
93
94
  reducer: (e, t) => t
94
95
  })
95
96
  });
96
- async function bt(e, t) {
97
- const a = z.getDefault().helperServices, o = a.geocode.find((P) => P.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
97
+ async function Rt(e, t) {
98
+ const a = _.getDefault().helperServices, o = a.geocode.find((R) => R.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
98
99
  if (!o)
99
100
  throw new Error("No geocoding service found in helperServices.");
100
- const n = o.url, c = `${te.assetsPath?.endsWith("/") ? te.assetsPath : `${te.assetsPath}/`}esri/images/search/search-symbol-32.png`, l = (await Ue(n, {
101
+ const n = o.url, c = `${oe.assetsPath?.endsWith("/") ? oe.assetsPath : `${oe.assetsPath}/`}esri/images/search/search-symbol-32.png`, l = (await Xe(n, {
101
102
  address: { SingleLine: e },
102
103
  outFields: ["Match_addr"]
103
104
  }))?.[0];
104
105
  if (!l?.extent)
105
106
  throw new Error(`Could not find location for: ${e}`);
106
- const { xmin: d, ymin: u, xmax: p, ymax: h, spatialReference: y } = l.extent, T = new ve({
107
+ const { xmin: d, ymin: u, xmax: p, ymax: m, spatialReference: y } = l.extent, E = new $e({
107
108
  xmin: d,
108
109
  ymin: u,
109
110
  xmax: p,
110
- ymax: h,
111
+ ymax: m,
111
112
  spatialReference: y
112
- }), m = (d + p) / 2, f = (u + h) / 2, v = new ae({
113
- x: m,
113
+ }), h = (d + p) / 2, f = (u + m) / 2, S = new ie({
114
+ x: h,
114
115
  y: f,
115
116
  spatialReference: y
116
- }), E = new Qe({
117
+ }), v = new Ye({
117
118
  url: c,
118
119
  width: 24,
119
120
  height: 24
120
- }), S = new Be({
121
- geometry: v,
122
- symbol: E
121
+ }), T = new Je({
122
+ geometry: S,
123
+ symbol: v
123
124
  });
124
- return t.graphics.removeAll(), t.graphics.add(S), await t.goTo(T), `Successfully zoomed to: ${e}. Location coordinates: x=${m}, y=${f}, wkid=${y.wkid}`;
125
+ return t.graphics.removeAll(), t.graphics.add(T), await t.goTo(E), `Successfully zoomed to: ${e}. Location coordinates: x=${h}, y=${f}, wkid=${y.wkid}`;
125
126
  }
126
- const xt = ["mapView"];
127
- function $(e) {
127
+ const $t = ["mapView"];
128
+ function k(e) {
128
129
  const r = e?.configurable?.context;
129
130
  if (!r || typeof r != "object")
130
131
  throw new Error("NavigationAgent context missing");
131
- const a = xt.filter((o) => !(o in r));
132
+ const a = $t.filter((o) => !(o in r));
132
133
  if (a.length)
133
134
  throw new Error(`NavigationAgent context missing: ${a.join(", ")}`);
134
135
  return r;
135
136
  }
136
- async function St({ address: e }, t) {
137
- const { mapView: r } = $(t);
138
- return await bt(e, r);
137
+ async function kt({ address: e }, t) {
138
+ const { mapView: r } = k(t);
139
+ return await Rt(e, r);
139
140
  }
140
- const vt = s.object({
141
- address: s.string().describe("The full address or place name to locate.")
142
- }), Tt = b(St, {
141
+ const Ft = i.object({
142
+ address: i.string().describe("The full address or place name to locate.")
143
+ }), qt = b(kt, {
143
144
  name: "goToAddress",
144
145
  description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
145
- schema: vt
146
+ schema: Ft
146
147
  });
147
- async function Et(e, t) {
148
+ async function Lt(e, t) {
148
149
  const a = t.map.bookmarks;
149
150
  if (!a || a.length === 0)
150
151
  throw new Error("No bookmarks found in the map.");
@@ -156,18 +157,18 @@ async function Et(e, t) {
156
157
  throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
157
158
  return await t.goTo(n), `Navigated to bookmark: ${e}`;
158
159
  }
159
- async function Ct({ bookmarkName: e }, t) {
160
- const { mapView: r } = $(t);
161
- return await Promise.resolve(Et(e, r));
160
+ async function It({ bookmarkName: e }, t) {
161
+ const { mapView: r } = k(t);
162
+ return await Promise.resolve(Lt(e, r));
162
163
  }
163
- const Rt = q.object({
164
- bookmarkName: q.string().describe("The name of the bookmark to navigate to.")
165
- }), $t = b(Ct, {
164
+ const Nt = N.object({
165
+ bookmarkName: N.string().describe("The name of the bookmark to navigate to.")
166
+ }), At = b(It, {
166
167
  name: "goToBookmark",
167
168
  description: "Go to the extent of the bookmark with the given name.",
168
- schema: Rt
169
+ schema: Nt
169
170
  });
170
- async function kt(e, t, r) {
171
+ async function zt(e, t, r) {
171
172
  const a = r.map?.allLayers.find((n) => n.id === e);
172
173
  if (!a)
173
174
  return `Error: Layer with id ${e} not found`;
@@ -186,20 +187,20 @@ async function kt(e, t, r) {
186
187
  return console.error("Error in goToFeatures:", n), `Error: ${n instanceof Error ? n.message : "Unknown error"}`;
187
188
  }
188
189
  }
189
- async function Ft({ layerId: e, where: t }, r) {
190
- const { mapView: a } = $(r);
191
- return await kt(e, t, a);
190
+ async function _t({ layerId: e, where: t }, r) {
191
+ const { mapView: a } = k(r);
192
+ return await zt(e, t, a);
192
193
  }
193
- const Lt = q.object({
194
- layerId: q.string().describe("The layerId of the layer to zoom to."),
195
- where: q.string().describe("The sql-92 where clause used to query features to zoom to")
196
- }), qt = b(Ft, {
194
+ const jt = N.object({
195
+ layerId: N.string().describe("The layerId of the layer to zoom to."),
196
+ where: N.string().describe("The sql-92 where clause used to query features to zoom to")
197
+ }), Dt = b(_t, {
197
198
  name: "goToFeatures",
198
199
  description: "Go to the features that match the given filter related to the given layerId.",
199
- schema: Lt
200
+ schema: jt
200
201
  });
201
- async function It(e) {
202
- const r = new ve({
202
+ async function Pt(e) {
203
+ const r = new $e({
203
204
  xmin: -180,
204
205
  ymin: -90,
205
206
  xmax: 180,
@@ -208,16 +209,16 @@ async function It(e) {
208
209
  }).expand(0.7);
209
210
  return await e.goTo(r), "Successfully zoomed to world extent";
210
211
  }
211
- async function At(e, t) {
212
- const { mapView: r } = $(t);
213
- return await It(r);
212
+ async function Mt(e, t) {
213
+ const { mapView: r } = k(t);
214
+ return await Pt(r);
214
215
  }
215
- const Nt = q.object({}), zt = b(At, {
216
+ const Ot = N.object({}), Gt = b(Mt, {
216
217
  name: "goToFullExtent",
217
218
  description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
218
- schema: Nt
219
+ schema: Ot
219
220
  });
220
- async function _t(e) {
221
+ async function Vt(e) {
221
222
  const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
222
223
  if (r)
223
224
  await e.goTo(r);
@@ -225,16 +226,16 @@ async function _t(e) {
225
226
  throw new Error("Initial extent is undefined");
226
227
  return "Successfully zoomed to home extent";
227
228
  }
228
- async function jt(e, t) {
229
- const { mapView: r } = $(t);
230
- return await _t(r);
229
+ async function Wt(e, t) {
230
+ const { mapView: r } = k(t);
231
+ return await Vt(r);
231
232
  }
232
- const Mt = s.object({}), Pt = b(jt, {
233
+ const Kt = i.object({}), Bt = b(Wt, {
233
234
  name: "goToHomeExtent",
234
235
  description: "Go to the initial web map view extent",
235
- schema: Mt
236
+ schema: Kt
236
237
  });
237
- async function Dt(e, t) {
238
+ async function Qt(e, t) {
238
239
  await t.when();
239
240
  const r = t.map?.allLayers.find((o) => o.id === e);
240
241
  if (!r)
@@ -242,34 +243,34 @@ async function Dt(e, t) {
242
243
  let a;
243
244
  return (r.type === "link-chart" || r.type === "knowledge-graph-sublayer") && t.map?.activeLinkChartLayer ? a = t.map.diagramNodesExtent : a = r.fullExtent, a ? (await t.goTo(a), r.visible = !0, `Successfully zoomed to: ${r.title ?? ""}`) : "Layer has no defined extent. Cannot zoom to layer.";
244
245
  }
245
- async function Ot({ layerId: e }, t) {
246
- const { mapView: r } = $(t);
247
- return await Dt(e, r);
246
+ async function Ut({ layerId: e }, t) {
247
+ const { mapView: r } = k(t);
248
+ return await Qt(e, r);
248
249
  }
249
- const Gt = q.object({
250
- layerId: q.string().describe("The id of the layer to navigate to")
251
- }), Vt = b(Ot, {
250
+ const Ht = N.object({
251
+ layerId: N.string().describe("The id of the layer to navigate to")
252
+ }), Zt = b(Ut, {
252
253
  name: "goToLayer",
253
254
  description: "Zooms the map view to the full extent of the top matching layer.",
254
- schema: Gt
255
+ schema: Ht
255
256
  });
256
- async function Wt(e, t) {
257
+ async function Jt(e, t) {
257
258
  return await t.goTo({ scale: e }), `Successfully zoomed to: ${e}`;
258
259
  }
259
- async function Kt({ scale: e }, t) {
260
- const { mapView: r } = $(t);
261
- return await Wt(e, r);
260
+ async function Yt({ scale: e }, t) {
261
+ const { mapView: r } = k(t);
262
+ return await Jt(e, r);
262
263
  }
263
- const Bt = s.object({
264
- scale: s.number().describe("The map scale of the view to go to.")
265
- }), Qt = b(Kt, {
264
+ const Xt = i.object({
265
+ scale: i.number().describe("The map scale of the view to go to.")
266
+ }), er = b(Yt, {
266
267
  name: "goToScale",
267
268
  description: "Go to the specified view scale.",
268
- schema: Bt
269
+ schema: Xt
269
270
  });
270
- async function Ut(e, t, r) {
271
+ async function tr(e, t, r) {
271
272
  const o = {
272
- target: new ae({
273
+ target: new ie({
273
274
  longitude: e.longitude,
274
275
  latitude: e.latitude,
275
276
  spatialReference: { wkid: 4326 }
@@ -281,50 +282,50 @@ async function Ut(e, t, r) {
281
282
  r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
282
283
  ].filter(Boolean).join(", ")}`;
283
284
  }
284
- async function Ht({
285
+ async function rr({
285
286
  center: e,
286
287
  zoom: t,
287
288
  scale: r
288
289
  }, a) {
289
- const { mapView: o } = $(a);
290
- return await Ut(e, o, { zoom: t, scale: r });
290
+ const { mapView: o } = k(a);
291
+ return await tr(e, o, { zoom: t, scale: r });
291
292
  }
292
- const Zt = s.object({
293
- center: s.object({
294
- longitude: s.number().describe("The longitude (x-coordinate) of the point to navigate to."),
295
- latitude: s.number().describe("The latitude (y-coordinate) of the point to navigate to.")
293
+ const ar = i.object({
294
+ center: i.object({
295
+ longitude: i.number().describe("The longitude (x-coordinate) of the point to navigate to."),
296
+ latitude: i.number().describe("The latitude (y-coordinate) of the point to navigate to.")
296
297
  }),
297
- zoom: s.number().optional().describe("The zoom level. Higher values = more zoomed in."),
298
- scale: s.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
299
- }), Jt = b(Ht, {
298
+ zoom: i.number().optional().describe("The zoom level. Higher values = more zoomed in."),
299
+ scale: i.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
300
+ }), or = b(rr, {
300
301
  name: "goToViewpoint",
301
302
  description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
302
- schema: Zt
303
+ schema: ar
303
304
  });
304
- async function Yt(e, t) {
305
+ async function nr(e, t) {
305
306
  return await t.goTo({ zoom: e }), `Successfully zoomed to: ${e}`;
306
307
  }
307
- async function Xt({ zoom: e }, t) {
308
- const { mapView: r } = $(t);
309
- return await Yt(e, r);
308
+ async function sr({ zoom: e }, t) {
309
+ const { mapView: r } = k(t);
310
+ return await nr(e, r);
310
311
  }
311
- const er = s.object({
312
- zoom: s.number().min(1).max(20).describe("The zoom level of the view to go to.")
313
- }), tr = b(Xt, {
312
+ const ir = i.object({
313
+ zoom: i.number().min(1).max(20).describe("The zoom level of the view to go to.")
314
+ }), cr = b(sr, {
314
315
  name: "goToZoom",
315
316
  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.).',
316
- schema: er
317
- }), ne = [
318
- Tt,
319
- $t,
317
+ schema: ir
318
+ }), le = [
320
319
  qt,
321
- zt,
322
- Pt,
323
- Vt,
324
- Qt,
325
- Jt,
326
- tr
327
- ], ye = /* @__PURE__ */ Object.assign({
320
+ At,
321
+ Dt,
322
+ Gt,
323
+ Bt,
324
+ Zt,
325
+ er,
326
+ or,
327
+ cr
328
+ ], Se = /* @__PURE__ */ Object.assign({
328
329
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md": () => import("./arcgis_knowledge_current_lc_context-BIA49RO2.js").then((e) => e.default),
329
330
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_intent_prompt.md": () => import("./arcgis_knowledge_intent_prompt-AaXBzNVW.js").then((e) => e.default),
330
331
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md": () => import("./arcgis_knowledge_tool_prompt-459P6qrK.js").then((e) => e.default),
@@ -337,11 +338,11 @@ const er = s.object({
337
338
  "../agents/navigation/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt-B-SYvVbG.js").then((e) => e.default)
338
339
  });
339
340
  async function L(e) {
340
- const t = Object.entries(ye).find(([r]) => r.endsWith(`/${e}.md`));
341
+ const t = Object.entries(Se).find(([r]) => r.endsWith(`/${e}.md`));
341
342
  if (!t)
342
343
  throw new Error(`Prompt not found: ${e}
343
344
  Available prompts:
344
- ${Object.keys(ye).join(`
345
+ ${Object.keys(Se).join(`
345
346
  `)}`);
346
347
  return await t[1]();
347
348
  }
@@ -352,63 +353,63 @@ const C = (e, t = 3) => {
352
353
  const a = r.length > t ? r[r.length - t] : r[0];
353
354
  return e.slice(a);
354
355
  };
355
- async function rr(e, t) {
356
- const r = await L("navigation_tool_prompt"), { mapView: a } = $(t), o = a.map, n = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
357
- (m, f) => `${f + 1}. layerId=${m.id} | title=${m.title ?? ""} | name=${m.name ?? ""} | score=${m.score.toFixed(2)}`
356
+ async function lr(e, t) {
357
+ const r = await L("navigation_tool_prompt"), { mapView: a } = k(t), o = a.map, n = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
358
+ (h, f) => `${f + 1}. layerId=${h.id} | title=${h.title ?? ""} | name=${h.name ?? ""} | score=${h.score.toFixed(2)}`
358
359
  ).join(`
359
- `) : "", c = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", i = e.intent === "goToBookmark" && o.bookmarks?.length ? `Available bookmarks:
360
+ `) : "", c = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", s = e.intent === "goToBookmark" && o.bookmarks?.length ? `Available bookmarks:
360
361
  ${JSON.stringify(o.bookmarks, null, 2)}` : "", l = (e.intent === "goToLayer" || e.intent === "goToFeatures") && e.vectorSearchLayerResults?.length ? `Candidate layers:
361
362
  ${n}` : "", d = e.intent === "goToFeatures" && e.vectorSearchFieldResults?.length ? `Candidate fields:
362
363
  ${c}` : "", u = {
363
364
  intent: e.intent,
364
- bookmarksSection: i,
365
+ bookmarksSection: s,
365
366
  layersSection: l,
366
367
  fieldsSection: d,
367
368
  currentZoom: a.zoom,
368
369
  assignedTask: e.agentExecutionContext.assignedTask,
369
370
  userRequest: e.agentExecutionContext.userRequest,
370
371
  priorSteps: e.agentExecutionContext.priorSteps
371
- }, p = await j({
372
+ }, p = await D({
372
373
  promptText: r,
373
374
  modelTier: "advanced",
374
375
  messages: C(e.agentExecutionContext.messages),
375
376
  inputVariables: u,
376
- tools: ne
377
- }), h = [...e.agentExecutionContext.messages, p], T = (p.tool_calls?.length ?? 0) > 0 ? [...h] : [...h, p];
378
- return { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: T } };
377
+ tools: le
378
+ }), m = [...e.agentExecutionContext.messages, p], E = (p.tool_calls?.length ?? 0) > 0 ? [...m] : [...m, p];
379
+ return { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: E } };
379
380
  }
380
- async function ar(e, t) {
381
- const a = await new M(ne).invoke(
381
+ async function dr(e, t) {
382
+ const a = await new P(le).invoke(
382
383
  {
383
384
  messages: C(e.agentExecutionContext.messages)
384
385
  },
385
386
  t
386
- ), o = a.messages.map((i) => i.text).join(`
387
+ ), o = a.messages.map((s) => s.text).join(`
387
388
  `);
388
389
  await g({ text: `Finished executing navigation tool: ${o}` }, t);
389
- const n = [...e.agentExecutionContext.messages, ...a.messages], c = a.messages.map((i) => i.text).join(`
390
+ const n = [...e.agentExecutionContext.messages, ...a.messages], c = a.messages.map((s) => s.text).join(`
390
391
  `);
391
392
  return { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: n }, outputMessage: c };
392
393
  }
393
- async function or(e, t) {
394
- const r = await L("navigation_intent_prompt"), { mapView: a } = $(t), o = ne.map((p) => ({
394
+ async function ur(e, t) {
395
+ const r = await L("navigation_intent_prompt"), { mapView: a } = k(t), o = le.map((p) => ({
395
396
  name: p.name,
396
397
  description: p.description,
397
398
  schema: p.schema
398
399
  })), n = a.map, c = n.bookmarks?.length ? `Available bookmarks:
399
- ${JSON.stringify(n.bookmarks, null, 2)}` : "", i = {
400
- tools: o.map(({ name: p, description: h, schema: y }) => `${p}: ${h}, ${JSON.stringify(y)}`).join(`
400
+ ${JSON.stringify(n.bookmarks, null, 2)}` : "", s = {
401
+ tools: o.map(({ name: p, description: m, schema: y }) => `${p}: ${m}, ${JSON.stringify(y)}`).join(`
401
402
  `),
402
403
  bookmarks: c,
403
404
  assignedTask: e.agentExecutionContext.assignedTask,
404
405
  userRequest: e.agentExecutionContext.userRequest,
405
406
  priorSteps: e.agentExecutionContext.priorSteps
406
- }, l = s.object({
407
- intent: s.string()
408
- }), d = await Se({
407
+ }, l = i.object({
408
+ intent: i.string()
409
+ }), d = await Re({
409
410
  promptText: r,
410
411
  messages: C(e.agentExecutionContext.messages),
411
- inputVariables: i,
412
+ inputVariables: s,
412
413
  schema: l
413
414
  }), u = typeof d.intent == "string" ? d.intent.trim().replace(/^"|"$/gu, "") : "";
414
415
  return { ...e, intent: u || "" };
@@ -418,7 +419,7 @@ const x = (e, t) => {
418
419
  if (a == null)
419
420
  throw new Error(`${t} missing in config.configurable.services`);
420
421
  return a;
421
- }, nr = 0.7, ir = async (e, t) => {
422
+ }, pr = 0.7, mr = async (e, t) => {
422
423
  try {
423
424
  await g(
424
425
  { text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
@@ -426,7 +427,7 @@ const x = (e, t) => {
426
427
  );
427
428
  const r = x(t, "layerSearch"), a = x(t, "layersAndFieldsRegistry"), o = x(t, "embeddingCache"), c = (await r.searchLayers({
428
429
  text: e.agentExecutionContext.assignedTask,
429
- minScore: nr,
430
+ minScore: pr,
430
431
  embeddingCache: o
431
432
  })).map(({ id: l, score: d }) => {
432
433
  const u = a.get(l)?.layerItem;
@@ -437,10 +438,10 @@ const x = (e, t) => {
437
438
  score: d
438
439
  };
439
440
  });
440
- let i;
441
- return c.length > 0 ? i = `Vector search completed. Matching layers:
441
+ let s;
442
+ return c.length > 0 ? s = `Vector search completed. Matching layers:
442
443
  ${c.map((l) => `- layerId=${l.id} | title=${l.title ?? ""} | name=${l.name ?? ""} | score=${l.score.toFixed(2)}`).join(`
443
- `)}` : i = "Vector search completed. No matching layers found.", await g({ text: i }, t), {
444
+ `)}` : s = "Vector search completed. No matching layers found.", await g({ text: s }, t), {
444
445
  ...e,
445
446
  vectorSearchLayerResults: c
446
447
  };
@@ -450,7 +451,7 @@ ${c.map((l) => `- layerId=${l.id} | title=${l.title ?? ""} | name=${l.name ?? ""
450
451
  t
451
452
  ), r;
452
453
  }
453
- }, fe = 0.7, sr = 10, cr = async (e, t) => {
454
+ }, ve = 0.7, hr = 10, gr = async (e, t) => {
454
455
  try {
455
456
  await g(
456
457
  { text: `Similarity search to find fields: ${e.agentExecutionContext.assignedTask}` },
@@ -459,22 +460,22 @@ ${c.map((l) => `- layerId=${l.id} | title=${l.title ?? ""} | name=${l.name ?? ""
459
460
  const r = x(t, "fieldSearch"), a = x(t, "layersAndFieldsRegistry"), o = x(t, "embeddingCache"), n = e.vectorSearchLayerResults?.map((d) => d.id) ?? [];
460
461
  if (n.length === 0)
461
462
  return await g({ text: "No candidate layers for field search" }, t), e;
462
- const i = (await r.searchFields({
463
+ const s = (await r.searchFields({
463
464
  text: e.agentExecutionContext.assignedTask,
464
465
  layerIds: n,
465
- minScore: fe,
466
- topResults: sr,
466
+ minScore: ve,
467
+ topResults: hr,
467
468
  embeddingCache: o
468
469
  })).map(({ layerId: d, results: u }) => {
469
470
  const p = a.get(d)?.fieldRegistry;
470
471
  return {
471
472
  layerId: d,
472
473
  layerName: a.get(d)?.layerItem.name,
473
- results: u.map((h) => {
474
- const y = p?.get(h.name);
474
+ results: u.map((m) => {
475
+ const y = p?.get(m.name);
475
476
  return {
476
- name: h.name,
477
- score: h.score,
477
+ name: m.name,
478
+ score: m.score,
478
479
  type: y?.type,
479
480
  alias: y?.alias,
480
481
  description: y?.description,
@@ -484,15 +485,15 @@ ${c.map((l) => `- layerId=${l.id} | title=${l.title ?? ""} | name=${l.name ?? ""
484
485
  };
485
486
  });
486
487
  let l;
487
- return i.length > 0 ? l = `Vector search completed. Matching layers and fields:
488
- ${i.map(
488
+ return s.length > 0 ? l = `Vector search completed. Matching layers and fields:
489
+ ${s.map(
489
490
  (d) => `${d.layerName ?? d.layerId}:
490
491
  ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
491
492
  `)}`
492
493
  ).join(`
493
- `)}` : l = `No vector search field results found for score over ${fe}.`, await g({ text: l }, t), {
494
+ `)}` : l = `No vector search field results found for score over ${ve}.`, await g({ text: l }, t), {
494
495
  ...e,
495
- vectorSearchFieldResults: i
496
+ vectorSearchFieldResults: s
496
497
  };
497
498
  } catch (r) {
498
499
  throw await g(
@@ -506,7 +507,7 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
506
507
  if (!o?.[n])
507
508
  throw new Error(`${t} requires services.${n} to be available.`);
508
509
  return r;
509
- }, lr = (e, t) => Q(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), dr = () => new V(ke).addNode("requireNavigationServices", lr).addNode("intentLLM", or).addNode("vectorSearchLayers", ir).addNode("vectorSearchFields", cr).addNode("agent", rr).addNode("tools", ar).addEdge(W, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
510
+ }, yr = (e, t) => Q(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), fr = () => new V(Ne).addNode("requireNavigationServices", yr).addNode("intentLLM", ur).addNode("vectorSearchLayers", mr).addNode("vectorSearchFields", gr).addNode("agent", lr).addNode("tools", dr).addEdge(W, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
510
511
  "intentLLM",
511
512
  (t) => t.intent === "goToLayer" || t.intent === "goToFeatures" ? "vectorSearchLayers" : "agent",
512
513
  {
@@ -520,7 +521,7 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
520
521
  vectorSearchFields: "vectorSearchFields",
521
522
  agent: "agent"
522
523
  }
523
- ).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", F), ur = String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
524
+ ).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", q), wr = String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
524
525
  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 "show me...", that is meant to be handled by another agent. If the query is about where a certain address is, call this agent.
525
526
 
526
527
  Supported actions:
@@ -539,13 +540,13 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
539
540
  _Example: “Center the map on San Francisco at scale 50000”_
540
541
  _Example: “Zoom to the features in the schools layer where city = 'Austin'”_
541
542
  _Example: “Go to the Downtown bookmark”_
542
- _Example: “Where is Mount Rainier?”_`, bi = {
543
+ _Example: “Where is Mount Rainier?”_`, qs = {
543
544
  id: "navigation",
544
545
  name: "Navigation Agent",
545
- description: ur,
546
- createGraph: dr,
547
- workspace: ke
548
- }, Fe = w.Root({
546
+ description: wr,
547
+ createGraph: fr,
548
+ workspace: Ne
549
+ }, Ae = w.Root({
549
550
  // Execution context provided by the orchestrator for this agent invocation.
550
551
  agentExecutionContext: w({
551
552
  reducer: K,
@@ -562,18 +563,18 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
562
563
  default: () => ""
563
564
  }),
564
565
  summary: w({
565
- reducer: _,
566
+ reducer: j,
566
567
  default: () => ""
567
568
  }),
568
569
  status: w({
569
- reducer: _,
570
+ reducer: j,
570
571
  default: () => "success"
571
572
  }),
572
573
  vectorSearchLayerIds: w(),
573
574
  vectorSearchFieldResults: w(),
574
575
  layerFieldInfo: w(),
575
576
  queryResponse: w()
576
- }), pr = async (e, t) => (await g({ text: "Exiting Data Exploration agent" }, t), e), ie = async (e, t) => {
577
+ }), br = async (e, t) => (await g({ text: "Exiting Data Exploration agent" }, t), e), de = async (e, t) => {
577
578
  const r = e.tool_calls ?? [];
578
579
  if (r.length === 0) {
579
580
  await g({ text: `LLM did not request any tool calls: ${String(e?.content)}` }, t);
@@ -587,55 +588,55 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
587
588
  )
588
589
  )
589
590
  );
590
- }, hr = ["mapView"];
591
- function I(e) {
591
+ }, xr = ["mapView"];
592
+ function A(e) {
592
593
  const r = e?.configurable?.context;
593
594
  if (!r || typeof r != "object")
594
595
  throw new Error("DataExplorationAgent context missing");
595
- const a = hr.filter((o) => !(o in r));
596
+ const a = xr.filter((o) => !(o in r));
596
597
  if (a.length)
597
598
  throw new Error(`DataExplorationAgent context missing: ${a.join(", ")}`);
598
599
  return r;
599
600
  }
600
- const mr = (e) => {
601
+ const Sr = (e) => {
601
602
  const t = e.map?.allLayers.filter((a) => a.type === "feature");
602
603
  let r = 0;
603
604
  return t?.forEach((a) => {
604
605
  const o = a;
605
606
  o.featureEffect && (o.featureEffect = null, r++);
606
607
  }), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
607
- }, gr = async (e, t) => {
608
- const { mapView: r } = I(t);
609
- return mr(r);
610
- }, yr = b(gr, {
608
+ }, vr = async (e, t) => {
609
+ const { mapView: r } = A(t);
610
+ return Sr(r);
611
+ }, Tr = b(vr, {
611
612
  name: "clearFilters",
612
613
  description: "Clears all feature effects/filters from the map but does NOT change the current view. Use when user says 'clear filters', 'reset filters', 'remove filters', 'show all features', or wants to remove emphasis without navigating anywhere.",
613
- schema: s.object({})
614
- }), fr = async (e) => {
614
+ schema: i.object({})
615
+ }), Er = async (e) => {
615
616
  e.map?.allLayers.filter((o) => o.type === "feature")?.forEach((o) => {
616
617
  const n = o;
617
618
  n.featureEffect && (n.featureEffect = null);
618
619
  });
619
620
  const a = e.map.initialViewProperties?.viewpoint?.targetGeometry;
620
621
  return a ? (await e.goTo(a), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
621
- }, wr = async (e, t) => {
622
- const { mapView: r } = I(t);
623
- return await fr(r);
624
- }, br = b(wr, {
622
+ }, Cr = async (e, t) => {
623
+ const { mapView: r } = A(t);
624
+ return await Er(r);
625
+ }, Rr = b(Cr, {
625
626
  name: "resetMap",
626
627
  description: "Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",
627
- schema: s.object({})
628
+ schema: i.object({})
628
629
  });
629
- function Z(e) {
630
+ function J(e) {
630
631
  return "point" in e && e.point !== void 0;
631
632
  }
632
633
  function O(e) {
633
634
  return "layerId" in e && e.layerId !== void 0;
634
635
  }
635
- const X = async (e, t) => {
636
- if (Z(e)) {
636
+ const re = async (e, t) => {
637
+ if (J(e)) {
637
638
  const { point: r } = e;
638
- return { geometry: new ae({
639
+ return { geometry: new ie({
639
640
  x: r.x,
640
641
  y: r.y,
641
642
  spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
@@ -664,7 +665,7 @@ const X = async (e, t) => {
664
665
  return { error: "The geometry of the first feature is undefined or null." };
665
666
  o = n;
666
667
  } else {
667
- const n = a.features.map((i) => i.geometry), c = Ze.executeMany(n);
668
+ const n = a.features.map((s) => s.geometry), c = tt.executeMany(n);
668
669
  if (!c)
669
670
  return { error: "Failed to create a combined geometry." };
670
671
  o = c;
@@ -675,17 +676,17 @@ const X = async (e, t) => {
675
676
  }
676
677
  }
677
678
  return { error: "Invalid geometry configuration provided" };
678
- }, xr = async (e, t, r, a, o, n) => {
679
+ }, $r = async (e, t, r, a, o, n) => {
679
680
  const c = e.map?.allLayers.find((l) => l.id === t);
680
681
  if (!c)
681
682
  return { success: !1, error: `Layer '${t}' not found.` };
682
- const i = c.createQuery();
683
- i.where = r ?? "1=1", a && (i.geometry = a, i.spatialRelationship = "intersects", o && (i.distance = o), n && (i.units = n));
683
+ const s = c.createQuery();
684
+ s.where = r ?? "1=1", a && (s.geometry = a, s.spatialRelationship = "intersects", o && (s.distance = o), n && (s.units = n));
684
685
  try {
685
- const { extent: l, count: d } = await c.queryExtent(i);
686
+ const { extent: l, count: d } = await c.queryExtent(s);
686
687
  return !l || d === 0 ? {
687
688
  success: !1,
688
- error: `No features found for filter (where: ${i.where}${a ? ", spatial filter used" : ""})`
689
+ error: `No features found for filter (where: ${s.where}${a ? ", spatial filter used" : ""})`
689
690
  } : (await e.goTo(l), { success: !0 });
690
691
  } catch (l) {
691
692
  return {
@@ -693,23 +694,23 @@ const X = async (e, t) => {
693
694
  error: l instanceof Error ? l.message : String(l)
694
695
  };
695
696
  }
696
- }, Sr = async (e, t, r, a, o, n) => {
697
+ }, kr = async (e, t, r, a, o, n) => {
697
698
  const c = t.map?.allLayers.find(
698
699
  (p) => p.id === e.layerId
699
700
  );
700
701
  if (!c)
701
702
  return `Could not find target layer with ID: ${e.layerId}`;
702
- let i;
703
+ let s;
703
704
  if (o) {
704
- const p = await X(o, t);
705
+ const p = await re(o, t);
705
706
  if ("error" in p)
706
707
  return p.error;
707
- i = p.geometry;
708
+ s = p.geometry;
708
709
  }
709
- if (c.featureEffect = null, c.featureEffect = new He({
710
- filter: new Ee({
710
+ if (c.featureEffect = null, c.featureEffect = new et({
711
+ filter: new Fe({
711
712
  ...e.objectIds?.length ? { objectIds: e.objectIds } : { where: e.where },
712
- geometry: i,
713
+ geometry: s,
713
714
  spatialRelationship: "intersects",
714
715
  distance: o?.distance,
715
716
  units: o?.units
@@ -718,190 +719,226 @@ const X = async (e, t) => {
718
719
  excludedEffect: a
719
720
  }), c.visible = !0, n)
720
721
  return `Applied feature effects to "${c.title ?? e.layerId}" within current map extent.`;
721
- const l = e.objectIds?.length ? `${c.objectIdField} IN (${e.objectIds.join(",")})` : e.where, d = await xr(
722
+ const l = e.objectIds?.length ? `${c.objectIdField} IN (${e.objectIds.join(",")})` : e.where, d = await $r(
722
723
  t,
723
724
  e.layerId,
724
725
  l,
725
- i,
726
+ s,
726
727
  o?.distance,
727
728
  o?.units
728
729
  ), u = c.title ?? e.layerId;
729
730
  return d.success ? `Applied feature effects to target layer "${c.title ?? e.layerId}"${o && "layerId" in o ? ` using geometry from layer "${o.layerId}"` : ""}.` : `Applied filter to "${u}" but no features matched. ${d.error}`;
730
- }, vr = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], A = s.enum(vr), Tr = async ({
731
+ }, Fr = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], z = i.enum(Fr), qr = async ({
731
732
  targetLayer: e,
732
733
  geometryFilter: t,
733
734
  useCurrentExtent: r,
734
735
  includedEffect: a = "drop-shadow(2px, 2px, 2px, gray)",
735
736
  excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
736
737
  }, n) => {
737
- const { mapView: c } = I(n);
738
- return await Sr(e, c, a, o, t, r);
739
- }, Er = s.object({
740
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
741
- where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
742
- distance: s.number().optional().describe("The buffer distance around the geometry."),
743
- units: A.optional().describe("The units for the distance buffer.")
744
- }), Cr = s.object({
745
- point: s.object({
746
- x: s.number().describe("X coordinate (longitude) from navigation result"),
747
- y: s.number().describe("Y coordinate (latitude) from navigation result"),
748
- spatialReference: s.object({
749
- wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
738
+ const { mapView: c } = A(n);
739
+ return await kr(e, c, a, o, t, r);
740
+ }, Lr = i.object({
741
+ layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
742
+ where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
743
+ distance: i.number().optional().describe("The buffer distance around the geometry."),
744
+ units: z.optional().describe("The units for the distance buffer.")
745
+ }), Ir = i.object({
746
+ point: i.object({
747
+ x: i.number().describe("X coordinate (longitude) from navigation result"),
748
+ y: i.number().describe("Y coordinate (latitude) from navigation result"),
749
+ spatialReference: i.object({
750
+ wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
750
751
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
751
752
  }).describe("Point coordinates from a previous navigation/geocoding result"),
752
- distance: s.number().optional().describe("Optional buffer distance around the point."),
753
- units: A.optional().describe("The units for the distance buffer.")
754
- }), Rr = s.object({
755
- targetLayer: s.object({
756
- layerId: s.string().describe("The layerId of the layer on which to set a feature effect."),
757
- where: s.string().describe("The SQL-92 where clause representing the features to emphasize."),
758
- objectIds: s.array(s.number()).optional().describe(
753
+ distance: i.number().optional().describe("Optional buffer distance around the point."),
754
+ units: z.optional().describe("The units for the distance buffer.")
755
+ }), Nr = i.object({
756
+ targetLayer: i.object({
757
+ layerId: i.string().describe("The layerId of the layer on which to set a feature effect."),
758
+ where: i.string().describe("The SQL-92 where clause representing the features to emphasize."),
759
+ objectIds: i.array(i.number()).optional().describe(
759
760
  "Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause."
760
761
  )
761
762
  }),
762
- geometryFilter: s.union([Er, Cr]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
763
- useCurrentExtent: s.boolean().optional().describe(
763
+ geometryFilter: i.union([Lr, Ir]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
764
+ useCurrentExtent: i.boolean().optional().describe(
764
765
  "Set to true when the previous query used the current map extent as a spatial filter. This ensures the feature effect applies only to features visible in the current view. Default is false."
765
766
  ),
766
- includedEffect: s.string().default("drop-shadow(2px, 2px, 2px, gray)").describe(
767
+ includedEffect: i.string().default("drop-shadow(2px, 2px, 2px, gray)").describe(
767
768
  "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."
768
769
  ),
769
- excludedEffect: s.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
770
+ excludedEffect: i.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
770
771
  "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."
771
772
  )
772
- }), $r = b(Tr, {
773
+ }), Ar = b(qr, {
773
774
  name: "setFeatureEffect",
774
775
  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.",
775
- schema: Rr
776
- }), J = (e, t, r) => {
776
+ schema: Nr
777
+ }), Y = (e, t, r) => {
777
778
  if (e && typeof e != "function") {
778
779
  const a = "getField" in r && r.getField?.(e), o = a && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(a.name) : null;
779
780
  if (o?.type === "coded-value") {
780
- const c = o.codedValues.find((i) => i.code === t);
781
+ const c = o.codedValues.find((s) => s.code === t);
781
782
  return c ? c.name : null;
782
783
  }
783
784
  }
784
785
  return null;
785
- }, kr = (e, t, r) => {
786
+ }, zr = /* @__PURE__ */ new Set(["date", "date-only", "time-only", "timestamp-offset"]), se = (e) => {
787
+ if (e instanceof Date)
788
+ return Number.isNaN(e.getTime()) ? null : e;
789
+ if (typeof e == "number" && Number.isFinite(e)) {
790
+ const t = new Date(e);
791
+ return Number.isNaN(t.getTime()) ? null : t;
792
+ }
793
+ return null;
794
+ }, _r = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, jr = (e) => {
795
+ if (typeof e == "string" && e)
796
+ return e;
797
+ const t = se(e);
798
+ return t ? t.toISOString().slice(0, 10) : null;
799
+ }, ze = () => {
800
+ const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), t = e <= 0 ? "+" : "-", r = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), a = (Math.abs(e) % 60).toString().padStart(2, "0"), o = `${t}${r}:${a}`;
801
+ return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
802
+ }, X = (e) => e ? zr.has(e.toLowerCase()) : !1, ee = (e, t, r) => {
803
+ const a = t?.toLowerCase();
804
+ if (a === "date-only") {
805
+ const n = jr(e);
806
+ return n ? rt(n, U("short-date")) : e;
807
+ }
808
+ if (a === "time-only") {
809
+ if (typeof e == "string" && e)
810
+ return at(e, U("long-time"));
811
+ const n = se(e);
812
+ return n ? fe(n, {
813
+ ...U("long-time"),
814
+ timeZone: "UTC"
815
+ }) : e;
816
+ }
817
+ const o = se(e);
818
+ return o ? fe(o, {
819
+ ...U("short-date-short-time"),
820
+ timeZone: _r(r)
821
+ }) : e;
822
+ }, Dr = (e, t, r) => {
786
823
  const a = e.createQuery();
787
824
  return a.outFields = [t], a.where = r || "1=1", a.num = 1, a;
788
- }, Fr = async (e, t, r, a) => {
789
- const o = a.map?.allLayers.find((p) => p.id === e), n = kr(o, t, r.where), i = (await o.queryFeatures(n)).features[0], l = i ? i.attributes[t] : null, d = J(t, l, o) || l;
825
+ }, Pr = async (e, t, r, a) => {
826
+ const o = a.map?.allLayers.find((y) => y.id === e), n = Dr(o, t, r.where), s = (await o.queryFeatures(n)).features[0], l = s ? s.attributes[t] : null, d = o.fields.find((y) => y.name === t), u = Y(t, l, o) || l, p = d && X(d.type) ? ee(u, d.type, a.timeZone) : u;
790
827
  return {
791
828
  tool: "getAttribute",
792
829
  layerName: o.title ?? e,
793
- summary: `${t} = ${d}`,
830
+ summary: `${t} = ${p}`,
794
831
  details: {
795
832
  fieldName: t,
796
- value: d,
833
+ value: p,
797
834
  where: r.where
798
835
  }
799
836
  };
800
837
  };
801
- async function Lr({ layerId: e, fieldName: t, query: r }, a) {
802
- const { mapView: o } = I(a), n = await Fr(e, t, r, o);
838
+ async function Mr({ layerId: e, fieldName: t, query: r }, a) {
839
+ const { mapView: o } = A(a), n = await Pr(e, t, r, o);
803
840
  return JSON.stringify(n, null, 2);
804
841
  }
805
- const qr = s.object({
806
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
807
- fieldName: s.string().describe("The name of the field/attribute from which to get a field value."),
808
- query: s.object({
809
- where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
842
+ const Or = i.object({
843
+ layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
844
+ fieldName: i.string().describe("The name of the field/attribute from which to get a field value."),
845
+ query: i.object({
846
+ where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
810
847
  })
811
- }), Ir = b(Lr, {
848
+ }), Gr = b(Mr, {
812
849
  name: "getAttribute",
813
850
  description: "Returns an attribute value for a given feature.",
814
- schema: qr
815
- }), se = (e, t, r) => r ? e.hasAllFeaturesInView && e.availableFields === t : e.hasAllFeatures && e.availableFields === t;
816
- function Y(e, t) {
851
+ schema: Or
852
+ }), ue = (e, t, r) => r ? e.hasAllFeaturesInView && e.availableFields === t : e.hasAllFeatures && e.availableFields === t;
853
+ function te(e, t) {
817
854
  let r = e ?? "";
818
855
  return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
819
856
  }
820
- const Ar = async (e) => {
821
- const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: c } = e, i = o.map?.allLayers.find((S) => S.id === t.layerId);
822
- if (!i)
857
+ const Vr = async (e) => {
858
+ const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: c } = e, s = o.map?.allLayers.find((T) => T.id === t.layerId);
859
+ if (!s)
823
860
  throw new Error(`Layer '${t.layerId}' not found.`);
824
- const l = await o.whenLayerView(i), u = n.get(t.layerId)?.fieldRegistry.get(r), p = u?.alias;
861
+ const l = await o.whenLayerView(s), u = n.get(t.layerId)?.fieldRegistry.get(r), p = u?.alias;
825
862
  if (!u)
826
863
  throw new Error(`Field '${r}' not found.`);
827
- let h, y;
864
+ let m, y;
828
865
  if (c) {
829
- const S = await X(c, o);
830
- if ("error" in S)
831
- throw new Error(S.error);
832
- if (!S.geometry)
866
+ const T = await re(c, o);
867
+ if ("error" in T)
868
+ throw new Error(T.error);
869
+ if (!T.geometry)
833
870
  throw O(c) ? new Error(`No features found matching: ${c.where}`) : new Error("Failed to create geometry");
834
- O(c) ? h = {
871
+ O(c) ? m = {
835
872
  geometryLayerId: c.layerId,
836
873
  geometryWhere: c.where,
837
874
  distance: c.distance,
838
875
  units: c.units,
839
876
  applied: !0
840
- } : Z(c) && (h = {
877
+ } : J(c) && (m = {
841
878
  point: c.point,
842
879
  distance: c.distance,
843
880
  units: c.units,
844
881
  applied: !0
845
- }), y = new Ee({
846
- geometry: S.geometry,
882
+ }), y = new Fe({
883
+ geometry: T.geometry,
847
884
  distance: c.distance,
848
885
  units: c.units,
849
886
  spatialRelationship: "intersects"
850
887
  });
851
888
  }
852
- const T = se(l, [r], !1);
853
- let m = null, f = null;
854
- const v = 10;
889
+ const E = ue(l, [r], !1);
890
+ let h = null, f = null;
891
+ const S = 10;
855
892
  if (u.type !== "geometry" && u.type !== "oid" && u.type !== "global-id")
856
893
  try {
857
- const S = {
858
- layer: i,
859
- useFeaturesInView: T,
860
- view: T ? o : void 0,
894
+ const T = {
895
+ layer: s,
896
+ useFeaturesInView: E,
897
+ view: E ? o : void 0,
861
898
  field: r,
862
- sqlWhere: Y(i.definitionExpression, t.where),
899
+ sqlWhere: te(s.definitionExpression, t.where),
863
900
  ...y && { filter: y },
864
901
  outStatisticTypes: { include: [a] }
865
902
  };
866
- m = await Ce(S);
867
- const P = ["string", "small-integer", "integer"], D = u.domain?.type === "coded-value" ? u.domain : null;
868
- (P.includes(u.type) || D) && (f = (await Re({
869
- layer: i,
870
- useFeaturesInView: T,
871
- view: T ? o : void 0,
903
+ h = await qe(T);
904
+ const R = ["string", "small-integer", "integer"], M = u.domain?.type === "coded-value" ? u.domain : null;
905
+ (R.includes(u.type) || M) && (f = (await Le({
906
+ layer: s,
907
+ useFeaturesInView: E,
908
+ view: E ? o : void 0,
872
909
  field: r,
873
- sqlWhere: Y(i.definitionExpression, t.where),
910
+ sqlWhere: te(s.definitionExpression, t.where),
874
911
  ...y && { filter: y }
875
- })).uniqueValueInfos.sort((N, Ve) => Ve.count - N.count).slice(0, v)), f && u.domain?.type === "coded-value" && (f = f.map((N) => ({
876
- ...N,
877
- value: D ? D.getName(N.value) ?? N.value : N.value
912
+ })).uniqueValueInfos.sort((I, Ue) => Ue.count - I.count).slice(0, S)), f && u.domain?.type === "coded-value" && (f = f.map((I) => ({
913
+ ...I,
914
+ value: M ? M.getName(I.value) ?? I.value : I.value
878
915
  })));
879
- } catch (S) {
880
- console.error("Statistics error:", S);
916
+ } catch (T) {
917
+ console.error("Statistics error:", T);
881
918
  }
882
919
  return {
883
920
  tool: "getStatistics",
884
- layerName: i.title ?? t.layerId,
885
- summary: `${a} = ${typeof m?.[a] == "number" ? m[a] : "N/A"}`,
921
+ layerName: s.title ?? t.layerId,
922
+ summary: `${a} = ${typeof h?.[a] == "number" ? h[a] : "N/A"}`,
886
923
  details: {
887
924
  fieldName: r,
888
925
  fieldAlias: p,
889
926
  statisticType: a,
890
- statistic: m?.[a] ?? null,
891
- summaryStatistics: m,
927
+ statistic: h?.[a] ?? null,
928
+ summaryStatistics: h,
892
929
  uniqueValues: f,
893
930
  where: t.where,
894
- spatialFilterInfo: h
931
+ spatialFilterInfo: m
895
932
  }
896
933
  };
897
934
  };
898
- async function Nr({
935
+ async function Wr({
899
936
  targetLayer: e,
900
937
  fieldName: t,
901
938
  statisticType: r,
902
939
  geometryFilter: a
903
940
  }, o) {
904
- const n = x(o, "layersAndFieldsRegistry"), { mapView: c } = I(o), i = await Ar({
941
+ const n = x(o, "layersAndFieldsRegistry"), { mapView: c } = A(o), s = await Vr({
905
942
  targetLayer: e,
906
943
  fieldName: t,
907
944
  statisticType: r,
@@ -909,34 +946,34 @@ async function Nr({
909
946
  layersAndFieldsRegistry: n,
910
947
  geometryFilter: a
911
948
  });
912
- return JSON.stringify(i, null, 2);
913
- }
914
- const zr = s.object({
915
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
916
- where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
917
- distance: s.number().optional().describe("The buffer distance around the geometry."),
918
- units: A.optional().describe("The units for the distance buffer.")
919
- }), _r = s.object({
920
- point: s.object({
921
- x: s.number().describe("X coordinate (longitude) from navigation result"),
922
- y: s.number().describe("Y coordinate (latitude) from navigation result"),
923
- spatialReference: s.object({
924
- wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
949
+ return JSON.stringify(s, null, 2);
950
+ }
951
+ const Kr = i.object({
952
+ layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
953
+ where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
954
+ distance: i.number().optional().describe("The buffer distance around the geometry."),
955
+ units: z.optional().describe("The units for the distance buffer.")
956
+ }), Br = i.object({
957
+ point: i.object({
958
+ x: i.number().describe("X coordinate (longitude) from navigation result"),
959
+ y: i.number().describe("Y coordinate (latitude) from navigation result"),
960
+ spatialReference: i.object({
961
+ wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
925
962
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
926
963
  }).describe("Point coordinates from a previous navigation/geocoding result"),
927
- distance: s.number().optional().describe("Optional buffer distance around the point."),
928
- units: A.optional().describe("The units for the distance buffer.")
929
- }), jr = s.object({
930
- targetLayer: s.object({
931
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
932
- where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
964
+ distance: i.number().optional().describe("Optional buffer distance around the point."),
965
+ units: z.optional().describe("The units for the distance buffer.")
966
+ }), Qr = i.object({
967
+ targetLayer: i.object({
968
+ layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
969
+ where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
933
970
  }),
934
- geometryFilter: s.union([zr, _r]).optional().describe(
971
+ geometryFilter: i.union([Kr, Br]).optional().describe(
935
972
  "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."
936
973
  ),
937
- fieldName: s.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
938
- statisticType: s.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
939
- }), Mr = b(Nr, {
974
+ fieldName: i.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
975
+ statisticType: i.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
976
+ }), Ur = b(Wr, {
940
977
  name: "getStatistics",
941
978
  description: `Computes a single aggregate statistic (max, min, avg, sum, median, stddev, variance) for a numeric field across matching features. Also returns frequency analysis for categorical fields.
942
979
 
@@ -951,35 +988,35 @@ DO NOT USE FOR:
951
988
  - Simple counts of features matching a condition — use queryFeatures instead
952
989
 
953
990
  Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,
954
- schema: jr
955
- }), Pr = async (e, t, r, a, o) => {
956
- const n = r.map?.allLayers.find((h) => h.id === e.layerId), c = await r.whenLayerView(n), i = n.title ?? e.layerId;
991
+ schema: Qr
992
+ }), Hr = async (e, t, r, a, o) => {
993
+ const n = r.map?.allLayers.find((m) => m.id === e.layerId), c = await r.whenLayerView(n), s = n.title ?? e.layerId;
957
994
  let l;
958
995
  if (a) {
959
- const h = await X(a, r);
960
- if ("error" in h)
996
+ const m = await re(a, r);
997
+ if ("error" in m)
961
998
  return {
962
999
  tool: "getTopFeatures",
963
- layerName: i,
1000
+ layerName: s,
964
1001
  summary: "Geometry lookup failed",
965
- details: { error: h.error }
1002
+ details: { error: m.error }
966
1003
  };
967
- if (!h.geometry)
1004
+ if (!m.geometry)
968
1005
  return {
969
1006
  tool: "getTopFeatures",
970
- layerName: i,
1007
+ layerName: s,
971
1008
  summary: "No features found for geometry filter",
972
1009
  details: {
973
1010
  error: `No features found matching: ${"where" in a ? a.where : "unknown criteria"}`
974
1011
  }
975
1012
  };
976
- l = h.geometry;
1013
+ l = m.geometry;
977
1014
  } else o && (l = r.extent.clone());
978
1015
  const d = t.groupByFields && t.groupByFields.length > 0, u = n.objectIdField, p = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, u])];
979
1016
  try {
980
- let h;
1017
+ let m;
981
1018
  if (d) {
982
- const m = new Je({
1019
+ const h = new ot({
983
1020
  where: e.where || "1=1",
984
1021
  outFields: p,
985
1022
  orderByFields: e.orderByFields,
@@ -987,41 +1024,41 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
987
1024
  spatialRelationship: l ? "intersects" : void 0,
988
1025
  distance: a?.distance,
989
1026
  units: a?.units,
990
- topFilter: new Ye({
1027
+ topFilter: new nt({
991
1028
  topCount: t.topCount,
992
1029
  groupByFields: t.groupByFields,
993
1030
  orderByFields: t.orderByFields
994
1031
  })
995
1032
  });
996
- h = await n.queryTopFeatures(m);
1033
+ m = await n.queryTopFeatures(h);
997
1034
  } else {
998
- const m = n.createQuery();
999
- m.where = Y(n.definitionExpression, e.where || "1=1"), m.outFields = p.length ? p : ["*"], m.orderByFields = t.orderByFields, m.num = t.topCount, l && (m.geometry = l, m.spatialRelationship = "intersects"), a?.distance && (m.distance = a.distance), a?.units && (m.units = a.units), m.outSpatialReference = r.spatialReference;
1000
- const f = se(c, e.outFields, o ?? !1);
1035
+ const h = n.createQuery();
1036
+ h.where = te(n.definitionExpression, e.where || "1=1"), h.outFields = p.length ? p : ["*"], h.orderByFields = t.orderByFields, h.num = t.topCount, l && (h.geometry = l, h.spatialRelationship = "intersects"), a?.distance && (h.distance = a.distance), a?.units && (h.units = a.units), h.outSpatialReference = r.spatialReference;
1037
+ const f = ue(c, e.outFields, o ?? !1);
1001
1038
  try {
1002
- h = f ? await c.queryFeatures(m) : await n.queryFeatures(m);
1003
- } catch (v) {
1004
- console.warn("Client-side query failed, falling back to server:", v), h = await n.queryFeatures(m);
1039
+ m = f ? await c.queryFeatures(h) : await n.queryFeatures(h);
1040
+ } catch (S) {
1041
+ console.warn("Client-side query failed, falling back to server:", S), m = await n.queryFeatures(h);
1005
1042
  }
1006
1043
  }
1007
- const y = h.features.map((m) => m.attributes[u]), T = h.features.map((m) => {
1008
- const f = m.attributes, v = {};
1009
- return n.fields.forEach((E) => {
1010
- if (E.name === n.objectIdField) {
1011
- v[E.name] = f[E.name];
1044
+ const y = m.features.map((h) => h.attributes[u]), E = m.features.map((h) => {
1045
+ const f = h.attributes, S = {};
1046
+ return n.fields.forEach((v) => {
1047
+ if (v.name === n.objectIdField) {
1048
+ S[v.name] = f[v.name];
1012
1049
  return;
1013
1050
  }
1014
- const S = f[E.name], P = J(E.name, S, n), D = E.alias || E.name;
1015
- v[D] = P ?? S;
1016
- }), v;
1051
+ const T = f[v.name], R = Y(v.name, T, n), M = v.alias || v.name, I = R ?? T;
1052
+ S[M] = X(v.type) ? ee(I, v.type, r.timeZone) : I;
1053
+ }), S;
1017
1054
  });
1018
1055
  return {
1019
1056
  tool: "getTopFeatures",
1020
- layerName: i,
1057
+ layerName: s,
1021
1058
  summary: `Top ${t.topCount} features extracted`,
1022
1059
  details: {
1023
1060
  topCount: t.topCount,
1024
- attributes: T,
1061
+ attributes: E,
1025
1062
  objectIds: y,
1026
1063
  objectIdField: u,
1027
1064
  where: e.where,
@@ -1029,110 +1066,110 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1029
1066
  ...d && { groupByFields: t.groupByFields }
1030
1067
  }
1031
1068
  };
1032
- } catch (h) {
1069
+ } catch (m) {
1033
1070
  return {
1034
1071
  tool: "getTopFeatures",
1035
- layerName: i,
1072
+ layerName: s,
1036
1073
  summary: "Query failed",
1037
- details: { error: h instanceof Error ? h.message : String(h) }
1074
+ details: { error: m instanceof Error ? m.message : String(m) }
1038
1075
  };
1039
1076
  }
1040
- }, Dr = async ({
1077
+ }, Zr = async ({
1041
1078
  targetLayer: e,
1042
1079
  topFilter: t,
1043
1080
  geometryFilter: r,
1044
1081
  useCurrentExtent: a
1045
1082
  }, o) => {
1046
- const { mapView: n } = I(o), c = await Pr(e, t, n, r, a);
1083
+ const { mapView: n } = A(o), c = await Hr(e, t, n, r, a);
1047
1084
  return JSON.stringify(c, null, 2);
1048
- }, Or = s.object({
1049
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1050
- where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1051
- distance: s.number().optional().describe("The buffer distance around the geometry."),
1052
- units: A.optional().describe("The units for the distance buffer.")
1053
- }), Gr = s.object({
1054
- point: s.object({
1055
- x: s.number().describe("X coordinate (longitude) from navigation result"),
1056
- y: s.number().describe("Y coordinate (latitude) from navigation result"),
1057
- spatialReference: s.object({
1058
- wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1085
+ }, Jr = i.object({
1086
+ layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1087
+ where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1088
+ distance: i.number().optional().describe("The buffer distance around the geometry."),
1089
+ units: z.optional().describe("The units for the distance buffer.")
1090
+ }), Yr = i.object({
1091
+ point: i.object({
1092
+ x: i.number().describe("X coordinate (longitude) from navigation result"),
1093
+ y: i.number().describe("Y coordinate (latitude) from navigation result"),
1094
+ spatialReference: i.object({
1095
+ wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1059
1096
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1060
1097
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1061
- distance: s.number().optional().describe("Optional buffer distance around the point."),
1062
- units: A.optional().describe("The units for the distance buffer.")
1063
- }), Vr = s.object({
1064
- targetLayer: s.object({
1065
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1066
- where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
1067
- orderByFields: s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),
1068
- outFields: s.array(
1069
- s.string().describe(
1098
+ distance: i.number().optional().describe("Optional buffer distance around the point."),
1099
+ units: z.optional().describe("The units for the distance buffer.")
1100
+ }), Xr = i.object({
1101
+ targetLayer: i.object({
1102
+ layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1103
+ where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
1104
+ orderByFields: i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),
1105
+ outFields: i.array(
1106
+ i.string().describe(
1070
1107
  'The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").'
1071
1108
  ).default("*")
1072
1109
  )
1073
1110
  }),
1074
- geometryFilter: s.union([Or, Gr]).optional().describe(
1111
+ geometryFilter: i.union([Jr, Yr]).optional().describe(
1075
1112
  "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."
1076
1113
  ),
1077
- topFilter: s.object({
1078
- topCount: s.number().describe("Number of top features to return per group."),
1079
- orderByFields: s.array(
1080
- s.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
1114
+ topFilter: i.object({
1115
+ topCount: i.number().describe("Number of top features to return per group."),
1116
+ orderByFields: i.array(
1117
+ i.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
1081
1118
  ),
1082
- groupByFields: s.array(s.string().describe("Field(s) to group results by. Returns top N per group."))
1119
+ groupByFields: i.array(i.string().describe("Field(s) to group results by. Returns top N per group."))
1083
1120
  }),
1084
- useCurrentExtent: s.boolean().optional().describe(
1121
+ useCurrentExtent: i.boolean().optional().describe(
1085
1122
  "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)."
1086
1123
  )
1087
- }), Wr = b(Dr, {
1124
+ }), ea = b(Zr, {
1088
1125
  name: "getTopFeatures",
1089
1126
  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.',
1090
- schema: Vr
1091
- }), re = 25, Kr = async (e, t, r, a) => {
1092
- const o = t.map?.allLayers.find((m) => m.id === e.layerId), n = await t.whenLayerView(o), c = o.title ?? e.layerId;
1093
- let i;
1127
+ schema: Xr
1128
+ }), ne = 25, ta = async (e, t, r, a) => {
1129
+ const o = t.map?.allLayers.find((h) => h.id === e.layerId), n = await t.whenLayerView(o), c = o.title ?? e.layerId;
1130
+ let s;
1094
1131
  if (r) {
1095
- const m = await X(r, t);
1096
- if ("error" in m) {
1097
- const f = { error: m.error };
1098
- return O(r) ? (f.geometryLayerId = r.layerId, f.geometryWhere = r.where) : Z(r) && (f.point = r.point), {
1132
+ const h = await re(r, t);
1133
+ if ("error" in h) {
1134
+ const f = { error: h.error };
1135
+ return O(r) ? (f.geometryLayerId = r.layerId, f.geometryWhere = r.where) : J(r) && (f.point = r.point), {
1099
1136
  tool: "queryFeatures",
1100
1137
  layerName: c,
1101
1138
  summary: "Geometry lookup failed",
1102
1139
  details: f
1103
1140
  };
1104
1141
  }
1105
- if (!m.geometry) {
1142
+ if (!h.geometry) {
1106
1143
  const f = {};
1107
- return O(r) ? (f.error = `No features found matching: ${r.where}`, f.geometryLayerId = r.layerId, f.geometryWhere = r.where) : Z(r) && (f.error = "Failed to create point geometry", f.point = r.point), {
1144
+ return O(r) ? (f.error = `No features found matching: ${r.where}`, f.geometryLayerId = r.layerId, f.geometryWhere = r.where) : J(r) && (f.error = "Failed to create point geometry", f.point = r.point), {
1108
1145
  tool: "queryFeatures",
1109
1146
  layerName: c,
1110
1147
  summary: "No features found for geometry filter",
1111
1148
  details: f
1112
1149
  };
1113
1150
  }
1114
- i = m.geometry;
1115
- } else a && (i = t.extent.clone());
1116
- const l = se(n, e.outFields, a ?? !1), d = o.objectIdField, u = o.createQuery();
1117
- u.where = Y(o.definitionExpression, e.where || "1=1"), u.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])], u.orderByFields = e.orderByFields, i && (u.geometry = i, u.spatialRelationship = "intersects"), r?.distance && (u.distance = r.distance), r?.units && (u.units = r.units), u.outSpatialReference = t.spatialReference;
1118
- let p, h;
1151
+ s = h.geometry;
1152
+ } else a && (s = t.extent.clone());
1153
+ const l = ue(n, e.outFields, a ?? !1), d = o.objectIdField, u = o.createQuery();
1154
+ u.where = te(o.definitionExpression, e.where || "1=1"), u.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])], u.orderByFields = e.orderByFields, s && (u.geometry = s, u.spatialRelationship = "intersects"), r?.distance && (u.distance = r.distance), r?.units && (u.units = r.units), u.outSpatialReference = t.spatialReference;
1155
+ let p, m;
1119
1156
  try {
1120
- p = l ? await n.queryFeatureCount(u) : await o.queryFeatureCount(u), p > 0 && p <= re && (h = l ? await n.queryFeatures(u) : await o.queryFeatures(u), h && h.features.forEach((m) => {
1121
- const f = m.attributes;
1122
- o.fields.forEach((v) => {
1123
- const E = f[v.name], S = J(v.name, E, o);
1124
- S && (f[v.name] = S);
1157
+ p = l ? await n.queryFeatureCount(u) : await o.queryFeatureCount(u), p > 0 && p <= ne && (m = l ? await n.queryFeatures(u) : await o.queryFeatures(u), m && m.features.forEach((h) => {
1158
+ const f = h.attributes;
1159
+ o.fields.forEach((S) => {
1160
+ const v = f[S.name], R = Y(S.name, v, o) ?? v;
1161
+ f[S.name] = X(S.type) ? ee(R, S.type, t.timeZone) : R;
1125
1162
  });
1126
1163
  }));
1127
- } catch (m) {
1128
- console.warn("Client-side query failed, falling back to server:", m), p = await o.queryFeatureCount(u), p > 0 && p <= re && (h = await o.queryFeatures(u), h && h.features.forEach((f) => {
1129
- o.fields.forEach((v) => {
1130
- const E = f.attributes[v.name], S = J(v.name, E, o);
1131
- S && (f.attributes[v.name] = S);
1164
+ } catch (h) {
1165
+ console.warn("Client-side query failed, falling back to server:", h), p = await o.queryFeatureCount(u), p > 0 && p <= ne && (m = await o.queryFeatures(u), m && m.features.forEach((f) => {
1166
+ o.fields.forEach((S) => {
1167
+ const v = f.attributes[S.name], R = Y(S.name, v, o) ?? v;
1168
+ f.attributes[S.name] = X(S.type) ? ee(R, S.type, t.timeZone) : R;
1132
1169
  });
1133
1170
  }));
1134
1171
  }
1135
- const y = h?.features.map((m) => m.attributes[d]), T = h?.features.map((m) => m.attributes);
1172
+ const y = m?.features.map((h) => h.attributes[d]), E = m?.features.map((h) => h.attributes);
1136
1173
  return {
1137
1174
  tool: "queryFeatures",
1138
1175
  layerName: c,
@@ -1143,56 +1180,56 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1143
1180
  orderByFields: e.orderByFields,
1144
1181
  outFields: e.outFields,
1145
1182
  ...y && { objectIds: y, objectIdField: d },
1146
- ...T && { attributes: T },
1147
- ...p > re && {
1183
+ ...E && { attributes: E },
1184
+ ...p > ne && {
1148
1185
  note: `${p} features found.`
1149
1186
  }
1150
1187
  }
1151
1188
  };
1152
1189
  };
1153
- async function Br({
1190
+ async function ra({
1154
1191
  targetLayer: e,
1155
1192
  geometryFilter: t,
1156
1193
  useCurrentExtent: r
1157
1194
  }, a) {
1158
- const { mapView: o } = I(a), n = await Kr(e, o, t, r);
1195
+ const { mapView: o } = A(a), n = await ta(e, o, t, r);
1159
1196
  return JSON.stringify(n, null, 2);
1160
1197
  }
1161
- const Qr = s.object({
1162
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1163
- where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1164
- distance: s.number().optional().describe("The buffer distance around the geometry."),
1165
- units: A.optional().describe("The units for the distance buffer.")
1166
- }), Ur = s.object({
1167
- point: s.object({
1168
- x: s.number().describe("X coordinate (longitude) from navigation result"),
1169
- y: s.number().describe("Y coordinate (latitude) from navigation result"),
1170
- spatialReference: s.object({
1171
- wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1198
+ const aa = i.object({
1199
+ layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1200
+ where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1201
+ distance: i.number().optional().describe("The buffer distance around the geometry."),
1202
+ units: z.optional().describe("The units for the distance buffer.")
1203
+ }), oa = i.object({
1204
+ point: i.object({
1205
+ x: i.number().describe("X coordinate (longitude) from navigation result"),
1206
+ y: i.number().describe("Y coordinate (latitude) from navigation result"),
1207
+ spatialReference: i.object({
1208
+ wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1172
1209
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1173
1210
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1174
- distance: s.number().optional().describe("Optional buffer distance around the point."),
1175
- units: A.optional().describe("The units for the distance buffer.")
1176
- }), Hr = s.object({
1177
- targetLayer: s.object({
1178
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1179
- where: s.string().describe(
1211
+ distance: i.number().optional().describe("Optional buffer distance around the point."),
1212
+ units: z.optional().describe("The units for the distance buffer.")
1213
+ }), na = i.object({
1214
+ targetLayer: i.object({
1215
+ layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1216
+ where: i.string().describe(
1180
1217
  "SQL-92 where clause. IMPORTANT: When using geometryFilter.point for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."
1181
1218
  ),
1182
- orderByFields: s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),
1183
- outFields: s.array(
1184
- s.string().describe(
1219
+ orderByFields: i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),
1220
+ outFields: i.array(
1221
+ i.string().describe(
1185
1222
  'The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").'
1186
1223
  ).default("*")
1187
1224
  )
1188
1225
  }),
1189
- geometryFilter: s.union([Qr, Ur]).optional().describe(
1226
+ geometryFilter: i.union([aa, oa]).optional().describe(
1190
1227
  "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."
1191
1228
  ),
1192
- useCurrentExtent: s.boolean().optional().describe(
1229
+ useCurrentExtent: i.boolean().optional().describe(
1193
1230
  "Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer)."
1194
1231
  )
1195
- }), Zr = b(Br, {
1232
+ }), sa = b(ra, {
1196
1233
  name: "queryFeatures",
1197
1234
  description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
1198
1235
 
@@ -1204,16 +1241,13 @@ USE THIS TOOL FOR:
1204
1241
  - Any question where the user wants to SEE or COUNT matching features
1205
1242
 
1206
1243
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1207
- schema: Hr
1208
- }), Le = [Ir, Mr, Wr, Zr], qe = [$r, br, yr], Ie = () => {
1209
- const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), t = e <= 0 ? "+" : "-", r = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), a = (Math.abs(e) % 60).toString().padStart(2, "0"), o = `${t}${r}:${a}`;
1210
- return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
1211
- }, Jr = async (e, t) => {
1244
+ schema: na
1245
+ }), _e = [Gr, Ur, ea, sa], je = [Ar, Rr, Tr], ia = async (e, t) => {
1212
1246
  await g({ text: "Requesting LLM for layer filter results" }, t);
1213
1247
  const a = await L("data_explore_filter_prompt");
1214
1248
  if (!t?.configurable)
1215
1249
  throw new Error("config.configurable is required for layer filter tools");
1216
- const { userTimezone: o, userTimezoneOffset: n } = Ie(), c = {
1250
+ const { userTimezone: o, userTimezoneOffset: n } = ze(), c = {
1217
1251
  layerFieldInfo: e.layerFieldInfo,
1218
1252
  userTimezone: o,
1219
1253
  userTimezoneOffset: n,
@@ -1221,42 +1255,42 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1221
1255
  assignedTask: e.agentExecutionContext.assignedTask,
1222
1256
  userRequest: e.agentExecutionContext.userRequest,
1223
1257
  priorSteps: e.agentExecutionContext.priorSteps
1224
- }, i = await j({
1258
+ }, s = await D({
1225
1259
  promptText: a,
1226
1260
  modelTier: "advanced",
1227
1261
  messages: C(e.agentExecutionContext.messages),
1228
1262
  inputVariables: c,
1229
- tools: qe
1230
- }), l = [...e.agentExecutionContext.messages, i];
1231
- if (!((i.tool_calls?.length ?? 0) > 0))
1263
+ tools: je
1264
+ }), l = [...e.agentExecutionContext.messages, s];
1265
+ if (!((s.tool_calls?.length ?? 0) > 0))
1232
1266
  return await g({ text: "LLM determined no filter changes needed" }, t), {
1233
1267
  ...e,
1234
1268
  agentExecutionContext: { ...e.agentExecutionContext, messages: l }
1235
1269
  // Don't overwrite outputMessage if query already set it
1236
1270
  };
1237
- const u = [...l, i], p = i.content.toString();
1238
- return await ie(i, t), { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: u }, outputMessage: p };
1239
- }, Yr = async (e, t) => {
1271
+ const u = [...l, s], p = s.content.toString();
1272
+ return await de(s, t), { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: u }, outputMessage: p };
1273
+ }, ca = async (e, t) => {
1240
1274
  await g({ text: "Requesting LLM for layer query results" }, t);
1241
1275
  const a = await L("data_explore_query_prompt");
1242
1276
  if (!t?.configurable)
1243
1277
  throw new Error("config.configurable is required for layer query tools");
1244
- const { userTimezone: o, userTimezoneOffset: n } = Ie(), c = {
1278
+ const { userTimezone: o, userTimezoneOffset: n } = ze(), c = {
1245
1279
  layerFieldInfo: e.layerFieldInfo,
1246
1280
  userTimezone: o,
1247
1281
  userTimezoneOffset: n,
1248
1282
  assignedTask: e.agentExecutionContext.assignedTask,
1249
1283
  userRequest: e.agentExecutionContext.userRequest,
1250
1284
  priorSteps: e.agentExecutionContext.priorSteps
1251
- }, i = await j({
1285
+ }, s = await D({
1252
1286
  promptText: a,
1253
1287
  modelTier: "advanced",
1254
1288
  messages: C(e.agentExecutionContext.messages),
1255
1289
  inputVariables: c,
1256
- tools: Le
1257
- }), l = [...e.agentExecutionContext.messages, i], d = i.content.toString();
1258
- return await ie(i, t), { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: l }, outputMessage: d };
1259
- }, Xr = async (e, t) => {
1290
+ tools: _e
1291
+ }), l = [...e.agentExecutionContext.messages, s], d = s.content.toString();
1292
+ return await de(s, t), { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: l }, outputMessage: d };
1293
+ }, la = async (e, t) => {
1260
1294
  try {
1261
1295
  await g({ text: "Requesting LLM for summary on query results" }, t);
1262
1296
  const a = await L("summarize_query_response_prompt"), o = {
@@ -1264,72 +1298,72 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1264
1298
  assignedTask: e.agentExecutionContext.assignedTask,
1265
1299
  userRequest: e.agentExecutionContext.userRequest,
1266
1300
  priorSteps: e.agentExecutionContext.priorSteps
1267
- }, n = await Ke({
1301
+ }, n = await Ze({
1268
1302
  promptText: a,
1269
1303
  modelTier: "fast",
1270
1304
  messages: C(e.agentExecutionContext.messages),
1271
1305
  inputVariables: o
1272
- }), c = typeof n == "string" ? n : n.content, i = new Te(c);
1306
+ }), c = typeof n == "string" ? n : n.content, s = new ke(c);
1273
1307
  return await g({ text: `Received response from LLM: ${c}` }, t), {
1274
1308
  ...e,
1275
1309
  outputMessage: c,
1276
1310
  agentExecutionContext: {
1277
1311
  ...e.agentExecutionContext,
1278
- messages: [...e.agentExecutionContext.messages, i]
1312
+ messages: [...e.agentExecutionContext.messages, s]
1279
1313
  }
1280
1314
  };
1281
1315
  } catch (r) {
1282
1316
  throw await g({ text: "Error during filter LLM request" }, t), new Error(`Error during filter LLM request: ${r instanceof Error ? r.message : String(r)}`);
1283
1317
  }
1284
1318
  };
1285
- async function ea(e, t) {
1286
- const a = await new M(qe).invoke(
1319
+ async function da(e, t) {
1320
+ const a = await new P(je).invoke(
1287
1321
  {
1288
1322
  messages: C(e.agentExecutionContext.messages)
1289
1323
  },
1290
1324
  t
1291
1325
  ), o = [...e.agentExecutionContext.messages, ...a.messages], n = a.messages.map(
1292
- (i) => new Te({
1293
- content: i.content,
1326
+ (s) => new ke({
1327
+ content: s.content,
1294
1328
  // eslint-disable-next-line @typescript-eslint/naming-convention
1295
- additional_kwargs: i.additional_kwargs
1329
+ additional_kwargs: s.additional_kwargs
1296
1330
  })
1297
1331
  );
1298
1332
  await g(
1299
- { text: `Finished executing layer filter tool: ${a.messages.map((i) => i.content).join(", ")}` },
1333
+ { text: `Finished executing layer filter tool: ${a.messages.map((s) => s.content).join(", ")}` },
1300
1334
  t
1301
1335
  );
1302
1336
  const c = [...o, ...n];
1303
1337
  return { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: c } };
1304
1338
  }
1305
- const ta = new M(Le);
1306
- async function ra(e, t) {
1307
- const { messages: r } = await ta.invoke(
1339
+ const ua = new P(_e);
1340
+ async function pa(e, t) {
1341
+ const { messages: r } = await ua.invoke(
1308
1342
  { messages: C(e.agentExecutionContext.messages) },
1309
1343
  t
1310
1344
  ), a = [], o = [];
1311
1345
  for (const c of r) {
1312
- const i = c.content;
1346
+ const s = c.content;
1313
1347
  let l;
1314
- typeof i != "string" && (l = {
1348
+ typeof s != "string" && (l = {
1315
1349
  tool: c.name ?? "unknown",
1316
1350
  layerName: "unknown",
1317
1351
  summary: "Query failed",
1318
- details: { error: "Skipping non-string tool output:", raw: i }
1352
+ details: { error: "Skipping non-string tool output:", raw: s }
1319
1353
  });
1320
1354
  try {
1321
- typeof i == "string" ? l = JSON.parse(i) : l = {
1355
+ typeof s == "string" ? l = JSON.parse(s) : l = {
1322
1356
  tool: c.name ?? "unknown",
1323
1357
  layerName: "unknown",
1324
1358
  summary: "Query failed",
1325
- details: { error: "Invalid tool output type", raw: i }
1359
+ details: { error: "Invalid tool output type", raw: s }
1326
1360
  };
1327
1361
  } catch {
1328
1362
  l = {
1329
1363
  tool: c.name ?? "unknown",
1330
1364
  layerName: "unknown",
1331
1365
  summary: "Query failed",
1332
- details: { error: i }
1366
+ details: { error: s }
1333
1367
  };
1334
1368
  }
1335
1369
  a.push(l), l.details && typeof l.details == "object" && "error" in l.details ? o.push(`- ${l.tool}: Error - ${String(l.details.error)}`) : o.push(`- ${l.layerName}: ${l.summary}`);
@@ -1341,13 +1375,13 @@ async function ra(e, t) {
1341
1375
  queryResponse: a
1342
1376
  };
1343
1377
  }
1344
- const aa = 10, oa = ["string", "small-integer", "integer"], na = async (e, t) => {
1378
+ const ma = 10, ha = ["string", "small-integer", "integer"], ga = async (e, t) => {
1345
1379
  let r = null, a = null;
1346
1380
  try {
1347
1381
  if (t.type !== "geometry" && t.type !== "oid" && t.type !== "global-id") {
1348
- r = await Ce({ layer: e, field: t.name });
1382
+ r = await qe({ layer: e, field: t.name });
1349
1383
  const o = t.domain?.type === "coded-value" ? t.domain : null;
1350
- (oa.includes(t.type) || o) && (a = (await Re({ layer: e, field: t.name })).uniqueValueInfos.sort((n, c) => c.count - n.count).slice(0, aa), o && (a = a.map((n) => ({
1384
+ (ha.includes(t.type) || o) && (a = (await Le({ layer: e, field: t.name })).uniqueValueInfos.sort((n, c) => c.count - n.count).slice(0, ma), o && (a = a.map((n) => ({
1351
1385
  ...n,
1352
1386
  value: o.getName(n.value) ?? n.value
1353
1387
  }))));
@@ -1360,57 +1394,57 @@ const aa = 10, oa = ["string", "small-integer", "integer"], na = async (e, t) =>
1360
1394
  uniqueValues: a
1361
1395
  };
1362
1396
  };
1363
- async function ia(e, t, r) {
1397
+ async function ya(e, t, r) {
1364
1398
  const a = [], o = [];
1365
1399
  for (const n of e) {
1366
- let c = function(h) {
1367
- const y = t.get(h)?.layerItem;
1400
+ let c = function(m) {
1401
+ const y = t.get(m)?.layerItem;
1368
1402
  return y ? [
1369
1403
  y.name && `Name: ${y.name}`,
1370
1404
  y.title && `Title: ${y.title}`,
1371
1405
  y.description && `Description: ${y.description}`
1372
- ].filter(Boolean).join(" | ") : h;
1406
+ ].filter(Boolean).join(" | ") : m;
1373
1407
  };
1374
- const { layerId: i, results: l } = n, d = r.map?.allLayers.find((h) => h.id === i), u = t.get(i)?.fieldRegistry;
1408
+ const { layerId: s, results: l } = n, d = r.map?.allLayers.find((m) => m.id === s), u = t.get(s)?.fieldRegistry;
1375
1409
  if (!u)
1376
1410
  continue;
1377
- let p = a.find((h) => h.layerId === i);
1411
+ let p = a.find((m) => m.layerId === s);
1378
1412
  p || (p = {
1379
- layerId: i,
1380
- layerSummary: c(i),
1413
+ layerId: s,
1414
+ layerSummary: c(s),
1381
1415
  fieldInfos: []
1382
1416
  }, a.push(p));
1383
- for (const h of l) {
1384
- const y = u.get(h.name);
1417
+ for (const m of l) {
1418
+ const y = u.get(m.name);
1385
1419
  if (!y)
1386
1420
  continue;
1387
1421
  if (!y.statistics) {
1388
- const m = na(d, y).then((f) => {
1422
+ const h = ga(d, y).then((f) => {
1389
1423
  u.set(y.name, { ...y, statistics: f }), y.statistics = f;
1390
1424
  });
1391
- o.push(m);
1425
+ o.push(h);
1392
1426
  }
1393
1427
  p.fieldInfos.push(y);
1394
1428
  }
1395
1429
  }
1396
1430
  return await Promise.all(o), a;
1397
1431
  }
1398
- const sa = async (e, t) => {
1432
+ const fa = async (e, t) => {
1399
1433
  try {
1400
1434
  await g({ text: "Getting statistics for vector search results" }, t);
1401
- const r = x(t, "layersAndFieldsRegistry"), { mapView: a } = I(t), o = await ia(e.vectorSearchFieldResults, r, a);
1435
+ const r = x(t, "layersAndFieldsRegistry"), { mapView: a } = A(t), o = await ya(e.vectorSearchFieldResults, r, a);
1402
1436
  return await g({ text: "Statistics retrieved" }, t), { ...e, layerFieldInfo: o };
1403
1437
  } catch (r) {
1404
1438
  throw await g({ text: "Error during fetching statistics" }, t), new Error(`Error during fetching statistics: ${r instanceof Error ? r.message : String(r)}`);
1405
1439
  }
1406
- }, we = 0.7, ca = 10, la = async (e, t) => {
1440
+ }, Te = 0.7, wa = 10, ba = async (e, t) => {
1407
1441
  try {
1408
1442
  await g({ text: "Similarity search to find fields" }, t);
1409
1443
  const r = x(t, "fieldSearch"), a = x(t, "layersAndFieldsRegistry"), o = x(t, "embeddingCache"), n = await r.searchFields({
1410
1444
  text: e.agentExecutionContext.assignedTask,
1411
1445
  layerIds: e.vectorSearchLayerIds,
1412
- minScore: we,
1413
- topResults: ca,
1446
+ minScore: Te,
1447
+ topResults: wa,
1414
1448
  embeddingCache: o
1415
1449
  }), c = n.map(({ layerId: l, results: d }) => {
1416
1450
  const u = d.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
@@ -1419,9 +1453,9 @@ const sa = async (e, t) => {
1419
1453
  ${u}`;
1420
1454
  }).join(`
1421
1455
  `);
1422
- let i;
1423
- return n.length > 0 ? i = `Vector search completed. Matching layers and fields with scores:
1424
- ${c}` : i = `No vector search results found for score over ${we}.`, await g({ text: i }, t), {
1456
+ let s;
1457
+ return n.length > 0 ? s = `Vector search completed. Matching layers and fields with scores:
1458
+ ${c}` : s = `No vector search results found for score over ${Te}.`, await g({ text: s }, t), {
1425
1459
  ...e,
1426
1460
  vectorSearchFieldResults: n
1427
1461
  };
@@ -1431,7 +1465,7 @@ ${c}` : i = `No vector search results found for score over ${we}.`, await g({ te
1431
1465
  t
1432
1466
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1433
1467
  }
1434
- }, da = 0.7, ua = async (e, t) => {
1468
+ }, xa = 0.7, Sa = async (e, t) => {
1435
1469
  try {
1436
1470
  await g(
1437
1471
  { text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
@@ -1439,13 +1473,13 @@ ${c}` : i = `No vector search results found for score over ${we}.`, await g({ te
1439
1473
  );
1440
1474
  const r = x(t, "layerSearch"), a = x(t, "layersAndFieldsRegistry"), o = x(t, "embeddingCache"), n = await r.searchLayers({
1441
1475
  text: e.agentExecutionContext.assignedTask,
1442
- minScore: da,
1476
+ minScore: xa,
1443
1477
  embeddingCache: o
1444
- }), c = n.map((d) => d.id), i = n.map(({ id: d, score: u }) => `${a.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1478
+ }), c = n.map((d) => d.id), s = n.map(({ id: d, score: u }) => `${a.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1445
1479
  `);
1446
1480
  let l;
1447
1481
  return c.length > 0 ? l = `Vector search completed. Matching layers with scores:
1448
- ${i}` : l = "Vector search completed. No matching layers found.", await g({ text: l }, t), {
1482
+ ${s}` : l = "Vector search completed. No matching layers found.", await g({ text: l }, t), {
1449
1483
  ...e,
1450
1484
  vectorSearchLayerIds: c
1451
1485
  };
@@ -1455,10 +1489,10 @@ ${i}` : l = "Vector search completed. No matching layers found.", await g({ text
1455
1489
  t
1456
1490
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1457
1491
  }
1458
- }, pa = (e, t) => Q(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
1492
+ }, va = (e, t) => Q(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
1459
1493
  e,
1460
1494
  t
1461
- ), ha = () => new V(Fe).addNode("requireDataExplorationServices", pa).addNode("vectorSearchLayers", ua).addNode("vectorSearchFields", la).addNode("fieldStatistics", sa).addNode("queryAgent", Yr).addNode("queryTools", ra).addNode("summarizeQueryResponseLLM", Xr).addNode("filterAgent", Jr).addNode("filterTools", ea).addNode("earlyExit", pr).addEdge(W, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1495
+ ), Ta = () => new V(Ae).addNode("requireDataExplorationServices", va).addNode("vectorSearchLayers", Sa).addNode("vectorSearchFields", ba).addNode("fieldStatistics", fa).addNode("queryAgent", ca).addNode("queryTools", pa).addNode("summarizeQueryResponseLLM", la).addNode("filterAgent", ia).addNode("filterTools", da).addNode("earlyExit", br).addEdge(W, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1462
1496
  "vectorSearchLayers",
1463
1497
  (t) => t.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
1464
1498
  ).addConditionalEdges(
@@ -1467,7 +1501,7 @@ ${i}` : l = "Vector search completed. No matching layers found.", await g({ text
1467
1501
  ).addEdge("fieldStatistics", "queryAgent").addConditionalEdges("queryAgent", (t) => (t.agentExecutionContext.messages[t.agentExecutionContext.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "queryTools" : "filterAgent").addConditionalEdges(
1468
1502
  "queryTools",
1469
1503
  (t) => t.queryResponse.length ? "summarizeQueryResponseLLM" : "filterAgent"
1470
- ).addEdge("summarizeQueryResponseLLM", "filterAgent").addConditionalEdges("filterAgent", (t) => (t.agentExecutionContext.messages[t.agentExecutionContext.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "filterTools" : F).addEdge("filterTools", F).addEdge("earlyExit", F), ma = 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).
1504
+ ).addEdge("summarizeQueryResponseLLM", "filterAgent").addConditionalEdges("filterAgent", (t) => (t.agentExecutionContext.messages[t.agentExecutionContext.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "filterTools" : q).addEdge("filterTools", q).addEdge("earlyExit", q), 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).
1471
1505
  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.
1472
1506
  _Example: “Only show stations where Brand is Shell”_
1473
1507
  _Example: “Make Shell stations stand out on the map”_
@@ -1475,20 +1509,20 @@ ${i}` : l = "Vector search completed. No matching layers found.", await g({ text
1475
1509
  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?”). However, this agent does not handle addresses.
1476
1510
  _Example: “How many features are there?”_
1477
1511
  _Example: “What’s the average population?”_
1478
- _Example: “Which values are in the status field?”_`, xi = {
1512
+ _Example: “Which values are in the status field?”_`, Ls = {
1479
1513
  id: "dataExploration",
1480
1514
  name: "Data Exploration Agent",
1481
- description: ma,
1482
- createGraph: ha,
1483
- workspace: Fe
1484
- }, be = 0.7, ga = 10, ya = async (e, t) => {
1515
+ description: Ea,
1516
+ createGraph: Ta,
1517
+ workspace: Ae
1518
+ }, Ee = 0.7, Ca = 10, Ra = async (e, t) => {
1485
1519
  try {
1486
1520
  await g({ text: "Similarity search to find fields" }, t);
1487
1521
  const r = x(t, "fieldSearch"), a = x(t, "layersAndFieldsRegistry"), o = x(t, "embeddingCache"), n = await r.searchFields({
1488
1522
  text: e.agentExecutionContext.assignedTask,
1489
1523
  layerIds: e.vectorSearchLayerIds,
1490
- minScore: be,
1491
- topResults: ga,
1524
+ minScore: Ee,
1525
+ topResults: Ca,
1492
1526
  embeddingCache: o
1493
1527
  }), c = n.map(({ layerId: l, results: d }) => {
1494
1528
  const u = d.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
@@ -1497,9 +1531,9 @@ ${i}` : l = "Vector search completed. No matching layers found.", await g({ text
1497
1531
  ${u}`;
1498
1532
  }).join(`
1499
1533
  `);
1500
- let i;
1501
- return n.length > 0 ? i = `Vector search completed. Matching layers and fields with scores:
1502
- ${c}` : i = `No vector search results found for score over ${be}.`, await g({ text: i }, t), {
1534
+ let s;
1535
+ return n.length > 0 ? s = `Vector search completed. Matching layers and fields with scores:
1536
+ ${c}` : s = `No vector search results found for score over ${Ee}.`, await g({ text: s }, t), {
1503
1537
  ...e,
1504
1538
  vectorSearchFieldResults: n
1505
1539
  };
@@ -1509,7 +1543,7 @@ ${c}` : i = `No vector search results found for score over ${be}.`, await g({ te
1509
1543
  t
1510
1544
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1511
1545
  }
1512
- }, fa = 0.7, wa = async (e, t) => {
1546
+ }, $a = 0.7, ka = async (e, t) => {
1513
1547
  try {
1514
1548
  await g(
1515
1549
  { text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
@@ -1517,12 +1551,12 @@ ${c}` : i = `No vector search results found for score over ${be}.`, await g({ te
1517
1551
  );
1518
1552
  const r = x(t, "layerSearch"), a = x(t, "layersAndFieldsRegistry"), o = await r.searchLayers({
1519
1553
  text: e.agentExecutionContext.assignedTask,
1520
- minScore: fa
1554
+ minScore: $a
1521
1555
  }), n = o.map((l) => l.id), c = o.map(({ id: l, score: d }) => `${a.get(l)?.layerItem.name ?? l} (${d.toFixed(2)})`).join(`
1522
1556
  `);
1523
- let i;
1524
- return n.length > 0 ? i = `Vector search completed. Matching layers with scores:
1525
- ${c}` : i = "Vector search completed. No matching layers found.", await g({ text: i }, t), {
1557
+ let s;
1558
+ return n.length > 0 ? s = `Vector search completed. Matching layers with scores:
1559
+ ${c}` : s = "Vector search completed. No matching layers found.", await g({ text: s }, t), {
1526
1560
  ...e,
1527
1561
  vectorSearchLayerIds: n
1528
1562
  };
@@ -1533,24 +1567,24 @@ ${c}` : i = "Vector search completed. No matching layers found.", await g({ text
1533
1567
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1534
1568
  }
1535
1569
  };
1536
- async function ba(e) {
1570
+ async function Fa(e) {
1537
1571
  const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
1538
1572
  let c;
1539
- return n ? c = et({
1540
- basemapTheme: await he(a),
1573
+ return n ? c = it({
1574
+ basemapTheme: await we(a),
1541
1575
  geometryType: r.geometryType,
1542
1576
  includedTags: n,
1543
1577
  numColors: Math.min(t.length, 8)
1544
- })[0] : c = tt({
1545
- basemapTheme: await he(a),
1578
+ })[0] : c = ct({
1579
+ basemapTheme: await we(a),
1546
1580
  geometryType: r.geometryType,
1547
1581
  numColors: Math.min(t.length, 8)
1548
1582
  }).primaryScheme, {
1549
1583
  layer: r,
1550
1584
  view: a,
1551
- attributes: t.map((i) => ({
1552
- field: i,
1553
- label: r.fields.find((l) => l.name === i)?.alias ?? ""
1585
+ attributes: t.map((s) => ({
1586
+ field: s,
1587
+ label: r.fields.find((l) => l.name === s)?.alias ?? ""
1554
1588
  })).slice(0, 8),
1555
1589
  outlineOptimizationEnabled: !0,
1556
1590
  sizeOptimizationEnabled: !0,
@@ -1558,10 +1592,10 @@ async function ba(e) {
1558
1592
  pieChartScheme: c
1559
1593
  };
1560
1594
  }
1561
- async function xa(e) {
1562
- return await Xe(e);
1595
+ async function qa(e) {
1596
+ return await st(e);
1563
1597
  }
1564
- async function Sa({
1598
+ async function La({
1565
1599
  arcgisMap: e,
1566
1600
  arcgisMapView: t,
1567
1601
  layerId: r,
@@ -1569,41 +1603,41 @@ async function Sa({
1569
1603
  colorSchemes: o,
1570
1604
  includeSize: n
1571
1605
  }) {
1572
- const c = t, i = e?.allLayers.find((u) => u.id === r);
1573
- if (!i)
1606
+ const c = t, s = e?.allLayers.find((u) => u.id === r);
1607
+ if (!s)
1574
1608
  return `Could not find layer for id: ${r}`;
1575
1609
  const d = {
1576
1610
  styleName: n ? "chart-size" : "chart",
1577
1611
  fields: a,
1578
- layer: i,
1612
+ layer: s,
1579
1613
  view: c,
1580
1614
  colorSchemeTags: o
1581
1615
  };
1582
1616
  try {
1583
- const u = await ba(d), p = await xa(u);
1584
- return i.renderer = p.renderer, i.visible = !0, `Chart renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1617
+ const u = await Fa(d), p = await qa(u);
1618
+ return s.renderer = p.renderer, s.visible = !0, `Chart renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
1585
1619
  } catch (u) {
1586
1620
  return `Error applying chart renderer: ${u instanceof Error ? u.message : String(u)}`;
1587
1621
  }
1588
1622
  }
1589
- const va = ["mapView"];
1590
- function k(e) {
1623
+ const Ia = ["mapView"];
1624
+ function F(e) {
1591
1625
  const r = e?.configurable?.context;
1592
1626
  if (!r || typeof r != "object")
1593
1627
  throw new Error("LayerStylingAgent context missing");
1594
- const a = va.filter((o) => !(o in r));
1628
+ const a = Ia.filter((o) => !(o in r));
1595
1629
  if (a.length)
1596
1630
  throw new Error(`LayerStylingAgent context missing: ${a.join(", ")}`);
1597
1631
  return r;
1598
1632
  }
1599
- async function Ta({
1633
+ async function Na({
1600
1634
  layerId: e,
1601
1635
  fields: t,
1602
1636
  colorSchemes: r,
1603
1637
  includeSize: a
1604
1638
  }, o) {
1605
- const { mapView: n } = k(o);
1606
- return await R({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Sa({
1639
+ const { mapView: n } = F(o);
1640
+ return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await La({
1607
1641
  arcgisMap: n.map,
1608
1642
  arcgisMapView: n,
1609
1643
  layerId: e,
@@ -1612,12 +1646,12 @@ async function Ta({
1612
1646
  includeSize: a
1613
1647
  });
1614
1648
  }
1615
- const Ea = s.object({
1616
- layerId: s.string().describe("The id of the layer to apply the chart renderer to"),
1617
- fields: s.array(s.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
1618
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1619
- includeSize: s.boolean().optional().describe("Whether to vary the chart size (chart-size)")
1620
- }), Ca = b(Ta, {
1649
+ const Aa = i.object({
1650
+ layerId: i.string().describe("The id of the layer to apply the chart renderer to"),
1651
+ fields: i.array(i.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
1652
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1653
+ includeSize: i.boolean().optional().describe("Whether to vary the chart size (chart-size)")
1654
+ }), za = b(Na, {
1621
1655
  name: "chart",
1622
1656
  description: `Label: Charts
1623
1657
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
@@ -1630,12 +1664,12 @@ const Ea = s.object({
1630
1664
  Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
1631
1665
  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.
1632
1666
  Fields: This style requires 2-8 number fields.`,
1633
- schema: Ea
1667
+ schema: Aa
1634
1668
  });
1635
- function Ra(e) {
1669
+ function _a(e) {
1636
1670
  const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: n } = e, c = t[0];
1637
- let i;
1638
- return n && (i = oe({
1671
+ let s;
1672
+ return n && (s = ce({
1639
1673
  geometryType: r.geometryType,
1640
1674
  includedTags: n,
1641
1675
  theme: o || "high-to-low"
@@ -1647,13 +1681,13 @@ function Ra(e) {
1647
1681
  theme: o,
1648
1682
  sizeOptimizationEnabled: !0,
1649
1683
  outlineOptimizationEnabled: !0,
1650
- colorScheme: i
1684
+ colorScheme: s
1651
1685
  };
1652
1686
  }
1653
- async function $a(e) {
1654
- return await rt(e);
1687
+ async function ja(e) {
1688
+ return await lt(e);
1655
1689
  }
1656
- async function ka({
1690
+ async function Da({
1657
1691
  arcgisMap: e,
1658
1692
  arcgisMapView: t,
1659
1693
  layerId: r,
@@ -1661,32 +1695,32 @@ async function ka({
1661
1695
  colorSchemes: o,
1662
1696
  theme: n
1663
1697
  }) {
1664
- const c = t, i = e?.allLayers.find((d) => d.id === r);
1665
- if (!i)
1698
+ const c = t, s = e?.allLayers.find((d) => d.id === r);
1699
+ if (!s)
1666
1700
  return `Could not find layer for id: ${r}`;
1667
1701
  const l = {
1668
1702
  styleName: "color-age",
1669
1703
  fields: a,
1670
- layer: i,
1704
+ layer: s,
1671
1705
  view: c,
1672
1706
  colorSchemeTags: o,
1673
1707
  theme: n
1674
1708
  };
1675
1709
  try {
1676
- const d = Ra(l), u = await $a(d);
1677
- return i.renderer = u.renderer, i.visible = !0, `Color-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1710
+ const d = _a(l), u = await ja(d);
1711
+ return s.renderer = u.renderer, s.visible = !0, `Color-age renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
1678
1712
  } catch (d) {
1679
1713
  return `Error applying color-age renderer: ${d instanceof Error ? d.message : String(d)}`;
1680
1714
  }
1681
1715
  }
1682
- async function Fa({
1716
+ async function Pa({
1683
1717
  layerId: e,
1684
1718
  fields: t,
1685
1719
  colorSchemes: r,
1686
1720
  theme: a
1687
1721
  }, o) {
1688
- const { mapView: n } = k(o);
1689
- return await R({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await ka({
1722
+ const { mapView: n } = F(o);
1723
+ return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await Da({
1690
1724
  arcgisMap: n.map,
1691
1725
  arcgisMapView: n,
1692
1726
  layerId: e,
@@ -1695,33 +1729,33 @@ async function Fa({
1695
1729
  theme: a
1696
1730
  });
1697
1731
  }
1698
- const La = s.object({
1699
- layerId: s.string().describe("The id of the layer to apply the color-age renderer to"),
1700
- fields: s.array(s.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
1701
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1702
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
1703
- }), qa = b(Fa, {
1732
+ const Ma = i.object({
1733
+ layerId: i.string().describe("The id of the layer to apply the color-age renderer to"),
1734
+ fields: i.array(i.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
1735
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1736
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
1737
+ }), Oa = b(Pa, {
1704
1738
  name: "color-age",
1705
1739
  description: `Label: Age (color)
1706
1740
  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.
1707
1741
  Keywords: since, age, how old, how long
1708
1742
  Example: Show the age of each feature based on its reported date.
1709
1743
  Fields: This style requires at least one field with a date type.`,
1710
- schema: La
1744
+ schema: Ma
1711
1745
  });
1712
- function Ia(e) {
1746
+ function Ga(e) {
1713
1747
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
1714
1748
  let { theme: n } = e, c = t[1];
1715
- const i = t[0];
1749
+ const s = t[0];
1716
1750
  let l;
1717
- return o && (l = oe({
1751
+ return o && (l = ce({
1718
1752
  geometryType: r.geometryType,
1719
1753
  includedTags: o,
1720
1754
  theme: n || "high-to-low"
1721
1755
  })[0]), {
1722
1756
  layer: r,
1723
1757
  view: a,
1724
- field: i,
1758
+ field: s,
1725
1759
  normalizationField: c,
1726
1760
  theme: n,
1727
1761
  sizeOptimizationEnabled: !0,
@@ -1729,10 +1763,10 @@ function Ia(e) {
1729
1763
  colorScheme: l
1730
1764
  };
1731
1765
  }
1732
- async function Aa(e) {
1733
- return await at(e);
1766
+ async function Va(e) {
1767
+ return await dt(e);
1734
1768
  }
1735
- async function Na({
1769
+ async function Wa({
1736
1770
  arcgisMap: e,
1737
1771
  arcgisMapView: t,
1738
1772
  layerId: r,
@@ -1740,32 +1774,32 @@ async function Na({
1740
1774
  colorSchemes: o,
1741
1775
  theme: n
1742
1776
  }) {
1743
- const c = t, i = e?.allLayers.find((d) => d.id === r);
1744
- if (!i)
1777
+ const c = t, s = e?.allLayers.find((d) => d.id === r);
1778
+ if (!s)
1745
1779
  return `Could not find layer for id: ${r}`;
1746
1780
  const l = {
1747
1781
  styleName: "color",
1748
1782
  fields: a,
1749
- layer: i,
1783
+ layer: s,
1750
1784
  view: c,
1751
1785
  colorSchemeTags: o,
1752
1786
  theme: n
1753
1787
  };
1754
1788
  try {
1755
- const d = Ia(l), u = await Aa(d);
1756
- return i.renderer = u.renderer, i.visible = !0, `Color renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1789
+ const d = Ga(l), u = await Va(d);
1790
+ return s.renderer = u.renderer, s.visible = !0, `Color renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
1757
1791
  } catch (d) {
1758
1792
  return `Error applying color renderer: ${d instanceof Error ? d.message : String(d)}`;
1759
1793
  }
1760
1794
  }
1761
- async function za({
1795
+ async function Ka({
1762
1796
  layerId: e,
1763
1797
  fields: t,
1764
1798
  colorSchemes: r,
1765
1799
  theme: a
1766
1800
  }, o) {
1767
- const { mapView: n } = k(o);
1768
- return await R({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Na({
1801
+ const { mapView: n } = F(o);
1802
+ return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await Wa({
1769
1803
  arcgisMap: n.map,
1770
1804
  arcgisMapView: n,
1771
1805
  layerId: e,
@@ -1774,25 +1808,25 @@ async function za({
1774
1808
  theme: a
1775
1809
  });
1776
1810
  }
1777
- const _a = s.object({
1778
- layerId: s.string().describe("The id of the layer to apply the color renderer to"),
1779
- fields: s.array(s.string()).describe("The field(s) to use for the color renderer"),
1780
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1781
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
1782
- }), ja = b(za, {
1811
+ const Ba = i.object({
1812
+ layerId: i.string().describe("The id of the layer to apply the color renderer to"),
1813
+ fields: i.array(i.string()).describe("The field(s) to use for the color renderer"),
1814
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1815
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
1816
+ }), Qa = b(Ka, {
1783
1817
  name: "color",
1784
1818
  description: `Label: Counts and Amounts (color)
1785
1819
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
1786
1820
  Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
1787
1821
  Example: Color each feature based on the population density.
1788
1822
  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.`,
1789
- schema: _a
1823
+ schema: Ba
1790
1824
  });
1791
- function Ma(e) {
1825
+ function Ua(e) {
1792
1826
  const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: n } = e;
1793
- let c, i;
1827
+ let c, s;
1794
1828
  const l = t[0];
1795
- return o && (i = oe({
1829
+ return o && (s = ce({
1796
1830
  geometryType: r.geometryType,
1797
1831
  includedTags: o,
1798
1832
  theme: n || "high-to-low"
@@ -1803,14 +1837,14 @@ function Ma(e) {
1803
1837
  normalizationField: c,
1804
1838
  theme: n,
1805
1839
  colorOptions: {
1806
- colorScheme: i
1840
+ colorScheme: s
1807
1841
  }
1808
1842
  };
1809
1843
  }
1810
- async function Pa(e) {
1811
- return await ot(e);
1844
+ async function Ha(e) {
1845
+ return await ut(e);
1812
1846
  }
1813
- async function Da({
1847
+ async function Za({
1814
1848
  arcgisMap: e,
1815
1849
  arcgisMapView: t,
1816
1850
  layerId: r,
@@ -1818,32 +1852,32 @@ async function Da({
1818
1852
  colorSchemes: o,
1819
1853
  theme: n
1820
1854
  }) {
1821
- const c = t, i = e?.allLayers.find((d) => d.id === r);
1822
- if (!i)
1855
+ const c = t, s = e?.allLayers.find((d) => d.id === r);
1856
+ if (!s)
1823
1857
  return `Could not find layer for id: ${r}`;
1824
1858
  const l = {
1825
1859
  styleName: "color-size-univariate",
1826
1860
  fields: a,
1827
- layer: i,
1861
+ layer: s,
1828
1862
  view: c,
1829
1863
  colorSchemeTags: o,
1830
1864
  theme: n
1831
1865
  };
1832
1866
  try {
1833
- const d = Ma(l), u = await Pa(d);
1834
- return i.renderer = u.renderer, i.visible = !0, `Color-size-univariate renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1867
+ const d = Ua(l), u = await Ha(d);
1868
+ return s.renderer = u.renderer, s.visible = !0, `Color-size-univariate renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
1835
1869
  } catch (d) {
1836
1870
  return `Error applying color-size-univariate renderer: ${d instanceof Error ? d.message : String(d)}`;
1837
1871
  }
1838
1872
  }
1839
- async function Oa({
1873
+ async function Ja({
1840
1874
  layerId: e,
1841
1875
  fields: t,
1842
1876
  colorSchemes: r,
1843
1877
  theme: a
1844
1878
  }, o) {
1845
- const { mapView: n } = k(o);
1846
- return await R({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Da({
1879
+ const { mapView: n } = F(o);
1880
+ return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await Za({
1847
1881
  arcgisMap: n.map,
1848
1882
  arcgisMapView: n,
1849
1883
  layerId: e,
@@ -1852,24 +1886,24 @@ async function Oa({
1852
1886
  theme: a
1853
1887
  });
1854
1888
  }
1855
- const Ga = s.object({
1856
- layerId: s.string().describe("The id of the layer to apply the color-size univariate renderer to"),
1857
- fields: s.array(s.string()).describe("The fields to use for the color-size univariate renderer"),
1858
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1859
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
1860
- }), Va = b(Oa, {
1889
+ const Ya = i.object({
1890
+ layerId: i.string().describe("The id of the layer to apply the color-size univariate renderer to"),
1891
+ fields: i.array(i.string()).describe("The fields to use for the color-size univariate renderer"),
1892
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1893
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
1894
+ }), Xa = b(Ja, {
1861
1895
  name: "color-size-univariate",
1862
1896
  description: `Label: Color and Size (univariate)
1863
1897
  Description: Vary symbol size and color based on the values of two numeric attributes.
1864
1898
  Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
1865
1899
  Example: Color each feature based on the percentage of the population that owns a home and vary the size of each point based on total population.
1866
1900
  Fields: This style requires at least two fields: one determining the color of each feature, the other determining the size of each feature. Each field may be normalized by an additional normalization field.`,
1867
- schema: Ga
1901
+ schema: Ya
1868
1902
  });
1869
- function Wa(e) {
1903
+ function eo(e) {
1870
1904
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
1871
1905
  let n;
1872
- return o && (n = it({
1906
+ return o && (n = mt({
1873
1907
  includedTags: o,
1874
1908
  numColors: Math.min(t.length, 8)
1875
1909
  })[0]), {
@@ -1880,16 +1914,16 @@ function Wa(e) {
1880
1914
  },
1881
1915
  attributes: t.map((c) => ({
1882
1916
  field: c,
1883
- label: r.fields.find((i) => i.name === c)?.alias ?? ""
1917
+ label: r.fields.find((s) => s.name === c)?.alias ?? ""
1884
1918
  })).slice(0, 8),
1885
1919
  outlineOptimizationEnabled: !0,
1886
1920
  dotDensityScheme: n
1887
1921
  };
1888
1922
  }
1889
- async function Ka(e) {
1890
- return await nt(e);
1923
+ async function to(e) {
1924
+ return await pt(e);
1891
1925
  }
1892
- async function Ba({
1926
+ async function ro({
1893
1927
  arcgisMap: e,
1894
1928
  arcgisMapView: t,
1895
1929
  layerId: r,
@@ -1899,7 +1933,7 @@ async function Ba({
1899
1933
  const n = t, c = e?.allLayers.find((l) => l.id === r);
1900
1934
  if (!c)
1901
1935
  return `Could not find layer for id: ${r}`;
1902
- const i = {
1936
+ const s = {
1903
1937
  styleName: "dot-density",
1904
1938
  fields: a,
1905
1939
  layer: c,
@@ -1907,19 +1941,19 @@ async function Ba({
1907
1941
  colorSchemeTags: o
1908
1942
  };
1909
1943
  try {
1910
- const l = Wa(i), d = await Ka(l);
1944
+ const l = eo(s), d = await to(l);
1911
1945
  return c.renderer = d.renderer, c.visible = !0, `Dot Density renderer applied to layer: ${c.title ?? c.id} using fields ${a.join(", ")}`;
1912
1946
  } catch (l) {
1913
1947
  return `Error applying dot density renderer: ${l instanceof Error ? l.message : String(l)}`;
1914
1948
  }
1915
1949
  }
1916
- async function Qa({
1950
+ async function ao({
1917
1951
  layerId: e,
1918
1952
  fields: t,
1919
1953
  colorSchemes: r
1920
1954
  }, a) {
1921
- const { mapView: o } = k(a);
1922
- return await R({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await Ba({
1955
+ const { mapView: o } = F(a);
1956
+ return await $({ type: "show-legend", data: { layerIds: [e] } }, a), await ro({
1923
1957
  arcgisMap: o.map,
1924
1958
  arcgisMapView: o,
1925
1959
  layerId: e,
@@ -1927,11 +1961,11 @@ async function Qa({
1927
1961
  colorSchemes: r
1928
1962
  });
1929
1963
  }
1930
- const Ua = s.object({
1931
- layerId: s.string().describe("The id of the layer to apply the dot density renderer to"),
1932
- fields: s.array(s.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
1933
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
1934
- }), Ha = b(Qa, {
1964
+ const oo = i.object({
1965
+ layerId: i.string().describe("The id of the layer to apply the dot density renderer to"),
1966
+ fields: i.array(i.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
1967
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
1968
+ }), no = b(ao, {
1935
1969
  name: "dot-density",
1936
1970
  description: `Dot Density
1937
1971
  Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
@@ -1945,13 +1979,13 @@ const Ua = s.object({
1945
1979
  - Display demographic patterns within census tracts
1946
1980
  **Fields:** Requires 2-8 number fields.
1947
1981
  **Keywords:** density, how much, how many, total, number, amount`,
1948
- schema: Ua
1982
+ schema: oo
1949
1983
  });
1950
- function Za(e) {
1984
+ function so(e) {
1951
1985
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
1952
1986
  let n;
1953
1987
  const c = t[0];
1954
- return o && (n = ct({
1988
+ return o && (n = gt({
1955
1989
  includedTags: o,
1956
1990
  basemap: a.map?.basemap || "topo"
1957
1991
  })[0]), {
@@ -1961,10 +1995,10 @@ function Za(e) {
1961
1995
  heatmapScheme: n
1962
1996
  };
1963
1997
  }
1964
- async function Ja(e) {
1965
- return await st(e);
1998
+ async function io(e) {
1999
+ return await ht(e);
1966
2000
  }
1967
- async function Ya({
2001
+ async function co({
1968
2002
  arcgisMap: e,
1969
2003
  arcgisMapView: t,
1970
2004
  layerId: r,
@@ -1974,7 +2008,7 @@ async function Ya({
1974
2008
  const n = t, c = e?.allLayers.find((l) => l.id === r);
1975
2009
  if (!c)
1976
2010
  return `Could not find layer for id: ${r}`;
1977
- const i = {
2011
+ const s = {
1978
2012
  styleName: "heatmap",
1979
2013
  fields: a,
1980
2014
  layer: c,
@@ -1982,19 +2016,19 @@ async function Ya({
1982
2016
  colorSchemeTags: o
1983
2017
  };
1984
2018
  try {
1985
- const l = Za(i), d = await Ja(l);
2019
+ const l = so(s), d = await io(l);
1986
2020
  return c.renderer = d.renderer, c.visible = !0, `Heatmap renderer applied to layer: ${c.title ?? c.id} using fields ${a.join(", ")}`;
1987
2021
  } catch (l) {
1988
2022
  return `Error applying heatmap renderer: ${l instanceof Error ? l.message : String(l)}`;
1989
2023
  }
1990
2024
  }
1991
- async function Xa({
2025
+ async function lo({
1992
2026
  layerId: e,
1993
2027
  fields: t,
1994
2028
  colorSchemes: r
1995
2029
  }, a) {
1996
- const { mapView: o } = k(a);
1997
- return await R({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await Ya({
2030
+ const { mapView: o } = F(a);
2031
+ return await $({ type: "show-legend", data: { layerIds: [e] } }, a), await co({
1998
2032
  arcgisMap: o.map,
1999
2033
  arcgisMapView: o,
2000
2034
  layerId: e,
@@ -2002,40 +2036,40 @@ async function Xa({
2002
2036
  colorSchemes: r
2003
2037
  });
2004
2038
  }
2005
- const eo = s.object({
2006
- layerId: s.string().describe("The id of the layer to apply the heatmap renderer to"),
2007
- fields: s.array(s.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
2008
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
2009
- }), to = b(Xa, {
2039
+ const uo = i.object({
2040
+ layerId: i.string().describe("The id of the layer to apply the heatmap renderer to"),
2041
+ fields: i.array(i.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
2042
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
2043
+ }), po = b(lo, {
2010
2044
  name: "heatmap",
2011
2045
  description: `Label: Heat Map
2012
2046
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
2013
2047
  Keywords: density, heatmap, hot spots, pattern, cluster
2014
2048
  Example: Create a heatmap
2015
2049
  Fields: This typically requires zero or one field of type number.`,
2016
- schema: eo
2050
+ schema: uo
2017
2051
  });
2018
- function ro(e) {
2052
+ function mo(e) {
2019
2053
  const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
2020
2054
  let c;
2021
- return n && (c = dt({
2055
+ return n && (c = ft({
2022
2056
  geometryType: r.geometryType,
2023
2057
  includedTags: n,
2024
2058
  numColors: Math.min(t.length, 10)
2025
2059
  })[0]), {
2026
2060
  layer: r,
2027
2061
  view: a,
2028
- fields: t.map((i) => ({ name: i })).slice(0, 9),
2062
+ fields: t.map((s) => ({ name: s })).slice(0, 9),
2029
2063
  outlineOptimizationEnabled: !0,
2030
2064
  sizeOptimizationEnabled: !0,
2031
2065
  includeSizeVariable: o.includes("Size"),
2032
2066
  predominanceScheme: c
2033
2067
  };
2034
2068
  }
2035
- async function ao(e) {
2036
- return await lt(e);
2069
+ async function ho(e) {
2070
+ return await yt(e);
2037
2071
  }
2038
- async function oo({
2072
+ async function go({
2039
2073
  arcgisMap: e,
2040
2074
  arcgisMapView: t,
2041
2075
  layerId: r,
@@ -2043,31 +2077,31 @@ async function oo({
2043
2077
  colorSchemes: o,
2044
2078
  includeSize: n
2045
2079
  }) {
2046
- const c = t, i = e?.allLayers.find((u) => u.id === r);
2047
- if (!i)
2080
+ const c = t, s = e?.allLayers.find((u) => u.id === r);
2081
+ if (!s)
2048
2082
  return `Could not find layer for id: ${r}`;
2049
2083
  const d = {
2050
2084
  styleName: n ? "predominance-size" : "predominance",
2051
2085
  fields: a,
2052
- layer: i,
2086
+ layer: s,
2053
2087
  view: c,
2054
2088
  colorSchemeTags: o
2055
2089
  };
2056
2090
  try {
2057
- const u = ro(d), p = await ao(u);
2058
- return i.renderer = p.renderer, i.visible = !0, `Predominance renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2091
+ const u = mo(d), p = await ho(u);
2092
+ return s.renderer = p.renderer, s.visible = !0, `Predominance renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
2059
2093
  } catch (u) {
2060
2094
  return `Error applying predominance renderer: ${u instanceof Error ? u.message : String(u)}`;
2061
2095
  }
2062
2096
  }
2063
- async function no({
2097
+ async function yo({
2064
2098
  layerId: e,
2065
2099
  fields: t,
2066
2100
  colorSchemes: r,
2067
2101
  includeSize: a
2068
2102
  }, o) {
2069
- const { mapView: n } = k(o);
2070
- return await R({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await oo({
2103
+ const { mapView: n } = F(o);
2104
+ return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await go({
2071
2105
  arcgisMap: n.map,
2072
2106
  arcgisMapView: n,
2073
2107
  layerId: e,
@@ -2076,12 +2110,12 @@ async function no({
2076
2110
  includeSize: a
2077
2111
  });
2078
2112
  }
2079
- const io = s.object({
2080
- layerId: s.string().describe("The id of the layer to apply the predominance renderer to"),
2081
- fields: s.array(s.string()).describe("The fields to use for the predominance renderer (competing categories)"),
2082
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
2083
- includeSize: s.boolean().optional().describe("Whether to include size visualization (predominance-size)")
2084
- }), so = b(no, {
2113
+ const fo = i.object({
2114
+ layerId: i.string().describe("The id of the layer to apply the predominance renderer to"),
2115
+ fields: i.array(i.string()).describe("The fields to use for the predominance renderer (competing categories)"),
2116
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
2117
+ includeSize: i.boolean().optional().describe("Whether to include size visualization (predominance-size)")
2118
+ }), wo = b(yo, {
2085
2119
  name: "predominance",
2086
2120
  description: `Label: Predominant category
2087
2121
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
@@ -2094,33 +2128,33 @@ const io = s.object({
2094
2128
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
2095
2129
  Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
2096
2130
  Fields: This style relies on 2-10 number fields.`,
2097
- schema: io
2131
+ schema: fo
2098
2132
  });
2099
- function co(e) {
2133
+ function bo(e) {
2100
2134
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
2101
2135
  let n;
2102
2136
  const c = {
2103
2137
  field: t[0]
2104
- }, i = {
2138
+ }, s = {
2105
2139
  field: t[1]
2106
2140
  };
2107
- return o && (n = pt({
2141
+ return o && (n = bt({
2108
2142
  geometryType: r.geometryType,
2109
2143
  includedTags: o
2110
2144
  })[0]), {
2111
2145
  layer: r,
2112
2146
  view: a,
2113
2147
  field1: c,
2114
- field2: i,
2148
+ field2: s,
2115
2149
  outlineOptimizationEnabled: !0,
2116
2150
  sizeOptimizationEnabled: !0,
2117
2151
  relationshipScheme: n
2118
2152
  };
2119
2153
  }
2120
- async function lo(e) {
2121
- return await ut(e);
2154
+ async function xo(e) {
2155
+ return await wt(e);
2122
2156
  }
2123
- async function uo({
2157
+ async function So({
2124
2158
  arcgisMap: e,
2125
2159
  arcgisMapView: t,
2126
2160
  layerId: r,
@@ -2130,7 +2164,7 @@ async function uo({
2130
2164
  const n = t, c = e?.allLayers.find((l) => l.id === r);
2131
2165
  if (!c)
2132
2166
  return `Could not find layer for id: ${r}`;
2133
- const i = {
2167
+ const s = {
2134
2168
  styleName: "relationship",
2135
2169
  fields: a,
2136
2170
  layer: c,
@@ -2138,19 +2172,19 @@ async function uo({
2138
2172
  colorSchemeTags: o
2139
2173
  };
2140
2174
  try {
2141
- const l = co(i), d = await lo(l);
2175
+ const l = bo(s), d = await xo(l);
2142
2176
  return c.renderer = d.renderer, c.visible = !0, `Relationship renderer applied to layer: ${c.title ?? c.id} using fields ${a.join(", ")}`;
2143
2177
  } catch (l) {
2144
2178
  return `Error applying relationship renderer: ${l instanceof Error ? l.message : String(l)}`;
2145
2179
  }
2146
2180
  }
2147
- async function po({
2181
+ async function vo({
2148
2182
  layerId: e,
2149
2183
  fields: t,
2150
2184
  colorSchemes: r
2151
2185
  }, a) {
2152
- const { mapView: o } = k(a);
2153
- return await R({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await uo({
2186
+ const { mapView: o } = F(a);
2187
+ return await $({ type: "show-legend", data: { layerIds: [e] } }, a), await So({
2154
2188
  arcgisMap: o.map,
2155
2189
  arcgisMapView: o,
2156
2190
  layerId: e,
@@ -2158,20 +2192,20 @@ async function po({
2158
2192
  colorSchemes: r
2159
2193
  });
2160
2194
  }
2161
- const ho = s.object({
2162
- layerId: s.string().describe("The id of the layer to apply the relationship renderer to"),
2163
- fields: s.array(s.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
2164
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
2165
- }), mo = b(po, {
2195
+ const To = i.object({
2196
+ layerId: i.string().describe("The id of the layer to apply the relationship renderer to"),
2197
+ fields: i.array(i.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
2198
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
2199
+ }), Eo = b(vo, {
2166
2200
  name: "relationship",
2167
2201
  description: `Label: Relationship
2168
2202
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
2169
2203
  Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
2170
2204
  Example: Show the relationship between tree height and carbon storage
2171
2205
  Fields: This style requires two number fields.`,
2172
- schema: ho
2206
+ schema: To
2173
2207
  });
2174
- function go(e) {
2208
+ function Co(e) {
2175
2209
  const { fields: t, layer: r, view: a, theme: o } = e, n = t[0];
2176
2210
  return {
2177
2211
  layer: r,
@@ -2183,10 +2217,10 @@ function go(e) {
2183
2217
  outlineOptimizationEnabled: !0
2184
2218
  };
2185
2219
  }
2186
- async function yo(e) {
2187
- return await ht(e);
2220
+ async function Ro(e) {
2221
+ return await xt(e);
2188
2222
  }
2189
- async function fo({
2223
+ async function $o({
2190
2224
  arcgisMap: e,
2191
2225
  arcgisMapView: t,
2192
2226
  layerId: r,
@@ -2194,32 +2228,32 @@ async function fo({
2194
2228
  colorSchemes: o,
2195
2229
  theme: n
2196
2230
  }) {
2197
- const c = t, i = e?.allLayers.find((d) => d.id === r);
2198
- if (!i)
2231
+ const c = t, s = e?.allLayers.find((d) => d.id === r);
2232
+ if (!s)
2199
2233
  return `Could not find layer for id: ${r}`;
2200
2234
  const l = {
2201
2235
  styleName: "size-age",
2202
2236
  fields: a,
2203
- layer: i,
2237
+ layer: s,
2204
2238
  view: c,
2205
2239
  colorSchemeTags: o,
2206
2240
  theme: n
2207
2241
  };
2208
2242
  try {
2209
- const d = go(l), u = await yo(d);
2210
- return i.renderer = u.renderer, i.visible = !0, `Size-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2243
+ const d = Co(l), u = await Ro(d);
2244
+ return s.renderer = u.renderer, s.visible = !0, `Size-age renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
2211
2245
  } catch (d) {
2212
2246
  return `Error applying size-age renderer: ${d instanceof Error ? d.message : String(d)}`;
2213
2247
  }
2214
2248
  }
2215
- async function wo({
2249
+ async function ko({
2216
2250
  layerId: e,
2217
2251
  fields: t,
2218
2252
  colorSchemes: r,
2219
2253
  theme: a
2220
2254
  }, o) {
2221
- const { mapView: n } = k(o);
2222
- return await R({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await fo({
2255
+ const { mapView: n } = F(o);
2256
+ return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await $o({
2223
2257
  arcgisMap: n.map,
2224
2258
  arcgisMapView: n,
2225
2259
  layerId: e,
@@ -2228,21 +2262,21 @@ async function wo({
2228
2262
  theme: a
2229
2263
  });
2230
2264
  }
2231
- const bo = s.object({
2232
- layerId: s.string().describe("The id of the layer to apply the size-age renderer to"),
2233
- fields: s.array(s.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
2234
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
2235
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2236
- }), xo = b(wo, {
2265
+ const Fo = i.object({
2266
+ layerId: i.string().describe("The id of the layer to apply the size-age renderer to"),
2267
+ fields: i.array(i.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
2268
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
2269
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2270
+ }), qo = b(ko, {
2237
2271
  name: "size-age",
2238
2272
  description: `Label: Age (size)
2239
2273
  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.
2240
2274
  Keywords: since, age, how old, how long
2241
2275
  Example: Change the size of features so older features are larger than new features.
2242
2276
  Fields: This style requires at least one field with a date type.`,
2243
- schema: bo
2277
+ schema: Fo
2244
2278
  });
2245
- function So(e) {
2279
+ function Lo(e) {
2246
2280
  const { fields: t, layer: r, view: a } = e;
2247
2281
  let { theme: o } = e, n = t[1];
2248
2282
  const c = t[0];
@@ -2256,10 +2290,10 @@ function So(e) {
2256
2290
  outlineOptimizationEnabled: !0
2257
2291
  };
2258
2292
  }
2259
- async function vo(e) {
2260
- return await mt(e);
2293
+ async function Io(e) {
2294
+ return await St(e);
2261
2295
  }
2262
- async function To({
2296
+ async function No({
2263
2297
  arcgisMap: e,
2264
2298
  arcgisMapView: t,
2265
2299
  layerId: r,
@@ -2267,32 +2301,32 @@ async function To({
2267
2301
  colorSchemes: o,
2268
2302
  theme: n
2269
2303
  }) {
2270
- const c = t, i = e?.allLayers.find((d) => d.id === r);
2271
- if (!i)
2304
+ const c = t, s = e?.allLayers.find((d) => d.id === r);
2305
+ if (!s)
2272
2306
  return `Could not find layer for id: ${r}`;
2273
2307
  const l = {
2274
2308
  styleName: "size",
2275
2309
  fields: a,
2276
- layer: i,
2310
+ layer: s,
2277
2311
  view: c,
2278
2312
  colorSchemeTags: o,
2279
2313
  theme: n
2280
2314
  };
2281
2315
  try {
2282
- const d = So(l), u = await vo(d);
2283
- return i.renderer = u.renderer, i.visible = !0, `Size renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2316
+ const d = Lo(l), u = await Io(d);
2317
+ return s.renderer = u.renderer, s.visible = !0, `Size renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
2284
2318
  } catch (d) {
2285
2319
  return `Error applying size renderer: ${d instanceof Error ? d.message : String(d)}`;
2286
2320
  }
2287
2321
  }
2288
- async function Eo({
2322
+ async function Ao({
2289
2323
  layerId: e,
2290
2324
  fields: t,
2291
2325
  colorSchemes: r,
2292
2326
  theme: a
2293
2327
  }, o) {
2294
- const { mapView: n } = k(o);
2295
- return await R({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await To({
2328
+ const { mapView: n } = F(o);
2329
+ return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await No({
2296
2330
  arcgisMap: n.map,
2297
2331
  arcgisMapView: n,
2298
2332
  layerId: e,
@@ -2301,12 +2335,12 @@ async function Eo({
2301
2335
  theme: a
2302
2336
  });
2303
2337
  }
2304
- const Co = s.object({
2305
- layerId: s.string().describe("The id of the layer to apply the size renderer to"),
2306
- fields: s.array(s.string()).describe("The field(s) to use for the size renderer (numeric data)"),
2307
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
2308
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2309
- }), Ro = b(Eo, {
2338
+ const zo = i.object({
2339
+ layerId: i.string().describe("The id of the layer to apply the size renderer to"),
2340
+ fields: i.array(i.string()).describe("The field(s) to use for the size renderer (numeric data)"),
2341
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
2342
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2343
+ }), _o = b(Ao, {
2310
2344
  name: "size",
2311
2345
  description: `Label: Counts and Amounts (size)
2312
2346
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
@@ -2319,12 +2353,12 @@ const Co = s.object({
2319
2353
  Keywords: graduated size, proportional size, classed size, how much, total, number, when
2320
2354
  Example: Vary the size of each feature based on the date a ticket was completed.
2321
2355
  Fields: This style requires a single field with a date type.`,
2322
- schema: Co
2356
+ schema: zo
2323
2357
  });
2324
- function $o(e) {
2325
- const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], c = t[1], i = t[2];
2358
+ function jo(e) {
2359
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], c = t[1], s = t[2];
2326
2360
  let l;
2327
- return o && (l = yt({
2361
+ return o && (l = Tt({
2328
2362
  geometryType: r.geometryType,
2329
2363
  includedTags: o
2330
2364
  })[0]), {
@@ -2332,16 +2366,16 @@ function $o(e) {
2332
2366
  view: a,
2333
2367
  field: n,
2334
2368
  field2: c,
2335
- field3: i,
2369
+ field3: s,
2336
2370
  outlineOptimizationEnabled: !0,
2337
2371
  sizeOptimizationEnabled: !0,
2338
2372
  typeScheme: l
2339
2373
  };
2340
2374
  }
2341
- async function ko(e) {
2342
- return await gt(e);
2375
+ async function Do(e) {
2376
+ return await vt(e);
2343
2377
  }
2344
- async function Fo({
2378
+ async function Po({
2345
2379
  arcgisMap: e,
2346
2380
  arcgisMapView: t,
2347
2381
  layerId: r,
@@ -2349,32 +2383,32 @@ async function Fo({
2349
2383
  colorSchemes: o,
2350
2384
  theme: n
2351
2385
  }) {
2352
- const c = t, i = e?.allLayers.find((d) => d.id === r);
2353
- if (!i)
2386
+ const c = t, s = e?.allLayers.find((d) => d.id === r);
2387
+ if (!s)
2354
2388
  return `Could not find layer for id: ${r}`;
2355
2389
  const l = {
2356
2390
  styleName: "type",
2357
2391
  fields: a,
2358
- layer: i,
2392
+ layer: s,
2359
2393
  view: c,
2360
2394
  colorSchemeTags: o,
2361
2395
  theme: n
2362
2396
  };
2363
2397
  try {
2364
- const d = $o(l), u = await ko(d);
2365
- return i.renderer = u.renderer, i.visible = !0, `Type renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2398
+ const d = jo(l), u = await Do(d);
2399
+ return s.renderer = u.renderer, s.visible = !0, `Type renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
2366
2400
  } catch (d) {
2367
2401
  return `Error applying type renderer: ${d instanceof Error ? d.message : String(d)}`;
2368
2402
  }
2369
2403
  }
2370
- async function Lo({
2404
+ async function Mo({
2371
2405
  layerId: e,
2372
2406
  fields: t,
2373
2407
  colorSchemes: r,
2374
2408
  theme: a
2375
2409
  }, o) {
2376
- const { mapView: n } = k(o);
2377
- return await R({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Fo({
2410
+ const { mapView: n } = F(o);
2411
+ return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await Po({
2378
2412
  arcgisMap: n.map,
2379
2413
  arcgisMapView: n,
2380
2414
  layerId: e,
@@ -2383,46 +2417,46 @@ async function Lo({
2383
2417
  theme: a
2384
2418
  });
2385
2419
  }
2386
- const qo = s.object({
2387
- layerId: s.string().describe("The id of the layer to apply the type renderer to"),
2388
- fields: s.array(s.string()).describe("The field(s) to use for the type renderer (categorical data)"),
2389
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
2390
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
2391
- }), Io = b(Lo, {
2420
+ const Oo = i.object({
2421
+ layerId: i.string().describe("The id of the layer to apply the type renderer to"),
2422
+ fields: i.array(i.string()).describe("The field(s) to use for the type renderer (categorical data)"),
2423
+ colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
2424
+ theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
2425
+ }), Go = b(Mo, {
2392
2426
  name: "type",
2393
2427
  description: `Label: Types (unique symbols)
2394
2428
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
2395
2429
  Keywords: categorical, category, type, unique, discrete, point of interest, region, group
2396
2430
  Example: Color each feature based on the region it belongs to
2397
2431
  Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
2398
- schema: qo
2399
- }), Ae = [
2400
- Ca,
2401
- qa,
2402
- ja,
2403
- Va,
2404
- Ha,
2405
- to,
2406
- so,
2407
- mo,
2408
- xo,
2409
- Ro,
2410
- Io
2411
- ], Ao = async (e, t) => {
2432
+ schema: Oo
2433
+ }), De = [
2434
+ za,
2435
+ Oa,
2436
+ Qa,
2437
+ Xa,
2438
+ no,
2439
+ po,
2440
+ wo,
2441
+ Eo,
2442
+ qo,
2443
+ _o,
2444
+ Go
2445
+ ], Vo = async (e, t) => {
2412
2446
  await g({ text: "Requesting LLM for layer query results" }, t);
2413
2447
  const r = await L("navigation_intent_prompt");
2414
2448
  if (!t?.configurable)
2415
2449
  throw new Error("config.configurable is required for layer query tools");
2416
2450
  const a = {
2417
2451
  layerFieldInfo: e.layerFieldInfo
2418
- }, o = await j({
2452
+ }, o = await D({
2419
2453
  promptText: r,
2420
2454
  modelTier: "advanced",
2421
2455
  messages: C(e.agentExecutionContext.messages),
2422
2456
  inputVariables: a,
2423
- tools: Ae
2457
+ tools: De
2424
2458
  });
2425
- return await ie(o, t), {
2459
+ return await de(o, t), {
2426
2460
  ...e,
2427
2461
  agentExecutionContext: {
2428
2462
  ...e.agentExecutionContext,
@@ -2430,8 +2464,8 @@ Fields: This style requires a single field which may be a string, number, or dat
2430
2464
  }
2431
2465
  };
2432
2466
  };
2433
- async function No(e, t) {
2434
- const a = await new M(Ae).invoke(
2467
+ async function Wo(e, t) {
2468
+ const a = await new P(De).invoke(
2435
2469
  {
2436
2470
  messages: C(e.agentExecutionContext.messages)
2437
2471
  },
@@ -2443,7 +2477,7 @@ async function No(e, t) {
2443
2477
  `);
2444
2478
  return { ...e, outputMessage: n };
2445
2479
  }
2446
- const Ne = w.Root({
2480
+ const Pe = w.Root({
2447
2481
  // Execution context provided by the orchestrator for this agent invocation.
2448
2482
  agentExecutionContext: w({
2449
2483
  reducer: K,
@@ -2463,20 +2497,20 @@ const Ne = w.Root({
2463
2497
  vectorSearchFieldResults: w(),
2464
2498
  layerFieldInfo: w(),
2465
2499
  selectedLayerId: w()
2466
- }), zo = async (e, t) => (await g({ text: "Exiting Layer Styling agent" }, t), e), _o = async (e, t) => {
2500
+ }), Ko = async (e, t) => (await g({ text: "Exiting Layer Styling agent" }, t), e), Bo = async (e, t) => {
2467
2501
  try {
2468
2502
  await g({ text: "Populating layer and field info" }, t);
2469
2503
  const r = [];
2470
2504
  for (const a of e.vectorSearchFieldResults) {
2471
2505
  let o = function(u) {
2472
- const p = i.get(u)?.layerItem;
2506
+ const p = s.get(u)?.layerItem;
2473
2507
  return p ? [
2474
2508
  p.name && `Name: ${p.name}`,
2475
2509
  p.title && `Title: ${p.title}`,
2476
2510
  p.description && `Description: ${p.description}`
2477
2511
  ].filter(Boolean).join(" | ") : u;
2478
2512
  };
2479
- const { layerId: n, results: c } = a, i = x(t, "layersAndFieldsRegistry"), l = i.get(n)?.fieldRegistry;
2513
+ const { layerId: n, results: c } = a, s = x(t, "layersAndFieldsRegistry"), l = s.get(n)?.fieldRegistry;
2480
2514
  if (!l)
2481
2515
  continue;
2482
2516
  let d = r.find((u) => u.layerId === n);
@@ -2494,43 +2528,43 @@ const Ne = w.Root({
2494
2528
  } catch (r) {
2495
2529
  throw await g({ text: "Error populating layerFieldInfo" }, t), new Error(`Error populating layerFieldInfo: ${r instanceof Error ? r.message : String(r)}`);
2496
2530
  }
2497
- }, jo = (e, t) => {
2531
+ }, Qo = (e, t) => {
2498
2532
  const r = e.vectorSearchLayerIds ?? [];
2499
2533
  if (r.length <= 1)
2500
2534
  return { ...e, selectedLayerId: e.vectorSearchLayerIds[0] };
2501
2535
  const { hitlResponse: a } = t.configurable;
2502
- if (!a || a.agentId !== xe.id || a.id !== "reviewLayerSelection") {
2536
+ if (!a || a.agentId !== Ce.id || a.id !== "reviewLayerSelection") {
2503
2537
  const n = {
2504
- agentId: xe.id,
2538
+ agentId: Ce.id,
2505
2539
  id: "reviewLayerSelection",
2506
2540
  kind: "singleSelection",
2507
2541
  message: "Choose a layer to apply the styles.",
2508
2542
  metadata: [...r]
2509
2543
  };
2510
- throw new We(n);
2544
+ throw new He(n);
2511
2545
  }
2512
2546
  let o = null;
2513
2547
  return Array.isArray(a.payload) && a.payload.length > 0 && (o = a.payload[0]), {
2514
2548
  ...e,
2515
2549
  selectedLayerId: o ?? e.vectorSearchLayerIds[0]
2516
2550
  };
2517
- }, Mo = (e, t) => Q(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(e, t), Po = () => new V(Ne).addNode("requireLayerStylingServices", Mo).addNode("vectorSearchLayers", wa).addNode("layerSelectionHITL", jo).addNode("vectorSearchFields", ya).addNode("populateLayerFieldInfo", _o).addNode("agent", Ao).addNode("tools", No).addNode("earlyExit", zo).addEdge(W, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
2551
+ }, Uo = (e, t) => Q(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(e, t), Ho = () => new V(Pe).addNode("requireLayerStylingServices", Uo).addNode("vectorSearchLayers", ka).addNode("layerSelectionHITL", Qo).addNode("vectorSearchFields", Ra).addNode("populateLayerFieldInfo", Bo).addNode("agent", Vo).addNode("tools", Wo).addNode("earlyExit", Ko).addEdge(W, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
2518
2552
  "layerSelectionHITL",
2519
2553
  (t) => t.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
2520
2554
  ).addConditionalEdges(
2521
2555
  "vectorSearchFields",
2522
2556
  (t) => t.vectorSearchFieldResults.length ? "populateLayerFieldInfo" : "earlyExit"
2523
- ).addEdge("populateLayerFieldInfo", "agent").addEdge("agent", "tools").addEdge("tools", F).addEdge("earlyExit", F), Do = 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.
2557
+ ).addEdge("populateLayerFieldInfo", "agent").addEdge("agent", "tools").addEdge("tools", q).addEdge("earlyExit", q), Zo = 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.
2524
2558
  _Example: “Color points by sales amount”_
2525
2559
  _Example: “Show population density with a color gradient”_
2526
2560
  _Example: “Create a relationship map between height and depth”_
2527
- _Example: “Vary circle sizes according to population”_`, xe = {
2561
+ _Example: “Vary circle sizes according to population”_`, Ce = {
2528
2562
  id: "layerStyling",
2529
2563
  name: "Layer Styling Agent",
2530
- description: Do,
2531
- createGraph: Po,
2532
- workspace: Ne
2533
- }, ze = w.Root({
2564
+ description: Zo,
2565
+ createGraph: Ho,
2566
+ workspace: Pe
2567
+ }, Me = w.Root({
2534
2568
  // Execution context provided by the orchestrator for this agent invocation.
2535
2569
  agentExecutionContext: w({
2536
2570
  reducer: K,
@@ -2547,14 +2581,14 @@ const Ne = w.Root({
2547
2581
  default: () => ""
2548
2582
  }),
2549
2583
  summary: w({
2550
- reducer: _,
2584
+ reducer: j,
2551
2585
  default: () => ""
2552
2586
  }),
2553
2587
  status: w({
2554
- reducer: _,
2588
+ reducer: j,
2555
2589
  default: () => "success"
2556
2590
  })
2557
- }), Oo = (e, t) => {
2591
+ }), Jo = (e, t) => {
2558
2592
  const r = Array.from(e.values()).find(
2559
2593
  ({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
2560
2594
  );
@@ -2567,20 +2601,20 @@ const Ne = w.Root({
2567
2601
  return `**${r.layerItem.title}** has ${a.length} field(s):
2568
2602
 
2569
2603
  ${o}`;
2570
- }, Go = async ({ layerTitle: e }, t) => {
2604
+ }, Yo = async ({ layerTitle: e }, t) => {
2571
2605
  const r = x(t, "layersAndFieldsRegistry");
2572
- return Oo(r, e);
2573
- }, Vo = b(Go, {
2606
+ return Jo(r, e);
2607
+ }, Xo = b(Yo, {
2574
2608
  name: "listLayerFields",
2575
2609
  description: "Lists all fields for a given layer by title. Use when the user asks to see fields, columns, or attributes of a specific layer.",
2576
- schema: s.object({
2577
- layerTitle: s.string().describe("The title or partial title of the layer to list fields for.")
2610
+ schema: i.object({
2611
+ layerTitle: i.string().describe("The title or partial title of the layer to list fields for.")
2578
2612
  })
2579
- }), _e = [Vo], Wo = (e) => {
2613
+ }), Oe = [Xo], en = (e) => {
2580
2614
  if (!e || e.size === 0)
2581
2615
  return "No layers available in this map.";
2582
2616
  const t = Array.from(e.values()).map(({ layerItem: r, fieldRegistry: a }, o) => {
2583
- const n = Array.from(a.values()).map((i) => i.name).slice(0, 10).join(", "), c = a.size > 10 ? ` (and ${a.size - 10} more)` : "";
2617
+ const n = Array.from(a.values()).map((s) => s.name).slice(0, 10).join(", "), c = a.size > 10 ? ` (and ${a.size - 10} more)` : "";
2584
2618
  return `${o + 1}. "${r.title}". Description: ${r.description}
2585
2619
  Fields: ${n}${c}`;
2586
2620
  }).join(`
@@ -2589,29 +2623,29 @@ ${o}`;
2589
2623
  return `This map contains ${e.size} layer(s):
2590
2624
 
2591
2625
  ${t}`;
2592
- }, Ko = (e) => {
2626
+ }, tn = (e) => {
2593
2627
  const t = e?.list() ?? [];
2594
2628
  return t.length ? t.map((r) => `- ${r.agent.name}: ${r.agent.description}`).join(`
2595
2629
  `) : "No agents currently available.";
2596
2630
  };
2597
- async function Bo(e, t) {
2631
+ async function rn(e, t) {
2598
2632
  const r = await L("help_prompt"), a = x(t, "layersAndFieldsRegistry"), o = x(t, "agentRegistry");
2599
2633
  try {
2600
- const n = await j({
2634
+ const n = await D({
2601
2635
  promptText: r,
2602
2636
  modelTier: "fast",
2603
- tools: _e,
2637
+ tools: Oe,
2604
2638
  inputVariables: {
2605
- layerSummary: Wo(a),
2606
- agents: Ko(o),
2639
+ layerSummary: en(a),
2640
+ agents: tn(o),
2607
2641
  assignedTask: e.agentExecutionContext.assignedTask,
2608
2642
  userRequest: e.agentExecutionContext.userRequest,
2609
2643
  priorSteps: e.agentExecutionContext.priorSteps
2610
2644
  }
2611
- }), c = n.content.toString(), i = [...e.agentExecutionContext.messages, n];
2645
+ }), c = n.content.toString(), s = [...e.agentExecutionContext.messages, n];
2612
2646
  return {
2613
2647
  ...e,
2614
- agentExecutionContext: { ...e.agentExecutionContext, messages: i },
2648
+ agentExecutionContext: { ...e.agentExecutionContext, messages: s },
2615
2649
  outputMessage: c,
2616
2650
  summary: "Provided map-related help based on the assigned task.",
2617
2651
  status: "success"
@@ -2626,13 +2660,13 @@ async function Bo(e, t) {
2626
2660
  };
2627
2661
  }
2628
2662
  }
2629
- const Qo = (e, t) => Q(["agentRegistry"], "Help Agent")(e, t);
2630
- async function Uo(e, t) {
2631
- const a = await new M(_e).invoke({ messages: e.agentExecutionContext.messages }, t), o = [...e.agentExecutionContext.messages, ...a.messages], n = a.messages.map((c) => c.text).join(`
2663
+ const an = (e, t) => Q(["agentRegistry"], "Help Agent")(e, t);
2664
+ async function on(e, t) {
2665
+ const a = await new P(Oe).invoke({ messages: e.agentExecutionContext.messages }, t), o = [...e.agentExecutionContext.messages, ...a.messages], n = a.messages.map((c) => c.text).join(`
2632
2666
  `);
2633
2667
  return { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: o }, outputMessage: n };
2634
2668
  }
2635
- const Ho = () => new V(ze).addNode("requireHelpServices", Qo).addNode("agent", Bo).addNode("tools", Uo).addEdge(W, "requireHelpServices").addEdge("requireHelpServices", "agent").addConditionalEdges("agent", (t) => (t.agentExecutionContext.messages[t.agentExecutionContext.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : F).addEdge("tools", F), Zo = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
2669
+ const nn = () => new V(Me).addNode("requireHelpServices", an).addNode("agent", rn).addNode("tools", on).addEdge(W, "requireHelpServices").addEdge("requireHelpServices", "agent").addConditionalEdges("agent", (t) => (t.agentExecutionContext.messages[t.agentExecutionContext.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : q).addEdge("tools", q), sn = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
2636
2670
 
2637
2671
  _Example: “Tell me about this map”_
2638
2672
  _Example: “List all layers in this map”_
@@ -2645,13 +2679,13 @@ const Ho = () => new V(ze).addNode("requireHelpServices", Qo).addNode("agent", B
2645
2679
 
2646
2680
  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.
2647
2681
  _Example: "Create a chart"_
2648
- _Example: "Create a table"_`, Si = {
2682
+ _Example: "Create a table"_`, Is = {
2649
2683
  id: "help",
2650
2684
  name: "Help Agent",
2651
- description: Zo,
2652
- createGraph: Ho,
2653
- workspace: ze
2654
- }, je = w.Root({
2685
+ description: sn,
2686
+ createGraph: nn,
2687
+ workspace: Me
2688
+ }, Ge = w.Root({
2655
2689
  // Execution context provided by the orchestrator for this agent invocation.
2656
2690
  agentExecutionContext: w({
2657
2691
  reducer: K,
@@ -2670,33 +2704,33 @@ const Ho = () => new V(ze).addNode("requireHelpServices", Qo).addNode("agent", B
2670
2704
  intent: w({
2671
2705
  reducer: (e, t) => t
2672
2706
  })
2673
- }), U = {
2707
+ }), H = {
2674
2708
  conversationId: ""
2675
- }, Jo = ["linkChartView"], Yo = ["knowledgeGraph"];
2676
- function ee(e) {
2709
+ }, cn = ["linkChartView"], ln = ["knowledgeGraph"];
2710
+ function ae(e) {
2677
2711
  const r = e?.configurable?.context;
2678
2712
  if (!r || typeof r != "object")
2679
2713
  throw new Error("ArcgisKnowledgeAgent context missing");
2680
- const a = Jo.filter((o) => !(o in r));
2714
+ const a = cn.filter((o) => !(o in r));
2681
2715
  if (a.length)
2682
2716
  throw new Error(`Link Chart context missing: ${a.join(", ")}`);
2683
2717
  return r;
2684
2718
  }
2685
- function ce(e) {
2719
+ function pe(e) {
2686
2720
  const r = e?.configurable?.context;
2687
2721
  if (!r || typeof r != "object")
2688
2722
  throw new Error("ArcgisKnowledgeAgent context missing");
2689
- const a = Yo.filter((o) => !(o in r));
2723
+ const a = ln.filter((o) => !(o in r));
2690
2724
  if (a.length)
2691
2725
  throw new Error(`Knowledge Graph context missing: ${a.join(", ")}`);
2692
2726
  return r;
2693
2727
  }
2694
- class Xo {
2728
+ class dn {
2695
2729
  constructor(t) {
2696
- this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = le.fromDataModel(t);
2730
+ this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = me.fromDataModel(t);
2697
2731
  }
2698
2732
  }
2699
- class le {
2733
+ class me {
2700
2734
  constructor() {
2701
2735
  this.schemaType = "ArcgisGraphSchema", this.entityTypes = [], this.relationshipTypes = [], this.identifierInfo = {
2702
2736
  mappingInfo: {
@@ -2706,14 +2740,14 @@ class le {
2706
2740
  };
2707
2741
  }
2708
2742
  static fromDataModel(t) {
2709
- const r = new le();
2743
+ const r = new me();
2710
2744
  for (const a of t.entityTypes)
2711
2745
  r.entityTypes.push(G.fromEntityType(a));
2712
2746
  for (const a of t.relationshipTypes)
2713
- r.relationshipTypes.push(en.fromRelationshipType(a));
2747
+ r.relationshipTypes.push(un.fromRelationshipType(a));
2714
2748
  return r.identifierInfo = {
2715
2749
  mappingInfo: {
2716
- identifierMapsTo: tn(
2750
+ identifierMapsTo: pn(
2717
2751
  t.identifierInfo.identifierMappingInfo.identifierInfoType
2718
2752
  ),
2719
2753
  identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
@@ -2727,13 +2761,13 @@ class G {
2727
2761
  }
2728
2762
  static fromEntityType(t) {
2729
2763
  const r = new G();
2730
- r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = rn(t.role);
2764
+ r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = mn(t.role);
2731
2765
  for (const a of t.properties) {
2732
2766
  const o = {
2733
2767
  name: a.name,
2734
2768
  alias: a.alias ? a.alias : void 0,
2735
2769
  fieldType: a.fieldType,
2736
- role: an(a.role),
2770
+ role: hn(a.role),
2737
2771
  geometryDef: a.fieldType === "esriFieldTypeGeometry" ? {
2738
2772
  geometryType: a.geometryType ?? "esriGeometryAny",
2739
2773
  hasM: a.hasM ? a.hasM : void 0,
@@ -2745,7 +2779,7 @@ class G {
2745
2779
  return r;
2746
2780
  }
2747
2781
  }
2748
- class en extends G {
2782
+ class un extends G {
2749
2783
  constructor() {
2750
2784
  super(...arguments), this.observedEndPoints = [];
2751
2785
  }
@@ -2760,7 +2794,7 @@ class en extends G {
2760
2794
  return r;
2761
2795
  }
2762
2796
  }
2763
- const tn = (e) => {
2797
+ const pn = (e) => {
2764
2798
  switch (e) {
2765
2799
  case "esriIdentifierInfoTypeUNSPECIFIED":
2766
2800
  return "UNSPECIFIED";
@@ -2771,7 +2805,7 @@ const tn = (e) => {
2771
2805
  default:
2772
2806
  return e;
2773
2807
  }
2774
- }, rn = (e) => {
2808
+ }, mn = (e) => {
2775
2809
  switch (e) {
2776
2810
  case "Regular":
2777
2811
  return "esriGraphNamedObjectRegular";
@@ -2783,7 +2817,7 @@ const tn = (e) => {
2783
2817
  return e;
2784
2818
  }
2785
2819
  };
2786
- function an(e) {
2820
+ function hn(e) {
2787
2821
  switch (e) {
2788
2822
  case "esriGraphPropertyRegular":
2789
2823
  return "Regular";
@@ -2821,41 +2855,41 @@ function an(e) {
2821
2855
  return "Regular";
2822
2856
  }
2823
2857
  }
2824
- async function on(e, t, r, a) {
2825
- const { graphQuery: o, explanation: n } = await de(e, t, r, a);
2858
+ async function gn(e, t, r, a) {
2859
+ const { graphQuery: o, explanation: n } = await he(e, t, r, a);
2826
2860
  return `Generated Graph Query:
2827
2861
  ${o}
2828
2862
 
2829
2863
  Explanation: ${n}`;
2830
2864
  }
2831
- async function de(e, t, r, a) {
2865
+ async function he(e, t, r, a) {
2832
2866
  const o = {
2833
2867
  message: e,
2834
- context: new Xo(t)
2868
+ context: new dn(t)
2835
2869
  };
2836
- U.conversationId && (o.conversationId = U.conversationId), await g({ text: "Attempting to generate a cypher query from your prompt..." }, a);
2837
- const n = await me(`${r}/chat`, {
2870
+ H.conversationId && (o.conversationId = H.conversationId), await g({ text: "Attempting to generate a cypher query from your prompt..." }, a);
2871
+ const n = await be(`${r}/chat`, {
2838
2872
  method: "post",
2839
2873
  body: JSON.stringify(o),
2840
2874
  headers: {
2841
2875
  "Content-Type": "application/json",
2842
- token: ge.findCredential(z.getDefault().url)?.token ?? ""
2876
+ token: xe.findCredential(_.getDefault().url)?.token ?? ""
2843
2877
  }
2844
2878
  });
2845
2879
  if (n.httpStatus !== 200)
2846
2880
  throw new Error(`Graph query service returned an error: ${n.httpStatus}`, {
2847
2881
  cause: n.data
2848
2882
  });
2849
- U.conversationId || (U.conversationId = n.data.conversationId);
2883
+ H.conversationId || (H.conversationId = n.data.conversationId);
2850
2884
  let c = !1;
2851
- const i = Date.now();
2885
+ const s = Date.now();
2852
2886
  let l = n.data.sequenceNumber, d = "", u = "", p = 1;
2853
2887
  for (; !c; ) {
2854
2888
  await new Promise((y) => setTimeout(y, 1e3)), await g(
2855
2889
  { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, p)}` },
2856
2890
  a
2857
2891
  ), p = p % 3 + 1;
2858
- const h = await me(`${r}/chat`, {
2892
+ const m = await be(`${r}/chat`, {
2859
2893
  method: "post",
2860
2894
  body: JSON.stringify({
2861
2895
  conversationId: n.data.conversationId,
@@ -2864,48 +2898,48 @@ async function de(e, t, r, a) {
2864
2898
  }),
2865
2899
  headers: {
2866
2900
  "Content-Type": "application/json",
2867
- token: ge.findCredential(z.getDefault().url)?.token ?? ""
2901
+ token: xe.findCredential(_.getDefault().url)?.token ?? ""
2868
2902
  }
2869
2903
  });
2870
- if (h.httpStatus !== 200)
2871
- throw new Error(`Graph query service polling returned an error: ${h.httpStatus}`, {
2872
- cause: h.data
2904
+ if (m.httpStatus !== 200)
2905
+ throw new Error(`Graph query service polling returned an error: ${m.httpStatus}`, {
2906
+ cause: m.data
2873
2907
  });
2874
- if (h.data.context)
2875
- d = h.data.context.graphQuery, u = h.data.message || "";
2876
- else if (!h.data.hasMore)
2908
+ if (m.data.context)
2909
+ d = m.data.context.graphQuery, u = m.data.message || "";
2910
+ else if (!m.data.hasMore)
2877
2911
  c = !0;
2878
- else if (Date.now() - i > 6e4)
2912
+ else if (Date.now() - s > 6e4)
2879
2913
  throw new Error("Graph query service polling timed out after 1 minute.");
2880
- l = h.data.sequenceNumber;
2914
+ l = m.data.sequenceNumber;
2881
2915
  }
2882
2916
  return { graphQuery: d, explanation: u };
2883
2917
  }
2884
- function H(e, t) {
2918
+ function Z(e, t) {
2885
2919
  if (!(!e || typeof e != "object")) {
2886
- if (sn(e))
2920
+ if (fn(e))
2887
2921
  for (const r of e.path)
2888
- H(r, t);
2889
- else if (nn(e))
2922
+ Z(r, t);
2923
+ else if (yn(e))
2890
2924
  t.set(`${e.typeName}__${e.id}`, { id: e.id, typeName: e.typeName });
2891
2925
  else if (Array.isArray(e))
2892
2926
  for (const r of e)
2893
- H(r, t);
2894
- else if (cn(e))
2927
+ Z(r, t);
2928
+ else if (wn(e))
2895
2929
  for (const r of Object.values(e.properties ?? {}))
2896
- H(r, t);
2930
+ Z(r, t);
2897
2931
  }
2898
2932
  }
2899
- function nn(e) {
2933
+ function yn(e) {
2900
2934
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
2901
2935
  }
2902
- function sn(e) {
2936
+ function fn(e) {
2903
2937
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
2904
2938
  }
2905
- function cn(e) {
2939
+ function wn(e) {
2906
2940
  return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
2907
2941
  }
2908
- function ln(e, t) {
2942
+ function bn(e, t) {
2909
2943
  const r = [];
2910
2944
  for (const a of [...t.dataModel.entityTypes, ...t.dataModel.relationshipTypes]) {
2911
2945
  const o = e.getMemberIdsByType(a.name);
@@ -2914,7 +2948,7 @@ function ln(e, t) {
2914
2948
  }
2915
2949
  return r;
2916
2950
  }
2917
- const dn = async (e) => {
2951
+ const xn = async (e) => {
2918
2952
  const t = /* @__PURE__ */ new Map(), r = e.resultRowsStream.getReader();
2919
2953
  for (; ; ) {
2920
2954
  const { done: a, value: o } = await r.read();
@@ -2922,12 +2956,12 @@ const dn = async (e) => {
2922
2956
  break;
2923
2957
  for (const n of o)
2924
2958
  for (const c of n)
2925
- H(c, t);
2959
+ Z(c, t);
2926
2960
  }
2927
2961
  return Array.from(t.values());
2928
2962
  };
2929
- async function un(e, t, r, a, o) {
2930
- const { graphQuery: n, explanation: c } = await de(
2963
+ async function Sn(e, t, r, a, o) {
2964
+ const { graphQuery: n, explanation: c } = await he(
2931
2965
  e,
2932
2966
  t.dataModel,
2933
2967
  r,
@@ -2937,16 +2971,16 @@ async function un(e, t, r, a, o) {
2937
2971
  { text: `Attempting to execute query: ${n.substring(0, 500)}${n.length > 500 ? "..." : ""}` },
2938
2972
  o
2939
2973
  );
2940
- const i = await ft(
2974
+ const s = await Et(
2941
2975
  t,
2942
- new $e({
2976
+ new Ie({
2943
2977
  openCypherQuery: n
2944
2978
  }),
2945
2979
  {
2946
2980
  signal: o?.signal,
2947
2981
  timeout: o?.timeout
2948
2982
  }
2949
- ), l = await dn(i);
2983
+ ), l = await xn(s);
2950
2984
  return await g(
2951
2985
  {
2952
2986
  text: `Query Results parsed into ${l.length} unique relationships and entities. Atempting to add to link chart...`
@@ -2957,11 +2991,11 @@ ${n}
2957
2991
 
2958
2992
  Explanation: ${c}`;
2959
2993
  }
2960
- async function Me({ prompt: e }, t) {
2961
- const { knowledgeGraph: r } = ce(t), { linkChartView: a } = ee(t), n = z.getDefault().helperServices, c = await L("arcgis_knowledge_current_lc_context"), i = ln(a.map, r), l = `${e}
2994
+ async function Ve({ prompt: e }, t) {
2995
+ const { knowledgeGraph: r } = pe(t), { linkChartView: a } = ae(t), n = _.getDefault().helperServices, c = await L("arcgis_knowledge_current_lc_context"), s = bn(a.map, r), l = `${e}
2962
2996
 
2963
- ${c}${JSON.stringify(i)}`;
2964
- return await un(
2997
+ ${c}${JSON.stringify(s)}`;
2998
+ return await Sn(
2965
2999
  l,
2966
3000
  r,
2967
3001
  `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
@@ -2969,22 +3003,22 @@ ${c}${JSON.stringify(i)}`;
2969
3003
  t
2970
3004
  );
2971
3005
  }
2972
- const pn = s.object({
2973
- prompt: s.string().describe("The user's inquiry into the knowledge graph that needs to be run.")
2974
- }), Pe = b(Me, {
3006
+ const vn = i.object({
3007
+ prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be run.")
3008
+ }), We = b(Ve, {
2975
3009
  name: "addRecords",
2976
3010
  description: "Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt.",
2977
- schema: pn
3011
+ schema: vn
2978
3012
  });
2979
- async function hn(e, t) {
3013
+ async function Tn(e, t) {
2980
3014
  return await t.map.applyLayout(e), `Successfully applied layout: ${e}.`;
2981
3015
  }
2982
- async function mn({ layout: e }, t) {
2983
- const { linkChartView: r } = ee(t);
2984
- return await hn(e, r);
3016
+ async function En({ layout: e }, t) {
3017
+ const { linkChartView: r } = ae(t);
3018
+ return await Tn(e, r);
2985
3019
  }
2986
- const gn = s.object({
2987
- layout: s.enum([
3020
+ const Cn = i.object({
3021
+ layout: i.enum([
2988
3022
  "organic-standard",
2989
3023
  "organic-community",
2990
3024
  "basic-grid",
@@ -2997,47 +3031,47 @@ const gn = s.object({
2997
3031
  ]).describe(
2998
3032
  "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"
2999
3033
  )
3000
- }), yn = b(mn, {
3034
+ }), Rn = b(En, {
3001
3035
  name: "applyLayout",
3002
3036
  description: "Apply a diagram layout to the link chart",
3003
- schema: gn
3037
+ schema: Cn
3004
3038
  });
3005
- function fn(e, t) {
3039
+ function $n(e, t) {
3006
3040
  return t.map.changeNonspatialDataDisplay(e), `Successfully applied nonspatial visibility setting: ${e}.`;
3007
3041
  }
3008
- function wn({ setting: e }, t) {
3009
- const { linkChartView: r } = ee(t);
3010
- return fn(e, r);
3042
+ function kn({ setting: e }, t) {
3043
+ const { linkChartView: r } = ae(t);
3044
+ return $n(e, r);
3011
3045
  }
3012
- const bn = s.object({
3013
- setting: s.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
3014
- }), xn = b(wn, {
3046
+ const Fn = i.object({
3047
+ setting: i.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
3048
+ }), qn = b(kn, {
3015
3049
  name: "changeNonspatialVisibility",
3016
3050
  description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
3017
- schema: bn
3051
+ schema: Fn
3018
3052
  });
3019
- async function Sn(e, t, r, a, o) {
3020
- const { graphQuery: n, explanation: c } = await de(
3053
+ async function Ln(e, t, r, a, o) {
3054
+ const { graphQuery: n, explanation: c } = await he(
3021
3055
  e,
3022
3056
  t.dataModel,
3023
3057
  r,
3024
3058
  o
3025
3059
  );
3026
3060
  await g({ text: `Attempting to create link chart from derived query: ${n}` }, o);
3027
- const i = await wt.fromCypherQuery(
3061
+ const s = await Ct.fromCypherQuery(
3028
3062
  t,
3029
- new $e({
3063
+ new Ie({
3030
3064
  openCypherQuery: n
3031
3065
  })
3032
3066
  );
3033
- return await g({ text: "Link chart created successfully, loading..." }, o), a.map = i, await i.load(), await a.when(), `Link chart created successfully. Cypher Query used to create the link chart:
3067
+ return await g({ text: "Link chart created successfully, loading..." }, o), a.map = s, await s.load(), await a.when(), `Link chart created successfully. Cypher Query used to create the link chart:
3034
3068
  ${n}
3035
3069
 
3036
3070
  Explanation: ${c}`;
3037
3071
  }
3038
- async function De({ prompt: e }, t) {
3039
- const { knowledgeGraph: r } = ce(t), { linkChartView: a } = ee(t), n = z.getDefault().helperServices;
3040
- return await Sn(
3072
+ async function Ke({ prompt: e }, t) {
3073
+ const { knowledgeGraph: r } = pe(t), { linkChartView: a } = ae(t), n = _.getDefault().helperServices;
3074
+ return await Ln(
3041
3075
  e,
3042
3076
  r,
3043
3077
  `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
@@ -3045,72 +3079,72 @@ async function De({ prompt: e }, t) {
3045
3079
  t
3046
3080
  );
3047
3081
  }
3048
- const vn = s.object({
3049
- prompt: s.string().describe(
3082
+ const In = i.object({
3083
+ prompt: i.string().describe(
3050
3084
  "The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization."
3051
3085
  )
3052
- }), Oe = b(De, {
3086
+ }), Be = b(Ke, {
3053
3087
  name: "createLinkChart",
3054
3088
  description: "Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt.",
3055
- schema: vn
3089
+ schema: In
3056
3090
  });
3057
- async function Ge({ prompt: e }, t) {
3058
- const { knowledgeGraph: r } = ce(t), o = z.getDefault().helperServices;
3059
- return await on(
3091
+ async function Qe({ prompt: e }, t) {
3092
+ const { knowledgeGraph: r } = pe(t), o = _.getDefault().helperServices;
3093
+ return await gn(
3060
3094
  e,
3061
3095
  r.dataModel,
3062
3096
  `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
3063
3097
  t
3064
3098
  );
3065
3099
  }
3066
- const Tn = s.object({
3067
- prompt: s.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
3068
- }), ue = b(Ge, {
3100
+ const Nn = i.object({
3101
+ prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
3102
+ }), ge = b(Qe, {
3069
3103
  name: "generateCypher",
3070
3104
  description: "Generates an Open Cypher query based on the user's prompt which represents an inquiry into the data of the knowledge service and its graph database, attempting to filter based on certain conditions and traverse specified relationships. The generated query should be syntactically correct and optimized for performance.",
3071
- schema: Tn
3072
- }), pe = [
3073
- yn,
3074
- xn,
3075
- ue,
3076
- Oe,
3077
- Pe
3078
- ], En = [ue, Oe, Pe];
3079
- async function Cn(e, t) {
3105
+ schema: Nn
3106
+ }), ye = [
3107
+ Rn,
3108
+ qn,
3109
+ ge,
3110
+ Be,
3111
+ We
3112
+ ], An = [ge, Be, We];
3113
+ async function zn(e, t) {
3080
3114
  const r = await L("arcgis_knowledge_tool_prompt"), a = {
3081
3115
  intent: e.intent
3082
- }, o = await j({
3116
+ }, o = await D({
3083
3117
  promptText: r,
3084
3118
  messages: C(e.agentExecutionContext.messages),
3085
3119
  inputVariables: a,
3086
- tools: pe
3087
- }), n = [...e.agentExecutionContext.messages, o], i = (o.tool_calls?.length ?? 0) > 0 ? [...n] : [...n, o];
3088
- return { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: i } };
3120
+ tools: ye
3121
+ }), n = [...e.agentExecutionContext.messages, o], s = (o.tool_calls?.length ?? 0) > 0 ? [...n] : [...n, o];
3122
+ return { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: s } };
3089
3123
  }
3090
- async function Rn(e, t) {
3091
- const a = await new M(pe).invoke(
3124
+ async function _n(e, t) {
3125
+ const a = await new P(ye).invoke(
3092
3126
  {
3093
3127
  messages: C(e.agentExecutionContext.messages)
3094
3128
  },
3095
3129
  t
3096
- ), o = a.messages.map((i) => i.text).join(`
3130
+ ), o = a.messages.map((s) => s.text).join(`
3097
3131
  `);
3098
3132
  await g({ text: `Finished executing arcgisKnowledge tool: ${o}` }, t);
3099
- const n = [...e.agentExecutionContext.messages, ...a.messages], c = a.messages.map((i) => i.text).join(`
3133
+ const n = [...e.agentExecutionContext.messages, ...a.messages], c = a.messages.map((s) => s.text).join(`
3100
3134
  `);
3101
3135
  return { ...e, agentExecutionContext: { ...e.agentExecutionContext, messages: n }, outputMessage: c };
3102
3136
  }
3103
- async function $n(e) {
3137
+ async function jn(e) {
3104
3138
  const t = await L("arcgis_knowledge_intent_prompt"), a = {
3105
- tools: pe.map((i) => ({
3106
- name: i.name,
3107
- description: i.description,
3108
- schema: i.schema
3109
- })).map(({ name: i, description: l, schema: d }) => `${i}: ${l}, ${JSON.stringify(d)}`).join(`
3139
+ tools: ye.map((s) => ({
3140
+ name: s.name,
3141
+ description: s.description,
3142
+ schema: s.schema
3143
+ })).map(({ name: s, description: l, schema: d }) => `${s}: ${l}, ${JSON.stringify(d)}`).join(`
3110
3144
  `)
3111
- }, o = s.object({
3112
- intent: s.string()
3113
- }), n = await Se({
3145
+ }, o = i.object({
3146
+ intent: i.string()
3147
+ }), n = await Re({
3114
3148
  promptText: t,
3115
3149
  messages: C(e.agentExecutionContext.messages),
3116
3150
  inputVariables: a,
@@ -3118,35 +3152,35 @@ async function $n(e) {
3118
3152
  }), c = typeof n.intent == "string" ? n.intent.trim().replace(/^"|"$/gu, "") : "";
3119
3153
  return { ...e, intent: c || "" };
3120
3154
  }
3121
- const kn = (e, t) => (
3155
+ const Dn = (e, t) => (
3122
3156
  //agent services (ex: embeddingsWorker) would go in the array below, if required.
3123
3157
  Q([], "ArcgisKnowledge Agent")(e, t)
3124
3158
  );
3125
- async function Fn(e, t) {
3159
+ async function Pn(e, t) {
3126
3160
  const r = e.agentExecutionContext.messages[e.agentExecutionContext.messages.length - 1].content;
3127
3161
  let a;
3128
3162
  if (typeof r != "string")
3129
3163
  throw new Error("The original message content must be a string to process server skills.");
3130
- if (e.intent === ue.name)
3131
- a = await Ge({ prompt: r }, t);
3164
+ if (e.intent === ge.name)
3165
+ a = await Qe({ prompt: r }, t);
3132
3166
  else if (e.intent === "createLinkChart")
3133
- a = await De({ prompt: r }, t);
3167
+ a = await Ke({ prompt: r }, t);
3134
3168
  else if (e.intent === "addRecords")
3135
- a = await Me({ prompt: r }, t);
3169
+ a = await Ve({ prompt: r }, t);
3136
3170
  else
3137
3171
  throw new Error(`No server skills were successfully invoked matching the name: ${e.intent}`);
3138
3172
  return { ...e, outputMessage: a };
3139
3173
  }
3140
- const Ln = () => new V(je).addNode("requireArcgisKnowledgeServices", kn).addNode("intentLLM", $n).addNode("agent", Cn).addNode("serverSkill", Fn).addNode("tools", Rn).addEdge(W, "requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices", "intentLLM").addConditionalEdges(
3174
+ const Mn = () => new V(Ge).addNode("requireArcgisKnowledgeServices", Dn).addNode("intentLLM", jn).addNode("agent", zn).addNode("serverSkill", Pn).addNode("tools", _n).addEdge(W, "requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices", "intentLLM").addConditionalEdges(
3141
3175
  "intentLLM",
3142
3176
  (t) => (
3143
3177
  // ts/lint are getting confused here about the type, and the cast resolves it. Without it, there is a ts error
3144
- En.map((r) => r.name).includes(t.intent) ? "serverSkill" : "agent"
3178
+ An.map((r) => r.name).includes(t.intent) ? "serverSkill" : "agent"
3145
3179
  )
3146
3180
  ).addConditionalEdges("agent", (t) => {
3147
3181
  const r = t.agentExecutionContext.messages[t.agentExecutionContext.messages.length - 1];
3148
- return r?.getType() === "ai" && "tool_calls" in r && Array.isArray(r.tool_calls) && r.tool_calls.length > 0 ? "tools" : F;
3149
- }).addEdge("tools", F), qn = String.raw`The purpose of this agent is to work with Knowledge Graph data, a graph database technology that represents and stores data as interconnected entities (nodes) and relationships (edges).
3182
+ return r?.getType() === "ai" && "tool_calls" in r && Array.isArray(r.tool_calls) && r.tool_calls.length > 0 ? "tools" : q;
3183
+ }).addEdge("tools", q), On = String.raw`The purpose of this agent is to work with Knowledge Graph data, a graph database technology that represents and stores data as interconnected entities (nodes) and relationships (edges).
3150
3184
  This agent has two categories of skills: those that work with an active link chart visualization of a subset of the data in the knowledge graph, and those that work with the knowledge graph data more generally against the entire dataset in the service and database.
3151
3185
  For link charts, the agent 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,
3152
3186
  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
@@ -3178,17 +3212,17 @@ _example: "Find all the products supplied by Supplier X and add them to my visua
3178
3212
  _example: "Expand the link chart from 'Entity D' to show its direct connections"_
3179
3213
  _example: "Find all the cars and then add everything up to two hops away from them on the link chart"_
3180
3214
  _example: "Connect Emma and Rob on the link chart if there is a relationship between them"
3181
- _example: "Discover and add all the relationships originating at 'Entity E' to the link chart"_`, vi = {
3215
+ _example: "Discover and add all the relationships originating at 'Entity E' to the link chart"_`, Ns = {
3182
3216
  id: "arcgisKnowledge",
3183
3217
  name: "ArcgisKnowledge Agent",
3184
- description: qn,
3185
- createGraph: Ln,
3186
- workspace: je
3218
+ description: On,
3219
+ createGraph: Mn,
3220
+ workspace: Ge
3187
3221
  };
3188
3222
  export {
3189
- vi as ArcgisKnowledgeAgent,
3190
- xi as DataExplorationAgent,
3191
- Si as HelpAgent,
3192
- xe as LayerStylingAgent,
3193
- bi as NavigationAgent
3223
+ Ns as ArcgisKnowledgeAgent,
3224
+ Ls as DataExplorationAgent,
3225
+ Is as HelpAgent,
3226
+ Ce as LayerStylingAgent,
3227
+ qs as NavigationAgent
3194
3228
  };