@arcgis/ai-components 5.2.0-next.1 → 5.2.0-next.100

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 (325) hide show
  1. package/LICENSE.md +4 -2
  2. package/README.md +2 -2
  3. package/dist/agent-utils/FunctionAgent.d.ts +2 -2
  4. package/dist/agent-utils/LLMAgent.d.ts +7 -4
  5. package/dist/agent-utils/LLMAgent.js +26 -24
  6. package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
  7. package/dist/agent-utils/WorkflowAgent.js +14 -15
  8. package/dist/agent-utils/index.d.ts +177 -0
  9. package/dist/agent-utils/index.js +167 -0
  10. package/dist/agent-utils/middlewares/trace.d.ts +2 -0
  11. package/dist/agent-utils/middlewares/trace.js +25 -33
  12. package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
  13. package/dist/agent-utils/types.d.ts +37 -8
  14. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
  15. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
  16. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
  17. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
  18. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
  19. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
  20. package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
  21. package/dist/agentic-workflow/Edge.d.ts +16 -0
  22. package/dist/agentic-workflow/WebAgent.d.ts +39 -0
  23. package/dist/agentic-workflow/jsonTypes.d.ts +189 -0
  24. package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -0
  25. package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
  26. package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
  27. package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
  28. package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
  29. package/dist/agentic-workflow/types.d.ts +29 -0
  30. package/dist/agents/tools/filter/clearFilters/adapter.d.ts +8 -0
  31. package/dist/agents/tools/filter/clearFilters/adapter.js +22 -0
  32. package/dist/agents/tools/filter/resetMap/adapter.d.ts +8 -0
  33. package/dist/agents/tools/filter/resetMap/adapter.js +22 -0
  34. package/dist/agents/tools/filter/setFeatureEffect/adapter.d.ts +8 -0
  35. package/dist/agents/tools/filter/setFeatureEffect/adapter.js +121 -0
  36. package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
  37. package/dist/agents/tools/help/listFields/adapter.js +30 -0
  38. package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
  39. package/dist/agents/tools/navigation/goToAddress/adapter.js +60 -0
  40. package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
  41. package/dist/agents/tools/navigation/goToBookmark/adapter.js +30 -0
  42. package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
  43. package/dist/agents/tools/navigation/goToFeatures/adapter.js +50 -0
  44. package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
  45. package/dist/agents/tools/navigation/goToFullExtent/adapter.js +27 -0
  46. package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
  47. package/dist/agents/tools/navigation/goToHomeExtent/adapter.js +24 -0
  48. package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
  49. package/dist/agents/tools/navigation/goToLayer/adapter.js +26 -0
  50. package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
  51. package/dist/agents/tools/navigation/goToScale/adapter.js +21 -0
  52. package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
  53. package/dist/agents/tools/navigation/goToViewpoint/adapter.js +42 -0
  54. package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
  55. package/dist/agents/tools/navigation/goToZoom/adapter.js +21 -0
  56. package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
  57. package/dist/agents/tools/query/getAttribute/adapter.js +40 -0
  58. package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
  59. package/dist/agents/tools/query/getStatistics/adapter.js +157 -0
  60. package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
  61. package/dist/agents/tools/query/getTopFeatures/adapter.js +144 -0
  62. package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
  63. package/dist/agents/tools/query/queryFeatures/adapter.js +130 -0
  64. package/dist/agents/tools/search/findRelevantFields/adapter.d.ts +8 -0
  65. package/dist/agents/tools/search/findRelevantFields/adapter.js +57 -0
  66. package/dist/agents/tools/search/findRelevantLayers/adapter.d.ts +8 -0
  67. package/dist/agents/tools/search/findRelevantLayers/adapter.js +38 -0
  68. package/dist/cdn/22KHSDJI.js +2 -0
  69. package/dist/cdn/2EY3BQQX.js +2 -0
  70. package/dist/cdn/2O4DON37.js +2 -0
  71. package/dist/cdn/34O57OGV.js +2 -0
  72. package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
  73. package/dist/cdn/434TAA3J.js +2 -0
  74. package/dist/cdn/4OGR5QKS.js +2 -0
  75. package/dist/cdn/5FL5BTTX.js +66 -0
  76. package/dist/cdn/5HBAJ57P.js +2 -0
  77. package/dist/cdn/5K5ZY267.js +2 -0
  78. package/dist/cdn/5MK44FNO.js +2 -0
  79. package/dist/cdn/5WYRJMBW.js +2 -0
  80. package/dist/cdn/5X7EG7D2.js +2 -0
  81. package/dist/cdn/5XZLS7UO.js +2 -0
  82. package/dist/cdn/5ZFUGNRN.js +2 -0
  83. package/dist/cdn/655YIKL3.js +11 -0
  84. package/dist/cdn/6ECRQVHY.js +2 -0
  85. package/dist/cdn/6OOZSZRJ.js +2 -0
  86. package/dist/cdn/{3PKJWIC3.js → 6P44KOKX.js} +1 -1
  87. package/dist/cdn/6YYPVU7H.js +3 -0
  88. package/dist/cdn/7BCQMK6D.js +2 -0
  89. package/dist/cdn/7SRLZQVC.js +5 -0
  90. package/dist/cdn/7V6OSTFC.js +2 -0
  91. package/dist/cdn/7VAQUCBU.js +9 -0
  92. package/dist/cdn/7VUSIGEM.js +2 -0
  93. package/dist/cdn/ACJTJLZN.js +2 -0
  94. package/dist/cdn/AI6DYOKR.js +181 -0
  95. package/dist/cdn/AKD5UOVX.js +2 -0
  96. package/dist/cdn/ANRQWYU2.js +2 -0
  97. package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
  98. package/dist/cdn/APFZY4PI.js +2 -0
  99. package/dist/cdn/B2JDVLA6.js +2 -0
  100. package/dist/cdn/BE7BRJZD.js +2 -0
  101. package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
  102. package/dist/cdn/C4FEETBZ.js +2 -0
  103. package/dist/cdn/C4JT4S5E.js +2 -0
  104. package/dist/cdn/CCC6LBMY.js +2 -0
  105. package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
  106. package/dist/cdn/CJMUJXPL.js +2 -0
  107. package/dist/cdn/COH3QXWG.js +4 -0
  108. package/dist/cdn/CP5BVGJU.js +2 -0
  109. package/dist/cdn/D5UFYQHN.js +44 -0
  110. package/dist/cdn/EWLXNGKH.js +208 -0
  111. package/dist/cdn/EYOWRGDP.js +2 -0
  112. package/dist/cdn/F5NIRETW.js +2 -0
  113. package/dist/cdn/FDOMMK2M.js +2 -0
  114. package/dist/cdn/FG647IP6.js +2 -0
  115. package/dist/cdn/FJO4KNOZ.js +2 -0
  116. package/dist/cdn/FUF3NAU7.js +2 -0
  117. package/dist/cdn/FXP5UIQU.js +156 -0
  118. package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
  119. package/dist/cdn/G2EGT3CF.js +6 -0
  120. package/dist/cdn/G3SF6U2U.js +2 -0
  121. package/dist/cdn/G7OMHU2B.js +2 -0
  122. package/dist/cdn/HAEFC2SJ.js +2 -0
  123. package/dist/cdn/HDACNIZF.js +2 -0
  124. package/dist/cdn/HHFNQR6Z.js +2 -0
  125. package/dist/cdn/HHUQXL3R.js +2 -0
  126. package/dist/cdn/IBZ2NEAO.js +2 -0
  127. package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
  128. package/dist/cdn/ICQCK5D3.js +2 -0
  129. package/dist/cdn/IHP25JWI.js +99 -0
  130. package/dist/cdn/IJVMUS2L.js +14 -0
  131. package/dist/cdn/J6A4AS7E.js +22 -0
  132. package/dist/cdn/J6SZIQJA.js +2 -0
  133. package/dist/cdn/JCOA24UH.js +3 -0
  134. package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
  135. package/dist/cdn/JO5ETMPS.js +2 -0
  136. package/dist/cdn/K2R6XVK3.js +2 -0
  137. package/dist/cdn/KITIP6J2.js +2 -0
  138. package/dist/cdn/KWD2ECTM.js +2 -0
  139. package/dist/cdn/{4HU7735A.js → LAYVGCPL.js} +6 -4
  140. package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
  141. package/dist/cdn/LLUGJKAQ.js +2 -0
  142. package/dist/cdn/MWYBF3F3.js +66 -0
  143. package/dist/cdn/{V2P4AIGG.js → MXTXJKFE.js} +1 -1
  144. package/dist/cdn/MY47B3CE.js +3 -0
  145. package/dist/cdn/NEV6OZN3.js +71 -0
  146. package/dist/cdn/NNXISHCA.js +14 -0
  147. package/dist/cdn/NZSOJ726.js +2 -0
  148. package/dist/cdn/O4NVW75A.js +2 -0
  149. package/dist/cdn/OE3GW5LE.js +2 -0
  150. package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
  151. package/dist/cdn/ONQ6JSBJ.js +2 -0
  152. package/dist/cdn/OX64WOEL.js +22 -0
  153. package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
  154. package/dist/cdn/PUHRBGKB.js +2 -0
  155. package/dist/cdn/Q57QWN5W.js +2 -0
  156. package/dist/cdn/QUKNPVAF.js +2 -0
  157. package/dist/cdn/R2PQVY4O.js +2 -0
  158. package/dist/cdn/R74ZHFA6.js +2 -0
  159. package/dist/cdn/RBE55SWR.js +2 -0
  160. package/dist/cdn/RHYNE5OE.js +2 -0
  161. package/dist/cdn/RLEHNAIA.js +2 -0
  162. package/dist/cdn/RVSTAUQS.js +2 -0
  163. package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
  164. package/dist/cdn/SXM4NUT5.js +2 -0
  165. package/dist/cdn/SZ2QSSB3.js +2 -0
  166. package/dist/cdn/T4RIGOXB.js +2 -0
  167. package/dist/cdn/TCH5I5LS.js +2 -0
  168. package/dist/cdn/TEPP7YPR.js +2 -0
  169. package/dist/cdn/TMVF2W5N.js +36 -0
  170. package/dist/cdn/TPULIO6I.js +34 -0
  171. package/dist/cdn/UDRKUVZP.js +2 -0
  172. package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
  173. package/dist/cdn/UHNVDALX.js +18 -0
  174. package/dist/cdn/UZLQALHY.js +2 -0
  175. package/dist/cdn/V6HOUZPZ.js +2 -0
  176. package/dist/cdn/VAXH6RUQ.js +134 -0
  177. package/dist/cdn/VLLZ2FFU.js +2 -0
  178. package/dist/cdn/VOKXKU7M.js +56 -0
  179. package/dist/cdn/VXFQANGJ.js +2 -0
  180. package/dist/cdn/WGO5SER7.js +6 -0
  181. package/dist/cdn/WJXXOKGA.js +9 -0
  182. package/dist/cdn/WKTQVBFJ.js +2 -0
  183. package/dist/cdn/{DHOVCT6R.js → WSWB3B7B.js} +1 -1
  184. package/dist/cdn/XX6GHMNR.js +2 -0
  185. package/dist/cdn/Y7XD7ZRD.js +2 -0
  186. package/dist/cdn/YEZ3AMNX.js +2 -0
  187. package/dist/cdn/YLVJA4ZE.js +2 -0
  188. package/dist/cdn/Z5HWPSZN.js +2 -0
  189. package/dist/cdn/Z5W4V7RC.js +2 -0
  190. package/dist/cdn/ZDV4K4WG.js +2 -0
  191. package/dist/cdn/ZOEMBHRF.js +2 -0
  192. package/dist/cdn/ZRVZMPFN.js +2 -0
  193. package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
  194. package/dist/cdn/agent-utils/index.js +2 -0
  195. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  196. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  197. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  198. package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
  199. package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
  200. package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.en.json +1 -0
  201. package/dist/cdn/assets/assistant-message/t9n/messages.en.json +1 -0
  202. package/dist/cdn/assets/assistant-message-loading/t9n/messages.en.json +1 -0
  203. package/dist/cdn/index.js +1 -1
  204. package/dist/cdn/main.css +1 -1
  205. package/dist/chunks/adapter.js +1299 -2113
  206. package/dist/chunks/arcgisKnowledgeGraph.js +128 -72
  207. package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
  208. package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
  209. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
  210. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
  211. package/dist/chunks/baseAgentState.js +58 -0
  212. package/dist/chunks/converterUtils.js +66 -41
  213. package/dist/chunks/dataExplorationGraph.js +135 -179
  214. package/dist/chunks/data_explore_query_prompt.js +9 -4
  215. package/dist/chunks/fetchAgentContext.js +13 -0
  216. package/dist/chunks/fetchService.js +10 -0
  217. package/dist/chunks/fieldStatistics.js +79 -0
  218. package/dist/chunks/formatFeatureAttributes.js +132 -0
  219. package/dist/chunks/generateLayerDescriptions.js +250 -246
  220. package/dist/chunks/helpGraph.js +35 -25
  221. package/dist/chunks/help_prompt.js +34 -17
  222. package/dist/chunks/index.js +11 -0
  223. package/dist/chunks/intent_prompt.js +16 -0
  224. package/dist/chunks/layerStylingGraph.js +37 -31
  225. package/dist/chunks/mergeWhereClauses.js +15 -0
  226. package/dist/chunks/navigationGraph.js +135 -111
  227. package/dist/chunks/navigation_intent_prompt.js +8 -2
  228. package/dist/chunks/orchestrator.js +530 -280
  229. package/dist/chunks/resolvePointGeometryFilter.js +92 -0
  230. package/dist/chunks/slottableRequestUtils.js +3 -7
  231. package/dist/chunks/state.js +21 -27
  232. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  233. package/dist/chunks/toolCallResponse.js +14 -10
  234. package/dist/chunks/utils2.js +11 -11
  235. package/dist/components/arcgis-assistant/customElement.d.ts +96 -0
  236. package/dist/components/arcgis-assistant/customElement.js +398 -149
  237. package/dist/components/arcgis-assistant/index.js +2 -3
  238. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  239. package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
  240. package/dist/components/arcgis-assistant-agent/customElement.js +614 -10
  241. package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
  242. package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
  243. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
  244. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  245. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +20 -4
  246. package/dist/components/arcgis-assistant-help-agent/customElement.js +29 -7
  247. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +8 -1
  248. package/dist/components/arcgis-assistant-interrupt/customElement.js +17 -14
  249. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +24 -0
  250. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  251. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  252. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +40 -16
  253. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +30 -7
  254. package/dist/components/arcgis-assistant-message/customElement.d.ts +26 -0
  255. package/dist/components/arcgis-assistant-message/customElement.js +29 -26
  256. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  257. package/dist/components/arcgis-assistant-message/index.js +2 -0
  258. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  259. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  260. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  261. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  262. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  263. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +11 -1
  264. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -7
  265. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  266. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  267. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  268. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +5 -1
  269. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  270. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +18 -4
  271. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  272. package/dist/components/arcgis-assistant-speech-input/customElement.js +34 -52
  273. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  274. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  275. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +6 -1
  276. package/dist/components/arcgis-assistant-user-message/customElement.js +15 -10
  277. package/dist/docs/api.json +1 -1
  278. package/dist/docs/docs.json +1 -1
  279. package/dist/docs/vscode.html-custom-data.json +1 -1
  280. package/dist/docs/web-types.json +1 -1
  281. package/dist/index.d.ts +4 -0
  282. package/dist/loader.js +9 -8
  283. package/dist/oauth-callback.html +1 -1
  284. package/dist/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
  285. package/dist/types/lumina.d.ts +14 -7
  286. package/dist/types/preact.d.ts +15 -7
  287. package/dist/types/react.d.ts +16 -7
  288. package/dist/types/stencil.d.ts +16 -9
  289. package/dist/utils/index.d.ts +135 -65
  290. package/dist/utils/index.js +55 -50
  291. package/package.json +32 -12
  292. package/dist/cdn/2AXF774U.js +0 -2
  293. package/dist/cdn/462JBSEV.js +0 -422
  294. package/dist/cdn/5QAHYX7Y.js +0 -5
  295. package/dist/cdn/7BCR6TUO.js +0 -2
  296. package/dist/cdn/7GH7VSB2.js +0 -2
  297. package/dist/cdn/7PLV4QH6.js +0 -2
  298. package/dist/cdn/AO7BQHKC.js +0 -2
  299. package/dist/cdn/AXDZBBNL.js +0 -45
  300. package/dist/cdn/DDLZOMUY.js +0 -2
  301. package/dist/cdn/F2AHA4GB.js +0 -54
  302. package/dist/cdn/FHVXO2WG.js +0 -166
  303. package/dist/cdn/FX5JFRDL.js +0 -2
  304. package/dist/cdn/GSEPHN3A.js +0 -106
  305. package/dist/cdn/H7422XUG.js +0 -2
  306. package/dist/cdn/HB5A5R2E.js +0 -2
  307. package/dist/cdn/JY6LLOUJ.js +0 -22
  308. package/dist/cdn/KMQ3SP4I.js +0 -5
  309. package/dist/cdn/MDVYQQUG.js +0 -14
  310. package/dist/cdn/MH5RPXHM.js +0 -2
  311. package/dist/cdn/NAUXSHIE.js +0 -72
  312. package/dist/cdn/NVI3I46B.js +0 -2
  313. package/dist/cdn/OAVEHGB6.js +0 -2
  314. package/dist/cdn/OH64RMOR.js +0 -4
  315. package/dist/cdn/ON2V5XI2.js +0 -3
  316. package/dist/cdn/P6OPJQMC.js +0 -3
  317. package/dist/cdn/QR54T33D.js +0 -2
  318. package/dist/cdn/RVOAPUBN.js +0 -2
  319. package/dist/cdn/S6W6HV4T.js +0 -36
  320. package/dist/cdn/SXDLXCIM.js +0 -2
  321. package/dist/cdn/USMDJUFS.js +0 -2
  322. package/dist/cdn/V5YEZSRY.js +0 -16
  323. package/dist/cdn/Y333DGV6.js +0 -2
  324. package/dist/cdn/YIMNOUTF.js +0 -2
  325. package/dist/cdn/YY2SBO3V.js +0 -2
