@arcgis/portal-components 5.2.0-next.62 → 5.2.0-next.63
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/7PPA7V23.js +2 -0
- package/dist/cdn/{KZVNGOD4.js → 7YQTBSDS.js} +56 -56
- package/dist/cdn/RKWOBE3M.js +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-portal-account-switcher/customElement.js +124 -115
- package/dist/components/arcgis-portal-ai-assistant/agents/types.d.ts +3 -1
- package/dist/components/arcgis-portal-ai-assistant/customElement.d.ts +2 -0
- package/dist/components/arcgis-portal-ai-assistant/customElement.js +144 -149
- package/dist/components/arcgis-portal-ai-assistant/data/capability-registries/types.d.ts +34 -0
- package/dist/components/arcgis-portal-navigation/customElement.js +2 -2
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +1 -1
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/package.json +4 -4
- package/dist/cdn/2YI5PHJ6.js +0 -2
- package/dist/cdn/QCJQXOSH.js +0 -2
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { c as zt } from "../../chunks/runtime.js";
|
|
3
3
|
import { LitElement as Et, createEvent as $t } from "@arcgis/lumina";
|
|
4
|
-
import { css as Rt, render as Dt, html as
|
|
4
|
+
import { css as Rt, render as Dt, html as T } from "lit";
|
|
5
5
|
import { createRef as P, ref as k } from "lit/directives/ref.js";
|
|
6
6
|
import { u as Ut } from "../../chunks/useT9n.js";
|
|
7
|
-
import { NodeInterrupt as dt, Annotation as h, StateGraph as C, START as
|
|
8
|
-
import { sendTraceMessage as g, invokeStructuredPrompt as
|
|
7
|
+
import { NodeInterrupt as dt, Annotation as h, StateGraph as C, START as N, END as w } from "@langchain/langgraph/web";
|
|
8
|
+
import { sendTraceMessage as g, invokeStructuredPrompt as v, sendUXSuggestion as L, createAgentRuntimeStateWithSharedState as A, createChatModel as B, getEmbeddings as Ft } from "@arcgis/ai-components/utils/index.js";
|
|
9
9
|
import r from "zod";
|
|
10
10
|
import { a as Ot, c as Kt, q as Vt } from "../../chunks/groups.js";
|
|
11
11
|
import jt from "@arcgis/core/identity/IdentityManager.js";
|
|
12
|
-
import
|
|
12
|
+
import J from "@arcgis/core/request.js";
|
|
13
13
|
import { a as z, t as Lt, b as Bt } from "../../chunks/functionalities.js";
|
|
14
|
-
import { ChatPromptTemplate as
|
|
14
|
+
import { ChatPromptTemplate as Q } from "@langchain/core/prompts";
|
|
15
15
|
import { tool as pt } from "@langchain/core/tools";
|
|
16
16
|
import { s as Qt, a as Wt } from "../../chunks/item2.js";
|
|
17
17
|
import { g as Jt, e as _t, i as Yt, c as Ht, a as Xt } from "../../chunks/groups2.js";
|
|
@@ -20,7 +20,7 @@ const mt = (t) => {
|
|
|
20
20
|
const { portal: e, user: a } = t ?? {};
|
|
21
21
|
return !!t && !!e && !!a;
|
|
22
22
|
};
|
|
23
|
-
function
|
|
23
|
+
function S(t) {
|
|
24
24
|
if (!mt(t))
|
|
25
25
|
throw new Error("Invalid context: PortalAssistantContext with portal and user is required.");
|
|
26
26
|
}
|
|
@@ -41,7 +41,7 @@ Not added members:
|
|
|
41
41
|
{notAddedMembers}
|
|
42
42
|
`, ee = (t) => t.map((e) => `"${e}"`).join(", "), ae = r.object({
|
|
43
43
|
successMessage: r.string().default("")
|
|
44
|
-
}),
|
|
44
|
+
}), _ = "portal-group-creation", Y = "approveAddMembers", ne = async (t, e) => {
|
|
45
45
|
if (t.intentParams.intent !== "addMembers")
|
|
46
46
|
return {
|
|
47
47
|
status: "success",
|
|
@@ -65,10 +65,10 @@ ${n.map((p) => `- **@${p}**`).join(`
|
|
|
65
65
|
`)}
|
|
66
66
|
|
|
67
67
|
Do you want to continue?`, { hitlResponse: i } = e?.configurable ?? {};
|
|
68
|
-
if (i?.agentId !==
|
|
68
|
+
if (i?.agentId !== _ || i.id !== Y) {
|
|
69
69
|
const p = {
|
|
70
|
-
agentId:
|
|
71
|
-
id:
|
|
70
|
+
agentId: _,
|
|
71
|
+
id: Y,
|
|
72
72
|
kind: "booleanChoice",
|
|
73
73
|
message: s,
|
|
74
74
|
metadata: {
|
|
@@ -89,7 +89,7 @@ Do you want to continue?`, { hitlResponse: i } = e?.configurable ?? {};
|
|
|
89
89
|
e
|
|
90
90
|
);
|
|
91
91
|
const u = e?.configurable?.context;
|
|
92
|
-
|
|
92
|
+
S(u);
|
|
93
93
|
const { result: c, error: d } = await Ot(u.portal, a, n);
|
|
94
94
|
if (d || !c)
|
|
95
95
|
return {
|
|
@@ -98,7 +98,7 @@ Do you want to continue?`, { hitlResponse: i } = e?.configurable ?? {};
|
|
|
98
98
|
};
|
|
99
99
|
const { addedUsernames: l, notAddedUsers: m } = c;
|
|
100
100
|
try {
|
|
101
|
-
const f = (await
|
|
101
|
+
const f = (await v({
|
|
102
102
|
promptText: te,
|
|
103
103
|
schema: ae,
|
|
104
104
|
modelTier: "fast",
|
|
@@ -141,7 +141,7 @@ Group title:
|
|
|
141
141
|
|
|
142
142
|
Failure reason:
|
|
143
143
|
{failureReason}
|
|
144
|
-
`,
|
|
144
|
+
`, H = "portal-group-creation", X = "approveCreateGroup", re = r.object({
|
|
145
145
|
successMessage: r.string().default("")
|
|
146
146
|
}), ie = r.object({
|
|
147
147
|
failureMessage: r.string().default("")
|
|
@@ -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 } = e?.configurable;
|
|
161
|
-
if (o?.agentId !==
|
|
161
|
+
if (o?.agentId !== H || o.id !== X) {
|
|
162
162
|
const d = {
|
|
163
|
-
agentId:
|
|
164
|
-
id:
|
|
163
|
+
agentId: H,
|
|
164
|
+
id: X,
|
|
165
165
|
kind: "booleanChoice",
|
|
166
166
|
message: n,
|
|
167
167
|
metadata: {
|
|
@@ -179,7 +179,7 @@ Failure reason:
|
|
|
179
179
|
};
|
|
180
180
|
await g({ text: `Creating group "${a}"...`, agentName: "group-creation" }, e);
|
|
181
181
|
const s = e?.configurable?.context;
|
|
182
|
-
|
|
182
|
+
S(s);
|
|
183
183
|
const { result: i, error: u } = await Kt(s.portal, {
|
|
184
184
|
title: a,
|
|
185
185
|
access: "private"
|
|
@@ -187,7 +187,7 @@ Failure reason:
|
|
|
187
187
|
if (u || !i) {
|
|
188
188
|
const d = u?.message?.trim() || "No additional details were provided.";
|
|
189
189
|
try {
|
|
190
|
-
const m = (await
|
|
190
|
+
const m = (await v({
|
|
191
191
|
promptText: se,
|
|
192
192
|
schema: ie,
|
|
193
193
|
modelTier: "fast",
|
|
@@ -211,7 +211,7 @@ Failure reason:
|
|
|
211
211
|
}
|
|
212
212
|
const c = i.id;
|
|
213
213
|
try {
|
|
214
|
-
const l = (await
|
|
214
|
+
const l = (await v({
|
|
215
215
|
promptText: oe,
|
|
216
216
|
schema: re,
|
|
217
217
|
modelTier: "fast",
|
|
@@ -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 = (t) => {
|
|
234
234
|
for (let e = t.length - 1; e >= 0; e -= 1) {
|
|
235
235
|
const a = t[e];
|
|
236
236
|
if (a.type !== "human")
|
|
@@ -277,7 +277,7 @@ User message:
|
|
|
277
277
|
clarifyMessage: r.string().default("")
|
|
278
278
|
}), de = async (t, e) => {
|
|
279
279
|
await g({ text: "Thinking about groups...", agentName: "group-creation" }, e);
|
|
280
|
-
const a =
|
|
280
|
+
const a = b(t.agentExecutionContext.messages).trim(), n = await v({
|
|
281
281
|
promptText: ce,
|
|
282
282
|
schema: le,
|
|
283
283
|
modelTier: "default",
|
|
@@ -304,11 +304,11 @@ User message:
|
|
|
304
304
|
destinationType: r.literal("portal-item"),
|
|
305
305
|
itemId: r.string().trim().min(1),
|
|
306
306
|
t9nKey: r.string().min(1).optional()
|
|
307
|
-
}),
|
|
307
|
+
}), be = r.object({
|
|
308
308
|
destinationType: r.literal("portal-group"),
|
|
309
309
|
groupId: r.string().trim().min(1),
|
|
310
310
|
t9nKey: r.string().min(1).optional()
|
|
311
|
-
}),
|
|
311
|
+
}), ve = r.object({
|
|
312
312
|
destinationType: r.union([
|
|
313
313
|
r.literal("portal-gallery"),
|
|
314
314
|
r.literal("portal-map-viewer"),
|
|
@@ -321,25 +321,25 @@ User message:
|
|
|
321
321
|
fe,
|
|
322
322
|
ye,
|
|
323
323
|
we,
|
|
324
|
-
|
|
325
|
-
|
|
324
|
+
be,
|
|
325
|
+
ve
|
|
326
326
|
]), gt = "portal-navigation", E = async (t, e) => {
|
|
327
327
|
const a = e?.configurable?.context;
|
|
328
|
-
!mt(a) || !a.navigationTargetMap?.[t.destinationType] || await
|
|
328
|
+
!mt(a) || !a.navigationTargetMap?.[t.destinationType] || await L({ type: gt, data: { ...t } }, e);
|
|
329
329
|
}, xe = async (t, e) => {
|
|
330
330
|
const a = t.createdGroupId ?? t.agentExecutionContext.sharedState.createdGroupId?.value;
|
|
331
331
|
return a ? (await g({ text: "Preparing navigation...", agentName: "group-creation" }, e), await E({ destinationType: "portal-group", groupId: a }, e), {}) : {};
|
|
332
|
-
},
|
|
333
|
-
...
|
|
332
|
+
}, Z = (t, e) => e ?? t, ht = h.Root({
|
|
333
|
+
...A(),
|
|
334
334
|
// * Shared state between nodes (but not persisted to the agent execution context)
|
|
335
335
|
/** Parameters related to the user's intent for group creation actions */
|
|
336
|
-
intentParams: h({ reducer:
|
|
336
|
+
intentParams: h({ reducer: Z, default: () => ({ intent: "clarify" }) }),
|
|
337
337
|
/** The ID of the group that was created
|
|
338
338
|
* even though we already have this in the shared state
|
|
339
339
|
* we still need it here to also share between nodes
|
|
340
340
|
*/
|
|
341
|
-
createdGroupId: h({ reducer:
|
|
342
|
-
}), Se = () => new C(ht).addNode("detectGroupCreationIntent", de).addNode("createPortalGroup", ue).addNode("addMembersToPortalGroup", ne).addNode("suggestCreatedGroupNavigation", xe).addEdge(
|
|
341
|
+
createdGroupId: h({ reducer: Z, default: () => "" })
|
|
342
|
+
}), Se = () => new C(ht).addNode("detectGroupCreationIntent", de).addNode("createPortalGroup", ue).addNode("addMembersToPortalGroup", ne).addNode("suggestCreatedGroupNavigation", xe).addEdge(N, "detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent", (e) => {
|
|
343
343
|
switch (e.intentParams.intent) {
|
|
344
344
|
case "create":
|
|
345
345
|
return "createPortalGroup";
|
|
@@ -365,9 +365,9 @@ User message:
|
|
|
365
365
|
return {
|
|
366
366
|
conversationId: typeof a.conversationId == "string" ? a.conversationId : ""
|
|
367
367
|
};
|
|
368
|
-
},
|
|
368
|
+
}, Ne = (t) => ({
|
|
369
369
|
[ft]: { value: t }
|
|
370
|
-
}),
|
|
370
|
+
}), Ae = {
|
|
371
371
|
pipeline: {
|
|
372
372
|
follow_up: { allow: !1 }
|
|
373
373
|
}
|
|
@@ -376,7 +376,7 @@ function Pe(t) {
|
|
|
376
376
|
return {
|
|
377
377
|
kind: "DocAIAssistantRequest",
|
|
378
378
|
filters: {
|
|
379
|
-
...
|
|
379
|
+
...Ae,
|
|
380
380
|
persona: { persona: t }
|
|
381
381
|
}
|
|
382
382
|
};
|
|
@@ -410,7 +410,7 @@ async function qe({
|
|
|
410
410
|
const s = `${t.helperServices.aiAssistantServices.url}/skills/${e}/chat`, i = {
|
|
411
411
|
"Content-Type": "application/json",
|
|
412
412
|
token: jt.findCredential(t.url)?.token ?? ""
|
|
413
|
-
}, u = await
|
|
413
|
+
}, u = await J(s, {
|
|
414
414
|
method: "post",
|
|
415
415
|
body: JSON.stringify({
|
|
416
416
|
message: a,
|
|
@@ -428,7 +428,7 @@ async function qe({
|
|
|
428
428
|
if (!y)
|
|
429
429
|
return;
|
|
430
430
|
await Lt(500);
|
|
431
|
-
const I = await
|
|
431
|
+
const I = await J(s, {
|
|
432
432
|
method: "post",
|
|
433
433
|
body: JSON.stringify({ conversationId: l, inquiryId: m, ackSequenceNumber: f }),
|
|
434
434
|
headers: i,
|
|
@@ -438,8 +438,8 @@ async function qe({
|
|
|
438
438
|
throw new Error(`Doc assistant poll failed (${I.httpStatus})`, {
|
|
439
439
|
cause: I.data
|
|
440
440
|
});
|
|
441
|
-
const
|
|
442
|
-
d.push(
|
|
441
|
+
const M = I.data;
|
|
442
|
+
d.push(M), await p(M.sequenceNumber, M.hasMore);
|
|
443
443
|
};
|
|
444
444
|
return c.hasMore && await p(c.sequenceNumber, c.hasMore), d;
|
|
445
445
|
}
|
|
@@ -463,14 +463,14 @@ function ze(t, e) {
|
|
|
463
463
|
}
|
|
464
464
|
const Ee = async (t, e) => {
|
|
465
465
|
await g({ text: "Asking documentation assistant...", agentName: "doc-assistant" }, e);
|
|
466
|
-
const a =
|
|
466
|
+
const a = b(t.agentExecutionContext.messages).trim();
|
|
467
467
|
if (!a)
|
|
468
468
|
return {
|
|
469
469
|
status: "success",
|
|
470
470
|
outputMessage: "Please share your question and I can help with ArcGIS and Portal documentation."
|
|
471
471
|
};
|
|
472
472
|
const n = e?.configurable?.context;
|
|
473
|
-
|
|
473
|
+
S(n);
|
|
474
474
|
const o = Ce(t.agentExecutionContext.sharedState), { reply: s, conversationId: i } = await ke({
|
|
475
475
|
portal: n.portal,
|
|
476
476
|
question: a,
|
|
@@ -481,7 +481,7 @@ const Ee = async (t, e) => {
|
|
|
481
481
|
return {
|
|
482
482
|
status: "success",
|
|
483
483
|
outputMessage: s.trim() || "I could not retrieve a response from the documentation assistant.",
|
|
484
|
-
sharedStatePatch:
|
|
484
|
+
sharedStatePatch: Ne({
|
|
485
485
|
conversationId: i || o.conversationId
|
|
486
486
|
})
|
|
487
487
|
};
|
|
@@ -491,7 +491,7 @@ const Ee = async (t, e) => {
|
|
|
491
491
|
if (!a)
|
|
492
492
|
return null;
|
|
493
493
|
const n = e?.configurable?.context;
|
|
494
|
-
|
|
494
|
+
S(n);
|
|
495
495
|
try {
|
|
496
496
|
return (await Vt(n.portal, { query: `title:${a}`, num: 1 }))?.results[0]?.id || null;
|
|
497
497
|
} catch (o) {
|
|
@@ -511,7 +511,7 @@ const Ee = async (t, e) => {
|
|
|
511
511
|
if (!a)
|
|
512
512
|
return null;
|
|
513
513
|
const n = e?.configurable?.context;
|
|
514
|
-
|
|
514
|
+
S(n);
|
|
515
515
|
const { result: o, error: s } = await Qt(n.portal, a, { num: 1 });
|
|
516
516
|
return s && console.error("Error searching for portal item by title:", s), o?.results[0]?.id || null;
|
|
517
517
|
},
|
|
@@ -530,7 +530,7 @@ function G(t, e = "#") {
|
|
|
530
530
|
const n = t.match(new RegExp(`\\${e}([^\\s"']+)`, "u"));
|
|
531
531
|
return n?.[1] ? n[1].trim() : null;
|
|
532
532
|
}
|
|
533
|
-
const
|
|
533
|
+
const bt = {
|
|
534
534
|
"portal-content": {
|
|
535
535
|
description: "The main content page of the portal.",
|
|
536
536
|
hints: ["My content", "Content"]
|
|
@@ -595,7 +595,7 @@ const vt = {
|
|
|
595
595
|
description: "The Organization > Settings > Security page of the portal.",
|
|
596
596
|
hints: ["Organization settings", "Security", "Organization > Settings > Security"]
|
|
597
597
|
}
|
|
598
|
-
}, $e = Bt(
|
|
598
|
+
}, $e = Bt(bt), Re = Object.entries(bt).map(([t, { description: e, hints: a }]) => ` - ${t}: ${e} (hints: ${a.join(", ")})`).join(`
|
|
599
599
|
`), De = `
|
|
600
600
|
You decide whether the assistant response should include a navigation action to ArcGIS Portal.
|
|
601
601
|
|
|
@@ -625,7 +625,7 @@ User question:
|
|
|
625
625
|
|
|
626
626
|
Assistant response:
|
|
627
627
|
{response}
|
|
628
|
-
`,
|
|
628
|
+
`, tt = r.object({
|
|
629
629
|
shouldSuggestNavigation: r.boolean().default(!1),
|
|
630
630
|
destinationType: r.enum(["none", ...$e]).default("none"),
|
|
631
631
|
itemId: r.string().default(""),
|
|
@@ -636,10 +636,10 @@ Assistant response:
|
|
|
636
636
|
const a = t.outputMessage.trim();
|
|
637
637
|
if (!a)
|
|
638
638
|
return {};
|
|
639
|
-
const n =
|
|
639
|
+
const n = b(t.agentExecutionContext.messages).trim(), o = await Q.fromTemplate(De).format({
|
|
640
640
|
question: n,
|
|
641
641
|
response: a
|
|
642
|
-
}), i = (await
|
|
642
|
+
}), i = (await B({ modelTier: "fast" })).withStructuredOutput(tt), u = tt.parse(await i.invoke(o));
|
|
643
643
|
if (!u.shouldSuggestNavigation || u.destinationType === "none")
|
|
644
644
|
return {};
|
|
645
645
|
if (u.destinationType === "portal-item" && !u.itemId) {
|
|
@@ -692,9 +692,9 @@ function Fe({
|
|
|
692
692
|
return z(t);
|
|
693
693
|
}
|
|
694
694
|
}
|
|
695
|
-
const
|
|
696
|
-
...
|
|
697
|
-
}), Oe = () => new C(
|
|
695
|
+
const vt = h.Root({
|
|
696
|
+
...A()
|
|
697
|
+
}), Oe = () => new C(vt).addNode("answerDocQuestion", Ee).addNode("extractNavigationIntent", Ue).addEdge(N, "answerDocQuestion").addEdge("answerDocQuestion", "extractNavigationIntent").addEdge("extractNavigationIntent", w), Ke = String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
|
|
698
698
|
- answers general ArcGIS, Portal, Enterprise, and JavaScript SDK questions
|
|
699
699
|
- acts as a fallback when specialized agents are not applicable
|
|
700
700
|
`, Ve = {
|
|
@@ -702,7 +702,7 @@ const bt = h.Root({
|
|
|
702
702
|
name: "Portal Doc Assistant",
|
|
703
703
|
description: Ke,
|
|
704
704
|
createGraph: Oe,
|
|
705
|
-
workspace:
|
|
705
|
+
workspace: vt
|
|
706
706
|
}, je = () => ({ latestGroupId: null, memory: {} }), $ = (t) => {
|
|
707
707
|
const e = t?.agentExecutionContext.sharedState.portalGroupSummaryMemory?.value;
|
|
708
708
|
return e ? { latestGroupId: e.latestGroupId, memory: e.memory } : je();
|
|
@@ -740,10 +740,10 @@ Question:
|
|
|
740
740
|
{question}
|
|
741
741
|
`, Be = async (t, e) => {
|
|
742
742
|
await g({ text: "Answering group follow-up...", agentName: "group-analytics" }, e);
|
|
743
|
-
const a = $(t), n = t.groupSummaryGroupId ?? a.latestGroupId, o = n ? a.memory[n] : void 0, s = t.groupSummaryQuestion ||
|
|
743
|
+
const a = $(t), n = t.groupSummaryGroupId ?? a.latestGroupId, o = n ? a.memory[n] : void 0, s = t.groupSummaryQuestion || b(t.agentExecutionContext.messages);
|
|
744
744
|
return o ? {
|
|
745
745
|
status: "success",
|
|
746
|
-
outputMessage: (await
|
|
746
|
+
outputMessage: (await v({
|
|
747
747
|
promptText: Le,
|
|
748
748
|
schema: Qe,
|
|
749
749
|
modelTier: "default",
|
|
@@ -791,10 +791,10 @@ User message:
|
|
|
791
791
|
{userMessage}
|
|
792
792
|
`, Je = async (t, e) => {
|
|
793
793
|
await g({ text: "Analyzing group-analytics intent...", agentName: "group-analytics" }, e);
|
|
794
|
-
const a =
|
|
794
|
+
const a = b(t.agentExecutionContext.messages), n = !!$(t).latestGroupId, o = await Q.fromTemplate(We).format({
|
|
795
795
|
userMessage: a,
|
|
796
796
|
hasAnalyticsContext: String(n)
|
|
797
|
-
}), i = (await
|
|
797
|
+
}), i = (await B({ modelTier: "fast" })).withStructuredOutput(et), u = et.parse(await i.invoke(o));
|
|
798
798
|
let c = u.groupId;
|
|
799
799
|
if ((u.intent === "summarize" || u.intent === "navigation") && !c) {
|
|
800
800
|
const y = G(a, "$");
|
|
@@ -808,7 +808,7 @@ User message:
|
|
|
808
808
|
status: "success",
|
|
809
809
|
outputMessage: f ? "Please clarify with a group id or title" : ""
|
|
810
810
|
};
|
|
811
|
-
},
|
|
811
|
+
}, et = r.object({
|
|
812
812
|
intent: r.enum(["summarize", "followUp", "navigation", "clarify"]),
|
|
813
813
|
groupId: r.string().default(""),
|
|
814
814
|
question: r.string().default("")
|
|
@@ -948,14 +948,14 @@ Deterministic signals:
|
|
|
948
948
|
};
|
|
949
949
|
await g({ text: `Analyzing group ${a}...`, agentName: "group-analytics" }, e);
|
|
950
950
|
const n = e?.configurable?.context;
|
|
951
|
-
|
|
951
|
+
S(n);
|
|
952
952
|
const { result: o, error: s } = await na(n.portal, a);
|
|
953
953
|
if (s || !o)
|
|
954
954
|
return await g({ text: "Failed to fetch group context", agentName: "group-analytics" }, e), {
|
|
955
955
|
status: "success",
|
|
956
956
|
outputMessage: "Unable to retrieve group context for analytics."
|
|
957
957
|
};
|
|
958
|
-
const { group: i, items: u } = o, c = Date.now(), d = i.modified, l = d ? xt({ timestamp: d, now: c, windowMs: sa }) : !1, m = u.recentlyModifiedItems.length, p = m > 0, f = l || p, y = await
|
|
958
|
+
const { group: i, items: u } = o, c = Date.now(), d = i.modified, l = d ? xt({ timestamp: d, now: c, windowMs: sa }) : !1, m = u.recentlyModifiedItems.length, p = m > 0, f = l || p, y = await v({
|
|
959
959
|
promptText: oa,
|
|
960
960
|
schema: ia,
|
|
961
961
|
modelTier: "default",
|
|
@@ -968,23 +968,23 @@ Deterministic signals:
|
|
|
968
968
|
recentItemCount: m
|
|
969
969
|
})
|
|
970
970
|
}
|
|
971
|
-
}), { followUpQuestions: I, summary:
|
|
971
|
+
}), { followUpQuestions: I, summary: M } = y, kt = $(t), qt = {
|
|
972
972
|
latestGroupId: a,
|
|
973
973
|
memory: {
|
|
974
974
|
...kt.memory,
|
|
975
|
-
[a]: { summary:
|
|
975
|
+
[a]: { summary: M, followUpQuestions: I, fullContext: o }
|
|
976
976
|
}
|
|
977
977
|
};
|
|
978
|
-
return I.length && await
|
|
978
|
+
return I.length && await L({ type: "suggested-prompts", data: { prompts: I } }, e), {
|
|
979
979
|
status: "success",
|
|
980
|
-
outputMessage:
|
|
980
|
+
outputMessage: M,
|
|
981
981
|
sharedStatePatch: { portalGroupSummaryMemory: { value: qt } }
|
|
982
982
|
};
|
|
983
983
|
}, ia = r.object({
|
|
984
984
|
summary: r.string(),
|
|
985
985
|
followUpQuestions: r.array(r.string()).default([])
|
|
986
986
|
}), R = (t, e) => e ?? t, St = h.Root({
|
|
987
|
-
...
|
|
987
|
+
...A(),
|
|
988
988
|
groupSummaryIntent: h({
|
|
989
989
|
reducer: R,
|
|
990
990
|
default: () => "clarify"
|
|
@@ -997,7 +997,7 @@ Deterministic signals:
|
|
|
997
997
|
reducer: R,
|
|
998
998
|
default: () => ""
|
|
999
999
|
})
|
|
1000
|
-
}), ua = () => new C(St).addNode("detectGroupSummaryIntent", Je).addNode("summarizePortalGroup", ra).addNode("answerGroupSummaryFollowUp", Be).addNode("suggestGroupSummaryNavigation", _e).addEdge(
|
|
1000
|
+
}), ua = () => new C(St).addNode("detectGroupSummaryIntent", Je).addNode("summarizePortalGroup", ra).addNode("answerGroupSummaryFollowUp", Be).addNode("suggestGroupSummaryNavigation", _e).addEdge(N, "detectGroupSummaryIntent").addConditionalEdges("detectGroupSummaryIntent", (e) => e.groupSummaryIntent === "summarize" ? "summarizePortalGroup" : e.groupSummaryIntent === "followUp" ? "answerGroupSummaryFollowUp" : e.groupSummaryIntent === "navigation" ? "suggestGroupSummaryNavigation" : w).addEdge("summarizePortalGroup", w).addEdge("answerGroupSummaryFollowUp", w).addEdge("suggestGroupSummaryNavigation", w), ca = String.raw`- **portal-group-analytics** - Portal group analytics assistant:
|
|
1001
1001
|
- summarizes ArcGIS portal groups from group context and sourceJSON details
|
|
1002
1002
|
- answers follow-up questions grounded in the summarized group
|
|
1003
1003
|
- suggests navigation to groups when relevant
|
|
@@ -1007,10 +1007,10 @@ Deterministic signals:
|
|
|
1007
1007
|
description: ca,
|
|
1008
1008
|
createGraph: ua,
|
|
1009
1009
|
workspace: St
|
|
1010
|
-
}, da = () => ({ latestItemId: null, memory: {} }),
|
|
1010
|
+
}, da = () => ({ latestItemId: null, memory: {} }), W = (t) => {
|
|
1011
1011
|
const e = t?.agentExecutionContext.sharedState.portalItemAnalyticsSummaryMemory?.value;
|
|
1012
1012
|
return e ? { latestItemId: e.latestItemId, memory: e.memory } : da();
|
|
1013
|
-
},
|
|
1013
|
+
}, at = r.object({
|
|
1014
1014
|
intent: r.enum(["summarize", "followUp", "clarify"]),
|
|
1015
1015
|
itemId: r.string().default(""),
|
|
1016
1016
|
question: r.string().default("")
|
|
@@ -1036,10 +1036,10 @@ Question:
|
|
|
1036
1036
|
{question}
|
|
1037
1037
|
`, ha = async (t, e) => {
|
|
1038
1038
|
await g({ text: "Answering follow-up...", agentName: "analytics" }, e);
|
|
1039
|
-
const a =
|
|
1039
|
+
const a = W(t), n = t.analyticsItemId ?? a.latestItemId, o = n ? a.memory[n] : void 0, s = t.analyticsQuestion || b(t.agentExecutionContext.messages);
|
|
1040
1040
|
return o ? {
|
|
1041
1041
|
status: "success",
|
|
1042
|
-
outputMessage: (await
|
|
1042
|
+
outputMessage: (await v({
|
|
1043
1043
|
promptText: ga,
|
|
1044
1044
|
schema: ma,
|
|
1045
1045
|
modelTier: "default",
|
|
@@ -1085,10 +1085,10 @@ User message:
|
|
|
1085
1085
|
{userMessage}
|
|
1086
1086
|
`, ya = async (t, e) => {
|
|
1087
1087
|
await g({ text: "Analyzing intent...", agentName: "analytics" }, e);
|
|
1088
|
-
const a =
|
|
1088
|
+
const a = b(t.agentExecutionContext.messages), n = !!W(t).latestItemId, o = await Q.fromTemplate(fa).format({
|
|
1089
1089
|
userMessage: a,
|
|
1090
1090
|
hasSummaryContext: String(n)
|
|
1091
|
-
}), i = (await
|
|
1091
|
+
}), i = (await B({ modelTier: "fast" })).withStructuredOutput(at), u = at.parse(await i.invoke(o));
|
|
1092
1092
|
let c = u.itemId;
|
|
1093
1093
|
if (u.intent === "summarize" && !c) {
|
|
1094
1094
|
const y = G(a, "#");
|
|
@@ -1118,7 +1118,7 @@ Do not include internal identifiers.
|
|
|
1118
1118
|
If the user asks for a detailed summary, you may expand the response up to 300 words.
|
|
1119
1119
|
Item context:
|
|
1120
1120
|
{context}
|
|
1121
|
-
`,
|
|
1121
|
+
`, ba = async (t, e) => {
|
|
1122
1122
|
const a = t.analyticsItemId;
|
|
1123
1123
|
if (!a)
|
|
1124
1124
|
return {
|
|
@@ -1127,32 +1127,32 @@ Item context:
|
|
|
1127
1127
|
};
|
|
1128
1128
|
await g({ text: `Summarizing item ${a}...`, agentName: "analytics" }, e);
|
|
1129
1129
|
const n = e?.configurable?.context;
|
|
1130
|
-
|
|
1130
|
+
S(n);
|
|
1131
1131
|
const { portal: o, user: s } = n, { result: i, error: u } = await Wt(s, o, a);
|
|
1132
1132
|
if (u || !i)
|
|
1133
1133
|
return await g({ text: "Failed to get item context for summarization", agentName: "analytics" }, e), {
|
|
1134
1134
|
status: "success",
|
|
1135
1135
|
outputMessage: "Unable to retrieve item context for summarization."
|
|
1136
1136
|
};
|
|
1137
|
-
const { context: c } = i, d = await
|
|
1137
|
+
const { context: c } = i, d = await v({
|
|
1138
1138
|
promptText: wa,
|
|
1139
1139
|
schema: pa,
|
|
1140
1140
|
modelTier: "default",
|
|
1141
1141
|
inputVariables: { context: JSON.stringify(c) }
|
|
1142
|
-
}), { followUpQuestions: l, summary: m } = d, p =
|
|
1142
|
+
}), { followUpQuestions: l, summary: m } = d, p = W(t), f = {
|
|
1143
1143
|
latestItemId: a,
|
|
1144
1144
|
memory: {
|
|
1145
1145
|
...p.memory,
|
|
1146
1146
|
[a]: { summary: m, followUpQuestions: l, fullContext: c }
|
|
1147
1147
|
}
|
|
1148
1148
|
};
|
|
1149
|
-
return l.length && await
|
|
1149
|
+
return l.length && await L({ type: "suggested-prompts", data: { prompts: l } }, e), {
|
|
1150
1150
|
status: "success",
|
|
1151
1151
|
outputMessage: m,
|
|
1152
1152
|
sharedStatePatch: { portalItemAnalyticsSummaryMemory: { value: f } }
|
|
1153
1153
|
};
|
|
1154
1154
|
}, D = (t, e) => e ?? t, Mt = h.Root({
|
|
1155
|
-
...
|
|
1155
|
+
...A(),
|
|
1156
1156
|
// States shared only across nodes in the graph, not between invocations
|
|
1157
1157
|
analyticsIntent: h({
|
|
1158
1158
|
reducer: D,
|
|
@@ -1166,7 +1166,7 @@ Item context:
|
|
|
1166
1166
|
reducer: D,
|
|
1167
1167
|
default: () => ""
|
|
1168
1168
|
})
|
|
1169
|
-
}),
|
|
1169
|
+
}), va = () => new C(Mt).addNode("detectAnalyticsIntent", ya).addNode("summarizePortalItem", ba).addNode("answerAnalyticsFollowUp", ha).addEdge(N, "detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent", (e) => e.analyticsIntent === "summarize" ? "summarizePortalItem" : e.analyticsIntent === "followUp" ? "answerAnalyticsFollowUp" : w).addEdge("summarizePortalItem", w).addEdge("answerAnalyticsFollowUp", w), Ia = String.raw`- **portal-item-analytics** - Portal item analytics assistant:
|
|
1170
1170
|
- answers questions about one specific ArcGIS portal item when item context is present
|
|
1171
1171
|
- summarizes item details, metadata, and context grounded in that item
|
|
1172
1172
|
- suggests follow-up prompts grounded in the same item
|
|
@@ -1175,7 +1175,7 @@ Item context:
|
|
|
1175
1175
|
id: "portal-item-analytics",
|
|
1176
1176
|
name: "Portal Item Analytics",
|
|
1177
1177
|
description: Ia,
|
|
1178
|
-
createGraph:
|
|
1178
|
+
createGraph: va,
|
|
1179
1179
|
workspace: Mt
|
|
1180
1180
|
}, Sa = {
|
|
1181
1181
|
schemaVersion: "1.0",
|
|
@@ -1273,24 +1273,7 @@ Item context:
|
|
|
1273
1273
|
]
|
|
1274
1274
|
}, Ta = {
|
|
1275
1275
|
schemaVersion: "1.0",
|
|
1276
|
-
capabilities: [
|
|
1277
|
-
{
|
|
1278
|
-
id: "org-config-mfa",
|
|
1279
|
-
title: "Multifactor Authentication (MFA)",
|
|
1280
|
-
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.",
|
|
1281
|
-
hints: ["config MFA", "set up MFA"],
|
|
1282
|
-
platforms: ["online", "enterprise"],
|
|
1283
|
-
resolutions: {
|
|
1284
|
-
navigate: {
|
|
1285
|
-
routeKey: "organization",
|
|
1286
|
-
queryParams: {
|
|
1287
|
-
tab: "security"
|
|
1288
|
-
},
|
|
1289
|
-
hash: "settings"
|
|
1290
|
-
}
|
|
1291
|
-
}
|
|
1292
|
-
}
|
|
1293
|
-
]
|
|
1276
|
+
capabilities: []
|
|
1294
1277
|
}, Ga = {
|
|
1295
1278
|
"contentRouteRegistry.ts": Sa,
|
|
1296
1279
|
"groupsRouteRegistry.ts": Ma,
|
|
@@ -1306,15 +1289,18 @@ function Ca(t) {
|
|
|
1306
1289
|
}
|
|
1307
1290
|
return e;
|
|
1308
1291
|
}
|
|
1309
|
-
let
|
|
1310
|
-
function
|
|
1311
|
-
return
|
|
1292
|
+
let U;
|
|
1293
|
+
function x(t) {
|
|
1294
|
+
return (t || !U) && (U = Ca({
|
|
1295
|
+
...Ga,
|
|
1296
|
+
...t ? { customCapabilities: t } : {}
|
|
1297
|
+
})), U;
|
|
1312
1298
|
}
|
|
1313
|
-
const
|
|
1299
|
+
const Na = /^(?:take me to|navigate to|go to|show me|open)\s+(?:the\s+)?/u;
|
|
1314
1300
|
function q(t) {
|
|
1315
|
-
return t.toLowerCase().replace(/[^a-z0-9]+/gu, " ").trim().replace(
|
|
1301
|
+
return t.toLowerCase().replace(/[^a-z0-9]+/gu, " ").trim().replace(Na, "").trim();
|
|
1316
1302
|
}
|
|
1317
|
-
const
|
|
1303
|
+
const Aa = r.object({
|
|
1318
1304
|
capabilityIds: r.array(r.string()).default([]),
|
|
1319
1305
|
confidence: r.number().min(0).max(1).default(0),
|
|
1320
1306
|
reason: r.string().default("")
|
|
@@ -1331,7 +1317,7 @@ Candidates:
|
|
|
1331
1317
|
{candidates}`, ka = async (t, e) => {
|
|
1332
1318
|
if (t.outputMessage || t.targets.length === 0)
|
|
1333
1319
|
return {};
|
|
1334
|
-
const a =
|
|
1320
|
+
const a = b(t.agentExecutionContext.messages).trim(), n = qa(a, t);
|
|
1335
1321
|
if (n.length === 1)
|
|
1336
1322
|
return console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
|
|
1337
1323
|
method: "exact-match",
|
|
@@ -1350,9 +1336,9 @@ Candidates:
|
|
|
1350
1336
|
}))
|
|
1351
1337
|
);
|
|
1352
1338
|
try {
|
|
1353
|
-
const s = await
|
|
1339
|
+
const s = await v({
|
|
1354
1340
|
promptText: Pa,
|
|
1355
|
-
schema:
|
|
1341
|
+
schema: Aa,
|
|
1356
1342
|
modelTier: "fast",
|
|
1357
1343
|
inputVariables: { candidates: o, userRequest: a }
|
|
1358
1344
|
}), i = new Set(t.targets.map(({ capability: c }) => c.id)), u = s.capabilityIds.filter((c) => i.has(c));
|
|
@@ -1384,7 +1370,7 @@ function qa(t, e) {
|
|
|
1384
1370
|
).map(({ capability: n }) => n.id);
|
|
1385
1371
|
}
|
|
1386
1372
|
function za(t) {
|
|
1387
|
-
return
|
|
1373
|
+
return x().flatMap((e) => {
|
|
1388
1374
|
const a = $a(e);
|
|
1389
1375
|
return a && Ra(a, t) ? [{ capability: e, target: a }] : [];
|
|
1390
1376
|
});
|
|
@@ -1420,7 +1406,12 @@ function $a(t) {
|
|
|
1420
1406
|
return { destinationType: "portal-groups" };
|
|
1421
1407
|
}
|
|
1422
1408
|
case "organization":
|
|
1423
|
-
return
|
|
1409
|
+
return {
|
|
1410
|
+
destinationType: "portal-org",
|
|
1411
|
+
hash: e,
|
|
1412
|
+
queryParams: a,
|
|
1413
|
+
buttonLabel: t.buttonLabel
|
|
1414
|
+
};
|
|
1424
1415
|
default:
|
|
1425
1416
|
return;
|
|
1426
1417
|
}
|
|
@@ -1435,7 +1426,7 @@ const Da = async (t, e) => {
|
|
|
1435
1426
|
if (!a)
|
|
1436
1427
|
return {
|
|
1437
1428
|
outputMessage: "I couldn't find a matching Portal page. Try asking to open your content, groups, or organization settings.",
|
|
1438
|
-
sharedStatePatch: { navLastAnsweredRequest: { value:
|
|
1429
|
+
sharedStatePatch: { navLastAnsweredRequest: { value: F(t) } },
|
|
1439
1430
|
status: "success",
|
|
1440
1431
|
summary: "Navigation could not find a matching capability; route another agent if appropriate."
|
|
1441
1432
|
};
|
|
@@ -1444,16 +1435,16 @@ const Da = async (t, e) => {
|
|
|
1444
1435
|
outputMessage: t.chosenCapabilityIds.length ? `Click the button below to open ${a.capability.title}.` : `The closest place to start is ${a.capability.title}. Click the button below to open it.`,
|
|
1445
1436
|
status: "success",
|
|
1446
1437
|
summary: `Navigation suggested ${a.capability.id}${t.retrievalDegraded ? " using keyword-only retrieval" : ""}.`,
|
|
1447
|
-
sharedStatePatch: { navLastAnsweredRequest: { value:
|
|
1438
|
+
sharedStatePatch: { navLastAnsweredRequest: { value: F(t) } }
|
|
1448
1439
|
}) : (console.warn(`Navigation capability ${a.capability.id} was not found in the resolver.`), {
|
|
1449
1440
|
outputMessage: "I found a possible destination, but couldn't resolve a valid Portal navigation target. Try asking to open your content, groups, or organization settings.",
|
|
1450
1441
|
status: "success",
|
|
1451
1442
|
summary: `Navigation resolver could not map ${a.capability.id}.`,
|
|
1452
|
-
sharedStatePatch: { navLastAnsweredRequest: { value:
|
|
1443
|
+
sharedStatePatch: { navLastAnsweredRequest: { value: F(t) } }
|
|
1453
1444
|
});
|
|
1454
1445
|
};
|
|
1455
|
-
function
|
|
1456
|
-
return
|
|
1446
|
+
function F(t) {
|
|
1447
|
+
return b(t.agentExecutionContext.messages) || t.agentExecutionContext.userRequest;
|
|
1457
1448
|
}
|
|
1458
1449
|
async function Tt(t) {
|
|
1459
1450
|
return t.length === 0 ? [] : (await Zt.getDefault().load(), await Ft(t));
|
|
@@ -1471,11 +1462,11 @@ function Fa(t) {
|
|
|
1471
1462
|
typeof o == "string" && o.trim().length > 0 && e.push({ field: "hint", text: o });
|
|
1472
1463
|
return e;
|
|
1473
1464
|
}
|
|
1474
|
-
let
|
|
1465
|
+
let O, Gt;
|
|
1475
1466
|
async function Oa(t = {}) {
|
|
1476
|
-
return
|
|
1477
|
-
throw
|
|
1478
|
-
}), await
|
|
1467
|
+
return O ??= Va(t.embed ?? ja).then((e) => (Gt = e, e)).catch((e) => {
|
|
1468
|
+
throw O = void 0, e;
|
|
1469
|
+
}), await O;
|
|
1479
1470
|
}
|
|
1480
1471
|
function Ka() {
|
|
1481
1472
|
return Gt;
|
|
@@ -1494,7 +1485,7 @@ async function ja(t) {
|
|
|
1494
1485
|
return await e(t);
|
|
1495
1486
|
}
|
|
1496
1487
|
function La() {
|
|
1497
|
-
return
|
|
1488
|
+
return x().flatMap(
|
|
1498
1489
|
(t) => Fa(t).map(({ field: e, text: a }) => ({
|
|
1499
1490
|
capabilityId: t.id,
|
|
1500
1491
|
field: e,
|
|
@@ -1502,7 +1493,7 @@ function La() {
|
|
|
1502
1493
|
}))
|
|
1503
1494
|
);
|
|
1504
1495
|
}
|
|
1505
|
-
const ot = 1.2, st = 0.75, Ba = 60, Qa = 0.65,
|
|
1496
|
+
const ot = 1.2, st = 0.75, Ba = 60, Qa = 0.65, K = {
|
|
1506
1497
|
description: 1,
|
|
1507
1498
|
hint: 2,
|
|
1508
1499
|
title: 3
|
|
@@ -1540,14 +1531,14 @@ async function Wa(t, e = {}) {
|
|
|
1540
1531
|
};
|
|
1541
1532
|
}
|
|
1542
1533
|
function Ja() {
|
|
1543
|
-
return rt ??= _a(
|
|
1534
|
+
return rt ??= _a(x()), rt;
|
|
1544
1535
|
}
|
|
1545
1536
|
function _a(t) {
|
|
1546
1537
|
const e = /* @__PURE__ */ new Map(), a = t.map((n) => {
|
|
1547
1538
|
const o = /* @__PURE__ */ new Map();
|
|
1548
|
-
|
|
1539
|
+
V(o, n.title, K.title), V(o, n.description, K.description);
|
|
1549
1540
|
for (const s of n.hints)
|
|
1550
|
-
|
|
1541
|
+
V(o, s, K.hint);
|
|
1551
1542
|
for (const s of o.keys())
|
|
1552
1543
|
e.set(s, (e.get(s) ?? 0) + 1);
|
|
1553
1544
|
return {
|
|
@@ -1562,7 +1553,7 @@ function _a(t) {
|
|
|
1562
1553
|
documents: a
|
|
1563
1554
|
};
|
|
1564
1555
|
}
|
|
1565
|
-
function
|
|
1556
|
+
function V(t, e, a) {
|
|
1566
1557
|
for (const n of Ct(e))
|
|
1567
1558
|
t.set(n, (t.get(n) ?? 0) + a);
|
|
1568
1559
|
}
|
|
@@ -1584,7 +1575,7 @@ function Ha(t) {
|
|
|
1584
1575
|
u += m * (d * (ot + 1) / (d + p));
|
|
1585
1576
|
}
|
|
1586
1577
|
return { capability: o, score: u };
|
|
1587
|
-
}).filter(({ score: o }) => o > 0).sort(
|
|
1578
|
+
}).filter(({ score: o }) => o > 0).sort(Nt);
|
|
1588
1579
|
}
|
|
1589
1580
|
function it(t, e) {
|
|
1590
1581
|
const a = /* @__PURE__ */ new Map();
|
|
@@ -1595,11 +1586,11 @@ function it(t, e) {
|
|
|
1595
1586
|
const i = a.get(o.capabilityId);
|
|
1596
1587
|
(i === void 0 || s > i) && a.set(o.capabilityId, s);
|
|
1597
1588
|
}
|
|
1598
|
-
const n = new Map(
|
|
1589
|
+
const n = new Map(x().map((o) => [o.id, o]));
|
|
1599
1590
|
return [...a.entries()].flatMap(([o, s]) => {
|
|
1600
1591
|
const i = n.get(o);
|
|
1601
1592
|
return i && s >= Qa ? [{ capability: i, score: s }] : [];
|
|
1602
|
-
}).sort(
|
|
1593
|
+
}).sort(Nt);
|
|
1603
1594
|
}
|
|
1604
1595
|
function Xa(t, e) {
|
|
1605
1596
|
if (t.length === 0 || t.length !== e.length)
|
|
@@ -1626,12 +1617,12 @@ function ct(t, e, a) {
|
|
|
1626
1617
|
u.score += 1 / (Ba + i), a === "keyword" ? (u.keywordRank = i, u.keywordScore = s) : (u.semanticRank = i, u.semanticScore = s), t.set(o.id, u);
|
|
1627
1618
|
}
|
|
1628
1619
|
}
|
|
1629
|
-
function
|
|
1620
|
+
function Nt(t, e) {
|
|
1630
1621
|
return e.score - t.score || t.capability.id.localeCompare(e.capability.id);
|
|
1631
1622
|
}
|
|
1632
1623
|
const tn = async (t, e) => {
|
|
1633
1624
|
await g({ text: "Finding a place to navigate...", agentName: "navigation" }, e);
|
|
1634
|
-
const a =
|
|
1625
|
+
const a = b(t.agentExecutionContext.messages).trim();
|
|
1635
1626
|
try {
|
|
1636
1627
|
const n = await Wa(a, { topN: 5 });
|
|
1637
1628
|
return console.table(
|
|
@@ -1668,14 +1659,14 @@ function en(t, e) {
|
|
|
1668
1659
|
const [o] = n;
|
|
1669
1660
|
return [o, ...e.filter((s) => s !== o)];
|
|
1670
1661
|
}
|
|
1671
|
-
const
|
|
1672
|
-
...
|
|
1673
|
-
chosenCapabilityIds: h({ reducer:
|
|
1662
|
+
const j = (t, e) => e ?? t, At = h.Root({
|
|
1663
|
+
...A(),
|
|
1664
|
+
chosenCapabilityIds: h({ reducer: j, default: () => [] }),
|
|
1674
1665
|
// Empty when hybrid keyword-and-semantic retrieval succeeds; otherwise
|
|
1675
1666
|
// contains the semantic-search failure reason for response diagnostics.
|
|
1676
|
-
retrievalDegraded: h({ reducer:
|
|
1677
|
-
targets: h({ reducer:
|
|
1678
|
-
}), an = () => new C(
|
|
1667
|
+
retrievalDegraded: h({ reducer: j, default: () => "" }),
|
|
1668
|
+
targets: h({ reducer: j, default: () => [] })
|
|
1669
|
+
}), an = () => new C(At).addNode("retrieveNavigationTargets", tn).addNode("chooseNavigationTargets", ka).addNode("respondWithNavigation", Da).addEdge(N, "retrieveNavigationTargets").addEdge("retrieveNavigationTargets", "chooseNavigationTargets").addEdge("chooseNavigationTargets", "respondWithNavigation").addEdge("respondWithNavigation", w), nn = x().map(({ hints: t, title: e }) => t[0] ?? e).join(", "), on = String.raw`- **portal-navigation** - Portal page navigation assistant:
|
|
1679
1670
|
- routes requests to open, show, or navigate to a Portal page, including creation-flow pages
|
|
1680
1671
|
- falls back to the closest Portal page where a workflow starts when another agent cannot perform the action
|
|
1681
1672
|
- handles short navigation follow-ups after asking the user to open a page
|
|
@@ -1686,7 +1677,7 @@ const V = (t, e) => e ?? t, Nt = h.Root({
|
|
|
1686
1677
|
name: "Portal Navigation",
|
|
1687
1678
|
description: on,
|
|
1688
1679
|
createGraph: an,
|
|
1689
|
-
workspace:
|
|
1680
|
+
workspace: At
|
|
1690
1681
|
}, rn = Rt`: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)}`;
|
|
1691
1682
|
function un(t, e) {
|
|
1692
1683
|
if (!e)
|
|
@@ -1698,7 +1689,7 @@ function un(t, e) {
|
|
|
1698
1689
|
case "portal-groups":
|
|
1699
1690
|
return e[a]?.(t.hash);
|
|
1700
1691
|
case "portal-org":
|
|
1701
|
-
return e[a]?.(t.hash);
|
|
1692
|
+
return e[a]?.(t.hash, t.queryParams);
|
|
1702
1693
|
case "portal-gallery":
|
|
1703
1694
|
return e[a];
|
|
1704
1695
|
case "portal-map-viewer":
|
|
@@ -1783,17 +1774,17 @@ class mn extends Et {
|
|
|
1783
1774
|
return;
|
|
1784
1775
|
const o = this.getNavigationAction(n);
|
|
1785
1776
|
o && this.upsertNavigationSlotElement(a.slotName, o);
|
|
1786
|
-
}, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.navigationAgentEnabled = !0, this.defaultClosed = !1, this.arcgisPortalNavigationRequest = $t(),
|
|
1777
|
+
}, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.navigationAgentEnabled = !0, this.defaultClosed = !1, this.arcgisPortalNavigationRequest = $t(), x();
|
|
1787
1778
|
}
|
|
1788
1779
|
static {
|
|
1789
|
-
this.properties = { inputText: 16, showVoiceInput: 16, isListening: 16, isVoiceInputDisabled: 16, interrupt: 16, autoDestroyDisabled: 5, portal: 0, user: 0, config: 0, navigationTargetMap: 0, navigationAgentEnabled: 5, defaultClosed: 5 };
|
|
1780
|
+
this.properties = { inputText: 16, showVoiceInput: 16, isListening: 16, isVoiceInputDisabled: 16, interrupt: 16, autoDestroyDisabled: 5, portal: 0, user: 0, config: 0, navigationTargetMap: 0, navigationAgentEnabled: 5, defaultClosed: 5, navigationCapabilities: 0 };
|
|
1790
1781
|
}
|
|
1791
1782
|
static {
|
|
1792
1783
|
this.styles = rn;
|
|
1793
1784
|
}
|
|
1794
1785
|
async load() {
|
|
1795
1786
|
try {
|
|
1796
|
-
await Oa();
|
|
1787
|
+
x(this.navigationCapabilities), await Oa();
|
|
1797
1788
|
} catch (e) {
|
|
1798
1789
|
console.warn("[arcgis-portal-ai-assistant] embeddings warm-up failed:", e);
|
|
1799
1790
|
}
|
|
@@ -1801,12 +1792,16 @@ class mn extends Et {
|
|
|
1801
1792
|
getNavigationAction(e) {
|
|
1802
1793
|
if (e?.type !== gt)
|
|
1803
1794
|
return;
|
|
1804
|
-
const a =
|
|
1805
|
-
if (!
|
|
1795
|
+
const a = e.data, n = cn(a);
|
|
1796
|
+
if (!n)
|
|
1806
1797
|
return;
|
|
1807
|
-
const
|
|
1808
|
-
if (
|
|
1809
|
-
return {
|
|
1798
|
+
const o = un(a, this.navigationTargetMap);
|
|
1799
|
+
if (o)
|
|
1800
|
+
return {
|
|
1801
|
+
href: o,
|
|
1802
|
+
targetDetail: a,
|
|
1803
|
+
label: a?.buttonLabel || dn(n, this.t9n)
|
|
1804
|
+
};
|
|
1810
1805
|
}
|
|
1811
1806
|
upsertNavigationSlotElement(e, a) {
|
|
1812
1807
|
const n = this.assistantEl.value;
|
|
@@ -1814,16 +1809,16 @@ class mn extends Et {
|
|
|
1814
1809
|
return;
|
|
1815
1810
|
const o = `navigation:${e}`;
|
|
1816
1811
|
let s = this.navigationSlotElements.get(o);
|
|
1817
|
-
s || (s = document.createElement("div"), s.slot = e, this.navigationSlotElements.set(o, s), n.append(s)), Dt(
|
|
1812
|
+
s || (s = document.createElement("div"), s.slot = e, this.navigationSlotElements.set(o, s), n.append(s)), Dt(T`<div><calcite-button class="navigation-button" appearance=outline width=full .href=${a.href} icon-end=launch @click=${(i) => {
|
|
1818
1813
|
i.preventDefault(), this.arcgisPortalNavigationRequest.emit({
|
|
1819
1814
|
href: a.href,
|
|
1820
1815
|
targetDetail: a.targetDetail
|
|
1821
1816
|
});
|
|
1822
|
-
}}>${a.label}</calcite-button>${a.description ?
|
|
1817
|
+
}}>${a.label}</calcite-button>${a.description ? T`<div class="navigation-block-description">${a.description}</div>` : null}</div>`, s);
|
|
1823
1818
|
}
|
|
1824
1819
|
render() {
|
|
1825
1820
|
const { t9n: e, inputText: a, portal: n, user: o, navigationTargetMap: s, navigationAgentEnabled: i, showVoiceInput: u, isListening: c, isVoiceInputDisabled: d } = this;
|
|
1826
|
-
return
|
|
1821
|
+
return T`<arcgis-assistant log-enabled keep-suggested-prompts .heading=${e.heading} .entryMessage=${e.entryMessage} @arcgisSlottableRequest=${this.handleSlottableRequest} @arcgisInterrupt=${({ detail: l }) => {
|
|
1827
1822
|
this.interrupt = l;
|
|
1828
1823
|
}} @arcgisInterruptCancel=${() => {
|
|
1829
1824
|
this.interrupt = null;
|
|
@@ -1849,11 +1844,11 @@ class mn extends Et {
|
|
|
1849
1844
|
l.detail.errorCode === "not-supported" && (this.showVoiceInput = !1);
|
|
1850
1845
|
}} @arcgisVoiceInputInterimTranscription=${(l) => {
|
|
1851
1846
|
this.inputText = l.detail.text;
|
|
1852
|
-
}} ${k(this.voiceInputEl)}></arcgis-portal-voice-input>${u &&
|
|
1847
|
+
}} ${k(this.voiceInputEl)}></arcgis-portal-voice-input>${u && T`<calcite-button icon-start=microphone .label=${e.voiceInput} round .disabled=${d} .appearance=${c ? "solid" : "outline-fill"} @click=${async () => {
|
|
1853
1848
|
this.isVoiceInputDisabled = !0;
|
|
1854
1849
|
const l = this.voiceInputEl.value;
|
|
1855
1850
|
c ? await l?.stopListening() : await l?.startListening();
|
|
1856
|
-
}}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!a.trim()} .label=${e.send}>${e.send}</calcite-button></div></form><arcgis-assistant-agent .agent=${xa} .context=${{ portal: n, user: o, navigationTargetMap: s }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${Te} .context=${{ portal: n, user: o, navigationTargetMap: s }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${Ve} .context=${{ portal: n, user: o, navigationTargetMap: s }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${la} .context=${{ portal: n, user: o, navigationTargetMap: s }}></arcgis-assistant-agent>${i &&
|
|
1851
|
+
}}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!a.trim()} .label=${e.send}>${e.send}</calcite-button></div></form><arcgis-assistant-agent .agent=${xa} .context=${{ portal: n, user: o, navigationTargetMap: s }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${Te} .context=${{ portal: n, user: o, navigationTargetMap: s }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${Ve} .context=${{ portal: n, user: o, navigationTargetMap: s }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${la} .context=${{ portal: n, user: o, navigationTargetMap: s }}></arcgis-assistant-agent>${i && T`<arcgis-assistant-agent .agent=${sn} .context=${{ portal: n, user: o, navigationTargetMap: s }}></arcgis-assistant-agent>` || ""}${this.interrupt && T`<arcgis-portal-ai-assistant-interrupt slot=interrupt .type=${this.interrupt.type} .message=${this.interrupt.message} .options=${this.interrupt.options} @arcgisSubmit=${({ detail: l }) => {
|
|
1857
1852
|
this.assistantEl.value?.submitInterrupt(l);
|
|
1858
1853
|
}} @arcgisCancel=${() => {
|
|
1859
1854
|
this.assistantEl.value?.cancelInterrupt();
|