@arcgis/ai-components 5.2.0-next.104 → 5.2.0-next.106
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.js +41 -40
- package/dist/agent-utils/middlewares/trace.js +5 -5
- package/dist/agents/runtime/skill/createSkillAgent.d.ts +31 -0
- package/dist/agents/runtime/skill/createSkillAgent.js +262 -0
- package/dist/agents/runtime/skill/loadAgentSkills.d.ts +16 -0
- package/dist/agents/runtime/skill/types.d.ts +28 -0
- package/dist/agents/runtime/skill/types.js +2 -0
- package/dist/agents/tools/filter/setFeatureEffect/adapter.js +20 -19
- package/dist/agents/tools/query/getStatistics/adapter.js +4 -3
- package/dist/agents/tools/query/getTopFeatures/adapter.js +4 -3
- package/dist/agents/tools/query/queryFeatures/adapter.js +4 -3
- package/dist/agents/tools/shared/resolveToolArtifact.d.ts +22 -0
- package/dist/agents/tools/shared/resolveToolArtifact.js +20 -0
- package/dist/agents/tools/shared/types.d.ts +22 -0
- package/dist/agents/tools/shared/types.js +6 -0
- package/dist/cdn/23C34FEU.js +2 -0
- package/dist/cdn/{NZSOJ726.js → 2AMUOR7X.js} +1 -1
- package/dist/cdn/2OHRNRNT.js +2 -0
- package/dist/cdn/2OUIRKTV.js +2 -0
- package/dist/cdn/2S6L3P4Q.js +2 -0
- package/dist/cdn/{C4FEETBZ.js → 2W7LK4HA.js} +1 -1
- package/dist/cdn/3IOP64NG.js +2 -0
- package/dist/cdn/3OH35VXS.js +2 -0
- package/dist/cdn/{5K5ZY267.js → 3SD47V7G.js} +1 -1
- package/dist/cdn/{7VAQUCBU.js → 3VCPN2KW.js} +1 -1
- package/dist/cdn/{LLUGJKAQ.js → 3XDT7MWI.js} +1 -1
- package/dist/cdn/{Y7XD7ZRD.js → 4ALF2CJY.js} +1 -1
- package/dist/cdn/{HAEFC2SJ.js → 5LMYUEK7.js} +1 -1
- package/dist/cdn/{655YIKL3.js → 6GODC6RU.js} +2 -2
- package/dist/cdn/{7VUSIGEM.js → 6RAWG2KQ.js} +1 -1
- package/dist/cdn/{GCVB5VG4.js → 6YZGKVYB.js} +1 -1
- package/dist/cdn/{VLLZ2FFU.js → 725MBCQF.js} +1 -1
- package/dist/cdn/74CVYM72.js +19 -0
- package/dist/cdn/{CP5BVGJU.js → 7EOS4SGJ.js} +1 -1
- package/dist/cdn/{5WYRJMBW.js → 7QIX4PZR.js} +1 -1
- package/dist/cdn/7UF3WRLO.js +72 -0
- package/dist/cdn/A7BKHIMA.js +2 -0
- package/dist/cdn/AFSBL4ZP.js +2 -0
- package/dist/cdn/{FG647IP6.js → AGQ5ADFU.js} +1 -1
- package/dist/cdn/{5ZFUGNRN.js → BQYF37UD.js} +1 -1
- package/dist/cdn/{4RDNI22D.js → BTTBKTFM.js} +4 -4
- package/dist/cdn/BVSK2GWP.js +2 -0
- package/dist/cdn/CFAC4FN3.js +2 -0
- package/dist/cdn/{HDACNIZF.js → D5EKX26R.js} +1 -1
- package/dist/cdn/EGN5BCHV.js +2 -0
- package/dist/cdn/{BXQ4I5HB.js → EJJFG5DE.js} +2 -2
- package/dist/cdn/{ZDV4K4WG.js → EOD5PNOL.js} +1 -1
- package/dist/cdn/{OE3GW5LE.js → ES6D4UD6.js} +1 -1
- package/dist/cdn/{K2R6XVK3.js → HB72YIII.js} +1 -1
- package/dist/cdn/{G2EGT3CF.js → HHBNLCJP.js} +1 -1
- package/dist/cdn/HLN5675C.js +2 -0
- package/dist/cdn/IFFOSSNB.js +2 -0
- package/dist/cdn/IO7DYFL2.js +2 -0
- package/dist/cdn/{IBZ2NEAO.js → IRSJXHRN.js} +1 -1
- package/dist/cdn/JD2TB7H4.js +2 -0
- package/dist/cdn/{ANRQWYU2.js → JKKU4K4C.js} +1 -1
- package/dist/cdn/{FUF3NAU7.js → JMNHFKGL.js} +1 -1
- package/dist/cdn/{22KHSDJI.js → JWZD3D5E.js} +1 -1
- package/dist/cdn/{HKOGIZDQ.js → KJLLN4P4.js} +18 -18
- package/dist/cdn/KZ73TZOB.js +2 -0
- package/dist/cdn/LEO3USHH.js +2 -0
- package/dist/cdn/LNIMGXB4.js +2 -0
- package/dist/cdn/MG2W2ZF3.js +2 -0
- package/dist/cdn/{NYJYRCGA.js → MSXMHRI7.js} +1 -1
- package/dist/cdn/MXAZE2VM.js +179 -0
- package/dist/cdn/{EWLXNGKH.js → OL7QBAGS.js} +15 -15
- package/dist/cdn/OMF6ITSG.js +2 -0
- package/dist/cdn/{Z5W4V7RC.js → OOGADOKQ.js} +1 -1
- package/dist/cdn/{KITIP6J2.js → OZ2CM3J2.js} +1 -1
- package/dist/cdn/{6YYPVU7H.js → P4GFYBBO.js} +1 -1
- package/dist/cdn/PK5KI2XF.js +2 -0
- package/dist/cdn/PWFUEBTT.js +2 -0
- package/dist/cdn/{HHUQXL3R.js → PYGX4HN7.js} +1 -1
- package/dist/cdn/RFVZ7KCG.js +66 -0
- package/dist/cdn/{YEZ3AMNX.js → RLB6TK6B.js} +1 -1
- package/dist/cdn/{WKTQVBFJ.js → RN6WMVZX.js} +1 -1
- package/dist/cdn/{WJXXOKGA.js → ROQGPAR5.js} +1 -1
- package/dist/cdn/RSJSRETN.js +2 -0
- package/dist/cdn/RSR66KB4.js +2 -0
- package/dist/cdn/{7SRLZQVC.js → RZIXMISL.js} +1 -1
- package/dist/cdn/{VOKXKU7M.js → S4LELUBK.js} +9 -9
- package/dist/cdn/{AI6DYOKR.js → S627D4K7.js} +1 -1
- package/dist/cdn/SL4Y7IRG.js +2 -0
- package/dist/cdn/STUBN3L5.js +2 -0
- package/dist/cdn/T2OYKP3V.js +2 -0
- package/dist/cdn/{C4JT4S5E.js → TBYDZN4H.js} +1 -1
- package/dist/cdn/{HHFNQR6Z.js → TEI6WXW7.js} +1 -1
- package/dist/cdn/{WGO5SER7.js → TFRWUAB6.js} +1 -1
- package/dist/cdn/U3ETGDT7.js +2 -0
- package/dist/cdn/{KWD2ECTM.js → UAG6GDUG.js} +1 -1
- package/dist/cdn/UHICISBZ.js +2 -0
- package/dist/cdn/{NNXISHCA.js → VMZZR7MY.js} +2 -2
- package/dist/cdn/WW4BEFDF.js +2 -0
- package/dist/cdn/XGCQS3N4.js +2 -0
- package/dist/cdn/{R2PQVY4O.js → XKH37FLY.js} +1 -1
- package/dist/cdn/XQ3NBBQ3.js +2 -0
- package/dist/cdn/{7BCQMK6D.js → XTCLJEID.js} +1 -1
- package/dist/cdn/{J6SZIQJA.js → Y7LGFSHO.js} +1 -1
- package/dist/cdn/ZFOG3KXV.js +2 -0
- package/dist/cdn/ZZZB3GES.js +14 -0
- 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/SKILL.js +5 -0
- package/dist/chunks/SKILL2.js +5 -0
- package/dist/chunks/SKILL3.js +22 -0
- package/dist/chunks/SKILL4.js +5 -0
- package/dist/chunks/adapter.js +137 -140
- package/dist/chunks/aiFactory.js +94 -0
- package/dist/chunks/arcgisKnowledgeGraph.js +14 -13
- package/dist/chunks/baseAgentState.js +2 -2
- package/dist/chunks/dataExplorationAgent.js +30 -0
- package/dist/chunks/generateLayerDescriptions.js +181 -268
- package/dist/chunks/helpAgent.js +37 -0
- package/dist/chunks/layerStylingGraph.js +91 -76
- package/dist/chunks/navigationAgent.js +40 -0
- package/dist/chunks/orchestrator.js +13 -12
- package/dist/chunks/requireAgentServices.js +11 -0
- package/dist/chunks/resolvePointGeometryFilter.js +11 -11
- package/dist/components/arcgis-assistant/customElement.d.ts +23 -3
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +17 -6
- package/dist/components/arcgis-assistant-help-agent/customElement.js +3 -1
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +18 -7
- 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/orchestrator/models/types.d.ts +1 -0
- package/dist/orchestrator/providers/arcgis/aiFactory.d.ts +15 -0
- package/dist/orchestrator/registry/agentRegistry.d.ts +33 -0
- package/dist/orchestrator/types/types.d.ts +17 -0
- package/dist/utils/index.d.ts +13 -3
- package/dist/utils/index.js +706 -82
- package/package.json +10 -6
- package/dist/cdn/2EY3BQQX.js +0 -2
- package/dist/cdn/2NDBI2VA.js +0 -156
- package/dist/cdn/4OGR5QKS.js +0 -2
- package/dist/cdn/5FL5BTTX.js +0 -66
- package/dist/cdn/5X7EG7D2.js +0 -2
- package/dist/cdn/6FCU2KJP.js +0 -2
- package/dist/cdn/7BJ4JKLG.js +0 -2
- package/dist/cdn/7HS5KX3J.js +0 -2
- package/dist/cdn/7UUYJTKT.js +0 -2
- package/dist/cdn/7V6OSTFC.js +0 -2
- package/dist/cdn/7VYYQ7BT.js +0 -2
- package/dist/cdn/ACJTJLZN.js +0 -2
- package/dist/cdn/AKD5UOVX.js +0 -2
- package/dist/cdn/C7LGDNB3.js +0 -14
- package/dist/cdn/CGJINV7H.js +0 -2
- package/dist/cdn/CJMUJXPL.js +0 -2
- package/dist/cdn/D2SS763Z.js +0 -2
- package/dist/cdn/FJO4KNOZ.js +0 -2
- package/dist/cdn/G3SF6U2U.js +0 -2
- package/dist/cdn/G6CR7JVM.js +0 -22
- package/dist/cdn/GL7BPKBN.js +0 -2
- package/dist/cdn/JO5ETMPS.js +0 -2
- package/dist/cdn/PUHRBGKB.js +0 -2
- package/dist/cdn/Q57QWN5W.js +0 -2
- package/dist/cdn/QUKNPVAF.js +0 -2
- package/dist/cdn/RBE55SWR.js +0 -2
- package/dist/cdn/SWH6ZHD4.js +0 -18
- package/dist/cdn/SZ2QSSB3.js +0 -2
- package/dist/cdn/T4RIGOXB.js +0 -2
- package/dist/cdn/W4JQDITQ.js +0 -36
- package/dist/cdn/XX6GHMNR.js +0 -2
- package/dist/cdn/YLVJA4ZE.js +0 -2
- package/dist/cdn/ZOEMBHRF.js +0 -2
- package/dist/cdn/ZRVZMPFN.js +0 -2
- package/dist/chunks/dataExplorationGraph.js +0 -254
- package/dist/chunks/helpGraph.js +0 -133
- package/dist/chunks/navigationGraph.js +0 -290
- package/dist/chunks/toolCallResponse.js +0 -33
|
@@ -5,8 +5,9 @@ import T from "@arcgis/core/rest/support/TopFeaturesQuery.js";
|
|
|
5
5
|
import B from "@arcgis/core/rest/support/TopFilter.js";
|
|
6
6
|
import { m as C, c as v } from "../../../../chunks/mergeWhereClauses.js";
|
|
7
7
|
import { a as I } from "../../../../chunks/formatFeatureAttributes.js";
|
|
8
|
-
import { g as q,
|
|
8
|
+
import { g as q, s as x, r as G } from "../../../../chunks/resolvePointGeometryFilter.js";
|
|
9
9
|
import { f as N } from "../../../../chunks/fetchAgentContext.js";
|
|
10
|
+
import { distanceUnitsSchema as y } from "../../shared/types.js";
|
|
10
11
|
const k = (s) => s.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), R = async (s, t, n, i, l) => {
|
|
11
12
|
const a = n.map?.allLayers.find((o) => o.id === s.layerId), c = await n.whenLayerView(a), u = a.title ?? s.layerId;
|
|
12
13
|
let d;
|
|
@@ -134,11 +135,11 @@ const k = (s) => s.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) =>
|
|
|
134
135
|
useCurrentExtent: e.boolean().optional().describe(
|
|
135
136
|
"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)."
|
|
136
137
|
)
|
|
137
|
-
}),
|
|
138
|
+
}), K = S(j, {
|
|
138
139
|
name: "getTopFeatures",
|
|
139
140
|
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.',
|
|
140
141
|
schema: U
|
|
141
142
|
});
|
|
142
143
|
export {
|
|
143
|
-
|
|
144
|
+
K as getTopFeaturesTool
|
|
144
145
|
};
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { tool as v } from "@langchain/core/tools";
|
|
3
3
|
import { a as C } from "../../../../chunks/formatFeatureAttributes.js";
|
|
4
|
-
import { g as R, i as F, a as I,
|
|
4
|
+
import { g as R, i as F, a as I, s as G, r as O } from "../../../../chunks/resolvePointGeometryFilter.js";
|
|
5
5
|
import { c as j, m as x } from "../../../../chunks/mergeWhereClauses.js";
|
|
6
6
|
import t from "zod";
|
|
7
7
|
import { f as N } from "../../../../chunks/fetchAgentContext.js";
|
|
8
|
+
import { distanceUnitsSchema as q } from "../../shared/types.js";
|
|
8
9
|
const p = 25, W = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map((r) => r.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((r) => !!r), B = async (i, r, e, l) => {
|
|
9
10
|
const a = r.map?.allLayers.find((u) => u.id === i.layerId), d = await r.whenLayerView(a), f = a.title ?? i.layerId;
|
|
10
11
|
let h;
|
|
@@ -111,7 +112,7 @@ const D = t.object({
|
|
|
111
112
|
useCurrentExtent: t.boolean().optional().describe(
|
|
112
113
|
"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)."
|
|
113
114
|
)
|
|
114
|
-
}),
|
|
115
|
+
}), X = v(k, {
|
|
115
116
|
name: "queryFeatures",
|
|
116
117
|
description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
|
|
117
118
|
|
|
@@ -126,5 +127,5 @@ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
|
|
|
126
127
|
schema: U
|
|
127
128
|
});
|
|
128
129
|
export {
|
|
129
|
-
|
|
130
|
+
X as queryFeaturesTool
|
|
130
131
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { BaseMessage } from "@langchain/core/messages";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the artifact from the most recent retained tool message with the requested tool name.
|
|
5
|
+
*
|
|
6
|
+
* @param parameter0
|
|
7
|
+
* @returns The validated artifact.
|
|
8
|
+
* @typeParam T - The validated artifact type.
|
|
9
|
+
* @throws If the matching message has no artifact, its artifact is invalid, or no matching message is available.
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export function resolveLatestToolArtifact<T>(parameter0: ResolveToolArtifactOptions<T>): T;
|
|
13
|
+
|
|
14
|
+
export type ResolveToolArtifactOptions<T> = {
|
|
15
|
+
messages: readonly BaseMessage[];
|
|
16
|
+
schema: ArtifactSchema<T>;
|
|
17
|
+
toolName: string;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type ArtifactSchema<T> = {
|
|
21
|
+
parse: (value: unknown) => T;
|
|
22
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { ToolMessage as a } from "@langchain/core/messages";
|
|
3
|
+
const i = (r) => typeof r == "object" && r !== null && "value" in r, c = ({ messages: r, schema: n, toolName: t }) => {
|
|
4
|
+
for (let o = r.length - 1; o >= 0; o--) {
|
|
5
|
+
const e = r[o];
|
|
6
|
+
if (!(!a.isInstance(e) || e.name !== t)) {
|
|
7
|
+
if (!i(e.artifact))
|
|
8
|
+
throw new Error(`Tool "${t}" did not return an artifact.`);
|
|
9
|
+
try {
|
|
10
|
+
return n.parse(e.artifact.value);
|
|
11
|
+
} catch {
|
|
12
|
+
throw new Error(`Tool "${t}" returned an invalid artifact.`);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
throw new Error(`No result from tool "${t}" is available.`);
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
c as resolveLatestToolArtifact
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { SharedResourceInput, SharedStatePatch } from "../../../orchestrator/types/types.js";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Artifact returned by an agent tool, including optional shared-context effects.
|
|
5
|
+
*
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export type AgentToolArtifact<TValue, TSharedState extends Record<string, unknown> = Record<string, unknown>> = Readonly<{
|
|
9
|
+
value: TValue;
|
|
10
|
+
sharedStatePatch?: SharedStatePatch<TSharedState>;
|
|
11
|
+
sharedResourceAdditions?: readonly SharedResourceInput[];
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Content and artifact returned by an agent tool.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
export type AgentToolResponse<TValue, TSharedState extends Record<string, unknown> = Record<string, unknown>> = [
|
|
20
|
+
content: string,
|
|
21
|
+
artifact: AgentToolArtifact<TValue, TSharedState>
|
|
22
|
+
];
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import c from"./A7BKHIMA.js";import"./7EOS4SGJ.js";import b from"./6RAWG2KQ.js";import"./XKH37FLY.js";import a from"./KJLLN4P4.js";import"./HHBNLCJP.js";import"./R74ZHFA6.js";import"./3VCPN2KW.js";import"./TEI6WXW7.js";import"./S4LELUBK.js";import"./OL7QBAGS.js";import"./S627D4K7.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./
|
|
2
|
+
import a from"./JKKU4K4C.js";import"./XKH37FLY.js";import"./HHBNLCJP.js";import"./OL7QBAGS.js";import"./S627D4K7.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:g,subclass:p},{c:d,d:u}])=>{var f=Object.defineProperty,w=Object.getOwnPropertyDescriptor,c=(e,r,n,o)=>{for(var t=o>1?void 0:o?w(r,n):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,n,t):a(t))||t);return o&&t&&f(r,n,t),t},s=class extends u{constructor(e){super(e)}getAgents(){return this.agents}buildNodes(e){let r=super.buildNodes(e);return r[l]=()=>({}),r}buildEdges(e){let r=this.condition;if(!r)throw new Error("ConditionalWorkflow requires a condition.");let n=d(e[0],0),o=d(e[1],1);return[{from:l,decide:async(t,i)=>await Promise.resolve(r(t,i))?n:o}]}getEntryNode(){return l}isTerminalAgent(){return!0}validateAgents(e){if(super.validateAgents(e),e.length!==2)throw new Error(`ConditionalWorkflow requires exactly 2 agents; received ${e.length}.`)}};c([g()],s.prototype,"condition",2);c([g()],s.prototype,"agents",2);s=c([p("ConditionalWorkflow")],s);var l="__conditional_decide";return s},"core/accessorSupport/decorators",a)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{$a as Ea,A as j,Aa as ga,B as k,Ba as ha,C as l,Ca as ia,D as m,Da as ja,E as n,Ea as ka,F as o,G as p,Ga as la,H as q,Ha as ma,I as r,Ia as na,J as s,Ja as oa,K as t,Ka as pa,L as u,La as qa,M as v,Ma as ra,N as w,Na as sa,O as x,Oa as ta,P as y,Pa as ua,Q as z,Qa as va,R as A,Ra as wa,S as B,Sa as xa,T as C,Ta as ya,U as D,Ua as za,V as E,Va as Aa,W as F,X as G,Y as H,Ya as Ba,Z as I,Za as Ca,_a as Da,ab as Fa,ba as J,bb as Ga,ca as K,cb as Ha,da as L,db as Ia,ea as M,eb as Ja,fa as N,fb as Ka,ga as O,gb as La,ha as P,ia as Q,ja as R,ka as S,l as a,la as T,ma as U,na as V,oa as W,pa as X,qa as Y,r as b,ra as Z,s as c,sa as _,t as d,ta as $,u as e,ua as aa,v as f,va as ba,w as g,wa as ca,xa as da,y as h,ya as ea,z as i,za as fa}from"./OL7QBAGS.js";import"./S627D4K7.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export{S as Annotation,O as AsyncBatchedStore,Q as BaseChannel,L as BaseCheckpointSaver,l as BaseLangGraphError,N as BaseStore,R as BinaryOperatorAggregate,e as COMMAND_SYMBOL,a as ChatModelStreamImpl,j as Command,f as CommandInstance,Ca as CompiledStateGraph,qa as DeltaChannel,ua as DeltaValue,c as END,C as EmptyChannelError,B as EmptyInputError,$ as EventLog,la as Graph,m as GraphBubbleUp,p as GraphDrained,r as GraphInterrupt,n as GraphRecursionError,ha as GraphRunStream,o as GraphValueError,d as INTERRUPT,P as InMemoryStore,D as InvalidUpdateError,M as MemorySaver,Da as MessageGraph,Ia as MessagesAnnotation,Aa as MessagesDeltaValue,za as MessagesValue,Ja as MessagesZodMeta,Ka as MessagesZodState,E as MultipleSubgraphsError,t as NodeError,s as NodeInterrupt,z as NodeTimeoutError,h as Overwrite,v as ParentCommand,wa as REMOVE_ALL_MESSAGES,sa as ReducedValue,G as RemoteException,X as RunControl,b as START,Y as STREAM_EVENTS_V3_MODES,g as Send,Ba as StateGraph,H as StateGraphInputError,va as StateSchema,$ as StreamChannel,ia as SubgraphRunStream,F as UnreachableNodeError,ta as UntrackedValue,ra as UntrackedValueChannel,xa as addMessages,_ as convertToProtocolEvent,K as copyCheckpoint,ja as createGraphRunStream,ba as createLifecycleTransformer,ca as createMessagesTransformer,ea as createSubgraphDiscoveryTransformer,fa as createValuesTransformer,J as emptyCheckpoint,Ga as entrypoint,aa as filterLifecycleEntries,da as filterSubgraphHandles,V as getConfig,W as getCurrentTaskInput,oa as getJsonSchemaFromSchema,Ha as getPreviousState,pa as getSchemaDefaultGetter,T as getStore,I as getSubgraphsSeenSet,U as getWriter,ka as interrupt,Z as isCheckpointEnvelope,k as isCommand,x as isGraphBubbleUp,q as isGraphDrained,y as isGraphInterrupt,i as isInterrupted,ga as isNativeTransformer,u as isNodeError,A as isNodeTimeoutError,w as isParentCommand,na as isSerializableSchema,ma as isStandardSchema,ya as messagesDeltaReducer,xa as messagesStateReducer,Ea as pushMessage,Fa as task,La as writer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a,b as s,c as o}from"./
|
|
2
|
+
import{a,b as s,c as o}from"./ROQGPAR5.js";import"./RFVZ7KCG.js";import{g as r,h as t,v as i,z as c}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var l=r`.container{color:var(--calcite-color-text-1);min-width:0}.content{min-width:0;overflow-wrap:anywhere}.content>*{margin:0}.content>*+*{margin-block-start:var(--calcite-spacing-sm)}.content :is(ol,ul){padding-inline-start:var(--calcite-spacing-lg)}.content>calcite-table{display:block;max-width:100%}.content pre{background-color:var(--calcite-color-foreground-1);padding:var(--calcite-spacing-sm);border-radius:var(--calcite-border-radius);color:var(--calcite-color-text-1);direction:ltr;max-width:100%;overflow:auto}.content pre code{display:block;white-space:pre;font-family:var(--calcite-code-family)}.part{animation:part-reveal calc(3 * var(--calcite-animation-timing)) ease-out}@keyframes part-reveal{0%{opacity:0;transform:translateY(var(--calcite-size-fixed-xxs))}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.part{animation:none}}`,e=class extends i{static{this.properties={content:1,parts:0}}static{this.styles=l}render(){return t`<div class="container"><div class="content">${this.parts?.map(n=>t`<span class="part">${a(o(n))}</span>`)??a(s(this.content))}</div></div>`}};c("arcgis-assistant-message-text",e);export{e as ArcgisAssistantMessageText};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import p from"./ZZZB3GES.js";import"./XQ3NBBQ3.js";import n from"./MXAZE2VM.js";import{a as o,c as m}from"./V6HOUZPZ.js";import l from"./OZ2CM3J2.js";import"./OOGADOKQ.js";import k from"./UAG6GDUG.js";import j from"./VMZZR7MY.js";import h from"./3SD47V7G.js";import g from"./6GODC6RU.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./RZIXMISL.js";import"./FDOMMK2M.js";import e from"./TBYDZN4H.js";import"./4ALF2CJY.js";import"./725MBCQF.js";import d from"./BQYF37UD.js";import"./3XDT7MWI.js";import"./RN6WMVZX.js";import"./HB72YIII.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./KJLLN4P4.js";import"./HHBNLCJP.js";import"./7QIX4PZR.js";import"./RLB6TK6B.js";import b from"./JWZD3D5E.js";import a from"./UHICISBZ.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./3VCPN2KW.js";import"./S4LELUBK.js";import"./OL7QBAGS.js";import"./S627D4K7.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,{b:p}])=>{var t=class extends i{constructor(){super(...arguments),this.agent=p}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-layer-styling-agent"),this.#i=m(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-layer-styling-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,n,p)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./CCC6LBMY.js";import{a as B,b as S}from"./34O57OGV.js";import a from"./
|
|
2
|
+
import b from"./CCC6LBMY.js";import{a as B,b as S}from"./34O57OGV.js";import a from"./UHICISBZ.js";import{a as g}from"./ONQ6JSBJ.js";import{Dc as h}from"./S627D4K7.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([k,j,{a:m,d:b,e:w,f:F},{d:T}])=>{var q=i=>i.flatMap(t=>t.split(",")).map(t=>t.trim()).map(t=>t.split(/\s+/u)[0]?.replace(/^"|"$/gu,"")).filter(t=>!!t),R=async(i,t,n,a,d)=>{let s=n.map?.allLayers.find(o=>o.id===i.layerId),c=await n.whenLayerView(s),u=s.title??i.layerId,l;if(a){let o=await b(a,n);if("error"in o)return{tool:"getTopFeatures",layerName:u,summary:"Geometry lookup failed",details:{error:o.error}};if(!o.geometry)return{tool:"getTopFeatures",layerName:u,summary:"No features found for geometry filter",details:{error:`No features found matching: ${"where"in a?a.where:"unknown criteria"}`}};l=o.geometry}else d&&(l=n.extent.clone());let y=t.groupByFields&&t.groupByFields.length>0,f=s.objectIdField,p=i.outFields.includes("*")?["*"]:[...new Set([...i.outFields,f])];try{let o;if(y){let r=new k({where:i.where||"1=1",outFields:p,orderByFields:i.orderByFields,geometry:l,spatialRelationship:l?"intersects":void 0,distance:a?.distance,units:a?.units,topFilter:new j({topCount:t.topCount,groupByFields:t.groupByFields,orderByFields:t.orderByFields})});o=await s.queryTopFeatures(r)}else{let r=s.createQuery();r.where=S(s.definitionExpression,i.where||"1=1"),r.outFields=p.length?p:["*"],r.orderByFields=t.orderByFields,r.returnGeometry=!1,r.num=t.topCount,l&&(r.geometry=l,r.spatialRelationship="intersects"),a?.distance&&(r.distance=a.distance),a?.units&&(r.units=a.units),r.outSpatialReference=n.spatialReference;let v=[...new Set([...i.outFields,...q(t.orderByFields)])],N=B(c,v,d??!1);try{o=N?await c.queryFeatures(r):await s.queryFeatures(r)}catch(x){console.warn("Client-side query failed, falling back to server:",x),o=await s.queryFeatures(r)}}let C=o.features.map(r=>r.attributes[f]),{attributes:I}=T(s,o,n.timeZone);return{tool:"getTopFeatures",layerName:u,summary:`Top ${t.topCount} features extracted`,details:{topCount:t.topCount,attributes:I,objectIds:C,objectIdField:f,where:i.where,orderByFields:t.orderByFields,...y&&{groupByFields:t.groupByFields}}}}catch(o){return{tool:"getTopFeatures",layerName:u,summary:"Query failed",details:{error:o instanceof Error?o.message:String(o)}}}},D=async({targetLayer:i,topFilter:t,geometryFilter:n,useCurrentExtent:a},d)=>{let{mapView:s}=g(d,["mapView"]),c=F(n,d.state?.agentExecutionContext?.sharedResources),u=await R(i,t,s,c,a);return JSON.stringify(u,null,2)},E=e.object({layerId:e.string().describe("The layerId of the layer containing the geometry by which to filter."),where:e.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:e.number().optional().describe("The buffer distance around the geometry."),units:m.optional().describe("The units for the distance buffer.")}),L=e.object({point:e.object({x:e.number().describe("X coordinate (longitude) from navigation result"),y:e.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:e.object({wkid:e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:e.number().optional().describe("Optional buffer distance around the point."),units:m.optional().describe("The units for the distance buffer.")}),U=e.object({targetLayer:e.object({layerId:e.string().describe("The layerId of the layer containing the field from which to get a value."),where:e.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:e.array(e.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:e.array(e.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:e.union([E,L,w]).optional().describe("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."),topFilter:e.object({topCount:e.number().describe("Number of top features to return per group."),orderByFields:e.array(e.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")),groupByFields:e.array(e.string().describe("Field(s) to group results by. Returns top N per group."))}).required(),useCurrentExtent:e.boolean().optional().describe("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).")}),Y=h(D,{name:"getTopFeatures",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.',schema:U});return Y},"rest/support/TopFeaturesQuery","rest/support/TopFilter",a,b)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{Va as i}from"./S627D4K7.js";async function n(a,t,e){if(e===void 0)throw new Error(["Unable to dispatch a custom event without a parent run id.",'"dispatchCustomEvent" can only be called from within an existing run (e.g.,',"inside a tool or a RunnableLambda).",`
|
|
3
3
|
|
|
4
4
|
If you continue to see this error, please import from "@langchain/core/callbacks/dispatch/web"`,"and explicitly pass in a config parameter.",`
|
|
5
5
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as n}from"./ONQ6JSBJ.js";import{Dc as o}from"./
|
|
2
|
+
import{a as n}from"./ONQ6JSBJ.js";import{Dc as o}from"./S627D4K7.js";import{a as i}from"./VXFQANGJ.js";async function a(e){let t=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(t)await e.goTo(t);else throw new Error("Initial extent is undefined");return{text:"Successfully zoomed to home extent"}}async function m(e,t){let{mapView:r}=n(t,["mapView"]);return await a(r)}var s=i.object({}),f=o(m,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:s});export{f as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as m}from"./ONQ6JSBJ.js";import{Dc as i}from"./
|
|
2
|
+
import{a as m}from"./ONQ6JSBJ.js";import{Dc as i}from"./S627D4K7.js";import{Dd as e}from"./MWYBF3F3.js";async function s(o,a){let t=a.map.bookmarks;if(!t||t.length===0)throw new Error("No bookmarks found in the map.");let r=t.find(k=>k.name===o);if(!r)throw new Error(`Bookmark with name "${o}" not found.`);let n=r.viewpoint;if(!n)throw new Error(`Bookmark with name "${o}" does not have a valid viewpoint.`);return await a.goTo(n),{text:`Navigated to bookmark: ${o}`}}async function h({bookmarkName:o},a){let{mapView:t}=m(a,["mapView"]);return await Promise.resolve(s(o,t))}var w=e.object({bookmarkName:e.string().describe("The name of the bookmark to navigate to.")}),b=i(h,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:w});export{b as a};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./
|
|
2
|
+
import a from"./6RAWG2KQ.js";import{e as l}from"./XKH37FLY.js";import"./HHBNLCJP.js";import"./OL7QBAGS.js";import"./S627D4K7.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:p,subclass:m},{watch:w},c])=>{var d=Object.defineProperty,f=Object.getOwnPropertyDescriptor,n=(e,r,s,o)=>{for(var t=o>1?void 0:o?f(r,s):r,i=e.length-1,a;i>=0;i--)(a=e[i])&&(t=(o?a(r,s,t):a(t))||t);return o&&t&&d(r,s,t),t},h=class extends c{constructor(e){super(e)}initialize(){this.addHandles(w(()=>[this.name,this.description,this.inputSchema,this.outputSchema,this.workflow],()=>this.generate(),{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,...this.workflow.getAgents().flatMap(e=>e.getSchemas()),this.outputSchema].filter(Boolean)}generate(){let{workspace:e,createGraph:r}=this.workflow.generate();if(this._set("workspace",e),!this.middlewares?.length)this._set("createGraph",r);else{let s=this.id,o={[s]:async(i,a)=>await r().compile().invoke(i,a)},t=[{from:s,decide:()=>{}}];this._set("createGraph",()=>l(o,t,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}}};n([p()],h.prototype,"workflow",2);n([p()],h.prototype,"inputSchema",2);n([p()],h.prototype,"outputSchema",2);h=n([m("WorkflowAgent")],h);return h},"core/accessorSupport/decorators","core/reactiveUtils",a)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./CCC6LBMY.js";import{a as x,b as O}from"./34O57OGV.js";import a from"./
|
|
2
|
+
import b from"./CCC6LBMY.js";import{a as x,b as O}from"./34O57OGV.js";import a from"./UHICISBZ.js";import{a as L}from"./ONQ6JSBJ.js";import{Dc as T}from"./S627D4K7.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([{a:p,b:g,c:b,d:v,e:R,f:j},{d:N}])=>{var w=25,k=i=>i.flatMap(r=>r.split(",")).map(r=>r.trim()).map(r=>r.split(/\s+/u)[0]?.replace(/^"|"$/gu,"")).filter(r=>!!r),E=async(i,r,t,l)=>{let s=r.map?.allLayers.find(u=>u.id===i.layerId),d=await r.whenLayerView(s),f=s.title??i.layerId,h;if(t){let u=await v(t,r);if("error"in u){let o={error:u.error};if(b(t)){let c=r.map?.allLayers.find(m=>m.id===t.layerId);o.geometryLayerName=c?.title??c?.id,o.geometryLayerId=t.layerId,o.geometryWhere=t.where}else g(t)&&(o.point=t.point);return{tool:"queryFeatures",layerName:f,summary:"Geometry lookup failed",details:o}}if(!u.geometry){let o={};if(b(t)){let c=r.map?.allLayers.find(m=>m.id===t.layerId);o.error=`No features found matching: ${t.where}`,o.geometryLayerName=c?.title??c?.id,o.geometryLayerId=t.layerId,o.geometryWhere=t.where}else g(t)&&(o.error="Failed to create point geometry",o.point=t.point);return{tool:"queryFeatures",layerName:f,summary:"No features found for geometry filter",details:o}}h=u.geometry}else l&&(h=r.extent.clone());let C=[...new Set([...i.outFields,...k(i.orderByFields)])],F=x(d,C,l??!1),I=s.objectIdField,a=s.createQuery();a.where=O(s.definitionExpression,i.where||"1=1"),a.outFields=i.outFields.includes("*")?["*"]:[...new Set([...i.outFields,I])],a.orderByFields=i.orderByFields,h&&(a.geometry=h,a.spatialRelationship="intersects"),t?.distance&&(a.distance=t.distance),t?.units&&(a.units=t.units),a.outSpatialReference=r.spatialReference;let n,y;try{n=F?await d.queryFeatureCount(a):await s.queryFeatureCount(a),n>0&&n<=w&&(y=F?await d.queryFeatures(a):await s.queryFeatures(a))}catch(u){console.warn("Client-side query failed, falling back to server:",u),n=await s.queryFeatureCount(a),n>0&&n<=w&&(y=await s.queryFeatures(a))}let{objectIds:q,attributes:S}=y?N(s,y,r.timeZone):{objectIds:void 0,attributes:void 0};return{tool:"queryFeatures",layerName:f,summary:`${n} features found`,details:{totalCount:n,where:i.where,orderByFields:i.orderByFields,outFields:i.outFields,...q&&{objectIds:q,objectIdField:I},...S&&{attributes:S},...n>w&&{note:`${n} features found.`}}}};async function W({targetLayer:i,geometryFilter:r,useCurrentExtent:t},l){let{mapView:s}=L(l,["mapView"]),d=j(r,l.state?.agentExecutionContext?.sharedResources),f=await E(i,s,d,t);return JSON.stringify(f,null,2)}var B=e.object({layerId:e.string().describe("The layerId of the layer containing the geometry by which to filter."),where:e.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:e.number().optional().describe("The buffer distance around the geometry."),units:p.optional().describe("The units for the distance buffer.")}),U=e.object({point:e.object({x:e.number().describe("X coordinate (longitude) from navigation result"),y:e.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:e.object({wkid:e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:e.number().optional().describe("Optional buffer distance around the point."),units:p.optional().describe("The units for the distance buffer.")}),D=e.object({targetLayer:e.object({layerId:e.string().describe("The layerId of the layer containing the field from which to get a value."),where:e.string().describe("SQL-92 where clause. IMPORTANT: When using geometryFilter.point or geometryFilter.sharedResourceId for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."),orderByFields:e.array(e.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:e.array(e.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:e.union([B,U,R]).optional().describe("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."),useCurrentExtent:e.boolean().optional().describe("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).")}),H=T(W,{name:"queryFeatures",description:`Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if \u226425 features match.
|
|
3
3
|
|
|
4
4
|
USE THIS TOOL FOR:
|
|
5
5
|
- "Show / display / list features where..." \u2014 finding and listing features
|
|
@@ -8,4 +8,4 @@ USE THIS TOOL FOR:
|
|
|
8
8
|
- Spatial queries \u2014 finding features near/within/intersecting other features
|
|
9
9
|
- Any question where the user wants to SEE or COUNT matching features
|
|
10
10
|
|
|
11
|
-
This is the DEFAULT tool for most queries. When in doubt, use this tool.`,schema:
|
|
11
|
+
This is the DEFAULT tool for most queries. When in doubt, use this tool.`,schema:D});return H},a,b)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{c}from"./
|
|
2
|
+
import{c}from"./XKH37FLY.js";export default $arcgis.t(([l,{property:i,subclass:y},{watch:d}])=>{var w=Object.defineProperty,g=Object.getOwnPropertyDescriptor,t=(s,a,p,o)=>{for(var r=o>1?void 0:o?g(a,p):a,h=s.length-1,n;h>=0;h--)(n=s[h])&&(r=(o?n(a,p,r):n(r))||r);return o&&r&&w(a,p,r),r},m=()=>{throw new Error("createGraph method not implemented.")},e=class extends l{constructor(){super(...arguments),this.description="",this.middlewares=[],this.createGraph=m,this.workspace=c()}initialize(){this.addHandles([d(()=>[this.name,this.description],()=>this.generate(),{initial:!0,sync:!0}),d(()=>this.createGraph,()=>this._compiledGraph=void 0)])}get id(){return this.name.replace(/\s+/gu,"-").toLowerCase()}get registration(){return{id:this.id,name:this.name,description:this.description,createGraph:this.createGraph,workspace:this.workspace}}async run(s={},a){return this.createGraph===m&&this.generate(),this._compiledGraph=this._compiledGraph??this.createGraph().compile(),await this._compiledGraph.invoke(s,a)}};t([i({readOnly:!0})],e.prototype,"id",1);t([i()],e.prototype,"name",2);t([i()],e.prototype,"description",2);t([i()],e.prototype,"middlewares",2);t([i({readOnly:!0})],e.prototype,"createGraph",2);t([i({readOnly:!0})],e.prototype,"workspace",2);t([i({readOnly:!0})],e.prototype,"registration",1);e=t([y("BaseAgent")],e);return e},"core/Accessor","core/accessorSupport/decorators","core/reactiveUtils")
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import
|
|
2
|
+
import{a as I}from"./RFVZ7KCG.js";import b from"./EJJFG5DE.js";import{a as $}from"./434TAA3J.js";import{b as D}from"./6OOZSZRJ.js";import{a as M}from"./3UEKINYC.js";import"./RLEHNAIA.js";import a from"./KJLLN4P4.js";import"./HHBNLCJP.js";import{g as C,h,k as A,l as P,n as g,t as v,u as f,v as T,x as y,z as L}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./3VCPN2KW.js";import"./S4LELUBK.js";import"./OL7QBAGS.js";import"./S627D4K7.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([B,{whenOnce:q,watch:V,when:j},F,,N,,,H,{property:b,subclass:W},,{b:R}])=>{var G=C`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;function x(o){return o.trim()?I.lexer(o).filter(t=>t.type!=="space").map(t=>I.parser([t])):[]}var w=class{constructor(){this._stableParts=[],this._stableText="",this._rawText=""}push(t){return this._rawText+=t,this._advanceStableBoundary(),this.getParts()}finalize(){let t=this._rawText.slice(this._stableText.length);return t.trim()&&(this._stableParts.push(...x(t)),this._stableText=this._rawText),this._stableParts}getParts(){let t=this._trimIncompleteTail(this._rawText.slice(this._stableText.length)),e=t.trim()?x(t):[];return[...this._stableParts,...e]}reset(){this._stableParts=[],this._stableText="",this._rawText=""}_advanceStableBoundary(){let t=this._rawText.slice(this._stableText.length),e=this._lastSafeBoundary(t);if(e<=0)return;let i=t.slice(0,e);this._stableParts.push(...x(i)),this._stableText+=i}_lastSafeBoundary(t){let e=t.split(`
|
|
3
3
|
`),i=!1,r=0,s=0;for(let l of e)/^\s*(```|~~~)/u.test(l)&&(i=!i),s+=l.length+1,l.trim()===""&&!i&&(r=s);return r<t.length?r:0}_trimIncompleteTail(t){let e=t.lastIndexOf("<");if(e!==-1&&!t.includes(">",e))return t.slice(0,e);let i=this._earliestUnclosedTag(t);if(i!==-1)return t.slice(0,i);let r=t.lastIndexOf("[");if(r!==-1){let s=t.slice(r);if(!/\[[^\]]*\]\([^)]*\)/u.test(s))return t.slice(0,r)}return t}_earliestUnclosedTag(t){let e=new Set(["br","img","hr","input","meta","link","area","base","col","embed","source","track","wbr"]),i=/<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu,r=[];for(let s=i.exec(t);s;s=i.exec(t)){let[,l,a,n]=s,c=a.toLowerCase();if(!(e.has(c)||n==="/"))if(l==="/"){for(let d=r.length-1;d>=0;d--)if(r[d].name===c){r.splice(d);break}}else r.push({name:c,index:s.index})}return r.length?r[0].index:-1}};function Z(o){let t=new w;return t.push(o),t.finalize()}var J=async o=>await new Promise(t=>setTimeout(t,o));async function*K(o,{chunkSize:t=15,delay:e=50}={}){let i=new w;for(let r=0;r<o.length;r+=t)yield i.push(o.slice(r,r+t)),await J(e);yield i.finalize()}var Q=Object.defineProperty,X=Object.getOwnPropertyDescriptor,m=(o,t,e,i)=>{for(var r=i>1?void 0:i?X(t,e):t,s=o.length-1,l;s>=0;s--)(l=o[s])&&(r=(i?l(t,e,r):l(r))||r);return i&&r&&Q(t,e,r),r},U=o=>!o||typeof o!="object"?!1:o.name==="AbortError";async function*O(o,t,e,i,r=!1){if(r){if(i?.aborted){yield{type:"cancelled",log:e,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:Z(o)},runId:t};return}for await(let s of K(o)){if(i?.aborted){yield{type:"cancelled",log:e,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:s},runId:t}}}var p=class extends H{constructor(o){super(o),this.view=null,this.streamingDisabled=!1,this.runtimeEventsEnabled=!1,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await q(()=>!this.view.updating),this._set("orchestrator",await R.init({agents:[...this.agents],runtimeEventsEnabled:this.runtimeEventsEnabled,view:this.view??void 0})),this.addHandles([V(()=>[this.view,this.agents],()=>{this._initialize()})])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(o,t,e){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let i=[],r,s="pending";try{let l=this.orchestrator.ask(o,t);for await(let a of l)switch(s=a.runId,a.type){case"runtime":{yield{type:"runtime",event:a,runId:s};break}case"trace":{this._set("processingStep",a.data.text),i.push(a.data.text);break}case"completed":{this._set("processing",!1),this._set("processingStep","");let n=a.result,c=!!n.content.length,d=!!r?.length;if(!c&&!d){yield{type:"completed",error:"No response received.",log:i,runId:s};return}let u=n.content;if(yield{type:"block-start",blockType:"text",runId:s},yield*O(u,s,i,e,this.streamingDisabled),yield{type:"block-end",blockType:"text",runId:s},d)for(let k of r){if(e?.aborted){yield{type:"cancelled",log:i,runId:s};return}let{type:_,data:E}=k;if(yield{type:"block-start",blockType:_,runId:s},_==="text"){let z=typeof E?.content=="string"?E.content:"";yield*O(z,s,i,e,this.streamingDisabled)}else yield{type:"block-data",blockType:_,data:E,runId:s};yield{type:"block-end",blockType:_,runId:s}}yield{type:"completed",response:u,blocks:r,log:i,runId:s};return}case"ux-suggestion":{let n=a.suggestion;r=r?[...r,n]:[n];break}case"interrupt":{let{kind:n,message:c,metadata:d}=a.interrupt,u=Array.isArray(d)?d.filter(_=>typeof _=="string"):[],k=(()=>{switch(n){case"booleanChoice":return{type:"boolean-choice",message:c,options:u};case"singleSelection":return{type:"single-select",message:c,options:u};case"multipleSelection":return{type:"multi-select",message:c,options:u};case"textInput":return{type:"text-input",message:c};default:return{type:n,message:c,options:u}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:k,runId:s};break}case"cancelled":{yield{type:"cancelled",log:i,runId:s};return}case"error":{if(e?.aborted||U(a.error)){yield{type:"cancelled",log:i,runId:s};return}yield{type:"completed",error:a.error.message,log:i,runId:s};return}default:{console.warn("Unknown event type:",a);break}}}catch(l){if(e?.aborted||U(l)){yield{type:"cancelled",log:i,runId:s};return}console.warn("Error during message processing:",l),yield{type:"completed",error:"An error occurred during message processing.",log:i,runId:"error"};return}finally{this._set("processing",!1)}}cancel(){this.orchestrator?.cancel()}};m([b({readOnly:!0})],p.prototype,"orchestrator",2);m([b()],p.prototype,"agents",2);m([b()],p.prototype,"portal",2);m([b()],p.prototype,"view",2);m([b()],p.prototype,"streamingDisabled",2);m([b()],p.prototype,"runtimeEventsEnabled",2);m([b({readOnly:!0})],p.prototype,"loading",2);m([b({readOnly:!0})],p.prototype,"processing",2);m([b({readOnly:!0})],p.prototype,"processingStep",2);p=m([W("OrchestratorController")],p);var Y="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",tt="Embeddings not found for this web map.",et="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",S=class extends T{constructor(){super(...arguments),this._messages=D({blocking:!0}),this.#t=v(),this.#o=v(),this.#s=v(),this.#e=null,this.#r=new Map,this.#i=F.getDefault(),this.#a=t=>{t.stopPropagation(),this.cancelInterrupt()},this.#n=t=>{t.stopPropagation();let e=t.detail;this.submitInterrupt(e)},this.#l=t=>{t.stopPropagation(),this.keepSuggestedPrompts||(this.suggestedPrompts=[]);let e=t.detail;this._inputValue="",this.arcgisSubmit.emit(e),this.submitMessage(e)},this.#c=t=>{if(this._canceling=!0,t.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this._orchestratorController?.cancel(),this.#e?.abort(),this.#e=null},this.#h=t=>{t.stopPropagation();let e=t.detail;this.arcgisFeedback.emit(e)},this.#d=t=>{t.stopPropagation();let e=t.detail;this._inputValue=e.prompt,this.arcgisPromptSelect.emit(e)},this.#u=t=>{this.arcgisSlottableRequest.emit(t.detail)},this._orchestratorController=null,this._interrupt=null,this._interruptDetails=[],this._error=null,this._inputValue="",this._isAnswering=!1,this._canceling=!1,this.messages=new B([]),this.referenceElement=null,this.suggestedPrompts=[],this.feedbackEnabled=!1,this.keepSuggestedPrompts=!1,this.streamingDisabled=!1,this.runtimeEventsEnabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.voiceInputEnabled=!1,this.readAloudEnabled=!1,this.assistantAvatarEnabled=!1,this.userAvatarEnabled=!1,this.arcgisCancel=g(),this.arcgisError=g(),this.arcgisFeedback=g(),this.arcgisInterrupt=g(),this.arcgisInterruptCancel=g(),this.arcgisInterruptSubmit=g(),this.arcgisPromptSelect=g(),this.arcgisReady=g(),this.arcgisResponse=g(),this.arcgisRuntime=g({bubbles:!1,composed:!1}),this.arcgisSlottableRequest=g({bubbles:!1,composed:!1}),this.arcgisSubmit=g()}static{this.properties={_orchestratorController:16,_interrupt:16,_interruptDetails:16,_error:16,_inputValue:16,_isAnswering:16,_signedInUserId:16,_canceling:16,_isSignedIn:16,_user:16,awaitingResponse:32,awaitingResponseStep:32,interrupt:32,messages:0,orchestrator:32,entryMessage:1,heading:1,description:1,referenceElement:1,alwaysUseAgentId:1,allowedAgentIds:0,suggestedPrompts:0,feedbackEnabled:5,keepSuggestedPrompts:5,streamingDisabled:5,runtimeEventsEnabled:5,logEnabled:5,copyEnabled:5,voiceInputEnabled:5,readAloudEnabled:5,assistantAvatarEnabled:5,userAvatarEnabled:5}}static{this.styles=G}#t;#o;#s;#e;#r;#i;#a;#n;#l;#c;#h;#d;#u;get _isSignedIn(){return!!this.#i?.user||!!this._signedInUserId}get _user(){return this.#i?.user?.fullName||this.#i?.user?.username}get awaitingResponse(){return this._orchestratorController?.processing??!1}get awaitingResponseStep(){return this._orchestratorController?.processingStep??""}get interrupt(){return this._interrupt}get orchestrator(){return this._orchestratorController?.orchestrator}cancelInterrupt(){this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}register(t){this.#r.set(t.agent.id,t),this._orchestratorController&&this.#g()}submitInterrupt(t){this.arcgisInterruptSubmit.emit(t),this._interrupt&&(this._interruptDetails=[...this._interruptDetails,{interrupt:this._interrupt,response:t}]),this.orchestrator?.resumeInterrupt(t),this._interrupt=null}async submitMessage(t){let e=t.trim();if(!e||(this.messages.push({id:Date.now().toString(),role:"user",content:e}),!this._orchestratorController))return;this.#e=new AbortController,this._orchestratorController.streamingDisabled=this.streamingDisabled;let i=this.alwaysUseAgentId?{routing:"direct",agentId:this.alwaysUseAgentId}:{routing:"auto",agentIds:this.allowedAgentIds},r=this._orchestratorController.ask(e,i,this.#e?.signal);for await(let s of r){let l=s.runId,a=this.messages.at(-1);switch(s.type){case"runtime":this.arcgisRuntime.emit(s.event);break;case"block-start":{this._isAnswering=!0;let n={type:s.blockType,isPending:!0};if(a?.role==="assistant"&&a.id===l){let c=[...a.blocks??[],n];this.messages.splice(-1,1,{...a,blocks:c})}else this.messages.push({role:"assistant",blocks:[n],id:l,isStreaming:!0,interrupts:this._interruptDetails}),this._interruptDetails=[];break}case"block-data":{if(a?.role!=="assistant"||a?.id!==l)break;let n=[...a.blocks??[]],c=n[n.length-1],{blockType:d,data:u}=s;if(c?.type!==d||!c.isPending)break;d==="text"?n[n.length-1]={...c,data:{...c.data,parts:u?.parts}}:n[n.length-1]={...c,data:{...c.data,...u??{}}},this.messages.splice(-1,1,{...a,blocks:n});break}case"block-end":{if(a?.role!=="assistant"||a?.id!==l)break;let n=[...a.blocks??[]],c=n[n.length-1];if(c?.type!==s.blockType||!c.isPending)break;let d=c;n[n.length-1]={...d,data:{...d.data},isPending:!1},this.messages.splice(-1,1,{...a,blocks:n});break}case"completed":s.error?(this.messages.push({role:"assistant",log:s.log,error:s.error,id:l,interrupts:this._interruptDetails}),this._interruptDetails=[]):a?.role==="assistant"&&a.id===l&&this.messages.splice(-1,1,{...a,content:s.response,blocks:a.blocks?.map(n=>({...n,data:{...n.data},isPending:!1}))??[],isStreaming:!1,log:s.log}),this._isAnswering=!1,this.#e=null,this._canceling=!1;break;case"interrupt":this._interrupt={...s.payload,id:l},this.arcgisInterrupt.emit(this._interrupt);break;case"cancelled":a?.role==="assistant"&&a.id===l?this.messages.splice(-1,1,{...a,blocks:a.blocks?.filter(n=>n.type==="text"||!n.isPending)??[],isStreaming:!1,log:s.log,error:`(${this._messages.stoppedByUserLabel})`}):(this.messages.push({role:"assistant",log:s.log,error:`(${this._messages.stoppedByUserLabel})`,id:l,interrupts:this._interruptDetails}),this._interruptDetails=[]),this._isAnswering=!1,this.#e=null,this._canceling=!1;break}}}unregister(t){this.#r.delete(t),this._orchestratorController&&this.#g()}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#t.value?.addEventListener("arcgisPromptSelect",this.#d),this.#t.value?.addEventListener("arcgisSubmit",this.#l),this.#t.value?.addEventListener("arcgisCancel",this.#c),this.#t.value?.addEventListener("arcgisFeedback",this.#h);let t=j(()=>!!this._interrupt&&!!this.#s.value,()=>{let i=this.#s.value;i.removeEventListener("arcgisSubmit",this.#n),i.removeEventListener("arcgisCancel",this.#a),i.addEventListener("arcgisSubmit",this.#n,{once:!0}),i.addEventListener("arcgisCancel",this.#a,{once:!0})}),e=this.messages.on("after-add",i=>{let r=i.item;r.role==="assistant"&&(r.error||r.content)&&this.arcgisResponse.emit(r)});return queueMicrotask(()=>{this.#p()}),()=>{t.remove(),e.remove(),this.#t.value?.removeEventListener("arcgisPromptSelect",this.#d),this.#s.value?.removeEventListener("arcgisSubmit",this.#n),this.#s.value?.removeEventListener("arcgisCancel",this.#a),this.#t.value?.removeEventListener("arcgisSubmit",this.#l),this.#t.value?.removeEventListener("arcgisCancel",this.#c),this.#t.value?.removeEventListener("arcgisFeedback",this.#h),this._orchestratorController?.destroy(),this._orchestratorController=null}})}willUpdate(t){this.hasUpdated&&t.has("runtimeEventsEnabled")&&this._orchestratorController&&(this._orchestratorController.destroy(),this._orchestratorController=null,this.#p())}async#g(){try{this._error=null;let t=M(this.el,this.referenceElement);await t?.componentOnReady();let e=[...this.#r.values()];return e.length?(this._orchestratorController?.destroy(),this._orchestratorController=new p({agents:e,portal:this.#i,runtimeEventsEnabled:this.runtimeEventsEnabled,streamingDisabled:this.streamingDisabled,view:t?.view}),await this._orchestratorController.load(),this.requestUpdate(),!0):(this._error=this._messages.noAgentsFoundMessage,!1)}catch(t){return this._error=t?.message??this._messages.orchestratorInitializationErrorMessage,P(this)(t),!1}}async#p(){await this.#g()?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))}_reset(){this._orchestratorController?.cancel(),this.#e?.abort(),this._interrupt=null,this.messages.removeAll(),this._error=null,this._inputValue="",this._signedInUserId=void 0}_renderEntryMessage(){return this._isSignedIn?this._error?this._renderErrorNotice():this.entryMessage?this.messages.length>0?null:h`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>`:h`<slot name=entry-message></slot>`:this._renderSignInNotice()}_renderSignInNotice(){let t=this.#i;return h`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${t?h`<calcite-link slot=link @click=${async()=>{try{let e=await N.getCredential(`${t.url}/sharing`);this._signedInUserId=e.userId,this._error=null,this.requestUpdate(),await this.#p()}catch(e){this._error=e?.message??this._messages.signInErrorMessage,this.arcgisError.emit(new Error(this._error)),A("error",this,"Error signing in:",{detail:{error:e}})}}} target=_blank title=${this._messages.signInToArcGISOnlineLabel??y}>${this._messages.signInLabel}</calcite-link>`:h`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`}_renderErrorNotice(){return this._error?h`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error===Y?h`<div slot=message>${tt}</div><calcite-link slot=link .href=${et} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel??y}>${this._messages.readMoreLabel}</calcite-link>`:h`<div slot=message>${this._error}</div>`}</calcite-notice>`:null}render(){return h`<calcite-panel .loading=${!this._orchestratorController&&!this._error||this._orchestratorController?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} ${f(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map(t=>t.role==="assistant"?h`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#u} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((e,i)=>h`<slot name=${$(t.id,i)??y} slot=${$(t.id,i)??y}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>`:h`<arcgis-assistant-user-message .message=${t} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt?h`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>`:h`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt?h`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${f(this.#s)}></arcgis-assistant-interrupt></slot>`:this.suggestedPrompts?.length?h`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>`:null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse||this._isAnswering} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling||!this._isSignedIn||!!this._interrupt||!!this._error} ${f(this.#o)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse||this._isAnswering?"circle-stop":"send"} @click=${()=>{this.#o.value?.submitMessage()}} round>${this.awaitingResponse||this._isAnswering?this._messages.stopButtonLabel:this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`}};L("arcgis-assistant",S);return S},"core/Collection","core/reactiveUtils","portal/Portal","request","identity/IdentityManager","config","layers/FeatureLayer","core/Accessor","core/accessorSupport/decorators",a,b)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as u}from"./ONQ6JSBJ.js";import{Dc as d}from"./
|
|
2
|
+
import{a as u}from"./ONQ6JSBJ.js";import{Dc as d}from"./S627D4K7.js";import{Dd as s}from"./MWYBF3F3.js";async function f(o,a,n){let e=n.map?.allLayers.find(r=>r.id===o);if(!e)return{text:`Error: Layer with id ${o} not found`};let t=a?.trim()?a:"1=1",l=e.createQuery();l.where=t;try{let{extent:r,count:i}=await e.queryExtent(l);if(i===0)return{text:`No features found in ${e.title} matching: ${t}`,where:t};if(r)await n.goTo(r);else return{text:`Error: Unable to determine extent for ${e.title}`,where:t};let c={layerId:o,layerTitle:e.title??o,where:t,count:i};return{text:`Successfully zoomed to ${i} feature(s) in ${e.title} matching: ${t}`,where:t,sharedStatePatch:{lastNavigatedFeatures:{value:c}}}}catch(r){return console.error("Error in goToFeatures:",r),{text:`Error: ${r instanceof Error?r.message:"Unknown error"}`,where:t}}}async function h({layerId:o,where:a},n){let{mapView:e}=u(n,["mapView"]);return await f(o,a,e)}var m=s.object({layerId:s.string().describe("The layerId of the layer to zoom to."),where:s.string().describe("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.")}),E=d(h,{name:"goToFeatures",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.",schema:m});export{E as a};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import"./UZLQALHY.js";var e=`---
|
|
3
|
+
name: help
|
|
4
|
+
description: Answers questions about the current map, its layers and fields, available assistant capabilities, unsupported map actions, and unrelated requests that need a map-focused redirect.
|
|
5
|
+
allowed-tools: listLayerFields
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Help
|
|
9
|
+
|
|
10
|
+
- Use the runtime context supplied with this skill as the authoritative source for map, layer, field, and capability information.
|
|
11
|
+
- List layers using the layers in the runtime context.
|
|
12
|
+
- When the user explicitly asks for fields, columns, or attributes of a named layer, call \`listLayerFields\` with that layer title. Do not use \`listLayerFields\` for general help, capability summaries, or layer listings.
|
|
13
|
+
- Summarize what the map contains using its actual layer titles, descriptions, and fields.
|
|
14
|
+
- Explain available capabilities using only the registered agents in the runtime context. Do not claim an action is supported unless a registered agent description supports it.
|
|
15
|
+
- For requests such as "what can I ask?", suggest 3-5 concise examples that use actual layer and field names from the map context.
|
|
16
|
+
- If a map-related action is unsupported, say so directly and suggest a nearby supported capability when one is available.
|
|
17
|
+
- You know only this map and the registered assistant capabilities. For unrelated questions, politely say that you do not have that information and redirect to a specific map-related question using the returned context.
|
|
18
|
+
- Keep responses concise. Use bullets for lists and never invent map details, fields, agents, or capabilities.
|
|
19
|
+
`;export{e as default};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{ta as c}from"./S627D4K7.js";function f(e,s,t){return{...e,status:s,summary:t}}function g(e){let s=Object.entries(e).filter(([t,n])=>t!=="agentExecutionContext"&&t!=="outputMessage"&&t!=="summary"&&t!=="status"&&n!==void 0);if(s.length!==0)try{return JSON.stringify(Object.fromEntries(s),null,2)}catch{return}}function m(e,s,t=[]){let n=s.safeParse(e);if(n.success){let u={...n.data},r=g(u),a=r??"LLMAgent produced structured output.",o=r??u.outputMessage,i={...u,...o?{outputMessage:o}:{},agentExecutionContext:{messages:[...t,new c(typeof o=="string"&&o.trim()?o:a)]}};return f(i,"success",a)}else throw new Error(`LLMAgent output schema validation failed: ${n.error.message}`)}function l(e,s){let t={outputMessage:e.outputMessage};if(s){let n=s.shape,u=e;for(let r of Object.keys(n??{}))r in e&&(t[r]=u[r])}return t}export{f as a,m as b,l as c};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as f}from"./ONQ6JSBJ.js";import{Dc as o}from"./
|
|
2
|
+
import{a as f}from"./ONQ6JSBJ.js";import{Dc as o}from"./S627D4K7.js";import{a as l}from"./VXFQANGJ.js";var i=a=>{let r=a.map?.allLayers.filter(t=>t.type==="feature"),e=0;return r?.forEach(t=>{let s=t;s.featureEffect&&(s.featureEffect=null,e++)}),e>0?`Cleared filters from ${e} layer(s). View unchanged.`:"No active filters to clear. View unchanged."},n=async(a,r)=>{let{mapView:e}=f(r,["mapView"]);return i(e)},h=o(n,{name:"clearFilters",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.",schema:l.object({})});export{h as a};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import x from"./RSR66KB4.js";import w from"./MG2W2ZF3.js";import t from"./BTTBKTFM.js";import s from"./ZZZB3GES.js";import{a as $}from"./XQ3NBBQ3.js";import r from"./PWFUEBTT.js";import q from"./MXAZE2VM.js";import p from"./OZ2CM3J2.js";import{a as ne}from"./OOGADOKQ.js";import o from"./RHYNE5OE.js";import n from"./UAG6GDUG.js";import m from"./VMZZR7MY.js";import l from"./3SD47V7G.js";import k from"./6GODC6RU.js";import i from"./CCC6LBMY.js";import"./34O57OGV.js";import{a as K}from"./RZIXMISL.js";import{a as u}from"./FDOMMK2M.js";import h from"./TBYDZN4H.js";import{a as Y}from"./4ALF2CJY.js";import{a as ee}from"./725MBCQF.js";import g from"./BQYF37UD.js";import{a as ae}from"./3XDT7MWI.js";import{a as se}from"./RN6WMVZX.js";import{a as oe}from"./HB72YIII.js";import f from"./EJJFG5DE.js";import e from"./KJLLN4P4.js";import{e as G,f as D}from"./HHBNLCJP.js";import"./7QIX4PZR.js";import"./RLB6TK6B.js";import c from"./JWZD3D5E.js";import a from"./UHICISBZ.js";import{a as b}from"./ONQ6JSBJ.js";import"./R74ZHFA6.js";import{a as d,b as H}from"./3VCPN2KW.js";import"./S4LELUBK.js";import{Ya as T,r as v,s as y}from"./OL7QBAGS.js";import{ta as j}from"./S627D4K7.js";import{a as M}from"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([be,Se,,,,,,,{b:O,g:P,h:Z,i:W,j:B,k:R,l:C,m:J,n:_,o:q,p:S,q:Q,r:U},{a:F,b:Te},te,X,{a:N},,,,,ie,re,{b:k,c:L,d:x,e:w,f:A,g:le,h:I,i:ce,v:z},pe,{a:E,b:ue},me,ge,de])=>{var ke=async e=>{let t=e.allLayers.toArray(),a=[],r=new Map;for(let s of t)if(s instanceof be){let o=(async()=>{let i=await Q(s),n=await U(s,i);r.set(s.id,{layerItem:n,fieldRegistry:i})})();a.push(o)}return await Promise.all(a),r},$e=async e=>{await Se.whenOnce(()=>e.ready);let t=await ke(e.map),{layers:a}=await Me(t),r={schemaVersion:P,modified:Date.now(),embeddings:{modelProvider:W,model:B,dimensions:Z,templates:{layer:R,field:C}},layers:a},s=J.safeParse(r);if(!s.success)throw console.error("Schema Mismatch:",s.error.format()),new Error("Webmap embedding generation failed validation.");return s.data},Me=async e=>{let t=[],a=[];for(let[o,{fieldRegistry:i,layerItem:n}]of e.entries()){let l=he(R,{name:n.name,title:n.title,description:n.description});t.push(l);let c={id:o,name:n.name??"",title:n.title,description:n.description,vector:[],fields:[]};for(let[,m]of i.entries()){let g=he(C,{name:m.name,alias:m.alias,description:m.description});t.push(g),c.fields.push({name:m.name,alias:m.alias,description:m.description,vector:[]})}a.push(c)}let r=await F(t),s=0;return{layers:a.map(o=>(o.vector=r[s++],o.fields.forEach(i=>{i.vector=r[s++]}),o))}},he=(e,t)=>e.replace(/\{(\w+)\}/gu,(a,r)=>t[r]??""),Re=(e,t)=>{if(e.length!==t.length)throw new Error("Vectors must be the same length");let a=0,r=0,s=0;for(let n=0;n<e.length;++n){let l=e[n],c=t[n];a+=l*c,r+=l*l,s+=c*c}let o=Math.sqrt(r*s);if(o===0)return 0;let i=a/o;return Math.max(-1,Math.min(1,i))},V=[X,Y,ee,te,ae,se,oe,re,ne];async function Ce(e,t){let a=await x("navigation_tool_prompt"),{mapView:r}=b(t,["mapView"]),s=r.map.bookmarks?.map(f=>f.name).filter(Boolean)??[],o=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((f,ve)=>`${ve+1}. layerId=${f.id} | title=${f.title??""} | name=${f.name??""} | score=${f.score.toFixed(2)}`).join(`
|
|
3
|
+
`):"",i=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",n=e.intent==="goToBookmark"&&s.length?`Available bookmarks:
|
|
4
|
+
${s.map(f=>`- ${f}`).join(`
|
|
5
|
+
`)}`:"",l=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
|
|
6
|
+
${o}`:"",c=e.intent==="goToFeatures"&&e.vectorSearchFieldResults?.length?`Candidate fields:
|
|
7
|
+
${i}`:"",m={intent:e.intent,bookmarksSection:n,layersSection:l,fieldsSection:c,currentZoom:r.zoom,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},g=await S({promptText:a,modelTier:"fast",config:t,inputVariables:m,tools:V});await E(g,t);let p=(g.tool_calls?.length??0)>0,h=typeof g.text=="string"?g.text.trim():"",Ee=h.length>0;return{...e,navigationInternalState:{...e.navigationInternalState,toolCallMessage:p?g:void 0},outputMessage:p?e.outputMessage:h,status:p?e.status:Ee?"success":"failed"}}var _e=e=>{let t=typeof e=="string"?e:String(e);try{let a=JSON.parse(t);if(a&&typeof a=="object"&&typeof a.text=="string")return a}catch{console.warn("Failed to parse tool response as JSON:",t)}return{text:t}};async function qe(e,t){let a=new k(V,{handleToolErrors:!1});try{let r=e.navigationInternalState.toolCallMessage;if(!r)throw new Error("navigationToolCalling: missing navigationInternalState.toolCallMessage");let{messages:s}=await a.invoke({messages:[r]},t),o="",i,n;for(let l of s){let c=_e(l.content),m=l.artifact;c.text&&(o+=`${c.text}
|
|
8
|
+
`);let g=m?.sharedStatePatch??c.sharedStatePatch;g&&(i={...i,...g}),m?.sharedResourceAdditions&&(n=[...n??[],...m.sharedResourceAdditions])}return await d({text:`Finished executing navigation tool: ${o}`},t),{...e,outputMessage:o,sharedStatePatch:i,sharedResourceAdditions:n,status:"success",summary:o?w(o):"Navigation executed.",navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}catch(r){let s=r instanceof Error?r.message:String(r);return await d({text:`Navigation tool execution failed: ${s}`},t),{...e,outputMessage:`Navigation tool execution failed: ${s}`,status:"failed",summary:`Navigation tool execution failed: ${s}`,navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}}async function Fe(e,t){let a=await x("navigation_intent_prompt"),{mapView:r}=b(t,["mapView"]),s=V.map(g=>({name:g.name,description:g.description,schema:g.schema})),o=r.map.bookmarks?.map(g=>g.name).filter(Boolean)??[],i=o.length?`Available bookmarks:
|
|
9
|
+
${o.map(g=>`- ${g}`).join(`
|
|
10
|
+
`)}`:"No bookmarks are available in this map.",n={tools:s.map(({name:g,description:p,schema:h})=>`${g}: ${p}, ${JSON.stringify(h)}`).join(`
|
|
11
|
+
`),bookmarks:i,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},l=M.object({intent:M.string()}),c=await q({promptText:a,config:t,inputVariables:n,schema:l,modelTier:"fast"}),m=typeof c.intent=="string"?c.intent.trim().replace(/^"|"$/gu,""):"";return{...e,intent:m||""}}var Ne=.7,Le=async(e,t)=>{try{await d({text:`Similarity search to find layers: ${e.agentExecutionContext.assignedTask}`},t);let a=u(t,"layerSearch"),r=u(t,"layersAndFieldsRegistry"),s=u(t,"embeddingCache"),o=(await a.searchLayers({text:e.agentExecutionContext.assignedTask,minScore:Ne,embeddingCache:s})).map(({id:n,score:l})=>{let c=r.get(n)?.layerItem;return{id:n,title:c?.title,name:c?.name??void 0,score:l}}),i;return o.length>0?i=`Vector search completed. Matching layers:
|
|
12
|
+
${o.map(n=>`- layerId=${n.id} | title=${n.title??""} | name=${n.name??""} | score=${n.score.toFixed(2)}`).join(`
|
|
13
|
+
`)}`:i="Vector search completed. No matching layers found.",await d({text:i},t),{...e,vectorSearchLayerResults:o}}catch(a){throw await d({text:`Error during vector search layers: ${a instanceof Error?a.message:String(a)}`},t),a}},fe=.7,Ae=10,Ie=async(e,t)=>{try{await d({text:`Similarity search to find fields: ${e.agentExecutionContext.assignedTask}`},t);let a=u(t,"fieldSearch"),r=u(t,"layersAndFieldsRegistry"),s=u(t,"embeddingCache"),o=e.vectorSearchLayerResults?.map(l=>l.id)??[];if(o.length===0)return await d({text:"No candidate layers for field search"},t),e;let i=(await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:o,minScore:fe,topResults:Ae,embeddingCache:s})).map(({layerId:l,results:c})=>{let m=r.get(l)?.fieldRegistry;return{layerId:l,layerName:r.get(l)?.layerItem.name,results:c.map(g=>{let p=m?.get(g.name);return{name:g.name,score:g.score,type:p?.type,alias:p?.alias,description:p?.description,statistics:p?.statistics,domain:p?.domain}})}}),n;return i.length>0?n=`Vector search completed. Matching layers and fields:
|
|
14
|
+
${i.map(l=>`${l.layerName??l.layerId}:
|
|
15
|
+
${l.results.map(c=>` - ${c.name} (${c.score.toFixed(2)})`).join(`
|
|
16
|
+
`)}`).join(`
|
|
17
|
+
`)}`:n=`No vector search field results found for score over ${fe}.`,await d({text:n},t),{...e,vectorSearchFieldResults:i}}catch(a){throw await d({text:`Error during vector search fields: ${a instanceof Error?a.message:String(a)}`},t),a}},ze=(e,t)=>$(["layerSearch","layersAndFieldsRegistry"],"Navigation Agent")(e,t),Ve=()=>new T(L).addNode("requireNavigationServices",ze).addNode("intentLLM",Fe).addNode("vectorSearchLayers",Le).addNode("vectorSearchFields",Ie).addNode("agent",Ce).addNode("tools",qe).addEdge(v,"requireNavigationServices").addEdge("requireNavigationServices","intentLLM").addConditionalEdges("intentLLM",e=>e.intent==="goToLayer"||e.intent==="goToFeatures"?"vectorSearchLayers":"agent",{vectorSearchLayers:"vectorSearchLayers",agent:"agent"}).addConditionalEdges("vectorSearchLayers",e=>e.intent==="goToFeatures"?"vectorSearchFields":"agent",{vectorSearchFields:"vectorSearchFields",agent:"agent"}).addEdge("vectorSearchFields","agent").addEdge("agent","tools").addEdge("tools",y),je=String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
|
|
18
|
+
This includes zooming, panning, centering, or geocoding based on user input. The agent is designed to handle explicit map movement requests. NOTE: DO NOT call this agent if the user asks "show me...", that is meant to be handled by another agent. If the query is about where a certain address is, call this agent.
|
|
19
|
+
|
|
20
|
+
Supported actions:
|
|
21
|
+
- **Zooming**: Adjust the map's zoom level (e.g., "Zoom to level 10", "Zoom in").
|
|
22
|
+
- **Viewpoints**: Navigate to a specific center point with optional zoom or scale (e.g., "Center the map on San Francisco at zoom level 16").
|
|
23
|
+
- **Scales**: Set the map to a specific scale (e.g., "Set the map scale to 1:50,000").
|
|
24
|
+
- **Layers**: Zoom to the full extent of a specific layer (e.g., "Go to the water mains layer"). For the purposes of link charts, if the user requests to go to the extent of a link chart or the entities/nodes within it, that should be treated as a request to use the goToLayer tool on the link chart layer
|
|
25
|
+
- **Features**: Zoom to features in a layer that match a filter (e.g., "Zoom to all schools in the city").
|
|
26
|
+
- **Bookmarks**: Navigate to a predefined bookmark extent (e.g., "Go to the Downtown bookmark").
|
|
27
|
+
- **Extents**: Reset to the initial web map extent or zoom to the full world extent (e.g., "Reset the map", "Zoom to the full world extent").
|
|
28
|
+
- **Addresses**: Zoom to an address or place name (e.g., "Zoom to 1600 Pennsylvania Ave").
|
|
29
|
+
|
|
30
|
+
_Example: “Zoom to Texas”_
|
|
31
|
+
_Example: “Go to the water mains layer”_
|
|
32
|
+
_Example: “Zoom to to the extent of my link chart”_
|
|
33
|
+
_Example: “Center the map on San Francisco at scale 50000”_
|
|
34
|
+
_Example: “Zoom to the features in the schools layer where city = 'Austin'”_
|
|
35
|
+
_Example: “Go to the Downtown bookmark”_
|
|
36
|
+
_Example: “Where is Mount Rainier?”_`,Oe={id:"navigationGraph",name:"Navigation Graph Agent",description:je,createGraph:Ve,workspace:L},Ge=async(e,t)=>(await d({text:"Exiting Data Exploration agent"},t),e),De=async(e,t)=>{await d({text:"Requesting LLM for layer filter results"},t);let a=await x("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:r,userTimezoneOffset:s}=N(),o={layerFieldInfo:e.layerFieldInfo,userTimezone:r,userTimezoneOffset:s,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},i=await S({promptText:a,modelTier:"default",config:t,messages:e.dataExplorationMessages,inputVariables:o,tools:I}),n=[...e.dataExplorationMessages,i];if(!((i.tool_calls?.length??0)>0))return await d({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:n};let l=n,c=i.content.toString();return await E(i,t),{...e,dataExplorationMessages:l,outputMessage:c}},He=async(e,t)=>{await d({text:"Requesting LLM for layer query results"},t);let a=await x("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:r,userTimezoneOffset:s}=N(),o=e.agentExecutionContext.sharedState,i=o.lastNavigatedFeatures?.value,n=o.lastResolvedLocation?.value,l="none";if(i!=null)try{l=JSON.stringify(i)}catch{l="none"}let c="none";if(n!=null)try{c=JSON.stringify({address:n.address,location:n.location})}catch{c="none"}let m={layerFieldInfo:e.layerFieldInfo,userTimezone:r,userTimezoneOffset:s,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,lastNavigatedFeatures:l,lastResolvedLocation:c},g=await S({promptText:a,modelTier:"default",config:t,messages:e.dataExplorationMessages,inputVariables:m,tools:le}),p=(g.tool_calls?.length??0)>0,h=g.content.toString();return await E(g,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,g],...p?{}:{outputMessage:h},status:"success",summary:h&&!p?w(h):"Query planning completed."}},Pe=async(e,t)=>{try{await d({text:"Requesting LLM for summary on query results"},t);let a=await x("summarize_query_response_prompt"),r={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},s=await _({promptText:a,modelTier:"fast",config:t,messages:e.dataExplorationMessages,inputVariables:r}),o=typeof s=="string"?s:s.content,i=new j(o);await d({text:`Received response from LLM: ${o}`},t);let n=o;return{...e,outputMessage:n,status:"success",summary:n?w(n):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,i]}}catch(a){throw await d({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function Ze(e,t){if((e.queryResponse??[]).some(r=>{let s=r.details;return typeof s=="object"&&s!==null&&"error"in s}))return await d({text:"Skipping layer filter tool because query response contains an error."},t),{...e};let a=await new k(I,{handleToolErrors:!1}).invoke({messages:e.dataExplorationMessages},t);return await d({text:`Finished executing layer filter tool: ${a.messages.map(r=>r.content).join(", ")}`},t),{...e}}var ye=/\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;function We(e,t){return ye.test(e)||ye.test(t)}var Be=async(e,t)=>{try{await d({text:"Preparing field information for vector search results"},t);let a=u(t,"layersAndFieldsRegistry"),{mapView:r}=b(t,["mapView"]),{assignedTask:s,userRequest:o}=e.agentExecutionContext,i=We(s,o),{layerFieldInfo:n,didFetchStatistics:l,fieldStatisticsFetchStatus:c}=await ie(e.vectorSearchFieldResults,a,r,i);l?await d({text:"Statistics fetched"},t):await d({text:"Statistics skipped"},t);for(let m of c)await d({text:` - ${m.fieldName} - stats ${m.didFetchStatistics?"fetched":"skipped"}`},t);return await d({text:"Field information prepared"},t),{...e,layerFieldInfo:n}}catch(a){throw await d({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},xe=.7,Je=10,Qe=async(e,t)=>{try{await d({text:"Similarity search to find fields"},t);let a=u(t,"fieldSearch"),r=u(t,"layersAndFieldsRegistry"),s=u(t,"embeddingCache"),o=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:xe,topResults:Je,embeddingCache:s}),i=o.map(({layerId:l,results:c})=>{let m=c.map(g=>` - ${g.name} (${g.score.toFixed(2)})`).join(`
|
|
37
|
+
`);return`${r.get(l)?.layerItem.name??l}:
|
|
38
|
+
${m}`}).join(`
|
|
39
|
+
`),n;return o.length>0?n=`Vector search completed. Matching layers and fields with scores:
|
|
40
|
+
${i}`:n=`No vector search results found for score over ${xe}.`,await d({text:n},t),{...e,vectorSearchFieldResults:o}}catch(a){throw await d({text:`Error during vector search: ${a instanceof Error?a.message:String(a)}`},t),new Error(`Vector search failed: ${a instanceof Error?a.message:String(a)}`)}},Ue=.7,Ke=async(e,t)=>{try{await d({text:`Similarity search to find layers: ${e.agentExecutionContext.assignedTask}`},t);let a=u(t,"layerSearch"),r=u(t,"layersAndFieldsRegistry"),s=u(t,"embeddingCache"),o=await a.searchLayers({text:e.agentExecutionContext.assignedTask,minScore:Ue,embeddingCache:s}),i=o.map(c=>c.id),n=o.map(({id:c,score:m})=>`${r.get(c)?.layerItem.name??c} (${m.toFixed(2)})`).join(`
|
|
41
|
+
`),l;return i.length>0?l=`Vector search completed. Matching layers with scores:
|
|
42
|
+
${n}`:l="Vector search completed. No matching layers found.",await d({text:l},t),{...e,vectorSearchLayerIds:i}}catch(a){throw await d({text:`Error during vector search: ${a instanceof Error?a.message:String(a)}`},t),new Error(`Vector search failed: ${a instanceof Error?a.message:String(a)}`)}},Xe=(e,t)=>$(["layerSearch","fieldSearch","layersAndFieldsRegistry"],"Data Exploration Agent")(e,t),Ye=()=>new T(A).addNode("requireDataExplorationServices",Xe).addNode("vectorSearchLayers",Ke).addNode("vectorSearchFields",Qe).addNode("fieldStatistics",Be).addNode("queryAgent",He).addNode("queryTools",ce).addNode("summarizeQueryResponseLLM",Pe).addNode("filterAgent",De).addNode("filterTools",Ze).addNode("earlyExit",Ge).addEdge(v,"requireDataExplorationServices").addEdge("requireDataExplorationServices","vectorSearchLayers").addConditionalEdges("vectorSearchLayers",e=>e.vectorSearchLayerIds.length?"vectorSearchFields":"earlyExit").addConditionalEdges("vectorSearchFields",e=>e.vectorSearchFieldResults.length?"fieldStatistics":"earlyExit").addEdge("fieldStatistics","queryAgent").addConditionalEdges("queryAgent",e=>(e.dataExplorationMessages[e.dataExplorationMessages.length-1]?.tool_calls?.length??0)>0?"queryTools":"filterAgent").addConditionalEdges("queryTools",e=>e.queryResponse.length?"summarizeQueryResponseLLM":"filterAgent").addEdge("summarizeQueryResponseLLM","filterAgent").addConditionalEdges("filterAgent",e=>(e.dataExplorationMessages[e.dataExplorationMessages.length-1]?.tool_calls?.length??0)>0?"filterTools":y).addEdge("filterTools",y).addEdge("earlyExit",y),et=String.raw`- **data exploration** — User is asking about the feature layer’s data (e.g. counts, summaries, statistics, field values), either for all features, a subset based on a condition, or for a subset based on the current view. And/Or user wants to include or exclude features based on field values, or visually style features differently (e.g., highlight or deemphasize them).
|
|
43
|
+
The Data Exploration Agent will automatically zoom to the affected features for action taken by this agent. In this case, no need to call navigation tool separately.
|
|
44
|
+
_Example: “Only show stations where Brand is Shell”_
|
|
45
|
+
_Example: “Make Shell stations stand out on the map”_
|
|
46
|
+
_Example: “Gray out all stations that aren’t Shell”_
|
|
47
|
+
This also includes questions that ask which feature meets a given condition or where a particular feature in the data is located (e.g., “Where is the spring with the highest elevation?”). However, this agent does not handle addresses.
|
|
48
|
+
_Example: “How many features are there?”_
|
|
49
|
+
_Example: “What’s the average population?”_
|
|
50
|
+
_Example: “Which values are in the status field?”_
|
|
51
|
+
|
|
52
|
+
This agent does NOT handle help/metadata requests such as listing available layers, listing field names/columns/attributes for a layer, or capability guidance.`,tt={id:"dataExplorationGraph",name:"Data Exploration Graph Agent",description:et,createGraph:Ye,workspace:A},we=[K],at=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:a,fieldRegistry:r},s)=>{let o=Array.from(r.values()).map(n=>n.name).slice(0,10).join(", "),i=r.size>10?` (and ${r.size-10} more)`:"";return`${s+1}. "${a.title}". Description: ${a.description}
|
|
53
|
+
Fields: ${o}${i}`}).join(`
|
|
54
|
+
|
|
55
|
+
`);return`This map contains ${e.size} layer(s):
|
|
56
|
+
|
|
57
|
+
${t}`},st=e=>{let t=e?.list()??[];return t.length?t.map(a=>`- ${a.agent.name}: ${a.agent.description}`).join(`
|
|
58
|
+
`):"No agents currently available."};async function ot(e,t){let a=await x("help_prompt"),r=u(t,"layersAndFieldsRegistry"),s=u(t,"agentRegistry");try{let o=await S({promptText:a,modelTier:"default",config:t,tools:we,inputVariables:{layerSummary:at(r),agents:st(s),assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps}});await E(o,t);let i=(o.tool_calls?.length??0)>0,n=typeof o.text=="string"?o.text.trim():"";return{...e,helpInternalState:{...e.helpInternalState,toolCallMessage:i?o:void 0},outputMessage:i?e.outputMessage:n,summary:i?"Prepared help tool call from assigned task.":"Provided map-related help based on the assigned task.",status:i?e.status:"success"}}catch(o){let i=o instanceof Error?o.message:String(o);return{...e,outputMessage:`Error invoking help agent: ${i}`,summary:"Help agent execution failed.",status:"failed"}}}var rt=(e,t)=>$(["agentRegistry"],"Help Agent")(e,t);async function nt(e,t){let a=new k(we,{handleToolErrors:!1});try{let r=e.helpInternalState.toolCallMessage;if(!r)throw new Error("helpToolCalling: missing helpInternalState.toolCallMessage");let s=(await a.invoke({messages:[r]},t)).messages.map(o=>o.text).join(`
|
|
59
|
+
`);return await d({text:`Finished executing help tool: ${s}`},t),{...e,outputMessage:s,status:"success",summary:s?w(s):"Help executed.",helpInternalState:{...e.helpInternalState,toolCallMessage:void 0}}}catch(r){let s=r instanceof Error?r.message:String(r);return await d({text:`Help tool execution failed: ${s}`},t),{...e,outputMessage:`Help tool execution failed: ${s}`,status:"failed",summary:`Help tool execution failed: ${s}`,helpInternalState:{...e.helpInternalState,toolCallMessage:void 0}}}}var it=()=>new T(z).addNode("requireHelpServices",rt).addNode("agent",ot).addNode("tools",nt).addEdge(v,"requireHelpServices").addEdge("requireHelpServices","agent").addConditionalEdges("agent",e=>e.helpInternalState.toolCallMessage?"tools":y).addEdge("tools",y),lt=String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
|
|
60
|
+
|
|
61
|
+
_Example: “Tell me about this map”_
|
|
62
|
+
_Example: “List all layers in this map”_
|
|
63
|
+
_Example: “List fields in protected areas layer”_
|
|
64
|
+
_Example: “What agents are available to me?”_
|
|
65
|
+
_Example: “What can you do?”_
|
|
66
|
+
_Example: “What can I ask”_
|
|
67
|
+
|
|
68
|
+
If the user asks unrelated queries like "What are the vowels in English alphabet" or "How to cook", call this agent so it can politely refuse and redirect to map-related questions.
|
|
69
|
+
|
|
70
|
+
IF the user asks map related queries, but those that are not performed by any of the agents, call this agent so we can respond that the requested action is not supported.
|
|
71
|
+
_Example: "Create a chart"_
|
|
72
|
+
_Example: "Create a table"_`,ct={id:"helpGraph",name:"Help Graph Agent",description:lt,createGraph:it,workspace:z},Ut=_,Kt=q,Xt=S,Yt=d,ea=F,ta=Re,aa=pe,sa=Oe,oa=ue,ra=de,na=tt,ia=ge,la=ct,ca=me,da=$e,ga=()=>G(),ma=()=>D(),ua=async(e,t)=>await H(e,t),pa=async({modelTier:e="default",config:t}={})=>await O({modelTier:e,config:t});return{ArcgisKnowledgeAgent:ca,DataExplorationAgent:ra,DataExplorationGraphAgent:na,HelpAgent:ia,HelpGraphAgent:la,LayerStylingAgent:oa,NavigationAgent:aa,NavigationGraphAgent:sa,Orchestrator:Te,cosineSimilarity:ta,createAgentRuntimeState:ga,createAgentRuntimeStateWithSharedState:ma,createChatModel:pa,createWebmapEmbeddings:da,getEmbeddings:ea,invokeStructuredPrompt:Kt,invokeTextPrompt:Ut,invokeToolPrompt:Xt,sendTraceMessage:Yt,sendUXSuggestion:ua}},"layers/FeatureLayer","core/reactiveUtils","identity/IdentityManager","portal/Portal","request","config",a,c,e,f,g,h,i,k,l,m,n,o,p,q,r,s,t,w,x)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as d,b as S,c as v}from"./7EOS4SGJ.js";import b from"./6RAWG2KQ.js";import{d as f,e as y}from"./XKH37FLY.js";import a from"./KJLLN4P4.js";import{c as u}from"./TEI6WXW7.js";import{b as h}from"./S4LELUBK.js";import{P as l,aa as g}from"./OL7QBAGS.js";export default $arcgis.t(([,,,{watch:T},,{property:m,subclass:_},{b:c},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(t,r,e,s)=>{for(var o=s>1?void 0:s?x(r,e):r,n=t.length-1,p;n>=0;n--)(p=t[n])&&(o=(s?p(r,e,o):p(o))||o);return s&&o&&k(r,e,o),o},i=class extends w{constructor(t){super(t),this.modelTier="default"}initialize(){this.addHandles(T(()=>[this.description,this.inputSchema,this.modelTier,this.name,this.outputSchema,this.prompt,this.tools],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let t=f(this.getSchemas());this._set("workspace",t);let r=this.id,e={[r]:this._invoke.bind(this)},s=[{from:r,decide:()=>{}}];this._set("createGraph",()=>y(e,s,t,{agent:this,entryNode:r,middlewares:this.middlewares}))}async _invoke(t,r){try{return this.outputSchema?await this._invokeStructured(t,r):await this._invokeUnstructured(t,r)}catch(e){if(l(e))throw e;let s=e instanceof Error?e.message:String(e);return d({outputMessage:s},"failed",s)}}async _invokeStructured(t,r){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let e=await h({model:await c({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:t.agentExecutionContext.messages},r);if(!("structuredResponse"in e)||e.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(e.structuredResponse,this.outputSchema,e.messages)}async _invokeUnstructured(t,r){let e=(await h({model:await c({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares)}).invoke({messages:t.agentExecutionContext.messages},r)).messages,s=e.at(-1)?.content??"",o=typeof s=="string"?s:JSON.stringify(s),n=o.trim()||"LLMAgent completed.";return d({agentExecutionContext:{...t.agentExecutionContext,messages:e},outputMessage:o},"success",n)}async _getPromptWithInputVariables(t){let r=v(t,this.inputSchema);for(let{outputKey:e}of this.middlewares)e&&(r[String(e)]=t[e]);return await g.fromTemplate(this.prompt).format(r)}_getTools(){return this.tools?.map(t=>"getTool"in t?t.getTool():t)??[]}};a([m()],i.prototype,"prompt",2);a([m()],i.prototype,"tools",2);a([m()],i.prototype,"inputSchema",2);a([m()],i.prototype,"outputSchema",2);a([m()],i.prototype,"modelTier",2);i=a([_("LLMAgent")],i);return i},"identity/IdentityManager","portal/Portal","request","core/reactiveUtils","layers/FeatureLayer","core/accessorSupport/decorators",a,b)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import n from"./RSR66KB4.js";import m from"./MXAZE2VM.js";import{a as o,c as p}from"./V6HOUZPZ.js";import l from"./OZ2CM3J2.js";import"./OOGADOKQ.js";import k from"./UAG6GDUG.js";import j from"./VMZZR7MY.js";import h from"./3SD47V7G.js";import g from"./6GODC6RU.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./RZIXMISL.js";import"./FDOMMK2M.js";import e from"./TBYDZN4H.js";import"./4ALF2CJY.js";import"./725MBCQF.js";import d from"./BQYF37UD.js";import"./3XDT7MWI.js";import"./RN6WMVZX.js";import"./HB72YIII.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./KJLLN4P4.js";import"./HHBNLCJP.js";import"./7QIX4PZR.js";import"./RLB6TK6B.js";import b from"./JWZD3D5E.js";import a from"./UHICISBZ.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./3VCPN2KW.js";import"./S4LELUBK.js";import"./OL7QBAGS.js";import"./S627D4K7.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,m])=>{var t=class extends i{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-data-exploration-agent"),this.#i=p(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-data-exploration-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import a from"./
|
|
2
|
+
import a from"./JKKU4K4C.js";import"./XKH37FLY.js";import"./HHBNLCJP.js";import"./OL7QBAGS.js";import"./S627D4K7.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:l,subclass:w},{c:p,d:d}])=>{var y=Object.defineProperty,m=Object.getOwnPropertyDescriptor,f=e=>{throw TypeError(e)},h=(e,t,o,n)=>{for(var r=n>1?void 0:n?m(t,o):t,s=e.length-1,g;s>=0;s--)(g=e[s])&&(r=(n?g(t,o,r):g(r))||r);return n&&r&&y(t,o,r),r},k=(e,t,o)=>t.has(e)||f("Cannot "+o),b=(e,t,o)=>t.has(e)?f("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),c=(e,t,o)=>(k(e,t,"access private method"),o),a,i,u=class extends d{constructor(e){super(e),b(this,a)}getAgents(){return c(this,a,i).call(this),[this.routerAgent,...Object.values(this.agentsMap)]}buildEdges(e){c(this,a,i).call(this);let t=p(this.routerAgent,0),o=new Map;for(let[n,[r]]of Object.entries(this.agentsMap).entries())o.set(r,p(e[n+1],n+1));return[{from:t,decide:n=>{let r=n[this.routerOutputKey];if(typeof r!="string"||!r)throw new Error("RouterWorkflow decideRoute could not determine next agent from state.");let s=o.get(r);if(!s)throw new Error(`RouterWorkflow decideRoute returned unknown agent: ${r}. Expected one of: ${Object.keys(this.agentsMap).join(", ")||"(none)"}.`);return s}}]}getEntryNode(){return c(this,a,i).call(this),p(this.routerAgent,0)}isTerminalAgent(e,t){return t>0}validateAgents(e){c(this,a,i).call(this),super.validateAgents(e)}};a=new WeakSet;i=function(){if(!Object.keys(this.agentsMap).length)throw new Error("RouterWorkflow requires a non-empty agentsMap.")};h([l()],u.prototype,"agentsMap",2);h([l()],u.prototype,"routerAgent",2);h([l()],u.prototype,"routerOutputKey",2);u=h([w("RouterWorkflow")],u);return u},"core/accessorSupport/decorators",a)
|