@arcgis/ai-agents 5.1.0-next.37 → 5.1.0-next.39

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,60 +1,60 @@
1
- import { Annotation as g, messagesStateReducer as z, StateGraph as _, START as j, END as R, NodeInterrupt as lt } from "@langchain/langgraph/web";
2
- import { invokeToolPrompt as M, sendTraceMessage as m, invokeStructuredPrompt as ke, invokeTextPrompt as ie, sendUXSuggestion as L } from "@arcgis/ai-orchestrator";
1
+ import { Annotation as f, messagesStateReducer as j, StateGraph as M, START as P, END as F, NodeInterrupt as ct } from "@langchain/langgraph/web";
2
+ import { invokeToolPrompt as k, sendTraceMessage as m, invokeStructuredPrompt as Ae, invokeTextPrompt as Ne, sendUXSuggestion as L } from "@arcgis/ai-orchestrator";
3
3
  import { tool as b } from "@langchain/core/tools";
4
- import ct from "@arcgis/core/Graphic.js";
5
- import le from "@arcgis/core/geometry/Point.js";
6
- import Ne from "@arcgis/core/geometry/Extent.js";
7
- import dt from "@arcgis/core/symbols/PictureMarkerSymbol.js";
8
- import { addressToLocations as ut } from "@arcgis/core/rest/locator.js";
9
- import G from "@arcgis/core/portal/Portal.js";
10
- import ne from "@arcgis/core/config.js";
11
- import s, { z as k } from "zod";
12
- import { HumanMessage as ze, AIMessage as K } from "@langchain/core/messages";
13
- import { ToolNode as P } from "@langchain/langgraph/prebuilt";
4
+ import dt from "@arcgis/core/Graphic.js";
5
+ import ie from "@arcgis/core/geometry/Point.js";
6
+ import ke from "@arcgis/core/geometry/Extent.js";
7
+ import ut from "@arcgis/core/symbols/PictureMarkerSymbol.js";
8
+ import { addressToLocations as ht } from "@arcgis/core/rest/locator.js";
9
+ import O from "@arcgis/core/portal/Portal.js";
10
+ import se from "@arcgis/core/config.js";
11
+ import n, { z as N } from "zod";
12
+ import { HumanMessage as ze, AIMessage as te } from "@langchain/core/messages";
13
+ import { ToolNode as z } from "@langchain/langgraph/prebuilt";
14
14
  import _e from "@arcgis/core/layers/support/FeatureEffect.js";
15
- import U from "@arcgis/core/layers/support/FeatureFilter.js";
16
- import * as ce from "@arcgis/core/geometry/operators/unionOperator.js";
17
- import de from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
18
- import ue from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
15
+ import K from "@arcgis/core/layers/support/FeatureFilter.js";
16
+ import * as le from "@arcgis/core/geometry/operators/unionOperator.js";
17
+ import ce from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
18
+ import de from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
19
19
  import je from "@arcgis/core/rest/support/TopFeaturesQuery.js";
20
20
  import Me from "@arcgis/core/rest/support/TopFilter.js";
21
- import * as ht from "@arcgis/core/geometry/operators/bufferOperator.js";
22
- import mt from "@arcgis/core/rest/support/Query.js";
23
- import { createRenderer as pt } from "@arcgis/core/smartMapping/renderers/pieChart.js";
24
- import { getSchemesByTag as yt, getSchemes as ft } from "@arcgis/core/smartMapping/symbology/pieChart.js";
25
- import { getBackgroundColorTheme as xe } from "@arcgis/core/views/support/colorUtils.js";
26
- import { createAgeRenderer as gt, createContinuousRenderer as wt } from "@arcgis/core/smartMapping/renderers/color.js";
27
- import { getSchemesByTag as he } from "@arcgis/core/smartMapping/symbology/color.js";
28
- import { createContinuousRenderer as bt } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
29
- import { createRenderer as St } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
30
- import { getSchemesByTag as vt } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
31
- import { createRenderer as Tt } from "@arcgis/core/smartMapping/renderers/heatmap.js";
32
- import { getSchemesByTag as xt } from "@arcgis/core/smartMapping/symbology/heatmap.js";
33
- import { createRenderer as Et } from "@arcgis/core/smartMapping/renderers/predominance.js";
34
- import { getSchemesByTag as $t } from "@arcgis/core/smartMapping/symbology/predominance.js";
35
- import { createRenderer as Ft } from "@arcgis/core/smartMapping/renderers/relationship.js";
36
- import { getSchemesByTag as Rt } from "@arcgis/core/smartMapping/symbology/relationship.js";
37
- import { createAgeRenderer as Lt, createContinuousRenderer as It } from "@arcgis/core/smartMapping/renderers/size.js";
38
- import { createRenderer as qt } from "@arcgis/core/smartMapping/renderers/type.js";
39
- import { getSchemesByTag as Ct } from "@arcgis/core/smartMapping/symbology/type.js";
21
+ import * as mt from "@arcgis/core/geometry/operators/bufferOperator.js";
22
+ import pt from "@arcgis/core/rest/support/Query.js";
23
+ import { createRenderer as yt } from "@arcgis/core/smartMapping/renderers/pieChart.js";
24
+ import { getSchemesByTag as gt, getSchemes as ft } from "@arcgis/core/smartMapping/symbology/pieChart.js";
25
+ import { getBackgroundColorTheme as Te } from "@arcgis/core/views/support/colorUtils.js";
26
+ import { createAgeRenderer as wt, createContinuousRenderer as bt } from "@arcgis/core/smartMapping/renderers/color.js";
27
+ import { getSchemesByTag as ue } from "@arcgis/core/smartMapping/symbology/color.js";
28
+ import { createContinuousRenderer as St } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
29
+ import { createRenderer as vt } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
30
+ import { getSchemesByTag as Tt } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
31
+ import { createRenderer as xt } from "@arcgis/core/smartMapping/renderers/heatmap.js";
32
+ import { getSchemesByTag as Et } from "@arcgis/core/smartMapping/symbology/heatmap.js";
33
+ import { createRenderer as $t } from "@arcgis/core/smartMapping/renderers/predominance.js";
34
+ import { getSchemesByTag as Ft } from "@arcgis/core/smartMapping/symbology/predominance.js";
35
+ import { createRenderer as Rt } from "@arcgis/core/smartMapping/renderers/relationship.js";
36
+ import { getSchemesByTag as Lt } from "@arcgis/core/smartMapping/symbology/relationship.js";
37
+ import { createAgeRenderer as It, createContinuousRenderer as qt } from "@arcgis/core/smartMapping/renderers/size.js";
38
+ import { createRenderer as Ct } from "@arcgis/core/smartMapping/renderers/type.js";
39
+ import { getSchemesByTag as At } from "@arcgis/core/smartMapping/symbology/type.js";
40
40
  import Pe from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
41
- import Ee from "@arcgis/core/request.js";
42
- import $e from "@arcgis/core/identity/IdentityManager.js";
43
- import { executeQueryStreaming as At } from "@arcgis/core/rest/knowledgeGraphService.js";
41
+ import xe from "@arcgis/core/request.js";
42
+ import Ee from "@arcgis/core/identity/IdentityManager.js";
43
+ import { executeQueryStreaming as Nt } from "@arcgis/core/rest/knowledgeGraphService.js";
44
44
  import kt from "@arcgis/core/WebLinkChart.js";
