@arcgis/ai-components 5.2.0-next.120 → 5.2.0-next.121
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/LLMAgent.js +2 -0
- package/dist/agents/runtime/skill/createSkillAgent.js +115 -131
- package/dist/cdn/2DYOTV7W.js +4 -0
- package/dist/cdn/2WT4JANT.js +2 -0
- package/dist/cdn/{2NODROJN.js → 3F5EZZSG.js} +20 -24
- package/dist/cdn/4V3Q7XGS.js +2 -0
- package/dist/cdn/5GALSAQF.js +3 -0
- package/dist/cdn/72KYGCIU.js +2 -0
- package/dist/cdn/75OPJOCY.js +2 -0
- package/dist/cdn/7D6POJJA.js +2 -0
- package/dist/cdn/{SLR75R32.js → 7HVK7G55.js} +1 -1
- package/dist/cdn/7L6LPWRH.js +2 -0
- package/dist/cdn/7TAIUEMW.js +2 -0
- package/dist/cdn/{C2W6MBDB.js → D3E5NSY3.js} +1 -1
- package/dist/cdn/ESPC6NTI.js +68 -0
- package/dist/cdn/{HTB76P2C.js → EWO73MJA.js} +1 -1
- package/dist/cdn/{EIZR3Q5O.js → FGQLS3UX.js} +1 -1
- package/dist/cdn/FOZAOJCM.js +2 -0
- package/dist/cdn/GZDI2LAT.js +2 -0
- package/dist/cdn/H4ERKWFA.js +2 -0
- package/dist/cdn/{7W7KWR5O.js → H5AVPDSE.js} +4 -4
- package/dist/cdn/{2I2FHPHR.js → HDAMDEYL.js} +6 -6
- package/dist/cdn/JE55XX2C.js +2 -0
- package/dist/cdn/K36XPG2M.js +2 -0
- package/dist/cdn/KDE5MMMR.js +2 -0
- package/dist/cdn/{ZGZX7GR5.js → KONQTXBJ.js} +1 -1
- package/dist/cdn/{J4YHT55S.js → MCZJD3A4.js} +1 -1
- package/dist/cdn/MNZAQM3Q.js +3 -0
- package/dist/cdn/NHZRDYLP.js +2 -0
- package/dist/cdn/NYFV4A6L.js +3 -0
- package/dist/cdn/OGYNTGNM.js +2 -0
- package/dist/cdn/PGIXKPTW.js +2 -0
- package/dist/cdn/PTEKX5TX.js +2 -0
- package/dist/cdn/PUHPFUCU.js +2 -0
- package/dist/cdn/{GKWMAWFZ.js → QDOKDRBB.js} +1 -1
- package/dist/cdn/TGZBLBEJ.js +2 -0
- package/dist/cdn/{K7BUBCK7.js → UBKYXKMW.js} +1 -1
- package/dist/cdn/UXECAKJ7.js +2 -0
- package/dist/cdn/WXOKGQ4D.js +2 -0
- package/dist/cdn/Y364LLPN.js +2 -0
- package/dist/cdn/YBSY32EU.js +2 -0
- package/dist/cdn/{CF2V3NER.js → ZLLVPKDN.js} +35 -35
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/assets/agents/t9n/messages.ar.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.bg.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.ca.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.cs.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.da.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.de.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.el.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.es.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.et.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.fi.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.fr.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.he.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.hr.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.hu.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.id.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.it.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.ja.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.ko.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.lt.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.lv.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.nl.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.no.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.pl.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.pt-BR.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.pt-PT.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.ro.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.ru.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.sk.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.sl.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.sr.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.sv.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.th.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.tr.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.uk.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.vi.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.zh-CN.json +1 -0
- package/dist/cdn/assets/agents/t9n/messages.zh-TW.json +1 -0
- package/dist/cdn/assets/orchestrator/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +54 -52
- package/dist/chunks/aiFactory.js +59 -41
- package/dist/chunks/arcgisKnowledgeGraph.js +4 -2
- package/dist/chunks/dataExplorationAgent.js +1 -1
- package/dist/chunks/generateLayerDescriptions.js +160 -156
- package/dist/chunks/layerStylingGraph.js +2 -0
- package/dist/chunks/orchestrator.js +325 -295
- package/dist/components/arcgis-assistant/customElement.d.ts +1 -1
- package/dist/components/arcgis-assistant/customElement.js +113 -112
- package/dist/components/arcgis-assistant-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +5 -4
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
- 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/utils/index.js +38 -36
- package/package.json +7 -7
- package/dist/cdn/5BBXNT75.js +0 -66
- package/dist/cdn/5HBAJ57P.js +0 -2
- package/dist/cdn/5MK44FNO.js +0 -2
- package/dist/cdn/6ECRQVHY.js +0 -2
- package/dist/cdn/AUDVUNF3.js +0 -2
- package/dist/cdn/BJUX4AYP.js +0 -2
- package/dist/cdn/COH3QXWG.js +0 -4
- package/dist/cdn/CPQGLQGY.js +0 -2
- package/dist/cdn/CT2ZOYNX.js +0 -2
- package/dist/cdn/DNV3L5M6.js +0 -2
- package/dist/cdn/EDVH3G5A.js +0 -2
- package/dist/cdn/HWGAJ4WN.js +0 -2
- package/dist/cdn/IHRX74QJ.js +0 -2
- package/dist/cdn/LRH2ZPVW.js +0 -2
- package/dist/cdn/OTOQL3QM.js +0 -3
- package/dist/cdn/R74ZHFA6.js +0 -2
- package/dist/cdn/RGVC76RW.js +0 -2
- package/dist/cdn/RIN3RP7D.js +0 -3
- package/dist/cdn/SWVRA77H.js +0 -2
- package/dist/cdn/TLQ75QXG.js +0 -2
- package/dist/cdn/TPF5Z277.js +0 -3
- package/dist/cdn/UIIVUHXL.js +0 -2
- package/dist/cdn/UWZQWGZP.js +0 -2
- package/dist/cdn/UXYYH6XF.js +0 -2
- package/dist/cdn/XUYARLRP.js +0 -2
- package/dist/cdn/XV3DHHYJ.js +0 -2
- package/dist/cdn/Y2BCEVV6.js +0 -2
- package/dist/cdn/YJ4MZOVC.js +0 -2
- package/dist/cdn/YXIPCGGP.js +0 -2
- package/dist/cdn/YYFKFPSN.js +0 -2
|
@@ -140,7 +140,7 @@ export abstract class ArcgisAssistant extends LitElement {
|
|
|
140
140
|
* Agent ids for SDK agents are as follows:
|
|
141
141
|
*
|
|
142
142
|
* - Navigation Agent: `navigation`
|
|
143
|
-
* - Data Exploration Agent: `
|
|
143
|
+
* - Data Exploration Agent: `data-exploration`
|
|
144
144
|
* - Help Agent: `help`
|
|
145
145
|
* - Knowledge Agent: `arcgisKnowledge`
|
|
146
146
|
*
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { c as L } from "../../chunks/runtime.js";
|
|
3
|
-
import { css as T, html as
|
|
3
|
+
import { css as T, html as d } from "lit";
|
|
4
4
|
import M from "@arcgis/core/core/Collection.js";
|
|
5
5
|
import { whenOnce as R, watch as D, when as O } from "@arcgis/core/core/reactiveUtils.js";
|
|
6
6
|
import U from "@arcgis/core/portal/Portal.js";
|
|
7
|
-
import { LitElement as B, createEvent as m, nothing as
|
|
7
|
+
import { LitElement as B, createEvent as m, nothing as w } from "@arcgis/lumina";
|
|
8
8
|
import * as z from "@arcgis/toolkit/log";
|
|
9
9
|
import { rethrowError as N } from "@arcgis/toolkit/log";
|
|
10
|
-
import { createRef as
|
|
10
|
+
import { createRef as E, ref as k } from "lit/directives/ref.js";
|
|
11
11
|
import { u as q } from "../../chunks/useT9n.js";
|
|
12
12
|
import { O as F } 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 S 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";
|
|
@@ -22,15 +22,15 @@ import "@arcgis/core/layers/FeatureLayer.js";
|
|
|
22
22
|
import "../../chunks/generateLayerDescriptions.js";
|
|
23
23
|
import "@langchain/langgraph/web";
|
|
24
24
|
import H from "@arcgis/core/core/Accessor.js";
|
|
25
|
-
import { property as
|
|
26
|
-
import { marked as
|
|
25
|
+
import { property as y, subclass as V } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
26
|
+
import { marked as I } from "marked";
|
|
27
27
|
import { g as j } from "../../chunks/utils3.js";
|
|
28
|
-
import { g as
|
|
28
|
+
import { g as A } from "../../chunks/slottableRequestUtils.js";
|
|
29
29
|
const W = T`: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
|
|
31
|
-
return l.trim() ?
|
|
30
|
+
function $(l) {
|
|
31
|
+
return l.trim() ? I.lexer(l).filter((t) => t.type !== "space").map((t) => I.parser([t])) : [];
|
|
32
32
|
}
|
|
33
|
-
class
|
|
33
|
+
class x {
|
|
34
34
|
constructor() {
|
|
35
35
|
this._stableParts = [], this._stableText = "", this._rawText = "";
|
|
36
36
|
}
|
|
@@ -42,11 +42,11 @@ class C {
|
|
|
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(...$(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)), e = t.trim() ?
|
|
49
|
+
const t = this._trimIncompleteTail(this._rawText.slice(this._stableText.length)), e = t.trim() ? $(t) : [];
|
|
50
50
|
return [...this._stableParts, ...e];
|
|
51
51
|
}
|
|
52
52
|
reset() {
|
|
@@ -58,7 +58,7 @@ class C {
|
|
|
58
58
|
if (e <= 0)
|
|
59
59
|
return;
|
|
60
60
|
const s = t.slice(0, e);
|
|
61
|
-
this._stableParts.push(
|
|
61
|
+
this._stableParts.push(...$(s)), this._stableText += s;
|
|
62
62
|
}
|
|
63
63
|
/**
|
|
64
64
|
* Find the last blank-line boundary that is outside code fences.
|
|
@@ -68,8 +68,8 @@ class C {
|
|
|
68
68
|
const e = t.split(`
|
|
69
69
|
`);
|
|
70
70
|
let s = !1, i = 0, r = 0;
|
|
71
|
-
for (const
|
|
72
|
-
/^\s*(```|~~~)/u.test(
|
|
71
|
+
for (const g of e)
|
|
72
|
+
/^\s*(```|~~~)/u.test(g) && (s = !s), r += g.length + 1, g.trim() === "" && !s && (i = r);
|
|
73
73
|
return i < t.length ? i : 0;
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -115,38 +115,38 @@ class C {
|
|
|
115
115
|
"wbr"
|
|
116
116
|
]), s = /<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu, i = [];
|
|
117
117
|
for (let r = s.exec(t); r; r = s.exec(t)) {
|
|
118
|
-
const [,
|
|
119
|
-
if (!(e.has(
|
|
120
|
-
if (
|
|
121
|
-
for (let
|
|
122
|
-
if (i[
|
|
123
|
-
i.splice(
|
|
118
|
+
const [, g, p, u] = r, a = p.toLowerCase();
|
|
119
|
+
if (!(e.has(a) || u === "/"))
|
|
120
|
+
if (g === "/") {
|
|
121
|
+
for (let c = i.length - 1; c >= 0; c--)
|
|
122
|
+
if (i[c].name === a) {
|
|
123
|
+
i.splice(c);
|
|
124
124
|
break;
|
|
125
125
|
}
|
|
126
126
|
} else
|
|
127
|
-
i.push({ name:
|
|
127
|
+
i.push({ name: a, index: r.index });
|
|
128
128
|
}
|
|
129
129
|
return i.length ? i[0].index : -1;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
function G(l) {
|
|
133
|
-
const t = new
|
|
133
|
+
const t = new x();
|
|
134
134
|
return t.push(l), t.finalize();
|
|
135
135
|
}
|
|
136
136
|
const Z = async (l) => await new Promise((t) => setTimeout(t, l));
|
|
137
137
|
async function* J(l, { chunkSize: t = 15, delay: e = 50 } = {}) {
|
|
138
|
-
const s = new
|
|
138
|
+
const s = new x();
|
|
139
139
|
for (let i = 0; i < l.length; i += t)
|
|
140
140
|
yield s.push(l.slice(i, i + t)), await Z(e);
|
|
141
141
|
yield s.finalize();
|
|
142
142
|
}
|
|
143
143
|
var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, f = (l, t, e, s) => {
|
|
144
|
-
for (var i = s > 1 ? void 0 : s ? Q(t, e) : t, r = l.length - 1,
|
|
145
|
-
(
|
|
144
|
+
for (var i = s > 1 ? void 0 : s ? Q(t, e) : t, r = l.length - 1, g; r >= 0; r--)
|
|
145
|
+
(g = l[r]) && (i = (s ? g(t, e, i) : g(i)) || i);
|
|
146
146
|
return s && i && K(t, e, i), i;
|
|
147
147
|
};
|
|
148
|
-
const
|
|
149
|
-
async function*
|
|
148
|
+
const P = (l) => !l || typeof l != "object" ? !1 : l.name === "AbortError";
|
|
149
|
+
async function* C(l, t, e, s, i = !1) {
|
|
150
150
|
if (i) {
|
|
151
151
|
if (s?.aborted) {
|
|
152
152
|
yield { type: "cancelled", log: e, runId: t };
|
|
@@ -205,8 +205,8 @@ let b = class extends H {
|
|
|
205
205
|
const s = [];
|
|
206
206
|
let i, r = "pending";
|
|
207
207
|
try {
|
|
208
|
-
const
|
|
209
|
-
for await (const p of
|
|
208
|
+
const g = this.orchestrator.ask(l, t);
|
|
209
|
+
for await (const p of g)
|
|
210
210
|
switch (r = p.runId, p.type) {
|
|
211
211
|
case "runtime": {
|
|
212
212
|
yield { type: "runtime", event: p, runId: r };
|
|
@@ -218,50 +218,50 @@ let b = class extends H {
|
|
|
218
218
|
}
|
|
219
219
|
case "completed": {
|
|
220
220
|
this._set("processing", !1), this._set("processingStep", "");
|
|
221
|
-
const
|
|
222
|
-
if (!
|
|
221
|
+
const u = p.result, a = !!u.content.length, c = !!i?.length;
|
|
222
|
+
if (!a && !c) {
|
|
223
223
|
yield { type: "completed", error: "No response received.", log: s, runId: r };
|
|
224
224
|
return;
|
|
225
225
|
}
|
|
226
|
-
const n =
|
|
227
|
-
if (yield { type: "block-start", blockType: "text", runId: r }, yield*
|
|
228
|
-
for (const
|
|
226
|
+
const n = u.content;
|
|
227
|
+
if (yield { type: "block-start", blockType: "text", runId: r }, yield* C(n, r, s, e, this.streamingDisabled), yield { type: "block-end", blockType: "text", runId: r }, c)
|
|
228
|
+
for (const o of i) {
|
|
229
229
|
if (e?.aborted) {
|
|
230
230
|
yield { type: "cancelled", log: s, runId: r };
|
|
231
231
|
return;
|
|
232
232
|
}
|
|
233
|
-
const { type:
|
|
234
|
-
if (yield { type: "block-start", blockType:
|
|
235
|
-
const
|
|
236
|
-
yield*
|
|
233
|
+
const { type: h, data: _ } = o;
|
|
234
|
+
if (yield { type: "block-start", blockType: h, runId: r }, h === "text") {
|
|
235
|
+
const v = typeof _?.content == "string" ? _.content : "";
|
|
236
|
+
yield* C(v, r, s, e, this.streamingDisabled);
|
|
237
237
|
} else
|
|
238
|
-
yield { type: "block-data", blockType:
|
|
239
|
-
yield { type: "block-end", blockType:
|
|
238
|
+
yield { type: "block-data", blockType: h, data: _, runId: r };
|
|
239
|
+
yield { type: "block-end", blockType: h, runId: r };
|
|
240
240
|
}
|
|
241
241
|
yield { type: "completed", response: n, blocks: i, log: s, runId: r };
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
case "ux-suggestion": {
|
|
245
|
-
const
|
|
246
|
-
i = i ? [...i,
|
|
245
|
+
const u = p.suggestion;
|
|
246
|
+
i = i ? [...i, u] : [u];
|
|
247
247
|
break;
|
|
248
248
|
}
|
|
249
249
|
case "interrupt": {
|
|
250
|
-
const { kind:
|
|
251
|
-
switch (
|
|
250
|
+
const { kind: u, message: a, metadata: c } = p.interrupt, n = Array.isArray(c) ? c.filter((h) => typeof h == "string") : [], o = (() => {
|
|
251
|
+
switch (u) {
|
|
252
252
|
case "booleanChoice":
|
|
253
|
-
return { type: "boolean-choice", message:
|
|
253
|
+
return { type: "boolean-choice", message: a, options: n };
|
|
254
254
|
case "singleSelection":
|
|
255
|
-
return { type: "single-select", message:
|
|
255
|
+
return { type: "single-select", message: a, options: n };
|
|
256
256
|
case "multipleSelection":
|
|
257
|
-
return { type: "multi-select", message:
|
|
257
|
+
return { type: "multi-select", message: a, options: n };
|
|
258
258
|
case "textInput":
|
|
259
|
-
return { type: "text-input", message:
|
|
259
|
+
return { type: "text-input", message: a };
|
|
260
260
|
default:
|
|
261
|
-
return { type:
|
|
261
|
+
return { type: u, message: a, options: n };
|
|
262
262
|
}
|
|
263
263
|
})();
|
|
264
|
-
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload:
|
|
264
|
+
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: o, runId: r };
|
|
265
265
|
break;
|
|
266
266
|
}
|
|
267
267
|
case "cancelled": {
|
|
@@ -269,7 +269,7 @@ let b = class extends H {
|
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
271
|
case "error": {
|
|
272
|
-
if (e?.aborted ||
|
|
272
|
+
if (e?.aborted || P(p.error)) {
|
|
273
273
|
yield { type: "cancelled", log: s, runId: r };
|
|
274
274
|
return;
|
|
275
275
|
}
|
|
@@ -281,12 +281,12 @@ let b = class extends H {
|
|
|
281
281
|
break;
|
|
282
282
|
}
|
|
283
283
|
}
|
|
284
|
-
} catch (
|
|
285
|
-
if (e?.aborted ||
|
|
284
|
+
} catch (g) {
|
|
285
|
+
if (e?.aborted || P(g)) {
|
|
286
286
|
yield { type: "cancelled", log: s, runId: r };
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
|
-
console.warn("Error during message processing:",
|
|
289
|
+
console.warn("Error during message processing:", g), yield { type: "completed", error: "An error occurred during message processing.", log: s, runId: "error" };
|
|
290
290
|
return;
|
|
291
291
|
} finally {
|
|
292
292
|
this._set("processing", !1);
|
|
@@ -297,31 +297,31 @@ let b = class extends H {
|
|
|
297
297
|
}
|
|
298
298
|
};
|
|
299
299
|
f([
|
|
300
|
-
|
|
300
|
+
y({ readOnly: !0 })
|
|
301
301
|
], b.prototype, "orchestrator", 2);
|
|
302
302
|
f([
|
|
303
|
-
|
|
303
|
+
y()
|
|
304
304
|
], b.prototype, "agents", 2);
|
|
305
305
|
f([
|
|
306
|
-
|
|
306
|
+
y()
|
|
307
307
|
], b.prototype, "portal", 2);
|
|
308
308
|
f([
|
|
309
|
-
|
|
309
|
+
y()
|
|
310
310
|
], b.prototype, "view", 2);
|
|
311
311
|
f([
|
|
312
|
-
|
|
312
|
+
y()
|
|
313
313
|
], b.prototype, "streamingDisabled", 2);
|
|
314
314
|
f([
|
|
315
|
-
|
|
315
|
+
y()
|
|
316
316
|
], b.prototype, "runtimeEventsEnabled", 2);
|
|
317
317
|
f([
|
|
318
|
-
|
|
318
|
+
y({ readOnly: !0 })
|
|
319
319
|
], b.prototype, "loading", 2);
|
|
320
320
|
f([
|
|
321
|
-
|
|
321
|
+
y({ readOnly: !0 })
|
|
322
322
|
], b.prototype, "processing", 2);
|
|
323
323
|
f([
|
|
324
|
-
|
|
324
|
+
y({ readOnly: !0 })
|
|
325
325
|
], b.prototype, "processingStep", 2);
|
|
326
326
|
b = f([
|
|
327
327
|
V("OrchestratorController")
|
|
@@ -329,7 +329,7 @@ b = f([
|
|
|
329
329
|
const X = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", Y = "Embeddings not found for this web map.", tt = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
|
|
330
330
|
class et extends B {
|
|
331
331
|
constructor() {
|
|
332
|
-
super(...arguments), this._messages = q({ blocking: !0 }), this.#t =
|
|
332
|
+
super(...arguments), this._messages = q({ blocking: !0 }), this.#t = E(), this.#o = E(), this.#i = E(), this.#e = null, this.#r = /* @__PURE__ */ new Map(), this.#s = U.getDefault(), this.#a = (t) => {
|
|
333
333
|
t.stopPropagation(), this.cancelInterrupt();
|
|
334
334
|
}, this.#n = (t) => {
|
|
335
335
|
t.stopPropagation();
|
|
@@ -421,31 +421,32 @@ class et extends B {
|
|
|
421
421
|
id: Date.now().toString(),
|
|
422
422
|
// TODO: Replace with a more robust ID generation method or get from orchestrator
|
|
423
423
|
role: "user",
|
|
424
|
-
content: e?.displayText?.trim() || s || i.map((
|
|
424
|
+
content: e?.displayText?.trim() || s || i.map((a) => this.#f(a)).join(" "),
|
|
425
425
|
parts: i
|
|
426
426
|
}), !this._orchestratorController))
|
|
427
427
|
return;
|
|
428
428
|
this.#e = new AbortController(), this._orchestratorController.streamingDisabled = this.streamingDisabled;
|
|
429
|
-
const r = this.#m(i),
|
|
429
|
+
const r = this.#m(i), g = this._messages._t9nLocale || "en", p = {
|
|
430
430
|
...e?.parts ? { inputParts: e.parts } : {},
|
|
431
|
-
...r ? { routing: "direct", agentId: r } : { routing: "auto", agentIds: this.allowedAgentIds }
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
431
|
+
...r ? { routing: "direct", agentId: r } : { routing: "auto", agentIds: this.allowedAgentIds },
|
|
432
|
+
locale: g
|
|
433
|
+
}, u = this._orchestratorController.ask(s, p, this.#e?.signal);
|
|
434
|
+
for await (const a of u) {
|
|
435
|
+
const c = a.runId, n = this.messages.at(-1);
|
|
436
|
+
switch (a.type) {
|
|
436
437
|
case "runtime":
|
|
437
|
-
this.arcgisRuntime.emit(
|
|
438
|
+
this.arcgisRuntime.emit(a.event);
|
|
438
439
|
break;
|
|
439
440
|
case "block-start": {
|
|
440
441
|
this._isAnswering = !0;
|
|
441
|
-
const
|
|
442
|
-
if (
|
|
443
|
-
const
|
|
444
|
-
this.messages.splice(-1, 1, { ...
|
|
442
|
+
const o = { type: a.blockType, isPending: !0 };
|
|
443
|
+
if (n?.role === "assistant" && n.id === c) {
|
|
444
|
+
const h = [...n.blocks ?? [], o];
|
|
445
|
+
this.messages.splice(-1, 1, { ...n, blocks: h });
|
|
445
446
|
} else
|
|
446
447
|
this.messages.push({
|
|
447
448
|
role: "assistant",
|
|
448
|
-
blocks: [
|
|
449
|
+
blocks: [o],
|
|
449
450
|
id: c,
|
|
450
451
|
isStreaming: !0,
|
|
451
452
|
interrupts: this._interruptDetails
|
|
@@ -453,58 +454,58 @@ class et extends B {
|
|
|
453
454
|
break;
|
|
454
455
|
}
|
|
455
456
|
case "block-data": {
|
|
456
|
-
if (
|
|
457
|
+
if (n?.role !== "assistant" || n?.id !== c)
|
|
457
458
|
break;
|
|
458
|
-
const
|
|
459
|
-
if (
|
|
459
|
+
const o = [...n.blocks ?? []], h = o[o.length - 1], { blockType: _, data: v } = a;
|
|
460
|
+
if (h?.type !== _ || !h.isPending)
|
|
460
461
|
break;
|
|
461
|
-
|
|
462
|
-
...
|
|
462
|
+
_ === "text" ? o[o.length - 1] = {
|
|
463
|
+
...h,
|
|
463
464
|
data: {
|
|
464
|
-
...
|
|
465
|
-
parts:
|
|
465
|
+
...h.data,
|
|
466
|
+
parts: v?.parts
|
|
466
467
|
}
|
|
467
|
-
} :
|
|
468
|
+
} : o[o.length - 1] = { ...h, data: { ...h.data, ...v ?? {} } }, this.messages.splice(-1, 1, { ...n, blocks: o });
|
|
468
469
|
break;
|
|
469
470
|
}
|
|
470
471
|
case "block-end": {
|
|
471
|
-
if (
|
|
472
|
+
if (n?.role !== "assistant" || n?.id !== c)
|
|
472
473
|
break;
|
|
473
|
-
const
|
|
474
|
-
if (
|
|
474
|
+
const o = [...n.blocks ?? []], h = o[o.length - 1];
|
|
475
|
+
if (h?.type !== a.blockType || !h.isPending)
|
|
475
476
|
break;
|
|
476
|
-
const
|
|
477
|
-
|
|
477
|
+
const _ = h;
|
|
478
|
+
o[o.length - 1] = { ..._, data: { ..._.data }, isPending: !1 }, this.messages.splice(-1, 1, { ...n, blocks: o });
|
|
478
479
|
break;
|
|
479
480
|
}
|
|
480
481
|
case "completed":
|
|
481
|
-
|
|
482
|
+
a.error ? (this.messages.push({
|
|
482
483
|
role: "assistant",
|
|
483
|
-
log:
|
|
484
|
-
error:
|
|
484
|
+
log: a.log,
|
|
485
|
+
error: a.error,
|
|
485
486
|
id: c,
|
|
486
487
|
interrupts: this._interruptDetails
|
|
487
|
-
}), this._interruptDetails = []) :
|
|
488
|
-
...
|
|
489
|
-
content:
|
|
490
|
-
blocks:
|
|
488
|
+
}), this._interruptDetails = []) : n?.role === "assistant" && n.id === c && this.messages.splice(-1, 1, {
|
|
489
|
+
...n,
|
|
490
|
+
content: a.response,
|
|
491
|
+
blocks: n.blocks?.map((o) => ({ ...o, data: { ...o.data }, isPending: !1 })) ?? [],
|
|
491
492
|
isStreaming: !1,
|
|
492
|
-
log:
|
|
493
|
+
log: a.log
|
|
493
494
|
}), this._isAnswering = !1, this.#e = null, this._canceling = !1;
|
|
494
495
|
break;
|
|
495
496
|
case "interrupt":
|
|
496
|
-
this._interrupt = { ...
|
|
497
|
+
this._interrupt = { ...a.payload, id: c }, this.arcgisInterrupt.emit(this._interrupt);
|
|
497
498
|
break;
|
|
498
499
|
case "cancelled":
|
|
499
|
-
|
|
500
|
-
...
|
|
501
|
-
blocks:
|
|
500
|
+
n?.role === "assistant" && n.id === c ? this.messages.splice(-1, 1, {
|
|
501
|
+
...n,
|
|
502
|
+
blocks: n.blocks?.filter((o) => o.type === "text" || !o.isPending) ?? [],
|
|
502
503
|
isStreaming: !1,
|
|
503
|
-
log:
|
|
504
|
+
log: a.log,
|
|
504
505
|
error: `(${this._messages.stoppedByUserLabel})`
|
|
505
506
|
}) : (this.messages.push({
|
|
506
507
|
role: "assistant",
|
|
507
|
-
log:
|
|
508
|
+
log: a.log,
|
|
508
509
|
error: `(${this._messages.stoppedByUserLabel})`,
|
|
509
510
|
id: c,
|
|
510
511
|
interrupts: this._interruptDetails
|
|
@@ -553,7 +554,7 @@ class et extends B {
|
|
|
553
554
|
return this._submissionError = s ? this._messages.multipleCommands : !t.trim() && e.length > 0 && !this.#m(e) ? this._messages.partsOnlyRequiresAgent : null, this._submissionError ? (this.arcgisError.emit(new Error(this._submissionError)), !1) : !0;
|
|
554
555
|
}
|
|
555
556
|
async #_() {
|
|
556
|
-
await
|
|
557
|
+
await S.checkSignInStatus(this.#s.url);
|
|
557
558
|
const t = await this.#s.load();
|
|
558
559
|
if (!t.helperServices?.aiAssistantServices?.url)
|
|
559
560
|
throw new Error(this._messages.serviceUrlNotAvailableMessage);
|
|
@@ -588,24 +589,24 @@ class et extends B {
|
|
|
588
589
|
this._orchestratorController?.cancel(), this.#e?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._submissionError = null, this._inputValue = "", this._signedInUserId = void 0;
|
|
589
590
|
}
|
|
590
591
|
_renderEntryMessage() {
|
|
591
|
-
return this._isSignedIn ? this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null :
|
|
592
|
+
return this._isSignedIn ? this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : d`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : d`<slot name=entry-message></slot>` : this._renderSignInNotice();
|
|
592
593
|
}
|
|
593
594
|
_renderSignInNotice() {
|
|
594
595
|
const t = this.#s;
|
|
595
|
-
return
|
|
596
|
+
return d`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${t ? d`<calcite-link slot=link @click=${async () => {
|
|
596
597
|
try {
|
|
597
|
-
const e = await
|
|
598
|
+
const e = await S.getCredential(`${t.url}/sharing`);
|
|
598
599
|
this._signedInUserId = e.userId, this._error = null, this.requestUpdate(), await this.#p();
|
|
599
600
|
} catch (e) {
|
|
600
601
|
this._error = e?.message ?? this._messages.signInErrorMessage, this.arcgisError.emit(new Error(this._error)), z.log("error", this, "Error signing in:", { detail: { error: e } });
|
|
601
602
|
}
|
|
602
|
-
}} target=_blank title=${this._messages.signInToArcGISOnlineLabel ??
|
|
603
|
+
}} target=_blank title=${this._messages.signInToArcGISOnlineLabel ?? w}>${this._messages.signInLabel}</calcite-link>` : d`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`;
|
|
603
604
|
}
|
|
604
605
|
_renderErrorNotice() {
|
|
605
|
-
return this._error ?
|
|
606
|
+
return this._error ? d`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error === X ? d`<div slot=message>${Y}</div><calcite-link slot=link .href=${tt} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel ?? w}>${this._messages.readMoreLabel}</calcite-link>` : d`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
|
|
606
607
|
}
|
|
607
608
|
render() {
|
|
608
|
-
return
|
|
609
|
+
return d`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${k(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" ? d`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#u} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((e, s) => d`<slot name=${A(t.id, s) ?? w} slot=${A(t.id, s) ?? w}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : d`<arcgis-assistant-user-message .message=${t} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt ? d`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>` : d`<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 ? d`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${k(this.#i)}></arcgis-assistant-interrupt></slot>` : this.suggestedPrompts?.length ? d`<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()}${this._submissionError ? d`<div role=alert>${this._submissionError}</div>` : null}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse || this._isAnswering} .commandProvider=${this.commandProvider} .entityProviders=${this.entityProviders} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling || !this._isSignedIn || !!this._interrupt || !!this._error} ${k(this.#o)}><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=${() => {
|
|
609
610
|
this.#o.value?.submitMessage();
|
|
610
611
|
}} 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>`;
|
|
611
612
|
}
|
|
@@ -23,6 +23,7 @@ import "@arcgis/toolkit/string";
|
|
|
23
23
|
import "../../chunks/generateLayerDescriptions.js";
|
|
24
24
|
import "@langchain/core/messages";
|
|
25
25
|
import "@langchain/core/callbacks/dispatch/web";
|
|
26
|
+
import "@arcgis/toolkit/intl";
|
|
26
27
|
import "@langchain/core/callbacks/base";
|
|
27
28
|
import "@langchain/openai";
|
|
28
29
|
import "@arcgis/core/config.js";
|
|
@@ -11,6 +11,7 @@ import "@arcgis/toolkit/string";
|
|
|
11
11
|
import "../../chunks/generateLayerDescriptions.js";
|
|
12
12
|
import "@langchain/core/messages";
|
|
13
13
|
import "@langchain/core/callbacks/dispatch/web";
|
|
14
|
+
import "@arcgis/toolkit/intl";
|
|
14
15
|
import "@langchain/core/callbacks/base";
|
|
15
16
|
import "@langchain/openai";
|
|
16
17
|
import "@arcgis/core/config.js";
|
|
@@ -11,6 +11,7 @@ import "@arcgis/toolkit/string";
|
|
|
11
11
|
import "../../chunks/generateLayerDescriptions.js";
|
|
12
12
|
import "@langchain/core/messages";
|
|
13
13
|
import "@langchain/core/callbacks/dispatch/web";
|
|
14
|
+
import "@arcgis/toolkit/intl";
|
|
14
15
|
import "@langchain/core/callbacks/base";
|
|
15
16
|
import "@langchain/openai";
|
|
16
17
|
import "@arcgis/core/config.js";
|
|
@@ -11,6 +11,7 @@ import "@arcgis/toolkit/string";
|
|
|
11
11
|
import "../../chunks/generateLayerDescriptions.js";
|
|
12
12
|
import "@langchain/core/messages";
|
|
13
13
|
import "@langchain/core/callbacks/dispatch/web";
|
|
14
|
+
import "@arcgis/toolkit/intl";
|
|
14
15
|
import "@langchain/core/callbacks/base";
|
|
15
16
|
import "@langchain/openai";
|
|
16
17
|
import "@arcgis/core/config.js";
|
|
@@ -40,8 +41,8 @@ import "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
|
|
|
40
41
|
import "@arcgis/core/smartMapping/statistics/uniqueValues.js";
|
|
41
42
|
import "../../agents/tools/help/listFields/adapter.js";
|
|
42
43
|
import { A as o } from "../../chunks/arcgisKnowledgeGraph.js";
|
|
43
|
-
import { a as s, i as
|
|
44
|
-
import { fetchKnowledgeGraph as
|
|
44
|
+
import { a as s, i as p } from "../../chunks/utils2.js";
|
|
45
|
+
import { fetchKnowledgeGraph as n } from "@arcgis/core/rest/knowledgeGraphService.js";
|
|
45
46
|
class m extends e {
|
|
46
47
|
constructor() {
|
|
47
48
|
super(...arguments), this.agent = o;
|
|
@@ -78,10 +79,10 @@ class m extends e {
|
|
|
78
79
|
return this.context;
|
|
79
80
|
}
|
|
80
81
|
willUpdate(t) {
|
|
81
|
-
t.has("serviceUrl") && this.serviceUrl ? this.#t =
|
|
82
|
+
t.has("serviceUrl") && this.serviceUrl ? this.#t = n(this.serviceUrl) : this.#t = void 0;
|
|
82
83
|
}
|
|
83
84
|
load() {
|
|
84
|
-
this.#i = s(this) ?? void 0, this.#e =
|
|
85
|
+
this.#i = s(this) ?? void 0, this.#e = p(this);
|
|
85
86
|
}
|
|
86
87
|
disconnectedCallback() {
|
|
87
88
|
this.#e?.unregister(this.agent.id), super.disconnectedCallback();
|
|
@@ -11,6 +11,7 @@ import "@arcgis/toolkit/string";
|
|
|
11
11
|
import "../../chunks/generateLayerDescriptions.js";
|
|
12
12
|
import "@langchain/core/messages";
|
|
13
13
|
import "@langchain/core/callbacks/dispatch/web";
|
|
14
|
+
import "@arcgis/toolkit/intl";
|
|
14
15
|
import "@langchain/core/callbacks/base";
|
|
15
16
|
import "@langchain/openai";
|
|
16
17
|
import "@arcgis/core/config.js";
|
|
@@ -11,6 +11,7 @@ import "@arcgis/toolkit/string";
|
|
|
11
11
|
import "../../chunks/generateLayerDescriptions.js";
|
|
12
12
|
import "@langchain/core/messages";
|
|
13
13
|
import "@langchain/core/callbacks/dispatch/web";
|
|
14
|
+
import "@arcgis/toolkit/intl";
|
|
14
15
|
import "@langchain/core/callbacks/base";
|
|
15
16
|
import "@langchain/openai";
|
|
16
17
|
import "@arcgis/core/config.js";
|