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

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 (105) hide show
  1. package/dist/agent-utils/LLMAgent.js +22 -22
  2. package/dist/cdn/{DHOVCT6R.js → 2SJAOYZT.js} +1 -1
  3. package/dist/cdn/434TAA3J.js +2 -0
  4. package/dist/cdn/{AMP6IALT.js → 5W7S2RS4.js} +1 -1
  5. package/dist/cdn/64PJB5NU.js +2 -0
  6. package/dist/cdn/{OH64RMOR.js → 6AWNQHCO.js} +2 -2
  7. package/dist/cdn/BIV2IPHH.js +2 -0
  8. package/dist/cdn/CCY4TSBO.js +2 -0
  9. package/dist/cdn/{AO7BQHKC.js → CTSALWEP.js} +1 -1
  10. package/dist/cdn/{NAUXSHIE.js → D2N2NSRQ.js} +2 -2
  11. package/dist/cdn/{3PKJWIC3.js → D3TNNRP4.js} +1 -1
  12. package/dist/cdn/{H7422XUG.js → DOV5ZJ7M.js} +1 -1
  13. package/dist/cdn/EEUCKMU7.js +2 -0
  14. package/dist/cdn/EGHBXLNG.js +2 -0
  15. package/dist/cdn/{GSEPHN3A.js → ETRWZ3MS.js} +31 -29
  16. package/dist/cdn/{S6W6HV4T.js → EWI4V3GQ.js} +10 -10
  17. package/dist/cdn/GTLS44GI.js +2 -0
  18. package/dist/cdn/{YY2SBO3V.js → I6HNBTWY.js} +1 -1
  19. package/dist/cdn/JBHNHHWO.js +3 -0
  20. package/dist/cdn/{FX5JFRDL.js → JOFUPKIB.js} +1 -1
  21. package/dist/cdn/KUEOKIQR.js +2 -0
  22. package/dist/cdn/{FHVXO2WG.js → LKRAPK4A.js} +30 -31
  23. package/dist/cdn/{4HU7735A.js → MODWHY3R.js} +2 -2
  24. package/dist/cdn/NXKKG5TK.js +2 -0
  25. package/dist/cdn/{2AXF774U.js → OBUZ7HBN.js} +1 -1
  26. package/dist/cdn/OIVRK7HT.js +2 -0
  27. package/dist/cdn/{HB5A5R2E.js → RUURNLTP.js} +1 -1
  28. package/dist/cdn/SWOXSJ62.js +2 -0
  29. package/dist/cdn/{ZLXN7NMF.js → T537PKP4.js} +9 -7
  30. package/dist/cdn/{JY6LLOUJ.js → TSZPHE7L.js} +2 -2
  31. package/dist/cdn/VAZNJSKA.js +16 -0
  32. package/dist/cdn/{V2P4AIGG.js → VMXLYWUK.js} +1 -1
  33. package/dist/cdn/{MDVYQQUG.js → VNQN5ZQO.js} +2 -2
  34. package/dist/cdn/WIDTPVSU.js +2 -0
  35. package/dist/cdn/{P6OPJQMC.js → XER22VYQ.js} +1 -1
  36. package/dist/cdn/index.js +1 -1
  37. package/dist/cdn/main.css +1 -1
  38. package/dist/chunks/adapter.js +491 -496
  39. package/dist/chunks/arcgisKnowledgeGraph.js +3 -3
  40. package/dist/chunks/dataExplorationGraph.js +101 -94
  41. package/dist/chunks/generateLayerDescriptions.js +236 -209
  42. package/dist/chunks/helpGraph.js +4 -4
  43. package/dist/chunks/layerStylingGraph.js +10 -10
  44. package/dist/chunks/navigationGraph.js +27 -27
  45. package/dist/chunks/orchestrator.js +240 -201
  46. package/dist/chunks/slottableRequestUtils.js +3 -7
  47. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  48. package/dist/components/arcgis-assistant/customElement.d.ts +15 -0
  49. package/dist/components/arcgis-assistant/customElement.js +227 -127
  50. package/dist/components/arcgis-assistant/index.js +2 -3
  51. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  52. package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
  53. package/dist/components/arcgis-assistant-chat/customElement.js +7 -7
  54. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
  55. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  56. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
  57. package/dist/components/arcgis-assistant-interrupt/customElement.js +13 -9
  58. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  59. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  60. package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
  61. package/dist/components/arcgis-assistant-message/customElement.js +28 -26
  62. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  63. package/dist/components/arcgis-assistant-message/index.js +2 -0
  64. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  65. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  66. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  67. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  68. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  69. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
  70. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
  71. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  72. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  73. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  74. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +4 -1
  75. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  76. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  77. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  78. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
  79. package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
  80. package/dist/docs/api.json +1 -1
  81. package/dist/docs/docs.json +1 -1
  82. package/dist/docs/vscode.html-custom-data.json +1 -1
  83. package/dist/docs/web-types.json +1 -1
  84. package/dist/index.d.ts +4 -0
  85. package/dist/loader.js +6 -5
  86. package/dist/types/lumina.d.ts +10 -4
  87. package/dist/types/preact.d.ts +11 -4
  88. package/dist/types/react.d.ts +12 -4
  89. package/dist/types/stencil.d.ts +10 -4
  90. package/dist/utils/index.d.ts +85 -42
  91. package/dist/utils/index.js +22 -18
  92. package/package.json +7 -7
  93. package/dist/cdn/7BCR6TUO.js +0 -2
  94. package/dist/cdn/7GH7VSB2.js +0 -2
  95. package/dist/cdn/7PLV4QH6.js +0 -2
  96. package/dist/cdn/DDLZOMUY.js +0 -2
  97. package/dist/cdn/MH5RPXHM.js +0 -2
  98. package/dist/cdn/NVI3I46B.js +0 -2
  99. package/dist/cdn/OAVEHGB6.js +0 -2
  100. package/dist/cdn/ON2V5XI2.js +0 -3
  101. package/dist/cdn/QR54T33D.js +0 -2
  102. package/dist/cdn/SXDLXCIM.js +0 -2
  103. package/dist/cdn/USMDJUFS.js +0 -2
  104. package/dist/cdn/V5YEZSRY.js +0 -16
  105. package/dist/cdn/Y333DGV6.js +0 -2
