@arcgis/ai-agents 5.1.0-next.91 → 5.1.0-next.92

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,10 +1,10 @@
1
1
  import { Annotation as y, StateGraph as V, START as K, END as q, messagesStateReducer as Re, NodeInterrupt as Xe } from "@langchain/langgraph/web";
2
- import { invokeToolPrompt as j, sendTraceMessage as g, invokeStructuredPrompt as Ce, invokeTextPrompt as et, sendUXSuggestion as C } from "@arcgis/ai-orchestrator";
3
- import { tool as w } from "@langchain/core/tools";
2
+ import { invokeToolPrompt as j, sendTraceMessage as m, invokeStructuredPrompt as Ce, invokeTextPrompt as et, sendUXSuggestion as C } from "@arcgis/ai-orchestrator";
3
+ import { tool as b } from "@langchain/core/tools";
4
4
  import tt from "@arcgis/core/Graphic.js";
5
5
  import rt from "@arcgis/core/symbols/PictureMarkerSymbol.js";
6
6
  import { addressToLocations as at } from "@arcgis/core/rest/locator.js";
7
- import M from "@arcgis/core/portal/Portal.js";
7
+ import z from "@arcgis/core/portal/Portal.js";
8
8
  import ae from "@arcgis/core/config.js";
9
9
  import l, { z as A } from "zod";
10
10
  import ot from "@arcgis/core/geometry/Extent.js";
@@ -107,7 +107,7 @@ ${r}`;
107
107
  })
108
108
  });
109
109
  async function At(e, t) {
110
- const a = M.getDefault().helperServices, o = a.geocode.find((p) => p.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
110
+ const a = z.getDefault().helperServices, o = a.geocode.find((p) => p.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
111
111
  if (!o)
112
112
  throw new Error("No geocoding service found in helperServices.");
113
113
  const n = o.url, i = `${ae.assetsPath?.endsWith("/") ? ae.assetsPath : `${ae.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await at(n, {
@@ -147,16 +147,16 @@ function $(e) {
147
147
  throw new Error(`NavigationAgent context missing: ${a.join(", ")}`);
148
148
  return r;
149
149
  }
150
- async function zt({ address: e }, t) {
150
+ async function Mt({ address: e }, t) {
151
151
  const { mapView: r } = $(t);
152
152
  return await At(e, r);
153
153
  }
154
- const Mt = l.object({
154
+ const zt = l.object({
155
155
  address: l.string().describe("The full address or place name to locate.")
156
- }), Dt = w(zt, {
156
+ }), Dt = b(Mt, {
157
157
  name: "goToAddress",
158
158
  description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
159
- schema: Mt
159
+ schema: zt
160
160
  });
161
161
  async function _t(e, t) {
162
162
  const a = t.map.bookmarks;
@@ -176,12 +176,12 @@ async function jt({ bookmarkName: e }, t) {
176
176
  }
177
177
  const Pt = A.object({
178
178
  bookmarkName: A.string().describe("The name of the bookmark to navigate to.")
179
- }), Ot = w(jt, {
179
+ }), Gt = b(jt, {
180
180
  name: "goToBookmark",
181
181
  description: "Go to the extent of the bookmark with the given name.",
182
182
  schema: Pt
183
183
  });
184
- async function Gt(e, t, r) {
184
+ async function Ot(e, t, r) {
185
185
  const a = r.map?.allLayers.find((n) => n.id === e);
186
186
  if (!a)
187
187
  return { text: `Error: Layer with id ${e} not found` };
@@ -202,12 +202,12 @@ async function Gt(e, t, r) {
202
202
  }
203
203
  async function Vt({ layerId: e, where: t }, r) {
204
204
  const { mapView: a } = $(r);
205
- return await Gt(e, t, a);
205
+ return await Ot(e, t, a);
206
206
  }
207
207
  const Kt = A.object({
208
208
  layerId: A.string().describe("The layerId of the layer to zoom to."),
209
209
  where: A.string().describe("The sql-92 where clause used to query features to zoom to")
210
- }), Wt = w(Vt, {
210
+ }), Wt = b(Vt, {
211
211
  name: "goToFeatures",
212
212
  description: "Go to the features that match the given filter related to the given layerId.",
213
213
  schema: Kt
@@ -226,7 +226,7 @@ async function Ut(e, t) {
226
226
  const { mapView: r } = $(t);
227
227
  return await Qt(r);
228
228
  }
229
- const Bt = A.object({}), Ht = w(Ut, {
229
+ const Bt = A.object({}), Ht = b(Ut, {
230
230
  name: "goToFullExtent",
231
231
  description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
232
232
  schema: Bt
@@ -243,7 +243,7 @@ async function Jt(e, t) {
243
243
  const { mapView: r } = $(t);
244
244
  return await Zt(r);
245
245
  }
246
- const Yt = l.object({}), Xt = w(Jt, {
246
+ const Yt = l.object({}), Xt = b(Jt, {
247
247
  name: "goToHomeExtent",
248
248
  description: "Go to the initial web map view extent",
249
249
  schema: Yt
@@ -262,7 +262,7 @@ async function tr({ layerId: e }, t) {
262
262
  }
263
263
  const rr = A.object({
264
264
  layerId: A.string().describe("The id of the layer to navigate to")
265
- }), ar = w(tr, {
265
+ }), ar = b(tr, {
266
266
  name: "goToLayer",
267
267
  description: "Zooms the map view to the full extent of the top matching layer.",
268
268
  schema: rr
@@ -276,7 +276,7 @@ async function nr({ scale: e }, t) {
276
276
  }
277
277
  const sr = l.object({
278
278
  scale: l.number().describe("The map scale of the view to go to.")
279
- }), ir = w(nr, {
279
+ }), ir = b(nr, {
280
280
  name: "goToScale",
281
281
  description: "Go to the specified view scale.",
282
282
  schema: sr
@@ -310,7 +310,7 @@ const dr = l.object({
310
310
  }),
311
311
  zoom: l.number().optional().describe("The zoom level. Higher values = more zoomed in."),
312
312
  scale: l.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
313
- }), ur = w(cr, {
313
+ }), ur = b(cr, {
314
314
  name: "goToViewpoint",
315
315
  description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
316
316
  schema: dr
@@ -324,13 +324,13 @@ async function hr({ zoom: e }, t) {
324
324
  }
325
325
  const mr = l.object({
326
326
  zoom: l.number().min(1).max(20).describe("The zoom level of the view to go to.")
327
- }), gr = w(hr, {
327
+ }), gr = b(hr, {
328
328
  name: "goToZoom",
329
329
  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.).',
330
330
  schema: mr
331
331
  }), ce = [
332
332
  Dt,
333
- Ot,
333
+ Gt,
334
334
  Wt,
335
335
  Ht,
336
336
  Xt,
@@ -344,7 +344,7 @@ const mr = l.object({
344
344
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md": () => import("./arcgis_knowledge_tool_prompt-459P6qrK.js").then((e) => e.default),
345
345
  "../agents/dataExploration/prompts/data_explore_filter_prompt.md": () => import("./data_explore_filter_prompt-g9GTTJyj.js").then((e) => e.default),
346
346
  "../agents/dataExploration/prompts/data_explore_query_prompt.md": () => import("./data_explore_query_prompt-DqJVadVm.js").then((e) => e.default),
347
- "../agents/dataExploration/prompts/summarize_query_response_prompt.md": () => import("./summarize_query_response_prompt-Dm47OAKf.js").then((e) => e.default),
347
+ "../agents/dataExploration/prompts/summarize_query_response_prompt.md": () => import("./summarize_query_response_prompt-uHW-P2T8.js").then((e) => e.default),
348
348
  "../agents/help/prompts/help_prompt.md": () => import("./help_prompt-CZjpixev.js").then((e) => e.default),
349
349
  "../agents/layerStyling/prompts/layer_styling_prompt.md": () => import("./layer_styling_prompt-ybkb5Jgq.js").then((e) => e.default),
350
350
  "../agents/navigation/prompts/navigation_intent_prompt.md": () => import("./navigation_intent_prompt-BPGHLtha.js").then((e) => e.default),
@@ -360,36 +360,37 @@ ${Object.keys(be).join(`
360
360
  return await t[1]();
361
361
  }
