@arcgis/ai-components 5.2.0-next.60 → 5.2.0-next.62
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/cdn/275NKWUE.js +22 -0
- package/dist/cdn/{HWBVWBDF.js → AYMUK2MC.js} +8 -8
- package/dist/cdn/LUJCH5V7.js +2 -0
- package/dist/cdn/{EF7OV7SR.js → NSER3L4A.js} +1 -1
- package/dist/cdn/THXUE6R4.js +2 -0
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/helpGraph.js +20 -17
- package/dist/chunks/navigationGraph.js +43 -40
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +4 -4
- package/dist/cdn/PDKH5ED3.js +0 -22
- package/dist/cdn/YIA7O2XZ.js +0 -2
- package/dist/cdn/YZIUJNAR.js +0 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import d from"./3ZPPYCNL.js";import b from"./OY2P2O47.js";import a from"./WHOZT5H5.js";import{a as p}from"./HJG7QM2R.js";import{Va as c,a as u,b as i}from"./TFT6HK3O.js";export default $arcgis.t(([,,,,,,{r:g},{I:d,J:E,a:h,m:f,n:y,o:m,p:x},S])=>{var _=[E],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(n=>n.name).slice(0,10).join(", "),l=s.size>10?` (and ${s.size-10} more)`:"";return`${o+1}. "${r.title}". Description: ${r.description}
|
|
3
|
+
Fields: ${a}${l}`}).join(`
|
|
4
|
+
|
|
5
|
+
`);return`This map contains ${e.size} layer(s):
|
|
6
|
+
|
|
7
|
+
${t}`},w=e=>{let t=e?.list()??[];return t.length?t.map(r=>`- ${r.agent.name}: ${r.agent.description}`).join(`
|
|
8
|
+
`):"No agents currently available."};async function $(e,t){let r=await f("help_prompt"),s=m(t,"layersAndFieldsRegistry"),o=m(t,"agentRegistry");try{let a=await g({promptText:r,modelTier:"default",config:t,tools:_,inputVariables:{layerSummary:v(s),agents:w(o),assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps}});await S(a,t);let l=(a.tool_calls?.length??0)>0,n=typeof a.text=="string"?a.text.trim():"";return{...e,helpInternalState:{...e.helpInternalState,toolCallMessage:l?a:void 0},outputMessage:l?e.outputMessage:n,summary:l?"Prepared help tool call from assigned task.":"Provided map-related help based on the assigned task.",status:l?e.status:"success"}}catch(a){let l=a instanceof Error?a.message:String(a);return{...e,outputMessage:`Error invoking help agent: ${l}`,summary:"Help agent execution failed.",status:"failed"}}}var b=(e,t)=>x(["agentRegistry"],"Help Agent")(e,t);async function k(e,t){let r=new h(_,{handleToolErrors:!1});try{let s=e.helpInternalState.toolCallMessage;if(!s)throw new Error("helpToolCalling: missing helpInternalState.toolCallMessage");let o=(await r.invoke({messages:[s]},t)).messages.map(a=>a.text).join(`
|
|
9
|
+
`);return await p({text:`Finished executing help tool: ${o}`},t),{...e,outputMessage:o,status:"success",summary:o?y(o):"Help executed.",helpInternalState:{...e.helpInternalState,toolCallMessage:void 0}}}catch(s){let o=s instanceof Error?s.message:String(s);return await p({text:`Help tool execution failed: ${o}`},t),{...e,outputMessage:`Help tool execution failed: ${o}`,status:"failed",summary:`Help tool execution failed: ${o}`,helpInternalState:{...e.helpInternalState,toolCallMessage:void 0}}}}var C=()=>new c(d).addNode("requireHelpServices",b).addNode("agent",$).addNode("tools",k).addEdge(u,"requireHelpServices").addEdge("requireHelpServices","agent").addConditionalEdges("agent",e=>e.helpInternalState.toolCallMessage?"tools":i).addEdge("tools",i),H=String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
|
|
10
|
+
|
|
11
|
+
_Example: “Tell me about this map”_
|
|
12
|
+
_Example: “List all layers in this map”_
|
|
13
|
+
_Example: “List fields in protected areas layer”_
|
|
14
|
+
_Example: “What agents are available to me?”_
|
|
15
|
+
_Example: “What can you do?”_
|
|
16
|
+
_Example: “What can I ask”_
|
|
17
|
+
|
|
18
|
+
If the user asks unrelated queries like "What are the vowels in English alphabet" or "How to cook", call this agent so it can politely refuse and redirect to map-related questions.
|
|
19
|
+
|
|
20
|
+
IF the user asks map related queries, but those that are not performed by any of the agents, call this agent so we can respond that the requested action is not supported.
|
|
21
|
+
_Example: "Create a chart"_
|
|
22
|
+
_Example: "Create a table"_`,V={id:"help",name:"Help Agent",description:H,createGraph:C,workspace:d};return V},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer",a,b,d)
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./OY2P2O47.js";import a from"./WHOZT5H5.js";import{a as
|
|
2
|
+
import c from"./3ZPPYCNL.js";import b from"./OY2P2O47.js";import a from"./WHOZT5H5.js";import{a as g}from"./HJG7QM2R.js";import{Va as $,a as k,b as E}from"./TFT6HK3O.js";import{a as f}from"./VXFQANGJ.js";export default $arcgis.t(([,,,,,,{q:N,r:T},{a:b,b:x,c:v,d:C,e:F,f:R,g:L,h:_,i:I,j:M,k:Z,l:A,m:S,n:q,o:p,p:j},V])=>{var w=[C,F,R,L,_,I,M,Z,A];async function B(e,t){let a=await S("navigation_tool_prompt"),{mapView:r}=v(t),c=r.map.bookmarks?.map(h=>h.name).filter(Boolean)??[],s=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((h,G)=>`${G+1}. layerId=${h.id} | title=${h.title??""} | name=${h.name??""} | score=${h.score.toFixed(2)}`).join(`
|
|
3
3
|
`):"",l=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",i=e.intent==="goToBookmark"&&c.length?`Available bookmarks:
|
|
4
4
|
${c.map(h=>`- ${h}`).join(`
|
|
5
5
|
`)}`:"",o=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
|
|
6
6
|
${s}`:"",d=e.intent==="goToFeatures"&&e.vectorSearchFieldResults?.length?`Candidate fields:
|
|
7
|
-
${l}`:"",u={intent:e.intent,bookmarksSection:i,layersSection:o,fieldsSection:d,currentZoom:r.zoom,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},n=await T({promptText:a,modelTier:"fast",config:t,inputVariables:u,tools:w}),
|
|
8
|
-
`),o.sharedStatePatch&&(l={...l,...o.sharedStatePatch})}return await
|
|
7
|
+
${l}`:"",u={intent:e.intent,bookmarksSection:i,layersSection:o,fieldsSection:d,currentZoom:r.zoom,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},n=await T({promptText:a,modelTier:"fast",config:t,inputVariables:u,tools:w});await V(n,t);let m=(n.tool_calls?.length??0)>0,y=typeof n.text=="string"?n.text.trim():"",z=y.length>0;return{...e,navigationInternalState:{...e.navigationInternalState,toolCallMessage:m?n:void 0},outputMessage:m?e.outputMessage:y,status:m?e.status:z?"success":"failed"}}var D=e=>{let t=typeof e=="string"?e:String(e);try{let a=JSON.parse(t);if(a&&typeof a=="object"&&typeof a.text=="string")return a}catch{console.warn("Failed to parse tool response as JSON:",t)}return{text:t}};async function J(e,t){let a=new b(w,{handleToolErrors:!1});try{let r=e.navigationInternalState.toolCallMessage;if(!r)throw new Error("navigationToolCalling: missing navigationInternalState.toolCallMessage");let{messages:c}=await a.invoke({messages:[r]},t),s="",l;for(let i of c){let o=D(i.content);o.text&&(s+=`${o.text}
|
|
8
|
+
`),o.sharedStatePatch&&(l={...l,...o.sharedStatePatch})}return await g({text:`Finished executing navigation tool: ${s}`},t),{...e,outputMessage:s,sharedStatePatch:l,status:"success",summary:s?q(s):"Navigation executed.",navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}catch(r){let c=r instanceof Error?r.message:String(r);return await g({text:`Navigation tool execution failed: ${c}`},t),{...e,outputMessage:`Navigation tool execution failed: ${c}`,status:"failed",summary:`Navigation tool execution failed: ${c}`,navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}}async function P(e,t){let a=await S("navigation_intent_prompt"),{mapView:r}=v(t),c=w.map(n=>({name:n.name,description:n.description,schema:n.schema})),s=r.map.bookmarks?.map(n=>n.name).filter(Boolean)??[],l=s.length?`Available bookmarks:
|
|
9
9
|
${s.map(n=>`- ${n}`).join(`
|
|
10
|
-
`)}`:"No bookmarks are available in this map.",i={tools:c.map(({name:n,description:
|
|
11
|
-
`),bookmarks:l,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=f.object({intent:f.string()}),d=await N({promptText:a,config:t,inputVariables:i,schema:o,modelTier:"fast"}),u=typeof d.intent=="string"?d.intent.trim().replace(/^"|"$/gu,""):"";return{...e,intent:u||""}}var
|
|
10
|
+
`)}`:"No bookmarks are available in this map.",i={tools:c.map(({name:n,description:m,schema:y})=>`${n}: ${m}, ${JSON.stringify(y)}`).join(`
|
|
11
|
+
`),bookmarks:l,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=f.object({intent:f.string()}),d=await N({promptText:a,config:t,inputVariables:i,schema:o,modelTier:"fast"}),u=typeof d.intent=="string"?d.intent.trim().replace(/^"|"$/gu,""):"";return{...e,intent:u||""}}var W=.7,H=async(e,t)=>{try{await g({text:`Similarity search to find layers: ${e.agentExecutionContext.assignedTask}`},t);let a=p(t,"layerSearch"),r=p(t,"layersAndFieldsRegistry"),c=p(t,"embeddingCache"),s=(await a.searchLayers({text:e.agentExecutionContext.assignedTask,minScore:W,embeddingCache:c})).map(({id:i,score:o})=>{let d=r.get(i)?.layerItem;return{id:i,title:d?.title,name:d?.name??void 0,score:o}}),l;return s.length>0?l=`Vector search completed. Matching layers:
|
|
12
12
|
${s.map(i=>`- layerId=${i.id} | title=${i.title??""} | name=${i.name??""} | score=${i.score.toFixed(2)}`).join(`
|
|
13
|
-
`)}`:l="Vector search completed. No matching layers found.",await
|
|
13
|
+
`)}`:l="Vector search completed. No matching layers found.",await g({text:l},t),{...e,vectorSearchLayerResults:s}}catch(a){throw await g({text:`Error during vector search layers: ${a instanceof Error?a.message:String(a)}`},t),a}},O=.7,K=10,Q=async(e,t)=>{try{await g({text:`Similarity search to find fields: ${e.agentExecutionContext.assignedTask}`},t);let a=p(t,"fieldSearch"),r=p(t,"layersAndFieldsRegistry"),c=p(t,"embeddingCache"),s=e.vectorSearchLayerResults?.map(o=>o.id)??[];if(s.length===0)return await g({text:"No candidate layers for field search"},t),e;let l=(await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:s,minScore:O,topResults:K,embeddingCache:c})).map(({layerId:o,results:d})=>{let u=r.get(o)?.fieldRegistry;return{layerId:o,layerName:r.get(o)?.layerItem.name,results:d.map(n=>{let m=u?.get(n.name);return{name:n.name,score:n.score,type:m?.type,alias:m?.alias,description:m?.description,statistics:m?.statistics}})}}),i;return l.length>0?i=`Vector search completed. Matching layers and fields:
|
|
14
14
|
${l.map(o=>`${o.layerName??o.layerId}:
|
|
15
15
|
${o.results.map(d=>` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
16
16
|
`)}`).join(`
|
|
17
|
-
`)}`:i=`No vector search field results found for score over ${
|
|
17
|
+
`)}`:i=`No vector search field results found for score over ${O}.`,await g({text:i},t),{...e,vectorSearchFieldResults:l}}catch(a){throw await g({text:`Error during vector search fields: ${a instanceof Error?a.message:String(a)}`},t),a}},U=(e,t)=>j(["layerSearch","layersAndFieldsRegistry"],"Navigation Agent")(e,t),X=()=>new $(x).addNode("requireNavigationServices",U).addNode("intentLLM",P).addNode("vectorSearchLayers",H).addNode("vectorSearchFields",Q).addNode("agent",B).addNode("tools",J).addEdge(k,"requireNavigationServices").addEdge("requireNavigationServices","intentLLM").addConditionalEdges("intentLLM",e=>e.intent==="goToLayer"||e.intent==="goToFeatures"?"vectorSearchLayers":"agent",{vectorSearchLayers:"vectorSearchLayers",agent:"agent"}).addConditionalEdges("vectorSearchLayers",e=>e.intent==="goToFeatures"?"vectorSearchFields":"agent",{vectorSearchFields:"vectorSearchFields",agent:"agent"}).addEdge("vectorSearchFields","agent").addEdge("agent","tools").addEdge("tools",E),Y=String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
|
|
18
18
|
This includes zooming, panning, centering, or geocoding based on user input. The agent is designed to handle explicit map movement requests. NOTE: DO NOT call this agent if the user asks "show me...", that is meant to be handled by another agent. If the query is about where a certain address is, call this agent.
|
|
19
19
|
|
|
20
20
|
Supported actions:
|
|
@@ -33,4 +33,4 @@ ${o.results.map(d=>` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
33
33
|
_Example: “Center the map on San Francisco at scale 50000”_
|
|
34
34
|
_Example: “Zoom to the features in the schools layer where city = 'Austin'”_
|
|
35
35
|
_Example: “Go to the Downtown bookmark”_
|
|
36
|
-
_Example: “Where is Mount Rainier?”_`,
|
|
36
|
+
_Example: “Where is Mount Rainier?”_`,fe={id:"navigation",name:"Navigation Agent",description:Y,createGraph:X,workspace:x};return fe},"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 d from"./AYMUK2MC.js";import c from"./3ZPPYCNL.js";import b from"./OY2P2O47.js";import a from"./WHOZT5H5.js";import{a as s,c as o}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./2XQAM2Q3.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./ICYUPLZM.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,a])=>{var t=class extends i{constructor(){super(...arguments),this.agent=a}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=s(this,"arcgis-assistant-navigation-agent"),this.#i=o(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)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import k from"./FVDFPK3V.js";import j from"./
|
|
2
|
+
import k from"./FVDFPK3V.js";import j from"./275NKWUE.js";import i from"./FC45FF2D.js";import f from"./3YCSUTGV.js";import e from"./AYMUK2MC.js";import d from"./3ZPPYCNL.js";import c from"./OY2P2O47.js";import b from"./FNPLHH4E.js";import a from"./WHOZT5H5.js";import"./R74ZHFA6.js";import{a as g,b as h}from"./HJG7QM2R.js";import"./ICYUPLZM.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([C,I,{b:u,c:y,f:w,i:v,j:A,k:S,l:b,m:d,n:p,o:M,p:E,q:P,r:T,s:W,t:x},{a:f,b:V},,,O,L,D,k,R])=>{var U=async e=>{let a=e.allLayers.toArray(),s=[],o=new Map;for(let t of a)if(t instanceof C){let i=(async()=>{let n=await W(t),r=await x(t,n);o.set(t.id,{layerItem:r,fieldRegistry:n})})();s.push(i)}return await Promise.all(s),o},j=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:s}=await q(a),o={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:S,model:b,dimensions:A,templates:{layer:d,field:p}},layers:s},t=M.safeParse(o);if(!t.success)throw console.error("Schema Mismatch:",t.error.format()),new Error("Webmap embedding generation failed validation.");return t.data},q=async e=>{let a=[],s=[];for(let[i,{fieldRegistry:n,layerItem:r}]of e.entries()){let l=H(d,{name:r.name,title:r.title,description:r.description});a.push(l);let m={id:i,name:r.name??"",title:r.title,description:r.description,vector:[],fields:[]};for(let[,c]of n.entries()){let N=H(p,{name:c.name,alias:c.alias,description:c.description});a.push(N),m.fields.push({name:c.name,alias:c.alias,description:c.description,vector:[]})}s.push(m)}let o=await f(a),t=0;return{layers:s.map(i=>(i.vector=o[t++],i.fields.forEach(n=>{n.vector=o[t++]}),i))}},H=(e,a)=>e.replace(/\{(\w+)\}/gu,(s,o)=>a[o]??""),z=(e,a)=>{if(e.length!==a.length)throw new Error("Vectors must be the same length");let s=0,o=0,t=0;for(let r=0;r<e.length;++r){let l=e[r],m=a[r];s+=l*m,o+=l*l,t+=m*m}let i=Math.sqrt(o*t);if(i===0)return 0;let n=s/i;return Math.max(-1,Math.min(1,n))},_=E,ee=P,ae=T,te=g,se=f,re=z,oe=O,ie=L,ne=R,me=k,ce=D,le=j,de=()=>u(),pe=()=>y(),fe=async(e,a)=>await h(e,a),ge=async({modelTier:e="default",temperature:a=0,config:s}={})=>await w({modelTier:e,temperature:a,config:s});return{ArcgisKnowledgeAgent:ce,DataExplorationAgent:ne,HelpAgent:me,LayerStylingAgent:ie,NavigationAgent:oe,Orchestrator:V,cosineSimilarity:re,createAgentRuntimeState:de,createAgentRuntimeStateWithSharedState:pe,createChatModel:ge,createWebmapEmbeddings:le,getEmbeddings:se,invokeStructuredPrompt:ee,invokeTextPrompt:_,invokeToolPrompt:ae,sendTraceMessage:te,sendUXSuggestion:fe}},"layers/FeatureLayer","core/reactiveUtils",a,b,c,d,e,f,i,j,k)
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import d from"./275NKWUE.js";import c from"./3ZPPYCNL.js";import b from"./OY2P2O47.js";import a from"./WHOZT5H5.js";import{a as s,c as e}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import{v as i,z as r}from"./2XQAM2Q3.js";import"./R74ZHFA6.js";import"./HJG7QM2R.js";import"./ICYUPLZM.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,o])=>{var t=class extends i{constructor(){super(...arguments),this.agent=o}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=s(this,"arcgis-assistant-help-agent"),this.#i=e(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)
|
|
@@ -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("../NSER3L4A.js");let o=await y;return await(await r(o,"sendUXSuggestion"))(n,t)}async function q(n){e??=import("../BE7ZN5FZ.js");let t=await e,o=await r(t,"FunctionAgent");return new o(n)}async function E(n){a??=import("../OYNIFMCJ.js");let t=await a,o=await r(t,"FunctionTool");return new o(n)}async function F(n){i??=import("../L4SS54EZ.js");let t=await i,o=await r(t,"LLMAgent");return new o(n)}async function v(n){c??=import("../4CEMUECT.js");let t=await c,o=await r(t,"WorkflowAgent");return new o(n)}async function U(n){u??=import("../6U7TEAAJ.js");let t=await u,o=await r(t,"ConditionalWorkflow");return new o(n)}async function M(n){s??=import("../3DJDRAGV.js");let t=await s,o=await r(t,"LoopWorkflow");return new o(n)}async function P(n){w??=import("../XCRR2EEG.js");let t=await w,o=await r(t,"ParallelWorkflow");return new o(n)}async function R(n){l??=import("../PVE7Q43N.js");let t=await l,o=await r(t,"RouterWorkflow");return new o(n)}async function X(n){f??=import("../LHLO6PTD.js");let t=await f,o=await r(t,"SequentialWorkflow");return new o(n)}async function x(n){m??=import("../IEHPNCTL.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"./2XQAM2Q3.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=s(e,{"arcgis-assistant":[()=>import("./RAAV47KU.js"),"_messages:,assistantAvatarEnabled,awaitingResponse:,awaitingResponseStep:,copyEnabled,description,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,streamingDisabled,suggestedPrompts:,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt,unregister"],"arcgis-assistant-agent":[()=>import("./5L7VPEQM.js"),"agent:,context:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./AHLLB5QW.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./
|
|
2
|
+
import{p as s,y as e}from"./2XQAM2Q3.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var a=s(e,{"arcgis-assistant":[()=>import("./RAAV47KU.js"),"_messages:,assistantAvatarEnabled,awaitingResponse:,awaitingResponseStep:,copyEnabled,description,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,streamingDisabled,suggestedPrompts:,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt,unregister"],"arcgis-assistant-agent":[()=>import("./5L7VPEQM.js"),"agent:,context:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./AHLLB5QW.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./THXUE6R4.js"),"referenceElement;;getContext"],"arcgis-assistant-knowledge-agent":[()=>import("./QZLE7B6X.js"),"context:,referenceElement,serviceUrl;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./7NP7WGR5.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./LUJCH5V7.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./WY7B6IMH.js"),"interrupt:,loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./CWZEQ4R6.js"),"_messages:,awaitingResponse,disabled,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./OI7EGYZU.js"),"_messages:,message,options:,type"],"arcgis-assistant-interrupt-preview":[()=>import("./HPSVZVAR.js"),"interrupts:"],"arcgis-assistant-message":[()=>import("./JHFOZPBP.js"),"assistantAvatarEnabled,copyEnabled,feedbackEnabled,footerDisabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-block":[()=>import("./PJ3UN2RU.js"),"block:"],"arcgis-assistant-message-feedback":[()=>import("./XVPBO2JC.js"),"_messages:,feedbackEnabled,message:"],"arcgis-assistant-message-footer":[()=>import("./BSP6IJY4.js"),"_messages:,copyEnabled,feedbackEnabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-loading":[()=>import("./SLXOVE7Y.js"),"assistantAvatarEnabled,interrupts:,loading,loadingMessage"],"arcgis-assistant-message-log":[()=>import("./GLOALVJR.js"),"log:,logEnabled,showLog"],"arcgis-assistant-message-read-aloud":[()=>import("./U4Z5XNJ5.js"),"_messages:,message:,readAloudEnabled"],"arcgis-assistant-message-text":[()=>import("./242OOJML.js"),"content,parts:"],"arcgis-assistant-speech-input":[()=>import("./MSDNERUF.js"),"awaitingResponse,inputValue,language,mode;;clearDraftSession"],"arcgis-assistant-suggested-prompts":[()=>import("./2WDZIJQR.js"),"_messages:,label,prompts:"],"arcgis-assistant-user-message":[()=>import("./BI3LK5D3.js"),"content,message:,user"]});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/helpGraph.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { StateGraph as d, START as g, END as i } from "@langchain/langgraph/web";
|
|
3
|
-
import { l as h, g as f, f as p, r as x, t as y, H as
|
|
3
|
+
import { l as h, g as f, f as p, r as x, t as y, H as u } 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";
|
|
@@ -12,8 +12,9 @@ import "@langchain/openai";
|
|
|
12
12
|
import "@arcgis/core/config.js";
|
|
13
13
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
14
14
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
15
|
+
import { h as E } from "./toolCallResponse.js";
|
|
16
|
+
import { ToolNode as T } from "@langchain/langgraph/prebuilt";
|
|
17
|
+
import { s as m } from "./index.js";
|
|
17
18
|
import "@langchain/core/prompts";
|
|
18
19
|
const c = [h], v = (e) => {
|
|
19
20
|
if (!e || e.size === 0)
|
|
@@ -28,7 +29,7 @@ const c = [h], v = (e) => {
|
|
|
28
29
|
return `This map contains ${e.size} layer(s):
|
|
29
30
|
|
|
30
31
|
${t}`;
|
|
31
|
-
},
|
|
32
|
+
}, C = (e) => {
|
|
32
33
|
const t = e?.list() ?? [];
|
|
33
34
|
return t.length ? t.map((r) => `- ${r.agent.name}: ${r.agent.description}`).join(`
|
|
34
35
|
`) : "No agents currently available.";
|
|
@@ -43,12 +44,14 @@ async function _(e, t) {
|
|
|
43
44
|
tools: c,
|
|
44
45
|
inputVariables: {
|
|
45
46
|
layerSummary: v(s),
|
|
46
|
-
agents:
|
|
47
|
+
agents: C(l),
|
|
47
48
|
assignedTask: e.agentExecutionContext.assignedTask,
|
|
48
49
|
userRequest: e.agentExecutionContext.userRequest,
|
|
49
50
|
priorSteps: e.agentExecutionContext.priorSteps
|
|
50
51
|
}
|
|
51
|
-
})
|
|
52
|
+
});
|
|
53
|
+
await E(a, t);
|
|
54
|
+
const o = (a.tool_calls?.length ?? 0) > 0, n = typeof a.text == "string" ? a.text.trim() : "";
|
|
52
55
|
return {
|
|
53
56
|
...e,
|
|
54
57
|
helpInternalState: {
|
|
@@ -69,16 +72,16 @@ async function _(e, t) {
|
|
|
69
72
|
};
|
|
70
73
|
}
|
|
71
74
|
}
|
|
72
|
-
const
|
|
73
|
-
async function
|
|
74
|
-
const r = new
|
|
75
|
+
const H = (e, t) => x(["agentRegistry"], "Help Agent")(e, t);
|
|
76
|
+
async function b(e, t) {
|
|
77
|
+
const r = new T(c, { handleToolErrors: !1 });
|
|
75
78
|
try {
|
|
76
79
|
const s = e.helpInternalState.toolCallMessage;
|
|
77
80
|
if (!s)
|
|
78
81
|
throw new Error("helpToolCalling: missing helpInternalState.toolCallMessage");
|
|
79
82
|
const a = (await r.invoke({ messages: [s] }, t)).messages.map((o) => o.text).join(`
|
|
80
83
|
`);
|
|
81
|
-
return await
|
|
84
|
+
return await m({ text: `Finished executing help tool: ${a}` }, t), {
|
|
82
85
|
...e,
|
|
83
86
|
outputMessage: a,
|
|
84
87
|
status: "success",
|
|
@@ -90,7 +93,7 @@ async function H(e, t) {
|
|
|
90
93
|
};
|
|
91
94
|
} catch (s) {
|
|
92
95
|
const l = s instanceof Error ? s.message : String(s);
|
|
93
|
-
return await
|
|
96
|
+
return await m({ text: `Help tool execution failed: ${l}` }, t), {
|
|
94
97
|
...e,
|
|
95
98
|
outputMessage: `Help tool execution failed: ${l}`,
|
|
96
99
|
status: "failed",
|
|
@@ -102,7 +105,7 @@ async function H(e, t) {
|
|
|
102
105
|
};
|
|
103
106
|
}
|
|
104
107
|
}
|
|
105
|
-
const
|
|
108
|
+
const M = () => new d(u).addNode("requireHelpServices", H).addNode("agent", _).addNode("tools", b).addEdge(g, "requireHelpServices").addEdge("requireHelpServices", "agent").addConditionalEdges("agent", (t) => t.helpInternalState.toolCallMessage ? "tools" : i).addEdge("tools", i), k = String.raw`- **help** — Enables users to ask questions about the map, layers, fields, and it's capabilities.
|
|
106
109
|
|
|
107
110
|
_Example: “Tell me about this map”_
|
|
108
111
|
_Example: “List all layers in this map”_
|
|
@@ -115,13 +118,13 @@ const b = () => new d(m).addNode("requireHelpServices", C).addNode("agent", _).a
|
|
|
115
118
|
|
|
116
119
|
IF the user asks map related queries, but those that are not performed by any of the agents, call this agent so we can respond that the requested action is not supported.
|
|
117
120
|
_Example: "Create a chart"_
|
|
118
|
-
_Example: "Create a table"_`,
|
|
121
|
+
_Example: "Create a table"_`, J = {
|
|
119
122
|
id: "help",
|
|
120
123
|
name: "Help Agent",
|
|
121
|
-
description:
|
|
122
|
-
createGraph:
|
|
123
|
-
workspace:
|
|
124
|
+
description: k,
|
|
125
|
+
createGraph: M,
|
|
126
|
+
workspace: u
|
|
124
127
|
};
|
|
125
128
|
export {
|
|
126
|
-
|
|
129
|
+
J as H
|
|
127
130
|
};
|
|
@@ -12,9 +12,10 @@ import "@langchain/openai";
|
|
|
12
12
|
import "@arcgis/core/config.js";
|
|
13
13
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
14
14
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
15
|
+
import { h as G } from "./toolCallResponse.js";
|
|
15
16
|
import { s as h } from "./index.js";
|
|
16
17
|
import "@langchain/core/prompts";
|
|
17
|
-
import { ToolNode as
|
|
18
|
+
import { ToolNode as O } from "@langchain/langgraph/prebuilt";
|
|
18
19
|
import x from "zod";
|
|
19
20
|
const S = [
|
|
20
21
|
F,
|
|
@@ -27,19 +28,19 @@ const S = [
|
|
|
27
28
|
q,
|
|
28
29
|
Z
|
|
29
30
|
];
|
|
30
|
-
async function
|
|
31
|
+
async function B(e, t) {
|
|
31
32
|
const o = await T("navigation_tool_prompt"), { mapView: s } = k(t), i = s.map.bookmarks?.map((p) => p.name).filter(Boolean) ?? [], l = e.vectorSearchLayerResults?.length > 0 ? e.vectorSearchLayerResults.map(
|
|
32
33
|
(p, b) => `${b + 1}. layerId=${p.id} | title=${p.title ?? ""} | name=${p.name ?? ""} | score=${p.score.toFixed(2)}`
|
|
33
34
|
).join(`
|
|
34
35
|
`) : "", c = e.vectorSearchFieldResults?.length > 0 ? JSON.stringify(e.vectorSearchFieldResults, null, 2) : "", a = e.intent === "goToBookmark" && i.length ? `Available bookmarks:
|
|
35
36
|
${i.map((p) => `- ${p}`).join(`
|
|
36
37
|
`)}` : "", r = (e.intent === "goToLayer" || e.intent === "goToFeatures") && e.vectorSearchLayerResults?.length ? `Candidate layers:
|
|
37
|
-
${l}` : "",
|
|
38
|
+
${l}` : "", g = e.intent === "goToFeatures" && e.vectorSearchFieldResults?.length ? `Candidate fields:
|
|
38
39
|
${c}` : "", y = {
|
|
39
40
|
intent: e.intent,
|
|
40
41
|
bookmarksSection: a,
|
|
41
42
|
layersSection: r,
|
|
42
|
-
fieldsSection:
|
|
43
|
+
fieldsSection: g,
|
|
43
44
|
currentZoom: s.zoom,
|
|
44
45
|
assignedTask: e.agentExecutionContext.assignedTask,
|
|
45
46
|
userRequest: e.agentExecutionContext.userRequest,
|
|
@@ -50,7 +51,9 @@ ${c}` : "", y = {
|
|
|
50
51
|
config: t,
|
|
51
52
|
inputVariables: y,
|
|
52
53
|
tools: S
|
|
53
|
-
})
|
|
54
|
+
});
|
|
55
|
+
await G(n, t);
|
|
56
|
+
const m = (n.tool_calls?.length ?? 0) > 0, v = typeof n.text == "string" ? n.text.trim() : "", N = v.length > 0;
|
|
54
57
|
return {
|
|
55
58
|
...e,
|
|
56
59
|
navigationInternalState: {
|
|
@@ -62,7 +65,7 @@ ${c}` : "", y = {
|
|
|
62
65
|
status: m ? e.status : N ? "success" : "failed"
|
|
63
66
|
};
|
|
64
67
|
}
|
|
65
|
-
const
|
|
68
|
+
const D = (e) => {
|
|
66
69
|
const t = typeof e == "string" ? e : String(e);
|
|
67
70
|
try {
|
|
68
71
|
const o = JSON.parse(t);
|
|
@@ -73,21 +76,21 @@ const B = (e) => {
|
|
|
73
76
|
}
|
|
74
77
|
return { text: t };
|
|
75
78
|
};
|
|
76
|
-
async function
|
|
77
|
-
const o = new
|
|
79
|
+
async function J(e, t) {
|
|
80
|
+
const o = new O(S, { handleToolErrors: !1 });
|
|
78
81
|
try {
|
|
79
82
|
const s = e.navigationInternalState.toolCallMessage;
|
|
80
83
|
if (!s)
|
|
81
84
|
throw new Error("navigationToolCalling: missing navigationInternalState.toolCallMessage");
|
|
82
|
-
const { messages:
|
|
85
|
+
const { messages: d } = await o.invoke(
|
|
83
86
|
{
|
|
84
87
|
messages: [s]
|
|
85
88
|
},
|
|
86
89
|
t
|
|
87
90
|
);
|
|
88
91
|
let i = "", l;
|
|
89
|
-
for (const c of
|
|
90
|
-
const a =
|
|
92
|
+
for (const c of d) {
|
|
93
|
+
const a = D(c.content);
|
|
91
94
|
a.text && (i += `${a.text}
|
|
92
95
|
`), a.sharedStatePatch && (l = {
|
|
93
96
|
...l,
|
|
@@ -106,12 +109,12 @@ async function D(e, t) {
|
|
|
106
109
|
}
|
|
107
110
|
};
|
|
108
111
|
} catch (s) {
|
|
109
|
-
const
|
|
110
|
-
return await h({ text: `Navigation tool execution failed: ${
|
|
112
|
+
const d = s instanceof Error ? s.message : String(s);
|
|
113
|
+
return await h({ text: `Navigation tool execution failed: ${d}` }, t), {
|
|
111
114
|
...e,
|
|
112
|
-
outputMessage: `Navigation tool execution failed: ${
|
|
115
|
+
outputMessage: `Navigation tool execution failed: ${d}`,
|
|
113
116
|
status: "failed",
|
|
114
|
-
summary: `Navigation tool execution failed: ${
|
|
117
|
+
summary: `Navigation tool execution failed: ${d}`,
|
|
115
118
|
navigationInternalState: {
|
|
116
119
|
...e.navigationInternalState,
|
|
117
120
|
toolCallMessage: void 0
|
|
@@ -119,15 +122,15 @@ async function D(e, t) {
|
|
|
119
122
|
};
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
|
-
async function
|
|
123
|
-
const o = await T("navigation_intent_prompt"), { mapView: s } = k(t),
|
|
125
|
+
async function H(e, t) {
|
|
126
|
+
const o = await T("navigation_intent_prompt"), { mapView: s } = k(t), d = S.map((n) => ({
|
|
124
127
|
name: n.name,
|
|
125
128
|
description: n.description,
|
|
126
129
|
schema: n.schema
|
|
127
130
|
})), l = s.map.bookmarks?.map((n) => n.name).filter(Boolean) ?? [], c = l.length ? `Available bookmarks:
|
|
128
131
|
${l.map((n) => `- ${n}`).join(`
|
|
129
132
|
`)}` : "No bookmarks are available in this map.", a = {
|
|
130
|
-
tools:
|
|
133
|
+
tools: d.map(({ name: n, description: m, schema: v }) => `${n}: ${m}, ${JSON.stringify(v)}`).join(`
|
|
131
134
|
`),
|
|
132
135
|
bookmarks: c,
|
|
133
136
|
assignedTask: e.agentExecutionContext.assignedTask,
|
|
@@ -135,31 +138,31 @@ ${l.map((n) => `- ${n}`).join(`
|
|
|
135
138
|
priorSteps: e.agentExecutionContext.priorSteps
|
|
136
139
|
}, r = x.object({
|
|
137
140
|
intent: x.string()
|
|
138
|
-
}),
|
|
141
|
+
}), g = await z({
|
|
139
142
|
promptText: o,
|
|
140
143
|
config: t,
|
|
141
144
|
inputVariables: a,
|
|
142
145
|
schema: r,
|
|
143
146
|
modelTier: "fast"
|
|
144
|
-
}), y = typeof
|
|
147
|
+
}), y = typeof g.intent == "string" ? g.intent.trim().replace(/^"|"$/gu, "") : "";
|
|
145
148
|
return { ...e, intent: y || "" };
|
|
146
149
|
}
|
|
147
|
-
const
|
|
150
|
+
const U = 0.7, W = async (e, t) => {
|
|
148
151
|
try {
|
|
149
152
|
await h(
|
|
150
153
|
{ text: `Similarity search to find layers: ${e.agentExecutionContext.assignedTask}` },
|
|
151
154
|
t
|
|
152
155
|
);
|
|
153
|
-
const o = u(t, "layerSearch"), s = u(t, "layersAndFieldsRegistry"),
|
|
156
|
+
const o = u(t, "layerSearch"), s = u(t, "layersAndFieldsRegistry"), d = u(t, "embeddingCache"), l = (await o.searchLayers({
|
|
154
157
|
text: e.agentExecutionContext.assignedTask,
|
|
155
|
-
minScore:
|
|
156
|
-
embeddingCache:
|
|
158
|
+
minScore: U,
|
|
159
|
+
embeddingCache: d
|
|
157
160
|
})).map(({ id: a, score: r }) => {
|
|
158
|
-
const
|
|
161
|
+
const g = s.get(a)?.layerItem;
|
|
159
162
|
return {
|
|
160
163
|
id: a,
|
|
161
|
-
title:
|
|
162
|
-
name:
|
|
164
|
+
title: g?.title,
|
|
165
|
+
name: g?.name ?? void 0,
|
|
163
166
|
score: r
|
|
164
167
|
};
|
|
165
168
|
});
|
|
@@ -176,27 +179,27 @@ ${l.map((a) => `- layerId=${a.id} | title=${a.title ?? ""} | name=${a.name ?? ""
|
|
|
176
179
|
t
|
|
177
180
|
), o;
|
|
178
181
|
}
|
|
179
|
-
}, f = 0.7,
|
|
182
|
+
}, f = 0.7, K = 10, Q = async (e, t) => {
|
|
180
183
|
try {
|
|
181
184
|
await h(
|
|
182
185
|
{ text: `Similarity search to find fields: ${e.agentExecutionContext.assignedTask}` },
|
|
183
186
|
t
|
|
184
187
|
);
|
|
185
|
-
const o = u(t, "fieldSearch"), s = u(t, "layersAndFieldsRegistry"),
|
|
188
|
+
const o = u(t, "fieldSearch"), s = u(t, "layersAndFieldsRegistry"), d = u(t, "embeddingCache"), i = e.vectorSearchLayerResults?.map((r) => r.id) ?? [];
|
|
186
189
|
if (i.length === 0)
|
|
187
190
|
return await h({ text: "No candidate layers for field search" }, t), e;
|
|
188
191
|
const c = (await o.searchFields({
|
|
189
192
|
text: e.agentExecutionContext.assignedTask,
|
|
190
193
|
layerIds: i,
|
|
191
194
|
minScore: f,
|
|
192
|
-
topResults:
|
|
193
|
-
embeddingCache:
|
|
194
|
-
})).map(({ layerId: r, results:
|
|
195
|
+
topResults: K,
|
|
196
|
+
embeddingCache: d
|
|
197
|
+
})).map(({ layerId: r, results: g }) => {
|
|
195
198
|
const y = s.get(r)?.fieldRegistry;
|
|
196
199
|
return {
|
|
197
200
|
layerId: r,
|
|
198
201
|
layerName: s.get(r)?.layerItem.name,
|
|
199
|
-
results:
|
|
202
|
+
results: g.map((n) => {
|
|
200
203
|
const m = y?.get(n.name);
|
|
201
204
|
return {
|
|
202
205
|
name: n.name,
|
|
@@ -213,7 +216,7 @@ ${l.map((a) => `- layerId=${a.id} | title=${a.title ?? ""} | name=${a.name ?? ""
|
|
|
213
216
|
return c.length > 0 ? a = `Vector search completed. Matching layers and fields:
|
|
214
217
|
${c.map(
|
|
215
218
|
(r) => `${r.layerName ?? r.layerId}:
|
|
216
|
-
${r.results.map((
|
|
219
|
+
${r.results.map((g) => ` - ${g.name} (${g.score.toFixed(2)})`).join(`
|
|
217
220
|
`)}`
|
|
218
221
|
).join(`
|
|
219
222
|
`)}` : a = `No vector search field results found for score over ${f}.`, await h({ text: a }, t), {
|
|
@@ -226,7 +229,7 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
226
229
|
t
|
|
227
230
|
), o;
|
|
228
231
|
}
|
|
229
|
-
},
|
|
232
|
+
}, X = (e, t) => P(["layerSearch", "layersAndFieldsRegistry"], "Navigation Agent")(e, t), Y = () => new E(w).addNode("requireNavigationServices", X).addNode("intentLLM", H).addNode("vectorSearchLayers", W).addNode("vectorSearchFields", Q).addNode("agent", B).addNode("tools", J).addEdge($, "requireNavigationServices").addEdge("requireNavigationServices", "intentLLM").addConditionalEdges(
|
|
230
233
|
"intentLLM",
|
|
231
234
|
(t) => t.intent === "goToLayer" || t.intent === "goToFeatures" ? "vectorSearchLayers" : "agent",
|
|
232
235
|
{
|
|
@@ -240,7 +243,7 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
240
243
|
vectorSearchFields: "vectorSearchFields",
|
|
241
244
|
agent: "agent"
|
|
242
245
|
}
|
|
243
|
-
).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", C),
|
|
246
|
+
).addEdge("vectorSearchFields", "agent").addEdge("agent", "tools").addEdge("tools", C), ee = String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
|
|
244
247
|
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.
|
|
245
248
|
|
|
246
249
|
Supported actions:
|
|
@@ -259,13 +262,13 @@ ${r.results.map((d) => ` - ${d.name} (${d.score.toFixed(2)})`).join(`
|
|
|
259
262
|
_Example: “Center the map on San Francisco at scale 50000”_
|
|
260
263
|
_Example: “Zoom to the features in the schools layer where city = 'Austin'”_
|
|
261
264
|
_Example: “Go to the Downtown bookmark”_
|
|
262
|
-
_Example: “Where is Mount Rainier?”_`,
|
|
265
|
+
_Example: “Where is Mount Rainier?”_`, xe = {
|
|
263
266
|
id: "navigation",
|
|
264
267
|
name: "Navigation Agent",
|
|
265
|
-
description:
|
|
266
|
-
createGraph:
|
|
268
|
+
description: ee,
|
|
269
|
+
createGraph: Y,
|
|
267
270
|
workspace: w
|
|
268
271
|
};
|
|
269
272
|
export {
|
|
270
|
-
|
|
273
|
+
xe as N
|
|
271
274
|
};
|