@@ -1,6 +1,6 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { StateGraph as w, START as y, END as h } from "@langchain/langgraph/web";
3
- import { a as f, c as x, b as k, d as _, e as b, s as K, q as v, g as p, h as A, t as g, r as M, i as S, G as T, j as u } from "./adapter.js";
3
+ import { a as f, c as x, b as k, d as _, e as b, s as K, q as v, g as p, h as A, t as g, r as M, i as T, G as S, j as u } from "./adapter.js";
4
4
  import "@arcgis/core/identity/IdentityManager.js";
5
5
  import "@arcgis/core/portal/Portal.js";
6
6
  import { j as q, s as c, h as C } from "./generateLayerDescriptions.js";
@@ -47,7 +47,7 @@ async function R(e, o) {
47
47
  };
48
48
  }
49
49
  async function N(e, o) {
50
- const l = new G(m);
50
+ const l = new G(m, { handleToolErrors: !1 });
51
51
  try {
52
52
  const a = await l.invoke(
53
53
  {
@@ -106,7 +106,7 @@ async function z(e, o) {
106
106
  ...d,
107
107
  details: void 0
108
108
  // Remove details to avoid overwhelming the LLM with too much info
109
- })), { knowledgeGraph: r } = await S(o), n = T.getDataModelTypesSummary(r.dataModel), t = {
109
+ })), { knowledgeGraph: r } = await T(o), n = S.getDataModelTypesSummary(r.dataModel), t = {
110
110
  assignedTask: e.agentExecutionContext.assignedTask,
111
111
  userRequest: e.agentExecutionContext.userRequest,
112
112
  toolResult: a,
@@ -1,174 +1,181 @@
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 { s as n, j as _, h as Q } from "./generateLayerDescriptions.js";
7
7
  import { AIMessage as j } from "@langchain/core/messages";
8
8
  import "@langchain/openai";
9
9
  import "@arcgis/core/core/reactiveUtils.js";
10
10
  import "@arcgis/core/layers/FeatureLayer.js";
11
11
  import "@arcgis/core/request.js";
12
12
  import "@langchain/core/prompts";
13
- import { h as I } from "./toolCallResponse.js";
13
+ import { h as $ } from "./toolCallResponse.js";
14
14
  import { ToolNode as O } from "@langchain/langgraph/prebuilt";
15
15
  import G from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
16
16
  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);
