@arcgis/ai-components 5.2.0-next.5 → 5.2.0-next.50

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 (218) hide show
  1. package/dist/agent-utils/FunctionAgent.d.ts +2 -2
  2. package/dist/agent-utils/LLMAgent.d.ts +2 -2
  3. package/dist/agent-utils/LLMAgent.js +1 -0
  4. package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
  5. package/dist/agent-utils/index.d.ts +177 -0
  6. package/dist/agent-utils/index.js +167 -0
  7. package/dist/agent-utils/middlewares/trace.d.ts +2 -0
  8. package/dist/agent-utils/middlewares/trace.js +25 -33
  9. package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
  10. package/dist/agent-utils/types.d.ts +36 -7
  11. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
  12. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
  13. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
  14. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
  15. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
  16. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
  17. package/dist/cdn/2ER3LN6U.js +2 -0
  18. package/dist/cdn/2W6XPTA6.js +9 -0
  19. package/dist/cdn/3DJDRAGV.js +2 -0
  20. package/dist/cdn/3LCF5HIE.js +3 -0
  21. package/dist/cdn/{AMP6IALT.js → 3UEKINYC.js} +1 -1
  22. package/dist/cdn/434TAA3J.js +2 -0
  23. package/dist/cdn/4CEMUECT.js +2 -0
  24. package/dist/cdn/4G5XCUE5.js +2 -0
  25. package/dist/cdn/57OMVTIU.js +2 -0
  26. package/dist/cdn/5I35MJXT.js +48 -0
  27. package/dist/cdn/6O6KMX3M.js +2 -0
  28. package/dist/cdn/6U7TEAAJ.js +2 -0
  29. package/dist/cdn/7FY4G4K2.js +2 -0
  30. package/dist/cdn/7YIRK2E3.js +2 -0
  31. package/dist/cdn/A4JLOAOH.js +2 -0
  32. package/dist/cdn/{ZS2TZ6BF.js → AOVJ34QE.js} +1 -1
  33. package/dist/cdn/APFZY4PI.js +2 -0
  34. package/dist/cdn/BE7ZN5FZ.js +2 -0
  35. package/dist/cdn/{FL4W4VYN.js → BL273EGZ.js} +17 -1
  36. package/dist/cdn/BMGQJYTE.js +2 -0
  37. package/dist/cdn/{5ZZGKP7N.js → CEKOEHB3.js} +1 -1
  38. package/dist/cdn/CMG2NY3K.js +2 -0
  39. package/dist/cdn/DMLRWHBA.js +2 -0
  40. package/dist/cdn/EQLRFZVU.js +18 -0
  41. package/dist/cdn/EW6AYEUX.js +36 -0
  42. package/dist/cdn/F5SUU35Z.js +2 -0
  43. package/dist/cdn/FYW633VX.js +2 -0
  44. package/dist/cdn/{ZLXN7NMF.js → FYZATVB3.js} +10 -8
  45. package/dist/cdn/{H7422XUG.js → GYVSHAUI.js} +1 -1
  46. package/dist/cdn/HBLRVXEB.js +2 -0
  47. package/dist/cdn/HJG7QM2R.js +9 -0
  48. package/dist/cdn/HQXPPYMD.js +2 -0
  49. package/dist/cdn/{FX7UOGHP.js → ICBIUFK7.js} +1 -1
  50. package/dist/cdn/ICYUPLZM.js +56 -0
  51. package/dist/cdn/IEHPNCTL.js +2 -0
  52. package/dist/cdn/IHP25JWI.js +99 -0
  53. package/dist/cdn/J6A4AS7E.js +22 -0
  54. package/dist/cdn/{NE7E52YR.js → JEBRN3EU.js} +9 -3
  55. package/dist/cdn/JEL5M7FA.js +2 -0
  56. package/dist/cdn/{CXWBEDXN.js → JSIGEUX7.js} +6 -4
  57. package/dist/cdn/JSJ4RMOE.js +2 -0
  58. package/dist/cdn/JVYPIWEU.js +2 -0
  59. package/dist/cdn/KJJAXCP4.js +2 -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/MS5EA2KY.js +2 -0
  65. package/dist/cdn/MWYBF3F3.js +66 -0
  66. package/dist/cdn/NAKAZDJ7.js +4 -0
  67. package/dist/cdn/NEV6OZN3.js +71 -0
  68. package/dist/cdn/O5TONDCH.js +2 -0
  69. package/dist/cdn/OC5GA5ZQ.js +3 -0
  70. package/dist/cdn/OGMMYFHR.js +2 -0
  71. package/dist/cdn/{23EQTPO3.js → OKVLGJAG.js} +1 -1
  72. package/dist/cdn/OYNIFMCJ.js +2 -0
  73. package/dist/cdn/PNFBQ6JV.js +180 -0
  74. package/dist/cdn/{LQ6R5YRN.js → PQ2DPOFM.js} +1 -1
  75. package/dist/cdn/PVE7Q43N.js +2 -0
  76. package/dist/cdn/R74ZHFA6.js +2 -0
  77. package/dist/cdn/RLEHNAIA.js +2 -0
  78. package/dist/cdn/{X2ZDYHCG.js → SDWWUWAF.js} +10 -5
  79. package/dist/cdn/SJR4IR57.js +2 -0
  80. package/dist/cdn/SPVOBZAL.js +2 -0
  81. package/dist/cdn/SUA3YJTU.js +22 -0
  82. package/dist/cdn/T7DYMSJV.js +65 -0
  83. package/dist/cdn/TFT6HK3O.js +208 -0
  84. package/dist/cdn/THR22OXW.js +2 -0
  85. package/dist/cdn/TPULIO6I.js +34 -0
  86. package/dist/cdn/{6YMR4QSD.js → UHEYPSOR.js} +1 -1
  87. package/dist/cdn/UK7PR2FE.js +2 -0
  88. package/dist/cdn/UZLQALHY.js +2 -0
  89. package/dist/cdn/V6HOUZPZ.js +2 -0
  90. package/dist/cdn/VAXH6RUQ.js +134 -0
  91. package/dist/cdn/VPFIUEKT.js +14 -0
  92. package/dist/cdn/VXFQANGJ.js +2 -0
  93. package/dist/cdn/XCRR2EEG.js +6 -0
  94. package/dist/cdn/YHQJ66WJ.js +2 -0
  95. package/dist/cdn/YYSMCB4A.js +2 -0
  96. package/dist/cdn/Z6I6JACX.js +3 -0
  97. package/dist/cdn/ZB57WYHC.js +2 -0
  98. package/dist/cdn/ZS6SXJP2.js +2 -0
  99. package/dist/cdn/{ZTBA5PM7.js → ZU2FHVNK.js} +1 -1
  100. package/dist/cdn/agent-utils/index.js +2 -0
  101. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  102. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  103. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  104. package/dist/cdn/index.js +1 -1
  105. package/dist/cdn/main.css +1 -1
  106. package/dist/chunks/adapter.js +1794 -1597
  107. package/dist/chunks/arcgisKnowledgeGraph.js +126 -71
  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 +139 -113
  114. package/dist/chunks/data_explore_query_prompt.js +9 -4
  115. package/dist/chunks/generateLayerDescriptions.js +248 -228
  116. package/dist/chunks/helpGraph.js +17 -13
  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 +24 -20
  121. package/dist/chunks/navigationGraph.js +33 -28
  122. package/dist/chunks/navigation_intent_prompt.js +8 -2
  123. package/dist/chunks/orchestrator.js +110 -108
  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 +12 -9
  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 +385 -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 +8 -2
  135. package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
  136. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
  137. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  138. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +11 -5
  139. package/dist/components/arcgis-assistant-help-agent/customElement.js +8 -2
  140. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
  141. package/dist/components/arcgis-assistant-interrupt/customElement.js +12 -8
  142. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  143. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  144. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  145. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +17 -11
  146. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +10 -4
  147. package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
  148. package/dist/components/arcgis-assistant-message/customElement.js +28 -26
  149. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  150. package/dist/components/arcgis-assistant-message/index.js +2 -0
  151. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  152. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  153. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  154. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  155. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  156. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
  157. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
  158. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  159. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  160. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  161. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +5 -1
  162. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  163. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +11 -5
  164. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  165. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  166. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  167. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
  168. package/dist/components/arcgis-assistant-user-message/customElement.js +10 -8
  169. package/dist/docs/api.json +1 -1
  170. package/dist/docs/docs.json +1 -1
  171. package/dist/docs/vscode.html-custom-data.json +1 -1
  172. package/dist/docs/web-types.json +1 -1
  173. package/dist/index.d.ts +4 -0
  174. package/dist/loader.js +7 -6
  175. package/dist/oauth-callback.html +1 -1
  176. package/dist/types/lumina.d.ts +11 -5
  177. package/dist/types/preact.d.ts +12 -5
  178. package/dist/types/react.d.ts +13 -5
  179. package/dist/types/stencil.d.ts +11 -5
  180. package/dist/utils/index.d.ts +85 -47
  181. package/dist/utils/index.js +48 -47
  182. package/package.json +13 -12
  183. package/dist/cdn/2AXF774U.js +0 -2
  184. package/dist/cdn/3BKUCFKS.js +0 -36
  185. package/dist/cdn/3PKJWIC3.js +0 -2
  186. package/dist/cdn/3WINIQWY.js +0 -2
  187. package/dist/cdn/462JBSEV.js +0 -422
  188. package/dist/cdn/5QAHYX7Y.js +0 -5
  189. package/dist/cdn/7BCR6TUO.js +0 -2
  190. package/dist/cdn/7GH7VSB2.js +0 -2
  191. package/dist/cdn/7PLV4QH6.js +0 -2
  192. package/dist/cdn/AO7BQHKC.js +0 -2
  193. package/dist/cdn/AXDZBBNL.js +0 -45
  194. package/dist/cdn/DDLZOMUY.js +0 -2
  195. package/dist/cdn/DHOVCT6R.js +0 -2
  196. package/dist/cdn/DO2P3PWF.js +0 -106
  197. package/dist/cdn/ERBQSEPQ.js +0 -22
  198. package/dist/cdn/F2AHA4GB.js +0 -54
  199. package/dist/cdn/FX5JFRDL.js +0 -2
  200. package/dist/cdn/GBNUMN4J.js +0 -16
  201. package/dist/cdn/GJUXVEOF.js +0 -166
  202. package/dist/cdn/HB5A5R2E.js +0 -2
  203. package/dist/cdn/J5CMRCPS.js +0 -3
  204. package/dist/cdn/KMQ3SP4I.js +0 -5
  205. package/dist/cdn/M6F4MXDK.js +0 -14
  206. package/dist/cdn/MH5RPXHM.js +0 -2
  207. package/dist/cdn/NAUXSHIE.js +0 -72
  208. package/dist/cdn/NVI3I46B.js +0 -2
  209. package/dist/cdn/OAVEHGB6.js +0 -2
  210. package/dist/cdn/OH64RMOR.js +0 -4
  211. package/dist/cdn/P6OPJQMC.js +0 -3
  212. package/dist/cdn/QR54T33D.js +0 -2
  213. package/dist/cdn/RVOAPUBN.js +0 -2
  214. package/dist/cdn/SXDLXCIM.js +0 -2
  215. package/dist/cdn/USMDJUFS.js +0 -2
  216. package/dist/cdn/V2P4AIGG.js +0 -2
  217. package/dist/cdn/Y333DGV6.js +0 -2
  218. package/dist/cdn/YIMNOUTF.js +0 -2