362
362
  async function yr(e, t) {
363
- const r = await F("navigation_tool_prompt"), { mapView: a } = $(t), o = a.map, n = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
364
- (m, b) => `${b + 1}. layerId=${m.id} | title=${m.title ?? ""} | name=${m.name ?? ""} | score=${m.score.toFixed(2)}`
363
+ const r = await F("navigation_tool_prompt"), { mapView: a } = $(t), n = a.map.bookmarks?.map((f) => f.name).filter(Boolean) ?? [], i = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
364
+ (f, x) => `${x + 1}. layerId=${f.id} | title=${f.title ?? ""} | name=${f.name ?? ""} | score=${f.score.toFixed(2)}`
365
365
  ).join(`
366
- `) : "", i = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", s = e.intent === "goToBookmark" && o.bookmarks?.length ? `Available bookmarks:
367
- ${JSON.stringify(o.bookmarks, null, 2)}` : "", c = (e.intent === "goToLayer" || e.intent === "goToFeatures") && e.vectorSearchLayerResults?.length ? `Candidate layers:
368
- ${n}` : "", d = e.intent === "goToFeatures" && e.vectorSearchFieldResults?.length ? `Candidate fields:
369
- ${i}` : "", u = {
366
+ `) : "", s = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", c = e.intent === "goToBookmark" && n.length ? `Available bookmarks:
367
+ ${n.map((f) => `- ${f}`).join(`
368
+ `)}` : "", d = (e.intent === "goToLayer" || e.intent === "goToFeatures") && e.vectorSearchLayerResults?.length ? `Candidate layers:
369
+ ${i}` : "", u = e.intent === "goToFeatures" && e.vectorSearchFieldResults?.length ? `Candidate fields:
370
+ ${s}` : "", p = {
370
371
  intent: e.intent,
371
- bookmarksSection: s,
372
- layersSection: c,
373
- fieldsSection: d,
372
+ bookmarksSection: c,
373
+ layersSection: d,
374
+ fieldsSection: u,
374
375
  currentZoom: a.zoom,
375
376
  assignedTask: e.agentExecutionContext.assignedTask,
376
377
  userRequest: e.agentExecutionContext.userRequest,
377
378
  priorSteps: e.agentExecutionContext.priorSteps
378
- }, p = await j({
379
+ }, h = await j({
379
380
  promptText: r,
380
381
  modelTier: "fast",
381
- inputVariables: u,
382
+ inputVariables: p,
382
383
  tools: ce
383
- }), h = (p.tool_calls?.length ?? 0) > 0, f = typeof p.text == "string" ? p.text.trim() : "", S = f.length > 0;
384
+ }), w = (h.tool_calls?.length ?? 0) > 0, S = typeof h.text == "string" ? h.text.trim() : "", g = S.length > 0;
384
385
  return {
385
386
  ...e,
386
387
  navigationInternalState: {
387
388
  ...e.navigationInternalState,
388
- toolCallMessage: h ? p : void 0
389
+ toolCallMessage: w ? h : void 0
389
390
  },
390
391
  // No tool call => surface fallback text now. Tool call => tool node will set output.
391
- outputMessage: h ? e.outputMessage : f,
392
- status: h ? e.status : S ? "success" : "failed"
392
+ outputMessage: w ? e.outputMessage : S,
393
+ status: w ? e.status : g ? "success" : "failed"
393
394
  };
394
395
  }
395
396
  const D = (e, t = 300) => {
@@ -427,7 +428,7 @@ async function wr(e, t) {
427
428
  ...c.sharedStatePatch
428
429
  });
429
430
  }
430
- return await g({ text: `Finished executing navigation tool: ${n}` }, t), {
431
+ return await m({ text: `Finished executing navigation tool: ${n}` }, t), {
431
432
  ...e,
432
433
  outputMessage: n,
433
434
  sharedStatePatch: i,
@@ -440,7 +441,7 @@ async function wr(e, t) {
440
441
  };
441
442
  } catch (a) {
442
443
  const o = a instanceof Error ? a.message : String(a);
443
- return await g({ text: `Navigation tool execution failed: ${o}` }, t), {
444
+ return await m({ text: `Navigation tool execution failed: ${o}` }, t), {
444
445
  ...e,
445
446
  outputMessage: `Navigation tool execution failed: ${o}`,
446
447
  status: "failed",
@@ -453,27 +454,28 @@ async function wr(e, t) {
453
454
  }
454
455
  }
455
456
  async function br(e, t) {
456
- const r = await F("navigation_intent_prompt"), { mapView: a } = $(t), o = ce.map((p) => ({
457
- name: p.name,
458
- description: p.description,
459
- schema: p.schema
460
- })), n = a.map, i = n.bookmarks?.length ? `Available bookmarks:
461
- ${JSON.stringify(n.bookmarks, null, 2)}` : "", s = {
462
- tools: o.map(({ name: p, description: h, schema: f }) => `${p}: ${h}, ${JSON.stringify(f)}`).join(`
457
+ const r = await F("navigation_intent_prompt"), { mapView: a } = $(t), o = ce.map((h) => ({
458
+ name: h.name,
459
+ description: h.description,
460
+ schema: h.schema
461
+ })), i = a.map.bookmarks?.map((h) => h.name).filter(Boolean) ?? [], s = i.length ? `Available bookmarks:
462
+ ${i.map((h) => `- ${h}`).join(`
463
+ `)}` : "", c = {
464
+ tools: o.map(({ name: h, description: w, schema: S }) => `${h}: ${w}, ${JSON.stringify(S)}`).join(`
463
465
  `),
464
- bookmarks: i,
466
+ bookmarks: s,
465
467
  assignedTask: e.agentExecutionContext.assignedTask,
466
468
  userRequest: e.agentExecutionContext.userRequest,
467
469
  priorSteps: e.agentExecutionContext.priorSteps
468
- }, c = l.object({
470
+ }, d = l.object({
469
471
  intent: l.string()
470
- }), d = await Ce({
472
+ }), u = await Ce({
471
473
  promptText: r,
472
- inputVariables: s,
473
- schema: c,
474
+ inputVariables: c,
475
+ schema: d,
474
476
  modelTier: "fast"
475
- }), u = typeof d.intent == "string" ? d.intent.trim().replace(/^"|"$/gu, "") : "";
476
- return { ...e, intent: u || "" };
477
+ }), p = typeof u.intent == "string" ? u.intent.trim().replace(/^"|"$/gu, "") : "";
478
+ return { ...e, intent: p || "" };
477
479
  }