17
+ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e), t), B = async (t, e) => {
18
+ await n({ text: "Requesting LLM for layer filter results" }, e);
19
19
  const d = await T("data_explore_filter_prompt");
20
20
  if (!e?.configurable)
21
21
  throw new Error("config.configurable is required for layer filter tools");
22
- const { userTimezone: n, userTimezoneOffset: r } = R(), o = {
22
+ const { userTimezone: l, userTimezoneOffset: s } = R(), o = {
23
23
  layerFieldInfo: t.layerFieldInfo,
24
- userTimezone: n,
25
- userTimezoneOffset: r,
24
+ userTimezone: l,
25
+ userTimezoneOffset: s,
26
26
  queryResponse: t.queryResponse,
27
27
  assignedTask: t.agentExecutionContext.assignedTask,
28
28
  userRequest: t.agentExecutionContext.userRequest,
29
29
  priorSteps: t.agentExecutionContext.priorSteps
30
- }, s = await A({
30
+ }, r = await _({
31
31
  promptText: d,
32
32
  modelTier: "advanced",
33
33
  messages: t.dataExplorationMessages,
34
34
  inputVariables: o,
35
35
  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), {
36
+ }), i = [...t.dataExplorationMessages, r];
37
+ if (!((r.tool_calls?.length ?? 0) > 0))
38
+ return await n({ text: "LLM determined no filter changes needed" }, e), {
39
39
  ...t,
40
40
  dataExplorationMessages: i
41
41
  // Don't overwrite outputMessage if query already set it
42
42
  };
43
- const m = [...i, s], p = s.content.toString();
44
- return await I(s, e), { ...t, dataExplorationMessages: m, outputMessage: p };
43
+ const m = i, p = r.content.toString();
44
+ return await $(r, e), { ...t, dataExplorationMessages: m, outputMessage: p };
45
45
  }, H = async (t, e) => {
46
- await c({ text: "Requesting LLM for layer query results" }, e);
46
+ await n({ text: "Requesting LLM for layer query results" }, e);
47
47
  const d = await T("data_explore_query_prompt");
48
48
  if (!e?.configurable)
49
49
  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";
50
+ const { userTimezone: l, userTimezoneOffset: s } = R(), r = t.agentExecutionContext.sharedState.lastNavigatedFeatures, i = r && typeof r == "object" && "value" in r ? r.value : r;
51
+ let c = "none";
52
52
  if (i != null)
53
53
  try {
54
- l = JSON.stringify(i);
54
+ c = JSON.stringify(i);
55
55
  } catch {
56
- l = "none";
56
+ c = "none";
57
57
  }
58
58
  const m = {
59
59
  layerFieldInfo: t.layerFieldInfo,
60
- userTimezone: n,
61
- userTimezoneOffset: r,
60
+ userTimezone: l,
61
+ userTimezoneOffset: s,
62
62
  assignedTask: t.agentExecutionContext.assignedTask,
63
63
  userRequest: t.agentExecutionContext.userRequest,
64
64
  priorSteps: t.agentExecutionContext.priorSteps,
65
- lastNavigatedFeatures: l
66
- }, p = await A({
65
+ lastNavigatedFeatures: c
66
+ }, p = await _({
67
67
  promptText: d,
68
68
  modelTier: "advanced",
69
69
  messages: t.dataExplorationMessages,
70
70
  inputVariables: m,
71
- tools: k
72
- }), y = p.content.toString();
73
- return await I(p, e), {
71
+ tools: V
72
+ }), f = (p.tool_calls?.length ?? 0) > 0, g = p.content.toString();
73
+ return await $(p, e), {
74
74
  ...t,
75
75
  dataExplorationMessages: [...t.dataExplorationMessages, p],
76
- outputMessage: y,
76
+ // Only emit output here when no tools are being called.
77
+ // For tool-calling flows, downstream summarizer nodes provide the final user-facing message.
78
+ ...f ? {} : { outputMessage: g },
77
79
  status: "success",
78
- summary: y ? N(y) : "Query executed."
80
+ summary: g && !f ? N(g) : "Query planning completed."
79
81
  };
80
82
  }, J = async (t, e) => {
81
83
  try {
82
- await c({ text: "Requesting LLM for summary on query results" }, e);
83
- const d = await T("summarize_query_response_prompt"), n = {
84
+ await n({ text: "Requesting LLM for summary on query results" }, e);
85
+ const d = await T("summarize_query_response_prompt"), l = {
84
86
  queryResponse: t.queryResponse,
85
87
  assignedTask: t.agentExecutionContext.assignedTask,
86
88
  userRequest: t.agentExecutionContext.userRequest,
87
89
  priorSteps: t.agentExecutionContext.priorSteps
88
- }, r = await Q({
90
+ }, s = await Q({
89
91
  promptText: d,
90
92
  modelTier: "fast",
91
93
  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);
94
+ inputVariables: l
95
+ }), o = typeof s == "string" ? s : s.content, r = new j(o);
96
+ await n({ text: `Received response from LLM: ${o}` }, e);
95
97
  const i = o;
96
98
  return {
97
99
  ...t,
98
100
  outputMessage: i,
99
101
  status: "success",
100
102
  summary: i ? N(i) : "Summary generated.",
101
- dataExplorationMessages: [...t.dataExplorationMessages, s]
103
+ dataExplorationMessages: [...t.dataExplorationMessages, r]
102
104
  };
103
105
  } 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)}`);
106
+ 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
107
  }
106
108
  };
107
109
  async function K(t, e) {
108
- const d = await new O(C).invoke(
110
+ if ((t.queryResponse ?? []).some((s) => {
111
+ const o = s.details;
112
+ return typeof o == "object" && o !== null && "error" in o;
113
+ }))
114
+ return await n({ text: "Skipping layer filter tool because query response contains an error." }, e), { ...t };
115
+ const l = await new O(C, { handleToolErrors: !1 }).invoke(
109
116
  {
110
117
  messages: t.dataExplorationMessages
111
118
  },
112
119
  e
113
120
  );
114
- return await c(
115
- { text: `Finished executing layer filter tool: ${d.messages.map((n) => n.content).join(", ")}` },
121
+ return await n(
122
+ { text: `Finished executing layer filter tool: ${l.messages.map((s) => s.content).join(", ")}` },
116
123
  e
117
124
  ), { ...t };
118
125
  }
119
126
  const X = 10, Y = ["string", "small-integer", "integer"], Z = async (t, e, { includeSummaryStatistics: a = !0, includeUniqueValues: d = !0 } = {}) => {
120
- let n = null, r = null;
127
+ let l = null, s = null;
121
128
  try {
122
129
  if (e.type !== "geometry" && e.type !== "oid" && e.type !== "global-id") {
123
- a && (n = await G({ layer: t, field: e.name }));
130
+ a && (l = await G({ layer: t, field: e.name }));
124
131
  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
132
+ 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) => ({
133
+ ...r,
134
+ value: o.getName(r.value) ?? r.value
128
135
  }))));
129
136
  }
130
137
  } catch (o) {
131
138
  console.error(`Error fetching statistics for field ${e.name}:`, o);
132
139
  }
133
140
  return {
134
- summaryStatistics: n,
135
- uniqueValues: r
141
+ summaryStatistics: l,
142
+ uniqueValues: s
136
143
  };
137
144
  };
138
145
  function ee(t, e) {
139
146
  return ["string", "small-integer", "integer"].includes(t) || e === "coded-value";
140
147
  }
141
148
  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;
149
+ const l = [], s = [], o = [];
150
+ for (const r of t) {
151
+ let i = function(y) {
152
+ const u = e.get(y)?.layerItem;
146
153
  return u ? [
147
154
  u.name && `Name: ${u.name}`,
148
155
  u.title && `Title: ${u.title}`,
149
156
  u.description && `Description: ${u.description}`
150
- ].filter(Boolean).join(" | ") : g;
157
+ ].filter(Boolean).join(" | ") : y;
151
158
  };
152
- const { layerId: l, results: m } = s, p = a.map?.allLayers.find((g) => g.id === l), y = e.get(l)?.fieldRegistry;
153
- if (!y)
159
+ const { layerId: c, results: m } = r, p = a.map?.allLayers.find((y) => y.id === c), f = e.get(c)?.fieldRegistry;
160
+ if (!f)
154
161
  continue;
155
- let f = n.find((g) => g.layerId === l);
156
- f || (f = {
157
- layerId: l,
158
- layerSummary: i(l),
162
+ let g = l.find((y) => y.layerId === c);
163
+ g || (g = {
164
+ layerId: c,
165
+ layerSummary: i(c),
159
166
  fieldInfos: []
160
- }, n.push(f));
161
- for (const g of m) {
162
- const u = y.get(g.name);
167
+ }, l.push(g));
168
+ for (const y of m) {
169
+ const u = f.get(y.name);
163
170
  if (!u)
164
171
  continue;
165
172
  const x = u.statistics, E = d && !x?.summaryStatistics, w = ee(u.type, u.domain?.type) && !x?.uniqueValues, q = E || w;
166
173
  if (o.push({
167
- layerId: l,
174
+ layerId: c,
168
175
  fieldName: u.name,
169
176
  didFetchStatistics: q
170
177
  }), q) {
171
- const _ = Z(p, u, {
178
+ const A = Z(p, u, {
172
179
  includeSummaryStatistics: E,
173
180
  includeUniqueValues: w
174
181
  }).then((F) => {
@@ -176,16 +183,16 @@ async function te(t, e, a, d = !0) {
176
183
  summaryStatistics: x?.summaryStatistics ?? null,
177
184
  uniqueValues: x?.uniqueValues ?? null
178
185
  };
179
- E && (S.summaryStatistics = F.summaryStatistics), w && (S.uniqueValues = F.uniqueValues), y.set(u.name, { ...u, statistics: S }), u.statistics = S;
186
+ E && (S.summaryStatistics = F.summaryStatistics), w && (S.uniqueValues = F.uniqueValues), f.set(u.name, { ...u, statistics: S }), u.statistics = S;
180
187
  });
181
- r.push(_);
188
+ s.push(A);
182
189
  }
183
- f.fieldInfos.push(u);
190
+ g.fieldInfos.push(u);
184
191
  }
185
192
  }
186
- return await Promise.all(r), {
187
- layerFieldInfo: n,
188
- didFetchStatistics: r.length > 0,
193
+ return await Promise.all(s), {
194
+ layerFieldInfo: l,
195
+ didFetchStatistics: s.length > 0,
189
196
  fieldStatisticsFetchStatus: o
190
197
  };
191
198
  }
@@ -195,73 +202,73 @@ function ae(t, e) {
195
202
  }
196
203
  const se = async (t, e) => {
197
204
  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(
205
+ await n({ text: "Preparing field information for vector search results" }, e);
206
+ 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
207
  t.vectorSearchFieldResults,
201
208
  a,
202
209
  d,
203
210
  o
204
211
  );
205
- i ? await c({ text: "Statistics fetched" }, e) : await c({ text: "Statistics skipped" }, e);
206
- for (const m of l)
207
- await c(
212
+ i ? await n({ text: "Statistics fetched" }, e) : await n({ text: "Statistics skipped" }, e);
213
+ for (const m of c)
214
+ await n(
208
215
  {
209
216
  text: ` - ${m.fieldName} - stats ${m.didFetchStatistics ? "fetched" : "skipped"}`
210
217
  },
211
218
  e
212
219
  );
213
- return await c({ text: "Field information prepared" }, e), { ...t, layerFieldInfo: s };
220
+ return await n({ text: "Field information prepared" }, e), { ...t, layerFieldInfo: r };
214
221
  } 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)}`);
222
+ throw await n({ text: "Error during fetching statistics" }, e), new Error(`Error during fetching statistics: ${a instanceof Error ? a.message : String(a)}`);
216
223
  }
