@arcgis/ai-agents 5.0.7 → 5.0.9

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.
Files changed (2) hide show
  1. package/dist/index.js +36 -36
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import le from "@arcgis/core/geometry/Point.js";
6
6
  import Ne from "@arcgis/core/geometry/Extent.js";
7
7
  import dt from "@arcgis/core/symbols/PictureMarkerSymbol.js";
8
8
  import { addressToLocations as ut } from "@arcgis/core/rest/locator.js";
9
- import O from "@arcgis/core/portal/Portal.js";
9
+ import G from "@arcgis/core/portal/Portal.js";
10
10
  import ne from "@arcgis/core/config.js";
11
11
  import s, { z as k } from "zod";
12
12
  import { HumanMessage as ze, AIMessage as K } from "@langchain/core/messages";
@@ -85,9 +85,9 @@ ${r}`;
85
85
  })
86
86
  });
87
87
  async function Nt(e, t) {
88
- const o = O.getDefault().helperServices.geocode.find((Q) => Q.name === "ArcGIS World Geocoding Service");
88
+ const a = G.getDefault().helperServices, o = a.geocode.find((Q) => Q.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
89
89
  if (!o)
90
- throw new Error("ArcGIS World Geocoding Service not found in helperServices.");
90
+ throw new Error("No geocoding service found in helperServices.");
91
91
  const n = o.url, i = `${ne.assetsPath?.endsWith("/") ? ne.assetsPath : `${ne.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await ut(n, {
92
92
  address: { SingleLine: e },
93
93
  outFields: ["Match_addr"]
@@ -151,12 +151,12 @@ async function Dt({ bookmarkName: e }, t) {
151
151
  const { mapView: r } = I(t);
152
152
  return await Promise.resolve(Pt(e, r));
153
153
  }
154
- const Gt = k.object({
154
+ const Ot = k.object({
155
155
  bookmarkName: k.string().describe("The name of the bookmark to navigate to.")
156
- }), Ot = b(Dt, {
156
+ }), Gt = b(Dt, {
157
157
  name: "goToBookmark",
158
158
  description: "Go to the extent of the bookmark with the given name.",
159
- schema: Gt
159
+ schema: Ot
160
160
  });
161
161
  async function Qt(e, t, r) {
162
162
  const a = r.map?.allLayers.find((n) => n.id === e);
@@ -307,7 +307,7 @@ const yr = s.object({
307
307
  schema: yr
308
308
  }), me = [
309
309
  Mt,
310
- Ot,
310
+ Gt,
311
311
  Bt,
312
312
  Zt,
313
313
  er,
@@ -529,7 +529,7 @@ ${u.results.map((h) => ` - ${h.name} (${h.score.toFixed(2)})`).join(`
529
529
  description: Rr,
530
530
  createGraph: Fr,
531
531
  workspace: De
532
- }, Ge = g.Root({
532
+ }, Oe = g.Root({
533
533
  // Inputs coming from global context
534
534
  messages: g({
535
535
  reducer: z,
@@ -730,7 +730,7 @@ const re = async (e, t) => {
730
730
  where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
731
731
  distance: s.number().optional().describe("The buffer distance around the geometry."),
732
732
  units: A.optional().describe("The units for the distance buffer.")
733
- }), Gr = s.object({
733
+ }), Or = s.object({
734
734
  point: s.object({
735
735
  x: s.number().describe("X coordinate (longitude) from navigation result"),
736
736
  y: s.number().describe("Y coordinate (latitude) from navigation result"),
@@ -740,12 +740,12 @@ const re = async (e, t) => {
740
740
  }).describe("Point coordinates from a previous navigation/geocoding result"),
741
741
  distance: s.number().optional().describe("Optional buffer distance around the point."),
742
742
  units: A.optional().describe("The units for the distance buffer.")
743
- }), Or = s.object({
743
+ }), Gr = s.object({
744
744
  targetLayer: s.object({
745
745
  layerId: s.string().describe("The layerId of the layer on which to set a feature effect."),
746
746
  where: s.string().describe("The SQL-92 where clause representing the features to emphasize.")
747
747
  }),
748
- geometryFilter: s.union([Dr, Gr]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
748
+ geometryFilter: s.union([Dr, Or]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
749
749
  useCurrentExtent: s.boolean().optional().describe(
750
750
  "Set to true when the previous query used the current map extent as a spatial filter. This ensures the feature effect applies only to features visible in the current view. Default is false."
751
751
  ),
@@ -758,7 +758,7 @@ const re = async (e, t) => {
758
758
  }), Qr = b(Pr, {
759
759
  name: "setFeatureEffect",
760
760
  description: "Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",
761
- schema: Or
761
+ schema: Gr
762
762
  }), ee = (e, t, r) => {
763
763
  if (e && typeof e != "function") {
764
764
  const a = "getField" in r && r.getField?.(e), o = a && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(a.name) : null;
@@ -858,9 +858,9 @@ const Hr = async (e) => {
858
858
  field: r,
859
859
  sqlWhere: te(l.definitionExpression, t.where),
860
860
  ...f && { filter: f }
861
- })).uniqueValueInfos.sort((G, it) => it.count - G.count).slice(0, E)), w && u.domain?.type === "coded-value" && (w = w.map((G) => ({
862
- ...G,
863
- value: V ? V.getName(G.value) ?? G.value : G.value
861
+ })).uniqueValueInfos.sort((O, it) => it.count - O.count).slice(0, E)), w && u.domain?.type === "coded-value" && (w = w.map((O) => ({
862
+ ...O,
863
+ value: V ? V.getName(O.value) ?? O.value : O.value
864
864
  })));
865
865
  } catch (v) {
866
866
  console.error("Statistics error:", v);
@@ -1192,7 +1192,7 @@ USE THIS TOOL FOR:
1192
1192
 
1193
1193
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1194
1194
  schema: ua
1195
- }), Oe = [Ur, ea, sa, ha], Qe = [Qr, zr, Ar], ae = () => {
1195
+ }), Ge = [Ur, ea, sa, ha], Qe = [Qr, zr, Ar], ae = () => {
1196
1196
  const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), t = e <= 0 ? "+" : "-", r = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), a = (Math.abs(e) % 60).toString().padStart(2, "0"), o = `${t}${r}:${a}`;
1197
1197
  return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
1198
1198
  }, ma = async (e, t) => {
@@ -1234,7 +1234,7 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1234
1234
  modelTier: "advanced",
1235
1235
  messages: x(e.messages),
1236
1236
  inputVariables: i,
1237
- tools: Oe
1237
+ tools: Ge
1238
1238
  }), c = [...e.messages, l], d = l.content.toString();
1239
1239
  return await H(l, t), { ...e, messages: c, outputMessage: d };
1240
1240
  }, ya = async (e, t) => {
@@ -1276,7 +1276,7 @@ async function fa(e, t) {
1276
1276
  const i = [...o, ...n];
1277
1277
  return { ...e, messages: i };
1278
1278
  }
1279
- const ga = new P(Oe);
1279
+ const ga = new P(Ge);
1280
1280
  async function wa(e, t) {
1281
1281
  const { messages: r } = await ga.invoke({ messages: x(e.messages) }, t), a = [], o = [];
1282
1282
  for (const i of r) {
@@ -1428,7 +1428,7 @@ ${c}` : d = "Vector search completed. No matching layers found.", await m({ text
1428
1428
  }, Ra = (e, t) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
1429
1429
  e,
1430
1430
  t
1431
- ), La = () => new _(Ge).addNode("requireDataExplorationServices", Ra).addNode("vectorSearchLayers", Fa).addNode("vectorSearchFields", Ea).addNode("fieldStatistics", Ta).addNode("queryAgent", pa).addNode("queryTools", wa).addNode("summarizeQueryResponseLLM", ya).addNode("filterAgent", ma).addNode("filterTools", fa).addNode("earlyExit", Lr).addEdge(j, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1431
+ ), La = () => new _(Oe).addNode("requireDataExplorationServices", Ra).addNode("vectorSearchLayers", Fa).addNode("vectorSearchFields", Ea).addNode("fieldStatistics", Ta).addNode("queryAgent", pa).addNode("queryTools", wa).addNode("summarizeQueryResponseLLM", ya).addNode("filterAgent", ma).addNode("filterTools", fa).addNode("earlyExit", Lr).addEdge(j, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
1432
1432
  "vectorSearchLayers",
1433
1433
  (t) => t.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
1434
1434
  ).addConditionalEdges(
@@ -1450,7 +1450,7 @@ ${c}` : d = "Vector search completed. No matching layers found.", await m({ text
1450
1450
  name: "Data Exploration Agent",
1451
1451
  description: Ia,
1452
1452
  createGraph: La,
1453
- workspace: Ge
1453
+ workspace: Oe
1454
1454
  }, Ie = 0.7, qa = 10, Ca = async (e, t) => {
1455
1455
  try {
1456
1456
  const r = C(e.messages);
@@ -1630,13 +1630,13 @@ const Na = async (e, t) => {
1630
1630
  r ? r.layerId : e.layerId,
1631
1631
  r ? r.where : e.where
1632
1632
  ), `Applied feature filter to layer "${a.title ?? e.layerId}"${r ? ` using geometry from layer "${r.layerId}"` : ""}.`;
1633
- }, Ga = async ({
1633
+ }, Oa = async ({
1634
1634
  targetLayer: e,
1635
1635
  geometryLayer: t
1636
1636
  }, r) => {
1637
1637
  const { mapView: a } = fe(r);
1638
1638
  return await Da(e, a, t);
1639
- }, Oa = s.object({
1639
+ }, Ga = s.object({
1640
1640
  targetLayer: s.object({
1641
1641
  layerId: s.string().describe("The layerId of the layer on which to set a filter."),
1642
1642
  where: s.string().describe("The SQL-92 where clause representing the features to display.")
@@ -1649,10 +1649,10 @@ const Na = async (e, t) => {
1649
1649
  distance: s.number().describe("The distance by which to filter the input geometry."),
1650
1650
  units: Ke.describe("The units used to filter by geometry and distance.")
1651
1651
  }).optional().describe("Optional geometry-based filtering parameters for spatial queries.")
1652
- }), Qa = b(Ga, {
1652
+ }), Qa = b(Oa, {
1653
1653
  name: "setFeatureFilter",
1654
1654
  description: "Sets a client-side filter using a where clause, geometry filter, or both on a target layer. This filters features at the client level in the view.",
1655
- schema: Oa
1655
+ schema: Ga
1656
1656
  }), Ue = [Pa, Qa], Va = async (e, t) => {
1657
1657
  await m({ text: "Requesting LLM for layer filter results" }, t);
1658
1658
  const a = await F("layer_filter_prompt");
@@ -2351,10 +2351,10 @@ function Do(e) {
2351
2351
  colorScheme: l
2352
2352
  };
2353
2353
  }
2354
- async function Go(e) {
2354
+ async function Oo(e) {
2355
2355
  return await gt(e);
2356
2356
  }
2357
- async function Oo({
2357
+ async function Go({
2358
2358
  arcgisMap: e,
2359
2359
  arcgisMapView: t,
2360
2360
  layerId: r,
@@ -2374,7 +2374,7 @@ async function Oo({
2374
2374
  theme: n
2375
2375
  };
2376
2376
  try {
2377
- const d = Do(c), u = await Go(d);
2377
+ const d = Do(c), u = await Oo(d);
2378
2378
  return l.renderer = u.renderer, l.visible = !0, `Color-age renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
2379
2379
  } catch (d) {
2380
2380
  return `Error applying color-age renderer: ${d instanceof Error ? d.message : String(d)}`;
@@ -2387,7 +2387,7 @@ async function Qo({
2387
2387
  theme: a
2388
2388
  }, o) {
2389
2389
  const { mapView: n } = q(o);
2390
- return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Oo({
2390
+ return await L({ id: "show-legend", description: "Show Legend", payload: { layerIds: [e] } }, o), await Go({
2391
2391
  arcgisMap: n.map,
2392
2392
  arcgisMapView: n,
2393
2393
  layerId: e,
@@ -3022,7 +3022,7 @@ const Pn = s.object({
3022
3022
  Fields: This style requires a single field with a date type.`,
3023
3023
  schema: Pn
3024
3024
  });
3025
- function Gn(e) {
3025
+ function On(e) {
3026
3026
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], i = t[1], l = t[2];
3027
3027
  let c;
3028
3028
  return o && (c = Ct({
@@ -3039,7 +3039,7 @@ function Gn(e) {
3039
3039
  typeScheme: c
3040
3040
  };
3041
3041
  }
3042
- async function On(e) {
3042
+ async function Gn(e) {
3043
3043
  return await qt(e);
3044
3044
  }
3045
3045
  async function Qn({
@@ -3062,7 +3062,7 @@ async function Qn({
3062
3062
  theme: n
3063
3063
  };
3064
3064
  try {
3065
- const d = Gn(c), u = await On(d);
3065
+ const d = On(c), u = await Gn(d);
3066
3066
  return l.renderer = u.renderer, l.visible = !0, `Type renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
3067
3067
  } catch (d) {
3068
3068
  return `Error applying type renderer: ${d instanceof Error ? d.message : String(d)}`;
@@ -3526,7 +3526,7 @@ async function Se(e, t, r, a) {
3526
3526
  body: JSON.stringify(o),
3527
3527
  headers: {
3528
3528
  "Content-Type": "application/json",
3529
- token: $e.findCredential(O.getDefault().url)?.token ?? ""
3529
+ token: $e.findCredential(G.getDefault().url)?.token ?? ""
3530
3530
  }
3531
3531
  });
3532
3532
  if (n.httpStatus !== 200)
@@ -3551,7 +3551,7 @@ async function Se(e, t, r, a) {
3551
3551
  }),
3552
3552
  headers: {
3553
3553
  "Content-Type": "application/json",
3554
- token: $e.findCredential(O.getDefault().url)?.token ?? ""
3554
+ token: $e.findCredential(G.getDefault().url)?.token ?? ""
3555
3555
  }
3556
3556
  });
3557
3557
  if (p.httpStatus !== 200)
@@ -3645,7 +3645,7 @@ ${n}
3645
3645
  Explanation: ${i}`;
3646
3646
  }
3647
3647
  async function rt({ prompt: e }, t) {
3648
- const { knowledgeGraph: r } = we(t), { linkChartView: a } = oe(t), n = O.getDefault().helperServices, i = await F("arcgis_knowledge_current_lc_context"), l = ws(a.map, r), c = `${e}
3648
+ const { knowledgeGraph: r } = we(t), { linkChartView: a } = oe(t), n = G.getDefault().helperServices, i = await F("arcgis_knowledge_current_lc_context"), l = ws(a.map, r), c = `${e}
3649
3649
 
3650
3650
  ${i}${JSON.stringify(l)}`;
3651
3651
  return await Ss(
@@ -3723,7 +3723,7 @@ ${n}
3723
3723
  Explanation: ${i}`;
3724
3724
  }
3725
3725
  async function ot({ prompt: e }, t) {
3726
- const { knowledgeGraph: r } = we(t), { linkChartView: a } = oe(t), n = O.getDefault().helperServices;
3726
+ const { knowledgeGraph: r } = we(t), { linkChartView: a } = oe(t), n = G.getDefault().helperServices;
3727
3727
  return await qs(
3728
3728
  e,
3729
3729
  r,
@@ -3742,7 +3742,7 @@ const Cs = s.object({
3742
3742
  schema: Cs
3743
3743
  });
3744
3744
  async function st({ prompt: e }, t) {
3745
- const { knowledgeGraph: r } = we(t), o = O.getDefault().helperServices;
3745
+ const { knowledgeGraph: r } = we(t), o = G.getDefault().helperServices;
3746
3746
  return await ps(
3747
3747
  e,
3748
3748
  r.dataModel,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcgis/ai-agents",
3
- "version": "5.0.7",
3
+ "version": "5.0.9",
4
4
  "description": "ArcGIS AI Agents Package",
5
5
  "homepage": "https://developers.arcgis.com/javascript/latest/",
6
6
  "type": "module",
@@ -20,7 +20,7 @@
20
20
  "@langchain/langgraph": "^1.1.2",
21
21
  "tslib": "^2.8.1",
22
22
  "zod": "^3.25.76",
23
- "@arcgis/ai-orchestrator": "5.0.7"
23
+ "@arcgis/ai-orchestrator": "5.0.9"
24
24
  },
25
25
  "peerDependencies": {
26
26
  "@arcgis/core": "^5.0.0"