@arcgis/ai-components 5.1.0-next.127 → 5.1.0-next.129

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.
Files changed (80) hide show
  1. package/dist/cdn/{IUAAPMMA.js → 32S235WW.js} +1 -1
  2. package/dist/cdn/{5H7BG46R.js → 3352JWU3.js} +2 -2
  3. package/dist/cdn/{BOP6HXCW.js → 43BXVTTX.js} +1 -1
  4. package/dist/cdn/{7J26XD64.js → 45WQFXC6.js} +1 -1
  5. package/dist/cdn/5BWAWCMA.js +2 -0
  6. package/dist/cdn/{PYVVZRRJ.js → 6HIZCLMG.js} +1 -1
  7. package/dist/cdn/6MS2XN27.js +2 -0
  8. package/dist/cdn/7UAGCI6W.js +166 -0
  9. package/dist/cdn/{J2F4YIQI.js → COFOUGFJ.js} +2 -2
  10. package/dist/cdn/CY2AOS7J.js +2 -0
  11. package/dist/cdn/DPCBYJAM.js +2 -0
  12. package/dist/cdn/{M5ZB2XU3.js → DQIMHH5V.js} +1 -1
  13. package/dist/cdn/DXWRFET6.js +2 -0
  14. package/dist/cdn/{KX7OG7DL.js → E4TOTVRI.js} +5 -3
  15. package/dist/cdn/{3GJNNEHV.js → EX6NWXUF.js} +1 -1
  16. package/dist/cdn/F2QU4HAK.js +2 -0
  17. package/dist/cdn/H4ENPGSI.js +2 -0
  18. package/dist/cdn/{6QA7CIBO.js → HFQQORS4.js} +1 -1
  19. package/dist/cdn/HWSIV5DK.js +2 -0
  20. package/dist/cdn/{XLFCW5OF.js → IFB2ASIW.js} +1 -1
  21. package/dist/cdn/{KLIA4JYQ.js → LYJY5QUA.js} +1 -1
  22. package/dist/cdn/M7C6Y752.js +2 -0
  23. package/dist/cdn/{FXWTEFFD.js → MEM7FGVU.js} +1 -1
  24. package/dist/cdn/{MLQKBQSG.js → P5M2HNJ7.js} +1 -1
  25. package/dist/cdn/{QEYLJYK7.js → P7EGIU6K.js} +1 -1
  26. package/dist/cdn/{7XQKBW4A.js → PW4XPFSA.js} +1 -1
  27. package/dist/cdn/{M56MGI7M.js → SOCUKQVO.js} +1 -1
  28. package/dist/cdn/TOYQ22PR.js +2 -0
  29. package/dist/cdn/VVG5FDCY.js +2 -0
  30. package/dist/cdn/{4SZDSAFW.js → ZR5WU3UB.js} +1 -1
  31. package/dist/cdn/ZSLJX22Z.js +3 -0
  32. package/dist/cdn/index.js +1 -1
  33. package/dist/chunks/adapter.js +1099 -1055
  34. package/dist/chunks/arcgisKnowledgeGraph.js +82 -65
  35. package/dist/chunks/slottableRequestUtils.js +3 -7
  36. package/dist/components/arcgis-assistant/customElement.d.ts +15 -0
  37. package/dist/components/arcgis-assistant/customElement.js +227 -127
  38. package/dist/components/arcgis-assistant/index.js +2 -3
  39. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  40. package/dist/components/arcgis-assistant-chat/customElement.d.ts +2 -1
  41. package/dist/components/arcgis-assistant-chat/customElement.js +7 -7
  42. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +2 -0
  43. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  44. package/dist/components/arcgis-assistant-interrupt/customElement.js +13 -9
  45. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  46. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  47. package/dist/components/arcgis-assistant-message/customElement.d.ts +2 -0
  48. package/dist/components/arcgis-assistant-message/customElement.js +28 -26
  49. package/dist/components/arcgis-assistant-message/index.js +2 -0
  50. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  51. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  52. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +4 -0
  53. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
  54. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  55. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  56. package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
  57. package/dist/docs/api.json +1 -1
  58. package/dist/docs/docs.json +1 -1
  59. package/dist/docs/vscode.html-custom-data.json +1 -1
  60. package/dist/docs/web-types.json +1 -1
  61. package/dist/loader.js +6 -5
  62. package/dist/orchestrator/registry/agentRegistry.d.ts +33 -0
  63. package/dist/types/lumina.d.ts +6 -5
  64. package/dist/types/preact.d.ts +6 -5
  65. package/dist/types/react.d.ts +6 -5
  66. package/dist/types/stencil.d.ts +6 -5
  67. package/dist/utils/index.d.ts +2 -1
  68. package/package.json +5 -5
  69. package/dist/cdn/2TKDD7IY.js +0 -2
  70. package/dist/cdn/7VV6WZYQ.js +0 -166
  71. package/dist/cdn/7Z6WK75Y.js +0 -3
  72. package/dist/cdn/ASFDOICU.js +0 -2
  73. package/dist/cdn/EUNEQNYC.js +0 -2
  74. package/dist/cdn/GHPDN2L7.js +0 -2
  75. package/dist/cdn/KDUG6AWZ.js +0 -2
  76. package/dist/cdn/MM4TFFXX.js +0 -2
  77. package/dist/cdn/RBLFCUDD.js +0 -2
  78. package/dist/cdn/SRNPZKME.js +0 -2
  79. package/dist/cdn/YGW7TUNX.js +0 -2
  80. package/dist/cdn/ZTRICLZY.js +0 -2
