@arcgis/ai-components 5.2.0-next.78 → 5.2.0-next.79
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/agentic-workflow/jsonTypes.d.ts +2 -12
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +2 -3
- package/dist/agents/tools/search/findRelevantFields/adapter.d.ts +8 -0
- package/dist/agents/tools/search/findRelevantFields/adapter.js +57 -0
- package/dist/agents/tools/search/findRelevantLayers/adapter.d.ts +8 -0
- package/dist/agents/tools/search/findRelevantLayers/adapter.js +38 -0
- package/dist/cdn/{ERNYKCUJ.js → 4AGGYAWS.js} +1 -1
- package/dist/cdn/{YWULKUQV.js → 6ADMWEVE.js} +1 -1
- package/dist/cdn/7BCQMK6D.js +2 -0
- package/dist/cdn/7QOC7FQE.js +2 -0
- package/dist/cdn/{IIIUSDQR.js → EAOKCWED.js} +6 -6
- package/dist/cdn/IBZ2NEAO.js +2 -0
- package/dist/cdn/{PKJY7FBV.js → KP2FWABJ.js} +1 -1
- package/dist/cdn/LM2IGECE.js +2 -0
- package/dist/cdn/{PBMQI4MV.js → MAPKEX67.js} +1 -1
- package/dist/cdn/{J7OJABFU.js → MYH43WYG.js} +1 -1
- package/dist/cdn/{GAPKW32H.js → NPBXE4EQ.js} +1 -1
- package/dist/cdn/{BGD2CCRJ.js → NZJ6LLYY.js} +1 -1
- package/dist/cdn/RHYNE5OE.js +2 -0
- package/dist/cdn/W7OT3KRG.js +18 -0
- package/dist/cdn/XCNN7BQ3.js +2 -0
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +14 -14
- package/dist/chunks/dataExplorationGraph.js +121 -195
- package/dist/chunks/fieldStatistics.js +79 -0
- package/dist/chunks/layerStylingGraph.js +9 -9
- package/dist/components/arcgis-assistant-agent/customElement.js +152 -184
- 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 +7 -5
- package/dist/agentic-workflow/nodes/support/Prompt.d.ts +0 -20
- package/dist/cdn/BS3HNSXX.js +0 -2
- package/dist/cdn/BWLXDT75.js +0 -2
- package/dist/cdn/I7KCB7KE.js +0 -18
- package/dist/cdn/YYSRYOHL.js +0 -2
- /package/dist/cdn/{3ORURUNE.js → J4R7KYJ3.js} +0 -0
|
@@ -33,18 +33,11 @@ export type AgenticWorkflowEndMessageNodeJson = AgenticWorkflowBaseNodeJson<"end
|
|
|
33
33
|
|
|
34
34
|
export type AgenticWorkflowAgentNodeJson = AgenticWorkflowBaseNodeJson<"agent_node">
|
|
35
35
|
& {
|
|
36
|
-
readonly prompt?: AgenticWorkflowPromptJson
|
|
36
|
+
readonly prompt?: AgenticWorkflowPromptJson;
|
|
37
37
|
readonly structured_output?: AgenticWorkflowStructuredJsonSchemaJson;
|
|
38
38
|
readonly tools?: AgenticWorkflowToolJson[];
|
|
39
39
|
};
|
|
40
40
|
|
|
41
|
-
export type AgenticWorkflowPromptJson = AgenticWorkflowJsonObject
|
|
42
|
-
& {
|
|
43
|
-
readonly id: AgenticWorkflowPromptIdJson;
|
|
44
|
-
readonly messages?: AgenticWorkflowPromptMessageJson[];
|
|
45
|
-
readonly type: "plain_text";
|
|
46
|
-
};
|
|
47
|
-
|
|
48
41
|
export type AgenticWorkflowArcgisToolJson = AgenticWorkflowJsonObject
|
|
49
42
|
& {
|
|
50
43
|
readonly type: "arcgis_tool";
|
|
@@ -77,8 +70,6 @@ export type AgenticWorkflowNodeIdJson = `${string}_node_${number}`;
|
|
|
77
70
|
|
|
78
71
|
export type AgenticWorkflowSourceAnchorIdJson = `source_anchor_${string}`;
|
|
79
72
|
|
|
80
|
-
export type AgenticWorkflowPromptIdJson = `prompt_${string}`;
|
|
81
|
-
|
|
82
73
|
export type AgenticWorkflowNodeJson = AgenticWorkflowAgentNodeJson | AgenticWorkflowEndMessageNodeJson | AgenticWorkflowGuardrailsNodeJson | AgenticWorkflowHumanInTheLoopNodeJson | AgenticWorkflowLoopNodeJson | AgenticWorkflowStartNodeJson;
|
|
83
74
|
|
|
84
75
|
export type AgenticWorkflowGuardrailsNodeJson = AgenticWorkflowBaseNodeJson<"guardrails_node">
|
|
@@ -108,10 +99,9 @@ export type AgenticWorkflowConditionJson = AgenticWorkflowJsonObject
|
|
|
108
99
|
readonly source_anchor_id: AgenticWorkflowSourceAnchorIdJson;
|
|
109
100
|
};
|
|
110
101
|
|
|
111
|
-
export type
|
|
102
|
+
export type AgenticWorkflowPromptJson = AgenticWorkflowJsonObject
|
|
112
103
|
& {
|
|
113
104
|
readonly content?: string;
|
|
114
|
-
readonly role?: "assistant" | "system" | "user";
|
|
115
105
|
};
|
|
116
106
|
|
|
117
107
|
export type AgenticWorkflowStructuredJsonSchemaJson = AgenticWorkflowJsonObject
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { BaseNode } from "./BaseNode.js";
|
|
2
2
|
import type { AgenticWorkflowAgentNodeJson } from "../jsonTypes.js";
|
|
3
|
-
import type { Prompt } from "./support/Prompt.js";
|
|
4
3
|
import type { AgentData, ZodObjectSchema } from "../../agent-utils/types.js";
|
|
5
4
|
import type { RuntimeNode, NodeCompilation, NodeCompilationContext } from "../types.js";
|
|
6
5
|
import type { ArcgisTool } from "./tools/ArcgisTool.js";
|
|
@@ -11,7 +10,7 @@ export class AgentNode extends BaseNode {
|
|
|
11
10
|
static fromJSON(json: AgenticWorkflowAgentNodeJson): AgentNode;
|
|
12
11
|
constructor(properties?: AgentNodeConstructProperties);
|
|
13
12
|
accessor outputSchema: ZodObjectSchema<AgentData> | undefined;
|
|
14
|
-
accessor prompt:
|
|
13
|
+
accessor prompt: string | undefined;
|
|
15
14
|
accessor tools: ArcgisTool[] | undefined;
|
|
16
15
|
/**
|
|
17
16
|
* The type of this node, which identifies it as an agent node within the workflow.
|
|
@@ -25,4 +24,4 @@ export class AgentNode extends BaseNode {
|
|
|
25
24
|
createRuntimeNode<TCustomState extends AgentData>(): RuntimeNode<TCustomState>;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
export type AgentNodeConstructProperties = Pick<AgentNode, "id" | "label" | "type">;
|
|
27
|
+
export type AgentNodeConstructProperties = Pick<AgentNode, "id" | "label" | "prompt" | "type">;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { tool as y } from "@langchain/core/tools";
|
|
3
|
+
import t from "zod";
|
|
4
|
+
import { f as h } from "../../../../chunks/fetchAgentContext.js";
|
|
5
|
+
import { f as r } from "../../../../chunks/fetchService.js";
|
|
6
|
+
import { b as p } from "../../../../chunks/fieldStatistics.js";
|
|
7
|
+
const v = 0.7, S = 10;
|
|
8
|
+
async function R(a) {
|
|
9
|
+
const {
|
|
10
|
+
query: e,
|
|
11
|
+
layerIds: i,
|
|
12
|
+
includeSummaryStatistics: s = !1,
|
|
13
|
+
fieldSearch: l,
|
|
14
|
+
layersAndFieldsRegistry: d,
|
|
15
|
+
embeddingCache: o,
|
|
16
|
+
mapView: c,
|
|
17
|
+
minScore: m = v,
|
|
18
|
+
topResults: f = S
|
|
19
|
+
} = a, n = await l.searchFields({
|
|
20
|
+
text: e,
|
|
21
|
+
layerIds: i,
|
|
22
|
+
minScore: m,
|
|
23
|
+
topResults: f,
|
|
24
|
+
embeddingCache: o
|
|
25
|
+
}), u = await p(
|
|
26
|
+
n,
|
|
27
|
+
d,
|
|
28
|
+
c,
|
|
29
|
+
s
|
|
30
|
+
);
|
|
31
|
+
return { matches: n, ...u };
|
|
32
|
+
}
|
|
33
|
+
const b = t.object({
|
|
34
|
+
query: t.string().describe("A concise semantic description of the fields relevant to the user's task."),
|
|
35
|
+
layerIds: t.array(t.string()).min(1).describe("Layer IDs returned by findRelevantLayers, restricted to layers relevant to the current task."),
|
|
36
|
+
includeSummaryStatistics: t.boolean().optional().default(!1).describe(
|
|
37
|
+
"Set to true only when the task directly asks for numeric summaries such as average, minimum, maximum, total, variance, or range."
|
|
38
|
+
)
|
|
39
|
+
});
|
|
40
|
+
async function F(a, e) {
|
|
41
|
+
const { mapView: i } = h(e, ["mapView"]), s = await R({
|
|
42
|
+
...a,
|
|
43
|
+
fieldSearch: r(e, "fieldSearch"),
|
|
44
|
+
layersAndFieldsRegistry: r(e, "layersAndFieldsRegistry"),
|
|
45
|
+
embeddingCache: r(e, "embeddingCache"),
|
|
46
|
+
mapView: i
|
|
47
|
+
});
|
|
48
|
+
return JSON.stringify(s, null, 2);
|
|
49
|
+
}
|
|
50
|
+
const C = y(F, {
|
|
51
|
+
name: "findRelevantFields",
|
|
52
|
+
description: "Finds relevant fields within candidate layers. Returns ranked matches, field metadata, categorical values, and optional numeric summary statistics. Call findRelevantLayers first when layer IDs are not already known.",
|
|
53
|
+
schema: b
|
|
54
|
+
});
|
|
55
|
+
export {
|
|
56
|
+
C as findRelevantFieldsTool
|
|
57
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { tool as y } from "@langchain/core/tools";
|
|
3
|
+
import i from "zod";
|
|
4
|
+
import { f as n } from "../../../../chunks/fetchService.js";
|
|
5
|
+
const m = 0.7;
|
|
6
|
+
async function h(r) {
|
|
7
|
+
const { query: e, layerSearch: a, layersAndFieldsRegistry: l, embeddingCache: o, minScore: c = m } = r;
|
|
8
|
+
return (await a.searchLayers({ text: e, minScore: c, embeddingCache: o })).map(({ id: s, score: d }) => {
|
|
9
|
+
const t = l.get(s)?.layerItem;
|
|
10
|
+
return {
|
|
11
|
+
layerId: s,
|
|
12
|
+
score: d,
|
|
13
|
+
name: t?.name ?? void 0,
|
|
14
|
+
title: t?.title,
|
|
15
|
+
description: t?.description
|
|
16
|
+
};
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
const f = i.object({
|
|
20
|
+
query: i.string().describe("A concise semantic description of the layers relevant to the user's task.")
|
|
21
|
+
});
|
|
22
|
+
async function p({ query: r }, e) {
|
|
23
|
+
const a = await h({
|
|
24
|
+
query: r,
|
|
25
|
+
layerSearch: n(e, "layerSearch"),
|
|
26
|
+
layersAndFieldsRegistry: n(e, "layersAndFieldsRegistry"),
|
|
27
|
+
embeddingCache: n(e, "embeddingCache")
|
|
28
|
+
});
|
|
29
|
+
return JSON.stringify({ layers: a }, null, 2);
|
|
30
|
+
}
|
|
31
|
+
const S = y(p, {
|
|
32
|
+
name: "findRelevantLayers",
|
|
33
|
+
description: "Finds map layers relevant to a task and returns their layer IDs, similarity scores, names, titles, and descriptions. Call this before finding fields or querying data when layer IDs are not already known.",
|
|
34
|
+
schema: f
|
|
35
|
+
});
|
|
36
|
+
export {
|
|
37
|
+
S as findRelevantLayersTool
|
|
38
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import q from"./
|
|
2
|
+
import q from"./EAOKCWED.js";import p from"./ONMNQBPO.js";import n from"./J4R7KYJ3.js";import{a as o,c as m}from"./YLGKKWZK.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./MMHDT4KV.js";import"./RLEHNAIA.js";import c from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.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)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import n from"./
|
|
2
|
+
import n from"./MYH43WYG.js";import m from"./J4R7KYJ3.js";import{c as s,d as p}from"./YLGKKWZK.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import i from"./OAKRPM7D.js";import h from"./V52XWEGV.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./MMHDT4KV.js";import"./RLEHNAIA.js";import c from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as e,z as o}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.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 b from"./RHYNE5OE.js";import{a as t}from"./FDOMMK2M.js";import{a as l}from"./ONQ6JSBJ.js";import{Dc as d}from"./AI6DYOKR.js";import{a}from"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([o])=>{var g=.7,b=10;async function S(i){let{query:e,layerIds:s,includeSummaryStatistics:r=!1,fieldSearch:c,layersAndFieldsRegistry:m,embeddingCache:y,mapView:u,minScore:f=g,topResults:h=b}=i,n=await c.searchFields({text:e,layerIds:s,minScore:f,topResults:h,embeddingCache:y}),p=await o(n,m,u,r);return{matches:n,...p}}var v=a.object({query:a.string().describe("A concise semantic description of the fields relevant to the user's task."),layerIds:a.array(a.string()).min(1).describe("Layer IDs returned by findRelevantLayers, restricted to layers relevant to the current task."),includeSummaryStatistics:a.boolean().optional().default(!1).describe("Set to true only when the task directly asks for numeric summaries such as average, minimum, maximum, total, variance, or range.")});async function w(i,e){let{mapView:s}=l(e,["mapView"]),r=await S({...i,fieldSearch:t(e,"fieldSearch"),layersAndFieldsRegistry:t(e,"layersAndFieldsRegistry"),embeddingCache:t(e,"embeddingCache"),mapView:s});return JSON.stringify(r,null,2)}var A=d(w,{name:"findRelevantFields",description:"Finds relevant fields within candidate layers. Returns ranked matches, field metadata, categorical values, and optional numeric summary statistics. Call findRelevantLayers first when layer IDs are not already known.",schema:v});return A},b)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import w from"./MYH43WYG.js";import v from"./EAOKCWED.js";import t from"./NPBXE4EQ.js";import s from"./W7OT3KRG.js";import r from"./NZJ6LLYY.js";import q from"./ONMNQBPO.js";import p from"./J4R7KYJ3.js";import o from"./KITIP6J2.js";import"./Z5W4V7RC.js";import n from"./RHYNE5OE.js";import m from"./KWD2ECTM.js";import l from"./U2D53TAX.js";import k from"./OAKRPM7D.js";import j from"./V52XWEGV.js";import i from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import e from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import d from"./L7XTRDFM.js";import c from"./AT4XVTJR.js";import{e as g,f as h}from"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./R74ZHFA6.js";import{a as y,b as u}from"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.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:f,m:M,n:E,o:P,p:T,q:x,r:D},{a:p,b:V},,,,,,,,,,,,W,R,O,L,k])=>{var U=async e=>{let a=e.allLayers.toArray(),o=[],r=new Map;for(let t of a)if(t instanceof C){let i=(async()=>{let n=await x(t),s=await D(t,n);r.set(t.id,{layerItem:s,fieldRegistry:n})})();o.push(i)}return await Promise.all(o),r},q=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:o}=await z(a),r={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:b,model:S,dimensions:A,templates:{layer:d,field:f}},layers:o},t=M.safeParse(r);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=[],o=[];for(let[i,{fieldRegistry:n,layerItem:s}]of e.entries()){let l=H(d,{name:s.name,title:s.title,description:s.description});a.push(l);let m={id:i,name:s.name??"",title:s.title,description:s.description,vector:[],fields:[]};for(let[,c]of n.entries()){let N=H(f,{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:[]})}o.push(m)}let r=await p(a),t=0;return{layers:o.map(i=>(i.vector=r[t++],i.fields.forEach(n=>{n.vector=r[t++]}),i))}},H=(e,a)=>e.replace(/\{(\w+)\}/gu,(o,r)=>a[r]??""),F=(e,a)=>{if(e.length!==a.length)throw new Error("Vectors must be the same length");let o=0,r=0,t=0;for(let s=0;s<e.length;++s){let l=e[s],m=a[s];o+=l*m,r+=l*l,t+=m*m}let i=Math.sqrt(r*t);if(i===0)return 0;let n=o/i;return Math.max(-1,Math.min(1,n))},ee=E,ae=P,te=T,se=y,re=p,oe=F,ie=O,ne=L,me=R,ce=W,le=k,de=q,fe=()=>g(),pe=()=>h(),ge=async(e,a)=>await u(e,a),he=async({modelTier:e="default",config:a}={})=>await w({modelTier:e,config:a});return{ArcgisKnowledgeAgent:le,DataExplorationAgent:me,HelpAgent:ce,LayerStylingAgent:ne,NavigationAgent:ie,Orchestrator:V,cosineSimilarity:oe,createAgentRuntimeState:fe,createAgentRuntimeStateWithSharedState:pe,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,w)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import c from"./ONMNQBPO.js";import b from"./
|
|
2
|
+
import c from"./ONMNQBPO.js";import b from"./J4R7KYJ3.js";import{a as g}from"./FDOMMK2M.js";import a from"./AT4XVTJR.js";import{a as i}from"./7VAQUCBU.js";import{Ya as S,a as u,b as p,s as f}from"./EWLXNGKH.js";export default $arcgis.t(([,,,,,,{p:x},{a:w,c:E,e:I,f:v,g:L,h:F,i:$,j:C,k:N,l:R,m:T,n:b,o:A,p:_,q:h},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await i({text:"Similarity search to find fields"},t);let e=g(t,"fieldSearch"),n=g(t,"layersAndFieldsRegistry"),o=g(t,"embeddingCache"),r=await e.searchFields({text:a.agentExecutionContext.assignedTask,layerIds:a.vectorSearchLayerIds,minScore:V,topResults:z,embeddingCache:o}),m=r.map(({layerId:d,results:c})=>{let y=c.map(s=>` - ${s.name} (${s.score.toFixed(2)})`).join(`
|
|
3
3
|
`);return`${n.get(d)?.layerItem.name??d}:
|
|
4
|
-
${
|
|
4
|
+
${y}`}).join(`
|
|
5
5
|
`),l;return r.length>0?l=`Vector search completed. Matching layers and fields with scores:
|
|
6
|
-
${m}`:l=`No vector search results found for score over ${
|
|
6
|
+
${m}`:l=`No vector search results found for score over ${V}.`,await i({text:l},t),{...a,vectorSearchFieldResults:r}}catch(e){throw await i({text:`Error during vector search: ${e instanceof Error?e.message:String(e)}`},t),new Error(`Vector search failed: ${e instanceof Error?e.message:String(e)}`)}},G=.7,H=async(a,t)=>{try{await i({text:`Similarity search to find layers: ${a.agentExecutionContext.assignedTask}`},t);let e=g(t,"layerSearch"),n=g(t,"layersAndFieldsRegistry"),o=await e.searchLayers({text:a.agentExecutionContext.assignedTask,minScore:G}),r=o.map(d=>d.id),m=o.map(({id:d,score:c})=>`${n.get(d)?.layerItem.name??d} (${c.toFixed(2)})`).join(`
|
|
7
7
|
`),l;return r.length>0?l=`Vector search completed. Matching layers with scores:
|
|
8
|
-
${m}`:l="Vector search completed. No matching layers found.",await i({text:l},t),{...a,vectorSearchLayerIds:r}}catch(e){throw await i({text:`Error during vector search: ${e instanceof Error?e.message:String(e)}`},t),new Error(`Vector search failed: ${e instanceof Error?e.message:String(e)}`)}},
|
|
8
|
+
${m}`:l="Vector search completed. No matching layers found.",await i({text:l},t),{...a,vectorSearchLayerIds:r}}catch(e){throw await i({text:`Error during vector search: ${e instanceof Error?e.message:String(e)}`},t),new Error(`Vector search failed: ${e instanceof Error?e.message:String(e)}`)}},k=[v,L,F,$,C,N,R,T,b,A,_],M=(a,t=3)=>{let e=a.map((o,r)=>o.type==="human"?r:-1).filter(o=>o!==-1);if(e.length===0)return[];let n=e.length>t?e[e.length-t]:e[0];return a.slice(n)},P=async(a,t)=>{await i({text:"Requesting LLM for layer query results"},t);let e=await E("navigation_intent_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let n={layerFieldInfo:a.layerFieldInfo},o=await x({promptText:e,modelTier:"advanced",config:t,messages:M(a.agentExecutionContext.messages),inputVariables:n,tools:k});return await q(o,t),{...a,agentExecutionContext:{...a.agentExecutionContext,messages:[...a.agentExecutionContext.messages,o]}}};async function B(a,t){let e=await new w(k,{handleToolErrors:!1}).invoke({messages:M(a.agentExecutionContext.messages)},t),n=e.messages.map(r=>r.text).join(`
|
|
9
9
|
`);await i({text:`Finished executing layer filter tool: ${n}`},t);let o=e.messages.map(r=>r.text).join(`
|
|
10
|
-
`);return{...a,outputMessage:o}}var U=async(a,t)=>(await i({text:"Exiting Layer Styling agent"},t),a),J=async(a,t)=>{try{await i({text:"Populating layer and field info"},t);let e=[];for(let n of a.vectorSearchFieldResults){let o=function(
|
|
10
|
+
`);return{...a,outputMessage:o}}var U=async(a,t)=>(await i({text:"Exiting Layer Styling agent"},t),a),J=async(a,t)=>{try{await i({text:"Populating layer and field info"},t);let e=[];for(let n of a.vectorSearchFieldResults){let o=function(y){let s=l.get(y)?.layerItem;return s?[s.name&&`Name: ${s.name}`,s.title&&`Title: ${s.title}`,s.description&&`Description: ${s.description}`].filter(Boolean).join(" | "):y},{layerId:r,results:m}=n,l=g(t,"layersAndFieldsRegistry"),d=l.get(r)?.fieldRegistry;if(!d)continue;let c=e.find(y=>y.layerId===r);c||(c={layerId:r,layerSummary:o(r),fieldInfos:[]},e.push(c));for(let y of m){let s=d.get(y.name);s&&c.fieldInfos.push(s)}}return await i({text:"Populated layerFieldInfo"},t),{...a,layerFieldInfo:e}}catch(e){throw await i({text:"Error populating layerFieldInfo"},t),new Error(`Error populating layerFieldInfo: ${e instanceof Error?e.message:String(e)}`)}},K=(a,t)=>{let e=a.vectorSearchLayerIds??[];if(e.length<=1)return{...a,selectedLayerId:a.vectorSearchLayerIds[0]};let{hitlResponse:n}=t.configurable;if(n?.agentId!==j.id||n.id!=="reviewLayerSelection"){let r={agentId:j.id,id:"reviewLayerSelection",kind:"singleSelection",message:"Choose a layer to apply the styles.",metadata:[...e]};throw new f(r)}let o=null;return Array.isArray(n.payload)&&n.payload.length>0&&(o=n.payload[0]),{...a,selectedLayerId:o??a.vectorSearchLayerIds[0]}},O=(a,t)=>I(["layerSearch","fieldSearch","layersAndFieldsRegistry"],"Layer Styling Agent")(a,t),Q=()=>new S(h).addNode("requireLayerStylingServices",O).addNode("vectorSearchLayers",H).addNode("layerSelectionHITL",K).addNode("vectorSearchFields",D).addNode("populateLayerFieldInfo",J).addNode("agent",P).addNode("tools",B).addNode("earlyExit",U).addEdge(u,"requireLayerStylingServices").addEdge("requireLayerStylingServices","vectorSearchLayers").addConditionalEdges("layerSelectionHITL",a=>a.vectorSearchLayerIds.length?"vectorSearchFields":"earlyExit").addConditionalEdges("vectorSearchFields",a=>a.vectorSearchFieldResults.length?"populateLayerFieldInfo":"earlyExit").addEdge("populateLayerFieldInfo","agent").addEdge("agent","tools").addEdge("tools",p).addEdge("earlyExit",p),W=String.raw`- **layerStyling** — User wants to change how features are drawn or styled on the map based on their data, such as applying color, size, transparency, symbols, or charts according to field values.
|
|
11
11
|
_Example: “Color points by sales amount”_
|
|
12
12
|
_Example: “Show population density with a color gradient”_
|
|
13
13
|
_Example: “Create a relationship map between height and depth”_
|
|
14
|
-
_Example: “Vary circle sizes according to population”_`,
|
|
14
|
+
_Example: “Vary circle sizes according to population”_`,j={id:"layerStyling",name:"Layer Styling Agent",description:W,createGraph:Q,workspace:h};return j},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer",a,b,c)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{a as r}from"./FDOMMK2M.js";import{Dc as o}from"./AI6DYOKR.js";import{a as s}from"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";var m=.7;async function h(a){let{query:e,layerSearch:t,layersAndFieldsRegistry:c,embeddingCache:l,minScore:d=m}=a;return(await t.searchLayers({text:e,minScore:d,embeddingCache:l})).map(({id:i,score:y})=>{let n=c.get(i)?.layerItem;return{layerId:i,score:y,name:n?.name??void 0,title:n?.title,description:n?.description}})}var f=s.object({query:s.string().describe("A concise semantic description of the layers relevant to the user's task.")});async function u({query:a},e){let t=await h({query:a,layerSearch:r(e,"layerSearch"),layersAndFieldsRegistry:r(e,"layersAndFieldsRegistry"),embeddingCache:r(e,"embeddingCache")});return JSON.stringify({layers:t},null,2)}var S=o(u,{name:"findRelevantLayers",description:"Finds map layers relevant to a task and returns their layer IDs, similarity scores, names, titles, and descriptions. Call this before finding fields or querying data when layer IDs are not already known.",schema:f});export{S as findRelevantLayersTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import q from"./
|
|
2
|
+
import q from"./NZJ6LLYY.js";import n from"./ONMNQBPO.js";import m from"./J4R7KYJ3.js";import{a as o,c as p}from"./YLGKKWZK.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./MMHDT4KV.js";import"./RLEHNAIA.js";import c from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.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)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import s from"./W7OT3KRG.js";import q from"./ONMNQBPO.js";import p from"./J4R7KYJ3.js";import{a as o,c as a}from"./YLGKKWZK.js";import n from"./KITIP6J2.js";import"./Z5W4V7RC.js";import m from"./RHYNE5OE.js";import l from"./KWD2ECTM.js";import k from"./U2D53TAX.js";import j from"./OAKRPM7D.js";import h from"./V52XWEGV.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import e from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./MMHDT4KV.js";import"./RLEHNAIA.js";import d from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import c from"./JKIESH74.js";import b from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.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,s)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import p from"./
|
|
2
|
+
import p from"./NPBXE4EQ.js";import n from"./ONMNQBPO.js";import m from"./J4R7KYJ3.js";import{a as o,c as s}from"./YLGKKWZK.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./MMHDT4KV.js";import"./RLEHNAIA.js";import c from"./AT4XVTJR.js";import"./7M6VKBTK.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.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-navigation-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-navigation-agent"),this.#i=s(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-navigation-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,p)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./J4R7KYJ3.js";import a from"./AT4XVTJR.js";import{a as c,b as k}from"./7VAQUCBU.js";import{Ya as x,a as w,b as d,j as f}from"./EWLXNGKH.js";import{ea as u}from"./AI6DYOKR.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(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import f from"./ONMNQBPO.js";import e from"./
|
|
2
|
+
import f from"./ONMNQBPO.js";import e from"./J4R7KYJ3.js";import d from"./KITIP6J2.js";import{a as Z}from"./Z5W4V7RC.js";import{a as h}from"./FDOMMK2M.js";import c from"./6HF36IKA.js";import{a as F}from"./Y7XD7ZRD.js";import{a as C}from"./VLLZ2FFU.js";import b from"./5ZFUGNRN.js";import{a as L}from"./LLUGJKAQ.js";import{a as _}from"./WKTQVBFJ.js";import{a as I}from"./K2R6XVK3.js";import a from"./AT4XVTJR.js";import{a as x}from"./ONQ6JSBJ.js";import{a as g}from"./7VAQUCBU.js";import{Ya as E,a as w,b as k}from"./EWLXNGKH.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
3
|
`):"",l=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",n=e.intent==="goToBookmark"&&c.length?`Available bookmarks:
|
|
4
4
|
${c.map(p=>`- ${p}`).join(`
|
|
5
5
|
`)}`:"",o=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import d from"./ONMNQBPO.js";import b from"./
|
|
2
|
+
import d from"./ONMNQBPO.js";import b from"./J4R7KYJ3.js";import{a as h}from"./7SRLZQVC.js";import{a as m}from"./FDOMMK2M.js";import a from"./AT4XVTJR.js";import{a as p}from"./7VAQUCBU.js";import{Ya as c,a as u,b as n}from"./EWLXNGKH.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):
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
export default $arcgis.t(([F,$])=>{var w=10,N=["string","small-integer","integer"],b=async(l,e,{includeSummaryStatistics:d=!0,includeUniqueValues:f=!0}={})=>{let u=null,i=null;try{if(e.type!=="geometry"&&e.type!=="oid"&&e.type!=="global-id"){d&&(u=await F({layer:l,field:e.name}));let s=e.domain?.type==="coded-value"?e.domain:null;f&&(N.includes(e.type)||s)&&(i=(await $({layer:l,field:e.name})).uniqueValueInfos.sort((n,y)=>y.count-n.count).slice(0,w),s&&(i=i.map(n=>({...n,value:s.getName(n.value)??n.value}))))}}catch(s){console.error(`Error fetching statistics for field ${e.name}:`,s)}return{summaryStatistics:u,uniqueValues:i}};function x(l,e){return["string","small-integer","integer"].includes(l)||e==="coded-value"}async function j(l,e,d,f=!0){let u=[],i=[],s=[];for(let n of l){let y=function(a){let t=e.get(a)?.layerItem;return t?[t.name&&`Name: ${t.name}`,t.title&&`Title: ${t.title}`,t.description&&`Description: ${t.description}`].filter(Boolean).join(" | "):a},{layerId:r,results:I}=n,V=d.map?.allLayers.find(a=>a.id===r),p=e.get(r)?.fieldRegistry;if(!p)continue;let c=u.find(a=>a.layerId===r);c||(c={layerId:r,layerSummary:y(r),fieldInfos:[]},u.push(c));for(let a of I){let t=p.get(a.name);if(!t)continue;let o=t.statistics,g=f&&!o?.summaryStatistics,S=x(t.type,t.domain?.type)&&!o?.uniqueValues,h=g||S;if(s.push({layerId:r,fieldName:t.name,didFetchStatistics:h}),h){let v=b(V,t,{includeSummaryStatistics:g,includeUniqueValues:S}).then(q=>{let m={summaryStatistics:o?.summaryStatistics??null,uniqueValues:o?.uniqueValues??null};g&&(m.summaryStatistics=q.summaryStatistics),S&&(m.uniqueValues=q.uniqueValues),p.set(t.name,{...t,statistics:m}),t.statistics=m});i.push(v)}c.fieldInfos.push(t)}}return await Promise.all(i),{layerFieldInfo:u,didFetchStatistics:i.length>0,fieldStatisticsFetchStatus:s}}return j},"smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues")
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import f from"./ONMNQBPO.js";import e from"./J4R7KYJ3.js";import d from"./RHYNE5OE.js";import c from"./CCC6LBMY.js";import{a as g}from"./FDOMMK2M.js";import a from"./AT4XVTJR.js";import{a as b}from"./ONQ6JSBJ.js";import{a as s}from"./7VAQUCBU.js";import{Ya as R,a as q,b as p}from"./EWLXNGKH.js";import{ea as M}from"./AI6DYOKR.js";export default $arcgis.t(([,,,,,,{n:L,p:y},{a:x},F,{a:_,c:f,d:E,e:C,r:w,s:k,t:S,u:N},v])=>{var I=async(e,t)=>(await s({text:"Exiting Data Exploration agent"},t),e),z=async(e,t)=>{await s({text:"Requesting LLM for layer filter results"},t);let a=await f("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:l,userTimezoneOffset:o}=x(),i={layerFieldInfo:e.layerFieldInfo,userTimezone:l,userTimezoneOffset:o,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},n=await y({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:i,tools:S}),r=[...e.dataExplorationMessages,n];if(!((n.tool_calls?.length??0)>0))return await s({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:r};let d=r,c=n.content.toString();return await v(n,t),{...e,dataExplorationMessages:d,outputMessage:c}},D=async(e,t)=>{await s({text:"Requesting LLM for layer query results"},t);let a=await f("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:l,userTimezoneOffset:o}=x(),i=e.agentExecutionContext.sharedState,n=i.lastNavigatedFeatures?.value,r=i.lastResolvedLocation?.value,d="none";if(n!=null)try{d=JSON.stringify(n)}catch{d="none"}let c="none";if(r!=null)try{c=JSON.stringify({address:r.address,location:r.location})}catch{c="none"}let u={layerFieldInfo:e.layerFieldInfo,userTimezone:l,userTimezoneOffset:o,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,lastNavigatedFeatures:d,lastResolvedLocation:c},m=await y({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:u,tools:k}),T=(m.tool_calls?.length??0)>0,h=m.content.toString();return await v(m,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,m],...T?{}:{outputMessage:h},status:"success",summary:h&&!T?E(h):"Query planning completed."}},V=async(e,t)=>{try{await s({text:"Requesting LLM for summary on query results"},t);let a=await f("summarize_query_response_prompt"),l={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=await L({promptText:a,modelTier:"fast",config:t,messages:e.dataExplorationMessages,inputVariables:l}),i=typeof o=="string"?o:o.content,n=new M(i);await s({text:`Received response from LLM: ${i}`},t);let r=i;return{...e,outputMessage:r,status:"success",summary:r?E(r):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,n]}}catch(a){throw await s({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function O(e,t){if((e.queryResponse??[]).some(l=>{let o=l.details;return typeof o=="object"&&o!==null&&"error"in o}))return await s({text:"Skipping layer filter tool because query response contains an error."},t),{...e};let a=await new _(S,{handleToolErrors:!1}).invoke({messages:e.dataExplorationMessages},t);return await s({text:`Finished executing layer filter tool: ${a.messages.map(l=>l.content).join(", ")}`},t),{...e}}var $=/\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 j(e,t){return $.test(e)||$.test(t)}var Q=async(e,t)=>{try{await s({text:"Preparing field information for vector search results"},t);let a=g(t,"layersAndFieldsRegistry"),{mapView:l}=b(t,["mapView"]),{assignedTask:o,userRequest:i}=e.agentExecutionContext,n=j(o,i),{layerFieldInfo:r,didFetchStatistics:d,fieldStatisticsFetchStatus:c}=await F(e.vectorSearchFieldResults,a,l,n);d?await s({text:"Statistics fetched"},t):await s({text:"Statistics skipped"},t);for(let u of c)await s({text:` - ${u.fieldName} - stats ${u.didFetchStatistics?"fetched":"skipped"}`},t);return await s({text:"Field information prepared"},t),{...e,layerFieldInfo:r}}catch(a){throw await s({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},A=.7,G=10,W=async(e,t)=>{try{await s({text:"Similarity search to find fields"},t);let a=g(t,"fieldSearch"),l=g(t,"layersAndFieldsRegistry"),o=g(t,"embeddingCache"),i=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:A,topResults:G,embeddingCache:o}),n=i.map(({layerId:d,results:c})=>{let u=c.map(m=>` - ${m.name} (${m.score.toFixed(2)})`).join(`
|
|
3
|
+
`);return`${l.get(d)?.layerItem.name??d}:
|
|
4
|
+
${u}`}).join(`
|
|
5
|
+
`),r;return i.length>0?r=`Vector search completed. Matching layers and fields with scores:
|
|
6
|
+
${n}`:r=`No vector search results found for score over ${A}.`,await s({text:r},t),{...e,vectorSearchFieldResults:i}}catch(a){throw await s({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)}`)}},H=.7,J=async(e,t)=>{try{await s({text:`Similarity search to find layers: ${e.agentExecutionContext.assignedTask}`},t);let a=g(t,"layerSearch"),l=g(t,"layersAndFieldsRegistry"),o=g(t,"embeddingCache"),i=await a.searchLayers({text:e.agentExecutionContext.assignedTask,minScore:H,embeddingCache:o}),n=i.map(c=>c.id),r=i.map(({id:c,score:u})=>`${l.get(c)?.layerItem.name??c} (${u.toFixed(2)})`).join(`
|
|
7
|
+
`),d;return n.length>0?d=`Vector search completed. Matching layers with scores:
|
|
8
|
+
${r}`:d="Vector search completed. No matching layers found.",await s({text:d},t),{...e,vectorSearchLayerIds:n}}catch(a){throw await s({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)}`)}},B=(e,t)=>C(["layerSearch","fieldSearch","layersAndFieldsRegistry"],"Data Exploration Agent")(e,t),P=()=>new R(w).addNode("requireDataExplorationServices",B).addNode("vectorSearchLayers",J).addNode("vectorSearchFields",W).addNode("fieldStatistics",Q).addNode("queryAgent",D).addNode("queryTools",N).addNode("summarizeQueryResponseLLM",V).addNode("filterAgent",z).addNode("filterTools",O).addNode("earlyExit",I).addEdge(q,"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":p).addEdge("filterTools",p).addEdge("earlyExit",p),U=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.`,fe={id:"dataExploration",name:"Data Exploration Agent",description:U,createGraph:P,workspace:w};return fe},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer",a,c,d,e,f)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{b as C,c as q}from"./YLGKKWZK.js";import"./MMHDT4KV.js";import"./RLEHNAIA.js";import d from"./FAR3DFFK.js";import"./CP5BVGJU.js";import b from"./OWTGH34K.js";import{a as R,b as F,e as L}from"./ZLWWWTH4.js";import a from"./AT4XVTJR.js";import{e as P}from"./7M6VKBTK.js";import{v as A,z as J}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./HHFNQR6Z.js";import"./VOKXKU7M.js";import{W as I,ka as S}from"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import{Dd as c}from"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([W,K,{property:n,subclass:l},b,E,,,,,,,D,M])=>{var Q=Object.defineProperty,U=Object.getOwnPropertyDescriptor,f=(t,e,r,s)=>{for(var o=s>1?void 0:s?U(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&Q(e,r,o),o},p=class extends E{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})}};f([n()],p.prototype,"id",2);f([n()],p.prototype,"sourceAnchorId",2);f([n()],p.prototype,"sourceNodeId",2);f([n()],p.prototype,"targetAnchorId",2);f([n()],p.prototype,"targetNodeId",2);p=f([l("Edge")],p);var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,O=(t,e,r,s)=>{for(var o=s>1?void 0:s?Y(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&X(e,r,o),o},d=class extends E{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.")}};O([n()],d.prototype,"id",2);O([n()],d.prototype,"label",2);O([n()],d.prototype,"type",2);d=O([l("BaseNode")],d);function G(t){let e=new Set(t.required),r=Object.fromEntries(Object.entries(t.properties).map(([s,o])=>{let a=$(o);return[s,e.has(s)?a:a.optional()]}));return c.object(r)}function $(t){let e;switch(t.type){case"array":e=c.array(t.items?$(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 tt=new Map([["clear_filters",async()=>(await import("./RBE55SWR.js")).clearFiltersTool],["reset_map",async()=>(await import("./T4RIGOXB.js")).resetMapTool],["set_feature_effect",async()=>(await import("./UHZG7SKO.js").then(m=>m.default.then(e=>({setFeatureEffectTool:e})))).setFeatureEffectTool],["list_layer_fields",async()=>(await import("./CJMUJXPL.js")).listLayerFieldsTool],["go_to_address",async()=>(await import("./7ZFAFKJT.js").then(m=>m.default.then(e=>({goToAddressTool:e})))).goToAddressTool],["go_to_bookmark",async()=>(await import("./2EY3BQQX.js")).goToBookmarkTool],["go_to_features",async()=>(await import("./5X7EG7D2.js")).goToFeaturesTool],["go_to_full_extent",async()=>(await import("./YLVJA4ZE.js").then(m=>m.default.then(e=>({goToFullExtentTool:e})))).goToFullExtentTool],["go_to_home_extent",async()=>(await import("./JO5ETMPS.js")).goToHomeExtentTool],["go_to_layer",async()=>(await import("./Q57QWN5W.js")).goToLayerTool],["go_to_scale",async()=>(await import("./4OGR5QKS.js")).goToScaleTool],["go_to_viewpoint",async()=>(await import("./ZOEMBHRF.js").then(m=>m.default.then(e=>({goToViewpointTool:e})))).goToViewpointTool],["go_to_zoom",async()=>(await import("./PUHRBGKB.js")).goToZoomTool],["find_relevant_fields",async()=>(await import("./7BCQMK6D.js").then(m=>m.default.then(e=>({findRelevantFieldsTool:e})))).findRelevantFieldsTool],["find_relevant_layers",async()=>(await import("./IBZ2NEAO.js")).findRelevantLayersTool],["get_attribute",async()=>(await import("./7V6OSTFC.js").then(m=>m.default.then(e=>({getAttributeTool:e})))).getAttributeTool],["get_statistics",async()=>(await import("./4WIDLQUH.js").then(m=>m.default.then(e=>({getStatisticsTool:e})))).getStatisticsTool],["get_top_features",async()=>(await import("./GFEOVHJK.js").then(m=>m.default.then(e=>({getTopFeaturesTool:e})))).getTopFeaturesTool],["query_features",async()=>(await import("./CZM4URK7.js").then(m=>m.default.then(e=>({queryFeaturesTool:e})))).queryFeaturesTool]]);async function et(t){let e=tt.get(t);if(!e)throw new Error(`ArcGIS tool is not supported in the browser runtime: ${t}`);return await e()}var ot=Object.defineProperty,rt=Object.getOwnPropertyDescriptor,N=(t,e,r,s)=>{for(var o=s>1?void 0:s?rt(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&ot(e,r,o),o},u=class extends E{constructor(t){super(t),this.type="arcgis-tool"}async createRuntimeTools(){if(!this.name)throw new Error("ArcgisTool name is required");return[await et(this.name)]}static fromJSON(t){return new u({name:t.name,requireApproval:t.require_approval})}};N([n()],u.prototype,"name",2);N([n()],u.prototype,"requireApproval",2);N([n()],u.prototype,"type",2);u=N([l("ArcgisTool")],u);var st=Object.defineProperty,at=Object.getOwnPropertyDescriptor,B=t=>{throw TypeError(t)},y=(t,e,r,s)=>{for(var o=s>1?void 0:s?at(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&st(e,r,o),o},it=(t,e,r)=>e.has(t)||B("Cannot "+r),nt=(t,e,r)=>e.has(t)?B("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ct=(t,e,r)=>(it(t,e,"access private method"),r),T,z,m=class extends d{constructor(t){super(t),nt(this,T),this.type="agent-node"}createRuntimeNode(){let t;return async(e,r)=>{t??=ct(this,T,z).call(this);let s=await(await t).run(e,r),o=this.outputSchema?.safeParse(s);if(o&&!o.success)throw o.error;let a=o?.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:r=>r.status==="failed"?void 0:e}],schemas:[c.object({output:this.outputSchema??c.string()})]}}static fromJSON(t){let e=new m({id:t.id,label:t.label,prompt:t.prompt?.content,type:"agent-node"});return t.structured_output&&(e.outputSchema=G(t.structured_output)),e.tools=t.tools?.filter(r=>r.type==="arcgis_tool").map(r=>u.fromJSON(r)),e}};T=new WeakSet;z=async function(){let t=this.prompt;if(!t?.trim())throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);let e=[];if(this.tools)for(let r of this.tools){let s=await r.createRuntimeTools();e.push(...s)}return new M({name:this.id,outputSchema:this.outputSchema,prompt:t,tools:e})};y([n()],m.prototype,"type",2);y([n()],m.prototype,"prompt",2);y([n()],m.prototype,"outputSchema",2);y([n()],m.prototype,"tools",2);m=y([l("AgentNode")],m);var pt=Object.defineProperty,dt=Object.getOwnPropertyDescriptor,k=(t,e,r,s)=>{for(var o=s>1?void 0:s?dt(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&pt(e,r,o),o},h=class extends d{constructor(t){super(t),this.type="end-message-node"}createRuntimeNode(){return async t=>{let e=await I.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 mt=Object.defineProperty,ut=Object.getOwnPropertyDescriptor,H=(t,e,r,s)=>{for(var o=s>1?void 0:s?ut(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&mt(e,r,o),o},w=class extends d{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"})}};H([n()],w.prototype,"type",2);w=H([l("StartNode")],w);function lt(t){switch(t.type){case"agent_node":return m.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 ht(t={}){let e=Object.keys(t);if(R(e),e.includes("nodes"))throw new Error("node state cannot define reserved field: nodes.");let r=F(t);return S.Root({...r,nodes:S({reducer:(s,o)=>({...s,...o}),default:()=>({})}),...P()})}function V(t){let e=new Set;for(let s of t)for(let o of Object.keys(s.shape??{}))o!=="nodes"&&e.add(o);let r=Object.fromEntries([...e].map(s=>[s,void 0]));return ht(r)}var v=class t{constructor(e,r,s){this.sourceJSON=e,this.edges=r,this.nodes=s,this._loaded=!1}static fromJSON(e){return new t(e,e.graph.edges.map(r=>p.fromJSON(r)),e.graph.nodes.map(r=>lt(r)))}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((r,s)=>{let o=this.nodes[s];return r.schemas?.map(a=>[o.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(),r=V(this.getSchemas()),s=this.nodes.find(i=>i.type==="start-node")?.id,o={},a=[];for(let[i,Z]of this.nodes.entries()){let _=e[i];_&&(_.runtimeNode&&(o[Z.id]=_.runtimeNode),a.push(..._.edges))}return{createGraph:()=>L(o,a,r,{entryNode:s}),workspace:r}}_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(r=>r.sourceNodeId===e.id)}))}},gt=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,x=(t,e,r,s)=>{for(var o=s>1?void 0:s?ft(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&>(e,r,o),o},wt=()=>{throw new Error("WebAgent must be loaded before it can run.")},g=class extends D{constructor(t){super(t)}async load(){if(this.portalItem){try{await this.portalItem.load()}catch(r){throw new b("web-agent:load-portal-item","Failed to load portal item",{error:r})}let e=await this.portalItem.fetchData();if(this.sourceJSON=e,!this.portalItem.title)throw new b("web-agent:missing-title","The portal item is missing a title")}if(!this.sourceJSON)throw new b("web-agent:missing-source-json","The source JSON is missing");if(!this.sourceJSON.description)throw new b("web-agent:missing-description","The source JSON is missing a description");let t=v.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",V([])),this._set("createGraph",wt);return}let{createGraph:t,workspace:e}=this._runtime.generate();this._set("workspace",e),this._set("createGraph",t)}};x([n({type:W})],g.prototype,"portalItem",2);x([n()],g.prototype,"sourceJSON",2);g=x([l("WebAgent")],g);var j=class extends A{static{this.properties={agent:0,context:0,itemId:1,workflow:0}}#t;async getContext(){return C(this.context)?await this.context():this.context}async load(){let e;if(this.itemId){let r=K.getDefault();e=new g({portalItem:new W({id:this.itemId,portal:r})})}else this.workflow&&(e=new g({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=q(this)}disconnectedCallback(){this.#t?.unregister(this.agent.id),super.disconnectedCallback()}};J("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)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../UZLQALHY.js";var e,a,i,c,u,s,w,l,f,m,p,y;async function r(n,t){if(t in n)return n[t];if("default"in n){let o=await n.default;return typeof o=="object"&&o!==null&&t in o?o[t]:o}throw new Error(`Unable to resolve ${String(t)} from module.`)}function W(n,t){let o={};for(let[b,k]of Object.entries(t))o[b]=h(n,k);return o}function d(n,t){return n.object(W(n,t))}function h(n,t){let o=g(n,t);return t.required===!0?o:o.optional()}function g(n,t){let o=T(n,t);return t.description!==void 0&&(o=o.describe(t.description)),o}function S(n,t){switch(t){case"string":return n.string();case"number":return n.number();case"boolean":return n.boolean()}}function A(n){return n==="string"||n==="number"||n==="boolean"}function T(n,t){switch(t.type){case"string":{if(t.enum!=null){if(t.enum.length===0)throw new Error("String schema field enum must include at least one value.");return n.enum(t.enum)}return n.string()}case"number":return n.number();case"boolean":return n.boolean();case"array":{if(t.itemType==null)throw new Error("Array schema field requires an itemType definition.");return n.array(A(t.itemType)?S(n,t.itemType):g(n,t.itemType))}case"object":{if(t.fields==null)throw new Error("Object schema field requires a fields definition.");return d(n,t.fields)}}}async function L(n){p??=import("../APFZY4PI.js");let t=await p;return d(t.z,n)}async function j(n,t){y??=import("../
|
|
2
|
+
import"../UZLQALHY.js";var e,a,i,c,u,s,w,l,f,m,p,y;async function r(n,t){if(t in n)return n[t];if("default"in n){let o=await n.default;return typeof o=="object"&&o!==null&&t in o?o[t]:o}throw new Error(`Unable to resolve ${String(t)} from module.`)}function W(n,t){let o={};for(let[b,k]of Object.entries(t))o[b]=h(n,k);return o}function d(n,t){return n.object(W(n,t))}function h(n,t){let o=g(n,t);return t.required===!0?o:o.optional()}function g(n,t){let o=T(n,t);return t.description!==void 0&&(o=o.describe(t.description)),o}function S(n,t){switch(t){case"string":return n.string();case"number":return n.number();case"boolean":return n.boolean()}}function A(n){return n==="string"||n==="number"||n==="boolean"}function T(n,t){switch(t.type){case"string":{if(t.enum!=null){if(t.enum.length===0)throw new Error("String schema field enum must include at least one value.");return n.enum(t.enum)}return n.string()}case"number":return n.number();case"boolean":return n.boolean();case"array":{if(t.itemType==null)throw new Error("Array schema field requires an itemType definition.");return n.array(A(t.itemType)?S(n,t.itemType):g(n,t.itemType))}case"object":{if(t.fields==null)throw new Error("Object schema field requires a fields definition.");return d(n,t.fields)}}}async function L(n){p??=import("../APFZY4PI.js");let t=await p;return d(t.z,n)}async function j(n,t){y??=import("../7QOC7FQE.js");let o=await y;return await(await r(o,"sendUXSuggestion"))(n,t)}async function q(n){e??=import("../6KFMRBAA.js");let t=await e,o=await r(t,"FunctionAgent");return new o(n)}async function E(n){a??=import("../J6SZIQJA.js");let t=await a,o=await r(t,"FunctionTool");return new o(n)}async function F(n){i??=import("../EMLOVMD4.js");let t=await i,o=await r(t,"LLMAgent");return new o(n)}async function v(n){c??=import("../KPO4XX6J.js");let t=await c,o=await r(t,"WorkflowAgent");return new o(n)}async function U(n){u??=import("../PSYRZMX2.js");let t=await u,o=await r(t,"ConditionalWorkflow");return new o(n)}async function M(n){s??=import("../4HDDRBIY.js");let t=await s,o=await r(t,"LoopWorkflow");return new o(n)}async function P(n){w??=import("../WP7ORLSB.js");let t=await w,o=await r(t,"ParallelWorkflow");return new o(n)}async function R(n){l??=import("../HMUWQCXU.js");let t=await l,o=await r(t,"RouterWorkflow");return new o(n)}async function X(n){f??=import("../4NJ2FF7H.js");let t=await f,o=await r(t,"SequentialWorkflow");return new o(n)}async function x(n){m??=import("../ZQMBJ6MI.js");let t=await m,o=await r(t,"SwitchWorkflow");return new o(n)}export{U as createConditionalWorkflow,q as createFunctionAgent,E as createFunctionTool,F as createLLMAgent,M as createLoopWorkflow,P as createParallelWorkflow,R as createRouterWorkflow,L as createSchema,X as createSequentialWorkflow,x as createSwitchWorkflow,v as createWorkflowAgent,j as sendUXSuggestion};
|
package/dist/cdn/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{p as s,y as e}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=s(e,{"arcgis-assistant":[()=>import("./ADJ63EDN.js"),"_messages:,assistantAvatarEnabled,awaitingResponse:,awaitingResponseStep:,copyEnabled,description,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,streamingDisabled,suggestedPrompts:,userAvatarEnabled,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt,unregister"],"arcgis-assistant-agent":[()=>import("./
|
|
2
|
+
import{p as s,y as e}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=s(e,{"arcgis-assistant":[()=>import("./ADJ63EDN.js"),"_messages:,assistantAvatarEnabled,awaitingResponse:,awaitingResponseStep:,copyEnabled,description,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,streamingDisabled,suggestedPrompts:,userAvatarEnabled,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt,unregister"],"arcgis-assistant-agent":[()=>import("./XCNN7BQ3.js"),"agent:,context:,itemId,workflow:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./LM2IGECE.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./KP2FWABJ.js"),"referenceElement;;getContext"],"arcgis-assistant-knowledge-agent":[()=>import("./6ADMWEVE.js"),"context:,referenceElement,serviceUrl;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./4AGGYAWS.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./MAPKEX67.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./WQGJATNJ.js"),"interrupt:,loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./XLHTQ7CF.js"),"_messages:,awaitingResponse,disabled,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./ORRMONGJ.js"),"_messages:,message,options:,type"],"arcgis-assistant-interrupt-preview":[()=>import("./QUMNJVKX.js"),"interrupts:"],"arcgis-assistant-message":[()=>import("./CZLLPKMS.js"),"_messages:,assistantAvatarEnabled,copyEnabled,feedbackEnabled,footerDisabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-block":[()=>import("./OKTBWKNG.js"),"block:"],"arcgis-assistant-message-feedback":[()=>import("./EBNVLMUU.js"),"_messages:,feedbackEnabled,message:"],"arcgis-assistant-message-footer":[()=>import("./NLEBWLVV.js"),"_messages:,copyEnabled,feedbackEnabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-loading":[()=>import("./ATFNWFKG.js"),"_messages:,assistantAvatarEnabled,interrupts:,loading,loadingMessage"],"arcgis-assistant-message-log":[()=>import("./HPU6K67Y.js"),"log:,logEnabled,showLog"],"arcgis-assistant-message-read-aloud":[()=>import("./4F7Y4RNW.js"),"_messages:,message:,readAloudEnabled"],"arcgis-assistant-message-text":[()=>import("./3LILAJUD.js"),"content,parts:"],"arcgis-assistant-speech-input":[()=>import("./ZCEMEUP7.js"),"awaitingResponse,inputValue,language,mode;;clearDraftSession"],"arcgis-assistant-suggested-prompts":[()=>import("./G5XE5D36.js"),"_messages:,label,prompts:"],"arcgis-assistant-user-message":[()=>import("./ZWBFTKHF.js"),"content,message:,user,userAvatarEnabled"]});a({resourcesUrl:import.meta.url});var t=new CSSStyleSheet;t.replaceSync("@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-knowledge-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-message,arcgis-assistant-message-block,arcgis-assistant-message-feedback,arcgis-assistant-message-footer,arcgis-assistant-message-loading,arcgis-assistant-message-log,arcgis-assistant-message-read-aloud,arcgis-assistant-message-text,arcgis-assistant-speech-input,arcgis-assistant-suggested-prompts,arcgis-assistant-user-message){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,t];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r,p,j,i=(a.importMap??={}).imports??={})=>{"agent-utils/index,agent-utils/middlewares/middleware,agent-utils/middlewares/humanInTheLoop,agent-utils/middlewares/trace".split(",").map(e=>i[p+e+j]=i[p+e]=import.meta.resolve("./"+e+j));a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,e,"@arcgis/ai-components/",".js")
|
package/dist/chunks/adapter.js
CHANGED
|
@@ -2122,7 +2122,7 @@ const K = "searchGraphData", Pt = c.object({
|
|
|
2122
2122
|
schema: Pt
|
|
2123
2123
|
});
|
|
2124
2124
|
export {
|
|
2125
|
-
|
|
2125
|
+
Ma as A,
|
|
2126
2126
|
La as D,
|
|
2127
2127
|
B as G,
|
|
2128
2128
|
Fa as H,
|
|
@@ -2137,21 +2137,21 @@ export {
|
|
|
2137
2137
|
L as g,
|
|
2138
2138
|
N as h,
|
|
2139
2139
|
_a as i,
|
|
2140
|
-
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2140
|
+
Ga as j,
|
|
2141
|
+
Vr as k,
|
|
2142
|
+
ja as l,
|
|
2143
|
+
xa as m,
|
|
2144
|
+
Ca as n,
|
|
2145
|
+
$a as o,
|
|
2146
|
+
Pa as p,
|
|
2147
2147
|
Wa as q,
|
|
2148
2148
|
Ra as r,
|
|
2149
2149
|
Ua as s,
|
|
2150
2150
|
Ie as t,
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2151
|
+
Ea as u,
|
|
2152
|
+
za as v,
|
|
2153
|
+
ka as w,
|
|
2154
|
+
Aa as x,
|
|
2155
|
+
qa as y,
|
|
2156
|
+
Na as z
|
|
2157
2157
|
};
|