@arcgis/ai-agents 5.1.0-next.112 → 5.1.0-next.113

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,48 +1,48 @@
1
- import { Annotation as v, StateGraph as U, START as B, END as C, messagesStateReducer as ke, NodeInterrupt as lt } from "@langchain/langgraph/web";
2
- import { createAgentRuntimeStateWithSharedState as ct, invokeToolPrompt as P, sendTraceMessage as m, invokeStructuredPrompt as Fe, createAgentRuntimeState as ee, invokeTextPrompt as qe, sendUXSuggestion as k } from "@arcgis/ai-orchestrator";
1
+ import { Annotation as v, StateGraph as U, START as B, END as C, messagesStateReducer as Fe, NodeInterrupt as lt } from "@langchain/langgraph/web";
2
+ import { createAgentRuntimeStateWithSharedState as ct, invokeToolPrompt as G, sendTraceMessage as m, invokeStructuredPrompt as qe, createAgentRuntimeState as ee, invokeTextPrompt as Le, sendUXSuggestion as k } from "@arcgis/ai-orchestrator";
3
3
  import { tool as b } from "@langchain/core/tools";
4
- import oe from "@arcgis/core/config.js";
4
+ import ne from "@arcgis/core/config.js";
5
5
  import dt from "@arcgis/core/Graphic.js";
6
6
  import _ from "@arcgis/core/portal/Portal.js";
7
7
  import { addressToLocations as ut } from "@arcgis/core/rest/locator.js";
8
8
  import pt from "@arcgis/core/symbols/PictureMarkerSymbol.js";
9
9
  import l, { z as I } from "zod";
10
- import Le from "@arcgis/core/geometry/Extent.js";
10
+ import ht from "@arcgis/core/geometry/Extent.js";
11
11
  import Ie from "@arcgis/core/geometry/Point.js";
12
- import { ToolNode as G } from "@langchain/langgraph/prebuilt";
13
- import ht from "@arcgis/core/layers/support/FeatureEffect.js";
12
+ import { ToolNode as O } from "@langchain/langgraph/prebuilt";
13
+ import mt from "@arcgis/core/layers/support/FeatureEffect.js";
14
14
  import Ne from "@arcgis/core/layers/support/FeatureFilter.js";
15
- import * as mt from "@arcgis/core/geometry/operators/unionOperator.js";
16
- import { formatDateOnly as yt, convertDateFormatToIntlOptions as Z, formatTimeOnly as gt, formatDate as fe } from "@arcgis/core/intl.js";
15
+ import * as yt from "@arcgis/core/geometry/operators/unionOperator.js";
16
+ import { formatDateOnly as gt, convertDateFormatToIntlOptions as Z, formatTimeOnly as ft, formatDate as we } from "@arcgis/core/intl.js";
17
17
  import Ae from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
18
18
  import Me from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
19
- import ft from "@arcgis/core/rest/support/TopFeaturesQuery.js";
20
- import wt from "@arcgis/core/rest/support/TopFilter.js";
19
+ import wt from "@arcgis/core/rest/support/TopFeaturesQuery.js";
20
+ import bt from "@arcgis/core/rest/support/TopFilter.js";
21
21
  import { AIMessage as ze } from "@langchain/core/messages";
22
- import { createRenderer as bt } from "@arcgis/core/smartMapping/renderers/pieChart.js";
23
- import { getSchemesByTag as St, getSchemes as vt } from "@arcgis/core/smartMapping/symbology/pieChart.js";
24
- import { getBackgroundColorTheme as we } from "@arcgis/core/views/support/colorUtils.js";
25
- import { createAgeRenderer as xt, createContinuousRenderer as Tt } from "@arcgis/core/smartMapping/renderers/color.js";
26
- import { getSchemesByTag as de } from "@arcgis/core/smartMapping/symbology/color.js";
27
- import { createContinuousRenderer as Et } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
28
- import { createRenderer as Rt } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
29
- import { getSchemesByTag as $t } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
30
- import { createRenderer as Ct } from "@arcgis/core/smartMapping/renderers/heatmap.js";
31
- import { getSchemesByTag as kt } from "@arcgis/core/smartMapping/symbology/heatmap.js";
32
- import { createRenderer as Ft } from "@arcgis/core/smartMapping/renderers/predominance.js";
33
- import { getSchemesByTag as qt } from "@arcgis/core/smartMapping/symbology/predominance.js";
34
- import { createRenderer as Lt } from "@arcgis/core/smartMapping/renderers/relationship.js";
35
- import { getSchemesByTag as It } from "@arcgis/core/smartMapping/symbology/relationship.js";
36
- import { createAgeRenderer as Nt, createContinuousRenderer as At } from "@arcgis/core/smartMapping/renderers/size.js";
37
- import { createRenderer as Mt } from "@arcgis/core/smartMapping/renderers/type.js";
38
- import { getSchemesByTag as zt } from "@arcgis/core/smartMapping/symbology/type.js";
22
+ import { createRenderer as St } from "@arcgis/core/smartMapping/renderers/pieChart.js";
23
+ import { getSchemesByTag as vt, getSchemes as xt } from "@arcgis/core/smartMapping/symbology/pieChart.js";
24
+ import { getBackgroundColorTheme as be } from "@arcgis/core/views/support/colorUtils.js";
25
+ import { createAgeRenderer as Tt, createContinuousRenderer as Et } from "@arcgis/core/smartMapping/renderers/color.js";
26
+ import { getSchemesByTag as ue } from "@arcgis/core/smartMapping/symbology/color.js";
27
+ import { createContinuousRenderer as Rt } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
28
+ import { createRenderer as $t } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
29
+ import { getSchemesByTag as Ct } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
30
+ import { createRenderer as kt } from "@arcgis/core/smartMapping/renderers/heatmap.js";
31
+ import { getSchemesByTag as Ft } from "@arcgis/core/smartMapping/symbology/heatmap.js";
32
+ import { createRenderer as qt } from "@arcgis/core/smartMapping/renderers/predominance.js";
33
+ import { getSchemesByTag as Lt } from "@arcgis/core/smartMapping/symbology/predominance.js";
34
+ import { createRenderer as It } from "@arcgis/core/smartMapping/renderers/relationship.js";
35
+ import { getSchemesByTag as Nt } from "@arcgis/core/smartMapping/symbology/relationship.js";
36
+ import { createAgeRenderer as At, createContinuousRenderer as Mt } from "@arcgis/core/smartMapping/renderers/size.js";
37
+ import { createRenderer as zt } from "@arcgis/core/smartMapping/renderers/type.js";
38
+ import { getSchemesByTag as _t } from "@arcgis/core/smartMapping/symbology/type.js";
39
39
  import "@arcgis/core/views/LinkChartView.js";
40
- import { fetchKnowledgeGraph as be, executeQueryStreaming as _t, executeSearchStreaming as Dt } from "@arcgis/core/rest/knowledgeGraphService.js";
41
- import jt from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
40
+ import { fetchKnowledgeGraph as Se, executeQueryStreaming as Dt, executeSearchStreaming as jt } from "@arcgis/core/rest/knowledgeGraphService.js";
41
+ import Pt from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
42
42
  import _e from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
43
- import Se from "@arcgis/core/request.js";
44
- import ve from "@arcgis/core/identity/IdentityManager.js";
45
- import Pt from "@arcgis/core/WebLinkChart.js";
43
+ import ve from "@arcgis/core/request.js";
44
+ import xe from "@arcgis/core/identity/IdentityManager.js";
45
+ import Gt from "@arcgis/core/WebLinkChart.js";
46
46
  const Q = (e, t) => t ?? e, De = v.Root({
47
47
  ...ct(),
48
48
  // internal to the navigation agent
@@ -63,11 +63,11 @@ const Q = (e, t) => t ?? e, De = v.Root({
63
63
  })
64
64
  })
65
65
  });