@@ -1,130 +1,147 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { StateGraph as w, START as y, END as h } from "@langchain/langgraph/web";
3
- import { a as f, c as x, b as k, d as _, e as b, s as K, q as v, g as p, h as A, t as g, r as M, i as S, G as T, j as u } from "./adapter.js";
2
+ import { StateGraph as y, START as f, END as h, Command as x } from "@langchain/langgraph/web";
3
+ import { a as k, c as _, b, d as K, e as A, s as v, q as M, g as u, h as S, t as c, r as T, i as q, G as C, j as m } from "./adapter.js";
4
4
  import "@arcgis/core/identity/IdentityManager.js";
5
5
  import "@arcgis/core/portal/Portal.js";
6
- import { j as q, s as c, h as C } from "./generateLayerDescriptions.js";
7
- import { AIMessage as E } from "@langchain/core/messages";
6
+ import { j as E, s as p, h as G } from "./generateLayerDescriptions.js";
7
+ import { AIMessage as R } from "@langchain/core/messages";
8
8
  import "@langchain/core/callbacks/dispatch/web";
9
9
  import "@langchain/openai";
10
10
  import "@arcgis/core/core/reactiveUtils.js";
11
11
  import "@arcgis/core/layers/FeatureLayer.js";
12
12
  import "@arcgis/core/request.js";
13
- import { ToolNode as G } from "@langchain/langgraph/prebuilt";
13
+ import { ToolNode as N } from "@langchain/langgraph/prebuilt";
14
14
  import "@langchain/core/prompts";
