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

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 (162) 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 +22 -22
  4. package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
  5. package/dist/agent-utils/index.d.ts +99 -0
  6. package/dist/agent-utils/index.js +148 -0
  7. package/dist/agent-utils/middlewares/trace.js +25 -33
  8. package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
  9. package/dist/agent-utils/types.d.ts +30 -1
  10. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
  11. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
  12. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
  13. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
  14. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
  15. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
  16. package/dist/cdn/{V2P4AIGG.js → 24QNMEFG.js} +1 -1
  17. package/dist/cdn/{NAUXSHIE.js → 34SG44C3.js} +2 -2
  18. package/dist/cdn/3JGWGKT6.js +2 -0
  19. package/dist/cdn/3NBDVZ2I.js +2 -0
  20. package/dist/cdn/3VOQD2MR.js +2 -0
  21. package/dist/cdn/434TAA3J.js +2 -0
  22. package/dist/cdn/53NTYC4I.js +2 -0
  23. package/dist/cdn/{4HU7735A.js → 5CV7R5IS.js} +6 -4
  24. package/dist/cdn/{AMP6IALT.js → 5W7S2RS4.js} +1 -1
  25. package/dist/cdn/{FL4W4VYN.js → 6ZW7Z36F.js} +16 -0
  26. package/dist/cdn/7CYGX4F4.js +2 -0
  27. package/dist/cdn/{DHOVCT6R.js → AZGGTNA3.js} +1 -1
  28. package/dist/cdn/B7WJFBOZ.js +2 -0
  29. package/dist/cdn/BX7FSMUU.js +56 -0
  30. package/dist/cdn/CHPQM77M.js +181 -0
  31. package/dist/cdn/DHKUXLU3.js +179 -0
  32. package/dist/cdn/DQSEBKOX.js +2 -0
  33. package/dist/cdn/DXVU45KM.js +2 -0
  34. package/dist/cdn/{P6OPJQMC.js → DZ2QWNUA.js} +1 -1
  35. package/dist/cdn/EBISDZ5H.js +2 -0
  36. package/dist/cdn/{MDVYQQUG.js → ERL2CB2Y.js} +5 -5
  37. package/dist/cdn/F6QHMKF5.js +2 -0
  38. package/dist/cdn/FUIGPHBH.js +2 -0
  39. package/dist/cdn/{AO7BQHKC.js → H2CHHGGH.js} +1 -1
  40. package/dist/cdn/{OH64RMOR.js → HWKDNS4K.js} +2 -2
  41. package/dist/cdn/IMQ4TVHF.js +16 -0
  42. package/dist/cdn/IOD3GDA7.js +2 -0
  43. package/dist/cdn/IR7PTESF.js +2 -0
  44. package/dist/cdn/IRZDTYO2.js +2 -0
  45. package/dist/cdn/JIWK6QK6.js +2 -0
  46. package/dist/cdn/{S6W6HV4T.js → JLKGS6Y5.js} +12 -12
  47. package/dist/cdn/K3JCH4XW.js +2 -0
  48. package/dist/cdn/KHXUWZHB.js +2 -0
  49. package/dist/cdn/LIFK3QSD.js +2 -0
  50. package/dist/cdn/NXKKG5TK.js +2 -0
  51. package/dist/cdn/{FX5JFRDL.js → O3EN27N5.js} +1 -1
  52. package/dist/cdn/O3RFFPU3.js +6 -0
  53. package/dist/cdn/P7DG5T3Z.js +9 -0
  54. package/dist/cdn/PBO6FZN6.js +2 -0
  55. package/dist/cdn/Q3ZW4FYA.js +3 -0
  56. package/dist/cdn/Q6LRANX6.js +2 -0
  57. package/dist/cdn/Q7TL5Q5N.js +2 -0
  58. package/dist/cdn/QCSN44H4.js +2 -0
  59. package/dist/cdn/R56X6ZKR.js +161 -0
  60. package/dist/cdn/{HB5A5R2E.js → RUURNLTP.js} +1 -1
  61. package/dist/cdn/T43LEBBE.js +47 -0
  62. package/dist/cdn/{ZLXN7NMF.js → T537PKP4.js} +9 -7
  63. package/dist/cdn/TR4GFL7X.js +2 -0
  64. package/dist/cdn/{3PKJWIC3.js → UPEEHMSY.js} +1 -1
  65. package/dist/cdn/WAIFKDR3.js +2 -0
  66. package/dist/cdn/WNS5ZUF5.js +2 -0
  67. package/dist/cdn/X4XY5HIE.js +2 -0
  68. package/dist/cdn/XOH56EQ2.js +2 -0
  69. package/dist/cdn/XON27U6U.js +2 -0
  70. package/dist/cdn/{H7422XUG.js → YLN2BZ5J.js} +1 -1
  71. package/dist/cdn/{2AXF774U.js → YUKR4AZW.js} +1 -1
  72. package/dist/cdn/{JY6LLOUJ.js → Z2G7MP5L.js} +3 -3
  73. package/dist/cdn/ZEYIBYSF.js +66 -0
  74. package/dist/cdn/agent-utils/index.js +2 -0
  75. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  76. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  77. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  78. package/dist/cdn/index.js +1 -1
  79. package/dist/cdn/main.css +1 -1
  80. package/dist/chunks/adapter.js +1390 -1323
  81. package/dist/chunks/arcgisKnowledgeGraph.js +109 -72
  82. package/dist/chunks/dataExplorationGraph.js +108 -96
  83. package/dist/chunks/generateLayerDescriptions.js +206 -168
  84. package/dist/chunks/helpGraph.js +16 -13
  85. package/dist/chunks/index.js +11 -0
  86. package/dist/chunks/intent_prompt.js +16 -0
  87. package/dist/chunks/layerStylingGraph.js +23 -20
  88. package/dist/chunks/navigationGraph.js +34 -30
  89. package/dist/chunks/orchestrator.js +241 -201
  90. package/dist/chunks/slottableRequestUtils.js +3 -7
  91. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  92. package/dist/chunks/toolCallResponse.js +5 -3
  93. package/dist/components/arcgis-assistant/customElement.d.ts +15 -0
  94. package/dist/components/arcgis-assistant/customElement.js +228 -127
  95. package/dist/components/arcgis-assistant/index.js +2 -3
  96. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  97. package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
  98. package/dist/components/arcgis-assistant-chat/customElement.js +7 -7
  99. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
  100. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  101. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -0
  102. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
  103. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
  104. package/dist/components/arcgis-assistant-interrupt/customElement.js +13 -9
  105. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  106. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  107. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  108. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -0
  109. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
  110. package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
  111. package/dist/components/arcgis-assistant-message/customElement.js +28 -26
  112. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  113. package/dist/components/arcgis-assistant-message/index.js +2 -0
  114. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  115. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  116. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  117. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  118. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  119. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
  120. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
  121. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  122. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  123. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  124. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +4 -1
  125. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
  126. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  127. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  128. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  129. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
  130. package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
  131. package/dist/docs/api.json +1 -1
  132. package/dist/docs/docs.json +1 -1
  133. package/dist/docs/vscode.html-custom-data.json +1 -1
  134. package/dist/docs/web-types.json +1 -1
  135. package/dist/index.d.ts +4 -0
  136. package/dist/loader.js +6 -5
  137. package/dist/orchestrator/registry/agentRegistry.d.ts +33 -0
  138. package/dist/types/lumina.d.ts +10 -4
  139. package/dist/types/preact.d.ts +11 -4
  140. package/dist/types/react.d.ts +12 -4
  141. package/dist/types/stencil.d.ts +10 -4
  142. package/dist/utils/index.d.ts +87 -43
  143. package/dist/utils/index.js +54 -49
  144. package/package.json +8 -7
  145. package/dist/cdn/462JBSEV.js +0 -422
  146. package/dist/cdn/7BCR6TUO.js +0 -2
  147. package/dist/cdn/7GH7VSB2.js +0 -2
  148. package/dist/cdn/7PLV4QH6.js +0 -2
  149. package/dist/cdn/DDLZOMUY.js +0 -2
  150. package/dist/cdn/FHVXO2WG.js +0 -166
  151. package/dist/cdn/GSEPHN3A.js +0 -106
  152. package/dist/cdn/MH5RPXHM.js +0 -2
  153. package/dist/cdn/NVI3I46B.js +0 -2
  154. package/dist/cdn/OAVEHGB6.js +0 -2
  155. package/dist/cdn/ON2V5XI2.js +0 -3
  156. package/dist/cdn/QR54T33D.js +0 -2
  157. package/dist/cdn/RVOAPUBN.js +0 -2
  158. package/dist/cdn/SXDLXCIM.js +0 -2
  159. package/dist/cdn/USMDJUFS.js +0 -2
  160. package/dist/cdn/V5YEZSRY.js +0 -16
  161. package/dist/cdn/Y333DGV6.js +0 -2
  162. package/dist/cdn/YY2SBO3V.js +0 -2