478
480
  const v = (e, t) => {
479
481
  const a = e?.configurable?.services?.[t];
@@ -482,7 +484,7 @@ const v = (e, t) => {
482
484
  return a;
483
485
  }, Sr = 0.7, vr = async (e, t) => {
484
486
  try {
485
- await g(
487
+ await m(
486
488
  { text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
487
489
  t
488
490
  );
@@ -502,25 +504,25 @@ const v = (e, t) => {
502
504
  let s;
503
505
  return i.length > 0 ? s = `Vector search completed. Matching layers:
504
506
  ${i.map((c) => `- layerId=${c.id} | title=${c.title ?? ""} | name=${c.name ?? ""} | score=${c.score.toFixed(2)}`).join(`
505
- `)}` : s = "Vector search completed. No matching layers found.", await g({ text: s }, t), {
507
+ `)}` : s = "Vector search completed. No matching layers found.", await m({ text: s }, t), {
506
508
  ...e,
507
509
  vectorSearchLayerResults: i
508
510
  };
509
511
  } catch (r) {
510
- throw await g(
512
+ throw await m(
511
513
  { text: `Error during vector search layers: ${r instanceof Error ? r.message : String(r)}` },
512
514
  t
513
515
  ), r;
514
516
  }
515
517
  }, Se = 0.7, xr = 10, Tr = async (e, t) => {
516
518
  try {
517
- await g(
519
+ await m(
518
520
  { text: `Similarity search to find fields: ${e.agentExecutionContext.assignedTask}` },
519
521
  t
520
522
  );
521
523
  const r = v(t, "fieldSearch"), a = v(t, "layersAndFieldsRegistry"), o = v(t, "embeddingCache"), n = e.vectorSearchLayerResults?.map((d) => d.id) ?? [];
522
524
  if (n.length === 0)
523
- return await g({ text: "No candidate layers for field search" }, t), e;
525
+ return await m({ text: "No candidate layers for field search" }, t), e;
524
526
  const s = (await r.searchFields({
525
527
  text: e.agentExecutionContext.assignedTask,
526
528
  layerIds: n,
@@ -533,14 +535,14 @@ ${i.map((c) => `- layerId=${c.id} | title=${c.title ?? ""} | name=${c.name ?? ""
533
535
  layerId: d,
534
536
  layerName: a.get(d)?.layerItem.name,
535
537
  results: u.map((h) => {
536
- const f = p?.get(h.name);
538
+ const w = p?.get(h.name);
537
539
  return {
538
540
  name: h.name,
539
541
  score: h.score,
540
- type: f?.type,
541
- alias: f?.alias,
542
- description: f?.description,
543
- statistics: f?.statistics
542
+ type: w?.type,
543
+ alias: w?.alias,
544
+ description: w?.description,
545
+ statistics: w?.statistics
544
546
  };
545
547
  })
546
548
  };
@@ -552,12 +554,12 @@ ${s.map(
552
554
  ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
553
555
  `)}`
554
556
  ).join(`
555
- `)}` : c = `No vector search field results found for score over ${Se}.`, await g({ text: c }, t), {
557
+ `)}` : c = `No vector search field results found for score over ${Se}.`, await m({ text: c }, t), {
556
558
  ...e,
557
559
  vectorSearchFieldResults: s
558
560
  };
559
561
  } catch (r) {
560
- throw await g(
562
+ throw await m(
561
563
  { text: `Error during vector search fields: ${r instanceof Error ? r.message : String(r)}` },
562
564
  t
563
565
  ), r;
@@ -639,15 +641,15 @@ ${d.results.map((u) => ` - ${u.name} (${u.score.toFixed(2)})`).join(`
639
641
  reducer: Re,
640
642
  default: () => []
641
643
  })
642
- }), $r = async (e, t) => (await g({ text: "Exiting Data Exploration agent" }, t), e), de = async (e, t) => {
644
+ }), $r = async (e, t) => (await m({ text: "Exiting Data Exploration agent" }, t), e), de = async (e, t) => {
643
645
  const r = e.tool_calls ?? [];
644
646
  if (r.length === 0) {
645
- await g({ text: `LLM did not request any tool calls: ${String(e?.content)}` }, t);
647
+ await m({ text: `LLM did not request any tool calls: ${String(e?.content)}` }, t);
646
648
  return;
647
649
  }
648
650
  await Promise.all(
649
651
  r.map(
650
- async (a) => await g(
652
+ async (a) => await m(
651
653
  { text: `LLM invoked ${a.name} tool with arguments: ${JSON.stringify(a.args, null, 2)}` },
652
654
  t
653
655
  )
@@ -673,7 +675,7 @@ const Ir = (e) => {
673
675
  }, qr = async (e, t) => {
674
676
  const { mapView: r } = N(t);
675
677
  return Ir(r);
676
- }, Fr = w(qr, {
678
+ }, Fr = b(qr, {
677
679
  name: "clearFilters",
678
680
  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.",
679
681
  schema: l.object({})
@@ -687,7 +689,7 @@ const Ir = (e) => {
687
689
  }, Ar = async (e, t) => {
688
690
  const { mapView: r } = N(t);
689
691
  return await Lr(r);
690
- }, Nr = w(Ar, {
692
+ }, Nr = b(Ar, {
691
693
  name: "resetMap",
692
694
  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.",
693
695
  schema: l.object({})
@@ -695,7 +697,7 @@ const Ir = (e) => {
695
697
  function J(e) {
696
698
  return "point" in e && e.point !== void 0;
697
699
  }
698
- function O(e) {
700
+ function G(e) {
699
701
  return "layerId" in e && e.layerId !== void 0;
700
702
  }
701
703
  const X = async (e, t) => {
@@ -707,7 +709,7 @@ const X = async (e, t) => {
707
709
  spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
708
710
  }) };
709
711
  }
710
- if (O(e)) {
712
+ if (G(e)) {
711
713
  const r = t.map?.allLayers.find(
712
714
  (o) => o.id === e.layerId
713
715
  );
@@ -742,7 +744,7 @@ const X = async (e, t) => {
742
744
  }
743
745
  }
744
746
  return { error: "Invalid geometry configuration provided" };
745
- }, zr = async (e, t, r, a, o, n) => {
747
+ }, Mr = async (e, t, r, a, o, n) => {
746
748
  const i = e.map?.allLayers.find((c) => c.id === t);
747
749
  if (!i)
748
750
  return { success: !1, error: `Layer '${t}' not found.` };
@@ -760,7 +762,7 @@ const X = async (e, t) => {
760
762
  error: c instanceof Error ? c.message : String(c)
761
763
  };
762
764
  }
763
- }, Mr = async (e, t, r, a, o, n) => {
765
+ }, zr = async (e, t, r, a, o, n) => {
764
766
  const i = t.map?.allLayers.find(
765
767
  (p) => p.id === e.layerId
766
768
  );
@@ -785,7 +787,7 @@ const X = async (e, t) => {
785
787
  excludedEffect: a
786
788
  }), i.visible = !0, n)
787
789
  return `Applied feature effects to "${i.title ?? e.layerId}" within current map extent.`;
788
- const c = e.objectIds?.length ? `${i.objectIdField} IN (${e.objectIds.join(",")})` : e.where, d = await zr(
790
+ const c = e.objectIds?.length ? `${i.objectIdField} IN (${e.objectIds.join(",")})` : e.where, d = await Mr(
789
791
  t,
790
792
  e.layerId,
791
793
  c,
@@ -794,7 +796,7 @@ const X = async (e, t) => {
794
796
  o?.units
795
797
  ), u = i.title ?? e.layerId;
796
798
  return d.success ? `Applied feature effects to target layer "${i.title ?? e.layerId}"${o && "layerId" in o ? ` using geometry from layer "${o.layerId}"` : ""}.` : `Applied filter to "${u}" but no features matched. ${d.error}`;
797
- }, Dr = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], z = l.enum(Dr), _r = async ({
799
+ }, Dr = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], M = l.enum(Dr), _r = async ({
798
800
  targetLayer: e,
799
801
  geometryFilter: t,
800
802
  useCurrentExtent: r,
@@ -802,12 +804,12 @@ const X = async (e, t) => {
802
804
  excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
803
805
  }, n) => {
804
806
  const { mapView: i } = N(n);
805
- return await Mr(e, i, a, o, t, r);
807
+ return await zr(e, i, a, o, t, r);
806
808
  }, jr = l.object({
807
809
  layerId: l.string().describe("The layerId of the layer containing the geometry by which to filter."),
808
810
  where: l.string().describe("The SQL-92 where clause representing the features from which to filter."),
809
811
  distance: l.number().optional().describe("The buffer distance around the geometry."),
810
- units: z.optional().describe("The units for the distance buffer.")
812
+ units: M.optional().describe("The units for the distance buffer.")
811
813
  }), Pr = l.object({
812
814
  point: l.object({
813
815
  x: l.number().describe("X coordinate (longitude) from navigation result"),
@@ -817,8 +819,8 @@ const X = async (e, t) => {
817
819
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
818
820
  }).describe("Point coordinates from a previous navigation/geocoding result"),
819
821
  distance: l.number().optional().describe("Optional buffer distance around the point."),
820
- units: z.optional().describe("The units for the distance buffer.")
821
- }), Or = l.object({
822
+ units: M.optional().describe("The units for the distance buffer.")
823
+ }), Gr = l.object({
822
824
  targetLayer: l.object({
823
825
  layerId: l.string().describe("The layerId of the layer on which to set a feature effect."),
824
826
  where: l.string().describe("The SQL-92 where clause representing the features to emphasize."),
@@ -836,10 +838,10 @@ const X = async (e, t) => {
836
838
  excludedEffect: l.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
837
839
  "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."
838
840
  )
839
- }), Gr = w(_r, {
841
+ }), Or = b(_r, {
840
842
  name: "setFeatureEffect",
841
843
  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.",
842
- schema: Or
844
+ schema: Gr
843
845
  }), se = (e) => {
844
846
  if (e instanceof Date)
845
847
  return Number.isNaN(e.getTime()) ? null : e;
@@ -918,15 +920,15 @@ const X = async (e, t) => {
918
920
  } catch {
919
921
  return e;
920
922
  }
921
- }, ze = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Me = (e, t, r, a, o) => {
923
+ }, Me = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, ze = (e, t, r, a, o) => {
922
924
  if (r == null)
923
925
  return r;
924
926
  const i = e.getFieldConfiguration?.(t)?.fieldFormat;
925
927
  return i?.type === "number" ? Br(r, i) : i?.type === "date-time" ? Hr(r, i, o) : Wr(r, a, o);
926
928
  }, Zr = (e, t, r, a) => {
927
929
  const o = e.fieldsIndex?.get(t), n = Ne(t, r, e) ?? r;
928
- return Me(e, t, n, o?.type, a);
929
- }, Jr = (e, t) => ze(e, t), De = (e, t, r) => {
930
+ return ze(e, t, n, o?.type, a);
931
+ }, Jr = (e, t) => Me(e, t), De = (e, t, r) => {
930
932
  const a = e.objectIdField, o = t.features.map(
931
933
  (i) => i.attributes[a]
932
934
  ), n = t.features.map((i) => {
@@ -939,8 +941,8 @@ const X = async (e, t) => {
939
941
  c[d.name] = u;
940
942
  return;
941
943
  }
942
- const p = Ne(d.name, u, e) ?? u, h = ze(e, d.name);
943
- c[h] = Me(e, d.name, p, d.type, r);
944
+ const p = Ne(d.name, u, e) ?? u, h = Me(e, d.name);
945
+ c[h] = ze(e, d.name, p, d.type, r);
944
946
  }), c;
945
947
  });
946
948
  return { objectIds: o, attributes: n };
@@ -971,7 +973,7 @@ const ta = l.object({
971
973
  query: l.object({
972
974
  where: l.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
973
975
  })
974
- }), ra = w(ea, {
976
+ }), ra = b(ea, {
975
977
  name: "getAttribute",
976
978
  description: "Returns an attribute value for a given feature.",
977
979
  schema: ta
@@ -987,14 +989,14 @@ const aa = async (e) => {
987
989
  const c = await o.whenLayerView(s), u = n.get(t.layerId)?.fieldRegistry.get(r), p = u?.alias;
988
990
  if (!u)
989
991
  throw new Error(`Field '${r}' not found.`);
990
- let h, f;
992
+ let h, w;
991
993
  if (i) {
992
994
  const T = await X(i, o);
993
995
  if ("error" in T)
994
996
  throw new Error(T.error);
995
997
  if (!T.geometry)
996
- throw O(i) ? new Error(`No features found matching: ${i.where}`) : new Error("Failed to create geometry");
997
- if (O(i)) {
998
+ throw G(i) ? new Error(`No features found matching: ${i.where}`) : new Error("Failed to create geometry");
999
+ if (G(i)) {
998
1000
  const _ = o.map?.allLayers.find((L) => L.id === i.layerId);
999
1001
  h = {
1000
1002
  geometryLayerName: _?.title ?? _?.id,
@@ -1010,7 +1012,7 @@ const aa = async (e) => {
1010
1012
  units: i.units,
1011
1013
  applied: !0
1012
1014
  });
1013
- f = new ke({
1015
+ w = new ke({
1014
1016
  geometry: T.geometry,
1015
1017
  distance: i.distance,
1016
1018
  units: i.units,
@@ -1018,7 +1020,7 @@ const aa = async (e) => {
1018
1020
  });
1019
1021
  }
1020
1022
  const S = ue(c, [r], !1);
1021
- let m = null, b = null;
1023
+ let g = null, f = null;
1022
1024
  const x = 10;
1023
1025
  if (u.type !== "geometry" && u.type !== "oid" && u.type !== "global-id")
1024
1026
  try {
@@ -1028,19 +1030,19 @@ const aa = async (e) => {
1028
1030
  view: S ? o : void 0,
1029
1031
  field: r,
1030
1032
  sqlWhere: Y(s.definitionExpression, t.where),
1031
- ...f && { filter: f },
1033
+ ...w && { filter: w },
1032
1034
  outStatisticTypes: { include: [a] }
1033
1035
  };
1034
- m = await Ie(T);
1036
+ g = await Ie(T);
1035
1037
  const _ = ["string", "small-integer", "integer"], L = u.domain?.type === "coded-value" ? u.domain : null;
1036
- (_.includes(u.type) || L) && (b = (await qe({
1038
+ (_.includes(u.type) || L) && (f = (await qe({
1037
1039
  layer: s,
1038
1040
  useFeaturesInView: S,
1039
1041
  view: S ? o : void 0,
1040
1042
  field: r,
1041
1043
  sqlWhere: Y(s.definitionExpression, t.where),
1042
- ...f && { filter: f }
1043
- })).uniqueValueInfos.sort((R, Ye) => Ye.count - R.count).slice(0, x)), b && u.domain?.type === "coded-value" && (b = b.map((R) => ({
1044
+ ...w && { filter: w }
1045
+ })).uniqueValueInfos.sort((R, Ye) => Ye.count - R.count).slice(0, x)), f && u.domain?.type === "coded-value" && (f = f.map((R) => ({
1044
1046
  ...R,
1045
1047
  value: L ? L.getName(R.value) ?? R.value : R.value
1046
1048
  })));
@@ -1050,14 +1052,14 @@ const aa = async (e) => {
1050
1052
  return {
1051
1053
  tool: "getStatistics",
1052
1054
  layerName: s.title ?? t.layerId,
1053
- summary: `${a} = ${typeof m?.[a] == "number" ? m[a] : "N/A"}`,
1055
+ summary: `${a} = ${typeof g?.[a] == "number" ? g[a] : "N/A"}`,
1054
1056
  details: {
1055
1057
  fieldName: r,
1056
1058
  fieldAlias: p,
1057
1059
  statisticType: a,
1058
- statistic: m?.[a] ?? null,
1059
- summaryStatistics: m,
1060
- uniqueValues: b,
1060
+ statistic: g?.[a] ?? null,
1061
+ summaryStatistics: g,
1062
+ uniqueValues: f,
1061
1063
  where: t.where,
1062
1064
  spatialFilterInfo: h
1063
1065
  }
@@ -1083,7 +1085,7 @@ const na = l.object({
1083
1085
  layerId: l.string().describe("The layerId of the layer containing the geometry by which to filter."),
1084
1086
  where: l.string().describe("The SQL-92 where clause representing the features from which to filter."),
1085
1087
  distance: l.number().optional().describe("The buffer distance around the geometry."),
1086
- units: z.optional().describe("The units for the distance buffer.")
1088
+ units: M.optional().describe("The units for the distance buffer.")
1087
1089
  }), sa = l.object({
1088
1090
  point: l.object({
1089
1091
  x: l.number().describe("X coordinate (longitude) from navigation result"),
@@ -1093,7 +1095,7 @@ const na = l.object({
1093
1095
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1094
1096
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1095
1097
  distance: l.number().optional().describe("Optional buffer distance around the point."),
1096
- units: z.optional().describe("The units for the distance buffer.")
1098
+ units: M.optional().describe("The units for the distance buffer.")
1097
1099
  }), ia = l.object({
1098
1100
  targetLayer: l.object({
1099
1101
  layerId: l.string().describe("The layerId of the layer containing the field from which to get a value."),
@@ -1104,7 +1106,7 @@ const na = l.object({
1104
1106
  ),
1105
1107
  fieldName: l.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
1106
1108
  statisticType: l.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1107
- }), la = w(oa, {
1109
+ }), la = b(oa, {
1108
1110
  name: "getStatistics",
1109
1111
  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.
1110
1112
 
@@ -1147,7 +1149,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1147
1149
  try {
1148
1150
  let h;
1149
1151
  if (d) {
1150
- const m = new ct({
1152
+ const g = new ct({
1151
1153
  where: e.where || "1=1",
1152
1154
  outFields: p,
1153
1155
  orderByFields: e.orderByFields,
@@ -1161,18 +1163,18 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1161
1163
  orderByFields: t.orderByFields
1162
1164
  })
1163
1165
  });
1164
- h = await n.queryTopFeatures(m);
1166
+ h = await n.queryTopFeatures(g);
1165
1167
  } else {
1166
- const m = n.createQuery();
1167
- m.where = Y(n.definitionExpression, e.where || "1=1"), m.outFields = p.length ? p : ["*"], m.orderByFields = t.orderByFields, m.num = t.topCount, c && (m.geometry = c, m.spatialRelationship = "intersects"), a?.distance && (m.distance = a.distance), a?.units && (m.units = a.units), m.outSpatialReference = r.spatialReference;
1168
- const b = ue(i, e.outFields, o ?? !1);
1168
+ const g = n.createQuery();
1169
+ g.where = Y(n.definitionExpression, e.where || "1=1"), g.outFields = p.length ? p : ["*"], g.orderByFields = t.orderByFields, g.num = t.topCount, c && (g.geometry = c, g.spatialRelationship = "intersects"), a?.distance && (g.distance = a.distance), a?.units && (g.units = a.units), g.outSpatialReference = r.spatialReference;
1170
+ const f = ue(i, e.outFields, o ?? !1);
1169
1171
  try {
1170
- h = b ? await i.queryFeatures(m) : await n.queryFeatures(m);
1172
+ h = f ? await i.queryFeatures(g) : await n.queryFeatures(g);
1171
1173
  } catch (x) {
1172
- console.warn("Client-side query failed, falling back to server:", x), h = await n.queryFeatures(m);
1174
+ console.warn("Client-side query failed, falling back to server:", x), h = await n.queryFeatures(g);
1173
1175
  }
1174
1176
  }
1175
- const f = h.features.map((m) => m.attributes[u]), { attributes: S } = De(n, h, r.timeZone);
1177
+ const w = h.features.map((g) => g.attributes[u]), { attributes: S } = De(n, h, r.timeZone);
1176
1178
  return {
1177
1179
  tool: "getTopFeatures",
1178
1180
  layerName: s,
@@ -1180,7 +1182,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1180
1182
  details: {
1181
1183
  topCount: t.topCount,
1182
1184
  attributes: S,
1183
- objectIds: f,
1185
+ objectIds: w,
1184
1186
  objectIdField: u,
1185
1187
  where: e.where,
1186
1188
  orderByFields: t.orderByFields,
@@ -1207,7 +1209,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1207
1209
  layerId: l.string().describe("The layerId of the layer containing the geometry by which to filter."),
1208
1210
  where: l.string().describe("The SQL-92 where clause representing the features from which to filter."),
1209
1211
  distance: l.number().optional().describe("The buffer distance around the geometry."),
1210
- units: z.optional().describe("The units for the distance buffer.")
1212
+ units: M.optional().describe("The units for the distance buffer.")
1211
1213
  }), pa = l.object({
1212
1214
  point: l.object({
1213
1215
  x: l.number().describe("X coordinate (longitude) from navigation result"),
@@ -1217,7 +1219,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1217
1219
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1218
1220
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1219
1221
  distance: l.number().optional().describe("Optional buffer distance around the point."),
1220
- units: z.optional().describe("The units for the distance buffer.")
1222
+ units: M.optional().describe("The units for the distance buffer.")
1221
1223
  }), ha = l.object({
1222
1224
  targetLayer: l.object({
1223
1225
  layerId: l.string().describe("The layerId of the layer containing the field from which to get a value."),
@@ -1242,52 +1244,52 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1242
1244
  useCurrentExtent: l.boolean().optional().describe(
1243
1245
  "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)."
1244
1246
  )
1245
- }), ma = w(da, {
1247
+ }), ma = b(da, {
1246
1248
  name: "getTopFeatures",
1247
1249
  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.',
1248
1250
  schema: ha
1249
1251
  }), oe = 25, ga = async (e, t, r, a) => {
1250
- const o = t.map?.allLayers.find((m) => m.id === e.layerId), n = await t.whenLayerView(o), i = o.title ?? e.layerId;
1252
+ const o = t.map?.allLayers.find((g) => g.id === e.layerId), n = await t.whenLayerView(o), i = o.title ?? e.layerId;
1251
1253
  let s;
1252
1254
  if (r) {
1253
- const m = await X(r, t);
1254
- if ("error" in m) {
1255
- const b = { error: m.error };
1256
- if (O(r)) {
1255
+ const g = await X(r, t);
1256
+ if ("error" in g) {
1257
+ const f = { error: g.error };
1258
+ if (G(r)) {
1257
1259
  const x = t.map?.allLayers.find((I) => I.id === r.layerId);
1258
- b.geometryLayerName = x?.title ?? x?.id, b.geometryLayerId = r.layerId, b.geometryWhere = r.where;
1259
- } else J(r) && (b.point = r.point);
1260
+ f.geometryLayerName = x?.title ?? x?.id, f.geometryLayerId = r.layerId, f.geometryWhere = r.where;
1261
+ } else J(r) && (f.point = r.point);
1260
1262
  return {
1261
1263
  tool: "queryFeatures",
1262
1264
  layerName: i,
1263
1265
  summary: "Geometry lookup failed",
1264
- details: b
1266
+ details: f
1265
1267
  };
1266
1268
  }
1267
- if (!m.geometry) {
1268
- const b = {};
1269
- if (O(r)) {
1269
+ if (!g.geometry) {
1270
+ const f = {};
1271
+ if (G(r)) {
1270
1272
  const x = t.map?.allLayers.find((I) => I.id === r.layerId);
1271
- b.error = `No features found matching: ${r.where}`, b.geometryLayerName = x?.title ?? x?.id, b.geometryLayerId = r.layerId, b.geometryWhere = r.where;
1272
- } else J(r) && (b.error = "Failed to create point geometry", b.point = r.point);
1273
+ f.error = `No features found matching: ${r.where}`, f.geometryLayerName = x?.title ?? x?.id, f.geometryLayerId = r.layerId, f.geometryWhere = r.where;
1274
+ } else J(r) && (f.error = "Failed to create point geometry", f.point = r.point);
1273
1275
  return {
1274
1276
  tool: "queryFeatures",
1275
1277
  layerName: i,
1276
1278
  summary: "No features found for geometry filter",
1277
- details: b
1279
+ details: f
1278
1280
  };
1279
1281
  }
1280
- s = m.geometry;
1282
+ s = g.geometry;
1281
1283
  } else a && (s = t.extent.clone());
1282
1284
  const c = ue(n, e.outFields, a ?? !1), d = o.objectIdField, u = o.createQuery();
1283
1285
  u.where = Y(o.definitionExpression, e.where || "1=1"), u.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])], u.orderByFields = e.orderByFields, s && (u.geometry = s, u.spatialRelationship = "intersects"), r?.distance && (u.distance = r.distance), r?.units && (u.units = r.units), u.outSpatialReference = t.spatialReference;
1284
1286
  let p, h;
1285
1287
  try {
1286
1288
  p = c ? await n.queryFeatureCount(u) : await o.queryFeatureCount(u), p > 0 && p <= oe && (h = c ? await n.queryFeatures(u) : await o.queryFeatures(u));
1287
- } catch (m) {
1288
- console.warn("Client-side query failed, falling back to server:", m), p = await o.queryFeatureCount(u), p > 0 && p <= oe && (h = await o.queryFeatures(u));
1289
+ } catch (g) {
1290
+ console.warn("Client-side query failed, falling back to server:", g), p = await o.queryFeatureCount(u), p > 0 && p <= oe && (h = await o.queryFeatures(u));
1289
1291
  }
1290
- const { objectIds: f, attributes: S } = h ? De(o, h, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1292
+ const { objectIds: w, attributes: S } = h ? De(o, h, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1291
1293
  return {
1292
1294
  tool: "queryFeatures",
1293
1295
  layerName: i,
@@ -1297,7 +1299,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1297
1299
  where: e.where,
1298
1300
  orderByFields: e.orderByFields,
1299
1301
  outFields: e.outFields,
1300
- ...f && { objectIds: f, objectIdField: d },
1302
+ ...w && { objectIds: w, objectIdField: d },
1301
1303
  ...S && { attributes: S },
1302
1304
  ...p > oe && {
1303
1305
  note: `${p} features found.`
@@ -1317,7 +1319,7 @@ const fa = l.object({
1317
1319
  layerId: l.string().describe("The layerId of the layer containing the geometry by which to filter."),
1318
1320
  where: l.string().describe("The SQL-92 where clause representing the features from which to filter."),
1319
1321
  distance: l.number().optional().describe("The buffer distance around the geometry."),
1320
- units: z.optional().describe("The units for the distance buffer.")
1322
+ units: M.optional().describe("The units for the distance buffer.")
1321
1323
  }), wa = l.object({
1322
1324
  point: l.object({
1323
1325
  x: l.number().describe("X coordinate (longitude) from navigation result"),
@@ -1327,7 +1329,7 @@ const fa = l.object({
1327
1329
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1328
1330
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1329
1331
  distance: l.number().optional().describe("Optional buffer distance around the point."),
1330
- units: z.optional().describe("The units for the distance buffer.")
1332
+ units: M.optional().describe("The units for the distance buffer.")
1331
1333
  }), ba = l.object({
1332
1334
  targetLayer: l.object({
1333
1335
  layerId: l.string().describe("The layerId of the layer containing the field from which to get a value."),
@@ -1347,7 +1349,7 @@ const fa = l.object({
1347
1349
  useCurrentExtent: l.boolean().optional().describe(
1348
1350
  "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)."
1349
1351
  )
1350
- }), Sa = w(ya, {
1352
+ }), Sa = b(ya, {
1351
1353
  name: "queryFeatures",
1352
1354
  description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
1353
1355
 
@@ -1360,8 +1362,8 @@ USE THIS TOOL FOR:
1360
1362
 
1361
1363
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1362
1364
  schema: ba
1363
- }), _e = [ra, la, ma, Sa], je = [Gr, Nr, Fr], va = async (e, t) => {
1364
- await g({ text: "Requesting LLM for layer filter results" }, t);
1365
+ }), _e = [ra, la, ma, Sa], je = [Or, Nr, Fr], va = async (e, t) => {
1366
+ await m({ text: "Requesting LLM for layer filter results" }, t);
1365
1367
  const a = await F("data_explore_filter_prompt");
1366
1368
  if (!t?.configurable)
1367
1369
  throw new Error("config.configurable is required for layer filter tools");
@@ -1381,7 +1383,7 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1381
1383
  tools: je
1382
1384
  }), c = [...e.dataExplorationMessages, s];
1383
1385
  if (!((s.tool_calls?.length ?? 0) > 0))
1384
- return await g({ text: "LLM determined no filter changes needed" }, t), {
1386
+ return await m({ text: "LLM determined no filter changes needed" }, t), {
1385
1387
  ...e,
1386
1388
  dataExplorationMessages: c
1387
1389
  // Don't overwrite outputMessage if query already set it
@@ -1389,7 +1391,7 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1389
1391
  const u = [...c, s], p = s.content.toString();
1390
1392
  return await de(s, t), { ...e, dataExplorationMessages: u, outputMessage: p };
1391
1393
  }, xa = async (e, t) => {
1392
- await g({ text: "Requesting LLM for layer query results" }, t);
1394
+ await m({ text: "Requesting LLM for layer query results" }, t);
1393
1395
  const a = await F("data_explore_query_prompt");
1394
1396
  if (!t?.configurable)
1395
1397
  throw new Error("config.configurable is required for layer query tools");
@@ -1416,7 +1418,7 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1416
1418
  };
1417
1419
  }, Ta = async (e, t) => {
1418
1420
  try {
1419
- await g({ text: "Requesting LLM for summary on query results" }, t);
1421
+ await m({ text: "Requesting LLM for summary on query results" }, t);
1420
1422
  const a = await F("summarize_query_response_prompt"), o = {
1421
1423
  queryResponse: e.queryResponse,
1422
1424
  assignedTask: e.agentExecutionContext.assignedTask,
@@ -1428,7 +1430,7 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1428
1430
  messages: e.dataExplorationMessages,
1429
1431
  inputVariables: o
1430
1432
  }), i = typeof n == "string" ? n : n.content, s = new ut(i);
1431
- await g({ text: `Received response from LLM: ${i}` }, t);
1433
+ await m({ text: `Received response from LLM: ${i}` }, t);
1432
1434
  const c = i;
1433
1435
  return {
1434
1436
  ...e,
@@ -1438,7 +1440,7 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1438
1440
  dataExplorationMessages: [...e.dataExplorationMessages, s]
1439
1441
  };
1440
1442
  } catch (r) {
1441
- throw await g({ text: "Error during filter LLM request" }, t), new Error(`Error during filter LLM request: ${r instanceof Error ? r.message : String(r)}`);
1443
+ throw await m({ text: "Error during filter LLM request" }, t), new Error(`Error during filter LLM request: ${r instanceof Error ? r.message : String(r)}`);
1442
1444
  }
1443
1445
  };
1444
1446
  async function Ea(e, t) {
@@ -1448,7 +1450,7 @@ async function Ea(e, t) {
1448
1450
  },
1449
1451
  t
1450
1452
  );
1451
- return await g(
1453
+ return await m(
1452
1454
  { text: `Finished executing layer filter tool: ${a.messages.map((o) => o.content).join(", ")}` },
1453
1455
  t
1454
1456
  ), { ...e };
@@ -1482,7 +1484,7 @@ async function Ca(e, t) {
1482
1484
  }
1483
1485
  a.push(s), s.details && typeof s.details == "object" && "error" in s.details ? o.push(`- ${s.tool}: Error - ${String(s.details.error)}`) : o.push(`- ${s.layerName}: ${s.summary}`);
1484
1486
  }
1485
- return await g({ text: `Finished executing layer query tool: ${o.join(", ")}` }, t), {
1487
+ return await m({ text: `Finished executing layer query tool: ${o.join(", ")}` }, t), {
1486
1488
  ...e,
1487
1489
  dataExplorationMessages: [...e.dataExplorationMessages, ...r],
1488
1490
  queryResponse: a,
@@ -1519,45 +1521,45 @@ async function Fa(e, t, r, a = !0) {
1519
1521
  const o = [], n = [], i = [];
1520
1522
  for (const s of e) {
1521
1523
  let c = function(S) {
1522
- const m = t.get(S)?.layerItem;
1523
- return m ? [
1524
- m.name && `Name: ${m.name}`,
1525
- m.title && `Title: ${m.title}`,
1526
- m.description && `Description: ${m.description}`
1524
+ const g = t.get(S)?.layerItem;
1525
+ return g ? [
1526
+ g.name && `Name: ${g.name}`,
1527
+ g.title && `Title: ${g.title}`,
1528
+ g.description && `Description: ${g.description}`
1527
1529
  ].filter(Boolean).join(" | ") : S;
1528
1530
  };
1529
1531
  const { layerId: d, results: u } = s, p = r.map?.allLayers.find((S) => S.id === d), h = t.get(d)?.fieldRegistry;
1530
1532
  if (!h)
1531
1533
  continue;
1532
- let f = o.find((S) => S.layerId === d);
1533
- f || (f = {
1534
+ let w = o.find((S) => S.layerId === d);
1535
+ w || (w = {
1534
1536
  layerId: d,
1535
1537
  layerSummary: c(d),
1536
1538
  fieldInfos: []
1537
- }, o.push(f));
1539
+ }, o.push(w));
1538
1540
  for (const S of u) {
1539
- const m = h.get(S.name);
1540
- if (!m)
1541
+ const g = h.get(S.name);
1542
+ if (!g)
1541
1543
  continue;
1542
- const b = m.statistics, x = a && !b?.summaryStatistics, I = qa(m.type, m.domain?.type) && !b?.uniqueValues, T = x || I;
1544
+ const f = g.statistics, x = a && !f?.summaryStatistics, I = qa(g.type, g.domain?.type) && !f?.uniqueValues, T = x || I;
1543
1545
  if (i.push({
1544
1546
  layerId: d,
1545
- fieldName: m.name,
1547
+ fieldName: g.name,
1546
1548
  didFetchStatistics: T
1547
1549
  }), T) {
1548
- const _ = Ia(p, m, {
1550
+ const _ = Ia(p, g, {
1549
1551
  includeSummaryStatistics: x,
1550
1552
  includeUniqueValues: I
1551
1553
  }).then((L) => {
1552
1554
  const R = {
1553
- summaryStatistics: b?.summaryStatistics ?? null,
1554
- uniqueValues: b?.uniqueValues ?? null
1555
+ summaryStatistics: f?.summaryStatistics ?? null,
1556
+ uniqueValues: f?.uniqueValues ?? null
1555
1557
  };
1556
- x && (R.summaryStatistics = L.summaryStatistics), I && (R.uniqueValues = L.uniqueValues), h.set(m.name, { ...m, statistics: R }), m.statistics = R;
1558
+ x && (R.summaryStatistics = L.summaryStatistics), I && (R.uniqueValues = L.uniqueValues), h.set(g.name, { ...g, statistics: R }), g.statistics = R;
1557
1559
  });
1558
1560
  n.push(_);
1559
1561
  }
1560
- f.fieldInfos.push(m);
1562
+ w.fieldInfos.push(g);
1561
1563
  }
1562
1564
  }
1563
1565
  return await Promise.all(n), {
@@ -1572,28 +1574,28 @@ function La(e, t) {
1572
1574
  }
1573
1575
  const Aa = async (e, t) => {
1574
1576
  try {
1575
- await g({ text: "Preparing field information for vector search results" }, t);
1577
+ await m({ text: "Preparing field information for vector search results" }, t);
1576
1578
  const r = v(t, "layersAndFieldsRegistry"), { mapView: a } = N(t), { assignedTask: o, userRequest: n } = e.agentExecutionContext, i = La(o, n), { layerFieldInfo: s, didFetchStatistics: c, fieldStatisticsFetchStatus: d } = await Fa(
1577
1579
  e.vectorSearchFieldResults,
1578
1580
  r,
1579
1581
  a,
1580
1582
  i
1581
1583
  );
1582
- c ? await g({ text: "Statistics fetched" }, t) : await g({ text: "Statistics skipped" }, t);
1584
+ c ? await m({ text: "Statistics fetched" }, t) : await m({ text: "Statistics skipped" }, t);
1583
1585
  for (const u of d)
1584
- await g(
1586
+ await m(
1585
1587
  {
1586
1588
  text: ` - ${u.fieldName} - stats ${u.didFetchStatistics ? "fetched" : "skipped"}`
1587
1589
  },
1588
1590
  t
1589
1591
  );
1590
- return await g({ text: "Field information prepared" }, t), { ...e, layerFieldInfo: s };
1592
+ return await m({ text: "Field information prepared" }, t), { ...e, layerFieldInfo: s };
1591
1593
  } catch (r) {
1592
- throw await g({ text: "Error during fetching statistics" }, t), new Error(`Error during fetching statistics: ${r instanceof Error ? r.message : String(r)}`);
1594
+ throw await m({ text: "Error during fetching statistics" }, t), new Error(`Error during fetching statistics: ${r instanceof Error ? r.message : String(r)}`);
1593
1595
  }
1594
- }, xe = 0.7, Na = 10, za = async (e, t) => {
1596
+ }, xe = 0.7, Na = 10, Ma = async (e, t) => {
1595
1597
  try {
1596
- await g({ text: "Similarity search to find fields" }, t);
1598
+ await m({ text: "Similarity search to find fields" }, t);
1597
1599
  const r = v(t, "fieldSearch"), a = v(t, "layersAndFieldsRegistry"), o = v(t, "embeddingCache"), n = await r.searchFields({
1598
1600
  text: e.agentExecutionContext.assignedTask,
1599
1601
  layerIds: e.vectorSearchLayerIds,
@@ -1609,36 +1611,36 @@ ${u}`;
1609
1611
  `);
1610
1612
  let s;
1611
1613
  return n.length > 0 ? s = `Vector search completed. Matching layers and fields with scores:
1612
- ${i}` : s = `No vector search results found for score over ${xe}.`, await g({ text: s }, t), {
1614
+ ${i}` : s = `No vector search results found for score over ${xe}.`, await m({ text: s }, t), {
1613
1615
  ...e,
1614
1616
  vectorSearchFieldResults: n
1615
1617
  };
1616
1618
  } catch (r) {
1617
- throw await g(
1619
+ throw await m(
1618
1620
  { text: `Error during vector search: ${r instanceof Error ? r.message : String(r)}` },
1619
1621
  t
1620
1622
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1621
1623
  }
1622
- }, Ma = 0.7, Da = async (e, t) => {
1624
+ }, za = 0.7, Da = async (e, t) => {
1623
1625
  try {
1624
- await g(
1626
+ await m(
1625
1627
  { text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
1626
1628
  t
1627
1629
  );
1628
1630
  const r = v(t, "layerSearch"), a = v(t, "layersAndFieldsRegistry"), o = v(t, "embeddingCache"), n = await r.searchLayers({
1629
1631
  text: e.agentExecutionContext.assignedTask,
1630
- minScore: Ma,
1632
+ minScore: za,
1631
1633
  embeddingCache: o
1632
1634
  }), i = n.map((d) => d.id), s = n.map(({ id: d, score: u }) => `${a.get(d)?.layerItem.name ?? d} (${u.toFixed(2)})`).join(`
1633
1635
  `);
1634
1636
  let c;
1635
1637
  return i.length > 0 ? c = `Vector search completed. Matching layers with scores:
1636
- ${s}` : c = "Vector search completed. No matching layers found.", await g({ text: c }, t), {
1638
+ ${s}` : c = "Vector search completed. No matching layers found.", await m({ text: c }, t), {
1637
1639
  ...e,
1638
1640
  vectorSearchLayerIds: i
1639
1641
  };
1640
1642
  } catch (r) {
1641
- throw await g(
1643
+ throw await m(
1642
1644
  { text: `Error during vector search: ${r instanceof Error ? r.message : String(r)}` },
1643
1645
  t
1644
1646
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
@@ -1646,7 +1648,7 @@ ${s}` : c = "Vector search completed. No matching layers found.", await g({ text
1646
1648
  }, _a = (e, t) => U(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
1647
1649
  e,
1648
1650
  t
1649
- ), ja = () => new V(Le).addNode("requireDataExplorationServices", _a).addNode("vectorSearchLayers", Da).addNode("vectorSearchFields", za).addNode("fieldStatistics", Aa).addNode("queryAgent", xa).addNode("queryTools", Ca).addNode("summarizeQueryResponseLLM", Ta).addNode("filterAgent", va).addNode("filterTools", Ea).addNode("earlyExit", $r).addEdge(K, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1651
+ ), ja = () => new V(Le).addNode("requireDataExplorationServices", _a).addNode("vectorSearchLayers", Da).addNode("vectorSearchFields", Ma).addNode("fieldStatistics", Aa).addNode("queryAgent", xa).addNode("queryTools", Ca).addNode("summarizeQueryResponseLLM", Ta).addNode("filterAgent", va).addNode("filterTools", Ea).addNode("earlyExit", $r).addEdge(K, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1650
1652
  "vectorSearchLayers",
1651
1653
  (t) => t.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
1652
1654
  ).addConditionalEdges(
@@ -1669,14 +1671,14 @@ ${s}` : c = "Vector search completed. No matching layers found.", await g({ text
1669
1671
  description: Pa,
1670
1672
  createGraph: ja,
1671
1673
  workspace: Le
1672
- }, Te = 0.7, Oa = 10, Ga = async (e, t) => {
1674
+ }, Te = 0.7, Ga = 10, Oa = async (e, t) => {
1673
1675
  try {
1674
- await g({ text: "Similarity search to find fields" }, t);
1676
+ await m({ text: "Similarity search to find fields" }, t);
1675
1677
  const r = v(t, "fieldSearch"), a = v(t, "layersAndFieldsRegistry"), o = v(t, "embeddingCache"), n = await r.searchFields({
1676
1678
  text: e.agentExecutionContext.assignedTask,
1677
1679
  layerIds: e.vectorSearchLayerIds,
1678
1680
  minScore: Te,
1679
- topResults: Oa,
1681
+ topResults: Ga,
1680
1682
  embeddingCache: o
1681
1683
  }), i = n.map(({ layerId: c, results: d }) => {
1682
1684
  const u = d.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
@@ -1687,19 +1689,19 @@ ${u}`;
1687
1689
  `);
1688
1690
  let s;
1689
1691
  return n.length > 0 ? s = `Vector search completed. Matching layers and fields with scores:
1690
- ${i}` : s = `No vector search results found for score over ${Te}.`, await g({ text: s }, t), {
1692
+ ${i}` : s = `No vector search results found for score over ${Te}.`, await m({ text: s }, t), {
1691
1693
  ...e,
1692
1694
  vectorSearchFieldResults: n
1693
1695
  };
1694
1696
  } catch (r) {
1695
- throw await g(
1697
+ throw await m(
1696
1698
  { text: `Error during vector search: ${r instanceof Error ? r.message : String(r)}` },
1697
1699
  t
1698
1700
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
1699
1701
  }
1700
1702
  }, Va = 0.7, Ka = async (e, t) => {
1701
1703
  try {
1702
- await g(
1704
+ await m(
1703
1705
  { text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
1704
1706
  t
1705
1707
  );
@@ -1710,12 +1712,12 @@ ${i}` : s = `No vector search results found for score over ${Te}.`, await g({ te
1710
1712
  `);
1711
1713
  let s;
1712
1714
  return n.length > 0 ? s = `Vector search completed. Matching layers with scores:
1713
- ${i}` : s = "Vector search completed. No matching layers found.", await g({ text: s }, t), {
1715
+ ${i}` : s = "Vector search completed. No matching layers found.", await m({ text: s }, t), {
1714
1716
  ...e,
1715
1717
  vectorSearchLayerIds: n
1716
1718
  };
1717
1719
  } catch (r) {
1718
- throw await g(
1720
+ throw await m(
1719
1721
  { text: `Error during vector search: ${r instanceof Error ? r.message : String(r)}` },
1720
1722
  t
1721
1723
  ), new Error(`Vector search failed: ${r instanceof Error ? r.message : String(r)}`);
@@ -1805,7 +1807,7 @@ const Za = l.object({
1805
1807
  fields: l.array(l.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
1806
1808
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
1807
1809
  includeSize: l.boolean().optional().describe("Whether to vary the chart size (chart-size)")
1808
- }), Ja = w(Ha, {
1810
+ }), Ja = b(Ha, {
1809
1811
  name: "chart",
1810
1812
  description: `Label: Charts
1811
1813
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
@@ -1888,7 +1890,7 @@ const ro = l.object({
1888
1890
  fields: l.array(l.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
1889
1891
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
1890
1892
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
1891
- }), ao = w(to, {
1893
+ }), ao = b(to, {
1892
1894
  name: "color-age",
1893
1895
  description: `Label: Age (color)
1894
1896
  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.
@@ -1967,7 +1969,7 @@ const lo = l.object({
1967
1969
  fields: l.array(l.string()).describe("The field(s) to use for the color renderer"),
1968
1970
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
1969
1971
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
1970
- }), co = w(io, {
1972
+ }), co = b(io, {
1971
1973
  name: "color",
1972
1974
  description: `Label: Counts and Amounts (color)
1973
1975
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
@@ -2045,7 +2047,7 @@ const go = l.object({
2045
2047
  fields: l.array(l.string()).describe("The fields to use for the color-size univariate renderer"),
2046
2048
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
2047
2049
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
2048
- }), yo = w(mo, {
2050
+ }), yo = b(mo, {
2049
2051
  name: "color-size-univariate",
2050
2052
  description: `Label: Color and Size (univariate)
2051
2053
  Description: Vary symbol size and color based on the values of two numeric attributes.
@@ -2119,7 +2121,7 @@ const vo = l.object({
2119
2121
  layerId: l.string().describe("The id of the layer to apply the dot density renderer to"),
2120
2122
  fields: l.array(l.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
2121
2123
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use")
2122
- }), xo = w(So, {
2124
+ }), xo = b(So, {
2123
2125
  name: "dot-density",
2124
2126
  description: `Dot Density
2125
2127
  Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
@@ -2194,7 +2196,7 @@ const $o = l.object({
2194
2196
  layerId: l.string().describe("The id of the layer to apply the heatmap renderer to"),
2195
2197
  fields: l.array(l.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
2196
2198
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use")
2197
- }), ko = w(Co, {
2199
+ }), ko = b(Co, {
2198
2200
  name: "heatmap",
2199
2201
  description: `Label: Heat Map
2200
2202
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
@@ -2269,7 +2271,7 @@ const Ao = l.object({
2269
2271
  fields: l.array(l.string()).describe("The fields to use for the predominance renderer (competing categories)"),
2270
2272
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
2271
2273
  includeSize: l.boolean().optional().describe("Whether to include size visualization (predominance-size)")
2272
- }), No = w(Lo, {
2274
+ }), No = b(Lo, {
2273
2275
  name: "predominance",
2274
2276
  description: `Label: Predominant category
2275
2277
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
@@ -2284,7 +2286,7 @@ const Ao = l.object({
2284
2286
  Fields: This style relies on 2-10 number fields.`,
2285
2287
  schema: Ao
2286
2288
  });
2287
- function zo(e) {
2289
+ function Mo(e) {
2288
2290
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
2289
2291
  let n;
2290
2292
  const i = {
@@ -2305,7 +2307,7 @@ function zo(e) {
2305
2307
  relationshipScheme: n
2306
2308
  };
2307
2309
  }
2308
- async function Mo(e) {
2310
+ async function zo(e) {
2309
2311
  return await Et(e);
2310
2312
  }
2311
2313
  async function Do({
@@ -2326,7 +2328,7 @@ async function Do({
2326
2328
  colorSchemeTags: o
2327
2329
  };
2328
2330
  try {
2329
- const c = zo(s), d = await Mo(c);
2331
+ const c = Mo(s), d = await zo(c);
2330
2332
  return i.renderer = d.renderer, i.visible = !0, `Relationship renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
2331
2333
  } catch (c) {
2332
2334
  return `Error applying relationship renderer: ${c instanceof Error ? c.message : String(c)}`;
@@ -2350,7 +2352,7 @@ const jo = l.object({
2350
2352
  layerId: l.string().describe("The id of the layer to apply the relationship renderer to"),
2351
2353
  fields: l.array(l.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
2352
2354
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use")
2353
- }), Po = w(_o, {
2355
+ }), Po = b(_o, {
2354
2356
  name: "relationship",
2355
2357
  description: `Label: Relationship
2356
2358
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
@@ -2359,7 +2361,7 @@ const jo = l.object({
2359
2361
  Fields: This style requires two number fields.`,
2360
2362
  schema: jo
2361
2363
  });
2362
- function Oo(e) {
2364
+ function Go(e) {
2363
2365
  const { fields: t, layer: r, view: a, theme: o } = e, n = t[0];
2364
2366
  return {
2365
2367
  layer: r,
@@ -2371,7 +2373,7 @@ function Oo(e) {
2371
2373
  outlineOptimizationEnabled: !0
2372
2374
  };
2373
2375
  }
2374
- async function Go(e) {
2376
+ async function Oo(e) {
2375
2377
  return await Ct(e);
2376
2378
  }
2377
2379
  async function Vo({
@@ -2394,7 +2396,7 @@ async function Vo({
2394
2396
  theme: n
2395
2397
  };
2396
2398
  try {
2397
- const d = Oo(c), u = await Go(d);
2399
+ const d = Go(c), u = await Oo(d);
2398
2400
  return s.renderer = u.renderer, s.visible = !0, `Size-age renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
2399
2401
  } catch (d) {
2400
2402
  return `Error applying size-age renderer: ${d instanceof Error ? d.message : String(d)}`;
@@ -2421,7 +2423,7 @@ const Wo = l.object({
2421
2423
  fields: l.array(l.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
2422
2424
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
2423
2425
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2424
- }), Qo = w(Ko, {
2426
+ }), Qo = b(Ko, {
2425
2427
  name: "size-age",
2426
2428
  description: `Label: Age (size)
2427
2429
  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.
@@ -2494,7 +2496,7 @@ const Jo = l.object({
2494
2496
  fields: l.array(l.string()).describe("The field(s) to use for the size renderer (numeric data)"),
2495
2497
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
2496
2498
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
2497
- }), Yo = w(Zo, {
2499
+ }), Yo = b(Zo, {
2498
2500
  name: "size",
2499
2501
  description: `Label: Counts and Amounts (size)
2500
2502
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
@@ -2576,7 +2578,7 @@ const an = l.object({
2576
2578
  fields: l.array(l.string()).describe("The field(s) to use for the type renderer (categorical data)"),
2577
2579
  colorSchemes: l.array(l.string()).optional().describe("Optional color scheme tags to use"),
2578
2580
  theme: l.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
2579
- }), on = w(rn, {
2581
+ }), on = b(rn, {
2580
2582
  name: "type",
2581
2583
  description: `Label: Types (unique symbols)
2582
2584
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
@@ -2596,14 +2598,14 @@ Fields: This style requires a single field which may be a string, number, or dat
2596
2598
  Qo,
2597
2599
  Yo,
2598
2600
  on
2599
- ], Oe = (e, t = 3) => {
2601
+ ], Ge = (e, t = 3) => {
2600
2602
  const r = e.map((o, n) => o.type === "human" ? n : -1).filter((o) => o !== -1);
2601
2603
  if (r.length === 0)
2602
2604
  return [];
2603
2605
  const a = r.length > t ? r[r.length - t] : r[0];
2604
2606
  return e.slice(a);
2605
2607
  }, nn = async (e, t) => {
2606
- await g({ text: "Requesting LLM for layer query results" }, t);
2608
+ await m({ text: "Requesting LLM for layer query results" }, t);
2607
2609
  const r = await F("navigation_intent_prompt");
2608
2610
  if (!t?.configurable)
2609
2611
  throw new Error("config.configurable is required for layer query tools");
@@ -2612,7 +2614,7 @@ Fields: This style requires a single field which may be a string, number, or dat
2612
2614
  }, o = await j({
2613
2615
  promptText: r,
2614
2616
  modelTier: "advanced",
2615
- messages: Oe(e.agentExecutionContext.messages),
2617
+ messages: Ge(e.agentExecutionContext.messages),
2616
2618
  inputVariables: a,
2617
2619
  tools: Pe
2618
2620
  });
@@ -2627,17 +2629,17 @@ Fields: This style requires a single field which may be a string, number, or dat
2627
2629
  async function sn(e, t) {
2628
2630
  const a = await new P(Pe).invoke(
2629
2631
  {
2630
- messages: Oe(e.agentExecutionContext.messages)
2632
+ messages: Ge(e.agentExecutionContext.messages)
2631
2633
  },
2632
2634
  t
2633
2635
  ), o = a.messages.map((i) => i.text).join(`
2634
2636
  `);
2635
- await g({ text: `Finished executing layer filter tool: ${o}` }, t);
2637
+ await m({ text: `Finished executing layer filter tool: ${o}` }, t);
2636
2638
  const n = a.messages.map((i) => i.text).join(`
2637
2639
  `);
2638
2640
  return { ...e, outputMessage: n };
2639
2641
  }
2640
- const Ge = y.Root({
2642
+ const Oe = y.Root({
2641
2643
  // Execution context provided by the orchestrator for this agent invocation.
2642
2644
  agentExecutionContext: y({
2643
2645
  reducer: W,
@@ -2658,9 +2660,9 @@ const Ge = y.Root({
2658
2660
  vectorSearchFieldResults: y(),
2659
2661
  layerFieldInfo: y(),
2660
2662
  selectedLayerId: y()
2661
- }), ln = async (e, t) => (await g({ text: "Exiting Layer Styling agent" }, t), e), cn = async (e, t) => {
2663
+ }), ln = async (e, t) => (await m({ text: "Exiting Layer Styling agent" }, t), e), cn = async (e, t) => {
2662
2664
  try {
2663
- await g({ text: "Populating layer and field info" }, t);
2665
+ await m({ text: "Populating layer and field info" }, t);
2664
2666
  const r = [];
2665
2667
  for (const a of e.vectorSearchFieldResults) {
2666
2668
  let o = function(u) {
@@ -2685,9 +2687,9 @@ const Ge = y.Root({
2685
2687
  p && d.fieldInfos.push(p);
2686
2688
  }
2687
2689
  }
2688
- return await g({ text: "Populated layerFieldInfo" }, t), { ...e, layerFieldInfo: r };
2690
+ return await m({ text: "Populated layerFieldInfo" }, t), { ...e, layerFieldInfo: r };
2689
2691
  } catch (r) {
2690
- throw await g({ text: "Error populating layerFieldInfo" }, t), new Error(`Error populating layerFieldInfo: ${r instanceof Error ? r.message : String(r)}`);
2692
+ throw await m({ text: "Error populating layerFieldInfo" }, t), new Error(`Error populating layerFieldInfo: ${r instanceof Error ? r.message : String(r)}`);
2691
2693
  }
2692
2694
  }, dn = (e, t) => {
2693
2695
  const r = e.vectorSearchLayerIds ?? [];
@@ -2709,7 +2711,7 @@ const Ge = y.Root({
2709
2711
  ...e,
2710
2712
  selectedLayerId: o ?? e.vectorSearchLayerIds[0]
2711
2713
  };
2712
- }, un = (e, t) => U(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(e, t), pn = () => new V(Ge).addNode("requireLayerStylingServices", un).addNode("vectorSearchLayers", Ka).addNode("layerSelectionHITL", dn).addNode("vectorSearchFields", Ga).addNode("populateLayerFieldInfo", cn).addNode("agent", nn).addNode("tools", sn).addNode("earlyExit", ln).addEdge(K, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
2714
+ }, un = (e, t) => U(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Layer Styling Agent")(e, t), pn = () => new V(Oe).addNode("requireLayerStylingServices", un).addNode("vectorSearchLayers", Ka).addNode("layerSelectionHITL", dn).addNode("vectorSearchFields", Oa).addNode("populateLayerFieldInfo", cn).addNode("agent", nn).addNode("tools", sn).addNode("earlyExit", ln).addEdge(K, "requireLayerStylingServices").addEdge("requireLayerStylingServices", "vectorSearchLayers").addConditionalEdges(
2713
2715
  "layerSelectionHITL",
2714
2716
  (t) => t.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
2715
2717
  ).addConditionalEdges(
@@ -2724,7 +2726,7 @@ const Ge = y.Root({
2724
2726
  name: "Layer Styling Agent",
2725
2727
  description: hn,
2726
2728
  createGraph: pn,
2727
- workspace: Ge
2729
+ workspace: Oe
2728
2730
  }, Ve = y.Root({
2729
2731
  // Execution context provided by the orchestrator for this agent invocation.
2730
2732
  agentExecutionContext: y({
@@ -2772,7 +2774,7 @@ ${o}`;
2772
2774
  }, gn = async ({ layerTitle: e }, t) => {
2773
2775
  const r = v(t, "layersAndFieldsRegistry");
2774
2776
  return mn(r, e);
2775
- }, yn = w(gn, {
2777
+ }, yn = b(gn, {
2776
2778
  name: "listLayerFields",
2777
2779
  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.",
2778
2780
  schema: l.object({
@@ -2840,7 +2842,7 @@ async function vn(e, t) {
2840
2842
  throw new Error("helpToolCalling: missing helpInternalState.toolCallMessage");
2841
2843
  const n = (await r.invoke({ messages: [a] }, t)).messages.map((i) => i.text).join(`
2842
2844
  `);
2843
- return await g({ text: `Finished executing help tool: ${n}` }, t), {
2845
+ return await m({ text: `Finished executing help tool: ${n}` }, t), {
2844
2846
  ...e,
2845
2847
  outputMessage: n,
2846
2848
  status: "success",
@@ -2852,7 +2854,7 @@ async function vn(e, t) {
2852
2854
  };
2853
2855
  } catch (a) {
2854
2856
  const o = a instanceof Error ? a.message : String(a);
2855
- return await g({ text: `Help tool execution failed: ${o}` }, t), {
2857
+ return await m({ text: `Help tool execution failed: ${o}` }, t), {
2856
2858
  ...e,
2857
2859
  outputMessage: `Help tool execution failed: ${o}`,
2858
2860
  status: "failed",
@@ -2962,7 +2964,7 @@ class pe {
2962
2964
  static fromDataModel(t) {
2963
2965
  const r = new pe();
2964
2966
  for (const a of t.entityTypes)
2965
- r.entityTypes.push(G.fromEntityType(a));
2967
+ r.entityTypes.push(O.fromEntityType(a));
2966
2968
  for (const a of t.relationshipTypes)
2967
2969
  r.relationshipTypes.push(Cn.fromRelationshipType(a));
2968
2970
  return r.identifierInfo = {
@@ -2975,12 +2977,12 @@ class pe {
2975
2977
  }, r.spatialReference = JSON.parse(JSON.stringify(t.spatialReference)), r;
2976
2978
  }
2977
2979
  }
2978
- class G {
2980
+ class O {
2979
2981
  constructor() {
2980
2982
  this.name = "", this.properties = [];
2981
2983
  }
2982
2984
  static fromEntityType(t) {
2983
- const r = new G();
2985
+ const r = new O();
2984
2986
  r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = kn(t.role);
2985
2987
  for (const a of t.properties) {
2986
2988
  const o = {
@@ -2999,12 +3001,12 @@ class G {
2999
3001
  return r;
3000
3002
  }
3001
3003
  }
3002
- class Cn extends G {
3004
+ class Cn extends O {
3003
3005
  constructor() {
3004
3006
  super(...arguments), this.observedEndPoints = [];
3005
3007
  }
3006
3008
  static fromRelationshipType(t) {
3007
- const r = G.fromEntityType(t);
3009
+ const r = O.fromEntityType(t);
3008
3010
  r.observedEndPoints = [];
3009
3011
  for (const a of t.endPoints)
3010
3012
  r.observedEndPoints.push({
@@ -3087,13 +3089,13 @@ async function re(e, t, r, a) {
3087
3089
  message: e,
3088
3090
  context: new Rn(t)
3089
3091
  };
3090
- H.conversationId && (o.conversationId = H.conversationId), await g({ text: "Attempting to generate a cypher query from your prompt..." }, a);
3092
+ H.conversationId && (o.conversationId = H.conversationId), await m({ text: "Attempting to generate a cypher query from your prompt..." }, a);
3091
3093
  const n = await fe(`${r}/chat`, {
3092
3094
  method: "post",
3093
3095
  body: JSON.stringify(o),
3094
3096
  headers: {
3095
3097
  "Content-Type": "application/json",
3096
- token: we.findCredential(M.getDefault().url)?.token ?? ""
3098
+ token: we.findCredential(z.getDefault().url)?.token ?? ""
3097
3099
  }
3098
3100
  });
3099
3101
  if (n.httpStatus !== 200)
@@ -3105,7 +3107,7 @@ async function re(e, t, r, a) {
3105
3107
  const s = Date.now();
3106
3108
  let c = n.data.sequenceNumber, d = "", u = "", p = 1;
3107
3109
  for (; !i; ) {
3108
- await new Promise((f) => setTimeout(f, 1e3)), await g(
3110
+ await new Promise((w) => setTimeout(w, 1e3)), await m(
3109
3111
  { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, p)}` },
3110
3112
  a
3111
3113
  ), p = p % 3 + 1;
@@ -3118,7 +3120,7 @@ async function re(e, t, r, a) {
3118
3120
  }),
3119
3121
  headers: {
3120
3122
  "Content-Type": "application/json",
3121
- token: we.findCredential(M.getDefault().url)?.token ?? ""
3123
+ token: we.findCredential(z.getDefault().url)?.token ?? ""
3122
3124
  }
3123
3125
  });
3124
3126
  if (h.httpStatus !== 200)
@@ -3155,14 +3157,14 @@ const Qe = async ({
3155
3157
  try {
3156
3158
  const h = await Ft(e, t, o);
3157
3159
  s = h.resultHeader;
3158
- const f = h.resultRowsStream.getReader();
3160
+ const w = h.resultRowsStream.getReader();
3159
3161
  let S = 0;
3160
- const m = Date.now(), b = !1;
3162
+ const g = Date.now(), f = !1;
3161
3163
  for (; ; ) {
3162
- const { done: x, value: I } = await f.read();
3164
+ const { done: x, value: I } = await w.read();
3163
3165
  if (x)
3164
3166
  break;
3165
- if (!b && i && Date.now() - m > i)
3167
+ if (!f && i && Date.now() - g > i)
3166
3168
  return d.abort(), { type: "timeout" };
3167
3169
  for (const T of I) {
3168
3170
  if (S++, n && S > n)
@@ -3201,7 +3203,7 @@ function An(e) {
3201
3203
  function Nn(e) {
3202
3204
  return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
3203
3205
  }
3204
- function zn(e, t) {
3206
+ function Mn(e, t) {
3205
3207
  const r = [];
3206
3208
  for (const a of [...t.dataModel.entityTypes, ...t.dataModel.relationshipTypes]) {
3207
3209
  const o = e.getMemberIdsByType(a.name);
@@ -3210,14 +3212,14 @@ function zn(e, t) {
3210
3212
  }
3211
3213
  return r;
3212
3214
  }
3213
- async function Mn(e, t, r, a, o) {
3215
+ async function zn(e, t, r, a, o) {
3214
3216
  const { graphQuery: n, explanation: i } = await re(
3215
3217
  e,
3216
3218
  t.dataModel,
3217
3219
  r,
3218
3220
  o
3219
3221
  );
3220
- await g(
3222
+ await m(
3221
3223
  { text: `Attempting to execute query: ${n.substring(0, 500)}${n.length > 500 ? "..." : ""}` },
3222
3224
  o
3223
3225
  );
@@ -3239,7 +3241,7 @@ async function Mn(e, t, r, a, o) {
3239
3241
  });
3240
3242
  if (s.type === "success") {
3241
3243
  const c = s.processedResult, d = Array.from(c.values());
3242
- return await g(
3244
+ return await m(
3243
3245
  {
3244
3246
  text: `Query Results parsed into ${d.length} unique relationships and entities. Atempting to add to link chart...`
3245
3247
  },
@@ -3254,10 +3256,10 @@ Explanation: ${i}`;
3254
3256
  );
3255
3257
  }
3256
3258
  async function Ue({ prompt: e }, t) {
3257
- const { knowledgeGraph: r } = await te(t), { linkChartView: a } = ee(t), n = M.getDefault().helperServices, i = await F("arcgis_knowledge_current_lc_context"), s = zn(a.map, r), c = `${e}
3259
+ const { knowledgeGraph: r } = await te(t), { linkChartView: a } = ee(t), n = z.getDefault().helperServices, i = await F("arcgis_knowledge_current_lc_context"), s = Mn(a.map, r), c = `${e}
3258
3260
 
3259
3261
  ${i}${JSON.stringify(s)}`;
3260
- return await Mn(
3262
+ return await zn(
3261
3263
  c,
3262
3264
  r,
3263
3265
  `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
@@ -3267,7 +3269,7 @@ ${i}${JSON.stringify(s)}`;
3267
3269
  }
3268
3270
  const Dn = l.object({
3269
3271
  prompt: l.string().describe("The user's inquiry into the knowledge graph that needs to be run.")
3270
- }), Be = w(Ue, {
3272
+ }), Be = b(Ue, {
3271
3273
  name: "addRecords",
3272
3274
  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.",
3273
3275
  schema: Dn
@@ -3293,21 +3295,21 @@ const Pn = l.object({
3293
3295
  ]).describe(
3294
3296
  "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"
3295
3297
  )
3296
- }), On = w(jn, {
3298
+ }), Gn = b(jn, {
3297
3299
  name: "applyLayout",
3298
3300
  description: "Apply a diagram layout to the link chart",
3299
3301
  schema: Pn
3300
3302
  });
3301
- function Gn(e, t) {
3303
+ function On(e, t) {
3302
3304
  return t.map.changeNonspatialDataDisplay(e), `Successfully applied nonspatial visibility setting: ${e}.`;
3303
3305
  }
3304
3306
  function Vn({ setting: e }, t) {
3305
3307
  const { linkChartView: r } = ee(t);
3306
- return Gn(e, r);
3308
+ return On(e, r);
3307
3309
  }
3308
3310
  const Kn = l.object({
3309
3311
  setting: l.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
3310
- }), Wn = w(Vn, {
3312
+ }), Wn = b(Vn, {
3311
3313
  name: "changeNonspatialVisibility",
3312
3314
  description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
3313
3315
  schema: Kn
@@ -3319,20 +3321,20 @@ async function Qn(e, t, r, a, o) {
3319
3321
  r,
3320
3322
  o
3321
3323
  );
3322
- await g({ text: `Attempting to create link chart from derived query: ${n}` }, o);
3324
+ await m({ text: `Attempting to create link chart from derived query: ${n}` }, o);
3323
3325
  const s = await Lt.fromCypherQuery(
3324
3326
  t,
3325
3327
  new le({
3326
3328
  openCypherQuery: n
3327
3329
  })
3328
3330
  );
3329
- return await g({ text: "Link chart created successfully, loading..." }, o), a.map = s, await s.load(), await a.when(), `Link chart created successfully. Cypher Query used to create the link chart:
3331
+ return await m({ text: "Link chart created successfully, loading..." }, o), a.map = s, await s.load(), await a.when(), `Link chart created successfully. Cypher Query used to create the link chart:
3330
3332
  ${n}
3331
3333
 
3332
3334
  Explanation: ${i}`;
3333
3335
  }
3334
3336
  async function He({ prompt: e }, t) {
3335
- const { knowledgeGraph: r } = await te(t), { linkChartView: a } = ee(t), n = M.getDefault().helperServices;
3337
+ const { knowledgeGraph: r } = await te(t), { linkChartView: a } = ee(t), n = z.getDefault().helperServices;
3336
3338
  return await Qn(
3337
3339
  e,
3338
3340
  r,
@@ -3345,19 +3347,19 @@ const Un = l.object({
3345
3347
  prompt: l.string().describe(
3346
3348
  "The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization."
3347
3349
  )
3348
- }), Ze = w(He, {
3350
+ }), Ze = b(He, {
3349
3351
  name: "createLinkChart",
3350
3352
  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.",
3351
3353
  schema: Un
3352
3354
  });
3353
3355
  async function Bn({ prompt: e }, t) {
3354
- const { knowledgeGraph: r } = await te(t), o = M.getDefault().helperServices, { graphQuery: n } = await re(
3356
+ const { knowledgeGraph: r } = await te(t), o = z.getDefault().helperServices, { graphQuery: n } = await re(
3355
3357
  e,
3356
3358
  r.dataModel,
3357
3359
  `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
3358
3360
  t
3359
3361
  );
3360
- await g({ text: "Attempting to execute the generated cypher query..." }, t);
3362
+ await m({ text: "Attempting to execute the generated cypher query..." }, t);
3361
3363
  const i = await Qe({
3362
3364
  kg: r,
3363
3365
  queryParams: new le({
@@ -3380,7 +3382,7 @@ async function Bn({ prompt: e }, t) {
3380
3382
  u += `| ${d.map(() => "---").join(" | ")} |
3381
3383
  `;
3382
3384
  for (const p of s) {
3383
- const h = p.map((f) => typeof f == "object" ? JSON.stringify(f) : String(f));
3385
+ const h = p.map((w) => typeof w == "object" ? JSON.stringify(w) : String(w));
3384
3386
  u += `| ${h.join(" | ")} |
3385
3387
  `;
3386
3388
  }
@@ -3403,13 +3405,13 @@ REQUEST LIMIT: If the user does not specifically request for no limits or an exp
3403
3405
 
3404
3406
  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.`
3405
3407
  )
3406
- }), Zn = w(Bn, {
3408
+ }), Zn = b(Bn, {
3407
3409
  name: "queryGraphData",
3408
3410
  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?'.",
3409
3411
  schema: Hn
3410
3412
  });
3411
3413
  async function Je({ prompt: e }, t) {
3412
- const { knowledgeGraph: r } = await te(t), o = M.getDefault().helperServices;
3414
+ const { knowledgeGraph: r } = await te(t), o = z.getDefault().helperServices;
3413
3415
  return await qn(
3414
3416
  e,
3415
3417
  r.dataModel,
@@ -3419,12 +3421,12 @@ async function Je({ prompt: e }, t) {
3419
3421
  }
3420
3422
  const Jn = l.object({
3421
3423
  prompt: l.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
3422
- }), he = w(Je, {
3424
+ }), he = b(Je, {
3423
3425
  name: "generateCypher",
3424
3426
  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.",
3425
3427
  schema: Jn
3426
3428
  }), me = [
3427
- On,
3429
+ Gn,
3428
3430
  Wn,
3429
3431
  he,
3430
3432
  Ze,
@@ -3461,7 +3463,7 @@ async function es(e, t) {
3461
3463
  t
3462
3464
  ), o = a.messages.map((n) => n.text).join(`
3463
3465
  `);
3464
- return await g({ text: `Finished executing ArcGIS Knowledge Agent tool: ${o}` }, t), {
3466
+ return await m({ text: `Finished executing ArcGIS Knowledge Agent tool: ${o}` }, t), {
3465
3467
  ...e,
3466
3468
  outputMessage: o,
3467
3469
  status: "success",
@@ -3470,7 +3472,7 @@ async function es(e, t) {
3470
3472
  };
3471
3473
  } catch (a) {
3472
3474
  const o = a instanceof Error ? a.message : String(a);
3473
- return await g({ text: `ArcGIS Knowledge Agent tool execution failed: ${o}` }, t), {
3475
+ return await m({ text: `ArcGIS Knowledge Agent tool execution failed: ${o}` }, t), {
3474
3476
  ...e,
3475
3477
  outputMessage: `ArcGIS Knowledge Agent tool execution failed: ${o}`,
3476
3478
  status: "failed",