@arcgis/ai-components 5.2.0-next.12 → 5.2.0-next.13

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 (73) hide show
  1. package/dist/agent-utils/LLMAgent.js +1 -0
  2. package/dist/cdn/{EBISDZ5H.js → 4UDYY3HL.js} +1 -1
  3. package/dist/cdn/{ERL2CB2Y.js → 55R6J3FL.js} +5 -5
  4. package/dist/cdn/ADYIXCSG.js +2 -0
  5. package/dist/cdn/CAECQD75.js +2 -0
  6. package/dist/cdn/{34SG44C3.js → CE6VDP2D.js} +1 -1
  7. package/dist/cdn/{T43LEBBE.js → CFVVQXPJ.js} +18 -18
  8. package/dist/cdn/CI3QSFPS.js +2 -0
  9. package/dist/cdn/DEAYZ3MK.js +2 -0
  10. package/dist/cdn/{Z2G7MP5L.js → DSVMXDPZ.js} +1 -1
  11. package/dist/cdn/{YLN2BZ5J.js → E2HENO3T.js} +1 -1
  12. package/dist/cdn/{JLKGS6Y5.js → ET453NAD.js} +1 -1
  13. package/dist/cdn/FWU6DFIB.js +2 -0
  14. package/dist/cdn/GPYYAQVI.js +2 -0
  15. package/dist/cdn/JN744CAW.js +2 -0
  16. package/dist/cdn/K475UT3E.js +2 -0
  17. package/dist/cdn/KWTJAVWV.js +2 -0
  18. package/dist/cdn/{5CV7R5IS.js → LREQ3XAW.js} +1 -1
  19. package/dist/cdn/M3SWPT3M.js +2 -0
  20. package/dist/cdn/MAV3DW27.js +4 -0
  21. package/dist/cdn/MRLTR3UO.js +16 -0
  22. package/dist/cdn/PB2ODJC7.js +2 -0
  23. package/dist/cdn/{QCSN44H4.js → QSA4T3BU.js} +1 -1
  24. package/dist/cdn/RMLXVQZ5.js +2 -0
  25. package/dist/cdn/SBHLUL3Q.js +2 -0
  26. package/dist/cdn/{R56X6ZKR.js → SRSFESAD.js} +1 -1
  27. package/dist/cdn/SWBER53G.js +3 -0
  28. package/dist/cdn/WH6QQK6N.js +2 -0
  29. package/dist/cdn/XBW4MWQR.js +2 -0
  30. package/dist/cdn/Z7UWJ4AI.js +3 -0
  31. package/dist/cdn/ZOSUDIJH.js +2 -0
  32. package/dist/cdn/ZPLFFLPF.js +2 -0
  33. package/dist/cdn/agent-utils/index.js +1 -1
  34. package/dist/cdn/index.js +1 -1
  35. package/dist/chunks/adapter.js +169 -168
  36. package/dist/chunks/arcgisKnowledgeGraph.js +3 -2
  37. package/dist/chunks/dataExplorationGraph.js +3 -2
  38. package/dist/chunks/generateLayerDescriptions.js +180 -178
  39. package/dist/chunks/helpGraph.js +3 -2
  40. package/dist/chunks/layerStylingGraph.js +1 -0
  41. package/dist/chunks/navigationGraph.js +3 -2
  42. package/dist/chunks/orchestrator.js +49 -48
  43. package/dist/chunks/toolCallResponse.js +10 -9
  44. package/dist/components/arcgis-assistant/customElement.js +54 -48
  45. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +3 -2
  46. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
  47. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +4 -3
  48. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
  49. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
  50. package/dist/docs/api.json +1 -1
  51. package/dist/docs/docs.json +1 -1
  52. package/dist/docs/web-types.json +1 -1
  53. package/package.json +4 -4
  54. package/dist/cdn/24QNMEFG.js +0 -2
  55. package/dist/cdn/3NBDVZ2I.js +0 -2
  56. package/dist/cdn/53NTYC4I.js +0 -2
  57. package/dist/cdn/AZGGTNA3.js +0 -2
  58. package/dist/cdn/B7WJFBOZ.js +0 -2
  59. package/dist/cdn/DZ2QWNUA.js +0 -3
  60. package/dist/cdn/F6QHMKF5.js +0 -2
  61. package/dist/cdn/H2CHHGGH.js +0 -2
  62. package/dist/cdn/HWKDNS4K.js +0 -4
  63. package/dist/cdn/IMQ4TVHF.js +0 -16
  64. package/dist/cdn/IRZDTYO2.js +0 -2
  65. package/dist/cdn/KHXUWZHB.js +0 -2
  66. package/dist/cdn/LIFK3QSD.js +0 -2
  67. package/dist/cdn/O3EN27N5.js +0 -2
  68. package/dist/cdn/PBO6FZN6.js +0 -2
  69. package/dist/cdn/Q3ZW4FYA.js +0 -3
  70. package/dist/cdn/UPEEHMSY.js +0 -2
  71. package/dist/cdn/WAIFKDR3.js +0 -2
  72. package/dist/cdn/XON27U6U.js +0 -2
  73. package/dist/cdn/YUKR4AZW.js +0 -2
