@arcgis/ai-components 5.2.0-next.17 → 5.2.0-next.19
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/agent-utils/index.d.ts +78 -0
- package/dist/agent-utils/index.js +116 -97
- package/dist/agent-utils/middlewares/trace.d.ts +2 -0
- package/dist/agent-utils/types.d.ts +12 -12
- package/dist/cdn/27NEUQN3.js +2 -0
- package/dist/cdn/{VKR2CBLM.js → 2NMR43NW.js} +1 -1
- package/dist/cdn/3YMSOD5D.js +2 -0
- package/dist/cdn/4I4MCV7V.js +71 -0
- package/dist/cdn/5SBLS4NW.js +2 -0
- package/dist/cdn/ASSH4WSC.js +36 -0
- package/dist/cdn/BFPMQT3A.js +2 -0
- package/dist/cdn/{LBSOW7OW.js → C7E7MJSR.js} +1 -1
- package/dist/cdn/{DECSD3LN.js → CIW3QMKV.js} +1 -1
- package/dist/cdn/CVHJMR5X.js +2 -0
- package/dist/cdn/E7TMP4YV.js +3 -0
- package/dist/cdn/{NRMBMWI5.js → EBRNMPPO.js} +19 -18
- package/dist/cdn/GJUD7EA3.js +3 -0
- package/dist/cdn/HCR23HJB.js +2 -0
- package/dist/cdn/I64KIZG3.js +2 -0
- package/dist/cdn/IB4WTK74.js +2 -0
- package/dist/cdn/{LQSZTK26.js → IC5P5NYY.js} +1 -1
- package/dist/cdn/{QZVAGRWA.js → ICA7JOSU.js} +2 -2
- package/dist/cdn/{C4KITTT5.js → IXAKT6L3.js} +1 -1
- package/dist/cdn/{NE7E52YR.js → KTK4HNL2.js} +8 -2
- package/dist/cdn/{6EVF6NFG.js → KTOL6IN7.js} +5 -5
- package/dist/cdn/{VV57ZUOI.js → L77BTGXY.js} +1 -1
- package/dist/cdn/NOJYPREL.js +3 -0
- package/dist/cdn/{FZIT3DLD.js → O3F47IO5.js} +1 -1
- package/dist/cdn/{OLJC5BM3.js → O7TGCM5P.js} +1 -1
- package/dist/cdn/PBTINZTK.js +65 -0
- package/dist/cdn/PDEBKVBO.js +22 -0
- package/dist/cdn/PDT6I6TZ.js +2 -0
- package/dist/cdn/PSWI3MFB.js +2 -0
- package/dist/cdn/ROLXMEVE.js +18 -0
- package/dist/cdn/RX45PCYB.js +9 -0
- package/dist/cdn/{W5DLXSAP.js → SMADRJ67.js} +1 -1
- package/dist/cdn/U53OEX6L.js +2 -0
- package/dist/cdn/VDXSALQI.js +2 -0
- package/dist/cdn/{RUURNLTP.js → W2JAKE2M.js} +1 -1
- package/dist/cdn/{RHF452M7.js → WAVKMZA6.js} +1 -1
- package/dist/cdn/{6ZW7Z36F.js → X7GE26KU.js} +2 -2
- package/dist/cdn/XGS5EIA5.js +14 -0
- package/dist/cdn/YJ3QQXF6.js +2 -0
- package/dist/cdn/{X4UZCTIG.js → YYY7HKYX.js} +1 -1
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/converterUtils.js +39 -32
- package/dist/chunks/dataExplorationGraph.js +12 -10
- package/dist/chunks/helpGraph.js +8 -8
- package/dist/chunks/help_prompt.js +34 -17
- package/dist/chunks/intent_prompt.js +2 -2
- package/dist/chunks/navigationGraph.js +4 -4
- package/dist/chunks/navigation_intent_prompt.js +8 -2
- package/dist/chunks/state.js +1 -1
- package/dist/chunks/utils2.js +8 -8
- package/dist/components/arcgis-assistant/customElement.d.ts +7 -0
- package/dist/components/arcgis-assistant/customElement.js +301 -181
- package/dist/components/arcgis-assistant-agent/customElement.js +5 -1
- package/dist/components/arcgis-assistant-chat/customElement.js +22 -17
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +9 -5
- package/dist/components/arcgis-assistant-help-agent/customElement.js +6 -2
- package/dist/components/arcgis-assistant-interrupt/customElement.js +4 -4
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +16 -12
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +8 -4
- package/dist/components/arcgis-assistant-message-block/customElement.js +1 -1
- package/dist/components/arcgis-assistant-message-text/customElement.d.ts +1 -0
- package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +9 -5
- package/dist/components/arcgis-assistant-user-message/customElement.js +10 -8
- 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 +2 -2
- 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/dist/utils/index.d.ts +1 -2
- package/package.json +4 -4
- package/dist/cdn/3S7PBYVD.js +0 -2
- package/dist/cdn/5VXRVWAX.js +0 -16
- package/dist/cdn/CE6VDP2D.js +0 -72
- package/dist/cdn/CI3QSFPS.js +0 -2
- package/dist/cdn/F2AHA4GB.js +0 -54
- package/dist/cdn/GPYYAQVI.js +0 -2
- package/dist/cdn/K475UT3E.js +0 -2
- package/dist/cdn/KIQUEMI4.js +0 -14
- package/dist/cdn/NTGC53UD.js +0 -36
- package/dist/cdn/PB2ODJC7.js +0 -2
- package/dist/cdn/SBHLUL3Q.js +0 -2
- package/dist/cdn/TR3OKQPQ.js +0 -22
- package/dist/cdn/WIJRNMBG.js +0 -3
- package/dist/cdn/XBW4MWQR.js +0 -2
- package/dist/cdn/Z7UWJ4AI.js +0 -3
- package/dist/orchestrator/registry/agentRegistry.d.ts +0 -33
|
@@ -1,58 +1,170 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { css as
|
|
4
|
-
import
|
|
5
|
-
import { whenOnce as
|
|
6
|
-
import
|
|
7
|
-
import { LitElement as M, createEvent as
|
|
8
|
-
import * as
|
|
9
|
-
import { rethrowError as
|
|
10
|
-
import { createRef as
|
|
11
|
-
import { u as
|
|
12
|
-
import { O as
|
|
2
|
+
import { c as x } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as A, html as c } from "lit";
|
|
4
|
+
import T from "@arcgis/core/core/Collection.js";
|
|
5
|
+
import { whenOnce as L, watch as R, when as D } from "@arcgis/core/core/reactiveUtils.js";
|
|
6
|
+
import O from "@arcgis/core/portal/Portal.js";
|
|
7
|
+
import { LitElement as M, createEvent as g, nothing as k } from "@arcgis/lumina";
|
|
8
|
+
import * as B from "@arcgis/toolkit/log";
|
|
9
|
+
import { rethrowError as z } from "@arcgis/toolkit/log";
|
|
10
|
+
import { createRef as y, ref as v } from "lit/directives/ref.js";
|
|
11
|
+
import { u as N } from "../../chunks/useT9n.js";
|
|
12
|
+
import { O as U } from "../../chunks/orchestrator.js";
|
|
13
13
|
import "@langchain/core/callbacks/dispatch/web";
|
|
14
14
|
import "@langchain/core/prompts";
|
|
15
15
|
import "@langchain/openai";
|
|
16
|
-
import
|
|
16
|
+
import V from "@arcgis/core/identity/IdentityManager.js";
|
|
17
17
|
import "@arcgis/toolkit/string";
|
|
18
18
|
import "@arcgis/core/config.js";
|
|
19
19
|
import "@langchain/core/messages";
|
|
20
20
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
21
21
|
import "../../chunks/generateLayerDescriptions.js";
|
|
22
22
|
import "@langchain/langgraph/web";
|
|
23
|
-
import
|
|
24
|
-
import { property as
|
|
25
|
-
import {
|
|
26
|
-
import { g as
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
return i && s && H(t, e, s), s;
|
|
32
|
-
};
|
|
33
|
-
const F = async (o) => await new Promise((t) => setTimeout(t, o)), E = (o) => !o || typeof o != "object" ? !1 : o.name === "AbortError";
|
|
34
|
-
async function* G(o, {
|
|
35
|
-
chunkSize: t = 5,
|
|
36
|
-
// chars per "token"
|
|
37
|
-
delay: e = 20
|
|
38
|
-
// ms between chunks
|
|
39
|
-
} = {}) {
|
|
40
|
-
let i = 0;
|
|
41
|
-
for (; i < o.length; )
|
|
42
|
-
yield o.slice(i, i + t), i += t, await F(e);
|
|
23
|
+
import j from "@arcgis/core/core/Accessor.js";
|
|
24
|
+
import { property as m, subclass as q } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
25
|
+
import { marked as E } from "marked";
|
|
26
|
+
import { g as H } from "../../chunks/utils3.js";
|
|
27
|
+
import { g as S } from "../../chunks/slottableRequestUtils.js";
|
|
28
|
+
const F = 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)}`;
|
|
29
|
+
function w(o) {
|
|
30
|
+
return o.trim() ? E.lexer(o).filter((t) => t.type !== "space").map((t) => E.parser([t])) : [];
|
|
43
31
|
}
|
|
44
|
-
|
|
45
|
-
|
|
32
|
+
class I {
|
|
33
|
+
constructor() {
|
|
34
|
+
this._stableParts = [], this._stableText = "", this._rawText = "";
|
|
35
|
+
}
|
|
36
|
+
// full streamed markdown so far
|
|
37
|
+
// Add one chunk and return all current segments.
|
|
38
|
+
push(t) {
|
|
39
|
+
return this._rawText += t, this._advanceStableBoundary(), this.getParts();
|
|
40
|
+
}
|
|
41
|
+
// Parse the remaining live tail. Call once at stream end.
|
|
42
|
+
finalize() {
|
|
43
|
+
const t = this._rawText.slice(this._stableText.length);
|
|
44
|
+
return t.trim() && (this._stableParts.push(...w(t)), this._stableText = this._rawText), this._stableParts;
|
|
45
|
+
}
|
|
46
|
+
// Get full output: stable segments + current live tail.
|
|
47
|
+
getParts() {
|
|
48
|
+
const t = this._trimIncompleteTail(this._rawText.slice(this._stableText.length)), s = t.trim() ? w(t) : [];
|
|
49
|
+
return [...this._stableParts, ...s];
|
|
50
|
+
}
|
|
51
|
+
reset() {
|
|
52
|
+
this._stableParts = [], this._stableText = "", this._rawText = "";
|
|
53
|
+
}
|
|
54
|
+
// Move parse-safe content from live tail into stable content.
|
|
55
|
+
_advanceStableBoundary() {
|
|
56
|
+
const t = this._rawText.slice(this._stableText.length), s = this._lastSafeBoundary(t);
|
|
57
|
+
if (s <= 0)
|
|
58
|
+
return;
|
|
59
|
+
const i = t.slice(0, s);
|
|
60
|
+
this._stableParts.push(...w(i)), this._stableText += i;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Find the last blank-line boundary that is outside code fences.
|
|
64
|
+
* Returns 0 if no safe boundary is available yet.
|
|
65
|
+
*/
|
|
66
|
+
_lastSafeBoundary(t) {
|
|
67
|
+
const s = t.split(`
|
|
68
|
+
`);
|
|
69
|
+
let i = !1, e = 0, n = 0;
|
|
70
|
+
for (const r of s)
|
|
71
|
+
/^\s*(```|~~~)/u.test(r) && (i = !i), n += r.length + 1, r.trim() === "" && !i && (e = n);
|
|
72
|
+
return e < t.length ? e : 0;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Remove incomplete syntax at the end so we do not render partial markup.
|
|
76
|
+
* Handles:
|
|
77
|
+
* - open HTML tags without closing '>'
|
|
78
|
+
* - HTML elements missing closing tags
|
|
79
|
+
* - markdown links missing closing ')'
|
|
80
|
+
*/
|
|
81
|
+
_trimIncompleteTail(t) {
|
|
82
|
+
const s = t.lastIndexOf("<");
|
|
83
|
+
if (s !== -1 && !t.includes(">", s))
|
|
84
|
+
return t.slice(0, s);
|
|
85
|
+
const i = this._earliestUnclosedTag(t);
|
|
86
|
+
if (i !== -1)
|
|
87
|
+
return t.slice(0, i);
|
|
88
|
+
const e = t.lastIndexOf("[");
|
|
89
|
+
if (e !== -1) {
|
|
90
|
+
const n = t.slice(e);
|
|
91
|
+
if (!/\[[^\]]*\]\([^)]*\)/u.test(n))
|
|
92
|
+
return t.slice(0, e);
|
|
93
|
+
}
|
|
94
|
+
return t;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Return the index of the earliest unclosed opening tag, or -1.
|
|
98
|
+
* Ignores void elements (img, br, input, etc.) and self-closing tags.
|
|
99
|
+
*/
|
|
100
|
+
_earliestUnclosedTag(t) {
|
|
101
|
+
const s = /* @__PURE__ */ new Set([
|
|
102
|
+
"br",
|
|
103
|
+
"img",
|
|
104
|
+
"hr",
|
|
105
|
+
"input",
|
|
106
|
+
"meta",
|
|
107
|
+
"link",
|
|
108
|
+
"area",
|
|
109
|
+
"base",
|
|
110
|
+
"col",
|
|
111
|
+
"embed",
|
|
112
|
+
"source",
|
|
113
|
+
"track",
|
|
114
|
+
"wbr"
|
|
115
|
+
]), i = /<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu, e = [];
|
|
116
|
+
for (let n = i.exec(t); n; n = i.exec(t)) {
|
|
117
|
+
const [, r, a, l] = n, h = a.toLowerCase();
|
|
118
|
+
if (!(s.has(h) || l === "/"))
|
|
119
|
+
if (r === "/") {
|
|
120
|
+
for (let p = e.length - 1; p >= 0; p--)
|
|
121
|
+
if (e[p].name === h) {
|
|
122
|
+
e.splice(p);
|
|
123
|
+
break;
|
|
124
|
+
}
|
|
125
|
+
} else
|
|
126
|
+
e.push({ name: h, index: n.index });
|
|
127
|
+
}
|
|
128
|
+
return e.length ? e[0].index : -1;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
function G(o) {
|
|
132
|
+
const t = new I();
|
|
133
|
+
return t.push(o), t.finalize();
|
|
134
|
+
}
|
|
135
|
+
const W = async (o) => await new Promise((t) => setTimeout(t, o));
|
|
136
|
+
async function* Y(o, { chunkSize: t = 15, delay: s = 50 } = {}) {
|
|
137
|
+
const i = new I();
|
|
138
|
+
for (let e = 0; e < o.length; e += t)
|
|
139
|
+
yield i.push(o.slice(e, e + t)), await W(s);
|
|
140
|
+
yield i.finalize();
|
|
141
|
+
}
|
|
142
|
+
var Z = Object.defineProperty, J = Object.getOwnPropertyDescriptor, u = (o, t, s, i) => {
|
|
143
|
+
for (var e = i > 1 ? void 0 : i ? J(t, s) : t, n = o.length - 1, r; n >= 0; n--)
|
|
144
|
+
(r = o[n]) && (e = (i ? r(t, s, e) : r(e)) || e);
|
|
145
|
+
return i && e && Z(t, s, e), e;
|
|
146
|
+
};
|
|
147
|
+
const $ = (o) => !o || typeof o != "object" ? !1 : o.name === "AbortError";
|
|
148
|
+
async function* C(o, t, s, i, e = !1) {
|
|
149
|
+
if (e) {
|
|
46
150
|
if (i?.aborted) {
|
|
47
|
-
yield { type: "cancelled", log:
|
|
151
|
+
yield { type: "cancelled", log: s, runId: t };
|
|
48
152
|
return;
|
|
49
153
|
}
|
|
50
|
-
yield { type: "block-data", blockType: "text", data: {
|
|
154
|
+
yield { type: "block-data", blockType: "text", data: { parts: G(o) }, runId: t };
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
for await (const n of Y(o)) {
|
|
158
|
+
if (i?.aborted) {
|
|
159
|
+
yield { type: "cancelled", log: s, runId: t };
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
yield { type: "block-data", blockType: "text", data: { parts: n }, runId: t };
|
|
51
163
|
}
|
|
52
164
|
}
|
|
53
|
-
let d = class extends
|
|
165
|
+
let d = class extends j {
|
|
54
166
|
constructor(o) {
|
|
55
|
-
super(o), this.view = null, this.loading = !1, this.processing = !1, this.processingStep = "";
|
|
167
|
+
super(o), this.view = null, this.streamingDisabled = !1, this.loading = !1, this.processing = !1, this.processingStep = "";
|
|
56
168
|
}
|
|
57
169
|
async load() {
|
|
58
170
|
this._set("loading", !0);
|
|
@@ -66,14 +178,14 @@ let d = class extends B {
|
|
|
66
178
|
this.orchestrator?.dispose(), super.destroy();
|
|
67
179
|
}
|
|
68
180
|
async _initialize() {
|
|
69
|
-
this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await
|
|
181
|
+
this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await L(() => !this.view.updating), this._set(
|
|
70
182
|
"orchestrator",
|
|
71
|
-
await
|
|
183
|
+
await U.init({
|
|
72
184
|
agents: [...this.agents],
|
|
73
185
|
view: this.view ?? void 0
|
|
74
186
|
})
|
|
75
187
|
), this.addHandles([
|
|
76
|
-
|
|
188
|
+
R(
|
|
77
189
|
() => [this.view, this.agents],
|
|
78
190
|
() => {
|
|
79
191
|
this._initialize();
|
|
@@ -88,39 +200,39 @@ let d = class extends B {
|
|
|
88
200
|
if (!this.orchestrator)
|
|
89
201
|
throw new Error("Orchestrator not initialized yet.");
|
|
90
202
|
this._set("processing", !0), this._set("processingStep", "");
|
|
91
|
-
const
|
|
92
|
-
let i,
|
|
203
|
+
const s = [];
|
|
204
|
+
let i, e = "pending";
|
|
93
205
|
try {
|
|
94
|
-
const
|
|
95
|
-
for await (const r of
|
|
96
|
-
switch (
|
|
206
|
+
const n = this.orchestrator.ask(o);
|
|
207
|
+
for await (const r of n)
|
|
208
|
+
switch (e = r.runId, r.type) {
|
|
97
209
|
case "trace": {
|
|
98
|
-
this._set("processingStep", r.data.text),
|
|
210
|
+
this._set("processingStep", r.data.text), s.push(r.data.text);
|
|
99
211
|
break;
|
|
100
212
|
}
|
|
101
213
|
case "completed": {
|
|
102
214
|
this._set("processing", !1), this._set("processingStep", "");
|
|
103
|
-
const a = r.result,
|
|
104
|
-
if (!
|
|
105
|
-
yield { type: "completed", error: "No response received.", log:
|
|
215
|
+
const a = r.result, l = !!a.content.length, h = !!i?.length;
|
|
216
|
+
if (!l && !h) {
|
|
217
|
+
yield { type: "completed", error: "No response received.", log: s, runId: e };
|
|
106
218
|
return;
|
|
107
219
|
}
|
|
108
|
-
const
|
|
109
|
-
if (yield { type: "block-start", blockType: "text", runId:
|
|
220
|
+
const p = a.content;
|
|
221
|
+
if (yield { type: "block-start", blockType: "text", runId: e }, yield* C(p, e, s, t, this.streamingDisabled), yield { type: "block-end", blockType: "text", runId: e }, h)
|
|
110
222
|
for (const f of i) {
|
|
111
223
|
if (t?.aborted) {
|
|
112
|
-
yield { type: "cancelled", log:
|
|
224
|
+
yield { type: "cancelled", log: s, runId: e };
|
|
113
225
|
return;
|
|
114
226
|
}
|
|
115
|
-
const { type:
|
|
116
|
-
if (yield { type: "block-start", blockType:
|
|
117
|
-
const
|
|
118
|
-
yield*
|
|
227
|
+
const { type: b, data: _ } = f;
|
|
228
|
+
if (yield { type: "block-start", blockType: b, runId: e }, b === "text") {
|
|
229
|
+
const P = typeof _?.content == "string" ? _.content : "";
|
|
230
|
+
yield* C(P, e, s, t, this.streamingDisabled);
|
|
119
231
|
} else
|
|
120
|
-
yield { type: "block-data", blockType:
|
|
121
|
-
yield { type: "block-end", blockType:
|
|
232
|
+
yield { type: "block-data", blockType: b, data: _, runId: e };
|
|
233
|
+
yield { type: "block-end", blockType: b, runId: e };
|
|
122
234
|
}
|
|
123
|
-
yield { type: "completed", response:
|
|
235
|
+
yield { type: "completed", response: p, blocks: i, log: s, runId: e };
|
|
124
236
|
return;
|
|
125
237
|
}
|
|
126
238
|
case "ux-suggestion": {
|
|
@@ -129,33 +241,33 @@ let d = class extends B {
|
|
|
129
241
|
break;
|
|
130
242
|
}
|
|
131
243
|
case "interrupt": {
|
|
132
|
-
const { kind: a, message:
|
|
244
|
+
const { kind: a, message: l, metadata: h } = r.interrupt, p = Array.isArray(h) ? h.filter((b) => typeof b == "string") : [], f = (() => {
|
|
133
245
|
switch (a) {
|
|
134
246
|
case "booleanChoice":
|
|
135
|
-
return { type: "boolean-choice", message:
|
|
247
|
+
return { type: "boolean-choice", message: l, options: p };
|
|
136
248
|
case "singleSelection":
|
|
137
|
-
return { type: "single-select", message:
|
|
249
|
+
return { type: "single-select", message: l, options: p };
|
|
138
250
|
case "multipleSelection":
|
|
139
|
-
return { type: "multi-select", message:
|
|
251
|
+
return { type: "multi-select", message: l, options: p };
|
|
140
252
|
case "textInput":
|
|
141
|
-
return { type: "text-input", message:
|
|
253
|
+
return { type: "text-input", message: l };
|
|
142
254
|
default:
|
|
143
|
-
return { type: a, message:
|
|
255
|
+
return { type: a, message: l, options: p };
|
|
144
256
|
}
|
|
145
257
|
})();
|
|
146
|
-
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: f, runId:
|
|
258
|
+
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: f, runId: e };
|
|
147
259
|
break;
|
|
148
260
|
}
|
|
149
261
|
case "cancelled": {
|
|
150
|
-
yield { type: "cancelled", log:
|
|
262
|
+
yield { type: "cancelled", log: s, runId: e };
|
|
151
263
|
return;
|
|
152
264
|
}
|
|
153
265
|
case "error": {
|
|
154
|
-
if (t?.aborted ||
|
|
155
|
-
yield { type: "cancelled", log:
|
|
266
|
+
if (t?.aborted || $(r.error)) {
|
|
267
|
+
yield { type: "cancelled", log: s, runId: e };
|
|
156
268
|
return;
|
|
157
269
|
}
|
|
158
|
-
yield { type: "completed", error: r.error.message, log:
|
|
270
|
+
yield { type: "completed", error: r.error.message, log: s, runId: e };
|
|
159
271
|
return;
|
|
160
272
|
}
|
|
161
273
|
default: {
|
|
@@ -163,12 +275,12 @@ let d = class extends B {
|
|
|
163
275
|
break;
|
|
164
276
|
}
|
|
165
277
|
}
|
|
166
|
-
} catch (
|
|
167
|
-
if (t?.aborted ||
|
|
168
|
-
yield { type: "cancelled", log:
|
|
278
|
+
} catch (n) {
|
|
279
|
+
if (t?.aborted || $(n)) {
|
|
280
|
+
yield { type: "cancelled", log: s, runId: e };
|
|
169
281
|
return;
|
|
170
282
|
}
|
|
171
|
-
console.warn("Error during message processing:",
|
|
283
|
+
console.warn("Error during message processing:", n), yield { type: "completed", error: "An error occurred during message processing.", log: s, runId: "error" };
|
|
172
284
|
return;
|
|
173
285
|
} finally {
|
|
174
286
|
this._set("processing", !1);
|
|
@@ -178,99 +290,103 @@ let d = class extends B {
|
|
|
178
290
|
this.orchestrator?.cancel();
|
|
179
291
|
}
|
|
180
292
|
};
|
|
181
|
-
|
|
182
|
-
|
|
293
|
+
u([
|
|
294
|
+
m({ readOnly: !0 })
|
|
183
295
|
], d.prototype, "orchestrator", 2);
|
|
184
|
-
|
|
185
|
-
|
|
296
|
+
u([
|
|
297
|
+
m()
|
|
186
298
|
], d.prototype, "agents", 2);
|
|
187
|
-
|
|
188
|
-
|
|
299
|
+
u([
|
|
300
|
+
m()
|
|
189
301
|
], d.prototype, "portal", 2);
|
|
190
|
-
|
|
191
|
-
|
|
302
|
+
u([
|
|
303
|
+
m()
|
|
192
304
|
], d.prototype, "view", 2);
|
|
193
|
-
|
|
194
|
-
|
|
305
|
+
u([
|
|
306
|
+
m()
|
|
307
|
+
], d.prototype, "streamingDisabled", 2);
|
|
308
|
+
u([
|
|
309
|
+
m({ readOnly: !0 })
|
|
195
310
|
], d.prototype, "loading", 2);
|
|
196
|
-
|
|
197
|
-
|
|
311
|
+
u([
|
|
312
|
+
m({ readOnly: !0 })
|
|
198
313
|
], d.prototype, "processing", 2);
|
|
199
|
-
|
|
200
|
-
|
|
314
|
+
u([
|
|
315
|
+
m({ readOnly: !0 })
|
|
201
316
|
], d.prototype, "processingStep", 2);
|
|
202
|
-
d =
|
|
203
|
-
|
|
317
|
+
d = u([
|
|
318
|
+
q("OrchestratorController")
|
|
204
319
|
], d);
|
|
205
|
-
const
|
|
206
|
-
class
|
|
320
|
+
const K = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", Q = "Embeddings not found for this web map.", X = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
|
|
321
|
+
class tt extends M {
|
|
207
322
|
constructor() {
|
|
208
|
-
super(...arguments), this._messages =
|
|
323
|
+
super(...arguments), this._messages = N({ blocking: !0 }), this.#t = y(), this.#l = y(), this.#s = y(), this.#e = null, this.#r = /* @__PURE__ */ new Map(), this.#i = O.getDefault(), this.#a = (t) => {
|
|
209
324
|
t.stopPropagation(), this.cancelInterrupt();
|
|
210
|
-
}, this.#
|
|
325
|
+
}, this.#n = (t) => {
|
|
211
326
|
t.stopPropagation();
|
|
212
|
-
const
|
|
213
|
-
this.submitInterrupt(
|
|
214
|
-
}, this.#l = (t) => {
|
|
215
|
-
t.stopPropagation(), this.keepSuggestedPrompts || (this.suggestedPrompts = []);
|
|
216
|
-
const e = t.detail;
|
|
217
|
-
this._inputValue = "", this.arcgisSubmit.emit(e), this.submitMessage(e);
|
|
327
|
+
const s = t.detail;
|
|
328
|
+
this.submitInterrupt(s);
|
|
218
329
|
}, this.#c = (t) => {
|
|
330
|
+
t.stopPropagation(), this.keepSuggestedPrompts || (this.suggestedPrompts = []);
|
|
331
|
+
const s = t.detail;
|
|
332
|
+
this._inputValue = "", this.arcgisSubmit.emit(s), this.submitMessage(s);
|
|
333
|
+
}, this.#h = (t) => {
|
|
219
334
|
if (this._canceling = !0, t.stopPropagation(), this.arcgisCancel.emit(), this._interrupt) {
|
|
220
335
|
this.orchestrator?.cancelInterrupt(), this._interrupt = null;
|
|
221
336
|
return;
|
|
222
337
|
}
|
|
223
338
|
this._orchestratorController?.cancel(), this.#e?.abort(), this.#e = null;
|
|
224
|
-
}, this.#
|
|
339
|
+
}, this.#p = (t) => {
|
|
225
340
|
t.stopPropagation();
|
|
226
|
-
const
|
|
227
|
-
this.arcgisFeedback.emit(
|
|
341
|
+
const s = t.detail;
|
|
342
|
+
this.arcgisFeedback.emit(s);
|
|
228
343
|
}, this.#g = (t) => {
|
|
229
344
|
t.stopPropagation();
|
|
230
|
-
const
|
|
231
|
-
this._inputValue =
|
|
232
|
-
}, this.#
|
|
345
|
+
const s = t.detail;
|
|
346
|
+
this._inputValue = s.prompt, this.arcgisPromptSelect.emit(s);
|
|
347
|
+
}, this.#d = (t) => {
|
|
233
348
|
this.arcgisSlottableRequest.emit(t.detail);
|
|
234
|
-
}, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new
|
|
349
|
+
}, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new T([]), 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.arcgisCancel = g(), this.arcgisError = g(), this.arcgisFeedback = g(), this.arcgisInterrupt = g(), this.arcgisInterruptCancel = g(), this.arcgisInterruptSubmit = g(), this.arcgisPromptSelect = g(), this.arcgisReady = g(), this.arcgisSubmit = g(), this.arcgisSlottableRequest = g({ bubbles: !1, composed: !1 }), this.arcgisResponse = g();
|
|
235
350
|
}
|
|
236
351
|
static {
|
|
237
|
-
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, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5 };
|
|
352
|
+
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 };
|
|
238
353
|
}
|
|
239
354
|
static {
|
|
240
|
-
this.styles =
|
|
355
|
+
this.styles = F;
|
|
241
356
|
}
|
|
242
357
|
#t;
|
|
243
|
-
#
|
|
358
|
+
#l;
|
|
244
359
|
#s;
|
|
245
360
|
#e;
|
|
246
|
-
#o;
|
|
247
361
|
#r;
|
|
248
362
|
#i;
|
|
249
363
|
#a;
|
|
250
|
-
#
|
|
364
|
+
#n;
|
|
251
365
|
#c;
|
|
252
366
|
#h;
|
|
253
|
-
#g;
|
|
254
367
|
#p;
|
|
255
|
-
|
|
368
|
+
#g;
|
|
369
|
+
#d;
|
|
370
|
+
async #o() {
|
|
256
371
|
try {
|
|
257
|
-
const t =
|
|
372
|
+
const t = H(this.el, this.referenceElement);
|
|
258
373
|
await t?.componentOnReady();
|
|
259
|
-
const
|
|
260
|
-
return
|
|
261
|
-
agents:
|
|
262
|
-
portal: this.#
|
|
374
|
+
const s = [...this.#r.values()];
|
|
375
|
+
return s.length ? (this._orchestratorController?.destroy(), this._orchestratorController = new d({
|
|
376
|
+
agents: s,
|
|
377
|
+
portal: this.#i,
|
|
378
|
+
streamingDisabled: this.streamingDisabled,
|
|
263
379
|
view: t?.view
|
|
264
380
|
}), await this._orchestratorController.load(), !0) : (this._error = "No agents found.", !1);
|
|
265
381
|
} catch (t) {
|
|
266
|
-
return this._error = t?.message ?? "Error initializing orchestrator.",
|
|
382
|
+
return this._error = t?.message ?? "Error initializing orchestrator.", z(this)(t), !1;
|
|
267
383
|
}
|
|
268
384
|
}
|
|
269
385
|
get _isSignedIn() {
|
|
270
|
-
return !!this.#
|
|
386
|
+
return !!this.#i?.user || !!this._signedInUserId;
|
|
271
387
|
}
|
|
272
388
|
get _user() {
|
|
273
|
-
return this.#
|
|
389
|
+
return this.#i?.user?.fullName || this.#i?.user?.username;
|
|
274
390
|
}
|
|
275
391
|
get awaitingResponse() {
|
|
276
392
|
return this._orchestratorController?.processing ?? !1;
|
|
@@ -291,94 +407,98 @@ class K extends M {
|
|
|
291
407
|
this.arcgisInterruptCancel.emit(), this.orchestrator?.cancelInterrupt(), this._interrupt = null;
|
|
292
408
|
}
|
|
293
409
|
register(t) {
|
|
294
|
-
this.#
|
|
410
|
+
this.#r.set(t.agent.id, t), this._orchestratorController && this.#o();
|
|
411
|
+
}
|
|
412
|
+
unregister(t) {
|
|
413
|
+
this.#r.delete(t), this._orchestratorController && this.#o();
|
|
295
414
|
}
|
|
296
415
|
async submitMessage(t) {
|
|
297
|
-
const
|
|
298
|
-
if (!
|
|
416
|
+
const s = t.trim();
|
|
417
|
+
if (!s || (this.messages.push({
|
|
299
418
|
id: Date.now().toString(),
|
|
300
419
|
// TODO: Replace with a more robust ID generation method or get from orchestrator
|
|
301
420
|
role: "user",
|
|
302
|
-
content:
|
|
421
|
+
content: s
|
|
303
422
|
}), !this._orchestratorController))
|
|
304
423
|
return;
|
|
305
|
-
this.#e = new AbortController();
|
|
306
|
-
const i = this._orchestratorController.ask(
|
|
307
|
-
for await (const
|
|
308
|
-
const
|
|
309
|
-
switch (
|
|
424
|
+
this.#e = new AbortController(), this._orchestratorController.streamingDisabled = this.streamingDisabled;
|
|
425
|
+
const i = this._orchestratorController.ask(s, this.#e?.signal);
|
|
426
|
+
for await (const e of i) {
|
|
427
|
+
const n = e.runId, r = this.messages.at(-1);
|
|
428
|
+
switch (e.type) {
|
|
310
429
|
case "block-start": {
|
|
311
430
|
this._isAnswering = !0;
|
|
312
|
-
const a = { type:
|
|
313
|
-
if (r?.role === "assistant" && r.id ===
|
|
314
|
-
const
|
|
315
|
-
this.messages.splice(-1, 1, { ...r, blocks:
|
|
431
|
+
const a = { type: e.blockType, isPending: !0 };
|
|
432
|
+
if (r?.role === "assistant" && r.id === n) {
|
|
433
|
+
const l = [...r.blocks ?? [], a];
|
|
434
|
+
this.messages.splice(-1, 1, { ...r, blocks: l });
|
|
316
435
|
} else
|
|
317
436
|
this.messages.push({
|
|
318
437
|
role: "assistant",
|
|
319
438
|
blocks: [a],
|
|
320
|
-
id:
|
|
439
|
+
id: n,
|
|
321
440
|
isStreaming: !0,
|
|
322
441
|
interrupts: this._interruptDetails
|
|
323
442
|
}), this._interruptDetails = [];
|
|
324
443
|
break;
|
|
325
444
|
}
|
|
326
445
|
case "block-data": {
|
|
327
|
-
if (r?.role !== "assistant" || r?.id !==
|
|
446
|
+
if (r?.role !== "assistant" || r?.id !== n)
|
|
328
447
|
break;
|
|
329
|
-
const a = [...r.blocks ?? []],
|
|
330
|
-
if (
|
|
448
|
+
const a = [...r.blocks ?? []], l = a[a.length - 1], { blockType: h, data: p } = e;
|
|
449
|
+
if (l?.type !== h || !l.isPending)
|
|
331
450
|
break;
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
451
|
+
h === "text" ? a[a.length - 1] = {
|
|
452
|
+
...l,
|
|
453
|
+
data: {
|
|
454
|
+
...l.data,
|
|
455
|
+
parts: p?.parts
|
|
456
|
+
}
|
|
457
|
+
} : a[a.length - 1] = { ...l, data: { ...l.data, ...p ?? {} } }, this.messages.splice(-1, 1, { ...r, blocks: a });
|
|
338
458
|
break;
|
|
339
459
|
}
|
|
340
460
|
case "block-end": {
|
|
341
|
-
if (r?.role !== "assistant" || r?.id !==
|
|
461
|
+
if (r?.role !== "assistant" || r?.id !== n)
|
|
342
462
|
break;
|
|
343
|
-
const a = [...r.blocks ?? []],
|
|
344
|
-
if (
|
|
463
|
+
const a = [...r.blocks ?? []], l = a[a.length - 1];
|
|
464
|
+
if (l?.type !== e.blockType || !l.isPending)
|
|
345
465
|
break;
|
|
346
|
-
const h =
|
|
466
|
+
const h = l;
|
|
347
467
|
a[a.length - 1] = { ...h, data: { ...h.data }, isPending: !1 }, this.messages.splice(-1, 1, { ...r, blocks: a });
|
|
348
468
|
break;
|
|
349
469
|
}
|
|
350
470
|
case "completed":
|
|
351
|
-
|
|
471
|
+
e.error ? (this.messages.push({
|
|
352
472
|
role: "assistant",
|
|
353
|
-
log:
|
|
354
|
-
error:
|
|
355
|
-
id:
|
|
473
|
+
log: e.log,
|
|
474
|
+
error: e.error,
|
|
475
|
+
id: n,
|
|
356
476
|
interrupts: this._interruptDetails
|
|
357
|
-
}), this._interruptDetails = []) : r?.role === "assistant" && r.id ===
|
|
477
|
+
}), this._interruptDetails = []) : r?.role === "assistant" && r.id === n && this.messages.splice(-1, 1, {
|
|
358
478
|
...r,
|
|
359
|
-
content:
|
|
360
|
-
blocks: r.blocks?.map((a) => ({ ...a, isPending: !1 })) ?? [],
|
|
479
|
+
content: e.response,
|
|
480
|
+
blocks: r.blocks?.map((a) => ({ ...a, data: { ...a.data }, isPending: !1 })) ?? [],
|
|
361
481
|
isStreaming: !1,
|
|
362
|
-
log:
|
|
482
|
+
log: e.log
|
|
363
483
|
}), this._isAnswering = !1, this.#e = null, this._canceling = !1;
|
|
364
484
|
break;
|
|
365
485
|
case "interrupt":
|
|
366
|
-
this._interrupt = { ...
|
|
486
|
+
this._interrupt = { ...e.payload, id: n }, this.arcgisInterrupt.emit(this._interrupt);
|
|
367
487
|
break;
|
|
368
488
|
case "cancelled":
|
|
369
|
-
r?.role === "assistant" && r.id ===
|
|
489
|
+
r?.role === "assistant" && r.id === n ? this.messages.splice(-1, 1, {
|
|
370
490
|
...r,
|
|
371
491
|
blocks: r.blocks?.filter((a) => a.type === "text" || !a.isPending) ?? [],
|
|
372
492
|
isStreaming: !1,
|
|
373
|
-
log:
|
|
493
|
+
log: e.log,
|
|
374
494
|
error: "(Stopped by user)"
|
|
375
495
|
// TODO: use strings from t9n
|
|
376
496
|
}) : (this.messages.push({
|
|
377
497
|
role: "assistant",
|
|
378
|
-
log:
|
|
498
|
+
log: e.log,
|
|
379
499
|
error: "(Stopped by user)",
|
|
380
500
|
// TODO: use strings from t9n
|
|
381
|
-
id:
|
|
501
|
+
id: n,
|
|
382
502
|
interrupts: this._interruptDetails
|
|
383
503
|
}), this._interruptDetails = []), this._isAnswering = !1, this.#e = null, this._canceling = !1;
|
|
384
504
|
break;
|
|
@@ -393,20 +513,20 @@ class K extends M {
|
|
|
393
513
|
}
|
|
394
514
|
loaded() {
|
|
395
515
|
this.manager.onLifecycle(() => {
|
|
396
|
-
this.#t.value?.addEventListener("arcgisPromptSelect", this.#g), this.#t.value?.addEventListener("arcgisSubmit", this.#
|
|
397
|
-
const t =
|
|
516
|
+
this.#t.value?.addEventListener("arcgisPromptSelect", this.#g), this.#t.value?.addEventListener("arcgisSubmit", this.#c), this.#t.value?.addEventListener("arcgisCancel", this.#h), this.#t.value?.addEventListener("arcgisFeedback", this.#p);
|
|
517
|
+
const t = D(() => !!this._interrupt && !!this.#s.value, () => {
|
|
398
518
|
const i = this.#s.value;
|
|
399
|
-
i.removeEventListener("arcgisSubmit", this.#
|
|
400
|
-
}),
|
|
401
|
-
const
|
|
402
|
-
|
|
519
|
+
i.removeEventListener("arcgisSubmit", this.#n), i.removeEventListener("arcgisCancel", this.#a), i.addEventListener("arcgisSubmit", this.#n, { once: !0 }), i.addEventListener("arcgisCancel", this.#a, { once: !0 });
|
|
520
|
+
}), s = this.messages.on("after-add", (i) => {
|
|
521
|
+
const e = i.item;
|
|
522
|
+
e.role === "assistant" && (e.error || e.content) && this.arcgisResponse.emit(e);
|
|
403
523
|
});
|
|
404
524
|
return queueMicrotask(() => {
|
|
405
|
-
this.#
|
|
525
|
+
this.#o().then((i) => {
|
|
406
526
|
i ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
|
|
407
527
|
});
|
|
408
528
|
}), () => {
|
|
409
|
-
t.remove(),
|
|
529
|
+
t.remove(), s.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#g), 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.#p), this._orchestratorController?.destroy(), this._orchestratorController = null;
|
|
410
530
|
};
|
|
411
531
|
});
|
|
412
532
|
}
|
|
@@ -417,26 +537,26 @@ class K extends M {
|
|
|
417
537
|
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();
|
|
418
538
|
}
|
|
419
539
|
_renderSignInNotice() {
|
|
420
|
-
const t = this.#
|
|
540
|
+
const t = this.#i;
|
|
421
541
|
return c`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>You need to sign in to use the assistant chat.</div>${t ? c`<calcite-link slot=link @click=${async () => {
|
|
422
542
|
try {
|
|
423
|
-
const
|
|
424
|
-
this._signedInUserId =
|
|
425
|
-
} catch (
|
|
426
|
-
this._error =
|
|
543
|
+
const s = await V.getCredential(`${t.url}/sharing`);
|
|
544
|
+
this._signedInUserId = s.userId, this._error = null, this.requestUpdate(), await this.#o() ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
|
|
545
|
+
} catch (s) {
|
|
546
|
+
this._error = s?.message ?? "Error signing in.", this.arcgisError.emit(new Error(this._error)), B.log("error", this, "Error signing in:", { detail: { error: s } });
|
|
427
547
|
}
|
|
428
548
|
}} target=_blank title="Sign in to ArcGIS Online">Sign in</calcite-link>` : c`<div slot=link>No portal information available</div>`}</calcite-notice>`;
|
|
429
549
|
}
|
|
430
550
|
_renderErrorNotice() {
|
|
431
|
-
return this._error ? c`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error ===
|
|
551
|
+
return this._error ? c`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error === K ? c`<div slot=message>${Q}</div><calcite-link slot=link .href=${X} target=_blank title="Learn about web map embeddings">Read more</calcite-link>` : c`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
|
|
432
552
|
}
|
|
433
553
|
render() {
|
|
434
|
-
return c`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${v(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.#
|
|
435
|
-
this.#
|
|
554
|
+
return c`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${v(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, i) => c`<slot name=${S(t.id, i) ?? k} slot=${S(t.id, i) ?? k}><arcgis-assistant-message-block .block=${s}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : c`<arcgis-assistant-user-message .message=${t} .user=${this._user}></arcgis-assistant-user-message>`)}</slot>${this._interrupt ? c`<div slot=message-loading><div class="interrupt-waiting-message">waiting for user input...</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} ${v(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} ${v(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=${() => {
|
|
555
|
+
this.#l.value?.submitMessage();
|
|
436
556
|
}} 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>`;
|
|
437
557
|
}
|
|
438
558
|
}
|
|
439
|
-
|
|
559
|
+
x("arcgis-assistant", tt);
|
|
440
560
|
export {
|
|
441
|
-
|
|
561
|
+
tt as ArcgisAssistant
|
|
442
562
|
};
|