@arcgis/ai-components 5.2.0-next.9 → 5.2.0-next.91

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 (315) 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 +4 -2
  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 +109 -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 +52 -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 +154 -0
  60. package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
  61. package/dist/agents/tools/query/getTopFeatures/adapter.js +141 -0
  62. package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
  63. package/dist/agents/tools/query/queryFeatures/adapter.js +127 -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/2EY3BQQX.js +2 -0
  69. package/dist/cdn/2PTPBAIN.js +2 -0
  70. package/dist/cdn/34O57OGV.js +2 -0
  71. package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
  72. package/dist/cdn/434TAA3J.js +2 -0
  73. package/dist/cdn/4EBLRHYE.js +2 -0
  74. package/dist/cdn/4HDDRBIY.js +2 -0
  75. package/dist/cdn/4KOV2NEI.js +9 -0
  76. package/dist/cdn/4NJ2FF7H.js +2 -0
  77. package/dist/cdn/4OGR5QKS.js +2 -0
  78. package/dist/cdn/4WIDLQUH.js +2 -0
  79. package/dist/cdn/5FL5BTTX.js +66 -0
  80. package/dist/cdn/5WYRJMBW.js +2 -0
  81. package/dist/cdn/5X7EG7D2.js +2 -0
  82. package/dist/cdn/5ZFUGNRN.js +2 -0
  83. package/dist/cdn/6HF36IKA.js +2 -0
  84. package/dist/cdn/6KFMRBAA.js +2 -0
  85. package/dist/cdn/6VJXUIXY.js +3 -0
  86. package/dist/cdn/7BCQMK6D.js +2 -0
  87. package/dist/cdn/7DFXYMEA.js +2 -0
  88. package/dist/cdn/7M6VKBTK.js +6 -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/7ZFAFKJT.js +2 -0
  93. package/dist/cdn/ACJTJLZN.js +2 -0
  94. package/dist/cdn/AI6DYOKR.js +181 -0
  95. package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
  96. package/dist/cdn/APFZY4PI.js +2 -0
  97. package/dist/cdn/AT4XVTJR.js +44 -0
  98. package/dist/cdn/AZCIDPML.js +2 -0
  99. package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
  100. package/dist/cdn/C5ZL5Z52.js +18 -0
  101. package/dist/cdn/CCC6LBMY.js +2 -0
  102. package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
  103. package/dist/cdn/CJMUJXPL.js +2 -0
  104. package/dist/cdn/COL6QYGQ.js +2 -0
  105. package/dist/cdn/CP5BVGJU.js +2 -0
  106. package/dist/cdn/CZM4URK7.js +2 -0
  107. package/dist/cdn/DP6O6PMH.js +2 -0
  108. package/dist/cdn/{V2P4AIGG.js → EKB7CAMM.js} +1 -1
  109. package/dist/cdn/EWLXNGKH.js +208 -0
  110. package/dist/cdn/EYNEYD34.js +2 -0
  111. package/dist/cdn/FDDQ67BG.js +2 -0
  112. package/dist/cdn/FDOMMK2M.js +2 -0
  113. package/dist/cdn/FQH3HOFH.js +2 -0
  114. package/dist/cdn/{GGSZM7KV.js → FUZ77UGP.js} +6 -4
  115. package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
  116. package/dist/cdn/GFEOVHJK.js +2 -0
  117. package/dist/cdn/HHFNQR6Z.js +2 -0
  118. package/dist/cdn/HIPQ3VRW.js +2 -0
  119. package/dist/cdn/HKSFWTWK.js +14 -0
  120. package/dist/cdn/HMUWQCXU.js +2 -0
  121. package/dist/cdn/IBZ2NEAO.js +2 -0
  122. package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
  123. package/dist/cdn/IHP25JWI.js +99 -0
  124. package/dist/cdn/J6A4AS7E.js +22 -0
  125. package/dist/cdn/J6SZIQJA.js +2 -0
  126. package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
  127. package/dist/cdn/JJJZ7FOM.js +2 -0
  128. package/dist/cdn/JKIESH74.js +2 -0
  129. package/dist/cdn/JO5ETMPS.js +2 -0
  130. package/dist/cdn/K2R6XVK3.js +2 -0
  131. package/dist/cdn/KCU4FWF7.js +2 -0
  132. package/dist/cdn/KITIP6J2.js +2 -0
  133. package/dist/cdn/KWD2ECTM.js +2 -0
  134. package/dist/cdn/{7RCQFLPP.js → LK7ZIQW6.js} +1 -1
  135. package/dist/cdn/LLUGJKAQ.js +2 -0
  136. package/dist/cdn/LPR72QZF.js +36 -0
  137. package/dist/cdn/{DHOVCT6R.js → MKOQJXQQ.js} +1 -1
  138. package/dist/cdn/MWYBF3F3.js +66 -0
  139. package/dist/cdn/NEV6OZN3.js +71 -0
  140. package/dist/cdn/OAKRPM7D.js +2 -0
  141. package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
  142. package/dist/cdn/OL5656NI.js +2 -0
  143. package/dist/cdn/ONQ6JSBJ.js +2 -0
  144. package/dist/cdn/OWTGH34K.js +2 -0
  145. package/dist/cdn/OYSPNIJI.js +156 -0
  146. package/dist/cdn/PEYYWXFE.js +2 -0
  147. package/dist/cdn/PKUDO2RC.js +3 -0
  148. package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
  149. package/dist/cdn/PSYRZMX2.js +2 -0
  150. package/dist/cdn/PUHRBGKB.js +2 -0
  151. package/dist/cdn/Q57QWN5W.js +2 -0
  152. package/dist/cdn/QCFICJ7U.js +3 -0
  153. package/dist/cdn/QNNGPA3Q.js +2 -0
  154. package/dist/cdn/R74ZHFA6.js +2 -0
  155. package/dist/cdn/RBE55SWR.js +2 -0
  156. package/dist/cdn/RHYNE5OE.js +2 -0
  157. package/dist/cdn/RLEHNAIA.js +2 -0
  158. package/dist/cdn/RSNGZQCQ.js +2 -0
  159. package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
  160. package/dist/cdn/SHD6YFSR.js +2 -0
  161. package/dist/cdn/SUYWKYWI.js +22 -0
  162. package/dist/cdn/SZ2QSSB3.js +2 -0
  163. package/dist/cdn/T4RIGOXB.js +2 -0
  164. package/dist/cdn/{3PKJWIC3.js → TMZ6DF22.js} +1 -1
  165. package/dist/cdn/TPULIO6I.js +34 -0
  166. package/dist/cdn/U2D53TAX.js +14 -0
  167. package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
  168. package/dist/cdn/UHZG7SKO.js +2 -0
  169. package/dist/cdn/UZLQALHY.js +2 -0
  170. package/dist/cdn/V52XWEGV.js +11 -0
  171. package/dist/cdn/V6F3HEK7.js +2 -0
  172. package/dist/cdn/V6HOUZPZ.js +2 -0
  173. package/dist/cdn/VAXH6RUQ.js +134 -0
  174. package/dist/cdn/VLLZ2FFU.js +2 -0
  175. package/dist/cdn/VNJMTA6O.js +2 -0
  176. package/dist/cdn/VOKXKU7M.js +56 -0
  177. package/dist/cdn/VXFQANGJ.js +2 -0
  178. package/dist/cdn/W5JPJWMM.js +2 -0
  179. package/dist/cdn/WKTQVBFJ.js +2 -0
  180. package/dist/cdn/WNNMKCKS.js +2 -0
  181. package/dist/cdn/WP7ORLSB.js +6 -0
  182. package/dist/cdn/WR2SQX3J.js +2 -0
  183. package/dist/cdn/X3COUAXY.js +4 -0
  184. package/dist/cdn/Y7XD7ZRD.js +2 -0
  185. package/dist/cdn/YEZ3AMNX.js +2 -0
  186. package/dist/cdn/YLVJA4ZE.js +2 -0
  187. package/dist/cdn/YQSU6IUO.js +2 -0
  188. package/dist/cdn/Z5W4V7RC.js +2 -0
  189. package/dist/cdn/ZLWWWTH4.js +2 -0
  190. package/dist/cdn/ZOEMBHRF.js +2 -0
  191. package/dist/cdn/ZQMBJ6MI.js +2 -0
  192. package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
  193. package/dist/cdn/ZVGUAOXE.js +2 -0
  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/chunks/adapter.js +1299 -2113
  205. package/dist/chunks/arcgisKnowledgeGraph.js +128 -72
  206. package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
  207. package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
  208. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
  209. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
  210. package/dist/chunks/baseAgentState.js +56 -0
  211. package/dist/chunks/converterUtils.js +66 -41
  212. package/dist/chunks/dataExplorationGraph.js +133 -177
  213. package/dist/chunks/data_explore_query_prompt.js +9 -4
  214. package/dist/chunks/fetchAgentContext.js +13 -0
  215. package/dist/chunks/fetchService.js +10 -0
  216. package/dist/chunks/fieldStatistics.js +79 -0
  217. package/dist/chunks/formatFeatureAttributes.js +132 -0
  218. package/dist/chunks/generateLayerDescriptions.js +259 -282
  219. package/dist/chunks/helpGraph.js +35 -25
  220. package/dist/chunks/help_prompt.js +34 -17
  221. package/dist/chunks/index.js +11 -0
  222. package/dist/chunks/intent_prompt.js +16 -0
  223. package/dist/chunks/layerStylingGraph.js +37 -31
  224. package/dist/chunks/mergeWhereClauses.js +15 -0
  225. package/dist/chunks/navigationGraph.js +124 -103
  226. package/dist/chunks/navigation_intent_prompt.js +8 -2
  227. package/dist/chunks/orchestrator.js +298 -139
  228. package/dist/chunks/slottableRequestUtils.js +3 -7
  229. package/dist/chunks/state.js +21 -27
  230. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  231. package/dist/chunks/toolCallResponse.js +14 -10
  232. package/dist/chunks/types.js +59 -0
  233. package/dist/chunks/utils2.js +11 -11
  234. package/dist/components/arcgis-assistant/customElement.d.ts +72 -0
  235. package/dist/components/arcgis-assistant/customElement.js +416 -172
  236. package/dist/components/arcgis-assistant/index.js +2 -3
  237. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  238. package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
  239. package/dist/components/arcgis-assistant-agent/customElement.js +614 -10
  240. package/dist/components/arcgis-assistant-chat/customElement.d.ts +2 -1
  241. package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
  242. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -0
  243. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  244. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +20 -4
  245. package/dist/components/arcgis-assistant-help-agent/customElement.js +29 -7
  246. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -0
  247. package/dist/components/arcgis-assistant-interrupt/customElement.js +17 -14
  248. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +24 -0
  249. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  250. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  251. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +40 -16
  252. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +30 -7
  253. package/dist/components/arcgis-assistant-message/customElement.d.ts +5 -0
  254. package/dist/components/arcgis-assistant-message/customElement.js +29 -26
  255. package/dist/components/arcgis-assistant-message/index.js +2 -0
  256. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  257. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  258. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +7 -0
  259. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -7
  260. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  261. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
  262. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  263. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +18 -4
  264. package/dist/components/arcgis-assistant-speech-input/customElement.js +34 -52
  265. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  266. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
  267. package/dist/components/arcgis-assistant-user-message/customElement.js +15 -10
  268. package/dist/docs/api.json +1 -1
  269. package/dist/docs/docs.json +1 -1
  270. package/dist/docs/vscode.html-custom-data.json +1 -1
  271. package/dist/docs/web-types.json +1 -1
  272. package/dist/loader.js +9 -8
  273. package/dist/oauth-callback.html +1 -1
  274. package/dist/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
  275. package/dist/types/lumina.d.ts +10 -8
  276. package/dist/types/preact.d.ts +10 -8
  277. package/dist/types/react.d.ts +10 -8
  278. package/dist/types/stencil.d.ts +12 -10
  279. package/dist/utils/index.d.ts +8 -8
  280. package/dist/utils/index.js +56 -55
  281. package/package.json +32 -12
  282. package/dist/cdn/2AXF774U.js +0 -2
  283. package/dist/cdn/462JBSEV.js +0 -422
  284. package/dist/cdn/53ZCUPKK.js +0 -22
  285. package/dist/cdn/5QAHYX7Y.js +0 -5
  286. package/dist/cdn/5XRDJL7R.js +0 -14
  287. package/dist/cdn/7BCR6TUO.js +0 -2
  288. package/dist/cdn/7GH7VSB2.js +0 -2
  289. package/dist/cdn/7PLV4QH6.js +0 -2
  290. package/dist/cdn/AXDZBBNL.js +0 -45
  291. package/dist/cdn/DDLZOMUY.js +0 -2
  292. package/dist/cdn/EECZLT6C.js +0 -166
  293. package/dist/cdn/ETRWZ3MS.js +0 -108
  294. package/dist/cdn/F2AHA4GB.js +0 -54
  295. package/dist/cdn/FX5JFRDL.js +0 -2
  296. package/dist/cdn/H7422XUG.js +0 -2
  297. package/dist/cdn/HB5A5R2E.js +0 -2
  298. package/dist/cdn/I6HNBTWY.js +0 -2
  299. package/dist/cdn/I7SRZPVS.js +0 -72
  300. package/dist/cdn/IG6YKZH3.js +0 -3
  301. package/dist/cdn/JVIKKZND.js +0 -3
  302. package/dist/cdn/KMQ3SP4I.js +0 -5
  303. package/dist/cdn/MH5RPXHM.js +0 -2
  304. package/dist/cdn/NVI3I46B.js +0 -2
  305. package/dist/cdn/OAVEHGB6.js +0 -2
  306. package/dist/cdn/OH64RMOR.js +0 -4
  307. package/dist/cdn/P26NON3Z.js +0 -16
  308. package/dist/cdn/QR54T33D.js +0 -2
  309. package/dist/cdn/RVOAPUBN.js +0 -2
  310. package/dist/cdn/S3VPZFWQ.js +0 -36
  311. package/dist/cdn/SXDLXCIM.js +0 -2
  312. package/dist/cdn/TR7RL3IK.js +0 -2
  313. package/dist/cdn/USMDJUFS.js +0 -2
  314. package/dist/cdn/Y333DGV6.js +0 -2
  315. package/dist/cdn/YIMNOUTF.js +0 -2
