@arcgis/portal-components 5.2.0-next.71 → 5.2.0-next.73
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.
- package/LICENSE.md +4 -2
- package/dist/cdn/{2IIE3YY2.js → HWRG6XAS.js} +107 -107
- package/dist/cdn/{UUGX7XW6.js → KPDZDJTT.js} +1 -1
- package/dist/cdn/{YPRKDQA4.js → SSLWBHRC.js} +1 -1
- package/dist/cdn/W2AW2BW3.js +2 -0
- package/dist/cdn/{3IA7YX3J.js → YY4236HO.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/portal-item-badge.js +107 -104
- package/dist/components/arcgis-portal-ai-assistant/agents/portalRouteKeys.d.ts +26 -0
- package/dist/components/arcgis-portal-ai-assistant/agents/types.d.ts +19 -4
- package/dist/components/arcgis-portal-ai-assistant/customElement.js +920 -780
- package/dist/components/arcgis-portal-navigation/customElement.js +1 -1
- package/dist/components/arcgis-portal-navigation/index.js +1 -1
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +4 -4
- package/dist/cdn/G4HKVJ53.js +0 -2
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { LitElement as
|
|
4
|
-
import { css as
|
|
2
|
+
import { c as Rt } from "../../chunks/runtime.js";
|
|
3
|
+
import { LitElement as Ut, createEvent as Ft } from "@arcgis/lumina";
|
|
4
|
+
import { css as Ot, render as Lt, html as v } from "lit";
|
|
5
5
|
import { createRef as P, ref as q } from "lit/directives/ref.js";
|
|
6
|
-
import { u as
|
|
7
|
-
import { NodeInterrupt as
|
|
8
|
-
import { sendTraceMessage as m, invokeStructuredPrompt as
|
|
6
|
+
import { u as jt } from "../../chunks/useT9n.js";
|
|
7
|
+
import { NodeInterrupt as ft, Annotation as h, StateGraph as A, START as N, END as w } from "@langchain/langgraph/web";
|
|
8
|
+
import { sendTraceMessage as m, invokeStructuredPrompt as b, sendUXSuggestion as Q, createAgentRuntimeStateWithSharedState as G, createChatModel as W, getEmbeddings as Vt } from "@arcgis/ai-components/utils/index.js";
|
|
9
9
|
import s from "zod";
|
|
10
|
-
import { a as
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import { a as
|
|
14
|
-
import { ChatPromptTemplate as
|
|
15
|
-
import { tool as
|
|
16
|
-
import { s as
|
|
17
|
-
import { g as
|
|
18
|
-
import
|
|
19
|
-
const
|
|
20
|
-
const { portal:
|
|
21
|
-
return !!
|
|
10
|
+
import { a as Bt, c as Kt, q as Qt } from "../../chunks/groups.js";
|
|
11
|
+
import Wt from "@arcgis/core/identity/IdentityManager.js";
|
|
12
|
+
import H from "@arcgis/core/request.js";
|
|
13
|
+
import { a as D, t as Jt, b as B } from "../../chunks/functionalities.js";
|
|
14
|
+
import { ChatPromptTemplate as J } from "@langchain/core/prompts";
|
|
15
|
+
import { tool as yt } from "@langchain/core/tools";
|
|
16
|
+
import { s as _t, a as Yt } from "../../chunks/item2.js";
|
|
17
|
+
import { g as Ht, e as Xt, i as Zt, c as te, a as ee } from "../../chunks/groups2.js";
|
|
18
|
+
import ae from "@arcgis/core/portal/Portal.js";
|
|
19
|
+
const wt = (t) => {
|
|
20
|
+
const { portal: e, user: a } = t ?? {};
|
|
21
|
+
return !!t && !!e && !!a;
|
|
22
22
|
};
|
|
23
|
-
function T(
|
|
24
|
-
if (!
|
|
23
|
+
function T(t) {
|
|
24
|
+
if (!wt(t))
|
|
25
25
|
throw new Error("Invalid context: PortalAssistantContext with portal and user is required.");
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const ne = `
|
|
28
28
|
Write a concise, friendly success message for adding members to a group.
|
|
29
29
|
|
|
30
30
|
Rules:
|
|
@@ -39,68 +39,68 @@ Added members:
|
|
|
39
39
|
|
|
40
40
|
Not added members:
|
|
41
41
|
{notAddedMembers}
|
|
42
|
-
`,
|
|
42
|
+
`, oe = (t) => t.map((e) => `"${e}"`).join(", "), re = s.object({
|
|
43
43
|
successMessage: s.string().default("")
|
|
44
|
-
}),
|
|
45
|
-
if (
|
|
44
|
+
}), X = "portal-group-creation", Z = "approveAddMembers", se = async (t, e) => {
|
|
45
|
+
if (t.intentParams.intent !== "addMembers")
|
|
46
46
|
return {
|
|
47
47
|
status: "success",
|
|
48
48
|
outputMessage: "Use @mention usernames for the members you want to add."
|
|
49
49
|
};
|
|
50
|
-
const a =
|
|
50
|
+
const a = t.agentExecutionContext.sharedState.createdGroupId?.value;
|
|
51
51
|
if (!a)
|
|
52
52
|
return {
|
|
53
53
|
status: "success",
|
|
54
54
|
outputMessage: "Create a group first, then add members using @mention usernames."
|
|
55
55
|
};
|
|
56
|
-
const n =
|
|
56
|
+
const n = t.intentParams.memberInfo.memberIdentifiers.map((p) => p.trim()).filter(Boolean);
|
|
57
57
|
if (!n.length)
|
|
58
58
|
return {
|
|
59
59
|
status: "success",
|
|
60
60
|
outputMessage: "Use @mention usernames for the members you want to add."
|
|
61
61
|
};
|
|
62
|
-
const
|
|
62
|
+
const r = `The following member(s) will be added to the newly created group:
|
|
63
63
|
|
|
64
64
|
${n.map((p) => `- **@${p}**`).join(`
|
|
65
65
|
`)}
|
|
66
66
|
|
|
67
|
-
Do you want to continue?`, { hitlResponse:
|
|
68
|
-
if (
|
|
67
|
+
Do you want to continue?`, { hitlResponse: c } = e?.configurable ?? {};
|
|
68
|
+
if (c?.agentId !== X || c.id !== Z) {
|
|
69
69
|
const p = {
|
|
70
|
-
agentId:
|
|
71
|
-
id:
|
|
70
|
+
agentId: X,
|
|
71
|
+
id: Z,
|
|
72
72
|
kind: "booleanChoice",
|
|
73
|
-
message:
|
|
73
|
+
message: r,
|
|
74
74
|
metadata: {
|
|
75
75
|
action: "addMembers",
|
|
76
76
|
groupId: a,
|
|
77
77
|
members: [...n]
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
|
-
throw new
|
|
80
|
+
throw new ft(p);
|
|
81
81
|
}
|
|
82
|
-
if (
|
|
82
|
+
if (c.payload !== !0)
|
|
83
83
|
return {
|
|
84
84
|
status: "success",
|
|
85
85
|
outputMessage: "Okay, I cancelled adding members to the group."
|
|
86
86
|
};
|
|
87
87
|
await m(
|
|
88
|
-
{ text: `Adding members ${
|
|
89
|
-
|
|
88
|
+
{ text: `Adding members ${oe(n)}...`, agentName: "group-creation" },
|
|
89
|
+
e
|
|
90
90
|
);
|
|
91
|
-
const i =
|
|
91
|
+
const i = e?.configurable?.context;
|
|
92
92
|
T(i);
|
|
93
|
-
const { result: l, error:
|
|
94
|
-
if (
|
|
93
|
+
const { result: l, error: u } = await Bt(i.portal, a, n);
|
|
94
|
+
if (u || !l)
|
|
95
95
|
return {
|
|
96
96
|
status: "success",
|
|
97
97
|
outputMessage: "I could not add members to that group. Please confirm group access and user accounts, then try again."
|
|
98
98
|
};
|
|
99
99
|
const { addedUsernames: d, notAddedUsers: g } = l;
|
|
100
100
|
try {
|
|
101
|
-
const f = (await
|
|
102
|
-
promptText:
|
|
103
|
-
schema:
|
|
101
|
+
const f = (await b({
|
|
102
|
+
promptText: ne,
|
|
103
|
+
schema: re,
|
|
104
104
|
modelTier: "fast",
|
|
105
105
|
inputVariables: {
|
|
106
106
|
addedMembers: d.join(", "),
|
|
@@ -115,7 +115,7 @@ Do you want to continue?`, { hitlResponse: u } = t?.configurable ?? {};
|
|
|
115
115
|
console.error("Error generating add-members success message:", p);
|
|
116
116
|
}
|
|
117
117
|
return {};
|
|
118
|
-
},
|
|
118
|
+
}, ie = `
|
|
119
119
|
Write a concise, friendly success message after creating a portal group.
|
|
120
120
|
|
|
121
121
|
Rules:
|
|
@@ -126,7 +126,7 @@ Rules:
|
|
|
126
126
|
|
|
127
127
|
Group title:
|
|
128
128
|
{groupTitle}
|
|
129
|
-
`,
|
|
129
|
+
`, ce = `
|
|
130
130
|
Write a concise, friendly failure message after an attempt to create a portal group.
|
|
131
131
|
|
|
132
132
|
Rules:
|
|
@@ -141,27 +141,27 @@ Group title:
|
|
|
141
141
|
|
|
142
142
|
Failure reason:
|
|
143
143
|
{failureReason}
|
|
144
|
-
`,
|
|
144
|
+
`, tt = "portal-group-creation", et = "approveCreateGroup", ue = s.object({
|
|
145
145
|
successMessage: s.string().default("")
|
|
146
|
-
}),
|
|
146
|
+
}), le = s.object({
|
|
147
147
|
failureMessage: s.string().default("")
|
|
148
|
-
}),
|
|
149
|
-
if (
|
|
148
|
+
}), de = async (t, e) => {
|
|
149
|
+
if (t.intentParams.intent !== "create")
|
|
150
150
|
return {
|
|
151
151
|
status: "success",
|
|
152
152
|
outputMessage: "Tell me the group title you want to use."
|
|
153
153
|
};
|
|
154
|
-
const a =
|
|
154
|
+
const a = t.intentParams.title.trim();
|
|
155
155
|
if (!a)
|
|
156
156
|
return {
|
|
157
157
|
status: "success",
|
|
158
158
|
outputMessage: "What title would you like for the new group?"
|
|
159
159
|
};
|
|
160
|
-
const n = `A group with the title **${a}** will be created. Do you want to continue?`, { hitlResponse:
|
|
161
|
-
if (
|
|
162
|
-
const
|
|
163
|
-
agentId:
|
|
164
|
-
id:
|
|
160
|
+
const n = `A group with the title **${a}** will be created. Do you want to continue?`, { hitlResponse: o } = e?.configurable;
|
|
161
|
+
if (o?.agentId !== tt || o.id !== et) {
|
|
162
|
+
const u = {
|
|
163
|
+
agentId: tt,
|
|
164
|
+
id: et,
|
|
165
165
|
kind: "booleanChoice",
|
|
166
166
|
message: n,
|
|
167
167
|
metadata: {
|
|
@@ -170,30 +170,30 @@ Failure reason:
|
|
|
170
170
|
access: "private"
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
throw new
|
|
173
|
+
throw new ft(u);
|
|
174
174
|
}
|
|
175
|
-
if (
|
|
175
|
+
if (o.payload !== !0)
|
|
176
176
|
return {
|
|
177
177
|
status: "success",
|
|
178
178
|
outputMessage: `Okay, I cancelled creating **${a}**.`
|
|
179
179
|
};
|
|
180
|
-
await m({ text: `Creating group "${a}"...`, agentName: "group-creation" },
|
|
181
|
-
const
|
|
182
|
-
T(
|
|
183
|
-
const { result:
|
|
180
|
+
await m({ text: `Creating group "${a}"...`, agentName: "group-creation" }, e);
|
|
181
|
+
const r = e?.configurable?.context;
|
|
182
|
+
T(r);
|
|
183
|
+
const { result: c, error: i } = await Kt(r.portal, {
|
|
184
184
|
title: a,
|
|
185
185
|
access: "private"
|
|
186
186
|
});
|
|
187
|
-
if (i || !
|
|
188
|
-
const
|
|
187
|
+
if (i || !c) {
|
|
188
|
+
const u = i?.message?.trim() || "No additional details were provided.";
|
|
189
189
|
try {
|
|
190
|
-
const g = (await
|
|
191
|
-
promptText:
|
|
192
|
-
schema:
|
|
190
|
+
const g = (await b({
|
|
191
|
+
promptText: ce,
|
|
192
|
+
schema: le,
|
|
193
193
|
modelTier: "fast",
|
|
194
194
|
inputVariables: {
|
|
195
195
|
groupTitle: a,
|
|
196
|
-
failureReason:
|
|
196
|
+
failureReason: u
|
|
197
197
|
}
|
|
198
198
|
})).failureMessage.trim();
|
|
199
199
|
if (g)
|
|
@@ -209,11 +209,11 @@ Failure reason:
|
|
|
209
209
|
outputMessage: "I could not create that group. Please confirm your permissions and try again with the group title."
|
|
210
210
|
};
|
|
211
211
|
}
|
|
212
|
-
const l =
|
|
212
|
+
const l = c.id;
|
|
213
213
|
try {
|
|
214
|
-
const d = (await
|
|
215
|
-
promptText:
|
|
216
|
-
schema:
|
|
214
|
+
const d = (await b({
|
|
215
|
+
promptText: ie,
|
|
216
|
+
schema: ue,
|
|
217
217
|
modelTier: "fast",
|
|
218
218
|
inputVariables: {
|
|
219
219
|
groupTitle: a
|
|
@@ -226,13 +226,13 @@ Failure reason:
|
|
|
226
226
|
sharedStatePatch: { createdGroupId: { value: l } },
|
|
227
227
|
createdGroupId: l
|
|
228
228
|
};
|
|
229
|
-
} catch (
|
|
230
|
-
console.error("Error generating create-group success message:",
|
|
229
|
+
} catch (u) {
|
|
230
|
+
console.error("Error generating create-group success message:", u);
|
|
231
231
|
}
|
|
232
232
|
return {};
|
|
233
|
-
}, I = (
|
|
234
|
-
for (let
|
|
235
|
-
const a = e
|
|
233
|
+
}, I = (t) => {
|
|
234
|
+
for (let e = t.length - 1; e >= 0; e -= 1) {
|
|
235
|
+
const a = t[e];
|
|
236
236
|
if (a.type !== "human")
|
|
237
237
|
continue;
|
|
238
238
|
const n = a.content;
|
|
@@ -240,11 +240,11 @@ Failure reason:
|
|
|
240
240
|
return n;
|
|
241
241
|
if (Array.isArray(n))
|
|
242
242
|
return n.map(
|
|
243
|
-
(
|
|
243
|
+
(o) => typeof o == "string" ? o : "text" in o && typeof o.text == "string" ? o.text : ""
|
|
244
244
|
).join(" ").trim();
|
|
245
245
|
}
|
|
246
246
|
return "";
|
|
247
|
-
},
|
|
247
|
+
}, pe = `
|
|
248
248
|
You classify whether a user is asking to create a new ArcGIS Portal group or add members to an existing group.
|
|
249
249
|
|
|
250
250
|
Rules:
|
|
@@ -270,77 +270,96 @@ Examples:
|
|
|
270
270
|
|
|
271
271
|
User message:
|
|
272
272
|
{userMessage}
|
|
273
|
-
`,
|
|
273
|
+
`, me = s.object({
|
|
274
274
|
intent: s.enum(["clarify", "create", "addMembers"]).default("clarify"),
|
|
275
275
|
title: s.string().default(""),
|
|
276
276
|
memberIdentifiers: s.array(s.string()).default([]),
|
|
277
277
|
clarifyMessage: s.string().default("")
|
|
278
|
-
}),
|
|
279
|
-
await m({ text: "Thinking about groups...", agentName: "group-creation" },
|
|
280
|
-
const a = I(
|
|
281
|
-
promptText:
|
|
282
|
-
schema:
|
|
278
|
+
}), ge = async (t, e) => {
|
|
279
|
+
await m({ text: "Thinking about groups...", agentName: "group-creation" }, e);
|
|
280
|
+
const a = I(t.agentExecutionContext.messages).trim(), n = await b({
|
|
281
|
+
promptText: pe,
|
|
282
|
+
schema: me,
|
|
283
283
|
modelTier: "default",
|
|
284
284
|
inputVariables: { userMessage: a }
|
|
285
|
-
}),
|
|
285
|
+
}), o = n.title.trim(), r = n.memberIdentifiers.filter(Boolean), c = n.clarifyMessage.trim(), i = n.intent === "create" && !!o, l = n.intent === "addMembers" && r.length > 0;
|
|
286
286
|
return {
|
|
287
|
-
intentParams: i ? { intent: "create", title:
|
|
287
|
+
intentParams: i ? { intent: "create", title: o } : l ? { intent: "addMembers", memberInfo: { memberIdentifiers: r } } : { intent: "clarify" },
|
|
288
288
|
status: "success",
|
|
289
|
-
outputMessage: !i && !l ?
|
|
289
|
+
outputMessage: !i && !l ? c : ""
|
|
290
290
|
};
|
|
291
|
-
},
|
|
291
|
+
}, he = [
|
|
292
|
+
"customSignInSection",
|
|
293
|
+
"loginsSection",
|
|
294
|
+
"changeLoginProviderSection",
|
|
295
|
+
"multiFactorAuthSection",
|
|
296
|
+
"multifactorEnforcementSection",
|
|
297
|
+
"multifactorDesignatedAdminsSection"
|
|
298
|
+
], fe = ["customSignInCard", "loginCard", "multifactorAuthCard"], ye = ["newItem", "createLayer", "developerCredentials"], we = {
|
|
299
|
+
customSignInSection: "customSignInCard",
|
|
300
|
+
loginsSection: "loginCard",
|
|
301
|
+
changeLoginProviderSection: "loginCard",
|
|
302
|
+
multiFactorAuthSection: "multifactorAuthCard",
|
|
303
|
+
multifactorEnforcementSection: "multifactorAuthCard",
|
|
304
|
+
multifactorDesignatedAdminsSection: "multifactorAuthCard"
|
|
305
|
+
}, ve = ["favorites", "group", "living-atlas", "org"], be = ["featured", "my", "organization"], Ie = ["licenses", "members", "overview", "reports", "settings", "status"], Se = s.object({
|
|
292
306
|
destinationType: s.literal("portal-content"),
|
|
293
|
-
hash: s.enum(
|
|
294
|
-
|
|
295
|
-
|
|
307
|
+
hash: s.enum(ve).optional(),
|
|
308
|
+
queryParams: s.object({
|
|
309
|
+
newItem: s.enum(ye).optional()
|
|
310
|
+
}).optional()
|
|
311
|
+
}), xe = s.object({
|
|
296
312
|
destinationType: s.literal("portal-groups"),
|
|
297
|
-
hash: s.enum(
|
|
298
|
-
|
|
299
|
-
}), xt = s.object({
|
|
313
|
+
hash: s.enum(be).optional()
|
|
314
|
+
}), Te = s.object({
|
|
300
315
|
destinationType: s.literal("portal-org"),
|
|
301
|
-
hash: s.enum(
|
|
302
|
-
|
|
303
|
-
|
|
316
|
+
hash: s.enum(Ie).optional(),
|
|
317
|
+
queryParams: s.object({
|
|
318
|
+
tab: s.literal("security").optional(),
|
|
319
|
+
section: s.enum(fe).optional(),
|
|
320
|
+
subsection: s.enum(he).optional(),
|
|
321
|
+
period: s.string().optional(),
|
|
322
|
+
startTime: s.string().optional(),
|
|
323
|
+
endTime: s.string().optional()
|
|
324
|
+
}).optional()
|
|
325
|
+
}), Ce = s.object({
|
|
304
326
|
destinationType: s.literal("portal-item"),
|
|
305
|
-
itemId: s.string().trim().min(1)
|
|
306
|
-
|
|
307
|
-
}), Tt = s.object({
|
|
327
|
+
itemId: s.string().trim().min(1)
|
|
328
|
+
}), Me = s.object({
|
|
308
329
|
destinationType: s.literal("portal-group"),
|
|
309
|
-
groupId: s.string().trim().min(1)
|
|
310
|
-
|
|
311
|
-
}), Mt = s.object({
|
|
330
|
+
groupId: s.string().trim().min(1)
|
|
331
|
+
}), Ae = s.object({
|
|
312
332
|
destinationType: s.union([
|
|
313
333
|
s.literal("portal-gallery"),
|
|
314
334
|
s.literal("portal-map-viewer"),
|
|
315
335
|
s.literal("portal-notebooks"),
|
|
316
336
|
s.literal("portal-scene-viewer")
|
|
317
|
-
])
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
...N(),
|
|
337
|
+
])
|
|
338
|
+
}), Ne = s.union([
|
|
339
|
+
Se,
|
|
340
|
+
xe,
|
|
341
|
+
Te,
|
|
342
|
+
Ce,
|
|
343
|
+
Me,
|
|
344
|
+
Ae
|
|
345
|
+
]), vt = "portal-navigation", R = async (t, e) => {
|
|
346
|
+
const a = e?.configurable?.context;
|
|
347
|
+
!wt(a) || !a.navigationTargetMap?.[t.destinationType] || await Q({ type: vt, data: { ...t } }, e);
|
|
348
|
+
}, Ge = async (t, e) => {
|
|
349
|
+
const a = t.createdGroupId ?? t.agentExecutionContext.sharedState.createdGroupId?.value;
|
|
350
|
+
return a ? (await m({ text: "Preparing navigation...", agentName: "group-creation" }, e), await R({ destinationType: "portal-group", groupId: a }, e), {}) : {};
|
|
351
|
+
}, at = (t, e) => e ?? t, bt = h.Root({
|
|
352
|
+
...G(),
|
|
334
353
|
// * Shared state between nodes (but not persisted to the agent execution context)
|
|
335
354
|
/** Parameters related to the user's intent for group creation actions */
|
|
336
|
-
intentParams: h({ reducer:
|
|
355
|
+
intentParams: h({ reducer: at, default: () => ({ intent: "clarify" }) }),
|
|
337
356
|
/** The ID of the group that was created
|
|
338
357
|
* even though we already have this in the shared state
|
|
339
358
|
* we still need it here to also share between nodes
|
|
340
359
|
*/
|
|
341
|
-
createdGroupId: h({ reducer:
|
|
342
|
-
}),
|
|
343
|
-
switch (
|
|
360
|
+
createdGroupId: h({ reducer: at, default: () => "" })
|
|
361
|
+
}), Pe = () => new A(bt).addNode("detectGroupCreationIntent", ge).addNode("createPortalGroup", de).addNode("addMembersToPortalGroup", se).addNode("suggestCreatedGroupNavigation", Ge).addEdge(N, "detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent", (e) => {
|
|
362
|
+
switch (e.intentParams.intent) {
|
|
344
363
|
case "create":
|
|
345
364
|
return "createPortalGroup";
|
|
346
365
|
case "addMembers":
|
|
@@ -348,154 +367,154 @@ User message:
|
|
|
348
367
|
default:
|
|
349
368
|
return w;
|
|
350
369
|
}
|
|
351
|
-
}).addEdge("createPortalGroup", "suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup", "suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation", w),
|
|
370
|
+
}).addEdge("createPortalGroup", "suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup", "suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation", w), qe = String.raw`- **portal-group-creation** - Portal group creation assistant:
|
|
352
371
|
- creates a new ArcGIS Portal group for the signed-in user
|
|
353
372
|
- adds users to the newly created group using @mention usernames
|
|
354
|
-
`,
|
|
373
|
+
`, Ee = {
|
|
355
374
|
id: "portal-group-creation",
|
|
356
375
|
name: "Portal Group Creation",
|
|
357
|
-
description:
|
|
358
|
-
createGraph:
|
|
359
|
-
workspace:
|
|
360
|
-
},
|
|
361
|
-
const
|
|
362
|
-
if (!
|
|
363
|
-
return
|
|
364
|
-
const a =
|
|
376
|
+
description: qe,
|
|
377
|
+
createGraph: Pe,
|
|
378
|
+
workspace: bt
|
|
379
|
+
}, It = "portalDocAssistantMemory", ze = () => ({ conversationId: "" }), ke = (t) => {
|
|
380
|
+
const e = t?.[It]?.value;
|
|
381
|
+
if (!e || typeof e != "object")
|
|
382
|
+
return ze();
|
|
383
|
+
const a = e;
|
|
365
384
|
return {
|
|
366
385
|
conversationId: typeof a.conversationId == "string" ? a.conversationId : ""
|
|
367
386
|
};
|
|
368
|
-
},
|
|
369
|
-
[
|
|
370
|
-
}),
|
|
387
|
+
}, $e = (t) => ({
|
|
388
|
+
[It]: { value: t }
|
|
389
|
+
}), De = {
|
|
371
390
|
pipeline: {
|
|
372
391
|
follow_up: { allow: !1 }
|
|
373
392
|
}
|
|
374
393
|
};
|
|
375
|
-
function
|
|
394
|
+
function Re(t) {
|
|
376
395
|
return {
|
|
377
396
|
kind: "DocAIAssistantRequest",
|
|
378
397
|
filters: {
|
|
379
|
-
...
|
|
380
|
-
persona: { persona:
|
|
398
|
+
...De,
|
|
399
|
+
persona: { persona: t }
|
|
381
400
|
}
|
|
382
401
|
};
|
|
383
402
|
}
|
|
384
|
-
async function
|
|
385
|
-
portal:
|
|
386
|
-
question:
|
|
403
|
+
async function Ue({
|
|
404
|
+
portal: t,
|
|
405
|
+
question: e,
|
|
387
406
|
persona: a,
|
|
388
407
|
previousConversationId: n,
|
|
389
|
-
signal:
|
|
390
|
-
skillId:
|
|
408
|
+
signal: o,
|
|
409
|
+
skillId: r
|
|
391
410
|
}) {
|
|
392
|
-
|
|
393
|
-
const
|
|
394
|
-
portal:
|
|
395
|
-
skillId:
|
|
396
|
-
message:
|
|
397
|
-
options: { context:
|
|
411
|
+
r ??= "doc_ai_assistant";
|
|
412
|
+
const c = Re(a), i = await Fe({
|
|
413
|
+
portal: t,
|
|
414
|
+
skillId: r,
|
|
415
|
+
message: e,
|
|
416
|
+
options: { context: c, previousConversationId: n, signal: o }
|
|
398
417
|
});
|
|
399
418
|
return {
|
|
400
|
-
reply:
|
|
419
|
+
reply: Oe(i, r),
|
|
401
420
|
conversationId: i[0]?.conversationId ?? ""
|
|
402
421
|
};
|
|
403
422
|
}
|
|
404
|
-
async function
|
|
405
|
-
portal:
|
|
406
|
-
skillId:
|
|
423
|
+
async function Fe({
|
|
424
|
+
portal: t,
|
|
425
|
+
skillId: e,
|
|
407
426
|
message: a,
|
|
408
427
|
options: n
|
|
409
428
|
}) {
|
|
410
|
-
const
|
|
429
|
+
const r = `${t.helperServices.aiAssistantServices.url}/skills/${e}/chat`, c = {
|
|
411
430
|
"Content-Type": "application/json",
|
|
412
|
-
token:
|
|
413
|
-
}, i = await
|
|
431
|
+
token: Wt.findCredential(t.url)?.token ?? ""
|
|
432
|
+
}, i = await H(r, {
|
|
414
433
|
method: "post",
|
|
415
434
|
body: JSON.stringify({
|
|
416
435
|
message: a,
|
|
417
436
|
context: n.context,
|
|
418
437
|
conversationId: n.previousConversationId
|
|
419
438
|
}),
|
|
420
|
-
headers:
|
|
439
|
+
headers: c,
|
|
421
440
|
signal: n.signal
|
|
422
441
|
});
|
|
423
442
|
if (i.httpStatus !== 200)
|
|
424
443
|
throw new Error(`Doc assistant chat failed (${i.httpStatus})`, {
|
|
425
444
|
cause: i.data
|
|
426
445
|
});
|
|
427
|
-
const l = i.data,
|
|
446
|
+
const l = i.data, u = [l], { conversationId: d, inquiryId: g } = l, p = async (f, y) => {
|
|
428
447
|
if (!y)
|
|
429
448
|
return;
|
|
430
|
-
await
|
|
431
|
-
const
|
|
449
|
+
await Jt(500);
|
|
450
|
+
const S = await H(r, {
|
|
432
451
|
method: "post",
|
|
433
452
|
body: JSON.stringify({ conversationId: d, inquiryId: g, ackSequenceNumber: f }),
|
|
434
|
-
headers:
|
|
453
|
+
headers: c,
|
|
435
454
|
signal: n.signal
|
|
436
455
|
});
|
|
437
|
-
if (
|
|
438
|
-
throw new Error(`Doc assistant poll failed (${
|
|
439
|
-
cause:
|
|
456
|
+
if (S.httpStatus !== 200)
|
|
457
|
+
throw new Error(`Doc assistant poll failed (${S.httpStatus})`, {
|
|
458
|
+
cause: S.data
|
|
440
459
|
});
|
|
441
|
-
const
|
|
442
|
-
|
|
460
|
+
const C = S.data;
|
|
461
|
+
u.push(C), await p(C.sequenceNumber, C.hasMore);
|
|
443
462
|
};
|
|
444
|
-
return l.hasMore && await p(l.sequenceNumber, l.hasMore),
|
|
463
|
+
return l.hasMore && await p(l.sequenceNumber, l.hasMore), u;
|
|
445
464
|
}
|
|
446
|
-
function
|
|
447
|
-
switch (
|
|
465
|
+
function Oe(t, e) {
|
|
466
|
+
switch (e) {
|
|
448
467
|
case "doc_chat":
|
|
449
|
-
return
|
|
468
|
+
return t.find((a) => a.message != null)?.message ?? "";
|
|
450
469
|
case "doc_ai_assistant":
|
|
451
|
-
for (let a =
|
|
452
|
-
const n =
|
|
470
|
+
for (let a = t.length - 1; a >= 0; a -= 1) {
|
|
471
|
+
const n = t[a];
|
|
453
472
|
if (n.context?.kind === "DocAIAssistantContext") {
|
|
454
|
-
const
|
|
455
|
-
if (
|
|
456
|
-
return
|
|
473
|
+
const o = n.context.results?.[0]?.reply;
|
|
474
|
+
if (o)
|
|
475
|
+
return o;
|
|
457
476
|
}
|
|
458
477
|
}
|
|
459
478
|
return "";
|
|
460
479
|
default:
|
|
461
|
-
return
|
|
480
|
+
return D(e);
|
|
462
481
|
}
|
|
463
482
|
}
|
|
464
|
-
const
|
|
465
|
-
await m({ text: "Asking documentation assistant...", agentName: "doc-assistant" },
|
|
466
|
-
const a = I(
|
|
483
|
+
const Le = async (t, e) => {
|
|
484
|
+
await m({ text: "Asking documentation assistant...", agentName: "doc-assistant" }, e);
|
|
485
|
+
const a = I(t.agentExecutionContext.messages).trim();
|
|
467
486
|
if (!a)
|
|
468
487
|
return {
|
|
469
488
|
status: "success",
|
|
470
489
|
outputMessage: "Please share your question and I can help with ArcGIS and Portal documentation."
|
|
471
490
|
};
|
|
472
|
-
const n =
|
|
491
|
+
const n = e?.configurable?.context;
|
|
473
492
|
T(n);
|
|
474
|
-
const
|
|
493
|
+
const o = ke(t.agentExecutionContext.sharedState), { reply: r, conversationId: c } = await Ue({
|
|
475
494
|
portal: n.portal,
|
|
476
495
|
question: a,
|
|
477
|
-
previousConversationId:
|
|
496
|
+
previousConversationId: o.conversationId || void 0,
|
|
478
497
|
skillId: "doc_ai_assistant",
|
|
479
498
|
persona: "doc-online"
|
|
480
499
|
});
|
|
481
500
|
return {
|
|
482
501
|
status: "success",
|
|
483
|
-
outputMessage:
|
|
484
|
-
sharedStatePatch:
|
|
485
|
-
conversationId:
|
|
502
|
+
outputMessage: r.trim() || "I could not retrieve a response from the documentation assistant.",
|
|
503
|
+
sharedStatePatch: $e({
|
|
504
|
+
conversationId: c || o.conversationId
|
|
486
505
|
})
|
|
487
506
|
};
|
|
488
|
-
},
|
|
489
|
-
async ({ groupTitle:
|
|
490
|
-
const a =
|
|
507
|
+
}, St = yt(
|
|
508
|
+
async ({ groupTitle: t }, e) => {
|
|
509
|
+
const a = t.trim();
|
|
491
510
|
if (!a)
|
|
492
511
|
return null;
|
|
493
|
-
const n =
|
|
512
|
+
const n = e?.configurable?.context;
|
|
494
513
|
T(n);
|
|
495
514
|
try {
|
|
496
|
-
return (await
|
|
497
|
-
} catch (
|
|
498
|
-
return console.error("Error searching for portal group by title:",
|
|
515
|
+
return (await Qt(n.portal, { query: `title:${a}`, num: 1 }))?.results[0]?.id || null;
|
|
516
|
+
} catch (o) {
|
|
517
|
+
return console.error("Error searching for portal group by title:", o), null;
|
|
499
518
|
}
|
|
500
519
|
},
|
|
501
520
|
{
|
|
@@ -505,15 +524,15 @@ const Ft = async (e, t) => {
|
|
|
505
524
|
groupTitle: s.string().describe("The portal group title to resolve to a group id.")
|
|
506
525
|
})
|
|
507
526
|
}
|
|
508
|
-
),
|
|
509
|
-
async ({ itemTitle:
|
|
510
|
-
const a =
|
|
527
|
+
), xt = yt(
|
|
528
|
+
async ({ itemTitle: t }, e) => {
|
|
529
|
+
const a = t.trim();
|
|
511
530
|
if (!a)
|
|
512
531
|
return null;
|
|
513
|
-
const n =
|
|
532
|
+
const n = e?.configurable?.context;
|
|
514
533
|
T(n);
|
|
515
|
-
const { result:
|
|
516
|
-
return
|
|
534
|
+
const { result: o, error: r } = await _t(n.portal, a, { num: 1 });
|
|
535
|
+
return r && console.error("Error searching for portal item by title:", r), o?.results[0]?.id || null;
|
|
517
536
|
},
|
|
518
537
|
{
|
|
519
538
|
name: "resolvePortalItemIdByTitle",
|
|
@@ -523,86 +542,174 @@ const Ft = async (e, t) => {
|
|
|
523
542
|
})
|
|
524
543
|
}
|
|
525
544
|
);
|
|
526
|
-
function
|
|
527
|
-
const a =
|
|
545
|
+
function M(t, e = "#") {
|
|
546
|
+
const a = t.match(new RegExp(`\\${e}"([^"]+)"`, "u"));
|
|
528
547
|
if (a?.[1])
|
|
529
548
|
return a[1].trim();
|
|
530
|
-
const n =
|
|
549
|
+
const n = t.match(new RegExp(`\\${e}([^\\s"']+)`, "u"));
|
|
531
550
|
return n?.[1] ? n[1].trim() : null;
|
|
532
551
|
}
|
|
533
|
-
|
|
552
|
+
function je(t) {
|
|
553
|
+
const e = B(t).flatMap((a) => {
|
|
554
|
+
const n = a, o = t[a], r = [
|
|
555
|
+
n,
|
|
556
|
+
{
|
|
557
|
+
description: o.description,
|
|
558
|
+
hints: o.hints
|
|
559
|
+
}
|
|
560
|
+
], c = o.sections ? B(o.sections).map((i) => {
|
|
561
|
+
const l = o.sections?.[i];
|
|
562
|
+
return [`${n}-${i}`, l];
|
|
563
|
+
}) : [];
|
|
564
|
+
return [r, ...c];
|
|
565
|
+
});
|
|
566
|
+
return Object.fromEntries(e);
|
|
567
|
+
}
|
|
568
|
+
function Ve(t) {
|
|
569
|
+
return Object.entries(t).map(([e, { description: a, hints: n }]) => ` - ${e}: ${a} (hints: ${n.join(", ")})`).join(`
|
|
570
|
+
`);
|
|
571
|
+
}
|
|
572
|
+
const Be = {
|
|
573
|
+
// Example prompt: "Take me to my content"
|
|
534
574
|
"portal-content": {
|
|
535
575
|
description: "The main content page of the portal.",
|
|
536
576
|
hints: ["My content", "Content"]
|
|
537
577
|
},
|
|
578
|
+
// Example prompt: "Show my content favorites"
|
|
538
579
|
"portal-content-favorites": {
|
|
539
580
|
description: "The Favorites view under Content in the portal.",
|
|
540
581
|
hints: ["My favorites", "Favorites", "Content favorites"]
|
|
541
582
|
},
|
|
583
|
+
// Example prompt: "Open group content"
|
|
542
584
|
"portal-content-group": {
|
|
543
585
|
description: "The Groups view under Content in the portal.",
|
|
544
586
|
hints: ["Content groups", "Group content", "My groups content"]
|
|
545
587
|
},
|
|
588
|
+
// Example prompt: "Browse Living Atlas content"
|
|
546
589
|
"portal-content-living-atlas": {
|
|
547
590
|
description: "The Living Atlas view under Content in the portal.",
|
|
548
591
|
hints: ["Living Atlas", "Content living atlas"]
|
|
549
592
|
},
|
|
593
|
+
// Example prompt: "Show my organization's content"
|
|
550
594
|
"portal-content-organization": {
|
|
551
595
|
description: "The Organization view under Content in the portal.",
|
|
552
596
|
hints: ["Organization content", "Content organization", "My organization content"]
|
|
553
597
|
},
|
|
598
|
+
// Example prompt: "Open the gallery"
|
|
554
599
|
"portal-gallery": {
|
|
555
600
|
description: "The gallery page of the portal.",
|
|
556
601
|
hints: ["Gallery", "Featured content", "Maps and apps"]
|
|
557
602
|
},
|
|
603
|
+
// Example prompt: "Go to the group called #Urban Planning"
|
|
558
604
|
"portal-group": {
|
|
559
605
|
description: "A specific group page in the portal.",
|
|
560
606
|
hints: ["Group", "group page"]
|
|
561
607
|
},
|
|
608
|
+
// Example prompt: "Browse groups"
|
|
562
609
|
"portal-groups": {
|
|
563
610
|
description: "The groups listing page of the portal.",
|
|
564
611
|
hints: ["Groups", "Browse groups"]
|
|
565
612
|
},
|
|
613
|
+
// Example prompt: "Show featured groups"
|
|
566
614
|
"portal-groups-featured": {
|
|
567
615
|
description: "The Featured groups view under Groups in the portal.",
|
|
568
616
|
hints: ["Featured groups", "Groups featured"]
|
|
569
617
|
},
|
|
618
|
+
// Example prompt: "Show my groups"
|
|
570
619
|
"portal-groups-my": {
|
|
571
620
|
description: "The My groups view under Groups in the portal.",
|
|
572
621
|
hints: ["My groups", "Groups my"]
|
|
573
622
|
},
|
|
623
|
+
// Example prompt: "Show organization groups"
|
|
574
624
|
"portal-groups-organization": {
|
|
575
625
|
description: "The Organization groups view under Groups in the portal.",
|
|
576
626
|
hints: ["Organization groups", "Groups organization", "My organization groups"]
|
|
577
627
|
},
|
|
628
|
+
// Example prompt: "Open item #Road Closures Map"
|
|
578
629
|
"portal-item": {
|
|
579
630
|
description: "A specific item page in the portal.",
|
|
580
631
|
hints: ["Item", "item page"]
|
|
581
632
|
},
|
|
633
|
+
// Example prompt: "Open Map Viewer"
|
|
582
634
|
"portal-map-viewer": {
|
|
583
635
|
description: "The Map Viewer app of the portal.",
|
|
584
636
|
hints: ["Map Viewer", "Map", "Open map"]
|
|
585
637
|
},
|
|
638
|
+
// Example prompt: "Take me to notebooks"
|
|
586
639
|
"portal-notebooks": {
|
|
587
640
|
description: "The Notebooks home page of the portal.",
|
|
588
641
|
hints: ["Notebooks", "Notebook home", "My notebooks"]
|
|
589
642
|
},
|
|
643
|
+
// Example prompt: "Open Scene Viewer"
|
|
590
644
|
"portal-scene-viewer": {
|
|
591
645
|
description: "The Scene Viewer app of the portal.",
|
|
592
646
|
hints: ["Scene Viewer", "Scene", "3D scene"]
|
|
593
647
|
},
|
|
648
|
+
// Example prompt: "Open organization security settings"
|
|
594
649
|
"portal-org-security": {
|
|
595
650
|
description: "The Organization > Settings > Security page of the portal.",
|
|
596
|
-
hints: ["Organization settings", "Security", "Organization > Settings > Security"]
|
|
651
|
+
hints: ["Organization settings", "Security", "Organization > Settings > Security"],
|
|
652
|
+
sections: {
|
|
653
|
+
// Example prompt: "How do I set up custom sign in?"
|
|
654
|
+
"custom-sign-in": {
|
|
655
|
+
description: "The Organization > Settings > Security > Custom Sign In section of the portal.",
|
|
656
|
+
hints: ["Custom Sign In", "Organization > Settings > Security > Custom Sign In"]
|
|
657
|
+
},
|
|
658
|
+
// Example prompt: "How do I configure login options?"
|
|
659
|
+
logins: {
|
|
660
|
+
description: "The Organization > Settings > Security > Logins section of the portal.",
|
|
661
|
+
hints: ["Logins", "Organization > Settings > Security > Logins"]
|
|
662
|
+
},
|
|
663
|
+
// Example prompt: "How do I change our login provider?"
|
|
664
|
+
"change-login-provider": {
|
|
665
|
+
description: "The Organization > Settings > Security > Change Login Provider section of the portal.",
|
|
666
|
+
hints: ["Change Login Provider", "Organization > Settings > Security > Change Login Provider"]
|
|
667
|
+
},
|
|
668
|
+
// Example prompt: "How do I configure MFA?"
|
|
669
|
+
"multifactor-auth": {
|
|
670
|
+
description: "The Organization > Settings > Security > Multifactor Authentication section of the portal.",
|
|
671
|
+
hints: ["MFA", "Multifactor Authentication", "Organization > Settings > Security > MFA"]
|
|
672
|
+
},
|
|
673
|
+
// Example prompt: "How do I configure Enforce MFA?"
|
|
674
|
+
"multifactor-enforcement": {
|
|
675
|
+
description: "The Organization > Settings > Security > Enforce MFA section of the portal.",
|
|
676
|
+
hints: ["Enforce MFA", "MFA enforcement", "Organization > Settings > Security > Enforce MFA"]
|
|
677
|
+
},
|
|
678
|
+
// Example prompt: "How do I set designated admins for MFA?"
|
|
679
|
+
"multifactor-designated-admins": {
|
|
680
|
+
description: "The Organization > Settings > Security > Designated Admins section of the portal.",
|
|
681
|
+
hints: ["Designated admins", "MFA designated admins", "Organization > Settings > Security > Designated Admins"]
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
},
|
|
685
|
+
// Example prompt: "I want to add a new item"
|
|
686
|
+
"portal-content-new-item": {
|
|
687
|
+
description: "The Content page with the New Item flow opened.",
|
|
688
|
+
hints: ["New item", "Create new item", "Content > My Content > New Item"],
|
|
689
|
+
sections: {
|
|
690
|
+
// Example prompt: "Create a new feature layer"
|
|
691
|
+
"feature-layer": {
|
|
692
|
+
description: "The Content page with New Item flow set to Feature Layer as the starting step.",
|
|
693
|
+
hints: ["Feature Layer", "New Feature Layer", "Content > My Content > New Item > Feature Layer"]
|
|
694
|
+
},
|
|
695
|
+
// Example prompt: "Create developer credentials"
|
|
696
|
+
"developer-credentials": {
|
|
697
|
+
description: "The Content page with New Item flow set to Developer Credentials as the starting step.",
|
|
698
|
+
hints: [
|
|
699
|
+
"Developer Credentials",
|
|
700
|
+
"New developer credentials",
|
|
701
|
+
"Content > My Content > New Item > Developer Credentials"
|
|
702
|
+
]
|
|
703
|
+
}
|
|
704
|
+
}
|
|
597
705
|
}
|
|
598
|
-
},
|
|
599
|
-
`), Vt = `
|
|
706
|
+
}, Tt = je(Be), Ke = B(Tt), Qe = Ve(Tt), We = `
|
|
600
707
|
You decide whether the assistant response should include a navigation action to ArcGIS Portal.
|
|
601
708
|
|
|
602
709
|
Given the user question and assistant response:
|
|
603
710
|
- Decide if a navigation action would help the user complete the task.
|
|
604
711
|
- If yes, choose one destinationType:
|
|
605
|
-
${
|
|
712
|
+
${Qe}
|
|
606
713
|
|
|
607
714
|
Rules:
|
|
608
715
|
- Only suggest navigation when you are highly confident the destination will help complete the user's task.
|
|
@@ -625,98 +732,144 @@ User question:
|
|
|
625
732
|
|
|
626
733
|
Assistant response:
|
|
627
734
|
{response}
|
|
628
|
-
`,
|
|
735
|
+
`, nt = s.object({
|
|
629
736
|
shouldSuggestNavigation: s.boolean().default(!1),
|
|
630
|
-
destinationType: s.enum(["none", ...
|
|
737
|
+
destinationType: s.enum(["none", ...Ke]).default("none"),
|
|
631
738
|
itemId: s.string().default(""),
|
|
632
739
|
groupId: s.string().default(""),
|
|
633
740
|
confidence: s.number().min(0).max(1).default(0)
|
|
634
|
-
}),
|
|
635
|
-
await m({ text: "Extracting navigation intent...", agentName: "doc-assistant" },
|
|
636
|
-
const a =
|
|
741
|
+
}), Je = async (t, e) => {
|
|
742
|
+
await m({ text: "Extracting navigation intent...", agentName: "doc-assistant" }, e);
|
|
743
|
+
const a = t.outputMessage.trim();
|
|
637
744
|
if (!a)
|
|
638
745
|
return {};
|
|
639
|
-
const n = I(
|
|
746
|
+
const n = I(t.agentExecutionContext.messages).trim(), o = await J.fromTemplate(We).format({
|
|
640
747
|
question: n,
|
|
641
748
|
response: a
|
|
642
|
-
}),
|
|
749
|
+
}), c = (await W({ modelTier: "fast" })).withStructuredOutput(nt), i = nt.parse(await c.invoke(o));
|
|
643
750
|
if (!i.shouldSuggestNavigation || i.destinationType === "none")
|
|
644
751
|
return {};
|
|
645
752
|
if (i.destinationType === "portal-item" && !i.itemId) {
|
|
646
|
-
const
|
|
647
|
-
|
|
753
|
+
const u = M(n, "#");
|
|
754
|
+
u && (i.itemId = await xt.invoke({ itemTitle: u }, e) ?? "");
|
|
648
755
|
}
|
|
649
756
|
if (i.destinationType === "portal-group" && !i.groupId) {
|
|
650
|
-
const
|
|
651
|
-
|
|
757
|
+
const u = M(n, "$") ?? M(n, "#");
|
|
758
|
+
u && (i.groupId = await St.invoke({ groupTitle: u }, e) ?? "");
|
|
652
759
|
}
|
|
653
|
-
const l =
|
|
654
|
-
return l ? (await
|
|
760
|
+
const l = _e(i);
|
|
761
|
+
return l ? (await R(l, e), {}) : {};
|
|
655
762
|
};
|
|
656
|
-
function
|
|
657
|
-
destinationType:
|
|
658
|
-
itemId:
|
|
763
|
+
function _e({
|
|
764
|
+
destinationType: t,
|
|
765
|
+
itemId: e,
|
|
659
766
|
groupId: a
|
|
660
767
|
}) {
|
|
661
|
-
switch (
|
|
768
|
+
switch (t) {
|
|
662
769
|
case "portal-content":
|
|
663
770
|
case "portal-gallery":
|
|
664
771
|
case "portal-groups":
|
|
665
772
|
case "portal-map-viewer":
|
|
666
773
|
case "portal-notebooks":
|
|
667
774
|
case "portal-scene-viewer":
|
|
668
|
-
return { destinationType:
|
|
775
|
+
return { destinationType: t };
|
|
669
776
|
case "portal-org-security":
|
|
670
|
-
return {
|
|
777
|
+
return {
|
|
778
|
+
destinationType: "portal-org",
|
|
779
|
+
hash: "settings",
|
|
780
|
+
queryParams: {
|
|
781
|
+
tab: "security"
|
|
782
|
+
}
|
|
783
|
+
};
|
|
784
|
+
case "portal-content-new-item":
|
|
785
|
+
case "portal-content-new-item-feature-layer":
|
|
786
|
+
case "portal-content-new-item-developer-credentials":
|
|
787
|
+
return {
|
|
788
|
+
queryParams: {
|
|
789
|
+
newItem: Ye[t]
|
|
790
|
+
},
|
|
791
|
+
destinationType: "portal-content"
|
|
792
|
+
};
|
|
671
793
|
case "portal-content-favorites":
|
|
672
|
-
return { destinationType: "portal-content", hash: "favorites" };
|
|
673
794
|
case "portal-content-group":
|
|
674
|
-
return { destinationType: "portal-content", hash: "group" };
|
|
675
795
|
case "portal-content-living-atlas":
|
|
676
|
-
return { destinationType: "portal-content", hash: "living-atlas" };
|
|
677
796
|
case "portal-content-organization":
|
|
678
|
-
return { destinationType: "portal-content", hash:
|
|
797
|
+
return { destinationType: "portal-content", hash: He[t] };
|
|
679
798
|
case "portal-groups-featured":
|
|
680
|
-
return { destinationType: "portal-groups", hash: "featured" };
|
|
681
799
|
case "portal-groups-my":
|
|
682
|
-
return { destinationType: "portal-groups", hash: "my" };
|
|
683
800
|
case "portal-groups-organization":
|
|
684
|
-
return { destinationType: "portal-groups", hash:
|
|
801
|
+
return { destinationType: "portal-groups", hash: Xe[t] };
|
|
802
|
+
case "portal-org-security-custom-sign-in":
|
|
803
|
+
case "portal-org-security-logins":
|
|
804
|
+
case "portal-org-security-change-login-provider":
|
|
805
|
+
case "portal-org-security-multifactor-auth":
|
|
806
|
+
case "portal-org-security-multifactor-enforcement":
|
|
807
|
+
case "portal-org-security-multifactor-designated-admins":
|
|
808
|
+
const n = Ze[t];
|
|
809
|
+
return {
|
|
810
|
+
destinationType: "portal-org",
|
|
811
|
+
hash: "settings",
|
|
812
|
+
queryParams: {
|
|
813
|
+
tab: "security",
|
|
814
|
+
section: we[n],
|
|
815
|
+
subsection: n
|
|
816
|
+
}
|
|
817
|
+
};
|
|
685
818
|
case "portal-item":
|
|
686
|
-
return
|
|
819
|
+
return e ? { destinationType: t, itemId: e } : null;
|
|
687
820
|
case "portal-group":
|
|
688
|
-
return a ? { destinationType:
|
|
821
|
+
return a ? { destinationType: t, groupId: a } : null;
|
|
689
822
|
case "none":
|
|
690
823
|
return null;
|
|
691
824
|
default:
|
|
692
|
-
return
|
|
825
|
+
return D(t);
|
|
693
826
|
}
|
|
694
827
|
}
|
|
695
|
-
const
|
|
696
|
-
|
|
697
|
-
|
|
828
|
+
const Ye = {
|
|
829
|
+
"portal-content-new-item": "newItem",
|
|
830
|
+
"portal-content-new-item-feature-layer": "createLayer",
|
|
831
|
+
"portal-content-new-item-developer-credentials": "developerCredentials"
|
|
832
|
+
}, He = {
|
|
833
|
+
"portal-content-favorites": "favorites",
|
|
834
|
+
"portal-content-group": "group",
|
|
835
|
+
"portal-content-living-atlas": "living-atlas",
|
|
836
|
+
"portal-content-organization": "org"
|
|
837
|
+
}, Xe = {
|
|
838
|
+
"portal-groups-featured": "featured",
|
|
839
|
+
"portal-groups-my": "my",
|
|
840
|
+
"portal-groups-organization": "organization"
|
|
841
|
+
}, Ze = {
|
|
842
|
+
"portal-org-security-custom-sign-in": "customSignInSection",
|
|
843
|
+
"portal-org-security-logins": "loginsSection",
|
|
844
|
+
"portal-org-security-change-login-provider": "changeLoginProviderSection",
|
|
845
|
+
"portal-org-security-multifactor-auth": "multiFactorAuthSection",
|
|
846
|
+
"portal-org-security-multifactor-enforcement": "multifactorEnforcementSection",
|
|
847
|
+
"portal-org-security-multifactor-designated-admins": "multifactorDesignatedAdminsSection"
|
|
848
|
+
}, Ct = h.Root({
|
|
849
|
+
...G()
|
|
850
|
+
}), ta = () => new A(Ct).addNode("answerDocQuestion", Le).addNode("extractNavigationIntent", Je).addEdge(N, "answerDocQuestion").addEdge("answerDocQuestion", "extractNavigationIntent").addEdge("extractNavigationIntent", w), ea = String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
|
|
698
851
|
- answers general ArcGIS, Portal, Enterprise, and JavaScript SDK questions
|
|
699
852
|
- acts as a fallback when specialized agents are not applicable
|
|
700
|
-
`,
|
|
853
|
+
`, aa = {
|
|
701
854
|
id: "portal-doc-assistant",
|
|
702
855
|
name: "Portal Doc Assistant",
|
|
703
|
-
description:
|
|
704
|
-
createGraph:
|
|
705
|
-
workspace:
|
|
706
|
-
},
|
|
707
|
-
const
|
|
708
|
-
return
|
|
709
|
-
},
|
|
856
|
+
description: ea,
|
|
857
|
+
createGraph: ta,
|
|
858
|
+
workspace: Ct
|
|
859
|
+
}, na = () => ({ latestGroupId: null, memory: {} }), U = (t) => {
|
|
860
|
+
const e = t?.agentExecutionContext.sharedState.portalGroupSummaryMemory?.value;
|
|
861
|
+
return e ? { latestGroupId: e.latestGroupId, memory: e.memory } : na();
|
|
862
|
+
}, Mt = `
|
|
710
863
|
Shared markdown formatting rules:
|
|
711
864
|
- Use clear markdown headings (##) to separate sections.
|
|
712
865
|
- Use concise bullet points for lists of facts, counts, or signals.
|
|
713
866
|
- Emphasize key metrics with bold labels (for example: **Recent items:** 4).
|
|
714
867
|
- Keep wording direct and analytical; avoid filler language but make sure the language is friendly.
|
|
715
868
|
- Do not include raw internal IDs unless explicitly requested.
|
|
716
|
-
`,
|
|
869
|
+
`, oa = `
|
|
717
870
|
You answer follow-up questions about ArcGIS group analytics.
|
|
718
871
|
|
|
719
|
-
${
|
|
872
|
+
${Mt}
|
|
720
873
|
|
|
721
874
|
Ground your answer in the provided group analytics summary and context.
|
|
722
875
|
If the answer is not available from the provided context, state that clearly and suggest what to check next.
|
|
@@ -738,29 +891,29 @@ Group full context:
|
|
|
738
891
|
|
|
739
892
|
Question:
|
|
740
893
|
{question}
|
|
741
|
-
`,
|
|
742
|
-
await m({ text: "Answering group follow-up...", agentName: "group-analytics" },
|
|
743
|
-
const a = U(
|
|
744
|
-
return
|
|
894
|
+
`, ra = async (t, e) => {
|
|
895
|
+
await m({ text: "Answering group follow-up...", agentName: "group-analytics" }, e);
|
|
896
|
+
const a = U(t), n = t.groupSummaryGroupId ?? a.latestGroupId, o = n ? a.memory[n] : void 0, r = t.groupSummaryQuestion || I(t.agentExecutionContext.messages);
|
|
897
|
+
return o ? {
|
|
745
898
|
status: "success",
|
|
746
|
-
outputMessage: (await
|
|
747
|
-
promptText:
|
|
748
|
-
schema:
|
|
899
|
+
outputMessage: (await b({
|
|
900
|
+
promptText: oa,
|
|
901
|
+
schema: sa,
|
|
749
902
|
modelTier: "default",
|
|
750
903
|
inputVariables: {
|
|
751
|
-
summary:
|
|
752
|
-
question:
|
|
753
|
-
fullContext: JSON.stringify(
|
|
904
|
+
summary: o.summary,
|
|
905
|
+
question: r,
|
|
906
|
+
fullContext: JSON.stringify(o.fullContext)
|
|
754
907
|
}
|
|
755
908
|
})).answer
|
|
756
909
|
} : {
|
|
757
910
|
status: "success",
|
|
758
911
|
outputMessage: "I do not have group analytics context yet. Ask me to analyze a group first with analyze group <group id>."
|
|
759
912
|
};
|
|
760
|
-
},
|
|
913
|
+
}, sa = s.object({
|
|
761
914
|
answer: s.string(),
|
|
762
915
|
isRelevant: s.boolean()
|
|
763
|
-
}),
|
|
916
|
+
}), ia = `
|
|
764
917
|
Classify the user's request for ArcGIS Portal group analytics.
|
|
765
918
|
|
|
766
919
|
Rules:
|
|
@@ -789,121 +942,121 @@ hasAnalyticsContext:
|
|
|
789
942
|
|
|
790
943
|
User message:
|
|
791
944
|
{userMessage}
|
|
792
|
-
`,
|
|
793
|
-
await m({ text: "Analyzing group-analytics intent...", agentName: "group-analytics" },
|
|
794
|
-
const a = I(
|
|
945
|
+
`, ca = async (t, e) => {
|
|
946
|
+
await m({ text: "Analyzing group-analytics intent...", agentName: "group-analytics" }, e);
|
|
947
|
+
const a = I(t.agentExecutionContext.messages), n = !!U(t).latestGroupId, o = await J.fromTemplate(ia).format({
|
|
795
948
|
userMessage: a,
|
|
796
949
|
hasAnalyticsContext: String(n)
|
|
797
|
-
}),
|
|
950
|
+
}), c = (await W({ modelTier: "fast" })).withStructuredOutput(ot), i = ot.parse(await c.invoke(o));
|
|
798
951
|
let l = i.groupId;
|
|
799
952
|
if ((i.intent === "summarize" || i.intent === "navigation") && !l) {
|
|
800
|
-
const y =
|
|
801
|
-
y && (l = await
|
|
953
|
+
const y = M(a, "$");
|
|
954
|
+
y && (l = await St.invoke({ groupTitle: y }, e) ?? "");
|
|
802
955
|
}
|
|
803
|
-
const { intent:
|
|
956
|
+
const { intent: u, question: d } = i, g = u === "summarize" && !l, p = u === "followUp" && !(d ?? "").trim(), f = u === "clarify" || g || p;
|
|
804
957
|
return {
|
|
805
|
-
groupSummaryIntent: f ? "clarify" :
|
|
958
|
+
groupSummaryIntent: f ? "clarify" : u,
|
|
806
959
|
groupSummaryGroupId: l || null,
|
|
807
960
|
groupSummaryQuestion: d || "",
|
|
808
961
|
status: "success",
|
|
809
962
|
outputMessage: f ? "Please clarify with a group id or title" : ""
|
|
810
963
|
};
|
|
811
|
-
},
|
|
964
|
+
}, ot = s.object({
|
|
812
965
|
intent: s.enum(["summarize", "followUp", "navigation", "clarify"]),
|
|
813
966
|
groupId: s.string().default(""),
|
|
814
967
|
question: s.string().default("")
|
|
815
|
-
}),
|
|
816
|
-
const a = U(
|
|
817
|
-
return await m({ text: "Preparing navigation...", agentName: "group-analytics" },
|
|
968
|
+
}), ua = async (t, e) => {
|
|
969
|
+
const a = U(t), n = t.groupSummaryGroupId ?? a.latestGroupId;
|
|
970
|
+
return await m({ text: "Preparing navigation...", agentName: "group-analytics" }, e), await R(
|
|
818
971
|
n ? { destinationType: "portal-group", groupId: n } : { destinationType: "portal-groups" },
|
|
819
|
-
|
|
972
|
+
e
|
|
820
973
|
), { status: "success" };
|
|
821
974
|
};
|
|
822
|
-
function
|
|
823
|
-
return
|
|
975
|
+
function At({ timestamp: t, now: e, windowMs: a }) {
|
|
976
|
+
return t ? e - t <= a : !1;
|
|
824
977
|
}
|
|
825
|
-
const
|
|
826
|
-
function
|
|
827
|
-
const
|
|
978
|
+
const la = 720 * 60 * 60 * 1e3;
|
|
979
|
+
function da(t) {
|
|
980
|
+
const e = Ht(t);
|
|
828
981
|
return {
|
|
829
|
-
id:
|
|
830
|
-
title:
|
|
831
|
-
description:
|
|
832
|
-
snippet:
|
|
833
|
-
access:
|
|
834
|
-
owner:
|
|
835
|
-
tags:
|
|
836
|
-
created:
|
|
837
|
-
modified:
|
|
838
|
-
isInvitationOnly:
|
|
982
|
+
id: t.id ?? "",
|
|
983
|
+
title: t.title ?? "",
|
|
984
|
+
description: t.description ?? "",
|
|
985
|
+
snippet: t.snippet ?? "",
|
|
986
|
+
access: t.access ?? null,
|
|
987
|
+
owner: t.owner ?? "",
|
|
988
|
+
tags: t.tags ?? [],
|
|
989
|
+
created: t.created?.getTime(),
|
|
990
|
+
modified: t.modified?.getTime(),
|
|
991
|
+
isInvitationOnly: t.isInvitationOnly,
|
|
839
992
|
sourceSignals: {
|
|
840
|
-
capabilities:
|
|
841
|
-
membershipAccess:
|
|
842
|
-
isOpenData:
|
|
843
|
-
isDistributedCollaborationGroup:
|
|
844
|
-
orgId:
|
|
845
|
-
hiddenMembers:
|
|
846
|
-
isViewOnly:
|
|
847
|
-
isReadOnly:
|
|
848
|
-
leavingDisallowed:
|
|
993
|
+
capabilities: ee(t),
|
|
994
|
+
membershipAccess: te(t),
|
|
995
|
+
isOpenData: Zt(t),
|
|
996
|
+
isDistributedCollaborationGroup: Xt(t),
|
|
997
|
+
orgId: e.orgId,
|
|
998
|
+
hiddenMembers: e.hiddenMembers,
|
|
999
|
+
isViewOnly: e.isViewOnly,
|
|
1000
|
+
isReadOnly: e.isReadOnly,
|
|
1001
|
+
leavingDisallowed: e.leavingDisallowed
|
|
849
1002
|
}
|
|
850
1003
|
};
|
|
851
1004
|
}
|
|
852
|
-
async function
|
|
853
|
-
const
|
|
1005
|
+
async function pa(t) {
|
|
1006
|
+
const e = { owner: t.owner ?? "", admins: [], users: [] };
|
|
854
1007
|
try {
|
|
855
|
-
return await
|
|
1008
|
+
return await t.fetchMembers();
|
|
856
1009
|
} catch (a) {
|
|
857
|
-
return console.warn("Unable to fetch group members for analytics context", a),
|
|
1010
|
+
return console.warn("Unable to fetch group members for analytics context", a), e;
|
|
858
1011
|
}
|
|
859
1012
|
}
|
|
860
|
-
function
|
|
861
|
-
return
|
|
862
|
-
id:
|
|
863
|
-
title:
|
|
864
|
-
type:
|
|
865
|
-
owner:
|
|
866
|
-
created:
|
|
867
|
-
modified:
|
|
1013
|
+
function ma(t) {
|
|
1014
|
+
return t.map((e) => ({
|
|
1015
|
+
id: e.id ?? "",
|
|
1016
|
+
title: e.title ?? "Untitled",
|
|
1017
|
+
type: e.type ?? "Unknown",
|
|
1018
|
+
owner: e.owner ?? "",
|
|
1019
|
+
created: e.created?.getTime(),
|
|
1020
|
+
modified: e.modified?.getTime()
|
|
868
1021
|
}));
|
|
869
1022
|
}
|
|
870
|
-
function
|
|
871
|
-
return
|
|
872
|
-
(a) => a.modified ?
|
|
1023
|
+
function ga(t, e) {
|
|
1024
|
+
return t.filter(
|
|
1025
|
+
(a) => a.modified ? At({ timestamp: a.modified, now: e, windowMs: la }) : !1
|
|
873
1026
|
);
|
|
874
1027
|
}
|
|
875
|
-
function
|
|
876
|
-
const
|
|
877
|
-
for (const a of
|
|
878
|
-
|
|
879
|
-
return [...
|
|
1028
|
+
function ha(t) {
|
|
1029
|
+
const e = /* @__PURE__ */ new Map();
|
|
1030
|
+
for (const a of t)
|
|
1031
|
+
e.set(a.type, (e.get(a.type) ?? 0) + 1);
|
|
1032
|
+
return [...e.entries()].sort((a, n) => n[1] - a[1] || a[0].localeCompare(n[0])).slice(0, 6).map(([a, n]) => ({ type: a, count: n }));
|
|
880
1033
|
}
|
|
881
|
-
async function
|
|
882
|
-
const
|
|
1034
|
+
async function fa(t) {
|
|
1035
|
+
const e = await t.queryItems({ num: 20, sortField: "modified", sortOrder: "desc" }), a = ma(e.results), n = Date.now();
|
|
883
1036
|
return {
|
|
884
|
-
total:
|
|
1037
|
+
total: e.total,
|
|
885
1038
|
topItems: a,
|
|
886
|
-
recentlyModifiedItems:
|
|
887
|
-
topItemTypes:
|
|
1039
|
+
recentlyModifiedItems: ga(a, n),
|
|
1040
|
+
topItemTypes: ha(a)
|
|
888
1041
|
};
|
|
889
1042
|
}
|
|
890
|
-
async function
|
|
891
|
-
if (!
|
|
1043
|
+
async function ya(t, e) {
|
|
1044
|
+
if (!e)
|
|
892
1045
|
return { error: { code: "missingGroupId", message: "Group id is required." } };
|
|
893
1046
|
try {
|
|
894
|
-
const n = (await
|
|
1047
|
+
const n = (await t.queryGroups({ query: `id:${e}`, num: 1 })).results[0];
|
|
895
1048
|
if (!n)
|
|
896
|
-
return { error: { code: "groupNotFound", message: `No group found for id: ${
|
|
897
|
-
const
|
|
898
|
-
return { result: { group:
|
|
1049
|
+
return { error: { code: "groupNotFound", message: `No group found for id: ${e}` } };
|
|
1050
|
+
const o = da(n), r = await pa(n), c = await fa(n);
|
|
1051
|
+
return { result: { group: o, members: r, items: c } };
|
|
899
1052
|
} catch (a) {
|
|
900
1053
|
return console.error("Error fetching portal group analytics context:", a), { error: { code: "unhandledError" } };
|
|
901
1054
|
}
|
|
902
1055
|
}
|
|
903
|
-
const
|
|
1056
|
+
const wa = `
|
|
904
1057
|
You summarize ArcGIS Portal groups based on structured context and deterministic activity signals.
|
|
905
1058
|
|
|
906
|
-
${
|
|
1059
|
+
${Mt}
|
|
907
1060
|
|
|
908
1061
|
Output format requirements:
|
|
909
1062
|
- Return concise markdown with clear sections in this order:
|
|
@@ -939,28 +1092,28 @@ Group context:
|
|
|
939
1092
|
|
|
940
1093
|
Deterministic signals:
|
|
941
1094
|
{deterministicSignals}
|
|
942
|
-
`,
|
|
943
|
-
const a =
|
|
1095
|
+
`, va = 2160 * 60 * 60 * 1e3, ba = async (t, e) => {
|
|
1096
|
+
const a = t.groupSummaryGroupId;
|
|
944
1097
|
if (!a)
|
|
945
1098
|
return {
|
|
946
1099
|
status: "success",
|
|
947
1100
|
outputMessage: 'Please clarify with analyze group <group id>, analyze group $<title>, or analyze group $"<title with spaces>".'
|
|
948
1101
|
};
|
|
949
|
-
await m({ text: `Analyzing group ${a}...`, agentName: "group-analytics" },
|
|
950
|
-
const n =
|
|
1102
|
+
await m({ text: `Analyzing group ${a}...`, agentName: "group-analytics" }, e);
|
|
1103
|
+
const n = e?.configurable?.context;
|
|
951
1104
|
T(n);
|
|
952
|
-
const { result:
|
|
953
|
-
if (
|
|
954
|
-
return await m({ text: "Failed to fetch group context", agentName: "group-analytics" },
|
|
1105
|
+
const { result: o, error: r } = await ya(n.portal, a);
|
|
1106
|
+
if (r || !o)
|
|
1107
|
+
return await m({ text: "Failed to fetch group context", agentName: "group-analytics" }, e), {
|
|
955
1108
|
status: "success",
|
|
956
1109
|
outputMessage: "Unable to retrieve group context for analytics."
|
|
957
1110
|
};
|
|
958
|
-
const { group:
|
|
959
|
-
promptText:
|
|
960
|
-
schema:
|
|
1111
|
+
const { group: c, items: i } = o, l = Date.now(), u = c.modified, d = u ? At({ timestamp: u, now: l, windowMs: va }) : !1, g = i.recentlyModifiedItems.length, p = g > 0, f = d || p, y = await b({
|
|
1112
|
+
promptText: wa,
|
|
1113
|
+
schema: Ia,
|
|
961
1114
|
modelTier: "default",
|
|
962
1115
|
inputVariables: {
|
|
963
|
-
context: JSON.stringify(
|
|
1116
|
+
context: JSON.stringify(o),
|
|
964
1117
|
deterministicSignals: JSON.stringify({
|
|
965
1118
|
isGroupActive: f,
|
|
966
1119
|
isGroupRecentlyModified: d,
|
|
@@ -968,23 +1121,23 @@ Deterministic signals:
|
|
|
968
1121
|
recentItemCount: g
|
|
969
1122
|
})
|
|
970
1123
|
}
|
|
971
|
-
}), { followUpQuestions:
|
|
1124
|
+
}), { followUpQuestions: S, summary: C } = y, $t = U(t), Dt = {
|
|
972
1125
|
latestGroupId: a,
|
|
973
1126
|
memory: {
|
|
974
|
-
|
|
975
|
-
[a]: { summary:
|
|
1127
|
+
...$t.memory,
|
|
1128
|
+
[a]: { summary: C, followUpQuestions: S, fullContext: o }
|
|
976
1129
|
}
|
|
977
1130
|
};
|
|
978
|
-
return
|
|
1131
|
+
return S.length && await Q({ type: "suggested-prompts", data: { prompts: S } }, e), {
|
|
979
1132
|
status: "success",
|
|
980
|
-
outputMessage:
|
|
981
|
-
sharedStatePatch: { portalGroupSummaryMemory: { value:
|
|
1133
|
+
outputMessage: C,
|
|
1134
|
+
sharedStatePatch: { portalGroupSummaryMemory: { value: Dt } }
|
|
982
1135
|
};
|
|
983
|
-
},
|
|
1136
|
+
}, Ia = s.object({
|
|
984
1137
|
summary: s.string(),
|
|
985
1138
|
followUpQuestions: s.array(s.string()).default([])
|
|
986
|
-
}), F = (
|
|
987
|
-
...
|
|
1139
|
+
}), F = (t, e) => e ?? t, Nt = h.Root({
|
|
1140
|
+
...G(),
|
|
988
1141
|
groupSummaryIntent: h({
|
|
989
1142
|
reducer: F,
|
|
990
1143
|
default: () => "clarify"
|
|
@@ -997,24 +1150,24 @@ Deterministic signals:
|
|
|
997
1150
|
reducer: F,
|
|
998
1151
|
default: () => ""
|
|
999
1152
|
})
|
|
1000
|
-
}),
|
|
1153
|
+
}), Sa = () => new A(Nt).addNode("detectGroupSummaryIntent", ca).addNode("summarizePortalGroup", ba).addNode("answerGroupSummaryFollowUp", ra).addNode("suggestGroupSummaryNavigation", ua).addEdge(N, "detectGroupSummaryIntent").addConditionalEdges("detectGroupSummaryIntent", (e) => e.groupSummaryIntent === "summarize" ? "summarizePortalGroup" : e.groupSummaryIntent === "followUp" ? "answerGroupSummaryFollowUp" : e.groupSummaryIntent === "navigation" ? "suggestGroupSummaryNavigation" : w).addEdge("summarizePortalGroup", w).addEdge("answerGroupSummaryFollowUp", w).addEdge("suggestGroupSummaryNavigation", w), xa = String.raw`- **portal-group-analytics** - Portal group analytics assistant:
|
|
1001
1154
|
- summarizes ArcGIS portal groups from group context and sourceJSON details
|
|
1002
1155
|
- answers follow-up questions grounded in the summarized group
|
|
1003
1156
|
- suggests navigation to groups when relevant
|
|
1004
|
-
`,
|
|
1157
|
+
`, Ta = {
|
|
1005
1158
|
id: "portal-group-analytics",
|
|
1006
1159
|
name: "Portal Group Analytics",
|
|
1007
|
-
description:
|
|
1008
|
-
createGraph:
|
|
1009
|
-
workspace:
|
|
1010
|
-
},
|
|
1011
|
-
const
|
|
1012
|
-
return
|
|
1013
|
-
},
|
|
1160
|
+
description: xa,
|
|
1161
|
+
createGraph: Sa,
|
|
1162
|
+
workspace: Nt
|
|
1163
|
+
}, Ca = () => ({ latestItemId: null, memory: {} }), _ = (t) => {
|
|
1164
|
+
const e = t?.agentExecutionContext.sharedState.portalItemAnalyticsSummaryMemory?.value;
|
|
1165
|
+
return e ? { latestItemId: e.latestItemId, memory: e.memory } : Ca();
|
|
1166
|
+
}, rt = s.object({
|
|
1014
1167
|
intent: s.enum(["summarize", "followUp", "clarify"]),
|
|
1015
1168
|
itemId: s.string().default(""),
|
|
1016
1169
|
question: s.string().default("")
|
|
1017
|
-
}),
|
|
1170
|
+
}), Ma = s.object({ summary: s.string(), followUpQuestions: s.array(s.string()).default([]) }), Aa = s.object({ answer: s.string(), isRelevant: s.boolean() }), Na = `
|
|
1018
1171
|
You answer follow-up questions about an ArcGIS item.
|
|
1019
1172
|
|
|
1020
1173
|
Ground your answer in the provided item context.
|
|
@@ -1034,26 +1187,26 @@ Item full context
|
|
|
1034
1187
|
|
|
1035
1188
|
Question:
|
|
1036
1189
|
{question}
|
|
1037
|
-
`,
|
|
1038
|
-
await m({ text: "Answering follow-up...", agentName: "analytics" },
|
|
1039
|
-
const a =
|
|
1040
|
-
return
|
|
1190
|
+
`, Ga = async (t, e) => {
|
|
1191
|
+
await m({ text: "Answering follow-up...", agentName: "analytics" }, e);
|
|
1192
|
+
const a = _(t), n = t.analyticsItemId ?? a.latestItemId, o = n ? a.memory[n] : void 0, r = t.analyticsQuestion || I(t.agentExecutionContext.messages);
|
|
1193
|
+
return o ? {
|
|
1041
1194
|
status: "success",
|
|
1042
|
-
outputMessage: (await
|
|
1043
|
-
promptText:
|
|
1044
|
-
schema:
|
|
1195
|
+
outputMessage: (await b({
|
|
1196
|
+
promptText: Na,
|
|
1197
|
+
schema: Aa,
|
|
1045
1198
|
modelTier: "default",
|
|
1046
1199
|
inputVariables: {
|
|
1047
|
-
summary:
|
|
1048
|
-
question:
|
|
1049
|
-
fullContext: JSON.stringify(
|
|
1200
|
+
summary: o.summary,
|
|
1201
|
+
question: r,
|
|
1202
|
+
fullContext: JSON.stringify(o.fullContext)
|
|
1050
1203
|
}
|
|
1051
1204
|
})).answer
|
|
1052
1205
|
} : {
|
|
1053
1206
|
status: "success",
|
|
1054
1207
|
outputMessage: "I don't have enough information yet. Please ask me to summarize the item first using summarize item <item id>."
|
|
1055
1208
|
};
|
|
1056
|
-
},
|
|
1209
|
+
}, Pa = `
|
|
1057
1210
|
Classify the user analytics request.
|
|
1058
1211
|
|
|
1059
1212
|
Rules:
|
|
@@ -1083,27 +1236,27 @@ hasSummaryContext:
|
|
|
1083
1236
|
|
|
1084
1237
|
User message:
|
|
1085
1238
|
{userMessage}
|
|
1086
|
-
`,
|
|
1087
|
-
await m({ text: "Analyzing intent...", agentName: "analytics" },
|
|
1088
|
-
const a = I(
|
|
1239
|
+
`, qa = async (t, e) => {
|
|
1240
|
+
await m({ text: "Analyzing intent...", agentName: "analytics" }, e);
|
|
1241
|
+
const a = I(t.agentExecutionContext.messages), n = !!_(t).latestItemId, o = await J.fromTemplate(Pa).format({
|
|
1089
1242
|
userMessage: a,
|
|
1090
1243
|
hasSummaryContext: String(n)
|
|
1091
|
-
}),
|
|
1244
|
+
}), c = (await W({ modelTier: "fast" })).withStructuredOutput(rt), i = rt.parse(await c.invoke(o));
|
|
1092
1245
|
let l = i.itemId;
|
|
1093
1246
|
if (i.intent === "summarize" && !l) {
|
|
1094
|
-
const y =
|
|
1095
|
-
y && (l = await
|
|
1247
|
+
const y = M(a, "#");
|
|
1248
|
+
y && (l = await xt.invoke({ itemTitle: y }, e) ?? "");
|
|
1096
1249
|
}
|
|
1097
|
-
const { intent:
|
|
1250
|
+
const { intent: u, question: d } = i, f = u === "clarify" || u === "summarize" && !l || u === "followUp" && !d;
|
|
1098
1251
|
return {
|
|
1099
|
-
agentExecutionContext: { ...
|
|
1100
|
-
analyticsIntent: f ? "clarify" :
|
|
1252
|
+
agentExecutionContext: { ...t.agentExecutionContext },
|
|
1253
|
+
analyticsIntent: f ? "clarify" : u,
|
|
1101
1254
|
analyticsItemId: l || null,
|
|
1102
1255
|
analyticsQuestion: d || "",
|
|
1103
1256
|
status: "success",
|
|
1104
1257
|
outputMessage: f ? 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".' : ""
|
|
1105
1258
|
};
|
|
1106
|
-
},
|
|
1259
|
+
}, Ea = `
|
|
1107
1260
|
You are a item summary tool for ArcGIS. Your job is to summarize an item's info based on the provided context.
|
|
1108
1261
|
Summary rules:
|
|
1109
1262
|
- The summary should be concise markdown, make sure to format the output nicely so it's easy to read.
|
|
@@ -1118,41 +1271,41 @@ Do not include internal identifiers.
|
|
|
1118
1271
|
If the user asks for a detailed summary, you may expand the response up to 300 words.
|
|
1119
1272
|
Item context:
|
|
1120
1273
|
{context}
|
|
1121
|
-
`,
|
|
1122
|
-
const a =
|
|
1274
|
+
`, za = async (t, e) => {
|
|
1275
|
+
const a = t.analyticsItemId;
|
|
1123
1276
|
if (!a)
|
|
1124
1277
|
return {
|
|
1125
1278
|
status: "success",
|
|
1126
1279
|
outputMessage: 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".'
|
|
1127
1280
|
};
|
|
1128
|
-
await m({ text: `Summarizing item ${a}...`, agentName: "analytics" },
|
|
1129
|
-
const n =
|
|
1281
|
+
await m({ text: `Summarizing item ${a}...`, agentName: "analytics" }, e);
|
|
1282
|
+
const n = e?.configurable?.context;
|
|
1130
1283
|
T(n);
|
|
1131
|
-
const { portal:
|
|
1132
|
-
if (i || !
|
|
1133
|
-
return await m({ text: "Failed to get item context for summarization", agentName: "analytics" },
|
|
1284
|
+
const { portal: o, user: r } = n, { result: c, error: i } = await Yt(r, o, a);
|
|
1285
|
+
if (i || !c)
|
|
1286
|
+
return await m({ text: "Failed to get item context for summarization", agentName: "analytics" }, e), {
|
|
1134
1287
|
status: "success",
|
|
1135
1288
|
outputMessage: "Unable to retrieve item context for summarization."
|
|
1136
1289
|
};
|
|
1137
|
-
const { context: l } =
|
|
1138
|
-
promptText:
|
|
1139
|
-
schema:
|
|
1290
|
+
const { context: l } = c, u = await b({
|
|
1291
|
+
promptText: Ea,
|
|
1292
|
+
schema: Ma,
|
|
1140
1293
|
modelTier: "default",
|
|
1141
1294
|
inputVariables: { context: JSON.stringify(l) }
|
|
1142
|
-
}), { followUpQuestions: d, summary: g } =
|
|
1295
|
+
}), { followUpQuestions: d, summary: g } = u, p = _(t), f = {
|
|
1143
1296
|
latestItemId: a,
|
|
1144
1297
|
memory: {
|
|
1145
1298
|
...p.memory,
|
|
1146
1299
|
[a]: { summary: g, followUpQuestions: d, fullContext: l }
|
|
1147
1300
|
}
|
|
1148
1301
|
};
|
|
1149
|
-
return d.length && await
|
|
1302
|
+
return d.length && await Q({ type: "suggested-prompts", data: { prompts: d } }, e), {
|
|
1150
1303
|
status: "success",
|
|
1151
1304
|
outputMessage: g,
|
|
1152
1305
|
sharedStatePatch: { portalItemAnalyticsSummaryMemory: { value: f } }
|
|
1153
1306
|
};
|
|
1154
|
-
}, O = (
|
|
1155
|
-
...
|
|
1307
|
+
}, O = (t, e) => e ?? t, Gt = h.Root({
|
|
1308
|
+
...G(),
|
|
1156
1309
|
// States shared only across nodes in the graph, not between invocations
|
|
1157
1310
|
analyticsIntent: h({
|
|
1158
1311
|
reducer: O,
|
|
@@ -1166,18 +1319,18 @@ Item context:
|
|
|
1166
1319
|
reducer: O,
|
|
1167
1320
|
default: () => ""
|
|
1168
1321
|
})
|
|
1169
|
-
}),
|
|
1322
|
+
}), ka = () => new A(Gt).addNode("detectAnalyticsIntent", qa).addNode("summarizePortalItem", za).addNode("answerAnalyticsFollowUp", Ga).addEdge(N, "detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent", (e) => e.analyticsIntent === "summarize" ? "summarizePortalItem" : e.analyticsIntent === "followUp" ? "answerAnalyticsFollowUp" : w).addEdge("summarizePortalItem", w).addEdge("answerAnalyticsFollowUp", w), $a = String.raw`- **portal-item-analytics** - Portal item analytics assistant:
|
|
1170
1323
|
- answers questions about one specific ArcGIS portal item when item context is present
|
|
1171
1324
|
- summarizes item details, metadata, and context grounded in that item
|
|
1172
1325
|
- suggests follow-up prompts grounded in the same item
|
|
1173
1326
|
- use for item-specific requests, not for gallery browsing, featured content, or opening Map Viewer
|
|
1174
|
-
`,
|
|
1327
|
+
`, Da = {
|
|
1175
1328
|
id: "portal-item-analytics",
|
|
1176
1329
|
name: "Portal Item Analytics",
|
|
1177
|
-
description:
|
|
1178
|
-
createGraph:
|
|
1179
|
-
workspace:
|
|
1180
|
-
},
|
|
1330
|
+
description: $a,
|
|
1331
|
+
createGraph: ka,
|
|
1332
|
+
workspace: Gt
|
|
1333
|
+
}, Ra = {
|
|
1181
1334
|
schemaVersion: "1.0",
|
|
1182
1335
|
capabilities: [
|
|
1183
1336
|
{
|
|
@@ -1217,7 +1370,7 @@ Item context:
|
|
|
1217
1370
|
}
|
|
1218
1371
|
}
|
|
1219
1372
|
]
|
|
1220
|
-
},
|
|
1373
|
+
}, Ua = {
|
|
1221
1374
|
schemaVersion: "1.0",
|
|
1222
1375
|
capabilities: [
|
|
1223
1376
|
{
|
|
@@ -1271,7 +1424,7 @@ Item context:
|
|
|
1271
1424
|
}
|
|
1272
1425
|
}
|
|
1273
1426
|
]
|
|
1274
|
-
},
|
|
1427
|
+
}, Fa = {
|
|
1275
1428
|
schemaVersion: "1.0",
|
|
1276
1429
|
capabilities: [
|
|
1277
1430
|
{
|
|
@@ -1291,34 +1444,34 @@ Item context:
|
|
|
1291
1444
|
}
|
|
1292
1445
|
}
|
|
1293
1446
|
]
|
|
1294
|
-
},
|
|
1295
|
-
"contentRouteRegistry.ts":
|
|
1296
|
-
"groupsRouteRegistry.ts":
|
|
1297
|
-
"orgSettingsRouteRegistry.ts":
|
|
1447
|
+
}, Oa = {
|
|
1448
|
+
"contentRouteRegistry.ts": Ra,
|
|
1449
|
+
"groupsRouteRegistry.ts": Ua,
|
|
1450
|
+
"orgSettingsRouteRegistry.ts": Fa
|
|
1298
1451
|
};
|
|
1299
|
-
function
|
|
1300
|
-
const
|
|
1301
|
-
for (const [n,
|
|
1302
|
-
for (const
|
|
1303
|
-
if (a.has(
|
|
1304
|
-
throw new Error(`${n}: duplicate capability id "${
|
|
1305
|
-
a.add(
|
|
1452
|
+
function st(t) {
|
|
1453
|
+
const e = [], a = /* @__PURE__ */ new Set();
|
|
1454
|
+
for (const [n, o] of Object.entries(t))
|
|
1455
|
+
for (const r of o.capabilities) {
|
|
1456
|
+
if (a.has(r.id))
|
|
1457
|
+
throw new Error(`${n}: duplicate capability id "${r.id}" across registries`);
|
|
1458
|
+
a.add(r.id), e.push(r);
|
|
1306
1459
|
}
|
|
1307
|
-
return
|
|
1460
|
+
return e;
|
|
1308
1461
|
}
|
|
1309
1462
|
let E;
|
|
1310
|
-
function
|
|
1311
|
-
return
|
|
1463
|
+
function x(t) {
|
|
1464
|
+
return t ? E = st({ customCapabilities: t }) : E || (E = st(Oa)), E;
|
|
1312
1465
|
}
|
|
1313
|
-
const
|
|
1314
|
-
function $(
|
|
1315
|
-
return
|
|
1466
|
+
const La = /^(?:take me to|navigate to|go to|show me|open)\s+(?:the\s+)?/u;
|
|
1467
|
+
function $(t) {
|
|
1468
|
+
return t.toLowerCase().replace(/[^a-z0-9]+/gu, " ").trim().replace(La, "").trim();
|
|
1316
1469
|
}
|
|
1317
|
-
const
|
|
1470
|
+
const ja = s.object({
|
|
1318
1471
|
capabilityIds: s.array(s.string()).default([]),
|
|
1319
1472
|
confidence: s.number().min(0).max(1).default(0),
|
|
1320
1473
|
reason: s.string().default("")
|
|
1321
|
-
}),
|
|
1474
|
+
}), it = 0.8, Va = String.raw`You select Portal navigation capabilities for a user's request.
|
|
1322
1475
|
|
|
1323
1476
|
Select only capability IDs from the supplied candidates. Return an empty array when none fit.
|
|
1324
1477
|
A named surface is required: do not select a capability on another Portal surface.
|
|
@@ -1328,44 +1481,44 @@ User request:
|
|
|
1328
1481
|
{userRequest}
|
|
1329
1482
|
|
|
1330
1483
|
Candidates:
|
|
1331
|
-
{candidates}`,
|
|
1332
|
-
if (
|
|
1484
|
+
{candidates}`, Ba = async (t, e) => {
|
|
1485
|
+
if (t.outputMessage || t.targets.length === 0)
|
|
1333
1486
|
return {};
|
|
1334
|
-
const a = I(
|
|
1487
|
+
const a = I(t.agentExecutionContext.messages).trim(), n = Ka(a, t);
|
|
1335
1488
|
if (n.length === 1)
|
|
1336
1489
|
return console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
|
|
1337
1490
|
method: "exact-match",
|
|
1338
1491
|
request: a,
|
|
1339
1492
|
selectedCapabilityIds: n
|
|
1340
1493
|
}), { chosenCapabilityIds: n };
|
|
1341
|
-
await m({ text: "Choosing a navigation destination...", agentName: "navigation" },
|
|
1342
|
-
const
|
|
1343
|
-
|
|
1344
|
-
id:
|
|
1345
|
-
title:
|
|
1346
|
-
description:
|
|
1347
|
-
route:
|
|
1348
|
-
keywordScore:
|
|
1494
|
+
await m({ text: "Choosing a navigation destination...", agentName: "navigation" }, e);
|
|
1495
|
+
const o = JSON.stringify(
|
|
1496
|
+
t.targets.map(({ capability: r, keywordScore: c, semanticScore: i }) => ({
|
|
1497
|
+
id: r.id,
|
|
1498
|
+
title: r.title,
|
|
1499
|
+
description: r.description,
|
|
1500
|
+
route: r.resolutions.navigate,
|
|
1501
|
+
keywordScore: c,
|
|
1349
1502
|
semanticScore: i
|
|
1350
1503
|
}))
|
|
1351
1504
|
);
|
|
1352
1505
|
try {
|
|
1353
|
-
const
|
|
1354
|
-
promptText:
|
|
1355
|
-
schema:
|
|
1506
|
+
const r = await b({
|
|
1507
|
+
promptText: Va,
|
|
1508
|
+
schema: ja,
|
|
1356
1509
|
modelTier: "fast",
|
|
1357
|
-
inputVariables: { candidates:
|
|
1358
|
-
}),
|
|
1510
|
+
inputVariables: { candidates: o, userRequest: a }
|
|
1511
|
+
}), c = new Set(t.targets.map(({ capability: l }) => l.id)), i = r.capabilityIds.filter((l) => c.has(l));
|
|
1359
1512
|
return console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
|
|
1360
|
-
confidence:
|
|
1513
|
+
confidence: r.confidence,
|
|
1361
1514
|
method: "structured-model",
|
|
1362
|
-
reason:
|
|
1515
|
+
reason: r.reason,
|
|
1363
1516
|
request: a,
|
|
1364
1517
|
selectedCapabilityIds: i
|
|
1365
|
-
}),
|
|
1518
|
+
}), r.confidence < it ? {
|
|
1366
1519
|
chosenCapabilityIds: [],
|
|
1367
1520
|
status: "failed",
|
|
1368
|
-
summary: `Navigation selection confidence ${
|
|
1521
|
+
summary: `Navigation selection confidence ${r.confidence} is below the required ${it}; defer to the Portal Doc Assistant.`
|
|
1369
1522
|
} : { chosenCapabilityIds: i };
|
|
1370
1523
|
} catch {
|
|
1371
1524
|
return console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
|
|
@@ -1375,19 +1528,19 @@ Candidates:
|
|
|
1375
1528
|
}), { chosenCapabilityIds: [] };
|
|
1376
1529
|
}
|
|
1377
1530
|
};
|
|
1378
|
-
function
|
|
1379
|
-
const a = $(
|
|
1380
|
-
return
|
|
1531
|
+
function Ka(t, e) {
|
|
1532
|
+
const a = $(t);
|
|
1533
|
+
return e.targets.filter(
|
|
1381
1534
|
({ capability: n }) => [n.title, ...n.hints].some(
|
|
1382
|
-
(
|
|
1535
|
+
(o) => $(o) === a
|
|
1383
1536
|
)
|
|
1384
1537
|
).map(({ capability: n }) => n.id);
|
|
1385
1538
|
}
|
|
1386
|
-
const
|
|
1539
|
+
const Pt = /* @__PURE__ */ new Set(["1d", "7d", "14d", "30d", "3m", "6m"]), Qa = s.object({
|
|
1387
1540
|
period: s.string(),
|
|
1388
1541
|
startTime: s.string(),
|
|
1389
1542
|
endTime: s.string()
|
|
1390
|
-
}),
|
|
1543
|
+
}), Wa = String.raw`Extract temporal filters for an ArcGIS storage-credits query.
|
|
1391
1544
|
|
|
1392
1545
|
Return JSON only with these optional string fields:
|
|
1393
1546
|
- period
|
|
@@ -1413,171 +1566,171 @@ Now UTC:
|
|
|
1413
1566
|
|
|
1414
1567
|
User request:
|
|
1415
1568
|
{userRequest}`;
|
|
1416
|
-
async function
|
|
1417
|
-
const a =
|
|
1569
|
+
async function Ja(t, e = /* @__PURE__ */ new Date()) {
|
|
1570
|
+
const a = t.trim();
|
|
1418
1571
|
if (!a)
|
|
1419
1572
|
return {};
|
|
1420
1573
|
try {
|
|
1421
|
-
const n = await
|
|
1422
|
-
promptText:
|
|
1423
|
-
schema:
|
|
1574
|
+
const n = await b({
|
|
1575
|
+
promptText: Wa,
|
|
1576
|
+
schema: Qa,
|
|
1424
1577
|
modelTier: "fast",
|
|
1425
1578
|
inputVariables: {
|
|
1426
|
-
nowEpochMs: String(
|
|
1427
|
-
nowIso:
|
|
1579
|
+
nowEpochMs: String(e.getTime()),
|
|
1580
|
+
nowIso: e.toISOString(),
|
|
1428
1581
|
userRequest: a
|
|
1429
1582
|
}
|
|
1430
1583
|
});
|
|
1431
|
-
return
|
|
1584
|
+
return _a(n, e);
|
|
1432
1585
|
} catch (n) {
|
|
1433
1586
|
return console.error(n), {};
|
|
1434
1587
|
}
|
|
1435
1588
|
}
|
|
1436
|
-
function
|
|
1437
|
-
const a =
|
|
1438
|
-
if (
|
|
1589
|
+
function _a(t, e = /* @__PURE__ */ new Date()) {
|
|
1590
|
+
const a = ct(t.startTime), n = ct(t.endTime), o = Ya(t.period);
|
|
1591
|
+
if (o) {
|
|
1439
1592
|
if (a !== void 0 && n !== void 0 && a < n)
|
|
1440
|
-
return { period:
|
|
1441
|
-
const
|
|
1442
|
-
if (!
|
|
1443
|
-
const i = n ??
|
|
1593
|
+
return { period: o, startTime: String(a), endTime: String(n) };
|
|
1594
|
+
const r = Pt.has(o);
|
|
1595
|
+
if (!r || n !== void 0 && !Xa(n, e.getTime())) {
|
|
1596
|
+
const i = n ?? e.getTime(), l = Ha(o, new Date(i));
|
|
1444
1597
|
if (l !== void 0)
|
|
1445
1598
|
return {
|
|
1446
|
-
period:
|
|
1599
|
+
period: o,
|
|
1447
1600
|
startTime: String(l),
|
|
1448
1601
|
endTime: String(i)
|
|
1449
1602
|
};
|
|
1450
1603
|
}
|
|
1451
|
-
return
|
|
1452
|
-
period:
|
|
1604
|
+
return r ? {
|
|
1605
|
+
period: o,
|
|
1453
1606
|
...a !== void 0 ? { startTime: String(a) } : {},
|
|
1454
1607
|
...n !== void 0 ? { endTime: String(n) } : {}
|
|
1455
|
-
} : { period:
|
|
1608
|
+
} : { period: o };
|
|
1456
1609
|
}
|
|
1457
|
-
return a !== void 0 && n !== void 0 && a < n ? { startTime: String(a), endTime: String(n) } : a !== void 0 ? { startTime: String(a), endTime: String(
|
|
1610
|
+
return a !== void 0 && n !== void 0 && a < n ? { startTime: String(a), endTime: String(n) } : a !== void 0 ? { startTime: String(a), endTime: String(e.getTime()) } : {};
|
|
1458
1611
|
}
|
|
1459
|
-
function
|
|
1460
|
-
const
|
|
1461
|
-
if (!
|
|
1612
|
+
function Ya(t) {
|
|
1613
|
+
const e = t?.trim().match(/^(\d+)\s*([dwm])$/iu);
|
|
1614
|
+
if (!e)
|
|
1462
1615
|
return;
|
|
1463
|
-
const a = Number.parseInt(
|
|
1616
|
+
const a = Number.parseInt(e[1], 10);
|
|
1464
1617
|
if (!Number.isFinite(a) || a <= 0)
|
|
1465
1618
|
return;
|
|
1466
|
-
const n =
|
|
1619
|
+
const n = e[2].toLowerCase();
|
|
1467
1620
|
if (n === "w") {
|
|
1468
|
-
const
|
|
1469
|
-
if (
|
|
1470
|
-
return `${
|
|
1621
|
+
const o = a * 7;
|
|
1622
|
+
if (Pt.has(`${o}d`))
|
|
1623
|
+
return `${o}d`;
|
|
1471
1624
|
}
|
|
1472
1625
|
return `${a}${n}`;
|
|
1473
1626
|
}
|
|
1474
|
-
function
|
|
1475
|
-
const a =
|
|
1627
|
+
function Ha(t, e) {
|
|
1628
|
+
const a = t.match(/^(\d+)([dwm])$/u);
|
|
1476
1629
|
if (!a)
|
|
1477
1630
|
return;
|
|
1478
1631
|
const n = Number.parseInt(a[1], 10);
|
|
1479
1632
|
if (!Number.isFinite(n) || n <= 0)
|
|
1480
1633
|
return;
|
|
1481
|
-
const
|
|
1482
|
-
if (
|
|
1483
|
-
return
|
|
1484
|
-
if (
|
|
1485
|
-
return
|
|
1486
|
-
const
|
|
1487
|
-
return
|
|
1634
|
+
const o = a[2];
|
|
1635
|
+
if (o === "d")
|
|
1636
|
+
return e.getTime() - n * 24 * 60 * 60 * 1e3;
|
|
1637
|
+
if (o === "w")
|
|
1638
|
+
return e.getTime() - n * 7 * 24 * 60 * 60 * 1e3;
|
|
1639
|
+
const r = new Date(e.getTime());
|
|
1640
|
+
return r.setUTCMonth(r.getUTCMonth() - n), r.getTime();
|
|
1488
1641
|
}
|
|
1489
|
-
function
|
|
1490
|
-
if (!
|
|
1642
|
+
function ct(t) {
|
|
1643
|
+
if (!t)
|
|
1491
1644
|
return;
|
|
1492
|
-
const
|
|
1493
|
-
if (!(!Number.isFinite(
|
|
1494
|
-
return
|
|
1645
|
+
const e = Number.parseInt(t, 10);
|
|
1646
|
+
if (!(!Number.isFinite(e) || e <= 0))
|
|
1647
|
+
return e;
|
|
1495
1648
|
}
|
|
1496
|
-
function
|
|
1497
|
-
const a = new Date(
|
|
1649
|
+
function Xa(t, e) {
|
|
1650
|
+
const a = new Date(t), n = new Date(e);
|
|
1498
1651
|
return a.getUTCFullYear() === n.getUTCFullYear() && a.getUTCMonth() === n.getUTCMonth() && a.getUTCDate() === n.getUTCDate();
|
|
1499
1652
|
}
|
|
1500
|
-
async function
|
|
1501
|
-
const n =
|
|
1653
|
+
async function Za(t, e, a) {
|
|
1654
|
+
const n = x().find((r) => r.id === t);
|
|
1502
1655
|
if (!n)
|
|
1503
1656
|
return;
|
|
1504
|
-
const
|
|
1505
|
-
return
|
|
1657
|
+
const o = await en(tn(n), a);
|
|
1658
|
+
return o && nn(o, e) ? { capability: n, target: o } : void 0;
|
|
1506
1659
|
}
|
|
1507
|
-
function
|
|
1508
|
-
const { hash:
|
|
1660
|
+
function tn(t) {
|
|
1661
|
+
const { hash: e, queryParams: a, routeKey: n } = t.resolutions.navigate;
|
|
1509
1662
|
switch (n) {
|
|
1510
1663
|
case "content":
|
|
1511
|
-
switch (
|
|
1664
|
+
switch (t.id) {
|
|
1512
1665
|
case "my-content":
|
|
1513
|
-
return { destinationType: "portal-content"
|
|
1666
|
+
return { destinationType: "portal-content" };
|
|
1514
1667
|
case "create-feature-layer":
|
|
1515
|
-
return { destinationType: "portal-content"
|
|
1668
|
+
return { destinationType: "portal-content" };
|
|
1516
1669
|
case "create-folder":
|
|
1517
|
-
return { destinationType: "portal-content"
|
|
1670
|
+
return { destinationType: "portal-content" };
|
|
1518
1671
|
default:
|
|
1519
1672
|
return { destinationType: "portal-content" };
|
|
1520
1673
|
}
|
|
1521
1674
|
case "groups":
|
|
1522
|
-
if (
|
|
1523
|
-
return { destinationType: "portal-groups", hash: "featured"
|
|
1524
|
-
if (
|
|
1525
|
-
return { destinationType: "portal-groups", hash: "organization"
|
|
1526
|
-
switch (
|
|
1675
|
+
if (e === "featured")
|
|
1676
|
+
return { destinationType: "portal-groups", hash: "featured" };
|
|
1677
|
+
if (e === "organization")
|
|
1678
|
+
return { destinationType: "portal-groups", hash: "organization" };
|
|
1679
|
+
switch (t.id) {
|
|
1527
1680
|
case "my groups":
|
|
1528
|
-
return { destinationType: "portal-groups", hash: "my"
|
|
1681
|
+
return { destinationType: "portal-groups", hash: "my" };
|
|
1529
1682
|
case "create-group":
|
|
1530
|
-
return { destinationType: "portal-groups"
|
|
1683
|
+
return { destinationType: "portal-groups" };
|
|
1531
1684
|
default:
|
|
1532
1685
|
return { destinationType: "portal-groups" };
|
|
1533
1686
|
}
|
|
1534
1687
|
case "organization":
|
|
1535
1688
|
return {
|
|
1536
1689
|
destinationType: "portal-org",
|
|
1537
|
-
hash:
|
|
1690
|
+
hash: e,
|
|
1538
1691
|
queryParams: a,
|
|
1539
|
-
buttonLabel:
|
|
1692
|
+
buttonLabel: t.buttonLabel
|
|
1540
1693
|
};
|
|
1541
1694
|
default:
|
|
1542
1695
|
return;
|
|
1543
1696
|
}
|
|
1544
1697
|
}
|
|
1545
|
-
async function
|
|
1546
|
-
if (!
|
|
1547
|
-
return
|
|
1548
|
-
const a = await
|
|
1698
|
+
async function en(t, e) {
|
|
1699
|
+
if (!t || !e || !an(t))
|
|
1700
|
+
return t;
|
|
1701
|
+
const a = await Ja(e);
|
|
1549
1702
|
if (!a.period && !a.startTime && !a.endTime)
|
|
1550
|
-
return
|
|
1703
|
+
return t;
|
|
1551
1704
|
const n = {
|
|
1552
|
-
...
|
|
1705
|
+
...t.queryParams ?? {},
|
|
1553
1706
|
...a.period ? { period: a.period } : {},
|
|
1554
1707
|
...a.startTime ? { startTime: a.startTime } : {},
|
|
1555
1708
|
...a.endTime ? { endTime: a.endTime } : {}
|
|
1556
1709
|
};
|
|
1557
|
-
return { ...
|
|
1710
|
+
return { ...t, queryParams: n };
|
|
1558
1711
|
}
|
|
1559
|
-
function
|
|
1560
|
-
return
|
|
1712
|
+
function an(t) {
|
|
1713
|
+
return t.destinationType === "portal-org" && t.hash === "status";
|
|
1561
1714
|
}
|
|
1562
|
-
function
|
|
1563
|
-
return !
|
|
1715
|
+
function nn(t, e) {
|
|
1716
|
+
return !e || !!e[t.destinationType];
|
|
1564
1717
|
}
|
|
1565
|
-
const
|
|
1566
|
-
if (
|
|
1718
|
+
const on = async (t, e) => {
|
|
1719
|
+
if (t.outputMessage || t.status === "failed")
|
|
1567
1720
|
return {};
|
|
1568
|
-
const a =
|
|
1721
|
+
const a = t.targets.find(({ capability: r }) => t.chosenCapabilityIds.includes(r.id)) ?? t.targets[0];
|
|
1569
1722
|
if (!a)
|
|
1570
1723
|
return {
|
|
1571
1724
|
outputMessage: "I couldn't find a matching Portal page. Try asking to open your content, groups, or organization settings.",
|
|
1572
|
-
sharedStatePatch: { navLastAnsweredRequest: { value:
|
|
1725
|
+
sharedStatePatch: { navLastAnsweredRequest: { value: ut(t) } },
|
|
1573
1726
|
status: "success",
|
|
1574
1727
|
summary: "Navigation could not find a matching capability; route another agent if appropriate."
|
|
1575
1728
|
};
|
|
1576
|
-
const n =
|
|
1577
|
-
return
|
|
1578
|
-
outputMessage:
|
|
1729
|
+
const n = ut(t), o = await Za(a.capability.id, void 0, n);
|
|
1730
|
+
return o ? (await m({ text: "Preparing navigation...", agentName: "navigation" }, e), await R(o.target, e), {
|
|
1731
|
+
outputMessage: t.chosenCapabilityIds.length ? a.capability.description : `The closest place to start is ${a.capability.title}. Click the button below to open it.`,
|
|
1579
1732
|
status: "success",
|
|
1580
|
-
summary: `Navigation suggested ${a.capability.id}${
|
|
1733
|
+
summary: `Navigation suggested ${a.capability.id}${t.retrievalDegraded ? " using keyword-only retrieval" : ""}.`,
|
|
1581
1734
|
sharedStatePatch: { navLastAnsweredRequest: { value: n } }
|
|
1582
1735
|
}) : (console.warn(`Navigation capability ${a.capability.id} was not found in the resolver.`), {
|
|
1583
1736
|
outputMessage: "I found a possible destination, but couldn't resolve a valid Portal navigation target. Try asking to open your content, groups, or organization settings.",
|
|
@@ -1586,208 +1739,208 @@ const _a = async (e, t) => {
|
|
|
1586
1739
|
sharedStatePatch: { navLastAnsweredRequest: { value: n } }
|
|
1587
1740
|
});
|
|
1588
1741
|
};
|
|
1589
|
-
function
|
|
1590
|
-
return I(
|
|
1742
|
+
function ut(t) {
|
|
1743
|
+
return I(t.agentExecutionContext.messages) || t.agentExecutionContext.userRequest;
|
|
1591
1744
|
}
|
|
1592
|
-
async function
|
|
1593
|
-
return
|
|
1745
|
+
async function qt(t) {
|
|
1746
|
+
return t.length === 0 ? [] : (await ae.getDefault().load(), await Vt(t));
|
|
1594
1747
|
}
|
|
1595
|
-
const
|
|
1748
|
+
const rn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1596
1749
|
__proto__: null,
|
|
1597
|
-
generateEmbeddings:
|
|
1750
|
+
generateEmbeddings: qt
|
|
1598
1751
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1599
|
-
function
|
|
1600
|
-
const
|
|
1601
|
-
a.trim().length > 0 &&
|
|
1602
|
-
const n =
|
|
1752
|
+
function sn(t) {
|
|
1753
|
+
const e = [], a = `${t.title}. ${t.description}`;
|
|
1754
|
+
a.trim().length > 0 && e.push({ field: "summary", text: a });
|
|
1755
|
+
const n = t.hints;
|
|
1603
1756
|
if (Array.isArray(n))
|
|
1604
|
-
for (const
|
|
1605
|
-
typeof
|
|
1606
|
-
return
|
|
1757
|
+
for (const o of n)
|
|
1758
|
+
typeof o == "string" && o.trim().length > 0 && e.push({ field: "hint", text: o });
|
|
1759
|
+
return e;
|
|
1607
1760
|
}
|
|
1608
|
-
let
|
|
1609
|
-
async function
|
|
1610
|
-
const
|
|
1611
|
-
return
|
|
1612
|
-
throw
|
|
1613
|
-
}), await
|
|
1761
|
+
let z, Y, k = 0;
|
|
1762
|
+
async function cn(t = {}) {
|
|
1763
|
+
const e = k;
|
|
1764
|
+
return z ??= ln(t.embed ?? dn).then((a) => (e === k && (Y = a), a)).catch((a) => {
|
|
1765
|
+
throw e === k && (z = void 0), a;
|
|
1766
|
+
}), await z;
|
|
1614
1767
|
}
|
|
1615
|
-
function
|
|
1616
|
-
return
|
|
1768
|
+
function un() {
|
|
1769
|
+
return Y;
|
|
1617
1770
|
}
|
|
1618
|
-
function
|
|
1619
|
-
|
|
1771
|
+
function lt() {
|
|
1772
|
+
k += 1, Y = void 0, z = void 0;
|
|
1620
1773
|
}
|
|
1621
|
-
async function
|
|
1622
|
-
const
|
|
1623
|
-
if (a.length !==
|
|
1624
|
-
throw new Error(`Expected ${
|
|
1625
|
-
return
|
|
1774
|
+
async function ln(t) {
|
|
1775
|
+
const e = pn(), a = await t(e.map((n) => n.text));
|
|
1776
|
+
if (a.length !== e.length)
|
|
1777
|
+
throw new Error(`Expected ${e.length} vectors, got ${a.length}`);
|
|
1778
|
+
return e.map((n, o) => ({
|
|
1626
1779
|
...n,
|
|
1627
|
-
vector: a[
|
|
1780
|
+
vector: a[o]
|
|
1628
1781
|
}));
|
|
1629
1782
|
}
|
|
1630
|
-
async function
|
|
1631
|
-
const { generateEmbeddings:
|
|
1632
|
-
return await t
|
|
1783
|
+
async function dn(t) {
|
|
1784
|
+
const { generateEmbeddings: e } = await Promise.resolve().then(() => rn);
|
|
1785
|
+
return await e(t);
|
|
1633
1786
|
}
|
|
1634
|
-
function
|
|
1635
|
-
return
|
|
1636
|
-
(
|
|
1637
|
-
capabilityId:
|
|
1638
|
-
field:
|
|
1787
|
+
function pn() {
|
|
1788
|
+
return x().flatMap(
|
|
1789
|
+
(t) => sn(t).map(({ field: e, text: a }) => ({
|
|
1790
|
+
capabilityId: t.id,
|
|
1791
|
+
field: e,
|
|
1639
1792
|
text: a
|
|
1640
1793
|
}))
|
|
1641
1794
|
);
|
|
1642
1795
|
}
|
|
1643
|
-
const
|
|
1796
|
+
const dt = 1.2, pt = 0.75, mn = 60, gn = 0.65, L = {
|
|
1644
1797
|
description: 1,
|
|
1645
1798
|
hint: 2,
|
|
1646
1799
|
title: 3
|
|
1647
1800
|
};
|
|
1648
|
-
let
|
|
1649
|
-
function
|
|
1650
|
-
|
|
1801
|
+
let K;
|
|
1802
|
+
function hn() {
|
|
1803
|
+
K = void 0;
|
|
1651
1804
|
}
|
|
1652
|
-
async function
|
|
1653
|
-
const a =
|
|
1654
|
-
let n = [],
|
|
1655
|
-
if (
|
|
1656
|
-
const
|
|
1657
|
-
if (!
|
|
1658
|
-
|
|
1805
|
+
async function fn(t, e = {}) {
|
|
1806
|
+
const a = bn(Et(t));
|
|
1807
|
+
let n = [], o = !1, r;
|
|
1808
|
+
if (t.trim()) {
|
|
1809
|
+
const c = e.loadEmbeddings, i = un();
|
|
1810
|
+
if (!c && !i)
|
|
1811
|
+
o = !0, r = "Capability embeddings are still loading.";
|
|
1659
1812
|
else
|
|
1660
1813
|
try {
|
|
1661
|
-
if (
|
|
1662
|
-
const [l,
|
|
1663
|
-
(
|
|
1664
|
-
|
|
1814
|
+
if (c) {
|
|
1815
|
+
const [l, u] = await Promise.all([
|
|
1816
|
+
(e.embedQuery ?? gt)(t),
|
|
1817
|
+
c()
|
|
1665
1818
|
]);
|
|
1666
|
-
n =
|
|
1819
|
+
n = mt(l, u);
|
|
1667
1820
|
} else if (i) {
|
|
1668
|
-
const l = await (
|
|
1669
|
-
n =
|
|
1821
|
+
const l = await (e.embedQuery ?? gt)(t);
|
|
1822
|
+
n = mt(l, i);
|
|
1670
1823
|
}
|
|
1671
1824
|
} catch {
|
|
1672
|
-
|
|
1825
|
+
o = !0, r = "Semantic search is unavailable.";
|
|
1673
1826
|
}
|
|
1674
1827
|
}
|
|
1675
1828
|
return {
|
|
1676
|
-
degraded:
|
|
1677
|
-
...
|
|
1829
|
+
degraded: o,
|
|
1830
|
+
...r ? { degradedReason: r } : {},
|
|
1678
1831
|
// RRF combines ranks rather than raw scores because BM25 and cosine
|
|
1679
1832
|
// similarity are on different scales.
|
|
1680
|
-
matches:
|
|
1833
|
+
matches: Sn(a, n, e.topN ?? 5)
|
|
1681
1834
|
};
|
|
1682
1835
|
}
|
|
1683
|
-
function
|
|
1684
|
-
return
|
|
1836
|
+
function yn() {
|
|
1837
|
+
return K ??= wn(x()), K;
|
|
1685
1838
|
}
|
|
1686
|
-
function
|
|
1687
|
-
const
|
|
1688
|
-
const
|
|
1689
|
-
|
|
1690
|
-
for (const
|
|
1691
|
-
|
|
1692
|
-
for (const
|
|
1693
|
-
|
|
1839
|
+
function wn(t) {
|
|
1840
|
+
const e = /* @__PURE__ */ new Map(), a = t.map((n) => {
|
|
1841
|
+
const o = /* @__PURE__ */ new Map();
|
|
1842
|
+
j(o, n.title, L.title), j(o, n.description, L.description);
|
|
1843
|
+
for (const r of n.hints)
|
|
1844
|
+
j(o, r, L.hint);
|
|
1845
|
+
for (const r of o.keys())
|
|
1846
|
+
e.set(r, (e.get(r) ?? 0) + 1);
|
|
1694
1847
|
return {
|
|
1695
1848
|
capability: n,
|
|
1696
|
-
length:
|
|
1697
|
-
termFrequencies:
|
|
1849
|
+
length: vn(o),
|
|
1850
|
+
termFrequencies: o
|
|
1698
1851
|
};
|
|
1699
1852
|
});
|
|
1700
1853
|
return {
|
|
1701
|
-
averageDocumentLength: a.length ? a.reduce((n,
|
|
1702
|
-
documentFrequency:
|
|
1854
|
+
averageDocumentLength: a.length ? a.reduce((n, o) => n + o.length, 0) / a.length : 0,
|
|
1855
|
+
documentFrequency: e,
|
|
1703
1856
|
documents: a
|
|
1704
1857
|
};
|
|
1705
1858
|
}
|
|
1706
|
-
function
|
|
1707
|
-
for (const n of
|
|
1708
|
-
|
|
1859
|
+
function j(t, e, a) {
|
|
1860
|
+
for (const n of Et(e))
|
|
1861
|
+
t.set(n, (t.get(n) ?? 0) + a);
|
|
1709
1862
|
}
|
|
1710
|
-
function
|
|
1711
|
-
return [...
|
|
1863
|
+
function vn(t) {
|
|
1864
|
+
return [...t.values()].reduce((e, a) => e + a, 0);
|
|
1712
1865
|
}
|
|
1713
|
-
function
|
|
1714
|
-
return
|
|
1866
|
+
function Et(t) {
|
|
1867
|
+
return t.toLowerCase().split(/[^a-z0-9]+/u).filter(Boolean);
|
|
1715
1868
|
}
|
|
1716
|
-
function
|
|
1717
|
-
const
|
|
1718
|
-
return
|
|
1869
|
+
function bn(t) {
|
|
1870
|
+
const e = yn(), a = new Set(t), n = e.documents.length;
|
|
1871
|
+
return e.documents.map(({ capability: o, length: r, termFrequencies: c }) => {
|
|
1719
1872
|
let i = 0;
|
|
1720
1873
|
for (const l of a) {
|
|
1721
|
-
const
|
|
1722
|
-
if (!
|
|
1874
|
+
const u = c.get(l), d = e.documentFrequency.get(l);
|
|
1875
|
+
if (!u || !d)
|
|
1723
1876
|
continue;
|
|
1724
|
-
const g = Math.log(1 + (n - d + 0.5) / (d + 0.5)), p =
|
|
1725
|
-
i += g * (
|
|
1877
|
+
const g = Math.log(1 + (n - d + 0.5) / (d + 0.5)), p = dt * (1 - pt + pt * (r / e.averageDocumentLength));
|
|
1878
|
+
i += g * (u * (dt + 1) / (u + p));
|
|
1726
1879
|
}
|
|
1727
|
-
return { capability:
|
|
1728
|
-
}).filter(({ score:
|
|
1880
|
+
return { capability: o, score: i };
|
|
1881
|
+
}).filter(({ score: o }) => o > 0).sort(zt);
|
|
1729
1882
|
}
|
|
1730
|
-
function
|
|
1883
|
+
function mt(t, e) {
|
|
1731
1884
|
const a = /* @__PURE__ */ new Map();
|
|
1732
|
-
for (const
|
|
1733
|
-
const
|
|
1734
|
-
if (
|
|
1885
|
+
for (const o of e) {
|
|
1886
|
+
const r = In(t, o.vector);
|
|
1887
|
+
if (r === void 0)
|
|
1735
1888
|
continue;
|
|
1736
|
-
const
|
|
1737
|
-
(
|
|
1889
|
+
const c = a.get(o.capabilityId);
|
|
1890
|
+
(c === void 0 || r > c) && a.set(o.capabilityId, r);
|
|
1738
1891
|
}
|
|
1739
|
-
const n = new Map(
|
|
1740
|
-
return [...a.entries()].flatMap(([
|
|
1741
|
-
const
|
|
1742
|
-
return
|
|
1743
|
-
}).sort(
|
|
1892
|
+
const n = new Map(x().map((o) => [o.id, o]));
|
|
1893
|
+
return [...a.entries()].flatMap(([o, r]) => {
|
|
1894
|
+
const c = n.get(o);
|
|
1895
|
+
return c && r >= gn ? [{ capability: c, score: r }] : [];
|
|
1896
|
+
}).sort(zt);
|
|
1744
1897
|
}
|
|
1745
|
-
function
|
|
1746
|
-
if (
|
|
1898
|
+
function In(t, e) {
|
|
1899
|
+
if (t.length === 0 || t.length !== e.length)
|
|
1747
1900
|
return;
|
|
1748
|
-
let a = 0, n = 0,
|
|
1749
|
-
for (let
|
|
1750
|
-
a +=
|
|
1751
|
-
const
|
|
1752
|
-
return
|
|
1901
|
+
let a = 0, n = 0, o = 0;
|
|
1902
|
+
for (let c = 0; c < t.length; c += 1)
|
|
1903
|
+
a += t[c] * e[c], n += t[c] ** 2, o += e[c] ** 2;
|
|
1904
|
+
const r = Math.sqrt(n) * Math.sqrt(o);
|
|
1905
|
+
return r === 0 ? void 0 : a / r;
|
|
1753
1906
|
}
|
|
1754
|
-
async function
|
|
1755
|
-
const [
|
|
1756
|
-
if (!
|
|
1907
|
+
async function gt(t) {
|
|
1908
|
+
const [e] = await qt([t]);
|
|
1909
|
+
if (!e)
|
|
1757
1910
|
throw new Error("Expected one query embedding.");
|
|
1758
|
-
return
|
|
1911
|
+
return e;
|
|
1759
1912
|
}
|
|
1760
|
-
function
|
|
1913
|
+
function Sn(t, e, a) {
|
|
1761
1914
|
const n = /* @__PURE__ */ new Map();
|
|
1762
|
-
return
|
|
1915
|
+
return ht(n, t, "keyword"), ht(n, e, "semantic"), [...n.values()].sort((o, r) => r.score !== o.score ? r.score - o.score : (r.semanticScore ?? 0) !== (o.semanticScore ?? 0) ? (r.semanticScore ?? 0) - (o.semanticScore ?? 0) : (r.keywordScore ?? 0) !== (o.keywordScore ?? 0) ? (r.keywordScore ?? 0) - (o.keywordScore ?? 0) : o.capability.id.localeCompare(r.capability.id)).slice(0, Math.max(0, a));
|
|
1763
1916
|
}
|
|
1764
|
-
function
|
|
1765
|
-
for (const [n, { capability:
|
|
1766
|
-
const
|
|
1767
|
-
i.score += 1 / (
|
|
1917
|
+
function ht(t, e, a) {
|
|
1918
|
+
for (const [n, { capability: o, score: r }] of e.entries()) {
|
|
1919
|
+
const c = n + 1, i = t.get(o.id) ?? { capability: o, score: 0 };
|
|
1920
|
+
i.score += 1 / (mn + c), a === "keyword" ? (i.keywordRank = c, i.keywordScore = r) : (i.semanticRank = c, i.semanticScore = r), t.set(o.id, i);
|
|
1768
1921
|
}
|
|
1769
1922
|
}
|
|
1770
|
-
function
|
|
1771
|
-
return
|
|
1923
|
+
function zt(t, e) {
|
|
1924
|
+
return e.score - t.score || t.capability.id.localeCompare(e.capability.id);
|
|
1772
1925
|
}
|
|
1773
|
-
const
|
|
1774
|
-
await m({ text: "Finding a place to navigate...", agentName: "navigation" },
|
|
1775
|
-
const a = I(
|
|
1926
|
+
const xn = async (t, e) => {
|
|
1927
|
+
await m({ text: "Finding a place to navigate...", agentName: "navigation" }, e);
|
|
1928
|
+
const a = I(t.agentExecutionContext.messages).trim();
|
|
1776
1929
|
try {
|
|
1777
|
-
const n = await
|
|
1930
|
+
const n = await fn(a, { topN: 5 });
|
|
1778
1931
|
return console.table(
|
|
1779
|
-
n.matches.map(({ capability:
|
|
1780
|
-
capability:
|
|
1781
|
-
fusedScore:
|
|
1782
|
-
keywordRank:
|
|
1783
|
-
keywordScore:
|
|
1932
|
+
n.matches.map(({ capability: o, keywordRank: r, keywordScore: c, semanticRank: i, semanticScore: l, score: u }) => ({
|
|
1933
|
+
capability: o.title,
|
|
1934
|
+
fusedScore: u,
|
|
1935
|
+
keywordRank: r,
|
|
1936
|
+
keywordScore: c,
|
|
1784
1937
|
semanticRank: i,
|
|
1785
1938
|
semanticScore: l
|
|
1786
1939
|
}))
|
|
1787
1940
|
), n.degradedReason && console.info("[arcgis-portal-ai-assistant] navigation semantic search:", n.degradedReason), {
|
|
1788
1941
|
chosenCapabilityIds: [],
|
|
1789
1942
|
retrievalDegraded: n.degradedReason ?? "",
|
|
1790
|
-
targets:
|
|
1943
|
+
targets: Tn(a, n.matches)
|
|
1791
1944
|
};
|
|
1792
1945
|
} catch {
|
|
1793
1946
|
return {
|
|
@@ -1798,233 +1951,220 @@ const gn = async (e, t) => {
|
|
|
1798
1951
|
};
|
|
1799
1952
|
}
|
|
1800
1953
|
};
|
|
1801
|
-
function
|
|
1802
|
-
const a = $(
|
|
1803
|
-
({ capability:
|
|
1804
|
-
(
|
|
1954
|
+
function Tn(t, e) {
|
|
1955
|
+
const a = $(t), n = e.filter(
|
|
1956
|
+
({ capability: r }) => [r.title, ...r.hints].some(
|
|
1957
|
+
(c) => $(c) === a
|
|
1805
1958
|
)
|
|
1806
1959
|
);
|
|
1807
1960
|
if (n.length !== 1)
|
|
1808
|
-
return
|
|
1809
|
-
const [
|
|
1810
|
-
return [
|
|
1961
|
+
return e;
|
|
1962
|
+
const [o] = n;
|
|
1963
|
+
return [o, ...e.filter((r) => r !== o)];
|
|
1811
1964
|
}
|
|
1812
|
-
const
|
|
1813
|
-
...
|
|
1814
|
-
chosenCapabilityIds: h({ reducer:
|
|
1965
|
+
const V = (t, e) => e ?? t, kt = h.Root({
|
|
1966
|
+
...G(),
|
|
1967
|
+
chosenCapabilityIds: h({ reducer: V, default: () => [] }),
|
|
1815
1968
|
// Empty when hybrid keyword-and-semantic retrieval succeeds; otherwise
|
|
1816
1969
|
// contains the semantic-search failure reason for response diagnostics.
|
|
1817
|
-
retrievalDegraded: h({ reducer:
|
|
1818
|
-
targets: h({ reducer:
|
|
1819
|
-
}),
|
|
1820
|
-
function
|
|
1821
|
-
const
|
|
1970
|
+
retrievalDegraded: h({ reducer: V, default: () => "" }),
|
|
1971
|
+
targets: h({ reducer: V, default: () => [] })
|
|
1972
|
+
}), Cn = () => new A(kt).addNode("retrieveNavigationTargets", xn).addNode("chooseNavigationTargets", Ba).addNode("respondWithNavigation", on).addEdge(N, "retrieveNavigationTargets").addEdge("retrieveNavigationTargets", "chooseNavigationTargets").addEdge("chooseNavigationTargets", "respondWithNavigation").addEdge("respondWithNavigation", w);
|
|
1973
|
+
function Mn() {
|
|
1974
|
+
const t = x().map(({ hints: e, title: a }) => e[0] ?? a).join(", ");
|
|
1822
1975
|
return String.raw`- **portal-navigation** - Portal page navigation assistant:
|
|
1823
1976
|
- routes requests to open, show, or navigate to a Portal page, including creation-flow pages
|
|
1824
1977
|
- falls back to the closest Portal page where a workflow starts when another agent cannot perform the action
|
|
1825
1978
|
- handles short navigation follow-ups after asking the user to open a page
|
|
1826
|
-
- capability examples: ${
|
|
1979
|
+
- capability examples: ${t}
|
|
1827
1980
|
- do not use for general "how do I" questions unless the user explicitly asks to reach a page
|
|
1828
1981
|
`;
|
|
1829
1982
|
}
|
|
1830
|
-
const
|
|
1983
|
+
const An = {
|
|
1831
1984
|
id: "navigation",
|
|
1832
1985
|
name: "Portal Navigation",
|
|
1833
1986
|
get description() {
|
|
1834
|
-
return
|
|
1987
|
+
return Mn();
|
|
1835
1988
|
},
|
|
1836
|
-
createGraph:
|
|
1837
|
-
workspace:
|
|
1838
|
-
},
|
|
1839
|
-
function
|
|
1840
|
-
if (!
|
|
1989
|
+
createGraph: Cn,
|
|
1990
|
+
workspace: kt
|
|
1991
|
+
}, Nn = Ot`: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)}`;
|
|
1992
|
+
function Gn(t, e) {
|
|
1993
|
+
if (!e)
|
|
1841
1994
|
return;
|
|
1842
|
-
const { destinationType: a } =
|
|
1995
|
+
const { destinationType: a } = t;
|
|
1843
1996
|
switch (a) {
|
|
1844
1997
|
case "portal-content":
|
|
1845
|
-
return
|
|
1998
|
+
return e[a]?.(t.hash, t.queryParams);
|
|
1846
1999
|
case "portal-groups":
|
|
1847
|
-
return
|
|
2000
|
+
return e[a]?.(t.hash);
|
|
1848
2001
|
case "portal-org":
|
|
1849
|
-
return
|
|
2002
|
+
return e[a]?.(t.hash, t.queryParams);
|
|
1850
2003
|
case "portal-gallery":
|
|
1851
|
-
return
|
|
2004
|
+
return e[a];
|
|
1852
2005
|
case "portal-map-viewer":
|
|
1853
2006
|
case "portal-notebooks":
|
|
1854
2007
|
case "portal-scene-viewer":
|
|
1855
|
-
return
|
|
2008
|
+
return e[a];
|
|
1856
2009
|
case "portal-item":
|
|
1857
|
-
return
|
|
2010
|
+
return e[a]?.(t.itemId);
|
|
1858
2011
|
case "portal-group":
|
|
1859
|
-
return
|
|
2012
|
+
return e[a]?.(t.groupId);
|
|
1860
2013
|
default:
|
|
1861
|
-
return
|
|
2014
|
+
return D(a);
|
|
1862
2015
|
}
|
|
1863
2016
|
}
|
|
1864
|
-
function
|
|
1865
|
-
const
|
|
1866
|
-
return
|
|
2017
|
+
function Pn(t) {
|
|
2018
|
+
const e = Ne.safeParse(t);
|
|
2019
|
+
return e.success ? e.data : void 0;
|
|
1867
2020
|
}
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
function Sn(e, t) {
|
|
1872
|
-
const a = he(e.t9nKey, t.navigationTargets) ?? he(e.t9nKey, $e.navigationTargets);
|
|
1873
|
-
if (a)
|
|
1874
|
-
return a;
|
|
1875
|
-
const n = t.navigation;
|
|
1876
|
-
switch (e.destinationType) {
|
|
2021
|
+
function qn(t, e) {
|
|
2022
|
+
const a = e.navigation;
|
|
2023
|
+
switch (t.destinationType) {
|
|
1877
2024
|
case "portal-content":
|
|
1878
|
-
switch (
|
|
2025
|
+
switch (t.hash) {
|
|
1879
2026
|
case "favorites":
|
|
1880
|
-
return
|
|
2027
|
+
return a.openContentFavorites;
|
|
1881
2028
|
case "group":
|
|
1882
|
-
return
|
|
2029
|
+
return a.openContentGroup;
|
|
1883
2030
|
case "living-atlas":
|
|
1884
|
-
return
|
|
2031
|
+
return a.openContentLivingAtlas;
|
|
1885
2032
|
case "org":
|
|
1886
|
-
return
|
|
2033
|
+
return a.openContentOrganization;
|
|
1887
2034
|
default:
|
|
1888
|
-
return
|
|
2035
|
+
return a.openContent;
|
|
1889
2036
|
}
|
|
1890
2037
|
case "portal-gallery":
|
|
1891
|
-
return
|
|
2038
|
+
return a.openGallery;
|
|
1892
2039
|
case "portal-groups":
|
|
1893
|
-
switch (
|
|
2040
|
+
switch (t.hash) {
|
|
1894
2041
|
case "featured":
|
|
1895
|
-
return
|
|
2042
|
+
return a.openGroupsFeatured;
|
|
1896
2043
|
case "my":
|
|
1897
|
-
return
|
|
2044
|
+
return a.openGroupsMy;
|
|
1898
2045
|
case "organization":
|
|
1899
|
-
return
|
|
2046
|
+
return a.openGroupsOrganization;
|
|
1900
2047
|
default:
|
|
1901
|
-
return
|
|
2048
|
+
return a.openGroups;
|
|
1902
2049
|
}
|
|
1903
2050
|
case "portal-map-viewer":
|
|
1904
|
-
return
|
|
2051
|
+
return a.openMapViewer;
|
|
1905
2052
|
case "portal-notebooks":
|
|
1906
|
-
return
|
|
2053
|
+
return a.openNotebooks;
|
|
1907
2054
|
case "portal-scene-viewer":
|
|
1908
|
-
return
|
|
2055
|
+
return a.openSceneViewer;
|
|
1909
2056
|
case "portal-org":
|
|
1910
|
-
return
|
|
2057
|
+
return a.openOrgSettings;
|
|
1911
2058
|
case "portal-item":
|
|
1912
|
-
return
|
|
2059
|
+
return a.openItem;
|
|
1913
2060
|
case "portal-group":
|
|
1914
|
-
return
|
|
2061
|
+
return a.openGroup;
|
|
1915
2062
|
default:
|
|
1916
|
-
return
|
|
2063
|
+
return D(t);
|
|
1917
2064
|
}
|
|
1918
2065
|
}
|
|
1919
|
-
|
|
1920
|
-
if (!(!e || !t || !Tn(e)))
|
|
1921
|
-
return t[e];
|
|
1922
|
-
}
|
|
1923
|
-
function Tn(e) {
|
|
1924
|
-
return e in $e.navigationTargets;
|
|
1925
|
-
}
|
|
1926
|
-
class Mn extends Fe {
|
|
2066
|
+
class En extends Ut {
|
|
1927
2067
|
constructor() {
|
|
1928
|
-
super(), this.t9n =
|
|
1929
|
-
const a =
|
|
2068
|
+
super(), this.t9n = jt({ blocking: !0 }), this.assistantEl = P(), this.formEl = P(), this.voiceInputEl = P(), this.inputEl = P(), this.navigationSlotElements = /* @__PURE__ */ new Map(), this.handleSlottableRequest = (e) => {
|
|
2069
|
+
const a = e.detail, n = a.data?.block;
|
|
1930
2070
|
if (!n)
|
|
1931
2071
|
return;
|
|
1932
|
-
const
|
|
1933
|
-
|
|
1934
|
-
}, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.defaultClosed = !1, this.arcgisPortalNavigationRequest =
|
|
2072
|
+
const o = this.getNavigationAction(n);
|
|
2073
|
+
o && this.upsertNavigationSlotElement(a.slotName, o);
|
|
2074
|
+
}, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.defaultClosed = !1, this.arcgisPortalNavigationRequest = Ft(), x();
|
|
1935
2075
|
}
|
|
1936
2076
|
static {
|
|
1937
2077
|
this.properties = { inputText: 16, showVoiceInput: 16, isListening: 16, isVoiceInputDisabled: 16, interrupt: 16, autoDestroyDisabled: 5, portal: 0, user: 0, config: 0, navigationTargetMap: 0, disabledAgents: 0, defaultClosed: 5, navigationCapabilities: 0 };
|
|
1938
2078
|
}
|
|
1939
2079
|
static {
|
|
1940
|
-
this.styles =
|
|
2080
|
+
this.styles = Nn;
|
|
1941
2081
|
}
|
|
1942
2082
|
async load() {
|
|
1943
2083
|
await this.refreshCapabilityEmbeddings();
|
|
1944
2084
|
}
|
|
1945
|
-
willUpdate(
|
|
1946
|
-
!this.hasUpdated || !
|
|
2085
|
+
willUpdate(e) {
|
|
2086
|
+
!this.hasUpdated || !e.has("navigationCapabilities") || this.refreshCapabilityEmbeddings();
|
|
1947
2087
|
}
|
|
1948
2088
|
async clearEmbeddingsCache() {
|
|
1949
|
-
|
|
2089
|
+
lt();
|
|
1950
2090
|
}
|
|
1951
|
-
isAgentEnabled(
|
|
1952
|
-
return !this.disabledAgents?.[
|
|
2091
|
+
isAgentEnabled(e) {
|
|
2092
|
+
return !this.disabledAgents?.[e];
|
|
1953
2093
|
}
|
|
1954
2094
|
async refreshCapabilityEmbeddings() {
|
|
1955
2095
|
try {
|
|
1956
|
-
|
|
1957
|
-
} catch (
|
|
1958
|
-
console.warn("[arcgis-portal-ai-assistant] embeddings warm-up failed:",
|
|
2096
|
+
x(this.navigationCapabilities), hn(), lt(), await cn();
|
|
2097
|
+
} catch (e) {
|
|
2098
|
+
console.warn("[arcgis-portal-ai-assistant] embeddings warm-up failed:", e);
|
|
1959
2099
|
}
|
|
1960
2100
|
}
|
|
1961
|
-
getNavigationAction(
|
|
1962
|
-
if (
|
|
2101
|
+
getNavigationAction(e) {
|
|
2102
|
+
if (e?.type !== vt)
|
|
1963
2103
|
return;
|
|
1964
|
-
const a =
|
|
2104
|
+
const a = e.data, n = Pn(a);
|
|
1965
2105
|
if (!n)
|
|
1966
2106
|
return;
|
|
1967
|
-
const
|
|
1968
|
-
if (
|
|
2107
|
+
const o = Gn(a, this.navigationTargetMap);
|
|
2108
|
+
if (o)
|
|
1969
2109
|
return {
|
|
1970
|
-
href:
|
|
2110
|
+
href: o,
|
|
1971
2111
|
targetDetail: a,
|
|
1972
|
-
label: a?.buttonLabel ||
|
|
2112
|
+
label: a?.buttonLabel || qn(n, this.t9n)
|
|
1973
2113
|
};
|
|
1974
2114
|
}
|
|
1975
|
-
upsertNavigationSlotElement(
|
|
2115
|
+
upsertNavigationSlotElement(e, a) {
|
|
1976
2116
|
const n = this.assistantEl.value;
|
|
1977
2117
|
if (!n)
|
|
1978
2118
|
return;
|
|
1979
|
-
const
|
|
1980
|
-
let
|
|
1981
|
-
|
|
1982
|
-
|
|
2119
|
+
const o = `navigation:${e}`;
|
|
2120
|
+
let r = this.navigationSlotElements.get(o);
|
|
2121
|
+
r || (r = document.createElement("div"), r.slot = e, this.navigationSlotElements.set(o, r), n.append(r)), Lt(v`<div><calcite-button class="navigation-button" appearance=outline width=full .href=${a.href} icon-end=launch @click=${(c) => {
|
|
2122
|
+
c.preventDefault(), this.arcgisPortalNavigationRequest.emit({
|
|
1983
2123
|
href: a.href,
|
|
1984
2124
|
targetDetail: a.targetDetail
|
|
1985
2125
|
});
|
|
1986
|
-
}}>${a.label}</calcite-button>${a.description ?
|
|
2126
|
+
}}>${a.label}</calcite-button>${a.description ? v`<div class="navigation-block-description">${a.description}</div>` : null}</div>`, r);
|
|
1987
2127
|
}
|
|
1988
2128
|
render() {
|
|
1989
|
-
const { t9n:
|
|
1990
|
-
return
|
|
1991
|
-
this.interrupt =
|
|
2129
|
+
const { t9n: e, inputText: a, portal: n, user: o, navigationTargetMap: r, showVoiceInput: c, isListening: i, isVoiceInputDisabled: l } = this;
|
|
2130
|
+
return v`<arcgis-assistant log-enabled keep-suggested-prompts .heading=${e.heading} .entryMessage=${e.entryMessage} @arcgisSlottableRequest=${this.handleSlottableRequest} @arcgisInterrupt=${({ detail: u }) => {
|
|
2131
|
+
this.interrupt = u;
|
|
1992
2132
|
}} @arcgisInterruptCancel=${() => {
|
|
1993
2133
|
this.interrupt = null;
|
|
1994
2134
|
}} @arcgisInterruptSubmit=${() => {
|
|
1995
2135
|
this.interrupt = null;
|
|
1996
|
-
}} @arcgisPromptSelect=${({ detail:
|
|
1997
|
-
this.inputText =
|
|
2136
|
+
}} @arcgisPromptSelect=${({ detail: u }) => {
|
|
2137
|
+
this.inputText = u.prompt, requestAnimationFrame(() => {
|
|
1998
2138
|
this.inputEl.value?.focusTextArea();
|
|
1999
2139
|
});
|
|
2000
|
-
}} ${q(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=${(
|
|
2001
|
-
|
|
2140
|
+
}} ${q(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=${(u) => {
|
|
2141
|
+
u.preventDefault();
|
|
2002
2142
|
const d = a.trim();
|
|
2003
2143
|
d && (this.assistantEl.value?.submitMessage(d), this.inputText = "");
|
|
2004
|
-
}} ${q(this.formEl)}><arcgis-portal-mentionable-text-area .portal=${n} .user=${
|
|
2005
|
-
|
|
2006
|
-
}} @arcgisUserMentionableTextAreaChange=${({ detail:
|
|
2007
|
-
this.inputText =
|
|
2144
|
+
}} ${q(this.formEl)}><arcgis-portal-mentionable-text-area .portal=${n} .user=${o} rows=3 .popoverListLabel=${e.mentionEntities} .placeholder=${e.placeholder} .value=${a} @arcgisUserMentionableTextAreaKeyDown=${({ detail: u }) => {
|
|
2145
|
+
u.key === "Enter" && !u.shiftKey && (u.preventDefault(), this.formEl.value?.requestSubmit());
|
|
2146
|
+
}} @arcgisUserMentionableTextAreaChange=${({ detail: u }) => {
|
|
2147
|
+
this.inputText = u ?? "";
|
|
2008
2148
|
}} ${q(this.inputEl)}></arcgis-portal-mentionable-text-area><div class="chat-actions"><arcgis-portal-voice-input @arcgisVoiceInputStart=${() => {
|
|
2009
2149
|
this.isListening = !0, this.isVoiceInputDisabled = !1;
|
|
2010
2150
|
}} @arcgisVoiceInputStop=${() => {
|
|
2011
2151
|
this.isListening = !1, this.isVoiceInputDisabled = !1;
|
|
2012
|
-
}} @arcgisVoiceInputError=${(
|
|
2013
|
-
|
|
2014
|
-
}} @arcgisVoiceInputInterimTranscription=${(
|
|
2015
|
-
this.inputText =
|
|
2016
|
-
}} ${q(this.voiceInputEl)}></arcgis-portal-voice-input>${
|
|
2152
|
+
}} @arcgisVoiceInputError=${(u) => {
|
|
2153
|
+
u.detail.errorCode === "not-supported" && (this.showVoiceInput = !1);
|
|
2154
|
+
}} @arcgisVoiceInputInterimTranscription=${(u) => {
|
|
2155
|
+
this.inputText = u.detail.text;
|
|
2156
|
+
}} ${q(this.voiceInputEl)}></arcgis-portal-voice-input>${c && v`<calcite-button icon-start=microphone .label=${e.voiceInput} round .disabled=${l} .appearance=${i ? "solid" : "outline-fill"} @click=${async () => {
|
|
2017
2157
|
this.isVoiceInputDisabled = !0;
|
|
2018
|
-
const
|
|
2019
|
-
i ? await
|
|
2020
|
-
}}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!a.trim()} .label=${
|
|
2021
|
-
this.assistantEl.value?.submitInterrupt(
|
|
2158
|
+
const u = this.voiceInputEl.value;
|
|
2159
|
+
i ? await u?.stopListening() : await u?.startListening();
|
|
2160
|
+
}}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!a.trim()} .label=${e.send}>${e.send}</calcite-button></div></form>${this.isAgentEnabled("itemAnalytics") && v`<arcgis-assistant-agent .agent=${Da} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupCreation") && v`<arcgis-assistant-agent .agent=${Ee} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("docAssistant") && v`<arcgis-assistant-agent .agent=${aa} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupAnalytics") && v`<arcgis-assistant-agent .agent=${Ta} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("navigation") && v`<arcgis-assistant-agent .agent=${An} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.interrupt && v`<arcgis-portal-ai-assistant-interrupt slot=interrupt .type=${this.interrupt.type} .message=${this.interrupt.message} .options=${this.interrupt.options} @arcgisSubmit=${({ detail: u }) => {
|
|
2161
|
+
this.assistantEl.value?.submitInterrupt(u);
|
|
2022
2162
|
}} @arcgisCancel=${() => {
|
|
2023
2163
|
this.assistantEl.value?.cancelInterrupt();
|
|
2024
2164
|
}}></arcgis-portal-ai-assistant-interrupt>` || ""}</arcgis-assistant>`;
|
|
2025
2165
|
}
|
|
2026
2166
|
}
|
|
2027
|
-
|
|
2167
|
+
Rt("arcgis-portal-ai-assistant", En);
|
|
2028
2168
|
export {
|
|
2029
|
-
|
|
2169
|
+
En as ArcgisPortalAiAssistant
|
|
2030
2170
|
};
|