@arcgis/ai-components 5.2.0-next.76 → 5.2.0-next.78
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/agents/tools/filter/clearFilters/adapter.d.ts +8 -0
- package/dist/{chunks/adapter12.js → agents/tools/filter/clearFilters/adapter.js} +1 -1
- package/dist/agents/tools/filter/resetMap/adapter.d.ts +8 -0
- package/dist/{chunks/adapter13.js → agents/tools/filter/resetMap/adapter.js} +1 -1
- package/dist/agents/tools/filter/setFeatureEffect/adapter.d.ts +8 -0
- package/dist/{chunks/adapter14.js → agents/tools/filter/setFeatureEffect/adapter.js} +2 -2
- package/dist/agents/tools/help/listFields/adapter.d.ts +11 -0
- package/dist/{chunks/adapter11.js → agents/tools/help/listFields/adapter.js} +1 -1
- package/dist/agents/tools/navigation/goToAddress/adapter.d.ts +10 -0
- package/dist/{chunks/adapter2.js → agents/tools/navigation/goToAddress/adapter.js} +1 -1
- package/dist/agents/tools/navigation/goToBookmark/adapter.d.ts +8 -0
- package/dist/{chunks/adapter3.js → agents/tools/navigation/goToBookmark/adapter.js} +1 -1
- package/dist/agents/tools/navigation/goToFeatures/adapter.d.ts +8 -0
- package/dist/{chunks/adapter4.js → agents/tools/navigation/goToFeatures/adapter.js} +1 -1
- package/dist/agents/tools/navigation/goToFullExtent/adapter.d.ts +8 -0
- package/dist/{chunks/adapter5.js → agents/tools/navigation/goToFullExtent/adapter.js} +1 -1
- package/dist/agents/tools/navigation/goToHomeExtent/adapter.d.ts +8 -0
- package/dist/{chunks/adapter6.js → agents/tools/navigation/goToHomeExtent/adapter.js} +1 -1
- package/dist/agents/tools/navigation/goToLayer/adapter.d.ts +8 -0
- package/dist/{chunks/adapter7.js → agents/tools/navigation/goToLayer/adapter.js} +1 -1
- package/dist/agents/tools/navigation/goToScale/adapter.d.ts +8 -0
- package/dist/{chunks/adapter8.js → agents/tools/navigation/goToScale/adapter.js} +1 -1
- package/dist/agents/tools/navigation/goToViewpoint/adapter.d.ts +8 -0
- package/dist/{chunks/adapter9.js → agents/tools/navigation/goToViewpoint/adapter.js} +1 -1
- package/dist/agents/tools/navigation/goToZoom/adapter.d.ts +8 -0
- package/dist/{chunks/adapter10.js → agents/tools/navigation/goToZoom/adapter.js} +1 -1
- package/dist/agents/tools/query/getAttribute/adapter.d.ts +8 -0
- package/dist/{chunks/adapter15.js → agents/tools/query/getAttribute/adapter.js} +2 -2
- package/dist/agents/tools/query/getStatistics/adapter.d.ts +8 -0
- package/dist/{chunks/adapter16.js → agents/tools/query/getStatistics/adapter.js} +4 -4
- package/dist/agents/tools/query/getTopFeatures/adapter.d.ts +8 -0
- package/dist/{chunks/adapter17.js → agents/tools/query/getTopFeatures/adapter.js} +4 -4
- package/dist/agents/tools/query/queryFeatures/adapter.d.ts +8 -0
- package/dist/{chunks/adapter18.js → agents/tools/query/queryFeatures/adapter.js} +4 -4
- package/dist/cdn/{GRHIFCQX.js → 2EY3BQQX.js} +1 -1
- package/dist/cdn/3LILAJUD.js +2 -0
- package/dist/cdn/{S6OYR4VI.js → 3ORURUNE.js} +7 -7
- package/dist/cdn/4F7Y4RNW.js +2 -0
- package/dist/cdn/{MM33KJPF.js → 4OGR5QKS.js} +1 -1
- package/dist/cdn/{66SKMECC.js → 4WIDLQUH.js} +1 -1
- package/dist/cdn/{WMZ24LWS.js → 5X7EG7D2.js} +1 -1
- package/dist/cdn/{B6CJG5UH.js → 6U4GTCLJ.js} +14 -14
- package/dist/cdn/{7E2QMWK6.js → 7V6OSTFC.js} +1 -1
- package/dist/cdn/{5WLNL4HZ.js → 7ZFAFKJT.js} +1 -1
- package/dist/cdn/ADJ63EDN.js +3 -0
- package/dist/cdn/ATFNWFKG.js +2 -0
- package/dist/cdn/{VYTYVWR6.js → BGD2CCRJ.js} +1 -1
- package/dist/cdn/{253R5CBD.js → BS3HNSXX.js} +1 -1
- package/dist/cdn/{QZ3NQTNQ.js → BWLXDT75.js} +1 -1
- package/dist/cdn/{I6PD2HSL.js → CJMUJXPL.js} +1 -1
- package/dist/cdn/CZLLPKMS.js +2 -0
- package/dist/cdn/{CWD37QFT.js → CZM4URK7.js} +1 -1
- package/dist/cdn/EBNVLMUU.js +2 -0
- package/dist/cdn/{UPWAOZXQ.js → ERNYKCUJ.js} +1 -1
- package/dist/cdn/G5XE5D36.js +2 -0
- package/dist/cdn/{5RVELJU4.js → GAPKW32H.js} +1 -1
- package/dist/cdn/{HZ5ARNAM.js → GFEOVHJK.js} +1 -1
- package/dist/cdn/{U3XIDLHO.js → HPU6K67Y.js} +1 -1
- package/dist/cdn/{2VBPA27M.js → I7KCB7KE.js} +1 -1
- package/dist/cdn/{323DHVYA.js → IIIUSDQR.js} +1 -1
- package/dist/cdn/{TQXLSW4A.js → J7OJABFU.js} +1 -1
- package/dist/cdn/{TKYI5QRL.js → JO5ETMPS.js} +1 -1
- package/dist/cdn/LXQFE5PJ.js +2 -0
- package/dist/cdn/NLEBWLVV.js +2 -0
- package/dist/cdn/ORRMONGJ.js +2 -0
- package/dist/cdn/{MDM2K3U7.js → PBMQI4MV.js} +1 -1
- package/dist/cdn/{6CLF7KIK.js → PKJY7FBV.js} +1 -1
- package/dist/cdn/{K33MZ726.js → PUHRBGKB.js} +1 -1
- package/dist/cdn/{5DVRVY4L.js → Q57QWN5W.js} +1 -1
- package/dist/cdn/QUMNJVKX.js +2 -0
- package/dist/cdn/{QRHZXLZN.js → RBE55SWR.js} +1 -1
- package/dist/cdn/{RADWN4ZP.js → T4RIGOXB.js} +1 -1
- package/dist/cdn/{5R6QUF5B.js → UHZG7SKO.js} +1 -1
- package/dist/cdn/{DUSILSNJ.js → XHGVCL22.js} +3 -3
- package/dist/cdn/XLHTQ7CF.js +2 -0
- package/dist/cdn/{V6HOUZPZ.js → YLGKKWZK.js} +1 -1
- package/dist/cdn/YLVJA4ZE.js +2 -0
- package/dist/cdn/{NIY32GK2.js → YWULKUQV.js} +1 -1
- package/dist/cdn/{IRNSIUBT.js → YYSRYOHL.js} +1 -1
- package/dist/cdn/ZOEMBHRF.js +2 -0
- package/dist/cdn/ZWBFTKHF.js +2 -0
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/assets/assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/assistant-interrupt/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/assistant-interrupt-preview/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/assistant-message/t9n/messages.en.json +1 -0
- package/dist/cdn/assets/assistant-message-loading/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +57 -60
- package/dist/chunks/converterUtils.js +66 -48
- package/dist/chunks/helpGraph.js +1 -1
- package/dist/chunks/navigationGraph.js +9 -9
- package/dist/chunks/utils2.js +10 -41
- package/dist/chunks/utils3.js +41 -10
- package/dist/components/arcgis-assistant/customElement.d.ts +30 -1
- package/dist/components/arcgis-assistant/customElement.js +133 -135
- package/dist/components/arcgis-assistant-agent/customElement.js +18 -18
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +11 -11
- package/dist/components/arcgis-assistant-help-agent/customElement.js +17 -17
- package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -0
- package/dist/components/arcgis-assistant-interrupt/customElement.js +10 -11
- package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +12 -8
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +18 -18
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +18 -18
- package/dist/components/arcgis-assistant-message/customElement.d.ts +3 -0
- package/dist/components/arcgis-assistant-message/customElement.js +9 -8
- package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +3 -0
- package/dist/components/arcgis-assistant-message-loading/customElement.js +11 -10
- package/dist/components/arcgis-assistant-message-text/customElement.js +4 -4
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +9 -9
- package/dist/components/arcgis-assistant-user-message/customElement.d.ts +2 -0
- package/dist/components/arcgis-assistant-user-message/customElement.js +13 -10
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +4 -4
- package/dist/types/lumina.d.ts +2 -2
- package/dist/types/preact.d.ts +2 -2
- package/dist/types/react.d.ts +2 -2
- package/dist/types/stencil.d.ts +2 -2
- package/package.json +22 -5
- package/dist/cdn/2GH3K5JP.js +0 -2
- package/dist/cdn/2Y4DTOGT.js +0 -2
- package/dist/cdn/3S5G5SIX.js +0 -2
- package/dist/cdn/5TI2F5XX.js +0 -2
- package/dist/cdn/DCSZPL7R.js +0 -2
- package/dist/cdn/FSGIG7UN.js +0 -2
- package/dist/cdn/GLBE7OW2.js +0 -2
- package/dist/cdn/IDUC4CPV.js +0 -2
- package/dist/cdn/K335IAIE.js +0 -2
- package/dist/cdn/KKLAQF3Z.js +0 -2
- package/dist/cdn/KLYNL2ZT.js +0 -2
- package/dist/cdn/OKMZQXBQ.js +0 -2
- package/dist/cdn/T4ECSHM7.js +0 -2
- package/dist/cdn/U6FBRUM4.js +0 -3
- package/dist/cdn/WSHWQDO2.js +0 -2
- package/dist/cdn/XRE5USHA.js +0 -2
- /package/dist/cdn/{BS2PFNU4.js → 5WYRJMBW.js} +0 -0
- /package/dist/cdn/{RU2T7GUX.js → 5ZFUGNRN.js} +0 -0
- /package/dist/cdn/{4YXYLX4H.js → 6HF36IKA.js} +0 -0
- /package/dist/cdn/{77QFSIWW.js → 7SRLZQVC.js} +0 -0
- /package/dist/cdn/{KA3FF3ZO.js → JKIESH74.js} +0 -0
- /package/dist/cdn/{CGXQAB3A.js → K2R6XVK3.js} +0 -0
- /package/dist/cdn/{LCFIADOZ.js → KITIP6J2.js} +0 -0
- /package/dist/cdn/{T2GJLEYV.js → KWD2ECTM.js} +0 -0
- /package/dist/cdn/{DYASSC7Z.js → LLUGJKAQ.js} +0 -0
- /package/dist/cdn/{3UEKINYC.js → MMHDT4KV.js} +0 -0
- /package/dist/cdn/{WS3T73IY.js → OAKRPM7D.js} +0 -0
- /package/dist/cdn/{Q4IQUEZN.js → U2D53TAX.js} +0 -0
- /package/dist/cdn/{4MFEKBKL.js → V52XWEGV.js} +0 -0
- /package/dist/cdn/{EAEQONP7.js → VLLZ2FFU.js} +0 -0
- /package/dist/cdn/{DY36ATOA.js → WKTQVBFJ.js} +0 -0
- /package/dist/cdn/{5PJXNTLZ.js → Y7XD7ZRD.js} +0 -0
- /package/dist/cdn/{UIXX3XEN.js → YEZ3AMNX.js} +0 -0
- /package/dist/cdn/{QVOMX3R6.js → Z5W4V7RC.js} +0 -0
|
@@ -89,13 +89,35 @@ export abstract class ArcgisAssistant extends LitElement {
|
|
|
89
89
|
assistantLabel: string;
|
|
90
90
|
stopButtonLabel: string;
|
|
91
91
|
askButtonLabel: string;
|
|
92
|
+
stoppedByUserLabel: string;
|
|
93
|
+
noAgentsFoundMessage: string;
|
|
94
|
+
orchestratorInitializationErrorMessage: string;
|
|
95
|
+
signInErrorMessage: string;
|
|
96
|
+
signInRequiredMessage: string;
|
|
97
|
+
signInLabel: string;
|
|
98
|
+
signInToArcGISOnlineLabel: string;
|
|
99
|
+
noPortalInformationMessage: string;
|
|
100
|
+
readMoreLabel: string;
|
|
101
|
+
learnAboutWebMapEmbeddingsLabel: string;
|
|
102
|
+
waitingForUserInputMessage: string;
|
|
92
103
|
} & T9nMeta<{
|
|
93
104
|
assistantLabel: string;
|
|
94
105
|
stopButtonLabel: string;
|
|
95
106
|
askButtonLabel: string;
|
|
107
|
+
stoppedByUserLabel: string;
|
|
108
|
+
noAgentsFoundMessage: string;
|
|
109
|
+
orchestratorInitializationErrorMessage: string;
|
|
110
|
+
signInErrorMessage: string;
|
|
111
|
+
signInRequiredMessage: string;
|
|
112
|
+
signInLabel: string;
|
|
113
|
+
signInToArcGISOnlineLabel: string;
|
|
114
|
+
noPortalInformationMessage: string;
|
|
115
|
+
readMoreLabel: string;
|
|
116
|
+
learnAboutWebMapEmbeddingsLabel: string;
|
|
117
|
+
waitingForUserInputMessage: string;
|
|
96
118
|
}>;
|
|
97
119
|
/**
|
|
98
|
-
* When `true`,
|
|
120
|
+
* When `true`, displays the assistant avatar in the chat interface.
|
|
99
121
|
*
|
|
100
122
|
* @default false
|
|
101
123
|
* @since 5.1
|
|
@@ -310,6 +332,13 @@ export abstract class ArcgisAssistant extends LitElement {
|
|
|
310
332
|
* ```
|
|
311
333
|
*/
|
|
312
334
|
accessor suggestedPrompts: string[];
|
|
335
|
+
/**
|
|
336
|
+
* When `true`, displays the user avatar in the chat interface.
|
|
337
|
+
*
|
|
338
|
+
* @default false
|
|
339
|
+
* @since 5.2
|
|
340
|
+
*/
|
|
341
|
+
accessor userAvatarEnabled: boolean;
|
|
313
342
|
/**
|
|
314
343
|
* Cancels the active interrupt, if one is pending.
|
|
315
344
|
*
|
|
@@ -1,36 +1,36 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { c as x } from "../../chunks/runtime.js";
|
|
3
3
|
import { css as A, html as c } from "lit";
|
|
4
|
-
import
|
|
5
|
-
import { whenOnce as
|
|
6
|
-
import
|
|
7
|
-
import { LitElement as
|
|
4
|
+
import L from "@arcgis/core/core/Collection.js";
|
|
5
|
+
import { whenOnce as T, watch as R, when as D } from "@arcgis/core/core/reactiveUtils.js";
|
|
6
|
+
import M from "@arcgis/core/portal/Portal.js";
|
|
7
|
+
import { LitElement as O, createEvent as p, nothing as f } from "@arcgis/lumina";
|
|
8
8
|
import * as B from "@arcgis/toolkit/log";
|
|
9
9
|
import { rethrowError as z } from "@arcgis/toolkit/log";
|
|
10
|
-
import { createRef as
|
|
11
|
-
import { u as
|
|
12
|
-
import { O as
|
|
10
|
+
import { createRef as v, ref as w } from "lit/directives/ref.js";
|
|
11
|
+
import { u as U } from "../../chunks/useT9n.js";
|
|
12
|
+
import { O as q } from "../../chunks/orchestrator.js";
|
|
13
13
|
import "@langchain/core/callbacks/dispatch/web";
|
|
14
14
|
import "@langchain/core/prompts";
|
|
15
15
|
import "@langchain/openai";
|
|
16
16
|
import "@arcgis/core/request.js";
|
|
17
|
-
import
|
|
17
|
+
import N from "@arcgis/core/identity/IdentityManager.js";
|
|
18
18
|
import "@arcgis/toolkit/string";
|
|
19
19
|
import "@arcgis/core/config.js";
|
|
20
20
|
import "@langchain/core/messages";
|
|
21
21
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
22
22
|
import "../../chunks/generateLayerDescriptions.js";
|
|
23
23
|
import "@langchain/langgraph/web";
|
|
24
|
-
import
|
|
25
|
-
import { property as m, subclass as
|
|
24
|
+
import V from "@arcgis/core/core/Accessor.js";
|
|
25
|
+
import { property as m, subclass as F } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
26
26
|
import { marked as E } from "marked";
|
|
27
|
-
import { g as
|
|
28
|
-
import { g as
|
|
29
|
-
const
|
|
30
|
-
function
|
|
27
|
+
import { g as j } from "../../chunks/utils2.js";
|
|
28
|
+
import { g as $ } from "../../chunks/slottableRequestUtils.js";
|
|
29
|
+
const H = A`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;
|
|
30
|
+
function k(o) {
|
|
31
31
|
return o.trim() ? E.lexer(o).filter((t) => t.type !== "space").map((t) => E.parser([t])) : [];
|
|
32
32
|
}
|
|
33
|
-
class
|
|
33
|
+
class C {
|
|
34
34
|
constructor() {
|
|
35
35
|
this._stableParts = [], this._stableText = "", this._rawText = "";
|
|
36
36
|
}
|
|
@@ -42,11 +42,11 @@ class I {
|
|
|
42
42
|
// Parse the remaining live tail. Call once at stream end.
|
|
43
43
|
finalize() {
|
|
44
44
|
const t = this._rawText.slice(this._stableText.length);
|
|
45
|
-
return t.trim() && (this._stableParts.push(...
|
|
45
|
+
return t.trim() && (this._stableParts.push(...k(t)), this._stableText = this._rawText), this._stableParts;
|
|
46
46
|
}
|
|
47
47
|
// Get full output: stable segments + current live tail.
|
|
48
48
|
getParts() {
|
|
49
|
-
const t = this._trimIncompleteTail(this._rawText.slice(this._stableText.length)), s = t.trim() ?
|
|
49
|
+
const t = this._trimIncompleteTail(this._rawText.slice(this._stableText.length)), s = t.trim() ? k(t) : [];
|
|
50
50
|
return [...this._stableParts, ...s];
|
|
51
51
|
}
|
|
52
52
|
reset() {
|
|
@@ -57,8 +57,8 @@ class I {
|
|
|
57
57
|
const t = this._rawText.slice(this._stableText.length), s = this._lastSafeBoundary(t);
|
|
58
58
|
if (s <= 0)
|
|
59
59
|
return;
|
|
60
|
-
const
|
|
61
|
-
this._stableParts.push(...
|
|
60
|
+
const r = t.slice(0, s);
|
|
61
|
+
this._stableParts.push(...k(r)), this._stableText += r;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Find the last blank-line boundary that is outside code fences.
|
|
@@ -67,9 +67,9 @@ class I {
|
|
|
67
67
|
_lastSafeBoundary(t) {
|
|
68
68
|
const s = t.split(`
|
|
69
69
|
`);
|
|
70
|
-
let
|
|
71
|
-
for (const
|
|
72
|
-
/^\s*(```|~~~)/u.test(
|
|
70
|
+
let r = !1, e = 0, n = 0;
|
|
71
|
+
for (const i of s)
|
|
72
|
+
/^\s*(```|~~~)/u.test(i) && (r = !r), n += i.length + 1, i.trim() === "" && !r && (e = n);
|
|
73
73
|
return e < t.length ? e : 0;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -83,9 +83,9 @@ class I {
|
|
|
83
83
|
const s = t.lastIndexOf("<");
|
|
84
84
|
if (s !== -1 && !t.includes(">", s))
|
|
85
85
|
return t.slice(0, s);
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
88
|
-
return t.slice(0,
|
|
86
|
+
const r = this._earliestUnclosedTag(t);
|
|
87
|
+
if (r !== -1)
|
|
88
|
+
return t.slice(0, r);
|
|
89
89
|
const e = t.lastIndexOf("[");
|
|
90
90
|
if (e !== -1) {
|
|
91
91
|
const n = t.slice(e);
|
|
@@ -113,14 +113,14 @@ class I {
|
|
|
113
113
|
"source",
|
|
114
114
|
"track",
|
|
115
115
|
"wbr"
|
|
116
|
-
]),
|
|
117
|
-
for (let n =
|
|
118
|
-
const [,
|
|
116
|
+
]), r = /<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu, e = [];
|
|
117
|
+
for (let n = r.exec(t); n; n = r.exec(t)) {
|
|
118
|
+
const [, i, a, l] = n, h = a.toLowerCase();
|
|
119
119
|
if (!(s.has(h) || l === "/"))
|
|
120
|
-
if (
|
|
121
|
-
for (let
|
|
122
|
-
if (e[
|
|
123
|
-
e.splice(
|
|
120
|
+
if (i === "/") {
|
|
121
|
+
for (let g = e.length - 1; g >= 0; g--)
|
|
122
|
+
if (e[g].name === h) {
|
|
123
|
+
e.splice(g);
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
126
|
} else
|
|
@@ -129,41 +129,41 @@ class I {
|
|
|
129
129
|
return e.length ? e[0].index : -1;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
function
|
|
133
|
-
const t = new
|
|
132
|
+
function W(o) {
|
|
133
|
+
const t = new C();
|
|
134
134
|
return t.push(o), t.finalize();
|
|
135
135
|
}
|
|
136
|
-
const
|
|
137
|
-
async function*
|
|
138
|
-
const
|
|
136
|
+
const G = async (o) => await new Promise((t) => setTimeout(t, o));
|
|
137
|
+
async function* Z(o, { chunkSize: t = 15, delay: s = 50 } = {}) {
|
|
138
|
+
const r = new C();
|
|
139
139
|
for (let e = 0; e < o.length; e += t)
|
|
140
|
-
yield
|
|
141
|
-
yield
|
|
140
|
+
yield r.push(o.slice(e, e + t)), await G(s);
|
|
141
|
+
yield r.finalize();
|
|
142
142
|
}
|
|
143
|
-
var
|
|
144
|
-
for (var e =
|
|
145
|
-
(
|
|
146
|
-
return
|
|
143
|
+
var J = Object.defineProperty, K = Object.getOwnPropertyDescriptor, u = (o, t, s, r) => {
|
|
144
|
+
for (var e = r > 1 ? void 0 : r ? K(t, s) : t, n = o.length - 1, i; n >= 0; n--)
|
|
145
|
+
(i = o[n]) && (e = (r ? i(t, s, e) : i(e)) || e);
|
|
146
|
+
return r && e && J(t, s, e), e;
|
|
147
147
|
};
|
|
148
|
-
const
|
|
149
|
-
async function*
|
|
148
|
+
const S = (o) => !o || typeof o != "object" ? !1 : o.name === "AbortError";
|
|
149
|
+
async function* I(o, t, s, r, e = !1) {
|
|
150
150
|
if (e) {
|
|
151
|
-
if (
|
|
151
|
+
if (r?.aborted) {
|
|
152
152
|
yield { type: "cancelled", log: s, runId: t };
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
|
-
yield { type: "block-data", blockType: "text", data: { parts:
|
|
155
|
+
yield { type: "block-data", blockType: "text", data: { parts: W(o) }, runId: t };
|
|
156
156
|
return;
|
|
157
157
|
}
|
|
158
|
-
for await (const n of
|
|
159
|
-
if (
|
|
158
|
+
for await (const n of Z(o)) {
|
|
159
|
+
if (r?.aborted) {
|
|
160
160
|
yield { type: "cancelled", log: s, runId: t };
|
|
161
161
|
return;
|
|
162
162
|
}
|
|
163
163
|
yield { type: "block-data", blockType: "text", data: { parts: n }, runId: t };
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
let d = class extends
|
|
166
|
+
let d = class extends V {
|
|
167
167
|
constructor(o) {
|
|
168
168
|
super(o), this.view = null, this.streamingDisabled = !1, this.loading = !1, this.processing = !1, this.processingStep = "";
|
|
169
169
|
}
|
|
@@ -179,9 +179,9 @@ let d = class extends j {
|
|
|
179
179
|
this.orchestrator?.dispose(), super.destroy();
|
|
180
180
|
}
|
|
181
181
|
async _initialize() {
|
|
182
|
-
this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await
|
|
182
|
+
this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await T(() => !this.view.updating), this._set(
|
|
183
183
|
"orchestrator",
|
|
184
|
-
await
|
|
184
|
+
await q.init({
|
|
185
185
|
agents: [...this.agents],
|
|
186
186
|
view: this.view ?? void 0
|
|
187
187
|
})
|
|
@@ -202,61 +202,61 @@ let d = class extends j {
|
|
|
202
202
|
throw new Error("Orchestrator not initialized yet.");
|
|
203
203
|
this._set("processing", !0), this._set("processingStep", "");
|
|
204
204
|
const s = [];
|
|
205
|
-
let
|
|
205
|
+
let r, e = "pending";
|
|
206
206
|
try {
|
|
207
207
|
const n = this.orchestrator.ask(o);
|
|
208
|
-
for await (const
|
|
209
|
-
switch (e =
|
|
208
|
+
for await (const i of n)
|
|
209
|
+
switch (e = i.runId, i.type) {
|
|
210
210
|
case "trace": {
|
|
211
|
-
this._set("processingStep",
|
|
211
|
+
this._set("processingStep", i.data.text), s.push(i.data.text);
|
|
212
212
|
break;
|
|
213
213
|
}
|
|
214
214
|
case "completed": {
|
|
215
215
|
this._set("processing", !1), this._set("processingStep", "");
|
|
216
|
-
const a =
|
|
216
|
+
const a = i.result, l = !!a.content.length, h = !!r?.length;
|
|
217
217
|
if (!l && !h) {
|
|
218
218
|
yield { type: "completed", error: "No response received.", log: s, runId: e };
|
|
219
219
|
return;
|
|
220
220
|
}
|
|
221
|
-
const
|
|
222
|
-
if (yield { type: "block-start", blockType: "text", runId: e }, yield*
|
|
223
|
-
for (const
|
|
221
|
+
const g = a.content;
|
|
222
|
+
if (yield { type: "block-start", blockType: "text", runId: e }, yield* I(g, e, s, t, this.streamingDisabled), yield { type: "block-end", blockType: "text", runId: e }, h)
|
|
223
|
+
for (const _ of r) {
|
|
224
224
|
if (t?.aborted) {
|
|
225
225
|
yield { type: "cancelled", log: s, runId: e };
|
|
226
226
|
return;
|
|
227
227
|
}
|
|
228
|
-
const { type: b, data:
|
|
228
|
+
const { type: b, data: y } = _;
|
|
229
229
|
if (yield { type: "block-start", blockType: b, runId: e }, b === "text") {
|
|
230
|
-
const P = typeof
|
|
231
|
-
yield*
|
|
230
|
+
const P = typeof y?.content == "string" ? y.content : "";
|
|
231
|
+
yield* I(P, e, s, t, this.streamingDisabled);
|
|
232
232
|
} else
|
|
233
|
-
yield { type: "block-data", blockType: b, data:
|
|
233
|
+
yield { type: "block-data", blockType: b, data: y, runId: e };
|
|
234
234
|
yield { type: "block-end", blockType: b, runId: e };
|
|
235
235
|
}
|
|
236
|
-
yield { type: "completed", response:
|
|
236
|
+
yield { type: "completed", response: g, blocks: r, log: s, runId: e };
|
|
237
237
|
return;
|
|
238
238
|
}
|
|
239
239
|
case "ux-suggestion": {
|
|
240
|
-
const a =
|
|
241
|
-
|
|
240
|
+
const a = i.suggestion;
|
|
241
|
+
r = r ? [...r, a] : [a];
|
|
242
242
|
break;
|
|
243
243
|
}
|
|
244
244
|
case "interrupt": {
|
|
245
|
-
const { kind: a, message: l, metadata: h } =
|
|
245
|
+
const { kind: a, message: l, metadata: h } = i.interrupt, g = Array.isArray(h) ? h.filter((b) => typeof b == "string") : [], _ = (() => {
|
|
246
246
|
switch (a) {
|
|
247
247
|
case "booleanChoice":
|
|
248
|
-
return { type: "boolean-choice", message: l, options:
|
|
248
|
+
return { type: "boolean-choice", message: l, options: g };
|
|
249
249
|
case "singleSelection":
|
|
250
|
-
return { type: "single-select", message: l, options:
|
|
250
|
+
return { type: "single-select", message: l, options: g };
|
|
251
251
|
case "multipleSelection":
|
|
252
|
-
return { type: "multi-select", message: l, options:
|
|
252
|
+
return { type: "multi-select", message: l, options: g };
|
|
253
253
|
case "textInput":
|
|
254
254
|
return { type: "text-input", message: l };
|
|
255
255
|
default:
|
|
256
|
-
return { type: a, message: l, options:
|
|
256
|
+
return { type: a, message: l, options: g };
|
|
257
257
|
}
|
|
258
258
|
})();
|
|
259
|
-
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload:
|
|
259
|
+
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: _, runId: e };
|
|
260
260
|
break;
|
|
261
261
|
}
|
|
262
262
|
case "cancelled": {
|
|
@@ -264,20 +264,20 @@ let d = class extends j {
|
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
266
|
case "error": {
|
|
267
|
-
if (t?.aborted ||
|
|
267
|
+
if (t?.aborted || S(i.error)) {
|
|
268
268
|
yield { type: "cancelled", log: s, runId: e };
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
|
-
yield { type: "completed", error:
|
|
271
|
+
yield { type: "completed", error: i.error.message, log: s, runId: e };
|
|
272
272
|
return;
|
|
273
273
|
}
|
|
274
274
|
default: {
|
|
275
|
-
console.warn("Unknown event type:",
|
|
275
|
+
console.warn("Unknown event type:", i);
|
|
276
276
|
break;
|
|
277
277
|
}
|
|
278
278
|
}
|
|
279
279
|
} catch (n) {
|
|
280
|
-
if (t?.aborted ||
|
|
280
|
+
if (t?.aborted || S(n)) {
|
|
281
281
|
yield { type: "cancelled", log: s, runId: e };
|
|
282
282
|
return;
|
|
283
283
|
}
|
|
@@ -316,12 +316,12 @@ u([
|
|
|
316
316
|
m({ readOnly: !0 })
|
|
317
317
|
], d.prototype, "processingStep", 2);
|
|
318
318
|
d = u([
|
|
319
|
-
|
|
319
|
+
F("OrchestratorController")
|
|
320
320
|
], d);
|
|
321
|
-
const
|
|
322
|
-
class tt extends
|
|
321
|
+
const Q = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", X = "Embeddings not found for this web map.", Y = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
|
|
322
|
+
class tt extends O {
|
|
323
323
|
constructor() {
|
|
324
|
-
super(...arguments), this._messages =
|
|
324
|
+
super(...arguments), this._messages = U({ blocking: !0 }), this.#t = v(), this.#l = v(), this.#s = v(), this.#e = null, this.#i = /* @__PURE__ */ new Map(), this.#r = M.getDefault(), this.#a = (t) => {
|
|
325
325
|
t.stopPropagation(), this.cancelInterrupt();
|
|
326
326
|
}, this.#n = (t) => {
|
|
327
327
|
t.stopPropagation();
|
|
@@ -337,57 +337,57 @@ class tt extends M {
|
|
|
337
337
|
return;
|
|
338
338
|
}
|
|
339
339
|
this._orchestratorController?.cancel(), this.#e?.abort(), this.#e = null;
|
|
340
|
-
}, this.#
|
|
340
|
+
}, this.#g = (t) => {
|
|
341
341
|
t.stopPropagation();
|
|
342
342
|
const s = t.detail;
|
|
343
343
|
this.arcgisFeedback.emit(s);
|
|
344
|
-
}, this.#
|
|
344
|
+
}, this.#p = (t) => {
|
|
345
345
|
t.stopPropagation();
|
|
346
346
|
const s = t.detail;
|
|
347
347
|
this._inputValue = s.prompt, this.arcgisPromptSelect.emit(s);
|
|
348
348
|
}, this.#d = (t) => {
|
|
349
349
|
this.arcgisSlottableRequest.emit(t.detail);
|
|
350
|
-
}, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new
|
|
350
|
+
}, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new L([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.streamingDisabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.assistantAvatarEnabled = !1, this.userAvatarEnabled = !1, this.arcgisCancel = p(), this.arcgisError = p(), this.arcgisFeedback = p(), this.arcgisInterrupt = p(), this.arcgisInterruptCancel = p(), this.arcgisInterruptSubmit = p(), this.arcgisPromptSelect = p(), this.arcgisReady = p(), this.arcgisSubmit = p(), this.arcgisSlottableRequest = p({ bubbles: !1, composed: !1 }), this.arcgisResponse = p();
|
|
351
351
|
}
|
|
352
352
|
static {
|
|
353
|
-
this.properties = { _orchestratorController: 16, _interrupt: 16, _interruptDetails: 16, _error: 16, _inputValue: 16, _isAnswering: 16, _signedInUserId: 16, _canceling: 16, _isSignedIn: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, streamingDisabled: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5 };
|
|
353
|
+
this.properties = { _orchestratorController: 16, _interrupt: 16, _interruptDetails: 16, _error: 16, _inputValue: 16, _isAnswering: 16, _signedInUserId: 16, _canceling: 16, _isSignedIn: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, streamingDisabled: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5, userAvatarEnabled: 5 };
|
|
354
354
|
}
|
|
355
355
|
static {
|
|
356
|
-
this.styles =
|
|
356
|
+
this.styles = H;
|
|
357
357
|
}
|
|
358
358
|
#t;
|
|
359
359
|
#l;
|
|
360
360
|
#s;
|
|
361
361
|
#e;
|
|
362
|
-
#r;
|
|
363
362
|
#i;
|
|
363
|
+
#r;
|
|
364
364
|
#a;
|
|
365
365
|
#n;
|
|
366
366
|
#c;
|
|
367
367
|
#h;
|
|
368
|
-
#p;
|
|
369
368
|
#g;
|
|
369
|
+
#p;
|
|
370
370
|
#d;
|
|
371
371
|
async #o() {
|
|
372
372
|
try {
|
|
373
|
-
const t =
|
|
373
|
+
const t = j(this.el, this.referenceElement);
|
|
374
374
|
await t?.componentOnReady();
|
|
375
|
-
const s = [...this.#
|
|
375
|
+
const s = [...this.#i.values()];
|
|
376
376
|
return s.length ? (this._orchestratorController?.destroy(), this._orchestratorController = new d({
|
|
377
377
|
agents: s,
|
|
378
|
-
portal: this.#
|
|
378
|
+
portal: this.#r,
|
|
379
379
|
streamingDisabled: this.streamingDisabled,
|
|
380
380
|
view: t?.view
|
|
381
|
-
}), await this._orchestratorController.load(), !0) : (this._error =
|
|
381
|
+
}), await this._orchestratorController.load(), this.requestUpdate(), !0) : (this._error = this._messages.noAgentsFoundMessage, !1);
|
|
382
382
|
} catch (t) {
|
|
383
|
-
return this._error = t?.message ??
|
|
383
|
+
return this._error = t?.message ?? this._messages.orchestratorInitializationErrorMessage, z(this)(t), !1;
|
|
384
384
|
}
|
|
385
385
|
}
|
|
386
386
|
get _isSignedIn() {
|
|
387
|
-
return !!this.#
|
|
387
|
+
return !!this.#r?.user || !!this._signedInUserId;
|
|
388
388
|
}
|
|
389
389
|
get _user() {
|
|
390
|
-
return this.#
|
|
390
|
+
return this.#r?.user?.fullName || this.#r?.user?.username;
|
|
391
391
|
}
|
|
392
392
|
get awaitingResponse() {
|
|
393
393
|
return this._orchestratorController?.processing ?? !1;
|
|
@@ -408,10 +408,10 @@ class tt extends M {
|
|
|
408
408
|
this.arcgisInterruptCancel.emit(), this.orchestrator?.cancelInterrupt(), this._interrupt = null;
|
|
409
409
|
}
|
|
410
410
|
register(t) {
|
|
411
|
-
this.#
|
|
411
|
+
this.#i.set(t.agent.id, t), this._orchestratorController && this.#o();
|
|
412
412
|
}
|
|
413
413
|
unregister(t) {
|
|
414
|
-
this.#
|
|
414
|
+
this.#i.delete(t), this._orchestratorController && this.#o();
|
|
415
415
|
}
|
|
416
416
|
async submitMessage(t) {
|
|
417
417
|
const s = t.trim();
|
|
@@ -423,16 +423,16 @@ class tt extends M {
|
|
|
423
423
|
}), !this._orchestratorController))
|
|
424
424
|
return;
|
|
425
425
|
this.#e = new AbortController(), this._orchestratorController.streamingDisabled = this.streamingDisabled;
|
|
426
|
-
const
|
|
427
|
-
for await (const e of
|
|
428
|
-
const n = e.runId,
|
|
426
|
+
const r = this._orchestratorController.ask(s, this.#e?.signal);
|
|
427
|
+
for await (const e of r) {
|
|
428
|
+
const n = e.runId, i = this.messages.at(-1);
|
|
429
429
|
switch (e.type) {
|
|
430
430
|
case "block-start": {
|
|
431
431
|
this._isAnswering = !0;
|
|
432
432
|
const a = { type: e.blockType, isPending: !0 };
|
|
433
|
-
if (
|
|
434
|
-
const l = [...
|
|
435
|
-
this.messages.splice(-1, 1, { ...
|
|
433
|
+
if (i?.role === "assistant" && i.id === n) {
|
|
434
|
+
const l = [...i.blocks ?? [], a];
|
|
435
|
+
this.messages.splice(-1, 1, { ...i, blocks: l });
|
|
436
436
|
} else
|
|
437
437
|
this.messages.push({
|
|
438
438
|
role: "assistant",
|
|
@@ -444,28 +444,28 @@ class tt extends M {
|
|
|
444
444
|
break;
|
|
445
445
|
}
|
|
446
446
|
case "block-data": {
|
|
447
|
-
if (
|
|
447
|
+
if (i?.role !== "assistant" || i?.id !== n)
|
|
448
448
|
break;
|
|
449
|
-
const a = [...
|
|
449
|
+
const a = [...i.blocks ?? []], l = a[a.length - 1], { blockType: h, data: g } = e;
|
|
450
450
|
if (l?.type !== h || !l.isPending)
|
|
451
451
|
break;
|
|
452
452
|
h === "text" ? a[a.length - 1] = {
|
|
453
453
|
...l,
|
|
454
454
|
data: {
|
|
455
455
|
...l.data,
|
|
456
|
-
parts:
|
|
456
|
+
parts: g?.parts
|
|
457
457
|
}
|
|
458
|
-
} : a[a.length - 1] = { ...l, data: { ...l.data, ...
|
|
458
|
+
} : a[a.length - 1] = { ...l, data: { ...l.data, ...g ?? {} } }, this.messages.splice(-1, 1, { ...i, blocks: a });
|
|
459
459
|
break;
|
|
460
460
|
}
|
|
461
461
|
case "block-end": {
|
|
462
|
-
if (
|
|
462
|
+
if (i?.role !== "assistant" || i?.id !== n)
|
|
463
463
|
break;
|
|
464
|
-
const a = [...
|
|
464
|
+
const a = [...i.blocks ?? []], l = a[a.length - 1];
|
|
465
465
|
if (l?.type !== e.blockType || !l.isPending)
|
|
466
466
|
break;
|
|
467
467
|
const h = l;
|
|
468
|
-
a[a.length - 1] = { ...h, data: { ...h.data }, isPending: !1 }, this.messages.splice(-1, 1, { ...
|
|
468
|
+
a[a.length - 1] = { ...h, data: { ...h.data }, isPending: !1 }, this.messages.splice(-1, 1, { ...i, blocks: a });
|
|
469
469
|
break;
|
|
470
470
|
}
|
|
471
471
|
case "completed":
|
|
@@ -475,10 +475,10 @@ class tt extends M {
|
|
|
475
475
|
error: e.error,
|
|
476
476
|
id: n,
|
|
477
477
|
interrupts: this._interruptDetails
|
|
478
|
-
}), this._interruptDetails = []) :
|
|
479
|
-
...
|
|
478
|
+
}), this._interruptDetails = []) : i?.role === "assistant" && i.id === n && this.messages.splice(-1, 1, {
|
|
479
|
+
...i,
|
|
480
480
|
content: e.response,
|
|
481
|
-
blocks:
|
|
481
|
+
blocks: i.blocks?.map((a) => ({ ...a, data: { ...a.data }, isPending: !1 })) ?? [],
|
|
482
482
|
isStreaming: !1,
|
|
483
483
|
log: e.log
|
|
484
484
|
}), this._isAnswering = !1, this.#e = null, this._canceling = !1;
|
|
@@ -487,18 +487,16 @@ class tt extends M {
|
|
|
487
487
|
this._interrupt = { ...e.payload, id: n }, this.arcgisInterrupt.emit(this._interrupt);
|
|
488
488
|
break;
|
|
489
489
|
case "cancelled":
|
|
490
|
-
|
|
491
|
-
...
|
|
492
|
-
blocks:
|
|
490
|
+
i?.role === "assistant" && i.id === n ? this.messages.splice(-1, 1, {
|
|
491
|
+
...i,
|
|
492
|
+
blocks: i.blocks?.filter((a) => a.type === "text" || !a.isPending) ?? [],
|
|
493
493
|
isStreaming: !1,
|
|
494
494
|
log: e.log,
|
|
495
|
-
error:
|
|
496
|
-
// TODO: use strings from t9n
|
|
495
|
+
error: `(${this._messages.stoppedByUserLabel})`
|
|
497
496
|
}) : (this.messages.push({
|
|
498
497
|
role: "assistant",
|
|
499
498
|
log: e.log,
|
|
500
|
-
error:
|
|
501
|
-
// TODO: use strings from t9n
|
|
499
|
+
error: `(${this._messages.stoppedByUserLabel})`,
|
|
502
500
|
id: n,
|
|
503
501
|
interrupts: this._interruptDetails
|
|
504
502
|
}), this._interruptDetails = []), this._isAnswering = !1, this.#e = null, this._canceling = !1;
|
|
@@ -514,20 +512,20 @@ class tt extends M {
|
|
|
514
512
|
}
|
|
515
513
|
loaded() {
|
|
516
514
|
this.manager.onLifecycle(() => {
|
|
517
|
-
this.#t.value?.addEventListener("arcgisPromptSelect", this.#
|
|
515
|
+
this.#t.value?.addEventListener("arcgisPromptSelect", this.#p), this.#t.value?.addEventListener("arcgisSubmit", this.#c), this.#t.value?.addEventListener("arcgisCancel", this.#h), this.#t.value?.addEventListener("arcgisFeedback", this.#g);
|
|
518
516
|
const t = D(() => !!this._interrupt && !!this.#s.value, () => {
|
|
519
|
-
const
|
|
520
|
-
|
|
521
|
-
}), s = this.messages.on("after-add", (
|
|
522
|
-
const e =
|
|
517
|
+
const r = this.#s.value;
|
|
518
|
+
r.removeEventListener("arcgisSubmit", this.#n), r.removeEventListener("arcgisCancel", this.#a), r.addEventListener("arcgisSubmit", this.#n, { once: !0 }), r.addEventListener("arcgisCancel", this.#a, { once: !0 });
|
|
519
|
+
}), s = this.messages.on("after-add", (r) => {
|
|
520
|
+
const e = r.item;
|
|
523
521
|
e.role === "assistant" && (e.error || e.content) && this.arcgisResponse.emit(e);
|
|
524
522
|
});
|
|
525
523
|
return queueMicrotask(() => {
|
|
526
|
-
this.#o().then((
|
|
527
|
-
|
|
524
|
+
this.#o().then((r) => {
|
|
525
|
+
r ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
|
|
528
526
|
});
|
|
529
527
|
}), () => {
|
|
530
|
-
t.remove(), s.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#
|
|
528
|
+
t.remove(), s.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#p), this.#s.value?.removeEventListener("arcgisSubmit", this.#n), this.#s.value?.removeEventListener("arcgisCancel", this.#a), this.#t.value?.removeEventListener("arcgisSubmit", this.#c), this.#t.value?.removeEventListener("arcgisCancel", this.#h), this.#t.value?.removeEventListener("arcgisFeedback", this.#g), this._orchestratorController?.destroy(), this._orchestratorController = null;
|
|
531
529
|
};
|
|
532
530
|
});
|
|
533
531
|
}
|
|
@@ -538,21 +536,21 @@ class tt extends M {
|
|
|
538
536
|
return this._isSignedIn ? this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : c`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : c`<slot name=entry-message></slot>` : this._renderSignInNotice();
|
|
539
537
|
}
|
|
540
538
|
_renderSignInNotice() {
|
|
541
|
-
const t = this.#
|
|
542
|
-
return c`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message
|
|
539
|
+
const t = this.#r;
|
|
540
|
+
return c`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${t ? c`<calcite-link slot=link @click=${async () => {
|
|
543
541
|
try {
|
|
544
|
-
const s = await
|
|
542
|
+
const s = await N.getCredential(`${t.url}/sharing`);
|
|
545
543
|
this._signedInUserId = s.userId, this._error = null, this.requestUpdate(), await this.#o() ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
|
|
546
544
|
} catch (s) {
|
|
547
|
-
this._error = s?.message ??
|
|
545
|
+
this._error = s?.message ?? this._messages.signInErrorMessage, this.arcgisError.emit(new Error(this._error)), B.log("error", this, "Error signing in:", { detail: { error: s } });
|
|
548
546
|
}
|
|
549
|
-
}} target=_blank title
|
|
547
|
+
}} target=_blank title=${this._messages.signInToArcGISOnlineLabel ?? f}>${this._messages.signInLabel}</calcite-link>` : c`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`;
|
|
550
548
|
}
|
|
551
549
|
_renderErrorNotice() {
|
|
552
|
-
return this._error ? c`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error ===
|
|
550
|
+
return this._error ? c`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error === Q ? c`<div slot=message>${X}</div><calcite-link slot=link .href=${Y} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel ?? f}>${this._messages.readMoreLabel}</calcite-link>` : c`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
|
|
553
551
|
}
|
|
554
552
|
render() {
|
|
555
|
-
return c`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${
|
|
553
|
+
return c`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${w(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map((t) => t.role === "assistant" ? c`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#d} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((s, r) => c`<slot name=${$(t.id, r) ?? f} slot=${$(t.id, r) ?? f}><arcgis-assistant-message-block .block=${s}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : c`<arcgis-assistant-user-message .message=${t} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt ? c`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>` : c`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt ? c`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${w(this.#s)}></arcgis-assistant-interrupt></slot>` : this.suggestedPrompts?.length ? c`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>` : null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse || this._isAnswering} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling || !this._isSignedIn || !!this._interrupt} ${w(this.#l)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse || this._isAnswering ? "circle-stop" : "send"} @click=${() => {
|
|
556
554
|
this.#l.value?.submitMessage();
|
|
557
555
|
}} round>${this.awaitingResponse || this._isAnswering ? this._messages.stopButtonLabel : this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`;
|
|
558
556
|
}
|