@arcgis/ai-components 5.2.0-next.72 → 5.2.0-next.74

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 (147) hide show
  1. package/dist/agent-utils/LLMAgent.d.ts +5 -2
  2. package/dist/agent-utils/LLMAgent.js +1 -1
  3. package/dist/agentic-workflow/jsonTypes.d.ts +8 -1
  4. package/dist/agentic-workflow/nodes/AgentNode.d.ts +2 -0
  5. package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
  6. package/dist/cdn/253R5CBD.js +2 -0
  7. package/dist/cdn/2VBPA27M.js +18 -0
  8. package/dist/cdn/{DWYODVWW.js → 323DHVYA.js} +5 -5
  9. package/dist/cdn/34O57OGV.js +2 -0
  10. package/dist/cdn/{FSMHR7GK.js → 4HDDRBIY.js} +1 -1
  11. package/dist/cdn/4MFEKBKL.js +11 -0
  12. package/dist/cdn/{Y5UFOH54.js → 4NJ2FF7H.js} +1 -1
  13. package/dist/cdn/4YXYLX4H.js +2 -0
  14. package/dist/cdn/5DVRVY4L.js +2 -0
  15. package/dist/cdn/5PJXNTLZ.js +2 -0
  16. package/dist/cdn/5R6QUF5B.js +2 -0
  17. package/dist/cdn/5RVELJU4.js +36 -0
  18. package/dist/cdn/5WLNL4HZ.js +2 -0
  19. package/dist/cdn/66SKMECC.js +2 -0
  20. package/dist/cdn/6CLF7KIK.js +2 -0
  21. package/dist/cdn/{S6ZAQRC6.js → 6KFMRBAA.js} +1 -1
  22. package/dist/cdn/77QFSIWW.js +5 -0
  23. package/dist/cdn/7E2QMWK6.js +2 -0
  24. package/dist/cdn/{HO2YDJI2.js → 7M6VKBTK.js} +1 -1
  25. package/dist/cdn/{HJG7QM2R.js → 7VAQUCBU.js} +1 -1
  26. package/dist/cdn/ACJTJLZN.js +2 -0
  27. package/dist/cdn/AI6DYOKR.js +181 -0
  28. package/dist/cdn/AT4XVTJR.js +44 -0
  29. package/dist/cdn/BS2PFNU4.js +2 -0
  30. package/dist/cdn/CCC6LBMY.js +2 -0
  31. package/dist/cdn/CGXQAB3A.js +2 -0
  32. package/dist/cdn/{M3MRIGDZ.js → CP5BVGJU.js} +1 -1
  33. package/dist/cdn/CWD37QFT.js +2 -0
  34. package/dist/cdn/DY36ATOA.js +2 -0
  35. package/dist/cdn/DYASSC7Z.js +2 -0
  36. package/dist/cdn/EAEQONP7.js +2 -0
  37. package/dist/cdn/EMLOVMD4.js +2 -0
  38. package/dist/cdn/EWLXNGKH.js +208 -0
  39. package/dist/cdn/FAR3DFFK.js +2 -0
  40. package/dist/cdn/FDOMMK2M.js +2 -0
  41. package/dist/cdn/GRHIFCQX.js +2 -0
  42. package/dist/cdn/{S3XUYAUX.js → HHFNQR6Z.js} +1 -1
  43. package/dist/cdn/{WQKNV6KK.js → HMUWQCXU.js} +1 -1
  44. package/dist/cdn/HZ5ARNAM.js +2 -0
  45. package/dist/cdn/I6PD2HSL.js +2 -0
  46. package/dist/cdn/IDUC4CPV.js +2 -0
  47. package/dist/cdn/IRNSIUBT.js +2 -0
  48. package/dist/cdn/{OYNIFMCJ.js → J6SZIQJA.js} +1 -1
  49. package/dist/cdn/K335IAIE.js +2 -0
  50. package/dist/cdn/K33MZ726.js +2 -0
  51. package/dist/cdn/KA3FF3ZO.js +2 -0
  52. package/dist/cdn/{DBHLKLKM.js → KPO4XX6J.js} +1 -1
  53. package/dist/cdn/{I4L45WQS.js → L7XTRDFM.js} +1 -1
  54. package/dist/cdn/LCFIADOZ.js +2 -0
  55. package/dist/cdn/MDM2K3U7.js +2 -0
  56. package/dist/cdn/MM33KJPF.js +2 -0
  57. package/dist/cdn/NIY32GK2.js +2 -0
  58. package/dist/cdn/{3ZPPYCNL.js → ONMNQBPO.js} +1 -1
  59. package/dist/cdn/ONQ6JSBJ.js +2 -0
  60. package/dist/cdn/{6QJFOL6M.js → OWTGH34K.js} +1 -1
  61. package/dist/cdn/{XPTCV6YV.js → PSYRZMX2.js} +1 -1
  62. package/dist/cdn/Q4IQUEZN.js +14 -0
  63. package/dist/cdn/QNNGPA3Q.js +2 -0
  64. package/dist/cdn/QRHZXLZN.js +2 -0
  65. package/dist/cdn/QVOMX3R6.js +2 -0
  66. package/dist/cdn/QZ3NQTNQ.js +2 -0
  67. package/dist/cdn/RADWN4ZP.js +2 -0
  68. package/dist/cdn/RU2T7GUX.js +2 -0
  69. package/dist/cdn/S6OYR4VI.js +156 -0
  70. package/dist/cdn/T2GJLEYV.js +2 -0
  71. package/dist/cdn/TKYI5QRL.js +2 -0
  72. package/dist/cdn/{5SFZS2RD.js → TQXLSW4A.js} +2 -2
  73. package/dist/cdn/{NJJYZP3R.js → U6FBRUM4.js} +1 -1
  74. package/dist/cdn/UIXX3XEN.js +2 -0
  75. package/dist/cdn/UPWAOZXQ.js +2 -0
  76. package/dist/cdn/{5SF6DEMO.js → VNJMTA6O.js} +1 -1
  77. package/dist/cdn/VOKXKU7M.js +56 -0
  78. package/dist/cdn/{33BF35AO.js → VYTYVWR6.js} +4 -4
  79. package/dist/cdn/WMZ24LWS.js +2 -0
  80. package/dist/cdn/{JYVBCHR6.js → WP7ORLSB.js} +1 -1
  81. package/dist/cdn/WS3T73IY.js +2 -0
  82. package/dist/cdn/{UZL6UVE4.js → ZLWWWTH4.js} +1 -1
  83. package/dist/cdn/{PAUIFUMO.js → ZQMBJ6MI.js} +1 -1
  84. package/dist/cdn/agent-utils/index.js +1 -1
  85. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
  86. package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
  87. package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
  88. package/dist/cdn/index.js +1 -1
  89. package/dist/chunks/adapter.js +938 -1938
  90. package/dist/chunks/adapter10.js +21 -0
  91. package/dist/chunks/adapter11.js +30 -0
  92. package/dist/chunks/adapter12.js +22 -0
  93. package/dist/chunks/adapter13.js +22 -0
  94. package/dist/chunks/adapter14.js +109 -0
  95. package/dist/chunks/adapter15.js +40 -0
  96. package/dist/chunks/adapter16.js +154 -0
  97. package/dist/chunks/adapter17.js +141 -0
  98. package/dist/chunks/adapter18.js +127 -0
  99. package/dist/chunks/adapter2.js +52 -0
  100. package/dist/chunks/adapter3.js +30 -0
  101. package/dist/chunks/adapter4.js +50 -0
  102. package/dist/chunks/adapter5.js +27 -0
  103. package/dist/chunks/adapter6.js +24 -0
  104. package/dist/chunks/adapter7.js +26 -0
  105. package/dist/chunks/adapter8.js +21 -0
  106. package/dist/chunks/adapter9.js +42 -0
  107. package/dist/chunks/arcgisKnowledgeGraph.js +5 -5
  108. package/dist/chunks/dataExplorationGraph.js +30 -27
  109. package/dist/chunks/fetchAgentContext.js +13 -0
  110. package/dist/chunks/fetchService.js +10 -0
  111. package/dist/chunks/formatFeatureAttributes.js +132 -0
  112. package/dist/chunks/generateLayerDescriptions.js +145 -148
  113. package/dist/chunks/helpGraph.js +11 -9
  114. package/dist/chunks/layerStylingGraph.js +22 -21
  115. package/dist/chunks/mergeWhereClauses.js +15 -0
  116. package/dist/chunks/navigationGraph.js +68 -57
  117. package/dist/chunks/types.js +59 -0
  118. package/dist/components/arcgis-assistant-agent/customElement.js +404 -279
  119. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +15 -5
  120. package/dist/components/arcgis-assistant-help-agent/customElement.js +21 -5
  121. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +39 -22
  122. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +22 -5
  123. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +13 -5
  124. package/dist/docs/api.json +1 -1
  125. package/dist/docs/docs.json +1 -1
  126. package/dist/docs/web-types.json +1 -1
  127. package/dist/types/stencil.d.ts +2 -2
  128. package/dist/utils/index.d.ts +4 -5
  129. package/dist/utils/index.js +19 -20
  130. package/package.json +8 -8
  131. package/dist/cdn/55M2HE4U.js +0 -2
  132. package/dist/cdn/5RZGG4F2.js +0 -2
  133. package/dist/cdn/BAB3MK4Y.js +0 -2
  134. package/dist/cdn/BMBV6Y2A.js +0 -2
  135. package/dist/cdn/D3RKQSWS.js +0 -2
  136. package/dist/cdn/E7KEOJZG.js +0 -208
  137. package/dist/cdn/IGQFAL3H.js +0 -2
  138. package/dist/cdn/LUY6V4TP.js +0 -181
  139. package/dist/cdn/NSXX2KYS.js +0 -2
  140. package/dist/cdn/OFRFP4BX.js +0 -2
  141. package/dist/cdn/OUFGJV3R.js +0 -2
  142. package/dist/cdn/RWM5T4XB.js +0 -180
  143. package/dist/cdn/SRFLL6ET.js +0 -2
  144. package/dist/cdn/WDOM6Z5O.js +0 -18
  145. package/dist/cdn/WZFC5HUX.js +0 -56
  146. package/dist/cdn/Z4XUJQ2I.js +0 -36
  147. package/dist/cdn/ZJEWP2ND.js +0 -44
