@arcgis/ai-components 6.0.0-next.0 → 6.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-utils/LLMAgent.d.ts +9 -2
- package/dist/agent-utils/LLMAgent.js +45 -36
- package/dist/agent-utils/tools/FunctionTool.d.ts +12 -1
- package/dist/agent-utils/tools/FunctionTool.js +15 -14
- package/dist/agent-utils/tools/MCPToolProvider.d.ts +54 -0
- package/dist/agent-utils/tools/MCPToolProvider.js +120 -0
- package/dist/agent-utils/tools/ToolProvider.d.ts +13 -0
- package/dist/agent-utils/tools/WebMCPToolProvider.d.ts +37 -0
- package/dist/agent-utils/tools/WebMCPToolProvider.js +71 -0
- package/dist/agents/tools/query/getAttribute/adapter.js +28 -24
- package/dist/agents/tools/query/getStatistics/adapter.js +70 -66
- package/dist/agents/tools/query/getTopFeatures/adapter.js +74 -70
- package/dist/agents/tools/query/queryFeatures/adapter.js +40 -36
- package/dist/cdn/{3HV6OXCZ.js → 24TK55FP.js} +1 -1
- package/dist/cdn/{4OLV5LA7.js → 2DWN3SKH.js} +1 -1
- package/dist/cdn/2O52MJ3D.js +2 -0
- package/dist/cdn/2UDDCWNW.js +2 -0
- package/dist/cdn/5FDBJI24.js +5 -0
- package/dist/cdn/5LA77ZBW.js +2 -0
- package/dist/cdn/{SBIYXWXZ.js → 5REENYPV.js} +1 -1
- package/dist/cdn/{V6AQFRUC.js → 5TW2NFES.js} +1 -1
- package/dist/cdn/{RBRHDEOB.js → 66VWTARH.js} +1 -1
- package/dist/cdn/6E6T6U7W.js +2 -0
- package/dist/cdn/{KKXOSV62.js → 6PK2UPG3.js} +1 -1
- package/dist/cdn/{OFM2S6U7.js → 6WYVG3JI.js} +1 -1
- package/dist/cdn/7HVIVV3O.js +2 -0
- package/dist/cdn/{U53SVXZK.js → 7MCFHVEH.js} +1 -1
- package/dist/cdn/{XI4BPYGB.js → 7X22QXJP.js} +1 -1
- package/dist/cdn/{EU6YSCZL.js → 7ZTYHZIN.js} +1 -1
- package/dist/cdn/A22375P3.js +2 -0
- package/dist/cdn/{2XXM52PS.js → AMP43OT2.js} +1 -1
- package/dist/cdn/{TTPTZBCM.js → AMURN3LO.js} +1 -1
- package/dist/cdn/AO2G4EXA.js +2 -0
- package/dist/cdn/{6GQCLDLJ.js → AQF6BBWC.js} +1 -1
- package/dist/cdn/AWPLRVPS.js +2 -0
- package/dist/cdn/{W3ZLMBEE.js → BBB5EJUB.js} +1 -1
- package/dist/cdn/{Q6PCXSZT.js → BMPBJXD7.js} +1 -1
- package/dist/cdn/{ZBRZU4XB.js → C67KQCPS.js} +1 -1
- package/dist/cdn/C76HLPKU.js +2 -0
- package/dist/cdn/{FFWPUYGD.js → CDS2HGQY.js} +1 -1
- package/dist/cdn/CHHC6YNW.js +2 -0
- package/dist/cdn/DBRBT54R.js +2 -0
- package/dist/cdn/{NN6MELJ7.js → DGCWQYN3.js} +1 -1
- package/dist/cdn/{IEAHAC6B.js → DI3VGUJY.js} +1 -1
- package/dist/cdn/{B4C7NIB5.js → DJG6DBCU.js} +2 -2
- package/dist/cdn/DJKEGIQZ.js +2 -0
- package/dist/cdn/{T2FKFOHE.js → DZOQFEOB.js} +1 -1
- package/dist/cdn/{AMFZY5QK.js → EEHDAYOG.js} +1 -1
- package/dist/cdn/{YO3L3XIH.js → EG5BMYZO.js} +1 -1
- package/dist/cdn/EGSD465U.js +2 -0
- package/dist/cdn/{ZMMUAYDN.js → EXLDRGUC.js} +1 -1
- package/dist/cdn/{WVMQ3I6F.js → FBARYPZ7.js} +1 -1
- package/dist/cdn/{M7TMD2HP.js → FJV7CI7O.js} +1 -1
- package/dist/cdn/{TRZJYWEB.js → FSLPYC4Y.js} +2 -2
- package/dist/cdn/{W6TS2TIE.js → GBFRJF4F.js} +1 -1
- package/dist/cdn/{7DRHB24Z.js → GHFOAS7T.js} +1 -1
- package/dist/cdn/HC5DJL2U.js +3 -0
- package/dist/cdn/HLWG7OIR.js +2 -0
- package/dist/cdn/{V7ERVXIO.js → HSMAXOOA.js} +1 -1
- package/dist/cdn/HWIM4KWF.js +2 -0
- package/dist/cdn/{VVWKEN53.js → JEWJ4M25.js} +1 -1
- package/dist/cdn/{I5OBL24F.js → JFL5IWPK.js} +1 -1
- package/dist/cdn/JUPTVXLY.js +2 -0
- package/dist/cdn/{B2JRBDJZ.js → JZPPP4QY.js} +1 -1
- package/dist/cdn/KKWCHNYQ.js +2 -0
- package/dist/cdn/{I7PHDOEQ.js → KX6CZEVZ.js} +1 -1
- package/dist/cdn/{XJUYG2M3.js → KY7M4WHO.js} +1 -1
- package/dist/cdn/L5IPMRHC.js +2 -0
- package/dist/cdn/M2G44RTS.js +2 -0
- package/dist/cdn/{H7WJUUJT.js → M6JQGHCE.js} +1 -1
- package/dist/cdn/MB7SEHPZ.js +2 -0
- package/dist/cdn/MC2V5WT3.js +2 -0
- package/dist/cdn/{ZBBI5M2X.js → MD2FTKQT.js} +1 -1
- package/dist/cdn/{645SDZBB.js → MPQ2OZXN.js} +1 -1
- package/dist/cdn/MZFWD5CQ.js +2 -0
- package/dist/cdn/{7OQA4GCM.js → NHWT7CXX.js} +1 -1
- package/dist/cdn/NMFEXE4D.js +2 -0
- package/dist/cdn/{MQSOVP27.js → NPV4MEAZ.js} +1 -1
- package/dist/cdn/{ENVTUTY6.js → OGZFST2A.js} +1 -1
- package/dist/cdn/P4CHI7W3.js +9 -0
- package/dist/cdn/{TPMZRJEC.js → PCAMBPOA.js} +1 -1
- package/dist/cdn/{O62IJLTZ.js → PGH7POKS.js} +1 -1
- package/dist/cdn/{37EJSNE3.js → PGUEODFA.js} +1 -1
- package/dist/cdn/{QJOO6IIX.js → QEGO4B2W.js} +1 -1
- package/dist/cdn/{FXRZCD5Y.js → QT3B5K4R.js} +1 -1
- package/dist/cdn/{2FUTKTNO.js → RE7MJTEF.js} +1 -1
- package/dist/cdn/RF6HWZMB.js +2 -0
- package/dist/cdn/{DWMZ23QK.js → RFDMNYTA.js} +1 -1
- package/dist/cdn/{OJP56R5R.js → RFPTOFM4.js} +1 -1
- package/dist/cdn/RKURZ5T2.js +2 -0
- package/dist/cdn/SJ4UMNIS.js +2 -0
- package/dist/cdn/{U3ZTF2BC.js → SWXUQFB6.js} +1 -1
- package/dist/cdn/{KJZVYKWL.js → T3SCINN5.js} +1 -1
- package/dist/cdn/{W3OJTTVX.js → TENUVOFJ.js} +1 -1
- package/dist/cdn/{UPSFL6U3.js → TJBU5BQK.js} +1 -1
- package/dist/cdn/UOKYHQNO.js +2 -0
- package/dist/cdn/UQRBY7ID.js +11 -0
- package/dist/cdn/{ZS5P7NRI.js → USPB2QBX.js} +1 -1
- package/dist/cdn/{ZKDCEL6K.js → UYP5PH5E.js} +1 -1
- package/dist/cdn/V6EX4YCY.js +2 -0
- package/dist/cdn/VA4M72JC.js +2 -0
- package/dist/cdn/VQ67NANV.js +2 -0
- package/dist/cdn/{2ZH5JNHL.js → X5ET73QZ.js} +1 -1
- package/dist/cdn/{DXCDVRGL.js → XC3T3Z5R.js} +1 -1
- package/dist/cdn/{J37GSI7C.js → XCLICBG7.js} +1 -1
- package/dist/cdn/XEJFVUNQ.js +2 -0
- package/dist/cdn/{EXIA3APU.js → XWNZMKQF.js} +1 -1
- package/dist/cdn/{UYEF3IKE.js → YBWRFVA6.js} +1 -1
- package/dist/cdn/YI6NIHNI.js +14 -0
- package/dist/cdn/{MHUEU6MR.js → YJXRCO4T.js} +1 -1
- package/dist/cdn/{2GSHUAQ2.js → YPLPDUMB.js} +1 -1
- package/dist/cdn/{YOQCQAKT.js → ZKWXHSEQ.js} +1 -1
- package/dist/cdn/{HWNPZ4CF.js → ZSLHB6MF.js} +1 -1
- package/dist/cdn/agent-utils/BaseAgent.js +1 -1
- package/dist/cdn/agent-utils/FunctionAgent.js +1 -1
- package/dist/cdn/agent-utils/LLMAgent.js +1 -1
- package/dist/cdn/agent-utils/SkillAgent.js +1 -1
- package/dist/cdn/agent-utils/WorkflowAgent.js +1 -1
- package/dist/cdn/agent-utils/createSchema.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/agent-utils/tools/FunctionTool.js +1 -1
- package/dist/cdn/agent-utils/tools/MCPToolProvider.js +15 -0
- package/dist/cdn/agent-utils/tools/WebMCPToolProvider.js +2 -0
- package/dist/cdn/agent-utils/workflows/ConditionalWorkflow.js +1 -1
- package/dist/cdn/agent-utils/workflows/LoopWorkflow.js +1 -1
- package/dist/cdn/agent-utils/workflows/ParallelWorkflow.js +1 -1
- package/dist/cdn/agent-utils/workflows/RouterWorkflow.js +1 -1
- package/dist/cdn/agent-utils/workflows/SequentialWorkflow.js +1 -1
- package/dist/cdn/agent-utils/workflows/SwitchWorkflow.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/orchestrator/embeddings/getEmbeddings.js +1 -1
- package/dist/cdn/orchestrator/models/chatModel.js +1 -1
- package/dist/cdn/orchestrator/models/prompts.js +1 -1
- package/dist/cdn/orchestrator/state/runtime.js +1 -1
- package/dist/chunks/converterUtils.js +65 -109
- package/dist/chunks/resolveFieldNames.js +9 -0
- package/dist/components/arcgis-assistant-message-log/customElement.js +4 -5
- package/dist/components/arcgis-assistant-message-log/index.js +5 -0
- package/dist/components/arcgis-assistant-message-text/customElement.js +10 -11
- package/dist/components/arcgis-assistant-message-text/index.js +5 -0
- package/dist/components/arcgis-assistant-user-message/customElement.js +7 -8
- package/dist/components/arcgis-assistant-user-message/index.js +5 -0
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/package.json +8 -5
- package/dist/cdn/25CQLMB4.js +0 -2
- package/dist/cdn/34HKOU3T.js +0 -2
- package/dist/cdn/3WS4DSWD.js +0 -2
- package/dist/cdn/43OJZMBB.js +0 -2
- package/dist/cdn/4BRIOLDJ.js +0 -2
- package/dist/cdn/4ZPGFIE2.js +0 -2
- package/dist/cdn/6JCDY4FL.js +0 -2
- package/dist/cdn/7GQCNR4P.js +0 -11
- package/dist/cdn/A3KIOUWB.js +0 -2
- package/dist/cdn/BKKLQUK2.js +0 -2
- package/dist/cdn/DQRKGYR3.js +0 -2
- package/dist/cdn/EOSKJPQV.js +0 -2
- package/dist/cdn/F7VQ3WH2.js +0 -2
- package/dist/cdn/FBIPIDP7.js +0 -2
- package/dist/cdn/GOET2CH4.js +0 -2
- package/dist/cdn/ISDNOFHU.js +0 -3
- package/dist/cdn/JZS6ZSWH.js +0 -2
- package/dist/cdn/KEBMHD4R.js +0 -9
- package/dist/cdn/KPHHXMRK.js +0 -2
- package/dist/cdn/LVSIZRTB.js +0 -2
- package/dist/cdn/QQPVN5MG.js +0 -2
- package/dist/cdn/REE4K4J7.js +0 -2
- package/dist/cdn/RFKOCMMT.js +0 -2
- package/dist/cdn/RKHDRUX5.js +0 -2
- package/dist/cdn/TGI7QCB2.js +0 -2
- package/dist/cdn/UALF45Q2.js +0 -2
- package/dist/cdn/WB5AFS42.js +0 -2
- package/dist/cdn/WC6SHIEX.js +0 -2
- package/dist/cdn/XPSPAZUD.js +0 -2
- package/dist/cdn/YAUQJ6NV.js +0 -2
- package/dist/cdn/YD3DLETZ.js +0 -2
- package/dist/cdn/YKKIJTJY.js +0 -2
- package/dist/cdn/ZCNCYKXW.js +0 -14
- package/dist/cdn/ZESTW6HJ.js +0 -2
|
@@ -1,31 +1,35 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { tool as
|
|
2
|
+
import { tool as E } from "@langchain/core/tools";
|
|
3
3
|
import t from "zod";
|
|
4
|
-
import
|
|
4
|
+
import N from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
|
|
5
5
|
import R from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
|
|
6
6
|
import V from "@arcgis/core/layers/support/FeatureFilter.js";
|
|
7
|
-
import { c as x, m as
|
|
8
|
-
import { g as O, i as
|
|
9
|
-
import {
|
|
10
|
-
import { f as
|
|
7
|
+
import { c as x, m as S } from "../../../../chunks/mergeWhereClauses.js";
|
|
8
|
+
import { g as O, i as F, a as C, s as G, r as U } from "../../../../chunks/resolveGeometryFilter.js";
|
|
9
|
+
import { r as W } from "../../../../chunks/resolveFieldNames.js";
|
|
10
|
+
import { f as j } from "../../../../chunks/fetchAgentContext.js";
|
|
11
|
+
import { f as A } from "../../../../chunks/fetchService.js";
|
|
11
12
|
import { distanceUnitsSchema as I } from "../../shared/types.js";
|
|
12
|
-
const
|
|
13
|
-
const { targetLayer:
|
|
14
|
-
if (!
|
|
15
|
-
throw new Error(`Layer '${
|
|
16
|
-
const w = await
|
|
13
|
+
const D = async (h) => {
|
|
14
|
+
const { targetLayer: s, fieldName: l, statisticType: n, mapView: r, layersAndFieldsRegistry: p, geometryFilter: e } = h, a = r.map?.allLayers.find((i) => i.id === s.layerId);
|
|
15
|
+
if (!a)
|
|
16
|
+
throw new Error(`Layer '${s.layerId}' not found.`);
|
|
17
|
+
const w = await r.whenLayerView(a), b = W(
|
|
18
|
+
l,
|
|
19
|
+
a.fields.map((i) => i.name)
|
|
20
|
+
), o = p.get(s.layerId)?.fieldRegistry.get(b), T = o?.alias;
|
|
17
21
|
if (!o)
|
|
18
|
-
throw new Error(`Field '${
|
|
19
|
-
let
|
|
22
|
+
throw new Error(`Field '${b}' not found.`);
|
|
23
|
+
let v, u;
|
|
20
24
|
if (e) {
|
|
21
|
-
const
|
|
22
|
-
if ("error" in
|
|
23
|
-
throw new Error(
|
|
24
|
-
if (!
|
|
25
|
-
throw
|
|
26
|
-
if (
|
|
27
|
-
const g =
|
|
28
|
-
|
|
25
|
+
const i = await O(e, r);
|
|
26
|
+
if ("error" in i)
|
|
27
|
+
throw new Error(i.error);
|
|
28
|
+
if (!i.geometry)
|
|
29
|
+
throw F(e) ? new Error(`No features found matching: ${e.where}`) : new Error("Failed to create geometry");
|
|
30
|
+
if (F(e)) {
|
|
31
|
+
const g = r.map?.allLayers.find((f) => f.id === e.layerId);
|
|
32
|
+
v = {
|
|
29
33
|
geometryLayerName: g?.title ?? g?.id,
|
|
30
34
|
geometryLayerId: e.layerId,
|
|
31
35
|
geometryWhere: e.where,
|
|
@@ -33,90 +37,90 @@ const j = async (h) => {
|
|
|
33
37
|
units: e.units,
|
|
34
38
|
applied: !0
|
|
35
39
|
};
|
|
36
|
-
} else C(e) && (
|
|
40
|
+
} else C(e) && (v = {
|
|
37
41
|
point: e.point,
|
|
38
42
|
distance: e.distance,
|
|
39
43
|
units: e.units,
|
|
40
44
|
applied: !0
|
|
41
45
|
});
|
|
42
46
|
u = new V({
|
|
43
|
-
geometry:
|
|
47
|
+
geometry: i.geometry,
|
|
44
48
|
distance: e.distance,
|
|
45
49
|
units: e.units,
|
|
46
50
|
spatialRelationship: "intersects"
|
|
47
51
|
});
|
|
48
52
|
}
|
|
49
|
-
const y = x(w, [
|
|
53
|
+
const y = x(w, [l], !1);
|
|
50
54
|
let d = null, m = null;
|
|
51
|
-
const
|
|
55
|
+
const q = 10;
|
|
52
56
|
if (o.type !== "geometry" && o.type !== "oid" && o.type !== "global-id")
|
|
53
57
|
try {
|
|
54
|
-
const
|
|
55
|
-
layer:
|
|
58
|
+
const i = {
|
|
59
|
+
layer: a,
|
|
56
60
|
useFeaturesInView: y,
|
|
57
|
-
view: y ?
|
|
58
|
-
field:
|
|
59
|
-
sqlWhere:
|
|
61
|
+
view: y ? r : void 0,
|
|
62
|
+
field: l,
|
|
63
|
+
sqlWhere: S(a.definitionExpression, s.where),
|
|
60
64
|
...u && { filter: u },
|
|
61
|
-
outStatisticTypes: { include: [
|
|
65
|
+
outStatisticTypes: { include: [n] }
|
|
62
66
|
};
|
|
63
|
-
d = await
|
|
67
|
+
d = await N(i);
|
|
64
68
|
const g = ["string", "small-integer", "integer"], f = o.domain?.type === "coded-value" ? o.domain : null;
|
|
65
69
|
(g.includes(o.type) || f) && (m = (await R({
|
|
66
|
-
layer:
|
|
70
|
+
layer: a,
|
|
67
71
|
useFeaturesInView: y,
|
|
68
|
-
view: y ?
|
|
69
|
-
field:
|
|
70
|
-
sqlWhere:
|
|
72
|
+
view: y ? r : void 0,
|
|
73
|
+
field: l,
|
|
74
|
+
sqlWhere: S(a.definitionExpression, s.where),
|
|
71
75
|
...u && { filter: u }
|
|
72
|
-
})).uniqueValueInfos.sort((c,
|
|
76
|
+
})).uniqueValueInfos.sort((c, L) => L.count - c.count).slice(0, q)), m && o.domain?.type === "coded-value" && (m = m.map((c) => ({
|
|
73
77
|
...c,
|
|
74
78
|
value: f ? f.getName(c.value) ?? c.value : c.value
|
|
75
79
|
})));
|
|
76
|
-
} catch (
|
|
77
|
-
console.error("Statistics error:",
|
|
80
|
+
} catch (i) {
|
|
81
|
+
console.error("Statistics error:", i);
|
|
78
82
|
}
|
|
79
83
|
return {
|
|
80
84
|
tool: "getStatistics",
|
|
81
|
-
layerName:
|
|
82
|
-
summary: `${
|
|
85
|
+
layerName: a.title ?? s.layerId,
|
|
86
|
+
summary: `${n} = ${typeof d?.[n] == "number" ? d[n] : "N/A"}`,
|
|
83
87
|
details: {
|
|
84
|
-
fieldName:
|
|
85
|
-
fieldAlias:
|
|
86
|
-
statisticType:
|
|
87
|
-
statistic: d?.[
|
|
88
|
+
fieldName: l,
|
|
89
|
+
fieldAlias: T,
|
|
90
|
+
statisticType: n,
|
|
91
|
+
statistic: d?.[n] ?? null,
|
|
88
92
|
summaryStatistics: d,
|
|
89
93
|
uniqueValues: m,
|
|
90
|
-
where:
|
|
91
|
-
spatialFilterInfo:
|
|
94
|
+
where: s.where,
|
|
95
|
+
spatialFilterInfo: v
|
|
92
96
|
}
|
|
93
97
|
};
|
|
94
98
|
};
|
|
95
|
-
async function
|
|
99
|
+
async function $({
|
|
96
100
|
targetLayer: h,
|
|
97
|
-
fieldName:
|
|
98
|
-
statisticType:
|
|
99
|
-
geometryFilter:
|
|
100
|
-
},
|
|
101
|
-
const p =
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
), w = await
|
|
101
|
+
fieldName: s,
|
|
102
|
+
statisticType: l,
|
|
103
|
+
geometryFilter: n
|
|
104
|
+
}, r) {
|
|
105
|
+
const p = A(r, "layersAndFieldsRegistry"), { mapView: e } = j(r, ["mapView"]), a = U(
|
|
106
|
+
n,
|
|
107
|
+
r.state?.agentExecutionContext?.sharedResources
|
|
108
|
+
), w = await D({
|
|
105
109
|
targetLayer: h,
|
|
106
|
-
fieldName:
|
|
107
|
-
statisticType:
|
|
110
|
+
fieldName: s,
|
|
111
|
+
statisticType: l,
|
|
108
112
|
mapView: e,
|
|
109
113
|
layersAndFieldsRegistry: p,
|
|
110
|
-
geometryFilter:
|
|
114
|
+
geometryFilter: a
|
|
111
115
|
});
|
|
112
116
|
return JSON.stringify(w, null, 2);
|
|
113
117
|
}
|
|
114
|
-
const
|
|
118
|
+
const P = t.object({
|
|
115
119
|
layerId: t.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
116
120
|
where: t.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
117
121
|
distance: t.number().optional().describe("The buffer distance around the geometry."),
|
|
118
122
|
units: I.optional().describe("The units for the distance buffer.")
|
|
119
|
-
}),
|
|
123
|
+
}), Q = t.object({
|
|
120
124
|
point: t.object({
|
|
121
125
|
x: t.number().describe("X coordinate (longitude) from navigation result"),
|
|
122
126
|
y: t.number().describe("Y coordinate (latitude) from navigation result"),
|
|
@@ -126,17 +130,17 @@ const D = t.object({
|
|
|
126
130
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
127
131
|
distance: t.number().optional().describe("Optional buffer distance around the point."),
|
|
128
132
|
units: I.optional().describe("The units for the distance buffer.")
|
|
129
|
-
}),
|
|
133
|
+
}), H = t.object({
|
|
130
134
|
targetLayer: t.object({
|
|
131
135
|
layerId: t.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
132
136
|
where: t.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
|
|
133
137
|
}),
|
|
134
|
-
geometryFilter: t.union([
|
|
138
|
+
geometryFilter: t.union([P, Q, G]).optional().describe(
|
|
135
139
|
"Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."
|
|
136
140
|
),
|
|
137
141
|
fieldName: t.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
|
|
138
142
|
statisticType: t.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
|
|
139
|
-
}),
|
|
143
|
+
}), re = E($, {
|
|
140
144
|
name: "getStatistics",
|
|
141
145
|
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.
|
|
142
146
|
|
|
@@ -151,8 +155,8 @@ DO NOT USE FOR:
|
|
|
151
155
|
- Simple counts of features matching a condition — use queryFeatures instead
|
|
152
156
|
|
|
153
157
|
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.`,
|
|
154
|
-
schema:
|
|
158
|
+
schema: H
|
|
155
159
|
});
|
|
156
160
|
export {
|
|
157
|
-
|
|
161
|
+
re as getStatisticsTool
|
|
158
162
|
};
|
|
@@ -2,130 +2,134 @@
|
|
|
2
2
|
import { tool as x } from "@langchain/core/tools";
|
|
3
3
|
import t from "zod";
|
|
4
4
|
import G from "@arcgis/core/rest/support/TopFeaturesQuery.js";
|
|
5
|
-
import
|
|
6
|
-
import { m as
|
|
7
|
-
import { a as
|
|
8
|
-
import { g as
|
|
9
|
-
import { f as
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
import R from "@arcgis/core/rest/support/TopFilter.js";
|
|
6
|
+
import { m as w, c as j } from "../../../../chunks/mergeWhereClauses.js";
|
|
7
|
+
import { a as D } from "../../../../chunks/formatFeatureAttributes.js";
|
|
8
|
+
import { g as Q, s as $, r as E } from "../../../../chunks/resolveGeometryFilter.js";
|
|
9
|
+
import { f as O } from "../../../../chunks/resolveFieldNames.js";
|
|
10
|
+
import { f as U } from "../../../../chunks/fetchAgentContext.js";
|
|
11
|
+
import { distanceUnitsSchema as B } from "../../shared/types.js";
|
|
12
|
+
const T = (o) => o.flatMap((e) => e.split(",")).map((e) => e.trim()).map((e) => e.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((e) => !!e), W = (o, e, n) => {
|
|
13
|
+
if (n === "date") {
|
|
14
|
+
const s = e instanceof Date ? e : typeof e == "number" ? new Date(e) : void 0;
|
|
15
|
+
if (s && Number.isFinite(s.getTime())) {
|
|
16
|
+
const l = s.toISOString().replace("T", " ").replace("Z", " +00:00");
|
|
17
|
+
return `${o} = TIMESTAMP'${l}'`;
|
|
17
18
|
}
|
|
18
19
|
return;
|
|
19
20
|
}
|
|
20
21
|
if (typeof e == "number" && Number.isFinite(e))
|
|
21
|
-
return `${
|
|
22
|
+
return `${o} = ${e}`;
|
|
22
23
|
if (typeof e == "string")
|
|
23
|
-
return `${
|
|
24
|
-
},
|
|
25
|
-
const i =
|
|
24
|
+
return `${o} = '${e.replace(/'/gu, "''")}'`;
|
|
25
|
+
}, A = async (o, e, n, s, l) => {
|
|
26
|
+
const i = n.map?.allLayers.find((r) => r.id === o.layerId), p = await n.whenLayerView(i), c = i.title ?? o.layerId, y = O(
|
|
27
|
+
o.outFields,
|
|
28
|
+
i.fields.map((r) => r.name)
|
|
29
|
+
);
|
|
26
30
|
let f;
|
|
27
|
-
if (
|
|
28
|
-
const
|
|
29
|
-
if ("error" in
|
|
31
|
+
if (s) {
|
|
32
|
+
const r = await Q(s, n);
|
|
33
|
+
if ("error" in r)
|
|
30
34
|
return {
|
|
31
35
|
tool: "getTopFeatures",
|
|
32
36
|
layerName: c,
|
|
33
37
|
summary: "Geometry lookup failed",
|
|
34
|
-
details: { error:
|
|
38
|
+
details: { error: r.error }
|
|
35
39
|
};
|
|
36
|
-
if (!
|
|
40
|
+
if (!r.geometry)
|
|
37
41
|
return {
|
|
38
42
|
tool: "getTopFeatures",
|
|
39
43
|
layerName: c,
|
|
40
44
|
summary: "No features found for geometry filter",
|
|
41
45
|
details: {
|
|
42
|
-
error: `No features found matching: ${"where" in
|
|
46
|
+
error: `No features found matching: ${"where" in s ? s.where : "unknown criteria"}`
|
|
43
47
|
}
|
|
44
48
|
};
|
|
45
|
-
f =
|
|
46
|
-
} else l && (f =
|
|
47
|
-
const
|
|
49
|
+
f = r.geometry;
|
|
50
|
+
} else l && (f = n.extent.clone());
|
|
51
|
+
const F = e.groupByFields && e.groupByFields.length > 0, g = i.objectIdField, b = y.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...y, g])];
|
|
48
52
|
try {
|
|
49
|
-
let
|
|
50
|
-
if (
|
|
53
|
+
let r;
|
|
54
|
+
if (F) {
|
|
51
55
|
const u = new G({
|
|
52
|
-
where:
|
|
53
|
-
outFields:
|
|
54
|
-
orderByFields:
|
|
56
|
+
where: o.where || "1=1",
|
|
57
|
+
outFields: b,
|
|
58
|
+
orderByFields: o.orderByFields,
|
|
55
59
|
geometry: f,
|
|
56
60
|
spatialRelationship: f ? "intersects" : void 0,
|
|
57
|
-
distance:
|
|
58
|
-
units:
|
|
59
|
-
topFilter: new
|
|
61
|
+
distance: s?.distance,
|
|
62
|
+
units: s?.units,
|
|
63
|
+
topFilter: new R({
|
|
60
64
|
topCount: e.topCount,
|
|
61
65
|
groupByFields: e.groupByFields,
|
|
62
66
|
orderByFields: e.orderByFields
|
|
63
67
|
})
|
|
64
68
|
});
|
|
65
|
-
|
|
69
|
+
r = await i.queryTopFeatures(u);
|
|
66
70
|
} else {
|
|
67
71
|
let u;
|
|
68
72
|
if (e.topCount === 1) {
|
|
69
73
|
const d = i.createQuery();
|
|
70
|
-
d.where =
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
74
|
+
d.where = w(i.definitionExpression, o.where || "1=1");
|
|
75
|
+
const N = T(e.orderByFields)[0], m = i.fields.find((h) => h.name.toLowerCase() === N?.toLowerCase());
|
|
76
|
+
if (m) {
|
|
73
77
|
d.outFields = ["*"], d.orderByFields = e.orderByFields, d.num = e.topCount, d.returnGeometry = !1;
|
|
74
|
-
const
|
|
75
|
-
u =
|
|
78
|
+
const h = await i.queryFeatures(d), q = h.features[h.features.length - 1]?.attributes?.[m.name];
|
|
79
|
+
u = W(m.name, q, m.type);
|
|
76
80
|
}
|
|
77
81
|
}
|
|
78
|
-
const
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
.../* @__PURE__ */ new Set([...
|
|
82
|
-
],
|
|
82
|
+
const a = i.createQuery(), S = w(i.definitionExpression, o.where || "1=1");
|
|
83
|
+
a.where = u ? w(S, u) : S, a.outFields = b.length ? b : ["*"], a.orderByFields = e.orderByFields, a.returnGeometry = !1, u || (a.num = e.topCount), f && (a.geometry = f, a.spatialRelationship = "intersects"), s?.distance && (a.distance = s.distance), s?.units && (a.units = s.units), a.outSpatialReference = n.spatialReference;
|
|
84
|
+
const k = [
|
|
85
|
+
.../* @__PURE__ */ new Set([...y, ...T(e.orderByFields)])
|
|
86
|
+
], v = j(p, k, l ?? !1);
|
|
83
87
|
try {
|
|
84
|
-
|
|
88
|
+
r = v ? await p.queryFeatures(a) : await i.queryFeatures(a);
|
|
85
89
|
} catch (d) {
|
|
86
|
-
console.warn("Client-side query failed, falling back to server:", d),
|
|
90
|
+
console.warn("Client-side query failed, falling back to server:", d), r = await i.queryFeatures(a);
|
|
87
91
|
}
|
|
88
92
|
}
|
|
89
|
-
const
|
|
93
|
+
const C = r.features.map((u) => u.attributes[g]), { attributes: I } = D(i, r, n.timeZone);
|
|
90
94
|
return {
|
|
91
95
|
tool: "getTopFeatures",
|
|
92
96
|
layerName: c,
|
|
93
97
|
summary: `Top ${e.topCount} features extracted`,
|
|
94
98
|
details: {
|
|
95
99
|
topCount: e.topCount,
|
|
96
|
-
attributes:
|
|
97
|
-
objectIds:
|
|
98
|
-
objectIdField:
|
|
99
|
-
where:
|
|
100
|
+
attributes: I,
|
|
101
|
+
objectIds: C,
|
|
102
|
+
objectIdField: g,
|
|
103
|
+
where: o.where,
|
|
100
104
|
orderByFields: e.orderByFields,
|
|
101
|
-
...
|
|
105
|
+
...F && { groupByFields: e.groupByFields }
|
|
102
106
|
}
|
|
103
107
|
};
|
|
104
|
-
} catch (
|
|
108
|
+
} catch (r) {
|
|
105
109
|
return {
|
|
106
110
|
tool: "getTopFeatures",
|
|
107
111
|
layerName: c,
|
|
108
112
|
summary: "Query failed",
|
|
109
|
-
details: { error:
|
|
113
|
+
details: { error: r instanceof Error ? r.message : String(r) }
|
|
110
114
|
};
|
|
111
115
|
}
|
|
112
|
-
},
|
|
113
|
-
targetLayer:
|
|
116
|
+
}, V = async ({
|
|
117
|
+
targetLayer: o,
|
|
114
118
|
topFilter: e,
|
|
115
|
-
geometryFilter:
|
|
116
|
-
useCurrentExtent:
|
|
119
|
+
geometryFilter: n,
|
|
120
|
+
useCurrentExtent: s
|
|
117
121
|
}, l) => {
|
|
118
|
-
const { mapView: i } =
|
|
119
|
-
|
|
122
|
+
const { mapView: i } = U(l, ["mapView"]), p = E(
|
|
123
|
+
n,
|
|
120
124
|
l.state?.agentExecutionContext?.sharedResources
|
|
121
|
-
), c = await
|
|
125
|
+
), c = await A(o, e, i, p, s);
|
|
122
126
|
return JSON.stringify(c, null, 2);
|
|
123
|
-
},
|
|
127
|
+
}, P = t.object({
|
|
124
128
|
layerId: t.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
125
129
|
where: t.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
126
130
|
distance: t.number().optional().describe("The buffer distance around the geometry."),
|
|
127
|
-
units:
|
|
128
|
-
}),
|
|
131
|
+
units: B.optional().describe("The units for the distance buffer.")
|
|
132
|
+
}), Y = t.object({
|
|
129
133
|
point: t.object({
|
|
130
134
|
x: t.number().describe("X coordinate (longitude) from navigation result"),
|
|
131
135
|
y: t.number().describe("Y coordinate (latitude) from navigation result"),
|
|
@@ -134,8 +138,8 @@ const S = (r) => r.flatMap((e) => e.split(",")).map((e) => e.trim()).map((e) =>
|
|
|
134
138
|
}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
|
|
135
139
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
136
140
|
distance: t.number().optional().describe("Optional buffer distance around the point."),
|
|
137
|
-
units:
|
|
138
|
-
}),
|
|
141
|
+
units: B.optional().describe("The units for the distance buffer.")
|
|
142
|
+
}), Z = t.object({
|
|
139
143
|
targetLayer: t.object({
|
|
140
144
|
layerId: t.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
141
145
|
where: t.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
|
|
@@ -146,7 +150,7 @@ const S = (r) => r.flatMap((e) => e.split(",")).map((e) => e.trim()).map((e) =>
|
|
|
146
150
|
).default("*")
|
|
147
151
|
)
|
|
148
152
|
}),
|
|
149
|
-
geometryFilter: t.union([
|
|
153
|
+
geometryFilter: t.union([P, Y, $]).optional().describe(
|
|
150
154
|
"Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."
|
|
151
155
|
),
|
|
152
156
|
topFilter: t.object({
|
|
@@ -159,11 +163,11 @@ const S = (r) => r.flatMap((e) => e.split(",")).map((e) => e.trim()).map((e) =>
|
|
|
159
163
|
useCurrentExtent: t.boolean().optional().describe(
|
|
160
164
|
"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)."
|
|
161
165
|
)
|
|
162
|
-
}),
|
|
166
|
+
}), se = x(V, {
|
|
163
167
|
name: "getTopFeatures",
|
|
164
168
|
description: 'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "latest", "earliest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). Display all the features that meet the ranking criteria, including ties at the cutoff value. orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',
|
|
165
|
-
schema:
|
|
169
|
+
schema: Z
|
|
166
170
|
});
|
|
167
171
|
export {
|
|
168
|
-
|
|
172
|
+
se as getTopFeaturesTool
|
|
169
173
|
};
|
|
@@ -1,55 +1,59 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { tool as
|
|
3
|
-
import { a as
|
|
4
|
-
import { g as
|
|
2
|
+
import { tool as C } from "@langchain/core/tools";
|
|
3
|
+
import { a as R } from "../../../../chunks/formatFeatureAttributes.js";
|
|
4
|
+
import { g as O, i as S, a as I, s as G, r as N } from "../../../../chunks/resolveGeometryFilter.js";
|
|
5
5
|
import { c as j, m as x } from "../../../../chunks/mergeWhereClauses.js";
|
|
6
|
+
import { f as W } from "../../../../chunks/resolveFieldNames.js";
|
|
6
7
|
import t from "zod";
|
|
7
|
-
import { f as
|
|
8
|
+
import { f as B } from "../../../../chunks/fetchAgentContext.js";
|
|
8
9
|
import { distanceUnitsSchema as q } from "../../shared/types.js";
|
|
9
|
-
const p = 25,
|
|
10
|
-
const
|
|
10
|
+
const p = 25, k = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map((r) => r.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((r) => !!r), D = async (i, r, e, l) => {
|
|
11
|
+
const s = r.map?.allLayers.find((u) => u.id === i.layerId), d = await r.whenLayerView(s), f = s.title ?? i.layerId;
|
|
11
12
|
let h;
|
|
12
13
|
if (e) {
|
|
13
|
-
const u = await
|
|
14
|
+
const u = await O(e, r);
|
|
14
15
|
if ("error" in u) {
|
|
15
|
-
const
|
|
16
|
-
if (
|
|
16
|
+
const a = { error: u.error };
|
|
17
|
+
if (S(e)) {
|
|
17
18
|
const c = r.map?.allLayers.find((y) => y.id === e.layerId);
|
|
18
|
-
|
|
19
|
-
} else I(e) && (
|
|
19
|
+
a.geometryLayerName = c?.title ?? c?.id, a.geometryLayerId = e.layerId, a.geometryWhere = e.where;
|
|
20
|
+
} else I(e) && (a.point = e.point);
|
|
20
21
|
return {
|
|
21
22
|
tool: "queryFeatures",
|
|
22
23
|
layerName: f,
|
|
23
24
|
summary: "Geometry lookup failed",
|
|
24
|
-
details:
|
|
25
|
+
details: a
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
28
|
if (!u.geometry) {
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
29
|
+
const a = {};
|
|
30
|
+
if (S(e)) {
|
|
30
31
|
const c = r.map?.allLayers.find((y) => y.id === e.layerId);
|
|
31
|
-
|
|
32
|
-
} else I(e) && (
|
|
32
|
+
a.error = `No features found matching: ${e.where}`, a.geometryLayerName = c?.title ?? c?.id, a.geometryLayerId = e.layerId, a.geometryWhere = e.where;
|
|
33
|
+
} else I(e) && (a.error = "Failed to create point geometry", a.point = e.point);
|
|
33
34
|
return {
|
|
34
35
|
tool: "queryFeatures",
|
|
35
36
|
layerName: f,
|
|
36
37
|
summary: "No features found for geometry filter",
|
|
37
|
-
details:
|
|
38
|
+
details: a
|
|
38
39
|
};
|
|
39
40
|
}
|
|
40
41
|
h = u.geometry;
|
|
41
42
|
} else l && (h = r.extent.clone());
|
|
42
|
-
const
|
|
43
|
-
.../* @__PURE__ */ new Set([...i.outFields, ...
|
|
44
|
-
], b = j(d,
|
|
45
|
-
o.where = x(
|
|
43
|
+
const v = [
|
|
44
|
+
.../* @__PURE__ */ new Set([...i.outFields, ...k(i.orderByFields)])
|
|
45
|
+
], b = j(d, v, l ?? !1), w = s.objectIdField, o = s.createQuery();
|
|
46
|
+
o.where = x(s.definitionExpression, i.where || "1=1"), o.outFields = i.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...i.outFields, w])], o.orderByFields = i.orderByFields, h && (o.geometry = h, o.spatialRelationship = "intersects"), e?.distance && (o.distance = e.distance), e?.units && (o.units = e.units), o.outSpatialReference = r.spatialReference;
|
|
46
47
|
let n, m;
|
|
47
48
|
try {
|
|
48
|
-
n = b ? await d.queryFeatureCount(o) : await
|
|
49
|
+
n = b ? await d.queryFeatureCount(o) : await s.queryFeatureCount(o), n > 0 && n <= p && (m = b ? await d.queryFeatures(o) : await s.queryFeatures(o));
|
|
49
50
|
} catch (u) {
|
|
50
|
-
console.warn("Client-side query failed, falling back to server:", u), n = await
|
|
51
|
+
console.warn("Client-side query failed, falling back to server:", u), n = await s.queryFeatureCount(o), n > 0 && n <= p && (m = await s.queryFeatures(o));
|
|
51
52
|
}
|
|
52
|
-
const { objectIds: g, attributes:
|
|
53
|
+
const { objectIds: g, attributes: F } = m ? R(s, m, r.timeZone) : { objectIds: void 0, attributes: void 0 }, T = W(
|
|
54
|
+
i.outFields,
|
|
55
|
+
s.fields.map((u) => u.name)
|
|
56
|
+
);
|
|
53
57
|
return {
|
|
54
58
|
tool: "queryFeatures",
|
|
55
59
|
layerName: f,
|
|
@@ -58,32 +62,32 @@ const p = 25, W = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map
|
|
|
58
62
|
totalCount: n,
|
|
59
63
|
where: i.where,
|
|
60
64
|
orderByFields: i.orderByFields,
|
|
61
|
-
outFields:
|
|
65
|
+
outFields: T,
|
|
62
66
|
...g && { objectIds: g, objectIdField: w },
|
|
63
|
-
...
|
|
67
|
+
...F && { attributes: F },
|
|
64
68
|
...n > p && {
|
|
65
69
|
note: `${n} features found.`
|
|
66
70
|
}
|
|
67
71
|
}
|
|
68
72
|
};
|
|
69
73
|
};
|
|
70
|
-
async function
|
|
74
|
+
async function L({
|
|
71
75
|
targetLayer: i,
|
|
72
76
|
geometryFilter: r,
|
|
73
77
|
useCurrentExtent: e
|
|
74
78
|
}, l) {
|
|
75
|
-
const { mapView:
|
|
79
|
+
const { mapView: s } = B(l, ["mapView"]), d = N(
|
|
76
80
|
r,
|
|
77
81
|
l.state?.agentExecutionContext?.sharedResources
|
|
78
|
-
), f = await
|
|
82
|
+
), f = await D(i, s, d, e);
|
|
79
83
|
return JSON.stringify(f, null, 2);
|
|
80
84
|
}
|
|
81
|
-
const
|
|
85
|
+
const U = t.object({
|
|
82
86
|
layerId: t.string().describe("The layerId of the layer containing the geometry by which to filter."),
|
|
83
87
|
where: t.string().describe("The SQL-92 where clause representing the features from which to filter."),
|
|
84
88
|
distance: t.number().optional().describe("The buffer distance around the geometry."),
|
|
85
89
|
units: q.optional().describe("The units for the distance buffer.")
|
|
86
|
-
}),
|
|
90
|
+
}), A = t.object({
|
|
87
91
|
point: t.object({
|
|
88
92
|
x: t.number().describe("X coordinate (longitude) from navigation result"),
|
|
89
93
|
y: t.number().describe("Y coordinate (latitude) from navigation result"),
|
|
@@ -93,7 +97,7 @@ const D = t.object({
|
|
|
93
97
|
}).describe("Point coordinates from a previous navigation/geocoding result"),
|
|
94
98
|
distance: t.number().optional().describe("Optional buffer distance around the point."),
|
|
95
99
|
units: q.optional().describe("The units for the distance buffer.")
|
|
96
|
-
}),
|
|
100
|
+
}), E = t.object({
|
|
97
101
|
targetLayer: t.object({
|
|
98
102
|
layerId: t.string().describe("The layerId of the layer containing the field from which to get a value."),
|
|
99
103
|
where: t.string().describe(
|
|
@@ -106,13 +110,13 @@ const D = t.object({
|
|
|
106
110
|
).default("*")
|
|
107
111
|
)
|
|
108
112
|
}),
|
|
109
|
-
geometryFilter: t.union([
|
|
113
|
+
geometryFilter: t.union([U, A, G]).optional().describe(
|
|
110
114
|
"Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."
|
|
111
115
|
),
|
|
112
116
|
useCurrentExtent: t.boolean().optional().describe(
|
|
113
117
|
"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)."
|
|
114
118
|
)
|
|
115
|
-
}),
|
|
119
|
+
}), K = C(L, {
|
|
116
120
|
name: "queryFeatures",
|
|
117
121
|
description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
|
|
118
122
|
|
|
@@ -124,8 +128,8 @@ USE THIS TOOL FOR:
|
|
|
124
128
|
- Any question where the user wants to SEE or COUNT matching features
|
|
125
129
|
|
|
126
130
|
This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
|
|
127
|
-
schema:
|
|
131
|
+
schema: E
|
|
128
132
|
});
|
|
129
133
|
export {
|
|
130
|
-
|
|
134
|
+
K as queryFeaturesTool
|
|
131
135
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a}from"./
|
|
2
|
+
import{a}from"./FJV7CI7O.js";import{a as t}from"./WSIZ2OTL.js";var l=async(i={})=>{let{modelTier:e="default",config:o}=i,{getChatAIUtilityServiceUrl:r}=await import("./4KFTUBFL.js").then(m=>m.default),{createAuthenticatedFetch:n}=await import("./OYHYHALE.js").then(m=>m.default.then(e=>({createAuthenticatedFetch:e}))),c=t[e],s=await r(e);return new a({modelName:c,apiKey:"dummy-key",useResponsesApi:!0,zdrEnabled:!0,configuration:{baseURL:s,fetch:await n({config:o,withCredentials:!0})}})};export{l as a};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as o}from"./FDOMMK2M.js";import{a as r}from"./
|
|
2
|
+
import{a as o}from"./FDOMMK2M.js";import{a as r}from"./RFPTOFM4.js";import{Ga as a}from"./FSLPYC4Y.js";var f=(l,i)=>{let t=Array.from(l.values()).find(({layerItem:e})=>e.title?.toLowerCase().includes(i.toLowerCase()));if(!t){let e=Array.from(l.values()).map(y=>y.layerItem.title).join(", ");return`Could not find a layer matching "${i}". Available layers: ${e}`}let s=Array.from(t.fieldRegistry.values()),n=s.map(e=>`- **${e.alias||e.name}** (\`${e.name}\`, ${e.type})${e.description?`: ${e.description}`:""}`).join(`
|
|
3
3
|
`);return`**${t.layerItem.title}** has ${s.length} field(s):
|
|
4
4
|
|
|
5
5
|
${n}`},m=({layerTitle:l},i)=>{let t=o(i,"layersAndFieldsRegistry");return f(t,l)},u=a(m,{name:"listLayerFields",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.",schema:r.object({layerTitle:r.string().describe("The title or partial title of the layer to list fields for.")})});export{u as a};
|