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

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 (39) hide show
  1. package/dist/cdn/{3WINIQWY.js → 3NI46YCE.js} +1 -1
  2. package/dist/cdn/{GBNUMN4J.js → 47FWPQ2A.js} +1 -1
  3. package/dist/cdn/{GJUXVEOF.js → AEJHYRGT.js} +1 -1
  4. package/dist/cdn/{ERBQSEPQ.js → BFZJNJL6.js} +1 -1
  5. package/dist/cdn/{M6F4MXDK.js → GCQLVNNC.js} +1 -1
  6. package/dist/cdn/{DO2P3PWF.js → JV4SI65E.js} +26 -24
  7. package/dist/cdn/{J5CMRCPS.js → R6HV42YW.js} +1 -1
  8. package/dist/cdn/{3BKUCFKS.js → V7OJRG26.js} +1 -1
  9. package/dist/cdn/{CXWBEDXN.js → VOQX4AVB.js} +1 -1
  10. package/dist/cdn/index.js +1 -1
  11. package/dist/cdn/main.css +1 -1
  12. package/dist/chunks/generateLayerDescriptions.js +153 -145
  13. package/dist/components/arcgis-assistant-chat/customElement.d.ts +6 -1
  14. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -1
  15. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
  16. package/dist/components/arcgis-assistant-message/customElement.d.ts +21 -0
  17. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  18. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  19. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  20. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  21. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +4 -1
  22. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  23. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  24. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +4 -1
  25. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  26. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  27. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
  28. package/dist/docs/api.json +1 -1
  29. package/dist/docs/docs.json +1 -1
  30. package/dist/docs/vscode.html-custom-data.json +1 -1
  31. package/dist/docs/web-types.json +1 -1
  32. package/dist/index.d.ts +4 -0
  33. package/dist/types/lumina.d.ts +5 -0
  34. package/dist/types/preact.d.ts +6 -0
  35. package/dist/types/react.d.ts +7 -0
  36. package/dist/types/stencil.d.ts +5 -0
  37. package/dist/utils/index.d.ts +2 -11
  38. package/dist/utils/index.js +64 -78
  39. package/package.json +6 -6
@@ -1,11 +1,11 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { Annotation as d } from "@langchain/langgraph/web";
3
3
  import p, { z as o } from "zod";
4
- import { ChatPromptTemplate as F, SystemMessagePromptTemplate as B } from "@langchain/core/prompts";
4
+ import { ChatPromptTemplate as F, SystemMessagePromptTemplate as W } from "@langchain/core/prompts";
5
5
  import { dispatchCustomEvent as U } from "@langchain/core/callbacks/dispatch/web";
6
- import { AIMessage as W, isAIMessage as H, isToolMessage as J } from "@langchain/core/messages";
7
- import { createAgent as X, summarizationMiddleware as G, modelCallLimitMiddleware as Q } from "langchain";
8
- import { ChatOpenAI as Y, OpenAIEmbeddings as Z } from "@langchain/openai";
6
+ import { AIMessage as H, isAIMessage as J, isToolMessage as X } from "@langchain/core/messages";
7
+ import { createAgent as G, summarizationMiddleware as Q, modelCallLimitMiddleware as Y } from "langchain";
8
+ import { ChatOpenAI as Z, OpenAIEmbeddings as ee } from "@langchain/openai";
9
9
  import _ from "@arcgis/core/identity/IdentityManager.js";
10
10
  import k from "@arcgis/core/portal/Portal.js";
11
11
  const P = {
@@ -14,30 +14,30 @@ const P = {
14
14
  fast: "gpt-5.4-nano"
15
15
  }, A = {
16
16
  default: "text-embedding-ada-002"
17
- }, S = /* @__PURE__ */ new Map();
17
+ }, M = /* @__PURE__ */ new Map();
18
18
  let v = null;