@@ -0,0 +1,127 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { tool as v } from "@langchain/core/tools";
3
+ import { a as C } from "./formatFeatureAttributes.js";
4
+ import { g as O, i as S, a as F, d as I } from "./types.js";
5
+ import { c as j, m as N } from "./mergeWhereClauses.js";
6
+ import t from "zod";
7
+ import { f as R } from "./fetchAgentContext.js";
8
+ const p = 25, x = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map((r) => r.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((r) => !!r), W = async (i, r, e, f) => {
9
+ const a = r.map?.allLayers.find((u) => u.id === i.layerId), l = await r.whenLayerView(a), y = a.title ?? i.layerId;
10
+ let c;
11
+ if (e) {
12
+ const u = await O(e, r);
13
+ if ("error" in u) {
14
+ const s = { error: u.error };
15
+ if (S(e)) {
16
+ const d = r.map?.allLayers.find((m) => m.id === e.layerId);
17
+ s.geometryLayerName = d?.title ?? d?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
18
+ } else F(e) && (s.point = e.point);
19
+ return {
20
+ tool: "queryFeatures",
21
+ layerName: y,
22
+ summary: "Geometry lookup failed",
23
+ details: s
24
+ };
25
+ }
26
+ if (!u.geometry) {
27
+ const s = {};
28
+ if (S(e)) {
29
+ const d = r.map?.allLayers.find((m) => m.id === e.layerId);
30
+ s.error = `No features found matching: ${e.where}`, s.geometryLayerName = d?.title ?? d?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
31
+ } else F(e) && (s.error = "Failed to create point geometry", s.point = e.point);
32
+ return {
33
+ tool: "queryFeatures",
34
+ layerName: y,
35
+ summary: "No features found for geometry filter",
36
+ details: s
37
+ };
38
+ }
39
+ c = u.geometry;
40
+ } else f && (c = r.extent.clone());
41
+ const T = [
42
+ .../* @__PURE__ */ new Set([...i.outFields, ...x(i.orderByFields)])
43
+ ], b = j(l, T, f ?? !1), w = a.objectIdField, o = a.createQuery();
44
+ o.where = N(a.definitionExpression, i.where || "1=1"), o.outFields = i.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...i.outFields, w])], o.orderByFields = i.orderByFields, c && (o.geometry = c, o.spatialRelationship = "intersects"), e?.distance && (o.distance = e.distance), e?.units && (o.units = e.units), o.outSpatialReference = r.spatialReference;
45
+ let n, h;
46
+ try {
47
+ n = b ? await l.queryFeatureCount(o) : await a.queryFeatureCount(o), n > 0 && n <= p && (h = b ? await l.queryFeatures(o) : await a.queryFeatures(o));
48
+ } catch (u) {
49
+ console.warn("Client-side query failed, falling back to server:", u), n = await a.queryFeatureCount(o), n > 0 && n <= p && (h = await a.queryFeatures(o));
50
+ }
51
+ const { objectIds: g, attributes: q } = h ? C(a, h, r.timeZone) : { objectIds: void 0, attributes: void 0 };
52
+ return {
53
+ tool: "queryFeatures",
54
+ layerName: y,
55
+ summary: `${n} features found`,
56
+ details: {
57
+ totalCount: n,
58
+ where: i.where,
59
+ orderByFields: i.orderByFields,
60
+ outFields: i.outFields,
61
+ ...g && { objectIds: g, objectIdField: w },
62
+ ...q && { attributes: q },
63
+ ...n > p && {
64
+ note: `${n} features found.`
65
+ }
66
+ }
67
+ };
68
+ };
69
+ async function B({
70
+ targetLayer: i,
71
+ geometryFilter: r,
72
+ useCurrentExtent: e
73
+ }, f) {
74
+ const { mapView: a } = R(f, ["mapView"]), l = await W(i, a, r, e);
75
+ return JSON.stringify(l, null, 2);
76
+ }
77
+ const G = t.object({
78
+ layerId: t.string().describe("The layerId of the layer containing the geometry by which to filter."),
79
+ where: t.string().describe("The SQL-92 where clause representing the features from which to filter."),
80
+ distance: t.number().optional().describe("The buffer distance around the geometry."),
81
+ units: I.optional().describe("The units for the distance buffer.")
82
+ }), k = t.object({
83
+ point: t.object({
84
+ x: t.number().describe("X coordinate (longitude) from navigation result"),
85
+ y: t.number().describe("Y coordinate (latitude) from navigation result"),
86
+ spatialReference: t.object({
87
+ wkid: t.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
88
+ }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
89
+ }).describe("Point coordinates from a previous navigation/geocoding result"),
90
+ distance: t.number().optional().describe("Optional buffer distance around the point."),
91
+ units: I.optional().describe("The units for the distance buffer.")
92
+ }), L = t.object({
93
+ targetLayer: t.object({
94
+ layerId: t.string().describe("The layerId of the layer containing the field from which to get a value."),
95
+ where: t.string().describe(
96
+ "SQL-92 where clause. IMPORTANT: When using geometryFilter.point for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."
97
+ ),
98
+ orderByFields: t.array(t.string().describe("The field(s) and order for which to sort the resulting features.")),
99
+ outFields: t.array(
100
+ t.string().describe(
101
+ 'The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").'
102
+ ).default("*")
103
+ )
104
+ }),
105
+ geometryFilter: t.union([G, k]).optional().describe(
106
+ "Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
107
+ ),
108
+ useCurrentExtent: t.boolean().optional().describe(
109
+ "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)."
110
+ )
111
+ }), P = v(B, {
112
+ name: "queryFeatures",
113
+ description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
114
+
115
+ USE THIS TOOL FOR:
116
+ - "Show / display / list features where..." — finding and listing features
117
+ - "How many X are Y?" — counting features that match a condition
118
+ - "Which features..." / "Find features..." — identifying specific features
119
+ - Spatial queries — finding features near/within/intersecting other features
120
+ - Any question where the user wants to SEE or COUNT matching features
121
+
122
+ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
123
+ schema: L
124
+ });
125
+ export {
126
+ P as queryFeaturesTool
127
+ };
@@ -0,0 +1,52 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { tool as p } from "@langchain/core/tools";
3
+ import r from "@arcgis/core/config.js";
4
+ import f from "@arcgis/core/Graphic.js";
5
+ import u from "@arcgis/core/portal/Portal.js";
6
+ import { addressToLocations as S } from "@arcgis/core/rest/locator.js";
7
+ import v from "@arcgis/core/symbols/PictureMarkerSymbol.js";
8
+ import { f as w } from "./fetchAgentContext.js";
9
+ import c from "zod";
10
+ async function y(e, t) {
11
+ const a = u.getDefault().helperServices, n = a.geocode.find((h) => h.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
12
+ if (!n)
13
+ throw new Error("No geocoding service found in helperServices.");
14
+ const i = n.url, d = `${r.assetsPath?.endsWith("/") ? r.assetsPath : `${r.assetsPath}/`}esri/images/search/search-symbol-32.png`, o = (await S(i, {
15
+ address: { SingleLine: e },
16
+ outFields: ["Match_addr"]
17
+ }))?.[0];
18
+ if (!o?.extent || !o.location)
19
+ throw new Error(`Could not find location for: ${e}`);
20
+ const l = new v({
21
+ url: d,
22
+ width: 24,
23
+ height: 24
24
+ }), m = new f({
25
+ geometry: o.location,
26
+ symbol: l
27
+ });
28
+ t.graphics.removeAll(), t.graphics.add(m), await t.goTo(o.extent);
29
+ const g = {
30
+ address: o.address ?? "",
31
+ location: o.location ? o.location.toJSON() : null,
32
+ extent: o.extent ? o.extent.toJSON() : null
33
+ };
34
+ return {
35
+ text: `Successfully zoomed to ${e}.`,
36
+ sharedStatePatch: { lastResolvedLocation: { value: g } }
37
+ };
38
+ }
39
+ async function T({ address: e }, t) {
40
+ const { mapView: s } = w(t, ["mapView"]);
41
+ return await y(e, s);
42
+ }
43
+ const x = c.object({
44
+ address: c.string().describe("The full address or place name to locate.")
45
+ }), E = p(T, {
46
+ name: "goToAddress",
47
+ description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
48
+ schema: x
49
+ });
50
+ export {
51
+ E as goToAddressTool
52
+ };
@@ -0,0 +1,30 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { z as i } from "zod";
3
+ import { tool as k } from "@langchain/core/tools";
4
+ import { f as s } from "./fetchAgentContext.js";
5
+ async function c(o, t) {
6
+ const e = t.map.bookmarks;
7
+ if (!e || e.length === 0)
8
+ throw new Error("No bookmarks found in the map.");
9
+ const n = e.find((m) => m.name === o);
10
+ if (!n)
11
+ throw new Error(`Bookmark with name "${o}" not found.`);
12
+ const a = n.viewpoint;
13
+ if (!a)
14
+ throw new Error(`Bookmark with name "${o}" does not have a valid viewpoint.`);
15
+ return await t.goTo(a), { text: `Navigated to bookmark: ${o}` };
16
+ }
17
+ async function h({ bookmarkName: o }, t) {
18
+ const { mapView: r } = s(t, ["mapView"]);
19
+ return await Promise.resolve(c(o, r));
20
+ }
21
+ const w = i.object({
22
+ bookmarkName: i.string().describe("The name of the bookmark to navigate to.")
23
+ }), b = k(h, {
24
+ name: "goToBookmark",
25
+ description: "Go to the extent of the bookmark with the given name.",
26
+ schema: w
27
+ });
28
+ export {
29
+ b as goToBookmarkTool
30
+ };
@@ -0,0 +1,50 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { z as i } from "zod";
3
+ import { tool as u } from "@langchain/core/tools";
4
+ import { f as c } from "./fetchAgentContext.js";
5
+ async function f(o, a, n) {
6
+ const e = n.map?.allLayers.find((r) => r.id === o);
7
+ if (!e)
8
+ return { text: `Error: Layer with id ${o} not found` };
9
+ const t = a?.trim() ? a : "1=1", l = e.createQuery();
10
+ l.where = t;
11
+ try {
12
+ const { extent: r, count: s } = await e.queryExtent(l);
13
+ if (s === 0)
14
+ return { text: `No features found in ${e.title} matching: ${t}`, where: t };
15
+ if (r)
16
+ await n.goTo(r);
17
+ else
18
+ return { text: `Error: Unable to determine extent for ${e.title}`, where: t };
19
+ const d = {
20
+ layerId: o,
21
+ layerTitle: e.title ?? o,
22
+ where: t,
23
+ count: s
24
+ };
25
+ return {
26
+ text: `Successfully zoomed to ${s} feature(s) in ${e.title} matching: ${t}`,
27
+ where: t,
28
+ sharedStatePatch: { lastNavigatedFeatures: { value: d } }
29
+ };
30
+ } catch (r) {
31
+ return console.error("Error in goToFeatures:", r), { text: `Error: ${r instanceof Error ? r.message : "Unknown error"}`, where: t };
32
+ }
33
+ }
34
+ async function h({ layerId: o, where: a }, n) {
35
+ const { mapView: e } = c(n, ["mapView"]);
36
+ return await f(o, a, e);
37
+ }
38
+ const m = i.object({
39
+ layerId: i.string().describe("The layerId of the layer to zoom to."),
40
+ where: i.string().describe(
41
+ "ArcGIS SQL-92 WHERE expression used for `query.where` on the selected layer. Start with a fresh filter for the current request unless the task explicitly refers to prior results. Use only field name values from the selected layer, not aliases. Use field metadata only to interpret intent: prefer LIKE '%value%' for string fields, and use =, <, >, BETWEEN, IN, IS NULL, AND/OR/NOT as appropriate for number/date fields. For coded-value domain fields, use the domain code already provided in layerInfo.domain.codedValues, never the display label. Respect range-domain bounds when they are provided. Do NOT include subqueries, nested SELECT, JOIN, GROUP BY, HAVING, ORDER BY, or semicolons."
42
+ )
43
+ }), E = u(h, {
44
+ name: "goToFeatures",
45
+ description: "Go to the features that match the given filter for the given layerId. Use coded-value domain codes from layer field metadata when building the WHERE clause.",
46
+ schema: m
47
+ });
48
+ export {
49
+ E as goToFeaturesTool
50
+ };
@@ -0,0 +1,27 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { z as n } from "zod";
3
+ import r from "@arcgis/core/geometry/Extent.js";
4
+ import { tool as i } from "@langchain/core/tools";
5
+ import { f as l } from "./fetchAgentContext.js";
6
+ async function m(o) {
7
+ const t = new r({
8
+ xmin: -180,
9
+ ymin: -90,
10
+ xmax: 180,
11
+ ymax: 90,
12
+ spatialReference: { wkid: 4326 }
13
+ }).expand(0.7);
14
+ return await o.goTo(t), { text: "Successfully zoomed to world extent" };
15
+ }
16
+ async function a(o, e) {
17
+ const { mapView: t } = l(e, ["mapView"]);
18
+ return await m(t);
19
+ }
20
+ const c = n.object({}), f = i(a, {
21
+ name: "goToFullExtent",
22
+ description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
23
+ schema: c
24
+ });
25
+ export {
26
+ f as goToFullExtentTool
27
+ };
@@ -0,0 +1,24 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { tool as n } from "@langchain/core/tools";
3
+ import i from "zod";
4
+ import { f as r } from "./fetchAgentContext.js";
5
+ async function a(e) {
6
+ const t = e.map.initialViewProperties?.viewpoint?.targetGeometry;
7
+ if (t)
8
+ await e.goTo(t);
9
+ else
10
+ throw new Error("Initial extent is undefined");
11
+ return { text: "Successfully zoomed to home extent" };
12
+ }
13
+ async function m(e, o) {
14
+ const { mapView: t } = r(o, ["mapView"]);
15
+ return await a(t);
16
+ }
17
+ const c = i.object({}), w = n(m, {
18
+ name: "goToHomeExtent",
19
+ description: "Go to the initial web map view extent",
20
+ schema: c
21
+ });
22
+ export {
23
+ w as goToHomeExtentTool
24
+ };
@@ -0,0 +1,26 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import { z as r } from "zod";
3
+ import { tool as i } from "@langchain/core/tools";
4
+ import { f as c } from "./fetchAgentContext.js";
5
+ async function l(o, t) {
6
+ await t.when();
7
+ const e = t.map?.allLayers.find((n) => n.id === o);
8
+ if (!e)
9
+ return console.warn(`[goToLayer] No matching FeatureLayer found for: ${o}`), { text: `Could not find layer for: ${o}` };
10
+ let a;
11
+ return (e.type === "link-chart" || e.type === "knowledge-graph-sublayer") && t.map?.activeLinkChartLayer ? a = t.map.diagramNodesExtent : a = e.fullExtent, a ? (await t.goTo(a), e.visible = !0, { text: `Successfully zoomed to: ${e.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
12
+ }
13
+ async function f({ layerId: o }, t) {
14
+ const { mapView: e } = c(t, ["mapView"]);
15
+ return await l(o, e);
16
+ }
17
+ const s = r.object({
18
+ layerId: r.string().describe("The id of the layer to navigate to")
19
+ }), h = i(f, {
20
+ name: "goToLayer",
21
+ description: "Zooms the map view to the full extent of the top matching layer.",
22
+ schema: s
23
+ });
24
+ export {
25
+ h as goToLayerTool
26
+ };
@@ -0,0 +1,21 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import t from "zod";
3
+ import { tool as a } from "@langchain/core/tools";
4
+ import { f as i } from "./fetchAgentContext.js";
5
+ async function n(o, e) {
6
+ return await e.goTo({ scale: o }), { text: `Successfully zoomed to: ${o}` };
7
+ }
8
+ async function r({ scale: o }, e) {
9
+ const { mapView: c } = i(e, ["mapView"]);
10
+ return await n(o, c);
11
+ }
12
+ const m = t.object({
13
+ scale: t.number().describe("The map scale of the view to go to.")
14
+ }), f = a(r, {
15
+ name: "goToScale",
16
+ description: "Go to the specified view scale.",
17
+ schema: m
18
+ });
19
+ export {
20
+ f as goToScaleTool
21
+ };
@@ -0,0 +1,42 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import t from "zod";
3
+ import { tool as c } from "@langchain/core/tools";
4
+ import l from "@arcgis/core/geometry/Point.js";
5
+ import { f as r } from "./fetchAgentContext.js";
6
+ async function m(e, a, o) {
7
+ const i = {
8
+ target: new l({
9
+ longitude: e.longitude,
10
+ latitude: e.latitude,
11
+ spatialReference: { wkid: 4326 }
12
+ })
13
+ };
14
+ return o?.zoom !== void 0 && (i.zoom = o.zoom), o?.scale !== void 0 && (i.scale = o.scale), await a.goTo(i), { text: `Successfully navigated to: ${[
15
+ `(${e.latitude}°, ${e.longitude}°)`,
16
+ o?.zoom !== void 0 ? `zoom ${o.zoom}` : "",
17
+ o?.scale !== void 0 ? `scale 1:${o.scale}` : ""
18
+ ].filter(Boolean).join(", ")}` };
19
+ }
20
+ async function d({
21
+ center: e,
22
+ zoom: a,
23
+ scale: o
24
+ }, n) {
25
+ const { mapView: i } = r(n, ["mapView"]);
26
+ return await m(e, i, { zoom: a, scale: o });
27
+ }
28
+ const s = t.object({
29
+ center: t.object({
30
+ longitude: t.number().describe("The longitude (x-coordinate) of the point to navigate to."),
31
+ latitude: t.number().describe("The latitude (y-coordinate) of the point to navigate to.")
32
+ }),
33
+ zoom: t.number().optional().describe("The zoom level. Higher values = more zoomed in."),
34
+ scale: t.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
35
+ }), T = c(d, {
36
+ name: "goToViewpoint",
37
+ description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
38
+ schema: s
39
+ });
40
+ export {
41
+ T as goToViewpointTool
42
+ };
@@ -1,6 +1,6 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { StateGraph as x, START as k, END as c, Command as b } from "@langchain/langgraph/web";
3
- import { a as K, c as _, b as T, d as A, e as S, s as M, q as v, g as u, h as q, t as g, r as C, i as E, G, j as m } from "./adapter.js";
3
+ import { a as K, c as _, b as T, d as A, e as S, s as M, q as v, g as u, f as q, t as g, r as C, h as E, G, i as m } from "./adapter.js";
4
4
  import "@arcgis/core/identity/IdentityManager.js";
5
5
  import "@arcgis/core/portal/Portal.js";
6
6
  import "@arcgis/core/request.js";
@@ -130,7 +130,7 @@ const V = (e, t) => (
130
130
  //agent services (ex: embeddingsWorker) would go in the array below, if required.
131
131
  C([], "ArcgisKnowledge Agent")(e, t)
132
132
  );
133
- async function j(e, t) {
133
+ async function O(e, t) {
134
134
  const s = (e.arcgisKnowledgeToolResult ?? []).map((d) => ({
135
135
  ...d,
136
136
  details: void 0
@@ -154,7 +154,7 @@ async function j(e, t) {
154
154
  arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, new y(i)]
155
155
  };
156
156
  }
157
- async function O(e) {
157
+ async function P(e) {
158
158
  const t = e.arcgisKnowledgeToolResult?.[0], o = t?.status === "success" ? t.summary : "ArcGIS Knowledge Agent tool execution failed.";
159
159
  return {
160
160
  ...e,
@@ -174,7 +174,7 @@ function h(e) {
174
174
  }
175
175
  })) : await e(t, o);
176
176
  }
177
- const P = () => new x(m).addNode("requireArcgisKnowledgeServices", V).addNode("agent", h(D)).addNode("tools", h(I)).addNode("summarizationLLM", h(j)).addNode("finalizeToolSummary", h(O)).addEdge(k, "requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices", "agent").addConditionalEdges("agent", (t) => (t.arcgisKnowledgeMessages[t.arcgisKnowledgeMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : c).addConditionalEdges("tools", (t) => {
177
+ const j = () => new x(m).addNode("requireArcgisKnowledgeServices", V).addNode("agent", h(D)).addNode("tools", h(I)).addNode("summarizationLLM", h(O)).addNode("finalizeToolSummary", h(P)).addEdge(k, "requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices", "agent").addConditionalEdges("agent", (t) => (t.arcgisKnowledgeMessages[t.arcgisKnowledgeMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : c).addConditionalEdges("tools", (t) => {
178
178
  if (t.status === "failed")
179
179
  return c;
180
180
  const o = t.arcgisKnowledgeToolResult?.[0];
@@ -221,7 +221,7 @@ _example: "What is the average age of all people who work for Esri?"_`, le = {
221
221
  id: "arcgisKnowledge",
222
222
  name: "ArcgisKnowledge Agent",
223
223
  description: J,
224
- createGraph: P,
224
+ createGraph: j,
225
225
  workspace: m
226
226
  };
227
227
  export {
@@ -1,28 +1,31 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { StateGraph as I, START as V, END as v } from "@langchain/langgraph/web";
3
- import { g as T, O as R, P as C, t as N, Q as k, f, y as D, r as z, R as b, S as P } from "./adapter.js";
3
+ import { g as T, y as R, t as C, z as k, r as D, D as N, A as z } from "./adapter.js";
4
4
  import "@arcgis/core/identity/IdentityManager.js";
5
5
  import "@arcgis/core/portal/Portal.js";
6
6
  import "@arcgis/core/request.js";
7
7
  import "@arcgis/toolkit/string";
8
- import { h as A, e as Q } from "./generateLayerDescriptions.js";
9
- import { AIMessage as O } from "@langchain/core/messages";
8
+ import { h as b, e as P } from "./generateLayerDescriptions.js";
9
+ import { AIMessage as Q } from "@langchain/core/messages";
10
10
  import { s as n } from "./index.js";
11
11
  import "@langchain/openai";
12
12
  import "@arcgis/core/config.js";
13
13
  import "@arcgis/core/core/reactiveUtils.js";
14
14
  import "@arcgis/core/layers/FeatureLayer.js";
15
15
  import "@langchain/core/prompts";
16
- import { h as _ } from "./toolCallResponse.js";
17
- import { ToolNode as j } from "@langchain/langgraph/prebuilt";
18
- import G from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
19
- import U from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
16
+ import { h as A } from "./toolCallResponse.js";
17
+ import { b as _ } from "./formatFeatureAttributes.js";
18
+ import { ToolNode as O } from "@langchain/langgraph/prebuilt";
19
+ import j from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
20
+ import G from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
21
+ import { f as U } from "./fetchAgentContext.js";
22
+ import { f } from "./fetchService.js";
20
23
  const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e), t), B = async (t, e) => {
21
24
  await n({ text: "Requesting LLM for layer filter results" }, e);
22
25
  const d = await T("data_explore_filter_prompt");
23
26
  if (!e?.configurable)
24
27
  throw new Error("config.configurable is required for layer filter tools");
25
- const { userTimezone: l, userTimezoneOffset: s } = R(), r = {
28
+ const { userTimezone: l, userTimezoneOffset: s } = _(), r = {
26
29
  layerFieldInfo: t.layerFieldInfo,
27
30
  userTimezone: l,
28
31
  userTimezoneOffset: s,
@@ -30,13 +33,13 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
30
33
  assignedTask: t.agentExecutionContext.assignedTask,
31
34
  userRequest: t.agentExecutionContext.userRequest,
32
35
  priorSteps: t.agentExecutionContext.priorSteps
33
- }, o = await A({
36
+ }, o = await b({
34
37
  promptText: d,
35
38
  modelTier: "advanced",
36
39
  config: e,
37
40
  messages: t.dataExplorationMessages,
38
41
  inputVariables: r,
39
- tools: C
42
+ tools: R
40
43
  }), i = [...t.dataExplorationMessages, o];
41
44
  if (!((o.tool_calls?.length ?? 0) > 0))
42
45
  return await n({ text: "LLM determined no filter changes needed" }, e), {
@@ -45,13 +48,13 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
45
48
  // Don't overwrite outputMessage if query already set it
46
49
  };
47
50
  const m = i, g = o.content.toString();
48
- return await _(o, e), { ...t, dataExplorationMessages: m, outputMessage: g };
51
+ return await A(o, e), { ...t, dataExplorationMessages: m, outputMessage: g };
49
52
  }, H = async (t, e) => {
50
53
  await n({ text: "Requesting LLM for layer query results" }, e);
51
54
  const d = await T("data_explore_query_prompt");
52
55
  if (!e?.configurable)
53
56
  throw new Error("config.configurable is required for layer query tools");
54
- const { userTimezone: l, userTimezoneOffset: s } = R(), r = t.agentExecutionContext.sharedState, o = r.lastNavigatedFeatures?.value, i = r.lastResolvedLocation?.value;
57
+ const { userTimezone: l, userTimezoneOffset: s } = _(), r = t.agentExecutionContext.sharedState, o = r.lastNavigatedFeatures?.value, i = r.lastResolvedLocation?.value;
55
58
  let c = "none";
56
59
  if (o != null)
57
60
  try {
@@ -78,7 +81,7 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
78
81
  priorSteps: t.agentExecutionContext.priorSteps,
79
82
  lastNavigatedFeatures: c,
80
83
  lastResolvedLocation: m
81
- }, y = await A({
84
+ }, y = await b({
82
85
  promptText: d,
83
86
  modelTier: "advanced",
84
87
  config: e,
@@ -86,14 +89,14 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
86
89
  inputVariables: g,
87
90
  tools: k
88
91
  }), h = (y.tool_calls?.length ?? 0) > 0, p = y.content.toString();
89
- return await _(y, e), {
92
+ return await A(y, e), {
90
93
  ...t,
91
94
  dataExplorationMessages: [...t.dataExplorationMessages, y],
92
95
  // Only emit output here when no tools are being called.
93
96
  // For tool-calling flows, downstream summarizer nodes provide the final user-facing message.
94
97
  ...h ? {} : { outputMessage: p },
95
98
  status: "success",
96
- summary: p && !h ? N(p) : "Query planning completed."
99
+ summary: p && !h ? C(p) : "Query planning completed."
97
100
  };
98
101
  }, J = async (t, e) => {
99
102
  try {
@@ -103,20 +106,20 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
103
106
  assignedTask: t.agentExecutionContext.assignedTask,
104
107
  userRequest: t.agentExecutionContext.userRequest,
105
108
  priorSteps: t.agentExecutionContext.priorSteps
106
- }, s = await Q({
109
+ }, s = await P({
107
110
  promptText: d,
108
111
  modelTier: "fast",
109
112
  config: e,
110
113
  messages: t.dataExplorationMessages,
111
114
  inputVariables: l
112
- }), r = typeof s == "string" ? s : s.content, o = new O(r);
115
+ }), r = typeof s == "string" ? s : s.content, o = new Q(r);
113
116
  await n({ text: `Received response from LLM: ${r}` }, e);
114
117
  const i = r;
115
118
  return {
116
119
  ...t,
117
120
  outputMessage: i,
118
121
  status: "success",
119
- summary: i ? N(i) : "Summary generated.",
122
+ summary: i ? C(i) : "Summary generated.",
120
123
  dataExplorationMessages: [...t.dataExplorationMessages, o]
121
124
  };
122
125
  } catch (a) {
@@ -129,7 +132,7 @@ async function K(t, e) {
129
132
  return typeof r == "object" && r !== null && "error" in r;
130
133
  }))
131
134
  return await n({ text: "Skipping layer filter tool because query response contains an error." }, e), { ...t };
132
- const l = await new j(C, { handleToolErrors: !1 }).invoke(
135
+ const l = await new O(R, { handleToolErrors: !1 }).invoke(
133
136
  {
134
137
  messages: t.dataExplorationMessages
135
138
  },
@@ -144,9 +147,9 @@ const X = 10, Y = ["string", "small-integer", "integer"], Z = async (t, e, { inc
144
147
  let l = null, s = null;
145
148
  try {
146
149
  if (e.type !== "geometry" && e.type !== "oid" && e.type !== "global-id") {
147
- a && (l = await G({ layer: t, field: e.name }));
150
+ a && (l = await j({ layer: t, field: e.name }));
148
151
  const r = e.domain?.type === "coded-value" ? e.domain : null;
149
- d && (Y.includes(e.type) || r) && (s = (await U({ layer: t, field: e.name })).uniqueValueInfos.sort((o, i) => i.count - o.count).slice(0, X), r && (s = s.map((o) => ({
152
+ d && (Y.includes(e.type) || r) && (s = (await G({ layer: t, field: e.name })).uniqueValueInfos.sort((o, i) => i.count - o.count).slice(0, X), r && (s = s.map((o) => ({
150
153
  ...o,
151
154
  value: r.getName(o.value) ?? o.value
152
155
  }))));
@@ -220,7 +223,7 @@ function ae(t, e) {
220
223
  const se = async (t, e) => {
221
224
  try {
222
225
  await n({ text: "Preparing field information for vector search results" }, e);
223
- const a = f(e, "layersAndFieldsRegistry"), { mapView: d } = D(e, ["mapView"]), { assignedTask: l, userRequest: s } = t.agentExecutionContext, r = ae(l, s), { layerFieldInfo: o, didFetchStatistics: i, fieldStatisticsFetchStatus: c } = await te(
226
+ const a = f(e, "layersAndFieldsRegistry"), { mapView: d } = U(e, ["mapView"]), { assignedTask: l, userRequest: s } = t.agentExecutionContext, r = ae(l, s), { layerFieldInfo: o, didFetchStatistics: i, fieldStatisticsFetchStatus: c } = await te(
224
227
  t.vectorSearchFieldResults,
225
228
  a,
226
229
  d,
@@ -290,10 +293,10 @@ ${o}` : i = "Vector search completed. No matching layers found.", await n({ text
290
293
  e
291
294
  ), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
292
295
  }
293
- }, le = (t, e) => z(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
296
+ }, le = (t, e) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
294
297
  t,
295
298
  e
296
- ), ce = () => new I(b).addNode("requireDataExplorationServices", le).addNode("vectorSearchLayers", ne).addNode("vectorSearchFields", oe).addNode("fieldStatistics", se).addNode("queryAgent", H).addNode("queryTools", P).addNode("summarizeQueryResponseLLM", J).addNode("filterAgent", B).addNode("filterTools", K).addNode("earlyExit", W).addEdge(V, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
299
+ ), ce = () => new I(N).addNode("requireDataExplorationServices", le).addNode("vectorSearchLayers", ne).addNode("vectorSearchFields", oe).addNode("fieldStatistics", se).addNode("queryAgent", H).addNode("queryTools", z).addNode("summarizeQueryResponseLLM", J).addNode("filterAgent", B).addNode("filterTools", K).addNode("earlyExit", W).addEdge(V, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
297
300
  "vectorSearchLayers",
298
301
  (e) => e.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
299
302
  ).addConditionalEdges(
@@ -312,13 +315,13 @@ ${o}` : i = "Vector search completed. No matching layers found.", await n({ text
312
315
  _Example: “What’s the average population?”_
313
316
  _Example: “Which values are in the status field?”_
314
317
 
315
- This agent does NOT handle help/metadata requests such as listing available layers, listing field names/columns/attributes for a layer, or capability guidance.`, Ce = {
318
+ This agent does NOT handle help/metadata requests such as listing available layers, listing field names/columns/attributes for a layer, or capability guidance.`, Ae = {
316
319
  id: "dataExploration",
317
320
  name: "Data Exploration Agent",
318
321
  description: de,
319
322
  createGraph: ce,
320
- workspace: b
323
+ workspace: N
321
324
  };
322
325
  export {
323
- Ce as D
326
+ Ae as D
324
327
  };
@@ -0,0 +1,13 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ function c(e, o) {
3
+ const t = e?.configurable?.context;
4
+ if (!t || typeof t != "object")
5
+ throw new Error("Agent context missing");
6
+ const n = o.filter((i) => !(i in t));
7
+ if (n.length)
8
+ throw new Error(`Agent context missing: ${n.join(", ")}`);
9
+ return t;
10
+ }
11
+ export {
12
+ c as f
13
+ };
@@ -0,0 +1,10 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ const i = (s, e) => {
3
+ const r = s?.configurable?.services?.[e];
4
+ if (r == null)
5
+ throw new Error(`${e} missing in config.configurable.services`);
6
+ return r;
7
+ };
8
+ export {
9
+ i as f
10
+ };