@@ -1,42 +1,44 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import R from "@arcgis/core/identity/IdentityManager.js";
3
3
  import C from "@arcgis/core/portal/Portal.js";
4
- import { p as I, q as v, s as l, D as k, r as A, t as M, W as F } from "./generateLayerDescriptions.js";
4
+ import { n as I, o as v, D as k, p as A, q as M, W as F } from "./generateLayerDescriptions.js";
5
5
  import { isGraphInterrupt as D, StateGraph as L, START as W, END as $, MemorySaver as j } from "@langchain/langgraph/web";
6
- import { HumanMessage as q, AIMessage as H } from "@langchain/core/messages";
7
- import * as P from "@arcgis/core/core/reactiveUtils.js";
8
- import O from "@arcgis/core/layers/FeatureLayer.js";
9
- import T from "@arcgis/core/request.js";
10
- const U = async (t) => {
11
- const e = await N(), r = await I("default"), s = C.getDefault(), a = (await R.getCredential(`${s.url}/sharing`)).token, i = {
6
+ import { generateGuid as q } from "@arcgis/toolkit/string";
7
+ import { HumanMessage as H, AIMessage as P } from "@langchain/core/messages";
8
+ import { s as l } from "./index.js";
9
+ import * as O from "@arcgis/core/core/reactiveUtils.js";
10
+ import T from "@arcgis/core/layers/FeatureLayer.js";
11
+ import U from "@arcgis/core/request.js";
12
+ const G = async (t) => {
13
+ const e = await N(), r = await I("default"), s = C.getDefault(), o = (await R.getCredential(`${s.url}/sharing`)).token, i = {
12
14
  type: "generateEmbeddings",
13
15
  webmapEmbeddings: t,
14
- auth: { apiUrl: r, token: a }
16
+ auth: { apiUrl: r, token: o }
15
17
  };
16
18
  return e.postMessage(i), await new Promise((c, d) => {
17
- const o = (u) => {
18
- u.data === "completed" && (e.removeEventListener("message", o), c());
19
+ const a = (u) => {
20
+ u.data === "completed" && (e.removeEventListener("message", a), c());
19
21
  }, g = (u) => {
20
- e.removeEventListener("message", o), d(u instanceof Error ? u : new Error("Embeddings worker error"));
22
+ e.removeEventListener("message", a), d(u instanceof Error ? u : new Error("Embeddings worker error"));
21
23
  };
22
- e.addEventListener("message", o), e.addEventListener("error", g, { once: !0 });
24
+ e.addEventListener("message", a), e.addEventListener("error", g, { once: !0 });
23
25
  }), e;
24
26
  }, N = async () => {
25
27
  {
26
28
  const t = (await import("./embeddings.worker.js")).default;
27
29
  return new t();
28
30
  }
29
- }, G = (t) => {
31
+ }, _ = (t) => {
30
32
  t.currentIntent = "none";
31
- }, _ = async (t, e) => {
33
+ }, V = async (t, e) => {
32
34
  const r = v(e);
33
35
  if (t.agentExecutionContext.userRequest) {
34
- const n = new q(t.agentExecutionContext.userRequest.trim());
35
- t.agentExecutionContext.messages = [...t.agentExecutionContext.messages, n], G(t);
36
+ const n = new H(t.agentExecutionContext.userRequest.trim());
37
+ t.agentExecutionContext.messages = [...t.agentExecutionContext.messages, n], _(t);
36
38
  }
37
39
  const s = r?.services.agentRegistry.list().map((n) => n.agent.id) ?? [];
38
40
  return await l({ text: `Available agents: ${[...s].join(", ")}` }, e), await l({ text: "Analyzing user input" }, e), t;
39
- }, V = async (t, e) => (await l({ text: "Exiting..." }, e), t), w = (t) => typeof t == "object" && t !== null && !Array.isArray(t), z = (t, e) => {
41
+ }, z = async (t, e) => (await l({ text: "Exiting..." }, e), t), w = (t) => typeof t == "object" && t !== null && !Array.isArray(t), Q = (t, e) => {
40
42
  if (!w(t)) {
41
43
  t !== void 0 && console.warn(`Agent "${e}" returned invalid sharedStatePatch. Ignoring it.`);
42
44
  return;
@@ -52,28 +54,28 @@ const U = async (t) => {
52
54
  r[s] = { value: n.value };
53
55
  }
54
56
  return r;
55
- }, Q = (t) => {
57
+ }, B = (t) => {
56
58
  const { previousSharedState: e, patch: r, agentId: s } = t;
57
59
  if (!r)
58
60
  return e;
59
- const n = Date.now(), a = {
61
+ const n = Date.now(), o = {
60
62
  ...e
61
63
  };
62
64
  for (const [i, c] of Object.entries(r))
63
- c?.value !== void 0 && (a[i] = {
65
+ c?.value !== void 0 && (o[i] = {
64
66
  value: c.value,
65
67
  meta: {
66
68
  updatedByAgentId: s,
67
69
  updatedAt: n
68
70
  }
69
71
  });
70
- return a;
72
+ return o;
71
73
  }, f = (t) => {
72
74
  if (typeof t != "string")
73
75
  return;
74
76
  const e = t.trim();
75
77
  return e || void 0;
76
- }, B = (t) => {
78
+ }, J = (t) => {
77
79
  switch (t) {
78
80
  case "failed":
79
81
  return "Agent failed without a summary.";
@@ -84,19 +86,19 @@ const U = async (t) => {
84
86
  default:
85
87
  return "Agent completed without a summary.";
86
88
  }
87
- }, J = (t, e) => {
88
- const r = f(e?.outputMessage), s = f(e?.summary), n = e?.status, a = n === "success" || n === "failed" ? n : "unknown";
89
- a === "unknown" && console.warn(`Agent "${t}" returned missing/invalid status. Defaulting to "unknown".`);
90
- const i = z(e?.sharedStatePatch, t);
89
+ }, K = (t, e) => {
90
+ const r = f(e?.outputMessage), s = f(e?.summary), n = e?.status, o = n === "success" || n === "failed" ? n : "unknown";
91
+ o === "unknown" && console.warn(`Agent "${t}" returned missing/invalid status. Defaulting to "unknown".`);
92
+ const i = Q(e?.sharedStatePatch, t);
91
93
  return {
92
94
  outputMessage: r,
93
- summary: s ?? r ?? B(a),
94
- status: a,
95
+ summary: s ?? r ?? J(o),
96
+ status: o,
95
97
  sharedStatePatch: i
96
98
  };
97
- }, E = 4e3, K = async (t, e) => {
99
+ }, E = 4e3, X = async (t, e) => {
98
100
  const r = v(e);
99
- if (r?.abortSignal?.aborted)
101
+ if (e?.signal?.aborted)
100
102
  return await l({ text: "Run cancelled; skipping agent execution" }, e), {
101
103
  ...t,
102
104
  currentIntent: "none",
@@ -106,7 +108,7 @@ const U = async (t) => {
106
108
  if (!n)
107
109
  return console.warn(`No agent found for intent: ${t.currentIntent}`), t;
108
110
  await l({ text: `Executing registered agent: ${n.agent.name}` }, e);
109
- const a = {
111
+ const o = {
110
112
  ...e ?? {},
111
113
  configurable: {
112
114
  ...r ?? {},
@@ -116,7 +118,7 @@ const U = async (t) => {
116
118
  };
117
119
  let i;
118
120
  try {
119
- const o = await n.agent.createGraph().compile().invoke(
121
+ const a = await n.agent.createGraph().compile().invoke(
120
122
  {
121
123
  agentExecutionContext: {
122
124
  ...t.agentExecutionContext,
@@ -127,14 +129,14 @@ const U = async (t) => {
127
129
  sharedState: structuredClone(t.agentExecutionContext.sharedState ?? {})
128
130
  }
129
131
  },
130
- a
132
+ o
131
133
  );
132
- i = J(n.agent.name, o), await l({ text: `Finished executing registered agent: ${n.agent.name}` }, e);
133
- } catch (o) {
134
- if (D(o))
135
- throw o;
136
- const g = o instanceof Error ? o.message : String(o);
137
- console.error(`Agent "${n.agent.name}" failed:`, o), await l({ text: `Registered agent failed: ${n.agent.name}. ${g}` }, e), i = {
134
+ i = K(n.agent.name, a), await l({ text: `Finished executing registered agent: ${n.agent.name}` }, e);
135
+ } catch (a) {
136
+ if (D(a) || e?.signal?.aborted || a instanceof Error && a.name === "AbortError")
137
+ throw a;
138
+ const g = a instanceof Error ? a.message : String(a);
139
+ console.error(`Agent "${n.agent.name}" failed:`, a), await l({ text: `Registered agent failed: ${n.agent.name}. ${g}` }, e), i = {
138
140
  status: "failed",
139
141
  outputMessage: `Agent execution failed: ${g}`,
140
142
  summary: `Agent execution failed: ${g}`
@@ -142,9 +144,9 @@ const U = async (t) => {
142
144
  }
143
145
  const c = i.outputMessage, d = [...t.agentExecutionContext.messages];
144
146
  if (c) {
145
- const o = c.length > E ? `${c.slice(0, E - 14)}
147
+ const a = c.length > E ? `${c.slice(0, E - 14)}
146
148
  [truncated]` : c;
147
- d.push(new H(o));
149
+ d.push(new P(a));
148
150
  }
149
151
  return {
150
152
  ...t,
@@ -164,18 +166,18 @@ const U = async (t) => {
164
166
  status: i?.status || "unknown"
165
167
  }
166
168
  ],
167
- sharedState: Q({
169
+ sharedState: B({
168
170
  previousSharedState: t.agentExecutionContext.sharedState,
169
171
  patch: i.sharedStatePatch,
170
172
  agentId: n.agent.id
171
173
  })
172
174
  }
173
175
  };
174
- }, X = 3, Y = () => new L(k).addNode("ingestInput", _).addNode("intentLLM", A).addNode("executeRegisteredAgent", K).addNode("exit", V).addEdge(W, "ingestInput").addEdge("ingestInput", "intentLLM").addConditionalEdges("intentLLM", (e) => e.currentIntent === "none" || e.currentIntent === e.lastExecutedAgent ? "exit" : "executeRegisteredAgent").addConditionalEdges(
176
+ }, Y = 3, Z = () => new L(k).addNode("ingestInput", V).addNode("intentLLM", A).addNode("executeRegisteredAgent", X).addNode("exit", z).addEdge(W, "ingestInput").addEdge("ingestInput", "intentLLM").addConditionalEdges("intentLLM", (e) => e.currentIntent === "none" || e.currentIntent === e.lastExecutedAgent ? "exit" : "executeRegisteredAgent").addConditionalEdges(
175
177
  "executeRegisteredAgent",
176
- (e) => e.stepCount >= X || !e.requiresFollowUp ? "exit" : "intentLLM"
178
+ (e) => e.stepCount >= Y || !e.requiresFollowUp ? "exit" : "intentLLM"
177
179
  ).addEdge("exit", $);
178
- class Z {
180
+ class ee {
179
181
  constructor() {
180
182
  this.agentRegistry = /* @__PURE__ */ new Map();
181
183
  }
@@ -192,7 +194,7 @@ class Z {
192
194
  return [...this.agentRegistry.values()];
193
195
  }
194
196
  }
195
- class ee {
197
+ class te {
196
198
  /**
197
199
  * Create a new InterruptHandler tied to a specific compiled graph and config.
198
200
  */
@@ -239,34 +241,34 @@ class ee {
239
241
  this.rejectWait && (this.rejectWait(new Error("Request cancelled by user.")), this.resolveWait = void 0, this.rejectWait = void 0);
240
242
  }
241
243
  }
242
- const te = async (t) => {
244
+ const re = async (t) => {
243
245
  try {
244
246
  return await (await M()).embedDocuments(t);
245
247
  } catch (e) {
246
248
  throw console.error("Failed to generate embeddings:", e), e;
247
249
  }
248
- }, b = async (t, e) => {
250
+ }, x = async (t, e) => {
249
251
  const r = e.get(t);
250
252
  if (r)
251
253
  return r;
252
- const s = await te([t]);
254
+ const s = await re([t]);
253
255
  return e.set(t, s[0]), s[0];
254
256
  };
255
- async function re(t, e, r, s) {
257
+ async function ne(t, e, r, s) {
256
258
  const n = `req-${Date.now()}`, i = {
257
259
  type: "layerSearch",
258
- precomputedEmbedding: s ? await b(t, s) : void 0,
260
+ precomputedEmbedding: s ? await x(t, s) : void 0,
259
261
  requestId: n,
260
262
  minScore: r
261
263
  };
262
264
  return await new Promise((c) => {
263
- const d = (o) => {
264
- o.data.requestId === n && c(o.data.results);
265
+ const d = (a) => {
266
+ a.data.requestId === n && c(a.data.results);
265
267
  };
266
268
  e.addEventListener("message", d, { once: !0 }), e.postMessage(i);
267
269
  });
268
270
  }
269
- function ne(t) {
271
+ function se(t) {
270
272
  const { worker: e } = t;
271
273
  return {
272
274
  async searchLayers({
@@ -274,19 +276,19 @@ function ne(t) {
274
276
  minScore: s,
275
277
  embeddingCache: n
276
278
  }) {
277
- return await re(r, e, s, n);
279
+ return await ne(r, e, s, n);
278
280
  }
279
281
  };
280
282
  }
281
- const se = async ({
283
+ const ae = async ({
282
284
  combinedQuery: t,
283
285
  layerIds: e,
284
286
  embeddingsWorker: r,
285
287
  minScore: s,
286
288
  topResults: n,
287
- embeddingCache: a
289
+ embeddingCache: o
288
290
  }) => {
289
- const i = `req-${Date.now()}`, c = a ? await b(t, a) : void 0, d = {
291
+ const i = `req-${Date.now()}`, c = o ? await x(t, o) : void 0, d = {
290
292
  type: "fieldSearch",
291
293
  layerIdForFieldsSearch: e,
292
294
  precomputedEmbedding: c,
@@ -294,7 +296,7 @@ const se = async ({
294
296
  minScore: s,
295
297
  topResults: n
296
298
  };
297
- return await new Promise((o) => {
299
+ return await new Promise((a) => {
298
300
  const g = (u) => {
299
301
  if (u.data.requestId !== i)
300
302
  return;
@@ -302,44 +304,44 @@ const se = async ({
302
304
  layerId: y,
303
305
  results: m
304
306
  }));
305
- o(p);
307
+ a(p);
306
308
  };
307
309
  r.addEventListener("message", g, { once: !0 }), r.postMessage(d);
308
310
  });
309
311
  };
310
- function ae(t) {
312
+ function ie(t) {
311
313
  const { worker: e } = t;
312
314
  return {
313
- async searchFields({ text: r, layerIds: s, minScore: n, topResults: a, embeddingCache: i }) {
314
- return await se({
315
+ async searchFields({ text: r, layerIds: s, minScore: n, topResults: o, embeddingCache: i }) {
316
+ return await ae({
315
317
  combinedQuery: r,
316
318
  layerIds: s,
317
319
  embeddingsWorker: e,
318
320
  minScore: n,
319
- topResults: a,
321
+ topResults: o,
320
322
  embeddingCache: i
321
323
  });
322
324
  }
323
325
  };
324
326
  }
325
- const ie = (t) => {
327
+ const oe = (t) => {
326
328
  const e = F.safeParse(t);
327
329
  if (!e.success)
328
330
  throw new Error("Embeddings response validation failed. Regenerate embeddings.");
329
331
  return e.data;
330
- }, oe = (t, e) => {
332
+ }, ce = (t, e) => {
331
333
  const r = /* @__PURE__ */ new Map(), s = /* @__PURE__ */ new Map();
332
334
  if (e.allLayers.forEach((n) => {
333
- n instanceof O && s.set(n.id, n);
335
+ n instanceof T && s.set(n.id, n);
334
336
  }), t.length !== s.size)
335
337
  throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");
336
338
  for (const n of t) {
337
- const a = s.get(n.id);
338
- if (!a)
339
+ const o = s.get(n.id);
340
+ if (!o)
339
341
  throw new Error(
340
342
  `Layer with ID ${n.id} not found in the original map during registry restoration. Regenerate embeddings.`
341
343
  );
342
- if (n.fields.length !== a.fields.length)
344
+ if (n.fields.length !== o.fields.length)
343
345
  throw new Error(
344
346
  `Field count mismatch for layer ID ${n.id} during registry restoration. Regenerate embeddings.`
345
347
  );
@@ -349,18 +351,18 @@ const ie = (t) => {
349
351
  description: n.description
350
352
  }, c = /* @__PURE__ */ new Map();
351
353
  for (const d of n.fields) {
352
- const o = a.fieldsIndex.get(d.name);
353
- if (!o)
354
+ const a = o.fieldsIndex.get(d.name);
355
+ if (!a)
354
356
  throw new Error(
355
357
  `Field with name ${d.name} not found in the original layer ${n.id} during registry restoration. Regenerate embeddings.`
356
358
  );
357
359
  c.set(d.name, {
358
360
  name: d.name,
359
- alias: a.getFieldAlias(d.name) ?? d.alias,
361
+ alias: o.getFieldAlias(d.name) ?? d.alias,
360
362
  description: d.description,
361
- type: o.type || "unknown",
362
- valueType: o.valueType || "unknown",
363
- domain: a.getFieldDomain(d.name) ?? void 0
363
+ type: a.type || "unknown",
364
+ valueType: a.valueType || "unknown",
365
+ domain: o.getFieldDomain(d.name) ?? void 0
364
366
  });
365
367
  }
366
368
  r.set(n.id, {
@@ -369,27 +371,27 @@ const ie = (t) => {
369
371
  });
370
372
  }
371
373
  return r;
372
- }, ce = async (t) => {
374
+ }, de = async (t) => {
373
375
  try {
374
- return (await T(t, {
376
+ return (await U(t, {
375
377
  responseType: "json"
376
378
  })).data;
377
379
  } catch (e) {
378
380
  throw new Error(`Failed to fetch data from ${t}: ${String(e)}`);
379
381
  }
380
- }, de = async (t) => {
382
+ }, ue = async (t) => {
381
383
  const e = t.map;
382
384
  if (!e?.portalItem)
383
385
  throw new Error("WebMap portal item is missing.");
384
386
  const { resources: r } = await e.portalItem.fetchResources(), s = r.find((i) => i.resource.path === "embeddings-v01.json");
385
387
  if (!s?.resource.url)
386
388
  throw new Error("Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.");
387
- const n = await ce(s.resource.url);
388
- return ie(n);
389
+ const n = await de(s.resource.url);
390
+ return oe(n);
389
391
  };
390
- class x {
392
+ class b {
391
393
  constructor() {
392
- this.orchestratorReady = !1, this.chatHistory = [], this.priorSteps = [], this.sharedState = {}, this.agentRegistry = new Z(), this.activeRunId = "", this.cancelledRunIds = /* @__PURE__ */ new Set(), this.streamEpoch = 0;
394
+ this.orchestratorReady = !1, this.chatHistory = [], this.priorSteps = [], this.sharedState = {}, this.agentRegistry = new ee(), this.activeRunId = "", this.cancelledRunIds = /* @__PURE__ */ new Set(), this.streamEpoch = 0;
393
395
  }
394
396
  /**
395
397
  * Creates and returns an AI-ready Orchestrator instance.
@@ -397,15 +399,15 @@ class x {
397
399
  * @returns Ready Orchestrator.
398
400
  */
399
401
  static async init(e) {
400
- const r = new x();
402
+ const r = new b();
401
403
  try {
402
404
  if (e.view?.map) {
403
- await P.whenOnce(() => e.view.ready);
404
- const s = await de(e.view), n = oe(
405
+ await O.whenOnce(() => e.view.ready);
406
+ const s = await ue(e.view), n = ce(
405
407
  s.layers,
406
408
  e.view.map
407
409
  );
408
- r.layersAndFieldsRegistry = n, r.embeddingsWorker = await U(s);
410
+ r.layersAndFieldsRegistry = n, r.embeddingsWorker = await G(s);
409
411
  }
410
412
  return e.agents?.forEach((s) => {
411
413
  r.agentRegistry.register(s);
@@ -429,24 +431,24 @@ class x {
429
431
  throw new Error("Orchestrator has no registered agents.");
430
432
  if (++this.streamEpoch, !e.trim())
431
433
  return;
432
- const r = String(Date.now());
433
- this.activeRunId = r, this.activeAbortController = new AbortController(), this.graph || (this.graph = Y().compile({ checkpointer: new j() }));
434
- const s = this.embeddingsWorker ? ne({ worker: this.embeddingsWorker }) : void 0, n = this.embeddingsWorker ? ae({ worker: this.embeddingsWorker }) : void 0, a = /* @__PURE__ */ new Map(), c = {
434
+ const r = q();
435
+ this.activeRunId = r, this.activeAbortController = new AbortController(), this.graph || (this.graph = Z().compile({ checkpointer: new j() }));
436
+ const s = this.embeddingsWorker ? se({ worker: this.embeddingsWorker }) : void 0, n = this.embeddingsWorker ? ie({ worker: this.embeddingsWorker }) : void 0, o = /* @__PURE__ */ new Map(), i = {
437
+ // eslint-disable-next-line @typescript-eslint/naming-convention
438
+ thread_id: r,
439
+ hitlResponse: null,
440
+ services: {
441
+ layerSearch: s,
442
+ fieldSearch: n,
443
+ layersAndFieldsRegistry: this.layersAndFieldsRegistry,
444
+ agentRegistry: this.agentRegistry,
445
+ embeddingCache: o
446
+ }
447
+ }, c = {
435
448
  version: "v2",
436
449
  streamMode: "custom",
437
- configurable: {
438
- // eslint-disable-next-line @typescript-eslint/naming-convention
439
- thread_id: r,
440
- abortSignal: this.activeAbortController.signal,
441
- hitlResponse: null,
442
- services: {
443
- layerSearch: s,
444
- fieldSearch: n,
445
- layersAndFieldsRegistry: this.layersAndFieldsRegistry,
446
- agentRegistry: this.agentRegistry,
447
- embeddingCache: a
448
- }
449
- },
450
+ signal: this.activeAbortController.signal,
451
+ configurable: i,
450
452
  subgraphs: !0
451
453
  }, d = this.graph?.streamEvents(
452
454
  {
@@ -458,8 +460,8 @@ class x {
458
460
  }
459
461
  },
460
462
  c
461
- ), o = ++this.streamEpoch;
462
- if (yield* this.pipeStream(d, o, r), this.isRunCancelled(r)) {
463
+ ), a = ++this.streamEpoch;
464
+ if (yield* this.pipeStream(d, a, r), this.isRunCancelled(r)) {
463
465
  yield { runId: r, timestamp: Date.now(), type: "cancelled", reason: "user" };
464
466
  return;
465
467
  }
@@ -471,7 +473,7 @@ class x {
471
473
  const m = (await this.graph.getState(c, { subgraphs: !0 })).tasks.find((h) => h.interrupts.length > 0)?.interrupts[0]?.value;
472
474
  if (!m)
473
475
  break;
474
- this.currentInterrupt = m, this.interruptHandler = new ee(this.graph, c), yield { runId: r, timestamp: Date.now(), type: "interrupt", interrupt: m };
476
+ this.currentInterrupt = m, this.interruptHandler = new te(this.graph, c), yield { runId: r, timestamp: Date.now(), type: "interrupt", interrupt: m };
475
477
  try {
476
478
  const h = await this.interruptHandler.waitForUser(), S = ++this.streamEpoch;
477
479
  yield* this.pipeStream(h, S, r);
@@ -562,6 +564,6 @@ class x {
562
564
  }
563
565
  }
564
566
  export {
565
- x as O,
566
- te as g
567
+ b as O,
568
+ re as g
567
569
  };
@@ -1,11 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- function a(e) {
3
- return `message-${e}`;
4
- }
5
- function o(e, t) {
6
- return `block-${e}-${t}`;
2
+ function e(o, t) {
3
+ return `block-${o}-${t}`;
7
4
  }
8
5
  export {
9
- o as a,
10
- a as g
6
+ e as g
11
7
  };
@@ -13,7 +13,7 @@ function u() {
13
13
  function i(r) {
14
14
  const n = [...new Set([...r].filter((t) => c.has(t)))];
15
15
  if (n.length !== 0)
16
- throw new Error(`ADK custom state cannot define reserved runtime fields: ${n.join(", ")}.`);
16
+ throw new Error(`custom state cannot define reserved runtime fields: ${n.join(", ")}.`);
17
17
  }
18
18
  function f(r) {
19
19
  const n = Object.entries(r);
@@ -22,13 +22,15 @@ Use chat history only when necessary to understand conversational references, an
22
22
 
23
23
  ### Your goal:
24
24
 
25
- 1. If the assigned task is about a **specific calculation** (e.g., average, total, count, min, max), return only the **direct numeric answer** short and clear.
26
- - Example: “The average price is $4.00.”
27
- - When a value is already present in \`queryResponse\` (for example in \`details.value\` or \`summary\`), copy that value **verbatim**.
28
- - Do NOT reformat values (including numbers, dates, and times):
29
- - Do not add/remove grouping commas.
30
- - Do not change decimals, round values, or change numeric type/text.
31
- - Do not change date/time format, timezone notation, separators, or precision.
25
+ 1. If the assigned task is about a **specific calculation** (e.g., average, total, count, min, max), return a **single concise sentence** that includes the numeric result.
26
+
27
+ - Example: “The average price is $4.00.”
28
+ - Never return a bare number by itself (for example: \`4\`).
29
+ - When a value is already present in \`queryResponse\` (for example in \`details.value\` or \`summary\`), copy that value **verbatim**.
30
+ - Do NOT reformat values (including numbers, dates, and times):
31
+ - Do not add/remove grouping commas.
32
+ - Do not change decimals, round values, or change numeric type/text.
33
+ - Do not change date/time format, timezone notation, separators, or precision.
32
34
 
33
35
  2. If the question is more general or there are **multiple features with varying attributes**, write a **brief summary** (2–3 sentences max) that highlights key patterns or insights.
34
36
 
@@ -2,28 +2,31 @@
2
2
  import "@arcgis/core/identity/IdentityManager.js";
3
3
  import "@arcgis/core/portal/Portal.js";
4
4
  import "@langchain/langgraph/web";
5
- import { s as r } from "./generateLayerDescriptions.js";
5
+ import "@arcgis/toolkit/string";
6
+ import "./generateLayerDescriptions.js";
6
7
  import "@langchain/core/messages";
8
+ import { s as a } from "./index.js";
7
9
  import "@langchain/openai";
10
+ import "@arcgis/core/config.js";
8
11
  import "@arcgis/core/core/reactiveUtils.js";
9
12
  import "@arcgis/core/layers/FeatureLayer.js";
10
13
  import "@arcgis/core/request.js";
11
14
  import "@langchain/core/prompts";
12
- const u = async (t, o) => {
13
- const a = t.tool_calls ?? [];
14
- if (a.length === 0) {
15
- await r({ text: `LLM did not request any tool calls: ${String(t?.content)}` }, o);
15
+ const L = async (t, o) => {
16
+ const i = t.tool_calls ?? [];
17
+ if (i.length === 0) {
18
+ await a({ text: `LLM did not request any tool calls: ${String(t?.content)}` }, o);
16
19
  return;
17
20
  }
18
21
  await Promise.all(
19
- a.map(
20
- async (i) => await r(
21
- { text: `LLM invoked ${i.name} tool with arguments: ${JSON.stringify(i.args, null, 2)}` },
22
+ i.map(
23
+ async (r) => await a(
24
+ { text: `LLM invoked ${r.name} tool with arguments: ${JSON.stringify(r.args, null, 2)}` },
22
25
  o
23
26
  )
24
27
  )
25
28
  );
26
29
  };
27
30
  export {
28
- u as h
31
+ L as h
29
32
  };
@@ -1,11 +1,11 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { getClosestElement as i } from "@arcgis/toolkit/dom";
3
- import { g as r, a as o } from "./utils3.js";
3
+ import { g as s, a as o } from "./utils3.js";
4
4
  function c(e, t) {
5
- const s = r(e.el, e.referenceElement);
6
- if (s)
7
- return s;
8
- const n = i(e.el, "arcgis-assistant"), a = r(e.el, n?.referenceElement);
5
+ const r = s(e.el, e.referenceElement);
6
+ if (r)
7
+ return r;
8
+ const n = i(e.el, "arcgis-assistant"), a = s(e.el, n?.referenceElement);
9
9
  if (a)
10
10
  return a;
11
11
  throw new Error(`${t}: Reference element not found`);
@@ -23,16 +23,16 @@ function g(e) {
23
23
  const t = i(e.el, "arcgis-assistant");
24
24
  if (t === void 0)
25
25
  throw new Error("arcgis-assistant-agent must be used within an arcgis-assistant element");
26
- t.register({
26
+ return t.register({
27
27
  agent: e.agent,
28
28
  getContext: async () => await e.getContext?.() ?? e.context ?? {}
29
- });
29
+ }), t;
30
30
  }
31
31
  function l(e) {
32
32
  const t = o(e.el, e.referenceElement);
33
33
  if (t)
34
34
  return t;
35
- const s = i(e.el, "arcgis-assistant"), n = r(e.el, s?.referenceElement);
35
+ const r = i(e.el, "arcgis-assistant"), n = s(e.el, r?.referenceElement);
36
36
  return n || null;
37
37
  }
38
38
  function v(e) {