@arcgis/ai-components 5.1.0-next.20 → 5.1.0-next.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cdn/{LKI5DI3H.js → 4GZDQE56.js} +1 -1
- package/dist/cdn/{7X4WODN4.js → 7UC775RA.js} +1 -1
- package/dist/cdn/{DARXCM4F.js → C3VBX534.js} +1 -1
- package/dist/cdn/{XWE57GB7.js → ENDNSNQH.js} +1 -1
- package/dist/cdn/{E77IJ3SU.js → F2UO6SO4.js} +61 -61
- package/dist/cdn/{2YSKWJQE.js → L7XZIZCR.js} +1 -1
- package/dist/cdn/LZ7ZI65E.js +2 -0
- package/dist/cdn/{EH66ASBE.js → PTDPFR7R.js} +3 -3
- package/dist/cdn/{ARLFZJO5.js → VDUOWASW.js} +2 -0
- package/dist/cdn/{2XALI4ZK.js → XKAASU5X.js} +1 -1
- package/dist/cdn/{GC556G6M.js → Z6ZNHTPJ.js} +2 -0
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-assistant/customElement.d.ts +25 -8
- package/dist/components/arcgis-assistant/customElement.js +29 -25
- package/dist/components/arcgis-assistant/index.js +2 -1
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +12 -2
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.d.ts +5 -0
- package/dist/components/arcgis-assistant-help-agent/customElement.d.ts +7 -3
- package/dist/components/arcgis-assistant-navigation-agent/customElement.d.ts +10 -5
- 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.d.ts +11 -7
- package/package.json +6 -6
- package/dist/cdn/I5KOHNUY.js +0 -2
- package/dist/cdn/utils.js +0 -2
- /package/dist/{utils.js → utils/index.js} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
2
|
import { c as _ } from "../../chunks/runtime.js";
|
|
3
|
-
import { css as
|
|
4
|
-
import
|
|
3
|
+
import { css as b, html as p } from "lit";
|
|
4
|
+
import v from "@arcgis/core/core/Collection.js";
|
|
5
5
|
import { whenOnce as w, watch as E, when as C } from "@arcgis/core/core/reactiveUtils.js";
|
|
6
6
|
import k from "@arcgis/core/portal/Portal.js";
|
|
7
7
|
import { LitElement as $, createEvent as n } from "@arcgis/lumina";
|
|
@@ -10,13 +10,13 @@ import { Orchestrator as S } from "@arcgis/ai-orchestrator";
|
|
|
10
10
|
import L from "@arcgis/core/core/Accessor.js";
|
|
11
11
|
import { property as h, subclass as P } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
12
12
|
import { g as I } from "../../chunks/utils2.js";
|
|
13
|
-
import { u as
|
|
14
|
-
import { rethrowError as
|
|
15
|
-
const
|
|
16
|
-
var
|
|
13
|
+
import { u as M } from "../../chunks/useT9n.js";
|
|
14
|
+
import { rethrowError as O } from "@arcgis/toolkit/log";
|
|
15
|
+
const R = b`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%)}`;
|
|
16
|
+
var x = Object.defineProperty, A = Object.getOwnPropertyDescriptor, l = (c, e, t, i) => {
|
|
17
17
|
for (var s = i > 1 ? void 0 : i ? A(e, t) : e, r = c.length - 1, o; r >= 0; r--)
|
|
18
18
|
(o = c[r]) && (s = (i ? o(e, t, s) : o(s)) || s);
|
|
19
|
-
return i && s &&
|
|
19
|
+
return i && s && x(e, t, s), s;
|
|
20
20
|
};
|
|
21
21
|
let a = class extends L {
|
|
22
22
|
constructor(c) {
|
|
@@ -78,18 +78,18 @@ let a = class extends L {
|
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
80
|
case "interrupt": {
|
|
81
|
-
const { kind: o, message:
|
|
81
|
+
const { kind: o, message: g, metadata: d } = s.interrupt, u = Array.isArray(d) ? [...d] : [], f = (() => {
|
|
82
82
|
switch (o) {
|
|
83
83
|
case "booleanChoice":
|
|
84
|
-
return { type: "boolean-choice", message:
|
|
84
|
+
return { type: "boolean-choice", message: g, options: u };
|
|
85
85
|
case "singleSelection":
|
|
86
|
-
return { type: "single-select", message:
|
|
86
|
+
return { type: "single-select", message: g, options: u };
|
|
87
87
|
case "multipleSelection":
|
|
88
|
-
return { type: "multi-select", message:
|
|
88
|
+
return { type: "multi-select", message: g, options: u };
|
|
89
89
|
case "textInput":
|
|
90
|
-
return { type: "text-input", message:
|
|
90
|
+
return { type: "text-input", message: g };
|
|
91
91
|
default:
|
|
92
|
-
return { type: o, message:
|
|
92
|
+
return { type: o, message: g, options: u };
|
|
93
93
|
}
|
|
94
94
|
})();
|
|
95
95
|
this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: f, runId: r };
|
|
@@ -141,9 +141,10 @@ l([
|
|
|
141
141
|
a = l([
|
|
142
142
|
P("OrchestratorController")
|
|
143
143
|
], a);
|
|
144
|
-
|
|
144
|
+
const z = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", H = "Embeddings not found for this web map.", j = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
|
|
145
|
+
class D extends $ {
|
|
145
146
|
constructor() {
|
|
146
|
-
super(...arguments), this._messages =
|
|
147
|
+
super(...arguments), this._messages = M({ blocking: !0 }), this.#e = m(), this.#t = m(), this.#s = null, this.#o = /* @__PURE__ */ new Map(), this.#r = k.getDefault(), this.#i = (e) => {
|
|
147
148
|
e.stopPropagation(), this.arcgisInterruptCancel.emit(), this.orchestrator?.cancelInterrupt(), this._interrupt = null;
|
|
148
149
|
}, this.#a = (e) => {
|
|
149
150
|
e.stopPropagation();
|
|
@@ -163,13 +164,13 @@ class z extends $ {
|
|
|
163
164
|
e.stopPropagation();
|
|
164
165
|
const t = e.detail;
|
|
165
166
|
this.arcgisFeedback.emit(t);
|
|
166
|
-
}, this._orchestratorController = null, this._interrupt = null, this._error = null, this.messages = new
|
|
167
|
+
}, this._orchestratorController = null, this._interrupt = null, this._error = null, this.messages = new v([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.logEnabled = !1, this.copyEnabled = !1, this.arcgisCancel = n(), this.arcgisError = n(), this.arcgisFeedback = n(), this.arcgisInterrupt = n(), this.arcgisInterruptCancel = n(), this.arcgisInterruptSubmit = n(), this.arcgisReady = n(), this.arcgisSubmit = n();
|
|
167
168
|
}
|
|
168
169
|
static {
|
|
169
170
|
this.properties = { _orchestratorController: 16, _interrupt: 16, _error: 16, _user: 16, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, logEnabled: 5, copyEnabled: 5 };
|
|
170
171
|
}
|
|
171
172
|
static {
|
|
172
|
-
this.styles =
|
|
173
|
+
this.styles = R;
|
|
173
174
|
}
|
|
174
175
|
#e;
|
|
175
176
|
#t;
|
|
@@ -192,7 +193,7 @@ class z extends $ {
|
|
|
192
193
|
view: e?.view
|
|
193
194
|
}), await this._orchestratorController.load(), !0) : (this._error = "No agents found.", !1);
|
|
194
195
|
} catch (e) {
|
|
195
|
-
return this._error = e?.message ?? "Error initializing orchestrator.",
|
|
196
|
+
return this._error = e?.message ?? "Error initializing orchestrator.", O(this)(e), !1;
|
|
196
197
|
}
|
|
197
198
|
}
|
|
198
199
|
get _user() {
|
|
@@ -201,12 +202,12 @@ class z extends $ {
|
|
|
201
202
|
get orchestrator() {
|
|
202
203
|
return this._orchestratorController?.orchestrator;
|
|
203
204
|
}
|
|
204
|
-
register(e) {
|
|
205
|
-
this.#o.set(e.agent.id, e);
|
|
206
|
-
}
|
|
207
205
|
async clearChatHistory() {
|
|
208
206
|
this._reset(), this._orchestratorController?.clearChatHistory();
|
|
209
207
|
}
|
|
208
|
+
register(e) {
|
|
209
|
+
this.#o.set(e.agent.id, e);
|
|
210
|
+
}
|
|
210
211
|
async submitMessage(e) {
|
|
211
212
|
const t = e.trim();
|
|
212
213
|
if (!t || (this.messages.push({
|
|
@@ -254,7 +255,7 @@ class z extends $ {
|
|
|
254
255
|
});
|
|
255
256
|
return queueMicrotask(() => {
|
|
256
257
|
this.#h().then((t) => {
|
|
257
|
-
t ? this.arcgisReady.emit() : this.arcgisError.emit(new Error(this._error
|
|
258
|
+
t ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
|
|
258
259
|
});
|
|
259
260
|
}), () => {
|
|
260
261
|
e.remove(), this.#t.value?.removeEventListener("arcgisSubmit", this.#a), this.#t.value?.removeEventListener("arcgisCancel", this.#i), this.#e.value?.removeEventListener("arcgisSubmit", this.#n), this.#e.value?.removeEventListener("arcgisCancel", this.#l), this.#e.value?.removeEventListener("arcgisFeedback", this.#c), this._orchestratorController?.destroy(), this._orchestratorController = null;
|
|
@@ -264,11 +265,14 @@ class z extends $ {
|
|
|
264
265
|
_reset() {
|
|
265
266
|
this.#s?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null;
|
|
266
267
|
}
|
|
268
|
+
_renderErrorNotice() {
|
|
269
|
+
return this._error ? p`<calcite-notice closable slot=entry-message open kind=danger icon width=full>${this._error === z ? p`<div slot=message>${H}</div><calcite-link slot=link .href=${j} target=_blank title="Learn about web map embeddings">Read more</calcite-link>` : p`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
|
|
270
|
+
}
|
|
267
271
|
render() {
|
|
268
|
-
return
|
|
272
|
+
return p`<arcgis-assistant-shell .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} .entryMessage=${this.entryMessage} .entryMessageClosed=${this.messages.length > 0} .awaitingResponse=${this._orchestratorController?.processing} .suggestedPrompts=${this.suggestedPrompts} .messages=${this.messages} ${y(this.#e)}>${this._renderErrorNotice()}${this._interrupt ? p`<arcgis-assistant-interrupt slot=entry-message .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${y(this.#t)}></arcgis-assistant-interrupt>` : null}<arcgis-assistant-chat .loading=${this._orchestratorController?.processing} .loadingMessage=${this._orchestratorController?.processingStep || ""} .messages=${this.messages} .user=${this._user} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled}><slot></slot></arcgis-assistant-chat><slot name=header-actions-end slot=header-actions-end></slot>${this.entryMessage ? null : p`<slot name=entry-message slot=entry-message></slot>`}<slot name=entry-actions-start slot=entry-actions-start></slot><slot name=footer-content slot=footer-content></slot></arcgis-assistant-shell>`;
|
|
269
273
|
}
|
|
270
274
|
}
|
|
271
|
-
_("arcgis-assistant",
|
|
275
|
+
_("arcgis-assistant", D);
|
|
272
276
|
export {
|
|
273
|
-
|
|
277
|
+
D as ArcgisAssistant
|
|
274
278
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import "../arcgis-assistant-shell/index.js";
|
|
2
1
|
import "@esri/calcite-components/components/calcite-notice";
|
|
2
|
+
import "@esri/calcite-components/components/calcite-link";
|
|
3
|
+
import "../arcgis-assistant-shell/index.js";
|
|
3
4
|
import "../arcgis-assistant-interrupt/index.js";
|
|
4
5
|
import "../arcgis-assistant-chat/index.js";
|
|
5
6
|
export * from "./customElement.js";
|
|
@@ -14,6 +14,9 @@ import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
|
14
14
|
* Use the [utils](https://developers.arcgis.com/javascript/latest/references/ai-components/utils/index/) module for helper functions and types related to building custom agents, including the `AgentRegistration`
|
|
15
15
|
* type and functions for making LLM calls, managing agent state, and setting up human-in-the-loop workflows.
|
|
16
16
|
*
|
|
17
|
+
* > We recommend that developers building custom agents have experience working with LLMs and generative AI, and have a good
|
|
18
|
+
* understanding of the limitations of these technologies when building applications for end users.
|
|
19
|
+
*
|
|
17
20
|
* This is an unrendered component that must be added as a child of the `arcgis-assistant` component in either HTML or JavaScript.
|
|
18
21
|
*
|
|
19
22
|
* ```html
|
|
@@ -45,7 +48,12 @@ import type { PublicLitElement as LitElement } from "@arcgis/lumina";
|
|
|
45
48
|
* @beta
|
|
46
49
|
* @see [arcgis-assistant](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/)
|
|
47
50
|
* @see [LangGraph documentation](https://docs.langchain.com/oss/javascript/langgraph/overview)
|
|
48
|
-
* @see [Custom
|
|
51
|
+
* @see [Custom agents guide](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-custom-agents/)
|
|
52
|
+
* @see [AI Assistant component sample](https://developers.arcgis.com/javascript/latest/sample-code/ai-assistant/)
|
|
53
|
+
* @see [AgentRegistration](https://developers.arcgis.com/javascript/latest/references/ai-components/utils/index/#AgentRegistration)
|
|
54
|
+
* @see [invokeStructuredPrompt](https://developers.arcgis.com/javascript/latest/references/ai-components/utils/index/#invokeStructuredPrompt)
|
|
55
|
+
* @see [invokeToolPrompt](https://developers.arcgis.com/javascript/latest/references/ai-components/utils/index/#invokeToolPrompt)
|
|
56
|
+
* @see [invokeTextPrompt](https://developers.arcgis.com/javascript/latest/references/ai-components/utils/index/#invokeTextPrompt)
|
|
49
57
|
*/
|
|
50
58
|
export abstract class ArcgisAssistantAgent<TContext = Record<string, unknown>> extends LitElement {
|
|
51
59
|
/**
|
|
@@ -56,10 +64,12 @@ export abstract class ArcgisAssistantAgent<TContext = Record<string, unknown>> e
|
|
|
56
64
|
* This is an agent defined in the client and can be invoked by the assistant from the browser to perform specific tasks
|
|
57
65
|
* using functions defined in the client.
|
|
58
66
|
*
|
|
59
|
-
* See the [Custom Agents guide](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-custom-agents/) for more instructions
|
|
67
|
+
* See the [Custom Agents guide](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-custom-agents/) for more instructions
|
|
68
|
+
* and links to samples demonstrating how to create custom agents.
|
|
60
69
|
*
|
|
61
70
|
* @required
|
|
62
71
|
* @see [LangGraph documentation](https://docs.langchain.com/oss/javascript/langgraph/overview)
|
|
72
|
+
* @see [Custom agents guide](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-custom-agents/)
|
|
63
73
|
* @example
|
|
64
74
|
* ```js
|
|
65
75
|
* // An example graph that updates a component property and replies with a confirmation message
|
|
@@ -70,9 +70,14 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
70
70
|
* - "Show me the population of cities in this map on a graph." (the data exploration agent can only
|
|
71
71
|
* provide answers in text form, not visualizations)
|
|
72
72
|
*
|
|
73
|
+
* > Due to the non-deterministic nature of generative AI, there may be inaccuracies or unexpected behavior when using the
|
|
74
|
+
* out-of-the-box agents.
|
|
75
|
+
*
|
|
73
76
|
* @since 5.0
|
|
74
77
|
* @beta
|
|
75
78
|
* @see [arcgis-assistant](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/)
|
|
79
|
+
* @see [Intro to building agentic mapping applications](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-introduction/)
|
|
80
|
+
* @see [AI Assistant component sample](https://developers.arcgis.com/javascript/latest/sample-code/ai-assistant/)
|
|
76
81
|
*/
|
|
77
82
|
export abstract class ArcgisAssistantDataExplorationAgent extends LitElement {
|
|
78
83
|
/**
|
|
@@ -32,8 +32,7 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
32
32
|
*
|
|
33
33
|
* - "What kind of questions can I ask?"
|
|
34
34
|
* - "What layers are in this map?"
|
|
35
|
-
* - "What
|
|
36
|
-
* - "How do I use the navigation agent?"
|
|
35
|
+
* - "What kind of data can I ask questions about?"
|
|
37
36
|
*
|
|
38
37
|
* The following are examples of the types of questions that fall outside the bounds of the
|
|
39
38
|
* help agent and should therefore be avoided:
|
|
@@ -43,14 +42,19 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
43
42
|
* - "How do I bake a cake?"
|
|
44
43
|
* - "How does map navigation work in ArcGIS?"
|
|
45
44
|
*
|
|
45
|
+
* > Due to the non-deterministic nature of generative AI, there may be inaccuracies or unexpected behavior when using the
|
|
46
|
+
* out-of-the-box agents.
|
|
47
|
+
*
|
|
46
48
|
* @since 5.0
|
|
47
49
|
* @beta
|
|
48
50
|
* @see [arcgis-assistant](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/)
|
|
51
|
+
* @see [Intro to building agentic mapping applications](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-introduction/)
|
|
52
|
+
* @see [AI Assistant component sample](https://developers.arcgis.com/javascript/latest/sample-code/ai-assistant/)
|
|
49
53
|
*/
|
|
50
54
|
export abstract class ArcgisAssistantHelpAgent extends LitElement {
|
|
51
55
|
/**
|
|
52
56
|
* The reference element to the map that provides context for the help agent. Currently,
|
|
53
|
-
* this is only scoped to `arcgis-map` elements. This shows the help agent which
|
|
57
|
+
* this is only scoped to `arcgis-map` elements. This shows the help agent which map for which to
|
|
54
58
|
* provide assistance. This allows users to ask questions about the specific map provided to the agent.
|
|
55
59
|
*
|
|
56
60
|
* Setting this property is not necessary if you set the reference element on the parent
|
|
@@ -27,11 +27,11 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
27
27
|
*
|
|
28
28
|
* The navigation agent provides the following capabilities related to map navigation:
|
|
29
29
|
*
|
|
30
|
-
* - **Geocoding** - Navigate to an address using Esri's World Geocoding Service
|
|
30
|
+
* - **Geocoding** - Navigate to an address using Esri's World Geocoding Service.
|
|
31
31
|
* - **Go to extent** - Navigate to the extent of a bookmark in the map, the home extent of the web map,
|
|
32
32
|
* or the extent of a layer.
|
|
33
|
-
* - **Go to features** -
|
|
34
|
-
* - **Go to viewpoint** -
|
|
33
|
+
* - **Go to features** - Navigate to a specified feature or set of features.
|
|
34
|
+
* - **Go to viewpoint** - Navigate to a specified viewpoint, which can include center, zoom, and/or
|
|
35
35
|
* rotation.
|
|
36
36
|
*
|
|
37
37
|
* ### Example questions
|
|
@@ -39,7 +39,7 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
39
39
|
* The following are example questions a user can ask within the bounds of the navigation agent:
|
|
40
40
|
*
|
|
41
41
|
* - "Go to the Golden Gate Bridge"
|
|
42
|
-
* - "Zoom to a 1
|
|
42
|
+
* - "Zoom to a 1 to 24,000 scale"
|
|
43
43
|
* - "Zoom in"
|
|
44
44
|
* - "Go to the parks layer"
|
|
45
45
|
*
|
|
@@ -50,14 +50,19 @@ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/a
|
|
|
50
50
|
* - "Make this map 3D and tilt the view to a 45 degree angle" (3D navigation is currently not supported)
|
|
51
51
|
* - "Where am I?" (the navigation agent does not have access to the user's location)
|
|
52
52
|
*
|
|
53
|
+
* > Due to the non-deterministic nature of generative AI, there may be inaccuracies or unexpected behavior when using the
|
|
54
|
+
* out-of-the-box agents.
|
|
55
|
+
*
|
|
53
56
|
* @since 5.0
|
|
54
57
|
* @beta
|
|
55
58
|
* @see [arcgis-assistant](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/)
|
|
59
|
+
* @see [Intro to building agentic mapping applications](https://developers.arcgis.com/javascript/latest/agentic-apps/ai-introduction/)
|
|
60
|
+
* @see [AI Assistant component sample](https://developers.arcgis.com/javascript/latest/sample-code/ai-assistant/)
|
|
56
61
|
*/
|
|
57
62
|
export abstract class ArcgisAssistantNavigationAgent extends LitElement {
|
|
58
63
|
/**
|
|
59
64
|
* The reference element to the map that provides context for the navigation agent. Currently,
|
|
60
|
-
* this is only scoped to `arcgis-map` elements. This shows the navigation agent which
|
|
65
|
+
* this is only scoped to `arcgis-map` elements. This shows the navigation agent which map on which to
|
|
61
66
|
* perform navigation actions. This is required for the navigation agent to function properly.
|
|
62
67
|
*
|
|
63
68
|
* Setting this property is not necessary if you set the reference element on the parent
|