@@ -1,230 +1,237 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { Annotation as d } from "@langchain/langgraph/web";
3
- import p, { z as r } from "zod";
4
- import { ChatPromptTemplate as C, SystemMessagePromptTemplate as K } from "@langchain/core/prompts";
5
- import { dispatchCustomEvent as F } from "@langchain/core/callbacks/dispatch/web";
6
- import { AIMessage as B, isAIMessage as W, isToolMessage as H } from "@langchain/core/messages";
7
- import { createAgent as J, summarizationMiddleware as X, modelCallLimitMiddleware as G } from "langchain";
8
- import { ChatOpenAI as Q, OpenAIEmbeddings as Y } from "@langchain/openai";
9
- import U from "@arcgis/core/identity/IdentityManager.js";
10
- import S from "@arcgis/core/portal/Portal.js";
11
- const _ = {
12
- advanced: "gpt-5.2",
13
- default: "gpt-5-mini",
14
- fast: "gpt-5.4-nano"
2
+ import { Annotation as g } from "@langchain/langgraph/web";
3
+ import { d as z, r as T, m as V, c as K } from "./baseAgentState.js";
4
+ import m, { z as r } from "zod";
5
+ import { ChatPromptTemplate as q, SystemMessagePromptTemplate as B } from "@langchain/core/prompts";
6
+ import { s as h } from "./index.js";
7
+ import { AIMessage as H, isAIMessage as W, isToolMessage as X } from "@langchain/core/messages";
8
+ import { createAgent as G, summarizationMiddleware as J, modelCallLimitMiddleware as Q } from "langchain";
9
+ import { ChatOpenAI as Y, OpenAIEmbeddings as Z } from "@langchain/openai";
10
+ import F from "@arcgis/core/portal/Portal.js";
11
+ import U from "@arcgis/core/request.js";
12
+ import ee from "@arcgis/core/identity/IdentityManager.js";
13
+ import { generateGuid as te } from "@arcgis/toolkit/string";
14
+ import ne from "@arcgis/core/config.js";
15
+ const P = {
16
+ advanced: "gpt-5.6-sol",
17
+ default: "gpt-5.6-terra",
18
+ fast: "gpt-5.6-luna"
15
19
  }, k = {
16
20
  default: "text-embedding-ada-002"
17
- }, M = /* @__PURE__ */ new Map();
18
- let T = null;
19
- const Z = () => {
20
- const t = S.getDefault().helperServices;
21
+ }, S = /* @__PURE__ */ new Map();
22
+ let M = null;
23
+ const se = () => {
24
+ const t = F.getDefault().helperServices;
21
25
  if (!t?.aiModels?.url)
22
26
  throw new Error("AI Models Service URL is not defined in the portal's helper services.");
23
27
  return t.aiModels.url;
24
- }, P = async (e) => {
25
- const t = Z();
26
- M.size === 0 && (T || (T = (async () => {
28
+ }, j = async (e) => {
29
+ const t = se();
30
+ S.size === 0 && (M || (M = (async () => {
27
31
  try {
28
- const n = await fetch(`${t}/models`);
29
- if (!n.ok)
30
- throw new Error("Failed to fetch AI service discovery data.");
31
- (await n.json()).models.forEach((o) => M.set(o.name, o));
32
+ (await U(`${t}/models`)).data.models.forEach((s) => S.set(s.name, s));
32
33
  } catch (n) {
33
- throw T = null, n;
34
+ throw M = null, n;
34
35
  }
35
- })()), await T);
36
- const s = M.get(e);
37
- if (!s)
36
+ })()), await M);
37
+ const o = S.get(e);
38
+ if (!o)
38
39
  throw new Error(`Model '${e}' is not available in the discovery service.`);
39
- return s.endpoint;
40
- }, ee = async (e = "default") => await P(_[e]), te = async (e = "default") => await P(k[e]), u = (e, t) => t, q = (e, t) => ({
41
- ...e,
42
- ...t
43
- }), $ = (e = "", t) => {
44
- const s = typeof t == "string" ? t.trim() : "";
45
- if (!s)
46
- return e;
47
- const n = e.trim();
48
- if (!n)
49
- return s;
50
- if (n === s)
51
- return e;
52
- const i = n.split(`
53
-
54
- `);
55
- return i[i.length - 1]?.trim() === s ? e : `${e}
56
-
57
- ${s}`;
58
- }, j = () => ({
59
- userRequest: "",
60
- assignedTask: "",
61
- messages: [],
62
- priorSteps: [],
63
- sharedState: {}
64
- }), ne = () => ({
65
- agentExecutionContext: d({
66
- reducer: q,
67
- default: j
68
- }),
69
- outputMessage: d({
70
- reducer: $,
71
- default: () => ""
72
- }),
73
- summary: d({
74
- reducer: u,
75
- default: () => ""
40
+ return o.endpoint;
41
+ }, oe = async (e = "default") => await j(P[e]), ie = async (e = "default") => await j(k[e]), Le = g.Root({
42
+ agentExecutionContext: g({
43
+ default: K,
44
+ reducer: V
76
45
  }),
77
- status: d({
78
- reducer: u
79
- })
80
- }), Ee = () => ({
81
- ...ne(),
82
- sharedStatePatch: d({
83
- reducer: u
84
- })
85
- }), Ie = d.Root({
86
- agentExecutionContext: d({
87
- default: j,
88
- reducer: q
89
- }),
90
- currentIntent: d({
46
+ currentIntent: g({
91
47
  default: () => "none",
92
- reducer: u
48
+ reducer: T
93
49
  }),
94
- lastExecutedAgent: d({
50
+ routing: g({
51
+ default: () => ({ mode: "auto" }),
52
+ reducer: T
53
+ }),
54
+ lastExecutedAgent: g({
95
55
  default: () => "",
96
- reducer: u
56
+ reducer: T
97
57
  }),
98
- requiresFollowUp: d({
58
+ requiresFollowUp: g({
99
59
  default: () => !0,
100
- reducer: u
60
+ reducer: T
101
61
  }),
102
- stepCount: d({
62
+ stepCount: g({
103
63
  default: () => 0,
104
64
  reducer: (e, t) => t ?? e + 1
105
65
  }),
106
- finalOutputMessage: d({
66
+ finalOutputMessage: g({
107
67
  default: () => "",
108
- reducer: $
68
+ reducer: z
109
69
  })
110
- }), y = async (e, t) => {
111
- await F("trace_message", e, t);
112
- }, De = async (e, t) => {
113
- await F("graph_ux_suggestion", e, t);
114
- }, se = (e, t, s) => {
70
+ }), re = (e) => {
71
+ if (!e || typeof e != "object" || !("services" in e))
72
+ return !1;
73
+ const t = e.services;
74
+ return !!t && typeof t == "object" && "agentRegistry" in t;
75
+ }, ae = (e) => {
76
+ const t = e?.configurable;
77
+ return re(t) ? t : void 0;
78
+ }, ce = (e, t, o) => {
115
79
  const n = e[t];
116
- return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, o) => {
117
- (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(o.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== s ? ". Note that variables only represent file names one level deep." : ""))));
80
+ return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, s) => {
81
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(s.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== o ? ". Note that variables only represent file names one level deep." : ""))));
118
82
  });
119
- }, A = async (e) => (await se(/* @__PURE__ */ Object.assign({ "./field_descriptions_prompt.md": () => import("./field_descriptions_prompt.js"), "./intent_prompt.md": () => import("./intent_prompt.js"), "./layer_descriptions_prompt.md": () => import("./layer_descriptions_prompt.js") }), `./${e}.md`, 2)).default, ie = async (e) => {
120
- const { agent: t, messages: s, config: n } = e;
83
+ }, E = async (e) => (await ce(/* @__PURE__ */ Object.assign({ "./field_descriptions_prompt.md": () => import("./field_descriptions_prompt.js"), "./intent_prompt.md": () => import("./intent_prompt.js"), "./layer_descriptions_prompt.md": () => import("./layer_descriptions_prompt.js") }), `./${e}.md`, 2)).default, le = async (e) => {
84
+ const { agent: t, messages: o, config: n } = e;
121
85
  return { structuredResponse: (await t.invoke(
122
86
  {
123
- messages: s
87
+ messages: o
124
88
  },
125
89
  n
126
90
  )).structuredResponse };
127
- }, N = (e) => async (t, s) => {
128
- const n = new Headers(s?.headers);
129
- return n.delete("Authorization"), n.delete("api-key"), e && e.length > 0 && (n.set("X-Esri-Authorization", `Bearer ${e}`), n.set("X-Esri-Request-Source", "MapsSDK")), await fetch(t, {
130
- ...s,
131
- headers: n
132
- });
133
- }, x = async (e = "default", t = 0) => {
134
- const s = S.getDefault(), n = await U.getCredential(`${s.url}/sharing`), i = _[e], o = await ee(e);
135
- return new Q({
136
- modelName: i,
91
+ }, de = (e) => typeof e == "string" && e.length > 0 ? e : void 0, pe = () => te(), me = (e) => typeof e != "string" || e.trim().length === 0 ? "MapsSDK" : `MapsSDK - ${e.trim()}`, ue = (e) => {
92
+ const t = e?.configurable;
93
+ return {
94
+ conversationId: de(t?.thread_id),
95
+ abortSignal: e?.signal,
96
+ requestId: pe(),
97
+ requestSource: me(ne.applicationName)
98
+ };
99
+ }, ge = (e) => {
100
+ if (e == null || typeof e == "string" || e instanceof FormData || e instanceof HTMLFormElement)
101
+ return e;
102
+ if (e instanceof URLSearchParams)
103
+ return e.toString();
104
+ throw new TypeError(`Unsupported request body type: ${Object.prototype.toString.call(e)}`);
105
+ }, _ = async ({ config: e }) => {
106
+ const t = F.getDefault(), n = (await ee.getCredential(`${t.url}/sharing`))?.token;
107
+ return async (i, s) => {
108
+ const { conversationId: a, abortSignal: c, requestId: l, requestSource: p } = ue(e), d = new Headers(s?.headers);
109
+ for (const v of [...d.keys()]) {
110
+ const u = v.toLowerCase();
111
+ (u === "authorization" || u === "api-key" || u.startsWith("x-stainless-")) && d.delete(v);
112
+ }
113
+ n && n.length > 0 && d.set("X-Esri-Authorization", `Bearer ${n}`), t.isPortal || (p && p.length > 0 && d.set("X-Esri-Request-Source", p), a && a.length > 0 && d.set("X-Esri-Conversation-Id", a), l.length > 0 && d.set("X-Esri-Request-Id", l));
114
+ const b = c && s?.signal ? AbortSignal.any([c, s.signal]) : s?.signal ?? c;
115
+ return (await U(i instanceof Request ? i.url : i.toString(), {
116
+ body: ge(s?.body),
117
+ headers: Object.fromEntries(d),
118
+ responseType: "native",
119
+ signal: b
120
+ })).data;
121
+ };
122
+ }, w = async (e = {}) => {
123
+ const { modelTier: t = "default", config: o } = e, n = P[t], i = await oe(t);
124
+ return new Y({
125
+ modelName: n,
137
126
  apiKey: "dummy-key",
138
- // 5-mini does not support temperature parameter
139
- ...e !== "default" && { temperature: t },
140
127
  configuration: {
141
- baseURL: o,
142
- fetch: N(n.token)
128
+ baseURL: i,
129
+ fetch: await _({ config: o })
143
130
  }
144
131
  });
145
- }, Re = async (e = "default") => {
146
- const t = S.getDefault(), s = await U.getCredential(`${t.url}/sharing`), n = k[e], i = await te(e);
147
- return new Y({
132
+ }, ze = async (e = {}) => {
133
+ const { tier: t = "default", config: o } = e, n = k[t], i = await ie(t);
134
+ return new Z({
148
135
  modelName: n,
149
136
  apiKey: "dummy-key",
150
137
  configuration: {
151
138
  baseURL: i,
152
- fetch: N(s.token)
139
+ fetch: await _({ config: o })
153
140
  },
154
141
  batchSize: 2048,
155
142
  maxConcurrency: 10
156
143
  });
157
- }, re = r.object({
144
+ }, fe = r.object({
158
145
  id: r.string().min(1),
159
146
  name: r.string().min(1),
160
147
  description: r.string().min(1)
161
148
  });
162
- r.array(re);
163
- const D = (e) => JSON.stringify(e, null, 2), oe = (e) => {
164
- const t = e.map((n) => n.id), s = r.enum(t);
149
+ r.array(fe);
150
+ const A = (e) => JSON.stringify(e, null, 2), he = (e) => {
151
+ const t = e.map((n) => n.id), o = r.enum(t);
165
152
  return r.object({
166
- intent: s.nullable(),
153
+ intent: o.nullable(),
167
154
  assignedTask: r.string().nullable(),
168
155
  requiresFollowUp: r.boolean()
169
156
  });
170
- }, Ce = async (e, t) => {
157
+ }, Ve = async (e, t) => {
158
+ const o = ae(t);
159
+ if (t?.signal?.aborted)
160
+ return await h({ text: "Run cancelled; skipping intent routing" }, t), {
161
+ ...e,
162
+ currentIntent: "none",
163
+ finalOutputMessage: "Operation cancelled.",
164
+ requiresFollowUp: !1
165
+ };
171
166
  try {
172
- await y({ text: "Asking LLM to route to an agent" }, t);
173
- const i = (t?.configurable?.services.agentRegistry?.list() ?? []).map(({ agent: h }) => ({
174
- id: h.id,
175
- name: h.name,
176
- description: h.description
167
+ await h({ text: "Asking LLM to route to an agent" }, t);
168
+ const i = o.services.agentRegistry?.list() ?? [], s = i.map(({ agent: f }) => ({
169
+ id: f.id,
170
+ name: f.name,
171
+ description: f.description
177
172
  }));
178
- if (!i.length)
179
- return await y({ text: "No agents registered; skipping intent detection" }, t), { ...e, currentIntent: "none" };
180
- const o = await A("intent_prompt"), a = D(i), c = oe(i), l = {
181
- registeredAgents: a,
182
- priorSteps: D(e.agentExecutionContext.priorSteps),
173
+ if (!s.length)
174
+ return await h({ text: "No agents registered; skipping intent detection" }, t), {
175
+ ...e,
176
+ currentIntent: "none",
177
+ finalOutputMessage: "No agents registered; skipping intent detection."
178
+ };
179
+ const a = await E("intent_prompt"), c = A(s), l = he(s), p = {
180
+ registeredAgents: c,
181
+ priorSteps: A(e.agentExecutionContext.priorSteps),
183
182
  userRequest: e.agentExecutionContext.userRequest
184
- }, g = await C.fromTemplate(o).format(l), I = J({
185
- model: await x("fast"),
183
+ }, b = await q.fromTemplate(a).format(p), C = G({
184
+ model: await w({
185
+ modelTier: "fast",
186
+ config: t
187
+ }),
186
188
  tools: [],
187
- systemPrompt: g,
188
- checkpointer: !0,
189
- responseFormat: c,
189
+ systemPrompt: b,
190
+ responseFormat: l,
190
191
  middleware: [
191
192
  // Preserve recent conversation context while summarizing older messages
192
193
  // to control token usage without losing important intent signals.
193
194
  // The trigger and keep parameters can be tuned based on token limits and behavior.
194
- X({
195
- model: await x("fast"),
195
+ J({
196
+ model: await w({
197
+ modelTier: "fast",
198
+ config: t
199
+ }),
196
200
  trigger: { tokens: 4e3 },
197
201
  keep: { messages: 6 }
198
202
  }),
199
203
  // Enforce no loop/retry.
200
204
  // 1 usual LLM call and 1 optional summarization call.
201
- G({ runLimit: 2 })
205
+ Q({ runLimit: 2 })
202
206
  ]
203
- }), { structuredResponse: z } = await ie({
204
- agent: I,
207
+ }), { structuredResponse: v } = await le({
208
+ agent: C,
205
209
  messages: e.agentExecutionContext.messages,
206
210
  config: t
207
- }), f = c.parse(
208
- z ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
209
- ), v = f.intent ?? "none", L = {
211
+ }), u = l.parse(
212
+ v ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
213
+ ), x = u.intent ?? "none", N = {
210
214
  ...e,
211
- currentIntent: v,
212
- requiresFollowUp: f.requiresFollowUp,
215
+ currentIntent: x,
216
+ requiresFollowUp: u.requiresFollowUp,
213
217
  agentExecutionContext: {
214
218
  ...e.agentExecutionContext,
215
- assignedTask: f.assignedTask ?? ""
219
+ assignedTask: u.assignedTask ?? ""
216
220
  }
217
221
  };
218
- if (v === "none") {
219
- const h = "I could not find a matching agent for that request. Please rephrase your question with more detail.";
220
- return await y({ text: "LLM did not identify a clear intent." }, t), {
222
+ if (x === "none") {
223
+ const f = `I could not find an agent that can handle that request. I have access to the following agents: ${i.map(({ agent: L }) => L.name).join(", ")}.
224
+
225
+ Please ask a question that can be answered by one of these agents.`;
226
+ return await h({ text: "LLM did not identify a clear intent." }, t), {
221
227
  ...e,
222
- currentIntent: v,
228
+ currentIntent: x,
223
229
  requiresFollowUp: !1,
230
+ finalOutputMessage: f,
224
231
  agentExecutionContext: {
225
232
  ...e.agentExecutionContext,
226
233
  assignedTask: "",
227
- messages: [...e.agentExecutionContext.messages, new B(h)],
234
+ messages: [...e.agentExecutionContext.messages, new H(f)],
228
235
  priorSteps: [
229
236
  ...e.agentExecutionContext.priorSteps ?? [],
230
237
  {
@@ -237,31 +244,31 @@ const D = (e) => JSON.stringify(e, null, 2), oe = (e) => {
237
244
  }
238
245
  };
239
246
  }
240
- return await y(
247
+ return await h(
241
248
  {
242
- text: `Agent picked: ${v}
243
- Task Assigned: ${f.assignedTask ?? ""}
244
- Requires Follow-Up: ${f.requiresFollowUp}`
249
+ text: `Agent picked: ${x}
250
+ Task Assigned: ${u.assignedTask ?? ""}
251
+ Requires Follow-Up: ${u.requiresFollowUp}`
245
252
  },
246
253
  t
247
- ), L;
248
- } catch (s) {
249
- throw await y({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${s instanceof Error ? s.message : String(s)}`);
254
+ ), N;
255
+ } catch (n) {
256
+ throw await h({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
250
257
  }
251
- }, ae = "0.1", w = 1536, ce = "openai", le = k.default, de = `Name: {name}
258
+ }, ye = "0.1", y = 1536, we = "openai", be = k.default, ve = `Name: {name}
252
259
  Title: {title}
253
- Description: {description}`, pe = `Name: {name}
260
+ Description: {description}`, xe = `Name: {name}
254
261
  Alias: {alias}
255
- Description: {description}`, Fe = r.object({
256
- schemaVersion: r.literal(ae),
262
+ Description: {description}`, Ke = r.object({
263
+ schemaVersion: r.literal(ye),
257
264
  modified: r.number().int().nonnegative(),
258
265
  embeddings: r.object({
259
- modelProvider: r.literal(ce),
260
- model: r.literal(le),
261
- dimensions: r.literal(w),
266
+ modelProvider: r.literal(we),
267
+ model: r.literal(be),
268
+ dimensions: r.literal(y),
262
269
  templates: r.object({
263
- layer: r.string().default(de),
264
- field: r.string().default(pe)
270
+ layer: r.string().default(ve),
271
+ field: r.string().default(xe)
265
272
  })
266
273
  }),
267
274
  layers: r.array(
@@ -270,112 +277,112 @@ Description: {description}`, Fe = r.object({
270
277
  name: r.string().min(1),
271
278
  title: r.string().catch(""),
272
279
  description: r.string().catch(""),
273
- vector: r.array(r.number()).length(w, {
274
- message: `Layer vector must be exactly ${w} dimensions`
280
+ vector: r.array(r.number()).length(y, {
281
+ message: `Layer vector must be exactly ${y} dimensions`
275
282
  }),
276
283
  fields: r.array(
277
284
  r.object({
278
285
  name: r.string().min(1),
279
286
  alias: r.string().catch(""),
280
287
  description: r.string().catch(""),
281
- vector: r.array(r.number()).length(w, {
282
- message: `Field vector must be exactly ${w} dimensions`
288
+ vector: r.array(r.number()).length(y, {
289
+ message: `Field vector must be exactly ${y} dimensions`
283
290
  })
284
291
  })
285
292
  )
286
293
  })
287
294
  ).default([])
288
- }), me = (e) => {
295
+ }), Te = (e) => {
289
296
  const t = /* @__PURE__ */ new Set();
290
297
  for (const n of e)
291
298
  if (W(n)) {
292
299
  const i = n;
293
- i.tool_calls && i.tool_calls.length > 0 && i.tool_calls.forEach((o) => {
294
- o.id && t.add(o.id);
300
+ i.tool_calls && i.tool_calls.length > 0 && i.tool_calls.forEach((s) => {
301
+ s.id && t.add(s.id);
295
302
  });
296
303
  }
297
304
  return e.filter((n) => {
298
- if (H(n)) {
305
+ if (X(n)) {
299
306
  const i = n;
300
307
  return t.has(i.tool_call_id);
301
308
  }
302
309
  return !0;
303
310
  });
304
- }, E = (e, t) => {
305
- const s = K.fromTemplate(e);
306
- return C.fromMessages([s, ...t]);
307
- }, ue = async (e) => {
308
- const { promptText: t, modelTier: s, temperature: n, messages: i } = e, o = E(t, i ?? []), a = await x(s, n);
309
- return o.pipe(a);
310
- }, Ue = async (e) => {
311
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o } = e, c = await (await ue({
311
+ }, R = (e, t) => {
312
+ const o = B.fromTemplate(e);
313
+ return q.fromMessages([o, ...t]);
314
+ }, Me = async (e) => {
315
+ const { promptText: t, modelTier: o, messages: n, config: i } = e, s = R(t, n ?? []), a = await w({ modelTier: o, config: i });
316
+ return s.pipe(a);
317
+ }, Be = async (e) => {
318
+ const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, config: s } = e, c = await (await Me({
312
319
  promptText: t,
313
- modelTier: s,
314
- temperature: n,
315
- messages: i
316
- })).invoke(o ?? {});
320
+ modelTier: o,
321
+ messages: n,
322
+ config: s
323
+ })).invoke(i ?? {}, s);
317
324
  if (typeof c == "string")
318
325
  return c;
319
326
  const l = c.content;
320
327
  return typeof l == "string" ? l : JSON.stringify(l);
321
328
  }, O = async (e) => {
322
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, schema: a } = e, c = E(t, i ?? []), m = (await x(s, n)).withStructuredOutput(a);
323
- return await c.pipe(m).invoke(o ?? {});
324
- }, _e = async (e) => {
325
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, tools: a } = e, c = a.length > 0 ? me(i ?? []) : i ?? [], l = E(t, c), m = await x(s, n);
326
- return await l.pipe(m.bindTools(a)).invoke(o ?? {});
327
- }, ge = p.object({
328
- name: p.string(),
329
- description: p.string(),
330
- valueType: p.string(),
331
- alias: p.string()
332
- }), fe = p.object({
333
- fields: p.array(ge)
334
- }), V = (e, t) => e.getFieldAlias(t) ?? void 0, b = (e, t) => V(e, t.name) ?? t.alias ?? "", he = (e, t) => {
335
- const s = V(e, t.name);
336
- return !!(s && s !== (t.alias ?? ""));
329
+ const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, schema: s, config: a } = e, c = R(t, n ?? []), p = (await w({ modelTier: o, config: a })).withStructuredOutput(s);
330
+ return await c.pipe(p).invoke(i ?? {}, a);
331
+ }, He = async (e) => {
332
+ const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, tools: s, config: a } = e, c = s.length > 0 ? Te(n ?? []) : n ?? [], l = R(t, c), p = await w({ modelTier: o, config: a });
333
+ return await l.pipe(p.bindTools(s)).invoke(i ?? {}, a);
334
+ }, Se = m.object({
335
+ name: m.string(),
336
+ description: m.string(),
337
+ valueType: m.string(),
338
+ alias: m.string()
339
+ }), Ie = m.object({
340
+ fields: m.array(Se)
341
+ }), $ = (e, t) => e.getFieldAlias(t) ?? void 0, I = (e, t) => $(e, t.name) ?? t.alias ?? "", ke = (e, t) => {
342
+ const o = $(e, t.name);
343
+ return !!(o && o !== (t.alias ?? ""));
337
344
  };
338
- function R(e, t) {
339
- const s = /* @__PURE__ */ new Map();
345
+ function D(e, t) {
346
+ const o = /* @__PURE__ */ new Map();
340
347
  for (const n of e.fields) {
341
- const i = t.fields.find((l) => l.name === n.name), o = b(e, n), a = he(e, n), c = {
348
+ const i = t.fields.find((l) => l.name === n.name), s = I(e, n), a = ke(e, n), c = {
342
349
  name: n.name,
343
350
  type: n.type,
344
- alias: a ? o : i?.alias ?? o,
351
+ alias: a ? s : i?.alias ?? s,
345
352
  description: i?.description ?? n.description ?? "",
346
353
  valueType: i?.valueType ?? n.valueType ?? "",
347
354
  domain: e.getFieldDomain(n.name) ?? void 0
348
355
  };
349
- s.set(n.name, c);
356
+ o.set(n.name, c);
350
357
  }
351
- return s;
358
+ return o;
352
359
  }
353
- const Pe = async (e) => {
354
- const s = await A("field_descriptions_prompt"), n = e.fields.filter((a) => !(b(e, a) && a.description)).map((a) => {
355
- const { name: c, type: l, description: m } = a, g = b(e, a);
356
- return [`Name: ${c}`, `Type: ${l}`, `Alias: ${g}`, `Description: ${m ?? "N/A"}`].join(", ");
360
+ const We = async (e) => {
361
+ const o = await E("field_descriptions_prompt"), n = e.fields.filter((a) => !(I(e, a) && a.description)).map((a) => {
362
+ const { name: c, type: l, description: p } = a, d = I(e, a);
363
+ return [`Name: ${c}`, `Type: ${l}`, `Alias: ${d}`, `Description: ${p ?? "N/A"}`].join(", ");
357
364
  }).join(`
358
365
  `);
359
366
  if (n.length === 0)
360
- return R(e, { fields: [] });
367
+ return D(e, { fields: [] });
361
368
  const i = {
362
369
  existingItemTitle: e.portalItem?.title,
363
370
  existingItemDescription: e.portalItem?.description,
364
371
  existingLayerTitle: e.title,
365
372
  existingLayerDescription: e.portalItem?.description,
366
373
  fieldInformation: n
367
- }, o = await O({
368
- promptText: s,
369
- schema: fe,
374
+ }, s = await O({
375
+ promptText: o,
376
+ schema: Ie,
370
377
  inputVariables: i
371
378
  });
372
- return R(e, o);
373
- }, ye = p.object({
374
- title: p.string(),
375
- description: p.string(),
376
- name: p.string().nullable()
377
- }), qe = async (e, t) => {
378
- const n = await A("layer_descriptions_prompt"), i = Array.from(t.values()), o = {
379
+ return D(e, s);
380
+ }, Ee = m.object({
381
+ title: m.string(),
382
+ description: m.string(),
383
+ name: m.string().nullable()
384
+ }), Xe = async (e, t) => {
385
+ const n = await E("layer_descriptions_prompt"), i = Array.from(t.values()), s = {
379
386
  fieldInformation: JSON.stringify(i, null, 2),
380
387
  existingLayerTitle: e.title,
381
388
  existingLayerDescription: e.portalItem?.description,
@@ -384,30 +391,27 @@ const Pe = async (e) => {
384
391
  };
385
392
  return { ...await O({
386
393
  promptText: n,
387
- schema: ye,
388
- inputVariables: o
394
+ schema: Ee,
395
+ inputVariables: s
389
396
  }), name: e.title ?? null };
390
397
  };
391
398
  export {
392
- Ie as D,
393
- Fe as W,
394
- qe as a,
395
- ce as b,
396
- x as c,
397
- w as d,
398
- ae as e,
399
- pe as f,
400
- Pe as g,
401
- Ue as h,
399
+ Le as D,
400
+ Ke as W,
401
+ Xe as a,
402
+ we as b,
403
+ w as c,
404
+ y as d,
405
+ Be as e,
406
+ xe as f,
407
+ We as g,
408
+ He as h,
402
409
  O as i,
403
- _e as j,
404
- ne as k,
405
- de as l,
406
- le as m,
407
- Ee as n,
408
- De as o,
409
- te as p,
410
- Ce as q,
411
- Re as r,
412
- y as s
410
+ ie as j,
411
+ ae as k,
412
+ ve as l,
413
+ be as m,
414
+ Ve as n,
415
+ ze as o,
416
+ ye as s
413
417
  };