19
- const ee = () => {
19
+ const te = () => {
20
20
  const t = k.getDefault().helperServices;
21
21
  if (!t?.aiModels?.url)
22
22
  throw new Error("AI Models Service URL is not defined in the portal's helper services.");
23
23
  return t.aiModels.url;
24
24
  }, q = async (e) => {
25
- const t = ee();
26
- S.size === 0 && (v || (v = (async () => {
25
+ const t = te();
26
+ M.size === 0 && (v || (v = (async () => {
27
27
  try {
28
28
  const n = await fetch(`${t}/models`);
29
29
  if (!n.ok)
30
30
  throw new Error("Failed to fetch AI service discovery data.");
31
- (await n.json()).models.forEach((r) => S.set(r.name, r));
31
+ (await n.json()).models.forEach((i) => M.set(i.name, i));
32
32
  } catch (n) {
33
33
  throw v = null, n;
34
34
  }
35
35
  })()), await v);
36
- const s = S.get(e);
36
+ const s = M.get(e);
37
37
  if (!s)
38
38
  throw new Error(`Model '${e}' is not available in the discovery service.`);
39
39
  return s.endpoint;
40
- }, te = async (e = "default") => await q(P[e]), ne = async (e = "default") => await q(A[e]), f = (e, t) => t, j = (e, t) => ({
40
+ }, ne = async (e = "default") => await q(P[e]), se = async (e = "default") => await q(A[e]), h = (e, t) => t, j = (e, t) => ({
41
41
  ...e,
42
42
  ...t
43
43
  }), $ = (e = "", t) => {
@@ -49,10 +49,10 @@ const ee = () => {
49
49
  return s;
50
50
  if (n === s)
51
51
  return e;
52
- const i = n.split(`
52
+ const a = n.split(`
53
53
 
54
54
  `);
55
- return i[i.length - 1]?.trim() === s ? e : `${e}
55
+ return a[a.length - 1]?.trim() === s ? e : `${e}
56
56
 
57
57
  ${s}`;
58
58
  }, N = () => ({
@@ -61,7 +61,7 @@ ${s}`;
61
61
  messages: [],
62
62
  priorSteps: [],
63
63
  sharedState: {}
64
- }), se = () => ({
64
+ }), ae = () => ({
65
65
  agentExecutionContext: d({
66
66
  reducer: j,
67
67
  default: N
@@ -71,33 +71,33 @@ ${s}`;
71
71
  default: () => ""
72
72
  }),
73
73
  summary: d({
74
- reducer: f,
74
+ reducer: h,
75
75
  default: () => ""
76
76
  }),
77
77
  status: d({
78
- reducer: f
78
+ reducer: h
79
79
  })
80
- }), Re = () => ({
81
- ...se(),
80
+ }), De = () => ({
81
+ ...ae(),
82
82
  sharedStatePatch: d({
83
- reducer: f
83
+ reducer: h
84
84
  })
85
- }), De = d.Root({
85
+ }), Fe = d.Root({
86
86
  agentExecutionContext: d({
87
87
  default: N,
88
88
  reducer: j
89
89
  }),
90
90
  currentIntent: d({
91
91
  default: () => "none",
92
- reducer: f
92
+ reducer: h
93
93
  }),
94
94
  lastExecutedAgent: d({
95
95
  default: () => "",
96
- reducer: f
96
+ reducer: h
97
97
  }),
98
98
  requiresFollowUp: d({
99
99
  default: () => !0,
100
- reducer: f
100
+ reducer: h
101
101
  }),
102
102
  stepCount: d({
103
103
  default: () => 0,
@@ -107,24 +107,24 @@ ${s}`;
107
107
  default: () => "",
108
108
  reducer: $
109
109
  })
110
- }), g = async (e, t) => {
110
+ }), f = async (e, t) => {
111
111
  await U("trace_message", e, t);
112
- }, Fe = async (e, t) => {
112
+ }, Ue = async (e, t) => {
113
113
  await U("graph_ux_suggestion", e, t);
114
114
  }, ie = (e) => {
115
115
  if (!e || typeof e != "object" || !("services" in e))
116
116
  return !1;
117
117
  const t = e.services;
118
118
  return !!t && typeof t == "object" && "agentRegistry" in t;
119
- }, re = (e) => {
119
+ }, oe = (e) => {
120
120
  const t = e?.configurable;
121
121
  return ie(t) ? t : void 0;
122
- }, oe = (e, t, s) => {
122
+ }, re = (e, t, s) => {
123
123
  const n = e[t];
124
- return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, r) => {
125
- (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(r.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== s ? ". Note that variables only represent file names one level deep." : ""))));
124
+ return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((a, i) => {
125
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(i.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== s ? ". Note that variables only represent file names one level deep." : ""))));
126
126
  });
127
- }, E = async (e) => (await oe(/* @__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, ae = async (e) => {
127
+ }, I = async (e) => (await re(/* @__PURE__ */ Object.assign({ "./field_descriptions_prompt.md": () => import("./field_descriptions_prompt.js"), "./intent_prompt.md": () => import("./intent_prompt.js"), "./layer_descriptions_prompt.md": () => import("./layer_descriptions_prompt.js") }), `./${e}.md`, 2)).default, ce = async (e) => {
128
128
  const { agent: t, messages: s, config: n } = e;
129
129
  return { structuredResponse: (await t.invoke(
130
130
  {
@@ -133,73 +133,78 @@ ${s}`;
133
133
  n
134
134
  )).structuredResponse };
135
135
  }, O = (e, t) => async (s, n) => {
136
- const i = new Headers(n?.headers);
137
- i.delete("Authorization"), i.delete("api-key"), e && e.length > 0 && (i.set("X-Esri-Authorization", `Bearer ${e}`), i.set("X-Esri-Request-Source", "MapsSDK"));
138
- const r = t && n?.signal ? AbortSignal.any([t, n.signal]) : n?.signal ?? t;
136
+ const a = new Headers(n?.headers);
137
+ a.delete("Authorization"), a.delete("api-key"), e && e.length > 0 && (a.set("X-Esri-Authorization", `Bearer ${e}`), a.set("X-Esri-Request-Source", "MapsSDK"));
138
+ const i = t && n?.signal ? AbortSignal.any([t, n.signal]) : n?.signal ?? t;
139
139
  return await fetch(s, {
140
140
  ...n,
141
- headers: i,
142
- signal: r
141
+ headers: a,
142
+ signal: i
143
143
  });
144
144
  }, b = async (e = {}) => {
145
- const { modelTier: t = "default", temperature: s = 0, abortSignal: n } = e, i = k.getDefault(), r = await _.getCredential(`${i.url}/sharing`), a = P[t], c = await te(t);
146
- return new Y({
147
- modelName: a,
145
+ const { modelTier: t = "default", temperature: s = 0, abortSignal: n } = e, a = k.getDefault(), i = await _.getCredential(`${a.url}/sharing`), r = P[t], c = await ne(t);
146
+ return new Z({
147
+ modelName: r,
148
148
  apiKey: "dummy-key",
149
149
  // 5-mini does not support temperature parameter
150
150
  ...t !== "default" && { temperature: s },
151
151
  configuration: {
152
152
  baseURL: c,
153
- fetch: O(r.token, n)
153
+ fetch: O(i.token, n)
154
154
  }
155
155
  });
156
- }, Ue = async (e = "default", t) => {
157
- const s = k.getDefault(), n = await _.getCredential(`${s.url}/sharing`), i = A[e], r = await ne(e);
158
- return new Z({
159
- modelName: i,
156
+ }, _e = async (e = "default", t) => {
157
+ const s = k.getDefault(), n = await _.getCredential(`${s.url}/sharing`), a = A[e], i = await se(e);
158
+ return new ee({
159
+ modelName: a,
160
160
  apiKey: "dummy-key",
161
161
  configuration: {
162
- baseURL: r,
162
+ baseURL: i,
163
163
  fetch: O(n.token, t)
164
164
  },
165
165
  batchSize: 2048,
166
166
  maxConcurrency: 10
167
167
  });
168
- }, ce = o.object({
168
+ }, le = o.object({
169
169
  id: o.string().min(1),
170
170
  name: o.string().min(1),
171
171
  description: o.string().min(1)
172
172
  });
173
- o.array(ce);
174
- const R = (e) => JSON.stringify(e, null, 2), le = (e) => {
173
+ o.array(le);
174
+ const R = (e) => JSON.stringify(e, null, 2), de = (e) => {
175
175
  const t = e.map((n) => n.id), s = o.enum(t);
176
176
  return o.object({
177
177
  intent: s.nullable(),
178
178
  assignedTask: o.string().nullable(),
179
179
  requiresFollowUp: o.boolean()
180
180
  });
181
- }, _e = async (e, t) => {
182
- const s = re(t);
181
+ }, Pe = async (e, t) => {
182
+ const s = oe(t);
183
183
  if (s.abortSignal?.aborted)
184
- return await g({ text: "Run cancelled; skipping intent routing" }, t), {
184
+ return await f({ text: "Run cancelled; skipping intent routing" }, t), {
185
185
  ...e,
186
186
  currentIntent: "none",
187
+ finalOutputMessage: "Operation cancelled.",
187
188
  requiresFollowUp: !1
188
189
  };
189
190
  try {
190
- await g({ text: "Asking LLM to route to an agent" }, t);
191
- const r = (s.services.agentRegistry?.list() ?? []).map(({ agent: y }) => ({
192
- id: y.id,
193
- name: y.name,
194
- description: y.description
191
+ await f({ text: "Asking LLM to route to an agent" }, t);
192
+ const a = s.services.agentRegistry?.list() ?? [], i = a.map(({ agent: g }) => ({
193
+ id: g.id,
194
+ name: g.name,
195
+ description: g.description
195
196
  }));
196
- if (!r.length)
197
- return await g({ text: "No agents registered; skipping intent detection" }, t), { ...e, currentIntent: "none" };
198
- const a = await E("intent_prompt"), c = R(r), l = le(r), m = {
197
+ if (!i.length)
198
+ return await f({ text: "No agents registered; skipping intent detection" }, t), {
199
+ ...e,
200
+ currentIntent: "none",
201
+ finalOutputMessage: "No agents registered; skipping intent detection."
202
+ };
203
+ const r = await I("intent_prompt"), c = R(i), l = de(i), m = {
199
204
  registeredAgents: c,
200
205
  priorSteps: R(e.agentExecutionContext.priorSteps),
201
206
  userRequest: e.agentExecutionContext.userRequest
202
- }, T = await F.fromTemplate(a).format(m), C = X({
207
+ }, T = await F.fromTemplate(r).format(m), C = G({
203
208
  model: await b({ modelTier: "fast", abortSignal: s.abortSignal }),
204
209
  tools: [],
205
210
  systemPrompt: T,
@@ -209,40 +214,43 @@ const R = (e) => JSON.stringify(e, null, 2), le = (e) => {
209
214
  // Preserve recent conversation context while summarizing older messages
210
215
  // to control token usage without losing important intent signals.
211
216
  // The trigger and keep parameters can be tuned based on token limits and behavior.
212
- G({
217
+ Q({
213
218
  model: await b({ modelTier: "fast", abortSignal: s.abortSignal }),
214
219
  trigger: { tokens: 4e3 },
215
220
  keep: { messages: 6 }
216
221
  }),
217
222
  // Enforce no loop/retry.
218
223
  // 1 usual LLM call and 1 optional summarization call.
219
- Q({ runLimit: 2 })
224
+ Y({ runLimit: 2 })
220
225
  ]
221
- }), { structuredResponse: L } = await ae({
226
+ }), { structuredResponse: L } = await ce({
222
227
  agent: C,
223
228
  messages: e.agentExecutionContext.messages,
224
229
  config: t
225
- }), h = l.parse(
230
+ }), y = l.parse(
226
231
  L ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
227
- ), x = h.intent ?? "none", K = {
232
+ ), x = y.intent ?? "none", K = {
228
233
  ...e,
229
234
  currentIntent: x,
230
- requiresFollowUp: h.requiresFollowUp,
235
+ requiresFollowUp: y.requiresFollowUp,
231
236
  agentExecutionContext: {
232
237
  ...e.agentExecutionContext,
233
- assignedTask: h.assignedTask ?? ""
238
+ assignedTask: y.assignedTask ?? ""
234
239
  }
235
240
  };
236
241
  if (x === "none") {
237
- const y = "I could not find a matching agent for that request. Please rephrase your question with more detail.";
238
- return await g({ text: "LLM did not identify a clear intent." }, t), {
242
+ const g = `I could not find an agent that can handle that request. I have access to the following agents: ${a.map(({ agent: B }) => B.name).join(", ")}.
243
+
244
+ Please ask a question that can be answered by one of these agents.`;
245
+ return await f({ text: "LLM did not identify a clear intent." }, t), {
239
246
  ...e,
240
247
  currentIntent: x,
241
248
  requiresFollowUp: !1,
249
+ finalOutputMessage: g,
242
250
  agentExecutionContext: {
243
251
  ...e.agentExecutionContext,
244
252
  assignedTask: "",
245
- messages: [...e.agentExecutionContext.messages, new W(y)],
253
+ messages: [...e.agentExecutionContext.messages, new H(g)],
246
254
  priorSteps: [
247
255
  ...e.agentExecutionContext.priorSteps ?? [],
248
256
  {
@@ -255,31 +263,31 @@ const R = (e) => JSON.stringify(e, null, 2), le = (e) => {
255
263
  }
256
264
  };
257
265
  }
258
- return await g(
266
+ return await f(
259
267
  {
260
268
  text: `Agent picked: ${x}
261
- Task Assigned: ${h.assignedTask ?? ""}
262
- Requires Follow-Up: ${h.requiresFollowUp}`
269
+ Task Assigned: ${y.assignedTask ?? ""}
270
+ Requires Follow-Up: ${y.requiresFollowUp}`
263
271
  },
264
272
  t
265
273
  ), K;
266
274
  } catch (n) {
267
- throw await g({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
275
+ throw await f({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
268
276
  }
269
- }, de = "0.1", w = 1536, pe = "openai", me = A.default, ue = `Name: {name}
277
+ }, pe = "0.1", w = 1536, me = "openai", ue = A.default, ge = `Name: {name}
270
278
  Title: {title}
271
- Description: {description}`, ge = `Name: {name}
279
+ Description: {description}`, fe = `Name: {name}
272
280
  Alias: {alias}
273
- Description: {description}`, Pe = o.object({
274
- schemaVersion: o.literal(de),
281
+ Description: {description}`, qe = o.object({
282
+ schemaVersion: o.literal(pe),
275
283
  modified: o.number().int().nonnegative(),
276
284
  embeddings: o.object({
277
- modelProvider: o.literal(pe),
278
- model: o.literal(me),
285
+ modelProvider: o.literal(me),
286
+ model: o.literal(ue),
279
287
  dimensions: o.literal(w),
280
288
  templates: o.object({
281
- layer: o.string().default(ue),
282
- field: o.string().default(ge)
289
+ layer: o.string().default(ge),
290
+ field: o.string().default(fe)
283
291
  })
284
292
  }),
285
293
  layers: o.array(
@@ -303,99 +311,99 @@ Description: {description}`, Pe = o.object({
303
311
  )
304
312
  })
305
313
  ).default([])
306
- }), fe = (e) => {
314
+ }), he = (e) => {
307
315
  const t = /* @__PURE__ */ new Set();
308
316
  for (const n of e)
309
- if (H(n)) {
310
- const i = n;
311
- i.tool_calls && i.tool_calls.length > 0 && i.tool_calls.forEach((r) => {
312
- r.id && t.add(r.id);
317
+ if (J(n)) {
318
+ const a = n;
319
+ a.tool_calls && a.tool_calls.length > 0 && a.tool_calls.forEach((i) => {
320
+ i.id && t.add(i.id);
313
321
  });
314
322
  }
315
323
  return e.filter((n) => {
316
- if (J(n)) {
317
- const i = n;
318
- return t.has(i.tool_call_id);
324
+ if (X(n)) {
325
+ const a = n;
326
+ return t.has(a.tool_call_id);
319
327
  }
320
328
  return !0;
321
329
  });
322
- }, I = (e, t) => {
323
- const s = B.fromTemplate(e);
330
+ }, E = (e, t) => {
331
+ const s = W.fromTemplate(e);
324
332
  return F.fromMessages([s, ...t]);
325
- }, he = async (e) => {
326
- const { promptText: t, modelTier: s, temperature: n, messages: i, abortSignal: r } = e, a = I(t, i ?? []), c = await b({ modelTier: s, temperature: n, abortSignal: r });
327
- return a.pipe(c);
328
- }, qe = async (e) => {
329
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: r, abortSignal: a } = e, l = await (await he({
333
+ }, ye = async (e) => {
334
+ const { promptText: t, modelTier: s, temperature: n, messages: a, abortSignal: i } = e, r = E(t, a ?? []), c = await b({ modelTier: s, temperature: n, abortSignal: i });
335
+ return r.pipe(c);
336
+ }, je = async (e) => {
337
+ const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: a, inputVariables: i, abortSignal: r } = e, l = await (await ye({
330
338
  promptText: t,
331
339
  modelTier: s,
332
340
  temperature: n,
333
- messages: i,
334
- abortSignal: a
335
- })).invoke(r ?? {});
341
+ messages: a,
342
+ abortSignal: r
343
+ })).invoke(i ?? {});
336
344
  if (typeof l == "string")
337
345
  return l;
338
346
  const m = l.content;
339
347
  return typeof m == "string" ? m : JSON.stringify(m);
340
348
  }, V = async (e) => {
341
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: r, schema: a, abortSignal: c } = e, l = I(t, i ?? []), u = (await b({ modelTier: s, temperature: n, abortSignal: c })).withStructuredOutput(a);
342
- return await l.pipe(u).invoke(r ?? {});
343
- }, je = async (e) => {
344
- const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: i, inputVariables: r, tools: a, abortSignal: c } = e, l = a.length > 0 ? fe(i ?? []) : i ?? [], m = I(t, l), u = await b({ modelTier: s, temperature: n, abortSignal: c });
345
- return await m.pipe(u.bindTools(a)).invoke(r ?? {});
346
- }, ye = p.object({
349
+ const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: a, inputVariables: i, schema: r, abortSignal: c } = e, l = E(t, a ?? []), u = (await b({ modelTier: s, temperature: n, abortSignal: c })).withStructuredOutput(r);
350
+ return await l.pipe(u).invoke(i ?? {});
351
+ }, $e = async (e) => {
352
+ const { promptText: t, modelTier: s = "default", temperature: n = 0, messages: a, inputVariables: i, tools: r, abortSignal: c } = e, l = r.length > 0 ? he(a ?? []) : a ?? [], m = E(t, l), u = await b({ modelTier: s, temperature: n, abortSignal: c });
353
+ return await m.pipe(u.bindTools(r)).invoke(i ?? {});
354
+ }, we = p.object({
347
355
  name: p.string(),
348
356
  description: p.string(),
349
357
  valueType: p.string(),
350
358
  alias: p.string()
351
- }), we = p.object({
352
- fields: p.array(ye)
353
- }), z = (e, t) => e.getFieldAlias(t) ?? void 0, M = (e, t) => z(e, t.name) ?? t.alias ?? "", be = (e, t) => {
359
+ }), be = p.object({
360
+ fields: p.array(we)
361
+ }), z = (e, t) => e.getFieldAlias(t) ?? void 0, S = (e, t) => z(e, t.name) ?? t.alias ?? "", xe = (e, t) => {
354
362
  const s = z(e, t.name);
355
363
  return !!(s && s !== (t.alias ?? ""));
356
364
  };
357
365
  function D(e, t) {
358
366
  const s = /* @__PURE__ */ new Map();
359
367
  for (const n of e.fields) {
360
- const i = t.fields.find((l) => l.name === n.name), r = M(e, n), a = be(e, n), c = {
368
+ const a = t.fields.find((l) => l.name === n.name), i = S(e, n), r = xe(e, n), c = {
361
369
  name: n.name,
362
370
  type: n.type,
363
- alias: a ? r : i?.alias ?? r,
364
- description: i?.description ?? n.description ?? "",
365
- valueType: i?.valueType ?? n.valueType ?? "",
371
+ alias: r ? i : a?.alias ?? i,
372
+ description: a?.description ?? n.description ?? "",
373
+ valueType: a?.valueType ?? n.valueType ?? "",
366
374
  domain: e.getFieldDomain(n.name) ?? void 0
367
375
  };
368
376
  s.set(n.name, c);
369
377
  }
370
378
  return s;
371
379
  }
372
- const $e = async (e) => {
373
- const s = await E("field_descriptions_prompt"), n = e.fields.filter((a) => !(M(e, a) && a.description)).map((a) => {
374
- const { name: c, type: l, description: m } = a, u = M(e, a);
380
+ const Ne = async (e) => {
381
+ const s = await I("field_descriptions_prompt"), n = e.fields.filter((r) => !(S(e, r) && r.description)).map((r) => {
382
+ const { name: c, type: l, description: m } = r, u = S(e, r);
375
383
  return [`Name: ${c}`, `Type: ${l}`, `Alias: ${u}`, `Description: ${m ?? "N/A"}`].join(", ");
376
384
  }).join(`
377
385
  `);
378
386
  if (n.length === 0)
379
387
  return D(e, { fields: [] });
380
- const i = {
388
+ const a = {
381
389
  existingItemTitle: e.portalItem?.title,
382
390
  existingItemDescription: e.portalItem?.description,
383
391
  existingLayerTitle: e.title,
384
392
  existingLayerDescription: e.portalItem?.description,
385
393
  fieldInformation: n
386
- }, r = await V({
394
+ }, i = await V({
387
395
  promptText: s,
388
- schema: we,
389
- inputVariables: i
396
+ schema: be,
397
+ inputVariables: a
390
398
  });
391
- return D(e, r);
392
- }, xe = p.object({
399
+ return D(e, i);
400
+ }, ve = p.object({
393
401
  title: p.string(),
394
402
  description: p.string(),
395
403
  name: p.string().nullable()
396
- }), Ne = async (e, t) => {
397
- const n = await E("layer_descriptions_prompt"), i = Array.from(t.values()), r = {
398
- fieldInformation: JSON.stringify(i, null, 2),
404
+ }), Oe = async (e, t) => {
405
+ const n = await I("layer_descriptions_prompt"), a = Array.from(t.values()), i = {
406
+ fieldInformation: JSON.stringify(a, null, 2),
399
407
  existingLayerTitle: e.title,
400
408
  existingLayerDescription: e.portalItem?.description,
401
409
  existingLayerSnippet: e.portalItem?.snippet,
@@ -403,31 +411,31 @@ const $e = async (e) => {
403
411
  };
404
412
  return { ...await V({
405
413
  promptText: n,
406
- schema: xe,
407
- inputVariables: r
414
+ schema: ve,
415
+ inputVariables: i
408
416
  }), name: e.title ?? null };
409
417
  };
410
418
  export {
411
- De as D,
412
- Pe as W,
413
- Ne as a,
414
- pe as b,
419
+ Fe as D,
420
+ qe as W,
421
+ Oe as a,
422
+ me as b,
415
423
  b as c,
416
424
  w as d,
417
- de as e,
418
- ge as f,
419
- $e as g,
420
- qe as h,
425
+ pe as e,
426
+ fe as f,
427
+ Ne as g,
428
+ je as h,
421
429
  V as i,
422
- je as j,
423
- se as k,
424
- ue as l,
425
- me as m,
426
- Re as n,
427
- Fe as o,
428
- ne as p,
429
- re as q,
430
- _e as r,
431
- g as s,
432
- Ue as t
430
+ $e as j,
431
+ ae as k,
432
+ ge as l,
433
+ ue as m,
434
+ De as n,
435
+ Ue as o,
436
+ se as p,
437
+ oe as q,
438
+ Pe as r,
439
+ f as s,
440
+ _e as t
433
441
  };
@@ -3,7 +3,12 @@ import type Collection from "@arcgis/core/core/Collection.js";
3
3
  import type { PublicLitElement as LitElement } from "@arcgis/lumina";
4
4
  import type { ChatMessage } from "../arcgis-assistant/types.js";
5
5
 
6
- /** @internal */
6
+ /**
7
+ * Wraps and renders the conversation area. Use it as the container for message list content.
8
+ * Offers chat-level layout structure for message starter, message list, and loading regions.
9
+ *
10
+ * @internal
11
+ */
7
12
  export abstract class ArcgisAssistantChat extends LitElement {
8
13
  /** @default false */
9
14
  accessor loading: boolean;
@@ -5,7 +5,8 @@ import type { ChatMessage } from "../arcgis-assistant/types.js";
5
5
  import type { T9nMeta } from "@arcgis/lumina/controllers";
6
6
 
7
7
  /**
8
- * An input bar primitive for collecting assistant prompts.
8
+ * Provides the input bar and submit or cancel behavior. Use it to collect prompts and emit submit events.
9
+ * Offers keyboard submit/history behavior, entry action slots, and optional voice-input integration.
9
10
  *
10
11
  * @slot [entry-actions-start] - Slot for adding actions to the start of the entry area.
11
12
  * @slot [entry-actions-end] - Slot for adding actions to the end of the entry area.
@@ -2,7 +2,10 @@
2
2
  import type { PublicLitElement as LitElement } from "@arcgis/lumina";
3
3
  import type { T9nMeta } from "@arcgis/lumina/controllers";
4
4
 
5
- /** @internal */
5
+ /**
6
+ * Renders interrupt prompts for extra user input. Use it when an agent pauses for confirmation, choice, or text input.
7
+ * Offers interrupt-specific input modes and submit or cancel event handling.
8
+ */
6
9
  export abstract class ArcgisAssistantInterrupt extends LitElement {
7
10
  /** @internal */
8
11
  protected _messages: {
@@ -0,0 +1,21 @@
1
+ /// <reference path="../../index.d.ts" />
2
+ import type { PublicLitElement as LitElement } from "@arcgis/lumina";
3
+ import type { AssistantMessage } from "../arcgis-assistant/types.js";
4
+
5
+ /**
6
+ * Renders a single assistant response message shell. Pass one assistant message object and let it host body and footer actions.
7
+ * Offers a reusable assistant-message layout with icon, content, and footer slot regions.
8
+ */
9
+ export abstract class ArcgisAssistantMessage extends LitElement {
10
+ /** @default false */
11
+ accessor copyEnabled: boolean;
12
+ /** @default false */
13
+ accessor feedbackEnabled: boolean;
14
+ /** @default false */
15
+ accessor footerDisabled: boolean;
16
+ /** @default false */
17
+ accessor logEnabled: boolean;
18
+ accessor message: AssistantMessage | undefined;
19
+ /** @default false */
20
+ accessor readAloudEnabled: boolean;
21
+ }
@@ -0,0 +1 @@
1
+ export * from "./customElement.js";
@@ -2,7 +2,7 @@
2
2
  import type { PublicLitElement as LitElement } from "@arcgis/lumina";
3
3
  import type { UXSuggestion } from "../../utils/index.js";
4
4
 
5
- /** A primitive for rendering a default assistant output block. */
5
+ /** Renders one structured assistant block. Offers default block rendering for supported suggestion-style blocks. */
6
6
  export abstract class ArcgisAssistantMessageBlock extends LitElement {
7
7
  accessor block: UXSuggestion | undefined;
8
8
  }
@@ -3,7 +3,10 @@ import type { PublicLitElement as LitElement } from "@arcgis/lumina";
3
3
  import type { AssistantMessage } from "../arcgis-assistant/types.js";
4
4
  import type { T9nMeta } from "@arcgis/lumina/controllers";
5
5
 
6
- /** @internal */
6
+ /**
7
+ * Handles thumbs up or down feedback UI. Use it to capture helpful or not helpful signals per response.
8
+ * Offers feedback toggle behavior and emits feedback updates for the associated assistant message.
9
+ */
7
10
  export abstract class ArcgisAssistantMessageFeedback extends LitElement {
8
11
  /** @internal */
9
12
  protected _messages: {
@@ -3,7 +3,10 @@ import type { PublicLitElement as LitElement } from "@arcgis/lumina";
3
3
  import type { AssistantMessage } from "../arcgis-assistant/types.js";
4
4
  import type { T9nMeta } from "@arcgis/lumina/controllers";
5
5
 
6
- /** @internal */
6
+ /**
7
+ * Renders the action row under an assistant message. Use it when you want feedback, log, copy, or read-aloud controls.
8
+ * Offers one footer surface that composes common assistant response actions.
9
+ */
7
10
  export abstract class ArcgisAssistantMessageFooter extends LitElement {
8
11
  /** @internal */
9
12
  protected _messages: {