217
224
  }, L = 0.7, re = 10, oe = async (t, e) => {
218
225
  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({
226
+ await n({ text: "Similarity search to find fields" }, e);
227
+ const a = h(e, "fieldSearch"), d = h(e, "layersAndFieldsRegistry"), l = h(e, "embeddingCache"), s = await a.searchFields({
221
228
  text: t.agentExecutionContext.assignedTask,
222
229
  layerIds: t.vectorSearchLayerIds,
223
230
  minScore: L,
224
231
  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(`
232
+ embeddingCache: l
233
+ }), o = s.map(({ layerId: i, results: c }) => {
234
+ const m = c.map((p) => ` - ${p.name} (${p.score.toFixed(2)})`).join(`
228
235
  `);
229
236
  return `${d.get(i)?.layerItem.name ?? i}:
230
237
  ${m}`;
231
238
  }).join(`
232
239
  `);
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), {
240
+ let r;
241
+ return s.length > 0 ? r = `Vector search completed. Matching layers and fields with scores:
242
+ ${o}` : r = `No vector search results found for score over ${L}.`, await n({ text: r }, e), {
236
243
  ...t,
237
- vectorSearchFieldResults: r
244
+ vectorSearchFieldResults: s
238
245
  };
239
246
  } catch (a) {
240
- throw await c(
247
+ throw await n(
241
248
  { text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
242
249
  e
243
250
  ), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
244
251
  }
245
252
  }, ie = 0.7, ne = async (t, e) => {
246
253
  try {
247
- await c(
254
+ await n(
248
255
  { text: `Similarity search to find layers: ${t.agentExecutionContext.assignedTask}` },
249
256
  e
250
257
  );
251
- const a = h(e, "layerSearch"), d = h(e, "layersAndFieldsRegistry"), n = h(e, "embeddingCache"), r = await a.searchLayers({
258
+ const a = h(e, "layerSearch"), d = h(e, "layersAndFieldsRegistry"), l = h(e, "embeddingCache"), s = await a.searchLayers({
252
259
  text: t.agentExecutionContext.assignedTask,
253
260
  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(`
261
+ embeddingCache: l
262
+ }), o = s.map((c) => c.id), r = s.map(({ id: c, score: m }) => `${d.get(c)?.layerItem.name ?? c} (${m.toFixed(2)})`).join(`
256
263
  `);
257
264
  let i;
258
265
  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), {
266
+ ${r}` : i = "Vector search completed. No matching layers found.", await n({ text: i }, e), {
260
267
  ...t,
261
268
  vectorSearchLayerIds: o
262
269
  };
263
270
  } catch (a) {
264
- throw await c(
271
+ throw await n(
265
272
  { text: `Error during vector search: ${a instanceof Error ? a.message : String(a)}` },
266
273
  e
267
274
  ), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
@@ -269,7 +276,7 @@ ${s}` : i = "Vector search completed. No matching layers found.", await c({ text
269
276
  }, le = (t, e) => z(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
270
277
  t,
271
278
  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(
279
+ ), 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
280
  "vectorSearchLayers",
274
281
  (e) => e.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
275
282
  ).addConditionalEdges(
@@ -291,7 +298,7 @@ ${s}` : i = "Vector search completed. No matching layers found.", await c({ text
291
298
  name: "Data Exploration Agent",
292
299
  description: de,
293
300
  createGraph: ce,
294
- workspace: $
301
+ workspace: b
295
302
  };
296
303
  export {
297
304
  Me as D