@@ -1,174 +1,186 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { StateGraph as b, START as V, END as v } from "@langchain/langgraph/web";
3
- import { g as T, O as R, P as C, t as N, Q as k, f as h, R as D, r as z, S as $, T as P } from "./adapter.js";
2
+ import { StateGraph as I, START as k, END as v } from "@langchain/langgraph/web";
3
+ import { g as T, O as R, P as C, t as N, Q as V, f as h, R as D, r as z, S as b, T as P } from "./adapter.js";
4
4
  import "@arcgis/core/identity/IdentityManager.js";
5
5
  import "@arcgis/core/portal/Portal.js";
6
- import { s as c, j as A, h as Q } from "./generateLayerDescriptions.js";
6
+ import { h as _, e as Q } from "./generateLayerDescriptions.js";
7
7
  import { AIMessage as j } from "@langchain/core/messages";
8
+ import { s as n } from "./index.js";
8
9
  import "@langchain/openai";
10
+ import "@arcgis/core/config.js";
9
11
  import "@arcgis/core/core/reactiveUtils.js";
10
12
  import "@arcgis/core/layers/FeatureLayer.js";
11
13
  import "@arcgis/core/request.js";
12
14
  import "@langchain/core/prompts";
13
- import { h as I } from "./toolCallResponse.js";
15
+ import { h as $ } from "./toolCallResponse.js";
14
16
  import { ToolNode as O } from "@langchain/langgraph/prebuilt";
