@arcgis/ai-components 5.1.0-next.103 → 5.1.0-next.104

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/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import{p as s,x as e}from"./DSEMD4M2.js";import"./CFDTXKJ6.js";var a=s(e,{"arcgis-assistant":[()=>import("./P6VE72RL.js"),"_messages:,awaitingResponse:,awaitingResponseStep:,copyEnabled,description,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,suggestedPrompts:,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt"],"arcgis-assistant-agent":[()=>import("./ZPNJGIAF.js"),"agent:,context:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./MXVYKCXV.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./PE3TLAMZ.js"),"referenceElement;;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./IYWZ7KR5.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./WJLYLYKX.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./2YEKZADB.js"),"loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./YNJYG2RG.js"),"_messages:,awaitingResponse,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./ZLO73NU6.js"),"_messages:,message,options:,type"],"arcgis-assistant-message":[()=>import("./G4SVCCJH.js"),"copyEnabled,feedbackEnabled,footerDisabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-block":[()=>import("./5JBT3YNY.js"),"block:"],"arcgis-assistant-message-feedback":[()=>import("./Q5D5LJS5.js"),"_messages:,feedbackEnabled,message:"],"arcgis-assistant-message-footer":[()=>import("./UK6CP7BR.js"),"_messages:,copyEnabled,feedbackEnabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-loading":[()=>import("./Z3DVGFEE.js"),"loading,loadingMessage"],"arcgis-assistant-message-log":[()=>import("./PTGKT5P6.js"),"log:,logEnabled,showLog"],"arcgis-assistant-message-read-aloud":[()=>import("./R5FWFRWW.js"),"_messages:,message:,readAloudEnabled"],"arcgis-assistant-message-text":[()=>import("./Y3AUHNRX.js"),"content"],"arcgis-assistant-speech-input":[()=>import("./TRDKA5Y6.js"),"awaitingResponse,inputValue,language,mode;;clearDraftSession"],"arcgis-assistant-suggested-prompts":[()=>import("./LXFCO34K.js"),"_messages:,label,prompts:"],"arcgis-assistant-user-message":[()=>import("./WBRZZ4FB.js"),"content,message:,user"]});a({resourcesUrl:import.meta.url});var t=new CSSStyleSheet;t.replaceSync("@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-message-block,arcgis-assistant-message-feedback,arcgis-assistant-message-footer,arcgis-assistant-message-loading,arcgis-assistant-message-log,arcgis-assistant-message-read-aloud,arcgis-assistant-message-text,arcgis-assistant-speech-input,arcgis-assistant-suggested-prompts,arcgis-assistant-user-message){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,t];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r)=>{a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,e)
2
+ import{p as s,x as e}from"./DSEMD4M2.js";import"./CFDTXKJ6.js";var a=s(e,{"arcgis-assistant":[()=>import("./TEUDBVRL.js"),"_messages:,awaitingResponse:,awaitingResponseStep:,copyEnabled,description,entryMessage,feedbackEnabled,heading,interrupt:,keepSuggestedPrompts,logEnabled,messages:,orchestrator:,readAloudEnabled,referenceElement,suggestedPrompts:,voiceInputEnabled;clearChatHistory,submitMessage;cancelInterrupt,register,submitInterrupt"],"arcgis-assistant-agent":[()=>import("./EKYXKJTY.js"),"agent:,context:;getContext"],"arcgis-assistant-data-exploration-agent":[()=>import("./AUI5SK23.js"),"referenceElement;;getContext"],"arcgis-assistant-help-agent":[()=>import("./DYOEGUSR.js"),"referenceElement;;getContext"],"arcgis-assistant-knowledge-agent":[()=>import("./MRXJFN2A.js"),"context:,referenceElement,serviceUrl;getContext"],"arcgis-assistant-layer-styling-agent":[()=>import("./AHO5GI7C.js"),"referenceElement;;getContext"],"arcgis-assistant-navigation-agent":[()=>import("./53VEUSO6.js"),"referenceElement;;getContext"],"arcgis-assistant-chat":[()=>import("./2YEKZADB.js"),"loading,messages:"],"arcgis-assistant-chat-entry":[()=>import("./YNJYG2RG.js"),"_messages:,awaitingResponse,entryPlaceholder,inputValue,keyboardShortcutsDisabled,messages:,status,voiceInputEnabled;submitMessage"],"arcgis-assistant-interrupt":[()=>import("./ZLO73NU6.js"),"_messages:,message,options:,type"],"arcgis-assistant-message":[()=>import("./G4SVCCJH.js"),"copyEnabled,feedbackEnabled,footerDisabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-block":[()=>import("./5JBT3YNY.js"),"block:"],"arcgis-assistant-message-feedback":[()=>import("./Q5D5LJS5.js"),"_messages:,feedbackEnabled,message:"],"arcgis-assistant-message-footer":[()=>import("./UK6CP7BR.js"),"_messages:,copyEnabled,feedbackEnabled,logEnabled,message:,readAloudEnabled"],"arcgis-assistant-message-loading":[()=>import("./Z3DVGFEE.js"),"loading,loadingMessage"],"arcgis-assistant-message-log":[()=>import("./PTGKT5P6.js"),"log:,logEnabled,showLog"],"arcgis-assistant-message-read-aloud":[()=>import("./R5FWFRWW.js"),"_messages:,message:,readAloudEnabled"],"arcgis-assistant-message-text":[()=>import("./Y3AUHNRX.js"),"content"],"arcgis-assistant-speech-input":[()=>import("./TRDKA5Y6.js"),"awaitingResponse,inputValue,language,mode;;clearDraftSession"],"arcgis-assistant-suggested-prompts":[()=>import("./LXFCO34K.js"),"_messages:,label,prompts:"],"arcgis-assistant-user-message":[()=>import("./WBRZZ4FB.js"),"content,message:,user"]});a({resourcesUrl:import.meta.url});var t=new CSSStyleSheet;t.replaceSync("@layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-knowledge-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-message-block,arcgis-assistant-message-feedback,arcgis-assistant-message-footer,arcgis-assistant-message-loading,arcgis-assistant-message-log,arcgis-assistant-message-read-aloud,arcgis-assistant-message-text,arcgis-assistant-speech-input,arcgis-assistant-suggested-prompts,arcgis-assistant-user-message){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,t];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r)=>{a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,e)
package/dist/cdn/main.css CHANGED
@@ -1 +1 @@
1
- @layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-message-block,arcgis-assistant-message-feedback,arcgis-assistant-message-footer,arcgis-assistant-message-loading,arcgis-assistant-message-log,arcgis-assistant-message-read-aloud,arcgis-assistant-message-text,arcgis-assistant-speech-input,arcgis-assistant-suggested-prompts,arcgis-assistant-user-message){visibility:hidden}}
1
+ @layer{:not([hydrated]):is(arcgis-assistant,arcgis-assistant-agent,arcgis-assistant-data-exploration-agent,arcgis-assistant-help-agent,arcgis-assistant-knowledge-agent,arcgis-assistant-layer-styling-agent,arcgis-assistant-navigation-agent,arcgis-assistant-chat,arcgis-assistant-chat-entry,arcgis-assistant-interrupt,arcgis-assistant-message-block,arcgis-assistant-message-feedback,arcgis-assistant-message-footer,arcgis-assistant-message-loading,arcgis-assistant-message-log,arcgis-assistant-message-read-aloud,arcgis-assistant-message-text,arcgis-assistant-speech-input,arcgis-assistant-suggested-prompts,arcgis-assistant-user-message){visibility:hidden}}
@@ -1,26 +1,26 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { getClosestElement as a } from "@arcgis/toolkit/dom";
3
- import { g as i } from "./utils2.js";
4
- function o(e, t) {
5
- const s = i(e.el, e.referenceElement);
2
+ import { getClosestElement as i } from "@arcgis/toolkit/dom";
3
+ import { g as r, a as o } from "./utils2.js";
4
+ function c(e, t) {
5
+ const s = r(e.el, e.referenceElement);
6
6
  if (s)
7
7
  return s;
8
- const n = a(e.el, "arcgis-assistant"), r = i(e.el, n?.referenceElement);
9
- if (r)
10
- return r;
8
+ const n = i(e.el, "arcgis-assistant"), a = r(e.el, n?.referenceElement);
9
+ if (a)
10
+ return a;
11
11
  throw new Error(`${t}: Reference element not found`);
12
12
  }
13
- function l(e, t) {
14
- const n = o(e, t).view;
13
+ function m(e, t) {
14
+ const n = c(e, t).view;
15
15
  if (!n)
16
16
  throw new Error(`${t}: Reference element does not have a view`);
17
17
  return n;
18
18
  }
19
- function m(e) {
19
+ function w(e) {
20
20
  return typeof e == "function";
21
21
  }
22
22
  function g(e) {
23
- const t = a(e.el, "arcgis-assistant");
23
+ const t = i(e.el, "arcgis-assistant");
24
24
  if (t === void 0)
25
25
  throw new Error("arcgis-assistant-agent must be used within an arcgis-assistant element");
26
26
  t.register({
@@ -28,8 +28,20 @@ function g(e) {
28
28
  getContext: async () => await e.getContext?.() ?? e.context ?? {}
29
29
  });
30
30
  }
31
+ function l(e) {
32
+ const t = o(e.el, e.referenceElement);
33
+ if (t)
34
+ return t;
35
+ const s = i(e.el, "arcgis-assistant"), n = r(e.el, s?.referenceElement);
36
+ return n || null;
37
+ }
38
+ function v(e) {
39
+ const t = l(e);
40
+ return t ? t.view : null;
41
+ }
31
42
  export {
32
43
  g as a,
33
- m as i,
34
- l as r
44
+ v as b,
45
+ w as i,
46
+ m as r
35
47
  };
@@ -1,12 +1,16 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { getClosestElement as i } from "@arcgis/toolkit/dom";
3
- function r(s, o) {
4
- return o ? typeof o == "string" ? l(s, o) ?? null : o : i(s, "arcgis-map") ?? null;
2
+ import { getClosestElement as s } from "@arcgis/toolkit/dom";
3
+ function l(t, o) {
4
+ return o ? typeof o == "string" ? u(t, o) ?? null : o : s(t, "arcgis-map") ?? null;
5
5
  }
6
- function l(s, o) {
7
- const u = o.includes("#") || o.includes(".") || o.includes("["), t = s.getRootNode();
8
- return (u ? void 0 : t.querySelector(`#${o}`)) ?? t.querySelector(o) ?? void 0;
6
+ function n(t, o) {
7
+ return o ? typeof o == "string" ? u(t, o) ?? null : o : s(t, "arcgis-link-chart") ?? s(t, "arcgis-map") ?? null;
8
+ }
9
+ function u(t, o) {
10
+ const r = o.includes("#") || o.includes(".") || o.includes("["), i = t.getRootNode();
11
+ return (r ? void 0 : i.querySelector(`#${o}`)) ?? i.querySelector(o) ?? void 0;
9
12
  }
10
13
  export {
11
- r as g
14
+ n as a,
15
+ l as g
12
16
  };
@@ -0,0 +1,101 @@
1
+ /// <reference path="../../index.d.ts" />
2
+ import type { PublicLitElement as LitElement } from "@arcgis/lumina";
3
+ import type { ArcgisKnowledgeContext } from "@arcgis/ai-agents";
4
+ import type { ArcgisLinkChart as ArcgisLinkChart } from "@arcgis/map-components/components/arcgis-link-chart";
5
+ import type { ArcgisMap as ArcgisMap } from "@arcgis/map-components/components/arcgis-map";
6
+
7
+ /**
8
+ * The Knowledge Agent enables the end user to perform operations on a knowledge graph layer or link chart layer,
9
+ * as well as explore the data in the knowledge graph via natural language queries. See the list of capabilities below for more details.
10
+ *
11
+ * This is an unrendered component that must be added as a child of the `arcgis-assistant` component in either HTML or JavaScript.
12
+ *
13
+ * Note: Sign in to access the data in this demo, U/P: `viewer01`/`I68VGU^nMurF`
14
+ *
15
+ * ```html
16
+ * <arcgis-link-chart id="my-link-chart"></arcgis-link-chart>
17
+ * <arcgis-assistant>
18
+ * <arcgis-assistant-knowledge-agent reference-element="my-link-chart"></arcgis-assistant-knowledge-agent>
19
+ * </arcgis-assistant>
20
+ * ```
21
+ *
22
+ * Once added to the assistant, the agent is loaded and ready to receive user messages related to their knowledge graph related layers or data.
23
+ *
24
+ * ### Capabilties
25
+ *
26
+ * The knowledge agent provides the following capabilities related to a knowledge graph or associated knowledge graph layer or link chart layer:
27
+ *
28
+ * - **Query and Search Graph Data** - Answers questions about the data in the knowledge graph via cypher query or text property search.
29
+ * - **Generate Cypher Query** - Generates a cypher query based on a natural language question and the current knowledge graph data model,
30
+ * which can be run against the knowledge graph service.
31
+ *
32
+ * **Additional capabilities with a map view with a knowledge graph layer or a link chart view**
33
+ * - **Add entities and relationships** - Add entities or relationships the the knowledge graph or link chart layer.
34
+ *
35
+ * **Additional capabilities with a link chart view only**
36
+ * - **Change link chart layout** - Swap the layout of the link chart between different modes such as force directed, radial, or hierarchical.
37
+ * - **Toggle non-spatial visibility** - Show or hide non-spatial entities and relationships on the link chart.
38
+ * - **Create link chart from query** - Update the existing link chart with new membership based on a generated query.
39
+ *
40
+ *
41
+ * ### Example questions
42
+ *
43
+ * The following are example questions a user can ask within the bounds of the navigation agent:
44
+ *
45
+ * - "What entities are in this graph, and what is the count of each entity type?"
46
+ * - "Find documents related to the San Francisco Bay Area."
47
+ * - "Generate a cypher query to find all employees of Company X that are located in California."
48
+ * - "Add all connections between Company X and Company Y to the link chart"
49
+ * - "Change the layout to radial-root-centric"
50
+ * - "Show nonspatial data on the link chart"
51
+ * - "Create a new link chart from the with all employees from Company X that joined the company after 2015 and are located in California"
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
+ *
56
+ * @since 5.1
57
+ * @beta
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/)
61
+ */
62
+ export abstract class ArcgisAssistantKnowledgeAgent extends LitElement {
63
+ /**
64
+ * Required and optional context for the knowledge agent. The knowledge agent requires either a link chart view,
65
+ * a map view with at least one knowledge graph layer, or KnowledgeGraph instance in order to function.
66
+ *
67
+ * Depending on the context provided, different capabilities will be available.
68
+ */
69
+ accessor context: ArcgisKnowledgeContext | undefined;
70
+ /**
71
+ * The reference element to the map that provides context for the navigation agent. Currently,
72
+ * this is only scoped to `arcgis-map` elements. This shows the navigation agent which map on which to
73
+ * perform navigation actions. This is required for the navigation agent to function properly.
74
+ *
75
+ * Setting this property is not necessary if you set the reference element on the parent
76
+ * `arcgis-assistant` component.
77
+ *
78
+ * @see [arcgis-assistant.referenceElement](https://developers.arcgis.com/javascript/latest/references/ai-components/components/arcgis-assistant/#referenceElement)
79
+ * @example
80
+ * ```html
81
+ * <arcgis-link-chart id="my-link-chart"></arcgis-link-chart>
82
+ * <arcgis-assistant>
83
+ * <arcgis-assistant-knowledge-agent reference-element="my-link-chart"></arcgis-assistant-knowledge-agent>
84
+ * </arcgis-assistant>
85
+ * ```
86
+ */
87
+ accessor referenceElement: ArcgisLinkChart | ArcgisMap | string | undefined;
88
+ /**
89
+ * The URL of a Knowledge Graph Service. This can be set to use the agent without a map or link chart view.
90
+ *
91
+ * If a map or link chart view reference element are provided, this property will be ignored.
92
+ *
93
+ * @example
94
+ * ```html
95
+ * <arcgis-assistant>
96
+ * <arcgis-assistant-knowledge-agent service-url="https://example.esri.com/server/rest/services/Hosted/KGS_Service_Name/KnowledgeGraphServer"></arcgis-assistant-knowledge-agent>
97
+ * </arcgis-assistant>
98
+ * ```
99
+ */
100
+ accessor serviceUrl: null | undefined | string;
101
+ }
@@ -0,0 +1,51 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
+ import { c as r } from "../../chunks/runtime.js";
3
+ import { LitElement as i } from "@arcgis/lumina";
4
+ import { ArcgisKnowledgeAgent as s } from "@arcgis/ai-agents";
5
+ import { b as o, a as n } from "../../chunks/utils.js";
6
+ import { fetchKnowledgeGraph as a } from "@arcgis/core/rest/knowledgeGraphService.js";
7
+ class c extends i {
8
+ constructor() {
9
+ super(...arguments), this.agent = s;
10
+ }
11
+ static {
12
+ this.properties = { referenceElement: 1, serviceUrl: 3, context: 0 };
13
+ }
14
+ #t;
15
+ #r;
16
+ #e;
17
+ get serviceUrl() {
18
+ return this.#r;
19
+ }
20
+ set serviceUrl(e) {
21
+ this.#r = e;
22
+ }
23
+ async getContext() {
24
+ const e = this.context ? { ...this.context, knowledgeGraph: void 0, view: void 0 } : {};
25
+ if (this.#t)
26
+ return {
27
+ ...e,
28
+ view: this.#t
29
+ };
30
+ if (this.#e)
31
+ try {
32
+ const t = await this.#e;
33
+ return { ...e, knowledgeGraph: t };
34
+ } catch (t) {
35
+ console.error("Failed to load knowledge graph via service URL:", t);
36
+ }
37
+ if (!this.context?.knowledgeGraph && !this.context?.view)
38
+ throw new Error("arcgis-assistant-knowledge-agent requires either a knowledgeGraph or view in context, and neither were provided");
39
+ return this.context;
40
+ }
41
+ willUpdate(e) {
42
+ e.has("serviceUrl") && this.serviceUrl ? this.#e = a(this.serviceUrl) : this.#e = void 0;
43
+ }
44
+ load() {
45
+ this.#t = o(this) ?? void 0, n(this);
46
+ }
47
+ }
48
+ r("arcgis-assistant-knowledge-agent", c);
49
+ export {
50
+ c as ArcgisAssistantKnowledgeAgent
51
+ };
@@ -0,0 +1 @@
1
+ export * from "./customElement.js";
@@ -0,0 +1 @@
1
+ export * from "./customElement.js";