@@ -1,255 +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 o } from "zod";
4
- import { ChatPromptTemplate as F, SystemMessagePromptTemplate as W } from "@langchain/core/prompts";
5
- import { dispatchCustomEvent as U } from "@langchain/core/callbacks/dispatch/web";
6
- import { AIMessage as H, isAIMessage as J, isToolMessage as X } from "@langchain/core/messages";
7
- import { createAgent as G, summarizationMiddleware as Q, modelCallLimitMiddleware as Y } from "langchain";
8
- import { ChatOpenAI as Z, OpenAIEmbeddings as ee } from "@langchain/openai";
9
- import _ from "@arcgis/core/identity/IdentityManager.js";
10
- import k from "@arcgis/core/portal/Portal.js";
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";
11
15
  const P = {
12
- advanced: "gpt-5.2",
13
- default: "gpt-5-mini",
14
- fast: "gpt-5.4-nano"
15
- }, A = {
16
+ advanced: "gpt-5.6-sol",
17
+ default: "gpt-5.6-terra",
18
+ fast: "gpt-5.6-luna"
19
+ }, k = {
16
20
  default: "text-embedding-ada-002"
17
- }, M = /* @__PURE__ */ new Map();
18
- let v = null;
19
- const te = () => {
20
- const t = k.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
- }, q = async (e) => {
25
- const t = te();
26
- M.size === 0 && (v || (v = (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((i) => M.set(i.name, i));
32
+ (await U(`${t}/models`)).data.models.forEach((s) => S.set(s.name, s));
32
33
  } catch (n) {
33
- throw v = null, n;
34
+ throw M = null, n;
34
35
  }
35
- })()), await v);
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
- }, ne = async (e = "default") => await q(P[e]), se = async (e = "default") => await q(A[e]), h = (e, t) => t, j = (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 a = n.split(`
53
-
54
- `);
55
- return a[a.length - 1]?.trim() === s ? e : `${e}
56
-
57
- ${s}`;
58
- }, N = () => ({
59
- userRequest: "",
60
- assignedTask: "",
61
- messages: [],
62
- priorSteps: [],
63
- sharedState: {}
64
- }), ae = () => ({
65
- agentExecutionContext: d({
66
- reducer: j,
67
- default: N
68
- }),
69
- outputMessage: d({
70
- reducer: $,
71
- 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
72
45
  }),
73
- summary: d({
74
- reducer: h,
75
- default: () => ""
76
- }),
77
- status: d({
78
- reducer: h
79
- })
80
- }), De = () => ({
81
- ...ae(),
82
- sharedStatePatch: d({
83
- reducer: h
84
- })
85
- }), Fe = d.Root({
86
- agentExecutionContext: d({
87
- default: N,
88
- reducer: j
89
- }),
90
- currentIntent: d({
46
+ currentIntent: g({
91
47
  default: () => "none",
92
- reducer: h
48
+ reducer: T
49
+ }),
50
+ routing: g({
51
+ default: () => ({ mode: "auto" }),
52
+ reducer: T
93
53
  }),
94
- lastExecutedAgent: d({
54
+ lastExecutedAgent: g({
95
55
  default: () => "",
96
- reducer: h
56
+ reducer: T
97
57
  }),
98
- requiresFollowUp: d({
58
+ requiresFollowUp: g({
99
59
  default: () => !0,
100
- reducer: h
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
- }), f = async (e, t) => {
111
- await U("trace_message", e, t);
112
- }, Ue = async (e, t) => {
113
- await U("graph_ux_suggestion", e, t);
114
- }, ie = (e) => {
70
+ }), re = (e) => {
115
71
  if (!e || typeof e != "object" || !("services" in e))
116
72
  return !1;
117
73
  const t = e.services;
118
74
  return !!t && typeof t == "object" && "agentRegistry" in t;
119
- }, oe = (e) => {
75
+ }, ae = (e) => {
120
76
  const t = e?.configurable;
121
- return ie(t) ? t : void 0;
122
- }, re = (e, t, s) => {
77
+ return re(t) ? t : void 0;
78
+ }, ce = (e, t, o) => {
123
79
  const n = e[t];
124
- return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((a, i) => {
125
- (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(i.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." : ""))));
126
82
  });
127
- }, I = async (e) => (await re(/* @__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, ce = async (e) => {
128
- 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;
129
85
  return { structuredResponse: (await t.invoke(
130
86
  {
131
- messages: s
87
+ messages: o
132
88
  },
133
89
  n
134
90
  )).structuredResponse };
135
- }, O = (e, t) => async (s, n) => {
136
- const a = new Headers(n?.headers);
137
- a.delete("Authorization"), a.delete("api-key"), e && e.length > 0 && (a.set("X-Esri-Authorization", `Bearer ${e}`), a.set("X-Esri-Request-Source", "MapsSDK"));
138
- const i = t && n?.signal ? AbortSignal.any([t, n.signal]) : n?.signal ?? t;
139
- return await fetch(s, {
140
- ...n,
141
- headers: a,
142
- signal: i
143
- });
144
- }, b = async (e = {}) => {
145
- const { modelTier: t = "default", temperature: s = 0, abortSignal: n } = e, a = k.getDefault(), i = await _.getCredential(`${a.url}/sharing`), r = P[t], c = await ne(t);
146
- return new Z({
147
- modelName: r,
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,
148
126
  apiKey: "dummy-key",
149
- // 5-mini does not support temperature parameter
150
- ...t !== "default" && { temperature: s },
151
127
  configuration: {
152
- baseURL: c,
153
- fetch: O(i.token, n)
128
+ baseURL: i,
129
+ fetch: await _({ config: o })
154
130
  }
155
131
  });
156
- }, _e = async (e = "default", t) => {
157
- const s = k.getDefault(), n = await _.getCredential(`${s.url}/sharing`), a = A[e], i = await se(e);
158
- return new ee({
159
- modelName: a,
132
+ }, ze = async (e = {}) => {
133
+ const { tier: t = "default", config: o } = e, n = k[t], i = await ie(t);
134
+ return new Z({
135
+ modelName: n,
160
136
  apiKey: "dummy-key",
161
137
  configuration: {
162
138
  baseURL: i,
163
- fetch: O(n.token, t)
139
+ fetch: await _({ config: o })
164
140
  },
165
141
  batchSize: 2048,
166
142
  maxConcurrency: 10
167
143
  });
168
- }, le = o.object({
169
- id: o.string().min(1),
170
- name: o.string().min(1),
171
- description: o.string().min(1)
144
+ }, fe = r.object({
145
+ id: r.string().min(1),
146
+ name: r.string().min(1),
147
+ description: r.string().min(1)
172
148
  });
173
- o.array(le);
174
- const R = (e) => JSON.stringify(e, null, 2), de = (e) => {
175
- const t = e.map((n) => n.id), s = o.enum(t);
176
- return o.object({
177
- intent: s.nullable(),
178
- assignedTask: o.string().nullable(),
179
- requiresFollowUp: o.boolean()
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);
152
+ return r.object({
153
+ intent: o.nullable(),
154
+ assignedTask: r.string().nullable(),
155
+ requiresFollowUp: r.boolean()
180
156
  });
181
- }, Pe = async (e, t) => {
182
- const s = oe(t);
183
- if (s.abortSignal?.aborted)
184
- return await f({ text: "Run cancelled; skipping intent routing" }, 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), {
185
161
  ...e,
186
162
  currentIntent: "none",
187
163
  finalOutputMessage: "Operation cancelled.",
188
164
  requiresFollowUp: !1
189
165
  };
190
166
  try {
191
- await f({ text: "Asking LLM to route to an agent" }, t);
192
- const a = s.services.agentRegistry?.list() ?? [], i = a.map(({ agent: g }) => ({
193
- id: g.id,
194
- name: g.name,
195
- description: g.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
196
172
  }));
197
- if (!i.length)
198
- return await f({ text: "No agents registered; skipping intent detection" }, t), {
173
+ if (!s.length)
174
+ return await h({ text: "No agents registered; skipping intent detection" }, t), {
199
175
  ...e,
200
176
  currentIntent: "none",
201
177
  finalOutputMessage: "No agents registered; skipping intent detection."
202
178
  };
203
- const r = await I("intent_prompt"), c = R(i), l = de(i), m = {
179
+ const a = await E("intent_prompt"), c = A(s), l = he(s), p = {
204
180
  registeredAgents: c,
205
- priorSteps: R(e.agentExecutionContext.priorSteps),
181
+ priorSteps: A(e.agentExecutionContext.priorSteps),
206
182
  userRequest: e.agentExecutionContext.userRequest
207
- }, T = await F.fromTemplate(r).format(m), C = G({
208
- model: await b({ modelTier: "fast", abortSignal: s.abortSignal }),
183
+ }, b = await q.fromTemplate(a).format(p), C = G({
184
+ model: await w({
185
+ modelTier: "fast",
186
+ config: t
187
+ }),
209
188
  tools: [],
210
- systemPrompt: T,
189
+ systemPrompt: b,
211
190
  responseFormat: l,
212
191
  middleware: [
213
192
  // Preserve recent conversation context while summarizing older messages
214
193
  // to control token usage without losing important intent signals.
215
194
  // The trigger and keep parameters can be tuned based on token limits and behavior.
216
- Q({
217
- model: await b({ modelTier: "fast", abortSignal: s.abortSignal }),
195
+ J({
196
+ model: await w({
197
+ modelTier: "fast",
198
+ config: t
199
+ }),
218
200
  trigger: { tokens: 4e3 },
219
201
  keep: { messages: 6 }
220
202
  }),
221
203
  // Enforce no loop/retry.
222
204
  // 1 usual LLM call and 1 optional summarization call.
223
- Y({ runLimit: 2 })
205
+ Q({ runLimit: 2 })
224
206
  ]
225
- }), { structuredResponse: L } = await ce({
207
+ }), { structuredResponse: v } = await le({
226
208
  agent: C,
227
209
  messages: e.agentExecutionContext.messages,
228
210
  config: t
229
- }), y = l.parse(
230
- L ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
231
- ), x = y.intent ?? "none", K = {
211
+ }), u = l.parse(
212
+ v ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
213
+ ), x = u.intent ?? "none", N = {
232
214
  ...e,
233
215
  currentIntent: x,
234
- requiresFollowUp: y.requiresFollowUp,
216
+ requiresFollowUp: u.requiresFollowUp,
235
217
  agentExecutionContext: {
236
218
  ...e.agentExecutionContext,
237
- assignedTask: y.assignedTask ?? ""
219
+ assignedTask: u.assignedTask ?? ""
238
220
  }
239
221
  };
240
222
  if (x === "none") {
241
- const g = `I could not find an agent that can handle that request. I have access to the following agents: ${a.map(({ agent: B }) => B.name).join(", ")}.
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(", ")}.
242
224
 
243
225
  Please ask a question that can be answered by one of these agents.`;
244
- return await f({ text: "LLM did not identify a clear intent." }, t), {
226
+ return await h({ text: "LLM did not identify a clear intent." }, t), {
245
227
  ...e,
246
228
  currentIntent: x,
247
229
  requiresFollowUp: !1,
248
- finalOutputMessage: g,
230
+ finalOutputMessage: f,
249
231
  agentExecutionContext: {
250
232
  ...e.agentExecutionContext,
251
233
  assignedTask: "",
252
- messages: [...e.agentExecutionContext.messages, new H(g)],
234
+ messages: [...e.agentExecutionContext.messages, new H(f)],
253
235
  priorSteps: [
254
236
  ...e.agentExecutionContext.priorSteps ?? [],
255
237
  {
@@ -262,179 +244,174 @@ Please ask a question that can be answered by one of these agents.`;
262
244
  }
263
245
  };
264
246
  }
265
- return await f(
247
+ return await h(
266
248
  {
267
249
  text: `Agent picked: ${x}
268
- Task Assigned: ${y.assignedTask ?? ""}
269
- Requires Follow-Up: ${y.requiresFollowUp}`
250
+ Task Assigned: ${u.assignedTask ?? ""}
251
+ Requires Follow-Up: ${u.requiresFollowUp}`
270
252
  },
271
253
  t
272
- ), K;
254
+ ), N;
273
255
  } catch (n) {
274
- throw await f({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
256
+ throw await h({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
275
257
  }
276
- }, pe = "0.1", w = 1536, me = "openai", ue = A.default, ge = `Name: {name}
258
+ }, ye = "0.1", y = 1536, we = "openai", be = k.default, ve = `Name: {name}
277
259
  Title: {title}
278
- Description: {description}`, fe = `Name: {name}
260
+ Description: {description}`, xe = `Name: {name}
279
261
  Alias: {alias}
280
- Description: {description}`, qe = o.object({
281
- schemaVersion: o.literal(pe),
282
- modified: o.number().int().nonnegative(),
283
- embeddings: o.object({
284
- modelProvider: o.literal(me),
285
- model: o.literal(ue),
286
- dimensions: o.literal(w),
287
- templates: o.object({
288
- layer: o.string().default(ge),
289
- field: o.string().default(fe)
262
+ Description: {description}`, Ke = r.object({
263
+ schemaVersion: r.literal(ye),
264
+ modified: r.number().int().nonnegative(),
265
+ embeddings: r.object({
266
+ modelProvider: r.literal(we),
267
+ model: r.literal(be),
268
+ dimensions: r.literal(y),
269
+ templates: r.object({
270
+ layer: r.string().default(ve),
271
+ field: r.string().default(xe)
290
272
  })
291
273
  }),
292
- layers: o.array(
293
- o.object({
294
- id: o.string().min(1),
295
- name: o.string().min(1),
296
- title: o.string().catch(""),
297
- description: o.string().catch(""),
298
- vector: o.array(o.number()).length(w, {
299
- message: `Layer vector must be exactly ${w} dimensions`
274
+ layers: r.array(
275
+ r.object({
276
+ id: r.string().min(1),
277
+ name: r.string().min(1),
278
+ title: r.string().catch(""),
279
+ description: r.string().catch(""),
280
+ vector: r.array(r.number()).length(y, {
281
+ message: `Layer vector must be exactly ${y} dimensions`
300
282
  }),
301
- fields: o.array(
302
- o.object({
303
- name: o.string().min(1),
304
- alias: o.string().catch(""),
305
- description: o.string().catch(""),
306
- vector: o.array(o.number()).length(w, {
307
- message: `Field vector must be exactly ${w} dimensions`
283
+ fields: r.array(
284
+ r.object({
285
+ name: r.string().min(1),
286
+ alias: r.string().catch(""),
287
+ description: r.string().catch(""),
288
+ vector: r.array(r.number()).length(y, {
289
+ message: `Field vector must be exactly ${y} dimensions`
308
290
  })
309
291
  })
310
292
  )
311
293
  })
312
294
  ).default([])
313
- }), he = (e) => {
295
+ }), Te = (e) => {
314
296
  const t = /* @__PURE__ */ new Set();
315
297
  for (const n of e)
316
- if (J(n)) {
317
- const a = n;
318
- a.tool_calls && a.tool_calls.length > 0 && a.tool_calls.forEach((i) => {
319
- i.id && t.add(i.id);
298
+ if (W(n)) {
299
+ const i = n;
300
+ i.tool_calls && i.tool_calls.length > 0 && i.tool_calls.forEach((s) => {
301
+ s.id && t.add(s.id);
320
302
  });
321
303
  }
322
304
  return e.filter((n) => {
323
305
  if (X(n)) {
324
- const a = n;
325
- return t.has(a.tool_call_id);
306
+ const i = n;
307
+ return t.has(i.tool_call_id);
326
308
  }
327
309
  return !0;
328
310
  });
329
- }, E = (e, t) => {
330
- const s = W.fromTemplate(e);
331
- return F.fromMessages([s, ...t]);
332
- }, ye = async (e) => {
333
- const { promptText: t, modelTier: s, temperature: n, messages: a, abortSignal: i } = e, r = E(t, a ?? []), c = await b({ modelTier: s, temperature: n, abortSignal: i });
334
- return r.pipe(c);
335
- }, je = async (e) => {
336
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: a, inputVariables: i, abortSignal: r } = e, l = await (await ye({
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({
337
319
  promptText: t,
338
- modelTier: s,
339
- temperature: n,
340
- messages: a,
341
- abortSignal: r
342
- })).invoke(i ?? {});
343
- if (typeof l == "string")
344
- return l;
345
- const m = l.content;
346
- return typeof m == "string" ? m : JSON.stringify(m);
347
- }, V = async (e) => {
348
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: a, inputVariables: i, schema: r, abortSignal: c } = e, l = E(t, a ?? []), u = (await b({ modelTier: s, temperature: n, abortSignal: c })).withStructuredOutput(r);
349
- return await l.pipe(u).invoke(i ?? {});
350
- }, $e = async (e) => {
351
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: a, inputVariables: i, tools: r, abortSignal: c } = e, l = r.length > 0 ? he(a ?? []) : a ?? [], m = E(t, l), u = await b({ modelTier: s, temperature: n, abortSignal: c });
352
- return await m.pipe(u.bindTools(r)).invoke(i ?? {});
353
- }, we = p.object({
354
- name: p.string(),
355
- description: p.string(),
356
- valueType: p.string(),
357
- alias: p.string()
358
- }), be = p.object({
359
- fields: p.array(we)
360
- }), z = (e, t) => e.getFieldAlias(t) ?? void 0, S = (e, t) => z(e, t.name) ?? t.alias ?? "", xe = (e, t) => {
361
- const s = z(e, t.name);
362
- return !!(s && s !== (t.alias ?? ""));
320
+ modelTier: o,
321
+ messages: n,
322
+ config: s
323
+ })).invoke(i ?? {}, s);
324
+ if (typeof c == "string")
325
+ return c;
326
+ const l = c.content;
327
+ return typeof l == "string" ? l : JSON.stringify(l);
328
+ }, O = async (e) => {
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 ?? ""));
363
344
  };
364
345
  function D(e, t) {
365
- const s = /* @__PURE__ */ new Map();
346
+ const o = /* @__PURE__ */ new Map();
366
347
  for (const n of e.fields) {
367
- const a = t.fields.find((l) => l.name === n.name), i = S(e, n), r = xe(e, n), c = {
348
+ const i = t.fields.find((l) => l.name === n.name), s = I(e, n), a = ke(e, n), c = {
368
349
  name: n.name,
369
350
  type: n.type,
370
- alias: r ? i : a?.alias ?? i,
371
- description: a?.description ?? n.description ?? "",
372
- valueType: a?.valueType ?? n.valueType ?? "",
351
+ alias: a ? s : i?.alias ?? s,
352
+ description: i?.description ?? n.description ?? "",
353
+ valueType: i?.valueType ?? n.valueType ?? "",
373
354
  domain: e.getFieldDomain(n.name) ?? void 0
374
355
  };
375
- s.set(n.name, c);
356
+ o.set(n.name, c);
376
357
  }
377
- return s;
358
+ return o;
378
359
  }
379
- const Ne = async (e) => {
380
- const s = await I("field_descriptions_prompt"), n = e.fields.filter((r) => !(S(e, r) && r.description)).map((r) => {
381
- const { name: c, type: l, description: m } = r, u = S(e, r);
382
- return [`Name: ${c}`, `Type: ${l}`, `Alias: ${u}`, `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(", ");
383
364
  }).join(`
384
365
  `);
385
366
  if (n.length === 0)
386
367
  return D(e, { fields: [] });
387
- const a = {
368
+ const i = {
388
369
  existingItemTitle: e.portalItem?.title,
389
370
  existingItemDescription: e.portalItem?.description,
390
371
  existingLayerTitle: e.title,
391
372
  existingLayerDescription: e.portalItem?.description,
392
373
  fieldInformation: n
393
- }, i = await V({
394
- promptText: s,
395
- schema: be,
396
- inputVariables: a
374
+ }, s = await O({
375
+ promptText: o,
376
+ schema: Ie,
377
+ inputVariables: i
397
378
  });
398
- return D(e, i);
399
- }, ve = p.object({
400
- title: p.string(),
401
- description: p.string(),
402
- name: p.string().nullable()
403
- }), Oe = async (e, t) => {
404
- const n = await I("layer_descriptions_prompt"), a = Array.from(t.values()), i = {
405
- fieldInformation: JSON.stringify(a, null, 2),
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 = {
386
+ fieldInformation: JSON.stringify(i, null, 2),
406
387
  existingLayerTitle: e.title,
407
388
  existingLayerDescription: e.portalItem?.description,
408
389
  existingLayerSnippet: e.portalItem?.snippet,
409
390
  layerGeometryType: e.geometryType
410
391
  };
411
- return { ...await V({
392
+ return { ...await O({
412
393
  promptText: n,
413
- schema: ve,
414
- inputVariables: i
394
+ schema: Ee,
395
+ inputVariables: s
415
396
  }), name: e.title ?? null };
416
397
  };
417
398
  export {
418
- Fe as D,
419
- qe as W,
420
- Oe as a,
421
- me as b,
422
- b as c,
423
- w as d,
424
- pe as e,
425
- fe as f,
426
- Ne as g,
427
- je as h,
428
- V as i,
429
- $e as j,
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,
409
+ O as i,
410
+ ie as j,
430
411
  ae as k,
431
- ge as l,
432
- ue as m,
433
- De as n,
434
- Ue as o,
435
- se as p,
436
- oe as q,
437
- Pe as r,
438
- f as s,
439
- _e as t
412
+ ve as l,
413
+ be as m,
414
+ Ve as n,
415
+ ze as o,
416
+ ye as s
440
417
  };