15
- const m = [
16
- f,
17
- x,
15
+ const w = [
18
16
  k,
19
17
  _,
20
18
  b,
21
19
  K,
22
- v
20
+ A,
21
+ v,
22
+ M
23
23
  ];
24
- async function R(e, o) {
25
- const l = await p("arcgis_knowledge_tool_prompt"), a = A(o), r = {
24
+ async function L(e, a) {
25
+ const i = await u("arcgis_knowledge_tool_prompt"), o = S(a), r = {
26
26
  assignedTask: e.agentExecutionContext.assignedTask,
27
27
  userRequest: e.agentExecutionContext.userRequest,
28
28
  priorSteps: e.agentExecutionContext.priorSteps,
29
- contextType: a
30
- }, n = await q({
31
- promptText: l,
29
+ contextType: o
30
+ }, s = await E({
31
+ promptText: i,
32
32
  messages: e.arcgisKnowledgeMessages,
33
33
  inputVariables: r,
34
- tools: m
35
- }), t = (n.tool_calls?.length ?? 0) > 0, s = typeof n.text == "string" ? n.text.trim() : "", i = s.length > 0, d = n.content.toString();
36
- return !t && (a === "map" || a === "knowledgeGraph") ? {
34
+ tools: w
35
+ }), t = (s.tool_calls?.length ?? 0) > 0, n = typeof s.text == "string" ? s.text.trim() : "", l = n.length > 0, d = s.content.toString();
36
+ return !t && (o === "map" || o === "knowledgeGraph") ? {
37
37
  ...e,
38
- arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, n],
39
- outputMessage: a === "map" ? "No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries." : "No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",
38
+ arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, s],
39
+ outputMessage: o === "map" ? "No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries." : "No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",
40
40
  status: "success"
41
41
  } : {
42
42
  ...e,
43
- arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, n],
44
- outputMessage: t ? d : s,
45
- status: t ? e.status : i ? "success" : "failed",
46
- summary: d ? g(d) : "ArcGIS Knowledge Agent tool executed."
43
+ arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, s],
44
+ outputMessage: t ? d : n,
45
+ status: t ? e.status : l ? "success" : "failed",
46
+ summary: d ? c(d) : "ArcGIS Knowledge Agent tool executed."
47
47
  };
48
48
  }
