@arcgis/ai-components 5.2.0-next.72 → 5.2.0-next.73
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-utils/LLMAgent.d.ts +5 -2
- package/dist/agent-utils/LLMAgent.js +1 -1
- package/dist/agentic-workflow/jsonTypes.d.ts +8 -1
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +2 -0
- package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
- package/dist/cdn/2EJROB32.js +2 -0
- package/dist/cdn/34O57OGV.js +2 -0
- package/dist/cdn/3LXXSMA5.js +2 -0
- package/dist/cdn/3MJQA533.js +2 -0
- package/dist/cdn/3U476GCP.js +5 -0
- package/dist/cdn/3XXZUQMQ.js +2 -0
- package/dist/cdn/4YDXYW4J.js +2 -0
- package/dist/cdn/4ZUUS4DH.js +2 -0
- package/dist/cdn/527C4GD2.js +36 -0
- package/dist/cdn/5Y6TQAJN.js +2 -0
- package/dist/cdn/65IWA2PM.js +2 -0
- package/dist/cdn/{5SFZS2RD.js → 67YCNNCN.js} +2 -2
- package/dist/cdn/6FKLWNGA.js +2 -0
- package/dist/cdn/6RDKDLSX.js +2 -0
- package/dist/cdn/6SGNSDLY.js +2 -0
- package/dist/cdn/7747YL7V.js +2 -0
- package/dist/cdn/7TO56JHS.js +2 -0
- package/dist/cdn/ABXLPDEK.js +2 -0
- package/dist/cdn/BBJDW6GC.js +2 -0
- package/dist/cdn/{33BF35AO.js → C4FKFOU4.js} +4 -4
- package/dist/cdn/CCC6LBMY.js +2 -0
- package/dist/cdn/{55M2HE4U.js → CGVVL52C.js} +1 -1
- package/dist/cdn/DKLK4EUE.js +2 -0
- package/dist/cdn/E25RINU2.js +2 -0
- package/dist/cdn/E62P76TP.js +2 -0
- package/dist/cdn/E7JLG2A2.js +2 -0
- package/dist/cdn/FDOMMK2M.js +2 -0
- package/dist/cdn/GG3AESSV.js +2 -0
- package/dist/cdn/H6JSNAT4.js +2 -0
- package/dist/cdn/HNMFFLSY.js +2 -0
- package/dist/cdn/ITBQGOMF.js +11 -0
- package/dist/cdn/JH6EAWB2.js +2 -0
- package/dist/cdn/JON2JHS2.js +2 -0
- package/dist/cdn/JWPB3XZM.js +2 -0
- package/dist/cdn/JXB4TNSG.js +2 -0
- package/dist/cdn/KRN6AFNB.js +18 -0
- package/dist/cdn/KZACIY2W.js +2 -0
- package/dist/cdn/MKJS7QYQ.js +2 -0
- package/dist/cdn/N735LT4S.js +2 -0
- package/dist/cdn/NP7DG7LQ.js +2 -0
- package/dist/cdn/NTZAOJH5.js +2 -0
- package/dist/cdn/{DWYODVWW.js → OHMNQ3RU.js} +5 -5
- package/dist/cdn/ONQ6JSBJ.js +2 -0
- package/dist/cdn/QNNGPA3Q.js +2 -0
- package/dist/cdn/RATZTLNX.js +2 -0
- package/dist/cdn/RU5DVLYG.js +156 -0
- package/dist/cdn/SABZC4D4.js +2 -0
- package/dist/cdn/TYL5G7KR.js +2 -0
- package/dist/cdn/{NJJYZP3R.js → UAZLKUFN.js} +1 -1
- package/dist/cdn/VBZ5XGAM.js +2 -0
- package/dist/cdn/VXBUMZYR.js +2 -0
- package/dist/cdn/W5FLNFSN.js +2 -0
- package/dist/cdn/W5J4Q3RO.js +14 -0
- package/dist/cdn/XGBEHER5.js +2 -0
- package/dist/cdn/YGCTAIBS.js +2 -0
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +938 -1938
- package/dist/chunks/adapter10.js +21 -0
- package/dist/chunks/adapter11.js +30 -0
- package/dist/chunks/adapter12.js +22 -0
- package/dist/chunks/adapter13.js +22 -0
- package/dist/chunks/adapter14.js +109 -0
- package/dist/chunks/adapter15.js +40 -0
- package/dist/chunks/adapter16.js +154 -0
- package/dist/chunks/adapter17.js +141 -0
- package/dist/chunks/adapter18.js +127 -0
- package/dist/chunks/adapter2.js +52 -0
- package/dist/chunks/adapter3.js +30 -0
- package/dist/chunks/adapter4.js +50 -0
- package/dist/chunks/adapter5.js +27 -0
- package/dist/chunks/adapter6.js +24 -0
- package/dist/chunks/adapter7.js +26 -0
- package/dist/chunks/adapter8.js +21 -0
- package/dist/chunks/adapter9.js +42 -0
- package/dist/chunks/arcgisKnowledgeGraph.js +5 -5
- package/dist/chunks/dataExplorationGraph.js +30 -27
- package/dist/chunks/fetchAgentContext.js +13 -0
- package/dist/chunks/fetchService.js +10 -0
- package/dist/chunks/formatFeatureAttributes.js +132 -0
- package/dist/chunks/helpGraph.js +11 -9
- package/dist/chunks/layerStylingGraph.js +22 -21
- package/dist/chunks/mergeWhereClauses.js +15 -0
- package/dist/chunks/navigationGraph.js +68 -57
- package/dist/chunks/types.js +59 -0
- package/dist/components/arcgis-assistant-agent/customElement.js +404 -279
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +15 -5
- package/dist/components/arcgis-assistant-help-agent/customElement.js +21 -5
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +39 -22
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +22 -5
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +13 -5
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +4 -4
- package/dist/cdn/BAB3MK4Y.js +0 -2
- package/dist/cdn/BMBV6Y2A.js +0 -2
- package/dist/cdn/D3RKQSWS.js +0 -2
- package/dist/cdn/IGQFAL3H.js +0 -2
- package/dist/cdn/NSXX2KYS.js +0 -2
- package/dist/cdn/OFRFP4BX.js +0 -2
- package/dist/cdn/OUFGJV3R.js +0 -2
- package/dist/cdn/RWM5T4XB.js +0 -180
- package/dist/cdn/SRFLL6ET.js +0 -2
- package/dist/cdn/WDOM6Z5O.js +0 -18
- package/dist/cdn/Z4XUJQ2I.js +0 -36
|
@@ -1,7 +1,10 @@
|
|
|
1
|
+
import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
1
2
|
import type { BaseAgent } from "./BaseAgent.js";
|
|
2
3
|
import type { FunctionToolLike } from "./tools/FunctionTool.js";
|
|
3
4
|
import type { AgentCustomState, AgentData, ZodObjectSchema } from "./types.js";
|
|
4
5
|
|
|
6
|
+
export type LLMAgentTool = FunctionToolLike | StructuredToolInterface;
|
|
7
|
+
|
|
5
8
|
/**
|
|
6
9
|
* LLMAgent uses a language model to generate its output based on a provided prompt template and optional tools.
|
|
7
10
|
* It supports structured input and output through Zod schemas, allowing for validation and type safety. The agent's logic is defined by the prompt and the tools it has access to, making it a flexible option for a wide range of use cases.
|
|
@@ -39,8 +42,8 @@ export class LLMAgent<TInput extends AgentData = AgentData, TOutput extends Agen
|
|
|
39
42
|
* @required
|
|
40
43
|
*/
|
|
41
44
|
accessor prompt: string;
|
|
42
|
-
/** The tools property is an optional array of
|
|
43
|
-
accessor tools:
|
|
45
|
+
/** The tools property is an optional array of tools that the agent can use during execution. */
|
|
46
|
+
accessor tools: LLMAgentTool[] | undefined;
|
|
44
47
|
/**
|
|
45
48
|
* Rebuilds internal workspace and createGraph wiring. This is automatically called during initialization and whenever
|
|
46
49
|
* the name or description properties change, but can also be called manually if needed to refresh the agent's graph definition.
|
|
@@ -113,7 +113,7 @@ let a = class extends v {
|
|
|
113
113
|
return await S.fromTemplate(this.prompt).format(r);
|
|
114
114
|
}
|
|
115
115
|
_getTools() {
|
|
116
|
-
return this.tools?.map((t) => t.getTool()) ?? [];
|
|
116
|
+
return this.tools?.map((t) => "getTool" in t ? t.getTool() : t) ?? [];
|
|
117
117
|
}
|
|
118
118
|
//#endregion
|
|
119
119
|
};
|
|
@@ -45,6 +45,13 @@ export type AgenticWorkflowPromptJson = AgenticWorkflowJsonObject
|
|
|
45
45
|
readonly type: "plain_text";
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
+
export type AgenticWorkflowArcgisToolJson = AgenticWorkflowJsonObject
|
|
49
|
+
& {
|
|
50
|
+
readonly type: "arcgis_tool";
|
|
51
|
+
readonly name: string;
|
|
52
|
+
readonly require_approval: AgenticWorkflowApprovalRequirementJson;
|
|
53
|
+
};
|
|
54
|
+
|
|
48
55
|
export type AgenticWorkflowJsonObject = { readonly [key: string]: AgenticWorkflowJsonValue | undefined; };
|
|
49
56
|
|
|
50
57
|
export type AgenticWorkflowJsonValue = AgenticWorkflowJsonObject | AgenticWorkflowJsonPrimitive | AgenticWorkflowJsonValue[] | undefined;
|
|
@@ -126,7 +133,7 @@ export type AgenticWorkflowStructuredJsonPropertyJson = AgenticWorkflowJsonObjec
|
|
|
126
133
|
readonly additionalProperties?: boolean;
|
|
127
134
|
};
|
|
128
135
|
|
|
129
|
-
export type AgenticWorkflowToolJson = AgenticWorkflowMcpToolJson;
|
|
136
|
+
export type AgenticWorkflowToolJson = AgenticWorkflowArcgisToolJson | AgenticWorkflowMcpToolJson;
|
|
130
137
|
|
|
131
138
|
export type AgenticWorkflowMcpToolJson = AgenticWorkflowJsonObject
|
|
132
139
|
& {
|
|
@@ -3,6 +3,7 @@ import type { AgenticWorkflowAgentNodeJson } from "../jsonTypes.js";
|
|
|
3
3
|
import type { Prompt } from "./support/Prompt.js";
|
|
4
4
|
import type { AgentData, ZodObjectSchema } from "../../agent-utils/types.js";
|
|
5
5
|
import type { RuntimeNode, NodeCompilation, NodeCompilationContext } from "../types.js";
|
|
6
|
+
import type { ArcgisTool } from "./tools/ArcgisTool.js";
|
|
6
7
|
|
|
7
8
|
/** @internal */
|
|
8
9
|
export class AgentNode extends BaseNode {
|
|
@@ -11,6 +12,7 @@ export class AgentNode extends BaseNode {
|
|
|
11
12
|
constructor(properties?: AgentNodeConstructProperties);
|
|
12
13
|
accessor outputSchema: ZodObjectSchema<AgentData> | undefined;
|
|
13
14
|
accessor prompt: Prompt | undefined;
|
|
15
|
+
accessor tools: ArcgisTool[] | undefined;
|
|
14
16
|
/**
|
|
15
17
|
* The type of this node, which identifies it as an agent node within the workflow.
|
|
16
18
|
*
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type Accessor from "@arcgis/core/core/Accessor.js";
|
|
2
|
+
import type { AgenticWorkflowArcgisToolJson } from "../../jsonTypes.js";
|
|
3
|
+
import type { StructuredToolInterface } from "@langchain/core/tools";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Portal configuration for ArcGIS tools.
|
|
7
|
+
*
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export class ArcgisTool extends Accessor {
|
|
11
|
+
/** @param json */
|
|
12
|
+
static fromJSON(json: AgenticWorkflowArcgisToolJson): ArcgisTool;
|
|
13
|
+
constructor(properties?: ArcgisToolConstructProperties);
|
|
14
|
+
accessor name: string | undefined;
|
|
15
|
+
accessor requireApproval: "always" | "never" | undefined;
|
|
16
|
+
/** @default "arcgis-tool" */
|
|
17
|
+
accessor type: "arcgis-tool";
|
|
18
|
+
createRuntimeTools(): Promise<StructuredToolInterface[]>;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type ArcgisToolConstructProperties = Pick<ArcgisTool, "name" | "requireApproval">;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{b as D,c as M}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import d from"./3LXXSMA5.js";import"./M3MRIGDZ.js";import b from"./6QJFOL6M.js";import{a as R,b as F,e as W}from"./UZL6UVE4.js";import a from"./ZJEWP2ND.js";import{e as q}from"./HO2YDJI2.js";import{v as P,z as I}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./S3XUYAUX.js";import"./WZFC5HUX.js";import{W as C,ia as v}from"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import{Dd as c}from"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([z,U,{property:n,subclass:l},O,N,,,,,,,L,$])=>{var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,y=(t,e,o,s)=>{for(var r=s>1?void 0:s?Y(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&X(e,o,r),r},p=class extends N{constructor(t){super(t)}static fromJSON(t){return new p({id:t.id,sourceAnchorId:t.source_anchor_id,sourceNodeId:t.source_node_id,targetAnchorId:t.target_anchor_id,targetNodeId:t.target_node_id})}};y([n()],p.prototype,"id",2);y([n()],p.prototype,"sourceAnchorId",2);y([n()],p.prototype,"sourceNodeId",2);y([n()],p.prototype,"targetAnchorId",2);y([n()],p.prototype,"targetNodeId",2);p=y([l("Edge")],p);var tt=Object.defineProperty,et=Object.getOwnPropertyDescriptor,S=(t,e,o,s)=>{for(var r=s>1?void 0:s?et(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&tt(e,o,r),r},m=class extends N{constructor(t){super(t)}async load(){return await Promise.resolve(this)}compile(t){return{runtimeNode:this.createRuntimeNode(),edges:t.outgoingEdges.map(e=>({from:this.id,to:e.targetNodeId}))}}static fromJSON(t){throw new Error("BaseNode is abstract and cannot be instantiated directly.")}};S([n()],m.prototype,"id",2);S([n()],m.prototype,"label",2);S([n()],m.prototype,"type",2);m=S([l("BaseNode")],m);var rt=Object.defineProperty,ot=Object.getOwnPropertyDescriptor,E=(t,e,o,s)=>{for(var r=s>1?void 0:s?ot(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&rt(e,o,r),r},d=class extends N{constructor(t){super(t),this.messages=[]}static fromJSON(t){let e=d._normalizeMessages(t.messages);return new d({id:t.id,messages:e})}static _normalizeMessages(t){return Array.isArray(t)?t.filter(e=>typeof e.content=="string").map(e=>({content:e.content,role:e.role??"system"})):[]}};E([n()],d.prototype,"id",2);E([n()],d.prototype,"messages",2);d=E([l("Prompt")],d);function G(t){let e=new Set(t.required),o=Object.fromEntries(Object.entries(t.properties).map(([s,r])=>{let a=B(r);return[s,e.has(s)?a:a.optional()]}));return c.object(o)}function B(t){let e;switch(t.type){case"array":e=c.array(t.items?B(t.items):c.unknown());break;case"boolean":e=c.boolean();break;case"number":e=c.number();break;case"object":e=G({properties:t.properties??{},required:t.required});break;case"string":e=t.enum?.length?c.enum(t.enum):c.string();break}return t.description?e.describe(t.description):e}var st=new Map([["clear_filters",async()=>(await import("./DKLK4EUE.js")).clearFiltersTool],["reset_map",async()=>(await import("./N735LT4S.js")).resetMapTool],["set_feature_effect",async()=>(await import("./E7JLG2A2.js").then(m=>m.default.then(e=>({setFeatureEffectTool:e})))).setFeatureEffectTool],["list_layer_fields",async()=>(await import("./6FKLWNGA.js")).listLayerFieldsTool],["go_to_address",async()=>(await import("./3XXZUQMQ.js").then(m=>m.default.then(e=>({goToAddressTool:e})))).goToAddressTool],["go_to_bookmark",async()=>(await import("./6SGNSDLY.js")).goToBookmarkTool],["go_to_features",async()=>(await import("./6RDKDLSX.js")).goToFeaturesTool],["go_to_full_extent",async()=>(await import("./7747YL7V.js").then(m=>m.default.then(e=>({goToFullExtentTool:e})))).goToFullExtentTool],["go_to_home_extent",async()=>(await import("./E62P76TP.js")).goToHomeExtentTool],["go_to_layer",async()=>(await import("./5Y6TQAJN.js")).goToLayerTool],["go_to_scale",async()=>(await import("./VXBUMZYR.js")).goToScaleTool],["go_to_viewpoint",async()=>(await import("./JH6EAWB2.js").then(m=>m.default.then(e=>({goToViewpointTool:e})))).goToViewpointTool],["go_to_zoom",async()=>(await import("./JXB4TNSG.js")).goToZoomTool],["get_attribute",async()=>(await import("./VBZ5XGAM.js").then(m=>m.default.then(e=>({getAttributeTool:e})))).getAttributeTool],["get_statistics",async()=>(await import("./H6JSNAT4.js").then(m=>m.default.then(e=>({getStatisticsTool:e})))).getStatisticsTool],["get_top_features",async()=>(await import("./NTZAOJH5.js").then(m=>m.default.then(e=>({getTopFeaturesTool:e})))).getTopFeaturesTool],["query_features",async()=>(await import("./NP7DG7LQ.js").then(m=>m.default.then(e=>({queryFeaturesTool:e})))).queryFeaturesTool]]);async function at(t){let e=st.get(t);if(!e)throw new Error(`ArcGIS tool is not supported in the browser runtime: ${t}`);return await e()}var it=Object.defineProperty,nt=Object.getOwnPropertyDescriptor,T=(t,e,o,s)=>{for(var r=s>1?void 0:s?nt(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&it(e,o,r),r},g=class extends N{constructor(t){super(t),this.type="arcgis-tool"}async createRuntimeTools(){if(!this.name)throw new Error("ArcgisTool name is required");return[await at(this.name)]}static fromJSON(t){return new g({name:t.name,requireApproval:t.require_approval})}};T([n()],g.prototype,"name",2);T([n()],g.prototype,"requireApproval",2);T([n()],g.prototype,"type",2);g=T([l("ArcgisTool")],g);var ct=Object.defineProperty,pt=Object.getOwnPropertyDescriptor,H=t=>{throw TypeError(t)},b=(t,e,o,s)=>{for(var r=s>1?void 0:s?pt(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&ct(e,o,r),r},mt=(t,e,o)=>e.has(t)||H("Cannot "+o),dt=(t,e,o)=>e.has(t)?H("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,o),ut=(t,e,o)=>(mt(t,e,"access private method"),o),j,V,u=class extends m{constructor(t){super(t),dt(this,j),this.type="agent-node"}createRuntimeNode(){let t;return async(e,o)=>{t??=ut(this,j,V).call(this);let s=await(await t).run(e,o),r=this.outputSchema?.safeParse(s);if(r&&!r.success)throw r.error;let a=r?.data,i=a??s.outputMessage;return{agentExecutionContext:s.agentExecutionContext,...a?{}:{outputMessage:s.outputMessage},status:s.status,summary:s.summary,nodes:{[this.id]:{output:i}}}}}compile(t){let e=t.outgoingEdges[0]?.targetNodeId;return{runtimeNode:this.createRuntimeNode(),edges:[{from:this.id,decide:o=>o.status==="failed"?void 0:e}],schemas:[c.object({output:this.outputSchema??c.string()})]}}static fromJSON(t){let e=new u({id:t.id,label:t.label,type:"agent-node"});return t.prompt&&(typeof t.prompt=="string"?e.prompt=d.fromJSON({id:`prompt_${t.id}`,type:"plain_text",messages:[{content:t.prompt,role:"system"}]}):e.prompt=d.fromJSON(t.prompt)),t.structured_output&&(e.outputSchema=G(t.structured_output)),e.tools=t.tools?.filter(o=>o.type==="arcgis_tool").map(o=>g.fromJSON(o)),e}};j=new WeakSet;V=async function(){let t=this.prompt?.messages?.[0].content;if(!t?.trim())throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);let e=[];if(this.tools)for(let o of this.tools){let s=await o.createRuntimeTools();e.push(...s)}return new $({name:this.id,outputSchema:this.outputSchema,prompt:t,tools:e})};b([n()],u.prototype,"type",2);b([n()],u.prototype,"prompt",2);b([n()],u.prototype,"outputSchema",2);b([n()],u.prototype,"tools",2);u=b([l("AgentNode")],u);var lt=Object.defineProperty,gt=Object.getOwnPropertyDescriptor,k=(t,e,o,s)=>{for(var r=s>1?void 0:s?gt(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&<(e,o,r),r},h=class extends m{constructor(t){super(t),this.type="end-message-node"}createRuntimeNode(){return async t=>{let e=await C.fromTemplate(this.message,{templateFormat:"mustache"}).format(t);return{outputMessage:e,status:"success",summary:e}}}compile(t){return{runtimeNode:this.createRuntimeNode(),edges:[]}}static fromJSON(t){let e=new h({id:t.id,label:t.label,type:"end-message-node"});return e.message=t.message,e}};k([n()],h.prototype,"type",2);k([n()],h.prototype,"message",2);h=k([l("EndMessageNode")],h);var ht=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,Z=(t,e,o,s)=>{for(var r=s>1?void 0:s?ft(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&ht(e,o,r),r},w=class extends m{constructor(t){super(t),this.type="start-node"}createRuntimeNode(){return t=>({question:t.agentExecutionContext.userRequest})}static fromJSON(t){return new w({id:t.id,label:t.label,type:"start-node"})}};Z([n()],w.prototype,"type",2);w=Z([l("StartNode")],w);function yt(t){switch(t.type){case"agent_node":return u.fromJSON(t);case"end_message_node":return h.fromJSON(t);case"start_node":return w.fromJSON(t);default:throw new Error(`WebAgent node "${t.id}" uses unsupported type "${t.type}".`)}}function wt(t={}){let e=Object.keys(t);if(R(e),e.includes("nodes"))throw new Error("node state cannot define reserved field: nodes.");let o=F(t);return v.Root({...o,nodes:v({reducer:(s,r)=>({...s,...r}),default:()=>({})}),...q()})}function K(t){let e=new Set;for(let s of t)for(let r of Object.keys(s.shape??{}))r!=="nodes"&&e.add(r);let o=Object.fromEntries([...e].map(s=>[s,void 0]));return wt(o)}var A=class t{constructor(e,o,s){this.sourceJSON=e,this.edges=o,this.nodes=s,this._loaded=!1}static fromJSON(e){return new t(e,e.graph.edges.map(o=>p.fromJSON(o)),e.graph.nodes.map(o=>yt(o)))}async load(){return this._loadPromise??=Promise.all(this.nodes.map(async e=>await e.load())).then(()=>{this._loaded=!0}),await this._loadPromise,this}getSchemas(){let e=Object.fromEntries(this._getNodeCompilations().flatMap((o,s)=>{let r=this.nodes[s];return o.schemas?.map(a=>[r.id,a])??[]}));return[c.object({loopCounts:c.record(c.string(),c.number()).optional(),nodes:c.object(e).partial().optional(),question:c.string().optional()})]}generate(){this._assertLoaded(),this._nodeCompilations=void 0;let e=this._getNodeCompilations(),o=K(this.getSchemas()),s=this.nodes.find(i=>i.type==="start-node")?.id,r={},a=[];for(let[i,Q]of this.nodes.entries()){let _=e[i];_&&(_.runtimeNode&&(r[Q.id]=_.runtimeNode),a.push(..._.edges))}return{createGraph:()=>W(r,a,o,{entryNode:s}),workspace:o}}_assertLoaded(){if(!this._loaded)throw new Error("AgenticWorkflowRuntime must be loaded before it can generate a graph.")}_getNodeCompilations(){return this._assertLoaded(),this._nodeCompilations??=this.nodes.map(e=>e.compile({outgoingEdges:this.edges.filter(o=>o.sourceNodeId===e.id)}))}},bt=Object.defineProperty,_t=Object.getOwnPropertyDescriptor,x=(t,e,o,s)=>{for(var r=s>1?void 0:s?_t(e,o):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(r=(s?i(e,o,r):i(r))||r);return s&&r&&bt(e,o,r),r},Ot=()=>{throw new Error("WebAgent must be loaded before it can run.")},f=class extends L{constructor(t){super(t)}async load(){if(this.portalItem){try{await this.portalItem.load()}catch(o){throw new O("web-agent:load-portal-item","Failed to load portal item",{error:o})}let e=await this.portalItem.fetchData();if(this.sourceJSON=e,!this.portalItem.title)throw new O("web-agent:missing-title","The portal item is missing a title")}if(!this.sourceJSON)throw new O("web-agent:missing-source-json","The source JSON is missing");if(!this.sourceJSON.description)throw new O("web-agent:missing-description","The source JSON is missing a description");let t=A.fromJSON(this.sourceJSON);return await t.load(),this._runtime=t,this.description=this.sourceJSON.description,this.name=this.portalItem?.title??`web-agent-${Date.now()}`,this.generate(),this}getSchemas(){return this._runtime?.getSchemas()??[]}generate(){if(!this._runtime){this._set("workspace",K([])),this._set("createGraph",Ot);return}let{createGraph:t,workspace:e}=this._runtime.generate();this._set("workspace",e),this._set("createGraph",t)}};x([n({type:z})],f.prototype,"portalItem",2);x([n()],f.prototype,"sourceJSON",2);f=x([l("WebAgent")],f);var J=class extends P{static{this.properties={agent:0,context:0,itemId:1,workflow:0}}#t;async getContext(){return D(this.context)?await this.context():this.context}async load(){let e;if(this.itemId){let o=U.getDefault();e=new f({portalItem:new z({id:this.itemId,portal:o})})}else this.workflow&&(e=new f({sourceJSON:this.workflow}));if(e&&(await e.load(),this.agent=e.registration),!this.agent)throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");this.#t=M(this)}disconnectedCallback(){this.#t?.unregister(this.agent.id),super.disconnectedCallback()}};I("arcgis-assistant-agent",J);return J},"portal/PortalItem","portal/Portal","core/accessorSupport/decorators","core/Error","core/Accessor","identity/IdentityManager","request","config","core/reactiveUtils","layers/FeatureLayer",a,b,d)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
var n=(r,e,a)=>{if(!(a?r.hasAllFeaturesInView:r.hasAllFeatures))return!1;let l=new Set((r.availableFields??[]).map(t=>t.toLowerCase()));return l.has("*")?!0:e.every(t=>l.has(t.toLowerCase()))};function s(r,e){let a=r??"";return e!=null&&e&&(a=a?`(${a}) AND (${e})`:e),a||null}export{n as a,s as b};
|
|
@@ -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"./M3MRIGDZ.js";import b from"./6QJFOL6M.js";import{d as f,e as y}from"./UZL6UVE4.js";import a from"./ZJEWP2ND.js";import{c as u}from"./S3XUYAUX.js";import{b as c}from"./WZFC5HUX.js";import{Y as g,y as l}from"./E7KEOJZG.js";export default $arcgis.t(([,,,{watch:T},,{property:m,subclass:_},{d:h},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(t,s,e,r)=>{for(var o=r>1?void 0:r?x(s,e):s,n=t.length-1,p;n>=0;n--)(p=t[n])&&(o=(r?p(s,e,o):p(o))||o);return r&&o&&k(s,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 s=this.id,e={[s]:this._invoke.bind(this)},r=[{from:s,decide:()=>{}}];this._set("createGraph",()=>y(e,r,t,{agent:this,entryNode:s,middlewares:this.middlewares}))}async _invoke(t,s){try{return this.outputSchema?await this._invokeStructured(t,s):await this._invokeUnstructured(t,s)}catch(e){if(l(e))throw e;let r=e instanceof Error?e.message:String(e);return d({outputMessage:r},"failed",r)}}async _invokeStructured(t,s){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let e=await c({model:await h({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},s);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,s){let e=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(t),tools:this._getTools(),checkpointer:!0,middleware:u(this.middlewares)}).invoke({messages:t.agentExecutionContext.messages},s)).messages,r=e.at(-1)?.content??"",o=typeof r=="string"?r:JSON.stringify(r),n=o.trim()||"LLMAgent completed.";return d({agentExecutionContext:{...t.agentExecutionContext,messages:e},outputMessage:o},"success",n)}async _getPromptWithInputVariables(t){let s=v(t,this.inputSchema);for(let{outputKey:e}of this.middlewares)e&&(s[String(e)]=t[e]);return await g.fromTemplate(this.prompt).format(s)}_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{a as c}from"./ONQ6JSBJ.js";import{Bc as i}from"./LUY6V4TP.js";import{a as r}from"./VXFQANGJ.js";export default $arcgis.t(([a,p,u,{addressToLocations:w},S])=>{async function v(e,t){let s=u.getDefault().helperServices,n=s.geocode.find(g=>g.name==="ArcGIS World Geocoding Service")??s.geocode[0];if(!n)throw new Error("No geocoding service found in helperServices.");let d=n.url,l=`${a.assetsPath?.endsWith("/")?a.assetsPath:`${a.assetsPath}/`}esri/images/search/search-symbol-32.png`,o=(await w(d,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!o?.extent||!o.location)throw new Error(`Could not find location for: ${e}`);let m=new S({url:l,width:24,height:24}),h=new p({geometry:o.location,symbol:m});t.graphics.removeAll(),t.graphics.add(h),await t.goTo(o.extent);let f={address:o.address??"",location:o.location?o.location.toJSON():null,extent:o.extent?o.extent.toJSON():null};return{text:`Successfully zoomed to ${e}.`,sharedStatePatch:{lastResolvedLocation:{value:f}}}}async function x({address:e},t){let{mapView:s}=c(t,["mapView"]);return await v(e,s)}var y=r.object({address:r.string().describe("The full address or place name to locate.")}),N=i(x,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:y});return N},"config","Graphic","portal/Portal","rest/locator","symbols/PictureMarkerSymbol")
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as o}from"./FDOMMK2M.js";import{Bc as a}from"./LUY6V4TP.js";import{a as r}from"./VXFQANGJ.js";var f=(l,i)=>{let t=Array.from(l.values()).find(({layerItem:e})=>e.title?.toLowerCase().includes(i.toLowerCase()));if(!t){let e=Array.from(l.values()).map(y=>y.layerItem.title).join(", ");return`Could not find a layer matching "${i}". Available layers: ${e}`}let s=Array.from(t.fieldRegistry.values()),n=s.map(e=>`- **${e.alias||e.name}** (\`${e.name}\`, ${e.type})${e.description?`: ${e.description}`:""}`).join(`
|
|
3
|
+
`);return`**${t.layerItem.title}** has ${s.length} field(s):
|
|
4
|
+
|
|
5
|
+
${n}`},m=({layerTitle:l},i)=>{let t=o(i,"layersAndFieldsRegistry");return f(t,l)},u=a(m,{name:"listLayerFields",description:"Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",schema:r.object({layerTitle:r.string().describe("The title or partial title of the layer to list fields for.")})});export{u as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as s}from"./ONQ6JSBJ.js";import{Bc as o}from"./LUY6V4TP.js";import{a as i}from"./VXFQANGJ.js";var n=async t=>{t.map?.allLayers.filter(e=>e.type==="feature")?.forEach(e=>{let r=e;r.featureEffect&&(r.featureEffect=null)});let a=t.map.initialViewProperties?.viewpoint?.targetGeometry;return a?(await t.goTo(a),"Cleared all filters and returned to home extent."):"Cleared all filters. Could not determine home extent."},l=async(t,a)=>{let{mapView:e}=s(a,["mapView"]);return await n(e)},c=o(l,{name:"resetMap",description:"Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",schema:i.object({})});export{c as a};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import v from"./527C4GD2.js";import t from"./KRN6AFNB.js";import s from"./C4FKFOU4.js";import r from"./67YCNNCN.js";import q from"./OHMNQ3RU.js";import p from"./3ZPPYCNL.js";import o from"./RU5DVLYG.js";import n from"./HNMFFLSY.js";import"./RATZTLNX.js";import m from"./W5FLNFSN.js";import l from"./W5J4Q3RO.js";import k from"./MKJS7QYQ.js";import j from"./ITBQGOMF.js";import i from"./CCC6LBMY.js";import"./34O57OGV.js";import"./3U476GCP.js";import"./FDOMMK2M.js";import f from"./3MJQA533.js";import"./E25RINU2.js";import"./SABZC4D4.js";import e from"./GG3AESSV.js";import"./KZACIY2W.js";import"./XGBEHER5.js";import"./JWPB3XZM.js";import d from"./I4L45WQS.js";import c from"./ZJEWP2ND.js";import{e as g,f as h}from"./HO2YDJI2.js";import"./7TO56JHS.js";import"./4YDXYW4J.js";import b from"./YGCTAIBS.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./R74ZHFA6.js";import{a as u,b as y}from"./HJG7QM2R.js";import"./WZFC5HUX.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([C,I,,,{d:w,g:v,h:A,i:b,j:S,k:d,l:p,m:M,n:E,o:P,p:T,q:x,r:D},{a:f,b:V},,,,,,,,,,,L,k,W,R,O])=>{var U=async e=>{let a=e.allLayers.toArray(),s=[],o=new Map;for(let t of a)if(t instanceof C){let i=(async()=>{let n=await x(t),r=await D(t,n);o.set(t.id,{layerItem:r,fieldRegistry:n})})();s.push(i)}return await Promise.all(s),o},q=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:s}=await z(a),o={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:b,model:S,dimensions:A,templates:{layer:d,field:p}},layers:s},t=M.safeParse(o);if(!t.success)throw console.error("Schema Mismatch:",t.error.format()),new Error("Webmap embedding generation failed validation.");return t.data},z=async e=>{let a=[],s=[];for(let[i,{fieldRegistry:n,layerItem:r}]of e.entries()){let l=H(d,{name:r.name,title:r.title,description:r.description});a.push(l);let m={id:i,name:r.name??"",title:r.title,description:r.description,vector:[],fields:[]};for(let[,c]of n.entries()){let N=H(p,{name:c.name,alias:c.alias,description:c.description});a.push(N),m.fields.push({name:c.name,alias:c.alias,description:c.description,vector:[]})}s.push(m)}let o=await f(a),t=0;return{layers:s.map(i=>(i.vector=o[t++],i.fields.forEach(n=>{n.vector=o[t++]}),i))}},H=(e,a)=>e.replace(/\{(\w+)\}/gu,(s,o)=>a[o]??""),F=(e,a)=>{if(e.length!==a.length)throw new Error("Vectors must be the same length");let s=0,o=0,t=0;for(let r=0;r<e.length;++r){let l=e[r],m=a[r];s+=l*m,o+=l*l,t+=m*m}let i=Math.sqrt(o*t);if(i===0)return 0;let n=s/i;return Math.max(-1,Math.min(1,n))},ee=E,ae=P,te=T,se=u,re=f,oe=F,ie=O,ne=L,me=R,ce=W,le=k,de=q,pe=()=>g(),fe=()=>h(),ge=async(e,a)=>await y(e,a),he=async({modelTier:e="default",temperature:a=0,config:s}={})=>await w({modelTier:e,temperature:a,config:s});return{ArcgisKnowledgeAgent:le,DataExplorationAgent:me,HelpAgent:ce,LayerStylingAgent:ne,NavigationAgent:ie,Orchestrator:V,cosineSimilarity:oe,createAgentRuntimeState:pe,createAgentRuntimeStateWithSharedState:fe,createChatModel:he,createWebmapEmbeddings:de,getEmbeddings:re,invokeStructuredPrompt:ae,invokeTextPrompt:ee,invokeToolPrompt:te,sendTraceMessage:se,sendUXSuggestion:ge}},"layers/FeatureLayer","core/reactiveUtils",a,b,c,d,e,f,i,j,k,l,m,n,o,p,q,r,s,t,v)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import f from"./3ZPPYCNL.js";import e from"./RU5DVLYG.js";import d from"./HNMFFLSY.js";import{a as Z}from"./RATZTLNX.js";import{a as h}from"./FDOMMK2M.js";import c from"./3MJQA533.js";import{a as F}from"./E25RINU2.js";import{a as C}from"./SABZC4D4.js";import b from"./GG3AESSV.js";import{a as L}from"./KZACIY2W.js";import{a as _}from"./XGBEHER5.js";import{a as I}from"./JWPB3XZM.js";import a from"./ZJEWP2ND.js";import{a as x}from"./ONQ6JSBJ.js";import{a as g}from"./HJG7QM2R.js";import{Wa as E,a as w,b as k}from"./E7KEOJZG.js";import{a as y}from"./VXFQANGJ.js";export default $arcgis.t(([,,,,,,{o:$,p:N},R,b,M,{a:A,b:v,c:S,d:q,e:V},j])=>{var T=[b,F,C,R,L,_,I,M,Z];async function B(e,t){let a=await S("navigation_tool_prompt"),{mapView:s}=x(t,["mapView"]),c=s.map.bookmarks?.map(p=>p.name).filter(Boolean)??[],i=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((p,G)=>`${G+1}. layerId=${p.id} | title=${p.title??""} | name=${p.name??""} | score=${p.score.toFixed(2)}`).join(`
|
|
3
|
+
`):"",l=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",n=e.intent==="goToBookmark"&&c.length?`Available bookmarks:
|
|
4
|
+
${c.map(p=>`- ${p}`).join(`
|
|
5
|
+
`)}`:"",o=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
|
|
6
|
+
${i}`:"",m=e.intent==="goToFeatures"&&e.vectorSearchFieldResults?.length?`Candidate fields:
|
|
7
|
+
${l}`:"",u={intent:e.intent,bookmarksSection:n,layersSection:o,fieldsSection:m,currentZoom:s.zoom,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},r=await N({promptText:a,modelTier:"fast",config:t,inputVariables:u,tools:T});await j(r,t);let d=(r.tool_calls?.length??0)>0,f=typeof r.text=="string"?r.text.trim():"",z=f.length>0;return{...e,navigationInternalState:{...e.navigationInternalState,toolCallMessage:d?r:void 0},outputMessage:d?e.outputMessage:f,status:d?e.status:z?"success":"failed"}}var D=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 J(e,t){let a=new A(T,{handleToolErrors:!1});try{let s=e.navigationInternalState.toolCallMessage;if(!s)throw new Error("navigationToolCalling: missing navigationInternalState.toolCallMessage");let{messages:c}=await a.invoke({messages:[s]},t),i="",l;for(let n of c){let o=D(n.content);o.text&&(i+=`${o.text}
|
|
8
|
+
`),o.sharedStatePatch&&(l={...l,...o.sharedStatePatch})}return await g({text:`Finished executing navigation tool: ${i}`},t),{...e,outputMessage:i,sharedStatePatch:l,status:"success",summary:i?q(i):"Navigation executed.",navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}catch(s){let c=s instanceof Error?s.message:String(s);return await g({text:`Navigation tool execution failed: ${c}`},t),{...e,outputMessage:`Navigation tool execution failed: ${c}`,status:"failed",summary:`Navigation tool execution failed: ${c}`,navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}}async function P(e,t){let a=await S("navigation_intent_prompt"),{mapView:s}=x(t,["mapView"]),c=T.map(r=>({name:r.name,description:r.description,schema:r.schema})),i=s.map.bookmarks?.map(r=>r.name).filter(Boolean)??[],l=i.length?`Available bookmarks:
|
|
9
|
+
${i.map(r=>`- ${r}`).join(`
|
|
10
|
+
`)}`:"No bookmarks are available in this map.",n={tools:c.map(({name:r,description:d,schema:f})=>`${r}: ${d}, ${JSON.stringify(f)}`).join(`
|
|
11
|
+
`),bookmarks:l,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=y.object({intent:y.string()}),m=await $({promptText:a,config:t,inputVariables:n,schema:o,modelTier:"fast"}),u=typeof m.intent=="string"?m.intent.trim().replace(/^"|"$/gu,""):"";return{...e,intent:u||""}}var H=.7,W=async(e,t)=>{try{await g({text:`Similarity search to find layers: ${e.agentExecutionContext.assignedTask}`},t);let a=h(t,"layerSearch"),s=h(t,"layersAndFieldsRegistry"),c=h(t,"embeddingCache"),i=(await a.searchLayers({text:e.agentExecutionContext.assignedTask,minScore:H,embeddingCache:c})).map(({id:n,score:o})=>{let m=s.get(n)?.layerItem;return{id:n,title:m?.title,name:m?.name??void 0,score:o}}),l;return i.length>0?l=`Vector search completed. Matching layers:
|
|
12
|
+
${i.map(n=>`- layerId=${n.id} | title=${n.title??""} | name=${n.name??""} | score=${n.score.toFixed(2)}`).join(`
|
|
13
|
+
`)}`:l="Vector search completed. No matching layers found.",await g({text:l},t),{...e,vectorSearchLayerResults:i}}catch(a){throw await g({text:`Error during vector search layers: ${a instanceof Error?a.message:String(a)}`},t),a}},O=.7,K=10,Q=async(e,t)=>{try{await g({text:`Similarity search to find fields: ${e.agentExecutionContext.assignedTask}`},t);let a=h(t,"fieldSearch"),s=h(t,"layersAndFieldsRegistry"),c=h(t,"embeddingCache"),i=e.vectorSearchLayerResults?.map(o=>o.id)??[];if(i.length===0)return await g({text:"No candidate layers for field search"},t),e;let l=(await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:i,minScore:O,topResults:K,embeddingCache:c})).map(({layerId:o,results:m})=>{let u=s.get(o)?.fieldRegistry;return{layerId:o,layerName:s.get(o)?.layerItem.name,results:m.map(r=>{let d=u?.get(r.name);return{name:r.name,score:r.score,type:d?.type,alias:d?.alias,description:d?.description,statistics:d?.statistics,domain:d?.domain}})}}),n;return l.length>0?n=`Vector search completed. Matching layers and fields:
|
|
14
|
+
${l.map(o=>`${o.layerName??o.layerId}:
|
|
15
|
+
${o.results.map(m=>` - ${m.name} (${m.score.toFixed(2)})`).join(`
|
|
16
|
+
`)}`).join(`
|
|
17
|
+
`)}`:n=`No vector search field results found for score over ${O}.`,await g({text:n},t),{...e,vectorSearchFieldResults:l}}catch(a){throw await g({text:`Error during vector search fields: ${a instanceof Error?a.message:String(a)}`},t),a}},U=(e,t)=>V(["layerSearch","layersAndFieldsRegistry"],"Navigation Agent")(e,t),X=()=>new E(v).addNode("requireNavigationServices",U).addNode("intentLLM",P).addNode("vectorSearchLayers",W).addNode("vectorSearchFields",Q).addNode("agent",B).addNode("tools",J).addEdge(w,"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",k),Y=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?”_`,Fe={id:"navigation",name:"Navigation Agent",description:Y,createGraph:X,workspace:v};return Fe},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer",a,b,c,d,e,f)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import q from"./KRN6AFNB.js";import p from"./3ZPPYCNL.js";import n from"./RU5DVLYG.js";import m from"./HNMFFLSY.js";import"./RATZTLNX.js";import l from"./W5FLNFSN.js";import k from"./W5J4Q3RO.js";import j from"./MKJS7QYQ.js";import h from"./ITBQGOMF.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import{a as o,c as a}from"./V6HOUZPZ.js";import"./3U476GCP.js";import"./FDOMMK2M.js";import f from"./3MJQA533.js";import"./E25RINU2.js";import"./SABZC4D4.js";import e from"./GG3AESSV.js";import"./KZACIY2W.js";import"./XGBEHER5.js";import"./JWPB3XZM.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import d from"./ZJEWP2ND.js";import"./HO2YDJI2.js";import"./7TO56JHS.js";import"./4YDXYW4J.js";import c from"./YGCTAIBS.js";import b from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./WZFC5HUX.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,s])=>{var t=class extends i{constructor(){super(...arguments),this.agent=s}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=a(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","views/LinkChartView","rest/knowledgeGraphService",b,c,d,e,f,g,h,j,k,l,m,n,p,q)
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./RU5DVLYG.js";import a from"./ZJEWP2ND.js";import{a as c,b as k}from"./HJG7QM2R.js";import{Wa as x,a as w,b as d,j as f}from"./E7KEOJZG.js";import{ca as u}from"./LUY6V4TP.js";export default $arcgis.t(([,,,,,,{n:_,p:b},{A:M,B:T,C:E,D:C,E:G,F:N,G:R,a:v,c:m,d:h,e:A,w:y,x:K,y:q,z:S}])=>{var z=[T,E,N,C,M,R,G];async function $(e,a){let o=await m("arcgis_knowledge_tool_prompt"),s=K(a),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:s},r=await b({promptText:o,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:z,config:a}),i=(r.tool_calls?.length??0)>0,t=typeof r.text=="string"?r.text.trim():"",l=t.length>0,p=r.content.toString();return!i&&(s==="map"||s==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:s==="map"?"No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries.":"No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",status:"success"}:{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:i?p:t,status:i?e.status:l?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var L={generateCypher:"generated-cypher-query",queryGraphData:"graph-query-result",searchGraphData:"graph-search-result",addRecords:"added-records",applyLayout:"applied-layout",changeNonspatialVisibility:"changed-nonspatial-visibility",createLinkChart:"created-link-chart"};function I(e){return!!e&&e.status==="success"&&!!L[e.toolName]}function D(e){return{type:L[e.toolName],data:e.details}}async function F(e,a){let o=new v(z,{handleToolErrors:!1});try{let s=await o.invoke({messages:e.arcgisKnowledgeMessages},a),n=[];for(let t of s.messages){let l;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{l=JSON.parse(t.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name??"unknown"}.
|
|
3
3
|
|
|
4
4
|
Original Content: ${t.content}`)}if(!l||typeof l!="object"||!("toolName"in l))throw new Error(`Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(l)}`);n.push(l)}await c({text:`Finished executing ArcGIS Knowledge Agent tools: ${s.messages.filter(t=>t.name).map(t=>t.name).join(", ")}`},a);let r=n.filter(t=>typeof t!="string").map(t=>`- Called Tool: ${t.toolName}, Status: ${t.status}`),i=n[0];return i&&I(i)&&await k(D(i),a),{...e,outputMessage:r.join(`
|
|
5
5
|
`),summary:r.length?h(r.join(`
|
|
6
|
-
`)):"ArcGIS Knowledge Agent did not execute any tools or return any results.",arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,...s.messages],arcgisKnowledgeToolResult:n}}catch(s){let n=s instanceof Error?s.message:String(s);return await c({text:`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}`},a),{...e,outputMessage:`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}`,status:"failed",summary:h(`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}`),arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages]}}}var V=(e,a)=>A([],"ArcgisKnowledge Agent")(e,a);async function
|
|
6
|
+
`)):"ArcGIS Knowledge Agent did not execute any tools or return any results.",arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,...s.messages],arcgisKnowledgeToolResult:n}}catch(s){let n=s instanceof Error?s.message:String(s);return await c({text:`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}`},a),{...e,outputMessage:`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}`,status:"failed",summary:h(`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}`),arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages]}}}var V=(e,a)=>A([],"ArcgisKnowledge Agent")(e,a);async function O(e,a){let o=(e.arcgisKnowledgeToolResult??[]).map(l=>({...l,details:void 0})),{knowledgeGraph:s}=await q(a),n=S.getDataModelTypesSummary(s.dataModel),r={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,toolResult:o,dataModelSummary:n},i=await _({promptText:await m("arcgis_knowledge_summarize_result_prompt"),modelTier:"default",inputVariables:r,config:a}),t=typeof i=="string"?i:i.content;return{...e,outputMessage:t,status:"success",summary:h(t),arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,new u(t)]}}async function j(e){let a=e.arcgisKnowledgeToolResult?.[0],o=a?.status==="success"?a.summary:"ArcGIS Knowledge Agent tool execution failed.";return{...e,outputMessage:o,status:"success",summary:h(o),arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,new u(o)]}}function g(e){return async(a,o)=>o?.signal?.aborted?(await c({text:"Knowledge Agent execution cancelled"},o),new f({goto:d,update:{outputMessage:"Knowledge Agent execution cancelled",summary:"Knowledge Agent execution cancelled",status:"failed"}})):await e(a,o)}var J=()=>new x(y).addNode("requireArcgisKnowledgeServices",V).addNode("agent",g($)).addNode("tools",g(F)).addNode("summarizationLLM",g(O)).addNode("finalizeToolSummary",g(j)).addEdge(w,"requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices","agent").addConditionalEdges("agent",e=>(e.arcgisKnowledgeMessages[e.arcgisKnowledgeMessages.length-1]?.tool_calls?.length??0)>0?"tools":d).addConditionalEdges("tools",e=>{if(e.status==="failed")return d;let a=e.arcgisKnowledgeToolResult?.[0];return a?.status==="success"&&["applyLayout","changeNonspatialVisibility"].includes(a.toolName)?"finalizeToolSummary":"summarizationLLM"}).addEdge("summarizationLLM",d).addEdge("finalizeToolSummary",d),P=String.raw`The purpose of this agent is to work with Knowledge Graph data, a graph database technology that represents and stores data as interconnected entities (nodes) and relationships (edges).
|
|
7
7
|
This agent has two categories of skills: those that work with an active link chart visualization of a subset of the data in the knowledge graph, and those that work with the knowledge graph data more generally against the entire dataset in the service and database.
|
|
8
8
|
For link charts, the agent enables users to interact with a link chart by adding new entities (also called nodes) or relationships (also called edges), removing existing entities or relationships,
|
|
9
9
|
expanding the graph from particular entities, finding relationships between specified entities on the link chart and adding them to the link chart, finding all relationships
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as f}from"./ONQ6JSBJ.js";import{Bc as o}from"./LUY6V4TP.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,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import n from"./67YCNNCN.js";import m from"./RU5DVLYG.js";import l from"./HNMFFLSY.js";import"./RATZTLNX.js";import k from"./W5FLNFSN.js";import j from"./W5J4Q3RO.js";import i from"./MKJS7QYQ.js";import h from"./ITBQGOMF.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import{c as s,d as p}from"./V6HOUZPZ.js";import"./3U476GCP.js";import"./FDOMMK2M.js";import f from"./3MJQA533.js";import"./E25RINU2.js";import"./SABZC4D4.js";import d from"./GG3AESSV.js";import"./KZACIY2W.js";import"./XGBEHER5.js";import"./JWPB3XZM.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./ZJEWP2ND.js";import"./HO2YDJI2.js";import"./7TO56JHS.js";import"./4YDXYW4J.js";import b from"./YGCTAIBS.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as e,z as o}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./WZFC5HUX.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,{fetchKnowledgeGraph:m},,,,,,,,,,,,,n])=>{var r=class extends e{constructor(){super(...arguments),this.agent=n}static{this.properties={referenceElement:1,serviceUrl:3,context:0}}#i;#r;#t;#e;get serviceUrl(){return this.#r}set serviceUrl(t){this.#r=t}async getContext(){let t=this.context?{...this.context,knowledgeGraph:void 0,view:void 0}:{};if(this.#i)return{...t,view:this.#i};if(this.#t)try{let i=await this.#t;return{...t,knowledgeGraph:i}}catch(i){console.error("Failed to load knowledge graph via service URL:",i)}if(!this.context?.knowledgeGraph&&!this.context?.view)throw new Error("arcgis-assistant-knowledge-agent requires either a knowledgeGraph or view in context, and neither were provided");return this.context}willUpdate(t){t.has("serviceUrl")&&this.serviceUrl?this.#t=m(this.serviceUrl):this.#t=void 0}load(){this.#i=p(this)??void 0,this.#e=s(this)}disconnectedCallback(){this.#e?.unregister(this.agent.id),super.disconnectedCallback()}};o("arcgis-assistant-knowledge-agent",r);return r},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,f,g,h,i,j,k,l,m,n)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import q from"./C4FKFOU4.js";import n from"./3ZPPYCNL.js";import m from"./RU5DVLYG.js";import l from"./HNMFFLSY.js";import"./RATZTLNX.js";import k from"./W5FLNFSN.js";import j from"./W5J4Q3RO.js";import h from"./MKJS7QYQ.js";import g from"./ITBQGOMF.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import{a as o,c as p}from"./V6HOUZPZ.js";import"./3U476GCP.js";import"./FDOMMK2M.js";import e from"./3MJQA533.js";import"./E25RINU2.js";import"./SABZC4D4.js";import d from"./GG3AESSV.js";import"./KZACIY2W.js";import"./XGBEHER5.js";import"./JWPB3XZM.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./ZJEWP2ND.js";import"./HO2YDJI2.js";import"./7TO56JHS.js";import"./4YDXYW4J.js";import b from"./YGCTAIBS.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./WZFC5HUX.js";import"./E7KEOJZG.js";import"./LUY6V4TP.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-help-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-help-agent"),this.#i=p(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-help-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n,q)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import d from"./3ZPPYCNL.js";import b from"./
|
|
2
|
+
import d from"./3ZPPYCNL.js";import b from"./RU5DVLYG.js";import{a as h}from"./3U476GCP.js";import{a as m}from"./FDOMMK2M.js";import a from"./ZJEWP2ND.js";import{a as p}from"./HJG7QM2R.js";import{Wa as c,a as u,b as n}from"./E7KEOJZG.js";export default $arcgis.t(([,,,,,,{p:g},{a:f,c:y,d:x,e:E,v:d},S])=>{var _=[h],v=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:r,fieldRegistry:s},o)=>{let a=Array.from(s.values()).map(i=>i.name).slice(0,10).join(", "),l=s.size>10?` (and ${s.size-10} more)`:"";return`${o+1}. "${r.title}". Description: ${r.description}
|
|
3
3
|
Fields: ${a}${l}`}).join(`
|
|
4
4
|
|
|
5
5
|
`);return`This map contains ${e.size} layer(s):
|
|
6
6
|
|
|
7
7
|
${t}`},w=e=>{let t=e?.list()??[];return t.length?t.map(r=>`- ${r.agent.name}: ${r.agent.description}`).join(`
|
|
8
|
-
`):"No agents currently available."};async function $(e,t){let r=await
|
|
9
|
-
`);return await p({text:`Finished executing help tool: ${o}`},t),{...e,outputMessage:o,status:"success",summary:o?
|
|
8
|
+
`):"No agents currently available."};async function $(e,t){let r=await y("help_prompt"),s=m(t,"layersAndFieldsRegistry"),o=m(t,"agentRegistry");try{let a=await g({promptText:r,modelTier:"default",config:t,tools:_,inputVariables:{layerSummary:v(s),agents:w(o),assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps}});await S(a,t);let l=(a.tool_calls?.length??0)>0,i=typeof a.text=="string"?a.text.trim():"";return{...e,helpInternalState:{...e.helpInternalState,toolCallMessage:l?a:void 0},outputMessage:l?e.outputMessage:i,summary:l?"Prepared help tool call from assigned task.":"Provided map-related help based on the assigned task.",status:l?e.status:"success"}}catch(a){let l=a instanceof Error?a.message:String(a);return{...e,outputMessage:`Error invoking help agent: ${l}`,summary:"Help agent execution failed.",status:"failed"}}}var b=(e,t)=>E(["agentRegistry"],"Help Agent")(e,t);async function k(e,t){let r=new f(_,{handleToolErrors:!1});try{let s=e.helpInternalState.toolCallMessage;if(!s)throw new Error("helpToolCalling: missing helpInternalState.toolCallMessage");let o=(await r.invoke({messages:[s]},t)).messages.map(a=>a.text).join(`
|
|
9
|
+
`);return await p({text:`Finished executing help tool: ${o}`},t),{...e,outputMessage:o,status:"success",summary:o?x(o):"Help executed.",helpInternalState:{...e.helpInternalState,toolCallMessage:void 0}}}catch(s){let o=s instanceof Error?s.message:String(s);return await p({text:`Help tool execution failed: ${o}`},t),{...e,outputMessage:`Help tool execution failed: ${o}`,status:"failed",summary:`Help tool execution failed: ${o}`,helpInternalState:{...e.helpInternalState,toolCallMessage:void 0}}}}var C=()=>new c(d).addNode("requireHelpServices",b).addNode("agent",$).addNode("tools",k).addEdge(u,"requireHelpServices").addEdge("requireHelpServices","agent").addConditionalEdges("agent",e=>e.helpInternalState.toolCallMessage?"tools":n).addEdge("tools",n),H=String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
|
|
10
10
|
|
|
11
11
|
_Example: “Tell me about this map”_
|
|
12
12
|
_Example: “List all layers in this map”_
|
|
@@ -19,4 +19,4 @@ ${t}`},w=e=>{let t=e?.list()??[];return t.length?t.map(r=>`- ${r.agent.name}: ${
|
|
|
19
19
|
|
|
20
20
|
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.
|
|
21
21
|
_Example: "Create a chart"_
|
|
22
|
-
_Example: "Create a table"_`,
|
|
22
|
+
_Example: "Create a table"_`,J={id:"help",name:"Help Agent",description:H,createGraph:C,workspace:d};return J},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer",a,b,d)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
export default $arcgis.t(([{formatDateOnly:h,convertDateFormatToIntlOptions:m,formatTimeOnly:N,formatDate:c}])=>{var T=new Set(["date","esrifieldtypedate","date-only","dateonly","esrifieldtypedateonly","time-only","timeonly","esrifieldtypetimeonly","timestamp-offset","timestampoffset","esrifieldtypetimestampoffset"]),y=e=>{if(!e)return!1;let t=e.toLowerCase();return T.has(t)},f=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"&&Number.isFinite(e)){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}return null},S=e=>!e||e==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:e==="unknown"?"UTC":e,w=e=>{if(typeof e=="string"&&e)return e;let t=f(e);return t?t.toISOString().slice(0,10):null},j=()=>{let e=new Date().getTimezoneOffset(),t=e<=0?"+":"-",n=Math.floor(Math.abs(e)/60).toString().padStart(2,"0"),r=(Math.abs(e)%60).toString().padStart(2,"0"),i=`${t}${n}:${r}`;return{userTimezone:Intl.DateTimeFormat().resolvedOptions().timeZone,userTimezoneOffset:i}},I=(e,t,n)=>{let r=t?.toLowerCase();if(r&&!y(r))return e;if(r==="date-only"){let o=w(e);return o?h(o,m("short-date")):e}if(r==="time-only"){if(typeof e=="string"&&e)return N(e,m("long-time"));let o=f(e);return o?c(o,{...m("long-time"),timeZone:"UTC"}):e}let i=f(e);return i?c(i,{...m("short-date-short-time"),timeZone:S(n)}):e},g=(e,t,n)=>{if(e&&typeof e!="function"){let r="getField"in n&&n.getField?.(e),i=r&&"getFieldDomain"in n&&n.getFieldDomain?n.getFieldDomain(r.name):null;if(i?.type==="coded-value"){let o=i.codedValues.find(s=>s.code===t);return o?o.name:null}}return null},O=e=>!e||e==="system"?Intl.DateTimeFormat().resolvedOptions().timeZone:e==="unknown"?"UTC":e,v=e=>{if(e instanceof Date)return Number.isNaN(e.getTime())?null:e;if(typeof e=="number"&&Number.isFinite(e)){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}if(typeof e=="string"&&e){let t=new Date(e);return Number.isNaN(t.getTime())?null:t}return null},x=(e,t)=>{if(typeof e!="number")return e;let n={};t.minimumFractionDigits!==void 0&&(n.minimumFractionDigits=t.minimumFractionDigits),t.maximumFractionDigits!==void 0&&(n.maximumFractionDigits=t.maximumFractionDigits),t.useGrouping==="always"?n.useGrouping=!0:t.useGrouping==="never"&&(n.useGrouping=!1);try{return new Intl.NumberFormat(void 0,n).format(e)}catch{return e}},C=(e,t,n)=>{let r=v(e);if(!r)return e;let i={};t.dateStyle?i.dateStyle=t.dateStyle:(t.year&&(i.year=t.year),t.month&&(i.month=t.month)),t.timeStyle&&(i.timeStyle=t.timeStyle),t.timeStyle&&t.hour12==="always"?i.hour12=!0:t.timeStyle&&t.hour12==="never"&&(i.hour12=!1),i.timeZone=O(n);try{return new Intl.DateTimeFormat(void 0,i).format(r)}catch{return e}},p=(e,t)=>e.getFieldAlias?.(t)??e.fieldsIndex?.get(t)?.alias??e.fieldsIndex?.get(t)?.name??t,F=(e,t,n,r,i)=>{if(n==null)return n;let o=e.getFieldConfiguration?.(t)?.fieldFormat;return o?.type==="number"?x(n,o):o?.type==="date-time"?!r||y(r)?C(n,o,i):n:I(n,r,i)},G=(e,t,n,r)=>{let i=e.fieldsIndex?.get(t),o=g(t,n,e)??n;return F(e,t,o,i?.type,r)},$=(e,t)=>p(e,t),k=(e,t,n)=>{let r=e.objectIdField,i=t.features.map(s=>s.attributes[r]),o=t.features.map(s=>{let d=s.attributes,u={};return e.fields.forEach(a=>{if(!Object.hasOwn(d,a.name))return;let l=d[a.name];if(a.name===r){u[a.name]=l;return}let D=g(a.name,l,e)??l,b=p(e,a.name);u[b]=F(e,a.name,D,a.type,n)}),u});return{objectIds:i,attributes:o}};return{a:j,b:G,c:$,d:k}},"intl")
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import c from"./
|
|
2
|
+
import c from"./3LXXSMA5.js";import"./M3MRIGDZ.js";import b from"./6QJFOL6M.js";import"./UZL6UVE4.js";import a from"./ZJEWP2ND.js";import"./HO2YDJI2.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./S3XUYAUX.js";import"./WZFC5HUX.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as m}from"./ONQ6JSBJ.js";import{Bc as i}from"./LUY6V4TP.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import b from"./YGCTAIBS.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,a])=>{return a},a,b)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a}from"./ONQ6JSBJ.js";import{Bc as n}from"./LUY6V4TP.js";import{Dd as e}from"./MWYBF3F3.js";export default $arcgis.t(([m])=>{async function r(t){let o=new m({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await t.goTo(o),{text:"Successfully zoomed to world extent"}}async function s(t,o){let{mapView:i}=a(o,["mapView"]);return await r(i)}var c=e.object({}),u=n(s,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:c});return u},"geometry/Extent")
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import b from"./W5J4Q3RO.js";import"./34O57OGV.js";import"./FDOMMK2M.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,a])=>{return a},a,b)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as c}from"./ONQ6JSBJ.js";import{Bc as n}from"./LUY6V4TP.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([m])=>{async function r(t,a,o){let i={target:new m({longitude:t.longitude,latitude:t.latitude,spatialReference:{wkid:4326}})};return o?.zoom!==void 0&&(i.zoom=o.zoom),o?.scale!==void 0&&(i.scale=o.scale),await a.goTo(i),{text:`Successfully navigated to: ${[`(${t.latitude}\xB0, ${t.longitude}\xB0)`,o?.zoom!==void 0?`zoom ${o.zoom}`:"",o?.scale!==void 0?`scale 1:${o.scale}`:""].filter(Boolean).join(", ")}`}}async function s({center:t,zoom:a,scale:o},i){let{mapView:l}=c(i,["mapView"]);return await r(t,l,{zoom:a,scale:o})}var d=e.object({center:e.object({longitude:e.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:e.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:e.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:e.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),g=n(s,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:d});return g},"geometry/Point")
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import b from"./CCC6LBMY.js";import{a as N,b as O}from"./34O57OGV.js";import a from"./QNNGPA3Q.js";import{a as S}from"./ONQ6JSBJ.js";import{Bc as L}from"./LUY6V4TP.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([{a:p,b:g,c:v,d:b},{d:j}])=>{var w=25,C=i=>i.flatMap(r=>r.split(",")).map(r=>r.trim()).map(r=>r.split(/\s+/u)[0]?.replace(/^"|"$/gu,"")).filter(r=>!!r),R=async(i,r,t,f)=>{let s=r.map?.allLayers.find(u=>u.id===i.layerId),l=await r.whenLayerView(s),h=s.title??i.layerId,c;if(t){let u=await v(t,r);if("error"in u){let o={error:u.error};if(g(t)){let d=r.map?.allLayers.find(m=>m.id===t.layerId);o.geometryLayerName=d?.title??d?.id,o.geometryLayerId=t.layerId,o.geometryWhere=t.where}else p(t)&&(o.point=t.point);return{tool:"queryFeatures",layerName:h,summary:"Geometry lookup failed",details:o}}if(!u.geometry){let o={};if(g(t)){let d=r.map?.allLayers.find(m=>m.id===t.layerId);o.error=`No features found matching: ${t.where}`,o.geometryLayerName=d?.title??d?.id,o.geometryLayerId=t.layerId,o.geometryWhere=t.where}else p(t)&&(o.error="Failed to create point geometry",o.point=t.point);return{tool:"queryFeatures",layerName:h,summary:"No features found for geometry filter",details:o}}c=u.geometry}else f&&(c=r.extent.clone());let x=[...new Set([...i.outFields,...C(i.orderByFields)])],F=N(l,x,f??!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,c&&(a.geometry=c,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 l.queryFeatureCount(a):await s.queryFeatureCount(a),n>0&&n<=w&&(y=F?await l.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:T}=y?j(s,y,r.timeZone):{objectIds:void 0,attributes:void 0};return{tool:"queryFeatures",layerName:h,summary:`${n} features found`,details:{totalCount:n,where:i.where,orderByFields:i.orderByFields,outFields:i.outFields,...q&&{objectIds:q,objectIdField:I},...T&&{attributes:T},...n>w&&{note:`${n} features found.`}}}};async function k({targetLayer:i,geometryFilter:r,useCurrentExtent:t},f){let{mapView:s}=S(f,["mapView"]),l=await R(i,s,r,t);return JSON.stringify(l,null,2)}var W=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:b.optional().describe("The units for the distance buffer.")}),B=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:b.optional().describe("The units for the distance buffer.")}),E=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 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([W,B]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),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).")}),P=L(k,{name:"queryFeatures",description:`Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if \u226425 features match.
|
|
3
|
+
|
|
4
|
+
USE THIS TOOL FOR:
|
|
5
|
+
- "Show / display / list features where..." \u2014 finding and listing features
|
|
6
|
+
- "How many X are Y?" \u2014 counting features that match a condition
|
|
7
|
+
- "Which features..." / "Find features..." \u2014 identifying specific features
|
|
8
|
+
- Spatial queries \u2014 finding features near/within/intersecting other features
|
|
9
|
+
- Any question where the user wants to SEE or COUNT matching features
|
|
10
|
+
|
|
11
|
+
This is the DEFAULT tool for most queries. When in doubt, use this tool.`,schema:E});return P},a,b)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import q from"./OHMNQ3RU.js";import p from"./3ZPPYCNL.js";import n from"./RU5DVLYG.js";import l from"./HNMFFLSY.js";import"./RATZTLNX.js";import k from"./W5FLNFSN.js";import j from"./W5J4Q3RO.js";import h from"./MKJS7QYQ.js";import g from"./ITBQGOMF.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import{a as o,c as m}from"./V6HOUZPZ.js";import"./3U476GCP.js";import"./FDOMMK2M.js";import e from"./3MJQA533.js";import"./E25RINU2.js";import"./SABZC4D4.js";import d from"./GG3AESSV.js";import"./KZACIY2W.js";import"./XGBEHER5.js";import"./JWPB3XZM.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./ZJEWP2ND.js";import"./HO2YDJI2.js";import"./7TO56JHS.js";import"./4YDXYW4J.js";import b from"./YGCTAIBS.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./WZFC5HUX.js";import"./E7KEOJZG.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,,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","views/LinkChartView","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,n,p,q)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as c}from"./ONQ6JSBJ.js";import{Bc as a}from"./LUY6V4TP.js";import{a as t}from"./VXFQANGJ.js";async function i(o,e){return await e.goTo({scale:o}),{text:`Successfully zoomed to: ${o}`}}async function r({scale:o},e){let{mapView:s}=c(e,["mapView"]);return await i(o,s)}var m=t.object({scale:t.number().describe("The map scale of the view to go to.")}),p=a(r,{name:"goToScale",description:"Go to the specified view scale.",schema:m});export{p as a};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import d from"./3ZPPYCNL.js";import c from"./RU5DVLYG.js";import b from"./CCC6LBMY.js";import{a as y}from"./FDOMMK2M.js";import a from"./ZJEWP2ND.js";import{a as k}from"./ONQ6JSBJ.js";import{a as n}from"./HJG7QM2R.js";import{Wa as N,a as $,b as S}from"./E7KEOJZG.js";import{ca as C}from"./LUY6V4TP.js";export default $arcgis.t(([,,,,,,U,W,{n:A,p:T},{a:M},{a:V,c:w,d:R,e:z,r:L,s:D,t:F,u:O},b])=>{var B=async(e,t)=>(await n({text:"Exiting Data Exploration agent"},t),e),H=async(e,t)=>{await n({text:"Requesting LLM for layer filter results"},t);let a=await w("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:d,userTimezoneOffset:o}=M(),s={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},i=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:s,tools:F}),r=[...e.dataExplorationMessages,i];if(!((i.tool_calls?.length??0)>0))return await n({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:r};let c=r,l=i.content.toString();return await b(i,t),{...e,dataExplorationMessages:c,outputMessage:l}},J=async(e,t)=>{await n({text:"Requesting LLM for layer query results"},t);let a=await w("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:d,userTimezoneOffset:o}=M(),s=e.agentExecutionContext.sharedState,i=s.lastNavigatedFeatures?.value,r=s.lastResolvedLocation?.value,c="none";if(i!=null)try{c=JSON.stringify(i)}catch{c="none"}let l="none";if(r!=null)try{l=JSON.stringify({address:r.address,location:r.location})}catch{l="none"}let g={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,lastNavigatedFeatures:c,lastResolvedLocation:l},m=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:g,tools:D}),h=(m.tool_calls?.length??0)>0,f=m.content.toString();return await b(m,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,m],...h?{}:{outputMessage:f},status:"success",summary:f&&!h?R(f):"Query planning completed."}},P=async(e,t)=>{try{await n({text:"Requesting LLM for summary on query results"},t);let a=await w("summarize_query_response_prompt"),d={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=await A({promptText:a,modelTier:"fast",config:t,messages:e.dataExplorationMessages,inputVariables:d}),s=typeof o=="string"?o:o.content,i=new C(s);await n({text:`Received response from LLM: ${s}`},t);let r=s;return{...e,outputMessage:r,status:"success",summary:r?R(r):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,i]}}catch(a){throw await n({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function K(e,t){if((e.queryResponse??[]).some(d=>{let o=d.details;return typeof o=="object"&&o!==null&&"error"in o}))return await n({text:"Skipping layer filter tool because query response contains an error."},t),{...e};let a=await new V(F,{handleToolErrors:!1}).invoke({messages:e.dataExplorationMessages},t);return await n({text:`Finished executing layer filter tool: ${a.messages.map(d=>d.content).join(", ")}`},t),{...e}}var X=10,Y=["string","small-integer","integer"],Z=async(e,t,{includeSummaryStatistics:a=!0,includeUniqueValues:d=!0}={})=>{let o=null,s=null;try{if(t.type!=="geometry"&&t.type!=="oid"&&t.type!=="global-id"){a&&(o=await U({layer:e,field:t.name}));let i=t.domain?.type==="coded-value"?t.domain:null;d&&(Y.includes(t.type)||i)&&(s=(await W({layer:e,field:t.name})).uniqueValueInfos.sort((r,c)=>c.count-r.count).slice(0,X),i&&(s=s.map(r=>({...r,value:i.getName(r.value)??r.value}))))}}catch(i){console.error(`Error fetching statistics for field ${t.name}:`,i)}return{summaryStatistics:o,uniqueValues:s}};function ee(e,t){return["string","small-integer","integer"].includes(e)||t==="coded-value"}async function te(e,t,a,d=!0){let o=[],s=[],i=[];for(let r of e){let c=function(p){let u=t.get(p)?.layerItem;return u?[u.name&&`Name: ${u.name}`,u.title&&`Title: ${u.title}`,u.description&&`Description: ${u.description}`].filter(Boolean).join(" | "):p},{layerId:l,results:g}=r,m=a.map?.allLayers.find(p=>p.id===l),h=t.get(l)?.fieldRegistry;if(!h)continue;let f=o.find(p=>p.layerId===l);f||(f={layerId:l,layerSummary:c(l),fieldInfos:[]},o.push(f));for(let p of g){let u=h.get(p.name);if(!u)continue;let x=u.statistics,v=d&&!x?.summaryStatistics,q=ee(u.type,u.domain?.type)&&!x?.uniqueValues,_=v||q;if(i.push({layerId:l,fieldName:u.name,didFetchStatistics:_}),_){let G=Z(m,u,{includeSummaryStatistics:v,includeUniqueValues:q}).then(I=>{let E={summaryStatistics:x?.summaryStatistics??null,uniqueValues:x?.uniqueValues??null};v&&(E.summaryStatistics=I.summaryStatistics),q&&(E.uniqueValues=I.uniqueValues),h.set(u.name,{...u,statistics:E}),u.statistics=E});s.push(G)}f.fieldInfos.push(u)}}return await Promise.all(s),{layerFieldInfo:o,didFetchStatistics:s.length>0,fieldStatisticsFetchStatus:i}}var j=/\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 ae(e,t){return j.test(e)||j.test(t)}var se=async(e,t)=>{try{await n({text:"Preparing field information for vector search results"},t);let a=y(t,"layersAndFieldsRegistry"),{mapView:d}=k(t,["mapView"]),{assignedTask:o,userRequest:s}=e.agentExecutionContext,i=ae(o,s),{layerFieldInfo:r,didFetchStatistics:c,fieldStatisticsFetchStatus:l}=await te(e.vectorSearchFieldResults,a,d,i);c?await n({text:"Statistics fetched"},t):await n({text:"Statistics skipped"},t);for(let g of l)await n({text:` - ${g.fieldName} - stats ${g.didFetchStatistics?"fetched":"skipped"}`},t);return await n({text:"Field information prepared"},t),{...e,layerFieldInfo:r}}catch(a){throw await n({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},Q=.7,re=10,ie=async(e,t)=>{try{await n({text:"Similarity search to find fields"},t);let a=y(t,"fieldSearch"),d=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),s=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:Q,topResults:re,embeddingCache:o}),i=s.map(({layerId:c,results:l})=>{let g=l.map(m=>` - ${m.name} (${m.score.toFixed(2)})`).join(`
|
|
3
|
+
`);return`${d.get(c)?.layerItem.name??c}:
|
|
4
|
+
${g}`}).join(`
|
|
5
|
+
`),r;return s.length>0?r=`Vector search completed. Matching layers and fields with scores:
|
|
6
|
+
${i}`:r=`No vector search results found for score over ${Q}.`,await n({text:r},t),{...e,vectorSearchFieldResults:s}}catch(a){throw await n({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)}`)}},oe=.7,ne=async(e,t)=>{try{await n({text:`Similarity search to find layers: ${e.agentExecutionContext.assignedTask}`},t);let a=y(t,"layerSearch"),d=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),s=await a.searchLayers({text:e.agentExecutionContext.assignedTask,minScore:oe,embeddingCache:o}),i=s.map(l=>l.id),r=s.map(({id:l,score:g})=>`${d.get(l)?.layerItem.name??l} (${g.toFixed(2)})`).join(`
|
|
7
|
+
`),c;return i.length>0?c=`Vector search completed. Matching layers with scores:
|
|
8
|
+
${r}`:c="Vector search completed. No matching layers found.",await n({text:c},t),{...e,vectorSearchLayerIds:i}}catch(a){throw await n({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)}`)}},le=(e,t)=>z(["layerSearch","fieldSearch","layersAndFieldsRegistry"],"Data Exploration Agent")(e,t),de=()=>new N(L).addNode("requireDataExplorationServices",le).addNode("vectorSearchLayers",ne).addNode("vectorSearchFields",ie).addNode("fieldStatistics",se).addNode("queryAgent",J).addNode("queryTools",O).addNode("summarizeQueryResponseLLM",P).addNode("filterAgent",H).addNode("filterTools",K).addNode("earlyExit",B).addEdge($,"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":S).addEdge("filterTools",S).addEdge("earlyExit",S),ce=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).
|
|
9
|
+
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.
|
|
10
|
+
_Example: “Only show stations where Brand is Shell”_
|
|
11
|
+
_Example: “Make Shell stations stand out on the map”_
|
|
12
|
+
_Example: “Gray out all stations that aren’t Shell”_
|
|
13
|
+
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.
|
|
14
|
+
_Example: “How many features are there?”_
|
|
15
|
+
_Example: “What’s the average population?”_
|
|
16
|
+
_Example: “Which values are in the status field?”_
|
|
17
|
+
|
|
18
|
+
This agent does NOT handle help/metadata requests such as listing available layers, listing field names/columns/attributes for a layer, or capability guidance.`,Ie={id:"dataExploration",name:"Data Exploration Agent",description:ce,createGraph:de,workspace:L};return Ie},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues",a,b,c,d)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as n}from"./ONQ6JSBJ.js";import{Bc as o}from"./LUY6V4TP.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};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import b from"./CCC6LBMY.js";import{a as F,b as T}from"./34O57OGV.js";import a from"./QNNGPA3Q.js";import{a as h}from"./ONQ6JSBJ.js";import{Bc as g}from"./LUY6V4TP.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([I,x,{c:b,d:y},{d:w}])=>{var k=o=>o.flatMap(t=>t.split(",")).map(t=>t.trim()).map(t=>t.split(/\s+/u)[0]?.replace(/^"|"$/gu,"")).filter(t=>!!t),j=async(o,t,n,a,u)=>{let s=n.map?.allLayers.find(i=>i.id===o.layerId),d=await n.whenLayerView(s),c=s.title??o.layerId,l;if(a){let i=await b(a,n);if("error"in i)return{tool:"getTopFeatures",layerName:c,summary:"Geometry lookup failed",details:{error:i.error}};if(!i.geometry)return{tool:"getTopFeatures",layerName:c,summary:"No features found for geometry filter",details:{error:`No features found matching: ${"where"in a?a.where:"unknown criteria"}`}};l=i.geometry}else u&&(l=n.extent.clone());let m=t.groupByFields&&t.groupByFields.length>0,p=s.objectIdField,f=o.outFields.includes("*")?["*"]:[...new Set([...o.outFields,p])];try{let i;if(m){let r=new I({where:o.where||"1=1",outFields:f,orderByFields:o.orderByFields,geometry:l,spatialRelationship:l?"intersects":void 0,distance:a?.distance,units:a?.units,topFilter:new x({topCount:t.topCount,groupByFields:t.groupByFields,orderByFields:t.orderByFields})});i=await s.queryTopFeatures(r)}else{let r=s.createQuery();r.where=T(s.definitionExpression,o.where||"1=1"),r.outFields=f.length?f:["*"],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 C=[...new Set([...o.outFields,...k(t.orderByFields)])],v=F(d,C,u??!1);try{i=v?await d.queryFeatures(r):await s.queryFeatures(r)}catch(N){console.warn("Client-side query failed, falling back to server:",N),i=await s.queryFeatures(r)}}let B=i.features.map(r=>r.attributes[p]),{attributes:S}=w(s,i,n.timeZone);return{tool:"getTopFeatures",layerName:c,summary:`Top ${t.topCount} features extracted`,details:{topCount:t.topCount,attributes:S,objectIds:B,objectIdField:p,where:o.where,orderByFields:t.orderByFields,...m&&{groupByFields:t.groupByFields}}}}catch(i){return{tool:"getTopFeatures",layerName:c,summary:"Query failed",details:{error:i instanceof Error?i.message:String(i)}}}},q=async({targetLayer:o,topFilter:t,geometryFilter:n,useCurrentExtent:a},u)=>{let{mapView:s}=h(u,["mapView"]),d=await j(o,t,s,n,a);return JSON.stringify(d,null,2)},R=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:y.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:y.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("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([R,L]).optional().describe("Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."),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).")}),$=g(q,{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:D});return $},"rest/support/TopFeaturesQuery","rest/support/TopFilter",a,b)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import c from"./ITBQGOMF.js";import b from"./CCC6LBMY.js";import"./34O57OGV.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import c from"./MKJS7QYQ.js";import b from"./CCC6LBMY.js";import"./34O57OGV.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
|