@arcgis/portal-components 5.2.0-next.54 → 5.2.0-next.56

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.
@@ -1,31 +1,29 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { c as ut } from "../../chunks/runtime.js";
3
- import { LitElement as ct, createEvent as pt } from "@arcgis/lumina";
4
- import { css as dt, render as mt, html as M } from "lit";
5
- import { createRef as G, ref as A } from "lit/directives/ref.js";
6
- import { u as gt } from "../../chunks/useT9n.js";
7
- import { a as T, t as ht, b as ft } from "../../chunks/functionalities.js";
8
- import { NodeInterrupt as J, Annotation as h, StateGraph as C, START as N, END as f } from "@langchain/langgraph/web";
9
- import { sendTraceMessage as g, invokeStructuredPrompt as b, sendUXSuggestion as $, createAgentRuntimeStateWithSharedState as P, createChatModel as E } from "@arcgis/ai-components/utils/index.js";
10
- import r from "zod";
11
- import { a as yt, c as wt, q as bt } from "../../chunks/groups2.js";
12
- import vt from "@arcgis/core/identity/IdentityManager.js";
13
- import O from "@arcgis/core/request.js";
14
- import { ChatPromptTemplate as D } from "@langchain/core/prompts";
15
- import { createAgent as U } from "langchain";
16
- import { tool as W } from "@langchain/core/tools";
17
- import { s as It, a as xt } from "../../chunks/item.js";
18
- import { Annotation as St } from "@langchain/langgraph";
19
- import { c as Mt, d as Gt, i as At, b as Tt, g as Ct } from "../../chunks/groups.js";
20
- const Y = (s) => {
21
- const { portal: t, user: e } = s ?? {};
22
- return !!s && !!t && !!e;
2
+ import { c as pt } from "../../chunks/runtime.js";
3
+ import { LitElement as dt, createEvent as mt } from "@arcgis/lumina";
4
+ import { css as gt, render as ht, html as M } from "lit";
5
+ import { createRef as T, ref as A } from "lit/directives/ref.js";
6
+ import { u as ft } from "../../chunks/useT9n.js";
7
+ import { a as C, t as yt, b as wt } from "../../chunks/functionalities.js";
8
+ import { NodeInterrupt as W, Annotation as y, StateGraph as N, START as P, END as w } from "@langchain/langgraph/web";
9
+ import { sendTraceMessage as g, invokeStructuredPrompt as v, sendUXSuggestion as E, createAgentRuntimeStateWithSharedState as k, createChatModel as D } from "@arcgis/ai-components/utils/index.js";
10
+ import n from "zod";
11
+ import { a as bt, c as vt, q as It } from "../../chunks/groups2.js";
12
+ import xt from "@arcgis/core/identity/IdentityManager.js";
13
+ import F from "@arcgis/core/request.js";
14
+ import { ChatPromptTemplate as U } from "@langchain/core/prompts";
15
+ import { tool as Y } from "@langchain/core/tools";
16
+ import { s as St, a as Mt } from "../../chunks/item.js";
17
+ import { c as Gt, d as Tt, i as At, b as Ct, g as Nt } from "../../chunks/groups.js";
18
+ const H = (a) => {
19
+ const { portal: t, user: e } = a ?? {};
20
+ return !!a && !!t && !!e;
23
21
  };
24
- function v(s) {
25
- if (!Y(s))
22
+ function I(a) {
23
+ if (!H(a))
26
24
  throw new Error("Invalid context: PortalAssistantContext with portal and user is required.");
27
25
  }
28
- const Nt = `
26
+ const Pt = `
29
27
  Write a concise, friendly success message for adding members to a group.
30
28
 
31
29
  Rules:
@@ -40,83 +38,83 @@ Added members:
40
38
 
41
39
  Not added members:
42
40
  {notAddedMembers}
43
- `, Pt = (s) => s.map((t) => `"${t}"`).join(", "), kt = r.object({
44
- successMessage: r.string().default("")
45
- }), V = "portal-group-creation", j = "approveAddMembers", qt = async (s, t) => {
46
- if (s.intentParams.intent !== "addMembers")
41
+ `, kt = (a) => a.map((t) => `"${t}"`).join(", "), qt = n.object({
42
+ successMessage: n.string().default("")
43
+ }), V = "portal-group-creation", j = "approveAddMembers", zt = async (a, t) => {
44
+ if (a.intentParams.intent !== "addMembers")
47
45
  return {
48
46
  status: "success",
49
47
  outputMessage: "Use @mention usernames for the members you want to add."
50
48
  };
51
- const e = s.agentExecutionContext.sharedState.createdGroupId?.value;
49
+ const e = a.agentExecutionContext.sharedState.createdGroupId?.value;
52
50
  if (!e)
53
51
  return {
54
52
  status: "success",
55
53
  outputMessage: "Create a group first, then add members using @mention usernames."
56
54
  };
57
- const a = s.intentParams.memberInfo.memberIdentifiers.map((d) => d.trim()).filter(Boolean);
58
- if (!a.length)
55
+ const s = a.intentParams.memberInfo.memberIdentifiers.map((d) => d.trim()).filter(Boolean);
56
+ if (!s.length)
59
57
  return {
60
58
  status: "success",
61
59
  outputMessage: "Use @mention usernames for the members you want to add."
62
60
  };
63
- const i = `The following member(s) will be added to the newly created group:
61
+ const l = `The following member(s) will be added to the newly created group:
64
62
 
65
- ${a.map((d) => `- **@${d}**`).join(`
63
+ ${s.map((d) => `- **@${d}**`).join(`
66
64
  `)}
67
65
 
68
- Do you want to continue?`, { hitlResponse: u } = t?.configurable ?? {};
69
- if (u?.agentId !== V || u.id !== j) {
66
+ Do you want to continue?`, { hitlResponse: c } = t?.configurable ?? {};
67
+ if (c?.agentId !== V || c.id !== j) {
70
68
  const d = {
71
69
  agentId: V,
72
70
  id: j,
73
71
  kind: "booleanChoice",
74
- message: i,
72
+ message: l,
75
73
  metadata: {
76
74
  action: "addMembers",
77
75
  groupId: e,
78
- members: [...a]
76
+ members: [...s]
79
77
  }
80
78
  };
81
- throw new J(d);
79
+ throw new W(d);
82
80
  }
83
- if (u.payload !== !0)
81
+ if (c.payload !== !0)
84
82
  return {
85
83
  status: "success",
86
84
  outputMessage: "Okay, I cancelled adding members to the group."
87
85
  };
88
86
  await g(
89
- { text: `Adding members ${Pt(a)}...`, agentName: "group-creation" },
87
+ { text: `Adding members ${kt(s)}...`, agentName: "group-creation" },
90
88
  t
91
89
  );
92
- const l = t?.configurable?.context;
93
- v(l);
94
- const { result: c, error: n } = await yt(l.portal, e, a);
95
- if (n || !c)
90
+ const i = t?.configurable?.context;
91
+ I(i);
92
+ const { result: u, error: r } = await bt(i.portal, e, s);
93
+ if (r || !u)
96
94
  return {
97
95
  status: "success",
98
96
  outputMessage: "I could not add members to that group. Please confirm group access and user accounts, then try again."
99
97
  };
100
- const { addedUsernames: p, notAddedUsers: m } = c;
98
+ const { addedUsernames: p, notAddedUsers: m } = u;
101
99
  try {
102
- const y = (await b({
103
- promptText: Nt,
104
- schema: kt,
100
+ const h = (await v({
101
+ promptText: Pt,
102
+ schema: qt,
105
103
  modelTier: "fast",
106
104
  inputVariables: {
107
105
  addedMembers: p.join(", "),
108
106
  notAddedMembers: JSON.stringify(
109
- m.map((x) => ({ username: x.username, reason: x.error.message }))
107
+ m.map((f) => ({ username: f.username, reason: f.error.message }))
110
108
  )
111
109
  }
112
110
  })).successMessage;
113
- if (y)
114
- return { status: "success", outputMessage: y };
111
+ if (h)
112
+ return { status: "success", outputMessage: h };
115
113
  } catch (d) {
116
114
  console.error("Error generating add-members success message:", d);
117
115
  }
118
116
  return {};
119
- }, zt = `
117
+ }, $t = `
120
118
  Write a concise, friendly success message after creating a portal group.
121
119
 
122
120
  Rules:
@@ -127,7 +125,7 @@ Rules:
127
125
 
128
126
  Group title:
129
127
  {groupTitle}
130
- `, $t = `
128
+ `, Et = `
131
129
  Write a concise, friendly failure message after an attempt to create a portal group.
132
130
 
133
131
  Rules:
@@ -142,36 +140,36 @@ Group title:
142
140
 
143
141
  Failure reason:
144
142
  {failureReason}
145
- `, L = "portal-group-creation", B = "approveCreateGroup", Et = r.object({
146
- successMessage: r.string().default("")
147
- }), Dt = r.object({
148
- failureMessage: r.string().default("")
149
- }), Ut = async (s, t) => {
150
- if (s.intentParams.intent !== "create")
143
+ `, _ = "portal-group-creation", L = "approveCreateGroup", Dt = n.object({
144
+ successMessage: n.string().default("")
145
+ }), Ut = n.object({
146
+ failureMessage: n.string().default("")
147
+ }), Rt = async (a, t) => {
148
+ if (a.intentParams.intent !== "create")
151
149
  return {
152
150
  status: "success",
153
151
  outputMessage: "Tell me the group title you want to use."
154
152
  };
155
- const e = s.intentParams.title.trim();
153
+ const e = a.intentParams.title.trim();
156
154
  if (!e)
157
155
  return {
158
156
  status: "success",
159
157
  outputMessage: "What title would you like for the new group?"
160
158
  };
161
- const a = `A group with the title **${e}** will be created. Do you want to continue?`, { hitlResponse: o } = t?.configurable;
162
- if (o?.agentId !== L || o.id !== B) {
163
- const n = {
164
- agentId: L,
165
- id: B,
159
+ const s = `A group with the title **${e}** will be created. Do you want to continue?`, { hitlResponse: o } = t?.configurable;
160
+ if (o?.agentId !== _ || o.id !== L) {
161
+ const r = {
162
+ agentId: _,
163
+ id: L,
166
164
  kind: "booleanChoice",
167
- message: a,
165
+ message: s,
168
166
  metadata: {
169
167
  action: "createGroup",
170
168
  title: e,
171
169
  access: "private"
172
170
  }
173
171
  };
174
- throw new J(n);
172
+ throw new W(r);
175
173
  }
176
174
  if (o.payload !== !0)
177
175
  return {
@@ -179,22 +177,22 @@ Failure reason:
179
177
  outputMessage: `Okay, I cancelled creating **${e}**.`
180
178
  };
181
179
  await g({ text: `Creating group "${e}"...`, agentName: "group-creation" }, t);
182
- const i = t?.configurable?.context;
183
- v(i);
184
- const { result: u, error: l } = await wt(i.portal, {
180
+ const l = t?.configurable?.context;
181
+ I(l);
182
+ const { result: c, error: i } = await vt(l.portal, {
185
183
  title: e,
186
184
  access: "private"
187
185
  });
188
- if (l || !u) {
189
- const n = l?.message?.trim() || "No additional details were provided.";
186
+ if (i || !c) {
187
+ const r = i?.message?.trim() || "No additional details were provided.";
190
188
  try {
191
- const m = (await b({
192
- promptText: $t,
193
- schema: Dt,
189
+ const m = (await v({
190
+ promptText: Et,
191
+ schema: Ut,
194
192
  modelTier: "fast",
195
193
  inputVariables: {
196
194
  groupTitle: e,
197
- failureReason: n
195
+ failureReason: r
198
196
  }
199
197
  })).failureMessage.trim();
200
198
  if (m)
@@ -210,11 +208,11 @@ Failure reason:
210
208
  outputMessage: "I could not create that group. Please confirm your permissions and try again with the group title."
211
209
  };
212
210
  }
213
- const c = u.id;
211
+ const u = c.id;
214
212
  try {
215
- const p = (await b({
216
- promptText: zt,
217
- schema: Et,
213
+ const p = (await v({
214
+ promptText: $t,
215
+ schema: Dt,
218
216
  modelTier: "fast",
219
217
  inputVariables: {
220
218
  groupTitle: e
@@ -224,28 +222,28 @@ Failure reason:
224
222
  return {
225
223
  status: "success",
226
224
  outputMessage: p,
227
- sharedStatePatch: { createdGroupId: { value: c } },
228
- createdGroupId: c
225
+ sharedStatePatch: { createdGroupId: { value: u } },
226
+ createdGroupId: u
229
227
  };
230
- } catch (n) {
231
- console.error("Error generating create-group success message:", n);
228
+ } catch (r) {
229
+ console.error("Error generating create-group success message:", r);
232
230
  }
233
231
  return {};
234
- }, I = (s) => {
235
- for (let t = s.length - 1; t >= 0; t -= 1) {
236
- const e = s[t];
232
+ }, x = (a) => {
233
+ for (let t = a.length - 1; t >= 0; t -= 1) {
234
+ const e = a[t];
237
235
  if (e.type !== "human")
238
236
  continue;
239
- const a = e.content;
240
- if (typeof a == "string")
241
- return a;
242
- if (Array.isArray(a))
243
- return a.map(
237
+ const s = e.content;
238
+ if (typeof s == "string")
239
+ return s;
240
+ if (Array.isArray(s))
241
+ return s.map(
244
242
  (o) => typeof o == "string" ? o : "text" in o && typeof o.text == "string" ? o.text : ""
245
243
  ).join(" ").trim();
246
244
  }
247
245
  return "";
248
- }, Rt = `
246
+ }, Ot = `
249
247
  You classify whether a user is asking to create a new ArcGIS Portal group or add members to an existing group.
250
248
 
251
249
  Rules:
@@ -271,25 +269,25 @@ Examples:
271
269
 
272
270
  User message:
273
271
  {userMessage}
274
- `, Ft = r.object({
275
- intent: r.enum(["clarify", "create", "addMembers"]).default("clarify"),
276
- title: r.string().default(""),
277
- memberIdentifiers: r.array(r.string()).default([]),
278
- clarifyMessage: r.string().default("")
279
- }), Ot = async (s, t) => {
272
+ `, Ft = n.object({
273
+ intent: n.enum(["clarify", "create", "addMembers"]).default("clarify"),
274
+ title: n.string().default(""),
275
+ memberIdentifiers: n.array(n.string()).default([]),
276
+ clarifyMessage: n.string().default("")
277
+ }), Vt = async (a, t) => {
280
278
  await g({ text: "Thinking about groups...", agentName: "group-creation" }, t);
281
- const e = I(s.agentExecutionContext.messages).trim(), a = await b({
282
- promptText: Rt,
279
+ const e = x(a.agentExecutionContext.messages).trim(), s = await v({
280
+ promptText: Ot,
283
281
  schema: Ft,
284
282
  modelTier: "default",
285
283
  inputVariables: { userMessage: e }
286
- }), o = a.title.trim(), i = a.memberIdentifiers.filter(Boolean), u = a.clarifyMessage.trim(), l = a.intent === "create" && !!o, c = a.intent === "addMembers" && i.length > 0;
284
+ }), o = s.title.trim(), l = s.memberIdentifiers.filter(Boolean), c = s.clarifyMessage.trim(), i = s.intent === "create" && !!o, u = s.intent === "addMembers" && l.length > 0;
287
285
  return {
288
- intentParams: l ? { intent: "create", title: o } : c ? { intent: "addMembers", memberInfo: { memberIdentifiers: i } } : { intent: "clarify" },
286
+ intentParams: i ? { intent: "create", title: o } : u ? { intent: "addMembers", memberInfo: { memberIdentifiers: l } } : { intent: "clarify" },
289
287
  status: "success",
290
- outputMessage: !l && !c ? u : ""
288
+ outputMessage: !i && !u ? c : ""
291
289
  };
292
- }, Vt = r.enum([
290
+ }, jt = n.enum([
293
291
  "portal-content",
294
292
  "portal-content-favorites",
295
293
  "portal-content-group",
@@ -304,44 +302,44 @@ User message:
304
302
  "portal-notebooks",
305
303
  "portal-scene-viewer",
306
304
  "portal-settings-security"
307
- ]), jt = r.object({
308
- destinationType: Vt
309
- }), Lt = r.union([
310
- jt,
311
- r.object({
312
- destinationType: r.literal("portal-item"),
313
- itemId: r.string().trim().min(1)
305
+ ]), _t = n.object({
306
+ destinationType: jt
307
+ }), Lt = n.union([
308
+ _t,
309
+ n.object({
310
+ destinationType: n.literal("portal-item"),
311
+ itemId: n.string().trim().min(1)
314
312
  }),
315
- r.object({
316
- destinationType: r.literal("portal-group"),
317
- groupId: r.string().trim().min(1)
313
+ n.object({
314
+ destinationType: n.literal("portal-group"),
315
+ groupId: n.string().trim().min(1)
318
316
  })
319
- ]), _ = "portal-navigation", R = async (s, t) => {
317
+ ]), X = "portal-navigation", R = async (a, t) => {
320
318
  const e = t?.configurable?.context;
321
- !Y(e) || !e.navigationTargetMap?.[s.destinationType] || await $({ type: _, data: { ...s } }, t);
322
- }, Bt = async (s, t) => {
323
- const e = s.createdGroupId ?? s.agentExecutionContext.sharedState.createdGroupId?.value;
319
+ !H(e) || !e.navigationTargetMap?.[a.destinationType] || await E({ type: X, data: { ...a } }, t);
320
+ }, Bt = async (a, t) => {
321
+ const e = a.createdGroupId ?? a.agentExecutionContext.sharedState.createdGroupId?.value;
324
322
  return e ? (await g({ text: "Preparing navigation...", agentName: "group-creation" }, t), await R({ destinationType: "portal-group", groupId: e }, t), {}) : {};
325
- }, Q = (s, t) => t ?? s, H = h.Root({
326
- ...P(),
323
+ }, B = (a, t) => t ?? a, Z = y.Root({
324
+ ...k(),
327
325
  // * Shared state between nodes (but not persisted to the agent execution context)
328
326
  /** Parameters related to the user's intent for group creation actions */
329
- intentParams: h({ reducer: Q, default: () => ({ intent: "clarify" }) }),
327
+ intentParams: y({ reducer: B, default: () => ({ intent: "clarify" }) }),
330
328
  /** The ID of the group that was created
331
329
  * even though we already have this in the shared state
332
330
  * we still need it here to also share between nodes
333
331
  */
334
- createdGroupId: h({ reducer: Q, default: () => "" })
335
- }), Qt = () => new C(H).addNode("detectGroupCreationIntent", Ot).addNode("createPortalGroup", Ut).addNode("addMembersToPortalGroup", qt).addNode("suggestCreatedGroupNavigation", Bt).addEdge(N, "detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent", (t) => {
332
+ createdGroupId: y({ reducer: B, default: () => "" })
333
+ }), Qt = () => new N(Z).addNode("detectGroupCreationIntent", Vt).addNode("createPortalGroup", Rt).addNode("addMembersToPortalGroup", zt).addNode("suggestCreatedGroupNavigation", Bt).addEdge(P, "detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent", (t) => {
336
334
  switch (t.intentParams.intent) {
337
335
  case "create":
338
336
  return "createPortalGroup";
339
337
  case "addMembers":
340
338
  return "addMembersToPortalGroup";
341
339
  default:
342
- return f;
340
+ return w;
343
341
  }
344
- }).addEdge("createPortalGroup", "suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup", "suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation", f), Kt = String.raw`- **portal-group-creation** - Portal group creation assistant:
342
+ }).addEdge("createPortalGroup", "suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup", "suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation", w), Kt = String.raw`- **portal-group-creation** - Portal group creation assistant:
345
343
  - creates a new ArcGIS Portal group for the signed-in user
346
344
  - adds users to the newly created group using @mention usernames
347
345
  `, Jt = {
@@ -349,134 +347,157 @@ User message:
349
347
  name: "Portal Group Creation",
350
348
  description: Kt,
351
349
  createGraph: Qt,
352
- workspace: H
353
- }, X = "portalDocAssistantMemory", Wt = () => ({ conversationId: "" }), Yt = (s) => {
354
- const t = s?.[X]?.value;
350
+ workspace: Z
351
+ }, tt = "portalDocAssistantMemory", Wt = () => ({ conversationId: "" }), Yt = (a) => {
352
+ const t = a?.[tt]?.value;
355
353
  if (!t || typeof t != "object")
356
354
  return Wt();
357
355
  const e = t;
358
356
  return {
359
357
  conversationId: typeof e.conversationId == "string" ? e.conversationId : ""
360
358
  };
361
- }, _t = (s) => ({
362
- [X]: { value: s }
363
- });
364
- async function Ht({
365
- portal: s,
359
+ }, Ht = (a) => ({
360
+ [tt]: { value: a }
361
+ }), Xt = {
362
+ rag: {
363
+ top_k: 20,
364
+ certainty_threshold: 0.7,
365
+ radius_of_surrounding_chunks: 2,
366
+ top_k_surrounding_chunks: 120,
367
+ extract_key_terms: !0
368
+ },
369
+ pipeline: {
370
+ conversation_history: {
371
+ allow: !0,
372
+ number_of_interactions_to_include: 4
373
+ },
374
+ conversation_title: { allow: !1 },
375
+ follow_up: { allow: !1 },
376
+ retrieved_chunks_in_response: { allow: !1 }
377
+ }
378
+ };
379
+ function Zt(a) {
380
+ return {
381
+ kind: "DocAIAssistantRequest",
382
+ filters: {
383
+ ...Xt,
384
+ persona: { persona: a }
385
+ }
386
+ };
387
+ }
388
+ async function te({
389
+ portal: a,
366
390
  question: t,
367
391
  persona: e,
368
- previousConversationId: a,
392
+ previousConversationId: s,
369
393
  signal: o,
370
- skillId: i
394
+ skillId: l
371
395
  }) {
372
- i ??= "doc_ai_assistant";
373
- const l = await Xt({
374
- portal: s,
375
- skillId: i,
396
+ l ??= "doc_ai_assistant";
397
+ const c = Zt(e), i = await ee({
398
+ portal: a,
399
+ skillId: l,
376
400
  message: t,
377
- options: { context: {
378
- kind: "DocAIAssistantRequest",
379
- filters: { persona: { persona: e } }
380
- }, previousConversationId: a, signal: o }
401
+ options: { context: c, previousConversationId: s, signal: o }
381
402
  });
382
403
  return {
383
- reply: Zt(l, i),
384
- conversationId: l[0]?.conversationId ?? ""
404
+ reply: ae(i, l),
405
+ conversationId: i[0]?.conversationId ?? ""
385
406
  };
386
407
  }
387
- async function Xt({
388
- portal: s,
408
+ async function ee({
409
+ portal: a,
389
410
  skillId: t,
390
411
  message: e,
391
- options: a
412
+ options: s
392
413
  }) {
393
- const i = `${s.helperServices.aiAssistantServices.url}/skills/${t}/chat`, u = {
414
+ const l = `${a.helperServices.aiAssistantServices.url}/skills/${t}/chat`, c = {
394
415
  "Content-Type": "application/json",
395
- token: vt.findCredential(s.url)?.token ?? ""
396
- }, l = await O(i, {
416
+ token: xt.findCredential(a.url)?.token ?? ""
417
+ }, i = await F(l, {
397
418
  method: "post",
398
419
  body: JSON.stringify({
399
420
  message: e,
400
- context: a.context,
401
- conversationId: a.previousConversationId
421
+ context: s.context,
422
+ conversationId: s.previousConversationId
402
423
  }),
403
- headers: u,
404
- signal: a.signal
424
+ headers: c,
425
+ signal: s.signal
405
426
  });
406
- if (l.httpStatus !== 200)
407
- throw new Error(`Doc assistant chat failed (${l.httpStatus})`, {
408
- cause: l.data
427
+ if (i.httpStatus !== 200)
428
+ throw new Error(`Doc assistant chat failed (${i.httpStatus})`, {
429
+ cause: i.data
409
430
  });
410
- const c = l.data, n = [c], { conversationId: p, inquiryId: m } = c, d = async (y, x) => {
411
- if (!x)
431
+ const u = i.data, r = [u], { conversationId: p, inquiryId: m } = u, d = async (h, f) => {
432
+ if (!f)
412
433
  return;
413
- await ht(1e3);
414
- const w = await O(i, {
434
+ await yt(500);
435
+ const b = await F(l, {
415
436
  method: "post",
416
- body: JSON.stringify({ conversationId: p, inquiryId: m, ackSequenceNumber: y }),
417
- headers: u,
418
- signal: a.signal
437
+ body: JSON.stringify({ conversationId: p, inquiryId: m, ackSequenceNumber: h }),
438
+ headers: c,
439
+ signal: s.signal
419
440
  });
420
- if (w.httpStatus !== 200)
421
- throw new Error(`Doc assistant poll failed (${w.httpStatus})`, {
422
- cause: w.data
441
+ if (b.httpStatus !== 200)
442
+ throw new Error(`Doc assistant poll failed (${b.httpStatus})`, {
443
+ cause: b.data
423
444
  });
424
- const S = w.data;
425
- n.push(S), await d(S.sequenceNumber, S.hasMore);
445
+ const S = b.data;
446
+ r.push(S), await d(S.sequenceNumber, S.hasMore);
426
447
  };
427
- return c.hasMore && await d(c.sequenceNumber, c.hasMore), n;
448
+ return u.hasMore && await d(u.sequenceNumber, u.hasMore), r;
428
449
  }
429
- function Zt(s, t) {
450
+ function ae(a, t) {
430
451
  switch (t) {
431
452
  case "doc_chat":
432
- return s.find((e) => e.message != null)?.message ?? "";
453
+ return a.find((e) => e.message != null)?.message ?? "";
433
454
  case "doc_ai_assistant":
434
- for (let e = s.length - 1; e >= 0; e -= 1) {
435
- const a = s[e];
436
- if (a.context?.kind === "DocAIAssistantContext") {
437
- const o = a.context.results?.[0]?.reply;
455
+ for (let e = a.length - 1; e >= 0; e -= 1) {
456
+ const s = a[e];
457
+ if (s.context?.kind === "DocAIAssistantContext") {
458
+ const o = s.context.results?.[0]?.reply;
438
459
  if (o)
439
460
  return o;
440
461
  }
441
462
  }
442
463
  return "";
443
464
  default:
444
- return T(t);
465
+ return C(t);
445
466
  }
446
467
  }
447
- const te = async (s, t) => {
468
+ const se = async (a, t) => {
448
469
  await g({ text: "Asking documentation assistant...", agentName: "doc-assistant" }, t);
449
- const e = I(s.agentExecutionContext.messages).trim();
470
+ const e = x(a.agentExecutionContext.messages).trim();
450
471
  if (!e)
451
472
  return {
452
473
  status: "success",
453
474
  outputMessage: "Please share your question and I can help with ArcGIS and Portal documentation."
454
475
  };
455
- const a = t?.configurable?.context;
456
- v(a);
457
- const o = Yt(s.agentExecutionContext.sharedState), { reply: i, conversationId: u } = await Ht({
458
- portal: a.portal,
476
+ const s = t?.configurable?.context;
477
+ I(s);
478
+ const o = Yt(a.agentExecutionContext.sharedState), { reply: l, conversationId: c } = await te({
479
+ portal: s.portal,
459
480
  question: e,
460
481
  previousConversationId: o.conversationId || void 0,
461
482
  skillId: "doc_ai_assistant",
462
- persona: "developers"
483
+ persona: "doc-online"
463
484
  });
464
485
  return {
465
486
  status: "success",
466
- outputMessage: i.trim() || "I could not retrieve a response from the documentation assistant.",
467
- sharedStatePatch: _t({
468
- conversationId: u || o.conversationId
487
+ outputMessage: l.trim() || "I could not retrieve a response from the documentation assistant.",
488
+ sharedStatePatch: Ht({
489
+ conversationId: c || o.conversationId
469
490
  })
470
491
  };
471
- }, Z = W(
472
- async ({ groupTitle: s }, t) => {
473
- const e = s.trim();
492
+ }, et = Y(
493
+ async ({ groupTitle: a }, t) => {
494
+ const e = a.trim();
474
495
  if (!e)
475
496
  return null;
476
- const a = t?.configurable?.context;
477
- v(a);
497
+ const s = t?.configurable?.context;
498
+ I(s);
478
499
  try {
479
- return (await bt(a.portal, { query: `title:${e}`, num: 1 }))?.results[0]?.id || null;
500
+ return (await It(s.portal, { query: `title:${e}`, num: 1 }))?.results[0]?.id || null;
480
501
  } catch (o) {
481
502
  return console.error("Error searching for portal group by title:", o), null;
482
503
  }
@@ -484,28 +505,36 @@ const te = async (s, t) => {
484
505
  {
485
506
  name: "resolvePortalGroupIdByTitle",
486
507
  description: "Resolves an ArcGIS Portal group title to the best-match group id. Use this when a user references a group by title instead of an explicit group id.",
487
- schema: r.object({
488
- groupTitle: r.string().describe("The portal group title to resolve to a group id.")
508
+ schema: n.object({
509
+ groupTitle: n.string().describe("The portal group title to resolve to a group id.")
489
510
  })
490
511
  }
491
- ), tt = W(
492
- async ({ itemTitle: s }, t) => {
493
- const e = s.trim();
512
+ ), at = Y(
513
+ async ({ itemTitle: a }, t) => {
514
+ const e = a.trim();
494
515
  if (!e)
495
516
  return null;
496
- const a = t?.configurable?.context;
497
- v(a);
498
- const { result: o, error: i } = await It(a.portal, e, { num: 1 });
499
- return i && console.error("Error searching for portal item by title:", i), o?.results[0]?.id || null;
517
+ const s = t?.configurable?.context;
518
+ I(s);
519
+ const { result: o, error: l } = await St(s.portal, e, { num: 1 });
520
+ return l && console.error("Error searching for portal item by title:", l), o?.results[0]?.id || null;
500
521
  },
501
522
  {
502
523
  name: "resolvePortalItemIdByTitle",
503
524
  description: 'Resolves an ArcGIS Portal item title to the best-match item id. Use this when a user references an item by title (including hash mentions like #title or #"title with spaces") instead of an explicit item id.',
504
- schema: r.object({
505
- itemTitle: r.string().describe("The portal item title to resolve to an item id.")
525
+ schema: n.object({
526
+ itemTitle: n.string().describe("The portal item title to resolve to an item id.")
506
527
  })
507
528
  }
508
- ), et = {
529
+ );
530
+ function G(a, t = "#") {
531
+ const e = a.match(new RegExp(`\\${t}"([^"]+)"`, "u"));
532
+ if (e?.[1])
533
+ return e[1].trim();
534
+ const s = a.match(new RegExp(`\\${t}([^\\s"']+)`, "u"));
535
+ return s?.[1] ? s[1].trim() : null;
536
+ }
537
+ const st = {
509
538
  "portal-content": {
510
539
  description: "The main content page of the portal.",
511
540
  hints: ["My content", "Content"],
@@ -586,16 +615,16 @@ const te = async (s, t) => {
586
615
  hints: ["Organization settings", "Security", "Organization > Settings > Security"],
587
616
  scope: "entity"
588
617
  }
589
- }, ee = ft(et), se = Object.entries(et).map(
590
- ([s, { description: t, hints: e, scope: a }]) => ` - ${s}: ${t} (scope: ${a}; hints: ${e.join(", ")})`
618
+ }, oe = wt(st), re = Object.entries(st).map(
619
+ ([a, { description: t, hints: e, scope: s }]) => ` - ${a}: ${t} (scope: ${s}; hints: ${e.join(", ")})`
591
620
  ).join(`
592
- `), ae = `
621
+ `), ne = `
593
622
  You decide whether the assistant response should include a navigation action to ArcGIS Portal.
594
623
 
595
624
  Given the user question and assistant response:
596
625
  - Decide if a navigation action would help the user complete the task.
597
626
  - If yes, choose one destination type:
598
- ${se}
627
+ ${re}
599
628
 
600
629
  Rules:
601
630
  - Only suggest navigation when you are highly confident the destination will help complete the user's task.
@@ -618,38 +647,40 @@ User question:
618
647
 
619
648
  Assistant response:
620
649
  {response}
621
- `, K = r.object({
622
- shouldSuggestNavigation: r.boolean().default(!1),
623
- destinationType: r.enum(["none", ...ee]).default("none"),
624
- itemId: r.string().default(""),
625
- groupId: r.string().default(""),
626
- confidence: r.number().min(0).max(1).default(0)
627
- }), oe = async (s, t) => {
650
+ `, Q = n.object({
651
+ shouldSuggestNavigation: n.boolean().default(!1),
652
+ destinationType: n.enum(["none", ...oe]).default("none"),
653
+ itemId: n.string().default(""),
654
+ groupId: n.string().default(""),
655
+ confidence: n.number().min(0).max(1).default(0)
656
+ }), ie = async (a, t) => {
628
657
  await g({ text: "Extracting navigation intent...", agentName: "doc-assistant" }, t);
629
- const e = s.outputMessage.trim();
658
+ const e = a.outputMessage.trim();
630
659
  if (!e)
631
660
  return {};
632
- const a = I(s.agentExecutionContext.messages).trim(), o = await D.fromTemplate(ae).format({
633
- question: a,
661
+ const s = x(a.agentExecutionContext.messages).trim(), o = await U.fromTemplate(ne).format({
662
+ question: s,
634
663
  response: e
635
- }), u = await U({
636
- model: await E({ modelTier: "default" }),
637
- tools: [tt, Z],
638
- systemPrompt: o,
639
- responseFormat: K,
640
- checkpointer: !0
641
- }).invoke({ messages: s.agentExecutionContext.messages }, t), l = K.parse(u.structuredResponse ?? {});
642
- if (!l.shouldSuggestNavigation || l.destinationType === "none")
664
+ }), c = (await D({ modelTier: "fast" })).withStructuredOutput(Q), i = Q.parse(await c.invoke(o));
665
+ if (!i.shouldSuggestNavigation || i.destinationType === "none")
643
666
  return {};
644
- const c = re(l);
645
- return c ? (await R(c, t), {}) : {};
667
+ if (i.destinationType === "portal-item" && !i.itemId) {
668
+ const r = G(s, "#");
669
+ r && (i.itemId = await at.invoke({ itemTitle: r }, t) ?? "");
670
+ }
671
+ if (i.destinationType === "portal-group" && !i.groupId) {
672
+ const r = G(s, "$") ?? G(s, "#");
673
+ r && (i.groupId = await et.invoke({ groupTitle: r }, t) ?? "");
674
+ }
675
+ const u = le(i);
676
+ return u ? (await R(u, t), {}) : {};
646
677
  };
647
- function re({
648
- destinationType: s,
678
+ function le({
679
+ destinationType: a,
649
680
  itemId: t,
650
681
  groupId: e
651
682
  }) {
652
- switch (s) {
683
+ switch (a) {
653
684
  case "portal-content":
654
685
  case "portal-content-favorites":
655
686
  case "portal-content-group":
@@ -664,7 +695,7 @@ function re({
664
695
  case "portal-notebooks":
665
696
  case "portal-scene-viewer":
666
697
  case "portal-settings-security":
667
- return { destinationType: s };
698
+ return { destinationType: a };
668
699
  case "portal-item":
669
700
  return t ? { destinationType: "portal-item", itemId: t } : null;
670
701
  case "portal-group":
@@ -672,34 +703,34 @@ function re({
672
703
  case "none":
673
704
  return null;
674
705
  default:
675
- return T(s);
706
+ return C(a);
676
707
  }
677
708
  }
678
- const st = St.Root({
679
- ...P()
680
- }), ne = () => new C(st).addNode("answerDocQuestion", te).addNode("extractNavigationIntent", oe).addEdge(N, "answerDocQuestion").addEdge("answerDocQuestion", "extractNavigationIntent").addEdge("extractNavigationIntent", f), ie = String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
709
+ const ot = y.Root({
710
+ ...k()
711
+ }), ue = () => new N(ot).addNode("answerDocQuestion", se).addNode("extractNavigationIntent", ie).addEdge(P, "answerDocQuestion").addEdge("answerDocQuestion", "extractNavigationIntent").addEdge("extractNavigationIntent", w), ce = String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
681
712
  - answers general ArcGIS, Portal, Enterprise, and JavaScript SDK questions
682
713
  - acts as a fallback when specialized agents are not applicable
683
- `, le = {
714
+ `, pe = {
684
715
  id: "portal-doc-assistant",
685
716
  name: "Portal Doc Assistant",
686
- description: ie,
687
- createGraph: ne,
688
- workspace: st
689
- }, ue = () => ({ latestGroupId: null, memory: {} }), k = (s) => {
690
- const t = s?.agentExecutionContext.sharedState.portalGroupSummaryMemory?.value;
691
- return t ? { latestGroupId: t.latestGroupId, memory: t.memory } : ue();
692
- }, at = `
717
+ description: ce,
718
+ createGraph: ue,
719
+ workspace: ot
720
+ }, de = () => ({ latestGroupId: null, memory: {} }), q = (a) => {
721
+ const t = a?.agentExecutionContext.sharedState.portalGroupSummaryMemory?.value;
722
+ return t ? { latestGroupId: t.latestGroupId, memory: t.memory } : de();
723
+ }, rt = `
693
724
  Shared markdown formatting rules:
694
725
  - Use clear markdown headings (##) to separate sections.
695
726
  - Use concise bullet points for lists of facts, counts, or signals.
696
727
  - Emphasize key metrics with bold labels (for example: **Recent items:** 4).
697
728
  - Keep wording direct and analytical; avoid filler language but make sure the language is friendly.
698
729
  - Do not include raw internal IDs unless explicitly requested.
699
- `, ce = `
730
+ `, me = `
700
731
  You answer follow-up questions about ArcGIS group analytics.
701
732
 
702
- ${at}
733
+ ${rt}
703
734
 
704
735
  Ground your answer in the provided group analytics summary and context.
705
736
  If the answer is not available from the provided context, state that clearly and suggest what to check next.
@@ -721,18 +752,18 @@ Group full context:
721
752
 
722
753
  Question:
723
754
  {question}
724
- `, pe = async (s, t) => {
755
+ `, ge = async (a, t) => {
725
756
  await g({ text: "Answering group follow-up...", agentName: "group-analytics" }, t);
726
- const e = k(s), a = s.groupSummaryGroupId ?? e.latestGroupId, o = a ? e.memory[a] : void 0, i = s.groupSummaryQuestion || I(s.agentExecutionContext.messages);
757
+ const e = q(a), s = a.groupSummaryGroupId ?? e.latestGroupId, o = s ? e.memory[s] : void 0, l = a.groupSummaryQuestion || x(a.agentExecutionContext.messages);
727
758
  return o ? {
728
759
  status: "success",
729
- outputMessage: (await b({
730
- promptText: ce,
731
- schema: de,
760
+ outputMessage: (await v({
761
+ promptText: me,
762
+ schema: he,
732
763
  modelTier: "default",
733
764
  inputVariables: {
734
765
  summary: o.summary,
735
- question: i,
766
+ question: l,
736
767
  fullContext: JSON.stringify(o.fullContext)
737
768
  }
738
769
  })).answer
@@ -740,10 +771,10 @@ Question:
740
771
  status: "success",
741
772
  outputMessage: "I do not have group analytics context yet. Ask me to analyze a group first with analyze group <group id>."
742
773
  };
743
- }, de = r.object({
744
- answer: r.string(),
745
- isRelevant: r.boolean()
746
- }), me = `
774
+ }, he = n.object({
775
+ answer: n.string(),
776
+ isRelevant: n.boolean()
777
+ }), fe = `
747
778
  Classify the user's request for ArcGIS Portal group analytics.
748
779
 
749
780
  Rules:
@@ -772,58 +803,58 @@ hasAnalyticsContext:
772
803
 
773
804
  User message:
774
805
  {userMessage}
775
- `, ge = async (s, t) => {
806
+ `, ye = async (a, t) => {
776
807
  await g({ text: "Analyzing group-analytics intent...", agentName: "group-analytics" }, t);
777
- const e = I(s.agentExecutionContext.messages), a = !!k(s).latestGroupId, o = await D.fromTemplate(me).format({
808
+ const e = x(a.agentExecutionContext.messages), s = !!q(a).latestGroupId, o = await U.fromTemplate(fe).format({
778
809
  userMessage: e,
779
- hasAnalyticsContext: String(a)
780
- }), u = await U({
781
- model: await E({ modelTier: "fast" }),
782
- tools: [Z],
783
- systemPrompt: o,
784
- responseFormat: he,
785
- checkpointer: !0
786
- }).invoke({ messages: s.agentExecutionContext.messages }, t), { intent: l, groupId: c, question: n } = u.structuredResponse, p = l === "summarize" && !c, m = l === "followUp" && !(n ?? "").trim(), d = l === "clarify" || p || m;
810
+ hasAnalyticsContext: String(s)
811
+ }), c = (await D({ modelTier: "fast" })).withStructuredOutput(K), i = K.parse(await c.invoke(o));
812
+ let u = i.groupId;
813
+ if ((i.intent === "summarize" || i.intent === "navigation") && !u) {
814
+ const f = G(e, "$");
815
+ f && (u = await et.invoke({ groupTitle: f }, t) ?? "");
816
+ }
817
+ const { intent: r, question: p } = i, m = r === "summarize" && !u, d = r === "followUp" && !(p ?? "").trim(), h = r === "clarify" || m || d;
787
818
  return {
788
- groupSummaryIntent: d ? "clarify" : l,
789
- groupSummaryGroupId: c || null,
790
- groupSummaryQuestion: n || "",
819
+ groupSummaryIntent: h ? "clarify" : r,
820
+ groupSummaryGroupId: u || null,
821
+ groupSummaryQuestion: p || "",
791
822
  status: "success",
792
- outputMessage: d ? "Please clarify with a group id or title" : ""
823
+ outputMessage: h ? "Please clarify with a group id or title" : ""
793
824
  };
794
- }, he = r.object({
795
- intent: r.enum(["summarize", "followUp", "navigation", "clarify"]),
796
- groupId: r.string().default(""),
797
- question: r.string().default("")
798
- }), fe = async (s, t) => {
799
- const e = k(s), a = s.groupSummaryGroupId ?? e.latestGroupId;
825
+ }, K = n.object({
826
+ intent: n.enum(["summarize", "followUp", "navigation", "clarify"]),
827
+ groupId: n.string().default(""),
828
+ question: n.string().default("")
829
+ }), we = async (a, t) => {
830
+ const e = q(a), s = a.groupSummaryGroupId ?? e.latestGroupId;
800
831
  return await g({ text: "Preparing navigation...", agentName: "group-analytics" }, t), await R(
801
- a ? { destinationType: "portal-group", groupId: a } : { destinationType: "portal-groups" },
832
+ s ? { destinationType: "portal-group", groupId: s } : { destinationType: "portal-groups" },
802
833
  t
803
834
  ), { status: "success" };
804
835
  };
805
- function ot({ timestamp: s, now: t, windowMs: e }) {
806
- return s ? t - s <= e : !1;
836
+ function nt({ timestamp: a, now: t, windowMs: e }) {
837
+ return a ? t - a <= e : !1;
807
838
  }
808
- const ye = 720 * 60 * 60 * 1e3;
809
- function we(s) {
810
- const t = Mt(s);
839
+ const be = 720 * 60 * 60 * 1e3;
840
+ function ve(a) {
841
+ const t = Gt(a);
811
842
  return {
812
- id: s.id ?? "",
813
- title: s.title ?? "",
814
- description: s.description ?? "",
815
- snippet: s.snippet ?? "",
816
- access: s.access ?? null,
817
- owner: s.owner ?? "",
818
- tags: s.tags ?? [],
819
- created: s.created?.getTime(),
820
- modified: s.modified?.getTime(),
821
- isInvitationOnly: s.isInvitationOnly,
843
+ id: a.id ?? "",
844
+ title: a.title ?? "",
845
+ description: a.description ?? "",
846
+ snippet: a.snippet ?? "",
847
+ access: a.access ?? null,
848
+ owner: a.owner ?? "",
849
+ tags: a.tags ?? [],
850
+ created: a.created?.getTime(),
851
+ modified: a.modified?.getTime(),
852
+ isInvitationOnly: a.isInvitationOnly,
822
853
  sourceSignals: {
823
- capabilities: Ct(s),
824
- membershipAccess: Tt(s),
825
- isOpenData: At(s),
826
- isDistributedCollaborationGroup: Gt(s),
854
+ capabilities: Nt(a),
855
+ membershipAccess: Ct(a),
856
+ isOpenData: At(a),
857
+ isDistributedCollaborationGroup: Tt(a),
827
858
  orgId: t.orgId,
828
859
  hiddenMembers: t.hiddenMembers,
829
860
  isViewOnly: t.isViewOnly,
@@ -832,16 +863,16 @@ function we(s) {
832
863
  }
833
864
  };
834
865
  }
835
- async function be(s) {
836
- const t = { owner: s.owner ?? "", admins: [], users: [] };
866
+ async function Ie(a) {
867
+ const t = { owner: a.owner ?? "", admins: [], users: [] };
837
868
  try {
838
- return await s.fetchMembers();
869
+ return await a.fetchMembers();
839
870
  } catch (e) {
840
871
  return console.warn("Unable to fetch group members for analytics context", e), t;
841
872
  }
842
873
  }
843
- function ve(s) {
844
- return s.map((t) => ({
874
+ function xe(a) {
875
+ return a.map((t) => ({
845
876
  id: t.id ?? "",
846
877
  title: t.title ?? "Untitled",
847
878
  type: t.type ?? "Unknown",
@@ -850,43 +881,43 @@ function ve(s) {
850
881
  modified: t.modified?.getTime()
851
882
  }));
852
883
  }
853
- function Ie(s, t) {
854
- return s.filter(
855
- (e) => e.modified ? ot({ timestamp: e.modified, now: t, windowMs: ye }) : !1
884
+ function Se(a, t) {
885
+ return a.filter(
886
+ (e) => e.modified ? nt({ timestamp: e.modified, now: t, windowMs: be }) : !1
856
887
  );
857
888
  }
858
- function xe(s) {
889
+ function Me(a) {
859
890
  const t = /* @__PURE__ */ new Map();
860
- for (const e of s)
891
+ for (const e of a)
861
892
  t.set(e.type, (t.get(e.type) ?? 0) + 1);
862
- return [...t.entries()].sort((e, a) => a[1] - e[1] || e[0].localeCompare(a[0])).slice(0, 6).map(([e, a]) => ({ type: e, count: a }));
893
+ return [...t.entries()].sort((e, s) => s[1] - e[1] || e[0].localeCompare(s[0])).slice(0, 6).map(([e, s]) => ({ type: e, count: s }));
863
894
  }
864
- async function Se(s) {
865
- const t = await s.queryItems({ num: 20, sortField: "modified", sortOrder: "desc" }), e = ve(t.results), a = Date.now();
895
+ async function Ge(a) {
896
+ const t = await a.queryItems({ num: 20, sortField: "modified", sortOrder: "desc" }), e = xe(t.results), s = Date.now();
866
897
  return {
867
898
  total: t.total,
868
899
  topItems: e,
869
- recentlyModifiedItems: Ie(e, a),
870
- topItemTypes: xe(e)
900
+ recentlyModifiedItems: Se(e, s),
901
+ topItemTypes: Me(e)
871
902
  };
872
903
  }
873
- async function Me(s, t) {
904
+ async function Te(a, t) {
874
905
  if (!t)
875
906
  return { error: { code: "missingGroupId", message: "Group id is required." } };
876
907
  try {
877
- const a = (await s.queryGroups({ query: `id:${t}`, num: 1 })).results[0];
878
- if (!a)
908
+ const s = (await a.queryGroups({ query: `id:${t}`, num: 1 })).results[0];
909
+ if (!s)
879
910
  return { error: { code: "groupNotFound", message: `No group found for id: ${t}` } };
880
- const o = we(a), i = await be(a), u = await Se(a);
881
- return { result: { group: o, members: i, items: u } };
911
+ const o = ve(s), l = await Ie(s), c = await Ge(s);
912
+ return { result: { group: o, members: l, items: c } };
882
913
  } catch (e) {
883
914
  return console.error("Error fetching portal group analytics context:", e), { error: { code: "unhandledError" } };
884
915
  }
885
916
  }
886
- const Ge = `
917
+ const Ae = `
887
918
  You summarize ArcGIS Portal groups based on structured context and deterministic activity signals.
888
919
 
889
- ${at}
920
+ ${rt}
890
921
 
891
922
  Output format requirements:
892
923
  - Return concise markdown with clear sections in this order:
@@ -922,82 +953,82 @@ Group context:
922
953
 
923
954
  Deterministic signals:
924
955
  {deterministicSignals}
925
- `, Ae = 2160 * 60 * 60 * 1e3, Te = async (s, t) => {
926
- const e = s.groupSummaryGroupId;
956
+ `, Ce = 2160 * 60 * 60 * 1e3, Ne = async (a, t) => {
957
+ const e = a.groupSummaryGroupId;
927
958
  if (!e)
928
959
  return {
929
960
  status: "success",
930
961
  outputMessage: 'Please clarify with analyze group <group id>, analyze group $<title>, or analyze group $"<title with spaces>".'
931
962
  };
932
963
  await g({ text: `Analyzing group ${e}...`, agentName: "group-analytics" }, t);
933
- const a = t?.configurable?.context;
934
- v(a);
935
- const { result: o, error: i } = await Me(a.portal, e);
936
- if (i || !o)
964
+ const s = t?.configurable?.context;
965
+ I(s);
966
+ const { result: o, error: l } = await Te(s.portal, e);
967
+ if (l || !o)
937
968
  return await g({ text: "Failed to fetch group context", agentName: "group-analytics" }, t), {
938
969
  status: "success",
939
970
  outputMessage: "Unable to retrieve group context for analytics."
940
971
  };
941
- const { group: u, items: l } = o, c = Date.now(), n = u.modified, p = n ? ot({ timestamp: n, now: c, windowMs: Ae }) : !1, m = l.recentlyModifiedItems.length, d = m > 0, y = p || d, x = await b({
942
- promptText: Ge,
943
- schema: Ce,
972
+ const { group: c, items: i } = o, u = Date.now(), r = c.modified, p = r ? nt({ timestamp: r, now: u, windowMs: Ce }) : !1, m = i.recentlyModifiedItems.length, d = m > 0, h = p || d, f = await v({
973
+ promptText: Ae,
974
+ schema: Pe,
944
975
  modelTier: "default",
945
976
  inputVariables: {
946
977
  context: JSON.stringify(o),
947
978
  deterministicSignals: JSON.stringify({
948
- isGroupActive: y,
979
+ isGroupActive: h,
949
980
  isGroupRecentlyModified: p,
950
981
  hasRecentlyAddedOrUpdatedContent: d,
951
982
  recentItemCount: m
952
983
  })
953
984
  }
954
- }), { followUpQuestions: w, summary: S } = x, it = k(s), lt = {
985
+ }), { followUpQuestions: b, summary: S } = f, ut = q(a), ct = {
955
986
  latestGroupId: e,
956
987
  memory: {
957
- ...it.memory,
958
- [e]: { summary: S, followUpQuestions: w, fullContext: o }
988
+ ...ut.memory,
989
+ [e]: { summary: S, followUpQuestions: b, fullContext: o }
959
990
  }
960
991
  };
961
- return w.length && await $({ type: "suggested-prompts", data: { prompts: w } }, t), {
992
+ return b.length && await E({ type: "suggested-prompts", data: { prompts: b } }, t), {
962
993
  status: "success",
963
994
  outputMessage: S,
964
- sharedStatePatch: { portalGroupSummaryMemory: { value: lt } }
995
+ sharedStatePatch: { portalGroupSummaryMemory: { value: ct } }
965
996
  };
966
- }, Ce = r.object({
967
- summary: r.string(),
968
- followUpQuestions: r.array(r.string()).default([])
969
- }), q = (s, t) => t ?? s, rt = h.Root({
970
- ...P(),
971
- groupSummaryIntent: h({
972
- reducer: q,
997
+ }, Pe = n.object({
998
+ summary: n.string(),
999
+ followUpQuestions: n.array(n.string()).default([])
1000
+ }), z = (a, t) => t ?? a, it = y.Root({
1001
+ ...k(),
1002
+ groupSummaryIntent: y({
1003
+ reducer: z,
973
1004
  default: () => "clarify"
974
1005
  }),
975
- groupSummaryGroupId: h({
976
- reducer: q,
1006
+ groupSummaryGroupId: y({
1007
+ reducer: z,
977
1008
  default: () => null
978
1009
  }),
979
- groupSummaryQuestion: h({
980
- reducer: q,
1010
+ groupSummaryQuestion: y({
1011
+ reducer: z,
981
1012
  default: () => ""
982
1013
  })
983
- }), Ne = () => new C(rt).addNode("detectGroupSummaryIntent", ge).addNode("summarizePortalGroup", Te).addNode("answerGroupSummaryFollowUp", pe).addNode("suggestGroupSummaryNavigation", fe).addEdge(N, "detectGroupSummaryIntent").addConditionalEdges("detectGroupSummaryIntent", (t) => t.groupSummaryIntent === "summarize" ? "summarizePortalGroup" : t.groupSummaryIntent === "followUp" ? "answerGroupSummaryFollowUp" : t.groupSummaryIntent === "navigation" ? "suggestGroupSummaryNavigation" : f).addEdge("summarizePortalGroup", f).addEdge("answerGroupSummaryFollowUp", f).addEdge("suggestGroupSummaryNavigation", f), Pe = String.raw`- **portal-group-analytics** - Portal group analytics assistant:
1014
+ }), ke = () => new N(it).addNode("detectGroupSummaryIntent", ye).addNode("summarizePortalGroup", Ne).addNode("answerGroupSummaryFollowUp", ge).addNode("suggestGroupSummaryNavigation", we).addEdge(P, "detectGroupSummaryIntent").addConditionalEdges("detectGroupSummaryIntent", (t) => t.groupSummaryIntent === "summarize" ? "summarizePortalGroup" : t.groupSummaryIntent === "followUp" ? "answerGroupSummaryFollowUp" : t.groupSummaryIntent === "navigation" ? "suggestGroupSummaryNavigation" : w).addEdge("summarizePortalGroup", w).addEdge("answerGroupSummaryFollowUp", w).addEdge("suggestGroupSummaryNavigation", w), qe = String.raw`- **portal-group-analytics** - Portal group analytics assistant:
984
1015
  - summarizes ArcGIS portal groups from group context and sourceJSON details
985
1016
  - answers follow-up questions grounded in the summarized group
986
1017
  - suggests navigation to groups when relevant
987
- `, ke = {
1018
+ `, ze = {
988
1019
  id: "portal-group-analytics",
989
1020
  name: "Portal Group Analytics",
990
- description: Pe,
991
- createGraph: Ne,
992
- workspace: rt
993
- }, qe = () => ({ latestItemId: null, memory: {} }), F = (s) => {
994
- const t = s?.agentExecutionContext.sharedState.portalItemAnalyticsSummaryMemory?.value;
995
- return t ? { latestItemId: t.latestItemId, memory: t.memory } : qe();
996
- }, ze = r.object({
997
- intent: r.enum(["summarize", "followUp", "clarify"]),
998
- itemId: r.string().default(""),
999
- question: r.string().default("")
1000
- }), $e = r.object({ summary: r.string(), followUpQuestions: r.array(r.string()).default([]) }), Ee = r.object({ answer: r.string(), isRelevant: r.boolean() }), De = `
1021
+ description: qe,
1022
+ createGraph: ke,
1023
+ workspace: it
1024
+ }, $e = () => ({ latestItemId: null, memory: {} }), O = (a) => {
1025
+ const t = a?.agentExecutionContext.sharedState.portalItemAnalyticsSummaryMemory?.value;
1026
+ return t ? { latestItemId: t.latestItemId, memory: t.memory } : $e();
1027
+ }, J = n.object({
1028
+ intent: n.enum(["summarize", "followUp", "clarify"]),
1029
+ itemId: n.string().default(""),
1030
+ question: n.string().default("")
1031
+ }), Ee = n.object({ summary: n.string(), followUpQuestions: n.array(n.string()).default([]) }), De = n.object({ answer: n.string(), isRelevant: n.boolean() }), Ue = `
1001
1032
  You answer follow-up questions about an ArcGIS item.
1002
1033
 
1003
1034
  Ground your answer in the provided item context.
@@ -1017,18 +1048,18 @@ Item full context
1017
1048
 
1018
1049
  Question:
1019
1050
  {question}
1020
- `, Ue = async (s, t) => {
1051
+ `, Re = async (a, t) => {
1021
1052
  await g({ text: "Answering follow-up...", agentName: "analytics" }, t);
1022
- const e = F(s), a = s.analyticsItemId ?? e.latestItemId, o = a ? e.memory[a] : void 0, i = s.analyticsQuestion || I(s.agentExecutionContext.messages);
1053
+ const e = O(a), s = a.analyticsItemId ?? e.latestItemId, o = s ? e.memory[s] : void 0, l = a.analyticsQuestion || x(a.agentExecutionContext.messages);
1023
1054
  return o ? {
1024
1055
  status: "success",
1025
- outputMessage: (await b({
1026
- promptText: De,
1027
- schema: Ee,
1056
+ outputMessage: (await v({
1057
+ promptText: Ue,
1058
+ schema: De,
1028
1059
  modelTier: "default",
1029
1060
  inputVariables: {
1030
1061
  summary: o.summary,
1031
- question: i,
1062
+ question: l,
1032
1063
  fullContext: JSON.stringify(o.fullContext)
1033
1064
  }
1034
1065
  })).answer
@@ -1036,7 +1067,7 @@ Question:
1036
1067
  status: "success",
1037
1068
  outputMessage: "I don't have enough information yet. Please ask me to summarize the item first using summarize item <item id>."
1038
1069
  };
1039
- }, Re = `
1070
+ }, Oe = `
1040
1071
  Classify the user analytics request.
1041
1072
 
1042
1073
  Rules:
@@ -1066,27 +1097,27 @@ hasSummaryContext:
1066
1097
 
1067
1098
  User message:
1068
1099
  {userMessage}
1069
- `, Fe = async (s, t) => {
1100
+ `, Fe = async (a, t) => {
1070
1101
  await g({ text: "Analyzing intent...", agentName: "analytics" }, t);
1071
- const e = I(s.agentExecutionContext.messages), a = !!F(s).latestItemId, o = await D.fromTemplate(Re).format({
1102
+ const e = x(a.agentExecutionContext.messages), s = !!O(a).latestItemId, o = await U.fromTemplate(Oe).format({
1072
1103
  userMessage: e,
1073
- hasSummaryContext: String(a)
1074
- }), u = await U({
1075
- model: await E({ modelTier: "fast" }),
1076
- tools: [tt],
1077
- systemPrompt: o,
1078
- responseFormat: ze,
1079
- checkpointer: !0
1080
- }).invoke({ messages: s.agentExecutionContext.messages }, t), { intent: l, itemId: c, question: n } = u.structuredResponse, d = l === "clarify" || l === "summarize" && !c || l === "followUp" && !n;
1104
+ hasSummaryContext: String(s)
1105
+ }), c = (await D({ modelTier: "fast" })).withStructuredOutput(J), i = J.parse(await c.invoke(o));
1106
+ let u = i.itemId;
1107
+ if (i.intent === "summarize" && !u) {
1108
+ const f = G(e, "#");
1109
+ f && (u = await at.invoke({ itemTitle: f }, t) ?? "");
1110
+ }
1111
+ const { intent: r, question: p } = i, h = r === "clarify" || r === "summarize" && !u || r === "followUp" && !p;
1081
1112
  return {
1082
- agentExecutionContext: { ...s.agentExecutionContext },
1083
- analyticsIntent: d ? "clarify" : l,
1084
- analyticsItemId: c || null,
1085
- analyticsQuestion: n || "",
1113
+ agentExecutionContext: { ...a.agentExecutionContext },
1114
+ analyticsIntent: h ? "clarify" : r,
1115
+ analyticsItemId: u || null,
1116
+ analyticsQuestion: p || "",
1086
1117
  status: "success",
1087
- outputMessage: d ? 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".' : ""
1118
+ outputMessage: h ? 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".' : ""
1088
1119
  };
1089
- }, Oe = `
1120
+ }, Ve = `
1090
1121
  You are a item summary tool for ArcGIS. Your job is to summarize an item's info based on the provided context.
1091
1122
  Summary rules:
1092
1123
  - The summary should be concise markdown, make sure to format the output nicely so it's easy to read.
@@ -1101,55 +1132,55 @@ Do not include internal identifiers.
1101
1132
  If the user asks for a detailed summary, you may expand the response up to 300 words.
1102
1133
  Item context:
1103
1134
  {context}
1104
- `, Ve = async (s, t) => {
1105
- const e = s.analyticsItemId;
1135
+ `, je = async (a, t) => {
1136
+ const e = a.analyticsItemId;
1106
1137
  if (!e)
1107
1138
  return {
1108
1139
  status: "success",
1109
1140
  outputMessage: 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".'
1110
1141
  };
1111
1142
  await g({ text: `Summarizing item ${e}...`, agentName: "analytics" }, t);
1112
- const a = t?.configurable?.context;
1113
- v(a);
1114
- const { portal: o, user: i } = a, { result: u, error: l } = await xt(i, o, e);
1115
- if (l || !u)
1143
+ const s = t?.configurable?.context;
1144
+ I(s);
1145
+ const { portal: o, user: l } = s, { result: c, error: i } = await Mt(l, o, e);
1146
+ if (i || !c)
1116
1147
  return await g({ text: "Failed to get item context for summarization", agentName: "analytics" }, t), {
1117
1148
  status: "success",
1118
1149
  outputMessage: "Unable to retrieve item context for summarization."
1119
1150
  };
1120
- const { context: c } = u, n = await b({
1121
- promptText: Oe,
1122
- schema: $e,
1151
+ const { context: u } = c, r = await v({
1152
+ promptText: Ve,
1153
+ schema: Ee,
1123
1154
  modelTier: "default",
1124
- inputVariables: { context: JSON.stringify(c) }
1125
- }), { followUpQuestions: p, summary: m } = n, d = F(s), y = {
1155
+ inputVariables: { context: JSON.stringify(u) }
1156
+ }), { followUpQuestions: p, summary: m } = r, d = O(a), h = {
1126
1157
  latestItemId: e,
1127
1158
  memory: {
1128
1159
  ...d.memory,
1129
- [e]: { summary: m, followUpQuestions: p, fullContext: c }
1160
+ [e]: { summary: m, followUpQuestions: p, fullContext: u }
1130
1161
  }
1131
1162
  };
1132
- return p.length && await $({ type: "suggested-prompts", data: { prompts: p } }, t), {
1163
+ return p.length && await E({ type: "suggested-prompts", data: { prompts: p } }, t), {
1133
1164
  status: "success",
1134
1165
  outputMessage: m,
1135
- sharedStatePatch: { portalItemAnalyticsSummaryMemory: { value: y } }
1166
+ sharedStatePatch: { portalItemAnalyticsSummaryMemory: { value: h } }
1136
1167
  };
1137
- }, z = (s, t) => t ?? s, nt = h.Root({
1138
- ...P(),
1168
+ }, $ = (a, t) => t ?? a, lt = y.Root({
1169
+ ...k(),
1139
1170
  // States shared only across nodes in the graph, not between invocations
1140
- analyticsIntent: h({
1141
- reducer: z,
1171
+ analyticsIntent: y({
1172
+ reducer: $,
1142
1173
  default: () => "clarify"
1143
1174
  }),
1144
- analyticsItemId: h({
1145
- reducer: z,
1175
+ analyticsItemId: y({
1176
+ reducer: $,
1146
1177
  default: () => null
1147
1178
  }),
1148
- analyticsQuestion: h({
1149
- reducer: z,
1179
+ analyticsQuestion: y({
1180
+ reducer: $,
1150
1181
  default: () => ""
1151
1182
  })
1152
- }), je = () => new C(nt).addNode("detectAnalyticsIntent", Fe).addNode("summarizePortalItem", Ve).addNode("answerAnalyticsFollowUp", Ue).addEdge(N, "detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent", (t) => t.analyticsIntent === "summarize" ? "summarizePortalItem" : t.analyticsIntent === "followUp" ? "answerAnalyticsFollowUp" : f).addEdge("summarizePortalItem", f).addEdge("answerAnalyticsFollowUp", f), Le = String.raw`- **portal-item-analytics** - Portal item analytics assistant:
1183
+ }), _e = () => new N(lt).addNode("detectAnalyticsIntent", Fe).addNode("summarizePortalItem", je).addNode("answerAnalyticsFollowUp", Re).addEdge(P, "detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent", (t) => t.analyticsIntent === "summarize" ? "summarizePortalItem" : t.analyticsIntent === "followUp" ? "answerAnalyticsFollowUp" : w).addEdge("summarizePortalItem", w).addEdge("answerAnalyticsFollowUp", w), Le = String.raw`- **portal-item-analytics** - Portal item analytics assistant:
1153
1184
  - answers questions about one specific ArcGIS portal item when item context is present
1154
1185
  - summarizes item details, metadata, and context grounded in that item
1155
1186
  - suggests follow-up prompts grounded in the same item
@@ -1158,13 +1189,13 @@ Item context:
1158
1189
  id: "portal-item-analytics",
1159
1190
  name: "Portal Item Analytics",
1160
1191
  description: Le,
1161
- createGraph: je,
1162
- workspace: nt
1163
- }, Qe = dt`:host{height:100%;border-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);display:block;width:100%;--tw-shadow: 0 1px 6px -1px rgba(0, 0, 0, .16), 0 1px 2px -1px rgba(0, 0, 0, .08);--tw-shadow-colored: 0 1px 6px -1px var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.chat-entry{display:flex;flex-direction:column;gap:.75rem;width:100%}.chat-actions{display:flex;justify-content:flex-end;gap:.5rem}.header-actions{display:flex;gap:.5rem;padding-inline-start:.75rem}.navigation-block{display:flex;flex-direction:column;align-items:stretch;gap:.35rem;margin-top:.5rem}.navigation-button{width:100%;margin-block:.25rem}.navigation-block-description{font-size:.75rem;color:var(--calcite-color-text-3)}`;
1164
- function Ke(s, t) {
1192
+ createGraph: _e,
1193
+ workspace: lt
1194
+ }, Qe = gt`:host{height:100%;border-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);display:block;width:100%;--tw-shadow: 0 1px 6px -1px rgba(0, 0, 0, .16), 0 1px 2px -1px rgba(0, 0, 0, .08);--tw-shadow-colored: 0 1px 6px -1px var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.chat-entry{display:flex;flex-direction:column;gap:.75rem;width:100%}.chat-actions{display:flex;justify-content:flex-end;gap:.5rem}.header-actions{display:flex;gap:.5rem;padding-inline-start:.75rem}.navigation-block{display:flex;flex-direction:column;align-items:stretch;gap:.35rem;margin-top:.5rem}.navigation-button{width:100%;margin-block:.25rem}.navigation-block-description{font-size:.75rem;color:var(--calcite-color-text-3)}`;
1195
+ function Ke(a, t) {
1165
1196
  if (!t)
1166
1197
  return;
1167
- const { destinationType: e } = s;
1198
+ const { destinationType: e } = a;
1168
1199
  switch (e) {
1169
1200
  case "portal-content":
1170
1201
  case "portal-content-favorites":
@@ -1182,26 +1213,26 @@ function Ke(s, t) {
1182
1213
  case "portal-settings-security":
1183
1214
  return t[e];
1184
1215
  case "portal-item":
1185
- return t[e]?.(s.itemId);
1216
+ return t[e]?.(a.itemId);
1186
1217
  case "portal-group":
1187
- return t[e]?.(s.groupId);
1218
+ return t[e]?.(a.groupId);
1188
1219
  default:
1189
- return T(e);
1220
+ return C(e);
1190
1221
  }
1191
1222
  }
1192
- function Je(s) {
1193
- const t = Lt.safeParse(s);
1223
+ function Je(a) {
1224
+ const t = Lt.safeParse(a);
1194
1225
  return t.success ? t.data : void 0;
1195
1226
  }
1196
- class We extends ct {
1227
+ class We extends dt {
1197
1228
  constructor() {
1198
- super(...arguments), this.t9n = gt({ blocking: !0 }), this.assistantEl = G(), this.formEl = G(), this.voiceInputEl = G(), this.inputEl = G(), this.navigationSlotElements = /* @__PURE__ */ new Map(), this.handleSlottableRequest = (t) => {
1199
- const e = t.detail, a = e.data?.block;
1200
- if (!a)
1229
+ super(...arguments), this.t9n = ft({ blocking: !0 }), this.assistantEl = T(), this.formEl = T(), this.voiceInputEl = T(), this.inputEl = T(), this.navigationSlotElements = /* @__PURE__ */ new Map(), this.handleSlottableRequest = (t) => {
1230
+ const e = t.detail, s = e.data?.block;
1231
+ if (!s)
1201
1232
  return;
1202
- const o = this.getNavigationAction(a);
1233
+ const o = this.getNavigationAction(s);
1203
1234
  o && this.upsertNavigationSlotElement(e.slotName, o);
1204
- }, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.defaultClosed = !1, this.arcgisPortalNavigationRequest = pt();
1235
+ }, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.defaultClosed = !1, this.arcgisPortalNavigationRequest = mt();
1205
1236
  }
1206
1237
  static {
1207
1238
  this.properties = { inputText: 16, showVoiceInput: 16, isListening: 16, isVoiceInputDisabled: 16, interrupt: 16, autoDestroyDisabled: 5, portal: 0, user: 0, config: 0, navigationTargetMap: 0, defaultClosed: 5 };
@@ -1210,22 +1241,22 @@ class We extends ct {
1210
1241
  this.styles = Qe;
1211
1242
  }
1212
1243
  getNavigationAction(t) {
1213
- if (t?.type !== _)
1244
+ if (t?.type !== X)
1214
1245
  return;
1215
1246
  const e = Je(t.data);
1216
1247
  if (!e)
1217
1248
  return;
1218
- const a = Ke(e, this.navigationTargetMap);
1219
- if (a)
1220
- return { href: a, targetDetail: e, label: this.getNavigationText(e.destinationType) };
1249
+ const s = Ke(e, this.navigationTargetMap);
1250
+ if (s)
1251
+ return { href: s, targetDetail: e, label: this.getNavigationText(e.destinationType) };
1221
1252
  }
1222
1253
  upsertNavigationSlotElement(t, e) {
1223
- const a = this.assistantEl.value;
1224
- if (!a)
1254
+ const s = this.assistantEl.value;
1255
+ if (!s)
1225
1256
  return;
1226
1257
  let o = this.navigationSlotElements.get(t);
1227
- o || (o = document.createElement("div"), o.slot = t, this.navigationSlotElements.set(t, o), a.append(o)), mt(M`<div><calcite-button class="navigation-button" appearance=outline width=full .href=${e.href} icon-end=launch @click=${(i) => {
1228
- i.preventDefault(), this.arcgisPortalNavigationRequest.emit({
1258
+ o || (o = document.createElement("div"), o.slot = t, this.navigationSlotElements.set(t, o), s.append(o)), ht(M`<div><calcite-button class="navigation-button" appearance=outline width=full .href=${e.href} icon-end=launch @click=${(l) => {
1259
+ l.preventDefault(), this.arcgisPortalNavigationRequest.emit({
1229
1260
  href: e.href,
1230
1261
  targetDetail: e.targetDetail
1231
1262
  });
@@ -1267,49 +1298,49 @@ class We extends ct {
1267
1298
  case "portal-group":
1268
1299
  return e.openGroup;
1269
1300
  default:
1270
- return T(t);
1301
+ return C(t);
1271
1302
  }
1272
1303
  }
1273
1304
  render() {
1274
- const { t9n: t, inputText: e, portal: a, user: o, navigationTargetMap: i, showVoiceInput: u, isListening: l, isVoiceInputDisabled: c } = this;
1275
- return M`<arcgis-assistant log-enabled keep-suggested-prompts .heading=${t.heading} .entryMessage=${t.entryMessage} @arcgisSlottableRequest=${this.handleSlottableRequest} @arcgisInterrupt=${({ detail: n }) => {
1276
- this.interrupt = n;
1305
+ const { t9n: t, inputText: e, portal: s, user: o, navigationTargetMap: l, showVoiceInput: c, isListening: i, isVoiceInputDisabled: u } = this;
1306
+ return M`<arcgis-assistant log-enabled keep-suggested-prompts .heading=${t.heading} .entryMessage=${t.entryMessage} @arcgisSlottableRequest=${this.handleSlottableRequest} @arcgisInterrupt=${({ detail: r }) => {
1307
+ this.interrupt = r;
1277
1308
  }} @arcgisInterruptCancel=${() => {
1278
1309
  this.interrupt = null;
1279
1310
  }} @arcgisInterruptSubmit=${() => {
1280
1311
  this.interrupt = null;
1281
- }} @arcgisPromptSelect=${({ detail: n }) => {
1282
- this.inputText = n.prompt, requestAnimationFrame(() => {
1312
+ }} @arcgisPromptSelect=${({ detail: r }) => {
1313
+ this.inputText = r.prompt, requestAnimationFrame(() => {
1283
1314
  this.inputEl.value?.focusTextArea();
1284
1315
  });
1285
- }} ${A(this.assistantEl)}><div slot=header-actions-start class="header-actions"><calcite-icon icon=effects></calcite-icon></div><form slot=chat-entry class="chat-entry" @submit=${(n) => {
1286
- n.preventDefault();
1316
+ }} ${A(this.assistantEl)}><div slot=header-actions-start class="header-actions"><calcite-icon icon=effects></calcite-icon></div><form slot=chat-entry class="chat-entry" @submit=${(r) => {
1317
+ r.preventDefault();
1287
1318
  const p = e.trim();
1288
1319
  p && (this.assistantEl.value?.submitMessage(p), this.inputText = "");
1289
- }} ${A(this.formEl)}><arcgis-portal-mentionable-text-area .portal=${a} .user=${o} rows=3 .popoverListLabel=${t.mentionEntities} .placeholder=${t.placeholder} .value=${e} @arcgisUserMentionableTextAreaKeyDown=${({ detail: n }) => {
1290
- n.key === "Enter" && !n.shiftKey && (n.preventDefault(), this.formEl.value?.requestSubmit());
1291
- }} @arcgisUserMentionableTextAreaChange=${({ detail: n }) => {
1292
- this.inputText = n ?? "";
1320
+ }} ${A(this.formEl)}><arcgis-portal-mentionable-text-area .portal=${s} .user=${o} rows=3 .popoverListLabel=${t.mentionEntities} .placeholder=${t.placeholder} .value=${e} @arcgisUserMentionableTextAreaKeyDown=${({ detail: r }) => {
1321
+ r.key === "Enter" && !r.shiftKey && (r.preventDefault(), this.formEl.value?.requestSubmit());
1322
+ }} @arcgisUserMentionableTextAreaChange=${({ detail: r }) => {
1323
+ this.inputText = r ?? "";
1293
1324
  }} ${A(this.inputEl)}></arcgis-portal-mentionable-text-area><div class="chat-actions"><arcgis-portal-voice-input @arcgisVoiceInputStart=${() => {
1294
1325
  this.isListening = !0, this.isVoiceInputDisabled = !1;
1295
1326
  }} @arcgisVoiceInputStop=${() => {
1296
1327
  this.isListening = !1, this.isVoiceInputDisabled = !1;
1297
- }} @arcgisVoiceInputError=${(n) => {
1298
- n.detail.errorCode === "not-supported" && (this.showVoiceInput = !1);
1299
- }} @arcgisVoiceInputInterimTranscription=${(n) => {
1300
- this.inputText = n.detail.text;
1301
- }} ${A(this.voiceInputEl)}></arcgis-portal-voice-input>${u && M`<calcite-button icon-start=microphone .label=${t.voiceInput} round .disabled=${c} .appearance=${l ? "solid" : "outline-fill"} @click=${async () => {
1328
+ }} @arcgisVoiceInputError=${(r) => {
1329
+ r.detail.errorCode === "not-supported" && (this.showVoiceInput = !1);
1330
+ }} @arcgisVoiceInputInterimTranscription=${(r) => {
1331
+ this.inputText = r.detail.text;
1332
+ }} ${A(this.voiceInputEl)}></arcgis-portal-voice-input>${c && M`<calcite-button icon-start=microphone .label=${t.voiceInput} round .disabled=${u} .appearance=${i ? "solid" : "outline-fill"} @click=${async () => {
1302
1333
  this.isVoiceInputDisabled = !0;
1303
- const n = this.voiceInputEl.value;
1304
- l ? await n?.stopListening() : await n?.startListening();
1305
- }}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!e.trim()} .label=${t.send}>${t.send}</calcite-button></div></form><arcgis-assistant-agent .agent=${Be} .context=${{ portal: a, user: o, navigationTargetMap: i }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${Jt} .context=${{ portal: a, user: o, navigationTargetMap: i }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${le} .context=${{ portal: a, user: o, navigationTargetMap: i }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${ke} .context=${{ portal: a, user: o, navigationTargetMap: i }}></arcgis-assistant-agent>${this.interrupt && M`<arcgis-portal-ai-assistant-interrupt slot=interrupt .type=${this.interrupt.type} .message=${this.interrupt.message} .options=${this.interrupt.options} @arcgisSubmit=${({ detail: n }) => {
1306
- this.assistantEl.value?.submitInterrupt(n);
1334
+ const r = this.voiceInputEl.value;
1335
+ i ? await r?.stopListening() : await r?.startListening();
1336
+ }}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!e.trim()} .label=${t.send}>${t.send}</calcite-button></div></form><arcgis-assistant-agent .agent=${Be} .context=${{ portal: s, user: o, navigationTargetMap: l }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${Jt} .context=${{ portal: s, user: o, navigationTargetMap: l }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${pe} .context=${{ portal: s, user: o, navigationTargetMap: l }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${ze} .context=${{ portal: s, user: o, navigationTargetMap: l }}></arcgis-assistant-agent>${this.interrupt && M`<arcgis-portal-ai-assistant-interrupt slot=interrupt .type=${this.interrupt.type} .message=${this.interrupt.message} .options=${this.interrupt.options} @arcgisSubmit=${({ detail: r }) => {
1337
+ this.assistantEl.value?.submitInterrupt(r);
1307
1338
  }} @arcgisCancel=${() => {
1308
1339
  this.assistantEl.value?.cancelInterrupt();
1309
1340
  }}></arcgis-portal-ai-assistant-interrupt>` || ""}</arcgis-assistant>`;
1310
1341
  }
1311
1342
  }
1312
- ut("arcgis-portal-ai-assistant", We);
1343
+ pt("arcgis-portal-ai-assistant", We);
1313
1344
  export {
1314
1345
  We as ArcgisPortalAiAssistant
1315
1346
  };