@arcgis/ai-components 5.2.0-next.71 → 5.2.0-next.73
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/LICENSE.md +4 -2
- package/dist/agent-utils/LLMAgent.d.ts +5 -2
- package/dist/agent-utils/LLMAgent.js +1 -1
- package/dist/agent-utils/types.d.ts +1 -1
- package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
- package/dist/agentic-workflow/Edge.d.ts +16 -0
- package/dist/agentic-workflow/WebAgent.d.ts +39 -0
- package/dist/agentic-workflow/jsonTypes.d.ts +193 -0
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -0
- package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
- package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
- package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
- package/dist/agentic-workflow/nodes/support/Prompt.d.ts +20 -0
- package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
- package/dist/agentic-workflow/types.d.ts +29 -0
- package/dist/cdn/2EJROB32.js +2 -0
- package/dist/cdn/34O57OGV.js +2 -0
- package/dist/cdn/3LXXSMA5.js +2 -0
- package/dist/cdn/3MJQA533.js +2 -0
- package/dist/cdn/3U476GCP.js +5 -0
- package/dist/cdn/3XXZUQMQ.js +2 -0
- package/dist/cdn/4YDXYW4J.js +2 -0
- package/dist/cdn/4ZUUS4DH.js +2 -0
- package/dist/cdn/527C4GD2.js +36 -0
- package/dist/cdn/5RZGG4F2.js +2 -0
- package/dist/cdn/5SF6DEMO.js +2 -0
- package/dist/cdn/5Y6TQAJN.js +2 -0
- package/dist/cdn/65IWA2PM.js +2 -0
- package/dist/cdn/{MW5S2XCB.js → 67YCNNCN.js} +2 -2
- package/dist/cdn/6FKLWNGA.js +2 -0
- package/dist/cdn/6QJFOL6M.js +2 -0
- package/dist/cdn/6RDKDLSX.js +2 -0
- package/dist/cdn/6SGNSDLY.js +2 -0
- package/dist/cdn/7747YL7V.js +2 -0
- package/dist/cdn/7TO56JHS.js +2 -0
- package/dist/cdn/ABXLPDEK.js +2 -0
- package/dist/cdn/BBJDW6GC.js +2 -0
- package/dist/cdn/{PUFTYLJ2.js → C4FKFOU4.js} +4 -4
- package/dist/cdn/CCC6LBMY.js +2 -0
- package/dist/cdn/CGVVL52C.js +2 -0
- package/dist/cdn/DBHLKLKM.js +2 -0
- package/dist/cdn/DKLK4EUE.js +2 -0
- package/dist/cdn/E25RINU2.js +2 -0
- package/dist/cdn/E62P76TP.js +2 -0
- package/dist/cdn/E7JLG2A2.js +2 -0
- package/dist/cdn/{TFT6HK3O.js → E7KEOJZG.js} +1 -1
- package/dist/cdn/FDOMMK2M.js +2 -0
- package/dist/cdn/FSMHR7GK.js +2 -0
- package/dist/cdn/GG3AESSV.js +2 -0
- package/dist/cdn/H6JSNAT4.js +2 -0
- package/dist/cdn/HNMFFLSY.js +2 -0
- package/dist/cdn/HO2YDJI2.js +6 -0
- package/dist/cdn/{KQHLOYKL.js → I4L45WQS.js} +1 -1
- package/dist/cdn/ITBQGOMF.js +11 -0
- package/dist/cdn/JH6EAWB2.js +2 -0
- package/dist/cdn/JON2JHS2.js +2 -0
- package/dist/cdn/JWPB3XZM.js +2 -0
- package/dist/cdn/JXB4TNSG.js +2 -0
- package/dist/cdn/JYVBCHR6.js +6 -0
- package/dist/cdn/KRN6AFNB.js +18 -0
- package/dist/cdn/KZACIY2W.js +2 -0
- package/dist/cdn/MKJS7QYQ.js +2 -0
- package/dist/cdn/N735LT4S.js +2 -0
- package/dist/cdn/NP7DG7LQ.js +2 -0
- package/dist/cdn/NTZAOJH5.js +2 -0
- package/dist/cdn/{CXW5URTF.js → OHMNQ3RU.js} +5 -5
- package/dist/cdn/ONQ6JSBJ.js +2 -0
- package/dist/cdn/PAUIFUMO.js +2 -0
- package/dist/cdn/QNNGPA3Q.js +2 -0
- package/dist/cdn/RATZTLNX.js +2 -0
- package/dist/cdn/RU5DVLYG.js +156 -0
- package/dist/cdn/{YHQJ66WJ.js → S3XUYAUX.js} +1 -1
- package/dist/cdn/S6ZAQRC6.js +2 -0
- package/dist/cdn/SABZC4D4.js +2 -0
- package/dist/cdn/TYL5G7KR.js +2 -0
- package/dist/cdn/{XETNZW4D.js → UAZLKUFN.js} +1 -1
- package/dist/cdn/UZL6UVE4.js +2 -0
- package/dist/cdn/VBZ5XGAM.js +2 -0
- package/dist/cdn/VXBUMZYR.js +2 -0
- package/dist/cdn/W5FLNFSN.js +2 -0
- package/dist/cdn/W5J4Q3RO.js +14 -0
- package/dist/cdn/WQKNV6KK.js +2 -0
- package/dist/cdn/{ICYUPLZM.js → WZFC5HUX.js} +1 -1
- package/dist/cdn/XGBEHER5.js +2 -0
- package/dist/cdn/XPTCV6YV.js +2 -0
- package/dist/cdn/Y5UFOH54.js +2 -0
- package/dist/cdn/YGCTAIBS.js +2 -0
- package/dist/cdn/{SXHH575T.js → ZJEWP2ND.js} +20 -24
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
- package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
- package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +939 -1950
- package/dist/chunks/adapter10.js +21 -0
- package/dist/chunks/adapter11.js +30 -0
- package/dist/chunks/adapter12.js +22 -0
- package/dist/chunks/adapter13.js +22 -0
- package/dist/chunks/adapter14.js +109 -0
- package/dist/chunks/adapter15.js +40 -0
- package/dist/chunks/adapter16.js +154 -0
- package/dist/chunks/adapter17.js +141 -0
- package/dist/chunks/adapter18.js +127 -0
- package/dist/chunks/adapter2.js +52 -0
- package/dist/chunks/adapter3.js +30 -0
- package/dist/chunks/adapter4.js +50 -0
- package/dist/chunks/adapter5.js +27 -0
- package/dist/chunks/adapter6.js +24 -0
- package/dist/chunks/adapter7.js +26 -0
- package/dist/chunks/adapter8.js +21 -0
- package/dist/chunks/adapter9.js +42 -0
- package/dist/chunks/arcgisKnowledgeGraph.js +5 -5
- package/dist/chunks/baseAgentState.js +56 -0
- package/dist/chunks/dataExplorationGraph.js +34 -31
- package/dist/chunks/fetchAgentContext.js +13 -0
- package/dist/chunks/fetchService.js +10 -0
- package/dist/chunks/formatFeatureAttributes.js +132 -0
- package/dist/chunks/generateLayerDescriptions.js +189 -235
- package/dist/chunks/helpGraph.js +11 -9
- package/dist/chunks/layerStylingGraph.js +22 -21
- package/dist/chunks/mergeWhereClauses.js +15 -0
- package/dist/chunks/navigationGraph.js +81 -70
- package/dist/chunks/orchestrator.js +1 -1
- package/dist/chunks/state.js +20 -26
- package/dist/chunks/types.js +59 -0
- package/dist/chunks/utils2.js +3 -3
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +636 -10
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +15 -5
- package/dist/components/arcgis-assistant-help-agent/customElement.js +21 -5
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +39 -22
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +22 -5
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +13 -5
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +1 -1
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/dist/utils/index.js +26 -25
- package/package.json +4 -4
- package/dist/cdn/3DJDRAGV.js +0 -2
- package/dist/cdn/4CEMUECT.js +0 -2
- package/dist/cdn/4PCAK3ET.js +0 -2
- package/dist/cdn/57OMVTIU.js +0 -2
- package/dist/cdn/6U7TEAAJ.js +0 -2
- package/dist/cdn/BE7ZN5FZ.js +0 -2
- package/dist/cdn/BNSJO6X2.js +0 -2
- package/dist/cdn/CMDRED5H.js +0 -2
- package/dist/cdn/DTIVDIDY.js +0 -2
- package/dist/cdn/E5ZKBC24.js +0 -36
- package/dist/cdn/GP6NDTUE.js +0 -18
- package/dist/cdn/HBLRVXEB.js +0 -2
- package/dist/cdn/HQXPPYMD.js +0 -2
- package/dist/cdn/IEHPNCTL.js +0 -2
- package/dist/cdn/LHLO6PTD.js +0 -2
- package/dist/cdn/OWXCOUIQ.js +0 -2
- package/dist/cdn/PVE7Q43N.js +0 -2
- package/dist/cdn/ST5FQYT7.js +0 -180
- package/dist/cdn/WUNCZOGU.js +0 -2
- package/dist/cdn/WVPU4QOO.js +0 -2
- package/dist/cdn/WXWO5D3W.js +0 -2
- package/dist/cdn/XCRR2EEG.js +0 -6
- package/dist/cdn/ZS6SXJP2.js +0 -2
|
@@ -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,
|
|
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
|
|
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
|
|
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
|
|
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:
|
|
224
|
+
createGraph: j,
|
|
225
225
|
workspace: m
|
|
226
226
|
};
|
|
227
227
|
export {
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { Annotation as s } from "@langchain/langgraph/web";
|
|
3
|
+
const n = (e, t) => t, c = (e, t) => ({
|
|
4
|
+
...e,
|
|
5
|
+
...t
|
|
6
|
+
}), o = (e = "", t) => {
|
|
7
|
+
const r = typeof t == "string" ? t.trim() : "";
|
|
8
|
+
if (!r)
|
|
9
|
+
return e;
|
|
10
|
+
const a = e.trim();
|
|
11
|
+
if (!a)
|
|
12
|
+
return r;
|
|
13
|
+
if (a === r)
|
|
14
|
+
return e;
|
|
15
|
+
const u = a.split(`
|
|
16
|
+
|
|
17
|
+
`);
|
|
18
|
+
return u[u.length - 1]?.trim() === r ? e : `${e}
|
|
19
|
+
|
|
20
|
+
${r}`;
|
|
21
|
+
}, i = () => ({
|
|
22
|
+
userRequest: "",
|
|
23
|
+
assignedTask: "",
|
|
24
|
+
messages: [],
|
|
25
|
+
priorSteps: [],
|
|
26
|
+
sharedState: {}
|
|
27
|
+
}), d = () => ({
|
|
28
|
+
agentExecutionContext: s({
|
|
29
|
+
reducer: c,
|
|
30
|
+
default: i
|
|
31
|
+
}),
|
|
32
|
+
outputMessage: s({
|
|
33
|
+
reducer: o,
|
|
34
|
+
default: () => ""
|
|
35
|
+
}),
|
|
36
|
+
summary: s({
|
|
37
|
+
reducer: n,
|
|
38
|
+
default: () => ""
|
|
39
|
+
}),
|
|
40
|
+
status: s({
|
|
41
|
+
reducer: n
|
|
42
|
+
})
|
|
43
|
+
}), g = () => ({
|
|
44
|
+
...d(),
|
|
45
|
+
sharedStatePatch: s({
|
|
46
|
+
reducer: n
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
d as a,
|
|
51
|
+
g as b,
|
|
52
|
+
i as c,
|
|
53
|
+
o as d,
|
|
54
|
+
c as m,
|
|
55
|
+
n as r
|
|
56
|
+
};
|