@arcgis/ai-components 5.2.0-next.18 → 5.2.0-next.19

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.
@@ -10,6 +10,7 @@ import type { AgentData } from "../types.js";
10
10
  * executions, which can be useful for debugging and monitoring the agent's behavior.
11
11
  *
12
12
  * @returns An agent middleware that wraps model calls and sends trace messages.
13
+ * @internal
13
14
  * @since 5.1
14
15
  */
15
16
  export function createAgentTraceMiddleware(): AgentMiddleware;
@@ -20,6 +21,7 @@ export function createAgentTraceMiddleware(): AgentMiddleware;
20
21
  * debugging and monitoring the behavior of tools within the agent's execution.
21
22
  *
22
23
  * @returns A function tool middleware that wraps tool calls and sends trace messages.
24
+ * @internal
23
25
  * @since 5.1
24
26
  */
25
27
  export function createToolTraceMiddleware<TInput extends AgentData = AgentData, TOutput = unknown>(): FunctionToolMiddleware<TInput, TOutput>;
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./RNLQZV6U.js";import b from"./IDZTJLVN.js";import a from"./I76F57I2.js";import{a as s,c as o}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as i,z as r}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.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","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c)
2
+ import c from"./ASSH4WSC.js";import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.js";import{a as s,c as o}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as i,z as r}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.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","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./IDZTJLVN.js";import a from"./I76F57I2.js";import{a as m}from"./4RZPOYZ7.js";import{a as k,b as E,ta as $}from"./CJIV4KJZ.js";import{a as f}from"./WNS5ZUF5.js";export default $arcgis.t(([,,,,,,{q:N,r:T},{a:b,b:v,c:x,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}])=>{var w=[C,F,R,L,_,I,M,Z,A];async function G(e,t){let a=await S("navigation_tool_prompt"),{mapView:r}=x(t),c=r.map.bookmarks?.map(h=>h.name).filter(Boolean)??[],s=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((h,z)=>`${z+1}. layerId=${h.id} | title=${h.title??""} | name=${h.name??""} | score=${h.score.toFixed(2)}`).join(`
2
+ import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.js";import{a as m}from"./4RZPOYZ7.js";import{a as k,b as E,ta as $}from"./CJIV4KJZ.js";import{a as f}from"./WNS5ZUF5.js";export default $arcgis.t(([,,,,,,{q:N,r:T},{a:b,b:v,c:x,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}])=>{var w=[C,F,R,L,_,I,M,Z,A];async function G(e,t){let a=await S("navigation_tool_prompt"),{mapView:r}=x(t),c=r.map.bookmarks?.map(h=>h.name).filter(Boolean)??[],s=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((h,z)=>`${z+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:
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./JBNITHPO.js";import b from"./IDZTJLVN.js";import a from"./I76F57I2.js";import{c as s,d as n}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as r,z as o}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,,,,,,,,{fetchKnowledgeGraph:p},,,a])=>{var i=class extends r{constructor(){super(...arguments),this.agent=a}static{this.properties={referenceElement:1,serviceUrl:3,context:0}}#e;#i;#t;#r;get serviceUrl(){return this.#i}set serviceUrl(t){this.#i=t}async getContext(){let t=this.context?{...this.context,knowledgeGraph:void 0,view:void 0}:{};if(this.#e)return{...t,view:this.#e};if(this.#t)try{let e=await this.#t;return{...t,knowledgeGraph:e}}catch(e){console.error("Failed to load knowledge graph via service URL:",e)}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=p(this.serviceUrl):this.#t=void 0}load(){this.#e=n(this)??void 0,this.#r=s(this)}disconnectedCallback(){this.#r?.unregister(this.agent.id),super.disconnectedCallback()}};o("arcgis-assistant-knowledge-agent",i);return i},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c)
2
+ import c from"./KTOL6IN7.js";import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.js";import{c as s,d as n}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as r,z as o}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,,,,,,,,{fetchKnowledgeGraph:p},,,a])=>{var i=class extends r{constructor(){super(...arguments),this.agent=a}static{this.properties={referenceElement:1,serviceUrl:3,context:0}}#e;#i;#t;#r;get serviceUrl(){return this.#i}set serviceUrl(t){this.#i=t}async getContext(){let t=this.context?{...this.context,knowledgeGraph:void 0,view:void 0}:{};if(this.#e)return{...t,view:this.#e};if(this.#t)try{let e=await this.#t;return{...t,knowledgeGraph:e}}catch(e){console.error("Failed to load knowledge graph via service URL:",e)}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=p(this.serviceUrl):this.#t=void 0}load(){this.#e=n(this)??void 0,this.#r=s(this)}disconnectedCallback(){this.#r?.unregister(this.agent.id),super.disconnectedCallback()}};o("arcgis-assistant-knowledge-agent",i);return i},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c)
@@ -1,3 +1,3 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./I76F57I2.js";import{b as f}from"./ADYIXCSG.js";import{a as l}from"./4RZPOYZ7.js";import{U as R,a as v,b as x,ta as S,u as E}from"./CJIV4KJZ.js";import{Z as I,ja as b}from"./IKEF7ZHH.js";export default $arcgis.t(([O,P,q,N,T,{a:C,d:k,e:p,g:A,h:$,o:M}])=>{var U=async t=>{let e=await _(),r=await C("default"),s=P.getDefault(),n=(await O.getCredential(`${s.url}/sharing`)).token,a={type:"generateEmbeddings",webmapEmbeddings:t,auth:{apiUrl:r,token:n}};return e.postMessage(a),await new Promise((i,o)=>{let d=u=>{u.data==="completed"&&(e.removeEventListener("message",d),i())},c=u=>{e.removeEventListener("message",d),o(u instanceof Error?u:new Error("Embeddings worker error"))};e.addEventListener("message",d),e.addEventListener("error",c,{once:!0})}),e},_=async()=>{{let t=(await import("./23EQTPO3.js")).default;return new t}},G=t=>{t.currentIntent="none"},z=async(t,e)=>{let r=p(e);if(t.agentExecutionContext.userRequest){let n=new b(t.agentExecutionContext.userRequest.trim());t.agentExecutionContext.messages=[...t.agentExecutionContext.messages,n],G(t)}let s=r?.services.agentRegistry.list().map(n=>n.agent.id)??[];return await l({text:`Available agents: ${[...s].join(", ")}`},e),await l({text:"Analyzing user input"},e),t},Q=async(t,e)=>(await l({text:"Exiting..."},e),t),D=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),B=(t,e)=>{if(!D(t)){t!==void 0&&console.warn(`Agent "${e}" returned invalid sharedStatePatch. Ignoring it.`);return}let r={};for(let[s,n]of Object.entries(t)){if(!D(n)||!("value"in n)){console.warn(`Agent "${e}" returned invalid sharedStatePatch entry for key "${s}". Ignoring that entry.`);continue}r[s]={value:n.value}}return r},J=t=>{let{previousSharedState:e,patch:r,agentId:s}=t;if(!r)return e;let n=Date.now(),a={...e};for(let[i,o]of Object.entries(r))o?.value!==void 0&&(a[i]={value:o.value,meta:{updatedByAgentId:s,updatedAt:n}});return a},W=t=>typeof t!="string"?void 0:t.trim()||void 0,K=t=>{switch(t){case"failed":return"Agent failed without a summary.";case"unknown":return"Agent returned with unknown status.";case"success":return"Agent completed without a summary.";default:return"Agent completed without a summary."}},V=(t,e)=>{let r=W(e?.outputMessage),s=W(e?.summary),n=e?.status,a=n==="success"||n==="failed"?n:"unknown";a==="unknown"&&console.warn(`Agent "${t}" returned missing/invalid status. Defaulting to "unknown".`);let i=B(e?.sharedStatePatch,t);return{outputMessage:r,summary:s??r??K(a),status:a,sharedStatePatch:i}},F=4e3,X=async(t,e)=>{let r=p(e);if(e?.signal?.aborted)return await l({text:"Run cancelled; skipping agent execution"},e),{...t,currentIntent:"none",requiresFollowUp:!1};let{agentRegistry:s}=r?.services??{},n=s?.get(t.currentIntent);if(!n)return console.warn(`No agent found for intent: ${t.currentIntent}`),t;await l({text:`Executing registered agent: ${n.agent.name}`},e);let a={...e??{},configurable:{...r??{},agentId:n.agent.id,context:n.getContext?await n.getContext():void 0}},i;try{let c=await n.agent.createGraph().compile().invoke({agentExecutionContext:{...t.agentExecutionContext,messages:[...t.agentExecutionContext.messages],priorSteps:structuredClone(t.agentExecutionContext.priorSteps??[]),sharedState:structuredClone(t.agentExecutionContext.sharedState??{})}},a);i=V(n.agent.name,c),await l({text:`Finished executing registered agent: ${n.agent.name}`},e)}catch(c){if(E(c)||e?.signal?.aborted||c instanceof Error&&c.name==="AbortError")throw c;let u=c instanceof Error?c.message:String(c);console.error(`Agent "${n.agent.name}" failed:`,c),await l({text:`Registered agent failed: ${n.agent.name}. ${u}`},e),i={status:"failed",outputMessage:`Agent execution failed: ${u}`,summary:`Agent execution failed: ${u}`}}let o=i.outputMessage,d=[...t.agentExecutionContext.messages];if(o){let c=o.length>F?`${o.slice(0,F-14)}
2
+ import a from"./EBRNMPPO.js";import{b as f}from"./ADYIXCSG.js";import{a as l}from"./4RZPOYZ7.js";import{U as R,a as v,b as x,ta as S,u as E}from"./CJIV4KJZ.js";import{Z as I,ja as b}from"./IKEF7ZHH.js";export default $arcgis.t(([O,P,q,N,T,{a:C,d:k,e:p,g:A,h:$,o:M}])=>{var U=async t=>{let e=await _(),r=await C("default"),s=P.getDefault(),n=(await O.getCredential(`${s.url}/sharing`)).token,a={type:"generateEmbeddings",webmapEmbeddings:t,auth:{apiUrl:r,token:n}};return e.postMessage(a),await new Promise((i,o)=>{let d=u=>{u.data==="completed"&&(e.removeEventListener("message",d),i())},c=u=>{e.removeEventListener("message",d),o(u instanceof Error?u:new Error("Embeddings worker error"))};e.addEventListener("message",d),e.addEventListener("error",c,{once:!0})}),e},_=async()=>{{let t=(await import("./23EQTPO3.js")).default;return new t}},G=t=>{t.currentIntent="none"},z=async(t,e)=>{let r=p(e);if(t.agentExecutionContext.userRequest){let n=new b(t.agentExecutionContext.userRequest.trim());t.agentExecutionContext.messages=[...t.agentExecutionContext.messages,n],G(t)}let s=r?.services.agentRegistry.list().map(n=>n.agent.id)??[];return await l({text:`Available agents: ${[...s].join(", ")}`},e),await l({text:"Analyzing user input"},e),t},Q=async(t,e)=>(await l({text:"Exiting..."},e),t),D=t=>typeof t=="object"&&t!==null&&!Array.isArray(t),B=(t,e)=>{if(!D(t)){t!==void 0&&console.warn(`Agent "${e}" returned invalid sharedStatePatch. Ignoring it.`);return}let r={};for(let[s,n]of Object.entries(t)){if(!D(n)||!("value"in n)){console.warn(`Agent "${e}" returned invalid sharedStatePatch entry for key "${s}". Ignoring that entry.`);continue}r[s]={value:n.value}}return r},J=t=>{let{previousSharedState:e,patch:r,agentId:s}=t;if(!r)return e;let n=Date.now(),a={...e};for(let[i,o]of Object.entries(r))o?.value!==void 0&&(a[i]={value:o.value,meta:{updatedByAgentId:s,updatedAt:n}});return a},W=t=>typeof t!="string"?void 0:t.trim()||void 0,K=t=>{switch(t){case"failed":return"Agent failed without a summary.";case"unknown":return"Agent returned with unknown status.";case"success":return"Agent completed without a summary.";default:return"Agent completed without a summary."}},V=(t,e)=>{let r=W(e?.outputMessage),s=W(e?.summary),n=e?.status,a=n==="success"||n==="failed"?n:"unknown";a==="unknown"&&console.warn(`Agent "${t}" returned missing/invalid status. Defaulting to "unknown".`);let i=B(e?.sharedStatePatch,t);return{outputMessage:r,summary:s??r??K(a),status:a,sharedStatePatch:i}},F=4e3,X=async(t,e)=>{let r=p(e);if(e?.signal?.aborted)return await l({text:"Run cancelled; skipping agent execution"},e),{...t,currentIntent:"none",requiresFollowUp:!1};let{agentRegistry:s}=r?.services??{},n=s?.get(t.currentIntent);if(!n)return console.warn(`No agent found for intent: ${t.currentIntent}`),t;await l({text:`Executing registered agent: ${n.agent.name}`},e);let a={...e??{},configurable:{...r??{},agentId:n.agent.id,context:n.getContext?await n.getContext():void 0}},i;try{let c=await n.agent.createGraph().compile().invoke({agentExecutionContext:{...t.agentExecutionContext,messages:[...t.agentExecutionContext.messages],priorSteps:structuredClone(t.agentExecutionContext.priorSteps??[]),sharedState:structuredClone(t.agentExecutionContext.sharedState??{})}},a);i=V(n.agent.name,c),await l({text:`Finished executing registered agent: ${n.agent.name}`},e)}catch(c){if(E(c)||e?.signal?.aborted||c instanceof Error&&c.name==="AbortError")throw c;let u=c instanceof Error?c.message:String(c);console.error(`Agent "${n.agent.name}" failed:`,c),await l({text:`Registered agent failed: ${n.agent.name}. ${u}`},e),i={status:"failed",outputMessage:`Agent execution failed: ${u}`,summary:`Agent execution failed: ${u}`}}let o=i.outputMessage,d=[...t.agentExecutionContext.messages];if(o){let c=o.length>F?`${o.slice(0,F-14)}
3
3
  [truncated]`:o;d.push(new I(c))}return{...t,stepCount:t.stepCount+1,lastExecutedAgent:n.agent.id,requiresFollowUp:i.status==="failed"?!0:t.requiresFollowUp,finalOutputMessage:o??"",agentExecutionContext:{...t.agentExecutionContext,messages:d,priorSteps:[...t.agentExecutionContext.priorSteps??[],{agentId:n.agent.id,assignedTask:t.agentExecutionContext.assignedTask,summary:i?.summary||"No summary provided.",status:i?.status||"unknown"}],sharedState:J({previousSharedState:t.agentExecutionContext.sharedState,patch:i.sharedStatePatch,agentId:n.agent.id})}}},Y=3,Z=()=>new S(k).addNode("ingestInput",z).addNode("intentLLM",$).addNode("executeRegisteredAgent",X).addNode("exit",Q).addEdge(v,"ingestInput").addEdge("ingestInput","intentLLM").addConditionalEdges("intentLLM",t=>t.currentIntent==="none"||t.currentIntent===t.lastExecutedAgent?"exit":"executeRegisteredAgent").addConditionalEdges("executeRegisteredAgent",t=>t.stepCount>=Y||!t.requiresFollowUp?"exit":"intentLLM").addEdge("exit",x),w=class{constructor(){this.agentRegistry=new Map}register(e){let{agent:r}=e;if(this.agentRegistry.has(r.id))throw new Error(`Duplicate agent id: ${r.id}`);this.agentRegistry.set(r.id,e)}get(e){return this.agentRegistry.get(e)}list(){return[...this.agentRegistry.values()]}},y=class{constructor(e,r){this.graph=e,this.config={...r}}async waitForUser(){return await new Promise((e,r)=>{this.resolveWait=e,this.rejectWait=r})}handle(e,r){try{let s={agentId:e.agentId,id:e.id,payload:r},n=this.graph.streamEvents(null,{...this.config,configurable:{...this.config.configurable,hitlResponse:s},subgraphs:!0,version:"v2"});this.resolveWait?.(n)}catch(s){this.rejectWait?.(s)}finally{this.resolveWait=void 0,this.rejectWait=void 0}}cancel(){this.rejectWait&&(this.rejectWait(new Error("Request cancelled by user.")),this.resolveWait=void 0,this.rejectWait=void 0)}},ee=async t=>{try{return await(await A()).embedDocuments(t)}catch(e){throw console.error("Failed to generate embeddings:",e),e}},j=async(t,e)=>{let r=e.get(t);if(r)return r;let s=await ee([t]);return e.set(t,s[0]),s[0]};async function te(t,e,r,s){let n=`req-${Date.now()}`,a={type:"layerSearch",precomputedEmbedding:s?await j(t,s):void 0,requestId:n,minScore:r};return await new Promise(i=>{let o=d=>{d.data.requestId===n&&i(d.data.results)};e.addEventListener("message",o,{once:!0}),e.postMessage(a)})}function re(t){let{worker:e}=t;return{async searchLayers({text:r,minScore:s,embeddingCache:n}){return await te(r,e,s,n)}}}var ne=async({combinedQuery:t,layerIds:e,embeddingsWorker:r,minScore:s,topResults:n,embeddingCache:a})=>{let i=`req-${Date.now()}`,o=a?await j(t,a):void 0,d={type:"fieldSearch",layerIdForFieldsSearch:e,precomputedEmbedding:o,requestId:i,minScore:s,topResults:n};return await new Promise(c=>{let u=h=>{if(h.data.requestId!==i)return;let g=h.data.results.map(({layerId:m,results:H})=>({layerId:m,results:H}));c(g)};r.addEventListener("message",u,{once:!0}),r.postMessage(d)})};function se(t){let{worker:e}=t;return{async searchFields({text:r,layerIds:s,minScore:n,topResults:a,embeddingCache:i}){return await ne({combinedQuery:r,layerIds:s,embeddingsWorker:e,minScore:n,topResults:a,embeddingCache:i})}}}var ae=t=>{let e=M.safeParse(t);if(!e.success)throw new Error("Embeddings response validation failed. Regenerate embeddings.");return e.data},ie=(t,e)=>{let r=new Map,s=new Map;if(e.allLayers.forEach(n=>{n instanceof N&&s.set(n.id,n)}),t.length!==s.size)throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");for(let n of t){let a=s.get(n.id);if(!a)throw new Error(`Layer with ID ${n.id} not found in the original map during registry restoration. Regenerate embeddings.`);if(n.fields.length!==a.fields.length)throw new Error(`Field count mismatch for layer ID ${n.id} during registry restoration. Regenerate embeddings.`);let i={name:n.name,title:n.title,description:n.description},o=new Map;for(let d of n.fields){let c=a.fieldsIndex.get(d.name);if(!c)throw new Error(`Field with name ${d.name} not found in the original layer ${n.id} during registry restoration. Regenerate embeddings.`);o.set(d.name,{name:d.name,alias:a.getFieldAlias(d.name)??d.alias,description:d.description,type:c.type||"unknown",valueType:c.valueType||"unknown",domain:a.getFieldDomain(d.name)??void 0})}r.set(n.id,{layerItem:i,fieldRegistry:o})}return r},oe=async t=>{try{return(await T(t,{responseType:"json"})).data}catch(e){throw new Error(`Failed to fetch data from ${t}: ${String(e)}`)}},de=async t=>{let e=t.map;if(!e?.portalItem)throw new Error("WebMap portal item is missing.");let{resources:r}=await e.portalItem.fetchResources(),s=r.find(a=>a.resource.path==="embeddings-v01.json");if(!s?.resource.url)throw new Error("Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.");let n=await oe(s.resource.url);return ae(n)},L=class t{constructor(){this.orchestratorReady=!1,this.chatHistory=[],this.priorSteps=[],this.sharedState={},this.agentRegistry=new w,this.activeRunId="",this.cancelledRunIds=new Set,this.streamEpoch=0}static async init(e){let r=new t;try{if(e.view?.map){await q.whenOnce(()=>e.view.ready);let s=await de(e.view),n=ie(s.layers,e.view.map);r.layersAndFieldsRegistry=n,r.embeddingsWorker=await U(s)}return e.agents?.forEach(s=>{r.agentRegistry.register(s)}),r.orchestratorReady=!0,r}catch(s){throw console.error("Orchestrator initialization failed:",s),s}}async*ask(e){if(!this.orchestratorReady)throw new Error("Orchestrator is not ready yet.");if(!this.agentRegistry.list().length)throw new Error("Orchestrator has no registered agents.");if(++this.streamEpoch,!e.trim())return;let r=f();this.activeRunId=r,this.activeAbortController=new AbortController,this.graph||(this.graph=Z().compile({checkpointer:new R}));let s=this.embeddingsWorker?re({worker:this.embeddingsWorker}):void 0,n=this.embeddingsWorker?se({worker:this.embeddingsWorker}):void 0,a=new Map,i={thread_id:r,hitlResponse:null,services:{layerSearch:s,fieldSearch:n,layersAndFieldsRegistry:this.layersAndFieldsRegistry,agentRegistry:this.agentRegistry,embeddingCache:a}},o={version:"v2",streamMode:"custom",signal:this.activeAbortController.signal,configurable:i,subgraphs:!0},d=this.graph?.streamEvents({agentExecutionContext:{userRequest:e,messages:this.chatHistory,priorSteps:this.priorSteps,sharedState:this.sharedState}},o),c=++this.streamEpoch;if(yield*this.pipeStream(d,c,r),this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}for(;;){if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}let h=(await this.graph.getState(o,{subgraphs:!0})).tasks.find(g=>g.interrupts.length>0)?.interrupts[0]?.value;if(!h)break;this.currentInterrupt=h,this.interruptHandler=new y(this.graph,o),yield{runId:r,timestamp:Date.now(),type:"interrupt",interrupt:h};try{let g=await this.interruptHandler.waitForUser(),m=++this.streamEpoch;yield*this.pipeStream(g,m,r)}catch(g){if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}if(g){yield{runId:r,timestamp:Date.now(),type:"error",error:{message:g?.message}};return}}}if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}let u=(await this.graph.getState(o,{subgraphs:!0})).values;if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}this.chatHistory=u.agentExecutionContext.messages.length?u.agentExecutionContext.messages:this.chatHistory,this.priorSteps=u.agentExecutionContext.priorSteps?.slice(-5)??[],this.sharedState=u.agentExecutionContext.sharedState??{},yield{runId:r,timestamp:Date.now(),type:"completed",result:{content:u.finalOutputMessage}}}newConversation(){this.chatHistory=[],this.priorSteps=[],this.sharedState={}}resumeInterrupt(e){if(!this.currentInterrupt||!this.interruptHandler)throw new Error("No pending interrupt to resume.");this.interruptHandler.handle(this.currentInterrupt,e)}cancelInterrupt(){this.interruptHandler&&this.interruptHandler.cancel()}cancel(){this.activeRunId&&(this.cancelledRunIds.add(this.activeRunId),this.activeAbortController?.abort(),++this.streamEpoch,this.interruptHandler?.cancel())}async*pipeStream(e,r,s){for await(let n of e){if(this.isRunCancelled(s)||r!==this.streamEpoch)break;n.event==="on_custom_event"&&n.name==="trace_message"?yield{runId:s,timestamp:Date.now(),type:"trace",data:n.data}:n.name==="graph_ux_suggestion"&&(yield{runId:s,timestamp:Date.now(),type:"ux-suggestion",suggestion:n.data})}}isRunCancelled(e){return this.cancelledRunIds.has(e)}dispose(){this.embeddingsWorker&&(this.embeddingsWorker.terminate(),this.embeddingsWorker=void 0),this.orchestratorReady=!1}};return{a:ee,b:L}},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request",a)
@@ -36,7 +36,7 @@ https://help.openai.com/en/articles/5112595-best-practices-for-api-key-safety
36
36
 
37
37
  `);return n[n.length-1]?.trim()===r?t:`${t}
38
38
 
39
- ${r}`},$u=()=>({userRequest:"",assignedTask:"",messages:[],priorSteps:[],sharedState:{}}),Ap=()=>({agentExecutionContext:ee({reducer:Eu,default:$u}),outputMessage:ee({reducer:Su,default:()=>""}),summary:ee({reducer:Vr,default:()=>""}),status:ee({reducer:Vr})}),AT=()=>({...Ap(),sharedStatePatch:ee({reducer:Vr})}),IT=ee.Root({agentExecutionContext:ee({default:$u,reducer:Eu}),currentIntent:ee({default:()=>"none",reducer:Vr}),lastExecutedAgent:ee({default:()=>"",reducer:Vr}),requiresFollowUp:ee({default:()=>!0,reducer:Vr}),stepCount:ee({default:()=>0,reducer:(t,e)=>e??t+1}),finalOutputMessage:ee({default:()=>"",reducer:Su})}),Ip=t=>{if(!t||typeof t!="object"||!("services"in t))return!1;let e=t.services;return!!e&&typeof e=="object"&&"agentRegistry"in e},bp=t=>{let e=t?.configurable;return Ip(e)?e:void 0},xp=(t,e,r)=>{let s=t[e];return s?typeof s=="function"?s():Promise.resolve(s):new Promise((n,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},$o=async t=>(await xp(Object.assign({"./field_descriptions_prompt.md":()=>import("./ZTBA5PM7.js"),"./intent_prompt.md":()=>import("./6ZW7Z36F.js"),"./layer_descriptions_prompt.md":()=>import("./7RCQFLPP.js")}),`./${t}.md`,2)).default,wp=async t=>{let{agent:e,messages:r,config:s}=t;return{structuredResponse:(await e.invoke({messages:r},s)).structuredResponse}},Op=t=>typeof t=="string"&&t.length>0?t:void 0,Pp=()=>jo(),vp=t=>typeof t!="string"||t.trim().length===0?"MapsSDK":`MapsSDK - ${t.trim()}`,kp=t=>{let e=t?.configurable;return{conversationId:Op(e?.thread_id),abortSignal:t?.signal,requestId:Pp(),requestSource:vp(hp.applicationName)}},Nu=async({config:t})=>{let e=Tu.getDefault(),r=(await dp.getCredential(`${e.url}/sharing`))?.token;return async(s,n)=>{let{conversationId:o,abortSignal:i,requestId:a,requestSource:l}=kp(t),u=new Headers(n?.headers);u.delete("Authorization"),u.delete("api-key"),r&&r.length>0&&(u.set("X-Esri-Authorization",`Bearer ${r}`),u.set("X-Esri-Request-Source",l)),o&&o.length>0&&u.set("X-Esri-Conversation-Id",o),a.length>0&&u.set("X-Esri-Request-Id",a);let f=i&&n?.signal?AbortSignal.any([i,n.signal]):n?.signal??i;return await fetch(s,{...n,headers:u,signal:f})}},Os=async(t={})=>{let{modelTier:e="default",temperature:r=0,config:s}=t,n=Cu[e],o=await gp(e);return new In({modelName:n,apiKey:"dummy-key",...e!=="default"&&{temperature:r},configuration:{baseURL:o,fetch:await Nu({config:s})}})},bT=async(t={})=>{let{tier:e="default",config:r}=t,s=So[e],n=await yp(e);return new bn({modelName:s,apiKey:"dummy-key",configuration:{baseURL:n,fetch:await Nu({config:r})},batchSize:2048,maxConcurrency:10})},Tp=I.object({id:I.string().min(1),name:I.string().min(1),description:I.string().min(1)});I.array(Tp);var vu=t=>JSON.stringify(t,null,2),Cp=t=>{let e=t.map(s=>s.id),r=I.enum(e);return I.object({intent:r.nullable(),assignedTask:I.string().nullable(),requiresFollowUp:I.boolean()})},xT=async(t,e)=>{let r=bp(e);if(e?.signal?.aborted)return await et({text:"Run cancelled; skipping intent routing"},e),{...t,currentIntent:"none",finalOutputMessage:"Operation cancelled.",requiresFollowUp:!1};try{await et({text:"Asking LLM to route to an agent"},e);let s=r.services.agentRegistry?.list()??[],n=s.map(({agent:x})=>({id:x.id,name:x.name,description:x.description}));if(!n.length)return await et({text:"No agents registered; skipping intent detection"},e),{...t,currentIntent:"none",finalOutputMessage:"No agents registered; skipping intent detection."};let o=await $o("intent_prompt"),i=vu(n),a=Cp(n),l={registeredAgents:i,priorSteps:vu(t.agentExecutionContext.priorSteps),userRequest:t.agentExecutionContext.userRequest},u=await Cn.fromTemplate(o).format(l),f=ii({model:await Os({modelTier:"fast",config:e}),tools:[],systemPrompt:u,responseFormat:a,middleware:[ai({model:await Os({modelTier:"fast",config:e}),trigger:{tokens:4e3},keep:{messages:6}}),ui({runLimit:2})]}),{structuredResponse:d}=await wp({agent:f,messages:t.agentExecutionContext.messages,config:e}),y=a.parse(d??{intent:null,assignedTask:null,requiresFollowUp:!1}),_=y.intent??"none",g={...t,currentIntent:_,requiresFollowUp:y.requiresFollowUp,agentExecutionContext:{...t.agentExecutionContext,assignedTask:y.assignedTask??""}};if(_==="none"){let x=`I could not find an agent that can handle that request. I have access to the following agents: ${s.map(({agent:$})=>$.name).join(", ")}.
39
+ ${r}`},$u=()=>({userRequest:"",assignedTask:"",messages:[],priorSteps:[],sharedState:{}}),Ap=()=>({agentExecutionContext:ee({reducer:Eu,default:$u}),outputMessage:ee({reducer:Su,default:()=>""}),summary:ee({reducer:Vr,default:()=>""}),status:ee({reducer:Vr})}),AT=()=>({...Ap(),sharedStatePatch:ee({reducer:Vr})}),IT=ee.Root({agentExecutionContext:ee({default:$u,reducer:Eu}),currentIntent:ee({default:()=>"none",reducer:Vr}),lastExecutedAgent:ee({default:()=>"",reducer:Vr}),requiresFollowUp:ee({default:()=>!0,reducer:Vr}),stepCount:ee({default:()=>0,reducer:(t,e)=>e??t+1}),finalOutputMessage:ee({default:()=>"",reducer:Su})}),Ip=t=>{if(!t||typeof t!="object"||!("services"in t))return!1;let e=t.services;return!!e&&typeof e=="object"&&"agentRegistry"in e},bp=t=>{let e=t?.configurable;return Ip(e)?e:void 0},xp=(t,e,r)=>{let s=t[e];return s?typeof s=="function"?s():Promise.resolve(s):new Promise((n,o)=>{(typeof queueMicrotask=="function"?queueMicrotask:setTimeout)(o.bind(null,new Error("Unknown variable dynamic import: "+e+(e.split("/").length!==r?". Note that variables only represent file names one level deep.":""))))})},$o=async t=>(await xp(Object.assign({"./field_descriptions_prompt.md":()=>import("./ZTBA5PM7.js"),"./intent_prompt.md":()=>import("./X7GE26KU.js"),"./layer_descriptions_prompt.md":()=>import("./7RCQFLPP.js")}),`./${t}.md`,2)).default,wp=async t=>{let{agent:e,messages:r,config:s}=t;return{structuredResponse:(await e.invoke({messages:r},s)).structuredResponse}},Op=t=>typeof t=="string"&&t.length>0?t:void 0,Pp=()=>jo(),vp=t=>typeof t!="string"||t.trim().length===0?"MapsSDK":`MapsSDK - ${t.trim()}`,kp=t=>{let e=t?.configurable;return{conversationId:Op(e?.thread_id),abortSignal:t?.signal,requestId:Pp(),requestSource:vp(hp.applicationName)}},Nu=async({config:t})=>{let e=Tu.getDefault(),r=(await dp.getCredential(`${e.url}/sharing`))?.token;return async(s,n)=>{let{conversationId:o,abortSignal:i,requestId:a,requestSource:l}=kp(t),u=new Headers(n?.headers);u.delete("Authorization"),u.delete("api-key"),r&&r.length>0&&(u.set("X-Esri-Authorization",`Bearer ${r}`),u.set("X-Esri-Request-Source",l)),o&&o.length>0&&u.set("X-Esri-Conversation-Id",o),a.length>0&&u.set("X-Esri-Request-Id",a);let f=i&&n?.signal?AbortSignal.any([i,n.signal]):n?.signal??i;return await fetch(s,{...n,headers:u,signal:f})}},Os=async(t={})=>{let{modelTier:e="default",temperature:r=0,config:s}=t,n=Cu[e],o=await gp(e);return new In({modelName:n,apiKey:"dummy-key",...e!=="default"&&{temperature:r},configuration:{baseURL:o,fetch:await Nu({config:s})}})},bT=async(t={})=>{let{tier:e="default",config:r}=t,s=So[e],n=await yp(e);return new bn({modelName:s,apiKey:"dummy-key",configuration:{baseURL:n,fetch:await Nu({config:r})},batchSize:2048,maxConcurrency:10})},Tp=I.object({id:I.string().min(1),name:I.string().min(1),description:I.string().min(1)});I.array(Tp);var vu=t=>JSON.stringify(t,null,2),Cp=t=>{let e=t.map(s=>s.id),r=I.enum(e);return I.object({intent:r.nullable(),assignedTask:I.string().nullable(),requiresFollowUp:I.boolean()})},xT=async(t,e)=>{let r=bp(e);if(e?.signal?.aborted)return await et({text:"Run cancelled; skipping intent routing"},e),{...t,currentIntent:"none",finalOutputMessage:"Operation cancelled.",requiresFollowUp:!1};try{await et({text:"Asking LLM to route to an agent"},e);let s=r.services.agentRegistry?.list()??[],n=s.map(({agent:x})=>({id:x.id,name:x.name,description:x.description}));if(!n.length)return await et({text:"No agents registered; skipping intent detection"},e),{...t,currentIntent:"none",finalOutputMessage:"No agents registered; skipping intent detection."};let o=await $o("intent_prompt"),i=vu(n),a=Cp(n),l={registeredAgents:i,priorSteps:vu(t.agentExecutionContext.priorSteps),userRequest:t.agentExecutionContext.userRequest},u=await Cn.fromTemplate(o).format(l),f=ii({model:await Os({modelTier:"fast",config:e}),tools:[],systemPrompt:u,responseFormat:a,middleware:[ai({model:await Os({modelTier:"fast",config:e}),trigger:{tokens:4e3},keep:{messages:6}}),ui({runLimit:2})]}),{structuredResponse:d}=await wp({agent:f,messages:t.agentExecutionContext.messages,config:e}),y=a.parse(d??{intent:null,assignedTask:null,requiresFollowUp:!1}),_=y.intent??"none",g={...t,currentIntent:_,requiresFollowUp:y.requiresFollowUp,agentExecutionContext:{...t.agentExecutionContext,assignedTask:y.assignedTask??""}};if(_==="none"){let x=`I could not find an agent that can handle that request. I have access to the following agents: ${s.map(({agent:$})=>$.name).join(", ")}.
40
40
 
41
41
  Please ask a question that can be answered by one of these agents.`;return await et({text:"LLM did not identify a clear intent."},e),{...t,currentIntent:_,requiresFollowUp:!1,finalOutputMessage:x,agentExecutionContext:{...t.agentExecutionContext,assignedTask:"",messages:[...t.agentExecutionContext.messages,new ae(x)],priorSteps:[...t.agentExecutionContext.priorSteps??[],{agentId:"no-intent-router",assignedTask:t.agentExecutionContext.userRequest,summary:"No matching agent found; asked user to rephrase.",status:"failed"}]}}}return await et({text:`Agent picked: ${_}
42
42
  Task Assigned: ${y.assignedTask??""}
@@ -1,3 +1,3 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./IW43UAIS.js";import{a as I}from"./434TAA3J.js";import{a as E}from"./PBTINZTK.js";import a from"./I76F57I2.js";import{a as D}from"./E2HENO3T.js";import"./QSA4T3BU.js";import{a as R}from"./5W7S2RS4.js";import"./NXKKG5TK.js";import{g as $,h as c,k as C,l as P,n as d,t as _,u as y,v as T,x as k,z as A}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([N,{whenOnce:U,watch:B,when:V},j,q,,,H,{property:m,subclass:F},,{b:L}])=>{var G=$`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;function S(o){return o.trim()?E.lexer(o).filter(t=>t.type!=="space").map(t=>E.parser([t])):[]}var f=class{constructor(){this._stableParts=[],this._stableText="",this._rawText=""}push(t){return this._rawText+=t,this._advanceStableBoundary(),this.getParts()}finalize(){let t=this._rawText.slice(this._stableText.length);return t.trim()&&(this._stableParts.push(...S(t)),this._stableText=this._rawText),this._stableParts}getParts(){let t=this._trimIncompleteTail(this._rawText.slice(this._stableText.length)),s=t.trim()?S(t):[];return[...this._stableParts,...s]}reset(){this._stableParts=[],this._stableText="",this._rawText=""}_advanceStableBoundary(){let t=this._rawText.slice(this._stableText.length),s=this._lastSafeBoundary(t);if(s<=0)return;let i=t.slice(0,s);this._stableParts.push(...S(i)),this._stableText+=i}_lastSafeBoundary(t){let s=t.split(`
2
+ import b from"./E7TMP4YV.js";import{a as I}from"./434TAA3J.js";import{a as E}from"./PBTINZTK.js";import a from"./EBRNMPPO.js";import{a as D}from"./E2HENO3T.js";import"./QSA4T3BU.js";import{a as R}from"./5W7S2RS4.js";import"./NXKKG5TK.js";import{g as $,h as c,k as C,l as P,n as d,t as _,u as y,v as T,x as k,z as A}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([N,{whenOnce:U,watch:B,when:V},j,q,,,H,{property:m,subclass:F},,{b:L}])=>{var G=$`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;function S(o){return o.trim()?E.lexer(o).filter(t=>t.type!=="space").map(t=>E.parser([t])):[]}var f=class{constructor(){this._stableParts=[],this._stableText="",this._rawText=""}push(t){return this._rawText+=t,this._advanceStableBoundary(),this.getParts()}finalize(){let t=this._rawText.slice(this._stableText.length);return t.trim()&&(this._stableParts.push(...S(t)),this._stableText=this._rawText),this._stableParts}getParts(){let t=this._trimIncompleteTail(this._rawText.slice(this._stableText.length)),s=t.trim()?S(t):[];return[...this._stableParts,...s]}reset(){this._stableParts=[],this._stableText="",this._rawText=""}_advanceStableBoundary(){let t=this._rawText.slice(this._stableText.length),s=this._lastSafeBoundary(t);if(s<=0)return;let i=t.slice(0,s);this._stableParts.push(...S(i)),this._stableText+=i}_lastSafeBoundary(t){let s=t.split(`
3
3
  `),i=!1,e=0,n=0;for(let r of s)/^\s*(```|~~~)/u.test(r)&&(i=!i),n+=r.length+1,r.trim()===""&&!i&&(e=n);return e<t.length?e:0}_trimIncompleteTail(t){let s=t.lastIndexOf("<");if(s!==-1&&!t.includes(">",s))return t.slice(0,s);let i=this._earliestUnclosedTag(t);if(i!==-1)return t.slice(0,i);let e=t.lastIndexOf("[");if(e!==-1){let n=t.slice(e);if(!/\[[^\]]*\]\([^)]*\)/u.test(n))return t.slice(0,e)}return t}_earliestUnclosedTag(t){let s=new Set(["br","img","hr","input","meta","link","area","base","col","embed","source","track","wbr"]),i=/<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu,e=[];for(let n=i.exec(t);n;n=i.exec(t)){let[,r,a,l]=n,h=a.toLowerCase();if(!(s.has(h)||l==="/"))if(r==="/"){for(let g=e.length-1;g>=0;g--)if(e[g].name===h){e.splice(g);break}}else e.push({name:h,index:n.index})}return e.length?e[0].index:-1}};function W(o){let t=new f;return t.push(o),t.finalize()}var Y=async o=>await new Promise(t=>setTimeout(t,o));async function*Z(o,{chunkSize:t=15,delay:s=50}={}){let i=new f;for(let e=0;e<o.length;e+=t)yield i.push(o.slice(e,e+t)),await Y(s);yield i.finalize()}var J=Object.defineProperty,K=Object.getOwnPropertyDescriptor,u=(o,t,s,i)=>{for(var e=i>1?void 0:i?K(t,s):t,n=o.length-1,r;n>=0;n--)(r=o[n])&&(e=(i?r(t,s,e):r(e))||e);return i&&e&&J(t,s,e),e},O=o=>!o||typeof o!="object"?!1:o.name==="AbortError";async function*z(o,t,s,i,e=!1){if(e){if(i?.aborted){yield{type:"cancelled",log:s,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:W(o)},runId:t};return}for await(let n of Z(o)){if(i?.aborted){yield{type:"cancelled",log:s,runId:t};return}yield{type:"block-data",blockType:"text",data:{parts:n},runId:t}}}var p=class extends H{constructor(o){super(o),this.view=null,this.streamingDisabled=!1,this.loading=!1,this.processing=!1,this.processingStep=""}async load(){this._set("loading",!0);try{await this._initialize()}finally{this._set("loading",!1)}}destroy(){this.orchestrator?.dispose(),super.destroy()}async _initialize(){this.removeHandles(),await Promise.all([this.portal.load(),this.view?.when()]),this.view&&await U(()=>!this.view.updating),this._set("orchestrator",await L.init({agents:[...this.agents],view:this.view??void 0})),this.addHandles([B(()=>[this.view,this.agents],()=>{this._initialize()})])}clearChatHistory(){this.orchestrator?.newConversation()}async*ask(o,t){if(!this.orchestrator)throw new Error("Orchestrator not initialized yet.");this._set("processing",!0),this._set("processingStep","");let s=[],i,e="pending";try{let n=this.orchestrator.ask(o);for await(let r of n)switch(e=r.runId,r.type){case"trace":{this._set("processingStep",r.data.text),s.push(r.data.text);break}case"completed":{this._set("processing",!1),this._set("processingStep","");let a=r.result,l=!!a.content.length,h=!!i?.length;if(!l&&!h){yield{type:"completed",error:"No response received.",log:s,runId:e};return}let g=a.content;if(yield{type:"block-start",blockType:"text",runId:e},yield*z(g,e,s,t,this.streamingDisabled),yield{type:"block-end",blockType:"text",runId:e},h)for(let v of i){if(t?.aborted){yield{type:"cancelled",log:s,runId:e};return}let{type:b,data:w}=v;if(yield{type:"block-start",blockType:b,runId:e},b==="text"){let M=typeof w?.content=="string"?w.content:"";yield*z(M,e,s,t,this.streamingDisabled)}else yield{type:"block-data",blockType:b,data:w,runId:e};yield{type:"block-end",blockType:b,runId:e}}yield{type:"completed",response:g,blocks:i,log:s,runId:e};return}case"ux-suggestion":{let a=r.suggestion;i=i?[...i,a]:[a];break}case"interrupt":{let{kind:a,message:l,metadata:h}=r.interrupt,g=Array.isArray(h)?h.filter(b=>typeof b=="string"):[],v=(()=>{switch(a){case"booleanChoice":return{type:"boolean-choice",message:l,options:g};case"singleSelection":return{type:"single-select",message:l,options:g};case"multipleSelection":return{type:"multi-select",message:l,options:g};case"textInput":return{type:"text-input",message:l};default:return{type:a,message:l,options:g}}})();this._set("processingStep","Waiting for user input..."),yield{type:"interrupt",payload:v,runId:e};break}case"cancelled":{yield{type:"cancelled",log:s,runId:e};return}case"error":{if(t?.aborted||O(r.error)){yield{type:"cancelled",log:s,runId:e};return}yield{type:"completed",error:r.error.message,log:s,runId:e};return}default:{console.warn("Unknown event type:",r);break}}}catch(n){if(t?.aborted||O(n)){yield{type:"cancelled",log:s,runId:e};return}console.warn("Error during message processing:",n),yield{type:"completed",error:"An error occurred during message processing.",log:s,runId:"error"};return}finally{this._set("processing",!1)}}cancel(){this.orchestrator?.cancel()}};u([m({readOnly:!0})],p.prototype,"orchestrator",2);u([m()],p.prototype,"agents",2);u([m()],p.prototype,"portal",2);u([m()],p.prototype,"view",2);u([m()],p.prototype,"streamingDisabled",2);u([m({readOnly:!0})],p.prototype,"loading",2);u([m({readOnly:!0})],p.prototype,"processing",2);u([m({readOnly:!0})],p.prototype,"processingStep",2);p=u([F("OrchestratorController")],p);var Q="Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.",X="Embeddings not found for this web map.",tt="https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings",x=class extends T{constructor(){super(...arguments),this._messages=D({blocking:!0}),this.#t=_(),this.#l=_(),this.#s=_(),this.#e=null,this.#r=new Map,this.#i=j.getDefault(),this.#a=t=>{t.stopPropagation(),this.cancelInterrupt()},this.#n=t=>{t.stopPropagation();let s=t.detail;this.submitInterrupt(s)},this.#c=t=>{t.stopPropagation(),this.keepSuggestedPrompts||(this.suggestedPrompts=[]);let s=t.detail;this._inputValue="",this.arcgisSubmit.emit(s),this.submitMessage(s)},this.#h=t=>{if(this._canceling=!0,t.stopPropagation(),this.arcgisCancel.emit(),this._interrupt){this.orchestrator?.cancelInterrupt(),this._interrupt=null;return}this._orchestratorController?.cancel(),this.#e?.abort(),this.#e=null},this.#g=t=>{t.stopPropagation();let s=t.detail;this.arcgisFeedback.emit(s)},this.#d=t=>{t.stopPropagation();let s=t.detail;this._inputValue=s.prompt,this.arcgisPromptSelect.emit(s)},this.#p=t=>{this.arcgisSlottableRequest.emit(t.detail)},this._orchestratorController=null,this._interrupt=null,this._interruptDetails=[],this._error=null,this._inputValue="",this._isAnswering=!1,this._canceling=!1,this.messages=new N([]),this.referenceElement=null,this.suggestedPrompts=[],this.feedbackEnabled=!1,this.keepSuggestedPrompts=!1,this.streamingDisabled=!1,this.logEnabled=!1,this.copyEnabled=!1,this.voiceInputEnabled=!1,this.readAloudEnabled=!1,this.assistantAvatarEnabled=!1,this.arcgisCancel=d(),this.arcgisError=d(),this.arcgisFeedback=d(),this.arcgisInterrupt=d(),this.arcgisInterruptCancel=d(),this.arcgisInterruptSubmit=d(),this.arcgisPromptSelect=d(),this.arcgisReady=d(),this.arcgisSubmit=d(),this.arcgisSlottableRequest=d({bubbles:!1,composed:!1}),this.arcgisResponse=d()}static{this.properties={_orchestratorController:16,_interrupt:16,_interruptDetails:16,_error:16,_inputValue:16,_isAnswering:16,_signedInUserId:16,_canceling:16,_isSignedIn:16,_user:16,awaitingResponse:32,awaitingResponseStep:32,interrupt:32,messages:0,orchestrator:32,entryMessage:1,heading:1,description:1,referenceElement:1,suggestedPrompts:0,feedbackEnabled:5,keepSuggestedPrompts:5,streamingDisabled:5,logEnabled:5,copyEnabled:5,voiceInputEnabled:5,readAloudEnabled:5,assistantAvatarEnabled:5}}static{this.styles=G}#t;#l;#s;#e;#r;#i;#a;#n;#c;#h;#g;#d;#p;async#o(){try{let t=R(this.el,this.referenceElement);await t?.componentOnReady();let s=[...this.#r.values()];return s.length?(this._orchestratorController?.destroy(),this._orchestratorController=new p({agents:s,portal:this.#i,streamingDisabled:this.streamingDisabled,view:t?.view}),await this._orchestratorController.load(),!0):(this._error="No agents found.",!1)}catch(t){return this._error=t?.message??"Error initializing orchestrator.",P(this)(t),!1}}get _isSignedIn(){return!!this.#i?.user||!!this._signedInUserId}get _user(){return this.#i?.user?.fullName||this.#i?.user?.username}get awaitingResponse(){return this._orchestratorController?.processing??!1}get awaitingResponseStep(){return this._orchestratorController?.processingStep??""}get interrupt(){return this._interrupt}get orchestrator(){return this._orchestratorController?.orchestrator}async clearChatHistory(){this._reset(),this._orchestratorController?.clearChatHistory()}cancelInterrupt(){this.arcgisInterruptCancel.emit(),this.orchestrator?.cancelInterrupt(),this._interrupt=null}register(t){this.#r.set(t.agent.id,t),this._orchestratorController&&this.#o()}unregister(t){this.#r.delete(t),this._orchestratorController&&this.#o()}async submitMessage(t){let s=t.trim();if(!s||(this.messages.push({id:Date.now().toString(),role:"user",content:s}),!this._orchestratorController))return;this.#e=new AbortController,this._orchestratorController.streamingDisabled=this.streamingDisabled;let i=this._orchestratorController.ask(s,this.#e?.signal);for await(let e of i){let n=e.runId,r=this.messages.at(-1);switch(e.type){case"block-start":{this._isAnswering=!0;let a={type:e.blockType,isPending:!0};if(r?.role==="assistant"&&r.id===n){let l=[...r.blocks??[],a];this.messages.splice(-1,1,{...r,blocks:l})}else this.messages.push({role:"assistant",blocks:[a],id:n,isStreaming:!0,interrupts:this._interruptDetails}),this._interruptDetails=[];break}case"block-data":{if(r?.role!=="assistant"||r?.id!==n)break;let a=[...r.blocks??[]],l=a[a.length-1],{blockType:h,data:g}=e;if(l?.type!==h||!l.isPending)break;h==="text"?a[a.length-1]={...l,data:{...l.data,parts:g?.parts}}:a[a.length-1]={...l,data:{...l.data,...g??{}}},this.messages.splice(-1,1,{...r,blocks:a});break}case"block-end":{if(r?.role!=="assistant"||r?.id!==n)break;let a=[...r.blocks??[]],l=a[a.length-1];if(l?.type!==e.blockType||!l.isPending)break;let h=l;a[a.length-1]={...h,data:{...h.data},isPending:!1},this.messages.splice(-1,1,{...r,blocks:a});break}case"completed":e.error?(this.messages.push({role:"assistant",log:e.log,error:e.error,id:n,interrupts:this._interruptDetails}),this._interruptDetails=[]):r?.role==="assistant"&&r.id===n&&this.messages.splice(-1,1,{...r,content:e.response,blocks:r.blocks?.map(a=>({...a,data:{...a.data},isPending:!1}))??[],isStreaming:!1,log:e.log}),this._isAnswering=!1,this.#e=null,this._canceling=!1;break;case"interrupt":this._interrupt={...e.payload,id:n},this.arcgisInterrupt.emit(this._interrupt);break;case"cancelled":r?.role==="assistant"&&r.id===n?this.messages.splice(-1,1,{...r,blocks:r.blocks?.filter(a=>a.type==="text"||!a.isPending)??[],isStreaming:!1,log:e.log,error:"(Stopped by user)"}):(this.messages.push({role:"assistant",log:e.log,error:"(Stopped by user)",id:n,interrupts:this._interruptDetails}),this._interruptDetails=[]),this._isAnswering=!1,this.#e=null,this._canceling=!1;break}}}submitInterrupt(t){this.arcgisInterruptSubmit.emit(t),this._interrupt&&(this._interruptDetails=[...this._interruptDetails,{interrupt:this._interrupt,response:t}]),this.orchestrator?.resumeInterrupt(t),this._interrupt=null}load(){this.manager.onLifecycle(this._reset.bind(this))}loaded(){this.manager.onLifecycle(()=>{this.#t.value?.addEventListener("arcgisPromptSelect",this.#d),this.#t.value?.addEventListener("arcgisSubmit",this.#c),this.#t.value?.addEventListener("arcgisCancel",this.#h),this.#t.value?.addEventListener("arcgisFeedback",this.#g);let t=V(()=>!!this._interrupt&&!!this.#s.value,()=>{let i=this.#s.value;i.removeEventListener("arcgisSubmit",this.#n),i.removeEventListener("arcgisCancel",this.#a),i.addEventListener("arcgisSubmit",this.#n,{once:!0}),i.addEventListener("arcgisCancel",this.#a,{once:!0})}),s=this.messages.on("after-add",i=>{let e=i.item;e.role==="assistant"&&(e.error||e.content)&&this.arcgisResponse.emit(e)});return queueMicrotask(()=>{this.#o().then(i=>{i?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))})}),()=>{t.remove(),s.remove(),this.#t.value?.removeEventListener("arcgisPromptSelect",this.#d),this.#s.value?.removeEventListener("arcgisSubmit",this.#n),this.#s.value?.removeEventListener("arcgisCancel",this.#a),this.#t.value?.removeEventListener("arcgisSubmit",this.#c),this.#t.value?.removeEventListener("arcgisCancel",this.#h),this.#t.value?.removeEventListener("arcgisFeedback",this.#g),this._orchestratorController?.destroy(),this._orchestratorController=null}})}_reset(){this._orchestratorController?.cancel(),this.#e?.abort(),this._interrupt=null,this.messages.removeAll(),this._error=null,this._inputValue="",this._signedInUserId=void 0}_renderEntryMessage(){return this._isSignedIn?this._error?this._renderErrorNotice():this.entryMessage?this.messages.length>0?null:c`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>`:c`<slot name=entry-message></slot>`:this._renderSignInNotice()}_renderSignInNotice(){let t=this.#i;return c`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>You need to sign in to use the assistant chat.</div>${t?c`<calcite-link slot=link @click=${async()=>{try{let s=await q.getCredential(`${t.url}/sharing`);this._signedInUserId=s.userId,this._error=null,this.requestUpdate(),await this.#o()?this.arcgisReady.emit():this._error&&this.arcgisError.emit(new Error(this._error))}catch(s){this._error=s?.message??"Error signing in.",this.arcgisError.emit(new Error(this._error)),C("error",this,"Error signing in:",{detail:{error:s}})}}} target=_blank title="Sign in to ArcGIS Online">Sign in</calcite-link>`:c`<div slot=link>No portal information available</div>`}</calcite-notice>`}_renderErrorNotice(){return this._error?c`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error===Q?c`<div slot=message>${X}</div><calcite-link slot=link .href=${tt} target=_blank title="Learn about web map embeddings">Read more</calcite-link>`:c`<div slot=message>${this._error}</div>`}</calcite-notice>`:null}render(){return c`<calcite-panel .loading=${!this._orchestratorController&&!this._error||this._orchestratorController?.loading} .heading=${this.heading??this._messages.assistantLabel} .description=${this.description} ${y(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map(t=>t.role==="assistant"?c`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#p} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((s,i)=>c`<slot name=${I(t.id,i)??k} slot=${I(t.id,i)??k}><arcgis-assistant-message-block .block=${s}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>`:c`<arcgis-assistant-user-message .message=${t} .user=${this._user}></arcgis-assistant-user-message>`)}</slot>${this._interrupt?c`<div slot=message-loading><div class="interrupt-waiting-message">waiting for user input...</div></div>`:c`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt?c`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${y(this.#s)}></arcgis-assistant-interrupt></slot>`:this.suggestedPrompts?.length?c`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>`:null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse||this._isAnswering} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling||!this._isSignedIn||!!this._interrupt} ${y(this.#l)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse||this._isAnswering?"circle-stop":"send"} @click=${()=>{this.#l.value?.submitMessage()}} round>${this.awaitingResponse||this._isAnswering?this._messages.stopButtonLabel:this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`}};A("arcgis-assistant",x);return x},"core/Collection","core/reactiveUtils","portal/Portal","identity/IdentityManager","config","layers/FeatureLayer","core/Accessor","core/accessorSupport/decorators",a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import d from"./ETD76QRC.js";import c from"./HOCTVCHH.js";import b from"./IDZTJLVN.js";import a from"./I76F57I2.js";import{a as s,c as e}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as i,z as r}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.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-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-layer-styling-agent"),this.#i=e(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-layer-styling-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c,d)
2
+ import d from"./XGS5EIA5.js";import c from"./HOCTVCHH.js";import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.js";import{a as s,c as e}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as i,z as r}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.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-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=s(this,"arcgis-assistant-layer-styling-agent"),this.#i=e(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-layer-styling-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c,d)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./I76F57I2.js";import{a as T,b as S}from"./4RZPOYZ7.js";import{_ as w,ea as Ee,g as Se,j as Q,k as B,pa as L,u as xe}from"./CJIV4KJZ.js";import{L as z,P as oe,_ as j,wc as f}from"./IKEF7ZHH.js";import{a as s}from"./WNS5ZUF5.js";import{Dd as I}from"./ZEYIBYSF.js";export default $arcgis.t(([Ae,M,ie,Le,,Ce,ot,{addressToLocations:at},nt,it,De,{createRenderer:st},{getSchemesByTag:lt,getSchemes:ct},{getBackgroundColorTheme:Re},{createAgeRenderer:ut,createContinuousRenderer:dt},{getSchemesByTag:we},{createContinuousRenderer:pt},{createRenderer:mt},{getSchemesByTag:ht},{createRenderer:ft},{getSchemesByTag:yt},{createRenderer:gt},{getSchemesByTag:wt},{createRenderer:bt},{getSchemesByTag:vt},{createAgeRenderer:Tt,createContinuousRenderer:St},{createRenderer:xt},{getSchemesByTag:Et},It,Oe,Pe,{formatDateOnly:Nt,convertDateFormatToIntlOptions:K,formatTimeOnly:$t,formatDate:qe},kt,Ft,Mt,At,Ct,Ge,,{fetchKnowledgeGraph:_e,executeQueryStreaming:Rt,executeSearchStreaming:qt},_t,{b:D,c:Ie,q:Ne}])=>{var Me=e=>Array.isArray(e)&&e.every(z),Xe=e=>typeof e=="object"&&e!=null&&"messages"in e&&Me(e.messages),et=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,U=class extends Ee{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(n,l)=>this.run(n,l)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t){let r=this.tools.find(o=>o.name===e.name);try{if(r===void 0)throw new Error(`Tool "${e.name}" not found.`);let o=await r.invoke({...e,type:"tool_call"},t);return z(o)&&o.getType()==="tool"||B(o)?o:new oe({status:"success",name:r.name,content:typeof o=="string"?o:JSON.stringify(o),tool_call_id:e.id})}catch(o){if(!this.handleToolErrors||xe(o))throw o;return new oe({status:"error",content:`Error: ${o.message}
2
+ import a from"./EBRNMPPO.js";import{a as T,b as S}from"./4RZPOYZ7.js";import{_ as w,ea as Ee,g as Se,j as Q,k as B,pa as L,u as xe}from"./CJIV4KJZ.js";import{L as z,P as oe,_ as j,wc as f}from"./IKEF7ZHH.js";import{a as s}from"./WNS5ZUF5.js";import{Dd as I}from"./ZEYIBYSF.js";export default $arcgis.t(([Ae,M,ie,Le,,Ce,ot,{addressToLocations:at},nt,it,De,{createRenderer:st},{getSchemesByTag:lt,getSchemes:ct},{getBackgroundColorTheme:Re},{createAgeRenderer:ut,createContinuousRenderer:dt},{getSchemesByTag:we},{createContinuousRenderer:pt},{createRenderer:mt},{getSchemesByTag:ht},{createRenderer:ft},{getSchemesByTag:yt},{createRenderer:gt},{getSchemesByTag:wt},{createRenderer:bt},{getSchemesByTag:vt},{createAgeRenderer:Tt,createContinuousRenderer:St},{createRenderer:xt},{getSchemesByTag:Et},It,Oe,Pe,{formatDateOnly:Nt,convertDateFormatToIntlOptions:K,formatTimeOnly:$t,formatDate:qe},kt,Ft,Mt,At,Ct,Ge,,{fetchKnowledgeGraph:_e,executeQueryStreaming:Rt,executeSearchStreaming:qt},_t,{b:D,c:Ie,q:Ne}])=>{var Me=e=>Array.isArray(e)&&e.every(z),Xe=e=>typeof e=="object"&&e!=null&&"messages"in e&&Me(e.messages),et=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,U=class extends Ee{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(n,l)=>this.run(n,l)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t){let r=this.tools.find(o=>o.name===e.name);try{if(r===void 0)throw new Error(`Tool "${e.name}" not found.`);let o=await r.invoke({...e,type:"tool_call"},t);return z(o)&&o.getType()==="tool"||B(o)?o:new oe({status:"success",name:r.name,content:typeof o=="string"?o:JSON.stringify(o),tool_call_id:e.id})}catch(o){if(!this.handleToolErrors||xe(o))throw o;return new oe({status:"error",content:`Error: ${o.message}
3
3
  Please fix your mistakes.`,name:e.name,tool_call_id:e.id??""})}}async run(e,t){let r;if(et(e))r=[await this.runTool(e.lg_tool_call,t)];else{let n;if(Me(e))n=e;else if(Xe(e))n=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let l=new Set(n.filter(c=>c.getType()==="tool").map(c=>c.tool_call_id)),i;for(let c=n.length-1;c>=0;c-=1){let u=n[c];if(j(u)){i=u;break}}if(i==null||!j(i))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(i.tool_calls?.filter(c=>c.id==null||!l.has(c.id)).map(c=>this.runTool(c,t))??[])}if(!r.some(B))return Array.isArray(e)?r:{messages:r};let o=[],a=null;for(let n of r)B(n)?n.graph===Q.PARENT&&Array.isArray(n.goto)&&n.goto.every(l=>Se(l))?a?a.goto.push(...n.goto):a=new Q({graph:Q.PARENT,goto:n.goto}):o.push(n):o.push(Array.isArray(e)?[n]:{messages:[n]});return a&&o.push(a),o}};var An=w.Root({llmInputMessages:w({reducer:(e,t)=>L([],t),default:()=>[]})});var O=(e,t)=>t??e,Oi=w.Root({...Ie(),intent:w({reducer:O}),vectorSearchLayerResults:w({reducer:O,default:()=>[]}),vectorSearchFieldResults:w({reducer:O}),navigationInternalState:w({reducer:O,default:()=>({toolCallMessage:void 0})})});async function zt(e,t){let r=M.getDefault().helperServices,o=r.geocode.find(d=>d.name==="ArcGIS World Geocoding Service")??r.geocode[0];if(!o)throw new Error("No geocoding service found in helperServices.");let a=o.url,n=`${ie.assetsPath?.endsWith("/")?ie.assetsPath:`${ie.assetsPath}/`}esri/images/search/search-symbol-32.png`,l=(await at(a,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!l?.extent||!l.location)throw new Error(`Could not find location for: ${e}`);let i=new nt({url:n,width:24,height:24}),c=new ot({geometry:l.location,symbol:i});t.graphics.removeAll(),t.graphics.add(c),await t.goTo(l.extent);let u={address:l.address??"",location:l.location?l.location.toJSON():null,extent:l.extent?l.extent.toJSON():null};return{text:`Successfully zoomed to ${e}.`,sharedStatePatch:{lastResolvedLocation:{value:u}}}}var jt=["mapView"];function N(e){let t=e?.configurable?.context;if(!t||typeof t!="object")throw new Error("NavigationAgent context missing");let r=jt.filter(o=>!(o in t));if(r.length)throw new Error(`NavigationAgent context missing: ${r.join(", ")}`);return t}async function Lt({address:e},t){let{mapView:r}=N(t);return await zt(e,r)}var Dt=s.object({address:s.string().describe("The full address or place name to locate.")}),Pi=f(Lt,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:Dt});async function Ot(e,t){let r=t.map.bookmarks;if(!r||r.length===0)throw new Error("No bookmarks found in the map.");let o=r.find(n=>n.name===e);if(!o)throw new Error(`Bookmark with name "${e}" not found.`);let a=o.viewpoint;if(!a)throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);return await t.goTo(a),{text:`Navigated to bookmark: ${e}`}}async function Pt({bookmarkName:e},t){let{mapView:r}=N(t);return await Promise.resolve(Ot(e,r))}var Gt=I.object({bookmarkName:I.string().describe("The name of the bookmark to navigate to.")}),Gi=f(Pt,{name:"goToBookmark",description:"Go to the extent of the bookmark with the given name.",schema:Gt});async function Vt(e,t,r){let o=r.map?.allLayers.find(l=>l.id===e);if(!o)return{text:`Error: Layer with id ${e} not found`};let a=t?.trim()?t:"1=1",n=o.createQuery();n.where=a;try{let{extent:l,count:i}=await o.queryExtent(n);if(i===0)return{text:`No features found in ${o.title} matching: ${a}`,where:a};if(l)await r.goTo(l);else return{text:`Error: Unable to determine extent for ${o.title}`,where:a};let c={layerId:e,layerTitle:o.title??e,where:a,count:i};return{text:`Successfully zoomed to ${i} feature(s) in ${o.title} matching: ${a}`,where:a,sharedStatePatch:{lastNavigatedFeatures:{value:c}}}}catch(l){return console.error("Error in goToFeatures:",l),{text:`Error: ${l instanceof Error?l.message:"Unknown error"}`,where:a}}}async function Qt({layerId:e,where:t},r){let{mapView:o}=N(r);return await Vt(e,t,o)}var Bt=I.object({layerId:I.string().describe("The layerId of the layer to zoom to."),where:I.string().describe("The sql-92 where clause used to query features to zoom to")}),Vi=f(Qt,{name:"goToFeatures",description:"Go to the features that match the given filter related to the given layerId.",schema:Bt});async function Ut(e){let t=new it({xmin:-180,ymin:-90,xmax:180,ymax:90,spatialReference:{wkid:4326}}).expand(.7);return await e.goTo(t),{text:"Successfully zoomed to world extent"}}async function Kt(e,t){let{mapView:r}=N(t);return await Ut(r)}var Wt=I.object({}),Qi=f(Kt,{name:"goToFullExtent",description:"Zooms the map to the full world extent using Esri's Geocoding Service.",schema:Wt});async function Ht(e){let t=e.map.initialViewProperties?.viewpoint?.targetGeometry;if(t)await e.goTo(t);else throw new Error("Initial extent is undefined");return{text:"Successfully zoomed to home extent"}}async function Jt(e,t){let{mapView:r}=N(t);return await Ht(r)}var Zt=s.object({}),Bi=f(Jt,{name:"goToHomeExtent",description:"Go to the initial web map view extent",schema:Zt});async function Yt(e,t){await t.when();let r=t.map?.allLayers.find(a=>a.id===e);if(!r)return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`),{text:`Could not find layer for: ${e}`};let o;return(r.type==="link-chart"||r.type==="knowledge-graph-sublayer")&&t.map?.activeLinkChartLayer?o=t.map.diagramNodesExtent:o=r.fullExtent,o?(await t.goTo(o),r.visible=!0,{text:`Successfully zoomed to: ${r.title??""}`}):{text:"Layer has no defined extent. Cannot zoom to layer."}}async function Xt({layerId:e},t){let{mapView:r}=N(t);return await Yt(e,r)}var er=I.object({layerId:I.string().describe("The id of the layer to navigate to")}),Ui=f(Xt,{name:"goToLayer",description:"Zooms the map view to the full extent of the top matching layer.",schema:er});async function tr(e,t){return await t.goTo({scale:e}),{text:`Successfully zoomed to: ${e}`}}async function rr({scale:e},t){let{mapView:r}=N(t);return await tr(e,r)}var or=s.object({scale:s.number().describe("The map scale of the view to go to.")}),Ki=f(rr,{name:"goToScale",description:"Go to the specified view scale.",schema:or});async function ar(e,t,r){let o={target:new De({longitude:e.longitude,latitude:e.latitude,spatialReference:{wkid:4326}})};return r?.zoom!==void 0&&(o.zoom=r.zoom),r?.scale!==void 0&&(o.scale=r.scale),await t.goTo(o),{text:`Successfully navigated to: ${[`(${e.latitude}\xB0, ${e.longitude}\xB0)`,r?.zoom!==void 0?`zoom ${r.zoom}`:"",r?.scale!==void 0?`scale 1:${r.scale}`:""].filter(Boolean).join(", ")}`}}async function nr({center:e,zoom:t,scale:r},o){let{mapView:a}=N(o);return await ar(e,a,{zoom:t,scale:r})}var ir=s.object({center:s.object({longitude:s.number().describe("The longitude (x-coordinate) of the point to navigate to."),latitude:s.number().describe("The latitude (y-coordinate) of the point to navigate to.")}),zoom:s.number().optional().describe("The zoom level. Higher values = more zoomed in."),scale:s.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")}),Wi=f(nr,{name:"goToViewpoint",description:"Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",schema:ir});async function sr(e,t){return await t.goTo({zoom:e}),{text:`Successfully zoomed to: ${e}`}}async function lr({zoom:e},t){let{mapView:r}=N(t);return await sr(e,r)}var cr=s.object({zoom:s.number().min(1).max(20).describe("The zoom level of the view to go to.")}),Hi=f(lr,{name:"goToZoom",description:'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',schema:cr}),ze=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./KMQ3SP4I.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./5QAHYX7Y.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./5ZZGKP7N.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./AXDZBBNL.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./ZS2TZ6BF.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./LQ6R5YRN.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./TNMXWUXU.js").then(e=>e.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./T537PKP4.js").then(e=>e.default),"../agents/help/prompts/help_prompt.md":()=>import("./4I4MCV7V.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./FX7UOGHP.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./KTK4HNL2.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./6YMR4QSD.js").then(e=>e.default)});async function le(e){let t=Object.entries(ze).find(([r])=>r.endsWith(`/${e}.md`));if(!t)throw new Error(`Prompt not found: ${e}
4
4
  Available prompts:
5
5
  ${Object.keys(ze).join(`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as u,b as S,c as v}from"./LODKJRS4.js";import b from"./L77BTGXY.js";import{b as f,c as y}from"./CVHJMR5X.js";import a from"./I76F57I2.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import{c as d}from"./XVQJBUMY.js";import{b as c}from"./6LZ6GOHF.js";import{O as g,u as l}from"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,{watch:T},,,{property:m,subclass:_},{f:h},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(e,s,t,r)=>{for(var o=r>1?void 0:r?x(s,t):s,n=e.length-1,p;n>=0;n--)(p=e[n])&&(o=(r?p(s,t,o):p(o))||o);return r&&o&&k(s,t,o),o},i=class extends w{constructor(e){super(e),this.modelTier="default"}initialize(){this.addHandles(T(()=>[this.description,this.inputSchema,this.modelTier,this.name,this.outputSchema,this.prompt,this.tools],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let e=f(this.getSchemas());this._set("workspace",e);let s=this.id,t={[s]:this._invoke.bind(this)},r=[{from:s,decide:()=>{}}];this._set("createGraph",()=>y(t,r,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}async _invoke(e,s){try{return this.outputSchema?await this._invokeStructured(e,s):await this._invokeUnstructured(e,s)}catch(t){if(l(t))throw t;let r=t instanceof Error?t.message:String(t);return u({outputMessage:r},"failed",r)}}async _invokeStructured(e,s){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let t=await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:d(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:e.agentExecutionContext.messages},s);if(!("structuredResponse"in t)||t.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(t.structuredResponse,this.outputSchema,t.messages)}async _invokeUnstructured(e,s){let t=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:d(this.middlewares)}).invoke({messages:e.agentExecutionContext.messages},s)).messages,r=t.at(-1)?.content??"",o=typeof r=="string"?r:JSON.stringify(r),n=o.trim()||"LLMAgent completed.";return u({agentExecutionContext:{...e.agentExecutionContext,messages:t},outputMessage:o},"success",n)}async _getPromptWithInputVariables(e){let s=v(e,this.inputSchema);for(let{outputKey:t}of this.middlewares)t&&(s[String(t)]=e[t]);return await g.fromTemplate(this.prompt).format(s)}_getTools(){return this.tools?.map(e=>e.getTool())??[]}};a([m()],i.prototype,"prompt",2);a([m()],i.prototype,"tools",2);a([m()],i.prototype,"inputSchema",2);a([m()],i.prototype,"outputSchema",2);a([m()],i.prototype,"modelTier",2);i=a([_("LLMAgent")],i);return i},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","core/accessorSupport/decorators",a,b)
2
+ import{a as u,b as S,c as v}from"./LODKJRS4.js";import b from"./L77BTGXY.js";import{b as f,c as y}from"./CVHJMR5X.js";import a from"./EBRNMPPO.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import{c as d}from"./XVQJBUMY.js";import{b as c}from"./6LZ6GOHF.js";import{O as g,u as l}from"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.js";export default $arcgis.t(([,,{watch:T},,,{property:m,subclass:_},{f:h},w])=>{var k=Object.defineProperty,x=Object.getOwnPropertyDescriptor,a=(e,s,t,r)=>{for(var o=r>1?void 0:r?x(s,t):s,n=e.length-1,p;n>=0;n--)(p=e[n])&&(o=(r?p(s,t,o):p(o))||o);return r&&o&&k(s,t,o),o},i=class extends w{constructor(e){super(e),this.modelTier="default"}initialize(){this.addHandles(T(()=>[this.description,this.inputSchema,this.modelTier,this.name,this.outputSchema,this.prompt,this.tools],()=>{this.generate()},{initial:!0,sync:!0}))}getSchemas(){return[this.inputSchema,this.outputSchema].filter(Boolean)}generate(){let e=f(this.getSchemas());this._set("workspace",e);let s=this.id,t={[s]:this._invoke.bind(this)},r=[{from:s,decide:()=>{}}];this._set("createGraph",()=>y(t,r,e,{agent:this,entryNode:s,middlewares:this.middlewares}))}async _invoke(e,s){try{return this.outputSchema?await this._invokeStructured(e,s):await this._invokeUnstructured(e,s)}catch(t){if(l(t))throw t;let r=t instanceof Error?t.message:String(t);return u({outputMessage:r},"failed",r)}}async _invokeStructured(e,s){if(!this.outputSchema)throw new Error("Output schema is required for structured invocation.");let t=await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:d(this.middlewares),responseFormat:this.outputSchema}).invoke({messages:e.agentExecutionContext.messages},s);if(!("structuredResponse"in t)||t.structuredResponse===void 0)throw new Error("LLMAgent did not receive structured output from createAgent.");return S(t.structuredResponse,this.outputSchema,t.messages)}async _invokeUnstructured(e,s){let t=(await c({model:await h({modelTier:this.modelTier}),systemPrompt:await this._getPromptWithInputVariables(e),tools:this._getTools(),checkpointer:!0,middleware:d(this.middlewares)}).invoke({messages:e.agentExecutionContext.messages},s)).messages,r=t.at(-1)?.content??"",o=typeof r=="string"?r:JSON.stringify(r),n=o.trim()||"LLMAgent completed.";return u({agentExecutionContext:{...e.agentExecutionContext,messages:t},outputMessage:o},"success",n)}async _getPromptWithInputVariables(e){let s=v(e,this.inputSchema);for(let{outputKey:t}of this.middlewares)t&&(s[String(t)]=e[t]);return await g.fromTemplate(this.prompt).format(s)}_getTools(){return this.tools?.map(e=>e.getTool())??[]}};a([m()],i.prototype,"prompt",2);a([m()],i.prototype,"tools",2);a([m()],i.prototype,"inputSchema",2);a([m()],i.prototype,"outputSchema",2);a([m()],i.prototype,"modelTier",2);i=a([_("LLMAgent")],i);return i},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request","core/accessorSupport/decorators",a,b)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./IDZTJLVN.js";import a from"./I76F57I2.js";import{a as c,b as k}from"./4RZPOYZ7.js";import{a as w,b as d,j as y,ta as x}from"./CJIV4KJZ.js";import{Z as f}from"./IKEF7ZHH.js";export default $arcgis.t(([,,,,,,{p:_,r:b},{K:u,L:A,M:K,N:S,O:E,P:M,Q:C,R:T,S:G,T:N,U:R,a:v,m:g,n:h,p:q}])=>{var $=[M,C,N,T,E,R,G];async function L(e,o){let l=await g("arcgis_knowledge_tool_prompt"),a=A(o),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:a},s=await b({promptText:l,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:$}),r=(s.tool_calls?.length??0)>0,t=typeof s.text=="string"?s.text.trim():"",i=t.length>0,p=s.content.toString();return!r&&(a==="map"||a==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,s],outputMessage:a==="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,s],outputMessage:r?p:t,status:r?e.status:i?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var z={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 D(e){return!!e&&e.status==="success"&&!!z[e.toolName]}function F(e){return{type:z[e.toolName],data:e.details}}async function I(e,o){let l=new v($,{handleToolErrors:!1});try{let a=await l.invoke({messages:e.arcgisKnowledgeMessages},o),n=[];for(let t of a.messages){let i;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{i=JSON.parse(t.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name??"unknown"}.
2
+ import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.js";import{a as c,b as k}from"./4RZPOYZ7.js";import{a as w,b as d,j as y,ta as x}from"./CJIV4KJZ.js";import{Z as f}from"./IKEF7ZHH.js";export default $arcgis.t(([,,,,,,{p:_,r:b},{K:u,L:A,M:K,N:S,O:E,P:M,Q:C,R:T,S:G,T:N,U:R,a:v,m:g,n:h,p:q}])=>{var $=[M,C,N,T,E,R,G];async function L(e,o){let l=await g("arcgis_knowledge_tool_prompt"),a=A(o),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:a},s=await b({promptText:l,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:$}),r=(s.tool_calls?.length??0)>0,t=typeof s.text=="string"?s.text.trim():"",i=t.length>0,p=s.content.toString();return!r&&(a==="map"||a==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,s],outputMessage:a==="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,s],outputMessage:r?p:t,status:r?e.status:i?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var z={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 D(e){return!!e&&e.status==="success"&&!!z[e.toolName]}function F(e){return{type:z[e.toolName],data:e.details}}async function I(e,o){let l=new v($,{handleToolErrors:!1});try{let a=await l.invoke({messages:e.arcgisKnowledgeMessages},o),n=[];for(let t of a.messages){let i;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{i=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(!i||typeof i!="object"||!("toolName"in i))throw new Error(`Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(i)}`);n.push(i)}await c({text:`Finished executing ArcGIS Knowledge Agent tools: ${a.messages.filter(t=>t.name).map(t=>t.name).join(", ")}`},o);let s=n.filter(t=>typeof t!="string").map(t=>`- Called Tool: ${t.toolName}, Status: ${t.status}`),r=n[0];return r&&D(r)&&await k(F(r),o),{...e,outputMessage:s.join(`
5
5
  `),summary:s.length?h(s.join(`
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./IDZTJLVN.js";import a from"./I76F57I2.js";import{a as p}from"./4RZPOYZ7.js";import{a as u,b as i,ta as c}from"./CJIV4KJZ.js";export default $arcgis.t(([,,,,,,{r:g},{I:d,J:E,a:h,m:f,n:y,o:m,p:x}])=>{var S=[E],_=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:r,fieldRegistry:a},s)=>{let o=Array.from(a.values()).map(n=>n.name).slice(0,10).join(", "),l=a.size>10?` (and ${a.size-10} more)`:"";return`${s+1}. "${r.title}". Description: ${r.description}
2
+ import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.js";import{a as p}from"./4RZPOYZ7.js";import{a as u,b as i,ta as c}from"./CJIV4KJZ.js";export default $arcgis.t(([,,,,,,{r:g},{I:d,J:E,a:h,m:f,n:y,o:m,p:x}])=>{var S=[E],_=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:r,fieldRegistry:a},s)=>{let o=Array.from(a.values()).map(n=>n.name).slice(0,10).join(", "),l=a.size>10?` (and ${a.size-10} more)`:"";return`${s+1}. "${r.title}". Description: ${r.description}
3
3
  Fields: ${o}${l}`}).join(`
4
4
 
5
5
  `);return`This map contains ${e.size} layer(s):
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import k from"./K37GTMOF.js";import j from"./V6TM3MTN.js";import i from"./JBNITHPO.js";import f from"./ETD76QRC.js";import e from"./HOCTVCHH.js";import d from"./RNLQZV6U.js";import c from"./IDZTJLVN.js";import b from"./IW43UAIS.js";import a from"./I76F57I2.js";import"./ADYIXCSG.js";import{a as g,b as h}from"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.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)
2
+ import k from"./ROLXMEVE.js";import j from"./PDEBKVBO.js";import i from"./KTOL6IN7.js";import f from"./XGS5EIA5.js";import e from"./HOCTVCHH.js";import d from"./ASSH4WSC.js";import c from"./ICA7JOSU.js";import b from"./E7TMP4YV.js";import a from"./EBRNMPPO.js";import"./ADYIXCSG.js";import{a as g,b as h}from"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.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)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./HOCTVCHH.js";import b from"./IDZTJLVN.js";import a from"./I76F57I2.js";import{a as n}from"./4RZPOYZ7.js";import{a as I,b as S,ta as N}from"./CJIV4KJZ.js";import{Z as $}from"./IKEF7ZHH.js";export default $arcgis.t(([,,,,,,P,U,{p:k,r:T},{C:M,D:z,E:L,F:D,G:F,H:O,a:A,m:w,n:R,o:y,p:V},b])=>{var W=async(e,t)=>(await n({text:"Exiting Data Exploration agent"},t),e),B=async(e,t)=>{await n({text:"Requesting LLM for layer filter results"},t);let a=await w("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:d,userTimezoneOffset:o}=L(),s={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},i=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:s,tools:F}),r=[...e.dataExplorationMessages,i];if(!((i.tool_calls?.length??0)>0))return await n({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:r};let c=r,l=i.content.toString();return await b(i,t),{...e,dataExplorationMessages:c,outputMessage:l}},H=async(e,t)=>{await n({text:"Requesting LLM for layer query results"},t);let a=await w("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:d,userTimezoneOffset:o}=L(),s=e.agentExecutionContext.sharedState,i=s.lastNavigatedFeatures?.value,r=s.lastResolvedLocation?.value,c="none";if(i!=null)try{c=JSON.stringify(i)}catch{c="none"}let l="none";if(r!=null)try{l=JSON.stringify({address:r.address,location:r.location})}catch{l="none"}let g={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,lastNavigatedFeatures:c,lastResolvedLocation:l},m=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:g,tools:D}),h=(m.tool_calls?.length??0)>0,f=m.content.toString();return await b(m,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,m],...h?{}:{outputMessage:f},status:"success",summary:f&&!h?R(f):"Query planning completed."}},J=async(e,t)=>{try{await n({text:"Requesting LLM for summary on query results"},t);let a=await w("summarize_query_response_prompt"),d={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=await k({promptText:a,modelTier:"fast",config:t,messages:e.dataExplorationMessages,inputVariables:d}),s=typeof o=="string"?o:o.content,i=new $(s);await n({text:`Received response from LLM: ${s}`},t);let r=s;return{...e,outputMessage:r,status:"success",summary:r?R(r):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,i]}}catch(a){throw await n({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function K(e,t){if((e.queryResponse??[]).some(d=>{let o=d.details;return typeof o=="object"&&o!==null&&"error"in o}))return await n({text:"Skipping layer filter tool because query response contains an error."},t),{...e};let a=await new A(F,{handleToolErrors:!1}).invoke({messages:e.dataExplorationMessages},t);return await n({text:`Finished executing layer filter tool: ${a.messages.map(d=>d.content).join(", ")}`},t),{...e}}var X=10,Y=["string","small-integer","integer"],Z=async(e,t,{includeSummaryStatistics:a=!0,includeUniqueValues:d=!0}={})=>{let o=null,s=null;try{if(t.type!=="geometry"&&t.type!=="oid"&&t.type!=="global-id"){a&&(o=await P({layer:e,field:t.name}));let i=t.domain?.type==="coded-value"?t.domain:null;d&&(Y.includes(t.type)||i)&&(s=(await U({layer:e,field:t.name})).uniqueValueInfos.sort((r,c)=>c.count-r.count).slice(0,X),i&&(s=s.map(r=>({...r,value:i.getName(r.value)??r.value}))))}}catch(i){console.error(`Error fetching statistics for field ${t.name}:`,i)}return{summaryStatistics:o,uniqueValues:s}};function ee(e,t){return["string","small-integer","integer"].includes(e)||t==="coded-value"}async function te(e,t,a,d=!0){let o=[],s=[],i=[];for(let r of e){let c=function(p){let u=t.get(p)?.layerItem;return u?[u.name&&`Name: ${u.name}`,u.title&&`Title: ${u.title}`,u.description&&`Description: ${u.description}`].filter(Boolean).join(" | "):p},{layerId:l,results:g}=r,m=a.map?.allLayers.find(p=>p.id===l),h=t.get(l)?.fieldRegistry;if(!h)continue;let f=o.find(p=>p.layerId===l);f||(f={layerId:l,layerSummary:c(l),fieldInfos:[]},o.push(f));for(let p of g){let u=h.get(p.name);if(!u)continue;let x=u.statistics,v=d&&!x?.summaryStatistics,q=ee(u.type,u.domain?.type)&&!x?.uniqueValues,_=v||q;if(i.push({layerId:l,fieldName:u.name,didFetchStatistics:_}),_){let G=Z(m,u,{includeSummaryStatistics:v,includeUniqueValues:q}).then(C=>{let E={summaryStatistics:x?.summaryStatistics??null,uniqueValues:x?.uniqueValues??null};v&&(E.summaryStatistics=C.summaryStatistics),q&&(E.uniqueValues=C.uniqueValues),h.set(u.name,{...u,statistics:E}),u.statistics=E});s.push(G)}f.fieldInfos.push(u)}}return await Promise.all(s),{layerFieldInfo:o,didFetchStatistics:s.length>0,fieldStatisticsFetchStatus:i}}var j=/\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;function ae(e,t){return j.test(e)||j.test(t)}var se=async(e,t)=>{try{await n({text:"Preparing field information for vector search results"},t);let a=y(t,"layersAndFieldsRegistry"),{mapView:d}=z(t),{assignedTask:o,userRequest:s}=e.agentExecutionContext,i=ae(o,s),{layerFieldInfo:r,didFetchStatistics:c,fieldStatisticsFetchStatus:l}=await te(e.vectorSearchFieldResults,a,d,i);c?await n({text:"Statistics fetched"},t):await n({text:"Statistics skipped"},t);for(let g of l)await n({text:` - ${g.fieldName} - stats ${g.didFetchStatistics?"fetched":"skipped"}`},t);return await n({text:"Field information prepared"},t),{...e,layerFieldInfo:r}}catch(a){throw await n({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},Q=.7,re=10,ie=async(e,t)=>{try{await n({text:"Similarity search to find fields"},t);let a=y(t,"fieldSearch"),d=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),s=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:Q,topResults:re,embeddingCache:o}),i=s.map(({layerId:c,results:l})=>{let g=l.map(m=>` - ${m.name} (${m.score.toFixed(2)})`).join(`
2
+ import c from"./HOCTVCHH.js";import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.js";import{a as n}from"./4RZPOYZ7.js";import{a as I,b as S,ta as N}from"./CJIV4KJZ.js";import{Z as $}from"./IKEF7ZHH.js";export default $arcgis.t(([,,,,,,P,U,{p:k,r:T},{C:M,D:z,E:L,F:D,G:F,H:O,a:A,m:w,n:R,o:y,p:V},b])=>{var W=async(e,t)=>(await n({text:"Exiting Data Exploration agent"},t),e),B=async(e,t)=>{await n({text:"Requesting LLM for layer filter results"},t);let a=await w("data_explore_filter_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer filter tools");let{userTimezone:d,userTimezoneOffset:o}=L(),s={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},i=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:s,tools:F}),r=[...e.dataExplorationMessages,i];if(!((i.tool_calls?.length??0)>0))return await n({text:"LLM determined no filter changes needed"},t),{...e,dataExplorationMessages:r};let c=r,l=i.content.toString();return await b(i,t),{...e,dataExplorationMessages:c,outputMessage:l}},H=async(e,t)=>{await n({text:"Requesting LLM for layer query results"},t);let a=await w("data_explore_query_prompt");if(!t?.configurable)throw new Error("config.configurable is required for layer query tools");let{userTimezone:d,userTimezoneOffset:o}=L(),s=e.agentExecutionContext.sharedState,i=s.lastNavigatedFeatures?.value,r=s.lastResolvedLocation?.value,c="none";if(i!=null)try{c=JSON.stringify(i)}catch{c="none"}let l="none";if(r!=null)try{l=JSON.stringify({address:r.address,location:r.location})}catch{l="none"}let g={layerFieldInfo:e.layerFieldInfo,userTimezone:d,userTimezoneOffset:o,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,lastNavigatedFeatures:c,lastResolvedLocation:l},m=await T({promptText:a,modelTier:"advanced",config:t,messages:e.dataExplorationMessages,inputVariables:g,tools:D}),h=(m.tool_calls?.length??0)>0,f=m.content.toString();return await b(m,t),{...e,dataExplorationMessages:[...e.dataExplorationMessages,m],...h?{}:{outputMessage:f},status:"success",summary:f&&!h?R(f):"Query planning completed."}},J=async(e,t)=>{try{await n({text:"Requesting LLM for summary on query results"},t);let a=await w("summarize_query_response_prompt"),d={queryResponse:e.queryResponse,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=await k({promptText:a,modelTier:"fast",config:t,messages:e.dataExplorationMessages,inputVariables:d}),s=typeof o=="string"?o:o.content,i=new $(s);await n({text:`Received response from LLM: ${s}`},t);let r=s;return{...e,outputMessage:r,status:"success",summary:r?R(r):"Summary generated.",dataExplorationMessages:[...e.dataExplorationMessages,i]}}catch(a){throw await n({text:"Error during filter LLM request"},t),new Error(`Error during filter LLM request: ${a instanceof Error?a.message:String(a)}`)}};async function K(e,t){if((e.queryResponse??[]).some(d=>{let o=d.details;return typeof o=="object"&&o!==null&&"error"in o}))return await n({text:"Skipping layer filter tool because query response contains an error."},t),{...e};let a=await new A(F,{handleToolErrors:!1}).invoke({messages:e.dataExplorationMessages},t);return await n({text:`Finished executing layer filter tool: ${a.messages.map(d=>d.content).join(", ")}`},t),{...e}}var X=10,Y=["string","small-integer","integer"],Z=async(e,t,{includeSummaryStatistics:a=!0,includeUniqueValues:d=!0}={})=>{let o=null,s=null;try{if(t.type!=="geometry"&&t.type!=="oid"&&t.type!=="global-id"){a&&(o=await P({layer:e,field:t.name}));let i=t.domain?.type==="coded-value"?t.domain:null;d&&(Y.includes(t.type)||i)&&(s=(await U({layer:e,field:t.name})).uniqueValueInfos.sort((r,c)=>c.count-r.count).slice(0,X),i&&(s=s.map(r=>({...r,value:i.getName(r.value)??r.value}))))}}catch(i){console.error(`Error fetching statistics for field ${t.name}:`,i)}return{summaryStatistics:o,uniqueValues:s}};function ee(e,t){return["string","small-integer","integer"].includes(e)||t==="coded-value"}async function te(e,t,a,d=!0){let o=[],s=[],i=[];for(let r of e){let c=function(p){let u=t.get(p)?.layerItem;return u?[u.name&&`Name: ${u.name}`,u.title&&`Title: ${u.title}`,u.description&&`Description: ${u.description}`].filter(Boolean).join(" | "):p},{layerId:l,results:g}=r,m=a.map?.allLayers.find(p=>p.id===l),h=t.get(l)?.fieldRegistry;if(!h)continue;let f=o.find(p=>p.layerId===l);f||(f={layerId:l,layerSummary:c(l),fieldInfos:[]},o.push(f));for(let p of g){let u=h.get(p.name);if(!u)continue;let x=u.statistics,v=d&&!x?.summaryStatistics,q=ee(u.type,u.domain?.type)&&!x?.uniqueValues,_=v||q;if(i.push({layerId:l,fieldName:u.name,didFetchStatistics:_}),_){let G=Z(m,u,{includeSummaryStatistics:v,includeUniqueValues:q}).then(C=>{let E={summaryStatistics:x?.summaryStatistics??null,uniqueValues:x?.uniqueValues??null};v&&(E.summaryStatistics=C.summaryStatistics),q&&(E.uniqueValues=C.uniqueValues),h.set(u.name,{...u,statistics:E}),u.statistics=E});s.push(G)}f.fieldInfos.push(u)}}return await Promise.all(s),{layerFieldInfo:o,didFetchStatistics:s.length>0,fieldStatisticsFetchStatus:i}}var j=/\b(average|avg|mean|median|max(?:imum)?|min(?:imum)?|sum|total|count|std(?:dev|\s*deviation)|variance|null\s*count|missing\s*values?|range)\b/iu;function ae(e,t){return j.test(e)||j.test(t)}var se=async(e,t)=>{try{await n({text:"Preparing field information for vector search results"},t);let a=y(t,"layersAndFieldsRegistry"),{mapView:d}=z(t),{assignedTask:o,userRequest:s}=e.agentExecutionContext,i=ae(o,s),{layerFieldInfo:r,didFetchStatistics:c,fieldStatisticsFetchStatus:l}=await te(e.vectorSearchFieldResults,a,d,i);c?await n({text:"Statistics fetched"},t):await n({text:"Statistics skipped"},t);for(let g of l)await n({text:` - ${g.fieldName} - stats ${g.didFetchStatistics?"fetched":"skipped"}`},t);return await n({text:"Field information prepared"},t),{...e,layerFieldInfo:r}}catch(a){throw await n({text:"Error during fetching statistics"},t),new Error(`Error during fetching statistics: ${a instanceof Error?a.message:String(a)}`)}},Q=.7,re=10,ie=async(e,t)=>{try{await n({text:"Similarity search to find fields"},t);let a=y(t,"fieldSearch"),d=y(t,"layersAndFieldsRegistry"),o=y(t,"embeddingCache"),s=await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:e.vectorSearchLayerIds,minScore:Q,topResults:re,embeddingCache:o}),i=s.map(({layerId:c,results:l})=>{let g=l.map(m=>` - ${m.name} (${m.score.toFixed(2)})`).join(`
3
3
  `);return`${d.get(c)?.layerItem.name??c}:
4
4
  ${g}`}).join(`
5
5
  `),r;return s.length>0?r=`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 c from"./V6TM3MTN.js";import b from"./IDZTJLVN.js";import a from"./I76F57I2.js";import{a as s,c as e}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as i,z as r}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.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","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c)
2
+ import c from"./PDEBKVBO.js";import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.js";import{a as s,c as e}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as i,z as r}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.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","config","core/reactiveUtils","layers/FeatureLayer","request","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","views/LinkChartView","rest/knowledgeGraphService",a,b,c)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import e from"./K37GTMOF.js";import d from"./HOCTVCHH.js";import c from"./IDZTJLVN.js";import b from"./I76F57I2.js";import{a,c as s}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as i,z as r}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.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-data-exploration-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=a(this,"arcgis-assistant-data-exploration-agent"),this.#i=s(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-data-exploration-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","views/LinkChartView","rest/knowledgeGraphService",b,c,d,e)
2
+ import e from"./ROLXMEVE.js";import d from"./HOCTVCHH.js";import c from"./ICA7JOSU.js";import b from"./EBRNMPPO.js";import{a,c as s}from"./W2JAKE2M.js";import"./5W7S2RS4.js";import"./NXKKG5TK.js";import{v as i,z as r}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./4RZPOYZ7.js";import"./6LZ6GOHF.js";import"./CJIV4KJZ.js";import"./IKEF7ZHH.js";import"./WNS5ZUF5.js";import"./ZEYIBYSF.js";import"./YIMNOUTF.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-data-exploration-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=a(this,"arcgis-assistant-data-exploration-agent"),this.#i=s(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-data-exploration-agent",t);return t},"identity/IdentityManager","portal/Portal","config","core/reactiveUtils","layers/FeatureLayer","request","views/LinkChartView","rest/knowledgeGraphService",b,c,d,e)
@@ -99,7 +99,7 @@ Do not reinterpret the request into a different form.
99
99
 
100
100
  ## Follow-up Reference Resolution
101
101
 
102
- If the latest user request refers to prior results or prior context using a referential phrase such as "these", "those", "them", "that set", or "the previous results", then the request depends on earlier context.
102
+ If the latest user request refers to prior results or prior context using a referential phrase such as "these", "those", "them", "that set", "the previous results", "this", "it", "that one", "this parcel", "this location", or "that feature", then the request depends on earlier context.
103
103
 
104
104
  This also applies to equivalent referential wording in other languages.
105
105
 
@@ -107,7 +107,7 @@ Resolve the reference using the most recent relevant chat history or successful
107
107
 
108
108
  In this case, the \`assignedTask\` should be standalone and should preserve the referenced prior constraints while adding only the new constraint or question from the latest user request.
109
109
 
110
- Do not leave ambiguous references like "these", "those", or "them" in \`assignedTask\` when they can be resolved from context.
110
+ Do not leave ambiguous references like "these", "those", "them", "this", or "it" in \`assignedTask\` when they can be resolved from context.
111
111
 
112
112
  ---
113
113
 
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./HOCTVCHH.js";import b from"./IDZTJLVN.js";import a from"./I76F57I2.js";import{a as i}from"./4RZPOYZ7.js";import{a as u,b as p,q as f,ta as S}from"./CJIV4KJZ.js";export default $arcgis.t(([,,,,,,{r:x},{A:_,B:h,a:w,m:E,o:y,p:I,q:L,r:v,s:F,t:$,u:C,v:N,w:R,x:T,y:b,z:A},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await i({text:"Similarity search to find fields"},t);let e=y(t,"fieldSearch"),n=y(t,"layersAndFieldsRegistry"),o=y(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 g=c.map(s=>` - ${s.name} (${s.score.toFixed(2)})`).join(`
2
+ import c from"./HOCTVCHH.js";import b from"./ICA7JOSU.js";import a from"./EBRNMPPO.js";import{a as i}from"./4RZPOYZ7.js";import{a as u,b as p,q as f,ta as S}from"./CJIV4KJZ.js";export default $arcgis.t(([,,,,,,{r:x},{A:_,B:h,a:w,m:E,o:y,p:I,q:L,r:v,s:F,t:$,u:C,v:N,w:R,x:T,y:b,z:A},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await i({text:"Similarity search to find fields"},t);let e=y(t,"fieldSearch"),n=y(t,"layersAndFieldsRegistry"),o=y(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 g=c.map(s=>` - ${s.name} (${s.score.toFixed(2)})`).join(`
3
3
  `);return`${n.get(d)?.layerItem.name??d}:
4
4
  ${g}`}).join(`
5
5
  `),l;return r.length>0?l=`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"../YIMNOUTF.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("../Q7TL5Q5N.js");let t=await p;return d(t.z,n)}async function j(n,t){y??=import("../SLNLQG3A.js");let o=await y;return await(await r(o,"sendUXSuggestion"))(n,t)}async function q(n){e??=import("../2NMR43NW.js");let t=await e,o=await r(t,"FunctionAgent");return new o(n)}async function E(n){a??=import("../JEIMRNYM.js");let t=await a,o=await r(t,"FunctionTool");return new o(n)}async function F(n){i??=import("../T7CQZ27H.js");let t=await i,o=await r(t,"LLMAgent");return new o(n)}async function v(n){c??=import("../O3F47IO5.js");let t=await c,o=await r(t,"WorkflowAgent");return new o(n)}async function U(n){u??=import("../C7E7MJSR.js");let t=await u,o=await r(t,"ConditionalWorkflow");return new o(n)}async function M(n){s??=import("../SMADRJ67.js");let t=await s,o=await r(t,"LoopWorkflow");return new o(n)}async function P(n){w??=import("../O7TGCM5P.js");let t=await w,o=await r(t,"ParallelWorkflow");return new o(n)}async function R(n){l??=import("../CIW3QMKV.js");let t=await l,o=await r(t,"RouterWorkflow");return new o(n)}async function X(n){f??=import("../YYY7HKYX.js");let t=await f,o=await r(t,"SequentialWorkflow");return new o(n)}async function x(n){m??=import("../IC5P5NYY.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};
2
+ import"../YIMNOUTF.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("../Q7TL5Q5N.js");let t=await p;return d(t.z,n)}async function j(n,t){y??=import("../PDT6I6TZ.js");let o=await y;return await(await r(o,"sendUXSuggestion"))(n,t)}async function q(n){e??=import("../2NMR43NW.js");let t=await e,o=await r(t,"FunctionAgent");return new o(n)}async function E(n){a??=import("../JEIMRNYM.js");let t=await a,o=await r(t,"FunctionTool");return new o(n)}async function F(n){i??=import("../IXAKT6L3.js");let t=await i,o=await r(t,"LLMAgent");return new o(n)}async function v(n){c??=import("../O3F47IO5.js");let t=await c,o=await r(t,"WorkflowAgent");return new o(n)}async function U(n){u??=import("../C7E7MJSR.js");let t=await u,o=await r(t,"ConditionalWorkflow");return new o(n)}async function M(n){s??=import("../SMADRJ67.js");let t=await s,o=await r(t,"LoopWorkflow");return new o(n)}async function P(n){w??=import("../O7TGCM5P.js");let t=await w,o=await r(t,"ParallelWorkflow");return new o(n)}async function R(n){l??=import("../CIW3QMKV.js");let t=await l,o=await r(t,"RouterWorkflow");return new o(n)}async function X(n){f??=import("../YYY7HKYX.js");let t=await f,o=await r(t,"SequentialWorkflow");return new o(n)}async function x(n){m??=import("../IC5P5NYY.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"./MAV3DW27.js";import"./ADYIXCSG.js";import"./YIMNOUTF.js";var a=s(e,{"arcgis-assistant":[()=>import("./UNFG4ZJ5.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("./27NEUQN3.js"),"agent:,context:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./WQQRLD5F.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./LSNMNSYS.js"),"referenceElement;;getContext"],"arcgis-assistant-knowledge-agent":[()=>import("./XAI6OR2N.js"),"context:,referenceElement,serviceUrl;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./NNC3UYMR.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./FC2ZX3SS.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./5SBLS4NW.js"),"interrupt:,loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./M3SWPT3M.js"),"_messages:,awaitingResponse,disabled,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./PSWI3MFB.js"),"_messages:,message,options:,type"],"arcgis-assistant-interrupt-preview":[()=>import("./JN744CAW.js"),"interrupts:"],"arcgis-assistant-message":[()=>import("./CAECQD75.js"),"assistantAvatarEnabled,copyEnabled,feedbackEnabled,footerDisabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-block":[()=>import("./I64KIZG3.js"),"block:"],"arcgis-assistant-message-feedback":[()=>import("./FWU6DFIB.js"),"_messages:,feedbackEnabled,message:"],"arcgis-assistant-message-footer":[()=>import("./DEAYZ3MK.js"),"_messages:,copyEnabled,feedbackEnabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-loading":[()=>import("./ZPLFFLPF.js"),"assistantAvatarEnabled,interrupts:,loading,loadingMessage"],"arcgis-assistant-message-log":[()=>import("./NOJYPREL.js"),"log:,logEnabled,showLog"],"arcgis-assistant-message-read-aloud":[()=>import("./RMLXVQZ5.js"),"_messages:,message:,readAloudEnabled"],"arcgis-assistant-message-text":[()=>import("./IB4WTK74.js"),"content,parts:"],"arcgis-assistant-speech-input":[()=>import("./ZOSUDIJH.js"),"awaitingResponse,inputValue,language,mode;;clearDraftSession"],"arcgis-assistant-suggested-prompts":[()=>import("./WH6QQK6N.js"),"_messages:,label,prompts:"],"arcgis-assistant-user-message":[()=>import("./YJ3QQXF6.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")
2
+ import{p as s,y as e}from"./MAV3DW27.js";import"./ADYIXCSG.js";import"./YIMNOUTF.js";var a=s(e,{"arcgis-assistant":[()=>import("./GJUD7EA3.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("./27NEUQN3.js"),"agent:,context:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./VDXSALQI.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./U53OEX6L.js"),"referenceElement;;getContext"],"arcgis-assistant-knowledge-agent":[()=>import("./BFPMQT3A.js"),"context:,referenceElement,serviceUrl;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./HCR23HJB.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./3YMSOD5D.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./5SBLS4NW.js"),"interrupt:,loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./M3SWPT3M.js"),"_messages:,awaitingResponse,disabled,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./PSWI3MFB.js"),"_messages:,message,options:,type"],"arcgis-assistant-interrupt-preview":[()=>import("./JN744CAW.js"),"interrupts:"],"arcgis-assistant-message":[()=>import("./CAECQD75.js"),"assistantAvatarEnabled,copyEnabled,feedbackEnabled,footerDisabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-block":[()=>import("./I64KIZG3.js"),"block:"],"arcgis-assistant-message-feedback":[()=>import("./FWU6DFIB.js"),"_messages:,feedbackEnabled,message:"],"arcgis-assistant-message-footer":[()=>import("./DEAYZ3MK.js"),"_messages:,copyEnabled,feedbackEnabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-loading":[()=>import("./ZPLFFLPF.js"),"assistantAvatarEnabled,interrupts:,loading,loadingMessage"],"arcgis-assistant-message-log":[()=>import("./NOJYPREL.js"),"log:,logEnabled,showLog"],"arcgis-assistant-message-read-aloud":[()=>import("./RMLXVQZ5.js"),"_messages:,message:,readAloudEnabled"],"arcgis-assistant-message-text":[()=>import("./IB4WTK74.js"),"content,parts:"],"arcgis-assistant-speech-input":[()=>import("./ZOSUDIJH.js"),"awaitingResponse,inputValue,language,mode;;clearDraftSession"],"arcgis-assistant-suggested-prompts":[()=>import("./WH6QQK6N.js"),"_messages:,label,prompts:"],"arcgis-assistant-user-message":[()=>import("./YJ3QQXF6.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")
@@ -99,7 +99,7 @@ Do not reinterpret the request into a different form.
99
99
 
100
100
  ## Follow-up Reference Resolution
101
101
 
102
- If the latest user request refers to prior results or prior context using a referential phrase such as "these", "those", "them", "that set", or "the previous results", then the request depends on earlier context.
102
+ If the latest user request refers to prior results or prior context using a referential phrase such as "these", "those", "them", "that set", "the previous results", "this", "it", "that one", "this parcel", "this location", or "that feature", then the request depends on earlier context.
103
103
 
104
104
  This also applies to equivalent referential wording in other languages.
105
105
 
@@ -107,7 +107,7 @@ Resolve the reference using the most recent relevant chat history or successful
107
107
 
108
108
  In this case, the \`assignedTask\` should be standalone and should preserve the referenced prior constraints while adding only the new constraint or question from the latest user request.
109
109
 
110
- Do not leave ambiguous references like "these", "those", or "them" in \`assignedTask\` when they can be resolved from context.
110
+ Do not leave ambiguous references like "these", "those", "them", "this", or "it" in \`assignedTask\` when they can be resolved from context.
111
111
 
112
112
  ---
113
113