@arcgis/portal-components 5.2.0-next.93 → 5.2.0-next.95
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/dist/cdn/{BMZFIENS.js → 27WR6TKM.js} +1 -1
- package/dist/cdn/{P6DWFLYH.js → 2LROLM5D.js} +1 -1
- package/dist/cdn/{P4ELMYQQ.js → 2M7ICZ55.js} +1 -1
- package/dist/cdn/2QCYQYNA.js +2 -0
- package/dist/cdn/2RPQKCIL.js +2 -0
- package/dist/cdn/{EZNTXOKK.js → 2Z5BVWD4.js} +1 -1
- package/dist/cdn/{2VGYRITT.js → 33IZVRD6.js} +1 -1
- package/dist/cdn/{BTSXQQKZ.js → 4PPXBKIJ.js} +3 -3
- package/dist/cdn/{H4L2DX4R.js → 4R5TLPGN.js} +1 -1
- package/dist/cdn/{Q54ZD7WJ.js → 6NHNSWIQ.js} +1 -1
- package/dist/cdn/{QH47GJCC.js → A6YWV3MB.js} +1 -1
- package/dist/cdn/{QLHCXOVQ.js → ACCEI7S4.js} +1 -1
- package/dist/cdn/{LTHZ2TRG.js → AVNFYSR4.js} +1 -1
- package/dist/cdn/{H76EB2WF.js → BA3HGV4Q.js} +1 -1
- package/dist/cdn/{7OR2HKBV.js → BCYZTGDC.js} +1 -1
- package/dist/cdn/BFH3HBUT.js +2 -0
- package/dist/cdn/BIJ755UR.js +2 -0
- package/dist/cdn/{GJ7GKO7I.js → BXDQIHOS.js} +1 -1
- package/dist/cdn/{KA4XSW6O.js → BY6ZY3C4.js} +1 -1
- package/dist/cdn/EFY6BRUW.js +2 -0
- package/dist/cdn/{7HHPKD5C.js → EHQVLI6M.js} +1 -1
- package/dist/cdn/FD7DZ3IE.js +2 -0
- package/dist/cdn/{5YCQRL4K.js → FJSGWELR.js} +1 -1
- package/dist/cdn/{CBXQFKN5.js → G2CJ5PLI.js} +1 -1
- package/dist/cdn/{T7FVQDHN.js → GBYHBRUW.js} +1 -1
- package/dist/cdn/{7XD6KSXV.js → GUTV5BR3.js} +1 -1
- package/dist/cdn/{PF3TB3QZ.js → H6QY5OJL.js} +1 -1
- package/dist/cdn/{DCIRWNQL.js → HFP5F435.js} +1 -1
- package/dist/cdn/{WNYL4EZA.js → HLQD6W3F.js} +1 -1
- package/dist/cdn/{YS2SZ3DL.js → IGZ7A7S3.js} +1 -1
- package/dist/cdn/{CNDTRZJT.js → INPDIPW5.js} +1 -1
- package/dist/cdn/JQTQZCBV.js +2 -0
- package/dist/cdn/{546M6SVH.js → KCJDG4OE.js} +1 -1
- package/dist/cdn/{PJLV3EQS.js → LDTVM22U.js} +1 -1
- package/dist/cdn/LDVTUC6I.js +2 -0
- package/dist/cdn/{MRHDSM6U.js → LLRHHAXZ.js} +1 -1
- package/dist/cdn/{YMLZCVEI.js → M6EVMQYT.js} +1 -1
- package/dist/cdn/MA5HWGFW.js +2 -0
- package/dist/cdn/{47ZPCFHE.js → NAAAOC2Z.js} +1 -1
- package/dist/cdn/{5Q7A62C3.js → NQX5UAUH.js} +86 -82
- package/dist/cdn/{ZGNXS6U5.js → PAFEMDUL.js} +1 -1
- package/dist/cdn/{KIKZIZGV.js → PH4LUNY2.js} +1 -1
- package/dist/cdn/{SFD33DHG.js → PKSH2HSK.js} +1 -1
- package/dist/cdn/{QNCSWTTL.js → PLVQ3AZ4.js} +1 -1
- package/dist/cdn/{E7MAKHJ5.js → QNFTJR2M.js} +1 -1
- package/dist/cdn/{433M2GP4.js → QVLQEBPD.js} +1 -1
- package/dist/cdn/{I2KQQXOO.js → S7IRYX4A.js} +1 -1
- package/dist/cdn/{OOH5B3WJ.js → T3BCFS2M.js} +1 -1
- package/dist/cdn/{R5BQIF6P.js → TFCRFHRE.js} +1 -1
- package/dist/cdn/VENYHN3O.js +2 -0
- package/dist/cdn/{EUWBMLIT.js → VHNV45FQ.js} +1 -1
- package/dist/cdn/{W7O7ZYZ4.js → VJ4STLVD.js} +1 -1
- package/dist/cdn/{7FVPT4SA.js → VKYMORWN.js} +1 -1
- package/dist/cdn/{6XLTWENT.js → VQKLCN3V.js} +1 -1
- package/dist/cdn/W4GBRVNN.js +2 -0
- package/dist/cdn/WAEULETE.js +2 -0
- package/dist/cdn/{O6ZQ4BRU.js → WYXW3ETE.js} +1 -1
- package/dist/cdn/{7SB7JHBR.js → XEH2E6NR.js} +1 -1
- package/dist/cdn/{TB4YQUMO.js → XWLOXRJZ.js} +1 -1
- package/dist/cdn/{RBQG66FL.js → YFT47SCG.js} +1 -1
- package/dist/cdn/{SXBAVMP3.js → YQHVXBGD.js} +1 -1
- package/dist/cdn/{O7KHFGHS.js → ZI3JA3SL.js} +1 -1
- package/dist/cdn/{WYLEYSM3.js → ZJ7GT4N2.js} +1 -1
- package/dist/cdn/{ZTGGJIVB.js → ZWDOT3HF.js} +1 -1
- package/dist/cdn/assets/portal-item-badges/t9n/messages.en.json +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/portal-item-badge.js +74 -71
- package/dist/chunks/utils2.js +28 -20
- package/dist/components/arcgis-portal-ai-assistant/agents/types.d.ts +18 -7
- package/dist/components/arcgis-portal-ai-assistant/customElement.js +625 -564
- package/dist/components/arcgis-portal-ai-assistant/data/capability-registries/types.d.ts +19 -8
- package/dist/components/arcgis-portal-ai-assistant/index.js +0 -1
- package/dist/components/arcgis-portal-navigation/customElement.js +159 -156
- package/dist/components/arcgis-portal-navigation/index.js +5 -4
- 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 +5 -5
- package/dist/cdn/2T33E2DS.js +0 -2
- package/dist/cdn/3HAZNYCD.js +0 -2
- package/dist/cdn/DN2QW5FV.js +0 -2
- package/dist/cdn/HNWQS7DU.js +0 -2
- package/dist/cdn/K42KPAN7.js +0 -2
- package/dist/cdn/NVGQFC2K.js +0 -2
- package/dist/cdn/O3JIWIMI.js +0 -2
- package/dist/cdn/RDAUPHB6.js +0 -2
- package/dist/cdn/RVWAHK4A.js +0 -2
- package/dist/cdn/SKRCLDPZ.js +0 -2
- package/dist/cdn/YWNUWLOL.js +0 -2
- package/dist/cdn/YZNRN2K5.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
|
|
5
|
-
import { createRef as
|
|
6
|
-
import { u as
|
|
7
|
-
import { NodeInterrupt as
|
|
8
|
-
import { sendTraceMessage as
|
|
2
|
+
import { c as Ve } from "../../chunks/runtime.js";
|
|
3
|
+
import { LitElement as Be, createEvent as Ke } from "@arcgis/lumina";
|
|
4
|
+
import { css as Qe, render as We, html as I } from "lit";
|
|
5
|
+
import { createRef as k, ref as E } from "lit/directives/ref.js";
|
|
6
|
+
import { u as Je } from "../../chunks/useT9n.js";
|
|
7
|
+
import { NodeInterrupt as J, Annotation as h, StateGraph as N, START as P, END as w } from "@langchain/langgraph/web";
|
|
8
|
+
import { sendTraceMessage as p, invokeStructuredPrompt as v, sendUXSuggestion as _, createAgentRuntimeStateWithSharedState as G, createChatModel as Y, getEmbeddings as _e } 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 U, t as
|
|
14
|
-
import { ChatPromptTemplate as
|
|
15
|
-
import { tool as
|
|
16
|
-
import { s as
|
|
17
|
-
import { g as
|
|
18
|
-
import
|
|
19
|
-
const
|
|
10
|
+
import { a as Ye, c as He, q as Xe } from "../../chunks/groups2.js";
|
|
11
|
+
import ee from "@arcgis/core/identity/IdentityManager.js";
|
|
12
|
+
import te from "@arcgis/core/request.js";
|
|
13
|
+
import { a as U, t as Ze, b as Q } from "../../chunks/functionalities.js";
|
|
14
|
+
import { ChatPromptTemplate as H } from "@langchain/core/prompts";
|
|
15
|
+
import { tool as Me } from "@langchain/core/tools";
|
|
16
|
+
import { s as et, a as tt } from "../../chunks/item.js";
|
|
17
|
+
import { g as at, e as nt, i as ot, c as rt, a as st } from "../../chunks/groups.js";
|
|
18
|
+
import it from "@arcgis/core/portal/Portal.js";
|
|
19
|
+
const Ce = (e) => {
|
|
20
20
|
const { portal: t, user: a } = e ?? {};
|
|
21
21
|
return !!e && !!t && !!a;
|
|
22
22
|
};
|
|
23
23
|
function x(e) {
|
|
24
|
-
if (!
|
|
24
|
+
if (!Ce(e))
|
|
25
25
|
throw new Error("Invalid context: PortalAssistantContext with portal and user is required.");
|
|
26
26
|
}
|
|
27
|
-
const
|
|
27
|
+
const ct = `
|
|
28
28
|
Write a concise, friendly success message for adding members to a group.
|
|
29
29
|
|
|
30
30
|
Rules:
|
|
@@ -39,9 +39,9 @@ Added members:
|
|
|
39
39
|
|
|
40
40
|
Not added members:
|
|
41
41
|
{notAddedMembers}
|
|
42
|
-
`,
|
|
42
|
+
`, ut = (e) => e.map((t) => `"${t}"`).join(", "), lt = s.object({
|
|
43
43
|
successMessage: s.string().default("")
|
|
44
|
-
}),
|
|
44
|
+
}), ae = "portal-group-creation", ne = "approveAddMembers", dt = async (e, t) => {
|
|
45
45
|
if (e.intentParams.intent !== "addMembers")
|
|
46
46
|
return {
|
|
47
47
|
status: "success",
|
|
@@ -53,7 +53,7 @@ Not added members:
|
|
|
53
53
|
status: "success",
|
|
54
54
|
outputMessage: "Create a group first, then add members using @mention usernames."
|
|
55
55
|
};
|
|
56
|
-
const n = e.intentParams.memberInfo.memberIdentifiers.map((
|
|
56
|
+
const n = e.intentParams.memberInfo.memberIdentifiers.map((g) => g.trim()).filter(Boolean);
|
|
57
57
|
if (!n.length)
|
|
58
58
|
return {
|
|
59
59
|
status: "success",
|
|
@@ -61,14 +61,14 @@ Not added members:
|
|
|
61
61
|
};
|
|
62
62
|
const r = `The following member(s) will be added to the newly created group:
|
|
63
63
|
|
|
64
|
-
${n.map((
|
|
64
|
+
${n.map((g) => `- **@${g}**`).join(`
|
|
65
65
|
`)}
|
|
66
66
|
|
|
67
67
|
Do you want to continue?`, { hitlResponse: i } = t?.configurable ?? {};
|
|
68
|
-
if (i?.agentId !==
|
|
69
|
-
const
|
|
70
|
-
agentId:
|
|
71
|
-
id:
|
|
68
|
+
if (i?.agentId !== ae || i.id !== ne) {
|
|
69
|
+
const g = {
|
|
70
|
+
agentId: ae,
|
|
71
|
+
id: ne,
|
|
72
72
|
kind: "booleanChoice",
|
|
73
73
|
message: r,
|
|
74
74
|
metadata: {
|
|
@@ -77,45 +77,45 @@ Do you want to continue?`, { hitlResponse: i } = t?.configurable ?? {};
|
|
|
77
77
|
members: [...n]
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
|
-
throw new
|
|
80
|
+
throw new J(g);
|
|
81
81
|
}
|
|
82
82
|
if (i.payload !== !0)
|
|
83
83
|
return {
|
|
84
84
|
status: "success",
|
|
85
85
|
outputMessage: "Okay, I cancelled adding members to the group."
|
|
86
86
|
};
|
|
87
|
-
await
|
|
88
|
-
{ text: `Adding members ${
|
|
87
|
+
await p(
|
|
88
|
+
{ text: `Adding members ${ut(n)}...`, agentName: "group-creation" },
|
|
89
89
|
t
|
|
90
90
|
);
|
|
91
91
|
const u = t?.configurable?.context;
|
|
92
92
|
x(u);
|
|
93
|
-
const { result: c, error: d } = await
|
|
93
|
+
const { result: c, error: d } = await Ye(u.portal, a, n);
|
|
94
94
|
if (d || !c)
|
|
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
|
-
const { addedUsernames: l, notAddedUsers:
|
|
99
|
+
const { addedUsernames: l, notAddedUsers: m } = c;
|
|
100
100
|
try {
|
|
101
|
-
const f = (await
|
|
102
|
-
promptText:
|
|
103
|
-
schema:
|
|
101
|
+
const f = (await v({
|
|
102
|
+
promptText: ct,
|
|
103
|
+
schema: lt,
|
|
104
104
|
modelTier: "fast",
|
|
105
105
|
inputVariables: {
|
|
106
106
|
addedMembers: l.join(", "),
|
|
107
107
|
notAddedMembers: JSON.stringify(
|
|
108
|
-
|
|
108
|
+
m.map((y) => ({ username: y.username, reason: y.error.message }))
|
|
109
109
|
)
|
|
110
110
|
}
|
|
111
111
|
})).successMessage;
|
|
112
112
|
if (f)
|
|
113
113
|
return { status: "success", outputMessage: f };
|
|
114
|
-
} catch (
|
|
115
|
-
console.error("Error generating add-members success message:",
|
|
114
|
+
} catch (g) {
|
|
115
|
+
console.error("Error generating add-members success message:", g);
|
|
116
116
|
}
|
|
117
117
|
return {};
|
|
118
|
-
},
|
|
118
|
+
}, pt = `
|
|
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
|
+
`, mt = `
|
|
130
130
|
Write a concise, friendly failure message after an attempt to create a portal group.
|
|
131
131
|
|
|
132
132
|
Rules:
|
|
@@ -141,11 +141,11 @@ Group title:
|
|
|
141
141
|
|
|
142
142
|
Failure reason:
|
|
143
143
|
{failureReason}
|
|
144
|
-
`,
|
|
144
|
+
`, oe = "portal-group-creation", re = "approveCreateGroup", gt = s.object({
|
|
145
145
|
successMessage: s.string().default("")
|
|
146
|
-
}),
|
|
146
|
+
}), ht = s.object({
|
|
147
147
|
failureMessage: s.string().default("")
|
|
148
|
-
}),
|
|
148
|
+
}), ft = async (e, t) => {
|
|
149
149
|
if (e.intentParams.intent !== "create")
|
|
150
150
|
return {
|
|
151
151
|
status: "success",
|
|
@@ -158,10 +158,10 @@ Failure reason:
|
|
|
158
158
|
outputMessage: "What title would you like for the new group?"
|
|
159
159
|
};
|
|
160
160
|
const n = `A group with the title **${a}** will be created. Do you want to continue?`, { hitlResponse: o } = t?.configurable;
|
|
161
|
-
if (o?.agentId !==
|
|
161
|
+
if (o?.agentId !== oe || o.id !== re) {
|
|
162
162
|
const d = {
|
|
163
|
-
agentId:
|
|
164
|
-
id:
|
|
163
|
+
agentId: oe,
|
|
164
|
+
id: re,
|
|
165
165
|
kind: "booleanChoice",
|
|
166
166
|
message: n,
|
|
167
167
|
metadata: {
|
|
@@ -170,36 +170,36 @@ Failure reason:
|
|
|
170
170
|
access: "private"
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
throw new
|
|
173
|
+
throw new J(d);
|
|
174
174
|
}
|
|
175
175
|
if (o.payload !== !0)
|
|
176
176
|
return {
|
|
177
177
|
status: "success",
|
|
178
178
|
outputMessage: `Okay, I cancelled creating **${a}**.`
|
|
179
179
|
};
|
|
180
|
-
await
|
|
180
|
+
await p({ text: `Creating group "${a}"...`, agentName: "group-creation" }, t);
|
|
181
181
|
const r = t?.configurable?.context;
|
|
182
182
|
x(r);
|
|
183
|
-
const { result: i, error: u } = await
|
|
183
|
+
const { result: i, error: u } = await He(r.portal, {
|
|
184
184
|
title: a,
|
|
185
185
|
access: "private"
|
|
186
186
|
});
|
|
187
187
|
if (u || !i) {
|
|
188
188
|
const d = u?.message?.trim() || "No additional details were provided.";
|
|
189
189
|
try {
|
|
190
|
-
const
|
|
191
|
-
promptText:
|
|
192
|
-
schema:
|
|
190
|
+
const m = (await v({
|
|
191
|
+
promptText: mt,
|
|
192
|
+
schema: ht,
|
|
193
193
|
modelTier: "fast",
|
|
194
194
|
inputVariables: {
|
|
195
195
|
groupTitle: a,
|
|
196
196
|
failureReason: d
|
|
197
197
|
}
|
|
198
198
|
})).failureMessage.trim();
|
|
199
|
-
if (
|
|
199
|
+
if (m)
|
|
200
200
|
return {
|
|
201
201
|
status: "success",
|
|
202
|
-
outputMessage:
|
|
202
|
+
outputMessage: m
|
|
203
203
|
};
|
|
204
204
|
} catch (l) {
|
|
205
205
|
console.error("Error generating create-group failure message:", l);
|
|
@@ -211,9 +211,9 @@ Failure reason:
|
|
|
211
211
|
}
|
|
212
212
|
const c = i.id;
|
|
213
213
|
try {
|
|
214
|
-
const l = (await
|
|
215
|
-
promptText:
|
|
216
|
-
schema:
|
|
214
|
+
const l = (await v({
|
|
215
|
+
promptText: pt,
|
|
216
|
+
schema: gt,
|
|
217
217
|
modelTier: "fast",
|
|
218
218
|
inputVariables: {
|
|
219
219
|
groupTitle: a
|
|
@@ -230,7 +230,7 @@ Failure reason:
|
|
|
230
230
|
console.error("Error generating create-group success message:", d);
|
|
231
231
|
}
|
|
232
232
|
return {};
|
|
233
|
-
},
|
|
233
|
+
}, b = (e) => {
|
|
234
234
|
for (let t = e.length - 1; t >= 0; t -= 1) {
|
|
235
235
|
const a = e[t];
|
|
236
236
|
if (a.type !== "human")
|
|
@@ -244,7 +244,7 @@ Failure reason:
|
|
|
244
244
|
).join(" ").trim();
|
|
245
245
|
}
|
|
246
246
|
return "";
|
|
247
|
-
},
|
|
247
|
+
}, yt = `
|
|
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,16 +270,16 @@ Examples:
|
|
|
270
270
|
|
|
271
271
|
User message:
|
|
272
272
|
{userMessage}
|
|
273
|
-
`,
|
|
273
|
+
`, wt = 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
|
|
280
|
-
const a =
|
|
281
|
-
promptText:
|
|
282
|
-
schema:
|
|
278
|
+
}), vt = async (e, t) => {
|
|
279
|
+
await p({ text: "Thinking about groups...", agentName: "group-creation" }, t);
|
|
280
|
+
const a = b(e.agentExecutionContext.messages).trim(), n = await v({
|
|
281
|
+
promptText: yt,
|
|
282
|
+
schema: wt,
|
|
283
283
|
modelTier: "default",
|
|
284
284
|
inputVariables: { userMessage: a }
|
|
285
285
|
}), o = n.title.trim(), r = n.memberIdentifiers.filter(Boolean), i = n.clarifyMessage.trim(), u = n.intent === "create" && !!o, c = n.intent === "addMembers" && r.length > 0;
|
|
@@ -288,7 +288,7 @@ User message:
|
|
|
288
288
|
status: "success",
|
|
289
289
|
outputMessage: !u && !c ? i : ""
|
|
290
290
|
};
|
|
291
|
-
},
|
|
291
|
+
}, bt = [
|
|
292
292
|
"general",
|
|
293
293
|
"about",
|
|
294
294
|
"homePage",
|
|
@@ -312,63 +312,61 @@ User message:
|
|
|
312
312
|
"openData",
|
|
313
313
|
"hub",
|
|
314
314
|
"orgExtensions"
|
|
315
|
-
],
|
|
315
|
+
], It = ["newItem", "createLayer", "developerCredentials"], xt = ["favorites", "group", "living-atlas", "org"], St = ["featured", "my", "organization"], Tt = ["overview", "content", "members", "settings"], Mt = ["licenses", "members", "overview", "reports", "settings", "status"], Ct = s.object({
|
|
316
316
|
destinationType: s.literal("portal-content"),
|
|
317
|
-
hash: s.enum(
|
|
317
|
+
hash: s.enum(xt).optional(),
|
|
318
318
|
queryParams: s.object({
|
|
319
|
-
newItem: s.enum(
|
|
319
|
+
newItem: s.enum(It).optional()
|
|
320
320
|
}).optional()
|
|
321
|
-
}),
|
|
321
|
+
}), At = s.object({
|
|
322
322
|
destinationType: s.literal("portal-groups"),
|
|
323
|
-
hash: s.enum(
|
|
324
|
-
}),
|
|
323
|
+
hash: s.enum(St).optional()
|
|
324
|
+
}), Nt = s.object({
|
|
325
325
|
destinationType: s.literal("portal-org"),
|
|
326
|
-
hash: s.enum(
|
|
326
|
+
hash: s.enum(Mt).optional(),
|
|
327
327
|
queryParams: s.object({
|
|
328
|
-
tab: s.enum(
|
|
328
|
+
tab: s.enum(bt).optional(),
|
|
329
329
|
section: s.string().optional(),
|
|
330
330
|
subsection: s.string().optional(),
|
|
331
331
|
period: s.string().optional(),
|
|
332
332
|
startTime: s.string().optional(),
|
|
333
333
|
endTime: s.string().optional()
|
|
334
334
|
}).optional()
|
|
335
|
-
}),
|
|
335
|
+
}), Pt = s.object({
|
|
336
336
|
destinationType: s.literal("portal-item"),
|
|
337
337
|
itemId: s.string().trim().min(1)
|
|
338
|
-
}),
|
|
338
|
+
}), Gt = s.object({
|
|
339
339
|
destinationType: s.literal("portal-group"),
|
|
340
|
-
groupId: s.string().trim().min(1)
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
Ct
|
|
355
|
-
]), xe = "portal-navigation", F = async (e, t) => {
|
|
340
|
+
groupId: s.string().trim().min(1),
|
|
341
|
+
hash: s.enum(Tt).optional(),
|
|
342
|
+
queryParams: s.record(s.string(), s.string()).optional()
|
|
343
|
+
}), qt = s.union([
|
|
344
|
+
Ct,
|
|
345
|
+
s.object({ destinationType: s.literal("portal-gallery") }),
|
|
346
|
+
Gt,
|
|
347
|
+
At,
|
|
348
|
+
Pt,
|
|
349
|
+
s.object({ destinationType: s.literal("portal-map-viewer") }),
|
|
350
|
+
s.object({ destinationType: s.literal("portal-notebooks") }),
|
|
351
|
+
Nt,
|
|
352
|
+
s.object({ destinationType: s.literal("portal-scene-viewer") })
|
|
353
|
+
]), Ae = "portal-navigation", F = async (e, t) => {
|
|
356
354
|
const a = t?.configurable?.context;
|
|
357
|
-
!
|
|
358
|
-
},
|
|
355
|
+
!Ce(a) || !a.navigationTargetMap?.[e.destinationType] || await _({ type: Ae, data: { ...e } }, t);
|
|
356
|
+
}, kt = async (e, t) => {
|
|
359
357
|
const a = e.createdGroupId ?? e.agentExecutionContext.sharedState.createdGroupId?.value;
|
|
360
|
-
return a ? (await
|
|
361
|
-
},
|
|
358
|
+
return a ? (await p({ text: "Preparing navigation...", agentName: "group-creation" }, t), await F({ destinationType: "portal-group", groupId: a }, t), {}) : {};
|
|
359
|
+
}, se = (e, t) => t ?? e, Ne = h.Root({
|
|
362
360
|
...G(),
|
|
363
361
|
// * Shared state between nodes (but not persisted to the agent execution context)
|
|
364
362
|
/** Parameters related to the user's intent for group creation actions */
|
|
365
|
-
intentParams: h({ reducer:
|
|
363
|
+
intentParams: h({ reducer: se, default: () => ({ intent: "clarify" }) }),
|
|
366
364
|
/** The ID of the group that was created
|
|
367
365
|
* even though we already have this in the shared state
|
|
368
366
|
* we still need it here to also share between nodes
|
|
369
367
|
*/
|
|
370
|
-
createdGroupId: h({ reducer:
|
|
371
|
-
}),
|
|
368
|
+
createdGroupId: h({ reducer: se, default: () => "" })
|
|
369
|
+
}), Et = () => new N(Ne).addNode("detectGroupCreationIntent", vt).addNode("createPortalGroup", ft).addNode("addMembersToPortalGroup", dt).addNode("suggestCreatedGroupNavigation", kt).addEdge(P, "detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent", (t) => {
|
|
372
370
|
switch (t.intentParams.intent) {
|
|
373
371
|
case "create":
|
|
374
372
|
return "createPortalGroup";
|
|
@@ -377,41 +375,41 @@ User message:
|
|
|
377
375
|
default:
|
|
378
376
|
return w;
|
|
379
377
|
}
|
|
380
|
-
}).addEdge("createPortalGroup", "suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup", "suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation", w),
|
|
378
|
+
}).addEdge("createPortalGroup", "suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup", "suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation", w), zt = String.raw`- **portal-group-creation** - Portal group creation assistant:
|
|
381
379
|
- creates a new ArcGIS Portal group for the signed-in user
|
|
382
380
|
- adds users to the newly created group using @mention usernames
|
|
383
|
-
`,
|
|
381
|
+
`, Dt = {
|
|
384
382
|
id: "portal-group-creation",
|
|
385
383
|
name: "Portal Group Creation",
|
|
386
|
-
description:
|
|
387
|
-
createGraph:
|
|
388
|
-
workspace:
|
|
389
|
-
},
|
|
390
|
-
const t = e?.[
|
|
384
|
+
description: zt,
|
|
385
|
+
createGraph: Et,
|
|
386
|
+
workspace: Ne
|
|
387
|
+
}, Pe = "portalDocAssistantMemory", $t = () => ({ conversationId: "" }), Rt = (e) => {
|
|
388
|
+
const t = e?.[Pe]?.value;
|
|
391
389
|
if (!t || typeof t != "object")
|
|
392
|
-
return
|
|
390
|
+
return $t();
|
|
393
391
|
const a = t;
|
|
394
392
|
return {
|
|
395
393
|
conversationId: typeof a.conversationId == "string" ? a.conversationId : ""
|
|
396
394
|
};
|
|
397
|
-
},
|
|
398
|
-
[
|
|
399
|
-
}),
|
|
395
|
+
}, Ut = (e) => ({
|
|
396
|
+
[Pe]: { value: e }
|
|
397
|
+
}), Ft = {
|
|
400
398
|
pipeline: {
|
|
401
399
|
follow_up: { allow: !1 }
|
|
402
400
|
}
|
|
403
401
|
};
|
|
404
|
-
function
|
|
402
|
+
function Ot(e) {
|
|
405
403
|
return {
|
|
406
404
|
kind: "DocAIAssistantRequest",
|
|
407
405
|
filters: {
|
|
408
|
-
|
|
406
|
+
...Ft,
|
|
409
407
|
persona: { persona: e }
|
|
410
408
|
}
|
|
411
409
|
};
|
|
412
410
|
}
|
|
413
|
-
const
|
|
414
|
-
async function
|
|
411
|
+
const Lt = "https://www.arcgis.com/sharing/rest";
|
|
412
|
+
async function jt({
|
|
415
413
|
portal: e,
|
|
416
414
|
question: t,
|
|
417
415
|
persona: a,
|
|
@@ -421,18 +419,18 @@ async function Ut({
|
|
|
421
419
|
skillId: i
|
|
422
420
|
}) {
|
|
423
421
|
i ??= "doc_ai_assistant";
|
|
424
|
-
const u =
|
|
422
|
+
const u = Ot(a), c = await Vt({
|
|
425
423
|
portal: e,
|
|
426
424
|
skillId: i,
|
|
427
425
|
message: t,
|
|
428
426
|
options: { context: u, previousConversationId: n, useProdDocAssistant: o, signal: r }
|
|
429
427
|
});
|
|
430
428
|
return {
|
|
431
|
-
reply:
|
|
429
|
+
reply: Bt(c, i),
|
|
432
430
|
conversationId: c[0]?.conversationId ?? ""
|
|
433
431
|
};
|
|
434
432
|
}
|
|
435
|
-
async function
|
|
433
|
+
async function Vt({
|
|
436
434
|
portal: e,
|
|
437
435
|
skillId: t,
|
|
438
436
|
message: a,
|
|
@@ -440,8 +438,8 @@ async function Ft({
|
|
|
440
438
|
}) {
|
|
441
439
|
const o = e.helperServices.aiAssistantServices.url, i = `${n.useProdDocAssistant ? "https://aiservices-beta.arcgis.com" : o}/skills/${t}/chat`, c = {
|
|
442
440
|
"Content-Type": "application/json",
|
|
443
|
-
token: n.useProdDocAssistant ? (await
|
|
444
|
-
}, d = await
|
|
441
|
+
token: n.useProdDocAssistant ? (await ee.getCredential(Lt, { oAuthPopupConfirmation: !1 })).token : ee.findCredential(e.url)?.token ?? ""
|
|
442
|
+
}, d = await te(i, {
|
|
445
443
|
method: "post",
|
|
446
444
|
body: JSON.stringify({
|
|
447
445
|
message: a,
|
|
@@ -455,26 +453,26 @@ async function Ft({
|
|
|
455
453
|
throw new Error(`Doc assistant chat failed (${d.httpStatus})`, {
|
|
456
454
|
cause: d.data
|
|
457
455
|
});
|
|
458
|
-
const l = d.data,
|
|
456
|
+
const l = d.data, m = [l], { conversationId: g, inquiryId: f } = l, y = async (M, q) => {
|
|
459
457
|
if (!q)
|
|
460
458
|
return;
|
|
461
|
-
await
|
|
462
|
-
const
|
|
459
|
+
await Ze(500);
|
|
460
|
+
const S = await te(i, {
|
|
463
461
|
method: "post",
|
|
464
|
-
body: JSON.stringify({ conversationId:
|
|
462
|
+
body: JSON.stringify({ conversationId: g, inquiryId: f, ackSequenceNumber: M }),
|
|
465
463
|
headers: c,
|
|
466
464
|
signal: n.signal
|
|
467
465
|
});
|
|
468
|
-
if (
|
|
469
|
-
throw new Error(`Doc assistant poll failed (${
|
|
470
|
-
cause:
|
|
466
|
+
if (S.httpStatus !== 200)
|
|
467
|
+
throw new Error(`Doc assistant poll failed (${S.httpStatus})`, {
|
|
468
|
+
cause: S.data
|
|
471
469
|
});
|
|
472
|
-
const C =
|
|
473
|
-
|
|
470
|
+
const C = S.data;
|
|
471
|
+
m.push(C), await y(C.sequenceNumber, C.hasMore);
|
|
474
472
|
};
|
|
475
|
-
return l.hasMore && await y(l.sequenceNumber, l.hasMore),
|
|
473
|
+
return l.hasMore && await y(l.sequenceNumber, l.hasMore), m;
|
|
476
474
|
}
|
|
477
|
-
function
|
|
475
|
+
function Bt(e, t) {
|
|
478
476
|
switch (t) {
|
|
479
477
|
case "doc_chat":
|
|
480
478
|
return e.find((a) => a.message != null)?.message ?? "";
|
|
@@ -492,11 +490,11 @@ function Ot(e, t) {
|
|
|
492
490
|
return U(t);
|
|
493
491
|
}
|
|
494
492
|
}
|
|
495
|
-
const
|
|
493
|
+
const Kt = async (e, t) => {
|
|
496
494
|
const a = performance.now();
|
|
497
495
|
try {
|
|
498
|
-
await
|
|
499
|
-
const n =
|
|
496
|
+
await p({ text: "Asking documentation assistant...", agentName: "doc-assistant" }, t);
|
|
497
|
+
const n = b(e.agentExecutionContext.messages).trim();
|
|
500
498
|
if (!n)
|
|
501
499
|
return {
|
|
502
500
|
status: "success",
|
|
@@ -504,7 +502,7 @@ const Lt = async (e, t) => {
|
|
|
504
502
|
};
|
|
505
503
|
const o = t?.configurable?.context;
|
|
506
504
|
x(o);
|
|
507
|
-
const r =
|
|
505
|
+
const r = Rt(e.agentExecutionContext.sharedState), { reply: i, conversationId: u } = await jt({
|
|
508
506
|
portal: o.portal,
|
|
509
507
|
question: n,
|
|
510
508
|
previousConversationId: r.conversationId || void 0,
|
|
@@ -515,7 +513,7 @@ const Lt = async (e, t) => {
|
|
|
515
513
|
return {
|
|
516
514
|
status: "success",
|
|
517
515
|
outputMessage: i.trim() || "I could not retrieve a response from the documentation assistant.",
|
|
518
|
-
sharedStatePatch:
|
|
516
|
+
sharedStatePatch: Ut({
|
|
519
517
|
conversationId: u || r.conversationId
|
|
520
518
|
})
|
|
521
519
|
};
|
|
@@ -526,7 +524,7 @@ const Lt = async (e, t) => {
|
|
|
526
524
|
durationMs: Number((performance.now() - a).toFixed(1))
|
|
527
525
|
});
|
|
528
526
|
}
|
|
529
|
-
},
|
|
527
|
+
}, Ge = Me(
|
|
530
528
|
async ({ groupTitle: e }, t) => {
|
|
531
529
|
const a = e.trim();
|
|
532
530
|
if (!a)
|
|
@@ -534,7 +532,7 @@ const Lt = async (e, t) => {
|
|
|
534
532
|
const n = t?.configurable?.context;
|
|
535
533
|
x(n);
|
|
536
534
|
try {
|
|
537
|
-
return (await
|
|
535
|
+
return (await Xe(n.portal, { query: `title:${a}`, num: 1 }))?.results[0]?.id || null;
|
|
538
536
|
} catch (o) {
|
|
539
537
|
return console.error("Error searching for portal group by title:", o), null;
|
|
540
538
|
}
|
|
@@ -546,14 +544,14 @@ const Lt = async (e, t) => {
|
|
|
546
544
|
groupTitle: s.string().describe("The portal group title to resolve to a group id.")
|
|
547
545
|
})
|
|
548
546
|
}
|
|
549
|
-
),
|
|
547
|
+
), qe = Me(
|
|
550
548
|
async ({ itemTitle: e }, t) => {
|
|
551
549
|
const a = e.trim();
|
|
552
550
|
if (!a)
|
|
553
551
|
return null;
|
|
554
552
|
const n = t?.configurable?.context;
|
|
555
553
|
x(n);
|
|
556
|
-
const { result: o, error: r } = await
|
|
554
|
+
const { result: o, error: r } = await et(n.portal, a, { num: 1 });
|
|
557
555
|
return r && console.error("Error searching for portal item by title:", r), o?.results[0]?.id || null;
|
|
558
556
|
},
|
|
559
557
|
{
|
|
@@ -571,7 +569,7 @@ function A(e, t = "#") {
|
|
|
571
569
|
const n = e.match(new RegExp(`\\${t}([^\\s"']+)`, "u"));
|
|
572
570
|
return n?.[1] ? n[1].trim() : null;
|
|
573
571
|
}
|
|
574
|
-
function
|
|
572
|
+
function Qt(e) {
|
|
575
573
|
const t = Q(e).flatMap((a) => {
|
|
576
574
|
const n = a, o = e[a], r = [
|
|
577
575
|
n,
|
|
@@ -587,11 +585,11 @@ function jt(e) {
|
|
|
587
585
|
});
|
|
588
586
|
return Object.fromEntries(t);
|
|
589
587
|
}
|
|
590
|
-
function
|
|
588
|
+
function Wt(e) {
|
|
591
589
|
return Object.entries(e).map(([t, { description: a, hints: n }]) => ` - ${t}: ${a} (hints: ${n.join(", ")})`).join(`
|
|
592
590
|
`);
|
|
593
591
|
}
|
|
594
|
-
const
|
|
592
|
+
const Jt = {
|
|
595
593
|
// Example prompt: "Take me to my content"
|
|
596
594
|
"portal-content": {
|
|
597
595
|
description: "The main content page of the portal.",
|
|
@@ -725,13 +723,13 @@ const Bt = {
|
|
|
725
723
|
}
|
|
726
724
|
}
|
|
727
725
|
}
|
|
728
|
-
},
|
|
726
|
+
}, ke = Qt(Jt), _t = Q(ke), Yt = Wt(ke), Ht = `
|
|
729
727
|
You decide whether the assistant response should include a navigation action to ArcGIS Portal.
|
|
730
728
|
|
|
731
729
|
Given the user question and assistant response:
|
|
732
730
|
- Decide if a navigation action would help the user complete the task.
|
|
733
731
|
- If yes, choose one destinationType:
|
|
734
|
-
${
|
|
732
|
+
${Yt}
|
|
735
733
|
|
|
736
734
|
Rules:
|
|
737
735
|
- Only suggest navigation when you are highly confident the destination will help complete the user's task.
|
|
@@ -754,39 +752,39 @@ User question:
|
|
|
754
752
|
|
|
755
753
|
Assistant response:
|
|
756
754
|
{response}
|
|
757
|
-
`,
|
|
755
|
+
`, ie = s.object({
|
|
758
756
|
shouldSuggestNavigation: s.boolean().default(!1),
|
|
759
|
-
destinationType: s.enum(["none", ...
|
|
757
|
+
destinationType: s.enum(["none", ..._t]).default("none"),
|
|
760
758
|
itemId: s.string().default(""),
|
|
761
759
|
groupId: s.string().default(""),
|
|
762
760
|
confidence: s.number().min(0).max(1).default(0)
|
|
763
761
|
});
|
|
764
|
-
let
|
|
765
|
-
async function
|
|
766
|
-
return
|
|
762
|
+
let ce;
|
|
763
|
+
async function Xt() {
|
|
764
|
+
return ce ??= Y({ modelTier: "fast" }), await ce;
|
|
767
765
|
}
|
|
768
|
-
const
|
|
766
|
+
const Zt = async (e, t) => {
|
|
769
767
|
const a = performance.now();
|
|
770
768
|
try {
|
|
771
|
-
await
|
|
769
|
+
await p({ text: "Extracting navigation intent...", agentName: "doc-assistant" }, t);
|
|
772
770
|
const n = e.outputMessage.trim();
|
|
773
771
|
if (!n)
|
|
774
772
|
return {};
|
|
775
|
-
const o =
|
|
773
|
+
const o = b(e.agentExecutionContext.messages).trim(), r = await H.fromTemplate(Ht).format({
|
|
776
774
|
question: o,
|
|
777
775
|
response: n
|
|
778
|
-
}), u = (await
|
|
776
|
+
}), u = (await Xt()).withStructuredOutput(ie), c = ie.parse(await u.invoke(r));
|
|
779
777
|
if (!c.shouldSuggestNavigation || c.destinationType === "none")
|
|
780
778
|
return {};
|
|
781
779
|
if (c.destinationType === "portal-item" && !c.itemId) {
|
|
782
780
|
const l = A(o, "#");
|
|
783
|
-
l && (c.itemId = await
|
|
781
|
+
l && (c.itemId = await qe.invoke({ itemTitle: l }, t) ?? "");
|
|
784
782
|
}
|
|
785
783
|
if (c.destinationType === "portal-group" && !c.groupId) {
|
|
786
784
|
const l = A(o, "$") ?? A(o, "#");
|
|
787
|
-
l && (c.groupId = await
|
|
785
|
+
l && (c.groupId = await Ge.invoke({ groupTitle: l }, t) ?? "");
|
|
788
786
|
}
|
|
789
|
-
const d =
|
|
787
|
+
const d = ea(c);
|
|
790
788
|
return d ? (await F(d, t), {}) : {};
|
|
791
789
|
} finally {
|
|
792
790
|
console.info("[arcgis-portal-ai-assistant] node timing", {
|
|
@@ -796,7 +794,7 @@ const _t = async (e, t) => {
|
|
|
796
794
|
});
|
|
797
795
|
}
|
|
798
796
|
};
|
|
799
|
-
function
|
|
797
|
+
function ea({
|
|
800
798
|
destinationType: e,
|
|
801
799
|
itemId: t,
|
|
802
800
|
groupId: a
|
|
@@ -822,7 +820,7 @@ function Yt({
|
|
|
822
820
|
case "portal-content-new-item-developer-credentials":
|
|
823
821
|
return {
|
|
824
822
|
queryParams: {
|
|
825
|
-
newItem:
|
|
823
|
+
newItem: ta[e]
|
|
826
824
|
},
|
|
827
825
|
destinationType: "portal-content"
|
|
828
826
|
};
|
|
@@ -830,11 +828,11 @@ function Yt({
|
|
|
830
828
|
case "portal-content-group":
|
|
831
829
|
case "portal-content-living-atlas":
|
|
832
830
|
case "portal-content-organization":
|
|
833
|
-
return { destinationType: "portal-content", hash:
|
|
831
|
+
return { destinationType: "portal-content", hash: aa[e] };
|
|
834
832
|
case "portal-groups-featured":
|
|
835
833
|
case "portal-groups-my":
|
|
836
834
|
case "portal-groups-organization":
|
|
837
|
-
return { destinationType: "portal-groups", hash:
|
|
835
|
+
return { destinationType: "portal-groups", hash: na[e] };
|
|
838
836
|
case "portal-org-security-custom-sign-in":
|
|
839
837
|
case "portal-org-security-logins":
|
|
840
838
|
case "portal-org-security-change-login-provider":
|
|
@@ -846,7 +844,7 @@ function Yt({
|
|
|
846
844
|
hash: "settings",
|
|
847
845
|
queryParams: {
|
|
848
846
|
tab: "security",
|
|
849
|
-
subsection:
|
|
847
|
+
subsection: oa[e]
|
|
850
848
|
}
|
|
851
849
|
};
|
|
852
850
|
case "portal-item":
|
|
@@ -859,51 +857,51 @@ function Yt({
|
|
|
859
857
|
return U(e);
|
|
860
858
|
}
|
|
861
859
|
}
|
|
862
|
-
const
|
|
860
|
+
const ta = {
|
|
863
861
|
"portal-content-new-item": "newItem",
|
|
864
862
|
"portal-content-new-item-feature-layer": "createLayer",
|
|
865
863
|
"portal-content-new-item-developer-credentials": "developerCredentials"
|
|
866
|
-
},
|
|
864
|
+
}, aa = {
|
|
867
865
|
"portal-content-favorites": "favorites",
|
|
868
866
|
"portal-content-group": "group",
|
|
869
867
|
"portal-content-living-atlas": "living-atlas",
|
|
870
868
|
"portal-content-organization": "org"
|
|
871
|
-
},
|
|
869
|
+
}, na = {
|
|
872
870
|
"portal-groups-featured": "featured",
|
|
873
871
|
"portal-groups-my": "my",
|
|
874
872
|
"portal-groups-organization": "organization"
|
|
875
|
-
},
|
|
873
|
+
}, oa = {
|
|
876
874
|
"portal-org-security-custom-sign-in": "customSignInSection",
|
|
877
875
|
"portal-org-security-logins": "loginsSection",
|
|
878
876
|
"portal-org-security-change-login-provider": "changeLoginProviderSection",
|
|
879
877
|
"portal-org-security-multifactor-auth": "multiFactorAuthSection",
|
|
880
878
|
"portal-org-security-multifactor-enforcement": "multifactorEnforcementSection",
|
|
881
879
|
"portal-org-security-multifactor-designated-admins": "multifactorDesignatedAdminsSection"
|
|
882
|
-
},
|
|
880
|
+
}, Ee = h.Root({
|
|
883
881
|
...G()
|
|
884
|
-
}),
|
|
882
|
+
}), ra = () => new N(Ee).addNode("answerDocQuestion", Kt).addNode("extractNavigationIntent", Zt).addEdge(P, "answerDocQuestion").addEdge("answerDocQuestion", "extractNavigationIntent").addEdge("extractNavigationIntent", w), sa = String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
|
|
885
883
|
- answers general ArcGIS, Portal, Enterprise, and JavaScript SDK questions
|
|
886
884
|
- acts as a fallback when specialized agents are not applicable
|
|
887
|
-
`,
|
|
885
|
+
`, ia = {
|
|
888
886
|
id: "portal-doc-assistant",
|
|
889
887
|
name: "Portal Doc Assistant",
|
|
890
|
-
description:
|
|
891
|
-
createGraph:
|
|
892
|
-
workspace:
|
|
893
|
-
},
|
|
888
|
+
description: sa,
|
|
889
|
+
createGraph: ra,
|
|
890
|
+
workspace: Ee
|
|
891
|
+
}, ca = () => ({ latestGroupId: null, memory: {} }), O = (e) => {
|
|
894
892
|
const t = e?.agentExecutionContext.sharedState.portalGroupSummaryMemory?.value;
|
|
895
|
-
return t ? { latestGroupId: t.latestGroupId, memory: t.memory } :
|
|
896
|
-
},
|
|
893
|
+
return t ? { latestGroupId: t.latestGroupId, memory: t.memory } : ca();
|
|
894
|
+
}, ze = `
|
|
897
895
|
Shared markdown formatting rules:
|
|
898
896
|
- Use clear markdown headings (##) to separate sections.
|
|
899
897
|
- Use concise bullet points for lists of facts, counts, or signals.
|
|
900
898
|
- Emphasize key metrics with bold labels (for example: **Recent items:** 4).
|
|
901
899
|
- Keep wording direct and analytical; avoid filler language but make sure the language is friendly.
|
|
902
900
|
- Do not include raw internal IDs unless explicitly requested.
|
|
903
|
-
`,
|
|
901
|
+
`, ua = `
|
|
904
902
|
You answer follow-up questions about ArcGIS group analytics.
|
|
905
903
|
|
|
906
|
-
${
|
|
904
|
+
${ze}
|
|
907
905
|
|
|
908
906
|
Ground your answer in the provided group analytics summary and context.
|
|
909
907
|
If the answer is not available from the provided context, state that clearly and suggest what to check next.
|
|
@@ -925,14 +923,14 @@ Group full context:
|
|
|
925
923
|
|
|
926
924
|
Question:
|
|
927
925
|
{question}
|
|
928
|
-
`,
|
|
929
|
-
await
|
|
930
|
-
const a = O(e), n = e.groupSummaryGroupId ?? a.latestGroupId, o = n ? a.memory[n] : void 0, r = e.groupSummaryQuestion ||
|
|
926
|
+
`, la = async (e, t) => {
|
|
927
|
+
await p({ text: "Answering group follow-up...", agentName: "group-analytics" }, t);
|
|
928
|
+
const a = O(e), n = e.groupSummaryGroupId ?? a.latestGroupId, o = n ? a.memory[n] : void 0, r = e.groupSummaryQuestion || b(e.agentExecutionContext.messages);
|
|
931
929
|
return o ? {
|
|
932
930
|
status: "success",
|
|
933
|
-
outputMessage: (await
|
|
934
|
-
promptText:
|
|
935
|
-
schema:
|
|
931
|
+
outputMessage: (await v({
|
|
932
|
+
promptText: ua,
|
|
933
|
+
schema: da,
|
|
936
934
|
modelTier: "default",
|
|
937
935
|
inputVariables: {
|
|
938
936
|
summary: o.summary,
|
|
@@ -944,10 +942,10 @@ Question:
|
|
|
944
942
|
status: "success",
|
|
945
943
|
outputMessage: "I do not have group analytics context yet. Ask me to analyze a group first with analyze group <group id>."
|
|
946
944
|
};
|
|
947
|
-
},
|
|
945
|
+
}, da = s.object({
|
|
948
946
|
answer: s.string(),
|
|
949
947
|
isRelevant: s.boolean()
|
|
950
|
-
}),
|
|
948
|
+
}), pa = `
|
|
951
949
|
Classify the user's request for ArcGIS Portal group analytics.
|
|
952
950
|
|
|
953
951
|
Rules:
|
|
@@ -976,18 +974,18 @@ hasAnalyticsContext:
|
|
|
976
974
|
|
|
977
975
|
User message:
|
|
978
976
|
{userMessage}
|
|
979
|
-
`,
|
|
980
|
-
await
|
|
981
|
-
const a =
|
|
977
|
+
`, ma = async (e, t) => {
|
|
978
|
+
await p({ text: "Analyzing group-analytics intent...", agentName: "group-analytics" }, t);
|
|
979
|
+
const a = b(e.agentExecutionContext.messages), n = !!O(e).latestGroupId, o = await H.fromTemplate(pa).format({
|
|
982
980
|
userMessage: a,
|
|
983
981
|
hasAnalyticsContext: String(n)
|
|
984
|
-
}), i = (await
|
|
982
|
+
}), i = (await Y({ modelTier: "fast" })).withStructuredOutput(ue), u = ue.parse(await i.invoke(o));
|
|
985
983
|
let c = u.groupId;
|
|
986
984
|
if ((u.intent === "summarize" || u.intent === "navigation") && !c) {
|
|
987
985
|
const y = A(a, "$");
|
|
988
|
-
y && (c = await
|
|
986
|
+
y && (c = await Ge.invoke({ groupTitle: y }, t) ?? "");
|
|
989
987
|
}
|
|
990
|
-
const { intent: d, question: l } = u,
|
|
988
|
+
const { intent: d, question: l } = u, m = d === "summarize" && !c, g = d === "followUp" && !(l ?? "").trim(), f = d === "clarify" || m || g;
|
|
991
989
|
return {
|
|
992
990
|
groupSummaryIntent: f ? "clarify" : d,
|
|
993
991
|
groupSummaryGroupId: c || null,
|
|
@@ -995,23 +993,23 @@ User message:
|
|
|
995
993
|
status: "success",
|
|
996
994
|
outputMessage: f ? "Please clarify with a group id or title" : ""
|
|
997
995
|
};
|
|
998
|
-
},
|
|
996
|
+
}, ue = s.object({
|
|
999
997
|
intent: s.enum(["summarize", "followUp", "navigation", "clarify"]),
|
|
1000
998
|
groupId: s.string().default(""),
|
|
1001
999
|
question: s.string().default("")
|
|
1002
|
-
}),
|
|
1000
|
+
}), ga = async (e, t) => {
|
|
1003
1001
|
const a = O(e), n = e.groupSummaryGroupId ?? a.latestGroupId;
|
|
1004
|
-
return await
|
|
1002
|
+
return await p({ text: "Preparing navigation...", agentName: "group-analytics" }, t), await F(
|
|
1005
1003
|
n ? { destinationType: "portal-group", groupId: n } : { destinationType: "portal-groups" },
|
|
1006
1004
|
t
|
|
1007
1005
|
), { status: "success" };
|
|
1008
1006
|
};
|
|
1009
|
-
function
|
|
1007
|
+
function De({ timestamp: e, now: t, windowMs: a }) {
|
|
1010
1008
|
return e ? t - e <= a : !1;
|
|
1011
1009
|
}
|
|
1012
|
-
const
|
|
1013
|
-
function
|
|
1014
|
-
const t =
|
|
1010
|
+
const ha = 720 * 60 * 60 * 1e3;
|
|
1011
|
+
function fa(e) {
|
|
1012
|
+
const t = at(e);
|
|
1015
1013
|
return {
|
|
1016
1014
|
id: e.id ?? "",
|
|
1017
1015
|
title: e.title ?? "",
|
|
@@ -1024,10 +1022,10 @@ function pa(e) {
|
|
|
1024
1022
|
modified: e.modified?.getTime(),
|
|
1025
1023
|
isInvitationOnly: e.isInvitationOnly,
|
|
1026
1024
|
sourceSignals: {
|
|
1027
|
-
capabilities:
|
|
1028
|
-
membershipAccess:
|
|
1029
|
-
isOpenData:
|
|
1030
|
-
isDistributedCollaborationGroup:
|
|
1025
|
+
capabilities: st(e),
|
|
1026
|
+
membershipAccess: rt(e),
|
|
1027
|
+
isOpenData: ot(e),
|
|
1028
|
+
isDistributedCollaborationGroup: nt(e),
|
|
1031
1029
|
orgId: t.orgId,
|
|
1032
1030
|
hiddenMembers: t.hiddenMembers,
|
|
1033
1031
|
isViewOnly: t.isViewOnly,
|
|
@@ -1036,7 +1034,7 @@ function pa(e) {
|
|
|
1036
1034
|
}
|
|
1037
1035
|
};
|
|
1038
1036
|
}
|
|
1039
|
-
async function
|
|
1037
|
+
async function ya(e) {
|
|
1040
1038
|
const t = { owner: e.owner ?? "", admins: [], users: [] };
|
|
1041
1039
|
try {
|
|
1042
1040
|
return await e.fetchMembers();
|
|
@@ -1044,7 +1042,7 @@ async function ma(e) {
|
|
|
1044
1042
|
return console.warn("Unable to fetch group members for analytics context", a), t;
|
|
1045
1043
|
}
|
|
1046
1044
|
}
|
|
1047
|
-
function
|
|
1045
|
+
function wa(e) {
|
|
1048
1046
|
return e.map((t) => ({
|
|
1049
1047
|
id: t.id ?? "",
|
|
1050
1048
|
title: t.title ?? "Untitled",
|
|
@@ -1054,43 +1052,43 @@ function ga(e) {
|
|
|
1054
1052
|
modified: t.modified?.getTime()
|
|
1055
1053
|
}));
|
|
1056
1054
|
}
|
|
1057
|
-
function
|
|
1055
|
+
function va(e, t) {
|
|
1058
1056
|
return e.filter(
|
|
1059
|
-
(a) => a.modified ?
|
|
1057
|
+
(a) => a.modified ? De({ timestamp: a.modified, now: t, windowMs: ha }) : !1
|
|
1060
1058
|
);
|
|
1061
1059
|
}
|
|
1062
|
-
function
|
|
1060
|
+
function ba(e) {
|
|
1063
1061
|
const t = /* @__PURE__ */ new Map();
|
|
1064
1062
|
for (const a of e)
|
|
1065
1063
|
t.set(a.type, (t.get(a.type) ?? 0) + 1);
|
|
1066
1064
|
return [...t.entries()].sort((a, n) => n[1] - a[1] || a[0].localeCompare(n[0])).slice(0, 6).map(([a, n]) => ({ type: a, count: n }));
|
|
1067
1065
|
}
|
|
1068
|
-
async function
|
|
1069
|
-
const t = await e.queryItems({ num: 20, sortField: "modified", sortOrder: "desc" }), a =
|
|
1066
|
+
async function Ia(e) {
|
|
1067
|
+
const t = await e.queryItems({ num: 20, sortField: "modified", sortOrder: "desc" }), a = wa(t.results), n = Date.now();
|
|
1070
1068
|
return {
|
|
1071
1069
|
total: t.total,
|
|
1072
1070
|
topItems: a,
|
|
1073
|
-
recentlyModifiedItems:
|
|
1074
|
-
topItemTypes:
|
|
1071
|
+
recentlyModifiedItems: va(a, n),
|
|
1072
|
+
topItemTypes: ba(a)
|
|
1075
1073
|
};
|
|
1076
1074
|
}
|
|
1077
|
-
async function
|
|
1075
|
+
async function xa(e, t) {
|
|
1078
1076
|
if (!t)
|
|
1079
1077
|
return { error: { code: "missingGroupId", message: "Group id is required." } };
|
|
1080
1078
|
try {
|
|
1081
1079
|
const n = (await e.queryGroups({ query: `id:${t}`, num: 1 })).results[0];
|
|
1082
1080
|
if (!n)
|
|
1083
1081
|
return { error: { code: "groupNotFound", message: `No group found for id: ${t}` } };
|
|
1084
|
-
const o =
|
|
1082
|
+
const o = fa(n), r = await ya(n), i = await Ia(n);
|
|
1085
1083
|
return { result: { group: o, members: r, items: i } };
|
|
1086
1084
|
} catch (a) {
|
|
1087
1085
|
return console.error("Error fetching portal group analytics context:", a), { error: { code: "unhandledError" } };
|
|
1088
1086
|
}
|
|
1089
1087
|
}
|
|
1090
|
-
const
|
|
1088
|
+
const Sa = `
|
|
1091
1089
|
You summarize ArcGIS Portal groups based on structured context and deterministic activity signals.
|
|
1092
1090
|
|
|
1093
|
-
${
|
|
1091
|
+
${ze}
|
|
1094
1092
|
|
|
1095
1093
|
Output format requirements:
|
|
1096
1094
|
- Return concise markdown with clear sections in this order:
|
|
@@ -1126,51 +1124,51 @@ Group context:
|
|
|
1126
1124
|
|
|
1127
1125
|
Deterministic signals:
|
|
1128
1126
|
{deterministicSignals}
|
|
1129
|
-
`,
|
|
1127
|
+
`, Ta = 2160 * 60 * 60 * 1e3, Ma = async (e, t) => {
|
|
1130
1128
|
const a = e.groupSummaryGroupId;
|
|
1131
1129
|
if (!a)
|
|
1132
1130
|
return {
|
|
1133
1131
|
status: "success",
|
|
1134
1132
|
outputMessage: 'Please clarify with analyze group <group id>, analyze group $<title>, or analyze group $"<title with spaces>".'
|
|
1135
1133
|
};
|
|
1136
|
-
await
|
|
1134
|
+
await p({ text: `Analyzing group ${a}...`, agentName: "group-analytics" }, t);
|
|
1137
1135
|
const n = t?.configurable?.context;
|
|
1138
1136
|
x(n);
|
|
1139
|
-
const { result: o, error: r } = await
|
|
1137
|
+
const { result: o, error: r } = await xa(n.portal, a);
|
|
1140
1138
|
if (r || !o)
|
|
1141
|
-
return await
|
|
1139
|
+
return await p({ text: "Failed to fetch group context", agentName: "group-analytics" }, t), {
|
|
1142
1140
|
status: "success",
|
|
1143
1141
|
outputMessage: "Unable to retrieve group context for analytics."
|
|
1144
1142
|
};
|
|
1145
|
-
const { group: i, items: u } = o, c = Date.now(), d = i.modified, l = d ?
|
|
1146
|
-
promptText:
|
|
1147
|
-
schema:
|
|
1143
|
+
const { group: i, items: u } = o, c = Date.now(), d = i.modified, l = d ? De({ timestamp: d, now: c, windowMs: Ta }) : !1, m = u.recentlyModifiedItems.length, g = m > 0, f = l || g, y = await v({
|
|
1144
|
+
promptText: Sa,
|
|
1145
|
+
schema: Ca,
|
|
1148
1146
|
modelTier: "default",
|
|
1149
1147
|
inputVariables: {
|
|
1150
1148
|
context: JSON.stringify(o),
|
|
1151
1149
|
deterministicSignals: JSON.stringify({
|
|
1152
1150
|
isGroupActive: f,
|
|
1153
1151
|
isGroupRecentlyModified: l,
|
|
1154
|
-
hasRecentlyAddedOrUpdatedContent:
|
|
1155
|
-
recentItemCount:
|
|
1152
|
+
hasRecentlyAddedOrUpdatedContent: g,
|
|
1153
|
+
recentItemCount: m
|
|
1156
1154
|
})
|
|
1157
1155
|
}
|
|
1158
|
-
}), { followUpQuestions: M, summary: q } = y,
|
|
1156
|
+
}), { followUpQuestions: M, summary: q } = y, S = O(e), C = {
|
|
1159
1157
|
latestGroupId: a,
|
|
1160
1158
|
memory: {
|
|
1161
|
-
...
|
|
1159
|
+
...S.memory,
|
|
1162
1160
|
[a]: { summary: q, followUpQuestions: M, fullContext: o }
|
|
1163
1161
|
}
|
|
1164
1162
|
};
|
|
1165
|
-
return M.length && await
|
|
1163
|
+
return M.length && await _({ type: "suggested-prompts", data: { prompts: M } }, t), {
|
|
1166
1164
|
status: "success",
|
|
1167
1165
|
outputMessage: q,
|
|
1168
1166
|
sharedStatePatch: { portalGroupSummaryMemory: { value: C } }
|
|
1169
1167
|
};
|
|
1170
|
-
},
|
|
1168
|
+
}, Ca = s.object({
|
|
1171
1169
|
summary: s.string(),
|
|
1172
1170
|
followUpQuestions: s.array(s.string()).default([])
|
|
1173
|
-
}), L = (e, t) => t ?? e,
|
|
1171
|
+
}), L = (e, t) => t ?? e, $e = h.Root({
|
|
1174
1172
|
...G(),
|
|
1175
1173
|
groupSummaryIntent: h({
|
|
1176
1174
|
reducer: L,
|
|
@@ -1184,24 +1182,24 @@ Deterministic signals:
|
|
|
1184
1182
|
reducer: L,
|
|
1185
1183
|
default: () => ""
|
|
1186
1184
|
})
|
|
1187
|
-
}),
|
|
1185
|
+
}), Aa = () => new N($e).addNode("detectGroupSummaryIntent", ma).addNode("summarizePortalGroup", Ma).addNode("answerGroupSummaryFollowUp", la).addNode("suggestGroupSummaryNavigation", ga).addEdge(P, "detectGroupSummaryIntent").addConditionalEdges("detectGroupSummaryIntent", (t) => t.groupSummaryIntent === "summarize" ? "summarizePortalGroup" : t.groupSummaryIntent === "followUp" ? "answerGroupSummaryFollowUp" : t.groupSummaryIntent === "navigation" ? "suggestGroupSummaryNavigation" : w).addEdge("summarizePortalGroup", w).addEdge("answerGroupSummaryFollowUp", w).addEdge("suggestGroupSummaryNavigation", w), Na = String.raw`- **portal-group-analytics** - Portal group analytics assistant:
|
|
1188
1186
|
- summarizes ArcGIS portal groups from group context and sourceJSON details
|
|
1189
1187
|
- answers follow-up questions grounded in the summarized group
|
|
1190
1188
|
- suggests navigation to groups when relevant
|
|
1191
|
-
`,
|
|
1189
|
+
`, Pa = {
|
|
1192
1190
|
id: "portal-group-analytics",
|
|
1193
1191
|
name: "Portal Group Analytics",
|
|
1194
|
-
description:
|
|
1195
|
-
createGraph:
|
|
1196
|
-
workspace:
|
|
1197
|
-
},
|
|
1192
|
+
description: Na,
|
|
1193
|
+
createGraph: Aa,
|
|
1194
|
+
workspace: $e
|
|
1195
|
+
}, Ga = () => ({ latestItemId: null, memory: {} }), X = (e) => {
|
|
1198
1196
|
const t = e?.agentExecutionContext.sharedState.portalItemAnalyticsSummaryMemory?.value;
|
|
1199
|
-
return t ? { latestItemId: t.latestItemId, memory: t.memory } :
|
|
1200
|
-
},
|
|
1197
|
+
return t ? { latestItemId: t.latestItemId, memory: t.memory } : Ga();
|
|
1198
|
+
}, le = s.object({
|
|
1201
1199
|
intent: s.enum(["summarize", "followUp", "clarify"]),
|
|
1202
1200
|
itemId: s.string().default(""),
|
|
1203
1201
|
question: s.string().default("")
|
|
1204
|
-
}),
|
|
1202
|
+
}), qa = s.object({ summary: s.string(), followUpQuestions: s.array(s.string()).default([]) }), ka = s.object({ answer: s.string(), isRelevant: s.boolean() }), Ea = `
|
|
1205
1203
|
You answer follow-up questions about an ArcGIS item.
|
|
1206
1204
|
|
|
1207
1205
|
Ground your answer in the provided item context.
|
|
@@ -1221,14 +1219,14 @@ Item full context
|
|
|
1221
1219
|
|
|
1222
1220
|
Question:
|
|
1223
1221
|
{question}
|
|
1224
|
-
`,
|
|
1225
|
-
await
|
|
1226
|
-
const a =
|
|
1222
|
+
`, za = async (e, t) => {
|
|
1223
|
+
await p({ text: "Answering follow-up...", agentName: "analytics" }, t);
|
|
1224
|
+
const a = X(e), n = e.analyticsItemId ?? a.latestItemId, o = n ? a.memory[n] : void 0, r = e.analyticsQuestion || b(e.agentExecutionContext.messages);
|
|
1227
1225
|
return o ? {
|
|
1228
1226
|
status: "success",
|
|
1229
|
-
outputMessage: (await
|
|
1230
|
-
promptText:
|
|
1231
|
-
schema:
|
|
1227
|
+
outputMessage: (await v({
|
|
1228
|
+
promptText: Ea,
|
|
1229
|
+
schema: ka,
|
|
1232
1230
|
modelTier: "default",
|
|
1233
1231
|
inputVariables: {
|
|
1234
1232
|
summary: o.summary,
|
|
@@ -1240,7 +1238,7 @@ Question:
|
|
|
1240
1238
|
status: "success",
|
|
1241
1239
|
outputMessage: "I don't have enough information yet. Please ask me to summarize the item first using summarize item <item id>."
|
|
1242
1240
|
};
|
|
1243
|
-
},
|
|
1241
|
+
}, Da = `
|
|
1244
1242
|
Classify the user analytics request.
|
|
1245
1243
|
|
|
1246
1244
|
Rules:
|
|
@@ -1270,16 +1268,16 @@ hasSummaryContext:
|
|
|
1270
1268
|
|
|
1271
1269
|
User message:
|
|
1272
1270
|
{userMessage}
|
|
1273
|
-
`,
|
|
1274
|
-
await
|
|
1275
|
-
const a =
|
|
1271
|
+
`, $a = async (e, t) => {
|
|
1272
|
+
await p({ text: "Analyzing intent...", agentName: "analytics" }, t);
|
|
1273
|
+
const a = b(e.agentExecutionContext.messages), n = !!X(e).latestItemId, o = await H.fromTemplate(Da).format({
|
|
1276
1274
|
userMessage: a,
|
|
1277
1275
|
hasSummaryContext: String(n)
|
|
1278
|
-
}), i = (await
|
|
1276
|
+
}), i = (await Y({ modelTier: "fast" })).withStructuredOutput(le), u = le.parse(await i.invoke(o));
|
|
1279
1277
|
let c = u.itemId;
|
|
1280
1278
|
if (u.intent === "summarize" && !c) {
|
|
1281
1279
|
const y = A(a, "#");
|
|
1282
|
-
y && (c = await
|
|
1280
|
+
y && (c = await qe.invoke({ itemTitle: y }, t) ?? "");
|
|
1283
1281
|
}
|
|
1284
1282
|
const { intent: d, question: l } = u, f = d === "clarify" || d === "summarize" && !c || d === "followUp" && !l;
|
|
1285
1283
|
return {
|
|
@@ -1290,7 +1288,7 @@ User message:
|
|
|
1290
1288
|
status: "success",
|
|
1291
1289
|
outputMessage: f ? 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".' : ""
|
|
1292
1290
|
};
|
|
1293
|
-
},
|
|
1291
|
+
}, Ra = `
|
|
1294
1292
|
You are a item summary tool for ArcGIS. Your job is to summarize an item's info based on the provided context.
|
|
1295
1293
|
Summary rules:
|
|
1296
1294
|
- The summary should be concise markdown, make sure to format the output nicely so it's easy to read.
|
|
@@ -1305,40 +1303,40 @@ Do not include internal identifiers.
|
|
|
1305
1303
|
If the user asks for a detailed summary, you may expand the response up to 300 words.
|
|
1306
1304
|
Item context:
|
|
1307
1305
|
{context}
|
|
1308
|
-
`,
|
|
1306
|
+
`, Ua = async (e, t) => {
|
|
1309
1307
|
const a = e.analyticsItemId;
|
|
1310
1308
|
if (!a)
|
|
1311
1309
|
return {
|
|
1312
1310
|
status: "success",
|
|
1313
1311
|
outputMessage: 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".'
|
|
1314
1312
|
};
|
|
1315
|
-
await
|
|
1313
|
+
await p({ text: `Summarizing item ${a}...`, agentName: "analytics" }, t);
|
|
1316
1314
|
const n = t?.configurable?.context;
|
|
1317
1315
|
x(n);
|
|
1318
|
-
const { portal: o, user: r } = n, { result: i, error: u } = await
|
|
1316
|
+
const { portal: o, user: r } = n, { result: i, error: u } = await tt(r, o, a);
|
|
1319
1317
|
if (u || !i)
|
|
1320
|
-
return await
|
|
1318
|
+
return await p({ text: "Failed to get item context for summarization", agentName: "analytics" }, t), {
|
|
1321
1319
|
status: "success",
|
|
1322
1320
|
outputMessage: "Unable to retrieve item context for summarization."
|
|
1323
1321
|
};
|
|
1324
|
-
const { context: c } = i, d = await
|
|
1325
|
-
promptText:
|
|
1326
|
-
schema:
|
|
1322
|
+
const { context: c } = i, d = await v({
|
|
1323
|
+
promptText: Ra,
|
|
1324
|
+
schema: qa,
|
|
1327
1325
|
modelTier: "default",
|
|
1328
1326
|
inputVariables: { context: JSON.stringify(c) }
|
|
1329
|
-
}), { followUpQuestions: l, summary:
|
|
1327
|
+
}), { followUpQuestions: l, summary: m } = d, g = X(e), f = {
|
|
1330
1328
|
latestItemId: a,
|
|
1331
1329
|
memory: {
|
|
1332
|
-
...
|
|
1333
|
-
[a]: { summary:
|
|
1330
|
+
...g.memory,
|
|
1331
|
+
[a]: { summary: m, followUpQuestions: l, fullContext: c }
|
|
1334
1332
|
}
|
|
1335
1333
|
};
|
|
1336
|
-
return l.length && await
|
|
1334
|
+
return l.length && await _({ type: "suggested-prompts", data: { prompts: l } }, t), {
|
|
1337
1335
|
status: "success",
|
|
1338
|
-
outputMessage:
|
|
1336
|
+
outputMessage: m,
|
|
1339
1337
|
sharedStatePatch: { portalItemAnalyticsSummaryMemory: { value: f } }
|
|
1340
1338
|
};
|
|
1341
|
-
}, j = (e, t) => t ?? e,
|
|
1339
|
+
}, j = (e, t) => t ?? e, Re = h.Root({
|
|
1342
1340
|
...G(),
|
|
1343
1341
|
// States shared only across nodes in the graph, not between invocations
|
|
1344
1342
|
analyticsIntent: h({
|
|
@@ -1353,151 +1351,18 @@ Item context:
|
|
|
1353
1351
|
reducer: j,
|
|
1354
1352
|
default: () => ""
|
|
1355
1353
|
})
|
|
1356
|
-
}),
|
|
1354
|
+
}), Fa = () => new N(Re).addNode("detectAnalyticsIntent", $a).addNode("summarizePortalItem", Ua).addNode("answerAnalyticsFollowUp", za).addEdge(P, "detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent", (t) => t.analyticsIntent === "summarize" ? "summarizePortalItem" : t.analyticsIntent === "followUp" ? "answerAnalyticsFollowUp" : w).addEdge("summarizePortalItem", w).addEdge("answerAnalyticsFollowUp", w), Oa = String.raw`- **portal-item-analytics** - Portal item analytics assistant:
|
|
1357
1355
|
- answers questions about one specific ArcGIS portal item when item context is present
|
|
1358
1356
|
- summarizes item details, metadata, and context grounded in that item
|
|
1359
1357
|
- suggests follow-up prompts grounded in the same item
|
|
1360
1358
|
- use for item-specific requests, not for gallery browsing, featured content, or opening Map Viewer
|
|
1361
|
-
`,
|
|
1359
|
+
`, La = {
|
|
1362
1360
|
id: "portal-item-analytics",
|
|
1363
1361
|
name: "Portal Item Analytics",
|
|
1364
|
-
description:
|
|
1365
|
-
createGraph:
|
|
1366
|
-
workspace:
|
|
1367
|
-
},
|
|
1368
|
-
schemaVersion: "1.0",
|
|
1369
|
-
capabilities: [
|
|
1370
|
-
{
|
|
1371
|
-
id: "my-content",
|
|
1372
|
-
title: "My content",
|
|
1373
|
-
description: "Browse, discover, search, and filter ArcGIS content—including maps, apps, datasets, and other items—that you own or can access.",
|
|
1374
|
-
hints: ["view my content", "show my content", "my content"],
|
|
1375
|
-
platforms: ["online", "enterprise"],
|
|
1376
|
-
resolutions: {
|
|
1377
|
-
navigate: {
|
|
1378
|
-
routeKey: "content"
|
|
1379
|
-
}
|
|
1380
|
-
}
|
|
1381
|
-
},
|
|
1382
|
-
{
|
|
1383
|
-
id: "create-feature-layer",
|
|
1384
|
-
title: "Create feature layer",
|
|
1385
|
-
description: "Generate an editable feature layer by copying fields from templates or existing layers.",
|
|
1386
|
-
hints: ["add a feature layer", "make a feature layer", "generate a feature layer"],
|
|
1387
|
-
platforms: ["online", "enterprise"],
|
|
1388
|
-
resolutions: {
|
|
1389
|
-
navigate: {
|
|
1390
|
-
routeKey: "content"
|
|
1391
|
-
}
|
|
1392
|
-
}
|
|
1393
|
-
},
|
|
1394
|
-
{
|
|
1395
|
-
id: "create-folder",
|
|
1396
|
-
title: "Create folder",
|
|
1397
|
-
description: "Create a new folder in your ArcGIS content to organize your items.",
|
|
1398
|
-
hints: ["create a folder", "make a folder", "set up a folder", "new folder"],
|
|
1399
|
-
platforms: ["online", "enterprise"],
|
|
1400
|
-
resolutions: {
|
|
1401
|
-
navigate: {
|
|
1402
|
-
routeKey: "content"
|
|
1403
|
-
}
|
|
1404
|
-
}
|
|
1405
|
-
}
|
|
1406
|
-
]
|
|
1407
|
-
}, Fa = {
|
|
1408
|
-
schemaVersion: "1.0",
|
|
1409
|
-
capabilities: [
|
|
1410
|
-
{
|
|
1411
|
-
id: "my groups",
|
|
1412
|
-
title: "My groups",
|
|
1413
|
-
description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that you own, belong to, or can access.",
|
|
1414
|
-
hints: ["view my groups", "show my groups", "my groups"],
|
|
1415
|
-
platforms: ["online", "enterprise"],
|
|
1416
|
-
resolutions: {
|
|
1417
|
-
navigate: {
|
|
1418
|
-
routeKey: "groups"
|
|
1419
|
-
}
|
|
1420
|
-
}
|
|
1421
|
-
},
|
|
1422
|
-
{
|
|
1423
|
-
id: "create-group",
|
|
1424
|
-
title: "Create group",
|
|
1425
|
-
description: "Create a new ArcGIS Portal group owned by the signed-in user.",
|
|
1426
|
-
hints: ["create a group", "make a group", "set up a group", "new group"],
|
|
1427
|
-
platforms: ["online", "enterprise"],
|
|
1428
|
-
resolutions: {
|
|
1429
|
-
navigate: {
|
|
1430
|
-
routeKey: "groups"
|
|
1431
|
-
}
|
|
1432
|
-
}
|
|
1433
|
-
},
|
|
1434
|
-
{
|
|
1435
|
-
id: "featured-groups",
|
|
1436
|
-
title: "Featured groups",
|
|
1437
|
-
description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that organization administrators choose to highlight in ArcGIS.",
|
|
1438
|
-
hints: ["view featured groups", "show featured groups", "highlighted groups", "top groups"],
|
|
1439
|
-
platforms: ["online", "enterprise"],
|
|
1440
|
-
resolutions: {
|
|
1441
|
-
navigate: {
|
|
1442
|
-
routeKey: "groups",
|
|
1443
|
-
hash: "featured"
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
},
|
|
1447
|
-
{
|
|
1448
|
-
id: "organization-groups",
|
|
1449
|
-
title: "Organization groups",
|
|
1450
|
-
description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that are specific to your organization in ArcGIS.",
|
|
1451
|
-
hints: ["view organization groups", "show organization groups"],
|
|
1452
|
-
platforms: ["online", "enterprise"],
|
|
1453
|
-
resolutions: {
|
|
1454
|
-
navigate: {
|
|
1455
|
-
routeKey: "groups",
|
|
1456
|
-
hash: "organization"
|
|
1457
|
-
}
|
|
1458
|
-
}
|
|
1459
|
-
}
|
|
1460
|
-
]
|
|
1461
|
-
}, Oa = {
|
|
1462
|
-
schemaVersion: "1.0",
|
|
1463
|
-
capabilities: [
|
|
1464
|
-
{
|
|
1465
|
-
id: "org-config-mfa",
|
|
1466
|
-
title: "Multifactor Authentication (MFA)",
|
|
1467
|
-
description: "Configure organization-level multifactor authentication (MFA) settings. Administrators can enable MFA for ArcGIS logins, allow recovery codes for members, view MFA adoption status, enforce MFA requirements for all members, manage the MFA exemption list, and designate administrators who can troubleshoot MFA issues.",
|
|
1468
|
-
hints: ["config MFA", "set up MFA"],
|
|
1469
|
-
platforms: ["online", "enterprise"],
|
|
1470
|
-
resolutions: {
|
|
1471
|
-
navigate: {
|
|
1472
|
-
routeKey: "organization",
|
|
1473
|
-
queryParams: {
|
|
1474
|
-
tab: "security"
|
|
1475
|
-
},
|
|
1476
|
-
hash: "settings"
|
|
1477
|
-
}
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
]
|
|
1481
|
-
}, La = {
|
|
1482
|
-
"contentRouteRegistry.ts": Ua,
|
|
1483
|
-
"groupsRouteRegistry.ts": Fa,
|
|
1484
|
-
"orgSettingsRouteRegistry.ts": Oa
|
|
1485
|
-
};
|
|
1486
|
-
function le(e) {
|
|
1487
|
-
const t = [], a = /* @__PURE__ */ new Set();
|
|
1488
|
-
for (const [n, o] of Object.entries(e))
|
|
1489
|
-
for (const r of o.capabilities) {
|
|
1490
|
-
if (a.has(r.id))
|
|
1491
|
-
throw new Error(`${n}: duplicate capability id "${r.id}" across registries`);
|
|
1492
|
-
a.add(r.id), t.push(r);
|
|
1493
|
-
}
|
|
1494
|
-
return t;
|
|
1495
|
-
}
|
|
1496
|
-
let z;
|
|
1497
|
-
function S(e) {
|
|
1498
|
-
return e ? z = le({ customCapabilities: e }) : z || (z = le(La)), z;
|
|
1499
|
-
}
|
|
1500
|
-
const ja = /^(?:take me to|navigate to|go to|show me|open)\s+(?:the\s+)?/u;
|
|
1362
|
+
description: Oa,
|
|
1363
|
+
createGraph: Fa,
|
|
1364
|
+
workspace: Re
|
|
1365
|
+
}, ja = /^(?:take me to|navigate to|go to|show me|open)\s+(?:the\s+)?/u;
|
|
1501
1366
|
function R(e) {
|
|
1502
1367
|
return e.toLowerCase().replace(/[^a-z0-9]+/gu, " ").trim().replace(ja, "").trim();
|
|
1503
1368
|
}
|
|
@@ -1518,14 +1383,17 @@ Candidates:
|
|
|
1518
1383
|
{candidates}`, Ka = async (e, t) => {
|
|
1519
1384
|
if (e.outputMessage || e.targets.length === 0)
|
|
1520
1385
|
return {};
|
|
1521
|
-
const a =
|
|
1386
|
+
const a = b(e.agentExecutionContext.messages).trim(), n = Qa(a, e);
|
|
1522
1387
|
if (n.length === 1)
|
|
1523
|
-
return
|
|
1388
|
+
return await p(
|
|
1389
|
+
{ text: `Selected navigation capability by exact match: ${n[0]}`, agentName: "navigation" },
|
|
1390
|
+
t
|
|
1391
|
+
), console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
|
|
1524
1392
|
method: "exact-match",
|
|
1525
1393
|
request: a,
|
|
1526
1394
|
selectedCapabilityIds: n
|
|
1527
1395
|
}), { chosenCapabilityIds: n };
|
|
1528
|
-
await
|
|
1396
|
+
await p({ text: "Choosing a navigation destination...", agentName: "navigation" }, t);
|
|
1529
1397
|
const o = JSON.stringify(
|
|
1530
1398
|
e.targets.map(({ capability: r, keywordScore: i, semanticScore: u }) => ({
|
|
1531
1399
|
id: r.id,
|
|
@@ -1537,13 +1405,19 @@ Candidates:
|
|
|
1537
1405
|
}))
|
|
1538
1406
|
);
|
|
1539
1407
|
try {
|
|
1540
|
-
const r = await
|
|
1408
|
+
const r = await v({
|
|
1541
1409
|
promptText: Ba,
|
|
1542
1410
|
schema: Va,
|
|
1543
1411
|
modelTier: "fast",
|
|
1544
1412
|
inputVariables: { candidates: o, userRequest: a }
|
|
1545
1413
|
}), i = new Set(e.targets.map(({ capability: c }) => c.id)), u = r.capabilityIds.filter((c) => i.has(c));
|
|
1546
|
-
return
|
|
1414
|
+
return await p(
|
|
1415
|
+
{
|
|
1416
|
+
text: `Navigation selection: ${u.join(", ") || "none"} (confidence: ${r.confidence.toFixed(2)}, reason: ${r.reason})`,
|
|
1417
|
+
agentName: "navigation"
|
|
1418
|
+
},
|
|
1419
|
+
t
|
|
1420
|
+
), console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
|
|
1547
1421
|
confidence: r.confidence,
|
|
1548
1422
|
method: "structured-model",
|
|
1549
1423
|
reason: r.reason,
|
|
@@ -1555,7 +1429,10 @@ Candidates:
|
|
|
1555
1429
|
summary: `Navigation selection confidence ${r.confidence} is below the required ${de}; defer to the Portal Doc Assistant.`
|
|
1556
1430
|
} : { chosenCapabilityIds: u };
|
|
1557
1431
|
} catch {
|
|
1558
|
-
return
|
|
1432
|
+
return await p(
|
|
1433
|
+
{ text: "Navigation selection model unavailable; using retrieval order.", agentName: "navigation" },
|
|
1434
|
+
t
|
|
1435
|
+
), console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
|
|
1559
1436
|
method: "structured-model-unavailable",
|
|
1560
1437
|
request: a,
|
|
1561
1438
|
selectedCapabilityIds: []
|
|
@@ -1570,7 +1447,7 @@ function Qa(e, t) {
|
|
|
1570
1447
|
)
|
|
1571
1448
|
).map(({ capability: n }) => n.id);
|
|
1572
1449
|
}
|
|
1573
|
-
const
|
|
1450
|
+
const Ue = /* @__PURE__ */ new Set(["1d", "7d", "14d", "30d", "3m", "6m"]), Wa = s.object({
|
|
1574
1451
|
period: s.string(),
|
|
1575
1452
|
startTime: s.string(),
|
|
1576
1453
|
endTime: s.string()
|
|
@@ -1605,7 +1482,7 @@ async function _a(e, t = /* @__PURE__ */ new Date()) {
|
|
|
1605
1482
|
if (!a)
|
|
1606
1483
|
return {};
|
|
1607
1484
|
try {
|
|
1608
|
-
const n = await
|
|
1485
|
+
const n = await v({
|
|
1609
1486
|
promptText: Ja,
|
|
1610
1487
|
schema: Wa,
|
|
1611
1488
|
modelTier: "fast",
|
|
@@ -1625,7 +1502,7 @@ function Ya(e, t = /* @__PURE__ */ new Date()) {
|
|
|
1625
1502
|
if (o) {
|
|
1626
1503
|
if (a !== void 0 && n !== void 0 && a < n)
|
|
1627
1504
|
return { period: o, startTime: String(a), endTime: String(n) };
|
|
1628
|
-
const r =
|
|
1505
|
+
const r = Ue.has(o);
|
|
1629
1506
|
if (!r || n !== void 0 && !Za(n, t.getTime())) {
|
|
1630
1507
|
const u = n ?? t.getTime(), c = Xa(o, new Date(u));
|
|
1631
1508
|
if (c !== void 0)
|
|
@@ -1653,7 +1530,7 @@ function Ha(e) {
|
|
|
1653
1530
|
const n = t[2].toLowerCase();
|
|
1654
1531
|
if (n === "w") {
|
|
1655
1532
|
const o = a * 7;
|
|
1656
|
-
if (
|
|
1533
|
+
if (Ue.has(`${o}d`))
|
|
1657
1534
|
return `${o}d`;
|
|
1658
1535
|
}
|
|
1659
1536
|
return `${a}${n}`;
|
|
@@ -1684,31 +1561,160 @@ function Za(e, t) {
|
|
|
1684
1561
|
const a = new Date(e), n = new Date(t);
|
|
1685
1562
|
return a.getUTCFullYear() === n.getUTCFullYear() && a.getUTCMonth() === n.getUTCMonth() && a.getUTCDate() === n.getUTCDate();
|
|
1686
1563
|
}
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1564
|
+
const en = {
|
|
1565
|
+
schemaVersion: "1.0",
|
|
1566
|
+
capabilities: [
|
|
1567
|
+
{
|
|
1568
|
+
id: "my-content",
|
|
1569
|
+
title: "My content",
|
|
1570
|
+
description: "Browse, discover, search, and filter ArcGIS content—including maps, apps, datasets, and other items—that you own or can access.",
|
|
1571
|
+
hints: ["view my content", "show my content", "my content"],
|
|
1572
|
+
platforms: ["online", "enterprise"],
|
|
1573
|
+
resolutions: {
|
|
1574
|
+
navigate: {
|
|
1575
|
+
routeKey: "content"
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
},
|
|
1579
|
+
{
|
|
1580
|
+
id: "create-feature-layer",
|
|
1581
|
+
title: "Create feature layer",
|
|
1582
|
+
description: "Generate an editable feature layer by copying fields from templates or existing layers.",
|
|
1583
|
+
hints: ["add a feature layer", "make a feature layer", "generate a feature layer"],
|
|
1584
|
+
platforms: ["online", "enterprise"],
|
|
1585
|
+
resolutions: {
|
|
1586
|
+
navigate: {
|
|
1587
|
+
routeKey: "content"
|
|
1588
|
+
}
|
|
1589
|
+
}
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
id: "create-folder",
|
|
1593
|
+
title: "Create folder",
|
|
1594
|
+
description: "Create a new folder in your ArcGIS content to organize your items.",
|
|
1595
|
+
hints: ["create a folder", "make a folder", "set up a folder", "new folder"],
|
|
1596
|
+
platforms: ["online", "enterprise"],
|
|
1597
|
+
resolutions: {
|
|
1598
|
+
navigate: {
|
|
1599
|
+
routeKey: "content"
|
|
1600
|
+
}
|
|
1601
|
+
}
|
|
1602
|
+
}
|
|
1603
|
+
]
|
|
1604
|
+
}, tn = {
|
|
1605
|
+
schemaVersion: "1.0",
|
|
1606
|
+
capabilities: [
|
|
1607
|
+
{
|
|
1608
|
+
id: "my groups",
|
|
1609
|
+
title: "My groups",
|
|
1610
|
+
description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that you own, belong to, or can access.",
|
|
1611
|
+
hints: ["view my groups", "show my groups", "my groups"],
|
|
1612
|
+
platforms: ["online", "enterprise"],
|
|
1613
|
+
resolutions: {
|
|
1614
|
+
navigate: {
|
|
1615
|
+
routeKey: "groups"
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
},
|
|
1619
|
+
{
|
|
1620
|
+
id: "create-group",
|
|
1621
|
+
title: "Create group",
|
|
1622
|
+
description: "Create a new ArcGIS Portal group owned by the signed-in user.",
|
|
1623
|
+
hints: ["create a group", "make a group", "set up a group", "new group"],
|
|
1624
|
+
platforms: ["online", "enterprise"],
|
|
1625
|
+
resolutions: {
|
|
1626
|
+
navigate: {
|
|
1627
|
+
routeKey: "groups"
|
|
1628
|
+
}
|
|
1629
|
+
}
|
|
1630
|
+
},
|
|
1631
|
+
{
|
|
1632
|
+
id: "featured-groups",
|
|
1633
|
+
title: "Featured groups",
|
|
1634
|
+
description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that organization administrators choose to highlight in ArcGIS.",
|
|
1635
|
+
hints: ["view featured groups", "show featured groups", "highlighted groups", "top groups"],
|
|
1636
|
+
platforms: ["online", "enterprise"],
|
|
1637
|
+
resolutions: {
|
|
1638
|
+
navigate: {
|
|
1639
|
+
routeKey: "groups",
|
|
1640
|
+
hash: "featured"
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
},
|
|
1644
|
+
{
|
|
1645
|
+
id: "organization-groups",
|
|
1646
|
+
title: "Organization groups",
|
|
1647
|
+
description: "Browse, discover, search, and filter ArcGIS content collections—including maps, apps, datasets, and other items—that are specific to your organization in ArcGIS.",
|
|
1648
|
+
hints: ["view organization groups", "show organization groups"],
|
|
1649
|
+
platforms: ["online", "enterprise"],
|
|
1650
|
+
resolutions: {
|
|
1651
|
+
navigate: {
|
|
1652
|
+
routeKey: "groups",
|
|
1653
|
+
hash: "organization"
|
|
1654
|
+
}
|
|
1655
|
+
}
|
|
1656
|
+
}
|
|
1657
|
+
]
|
|
1658
|
+
}, an = {
|
|
1659
|
+
schemaVersion: "1.0",
|
|
1660
|
+
capabilities: [
|
|
1661
|
+
{
|
|
1662
|
+
id: "org-config-mfa",
|
|
1663
|
+
title: "Multifactor Authentication (MFA)",
|
|
1664
|
+
description: "Configure organization-level multifactor authentication (MFA) settings. Administrators can enable MFA for ArcGIS logins, allow recovery codes for members, view MFA adoption status, enforce MFA requirements for all members, manage the MFA exemption list, and designate administrators who can troubleshoot MFA issues.",
|
|
1665
|
+
hints: ["config MFA", "set up MFA"],
|
|
1666
|
+
platforms: ["online", "enterprise"],
|
|
1667
|
+
resolutions: {
|
|
1668
|
+
navigate: {
|
|
1669
|
+
routeKey: "organization",
|
|
1670
|
+
queryParams: {
|
|
1671
|
+
tab: "security"
|
|
1672
|
+
},
|
|
1673
|
+
hash: "settings"
|
|
1674
|
+
}
|
|
1675
|
+
}
|
|
1676
|
+
}
|
|
1677
|
+
]
|
|
1678
|
+
}, nn = {
|
|
1679
|
+
"contentRouteRegistry.ts": en,
|
|
1680
|
+
"groupsRouteRegistry.ts": tn,
|
|
1681
|
+
"orgSettingsRouteRegistry.ts": an
|
|
1682
|
+
};
|
|
1683
|
+
function me(e) {
|
|
1684
|
+
const t = [], a = /* @__PURE__ */ new Set();
|
|
1685
|
+
for (const [n, o] of Object.entries(e))
|
|
1686
|
+
for (const r of o.capabilities) {
|
|
1687
|
+
if (a.has(r.id))
|
|
1688
|
+
throw new Error(`${n}: duplicate capability id "${r.id}" across registries`);
|
|
1689
|
+
a.add(r.id), t.push(r);
|
|
1690
|
+
}
|
|
1691
|
+
return t;
|
|
1692
|
+
}
|
|
1693
|
+
let z;
|
|
1694
|
+
function T(e) {
|
|
1695
|
+
return e ? z = me({ customCapabilities: e }) : z || (z = me(nn)), z;
|
|
1696
|
+
}
|
|
1697
|
+
async function on(e, t, a, n) {
|
|
1698
|
+
const o = T().find((i) => i.id === e);
|
|
1699
|
+
if (!o)
|
|
1690
1700
|
return;
|
|
1691
|
-
const
|
|
1692
|
-
return
|
|
1701
|
+
const r = await sn(rn(o, n), a);
|
|
1702
|
+
return r && un(r, t) ? { capability: o, target: r } : void 0;
|
|
1693
1703
|
}
|
|
1694
|
-
function
|
|
1695
|
-
const
|
|
1696
|
-
switch (
|
|
1704
|
+
function rn(e, t) {
|
|
1705
|
+
const a = e.resolutions.navigate;
|
|
1706
|
+
switch (a.routeKey) {
|
|
1697
1707
|
case "content":
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
return { destinationType: "portal-content" };
|
|
1705
|
-
default:
|
|
1706
|
-
return { destinationType: "portal-content" };
|
|
1707
|
-
}
|
|
1708
|
+
return {
|
|
1709
|
+
destinationType: "portal-content",
|
|
1710
|
+
hash: a.hash,
|
|
1711
|
+
queryParams: a.queryParams,
|
|
1712
|
+
buttonLabel: e.buttonLabel
|
|
1713
|
+
};
|
|
1708
1714
|
case "groups":
|
|
1709
|
-
if (
|
|
1715
|
+
if (a.hash === "featured")
|
|
1710
1716
|
return { destinationType: "portal-groups", hash: "featured" };
|
|
1711
|
-
if (
|
|
1717
|
+
if (a.hash === "organization")
|
|
1712
1718
|
return { destinationType: "portal-groups", hash: "organization" };
|
|
1713
1719
|
switch (e.id) {
|
|
1714
1720
|
case "my groups":
|
|
@@ -1718,19 +1724,29 @@ function tn(e) {
|
|
|
1718
1724
|
default:
|
|
1719
1725
|
return { destinationType: "portal-groups" };
|
|
1720
1726
|
}
|
|
1727
|
+
case "group": {
|
|
1728
|
+
const n = t?.trim();
|
|
1729
|
+
return n ? {
|
|
1730
|
+
destinationType: "portal-group",
|
|
1731
|
+
groupId: n,
|
|
1732
|
+
hash: a.hash,
|
|
1733
|
+
queryParams: a.queryParams,
|
|
1734
|
+
buttonLabel: e.buttonLabel
|
|
1735
|
+
} : void 0;
|
|
1736
|
+
}
|
|
1721
1737
|
case "organization":
|
|
1722
1738
|
return {
|
|
1723
1739
|
destinationType: "portal-org",
|
|
1724
|
-
hash:
|
|
1725
|
-
queryParams: a,
|
|
1740
|
+
hash: a.hash,
|
|
1741
|
+
queryParams: a.queryParams,
|
|
1726
1742
|
buttonLabel: e.buttonLabel
|
|
1727
1743
|
};
|
|
1728
1744
|
default:
|
|
1729
1745
|
return;
|
|
1730
1746
|
}
|
|
1731
1747
|
}
|
|
1732
|
-
async function
|
|
1733
|
-
if (!e || !t || !
|
|
1748
|
+
async function sn(e, t) {
|
|
1749
|
+
if (!e || !t || !cn(e))
|
|
1734
1750
|
return e;
|
|
1735
1751
|
const a = await _a(t);
|
|
1736
1752
|
if (!a.period && !a.startTime && !a.endTime)
|
|
@@ -1743,25 +1759,33 @@ async function an(e, t) {
|
|
|
1743
1759
|
};
|
|
1744
1760
|
return { ...e, queryParams: n };
|
|
1745
1761
|
}
|
|
1746
|
-
function
|
|
1762
|
+
function cn(e) {
|
|
1747
1763
|
return e.destinationType === "portal-org" && e.hash === "status";
|
|
1748
1764
|
}
|
|
1749
|
-
function
|
|
1765
|
+
function un(e, t) {
|
|
1750
1766
|
return !t || !!t[e.destinationType];
|
|
1751
1767
|
}
|
|
1752
|
-
|
|
1768
|
+
function ge(e) {
|
|
1769
|
+
return e.match(/\b[a-f0-9]{32}\b/iu)?.[0];
|
|
1770
|
+
}
|
|
1771
|
+
const he = "navigation", fe = "provideGroupId", ln = async (e, t) => {
|
|
1753
1772
|
if (e.outputMessage || e.status === "failed")
|
|
1754
1773
|
return {};
|
|
1755
|
-
const a = e.targets.find(({ capability:
|
|
1774
|
+
const a = e.targets.find(({ capability: i }) => e.chosenCapabilityIds.includes(i.id)) ?? e.targets[0];
|
|
1756
1775
|
if (!a)
|
|
1757
1776
|
return {
|
|
1758
1777
|
outputMessage: "I couldn't find a matching Portal page. Try asking to open your content, groups, or organization settings.",
|
|
1759
|
-
sharedStatePatch: { navLastAnsweredRequest: { value:
|
|
1778
|
+
sharedStatePatch: { navLastAnsweredRequest: { value: ye(e) } },
|
|
1760
1779
|
status: "success",
|
|
1761
1780
|
summary: "Navigation could not find a matching capability; route another agent if appropriate."
|
|
1762
1781
|
};
|
|
1763
|
-
const n =
|
|
1764
|
-
|
|
1782
|
+
const n = ye(e), o = dn(a.capability.resolutions.navigate, n, t), r = await on(
|
|
1783
|
+
a.capability.id,
|
|
1784
|
+
void 0,
|
|
1785
|
+
n,
|
|
1786
|
+
o
|
|
1787
|
+
);
|
|
1788
|
+
return r ? (await p({ text: "Preparing navigation...", agentName: "navigation" }, t), await F(r.target, t), {
|
|
1765
1789
|
outputMessage: e.chosenCapabilityIds.length ? a.capability.description : `The closest place to start is ${a.capability.title}. Click the button below to open it.`,
|
|
1766
1790
|
status: "success",
|
|
1767
1791
|
summary: `Navigation suggested ${a.capability.id}${e.retrievalDegraded ? " using keyword-only retrieval" : ""}.`,
|
|
@@ -1773,17 +1797,47 @@ const rn = async (e, t) => {
|
|
|
1773
1797
|
sharedStatePatch: { navLastAnsweredRequest: { value: n } }
|
|
1774
1798
|
});
|
|
1775
1799
|
};
|
|
1776
|
-
function
|
|
1777
|
-
return
|
|
1800
|
+
function ye(e) {
|
|
1801
|
+
return b(e.agentExecutionContext.messages) || e.agentExecutionContext.userRequest;
|
|
1802
|
+
}
|
|
1803
|
+
function dn(e, t, a) {
|
|
1804
|
+
if (e.routeKey !== "group")
|
|
1805
|
+
return;
|
|
1806
|
+
const n = ge(t);
|
|
1807
|
+
if (n)
|
|
1808
|
+
return n;
|
|
1809
|
+
const o = pn(a);
|
|
1810
|
+
if (o?.agentId === he && o.id === fe) {
|
|
1811
|
+
const i = typeof o.payload == "string" ? ge(o.payload) : void 0;
|
|
1812
|
+
if (i)
|
|
1813
|
+
return i;
|
|
1814
|
+
}
|
|
1815
|
+
const r = {
|
|
1816
|
+
agentId: he,
|
|
1817
|
+
id: fe,
|
|
1818
|
+
kind: "textInput",
|
|
1819
|
+
message: "Enter the group ID to open."
|
|
1820
|
+
};
|
|
1821
|
+
throw new J(r);
|
|
1778
1822
|
}
|
|
1779
|
-
|
|
1780
|
-
|
|
1823
|
+
function pn(e) {
|
|
1824
|
+
const t = e?.configurable;
|
|
1825
|
+
if (!t || typeof t != "object" || !("hitlResponse" in t))
|
|
1826
|
+
return;
|
|
1827
|
+
const a = t.hitlResponse;
|
|
1828
|
+
if (!a || typeof a != "object" || !("agentId" in a) || !("id" in a) || !("payload" in a))
|
|
1829
|
+
return;
|
|
1830
|
+
const { agentId: n, id: o, payload: r } = a;
|
|
1831
|
+
return typeof n == "string" && typeof o == "string" ? { agentId: n, id: o, payload: r } : void 0;
|
|
1781
1832
|
}
|
|
1782
|
-
|
|
1833
|
+
async function Fe(e) {
|
|
1834
|
+
return e.length === 0 ? [] : (await it.getDefault().load(), await _e(e));
|
|
1835
|
+
}
|
|
1836
|
+
const mn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
1783
1837
|
__proto__: null,
|
|
1784
|
-
generateEmbeddings:
|
|
1838
|
+
generateEmbeddings: Fe
|
|
1785
1839
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
1786
|
-
function
|
|
1840
|
+
function gn(e) {
|
|
1787
1841
|
const t = [], a = `${e.title}. ${e.description}`;
|
|
1788
1842
|
a.trim().length > 0 && t.push({ field: "summary", text: a });
|
|
1789
1843
|
const n = e.hints;
|
|
@@ -1792,21 +1846,21 @@ function cn(e) {
|
|
|
1792
1846
|
typeof o == "string" && o.trim().length > 0 && t.push({ field: "hint", text: o });
|
|
1793
1847
|
return t;
|
|
1794
1848
|
}
|
|
1795
|
-
let
|
|
1796
|
-
async function
|
|
1797
|
-
const t =
|
|
1798
|
-
return
|
|
1799
|
-
throw t ===
|
|
1800
|
-
}), await
|
|
1849
|
+
let D, Z, $ = 0;
|
|
1850
|
+
async function hn(e = {}) {
|
|
1851
|
+
const t = $;
|
|
1852
|
+
return D ??= yn(e.embed ?? wn).then((a) => (t === $ && (Z = a), a)).catch((a) => {
|
|
1853
|
+
throw t === $ && (D = void 0), a;
|
|
1854
|
+
}), await D;
|
|
1801
1855
|
}
|
|
1802
|
-
function
|
|
1803
|
-
return
|
|
1856
|
+
function fn() {
|
|
1857
|
+
return Z;
|
|
1804
1858
|
}
|
|
1805
|
-
function
|
|
1806
|
-
|
|
1859
|
+
function we() {
|
|
1860
|
+
$ += 1, Z = void 0, D = void 0;
|
|
1807
1861
|
}
|
|
1808
|
-
async function
|
|
1809
|
-
const t =
|
|
1862
|
+
async function yn(e) {
|
|
1863
|
+
const t = vn(), a = await e(t.map((n) => n.text));
|
|
1810
1864
|
if (a.length !== t.length)
|
|
1811
1865
|
throw new Error(`Expected ${t.length} vectors, got ${a.length}`);
|
|
1812
1866
|
return t.map((n, o) => ({
|
|
@@ -1814,46 +1868,46 @@ async function dn(e) {
|
|
|
1814
1868
|
vector: a[o]
|
|
1815
1869
|
}));
|
|
1816
1870
|
}
|
|
1817
|
-
async function
|
|
1818
|
-
const { generateEmbeddings: t } = await Promise.resolve().then(() =>
|
|
1871
|
+
async function wn(e) {
|
|
1872
|
+
const { generateEmbeddings: t } = await Promise.resolve().then(() => mn);
|
|
1819
1873
|
return await t(e);
|
|
1820
1874
|
}
|
|
1821
|
-
function
|
|
1822
|
-
return
|
|
1823
|
-
(e) =>
|
|
1875
|
+
function vn() {
|
|
1876
|
+
return T().flatMap(
|
|
1877
|
+
(e) => gn(e).map(({ field: t, text: a }) => ({
|
|
1824
1878
|
capabilityId: e.id,
|
|
1825
1879
|
field: t,
|
|
1826
1880
|
text: a
|
|
1827
1881
|
}))
|
|
1828
1882
|
);
|
|
1829
1883
|
}
|
|
1830
|
-
const
|
|
1884
|
+
const ve = 1.2, be = 0.75, bn = 60, In = 0.65, V = {
|
|
1831
1885
|
description: 1,
|
|
1832
1886
|
hint: 2,
|
|
1833
1887
|
title: 3
|
|
1834
1888
|
};
|
|
1835
1889
|
let W;
|
|
1836
|
-
function
|
|
1890
|
+
function xn() {
|
|
1837
1891
|
W = void 0;
|
|
1838
1892
|
}
|
|
1839
|
-
async function
|
|
1840
|
-
const a =
|
|
1893
|
+
async function Sn(e, t = {}) {
|
|
1894
|
+
const a = An(Oe(e));
|
|
1841
1895
|
let n = [], o = !1, r;
|
|
1842
1896
|
if (e.trim()) {
|
|
1843
|
-
const i = t.loadEmbeddings, u =
|
|
1897
|
+
const i = t.loadEmbeddings, u = fn();
|
|
1844
1898
|
if (!i && !u)
|
|
1845
1899
|
o = !0, r = "Capability embeddings are still loading.";
|
|
1846
1900
|
else
|
|
1847
1901
|
try {
|
|
1848
1902
|
if (i) {
|
|
1849
1903
|
const [c, d] = await Promise.all([
|
|
1850
|
-
(t.embedQuery ??
|
|
1904
|
+
(t.embedQuery ?? xe)(e),
|
|
1851
1905
|
i()
|
|
1852
1906
|
]);
|
|
1853
|
-
n =
|
|
1907
|
+
n = Ie(c, d);
|
|
1854
1908
|
} else if (u) {
|
|
1855
|
-
const c = await (t.embedQuery ??
|
|
1856
|
-
n =
|
|
1909
|
+
const c = await (t.embedQuery ?? xe)(e);
|
|
1910
|
+
n = Ie(c, u);
|
|
1857
1911
|
}
|
|
1858
1912
|
} catch {
|
|
1859
1913
|
o = !0, r = "Semantic search is unavailable.";
|
|
@@ -1864,13 +1918,13 @@ async function yn(e, t = {}) {
|
|
|
1864
1918
|
...r ? { degradedReason: r } : {},
|
|
1865
1919
|
// RRF combines ranks rather than raw scores because BM25 and cosine
|
|
1866
1920
|
// similarity are on different scales.
|
|
1867
|
-
matches:
|
|
1921
|
+
matches: Pn(a, n, t.topN ?? 5)
|
|
1868
1922
|
};
|
|
1869
1923
|
}
|
|
1870
|
-
function
|
|
1871
|
-
return W ??=
|
|
1924
|
+
function Tn() {
|
|
1925
|
+
return W ??= Mn(T()), W;
|
|
1872
1926
|
}
|
|
1873
|
-
function
|
|
1927
|
+
function Mn(e) {
|
|
1874
1928
|
const t = /* @__PURE__ */ new Map(), a = e.map((n) => {
|
|
1875
1929
|
const o = /* @__PURE__ */ new Map();
|
|
1876
1930
|
B(o, n.title, V.title), B(o, n.description, V.description);
|
|
@@ -1880,7 +1934,7 @@ function vn(e) {
|
|
|
1880
1934
|
t.set(r, (t.get(r) ?? 0) + 1);
|
|
1881
1935
|
return {
|
|
1882
1936
|
capability: n,
|
|
1883
|
-
length:
|
|
1937
|
+
length: Cn(o),
|
|
1884
1938
|
termFrequencies: o
|
|
1885
1939
|
};
|
|
1886
1940
|
});
|
|
@@ -1891,45 +1945,45 @@ function vn(e) {
|
|
|
1891
1945
|
};
|
|
1892
1946
|
}
|
|
1893
1947
|
function B(e, t, a) {
|
|
1894
|
-
for (const n of
|
|
1948
|
+
for (const n of Oe(t))
|
|
1895
1949
|
e.set(n, (e.get(n) ?? 0) + a);
|
|
1896
1950
|
}
|
|
1897
|
-
function
|
|
1951
|
+
function Cn(e) {
|
|
1898
1952
|
return [...e.values()].reduce((t, a) => t + a, 0);
|
|
1899
1953
|
}
|
|
1900
|
-
function
|
|
1954
|
+
function Oe(e) {
|
|
1901
1955
|
return e.toLowerCase().split(/[^a-z0-9]+/u).filter(Boolean);
|
|
1902
1956
|
}
|
|
1903
|
-
function
|
|
1904
|
-
const t =
|
|
1957
|
+
function An(e) {
|
|
1958
|
+
const t = Tn(), a = new Set(e), n = t.documents.length;
|
|
1905
1959
|
return t.documents.map(({ capability: o, length: r, termFrequencies: i }) => {
|
|
1906
1960
|
let u = 0;
|
|
1907
1961
|
for (const c of a) {
|
|
1908
1962
|
const d = i.get(c), l = t.documentFrequency.get(c);
|
|
1909
1963
|
if (!d || !l)
|
|
1910
1964
|
continue;
|
|
1911
|
-
const
|
|
1912
|
-
u +=
|
|
1965
|
+
const m = Math.log(1 + (n - l + 0.5) / (l + 0.5)), g = ve * (1 - be + be * (r / t.averageDocumentLength));
|
|
1966
|
+
u += m * (d * (ve + 1) / (d + g));
|
|
1913
1967
|
}
|
|
1914
1968
|
return { capability: o, score: u };
|
|
1915
|
-
}).filter(({ score: o }) => o > 0).sort(
|
|
1969
|
+
}).filter(({ score: o }) => o > 0).sort(Le);
|
|
1916
1970
|
}
|
|
1917
|
-
function
|
|
1971
|
+
function Ie(e, t) {
|
|
1918
1972
|
const a = /* @__PURE__ */ new Map();
|
|
1919
1973
|
for (const o of t) {
|
|
1920
|
-
const r =
|
|
1974
|
+
const r = Nn(e, o.vector);
|
|
1921
1975
|
if (r === void 0)
|
|
1922
1976
|
continue;
|
|
1923
1977
|
const i = a.get(o.capabilityId);
|
|
1924
1978
|
(i === void 0 || r > i) && a.set(o.capabilityId, r);
|
|
1925
1979
|
}
|
|
1926
|
-
const n = new Map(
|
|
1980
|
+
const n = new Map(T().map((o) => [o.id, o]));
|
|
1927
1981
|
return [...a.entries()].flatMap(([o, r]) => {
|
|
1928
1982
|
const i = n.get(o);
|
|
1929
|
-
return i && r >=
|
|
1930
|
-
}).sort(
|
|
1983
|
+
return i && r >= In ? [{ capability: i, score: r }] : [];
|
|
1984
|
+
}).sort(Le);
|
|
1931
1985
|
}
|
|
1932
|
-
function
|
|
1986
|
+
function Nn(e, t) {
|
|
1933
1987
|
if (e.length === 0 || e.length !== t.length)
|
|
1934
1988
|
return;
|
|
1935
1989
|
let a = 0, n = 0, o = 0;
|
|
@@ -1938,31 +1992,37 @@ function Sn(e, t) {
|
|
|
1938
1992
|
const r = Math.sqrt(n) * Math.sqrt(o);
|
|
1939
1993
|
return r === 0 ? void 0 : a / r;
|
|
1940
1994
|
}
|
|
1941
|
-
async function
|
|
1942
|
-
const [t] = await
|
|
1995
|
+
async function xe(e) {
|
|
1996
|
+
const [t] = await Fe([e]);
|
|
1943
1997
|
if (!t)
|
|
1944
1998
|
throw new Error("Expected one query embedding.");
|
|
1945
1999
|
return t;
|
|
1946
2000
|
}
|
|
1947
|
-
function
|
|
2001
|
+
function Pn(e, t, a) {
|
|
1948
2002
|
const n = /* @__PURE__ */ new Map();
|
|
1949
|
-
return
|
|
2003
|
+
return Se(n, e, "keyword"), Se(n, t, "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));
|
|
1950
2004
|
}
|
|
1951
|
-
function
|
|
2005
|
+
function Se(e, t, a) {
|
|
1952
2006
|
for (const [n, { capability: o, score: r }] of t.entries()) {
|
|
1953
2007
|
const i = n + 1, u = e.get(o.id) ?? { capability: o, score: 0 };
|
|
1954
|
-
u.score += 1 / (
|
|
2008
|
+
u.score += 1 / (bn + i), a === "keyword" ? (u.keywordRank = i, u.keywordScore = r) : (u.semanticRank = i, u.semanticScore = r), e.set(o.id, u);
|
|
1955
2009
|
}
|
|
1956
2010
|
}
|
|
1957
|
-
function
|
|
2011
|
+
function Le(e, t) {
|
|
1958
2012
|
return t.score - e.score || e.capability.id.localeCompare(t.capability.id);
|
|
1959
2013
|
}
|
|
1960
|
-
const
|
|
1961
|
-
await
|
|
1962
|
-
const a =
|
|
2014
|
+
const Gn = async (e, t) => {
|
|
2015
|
+
await p({ text: "Finding a place to navigate...", agentName: "navigation" }, t);
|
|
2016
|
+
const a = b(e.agentExecutionContext.messages).trim();
|
|
1963
2017
|
try {
|
|
1964
|
-
const n = await
|
|
1965
|
-
return
|
|
2018
|
+
const n = await Sn(a, { topN: 5 });
|
|
2019
|
+
return await p(
|
|
2020
|
+
{
|
|
2021
|
+
text: `Navigation candidates: ${kn(n.matches)}`,
|
|
2022
|
+
agentName: "navigation"
|
|
2023
|
+
},
|
|
2024
|
+
t
|
|
2025
|
+
), console.table(
|
|
1966
2026
|
n.matches.map(({ capability: o, keywordRank: r, keywordScore: i, semanticRank: u, semanticScore: c, score: d }) => ({
|
|
1967
2027
|
capability: o.title,
|
|
1968
2028
|
fusedScore: d,
|
|
@@ -1974,7 +2034,7 @@ const Tn = async (e, t) => {
|
|
|
1974
2034
|
), n.degradedReason && console.info("[arcgis-portal-ai-assistant] navigation semantic search:", n.degradedReason), {
|
|
1975
2035
|
chosenCapabilityIds: [],
|
|
1976
2036
|
retrievalDegraded: n.degradedReason ?? "",
|
|
1977
|
-
targets:
|
|
2037
|
+
targets: qn(a, n.matches)
|
|
1978
2038
|
};
|
|
1979
2039
|
} catch {
|
|
1980
2040
|
return {
|
|
@@ -1985,7 +2045,7 @@ const Tn = async (e, t) => {
|
|
|
1985
2045
|
};
|
|
1986
2046
|
}
|
|
1987
2047
|
};
|
|
1988
|
-
function
|
|
2048
|
+
function qn(e, t) {
|
|
1989
2049
|
const a = R(e), n = t.filter(
|
|
1990
2050
|
({ capability: r }) => [r.title, ...r.hints].some(
|
|
1991
2051
|
(i) => R(i) === a
|
|
@@ -1996,34 +2056,45 @@ function Mn(e, t) {
|
|
|
1996
2056
|
const [o] = n;
|
|
1997
2057
|
return [o, ...t.filter((r) => r !== o)];
|
|
1998
2058
|
}
|
|
1999
|
-
|
|
2059
|
+
function kn(e) {
|
|
2060
|
+
return e.map(
|
|
2061
|
+
({ capability: t, keywordScore: a, semanticScore: n }) => `${t.title} (keyword: ${Te(a)}, semantic: ${Te(n)})`
|
|
2062
|
+
).join("; ") || "none";
|
|
2063
|
+
}
|
|
2064
|
+
function Te(e) {
|
|
2065
|
+
return e?.toFixed(3) ?? "none";
|
|
2066
|
+
}
|
|
2067
|
+
const K = (e, t) => t ?? e, je = h.Root({
|
|
2000
2068
|
...G(),
|
|
2001
2069
|
chosenCapabilityIds: h({ reducer: K, default: () => [] }),
|
|
2002
2070
|
// Empty when hybrid keyword-and-semantic retrieval succeeds; otherwise
|
|
2003
2071
|
// contains the semantic-search failure reason for response diagnostics.
|
|
2004
2072
|
retrievalDegraded: h({ reducer: K, default: () => "" }),
|
|
2005
2073
|
targets: h({ reducer: K, default: () => [] })
|
|
2006
|
-
}),
|
|
2007
|
-
function
|
|
2008
|
-
|
|
2009
|
-
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2074
|
+
}), En = () => new N(je).addNode("retrieveNavigationTargets", Gn).addNode("chooseNavigationTargets", Ka).addNode("respondWithNavigation", ln).addEdge(P, "retrieveNavigationTargets").addEdge("retrieveNavigationTargets", "chooseNavigationTargets").addEdge("chooseNavigationTargets", "respondWithNavigation").addEdge("respondWithNavigation", w);
|
|
2075
|
+
function zn() {
|
|
2076
|
+
return String.raw`- **Navigation** — Takes the user to the portal page or app that fulfills their request. Presenting the button COMPLETES the request — no follow-up step is needed.
|
|
2077
|
+
|
|
2078
|
+
Route here for **navigation intent** ("take me to the map viewer", "open content", "where is X?") and for **action intent** ("publish a scene layer", "create a web map", "share this item") — for an action, Navigation takes the user to the page where that workflow starts. Navigation searches the capability registry itself, so don't rule it out because a page isn't named here.
|
|
2079
|
+
|
|
2080
|
+
If Navigation just asked the user for a missing value (such as an item id), route the user's short follow-up answer — often just an id like "797f6c0d300a4ddc87a8ae14cd2eeb8e" — back here so it can finish.
|
|
2081
|
+
|
|
2082
|
+
Do NOT route here for:
|
|
2083
|
+
- An action another agent actually performs — e.g. "create group" is EXECUTED by group agent. Route it here only when the user explicitly asks to navigate ("take me to create group")
|
|
2084
|
+
- Requests that mix navigation with a question or explanation ("take me there and explain how") → use Help
|
|
2085
|
+
|
|
2086
|
+
Do not dispatch Navigation again for the same request in the same turn: once it has responded, the task is done.`;
|
|
2087
|
+
}
|
|
2088
|
+
const Dn = {
|
|
2018
2089
|
id: "navigation",
|
|
2019
2090
|
name: "Portal Navigation",
|
|
2020
2091
|
get description() {
|
|
2021
|
-
return
|
|
2092
|
+
return zn();
|
|
2022
2093
|
},
|
|
2023
|
-
createGraph:
|
|
2024
|
-
workspace:
|
|
2025
|
-
},
|
|
2026
|
-
function
|
|
2094
|
+
createGraph: En,
|
|
2095
|
+
workspace: je
|
|
2096
|
+
}, $n = Qe`: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)}`;
|
|
2097
|
+
function Rn(e, t) {
|
|
2027
2098
|
if (!t)
|
|
2028
2099
|
return;
|
|
2029
2100
|
const { destinationType: a } = e;
|
|
@@ -2043,16 +2114,16 @@ function Gn(e, t) {
|
|
|
2043
2114
|
case "portal-item":
|
|
2044
2115
|
return t[a]?.(e.itemId);
|
|
2045
2116
|
case "portal-group":
|
|
2046
|
-
return t[a]?.(e.groupId);
|
|
2117
|
+
return t[a]?.(e.groupId, e.hash, e.queryParams);
|
|
2047
2118
|
default:
|
|
2048
2119
|
return U(a);
|
|
2049
2120
|
}
|
|
2050
2121
|
}
|
|
2051
|
-
function
|
|
2052
|
-
const t =
|
|
2122
|
+
function Un(e) {
|
|
2123
|
+
const t = qt.safeParse(e);
|
|
2053
2124
|
return t.success ? t.data : void 0;
|
|
2054
2125
|
}
|
|
2055
|
-
function
|
|
2126
|
+
function Fn(e, t) {
|
|
2056
2127
|
const a = t.navigation;
|
|
2057
2128
|
switch (e.destinationType) {
|
|
2058
2129
|
case "portal-content":
|
|
@@ -2097,21 +2168,21 @@ function En(e, t) {
|
|
|
2097
2168
|
return U(e);
|
|
2098
2169
|
}
|
|
2099
2170
|
}
|
|
2100
|
-
class
|
|
2171
|
+
class On extends Be {
|
|
2101
2172
|
constructor() {
|
|
2102
|
-
super(), this.t9n =
|
|
2173
|
+
super(), this.t9n = Je({ blocking: !0 }), this.assistantEl = k(), this.formEl = k(), this.voiceInputEl = k(), this.inputEl = k(), this.navigationSlotElements = /* @__PURE__ */ new Map(), this.handleSlottableRequest = (t) => {
|
|
2103
2174
|
const a = t.detail, n = a.data?.block;
|
|
2104
2175
|
if (!n)
|
|
2105
2176
|
return;
|
|
2106
2177
|
const o = this.getNavigationAction(n);
|
|
2107
2178
|
o && this.upsertNavigationSlotElement(a.slotName, o);
|
|
2108
|
-
}, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.
|
|
2179
|
+
}, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.autoDestroyDisabled = !1, this.defaultClosed = !1, this.useProdDocAssistant = !1, this.arcgisPortalNavigationRequest = Ke(), T();
|
|
2109
2180
|
}
|
|
2110
2181
|
static {
|
|
2111
|
-
this.properties = { inputText: 16, showVoiceInput: 16, isListening: 16, isVoiceInputDisabled: 16,
|
|
2182
|
+
this.properties = { inputText: 16, showVoiceInput: 16, isListening: 16, isVoiceInputDisabled: 16, autoDestroyDisabled: 5, portal: 0, user: 0, config: 0, navigationTargetMap: 0, disabledAgents: 0, defaultClosed: 5, navigationCapabilities: 0, useProdDocAssistant: 5 };
|
|
2112
2183
|
}
|
|
2113
2184
|
static {
|
|
2114
|
-
this.styles =
|
|
2185
|
+
this.styles = $n;
|
|
2115
2186
|
}
|
|
2116
2187
|
async load() {
|
|
2117
2188
|
await this.refreshCapabilityEmbeddings();
|
|
@@ -2120,30 +2191,30 @@ class kn extends Oe {
|
|
|
2120
2191
|
!this.hasUpdated || !t.has("navigationCapabilities") || this.refreshCapabilityEmbeddings();
|
|
2121
2192
|
}
|
|
2122
2193
|
async clearEmbeddingsCache() {
|
|
2123
|
-
|
|
2194
|
+
we();
|
|
2124
2195
|
}
|
|
2125
2196
|
isAgentEnabled(t) {
|
|
2126
2197
|
return !this.disabledAgents?.[t];
|
|
2127
2198
|
}
|
|
2128
2199
|
async refreshCapabilityEmbeddings() {
|
|
2129
2200
|
try {
|
|
2130
|
-
|
|
2201
|
+
T(this.navigationCapabilities), xn(), we(), await hn();
|
|
2131
2202
|
} catch (t) {
|
|
2132
2203
|
console.warn("[arcgis-portal-ai-assistant] embeddings warm-up failed:", t);
|
|
2133
2204
|
}
|
|
2134
2205
|
}
|
|
2135
2206
|
getNavigationAction(t) {
|
|
2136
|
-
if (t?.type !==
|
|
2207
|
+
if (t?.type !== Ae)
|
|
2137
2208
|
return;
|
|
2138
|
-
const a = t.data, n =
|
|
2209
|
+
const a = t.data, n = Un(a);
|
|
2139
2210
|
if (!n)
|
|
2140
2211
|
return;
|
|
2141
|
-
const o =
|
|
2212
|
+
const o = Rn(a, this.navigationTargetMap);
|
|
2142
2213
|
if (o)
|
|
2143
2214
|
return {
|
|
2144
2215
|
href: o,
|
|
2145
2216
|
targetDetail: a,
|
|
2146
|
-
label: a?.buttonLabel ||
|
|
2217
|
+
label: a?.buttonLabel || Fn(n, this.t9n)
|
|
2147
2218
|
};
|
|
2148
2219
|
}
|
|
2149
2220
|
upsertNavigationSlotElement(t, a) {
|
|
@@ -2152,34 +2223,28 @@ class kn extends Oe {
|
|
|
2152
2223
|
return;
|
|
2153
2224
|
const o = `navigation:${t}`;
|
|
2154
2225
|
let r = this.navigationSlotElements.get(o);
|
|
2155
|
-
r || (r = document.createElement("div"), r.slot = t, this.navigationSlotElements.set(o, r), n.append(r)),
|
|
2226
|
+
r || (r = document.createElement("div"), r.slot = t, this.navigationSlotElements.set(o, r), n.append(r)), We(I`<div><calcite-button class="navigation-button" appearance=outline width=full .href=${a.href} icon-end=launch @click=${(i) => {
|
|
2156
2227
|
i.preventDefault(), this.arcgisPortalNavigationRequest.emit({
|
|
2157
2228
|
href: a.href,
|
|
2158
2229
|
targetDetail: a.targetDetail
|
|
2159
2230
|
});
|
|
2160
|
-
}}>${a.label}</calcite-button>${a.description ?
|
|
2231
|
+
}}>${a.label}</calcite-button>${a.description ? I`<div class="navigation-block-description">${a.description}</div>` : null}</div>`, r);
|
|
2161
2232
|
}
|
|
2162
2233
|
render() {
|
|
2163
2234
|
const { t9n: t, inputText: a, portal: n, user: o, navigationTargetMap: r, showVoiceInput: i, isListening: u, isVoiceInputDisabled: c, useProdDocAssistant: d } = this;
|
|
2164
|
-
return
|
|
2165
|
-
this.interrupt = l;
|
|
2166
|
-
}} @arcgisInterruptCancel=${() => {
|
|
2167
|
-
this.interrupt = null;
|
|
2168
|
-
}} @arcgisInterruptSubmit=${() => {
|
|
2169
|
-
this.interrupt = null;
|
|
2170
|
-
}} @arcgisPromptSelect=${({ detail: l }) => {
|
|
2235
|
+
return I`<arcgis-assistant log-enabled keep-suggested-prompts .heading=${t.heading} .entryMessage=${t.entryMessage} @arcgisSlottableRequest=${this.handleSlottableRequest} @arcgisPromptSelect=${({ detail: l }) => {
|
|
2171
2236
|
this.inputText = l.prompt, requestAnimationFrame(() => {
|
|
2172
2237
|
this.inputEl.value?.focusTextArea();
|
|
2173
2238
|
});
|
|
2174
|
-
}} ${
|
|
2239
|
+
}} ${E(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=${(l) => {
|
|
2175
2240
|
l.preventDefault();
|
|
2176
|
-
const
|
|
2177
|
-
|
|
2178
|
-
}} ${
|
|
2241
|
+
const m = a.trim();
|
|
2242
|
+
m && (this.assistantEl.value?.submitMessage(m), this.inputText = "");
|
|
2243
|
+
}} ${E(this.formEl)}><arcgis-portal-mentionable-text-area .portal=${n} .user=${o} rows=3 .popoverListLabel=${t.mentionEntities} .placeholder=${t.placeholder} .value=${a} @arcgisUserMentionableTextAreaKeyDown=${({ detail: l }) => {
|
|
2179
2244
|
l.key === "Enter" && !l.shiftKey && (l.preventDefault(), this.formEl.value?.requestSubmit());
|
|
2180
2245
|
}} @arcgisUserMentionableTextAreaChange=${({ detail: l }) => {
|
|
2181
2246
|
this.inputText = l ?? "";
|
|
2182
|
-
}} ${
|
|
2247
|
+
}} ${E(this.inputEl)}></arcgis-portal-mentionable-text-area><div class="chat-actions"><arcgis-portal-voice-input @arcgisVoiceInputStart=${() => {
|
|
2183
2248
|
this.isListening = !0, this.isVoiceInputDisabled = !1;
|
|
2184
2249
|
}} @arcgisVoiceInputStop=${() => {
|
|
2185
2250
|
this.isListening = !1, this.isVoiceInputDisabled = !1;
|
|
@@ -2187,18 +2252,14 @@ class kn extends Oe {
|
|
|
2187
2252
|
l.detail.errorCode === "not-supported" && (this.showVoiceInput = !1);
|
|
2188
2253
|
}} @arcgisVoiceInputInterimTranscription=${(l) => {
|
|
2189
2254
|
this.inputText = l.detail.text;
|
|
2190
|
-
}} ${
|
|
2255
|
+
}} ${E(this.voiceInputEl)}></arcgis-portal-voice-input>${i && I`<calcite-button icon-start=microphone .label=${t.voiceInput} round .disabled=${c} .appearance=${u ? "solid" : "outline-fill"} @click=${async () => {
|
|
2191
2256
|
this.isVoiceInputDisabled = !0;
|
|
2192
2257
|
const l = this.voiceInputEl.value;
|
|
2193
2258
|
u ? await l?.stopListening() : await l?.startListening();
|
|
2194
|
-
}}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!a.trim()} .label=${t.send}>${t.send}</calcite-button></div></form>${this.isAgentEnabled("itemAnalytics") &&
|
|
2195
|
-
this.assistantEl.value?.submitInterrupt(l);
|
|
2196
|
-
}} @arcgisCancel=${() => {
|
|
2197
|
-
this.assistantEl.value?.cancelInterrupt();
|
|
2198
|
-
}}></arcgis-portal-ai-assistant-interrupt>` || ""}</arcgis-assistant>`;
|
|
2259
|
+
}}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!a.trim()} .label=${t.send}>${t.send}</calcite-button></div></form>${this.isAgentEnabled("itemAnalytics") && I`<arcgis-assistant-agent .agent=${La} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupCreation") && I`<arcgis-assistant-agent .agent=${Dt} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("docAssistant") && I`<arcgis-assistant-agent .agent=${ia} .context=${{ portal: n, user: o, navigationTargetMap: r, useProdDocAssistant: d }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupAnalytics") && I`<arcgis-assistant-agent .agent=${Pa} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("navigation") && I`<arcgis-assistant-agent .agent=${Dn} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}</arcgis-assistant>`;
|
|
2199
2260
|
}
|
|
2200
2261
|
}
|
|
2201
|
-
|
|
2262
|
+
Ve("arcgis-portal-ai-assistant", On);
|
|
2202
2263
|
export {
|
|
2203
|
-
|
|
2264
|
+
On as ArcgisPortalAiAssistant
|
|
2204
2265
|
};
|