@arcgis/ai-components 5.2.0-next.24 → 5.2.0-next.25
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/cdn/3AXQTBIA.js +134 -0
- package/dist/cdn/3EMHTJ2C.js +180 -0
- package/dist/cdn/{BGVIBF6M.js → 4D4XBLDN.js} +1 -1
- package/dist/cdn/{GH263QNS.js → 4JK6XZLV.js} +1 -1
- package/dist/cdn/{SASFHTVY.js → 6ELX5G6N.js} +5 -5
- package/dist/cdn/{FWXRFMNO.js → CZCEK4Z5.js} +1 -1
- package/dist/cdn/{2EMRDLJG.js → E6CUTFFK.js} +1 -1
- package/dist/cdn/{YIJSPLIP.js → G7PX6SLG.js} +1 -1
- package/dist/cdn/{GJUD7EA3.js → IGZWQJW7.js} +1 -1
- package/dist/cdn/LEPJUN3X.js +22 -0
- package/dist/cdn/{OARG3JNP.js → QUXNVDLI.js} +1 -1
- package/dist/cdn/{QPHLBARY.js → RQ7Y7JY3.js} +1 -1
- package/dist/cdn/{CMTXZ33N.js → TNEA5K7L.js} +1 -1
- package/dist/cdn/{2F2U6T5S.js → VD5GRVML.js} +1 -1
- package/dist/cdn/W2IHPJ54.js +34 -0
- package/dist/cdn/{B4GH4POB.js → X64XUQX2.js} +1 -1
- package/dist/cdn/ZMSJQB65.js +99 -0
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +1179 -1091
- package/dist/chunks/arcgisKnowledgeGraph.js +91 -74
- package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
- package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
- package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
- package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +4 -4
- package/dist/cdn/5QAHYX7Y.js +0 -5
- package/dist/cdn/AMXYAMAZ.js +0 -161
- package/dist/cdn/AXDZBBNL.js +0 -45
- package/dist/cdn/KMQ3SP4I.js +0 -5
package/dist/chunks/adapter.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import { Annotation as
|
|
2
|
+
import pe from "@arcgis/core/identity/IdentityManager.js";
|
|
3
|
+
import k from "@arcgis/core/portal/Portal.js";
|
|
4
|
+
import { Annotation as T, messagesStateReducer as be } from "@langchain/langgraph/web";
|
|
5
5
|
import "@arcgis/toolkit/string";
|
|
6
|
-
import { k as
|
|
6
|
+
import { k as De, j as H, i as Pe } from "./generateLayerDescriptions.js";
|
|
7
7
|
import "@langchain/core/messages";
|
|
8
8
|
import "@langchain/core/callbacks/dispatch/web";
|
|
9
9
|
import "@langchain/openai";
|
|
10
10
|
import X from "@arcgis/core/config.js";
|
|
11
11
|
import * as Ae from "@arcgis/core/core/reactiveUtils.js";
|
|
12
12
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
13
|
-
import
|
|
13
|
+
import me from "@arcgis/core/request.js";
|
|
14
14
|
import "@langchain/core/prompts";
|
|
15
|
-
import { tool as
|
|
16
|
-
import
|
|
17
|
-
import { addressToLocations as
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { createRenderer as
|
|
23
|
-
import { getSchemesByTag as
|
|
24
|
-
import { getBackgroundColorTheme as
|
|
15
|
+
import { tool as g } from "@langchain/core/tools";
|
|
16
|
+
import Le from "@arcgis/core/Graphic.js";
|
|
17
|
+
import { addressToLocations as je } from "@arcgis/core/rest/locator.js";
|
|
18
|
+
import Ge from "@arcgis/core/symbols/PictureMarkerSymbol.js";
|
|
19
|
+
import s, { z as E } from "zod";
|
|
20
|
+
import Oe from "@arcgis/core/geometry/Extent.js";
|
|
21
|
+
import Te from "@arcgis/core/geometry/Point.js";
|
|
22
|
+
import { createRenderer as Me } from "@arcgis/core/smartMapping/renderers/pieChart.js";
|
|
23
|
+
import { getSchemesByTag as Qe, getSchemes as _e } from "@arcgis/core/smartMapping/symbology/pieChart.js";
|
|
24
|
+
import { getBackgroundColorTheme as he } from "@arcgis/core/views/support/colorUtils.js";
|
|
25
25
|
import { a as R, s as x } from "./index.js";
|
|
26
|
-
import { createAgeRenderer as
|
|
27
|
-
import { getSchemesByTag as
|
|
28
|
-
import { createContinuousRenderer as
|
|
26
|
+
import { createAgeRenderer as We, createContinuousRenderer as Ve } from "@arcgis/core/smartMapping/renderers/color.js";
|
|
27
|
+
import { getSchemesByTag as se } from "@arcgis/core/smartMapping/symbology/color.js";
|
|
28
|
+
import { createContinuousRenderer as Be } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
|
|
29
29
|
import { createRenderer as Ue } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
|
|
30
|
-
import { getSchemesByTag as
|
|
31
|
-
import { createRenderer as
|
|
32
|
-
import { getSchemesByTag as
|
|
33
|
-
import { createRenderer as
|
|
34
|
-
import { getSchemesByTag as
|
|
35
|
-
import { createRenderer as
|
|
36
|
-
import { getSchemesByTag as
|
|
37
|
-
import { createAgeRenderer as
|
|
38
|
-
import { createRenderer as
|
|
39
|
-
import { getSchemesByTag as
|
|
40
|
-
import { ToolNode as
|
|
41
|
-
import
|
|
30
|
+
import { getSchemesByTag as Ke } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
|
|
31
|
+
import { createRenderer as He } from "@arcgis/core/smartMapping/renderers/heatmap.js";
|
|
32
|
+
import { getSchemesByTag as Je } from "@arcgis/core/smartMapping/symbology/heatmap.js";
|
|
33
|
+
import { createRenderer as Ze } from "@arcgis/core/smartMapping/renderers/predominance.js";
|
|
34
|
+
import { getSchemesByTag as Ye } from "@arcgis/core/smartMapping/symbology/predominance.js";
|
|
35
|
+
import { createRenderer as Xe } from "@arcgis/core/smartMapping/renderers/relationship.js";
|
|
36
|
+
import { getSchemesByTag as et } from "@arcgis/core/smartMapping/symbology/relationship.js";
|
|
37
|
+
import { createAgeRenderer as tt, createContinuousRenderer as rt } from "@arcgis/core/smartMapping/renderers/size.js";
|
|
38
|
+
import { createRenderer as at } from "@arcgis/core/smartMapping/renderers/type.js";
|
|
39
|
+
import { getSchemesByTag as ot } from "@arcgis/core/smartMapping/symbology/type.js";
|
|
40
|
+
import { ToolNode as nt } from "@langchain/langgraph/prebuilt";
|
|
41
|
+
import it from "@arcgis/core/layers/support/FeatureEffect.js";
|
|
42
42
|
import Se from "@arcgis/core/layers/support/FeatureFilter.js";
|
|
43
|
-
import * as
|
|
44
|
-
import { formatDateOnly as
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
43
|
+
import * as st from "@arcgis/core/geometry/operators/unionOperator.js";
|
|
44
|
+
import { formatDateOnly as lt, convertDateFormatToIntlOptions as _, formatTimeOnly as ct, formatDate as ye } from "@arcgis/core/intl.js";
|
|
45
|
+
import ut from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
|
|
46
|
+
import dt from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
|
|
47
|
+
import pt from "@arcgis/core/rest/support/TopFeaturesQuery.js";
|
|
48
|
+
import mt from "@arcgis/core/rest/support/TopFilter.js";
|
|
49
|
+
import ht from "@arcgis/core/WebLinkChart.js";
|
|
50
|
+
import ve from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
|
|
51
51
|
import "@arcgis/core/views/LinkChartView.js";
|
|
52
|
-
import { fetchKnowledgeGraph as
|
|
53
|
-
import
|
|
54
|
-
const L = (e, t) => t ?? e,
|
|
55
|
-
...
|
|
52
|
+
import { fetchKnowledgeGraph as fe, executeQueryStreaming as yt, executeSearchStreaming as ft } from "@arcgis/core/rest/knowledgeGraphService.js";
|
|
53
|
+
import gt from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
|
|
54
|
+
const L = (e, t) => t ?? e, En = T.Root({
|
|
55
|
+
...De(),
|
|
56
56
|
// internal to the navigation agent
|
|
57
|
-
intent:
|
|
57
|
+
intent: T({
|
|
58
58
|
reducer: L
|
|
59
59
|
}),
|
|
60
|
-
vectorSearchLayerResults:
|
|
60
|
+
vectorSearchLayerResults: T({
|
|
61
61
|
reducer: L,
|
|
62
62
|
default: () => []
|
|
63
63
|
}),
|
|
64
|
-
vectorSearchFieldResults:
|
|
64
|
+
vectorSearchFieldResults: T({
|
|
65
65
|
reducer: L
|
|
66
66
|
}),
|
|
67
|
-
navigationInternalState:
|
|
67
|
+
navigationInternalState: T({
|
|
68
68
|
reducer: L,
|
|
69
69
|
default: () => ({
|
|
70
70
|
toolCallMessage: void 0
|
|
71
71
|
})
|
|
72
72
|
})
|
|
73
73
|
});
|
|
74
|
-
async function
|
|
75
|
-
const a =
|
|
74
|
+
async function wt(e, t) {
|
|
75
|
+
const a = k.getDefault().helperServices, o = a.geocode.find((m) => m.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
|
|
76
76
|
if (!o)
|
|
77
77
|
throw new Error("No geocoding service found in helperServices.");
|
|
78
|
-
const n = o.url, l = `${X.assetsPath?.endsWith("/") ? X.assetsPath : `${X.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await
|
|
78
|
+
const n = o.url, l = `${X.assetsPath?.endsWith("/") ? X.assetsPath : `${X.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await je(n, {
|
|
79
79
|
address: { SingleLine: e },
|
|
80
80
|
outFields: ["Match_addr"]
|
|
81
81
|
}))?.[0];
|
|
82
82
|
if (!c?.extent || !c.location)
|
|
83
83
|
throw new Error(`Could not find location for: ${e}`);
|
|
84
|
-
const u = new
|
|
84
|
+
const u = new Ge({
|
|
85
85
|
url: l,
|
|
86
86
|
width: 24,
|
|
87
87
|
height: 24
|
|
88
|
-
}), d = new
|
|
88
|
+
}), d = new Le({
|
|
89
89
|
geometry: c.location,
|
|
90
90
|
symbol: u
|
|
91
91
|
});
|
|
@@ -100,26 +100,26 @@ async function gt(e, t) {
|
|
|
100
100
|
sharedStatePatch: { lastResolvedLocation: { value: p } }
|
|
101
101
|
};
|
|
102
102
|
}
|
|
103
|
-
const
|
|
103
|
+
const bt = ["mapView"];
|
|
104
104
|
function C(e) {
|
|
105
105
|
const r = e?.configurable?.context;
|
|
106
106
|
if (!r || typeof r != "object")
|
|
107
107
|
throw new Error("NavigationAgent context missing");
|
|
108
|
-
const a =
|
|
108
|
+
const a = bt.filter((o) => !(o in r));
|
|
109
109
|
if (a.length)
|
|
110
110
|
throw new Error(`NavigationAgent context missing: ${a.join(", ")}`);
|
|
111
111
|
return r;
|
|
112
112
|
}
|
|
113
|
-
async function
|
|
113
|
+
async function Tt({ address: e }, t) {
|
|
114
114
|
const { mapView: r } = C(t);
|
|
115
|
-
return await
|
|
115
|
+
return await wt(e, r);
|
|
116
116
|
}
|
|
117
|
-
const
|
|
118
|
-
address:
|
|
119
|
-
}),
|
|
117
|
+
const St = s.object({
|
|
118
|
+
address: s.string().describe("The full address or place name to locate.")
|
|
119
|
+
}), Fn = g(Tt, {
|
|
120
120
|
name: "goToAddress",
|
|
121
121
|
description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
|
|
122
|
-
schema:
|
|
122
|
+
schema: St
|
|
123
123
|
});
|
|
124
124
|
async function vt(e, t) {
|
|
125
125
|
const a = t.map.bookmarks;
|
|
@@ -133,26 +133,26 @@ async function vt(e, t) {
|
|
|
133
133
|
throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
|
|
134
134
|
return await t.goTo(n), { text: `Navigated to bookmark: ${e}` };
|
|
135
135
|
}
|
|
136
|
-
async function
|
|
136
|
+
async function xt({ bookmarkName: e }, t) {
|
|
137
137
|
const { mapView: r } = C(t);
|
|
138
138
|
return await Promise.resolve(vt(e, r));
|
|
139
139
|
}
|
|
140
|
-
const
|
|
140
|
+
const Rt = E.object({
|
|
141
141
|
bookmarkName: E.string().describe("The name of the bookmark to navigate to.")
|
|
142
|
-
}),
|
|
142
|
+
}), kn = g(xt, {
|
|
143
143
|
name: "goToBookmark",
|
|
144
144
|
description: "Go to the extent of the bookmark with the given name.",
|
|
145
|
-
schema:
|
|
145
|
+
schema: Rt
|
|
146
146
|
});
|
|
147
|
-
async function
|
|
147
|
+
async function $t(e, t, r) {
|
|
148
148
|
const a = r.map?.allLayers.find((l) => l.id === e);
|
|
149
149
|
if (!a)
|
|
150
150
|
return { text: `Error: Layer with id ${e} not found` };
|
|
151
151
|
const o = t?.trim() ? t : "1=1", n = a.createQuery();
|
|
152
152
|
n.where = o;
|
|
153
153
|
try {
|
|
154
|
-
const { extent: l, count:
|
|
155
|
-
if (
|
|
154
|
+
const { extent: l, count: i } = await a.queryExtent(n);
|
|
155
|
+
if (i === 0)
|
|
156
156
|
return { text: `No features found in ${a.title} matching: ${o}`, where: o };
|
|
157
157
|
if (l)
|
|
158
158
|
await r.goTo(l);
|
|
@@ -162,10 +162,10 @@ async function Rt(e, t, r) {
|
|
|
162
162
|
layerId: e,
|
|
163
163
|
layerTitle: a.title ?? e,
|
|
164
164
|
where: o,
|
|
165
|
-
count:
|
|
165
|
+
count: i
|
|
166
166
|
};
|
|
167
167
|
return {
|
|
168
|
-
text: `Successfully zoomed to ${
|
|
168
|
+
text: `Successfully zoomed to ${i} feature(s) in ${a.title} matching: ${o}`,
|
|
169
169
|
where: o,
|
|
170
170
|
sharedStatePatch: { lastNavigatedFeatures: { value: c } }
|
|
171
171
|
};
|
|
@@ -173,20 +173,20 @@ async function Rt(e, t, r) {
|
|
|
173
173
|
return console.error("Error in goToFeatures:", l), { text: `Error: ${l instanceof Error ? l.message : "Unknown error"}`, where: o };
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
async function
|
|
176
|
+
async function Ct({ layerId: e, where: t }, r) {
|
|
177
177
|
const { mapView: a } = C(r);
|
|
178
|
-
return await
|
|
178
|
+
return await $t(e, t, a);
|
|
179
179
|
}
|
|
180
|
-
const
|
|
180
|
+
const Et = E.object({
|
|
181
181
|
layerId: E.string().describe("The layerId of the layer to zoom to."),
|
|
182
182
|
where: E.string().describe("The sql-92 where clause used to query features to zoom to")
|
|
183
|
-
}), Nn =
|
|
183
|
+
}), Nn = g(Ct, {
|
|
184
184
|
name: "goToFeatures",
|
|
185
185
|
description: "Go to the features that match the given filter related to the given layerId.",
|
|
186
|
-
schema:
|
|
186
|
+
schema: Et
|
|
187
187
|
});
|
|
188
|
-
async function
|
|
189
|
-
const r = new
|
|
188
|
+
async function Ft(e) {
|
|
189
|
+
const r = new Oe({
|
|
190
190
|
xmin: -180,
|
|
191
191
|
ymin: -90,
|
|
192
192
|
xmax: 180,
|
|
@@ -195,16 +195,16 @@ async function Et(e) {
|
|
|
195
195
|
}).expand(0.7);
|
|
196
196
|
return await e.goTo(r), { text: "Successfully zoomed to world extent" };
|
|
197
197
|
}
|
|
198
|
-
async function
|
|
198
|
+
async function kt(e, t) {
|
|
199
199
|
const { mapView: r } = C(t);
|
|
200
|
-
return await
|
|
200
|
+
return await Ft(r);
|
|
201
201
|
}
|
|
202
|
-
const Nt = E.object({}),
|
|
202
|
+
const Nt = E.object({}), qn = g(kt, {
|
|
203
203
|
name: "goToFullExtent",
|
|
204
204
|
description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
|
|
205
205
|
schema: Nt
|
|
206
206
|
});
|
|
207
|
-
async function
|
|
207
|
+
async function qt(e) {
|
|
208
208
|
const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
|
|
209
209
|
if (r)
|
|
210
210
|
await e.goTo(r);
|
|
@@ -212,16 +212,16 @@ async function It(e) {
|
|
|
212
212
|
throw new Error("Initial extent is undefined");
|
|
213
213
|
return { text: "Successfully zoomed to home extent" };
|
|
214
214
|
}
|
|
215
|
-
async function
|
|
215
|
+
async function It(e, t) {
|
|
216
216
|
const { mapView: r } = C(t);
|
|
217
|
-
return await
|
|
217
|
+
return await qt(r);
|
|
218
218
|
}
|
|
219
|
-
const
|
|
219
|
+
const zt = s.object({}), In = g(It, {
|
|
220
220
|
name: "goToHomeExtent",
|
|
221
221
|
description: "Go to the initial web map view extent",
|
|
222
|
-
schema:
|
|
222
|
+
schema: zt
|
|
223
223
|
});
|
|
224
|
-
async function
|
|
224
|
+
async function Dt(e, t) {
|
|
225
225
|
await t.when();
|
|
226
226
|
const r = t.map?.allLayers.find((o) => o.id === e);
|
|
227
227
|
if (!r)
|
|
@@ -229,34 +229,34 @@ async function zt(e, t) {
|
|
|
229
229
|
let a;
|
|
230
230
|
return (r.type === "link-chart" || r.type === "knowledge-graph-sublayer") && t.map?.activeLinkChartLayer ? a = t.map.diagramNodesExtent : a = r.fullExtent, a ? (await t.goTo(a), r.visible = !0, { text: `Successfully zoomed to: ${r.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
|
|
231
231
|
}
|
|
232
|
-
async function
|
|
232
|
+
async function Pt({ layerId: e }, t) {
|
|
233
233
|
const { mapView: r } = C(t);
|
|
234
|
-
return await
|
|
234
|
+
return await Dt(e, r);
|
|
235
235
|
}
|
|
236
236
|
const At = E.object({
|
|
237
237
|
layerId: E.string().describe("The id of the layer to navigate to")
|
|
238
|
-
}),
|
|
238
|
+
}), zn = g(Pt, {
|
|
239
239
|
name: "goToLayer",
|
|
240
240
|
description: "Zooms the map view to the full extent of the top matching layer.",
|
|
241
241
|
schema: At
|
|
242
242
|
});
|
|
243
|
-
async function
|
|
243
|
+
async function Lt(e, t) {
|
|
244
244
|
return await t.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
|
|
245
245
|
}
|
|
246
|
-
async function
|
|
246
|
+
async function jt({ scale: e }, t) {
|
|
247
247
|
const { mapView: r } = C(t);
|
|
248
|
-
return await
|
|
248
|
+
return await Lt(e, r);
|
|
249
249
|
}
|
|
250
|
-
const
|
|
251
|
-
scale:
|
|
252
|
-
}),
|
|
250
|
+
const Gt = s.object({
|
|
251
|
+
scale: s.number().describe("The map scale of the view to go to.")
|
|
252
|
+
}), Dn = g(jt, {
|
|
253
253
|
name: "goToScale",
|
|
254
254
|
description: "Go to the specified view scale.",
|
|
255
|
-
schema:
|
|
255
|
+
schema: Gt
|
|
256
256
|
});
|
|
257
|
-
async function
|
|
257
|
+
async function Ot(e, t, r) {
|
|
258
258
|
const o = {
|
|
259
|
-
target: new
|
|
259
|
+
target: new Te({
|
|
260
260
|
longitude: e.longitude,
|
|
261
261
|
latitude: e.latitude,
|
|
262
262
|
spatialReference: { wkid: 4326 }
|
|
@@ -268,42 +268,43 @@ async function Gt(e, t, r) {
|
|
|
268
268
|
r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
|
|
269
269
|
].filter(Boolean).join(", ")}` };
|
|
270
270
|
}
|
|
271
|
-
async function
|
|
271
|
+
async function Mt({
|
|
272
272
|
center: e,
|
|
273
273
|
zoom: t,
|
|
274
274
|
scale: r
|
|
275
275
|
}, a) {
|
|
276
276
|
const { mapView: o } = C(a);
|
|
277
|
-
return await
|
|
277
|
+
return await Ot(e, o, { zoom: t, scale: r });
|
|
278
278
|
}
|
|
279
|
-
const
|
|
280
|
-
center:
|
|
281
|
-
longitude:
|
|
282
|
-
latitude:
|
|
279
|
+
const Qt = s.object({
|
|
280
|
+
center: s.object({
|
|
281
|
+
longitude: s.number().describe("The longitude (x-coordinate) of the point to navigate to."),
|
|
282
|
+
latitude: s.number().describe("The latitude (y-coordinate) of the point to navigate to.")
|
|
283
283
|
}),
|
|
284
|
-
zoom:
|
|
285
|
-
scale:
|
|
286
|
-
}),
|
|
284
|
+
zoom: s.number().optional().describe("The zoom level. Higher values = more zoomed in."),
|
|
285
|
+
scale: s.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
|
|
286
|
+
}), Pn = g(Mt, {
|
|
287
287
|
name: "goToViewpoint",
|
|
288
288
|
description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
|
|
289
|
-
schema:
|
|
289
|
+
schema: Qt
|
|
290
290
|
});
|
|
291
|
-
async function
|
|
291
|
+
async function _t(e, t) {
|
|
292
292
|
return await t.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
|
|
293
293
|
}
|
|
294
|
-
async function
|
|
294
|
+
async function Wt({ zoom: e }, t) {
|
|
295
295
|
const { mapView: r } = C(t);
|
|
296
|
-
return await
|
|
296
|
+
return await _t(e, r);
|
|
297
297
|
}
|
|
298
|
-
const
|
|
299
|
-
zoom:
|
|
300
|
-
}), An =
|
|
298
|
+
const Vt = s.object({
|
|
299
|
+
zoom: s.number().min(1).max(20).describe("The zoom level of the view to go to.")
|
|
300
|
+
}), An = g(Wt, {
|
|
301
301
|
name: "goToZoom",
|
|
302
302
|
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.).',
|
|
303
|
-
schema:
|
|
304
|
-
}),
|
|
303
|
+
schema: Vt
|
|
304
|
+
}), ge = /* @__PURE__ */ Object.assign({
|
|
305
305
|
"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md": () => import("./arcgis_knowledge_current_lc_context.js").then((e) => e.default),
|
|
306
306
|
"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md": () => import("./arcgis_knowledge_current_map_context.js").then((e) => e.default),
|
|
307
|
+
"../agents/arcgisKnowledge/prompts/arcgis_knowledge_cypher_query_prompt.md": () => import("./arcgis_knowledge_cypher_query_prompt.js").then((e) => e.default),
|
|
307
308
|
"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md": () => import("./arcgis_knowledge_lucene_generation_prompt.js").then((e) => e.default),
|
|
308
309
|
"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md": () => import("./arcgis_knowledge_summarize_result_prompt.js").then((e) => e.default),
|
|
309
310
|
"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md": () => import("./arcgis_knowledge_tool_prompt.js").then((e) => e.default),
|
|
@@ -315,24 +316,24 @@ const Wt = i.object({
|
|
|
315
316
|
"../agents/navigation/prompts/navigation_intent_prompt.md": () => import("./navigation_intent_prompt.js").then((e) => e.default),
|
|
316
317
|
"../agents/navigation/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt.js").then((e) => e.default)
|
|
317
318
|
});
|
|
318
|
-
async function
|
|
319
|
-
const t = Object.entries(
|
|
319
|
+
async function B(e) {
|
|
320
|
+
const t = Object.entries(ge).find(([r]) => r.endsWith(`/${e}.md`));
|
|
320
321
|
if (!t)
|
|
321
322
|
throw new Error(`Prompt not found: ${e}
|
|
322
323
|
Available prompts:
|
|
323
|
-
${Object.keys(
|
|
324
|
+
${Object.keys(ge).join(`
|
|
324
325
|
`)}`);
|
|
325
326
|
return await t[1]();
|
|
326
327
|
}
|
|
327
|
-
const
|
|
328
|
+
const Bt = (e, t = 300) => {
|
|
328
329
|
const r = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
|
|
329
330
|
return r.length > t ? `${r.slice(0, t)}...` : r;
|
|
330
|
-
},
|
|
331
|
+
}, xe = (e, t) => {
|
|
331
332
|
const a = e?.configurable?.services?.[t];
|
|
332
333
|
if (a == null)
|
|
333
334
|
throw new Error(`${t} missing in config.configurable.services`);
|
|
334
335
|
return a;
|
|
335
|
-
},
|
|
336
|
+
}, Ln = (e, t) => (r, a) => {
|
|
336
337
|
const o = a?.configurable?.services;
|
|
337
338
|
for (const n of e)
|
|
338
339
|
if (!o?.[n])
|
|
@@ -342,21 +343,21 @@ const Vt = (e, t = 300) => {
|
|
|
342
343
|
async function Ut(e) {
|
|
343
344
|
const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
|
|
344
345
|
let l;
|
|
345
|
-
return n ? l =
|
|
346
|
-
basemapTheme: await
|
|
346
|
+
return n ? l = Qe({
|
|
347
|
+
basemapTheme: await he(a),
|
|
347
348
|
geometryType: r.geometryType,
|
|
348
349
|
includedTags: n,
|
|
349
350
|
numColors: Math.min(t.length, 8)
|
|
350
|
-
})[0] : l =
|
|
351
|
-
basemapTheme: await
|
|
351
|
+
})[0] : l = _e({
|
|
352
|
+
basemapTheme: await he(a),
|
|
352
353
|
geometryType: r.geometryType,
|
|
353
354
|
numColors: Math.min(t.length, 8)
|
|
354
355
|
}).primaryScheme, {
|
|
355
356
|
layer: r,
|
|
356
357
|
view: a,
|
|
357
|
-
attributes: t.map((
|
|
358
|
-
field:
|
|
359
|
-
label: r.fields.find((c) => c.name ===
|
|
358
|
+
attributes: t.map((i) => ({
|
|
359
|
+
field: i,
|
|
360
|
+
label: r.fields.find((c) => c.name === i)?.alias ?? ""
|
|
360
361
|
})).slice(0, 8),
|
|
361
362
|
outlineOptimizationEnabled: !0,
|
|
362
363
|
sizeOptimizationEnabled: !0,
|
|
@@ -364,10 +365,10 @@ async function Ut(e) {
|
|
|
364
365
|
pieChartScheme: l
|
|
365
366
|
};
|
|
366
367
|
}
|
|
367
|
-
async function
|
|
368
|
-
return await
|
|
368
|
+
async function Kt(e) {
|
|
369
|
+
return await Me(e);
|
|
369
370
|
}
|
|
370
|
-
async function
|
|
371
|
+
async function Ht({
|
|
371
372
|
arcgisMap: e,
|
|
372
373
|
arcgisMapView: t,
|
|
373
374
|
layerId: r,
|
|
@@ -375,41 +376,41 @@ async function Kt({
|
|
|
375
376
|
colorSchemes: o,
|
|
376
377
|
includeSize: n
|
|
377
378
|
}) {
|
|
378
|
-
const l = t,
|
|
379
|
-
if (!
|
|
379
|
+
const l = t, i = e?.allLayers.find((d) => d.id === r);
|
|
380
|
+
if (!i)
|
|
380
381
|
return `Could not find layer for id: ${r}`;
|
|
381
382
|
const u = {
|
|
382
383
|
styleName: n ? "chart-size" : "chart",
|
|
383
384
|
fields: a,
|
|
384
|
-
layer:
|
|
385
|
+
layer: i,
|
|
385
386
|
view: l,
|
|
386
387
|
colorSchemeTags: o
|
|
387
388
|
};
|
|
388
389
|
try {
|
|
389
|
-
const d = await Ut(u), p = await
|
|
390
|
-
return
|
|
390
|
+
const d = await Ut(u), p = await Kt(d);
|
|
391
|
+
return i.renderer = p.renderer, i.visible = !0, `Chart renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
391
392
|
} catch (d) {
|
|
392
393
|
return `Error applying chart renderer: ${d instanceof Error ? d.message : String(d)}`;
|
|
393
394
|
}
|
|
394
395
|
}
|
|
395
|
-
const
|
|
396
|
+
const Jt = ["mapView"];
|
|
396
397
|
function $(e) {
|
|
397
398
|
const r = e?.configurable?.context;
|
|
398
399
|
if (!r || typeof r != "object")
|
|
399
400
|
throw new Error("LayerStylingAgent context missing");
|
|
400
|
-
const a =
|
|
401
|
+
const a = Jt.filter((o) => !(o in r));
|
|
401
402
|
if (a.length)
|
|
402
403
|
throw new Error(`LayerStylingAgent context missing: ${a.join(", ")}`);
|
|
403
404
|
return r;
|
|
404
405
|
}
|
|
405
|
-
async function
|
|
406
|
+
async function Zt({
|
|
406
407
|
layerId: e,
|
|
407
408
|
fields: t,
|
|
408
409
|
colorSchemes: r,
|
|
409
410
|
includeSize: a
|
|
410
411
|
}, o) {
|
|
411
412
|
const { mapView: n } = $(o);
|
|
412
|
-
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await
|
|
413
|
+
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Ht({
|
|
413
414
|
arcgisMap: n.map,
|
|
414
415
|
arcgisMapView: n,
|
|
415
416
|
layerId: e,
|
|
@@ -418,12 +419,12 @@ async function Jt({
|
|
|
418
419
|
includeSize: a
|
|
419
420
|
});
|
|
420
421
|
}
|
|
421
|
-
const
|
|
422
|
-
layerId:
|
|
423
|
-
fields:
|
|
424
|
-
colorSchemes:
|
|
425
|
-
includeSize:
|
|
426
|
-
}),
|
|
422
|
+
const Yt = s.object({
|
|
423
|
+
layerId: s.string().describe("The id of the layer to apply the chart renderer to"),
|
|
424
|
+
fields: s.array(s.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
|
|
425
|
+
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
426
|
+
includeSize: s.boolean().optional().describe("Whether to vary the chart size (chart-size)")
|
|
427
|
+
}), jn = g(Zt, {
|
|
427
428
|
name: "chart",
|
|
428
429
|
description: `Label: Charts
|
|
429
430
|
Description: Show the values of two or more categories as a proportion of the total using a pie chart.
|
|
@@ -436,12 +437,12 @@ const Zt = i.object({
|
|
|
436
437
|
Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
|
|
437
438
|
Example: Show the total number of homes built in each decade using a pie chart for each feature and vary the size of each chart based on the total of all categories.
|
|
438
439
|
Fields: This style requires 2-8 number fields.`,
|
|
439
|
-
schema:
|
|
440
|
+
schema: Yt
|
|
440
441
|
});
|
|
441
|
-
function
|
|
442
|
+
function Xt(e) {
|
|
442
443
|
const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: n } = e, l = t[0];
|
|
443
|
-
let
|
|
444
|
-
return n && (
|
|
444
|
+
let i;
|
|
445
|
+
return n && (i = se({
|
|
445
446
|
geometryType: r.geometryType,
|
|
446
447
|
includedTags: n,
|
|
447
448
|
theme: o || "high-to-low"
|
|
@@ -453,13 +454,13 @@ function Yt(e) {
|
|
|
453
454
|
theme: o,
|
|
454
455
|
sizeOptimizationEnabled: !0,
|
|
455
456
|
outlineOptimizationEnabled: !0,
|
|
456
|
-
colorScheme:
|
|
457
|
+
colorScheme: i
|
|
457
458
|
};
|
|
458
459
|
}
|
|
459
|
-
async function
|
|
460
|
-
return await
|
|
460
|
+
async function er(e) {
|
|
461
|
+
return await We(e);
|
|
461
462
|
}
|
|
462
|
-
async function
|
|
463
|
+
async function tr({
|
|
463
464
|
arcgisMap: e,
|
|
464
465
|
arcgisMapView: t,
|
|
465
466
|
layerId: r,
|
|
@@ -467,32 +468,32 @@ async function er({
|
|
|
467
468
|
colorSchemes: o,
|
|
468
469
|
theme: n
|
|
469
470
|
}) {
|
|
470
|
-
const l = t,
|
|
471
|
-
if (!
|
|
471
|
+
const l = t, i = e?.allLayers.find((u) => u.id === r);
|
|
472
|
+
if (!i)
|
|
472
473
|
return `Could not find layer for id: ${r}`;
|
|
473
474
|
const c = {
|
|
474
475
|
styleName: "color-age",
|
|
475
476
|
fields: a,
|
|
476
|
-
layer:
|
|
477
|
+
layer: i,
|
|
477
478
|
view: l,
|
|
478
479
|
colorSchemeTags: o,
|
|
479
480
|
theme: n
|
|
480
481
|
};
|
|
481
482
|
try {
|
|
482
|
-
const u =
|
|
483
|
-
return
|
|
483
|
+
const u = Xt(c), d = await er(u);
|
|
484
|
+
return i.renderer = d.renderer, i.visible = !0, `Color-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
484
485
|
} catch (u) {
|
|
485
486
|
return `Error applying color-age renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
486
487
|
}
|
|
487
488
|
}
|
|
488
|
-
async function
|
|
489
|
+
async function rr({
|
|
489
490
|
layerId: e,
|
|
490
491
|
fields: t,
|
|
491
492
|
colorSchemes: r,
|
|
492
493
|
theme: a
|
|
493
494
|
}, o) {
|
|
494
495
|
const { mapView: n } = $(o);
|
|
495
|
-
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await
|
|
496
|
+
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await tr({
|
|
496
497
|
arcgisMap: n.map,
|
|
497
498
|
arcgisMapView: n,
|
|
498
499
|
layerId: e,
|
|
@@ -501,33 +502,33 @@ async function tr({
|
|
|
501
502
|
theme: a
|
|
502
503
|
});
|
|
503
504
|
}
|
|
504
|
-
const
|
|
505
|
-
layerId:
|
|
506
|
-
fields:
|
|
507
|
-
colorSchemes:
|
|
508
|
-
theme:
|
|
509
|
-
}),
|
|
505
|
+
const ar = s.object({
|
|
506
|
+
layerId: s.string().describe("The id of the layer to apply the color-age renderer to"),
|
|
507
|
+
fields: s.array(s.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
|
|
508
|
+
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
509
|
+
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
|
|
510
|
+
}), Gn = g(rr, {
|
|
510
511
|
name: "color-age",
|
|
511
512
|
description: `Label: Age (color)
|
|
512
513
|
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.
|
|
513
514
|
Keywords: since, age, how old, how long
|
|
514
515
|
Example: Show the age of each feature based on its reported date.
|
|
515
516
|
Fields: This style requires at least one field with a date type.`,
|
|
516
|
-
schema:
|
|
517
|
+
schema: ar
|
|
517
518
|
});
|
|
518
|
-
function
|
|
519
|
+
function or(e) {
|
|
519
520
|
const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
|
|
520
521
|
let { theme: n } = e, l = t[1];
|
|
521
|
-
const
|
|
522
|
+
const i = t[0];
|
|
522
523
|
let c;
|
|
523
|
-
return o && (c =
|
|
524
|
+
return o && (c = se({
|
|
524
525
|
geometryType: r.geometryType,
|
|
525
526
|
includedTags: o,
|
|
526
527
|
theme: n || "high-to-low"
|
|
527
528
|
})[0]), {
|
|
528
529
|
layer: r,
|
|
529
530
|
view: a,
|
|
530
|
-
field:
|
|
531
|
+
field: i,
|
|
531
532
|
normalizationField: l,
|
|
532
533
|
theme: n,
|
|
533
534
|
sizeOptimizationEnabled: !0,
|
|
@@ -535,10 +536,10 @@ function ar(e) {
|
|
|
535
536
|
colorScheme: c
|
|
536
537
|
};
|
|
537
538
|
}
|
|
538
|
-
async function
|
|
539
|
-
return await
|
|
539
|
+
async function nr(e) {
|
|
540
|
+
return await Ve(e);
|
|
540
541
|
}
|
|
541
|
-
async function
|
|
542
|
+
async function ir({
|
|
542
543
|
arcgisMap: e,
|
|
543
544
|
arcgisMapView: t,
|
|
544
545
|
layerId: r,
|
|
@@ -546,32 +547,32 @@ async function nr({
|
|
|
546
547
|
colorSchemes: o,
|
|
547
548
|
theme: n
|
|
548
549
|
}) {
|
|
549
|
-
const l = t,
|
|
550
|
-
if (!
|
|
550
|
+
const l = t, i = e?.allLayers.find((u) => u.id === r);
|
|
551
|
+
if (!i)
|
|
551
552
|
return `Could not find layer for id: ${r}`;
|
|
552
553
|
const c = {
|
|
553
554
|
styleName: "color",
|
|
554
555
|
fields: a,
|
|
555
|
-
layer:
|
|
556
|
+
layer: i,
|
|
556
557
|
view: l,
|
|
557
558
|
colorSchemeTags: o,
|
|
558
559
|
theme: n
|
|
559
560
|
};
|
|
560
561
|
try {
|
|
561
|
-
const u =
|
|
562
|
-
return
|
|
562
|
+
const u = or(c), d = await nr(u);
|
|
563
|
+
return i.renderer = d.renderer, i.visible = !0, `Color renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
563
564
|
} catch (u) {
|
|
564
565
|
return `Error applying color renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
565
566
|
}
|
|
566
567
|
}
|
|
567
|
-
async function
|
|
568
|
+
async function sr({
|
|
568
569
|
layerId: e,
|
|
569
570
|
fields: t,
|
|
570
571
|
colorSchemes: r,
|
|
571
572
|
theme: a
|
|
572
573
|
}, o) {
|
|
573
574
|
const { mapView: n } = $(o);
|
|
574
|
-
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await
|
|
575
|
+
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await ir({
|
|
575
576
|
arcgisMap: n.map,
|
|
576
577
|
arcgisMapView: n,
|
|
577
578
|
layerId: e,
|
|
@@ -580,25 +581,25 @@ async function ir({
|
|
|
580
581
|
theme: a
|
|
581
582
|
});
|
|
582
583
|
}
|
|
583
|
-
const
|
|
584
|
-
layerId:
|
|
585
|
-
fields:
|
|
586
|
-
colorSchemes:
|
|
587
|
-
theme:
|
|
588
|
-
}),
|
|
584
|
+
const lr = s.object({
|
|
585
|
+
layerId: s.string().describe("The id of the layer to apply the color renderer to"),
|
|
586
|
+
fields: s.array(s.string()).describe("The field(s) to use for the color renderer"),
|
|
587
|
+
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
588
|
+
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
|
|
589
|
+
}), On = g(sr, {
|
|
589
590
|
name: "color",
|
|
590
591
|
description: `Label: Counts and Amounts (color)
|
|
591
592
|
Description: Vary color along a continuous color ramp to represent numeric or ranked data.
|
|
592
593
|
Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
|
|
593
594
|
Example: Color each feature based on the population density.
|
|
594
595
|
Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.`,
|
|
595
|
-
schema:
|
|
596
|
+
schema: lr
|
|
596
597
|
});
|
|
597
|
-
function
|
|
598
|
+
function cr(e) {
|
|
598
599
|
const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: n } = e;
|
|
599
|
-
let l,
|
|
600
|
+
let l, i;
|
|
600
601
|
const c = t[0];
|
|
601
|
-
return o && (
|
|
602
|
+
return o && (i = se({
|
|
602
603
|
geometryType: r.geometryType,
|
|
603
604
|
includedTags: o,
|
|
604
605
|
theme: n || "high-to-low"
|
|
@@ -609,14 +610,14 @@ function lr(e) {
|
|
|
609
610
|
normalizationField: l,
|
|
610
611
|
theme: n,
|
|
611
612
|
colorOptions: {
|
|
612
|
-
colorScheme:
|
|
613
|
+
colorScheme: i
|
|
613
614
|
}
|
|
614
615
|
};
|
|
615
616
|
}
|
|
616
|
-
async function
|
|
617
|
-
return await
|
|
617
|
+
async function ur(e) {
|
|
618
|
+
return await Be(e);
|
|
618
619
|
}
|
|
619
|
-
async function
|
|
620
|
+
async function dr({
|
|
620
621
|
arcgisMap: e,
|
|
621
622
|
arcgisMapView: t,
|
|
622
623
|
layerId: r,
|
|
@@ -624,32 +625,32 @@ async function ur({
|
|
|
624
625
|
colorSchemes: o,
|
|
625
626
|
theme: n
|
|
626
627
|
}) {
|
|
627
|
-
const l = t,
|
|
628
|
-
if (!
|
|
628
|
+
const l = t, i = e?.allLayers.find((u) => u.id === r);
|
|
629
|
+
if (!i)
|
|
629
630
|
return `Could not find layer for id: ${r}`;
|
|
630
631
|
const c = {
|
|
631
632
|
styleName: "color-size-univariate",
|
|
632
633
|
fields: a,
|
|
633
|
-
layer:
|
|
634
|
+
layer: i,
|
|
634
635
|
view: l,
|
|
635
636
|
colorSchemeTags: o,
|
|
636
637
|
theme: n
|
|
637
638
|
};
|
|
638
639
|
try {
|
|
639
|
-
const u =
|
|
640
|
-
return
|
|
640
|
+
const u = cr(c), d = await ur(u);
|
|
641
|
+
return i.renderer = d.renderer, i.visible = !0, `Color-size-univariate renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
641
642
|
} catch (u) {
|
|
642
643
|
return `Error applying color-size-univariate renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
643
644
|
}
|
|
644
645
|
}
|
|
645
|
-
async function
|
|
646
|
+
async function pr({
|
|
646
647
|
layerId: e,
|
|
647
648
|
fields: t,
|
|
648
649
|
colorSchemes: r,
|
|
649
650
|
theme: a
|
|
650
651
|
}, o) {
|
|
651
652
|
const { mapView: n } = $(o);
|
|
652
|
-
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await
|
|
653
|
+
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await dr({
|
|
653
654
|
arcgisMap: n.map,
|
|
654
655
|
arcgisMapView: n,
|
|
655
656
|
layerId: e,
|
|
@@ -658,24 +659,24 @@ async function dr({
|
|
|
658
659
|
theme: a
|
|
659
660
|
});
|
|
660
661
|
}
|
|
661
|
-
const
|
|
662
|
-
layerId:
|
|
663
|
-
fields:
|
|
664
|
-
colorSchemes:
|
|
665
|
-
theme:
|
|
666
|
-
}),
|
|
662
|
+
const mr = s.object({
|
|
663
|
+
layerId: s.string().describe("The id of the layer to apply the color-size univariate renderer to"),
|
|
664
|
+
fields: s.array(s.string()).describe("The fields to use for the color-size univariate renderer"),
|
|
665
|
+
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
666
|
+
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
|
|
667
|
+
}), Mn = g(pr, {
|
|
667
668
|
name: "color-size-univariate",
|
|
668
669
|
description: `Label: Color and Size (univariate)
|
|
669
670
|
Description: Vary symbol size and color based on the values of two numeric attributes.
|
|
670
671
|
Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
|
|
671
672
|
Example: Color each feature based on the percentage of the population that owns a home and vary the size of each point based on total population.
|
|
672
673
|
Fields: This style requires at least two fields: one determining the color of each feature, the other determining the size of each feature. Each field may be normalized by an additional normalization field.`,
|
|
673
|
-
schema:
|
|
674
|
+
schema: mr
|
|
674
675
|
});
|
|
675
|
-
function
|
|
676
|
+
function hr(e) {
|
|
676
677
|
const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
|
|
677
678
|
let n;
|
|
678
|
-
return o && (n =
|
|
679
|
+
return o && (n = Ke({
|
|
679
680
|
includedTags: o,
|
|
680
681
|
numColors: Math.min(t.length, 8)
|
|
681
682
|
})[0]), {
|
|
@@ -686,16 +687,16 @@ function mr(e) {
|
|
|
686
687
|
},
|
|
687
688
|
attributes: t.map((l) => ({
|
|
688
689
|
field: l,
|
|
689
|
-
label: r.fields.find((
|
|
690
|
+
label: r.fields.find((i) => i.name === l)?.alias ?? ""
|
|
690
691
|
})).slice(0, 8),
|
|
691
692
|
outlineOptimizationEnabled: !0,
|
|
692
693
|
dotDensityScheme: n
|
|
693
694
|
};
|
|
694
695
|
}
|
|
695
|
-
async function
|
|
696
|
+
async function yr(e) {
|
|
696
697
|
return await Ue(e);
|
|
697
698
|
}
|
|
698
|
-
async function
|
|
699
|
+
async function fr({
|
|
699
700
|
arcgisMap: e,
|
|
700
701
|
arcgisMapView: t,
|
|
701
702
|
layerId: r,
|
|
@@ -705,7 +706,7 @@ async function yr({
|
|
|
705
706
|
const n = t, l = e?.allLayers.find((c) => c.id === r);
|
|
706
707
|
if (!l)
|
|
707
708
|
return `Could not find layer for id: ${r}`;
|
|
708
|
-
const
|
|
709
|
+
const i = {
|
|
709
710
|
styleName: "dot-density",
|
|
710
711
|
fields: a,
|
|
711
712
|
layer: l,
|
|
@@ -713,19 +714,19 @@ async function yr({
|
|
|
713
714
|
colorSchemeTags: o
|
|
714
715
|
};
|
|
715
716
|
try {
|
|
716
|
-
const c =
|
|
717
|
+
const c = hr(i), u = await yr(c);
|
|
717
718
|
return l.renderer = u.renderer, l.visible = !0, `Dot Density renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
|
|
718
719
|
} catch (c) {
|
|
719
720
|
return `Error applying dot density renderer: ${c instanceof Error ? c.message : String(c)}`;
|
|
720
721
|
}
|
|
721
722
|
}
|
|
722
|
-
async function
|
|
723
|
+
async function gr({
|
|
723
724
|
layerId: e,
|
|
724
725
|
fields: t,
|
|
725
726
|
colorSchemes: r
|
|
726
727
|
}, a) {
|
|
727
728
|
const { mapView: o } = $(a);
|
|
728
|
-
return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await
|
|
729
|
+
return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await fr({
|
|
729
730
|
arcgisMap: o.map,
|
|
730
731
|
arcgisMapView: o,
|
|
731
732
|
layerId: e,
|
|
@@ -733,11 +734,11 @@ async function fr({
|
|
|
733
734
|
colorSchemes: r
|
|
734
735
|
});
|
|
735
736
|
}
|
|
736
|
-
const
|
|
737
|
-
layerId:
|
|
738
|
-
fields:
|
|
739
|
-
colorSchemes:
|
|
740
|
-
}),
|
|
737
|
+
const wr = s.object({
|
|
738
|
+
layerId: s.string().describe("The id of the layer to apply the dot density renderer to"),
|
|
739
|
+
fields: s.array(s.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
|
|
740
|
+
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
|
|
741
|
+
}), Qn = g(gr, {
|
|
741
742
|
name: "dot-density",
|
|
742
743
|
description: `Dot Density
|
|
743
744
|
Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
|
|
@@ -751,13 +752,13 @@ const gr = i.object({
|
|
|
751
752
|
- Display demographic patterns within census tracts
|
|
752
753
|
**Fields:** Requires 2-8 number fields.
|
|
753
754
|
**Keywords:** density, how much, how many, total, number, amount`,
|
|
754
|
-
schema:
|
|
755
|
+
schema: wr
|
|
755
756
|
});
|
|
756
|
-
function
|
|
757
|
+
function br(e) {
|
|
757
758
|
const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
|
|
758
759
|
let n;
|
|
759
760
|
const l = t[0];
|
|
760
|
-
return o && (n =
|
|
761
|
+
return o && (n = Je({
|
|
761
762
|
includedTags: o,
|
|
762
763
|
basemap: a.map?.basemap || "topo"
|
|
763
764
|
})[0]), {
|
|
@@ -767,10 +768,10 @@ function wr(e) {
|
|
|
767
768
|
heatmapScheme: n
|
|
768
769
|
};
|
|
769
770
|
}
|
|
770
|
-
async function
|
|
771
|
-
return await
|
|
771
|
+
async function Tr(e) {
|
|
772
|
+
return await He(e);
|
|
772
773
|
}
|
|
773
|
-
async function
|
|
774
|
+
async function Sr({
|
|
774
775
|
arcgisMap: e,
|
|
775
776
|
arcgisMapView: t,
|
|
776
777
|
layerId: r,
|
|
@@ -780,7 +781,7 @@ async function Tr({
|
|
|
780
781
|
const n = t, l = e?.allLayers.find((c) => c.id === r);
|
|
781
782
|
if (!l)
|
|
782
783
|
return `Could not find layer for id: ${r}`;
|
|
783
|
-
const
|
|
784
|
+
const i = {
|
|
784
785
|
styleName: "heatmap",
|
|
785
786
|
fields: a,
|
|
786
787
|
layer: l,
|
|
@@ -788,7 +789,7 @@ async function Tr({
|
|
|
788
789
|
colorSchemeTags: o
|
|
789
790
|
};
|
|
790
791
|
try {
|
|
791
|
-
const c =
|
|
792
|
+
const c = br(i), u = await Tr(c);
|
|
792
793
|
return l.renderer = u.renderer, l.visible = !0, `Heatmap renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
|
|
793
794
|
} catch (c) {
|
|
794
795
|
return `Error applying heatmap renderer: ${c instanceof Error ? c.message : String(c)}`;
|
|
@@ -800,7 +801,7 @@ async function vr({
|
|
|
800
801
|
colorSchemes: r
|
|
801
802
|
}, a) {
|
|
802
803
|
const { mapView: o } = $(a);
|
|
803
|
-
return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await
|
|
804
|
+
return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await Sr({
|
|
804
805
|
arcgisMap: o.map,
|
|
805
806
|
arcgisMapView: o,
|
|
806
807
|
layerId: e,
|
|
@@ -808,40 +809,40 @@ async function vr({
|
|
|
808
809
|
colorSchemes: r
|
|
809
810
|
});
|
|
810
811
|
}
|
|
811
|
-
const
|
|
812
|
-
layerId:
|
|
813
|
-
fields:
|
|
814
|
-
colorSchemes:
|
|
815
|
-
}),
|
|
812
|
+
const xr = s.object({
|
|
813
|
+
layerId: s.string().describe("The id of the layer to apply the heatmap renderer to"),
|
|
814
|
+
fields: s.array(s.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
|
|
815
|
+
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
|
|
816
|
+
}), _n = g(vr, {
|
|
816
817
|
name: "heatmap",
|
|
817
818
|
description: `Label: Heat Map
|
|
818
819
|
Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
|
|
819
820
|
Keywords: density, heatmap, hot spots, pattern, cluster
|
|
820
821
|
Example: Create a heatmap
|
|
821
822
|
Fields: This typically requires zero or one field of type number.`,
|
|
822
|
-
schema:
|
|
823
|
+
schema: xr
|
|
823
824
|
});
|
|
824
|
-
function
|
|
825
|
+
function Rr(e) {
|
|
825
826
|
const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
|
|
826
827
|
let l;
|
|
827
|
-
return n && (l =
|
|
828
|
+
return n && (l = Ye({
|
|
828
829
|
geometryType: r.geometryType,
|
|
829
830
|
includedTags: n,
|
|
830
831
|
numColors: Math.min(t.length, 10)
|
|
831
832
|
})[0]), {
|
|
832
833
|
layer: r,
|
|
833
834
|
view: a,
|
|
834
|
-
fields: t.map((
|
|
835
|
+
fields: t.map((i) => ({ name: i })).slice(0, 9),
|
|
835
836
|
outlineOptimizationEnabled: !0,
|
|
836
837
|
sizeOptimizationEnabled: !0,
|
|
837
838
|
includeSizeVariable: o.includes("Size"),
|
|
838
839
|
predominanceScheme: l
|
|
839
840
|
};
|
|
840
841
|
}
|
|
841
|
-
async function
|
|
842
|
-
return await
|
|
842
|
+
async function $r(e) {
|
|
843
|
+
return await Ze(e);
|
|
843
844
|
}
|
|
844
|
-
async function
|
|
845
|
+
async function Cr({
|
|
845
846
|
arcgisMap: e,
|
|
846
847
|
arcgisMapView: t,
|
|
847
848
|
layerId: r,
|
|
@@ -849,31 +850,31 @@ async function $r({
|
|
|
849
850
|
colorSchemes: o,
|
|
850
851
|
includeSize: n
|
|
851
852
|
}) {
|
|
852
|
-
const l = t,
|
|
853
|
-
if (!
|
|
853
|
+
const l = t, i = e?.allLayers.find((d) => d.id === r);
|
|
854
|
+
if (!i)
|
|
854
855
|
return `Could not find layer for id: ${r}`;
|
|
855
856
|
const u = {
|
|
856
857
|
styleName: n ? "predominance-size" : "predominance",
|
|
857
858
|
fields: a,
|
|
858
|
-
layer:
|
|
859
|
+
layer: i,
|
|
859
860
|
view: l,
|
|
860
861
|
colorSchemeTags: o
|
|
861
862
|
};
|
|
862
863
|
try {
|
|
863
|
-
const d =
|
|
864
|
-
return
|
|
864
|
+
const d = Rr(u), p = await $r(d);
|
|
865
|
+
return i.renderer = p.renderer, i.visible = !0, `Predominance renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
865
866
|
} catch (d) {
|
|
866
867
|
return `Error applying predominance renderer: ${d instanceof Error ? d.message : String(d)}`;
|
|
867
868
|
}
|
|
868
869
|
}
|
|
869
|
-
async function
|
|
870
|
+
async function Er({
|
|
870
871
|
layerId: e,
|
|
871
872
|
fields: t,
|
|
872
873
|
colorSchemes: r,
|
|
873
874
|
includeSize: a
|
|
874
875
|
}, o) {
|
|
875
876
|
const { mapView: n } = $(o);
|
|
876
|
-
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await
|
|
877
|
+
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Cr({
|
|
877
878
|
arcgisMap: n.map,
|
|
878
879
|
arcgisMapView: n,
|
|
879
880
|
layerId: e,
|
|
@@ -882,12 +883,12 @@ async function Cr({
|
|
|
882
883
|
includeSize: a
|
|
883
884
|
});
|
|
884
885
|
}
|
|
885
|
-
const
|
|
886
|
-
layerId:
|
|
887
|
-
fields:
|
|
888
|
-
colorSchemes:
|
|
889
|
-
includeSize:
|
|
890
|
-
}),
|
|
886
|
+
const Fr = s.object({
|
|
887
|
+
layerId: s.string().describe("The id of the layer to apply the predominance renderer to"),
|
|
888
|
+
fields: s.array(s.string()).describe("The fields to use for the predominance renderer (competing categories)"),
|
|
889
|
+
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
890
|
+
includeSize: s.boolean().optional().describe("Whether to include size visualization (predominance-size)")
|
|
891
|
+
}), Wn = g(Er, {
|
|
891
892
|
name: "predominance",
|
|
892
893
|
description: `Label: Predominant category
|
|
893
894
|
Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
|
|
@@ -900,33 +901,33 @@ const Er = i.object({
|
|
|
900
901
|
Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
|
|
901
902
|
Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
|
|
902
903
|
Fields: This style relies on 2-10 number fields.`,
|
|
903
|
-
schema:
|
|
904
|
+
schema: Fr
|
|
904
905
|
});
|
|
905
|
-
function
|
|
906
|
+
function kr(e) {
|
|
906
907
|
const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
|
|
907
908
|
let n;
|
|
908
909
|
const l = {
|
|
909
910
|
field: t[0]
|
|
910
|
-
},
|
|
911
|
+
}, i = {
|
|
911
912
|
field: t[1]
|
|
912
913
|
};
|
|
913
|
-
return o && (n =
|
|
914
|
+
return o && (n = et({
|
|
914
915
|
geometryType: r.geometryType,
|
|
915
916
|
includedTags: o
|
|
916
917
|
})[0]), {
|
|
917
918
|
layer: r,
|
|
918
919
|
view: a,
|
|
919
920
|
field1: l,
|
|
920
|
-
field2:
|
|
921
|
+
field2: i,
|
|
921
922
|
outlineOptimizationEnabled: !0,
|
|
922
923
|
sizeOptimizationEnabled: !0,
|
|
923
924
|
relationshipScheme: n
|
|
924
925
|
};
|
|
925
926
|
}
|
|
926
927
|
async function Nr(e) {
|
|
927
|
-
return await
|
|
928
|
+
return await Xe(e);
|
|
928
929
|
}
|
|
929
|
-
async function
|
|
930
|
+
async function qr({
|
|
930
931
|
arcgisMap: e,
|
|
931
932
|
arcgisMapView: t,
|
|
932
933
|
layerId: r,
|
|
@@ -936,7 +937,7 @@ async function Ir({
|
|
|
936
937
|
const n = t, l = e?.allLayers.find((c) => c.id === r);
|
|
937
938
|
if (!l)
|
|
938
939
|
return `Could not find layer for id: ${r}`;
|
|
939
|
-
const
|
|
940
|
+
const i = {
|
|
940
941
|
styleName: "relationship",
|
|
941
942
|
fields: a,
|
|
942
943
|
layer: l,
|
|
@@ -944,19 +945,19 @@ async function Ir({
|
|
|
944
945
|
colorSchemeTags: o
|
|
945
946
|
};
|
|
946
947
|
try {
|
|
947
|
-
const c =
|
|
948
|
+
const c = kr(i), u = await Nr(c);
|
|
948
949
|
return l.renderer = u.renderer, l.visible = !0, `Relationship renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
|
|
949
950
|
} catch (c) {
|
|
950
951
|
return `Error applying relationship renderer: ${c instanceof Error ? c.message : String(c)}`;
|
|
951
952
|
}
|
|
952
953
|
}
|
|
953
|
-
async function
|
|
954
|
+
async function Ir({
|
|
954
955
|
layerId: e,
|
|
955
956
|
fields: t,
|
|
956
957
|
colorSchemes: r
|
|
957
958
|
}, a) {
|
|
958
959
|
const { mapView: o } = $(a);
|
|
959
|
-
return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await
|
|
960
|
+
return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await qr({
|
|
960
961
|
arcgisMap: o.map,
|
|
961
962
|
arcgisMapView: o,
|
|
962
963
|
layerId: e,
|
|
@@ -964,20 +965,20 @@ async function kr({
|
|
|
964
965
|
colorSchemes: r
|
|
965
966
|
});
|
|
966
967
|
}
|
|
967
|
-
const
|
|
968
|
-
layerId:
|
|
969
|
-
fields:
|
|
970
|
-
colorSchemes:
|
|
971
|
-
}),
|
|
968
|
+
const zr = s.object({
|
|
969
|
+
layerId: s.string().describe("The id of the layer to apply the relationship renderer to"),
|
|
970
|
+
fields: s.array(s.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
|
|
971
|
+
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
|
|
972
|
+
}), Vn = g(Ir, {
|
|
972
973
|
name: "relationship",
|
|
973
974
|
description: `Label: Relationship
|
|
974
975
|
Description: Overlays two color ramps to represent the relationship between two numeric attributes.
|
|
975
976
|
Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
|
|
976
977
|
Example: Show the relationship between tree height and carbon storage
|
|
977
978
|
Fields: This style requires two number fields.`,
|
|
978
|
-
schema:
|
|
979
|
+
schema: zr
|
|
979
980
|
});
|
|
980
|
-
function
|
|
981
|
+
function Dr(e) {
|
|
981
982
|
const { fields: t, layer: r, view: a, theme: o } = e, n = t[0];
|
|
982
983
|
return {
|
|
983
984
|
layer: r,
|
|
@@ -989,8 +990,8 @@ function zr(e) {
|
|
|
989
990
|
outlineOptimizationEnabled: !0
|
|
990
991
|
};
|
|
991
992
|
}
|
|
992
|
-
async function
|
|
993
|
-
return await
|
|
993
|
+
async function Pr(e) {
|
|
994
|
+
return await tt(e);
|
|
994
995
|
}
|
|
995
996
|
async function Ar({
|
|
996
997
|
arcgisMap: e,
|
|
@@ -1000,25 +1001,25 @@ async function Ar({
|
|
|
1000
1001
|
colorSchemes: o,
|
|
1001
1002
|
theme: n
|
|
1002
1003
|
}) {
|
|
1003
|
-
const l = t,
|
|
1004
|
-
if (!
|
|
1004
|
+
const l = t, i = e?.allLayers.find((u) => u.id === r);
|
|
1005
|
+
if (!i)
|
|
1005
1006
|
return `Could not find layer for id: ${r}`;
|
|
1006
1007
|
const c = {
|
|
1007
1008
|
styleName: "size-age",
|
|
1008
1009
|
fields: a,
|
|
1009
|
-
layer:
|
|
1010
|
+
layer: i,
|
|
1010
1011
|
view: l,
|
|
1011
1012
|
colorSchemeTags: o,
|
|
1012
1013
|
theme: n
|
|
1013
1014
|
};
|
|
1014
1015
|
try {
|
|
1015
|
-
const u =
|
|
1016
|
-
return
|
|
1016
|
+
const u = Dr(c), d = await Pr(u);
|
|
1017
|
+
return i.renderer = d.renderer, i.visible = !0, `Size-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
1017
1018
|
} catch (u) {
|
|
1018
1019
|
return `Error applying size-age renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
1019
1020
|
}
|
|
1020
1021
|
}
|
|
1021
|
-
async function
|
|
1022
|
+
async function Lr({
|
|
1022
1023
|
layerId: e,
|
|
1023
1024
|
fields: t,
|
|
1024
1025
|
colorSchemes: r,
|
|
@@ -1034,21 +1035,21 @@ async function Pr({
|
|
|
1034
1035
|
theme: a
|
|
1035
1036
|
});
|
|
1036
1037
|
}
|
|
1037
|
-
const
|
|
1038
|
-
layerId:
|
|
1039
|
-
fields:
|
|
1040
|
-
colorSchemes:
|
|
1041
|
-
theme:
|
|
1042
|
-
}),
|
|
1038
|
+
const jr = s.object({
|
|
1039
|
+
layerId: s.string().describe("The id of the layer to apply the size-age renderer to"),
|
|
1040
|
+
fields: s.array(s.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
|
|
1041
|
+
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
1042
|
+
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
|
|
1043
|
+
}), Bn = g(Lr, {
|
|
1043
1044
|
name: "size-age",
|
|
1044
1045
|
description: `Label: Age (size)
|
|
1045
1046
|
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.
|
|
1046
1047
|
Keywords: since, age, how old, how long
|
|
1047
1048
|
Example: Change the size of features so older features are larger than new features.
|
|
1048
1049
|
Fields: This style requires at least one field with a date type.`,
|
|
1049
|
-
schema:
|
|
1050
|
+
schema: jr
|
|
1050
1051
|
});
|
|
1051
|
-
function
|
|
1052
|
+
function Gr(e) {
|
|
1052
1053
|
const { fields: t, layer: r, view: a } = e;
|
|
1053
1054
|
let { theme: o } = e, n = t[1];
|
|
1054
1055
|
const l = t[0];
|
|
@@ -1062,10 +1063,10 @@ function jr(e) {
|
|
|
1062
1063
|
outlineOptimizationEnabled: !0
|
|
1063
1064
|
};
|
|
1064
1065
|
}
|
|
1065
|
-
async function
|
|
1066
|
-
return await
|
|
1066
|
+
async function Or(e) {
|
|
1067
|
+
return await rt(e);
|
|
1067
1068
|
}
|
|
1068
|
-
async function
|
|
1069
|
+
async function Mr({
|
|
1069
1070
|
arcgisMap: e,
|
|
1070
1071
|
arcgisMapView: t,
|
|
1071
1072
|
layerId: r,
|
|
@@ -1073,32 +1074,32 @@ async function Or({
|
|
|
1073
1074
|
colorSchemes: o,
|
|
1074
1075
|
theme: n
|
|
1075
1076
|
}) {
|
|
1076
|
-
const l = t,
|
|
1077
|
-
if (!
|
|
1077
|
+
const l = t, i = e?.allLayers.find((u) => u.id === r);
|
|
1078
|
+
if (!i)
|
|
1078
1079
|
return `Could not find layer for id: ${r}`;
|
|
1079
1080
|
const c = {
|
|
1080
1081
|
styleName: "size",
|
|
1081
1082
|
fields: a,
|
|
1082
|
-
layer:
|
|
1083
|
+
layer: i,
|
|
1083
1084
|
view: l,
|
|
1084
1085
|
colorSchemeTags: o,
|
|
1085
1086
|
theme: n
|
|
1086
1087
|
};
|
|
1087
1088
|
try {
|
|
1088
|
-
const u =
|
|
1089
|
-
return
|
|
1089
|
+
const u = Gr(c), d = await Or(u);
|
|
1090
|
+
return i.renderer = d.renderer, i.visible = !0, `Size renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
1090
1091
|
} catch (u) {
|
|
1091
1092
|
return `Error applying size renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
1092
1093
|
}
|
|
1093
1094
|
}
|
|
1094
|
-
async function
|
|
1095
|
+
async function Qr({
|
|
1095
1096
|
layerId: e,
|
|
1096
1097
|
fields: t,
|
|
1097
1098
|
colorSchemes: r,
|
|
1098
1099
|
theme: a
|
|
1099
1100
|
}, o) {
|
|
1100
1101
|
const { mapView: n } = $(o);
|
|
1101
|
-
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await
|
|
1102
|
+
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Mr({
|
|
1102
1103
|
arcgisMap: n.map,
|
|
1103
1104
|
arcgisMapView: n,
|
|
1104
1105
|
layerId: e,
|
|
@@ -1107,12 +1108,12 @@ async function Mr({
|
|
|
1107
1108
|
theme: a
|
|
1108
1109
|
});
|
|
1109
1110
|
}
|
|
1110
|
-
const
|
|
1111
|
-
layerId:
|
|
1112
|
-
fields:
|
|
1113
|
-
colorSchemes:
|
|
1114
|
-
theme:
|
|
1115
|
-
}), Un =
|
|
1111
|
+
const _r = s.object({
|
|
1112
|
+
layerId: s.string().describe("The id of the layer to apply the size renderer to"),
|
|
1113
|
+
fields: s.array(s.string()).describe("The field(s) to use for the size renderer (numeric data)"),
|
|
1114
|
+
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
1115
|
+
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
|
|
1116
|
+
}), Un = g(Qr, {
|
|
1116
1117
|
name: "size",
|
|
1117
1118
|
description: `Label: Counts and Amounts (size)
|
|
1118
1119
|
Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
|
|
@@ -1125,12 +1126,12 @@ const Qr = i.object({
|
|
|
1125
1126
|
Keywords: graduated size, proportional size, classed size, how much, total, number, when
|
|
1126
1127
|
Example: Vary the size of each feature based on the date a ticket was completed.
|
|
1127
1128
|
Fields: This style requires a single field with a date type.`,
|
|
1128
|
-
schema:
|
|
1129
|
+
schema: _r
|
|
1129
1130
|
});
|
|
1130
|
-
function
|
|
1131
|
-
const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], l = t[1],
|
|
1131
|
+
function Wr(e) {
|
|
1132
|
+
const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], l = t[1], i = t[2];
|
|
1132
1133
|
let c;
|
|
1133
|
-
return o && (c =
|
|
1134
|
+
return o && (c = ot({
|
|
1134
1135
|
geometryType: r.geometryType,
|
|
1135
1136
|
includedTags: o
|
|
1136
1137
|
})[0]), {
|
|
@@ -1138,16 +1139,16 @@ function _r(e) {
|
|
|
1138
1139
|
view: a,
|
|
1139
1140
|
field: n,
|
|
1140
1141
|
field2: l,
|
|
1141
|
-
field3:
|
|
1142
|
+
field3: i,
|
|
1142
1143
|
outlineOptimizationEnabled: !0,
|
|
1143
1144
|
sizeOptimizationEnabled: !0,
|
|
1144
1145
|
typeScheme: c
|
|
1145
1146
|
};
|
|
1146
1147
|
}
|
|
1147
|
-
async function
|
|
1148
|
-
return await
|
|
1148
|
+
async function Vr(e) {
|
|
1149
|
+
return await at(e);
|
|
1149
1150
|
}
|
|
1150
|
-
async function
|
|
1151
|
+
async function Br({
|
|
1151
1152
|
arcgisMap: e,
|
|
1152
1153
|
arcgisMapView: t,
|
|
1153
1154
|
layerId: r,
|
|
@@ -1155,20 +1156,20 @@ async function Vr({
|
|
|
1155
1156
|
colorSchemes: o,
|
|
1156
1157
|
theme: n
|
|
1157
1158
|
}) {
|
|
1158
|
-
const l = t,
|
|
1159
|
-
if (!
|
|
1159
|
+
const l = t, i = e?.allLayers.find((u) => u.id === r);
|
|
1160
|
+
if (!i)
|
|
1160
1161
|
return `Could not find layer for id: ${r}`;
|
|
1161
1162
|
const c = {
|
|
1162
1163
|
styleName: "type",
|
|
1163
1164
|
fields: a,
|
|
1164
|
-
layer:
|
|
1165
|
+
layer: i,
|
|
1165
1166
|
view: l,
|
|
1166
1167
|
colorSchemeTags: o,
|
|
1167
1168
|
theme: n
|
|
1168
1169
|
};
|
|
1169
1170
|
try {
|
|
1170
|
-
const u =
|
|
1171
|
-
return
|
|
1171
|
+
const u = Wr(c), d = await Vr(u);
|
|
1172
|
+
return i.renderer = d.renderer, i.visible = !0, `Type renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
1172
1173
|
} catch (u) {
|
|
1173
1174
|
return `Error applying type renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
1174
1175
|
}
|
|
@@ -1180,7 +1181,7 @@ async function Ur({
|
|
|
1180
1181
|
theme: a
|
|
1181
1182
|
}, o) {
|
|
1182
1183
|
const { mapView: n } = $(o);
|
|
1183
|
-
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await
|
|
1184
|
+
return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Br({
|
|
1184
1185
|
arcgisMap: n.map,
|
|
1185
1186
|
arcgisMapView: n,
|
|
1186
1187
|
layerId: e,
|
|
@@ -1189,84 +1190,84 @@ async function Ur({
|
|
|
1189
1190
|
theme: a
|
|
1190
1191
|
});
|
|
1191
1192
|
}
|
|
1192
|
-
const
|
|
1193
|
-
layerId:
|
|
1194
|
-
fields:
|
|
1195
|
-
colorSchemes:
|
|
1196
|
-
theme:
|
|
1197
|
-
}),
|
|
1193
|
+
const Kr = s.object({
|
|
1194
|
+
layerId: s.string().describe("The id of the layer to apply the type renderer to"),
|
|
1195
|
+
fields: s.array(s.string()).describe("The field(s) to use for the type renderer (categorical data)"),
|
|
1196
|
+
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
1197
|
+
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
|
|
1198
|
+
}), Kn = g(Ur, {
|
|
1198
1199
|
name: "type",
|
|
1199
1200
|
description: `Label: Types (unique symbols)
|
|
1200
1201
|
Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
|
|
1201
1202
|
Keywords: categorical, category, type, unique, discrete, point of interest, region, group
|
|
1202
1203
|
Example: Color each feature based on the region it belongs to
|
|
1203
1204
|
Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
|
|
1204
|
-
schema:
|
|
1205
|
-
}),
|
|
1206
|
-
...
|
|
1207
|
-
vectorSearchLayerIds:
|
|
1208
|
-
vectorSearchFieldResults:
|
|
1209
|
-
layerFieldInfo:
|
|
1210
|
-
selectedLayerId:
|
|
1211
|
-
}),
|
|
1212
|
-
...
|
|
1213
|
-
vectorSearchLayerIds:
|
|
1214
|
-
vectorSearchFieldResults:
|
|
1215
|
-
layerFieldInfo:
|
|
1216
|
-
queryResponse:
|
|
1217
|
-
dataExplorationMessages:
|
|
1218
|
-
reducer:
|
|
1205
|
+
schema: Kr
|
|
1206
|
+
}), Hn = T.Root({
|
|
1207
|
+
...H(),
|
|
1208
|
+
vectorSearchLayerIds: T(),
|
|
1209
|
+
vectorSearchFieldResults: T(),
|
|
1210
|
+
layerFieldInfo: T(),
|
|
1211
|
+
selectedLayerId: T()
|
|
1212
|
+
}), Jn = T.Root({
|
|
1213
|
+
...H(),
|
|
1214
|
+
vectorSearchLayerIds: T(),
|
|
1215
|
+
vectorSearchFieldResults: T(),
|
|
1216
|
+
layerFieldInfo: T(),
|
|
1217
|
+
queryResponse: T(),
|
|
1218
|
+
dataExplorationMessages: T({
|
|
1219
|
+
reducer: be,
|
|
1219
1220
|
default: () => []
|
|
1220
1221
|
})
|
|
1221
|
-
}),
|
|
1222
|
-
function
|
|
1222
|
+
}), Hr = ["mapView"];
|
|
1223
|
+
function N(e) {
|
|
1223
1224
|
const r = e?.configurable?.context;
|
|
1224
1225
|
if (!r || typeof r != "object")
|
|
1225
1226
|
throw new Error("DataExplorationAgent context missing");
|
|
1226
|
-
const a =
|
|
1227
|
+
const a = Hr.filter((o) => !(o in r));
|
|
1227
1228
|
if (a.length)
|
|
1228
1229
|
throw new Error(`DataExplorationAgent context missing: ${a.join(", ")}`);
|
|
1229
1230
|
return r;
|
|
1230
1231
|
}
|
|
1231
|
-
const
|
|
1232
|
+
const Jr = (e) => {
|
|
1232
1233
|
const t = e.map?.allLayers.filter((a) => a.type === "feature");
|
|
1233
1234
|
let r = 0;
|
|
1234
1235
|
return t?.forEach((a) => {
|
|
1235
1236
|
const o = a;
|
|
1236
1237
|
o.featureEffect && (o.featureEffect = null, r++);
|
|
1237
1238
|
}), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
|
|
1238
|
-
},
|
|
1239
|
-
const { mapView: r } =
|
|
1240
|
-
return
|
|
1241
|
-
},
|
|
1239
|
+
}, Zr = async (e, t) => {
|
|
1240
|
+
const { mapView: r } = N(t);
|
|
1241
|
+
return Jr(r);
|
|
1242
|
+
}, Yr = g(Zr, {
|
|
1242
1243
|
name: "clearFilters",
|
|
1243
1244
|
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.",
|
|
1244
|
-
schema:
|
|
1245
|
-
}),
|
|
1245
|
+
schema: s.object({})
|
|
1246
|
+
}), Xr = async (e) => {
|
|
1246
1247
|
e.map?.allLayers.filter((o) => o.type === "feature")?.forEach((o) => {
|
|
1247
1248
|
const n = o;
|
|
1248
1249
|
n.featureEffect && (n.featureEffect = null);
|
|
1249
1250
|
});
|
|
1250
1251
|
const a = e.map.initialViewProperties?.viewpoint?.targetGeometry;
|
|
1251
1252
|
return a ? (await e.goTo(a), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
|
|
1252
|
-
},
|
|
1253
|
-
const { mapView: r } =
|
|
1254
|
-
return await
|
|
1255
|
-
},
|
|
1253
|
+
}, ea = async (e, t) => {
|
|
1254
|
+
const { mapView: r } = N(t);
|
|
1255
|
+
return await Xr(r);
|
|
1256
|
+
}, ta = g(ea, {
|
|
1256
1257
|
name: "resetMap",
|
|
1257
1258
|
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.",
|
|
1258
|
-
schema:
|
|
1259
|
-
}),
|
|
1259
|
+
schema: s.object({})
|
|
1260
|
+
}), we = 750;
|
|
1260
1261
|
function U(e) {
|
|
1261
1262
|
return "point" in e && e.point !== void 0;
|
|
1262
1263
|
}
|
|
1263
1264
|
function j(e) {
|
|
1264
1265
|
return "layerId" in e && e.layerId !== void 0;
|
|
1265
1266
|
}
|
|
1266
|
-
const
|
|
1267
|
+
const J = async (e, t) => {
|
|
1267
1268
|
if (U(e)) {
|
|
1268
1269
|
const { point: r } = e;
|
|
1269
|
-
return { geometry: new
|
|
1270
|
+
return { geometry: new Te({
|
|
1270
1271
|
x: r.x,
|
|
1271
1272
|
y: r.y,
|
|
1272
1273
|
spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
|
|
@@ -1284,37 +1285,37 @@ const H = async (e, t) => {
|
|
|
1284
1285
|
where: o,
|
|
1285
1286
|
returnGeometry: !0,
|
|
1286
1287
|
outSpatialReference: t.spatialReference,
|
|
1287
|
-
num:
|
|
1288
|
+
num: we + 1
|
|
1288
1289
|
});
|
|
1289
1290
|
if (!n.features.length)
|
|
1290
1291
|
return {
|
|
1291
1292
|
error: `No features found in geometry layer "${a}" with the specified where clause: ${o}`
|
|
1292
1293
|
};
|
|
1293
|
-
if (n.features.length >
|
|
1294
|
+
if (n.features.length > we)
|
|
1294
1295
|
return {
|
|
1295
1296
|
error: `Geometry filter for layer "${a}" matched too many features (${n.features.length}+). Please narrow the geometry layer filter.`
|
|
1296
1297
|
};
|
|
1297
1298
|
const l = n.features.map((c) => c.geometry).filter((c) => !!c);
|
|
1298
1299
|
if (!l.length)
|
|
1299
1300
|
return { error: "No valid geometries found for the matched geometry layer features." };
|
|
1300
|
-
const
|
|
1301
|
-
return
|
|
1301
|
+
const i = l.length === 1 ? l[0] : st.executeMany(l);
|
|
1302
|
+
return i ? (i.spatialReference || (i.spatialReference = t.spatialReference), { geometry: i }) : { error: "Failed to combine geometries from geometry layer." };
|
|
1302
1303
|
} catch (n) {
|
|
1303
1304
|
return { error: `Failed to query geometry: ${String(n)}` };
|
|
1304
1305
|
}
|
|
1305
1306
|
}
|
|
1306
1307
|
return { error: "Invalid geometry configuration provided" };
|
|
1307
|
-
},
|
|
1308
|
+
}, ra = async (e, t, r, a, o, n) => {
|
|
1308
1309
|
const l = e.map?.allLayers.find((c) => c.id === t);
|
|
1309
1310
|
if (!l)
|
|
1310
1311
|
return { success: !1, error: `Layer '${t}' not found.` };
|
|
1311
|
-
const
|
|
1312
|
-
|
|
1312
|
+
const i = l.createQuery();
|
|
1313
|
+
i.where = r ?? "1=1", a && (i.geometry = a, i.spatialRelationship = "intersects", o && (i.distance = o), n && (i.units = n));
|
|
1313
1314
|
try {
|
|
1314
|
-
const { extent: c, count: u } = await l.queryExtent(
|
|
1315
|
+
const { extent: c, count: u } = await l.queryExtent(i);
|
|
1315
1316
|
return !c || u === 0 ? {
|
|
1316
1317
|
success: !1,
|
|
1317
|
-
error: `No features found for filter (where: ${
|
|
1318
|
+
error: `No features found for filter (where: ${i.where}${a ? ", spatial filter used" : ""})`
|
|
1318
1319
|
} : (await e.goTo(c), { success: !0 });
|
|
1319
1320
|
} catch (c) {
|
|
1320
1321
|
return {
|
|
@@ -1322,23 +1323,23 @@ const H = async (e, t) => {
|
|
|
1322
1323
|
error: c instanceof Error ? c.message : String(c)
|
|
1323
1324
|
};
|
|
1324
1325
|
}
|
|
1325
|
-
},
|
|
1326
|
+
}, aa = async (e, t, r, a, o, n) => {
|
|
1326
1327
|
const l = t.map?.allLayers.find(
|
|
1327
1328
|
(p) => p.id === e.layerId
|
|
1328
1329
|
);
|
|
1329
1330
|
if (!l)
|
|
1330
1331
|
return `Could not find target layer with ID: ${e.layerId}`;
|
|
1331
|
-
let
|
|
1332
|
+
let i;
|
|
1332
1333
|
if (o) {
|
|
1333
|
-
const p = await
|
|
1334
|
+
const p = await J(o, t);
|
|
1334
1335
|
if ("error" in p)
|
|
1335
1336
|
return p.error;
|
|
1336
|
-
|
|
1337
|
+
i = p.geometry;
|
|
1337
1338
|
}
|
|
1338
|
-
if (l.featureEffect = null, l.featureEffect = new
|
|
1339
|
+
if (l.featureEffect = null, l.featureEffect = new it({
|
|
1339
1340
|
filter: new Se({
|
|
1340
1341
|
...e.objectIds?.length ? { objectIds: e.objectIds } : { where: e.where },
|
|
1341
|
-
geometry:
|
|
1342
|
+
geometry: i,
|
|
1342
1343
|
spatialRelationship: "intersects",
|
|
1343
1344
|
distance: o?.distance,
|
|
1344
1345
|
units: o?.units
|
|
@@ -1347,62 +1348,62 @@ const H = async (e, t) => {
|
|
|
1347
1348
|
excludedEffect: a
|
|
1348
1349
|
}), l.visible = !0, n)
|
|
1349
1350
|
return `Applied feature effects to "${l.title ?? e.layerId}" within current map extent.`;
|
|
1350
|
-
const c = e.objectIds?.length ? `${l.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await
|
|
1351
|
+
const c = e.objectIds?.length ? `${l.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await ra(
|
|
1351
1352
|
t,
|
|
1352
1353
|
e.layerId,
|
|
1353
1354
|
c,
|
|
1354
|
-
|
|
1355
|
+
i,
|
|
1355
1356
|
o?.distance,
|
|
1356
1357
|
o?.units
|
|
1357
1358
|
), d = l.title ?? e.layerId;
|
|
1358
1359
|
return u.success ? `Applied feature effects to target layer "${l.title ?? e.layerId}"${o && "layerId" in o ? ` using geometry from layer "${o.layerId}"` : ""}.` : `Applied filter to "${d}" but no features matched. ${u.error}`;
|
|
1359
|
-
},
|
|
1360
|
+
}, oa = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], F = s.enum(oa), na = async ({
|
|
1360
1361
|
targetLayer: e,
|
|
1361
1362
|
geometryFilter: t,
|
|
1362
1363
|
useCurrentExtent: r,
|
|
1363
1364
|
includedEffect: a = "drop-shadow(2px, 2px, 2px, gray)",
|
|
1364
1365
|
excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
|
|
1365
1366
|
}, n) => {
|
|
1366
|
-
const { mapView: l } =
|
|
1367
|
-
return await
|
|
1368
|
-
},
|
|
1369
|
-
layerId:
|
|
1370
|
-
where:
|
|
1371
|
-
distance:
|
|
1372
|
-
units:
|
|
1373
|
-
}),
|
|
1374
|
-
point:
|
|
1375
|
-
x:
|
|
1376
|
-
y:
|
|
1377
|
-
spatialReference:
|
|
1378
|
-
wkid:
|
|
1367
|
+
const { mapView: l } = N(n);
|
|
1368
|
+
return await aa(e, l, a, o, t, r);
|
|
1369
|
+
}, ia = s.object({
|
|
1370
|
+
layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1371
|
+
where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1372
|
+
distance: s.number().optional().describe("The buffer distance around the geometry."),
|
|
1373
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1374
|
+
}), sa = s.object({
|
|
1375
|
+
point: s.object({
|
|
1376
|
+
x: s.number().describe("X coordinate (longitude) from navigation result"),
|
|
1377
|
+
y: s.number().describe("Y coordinate (latitude) from navigation result"),
|
|
1378
|
+
spatialReference: s.object({
|
|
1379
|
+
wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
|
|
1379
1380
|
}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
|
|
1380
1381
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1381
|
-
distance:
|
|
1382
|
-
units:
|
|
1383
|
-
}),
|
|
1384
|
-
targetLayer:
|
|
1385
|
-
layerId:
|
|
1386
|
-
where:
|
|
1387
|
-
objectIds:
|
|
1382
|
+
distance: s.number().optional().describe("Optional buffer distance around the point."),
|
|
1383
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1384
|
+
}), la = s.object({
|
|
1385
|
+
targetLayer: s.object({
|
|
1386
|
+
layerId: s.string().describe("The layerId of the layer on which to set a feature effect."),
|
|
1387
|
+
where: s.string().describe("The SQL-92 where clause representing the features to emphasize."),
|
|
1388
|
+
objectIds: s.array(s.number()).optional().describe(
|
|
1388
1389
|
"Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause."
|
|
1389
1390
|
)
|
|
1390
1391
|
}),
|
|
1391
|
-
geometryFilter:
|
|
1392
|
-
useCurrentExtent:
|
|
1392
|
+
geometryFilter: s.union([ia, sa]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
|
|
1393
|
+
useCurrentExtent: s.boolean().optional().describe(
|
|
1393
1394
|
"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."
|
|
1394
1395
|
),
|
|
1395
|
-
includedEffect:
|
|
1396
|
+
includedEffect: s.string().default("drop-shadow(2px, 2px, 2px, gray)").describe(
|
|
1396
1397
|
"The effect applied to features that 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."
|
|
1397
1398
|
),
|
|
1398
|
-
excludedEffect:
|
|
1399
|
+
excludedEffect: s.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
|
|
1399
1400
|
"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."
|
|
1400
1401
|
)
|
|
1401
|
-
}),
|
|
1402
|
+
}), ca = g(na, {
|
|
1402
1403
|
name: "setFeatureEffect",
|
|
1403
1404
|
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.",
|
|
1404
|
-
schema:
|
|
1405
|
-
}),
|
|
1405
|
+
schema: la
|
|
1406
|
+
}), te = (e) => {
|
|
1406
1407
|
if (e instanceof Date)
|
|
1407
1408
|
return Number.isNaN(e.getTime()) ? null : e;
|
|
1408
1409
|
if (typeof e == "number" && Number.isFinite(e)) {
|
|
@@ -1410,44 +1411,44 @@ const H = async (e, t) => {
|
|
|
1410
1411
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
1411
1412
|
}
|
|
1412
1413
|
return null;
|
|
1413
|
-
},
|
|
1414
|
+
}, ua = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, da = (e) => {
|
|
1414
1415
|
if (typeof e == "string" && e)
|
|
1415
1416
|
return e;
|
|
1416
|
-
const t =
|
|
1417
|
+
const t = te(e);
|
|
1417
1418
|
return t ? t.toISOString().slice(0, 10) : null;
|
|
1418
|
-
},
|
|
1419
|
+
}, Zn = () => {
|
|
1419
1420
|
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}`;
|
|
1420
1421
|
return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
|
|
1421
|
-
},
|
|
1422
|
+
}, pa = (e, t, r) => {
|
|
1422
1423
|
const a = t?.toLowerCase();
|
|
1423
1424
|
if (a === "date-only") {
|
|
1424
|
-
const n =
|
|
1425
|
-
return n ?
|
|
1425
|
+
const n = da(e);
|
|
1426
|
+
return n ? lt(n, _("short-date")) : e;
|
|
1426
1427
|
}
|
|
1427
1428
|
if (a === "time-only") {
|
|
1428
1429
|
if (typeof e == "string" && e)
|
|
1429
|
-
return
|
|
1430
|
-
const n =
|
|
1431
|
-
return n ?
|
|
1432
|
-
...
|
|
1430
|
+
return ct(e, _("long-time"));
|
|
1431
|
+
const n = te(e);
|
|
1432
|
+
return n ? ye(n, {
|
|
1433
|
+
..._("long-time"),
|
|
1433
1434
|
timeZone: "UTC"
|
|
1434
1435
|
}) : e;
|
|
1435
1436
|
}
|
|
1436
|
-
const o =
|
|
1437
|
-
return o ?
|
|
1438
|
-
...
|
|
1439
|
-
timeZone:
|
|
1437
|
+
const o = te(e);
|
|
1438
|
+
return o ? ye(o, {
|
|
1439
|
+
..._("short-date-short-time"),
|
|
1440
|
+
timeZone: ua(r)
|
|
1440
1441
|
}) : e;
|
|
1441
|
-
},
|
|
1442
|
+
}, Re = (e, t, r) => {
|
|
1442
1443
|
if (e && typeof e != "function") {
|
|
1443
1444
|
const a = "getField" in r && r.getField?.(e), o = a && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(a.name) : null;
|
|
1444
1445
|
if (o?.type === "coded-value") {
|
|
1445
|
-
const l = o.codedValues.find((
|
|
1446
|
+
const l = o.codedValues.find((i) => i.code === t);
|
|
1446
1447
|
return l ? l.name : null;
|
|
1447
1448
|
}
|
|
1448
1449
|
}
|
|
1449
1450
|
return null;
|
|
1450
|
-
},
|
|
1451
|
+
}, ma = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ha = (e) => {
|
|
1451
1452
|
if (e instanceof Date)
|
|
1452
1453
|
return Number.isNaN(e.getTime()) ? null : e;
|
|
1453
1454
|
if (typeof e == "number" && Number.isFinite(e)) {
|
|
@@ -1459,7 +1460,7 @@ const H = async (e, t) => {
|
|
|
1459
1460
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
1460
1461
|
}
|
|
1461
1462
|
return null;
|
|
1462
|
-
},
|
|
1463
|
+
}, ya = (e, t) => {
|
|
1463
1464
|
if (typeof e != "number")
|
|
1464
1465
|
return e;
|
|
1465
1466
|
const r = {};
|
|
@@ -1469,48 +1470,48 @@ const H = async (e, t) => {
|
|
|
1469
1470
|
} catch {
|
|
1470
1471
|
return e;
|
|
1471
1472
|
}
|
|
1472
|
-
},
|
|
1473
|
-
const a =
|
|
1473
|
+
}, fa = (e, t, r) => {
|
|
1474
|
+
const a = ha(e);
|
|
1474
1475
|
if (!a)
|
|
1475
1476
|
return e;
|
|
1476
1477
|
const o = {};
|
|
1477
|
-
t.dateStyle ? o.dateStyle = t.dateStyle : (t.year && (o.year = t.year), t.month && (o.month = t.month)), t.timeStyle && (o.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? o.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (o.hour12 = !1), o.timeZone =
|
|
1478
|
+
t.dateStyle ? o.dateStyle = t.dateStyle : (t.year && (o.year = t.year), t.month && (o.month = t.month)), t.timeStyle && (o.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? o.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (o.hour12 = !1), o.timeZone = ma(r);
|
|
1478
1479
|
try {
|
|
1479
1480
|
return new Intl.DateTimeFormat(void 0, o).format(a);
|
|
1480
1481
|
} catch {
|
|
1481
1482
|
return e;
|
|
1482
1483
|
}
|
|
1483
|
-
},
|
|
1484
|
+
}, $e = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Ce = (e, t, r, a, o) => {
|
|
1484
1485
|
if (r == null)
|
|
1485
1486
|
return r;
|
|
1486
1487
|
const l = e.getFieldConfiguration?.(t)?.fieldFormat;
|
|
1487
|
-
return l?.type === "number" ?
|
|
1488
|
-
},
|
|
1489
|
-
const o = e.fieldsIndex?.get(t), n =
|
|
1490
|
-
return
|
|
1491
|
-
},
|
|
1488
|
+
return l?.type === "number" ? ya(r, l) : l?.type === "date-time" ? fa(r, l, o) : pa(r, a, o);
|
|
1489
|
+
}, ga = (e, t, r, a) => {
|
|
1490
|
+
const o = e.fieldsIndex?.get(t), n = Re(t, r, e) ?? r;
|
|
1491
|
+
return Ce(e, t, n, o?.type, a);
|
|
1492
|
+
}, wa = (e, t) => $e(e, t), Ee = (e, t, r) => {
|
|
1492
1493
|
const a = e.objectIdField, o = t.features.map(
|
|
1493
1494
|
(l) => l.attributes[a]
|
|
1494
1495
|
), n = t.features.map((l) => {
|
|
1495
|
-
const
|
|
1496
|
+
const i = l.attributes, c = {};
|
|
1496
1497
|
return e.fields.forEach((u) => {
|
|
1497
|
-
if (!Object.hasOwn(
|
|
1498
|
+
if (!Object.hasOwn(i, u.name))
|
|
1498
1499
|
return;
|
|
1499
|
-
const d =
|
|
1500
|
+
const d = i[u.name];
|
|
1500
1501
|
if (u.name === a) {
|
|
1501
1502
|
c[u.name] = d;
|
|
1502
1503
|
return;
|
|
1503
1504
|
}
|
|
1504
|
-
const p =
|
|
1505
|
-
c[m] =
|
|
1505
|
+
const p = Re(u.name, d, e) ?? d, m = $e(e, u.name);
|
|
1506
|
+
c[m] = Ce(e, u.name, p, u.type, r);
|
|
1506
1507
|
}), c;
|
|
1507
1508
|
});
|
|
1508
1509
|
return { objectIds: o, attributes: n };
|
|
1509
|
-
},
|
|
1510
|
+
}, ba = (e, t, r) => {
|
|
1510
1511
|
const a = e.createQuery();
|
|
1511
1512
|
return a.outFields = [t], a.where = r || "1=1", a.num = 1, a;
|
|
1512
|
-
},
|
|
1513
|
-
const o = a.map?.allLayers.find((m) => m.id === e), n =
|
|
1513
|
+
}, Ta = async (e, t, r, a) => {
|
|
1514
|
+
const o = a.map?.allLayers.find((m) => m.id === e), n = ba(o, t, r.where), i = (await o.queryFeatures(n)).features[0], c = i ? i.attributes[t] : null, u = ga(o, t, c, a.timeZone), d = wa(o, t);
|
|
1514
1515
|
return {
|
|
1515
1516
|
tool: "getAttribute",
|
|
1516
1517
|
layerName: o.title ?? e,
|
|
@@ -1523,48 +1524,48 @@ const H = async (e, t) => {
|
|
|
1523
1524
|
}
|
|
1524
1525
|
};
|
|
1525
1526
|
};
|
|
1526
|
-
async function
|
|
1527
|
-
const { mapView: o } =
|
|
1527
|
+
async function Sa({ layerId: e, fieldName: t, query: r }, a) {
|
|
1528
|
+
const { mapView: o } = N(a), n = await Ta(e, t, r, o);
|
|
1528
1529
|
return JSON.stringify(n, null, 2);
|
|
1529
1530
|
}
|
|
1530
|
-
const va =
|
|
1531
|
-
layerId:
|
|
1532
|
-
fieldName:
|
|
1533
|
-
query:
|
|
1534
|
-
where:
|
|
1531
|
+
const va = s.object({
|
|
1532
|
+
layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1533
|
+
fieldName: s.string().describe("The name of the field/attribute from which to get a field value."),
|
|
1534
|
+
query: s.object({
|
|
1535
|
+
where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
|
|
1535
1536
|
})
|
|
1536
|
-
}),
|
|
1537
|
+
}), xa = g(Sa, {
|
|
1537
1538
|
name: "getAttribute",
|
|
1538
1539
|
description: "Returns an attribute value for a given feature.",
|
|
1539
1540
|
schema: va
|
|
1540
|
-
}),
|
|
1541
|
+
}), le = (e, t, r) => {
|
|
1541
1542
|
if (!(r ? e.hasAllFeaturesInView : e.hasAllFeatures))
|
|
1542
1543
|
return !1;
|
|
1543
1544
|
const o = new Set((e.availableFields ?? []).map((n) => n.toLowerCase()));
|
|
1544
1545
|
return o.has("*") ? !0 : t.every((n) => o.has(n.toLowerCase()));
|
|
1545
1546
|
};
|
|
1546
|
-
function
|
|
1547
|
+
function K(e, t) {
|
|
1547
1548
|
let r = e ?? "";
|
|
1548
1549
|
return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
|
|
1549
1550
|
}
|
|
1550
|
-
const
|
|
1551
|
-
const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: l } = e,
|
|
1552
|
-
if (!
|
|
1551
|
+
const Ra = async (e) => {
|
|
1552
|
+
const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: l } = e, i = o.map?.allLayers.find((S) => S.id === t.layerId);
|
|
1553
|
+
if (!i)
|
|
1553
1554
|
throw new Error(`Layer '${t.layerId}' not found.`);
|
|
1554
|
-
const c = await o.whenLayerView(
|
|
1555
|
+
const c = await o.whenLayerView(i), d = n.get(t.layerId)?.fieldRegistry.get(r), p = d?.alias;
|
|
1555
1556
|
if (!d)
|
|
1556
1557
|
throw new Error(`Field '${r}' not found.`);
|
|
1557
|
-
let m,
|
|
1558
|
+
let m, y;
|
|
1558
1559
|
if (l) {
|
|
1559
|
-
const
|
|
1560
|
-
if ("error" in
|
|
1561
|
-
throw new Error(
|
|
1562
|
-
if (!
|
|
1560
|
+
const S = await J(l, o);
|
|
1561
|
+
if ("error" in S)
|
|
1562
|
+
throw new Error(S.error);
|
|
1563
|
+
if (!S.geometry)
|
|
1563
1564
|
throw j(l) ? new Error(`No features found matching: ${l.where}`) : new Error("Failed to create geometry");
|
|
1564
1565
|
if (j(l)) {
|
|
1565
|
-
const
|
|
1566
|
+
const Q = o.map?.allLayers.find((A) => A.id === l.layerId);
|
|
1566
1567
|
m = {
|
|
1567
|
-
geometryLayerName:
|
|
1568
|
+
geometryLayerName: Q?.title ?? Q?.id,
|
|
1568
1569
|
geometryLayerId: l.layerId,
|
|
1569
1570
|
geometryWhere: l.where,
|
|
1570
1571
|
distance: l.distance,
|
|
@@ -1577,66 +1578,66 @@ const xa = async (e) => {
|
|
|
1577
1578
|
units: l.units,
|
|
1578
1579
|
applied: !0
|
|
1579
1580
|
});
|
|
1580
|
-
|
|
1581
|
-
geometry:
|
|
1581
|
+
y = new Se({
|
|
1582
|
+
geometry: S.geometry,
|
|
1582
1583
|
distance: l.distance,
|
|
1583
1584
|
units: l.units,
|
|
1584
1585
|
spatialRelationship: "intersects"
|
|
1585
1586
|
});
|
|
1586
1587
|
}
|
|
1587
|
-
const
|
|
1588
|
-
let
|
|
1589
|
-
const
|
|
1588
|
+
const f = le(c, [r], !1);
|
|
1589
|
+
let h = null, w = null;
|
|
1590
|
+
const b = 10;
|
|
1590
1591
|
if (d.type !== "geometry" && d.type !== "oid" && d.type !== "global-id")
|
|
1591
1592
|
try {
|
|
1592
|
-
const
|
|
1593
|
-
layer:
|
|
1594
|
-
useFeaturesInView:
|
|
1595
|
-
view:
|
|
1593
|
+
const S = {
|
|
1594
|
+
layer: i,
|
|
1595
|
+
useFeaturesInView: f,
|
|
1596
|
+
view: f ? o : void 0,
|
|
1596
1597
|
field: r,
|
|
1597
|
-
sqlWhere:
|
|
1598
|
-
...
|
|
1598
|
+
sqlWhere: K(i.definitionExpression, t.where),
|
|
1599
|
+
...y && { filter: y },
|
|
1599
1600
|
outStatisticTypes: { include: [a] }
|
|
1600
1601
|
};
|
|
1601
|
-
|
|
1602
|
-
const
|
|
1603
|
-
(
|
|
1604
|
-
layer:
|
|
1605
|
-
useFeaturesInView:
|
|
1606
|
-
view:
|
|
1602
|
+
h = await ut(S);
|
|
1603
|
+
const Q = ["string", "small-integer", "integer"], A = d.domain?.type === "coded-value" ? d.domain : null;
|
|
1604
|
+
(Q.includes(d.type) || A) && (w = (await dt({
|
|
1605
|
+
layer: i,
|
|
1606
|
+
useFeaturesInView: f,
|
|
1607
|
+
view: f ? o : void 0,
|
|
1607
1608
|
field: r,
|
|
1608
|
-
sqlWhere:
|
|
1609
|
-
...
|
|
1610
|
-
})).uniqueValueInfos.sort((
|
|
1611
|
-
...
|
|
1612
|
-
value:
|
|
1609
|
+
sqlWhere: K(i.definitionExpression, t.where),
|
|
1610
|
+
...y && { filter: y }
|
|
1611
|
+
})).uniqueValueInfos.sort((I, ze) => ze.count - I.count).slice(0, b)), w && d.domain?.type === "coded-value" && (w = w.map((I) => ({
|
|
1612
|
+
...I,
|
|
1613
|
+
value: A ? A.getName(I.value) ?? I.value : I.value
|
|
1613
1614
|
})));
|
|
1614
|
-
} catch (
|
|
1615
|
-
console.error("Statistics error:",
|
|
1615
|
+
} catch (S) {
|
|
1616
|
+
console.error("Statistics error:", S);
|
|
1616
1617
|
}
|
|
1617
1618
|
return {
|
|
1618
1619
|
tool: "getStatistics",
|
|
1619
|
-
layerName:
|
|
1620
|
-
summary: `${a} = ${typeof
|
|
1620
|
+
layerName: i.title ?? t.layerId,
|
|
1621
|
+
summary: `${a} = ${typeof h?.[a] == "number" ? h[a] : "N/A"}`,
|
|
1621
1622
|
details: {
|
|
1622
1623
|
fieldName: r,
|
|
1623
1624
|
fieldAlias: p,
|
|
1624
1625
|
statisticType: a,
|
|
1625
|
-
statistic:
|
|
1626
|
-
summaryStatistics:
|
|
1627
|
-
uniqueValues:
|
|
1626
|
+
statistic: h?.[a] ?? null,
|
|
1627
|
+
summaryStatistics: h,
|
|
1628
|
+
uniqueValues: w,
|
|
1628
1629
|
where: t.where,
|
|
1629
1630
|
spatialFilterInfo: m
|
|
1630
1631
|
}
|
|
1631
1632
|
};
|
|
1632
1633
|
};
|
|
1633
|
-
async function
|
|
1634
|
+
async function $a({
|
|
1634
1635
|
targetLayer: e,
|
|
1635
1636
|
fieldName: t,
|
|
1636
1637
|
statisticType: r,
|
|
1637
1638
|
geometryFilter: a
|
|
1638
1639
|
}, o) {
|
|
1639
|
-
const n =
|
|
1640
|
+
const n = xe(o, "layersAndFieldsRegistry"), { mapView: l } = N(o), i = await Ra({
|
|
1640
1641
|
targetLayer: e,
|
|
1641
1642
|
fieldName: t,
|
|
1642
1643
|
statisticType: r,
|
|
@@ -1644,34 +1645,34 @@ async function Ra({
|
|
|
1644
1645
|
layersAndFieldsRegistry: n,
|
|
1645
1646
|
geometryFilter: a
|
|
1646
1647
|
});
|
|
1647
|
-
return JSON.stringify(
|
|
1648
|
-
}
|
|
1649
|
-
const
|
|
1650
|
-
layerId:
|
|
1651
|
-
where:
|
|
1652
|
-
distance:
|
|
1653
|
-
units:
|
|
1654
|
-
}),
|
|
1655
|
-
point:
|
|
1656
|
-
x:
|
|
1657
|
-
y:
|
|
1658
|
-
spatialReference:
|
|
1659
|
-
wkid:
|
|
1648
|
+
return JSON.stringify(i, null, 2);
|
|
1649
|
+
}
|
|
1650
|
+
const Ca = s.object({
|
|
1651
|
+
layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1652
|
+
where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1653
|
+
distance: s.number().optional().describe("The buffer distance around the geometry."),
|
|
1654
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1655
|
+
}), Ea = s.object({
|
|
1656
|
+
point: s.object({
|
|
1657
|
+
x: s.number().describe("X coordinate (longitude) from navigation result"),
|
|
1658
|
+
y: s.number().describe("Y coordinate (latitude) from navigation result"),
|
|
1659
|
+
spatialReference: s.object({
|
|
1660
|
+
wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
|
|
1660
1661
|
}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
|
|
1661
1662
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1662
|
-
distance:
|
|
1663
|
-
units:
|
|
1664
|
-
}),
|
|
1665
|
-
targetLayer:
|
|
1666
|
-
layerId:
|
|
1667
|
-
where:
|
|
1663
|
+
distance: s.number().optional().describe("Optional buffer distance around the point."),
|
|
1664
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1665
|
+
}), Fa = s.object({
|
|
1666
|
+
targetLayer: s.object({
|
|
1667
|
+
layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1668
|
+
where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
|
|
1668
1669
|
}),
|
|
1669
|
-
geometryFilter:
|
|
1670
|
+
geometryFilter: s.union([Ca, Ea]).optional().describe(
|
|
1670
1671
|
"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."
|
|
1671
1672
|
),
|
|
1672
|
-
fieldName:
|
|
1673
|
-
statisticType:
|
|
1674
|
-
}),
|
|
1673
|
+
fieldName: s.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
|
|
1674
|
+
statisticType: s.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
|
|
1675
|
+
}), ka = g($a, {
|
|
1675
1676
|
name: "getStatistics",
|
|
1676
1677
|
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.
|
|
1677
1678
|
|
|
@@ -1686,23 +1687,23 @@ DO NOT USE FOR:
|
|
|
1686
1687
|
- Simple counts of features matching a condition — use queryFeatures instead
|
|
1687
1688
|
|
|
1688
1689
|
Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,
|
|
1689
|
-
schema:
|
|
1690
|
-
}), Na = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t),
|
|
1691
|
-
const n = r.map?.allLayers.find((m) => m.id === e.layerId), l = await r.whenLayerView(n),
|
|
1690
|
+
schema: Fa
|
|
1691
|
+
}), Na = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), qa = async (e, t, r, a, o) => {
|
|
1692
|
+
const n = r.map?.allLayers.find((m) => m.id === e.layerId), l = await r.whenLayerView(n), i = n.title ?? e.layerId;
|
|
1692
1693
|
let c;
|
|
1693
1694
|
if (a) {
|
|
1694
|
-
const m = await
|
|
1695
|
+
const m = await J(a, r);
|
|
1695
1696
|
if ("error" in m)
|
|
1696
1697
|
return {
|
|
1697
1698
|
tool: "getTopFeatures",
|
|
1698
|
-
layerName:
|
|
1699
|
+
layerName: i,
|
|
1699
1700
|
summary: "Geometry lookup failed",
|
|
1700
1701
|
details: { error: m.error }
|
|
1701
1702
|
};
|
|
1702
1703
|
if (!m.geometry)
|
|
1703
1704
|
return {
|
|
1704
1705
|
tool: "getTopFeatures",
|
|
1705
|
-
layerName:
|
|
1706
|
+
layerName: i,
|
|
1706
1707
|
summary: "No features found for geometry filter",
|
|
1707
1708
|
details: {
|
|
1708
1709
|
error: `No features found matching: ${"where" in a ? a.where : "unknown criteria"}`
|
|
@@ -1714,7 +1715,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1714
1715
|
try {
|
|
1715
1716
|
let m;
|
|
1716
1717
|
if (u) {
|
|
1717
|
-
const
|
|
1718
|
+
const h = new pt({
|
|
1718
1719
|
where: e.where || "1=1",
|
|
1719
1720
|
outFields: p,
|
|
1720
1721
|
orderByFields: e.orderByFields,
|
|
@@ -1722,34 +1723,34 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1722
1723
|
spatialRelationship: c ? "intersects" : void 0,
|
|
1723
1724
|
distance: a?.distance,
|
|
1724
1725
|
units: a?.units,
|
|
1725
|
-
topFilter: new
|
|
1726
|
+
topFilter: new mt({
|
|
1726
1727
|
topCount: t.topCount,
|
|
1727
1728
|
groupByFields: t.groupByFields,
|
|
1728
1729
|
orderByFields: t.orderByFields
|
|
1729
1730
|
})
|
|
1730
1731
|
});
|
|
1731
|
-
m = await n.queryTopFeatures(
|
|
1732
|
+
m = await n.queryTopFeatures(h);
|
|
1732
1733
|
} else {
|
|
1733
|
-
const
|
|
1734
|
-
|
|
1735
|
-
const
|
|
1734
|
+
const h = n.createQuery();
|
|
1735
|
+
h.where = K(n.definitionExpression, e.where || "1=1"), h.outFields = p.length ? p : ["*"], h.orderByFields = t.orderByFields, h.returnGeometry = !1, h.num = t.topCount, c && (h.geometry = c, h.spatialRelationship = "intersects"), a?.distance && (h.distance = a.distance), a?.units && (h.units = a.units), h.outSpatialReference = r.spatialReference;
|
|
1736
|
+
const w = [
|
|
1736
1737
|
.../* @__PURE__ */ new Set([...e.outFields, ...Na(t.orderByFields)])
|
|
1737
|
-
],
|
|
1738
|
+
], b = le(l, w, o ?? !1);
|
|
1738
1739
|
try {
|
|
1739
|
-
m =
|
|
1740
|
-
} catch (
|
|
1741
|
-
console.warn("Client-side query failed, falling back to server:",
|
|
1740
|
+
m = b ? await l.queryFeatures(h) : await n.queryFeatures(h);
|
|
1741
|
+
} catch (v) {
|
|
1742
|
+
console.warn("Client-side query failed, falling back to server:", v), m = await n.queryFeatures(h);
|
|
1742
1743
|
}
|
|
1743
1744
|
}
|
|
1744
|
-
const
|
|
1745
|
+
const y = m.features.map((h) => h.attributes[d]), { attributes: f } = Ee(n, m, r.timeZone);
|
|
1745
1746
|
return {
|
|
1746
1747
|
tool: "getTopFeatures",
|
|
1747
|
-
layerName:
|
|
1748
|
+
layerName: i,
|
|
1748
1749
|
summary: `Top ${t.topCount} features extracted`,
|
|
1749
1750
|
details: {
|
|
1750
1751
|
topCount: t.topCount,
|
|
1751
|
-
attributes:
|
|
1752
|
-
objectIds:
|
|
1752
|
+
attributes: f,
|
|
1753
|
+
objectIds: y,
|
|
1753
1754
|
objectIdField: d,
|
|
1754
1755
|
where: e.where,
|
|
1755
1756
|
orderByFields: t.orderByFields,
|
|
@@ -1759,106 +1760,106 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1759
1760
|
} catch (m) {
|
|
1760
1761
|
return {
|
|
1761
1762
|
tool: "getTopFeatures",
|
|
1762
|
-
layerName:
|
|
1763
|
+
layerName: i,
|
|
1763
1764
|
summary: "Query failed",
|
|
1764
1765
|
details: { error: m instanceof Error ? m.message : String(m) }
|
|
1765
1766
|
};
|
|
1766
1767
|
}
|
|
1767
|
-
},
|
|
1768
|
+
}, Ia = async ({
|
|
1768
1769
|
targetLayer: e,
|
|
1769
1770
|
topFilter: t,
|
|
1770
1771
|
geometryFilter: r,
|
|
1771
1772
|
useCurrentExtent: a
|
|
1772
1773
|
}, o) => {
|
|
1773
|
-
const { mapView: n } =
|
|
1774
|
+
const { mapView: n } = N(o), l = await qa(e, t, n, r, a);
|
|
1774
1775
|
return JSON.stringify(l, null, 2);
|
|
1775
|
-
},
|
|
1776
|
-
layerId:
|
|
1777
|
-
where:
|
|
1778
|
-
distance:
|
|
1779
|
-
units:
|
|
1780
|
-
}),
|
|
1781
|
-
point:
|
|
1782
|
-
x:
|
|
1783
|
-
y:
|
|
1784
|
-
spatialReference:
|
|
1785
|
-
wkid:
|
|
1776
|
+
}, za = s.object({
|
|
1777
|
+
layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1778
|
+
where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1779
|
+
distance: s.number().optional().describe("The buffer distance around the geometry."),
|
|
1780
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1781
|
+
}), Da = s.object({
|
|
1782
|
+
point: s.object({
|
|
1783
|
+
x: s.number().describe("X coordinate (longitude) from navigation result"),
|
|
1784
|
+
y: s.number().describe("Y coordinate (latitude) from navigation result"),
|
|
1785
|
+
spatialReference: s.object({
|
|
1786
|
+
wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
|
|
1786
1787
|
}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
|
|
1787
1788
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1788
|
-
distance:
|
|
1789
|
-
units:
|
|
1790
|
-
}),
|
|
1791
|
-
targetLayer:
|
|
1792
|
-
layerId:
|
|
1793
|
-
where:
|
|
1794
|
-
orderByFields:
|
|
1795
|
-
outFields:
|
|
1796
|
-
|
|
1789
|
+
distance: s.number().optional().describe("Optional buffer distance around the point."),
|
|
1790
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1791
|
+
}), Pa = s.object({
|
|
1792
|
+
targetLayer: s.object({
|
|
1793
|
+
layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1794
|
+
where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
|
|
1795
|
+
orderByFields: s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),
|
|
1796
|
+
outFields: s.array(
|
|
1797
|
+
s.string().describe(
|
|
1797
1798
|
'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 ("*").'
|
|
1798
1799
|
).default("*")
|
|
1799
1800
|
)
|
|
1800
1801
|
}),
|
|
1801
|
-
geometryFilter:
|
|
1802
|
+
geometryFilter: s.union([za, Da]).optional().describe(
|
|
1802
1803
|
"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."
|
|
1803
1804
|
),
|
|
1804
|
-
topFilter:
|
|
1805
|
-
topCount:
|
|
1806
|
-
orderByFields:
|
|
1807
|
-
|
|
1805
|
+
topFilter: s.object({
|
|
1806
|
+
topCount: s.number().describe("Number of top features to return per group."),
|
|
1807
|
+
orderByFields: s.array(
|
|
1808
|
+
s.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
|
|
1808
1809
|
),
|
|
1809
|
-
groupByFields:
|
|
1810
|
+
groupByFields: s.array(s.string().describe("Field(s) to group results by. Returns top N per group."))
|
|
1810
1811
|
}).required(),
|
|
1811
|
-
useCurrentExtent:
|
|
1812
|
+
useCurrentExtent: s.boolean().optional().describe(
|
|
1812
1813
|
"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)."
|
|
1813
1814
|
)
|
|
1814
|
-
}), Aa =
|
|
1815
|
+
}), Aa = g(Ia, {
|
|
1815
1816
|
name: "getTopFeatures",
|
|
1816
1817
|
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.',
|
|
1817
|
-
schema:
|
|
1818
|
-
}), ee = 25,
|
|
1819
|
-
const o = t.map?.allLayers.find((
|
|
1820
|
-
let
|
|
1818
|
+
schema: Pa
|
|
1819
|
+
}), ee = 25, La = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), ja = async (e, t, r, a) => {
|
|
1820
|
+
const o = t.map?.allLayers.find((w) => w.id === e.layerId), n = await t.whenLayerView(o), l = o.title ?? e.layerId;
|
|
1821
|
+
let i;
|
|
1821
1822
|
if (r) {
|
|
1822
|
-
const
|
|
1823
|
-
if ("error" in
|
|
1824
|
-
const
|
|
1823
|
+
const w = await J(r, t);
|
|
1824
|
+
if ("error" in w) {
|
|
1825
|
+
const b = { error: w.error };
|
|
1825
1826
|
if (j(r)) {
|
|
1826
|
-
const
|
|
1827
|
-
|
|
1828
|
-
} else U(r) && (
|
|
1827
|
+
const v = t.map?.allLayers.find((S) => S.id === r.layerId);
|
|
1828
|
+
b.geometryLayerName = v?.title ?? v?.id, b.geometryLayerId = r.layerId, b.geometryWhere = r.where;
|
|
1829
|
+
} else U(r) && (b.point = r.point);
|
|
1829
1830
|
return {
|
|
1830
1831
|
tool: "queryFeatures",
|
|
1831
1832
|
layerName: l,
|
|
1832
1833
|
summary: "Geometry lookup failed",
|
|
1833
|
-
details:
|
|
1834
|
+
details: b
|
|
1834
1835
|
};
|
|
1835
1836
|
}
|
|
1836
|
-
if (!
|
|
1837
|
-
const
|
|
1837
|
+
if (!w.geometry) {
|
|
1838
|
+
const b = {};
|
|
1838
1839
|
if (j(r)) {
|
|
1839
|
-
const
|
|
1840
|
-
|
|
1841
|
-
} else U(r) && (
|
|
1840
|
+
const v = t.map?.allLayers.find((S) => S.id === r.layerId);
|
|
1841
|
+
b.error = `No features found matching: ${r.where}`, b.geometryLayerName = v?.title ?? v?.id, b.geometryLayerId = r.layerId, b.geometryWhere = r.where;
|
|
1842
|
+
} else U(r) && (b.error = "Failed to create point geometry", b.point = r.point);
|
|
1842
1843
|
return {
|
|
1843
1844
|
tool: "queryFeatures",
|
|
1844
1845
|
layerName: l,
|
|
1845
1846
|
summary: "No features found for geometry filter",
|
|
1846
|
-
details:
|
|
1847
|
+
details: b
|
|
1847
1848
|
};
|
|
1848
1849
|
}
|
|
1849
|
-
|
|
1850
|
-
} else a && (
|
|
1850
|
+
i = w.geometry;
|
|
1851
|
+
} else a && (i = t.extent.clone());
|
|
1851
1852
|
const c = [
|
|
1852
|
-
.../* @__PURE__ */ new Set([...e.outFields, ...
|
|
1853
|
-
], u =
|
|
1854
|
-
p.where =
|
|
1855
|
-
let m,
|
|
1853
|
+
.../* @__PURE__ */ new Set([...e.outFields, ...La(e.orderByFields)])
|
|
1854
|
+
], u = le(n, c, a ?? !1), d = o.objectIdField, p = o.createQuery();
|
|
1855
|
+
p.where = K(o.definitionExpression, e.where || "1=1"), p.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])], p.orderByFields = e.orderByFields, i && (p.geometry = i, p.spatialRelationship = "intersects"), r?.distance && (p.distance = r.distance), r?.units && (p.units = r.units), p.outSpatialReference = t.spatialReference;
|
|
1856
|
+
let m, y;
|
|
1856
1857
|
try {
|
|
1857
|
-
m = u ? await n.queryFeatureCount(p) : await o.queryFeatureCount(p), m > 0 && m <= ee && (
|
|
1858
|
-
} catch (
|
|
1859
|
-
console.warn("Client-side query failed, falling back to server:",
|
|
1858
|
+
m = u ? await n.queryFeatureCount(p) : await o.queryFeatureCount(p), m > 0 && m <= ee && (y = u ? await n.queryFeatures(p) : await o.queryFeatures(p));
|
|
1859
|
+
} catch (w) {
|
|
1860
|
+
console.warn("Client-side query failed, falling back to server:", w), m = await o.queryFeatureCount(p), m > 0 && m <= ee && (y = await o.queryFeatures(p));
|
|
1860
1861
|
}
|
|
1861
|
-
const { objectIds:
|
|
1862
|
+
const { objectIds: f, attributes: h } = y ? Ee(o, y, t.timeZone) : { objectIds: void 0, attributes: void 0 };
|
|
1862
1863
|
return {
|
|
1863
1864
|
tool: "queryFeatures",
|
|
1864
1865
|
layerName: l,
|
|
@@ -1868,57 +1869,57 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1868
1869
|
where: e.where,
|
|
1869
1870
|
orderByFields: e.orderByFields,
|
|
1870
1871
|
outFields: e.outFields,
|
|
1871
|
-
...
|
|
1872
|
-
...
|
|
1872
|
+
...f && { objectIds: f, objectIdField: d },
|
|
1873
|
+
...h && { attributes: h },
|
|
1873
1874
|
...m > ee && {
|
|
1874
1875
|
note: `${m} features found.`
|
|
1875
1876
|
}
|
|
1876
1877
|
}
|
|
1877
1878
|
};
|
|
1878
1879
|
};
|
|
1879
|
-
async function
|
|
1880
|
+
async function Ga({
|
|
1880
1881
|
targetLayer: e,
|
|
1881
1882
|
geometryFilter: t,
|
|
1882
1883
|
useCurrentExtent: r
|
|
1883
1884
|
}, a) {
|
|
1884
|
-
const { mapView: o } =
|
|
1885
|
+
const { mapView: o } = N(a), n = await ja(e, o, t, r);
|
|
1885
1886
|
return JSON.stringify(n, null, 2);
|
|
1886
1887
|
}
|
|
1887
|
-
const
|
|
1888
|
-
layerId:
|
|
1889
|
-
where:
|
|
1890
|
-
distance:
|
|
1891
|
-
units:
|
|
1892
|
-
}),
|
|
1893
|
-
point:
|
|
1894
|
-
x:
|
|
1895
|
-
y:
|
|
1896
|
-
spatialReference:
|
|
1897
|
-
wkid:
|
|
1888
|
+
const Oa = s.object({
|
|
1889
|
+
layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1890
|
+
where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1891
|
+
distance: s.number().optional().describe("The buffer distance around the geometry."),
|
|
1892
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1893
|
+
}), Ma = s.object({
|
|
1894
|
+
point: s.object({
|
|
1895
|
+
x: s.number().describe("X coordinate (longitude) from navigation result"),
|
|
1896
|
+
y: s.number().describe("Y coordinate (latitude) from navigation result"),
|
|
1897
|
+
spatialReference: s.object({
|
|
1898
|
+
wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
|
|
1898
1899
|
}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
|
|
1899
1900
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1900
|
-
distance:
|
|
1901
|
-
units:
|
|
1902
|
-
}),
|
|
1903
|
-
targetLayer:
|
|
1904
|
-
layerId:
|
|
1905
|
-
where:
|
|
1901
|
+
distance: s.number().optional().describe("Optional buffer distance around the point."),
|
|
1902
|
+
units: F.optional().describe("The units for the distance buffer.")
|
|
1903
|
+
}), Qa = s.object({
|
|
1904
|
+
targetLayer: s.object({
|
|
1905
|
+
layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1906
|
+
where: s.string().describe(
|
|
1906
1907
|
"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."
|
|
1907
1908
|
),
|
|
1908
|
-
orderByFields:
|
|
1909
|
-
outFields:
|
|
1910
|
-
|
|
1909
|
+
orderByFields: s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),
|
|
1910
|
+
outFields: s.array(
|
|
1911
|
+
s.string().describe(
|
|
1911
1912
|
'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 ("*").'
|
|
1912
1913
|
).default("*")
|
|
1913
1914
|
)
|
|
1914
1915
|
}),
|
|
1915
|
-
geometryFilter:
|
|
1916
|
+
geometryFilter: s.union([Oa, Ma]).optional().describe(
|
|
1916
1917
|
"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."
|
|
1917
1918
|
),
|
|
1918
|
-
useCurrentExtent:
|
|
1919
|
+
useCurrentExtent: s.boolean().optional().describe(
|
|
1919
1920
|
"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)."
|
|
1920
1921
|
)
|
|
1921
|
-
}),
|
|
1922
|
+
}), _a = g(Ga, {
|
|
1922
1923
|
name: "queryFeatures",
|
|
1923
1924
|
description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
|
|
1924
1925
|
|
|
@@ -1930,55 +1931,55 @@ USE THIS TOOL FOR:
|
|
|
1930
1931
|
- Any question where the user wants to SEE or COUNT matching features
|
|
1931
1932
|
|
|
1932
1933
|
This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
|
|
1933
|
-
schema:
|
|
1934
|
-
}),
|
|
1935
|
-
async function
|
|
1936
|
-
const { messages: r } = await
|
|
1934
|
+
schema: Qa
|
|
1935
|
+
}), Wa = [xa, ka, Aa, _a], Yn = [ca, ta, Yr], Va = new nt(Wa, { handleToolErrors: !1 });
|
|
1936
|
+
async function Xn(e, t) {
|
|
1937
|
+
const { messages: r } = await Va.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
|
|
1937
1938
|
for (const n of r) {
|
|
1938
1939
|
const l = n.content;
|
|
1939
|
-
let
|
|
1940
|
-
typeof l != "string" && (
|
|
1940
|
+
let i;
|
|
1941
|
+
typeof l != "string" && (i = {
|
|
1941
1942
|
tool: n.name ?? "unknown",
|
|
1942
1943
|
layerName: "unknown",
|
|
1943
1944
|
summary: "Query failed",
|
|
1944
1945
|
details: { error: "Skipping non-string tool output:", raw: l }
|
|
1945
1946
|
});
|
|
1946
1947
|
try {
|
|
1947
|
-
typeof l == "string" ?
|
|
1948
|
+
typeof l == "string" ? i = JSON.parse(l) : i = {
|
|
1948
1949
|
tool: n.name ?? "unknown",
|
|
1949
1950
|
layerName: "unknown",
|
|
1950
1951
|
summary: "Query failed",
|
|
1951
1952
|
details: { error: "Invalid tool output type", raw: l }
|
|
1952
1953
|
};
|
|
1953
1954
|
} catch {
|
|
1954
|
-
|
|
1955
|
+
i = {
|
|
1955
1956
|
tool: n.name ?? "unknown",
|
|
1956
1957
|
layerName: "unknown",
|
|
1957
1958
|
summary: "Query failed",
|
|
1958
1959
|
details: { error: l }
|
|
1959
1960
|
};
|
|
1960
1961
|
}
|
|
1961
|
-
a.push(
|
|
1962
|
+
a.push(i), i.details && typeof i.details == "object" && "error" in i.details ? o.push(`- ${i.tool}: Error - ${String(i.details.error)}`) : o.push(`- ${i.layerName}: ${i.summary}`);
|
|
1962
1963
|
}
|
|
1963
1964
|
return await x({ text: `Finished executing layer query tool: ${o.join(", ")}` }, t), {
|
|
1964
1965
|
...e,
|
|
1965
1966
|
dataExplorationMessages: [...e.dataExplorationMessages, ...r],
|
|
1966
1967
|
queryResponse: a,
|
|
1967
1968
|
status: "success",
|
|
1968
|
-
summary: o.length > 0 ?
|
|
1969
|
+
summary: o.length > 0 ? Bt(o.join(`
|
|
1969
1970
|
`)) : "Query executed."
|
|
1970
1971
|
};
|
|
1971
1972
|
}
|
|
1972
|
-
const
|
|
1973
|
-
...
|
|
1973
|
+
const ei = T.Root({
|
|
1974
|
+
...H(),
|
|
1974
1975
|
// internal to the help agent
|
|
1975
|
-
helpInternalState:
|
|
1976
|
+
helpInternalState: T({
|
|
1976
1977
|
reducer: L,
|
|
1977
1978
|
default: () => ({
|
|
1978
1979
|
toolCallMessage: void 0
|
|
1979
1980
|
})
|
|
1980
1981
|
})
|
|
1981
|
-
}),
|
|
1982
|
+
}), Ba = (e, t) => {
|
|
1982
1983
|
const r = Array.from(e.values()).find(
|
|
1983
1984
|
({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
|
|
1984
1985
|
);
|
|
@@ -1992,62 +1993,60 @@ const Xn = w.Root({
|
|
|
1992
1993
|
|
|
1993
1994
|
${o}`;
|
|
1994
1995
|
}, Ua = async ({ layerTitle: e }, t) => {
|
|
1995
|
-
const r =
|
|
1996
|
-
return
|
|
1997
|
-
},
|
|
1996
|
+
const r = xe(t, "layersAndFieldsRegistry");
|
|
1997
|
+
return Ba(r, e);
|
|
1998
|
+
}, ti = g(Ua, {
|
|
1998
1999
|
name: "listLayerFields",
|
|
1999
2000
|
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.",
|
|
2000
|
-
schema:
|
|
2001
|
-
layerTitle:
|
|
2001
|
+
schema: s.object({
|
|
2002
|
+
layerTitle: s.string().describe("The title or partial title of the layer to list fields for.")
|
|
2002
2003
|
})
|
|
2003
|
-
}),
|
|
2004
|
-
...
|
|
2005
|
-
intent:
|
|
2004
|
+
}), ri = T.Root({
|
|
2005
|
+
...H(),
|
|
2006
|
+
intent: T({
|
|
2006
2007
|
reducer: (e, t) => t
|
|
2007
2008
|
}),
|
|
2008
|
-
arcgisKnowledgeMessages:
|
|
2009
|
-
reducer:
|
|
2009
|
+
arcgisKnowledgeMessages: T({
|
|
2010
|
+
reducer: be,
|
|
2010
2011
|
default: () => []
|
|
2011
2012
|
}),
|
|
2012
|
-
arcgisKnowledgeToolResult:
|
|
2013
|
+
arcgisKnowledgeToolResult: T({
|
|
2013
2014
|
reducer: (e, t) => t,
|
|
2014
2015
|
default: () => null
|
|
2015
2016
|
})
|
|
2016
|
-
})
|
|
2017
|
-
|
|
2018
|
-
};
|
|
2019
|
-
function ue(e) {
|
|
2017
|
+
});
|
|
2018
|
+
function ce(e) {
|
|
2020
2019
|
const t = e.map?.allLayers.filter((r) => r.type === "knowledge-graph");
|
|
2021
2020
|
if (!t || t?.length !== 1)
|
|
2022
2021
|
throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.");
|
|
2023
2022
|
}
|
|
2024
|
-
function
|
|
2023
|
+
function q(e) {
|
|
2025
2024
|
return !!e?.map && !("activeLinkChartLayer" in e.map);
|
|
2026
2025
|
}
|
|
2027
|
-
async function
|
|
2028
|
-
!e ||
|
|
2026
|
+
async function Z(e) {
|
|
2027
|
+
!e || q(e) || !e.map?.diagramNodesExtent || await e.goTo(e.map.diagramNodesExtent);
|
|
2029
2028
|
}
|
|
2030
|
-
function
|
|
2029
|
+
function O(e) {
|
|
2031
2030
|
const r = e?.configurable?.context;
|
|
2032
2031
|
if (!r || typeof r != "object")
|
|
2033
2032
|
throw new Error("ArcgisKnowledgeAgent context missing");
|
|
2034
2033
|
if (!("view" in r))
|
|
2035
2034
|
throw new Error("View context missing");
|
|
2036
2035
|
const a = r.view;
|
|
2037
|
-
return a.map && !("activeLinkChartLayer" in a.map) &&
|
|
2036
|
+
return a.map && !("activeLinkChartLayer" in a.map) && ce(a), {
|
|
2038
2037
|
view: a
|
|
2039
2038
|
};
|
|
2040
2039
|
}
|
|
2041
|
-
function
|
|
2040
|
+
function ai(e) {
|
|
2042
2041
|
const r = e?.configurable?.context;
|
|
2043
|
-
if (
|
|
2042
|
+
if (Fe(e) === "knowledgeGraph")
|
|
2044
2043
|
return "knowledgeGraph";
|
|
2045
2044
|
const o = r.view;
|
|
2046
|
-
return
|
|
2045
|
+
return q(o) ? (ce(o), "map") : "linkChart";
|
|
2047
2046
|
}
|
|
2048
|
-
async function
|
|
2047
|
+
async function M(e) {
|
|
2049
2048
|
const r = e?.configurable?.context;
|
|
2050
|
-
if (
|
|
2049
|
+
if (Fe(e) === "knowledgeGraph")
|
|
2051
2050
|
return r;
|
|
2052
2051
|
{
|
|
2053
2052
|
const o = r.view.map;
|
|
@@ -2056,22 +2055,22 @@ async function O(e) {
|
|
|
2056
2055
|
if (!n)
|
|
2057
2056
|
throw new Error("Knowledge graph url missing from link chart.");
|
|
2058
2057
|
return {
|
|
2059
|
-
knowledgeGraph: await
|
|
2058
|
+
knowledgeGraph: await fe(n)
|
|
2060
2059
|
};
|
|
2061
2060
|
} else {
|
|
2062
|
-
|
|
2061
|
+
ce(r.view);
|
|
2063
2062
|
const l = (r.view.map?.allLayers.find(
|
|
2064
2063
|
(c) => c.type === "knowledge-graph"
|
|
2065
2064
|
)).url;
|
|
2066
2065
|
if (!l)
|
|
2067
2066
|
throw new Error("Knowledge graph url missing from map.");
|
|
2068
2067
|
return {
|
|
2069
|
-
knowledgeGraph: await
|
|
2068
|
+
knowledgeGraph: await fe(l)
|
|
2070
2069
|
};
|
|
2071
2070
|
}
|
|
2072
2071
|
}
|
|
2073
2072
|
}
|
|
2074
|
-
function
|
|
2073
|
+
function Fe(e) {
|
|
2075
2074
|
const r = e?.configurable?.context;
|
|
2076
2075
|
if (!r || typeof r != "object")
|
|
2077
2076
|
throw new Error("ArcgisKnowledgeAgent context missing");
|
|
@@ -2083,12 +2082,12 @@ function Ne(e) {
|
|
|
2083
2082
|
return "view";
|
|
2084
2083
|
throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.");
|
|
2085
2084
|
}
|
|
2086
|
-
class
|
|
2085
|
+
class Ka {
|
|
2087
2086
|
constructor(t) {
|
|
2088
|
-
this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation =
|
|
2087
|
+
this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = ue.fromDataModel(t);
|
|
2089
2088
|
}
|
|
2090
2089
|
}
|
|
2091
|
-
class
|
|
2090
|
+
class ue {
|
|
2092
2091
|
constructor() {
|
|
2093
2092
|
this.schemaType = "ArcgisGraphSchema", this.entityTypes = [], this.relationshipTypes = [], this.identifierInfo = {
|
|
2094
2093
|
mappingInfo: {
|
|
@@ -2098,14 +2097,14 @@ class de {
|
|
|
2098
2097
|
};
|
|
2099
2098
|
}
|
|
2100
2099
|
static fromDataModel(t) {
|
|
2101
|
-
const r = new
|
|
2100
|
+
const r = new ue();
|
|
2102
2101
|
for (const a of t.entityTypes)
|
|
2103
2102
|
r.entityTypes.push(G.fromEntityType(a));
|
|
2104
2103
|
for (const a of t.relationshipTypes)
|
|
2105
|
-
r.relationshipTypes.push(
|
|
2104
|
+
r.relationshipTypes.push(Ha.fromRelationshipType(a));
|
|
2106
2105
|
return r.identifierInfo = {
|
|
2107
2106
|
mappingInfo: {
|
|
2108
|
-
identifierMapsTo:
|
|
2107
|
+
identifierMapsTo: Ja(
|
|
2109
2108
|
t.identifierInfo.identifierMappingInfo.identifierInfoType
|
|
2110
2109
|
),
|
|
2111
2110
|
identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
|
|
@@ -2125,13 +2124,13 @@ class G {
|
|
|
2125
2124
|
}
|
|
2126
2125
|
static fromEntityType(t) {
|
|
2127
2126
|
const r = new G();
|
|
2128
|
-
r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role =
|
|
2127
|
+
r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = Za(t.role);
|
|
2129
2128
|
for (const a of t.properties) {
|
|
2130
2129
|
const o = {
|
|
2131
2130
|
name: a.name,
|
|
2132
2131
|
alias: a.alias ? a.alias : void 0,
|
|
2133
2132
|
fieldType: a.fieldType,
|
|
2134
|
-
role:
|
|
2133
|
+
role: Ya(a.role),
|
|
2135
2134
|
geometryDef: a.fieldType === "esriFieldTypeGeometry" ? {
|
|
2136
2135
|
geometryType: a.geometryType ?? "esriGeometryAny",
|
|
2137
2136
|
hasM: a.hasM ? a.hasM : void 0,
|
|
@@ -2143,7 +2142,7 @@ class G {
|
|
|
2143
2142
|
return r;
|
|
2144
2143
|
}
|
|
2145
2144
|
}
|
|
2146
|
-
class
|
|
2145
|
+
class Ha extends G {
|
|
2147
2146
|
constructor() {
|
|
2148
2147
|
super(...arguments), this.observedEndPoints = [];
|
|
2149
2148
|
}
|
|
@@ -2158,7 +2157,7 @@ class Ka extends G {
|
|
|
2158
2157
|
return r;
|
|
2159
2158
|
}
|
|
2160
2159
|
}
|
|
2161
|
-
const
|
|
2160
|
+
const Ja = (e) => {
|
|
2162
2161
|
switch (e) {
|
|
2163
2162
|
case "esriIdentifierInfoTypeUNSPECIFIED":
|
|
2164
2163
|
return "UNSPECIFIED";
|
|
@@ -2169,7 +2168,7 @@ const Ha = (e) => {
|
|
|
2169
2168
|
default:
|
|
2170
2169
|
return e;
|
|
2171
2170
|
}
|
|
2172
|
-
},
|
|
2171
|
+
}, Za = (e) => {
|
|
2173
2172
|
switch (e) {
|
|
2174
2173
|
case "Regular":
|
|
2175
2174
|
return "esriGraphNamedObjectRegular";
|
|
@@ -2181,7 +2180,7 @@ const Ha = (e) => {
|
|
|
2181
2180
|
return e;
|
|
2182
2181
|
}
|
|
2183
2182
|
};
|
|
2184
|
-
function
|
|
2183
|
+
function Ya(e) {
|
|
2185
2184
|
switch (e) {
|
|
2186
2185
|
case "esriGraphPropertyRegular":
|
|
2187
2186
|
return "Regular";
|
|
@@ -2222,83 +2221,149 @@ function Za(e) {
|
|
|
2222
2221
|
function Y(e) {
|
|
2223
2222
|
return e?.signal;
|
|
2224
2223
|
}
|
|
2225
|
-
function
|
|
2226
|
-
|
|
2224
|
+
async function Xa(e, t) {
|
|
2225
|
+
const r = await B("arcgis_knowledge_cypher_query_prompt");
|
|
2226
|
+
return t ? `${e} ${r}
|
|
2227
2227
|
|
|
2228
2228
|
Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
|
|
2229
2229
|
|
|
2230
2230
|
Attempt Number: ${t.attemptCount}
|
|
2231
2231
|
Execution Error: ${t.executionError}
|
|
2232
2232
|
Failed Query:
|
|
2233
|
-
${t.failedGraphQuery}` : e
|
|
2233
|
+
${t.failedGraphQuery}` : `${e} ${r}`;
|
|
2234
2234
|
}
|
|
2235
|
-
async function
|
|
2236
|
-
const { graphQuery: o, explanation: n } = await
|
|
2235
|
+
async function eo(e, t, r, a) {
|
|
2236
|
+
const { graphQuery: o, explanation: n } = await de(e, t, r, a);
|
|
2237
2237
|
return { graphQuery: o, explanation: n };
|
|
2238
2238
|
}
|
|
2239
|
-
async function
|
|
2239
|
+
async function de(e, t, r, a, o) {
|
|
2240
2240
|
const n = {
|
|
2241
|
-
message:
|
|
2242
|
-
context: new
|
|
2243
|
-
};
|
|
2244
|
-
_.conversationId && (n.conversationId = _.conversationId);
|
|
2245
|
-
const l = Y(a);
|
|
2241
|
+
message: await Xa(e, o),
|
|
2242
|
+
context: new Ka(t)
|
|
2243
|
+
}, l = Y(a);
|
|
2246
2244
|
await x({ text: "Attempting to generate a cypher query from your prompt..." }, a);
|
|
2247
|
-
const
|
|
2245
|
+
const i = await me(`${r}/chat`, {
|
|
2248
2246
|
method: "post",
|
|
2249
2247
|
body: JSON.stringify(n),
|
|
2250
2248
|
headers: {
|
|
2251
2249
|
"Content-Type": "application/json",
|
|
2252
|
-
token:
|
|
2250
|
+
token: pe.findCredential(k.getDefault().url)?.token ?? ""
|
|
2253
2251
|
},
|
|
2254
2252
|
signal: l
|
|
2255
2253
|
});
|
|
2256
|
-
if (
|
|
2257
|
-
throw new Error(`Graph query service returned an error: ${
|
|
2258
|
-
cause:
|
|
2254
|
+
if (i.httpStatus !== 200)
|
|
2255
|
+
throw new Error(`Graph query service returned an error: ${i.httpStatus}`, {
|
|
2256
|
+
cause: i.data
|
|
2259
2257
|
});
|
|
2260
|
-
_.conversationId || (_.conversationId = s.data.conversationId);
|
|
2261
2258
|
let c = !1;
|
|
2262
2259
|
const u = Date.now();
|
|
2263
|
-
let d =
|
|
2260
|
+
let d = i.data.sequenceNumber, p = "", m = "", y = 1;
|
|
2264
2261
|
for (; !c; ) {
|
|
2265
|
-
await new Promise((
|
|
2266
|
-
{ text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0,
|
|
2262
|
+
await new Promise((h) => setTimeout(h, 1e3)), await x(
|
|
2263
|
+
{ text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, y)}` },
|
|
2267
2264
|
a
|
|
2268
|
-
),
|
|
2269
|
-
const
|
|
2265
|
+
), y = y % 3 + 1;
|
|
2266
|
+
const f = await me(`${r}/chat`, {
|
|
2270
2267
|
method: "post",
|
|
2271
2268
|
body: JSON.stringify({
|
|
2272
|
-
conversationId:
|
|
2273
|
-
inquiryId:
|
|
2269
|
+
conversationId: i.data.conversationId,
|
|
2270
|
+
inquiryId: i.data.inquiryId,
|
|
2274
2271
|
ackSequenceNumber: d
|
|
2275
2272
|
}),
|
|
2276
2273
|
headers: {
|
|
2277
2274
|
"Content-Type": "application/json",
|
|
2278
|
-
token:
|
|
2275
|
+
token: pe.findCredential(k.getDefault().url)?.token ?? ""
|
|
2279
2276
|
},
|
|
2280
2277
|
signal: l
|
|
2281
2278
|
});
|
|
2282
|
-
if (
|
|
2283
|
-
throw new Error(`Graph query service polling returned an error: ${
|
|
2284
|
-
cause:
|
|
2279
|
+
if (f.httpStatus !== 200)
|
|
2280
|
+
throw new Error(`Graph query service polling returned an error: ${f.httpStatus}`, {
|
|
2281
|
+
cause: f.data
|
|
2285
2282
|
});
|
|
2286
|
-
if (
|
|
2287
|
-
if (
|
|
2288
|
-
throw new Error(`Unexpected response from graph query service polling. Message: ${
|
|
2289
|
-
cause:
|
|
2283
|
+
if (f.data.context?.kind) {
|
|
2284
|
+
if (f.data.context.kind !== "GraphQueryGenerationResponse")
|
|
2285
|
+
throw new Error(`Unexpected response from graph query service polling. Message: ${f.data.message}`, {
|
|
2286
|
+
cause: f.data
|
|
2290
2287
|
});
|
|
2291
|
-
p =
|
|
2292
|
-
} else if (!
|
|
2288
|
+
p = f.data.context.graphQuery, m = f.data.message || "", c = !0;
|
|
2289
|
+
} else if (!f.data.hasMore)
|
|
2293
2290
|
c = !0;
|
|
2294
2291
|
else if (Date.now() - u > 6e4)
|
|
2295
2292
|
throw new Error("Graph query service polling timed out after 1 minute.");
|
|
2296
|
-
d =
|
|
2293
|
+
d = f.data.sequenceNumber;
|
|
2297
2294
|
}
|
|
2298
2295
|
return { graphQuery: p, explanation: m };
|
|
2299
2296
|
}
|
|
2300
|
-
|
|
2301
|
-
|
|
2297
|
+
function to(e, t) {
|
|
2298
|
+
z(e, (r) => {
|
|
2299
|
+
t.set(`${r.typeName}__${r.id}`, {
|
|
2300
|
+
id: r.id,
|
|
2301
|
+
typeName: r.typeName
|
|
2302
|
+
});
|
|
2303
|
+
});
|
|
2304
|
+
}
|
|
2305
|
+
function z(e, t) {
|
|
2306
|
+
if (!(!e || typeof e != "object")) {
|
|
2307
|
+
if (ao(e))
|
|
2308
|
+
for (const r of e.path)
|
|
2309
|
+
z(r, t);
|
|
2310
|
+
else if (ro(e))
|
|
2311
|
+
t(e);
|
|
2312
|
+
else if (Array.isArray(e))
|
|
2313
|
+
for (const r of e)
|
|
2314
|
+
z(r, t);
|
|
2315
|
+
else if (oo(e))
|
|
2316
|
+
for (const r of Object.values(e.properties ?? {}))
|
|
2317
|
+
z(r, t);
|
|
2318
|
+
}
|
|
2319
|
+
}
|
|
2320
|
+
function ro(e) {
|
|
2321
|
+
return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
|
|
2322
|
+
}
|
|
2323
|
+
function ao(e) {
|
|
2324
|
+
return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
|
|
2325
|
+
}
|
|
2326
|
+
function oo(e) {
|
|
2327
|
+
return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
|
|
2328
|
+
}
|
|
2329
|
+
function no(e, t) {
|
|
2330
|
+
const r = [], a = [], o = [
|
|
2331
|
+
[t.dataModel.entityTypes, r],
|
|
2332
|
+
[t.dataModel.relationshipTypes, a]
|
|
2333
|
+
];
|
|
2334
|
+
for (const [n, l] of o)
|
|
2335
|
+
for (const i of n) {
|
|
2336
|
+
const c = e.getMemberIdsByType(i.name);
|
|
2337
|
+
l.push(...c);
|
|
2338
|
+
}
|
|
2339
|
+
return { entityIds: r, relationshipIds: a };
|
|
2340
|
+
}
|
|
2341
|
+
function io(e, t) {
|
|
2342
|
+
const r = { entityIds: new Array(), relationshipIds: new Array() }, a = [], n = e?.allLayers.find((c) => c.type === "knowledge-graph")?.inclusionModeDefinition;
|
|
2343
|
+
if (!n)
|
|
2344
|
+
return { allNamedTypesFullyDynamic: !0, bindParameters: r, nonDynamicTypes: a };
|
|
2345
|
+
const l = [
|
|
2346
|
+
[t.dataModel.entityTypes, r.entityIds],
|
|
2347
|
+
[t.dataModel.relationshipTypes, r.relationshipIds]
|
|
2348
|
+
];
|
|
2349
|
+
let i = !0;
|
|
2350
|
+
for (const [c, u] of l)
|
|
2351
|
+
for (const d of c) {
|
|
2352
|
+
const p = n.namedTypeDefinitions.get(d.name);
|
|
2353
|
+
if (!p) {
|
|
2354
|
+
i = !1, a.push(d.name);
|
|
2355
|
+
continue;
|
|
2356
|
+
}
|
|
2357
|
+
if (!p.useAllData) {
|
|
2358
|
+
i = !1, a.push(d.name);
|
|
2359
|
+
for (const [m] of p.members || [])
|
|
2360
|
+
u.push(m);
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
return { allNamedTypesFullyDynamic: i, bindParameters: r, nonDynamicTypes: a };
|
|
2364
|
+
}
|
|
2365
|
+
const D = 3;
|
|
2366
|
+
function ke(e, t = 100) {
|
|
2302
2367
|
const r = {};
|
|
2303
2368
|
for (const a of Object.entries(e.properties ?? {})) {
|
|
2304
2369
|
const [o, n] = a;
|
|
@@ -2306,10 +2371,10 @@ function Ie(e, t = 100) {
|
|
|
2306
2371
|
}
|
|
2307
2372
|
return e.properties = r, e;
|
|
2308
2373
|
}
|
|
2309
|
-
function
|
|
2374
|
+
function P(e) {
|
|
2310
2375
|
return typeof e != "object" || e === null ? String(e) : "details" in e && typeof e.details == "object" && e.details !== null && "errorMessage" in e.details && typeof e.details.errorMessage == "string" ? e.details.errorMessage : "message" in e && typeof e.message == "string" ? e.message : String(e);
|
|
2311
2376
|
}
|
|
2312
|
-
const
|
|
2377
|
+
const so = async ({
|
|
2313
2378
|
kg: e,
|
|
2314
2379
|
queryParams: t,
|
|
2315
2380
|
targetStructure: r,
|
|
@@ -2318,119 +2383,121 @@ const eo = async ({
|
|
|
2318
2383
|
queryRowLimit: n,
|
|
2319
2384
|
queryTimeoutMs: l
|
|
2320
2385
|
}) => {
|
|
2321
|
-
let
|
|
2386
|
+
let i = null, c = r;
|
|
2322
2387
|
const u = new AbortController(), d = o?.signal, p = () => {
|
|
2323
2388
|
u.abort(d?.reason);
|
|
2324
2389
|
};
|
|
2325
2390
|
d && (d.aborted ? u.abort(d.reason) : d.addEventListener("abort", p, { once: !0 }));
|
|
2326
2391
|
try {
|
|
2327
|
-
const m = await
|
|
2328
|
-
|
|
2329
|
-
const
|
|
2330
|
-
let
|
|
2331
|
-
const
|
|
2392
|
+
const m = await yt(e, t, o);
|
|
2393
|
+
i = m.resultHeader;
|
|
2394
|
+
const y = m.resultRowsStream.getReader();
|
|
2395
|
+
let f = 0;
|
|
2396
|
+
const h = Date.now(), w = !1;
|
|
2332
2397
|
for (; ; ) {
|
|
2333
|
-
const { done:
|
|
2334
|
-
if (
|
|
2398
|
+
const { done: b, value: v } = await y.read();
|
|
2399
|
+
if (b)
|
|
2335
2400
|
break;
|
|
2336
|
-
if (!
|
|
2401
|
+
if (!w && l && Date.now() - h > l)
|
|
2337
2402
|
return u.abort(), { type: "timeout" };
|
|
2338
|
-
for (const
|
|
2339
|
-
if (
|
|
2340
|
-
return u.abort(), { type: "success", rowLimitReached: !0, resultHeader:
|
|
2341
|
-
c = a(c,
|
|
2403
|
+
for (const S of v) {
|
|
2404
|
+
if (f++, n && f > n)
|
|
2405
|
+
return u.abort(), { type: "success", rowLimitReached: !0, resultHeader: i, processedResult: c };
|
|
2406
|
+
c = a(c, S);
|
|
2342
2407
|
}
|
|
2343
2408
|
}
|
|
2344
2409
|
} catch (m) {
|
|
2345
|
-
return u.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage:
|
|
2410
|
+
return u.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: P(m), error: m };
|
|
2346
2411
|
} finally {
|
|
2347
2412
|
d?.removeEventListener("abort", p);
|
|
2348
2413
|
}
|
|
2349
|
-
return { type: "success", rowLimitReached: !1, resultHeader:
|
|
2414
|
+
return { type: "success", rowLimitReached: !1, resultHeader: i, processedResult: c };
|
|
2350
2415
|
};
|
|
2351
|
-
async function
|
|
2416
|
+
async function Ne({
|
|
2352
2417
|
prompt: e,
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2418
|
+
bindParameters: t,
|
|
2419
|
+
kg: r,
|
|
2420
|
+
graphQueryServiceUrl: a,
|
|
2421
|
+
targetStructure: o,
|
|
2422
|
+
targetStructureReducer: n,
|
|
2423
|
+
requestOptions: l,
|
|
2424
|
+
queryRowLimit: i,
|
|
2425
|
+
queryTimeoutMs: c,
|
|
2426
|
+
config: u
|
|
2361
2427
|
}) {
|
|
2362
|
-
let
|
|
2363
|
-
for (let
|
|
2364
|
-
let
|
|
2428
|
+
let d;
|
|
2429
|
+
for (let p = 1; p <= D; p++) {
|
|
2430
|
+
let m;
|
|
2365
2431
|
try {
|
|
2366
|
-
|
|
2367
|
-
} catch (
|
|
2432
|
+
m = await de(e, r.dataModel, a, u, d);
|
|
2433
|
+
} catch (h) {
|
|
2368
2434
|
return {
|
|
2369
2435
|
type: "generation-error",
|
|
2370
|
-
errorMessage:
|
|
2371
|
-
error:
|
|
2436
|
+
errorMessage: P(h),
|
|
2437
|
+
error: h
|
|
2372
2438
|
};
|
|
2373
2439
|
}
|
|
2374
2440
|
await x(
|
|
2375
2441
|
{
|
|
2376
|
-
text: `Attempting to execute query: ${
|
|
2442
|
+
text: `Attempting to execute query: ${m.graphQuery.substring(0, 500)}${m.graphQuery.length > 500 ? "..." : ""}`
|
|
2377
2443
|
},
|
|
2378
|
-
|
|
2444
|
+
u
|
|
2379
2445
|
);
|
|
2380
|
-
const
|
|
2381
|
-
kg:
|
|
2382
|
-
queryParams: new
|
|
2383
|
-
openCypherQuery:
|
|
2446
|
+
const y = await so({
|
|
2447
|
+
kg: r,
|
|
2448
|
+
queryParams: new ve({
|
|
2449
|
+
openCypherQuery: m.graphQuery,
|
|
2450
|
+
bindParameters: t
|
|
2384
2451
|
}),
|
|
2385
|
-
targetStructure:
|
|
2386
|
-
targetStructureReducer:
|
|
2387
|
-
requestOptions:
|
|
2388
|
-
queryRowLimit:
|
|
2389
|
-
queryTimeoutMs:
|
|
2390
|
-
}),
|
|
2391
|
-
if (
|
|
2452
|
+
targetStructure: o,
|
|
2453
|
+
targetStructureReducer: n,
|
|
2454
|
+
requestOptions: l,
|
|
2455
|
+
queryRowLimit: i,
|
|
2456
|
+
queryTimeoutMs: c
|
|
2457
|
+
}), f = y.type === "aborted" ? "Query execution was aborted." : y.type === "timeout" ? "Query execution timed out." : y.type === "error" ? `Query failed with error: ${y.errorMessage}` : "";
|
|
2458
|
+
if (y.type === "success")
|
|
2392
2459
|
return {
|
|
2393
2460
|
type: "success",
|
|
2394
|
-
graphQuery:
|
|
2395
|
-
explanation:
|
|
2396
|
-
rowLimitReached:
|
|
2397
|
-
resultHeader:
|
|
2398
|
-
processedResult:
|
|
2461
|
+
graphQuery: m.graphQuery,
|
|
2462
|
+
explanation: m.explanation,
|
|
2463
|
+
rowLimitReached: y.rowLimitReached,
|
|
2464
|
+
resultHeader: y.resultHeader,
|
|
2465
|
+
processedResult: y.processedResult
|
|
2399
2466
|
};
|
|
2400
|
-
if (
|
|
2467
|
+
if (y.type === "aborted")
|
|
2401
2468
|
return {
|
|
2402
2469
|
type: "aborted",
|
|
2403
|
-
errorMessage:
|
|
2404
|
-
graphQuery:
|
|
2405
|
-
explanation:
|
|
2470
|
+
errorMessage: f,
|
|
2471
|
+
graphQuery: m.graphQuery,
|
|
2472
|
+
explanation: m.explanation
|
|
2406
2473
|
};
|
|
2407
|
-
if (
|
|
2408
|
-
return
|
|
2474
|
+
if (p >= D)
|
|
2475
|
+
return y.type === "timeout" ? {
|
|
2409
2476
|
type: "timeout",
|
|
2410
|
-
errorMessage:
|
|
2411
|
-
graphQuery:
|
|
2412
|
-
explanation:
|
|
2477
|
+
errorMessage: f,
|
|
2478
|
+
graphQuery: m.graphQuery,
|
|
2479
|
+
explanation: m.explanation
|
|
2413
2480
|
} : {
|
|
2414
2481
|
type: "execution-error",
|
|
2415
|
-
errorMessage:
|
|
2416
|
-
error:
|
|
2417
|
-
graphQuery:
|
|
2418
|
-
explanation:
|
|
2482
|
+
errorMessage: f,
|
|
2483
|
+
error: y.error,
|
|
2484
|
+
graphQuery: m.graphQuery,
|
|
2485
|
+
explanation: m.explanation
|
|
2419
2486
|
};
|
|
2420
|
-
|
|
2421
|
-
failedGraphQuery:
|
|
2422
|
-
executionError:
|
|
2423
|
-
attemptCount:
|
|
2487
|
+
d = {
|
|
2488
|
+
failedGraphQuery: m.graphQuery,
|
|
2489
|
+
executionError: f,
|
|
2490
|
+
attemptCount: p
|
|
2424
2491
|
}, await x(
|
|
2425
|
-
{ text: `Attempt ${
|
|
2426
|
-
|
|
2492
|
+
{ text: `Attempt ${p} failed with error: ${f}. Retrying...` },
|
|
2493
|
+
u
|
|
2427
2494
|
);
|
|
2428
2495
|
}
|
|
2429
2496
|
throw new Error(
|
|
2430
|
-
`Failed to execute generated cypher due to an unexpected error after ${
|
|
2497
|
+
`Failed to execute generated cypher due to an unexpected error after ${D} attempts.`
|
|
2431
2498
|
);
|
|
2432
2499
|
}
|
|
2433
|
-
const
|
|
2500
|
+
const lo = async ({
|
|
2434
2501
|
kg: e,
|
|
2435
2502
|
searchQuery: t,
|
|
2436
2503
|
typeCategoryFilter: r,
|
|
@@ -2439,17 +2506,17 @@ const to = async ({
|
|
|
2439
2506
|
requestOptions: n
|
|
2440
2507
|
}) => {
|
|
2441
2508
|
const l = [];
|
|
2442
|
-
let
|
|
2443
|
-
r === "both" && !e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth") && (
|
|
2509
|
+
let i = [r];
|
|
2510
|
+
r === "both" && !e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth") && (i = ["entity", "relationship"]);
|
|
2444
2511
|
const c = o ?? 1 / 0;
|
|
2445
2512
|
try {
|
|
2446
|
-
for (const u of
|
|
2513
|
+
for (const u of i) {
|
|
2447
2514
|
const d = c - l.length;
|
|
2448
2515
|
if (d <= 0)
|
|
2449
2516
|
break;
|
|
2450
|
-
const
|
|
2517
|
+
const y = (await ft(
|
|
2451
2518
|
e,
|
|
2452
|
-
new
|
|
2519
|
+
new gt({
|
|
2453
2520
|
searchQuery: t,
|
|
2454
2521
|
typeCategoryFilter: u,
|
|
2455
2522
|
namedTypesFilter: a ?? void 0,
|
|
@@ -2457,20 +2524,20 @@ const to = async ({
|
|
|
2457
2524
|
}),
|
|
2458
2525
|
n
|
|
2459
2526
|
)).resultRowsStream.getReader();
|
|
2460
|
-
let
|
|
2461
|
-
for (; !
|
|
2462
|
-
const { done:
|
|
2463
|
-
if (
|
|
2464
|
-
|
|
2527
|
+
let f = !1;
|
|
2528
|
+
for (; !f; ) {
|
|
2529
|
+
const { done: h, value: w } = await y.read();
|
|
2530
|
+
if (h) {
|
|
2531
|
+
f = !0;
|
|
2465
2532
|
break;
|
|
2466
2533
|
}
|
|
2467
|
-
for (const
|
|
2468
|
-
for (const
|
|
2469
|
-
l.push(
|
|
2534
|
+
for (const b of w)
|
|
2535
|
+
for (const v of b)
|
|
2536
|
+
l.push(v);
|
|
2470
2537
|
}
|
|
2471
2538
|
}
|
|
2472
2539
|
} catch (u) {
|
|
2473
|
-
const d =
|
|
2540
|
+
const d = P(u);
|
|
2474
2541
|
return n?.signal?.aborted ? {
|
|
2475
2542
|
type: "aborted",
|
|
2476
2543
|
errorMessage: d,
|
|
@@ -2481,120 +2548,110 @@ const to = async ({
|
|
|
2481
2548
|
type: "success",
|
|
2482
2549
|
results: l
|
|
2483
2550
|
};
|
|
2484
|
-
};
|
|
2485
|
-
function
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
for (const r of e)
|
|
2502
|
-
D(r, t);
|
|
2503
|
-
else if (no(e))
|
|
2504
|
-
for (const r of Object.values(e.properties ?? {}))
|
|
2505
|
-
D(r, t);
|
|
2506
|
-
}
|
|
2507
|
-
}
|
|
2508
|
-
function ao(e) {
|
|
2509
|
-
return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
|
|
2510
|
-
}
|
|
2511
|
-
function oo(e) {
|
|
2512
|
-
return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
|
|
2513
|
-
}
|
|
2514
|
-
function no(e) {
|
|
2515
|
-
return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
|
|
2516
|
-
}
|
|
2517
|
-
function io(e, t) {
|
|
2518
|
-
const r = [];
|
|
2519
|
-
for (const a of [...t.dataModel.entityTypes, ...t.dataModel.relationshipTypes]) {
|
|
2520
|
-
const o = e.getMemberIdsByType(a.name);
|
|
2521
|
-
for (const n of o)
|
|
2522
|
-
r.push({ id: n, typeName: a.name });
|
|
2551
|
+
}, qe = "IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";
|
|
2552
|
+
async function Ie({
|
|
2553
|
+
prompt: e,
|
|
2554
|
+
view: t,
|
|
2555
|
+
knowledgeGraph: r,
|
|
2556
|
+
includeReturnEntityAndRelationshipContext: a = !1
|
|
2557
|
+
}) {
|
|
2558
|
+
const o = [e];
|
|
2559
|
+
if (a && o.push(qe), !q(t) && t.map) {
|
|
2560
|
+
const d = await B("arcgis_knowledge_current_lc_context"), p = no(t.map, r);
|
|
2561
|
+
return o.push(d), {
|
|
2562
|
+
enhancedPrompt: o.join(`
|
|
2563
|
+
|
|
2564
|
+
`),
|
|
2565
|
+
bindParameters: p,
|
|
2566
|
+
allNamedTypesFullyDynamic: !1
|
|
2567
|
+
};
|
|
2523
2568
|
}
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
if (
|
|
2529
|
-
return {
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2569
|
+
const n = t.map, { allNamedTypesFullyDynamic: l, bindParameters: i, nonDynamicTypes: c } = io(
|
|
2570
|
+
n,
|
|
2571
|
+
r
|
|
2572
|
+
);
|
|
2573
|
+
if (l)
|
|
2574
|
+
return {
|
|
2575
|
+
enhancedPrompt: o.join(`
|
|
2576
|
+
|
|
2577
|
+
`),
|
|
2578
|
+
bindParameters: i,
|
|
2579
|
+
allNamedTypesFullyDynamic: !0
|
|
2580
|
+
};
|
|
2581
|
+
const u = (await B("arcgis_knowledge_current_map_context")).replaceAll(
|
|
2582
|
+
"{nonDynamicTypes}",
|
|
2583
|
+
JSON.stringify(c)
|
|
2584
|
+
);
|
|
2585
|
+
return o.push(u), {
|
|
2586
|
+
enhancedPrompt: o.join(`
|
|
2587
|
+
|
|
2588
|
+
`),
|
|
2589
|
+
bindParameters: i,
|
|
2590
|
+
allNamedTypesFullyDynamic: l
|
|
2591
|
+
};
|
|
2537
2592
|
}
|
|
2538
|
-
async function
|
|
2539
|
-
const { view:
|
|
2593
|
+
async function co(e, t, r, a, o, n) {
|
|
2594
|
+
const { view: l } = o, i = await Ne({
|
|
2540
2595
|
prompt: e,
|
|
2541
|
-
|
|
2542
|
-
|
|
2596
|
+
bindParameters: t,
|
|
2597
|
+
kg: r,
|
|
2598
|
+
graphQueryServiceUrl: a,
|
|
2543
2599
|
targetStructure: /* @__PURE__ */ new Map(),
|
|
2544
|
-
targetStructureReducer: (
|
|
2545
|
-
for (const
|
|
2546
|
-
|
|
2547
|
-
return
|
|
2600
|
+
targetStructureReducer: (m, y) => {
|
|
2601
|
+
for (const f of y)
|
|
2602
|
+
to(f, m);
|
|
2603
|
+
return m;
|
|
2548
2604
|
},
|
|
2549
2605
|
requestOptions: {
|
|
2550
|
-
signal: Y(
|
|
2551
|
-
timeout:
|
|
2606
|
+
signal: Y(n),
|
|
2607
|
+
timeout: n?.timeout
|
|
2552
2608
|
},
|
|
2553
|
-
config:
|
|
2609
|
+
config: n
|
|
2554
2610
|
});
|
|
2555
|
-
if (
|
|
2556
|
-
const
|
|
2557
|
-
throw new Error(`Failed to add records to the link chart. ${
|
|
2611
|
+
if (i.type !== "success") {
|
|
2612
|
+
const m = i.type === "generation-error" ? i.errorMessage : `${i.errorMessage} Cypher query: ${i.graphQuery}`;
|
|
2613
|
+
throw new Error(`Failed to add records to the link chart. ${m}`);
|
|
2558
2614
|
}
|
|
2559
|
-
const { graphQuery:
|
|
2615
|
+
const { graphQuery: c, explanation: u, processedResult: d } = i, p = Array.from(d.values());
|
|
2560
2616
|
return await x(
|
|
2561
2617
|
{
|
|
2562
|
-
text: `Query Results parsed into ${
|
|
2618
|
+
text: `Query Results parsed into ${p.length} unique relationships and entities. Atempting to add to link chart...`
|
|
2563
2619
|
},
|
|
2564
|
-
|
|
2565
|
-
), !
|
|
2566
|
-
(
|
|
2567
|
-
)?.addRecords(
|
|
2568
|
-
}
|
|
2569
|
-
const W = "addRecords",
|
|
2570
|
-
prompt:
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
}
|
|
2594
|
-
|
|
2620
|
+
n
|
|
2621
|
+
), !q(l) && l?.map ? (await l.map.addRecords(p), await Z(l), { generatedQuery: c, explanation: u, addedIdTypePairs: p }) : (await l?.map?.allLayers.find(
|
|
2622
|
+
(y) => y.type === "knowledge-graph"
|
|
2623
|
+
)?.addRecords(p), { generatedQuery: c, explanation: u, addedIdTypePairs: p });
|
|
2624
|
+
}
|
|
2625
|
+
const W = "addRecords", uo = s.object({
|
|
2626
|
+
prompt: s.string().describe(
|
|
2627
|
+
"The user's inquiry and context required in order to generate a cypher query that will be used to add records to the link chart."
|
|
2628
|
+
)
|
|
2629
|
+
}), po = async ({ prompt: e }, t) => {
|
|
2630
|
+
const { knowledgeGraph: r } = await M(t), a = O(t), { view: o } = a, l = k.getDefault().helperServices, {
|
|
2631
|
+
enhancedPrompt: i,
|
|
2632
|
+
bindParameters: c,
|
|
2633
|
+
allNamedTypesFullyDynamic: u
|
|
2634
|
+
} = await Ie({
|
|
2635
|
+
prompt: e,
|
|
2636
|
+
view: o,
|
|
2637
|
+
knowledgeGraph: r,
|
|
2638
|
+
includeReturnEntityAndRelationshipContext: !0
|
|
2639
|
+
});
|
|
2640
|
+
if (u)
|
|
2641
|
+
return {
|
|
2642
|
+
toolName: W,
|
|
2643
|
+
status: "success",
|
|
2644
|
+
summary: "No records have been added to the map because all data in the knowledge graph is contained in the map.",
|
|
2645
|
+
details: {
|
|
2646
|
+
generatedQuery: "N/A",
|
|
2647
|
+
explanation: "All named types in the knowledge graph are fully dynamic and therefore all data is already contained in the map. No records have been added.",
|
|
2648
|
+
addedIdTypePairs: []
|
|
2649
|
+
}
|
|
2650
|
+
};
|
|
2595
2651
|
try {
|
|
2596
|
-
const { generatedQuery:
|
|
2597
|
-
|
|
2652
|
+
const { generatedQuery: d, explanation: p, addedIdTypePairs: m } = await co(
|
|
2653
|
+
i,
|
|
2654
|
+
c,
|
|
2598
2655
|
r,
|
|
2599
2656
|
`${l.aiAssistantServices.url}${l.aiAssistantServices.graphQueryAssistant}`,
|
|
2600
2657
|
a,
|
|
@@ -2603,34 +2660,44 @@ ${m}${JSON.stringify(d)} and all entities or relationships with the the followin
|
|
|
2603
2660
|
return {
|
|
2604
2661
|
toolName: W,
|
|
2605
2662
|
status: "success",
|
|
2606
|
-
summary: `Records added successfully. Cypher Query used: ${
|
|
2663
|
+
summary: `Records added successfully. Cypher Query used: ${d}
|
|
2607
2664
|
|
|
2608
|
-
Number of records added: ${
|
|
2665
|
+
Number of records added: ${m.length}`,
|
|
2609
2666
|
details: {
|
|
2610
|
-
generatedQuery:
|
|
2611
|
-
explanation:
|
|
2612
|
-
addedIdTypePairs:
|
|
2667
|
+
generatedQuery: d,
|
|
2668
|
+
explanation: p,
|
|
2669
|
+
addedIdTypePairs: m
|
|
2613
2670
|
}
|
|
2614
2671
|
};
|
|
2615
|
-
} catch (
|
|
2616
|
-
const
|
|
2617
|
-
return
|
|
2672
|
+
} catch (d) {
|
|
2673
|
+
const p = P(d);
|
|
2674
|
+
return {
|
|
2618
2675
|
toolName: W,
|
|
2619
2676
|
status: "error",
|
|
2620
|
-
errorMessage: `Failed to add records to the link chart. ${
|
|
2621
|
-
error:
|
|
2677
|
+
errorMessage: `Failed to add records to the link chart. ${p}`,
|
|
2678
|
+
error: d
|
|
2622
2679
|
};
|
|
2623
2680
|
}
|
|
2624
|
-
},
|
|
2681
|
+
}, oi = g(po, {
|
|
2625
2682
|
name: W,
|
|
2626
|
-
description:
|
|
2627
|
-
|
|
2683
|
+
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. "add to new link chart" is not a valid prompt for this tool.
|
|
2684
|
+
|
|
2685
|
+
example prompts:
|
|
2686
|
+
- "add all suppliers and the parts they produce to the link chart"
|
|
2687
|
+
- "show me the competitors of company x and add them to the link chart"
|
|
2688
|
+
- "add the relationships between company x and company y to the link chart"
|
|
2689
|
+
- "expand all the companies"
|
|
2690
|
+
- "expand company x through all the buildings it owns"
|
|
2691
|
+
- "connect company x and company y"
|
|
2692
|
+
- "connect all buildings on the link chart"
|
|
2693
|
+
`,
|
|
2694
|
+
schema: uo
|
|
2628
2695
|
});
|
|
2629
|
-
async function
|
|
2630
|
-
return await t.map?.applyLayout(e), await
|
|
2696
|
+
async function mo(e, t) {
|
|
2697
|
+
return await t.map?.applyLayout(e), await Z(t), { appliedLayout: e };
|
|
2631
2698
|
}
|
|
2632
|
-
const
|
|
2633
|
-
layout:
|
|
2699
|
+
const re = "applyLayout", ho = s.object({
|
|
2700
|
+
layout: s.enum([
|
|
2634
2701
|
"organic-standard",
|
|
2635
2702
|
"organic-community",
|
|
2636
2703
|
"basic-grid",
|
|
@@ -2643,19 +2710,19 @@ const ae = "applyLayout", mo = i.object({
|
|
|
2643
2710
|
]).describe(
|
|
2644
2711
|
"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"
|
|
2645
2712
|
)
|
|
2646
|
-
}),
|
|
2647
|
-
const { view: r } =
|
|
2648
|
-
if (
|
|
2713
|
+
}), yo = async ({ layout: e }, t) => {
|
|
2714
|
+
const { view: r } = O(t);
|
|
2715
|
+
if (q(r))
|
|
2649
2716
|
return {
|
|
2650
|
-
toolName:
|
|
2717
|
+
toolName: re,
|
|
2651
2718
|
status: "error",
|
|
2652
2719
|
errorMessage: "The applyLayout tool can only be used with a LinkChartView.",
|
|
2653
2720
|
error: new Error()
|
|
2654
2721
|
};
|
|
2655
2722
|
{
|
|
2656
|
-
const { appliedLayout: a } = await
|
|
2723
|
+
const { appliedLayout: a } = await mo(e, r);
|
|
2657
2724
|
return {
|
|
2658
|
-
toolName:
|
|
2725
|
+
toolName: re,
|
|
2659
2726
|
status: "success",
|
|
2660
2727
|
summary: `Successfully applied layout: ${a}.`,
|
|
2661
2728
|
details: {
|
|
@@ -2663,29 +2730,29 @@ const ae = "applyLayout", mo = i.object({
|
|
|
2663
2730
|
}
|
|
2664
2731
|
};
|
|
2665
2732
|
}
|
|
2666
|
-
},
|
|
2667
|
-
name:
|
|
2733
|
+
}, ni = g(yo, {
|
|
2734
|
+
name: re,
|
|
2668
2735
|
description: "Apply a diagram layout to the link chart",
|
|
2669
|
-
schema:
|
|
2736
|
+
schema: ho
|
|
2670
2737
|
});
|
|
2671
|
-
async function
|
|
2672
|
-
return t.map?.changeNonspatialDataDisplay(e), await
|
|
2673
|
-
}
|
|
2674
|
-
const
|
|
2675
|
-
setting:
|
|
2676
|
-
}),
|
|
2677
|
-
const { view: r } =
|
|
2678
|
-
if (
|
|
2738
|
+
async function fo(e, t) {
|
|
2739
|
+
return t.map?.changeNonspatialDataDisplay(e), await Z(t), { appliedNonspatialDataDisplayMode: e };
|
|
2740
|
+
}
|
|
2741
|
+
const ae = "changeNonspatialVisibility", go = s.object({
|
|
2742
|
+
setting: s.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
|
|
2743
|
+
}), wo = async ({ setting: e }, t) => {
|
|
2744
|
+
const { view: r } = O(t);
|
|
2745
|
+
if (q(r))
|
|
2679
2746
|
return {
|
|
2680
|
-
toolName:
|
|
2747
|
+
toolName: ae,
|
|
2681
2748
|
status: "error",
|
|
2682
2749
|
errorMessage: "The changeNonspatialVisibility tool can only be used with a LinkChartView.",
|
|
2683
2750
|
error: new Error()
|
|
2684
2751
|
};
|
|
2685
2752
|
{
|
|
2686
|
-
const { appliedNonspatialDataDisplayMode: a } = await
|
|
2753
|
+
const { appliedNonspatialDataDisplayMode: a } = await fo(e, r);
|
|
2687
2754
|
return {
|
|
2688
|
-
toolName:
|
|
2755
|
+
toolName: ae,
|
|
2689
2756
|
status: "success",
|
|
2690
2757
|
summary: `Successfully applied nonspatial visibility setting: ${a}.`,
|
|
2691
2758
|
details: {
|
|
@@ -2693,15 +2760,15 @@ const oe = "changeNonspatialVisibility", fo = i.object({
|
|
|
2693
2760
|
}
|
|
2694
2761
|
};
|
|
2695
2762
|
}
|
|
2696
|
-
},
|
|
2697
|
-
name:
|
|
2763
|
+
}, ii = g(wo, {
|
|
2764
|
+
name: ae,
|
|
2698
2765
|
description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
|
|
2699
|
-
schema:
|
|
2766
|
+
schema: go
|
|
2700
2767
|
});
|
|
2701
|
-
async function
|
|
2768
|
+
async function bo(e, t, r, a, o) {
|
|
2702
2769
|
let n, l = "";
|
|
2703
|
-
for (let
|
|
2704
|
-
const { graphQuery: c, explanation: u } = await
|
|
2770
|
+
for (let i = 1; i <= D; i++) {
|
|
2771
|
+
const { graphQuery: c, explanation: u } = await de(
|
|
2705
2772
|
e,
|
|
2706
2773
|
t.dataModel,
|
|
2707
2774
|
r,
|
|
@@ -2710,9 +2777,9 @@ async function wo(e, t, r, a, o) {
|
|
|
2710
2777
|
);
|
|
2711
2778
|
try {
|
|
2712
2779
|
await x({ text: `Attempting to create link chart from derived query: ${c}` }, o);
|
|
2713
|
-
const d = await
|
|
2780
|
+
const d = await ht.fromCypherQuery(
|
|
2714
2781
|
t,
|
|
2715
|
-
new
|
|
2782
|
+
new ve({
|
|
2716
2783
|
openCypherQuery: c
|
|
2717
2784
|
})
|
|
2718
2785
|
);
|
|
@@ -2724,39 +2791,39 @@ async function wo(e, t, r, a, o) {
|
|
|
2724
2791
|
${c}
|
|
2725
2792
|
|
|
2726
2793
|
Explanation: ${u}`
|
|
2727
|
-
}) : (await
|
|
2794
|
+
}) : (await Z(a), {
|
|
2728
2795
|
type: "success",
|
|
2729
2796
|
graphQuery: c,
|
|
2730
2797
|
explanation: u
|
|
2731
2798
|
});
|
|
2732
2799
|
} catch (d) {
|
|
2733
|
-
const p =
|
|
2734
|
-
if (
|
|
2800
|
+
const p = P(d);
|
|
2801
|
+
if (i >= D) {
|
|
2735
2802
|
l = p;
|
|
2736
2803
|
break;
|
|
2737
2804
|
}
|
|
2738
2805
|
n = {
|
|
2739
2806
|
failedGraphQuery: c,
|
|
2740
2807
|
executionError: p,
|
|
2741
|
-
attemptCount:
|
|
2808
|
+
attemptCount: i
|
|
2742
2809
|
}, await x(
|
|
2743
|
-
{ text: `Attempt ${
|
|
2810
|
+
{ text: `Attempt ${i} to create link chart failed with error: ${p}. Retrying ...` },
|
|
2744
2811
|
o
|
|
2745
2812
|
);
|
|
2746
2813
|
}
|
|
2747
2814
|
}
|
|
2748
2815
|
return {
|
|
2749
2816
|
type: "error",
|
|
2750
|
-
errorMessage: `Failed to create link chart after ${
|
|
2817
|
+
errorMessage: `Failed to create link chart after ${D} attempts. Last error: ${l}`
|
|
2751
2818
|
};
|
|
2752
2819
|
}
|
|
2753
|
-
const V = "createLinkChart",
|
|
2754
|
-
prompt:
|
|
2755
|
-
"The user's inquiry
|
|
2820
|
+
const V = "createLinkChart", To = s.object({
|
|
2821
|
+
prompt: s.string().describe(
|
|
2822
|
+
"The user's inquiry and context required in order to generate a cypher query that will be used to create a link chart visualization. Only include information relevant to generating a cypher query. Do not suggest entity types, relationship types or properties. Do not include limits or formatting instructions for the query results unless specifically requested by the user. The prompt should be focused on the data the user wants to see in the link chart, not how to generate it."
|
|
2756
2823
|
)
|
|
2757
|
-
}),
|
|
2758
|
-
const { knowledgeGraph: r } = await
|
|
2759
|
-
if (
|
|
2824
|
+
}), So = async ({ prompt: e }, t) => {
|
|
2825
|
+
const { knowledgeGraph: r } = await M(t), { view: a } = O(t);
|
|
2826
|
+
if (q(a))
|
|
2760
2827
|
return {
|
|
2761
2828
|
toolName: V,
|
|
2762
2829
|
status: "error",
|
|
@@ -2764,8 +2831,10 @@ const V = "createLinkChart", bo = i.object({
|
|
|
2764
2831
|
error: new Error()
|
|
2765
2832
|
};
|
|
2766
2833
|
{
|
|
2767
|
-
const n =
|
|
2768
|
-
e
|
|
2834
|
+
const n = k.getDefault().helperServices, l = await bo(
|
|
2835
|
+
`${e}
|
|
2836
|
+
|
|
2837
|
+
${qe}`,
|
|
2769
2838
|
r,
|
|
2770
2839
|
`${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
|
|
2771
2840
|
a,
|
|
@@ -2778,107 +2847,116 @@ const V = "createLinkChart", bo = i.object({
|
|
|
2778
2847
|
errorMessage: l.errorMessage,
|
|
2779
2848
|
error: new Error()
|
|
2780
2849
|
};
|
|
2781
|
-
const { graphQuery:
|
|
2850
|
+
const { graphQuery: i, explanation: c } = l;
|
|
2782
2851
|
return {
|
|
2783
2852
|
toolName: V,
|
|
2784
2853
|
status: "success",
|
|
2785
2854
|
summary: `Link chart created successfully. Cypher Query used to create the link chart:
|
|
2786
|
-
${
|
|
2855
|
+
${i}
|
|
2787
2856
|
|
|
2788
2857
|
Explanation: ${c}`,
|
|
2789
2858
|
details: {
|
|
2790
|
-
generatedQuery:
|
|
2859
|
+
generatedQuery: i,
|
|
2791
2860
|
explanation: c
|
|
2792
2861
|
}
|
|
2793
2862
|
};
|
|
2794
2863
|
}
|
|
2795
|
-
},
|
|
2864
|
+
}, si = g(So, {
|
|
2796
2865
|
name: V,
|
|
2797
|
-
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.",
|
|
2798
|
-
schema:
|
|
2799
|
-
}),
|
|
2800
|
-
prompt:
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
REQUEST LIMIT: If the user does not specifically request for no limits or an explicit limit to be placed on the query, or the number of rows will not be limited by e.g. the number of entity or relationship types in the graph, ensure that the generated query has a reasonable row limit (e.g. 10 rows).
|
|
2804
|
-
|
|
2805
|
-
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.`
|
|
2866
|
+
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 using language like 'create new link chart' or 'add to new link chart'.",
|
|
2867
|
+
schema: To
|
|
2868
|
+
}), oe = "queryGraphData", vo = s.object({
|
|
2869
|
+
prompt: s.string().describe(
|
|
2870
|
+
"The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. Only include entity types, relationship types or properties if they are provided in the user prompt or prior steps. Do not suggest entity types, relationship types or properties. Do not include limits, information on what to return, instructions on how to write the query, or formatting instructions for the query results unless specifically requested by the user."
|
|
2806
2871
|
)
|
|
2807
|
-
}),
|
|
2808
|
-
const { knowledgeGraph: r } = await
|
|
2872
|
+
}), xo = async ({ prompt: e }, t) => {
|
|
2873
|
+
const { knowledgeGraph: r } = await M(t), o = k.getDefault().helperServices;
|
|
2874
|
+
let n = e, l = null, i = null;
|
|
2875
|
+
try {
|
|
2876
|
+
({ view: i } = O(t));
|
|
2877
|
+
} catch {
|
|
2878
|
+
}
|
|
2879
|
+
i && ({ enhancedPrompt: n, bindParameters: l } = await Ie({
|
|
2809
2880
|
prompt: e,
|
|
2881
|
+
view: i,
|
|
2882
|
+
knowledgeGraph: r,
|
|
2883
|
+
includeReturnEntityAndRelationshipContext: !1
|
|
2884
|
+
}));
|
|
2885
|
+
const c = await Ne({
|
|
2886
|
+
prompt: n,
|
|
2887
|
+
bindParameters: l,
|
|
2810
2888
|
kg: r,
|
|
2811
2889
|
graphQueryServiceUrl: `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
|
|
2812
2890
|
targetStructure: new Array(),
|
|
2813
|
-
targetStructureReducer: (
|
|
2891
|
+
targetStructureReducer: (w, b) => (w.push(b), w),
|
|
2814
2892
|
requestOptions: {
|
|
2815
2893
|
signal: Y(t),
|
|
2816
2894
|
timeout: t?.timeout
|
|
2817
2895
|
},
|
|
2818
2896
|
config: t
|
|
2819
2897
|
});
|
|
2820
|
-
if (
|
|
2821
|
-
const
|
|
2898
|
+
if (c.type !== "success") {
|
|
2899
|
+
const w = c.type === "generation-error" ? c.errorMessage : `${c.errorMessage} Cypher query: ${c.graphQuery}`;
|
|
2822
2900
|
return {
|
|
2823
|
-
toolName:
|
|
2901
|
+
toolName: oe,
|
|
2824
2902
|
status: "error",
|
|
2825
|
-
errorMessage: `Failed to query the knowledge graph. ${
|
|
2826
|
-
error: "error" in
|
|
2903
|
+
errorMessage: `Failed to query the knowledge graph. ${w}`,
|
|
2904
|
+
error: "error" in c ? c.error : null
|
|
2827
2905
|
};
|
|
2828
2906
|
}
|
|
2829
|
-
const { graphQuery:
|
|
2830
|
-
for (const
|
|
2831
|
-
for (const
|
|
2832
|
-
|
|
2833
|
-
|
|
2834
|
-
(
|
|
2907
|
+
const { graphQuery: u, explanation: d, processedResult: p, resultHeader: m } = c, y = m.headerKeys;
|
|
2908
|
+
for (const w of p)
|
|
2909
|
+
for (const b of w)
|
|
2910
|
+
z(
|
|
2911
|
+
b,
|
|
2912
|
+
(v) => ke(v)
|
|
2835
2913
|
);
|
|
2836
|
-
const
|
|
2914
|
+
const f = 50, h = p.slice(0, f).map((w) => JSON.stringify(w));
|
|
2837
2915
|
return {
|
|
2838
|
-
toolName:
|
|
2916
|
+
toolName: oe,
|
|
2839
2917
|
status: "success",
|
|
2840
2918
|
summary: `To answer the inquiry, the following cypher query was executed against the knowledge graph:
|
|
2841
2919
|
|
|
2842
2920
|
\`\`\`cypher
|
|
2843
|
-
${
|
|
2921
|
+
${u}
|
|
2844
2922
|
\`\`\`
|
|
2845
2923
|
|
|
2846
2924
|
Query Results:
|
|
2847
|
-
${
|
|
2925
|
+
${h.length} result(s) found.
|
|
2848
2926
|
|
|
2849
|
-
Column Headers: ${
|
|
2927
|
+
Column Headers: ${y.join(", ")}
|
|
2850
2928
|
|
|
2851
|
-
${
|
|
2929
|
+
${h.length > f ? `Showing top ${f} results:
|
|
2852
2930
|
|
|
2853
2931
|
` : `Results:
|
|
2854
2932
|
|
|
2855
|
-
`}${
|
|
2933
|
+
`}${h.join(`
|
|
2856
2934
|
`)}
|
|
2857
2935
|
`,
|
|
2858
2936
|
details: {
|
|
2859
|
-
generatedQuery:
|
|
2860
|
-
explanation:
|
|
2861
|
-
resultHeader:
|
|
2862
|
-
queryResults:
|
|
2937
|
+
generatedQuery: u,
|
|
2938
|
+
explanation: d,
|
|
2939
|
+
resultHeader: m,
|
|
2940
|
+
queryResults: p
|
|
2863
2941
|
}
|
|
2864
2942
|
};
|
|
2865
|
-
},
|
|
2866
|
-
name:
|
|
2943
|
+
}, li = g(xo, {
|
|
2944
|
+
name: oe,
|
|
2867
2945
|
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?'.",
|
|
2868
2946
|
schema: vo
|
|
2869
|
-
}),
|
|
2870
|
-
prompt:
|
|
2871
|
-
}),
|
|
2872
|
-
const { knowledgeGraph: r } = await
|
|
2947
|
+
}), ne = "generateCypher", Ro = s.object({
|
|
2948
|
+
prompt: s.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
|
|
2949
|
+
}), $o = async ({ prompt: e }, t) => {
|
|
2950
|
+
const { knowledgeGraph: r } = await M(t), o = k.getDefault().helperServices;
|
|
2873
2951
|
try {
|
|
2874
|
-
const { graphQuery: n, explanation: l } = await
|
|
2952
|
+
const { graphQuery: n, explanation: l } = await eo(
|
|
2875
2953
|
e,
|
|
2876
2954
|
r.dataModel,
|
|
2877
2955
|
`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
|
|
2878
2956
|
t
|
|
2879
2957
|
);
|
|
2880
2958
|
return {
|
|
2881
|
-
toolName:
|
|
2959
|
+
toolName: ne,
|
|
2882
2960
|
status: "success",
|
|
2883
2961
|
summary: `Generated Graph Query:
|
|
2884
2962
|
${n}
|
|
@@ -2890,69 +2968,70 @@ Explanation: ${l}`,
|
|
|
2890
2968
|
}
|
|
2891
2969
|
};
|
|
2892
2970
|
} catch (n) {
|
|
2893
|
-
const l =
|
|
2971
|
+
const l = P(n);
|
|
2894
2972
|
return {
|
|
2895
|
-
toolName:
|
|
2973
|
+
toolName: ne,
|
|
2896
2974
|
status: "error",
|
|
2897
2975
|
errorMessage: `Failed to generate Cypher query. ${l}`,
|
|
2898
2976
|
error: n
|
|
2899
2977
|
};
|
|
2900
2978
|
}
|
|
2901
|
-
},
|
|
2902
|
-
name:
|
|
2979
|
+
}, ci = g($o, {
|
|
2980
|
+
name: ne,
|
|
2903
2981
|
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.",
|
|
2904
|
-
schema:
|
|
2905
|
-
}),
|
|
2982
|
+
schema: Ro
|
|
2983
|
+
}), Co = (e) => {
|
|
2906
2984
|
const t = e.dataModel, r = /* @__PURE__ */ new Map();
|
|
2907
|
-
for (const
|
|
2908
|
-
if (
|
|
2909
|
-
for (const [c, u] of
|
|
2985
|
+
for (const i of t.searchIndexes)
|
|
2986
|
+
if (i.supportedCategory !== "esriTypeMetaEntityProvenance")
|
|
2987
|
+
for (const [c, u] of i.searchProperties.entries()) {
|
|
2910
2988
|
const d = r.get(c) ?? /* @__PURE__ */ new Set();
|
|
2911
2989
|
u.propertyNames.forEach((p) => d.add(p)), r.set(c, d);
|
|
2912
2990
|
}
|
|
2913
|
-
const a = t.entityTypes.filter((
|
|
2914
|
-
${a.map(({ name:
|
|
2991
|
+
const a = t.entityTypes.filter((i) => r.has(i.name)), o = t.relationshipTypes.filter((i) => r.has(i.name)), n = `Entity Types:
|
|
2992
|
+
${a.map(({ name: i }) => `${i}: [${Array.from(r.get(i) ?? []).join(", ")}]`).join(`
|
|
2915
2993
|
`)}`, l = `Relationship Types:
|
|
2916
|
-
${o.map(({ name:
|
|
2994
|
+
${o.map(({ name: i }) => `${i}: [${Array.from(r.get(i) ?? []).join(", ")}]`).join(`
|
|
2917
2995
|
`)}`;
|
|
2918
2996
|
return `${n}
|
|
2919
2997
|
|
|
2920
2998
|
${l}`;
|
|
2921
2999
|
};
|
|
2922
|
-
async function
|
|
2923
|
-
const
|
|
3000
|
+
async function Eo(e, t, r) {
|
|
3001
|
+
const a = await B("arcgis_knowledge_lucene_generation_prompt"), o = {
|
|
2924
3002
|
inquiry: e,
|
|
2925
|
-
dataModelForSearch:
|
|
2926
|
-
},
|
|
3003
|
+
dataModelForSearch: Co(t)
|
|
3004
|
+
}, n = s.enum(["entity", "relationship", "both"]).describe("The graph element category to search against - entity, relationship, or both"), l = s.number().int().positive().nullable().describe(
|
|
2927
3005
|
"The maximum number of search results to return. Default to 10 if not specified by the user, or set to null if the user specifically requests no limits or all results."
|
|
2928
|
-
),
|
|
2929
|
-
|
|
2930
|
-
t.dataModel.entityTypes.map((
|
|
3006
|
+
), i = s.array(
|
|
3007
|
+
s.enum(
|
|
3008
|
+
t.dataModel.entityTypes.map((d) => d.name).concat(t.dataModel.relationshipTypes.map((d) => d.name))
|
|
2931
3009
|
)
|
|
2932
|
-
).min(1),
|
|
2933
|
-
query:
|
|
2934
|
-
typeFilters:
|
|
3010
|
+
).min(1), c = s.object({
|
|
3011
|
+
query: s.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),
|
|
3012
|
+
typeFilters: i.nullable().describe(
|
|
2935
3013
|
"Nullable list of entity or relationship types from the graph to limit the search to. If set to null, search will execute against all named types with indexed properties in the graph"
|
|
2936
3014
|
),
|
|
2937
|
-
typeCategoryFilter:
|
|
2938
|
-
resultLimit:
|
|
3015
|
+
typeCategoryFilter: n,
|
|
3016
|
+
resultLimit: l
|
|
2939
3017
|
});
|
|
2940
|
-
return await
|
|
2941
|
-
promptText:
|
|
2942
|
-
inputVariables:
|
|
2943
|
-
schema:
|
|
3018
|
+
return await Pe({
|
|
3019
|
+
promptText: a,
|
|
3020
|
+
inputVariables: o,
|
|
3021
|
+
schema: c,
|
|
3022
|
+
config: r
|
|
2944
3023
|
});
|
|
2945
3024
|
}
|
|
2946
|
-
const
|
|
2947
|
-
prompt:
|
|
3025
|
+
const ie = "searchGraphData", Fo = s.object({
|
|
3026
|
+
prompt: s.string().describe(
|
|
2948
3027
|
"The user's inquiry into the knowledge graph, from which a lucene search query will be generated and executed against the graph to return relevant results."
|
|
2949
3028
|
)
|
|
2950
|
-
}),
|
|
2951
|
-
const { knowledgeGraph: r } = await
|
|
3029
|
+
}), ko = async ({ prompt: e }, t) => {
|
|
3030
|
+
const { knowledgeGraph: r } = await M(t);
|
|
2952
3031
|
await x({ text: "Generating search query for the user inquiry" }, t);
|
|
2953
|
-
const a = await
|
|
3032
|
+
const a = await Eo(e, r, t);
|
|
2954
3033
|
await x({ text: "Executing graph search with generated search query" }, t);
|
|
2955
|
-
const o = await
|
|
3034
|
+
const o = await lo({
|
|
2956
3035
|
kg: r,
|
|
2957
3036
|
searchQuery: a.query,
|
|
2958
3037
|
typeCategoryFilter: a.typeCategoryFilter,
|
|
@@ -2965,19 +3044,19 @@ const se = "searchGraphData", Eo = i.object({
|
|
|
2965
3044
|
});
|
|
2966
3045
|
if (o.type !== "success")
|
|
2967
3046
|
return {
|
|
2968
|
-
toolName:
|
|
3047
|
+
toolName: ie,
|
|
2969
3048
|
status: "error",
|
|
2970
3049
|
errorMessage: o.errorMessage,
|
|
2971
3050
|
error: "error" in o ? o.error : null
|
|
2972
3051
|
};
|
|
2973
|
-
for (const
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
(c) =>
|
|
3052
|
+
for (const i of o.results)
|
|
3053
|
+
z(
|
|
3054
|
+
i,
|
|
3055
|
+
(c) => ke(c)
|
|
2977
3056
|
);
|
|
2978
3057
|
const n = 10, l = o.results.slice(0, n);
|
|
2979
3058
|
return {
|
|
2980
|
-
toolName:
|
|
3059
|
+
toolName: ie,
|
|
2981
3060
|
status: "success",
|
|
2982
3061
|
summary: `To answer the query, the following lucene query was generated and executed:
|
|
2983
3062
|
Query: ${a.query}
|
|
@@ -2989,63 +3068,72 @@ const se = "searchGraphData", Eo = i.object({
|
|
|
2989
3068
|
|
|
2990
3069
|
${o.results.length > n ? `Showing top ${n} results:
|
|
2991
3070
|
|
|
2992
|
-
` : ""}${l.map((
|
|
3071
|
+
` : ""}${l.map((i) => JSON.stringify(i)).join(`
|
|
2993
3072
|
`)}`,
|
|
2994
3073
|
details: {
|
|
2995
3074
|
generatedSearchQuery: a,
|
|
2996
3075
|
searchResults: o.results
|
|
2997
3076
|
}
|
|
2998
3077
|
};
|
|
2999
|
-
},
|
|
3000
|
-
name:
|
|
3001
|
-
description:
|
|
3002
|
-
|
|
3078
|
+
}, ui = g(ko, {
|
|
3079
|
+
name: ie,
|
|
3080
|
+
description: `
|
|
3081
|
+
Search the knowledge graph using one or more search texts, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.
|
|
3082
|
+
Example prompts:
|
|
3083
|
+
- "Find 'Bradley'"
|
|
3084
|
+
- "find the person john smith"
|
|
3085
|
+
- "find all people named smith"
|
|
3086
|
+
- "Find all references to 'delayed parts shipment'"
|
|
3087
|
+
- "Find all reports authored by someone with the title of 'Researcher'"
|
|
3088
|
+
- "Find the first 5 reports where summary mentions flood zoning near Sacramento, and the organization name is the City of Sacramento Utilities, and tags containing stormwater".
|
|
3089
|
+
- "Search for all john smiths and show their global ids`,
|
|
3090
|
+
schema: Fo
|
|
3003
3091
|
});
|
|
3004
3092
|
export {
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3093
|
+
Gn as A,
|
|
3094
|
+
On as B,
|
|
3095
|
+
Mn as C,
|
|
3096
|
+
Qn as D,
|
|
3097
|
+
_n as E,
|
|
3098
|
+
Wn as F,
|
|
3099
|
+
ue as G,
|
|
3100
|
+
ei as H,
|
|
3101
|
+
Vn as I,
|
|
3102
|
+
Bn as J,
|
|
3015
3103
|
Un as K,
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
|
|
3032
|
-
|
|
3033
|
-
|
|
3034
|
-
|
|
3035
|
-
|
|
3036
|
-
|
|
3037
|
-
|
|
3104
|
+
Kn as L,
|
|
3105
|
+
Hn as M,
|
|
3106
|
+
En as N,
|
|
3107
|
+
Zn as O,
|
|
3108
|
+
Yn as P,
|
|
3109
|
+
Wa as Q,
|
|
3110
|
+
N as R,
|
|
3111
|
+
Jn as S,
|
|
3112
|
+
Xn as T,
|
|
3113
|
+
ni as a,
|
|
3114
|
+
ci as b,
|
|
3115
|
+
ii as c,
|
|
3116
|
+
si as d,
|
|
3117
|
+
oi as e,
|
|
3118
|
+
xe as f,
|
|
3119
|
+
B as g,
|
|
3120
|
+
ai as h,
|
|
3121
|
+
M as i,
|
|
3122
|
+
ri as j,
|
|
3123
|
+
Fn as k,
|
|
3124
|
+
ti as l,
|
|
3125
|
+
kn as m,
|
|
3038
3126
|
Nn as n,
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3127
|
+
qn as o,
|
|
3128
|
+
In as p,
|
|
3129
|
+
li as q,
|
|
3130
|
+
Ln as r,
|
|
3131
|
+
ui as s,
|
|
3132
|
+
Bt as t,
|
|
3133
|
+
zn as u,
|
|
3134
|
+
Dn as v,
|
|
3135
|
+
Pn as w,
|
|
3048
3136
|
An as x,
|
|
3049
3137
|
C as y,
|
|
3050
|
-
|
|
3138
|
+
jn as z
|
|
3051
3139
|
};
|