@arcgis/ai-components 5.2.0-next.71 → 5.2.0-next.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +4 -2
- package/dist/agent-utils/types.d.ts +1 -1
- package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
- package/dist/agentic-workflow/Edge.d.ts +16 -0
- package/dist/agentic-workflow/WebAgent.d.ts +39 -0
- package/dist/agentic-workflow/jsonTypes.d.ts +186 -0
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +26 -0
- package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
- package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
- package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
- package/dist/agentic-workflow/nodes/support/Prompt.d.ts +20 -0
- package/dist/agentic-workflow/types.d.ts +29 -0
- package/dist/cdn/{PUFTYLJ2.js → 33BF35AO.js} +1 -1
- package/dist/cdn/55M2HE4U.js +2 -0
- package/dist/cdn/5RZGG4F2.js +2 -0
- package/dist/cdn/5SF6DEMO.js +2 -0
- package/dist/cdn/{MW5S2XCB.js → 5SFZS2RD.js} +1 -1
- package/dist/cdn/6QJFOL6M.js +2 -0
- package/dist/cdn/BAB3MK4Y.js +2 -0
- package/dist/cdn/BMBV6Y2A.js +2 -0
- package/dist/cdn/D3RKQSWS.js +2 -0
- package/dist/cdn/DBHLKLKM.js +2 -0
- package/dist/cdn/{CXW5URTF.js → DWYODVWW.js} +1 -1
- package/dist/cdn/{TFT6HK3O.js → E7KEOJZG.js} +1 -1
- package/dist/cdn/FSMHR7GK.js +2 -0
- package/dist/cdn/HO2YDJI2.js +6 -0
- package/dist/cdn/{KQHLOYKL.js → I4L45WQS.js} +1 -1
- package/dist/cdn/IGQFAL3H.js +2 -0
- package/dist/cdn/JYVBCHR6.js +6 -0
- package/dist/cdn/{XETNZW4D.js → NJJYZP3R.js} +1 -1
- package/dist/cdn/NSXX2KYS.js +2 -0
- package/dist/cdn/OFRFP4BX.js +2 -0
- package/dist/cdn/OUFGJV3R.js +2 -0
- package/dist/cdn/PAUIFUMO.js +2 -0
- package/dist/cdn/RWM5T4XB.js +180 -0
- package/dist/cdn/{YHQJ66WJ.js → S3XUYAUX.js} +1 -1
- package/dist/cdn/S6ZAQRC6.js +2 -0
- package/dist/cdn/SRFLL6ET.js +2 -0
- package/dist/cdn/UZL6UVE4.js +2 -0
- package/dist/cdn/{GP6NDTUE.js → WDOM6Z5O.js} +2 -2
- package/dist/cdn/WQKNV6KK.js +2 -0
- package/dist/cdn/{ICYUPLZM.js → WZFC5HUX.js} +1 -1
- package/dist/cdn/XPTCV6YV.js +2 -0
- package/dist/cdn/Y5UFOH54.js +2 -0
- package/dist/cdn/{E5ZKBC24.js → Z4XUJQ2I.js} +2 -2
- package/dist/cdn/{SXHH575T.js → ZJEWP2ND.js} +20 -24
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
- package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
- package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +668 -679
- package/dist/chunks/baseAgentState.js +56 -0
- package/dist/chunks/dataExplorationGraph.js +13 -13
- package/dist/chunks/generateLayerDescriptions.js +189 -235
- package/dist/chunks/navigationGraph.js +28 -28
- package/dist/chunks/orchestrator.js +1 -1
- package/dist/chunks/state.js +20 -26
- package/dist/chunks/utils2.js +3 -3
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +513 -12
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -1
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +1 -1
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/dist/utils/index.js +26 -25
- package/package.json +4 -4
- package/dist/cdn/3DJDRAGV.js +0 -2
- package/dist/cdn/4CEMUECT.js +0 -2
- package/dist/cdn/4PCAK3ET.js +0 -2
- package/dist/cdn/57OMVTIU.js +0 -2
- package/dist/cdn/6U7TEAAJ.js +0 -2
- package/dist/cdn/BE7ZN5FZ.js +0 -2
- package/dist/cdn/BNSJO6X2.js +0 -2
- package/dist/cdn/CMDRED5H.js +0 -2
- package/dist/cdn/DTIVDIDY.js +0 -2
- package/dist/cdn/HBLRVXEB.js +0 -2
- package/dist/cdn/HQXPPYMD.js +0 -2
- package/dist/cdn/IEHPNCTL.js +0 -2
- package/dist/cdn/LHLO6PTD.js +0 -2
- package/dist/cdn/OWXCOUIQ.js +0 -2
- package/dist/cdn/PVE7Q43N.js +0 -2
- package/dist/cdn/ST5FQYT7.js +0 -180
- package/dist/cdn/WUNCZOGU.js +0 -2
- package/dist/cdn/WVPU4QOO.js +0 -2
- package/dist/cdn/WXWO5D3W.js +0 -2
- package/dist/cdn/XCRR2EEG.js +0 -6
- package/dist/cdn/ZS6SXJP2.js +0 -2
package/dist/chunks/adapter.js
CHANGED
|
@@ -1,92 +1,93 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { Annotation as T, messagesStateReducer as
|
|
2
|
+
import de from "@arcgis/core/identity/IdentityManager.js";
|
|
3
|
+
import k from "@arcgis/core/portal/Portal.js";
|
|
4
|
+
import pe from "@arcgis/core/request.js";
|
|
5
|
+
import { Annotation as T, messagesStateReducer as we } from "@langchain/langgraph/web";
|
|
6
6
|
import "@arcgis/toolkit/string";
|
|
7
|
-
import {
|
|
7
|
+
import { i as De } from "./generateLayerDescriptions.js";
|
|
8
8
|
import "@langchain/core/messages";
|
|
9
9
|
import "@langchain/core/callbacks/dispatch/web";
|
|
10
10
|
import "@langchain/openai";
|
|
11
|
-
import
|
|
12
|
-
import * as
|
|
11
|
+
import Z from "@arcgis/core/config.js";
|
|
12
|
+
import * as Pe from "@arcgis/core/core/reactiveUtils.js";
|
|
13
13
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
14
14
|
import "@langchain/core/prompts";
|
|
15
|
+
import { b as Ae, a as K } from "./baseAgentState.js";
|
|
15
16
|
import { tool as f } from "@langchain/core/tools";
|
|
16
|
-
import
|
|
17
|
-
import { addressToLocations as
|
|
18
|
-
import
|
|
17
|
+
import Le from "@arcgis/core/Graphic.js";
|
|
18
|
+
import { addressToLocations as je } from "@arcgis/core/rest/locator.js";
|
|
19
|
+
import Ge from "@arcgis/core/symbols/PictureMarkerSymbol.js";
|
|
19
20
|
import s, { z as E } from "zod";
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import { createRenderer as
|
|
23
|
-
import { getSchemesByTag as
|
|
24
|
-
import { getBackgroundColorTheme as
|
|
25
|
-
import { a as
|
|
26
|
-
import { createAgeRenderer as
|
|
27
|
-
import { getSchemesByTag as
|
|
28
|
-
import { createContinuousRenderer as
|
|
29
|
-
import { createRenderer as
|
|
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
|
|
42
|
-
import
|
|
43
|
-
import * as
|
|
44
|
-
import { formatDateOnly as
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
import
|
|
48
|
-
import
|
|
49
|
-
import
|
|
50
|
-
import
|
|
21
|
+
import Oe from "@arcgis/core/geometry/Extent.js";
|
|
22
|
+
import be from "@arcgis/core/geometry/Point.js";
|
|
23
|
+
import { createRenderer as Me } from "@arcgis/core/smartMapping/renderers/pieChart.js";
|
|
24
|
+
import { getSchemesByTag as Qe, getSchemes as Ve } from "@arcgis/core/smartMapping/symbology/pieChart.js";
|
|
25
|
+
import { getBackgroundColorTheme as me } from "@arcgis/core/views/support/colorUtils.js";
|
|
26
|
+
import { a as $, s as R } from "./index.js";
|
|
27
|
+
import { createAgeRenderer as _e, createContinuousRenderer as We } from "@arcgis/core/smartMapping/renderers/color.js";
|
|
28
|
+
import { getSchemesByTag as ie } from "@arcgis/core/smartMapping/symbology/color.js";
|
|
29
|
+
import { createContinuousRenderer as Be } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
|
|
30
|
+
import { createRenderer as Ue } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
|
|
31
|
+
import { getSchemesByTag as Ke } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
|
|
32
|
+
import { createRenderer as He } from "@arcgis/core/smartMapping/renderers/heatmap.js";
|
|
33
|
+
import { getSchemesByTag as Je } from "@arcgis/core/smartMapping/symbology/heatmap.js";
|
|
34
|
+
import { createRenderer as Ye } from "@arcgis/core/smartMapping/renderers/predominance.js";
|
|
35
|
+
import { getSchemesByTag as Ze } from "@arcgis/core/smartMapping/symbology/predominance.js";
|
|
36
|
+
import { createRenderer as Xe } from "@arcgis/core/smartMapping/renderers/relationship.js";
|
|
37
|
+
import { getSchemesByTag as et } from "@arcgis/core/smartMapping/symbology/relationship.js";
|
|
38
|
+
import { createAgeRenderer as tt, createContinuousRenderer as rt } from "@arcgis/core/smartMapping/renderers/size.js";
|
|
39
|
+
import { createRenderer as at } from "@arcgis/core/smartMapping/renderers/type.js";
|
|
40
|
+
import { getSchemesByTag as ot } from "@arcgis/core/smartMapping/symbology/type.js";
|
|
41
|
+
import { ToolNode as nt } from "@langchain/langgraph/prebuilt";
|
|
42
|
+
import it from "@arcgis/core/layers/support/FeatureEffect.js";
|
|
43
|
+
import Te from "@arcgis/core/layers/support/FeatureFilter.js";
|
|
44
|
+
import * as st from "@arcgis/core/geometry/operators/unionOperator.js";
|
|
45
|
+
import { formatDateOnly as lt, convertDateFormatToIntlOptions as Q, formatTimeOnly as ct, formatDate as he } from "@arcgis/core/intl.js";
|
|
46
|
+
import ut from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
|
|
47
|
+
import dt from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
|
|
48
|
+
import pt from "@arcgis/core/rest/support/TopFeaturesQuery.js";
|
|
49
|
+
import mt from "@arcgis/core/rest/support/TopFilter.js";
|
|
50
|
+
import ht from "@arcgis/core/WebLinkChart.js";
|
|
51
|
+
import Se from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
|
|
51
52
|
import "@arcgis/core/views/LinkChartView.js";
|
|
52
|
-
import { fetchKnowledgeGraph as
|
|
53
|
-
import
|
|
54
|
-
import { getBindParametersFromCypherQuery as
|
|
55
|
-
const
|
|
56
|
-
...
|
|
53
|
+
import { fetchKnowledgeGraph as ye, executeQueryStreaming as yt, executeSearchStreaming as ft } from "@arcgis/core/rest/knowledgeGraphService.js";
|
|
54
|
+
import gt from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
|
|
55
|
+
import { getBindParametersFromCypherQuery as wt } from "@arcgis/core/applications/KnowledgeStudio/generalSharedKgUtils.js";
|
|
56
|
+
const A = (e, t) => t ?? e, Nn = T.Root({
|
|
57
|
+
...Ae(),
|
|
57
58
|
// internal to the navigation agent
|
|
58
59
|
intent: T({
|
|
59
|
-
reducer:
|
|
60
|
+
reducer: A
|
|
60
61
|
}),
|
|
61
62
|
vectorSearchLayerResults: T({
|
|
62
|
-
reducer:
|
|
63
|
+
reducer: A,
|
|
63
64
|
default: () => []
|
|
64
65
|
}),
|
|
65
66
|
vectorSearchFieldResults: T({
|
|
66
|
-
reducer:
|
|
67
|
+
reducer: A
|
|
67
68
|
}),
|
|
68
69
|
navigationInternalState: T({
|
|
69
|
-
reducer:
|
|
70
|
+
reducer: A,
|
|
70
71
|
default: () => ({
|
|
71
72
|
toolCallMessage: void 0
|
|
72
73
|
})
|
|
73
74
|
})
|
|
74
75
|
});
|
|
75
|
-
async function
|
|
76
|
-
const a =
|
|
76
|
+
async function bt(e, t) {
|
|
77
|
+
const a = k.getDefault().helperServices, o = a.geocode.find((m) => m.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
|
|
77
78
|
if (!o)
|
|
78
79
|
throw new Error("No geocoding service found in helperServices.");
|
|
79
|
-
const n = o.url, l = `${
|
|
80
|
+
const n = o.url, l = `${Z.assetsPath?.endsWith("/") ? Z.assetsPath : `${Z.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await je(n, {
|
|
80
81
|
address: { SingleLine: e },
|
|
81
82
|
outFields: ["Match_addr"]
|
|
82
83
|
}))?.[0];
|
|
83
84
|
if (!c?.extent || !c.location)
|
|
84
85
|
throw new Error(`Could not find location for: ${e}`);
|
|
85
|
-
const u = new
|
|
86
|
+
const u = new Ge({
|
|
86
87
|
url: l,
|
|
87
88
|
width: 24,
|
|
88
89
|
height: 24
|
|
89
|
-
}), d = new
|
|
90
|
+
}), d = new Le({
|
|
90
91
|
geometry: c.location,
|
|
91
92
|
symbol: u
|
|
92
93
|
});
|
|
@@ -101,28 +102,27 @@ async function Tt(e, t) {
|
|
|
101
102
|
sharedStatePatch: { lastResolvedLocation: { value: p } }
|
|
102
103
|
};
|
|
103
104
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
return r;
|
|
105
|
+
function v(e, t) {
|
|
106
|
+
const a = e?.configurable?.context;
|
|
107
|
+
if (!a || typeof a != "object")
|
|
108
|
+
throw new Error("Agent context missing");
|
|
109
|
+
const o = t.filter((n) => !(n in a));
|
|
110
|
+
if (o.length)
|
|
111
|
+
throw new Error(`Agent context missing: ${o.join(", ")}`);
|
|
112
|
+
return a;
|
|
113
113
|
}
|
|
114
|
-
async function
|
|
115
|
-
const { mapView: r } =
|
|
116
|
-
return await
|
|
114
|
+
async function Tt({ address: e }, t) {
|
|
115
|
+
const { mapView: r } = v(t, ["mapView"]);
|
|
116
|
+
return await bt(e, r);
|
|
117
117
|
}
|
|
118
|
-
const
|
|
118
|
+
const St = s.object({
|
|
119
119
|
address: s.string().describe("The full address or place name to locate.")
|
|
120
|
-
}),
|
|
120
|
+
}), In = f(Tt, {
|
|
121
121
|
name: "goToAddress",
|
|
122
122
|
description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
|
|
123
|
-
schema:
|
|
123
|
+
schema: St
|
|
124
124
|
});
|
|
125
|
-
async function
|
|
125
|
+
async function vt(e, t) {
|
|
126
126
|
const a = t.map.bookmarks;
|
|
127
127
|
if (!a || a.length === 0)
|
|
128
128
|
throw new Error("No bookmarks found in the map.");
|
|
@@ -134,18 +134,18 @@ async function Rt(e, t) {
|
|
|
134
134
|
throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
|
|
135
135
|
return await t.goTo(n), { text: `Navigated to bookmark: ${e}` };
|
|
136
136
|
}
|
|
137
|
-
async function
|
|
138
|
-
const { mapView: r } =
|
|
139
|
-
return await Promise.resolve(
|
|
137
|
+
async function xt({ bookmarkName: e }, t) {
|
|
138
|
+
const { mapView: r } = v(t, ["mapView"]);
|
|
139
|
+
return await Promise.resolve(vt(e, r));
|
|
140
140
|
}
|
|
141
|
-
const
|
|
141
|
+
const Rt = E.object({
|
|
142
142
|
bookmarkName: E.string().describe("The name of the bookmark to navigate to.")
|
|
143
|
-
}),
|
|
143
|
+
}), qn = f(xt, {
|
|
144
144
|
name: "goToBookmark",
|
|
145
145
|
description: "Go to the extent of the bookmark with the given name.",
|
|
146
|
-
schema:
|
|
146
|
+
schema: Rt
|
|
147
147
|
});
|
|
148
|
-
async function
|
|
148
|
+
async function $t(e, t, r) {
|
|
149
149
|
const a = r.map?.allLayers.find((l) => l.id === e);
|
|
150
150
|
if (!a)
|
|
151
151
|
return { text: `Error: Layer with id ${e} not found` };
|
|
@@ -174,22 +174,22 @@ async function Et(e, t, r) {
|
|
|
174
174
|
return console.error("Error in goToFeatures:", l), { text: `Error: ${l instanceof Error ? l.message : "Unknown error"}`, where: o };
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
async function
|
|
178
|
-
const { mapView: a } =
|
|
179
|
-
return await
|
|
177
|
+
async function Ct({ layerId: e, where: t }, r) {
|
|
178
|
+
const { mapView: a } = v(r, ["mapView"]);
|
|
179
|
+
return await $t(e, t, a);
|
|
180
180
|
}
|
|
181
|
-
const
|
|
181
|
+
const Et = E.object({
|
|
182
182
|
layerId: E.string().describe("The layerId of the layer to zoom to."),
|
|
183
183
|
where: E.string().describe(
|
|
184
184
|
"ArcGIS SQL-92 WHERE expression used for `query.where` on the selected layer. Start with a fresh filter for the current request unless the task explicitly refers to prior results. Use only field name values from the selected layer, not aliases. Use field metadata only to interpret intent: prefer LIKE '%value%' for string fields, and use =, <, >, BETWEEN, IN, IS NULL, AND/OR/NOT as appropriate for number/date fields. For coded-value domain fields, use the domain code already provided in layerInfo.domain.codedValues, never the display label. Respect range-domain bounds when they are provided. Do NOT include subqueries, nested SELECT, JOIN, GROUP BY, HAVING, ORDER BY, or semicolons."
|
|
185
185
|
)
|
|
186
|
-
}),
|
|
186
|
+
}), zn = f(Ct, {
|
|
187
187
|
name: "goToFeatures",
|
|
188
188
|
description: "Go to the features that match the given filter for the given layerId. Use coded-value domain codes from layer field metadata when building the WHERE clause.",
|
|
189
|
-
schema:
|
|
189
|
+
schema: Et
|
|
190
190
|
});
|
|
191
|
-
async function
|
|
192
|
-
const r = new
|
|
191
|
+
async function Ft(e) {
|
|
192
|
+
const r = new Oe({
|
|
193
193
|
xmin: -180,
|
|
194
194
|
ymin: -90,
|
|
195
195
|
xmax: 180,
|
|
@@ -198,16 +198,16 @@ async function kt(e) {
|
|
|
198
198
|
}).expand(0.7);
|
|
199
199
|
return await e.goTo(r), { text: "Successfully zoomed to world extent" };
|
|
200
200
|
}
|
|
201
|
-
async function
|
|
202
|
-
const { mapView: r } =
|
|
203
|
-
return await
|
|
201
|
+
async function kt(e, t) {
|
|
202
|
+
const { mapView: r } = v(t, ["mapView"]);
|
|
203
|
+
return await Ft(r);
|
|
204
204
|
}
|
|
205
|
-
const
|
|
205
|
+
const Nt = E.object({}), Dn = f(kt, {
|
|
206
206
|
name: "goToFullExtent",
|
|
207
207
|
description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
|
|
208
|
-
schema:
|
|
208
|
+
schema: Nt
|
|
209
209
|
});
|
|
210
|
-
async function
|
|
210
|
+
async function It(e) {
|
|
211
211
|
const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
|
|
212
212
|
if (r)
|
|
213
213
|
await e.goTo(r);
|
|
@@ -215,16 +215,16 @@ async function Dt(e) {
|
|
|
215
215
|
throw new Error("Initial extent is undefined");
|
|
216
216
|
return { text: "Successfully zoomed to home extent" };
|
|
217
217
|
}
|
|
218
|
-
async function
|
|
219
|
-
const { mapView: r } =
|
|
220
|
-
return await
|
|
218
|
+
async function qt(e, t) {
|
|
219
|
+
const { mapView: r } = v(t, ["mapView"]);
|
|
220
|
+
return await It(r);
|
|
221
221
|
}
|
|
222
|
-
const
|
|
222
|
+
const zt = s.object({}), Pn = f(qt, {
|
|
223
223
|
name: "goToHomeExtent",
|
|
224
224
|
description: "Go to the initial web map view extent",
|
|
225
|
-
schema:
|
|
225
|
+
schema: zt
|
|
226
226
|
});
|
|
227
|
-
async function
|
|
227
|
+
async function Dt(e, t) {
|
|
228
228
|
await t.when();
|
|
229
229
|
const r = t.map?.allLayers.find((o) => o.id === e);
|
|
230
230
|
if (!r)
|
|
@@ -232,34 +232,34 @@ async function At(e, t) {
|
|
|
232
232
|
let a;
|
|
233
233
|
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." };
|
|
234
234
|
}
|
|
235
|
-
async function
|
|
236
|
-
const { mapView: r } =
|
|
237
|
-
return await
|
|
235
|
+
async function Pt({ layerId: e }, t) {
|
|
236
|
+
const { mapView: r } = v(t, ["mapView"]);
|
|
237
|
+
return await Dt(e, r);
|
|
238
238
|
}
|
|
239
|
-
const
|
|
239
|
+
const At = E.object({
|
|
240
240
|
layerId: E.string().describe("The id of the layer to navigate to")
|
|
241
|
-
}),
|
|
241
|
+
}), An = f(Pt, {
|
|
242
242
|
name: "goToLayer",
|
|
243
243
|
description: "Zooms the map view to the full extent of the top matching layer.",
|
|
244
|
-
schema:
|
|
244
|
+
schema: At
|
|
245
245
|
});
|
|
246
|
-
async function
|
|
246
|
+
async function Lt(e, t) {
|
|
247
247
|
return await t.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
|
|
248
248
|
}
|
|
249
|
-
async function
|
|
250
|
-
const { mapView: r } =
|
|
251
|
-
return await
|
|
249
|
+
async function jt({ scale: e }, t) {
|
|
250
|
+
const { mapView: r } = v(t, ["mapView"]);
|
|
251
|
+
return await Lt(e, r);
|
|
252
252
|
}
|
|
253
|
-
const
|
|
253
|
+
const Gt = s.object({
|
|
254
254
|
scale: s.number().describe("The map scale of the view to go to.")
|
|
255
|
-
}),
|
|
255
|
+
}), Ln = f(jt, {
|
|
256
256
|
name: "goToScale",
|
|
257
257
|
description: "Go to the specified view scale.",
|
|
258
|
-
schema:
|
|
258
|
+
schema: Gt
|
|
259
259
|
});
|
|
260
|
-
async function
|
|
260
|
+
async function Ot(e, t, r) {
|
|
261
261
|
const o = {
|
|
262
|
-
target: new
|
|
262
|
+
target: new be({
|
|
263
263
|
longitude: e.longitude,
|
|
264
264
|
latitude: e.latitude,
|
|
265
265
|
spatialReference: { wkid: 4326 }
|
|
@@ -271,40 +271,40 @@ async function Qt(e, t, r) {
|
|
|
271
271
|
r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
|
|
272
272
|
].filter(Boolean).join(", ")}` };
|
|
273
273
|
}
|
|
274
|
-
async function
|
|
274
|
+
async function Mt({
|
|
275
275
|
center: e,
|
|
276
276
|
zoom: t,
|
|
277
277
|
scale: r
|
|
278
278
|
}, a) {
|
|
279
|
-
const { mapView: o } =
|
|
280
|
-
return await
|
|
279
|
+
const { mapView: o } = v(a, ["mapView"]);
|
|
280
|
+
return await Ot(e, o, { zoom: t, scale: r });
|
|
281
281
|
}
|
|
282
|
-
const
|
|
282
|
+
const Qt = s.object({
|
|
283
283
|
center: s.object({
|
|
284
284
|
longitude: s.number().describe("The longitude (x-coordinate) of the point to navigate to."),
|
|
285
285
|
latitude: s.number().describe("The latitude (y-coordinate) of the point to navigate to.")
|
|
286
286
|
}),
|
|
287
287
|
zoom: s.number().optional().describe("The zoom level. Higher values = more zoomed in."),
|
|
288
288
|
scale: s.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
|
|
289
|
-
}),
|
|
289
|
+
}), jn = f(Mt, {
|
|
290
290
|
name: "goToViewpoint",
|
|
291
291
|
description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
|
|
292
|
-
schema:
|
|
292
|
+
schema: Qt
|
|
293
293
|
});
|
|
294
294
|
async function Vt(e, t) {
|
|
295
295
|
return await t.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
|
|
296
296
|
}
|
|
297
|
-
async function
|
|
298
|
-
const { mapView: r } =
|
|
297
|
+
async function _t({ zoom: e }, t) {
|
|
298
|
+
const { mapView: r } = v(t, ["mapView"]);
|
|
299
299
|
return await Vt(e, r);
|
|
300
300
|
}
|
|
301
|
-
const
|
|
301
|
+
const Wt = s.object({
|
|
302
302
|
zoom: s.number().min(1).max(20).describe("The zoom level of the view to go to.")
|
|
303
|
-
}),
|
|
303
|
+
}), Gn = f(_t, {
|
|
304
304
|
name: "goToZoom",
|
|
305
305
|
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.).',
|
|
306
|
-
schema:
|
|
307
|
-
}),
|
|
306
|
+
schema: Wt
|
|
307
|
+
}), fe = /* @__PURE__ */ Object.assign({
|
|
308
308
|
"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md": () => import("./arcgis_knowledge_current_lc_context.js").then((e) => e.default),
|
|
309
309
|
"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md": () => import("./arcgis_knowledge_current_map_context.js").then((e) => e.default),
|
|
310
310
|
"../agents/arcgisKnowledge/prompts/arcgis_knowledge_cypher_query_prompt.md": () => import("./arcgis_knowledge_cypher_query_prompt.js").then((e) => e.default),
|
|
@@ -319,40 +319,40 @@ const Ut = s.object({
|
|
|
319
319
|
"../agents/navigation/prompts/navigation_intent_prompt.md": () => import("./navigation_intent_prompt.js").then((e) => e.default),
|
|
320
320
|
"../agents/navigation/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt.js").then((e) => e.default)
|
|
321
321
|
});
|
|
322
|
-
async function
|
|
323
|
-
const t = Object.entries(
|
|
322
|
+
async function W(e) {
|
|
323
|
+
const t = Object.entries(fe).find(([r]) => r.endsWith(`/${e}.md`));
|
|
324
324
|
if (!t)
|
|
325
325
|
throw new Error(`Prompt not found: ${e}
|
|
326
326
|
Available prompts:
|
|
327
|
-
${Object.keys(
|
|
327
|
+
${Object.keys(fe).join(`
|
|
328
328
|
`)}`);
|
|
329
329
|
return await t[1]();
|
|
330
330
|
}
|
|
331
|
-
const
|
|
331
|
+
const Bt = (e, t = 300) => {
|
|
332
332
|
const r = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
|
|
333
333
|
return r.length > t ? `${r.slice(0, t)}...` : r;
|
|
334
|
-
},
|
|
334
|
+
}, ve = (e, t) => {
|
|
335
335
|
const a = e?.configurable?.services?.[t];
|
|
336
336
|
if (a == null)
|
|
337
337
|
throw new Error(`${t} missing in config.configurable.services`);
|
|
338
338
|
return a;
|
|
339
|
-
},
|
|
339
|
+
}, On = (e, t) => (r, a) => {
|
|
340
340
|
const o = a?.configurable?.services;
|
|
341
341
|
for (const n of e)
|
|
342
342
|
if (!o?.[n])
|
|
343
343
|
throw new Error(`${t} requires services.${n} to be available.`);
|
|
344
344
|
return r;
|
|
345
345
|
};
|
|
346
|
-
async function
|
|
346
|
+
async function Ut(e) {
|
|
347
347
|
const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
|
|
348
348
|
let l;
|
|
349
|
-
return n ? l =
|
|
350
|
-
basemapTheme: await
|
|
349
|
+
return n ? l = Qe({
|
|
350
|
+
basemapTheme: await me(a),
|
|
351
351
|
geometryType: r.geometryType,
|
|
352
352
|
includedTags: n,
|
|
353
353
|
numColors: Math.min(t.length, 8)
|
|
354
|
-
})[0] : l =
|
|
355
|
-
basemapTheme: await
|
|
354
|
+
})[0] : l = Ve({
|
|
355
|
+
basemapTheme: await me(a),
|
|
356
356
|
geometryType: r.geometryType,
|
|
357
357
|
numColors: Math.min(t.length, 8)
|
|
358
358
|
}).primaryScheme, {
|
|
@@ -368,10 +368,10 @@ async function Ht(e) {
|
|
|
368
368
|
pieChartScheme: l
|
|
369
369
|
};
|
|
370
370
|
}
|
|
371
|
-
async function
|
|
372
|
-
return await
|
|
371
|
+
async function Kt(e) {
|
|
372
|
+
return await Me(e);
|
|
373
373
|
}
|
|
374
|
-
async function
|
|
374
|
+
async function Ht({
|
|
375
375
|
arcgisMap: e,
|
|
376
376
|
arcgisMapView: t,
|
|
377
377
|
layerId: r,
|
|
@@ -390,30 +390,30 @@ async function Yt({
|
|
|
390
390
|
colorSchemeTags: o
|
|
391
391
|
};
|
|
392
392
|
try {
|
|
393
|
-
const d = await
|
|
393
|
+
const d = await Ut(u), p = await Kt(d);
|
|
394
394
|
return i.renderer = p.renderer, i.visible = !0, `Chart renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
395
395
|
} catch (d) {
|
|
396
396
|
return `Error applying chart renderer: ${d instanceof Error ? d.message : String(d)}`;
|
|
397
397
|
}
|
|
398
398
|
}
|
|
399
|
-
const
|
|
400
|
-
function
|
|
399
|
+
const Jt = ["mapView"];
|
|
400
|
+
function C(e) {
|
|
401
401
|
const r = e?.configurable?.context;
|
|
402
402
|
if (!r || typeof r != "object")
|
|
403
403
|
throw new Error("LayerStylingAgent context missing");
|
|
404
|
-
const a =
|
|
404
|
+
const a = Jt.filter((o) => !(o in r));
|
|
405
405
|
if (a.length)
|
|
406
406
|
throw new Error(`LayerStylingAgent context missing: ${a.join(", ")}`);
|
|
407
407
|
return r;
|
|
408
408
|
}
|
|
409
|
-
async function
|
|
409
|
+
async function Yt({
|
|
410
410
|
layerId: e,
|
|
411
411
|
fields: t,
|
|
412
412
|
colorSchemes: r,
|
|
413
413
|
includeSize: a
|
|
414
414
|
}, o) {
|
|
415
|
-
const { mapView: n } =
|
|
416
|
-
return await
|
|
415
|
+
const { mapView: n } = C(o);
|
|
416
|
+
return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await Ht({
|
|
417
417
|
arcgisMap: n.map,
|
|
418
418
|
arcgisMapView: n,
|
|
419
419
|
layerId: e,
|
|
@@ -422,12 +422,12 @@ async function Xt({
|
|
|
422
422
|
includeSize: a
|
|
423
423
|
});
|
|
424
424
|
}
|
|
425
|
-
const
|
|
425
|
+
const Zt = s.object({
|
|
426
426
|
layerId: s.string().describe("The id of the layer to apply the chart renderer to"),
|
|
427
427
|
fields: s.array(s.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
|
|
428
428
|
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
429
429
|
includeSize: s.boolean().optional().describe("Whether to vary the chart size (chart-size)")
|
|
430
|
-
}),
|
|
430
|
+
}), Mn = f(Yt, {
|
|
431
431
|
name: "chart",
|
|
432
432
|
description: `Label: Charts
|
|
433
433
|
Description: Show the values of two or more categories as a proportion of the total using a pie chart.
|
|
@@ -440,12 +440,12 @@ const er = s.object({
|
|
|
440
440
|
Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
|
|
441
441
|
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.
|
|
442
442
|
Fields: This style requires 2-8 number fields.`,
|
|
443
|
-
schema:
|
|
443
|
+
schema: Zt
|
|
444
444
|
});
|
|
445
|
-
function
|
|
445
|
+
function Xt(e) {
|
|
446
446
|
const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: n } = e, l = t[0];
|
|
447
447
|
let i;
|
|
448
|
-
return n && (i =
|
|
448
|
+
return n && (i = ie({
|
|
449
449
|
geometryType: r.geometryType,
|
|
450
450
|
includedTags: n,
|
|
451
451
|
theme: o || "high-to-low"
|
|
@@ -460,10 +460,10 @@ function tr(e) {
|
|
|
460
460
|
colorScheme: i
|
|
461
461
|
};
|
|
462
462
|
}
|
|
463
|
-
async function
|
|
464
|
-
return await
|
|
463
|
+
async function er(e) {
|
|
464
|
+
return await _e(e);
|
|
465
465
|
}
|
|
466
|
-
async function
|
|
466
|
+
async function tr({
|
|
467
467
|
arcgisMap: e,
|
|
468
468
|
arcgisMapView: t,
|
|
469
469
|
layerId: r,
|
|
@@ -483,20 +483,20 @@ async function ar({
|
|
|
483
483
|
theme: n
|
|
484
484
|
};
|
|
485
485
|
try {
|
|
486
|
-
const u =
|
|
486
|
+
const u = Xt(c), d = await er(u);
|
|
487
487
|
return i.renderer = d.renderer, i.visible = !0, `Color-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
488
488
|
} catch (u) {
|
|
489
489
|
return `Error applying color-age renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
490
490
|
}
|
|
491
491
|
}
|
|
492
|
-
async function
|
|
492
|
+
async function rr({
|
|
493
493
|
layerId: e,
|
|
494
494
|
fields: t,
|
|
495
495
|
colorSchemes: r,
|
|
496
496
|
theme: a
|
|
497
497
|
}, o) {
|
|
498
|
-
const { mapView: n } =
|
|
499
|
-
return await
|
|
498
|
+
const { mapView: n } = C(o);
|
|
499
|
+
return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await tr({
|
|
500
500
|
arcgisMap: n.map,
|
|
501
501
|
arcgisMapView: n,
|
|
502
502
|
layerId: e,
|
|
@@ -505,26 +505,26 @@ async function or({
|
|
|
505
505
|
theme: a
|
|
506
506
|
});
|
|
507
507
|
}
|
|
508
|
-
const
|
|
508
|
+
const ar = s.object({
|
|
509
509
|
layerId: s.string().describe("The id of the layer to apply the color-age renderer to"),
|
|
510
510
|
fields: s.array(s.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
|
|
511
511
|
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
512
512
|
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
|
|
513
|
-
}),
|
|
513
|
+
}), Qn = f(rr, {
|
|
514
514
|
name: "color-age",
|
|
515
515
|
description: `Label: Age (color)
|
|
516
516
|
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.
|
|
517
517
|
Keywords: since, age, how old, how long
|
|
518
518
|
Example: Show the age of each feature based on its reported date.
|
|
519
519
|
Fields: This style requires at least one field with a date type.`,
|
|
520
|
-
schema:
|
|
520
|
+
schema: ar
|
|
521
521
|
});
|
|
522
|
-
function
|
|
522
|
+
function or(e) {
|
|
523
523
|
const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
|
|
524
524
|
let { theme: n } = e, l = t[1];
|
|
525
525
|
const i = t[0];
|
|
526
526
|
let c;
|
|
527
|
-
return o && (c =
|
|
527
|
+
return o && (c = ie({
|
|
528
528
|
geometryType: r.geometryType,
|
|
529
529
|
includedTags: o,
|
|
530
530
|
theme: n || "high-to-low"
|
|
@@ -539,10 +539,10 @@ function ir(e) {
|
|
|
539
539
|
colorScheme: c
|
|
540
540
|
};
|
|
541
541
|
}
|
|
542
|
-
async function
|
|
543
|
-
return await
|
|
542
|
+
async function nr(e) {
|
|
543
|
+
return await We(e);
|
|
544
544
|
}
|
|
545
|
-
async function
|
|
545
|
+
async function ir({
|
|
546
546
|
arcgisMap: e,
|
|
547
547
|
arcgisMapView: t,
|
|
548
548
|
layerId: r,
|
|
@@ -562,20 +562,20 @@ async function lr({
|
|
|
562
562
|
theme: n
|
|
563
563
|
};
|
|
564
564
|
try {
|
|
565
|
-
const u =
|
|
565
|
+
const u = or(c), d = await nr(u);
|
|
566
566
|
return i.renderer = d.renderer, i.visible = !0, `Color renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
567
567
|
} catch (u) {
|
|
568
568
|
return `Error applying color renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
async function
|
|
571
|
+
async function sr({
|
|
572
572
|
layerId: e,
|
|
573
573
|
fields: t,
|
|
574
574
|
colorSchemes: r,
|
|
575
575
|
theme: a
|
|
576
576
|
}, o) {
|
|
577
|
-
const { mapView: n } =
|
|
578
|
-
return await
|
|
577
|
+
const { mapView: n } = C(o);
|
|
578
|
+
return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await ir({
|
|
579
579
|
arcgisMap: n.map,
|
|
580
580
|
arcgisMapView: n,
|
|
581
581
|
layerId: e,
|
|
@@ -584,25 +584,25 @@ async function cr({
|
|
|
584
584
|
theme: a
|
|
585
585
|
});
|
|
586
586
|
}
|
|
587
|
-
const
|
|
587
|
+
const lr = s.object({
|
|
588
588
|
layerId: s.string().describe("The id of the layer to apply the color renderer to"),
|
|
589
589
|
fields: s.array(s.string()).describe("The field(s) to use for the color renderer"),
|
|
590
590
|
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
591
591
|
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
|
|
592
|
-
}), Vn = f(
|
|
592
|
+
}), Vn = f(sr, {
|
|
593
593
|
name: "color",
|
|
594
594
|
description: `Label: Counts and Amounts (color)
|
|
595
595
|
Description: Vary color along a continuous color ramp to represent numeric or ranked data.
|
|
596
596
|
Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
|
|
597
597
|
Example: Color each feature based on the population density.
|
|
598
598
|
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.`,
|
|
599
|
-
schema:
|
|
599
|
+
schema: lr
|
|
600
600
|
});
|
|
601
|
-
function
|
|
601
|
+
function cr(e) {
|
|
602
602
|
const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: n } = e;
|
|
603
603
|
let l, i;
|
|
604
604
|
const c = t[0];
|
|
605
|
-
return o && (i =
|
|
605
|
+
return o && (i = ie({
|
|
606
606
|
geometryType: r.geometryType,
|
|
607
607
|
includedTags: o,
|
|
608
608
|
theme: n || "high-to-low"
|
|
@@ -617,10 +617,10 @@ function dr(e) {
|
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
619
|
}
|
|
620
|
-
async function
|
|
621
|
-
return await
|
|
620
|
+
async function ur(e) {
|
|
621
|
+
return await Be(e);
|
|
622
622
|
}
|
|
623
|
-
async function
|
|
623
|
+
async function dr({
|
|
624
624
|
arcgisMap: e,
|
|
625
625
|
arcgisMapView: t,
|
|
626
626
|
layerId: r,
|
|
@@ -640,20 +640,20 @@ async function mr({
|
|
|
640
640
|
theme: n
|
|
641
641
|
};
|
|
642
642
|
try {
|
|
643
|
-
const u =
|
|
643
|
+
const u = cr(c), d = await ur(u);
|
|
644
644
|
return i.renderer = d.renderer, i.visible = !0, `Color-size-univariate renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
645
645
|
} catch (u) {
|
|
646
646
|
return `Error applying color-size-univariate renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
async function
|
|
649
|
+
async function pr({
|
|
650
650
|
layerId: e,
|
|
651
651
|
fields: t,
|
|
652
652
|
colorSchemes: r,
|
|
653
653
|
theme: a
|
|
654
654
|
}, o) {
|
|
655
|
-
const { mapView: n } =
|
|
656
|
-
return await
|
|
655
|
+
const { mapView: n } = C(o);
|
|
656
|
+
return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await dr({
|
|
657
657
|
arcgisMap: n.map,
|
|
658
658
|
arcgisMapView: n,
|
|
659
659
|
layerId: e,
|
|
@@ -662,24 +662,24 @@ async function hr({
|
|
|
662
662
|
theme: a
|
|
663
663
|
});
|
|
664
664
|
}
|
|
665
|
-
const
|
|
665
|
+
const mr = s.object({
|
|
666
666
|
layerId: s.string().describe("The id of the layer to apply the color-size univariate renderer to"),
|
|
667
667
|
fields: s.array(s.string()).describe("The fields to use for the color-size univariate renderer"),
|
|
668
668
|
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
669
669
|
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
|
|
670
|
-
}),
|
|
670
|
+
}), _n = f(pr, {
|
|
671
671
|
name: "color-size-univariate",
|
|
672
672
|
description: `Label: Color and Size (univariate)
|
|
673
673
|
Description: Vary symbol size and color based on the values of two numeric attributes.
|
|
674
674
|
Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
|
|
675
675
|
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.
|
|
676
676
|
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.`,
|
|
677
|
-
schema:
|
|
677
|
+
schema: mr
|
|
678
678
|
});
|
|
679
|
-
function
|
|
679
|
+
function hr(e) {
|
|
680
680
|
const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
|
|
681
681
|
let n;
|
|
682
|
-
return o && (n =
|
|
682
|
+
return o && (n = Ke({
|
|
683
683
|
includedTags: o,
|
|
684
684
|
numColors: Math.min(t.length, 8)
|
|
685
685
|
})[0]), {
|
|
@@ -696,10 +696,10 @@ function fr(e) {
|
|
|
696
696
|
dotDensityScheme: n
|
|
697
697
|
};
|
|
698
698
|
}
|
|
699
|
-
async function
|
|
700
|
-
return await
|
|
699
|
+
async function yr(e) {
|
|
700
|
+
return await Ue(e);
|
|
701
701
|
}
|
|
702
|
-
async function
|
|
702
|
+
async function fr({
|
|
703
703
|
arcgisMap: e,
|
|
704
704
|
arcgisMapView: t,
|
|
705
705
|
layerId: r,
|
|
@@ -717,19 +717,19 @@ async function wr({
|
|
|
717
717
|
colorSchemeTags: o
|
|
718
718
|
};
|
|
719
719
|
try {
|
|
720
|
-
const c =
|
|
720
|
+
const c = hr(i), u = await yr(c);
|
|
721
721
|
return l.renderer = u.renderer, l.visible = !0, `Dot Density renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
|
|
722
722
|
} catch (c) {
|
|
723
723
|
return `Error applying dot density renderer: ${c instanceof Error ? c.message : String(c)}`;
|
|
724
724
|
}
|
|
725
725
|
}
|
|
726
|
-
async function
|
|
726
|
+
async function gr({
|
|
727
727
|
layerId: e,
|
|
728
728
|
fields: t,
|
|
729
729
|
colorSchemes: r
|
|
730
730
|
}, a) {
|
|
731
|
-
const { mapView: o } =
|
|
732
|
-
return await
|
|
731
|
+
const { mapView: o } = C(a);
|
|
732
|
+
return await $({ type: "show-legend", data: { layerIds: [e] } }, a), await fr({
|
|
733
733
|
arcgisMap: o.map,
|
|
734
734
|
arcgisMapView: o,
|
|
735
735
|
layerId: e,
|
|
@@ -737,11 +737,11 @@ async function br({
|
|
|
737
737
|
colorSchemes: r
|
|
738
738
|
});
|
|
739
739
|
}
|
|
740
|
-
const
|
|
740
|
+
const wr = s.object({
|
|
741
741
|
layerId: s.string().describe("The id of the layer to apply the dot density renderer to"),
|
|
742
742
|
fields: s.array(s.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
|
|
743
743
|
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
|
|
744
|
-
}),
|
|
744
|
+
}), Wn = f(gr, {
|
|
745
745
|
name: "dot-density",
|
|
746
746
|
description: `Dot Density
|
|
747
747
|
Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
|
|
@@ -755,13 +755,13 @@ const Tr = s.object({
|
|
|
755
755
|
- Display demographic patterns within census tracts
|
|
756
756
|
**Fields:** Requires 2-8 number fields.
|
|
757
757
|
**Keywords:** density, how much, how many, total, number, amount`,
|
|
758
|
-
schema:
|
|
758
|
+
schema: wr
|
|
759
759
|
});
|
|
760
|
-
function
|
|
760
|
+
function br(e) {
|
|
761
761
|
const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
|
|
762
762
|
let n;
|
|
763
763
|
const l = t[0];
|
|
764
|
-
return o && (n =
|
|
764
|
+
return o && (n = Je({
|
|
765
765
|
includedTags: o,
|
|
766
766
|
basemap: a.map?.basemap || "topo"
|
|
767
767
|
})[0]), {
|
|
@@ -771,10 +771,10 @@ function Sr(e) {
|
|
|
771
771
|
heatmapScheme: n
|
|
772
772
|
};
|
|
773
773
|
}
|
|
774
|
-
async function
|
|
775
|
-
return await
|
|
774
|
+
async function Tr(e) {
|
|
775
|
+
return await He(e);
|
|
776
776
|
}
|
|
777
|
-
async function
|
|
777
|
+
async function Sr({
|
|
778
778
|
arcgisMap: e,
|
|
779
779
|
arcgisMapView: t,
|
|
780
780
|
layerId: r,
|
|
@@ -792,19 +792,19 @@ async function xr({
|
|
|
792
792
|
colorSchemeTags: o
|
|
793
793
|
};
|
|
794
794
|
try {
|
|
795
|
-
const c =
|
|
795
|
+
const c = br(i), u = await Tr(c);
|
|
796
796
|
return l.renderer = u.renderer, l.visible = !0, `Heatmap renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
|
|
797
797
|
} catch (c) {
|
|
798
798
|
return `Error applying heatmap renderer: ${c instanceof Error ? c.message : String(c)}`;
|
|
799
799
|
}
|
|
800
800
|
}
|
|
801
|
-
async function
|
|
801
|
+
async function vr({
|
|
802
802
|
layerId: e,
|
|
803
803
|
fields: t,
|
|
804
804
|
colorSchemes: r
|
|
805
805
|
}, a) {
|
|
806
|
-
const { mapView: o } =
|
|
807
|
-
return await
|
|
806
|
+
const { mapView: o } = C(a);
|
|
807
|
+
return await $({ type: "show-legend", data: { layerIds: [e] } }, a), await Sr({
|
|
808
808
|
arcgisMap: o.map,
|
|
809
809
|
arcgisMapView: o,
|
|
810
810
|
layerId: e,
|
|
@@ -812,23 +812,23 @@ async function Rr({
|
|
|
812
812
|
colorSchemes: r
|
|
813
813
|
});
|
|
814
814
|
}
|
|
815
|
-
const
|
|
815
|
+
const xr = s.object({
|
|
816
816
|
layerId: s.string().describe("The id of the layer to apply the heatmap renderer to"),
|
|
817
817
|
fields: s.array(s.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
|
|
818
818
|
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
|
|
819
|
-
}),
|
|
819
|
+
}), Bn = f(vr, {
|
|
820
820
|
name: "heatmap",
|
|
821
821
|
description: `Label: Heat Map
|
|
822
822
|
Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
|
|
823
823
|
Keywords: density, heatmap, hot spots, pattern, cluster
|
|
824
824
|
Example: Create a heatmap
|
|
825
825
|
Fields: This typically requires zero or one field of type number.`,
|
|
826
|
-
schema:
|
|
826
|
+
schema: xr
|
|
827
827
|
});
|
|
828
|
-
function
|
|
828
|
+
function Rr(e) {
|
|
829
829
|
const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
|
|
830
830
|
let l;
|
|
831
|
-
return n && (l =
|
|
831
|
+
return n && (l = Ze({
|
|
832
832
|
geometryType: r.geometryType,
|
|
833
833
|
includedTags: n,
|
|
834
834
|
numColors: Math.min(t.length, 10)
|
|
@@ -842,10 +842,10 @@ function Cr(e) {
|
|
|
842
842
|
predominanceScheme: l
|
|
843
843
|
};
|
|
844
844
|
}
|
|
845
|
-
async function
|
|
846
|
-
return await
|
|
845
|
+
async function $r(e) {
|
|
846
|
+
return await Ye(e);
|
|
847
847
|
}
|
|
848
|
-
async function
|
|
848
|
+
async function Cr({
|
|
849
849
|
arcgisMap: e,
|
|
850
850
|
arcgisMapView: t,
|
|
851
851
|
layerId: r,
|
|
@@ -864,20 +864,20 @@ async function Fr({
|
|
|
864
864
|
colorSchemeTags: o
|
|
865
865
|
};
|
|
866
866
|
try {
|
|
867
|
-
const d =
|
|
867
|
+
const d = Rr(u), p = await $r(d);
|
|
868
868
|
return i.renderer = p.renderer, i.visible = !0, `Predominance renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
869
869
|
} catch (d) {
|
|
870
870
|
return `Error applying predominance renderer: ${d instanceof Error ? d.message : String(d)}`;
|
|
871
871
|
}
|
|
872
872
|
}
|
|
873
|
-
async function
|
|
873
|
+
async function Er({
|
|
874
874
|
layerId: e,
|
|
875
875
|
fields: t,
|
|
876
876
|
colorSchemes: r,
|
|
877
877
|
includeSize: a
|
|
878
878
|
}, o) {
|
|
879
|
-
const { mapView: n } =
|
|
880
|
-
return await
|
|
879
|
+
const { mapView: n } = C(o);
|
|
880
|
+
return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await Cr({
|
|
881
881
|
arcgisMap: n.map,
|
|
882
882
|
arcgisMapView: n,
|
|
883
883
|
layerId: e,
|
|
@@ -886,12 +886,12 @@ async function Nr({
|
|
|
886
886
|
includeSize: a
|
|
887
887
|
});
|
|
888
888
|
}
|
|
889
|
-
const
|
|
889
|
+
const Fr = s.object({
|
|
890
890
|
layerId: s.string().describe("The id of the layer to apply the predominance renderer to"),
|
|
891
891
|
fields: s.array(s.string()).describe("The fields to use for the predominance renderer (competing categories)"),
|
|
892
892
|
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
893
893
|
includeSize: s.boolean().optional().describe("Whether to include size visualization (predominance-size)")
|
|
894
|
-
}),
|
|
894
|
+
}), Un = f(Er, {
|
|
895
895
|
name: "predominance",
|
|
896
896
|
description: `Label: Predominant category
|
|
897
897
|
Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
|
|
@@ -904,9 +904,9 @@ const kr = s.object({
|
|
|
904
904
|
Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
|
|
905
905
|
Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
|
|
906
906
|
Fields: This style relies on 2-10 number fields.`,
|
|
907
|
-
schema:
|
|
907
|
+
schema: Fr
|
|
908
908
|
});
|
|
909
|
-
function
|
|
909
|
+
function kr(e) {
|
|
910
910
|
const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
|
|
911
911
|
let n;
|
|
912
912
|
const l = {
|
|
@@ -914,7 +914,7 @@ function qr(e) {
|
|
|
914
914
|
}, i = {
|
|
915
915
|
field: t[1]
|
|
916
916
|
};
|
|
917
|
-
return o && (n =
|
|
917
|
+
return o && (n = et({
|
|
918
918
|
geometryType: r.geometryType,
|
|
919
919
|
includedTags: o
|
|
920
920
|
})[0]), {
|
|
@@ -927,10 +927,10 @@ function qr(e) {
|
|
|
927
927
|
relationshipScheme: n
|
|
928
928
|
};
|
|
929
929
|
}
|
|
930
|
-
async function
|
|
931
|
-
return await
|
|
930
|
+
async function Nr(e) {
|
|
931
|
+
return await Xe(e);
|
|
932
932
|
}
|
|
933
|
-
async function
|
|
933
|
+
async function Ir({
|
|
934
934
|
arcgisMap: e,
|
|
935
935
|
arcgisMapView: t,
|
|
936
936
|
layerId: r,
|
|
@@ -948,19 +948,19 @@ async function Dr({
|
|
|
948
948
|
colorSchemeTags: o
|
|
949
949
|
};
|
|
950
950
|
try {
|
|
951
|
-
const c =
|
|
951
|
+
const c = kr(i), u = await Nr(c);
|
|
952
952
|
return l.renderer = u.renderer, l.visible = !0, `Relationship renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
|
|
953
953
|
} catch (c) {
|
|
954
954
|
return `Error applying relationship renderer: ${c instanceof Error ? c.message : String(c)}`;
|
|
955
955
|
}
|
|
956
956
|
}
|
|
957
|
-
async function
|
|
957
|
+
async function qr({
|
|
958
958
|
layerId: e,
|
|
959
959
|
fields: t,
|
|
960
960
|
colorSchemes: r
|
|
961
961
|
}, a) {
|
|
962
|
-
const { mapView: o } =
|
|
963
|
-
return await
|
|
962
|
+
const { mapView: o } = C(a);
|
|
963
|
+
return await $({ type: "show-legend", data: { layerIds: [e] } }, a), await Ir({
|
|
964
964
|
arcgisMap: o.map,
|
|
965
965
|
arcgisMapView: o,
|
|
966
966
|
layerId: e,
|
|
@@ -968,20 +968,20 @@ async function zr({
|
|
|
968
968
|
colorSchemes: r
|
|
969
969
|
});
|
|
970
970
|
}
|
|
971
|
-
const
|
|
971
|
+
const zr = s.object({
|
|
972
972
|
layerId: s.string().describe("The id of the layer to apply the relationship renderer to"),
|
|
973
973
|
fields: s.array(s.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
|
|
974
974
|
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
|
|
975
|
-
}),
|
|
975
|
+
}), Kn = f(qr, {
|
|
976
976
|
name: "relationship",
|
|
977
977
|
description: `Label: Relationship
|
|
978
978
|
Description: Overlays two color ramps to represent the relationship between two numeric attributes.
|
|
979
979
|
Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
|
|
980
980
|
Example: Show the relationship between tree height and carbon storage
|
|
981
981
|
Fields: This style requires two number fields.`,
|
|
982
|
-
schema:
|
|
982
|
+
schema: zr
|
|
983
983
|
});
|
|
984
|
-
function
|
|
984
|
+
function Dr(e) {
|
|
985
985
|
const { fields: t, layer: r, view: a, theme: o } = e, n = t[0];
|
|
986
986
|
return {
|
|
987
987
|
layer: r,
|
|
@@ -993,10 +993,10 @@ function Ar(e) {
|
|
|
993
993
|
outlineOptimizationEnabled: !0
|
|
994
994
|
};
|
|
995
995
|
}
|
|
996
|
-
async function
|
|
997
|
-
return await
|
|
996
|
+
async function Pr(e) {
|
|
997
|
+
return await tt(e);
|
|
998
998
|
}
|
|
999
|
-
async function
|
|
999
|
+
async function Ar({
|
|
1000
1000
|
arcgisMap: e,
|
|
1001
1001
|
arcgisMapView: t,
|
|
1002
1002
|
layerId: r,
|
|
@@ -1016,20 +1016,20 @@ async function jr({
|
|
|
1016
1016
|
theme: n
|
|
1017
1017
|
};
|
|
1018
1018
|
try {
|
|
1019
|
-
const u =
|
|
1019
|
+
const u = Dr(c), d = await Pr(u);
|
|
1020
1020
|
return i.renderer = d.renderer, i.visible = !0, `Size-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
1021
1021
|
} catch (u) {
|
|
1022
1022
|
return `Error applying size-age renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
1023
1023
|
}
|
|
1024
1024
|
}
|
|
1025
|
-
async function
|
|
1025
|
+
async function Lr({
|
|
1026
1026
|
layerId: e,
|
|
1027
1027
|
fields: t,
|
|
1028
1028
|
colorSchemes: r,
|
|
1029
1029
|
theme: a
|
|
1030
1030
|
}, o) {
|
|
1031
|
-
const { mapView: n } =
|
|
1032
|
-
return await
|
|
1031
|
+
const { mapView: n } = C(o);
|
|
1032
|
+
return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await Ar({
|
|
1033
1033
|
arcgisMap: n.map,
|
|
1034
1034
|
arcgisMapView: n,
|
|
1035
1035
|
layerId: e,
|
|
@@ -1038,21 +1038,21 @@ async function Gr({
|
|
|
1038
1038
|
theme: a
|
|
1039
1039
|
});
|
|
1040
1040
|
}
|
|
1041
|
-
const
|
|
1041
|
+
const jr = s.object({
|
|
1042
1042
|
layerId: s.string().describe("The id of the layer to apply the size-age renderer to"),
|
|
1043
1043
|
fields: s.array(s.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
|
|
1044
1044
|
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
1045
1045
|
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
|
|
1046
|
-
}),
|
|
1046
|
+
}), Hn = f(Lr, {
|
|
1047
1047
|
name: "size-age",
|
|
1048
1048
|
description: `Label: Age (size)
|
|
1049
1049
|
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.
|
|
1050
1050
|
Keywords: since, age, how old, how long
|
|
1051
1051
|
Example: Change the size of features so older features are larger than new features.
|
|
1052
1052
|
Fields: This style requires at least one field with a date type.`,
|
|
1053
|
-
schema:
|
|
1053
|
+
schema: jr
|
|
1054
1054
|
});
|
|
1055
|
-
function
|
|
1055
|
+
function Gr(e) {
|
|
1056
1056
|
const { fields: t, layer: r, view: a } = e;
|
|
1057
1057
|
let { theme: o } = e, n = t[1];
|
|
1058
1058
|
const l = t[0];
|
|
@@ -1066,10 +1066,10 @@ function Mr(e) {
|
|
|
1066
1066
|
outlineOptimizationEnabled: !0
|
|
1067
1067
|
};
|
|
1068
1068
|
}
|
|
1069
|
-
async function
|
|
1070
|
-
return await
|
|
1069
|
+
async function Or(e) {
|
|
1070
|
+
return await rt(e);
|
|
1071
1071
|
}
|
|
1072
|
-
async function
|
|
1072
|
+
async function Mr({
|
|
1073
1073
|
arcgisMap: e,
|
|
1074
1074
|
arcgisMapView: t,
|
|
1075
1075
|
layerId: r,
|
|
@@ -1089,20 +1089,20 @@ async function _r({
|
|
|
1089
1089
|
theme: n
|
|
1090
1090
|
};
|
|
1091
1091
|
try {
|
|
1092
|
-
const u =
|
|
1092
|
+
const u = Gr(c), d = await Or(u);
|
|
1093
1093
|
return i.renderer = d.renderer, i.visible = !0, `Size renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
1094
1094
|
} catch (u) {
|
|
1095
1095
|
return `Error applying size renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
1098
|
-
async function
|
|
1098
|
+
async function Qr({
|
|
1099
1099
|
layerId: e,
|
|
1100
1100
|
fields: t,
|
|
1101
1101
|
colorSchemes: r,
|
|
1102
1102
|
theme: a
|
|
1103
1103
|
}, o) {
|
|
1104
|
-
const { mapView: n } =
|
|
1105
|
-
return await
|
|
1104
|
+
const { mapView: n } = C(o);
|
|
1105
|
+
return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await Mr({
|
|
1106
1106
|
arcgisMap: n.map,
|
|
1107
1107
|
arcgisMapView: n,
|
|
1108
1108
|
layerId: e,
|
|
@@ -1116,7 +1116,7 @@ const Vr = s.object({
|
|
|
1116
1116
|
fields: s.array(s.string()).describe("The field(s) to use for the size renderer (numeric data)"),
|
|
1117
1117
|
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
1118
1118
|
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
|
|
1119
|
-
}),
|
|
1119
|
+
}), Jn = f(Qr, {
|
|
1120
1120
|
name: "size",
|
|
1121
1121
|
description: `Label: Counts and Amounts (size)
|
|
1122
1122
|
Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
|
|
@@ -1131,10 +1131,10 @@ const Vr = s.object({
|
|
|
1131
1131
|
Fields: This style requires a single field with a date type.`,
|
|
1132
1132
|
schema: Vr
|
|
1133
1133
|
});
|
|
1134
|
-
function
|
|
1134
|
+
function _r(e) {
|
|
1135
1135
|
const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], l = t[1], i = t[2];
|
|
1136
1136
|
let c;
|
|
1137
|
-
return o && (c =
|
|
1137
|
+
return o && (c = ot({
|
|
1138
1138
|
geometryType: r.geometryType,
|
|
1139
1139
|
includedTags: o
|
|
1140
1140
|
})[0]), {
|
|
@@ -1148,10 +1148,10 @@ function Br(e) {
|
|
|
1148
1148
|
typeScheme: c
|
|
1149
1149
|
};
|
|
1150
1150
|
}
|
|
1151
|
-
async function
|
|
1152
|
-
return await
|
|
1151
|
+
async function Wr(e) {
|
|
1152
|
+
return await at(e);
|
|
1153
1153
|
}
|
|
1154
|
-
async function
|
|
1154
|
+
async function Br({
|
|
1155
1155
|
arcgisMap: e,
|
|
1156
1156
|
arcgisMapView: t,
|
|
1157
1157
|
layerId: r,
|
|
@@ -1171,20 +1171,20 @@ async function Kr({
|
|
|
1171
1171
|
theme: n
|
|
1172
1172
|
};
|
|
1173
1173
|
try {
|
|
1174
|
-
const u =
|
|
1174
|
+
const u = _r(c), d = await Wr(u);
|
|
1175
1175
|
return i.renderer = d.renderer, i.visible = !0, `Type renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
|
|
1176
1176
|
} catch (u) {
|
|
1177
1177
|
return `Error applying type renderer: ${u instanceof Error ? u.message : String(u)}`;
|
|
1178
1178
|
}
|
|
1179
1179
|
}
|
|
1180
|
-
async function
|
|
1180
|
+
async function Ur({
|
|
1181
1181
|
layerId: e,
|
|
1182
1182
|
fields: t,
|
|
1183
1183
|
colorSchemes: r,
|
|
1184
1184
|
theme: a
|
|
1185
1185
|
}, o) {
|
|
1186
|
-
const { mapView: n } =
|
|
1187
|
-
return await
|
|
1186
|
+
const { mapView: n } = C(o);
|
|
1187
|
+
return await $({ type: "show-legend", data: { layerIds: [e] } }, o), await Br({
|
|
1188
1188
|
arcgisMap: n.map,
|
|
1189
1189
|
arcgisMapView: n,
|
|
1190
1190
|
layerId: e,
|
|
@@ -1193,90 +1193,80 @@ async function Hr({
|
|
|
1193
1193
|
theme: a
|
|
1194
1194
|
});
|
|
1195
1195
|
}
|
|
1196
|
-
const
|
|
1196
|
+
const Kr = s.object({
|
|
1197
1197
|
layerId: s.string().describe("The id of the layer to apply the type renderer to"),
|
|
1198
1198
|
fields: s.array(s.string()).describe("The field(s) to use for the type renderer (categorical data)"),
|
|
1199
1199
|
colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
|
|
1200
1200
|
theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
|
|
1201
|
-
}),
|
|
1201
|
+
}), Yn = f(Ur, {
|
|
1202
1202
|
name: "type",
|
|
1203
1203
|
description: `Label: Types (unique symbols)
|
|
1204
1204
|
Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
|
|
1205
1205
|
Keywords: categorical, category, type, unique, discrete, point of interest, region, group
|
|
1206
1206
|
Example: Color each feature based on the region it belongs to
|
|
1207
1207
|
Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
|
|
1208
|
-
schema:
|
|
1209
|
-
}),
|
|
1210
|
-
...
|
|
1208
|
+
schema: Kr
|
|
1209
|
+
}), Zn = T.Root({
|
|
1210
|
+
...K(),
|
|
1211
1211
|
vectorSearchLayerIds: T(),
|
|
1212
1212
|
vectorSearchFieldResults: T(),
|
|
1213
1213
|
layerFieldInfo: T(),
|
|
1214
1214
|
selectedLayerId: T()
|
|
1215
|
-
}),
|
|
1216
|
-
...
|
|
1215
|
+
}), Xn = T.Root({
|
|
1216
|
+
...K(),
|
|
1217
1217
|
vectorSearchLayerIds: T(),
|
|
1218
1218
|
vectorSearchFieldResults: T(),
|
|
1219
1219
|
layerFieldInfo: T(),
|
|
1220
1220
|
queryResponse: T(),
|
|
1221
1221
|
dataExplorationMessages: T({
|
|
1222
|
-
reducer:
|
|
1222
|
+
reducer: we,
|
|
1223
1223
|
default: () => []
|
|
1224
1224
|
})
|
|
1225
|
-
}),
|
|
1226
|
-
function k(e) {
|
|
1227
|
-
const r = e?.configurable?.context;
|
|
1228
|
-
if (!r || typeof r != "object")
|
|
1229
|
-
throw new Error("DataExplorationAgent context missing");
|
|
1230
|
-
const a = Yr.filter((o) => !(o in r));
|
|
1231
|
-
if (a.length)
|
|
1232
|
-
throw new Error(`DataExplorationAgent context missing: ${a.join(", ")}`);
|
|
1233
|
-
return r;
|
|
1234
|
-
}
|
|
1235
|
-
const Zr = (e) => {
|
|
1225
|
+
}), Hr = (e) => {
|
|
1236
1226
|
const t = e.map?.allLayers.filter((a) => a.type === "feature");
|
|
1237
1227
|
let r = 0;
|
|
1238
1228
|
return t?.forEach((a) => {
|
|
1239
1229
|
const o = a;
|
|
1240
1230
|
o.featureEffect && (o.featureEffect = null, r++);
|
|
1241
1231
|
}), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
|
|
1242
|
-
},
|
|
1243
|
-
const { mapView: r } =
|
|
1244
|
-
return
|
|
1245
|
-
},
|
|
1232
|
+
}, Jr = async (e, t) => {
|
|
1233
|
+
const { mapView: r } = v(t, ["mapView"]);
|
|
1234
|
+
return Hr(r);
|
|
1235
|
+
}, Yr = f(Jr, {
|
|
1246
1236
|
name: "clearFilters",
|
|
1247
1237
|
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.",
|
|
1248
1238
|
schema: s.object({})
|
|
1249
|
-
}),
|
|
1239
|
+
}), Zr = async (e) => {
|
|
1250
1240
|
e.map?.allLayers.filter((o) => o.type === "feature")?.forEach((o) => {
|
|
1251
1241
|
const n = o;
|
|
1252
1242
|
n.featureEffect && (n.featureEffect = null);
|
|
1253
1243
|
});
|
|
1254
1244
|
const a = e.map.initialViewProperties?.viewpoint?.targetGeometry;
|
|
1255
1245
|
return a ? (await e.goTo(a), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
|
|
1256
|
-
},
|
|
1257
|
-
const { mapView: r } =
|
|
1258
|
-
return await
|
|
1259
|
-
},
|
|
1246
|
+
}, Xr = async (e, t) => {
|
|
1247
|
+
const { mapView: r } = v(t, ["mapView"]);
|
|
1248
|
+
return await Zr(r);
|
|
1249
|
+
}, ea = f(Xr, {
|
|
1260
1250
|
name: "resetMap",
|
|
1261
1251
|
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.",
|
|
1262
1252
|
schema: s.object({})
|
|
1263
|
-
}),
|
|
1264
|
-
function
|
|
1253
|
+
}), ge = 750;
|
|
1254
|
+
function B(e) {
|
|
1265
1255
|
return "point" in e && e.point !== void 0;
|
|
1266
1256
|
}
|
|
1267
|
-
function
|
|
1257
|
+
function L(e) {
|
|
1268
1258
|
return "layerId" in e && e.layerId !== void 0;
|
|
1269
1259
|
}
|
|
1270
|
-
const
|
|
1271
|
-
if (
|
|
1260
|
+
const H = async (e, t) => {
|
|
1261
|
+
if (B(e)) {
|
|
1272
1262
|
const { point: r } = e;
|
|
1273
|
-
return { geometry: new
|
|
1263
|
+
return { geometry: new be({
|
|
1274
1264
|
x: r.x,
|
|
1275
1265
|
y: r.y,
|
|
1276
1266
|
spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
|
|
1277
1267
|
}) };
|
|
1278
1268
|
}
|
|
1279
|
-
if (
|
|
1269
|
+
if (L(e)) {
|
|
1280
1270
|
const r = t.map?.allLayers.find(
|
|
1281
1271
|
(n) => n.id === e.layerId
|
|
1282
1272
|
);
|
|
@@ -1288,27 +1278,27 @@ const J = async (e, t) => {
|
|
|
1288
1278
|
where: o,
|
|
1289
1279
|
returnGeometry: !0,
|
|
1290
1280
|
outSpatialReference: t.spatialReference,
|
|
1291
|
-
num:
|
|
1281
|
+
num: ge + 1
|
|
1292
1282
|
});
|
|
1293
1283
|
if (!n.features.length)
|
|
1294
1284
|
return {
|
|
1295
1285
|
error: `No features found in geometry layer "${a}" with the specified where clause: ${o}`
|
|
1296
1286
|
};
|
|
1297
|
-
if (n.features.length >
|
|
1287
|
+
if (n.features.length > ge)
|
|
1298
1288
|
return {
|
|
1299
1289
|
error: `Geometry filter for layer "${a}" matched too many features (${n.features.length}+). Please narrow the geometry layer filter.`
|
|
1300
1290
|
};
|
|
1301
1291
|
const l = n.features.map((c) => c.geometry).filter((c) => !!c);
|
|
1302
1292
|
if (!l.length)
|
|
1303
1293
|
return { error: "No valid geometries found for the matched geometry layer features." };
|
|
1304
|
-
const i = l.length === 1 ? l[0] :
|
|
1294
|
+
const i = l.length === 1 ? l[0] : st.executeMany(l);
|
|
1305
1295
|
return i ? (i.spatialReference || (i.spatialReference = t.spatialReference), { geometry: i }) : { error: "Failed to combine geometries from geometry layer." };
|
|
1306
1296
|
} catch (n) {
|
|
1307
1297
|
return { error: `Failed to query geometry: ${String(n)}` };
|
|
1308
1298
|
}
|
|
1309
1299
|
}
|
|
1310
1300
|
return { error: "Invalid geometry configuration provided" };
|
|
1311
|
-
},
|
|
1301
|
+
}, ta = async (e, t, r, a, o, n) => {
|
|
1312
1302
|
const l = e.map?.allLayers.find((c) => c.id === t);
|
|
1313
1303
|
if (!l)
|
|
1314
1304
|
return { success: !1, error: `Layer '${t}' not found.` };
|
|
@@ -1326,7 +1316,7 @@ const J = async (e, t) => {
|
|
|
1326
1316
|
error: c instanceof Error ? c.message : String(c)
|
|
1327
1317
|
};
|
|
1328
1318
|
}
|
|
1329
|
-
},
|
|
1319
|
+
}, ra = async (e, t, r, a, o, n) => {
|
|
1330
1320
|
const l = t.map?.allLayers.find(
|
|
1331
1321
|
(p) => p.id === e.layerId
|
|
1332
1322
|
);
|
|
@@ -1334,13 +1324,13 @@ const J = async (e, t) => {
|
|
|
1334
1324
|
return `Could not find target layer with ID: ${e.layerId}`;
|
|
1335
1325
|
let i;
|
|
1336
1326
|
if (o) {
|
|
1337
|
-
const p = await
|
|
1327
|
+
const p = await H(o, t);
|
|
1338
1328
|
if ("error" in p)
|
|
1339
1329
|
return p.error;
|
|
1340
1330
|
i = p.geometry;
|
|
1341
1331
|
}
|
|
1342
|
-
if (l.featureEffect = null, l.featureEffect = new
|
|
1343
|
-
filter: new
|
|
1332
|
+
if (l.featureEffect = null, l.featureEffect = new it({
|
|
1333
|
+
filter: new Te({
|
|
1344
1334
|
...e.objectIds?.length ? { objectIds: e.objectIds } : { where: e.where },
|
|
1345
1335
|
geometry: i,
|
|
1346
1336
|
spatialRelationship: "intersects",
|
|
@@ -1351,7 +1341,7 @@ const J = async (e, t) => {
|
|
|
1351
1341
|
excludedEffect: a
|
|
1352
1342
|
}), l.visible = !0, n)
|
|
1353
1343
|
return `Applied feature effects to "${l.title ?? e.layerId}" within current map extent.`;
|
|
1354
|
-
const c = e.objectIds?.length ? `${l.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await
|
|
1344
|
+
const c = e.objectIds?.length ? `${l.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await ta(
|
|
1355
1345
|
t,
|
|
1356
1346
|
e.layerId,
|
|
1357
1347
|
c,
|
|
@@ -1360,21 +1350,21 @@ const J = async (e, t) => {
|
|
|
1360
1350
|
o?.units
|
|
1361
1351
|
), d = l.title ?? e.layerId;
|
|
1362
1352
|
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}`;
|
|
1363
|
-
},
|
|
1353
|
+
}, aa = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], F = s.enum(aa), oa = async ({
|
|
1364
1354
|
targetLayer: e,
|
|
1365
1355
|
geometryFilter: t,
|
|
1366
1356
|
useCurrentExtent: r,
|
|
1367
1357
|
includedEffect: a = "drop-shadow(2px, 2px, 2px, gray)",
|
|
1368
1358
|
excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
|
|
1369
1359
|
}, n) => {
|
|
1370
|
-
const { mapView: l } =
|
|
1371
|
-
return await
|
|
1372
|
-
},
|
|
1360
|
+
const { mapView: l } = v(n, ["mapView"]);
|
|
1361
|
+
return await ra(e, l, a, o, t, r);
|
|
1362
|
+
}, na = s.object({
|
|
1373
1363
|
layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1374
1364
|
where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1375
1365
|
distance: s.number().optional().describe("The buffer distance around the geometry."),
|
|
1376
1366
|
units: F.optional().describe("The units for the distance buffer.")
|
|
1377
|
-
}),
|
|
1367
|
+
}), ia = s.object({
|
|
1378
1368
|
point: s.object({
|
|
1379
1369
|
x: s.number().describe("X coordinate (longitude) from navigation result"),
|
|
1380
1370
|
y: s.number().describe("Y coordinate (latitude) from navigation result"),
|
|
@@ -1384,7 +1374,7 @@ const J = async (e, t) => {
|
|
|
1384
1374
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1385
1375
|
distance: s.number().optional().describe("Optional buffer distance around the point."),
|
|
1386
1376
|
units: F.optional().describe("The units for the distance buffer.")
|
|
1387
|
-
}),
|
|
1377
|
+
}), sa = s.object({
|
|
1388
1378
|
targetLayer: s.object({
|
|
1389
1379
|
layerId: s.string().describe("The layerId of the layer on which to set a feature effect."),
|
|
1390
1380
|
where: s.string().describe("The SQL-92 where clause representing the features to emphasize."),
|
|
@@ -1392,7 +1382,7 @@ const J = async (e, t) => {
|
|
|
1392
1382
|
"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."
|
|
1393
1383
|
)
|
|
1394
1384
|
}),
|
|
1395
|
-
geometryFilter: s.union([
|
|
1385
|
+
geometryFilter: s.union([na, ia]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
|
|
1396
1386
|
useCurrentExtent: s.boolean().optional().describe(
|
|
1397
1387
|
"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."
|
|
1398
1388
|
),
|
|
@@ -1402,11 +1392,11 @@ const J = async (e, t) => {
|
|
|
1402
1392
|
excludedEffect: s.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
|
|
1403
1393
|
"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."
|
|
1404
1394
|
)
|
|
1405
|
-
}),
|
|
1395
|
+
}), la = f(oa, {
|
|
1406
1396
|
name: "setFeatureEffect",
|
|
1407
1397
|
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.",
|
|
1408
|
-
schema:
|
|
1409
|
-
}),
|
|
1398
|
+
schema: sa
|
|
1399
|
+
}), ca = /* @__PURE__ */ new Set([
|
|
1410
1400
|
"date",
|
|
1411
1401
|
"esrifieldtypedate",
|
|
1412
1402
|
"date-only",
|
|
@@ -1418,12 +1408,12 @@ const J = async (e, t) => {
|
|
|
1418
1408
|
"timestamp-offset",
|
|
1419
1409
|
"timestampoffset",
|
|
1420
1410
|
"esrifieldtypetimestampoffset"
|
|
1421
|
-
]),
|
|
1411
|
+
]), xe = (e) => {
|
|
1422
1412
|
if (!e)
|
|
1423
1413
|
return !1;
|
|
1424
1414
|
const t = e.toLowerCase();
|
|
1425
|
-
return
|
|
1426
|
-
},
|
|
1415
|
+
return ca.has(t);
|
|
1416
|
+
}, ee = (e) => {
|
|
1427
1417
|
if (e instanceof Date)
|
|
1428
1418
|
return Number.isNaN(e.getTime()) ? null : e;
|
|
1429
1419
|
if (typeof e == "number" && Number.isFinite(e)) {
|
|
@@ -1431,46 +1421,46 @@ const J = async (e, t) => {
|
|
|
1431
1421
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
1432
1422
|
}
|
|
1433
1423
|
return null;
|
|
1434
|
-
},
|
|
1424
|
+
}, ua = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, da = (e) => {
|
|
1435
1425
|
if (typeof e == "string" && e)
|
|
1436
1426
|
return e;
|
|
1437
|
-
const t =
|
|
1427
|
+
const t = ee(e);
|
|
1438
1428
|
return t ? t.toISOString().slice(0, 10) : null;
|
|
1439
|
-
},
|
|
1429
|
+
}, ei = () => {
|
|
1440
1430
|
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}`;
|
|
1441
1431
|
return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
|
|
1442
|
-
},
|
|
1432
|
+
}, pa = (e, t, r) => {
|
|
1443
1433
|
const a = t?.toLowerCase();
|
|
1444
|
-
if (a && !
|
|
1434
|
+
if (a && !xe(a))
|
|
1445
1435
|
return e;
|
|
1446
1436
|
if (a === "date-only") {
|
|
1447
|
-
const n =
|
|
1448
|
-
return n ?
|
|
1437
|
+
const n = da(e);
|
|
1438
|
+
return n ? lt(n, Q("short-date")) : e;
|
|
1449
1439
|
}
|
|
1450
1440
|
if (a === "time-only") {
|
|
1451
1441
|
if (typeof e == "string" && e)
|
|
1452
|
-
return
|
|
1453
|
-
const n =
|
|
1454
|
-
return n ?
|
|
1455
|
-
...
|
|
1442
|
+
return ct(e, Q("long-time"));
|
|
1443
|
+
const n = ee(e);
|
|
1444
|
+
return n ? he(n, {
|
|
1445
|
+
...Q("long-time"),
|
|
1456
1446
|
timeZone: "UTC"
|
|
1457
1447
|
}) : e;
|
|
1458
1448
|
}
|
|
1459
|
-
const o =
|
|
1460
|
-
return o ?
|
|
1461
|
-
...
|
|
1462
|
-
timeZone:
|
|
1449
|
+
const o = ee(e);
|
|
1450
|
+
return o ? he(o, {
|
|
1451
|
+
...Q("short-date-short-time"),
|
|
1452
|
+
timeZone: ua(r)
|
|
1463
1453
|
}) : e;
|
|
1464
|
-
},
|
|
1454
|
+
}, Re = (e, t, r) => {
|
|
1465
1455
|
if (e && typeof e != "function") {
|
|
1466
1456
|
const a = "getField" in r && r.getField?.(e), o = a && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(a.name) : null;
|
|
1467
1457
|
if (o?.type === "coded-value") {
|
|
1468
|
-
const
|
|
1469
|
-
return
|
|
1458
|
+
const n = o.codedValues.find((l) => l.code === t);
|
|
1459
|
+
return n ? n.name : null;
|
|
1470
1460
|
}
|
|
1471
1461
|
}
|
|
1472
1462
|
return null;
|
|
1473
|
-
},
|
|
1463
|
+
}, ma = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ha = (e) => {
|
|
1474
1464
|
if (e instanceof Date)
|
|
1475
1465
|
return Number.isNaN(e.getTime()) ? null : e;
|
|
1476
1466
|
if (typeof e == "number" && Number.isFinite(e)) {
|
|
@@ -1482,7 +1472,7 @@ const J = async (e, t) => {
|
|
|
1482
1472
|
return Number.isNaN(t.getTime()) ? null : t;
|
|
1483
1473
|
}
|
|
1484
1474
|
return null;
|
|
1485
|
-
},
|
|
1475
|
+
}, ya = (e, t) => {
|
|
1486
1476
|
if (typeof e != "number")
|
|
1487
1477
|
return e;
|
|
1488
1478
|
const r = {};
|
|
@@ -1492,26 +1482,26 @@ const J = async (e, t) => {
|
|
|
1492
1482
|
} catch {
|
|
1493
1483
|
return e;
|
|
1494
1484
|
}
|
|
1495
|
-
},
|
|
1496
|
-
const a =
|
|
1485
|
+
}, fa = (e, t, r) => {
|
|
1486
|
+
const a = ha(e);
|
|
1497
1487
|
if (!a)
|
|
1498
1488
|
return e;
|
|
1499
1489
|
const o = {};
|
|
1500
|
-
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 =
|
|
1490
|
+
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);
|
|
1501
1491
|
try {
|
|
1502
1492
|
return new Intl.DateTimeFormat(void 0, o).format(a);
|
|
1503
1493
|
} catch {
|
|
1504
1494
|
return e;
|
|
1505
1495
|
}
|
|
1506
|
-
},
|
|
1496
|
+
}, $e = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Ce = (e, t, r, a, o) => {
|
|
1507
1497
|
if (r == null)
|
|
1508
1498
|
return r;
|
|
1509
1499
|
const l = e.getFieldConfiguration?.(t)?.fieldFormat;
|
|
1510
|
-
return l?.type === "number" ?
|
|
1511
|
-
},
|
|
1512
|
-
const o = e.fieldsIndex?.get(t), n =
|
|
1513
|
-
return
|
|
1514
|
-
},
|
|
1500
|
+
return l?.type === "number" ? ya(r, l) : l?.type === "date-time" ? !a || xe(a) ? fa(r, l, o) : r : pa(r, a, o);
|
|
1501
|
+
}, ga = (e, t, r, a) => {
|
|
1502
|
+
const o = e.fieldsIndex?.get(t), n = Re(t, r, e) ?? r;
|
|
1503
|
+
return Ce(e, t, n, o?.type, a);
|
|
1504
|
+
}, wa = (e, t) => $e(e, t), Ee = (e, t, r) => {
|
|
1515
1505
|
const a = e.objectIdField, o = t.features.map(
|
|
1516
1506
|
(l) => l.attributes[a]
|
|
1517
1507
|
), n = t.features.map((l) => {
|
|
@@ -1524,16 +1514,16 @@ const J = async (e, t) => {
|
|
|
1524
1514
|
c[u.name] = d;
|
|
1525
1515
|
return;
|
|
1526
1516
|
}
|
|
1527
|
-
const p =
|
|
1528
|
-
c[m] =
|
|
1517
|
+
const p = Re(u.name, d, e) ?? d, m = $e(e, u.name);
|
|
1518
|
+
c[m] = Ce(e, u.name, p, u.type, r);
|
|
1529
1519
|
}), c;
|
|
1530
1520
|
});
|
|
1531
1521
|
return { objectIds: o, attributes: n };
|
|
1532
|
-
},
|
|
1522
|
+
}, ba = (e, t, r) => {
|
|
1533
1523
|
const a = e.createQuery();
|
|
1534
1524
|
return a.outFields = [t], a.where = r || "1=1", a.num = 1, a;
|
|
1535
|
-
},
|
|
1536
|
-
const o = a.map?.allLayers.find((m) => m.id === e), n =
|
|
1525
|
+
}, Ta = async (e, t, r, a) => {
|
|
1526
|
+
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);
|
|
1537
1527
|
return {
|
|
1538
1528
|
tool: "getAttribute",
|
|
1539
1529
|
layerName: o.title ?? e,
|
|
@@ -1546,31 +1536,31 @@ const J = async (e, t) => {
|
|
|
1546
1536
|
}
|
|
1547
1537
|
};
|
|
1548
1538
|
};
|
|
1549
|
-
async function
|
|
1550
|
-
const { mapView: o } =
|
|
1539
|
+
async function Sa({ layerId: e, fieldName: t, query: r }, a) {
|
|
1540
|
+
const { mapView: o } = v(a, ["mapView"]), n = await Ta(e, t, r, o);
|
|
1551
1541
|
return JSON.stringify(n, null, 2);
|
|
1552
1542
|
}
|
|
1553
|
-
const
|
|
1543
|
+
const va = s.object({
|
|
1554
1544
|
layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1555
1545
|
fieldName: s.string().describe("The name of the field/attribute from which to get a field value."),
|
|
1556
1546
|
query: s.object({
|
|
1557
1547
|
where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
|
|
1558
1548
|
})
|
|
1559
|
-
}),
|
|
1549
|
+
}), xa = f(Sa, {
|
|
1560
1550
|
name: "getAttribute",
|
|
1561
1551
|
description: "Returns an attribute value for a given feature.",
|
|
1562
|
-
schema:
|
|
1563
|
-
}),
|
|
1552
|
+
schema: va
|
|
1553
|
+
}), se = (e, t, r) => {
|
|
1564
1554
|
if (!(r ? e.hasAllFeaturesInView : e.hasAllFeatures))
|
|
1565
1555
|
return !1;
|
|
1566
1556
|
const o = new Set((e.availableFields ?? []).map((n) => n.toLowerCase()));
|
|
1567
1557
|
return o.has("*") ? !0 : t.every((n) => o.has(n.toLowerCase()));
|
|
1568
1558
|
};
|
|
1569
|
-
function
|
|
1559
|
+
function U(e, t) {
|
|
1570
1560
|
let r = e ?? "";
|
|
1571
1561
|
return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
|
|
1572
1562
|
}
|
|
1573
|
-
const
|
|
1563
|
+
const Ra = async (e) => {
|
|
1574
1564
|
const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: l } = e, i = o.map?.allLayers.find((S) => S.id === t.layerId);
|
|
1575
1565
|
if (!i)
|
|
1576
1566
|
throw new Error(`Layer '${t.layerId}' not found.`);
|
|
@@ -1579,35 +1569,35 @@ const Ea = async (e) => {
|
|
|
1579
1569
|
throw new Error(`Field '${r}' not found.`);
|
|
1580
1570
|
let m, w;
|
|
1581
1571
|
if (l) {
|
|
1582
|
-
const S = await
|
|
1572
|
+
const S = await H(l, o);
|
|
1583
1573
|
if ("error" in S)
|
|
1584
1574
|
throw new Error(S.error);
|
|
1585
1575
|
if (!S.geometry)
|
|
1586
|
-
throw
|
|
1587
|
-
if (
|
|
1588
|
-
const
|
|
1576
|
+
throw L(l) ? new Error(`No features found matching: ${l.where}`) : new Error("Failed to create geometry");
|
|
1577
|
+
if (L(l)) {
|
|
1578
|
+
const M = o.map?.allLayers.find((P) => P.id === l.layerId);
|
|
1589
1579
|
m = {
|
|
1590
|
-
geometryLayerName:
|
|
1580
|
+
geometryLayerName: M?.title ?? M?.id,
|
|
1591
1581
|
geometryLayerId: l.layerId,
|
|
1592
1582
|
geometryWhere: l.where,
|
|
1593
1583
|
distance: l.distance,
|
|
1594
1584
|
units: l.units,
|
|
1595
1585
|
applied: !0
|
|
1596
1586
|
};
|
|
1597
|
-
} else
|
|
1587
|
+
} else B(l) && (m = {
|
|
1598
1588
|
point: l.point,
|
|
1599
1589
|
distance: l.distance,
|
|
1600
1590
|
units: l.units,
|
|
1601
1591
|
applied: !0
|
|
1602
1592
|
});
|
|
1603
|
-
w = new
|
|
1593
|
+
w = new Te({
|
|
1604
1594
|
geometry: S.geometry,
|
|
1605
1595
|
distance: l.distance,
|
|
1606
1596
|
units: l.units,
|
|
1607
1597
|
spatialRelationship: "intersects"
|
|
1608
1598
|
});
|
|
1609
1599
|
}
|
|
1610
|
-
const h =
|
|
1600
|
+
const h = se(c, [r], !1);
|
|
1611
1601
|
let y = null, g = null;
|
|
1612
1602
|
const b = 10;
|
|
1613
1603
|
if (d.type !== "geometry" && d.type !== "oid" && d.type !== "global-id")
|
|
@@ -1617,22 +1607,22 @@ const Ea = async (e) => {
|
|
|
1617
1607
|
useFeaturesInView: h,
|
|
1618
1608
|
view: h ? o : void 0,
|
|
1619
1609
|
field: r,
|
|
1620
|
-
sqlWhere:
|
|
1610
|
+
sqlWhere: U(i.definitionExpression, t.where),
|
|
1621
1611
|
...w && { filter: w },
|
|
1622
1612
|
outStatisticTypes: { include: [a] }
|
|
1623
1613
|
};
|
|
1624
|
-
y = await
|
|
1625
|
-
const
|
|
1626
|
-
(
|
|
1614
|
+
y = await ut(S);
|
|
1615
|
+
const M = ["string", "small-integer", "integer"], P = d.domain?.type === "coded-value" ? d.domain : null;
|
|
1616
|
+
(M.includes(d.type) || P) && (g = (await dt({
|
|
1627
1617
|
layer: i,
|
|
1628
1618
|
useFeaturesInView: h,
|
|
1629
1619
|
view: h ? o : void 0,
|
|
1630
1620
|
field: r,
|
|
1631
|
-
sqlWhere:
|
|
1621
|
+
sqlWhere: U(i.definitionExpression, t.where),
|
|
1632
1622
|
...w && { filter: w }
|
|
1633
1623
|
})).uniqueValueInfos.sort((I, ze) => ze.count - I.count).slice(0, b)), g && d.domain?.type === "coded-value" && (g = g.map((I) => ({
|
|
1634
1624
|
...I,
|
|
1635
|
-
value:
|
|
1625
|
+
value: P ? P.getName(I.value) ?? I.value : I.value
|
|
1636
1626
|
})));
|
|
1637
1627
|
} catch (S) {
|
|
1638
1628
|
console.error("Statistics error:", S);
|
|
@@ -1653,13 +1643,13 @@ const Ea = async (e) => {
|
|
|
1653
1643
|
}
|
|
1654
1644
|
};
|
|
1655
1645
|
};
|
|
1656
|
-
async function
|
|
1646
|
+
async function $a({
|
|
1657
1647
|
targetLayer: e,
|
|
1658
1648
|
fieldName: t,
|
|
1659
1649
|
statisticType: r,
|
|
1660
1650
|
geometryFilter: a
|
|
1661
1651
|
}, o) {
|
|
1662
|
-
const n =
|
|
1652
|
+
const n = ve(o, "layersAndFieldsRegistry"), { mapView: l } = v(o, ["mapView"]), i = await Ra({
|
|
1663
1653
|
targetLayer: e,
|
|
1664
1654
|
fieldName: t,
|
|
1665
1655
|
statisticType: r,
|
|
@@ -1669,12 +1659,12 @@ async function Fa({
|
|
|
1669
1659
|
});
|
|
1670
1660
|
return JSON.stringify(i, null, 2);
|
|
1671
1661
|
}
|
|
1672
|
-
const
|
|
1662
|
+
const Ca = s.object({
|
|
1673
1663
|
layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1674
1664
|
where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1675
1665
|
distance: s.number().optional().describe("The buffer distance around the geometry."),
|
|
1676
1666
|
units: F.optional().describe("The units for the distance buffer.")
|
|
1677
|
-
}),
|
|
1667
|
+
}), Ea = s.object({
|
|
1678
1668
|
point: s.object({
|
|
1679
1669
|
x: s.number().describe("X coordinate (longitude) from navigation result"),
|
|
1680
1670
|
y: s.number().describe("Y coordinate (latitude) from navigation result"),
|
|
@@ -1684,17 +1674,17 @@ const Na = s.object({
|
|
|
1684
1674
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1685
1675
|
distance: s.number().optional().describe("Optional buffer distance around the point."),
|
|
1686
1676
|
units: F.optional().describe("The units for the distance buffer.")
|
|
1687
|
-
}),
|
|
1677
|
+
}), Fa = s.object({
|
|
1688
1678
|
targetLayer: s.object({
|
|
1689
1679
|
layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1690
1680
|
where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
|
|
1691
1681
|
}),
|
|
1692
|
-
geometryFilter: s.union([
|
|
1682
|
+
geometryFilter: s.union([Ca, Ea]).optional().describe(
|
|
1693
1683
|
"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."
|
|
1694
1684
|
),
|
|
1695
1685
|
fieldName: s.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
|
|
1696
1686
|
statisticType: s.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
|
|
1697
|
-
}),
|
|
1687
|
+
}), ka = f($a, {
|
|
1698
1688
|
name: "getStatistics",
|
|
1699
1689
|
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.
|
|
1700
1690
|
|
|
@@ -1709,12 +1699,12 @@ DO NOT USE FOR:
|
|
|
1709
1699
|
- Simple counts of features matching a condition — use queryFeatures instead
|
|
1710
1700
|
|
|
1711
1701
|
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.`,
|
|
1712
|
-
schema:
|
|
1713
|
-
}),
|
|
1702
|
+
schema: Fa
|
|
1703
|
+
}), Na = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), Ia = async (e, t, r, a, o) => {
|
|
1714
1704
|
const n = r.map?.allLayers.find((m) => m.id === e.layerId), l = await r.whenLayerView(n), i = n.title ?? e.layerId;
|
|
1715
1705
|
let c;
|
|
1716
1706
|
if (a) {
|
|
1717
|
-
const m = await
|
|
1707
|
+
const m = await H(a, r);
|
|
1718
1708
|
if ("error" in m)
|
|
1719
1709
|
return {
|
|
1720
1710
|
tool: "getTopFeatures",
|
|
@@ -1737,7 +1727,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1737
1727
|
try {
|
|
1738
1728
|
let m;
|
|
1739
1729
|
if (u) {
|
|
1740
|
-
const y = new
|
|
1730
|
+
const y = new pt({
|
|
1741
1731
|
where: e.where || "1=1",
|
|
1742
1732
|
outFields: p,
|
|
1743
1733
|
orderByFields: e.orderByFields,
|
|
@@ -1745,7 +1735,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1745
1735
|
spatialRelationship: c ? "intersects" : void 0,
|
|
1746
1736
|
distance: a?.distance,
|
|
1747
1737
|
units: a?.units,
|
|
1748
|
-
topFilter: new
|
|
1738
|
+
topFilter: new mt({
|
|
1749
1739
|
topCount: t.topCount,
|
|
1750
1740
|
groupByFields: t.groupByFields,
|
|
1751
1741
|
orderByFields: t.orderByFields
|
|
@@ -1754,17 +1744,17 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1754
1744
|
m = await n.queryTopFeatures(y);
|
|
1755
1745
|
} else {
|
|
1756
1746
|
const y = n.createQuery();
|
|
1757
|
-
y.where =
|
|
1747
|
+
y.where = U(n.definitionExpression, e.where || "1=1"), y.outFields = p.length ? p : ["*"], y.orderByFields = t.orderByFields, y.returnGeometry = !1, y.num = t.topCount, c && (y.geometry = c, y.spatialRelationship = "intersects"), a?.distance && (y.distance = a.distance), a?.units && (y.units = a.units), y.outSpatialReference = r.spatialReference;
|
|
1758
1748
|
const g = [
|
|
1759
|
-
.../* @__PURE__ */ new Set([...e.outFields, ...
|
|
1760
|
-
], b =
|
|
1749
|
+
.../* @__PURE__ */ new Set([...e.outFields, ...Na(t.orderByFields)])
|
|
1750
|
+
], b = se(l, g, o ?? !1);
|
|
1761
1751
|
try {
|
|
1762
1752
|
m = b ? await l.queryFeatures(y) : await n.queryFeatures(y);
|
|
1763
|
-
} catch (
|
|
1764
|
-
console.warn("Client-side query failed, falling back to server:",
|
|
1753
|
+
} catch (x) {
|
|
1754
|
+
console.warn("Client-side query failed, falling back to server:", x), m = await n.queryFeatures(y);
|
|
1765
1755
|
}
|
|
1766
1756
|
}
|
|
1767
|
-
const w = m.features.map((y) => y.attributes[d]), { attributes: h } =
|
|
1757
|
+
const w = m.features.map((y) => y.attributes[d]), { attributes: h } = Ee(n, m, r.timeZone);
|
|
1768
1758
|
return {
|
|
1769
1759
|
tool: "getTopFeatures",
|
|
1770
1760
|
layerName: i,
|
|
@@ -1787,20 +1777,20 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1787
1777
|
details: { error: m instanceof Error ? m.message : String(m) }
|
|
1788
1778
|
};
|
|
1789
1779
|
}
|
|
1790
|
-
},
|
|
1780
|
+
}, qa = async ({
|
|
1791
1781
|
targetLayer: e,
|
|
1792
1782
|
topFilter: t,
|
|
1793
1783
|
geometryFilter: r,
|
|
1794
1784
|
useCurrentExtent: a
|
|
1795
1785
|
}, o) => {
|
|
1796
|
-
const { mapView: n } =
|
|
1786
|
+
const { mapView: n } = v(o, ["mapView"]), l = await Ia(e, t, n, r, a);
|
|
1797
1787
|
return JSON.stringify(l, null, 2);
|
|
1798
|
-
},
|
|
1788
|
+
}, za = s.object({
|
|
1799
1789
|
layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1800
1790
|
where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1801
1791
|
distance: s.number().optional().describe("The buffer distance around the geometry."),
|
|
1802
1792
|
units: F.optional().describe("The units for the distance buffer.")
|
|
1803
|
-
}),
|
|
1793
|
+
}), Da = s.object({
|
|
1804
1794
|
point: s.object({
|
|
1805
1795
|
x: s.number().describe("X coordinate (longitude) from navigation result"),
|
|
1806
1796
|
y: s.number().describe("Y coordinate (latitude) from navigation result"),
|
|
@@ -1810,7 +1800,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1810
1800
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1811
1801
|
distance: s.number().optional().describe("Optional buffer distance around the point."),
|
|
1812
1802
|
units: F.optional().describe("The units for the distance buffer.")
|
|
1813
|
-
}),
|
|
1803
|
+
}), Pa = s.object({
|
|
1814
1804
|
targetLayer: s.object({
|
|
1815
1805
|
layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1816
1806
|
where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
|
|
@@ -1821,7 +1811,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1821
1811
|
).default("*")
|
|
1822
1812
|
)
|
|
1823
1813
|
}),
|
|
1824
|
-
geometryFilter: s.union([
|
|
1814
|
+
geometryFilter: s.union([za, Da]).optional().describe(
|
|
1825
1815
|
"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."
|
|
1826
1816
|
),
|
|
1827
1817
|
topFilter: s.object({
|
|
@@ -1834,21 +1824,21 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1834
1824
|
useCurrentExtent: s.boolean().optional().describe(
|
|
1835
1825
|
"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)."
|
|
1836
1826
|
)
|
|
1837
|
-
}),
|
|
1827
|
+
}), Aa = f(qa, {
|
|
1838
1828
|
name: "getTopFeatures",
|
|
1839
1829
|
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.',
|
|
1840
|
-
schema:
|
|
1841
|
-
}),
|
|
1830
|
+
schema: Pa
|
|
1831
|
+
}), X = 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) => {
|
|
1842
1832
|
const o = t.map?.allLayers.find((g) => g.id === e.layerId), n = await t.whenLayerView(o), l = o.title ?? e.layerId;
|
|
1843
1833
|
let i;
|
|
1844
1834
|
if (r) {
|
|
1845
|
-
const g = await
|
|
1835
|
+
const g = await H(r, t);
|
|
1846
1836
|
if ("error" in g) {
|
|
1847
1837
|
const b = { error: g.error };
|
|
1848
|
-
if (
|
|
1849
|
-
const
|
|
1850
|
-
b.geometryLayerName =
|
|
1851
|
-
} else
|
|
1838
|
+
if (L(r)) {
|
|
1839
|
+
const x = t.map?.allLayers.find((S) => S.id === r.layerId);
|
|
1840
|
+
b.geometryLayerName = x?.title ?? x?.id, b.geometryLayerId = r.layerId, b.geometryWhere = r.where;
|
|
1841
|
+
} else B(r) && (b.point = r.point);
|
|
1852
1842
|
return {
|
|
1853
1843
|
tool: "queryFeatures",
|
|
1854
1844
|
layerName: l,
|
|
@@ -1858,10 +1848,10 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1858
1848
|
}
|
|
1859
1849
|
if (!g.geometry) {
|
|
1860
1850
|
const b = {};
|
|
1861
|
-
if (
|
|
1862
|
-
const
|
|
1863
|
-
b.error = `No features found matching: ${r.where}`, b.geometryLayerName =
|
|
1864
|
-
} else
|
|
1851
|
+
if (L(r)) {
|
|
1852
|
+
const x = t.map?.allLayers.find((S) => S.id === r.layerId);
|
|
1853
|
+
b.error = `No features found matching: ${r.where}`, b.geometryLayerName = x?.title ?? x?.id, b.geometryLayerId = r.layerId, b.geometryWhere = r.where;
|
|
1854
|
+
} else B(r) && (b.error = "Failed to create point geometry", b.point = r.point);
|
|
1865
1855
|
return {
|
|
1866
1856
|
tool: "queryFeatures",
|
|
1867
1857
|
layerName: l,
|
|
@@ -1872,16 +1862,16 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1872
1862
|
i = g.geometry;
|
|
1873
1863
|
} else a && (i = t.extent.clone());
|
|
1874
1864
|
const c = [
|
|
1875
|
-
.../* @__PURE__ */ new Set([...e.outFields, ...
|
|
1876
|
-
], u =
|
|
1877
|
-
p.where =
|
|
1865
|
+
.../* @__PURE__ */ new Set([...e.outFields, ...La(e.orderByFields)])
|
|
1866
|
+
], u = se(n, c, a ?? !1), d = o.objectIdField, p = o.createQuery();
|
|
1867
|
+
p.where = U(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;
|
|
1878
1868
|
let m, w;
|
|
1879
1869
|
try {
|
|
1880
|
-
m = u ? await n.queryFeatureCount(p) : await o.queryFeatureCount(p), m > 0 && m <=
|
|
1870
|
+
m = u ? await n.queryFeatureCount(p) : await o.queryFeatureCount(p), m > 0 && m <= X && (w = u ? await n.queryFeatures(p) : await o.queryFeatures(p));
|
|
1881
1871
|
} catch (g) {
|
|
1882
|
-
console.warn("Client-side query failed, falling back to server:", g), m = await o.queryFeatureCount(p), m > 0 && m <=
|
|
1872
|
+
console.warn("Client-side query failed, falling back to server:", g), m = await o.queryFeatureCount(p), m > 0 && m <= X && (w = await o.queryFeatures(p));
|
|
1883
1873
|
}
|
|
1884
|
-
const { objectIds: h, attributes: y } = w ?
|
|
1874
|
+
const { objectIds: h, attributes: y } = w ? Ee(o, w, t.timeZone) : { objectIds: void 0, attributes: void 0 };
|
|
1885
1875
|
return {
|
|
1886
1876
|
tool: "queryFeatures",
|
|
1887
1877
|
layerName: l,
|
|
@@ -1893,26 +1883,26 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
|
|
|
1893
1883
|
outFields: e.outFields,
|
|
1894
1884
|
...h && { objectIds: h, objectIdField: d },
|
|
1895
1885
|
...y && { attributes: y },
|
|
1896
|
-
...m >
|
|
1886
|
+
...m > X && {
|
|
1897
1887
|
note: `${m} features found.`
|
|
1898
1888
|
}
|
|
1899
1889
|
}
|
|
1900
1890
|
};
|
|
1901
1891
|
};
|
|
1902
|
-
async function
|
|
1892
|
+
async function Ga({
|
|
1903
1893
|
targetLayer: e,
|
|
1904
1894
|
geometryFilter: t,
|
|
1905
1895
|
useCurrentExtent: r
|
|
1906
1896
|
}, a) {
|
|
1907
|
-
const { mapView: o } =
|
|
1897
|
+
const { mapView: o } = v(a, ["mapView"]), n = await ja(e, o, t, r);
|
|
1908
1898
|
return JSON.stringify(n, null, 2);
|
|
1909
1899
|
}
|
|
1910
|
-
const
|
|
1900
|
+
const Oa = s.object({
|
|
1911
1901
|
layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
1912
1902
|
where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
1913
1903
|
distance: s.number().optional().describe("The buffer distance around the geometry."),
|
|
1914
1904
|
units: F.optional().describe("The units for the distance buffer.")
|
|
1915
|
-
}),
|
|
1905
|
+
}), Ma = s.object({
|
|
1916
1906
|
point: s.object({
|
|
1917
1907
|
x: s.number().describe("X coordinate (longitude) from navigation result"),
|
|
1918
1908
|
y: s.number().describe("Y coordinate (latitude) from navigation result"),
|
|
@@ -1922,7 +1912,7 @@ const _a = s.object({
|
|
|
1922
1912
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
1923
1913
|
distance: s.number().optional().describe("Optional buffer distance around the point."),
|
|
1924
1914
|
units: F.optional().describe("The units for the distance buffer.")
|
|
1925
|
-
}),
|
|
1915
|
+
}), Qa = s.object({
|
|
1926
1916
|
targetLayer: s.object({
|
|
1927
1917
|
layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
1928
1918
|
where: s.string().describe(
|
|
@@ -1935,13 +1925,13 @@ const _a = s.object({
|
|
|
1935
1925
|
).default("*")
|
|
1936
1926
|
)
|
|
1937
1927
|
}),
|
|
1938
|
-
geometryFilter: s.union([
|
|
1928
|
+
geometryFilter: s.union([Oa, Ma]).optional().describe(
|
|
1939
1929
|
"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."
|
|
1940
1930
|
),
|
|
1941
1931
|
useCurrentExtent: s.boolean().optional().describe(
|
|
1942
1932
|
"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)."
|
|
1943
1933
|
)
|
|
1944
|
-
}),
|
|
1934
|
+
}), Va = f(Ga, {
|
|
1945
1935
|
name: "queryFeatures",
|
|
1946
1936
|
description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
|
|
1947
1937
|
|
|
@@ -1953,10 +1943,10 @@ USE THIS TOOL FOR:
|
|
|
1953
1943
|
- Any question where the user wants to SEE or COUNT matching features
|
|
1954
1944
|
|
|
1955
1945
|
This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
|
|
1956
|
-
schema:
|
|
1957
|
-
}),
|
|
1958
|
-
async function
|
|
1959
|
-
const { messages: r } = await
|
|
1946
|
+
schema: Qa
|
|
1947
|
+
}), _a = [xa, ka, Aa, Va], ti = [la, ea, Yr], Wa = new nt(_a, { handleToolErrors: !1 });
|
|
1948
|
+
async function ri(e, t) {
|
|
1949
|
+
const { messages: r } = await Wa.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
|
|
1960
1950
|
for (const n of r) {
|
|
1961
1951
|
const l = n.content;
|
|
1962
1952
|
let i;
|
|
@@ -1983,25 +1973,25 @@ async function oi(e, t) {
|
|
|
1983
1973
|
}
|
|
1984
1974
|
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}`);
|
|
1985
1975
|
}
|
|
1986
|
-
return await
|
|
1976
|
+
return await R({ text: `Finished executing layer query tool: ${o.join(", ")}` }, t), {
|
|
1987
1977
|
...e,
|
|
1988
1978
|
dataExplorationMessages: [...e.dataExplorationMessages, ...r],
|
|
1989
1979
|
queryResponse: a,
|
|
1990
1980
|
status: "success",
|
|
1991
|
-
summary: o.length > 0 ?
|
|
1981
|
+
summary: o.length > 0 ? Bt(o.join(`
|
|
1992
1982
|
`)) : "Query executed."
|
|
1993
1983
|
};
|
|
1994
1984
|
}
|
|
1995
|
-
const
|
|
1996
|
-
...
|
|
1985
|
+
const ai = T.Root({
|
|
1986
|
+
...K(),
|
|
1997
1987
|
// internal to the help agent
|
|
1998
1988
|
helpInternalState: T({
|
|
1999
|
-
reducer:
|
|
1989
|
+
reducer: A,
|
|
2000
1990
|
default: () => ({
|
|
2001
1991
|
toolCallMessage: void 0
|
|
2002
1992
|
})
|
|
2003
1993
|
})
|
|
2004
|
-
}),
|
|
1994
|
+
}), Ba = (e, t) => {
|
|
2005
1995
|
const r = Array.from(e.values()).find(
|
|
2006
1996
|
({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
|
|
2007
1997
|
);
|
|
@@ -2014,22 +2004,22 @@ const ni = T.Root({
|
|
|
2014
2004
|
return `**${r.layerItem.title}** has ${a.length} field(s):
|
|
2015
2005
|
|
|
2016
2006
|
${o}`;
|
|
2017
|
-
},
|
|
2018
|
-
const r =
|
|
2019
|
-
return
|
|
2020
|
-
},
|
|
2007
|
+
}, Ua = ({ layerTitle: e }, t) => {
|
|
2008
|
+
const r = ve(t, "layersAndFieldsRegistry");
|
|
2009
|
+
return Ba(r, e);
|
|
2010
|
+
}, oi = f(Ua, {
|
|
2021
2011
|
name: "listLayerFields",
|
|
2022
2012
|
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.",
|
|
2023
2013
|
schema: s.object({
|
|
2024
2014
|
layerTitle: s.string().describe("The title or partial title of the layer to list fields for.")
|
|
2025
2015
|
})
|
|
2026
|
-
}),
|
|
2027
|
-
...
|
|
2016
|
+
}), ni = T.Root({
|
|
2017
|
+
...K(),
|
|
2028
2018
|
intent: T({
|
|
2029
2019
|
reducer: (e, t) => t
|
|
2030
2020
|
}),
|
|
2031
2021
|
arcgisKnowledgeMessages: T({
|
|
2032
|
-
reducer:
|
|
2022
|
+
reducer: we,
|
|
2033
2023
|
default: () => []
|
|
2034
2024
|
}),
|
|
2035
2025
|
arcgisKnowledgeToolResult: T({
|
|
@@ -2037,38 +2027,38 @@ ${o}`;
|
|
|
2037
2027
|
default: () => null
|
|
2038
2028
|
})
|
|
2039
2029
|
});
|
|
2040
|
-
function
|
|
2030
|
+
function le(e) {
|
|
2041
2031
|
const t = e.map?.allLayers.filter((r) => r.type === "knowledge-graph");
|
|
2042
2032
|
if (!t || t?.length !== 1)
|
|
2043
2033
|
throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.");
|
|
2044
2034
|
}
|
|
2045
|
-
function
|
|
2035
|
+
function N(e) {
|
|
2046
2036
|
return !!e?.map && !("activeLinkChartLayer" in e.map);
|
|
2047
2037
|
}
|
|
2048
|
-
async function
|
|
2049
|
-
!e ||
|
|
2038
|
+
async function J(e) {
|
|
2039
|
+
!e || N(e) || !e.map?.diagramNodesExtent || await e.goTo(e.map.diagramNodesExtent);
|
|
2050
2040
|
}
|
|
2051
|
-
function
|
|
2041
|
+
function G(e) {
|
|
2052
2042
|
const r = e?.configurable?.context;
|
|
2053
2043
|
if (!r || typeof r != "object")
|
|
2054
2044
|
throw new Error("ArcgisKnowledgeAgent context missing");
|
|
2055
2045
|
if (!("view" in r))
|
|
2056
2046
|
throw new Error("View context missing");
|
|
2057
2047
|
const a = r.view;
|
|
2058
|
-
return a.map && !("activeLinkChartLayer" in a.map) &&
|
|
2048
|
+
return a.map && !("activeLinkChartLayer" in a.map) && le(a), {
|
|
2059
2049
|
view: a
|
|
2060
2050
|
};
|
|
2061
2051
|
}
|
|
2062
|
-
function
|
|
2052
|
+
function ii(e) {
|
|
2063
2053
|
const r = e?.configurable?.context;
|
|
2064
|
-
if (
|
|
2054
|
+
if (Fe(e) === "knowledgeGraph")
|
|
2065
2055
|
return "knowledgeGraph";
|
|
2066
2056
|
const o = r.view;
|
|
2067
|
-
return
|
|
2057
|
+
return N(o) ? (le(o), "map") : "linkChart";
|
|
2068
2058
|
}
|
|
2069
|
-
async function
|
|
2059
|
+
async function O(e) {
|
|
2070
2060
|
const r = e?.configurable?.context;
|
|
2071
|
-
if (
|
|
2061
|
+
if (Fe(e) === "knowledgeGraph")
|
|
2072
2062
|
return r;
|
|
2073
2063
|
{
|
|
2074
2064
|
const o = r.view.map;
|
|
@@ -2077,22 +2067,22 @@ async function M(e) {
|
|
|
2077
2067
|
if (!n)
|
|
2078
2068
|
throw new Error("Knowledge graph url missing from link chart.");
|
|
2079
2069
|
return {
|
|
2080
|
-
knowledgeGraph: await
|
|
2070
|
+
knowledgeGraph: await ye(n)
|
|
2081
2071
|
};
|
|
2082
2072
|
} else {
|
|
2083
|
-
|
|
2073
|
+
le(r.view);
|
|
2084
2074
|
const l = (r.view.map?.allLayers.find(
|
|
2085
2075
|
(c) => c.type === "knowledge-graph"
|
|
2086
2076
|
)).url;
|
|
2087
2077
|
if (!l)
|
|
2088
2078
|
throw new Error("Knowledge graph url missing from map.");
|
|
2089
2079
|
return {
|
|
2090
|
-
knowledgeGraph: await
|
|
2080
|
+
knowledgeGraph: await ye(l)
|
|
2091
2081
|
};
|
|
2092
2082
|
}
|
|
2093
2083
|
}
|
|
2094
2084
|
}
|
|
2095
|
-
function
|
|
2085
|
+
function Fe(e) {
|
|
2096
2086
|
const r = e?.configurable?.context;
|
|
2097
2087
|
if (!r || typeof r != "object")
|
|
2098
2088
|
throw new Error("ArcgisKnowledgeAgent context missing");
|
|
@@ -2104,12 +2094,12 @@ function Ne(e) {
|
|
|
2104
2094
|
return "view";
|
|
2105
2095
|
throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.");
|
|
2106
2096
|
}
|
|
2107
|
-
class
|
|
2097
|
+
class Ka {
|
|
2108
2098
|
constructor(t) {
|
|
2109
|
-
this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation =
|
|
2099
|
+
this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = ce.fromDataModel(t);
|
|
2110
2100
|
}
|
|
2111
2101
|
}
|
|
2112
|
-
class
|
|
2102
|
+
class ce {
|
|
2113
2103
|
constructor() {
|
|
2114
2104
|
this.schemaType = "ArcgisGraphSchema", this.entityTypes = [], this.relationshipTypes = [], this.identifierInfo = {
|
|
2115
2105
|
mappingInfo: {
|
|
@@ -2119,14 +2109,14 @@ class ue {
|
|
|
2119
2109
|
};
|
|
2120
2110
|
}
|
|
2121
2111
|
static fromDataModel(t) {
|
|
2122
|
-
const r = new
|
|
2112
|
+
const r = new ce();
|
|
2123
2113
|
for (const a of t.entityTypes)
|
|
2124
|
-
r.entityTypes.push(
|
|
2114
|
+
r.entityTypes.push(j.fromEntityType(a));
|
|
2125
2115
|
for (const a of t.relationshipTypes)
|
|
2126
|
-
r.relationshipTypes.push(
|
|
2116
|
+
r.relationshipTypes.push(Ha.fromRelationshipType(a));
|
|
2127
2117
|
return r.identifierInfo = {
|
|
2128
2118
|
mappingInfo: {
|
|
2129
|
-
identifierMapsTo:
|
|
2119
|
+
identifierMapsTo: Ja(
|
|
2130
2120
|
t.identifierInfo.identifierMappingInfo.identifierInfoType
|
|
2131
2121
|
),
|
|
2132
2122
|
identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
|
|
@@ -2140,19 +2130,19 @@ class ue {
|
|
|
2140
2130
|
Relationship Types: ${a}.`;
|
|
2141
2131
|
}
|
|
2142
2132
|
}
|
|
2143
|
-
class
|
|
2133
|
+
class j {
|
|
2144
2134
|
constructor() {
|
|
2145
2135
|
this.name = "", this.properties = [];
|
|
2146
2136
|
}
|
|
2147
2137
|
static fromEntityType(t) {
|
|
2148
|
-
const r = new
|
|
2149
|
-
r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role =
|
|
2138
|
+
const r = new j();
|
|
2139
|
+
r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = Ya(t.role);
|
|
2150
2140
|
for (const a of t.properties) {
|
|
2151
2141
|
const o = {
|
|
2152
2142
|
name: a.name,
|
|
2153
2143
|
alias: a.alias ? a.alias : void 0,
|
|
2154
2144
|
fieldType: a.fieldType,
|
|
2155
|
-
role:
|
|
2145
|
+
role: Za(a.role),
|
|
2156
2146
|
geometryDef: a.fieldType === "esriFieldTypeGeometry" ? {
|
|
2157
2147
|
geometryType: a.geometryType ?? "esriGeometryAny",
|
|
2158
2148
|
hasM: a.hasM ? a.hasM : void 0,
|
|
@@ -2164,12 +2154,12 @@ class G {
|
|
|
2164
2154
|
return r;
|
|
2165
2155
|
}
|
|
2166
2156
|
}
|
|
2167
|
-
class
|
|
2157
|
+
class Ha extends j {
|
|
2168
2158
|
constructor() {
|
|
2169
2159
|
super(...arguments), this.observedEndPoints = [];
|
|
2170
2160
|
}
|
|
2171
2161
|
static fromRelationshipType(t) {
|
|
2172
|
-
const r =
|
|
2162
|
+
const r = j.fromEntityType(t);
|
|
2173
2163
|
r.observedEndPoints = [];
|
|
2174
2164
|
for (const a of t.endPoints)
|
|
2175
2165
|
r.observedEndPoints.push({
|
|
@@ -2179,7 +2169,7 @@ class Za extends G {
|
|
|
2179
2169
|
return r;
|
|
2180
2170
|
}
|
|
2181
2171
|
}
|
|
2182
|
-
const
|
|
2172
|
+
const Ja = (e) => {
|
|
2183
2173
|
switch (e) {
|
|
2184
2174
|
case "esriIdentifierInfoTypeUNSPECIFIED":
|
|
2185
2175
|
return "UNSPECIFIED";
|
|
@@ -2190,7 +2180,7 @@ const Xa = (e) => {
|
|
|
2190
2180
|
default:
|
|
2191
2181
|
return e;
|
|
2192
2182
|
}
|
|
2193
|
-
},
|
|
2183
|
+
}, Ya = (e) => {
|
|
2194
2184
|
switch (e) {
|
|
2195
2185
|
case "Regular":
|
|
2196
2186
|
return "esriGraphNamedObjectRegular";
|
|
@@ -2202,7 +2192,7 @@ const Xa = (e) => {
|
|
|
2202
2192
|
return e;
|
|
2203
2193
|
}
|
|
2204
2194
|
};
|
|
2205
|
-
function
|
|
2195
|
+
function Za(e) {
|
|
2206
2196
|
switch (e) {
|
|
2207
2197
|
case "esriGraphPropertyRegular":
|
|
2208
2198
|
return "Regular";
|
|
@@ -2240,11 +2230,11 @@ function to(e) {
|
|
|
2240
2230
|
return "Regular";
|
|
2241
2231
|
}
|
|
2242
2232
|
}
|
|
2243
|
-
function
|
|
2233
|
+
function Y(e) {
|
|
2244
2234
|
return e?.signal;
|
|
2245
2235
|
}
|
|
2246
|
-
async function
|
|
2247
|
-
const r = await
|
|
2236
|
+
async function Xa(e, t) {
|
|
2237
|
+
const r = await W("arcgis_knowledge_cypher_query_prompt");
|
|
2248
2238
|
return t ? `${e} ${r}
|
|
2249
2239
|
|
|
2250
2240
|
Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
|
|
@@ -2254,22 +2244,22 @@ Execution Error: ${t.executionError}
|
|
|
2254
2244
|
Failed Query:
|
|
2255
2245
|
${t.failedGraphQuery}` : `${e} ${r}`;
|
|
2256
2246
|
}
|
|
2257
|
-
async function
|
|
2258
|
-
const { graphQuery: o, explanation: n } = await
|
|
2247
|
+
async function eo(e, t, r, a) {
|
|
2248
|
+
const { graphQuery: o, explanation: n } = await ue(e, t, r, a);
|
|
2259
2249
|
return { graphQuery: o, explanation: n };
|
|
2260
2250
|
}
|
|
2261
|
-
async function
|
|
2251
|
+
async function ue(e, t, r, a, o) {
|
|
2262
2252
|
const n = {
|
|
2263
|
-
message: await
|
|
2264
|
-
context: new
|
|
2265
|
-
}, l =
|
|
2266
|
-
await
|
|
2267
|
-
const i = await
|
|
2253
|
+
message: await Xa(e, o),
|
|
2254
|
+
context: new Ka(t)
|
|
2255
|
+
}, l = Y(a);
|
|
2256
|
+
await R({ text: "Attempting to generate a cypher query from your prompt..." }, a);
|
|
2257
|
+
const i = await pe(`${r}/chat`, {
|
|
2268
2258
|
method: "post",
|
|
2269
2259
|
body: JSON.stringify(n),
|
|
2270
2260
|
headers: {
|
|
2271
2261
|
"Content-Type": "application/json",
|
|
2272
|
-
token:
|
|
2262
|
+
token: de.findCredential(k.getDefault().url)?.token ?? ""
|
|
2273
2263
|
},
|
|
2274
2264
|
signal: l
|
|
2275
2265
|
});
|
|
@@ -2281,11 +2271,11 @@ async function de(e, t, r, a, o) {
|
|
|
2281
2271
|
const u = Date.now();
|
|
2282
2272
|
let d = i.data.sequenceNumber, p = "", m = "", w = 1;
|
|
2283
2273
|
for (; !c; ) {
|
|
2284
|
-
await new Promise((y) => setTimeout(y, 1e3)), await
|
|
2274
|
+
await new Promise((y) => setTimeout(y, 1e3)), await R(
|
|
2285
2275
|
{ text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, w)}` },
|
|
2286
2276
|
a
|
|
2287
2277
|
), w = w % 3 + 1;
|
|
2288
|
-
const h = await
|
|
2278
|
+
const h = await pe(`${r}/chat`, {
|
|
2289
2279
|
method: "post",
|
|
2290
2280
|
body: JSON.stringify({
|
|
2291
2281
|
conversationId: i.data.conversationId,
|
|
@@ -2294,7 +2284,7 @@ async function de(e, t, r, a, o) {
|
|
|
2294
2284
|
}),
|
|
2295
2285
|
headers: {
|
|
2296
2286
|
"Content-Type": "application/json",
|
|
2297
|
-
token:
|
|
2287
|
+
token: de.findCredential(k.getDefault().url)?.token ?? ""
|
|
2298
2288
|
},
|
|
2299
2289
|
signal: l
|
|
2300
2290
|
});
|
|
@@ -2316,39 +2306,39 @@ async function de(e, t, r, a, o) {
|
|
|
2316
2306
|
}
|
|
2317
2307
|
return { graphQuery: p, explanation: m };
|
|
2318
2308
|
}
|
|
2319
|
-
function
|
|
2320
|
-
|
|
2309
|
+
function to(e, t) {
|
|
2310
|
+
q(e, (r) => {
|
|
2321
2311
|
t.set(`${r.typeName}__${r.id}`, {
|
|
2322
2312
|
id: r.id,
|
|
2323
2313
|
typeName: r.typeName
|
|
2324
2314
|
});
|
|
2325
2315
|
});
|
|
2326
2316
|
}
|
|
2327
|
-
function
|
|
2317
|
+
function q(e, t) {
|
|
2328
2318
|
if (!(!e || typeof e != "object")) {
|
|
2329
|
-
if (
|
|
2319
|
+
if (ao(e))
|
|
2330
2320
|
for (const r of e.path)
|
|
2331
|
-
|
|
2332
|
-
else if (
|
|
2321
|
+
q(r, t);
|
|
2322
|
+
else if (ro(e))
|
|
2333
2323
|
t(e);
|
|
2334
2324
|
else if (Array.isArray(e))
|
|
2335
2325
|
for (const r of e)
|
|
2336
|
-
|
|
2337
|
-
else if (
|
|
2326
|
+
q(r, t);
|
|
2327
|
+
else if (oo(e))
|
|
2338
2328
|
for (const r of Object.values(e.properties ?? {}))
|
|
2339
|
-
|
|
2329
|
+
q(r, t);
|
|
2340
2330
|
}
|
|
2341
2331
|
}
|
|
2342
|
-
function
|
|
2332
|
+
function ro(e) {
|
|
2343
2333
|
return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
|
|
2344
2334
|
}
|
|
2345
|
-
function
|
|
2335
|
+
function ao(e) {
|
|
2346
2336
|
return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
|
|
2347
2337
|
}
|
|
2348
|
-
function
|
|
2338
|
+
function oo(e) {
|
|
2349
2339
|
return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
|
|
2350
2340
|
}
|
|
2351
|
-
function
|
|
2341
|
+
function no(e, t) {
|
|
2352
2342
|
const r = [], a = [], o = [
|
|
2353
2343
|
[t.dataModel.entityTypes, r],
|
|
2354
2344
|
[t.dataModel.relationshipTypes, a]
|
|
@@ -2360,7 +2350,7 @@ function lo(e, t) {
|
|
|
2360
2350
|
}
|
|
2361
2351
|
return { entityIds: r, relationshipIds: a };
|
|
2362
2352
|
}
|
|
2363
|
-
function
|
|
2353
|
+
function io(e, t) {
|
|
2364
2354
|
const r = { entityIds: new Array(), relationshipIds: new Array() }, a = [], n = e?.allLayers.find((c) => c.type === "knowledge-graph")?.inclusionModeDefinition;
|
|
2365
2355
|
if (!n)
|
|
2366
2356
|
return { allNamedTypesFullyDynamic: !0, bindParameters: r, nonDynamicTypes: a };
|
|
@@ -2393,10 +2383,10 @@ function ke(e, t = 100) {
|
|
|
2393
2383
|
}
|
|
2394
2384
|
return e.properties = r, e;
|
|
2395
2385
|
}
|
|
2396
|
-
function
|
|
2386
|
+
function D(e) {
|
|
2397
2387
|
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);
|
|
2398
2388
|
}
|
|
2399
|
-
const
|
|
2389
|
+
const so = async ({
|
|
2400
2390
|
kg: e,
|
|
2401
2391
|
queryParams: t,
|
|
2402
2392
|
targetStructure: r,
|
|
@@ -2411,31 +2401,31 @@ const uo = async ({
|
|
|
2411
2401
|
};
|
|
2412
2402
|
d && (d.aborted ? u.abort(d.reason) : d.addEventListener("abort", p, { once: !0 }));
|
|
2413
2403
|
try {
|
|
2414
|
-
const m = await
|
|
2404
|
+
const m = await yt(e, t, o);
|
|
2415
2405
|
i = m.resultHeader;
|
|
2416
2406
|
const w = m.resultRowsStream.getReader();
|
|
2417
2407
|
let h = 0;
|
|
2418
2408
|
const y = Date.now(), g = !1;
|
|
2419
2409
|
for (; ; ) {
|
|
2420
|
-
const { done: b, value:
|
|
2410
|
+
const { done: b, value: x } = await w.read();
|
|
2421
2411
|
if (b)
|
|
2422
2412
|
break;
|
|
2423
2413
|
if (!g && l && Date.now() - y > l)
|
|
2424
2414
|
return u.abort(), { type: "timeout" };
|
|
2425
|
-
for (const S of
|
|
2415
|
+
for (const S of x) {
|
|
2426
2416
|
if (h++, n && h > n)
|
|
2427
2417
|
return u.abort(), { type: "success", rowLimitReached: !0, resultHeader: i, processedResult: c };
|
|
2428
2418
|
c = a(c, S);
|
|
2429
2419
|
}
|
|
2430
2420
|
}
|
|
2431
2421
|
} catch (m) {
|
|
2432
|
-
return u.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage:
|
|
2422
|
+
return u.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: D(m), error: m };
|
|
2433
2423
|
} finally {
|
|
2434
2424
|
d?.removeEventListener("abort", p);
|
|
2435
2425
|
}
|
|
2436
2426
|
return { type: "success", rowLimitReached: !1, resultHeader: i, processedResult: c };
|
|
2437
2427
|
};
|
|
2438
|
-
async function
|
|
2428
|
+
async function Ne({
|
|
2439
2429
|
prompt: e,
|
|
2440
2430
|
bindParameters: t,
|
|
2441
2431
|
kg: r,
|
|
@@ -2451,23 +2441,23 @@ async function qe({
|
|
|
2451
2441
|
for (let p = 1; p <= z; p++) {
|
|
2452
2442
|
let m;
|
|
2453
2443
|
try {
|
|
2454
|
-
m = await
|
|
2444
|
+
m = await ue(e, r.dataModel, a, u, d);
|
|
2455
2445
|
} catch (g) {
|
|
2456
2446
|
return {
|
|
2457
2447
|
type: "generation-error",
|
|
2458
|
-
errorMessage:
|
|
2448
|
+
errorMessage: D(g),
|
|
2459
2449
|
error: g
|
|
2460
2450
|
};
|
|
2461
2451
|
}
|
|
2462
|
-
await
|
|
2452
|
+
await R(
|
|
2463
2453
|
{
|
|
2464
2454
|
text: `Attempting to execute query: ${m.graphQuery.substring(0, 500)}${m.graphQuery.length > 500 ? "..." : ""}`
|
|
2465
2455
|
},
|
|
2466
2456
|
u
|
|
2467
2457
|
);
|
|
2468
|
-
const w = await
|
|
2458
|
+
const w = await lo(m.graphQuery, t), h = await so({
|
|
2469
2459
|
kg: r,
|
|
2470
|
-
queryParams: new
|
|
2460
|
+
queryParams: new Se({
|
|
2471
2461
|
openCypherQuery: m.graphQuery,
|
|
2472
2462
|
bindParameters: w
|
|
2473
2463
|
}),
|
|
@@ -2510,7 +2500,7 @@ async function qe({
|
|
|
2510
2500
|
failedGraphQuery: m.graphQuery,
|
|
2511
2501
|
executionError: y,
|
|
2512
2502
|
attemptCount: p
|
|
2513
|
-
}, await
|
|
2503
|
+
}, await R(
|
|
2514
2504
|
{ text: `Attempt ${p} failed with error: ${y}. Retrying...` },
|
|
2515
2505
|
u
|
|
2516
2506
|
);
|
|
@@ -2519,17 +2509,17 @@ async function qe({
|
|
|
2519
2509
|
`Failed to execute generated cypher due to an unexpected error after ${z} attempts.`
|
|
2520
2510
|
);
|
|
2521
2511
|
}
|
|
2522
|
-
const
|
|
2512
|
+
const lo = async (e, t) => {
|
|
2523
2513
|
if (!t)
|
|
2524
2514
|
return {};
|
|
2525
|
-
const { bindParameters: r, parseErrors: a } = await
|
|
2515
|
+
const { bindParameters: r, parseErrors: a } = await wt(e);
|
|
2526
2516
|
if (a)
|
|
2527
2517
|
return t;
|
|
2528
2518
|
const o = {};
|
|
2529
2519
|
for (const n of r)
|
|
2530
2520
|
n in t && (o[n] = t[n]);
|
|
2531
2521
|
return o;
|
|
2532
|
-
},
|
|
2522
|
+
}, co = async ({
|
|
2533
2523
|
kg: e,
|
|
2534
2524
|
searchQuery: t,
|
|
2535
2525
|
typeCategoryFilter: r,
|
|
@@ -2546,9 +2536,9 @@ const po = async (e, t) => {
|
|
|
2546
2536
|
const d = c - l.length;
|
|
2547
2537
|
if (d <= 0)
|
|
2548
2538
|
break;
|
|
2549
|
-
const w = (await
|
|
2539
|
+
const w = (await ft(
|
|
2550
2540
|
e,
|
|
2551
|
-
new
|
|
2541
|
+
new gt({
|
|
2552
2542
|
searchQuery: t,
|
|
2553
2543
|
typeCategoryFilter: u,
|
|
2554
2544
|
namedTypesFilter: a ?? void 0,
|
|
@@ -2564,12 +2554,12 @@ const po = async (e, t) => {
|
|
|
2564
2554
|
break;
|
|
2565
2555
|
}
|
|
2566
2556
|
for (const b of g)
|
|
2567
|
-
for (const
|
|
2568
|
-
l.push(
|
|
2557
|
+
for (const x of b)
|
|
2558
|
+
l.push(x);
|
|
2569
2559
|
}
|
|
2570
2560
|
}
|
|
2571
2561
|
} catch (u) {
|
|
2572
|
-
const d =
|
|
2562
|
+
const d = D(u);
|
|
2573
2563
|
return n?.signal?.aborted ? {
|
|
2574
2564
|
type: "aborted",
|
|
2575
2565
|
errorMessage: d,
|
|
@@ -2581,15 +2571,15 @@ const po = async (e, t) => {
|
|
|
2581
2571
|
results: l
|
|
2582
2572
|
};
|
|
2583
2573
|
}, Ie = "IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";
|
|
2584
|
-
async function
|
|
2574
|
+
async function qe({
|
|
2585
2575
|
prompt: e,
|
|
2586
2576
|
view: t,
|
|
2587
2577
|
knowledgeGraph: r,
|
|
2588
2578
|
includeReturnEntityAndRelationshipContext: a = !1
|
|
2589
2579
|
}) {
|
|
2590
2580
|
const o = [e];
|
|
2591
|
-
if (a && o.push(Ie), !
|
|
2592
|
-
const d = await
|
|
2581
|
+
if (a && o.push(Ie), !N(t) && t.map) {
|
|
2582
|
+
const d = await W("arcgis_knowledge_current_lc_context"), p = no(t.map, r);
|
|
2593
2583
|
return o.push(d), {
|
|
2594
2584
|
enhancedPrompt: o.join(`
|
|
2595
2585
|
|
|
@@ -2598,7 +2588,7 @@ async function De({
|
|
|
2598
2588
|
allNamedTypesFullyDynamic: !1
|
|
2599
2589
|
};
|
|
2600
2590
|
}
|
|
2601
|
-
const n = t.map, { allNamedTypesFullyDynamic: l, bindParameters: i, nonDynamicTypes: c } =
|
|
2591
|
+
const n = t.map, { allNamedTypesFullyDynamic: l, bindParameters: i, nonDynamicTypes: c } = io(
|
|
2602
2592
|
n,
|
|
2603
2593
|
r
|
|
2604
2594
|
);
|
|
@@ -2610,7 +2600,7 @@ async function De({
|
|
|
2610
2600
|
bindParameters: i,
|
|
2611
2601
|
allNamedTypesFullyDynamic: !0
|
|
2612
2602
|
};
|
|
2613
|
-
const u = (await
|
|
2603
|
+
const u = (await W("arcgis_knowledge_current_map_context")).replaceAll(
|
|
2614
2604
|
"{nonDynamicTypes}",
|
|
2615
2605
|
JSON.stringify(c)
|
|
2616
2606
|
);
|
|
@@ -2622,8 +2612,8 @@ async function De({
|
|
|
2622
2612
|
allNamedTypesFullyDynamic: l
|
|
2623
2613
|
};
|
|
2624
2614
|
}
|
|
2625
|
-
async function
|
|
2626
|
-
const { view: l } = o, i = await
|
|
2615
|
+
async function uo(e, t, r, a, o, n) {
|
|
2616
|
+
const { view: l } = o, i = await Ne({
|
|
2627
2617
|
prompt: e,
|
|
2628
2618
|
bindParameters: t,
|
|
2629
2619
|
kg: r,
|
|
@@ -2631,11 +2621,11 @@ async function ho(e, t, r, a, o, n) {
|
|
|
2631
2621
|
targetStructure: /* @__PURE__ */ new Map(),
|
|
2632
2622
|
targetStructureReducer: (m, w) => {
|
|
2633
2623
|
for (const h of w)
|
|
2634
|
-
|
|
2624
|
+
to(h, m);
|
|
2635
2625
|
return m;
|
|
2636
2626
|
},
|
|
2637
2627
|
requestOptions: {
|
|
2638
|
-
signal:
|
|
2628
|
+
signal: Y(n),
|
|
2639
2629
|
timeout: n?.timeout
|
|
2640
2630
|
},
|
|
2641
2631
|
config: n
|
|
@@ -2645,25 +2635,25 @@ async function ho(e, t, r, a, o, n) {
|
|
|
2645
2635
|
throw new Error(`Failed to add records to the link chart. ${m}`);
|
|
2646
2636
|
}
|
|
2647
2637
|
const { graphQuery: c, explanation: u, processedResult: d } = i, p = Array.from(d.values());
|
|
2648
|
-
return await
|
|
2638
|
+
return await R(
|
|
2649
2639
|
{
|
|
2650
2640
|
text: `Query Results parsed into ${p.length} unique relationships and entities. Atempting to add to link chart...`
|
|
2651
2641
|
},
|
|
2652
2642
|
n
|
|
2653
|
-
), !
|
|
2643
|
+
), !N(l) && l?.map ? (await l.map.addRecords(p), await J(l), { generatedQuery: c, explanation: u, addedIdTypePairs: p }) : (await l?.map?.allLayers.find(
|
|
2654
2644
|
(w) => w.type === "knowledge-graph"
|
|
2655
2645
|
)?.addRecords(p), { generatedQuery: c, explanation: u, addedIdTypePairs: p });
|
|
2656
2646
|
}
|
|
2657
|
-
const
|
|
2647
|
+
const V = "addRecords", po = s.object({
|
|
2658
2648
|
prompt: s.string().describe(
|
|
2659
2649
|
"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."
|
|
2660
2650
|
)
|
|
2661
|
-
}),
|
|
2662
|
-
const { knowledgeGraph: r } = await
|
|
2651
|
+
}), mo = async ({ prompt: e }, t) => {
|
|
2652
|
+
const { knowledgeGraph: r } = await O(t), a = G(t), { view: o } = a, l = k.getDefault().helperServices, {
|
|
2663
2653
|
enhancedPrompt: i,
|
|
2664
2654
|
bindParameters: c,
|
|
2665
2655
|
allNamedTypesFullyDynamic: u
|
|
2666
|
-
} = await
|
|
2656
|
+
} = await qe({
|
|
2667
2657
|
prompt: e,
|
|
2668
2658
|
view: o,
|
|
2669
2659
|
knowledgeGraph: r,
|
|
@@ -2671,7 +2661,7 @@ const W = "addRecords", yo = s.object({
|
|
|
2671
2661
|
});
|
|
2672
2662
|
if (u)
|
|
2673
2663
|
return {
|
|
2674
|
-
toolName:
|
|
2664
|
+
toolName: V,
|
|
2675
2665
|
status: "success",
|
|
2676
2666
|
summary: "No records have been added to the map because all data in the knowledge graph is contained in the map.",
|
|
2677
2667
|
details: {
|
|
@@ -2681,7 +2671,7 @@ const W = "addRecords", yo = s.object({
|
|
|
2681
2671
|
}
|
|
2682
2672
|
};
|
|
2683
2673
|
try {
|
|
2684
|
-
const { generatedQuery: d, explanation: p, addedIdTypePairs: m } = await
|
|
2674
|
+
const { generatedQuery: d, explanation: p, addedIdTypePairs: m } = await uo(
|
|
2685
2675
|
i,
|
|
2686
2676
|
c,
|
|
2687
2677
|
r,
|
|
@@ -2690,7 +2680,7 @@ const W = "addRecords", yo = s.object({
|
|
|
2690
2680
|
t
|
|
2691
2681
|
);
|
|
2692
2682
|
return {
|
|
2693
|
-
toolName:
|
|
2683
|
+
toolName: V,
|
|
2694
2684
|
status: "success",
|
|
2695
2685
|
summary: `Records added successfully. Cypher Query used: ${d}
|
|
2696
2686
|
|
|
@@ -2702,16 +2692,16 @@ Number of records added: ${m.length}`,
|
|
|
2702
2692
|
}
|
|
2703
2693
|
};
|
|
2704
2694
|
} catch (d) {
|
|
2705
|
-
const p =
|
|
2695
|
+
const p = D(d);
|
|
2706
2696
|
return {
|
|
2707
|
-
toolName:
|
|
2697
|
+
toolName: V,
|
|
2708
2698
|
status: "error",
|
|
2709
2699
|
errorMessage: `Failed to add records to the link chart. ${p}`,
|
|
2710
2700
|
error: d
|
|
2711
2701
|
};
|
|
2712
2702
|
}
|
|
2713
|
-
},
|
|
2714
|
-
name:
|
|
2703
|
+
}, si = f(mo, {
|
|
2704
|
+
name: V,
|
|
2715
2705
|
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.
|
|
2716
2706
|
|
|
2717
2707
|
example prompts:
|
|
@@ -2723,12 +2713,12 @@ Number of records added: ${m.length}`,
|
|
|
2723
2713
|
- "connect company x and company y"
|
|
2724
2714
|
- "connect all buildings on the link chart"
|
|
2725
2715
|
`,
|
|
2726
|
-
schema:
|
|
2716
|
+
schema: po
|
|
2727
2717
|
});
|
|
2728
|
-
async function
|
|
2729
|
-
return await t.map?.applyLayout(e), await
|
|
2718
|
+
async function ho(e, t) {
|
|
2719
|
+
return await t.map?.applyLayout(e), await J(t), { appliedLayout: e };
|
|
2730
2720
|
}
|
|
2731
|
-
const
|
|
2721
|
+
const te = "applyLayout", yo = s.object({
|
|
2732
2722
|
layout: s.enum([
|
|
2733
2723
|
"organic-standard",
|
|
2734
2724
|
"organic-community",
|
|
@@ -2742,19 +2732,19 @@ const re = "applyLayout", wo = s.object({
|
|
|
2742
2732
|
]).describe(
|
|
2743
2733
|
"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"
|
|
2744
2734
|
)
|
|
2745
|
-
}),
|
|
2746
|
-
const { view: r } =
|
|
2747
|
-
if (
|
|
2735
|
+
}), fo = async ({ layout: e }, t) => {
|
|
2736
|
+
const { view: r } = G(t);
|
|
2737
|
+
if (N(r))
|
|
2748
2738
|
return {
|
|
2749
|
-
toolName:
|
|
2739
|
+
toolName: te,
|
|
2750
2740
|
status: "error",
|
|
2751
2741
|
errorMessage: "The applyLayout tool can only be used with a LinkChartView.",
|
|
2752
2742
|
error: new Error()
|
|
2753
2743
|
};
|
|
2754
2744
|
{
|
|
2755
|
-
const { appliedLayout: a } = await
|
|
2745
|
+
const { appliedLayout: a } = await ho(e, r);
|
|
2756
2746
|
return {
|
|
2757
|
-
toolName:
|
|
2747
|
+
toolName: te,
|
|
2758
2748
|
status: "success",
|
|
2759
2749
|
summary: `Successfully applied layout: ${a}.`,
|
|
2760
2750
|
details: {
|
|
@@ -2762,29 +2752,29 @@ const re = "applyLayout", wo = s.object({
|
|
|
2762
2752
|
}
|
|
2763
2753
|
};
|
|
2764
2754
|
}
|
|
2765
|
-
},
|
|
2766
|
-
name:
|
|
2755
|
+
}, li = f(fo, {
|
|
2756
|
+
name: te,
|
|
2767
2757
|
description: "Apply a diagram layout to the link chart",
|
|
2768
|
-
schema:
|
|
2758
|
+
schema: yo
|
|
2769
2759
|
});
|
|
2770
|
-
async function
|
|
2771
|
-
return t.map?.changeNonspatialDataDisplay(e), await
|
|
2760
|
+
async function go(e, t) {
|
|
2761
|
+
return t.map?.changeNonspatialDataDisplay(e), await J(t), { appliedNonspatialDataDisplayMode: e };
|
|
2772
2762
|
}
|
|
2773
|
-
const
|
|
2763
|
+
const re = "changeNonspatialVisibility", wo = s.object({
|
|
2774
2764
|
setting: s.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
|
|
2775
|
-
}),
|
|
2776
|
-
const { view: r } =
|
|
2777
|
-
if (
|
|
2765
|
+
}), bo = async ({ setting: e }, t) => {
|
|
2766
|
+
const { view: r } = G(t);
|
|
2767
|
+
if (N(r))
|
|
2778
2768
|
return {
|
|
2779
|
-
toolName:
|
|
2769
|
+
toolName: re,
|
|
2780
2770
|
status: "error",
|
|
2781
2771
|
errorMessage: "The changeNonspatialVisibility tool can only be used with a LinkChartView.",
|
|
2782
2772
|
error: new Error()
|
|
2783
2773
|
};
|
|
2784
2774
|
{
|
|
2785
|
-
const { appliedNonspatialDataDisplayMode: a } = await
|
|
2775
|
+
const { appliedNonspatialDataDisplayMode: a } = await go(e, r);
|
|
2786
2776
|
return {
|
|
2787
|
-
toolName:
|
|
2777
|
+
toolName: re,
|
|
2788
2778
|
status: "success",
|
|
2789
2779
|
summary: `Successfully applied nonspatial visibility setting: ${a}.`,
|
|
2790
2780
|
details: {
|
|
@@ -2792,15 +2782,15 @@ const ae = "changeNonspatialVisibility", So = s.object({
|
|
|
2792
2782
|
}
|
|
2793
2783
|
};
|
|
2794
2784
|
}
|
|
2795
|
-
},
|
|
2796
|
-
name:
|
|
2785
|
+
}, ci = f(bo, {
|
|
2786
|
+
name: re,
|
|
2797
2787
|
description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
|
|
2798
|
-
schema:
|
|
2788
|
+
schema: wo
|
|
2799
2789
|
});
|
|
2800
|
-
async function
|
|
2790
|
+
async function To(e, t, r, a, o) {
|
|
2801
2791
|
let n, l = "";
|
|
2802
2792
|
for (let i = 1; i <= z; i++) {
|
|
2803
|
-
const { graphQuery: c, explanation: u } = await
|
|
2793
|
+
const { graphQuery: c, explanation: u } = await ue(
|
|
2804
2794
|
e,
|
|
2805
2795
|
t.dataModel,
|
|
2806
2796
|
r,
|
|
@@ -2808,28 +2798,28 @@ async function xo(e, t, r, a, o) {
|
|
|
2808
2798
|
n
|
|
2809
2799
|
);
|
|
2810
2800
|
try {
|
|
2811
|
-
await
|
|
2812
|
-
const d = await
|
|
2801
|
+
await R({ text: `Attempting to create link chart from derived query: ${c}` }, o);
|
|
2802
|
+
const d = await ht.fromCypherQuery(
|
|
2813
2803
|
t,
|
|
2814
|
-
new
|
|
2804
|
+
new Se({
|
|
2815
2805
|
openCypherQuery: c
|
|
2816
2806
|
})
|
|
2817
2807
|
);
|
|
2818
|
-
await
|
|
2808
|
+
await R({ text: "Link chart created successfully, loading..." }, o), await d.load();
|
|
2819
2809
|
const p = a.map;
|
|
2820
|
-
return a.map = d, await a.when(), await
|
|
2810
|
+
return a.map = d, await a.when(), await Pe.whenOnce(() => !a.updating), d.entityCount === 0 && d.relationshipCount === 0 ? (a.map === d && (a.map = p), d.destroy(), {
|
|
2821
2811
|
type: "error",
|
|
2822
2812
|
errorMessage: `Query returned no results. Cypher Query used to create the link chart:
|
|
2823
2813
|
${c}
|
|
2824
2814
|
|
|
2825
2815
|
Explanation: ${u}`
|
|
2826
|
-
}) : (await
|
|
2816
|
+
}) : (await J(a), {
|
|
2827
2817
|
type: "success",
|
|
2828
2818
|
graphQuery: c,
|
|
2829
2819
|
explanation: u
|
|
2830
2820
|
});
|
|
2831
2821
|
} catch (d) {
|
|
2832
|
-
const p =
|
|
2822
|
+
const p = D(d);
|
|
2833
2823
|
if (i >= z) {
|
|
2834
2824
|
l = p;
|
|
2835
2825
|
break;
|
|
@@ -2838,7 +2828,7 @@ Explanation: ${u}`
|
|
|
2838
2828
|
failedGraphQuery: c,
|
|
2839
2829
|
executionError: p,
|
|
2840
2830
|
attemptCount: i
|
|
2841
|
-
}, await
|
|
2831
|
+
}, await R(
|
|
2842
2832
|
{ text: `Attempt ${i} to create link chart failed with error: ${p}. Retrying ...` },
|
|
2843
2833
|
o
|
|
2844
2834
|
);
|
|
@@ -2849,21 +2839,21 @@ Explanation: ${u}`
|
|
|
2849
2839
|
errorMessage: `Failed to create link chart after ${z} attempts. Last error: ${l}`
|
|
2850
2840
|
};
|
|
2851
2841
|
}
|
|
2852
|
-
const
|
|
2842
|
+
const _ = "createLinkChart", So = s.object({
|
|
2853
2843
|
prompt: s.string().describe(
|
|
2854
2844
|
"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."
|
|
2855
2845
|
)
|
|
2856
|
-
}),
|
|
2857
|
-
const { knowledgeGraph: r } = await
|
|
2858
|
-
if (
|
|
2846
|
+
}), vo = async ({ prompt: e }, t) => {
|
|
2847
|
+
const { knowledgeGraph: r } = await O(t), { view: a } = G(t);
|
|
2848
|
+
if (N(a))
|
|
2859
2849
|
return {
|
|
2860
|
-
toolName:
|
|
2850
|
+
toolName: _,
|
|
2861
2851
|
status: "error",
|
|
2862
2852
|
errorMessage: "The createLinkChart tool can only be used with a LinkChartView.",
|
|
2863
2853
|
error: new Error()
|
|
2864
2854
|
};
|
|
2865
2855
|
{
|
|
2866
|
-
const n =
|
|
2856
|
+
const n = k.getDefault().helperServices, l = await To(
|
|
2867
2857
|
`${e}
|
|
2868
2858
|
|
|
2869
2859
|
${Ie}`,
|
|
@@ -2874,14 +2864,14 @@ ${Ie}`,
|
|
|
2874
2864
|
);
|
|
2875
2865
|
if (l.type === "error")
|
|
2876
2866
|
return {
|
|
2877
|
-
toolName:
|
|
2867
|
+
toolName: _,
|
|
2878
2868
|
status: "error",
|
|
2879
2869
|
errorMessage: l.errorMessage,
|
|
2880
2870
|
error: new Error()
|
|
2881
2871
|
};
|
|
2882
2872
|
const { graphQuery: i, explanation: c } = l;
|
|
2883
2873
|
return {
|
|
2884
|
-
toolName:
|
|
2874
|
+
toolName: _,
|
|
2885
2875
|
status: "success",
|
|
2886
2876
|
summary: `Link chart created successfully. Cypher Query used to create the link chart:
|
|
2887
2877
|
${i}
|
|
@@ -2893,28 +2883,28 @@ Explanation: ${c}`,
|
|
|
2893
2883
|
}
|
|
2894
2884
|
};
|
|
2895
2885
|
}
|
|
2896
|
-
},
|
|
2897
|
-
name:
|
|
2886
|
+
}, ui = f(vo, {
|
|
2887
|
+
name: _,
|
|
2898
2888
|
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'.",
|
|
2899
|
-
schema:
|
|
2900
|
-
}),
|
|
2889
|
+
schema: So
|
|
2890
|
+
}), ae = "queryGraphData", xo = s.object({
|
|
2901
2891
|
prompt: s.string().describe(
|
|
2902
2892
|
"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."
|
|
2903
2893
|
)
|
|
2904
|
-
}),
|
|
2905
|
-
const { knowledgeGraph: r } = await
|
|
2894
|
+
}), Ro = async ({ prompt: e }, t) => {
|
|
2895
|
+
const { knowledgeGraph: r } = await O(t), o = k.getDefault().helperServices;
|
|
2906
2896
|
let n = e, l = null, i = null;
|
|
2907
2897
|
try {
|
|
2908
|
-
({ view: i } =
|
|
2898
|
+
({ view: i } = G(t));
|
|
2909
2899
|
} catch {
|
|
2910
2900
|
}
|
|
2911
|
-
i && ({ enhancedPrompt: n, bindParameters: l } = await
|
|
2901
|
+
i && ({ enhancedPrompt: n, bindParameters: l } = await qe({
|
|
2912
2902
|
prompt: e,
|
|
2913
2903
|
view: i,
|
|
2914
2904
|
knowledgeGraph: r,
|
|
2915
2905
|
includeReturnEntityAndRelationshipContext: !1
|
|
2916
2906
|
}));
|
|
2917
|
-
const c = await
|
|
2907
|
+
const c = await Ne({
|
|
2918
2908
|
prompt: n,
|
|
2919
2909
|
bindParameters: l,
|
|
2920
2910
|
kg: r,
|
|
@@ -2922,7 +2912,7 @@ Explanation: ${c}`,
|
|
|
2922
2912
|
targetStructure: new Array(),
|
|
2923
2913
|
targetStructureReducer: (g, b) => (g.push(b), g),
|
|
2924
2914
|
requestOptions: {
|
|
2925
|
-
signal:
|
|
2915
|
+
signal: Y(t),
|
|
2926
2916
|
timeout: t?.timeout
|
|
2927
2917
|
},
|
|
2928
2918
|
config: t
|
|
@@ -2930,7 +2920,7 @@ Explanation: ${c}`,
|
|
|
2930
2920
|
if (c.type !== "success") {
|
|
2931
2921
|
const g = c.type === "generation-error" ? c.errorMessage : `${c.errorMessage} Cypher query: ${c.graphQuery}`;
|
|
2932
2922
|
return {
|
|
2933
|
-
toolName:
|
|
2923
|
+
toolName: ae,
|
|
2934
2924
|
status: "error",
|
|
2935
2925
|
errorMessage: `Failed to query the knowledge graph. ${g}`,
|
|
2936
2926
|
error: "error" in c ? c.error : null
|
|
@@ -2939,13 +2929,13 @@ Explanation: ${c}`,
|
|
|
2939
2929
|
const { graphQuery: u, explanation: d, processedResult: p, resultHeader: m } = c, w = m.headerKeys;
|
|
2940
2930
|
for (const g of p)
|
|
2941
2931
|
for (const b of g)
|
|
2942
|
-
|
|
2932
|
+
q(
|
|
2943
2933
|
b,
|
|
2944
|
-
(
|
|
2934
|
+
(x) => ke(x)
|
|
2945
2935
|
);
|
|
2946
2936
|
const h = 50, y = p.slice(0, h).map((g) => JSON.stringify(g));
|
|
2947
2937
|
return {
|
|
2948
|
-
toolName:
|
|
2938
|
+
toolName: ae,
|
|
2949
2939
|
status: "success",
|
|
2950
2940
|
summary: `To answer the inquiry, the following cypher query was executed against the knowledge graph:
|
|
2951
2941
|
|
|
@@ -2972,23 +2962,23 @@ ${y.length > h ? `Showing top ${h} results:
|
|
|
2972
2962
|
queryResults: p
|
|
2973
2963
|
}
|
|
2974
2964
|
};
|
|
2975
|
-
},
|
|
2976
|
-
name:
|
|
2965
|
+
}, di = f(Ro, {
|
|
2966
|
+
name: ae,
|
|
2977
2967
|
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?'.",
|
|
2978
|
-
schema:
|
|
2979
|
-
}),
|
|
2968
|
+
schema: xo
|
|
2969
|
+
}), oe = "generateCypher", $o = s.object({
|
|
2980
2970
|
prompt: s.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
|
|
2981
|
-
}),
|
|
2982
|
-
const { knowledgeGraph: r } = await
|
|
2971
|
+
}), Co = async ({ prompt: e }, t) => {
|
|
2972
|
+
const { knowledgeGraph: r } = await O(t), o = k.getDefault().helperServices;
|
|
2983
2973
|
try {
|
|
2984
|
-
const { graphQuery: n, explanation: l } = await
|
|
2974
|
+
const { graphQuery: n, explanation: l } = await eo(
|
|
2985
2975
|
e,
|
|
2986
2976
|
r.dataModel,
|
|
2987
2977
|
`${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
|
|
2988
2978
|
t
|
|
2989
2979
|
);
|
|
2990
2980
|
return {
|
|
2991
|
-
toolName:
|
|
2981
|
+
toolName: oe,
|
|
2992
2982
|
status: "success",
|
|
2993
2983
|
summary: `Generated Graph Query:
|
|
2994
2984
|
${n}
|
|
@@ -3000,19 +2990,19 @@ Explanation: ${l}`,
|
|
|
3000
2990
|
}
|
|
3001
2991
|
};
|
|
3002
2992
|
} catch (n) {
|
|
3003
|
-
const l =
|
|
2993
|
+
const l = D(n);
|
|
3004
2994
|
return {
|
|
3005
|
-
toolName:
|
|
2995
|
+
toolName: oe,
|
|
3006
2996
|
status: "error",
|
|
3007
2997
|
errorMessage: `Failed to generate Cypher query. ${l}`,
|
|
3008
2998
|
error: n
|
|
3009
2999
|
};
|
|
3010
3000
|
}
|
|
3011
|
-
},
|
|
3012
|
-
name:
|
|
3001
|
+
}, pi = f(Co, {
|
|
3002
|
+
name: oe,
|
|
3013
3003
|
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.",
|
|
3014
|
-
schema:
|
|
3015
|
-
}),
|
|
3004
|
+
schema: $o
|
|
3005
|
+
}), Eo = (e) => {
|
|
3016
3006
|
const t = e.dataModel, r = /* @__PURE__ */ new Map();
|
|
3017
3007
|
for (const i of t.searchIndexes)
|
|
3018
3008
|
if (i.supportedCategory !== "esriTypeMetaEntityProvenance")
|
|
@@ -3029,10 +3019,10 @@ ${o.map(({ name: i }) => `${i}: [${Array.from(r.get(i) ?? []).join(", ")}]`).joi
|
|
|
3029
3019
|
|
|
3030
3020
|
${l}`;
|
|
3031
3021
|
};
|
|
3032
|
-
async function
|
|
3033
|
-
const a = await
|
|
3022
|
+
async function Fo(e, t, r) {
|
|
3023
|
+
const a = await W("arcgis_knowledge_lucene_generation_prompt"), o = {
|
|
3034
3024
|
inquiry: e,
|
|
3035
|
-
dataModelForSearch:
|
|
3025
|
+
dataModelForSearch: Eo(t)
|
|
3036
3026
|
}, 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(
|
|
3037
3027
|
"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."
|
|
3038
3028
|
), i = s.array(
|
|
@@ -3047,48 +3037,48 @@ async function qo(e, t, r) {
|
|
|
3047
3037
|
typeCategoryFilter: n,
|
|
3048
3038
|
resultLimit: l
|
|
3049
3039
|
});
|
|
3050
|
-
return await
|
|
3040
|
+
return await De({
|
|
3051
3041
|
promptText: a,
|
|
3052
3042
|
inputVariables: o,
|
|
3053
3043
|
schema: c,
|
|
3054
3044
|
config: r
|
|
3055
3045
|
});
|
|
3056
3046
|
}
|
|
3057
|
-
const
|
|
3047
|
+
const ne = "searchGraphData", ko = s.object({
|
|
3058
3048
|
prompt: s.string().describe(
|
|
3059
3049
|
"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."
|
|
3060
3050
|
)
|
|
3061
|
-
}),
|
|
3062
|
-
const { knowledgeGraph: r } = await
|
|
3063
|
-
await
|
|
3064
|
-
const a = await
|
|
3065
|
-
await
|
|
3066
|
-
const o = await
|
|
3051
|
+
}), No = async ({ prompt: e }, t) => {
|
|
3052
|
+
const { knowledgeGraph: r } = await O(t);
|
|
3053
|
+
await R({ text: "Generating search query for the user inquiry" }, t);
|
|
3054
|
+
const a = await Fo(e, r, t);
|
|
3055
|
+
await R({ text: "Executing graph search with generated search query" }, t);
|
|
3056
|
+
const o = await co({
|
|
3067
3057
|
kg: r,
|
|
3068
3058
|
searchQuery: a.query,
|
|
3069
3059
|
typeCategoryFilter: a.typeCategoryFilter,
|
|
3070
3060
|
namedTypesFilter: a.typeFilters,
|
|
3071
3061
|
searchResultLimit: a.resultLimit,
|
|
3072
3062
|
requestOptions: {
|
|
3073
|
-
signal:
|
|
3063
|
+
signal: Y(t),
|
|
3074
3064
|
timeout: t?.timeout
|
|
3075
3065
|
}
|
|
3076
3066
|
});
|
|
3077
3067
|
if (o.type !== "success")
|
|
3078
3068
|
return {
|
|
3079
|
-
toolName:
|
|
3069
|
+
toolName: ne,
|
|
3080
3070
|
status: "error",
|
|
3081
3071
|
errorMessage: o.errorMessage,
|
|
3082
3072
|
error: "error" in o ? o.error : null
|
|
3083
3073
|
};
|
|
3084
3074
|
for (const i of o.results)
|
|
3085
|
-
|
|
3075
|
+
q(
|
|
3086
3076
|
i,
|
|
3087
3077
|
(c) => ke(c)
|
|
3088
3078
|
);
|
|
3089
3079
|
const n = 10, l = o.results.slice(0, n);
|
|
3090
3080
|
return {
|
|
3091
|
-
toolName:
|
|
3081
|
+
toolName: ne,
|
|
3092
3082
|
status: "success",
|
|
3093
3083
|
summary: `To answer the query, the following lucene query was generated and executed:
|
|
3094
3084
|
Query: ${a.query}
|
|
@@ -3107,8 +3097,8 @@ const ie = "searchGraphData", Io = s.object({
|
|
|
3107
3097
|
searchResults: o.results
|
|
3108
3098
|
}
|
|
3109
3099
|
};
|
|
3110
|
-
},
|
|
3111
|
-
name:
|
|
3100
|
+
}, mi = f(No, {
|
|
3101
|
+
name: ne,
|
|
3112
3102
|
description: `
|
|
3113
3103
|
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.
|
|
3114
3104
|
Example prompts:
|
|
@@ -3119,53 +3109,52 @@ const ie = "searchGraphData", Io = s.object({
|
|
|
3119
3109
|
- "Find all reports authored by someone with the title of 'Researcher'"
|
|
3120
3110
|
- "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".
|
|
3121
3111
|
- "Search for all john smiths and show their global ids`,
|
|
3122
|
-
schema:
|
|
3112
|
+
schema: ko
|
|
3123
3113
|
});
|
|
3124
3114
|
export {
|
|
3125
|
-
|
|
3115
|
+
Qn as A,
|
|
3126
3116
|
Vn as B,
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
|
|
3149
|
-
|
|
3150
|
-
|
|
3151
|
-
|
|
3152
|
-
|
|
3153
|
-
|
|
3154
|
-
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
zn as
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
|
-
|
|
3164
|
-
|
|
3165
|
-
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
_n as z
|
|
3117
|
+
_n as C,
|
|
3118
|
+
Wn as D,
|
|
3119
|
+
Bn as E,
|
|
3120
|
+
Un as F,
|
|
3121
|
+
ce as G,
|
|
3122
|
+
ai as H,
|
|
3123
|
+
Kn as I,
|
|
3124
|
+
Hn as J,
|
|
3125
|
+
Jn as K,
|
|
3126
|
+
Yn as L,
|
|
3127
|
+
Zn as M,
|
|
3128
|
+
Nn as N,
|
|
3129
|
+
ei as O,
|
|
3130
|
+
ti as P,
|
|
3131
|
+
_a as Q,
|
|
3132
|
+
Xn as R,
|
|
3133
|
+
ri as S,
|
|
3134
|
+
li as a,
|
|
3135
|
+
pi as b,
|
|
3136
|
+
ci as c,
|
|
3137
|
+
ui as d,
|
|
3138
|
+
si as e,
|
|
3139
|
+
ve as f,
|
|
3140
|
+
W as g,
|
|
3141
|
+
ii as h,
|
|
3142
|
+
O as i,
|
|
3143
|
+
ni as j,
|
|
3144
|
+
In as k,
|
|
3145
|
+
oi as l,
|
|
3146
|
+
qn as m,
|
|
3147
|
+
zn as n,
|
|
3148
|
+
Dn as o,
|
|
3149
|
+
Pn as p,
|
|
3150
|
+
di as q,
|
|
3151
|
+
On as r,
|
|
3152
|
+
mi as s,
|
|
3153
|
+
Bt as t,
|
|
3154
|
+
An as u,
|
|
3155
|
+
Ln as v,
|
|
3156
|
+
jn as w,
|
|
3157
|
+
Gn as x,
|
|
3158
|
+
v as y,
|
|
3159
|
+
Mn as z
|
|
3171
3160
|
};
|