15
17
  import G from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
16
18
  import U from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
17
- const W = async (t, e) => (await c({ text: "Exiting Data Exploration agent" }, e), t), B = async (t, e) => {
18
- await c({ text: "Requesting LLM for layer filter results" }, e);
19
+ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e), t), B = async (t, e) => {
20
+ await n({ text: "Requesting LLM for layer filter results" }, e);
19
21
  const d = await T("data_explore_filter_prompt");
20
22
  if (!e?.configurable)
21
23
  throw new Error("config.configurable is required for layer filter tools");
22
- const { userTimezone: n, userTimezoneOffset: r } = R(), o = {
24
+ const { userTimezone: l, userTimezoneOffset: s } = R(), o = {
23
25
  layerFieldInfo: t.layerFieldInfo,
24
- userTimezone: n,
25
- userTimezoneOffset: r,
26
+ userTimezone: l,
27
+ userTimezoneOffset: s,
26
28
  queryResponse: t.queryResponse,
27
29
  assignedTask: t.agentExecutionContext.assignedTask,
28
30
  userRequest: t.agentExecutionContext.userRequest,
29
31
  priorSteps: t.agentExecutionContext.priorSteps
30
- }, s = await A({
32
+ }, r = await _({
31
33
  promptText: d,
32
34
  modelTier: "advanced",
35
+ config: e,
33
36
  messages: t.dataExplorationMessages,
34
37
  inputVariables: o,
35
38
  tools: C
36
- }), i = [...t.dataExplorationMessages, s];
37
- if (!((s.tool_calls?.length ?? 0) > 0))
38
- return await c({ text: "LLM determined no filter changes needed" }, e), {
39
+ }), i = [...t.dataExplorationMessages, r];
40
+ if (!((r.tool_calls?.length ?? 0) > 0))
41
+ return await n({ text: "LLM determined no filter changes needed" }, e), {
39
42
  ...t,
40
43
  dataExplorationMessages: i
41
44
  // Don't overwrite outputMessage if query already set it
42
45
  };
43
- const m = [...i, s], p = s.content.toString();
44
- return await I(s, e), { ...t, dataExplorationMessages: m, outputMessage: p };
46
+ const m = i, p = r.content.toString();
47
+ return await $(r, e), { ...t, dataExplorationMessages: m, outputMessage: p };
45
48
  }, H = async (t, e) => {
46
- await c({ text: "Requesting LLM for layer query results" }, e);
49
+ await n({ text: "Requesting LLM for layer query results" }, e);
47
50
  const d = await T("data_explore_query_prompt");
48
51
  if (!e?.configurable)
49
52
  throw new Error("config.configurable is required for layer query tools");
50
- const { userTimezone: n, userTimezoneOffset: r } = R(), s = t.agentExecutionContext.sharedState.lastNavigatedFeatures, i = s && typeof s == "object" && "value" in s ? s.value : s;
51
- let l = "none";
53
+ const { userTimezone: l, userTimezoneOffset: s } = R(), r = t.agentExecutionContext.sharedState.lastNavigatedFeatures, i = r && typeof r == "object" && "value" in r ? r.value : r;
54
+ let c = "none";
52
55
  if (i != null)
53
56
  try {
54
- l = JSON.stringify(i);
57
+ c = JSON.stringify(i);
55
58
  } catch {
56
- l = "none";
59
+ c = "none";
57
60
  }
58
61
  const m = {
59
62
  layerFieldInfo: t.layerFieldInfo,
60
- userTimezone: n,
61
- userTimezoneOffset: r,
63
+ userTimezone: l,
64
+ userTimezoneOffset: s,
62
65
  assignedTask: t.agentExecutionContext.assignedTask,
63
66
  userRequest: t.agentExecutionContext.userRequest,
64
67
  priorSteps: t.agentExecutionContext.priorSteps,
65
- lastNavigatedFeatures: l
66
- }, p = await A({
68
+ lastNavigatedFeatures: c
69
+ }, p = await _({
67
70
  promptText: d,
68
71
  modelTier: "advanced",
72
+ config: e,
69
73
  messages: t.dataExplorationMessages,
70
74
  inputVariables: m,
71
- tools: k
72
- }), y = p.content.toString();
73
- return await I(p, e), {
75
+ tools: V
76
+ }), f = (p.tool_calls?.length ?? 0) > 0, g = p.content.toString();
77
+ return await $(p, e), {
74
78
  ...t,
75
79
  dataExplorationMessages: [...t.dataExplorationMessages, p],
76
- outputMessage: y,
80
+ // Only emit output here when no tools are being called.
81
+ // For tool-calling flows, downstream summarizer nodes provide the final user-facing message.
82
+ ...f ? {} : { outputMessage: g },
77
83
  status: "success",
78
- summary: y ? N(y) : "Query executed."
84
+ summary: g && !f ? N(g) : "Query planning completed."
79
85
  };
80
86
  }, J = async (t, e) => {
81
87
  try {
82
- await c({ text: "Requesting LLM for summary on query results" }, e);
83
- const d = await T("summarize_query_response_prompt"), n = {
88
+ await n({ text: "Requesting LLM for summary on query results" }, e);
89
+ const d = await T("summarize_query_response_prompt"), l = {
84
90
  queryResponse: t.queryResponse,
85
91
  assignedTask: t.agentExecutionContext.assignedTask,
86
92
  userRequest: t.agentExecutionContext.userRequest,
87
93
  priorSteps: t.agentExecutionContext.priorSteps
88
- }, r = await Q({
94
+ }, s = await Q({
89
95
  promptText: d,
90
96
  modelTier: "fast",
97
+ config: e,
91
98
  messages: t.dataExplorationMessages,
92
- inputVariables: n
93
- }), o = typeof r == "string" ? r : r.content, s = new j(o);
94
- await c({ text: `Received response from LLM: ${o}` }, e);
99
+ inputVariables: l
100
+ }), o = typeof s == "string" ? s : s.content, r = new j(o);
101
+ await n({ text: `Received response from LLM: ${o}` }, e);
95
102
  const i = o;
96
103
  return {
97
104
  ...t,
98
105
  outputMessage: i,
99
106
  status: "success",
100
107
  summary: i ? N(i) : "Summary generated.",
101
- dataExplorationMessages: [...t.dataExplorationMessages, s]
108
+ dataExplorationMessages: [...t.dataExplorationMessages, r]
102
109
  };
103
110
  } catch (a) {
104
- throw await c({ text: "Error during filter LLM request" }, e), new Error(`Error during filter LLM request: ${a instanceof Error ? a.message : String(a)}`);
111
+ throw await n({ text: "Error during filter LLM request" }, e), new Error(`Error during filter LLM request: ${a instanceof Error ? a.message : String(a)}`);
105
112
  }
106
113
  };
107
114
  async function K(t, e) {
108
- const d = await new O(C).invoke(
115
+ if ((t.queryResponse ?? []).some((s) => {
116
+ const o = s.details;
117
+ return typeof o == "object" && o !== null && "error" in o;
118
+ }))
119
+ return await n({ text: "Skipping layer filter tool because query response contains an error." }, e), { ...t };
120
+ const l = await new O(C, { handleToolErrors: !1 }).invoke(
109
121
  {
110
122
  messages: t.dataExplorationMessages
111
123
  },
112
124
  e
113
125
  );
114
- return await c(
115
- { text: `Finished executing layer filter tool: ${d.messages.map((n) => n.content).join(", ")}` },
126
+ return await n(
127
+ { text: `Finished executing layer filter tool: ${l.messages.map((s) => s.content).join(", ")}` },
116
128
  e
117
129
  ), { ...t };
118
130
  }
119
131
  const X = 10, Y = ["string", "small-integer", "integer"], Z = async (t, e, { includeSummaryStatistics: a = !0, includeUniqueValues: d = !0 } = {}) => {
120
- let n = null, r = null;
132
+ let l = null, s = null;
121
133
  try {
122
134
  if (e.type !== "geometry" && e.type !== "oid" && e.type !== "global-id") {
123
- a && (n = await G({ layer: t, field: e.name }));
135
+ a && (l = await G({ layer: t, field: e.name }));
124
136
  const o = e.domain?.type === "coded-value" ? e.domain : null;
125
- d && (Y.includes(e.type) || o) && (r = (await U({ layer: t, field: e.name })).uniqueValueInfos.sort((s, i) => i.count - s.count).slice(0, X), o && (r = r.map((s) => ({
126
- ...s,
127
- value: o.getName(s.value) ?? s.value
137
+ d && (Y.includes(e.type) || o) && (s = (await U({ layer: t, field: e.name })).uniqueValueInfos.sort((r, i) => i.count - r.count).slice(0, X), o && (s = s.map((r) => ({
138
+ ...r,
139
+ value: o.getName(r.value) ?? r.value
128
140
  }))));
129
141
  }
130
142
  } catch (o) {
131
143
  console.error(`Error fetching statistics for field ${e.name}:`, o);
132
144
  }
133
145
  return {
134
- summaryStatistics: n,
135
- uniqueValues: r
146
+ summaryStatistics: l,
147
+ uniqueValues: s
136
148
  };
137
149
  };
138
150
  function ee(t, e) {
139
151
  return ["string", "small-integer", "integer"].includes(t) || e === "coded-value";
140
152
  }
141
153
  async function te(t, e, a, d = !0) {
142
- const n = [], r = [], o = [];
143
- for (const s of t) {
144
- let i = function(g) {
145
- const u = e.get(g)?.layerItem;
154
+ const l = [], s = [], o = [];
155
+ for (const r of t) {
156
+ let i = function(y) {
157
+ const u = e.get(y)?.layerItem;
146
158
  return u ? [
147
159
  u.name && `Name: ${u.name}`,
148
160
  u.title && `Title: ${u.title}`,
149
161
  u.description && `Description: ${u.description}`
150
- ].filter(Boolean).join(" | ") : g;
162
+ ].filter(Boolean).join(" | ") : y;
151
163
  };
152
- const { layerId: l, results: m } = s, p = a.map?.allLayers.find((g) => g.id === l), y = e.get(l)?.fieldRegistry;
153
- if (!y)
164
+ const { layerId: c, results: m } = r, p = a.map?.allLayers.find((y) => y.id === c), f = e.get(c)?.fieldRegistry;
165
+ if (!f)
154
166
  continue;
155
- let f = n.find((g) => g.layerId === l);
156
- f || (f = {
157
- layerId: l,
158
- layerSummary: i(l),
167
+ let g = l.find((y) => y.layerId === c);
168
+ g || (g = {
169
+ layerId: c,
170
+ layerSummary: i(c),
159
171
  fieldInfos: []
160
- }, n.push(f));
161
- for (const g of m) {
162
- const u = y.get(g.name);
172
+ }, l.push(g));
173
+ for (const y of m) {
174
+ const u = f.get(y.name);
163
175
  if (!u)
164
176
  continue;
165
177
  const x = u.statistics, E = d && !x?.summaryStatistics, w = ee(u.type, u.domain?.type) && !x?.uniqueValues, q = E || w;
166
178
  if (o.push({
167
- layerId: l,
179
+ layerId: c,
168
180
  fieldName: u.name,
169
181
  didFetchStatistics: q
170
182
  }), q) {
171
- const _ = Z(p, u, {
183
+ const A = Z(p, u, {
172
184
  includeSummaryStatistics: E,
173
185
  includeUniqueValues: w
174
186
  }).then((F) => {
@@ -176,16 +188,16 @@ async function te(t, e, a, d = !0) {
176
188
  summaryStatistics: x?.summaryStatistics ?? null,
177
189
  uniqueValues: x?.uniqueValues ?? null
178
190
  };
179
- E && (S.summaryStatistics = F.summaryStatistics), w && (S.uniqueValues = F.uniqueValues), y.set(u.name, { ...u, statistics: S }), u.statistics = S;
191
+ E && (S.summaryStatistics = F.summaryStatistics), w && (S.uniqueValues = F.uniqueValues), f.set(u.name, { ...u, statistics: S }), u.statistics = S;
180
192
  });
181
- r.push(_);
193
+ s.push(A);
182
194
  }
183
- f.fieldInfos.push(u);
195
+ g.fieldInfos.push(u);
184
196
  }
185
197
  }
186
- return await Promise.all(r), {
187
- layerFieldInfo: n,
188
- didFetchStatistics: r.length > 0,
198
+ return await Promise.all(s), {
199
+ layerFieldInfo: l,
200
+ didFetchStatistics: s.length > 0,
189
201
  fieldStatisticsFetchStatus: o
190
202
  };
191
203
  }
@@ -195,73 +207,73 @@ function ae(t, e) {
195
207
  }
196
208
  const se = async (t, e) => {
197
209
  try {
198
- await c({ text: "Preparing field information for vector search results" }, e);
199
- const a = h(e, "layersAndFieldsRegistry"), { mapView: d } = D(e), { assignedTask: n, userRequest: r } = t.agentExecutionContext, o = ae(n, r), { layerFieldInfo: s, didFetchStatistics: i, fieldStatisticsFetchStatus: l } = await te(
210
+ await n({ text: "Preparing field information for vector search results" }, e);
211
+ const a = h(e, "layersAndFieldsRegistry"), { mapView: d } = D(e), { assignedTask: l, userRequest: s } = t.agentExecutionContext, o = ae(l, s), { layerFieldInfo: r, didFetchStatistics: i, fieldStatisticsFetchStatus: c } = await te(
200
212
  t.vectorSearchFieldResults,
201
213
  a,
202
214
  d,
203
215
  o
204
216
  );
205
- i ? await c({ text: "Statistics fetched" }, e) : await c({ text: "Statistics skipped" }, e);
206
- for (const m of l)
207
- await c(
217
+ i ? await n({ text: "Statistics fetched" }, e) : await n({ text: "Statistics skipped" }, e);
218
+ for (const m of c)
219
+ await n(
208
220
  {
209
221
  text: ` - ${m.fieldName} - stats ${m.didFetchStatistics ? "fetched" : "skipped"}`
210
222
  },
211
223
  e
212
224
  );
213
- return await c({ text: "Field information prepared" }, e), { ...t, layerFieldInfo: s };
225
+ return await n({ text: "Field information prepared" }, e), { ...t, layerFieldInfo: r };
214
226
  } catch (a) {
215
- throw await c({ text: "Error during fetching statistics" }, e), new Error(`Error during fetching statistics: ${a instanceof Error ? a.message : String(a)}`);
227
+ throw await n({ text: "Error during fetching statistics" }, e), new Error(`Error during fetching statistics: ${a instanceof Error ? a.message : String(a)}`);
216
228
  }
217
229
  }, L = 0.7, re = 10, oe = async (t, e) => {
218
230
  try {
219
- await c({ text: "Similarity search to find fields" }, e);
220
- const a = h(e, "fieldSearch"), d = h(e, "layersAndFieldsRegistry"), n = h(e, "embeddingCache"), r = await a.searchFields({
231
+ await n({ text: "Similarity search to find fields" }, e);
232
+ const a = h(e, "fieldSearch"), d = h(e, "layersAndFieldsRegistry"), l = h(e, "embeddingCache"), s = await a.searchFields({
221
233
  text: t.agentExecutionContext.assignedTask,
222
234
  layerIds: t.vectorSearchLayerIds,
223
235
  minScore: L,
224
236
  topResults: re,
225
- embeddingCache: n
226
- }), o = r.map(({ layerId: i, results: l }) => {
227
- const m = l.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
237
+ embeddingCache: l
238
+ }), o = s.map(({ layerId: i, results: c }) => {
239
+ const m = c.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
228
240
  `);
229
241
  return `${d.get(i)?.layerItem.name ?? i}:
230
242
  ${m}`;
231
243
  }).join(`
232
244
  `);
233
- let s;
234
- return r.length > 0 ? s = `Vector search completed. Matching layers and fields with scores:
235
- ${o}` : s = `No vector search results found for score over ${L}.`, await c({ text: s }, e), {
245
+ let r;
246
+ return s.length > 0 ? r = `Vector search completed. Matching layers and fields with scores:
247
+ ${o}` : r = `No vector search results found for score over ${L}.`, await n({ text: r }, e), {
236
248
  ...t,
237
- vectorSearchFieldResults: r
249
+ vectorSearchFieldResults: s
238
250
  };
239
251
  } catch (a) {
240
- throw await c(
252
+ throw await n(
241
253
  { text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
242
254
  e
243
255
  ), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
244
256
  }
245
257
  }, ie = 0.7, ne = async (t, e) => {
246
258
  try {
247
- await c(
259
+ await n(
248
260
  { text: `Similarity search to find layers: ${t.agentExecutionContext.assignedTask}` },
249
261
  e
250
262
  );
251
- const a = h(e, "layerSearch"), d = h(e, "layersAndFieldsRegistry"), n = h(e, "embeddingCache"), r = await a.searchLayers({
263
+ const a = h(e, "layerSearch"), d = h(e, "layersAndFieldsRegistry"), l = h(e, "embeddingCache"), s = await a.searchLayers({
252
264
  text: t.agentExecutionContext.assignedTask,
253
265
  minScore: ie,
254
- embeddingCache: n
255
- }), o = r.map((l) => l.id), s = r.map(({ id: l, score: m }) => `${d.get(l)?.layerItem.name ?? l} (${m.toFixed(2)})`).join(`
266
+ embeddingCache: l
267
+ }), o = s.map((c) => c.id), r = s.map(({ id: c, score: m }) => `${d.get(c)?.layerItem.name ?? c} (${m.toFixed(2)})`).join(`
256
268
  `);
257
269
  let i;
258
270
  return o.length > 0 ? i = `Vector search completed. Matching layers with scores:
259
- ${s}` : i = "Vector search completed. No matching layers found.", await c({ text: i }, e), {
271
+ ${r}` : i = "Vector search completed. No matching layers found.", await n({ text: i }, e), {
260
272
  ...t,
261
273
  vectorSearchLayerIds: o
262
274
  };
263
275
  } catch (a) {
264
- throw await c(
276
+ throw await n(
265
277
  { text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
266
278
  e
267
279
  ), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
@@ -269,7 +281,7 @@ ${s}` : i = "Vector search completed. No matching layers found.", await c({ text
269
281
  }, le = (t, e) => z(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
270
282
  t,
271
283
  e
272
- ), ce = () => new b($).addNode("requireDataExplorationServices", le).addNode("vectorSearchLayers", ne).addNode("vectorSearchFields", oe).addNode("fieldStatistics", se).addNode("queryAgent", H).addNode("queryTools", P).addNode("summarizeQueryResponseLLM", J).addNode("filterAgent", B).addNode("filterTools", K).addNode("earlyExit", W).addEdge(V, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
284
+ ), ce = () => new I(b).addNode("requireDataExplorationServices", le).addNode("vectorSearchLayers", ne).addNode("vectorSearchFields", oe).addNode("fieldStatistics", se).addNode("queryAgent", H).addNode("queryTools", P).addNode("summarizeQueryResponseLLM", J).addNode("filterAgent", B).addNode("filterTools", K).addNode("earlyExit", W).addEdge(k, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
273
285
  "vectorSearchLayers",
274
286
  (e) => e.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
275
287
  ).addConditionalEdges(
@@ -286,13 +298,13 @@ ${s}` : i = "Vector search completed. No matching layers found.", await c({ text
286
298
  This also includes questions that ask which feature meets a given condition or where a particular feature in the data is located (e.g., “Where is the spring with the highest elevation?”). However, this agent does not handle addresses.
287
299
  _Example: “How many features are there?”_
288
300
  _Example: “What’s the average population?”_
289
- _Example: “Which values are in the status field?”_`, Me = {
301
+ _Example: “Which values are in the status field?”_`, Re = {
290
302
  id: "dataExploration",
291
303
  name: "Data Exploration Agent",
292
304
  description: de,
293
305
  createGraph: ce,
294
- workspace: $
306
+ workspace: b
295
307
  };
296
308
  export {
297
- Me as D
309
+ Re as D
298
310
  };