@arcgis/ai-components 5.2.0-next.7 → 5.2.0-next.70

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.
Files changed (208) hide show
  1. package/README.md +2 -2
  2. package/dist/agent-utils/FunctionAgent.d.ts +2 -2
  3. package/dist/agent-utils/LLMAgent.d.ts +2 -2
  4. package/dist/agent-utils/LLMAgent.js +2 -1
  5. package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
  6. package/dist/agent-utils/index.d.ts +177 -0
  7. package/dist/agent-utils/index.js +167 -0
  8. package/dist/agent-utils/middlewares/trace.d.ts +2 -0
  9. package/dist/agent-utils/middlewares/trace.js +25 -33
  10. package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
  11. package/dist/agent-utils/types.d.ts +36 -7
  12. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
  13. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
  14. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
  15. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
  16. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
  17. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
  18. package/dist/cdn/{H7422XUG.js → 2GH3K5JP.js} +1 -1
  19. package/dist/cdn/2Y4DTOGT.js +2 -0
  20. package/dist/cdn/3DJDRAGV.js +2 -0
  21. package/dist/cdn/3S5G5SIX.js +2 -0
  22. package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
  23. package/dist/cdn/3ZPPYCNL.js +2 -0
  24. package/dist/cdn/434TAA3J.js +2 -0
  25. package/dist/cdn/4CEMUECT.js +2 -0
  26. package/dist/cdn/4PCAK3ET.js +2 -0
  27. package/dist/cdn/57OMVTIU.js +2 -0
  28. package/dist/cdn/5TI2F5XX.js +2 -0
  29. package/dist/cdn/6TA5KFAQ.js +4 -0
  30. package/dist/cdn/6U7TEAAJ.js +2 -0
  31. package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
  32. package/dist/cdn/APFZY4PI.js +2 -0
  33. package/dist/cdn/B6CJG5UH.js +66 -0
  34. package/dist/cdn/BE7ZN5FZ.js +2 -0
  35. package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
  36. package/dist/cdn/BNSJO6X2.js +2 -0
  37. package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
  38. package/dist/cdn/CMDRED5H.js +2 -0
  39. package/dist/cdn/CXW5URTF.js +14 -0
  40. package/dist/cdn/DCSZPL7R.js +2 -0
  41. package/dist/cdn/DTIVDIDY.js +2 -0
  42. package/dist/cdn/DUSILSNJ.js +9 -0
  43. package/dist/cdn/E5ZKBC24.js +36 -0
  44. package/dist/cdn/FSGIG7UN.js +2 -0
  45. package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
  46. package/dist/cdn/GLBE7OW2.js +2 -0
  47. package/dist/cdn/GP6NDTUE.js +18 -0
  48. package/dist/cdn/HBLRVXEB.js +2 -0
  49. package/dist/cdn/HJG7QM2R.js +9 -0
  50. package/dist/cdn/HQXPPYMD.js +2 -0
  51. package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
  52. package/dist/cdn/ICYUPLZM.js +56 -0
  53. package/dist/cdn/IEHPNCTL.js +2 -0
  54. package/dist/cdn/IHP25JWI.js +99 -0
  55. package/dist/cdn/J6A4AS7E.js +22 -0
  56. package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
  57. package/dist/cdn/KKLAQF3Z.js +2 -0
  58. package/dist/cdn/KLYNL2ZT.js +2 -0
  59. package/dist/cdn/KQHLOYKL.js +3 -0
  60. package/dist/cdn/LHLO6PTD.js +2 -0
  61. package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
  62. package/dist/cdn/LUY6V4TP.js +181 -0
  63. package/dist/cdn/M3MRIGDZ.js +2 -0
  64. package/dist/cdn/{VOQX4AVB.js → MW5S2XCB.js} +6 -4
  65. package/dist/cdn/MWYBF3F3.js +66 -0
  66. package/dist/cdn/NEV6OZN3.js +71 -0
  67. package/dist/cdn/OKMZQXBQ.js +2 -0
  68. package/dist/cdn/OKTBWKNG.js +2 -0
  69. package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
  70. package/dist/cdn/OWXCOUIQ.js +2 -0
  71. package/dist/cdn/OYNIFMCJ.js +2 -0
  72. package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
  73. package/dist/cdn/PUFTYLJ2.js +22 -0
  74. package/dist/cdn/PVE7Q43N.js +2 -0
  75. package/dist/cdn/R74ZHFA6.js +2 -0
  76. package/dist/cdn/RLEHNAIA.js +2 -0
  77. package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
  78. package/dist/cdn/ST5FQYT7.js +180 -0
  79. package/dist/cdn/SXHH575T.js +48 -0
  80. package/dist/cdn/T4ECSHM7.js +2 -0
  81. package/dist/cdn/TFT6HK3O.js +208 -0
  82. package/dist/cdn/TPULIO6I.js +34 -0
  83. package/dist/cdn/U3XIDLHO.js +3 -0
  84. package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
  85. package/dist/cdn/UZLQALHY.js +2 -0
  86. package/dist/cdn/V6HOUZPZ.js +2 -0
  87. package/dist/cdn/VAXH6RUQ.js +134 -0
  88. package/dist/cdn/VXFQANGJ.js +2 -0
  89. package/dist/cdn/WQGJATNJ.js +2 -0
  90. package/dist/cdn/WSHWQDO2.js +2 -0
  91. package/dist/cdn/WUNCZOGU.js +2 -0
  92. package/dist/cdn/WVPU4QOO.js +2 -0
  93. package/dist/cdn/WXWO5D3W.js +2 -0
  94. package/dist/cdn/XCRR2EEG.js +6 -0
  95. package/dist/cdn/XETNZW4D.js +3 -0
  96. package/dist/cdn/XRE5USHA.js +2 -0
  97. package/dist/cdn/YHQJ66WJ.js +2 -0
  98. package/dist/cdn/ZCEMEUP7.js +2 -0
  99. package/dist/cdn/ZS6SXJP2.js +2 -0
  100. package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
  101. package/dist/cdn/agent-utils/index.js +2 -0
  102. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  103. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  104. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  105. package/dist/cdn/index.js +1 -1
  106. package/dist/chunks/adapter.js +1795 -1598
  107. package/dist/chunks/arcgisKnowledgeGraph.js +127 -72
  108. package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
  109. package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
  110. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
  111. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
  112. package/dist/chunks/converterUtils.js +39 -32
  113. package/dist/chunks/dataExplorationGraph.js +140 -114
  114. package/dist/chunks/data_explore_query_prompt.js +9 -4
  115. package/dist/chunks/generateLayerDescriptions.js +265 -240
  116. package/dist/chunks/helpGraph.js +30 -23
  117. package/dist/chunks/help_prompt.js +34 -17
  118. package/dist/chunks/index.js +11 -0
  119. package/dist/chunks/intent_prompt.js +16 -0
  120. package/dist/chunks/layerStylingGraph.js +25 -21
  121. package/dist/chunks/navigationGraph.js +79 -70
  122. package/dist/chunks/navigation_intent_prompt.js +8 -2
  123. package/dist/chunks/orchestrator.js +205 -175
  124. package/dist/chunks/slottableRequestUtils.js +3 -7
  125. package/dist/chunks/state.js +1 -1
  126. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  127. package/dist/chunks/toolCallResponse.js +13 -10
  128. package/dist/chunks/utils2.js +8 -8
  129. package/dist/components/arcgis-assistant/customElement.d.ts +27 -0
  130. package/dist/components/arcgis-assistant/customElement.js +386 -152
  131. package/dist/components/arcgis-assistant/index.js +2 -3
  132. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  133. package/dist/components/arcgis-assistant-agent/customElement.js +5 -1
  134. package/dist/components/arcgis-assistant-chat/customElement.d.ts +2 -1
  135. package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
  136. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -0
  137. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  138. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +12 -6
  139. package/dist/components/arcgis-assistant-help-agent/customElement.js +9 -3
  140. package/dist/components/arcgis-assistant-interrupt/customElement.js +12 -8
  141. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  142. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  143. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  144. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +18 -12
  145. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +11 -5
  146. package/dist/components/arcgis-assistant-message/customElement.d.ts +2 -0
  147. package/dist/components/arcgis-assistant-message/customElement.js +28 -26
  148. package/dist/components/arcgis-assistant-message/index.js +2 -0
  149. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  150. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  151. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +4 -0
  152. package/dist/components/arcgis-assistant-message-loading/customElement.js +10 -10
  153. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  154. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
  155. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  156. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +12 -6
  157. package/dist/components/arcgis-assistant-speech-input/customElement.js +29 -46
  158. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  159. package/dist/components/arcgis-assistant-user-message/customElement.js +10 -8
  160. package/dist/docs/api.json +1 -1
  161. package/dist/docs/docs.json +1 -1
  162. package/dist/docs/vscode.html-custom-data.json +1 -1
  163. package/dist/docs/web-types.json +1 -1
  164. package/dist/loader.js +7 -6
  165. package/dist/oauth-callback.html +1 -1
  166. package/dist/types/lumina.d.ts +7 -6
  167. package/dist/types/preact.d.ts +7 -6
  168. package/dist/types/react.d.ts +7 -6
  169. package/dist/types/stencil.d.ts +7 -6
  170. package/dist/utils/index.d.ts +95 -47
  171. package/dist/utils/index.js +80 -65
  172. package/package.json +12 -11
  173. package/dist/cdn/2AXF774U.js +0 -2
  174. package/dist/cdn/3NI46YCE.js +0 -2
  175. package/dist/cdn/3PKJWIC3.js +0 -2
  176. package/dist/cdn/462JBSEV.js +0 -422
  177. package/dist/cdn/47FWPQ2A.js +0 -16
  178. package/dist/cdn/5QAHYX7Y.js +0 -5
  179. package/dist/cdn/7BCR6TUO.js +0 -2
  180. package/dist/cdn/7GH7VSB2.js +0 -2
  181. package/dist/cdn/7PLV4QH6.js +0 -2
  182. package/dist/cdn/AEJHYRGT.js +0 -166
  183. package/dist/cdn/AO7BQHKC.js +0 -2
  184. package/dist/cdn/AXDZBBNL.js +0 -45
  185. package/dist/cdn/BFZJNJL6.js +0 -22
  186. package/dist/cdn/DDLZOMUY.js +0 -2
  187. package/dist/cdn/DHOVCT6R.js +0 -2
  188. package/dist/cdn/F2AHA4GB.js +0 -54
  189. package/dist/cdn/FX5JFRDL.js +0 -2
  190. package/dist/cdn/GCQLVNNC.js +0 -14
  191. package/dist/cdn/HB5A5R2E.js +0 -2
  192. package/dist/cdn/JV4SI65E.js +0 -108
  193. package/dist/cdn/KMQ3SP4I.js +0 -5
  194. package/dist/cdn/MH5RPXHM.js +0 -2
  195. package/dist/cdn/NAUXSHIE.js +0 -72
  196. package/dist/cdn/NVI3I46B.js +0 -2
  197. package/dist/cdn/OAVEHGB6.js +0 -2
  198. package/dist/cdn/OH64RMOR.js +0 -4
  199. package/dist/cdn/P6OPJQMC.js +0 -3
  200. package/dist/cdn/QR54T33D.js +0 -2
  201. package/dist/cdn/R6HV42YW.js +0 -3
  202. package/dist/cdn/RVOAPUBN.js +0 -2
  203. package/dist/cdn/SXDLXCIM.js +0 -2
  204. package/dist/cdn/USMDJUFS.js +0 -2
  205. package/dist/cdn/V2P4AIGG.js +0 -2
  206. package/dist/cdn/V7OJRG26.js +0 -36
  207. package/dist/cdn/Y333DGV6.js +0 -2
  208. package/dist/cdn/YIMNOUTF.js +0 -2
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./YIMNOUTF.js";var e=`## Navigation Agent - Tool Intent Classifier
2
+ import"./UZLQALHY.js";var e=`## Navigation Agent - Tool Intent Classifier
3
3
 
4
4
  You are an assistant that classifies the assigned task intent for navigation agent.
5
5
 
@@ -36,8 +36,14 @@ This is the order of preference in case of overlap:
36
36
 
37
37
  For example, "Where is Yosemite National Park". This is an address, but:
38
38
  A map that contains a bookmark with Yosemite National Park should prefer the bookmark.
39
- A map that has the National Parks layer, for example, should prefer the feature.
40
- If these do not exist, geocode and go to that address.
39
+ If bookmark does not exist, a map that has the National Parks layer, for example, should prefer the feature.
40
+ If both of these do not exist, geocode and go to that address.
41
+
42
+ Additional mapping guidance:
43
+
44
+ - "zoom/go to [layer]" with no filter \u2192 prefer \`goToLayer\`.
45
+ - "zoom/go to [features] where/with ..." (has a condition/filter) \u2192 prefer \`goToFeatures\`.
46
+ - Explicit numeric zoom/scale/viewpoint requests \u2192 prefer the matching zoom/scale/viewpoint tool.
41
47
 
42
48
  Return the name of the tool as a string.
43
49
  `;export{e as default};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as o}from"./2GH3K5JP.js";import"./OKMZQXBQ.js";import"./RLEHNAIA.js";import{g as a,h as e,n as i,v as c,z as n}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var r=a`.actions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs)}`,t=class extends c{constructor(){super(...arguments),this._messages=o({blocking:!0}),this.feedbackEnabled=!1,this.arcgisFeedback=i()}static{this.properties={feedbackEnabled:5,message:0}}static{this.styles=r}_handleFeedback(s){this.message&&(this.message.feedback=this.message.feedback?.positive===s?void 0:{positive:s},this.arcgisFeedback.emit(this.message),this.requestUpdate())}_getFeedback(){return this.message?.feedback?.positive}_renderThumbsUpButton(){return e`<calcite-action id=action-thumbs-up icon=thumbs-up scale=s .active=${this._getFeedback()===!0} @click=${()=>this._handleFeedback(!0)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-up overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsUpLabel}</span></calcite-tooltip>`}_renderThumbsDownButton(){return e`<calcite-action id=action-thumbs-down icon=thumbs-down scale=s .active=${this._getFeedback()===!1} @click=${()=>this._handleFeedback(!1)} text></calcite-action><calcite-tooltip reference-element=action-thumbs-down overlay-positioning=fixed placement=bottom><span>${this._messages.thumbsDownLabel}</span></calcite-tooltip>`}render(){return this.feedbackEnabled&&!this.message?.error?e`<div class="actions">${this._renderThumbsUpButton()}${this._renderThumbsDownButton()}</div>`:null}};n("arcgis-assistant-message-feedback",t);export{t as ArcgisAssistantMessageFeedback};
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as c}from"./2GH3K5JP.js";import"./OKMZQXBQ.js";import"./RLEHNAIA.js";import{g as i,h as s,n as r,v as a,z as p}from"./6TA5KFAQ.js";import"./R74ZHFA6.js";import"./UZLQALHY.js";var l=i`:host{display:block;max-width:100%}.group{max-width:100%}.prompt{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-style:normal;cursor:pointer;font-weight:var(--calcite-font-weight-regular)}calcite-chip{max-width:100%}`,e=class extends a{constructor(){super(...arguments),this._messages=c({blocking:!0}),this.prompts=[],this.arcgisPromptSelect=r()}static{this.properties={label:1,prompts:0}}static{this.styles=l}_emitPromptSelect(t){this.arcgisPromptSelect.emit({prompt:t})}render(){return this.prompts.length?s`<calcite-chip-group class="group" .label=${this.label??this._messages.suggestedPromptsLabel}>${this.prompts.map(t=>s`<calcite-chip .value=${t} .label=${t} appearance=outline-fill kind=brand @calciteChipSelect=${()=>this._emitPromptSelect(t)}><div class="prompt">${t}</div></calcite-chip>`)}</calcite-chip-group>`:null}};p("arcgis-assistant-suggested-prompts",e);export{e as ArcgisAssistantSuggestedPrompts};
@@ -0,0 +1,3 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./SXHH575T.js";import{b as E}from"./R74ZHFA6.js";import{a as g}from"./HJG7QM2R.js";import{Va as A,a as v,b as I,ba as S,y as R}from"./TFT6HK3O.js";import{ca as b,oa as C}from"./LUY6V4TP.js";export default $arcgis.t(([N,U,H,T,_,{a:k,d:D,e:f,g:$,h:M,o:W}])=>{var G=async e=>{let t=await z(),n=await k("default"),s=U.getDefault(),r=(await N.getCredential(`${s.url}/sharing`)).token,a={type:"generateEmbeddings",webmapEmbeddings:e,auth:{apiUrl:n,token:r}};return t.postMessage(a),await new Promise((i,c)=>{let o=u=>{u.data==="completed"&&(t.removeEventListener("message",o),i())},d=u=>{t.removeEventListener("message",o),c(u instanceof Error?u:new Error("Embeddings worker error"))};t.addEventListener("message",o),t.addEventListener("error",d,{once:!0})}),t},z=async()=>{{let e=(await import("./OKVLGJAG.js")).default;return new e}},Q=e=>{e.currentIntent="none"},B=async(e,t)=>{let n=f(t);if(e.agentExecutionContext.userRequest){let r=new C(e.agentExecutionContext.userRequest.trim());e.agentExecutionContext.messages=[...e.agentExecutionContext.messages,r],Q(e)}let s=n?.services.agentRegistry.list().map(r=>r.agent.id)??[];return await g({text:`Available agents: ${[...s].join(", ")}`},t),await g({text:"Analyzing user input"},t),e},J=async(e,t)=>(await g({text:"Exiting..."},t),e),q=e=>typeof e=="object"&&e!==null&&!Array.isArray(e),K=(e,t)=>{if(!q(e)){e!==void 0&&console.warn(`Agent "${t}" returned invalid sharedStatePatch. Ignoring it.`);return}let n={};for(let[s,r]of Object.entries(e)){if(!q(r)||!("value"in r)){console.warn(`Agent "${t}" returned invalid sharedStatePatch entry for key "${s}". Ignoring that entry.`);continue}n[s]={value:r.value}}return n},V=e=>{let{previousSharedState:t,patch:n,agentId:s}=e;if(!n)return t;let r=Date.now(),a={...t};for(let[i,c]of Object.entries(n))c?.value!==void 0&&(a[i]={value:c.value,meta:{updatedByAgentId:s,updatedAt:r}});return a},F=e=>typeof e!="string"?void 0:e.trim()||void 0,X=e=>{switch(e){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."}},Y=(e,t)=>{let n=F(t?.outputMessage),s=F(t?.summary),r=t?.status,a=r==="success"||r==="failed"?r:"unknown";a==="unknown"&&console.warn(`Agent "${e}" returned missing/invalid status. Defaulting to "unknown".`);let i=K(t?.sharedStatePatch,e);return{outputMessage:n,summary:s??n??X(a),status:a,sharedStatePatch:i}},L=4e3,Z=async(e,t)=>{let n=f(t);if(t?.signal?.aborted)return await g({text:"Run cancelled; skipping agent execution"},t),{...e,currentIntent:"none",requiresFollowUp:!1};let{agentRegistry:s}=n?.services??{},r=s?.get(e.currentIntent);if(!r)return console.warn(`No agent found for intent: ${e.currentIntent}`),e;await g({text:`Executing registered agent: ${r.agent.name}`},t);let a={...t??{},configurable:{...n??{},agentId:r.agent.id,context:r.getContext?await r.getContext():void 0}},i;try{let d=await r.agent.createGraph().compile().invoke({agentExecutionContext:{...e.agentExecutionContext,messages:[...e.agentExecutionContext.messages],priorSteps:structuredClone(e.agentExecutionContext.priorSteps??[]),sharedState:structuredClone(e.agentExecutionContext.sharedState??{})}},a);i=Y(r.agent.name,d),await g({text:`Finished executing registered agent: ${r.agent.name}`},t)}catch(d){if(R(d)||t?.signal?.aborted||d instanceof Error&&d.name==="AbortError")throw d;let u=d instanceof Error?d.message:String(d);console.error(`Agent "${r.agent.name}" failed:`,d),await g({text:`Registered agent failed: ${r.agent.name}. ${u}`},t),i={status:"failed",outputMessage:`Agent execution failed: ${u}`,summary:`Agent execution failed: ${u}`}}let c=i.outputMessage,o=[...e.agentExecutionContext.messages];if(c){let d=c.length>L?`${c.slice(0,L-14)}
3
+ [truncated]`:c;o.push(new b(d))}return{...e,stepCount:e.stepCount+1,lastExecutedAgent:r.agent.id,requiresFollowUp:i.status==="failed"?!0:e.requiresFollowUp,finalOutputMessage:c??"",agentExecutionContext:{...e.agentExecutionContext,messages:o,priorSteps:[...e.agentExecutionContext.priorSteps??[],{agentId:r.agent.id,assignedTask:e.agentExecutionContext.assignedTask,summary:i?.summary||"No summary provided.",status:i?.status||"unknown"}],sharedState:V({previousSharedState:e.agentExecutionContext.sharedState,patch:i.sharedStatePatch,agentId:r.agent.id})}}},ee=async(e,t)=>{if(e.routing.mode!=="direct")throw new Error("Direct agent assignment requires direct routing.");return await g({text:`Doing a direct route to agent: ${e.routing.agentId}`},t),{...e,currentIntent:e.routing.agentId,requiresFollowUp:!1,agentExecutionContext:{...e.agentExecutionContext,assignedTask:e.agentExecutionContext.userRequest}}},te=3,re=e=>e.routing.mode==="direct"?"assignDirectAgent":"intentLLM",ne=e=>e.routing.mode==="direct"||e.stepCount>=te||!e.requiresFollowUp?"exit":"intentLLM",se=()=>new A(D).addNode("ingestInput",B).addNode("assignDirectAgent",ee).addNode("intentLLM",M).addNode("executeRegisteredAgent",Z).addNode("exit",J).addEdge(v,"ingestInput").addConditionalEdges("ingestInput",re).addEdge("assignDirectAgent","executeRegisteredAgent").addConditionalEdges("intentLLM",e=>e.currentIntent==="none"||e.currentIntent===e.lastExecutedAgent?"exit":"executeRegisteredAgent").addConditionalEdges("executeRegisteredAgent",ne).addEdge("exit",I),w=class{constructor(){this.agentRegistry=new Map}register(t){let{agent:n}=t;if(this.agentRegistry.has(n.id))throw new Error(`Duplicate agent id: ${n.id}`);this.agentRegistry.set(n.id,t)}get(t){return this.agentRegistry.get(t)}list(){return[...this.agentRegistry.values()]}},x=class{constructor(t,n){this.graph=t,this.config={...n}}async waitForUser(){return await new Promise((t,n)=>{this.resolveWait=t,this.rejectWait=n})}handle(t,n){try{let s={agentId:t.agentId,id:t.id,payload:n},r=this.graph.streamEvents(null,{...this.config,configurable:{...this.config.configurable,hitlResponse:s},subgraphs:!0,version:"v2"});this.resolveWait?.(r)}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)}},ae=async e=>{try{return await(await $()).embedDocuments(e)}catch(t){throw console.error("Failed to generate embeddings:",t),t}},O=async(e,t)=>{let n=t.get(e);if(n)return n;let s=await ae([e]);return t.set(e,s[0]),s[0]};async function ie(e,t,n,s){let r=`req-${Date.now()}`,a={type:"layerSearch",precomputedEmbedding:s?await O(e,s):void 0,requestId:r,minScore:n};return await new Promise(i=>{let c=o=>{o.data.requestId===r&&i(o.data.results)};t.addEventListener("message",c,{once:!0}),t.postMessage(a)})}function oe(e){let{worker:t}=e;return{async searchLayers({text:n,minScore:s,embeddingCache:r}){return await ie(n,t,s,r)}}}var de=async({combinedQuery:e,layerIds:t,embeddingsWorker:n,minScore:s,topResults:r,embeddingCache:a})=>{let i=`req-${Date.now()}`,c=a?await O(e,a):void 0,o={type:"fieldSearch",layerIdForFieldsSearch:t,precomputedEmbedding:c,requestId:i,minScore:s,topResults:r};return await new Promise(d=>{let u=p=>{if(p.data.requestId!==i)return;let y=p.data.results.map(({layerId:l,results:m})=>({layerId:l,results:m}));d(y)};n.addEventListener("message",u,{once:!0}),n.postMessage(o)})};function ce(e){let{worker:t}=e;return{async searchFields({text:n,layerIds:s,minScore:r,topResults:a,embeddingCache:i}){return await de({combinedQuery:n,layerIds:s,embeddingsWorker:t,minScore:r,topResults:a,embeddingCache:i})}}}var ue=e=>{let t=W.safeParse(e);if(!t.success)throw new Error("Embeddings response validation failed. Regenerate embeddings.");return t.data},ge=(e,t)=>{let n=new Map,s=new Map;if(t.allLayers.forEach(r=>{r instanceof T&&s.set(r.id,r)}),e.length!==s.size)throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");for(let r of e){let a=s.get(r.id);if(!a)throw new Error(`Layer with ID ${r.id} not found in the original map during registry restoration. Regenerate embeddings.`);if(r.fields.length!==a.fields.length)throw new Error(`Field count mismatch for layer ID ${r.id} during registry restoration. Regenerate embeddings.`);let i={name:r.name,title:r.title,description:r.description},c=new Map;for(let o of r.fields){let d=a.fieldsIndex.get(o.name);if(!d)throw new Error(`Field with name ${o.name} not found in the original layer ${r.id} during registry restoration. Regenerate embeddings.`);c.set(o.name,{name:o.name,alias:a.getFieldAlias(o.name)??o.alias,description:o.description,type:d.type||"unknown",valueType:d.valueType||"unknown",domain:a.getFieldDomain(o.name)??void 0})}n.set(r.id,{layerItem:i,fieldRegistry:c})}return n},le=async e=>{try{return(await _(e,{responseType:"json"})).data}catch(t){throw new Error(`Failed to fetch data from ${e}: ${String(t)}`)}},he=async e=>{let t=e.map;if(!t?.portalItem)throw new Error("WebMap portal item is missing.");let{resources:n}=await t.portalItem.fetchResources(),s=n.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 r=await le(s.resource.url);return ue(r)},j=class e{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(t){let n=new e;try{if(t.view?.map){await H.whenOnce(()=>t.view.ready);let s=await he(t.view),r=ge(s.layers,t.view.map);n.layersAndFieldsRegistry=r,n.embeddingsWorker=await G(s)}return t.agents?.forEach(s=>{n.agentRegistry.register(s)}),n.orchestratorReady=!0,n}catch(s){throw console.error("Orchestrator initialization failed:",s),s}}async*ask(t,n={}){if(!this.orchestratorReady)throw new Error("Orchestrator is not ready yet.");if(!this.agentRegistry.list().length)throw new Error("Orchestrator has no registered agents.");let s=this.createRequestAgentRegistry(n);if(!s.list().length)throw new Error("Orchestrator has no agents selected for this request.");if(++this.streamEpoch,!t.trim())return;let r=E();this.activeRunId=r,this.activeAbortController=new AbortController,this.graph||(this.graph=se().compile({checkpointer:new S}));let a=this.embeddingsWorker?oe({worker:this.embeddingsWorker}):void 0,i=this.embeddingsWorker?ce({worker:this.embeddingsWorker}):void 0,c=new Map,o=n.routing==="direct"?{mode:"direct",agentId:n.agentId}:{mode:"auto"},d={thread_id:r,hitlResponse:null,services:{layerSearch:a,fieldSearch:i,layersAndFieldsRegistry:this.layersAndFieldsRegistry,agentRegistry:s,embeddingCache:c}},u={version:"v2",streamMode:"custom",signal:this.activeAbortController.signal,configurable:d,subgraphs:!0},p=this.graph?.streamEvents({routing:o,agentExecutionContext:{userRequest:t,messages:this.chatHistory,priorSteps:this.priorSteps,sharedState:this.sharedState}},u),y=++this.streamEpoch;if(yield*this.pipeStream(p,y,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 m=(await this.graph.getState(u,{subgraphs:!0})).tasks.find(h=>h.interrupts.length>0)?.interrupts[0]?.value;if(!m)break;this.currentInterrupt=m,this.interruptHandler=new x(this.graph,u),yield{runId:r,timestamp:Date.now(),type:"interrupt",interrupt:m};try{let h=await this.interruptHandler.waitForUser(),P=++this.streamEpoch;yield*this.pipeStream(h,P,r)}catch(h){if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}if(h){yield{runId:r,timestamp:Date.now(),type:"error",error:{message:h?.message}};return}}}if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}let l=(await this.graph.getState(u,{subgraphs:!0})).values;if(this.isRunCancelled(r)){yield{runId:r,timestamp:Date.now(),type:"cancelled",reason:"user"};return}this.chatHistory=l.agentExecutionContext.messages.length?l.agentExecutionContext.messages:this.chatHistory,this.priorSteps=l.agentExecutionContext.priorSteps?.slice(-5)??[],this.sharedState=l.agentExecutionContext.sharedState??{},yield{runId:r,timestamp:Date.now(),type:"completed",result:{content:l.finalOutputMessage}}}newConversation(){this.chatHistory=[],this.priorSteps=[],this.sharedState={}}resumeInterrupt(t){if(!this.currentInterrupt||!this.interruptHandler)throw new Error("No pending interrupt to resume.");this.interruptHandler.handle(this.currentInterrupt,t)}cancelInterrupt(){this.interruptHandler&&this.interruptHandler.cancel()}cancel(){this.activeRunId&&(this.cancelledRunIds.add(this.activeRunId),this.activeAbortController?.abort(),++this.streamEpoch,this.interruptHandler?.cancel())}async*pipeStream(t,n,s){for await(let r of t){if(this.isRunCancelled(s)||n!==this.streamEpoch)break;r.event==="on_custom_event"&&r.name==="trace_message"?yield{runId:s,timestamp:Date.now(),type:"trace",data:r.data}:r.name==="graph_ux_suggestion"&&(yield{runId:s,timestamp:Date.now(),type:"ux-suggestion",suggestion:r.data})}}isRunCancelled(t){return this.cancelledRunIds.has(t)}createRequestAgentRegistry(t){let n=t.routing==="direct"?[t.agentId]:t.agentIds,s=n?n.map(a=>{let i=this.agentRegistry.get(a);if(!i)throw new Error(`Agent is not registered: ${a}`);return i}):this.agentRegistry.list(),r=new w;return s.forEach(a=>r.register(a)),r}dispose(){this.embeddingsWorker&&(this.embeddingsWorker.terminate(),this.embeddingsWorker=void 0),this.orchestratorReady=!1}};return{a:ae,b:j}},"identity/IdentityManager","portal/Portal","core/reactiveUtils","layers/FeatureLayer","request",a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./ZS6SXJP2.js";import"./57OMVTIU.js";import"./TFT6HK3O.js";import"./LUY6V4TP.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([{property:d,subclass:f},{a:u,c:i,d:c}])=>{var m=Object.defineProperty,g=Object.getOwnPropertyDescriptor,p=(e,o,r,t)=>{for(var s=t>1?void 0:t?g(o,r):o,a=e.length-1,n;a>=0;a--)(n=e[a])&&(s=(t?n(o,r,s):n(s))||s);return t&&s&&m(o,r,s),s},l=class extends c{constructor(e){super(e)}getAgents(){return this.agents}getEntryNode(e){return e[0]?i(e[0],0):void 0}isTerminalAgent(e,o){return o===e.length-1}validateAgents(e){super.validateAgents(e);let o=new Map;for(let[r,t]of e.entries()){let s=e[r-1];if(t.outputSchema)for(let a of u(t.outputSchema)){let n=o.get(a)??[];n.push(`${t.name} [${r}]`),o.set(a,n)}if(!(r===0||!t.inputSchema||s?.outputSchema))throw new Error(`Workflow agent "${t.name}" declares an input schema, so upstream agent "${s.name}" must declare an output schema.`)}for(let[r,t]of o.entries())t.length>1&&console.warn(`Workflow output field "${r}" is declared by multiple steps (${t.join(", ")}). Later steps will overwrite earlier values in shared state.`)}buildEdges(e){return e.length===1?[{from:i(e[0],0),decide:()=>{}}]:e.slice(0,-1).map((o,r)=>({from:i(o,r),decide:t=>t.status==="failed"?void 0:i(e[r+1],r+1)}))}};p([d()],l.prototype,"agents",2);l=p([f("SequentialWorkflow")],l);return l},"core/accessorSupport/decorators",a)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./YIMNOUTF.js";var e=`This Feature Layer is part of a Feature Service. The Feature Layer contains various fields, each with its own name, type, and description.
2
+ import"./UZLQALHY.js";var e=`This Feature Layer is part of a Feature Service. The Feature Layer contains various fields, each with its own name, type, and description.
3
3
  The Feature Layer is a collection of geographic features that represent real-world entities. Each feature in the layer has attributes that provide additional information about the feature. The layer may include point, line, or polygon geometries, depending on the type of data it represents.
4
4
  The geometry type for this layer is {layerGeometryType}.
5
5