66
- async function Gt(e, t) {
66
+ async function Ot(e, t) {
67
67
  const a = _.getDefault().helperServices, o = a.geocode.find((h) => h.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
68
68
  if (!o)
69
69
  throw new Error("No geocoding service found in helperServices.");
70
- const n = o.url, s = `${oe.assetsPath?.endsWith("/") ? oe.assetsPath : `${oe.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await ut(n, {
70
+ const n = o.url, s = `${ne.assetsPath?.endsWith("/") ? ne.assetsPath : `${ne.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await ut(n, {
71
71
  address: { SingleLine: e },
72
72
  outFields: ["Match_addr"]
73
73
  }))?.[0];
@@ -92,28 +92,28 @@ async function Gt(e, t) {
92
92
  sharedStatePatch: { lastResolvedLocation: { value: p } }
93
93
  };
94
94
  }
95
- const Ot = ["mapView"];
95
+ const Vt = ["mapView"];
96
96
  function F(e) {
97
97
  const r = e?.configurable?.context;
98
98
  if (!r || typeof r != "object")
99
99
  throw new Error("NavigationAgent context missing");
100
- const a = Ot.filter((o) => !(o in r));
100
+ const a = Vt.filter((o) => !(o in r));
101
101
  if (a.length)
102
102
  throw new Error(`NavigationAgent context missing: ${a.join(", ")}`);
103
103
  return r;
104
104
  }
105
- async function Vt({ address: e }, t) {
105
+ async function Qt({ address: e }, t) {
106
106
  const { mapView: r } = F(t);
107
- return await Gt(e, r);
107
+ return await Ot(e, r);
108
108
  }
109
- const Qt = l.object({
109
+ const Kt = l.object({
110
110
  address: l.string().describe("The full address or place name to locate.")
111
- }), Kt = b(Vt, {
111
+ }), Wt = b(Qt, {
112
112
  name: "goToAddress",
113
113
  description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
114
- schema: Qt
114
+ schema: Kt
115
115
  });
116
- async function Wt(e, t) {
116
+ async function Ut(e, t) {
117
117
  const a = t.map.bookmarks;
118
118
  if (!a || a.length === 0)
119
119
  throw new Error("No bookmarks found in the map.");
@@ -125,18 +125,18 @@ async function Wt(e, t) {
125
125
  throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
126
126
  return await t.goTo(n), { text: `Navigated to bookmark: ${e}` };
127
127
  }
128
- async function Ut({ bookmarkName: e }, t) {
128
+ async function Bt({ bookmarkName: e }, t) {
129
129
  const { mapView: r } = F(t);
130
- return await Promise.resolve(Wt(e, r));
130
+ return await Promise.resolve(Ut(e, r));
131
131
  }
132
- const Bt = I.object({
132
+ const Ht = I.object({
133
133
  bookmarkName: I.string().describe("The name of the bookmark to navigate to.")
134
- }), Ht = b(Ut, {
134
+ }), Zt = b(Bt, {
135
135
  name: "goToBookmark",
136
136
  description: "Go to the extent of the bookmark with the given name.",
137
- schema: Bt
137
+ schema: Ht
138
138
  });
139
- async function Zt(e, t, r) {
139
+ async function Jt(e, t, r) {
140
140
  const a = r.map?.allLayers.find((n) => n.id === e);
141
141
  if (!a)
142
142
  return { text: `Error: Layer with id ${e} not found` };
@@ -155,20 +155,20 @@ async function Zt(e, t, r) {
155
155
  return console.error("Error in goToFeatures:", n), { text: `Error: ${n instanceof Error ? n.message : "Unknown error"}` };
156
156
  }
157
157
  }
158
- async function Jt({ layerId: e, where: t }, r) {
158
+ async function Yt({ layerId: e, where: t }, r) {
159
159
  const { mapView: a } = F(r);
160
- return await Zt(e, t, a);
160
+ return await Jt(e, t, a);
161
161
  }
162
- const Yt = I.object({
162
+ const Xt = I.object({
163
163
  layerId: I.string().describe("The layerId of the layer to zoom to."),
164
164
  where: I.string().describe("The sql-92 where clause used to query features to zoom to")
165
- }), Xt = b(Jt, {
165
+ }), er = b(Yt, {
166
166
  name: "goToFeatures",
167
167
  description: "Go to the features that match the given filter related to the given layerId.",
168
- schema: Yt
168
+ schema: Xt
169
169
  });
170
- async function er(e) {
171
- const r = new Le({
170
+ async function tr(e) {
171
+ const r = new ht({
172
172
  xmin: -180,
173
173
  ymin: -90,
174
174
  xmax: 180,
@@ -177,16 +177,16 @@ async function er(e) {
177
177
  }).expand(0.7);
178
178
  return await e.goTo(r), { text: "Successfully zoomed to world extent" };
179
179
  }
180
- async function tr(e, t) {
180
+ async function rr(e, t) {
181
181
  const { mapView: r } = F(t);
182
- return await er(r);
182
+ return await tr(r);
183
183
  }
184
- const rr = I.object({}), ar = b(tr, {
184
+ const ar = I.object({}), or = b(rr, {
185
185
  name: "goToFullExtent",
186
186
  description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
187
- schema: rr
187
+ schema: ar
188
188
  });
189
- async function or(e) {
189
+ async function nr(e) {
190
190
  const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
191
191
  if (r)
192
192
  await e.goTo(r);
@@ -194,16 +194,16 @@ async function or(e) {
194
194
  throw new Error("Initial extent is undefined");
195
195
  return { text: "Successfully zoomed to home extent" };
196
196
  }
197
- async function nr(e, t) {
197
+ async function sr(e, t) {
198
198
  const { mapView: r } = F(t);
199
- return await or(r);
199
+ return await nr(r);
200
200
  }
201
- const sr = l.object({}), ir = b(nr, {
201
+ const ir = l.object({}), lr = b(sr, {
202
202
  name: "goToHomeExtent",
203
203
  description: "Go to the initial web map view extent",
204
- schema: sr
204
+ schema: ir
205
205
  });
206
- async function lr(e, t) {
206
+ async function cr(e, t) {
207
207
  await t.when();
208
208
  const r = t.map?.allLayers.find((o) => o.id === e);
209
209
  if (!r)
@@ -211,32 +211,32 @@ async function lr(e, t) {
211
211
  let a;
212
212
  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, { text: `Successfully zoomed to: ${r.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
213
213
  }
214
- async function cr({ layerId: e }, t) {
214
+ async function dr({ layerId: e }, t) {
215
215
  const { mapView: r } = F(t);
216
- return await lr(e, r);
216
+ return await cr(e, r);
217
217
  }
218
- const dr = I.object({
218
+ const ur = I.object({
219
219
  layerId: I.string().describe("The id of the layer to navigate to")
220
- }), ur = b(cr, {
220
+ }), pr = b(dr, {
221
221
  name: "goToLayer",
222
222
  description: "Zooms the map view to the full extent of the top matching layer.",
223
- schema: dr
223
+ schema: ur
224
224
  });
225
- async function pr(e, t) {
225
+ async function hr(e, t) {
226
226
  return await t.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
227
227
  }
228
- async function hr({ scale: e }, t) {
228
+ async function mr({ scale: e }, t) {
229
229
  const { mapView: r } = F(t);
230
- return await pr(e, r);
230
+ return await hr(e, r);
231
231
  }
232
- const mr = l.object({
232
+ const yr = l.object({
233
233
  scale: l.number().describe("The map scale of the view to go to.")
234
- }), yr = b(hr, {
234
+ }), gr = b(mr, {
235
235
  name: "goToScale",
236
236
  description: "Go to the specified view scale.",
237
- schema: mr
237
+ schema: yr
238
238
  });
239
- async function gr(e, t, r) {
239
+ async function fr(e, t, r) {
240
240
  const o = {
241
241
  target: new Ie({
242
242
  longitude: e.longitude,
@@ -250,50 +250,50 @@ async function gr(e, t, r) {
250
250
  r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
251
251
  ].filter(Boolean).join(", ")}` };
252
252
  }
253
- async function fr({
253
+ async function wr({
254
254
  center: e,
255
255
  zoom: t,
256
256
  scale: r
257
257
  }, a) {
258
258
  const { mapView: o } = F(a);
259
- return await gr(e, o, { zoom: t, scale: r });
259
+ return await fr(e, o, { zoom: t, scale: r });
260
260
  }
261
- const wr = l.object({
261
+ const br = l.object({
262
262
  center: l.object({
263
263
  longitude: l.number().describe("The longitude (x-coordinate) of the point to navigate to."),
264
264
  latitude: l.number().describe("The latitude (y-coordinate) of the point to navigate to.")
265
265
  }),
266
266
  zoom: l.number().optional().describe("The zoom level. Higher values = more zoomed in."),
267
267
  scale: l.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
268
- }), br = b(fr, {
268
+ }), Sr = b(wr, {
269
269
  name: "goToViewpoint",
270
270
  description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
271
- schema: wr
271
+ schema: br
272
272
  });
273
- async function Sr(e, t) {
273
+ async function vr(e, t) {
274
274
  return await t.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
275
275
  }
276
- async function vr({ zoom: e }, t) {
276
+ async function xr({ zoom: e }, t) {
277
277
  const { mapView: r } = F(t);
278
- return await Sr(e, r);
278
+ return await vr(e, r);
279
279
  }
280
- const xr = l.object({
280
+ const Tr = l.object({
281
281
  zoom: l.number().min(1).max(20).describe("The zoom level of the view to go to.")
282
- }), Tr = b(vr, {
282
+ }), Er = b(xr, {
283
283
  name: "goToZoom",
284
284
  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.).',
285
- schema: xr
286
- }), ue = [
287
- Kt,
288
- Ht,
289
- Xt,
290
- ar,
291
- ir,
292
- ur,
293
- yr,
294
- br,
295
- Tr
296
- ], xe = /* @__PURE__ */ Object.assign({
285
+ schema: Tr
286
+ }), pe = [
287
+ Wt,
288
+ Zt,
289
+ er,
290
+ or,
291
+ lr,
292
+ pr,
293
+ gr,
294
+ Sr,
295
+ Er
296
+ ], Te = /* @__PURE__ */ Object.assign({
297
297
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md": () => import("./arcgis_knowledge_current_lc_context-BIA49RO2.js").then((e) => e.default),
298
298
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md": () => import("./arcgis_knowledge_current_map_context-CfNPKOjr.js").then((e) => e.default),
299
299
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md": () => import("./arcgis_knowledge_lucene_generation_prompt-D3mtOeWu.js").then((e) => e.default),
@@ -308,15 +308,15 @@ const xr = l.object({
308
308
  "../agents/navigation/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt-BKqPOpCk.js").then((e) => e.default)
309
309
  });
310
310
  async function R(e) {
311
- const t = Object.entries(xe).find(([r]) => r.endsWith(`/${e}.md`));
311
+ const t = Object.entries(Te).find(([r]) => r.endsWith(`/${e}.md`));
312
312
  if (!t)
313
313
  throw new Error(`Prompt not found: ${e}
314
314
  Available prompts:
315
- ${Object.keys(xe).join(`
315
+ ${Object.keys(Te).join(`
316
316
  `)}`);
317
317
  return await t[1]();
318
318
  }
319
- async function Er(e, t) {
319
+ async function Rr(e, t) {
320
320
  const r = await R("navigation_tool_prompt"), { mapView: a } = F(t), n = a.map.bookmarks?.map((f) => f.name).filter(Boolean) ?? [], s = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
321
321
  (f, x) => `${x + 1}. layerId=${f.id} | title=${f.title ?? ""} | name=${f.name ?? ""} | score=${f.score.toFixed(2)}`
322
322
  ).join(`
@@ -333,11 +333,11 @@ ${i}` : "", p = {
333
333
  assignedTask: e.agentExecutionContext.assignedTask,
334
334
  userRequest: e.agentExecutionContext.userRequest,
335
335
  priorSteps: e.agentExecutionContext.priorSteps
336
- }, h = await P({
336
+ }, h = await G({
337
337
  promptText: r,
338
338
  modelTier: "fast",
339
339
  inputVariables: p,
340
- tools: ue
340
+ tools: pe
341
341
  }), g = (h.tool_calls?.length ?? 0) > 0, w = typeof h.text == "string" ? h.text.trim() : "", y = w.length > 0;
342
342
  return {
343
343
  ...e,
@@ -353,7 +353,7 @@ ${i}` : "", p = {
353
353
  const N = (e, t = 300) => {
354
354
  const r = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
355
355
  return r.length > t ? `${r.slice(0, t)}...` : r;
356
- }, Rr = (e) => {
356
+ }, $r = (e) => {
357
357
  const t = typeof e == "string" ? e : String(e);
358
358
  try {
359
359
  const r = JSON.parse(t);
@@ -364,8 +364,8 @@ const N = (e, t = 300) => {
364
364
  }
365
365
  return { text: t };
366
366
  };
367
- async function $r(e, t) {
368
- const r = new G(ue);
367
+ async function Cr(e, t) {
368
+ const r = new O(pe);
369
369
  try {
370
370
  const a = e.navigationInternalState.toolCallMessage;
371
371
  if (!a)
@@ -378,7 +378,7 @@ async function $r(e, t) {
378
378
  );
379
379
  let n = "", s;
380
380
  for (const i of o) {
381
- const c = Rr(i.content);
381
+ const c = $r(i.content);
382
382
  c.text && (n += `${c.text}
383
383
  `), c.sharedStatePatch && (s = {
384
384
  ...s,
@@ -410,8 +410,8 @@ async function $r(e, t) {
410
410
  };
411
411
  }
412
412
  }
413
- async function Cr(e, t) {
414
- const r = await R("navigation_intent_prompt"), { mapView: a } = F(t), o = ue.map((h) => ({
413
+ async function kr(e, t) {
414
+ const r = await R("navigation_intent_prompt"), { mapView: a } = F(t), o = pe.map((h) => ({
415
415
  name: h.name,
416
416
  description: h.description,
417
417
  schema: h.schema
@@ -426,7 +426,7 @@ ${s.map((h) => `- ${h}`).join(`
426
426
  priorSteps: e.agentExecutionContext.priorSteps
427
427
  }, d = l.object({
428
428
  intent: l.string()
429
- }), u = await Fe({
429
+ }), u = await qe({
430
430
  promptText: r,
431
431
  inputVariables: c,
432
432
  schema: d,
@@ -439,7 +439,7 @@ const S = (e, t) => {
439
439
  if (a == null)
440
440
  throw new Error(`${t} missing in config.configurable.services`);
441
441
  return a;
442
- }, kr = 0.7, Fr = async (e, t) => {
442
+ }, Fr = 0.7, qr = async (e, t) => {
443
443
  try {
444
444
  await m(
445
445
  { text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
@@ -447,7 +447,7 @@ const S = (e, t) => {
447
447
  );
448
448
  const r = S(t, "layerSearch"), a = S(t, "layersAndFieldsRegistry"), o = S(t, "embeddingCache"), s = (await r.searchLayers({
449
449
  text: e.agentExecutionContext.assignedTask,
450
- minScore: kr,
450
+ minScore: Fr,
451
451
  embeddingCache: o
452
452
  })).map(({ id: c, score: d }) => {
453
453
  const u = a.get(c)?.layerItem;
@@ -471,7 +471,7 @@ ${s.map((c) => `- layerId=${c.id} | title=${c.title ?? ""} | name=${c.name ?? ""
471
471
  t
472
472
  ), r;
473
473
  }
474
- }, Te = 0.7, qr = 10, Lr = async (e, t) => {
474
+ }, Ee = 0.7, Lr = 10, Ir = async (e, t) => {
475
475
  try {
476
476
  await m(
477
477
  { text: `Similarity search to find fields: ${e.agentExecutionContext.assignedTask}` },
@@ -483,8 +483,8 @@ ${s.map((c) => `- layerId=${c.id} | title=${c.title ?? ""} | name=${c.name ?? ""
483
483
  const i = (await r.searchFields({
484
484
  text: e.agentExecutionContext.assignedTask,
485
485
  layerIds: n,
486
- minScore: Te,
487
- topResults: qr,
486
+ minScore: Ee,
487
+ topResults: Lr,
488
488
  embeddingCache: o
489
489
  })).map(({ layerId: d, results: u }) => {
490
490
  const p = a.get(d)?.fieldRegistry;
@@ -511,7 +511,7 @@ ${i.map(
511
511
  ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
512
512
  `)}`
513
513
  ).join(`
514
- `)}` : c = `No vector search field results found for score over ${Te}.`, await m({ text: c }, t), {
514
+ `)}` : c = `No vector search field results found for score over ${Ee}.`, await m({ text: c }, t), {
515
515
  ...e,
516
516
  vectorSearchFieldResults: i
517
517
  };
@@ -527,7 +527,7 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
527
527
  if (!o?.[n])
528
528
  throw new Error(`${t} requires services.${n} to be available.`);
529
529
  return r;
530
- }, Ir = (e, t) => H(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), Nr = () => new U(De).addNode("requireNavigationServices", Ir).addNode("intentLLM", Cr).addNode("vectorSearchLayers", Fr).addNode("vectorSearchFields", Lr).addNode("agent", Er).addNode("tools", $r).addEdge(B, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
530
+ }, Nr = (e, t) => H(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), Ar = () => new U(De).addNode("requireNavigationServices", Nr).addNode("intentLLM", kr).addNode("vectorSearchLayers", qr).addNode("vectorSearchFields", Ir).addNode("agent", Rr).addNode("tools", Cr).addEdge(B, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
531
531
  "intentLLM",
532
532
  (t) => t.intent === "goToLayer" || t.intent === "goToFeatures" ? "vectorSearchLayers" : "agent",
533
533
  {
@@ -541,7 +541,7 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
541
541
  vectorSearchFields: "vectorSearchFields",
542
542
  agent: "agent"
543
543
  }
544
- ).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", C), Ar = String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
544
+ ).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", C), Mr = String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
545
545
  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.
546
546
 
547
547
  Supported actions:
@@ -560,11 +560,11 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
560
560
  _Example: “Center the map on San Francisco at scale 50000”_
561
561
  _Example: “Zoom to the features in the schools layer where city = 'Austin'”_
562
562
  _Example: “Go to the Downtown bookmark”_
563
- _Example: “Where is Mount Rainier?”_`, fi = {
563
+ _Example: “Where is Mount Rainier?”_`, wi = {
564
564
  id: "navigation",
565
565
  name: "Navigation Agent",
566
- description: Ar,
567
- createGraph: Nr,
566
+ description: Mr,
567
+ createGraph: Ar,
568
568
  workspace: De
569
569
  }, je = v.Root({
570
570
  ...ee(),
@@ -573,10 +573,10 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
573
573
  layerFieldInfo: v(),
574
574
  queryResponse: v(),
575
575
  dataExplorationMessages: v({
576
- reducer: ke,
576
+ reducer: Fe,
577
577
  default: () => []
578
578
  })
579
- }), Mr = async (e, t) => (await m({ text: "Exiting Data Exploration agent" }, t), e), pe = async (e, t) => {
579
+ }), zr = async (e, t) => (await m({ text: "Exiting Data Exploration agent" }, t), e), he = async (e, t) => {
580
580
  const r = e.tool_calls ?? [];
581
581
  if (r.length === 0) {
582
582
  await m({ text: `LLM did not request any tool calls: ${String(e?.content)}` }, t);
@@ -590,41 +590,41 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
590
590
  )
591
591
  )
592
592
  );
593
- }, zr = ["mapView"];
593
+ }, _r = ["mapView"];
594
594
  function A(e) {
595
595
  const r = e?.configurable?.context;
596
596
  if (!r || typeof r != "object")
597
597
  throw new Error("DataExplorationAgent context missing");
598
- const a = zr.filter((o) => !(o in r));
598
+ const a = _r.filter((o) => !(o in r));
599
599
  if (a.length)
600
600
  throw new Error(`DataExplorationAgent context missing: ${a.join(", ")}`);
601
601
  return r;
602
602
  }
603
- const _r = (e) => {
603
+ const Dr = (e) => {
604
604
  const t = e.map?.allLayers.filter((a) => a.type === "feature");
605
605
  let r = 0;
606
606
  return t?.forEach((a) => {
607
607
  const o = a;
608
608
  o.featureEffect && (o.featureEffect = null, r++);
609
609
  }), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
610
- }, Dr = async (e, t) => {
610
+ }, jr = async (e, t) => {
611
611
  const { mapView: r } = A(t);
612
- return _r(r);
613
- }, jr = b(Dr, {
612
+ return Dr(r);
613
+ }, Pr = b(jr, {
614
614
  name: "clearFilters",
615
615
  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.",
616
616
  schema: l.object({})
617
- }), Pr = async (e) => {
617
+ }), Gr = async (e) => {
618
618
  e.map?.allLayers.filter((o) => o.type === "feature")?.forEach((o) => {
619
619
  const n = o;
620
620
  n.featureEffect && (n.featureEffect = null);
621
621
  });
622
622
  const a = e.map.initialViewProperties?.viewpoint?.targetGeometry;
623
623
  return a ? (await e.goTo(a), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
624
- }, Gr = async (e, t) => {
624
+ }, Or = async (e, t) => {
625
625
  const { mapView: r } = A(t);
626
- return await Pr(r);
627
- }, Or = b(Gr, {
626
+ return await Gr(r);
627
+ }, Vr = b(Or, {
628
628
  name: "resetMap",
629
629
  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.",
630
630
  schema: l.object({})
@@ -668,7 +668,7 @@ const te = async (e, t) => {
668
668
  return { error: "The geometry of the first feature is undefined or null." };
669
669
  n = s;
670
670
  } else {
671
- const s = o.features.map((c) => c.geometry), i = mt.executeMany(s);
671
+ const s = o.features.map((c) => c.geometry), i = yt.executeMany(s);
672
672
  if (!i)
673
673
  return { error: "Failed to create a combined geometry." };
674
674
  n = i;
@@ -679,7 +679,7 @@ const te = async (e, t) => {
679
679
  }
680
680
  }
681
681
  return { error: "Invalid geometry configuration provided" };
682
- }, Vr = async (e, t, r, a, o, n) => {
682
+ }, Qr = async (e, t, r, a, o, n) => {
683
683
  const s = e.map?.allLayers.find((c) => c.id === t);
684
684
  if (!s)
685
685
  return { success: !1, error: `Layer '${t}' not found.` };
@@ -697,7 +697,7 @@ const te = async (e, t) => {
697
697
  error: c instanceof Error ? c.message : String(c)
698
698
  };
699
699
  }
700
- }, Qr = async (e, t, r, a, o, n) => {
700
+ }, Kr = async (e, t, r, a, o, n) => {
701
701
  const s = t.map?.allLayers.find(
702
702
  (p) => p.id === e.layerId
703
703
  );
@@ -710,7 +710,7 @@ const te = async (e, t) => {
710
710
  return p.error;
711
711
  i = p.geometry;
712
712
  }
713
- if (s.featureEffect = null, s.featureEffect = new ht({
713
+ if (s.featureEffect = null, s.featureEffect = new mt({
714
714
  filter: new Ne({
715
715
  ...e.objectIds?.length ? { objectIds: e.objectIds } : { where: e.where },
716
716
  geometry: i,
@@ -722,7 +722,7 @@ const te = async (e, t) => {
722
722
  excludedEffect: a
723
723
  }), s.visible = !0, n)
724
724
  return `Applied feature effects to "${s.title ?? e.layerId}" within current map extent.`;
725
- const c = e.objectIds?.length ? `${s.objectIdField} IN (${e.objectIds.join(",")})` : e.where, d = await Vr(
725
+ const c = e.objectIds?.length ? `${s.objectIdField} IN (${e.objectIds.join(",")})` : e.where, d = await Qr(
726
726
  t,
727
727
  e.layerId,
728
728
  c,
@@ -731,7 +731,7 @@ const te = async (e, t) => {
731
731
  o?.units
732
732
  ), u = s.title ?? e.layerId;
733
733
  return d.success ? `Applied feature effects to target layer "${s.title ?? e.layerId}"${o && "layerId" in o ? ` using geometry from layer "${o.layerId}"` : ""}.` : `Applied filter to "${u}" but no features matched. ${d.error}`;
734
- }, Kr = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], M = l.enum(Kr), Wr = async ({
734
+ }, Wr = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], M = l.enum(Wr), Ur = async ({
735
735
  targetLayer: e,
736
736
  geometryFilter: t,
737
737
  useCurrentExtent: r,
@@ -739,13 +739,13 @@ const te = async (e, t) => {
739
739
  excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
740
740
  }, n) => {
741
741
  const { mapView: s } = A(n);
742
- return await Qr(e, s, a, o, t, r);
743
- }, Ur = l.object({
742
+ return await Kr(e, s, a, o, t, r);
743
+ }, Br = l.object({
744
744
  layerId: l.string().describe("The layerId of the layer containing the geometry by which to filter."),
745
745
  where: l.string().describe("The SQL-92 where clause representing the features from which to filter."),
746
746
  distance: l.number().optional().describe("The buffer distance around the geometry."),
747
747
  units: M.optional().describe("The units for the distance buffer.")
748
- }), Br = l.object({
748
+ }), Hr = l.object({
749
749
  point: l.object({
750
750
  x: l.number().describe("X coordinate (longitude) from navigation result"),
751
751
  y: l.number().describe("Y coordinate (latitude) from navigation result"),
@@ -755,7 +755,7 @@ const te = async (e, t) => {
755
755
  }).describe("Point coordinates from a previous navigation/geocoding result"),
756
756
  distance: l.number().optional().describe("Optional buffer distance around the point."),
757
757
  units: M.optional().describe("The units for the distance buffer.")
758
- }), Hr = l.object({
758
+ }), Zr = l.object({
759
759
  targetLayer: l.object({
760
760
  layerId: l.string().describe("The layerId of the layer on which to set a feature effect."),
761
761
  where: l.string().describe("The SQL-92 where clause representing the features to emphasize."),
@@ -763,7 +763,7 @@ const te = async (e, t) => {
763
763
  "Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause."
764
764
  )
765
765
  }),
766
- geometryFilter: l.union([Ur, Br]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
766
+ geometryFilter: l.union([Br, Hr]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
767
767
  useCurrentExtent: l.boolean().optional().describe(
768
768
  "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."
769
769
  ),
@@ -773,11 +773,11 @@ const te = async (e, t) => {
773
773
  excludedEffect: l.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
774
774
  "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."
775
775
  )
776
- }), Zr = b(Wr, {
776
+ }), Jr = b(Ur, {
777
777
  name: "setFeatureEffect",
778
778
  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.",
779
- schema: Hr
780
- }), se = (e) => {
779
+ schema: Zr
780
+ }), ie = (e) => {
781
781
  if (e instanceof Date)
782
782
  return Number.isNaN(e.getTime()) ? null : e;
783
783
  if (typeof e == "number" && Number.isFinite(e)) {
@@ -785,33 +785,33 @@ const te = async (e, t) => {
785
785
  return Number.isNaN(t.getTime()) ? null : t;
786
786
  }
787
787
  return null;
788
- }, Jr = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, Yr = (e) => {
788
+ }, Yr = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, Xr = (e) => {
789
789
  if (typeof e == "string" && e)
790
790
  return e;
791
- const t = se(e);
791
+ const t = ie(e);
792
792
  return t ? t.toISOString().slice(0, 10) : null;
793
793
  }, Pe = () => {
794
794
  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}`;
795
795
  return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
796
- }, Xr = (e, t, r) => {
796
+ }, ea = (e, t, r) => {
797
797
  const a = t?.toLowerCase();
798
798
  if (a === "date-only") {
799
- const n = Yr(e);
800
- return n ? yt(n, Z("short-date")) : e;
799
+ const n = Xr(e);
800
+ return n ? gt(n, Z("short-date")) : e;
801
801
  }
802
802
  if (a === "time-only") {
803
803
  if (typeof e == "string" && e)
804
- return gt(e, Z("long-time"));
805
- const n = se(e);
806
- return n ? fe(n, {
804
+ return ft(e, Z("long-time"));
805
+ const n = ie(e);
806
+ return n ? we(n, {
807
807
  ...Z("long-time"),
808
808
  timeZone: "UTC"
809
809
  }) : e;
810
810
  }
811
- const o = se(e);
812
- return o ? fe(o, {
811
+ const o = ie(e);
812
+ return o ? we(o, {
813
813
  ...Z("short-date-short-time"),
814
- timeZone: Jr(r)
814
+ timeZone: Yr(r)
815
815
  }) : e;
816
816
  }, Ge = (e, t, r) => {
817
817
  if (e && typeof e != "function") {
@@ -822,7 +822,7 @@ const te = async (e, t) => {
822
822
  }
823
823
  }
824
824
  return null;
825
- }, ea = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ta = (e) => {
825
+ }, ta = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ra = (e) => {
826
826
  if (e instanceof Date)
827
827
  return Number.isNaN(e.getTime()) ? null : e;
828
828
  if (typeof e == "number" && Number.isFinite(e)) {
@@ -834,7 +834,7 @@ const te = async (e, t) => {
834
834
  return Number.isNaN(t.getTime()) ? null : t;
835
835
  }
836
836
  return null;
837
- }, ra = (e, t) => {
837
+ }, aa = (e, t) => {
838
838
  if (typeof e != "number")
839
839
  return e;
840
840
  const r = {};
@@ -844,12 +844,12 @@ const te = async (e, t) => {
844
844
  } catch {
845
845
  return e;
846
846
  }
847
- }, aa = (e, t, r) => {
848
- const a = ta(e);
847
+ }, oa = (e, t, r) => {
848
+ const a = ra(e);
849
849
  if (!a)
850
850
  return e;
851
851
  const o = {};
852
- t.dateStyle ? o.dateStyle = t.dateStyle : (t.year && (o.year = t.year), t.month && (o.month = t.month)), t.timeStyle && (o.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? o.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (o.hour12 = !1), o.timeZone = ea(r);
852
+ t.dateStyle ? o.dateStyle = t.dateStyle : (t.year && (o.year = t.year), t.month && (o.month = t.month)), t.timeStyle && (o.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? o.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (o.hour12 = !1), o.timeZone = ta(r);
853
853
  try {
854
854
  return new Intl.DateTimeFormat(void 0, o).format(a);
855
855
  } catch {
@@ -859,11 +859,11 @@ const te = async (e, t) => {
859
859
  if (r == null)
860
860
  return r;
861
861
  const s = e.getFieldConfiguration?.(t)?.fieldFormat;
862
- return s?.type === "number" ? ra(r, s) : s?.type === "date-time" ? aa(r, s, o) : Xr(r, a, o);
863
- }, oa = (e, t, r, a) => {
862
+ return s?.type === "number" ? aa(r, s) : s?.type === "date-time" ? oa(r, s, o) : ea(r, a, o);
863
+ }, na = (e, t, r, a) => {
864
864
  const o = e.fieldsIndex?.get(t), n = Ge(t, r, e) ?? r;
865
865
  return Ve(e, t, n, o?.type, a);
866
- }, na = (e, t) => Oe(e, t), Qe = (e, t, r) => {
866
+ }, sa = (e, t) => Oe(e, t), Qe = (e, t, r) => {
867
867
  const a = e.objectIdField, o = t.features.map(
868
868
  (s) => s.attributes[a]
869
869
  ), n = t.features.map((s) => {
@@ -881,11 +881,11 @@ const te = async (e, t) => {
881
881
  }), c;
882
882
  });
883
883
  return { objectIds: o, attributes: n };
884
- }, sa = (e, t, r) => {
884
+ }, ia = (e, t, r) => {
885
885
  const a = e.createQuery();
886
886
  return a.outFields = [t], a.where = r || "1=1", a.num = 1, a;
887
- }, ia = async (e, t, r, a) => {
888
- const o = a.map?.allLayers.find((h) => h.id === e), n = sa(o, t, r.where), i = (await o.queryFeatures(n)).features[0], c = i ? i.attributes[t] : null, d = oa(o, t, c, a.timeZone), u = na(o, t);
887
+ }, la = async (e, t, r, a) => {
888
+ const o = a.map?.allLayers.find((h) => h.id === e), n = ia(o, t, r.where), i = (await o.queryFeatures(n)).features[0], c = i ? i.attributes[t] : null, d = na(o, t, c, a.timeZone), u = sa(o, t);
889
889
  return {
890
890
  tool: "getAttribute",
891
891
  layerName: o.title ?? e,
@@ -898,26 +898,26 @@ const te = async (e, t) => {
898
898
  }
899
899
  };
900
900
  };
901
- async function la({ layerId: e, fieldName: t, query: r }, a) {
902
- const { mapView: o } = A(a), n = await ia(e, t, r, o);
901
+ async function ca({ layerId: e, fieldName: t, query: r }, a) {
902
+ const { mapView: o } = A(a), n = await la(e, t, r, o);
903
903
  return JSON.stringify(n, null, 2);
904
904
  }
905
- const ca = l.object({
905
+ const da = l.object({
906
906
  layerId: l.string().describe("The layerId of the layer containing the field from which to get a value."),
907
907
  fieldName: l.string().describe("The name of the field/attribute from which to get a field value."),
908
908
  query: l.object({
909
909
  where: l.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
910
910
  })
911
- }), da = b(la, {
911
+ }), ua = b(ca, {
912
912
  name: "getAttribute",
913
913
  description: "Returns an attribute value for a given feature.",
914
- schema: ca
915
- }), he = (e, t, r) => r ? e.hasAllFeaturesInView && e.availableFields === t : e.hasAllFeatures && e.availableFields === t;
914
+ schema: da
915
+ }), me = (e, t, r) => r ? e.hasAllFeaturesInView && e.availableFields === t : e.hasAllFeatures && e.availableFields === t;
916
916
  function X(e, t) {
917
917
  let r = e ?? "";
918
918
  return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
919
919
  }
920
- const ua = async (e) => {
920
+ const pa = async (e) => {
921
921
  const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: s } = e, i = o.map?.allLayers.find((T) => T.id === t.layerId);
922
922
  if (!i)
923
923
  throw new Error(`Layer '${t.layerId}' not found.`);
@@ -932,9 +932,9 @@ const ua = async (e) => {
932
932
  if (!T.geometry)
933
933
  throw K(s) ? new Error(`No features found matching: ${s.where}`) : new Error("Failed to create geometry");
934
934
  if (K(s)) {
935
- const D = o.map?.allLayers.find((L) => L.id === s.layerId);
935
+ const j = o.map?.allLayers.find((L) => L.id === s.layerId);
936
936
  h = {
937
- geometryLayerName: D?.title ?? D?.id,
937
+ geometryLayerName: j?.title ?? j?.id,
938
938
  geometryLayerId: s.layerId,
939
939
  geometryWhere: s.where,
940
940
  distance: s.distance,
@@ -954,7 +954,7 @@ const ua = async (e) => {
954
954
  spatialRelationship: "intersects"
955
955
  });
956
956
  }
957
- const w = he(c, [r], !1);
957
+ const w = me(c, [r], !1);
958
958
  let y = null, f = null;
959
959
  const x = 10;
960
960
  if (u.type !== "geometry" && u.type !== "oid" && u.type !== "global-id")
@@ -969,8 +969,8 @@ const ua = async (e) => {
969
969
  outStatisticTypes: { include: [a] }
970
970
  };
971
971
  y = await Ae(T);
972
- const D = ["string", "small-integer", "integer"], L = u.domain?.type === "coded-value" ? u.domain : null;
973
- (D.includes(u.type) || L) && (f = (await Me({
972
+ const j = ["string", "small-integer", "integer"], L = u.domain?.type === "coded-value" ? u.domain : null;
973
+ (j.includes(u.type) || L) && (f = (await Me({
974
974
  layer: i,
975
975
  useFeaturesInView: w,
976
976
  view: w ? o : void 0,
@@ -1000,13 +1000,13 @@ const ua = async (e) => {
1000
1000
  }
1001
1001
  };
1002
1002
  };
1003
- async function pa({
1003
+ async function ha({
1004
1004
  targetLayer: e,
1005
1005
  fieldName: t,
1006
1006
  statisticType: r,
1007
1007
  geometryFilter: a
1008
1008
  }, o) {
1009
- const n = S(o, "layersAndFieldsRegistry"), { mapView: s } = A(o), i = await ua({
1009
+ const n = S(o, "layersAndFieldsRegistry"), { mapView: s } = A(o), i = await pa({
1010
1010
  targetLayer: e,
1011
1011
  fieldName: t,
1012
1012
  statisticType: r,
@@ -1016,12 +1016,12 @@ async function pa({
1016
1016
  });
1017
1017
  return JSON.stringify(i, null, 2);
1018
1018
  }
1019
- const ha = l.object({
1019
+ const ma = l.object({
1020
1020
  layerId: l.string().describe("The layerId of the layer containing the geometry by which to filter."),
1021
1021
  where: l.string().describe("The SQL-92 where clause representing the features from which to filter."),
1022
1022
  distance: l.number().optional().describe("The buffer distance around the geometry."),
1023
1023
  units: M.optional().describe("The units for the distance buffer.")
1024
- }), ma = l.object({
1024
+ }), ya = l.object({
1025
1025
  point: l.object({
1026
1026
  x: l.number().describe("X coordinate (longitude) from navigation result"),
1027
1027
  y: l.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1031,17 +1031,17 @@ const ha = l.object({
1031
1031
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1032
1032
  distance: l.number().optional().describe("Optional buffer distance around the point."),
1033
1033
  units: M.optional().describe("The units for the distance buffer.")
1034
- }), ya = l.object({
1034
+ }), ga = l.object({
1035
1035
  targetLayer: l.object({
1036
1036
  layerId: l.string().describe("The layerId of the layer containing the field from which to get a value."),
1037
1037
  where: l.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1038
1038
  }),
1039
- geometryFilter: l.union([ha, ma]).optional().describe(
1039
+ geometryFilter: l.union([ma, ya]).optional().describe(
1040
1040
  "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."
1041
1041
  ),
1042
1042
  fieldName: l.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
1043
1043
  statisticType: l.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1044
- }), ga = b(pa, {
1044
+ }), fa = b(ha, {
1045
1045
  name: "getStatistics",
1046
1046
  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.
1047
1047
 
@@ -1056,8 +1056,8 @@ DO NOT USE FOR:
1056
1056
  - Simple counts of features matching a condition — use queryFeatures instead
1057
1057
 
1058
1058
  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.`,
1059
- schema: ya
1060
- }), fa = async (e, t, r, a, o) => {
1059
+ schema: ga
1060
+ }), wa = async (e, t, r, a, o) => {
1061
1061
  const n = r.map?.allLayers.find((h) => h.id === e.layerId), s = await r.whenLayerView(n), i = n.title ?? e.layerId;
1062
1062
  let c;
1063
1063
  if (a) {
@@ -1084,7 +1084,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1084
1084
  try {
1085
1085
  let h;
1086
1086
  if (d) {
1087
- const y = new ft({
1087
+ const y = new wt({
1088
1088
  where: e.where || "1=1",
1089
1089
  outFields: p,
1090
1090
  orderByFields: e.orderByFields,
@@ -1092,7 +1092,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1092
1092
  spatialRelationship: c ? "intersects" : void 0,
1093
1093
  distance: a?.distance,
1094
1094
  units: a?.units,
1095
- topFilter: new wt({
1095
+ topFilter: new bt({
1096
1096
  topCount: t.topCount,
1097
1097
  groupByFields: t.groupByFields,
1098
1098
  orderByFields: t.orderByFields
@@ -1102,7 +1102,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1102
1102
  } else {
1103
1103
  const y = n.createQuery();
1104
1104
  y.where = X(n.definitionExpression, e.where || "1=1"), y.outFields = p.length ? p : ["*"], 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;
1105
- const f = he(s, e.outFields, o ?? !1);
1105
+ const f = me(s, e.outFields, o ?? !1);
1106
1106
  try {
1107
1107
  h = f ? await s.queryFeatures(y) : await n.queryFeatures(y);
1108
1108
  } catch (x) {
@@ -1132,20 +1132,20 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1132
1132
  details: { error: h instanceof Error ? h.message : String(h) }
1133
1133
  };
1134
1134
  }
1135
- }, wa = async ({
1135
+ }, ba = async ({
1136
1136
  targetLayer: e,
1137
1137
  topFilter: t,
1138
1138
  geometryFilter: r,
1139
1139
  useCurrentExtent: a
1140
1140
  }, o) => {
1141
- const { mapView: n } = A(o), s = await fa(e, t, n, r, a);
1141
+ const { mapView: n } = A(o), s = await wa(e, t, n, r, a);
1142
1142
  return JSON.stringify(s, null, 2);
1143
- }, ba = l.object({
1143
+ }, Sa = l.object({
1144
1144
  layerId: l.string().describe("The layerId of the layer containing the geometry by which to filter."),
1145
1145
  where: l.string().describe("The SQL-92 where clause representing the features from which to filter."),
1146
1146
  distance: l.number().optional().describe("The buffer distance around the geometry."),
1147
1147
  units: M.optional().describe("The units for the distance buffer.")
1148
- }), Sa = l.object({
1148
+ }), va = l.object({
1149
1149
  point: l.object({
1150
1150
  x: l.number().describe("X coordinate (longitude) from navigation result"),
1151
1151
  y: l.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1155,7 +1155,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1155
1155
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1156
1156
  distance: l.number().optional().describe("Optional buffer distance around the point."),
1157
1157
  units: M.optional().describe("The units for the distance buffer.")
1158
- }), va = l.object({
1158
+ }), xa = l.object({
1159
1159
  targetLayer: l.object({
1160
1160
  layerId: l.string().describe("The layerId of the layer containing the field from which to get a value."),
1161
1161
  where: l.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
@@ -1166,7 +1166,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1166
1166
  ).default("*")
1167
1167
  )
1168
1168
  }),
1169
- geometryFilter: l.union([ba, Sa]).optional().describe(
1169
+ geometryFilter: l.union([Sa, va]).optional().describe(
1170
1170
  "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."
1171
1171
  ),
1172
1172
  topFilter: l.object({
@@ -1179,11 +1179,11 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1179
1179
  useCurrentExtent: l.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
- }), xa = b(wa, {
1182
+ }), Ta = b(ba, {
1183
1183
  name: "getTopFeatures",
1184
1184
  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.',
1185
- schema: va
1186
- }), ne = 25, Ta = async (e, t, r, a) => {
1185
+ schema: xa
1186
+ }), se = 25, Ea = async (e, t, r, a) => {
1187
1187
  const o = t.map?.allLayers.find((y) => y.id === e.layerId), n = await t.whenLayerView(o), s = o.title ?? e.layerId;
1188
1188
  let i;
1189
1189
  if (r) {
@@ -1216,13 +1216,13 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1216
1216
  }
1217
1217
  i = y.geometry;
1218
1218
  } else a && (i = t.extent.clone());
1219
- const c = he(n, e.outFields, a ?? !1), d = o.objectIdField, u = o.createQuery();
1219
+ const c = me(n, e.outFields, a ?? !1), d = o.objectIdField, u = o.createQuery();
1220
1220
  u.where = X(o.definitionExpression, e.where || "1=1"), u.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])], u.orderByFields = e.orderByFields, i && (u.geometry = i, u.spatialRelationship = "intersects"), r?.distance && (u.distance = r.distance), r?.units && (u.units = r.units), u.outSpatialReference = t.spatialReference;
1221
1221
  let p, h;
1222
1222
  try {
1223
- p = c ? await n.queryFeatureCount(u) : await o.queryFeatureCount(u), p > 0 && p <= ne && (h = c ? await n.queryFeatures(u) : await o.queryFeatures(u));
1223
+ p = c ? await n.queryFeatureCount(u) : await o.queryFeatureCount(u), p > 0 && p <= se && (h = c ? await n.queryFeatures(u) : await o.queryFeatures(u));
1224
1224
  } catch (y) {
1225
- console.warn("Client-side query failed, falling back to server:", y), p = await o.queryFeatureCount(u), p > 0 && p <= ne && (h = await o.queryFeatures(u));
1225
+ console.warn("Client-side query failed, falling back to server:", y), p = await o.queryFeatureCount(u), p > 0 && p <= se && (h = await o.queryFeatures(u));
1226
1226
  }
1227
1227
  const { objectIds: g, attributes: w } = h ? Qe(o, h, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1228
1228
  return {
@@ -1236,26 +1236,26 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1236
1236
  outFields: e.outFields,
1237
1237
  ...g && { objectIds: g, objectIdField: d },
1238
1238
  ...w && { attributes: w },
1239
- ...p > ne && {
1239
+ ...p > se && {
1240
1240
  note: `${p} features found.`
1241
1241
  }
1242
1242
  }
1243
1243
  };
1244
1244
  };
1245
- async function Ea({
1245
+ async function Ra({
1246
1246
  targetLayer: e,
1247
1247
  geometryFilter: t,
1248
1248
  useCurrentExtent: r
1249
1249
  }, a) {
1250
- const { mapView: o } = A(a), n = await Ta(e, o, t, r);
1250
+ const { mapView: o } = A(a), n = await Ea(e, o, t, r);
1251
1251
  return JSON.stringify(n, null, 2);
1252
1252
  }
1253
- const Ra = l.object({
1253
+ const $a = l.object({
1254
1254
  layerId: l.string().describe("The layerId of the layer containing the geometry by which to filter."),
1255
1255
  where: l.string().describe("The SQL-92 where clause representing the features from which to filter."),
1256
1256
  distance: l.number().optional().describe("The buffer distance around the geometry."),
1257
1257
  units: M.optional().describe("The units for the distance buffer.")
1258
- }), $a = l.object({
1258
+ }), Ca = l.object({
1259
1259
  point: l.object({
1260
1260
  x: l.number().describe("X coordinate (longitude) from navigation result"),
1261
1261
  y: l.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1265,7 +1265,7 @@ const Ra = l.object({
1265
1265
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1266
1266
  distance: l.number().optional().describe("Optional buffer distance around the point."),
1267
1267
  units: M.optional().describe("The units for the distance buffer.")
1268
- }), Ca = l.object({
1268
+ }), ka = l.object({
1269
1269
  targetLayer: l.object({
1270
1270
  layerId: l.string().describe("The layerId of the layer containing the field from which to get a value."),
1271
1271
  where: l.string().describe(
@@ -1278,13 +1278,13 @@ const Ra = l.object({
1278
1278
  ).default("*")
1279
1279
  )
1280
1280
  }),
1281
- geometryFilter: l.union([Ra, $a]).optional().describe(
1281
+ geometryFilter: l.union([$a, Ca]).optional().describe(
1282
1282
  "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."
1283
1283
  ),
1284
1284
  useCurrentExtent: l.boolean().optional().describe(
1285
1285
  "Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer)."
1286
1286
  )
1287
- }), ka = b(Ea, {
1287
+ }), Fa = b(Ra, {
1288
1288
  name: "queryFeatures",
1289
1289
  description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
1290
1290
 
@@ -1296,8 +1296,8 @@ USE THIS TOOL FOR:
1296
1296
  - Any question where the user wants to SEE or COUNT matching features
1297
1297
 
1298
1298
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1299
- schema: Ca
1300
- }), Ke = [da, ga, xa, ka], We = [Zr, Or, jr], Fa = async (e, t) => {
1299
+ schema: ka
1300
+ }), Ke = [ua, fa, Ta, Fa], We = [Jr, Vr, Pr], qa = async (e, t) => {
1301
1301
  await m({ text: "Requesting LLM for layer filter results" }, t);
1302
1302
  const a = await R("data_explore_filter_prompt");
1303
1303
  if (!t?.configurable)
@@ -1310,7 +1310,7 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1310
1310
  assignedTask: e.agentExecutionContext.assignedTask,
1311
1311
  userRequest: e.agentExecutionContext.userRequest,
1312
1312
  priorSteps: e.agentExecutionContext.priorSteps
1313
- }, i = await P({
1313
+ }, i = await G({
1314
1314
  promptText: a,
1315
1315
  modelTier: "advanced",
1316
1316
  messages: e.dataExplorationMessages,
@@ -1324,8 +1324,8 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1324
1324
  // Don't overwrite outputMessage if query already set it
1325
1325
  };
1326
1326
  const u = [...c, i], p = i.content.toString();
1327
- return await pe(i, t), { ...e, dataExplorationMessages: u, outputMessage: p };
1328
- }, qa = async (e, t) => {
1327
+ return await he(i, t), { ...e, dataExplorationMessages: u, outputMessage: p };
1328
+ }, La = async (e, t) => {
1329
1329
  await m({ text: "Requesting LLM for layer query results" }, t);
1330
1330
  const a = await R("data_explore_query_prompt");
1331
1331
  if (!t?.configurable)
@@ -1337,21 +1337,21 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1337
1337
  assignedTask: e.agentExecutionContext.assignedTask,
1338
1338
  userRequest: e.agentExecutionContext.userRequest,
1339
1339
  priorSteps: e.agentExecutionContext.priorSteps
1340
- }, i = await P({
1340
+ }, i = await G({
1341
1341
  promptText: a,
1342
1342
  modelTier: "advanced",
1343
1343
  messages: e.dataExplorationMessages,
1344
1344
  inputVariables: s,
1345
1345
  tools: Ke
1346
1346
  }), c = i.content.toString();
1347
- return await pe(i, t), {
1347
+ return await he(i, t), {
1348
1348
  ...e,
1349
1349
  dataExplorationMessages: [...e.dataExplorationMessages, i],
1350
1350
  outputMessage: c,
1351
1351
  status: "success",
1352
1352
  summary: c ? N(c) : "Query executed."
1353
1353
  };
1354
- }, La = async (e, t) => {
1354
+ }, Ia = async (e, t) => {
1355
1355
  try {
1356
1356
  await m({ text: "Requesting LLM for summary on query results" }, t);
1357
1357
  const a = await R("summarize_query_response_prompt"), o = {
@@ -1359,7 +1359,7 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1359
1359
  assignedTask: e.agentExecutionContext.assignedTask,
1360
1360
  userRequest: e.agentExecutionContext.userRequest,
1361
1361
  priorSteps: e.agentExecutionContext.priorSteps
1362
- }, n = await qe({
1362
+ }, n = await Le({
1363
1363
  promptText: a,
1364
1364
  modelTier: "fast",
1365
1365
  messages: e.dataExplorationMessages,
@@ -1378,8 +1378,8 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1378
1378
  throw await m({ text: "Error during filter LLM request" }, t), new Error(`Error during filter LLM request: ${r instanceof Error ? r.message : String(r)}`);
1379
1379
  }
1380
1380
  };
1381
- async function Ia(e, t) {
1382
- const a = await new G(We).invoke(
1381
+ async function Na(e, t) {
1382
+ const a = await new O(We).invoke(
1383
1383
  {
1384
1384
  messages: e.dataExplorationMessages
1385
1385
  },
@@ -1390,9 +1390,9 @@ async function Ia(e, t) {
1390
1390
  t
1391
1391
  ), { ...e };
1392
1392
  }
1393
- const Na = new G(Ke);
1394
- async function Aa(e, t) {
1395
- const { messages: r } = await Na.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
1393
+ const Aa = new O(Ke);
1394
+ async function Ma(e, t) {
1395
+ const { messages: r } = await Aa.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
1396
1396
  for (const n of r) {
1397
1397
  const s = n.content;
1398
1398
  let i;
@@ -1430,13 +1430,13 @@ async function Aa(e, t) {
1430
1430
  `)) : "Query executed."
1431
1431
  };
1432
1432
  }
1433
- const Ma = 10, za = ["string", "small-integer", "integer"], _a = async (e, t, { includeSummaryStatistics: r = !0, includeUniqueValues: a = !0 } = {}) => {
1433
+ const za = 10, _a = ["string", "small-integer", "integer"], Da = async (e, t, { includeSummaryStatistics: r = !0, includeUniqueValues: a = !0 } = {}) => {
1434
1434
  let o = null, n = null;
1435
1435
  try {
1436
1436
  if (t.type !== "geometry" && t.type !== "oid" && t.type !== "global-id") {
1437
1437
  r && (o = await Ae({ layer: e, field: t.name }));
1438
1438
  const s = t.domain?.type === "coded-value" ? t.domain : null;
1439
- a && (za.includes(t.type) || s) && (n = (await Me({ layer: e, field: t.name })).uniqueValueInfos.sort((i, c) => c.count - i.count).slice(0, Ma), s && (n = n.map((i) => ({
1439
+ a && (_a.includes(t.type) || s) && (n = (await Me({ layer: e, field: t.name })).uniqueValueInfos.sort((i, c) => c.count - i.count).slice(0, za), s && (n = n.map((i) => ({
1440
1440
  ...i,
1441
1441
  value: s.getName(i.value) ?? i.value
1442
1442
  }))));
@@ -1449,10 +1449,10 @@ const Ma = 10, za = ["string", "small-integer", "integer"], _a = async (e, t, {
1449
1449
  uniqueValues: n
1450
1450
  };
1451
1451
  };
1452
- function Da(e, t) {
1452
+ function ja(e, t) {
1453
1453
  return ["string", "small-integer", "integer"].includes(e) || t === "coded-value";
1454
1454
  }
1455
- async function ja(e, t, r, a = !0) {
1455
+ async function Pa(e, t, r, a = !0) {
1456
1456
  const o = [], n = [], s = [];
1457
1457
  for (const i of e) {
1458
1458
  let c = function(w) {
@@ -1476,13 +1476,13 @@ async function ja(e, t, r, a = !0) {
1476
1476
  const y = h.get(w.name);
1477
1477
  if (!y)
1478
1478
  continue;
1479
- const f = y.statistics, x = a && !f?.summaryStatistics, E = Da(y.type, y.domain?.type) && !f?.uniqueValues, T = x || E;
1479
+ const f = y.statistics, x = a && !f?.summaryStatistics, E = ja(y.type, y.domain?.type) && !f?.uniqueValues, T = x || E;
1480
1480
  if (s.push({
1481
1481
  layerId: d,
1482
1482
  fieldName: y.name,
1483
1483
  didFetchStatistics: T
1484
1484
  }), T) {
1485
- const D = _a(p, y, {
1485
+ const j = Da(p, y, {
1486
1486
  includeSummaryStatistics: x,
1487
1487
  includeUniqueValues: E
1488
1488
  }).then((L) => {
@@ -1492,7 +1492,7 @@ async function ja(e, t, r, a = !0) {
1492
1492
  };
1493
1493
  x && ($.summaryStatistics = L.summaryStatistics), E && ($.uniqueValues = L.uniqueValues), h.set(y.name, { ...y, statistics: $ }), y.statistics = $;
1494
1494
  });
1495
- n.push(D);
1495
+ n.push(j);
1496
1496
  }
1497
1497
  g.fieldInfos.push(y);
1498
1498
  }
@@ -1503,14 +1503,14 @@ async function ja(e, t, r, a = !0) {
1503
1503
  fieldStatisticsFetchStatus: s
1504
1504
  };
1505
1505
  }
1506
- const Ee = /\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;
1507
- function Pa(e, t) {
1508
- return Ee.test(e) || Ee.test(t);
1506
+ const Re = /\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;
1507
+ function Ga(e, t) {
1508
+ return Re.test(e) || Re.test(t);
1509
1509
  }
1510
- const Ga = async (e, t) => {
1510
+ const Oa = async (e, t) => {
1511
1511
  try {
1512
1512
  await m({ text: "Preparing field information for vector search results" }, t);
1513
- const r = S(t, "layersAndFieldsRegistry"), { mapView: a } = A(t), { assignedTask: o, userRequest: n } = e.agentExecutionContext, s = Pa(o, n), { layerFieldInfo: i, didFetchStatistics: c, fieldStatisticsFetchStatus: d } = await ja(
1513
+ const r = S(t, "layersAndFieldsRegistry"), { mapView: a } = A(t), { assignedTask: o, userRequest: n } = e.agentExecutionContext, s = Ga(o, n), { layerFieldInfo: i, didFetchStatistics: c, fieldStatisticsFetchStatus: d } = await Pa(
1514
1514
  e.vectorSearchFieldResults,
1515
1515
  r,
1516
1516
  a,
@@ -1528,14 +1528,14 @@ const Ga = async (e, t) => {
1528
1528
  } catch (r) {
1529
1529
  throw await m({ text: "Error during fetching statistics" }, t), new Error(`Error during fetching statistics: ${r instanceof Error ? r.message : String(r)}`);
1530
1530
  }
1531
- }, Re = 0.7, Oa = 10, Va = async (e, t) => {
1531
+ }, $e = 0.7, Va = 10, Qa = async (e, t) => {
1532
1532
  try {
1533
1533
  await m({ text: "Similarity search to find fields" }, t);
1534
1534
  const r = S(t, "fieldSearch"), a = S(t, "layersAndFieldsRegistry"), o = S(t, "embeddingCache"), n = await r.searchFields({
1535
1535
  text: e.agentExecutionContext.assignedTask,
1536
1536
  layerIds: e.vectorSearchLayerIds,
1537
- minScore: Re,
1538
- topResults: Oa,
1537
+ minScore: $e,
1538
+ topResults: Va,
1539
1539
  embeddingCache: o
1540
1540
  }), s = n.map(({ layerId: c, results: d }) => {
1541
1541
  const u = d.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
@@ -1546,7 +1546,7 @@ ${u}`;
1546
1546
  `);
1547
1547
  let i;
1548
1548
  return n.length > 0 ? i = `Vector search completed. Matching layers and fields with scores:
1549
- ${s}` : i = `No vector search results found for score over ${Re}.`, await m({ text: i }, t), {
1549
+ ${s}` : i = `No vector search results found for score over ${$e}.`, await m({ text: i }, t), {
1550
1550
  ...e,
1551
1551
  vectorSearchFieldResults: n
1552
1552
  };
@@ -1556,7 +1556,7 @@ ${s}` : i = `No vector search results found for score over ${Re}.`, await m({ te
1556
1556
  t
1557
1557
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1558
1558
  }
1559
- }, Qa = 0.7, Ka = async (e, t) => {
1559
+ }, Ka = 0.7, Wa = async (e, t) => {
1560
1560
  try {
1561
1561
  await m(
1562
1562
  { text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
@@ -1564,7 +1564,7 @@ ${s}` : i = `No vector search results found for score over ${Re}.`, await m({ te
1564
1564
  );
1565
1565
  const r = S(t, "layerSearch"), a = S(t, "layersAndFieldsRegistry"), o = S(t, "embeddingCache"), n = await r.searchLayers({
1566
1566
  text: e.agentExecutionContext.assignedTask,
1567
- minScore: Qa,
1567
+ minScore: Ka,
1568
1568
  embeddingCache: o
1569
1569
  }), s = n.map((d) => d.id), i = n.map(({ id: d, score: u }) => `${a.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1570
1570
  `);
@@ -1580,10 +1580,10 @@ ${i}` : c = "Vector search completed. No matching layers found.", await m({ text
1580
1580
  t
1581
1581
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1582
1582
  }
1583
- }, Wa = (e, t) => H(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
1583
+ }, Ua = (e, t) => H(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
1584
1584
  e,
1585
1585
  t
1586
- ), Ua = () => new U(je).addNode("requireDataExplorationServices", Wa).addNode("vectorSearchLayers", Ka).addNode("vectorSearchFields", Va).addNode("fieldStatistics", Ga).addNode("queryAgent", qa).addNode("queryTools", Aa).addNode("summarizeQueryResponseLLM", La).addNode("filterAgent", Fa).addNode("filterTools", Ia).addNode("earlyExit", Mr).addEdge(B, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1586
+ ), Ba = () => new U(je).addNode("requireDataExplorationServices", Ua).addNode("vectorSearchLayers", Wa).addNode("vectorSearchFields", Qa).addNode("fieldStatistics", Oa).addNode("queryAgent", La).addNode("queryTools", Ma).addNode("summarizeQueryResponseLLM", Ia).addNode("filterAgent", qa).addNode("filterTools", Na).addNode("earlyExit", zr).addEdge(B, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1587
1587
  "vectorSearchLayers",
1588
1588
  (t) => t.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
1589
1589
  ).addConditionalEdges(
@@ -1592,7 +1592,7 @@ ${i}` : c = "Vector search completed. No matching layers found.", await m({ text
1592
1592
  ).addEdge("fieldStatistics", "queryAgent").addConditionalEdges("queryAgent", (t) => (t.dataExplorationMessages[t.dataExplorationMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "queryTools" : "filterAgent").addConditionalEdges(
1593
1593
  "queryTools",
1594
1594
  (t) => t.queryResponse.length ? "summarizeQueryResponseLLM" : "filterAgent"
1595
- ).addEdge("summarizeQueryResponseLLM", "filterAgent").addConditionalEdges("filterAgent", (t) => (t.dataExplorationMessages[t.dataExplorationMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "filterTools" : C).addEdge("filterTools", C).addEdge("earlyExit", C), Ba = 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).
1595
+ ).addEdge("summarizeQueryResponseLLM", "filterAgent").addConditionalEdges("filterAgent", (t) => (t.dataExplorationMessages[t.dataExplorationMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "filterTools" : C).addEdge("filterTools", C).addEdge("earlyExit", C), Ha = 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).
1596
1596
  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.
1597
1597
  _Example: “Only show stations where Brand is Shell”_
1598
1598
  _Example: “Make Shell stations stand out on the map”_
@@ -1600,20 +1600,20 @@ ${i}` : c = "Vector search completed. No matching layers found.", await m({ text
1600
1600
  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.
1601
1601
  _Example: “How many features are there?”_
1602
1602
  _Example: “What’s the average population?”_
1603
- _Example: “Which values are in the status field?”_`, wi = {
1603
+ _Example: “Which values are in the status field?”_`, bi = {
1604
1604
  id: "dataExploration",
1605
1605
  name: "Data Exploration Agent",
1606
- description: Ba,
1607
- createGraph: Ua,
1606
+ description: Ha,
1607
+ createGraph: Ba,
1608
1608
  workspace: je
1609
- }, $e = 0.7, Ha = 10, Za = async (e, t) => {
1609
+ }, Ce = 0.7, Za = 10, Ja = async (e, t) => {
1610
1610
  try {
1611
1611
  await m({ text: "Similarity search to find fields" }, t);
1612
1612
  const r = S(t, "fieldSearch"), a = S(t, "layersAndFieldsRegistry"), o = S(t, "embeddingCache"), n = await r.searchFields({
1613
1613
  text: e.agentExecutionContext.assignedTask,
1614
1614
  layerIds: e.vectorSearchLayerIds,
1615
- minScore: $e,
1616
- topResults: Ha,
1615
+ minScore: Ce,
1616
+ topResults: Za,
1617
1617
  embeddingCache: o
1618
1618
  }), s = n.map(({ layerId: c, results: d }) => {
1619
1619
  const u = d.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
@@ -1624,7 +1624,7 @@ ${u}`;
1624
1624
  `);
1625
1625
  let i;
1626
1626
  return n.length > 0 ? i = `Vector search completed. Matching layers and fields with scores:
1627
- ${s}` : i = `No vector search results found for score over ${$e}.`, await m({ text: i }, t), {
1627
+ ${s}` : i = `No vector search results found for score over ${Ce}.`, await m({ text: i }, t), {
1628
1628
  ...e,
1629
1629
  vectorSearchFieldResults: n
1630
1630
  };
@@ -1634,7 +1634,7 @@ ${s}` : i = `No vector search results found for score over ${$e}.`, await m({ te
1634
1634
  t
1635
1635
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1636
1636
  }
1637
- }, Ja = 0.7, Ya = async (e, t) => {
1637
+ }, Ya = 0.7, Xa = async (e, t) => {
1638
1638
  try {
1639
1639
  await m(
1640
1640
  { text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
@@ -1642,7 +1642,7 @@ ${s}` : i = `No vector search results found for score over ${$e}.`, await m({ te
1642
1642
  );
1643
1643
  const r = S(t, "layerSearch"), a = S(t, "layersAndFieldsRegistry"), o = await r.searchLayers({
1644
1644
  text: e.agentExecutionContext.assignedTask,
1645
- minScore: Ja
1645
+ minScore: Ya
1646
1646
  }), n = o.map((c) => c.id), s = o.map(({ id: c, score: d }) => `${a.get(c)?.layerItem.name ?? c} (${d.toFixed(2)})`).join(`
1647
1647
  `);
1648
1648
  let i;
@@ -1658,16 +1658,16 @@ ${s}` : i = "Vector search completed. No matching layers found.", await m({ text
1658
1658
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1659
1659
  }
1660
1660
  };
1661
- async function Xa(e) {
1661
+ async function eo(e) {
1662
1662
  const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
1663
1663
  let s;
1664
- return n ? s = St({
1665
- basemapTheme: await we(a),
1664
+ return n ? s = vt({
1665
+ basemapTheme: await be(a),
1666
1666
  geometryType: r.geometryType,
1667
1667
  includedTags: n,
1668
1668
  numColors: Math.min(t.length, 8)
1669
- })[0] : s = vt({
1670
- basemapTheme: await we(a),
1669
+ })[0] : s = xt({
1670
+ basemapTheme: await be(a),
1671
1671
  geometryType: r.geometryType,
1672
1672
  numColors: Math.min(t.length, 8)
1673
1673
  }).primaryScheme, {
@@ -1683,10 +1683,10 @@ async function Xa(e) {
1683
1683
  pieChartScheme: s
1684
1684
  };
1685
1685
  }
1686
- async function eo(e) {
1687
- return await bt(e);
1686
+ async function to(e) {
1687
+ return await St(e);
1688
1688
  }
1689
- async function to({
1689
+ async function ro({
1690
1690
  arcgisMap: e,
1691
1691
  arcgisMapView: t,
1692
1692
  layerId: r,
@@ -1705,30 +1705,30 @@ async function to({
1705
1705
  colorSchemeTags: o
1706
1706
  };
1707
1707
  try {
1708
- const u = await Xa(d), p = await eo(u);
1708
+ const u = await eo(d), p = await to(u);
1709
1709
  return i.renderer = p.renderer, i.visible = !0, `Chart renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1710
1710
  } catch (u) {
1711
1711
  return `Error applying chart renderer: ${u instanceof Error ? u.message : String(u)}`;
1712
1712
  }
1713
1713
  }
1714
- const ro = ["mapView"];
1714
+ const ao = ["mapView"];
1715
1715
  function q(e) {
1716
1716
  const r = e?.configurable?.context;
1717
1717
  if (!r || typeof r != "object")
1718
1718
  throw new Error("LayerStylingAgent context missing");
1719
- const a = ro.filter((o) => !(o in r));
1719
+ const a = ao.filter((o) => !(o in r));
1720
1720
  if (a.length)
1721
1721
  throw new Error(`LayerStylingAgent context missing: ${a.join(", ")}`);
1722
1722
  return r;
1723
1723
  }
1724
- async function ao({
1724
+ async function oo({
1725
1725
  layerId: e,
1726
1726
  fields: t,
1727
1727
  colorSchemes: r,
1728
1728
  includeSize: a
1729
1729
  }, o) {
1730
1730
  const { mapView: n } = q(o);
1731
- return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await to({
1731
+ return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await ro({
1732
1732
  arcgisMap: n.map,
1733
1733
  arcgisMapView: n,
1734
1734
  layerId: e,
@@ -1737,12 +1737,12 @@ async function ao({
1737
1737
  includeSize: a
1738
1738
  });
1739
1739
  }
1740
- const oo = l.object({
1740
+ const no = l.object({
1741
1741
  layerId: l.string().describe("The id of the layer to apply the chart renderer to"),
1742
1742
  fields: l.array(l.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
1743
1743
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
1744
1744
  includeSize: l.boolean().optional().describe("Whether to vary the chart size (chart-size)")
1745
- }), no = b(ao, {
1745
+ }), so = b(oo, {
1746
1746
  name: "chart",
1747
1747
  description: `Label: Charts
1748
1748
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
@@ -1755,12 +1755,12 @@ const oo = l.object({
1755
1755
  Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
1756
1756
  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.
1757
1757
  Fields: This style requires 2-8 number fields.`,
1758
- schema: oo
1758
+ schema: no
1759
1759
  });
1760
- function so(e) {
1760
+ function io(e) {
1761
1761
  const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: n } = e, s = t[0];
1762
1762
  let i;
1763
- return n && (i = de({
1763
+ return n && (i = ue({
1764
1764
  geometryType: r.geometryType,
1765
1765
  includedTags: n,
1766
1766
  theme: o || "high-to-low"
@@ -1775,10 +1775,10 @@ function so(e) {
1775
1775
  colorScheme: i
1776
1776
  };
1777
1777
  }
1778
- async function io(e) {
1779
- return await xt(e);
1778
+ async function lo(e) {
1779
+ return await Tt(e);
1780
1780
  }
1781
- async function lo({
1781
+ async function co({
1782
1782
  arcgisMap: e,
1783
1783
  arcgisMapView: t,
1784
1784
  layerId: r,
@@ -1798,20 +1798,20 @@ async function lo({
1798
1798
  theme: n
1799
1799
  };
1800
1800
  try {
1801
- const d = so(c), u = await io(d);
1801
+ const d = io(c), u = await lo(d);
1802
1802
  return i.renderer = u.renderer, i.visible = !0, `Color-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1803
1803
  } catch (d) {
1804
1804
  return `Error applying color-age renderer: ${d instanceof Error ? d.message : String(d)}`;
1805
1805
  }
1806
1806
  }
1807
- async function co({
1807
+ async function uo({
1808
1808
  layerId: e,
1809
1809
  fields: t,
1810
1810
  colorSchemes: r,
1811
1811
  theme: a
1812
1812
  }, o) {
1813
1813
  const { mapView: n } = q(o);
1814
- return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await lo({
1814
+ return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await co({
1815
1815
  arcgisMap: n.map,
1816
1816
  arcgisMapView: n,
1817
1817
  layerId: e,
@@ -1820,26 +1820,26 @@ async function co({
1820
1820
  theme: a
1821
1821
  });
1822
1822
  }
1823
- const uo = l.object({
1823
+ const po = l.object({
1824
1824
  layerId: l.string().describe("The id of the layer to apply the color-age renderer to"),
1825
1825
  fields: l.array(l.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
1826
1826
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
1827
1827
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
1828
- }), po = b(co, {
1828
+ }), ho = b(uo, {
1829
1829
  name: "color-age",
1830
1830
  description: `Label: Age (color)
1831
1831
  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.
1832
1832
  Keywords: since, age, how old, how long
1833
1833
  Example: Show the age of each feature based on its reported date.
1834
1834
  Fields: This style requires at least one field with a date type.`,
1835
- schema: uo
1835
+ schema: po
1836
1836
  });
1837
- function ho(e) {
1837
+ function mo(e) {
1838
1838
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
1839
1839
  let { theme: n } = e, s = t[1];
1840
1840
  const i = t[0];
1841
1841
  let c;
1842
- return o && (c = de({
1842
+ return o && (c = ue({
1843
1843
  geometryType: r.geometryType,
1844
1844
  includedTags: o,
1845
1845
  theme: n || "high-to-low"
@@ -1854,10 +1854,10 @@ function ho(e) {
1854
1854
  colorScheme: c
1855
1855
  };
1856
1856
  }
1857
- async function mo(e) {
1858
- return await Tt(e);
1857
+ async function yo(e) {
1858
+ return await Et(e);
1859
1859
  }
1860
- async function yo({
1860
+ async function go({
1861
1861
  arcgisMap: e,
1862
1862
  arcgisMapView: t,
1863
1863
  layerId: r,
@@ -1877,20 +1877,20 @@ async function yo({
1877
1877
  theme: n
1878
1878
  };
1879
1879
  try {
1880
- const d = ho(c), u = await mo(d);
1880
+ const d = mo(c), u = await yo(d);
1881
1881
  return i.renderer = u.renderer, i.visible = !0, `Color renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1882
1882
  } catch (d) {
1883
1883
  return `Error applying color renderer: ${d instanceof Error ? d.message : String(d)}`;
1884
1884
  }
1885
1885
  }
1886
- async function go({
1886
+ async function fo({
1887
1887
  layerId: e,
1888
1888
  fields: t,
1889
1889
  colorSchemes: r,
1890
1890
  theme: a
1891
1891
  }, o) {
1892
1892
  const { mapView: n } = q(o);
1893
- return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await yo({
1893
+ return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await go({
1894
1894
  arcgisMap: n.map,
1895
1895
  arcgisMapView: n,
1896
1896
  layerId: e,
@@ -1899,25 +1899,25 @@ async function go({
1899
1899
  theme: a
1900
1900
  });
1901
1901
  }
1902
- const fo = l.object({
1902
+ const wo = l.object({
1903
1903
  layerId: l.string().describe("The id of the layer to apply the color renderer to"),
1904
1904
  fields: l.array(l.string()).describe("The field(s) to use for the color renderer"),
1905
1905
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
1906
1906
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
1907
- }), wo = b(go, {
1907
+ }), bo = b(fo, {
1908
1908
  name: "color",
1909
1909
  description: `Label: Counts and Amounts (color)
1910
1910
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
1911
1911
  Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
1912
1912
  Example: Color each feature based on the population density.
1913
1913
  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.`,
1914
- schema: fo
1914
+ schema: wo
1915
1915
  });
1916
- function bo(e) {
1916
+ function So(e) {
1917
1917
  const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: n } = e;
1918
1918
  let s, i;
1919
1919
  const c = t[0];
1920
- return o && (i = de({
1920
+ return o && (i = ue({
1921
1921
  geometryType: r.geometryType,
1922
1922
  includedTags: o,
1923
1923
  theme: n || "high-to-low"
@@ -1932,10 +1932,10 @@ function bo(e) {
1932
1932
  }
1933
1933
  };
1934
1934
  }
1935
- async function So(e) {
1936
- return await Et(e);
1935
+ async function vo(e) {
1936
+ return await Rt(e);
1937
1937
  }
1938
- async function vo({
1938
+ async function xo({
1939
1939
  arcgisMap: e,
1940
1940
  arcgisMapView: t,
1941
1941
  layerId: r,
@@ -1955,20 +1955,20 @@ async function vo({
1955
1955
  theme: n
1956
1956
  };
1957
1957
  try {
1958
- const d = bo(c), u = await So(d);
1958
+ const d = So(c), u = await vo(d);
1959
1959
  return i.renderer = u.renderer, i.visible = !0, `Color-size-univariate renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1960
1960
  } catch (d) {
1961
1961
  return `Error applying color-size-univariate renderer: ${d instanceof Error ? d.message : String(d)}`;
1962
1962
  }
1963
1963
  }
1964
- async function xo({
1964
+ async function To({
1965
1965
  layerId: e,
1966
1966
  fields: t,
1967
1967
  colorSchemes: r,
1968
1968
  theme: a
1969
1969
  }, o) {
1970
1970
  const { mapView: n } = q(o);
1971
- return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await vo({
1971
+ return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await xo({
1972
1972
  arcgisMap: n.map,
1973
1973
  arcgisMapView: n,
1974
1974
  layerId: e,
@@ -1977,24 +1977,24 @@ async function xo({
1977
1977
  theme: a
1978
1978
  });
1979
1979
  }
1980
- const To = l.object({
1980
+ const Eo = l.object({
1981
1981
  layerId: l.string().describe("The id of the layer to apply the color-size univariate renderer to"),
1982
1982
  fields: l.array(l.string()).describe("The fields to use for the color-size univariate renderer"),
1983
1983
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
1984
1984
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
1985
- }), Eo = b(xo, {
1985
+ }), Ro = b(To, {
1986
1986
  name: "color-size-univariate",
1987
1987
  description: `Label: Color and Size (univariate)
1988
1988
  Description: Vary symbol size and color based on the values of two numeric attributes.
1989
1989
  Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
1990
1990
  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.
1991
1991
  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.`,
1992
- schema: To
1992
+ schema: Eo
1993
1993
  });
1994
- function Ro(e) {
1994
+ function $o(e) {
1995
1995
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
1996
1996
  let n;
1997
- return o && (n = $t({
1997
+ return o && (n = Ct({
1998
1998
  includedTags: o,
1999
1999
  numColors: Math.min(t.length, 8)
2000
2000
  })[0]), {
@@ -2011,10 +2011,10 @@ function Ro(e) {
2011
2011
  dotDensityScheme: n
2012
2012
  };
2013
2013
  }
2014
- async function $o(e) {
2015
- return await Rt(e);
2014
+ async function Co(e) {
2015
+ return await $t(e);
2016
2016
  }
2017
- async function Co({
2017
+ async function ko({
2018
2018
  arcgisMap: e,
2019
2019
  arcgisMapView: t,
2020
2020
  layerId: r,
@@ -2032,19 +2032,19 @@ async function Co({
2032
2032
  colorSchemeTags: o
2033
2033
  };
2034
2034
  try {
2035
- const c = Ro(i), d = await $o(c);
2035
+ const c = $o(i), d = await Co(c);
2036
2036
  return s.renderer = d.renderer, s.visible = !0, `Dot Density renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
2037
2037
  } catch (c) {
2038
2038
  return `Error applying dot density renderer: ${c instanceof Error ? c.message : String(c)}`;
2039
2039
  }
2040
2040
  }
2041
- async function ko({
2041
+ async function Fo({
2042
2042
  layerId: e,
2043
2043
  fields: t,
2044
2044
  colorSchemes: r
2045
2045
  }, a) {
2046
2046
  const { mapView: o } = q(a);
2047
- return await k({ type: "show-legend", data: { layerIds: [e] } }, a), await Co({
2047
+ return await k({ type: "show-legend", data: { layerIds: [e] } }, a), await ko({
2048
2048
  arcgisMap: o.map,
2049
2049
  arcgisMapView: o,
2050
2050
  layerId: e,
@@ -2052,11 +2052,11 @@ async function ko({
2052
2052
  colorSchemes: r
2053
2053
  });
2054
2054
  }
2055
- const Fo = l.object({
2055
+ const qo = l.object({
2056
2056
  layerId: l.string().describe("The id of the layer to apply the dot density renderer to"),
2057
2057
  fields: l.array(l.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
2058
2058
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use")
2059
- }), qo = b(ko, {
2059
+ }), Lo = b(Fo, {
2060
2060
  name: "dot-density",
2061
2061
  description: `Dot Density
2062
2062
  Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
@@ -2070,13 +2070,13 @@ const Fo = l.object({
2070
2070
  - Display demographic patterns within census tracts
2071
2071
  **Fields:** Requires 2-8 number fields.
2072
2072
  **Keywords:** density, how much, how many, total, number, amount`,
2073
- schema: Fo
2073
+ schema: qo
2074
2074
  });
2075
- function Lo(e) {
2075
+ function Io(e) {
2076
2076
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
2077
2077
  let n;
2078
2078
  const s = t[0];
2079
- return o && (n = kt({
2079
+ return o && (n = Ft({
2080
2080
  includedTags: o,
2081
2081
  basemap: a.map?.basemap || "topo"
2082
2082
  })[0]), {
@@ -2086,10 +2086,10 @@ function Lo(e) {
2086
2086
  heatmapScheme: n
2087
2087
  };
2088
2088
  }
2089
- async function Io(e) {
2090
- return await Ct(e);
2089
+ async function No(e) {
2090
+ return await kt(e);
2091
2091
  }
2092
- async function No({
2092
+ async function Ao({
2093
2093
  arcgisMap: e,
2094
2094
  arcgisMapView: t,
2095
2095
  layerId: r,
@@ -2107,19 +2107,19 @@ async function No({
2107
2107
  colorSchemeTags: o
2108
2108
  };
2109
2109
  try {
2110
- const c = Lo(i), d = await Io(c);
2110
+ const c = Io(i), d = await No(c);
2111
2111
  return s.renderer = d.renderer, s.visible = !0, `Heatmap renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
2112
2112
  } catch (c) {
2113
2113
  return `Error applying heatmap renderer: ${c instanceof Error ? c.message : String(c)}`;
2114
2114
  }
2115
2115
  }
2116
- async function Ao({
2116
+ async function Mo({
2117
2117
  layerId: e,
2118
2118
  fields: t,
2119
2119
  colorSchemes: r
2120
2120
  }, a) {
2121
2121
  const { mapView: o } = q(a);
2122
- return await k({ type: "show-legend", data: { layerIds: [e] } }, a), await No({
2122
+ return await k({ type: "show-legend", data: { layerIds: [e] } }, a), await Ao({
2123
2123
  arcgisMap: o.map,
2124
2124
  arcgisMapView: o,
2125
2125
  layerId: e,
@@ -2127,23 +2127,23 @@ async function Ao({
2127
2127
  colorSchemes: r
2128
2128
  });
2129
2129
  }
2130
- const Mo = l.object({
2130
+ const zo = l.object({
2131
2131
  layerId: l.string().describe("The id of the layer to apply the heatmap renderer to"),
2132
2132
  fields: l.array(l.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
2133
2133
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use")
2134
- }), zo = b(Ao, {
2134
+ }), _o = b(Mo, {
2135
2135
  name: "heatmap",
2136
2136
  description: `Label: Heat Map
2137
2137
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
2138
2138
  Keywords: density, heatmap, hot spots, pattern, cluster
2139
2139
  Example: Create a heatmap
2140
2140
  Fields: This typically requires zero or one field of type number.`,
2141
- schema: Mo
2141
+ schema: zo
2142
2142
  });
2143
- function _o(e) {
2143
+ function Do(e) {
2144
2144
  const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
2145
2145
  let s;
2146
- return n && (s = qt({
2146
+ return n && (s = Lt({
2147
2147
  geometryType: r.geometryType,
2148
2148
  includedTags: n,
2149
2149
  numColors: Math.min(t.length, 10)
@@ -2157,10 +2157,10 @@ function _o(e) {
2157
2157
  predominanceScheme: s
2158
2158
  };
2159
2159
  }
2160
- async function Do(e) {
2161
- return await Ft(e);
2160
+ async function jo(e) {
2161
+ return await qt(e);
2162
2162
  }
2163
- async function jo({
2163
+ async function Po({
2164
2164
  arcgisMap: e,
2165
2165
  arcgisMapView: t,
2166
2166
  layerId: r,
@@ -2179,20 +2179,20 @@ async function jo({
2179
2179
  colorSchemeTags: o
2180
2180
  };
2181
2181
  try {
2182
- const u = _o(d), p = await Do(u);
2182
+ const u = Do(d), p = await jo(u);
2183
2183
  return i.renderer = p.renderer, i.visible = !0, `Predominance renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2184
2184
  } catch (u) {
2185
2185
  return `Error applying predominance renderer: ${u instanceof Error ? u.message : String(u)}`;
2186
2186
  }
2187
2187
  }
2188
- async function Po({
2188
+ async function Go({
2189
2189
  layerId: e,
2190
2190
  fields: t,
2191
2191
  colorSchemes: r,
2192
2192
  includeSize: a
2193
2193
  }, o) {
2194
2194
  const { mapView: n } = q(o);
2195
- return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await jo({
2195
+ return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await Po({
2196
2196
  arcgisMap: n.map,
2197
2197
  arcgisMapView: n,
2198
2198
  layerId: e,
@@ -2201,12 +2201,12 @@ async function Po({
2201
2201
  includeSize: a
2202
2202
  });
2203
2203
  }
2204
- const Go = l.object({
2204
+ const Oo = l.object({
2205
2205
  layerId: l.string().describe("The id of the layer to apply the predominance renderer to"),
2206
2206
  fields: l.array(l.string()).describe("The fields to use for the predominance renderer (competing categories)"),
2207
2207
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
2208
2208
  includeSize: l.boolean().optional().describe("Whether to include size visualization (predominance-size)")
2209
- }), Oo = b(Po, {
2209
+ }), Vo = b(Go, {
2210
2210
  name: "predominance",
2211
2211
  description: `Label: Predominant category
2212
2212
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
@@ -2219,9 +2219,9 @@ const Go = l.object({
2219
2219
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
2220
2220
  Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
2221
2221
  Fields: This style relies on 2-10 number fields.`,
2222
- schema: Go
2222
+ schema: Oo
2223
2223
  });
2224
- function Vo(e) {
2224
+ function Qo(e) {
2225
2225
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
2226
2226
  let n;
2227
2227
  const s = {
@@ -2229,7 +2229,7 @@ function Vo(e) {
2229
2229
  }, i = {
2230
2230
  field: t[1]
2231
2231
  };
2232
- return o && (n = It({
2232
+ return o && (n = Nt({
2233
2233
  geometryType: r.geometryType,
2234
2234
  includedTags: o
2235
2235
  })[0]), {
@@ -2242,10 +2242,10 @@ function Vo(e) {
2242
2242
  relationshipScheme: n
2243
2243
  };
2244
2244
  }
2245
- async function Qo(e) {
2246
- return await Lt(e);
2245
+ async function Ko(e) {
2246
+ return await It(e);
2247
2247
  }
2248
- async function Ko({
2248
+ async function Wo({
2249
2249
  arcgisMap: e,
2250
2250
  arcgisMapView: t,
2251
2251
  layerId: r,
@@ -2263,19 +2263,19 @@ async function Ko({
2263
2263
  colorSchemeTags: o
2264
2264
  };
2265
2265
  try {
2266
- const c = Vo(i), d = await Qo(c);
2266
+ const c = Qo(i), d = await Ko(c);
2267
2267
  return s.renderer = d.renderer, s.visible = !0, `Relationship renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
2268
2268
  } catch (c) {
2269
2269
  return `Error applying relationship renderer: ${c instanceof Error ? c.message : String(c)}`;
2270
2270
  }
2271
2271
  }
2272
- async function Wo({
2272
+ async function Uo({
2273
2273
  layerId: e,
2274
2274
  fields: t,
2275
2275
  colorSchemes: r
2276
2276
  }, a) {
2277
2277
  const { mapView: o } = q(a);
2278
- return await k({ type: "show-legend", data: { layerIds: [e] } }, a), await Ko({
2278
+ return await k({ type: "show-legend", data: { layerIds: [e] } }, a), await Wo({
2279
2279
  arcgisMap: o.map,
2280
2280
  arcgisMapView: o,
2281
2281
  layerId: e,
@@ -2283,20 +2283,20 @@ async function Wo({
2283
2283
  colorSchemes: r
2284
2284
  });
2285
2285
  }
2286
- const Uo = l.object({
2286
+ const Bo = l.object({
2287
2287
  layerId: l.string().describe("The id of the layer to apply the relationship renderer to"),
2288
2288
  fields: l.array(l.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
2289
2289
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use")
2290
- }), Bo = b(Wo, {
2290
+ }), Ho = b(Uo, {
2291
2291
  name: "relationship",
2292
2292
  description: `Label: Relationship
2293
2293
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
2294
2294
  Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
2295
2295
  Example: Show the relationship between tree height and carbon storage
2296
2296
  Fields: This style requires two number fields.`,
2297
- schema: Uo
2297
+ schema: Bo
2298
2298
  });
2299
- function Ho(e) {
2299
+ function Zo(e) {
2300
2300
  const { fields: t, layer: r, view: a, theme: o } = e, n = t[0];
2301
2301
  return {
2302
2302
  layer: r,
@@ -2308,10 +2308,10 @@ function Ho(e) {
2308
2308
  outlineOptimizationEnabled: !0
2309
2309
  };
2310
2310
  }
2311
- async function Zo(e) {
2312
- return await Nt(e);
2311
+ async function Jo(e) {
2312
+ return await At(e);
2313
2313
  }
2314
- async function Jo({
2314
+ async function Yo({
2315
2315
  arcgisMap: e,
2316
2316
  arcgisMapView: t,
2317
2317
  layerId: r,
@@ -2331,20 +2331,20 @@ async function Jo({
2331
2331
  theme: n
2332
2332
  };
2333
2333
  try {
2334
- const d = Ho(c), u = await Zo(d);
2334
+ const d = Zo(c), u = await Jo(d);
2335
2335
  return i.renderer = u.renderer, i.visible = !0, `Size-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2336
2336
  } catch (d) {
2337
2337
  return `Error applying size-age renderer: ${d instanceof Error ? d.message : String(d)}`;
2338
2338
  }
2339
2339
  }
2340
- async function Yo({
2340
+ async function Xo({
2341
2341
  layerId: e,
2342
2342
  fields: t,
2343
2343
  colorSchemes: r,
2344
2344
  theme: a
2345
2345
  }, o) {
2346
2346
  const { mapView: n } = q(o);
2347
- return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await Jo({
2347
+ return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await Yo({
2348
2348
  arcgisMap: n.map,
2349
2349
  arcgisMapView: n,
2350
2350
  layerId: e,
@@ -2353,21 +2353,21 @@ async function Yo({
2353
2353
  theme: a
2354
2354
  });
2355
2355
  }
2356
- const Xo = l.object({
2356
+ const en = l.object({
2357
2357
  layerId: l.string().describe("The id of the layer to apply the size-age renderer to"),
2358
2358
  fields: l.array(l.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
2359
2359
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
2360
2360
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2361
- }), en = b(Yo, {
2361
+ }), tn = b(Xo, {
2362
2362
  name: "size-age",
2363
2363
  description: `Label: Age (size)
2364
2364
  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.
2365
2365
  Keywords: since, age, how old, how long
2366
2366
  Example: Change the size of features so older features are larger than new features.
2367
2367
  Fields: This style requires at least one field with a date type.`,
2368
- schema: Xo
2368
+ schema: en
2369
2369
  });
2370
- function tn(e) {
2370
+ function rn(e) {
2371
2371
  const { fields: t, layer: r, view: a } = e;
2372
2372
  let { theme: o } = e, n = t[1];
2373
2373
  const s = t[0];
@@ -2381,10 +2381,10 @@ function tn(e) {
2381
2381
  outlineOptimizationEnabled: !0
2382
2382
  };
2383
2383
  }
2384
- async function rn(e) {
2385
- return await At(e);
2384
+ async function an(e) {
2385
+ return await Mt(e);
2386
2386
  }
2387
- async function an({
2387
+ async function on({
2388
2388
  arcgisMap: e,
2389
2389
  arcgisMapView: t,
2390
2390
  layerId: r,
@@ -2404,20 +2404,20 @@ async function an({
2404
2404
  theme: n
2405
2405
  };
2406
2406
  try {
2407
- const d = tn(c), u = await rn(d);
2407
+ const d = rn(c), u = await an(d);
2408
2408
  return i.renderer = u.renderer, i.visible = !0, `Size renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2409
2409
  } catch (d) {
2410
2410
  return `Error applying size renderer: ${d instanceof Error ? d.message : String(d)}`;
2411
2411
  }
2412
2412
  }
2413
- async function on({
2413
+ async function nn({
2414
2414
  layerId: e,
2415
2415
  fields: t,
2416
2416
  colorSchemes: r,
2417
2417
  theme: a
2418
2418
  }, o) {
2419
2419
  const { mapView: n } = q(o);
2420
- return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await an({
2420
+ return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await on({
2421
2421
  arcgisMap: n.map,
2422
2422
  arcgisMapView: n,
2423
2423
  layerId: e,
@@ -2426,12 +2426,12 @@ async function on({
2426
2426
  theme: a
2427
2427
  });
2428
2428
  }
2429
- const nn = l.object({
2429
+ const sn = l.object({
2430
2430
  layerId: l.string().describe("The id of the layer to apply the size renderer to"),
2431
2431
  fields: l.array(l.string()).describe("The field(s) to use for the size renderer (numeric data)"),
2432
2432
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
2433
2433
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2434
- }), sn = b(on, {
2434
+ }), ln = b(nn, {
2435
2435
  name: "size",
2436
2436
  description: `Label: Counts and Amounts (size)
2437
2437
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
@@ -2444,12 +2444,12 @@ const nn = l.object({
2444
2444
  Keywords: graduated size, proportional size, classed size, how much, total, number, when
2445
2445
  Example: Vary the size of each feature based on the date a ticket was completed.
2446
2446
  Fields: This style requires a single field with a date type.`,
2447
- schema: nn
2447
+ schema: sn
2448
2448
  });
2449
- function ln(e) {
2449
+ function cn(e) {
2450
2450
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], s = t[1], i = t[2];
2451
2451
  let c;
2452
- return o && (c = zt({
2452
+ return o && (c = _t({
2453
2453
  geometryType: r.geometryType,
2454
2454
  includedTags: o
2455
2455
  })[0]), {
@@ -2463,10 +2463,10 @@ function ln(e) {
2463
2463
  typeScheme: c
2464
2464
  };
2465
2465
  }
2466
- async function cn(e) {
2467
- return await Mt(e);
2466
+ async function dn(e) {
2467
+ return await zt(e);
2468
2468
  }
2469
- async function dn({
2469
+ async function un({
2470
2470
  arcgisMap: e,
2471
2471
  arcgisMapView: t,
2472
2472
  layerId: r,
@@ -2486,20 +2486,20 @@ async function dn({
2486
2486
  theme: n
2487
2487
  };
2488
2488
  try {
2489
- const d = ln(c), u = await cn(d);
2489
+ const d = cn(c), u = await dn(d);
2490
2490
  return i.renderer = u.renderer, i.visible = !0, `Type renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2491
2491
  } catch (d) {
2492
2492
  return `Error applying type renderer: ${d instanceof Error ? d.message : String(d)}`;
2493
2493
  }
2494
2494
  }
2495
- async function un({
2495
+ async function pn({
2496
2496
  layerId: e,
2497
2497
  fields: t,
2498
2498
  colorSchemes: r,
2499
2499
  theme: a
2500
2500
  }, o) {
2501
2501
  const { mapView: n } = q(o);
2502
- return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await dn({
2502
+ return await k({ type: "show-legend", data: { layerIds: [e] } }, o), await un({
2503
2503
  arcgisMap: n.map,
2504
2504
  arcgisMapView: n,
2505
2505
  layerId: e,
@@ -2508,52 +2508,52 @@ async function un({
2508
2508
  theme: a
2509
2509
  });
2510
2510
  }
2511
- const pn = l.object({
2511
+ const hn = l.object({
2512
2512
  layerId: l.string().describe("The id of the layer to apply the type renderer to"),
2513
2513
  fields: l.array(l.string()).describe("The field(s) to use for the type renderer (categorical data)"),
2514
2514
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
2515
2515
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
2516
- }), hn = b(un, {
2516
+ }), mn = b(pn, {
2517
2517
  name: "type",
2518
2518
  description: `Label: Types (unique symbols)
2519
2519
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
2520
2520
  Keywords: categorical, category, type, unique, discrete, point of interest, region, group
2521
2521
  Example: Color each feature based on the region it belongs to
2522
2522
  Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
2523
- schema: pn
2523
+ schema: hn
2524
2524
  }), Ue = [
2525
- no,
2526
- po,
2527
- wo,
2528
- Eo,
2529
- qo,
2530
- zo,
2531
- Oo,
2532
- Bo,
2533
- en,
2534
- sn,
2535
- hn
2525
+ so,
2526
+ ho,
2527
+ bo,
2528
+ Ro,
2529
+ Lo,
2530
+ _o,
2531
+ Vo,
2532
+ Ho,
2533
+ tn,
2534
+ ln,
2535
+ mn
2536
2536
  ], Be = (e, t = 3) => {
2537
2537
  const r = e.map((o, n) => o.type === "human" ? n : -1).filter((o) => o !== -1);
2538
2538
  if (r.length === 0)
2539
2539
  return [];
2540
2540
  const a = r.length > t ? r[r.length - t] : r[0];
2541
2541
  return e.slice(a);
2542
- }, mn = async (e, t) => {
2542
+ }, yn = async (e, t) => {
2543
2543
  await m({ text: "Requesting LLM for layer query results" }, t);
2544
2544
  const r = await R("navigation_intent_prompt");
2545
2545
  if (!t?.configurable)
2546
2546
  throw new Error("config.configurable is required for layer query tools");
2547
2547
  const a = {
2548
2548
  layerFieldInfo: e.layerFieldInfo
2549
- }, o = await P({
2549
+ }, o = await G({
2550
2550
  promptText: r,
2551
2551
  modelTier: "advanced",
2552
2552
  messages: Be(e.agentExecutionContext.messages),
2553
2553
  inputVariables: a,
2554
2554
  tools: Ue
2555
2555
  });
2556
- return await pe(o, t), {
2556
+ return await he(o, t), {
2557
2557
  ...e,
2558
2558
  agentExecutionContext: {
2559
2559
  ...e.agentExecutionContext,
@@ -2561,8 +2561,8 @@ Fields: This style requires a single field which may be a string, number, or dat
2561
2561
  }
2562
2562
  };
2563
2563
  };
2564
- async function yn(e, t) {
2565
- const a = await new G(Ue).invoke(
2564
+ async function gn(e, t) {
2565
+ const a = await new O(Ue).invoke(
2566
2566
  {
2567
2567
  messages: Be(e.agentExecutionContext.messages)
2568
2568
  },
@@ -2580,7 +2580,7 @@ const He = v.Root({
2580
2580
  vectorSearchFieldResults: v(),
2581
2581
  layerFieldInfo: v(),
2582
2582
  selectedLayerId: v()
2583
- }), gn = async (e, t) => (await m({ text: "Exiting Layer Styling agent" }, t), e), fn = async (e, t) => {
2583
+ }), fn = async (e, t) => (await m({ text: "Exiting Layer Styling agent" }, t), e), wn = async (e, t) => {
2584
2584
  try {
2585
2585
  await m({ text: "Populating layer and field info" }, t);
2586
2586
  const r = [];
@@ -2611,14 +2611,14 @@ const He = v.Root({
2611
2611
  } catch (r) {
2612
2612
  throw await m({ text: "Error populating layerFieldInfo" }, t), new Error(`Error populating layerFieldInfo: ${r instanceof Error ? r.message : String(r)}`);
2613
2613
  }
2614
- }, wn = (e, t) => {
2614
+ }, bn = (e, t) => {
2615
2615
  const r = e.vectorSearchLayerIds ?? [];
2616
2616
  if (r.length <= 1)
2617
2617
  return { ...e, selectedLayerId: e.vectorSearchLayerIds[0] };
2618
2618
  const { hitlResponse: a } = t.configurable;
2619
- if (a?.agentId !== Ce.id || a.id !== "reviewLayerSelection") {
2619
+ if (a?.agentId !== ke.id || a.id !== "reviewLayerSelection") {
2620
2620
  const n = {
2621
- agentId: Ce.id,
2621
+ agentId: ke.id,
2622
2622
  id: "reviewLayerSelection",
2623
2623
  kind: "singleSelection",
2624
2624
  message: "Choose a layer to apply the styles.",
@@ -2631,21 +2631,21 @@ const He = v.Root({
2631
2631
  ...e,
2632
2632
  selectedLayerId: o ?? e.vectorSearchLayerIds[0]
2633
2633
  };
2634
- }, bn = (e, t) => H(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(e, t), Sn = () => new U(He).addNode("requireLayerStylingServices", bn).addNode("vectorSearchLayers", Ya).addNode("layerSelectionHITL", wn).addNode("vectorSearchFields", Za).addNode("populateLayerFieldInfo", fn).addNode("agent", mn).addNode("tools", yn).addNode("earlyExit", gn).addEdge(B, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
2634
+ }, Sn = (e, t) => H(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(e, t), vn = () => new U(He).addNode("requireLayerStylingServices", Sn).addNode("vectorSearchLayers", Xa).addNode("layerSelectionHITL", bn).addNode("vectorSearchFields", Ja).addNode("populateLayerFieldInfo", wn).addNode("agent", yn).addNode("tools", gn).addNode("earlyExit", fn).addEdge(B, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
2635
2635
  "layerSelectionHITL",
2636
2636
  (t) => t.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
2637
2637
  ).addConditionalEdges(
2638
2638
  "vectorSearchFields",
2639
2639
  (t) => t.vectorSearchFieldResults.length ? "populateLayerFieldInfo" : "earlyExit"
2640
- ).addEdge("populateLayerFieldInfo", "agent").addEdge("agent", "tools").addEdge("tools", C).addEdge("earlyExit", C), vn = 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.
2640
+ ).addEdge("populateLayerFieldInfo", "agent").addEdge("agent", "tools").addEdge("tools", C).addEdge("earlyExit", C), xn = 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.
2641
2641
  _Example: “Color points by sales amount”_
2642
2642
  _Example: “Show population density with a color gradient”_
2643
2643
  _Example: “Create a relationship map between height and depth”_
2644
- _Example: “Vary circle sizes according to population”_`, Ce = {
2644
+ _Example: “Vary circle sizes according to population”_`, ke = {
2645
2645
  id: "layerStyling",
2646
2646
  name: "Layer Styling Agent",
2647
- description: vn,
2648
- createGraph: Sn,
2647
+ description: xn,
2648
+ createGraph: vn,
2649
2649
  workspace: He
2650
2650
  }, Ze = v.Root({
2651
2651
  ...ee(),
@@ -2656,7 +2656,7 @@ const He = v.Root({
2656
2656
  toolCallMessage: void 0
2657
2657
  })
2658
2658
  })
2659
- }), xn = (e, t) => {
2659
+ }), Tn = (e, t) => {
2660
2660
  const r = Array.from(e.values()).find(
2661
2661
  ({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
2662
2662
  );
@@ -2669,16 +2669,16 @@ const He = v.Root({
2669
2669
  return `**${r.layerItem.title}** has ${a.length} field(s):
2670
2670
 
2671
2671
  ${o}`;
2672
- }, Tn = async ({ layerTitle: e }, t) => {
2672
+ }, En = async ({ layerTitle: e }, t) => {
2673
2673
  const r = S(t, "layersAndFieldsRegistry");
2674
- return xn(r, e);
2675
- }, En = b(Tn, {
2674
+ return Tn(r, e);
2675
+ }, Rn = b(En, {
2676
2676
  name: "listLayerFields",
2677
2677
  description: "Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",
2678
2678
  schema: l.object({
2679
2679
  layerTitle: l.string().describe("The title or partial title of the layer to list fields for.")
2680
2680
  })
2681
- }), Je = [En], Rn = (e) => {
2681
+ }), Je = [Rn], $n = (e) => {
2682
2682
  if (!e || e.size === 0)
2683
2683
  return "No layers available in this map.";
2684
2684
  const t = Array.from(e.values()).map(({ layerItem: r, fieldRegistry: a }, o) => {
@@ -2691,21 +2691,21 @@ ${o}`;
2691
2691
  return `This map contains ${e.size} layer(s):
2692
2692
 
2693
2693
  ${t}`;
2694
- }, $n = (e) => {
2694
+ }, Cn = (e) => {
2695
2695
  const t = e?.list() ?? [];
2696
2696
  return t.length ? t.map((r) => `- ${r.agent.name}: ${r.agent.description}`).join(`
2697
2697
  `) : "No agents currently available.";
2698
2698
  };
2699
- async function Cn(e, t) {
2699
+ async function kn(e, t) {
2700
2700
  const r = await R("help_prompt"), a = S(t, "layersAndFieldsRegistry"), o = S(t, "agentRegistry");
2701
2701
  try {
2702
- const n = await P({
2702
+ const n = await G({
2703
2703
  promptText: r,
2704
2704
  modelTier: "fast",
2705
2705
  tools: Je,
2706
2706
  inputVariables: {
2707
- layerSummary: Rn(a),
2708
- agents: $n(o),
2707
+ layerSummary: $n(a),
2708
+ agents: Cn(o),
2709
2709
  assignedTask: e.agentExecutionContext.assignedTask,
2710
2710
  userRequest: e.agentExecutionContext.userRequest,
2711
2711
  priorSteps: e.agentExecutionContext.priorSteps
@@ -2731,9 +2731,9 @@ async function Cn(e, t) {
2731
2731
  };
2732
2732
  }
2733
2733
  }
2734
- const kn = (e, t) => H(["agentRegistry"], "Help Agent")(e, t);
2735
- async function Fn(e, t) {
2736
- const r = new G(Je);
2734
+ const Fn = (e, t) => H(["agentRegistry"], "Help Agent")(e, t);
2735
+ async function qn(e, t) {
2736
+ const r = new O(Je);
2737
2737
  try {
2738
2738
  const a = e.helpInternalState.toolCallMessage;
2739
2739
  if (!a)
@@ -2764,7 +2764,7 @@ async function Fn(e, t) {
2764
2764
  };
2765
2765
  }
2766
2766
  }
2767
- const qn = () => new U(Ze).addNode("requireHelpServices", kn).addNode("agent", Cn).addNode("tools", Fn).addEdge(B, "requireHelpServices").addEdge("requireHelpServices", "agent").addConditionalEdges("agent", (t) => t.helpInternalState.toolCallMessage ? "tools" : C).addEdge("tools", C), Ln = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
2767
+ const Ln = () => new U(Ze).addNode("requireHelpServices", Fn).addNode("agent", kn).addNode("tools", qn).addEdge(B, "requireHelpServices").addEdge("requireHelpServices", "agent").addConditionalEdges("agent", (t) => t.helpInternalState.toolCallMessage ? "tools" : C).addEdge("tools", C), In = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
2768
2768
 
2769
2769
  _Example: “Tell me about this map”_
2770
2770
  _Example: “List all layers in this map”_
@@ -2777,11 +2777,11 @@ const qn = () => new U(Ze).addNode("requireHelpServices", kn).addNode("agent", C
2777
2777
 
2778
2778
  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.
2779
2779
  _Example: "Create a chart"_
2780
- _Example: "Create a table"_`, bi = {
2780
+ _Example: "Create a table"_`, Si = {
2781
2781
  id: "help",
2782
2782
  name: "Help Agent",
2783
- description: Ln,
2784
- createGraph: qn,
2783
+ description: In,
2784
+ createGraph: Ln,
2785
2785
  workspace: Ze
2786
2786
  }, Ye = v.Root({
2787
2787
  ...ee(),
@@ -2789,7 +2789,7 @@ const qn = () => new U(Ze).addNode("requireHelpServices", kn).addNode("agent", C
2789
2789
  reducer: (e, t) => t
2790
2790
  }),
2791
2791
  arcgisKnowledgeMessages: v({
2792
- reducer: ke,
2792
+ reducer: Fe,
2793
2793
  default: () => []
2794
2794
  }),
2795
2795
  arcgisKnowledgeToolResult: v({
@@ -2799,31 +2799,34 @@ const qn = () => new U(Ze).addNode("requireHelpServices", kn).addNode("agent", C
2799
2799
  }), J = {
2800
2800
  conversationId: ""
2801
2801
  };
2802
- function me(e) {
2802
+ function ye(e) {
2803
2803
  const t = e.map?.allLayers.filter((r) => r.type === "knowledge-graph");
2804
2804
  if (!t || t?.length !== 1)
2805
2805
  throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.");
2806
2806
  }
2807
- function O(e) {
2807
+ function D(e) {
2808
2808
  return !!e?.map && !("activeLinkChartLayer" in e.map);
2809
2809
  }
2810
- function re(e) {
2810
+ async function re(e) {
2811
+ !e || D(e) || !e.map?.diagramNodesExtent || await e.goTo(e.map.diagramNodesExtent);
2812
+ }
2813
+ function ae(e) {
2811
2814
  const r = e?.configurable?.context;
2812
2815
  if (!r || typeof r != "object")
2813
2816
  throw new Error("ArcgisKnowledgeAgent context missing");
2814
2817
  if (!("view" in r))
2815
2818
  throw new Error("View context missing");
2816
2819
  const a = r.view;
2817
- return a.map && !("activeLinkChartLayer" in a.map) && me(a), {
2820
+ return a.map && !("activeLinkChartLayer" in a.map) && ye(a), {
2818
2821
  view: a
2819
2822
  };
2820
2823
  }
2821
- function In(e) {
2824
+ function Nn(e) {
2822
2825
  const r = e?.configurable?.context;
2823
2826
  if (Xe(e) === "knowledgeGraph")
2824
2827
  return "knowledgeGraph";
2825
2828
  const o = r.view;
2826
- return O(o) ? (me(o), "map") : "linkChart";
2829
+ return D(o) ? (ye(o), "map") : "linkChart";
2827
2830
  }
2828
2831
  async function V(e) {
2829
2832
  const r = e?.configurable?.context;
@@ -2836,17 +2839,17 @@ async function V(e) {
2836
2839
  if (!n)
2837
2840
  throw new Error("Knowledge graph url missing from link chart.");
2838
2841
  return {
2839
- knowledgeGraph: await be(n)
2842
+ knowledgeGraph: await Se(n)
2840
2843
  };
2841
2844
  } else {
2842
- me(r.view);
2845
+ ye(r.view);
2843
2846
  const s = (r.view.map?.allLayers.find(
2844
2847
  (c) => c.type === "knowledge-graph"
2845
2848
  )).url;
2846
2849
  if (!s)
2847
2850
  throw new Error("Knowledge graph url missing from map.");
2848
2851
  return {
2849
- knowledgeGraph: await be(s)
2852
+ knowledgeGraph: await Se(s)
2850
2853
  };
2851
2854
  }
2852
2855
  }
@@ -2863,12 +2866,12 @@ function Xe(e) {
2863
2866
  return "view";
2864
2867
  throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.");
2865
2868
  }
2866
- class Nn {
2869
+ class An {
2867
2870
  constructor(t) {
2868
- this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = ae.fromDataModel(t);
2871
+ this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = oe.fromDataModel(t);
2869
2872
  }
2870
2873
  }
2871
- class ae {
2874
+ class oe {
2872
2875
  constructor() {
2873
2876
  this.schemaType = "ArcgisGraphSchema", this.entityTypes = [], this.relationshipTypes = [], this.identifierInfo = {
2874
2877
  mappingInfo: {
@@ -2878,14 +2881,14 @@ class ae {
2878
2881
  };
2879
2882
  }
2880
2883
  static fromDataModel(t) {
2881
- const r = new ae();
2884
+ const r = new oe();
2882
2885
  for (const a of t.entityTypes)
2883
2886
  r.entityTypes.push(W.fromEntityType(a));
2884
2887
  for (const a of t.relationshipTypes)
2885
- r.relationshipTypes.push(An.fromRelationshipType(a));
2888
+ r.relationshipTypes.push(Mn.fromRelationshipType(a));
2886
2889
  return r.identifierInfo = {
2887
2890
  mappingInfo: {
2888
- identifierMapsTo: Mn(
2891
+ identifierMapsTo: zn(
2889
2892
  t.identifierInfo.identifierMappingInfo.identifierInfoType
2890
2893
  ),
2891
2894
  identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
@@ -2905,13 +2908,13 @@ class W {
2905
2908
  }
2906
2909
  static fromEntityType(t) {
2907
2910
  const r = new W();
2908
- r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = zn(t.role);
2911
+ r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = _n(t.role);
2909
2912
  for (const a of t.properties) {
2910
2913
  const o = {
2911
2914
  name: a.name,
2912
2915
  alias: a.alias ? a.alias : void 0,
2913
2916
  fieldType: a.fieldType,
2914
- role: _n(a.role),
2917
+ role: Dn(a.role),
2915
2918
  geometryDef: a.fieldType === "esriFieldTypeGeometry" ? {
2916
2919
  geometryType: a.geometryType ?? "esriGeometryAny",
2917
2920
  hasM: a.hasM ? a.hasM : void 0,
@@ -2923,7 +2926,7 @@ class W {
2923
2926
  return r;
2924
2927
  }
2925
2928
  }
2926
- class An extends W {
2929
+ class Mn extends W {
2927
2930
  constructor() {
2928
2931
  super(...arguments), this.observedEndPoints = [];
2929
2932
  }
@@ -2938,7 +2941,7 @@ class An extends W {
2938
2941
  return r;
2939
2942
  }
2940
2943
  }
2941
- const Mn = (e) => {
2944
+ const zn = (e) => {
2942
2945
  switch (e) {
2943
2946
  case "esriIdentifierInfoTypeUNSPECIFIED":
2944
2947
  return "UNSPECIFIED";
@@ -2949,7 +2952,7 @@ const Mn = (e) => {
2949
2952
  default:
2950
2953
  return e;
2951
2954
  }
2952
- }, zn = (e) => {
2955
+ }, _n = (e) => {
2953
2956
  switch (e) {
2954
2957
  case "Regular":
2955
2958
  return "esriGraphNamedObjectRegular";
@@ -2961,7 +2964,7 @@ const Mn = (e) => {
2961
2964
  return e;
2962
2965
  }
2963
2966
  };
2964
- function _n(e) {
2967
+ function Dn(e) {
2965
2968
  switch (e) {
2966
2969
  case "esriGraphPropertyRegular":
2967
2970
  return "Regular";
@@ -2999,7 +3002,7 @@ function _n(e) {
2999
3002
  return "Regular";
3000
3003
  }
3001
3004
  }
3002
- function Dn(e, t) {
3005
+ function jn(e, t) {
3003
3006
  return t ? `${e}
3004
3007
 
3005
3008
  Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
@@ -3009,25 +3012,25 @@ Execution Error: ${t.executionError}
3009
3012
  Failed Query:
3010
3013
  ${t.failedGraphQuery}` : e;
3011
3014
  }
3012
- async function jn(e, t, r, a) {
3013
- const { graphQuery: o, explanation: n } = await ye(e, t, r, a);
3015
+ async function Pn(e, t, r, a) {
3016
+ const { graphQuery: o, explanation: n } = await ge(e, t, r, a);
3014
3017
  return `Generated Graph Query:
3015
3018
  ${o}
3016
3019
 
3017
3020
  Explanation: ${n}`;
3018
3021
  }
3019
- async function ye(e, t, r, a, o) {
3022
+ async function ge(e, t, r, a, o) {
3020
3023
  const n = {
3021
- message: Dn(e, o),
3022
- context: new Nn(t)
3024
+ message: jn(e, o),
3025
+ context: new An(t)
3023
3026
  };
3024
3027
  J.conversationId && (n.conversationId = J.conversationId), await m({ text: "Attempting to generate a cypher query from your prompt..." }, a);
3025
- const s = await Se(`${r}/chat`, {
3028
+ const s = await ve(`${r}/chat`, {
3026
3029
  method: "post",
3027
3030
  body: JSON.stringify(n),
3028
3031
  headers: {
3029
3032
  "Content-Type": "application/json",
3030
- token: ve.findCredential(_.getDefault().url)?.token ?? ""
3033
+ token: xe.findCredential(_.getDefault().url)?.token ?? ""
3031
3034
  }
3032
3035
  });
3033
3036
  if (s.httpStatus !== 200)
@@ -3043,7 +3046,7 @@ async function ye(e, t, r, a, o) {
3043
3046
  { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, h)}` },
3044
3047
  a
3045
3048
  ), h = h % 3 + 1;
3046
- const g = await Se(`${r}/chat`, {
3049
+ const g = await ve(`${r}/chat`, {
3047
3050
  method: "post",
3048
3051
  body: JSON.stringify({
3049
3052
  conversationId: s.data.conversationId,
@@ -3052,7 +3055,7 @@ async function ye(e, t, r, a, o) {
3052
3055
  }),
3053
3056
  headers: {
3054
3057
  "Content-Type": "application/json",
3055
- token: ve.findCredential(_.getDefault().url)?.token ?? ""
3058
+ token: xe.findCredential(_.getDefault().url)?.token ?? ""
3056
3059
  }
3057
3060
  });
3058
3061
  if (g.httpStatus !== 200)
@@ -3078,10 +3081,10 @@ function et(e, t = 100) {
3078
3081
  }
3079
3082
  return e.properties = r, e;
3080
3083
  }
3081
- function ge(e) {
3084
+ function fe(e) {
3082
3085
  return typeof e != "object" || e === null ? String(e) : "details" in e && typeof e.details == "object" && e.details !== null && "errorMessage" in e.details && typeof e.details.errorMessage == "string" ? e.details.errorMessage : "message" in e && typeof e.message == "string" ? e.message : String(e);
3083
3086
  }
3084
- const Pn = async ({
3087
+ const Gn = async ({
3085
3088
  kg: e,
3086
3089
  queryParams: t,
3087
3090
  targetStructure: r,
@@ -3096,7 +3099,7 @@ const Pn = async ({
3096
3099
  };
3097
3100
  u && (u.aborted ? d.abort(u.reason) : u.addEventListener("abort", p, { once: !0 }));
3098
3101
  try {
3099
- const h = await _t(e, t, o);
3102
+ const h = await Dt(e, t, o);
3100
3103
  i = h.resultHeader;
3101
3104
  const g = h.resultRowsStream.getReader();
3102
3105
  let w = 0;
@@ -3114,7 +3117,7 @@ const Pn = async ({
3114
3117
  }
3115
3118
  }
3116
3119
  } catch (h) {
3117
- return d.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: ge(h), error: h };
3120
+ return d.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: fe(h), error: h };
3118
3121
  } finally {
3119
3122
  u?.removeEventListener("abort", p);
3120
3123
  }
@@ -3135,11 +3138,11 @@ async function tt({
3135
3138
  for (let u = 1; u <= z; u++) {
3136
3139
  let p;
3137
3140
  try {
3138
- p = await ye(e, t.dataModel, r, c, d);
3141
+ p = await ge(e, t.dataModel, r, c, d);
3139
3142
  } catch (w) {
3140
3143
  return {
3141
3144
  type: "generation-error",
3142
- errorMessage: ge(w),
3145
+ errorMessage: fe(w),
3143
3146
  error: w
3144
3147
  };
3145
3148
  }
@@ -3149,7 +3152,7 @@ async function tt({
3149
3152
  },
3150
3153
  c
3151
3154
  );
3152
- const h = await Pn({
3155
+ const h = await Gn({
3153
3156
  kg: t,
3154
3157
  queryParams: new _e({
3155
3158
  openCypherQuery: p.graphQuery
@@ -3202,7 +3205,7 @@ async function tt({
3202
3205
  `Failed to execute generated cypher due to an unexpected error after ${z} attempts.`
3203
3206
  );
3204
3207
  }
3205
- const Gn = async ({
3208
+ const On = async ({
3206
3209
  kg: e,
3207
3210
  searchQuery: t,
3208
3211
  typeCategoryFilter: r,
@@ -3219,9 +3222,9 @@ const Gn = async ({
3219
3222
  const u = c - s.length;
3220
3223
  if (u <= 0)
3221
3224
  break;
3222
- const g = (await Dt(
3225
+ const g = (await jt(
3223
3226
  e,
3224
- new jt({
3227
+ new Pt({
3225
3228
  searchQuery: t,
3226
3229
  typeCategoryFilter: d,
3227
3230
  namedTypesFilter: a ?? void 0,
@@ -3244,46 +3247,46 @@ const Gn = async ({
3244
3247
  } catch (d) {
3245
3248
  return console.log('Error when running graph search with query: "', t, '" - error: ', d), n?.signal?.aborted ? {
3246
3249
  type: "aborted"
3247
- } : { type: "error", errorMessage: ge(d), error: d };
3250
+ } : { type: "error", errorMessage: fe(d), error: d };
3248
3251
  }
3249
3252
  return {
3250
3253
  type: "success",
3251
3254
  results: s
3252
3255
  };
3253
3256
  };
3254
- function On(e, t) {
3255
- j(e, (r) => {
3257
+ function Vn(e, t) {
3258
+ P(e, (r) => {
3256
3259
  t.set(`${r.typeName}__${r.id}`, {
3257
3260
  id: r.id,
3258
3261
  typeName: r.typeName
3259
3262
  });
3260
3263
  });
3261
3264
  }
3262
- function j(e, t) {
3265
+ function P(e, t) {
3263
3266
  if (!(!e || typeof e != "object")) {
3264
- if (Qn(e))
3267
+ if (Kn(e))
3265
3268
  for (const r of e.path)
3266
- j(r, t);
3267
- else if (Vn(e))
3269
+ P(r, t);
3270
+ else if (Qn(e))
3268
3271
  t(e);
3269
3272
  else if (Array.isArray(e))
3270
3273
  for (const r of e)
3271
- j(r, t);
3272
- else if (Kn(e))
3274
+ P(r, t);
3275
+ else if (Wn(e))
3273
3276
  for (const r of Object.values(e.properties ?? {}))
3274
- j(r, t);
3277
+ P(r, t);
3275
3278
  }
3276
3279
  }
3277
- function Vn(e) {
3280
+ function Qn(e) {
3278
3281
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
3279
3282
  }
3280
- function Qn(e) {
3283
+ function Kn(e) {
3281
3284
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
3282
3285
  }
3283
- function Kn(e) {
3286
+ function Wn(e) {
3284
3287
  return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
3285
3288
  }
3286
- function Wn(e, t) {
3289
+ function Un(e, t) {
3287
3290
  const r = [];
3288
3291
  for (const a of [...t.dataModel.entityTypes, ...t.dataModel.relationshipTypes]) {
3289
3292
  const o = e.getMemberIdsByType(a.name);
@@ -3292,7 +3295,7 @@ function Wn(e, t) {
3292
3295
  }
3293
3296
  return r;
3294
3297
  }
3295
- function Un(e) {
3298
+ function Bn(e) {
3296
3299
  const t = [], r = [], o = e?.allLayers.find((n) => n.type === "knowledge-graph")?.inclusionModeDefinition;
3297
3300
  if (o?.generateAllSublayers)
3298
3301
  return { allNamedTypesFullyDynamic: !0, idTypePairs: t, dynamicTypes: r };
@@ -3304,7 +3307,7 @@ function Un(e) {
3304
3307
  t.push({ id: i, typeName: n });
3305
3308
  return { allNamedTypesFullyDynamic: !1, idTypePairs: t, dynamicTypes: r };
3306
3309
  }
3307
- async function Bn(e, t, r, a, o) {
3310
+ async function Hn(e, t, r, a, o) {
3308
3311
  const { view: n } = a, s = await tt({
3309
3312
  prompt: e,
3310
3313
  kg: t,
@@ -3312,7 +3315,7 @@ async function Bn(e, t, r, a, o) {
3312
3315
  targetStructure: /* @__PURE__ */ new Map(),
3313
3316
  targetStructureReducer: (p, h) => {
3314
3317
  for (const g of h)
3315
- On(g, p);
3318
+ Vn(g, p);
3316
3319
  return p;
3317
3320
  },
3318
3321
  requestOptions: {
@@ -3326,32 +3329,28 @@ async function Bn(e, t, r, a, o) {
3326
3329
  throw new Error(`Failed to add records to the link chart. ${p}`);
3327
3330
  }
3328
3331
  const { graphQuery: i, explanation: c, processedResult: d } = s, u = Array.from(d.values());
3329
- if (await m(
3332
+ return await m(
3330
3333
  {
3331
3334
  text: `Query Results parsed into ${u.length} unique relationships and entities. Atempting to add to link chart...`
3332
3335
  },
3333
3336
  o
3334
- ), !O(n) && n?.map) {
3335
- const p = n.map;
3336
- return await p.addRecords(u), n.goTo(p.diagramNodesExtent ?? new Le()), `Link Chart updated successfully. Cypher Query used:
3337
+ ), !D(n) && n?.map ? (await n.map.addRecords(u), await re(n), `Link Chart updated successfully. Cypher Query used:
3337
3338
  ${i}
3338
3339
 
3339
- Explanation: ${c}`;
3340
- } else
3341
- return await n?.map?.allLayers.find(
3342
- (h) => h.type === "knowledge-graph"
3343
- )?.addRecords(u), `Map updated successfully. Cypher Query used:
3340
+ Explanation: ${c}`) : (await n?.map?.allLayers.find(
3341
+ (h) => h.type === "knowledge-graph"
3342
+ )?.addRecords(u), `Map updated successfully. Cypher Query used:
3344
3343
  ${i}
3345
3344
 
3346
- Explanation: ${c}`;
3345
+ Explanation: ${c}`);
3347
3346
  }
3348
- const rt = "addRecords", Hn = l.object({
3347
+ const rt = "addRecords", Zn = l.object({
3349
3348
  prompt: l.string().describe("The user's inquiry into the knowledge graph that needs to be run.")
3350
- }), Zn = async ({ prompt: e }, t) => {
3351
- const { knowledgeGraph: r } = await V(t), a = re(t), { view: o } = a, s = _.getDefault().helperServices;
3349
+ }), Jn = async ({ prompt: e }, t) => {
3350
+ const { knowledgeGraph: r } = await V(t), a = ae(t), { view: o } = a, s = _.getDefault().helperServices;
3352
3351
  let i = e;
3353
- if (O(o)) {
3354
- const d = o.map, { allNamedTypesFullyDynamic: u, idTypePairs: p, dynamicTypes: h } = Un(d), g = await R("arcgis_knowledge_current_map_context");
3352
+ if (D(o)) {
3353
+ const d = o.map, { allNamedTypesFullyDynamic: u, idTypePairs: p, dynamicTypes: h } = Bn(d), g = await R("arcgis_knowledge_current_map_context");
3355
3354
  if (i = `${e}
3356
3355
 
3357
3356
  ${g}${JSON.stringify(p)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(h)}`, u)
@@ -3359,12 +3358,12 @@ ${g}${JSON.stringify(p)} and all entities or relationships with the the followin
3359
3358
  "No records have been added to the map because all data in the knowledge graph is contained in the map."
3360
3359
  );
3361
3360
  } else {
3362
- const d = o.map, u = await R("arcgis_knowledge_current_lc_context"), p = Wn(d, r);
3361
+ const d = o.map, u = await R("arcgis_knowledge_current_lc_context"), p = Un(d, r);
3363
3362
  i = `${e}
3364
3363
 
3365
3364
  ${u}${JSON.stringify(p)}`;
3366
3365
  }
3367
- const c = await Bn(
3366
+ const c = await Hn(
3368
3367
  i,
3369
3368
  r,
3370
3369
  `${s.aiAssistantServices.url}${s.aiAssistantServices.graphQueryAssistant}`,
@@ -3376,15 +3375,15 @@ ${u}${JSON.stringify(p)}`;
3376
3375
  status: "success",
3377
3376
  summary: c
3378
3377
  };
3379
- }, Jn = b(Zn, {
3378
+ }, Yn = b(Jn, {
3380
3379
  name: rt,
3381
3380
  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.",
3382
- schema: Hn
3381
+ schema: Zn
3383
3382
  });
3384
- async function Yn(e, t) {
3385
- return await t.map?.applyLayout(e), `Successfully applied layout: ${e}.`;
3383
+ async function Xn(e, t) {
3384
+ return await t.map?.applyLayout(e), await re(t), `Successfully applied layout: ${e}.`;
3386
3385
  }
3387
- const ie = "applyLayout", Xn = l.object({
3386
+ const le = "applyLayout", es = l.object({
3388
3387
  layout: l.enum([
3389
3388
  "organic-standard",
3390
3389
  "organic-community",
@@ -3398,59 +3397,59 @@ const ie = "applyLayout", Xn = l.object({
3398
3397
  ]).describe(
3399
3398
  "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"
3400
3399
  )
3401
- }), es = async ({ layout: e }, t) => {
3402
- const { view: r } = re(t);
3403
- if (O(r))
3400
+ }), ts = async ({ layout: e }, t) => {
3401
+ const { view: r } = ae(t);
3402
+ if (D(r))
3404
3403
  return {
3405
- toolName: ie,
3404
+ toolName: le,
3406
3405
  status: "error",
3407
3406
  errorMessage: "The applyLayout tool can only be used with a LinkChartView.",
3408
3407
  error: new Error()
3409
3408
  };
3410
3409
  {
3411
- const a = await Yn(e, r);
3410
+ const a = await Xn(e, r);
3412
3411
  return {
3413
- toolName: ie,
3412
+ toolName: le,
3414
3413
  status: "success",
3415
3414
  summary: a
3416
3415
  };
3417
3416
  }
3418
- }, ts = b(es, {
3419
- name: ie,
3417
+ }, rs = b(ts, {
3418
+ name: le,
3420
3419
  description: "Apply a diagram layout to the link chart",
3421
- schema: Xn
3420
+ schema: es
3422
3421
  });
3423
- function rs(e, t) {
3424
- return t.map?.changeNonspatialDataDisplay(e), `Successfully applied nonspatial visibility setting: ${e}.`;
3422
+ async function as(e, t) {
3423
+ return t.map?.changeNonspatialDataDisplay(e), await re(t), `Successfully applied nonspatial visibility setting: ${e}.`;
3425
3424
  }
3426
- const le = "changeNonspatialVisibility", as = l.object({
3425
+ const ce = "changeNonspatialVisibility", os = l.object({
3427
3426
  setting: l.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
3428
- }), os = async ({ setting: e }, t) => {
3429
- const { view: r } = re(t);
3430
- if (O(r))
3427
+ }), ns = async ({ setting: e }, t) => {
3428
+ const { view: r } = ae(t);
3429
+ if (D(r))
3431
3430
  return {
3432
- toolName: le,
3431
+ toolName: ce,
3433
3432
  status: "error",
3434
3433
  errorMessage: "The changeNonspatialVisibility tool can only be used with a LinkChartView.",
3435
3434
  error: new Error()
3436
3435
  };
3437
3436
  {
3438
- const a = rs(e, r);
3437
+ const a = await as(e, r);
3439
3438
  return {
3440
- toolName: le,
3439
+ toolName: ce,
3441
3440
  status: "success",
3442
3441
  summary: a
3443
3442
  };
3444
3443
  }
3445
- }, ns = b(os, {
3446
- name: le,
3444
+ }, ss = b(ns, {
3445
+ name: ce,
3447
3446
  description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
3448
- schema: as
3447
+ schema: os
3449
3448
  });
3450
- async function ss(e, t, r, a, o) {
3449
+ async function is(e, t, r, a, o) {
3451
3450
  let n;
3452
3451
  for (let s = 1; s <= z; s++) {
3453
- const { graphQuery: i, explanation: c } = await ye(
3452
+ const { graphQuery: i, explanation: c } = await ge(
3454
3453
  e,
3455
3454
  t.dataModel,
3456
3455
  r,
@@ -3459,13 +3458,13 @@ async function ss(e, t, r, a, o) {
3459
3458
  );
3460
3459
  try {
3461
3460
  await m({ text: `Attempting to create link chart from derived query: ${i}` }, o);
3462
- const d = await Pt.fromCypherQuery(
3461
+ const d = await Gt.fromCypherQuery(
3463
3462
  t,
3464
3463
  new _e({
3465
3464
  openCypherQuery: i
3466
3465
  })
3467
3466
  );
3468
- return await m({ text: "Link chart created successfully, loading..." }, o), a.map = d, await d.load(), await a.when(), `Link chart created successfully. Cypher Query used to create the link chart:
3467
+ return await m({ text: "Link chart created successfully, loading..." }, o), a.map = d, await d.load(), await a.when(), await re(a), `Link chart created successfully. Cypher Query used to create the link chart:
3469
3468
  ${i}
3470
3469
 
3471
3470
  Explanation: ${c}`;
@@ -3486,21 +3485,21 @@ Explanation: ${c}`;
3486
3485
  }
3487
3486
  throw new Error(`Failed to create link chart after ${z} attempts.`);
3488
3487
  }
3489
- const ce = "createLinkChart", is = l.object({
3488
+ const de = "createLinkChart", ls = l.object({
3490
3489
  prompt: l.string().describe(
3491
3490
  "The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization."
3492
3491
  )
3493
- }), ls = async ({ prompt: e }, t) => {
3494
- const { knowledgeGraph: r } = await V(t), { view: a } = re(t);
3495
- if (O(a))
3492
+ }), cs = async ({ prompt: e }, t) => {
3493
+ const { knowledgeGraph: r } = await V(t), { view: a } = ae(t);
3494
+ if (D(a))
3496
3495
  return {
3497
- toolName: ce,
3496
+ toolName: de,
3498
3497
  status: "error",
3499
3498
  errorMessage: "The createLinkChart tool can only be used with a LinkChartView.",
3500
3499
  error: new Error()
3501
3500
  };
3502
3501
  {
3503
- const n = _.getDefault().helperServices, s = await ss(
3502
+ const n = _.getDefault().helperServices, s = await is(
3504
3503
  e,
3505
3504
  r,
3506
3505
  `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
@@ -3508,16 +3507,16 @@ const ce = "createLinkChart", is = l.object({
3508
3507
  t
3509
3508
  );
3510
3509
  return {
3511
- toolName: ce,
3510
+ toolName: de,
3512
3511
  status: "success",
3513
3512
  summary: s
3514
3513
  };
3515
3514
  }
3516
- }, cs = b(ls, {
3517
- name: ce,
3515
+ }, ds = b(cs, {
3516
+ name: de,
3518
3517
  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.",
3519
- schema: is
3520
- }), at = "queryGraphData", ds = l.object({
3518
+ schema: ls
3519
+ }), at = "queryGraphData", us = l.object({
3521
3520
  prompt: l.string().describe(
3522
3521
  `The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. IMPORTANT:
3523
3522
 
@@ -3525,7 +3524,7 @@ REQUEST LIMIT: If the user does not specifically request for no limits or an exp
3525
3524
 
3526
3525
  DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for specific column names in the result, ensure that the generated query has descriptive column names (using AS statements) to make the results easier to understand when displayed in a table format.`
3527
3526
  )
3528
- }), us = async ({ prompt: e }, t) => {
3527
+ }), ps = async ({ prompt: e }, t) => {
3529
3528
  const { knowledgeGraph: r } = await V(t), o = _.getDefault().helperServices, n = await tt({
3530
3529
  prompt: e,
3531
3530
  kg: r,
@@ -3545,7 +3544,7 @@ DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for s
3545
3544
  const { graphQuery: s, processedResult: i, resultHeader: c } = n, d = c.headerKeys;
3546
3545
  for (const h of i)
3547
3546
  for (const g of h)
3548
- j(
3547
+ P(
3549
3548
  g,
3550
3549
  (w) => et(w)
3551
3550
  );
@@ -3577,14 +3576,14 @@ ${p.length > u ? `Showing top ${u} results:
3577
3576
  queryResults: i
3578
3577
  }
3579
3578
  };
3580
- }, ps = b(us, {
3579
+ }, hs = b(ps, {
3581
3580
  name: at,
3582
3581
  description: "Allows users to explore the data in their knowledge graph via cypher query. Generates and executes a cypher query based on the user's inquiry into the knowledge graph, and displays the results in the chat pane without modifying the user's link chart if any. Use this tool when the user is asking an exploratory question about their data as a whole that can be answered via cypher query, for example 'What are the top 5 suppliers by total parts cost?' or 'How many employees do we have in each department?'.",
3583
- schema: ds
3584
- }), ot = "generateCypher", hs = l.object({
3582
+ schema: us
3583
+ }), ot = "generateCypher", ms = l.object({
3585
3584
  prompt: l.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
3586
- }), ms = async ({ prompt: e }, t) => {
3587
- const { knowledgeGraph: r } = await V(t), o = _.getDefault().helperServices, n = await jn(
3585
+ }), ys = async ({ prompt: e }, t) => {
3586
+ const { knowledgeGraph: r } = await V(t), o = _.getDefault().helperServices, n = await Pn(
3588
3587
  e,
3589
3588
  r.dataModel,
3590
3589
  `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
@@ -3595,11 +3594,11 @@ ${p.length > u ? `Showing top ${u} results:
3595
3594
  status: "success",
3596
3595
  summary: n
3597
3596
  };
3598
- }, ys = b(ms, {
3597
+ }, gs = b(ys, {
3599
3598
  name: ot,
3600
3599
  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.",
3601
- schema: hs
3602
- }), gs = (e) => {
3600
+ schema: ms
3601
+ }), fs = (e) => {
3603
3602
  const t = e.dataModel, r = /* @__PURE__ */ new Map();
3604
3603
  for (const i of t.searchIndexes)
3605
3604
  if (i.supportedCategory !== "esriTypeMetaEntityProvenance")
@@ -3616,10 +3615,10 @@ ${o.map(({ name: i }) => `${i}: [${Array.from(r.get(i) ?? []).join(", ")}]`).joi
3616
3615
 
3617
3616
  ${s}`;
3618
3617
  };
3619
- async function fs(e, t) {
3618
+ async function ws(e, t) {
3620
3619
  const r = await R("arcgis_knowledge_lucene_generation_prompt"), a = {
3621
3620
  inquiry: e,
3622
- dataModelForSearch: gs(t)
3621
+ dataModelForSearch: fs(t)
3623
3622
  }, o = l.enum(["entity", "relationship", "both"]).describe("The graph element category to search against - entity, relationship, or both"), n = l.number().int().positive().nullable().describe(
3624
3623
  "The maximum number of search results to return. Default to 10 if not specified by the user, or set to null if the user specifically requests no limits or all results."
3625
3624
  ), s = l.array(
@@ -3634,22 +3633,22 @@ async function fs(e, t) {
3634
3633
  typeCategoryFilter: o,
3635
3634
  resultLimit: n
3636
3635
  });
3637
- return await Fe({
3636
+ return await qe({
3638
3637
  promptText: r,
3639
3638
  inputVariables: a,
3640
3639
  schema: i
3641
3640
  });
3642
3641
  }
3643
- const nt = "searchGraphData", ws = l.object({
3642
+ const nt = "searchGraphData", bs = l.object({
3644
3643
  prompt: l.string().describe(
3645
3644
  "The user's inquiry into the knowledge graph, from which a lucene search query will be generated and executed against the graph to return relevant results."
3646
3645
  )
3647
- }), bs = async ({ prompt: e }, t) => {
3646
+ }), Ss = async ({ prompt: e }, t) => {
3648
3647
  const { knowledgeGraph: r } = await V(t);
3649
3648
  await m({ text: "Generating search query for the user inquiry" }, t);
3650
- const a = await fs(e, r);
3649
+ const a = await ws(e, r);
3651
3650
  await m({ text: "Executing graph search with generated search query" }, t);
3652
- const o = await Gn({
3651
+ const o = await On({
3653
3652
  kg: r,
3654
3653
  searchQuery: a.query,
3655
3654
  typeCategoryFilter: a.typeCategoryFilter,
@@ -3665,7 +3664,7 @@ const nt = "searchGraphData", ws = l.object({
3665
3664
  `Graph search failed with error: ${o.type === "error" ? o.errorMessage : "aborted"}`
3666
3665
  );
3667
3666
  for (const i of o.results)
3668
- j(
3667
+ P(
3669
3668
  i,
3670
3669
  (c) => et(c)
3671
3670
  );
@@ -3692,26 +3691,26 @@ const nt = "searchGraphData", ws = l.object({
3692
3691
  }
3693
3692
  }
3694
3693
  };
3695
- }, Ss = b(bs, {
3694
+ }, vs = b(Ss, {
3696
3695
  name: nt,
3697
3696
  description: "Allows users to search the knowledge graph for text matching their inquiry, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.",
3698
- schema: ws
3697
+ schema: bs
3699
3698
  }), st = [
3700
- ts,
3701
- ns,
3702
- ys,
3703
- cs,
3704
- Jn,
3705
- Ss,
3706
- ps
3699
+ rs,
3700
+ ss,
3701
+ gs,
3702
+ ds,
3703
+ Yn,
3704
+ vs,
3705
+ hs
3707
3706
  ];
3708
- async function vs(e, t) {
3709
- const r = await R("arcgis_knowledge_tool_prompt"), a = In(t), o = {
3707
+ async function xs(e, t) {
3708
+ const r = await R("arcgis_knowledge_tool_prompt"), a = Nn(t), o = {
3710
3709
  assignedTask: e.agentExecutionContext.assignedTask,
3711
3710
  userRequest: e.agentExecutionContext.userRequest,
3712
3711
  priorSteps: e.agentExecutionContext.priorSteps,
3713
3712
  contextType: a
3714
- }, n = await P({
3713
+ }, n = await G({
3715
3714
  promptText: r,
3716
3715
  messages: e.arcgisKnowledgeMessages,
3717
3716
  inputVariables: o,
@@ -3730,8 +3729,8 @@ async function vs(e, t) {
3730
3729
  summary: d ? N(d) : "ArcGIS Knowledge Agent tool executed."
3731
3730
  };
3732
3731
  }
3733
- async function xs(e, t) {
3734
- const r = new G(st);
3732
+ async function Ts(e, t) {
3733
+ const r = new O(st);
3735
3734
  try {
3736
3735
  const a = await r.invoke(
3737
3736
  {
@@ -3781,21 +3780,21 @@ async function xs(e, t) {
3781
3780
  };
3782
3781
  }
3783
3782
  }
3784
- const Ts = (e, t) => (
3783
+ const Es = (e, t) => (
3785
3784
  //agent services (ex: embeddingsWorker) would go in the array below, if required.
3786
3785
  H([], "ArcgisKnowledge Agent")(e, t)
3787
3786
  );
3788
- async function Es(e, t) {
3787
+ async function Rs(e, t) {
3789
3788
  const a = (e.arcgisKnowledgeToolResult ?? []).map((d) => ({
3790
3789
  ...d,
3791
3790
  details: void 0
3792
3791
  // Remove details to avoid overwhelming the LLM with too much info
3793
- })), { knowledgeGraph: o } = await V(t), n = ae.getDataModelTypesSummary(o.dataModel), s = {
3792
+ })), { knowledgeGraph: o } = await V(t), n = oe.getDataModelTypesSummary(o.dataModel), s = {
3794
3793
  assignedTask: e.agentExecutionContext.assignedTask,
3795
3794
  userRequest: e.agentExecutionContext.userRequest,
3796
3795
  toolResult: a,
3797
3796
  dataModelSummary: n
3798
- }, i = await qe({
3797
+ }, i = await Le({
3799
3798
  promptText: await R("arcgis_knowledge_summarize_result_prompt"),
3800
3799
  modelTier: "default",
3801
3800
  inputVariables: s
@@ -3808,7 +3807,7 @@ async function Es(e, t) {
3808
3807
  arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, new ze(c)]
3809
3808
  };
3810
3809
  }
3811
- const Rs = () => new U(Ye).addNode("requireArcgisKnowledgeServices", Ts).addNode("agent", vs).addNode("tools", xs).addNode("summarizationLLM", Es).addEdge(B, "requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices", "agent").addConditionalEdges("agent", (t) => (t.arcgisKnowledgeMessages[t.arcgisKnowledgeMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : C).addConditionalEdges("tools", (t) => t.status === "failed" ? C : "summarizationLLM").addEdge("summarizationLLM", C), $s = 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).
3810
+ const $s = () => new U(Ye).addNode("requireArcgisKnowledgeServices", Es).addNode("agent", xs).addNode("tools", Ts).addNode("summarizationLLM", Rs).addEdge(B, "requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices", "agent").addConditionalEdges("agent", (t) => (t.arcgisKnowledgeMessages[t.arcgisKnowledgeMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : C).addConditionalEdges("tools", (t) => t.status === "failed" ? C : "summarizationLLM").addEdge("summarizationLLM", C), Cs = 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).
3812
3811
  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.
3813
3812
  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,
3814
3813
  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
@@ -3846,17 +3845,17 @@ _example: "Discover and add all the relationships originating at 'Entity E' to t
3846
3845
  _example: "Show me all entities with a name similar to 'Smith' and add them to the link chart"_
3847
3846
  _example: "Find reports in my graph that have a title similar to 'Quarterly Earnings'"_
3848
3847
  _example: "Find John Smith and all people he has made phone calls to in the last year"_
3849
- _example: "What is the average age of all people who work for Esri?"_`, Si = {
3848
+ _example: "What is the average age of all people who work for Esri?"_`, vi = {
3850
3849
  id: "arcgisKnowledge",
3851
3850
  name: "ArcgisKnowledge Agent",
3852
- description: $s,
3853
- createGraph: Rs,
3851
+ description: Cs,
3852
+ createGraph: $s,
3854
3853
  workspace: Ye
3855
3854
  };
3856
3855
  export {
3857
- Si as ArcgisKnowledgeAgent,
3858
- wi as DataExplorationAgent,
3859
- bi as HelpAgent,
3860
- Ce as LayerStylingAgent,
3861
- fi as NavigationAgent
3856
+ vi as ArcgisKnowledgeAgent,
3857
+ bi as DataExplorationAgent,
3858
+ Si as HelpAgent,
3859
+ ke as LayerStylingAgent,
3860
+ wi as NavigationAgent
3862
3861
  };