@arcgis/ai-components 5.2.0-next.98 → 5.2.0-next.99
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/agents/tools/filter/setFeatureEffect/adapter.js +52 -40
- package/dist/agents/tools/navigation/goToAddress/adapter.js +39 -31
- package/dist/agents/tools/query/getStatistics/adapter.js +59 -56
- package/dist/agents/tools/query/getTopFeatures/adapter.js +51 -48
- package/dist/agents/tools/query/queryFeatures/adapter.js +46 -43
- package/dist/cdn/22KHSDJI.js +2 -0
- package/dist/cdn/5K5ZY267.js +2 -0
- package/dist/cdn/{NSHLOFIY.js → 5XZLS7UO.js} +1 -1
- package/dist/cdn/655YIKL3.js +11 -0
- package/dist/cdn/AKD5UOVX.js +2 -0
- package/dist/cdn/{NEZXHUAL.js → BE7BRJZD.js} +1 -1
- package/dist/cdn/C4JT4S5E.js +2 -0
- package/dist/cdn/{UHZG7SKO.js → FJO4KNOZ.js} +1 -1
- package/dist/cdn/{MX7OEO5Z.js → FXP5UIQU.js} +1 -1
- package/dist/cdn/{CZM4URK7.js → G3SF6U2U.js} +1 -1
- package/dist/cdn/{HNADFHYH.js → ICQCK5D3.js} +1 -1
- package/dist/cdn/{ASR3I43T.js → IJVMUS2L.js} +1 -1
- package/dist/cdn/{UAANWCMU.js → LAYVGCPL.js} +1 -1
- package/dist/cdn/NNXISHCA.js +14 -0
- package/dist/cdn/{LNCT4S4I.js → OX64WOEL.js} +1 -1
- package/dist/cdn/{7ZFAFKJT.js → QUKNPVAF.js} +1 -1
- package/dist/cdn/{YWN57GH4.js → RVSTAUQS.js} +1 -1
- package/dist/cdn/{EKWM5K4K.js → TCH5I5LS.js} +1 -1
- package/dist/cdn/{B2T7D57Y.js → TEPP7YPR.js} +1 -1
- package/dist/cdn/{6KN5LUAV.js → TMVF2W5N.js} +15 -15
- package/dist/cdn/{IC3LG6TH.js → UHNVDALX.js} +1 -1
- package/dist/cdn/{4WIDLQUH.js → XX6GHMNR.js} +1 -1
- package/dist/cdn/{AA4FBYKK.js → Z5HWPSZN.js} +1 -1
- package/dist/cdn/{GFEOVHJK.js → ZRVZMPFN.js} +1 -1
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/navigationGraph.js +84 -81
- package/dist/chunks/resolvePointGeometryFilter.js +92 -0
- 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 +5 -5
- package/dist/cdn/6HF36IKA.js +0 -2
- package/dist/cdn/JKIESH74.js +0 -2
- package/dist/cdn/OAKRPM7D.js +0 -2
- package/dist/cdn/QNNGPA3Q.js +0 -2
- package/dist/cdn/U2D53TAX.js +0 -14
- package/dist/cdn/V52XWEGV.js +0 -11
- package/dist/chunks/types.js +0 -59
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import f from"./SZ2QSSB3.js";import e from"./
|
|
2
|
+
import f from"./SZ2QSSB3.js";import e from"./FXP5UIQU.js";import d from"./RHYNE5OE.js";import c from"./CCC6LBMY.js";import{a as g}from"./FDOMMK2M.js";import a from"./D5UFYQHN.js";import{a as b}from"./ONQ6JSBJ.js";import{a as r}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,f:w,g:k,h:S,i:N},v])=>{var I=async(e,t)=>(await r({text:"Exiting Data Exploration agent"},t),e),z=async(e,t)=>{await r({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:"default",config:t,messages:e.dataExplorationMessages,inputVariables:i,tools:S}),s=[...e.dataExplorationMessages,n];if(!((n.tool_calls?.length??0)>0))return await r({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:s};let d=s,c=n.content.toString();return await v(n,t),{...e,dataExplorationMessages:d,outputMessage:c}},D=async(e,t)=>{await r({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,s=i.lastResolvedLocation?.value,d="none";if(n!=null)try{d=JSON.stringify(n)}catch{d="none"}let c="none";if(s!=null)try{c=JSON.stringify({address:s.address,location:s.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:"default",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 r({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 r({text:`Received response from LLM: ${i}`},t);let s=i;return{...e,outputMessage:s,status:"success",summary:s?E(s):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,n]}}catch(a){throw await r({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 r({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 r({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 r({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:s,didFetchStatistics:d,fieldStatisticsFetchStatus:c}=await F(e.vectorSearchFieldResults,a,l,n);d?await r({text:"Statistics fetched"},t):await r({text:"Statistics skipped"},t);for(let u of c)await r({text:` - ${u.fieldName} - stats ${u.didFetchStatistics?"fetched":"skipped"}`},t);return await r({text:"Field information prepared"},t),{...e,layerFieldInfo:s}}catch(a){throw await r({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 r({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
3
|
`);return`${l.get(d)?.layerItem.name??d}:
|
|
4
4
|
${u}`}).join(`
|
|
5
5
|
`),s;return i.length>0?s=`Vector search completed. Matching layers and fields with scores:
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./NNXISHCA.js";import"./34O57OGV.js";import"./FDOMMK2M.js";import a from"./AKD5UOVX.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,a])=>{return a},a,b)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import n from"./
|
|
2
|
+
import n from"./LAYVGCPL.js";import m from"./FXP5UIQU.js";import{c as s,d as p}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./NNXISHCA.js";import i from"./5K5ZY267.js";import h from"./655YIKL3.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./C4JT4S5E.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./22KHSDJI.js";import a from"./AKD5UOVX.js";import"./ONQ6JSBJ.js";import{v as e,z as o}from"./COH3QXWG.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:n},,,,,,,,,,,,,m])=>{var r=class extends e{constructor(){super(...arguments),this.agent=m}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=n(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)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import c from"./
|
|
2
|
+
import c from"./5K5ZY267.js";import b from"./CCC6LBMY.js";import"./34O57OGV.js";import a from"./AKD5UOVX.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../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("../TCH5I5LS.js");let o=await y;return await(await r(o,"sendUXSuggestion"))(n,t)}async function q(n){e??=import("../FUF3NAU7.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("../B2JDVLA6.js");let t=await i,o=await r(t,"LLMAgent");return new o(n)}async function v(n){c??=import("../HAEFC2SJ.js");let t=await c,o=await r(t,"WorkflowAgent");return new o(n)}async function U(n){u??=import("../NZSOJ726.js");let t=await u,o=await r(t,"ConditionalWorkflow");return new o(n)}async function M(n){s??=import("../OE3GW5LE.js");let t=await s,o=await r(t,"LoopWorkflow");return new o(n)}async function P(n){w??=import("../WGO5SER7.js");let t=await w,o=await r(t,"ParallelWorkflow");return new o(n)}async function R(n){l??=import("../FG647IP6.js");let t=await l,o=await r(t,"RouterWorkflow");return new o(n)}async function X(n){f??=import("../ZDV4K4WG.js");let t=await f,o=await r(t,"SequentialWorkflow");return new o(n)}async function x(n){m??=import("../HDACNIZF.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"./COH3QXWG.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=s(e,{"arcgis-assistant":[()=>import("./MY47B3CE.js"),"_messages:,allowedAgentIds:,alwaysUseAgentId,assistantAvatarEnabled,awaitingResponse:,awaitingResponseStep:,copyEnabled,description,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,runtimeEventsEnabled,streamingDisabled,suggestedPrompts:,userAvatarEnabled,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt,unregister"],"arcgis-assistant-agent":[()=>import("./
|
|
2
|
+
import{p as s,y as e}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=s(e,{"arcgis-assistant":[()=>import("./MY47B3CE.js"),"_messages:,allowedAgentIds:,alwaysUseAgentId,assistantAvatarEnabled,awaitingResponse:,awaitingResponseStep:,copyEnabled,description,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,runtimeEventsEnabled,streamingDisabled,suggestedPrompts:,userAvatarEnabled,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt,unregister"],"arcgis-assistant-agent":[()=>import("./BE7BRJZD.js"),"agent:,context:,itemId,workflow:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./RVSTAUQS.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./TEPP7YPR.js"),"referenceElement;;getContext"],"arcgis-assistant-knowledge-agent":[()=>import("./Z5HWPSZN.js"),"context:,referenceElement,serviceUrl;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./5XZLS7UO.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./ICQCK5D3.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./6ECRQVHY.js"),"interrupt:,loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./2O4DON37.js"),"_messages:,awaitingResponse,disabled,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./F5NIRETW.js"),"_messages:,message,options:,type"],"arcgis-assistant-interrupt-preview":[()=>import("./UDRKUVZP.js"),"interrupts:"],"arcgis-assistant-message":[()=>import("./EYOWRGDP.js"),"_messages:,assistantAvatarEnabled,copyEnabled,feedbackEnabled,footerDisabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-block":[()=>import("./5HBAJ57P.js"),"block:"],"arcgis-assistant-message-feedback":[()=>import("./MXTXJKFE.js"),"_messages:,feedbackEnabled,message:"],"arcgis-assistant-message-footer":[()=>import("./6P44KOKX.js"),"_messages:,copyEnabled,feedbackEnabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-loading":[()=>import("./O4NVW75A.js"),"_messages:,assistantAvatarEnabled,interrupts:,loading,loadingMessage"],"arcgis-assistant-message-log":[()=>import("./6YYPVU7H.js"),"log:,logEnabled,showLog"],"arcgis-assistant-message-read-aloud":[()=>import("./WSWB3B7B.js"),"_messages:,message:,readAloudEnabled"],"arcgis-assistant-message-text":[()=>import("./C4FEETBZ.js"),"content,parts:"],"arcgis-assistant-speech-input":[()=>import("./5MK44FNO.js"),"awaitingResponse,inputValue,language,mode;;clearDraftSession"],"arcgis-assistant-suggested-prompts":[()=>import("./SXM4NUT5.js"),"_messages:,label,prompts:"],"arcgis-assistant-user-message":[()=>import("./HHUQXL3R.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")
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { StateGraph as E, START as $, END as
|
|
3
|
-
import { g as T, t as
|
|
2
|
+
import { StateGraph as E, START as $, END as R } from "@langchain/langgraph/web";
|
|
3
|
+
import { g as T, t as C, r as F, N as k } from "./adapter.js";
|
|
4
4
|
import "@arcgis/core/identity/IdentityManager.js";
|
|
5
5
|
import "@arcgis/core/portal/Portal.js";
|
|
6
6
|
import "@arcgis/core/request.js";
|
|
@@ -28,7 +28,7 @@ import { s as p } from "./index.js";
|
|
|
28
28
|
import "@langchain/core/prompts";
|
|
29
29
|
import { ToolNode as O } from "@langchain/langgraph/prebuilt";
|
|
30
30
|
import S from "zod";
|
|
31
|
-
import { f as
|
|
31
|
+
import { f as y } from "./fetchService.js";
|
|
32
32
|
const f = [
|
|
33
33
|
A,
|
|
34
34
|
_,
|
|
@@ -41,19 +41,19 @@ const f = [
|
|
|
41
41
|
z
|
|
42
42
|
];
|
|
43
43
|
async function B(e, t) {
|
|
44
|
-
const o = await T("navigation_tool_prompt"), { mapView:
|
|
45
|
-
(
|
|
44
|
+
const o = await T("navigation_tool_prompt"), { mapView: s } = w(t, ["mapView"]), c = s.map.bookmarks?.map((u) => u.name).filter(Boolean) ?? [], m = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
|
|
45
|
+
(u, b) => `${b + 1}. layerId=${u.id} | title=${u.title ?? ""} | name=${u.name ?? ""} | score=${u.score.toFixed(2)}`
|
|
46
46
|
).join(`
|
|
47
|
-
`) : "",
|
|
48
|
-
${
|
|
49
|
-
`)}` : "",
|
|
50
|
-
${
|
|
51
|
-
${
|
|
47
|
+
`) : "", l = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", r = e.intent === "goToBookmark" && c.length ? `Available bookmarks:
|
|
48
|
+
${c.map((u) => `- ${u}`).join(`
|
|
49
|
+
`)}` : "", a = (e.intent === "goToLayer" || e.intent === "goToFeatures") && e.vectorSearchLayerResults?.length ? `Candidate layers:
|
|
50
|
+
${m}` : "", i = e.intent === "goToFeatures" && e.vectorSearchFieldResults?.length ? `Candidate fields:
|
|
51
|
+
${l}` : "", h = {
|
|
52
52
|
intent: e.intent,
|
|
53
|
-
bookmarksSection:
|
|
54
|
-
layersSection:
|
|
55
|
-
fieldsSection:
|
|
56
|
-
currentZoom:
|
|
53
|
+
bookmarksSection: r,
|
|
54
|
+
layersSection: a,
|
|
55
|
+
fieldsSection: i,
|
|
56
|
+
currentZoom: s.zoom,
|
|
57
57
|
assignedTask: e.agentExecutionContext.assignedTask,
|
|
58
58
|
userRequest: e.agentExecutionContext.userRequest,
|
|
59
59
|
priorSteps: e.agentExecutionContext.priorSteps
|
|
@@ -61,7 +61,7 @@ ${c}` : "", y = {
|
|
|
61
61
|
promptText: o,
|
|
62
62
|
modelTier: "fast",
|
|
63
63
|
config: t,
|
|
64
|
-
inputVariables:
|
|
64
|
+
inputVariables: h,
|
|
65
65
|
tools: f
|
|
66
66
|
});
|
|
67
67
|
await G(n, t);
|
|
@@ -91,42 +91,45 @@ const D = (e) => {
|
|
|
91
91
|
async function J(e, t) {
|
|
92
92
|
const o = new O(f, { handleToolErrors: !1 });
|
|
93
93
|
try {
|
|
94
|
-
const
|
|
95
|
-
if (!
|
|
94
|
+
const s = e.navigationInternalState.toolCallMessage;
|
|
95
|
+
if (!s)
|
|
96
96
|
throw new Error("navigationToolCalling: missing navigationInternalState.toolCallMessage");
|
|
97
|
-
const { messages:
|
|
97
|
+
const { messages: d } = await o.invoke(
|
|
98
98
|
{
|
|
99
|
-
messages: [
|
|
99
|
+
messages: [s]
|
|
100
100
|
},
|
|
101
101
|
t
|
|
102
102
|
);
|
|
103
|
-
let
|
|
104
|
-
for (const
|
|
105
|
-
const a = D(
|
|
106
|
-
a.text && (
|
|
107
|
-
`)
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
103
|
+
let c = "", m, l;
|
|
104
|
+
for (const r of d) {
|
|
105
|
+
const a = D(r.content), i = r.artifact;
|
|
106
|
+
a.text && (c += `${a.text}
|
|
107
|
+
`);
|
|
108
|
+
const h = i?.sharedStatePatch ?? a.sharedStatePatch;
|
|
109
|
+
h && (m = {
|
|
110
|
+
...m,
|
|
111
|
+
...h
|
|
112
|
+
}), i?.sharedResourceAdditions && (l = [...l ?? [], ...i.sharedResourceAdditions]);
|
|
111
113
|
}
|
|
112
|
-
return await p({ text: `Finished executing navigation tool: ${
|
|
114
|
+
return await p({ text: `Finished executing navigation tool: ${c}` }, t), {
|
|
113
115
|
...e,
|
|
114
|
-
outputMessage:
|
|
115
|
-
sharedStatePatch:
|
|
116
|
+
outputMessage: c,
|
|
117
|
+
sharedStatePatch: m,
|
|
118
|
+
sharedResourceAdditions: l,
|
|
116
119
|
status: "success",
|
|
117
|
-
summary:
|
|
120
|
+
summary: c ? C(c) : "Navigation executed.",
|
|
118
121
|
navigationInternalState: {
|
|
119
122
|
...e.navigationInternalState,
|
|
120
123
|
toolCallMessage: void 0
|
|
121
124
|
}
|
|
122
125
|
};
|
|
123
|
-
} catch (
|
|
124
|
-
const
|
|
125
|
-
return await p({ text: `Navigation tool execution failed: ${
|
|
126
|
+
} catch (s) {
|
|
127
|
+
const d = s instanceof Error ? s.message : String(s);
|
|
128
|
+
return await p({ text: `Navigation tool execution failed: ${d}` }, t), {
|
|
126
129
|
...e,
|
|
127
|
-
outputMessage: `Navigation tool execution failed: ${
|
|
130
|
+
outputMessage: `Navigation tool execution failed: ${d}`,
|
|
128
131
|
status: "failed",
|
|
129
|
-
summary: `Navigation tool execution failed: ${
|
|
132
|
+
summary: `Navigation tool execution failed: ${d}`,
|
|
130
133
|
navigationInternalState: {
|
|
131
134
|
...e.navigationInternalState,
|
|
132
135
|
toolCallMessage: void 0
|
|
@@ -135,29 +138,29 @@ async function J(e, t) {
|
|
|
135
138
|
}
|
|
136
139
|
}
|
|
137
140
|
async function H(e, t) {
|
|
138
|
-
const o = await T("navigation_intent_prompt"), { mapView:
|
|
141
|
+
const o = await T("navigation_intent_prompt"), { mapView: s } = w(t, ["mapView"]), d = f.map((n) => ({
|
|
139
142
|
name: n.name,
|
|
140
143
|
description: n.description,
|
|
141
144
|
schema: n.schema
|
|
142
|
-
})),
|
|
143
|
-
${
|
|
144
|
-
`)}` : "No bookmarks are available in this map.",
|
|
145
|
-
tools:
|
|
145
|
+
})), m = s.map.bookmarks?.map((n) => n.name).filter(Boolean) ?? [], l = m.length ? `Available bookmarks:
|
|
146
|
+
${m.map((n) => `- ${n}`).join(`
|
|
147
|
+
`)}` : "No bookmarks are available in this map.", r = {
|
|
148
|
+
tools: d.map(({ name: n, description: g, schema: v }) => `${n}: ${g}, ${JSON.stringify(v)}`).join(`
|
|
146
149
|
`),
|
|
147
|
-
bookmarks:
|
|
150
|
+
bookmarks: l,
|
|
148
151
|
assignedTask: e.agentExecutionContext.assignedTask,
|
|
149
152
|
userRequest: e.agentExecutionContext.userRequest,
|
|
150
153
|
priorSteps: e.agentExecutionContext.priorSteps
|
|
151
|
-
},
|
|
154
|
+
}, a = S.object({
|
|
152
155
|
intent: S.string()
|
|
153
|
-
}),
|
|
156
|
+
}), i = await M({
|
|
154
157
|
promptText: o,
|
|
155
158
|
config: t,
|
|
156
|
-
inputVariables:
|
|
157
|
-
schema:
|
|
159
|
+
inputVariables: r,
|
|
160
|
+
schema: a,
|
|
158
161
|
modelTier: "fast"
|
|
159
|
-
}),
|
|
160
|
-
return { ...e, intent:
|
|
162
|
+
}), h = typeof i.intent == "string" ? i.intent.trim().replace(/^"|"$/gu, "") : "";
|
|
163
|
+
return { ...e, intent: h || "" };
|
|
161
164
|
}
|
|
162
165
|
const U = 0.7, W = async (e, t) => {
|
|
163
166
|
try {
|
|
@@ -165,25 +168,25 @@ const U = 0.7, W = async (e, t) => {
|
|
|
165
168
|
{ text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
|
|
166
169
|
t
|
|
167
170
|
);
|
|
168
|
-
const o =
|
|
171
|
+
const o = y(t, "layerSearch"), s = y(t, "layersAndFieldsRegistry"), d = y(t, "embeddingCache"), m = (await o.searchLayers({
|
|
169
172
|
text: e.agentExecutionContext.assignedTask,
|
|
170
173
|
minScore: U,
|
|
171
|
-
embeddingCache:
|
|
172
|
-
})).map(({ id:
|
|
173
|
-
const
|
|
174
|
+
embeddingCache: d
|
|
175
|
+
})).map(({ id: r, score: a }) => {
|
|
176
|
+
const i = s.get(r)?.layerItem;
|
|
174
177
|
return {
|
|
175
|
-
id:
|
|
176
|
-
title:
|
|
177
|
-
name:
|
|
178
|
-
score:
|
|
178
|
+
id: r,
|
|
179
|
+
title: i?.title,
|
|
180
|
+
name: i?.name ?? void 0,
|
|
181
|
+
score: a
|
|
179
182
|
};
|
|
180
183
|
});
|
|
181
|
-
let
|
|
182
|
-
return
|
|
183
|
-
${
|
|
184
|
-
`)}` :
|
|
184
|
+
let l;
|
|
185
|
+
return m.length > 0 ? l = `Vector search completed. Matching layers:
|
|
186
|
+
${m.map((r) => `- layerId=${r.id} | title=${r.title ?? ""} | name=${r.name ?? ""} | score=${r.score.toFixed(2)}`).join(`
|
|
187
|
+
`)}` : l = "Vector search completed. No matching layers found.", await p({ text: l }, t), {
|
|
185
188
|
...e,
|
|
186
|
-
vectorSearchLayerResults:
|
|
189
|
+
vectorSearchLayerResults: m
|
|
187
190
|
};
|
|
188
191
|
} catch (o) {
|
|
189
192
|
throw await p(
|
|
@@ -197,22 +200,22 @@ ${l.map((a) => `- layerId=${a.id} | title=${a.title ?? ""} | name=${a.name ?? ""
|
|
|
197
200
|
{ text: `Similarity search to find fields: ${e.agentExecutionContext.assignedTask}` },
|
|
198
201
|
t
|
|
199
202
|
);
|
|
200
|
-
const o =
|
|
201
|
-
if (
|
|
203
|
+
const o = y(t, "fieldSearch"), s = y(t, "layersAndFieldsRegistry"), d = y(t, "embeddingCache"), c = e.vectorSearchLayerResults?.map((a) => a.id) ?? [];
|
|
204
|
+
if (c.length === 0)
|
|
202
205
|
return await p({ text: "No candidate layers for field search" }, t), e;
|
|
203
|
-
const
|
|
206
|
+
const l = (await o.searchFields({
|
|
204
207
|
text: e.agentExecutionContext.assignedTask,
|
|
205
|
-
layerIds:
|
|
208
|
+
layerIds: c,
|
|
206
209
|
minScore: x,
|
|
207
210
|
topResults: K,
|
|
208
|
-
embeddingCache:
|
|
209
|
-
})).map(({ layerId:
|
|
210
|
-
const
|
|
211
|
+
embeddingCache: d
|
|
212
|
+
})).map(({ layerId: a, results: i }) => {
|
|
213
|
+
const h = s.get(a)?.fieldRegistry;
|
|
211
214
|
return {
|
|
212
|
-
layerId:
|
|
213
|
-
layerName:
|
|
214
|
-
results:
|
|
215
|
-
const g =
|
|
215
|
+
layerId: a,
|
|
216
|
+
layerName: s.get(a)?.layerItem.name,
|
|
217
|
+
results: i.map((n) => {
|
|
218
|
+
const g = h?.get(n.name);
|
|
216
219
|
return {
|
|
217
220
|
name: n.name,
|
|
218
221
|
score: n.score,
|
|
@@ -225,16 +228,16 @@ ${l.map((a) => `- layerId=${a.id} | title=${a.title ?? ""} | name=${a.name ?? ""
|
|
|
225
228
|
})
|
|
226
229
|
};
|
|
227
230
|
});
|
|
228
|
-
let
|
|
229
|
-
return
|
|
230
|
-
${
|
|
231
|
-
(
|
|
232
|
-
${
|
|
231
|
+
let r;
|
|
232
|
+
return l.length > 0 ? r = `Vector search completed. Matching layers and fields:
|
|
233
|
+
${l.map(
|
|
234
|
+
(a) => `${a.layerName ?? a.layerId}:
|
|
235
|
+
${a.results.map((i) => ` - ${i.name} (${i.score.toFixed(2)})`).join(`
|
|
233
236
|
`)}`
|
|
234
237
|
).join(`
|
|
235
|
-
`)}` :
|
|
238
|
+
`)}` : r = `No vector search field results found for score over ${x}.`, await p({ text: r }, t), {
|
|
236
239
|
...e,
|
|
237
|
-
vectorSearchFieldResults:
|
|
240
|
+
vectorSearchFieldResults: l
|
|
238
241
|
};
|
|
239
242
|
} catch (o) {
|
|
240
243
|
throw await p(
|
|
@@ -242,7 +245,7 @@ ${s.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
242
245
|
t
|
|
243
246
|
), o;
|
|
244
247
|
}
|
|
245
|
-
}, X = (e, t) =>
|
|
248
|
+
}, X = (e, t) => F(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), Y = () => new E(k).addNode("requireNavigationServices", X).addNode("intentLLM", H).addNode("vectorSearchLayers", W).addNode("vectorSearchFields", Q).addNode("agent", B).addNode("tools", J).addEdge($, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
|
|
246
249
|
"intentLLM",
|
|
247
250
|
(t) => t.intent === "goToLayer" || t.intent === "goToFeatures" ? "vectorSearchLayers" : "agent",
|
|
248
251
|
{
|
|
@@ -256,7 +259,7 @@ ${s.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
256
259
|
vectorSearchFields: "vectorSearchFields",
|
|
257
260
|
agent: "agent"
|
|
258
261
|
}
|
|
259
|
-
).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools",
|
|
262
|
+
).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", R), ee = String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
|
|
260
263
|
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.
|
|
261
264
|
|
|
262
265
|
Supported actions:
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import l from "@arcgis/core/geometry/Point.js";
|
|
3
|
+
import * as f from "@arcgis/core/geometry/operators/unionOperator.js";
|
|
4
|
+
import r from "zod";
|
|
5
|
+
const d = 750;
|
|
6
|
+
function m(e) {
|
|
7
|
+
return "point" in e && e.point !== void 0;
|
|
8
|
+
}
|
|
9
|
+
function y(e) {
|
|
10
|
+
return "layerId" in e && e.layerId !== void 0;
|
|
11
|
+
}
|
|
12
|
+
const v = async (e, n) => {
|
|
13
|
+
if (m(e)) {
|
|
14
|
+
const { point: t } = e;
|
|
15
|
+
return { geometry: new l({
|
|
16
|
+
x: t.x,
|
|
17
|
+
y: t.y,
|
|
18
|
+
spatialReference: t.spatialReference ? { wkid: t.spatialReference.wkid } : n.spatialReference
|
|
19
|
+
}) };
|
|
20
|
+
}
|
|
21
|
+
if (y(e)) {
|
|
22
|
+
const t = n.map?.allLayers.find(
|
|
23
|
+
(o) => o.id === e.layerId
|
|
24
|
+
);
|
|
25
|
+
if (!t)
|
|
26
|
+
return { error: `Could not find geometry layer with ID: ${e.layerId}` };
|
|
27
|
+
const a = t.title ?? t.id, s = e.where?.trim() || "1=1";
|
|
28
|
+
try {
|
|
29
|
+
const o = await t.queryFeatures({
|
|
30
|
+
where: s,
|
|
31
|
+
returnGeometry: !0,
|
|
32
|
+
outSpatialReference: n.spatialReference,
|
|
33
|
+
num: d + 1
|
|
34
|
+
});
|
|
35
|
+
if (!o.features.length)
|
|
36
|
+
return {
|
|
37
|
+
error: `No features found in geometry layer "${a}" with the specified where clause: ${s}`
|
|
38
|
+
};
|
|
39
|
+
if (o.features.length > d)
|
|
40
|
+
return {
|
|
41
|
+
error: `Geometry filter for layer "${a}" matched too many features (${o.features.length}+). Please narrow the geometry layer filter.`
|
|
42
|
+
};
|
|
43
|
+
const i = o.features.map((c) => c.geometry).filter((c) => !!c);
|
|
44
|
+
if (!i.length)
|
|
45
|
+
return { error: "No valid geometries found for the matched geometry layer features." };
|
|
46
|
+
const u = i.length === 1 ? i[0] : f.executeMany(i);
|
|
47
|
+
return u ? (u.spatialReference || (u.spatialReference = n.spatialReference), { geometry: u }) : { error: "Failed to combine geometries from geometry layer." };
|
|
48
|
+
} catch (o) {
|
|
49
|
+
return { error: `Failed to query geometry: ${String(o)}` };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return { error: "Invalid geometry configuration provided" };
|
|
53
|
+
}, h = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], p = r.enum(h), b = r.object({ id: r.string() }), R = r.object({
|
|
54
|
+
id: r.string(),
|
|
55
|
+
kind: r.literal("point"),
|
|
56
|
+
payload: r.object({
|
|
57
|
+
x: r.number(),
|
|
58
|
+
y: r.number(),
|
|
59
|
+
spatialReference: r.object({ wkid: r.number() }).optional()
|
|
60
|
+
})
|
|
61
|
+
}), S = r.object({
|
|
62
|
+
sharedResourceId: r.string().describe("ID of a point returned by listSharedResources for a previously geocoded address or place."),
|
|
63
|
+
distance: r.number().optional().describe("Optional buffer distance around the point."),
|
|
64
|
+
units: p.optional().describe("The units for the distance buffer.")
|
|
65
|
+
}), g = (e, n) => {
|
|
66
|
+
if (!e || !("sharedResourceId" in e))
|
|
67
|
+
return e;
|
|
68
|
+
if (!n)
|
|
69
|
+
throw new Error("Shared resources are unavailable in the tool runtime state.");
|
|
70
|
+
const t = n.find((s) => {
|
|
71
|
+
const o = b.safeParse(s);
|
|
72
|
+
return o.success && o.data.id === e.sharedResourceId;
|
|
73
|
+
});
|
|
74
|
+
if (!t)
|
|
75
|
+
throw new Error(`Shared resource not found: ${e.sharedResourceId}`);
|
|
76
|
+
const a = R.safeParse(t);
|
|
77
|
+
if (!a.success)
|
|
78
|
+
throw new Error(`Shared resource ${e.sharedResourceId} does not contain a valid point.`);
|
|
79
|
+
return {
|
|
80
|
+
point: a.data.payload,
|
|
81
|
+
distance: e.distance,
|
|
82
|
+
units: e.units
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export {
|
|
86
|
+
m as a,
|
|
87
|
+
p as d,
|
|
88
|
+
v as g,
|
|
89
|
+
y as i,
|
|
90
|
+
g as r,
|
|
91
|
+
S as s
|
|
92
|
+
};
|