49
- async function N(e, o) {
50
- const l = new G(m);
49
+ async function z(e, a) {
50
+ const i = new N(w);
51
51
  try {
52
- const a = await l.invoke(
52
+ const o = await i.invoke(
53
53
  {
54
54
  messages: e.arcgisKnowledgeMessages
55
55
  },
56
- o
56
+ a
57
57
  ), r = [];
58
- for (const t of a.messages) {
59
- let s;
58
+ for (const t of o.messages) {
59
+ let n;
60
60
  if (typeof t.content != "string")
61
61
  throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);
62
62
  try {
63
- s = JSON.parse(t.content);
63
+ n = JSON.parse(t.content);
64
64
  } catch {
65
- throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name ?? "unknown"}`);
65
+ throw new Error(
66
+ `Failed to parse tool message content as JSON. Tool: ${t.name ?? "unknown"}.
67
+
68
+ Original Content: ${t.content}`
69
+ );
66
70
  }
67
- if (!s || typeof s != "object" || !("toolName" in s))
71
+ if (!n || typeof n != "object" || !("toolName" in n))
68
72
  throw new Error(
69
- `Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(s)}`
73
+ `Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(n)}`
70
74
  );
71
- r.push(s);
75
+ r.push(n);
72
76
  }
73
- await c(
77
+ await p(
74
78
  {
75
- text: `Finished executing ArcGIS Knowledge Agent tools: ${a.messages.filter((t) => t.name).map((t) => t.name).join(", ")}`
79
+ text: `Finished executing ArcGIS Knowledge Agent tools: ${o.messages.filter((t) => t.name).map((t) => t.name).join(", ")}`
76
80
  },
77
- o
81
+ a
78
82
  );
79
- const n = r.filter((t) => typeof t != "string").map((t) => `- Called Tool: ${t.toolName}, Status: ${t.status}`);
83
+ const s = r.filter((t) => typeof t != "string").map((t) => `- Called Tool: ${t.toolName}, Status: ${t.status}`);
80
84
  return {
81
85
  ...e,
82
- outputMessage: n.join(`
86
+ outputMessage: s.join(`
83
87
  `),
84
- summary: n.length ? g(n.join(`
88
+ summary: s.length ? c(s.join(`
85
89
  `)) : "ArcGIS Knowledge Agent did not execute any tools or return any results.",
86
- arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, ...a.messages],
90
+ arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, ...o.messages],
87
91
  arcgisKnowledgeToolResult: r
88
92
  };
89
- } catch (a) {
90
- const r = a instanceof Error ? a.message : String(a);
91
- return await c({ text: `ArcGIS Knowledge Agent tool execution failed: ${r}` }, o), {
93
+ } catch (o) {
94
+ const r = o instanceof Error ? o.message : String(o);
95
+ return await p(
96
+ { text: `ArcGIS Knowledge Agent tool execution failed unexpectedly: ${r}` },
97
+ a
98
+ ), {
92
99
  ...e,
93
- outputMessage: `ArcGIS Knowledge Agent tool execution failed: ${r}`,
100
+ outputMessage: `ArcGIS Knowledge Agent tool execution failed unexpectedly: ${r}`,
94
101
  status: "failed",
95
- summary: `ArcGIS Knowledge Agent tool execution failed: ${r}`,
102
+ summary: c(`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${r}`),
96
103
  arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages]
97
104
  };
98
105
  }
99
106
  }
100
- const L = (e, o) => (
107
+ const D = (e, a) => (
101
108
  //agent services (ex: embeddingsWorker) would go in the array below, if required.
102
- M([], "ArcgisKnowledge Agent")(e, o)
109
+ T([], "ArcgisKnowledge Agent")(e, a)
103
110
  );
104
- async function z(e, o) {
105
- const a = (e.arcgisKnowledgeToolResult ?? []).map((d) => ({
111
+ async function $(e, a) {
112
+ const o = (e.arcgisKnowledgeToolResult ?? []).map((d) => ({
106
113
  ...d,
107
114
  details: void 0
108
115
  // Remove details to avoid overwhelming the LLM with too much info
109
- })), { knowledgeGraph: r } = await S(o), n = T.getDataModelTypesSummary(r.dataModel), t = {
116
+ })), { knowledgeGraph: r } = await q(a), s = C.getDataModelTypesSummary(r.dataModel), t = {
110
117
  assignedTask: e.agentExecutionContext.assignedTask,
111
118
  userRequest: e.agentExecutionContext.userRequest,
112
- toolResult: a,
113
- dataModelSummary: n
114
- }, s = await C({
115
- promptText: await p("arcgis_knowledge_summarize_result_prompt"),
119
+ toolResult: o,
120
+ dataModelSummary: s
121
+ }, n = await G({
122
+ promptText: await u("arcgis_knowledge_summarize_result_prompt"),
116
123
  modelTier: "default",
117
124
  inputVariables: t
118
- }), i = typeof s == "string" ? s : s.content;
125
+ }), l = typeof n == "string" ? n : n.content;
119
126
  return {
120
127
  ...e,
121
- outputMessage: i,
128
+ outputMessage: l,
122
129
  status: "success",
123
- summary: g(i),
124
- arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, new E(i)]
130
+ summary: c(l),
131
+ arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, new R(l)]
125
132
  };
126
133
  }
127
- const D = () => new w(u).addNode("requireArcgisKnowledgeServices", L).addNode("agent", R).addNode("tools", N).addNode("summarizationLLM", z).addEdge(y, "requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices", "agent").addConditionalEdges("agent", (o) => (o.arcgisKnowledgeMessages[o.arcgisKnowledgeMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : h).addConditionalEdges("tools", (o) => o.status === "failed" ? h : "summarizationLLM").addEdge("summarizationLLM", h), F = String.raw`The purpose of this agent is to work with Knowledge Graph data, a graph database technology that represents and stores data as interconnected entities (nodes) and relationships (edges).
134
+ function g(e) {
135
+ return async (a, i) => i?.configurable?.abortSignal?.aborted ? (await p({ text: "Knowledge Agent execution cancelled" }, i), new x({
136
+ goto: h,
137
+ update: {
138
+ outputMessage: "Knowledge Agent execution cancelled",
139
+ summary: "Knowledge Agent execution cancelled",
140
+ status: "failed"
141
+ }
142
+ })) : await e(a, i);
143
+ }
144
+ const F = () => new y(m).addNode("requireArcgisKnowledgeServices", D).addNode("agent", g(L)).addNode("tools", g(z)).addNode("summarizationLLM", g($)).addEdge(f, "requireArcgisKnowledgeServices").addEdge("requireArcgisKnowledgeServices", "agent").addConditionalEdges("agent", (a) => (a.arcgisKnowledgeMessages[a.arcgisKnowledgeMessages.length - 1]?.tool_calls?.length ?? 0) > 0 ? "tools" : h).addConditionalEdges("tools", (a) => a.status === "failed" ? h : "summarizationLLM").addEdge("summarizationLLM", h), I = String.raw`The purpose of this agent is to work with Knowledge Graph data, a graph database technology that represents and stores data as interconnected entities (nodes) and relationships (edges).
128
145
  This agent has two categories of skills: those that work with an active link chart visualization of a subset of the data in the knowledge graph, and those that work with the knowledge graph data more generally against the entire dataset in the service and database.
129
146
  For link charts, the agent enables users to interact with a link chart by adding new entities (also called nodes) or relationships (also called edges), removing existing entities or relationships,
130
147
  expanding the graph from particular entities, finding relationships between specified entities on the link chart and adding them to the link chart, finding all relationships
@@ -162,13 +179,13 @@ _example: "Discover and add all the relationships originating at 'Entity E' to t
162
179
  _example: "Show me all entities with a name similar to 'Smith' and add them to the link chart"_
163
180
  _example: "Find reports in my graph that have a title similar to 'Quarterly Earnings'"_
164
181
  _example: "Find John Smith and all people he has made phone calls to in the last year"_
165
- _example: "What is the average age of all people who work for Esri?"_`, W = {
182
+ _example: "What is the average age of all people who work for Esri?"_`, ee = {
166
183
  id: "arcgisKnowledge",
167
184
  name: "ArcgisKnowledge Agent",
168
- description: F,
169
- createGraph: D,
170
- workspace: u
185
+ description: I,
186
+ createGraph: F,
187
+ workspace: m
171
188
  };
172
189
  export {
173
- W as A
190
+ ee as A
174
191
  };
@@ -1,11 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- function a(e) {
3
- return `message-${e}`;
4
- }
5
- function o(e, t) {
6
- return `block-${e}-${t}`;
2
+ function e(o, t) {
3
+ return `block-${o}-${t}`;
7
4
  }
8
5
  export {
9
- o as a,
10
- a as g
6
+ e as g
11
7
  };
@@ -89,6 +89,13 @@ export abstract class ArcgisAssistant extends LitElement {
89
89
  stopButtonLabel: string;
90
90
  askButtonLabel: string;
91
91
  }>;
92
+ /**
93
+ * When `true`, disables the assistant avatar in the chat interface.
94
+ *
95
+ * @default false
96
+ * @since 5.1
97
+ */
98
+ accessor assistantAvatarEnabled: boolean;
92
99
  /**
93
100
  * Indicates whether the assistant is currently processing a user message.
94
101
  * This value is `true` while the assistant is generating a response and `false` when idle.
@@ -454,6 +461,13 @@ export abstract class ArcgisAssistant extends LitElement {
454
461
  * ```
455
462
  */
456
463
  readonly arcgisReady: import("@arcgis/lumina").TargetedEvent<this, void>;
464
+ /**
465
+ * Emitted when the assistant generates a response to a user message. The event detail includes an AssistantMessage object that contains the assistant's response,
466
+ * along with any relevant logs or errors. This allows app developers to capture the assistant's responses.
467
+ *
468
+ * @since 5.1
469
+ */
470
+ readonly arcgisResponse: import("@arcgis/lumina").TargetedEvent<this, AssistantMessage>;
457
471
  /**
458
472
  * Emitted when the assistant requests custom slotted content for an assistant message.
459
473
  *
@@ -508,6 +522,7 @@ export abstract class ArcgisAssistant extends LitElement {
508
522
  arcgisInterruptSubmit: ArcgisAssistant["arcgisInterruptSubmit"]["detail"];
509
523
  arcgisPromptSelect: ArcgisAssistant["arcgisPromptSelect"]["detail"];
510
524
  arcgisReady: ArcgisAssistant["arcgisReady"]["detail"];
525
+ arcgisResponse: ArcgisAssistant["arcgisResponse"]["detail"];
511
526
  arcgisSlottableRequest: ArcgisAssistant["arcgisSlottableRequest"]["detail"];
512
527
  arcgisSubmit: ArcgisAssistant["arcgisSubmit"]["detail"];
513
528
  };