45
- const De = g.Root({
45
+ const De = f.Root({
46
46
  // messages: comes from global chat history.
47
47
  // It is safe to append new messages locally, but existing message objects
48
48
  // must be treated as read-only and never mutated.
49
- messages: g({
50
- reducer: z,
49
+ messages: f({
50
+ reducer: j,
51
51
  default: () => []
52
52
  }),
53
53
  // Accumulates user-visible output across graph nodes.
54
54
  // Uses append semantics, but de-duplicates identical consecutive writes.
55
55
  // This avoids duplicate output when tool nodes and final LLM nodes
56
56
  // emit the same text during a single agent turn.
57
- outputMessage: g({
57
+ outputMessage: f({
58
58
  reducer: (e = "", t) => {
59
59
  const r = typeof t == "string" ? t.trim() : "";
60
60
  if (!r)
@@ -73,124 +73,124 @@ ${r}`;
73
73
  },
74
74
  default: () => ""
75
75
  }),
76
- intent: g({
76
+ intent: f({
77
77
  reducer: (e, t) => t
78
78
  }),
79
- vectorSearchLayerResults: g({
79
+ vectorSearchLayerResults: f({
80
80
  reducer: (e, t) => t,
81
81
  default: () => []
82
82
  }),
83
- vectorSearchFieldResults: g({
83
+ vectorSearchFieldResults: f({
84
84
  reducer: (e, t) => t
85
85
  })
86
86
  });
87
- async function Nt(e, t) {
88
- const a = G.getDefault().helperServices, o = a.geocode.find((Q) => Q.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
87
+ async function zt(e, t) {
88
+ const a = O.getDefault().helperServices, o = a.geocode.find((Q) => Q.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
89
89
  if (!o)
90
90
  throw new Error("No geocoding service found in helperServices.");
91
- const n = o.url, i = `${ne.assetsPath?.endsWith("/") ? ne.assetsPath : `${ne.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await ut(n, {
91
+ const s = o.url, i = `${se.assetsPath?.endsWith("/") ? se.assetsPath : `${se.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await ht(s, {
92
92
  address: { SingleLine: e },
93
93
  outFields: ["Match_addr"]
94
94
  }))?.[0];
95
95
  if (!c?.extent)
96
96
  throw new Error(`Could not find location for: ${e}`);
97
- const { xmin: d, ymin: u, xmax: h, ymax: p, spatialReference: f } = c.extent, T = new Ne({
97
+ const { xmin: d, ymin: u, xmax: h, ymax: p, spatialReference: g } = c.extent, T = new ke({
98
98
  xmin: d,
99
99
  ymin: u,
100
100
  xmax: h,
101
101
  ymax: p,
102
- spatialReference: f
103
- }), y = (d + h) / 2, w = (u + p) / 2, E = new le({
102
+ spatialReference: g
103
+ }), y = (d + h) / 2, w = (u + p) / 2, E = new ie({
104
104
  x: y,
105
105
  y: w,
106
- spatialReference: f
107
- }), $ = new dt({
106
+ spatialReference: g
107
+ }), $ = new ut({
108
108
  url: i,
109
109
  width: 24,
110
110
  height: 24
111
- }), v = new ct({
111
+ }), v = new dt({
112
112
  geometry: E,
113
113
  symbol: $
114
114
  });
115
- return t.graphics.removeAll(), t.graphics.add(v), await t.goTo(T), `Successfully zoomed to: ${e}. Location coordinates: x=${y}, y=${w}, wkid=${f.wkid}`;
115
+ return t.graphics.removeAll(), t.graphics.add(v), await t.goTo(T), `Successfully zoomed to: ${e}. Location coordinates: x=${y}, y=${w}, wkid=${g.wkid}`;
116
116
  }
117
- const zt = ["mapView"];
117
+ const _t = ["mapView"];
118
118
  function I(e) {
119
119
  const r = e?.configurable?.context;
120
120
  if (!r || typeof r != "object")
121
121
  throw new Error("NavigationAgent context missing");
122
- const a = zt.filter((o) => !(o in r));
122
+ const a = _t.filter((o) => !(o in r));
123
123
  if (a.length)
124
124
  throw new Error(`NavigationAgent context missing: ${a.join(", ")}`);
125
125
  return r;
126
126
  }
127
- async function _t({ address: e }, t) {
127
+ async function jt({ address: e }, t) {
128
128
  const { mapView: r } = I(t);
129
- return await Nt(e, r);
129
+ return await zt(e, r);
130
130
  }
131
- const jt = s.object({
132
- address: s.string().describe("The full address or place name to locate.")
133
- }), Mt = b(_t, {
131
+ const Mt = n.object({
132
+ address: n.string().describe("The full address or place name to locate.")
133
+ }), Pt = b(jt, {
134
134
  name: "goToAddress",
135
135
  description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
136
- schema: jt
136
+ schema: Mt
137
137
  });
138
- async function Pt(e, t) {
138
+ async function Dt(e, t) {
139
139
  const a = t.map.bookmarks;
140
140
  if (!a || a.length === 0)
141
141
  throw new Error("No bookmarks found in the map.");
142
142
  const o = a.find((i) => i.name === e);
143
143
  if (!o)
144
144
  throw new Error(`Bookmark with name "${e}" not found.`);
145
- const n = o.viewpoint;
146
- if (!n)
145
+ const s = o.viewpoint;
146
+ if (!s)
147
147
  throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
148
- return await t.goTo(n), `Navigated to bookmark: ${e}`;
148
+ return await t.goTo(s), `Navigated to bookmark: ${e}`;
149
149
  }
150
- async function Dt({ bookmarkName: e }, t) {
150
+ async function Gt({ bookmarkName: e }, t) {
151
151
  const { mapView: r } = I(t);
152
- return await Promise.resolve(Pt(e, r));
152
+ return await Promise.resolve(Dt(e, r));
153
153
  }
154
- const Ot = k.object({
155
- bookmarkName: k.string().describe("The name of the bookmark to navigate to.")
156
- }), Gt = b(Dt, {
154
+ const Ot = N.object({
155
+ bookmarkName: N.string().describe("The name of the bookmark to navigate to.")
156
+ }), Qt = b(Gt, {
157
157
  name: "goToBookmark",
158
158
  description: "Go to the extent of the bookmark with the given name.",
159
159
  schema: Ot
160
160
  });
161
- async function Qt(e, t, r) {
162
- const a = r.map?.allLayers.find((n) => n.id === e);
161
+ async function Vt(e, t, r) {
162
+ const a = r.map?.allLayers.find((s) => s.id === e);
163
163
  if (!a)
164
164
  return `Error: Layer with id ${e} not found`;
165
165
  const o = a.createQuery();
166
166
  o.where = t ?? "1=1";
167
167
  try {
168
- const { extent: n, count: i } = await a.queryExtent(o);
168
+ const { extent: s, count: i } = await a.queryExtent(o);
169
169
  if (i === 0)
170
170
  return `No features found in ${a.title} matching: ${t}`;
171
- if (n)
172
- await r.goTo(n);
171
+ if (s)
172
+ await r.goTo(s);
173
173
  else
174
174
  return `Error: Unable to determine extent for ${a.title}`;
175
175
  return `Successfully zoomed to ${i} feature(s) in ${a.title}`;
176
- } catch (n) {
177
- return console.error("Error in goToFeatures:", n), `Error: ${n instanceof Error ? n.message : "Unknown error"}`;
176
+ } catch (s) {
177
+ return console.error("Error in goToFeatures:", s), `Error: ${s instanceof Error ? s.message : "Unknown error"}`;
178
178
  }
179
179
  }
180
- async function Vt({ layerId: e, where: t }, r) {
180
+ async function Wt({ layerId: e, where: t }, r) {
181
181
  const { mapView: a } = I(r);
182
- return await Qt(e, t, a);
182
+ return await Vt(e, t, a);
183
183
  }
184
- const Wt = k.object({
185
- layerId: k.string().describe("The layerId of the layer to zoom to."),
186
- where: k.string().describe("The sql-92 where clause used to query features to zoom to")
187
- }), Bt = b(Vt, {
184
+ const Bt = N.object({
185
+ layerId: N.string().describe("The layerId of the layer to zoom to."),
186
+ where: N.string().describe("The sql-92 where clause used to query features to zoom to")
187
+ }), Kt = b(Wt, {
188
188
  name: "goToFeatures",
189
189
  description: "Go to the features that match the given filter related to the given layerId.",
190
- schema: Wt
190
+ schema: Bt
191
191
  });
192
- async function Kt(e) {
193
- const r = new Ne({
192
+ async function Ut(e) {
193
+ const r = new ke({
194
194
  xmin: -180,
195
195
  ymin: -90,
196
196
  xmax: 180,
@@ -199,16 +199,16 @@ async function Kt(e) {
199
199
  }).expand(0.7);
200
200
  return await e.goTo(r), "Successfully zoomed to world extent";
201
201
  }
202
- async function Ut(e, t) {
202
+ async function Ht(e, t) {
203
203
  const { mapView: r } = I(t);
204
- return await Kt(r);
204
+ return await Ut(r);
205
205
  }
206
- const Ht = k.object({}), Zt = b(Ut, {
206
+ const Zt = N.object({}), Jt = b(Ht, {
207
207
  name: "goToFullExtent",
208
208
  description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
209
- schema: Ht
209
+ schema: Zt
210
210
  });
211
- async function Jt(e) {
211
+ async function Yt(e) {
212
212
  const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
213
213
  if (r)
214
214
  await e.goTo(r);
@@ -216,16 +216,16 @@ async function Jt(e) {
216
216
  throw new Error("Initial extent is undefined");
217
217
  return "Successfully zoomed to home extent";
218
218
  }
219
- async function Yt(e, t) {
219
+ async function Xt(e, t) {
220
220
  const { mapView: r } = I(t);
221
- return await Jt(r);
221
+ return await Yt(r);
222
222
  }
223
- const Xt = s.object({}), er = b(Yt, {
223
+ const er = n.object({}), tr = b(Xt, {
224
224
  name: "goToHomeExtent",
225
225
  description: "Go to the initial web map view extent",
226
- schema: Xt
226
+ schema: er
227
227
  });
228
- async function tr(e, t) {
228
+ async function rr(e, t) {
229
229
  await t.when();
230
230
  const r = t.map?.allLayers.find((o) => o.id === e);
231
231
  if (!r)
@@ -233,34 +233,34 @@ async function tr(e, t) {
233
233
  let a;
234
234
  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.";
235
235
  }
236
- async function rr({ layerId: e }, t) {
236
+ async function ar({ layerId: e }, t) {
237
237
  const { mapView: r } = I(t);
238
- return await tr(e, r);
238
+ return await rr(e, r);
239
239
  }
240
- const ar = k.object({
241
- layerId: k.string().describe("The id of the layer to navigate to")
242
- }), or = b(rr, {
240
+ const or = N.object({
241
+ layerId: N.string().describe("The id of the layer to navigate to")
242
+ }), sr = b(ar, {
243
243
  name: "goToLayer",
244
244
  description: "Zooms the map view to the full extent of the top matching layer.",
245
- schema: ar
245
+ schema: or
246
246
  });
247
247
  async function nr(e, t) {
248
248
  return await t.goTo({ scale: e }), `Successfully zoomed to: ${e}`;
249
249
  }
250
- async function sr({ scale: e }, t) {
250
+ async function ir({ scale: e }, t) {
251
251
  const { mapView: r } = I(t);
252
252
  return await nr(e, r);
253
253
  }
254
- const ir = s.object({
255
- scale: s.number().describe("The map scale of the view to go to.")
256
- }), lr = b(sr, {
254
+ const lr = n.object({
255
+ scale: n.number().describe("The map scale of the view to go to.")
256
+ }), cr = b(ir, {
257
257
  name: "goToScale",
258
258
  description: "Go to the specified view scale.",
259
- schema: ir
259
+ schema: lr
260
260
  });
261
- async function cr(e, t, r) {
261
+ async function dr(e, t, r) {
262
262
  const o = {
263
- target: new le({
263
+ target: new ie({
264
264
  longitude: e.longitude,
265
265
  latitude: e.latitude,
266
266
  spatialReference: { wkid: 4326 }
@@ -272,57 +272,57 @@ async function cr(e, t, r) {
272
272
  r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
273
273
  ].filter(Boolean).join(", ")}`;
274
274
  }
275
- async function dr({
275
+ async function ur({
276
276
  center: e,
277
277
  zoom: t,
278
278
  scale: r
279
279
  }, a) {
280
280
  const { mapView: o } = I(a);
281
- return await cr(e, o, { zoom: t, scale: r });
281
+ return await dr(e, o, { zoom: t, scale: r });
282
282
  }
283
- const ur = s.object({
284
- center: s.object({
285
- longitude: s.number().describe("The longitude (x-coordinate) of the point to navigate to."),
286
- latitude: s.number().describe("The latitude (y-coordinate) of the point to navigate to.")
283
+ const hr = n.object({
284
+ center: n.object({
285
+ longitude: n.number().describe("The longitude (x-coordinate) of the point to navigate to."),
286
+ latitude: n.number().describe("The latitude (y-coordinate) of the point to navigate to.")
287
287
  }),
288
- zoom: s.number().optional().describe("The zoom level. Higher values = more zoomed in."),
289
- scale: s.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
290
- }), hr = b(dr, {
288
+ zoom: n.number().optional().describe("The zoom level. Higher values = more zoomed in."),
289
+ scale: n.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
290
+ }), mr = b(ur, {
291
291
  name: "goToViewpoint",
292
292
  description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
293
- schema: ur
293
+ schema: hr
294
294
  });
295
- async function mr(e, t) {
295
+ async function pr(e, t) {
296
296
  return await t.goTo({ zoom: e }), `Successfully zoomed to: ${e}`;
297
297
  }
298
- async function pr({ zoom: e }, t) {
298
+ async function yr({ zoom: e }, t) {
299
299
  const { mapView: r } = I(t);
300
- return await mr(e, r);
300
+ return await pr(e, r);
301
301
  }
302
- const yr = s.object({
303
- zoom: s.number().min(1).max(20).describe("The zoom level of the view to go to.")
304
- }), fr = b(pr, {
302
+ const gr = n.object({
303
+ zoom: n.number().min(1).max(20).describe("The zoom level of the view to go to.")
304
+ }), fr = b(yr, {
305
305
  name: "goToZoom",
306
306
  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.).',
307
- schema: yr
308
- }), me = [
309
- Mt,
310
- Gt,
311
- Bt,
312
- Zt,
313
- er,
314
- or,
315
- lr,
316
- hr,
307
+ schema: gr
308
+ }), he = [
309
+ Pt,
310
+ Qt,
311
+ Kt,
312
+ Jt,
313
+ tr,
314
+ sr,
315
+ cr,
316
+ mr,
317
317
  fr
318
- ], Fe = /* @__PURE__ */ Object.assign({
318
+ ], $e = /* @__PURE__ */ Object.assign({
319
319
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md": () => import("./arcgis_knowledge_current_lc_context-BIA49RO2.js").then((e) => e.default),
320
320
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_intent_prompt.md": () => import("./arcgis_knowledge_intent_prompt-AaXBzNVW.js").then((e) => e.default),
321
321
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md": () => import("./arcgis_knowledge_tool_prompt-459P6qrK.js").then((e) => e.default),
322
322
  "../agents/dataExploration/prompts/data_explore_filter_prompt.md": () => import("./data_explore_filter_prompt-BPOAIqs_.js").then((e) => e.default),
323
323
  "../agents/dataExploration/prompts/data_explore_query_prompt.md": () => import("./data_explore_query_prompt-CuTod2tk.js").then((e) => e.default),
324
324
  "../agents/dataExploration/prompts/summarize_query_response_prompt.md": () => import("./summarize_query_response_prompt-B9bQLnuT.js").then((e) => e.default),
325
- "../agents/help/prompts/help_prompt.md": () => import("./help_prompt-wgcBcna5.js").then((e) => e.default),
325
+ "../agents/help/prompts/help_prompt.md": () => import("./help_prompt-9_7NHCT0.js").then((e) => e.default),
326
326
  "../agents/layerFilter/prompts/layer_filter_prompt.md": () => import("./layer_filter_prompt-0ujK87_y.js").then((e) => e.default),
327
327
  "../agents/layerQuery/prompts/data_query_prompt.md": () => import("./data_query_prompt-N4YzctpM.js").then((e) => e.default),
328
328
  "../agents/layerQuery/prompts/summarize_query_response_prompt.md": () => import("./summarize_query_response_prompt-DBJy1AAu.js").then((e) => e.default),
@@ -330,46 +330,46 @@ const yr = s.object({
330
330
  "../agents/navigation/prompts/navigation_intent_prompt.md": () => import("./navigation_intent_prompt-zcuSWrlv.js").then((e) => e.default),
331
331
  "../agents/navigation/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt-C2jIBkeu.js").then((e) => e.default)
332
332
  });
333
- async function F(e) {
334
- const t = Object.entries(Fe).find(([r]) => r.endsWith(`/${e}.md`));
333
+ async function R(e) {
334
+ const t = Object.entries($e).find(([r]) => r.endsWith(`/${e}.md`));
335
335
  if (!t)
336
336
  throw new Error(`Prompt not found: ${e}
337
337
  Available prompts:
338
- ${Object.keys(Fe).join(`
338
+ ${Object.keys($e).join(`
339
339
  `)}`);
340
340
  return await t[1]();
341
341
  }
342
- const gr = (e, t = 3) => e.filter((r) => r instanceof ze).slice(-t), x = (e, t = 3) => {
343
- const r = e.map((o, n) => o instanceof ze ? n : -1).filter((o) => o !== -1);
342
+ const wr = (e, t = 3) => e.filter((r) => r instanceof ze).slice(-t), x = (e, t = 3) => {
343
+ const r = e.map((o, s) => o instanceof ze ? s : -1).filter((o) => o !== -1);
344
344
  if (r.length === 0)
345
345
  return [];
346
346
  const a = r.length > t ? r[r.length - t] : r[0];
347
347
  return e.slice(a);
348
- }, C = (e, t = " ") => gr(e).map((o) => o.content).join(t).trim();
349
- async function wr(e, t) {
350
- const r = await F("navigation_tool_prompt"), { mapView: a } = I(t), o = a.map, n = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
348
+ }, C = (e, t = " ") => wr(e).map((o) => o.content).join(t).trim();
349
+ async function br(e, t) {
350
+ const r = await R("navigation_tool_prompt"), { mapView: a } = I(t), o = a.map, s = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
351
351
  (y, w) => `${w + 1}. layerId=${y.id} | title=${y.title ?? ""} | name=${y.name ?? ""} | score=${y.score.toFixed(2)}`
352
352
  ).join(`
353
353
  `) : "", i = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", l = e.intent === "goToBookmark" && o.bookmarks?.length ? `Available bookmarks:
354
354
  ${JSON.stringify(o.bookmarks, null, 2)}` : "", c = (e.intent === "goToLayer" || e.intent === "goToFeatures") && e.vectorSearchLayerResults?.length ? `Candidate layers:
355
- ${n}` : "", d = e.intent === "goToFeatures" && e.vectorSearchFieldResults?.length ? `Candidate fields:
355
+ ${s}` : "", d = e.intent === "goToFeatures" && e.vectorSearchFieldResults?.length ? `Candidate fields:
356
356
  ${i}` : "", u = {
357
357
  intent: e.intent,
358
358
  bookmarksSection: l,
359
359
  layersSection: c,
360
360
  fieldsSection: d,
361
361
  currentZoom: a.zoom
362
- }, h = await M({
362
+ }, h = await k({
363
363
  promptText: r,
364
364
  modelTier: "advanced",
365
365
  messages: x(e.messages),
366
366
  inputVariables: u,
367
- tools: me
367
+ tools: he
368
368
  }), p = [...e.messages, h], T = (h.tool_calls?.length ?? 0) > 0 ? [...p] : [...p, h];
369
369
  return { ...e, messages: T };
370
370
  }
371
- async function br(e, t) {
372
- const a = await new P(me).invoke(
371
+ async function Sr(e, t) {
372
+ const a = await new z(he).invoke(
373
373
  {
374
374
  messages: x(e.messages)
375
375
  },
@@ -377,23 +377,23 @@ async function br(e, t) {
377
377
  ), o = a.messages.map((l) => l.text).join(`
378
378
  `);
379
379
  await m({ text: `Finished executing navigation tool: ${o}` }, t);
380
- const n = [...e.messages, ...a.messages], i = a.messages.map((l) => l.text).join(`
380
+ const s = [...e.messages, ...a.messages], i = a.messages.map((l) => l.text).join(`
381
381
  `);
382
- return { ...e, messages: n, outputMessage: i };
382
+ return { ...e, messages: s, outputMessage: i };
383
383
  }
384
- async function Sr(e, t) {
385
- const r = await F("navigation_intent_prompt"), { mapView: a } = I(t), o = me.map((h) => ({
384
+ async function vr(e, t) {
385
+ const r = await R("navigation_intent_prompt"), { mapView: a } = I(t), o = he.map((h) => ({
386
386
  name: h.name,
387
387
  description: h.description,
388
388
  schema: h.schema
389
- })), n = a.map, i = n.bookmarks?.length ? `Available bookmarks:
390
- ${JSON.stringify(n.bookmarks, null, 2)}` : "", l = {
391
- tools: o.map(({ name: h, description: p, schema: f }) => `${h}: ${p}, ${JSON.stringify(f)}`).join(`
389
+ })), s = a.map, i = s.bookmarks?.length ? `Available bookmarks:
390
+ ${JSON.stringify(s.bookmarks, null, 2)}` : "", l = {
391
+ tools: o.map(({ name: h, description: p, schema: g }) => `${h}: ${p}, ${JSON.stringify(g)}`).join(`
392
392
  `),
393
393
  bookmarks: i
394
- }, c = s.object({
395
- intent: s.string()
396
- }), d = await ke({
394
+ }, c = n.object({
395
+ intent: n.string()
396
+ }), d = await Ae({
397
397
  promptText: r,
398
398
  messages: x(e.messages),
399
399
  inputVariables: l,
@@ -406,14 +406,14 @@ const S = (e, t) => {
406
406
  if (a == null)
407
407
  throw new Error(`${t} missing in config.configurable.services`);
408
408
  return a;
409
- }, vr = 0.7, Tr = async (e, t) => {
409
+ }, Tr = 0.7, xr = async (e, t) => {
410
410
  try {
411
411
  const r = C(e.messages);
412
412
  await m({ text: `Similarity search to find layers: ${r}` }, t);
413
- const a = S(t, "layerSearch"), o = S(t, "layersAndFieldsRegistry"), n = S(t, "embeddingCache"), l = (await a.searchLayers({
413
+ const a = S(t, "layerSearch"), o = S(t, "layersAndFieldsRegistry"), s = S(t, "embeddingCache"), l = (await a.searchLayers({
414
414
  text: r,
415
- minScore: vr,
416
- embeddingCache: n
415
+ minScore: Tr,
416
+ embeddingCache: s
417
417
  })).map(({ id: d, score: u }) => {
418
418
  const h = o.get(d)?.layerItem;
419
419
  return {
@@ -436,29 +436,29 @@ ${l.map((d) => `- layerId=${d.id} | title=${d.title ?? ""} | name=${d.name ?? ""
436
436
  t
437
437
  ), r;
438
438
  }
439
- }, Re = 0.7, xr = 10, Er = async (e, t) => {
439
+ }, Fe = 0.7, Er = 10, $r = async (e, t) => {
440
440
  try {
441
441
  const r = C(e.messages);
442
442
  await m({ text: "Similarity search to find fields" }, t);
443
- const a = S(t, "fieldSearch"), o = S(t, "layersAndFieldsRegistry"), n = S(t, "embeddingCache"), i = e.vectorSearchLayerResults?.map((u) => u.id) ?? [];
443
+ const a = S(t, "fieldSearch"), o = S(t, "layersAndFieldsRegistry"), s = S(t, "embeddingCache"), i = e.vectorSearchLayerResults?.map((u) => u.id) ?? [];
444
444
  if (i.length === 0)
445
445
  return await m({ text: "No candidate layers for field search" }, t), e;
446
446
  const c = (await a.searchFields({
447
447
  text: r,
448
448
  layerIds: i,
449
- minScore: Re,
450
- topResults: xr,
451
- embeddingCache: n
449
+ minScore: Fe,
450
+ topResults: Er,
451
+ embeddingCache: s
452
452
  })).map(({ layerId: u, results: h }) => {
453
453
  const p = o.get(u)?.fieldRegistry;
454
454
  return {
455
455
  layerId: u,
456
456
  layerName: o.get(u)?.layerItem.name,
457
- results: h.map((f) => {
458
- const T = p?.get(f.name);
457
+ results: h.map((g) => {
458
+ const T = p?.get(g.name);
459
459
  return {
460
- name: f.name,
461
- score: f.score,
460
+ name: g.name,
461
+ score: g.score,
462
462
  type: T?.type,
463
463
  alias: T?.alias,
464
464
  description: T?.description,
@@ -474,7 +474,7 @@ ${c.map(
474
474
  ${u.results.map((h) => ` - ${h.name} (${h.score.toFixed(2)})`).join(`
475
475
  `)}`
476
476
  ).join(`
477
- `)}` : d = `No vector search field results found for score over ${Re}.`, await m({ text: d }, t), {
477
+ `)}` : d = `No vector search field results found for score over ${Fe}.`, await m({ text: d }, t), {
478
478
  ...e,
479
479
  vectorSearchFieldResults: c
480
480
  };
@@ -486,11 +486,11 @@ ${u.results.map((h) => ` - ${h.name} (${h.score.toFixed(2)})`).join(`
486
486
  }
487
487
  }, D = (e, t) => (r, a) => {
488
488
  const o = a?.configurable?.services;
489
- for (const n of e)
490
- if (!o?.[n])
491
- throw new Error(`${t} requires services.${n} to be available.`);
489
+ for (const s of e)
490
+ if (!o?.[s])
491
+ throw new Error(`${t} requires services.${s} to be available.`);
492
492
  return r;
493
- }, $r = (e, t) => D(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), Fr = () => new _(De).addNode("requireNavigationServices", $r).addNode("intentLLM", Sr).addNode("vectorSearchLayers", Tr).addNode("vectorSearchFields", Er).addNode("agent", wr).addNode("tools", br).addEdge(j, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
493
+ }, Fr = (e, t) => D(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), Rr = () => new M(De).addNode("requireNavigationServices", Fr).addNode("intentLLM", vr).addNode("vectorSearchLayers", xr).addNode("vectorSearchFields", $r).addNode("agent", br).addNode("tools", Sr).addEdge(P, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
494
494
  "intentLLM",
495
495
  (t) => t.intent === "goToLayer" || t.intent === "goToFeatures" ? "vectorSearchLayers" : "agent",
496
496
  {
@@ -504,7 +504,7 @@ ${u.results.map((h) => ` - ${h.name} (${h.score.toFixed(2)})`).join(`
504
504
  vectorSearchFields: "vectorSearchFields",
505
505
  agent: "agent"
506
506
  }
507
- ).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", R), Rr = String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
507
+ ).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", F), Lr = String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
508
508
  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.
509
509
 
510
510
  Supported actions:
@@ -523,23 +523,23 @@ ${u.results.map((h) => ` - ${h.name} (${h.score.toFixed(2)})`).join(`
523
523
  _Example: “Center the map on San Francisco at scale 50000”_
524
524
  _Example: “Zoom to the features in the schools layer where city = 'Austin'”_
525
525
  _Example: “Go to the Downtown bookmark”_
526
- _Example: “Where is Mount Rainier?”_`, Ii = {
526
+ _Example: “Where is Mount Rainier?”_`, ki = {
527
527
  id: "navigation",
528
528
  name: "Navigation Agent",
529
- description: Rr,
530
- createGraph: Fr,
529
+ description: Lr,
530
+ createGraph: Rr,
531
531
  workspace: De
532
- }, Oe = g.Root({
532
+ }, Ge = f.Root({
533
533
  // Inputs coming from global context
534
- messages: g({
535
- reducer: z,
534
+ messages: f({
535
+ reducer: j,
536
536
  default: () => []
537
537
  }),
538
538
  // Accumulates user-visible output across graph nodes.
539
539
  // Uses append semantics, but de-duplicates identical consecutive writes.
540
540
  // This avoids duplicate output when tool nodes and final LLM nodes
541
541
  // emit the same text during a single agent turn.
542
- outputMessage: g({
542
+ outputMessage: f({
543
543
  reducer: (e = "", t) => {
544
544
  const r = typeof t == "string" ? t.trim() : "";
545
545
  if (!r)
@@ -558,11 +558,11 @@ ${r}`;
558
558
  },
559
559
  default: () => ""
560
560
  }),
561
- vectorSearchLayerIds: g(),
562
- vectorSearchFieldResults: g(),
563
- layerFieldInfo: g(),
564
- queryResponse: g()
565
- }), Lr = async (e, t) => (await m({ text: "Exiting Data Exploration agent" }, t), e), H = async (e, t) => {
561
+ vectorSearchLayerIds: f(),
562
+ vectorSearchFieldResults: f(),
563
+ layerFieldInfo: f(),
564
+ queryResponse: f()
565
+ }), Ir = async (e, t) => (await m({ text: "Exiting Data Exploration agent" }, t), e), U = async (e, t) => {
566
566
  const r = e.tool_calls ?? [];
567
567
  if (r.length === 0) {
568
568
  await m({ text: `LLM did not request any tool calls: ${String(e?.content)}` }, t);
@@ -576,55 +576,55 @@ ${r}`;
576
576
  )
577
577
  )
578
578
  );
579
- }, Ir = ["mapView"];
580
- function N(e) {
579
+ }, qr = ["mapView"];
580
+ function _(e) {
581
581
  const r = e?.configurable?.context;
582
582
  if (!r || typeof r != "object")
583
583
  throw new Error("DataExplorationAgent context missing");
584
- const a = Ir.filter((o) => !(o in r));
584
+ const a = qr.filter((o) => !(o in r));
585
585
  if (a.length)
586
586
  throw new Error(`DataExplorationAgent context missing: ${a.join(", ")}`);
587
587
  return r;
588
588
  }
589
- const qr = (e) => {
589
+ const Cr = (e) => {
590
590
  const t = e.map?.allLayers.filter((a) => a.type === "feature");
591
591
  let r = 0;
592
592
  return t?.forEach((a) => {
593
593
  const o = a;
594
594
  o.featureEffect && (o.featureEffect = null, r++);
595
595
  }), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
596
- }, Cr = async (e, t) => {
597
- const { mapView: r } = N(t);
598
- return qr(r);
599
- }, Ar = b(Cr, {
596
+ }, Ar = async (e, t) => {
597
+ const { mapView: r } = _(t);
598
+ return Cr(r);
599
+ }, Nr = b(Ar, {
600
600
  name: "clearFilters",
601
601
  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.",
602
- schema: s.object({})
602
+ schema: n.object({})
603
603
  }), kr = async (e) => {
604
604
  e.map?.allLayers.filter((o) => o.type === "feature")?.forEach((o) => {
605
- const n = o;
606
- n.featureEffect && (n.featureEffect = null);
605
+ const s = o;
606
+ s.featureEffect && (s.featureEffect = null);
607
607
  });
608
608
  const a = e.map.initialViewProperties?.viewpoint?.targetGeometry;
609
609
  return a ? (await e.goTo(a), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
610
- }, Nr = async (e, t) => {
611
- const { mapView: r } = N(t);
610
+ }, zr = async (e, t) => {
611
+ const { mapView: r } = _(t);
612
612
  return await kr(r);
613
- }, zr = b(Nr, {
613
+ }, _r = b(zr, {
614
614
  name: "resetMap",
615
615
  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.",
616
- schema: s.object({})
616
+ schema: n.object({})
617
617
  });
618
- function X(e) {
618
+ function Y(e) {
619
619
  return "point" in e && e.point !== void 0;
620
620
  }
621
621
  function W(e) {
622
622
  return "layerId" in e && e.layerId !== void 0;
623
623
  }
624
624
  const re = async (e, t) => {
625
- if (X(e)) {
625
+ if (Y(e)) {
626
626
  const { point: r } = e;
627
- return { geometry: new le({
627
+ return { geometry: new ie({
628
628
  x: r.x,
629
629
  y: r.y,
630
630
  spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
@@ -648,12 +648,12 @@ const re = async (e, t) => {
648
648
  };
649
649
  let o;
650
650
  if (a.features.length === 1) {
651
- const n = a.features[0].geometry;
652
- if (!n)
651
+ const s = a.features[0].geometry;
652
+ if (!s)
653
653
  return { error: "The geometry of the first feature is undefined or null." };
654
- o = n;
654
+ o = s;
655
655
  } else {
656
- const n = a.features.map((l) => l.geometry), i = ce.executeMany(n);
656
+ const s = a.features.map((l) => l.geometry), i = le.executeMany(s);
657
657
  if (!i)
658
658
  return { error: "Failed to create a combined geometry." };
659
659
  o = i;
@@ -664,12 +664,12 @@ const re = async (e, t) => {
664
664
  }
665
665
  }
666
666
  return { error: "Invalid geometry configuration provided" };
667
- }, _r = async (e, t, r, a, o, n) => {
667
+ }, jr = async (e, t, r, a, o, s) => {
668
668
  const i = e.map?.allLayers.find((c) => c.id === t);
669
669
  if (!i)
670
670
  return { success: !1, error: `Layer '${t}' not found.` };
671
671
  const l = i.createQuery();
672
- l.where = r ?? "1=1", a && (l.geometry = a, l.spatialRelationship = "intersects", o && (l.distance = o), n && (l.units = n));
672
+ l.where = r ?? "1=1", a && (l.geometry = a, l.spatialRelationship = "intersects", o && (l.distance = o), s && (l.units = s));
673
673
  try {
674
674
  const { extent: c, count: d } = await i.queryExtent(l);
675
675
  return !c || d === 0 ? {
@@ -682,7 +682,7 @@ const re = async (e, t) => {
682
682
  error: c instanceof Error ? c.message : String(c)
683
683
  };
684
684
  }
685
- }, jr = async (e, t, r, a, o, n) => {
685
+ }, Mr = async (e, t, r, a, o, s) => {
686
686
  const i = t.map?.allLayers.find(
687
687
  (u) => u.id === e.layerId
688
688
  );
@@ -696,7 +696,7 @@ const re = async (e, t) => {
696
696
  l = u.geometry;
697
697
  }
698
698
  if (i.featureEffect = null, i.featureEffect = new _e({
699
- filter: new U({
699
+ filter: new K({
700
700
  where: e.where,
701
701
  geometry: l,
702
702
  spatialRelationship: "intersects",
@@ -705,9 +705,9 @@ const re = async (e, t) => {
705
705
  }),
706
706
  includedEffect: r,
707
707
  excludedEffect: a
708
- }), i.visible = !0, n)
708
+ }), i.visible = !0, s)
709
709
  return `Applied feature effects to "${i.title ?? e.layerId}" within current map extent.`;
710
- const c = await _r(
710
+ const c = await jr(
711
711
  t,
712
712
  e.layerId,
713
713
  e.where,
@@ -716,50 +716,50 @@ const re = async (e, t) => {
716
716
  o?.units
717
717
  ), d = i.title ?? e.layerId;
718
718
  return c.success ? `Applied feature effects to target layer "${i.title ?? e.layerId}"${o && "layerId" in o ? ` using geometry from layer "${o.layerId}"` : ""}.` : `Applied filter to "${d}" but no features matched. ${c.error}`;
719
- }, Mr = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], A = s.enum(Mr), Pr = async ({
719
+ }, Pr = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], A = n.enum(Pr), Dr = async ({
720
720
  targetLayer: e,
721
721
  geometryFilter: t,
722
722
  useCurrentExtent: r,
723
723
  includedEffect: a = "drop-shadow(2px, 2px, 2px, gray)",
724
724
  excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
725
- }, n) => {
726
- const { mapView: i } = N(n);
727
- return await jr(e, i, a, o, t, r);
728
- }, Dr = s.object({
729
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
730
- where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
731
- distance: s.number().optional().describe("The buffer distance around the geometry."),
725
+ }, s) => {
726
+ const { mapView: i } = _(s);
727
+ return await Mr(e, i, a, o, t, r);
728
+ }, Gr = n.object({
729
+ layerId: n.string().describe("The layerId of the layer containing the geometry by which to filter."),
730
+ where: n.string().describe("The SQL-92 where clause representing the features from which to filter."),
731
+ distance: n.number().optional().describe("The buffer distance around the geometry."),
732
732
  units: A.optional().describe("The units for the distance buffer.")
733
- }), Or = s.object({
734
- point: s.object({
735
- x: s.number().describe("X coordinate (longitude) from navigation result"),
736
- y: s.number().describe("Y coordinate (latitude) from navigation result"),
737
- spatialReference: s.object({
738
- wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
733
+ }), Or = n.object({
734
+ point: n.object({
735
+ x: n.number().describe("X coordinate (longitude) from navigation result"),
736
+ y: n.number().describe("Y coordinate (latitude) from navigation result"),
737
+ spatialReference: n.object({
738
+ wkid: n.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
739
739
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
740
740
  }).describe("Point coordinates from a previous navigation/geocoding result"),
741
- distance: s.number().optional().describe("Optional buffer distance around the point."),
741
+ distance: n.number().optional().describe("Optional buffer distance around the point."),
742
742
  units: A.optional().describe("The units for the distance buffer.")
743
- }), Gr = s.object({
744
- targetLayer: s.object({
745
- layerId: s.string().describe("The layerId of the layer on which to set a feature effect."),
746
- where: s.string().describe("The SQL-92 where clause representing the features to emphasize.")
743
+ }), Qr = n.object({
744
+ targetLayer: n.object({
745
+ layerId: n.string().describe("The layerId of the layer on which to set a feature effect."),
746
+ where: n.string().describe("The SQL-92 where clause representing the features to emphasize.")
747
747
  }),
748
- geometryFilter: s.union([Dr, Or]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
749
- useCurrentExtent: s.boolean().optional().describe(
748
+ geometryFilter: n.union([Gr, Or]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
749
+ useCurrentExtent: n.boolean().optional().describe(
750
750
  "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."
751
751
  ),
752
- includedEffect: s.string().default("drop-shadow(2px, 2px, 2px, gray)").describe(
752
+ includedEffect: n.string().default("drop-shadow(2px, 2px, 2px, gray)").describe(
753
753
  "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."
754
754
  ),
755
- excludedEffect: s.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
755
+ excludedEffect: n.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
756
756
  "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."
757
757
  )
758
- }), Qr = b(Pr, {
758
+ }), Vr = b(Dr, {
759
759
  name: "setFeatureEffect",
760
760
  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.",
761
- schema: Gr
762
- }), ee = (e, t, r) => {
761
+ schema: Qr
762
+ }), X = (e, t, r) => {
763
763
  if (e && typeof e != "function") {
764
764
  const a = "getField" in r && r.getField?.(e), o = a && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(a.name) : null;
765
765
  if (o?.type === "coded-value") {
@@ -768,11 +768,11 @@ const re = async (e, t) => {
768
768
  }
769
769
  }
770
770
  return null;
771
- }, Vr = (e, t, r) => {
771
+ }, Wr = (e, t, r) => {
772
772
  const a = e.createQuery();
773
773
  return a.outFields = [t], a.where = r || "1=1", a.num = 1, a;
774
- }, Wr = async (e, t, r, a) => {
775
- const o = a.map?.allLayers.find((h) => h.id === e), n = Vr(o, t, r.where), l = (await o.queryFeatures(n)).features[0], c = l ? l.attributes[t] : null, d = ee(t, c, o) || c;
774
+ }, Br = async (e, t, r, a) => {
775
+ const o = a.map?.allLayers.find((h) => h.id === e), s = Wr(o, t, r.where), l = (await o.queryFeatures(s)).features[0], c = l ? l.attributes[t] : null, d = X(t, c, o) || c;
776
776
  return {
777
777
  tool: "getAttribute",
778
778
  layerName: o.title ?? e,
@@ -784,33 +784,33 @@ const re = async (e, t) => {
784
784
  }
785
785
  };
786
786
  };
787
- async function Br({ layerId: e, fieldName: t, query: r }, a) {
788
- const { mapView: o } = N(a), n = await Wr(e, t, r, o);
789
- return JSON.stringify(n, null, 2);
790
- }
791
- const Kr = s.object({
792
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
793
- fieldName: s.string().describe("The name of the field/attribute from which to get a field value."),
794
- query: s.object({
795
- where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
787
+ async function Kr({ layerId: e, fieldName: t, query: r }, a) {
788
+ const { mapView: o } = _(a), s = await Br(e, t, r, o);
789
+ return JSON.stringify(s, null, 2);
790
+ }
791
+ const Ur = n.object({
792
+ layerId: n.string().describe("The layerId of the layer containing the field from which to get a value."),
793
+ fieldName: n.string().describe("The name of the field/attribute from which to get a field value."),
794
+ query: n.object({
795
+ where: n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
796
796
  })
797
- }), Ur = b(Br, {
797
+ }), Hr = b(Kr, {
798
798
  name: "getAttribute",
799
799
  description: "Returns an attribute value for a given feature.",
800
- schema: Kr
801
- }), pe = (e, t, r) => r ? e.hasAllFeaturesInView && e.availableFields === t : e.hasAllFeatures && e.availableFields === t;
802
- function te(e, t) {
800
+ schema: Ur
801
+ }), me = (e, t, r) => r ? e.hasAllFeaturesInView && e.availableFields === t : e.hasAllFeatures && e.availableFields === t;
802
+ function ee(e, t) {
803
803
  let r = e ?? "";
804
804
  return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
805
805
  }
806
- const Hr = async (e) => {
807
- const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: i } = e, l = o.map?.allLayers.find((v) => v.id === t.layerId);
806
+ const Zr = async (e) => {
807
+ const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: s, geometryFilter: i } = e, l = o.map?.allLayers.find((v) => v.id === t.layerId);
808
808
  if (!l)
809
809
  throw new Error(`Layer '${t.layerId}' not found.`);
810
- const c = await o.whenLayerView(l), u = n.get(t.layerId)?.fieldRegistry.get(r), h = u?.alias;
810
+ const c = await o.whenLayerView(l), u = s.get(t.layerId)?.fieldRegistry.get(r), h = u?.alias;
811
811
  if (!u)
812
812
  throw new Error(`Field '${r}' not found.`);
813
- let p, f;
813
+ let p, g;
814
814
  if (i) {
815
815
  const v = await re(i, o);
816
816
  if ("error" in v)
@@ -823,19 +823,19 @@ const Hr = async (e) => {
823
823
  distance: i.distance,
824
824
  units: i.units,
825
825
  applied: !0
826
- } : X(i) && (p = {
826
+ } : Y(i) && (p = {
827
827
  point: i.point,
828
828
  distance: i.distance,
829
829
  units: i.units,
830
830
  applied: !0
831
- }), f = new U({
831
+ }), g = new K({
832
832
  geometry: v.geometry,
833
833
  distance: i.distance,
834
834
  units: i.units,
835
835
  spatialRelationship: "intersects"
836
836
  });
837
837
  }
838
- const T = pe(c, [r], !1);
838
+ const T = me(c, [r], !1);
839
839
  let y = null, w = null;
840
840
  const E = 10;
841
841
  if (u.type !== "geometry" && u.type !== "oid" && u.type !== "global-id")
@@ -845,22 +845,22 @@ const Hr = async (e) => {
845
845
  useFeaturesInView: T,
846
846
  view: T ? o : void 0,
847
847
  field: r,
848
- sqlWhere: te(l.definitionExpression, t.where),
849
- ...f && { filter: f },
848
+ sqlWhere: ee(l.definitionExpression, t.where),
849
+ ...g && { filter: g },
850
850
  outStatisticTypes: { include: [a] }
851
851
  };
852
- y = await de(v);
852
+ y = await ce(v);
853
853
  const Q = ["string", "small-integer", "integer"], V = u.domain?.type === "coded-value" ? u.domain : null;
854
- (Q.includes(u.type) || V) && (w = (await ue({
854
+ (Q.includes(u.type) || V) && (w = (await de({
855
855
  layer: l,
856
856
  useFeaturesInView: T,
857
857
  view: T ? o : void 0,
858
858
  field: r,
859
- sqlWhere: te(l.definitionExpression, t.where),
860
- ...f && { filter: f }
861
- })).uniqueValueInfos.sort((O, it) => it.count - O.count).slice(0, E)), w && u.domain?.type === "coded-value" && (w = w.map((O) => ({
862
- ...O,
863
- value: V ? V.getName(O.value) ?? O.value : O.value
859
+ sqlWhere: ee(l.definitionExpression, t.where),
860
+ ...g && { filter: g }
861
+ })).uniqueValueInfos.sort((G, lt) => lt.count - G.count).slice(0, E)), w && u.domain?.type === "coded-value" && (w = w.map((G) => ({
862
+ ...G,
863
+ value: V ? V.getName(G.value) ?? G.value : G.value
864
864
  })));
865
865
  } catch (v) {
866
866
  console.error("Statistics error:", v);
@@ -881,48 +881,48 @@ const Hr = async (e) => {
881
881
  }
882
882
  };
883
883
  };
884
- async function Zr({
884
+ async function Jr({
885
885
  targetLayer: e,
886
886
  fieldName: t,
887
887
  statisticType: r,
888
888
  geometryFilter: a
889
889
  }, o) {
890
- const n = S(o, "layersAndFieldsRegistry"), { mapView: i } = N(o), l = await Hr({
890
+ const s = S(o, "layersAndFieldsRegistry"), { mapView: i } = _(o), l = await Zr({
891
891
  targetLayer: e,
892
892
  fieldName: t,
893
893
  statisticType: r,
894
894
  mapView: i,
895
- layersAndFieldsRegistry: n,
895
+ layersAndFieldsRegistry: s,
896
896
  geometryFilter: a
897
897
  });
898
898
  return JSON.stringify(l, null, 2);
899
899
  }
900
- const Jr = s.object({
901
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
902
- where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
903
- distance: s.number().optional().describe("The buffer distance around the geometry."),
900
+ const Yr = n.object({
901
+ layerId: n.string().describe("The layerId of the layer containing the geometry by which to filter."),
902
+ where: n.string().describe("The SQL-92 where clause representing the features from which to filter."),
903
+ distance: n.number().optional().describe("The buffer distance around the geometry."),
904
904
  units: A.optional().describe("The units for the distance buffer.")
905
- }), Yr = s.object({
906
- point: s.object({
907
- x: s.number().describe("X coordinate (longitude) from navigation result"),
908
- y: s.number().describe("Y coordinate (latitude) from navigation result"),
909
- spatialReference: s.object({
910
- wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
905
+ }), Xr = n.object({
906
+ point: n.object({
907
+ x: n.number().describe("X coordinate (longitude) from navigation result"),
908
+ y: n.number().describe("Y coordinate (latitude) from navigation result"),
909
+ spatialReference: n.object({
910
+ wkid: n.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
911
911
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
912
912
  }).describe("Point coordinates from a previous navigation/geocoding result"),
913
- distance: s.number().optional().describe("Optional buffer distance around the point."),
913
+ distance: n.number().optional().describe("Optional buffer distance around the point."),
914
914
  units: A.optional().describe("The units for the distance buffer.")
915
- }), Xr = s.object({
916
- targetLayer: s.object({
917
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
918
- where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
915
+ }), ea = n.object({
916
+ targetLayer: n.object({
917
+ layerId: n.string().describe("The layerId of the layer containing the field from which to get a value."),
918
+ where: n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
919
919
  }),
920
- geometryFilter: s.union([Jr, Yr]).optional().describe(
920
+ geometryFilter: n.union([Yr, Xr]).optional().describe(
921
921
  "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."
922
922
  ),
923
- fieldName: s.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
924
- statisticType: s.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
925
- }), ea = b(Zr, {
923
+ fieldName: n.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
924
+ statisticType: n.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
925
+ }), ta = b(Jr, {
926
926
  name: "getStatistics",
927
927
  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.
928
928
 
@@ -937,9 +937,9 @@ DO NOT USE FOR:
937
937
  - Simple counts of features matching a condition — use queryFeatures instead
938
938
 
939
939
  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.`,
940
- schema: Xr
941
- }), ta = async (e, t, r, a, o) => {
942
- const n = r.map?.allLayers.find((p) => p.id === e.layerId), i = await r.whenLayerView(n), l = n.title ?? e.layerId;
940
+ schema: ea
941
+ }), ra = async (e, t, r, a, o) => {
942
+ const s = r.map?.allLayers.find((p) => p.id === e.layerId), i = await r.whenLayerView(s), l = s.title ?? e.layerId;
943
943
  let c;
944
944
  if (a) {
945
945
  const p = await re(a, r);
@@ -961,7 +961,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
961
961
  };
962
962
  c = p.geometry;
963
963
  } else o && (c = r.extent.clone());
964
- const d = t.groupByFields && t.groupByFields.length > 0, u = n.objectIdField, h = e.outFields.length > 2 ? e.outFields : ["*"];
964
+ const d = t.groupByFields && t.groupByFields.length > 0, u = s.objectIdField, h = e.outFields.length > 2 ? e.outFields : ["*"];
965
965
  !h.includes("*") && !h.includes(u) && h.push(u);
966
966
  try {
967
967
  let p;
@@ -980,25 +980,25 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
980
980
  orderByFields: t.orderByFields
981
981
  })
982
982
  });
983
- p = await n.queryTopFeatures(y);
983
+ p = await s.queryTopFeatures(y);
984
984
  } else {
985
- const y = n.createQuery();
986
- y.where = te(n.definitionExpression, e.where || "1=1"), y.outFields = h, y.orderByFields = t.orderByFields, y.num = t.topCount, c && (y.geometry = c, y.spatialRelationship = "intersects"), a?.distance && (y.distance = a.distance), a?.units && (y.units = a.units), y.outSpatialReference = r.spatialReference;
987
- const w = pe(i, e.outFields, o ?? !1);
985
+ const y = s.createQuery();
986
+ y.where = ee(s.definitionExpression, e.where || "1=1"), y.outFields = h, y.orderByFields = t.orderByFields, y.num = t.topCount, c && (y.geometry = c, y.spatialRelationship = "intersects"), a?.distance && (y.distance = a.distance), a?.units && (y.units = a.units), y.outSpatialReference = r.spatialReference;
987
+ const w = me(i, e.outFields, o ?? !1);
988
988
  try {
989
- p = w ? await i.queryFeatures(y) : await n.queryFeatures(y);
989
+ p = w ? await i.queryFeatures(y) : await s.queryFeatures(y);
990
990
  } catch (E) {
991
- console.warn("Client-side query failed, falling back to server:", E), p = await n.queryFeatures(y);
991
+ console.warn("Client-side query failed, falling back to server:", E), p = await s.queryFeatures(y);
992
992
  }
993
993
  }
994
- const f = p.features.map((y) => y.attributes[u]), T = p.features.map((y) => {
994
+ const g = p.features.map((y) => y.attributes[u]), T = p.features.map((y) => {
995
995
  const w = y.attributes, E = {};
996
- return n.fields.forEach(($) => {
997
- if ($.name === n.objectIdField) {
996
+ return s.fields.forEach(($) => {
997
+ if ($.name === s.objectIdField) {
998
998
  E[$.name] = w[$.name];
999
999
  return;
1000
1000
  }
1001
- const v = w[$.name], Q = ee($.name, v, n), V = $.alias || $.name;
1001
+ const v = w[$.name], Q = X($.name, v, s), V = $.alias || $.name;
1002
1002
  E[V] = Q ?? v;
1003
1003
  }), E;
1004
1004
  });
@@ -1009,7 +1009,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1009
1009
  details: {
1010
1010
  topCount: t.topCount,
1011
1011
  attributes: T,
1012
- objectIds: f,
1012
+ objectIds: g,
1013
1013
  objectIdField: u,
1014
1014
  where: e.where,
1015
1015
  orderByFields: t.orderByFields,
@@ -1024,65 +1024,65 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1024
1024
  details: { error: p instanceof Error ? p.message : String(p) }
1025
1025
  };
1026
1026
  }
1027
- }, ra = async ({
1027
+ }, aa = async ({
1028
1028
  targetLayer: e,
1029
1029
  topFilter: t,
1030
1030
  geometryFilter: r,
1031
1031
  useCurrentExtent: a
1032
1032
  }, o) => {
1033
- const { mapView: n } = N(o), i = await ta(e, t, n, r, a);
1033
+ const { mapView: s } = _(o), i = await ra(e, t, s, r, a);
1034
1034
  return JSON.stringify(i, null, 2);
1035
- }, aa = s.object({
1036
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1037
- where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1038
- distance: s.number().optional().describe("The buffer distance around the geometry."),
1035
+ }, oa = n.object({
1036
+ layerId: n.string().describe("The layerId of the layer containing the geometry by which to filter."),
1037
+ where: n.string().describe("The SQL-92 where clause representing the features from which to filter."),
1038
+ distance: n.number().optional().describe("The buffer distance around the geometry."),
1039
1039
  units: A.optional().describe("The units for the distance buffer.")
1040
- }), oa = s.object({
1041
- point: s.object({
1042
- x: s.number().describe("X coordinate (longitude) from navigation result"),
1043
- y: s.number().describe("Y coordinate (latitude) from navigation result"),
1044
- spatialReference: s.object({
1045
- wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1040
+ }), sa = n.object({
1041
+ point: n.object({
1042
+ x: n.number().describe("X coordinate (longitude) from navigation result"),
1043
+ y: n.number().describe("Y coordinate (latitude) from navigation result"),
1044
+ spatialReference: n.object({
1045
+ wkid: n.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1046
1046
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1047
1047
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1048
- distance: s.number().optional().describe("Optional buffer distance around the point."),
1048
+ distance: n.number().optional().describe("Optional buffer distance around the point."),
1049
1049
  units: A.optional().describe("The units for the distance buffer.")
1050
- }), na = s.object({
1051
- targetLayer: s.object({
1052
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1053
- where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
1054
- orderByFields: s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),
1055
- outFields: s.array(
1056
- s.string().describe(
1050
+ }), na = n.object({
1051
+ targetLayer: n.object({
1052
+ layerId: n.string().describe("The layerId of the layer containing the field from which to get a value."),
1053
+ where: n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
1054
+ orderByFields: n.array(n.string().describe("The field(s) and order for which to sort the resulting features.")),
1055
+ outFields: n.array(
1056
+ n.string().describe(
1057
1057
  '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 ("*").'
1058
1058
  ).default("*")
1059
1059
  )
1060
1060
  }),
1061
- geometryFilter: s.union([aa, oa]).optional().describe(
1061
+ geometryFilter: n.union([oa, sa]).optional().describe(
1062
1062
  "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."
1063
1063
  ),
1064
- topFilter: s.object({
1065
- topCount: s.number().describe("Number of top features to return per group."),
1066
- orderByFields: s.array(
1067
- s.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
1064
+ topFilter: n.object({
1065
+ topCount: n.number().describe("Number of top features to return per group."),
1066
+ orderByFields: n.array(
1067
+ n.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
1068
1068
  ),
1069
- groupByFields: s.array(s.string().describe("Field(s) to group results by. Returns top N per group."))
1069
+ groupByFields: n.array(n.string().describe("Field(s) to group results by. Returns top N per group."))
1070
1070
  }),
1071
- useCurrentExtent: s.boolean().optional().describe(
1071
+ useCurrentExtent: n.boolean().optional().describe(
1072
1072
  "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)."
1073
1073
  )
1074
- }), sa = b(ra, {
1074
+ }), ia = b(aa, {
1075
1075
  name: "getTopFeatures",
1076
1076
  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.',
1077
1077
  schema: na
1078
- }), se = 25, ia = async (e, t, r, a) => {
1079
- const o = t.map?.allLayers.find((y) => y.id === e.layerId), n = await t.whenLayerView(o), i = o.title ?? e.layerId;
1078
+ }), ne = 25, la = async (e, t, r, a) => {
1079
+ const o = t.map?.allLayers.find((y) => y.id === e.layerId), s = await t.whenLayerView(o), i = o.title ?? e.layerId;
1080
1080
  let l;
1081
1081
  if (r) {
1082
1082
  const y = await re(r, t);
1083
1083
  if ("error" in y) {
1084
1084
  const w = { error: y.error };
1085
- return W(r) ? (w.geometryLayerId = r.layerId, w.geometryWhere = r.where) : X(r) && (w.point = r.point), {
1085
+ return W(r) ? (w.geometryLayerId = r.layerId, w.geometryWhere = r.where) : Y(r) && (w.point = r.point), {
1086
1086
  tool: "queryFeatures",
1087
1087
  layerName: i,
1088
1088
  summary: "Geometry lookup failed",
@@ -1091,7 +1091,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1091
1091
  }
1092
1092
  if (!y.geometry) {
1093
1093
  const w = {};
1094
- return W(r) ? (w.error = `No features found matching: ${r.where}`, w.geometryLayerId = r.layerId, w.geometryWhere = r.where) : X(r) && (w.error = "Failed to create point geometry", w.point = r.point), {
1094
+ return W(r) ? (w.error = `No features found matching: ${r.where}`, w.geometryLayerId = r.layerId, w.geometryWhere = r.where) : Y(r) && (w.error = "Failed to create point geometry", w.point = r.point), {
1095
1095
  tool: "queryFeatures",
1096
1096
  layerName: i,
1097
1097
  summary: "No features found for geometry filter",
@@ -1100,26 +1100,26 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1100
1100
  }
1101
1101
  l = y.geometry;
1102
1102
  } else a && (l = t.extent.clone());
1103
- const c = pe(n, e.outFields, a ?? !1), d = o.createQuery();
1104
- d.where = te(o.definitionExpression, e.where || "1=1"), d.outFields = e.outFields.length ? e.outFields : ["*"], d.orderByFields = e.orderByFields, l && (d.geometry = l, d.spatialRelationship = "intersects"), r?.distance && (d.distance = r.distance), r?.units && (d.units = r.units), d.outSpatialReference = t.spatialReference;
1103
+ const c = me(s, e.outFields, a ?? !1), d = o.createQuery();
1104
+ d.where = ee(o.definitionExpression, e.where || "1=1"), d.outFields = e.outFields.length ? e.outFields : ["*"], d.orderByFields = e.orderByFields, l && (d.geometry = l, d.spatialRelationship = "intersects"), r?.distance && (d.distance = r.distance), r?.units && (d.units = r.units), d.outSpatialReference = t.spatialReference;
1105
1105
  let u, h;
1106
1106
  try {
1107
- u = c ? await n.queryFeatureCount(d) : await o.queryFeatureCount(d), u > 0 && u <= se && (h = c ? await n.queryFeatures(d) : await o.queryFeatures(d), h && h.features.forEach((y) => {
1107
+ u = c ? await s.queryFeatureCount(d) : await o.queryFeatureCount(d), u > 0 && u <= ne && (h = c ? await s.queryFeatures(d) : await o.queryFeatures(d), h && h.features.forEach((y) => {
1108
1108
  const w = y.attributes;
1109
1109
  o.fields.forEach((E) => {
1110
- const $ = w[E.name], v = ee(E.name, $, o);
1110
+ const $ = w[E.name], v = X(E.name, $, o);
1111
1111
  v && (w[E.name] = v);
1112
1112
  });
1113
1113
  }));
1114
1114
  } catch (y) {
1115
- console.warn("Client-side query failed, falling back to server:", y), u = await o.queryFeatureCount(d), u > 0 && u <= se && (h = await o.queryFeatures(d), h && h.features.forEach((w) => {
1115
+ console.warn("Client-side query failed, falling back to server:", y), u = await o.queryFeatureCount(d), u > 0 && u <= ne && (h = await o.queryFeatures(d), h && h.features.forEach((w) => {
1116
1116
  o.fields.forEach((E) => {
1117
- const $ = w.attributes[E.name], v = ee(E.name, $, o);
1117
+ const $ = w.attributes[E.name], v = X(E.name, $, o);
1118
1118
  v && (w.attributes[E.name] = v);
1119
1119
  });
1120
1120
  }));
1121
1121
  }
1122
- const p = o.objectIdField, f = h?.features.map((y) => y.attributes[p]), T = h?.features.map((y) => y.attributes);
1122
+ const p = o.objectIdField, g = h?.features.map((y) => y.attributes[p]), T = h?.features.map((y) => y.attributes);
1123
1123
  return {
1124
1124
  tool: "queryFeatures",
1125
1125
  layerName: i,
@@ -1129,57 +1129,57 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1129
1129
  where: e.where,
1130
1130
  orderByFields: e.orderByFields,
1131
1131
  outFields: e.outFields,
1132
- ...f && { objectIds: f, objectIdField: p },
1132
+ ...g && { objectIds: g, objectIdField: p },
1133
1133
  ...T && { attributes: T },
1134
- ...u > se && {
1134
+ ...u > ne && {
1135
1135
  note: `${u} features found.`
1136
1136
  }
1137
1137
  }
1138
1138
  };
1139
1139
  };
1140
- async function la({
1140
+ async function ca({
1141
1141
  targetLayer: e,
1142
1142
  geometryFilter: t,
1143
1143
  useCurrentExtent: r
1144
1144
  }, a) {
1145
- const { mapView: o } = N(a), n = await ia(e, o, t, r);
1146
- return JSON.stringify(n, null, 2);
1145
+ const { mapView: o } = _(a), s = await la(e, o, t, r);
1146
+ return JSON.stringify(s, null, 2);
1147
1147
  }
1148
- const ca = s.object({
1149
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1150
- where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1151
- distance: s.number().optional().describe("The buffer distance around the geometry."),
1148
+ const da = n.object({
1149
+ layerId: n.string().describe("The layerId of the layer containing the geometry by which to filter."),
1150
+ where: n.string().describe("The SQL-92 where clause representing the features from which to filter."),
1151
+ distance: n.number().optional().describe("The buffer distance around the geometry."),
1152
1152
  units: A.optional().describe("The units for the distance buffer.")
1153
- }), da = s.object({
1154
- point: s.object({
1155
- x: s.number().describe("X coordinate (longitude) from navigation result"),
1156
- y: s.number().describe("Y coordinate (latitude) from navigation result"),
1157
- spatialReference: s.object({
1158
- wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1153
+ }), ua = n.object({
1154
+ point: n.object({
1155
+ x: n.number().describe("X coordinate (longitude) from navigation result"),
1156
+ y: n.number().describe("Y coordinate (latitude) from navigation result"),
1157
+ spatialReference: n.object({
1158
+ wkid: n.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1159
1159
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1160
1160
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1161
- distance: s.number().optional().describe("Optional buffer distance around the point."),
1161
+ distance: n.number().optional().describe("Optional buffer distance around the point."),
1162
1162
  units: A.optional().describe("The units for the distance buffer.")
1163
- }), ua = s.object({
1164
- targetLayer: s.object({
1165
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1166
- where: s.string().describe(
1163
+ }), ha = n.object({
1164
+ targetLayer: n.object({
1165
+ layerId: n.string().describe("The layerId of the layer containing the field from which to get a value."),
1166
+ where: n.string().describe(
1167
1167
  "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."
1168
1168
  ),
1169
- orderByFields: s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),
1170
- outFields: s.array(
1171
- s.string().describe(
1169
+ orderByFields: n.array(n.string().describe("The field(s) and order for which to sort the resulting features.")),
1170
+ outFields: n.array(
1171
+ n.string().describe(
1172
1172
  '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 ("*").'
1173
1173
  ).default("*")
1174
1174
  )
1175
1175
  }),
1176
- geometryFilter: s.union([ca, da]).optional().describe(
1176
+ geometryFilter: n.union([da, ua]).optional().describe(
1177
1177
  "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."
1178
1178
  ),
1179
- useCurrentExtent: s.boolean().optional().describe(
1179
+ useCurrentExtent: n.boolean().optional().describe(
1180
1180
  "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)."
1181
1181
  )
1182
- }), ha = b(la, {
1182
+ }), ma = b(ca, {
1183
1183
  name: "queryFeatures",
1184
1184
  description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
1185
1185
 
@@ -1191,21 +1191,21 @@ USE THIS TOOL FOR:
1191
1191
  - Any question where the user wants to SEE or COUNT matching features
1192
1192
 
1193
1193
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1194
- schema: ua
1195
- }), Ge = [Ur, ea, sa, ha], Qe = [Qr, zr, Ar], ae = () => {
1194
+ schema: ha
1195
+ }), Oe = [Hr, ta, ia, ma], Qe = [Vr, _r, Nr], ae = () => {
1196
1196
  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}`;
1197
1197
  return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
1198
- }, ma = async (e, t) => {
1198
+ }, pa = async (e, t) => {
1199
1199
  await m({ text: "Requesting LLM for layer filter results" }, t);
1200
- const a = await F("data_explore_filter_prompt");
1200
+ const a = await R("data_explore_filter_prompt");
1201
1201
  if (!t?.configurable)
1202
1202
  throw new Error("config.configurable is required for layer filter tools");
1203
- const { userTimezone: o, userTimezoneOffset: n } = ae(), i = {
1203
+ const { userTimezone: o, userTimezoneOffset: s } = ae(), i = {
1204
1204
  layerFieldInfo: e.layerFieldInfo,
1205
1205
  userTimezone: o,
1206
- userTimezoneOffset: n,
1206
+ userTimezoneOffset: s,
1207
1207
  queryResponse: e.queryResponse
1208
- }, l = await M({
1208
+ }, l = await k({
1209
1209
  promptText: a,
1210
1210
  modelTier: "advanced",
1211
1211
  messages: x(e.messages),
@@ -1219,34 +1219,34 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1219
1219
  // Don't overwrite outputMessage if query already set it
1220
1220
  };
1221
1221
  const u = [...c, l], h = l.content.toString();
1222
- return await H(l, t), { ...e, messages: u, outputMessage: h };
1223
- }, pa = async (e, t) => {
1222
+ return await U(l, t), { ...e, messages: u, outputMessage: h };
1223
+ }, ya = async (e, t) => {
1224
1224
  await m({ text: "Requesting LLM for layer query results" }, t);
1225
- const a = await F("data_explore_query_prompt");
1225
+ const a = await R("data_explore_query_prompt");
1226
1226
  if (!t?.configurable)
1227
1227
  throw new Error("config.configurable is required for layer query tools");
1228
- const { userTimezone: o, userTimezoneOffset: n } = ae(), i = {
1228
+ const { userTimezone: o, userTimezoneOffset: s } = ae(), i = {
1229
1229
  layerFieldInfo: e.layerFieldInfo,
1230
1230
  userTimezone: o,
1231
- userTimezoneOffset: n
1232
- }, l = await M({
1231
+ userTimezoneOffset: s
1232
+ }, l = await k({
1233
1233
  promptText: a,
1234
1234
  modelTier: "advanced",
1235
1235
  messages: x(e.messages),
1236
1236
  inputVariables: i,
1237
- tools: Ge
1237
+ tools: Oe
1238
1238
  }), c = [...e.messages, l], d = l.content.toString();
1239
- return await H(l, t), { ...e, messages: c, outputMessage: d };
1240
- }, ya = async (e, t) => {
1239
+ return await U(l, t), { ...e, messages: c, outputMessage: d };
1240
+ }, ga = async (e, t) => {
1241
1241
  try {
1242
1242
  await m({ text: "Requesting LLM for summary on query results" }, t);
1243
- const a = await F("summarize_query_response_prompt"), o = {
1243
+ const a = await R("summarize_query_response_prompt"), o = {
1244
1244
  queryResponse: e.queryResponse
1245
- }, n = await ie({
1245
+ }, s = await Ne({
1246
1246
  promptText: a,
1247
1247
  messages: x(e.messages),
1248
1248
  inputVariables: o
1249
- }), i = typeof n == "string" ? n : n.content, l = new K(i);
1249
+ }), i = typeof s == "string" ? s : s.content, l = new te(i);
1250
1250
  return await m({ text: `Received response from LLM: ${i}` }, t), {
1251
1251
  ...e,
1252
1252
  outputMessage: i,
@@ -1257,13 +1257,13 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1257
1257
  }
1258
1258
  };
1259
1259
  async function fa(e, t) {
1260
- const a = await new P(Qe).invoke(
1260
+ const a = await new z(Qe).invoke(
1261
1261
  {
1262
1262
  messages: x(e.messages)
1263
1263
  },
1264
1264
  t
1265
- ), o = [...e.messages, ...a.messages], n = a.messages.map(
1266
- (l) => new K({
1265
+ ), o = [...e.messages, ...a.messages], s = a.messages.map(
1266
+ (l) => new te({
1267
1267
  content: l.content,
1268
1268
  // eslint-disable-next-line @typescript-eslint/naming-convention
1269
1269
  additional_kwargs: l.additional_kwargs
@@ -1273,12 +1273,12 @@ async function fa(e, t) {
1273
1273
  { text: `Finished executing layer filter tool: ${a.messages.map((l) => l.content).join(", ")}` },
1274
1274
  t
1275
1275
  );
1276
- const i = [...o, ...n];
1276
+ const i = [...o, ...s];
1277
1277
  return { ...e, messages: i };
1278
1278
  }
1279
- const ga = new P(Ge);
1280
- async function wa(e, t) {
1281
- const { messages: r } = await ga.invoke({ messages: x(e.messages) }, t), a = [], o = [];
1279
+ const wa = new z(Oe);
1280
+ async function ba(e, t) {
1281
+ const { messages: r } = await wa.invoke({ messages: x(e.messages) }, t), a = [], o = [];
1282
1282
  for (const i of r) {
1283
1283
  const l = i.content;
1284
1284
  let c;
@@ -1305,22 +1305,22 @@ async function wa(e, t) {
1305
1305
  }
1306
1306
  a.push(c), c.details && typeof c.details == "object" && "error" in c.details ? o.push(`- ${c.tool}: Error - ${String(c.details.error)}`) : o.push(`- ${c.layerName}: ${c.summary}`);
1307
1307
  }
1308
- const n = [...e.messages, ...r];
1308
+ const s = [...e.messages, ...r];
1309
1309
  return await m({ text: `Finished executing layer query tool: ${o.join(", ")}` }, t), {
1310
1310
  ...e,
1311
- messages: n,
1311
+ messages: s,
1312
1312
  queryResponse: a
1313
1313
  };
1314
1314
  }
1315
- const ba = 10, Sa = ["string", "small-integer", "integer"], va = async (e, t) => {
1315
+ const Sa = 10, va = ["string", "small-integer", "integer"], Ta = async (e, t) => {
1316
1316
  let r = null, a = null;
1317
1317
  try {
1318
1318
  if (t.type !== "geometry" && t.type !== "oid" && t.type !== "global-id") {
1319
- r = await de({ layer: e, field: t.name });
1319
+ r = await ce({ layer: e, field: t.name });
1320
1320
  const o = t.domain?.type === "coded-value" ? t.domain : null;
1321
- (Sa.includes(t.type) || o) && (a = (await ue({ layer: e, field: t.name })).uniqueValueInfos.sort((n, i) => i.count - n.count).slice(0, ba), o && (a = a.map((n) => ({
1322
- ...n,
1323
- value: o.getName(n.value) ?? n.value
1321
+ (va.includes(t.type) || o) && (a = (await de({ layer: e, field: t.name })).uniqueValueInfos.sort((s, i) => i.count - s.count).slice(0, Sa), o && (a = a.map((s) => ({
1322
+ ...s,
1323
+ value: o.getName(s.value) ?? s.value
1324
1324
  }))));
1325
1325
  }
1326
1326
  } catch (o) {
@@ -1331,18 +1331,18 @@ const ba = 10, Sa = ["string", "small-integer", "integer"], va = async (e, t) =>
1331
1331
  uniqueValues: a
1332
1332
  };
1333
1333
  };
1334
- async function ye(e, t, r) {
1334
+ async function pe(e, t, r) {
1335
1335
  const a = [], o = [];
1336
- for (const n of e) {
1336
+ for (const s of e) {
1337
1337
  let i = function(p) {
1338
- const f = t.get(p)?.layerItem;
1339
- return f ? [
1340
- f.name && `Name: ${f.name}`,
1341
- f.title && `Title: ${f.title}`,
1342
- f.description && `Description: ${f.description}`
1338
+ const g = t.get(p)?.layerItem;
1339
+ return g ? [
1340
+ g.name && `Name: ${g.name}`,
1341
+ g.title && `Title: ${g.title}`,
1342
+ g.description && `Description: ${g.description}`
1343
1343
  ].filter(Boolean).join(" | ") : p;
1344
1344
  };
1345
- const { layerId: l, results: c } = n, d = r.map?.allLayers.find((p) => p.id === l), u = t.get(l)?.fieldRegistry;
1345
+ const { layerId: l, results: c } = s, d = r.map?.allLayers.find((p) => p.id === l), u = t.get(l)?.fieldRegistry;
1346
1346
  if (!u)
1347
1347
  continue;
1348
1348
  let h = a.find((p) => p.layerId === l);
@@ -1352,38 +1352,38 @@ async function ye(e, t, r) {
1352
1352
  fieldInfos: []
1353
1353
  }, a.push(h));
1354
1354
  for (const p of c) {
1355
- const f = u.get(p.name);
1356
- if (!f)
1355
+ const g = u.get(p.name);
1356
+ if (!g)
1357
1357
  continue;
1358
- if (!f.statistics) {
1359
- const y = va(d, f).then((w) => {
1360
- u.set(f.name, { ...f, statistics: w }), f.statistics = w;
1358
+ if (!g.statistics) {
1359
+ const y = Ta(d, g).then((w) => {
1360
+ u.set(g.name, { ...g, statistics: w }), g.statistics = w;
1361
1361
  });
1362
1362
  o.push(y);
1363
1363
  }
1364
- h.fieldInfos.push(f);
1364
+ h.fieldInfos.push(g);
1365
1365
  }
1366
1366
  }
1367
1367
  return await Promise.all(o), a;
1368
1368
  }
1369
- const Ta = async (e, t) => {
1369
+ const xa = async (e, t) => {
1370
1370
  try {
1371
1371
  await m({ text: "Getting statistics for vector search results" }, t);
1372
- const r = S(t, "layersAndFieldsRegistry"), { mapView: a } = N(t), o = await ye(e.vectorSearchFieldResults, r, a);
1372
+ const r = S(t, "layersAndFieldsRegistry"), { mapView: a } = _(t), o = await pe(e.vectorSearchFieldResults, r, a);
1373
1373
  return await m({ text: "Statistics retrieved" }, t), { ...e, layerFieldInfo: o };
1374
1374
  } catch (r) {
1375
1375
  throw await m({ text: "Error during fetching statistics" }, t), new Error(`Error during fetching statistics: ${r instanceof Error ? r.message : String(r)}`);
1376
1376
  }
1377
- }, Le = 0.7, xa = 10, Ea = async (e, t) => {
1377
+ }, Re = 0.7, Ea = 10, $a = async (e, t) => {
1378
1378
  try {
1379
1379
  const r = C(e.messages);
1380
1380
  await m({ text: "Similarity search to find fields" }, t);
1381
- const a = S(t, "fieldSearch"), o = S(t, "layersAndFieldsRegistry"), n = S(t, "embeddingCache"), i = await a.searchFields({
1381
+ const a = S(t, "fieldSearch"), o = S(t, "layersAndFieldsRegistry"), s = S(t, "embeddingCache"), i = await a.searchFields({
1382
1382
  text: r,
1383
1383
  layerIds: e.vectorSearchLayerIds,
1384
- minScore: Le,
1385
- topResults: xa,
1386
- embeddingCache: n
1384
+ minScore: Re,
1385
+ topResults: Ea,
1386
+ embeddingCache: s
1387
1387
  }), l = i.map(({ layerId: d, results: u }) => {
1388
1388
  const h = u.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
1389
1389
  `);
@@ -1393,7 +1393,7 @@ ${h}`;
1393
1393
  `);
1394
1394
  let c;
1395
1395
  return i.length > 0 ? c = `Vector search completed. Matching layers and fields with scores:
1396
- ${l}` : c = `No vector search results found for score over ${Le}.`, await m({ text: c }, t), {
1396
+ ${l}` : c = `No vector search results found for score over ${Re}.`, await m({ text: c }, t), {
1397
1397
  ...e,
1398
1398
  vectorSearchFieldResults: i
1399
1399
  };
@@ -1403,14 +1403,14 @@ ${l}` : c = `No vector search results found for score over ${Le}.`, await m({ te
1403
1403
  t
1404
1404
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1405
1405
  }
1406
- }, $a = 0.7, Fa = async (e, t) => {
1406
+ }, Fa = 0.7, Ra = async (e, t) => {
1407
1407
  try {
1408
1408
  const r = C(e.messages);
1409
1409
  await m({ text: `Similarity search to find layers: ${r}` }, t);
1410
- const a = S(t, "layerSearch"), o = S(t, "layersAndFieldsRegistry"), n = S(t, "embeddingCache"), i = await a.searchLayers({
1410
+ const a = S(t, "layerSearch"), o = S(t, "layersAndFieldsRegistry"), s = S(t, "embeddingCache"), i = await a.searchLayers({
1411
1411
  text: r,
1412
- minScore: $a,
1413
- embeddingCache: n
1412
+ minScore: Fa,
1413
+ embeddingCache: s
1414
1414
  }), l = i.map((u) => u.id), c = i.map(({ id: u, score: h }) => `${o.get(u)?.layerItem.name ?? u} (${h.toFixed(2)})`).join(`
1415
1415
  `);
1416
1416
  let d;
@@ -1425,10 +1425,10 @@ ${c}` : d = "Vector search completed. No matching layers found.", await m({ text
1425
1425
  t
1426
1426
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1427
1427
  }
1428
- }, Ra = (e, t) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
1428
+ }, La = (e, t) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
1429
1429
  e,
1430
1430
  t
1431
- ), La = () => new _(Oe).addNode("requireDataExplorationServices", Ra).addNode("vectorSearchLayers", Fa).addNode("vectorSearchFields", Ea).addNode("fieldStatistics", Ta).addNode("queryAgent", pa).addNode("queryTools", wa).addNode("summarizeQueryResponseLLM", ya).addNode("filterAgent", ma).addNode("filterTools", fa).addNode("earlyExit", Lr).addEdge(j, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1431
+ ), Ia = () => new M(Ge).addNode("requireDataExplorationServices", La).addNode("vectorSearchLayers", Ra).addNode("vectorSearchFields", $a).addNode("fieldStatistics", xa).addNode("queryAgent", ya).addNode("queryTools", ba).addNode("summarizeQueryResponseLLM", ga).addNode("filterAgent", pa).addNode("filterTools", fa).addNode("earlyExit", Ir).addEdge(P, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1432
1432
  "vectorSearchLayers",
1433
1433
  (t) => t.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
1434
1434
  ).addConditionalEdges(
@@ -1437,7 +1437,7 @@ ${c}` : d = "Vector search completed. No matching layers found.", await m({ text
1437
1437
  ).addEdge("fieldStatistics", "queryAgent").addConditionalEdges("queryAgent", (t) => (t.messages[t.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "queryTools" : "filterAgent").addConditionalEdges(
1438
1438
  "queryTools",
1439
1439
  (t) => t.queryResponse.length ? "summarizeQueryResponseLLM" : "filterAgent"
1440
- ).addEdge("summarizeQueryResponseLLM", "filterAgent").addConditionalEdges("filterAgent", (t) => (t.messages[t.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "filterTools" : R).addEdge("filterTools", R).addEdge("earlyExit", R), Ia = 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).
1440
+ ).addEdge("summarizeQueryResponseLLM", "filterAgent").addConditionalEdges("filterAgent", (t) => (t.messages[t.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "filterTools" : F).addEdge("filterTools", F).addEdge("earlyExit", F), qa = 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).
1441
1441
  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.
1442
1442
  _Example: “Only show stations where Brand is Shell”_
1443
1443
  _Example: “Make Shell stations stand out on the map”_
@@ -1445,22 +1445,22 @@ ${c}` : d = "Vector search completed. No matching layers found.", await m({ text
1445
1445
  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.
1446
1446
  _Example: “How many features are there?”_
1447
1447
  _Example: “What’s the average population?”_
1448
- _Example: “Which values are in the status field?”_`, qi = {
1448
+ _Example: “Which values are in the status field?”_`, zi = {
1449
1449
  id: "dataExploration",
1450
1450
  name: "Data Exploration Agent",
1451
- description: Ia,
1452
- createGraph: La,
1453
- workspace: Oe
1454
- }, Ie = 0.7, qa = 10, Ca = async (e, t) => {
1451
+ description: qa,
1452
+ createGraph: Ia,
1453
+ workspace: Ge
1454
+ }, Le = 0.7, Ca = 10, Aa = async (e, t) => {
1455
1455
  try {
1456
1456
  const r = C(e.messages);
1457
1457
  await m({ text: "Similarity search to find fields" }, t);
1458
- const a = S(t, "fieldSearch"), o = S(t, "layersAndFieldsRegistry"), n = S(t, "embeddingCache"), i = await a.searchFields({
1458
+ const a = S(t, "fieldSearch"), o = S(t, "layersAndFieldsRegistry"), s = S(t, "embeddingCache"), i = await a.searchFields({
1459
1459
  text: r,
1460
1460
  layerIds: e.vectorSearchLayerIds,
1461
- minScore: Ie,
1462
- topResults: qa,
1463
- embeddingCache: n
1461
+ minScore: Le,
1462
+ topResults: Ca,
1463
+ embeddingCache: s
1464
1464
  }), l = i.map(({ layerId: d, results: u }) => {
1465
1465
  const h = u.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
1466
1466
  `);
@@ -1470,7 +1470,7 @@ ${h}`;
1470
1470
  `);
1471
1471
  let c;
1472
1472
  return i.length > 0 ? c = `Vector search completed. Matching layers and fields with scores:
1473
- ${l}` : c = `No vector search results found for score over ${Ie}.`, await m({ text: c }, t), {
1473
+ ${l}` : c = `No vector search results found for score over ${Le}.`, await m({ text: c }, t), {
1474
1474
  ...e,
1475
1475
  vectorSearchFieldResults: i
1476
1476
  };
@@ -1480,11 +1480,11 @@ ${l}` : c = `No vector search results found for score over ${Ie}.`, await m({ te
1480
1480
  t
1481
1481
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1482
1482
  }
1483
- }, Aa = 0.7, ka = async (e, t) => {
1483
+ }, Na = 0.7, ka = async (e, t) => {
1484
1484
  try {
1485
1485
  const r = C(e.messages);
1486
1486
  await m({ text: `Similarity search to find layers: ${r}` }, t);
1487
- const a = S(t, "layerSearch"), o = S(t, "layersAndFieldsRegistry"), n = await a.searchLayers({ text: r, minScore: Aa }), i = n.map((d) => d.id), l = n.map(({ id: d, score: u }) => `${o.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1487
+ const a = S(t, "layerSearch"), o = S(t, "layersAndFieldsRegistry"), s = await a.searchLayers({ text: r, minScore: Na }), i = s.map((d) => d.id), l = s.map(({ id: d, score: u }) => `${o.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1488
1488
  `);
1489
1489
  let c;
1490
1490
  return i.length > 0 ? c = `Vector search completed. Matching layers with scores:
@@ -1499,7 +1499,7 @@ ${l}` : c = "Vector search completed. No matching layers found.", await m({ text
1499
1499
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1500
1500
  }
1501
1501
  }, Ve = ["mapView"];
1502
- function fe(e) {
1502
+ function ye(e) {
1503
1503
  const r = e?.configurable?.context;
1504
1504
  if (!r || typeof r != "object")
1505
1505
  throw new Error("LayerFilterAgent context missing");
@@ -1508,10 +1508,10 @@ function fe(e) {
1508
1508
  throw new Error(`LayerFilterAgent context missing: ${a.join(", ")}`);
1509
1509
  return r;
1510
1510
  }
1511
- const Na = async (e, t) => {
1511
+ const za = async (e, t) => {
1512
1512
  try {
1513
1513
  await m({ text: "Getting statistics for vector search results" }, t);
1514
- const r = S(t, "layersAndFieldsRegistry"), { mapView: a } = fe(t), o = await ye(e.vectorSearchFieldResults, r, a);
1514
+ const r = S(t, "layersAndFieldsRegistry"), { mapView: a } = ye(t), o = await pe(e.vectorSearchFieldResults, r, a);
1515
1515
  return await m({ text: "Statistics retrieved" }, t), { ...e, layerFieldInfo: o };
1516
1516
  } catch (r) {
1517
1517
  throw await m({ text: "Error during fetching statistics" }, t), new Error(`Error during fetching statistics: ${r instanceof Error ? r.message : String(r)}`);
@@ -1519,11 +1519,11 @@ const Na = async (e, t) => {
1519
1519
  }, We = async (e, t, r) => {
1520
1520
  const a = e.map?.allLayers.find((i) => i.id === t), o = a.createQuery();
1521
1521
  o.where = r ?? "1=1";
1522
- const { features: n } = await a.queryFeatures(o);
1523
- e.goTo(n);
1522
+ const { features: s } = await a.queryFeatures(o);
1523
+ e.goTo(s);
1524
1524
  }, Be = async (e, t) => {
1525
1525
  const r = t.map?.allLayers.find(
1526
- (n) => n.id === e.layerId
1526
+ (s) => s.id === e.layerId
1527
1527
  );
1528
1528
  if (!r)
1529
1529
  return { error: `Could not find geometry layer with ID: ${e.layerId}` };
@@ -1535,22 +1535,22 @@ const Na = async (e, t) => {
1535
1535
  return { error: `No features found in geometry layer with the specified where clause: ${e.where}` };
1536
1536
  let o;
1537
1537
  if (a.features.length === 1) {
1538
- const n = a.features[0].geometry;
1539
- if (!n)
1538
+ const s = a.features[0].geometry;
1539
+ if (!s)
1540
1540
  return { error: "The geometry of the first feature is undefined or null." };
1541
- o = n;
1541
+ o = s;
1542
1542
  } else {
1543
- const n = a.features.map((l) => l.geometry), i = ce.executeMany(n);
1543
+ const s = a.features.map((l) => l.geometry), i = le.executeMany(s);
1544
1544
  if (!i)
1545
1545
  return { error: "Failed to create a combined geometry." };
1546
1546
  o = i;
1547
1547
  }
1548
1548
  return { geometry: o };
1549
- }, za = async (e, t, r, a, o) => {
1550
- const n = t.map?.allLayers.find(
1549
+ }, _a = async (e, t, r, a, o) => {
1550
+ const s = t.map?.allLayers.find(
1551
1551
  (l) => l.id === e.layerId
1552
1552
  );
1553
- if (!n)
1553
+ if (!s)
1554
1554
  return `Could not find target layer with ID: ${e.layerId}`;
1555
1555
  let i;
1556
1556
  if (o) {
@@ -1559,8 +1559,8 @@ const Na = async (e, t) => {
1559
1559
  return l.error;
1560
1560
  i = l.geometry;
1561
1561
  }
1562
- return n.featureEffect = new _e({
1563
- filter: new U({
1562
+ return s.featureEffect = new _e({
1563
+ filter: new K({
1564
1564
  where: e.where,
1565
1565
  geometry: i,
1566
1566
  spatialRelationship: "intersects",
@@ -1569,43 +1569,43 @@ const Na = async (e, t) => {
1569
1569
  }),
1570
1570
  includedEffect: r,
1571
1571
  excludedEffect: a
1572
- }), n.visible = !0, n.refresh(), We(
1572
+ }), s.visible = !0, s.refresh(), We(
1573
1573
  t,
1574
1574
  o ? o.layerId : e.layerId,
1575
1575
  o ? o.where : e.where
1576
- ), `Applied feature effects to target layer "${n.title ?? e.layerId}"${o ? ` using geometry from layer "${o.layerId}"` : ""}.`;
1577
- }, _a = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], Ke = s.enum(_a), ja = async ({
1576
+ ), `Applied feature effects to target layer "${s.title ?? e.layerId}"${o ? ` using geometry from layer "${o.layerId}"` : ""}.`;
1577
+ }, ja = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], Ke = n.enum(ja), Ma = async ({
1578
1578
  targetLayer: e,
1579
1579
  geometryLayer: t,
1580
1580
  includedEffect: r = "drop-shadow(2px, 2px, 2px, gray)",
1581
1581
  excludedEffect: a = "grayscale(100%) opacity(60%) blur(2px)"
1582
1582
  }, o) => {
1583
- const { mapView: n } = fe(o);
1584
- return await za(e, n, r, a, t);
1585
- }, Ma = s.object({
1586
- targetLayer: s.object({
1587
- layerId: s.string().describe("The layerId of the layer on which to set a feature effect."),
1588
- where: s.string().describe("The SQL-92 where clause representing the features to emphasize.")
1583
+ const { mapView: s } = ye(o);
1584
+ return await _a(e, s, r, a, t);
1585
+ }, Pa = n.object({
1586
+ targetLayer: n.object({
1587
+ layerId: n.string().describe("The layerId of the layer on which to set a feature effect."),
1588
+ where: n.string().describe("The SQL-92 where clause representing the features to emphasize.")
1589
1589
  }),
1590
- geometryLayer: s.object({
1591
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1592
- where: s.string().describe(
1590
+ geometryLayer: n.object({
1591
+ layerId: n.string().describe("The layerId of the layer containing the geometry by which to filter."),
1592
+ where: n.string().describe(
1593
1593
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
1594
1594
  ),
1595
- distance: s.number().describe("The distance by which to filter the input geometry."),
1595
+ distance: n.number().describe("The distance by which to filter the input geometry."),
1596
1596
  units: Ke.describe("The units used to filter by geometry and distance.")
1597
1597
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1598
- includedEffect: s.string().optional().default("drop-shadow(2px, 2px, 2px, gray)").describe(
1598
+ includedEffect: n.string().optional().default("drop-shadow(2px, 2px, 2px, gray)").describe(
1599
1599
  "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."
1600
1600
  ),
1601
- excludedEffect: s.string().optional().default("grayscale(100%) opacity(60%) blur(2px)").describe(
1601
+ excludedEffect: n.string().optional().default("grayscale(100%) opacity(60%) blur(2px)").describe(
1602
1602
  "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."
1603
1603
  )
1604
- }), Pa = b(ja, {
1604
+ }), Da = b(Ma, {
1605
1605
  name: "setFeatureEffect",
1606
1606
  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.",
1607
- schema: Ma
1608
- }), Da = async (e, t, r) => {
1607
+ schema: Pa
1608
+ }), Ga = async (e, t, r) => {
1609
1609
  const a = t.map?.allLayers.find(
1610
1610
  (i) => i.id === e.layerId
1611
1611
  );
@@ -1618,8 +1618,8 @@ const Na = async (e, t) => {
1618
1618
  return i.error;
1619
1619
  o = i.geometry;
1620
1620
  }
1621
- const n = await t.whenLayerView(a);
1622
- return n.filter = new U({
1621
+ const s = await t.whenLayerView(a);
1622
+ return s.filter = new K({
1623
1623
  where: e.where,
1624
1624
  geometry: o,
1625
1625
  spatialRelationship: "intersects",
@@ -1634,45 +1634,45 @@ const Na = async (e, t) => {
1634
1634
  targetLayer: e,
1635
1635
  geometryLayer: t
1636
1636
  }, r) => {
1637
- const { mapView: a } = fe(r);
1638
- return await Da(e, a, t);
1639
- }, Ga = s.object({
1640
- targetLayer: s.object({
1641
- layerId: s.string().describe("The layerId of the layer on which to set a filter."),
1642
- where: s.string().describe("The SQL-92 where clause representing the features to display.")
1637
+ const { mapView: a } = ye(r);
1638
+ return await Ga(e, a, t);
1639
+ }, Qa = n.object({
1640
+ targetLayer: n.object({
1641
+ layerId: n.string().describe("The layerId of the layer on which to set a filter."),
1642
+ where: n.string().describe("The SQL-92 where clause representing the features to display.")
1643
1643
  }),
1644
- geometryLayer: s.object({
1645
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1646
- where: s.string().describe(
1644
+ geometryLayer: n.object({
1645
+ layerId: n.string().describe("The layerId of the layer containing the geometry by which to filter."),
1646
+ where: n.string().describe(
1647
1647
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
1648
1648
  ),
1649
- distance: s.number().describe("The distance by which to filter the input geometry."),
1649
+ distance: n.number().describe("The distance by which to filter the input geometry."),
1650
1650
  units: Ke.describe("The units used to filter by geometry and distance.")
1651
1651
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries.")
1652
- }), Qa = b(Oa, {
1652
+ }), Va = b(Oa, {
1653
1653
  name: "setFeatureFilter",
1654
1654
  description: "Sets a client-side filter using a where clause, geometry filter, or both on a target layer. This filters features at the client level in the view.",
1655
- schema: Ga
1656
- }), Ue = [Pa, Qa], Va = async (e, t) => {
1655
+ schema: Qa
1656
+ }), Ue = [Da, Va], Wa = async (e, t) => {
1657
1657
  await m({ text: "Requesting LLM for layer filter results" }, t);
1658
- const a = await F("layer_filter_prompt");
1658
+ const a = await R("layer_filter_prompt");
1659
1659
  if (!t?.configurable)
1660
1660
  throw new Error("config.configurable is required for layer filter tools");
1661
- const { userTimezone: o, userTimezoneOffset: n } = ae(), i = {
1661
+ const { userTimezone: o, userTimezoneOffset: s } = ae(), i = {
1662
1662
  layerFieldInfo: e.layerFieldInfo,
1663
1663
  userTimezone: o,
1664
- userTimezoneOffset: n
1665
- }, l = await M({
1664
+ userTimezoneOffset: s
1665
+ }, l = await k({
1666
1666
  promptText: a,
1667
1667
  modelTier: "advanced",
1668
1668
  messages: x(e.messages),
1669
1669
  inputVariables: i,
1670
1670
  tools: Ue
1671
1671
  }), c = l.content.toString();
1672
- return await H(l, t), { ...e, messages: [...e.messages, l], outputMessage: c };
1672
+ return await U(l, t), { ...e, messages: [...e.messages, l], outputMessage: c };
1673
1673
  };
1674
- async function Wa(e, t) {
1675
- const a = await new P(Ue).invoke(
1674
+ async function Ba(e, t) {
1675
+ const a = await new z(Ue).invoke(
1676
1676
  {
1677
1677
  messages: x(e.messages)
1678
1678
  },
@@ -1680,21 +1680,21 @@ async function Wa(e, t) {
1680
1680
  ), o = a.messages.map((l) => l.text).join(`
1681
1681
  `);
1682
1682
  await m({ text: `Finished executing layer filter tool: ${o}` }, t);
1683
- const n = [...e.messages, ...a.messages], i = a.messages.map((l) => l.text).join(`
1683
+ const s = [...e.messages, ...a.messages], i = a.messages.map((l) => l.text).join(`
1684
1684
  `);
1685
- return { ...e, outputMessage: i, messages: n };
1685
+ return { ...e, outputMessage: i, messages: s };
1686
1686
  }
1687
- const He = g.Root({
1687
+ const He = f.Root({
1688
1688
  // Inputs coming from global context
1689
- messages: g({
1690
- reducer: z,
1689
+ messages: f({
1690
+ reducer: j,
1691
1691
  default: () => []
1692
1692
  }),
1693
1693
  // Accumulates user-visible output across graph nodes.
1694
1694
  // Uses append semantics, but de-duplicates identical consecutive writes.
1695
1695
  // This avoids duplicate output when tool nodes and final LLM nodes
1696
1696
  // emit the same text during a single agent turn.
1697
- outputMessage: g({
1697
+ outputMessage: f({
1698
1698
  reducer: (e = "", t) => {
1699
1699
  const r = typeof t == "string" ? t.trim() : "";
1700
1700
  if (!r)
@@ -1713,36 +1713,36 @@ ${r}`;
1713
1713
  },
1714
1714
  default: () => ""
1715
1715
  }),
1716
- vectorSearchLayerIds: g(),
1717
- vectorSearchFieldResults: g(),
1718
- layerFieldInfo: g()
1719
- }), Ba = async (e, t) => (await m({ text: "Exiting Layer Filter agent" }, t), e), Ka = (e, t) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Filter Agent")(e, t), Ua = () => new _(He).addNode("requireLayerFilterServices", Ka).addNode("vectorSearchLayers", ka).addNode("vectorSearchFields", Ca).addNode("fieldStatistics", Na).addNode("agent", Va).addNode("tools", Wa).addNode("earlyExit", Ba).addEdge(j, "requireLayerFilterServices").addEdge("requireLayerFilterServices", "vectorSearchLayers").addConditionalEdges(
1716
+ vectorSearchLayerIds: f(),
1717
+ vectorSearchFieldResults: f(),
1718
+ layerFieldInfo: f()
1719
+ }), Ka = async (e, t) => (await m({ text: "Exiting Layer Filter agent" }, t), e), Ua = (e, t) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Filter Agent")(e, t), Ha = () => new M(He).addNode("requireLayerFilterServices", Ua).addNode("vectorSearchLayers", ka).addNode("vectorSearchFields", Aa).addNode("fieldStatistics", za).addNode("agent", Wa).addNode("tools", Ba).addNode("earlyExit", Ka).addEdge(P, "requireLayerFilterServices").addEdge("requireLayerFilterServices", "vectorSearchLayers").addConditionalEdges(
1720
1720
  "vectorSearchLayers",
1721
1721
  (t) => t.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
1722
1722
  ).addConditionalEdges(
1723
1723
  "vectorSearchFields",
1724
1724
  (t) => t.vectorSearchFieldResults.length ? "fieldStatistics" : "earlyExit"
1725
- ).addEdge("fieldStatistics", "agent").addConditionalEdges("agent", (t) => (t.messages[t.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : "earlyExit").addEdge("tools", "earlyExit").addEdge("earlyExit", R), Ha = String.raw`- **layer filter** — User wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
1725
+ ).addEdge("fieldStatistics", "agent").addConditionalEdges("agent", (t) => (t.messages[t.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : "earlyExit").addEdge("tools", "earlyExit").addEdge("earlyExit", F), Za = String.raw`- **layer filter** — User wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
1726
1726
  The Layer Filter Agent will automatically zoom to the affected features for action taken by this agent. In this case, no need to call navigation tool separately.
1727
1727
  _Example: “Only show stations where Brand is Shell”_
1728
1728
  _Example: “Make Shell stations stand out on the map”_
1729
- _Example: “Gray out all stations that aren’t Shell”_`, Ci = {
1729
+ _Example: “Gray out all stations that aren’t Shell”_`, _i = {
1730
1730
  id: "layerFilter",
1731
1731
  name: "Layer Filter Agent",
1732
- description: Ha,
1733
- createGraph: Ua,
1732
+ description: Za,
1733
+ createGraph: Ha,
1734
1734
  workspace: He
1735
- }, Ze = g.Root({
1735
+ }, Ze = f.Root({
1736
1736
  // Inputs coming from global context
1737
- messages: g({
1738
- reducer: z,
1737
+ messages: f({
1738
+ reducer: j,
1739
1739
  default: () => []
1740
1740
  }),
1741
1741
  // Accumulates user-visible output across graph nodes.
1742
1742
  // Uses append semantics, but de-duplicates identical consecutive writes.
1743
1743
  // This avoids duplicate output when tool nodes and final LLM nodes
1744
1744
  // emit the same text during a single agent turn.
1745
- outputMessage: g({
1745
+ outputMessage: f({
1746
1746
  reducer: (e = "", t) => {
1747
1747
  const r = typeof t == "string" ? t.trim() : "";
1748
1748
  if (!r)
@@ -1761,12 +1761,12 @@ ${r}`;
1761
1761
  },
1762
1762
  default: () => ""
1763
1763
  }),
1764
- vectorSearchLayerIds: g(),
1765
- vectorSearchFieldResults: g(),
1766
- layerFieldInfo: g(),
1767
- queryResponses: g()
1768
- }), Za = async (e, t) => (await m({ text: "Exiting Layer Query agent" }, t), e);
1769
- function Z(e) {
1764
+ vectorSearchLayerIds: f(),
1765
+ vectorSearchFieldResults: f(),
1766
+ layerFieldInfo: f(),
1767
+ queryResponses: f()
1768
+ }), Ja = async (e, t) => (await m({ text: "Exiting Layer Query agent" }, t), e);
1769
+ function H(e) {
1770
1770
  const r = e?.configurable?.context;
1771
1771
  if (!r || typeof r != "object")
1772
1772
  throw new Error("LayerQueryAgent context missing");
@@ -1775,24 +1775,24 @@ function Z(e) {
1775
1775
  throw new Error(`LayerQueryAgent context missing: ${a.join(", ")}`);
1776
1776
  return r;
1777
1777
  }
1778
- const Ja = async (e, t) => {
1778
+ const Ya = async (e, t) => {
1779
1779
  try {
1780
1780
  await m({ text: "Getting statistics for vector search results" }, t);
1781
- const r = S(t, "layersAndFieldsRegistry"), { mapView: a } = Z(t), o = await ye(e.vectorSearchFieldResults, r, a);
1781
+ const r = S(t, "layersAndFieldsRegistry"), { mapView: a } = H(t), o = await pe(e.vectorSearchFieldResults, r, a);
1782
1782
  return await m({ text: "Statistics retrieved" }, t), { ...e, layerFieldInfo: o };
1783
1783
  } catch (r) {
1784
1784
  throw await m({ text: "Error during fetching statistics" }, t), new Error(`Error during fetching statistics: ${r instanceof Error ? r.message : String(r)}`);
1785
1785
  }
1786
- }, qe = 0.7, Ya = 10, Xa = async (e, t) => {
1786
+ }, Ie = 0.7, Xa = 10, eo = async (e, t) => {
1787
1787
  try {
1788
1788
  const r = C(e.messages);
1789
1789
  await m({ text: "Similarity search to find fields" }, t);
1790
- const a = S(t, "fieldSearch"), o = S(t, "layersAndFieldsRegistry"), n = S(t, "embeddingCache"), i = await a.searchFields({
1790
+ const a = S(t, "fieldSearch"), o = S(t, "layersAndFieldsRegistry"), s = S(t, "embeddingCache"), i = await a.searchFields({
1791
1791
  text: r,
1792
1792
  layerIds: e.vectorSearchLayerIds,
1793
- minScore: qe,
1794
- topResults: Ya,
1795
- embeddingCache: n
1793
+ minScore: Ie,
1794
+ topResults: Xa,
1795
+ embeddingCache: s
1796
1796
  }), l = i.map(({ layerId: d, results: u }) => {
1797
1797
  const h = u.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
1798
1798
  `);
@@ -1802,7 +1802,7 @@ ${h}`;
1802
1802
  `);
1803
1803
  let c;
1804
1804
  return i.length > 0 ? c = `Vector search completed. Matching layers and fields with scores:
1805
- ${l}` : c = `No vector search results found for score over ${qe}.`, await m({ text: c }, t), {
1805
+ ${l}` : c = `No vector search results found for score over ${Ie}.`, await m({ text: c }, t), {
1806
1806
  ...e,
1807
1807
  vectorSearchFieldResults: i
1808
1808
  };
@@ -1812,14 +1812,14 @@ ${l}` : c = `No vector search results found for score over ${qe}.`, await m({ te
1812
1812
  t
1813
1813
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1814
1814
  }
1815
- }, eo = 0.7, to = async (e, t) => {
1815
+ }, to = 0.7, ro = async (e, t) => {
1816
1816
  try {
1817
1817
  const r = C(e.messages);
1818
1818
  await m({ text: `Similarity search to find layers: ${r}` }, t);
1819
- const a = S(t, "layerSearch"), o = S(t, "layersAndFieldsRegistry"), n = await a.searchLayers({
1819
+ const a = S(t, "layerSearch"), o = S(t, "layersAndFieldsRegistry"), s = await a.searchLayers({
1820
1820
  text: r,
1821
- minScore: eo
1822
- }), i = n.map((d) => d.id), l = n.map(({ id: d, score: u }) => `${o.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1821
+ minScore: to
1822
+ }), i = s.map((d) => d.id), l = s.map(({ id: d, score: u }) => `${o.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1823
1823
  `);
1824
1824
  let c;
1825
1825
  return i.length > 0 ? c = `Vector search completed. Matching layers with scores:
@@ -1833,11 +1833,11 @@ ${l}` : c = "Vector search completed. No matching layers found.", await m({ text
1833
1833
  t
1834
1834
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1835
1835
  }
1836
- }, ro = (e, t, r) => {
1836
+ }, ao = (e, t, r) => {
1837
1837
  const a = e.createQuery();
1838
1838
  return a.outFields = [t], a.where = r || "1=1", a.num = 1, a;
1839
- }, ao = async (e, t, r, a) => {
1840
- const o = a.map?.allLayers.find((u) => u.id === e), n = ro(o, t, r.where), l = (await o.queryFeatures(n)).features[0], c = l ? l.attributes[t] : null;
1839
+ }, oo = async (e, t, r, a) => {
1840
+ const o = a.map?.allLayers.find((u) => u.id === e), s = ao(o, t, r.where), l = (await o.queryFeatures(s)).features[0], c = l ? l.attributes[t] : null;
1841
1841
  return {
1842
1842
  tool: "getAttribute",
1843
1843
  layerName: o.title ?? e,
@@ -1849,23 +1849,23 @@ ${l}` : c = "Vector search completed. No matching layers found.", await m({ text
1849
1849
  }
1850
1850
  };
1851
1851
  };
1852
- async function oo({ layerId: e, fieldName: t, query: r }, a) {
1853
- const { mapView: o } = Z(a), n = await ao(e, t, r, o);
1854
- return JSON.stringify(n, null, 2);
1855
- }
1856
- const no = s.object({
1857
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1858
- fieldName: s.string().describe("The name of the field/attribute from which to get a field value."),
1859
- query: s.object({
1860
- where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1852
+ async function so({ layerId: e, fieldName: t, query: r }, a) {
1853
+ const { mapView: o } = H(a), s = await oo(e, t, r, o);
1854
+ return JSON.stringify(s, null, 2);
1855
+ }
1856
+ const no = n.object({
1857
+ layerId: n.string().describe("The layerId of the layer containing the field from which to get a value."),
1858
+ fieldName: n.string().describe("The name of the field/attribute from which to get a field value."),
1859
+ query: n.object({
1860
+ where: n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1861
1861
  })
1862
- }), so = b(oo, {
1862
+ }), io = b(so, {
1863
1863
  name: "getAttribute",
1864
1864
  description: "Returns an attribute value for a given feature.",
1865
1865
  schema: no
1866
1866
  }), ge = async (e, t) => {
1867
1867
  const r = t.map?.allLayers.find(
1868
- (n) => n.id === e.layerId
1868
+ (s) => s.id === e.layerId
1869
1869
  );
1870
1870
  if (!r)
1871
1871
  return { error: `Could not find geometry layer with ID: ${e.layerId}` };
@@ -1877,22 +1877,22 @@ const no = s.object({
1877
1877
  return { error: `No features found in geometry layer with the specified where clause: ${e.where}` };
1878
1878
  let o;
1879
1879
  if (a.features.length === 1) {
1880
- const n = a.features[0].geometry;
1881
- if (!n)
1880
+ const s = a.features[0].geometry;
1881
+ if (!s)
1882
1882
  return { error: "The geometry of the first feature is undefined or null." };
1883
- o = n;
1883
+ o = s;
1884
1884
  } else {
1885
- const n = a.features.map((l) => l.geometry), i = ce.executeMany(n);
1885
+ const s = a.features.map((l) => l.geometry), i = le.executeMany(s);
1886
1886
  if (!i)
1887
1887
  return { error: "Failed to create a combined geometry." };
1888
1888
  o = i;
1889
1889
  }
1890
1890
  return { geometry: o };
1891
- }, io = async (e) => {
1892
- const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryLayer: i } = e, l = o.map?.allLayers.find((y) => y.id === t.layerId);
1891
+ }, lo = async (e) => {
1892
+ const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: s, geometryLayer: i } = e, l = o.map?.allLayers.find((y) => y.id === t.layerId);
1893
1893
  if (!l)
1894
1894
  throw new Error(`Layer '${t.layerId}' not found.`);
1895
- const d = n.get(t.layerId)?.fieldRegistry.get(r);
1895
+ const d = s.get(t.layerId)?.fieldRegistry.get(r);
1896
1896
  if (!d)
1897
1897
  throw new Error(`Field '${r}' not found.`);
1898
1898
  let u;
@@ -1901,26 +1901,26 @@ const no = s.object({
1901
1901
  if ("error" in y)
1902
1902
  throw new Error(y.error);
1903
1903
  if (u = y.geometry, i.distance && i.units) {
1904
- const w = ht.execute(u, i.distance, {
1904
+ const w = mt.execute(u, i.distance, {
1905
1905
  unit: i.units === "us-nautical-miles" ? "nautical-miles" : i.units
1906
1906
  });
1907
1907
  w && (u = w);
1908
1908
  }
1909
1909
  } else
1910
1910
  u = o.extent.clone();
1911
- const h = new U({
1911
+ const h = new K({
1912
1912
  geometry: u,
1913
1913
  spatialRelationship: "intersects"
1914
1914
  });
1915
- let p = null, f = null;
1915
+ let p = null, g = null;
1916
1916
  try {
1917
- p = await de({
1917
+ p = await ce({
1918
1918
  layer: l,
1919
1919
  field: r,
1920
1920
  sqlWhere: t.where,
1921
1921
  filter: h,
1922
1922
  outStatisticTypes: { include: [a] }
1923
- }), d.type === "string" && (f = (await ue({
1923
+ }), d.type === "string" && (g = (await de({
1924
1924
  layer: l,
1925
1925
  field: r,
1926
1926
  sqlWhere: t.where,
@@ -1938,52 +1938,52 @@ const no = s.object({
1938
1938
  statisticType: a,
1939
1939
  statistic: p?.[a] ?? null,
1940
1940
  summaryStatistics: p,
1941
- uniqueValues: f,
1941
+ uniqueValues: g,
1942
1942
  where: t.where
1943
1943
  }
1944
1944
  };
1945
- }, lo = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], co = s.enum(lo);
1946
- async function uo({
1945
+ }, co = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], uo = n.enum(co);
1946
+ async function ho({
1947
1947
  targetLayer: e,
1948
1948
  fieldName: t,
1949
1949
  statisticType: r,
1950
1950
  geometryLayer: a
1951
1951
  }, o) {
1952
- const n = S(o, "layersAndFieldsRegistry"), { mapView: i } = Z(o), l = await io({
1952
+ const s = S(o, "layersAndFieldsRegistry"), { mapView: i } = H(o), l = await lo({
1953
1953
  targetLayer: e,
1954
1954
  fieldName: t,
1955
1955
  statisticType: r,
1956
1956
  mapView: i,
1957
- layersAndFieldsRegistry: n,
1957
+ layersAndFieldsRegistry: s,
1958
1958
  geometryLayer: a
1959
1959
  });
1960
1960
  return JSON.stringify(l, null, 2);
1961
1961
  }
1962
- const ho = s.object({
1963
- targetLayer: s.object({
1964
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1965
- where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1962
+ const mo = n.object({
1963
+ targetLayer: n.object({
1964
+ layerId: n.string().describe("The layerId of the layer containing the field from which to get a value."),
1965
+ where: n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1966
1966
  }),
1967
- geometryLayer: s.union([
1968
- s.object({
1969
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1970
- where: s.string().describe(
1967
+ geometryLayer: n.union([
1968
+ n.object({
1969
+ layerId: n.string().describe("The layerId of the layer containing the geometry by which to filter."),
1970
+ where: n.string().describe(
1971
1971
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
1972
1972
  ),
1973
- distance: s.number().optional().describe("The distance by which to query from the input geometry."),
1974
- units: co.optional().describe("The units used to query by geometry and distance.")
1973
+ distance: n.number().optional().describe("The distance by which to query from the input geometry."),
1974
+ units: uo.optional().describe("The units used to query by geometry and distance.")
1975
1975
  }),
1976
- s.object({}).strict()
1976
+ n.object({}).strict()
1977
1977
  // <-- Allows `{}` without throwing
1978
1978
  ]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1979
- fieldName: s.string().describe("The name of the field for which to get statistics."),
1980
- statisticType: s.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1981
- }), mo = b(uo, {
1979
+ fieldName: n.string().describe("The name of the field for which to get statistics."),
1980
+ statisticType: n.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1981
+ }), po = b(ho, {
1982
1982
  name: "getStatistics",
1983
1983
  description: "Returns one or more summary statistics for the given field. Statistic types include: count, maximum, minimum, average, median, standard deviation, variance, mode, sum, nullcount (number of features without a value for a given field), unique values. Statistics can be returned for number, date, and string fields. Only call this tool when the question requires filtering (e.g. a WHERE clause or spatial constraint) that cannot be satisfied by precomputed stats.",
1984
- schema: ho
1985
- }), po = async (e, t, r, a) => {
1986
- const o = r.map?.allLayers.find((u) => u.id === e.layerId), n = a ? await ge(a, r) : { geometry: void 0 }, i = "geometry" in n ? n.geometry : void 0, l = new je({
1984
+ schema: mo
1985
+ }), yo = async (e, t, r, a) => {
1986
+ const o = r.map?.allLayers.find((u) => u.id === e.layerId), s = a ? await ge(a, r) : { geometry: void 0 }, i = "geometry" in s ? s.geometry : void 0, l = new je({
1987
1987
  where: e.where || "1=1",
1988
1988
  outFields: e.outFields.length ? e.outFields : ["*"],
1989
1989
  orderByFields: e.orderByFields,
@@ -2007,48 +2007,48 @@ const ho = s.object({
2007
2007
  where: e.where
2008
2008
  }
2009
2009
  };
2010
- }, yo = async ({
2010
+ }, go = async ({
2011
2011
  targetLayer: e,
2012
2012
  topFilter: t,
2013
2013
  geometryLayer: r
2014
2014
  }, a) => {
2015
- const { mapView: o } = Z(a), n = await po(e, t, o, r);
2016
- return JSON.stringify(n, null, 2);
2017
- }, fo = s.object({
2018
- targetLayer: s.object({
2019
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
2020
- where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
2021
- orderByFields: s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),
2022
- outFields: s.array(
2023
- s.string().describe(
2015
+ const { mapView: o } = H(a), s = await yo(e, t, o, r);
2016
+ return JSON.stringify(s, null, 2);
2017
+ }, fo = n.object({
2018
+ targetLayer: n.object({
2019
+ layerId: n.string().describe("The layerId of the layer containing the field from which to get a value."),
2020
+ where: n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
2021
+ orderByFields: n.array(n.string().describe("The field(s) and order for which to sort the resulting features.")),
2022
+ outFields: n.array(
2023
+ n.string().describe(
2024
2024
  "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."
2025
2025
  )
2026
2026
  )
2027
2027
  }),
2028
- geometryLayer: s.object({
2029
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
2030
- where: s.string().describe(
2028
+ geometryLayer: n.object({
2029
+ layerId: n.string().describe("The layerId of the layer containing the geometry by which to filter."),
2030
+ where: n.string().describe(
2031
2031
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
2032
2032
  ),
2033
- distance: s.number().describe("The distance by which to query from the input geometry."),
2033
+ distance: n.number().describe("The distance by which to query from the input geometry."),
2034
2034
  units: A.describe("The units used to query by geometry and distance.")
2035
2035
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
2036
- topFilter: s.object({
2037
- topCount: s.number().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
2038
- orderByFields: s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),
2039
- groupByFields: s.array(s.string().describe("The field(s) for which to group by the top features."))
2036
+ topFilter: n.object({
2037
+ topCount: n.number().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
2038
+ orderByFields: n.array(n.string().describe("The field(s) and order for which to sort the resulting features.")),
2039
+ groupByFields: n.array(n.string().describe("The field(s) for which to group by the top features."))
2040
2040
  })
2041
- }), go = b(yo, {
2041
+ }), wo = b(go, {
2042
2042
  name: "getTopFeatures",
2043
2043
  description: "Returns the top n features from a layer",
2044
2044
  schema: fo
2045
- }), wo = async (e, t, r) => {
2046
- const a = t.map?.allLayers.find((d) => d.id === e.layerId), o = r ? await ge(r, t) : { geometry: void 0 }, n = "geometry" in o ? o.geometry : void 0, i = new mt({
2045
+ }), bo = async (e, t, r) => {
2046
+ const a = t.map?.allLayers.find((d) => d.id === e.layerId), o = r ? await ge(r, t) : { geometry: void 0 }, s = "geometry" in o ? o.geometry : void 0, i = new pt({
2047
2047
  where: e.where || "1=1",
2048
2048
  outFields: e.outFields.length ? e.outFields : ["*"],
2049
2049
  orderByFields: e.orderByFields,
2050
- geometry: n,
2051
- spatialRelationship: n ? "intersects" : void 0,
2050
+ geometry: s,
2051
+ spatialRelationship: s ? "intersects" : void 0,
2052
2052
  distance: r?.distance,
2053
2053
  units: r?.units
2054
2054
  }), l = await a.queryFeatures(i);
@@ -2063,50 +2063,50 @@ const ho = s.object({
2063
2063
  }
2064
2064
  };
2065
2065
  };
2066
- async function bo({
2066
+ async function So({
2067
2067
  targetLayer: e,
2068
2068
  geometryLayer: t
2069
2069
  }, r) {
2070
- const { mapView: a } = Z(r), o = await wo(e, a, t);
2070
+ const { mapView: a } = H(r), o = await bo(e, a, t);
2071
2071
  return JSON.stringify(o, null, 2);
2072
2072
  }
2073
- const So = s.object({
2074
- targetLayer: s.object({
2075
- layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
2076
- where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
2077
- orderByFields: s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),
2078
- outFields: s.array(
2079
- s.string().describe(
2073
+ const vo = n.object({
2074
+ targetLayer: n.object({
2075
+ layerId: n.string().describe("The layerId of the layer containing the field from which to get a value."),
2076
+ where: n.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
2077
+ orderByFields: n.array(n.string().describe("The field(s) and order for which to sort the resulting features.")),
2078
+ outFields: n.array(
2079
+ n.string().describe(
2080
2080
  "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."
2081
2081
  )
2082
2082
  )
2083
2083
  }),
2084
- geometryLayer: s.object({
2085
- layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
2086
- where: s.string().describe(
2084
+ geometryLayer: n.object({
2085
+ layerId: n.string().describe("The layerId of the layer containing the geometry by which to filter."),
2086
+ where: n.string().describe(
2087
2087
  "The SQL-92 where clause representing the features from which to filter features from the targetLayer by geometry."
2088
2088
  ),
2089
- distance: s.number().describe("The distance by which to query from the input geometry."),
2089
+ distance: n.number().describe("The distance by which to query from the input geometry."),
2090
2090
  units: A.describe("The units used to query by geometry and distance.")
2091
2091
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries.")
2092
- }), vo = b(bo, {
2092
+ }), To = b(So, {
2093
2093
  name: "queryFeatures",
2094
2094
  description: "Queries for one or more features from a given layer.",
2095
- schema: So
2096
- }), Je = [vo, mo, so, go], To = async (e, t) => {
2095
+ schema: vo
2096
+ }), Je = [To, po, io, wo], xo = async (e, t) => {
2097
2097
  await m({ text: "Requesting LLM for layer query results" }, t);
2098
- const r = await F("data_query_prompt");
2098
+ const r = await R("data_query_prompt");
2099
2099
  if (!t?.configurable)
2100
2100
  throw new Error("config.configurable is required for layer query tools");
2101
- const { userTimezone: a, userTimezoneOffset: o } = ae(), n = {
2101
+ const { userTimezone: a, userTimezoneOffset: o } = ae(), s = {
2102
2102
  layerFieldInfo: e.layerFieldInfo,
2103
2103
  userTimezone: a,
2104
2104
  userTimezoneOffset: o
2105
- }, i = await M({
2105
+ }, i = await k({
2106
2106
  promptText: r,
2107
2107
  modelTier: "advanced",
2108
2108
  messages: x(e.messages),
2109
- inputVariables: n,
2109
+ inputVariables: s,
2110
2110
  tools: Je
2111
2111
  });
2112
2112
  if (!(i.tool_calls && Array.isArray(i.tool_calls) && i.tool_calls.length > 0))
@@ -2115,10 +2115,10 @@ const So = s.object({
2115
2115
  messages: [...e.messages, i]
2116
2116
  };
2117
2117
  const c = i.content.toString() || "LLM requested tool calls.";
2118
- return await H(i, t), { ...e, outputMessage: c, messages: [...e.messages, i] };
2119
- }, xo = new P(Je);
2120
- async function Eo(e, t) {
2121
- const { messages: r } = await xo.invoke(
2118
+ return await U(i, t), { ...e, outputMessage: c, messages: [...e.messages, i] };
2119
+ }, Eo = new z(Je);
2120
+ async function $o(e, t) {
2121
+ const { messages: r } = await Eo.invoke(
2122
2122
  { messages: x(e.messages) },
2123
2123
  t
2124
2124
  ), a = [], o = [];
@@ -2139,7 +2139,7 @@ async function Eo(e, t) {
2139
2139
  }
2140
2140
  if (o.length === 0)
2141
2141
  return { ...e, queryResponses: a };
2142
- const n = new K({
2142
+ const s = new te({
2143
2143
  content: `Query results:
2144
2144
  ${o.join(`
2145
2145
  `)}`
@@ -2149,50 +2149,50 @@ ${o.join(`
2149
2149
  return {
2150
2150
  ...e,
2151
2151
  outputMessage: i,
2152
- messages: [...e.messages, ...r, n],
2152
+ messages: [...e.messages, ...r, s],
2153
2153
  queryResponses: a
2154
2154
  };
2155
2155
  }
2156
- const $o = async (e, t) => {
2156
+ const Fo = async (e, t) => {
2157
2157
  try {
2158
2158
  await m({ text: "Requesting LLM for summary on query results" }, t);
2159
- const a = await F("summarize_query_response_prompt"), o = {
2159
+ const a = await R("summarize_query_response_prompt"), o = {
2160
2160
  queryResponse: e.queryResponses
2161
- }, n = await ie({
2161
+ }, s = await Ne({
2162
2162
  promptText: a,
2163
2163
  messages: x(e.messages),
2164
2164
  inputVariables: o
2165
- }), i = typeof n == "string" ? n : n.content;
2166
- return e.messages = [...e.messages, new K(i)], e.outputMessage = i, await m({ text: `Received response from LLM: ${i}` }, t), e;
2165
+ }), i = typeof s == "string" ? s : s.content;
2166
+ return e.messages = [...e.messages, new te(i)], e.outputMessage = i, await m({ text: `Received response from LLM: ${i}` }, t), e;
2167
2167
  } catch (r) {
2168
2168
  throw await m({ text: "Error during filter LLM request" }, t), new Error(`Error during filter LLM request: ${r instanceof Error ? r.message : String(r)}`);
2169
2169
  }
2170
- }, Fo = (e, t) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Query Agent")(e, t), Ro = () => new _(Ze).addNode("requireLayerQueryServices", Fo).addNode("vectorSearchLayers", to).addNode("vectorSearchFields", Xa).addNode("fieldStatistics", Ja).addNode("agent", To).addNode("tools", Eo).addNode("summarizeQueryResponseLLM", $o).addNode("earlyExit", Za).addEdge(j, "requireLayerQueryServices").addEdge("requireLayerQueryServices", "vectorSearchLayers").addConditionalEdges(
2170
+ }, Ro = (e, t) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Query Agent")(e, t), Lo = () => new M(Ze).addNode("requireLayerQueryServices", Ro).addNode("vectorSearchLayers", ro).addNode("vectorSearchFields", eo).addNode("fieldStatistics", Ya).addNode("agent", xo).addNode("tools", $o).addNode("summarizeQueryResponseLLM", Fo).addNode("earlyExit", Ja).addEdge(P, "requireLayerQueryServices").addEdge("requireLayerQueryServices", "vectorSearchLayers").addConditionalEdges(
2171
2171
  "vectorSearchLayers",
2172
2172
  (t) => t.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
2173
2173
  ).addConditionalEdges(
2174
2174
  "vectorSearchFields",
2175
2175
  (t) => t.vectorSearchFieldResults.length ? "fieldStatistics" : "earlyExit"
2176
- ).addEdge("fieldStatistics", "agent").addEdge("agent", "tools").addConditionalEdges("tools", (t) => t.queryResponses.length ? "summarizeQueryResponseLLM" : "earlyExit").addEdge("summarizeQueryResponseLLM", R).addEdge("earlyExit", R), Lo = String.raw`- **layerQuery** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. CRITICAL: Always call the Layer Filter Agent after this agent.
2176
+ ).addEdge("fieldStatistics", "agent").addEdge("agent", "tools").addConditionalEdges("tools", (t) => t.queryResponses.length ? "summarizeQueryResponseLLM" : "earlyExit").addEdge("summarizeQueryResponseLLM", F).addEdge("earlyExit", F), Io = String.raw`- **layerQuery** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. CRITICAL: Always call the Layer Filter Agent after this agent.
2177
2177
  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?”).
2178
2178
  _Example: “How many features are there?”_
2179
2179
  _Example: “What’s the average population?”_
2180
- _Example: “Which values are in the status field?”_`, Ai = {
2180
+ _Example: “Which values are in the status field?”_`, ji = {
2181
2181
  id: "layerQuery",
2182
2182
  name: "Layer Query Agent",
2183
- description: Lo,
2184
- createGraph: Ro,
2183
+ description: Io,
2184
+ createGraph: Lo,
2185
2185
  workspace: Ze
2186
- }, Ce = 0.7, Io = 10, qo = async (e, t) => {
2186
+ }, qe = 0.7, qo = 10, Co = async (e, t) => {
2187
2187
  try {
2188
2188
  const r = C(e.messages);
2189
2189
  await m({ text: "Similarity search to find fields" }, t);
2190
- const a = S(t, "fieldSearch"), o = S(t, "layersAndFieldsRegistry"), n = S(t, "embeddingCache"), i = await a.searchFields({
2190
+ const a = S(t, "fieldSearch"), o = S(t, "layersAndFieldsRegistry"), s = S(t, "embeddingCache"), i = await a.searchFields({
2191
2191
  text: r,
2192
2192
  layerIds: e.vectorSearchLayerIds,
2193
- minScore: Ce,
2194
- topResults: Io,
2195
- embeddingCache: n
2193
+ minScore: qe,
2194
+ topResults: qo,
2195
+ embeddingCache: s
2196
2196
  }), l = i.map(({ layerId: d, results: u }) => {
2197
2197
  const h = u.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
2198
2198
  `);
@@ -2202,7 +2202,7 @@ ${h}`;
2202
2202
  `);
2203
2203
  let c;
2204
2204
  return i.length > 0 ? c = `Vector search completed. Matching layers and fields with scores:
2205
- ${l}` : c = `No vector search results found for score over ${Ce}.`, await m({ text: c }, t), {
2205
+ ${l}` : c = `No vector search results found for score over ${qe}.`, await m({ text: c }, t), {
2206
2206
  ...e,
2207
2207
  vectorSearchFieldResults: i
2208
2208
  };
@@ -2212,14 +2212,14 @@ ${l}` : c = `No vector search results found for score over ${Ce}.`, await m({ te
2212
2212
  t
2213
2213
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
2214
2214
  }
2215
- }, Co = 0.7, Ao = async (e, t) => {
2215
+ }, Ao = 0.7, No = async (e, t) => {
2216
2216
  try {
2217
2217
  const r = C(e.messages);
2218
2218
  await m({ text: `Similarity search to find layers: ${r}` }, t);
2219
- const a = S(t, "layerSearch"), o = S(t, "layersAndFieldsRegistry"), n = await a.searchLayers({
2219
+ const a = S(t, "layerSearch"), o = S(t, "layersAndFieldsRegistry"), s = await a.searchLayers({
2220
2220
  text: r,
2221
- minScore: Co
2222
- }), i = n.map((d) => d.id), l = n.map(({ id: d, score: u }) => `${o.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
2221
+ minScore: Ao
2222
+ }), i = s.map((d) => d.id), l = s.map(({ id: d, score: u }) => `${o.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
2223
2223
  `);
2224
2224
  let c;
2225
2225
  return i.length > 0 ? c = `Vector search completed. Matching layers with scores:
@@ -2235,15 +2235,15 @@ ${l}` : c = "Vector search completed. No matching layers found.", await m({ text
2235
2235
  }
2236
2236
  };
2237
2237
  async function ko(e) {
2238
- const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
2238
+ const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: s } = e;
2239
2239
  let i;
2240
- return n ? i = yt({
2241
- basemapTheme: await xe(a),
2240
+ return s ? i = gt({
2241
+ basemapTheme: await Te(a),
2242
2242
  geometryType: r.geometryType,
2243
- includedTags: n,
2243
+ includedTags: s,
2244
2244
  numColors: Math.min(t.length, 8)
2245
2245
  })[0] : i = ft({
2246
- basemapTheme: await xe(a),
2246
+ basemapTheme: await Te(a),
2247
2247
  geometryType: r.geometryType,
2248
2248
  numColors: Math.min(t.length, 8)
2249
2249
  }).primaryScheme, {
@@ -2259,66 +2259,66 @@ async function ko(e) {
2259
2259
  pieChartScheme: i
2260
2260
  };
2261
2261
  }
2262
- async function No(e) {
2263
- return await pt(e);
2262
+ async function zo(e) {
2263
+ return await yt(e);
2264
2264
  }
2265
- async function zo({
2265
+ async function _o({
2266
2266
  arcgisMap: e,
2267
2267
  arcgisMapView: t,
2268
2268
  layerId: r,
2269
2269
  fields: a,
2270
2270
  colorSchemes: o,
2271
- includeSize: n
2271
+ includeSize: s
2272
2272
  }) {
2273
2273
  const i = t, l = e?.allLayers.find((u) => u.id === r);
2274
2274
  if (!l)
2275
2275
  return `Could not find layer for id: ${r}`;
2276
2276
  const d = {
2277
- styleName: n ? "chart-size" : "chart",
2277
+ styleName: s ? "chart-size" : "chart",
2278
2278
  fields: a,
2279
2279
  layer: l,
2280
2280
  view: i,
2281
2281
  colorSchemeTags: o
2282
2282
  };
2283
2283
  try {
2284
- const u = await ko(d), h = await No(u);
2284
+ const u = await ko(d), h = await zo(u);
2285
2285
  return l.renderer = h.renderer, l.visible = !0, `Chart renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
2286
2286
  } catch (u) {
2287
2287
  return `Error applying chart renderer: ${u instanceof Error ? u.message : String(u)}`;
2288
2288
  }
2289
2289
  }
2290
- const _o = ["mapView"];
2290
+ const jo = ["mapView"];
2291
2291
  function q(e) {
2292
2292
  const r = e?.configurable?.context;
2293
2293
  if (!r || typeof r != "object")
2294
2294
  throw new Error("LayerStylingAgent context missing");
2295
- const a = _o.filter((o) => !(o in r));
2295
+ const a = jo.filter((o) => !(o in r));
2296
2296
  if (a.length)
2297
2297
  throw new Error(`LayerStylingAgent context missing: ${a.join(", ")}`);
2298
2298
  return r;
2299
2299
  }
2300
- async function jo({
2300
+ async function Mo({
2301
2301
  layerId: e,
2302
2302
  fields: t,
2303
2303
  colorSchemes: r,
2304
2304
  includeSize: a
2305
2305
  }, o) {
2306
- const { mapView: n } = q(o);
2307
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await zo({
2308
- arcgisMap: n.map,
2309
- arcgisMapView: n,
2306
+ const { mapView: s } = q(o);
2307
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await _o({
2308
+ arcgisMap: s.map,
2309
+ arcgisMapView: s,
2310
2310
  layerId: e,
2311
2311
  fields: t,
2312
2312
  colorSchemes: r,
2313
2313
  includeSize: a
2314
2314
  });
2315
2315
  }
2316
- const Mo = s.object({
2317
- layerId: s.string().describe("The id of the layer to apply the chart renderer to"),
2318
- fields: s.array(s.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
2319
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
2320
- includeSize: s.boolean().optional().describe("Whether to vary the chart size (chart-size)")
2321
- }), Po = b(jo, {
2316
+ const Po = n.object({
2317
+ layerId: n.string().describe("The id of the layer to apply the chart renderer to"),
2318
+ fields: n.array(n.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
2319
+ colorSchemes: n.array(n.string()).optional().describe("Optional color scheme tags to use"),
2320
+ includeSize: n.boolean().optional().describe("Whether to vary the chart size (chart-size)")
2321
+ }), Do = b(Mo, {
2322
2322
  name: "chart",
2323
2323
  description: `Label: Charts
2324
2324
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
@@ -2331,14 +2331,14 @@ const Mo = s.object({
2331
2331
  Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
2332
2332
  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.
2333
2333
  Fields: This style requires 2-8 number fields.`,
2334
- schema: Mo
2334
+ schema: Po
2335
2335
  });
2336
- function Do(e) {
2337
- const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: n } = e, i = t[0];
2336
+ function Go(e) {
2337
+ const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: s } = e, i = t[0];
2338
2338
  let l;
2339
- return n && (l = he({
2339
+ return s && (l = ue({
2340
2340
  geometryType: r.geometryType,
2341
- includedTags: n,
2341
+ includedTags: s,
2342
2342
  theme: o || "high-to-low"
2343
2343
  })[0]), {
2344
2344
  layer: r,
@@ -2352,15 +2352,15 @@ function Do(e) {
2352
2352
  };
2353
2353
  }
2354
2354
  async function Oo(e) {
2355
- return await gt(e);
2355
+ return await wt(e);
2356
2356
  }
2357
- async function Go({
2357
+ async function Qo({
2358
2358
  arcgisMap: e,
2359
2359
  arcgisMapView: t,
2360
2360
  layerId: r,
2361
2361
  fields: a,
2362
2362
  colorSchemes: o,
2363
- theme: n
2363
+ theme: s
2364
2364
  }) {
2365
2365
  const i = t, l = e?.allLayers.find((d) => d.id === r);
2366
2366
  if (!l)
@@ -2371,75 +2371,75 @@ async function Go({
2371
2371
  layer: l,
2372
2372
  view: i,
2373
2373
  colorSchemeTags: o,
2374
- theme: n
2374
+ theme: s
2375
2375
  };
2376
2376
  try {
2377
- const d = Do(c), u = await Oo(d);
2377
+ const d = Go(c), u = await Oo(d);
2378
2378
  return l.renderer = u.renderer, l.visible = !0, `Color-age renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
2379
2379
  } catch (d) {
2380
2380
  return `Error applying color-age renderer: ${d instanceof Error ? d.message : String(d)}`;
2381
2381
  }
2382
2382
  }
2383
- async function Qo({
2383
+ async function Vo({
2384
2384
  layerId: e,
2385
2385
  fields: t,
2386
2386
  colorSchemes: r,
2387
2387
  theme: a
2388
2388
  }, o) {
2389
- const { mapView: n } = q(o);
2390
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Go({
2391
- arcgisMap: n.map,
2392
- arcgisMapView: n,
2389
+ const { mapView: s } = q(o);
2390
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Qo({
2391
+ arcgisMap: s.map,
2392
+ arcgisMapView: s,
2393
2393
  layerId: e,
2394
2394
  fields: t,
2395
2395
  colorSchemes: r,
2396
2396
  theme: a
2397
2397
  });
2398
2398
  }
2399
- const Vo = s.object({
2400
- layerId: s.string().describe("The id of the layer to apply the color-age renderer to"),
2401
- fields: s.array(s.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
2402
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
2403
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
2404
- }), Wo = b(Qo, {
2399
+ const Wo = n.object({
2400
+ layerId: n.string().describe("The id of the layer to apply the color-age renderer to"),
2401
+ fields: n.array(n.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
2402
+ colorSchemes: n.array(n.string()).optional().describe("Optional color scheme tags to use"),
2403
+ theme: n.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
2404
+ }), Bo = b(Vo, {
2405
2405
  name: "color-age",
2406
2406
  description: `Label: Age (color)
2407
2407
  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.
2408
2408
  Keywords: since, age, how old, how long
2409
2409
  Example: Show the age of each feature based on its reported date.
2410
2410
  Fields: This style requires at least one field with a date type.`,
2411
- schema: Vo
2411
+ schema: Wo
2412
2412
  });
2413
- function Bo(e) {
2413
+ function Ko(e) {
2414
2414
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
2415
- let { theme: n } = e, i = t[1];
2415
+ let { theme: s } = e, i = t[1];
2416
2416
  const l = t[0];
2417
2417
  let c;
2418
- return o && (c = he({
2418
+ return o && (c = ue({
2419
2419
  geometryType: r.geometryType,
2420
2420
  includedTags: o,
2421
- theme: n || "high-to-low"
2421
+ theme: s || "high-to-low"
2422
2422
  })[0]), {
2423
2423
  layer: r,
2424
2424
  view: a,
2425
2425
  field: l,
2426
2426
  normalizationField: i,
2427
- theme: n,
2427
+ theme: s,
2428
2428
  sizeOptimizationEnabled: !0,
2429
2429
  outlineOptimizationEnabled: !0,
2430
2430
  colorScheme: c
2431
2431
  };
2432
2432
  }
2433
- async function Ko(e) {
2434
- return await wt(e);
2433
+ async function Uo(e) {
2434
+ return await bt(e);
2435
2435
  }
2436
- async function Uo({
2436
+ async function Ho({
2437
2437
  arcgisMap: e,
2438
2438
  arcgisMapView: t,
2439
2439
  layerId: r,
2440
2440
  fields: a,
2441
2441
  colorSchemes: o,
2442
- theme: n
2442
+ theme: s
2443
2443
  }) {
2444
2444
  const i = t, l = e?.allLayers.find((d) => d.id === r);
2445
2445
  if (!l)
@@ -2450,74 +2450,74 @@ async function Uo({
2450
2450
  layer: l,
2451
2451
  view: i,
2452
2452
  colorSchemeTags: o,
2453
- theme: n
2453
+ theme: s
2454
2454
  };
2455
2455
  try {
2456
- const d = Bo(c), u = await Ko(d);
2456
+ const d = Ko(c), u = await Uo(d);
2457
2457
  return l.renderer = u.renderer, l.visible = !0, `Color renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
2458
2458
  } catch (d) {
2459
2459
  return `Error applying color renderer: ${d instanceof Error ? d.message : String(d)}`;
2460
2460
  }
2461
2461
  }
2462
- async function Ho({
2462
+ async function Zo({
2463
2463
  layerId: e,
2464
2464
  fields: t,
2465
2465
  colorSchemes: r,
2466
2466
  theme: a
2467
2467
  }, o) {
2468
- const { mapView: n } = q(o);
2469
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Uo({
2470
- arcgisMap: n.map,
2471
- arcgisMapView: n,
2468
+ const { mapView: s } = q(o);
2469
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Ho({
2470
+ arcgisMap: s.map,
2471
+ arcgisMapView: s,
2472
2472
  layerId: e,
2473
2473
  fields: t,
2474
2474
  colorSchemes: r,
2475
2475
  theme: a
2476
2476
  });
2477
2477
  }
2478
- const Zo = s.object({
2479
- layerId: s.string().describe("The id of the layer to apply the color renderer to"),
2480
- fields: s.array(s.string()).describe("The field(s) to use for the color renderer"),
2481
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
2482
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
2483
- }), Jo = b(Ho, {
2478
+ const Jo = n.object({
2479
+ layerId: n.string().describe("The id of the layer to apply the color renderer to"),
2480
+ fields: n.array(n.string()).describe("The field(s) to use for the color renderer"),
2481
+ colorSchemes: n.array(n.string()).optional().describe("Optional color scheme tags to use"),
2482
+ theme: n.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
2483
+ }), Yo = b(Zo, {
2484
2484
  name: "color",
2485
2485
  description: `Label: Counts and Amounts (color)
2486
2486
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
2487
2487
  Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
2488
2488
  Example: Color each feature based on the population density.
2489
2489
  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.`,
2490
- schema: Zo
2490
+ schema: Jo
2491
2491
  });
2492
- function Yo(e) {
2493
- const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: n } = e;
2492
+ function Xo(e) {
2493
+ const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: s } = e;
2494
2494
  let i, l;
2495
2495
  const c = t[0];
2496
- return o && (l = he({
2496
+ return o && (l = ue({
2497
2497
  geometryType: r.geometryType,
2498
2498
  includedTags: o,
2499
- theme: n || "high-to-low"
2499
+ theme: s || "high-to-low"
2500
2500
  })[0]), {
2501
2501
  layer: r,
2502
2502
  view: a,
2503
2503
  field: c,
2504
2504
  normalizationField: i,
2505
- theme: n,
2505
+ theme: s,
2506
2506
  colorOptions: {
2507
2507
  colorScheme: l
2508
2508
  }
2509
2509
  };
2510
2510
  }
2511
- async function Xo(e) {
2512
- return await bt(e);
2511
+ async function es(e) {
2512
+ return await St(e);
2513
2513
  }
2514
- async function en({
2514
+ async function ts({
2515
2515
  arcgisMap: e,
2516
2516
  arcgisMapView: t,
2517
2517
  layerId: r,
2518
2518
  fields: a,
2519
2519
  colorSchemes: o,
2520
- theme: n
2520
+ theme: s
2521
2521
  }) {
2522
2522
  const i = t, l = e?.allLayers.find((d) => d.id === r);
2523
2523
  if (!l)
@@ -2528,49 +2528,49 @@ async function en({
2528
2528
  layer: l,
2529
2529
  view: i,
2530
2530
  colorSchemeTags: o,
2531
- theme: n
2531
+ theme: s
2532
2532
  };
2533
2533
  try {
2534
- const d = Yo(c), u = await Xo(d);
2534
+ const d = Xo(c), u = await es(d);
2535
2535
  return l.renderer = u.renderer, l.visible = !0, `Color-size-univariate renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
2536
2536
  } catch (d) {
2537
2537
  return `Error applying color-size-univariate renderer: ${d instanceof Error ? d.message : String(d)}`;
2538
2538
  }
2539
2539
  }
2540
- async function tn({
2540
+ async function rs({
2541
2541
  layerId: e,
2542
2542
  fields: t,
2543
2543
  colorSchemes: r,
2544
2544
  theme: a
2545
2545
  }, o) {
2546
- const { mapView: n } = q(o);
2547
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await en({
2548
- arcgisMap: n.map,
2549
- arcgisMapView: n,
2546
+ const { mapView: s } = q(o);
2547
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await ts({
2548
+ arcgisMap: s.map,
2549
+ arcgisMapView: s,
2550
2550
  layerId: e,
2551
2551
  fields: t,
2552
2552
  colorSchemes: r,
2553
2553
  theme: a
2554
2554
  });
2555
2555
  }
2556
- const rn = s.object({
2557
- layerId: s.string().describe("The id of the layer to apply the color-size univariate renderer to"),
2558
- fields: s.array(s.string()).describe("The fields to use for the color-size univariate renderer"),
2559
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
2560
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
2561
- }), an = b(tn, {
2556
+ const as = n.object({
2557
+ layerId: n.string().describe("The id of the layer to apply the color-size univariate renderer to"),
2558
+ fields: n.array(n.string()).describe("The fields to use for the color-size univariate renderer"),
2559
+ colorSchemes: n.array(n.string()).optional().describe("Optional color scheme tags to use"),
2560
+ theme: n.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
2561
+ }), os = b(rs, {
2562
2562
  name: "color-size-univariate",
2563
2563
  description: `Label: Color and Size (univariate)
2564
2564
  Description: Vary symbol size and color based on the values of two numeric attributes.
2565
2565
  Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
2566
2566
  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.
2567
2567
  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.`,
2568
- schema: rn
2568
+ schema: as
2569
2569
  });
2570
- function on(e) {
2570
+ function ss(e) {
2571
2571
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
2572
- let n;
2573
- return o && (n = vt({
2572
+ let s;
2573
+ return o && (s = Tt({
2574
2574
  includedTags: o,
2575
2575
  numColors: Math.min(t.length, 8)
2576
2576
  })[0]), {
@@ -2584,43 +2584,43 @@ function on(e) {
2584
2584
  label: r.fields.find((l) => l.name === i)?.alias ?? ""
2585
2585
  })).slice(0, 8),
2586
2586
  outlineOptimizationEnabled: !0,
2587
- dotDensityScheme: n
2587
+ dotDensityScheme: s
2588
2588
  };
2589
2589
  }
2590
- async function nn(e) {
2591
- return await St(e);
2590
+ async function ns(e) {
2591
+ return await vt(e);
2592
2592
  }
2593
- async function sn({
2593
+ async function is({
2594
2594
  arcgisMap: e,
2595
2595
  arcgisMapView: t,
2596
2596
  layerId: r,
2597
2597
  fields: a,
2598
2598
  colorSchemes: o
2599
2599
  }) {
2600
- const n = t, i = e?.allLayers.find((c) => c.id === r);
2600
+ const s = t, i = e?.allLayers.find((c) => c.id === r);
2601
2601
  if (!i)
2602
2602
  return `Could not find layer for id: ${r}`;
2603
2603
  const l = {
2604
2604
  styleName: "dot-density",
2605
2605
  fields: a,
2606
2606
  layer: i,
2607
- view: n,
2607
+ view: s,
2608
2608
  colorSchemeTags: o
2609
2609
  };
2610
2610
  try {
2611
- const c = on(l), d = await nn(c);
2611
+ const c = ss(l), d = await ns(c);
2612
2612
  return i.renderer = d.renderer, i.visible = !0, `Dot Density renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2613
2613
  } catch (c) {
2614
2614
  return `Error applying dot density renderer: ${c instanceof Error ? c.message : String(c)}`;
2615
2615
  }
2616
2616
  }
2617
- async function ln({
2617
+ async function ls({
2618
2618
  layerId: e,
2619
2619
  fields: t,
2620
2620
  colorSchemes: r
2621
2621
  }, a) {
2622
2622
  const { mapView: o } = q(a);
2623
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await sn({
2623
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await is({
2624
2624
  arcgisMap: o.map,
2625
2625
  arcgisMapView: o,
2626
2626
  layerId: e,
@@ -2628,11 +2628,11 @@ async function ln({
2628
2628
  colorSchemes: r
2629
2629
  });
2630
2630
  }
2631
- const cn = s.object({
2632
- layerId: s.string().describe("The id of the layer to apply the dot density renderer to"),
2633
- fields: s.array(s.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
2634
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
2635
- }), dn = b(ln, {
2631
+ const cs = n.object({
2632
+ layerId: n.string().describe("The id of the layer to apply the dot density renderer to"),
2633
+ fields: n.array(n.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
2634
+ colorSchemes: n.array(n.string()).optional().describe("Optional color scheme tags to use")
2635
+ }), ds = b(ls, {
2636
2636
  name: "dot-density",
2637
2637
  description: `Dot Density
2638
2638
  Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
@@ -2646,56 +2646,56 @@ const cn = s.object({
2646
2646
  - Display demographic patterns within census tracts
2647
2647
  **Fields:** Requires 2-8 number fields.
2648
2648
  **Keywords:** density, how much, how many, total, number, amount`,
2649
- schema: cn
2649
+ schema: cs
2650
2650
  });
2651
- function un(e) {
2651
+ function us(e) {
2652
2652
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
2653
- let n;
2653
+ let s;
2654
2654
  const i = t[0];
2655
- return o && (n = xt({
2655
+ return o && (s = Et({
2656
2656
  includedTags: o,
2657
2657
  basemap: a.map?.basemap || "topo"
2658
2658
  })[0]), {
2659
2659
  layer: r,
2660
2660
  view: a,
2661
2661
  field: i,
2662
- heatmapScheme: n
2662
+ heatmapScheme: s
2663
2663
  };
2664
2664
  }
2665
- async function hn(e) {
2666
- return await Tt(e);
2665
+ async function hs(e) {
2666
+ return await xt(e);
2667
2667
  }
2668
- async function mn({
2668
+ async function ms({
2669
2669
  arcgisMap: e,
2670
2670
  arcgisMapView: t,
2671
2671
  layerId: r,
2672
2672
  fields: a,
2673
2673
  colorSchemes: o
2674
2674
  }) {
2675
- const n = t, i = e?.allLayers.find((c) => c.id === r);
2675
+ const s = t, i = e?.allLayers.find((c) => c.id === r);
2676
2676
  if (!i)
2677
2677
  return `Could not find layer for id: ${r}`;
2678
2678
  const l = {
2679
2679
  styleName: "heatmap",
2680
2680
  fields: a,
2681
2681
  layer: i,
2682
- view: n,
2682
+ view: s,
2683
2683
  colorSchemeTags: o
2684
2684
  };
2685
2685
  try {
2686
- const c = un(l), d = await hn(c);
2686
+ const c = us(l), d = await hs(c);
2687
2687
  return i.renderer = d.renderer, i.visible = !0, `Heatmap renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2688
2688
  } catch (c) {
2689
2689
  return `Error applying heatmap renderer: ${c instanceof Error ? c.message : String(c)}`;
2690
2690
  }
2691
2691
  }
2692
- async function pn({
2692
+ async function ps({
2693
2693
  layerId: e,
2694
2694
  fields: t,
2695
2695
  colorSchemes: r
2696
2696
  }, a) {
2697
2697
  const { mapView: o } = q(a);
2698
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await mn({
2698
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await ms({
2699
2699
  arcgisMap: o.map,
2700
2700
  arcgisMapView: o,
2701
2701
  layerId: e,
@@ -2703,25 +2703,25 @@ async function pn({
2703
2703
  colorSchemes: r
2704
2704
  });
2705
2705
  }
2706
- const yn = s.object({
2707
- layerId: s.string().describe("The id of the layer to apply the heatmap renderer to"),
2708
- fields: s.array(s.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
2709
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
2710
- }), fn = b(pn, {
2706
+ const ys = n.object({
2707
+ layerId: n.string().describe("The id of the layer to apply the heatmap renderer to"),
2708
+ fields: n.array(n.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
2709
+ colorSchemes: n.array(n.string()).optional().describe("Optional color scheme tags to use")
2710
+ }), gs = b(ps, {
2711
2711
  name: "heatmap",
2712
2712
  description: `Label: Heat Map
2713
2713
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
2714
2714
  Keywords: density, heatmap, hot spots, pattern, cluster
2715
2715
  Example: Create a heatmap
2716
2716
  Fields: This typically requires zero or one field of type number.`,
2717
- schema: yn
2717
+ schema: ys
2718
2718
  });
2719
- function gn(e) {
2720
- const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
2719
+ function fs(e) {
2720
+ const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: s } = e;
2721
2721
  let i;
2722
- return n && (i = $t({
2722
+ return s && (i = Ft({
2723
2723
  geometryType: r.geometryType,
2724
- includedTags: n,
2724
+ includedTags: s,
2725
2725
  numColors: Math.min(t.length, 10)
2726
2726
  })[0]), {
2727
2727
  layer: r,
@@ -2733,56 +2733,56 @@ function gn(e) {
2733
2733
  predominanceScheme: i
2734
2734
  };
2735
2735
  }
2736
- async function wn(e) {
2737
- return await Et(e);
2736
+ async function ws(e) {
2737
+ return await $t(e);
2738
2738
  }
2739
- async function bn({
2739
+ async function bs({
2740
2740
  arcgisMap: e,
2741
2741
  arcgisMapView: t,
2742
2742
  layerId: r,
2743
2743
  fields: a,
2744
2744
  colorSchemes: o,
2745
- includeSize: n
2745
+ includeSize: s
2746
2746
  }) {
2747
2747
  const i = t, l = e?.allLayers.find((u) => u.id === r);
2748
2748
  if (!l)
2749
2749
  return `Could not find layer for id: ${r}`;
2750
2750
  const d = {
2751
- styleName: n ? "predominance-size" : "predominance",
2751
+ styleName: s ? "predominance-size" : "predominance",
2752
2752
  fields: a,
2753
2753
  layer: l,
2754
2754
  view: i,
2755
2755
  colorSchemeTags: o
2756
2756
  };
2757
2757
  try {
2758
- const u = gn(d), h = await wn(u);
2758
+ const u = fs(d), h = await ws(u);
2759
2759
  return l.renderer = h.renderer, l.visible = !0, `Predominance renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
2760
2760
  } catch (u) {
2761
2761
  return `Error applying predominance renderer: ${u instanceof Error ? u.message : String(u)}`;
2762
2762
  }
2763
2763
  }
2764
- async function Sn({
2764
+ async function Ss({
2765
2765
  layerId: e,
2766
2766
  fields: t,
2767
2767
  colorSchemes: r,
2768
2768
  includeSize: a
2769
2769
  }, o) {
2770
- const { mapView: n } = q(o);
2771
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await bn({
2772
- arcgisMap: n.map,
2773
- arcgisMapView: n,
2770
+ const { mapView: s } = q(o);
2771
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await bs({
2772
+ arcgisMap: s.map,
2773
+ arcgisMapView: s,
2774
2774
  layerId: e,
2775
2775
  fields: t,
2776
2776
  colorSchemes: r,
2777
2777
  includeSize: a
2778
2778
  });
2779
2779
  }
2780
- const vn = s.object({
2781
- layerId: s.string().describe("The id of the layer to apply the predominance renderer to"),
2782
- fields: s.array(s.string()).describe("The fields to use for the predominance renderer (competing categories)"),
2783
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
2784
- includeSize: s.boolean().optional().describe("Whether to include size visualization (predominance-size)")
2785
- }), Tn = b(Sn, {
2780
+ const vs = n.object({
2781
+ layerId: n.string().describe("The id of the layer to apply the predominance renderer to"),
2782
+ fields: n.array(n.string()).describe("The fields to use for the predominance renderer (competing categories)"),
2783
+ colorSchemes: n.array(n.string()).optional().describe("Optional color scheme tags to use"),
2784
+ includeSize: n.boolean().optional().describe("Whether to include size visualization (predominance-size)")
2785
+ }), Ts = b(Ss, {
2786
2786
  name: "predominance",
2787
2787
  description: `Label: Predominant category
2788
2788
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
@@ -2795,17 +2795,17 @@ const vn = s.object({
2795
2795
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
2796
2796
  Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
2797
2797
  Fields: This style relies on 2-10 number fields.`,
2798
- schema: vn
2798
+ schema: vs
2799
2799
  });
2800
- function xn(e) {
2800
+ function xs(e) {
2801
2801
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
2802
- let n;
2802
+ let s;
2803
2803
  const i = {
2804
2804
  field: t[0]
2805
2805
  }, l = {
2806
2806
  field: t[1]
2807
2807
  };
2808
- return o && (n = Rt({
2808
+ return o && (s = Lt({
2809
2809
  geometryType: r.geometryType,
2810
2810
  includedTags: o
2811
2811
  })[0]), {
@@ -2815,43 +2815,43 @@ function xn(e) {
2815
2815
  field2: l,
2816
2816
  outlineOptimizationEnabled: !0,
2817
2817
  sizeOptimizationEnabled: !0,
2818
- relationshipScheme: n
2818
+ relationshipScheme: s
2819
2819
  };
2820
2820
  }
2821
- async function En(e) {
2822
- return await Ft(e);
2821
+ async function Es(e) {
2822
+ return await Rt(e);
2823
2823
  }
2824
- async function $n({
2824
+ async function $s({
2825
2825
  arcgisMap: e,
2826
2826
  arcgisMapView: t,
2827
2827
  layerId: r,
2828
2828
  fields: a,
2829
2829
  colorSchemes: o
2830
2830
  }) {
2831
- const n = t, i = e?.allLayers.find((c) => c.id === r);
2831
+ const s = t, i = e?.allLayers.find((c) => c.id === r);
2832
2832
  if (!i)
2833
2833
  return `Could not find layer for id: ${r}`;
2834
2834
  const l = {
2835
2835
  styleName: "relationship",
2836
2836
  fields: a,
2837
2837
  layer: i,
2838
- view: n,
2838
+ view: s,
2839
2839
  colorSchemeTags: o
2840
2840
  };
2841
2841
  try {
2842
- const c = xn(l), d = await En(c);
2842
+ const c = xs(l), d = await Es(c);
2843
2843
  return i.renderer = d.renderer, i.visible = !0, `Relationship renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2844
2844
  } catch (c) {
2845
2845
  return `Error applying relationship renderer: ${c instanceof Error ? c.message : String(c)}`;
2846
2846
  }
2847
2847
  }
2848
- async function Fn({
2848
+ async function Fs({
2849
2849
  layerId: e,
2850
2850
  fields: t,
2851
2851
  colorSchemes: r
2852
2852
  }, a) {
2853
2853
  const { mapView: o } = q(a);
2854
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await $n({
2854
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, a), await $s({
2855
2855
  arcgisMap: o.map,
2856
2856
  arcgisMapView: o,
2857
2857
  layerId: e,
@@ -2859,41 +2859,41 @@ async function Fn({
2859
2859
  colorSchemes: r
2860
2860
  });
2861
2861
  }
2862
- const Rn = s.object({
2863
- layerId: s.string().describe("The id of the layer to apply the relationship renderer to"),
2864
- fields: s.array(s.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
2865
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
2866
- }), Ln = b(Fn, {
2862
+ const Rs = n.object({
2863
+ layerId: n.string().describe("The id of the layer to apply the relationship renderer to"),
2864
+ fields: n.array(n.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
2865
+ colorSchemes: n.array(n.string()).optional().describe("Optional color scheme tags to use")
2866
+ }), Ls = b(Fs, {
2867
2867
  name: "relationship",
2868
2868
  description: `Label: Relationship
2869
2869
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
2870
2870
  Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
2871
2871
  Example: Show the relationship between tree height and carbon storage
2872
2872
  Fields: This style requires two number fields.`,
2873
- schema: Rn
2873
+ schema: Rs
2874
2874
  });
2875
- function In(e) {
2876
- const { fields: t, layer: r, view: a, theme: o } = e, n = t[0];
2875
+ function Is(e) {
2876
+ const { fields: t, layer: r, view: a, theme: o } = e, s = t[0];
2877
2877
  return {
2878
2878
  layer: r,
2879
2879
  view: a,
2880
- startTime: n,
2880
+ startTime: s,
2881
2881
  endTime: /* @__PURE__ */ new Date(),
2882
2882
  theme: o,
2883
2883
  sizeOptimizationEnabled: !0,
2884
2884
  outlineOptimizationEnabled: !0
2885
2885
  };
2886
2886
  }
2887
- async function qn(e) {
2888
- return await Lt(e);
2887
+ async function qs(e) {
2888
+ return await It(e);
2889
2889
  }
2890
- async function Cn({
2890
+ async function Cs({
2891
2891
  arcgisMap: e,
2892
2892
  arcgisMapView: t,
2893
2893
  layerId: r,
2894
2894
  fields: a,
2895
2895
  colorSchemes: o,
2896
- theme: n
2896
+ theme: s
2897
2897
  }) {
2898
2898
  const i = t, l = e?.allLayers.find((d) => d.id === r);
2899
2899
  if (!l)
@@ -2904,69 +2904,69 @@ async function Cn({
2904
2904
  layer: l,
2905
2905
  view: i,
2906
2906
  colorSchemeTags: o,
2907
- theme: n
2907
+ theme: s
2908
2908
  };
2909
2909
  try {
2910
- const d = In(c), u = await qn(d);
2910
+ const d = Is(c), u = await qs(d);
2911
2911
  return l.renderer = u.renderer, l.visible = !0, `Size-age renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
2912
2912
  } catch (d) {
2913
2913
  return `Error applying size-age renderer: ${d instanceof Error ? d.message : String(d)}`;
2914
2914
  }
2915
2915
  }
2916
- async function An({
2916
+ async function As({
2917
2917
  layerId: e,
2918
2918
  fields: t,
2919
2919
  colorSchemes: r,
2920
2920
  theme: a
2921
2921
  }, o) {
2922
- const { mapView: n } = q(o);
2923
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Cn({
2924
- arcgisMap: n.map,
2925
- arcgisMapView: n,
2922
+ const { mapView: s } = q(o);
2923
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Cs({
2924
+ arcgisMap: s.map,
2925
+ arcgisMapView: s,
2926
2926
  layerId: e,
2927
2927
  fields: t,
2928
2928
  colorSchemes: r,
2929
2929
  theme: a
2930
2930
  });
2931
2931
  }
2932
- const kn = s.object({
2933
- layerId: s.string().describe("The id of the layer to apply the size-age renderer to"),
2934
- fields: s.array(s.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
2935
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
2936
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2937
- }), Nn = b(An, {
2932
+ const Ns = n.object({
2933
+ layerId: n.string().describe("The id of the layer to apply the size-age renderer to"),
2934
+ fields: n.array(n.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
2935
+ colorSchemes: n.array(n.string()).optional().describe("Optional color scheme tags to use"),
2936
+ theme: n.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2937
+ }), ks = b(As, {
2938
2938
  name: "size-age",
2939
2939
  description: `Label: Age (size)
2940
2940
  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.
2941
2941
  Keywords: since, age, how old, how long
2942
2942
  Example: Change the size of features so older features are larger than new features.
2943
2943
  Fields: This style requires at least one field with a date type.`,
2944
- schema: kn
2944
+ schema: Ns
2945
2945
  });
2946
- function zn(e) {
2946
+ function zs(e) {
2947
2947
  const { fields: t, layer: r, view: a } = e;
2948
- let { theme: o } = e, n = t[1];
2948
+ let { theme: o } = e, s = t[1];
2949
2949
  const i = t[0];
2950
2950
  return {
2951
2951
  layer: r,
2952
2952
  view: a,
2953
2953
  field: i,
2954
- normalizationField: n,
2954
+ normalizationField: s,
2955
2955
  theme: o,
2956
2956
  sizeOptimizationEnabled: !0,
2957
2957
  outlineOptimizationEnabled: !0
2958
2958
  };
2959
2959
  }
2960
- async function _n(e) {
2961
- return await It(e);
2960
+ async function _s(e) {
2961
+ return await qt(e);
2962
2962
  }
2963
- async function jn({
2963
+ async function js({
2964
2964
  arcgisMap: e,
2965
2965
  arcgisMapView: t,
2966
2966
  layerId: r,
2967
2967
  fields: a,
2968
2968
  colorSchemes: o,
2969
- theme: n
2969
+ theme: s
2970
2970
  }) {
2971
2971
  const i = t, l = e?.allLayers.find((d) => d.id === r);
2972
2972
  if (!l)
@@ -2977,37 +2977,37 @@ async function jn({
2977
2977
  layer: l,
2978
2978
  view: i,
2979
2979
  colorSchemeTags: o,
2980
- theme: n
2980
+ theme: s
2981
2981
  };
2982
2982
  try {
2983
- const d = zn(c), u = await _n(d);
2983
+ const d = zs(c), u = await _s(d);
2984
2984
  return l.renderer = u.renderer, l.visible = !0, `Size renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
2985
2985
  } catch (d) {
2986
2986
  return `Error applying size renderer: ${d instanceof Error ? d.message : String(d)}`;
2987
2987
  }
2988
2988
  }
2989
- async function Mn({
2989
+ async function Ms({
2990
2990
  layerId: e,
2991
2991
  fields: t,
2992
2992
  colorSchemes: r,
2993
2993
  theme: a
2994
2994
  }, o) {
2995
- const { mapView: n } = q(o);
2996
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await jn({
2997
- arcgisMap: n.map,
2998
- arcgisMapView: n,
2995
+ const { mapView: s } = q(o);
2996
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await js({
2997
+ arcgisMap: s.map,
2998
+ arcgisMapView: s,
2999
2999
  layerId: e,
3000
3000
  fields: t,
3001
3001
  colorSchemes: r,
3002
3002
  theme: a
3003
3003
  });
3004
3004
  }
3005
- const Pn = s.object({
3006
- layerId: s.string().describe("The id of the layer to apply the size renderer to"),
3007
- fields: s.array(s.string()).describe("The field(s) to use for the size renderer (numeric data)"),
3008
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
3009
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
3010
- }), Dn = b(Mn, {
3005
+ const Ps = n.object({
3006
+ layerId: n.string().describe("The id of the layer to apply the size renderer to"),
3007
+ fields: n.array(n.string()).describe("The field(s) to use for the size renderer (numeric data)"),
3008
+ colorSchemes: n.array(n.string()).optional().describe("Optional color scheme tags to use"),
3009
+ theme: n.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
3010
+ }), Ds = b(Ms, {
3011
3011
  name: "size",
3012
3012
  description: `Label: Counts and Amounts (size)
3013
3013
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
@@ -3020,18 +3020,18 @@ const Pn = s.object({
3020
3020
  Keywords: graduated size, proportional size, classed size, how much, total, number, when
3021
3021
  Example: Vary the size of each feature based on the date a ticket was completed.
3022
3022
  Fields: This style requires a single field with a date type.`,
3023
- schema: Pn
3023
+ schema: Ps
3024
3024
  });
3025
- function On(e) {
3026
- const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], i = t[1], l = t[2];
3025
+ function Gs(e) {
3026
+ const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, s = t[0], i = t[1], l = t[2];
3027
3027
  let c;
3028
- return o && (c = Ct({
3028
+ return o && (c = At({
3029
3029
  geometryType: r.geometryType,
3030
3030
  includedTags: o
3031
3031
  })[0]), {
3032
3032
  layer: r,
3033
3033
  view: a,
3034
- field: n,
3034
+ field: s,
3035
3035
  field2: i,
3036
3036
  field3: l,
3037
3037
  outlineOptimizationEnabled: !0,
@@ -3039,16 +3039,16 @@ function On(e) {
3039
3039
  typeScheme: c
3040
3040
  };
3041
3041
  }
3042
- async function Gn(e) {
3043
- return await qt(e);
3042
+ async function Os(e) {
3043
+ return await Ct(e);
3044
3044
  }
3045
- async function Qn({
3045
+ async function Qs({
3046
3046
  arcgisMap: e,
3047
3047
  arcgisMapView: t,
3048
3048
  layerId: r,
3049
3049
  fields: a,
3050
3050
  colorSchemes: o,
3051
- theme: n
3051
+ theme: s
3052
3052
  }) {
3053
3053
  const i = t, l = e?.allLayers.find((d) => d.id === r);
3054
3054
  if (!l)
@@ -3059,74 +3059,74 @@ async function Qn({
3059
3059
  layer: l,
3060
3060
  view: i,
3061
3061
  colorSchemeTags: o,
3062
- theme: n
3062
+ theme: s
3063
3063
  };
3064
3064
  try {
3065
- const d = On(c), u = await Gn(d);
3065
+ const d = Gs(c), u = await Os(d);
3066
3066
  return l.renderer = u.renderer, l.visible = !0, `Type renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
3067
3067
  } catch (d) {
3068
3068
  return `Error applying type renderer: ${d instanceof Error ? d.message : String(d)}`;
3069
3069
  }
3070
3070
  }
3071
- async function Vn({
3071
+ async function Vs({
3072
3072
  layerId: e,
3073
3073
  fields: t,
3074
3074
  colorSchemes: r,
3075
3075
  theme: a
3076
3076
  }, o) {
3077
- const { mapView: n } = q(o);
3078
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Qn({
3079
- arcgisMap: n.map,
3080
- arcgisMapView: n,
3077
+ const { mapView: s } = q(o);
3078
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Qs({
3079
+ arcgisMap: s.map,
3080
+ arcgisMapView: s,
3081
3081
  layerId: e,
3082
3082
  fields: t,
3083
3083
  colorSchemes: r,
3084
3084
  theme: a
3085
3085
  });
3086
3086
  }
3087
- const Wn = s.object({
3088
- layerId: s.string().describe("The id of the layer to apply the type renderer to"),
3089
- fields: s.array(s.string()).describe("The field(s) to use for the type renderer (categorical data)"),
3090
- colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
3091
- theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
3092
- }), Bn = b(Vn, {
3087
+ const Ws = n.object({
3088
+ layerId: n.string().describe("The id of the layer to apply the type renderer to"),
3089
+ fields: n.array(n.string()).describe("The field(s) to use for the type renderer (categorical data)"),
3090
+ colorSchemes: n.array(n.string()).optional().describe("Optional color scheme tags to use"),
3091
+ theme: n.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
3092
+ }), Bs = b(Vs, {
3093
3093
  name: "type",
3094
3094
  description: `Label: Types (unique symbols)
3095
3095
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
3096
3096
  Keywords: categorical, category, type, unique, discrete, point of interest, region, group
3097
3097
  Example: Color each feature based on the region it belongs to
3098
3098
  Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
3099
- schema: Wn
3099
+ schema: Ws
3100
3100
  }), Ye = [
3101
- Po,
3102
- Wo,
3103
- Jo,
3104
- an,
3105
- dn,
3106
- fn,
3107
- Tn,
3108
- Ln,
3109
- Nn,
3110
- Dn,
3111
- Bn
3112
- ], Kn = async (e, t) => {
3101
+ Do,
3102
+ Bo,
3103
+ Yo,
3104
+ os,
3105
+ ds,
3106
+ gs,
3107
+ Ts,
3108
+ Ls,
3109
+ ks,
3110
+ Ds,
3111
+ Bs
3112
+ ], Ks = async (e, t) => {
3113
3113
  await m({ text: "Requesting LLM for layer query results" }, t);
3114
- const r = await F("navigation_intent_prompt");
3114
+ const r = await R("navigation_intent_prompt");
3115
3115
  if (!t?.configurable)
3116
3116
  throw new Error("config.configurable is required for layer query tools");
3117
3117
  const a = {
3118
3118
  layerFieldInfo: e.layerFieldInfo
3119
- }, o = await M({
3119
+ }, o = await k({
3120
3120
  promptText: r,
3121
3121
  modelTier: "advanced",
3122
3122
  messages: x(e.messages),
3123
3123
  inputVariables: a,
3124
3124
  tools: Ye
3125
3125
  });
3126
- return await H(o, t), { ...e, messages: [...e.messages, o] };
3126
+ return await U(o, t), { ...e, messages: [...e.messages, o] };
3127
3127
  };
3128
- async function Un(e, t) {
3129
- const a = await new P(Ye).invoke(
3128
+ async function Us(e, t) {
3129
+ const a = await new z(Ye).invoke(
3130
3130
  {
3131
3131
  messages: x(e.messages)
3132
3132
  },
@@ -3134,21 +3134,21 @@ async function Un(e, t) {
3134
3134
  ), o = a.messages.map((i) => i.text).join(`
3135
3135
  `);
3136
3136
  await m({ text: `Finished executing layer filter tool: ${o}` }, t);
3137
- const n = a.messages.map((i) => i.text).join(`
3137
+ const s = a.messages.map((i) => i.text).join(`
3138
3138
  `);
3139
- return { ...e, outputMessage: n };
3139
+ return { ...e, outputMessage: s };
3140
3140
  }
3141
- const Xe = g.Root({
3141
+ const Xe = f.Root({
3142
3142
  // Inputs coming from global context
3143
- messages: g({
3144
- reducer: z,
3143
+ messages: f({
3144
+ reducer: j,
3145
3145
  default: () => []
3146
3146
  }),
3147
3147
  // Accumulates user-visible output across graph nodes.
3148
3148
  // Uses append semantics, but de-duplicates identical consecutive writes.
3149
3149
  // This avoids duplicate output when tool nodes and final LLM nodes
3150
3150
  // emit the same text during a single agent turn.
3151
- outputMessage: g({
3151
+ outputMessage: f({
3152
3152
  reducer: (e = "", t) => {
3153
3153
  const r = typeof t == "string" ? t.trim() : "";
3154
3154
  if (!r)
@@ -3167,11 +3167,11 @@ ${r}`;
3167
3167
  },
3168
3168
  default: () => ""
3169
3169
  }),
3170
- vectorSearchLayerIds: g(),
3171
- vectorSearchFieldResults: g(),
3172
- layerFieldInfo: g(),
3173
- selectedLayerId: g()
3174
- }), Hn = async (e, t) => (await m({ text: "Exiting Layer Styling agent" }, t), e), Zn = async (e, t) => {
3170
+ vectorSearchLayerIds: f(),
3171
+ vectorSearchFieldResults: f(),
3172
+ layerFieldInfo: f(),
3173
+ selectedLayerId: f()
3174
+ }), Hs = async (e, t) => (await m({ text: "Exiting Layer Styling agent" }, t), e), Zs = async (e, t) => {
3175
3175
  try {
3176
3176
  await m({ text: "Populating layer and field info" }, t);
3177
3177
  const r = [];
@@ -3184,13 +3184,13 @@ ${r}`;
3184
3184
  h.description && `Description: ${h.description}`
3185
3185
  ].filter(Boolean).join(" | ") : u;
3186
3186
  };
3187
- const { layerId: n, results: i } = a, l = S(t, "layersAndFieldsRegistry"), c = l.get(n)?.fieldRegistry;
3187
+ const { layerId: s, results: i } = a, l = S(t, "layersAndFieldsRegistry"), c = l.get(s)?.fieldRegistry;
3188
3188
  if (!c)
3189
3189
  continue;
3190
- let d = r.find((u) => u.layerId === n);
3190
+ let d = r.find((u) => u.layerId === s);
3191
3191
  d || (d = {
3192
- layerId: n,
3193
- layerSummary: o(n),
3192
+ layerId: s,
3193
+ layerSummary: o(s),
3194
3194
  fieldInfos: []
3195
3195
  }, r.push(d));
3196
3196
  for (const u of i) {
@@ -3202,55 +3202,55 @@ ${r}`;
3202
3202
  } catch (r) {
3203
3203
  throw await m({ text: "Error populating layerFieldInfo" }, t), new Error(`Error populating layerFieldInfo: ${r instanceof Error ? r.message : String(r)}`);
3204
3204
  }
3205
- }, Jn = (e, t) => {
3205
+ }, Js = (e, t) => {
3206
3206
  const r = e.vectorSearchLayerIds ?? [];
3207
3207
  if (r.length <= 1)
3208
3208
  return { ...e, selectedLayerId: e.vectorSearchLayerIds[0] };
3209
3209
  const { hitlResponse: a } = t.configurable;
3210
- if (!a || a.agentId !== Ae.id || a.id !== "reviewLayerSelection") {
3211
- const n = {
3212
- agentId: Ae.id,
3210
+ if (!a || a.agentId !== Ce.id || a.id !== "reviewLayerSelection") {
3211
+ const s = {
3212
+ agentId: Ce.id,
3213
3213
  id: "reviewLayerSelection",
3214
3214
  kind: "singleSelection",
3215
3215
  message: "Choose a layer to apply the styles.",
3216
3216
  metadata: [...r]
3217
3217
  };
3218
- throw new lt(n);
3218
+ throw new ct(s);
3219
3219
  }
3220
3220
  let o = null;
3221
3221
  return Array.isArray(a.payload) && a.payload.length > 0 && (o = a.payload[0]), {
3222
3222
  ...e,
3223
3223
  selectedLayerId: o ?? e.vectorSearchLayerIds[0]
3224
3224
  };
3225
- }, Yn = (e, t) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(e, t), Xn = () => new _(Xe).addNode("requireLayerStylingServices", Yn).addNode("vectorSearchLayers", Ao).addNode("layerSelectionHITL", Jn).addNode("vectorSearchFields", qo).addNode("populateLayerFieldInfo", Zn).addNode("agent", Kn).addNode("tools", Un).addNode("earlyExit", Hn).addEdge(j, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
3225
+ }, Ys = (e, t) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(e, t), Xs = () => new M(Xe).addNode("requireLayerStylingServices", Ys).addNode("vectorSearchLayers", No).addNode("layerSelectionHITL", Js).addNode("vectorSearchFields", Co).addNode("populateLayerFieldInfo", Zs).addNode("agent", Ks).addNode("tools", Us).addNode("earlyExit", Hs).addEdge(P, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
3226
3226
  "layerSelectionHITL",
3227
3227
  (t) => t.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
3228
3228
  ).addConditionalEdges(
3229
3229
  "vectorSearchFields",
3230
3230
  (t) => t.vectorSearchFieldResults.length ? "populateLayerFieldInfo" : "earlyExit"
3231
- ).addEdge("populateLayerFieldInfo", "agent").addEdge("agent", "tools").addEdge("tools", R).addEdge("earlyExit", R), es = 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.
3231
+ ).addEdge("populateLayerFieldInfo", "agent").addEdge("agent", "tools").addEdge("tools", F).addEdge("earlyExit", F), en = 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.
3232
3232
  _Example: “Color points by sales amount”_
3233
3233
  _Example: “Show population density with a color gradient”_
3234
3234
  _Example: “Create a relationship map between height and depth”_
3235
- _Example: “Vary circle sizes according to population”_`, Ae = {
3235
+ _Example: “Vary circle sizes according to population”_`, Ce = {
3236
3236
  id: "layerStyling",
3237
3237
  name: "Layer Styling Agent",
3238
- description: es,
3239
- createGraph: Xn,
3238
+ description: en,
3239
+ createGraph: Xs,
3240
3240
  workspace: Xe
3241
- }, et = g.Root({
3241
+ }, et = f.Root({
3242
3242
  // messages: comes from global chat history.
3243
3243
  // It is safe to append new messages locally, but existing message objects
3244
3244
  // must be treated as read-only and never mutated.
3245
- messages: g({
3246
- reducer: z,
3245
+ messages: f({
3246
+ reducer: j,
3247
3247
  default: () => []
3248
3248
  }),
3249
3249
  // Accumulates user-visible output across graph nodes.
3250
3250
  // Uses append semantics, but de-duplicates identical consecutive writes.
3251
3251
  // This avoids duplicate output when tool nodes and final LLM nodes
3252
3252
  // emit the same text during a single agent turn.
3253
- outputMessage: g({
3253
+ outputMessage: f({
3254
3254
  reducer: (e = "", t) => {
3255
3255
  const r = typeof t == "string" ? t.trim() : "";
3256
3256
  if (!r)
@@ -3269,42 +3269,65 @@ ${r}`;
3269
3269
  },
3270
3270
  default: () => ""
3271
3271
  })
3272
- }), ts = (e) => {
3272
+ }), tn = (e, t) => {
3273
+ const r = Array.from(e.values()).find(
3274
+ ({ layerItem: s }) => s.title?.toLowerCase().includes(t.toLowerCase())
3275
+ );
3276
+ if (!r) {
3277
+ const s = Array.from(e.values()).map((i) => i.layerItem.title).join(", ");
3278
+ return `Could not find a layer matching "${t}". Available layers: ${s}`;
3279
+ }
3280
+ const a = Array.from(r.fieldRegistry.values()), o = a.map((s) => `- **${s.alias || s.name}** (\`${s.name}\`, ${s.type})${s.description ? `: ${s.description}` : ""}`).join(`
3281
+ `);
3282
+ return `**${r.layerItem.title}** has ${a.length} field(s):
3283
+
3284
+ ${o}`;
3285
+ }, rn = async ({ layerTitle: e }, t) => {
3286
+ const r = S(t, "layersAndFieldsRegistry");
3287
+ return tn(r, e);
3288
+ }, an = b(rn, {
3289
+ name: "listLayerFields",
3290
+ 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.",
3291
+ schema: n.object({
3292
+ layerTitle: n.string().describe("The title or partial title of the layer to list fields for.")
3293
+ })
3294
+ }), tt = [an], on = (e) => {
3273
3295
  if (!e || e.size === 0)
3274
3296
  return "No layers available in this map.";
3275
3297
  const t = Array.from(e.values()).map(({ layerItem: r, fieldRegistry: a }, o) => {
3276
- const n = Array.from(a.values()).map((l) => l.name).slice(0, 10).join(", "), i = a.size > 10 ? ` (and ${a.size - 10} more)` : "";
3298
+ const s = Array.from(a.values()).map((l) => l.name).slice(0, 10).join(", "), i = a.size > 10 ? ` (and ${a.size - 10} more)` : "";
3277
3299
  return `${o + 1}. "${r.title}". Description: ${r.description}
3278
- Fields: ${n}${i}`;
3300
+ Fields: ${s}${i}`;
3279
3301
  }).join(`
3280
3302
 
3281
3303
  `);
3282
3304
  return `This map contains ${e.size} layer(s):
3283
3305
 
3284
3306
  ${t}`;
3285
- }, rs = (e) => {
3307
+ }, sn = (e) => {
3286
3308
  const t = e?.list() ?? [];
3287
3309
  return t.length ? t.map((r) => `- ${r.agent.name}: ${r.agent.description}`).join(`
3288
3310
  `) : "No agents currently available.";
3289
3311
  };
3290
- async function as(e, t) {
3291
- const r = await F("help_prompt"), a = S(t, "layersAndFieldsRegistry"), o = S(t, "agentRegistry"), n = {
3292
- layerSummary: ts(a),
3293
- agents: rs(o)
3294
- }, i = await ie({
3312
+ async function nn(e, t) {
3313
+ const r = await R("help_prompt"), a = S(t, "layersAndFieldsRegistry"), o = S(t, "agentRegistry"), s = await k({
3295
3314
  promptText: r,
3296
3315
  messages: x(e.messages),
3297
- inputVariables: n
3298
- }), l = new K(i), c = [...e.messages, l], d = `${e.outputMessage}
3299
-
3300
- ${i}`.trim();
3301
- return {
3302
- ...e,
3303
- messages: c,
3304
- outputMessage: d
3305
- };
3316
+ tools: tt,
3317
+ inputVariables: {
3318
+ layerSummary: on(a),
3319
+ agents: sn(o)
3320
+ }
3321
+ }), i = s.content.toString(), l = [...e.messages, s];
3322
+ return { ...e, messages: l, outputMessage: i };
3306
3323
  }
3307
- const os = (e, t) => D(["agentRegistry"], "Help Agent")(e, t), ns = () => new _(et).addNode("requireHelpServices", os).addNode("agent", as).addEdge(j, "requireHelpServices").addEdge("requireHelpServices", "agent").addEdge("agent", R), ss = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
3324
+ const ln = (e, t) => D(["agentRegistry"], "Help Agent")(e, t);
3325
+ async function cn(e, t) {
3326
+ const a = await new z(tt).invoke({ messages: e.messages }, t), o = [...e.messages, ...a.messages], s = a.messages.map((i) => i.text).join(`
3327
+ `);
3328
+ return { ...e, messages: o, outputMessage: s };
3329
+ }
3330
+ const dn = () => new M(et).addNode("requireHelpServices", ln).addNode("agent", nn).addNode("tools", cn).addEdge(P, "requireHelpServices").addEdge("requireHelpServices", "agent").addConditionalEdges("agent", (t) => (t.messages[t.messages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : F).addEdge("tools", F), un = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
3308
3331
 
3309
3332
  _Example: “Tell me about this map”_
3310
3333
  _Example: “List all layers in this map”_
@@ -3317,25 +3340,25 @@ const os = (e, t) => D(["agentRegistry"], "Help Agent")(e, t), ns = () => new _(
3317
3340
 
3318
3341
  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.
3319
3342
  _Example: "Create a chart"_
3320
- _Example: "Create a table"_`, ki = {
3343
+ _Example: "Create a table"_`, Mi = {
3321
3344
  id: "help",
3322
3345
  name: "Help Agent",
3323
- description: ss,
3324
- createGraph: ns,
3346
+ description: un,
3347
+ createGraph: dn,
3325
3348
  workspace: et
3326
- }, tt = g.Root({
3349
+ }, rt = f.Root({
3327
3350
  // messages: comes from global chat history.
3328
3351
  // It is safe to append new messages locally, but existing message objects
3329
3352
  // must be treated as read-only and never mutated.
3330
- messages: g({
3331
- reducer: z,
3353
+ messages: f({
3354
+ reducer: j,
3332
3355
  default: () => []
3333
3356
  }),
3334
3357
  // Accumulates user-visible output across graph nodes.
3335
3358
  // Uses append semantics, but de-duplicates identical consecutive writes.
3336
3359
  // This avoids duplicate output when tool nodes and final LLM nodes
3337
3360
  // emit the same text during a single agent turn.
3338
- outputMessage: g({
3361
+ outputMessage: f({
3339
3362
  reducer: (e = "", t) => {
3340
3363
  const r = typeof t == "string" ? t.trim() : "";
3341
3364
  if (!r)
@@ -3354,36 +3377,36 @@ ${r}`;
3354
3377
  },
3355
3378
  default: () => ""
3356
3379
  }),
3357
- intent: g({
3380
+ intent: f({
3358
3381
  reducer: (e, t) => t
3359
3382
  })
3360
- }), J = {
3383
+ }), Z = {
3361
3384
  conversationId: ""
3362
- }, is = ["linkChartView"], ls = ["knowledgeGraph"];
3385
+ }, hn = ["linkChartView"], mn = ["knowledgeGraph"];
3363
3386
  function oe(e) {
3364
3387
  const r = e?.configurable?.context;
3365
3388
  if (!r || typeof r != "object")
3366
3389
  throw new Error("ArcgisKnowledgeAgent context missing");
3367
- const a = is.filter((o) => !(o in r));
3390
+ const a = hn.filter((o) => !(o in r));
3368
3391
  if (a.length)
3369
3392
  throw new Error(`Link Chart context missing: ${a.join(", ")}`);
3370
3393
  return r;
3371
3394
  }
3372
- function we(e) {
3395
+ function fe(e) {
3373
3396
  const r = e?.configurable?.context;
3374
3397
  if (!r || typeof r != "object")
3375
3398
  throw new Error("ArcgisKnowledgeAgent context missing");
3376
- const a = ls.filter((o) => !(o in r));
3399
+ const a = mn.filter((o) => !(o in r));
3377
3400
  if (a.length)
3378
3401
  throw new Error(`Knowledge Graph context missing: ${a.join(", ")}`);
3379
3402
  return r;
3380
3403
  }
3381
- class cs {
3404
+ class pn {
3382
3405
  constructor(t) {
3383
- this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = be.fromDataModel(t);
3406
+ this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = we.fromDataModel(t);
3384
3407
  }
3385
3408
  }
3386
- class be {
3409
+ class we {
3387
3410
  constructor() {
3388
3411
  this.schemaType = "ArcgisGraphSchema", this.entityTypes = [], this.relationshipTypes = [], this.identifierInfo = {
3389
3412
  mappingInfo: {
@@ -3393,14 +3416,14 @@ class be {
3393
3416
  };
3394
3417
  }
3395
3418
  static fromDataModel(t) {
3396
- const r = new be();
3419
+ const r = new we();
3397
3420
  for (const a of t.entityTypes)
3398
3421
  r.entityTypes.push(B.fromEntityType(a));
3399
3422
  for (const a of t.relationshipTypes)
3400
- r.relationshipTypes.push(ds.fromRelationshipType(a));
3423
+ r.relationshipTypes.push(yn.fromRelationshipType(a));
3401
3424
  return r.identifierInfo = {
3402
3425
  mappingInfo: {
3403
- identifierMapsTo: us(
3426
+ identifierMapsTo: gn(
3404
3427
  t.identifierInfo.identifierMappingInfo.identifierInfoType
3405
3428
  ),
3406
3429
  identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
@@ -3414,13 +3437,13 @@ class B {
3414
3437
  }
3415
3438
  static fromEntityType(t) {
3416
3439
  const r = new B();
3417
- r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = hs(t.role);
3440
+ r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = fn(t.role);
3418
3441
  for (const a of t.properties) {
3419
3442
  const o = {
3420
3443
  name: a.name,
3421
3444
  alias: a.alias ? a.alias : void 0,
3422
3445
  fieldType: a.fieldType,
3423
- role: ms(a.role),
3446
+ role: wn(a.role),
3424
3447
  geometryDef: a.fieldType === "esriFieldTypeGeometry" ? {
3425
3448
  geometryType: a.geometryType ?? "esriGeometryAny",
3426
3449
  hasM: a.hasM ? a.hasM : void 0,
@@ -3432,7 +3455,7 @@ class B {
3432
3455
  return r;
3433
3456
  }
3434
3457
  }
3435
- class ds extends B {
3458
+ class yn extends B {
3436
3459
  constructor() {
3437
3460
  super(...arguments), this.observedEndPoints = [];
3438
3461
  }
@@ -3447,7 +3470,7 @@ class ds extends B {
3447
3470
  return r;
3448
3471
  }
3449
3472
  }
3450
- const us = (e) => {
3473
+ const gn = (e) => {
3451
3474
  switch (e) {
3452
3475
  case "esriIdentifierInfoTypeUNSPECIFIED":
3453
3476
  return "UNSPECIFIED";
@@ -3458,7 +3481,7 @@ const us = (e) => {
3458
3481
  default:
3459
3482
  return e;
3460
3483
  }
3461
- }, hs = (e) => {
3484
+ }, fn = (e) => {
3462
3485
  switch (e) {
3463
3486
  case "Regular":
3464
3487
  return "esriGraphNamedObjectRegular";
@@ -3470,7 +3493,7 @@ const us = (e) => {
3470
3493
  return e;
3471
3494
  }
3472
3495
  };
3473
- function ms(e) {
3496
+ function wn(e) {
3474
3497
  switch (e) {
3475
3498
  case "esriGraphPropertyRegular":
3476
3499
  return "Regular";
@@ -3508,50 +3531,50 @@ function ms(e) {
3508
3531
  return "Regular";
3509
3532
  }
3510
3533
  }
3511
- async function ps(e, t, r, a) {
3512
- const { graphQuery: o, explanation: n } = await Se(e, t, r, a);
3534
+ async function bn(e, t, r, a) {
3535
+ const { graphQuery: o, explanation: s } = await be(e, t, r, a);
3513
3536
  return `Generated Graph Query:
3514
3537
  ${o}
3515
3538
 
3516
- Explanation: ${n}`;
3539
+ Explanation: ${s}`;
3517
3540
  }
3518
- async function Se(e, t, r, a) {
3541
+ async function be(e, t, r, a) {
3519
3542
  const o = {
3520
3543
  message: e,
3521
- context: new cs(t)
3544
+ context: new pn(t)
3522
3545
  };
3523
- J.conversationId && (o.conversationId = J.conversationId), await m({ text: "Attempting to generate a cypher query from your prompt..." }, a);
3524
- const n = await Ee(`${r}/chat`, {
3546
+ Z.conversationId && (o.conversationId = Z.conversationId), await m({ text: "Attempting to generate a cypher query from your prompt..." }, a);
3547
+ const s = await xe(`${r}/chat`, {
3525
3548
  method: "post",
3526
3549
  body: JSON.stringify(o),
3527
3550
  headers: {
3528
3551
  "Content-Type": "application/json",
3529
- token: $e.findCredential(G.getDefault().url)?.token ?? ""
3552
+ token: Ee.findCredential(O.getDefault().url)?.token ?? ""
3530
3553
  }
3531
3554
  });
3532
- if (n.httpStatus !== 200)
3533
- throw new Error(`Graph query service returned an error: ${n.httpStatus}`, {
3534
- cause: n.data
3555
+ if (s.httpStatus !== 200)
3556
+ throw new Error(`Graph query service returned an error: ${s.httpStatus}`, {
3557
+ cause: s.data
3535
3558
  });
3536
- J.conversationId || (J.conversationId = n.data.conversationId);
3559
+ Z.conversationId || (Z.conversationId = s.data.conversationId);
3537
3560
  let i = !1;
3538
3561
  const l = Date.now();
3539
- let c = n.data.sequenceNumber, d = "", u = "", h = 1;
3562
+ let c = s.data.sequenceNumber, d = "", u = "", h = 1;
3540
3563
  for (; !i; ) {
3541
- await new Promise((f) => setTimeout(f, 1e3)), await m(
3564
+ await new Promise((g) => setTimeout(g, 1e3)), await m(
3542
3565
  { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, h)}` },
3543
3566
  a
3544
3567
  ), h = h % 3 + 1;
3545
- const p = await Ee(`${r}/chat`, {
3568
+ const p = await xe(`${r}/chat`, {
3546
3569
  method: "post",
3547
3570
  body: JSON.stringify({
3548
- conversationId: n.data.conversationId,
3549
- inquiryId: n.data.inquiryId,
3571
+ conversationId: s.data.conversationId,
3572
+ inquiryId: s.data.inquiryId,
3550
3573
  ackSequenceNumber: c
3551
3574
  }),
3552
3575
  headers: {
3553
3576
  "Content-Type": "application/json",
3554
- token: $e.findCredential(G.getDefault().url)?.token ?? ""
3577
+ token: Ee.findCredential(O.getDefault().url)?.token ?? ""
3555
3578
  }
3556
3579
  });
3557
3580
  if (p.httpStatus !== 200)
@@ -3568,110 +3591,110 @@ async function Se(e, t, r, a) {
3568
3591
  }
3569
3592
  return { graphQuery: d, explanation: u };
3570
3593
  }
3571
- function Y(e, t) {
3594
+ function J(e, t) {
3572
3595
  if (!(!e || typeof e != "object")) {
3573
- if (fs(e))
3596
+ if (vn(e))
3574
3597
  for (const r of e.path)
3575
- Y(r, t);
3576
- else if (ys(e))
3598
+ J(r, t);
3599
+ else if (Sn(e))
3577
3600
  t.set(`${e.typeName}__${e.id}`, { id: e.id, typeName: e.typeName });
3578
3601
  else if (Array.isArray(e))
3579
3602
  for (const r of e)
3580
- Y(r, t);
3581
- else if (gs(e))
3603
+ J(r, t);
3604
+ else if (Tn(e))
3582
3605
  for (const r of Object.values(e.properties ?? {}))
3583
- Y(r, t);
3606
+ J(r, t);
3584
3607
  }
3585
3608
  }
3586
- function ys(e) {
3609
+ function Sn(e) {
3587
3610
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
3588
3611
  }
3589
- function fs(e) {
3612
+ function vn(e) {
3590
3613
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
3591
3614
  }
3592
- function gs(e) {
3615
+ function Tn(e) {
3593
3616
  return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
3594
3617
  }
3595
- function ws(e, t) {
3618
+ function xn(e, t) {
3596
3619
  const r = [];
3597
3620
  for (const a of [...t.dataModel.entityTypes, ...t.dataModel.relationshipTypes]) {
3598
3621
  const o = e.getMemberIdsByType(a.name);
3599
- for (const n of o)
3600
- r.push({ id: n, typeName: a.name });
3622
+ for (const s of o)
3623
+ r.push({ id: s, typeName: a.name });
3601
3624
  }
3602
3625
  return r;
3603
3626
  }
3604
- const bs = async (e) => {
3627
+ const En = async (e) => {
3605
3628
  const t = /* @__PURE__ */ new Map(), r = e.resultRowsStream.getReader();
3606
3629
  for (; ; ) {
3607
3630
  const { done: a, value: o } = await r.read();
3608
3631
  if (a)
3609
3632
  break;
3610
- for (const n of o)
3611
- for (const i of n)
3612
- Y(i, t);
3633
+ for (const s of o)
3634
+ for (const i of s)
3635
+ J(i, t);
3613
3636
  }
3614
3637
  return Array.from(t.values());
3615
3638
  };
3616
- async function Ss(e, t, r, a, o) {
3617
- const { graphQuery: n, explanation: i } = await Se(
3639
+ async function $n(e, t, r, a, o) {
3640
+ const { graphQuery: s, explanation: i } = await be(
3618
3641
  e,
3619
3642
  t.dataModel,
3620
3643
  r,
3621
3644
  o
3622
3645
  );
3623
3646
  await m(
3624
- { text: `Attempting to execute query: ${n.substring(0, 500)}${n.length > 500 ? "..." : ""}` },
3647
+ { text: `Attempting to execute query: ${s.substring(0, 500)}${s.length > 500 ? "..." : ""}` },
3625
3648
  o
3626
3649
  );
3627
- const l = await At(
3650
+ const l = await Nt(
3628
3651
  t,
3629
3652
  new Pe({
3630
- openCypherQuery: n
3653
+ openCypherQuery: s
3631
3654
  }),
3632
3655
  {
3633
3656
  signal: o?.signal,
3634
3657
  timeout: o?.timeout
3635
3658
  }
3636
- ), c = await bs(l);
3659
+ ), c = await En(l);
3637
3660
  return await m(
3638
3661
  {
3639
3662
  text: `Query Results parsed into ${c.length} unique relationships and entities. Atempting to add to link chart...`
3640
3663
  },
3641
3664
  o
3642
3665
  ), await a.map.addRecords(c), a.goTo(a.map.diagramNodesExtent), `Link Chart updated successfully. Cypher Query used:
3643
- ${n}
3666
+ ${s}
3644
3667
 
3645
3668
  Explanation: ${i}`;
3646
3669
  }
3647
- async function rt({ prompt: e }, t) {
3648
- const { knowledgeGraph: r } = we(t), { linkChartView: a } = oe(t), n = G.getDefault().helperServices, i = await F("arcgis_knowledge_current_lc_context"), l = ws(a.map, r), c = `${e}
3670
+ async function at({ prompt: e }, t) {
3671
+ const { knowledgeGraph: r } = fe(t), { linkChartView: a } = oe(t), s = O.getDefault().helperServices, i = await R("arcgis_knowledge_current_lc_context"), l = xn(a.map, r), c = `${e}
3649
3672
 
3650
3673
  ${i}${JSON.stringify(l)}`;
3651
- return await Ss(
3674
+ return await $n(
3652
3675
  c,
3653
3676
  r,
3654
- `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
3677
+ `${s.aiAssistantServices.url}${s.aiAssistantServices.graphQueryAssistant}`,
3655
3678
  a,
3656
3679
  t
3657
3680
  );
3658
3681
  }
3659
- const vs = s.object({
3660
- prompt: s.string().describe("The user's inquiry into the knowledge graph that needs to be run.")
3661
- }), at = b(rt, {
3682
+ const Fn = n.object({
3683
+ prompt: n.string().describe("The user's inquiry into the knowledge graph that needs to be run.")
3684
+ }), ot = b(at, {
3662
3685
  name: "addRecords",
3663
3686
  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.",
3664
- schema: vs
3687
+ schema: Fn
3665
3688
  });
3666
- async function Ts(e, t) {
3689
+ async function Rn(e, t) {
3667
3690
  return await t.map.applyLayout(e), `Successfully applied layout: ${e}.`;
3668
3691
  }
3669
- async function xs({ layout: e }, t) {
3692
+ async function Ln({ layout: e }, t) {
3670
3693
  const { linkChartView: r } = oe(t);
3671
- return await Ts(e, r);
3694
+ return await Rn(e, r);
3672
3695
  }
3673
- const Es = s.object({
3674
- layout: s.enum([
3696
+ const In = n.object({
3697
+ layout: n.enum([
3675
3698
  "organic-standard",
3676
3699
  "organic-community",
3677
3700
  "basic-grid",
@@ -3684,98 +3707,98 @@ const Es = s.object({
3684
3707
  ]).describe(
3685
3708
  "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"
3686
3709
  )
3687
- }), $s = b(xs, {
3710
+ }), qn = b(Ln, {
3688
3711
  name: "applyLayout",
3689
3712
  description: "Apply a diagram layout to the link chart",
3690
- schema: Es
3713
+ schema: In
3691
3714
  });
3692
- function Fs(e, t) {
3715
+ function Cn(e, t) {
3693
3716
  return t.map.changeNonspatialDataDisplay(e), `Successfully applied nonspatial visibility setting: ${e}.`;
3694
3717
  }
3695
- function Rs({ setting: e }, t) {
3718
+ function An({ setting: e }, t) {
3696
3719
  const { linkChartView: r } = oe(t);
3697
- return Fs(e, r);
3720
+ return Cn(e, r);
3698
3721
  }
3699
- const Ls = s.object({
3700
- setting: s.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
3701
- }), Is = b(Rs, {
3722
+ const Nn = n.object({
3723
+ setting: n.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
3724
+ }), kn = b(An, {
3702
3725
  name: "changeNonspatialVisibility",
3703
3726
  description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
3704
- schema: Ls
3727
+ schema: Nn
3705
3728
  });
3706
- async function qs(e, t, r, a, o) {
3707
- const { graphQuery: n, explanation: i } = await Se(
3729
+ async function zn(e, t, r, a, o) {
3730
+ const { graphQuery: s, explanation: i } = await be(
3708
3731
  e,
3709
3732
  t.dataModel,
3710
3733
  r,
3711
3734
  o
3712
3735
  );
3713
- await m({ text: `Attempting to create link chart from derived query: ${n}` }, o);
3736
+ await m({ text: `Attempting to create link chart from derived query: ${s}` }, o);
3714
3737
  const l = await kt.fromCypherQuery(
3715
3738
  t,
3716
3739
  new Pe({
3717
- openCypherQuery: n
3740
+ openCypherQuery: s
3718
3741
  })
3719
3742
  );
3720
3743
  return await m({ text: "Link chart created successfully, loading..." }, o), a.map = l, await l.load(), await a.when(), `Link chart created successfully. Cypher Query used to create the link chart:
3721
- ${n}
3744
+ ${s}
3722
3745
 
3723
3746
  Explanation: ${i}`;
3724
3747
  }
3725
- async function ot({ prompt: e }, t) {
3726
- const { knowledgeGraph: r } = we(t), { linkChartView: a } = oe(t), n = G.getDefault().helperServices;
3727
- return await qs(
3748
+ async function st({ prompt: e }, t) {
3749
+ const { knowledgeGraph: r } = fe(t), { linkChartView: a } = oe(t), s = O.getDefault().helperServices;
3750
+ return await zn(
3728
3751
  e,
3729
3752
  r,
3730
- `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
3753
+ `${s.aiAssistantServices.url}${s.aiAssistantServices.graphQueryAssistant}`,
3731
3754
  a,
3732
3755
  t
3733
3756
  );
3734
3757
  }
3735
- const Cs = s.object({
3736
- prompt: s.string().describe(
3758
+ const _n = n.object({
3759
+ prompt: n.string().describe(
3737
3760
  "The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization."
3738
3761
  )
3739
- }), nt = b(ot, {
3762
+ }), nt = b(st, {
3740
3763
  name: "createLinkChart",
3741
3764
  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.",
3742
- schema: Cs
3765
+ schema: _n
3743
3766
  });
3744
- async function st({ prompt: e }, t) {
3745
- const { knowledgeGraph: r } = we(t), o = G.getDefault().helperServices;
3746
- return await ps(
3767
+ async function it({ prompt: e }, t) {
3768
+ const { knowledgeGraph: r } = fe(t), o = O.getDefault().helperServices;
3769
+ return await bn(
3747
3770
  e,
3748
3771
  r.dataModel,
3749
3772
  `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
3750
3773
  t
3751
3774
  );
3752
3775
  }
3753
- const As = s.object({
3754
- prompt: s.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
3755
- }), ve = b(st, {
3776
+ const jn = n.object({
3777
+ prompt: n.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
3778
+ }), Se = b(it, {
3756
3779
  name: "generateCypher",
3757
3780
  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.",
3758
- schema: As
3759
- }), Te = [
3760
- $s,
3761
- Is,
3762
- ve,
3781
+ schema: jn
3782
+ }), ve = [
3783
+ qn,
3784
+ kn,
3785
+ Se,
3763
3786
  nt,
3764
- at
3765
- ], ks = [ve, nt, at];
3766
- async function Ns(e, t) {
3767
- const r = await F("arcgis_knowledge_tool_prompt"), a = {
3787
+ ot
3788
+ ], Mn = [Se, nt, ot];
3789
+ async function Pn(e, t) {
3790
+ const r = await R("arcgis_knowledge_tool_prompt"), a = {
3768
3791
  intent: e.intent
3769
- }, o = await M({
3792
+ }, o = await k({
3770
3793
  promptText: r,
3771
3794
  messages: x(e.messages),
3772
3795
  inputVariables: a,
3773
- tools: Te
3774
- }), n = [...e.messages, o], l = (o.tool_calls?.length ?? 0) > 0 ? [...n] : [...n, o];
3796
+ tools: ve
3797
+ }), s = [...e.messages, o], l = (o.tool_calls?.length ?? 0) > 0 ? [...s] : [...s, o];
3775
3798
  return { ...e, messages: l };
3776
3799
  }
3777
- async function zs(e, t) {
3778
- const a = await new P(Te).invoke(
3800
+ async function Dn(e, t) {
3801
+ const a = await new z(ve).invoke(
3779
3802
  {
3780
3803
  messages: x(e.messages)
3781
3804
  },
@@ -3783,57 +3806,57 @@ async function zs(e, t) {
3783
3806
  ), o = a.messages.map((l) => l.text).join(`
3784
3807
  `);
3785
3808
  await m({ text: `Finished executing arcgisKnowledge tool: ${o}` }, t);
3786
- const n = [...e.messages, ...a.messages], i = a.messages.map((l) => l.text).join(`
3809
+ const s = [...e.messages, ...a.messages], i = a.messages.map((l) => l.text).join(`
3787
3810
  `);
3788
- return { ...e, messages: n, outputMessage: i };
3811
+ return { ...e, messages: s, outputMessage: i };
3789
3812
  }
3790
- async function _s(e) {
3791
- const t = await F("arcgis_knowledge_intent_prompt"), a = {
3792
- tools: Te.map((l) => ({
3813
+ async function Gn(e) {
3814
+ const t = await R("arcgis_knowledge_intent_prompt"), a = {
3815
+ tools: ve.map((l) => ({
3793
3816
  name: l.name,
3794
3817
  description: l.description,
3795
3818
  schema: l.schema
3796
3819
  })).map(({ name: l, description: c, schema: d }) => `${l}: ${c}, ${JSON.stringify(d)}`).join(`
3797
3820
  `)
3798
- }, o = s.object({
3799
- intent: s.string()
3800
- }), n = await ke({
3821
+ }, o = n.object({
3822
+ intent: n.string()
3823
+ }), s = await Ae({
3801
3824
  promptText: t,
3802
3825
  messages: x(e.messages),
3803
3826
  inputVariables: a,
3804
3827
  schema: o
3805
- }), i = typeof n.intent == "string" ? n.intent.trim().replace(/^"|"$/gu, "") : "";
3828
+ }), i = typeof s.intent == "string" ? s.intent.trim().replace(/^"|"$/gu, "") : "";
3806
3829
  return { ...e, intent: i || "" };
3807
3830
  }
3808
- const js = (e, t) => (
3831
+ const On = (e, t) => (
3809
3832
  //agent services (ex: embeddingsWorker) would go in the array below, if required.
3810
3833
  D([], "ArcgisKnowledge Agent")(e, t)
3811
3834
  );
3812
- async function Ms(e, t) {
3835
+ async function Qn(e, t) {
3813
3836
  const r = e.messages[e.messages.length - 1].content;
3814
3837
  let a;
3815
3838
  if (typeof r != "string")
3816
3839
  throw new Error("The original message content must be a string to process server skills.");
3817
- if (e.intent === ve.name)
3818
- a = await st({ prompt: r }, t);
3840
+ if (e.intent === Se.name)
3841
+ a = await it({ prompt: r }, t);
3819
3842
  else if (e.intent === "createLinkChart")
3820
- a = await ot({ prompt: r }, t);
3843
+ a = await st({ prompt: r }, t);
3821
3844
  else if (e.intent === "addRecords")
3822
- a = await rt({ prompt: r }, t);
3845
+ a = await at({ prompt: r }, t);
3823
3846
  else
3824
3847
  throw new Error(`No server skills were successfully invoked matching the name: ${e.intent}`);
3825
3848
  return { ...e, messages: [...e.messages], outputMessage: a };
3826
3849
  }
3827
- const Ps = () => new _(tt).addNode("requireArcgisKnowledgeServices", js).addNode("intentLLM", _s).addNode("agent", Ns).addNode("serverSkill", Ms).addNode("tools", zs).addEdge(j, "requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices", "intentLLM").addConditionalEdges(
3850
+ const Vn = () => new M(rt).addNode("requireArcgisKnowledgeServices", On).addNode("intentLLM", Gn).addNode("agent", Pn).addNode("serverSkill", Qn).addNode("tools", Dn).addEdge(P, "requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices", "intentLLM").addConditionalEdges(
3828
3851
  "intentLLM",
3829
3852
  (t) => (
3830
3853
  // ts/lint are getting confused here about the type, and the cast resolves it. Without it, there is a ts error
3831
- ks.map((r) => r.name).includes(t.intent) ? "serverSkill" : "agent"
3854
+ Mn.map((r) => r.name).includes(t.intent) ? "serverSkill" : "agent"
3832
3855
  )
3833
3856
  ).addConditionalEdges("agent", (t) => {
3834
3857
  const r = t.messages[t.messages.length - 1];
3835
- return r?.getType() === "ai" && "tool_calls" in r && Array.isArray(r.tool_calls) && r.tool_calls.length > 0 ? "tools" : R;
3836
- }).addEdge("tools", R), Ds = 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).
3858
+ return r?.getType() === "ai" && "tool_calls" in r && Array.isArray(r.tool_calls) && r.tool_calls.length > 0 ? "tools" : F;
3859
+ }).addEdge("tools", F), Wn = 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).
3837
3860
  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.
3838
3861
  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,
3839
3862
  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
@@ -3865,19 +3888,19 @@ _example: "Find all the products supplied by Supplier X and add them to my visua
3865
3888
  _example: "Expand the link chart from 'Entity D' to show its direct connections"_
3866
3889
  _example: "Find all the cars and then add everything up to two hops away from them on the link chart"_
3867
3890
  _example: "Connect Emma and Rob on the link chart if there is a relationship between them"
3868
- _example: "Discover and add all the relationships originating at 'Entity E' to the link chart"_`, Ni = {
3891
+ _example: "Discover and add all the relationships originating at 'Entity E' to the link chart"_`, Pi = {
3869
3892
  id: "arcgisKnowledge",
3870
3893
  name: "ArcgisKnowledge Agent",
3871
- description: Ds,
3872
- createGraph: Ps,
3873
- workspace: tt
3894
+ description: Wn,
3895
+ createGraph: Vn,
3896
+ workspace: rt
3874
3897
  };
3875
3898
  export {
3876
- Ni as ArcgisKnowledgeAgent,
3877
- qi as DataExplorationAgent,
3878
- ki as HelpAgent,
3879
- Ci as LayerFilterAgent,
3880
- Ai as LayerQueryAgent,
3881
- Ae as LayerStylingAgent,
3882
- Ii as NavigationAgent
3899
+ Pi as ArcgisKnowledgeAgent,
3900
+ zi as DataExplorationAgent,
3901
+ Mi as HelpAgent,
3902
+ _i as LayerFilterAgent,
3903
+ ji as LayerQueryAgent,
3904
+ Ce as LayerStylingAgent,
3905
+ ki as NavigationAgent
3883
3906
  };