@@ -3,6 +3,7 @@ import { StateGraph as f, START as x, END as h, Command as k } from "@langchain/
3
3
  import { a as b, c as _, b as K, d as A, e as T, s as v, q as S, g as u, h as q, t as c, r as M, i as C, G as E, j as m } from "./adapter.js";
4
4
  import "@arcgis/core/identity/IdentityManager.js";
5
5
  import "@arcgis/core/portal/Portal.js";
6
+ import "@arcgis/toolkit/string";
6
7
  import { h as G, e as N } from "./generateLayerDescriptions.js";
7
8
  import { AIMessage as R } from "@langchain/core/messages";
8
9
  import "@langchain/core/callbacks/dispatch/web";
@@ -199,7 +200,7 @@ _example: "Discover and add all the relationships originating at 'Entity E' to t
199
200
  _example: "Show me all entities with a name similar to 'Smith' and add them to the link chart"_
200
201
  _example: "Find reports in my graph that have a title similar to 'Quarterly Earnings'"_
201
202
  _example: "Find John Smith and all people he has made phone calls to in the last year"_
202
- _example: "What is the average age of all people who work for Esri?"_`, re = {
203
+ _example: "What is the average age of all people who work for Esri?"_`, ie = {
203
204
  id: "arcgisKnowledge",
204
205
  name: "ArcgisKnowledge Agent",
205
206
  description: P,
@@ -207,5 +208,5 @@ _example: "What is the average age of all people who work for Esri?"_`, re = {
207
208
  workspace: m
208
209
  };
209
210
  export {
210
- re as A
211
+ ie as A
211
212
  };
@@ -3,6 +3,7 @@ import { StateGraph as I, START as k, END as v } from "@langchain/langgraph/web"
3
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 "@arcgis/toolkit/string";
6
7
  import { h as _, e as Q } from "./generateLayerDescriptions.js";
7
8
  import { AIMessage as j } from "@langchain/core/messages";
8
9
  import { s as n } from "./index.js";
@@ -298,7 +299,7 @@ ${r}` : i = "Vector search completed. No matching layers found.", await n({ text
298
299
  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.
299
300
  _Example: “How many features are there?”_
300
301
  _Example: “What’s the average population?”_
301
- _Example: “Which values are in the status field?”_`, Re = {
302
+ _Example: “Which values are in the status field?”_`, Ce = {
302
303
  id: "dataExploration",
303
304
  name: "Data Exploration Agent",
304
305
  description: de,
@@ -306,5 +307,5 @@ ${r}` : i = "Vector search completed. No matching layers found.", await n({ text
306
307
  workspace: b
307
308
  };
308
309
  export {
309
- Re as D
310
+ Ce as D
310
311
  };
@@ -1,44 +1,45 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { Annotation as p } from "@langchain/langgraph/web";
3
- import m, { z as r } from "zod";
2
+ import { Annotation as m } from "@langchain/langgraph/web";
3
+ import u, { z as r } from "zod";
4
4
  import { ChatPromptTemplate as D, SystemMessagePromptTemplate as K } from "@langchain/core/prompts";
5
5
  import { s as f } from "./index.js";
6
6
  import { AIMessage as B, isAIMessage as W, isToolMessage as X } from "@langchain/core/messages";
7
- import { createAgent as H, summarizationMiddleware as J, modelCallLimitMiddleware as G } from "langchain";
7
+ import { createAgent as G, summarizationMiddleware as H, modelCallLimitMiddleware as J } from "langchain";
8
8
  import { ChatOpenAI as Q, OpenAIEmbeddings as Y } from "@langchain/openai";
9
- import F from "@arcgis/core/portal/Portal.js";
9
+ import q from "@arcgis/core/portal/Portal.js";
10
10
  import Z from "@arcgis/core/identity/IdentityManager.js";
11
- import ee from "@arcgis/core/config.js";
12
- const q = {
11
+ import { generateGuid as ee } from "@arcgis/toolkit/string";
12
+ import te from "@arcgis/core/config.js";
13
+ const F = {
13
14
  advanced: "gpt-5.2",
14
15
  default: "gpt-5-mini",
15
16
  fast: "gpt-5.4-nano"
16
- }, k = {
17
+ }, I = {
17
18
  default: "text-embedding-ada-002"
18
- }, M = /* @__PURE__ */ new Map();
19
- let x = null;
20
- const te = () => {
21
- const t = F.getDefault().helperServices;
19
+ }, T = /* @__PURE__ */ new Map();
20
+ let M = null;
21
+ const ne = () => {
22
+ const t = q.getDefault().helperServices;
22
23
  if (!t?.aiModels?.url)
23
24
  throw new Error("AI Models Service URL is not defined in the portal's helper services.");
24
25
  return t.aiModels.url;
25
26
  }, U = async (e) => {
26
- const t = te();
27
- M.size === 0 && (x || (x = (async () => {
27
+ const t = ne();
28
+ T.size === 0 && (M || (M = (async () => {
28
29
  try {
29
30
  const n = await fetch(`${t}/models`);
30
31
  if (!n.ok)
31
32
  throw new Error("Failed to fetch AI service discovery data.");
32
- (await n.json()).models.forEach((o) => M.set(o.name, o));
33
+ (await n.json()).models.forEach((i) => T.set(i.name, i));
33
34
  } catch (n) {
34
- throw x = null, n;
35
+ throw M = null, n;
35
36
  }
36
- })()), await x);
37
- const s = M.get(e);
37
+ })()), await M);
38
+ const s = T.get(e);
38
39
  if (!s)
39
40
  throw new Error(`Model '${e}' is not available in the discovery service.`);
40
41
  return s.endpoint;
41
- }, ne = async (e = "default") => await U(q[e]), se = async (e = "default") => await U(k[e]), h = (e, t) => t, P = (e, t) => ({
42
+ }, se = async (e = "default") => await U(F[e]), oe = async (e = "default") => await U(I[e]), h = (e, t) => t, P = (e, t) => ({
42
43
  ...e,
43
44
  ...t
44
45
  }), _ = (e = "", t) => {
@@ -50,10 +51,10 @@ const te = () => {
50
51
  return s;
51
52
  if (n === s)
52
53
  return e;
53
- const i = n.split(`
54
+ const o = n.split(`
54
55
 
55
56
  `);
56
- return i[i.length - 1]?.trim() === s ? e : `${e}
57
+ return o[o.length - 1]?.trim() === s ? e : `${e}
57
58
 
58
59
  ${s}`;
59
60
  }, j = () => ({
@@ -63,65 +64,65 @@ ${s}`;
63
64
  priorSteps: [],
64
65
  sharedState: {}
65
66
  }), ie = () => ({
66
- agentExecutionContext: p({
67
+ agentExecutionContext: m({
67
68
  reducer: P,
68
69
  default: j
69
70
  }),
70
- outputMessage: p({
71
+ outputMessage: m({
71
72
  reducer: _,
72
73
  default: () => ""
73
74
  }),
74
- summary: p({
75
+ summary: m({
75
76
  reducer: h,
76
77
  default: () => ""
77
78
  }),
78
- status: p({
79
+ status: m({
79
80
  reducer: h
80
81
  })
81
- }), Pe = () => ({
82
+ }), Ne = () => ({
82
83
  ...ie(),
83
- sharedStatePatch: p({
84
+ sharedStatePatch: m({
84
85
  reducer: h
85
86
  })
86
- }), _e = p.Root({
87
- agentExecutionContext: p({
87
+ }), Oe = m.Root({
88
+ agentExecutionContext: m({
88
89
  default: j,
89
90
  reducer: P
90
91
  }),
91
- currentIntent: p({
92
+ currentIntent: m({
92
93
  default: () => "none",
93
94
  reducer: h
94
95
  }),
95
- lastExecutedAgent: p({
96
+ lastExecutedAgent: m({
96
97
  default: () => "",
97
98
  reducer: h
98
99
  }),
99
- requiresFollowUp: p({
100
+ requiresFollowUp: m({
100
101
  default: () => !0,
101
102
  reducer: h
102
103
  }),
103
- stepCount: p({
104
+ stepCount: m({
104
105
  default: () => 0,
105
106
  reducer: (e, t) => t ?? e + 1
106
107
  }),
107
- finalOutputMessage: p({
108
+ finalOutputMessage: m({
108
109
  default: () => "",
109
110
  reducer: _
110
111
  })
111
- }), oe = (e) => {
112
+ }), re = (e) => {
112
113
  if (!e || typeof e != "object" || !("services" in e))
113
114
  return !1;
114
115
  const t = e.services;
115
116
  return !!t && typeof t == "object" && "agentRegistry" in t;
116
- }, re = (e) => {
117
+ }, ae = (e) => {
117
118
  const t = e?.configurable;
118
- return oe(t) ? t : void 0;
119
- }, ae = (e, t, s) => {
119
+ return re(t) ? t : void 0;
120
+ }, ce = (e, t, s) => {
120
121
  const n = e[t];
121
- return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, o) => {
122
- (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(o.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== s ? ". Note that variables only represent file names one level deep." : ""))));
122
+ return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((o, i) => {
123
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(i.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== s ? ". Note that variables only represent file names one level deep." : ""))));
123
124
  });
124
- }, I = async (e) => (await ae(/* @__PURE__ */ Object.assign({ "./field_descriptions_prompt.md": () => import("./field_descriptions_prompt.js"), "./intent_prompt.md": () => import("./intent_prompt.js"), "./layer_descriptions_prompt.md": () => import("./layer_descriptions_prompt.js") }), `./${e}.md`, 2)).default, ce = async (e) => {
125
+ }, k = async (e) => (await ce(/* @__PURE__ */ Object.assign({ "./field_descriptions_prompt.md": () => import("./field_descriptions_prompt.js"), "./intent_prompt.md": () => import("./intent_prompt.js"), "./layer_descriptions_prompt.md": () => import("./layer_descriptions_prompt.js") }), `./${e}.md`, 2)).default, le = async (e) => {
125
126
  const { agent: t, messages: s, config: n } = e;
126
127
  return { structuredResponse: (await t.invoke(
127
128
  {
@@ -129,64 +130,65 @@ ${s}`;
129
130
  },
130
131
  n
131
132
  )).structuredResponse };
132
- }, le = (e) => typeof e == "string" && e.length > 0 ? e : void 0, de = (e) => e && typeof e == "object" && "aborted" in e ? e : void 0, pe = (e) => {
133
+ }, de = (e) => typeof e == "string" && e.length > 0 ? e : void 0, pe = (e) => e && typeof e == "object" && "aborted" in e ? e : void 0, me = () => ee(), ue = (e) => typeof e != "string" || e.trim().length === 0 ? "MapsSDK" : `MapsSDK - ${e.trim()}`, ge = (e) => {
133
134
  const t = e?.configurable;
134
135
  return {
135
- conversationId: le(t?.thread_id),
136
- abortSignal: de(t?.abortSignal),
137
- requestId: ee.applicationName
136
+ conversationId: de(t?.thread_id),
137
+ abortSignal: pe(t?.abortSignal),
138
+ requestId: me(),
139
+ requestSource: ue(te.applicationName)
138
140
  };
139
- }, N = async ({ config: e }) => {
140
- const t = F.getDefault(), n = (await Z.getCredential(`${t.url}/sharing`))?.token;
141
- return async (i, o) => {
142
- const { conversationId: a, abortSignal: d, requestId: c } = pe(e), l = new Headers(o?.headers);
143
- l.delete("Authorization"), l.delete("api-key"), n && n.length > 0 && (l.set("X-Esri-Authorization", `Bearer ${n}`), l.set("X-Esri-Request-Source", "MapsSDK")), a && a.length > 0 && l.set("X-Esri-Conversation-Id", a), c && c.length > 0 && l.set("X-Esri-Request-Id", c);
144
- const u = d && o?.signal ? AbortSignal.any([d, o.signal]) : o?.signal ?? d;
145
- return await fetch(i, {
146
- ...o,
147
- headers: l,
148
- signal: u
141
+ }, $ = async ({ config: e }) => {
142
+ const t = q.getDefault(), n = (await Z.getCredential(`${t.url}/sharing`))?.token;
143
+ return async (o, i) => {
144
+ const { conversationId: a, abortSignal: l, requestId: c, requestSource: p } = ge(e), d = new Headers(i?.headers);
145
+ d.delete("Authorization"), d.delete("api-key"), n && n.length > 0 && (d.set("X-Esri-Authorization", `Bearer ${n}`), d.set("X-Esri-Request-Source", p)), a && a.length > 0 && d.set("X-Esri-Conversation-Id", a), c.length > 0 && d.set("X-Esri-Request-Id", c);
146
+ const y = l && i?.signal ? AbortSignal.any([l, i.signal]) : i?.signal ?? l;
147
+ return await fetch(o, {
148
+ ...i,
149
+ headers: d,
150
+ signal: y
149
151
  });
150
152
  };
151
- }, b = async (e = {}) => {
152
- const { modelTier: t = "default", temperature: s = 0, config: n } = e, i = q[t], o = await ne(t);
153
+ }, v = async (e = {}) => {
154
+ const { modelTier: t = "default", temperature: s = 0, config: n } = e, o = F[t], i = await se(t);
153
155
  return new Q({
154
- modelName: i,
156
+ modelName: o,
155
157
  apiKey: "dummy-key",
156
158
  // 5-mini does not support temperature parameter
157
159
  ...t !== "default" && { temperature: s },
158
160
  configuration: {
159
- baseURL: o,
160
- fetch: await N({ config: n })
161
+ baseURL: i,
162
+ fetch: await $({ config: n })
161
163
  }
162
164
  });
163
- }, je = async (e = {}) => {
164
- const { tier: t = "default", config: s } = e, n = k[t], i = await se(t);
165
+ }, Ve = async (e = {}) => {
166
+ const { tier: t = "default", config: s } = e, n = I[t], o = await oe(t);
165
167
  return new Y({
166
168
  modelName: n,
167
169
  apiKey: "dummy-key",
168
170
  configuration: {
169
- baseURL: i,
170
- fetch: await N({ config: s })
171
+ baseURL: o,
172
+ fetch: await $({ config: s })
171
173
  },
172
174
  batchSize: 2048,
173
175
  maxConcurrency: 10
174
176
  });
175
- }, me = r.object({
177
+ }, fe = r.object({
176
178
  id: r.string().min(1),
177
179
  name: r.string().min(1),
178
180
  description: r.string().min(1)
179
181
  });
180
- r.array(me);
181
- const C = (e) => JSON.stringify(e, null, 2), ue = (e) => {
182
+ r.array(fe);
183
+ const R = (e) => JSON.stringify(e, null, 2), he = (e) => {
182
184
  const t = e.map((n) => n.id), s = r.enum(t);
183
185
  return r.object({
184
186
  intent: s.nullable(),
185
187
  assignedTask: r.string().nullable(),
186
188
  requiresFollowUp: r.boolean()
187
189
  });
188
- }, Ne = async (e, t) => {
189
- const s = re(t);
190
+ }, ze = async (e, t) => {
191
+ const s = ae(t);
190
192
  if (s.abortSignal?.aborted)
191
193
  return await f({ text: "Run cancelled; skipping intent routing" }, t), {
192
194
  ...e,
@@ -196,35 +198,35 @@ const C = (e) => JSON.stringify(e, null, 2), ue = (e) => {
196
198
  };
197
199
  try {
198
200
  await f({ text: "Asking LLM to route to an agent" }, t);
199
- const i = s.services.agentRegistry?.list() ?? [], o = i.map(({ agent: g }) => ({
201
+ const o = s.services.agentRegistry?.list() ?? [], i = o.map(({ agent: g }) => ({
200
202
  id: g.id,
201
203
  name: g.name,
202
204
  description: g.description
203
205
  }));
204
- if (!o.length)
206
+ if (!i.length)
205
207
  return await f({ text: "No agents registered; skipping intent detection" }, t), {
206
208
  ...e,
207
209
  currentIntent: "none",
208
210
  finalOutputMessage: "No agents registered; skipping intent detection."
209
211
  };
210
- const a = await I("intent_prompt"), d = C(o), c = ue(o), l = {
211
- registeredAgents: d,
212
- priorSteps: C(e.agentExecutionContext.priorSteps),
212
+ const a = await k("intent_prompt"), l = R(i), c = he(i), p = {
213
+ registeredAgents: l,
214
+ priorSteps: R(e.agentExecutionContext.priorSteps),
213
215
  userRequest: e.agentExecutionContext.userRequest
214
- }, T = await D.fromTemplate(a).format(l), E = H({
215
- model: await b({
216
+ }, y = await D.fromTemplate(a).format(p), E = G({
217
+ model: await v({
216
218
  modelTier: "fast",
217
219
  config: t
218
220
  }),
219
221
  tools: [],
220
- systemPrompt: T,
222
+ systemPrompt: y,
221
223
  responseFormat: c,
222
224
  middleware: [
223
225
  // Preserve recent conversation context while summarizing older messages
224
226
  // to control token usage without losing important intent signals.
225
227
  // The trigger and keep parameters can be tuned based on token limits and behavior.
226
- J({
227
- model: await b({
228
+ H({
229
+ model: await v({
228
230
  modelTier: "fast",
229
231
  config: t
230
232
  }),
@@ -233,30 +235,30 @@ const C = (e) => JSON.stringify(e, null, 2), ue = (e) => {
233
235
  }),
234
236
  // Enforce no loop/retry.
235
237
  // 1 usual LLM call and 1 optional summarization call.
236
- G({ runLimit: 2 })
238
+ J({ runLimit: 2 })
237
239
  ]
238
- }), { structuredResponse: V } = await ce({
240
+ }), { structuredResponse: V } = await le({
239
241
  agent: E,
240
242
  messages: e.agentExecutionContext.messages,
241
243
  config: t
242
- }), y = c.parse(
244
+ }), w = c.parse(
243
245
  V ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
244
- ), v = y.intent ?? "none", z = {
246
+ ), x = w.intent ?? "none", z = {
245
247
  ...e,
246
- currentIntent: v,
247
- requiresFollowUp: y.requiresFollowUp,
248
+ currentIntent: x,
249
+ requiresFollowUp: w.requiresFollowUp,
248
250
  agentExecutionContext: {
249
251
  ...e.agentExecutionContext,
250
- assignedTask: y.assignedTask ?? ""
252
+ assignedTask: w.assignedTask ?? ""
251
253
  }
252
254
  };
253
- if (v === "none") {
254
- const g = `I could not find an agent that can handle that request. I have access to the following agents: ${i.map(({ agent: L }) => L.name).join(", ")}.
255
+ if (x === "none") {
256
+ const g = `I could not find an agent that can handle that request. I have access to the following agents: ${o.map(({ agent: L }) => L.name).join(", ")}.
255
257
 
256
258
  Please ask a question that can be answered by one of these agents.`;
257
259
  return await f({ text: "LLM did not identify a clear intent." }, t), {
258
260
  ...e,
259
- currentIntent: v,
261
+ currentIntent: x,
260
262
  requiresFollowUp: !1,
261
263
  finalOutputMessage: g,
262
264
  agentExecutionContext: {
@@ -277,29 +279,29 @@ Please ask a question that can be answered by one of these agents.`;
277
279
  }
278
280
  return await f(
279
281
  {
280
- text: `Agent picked: ${v}
281
- Task Assigned: ${y.assignedTask ?? ""}
282
- Requires Follow-Up: ${y.requiresFollowUp}`
282
+ text: `Agent picked: ${x}
283
+ Task Assigned: ${w.assignedTask ?? ""}
284
+ Requires Follow-Up: ${w.requiresFollowUp}`
283
285
  },
284
286
  t
285
287
  ), z;
286
288
  } catch (n) {
287
289
  throw await f({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
288
290
  }
289
- }, ge = "0.1", w = 1536, fe = "openai", he = k.default, ye = `Name: {name}
291
+ }, ye = "0.1", b = 1536, we = "openai", be = I.default, ve = `Name: {name}
290
292
  Title: {title}
291
- Description: {description}`, we = `Name: {name}
293
+ Description: {description}`, xe = `Name: {name}
292
294
  Alias: {alias}
293
- Description: {description}`, $e = r.object({
294
- schemaVersion: r.literal(ge),
295
+ Description: {description}`, Le = r.object({
296
+ schemaVersion: r.literal(ye),
295
297
  modified: r.number().int().nonnegative(),
296
298
  embeddings: r.object({
297
- modelProvider: r.literal(fe),
298
- model: r.literal(he),
299
- dimensions: r.literal(w),
299
+ modelProvider: r.literal(we),
300
+ model: r.literal(be),
301
+ dimensions: r.literal(b),
300
302
  templates: r.object({
301
- layer: r.string().default(ye),
302
- field: r.string().default(we)
303
+ layer: r.string().default(ve),
304
+ field: r.string().default(xe)
303
305
  })
304
306
  }),
305
307
  layers: r.array(
@@ -308,144 +310,144 @@ Description: {description}`, $e = r.object({
308
310
  name: r.string().min(1),
309
311
  title: r.string().catch(""),
310
312
  description: r.string().catch(""),
311
- vector: r.array(r.number()).length(w, {
312
- message: `Layer vector must be exactly ${w} dimensions`
313
+ vector: r.array(r.number()).length(b, {
314
+ message: `Layer vector must be exactly ${b} dimensions`
313
315
  }),
314
316
  fields: r.array(
315
317
  r.object({
316
318
  name: r.string().min(1),
317
319
  alias: r.string().catch(""),
318
320
  description: r.string().catch(""),
319
- vector: r.array(r.number()).length(w, {
320
- message: `Field vector must be exactly ${w} dimensions`
321
+ vector: r.array(r.number()).length(b, {
322
+ message: `Field vector must be exactly ${b} dimensions`
321
323
  })
322
324
  })
323
325
  )
324
326
  })
325
327
  ).default([])
326
- }), be = (e) => {
328
+ }), Me = (e) => {
327
329
  const t = /* @__PURE__ */ new Set();
328
330
  for (const n of e)
329
331
  if (W(n)) {
330
- const i = n;
331
- i.tool_calls && i.tool_calls.length > 0 && i.tool_calls.forEach((o) => {
332
- o.id && t.add(o.id);
332
+ const o = n;
333
+ o.tool_calls && o.tool_calls.length > 0 && o.tool_calls.forEach((i) => {
334
+ i.id && t.add(i.id);
333
335
  });
334
336
  }
335
337
  return e.filter((n) => {
336
338
  if (X(n)) {
337
- const i = n;
338
- return t.has(i.tool_call_id);
339
+ const o = n;
340
+ return t.has(o.tool_call_id);
339
341
  }
340
342
  return !0;
341
343
  });
342
344
  }, A = (e, t) => {
343
345
  const s = K.fromTemplate(e);
344
346
  return D.fromMessages([s, ...t]);
345
- }, ve = async (e) => {
346
- const { promptText: t, modelTier: s, temperature: n, messages: i, config: o } = e, a = A(t, i ?? []), d = await b({ modelTier: s, temperature: n, config: o });
347
- return a.pipe(d);
348
- }, Oe = async (e) => {
349
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, config: a } = e, c = await (await ve({
347
+ }, Te = async (e) => {
348
+ const { promptText: t, modelTier: s, temperature: n, messages: o, config: i } = e, a = A(t, o ?? []), l = await v({ modelTier: s, temperature: n, config: i });
349
+ return a.pipe(l);
350
+ }, Ke = async (e) => {
351
+ const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: o, inputVariables: i, config: a } = e, c = await (await Te({
350
352
  promptText: t,
351
353
  modelTier: s,
352
354
  temperature: n,
353
- messages: i,
355
+ messages: o,
354
356
  config: a
355
- })).invoke(o ?? {});
357
+ })).invoke(i ?? {});
356
358
  if (typeof c == "string")
357
359
  return c;
358
- const l = c.content;
359
- return typeof l == "string" ? l : JSON.stringify(l);
360
- }, $ = async (e) => {
361
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, schema: a, config: d } = e, c = A(t, i ?? []), u = (await b({ modelTier: s, temperature: n, config: d })).withStructuredOutput(a);
362
- return await c.pipe(u).invoke(o ?? {});
363
- }, Ve = async (e) => {
364
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: o, tools: a, config: d } = e, c = a.length > 0 ? be(i ?? []) : i ?? [], l = A(t, c), u = await b({ modelTier: s, temperature: n, config: d });
365
- return await l.pipe(u.bindTools(a)).invoke(o ?? {});
366
- }, xe = m.object({
367
- name: m.string(),
368
- description: m.string(),
369
- valueType: m.string(),
370
- alias: m.string()
371
- }), Te = m.object({
372
- fields: m.array(xe)
373
- }), O = (e, t) => e.getFieldAlias(t) ?? void 0, S = (e, t) => O(e, t.name) ?? t.alias ?? "", Me = (e, t) => {
360
+ const p = c.content;
361
+ return typeof p == "string" ? p : JSON.stringify(p);
362
+ }, N = async (e) => {
363
+ const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: o, inputVariables: i, schema: a, config: l } = e, c = A(t, o ?? []), d = (await v({ modelTier: s, temperature: n, config: l })).withStructuredOutput(a);
364
+ return await c.pipe(d).invoke(i ?? {});
365
+ }, Be = async (e) => {
366
+ const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: o, inputVariables: i, tools: a, config: l } = e, c = a.length > 0 ? Me(o ?? []) : o ?? [], p = A(t, c), d = await v({ modelTier: s, temperature: n, config: l });
367
+ return await p.pipe(d.bindTools(a)).invoke(i ?? {});
368
+ }, Se = u.object({
369
+ name: u.string(),
370
+ description: u.string(),
371
+ valueType: u.string(),
372
+ alias: u.string()
373
+ }), Ie = u.object({
374
+ fields: u.array(Se)
375
+ }), O = (e, t) => e.getFieldAlias(t) ?? void 0, S = (e, t) => O(e, t.name) ?? t.alias ?? "", ke = (e, t) => {
374
376
  const s = O(e, t.name);
375
377
  return !!(s && s !== (t.alias ?? ""));
376
378
  };
377
- function R(e, t) {
379
+ function C(e, t) {
378
380
  const s = /* @__PURE__ */ new Map();
379
381
  for (const n of e.fields) {
380
- const i = t.fields.find((c) => c.name === n.name), o = S(e, n), a = Me(e, n), d = {
382
+ const o = t.fields.find((c) => c.name === n.name), i = S(e, n), a = ke(e, n), l = {
381
383
  name: n.name,
382
384
  type: n.type,
383
- alias: a ? o : i?.alias ?? o,
384
- description: i?.description ?? n.description ?? "",
385
- valueType: i?.valueType ?? n.valueType ?? "",
385
+ alias: a ? i : o?.alias ?? i,
386
+ description: o?.description ?? n.description ?? "",
387
+ valueType: o?.valueType ?? n.valueType ?? "",
386
388
  domain: e.getFieldDomain(n.name) ?? void 0
387
389
  };
388
- s.set(n.name, d);
390
+ s.set(n.name, l);
389
391
  }
390
392
  return s;
391
393
  }
392
- const ze = async (e) => {
393
- const s = await I("field_descriptions_prompt"), n = e.fields.filter((a) => !(S(e, a) && a.description)).map((a) => {
394
- const { name: d, type: c, description: l } = a, u = S(e, a);
395
- return [`Name: ${d}`, `Type: ${c}`, `Alias: ${u}`, `Description: ${l ?? "N/A"}`].join(", ");
394
+ const We = async (e) => {
395
+ const s = await k("field_descriptions_prompt"), n = e.fields.filter((a) => !(S(e, a) && a.description)).map((a) => {
396
+ const { name: l, type: c, description: p } = a, d = S(e, a);
397
+ return [`Name: ${l}`, `Type: ${c}`, `Alias: ${d}`, `Description: ${p ?? "N/A"}`].join(", ");
396
398
  }).join(`
397
399
  `);
398
400
  if (n.length === 0)
399
- return R(e, { fields: [] });
400
- const i = {
401
+ return C(e, { fields: [] });
402
+ const o = {
401
403
  existingItemTitle: e.portalItem?.title,
402
404
  existingItemDescription: e.portalItem?.description,
403
405
  existingLayerTitle: e.title,
404
406
  existingLayerDescription: e.portalItem?.description,
405
407
  fieldInformation: n
406
- }, o = await $({
408
+ }, i = await N({
407
409
  promptText: s,
408
- schema: Te,
409
- inputVariables: i
410
+ schema: Ie,
411
+ inputVariables: o
410
412
  });
411
- return R(e, o);
412
- }, Se = m.object({
413
- title: m.string(),
414
- description: m.string(),
415
- name: m.string().nullable()
416
- }), Le = async (e, t) => {
417
- const n = await I("layer_descriptions_prompt"), i = Array.from(t.values()), o = {
418
- fieldInformation: JSON.stringify(i, null, 2),
413
+ return C(e, i);
414
+ }, Ae = u.object({
415
+ title: u.string(),
416
+ description: u.string(),
417
+ name: u.string().nullable()
418
+ }), Xe = async (e, t) => {
419
+ const n = await k("layer_descriptions_prompt"), o = Array.from(t.values()), i = {
420
+ fieldInformation: JSON.stringify(o, null, 2),
419
421
  existingLayerTitle: e.title,
420
422
  existingLayerDescription: e.portalItem?.description,
421
423
  existingLayerSnippet: e.portalItem?.snippet,
422
424
  layerGeometryType: e.geometryType
423
425
  };
424
- return { ...await $({
426
+ return { ...await N({
425
427
  promptText: n,
426
- schema: Se,
427
- inputVariables: o
428
+ schema: Ae,
429
+ inputVariables: i
428
430
  }), name: e.title ?? null };
429
431
  };
430
432
  export {
431
- _e as D,
432
- $e as W,
433
- Le as a,
434
- fe as b,
435
- b as c,
436
- w as d,
437
- Oe as e,
438
- we as f,
439
- ze as g,
440
- Ve as h,
441
- $ as i,
433
+ Oe as D,
434
+ Le as W,
435
+ Xe as a,
436
+ we as b,
437
+ v as c,
438
+ b as d,
439
+ Ke as e,
440
+ xe as f,
441
+ We as g,
442
+ Be as h,
443
+ N as i,
442
444
  ie as j,
443
- Pe as k,
444
- ye as l,
445
- he as m,
446
- se as n,
447
- re as o,
448
- Ne as p,
449
- je as q,
450
- ge as s
445
+ Ne as k,
446
+ ve as l,
447
+ be as m,
448
+ oe as n,
449
+ ae as o,
450
+ ze as p,
451
+ Ve as q,
452
+ ye as s
451
453
  };