@arcgis/ai-components 5.1.0-next.130 → 5.1.0-next.131

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 (83) hide show
  1. package/dist/agent-utils/FunctionAgent.d.ts +2 -2
  2. package/dist/agent-utils/LLMAgent.d.ts +2 -2
  3. package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
  4. package/dist/agent-utils/index.d.ts +99 -0
  5. package/dist/agent-utils/index.js +148 -0
  6. package/dist/agent-utils/middlewares/trace.js +25 -33
  7. package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
  8. package/dist/agent-utils/types.d.ts +30 -1
  9. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
  10. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
  11. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
  12. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
  13. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
  14. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
  15. package/dist/cdn/2DYXX3VX.js +2 -0
  16. package/dist/cdn/4ASZF5I2.js +181 -0
  17. package/dist/cdn/6FEB6XYK.js +2 -0
  18. package/dist/cdn/7HKOEG6B.js +161 -0
  19. package/dist/cdn/DAMZY3V4.js +2 -0
  20. package/dist/cdn/DZWRIK64.js +47 -0
  21. package/dist/cdn/EY5GGKO5.js +2 -0
  22. package/dist/cdn/FYNHAVHL.js +2 -0
  23. package/dist/cdn/GNCV7JCL.js +2 -0
  24. package/dist/cdn/H3EEFM4A.js +179 -0
  25. package/dist/cdn/I6AHJA2A.js +16 -0
  26. package/dist/cdn/IFDBNTW2.js +3 -0
  27. package/dist/cdn/KGYSBUFO.js +9 -0
  28. package/dist/cdn/KJ5IHMRP.js +2 -0
  29. package/dist/cdn/L6GVMINQ.js +2 -0
  30. package/dist/cdn/LXJWWOGK.js +66 -0
  31. package/dist/cdn/MDZ3PTNT.js +2 -0
  32. package/dist/cdn/{RBMBKUY6.js → MGPLH2PO.js} +5 -5
  33. package/dist/cdn/{Y2L6M2RG.js → NKL6PVCN.js} +11 -11
  34. package/dist/cdn/O4SVTPFW.js +2 -0
  35. package/dist/cdn/{LUWP3MUX.js → P3JUCFXI.js} +16 -0
  36. package/dist/cdn/PCZS64LS.js +2 -0
  37. package/dist/cdn/PIUDMACH.js +56 -0
  38. package/dist/cdn/QH6TSBNI.js +2 -0
  39. package/dist/cdn/{FKSLZTUY.js → QXWL4WLO.js} +5 -5
  40. package/dist/cdn/QZXQIJSW.js +2 -0
  41. package/dist/cdn/RLWXD365.js +2 -0
  42. package/dist/cdn/UPSGN34Q.js +2 -0
  43. package/dist/cdn/V746CPCO.js +6 -0
  44. package/dist/cdn/VPZHLYPA.js +2 -0
  45. package/dist/cdn/VWG4M6ZB.js +2 -0
  46. package/dist/cdn/{72HM6DTZ.js → WRKGKKWT.js} +3 -3
  47. package/dist/cdn/ZL2D2BJI.js +2 -0
  48. package/dist/cdn/agent-utils/index.js +2 -0
  49. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  50. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  51. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  52. package/dist/cdn/index.js +1 -1
  53. package/dist/chunks/adapter.js +1046 -1018
  54. package/dist/chunks/arcgisKnowledgeGraph.js +66 -46
  55. package/dist/chunks/dataExplorationGraph.js +8 -3
  56. package/dist/chunks/generateLayerDescriptions.js +228 -217
  57. package/dist/chunks/helpGraph.js +14 -11
  58. package/dist/chunks/index.js +11 -0
  59. package/dist/chunks/intent_prompt.js +16 -0
  60. package/dist/chunks/layerStylingGraph.js +25 -22
  61. package/dist/chunks/navigationGraph.js +7 -3
  62. package/dist/chunks/orchestrator.js +9 -8
  63. package/dist/chunks/toolCallResponse.js +5 -3
  64. package/dist/components/arcgis-assistant/customElement.js +1 -0
  65. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -0
  66. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
  67. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  68. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -0
  69. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
  70. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
  71. package/dist/docs/api.json +1 -1
  72. package/dist/docs/docs.json +1 -1
  73. package/dist/docs/web-types.json +1 -1
  74. package/dist/utils/index.d.ts +3 -3
  75. package/dist/utils/index.js +48 -47
  76. package/package.json +5 -4
  77. package/dist/cdn/AZTWZFVA.js +0 -16
  78. package/dist/cdn/I3H52G4C.js +0 -2
  79. package/dist/cdn/QLU3NT5J.js +0 -2
  80. package/dist/cdn/RJ6XMESZ.js +0 -165
  81. package/dist/cdn/V7BWJN43.js +0 -422
  82. package/dist/cdn/ZP3SG5OG.js +0 -108
  83. package/dist/cdn/ZSLJX22Z.js +0 -3
@@ -1,39 +1,41 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
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";
2
+ import { StateGraph as f, START as x, END as h, Command as k } from "@langchain/langgraph/web";
3
+ import { a as b, c as _, b as K, d as A, e as T, s as v, q as S, g as u, h as q, t as c, r as M, i as C, G as E, 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 E, s as p, h as G } from "./generateLayerDescriptions.js";
6
+ import { h as G, e as N } from "./generateLayerDescriptions.js";
7
7
  import { AIMessage as R } from "@langchain/core/messages";
8
8
  import "@langchain/core/callbacks/dispatch/web";
9
9
  import "@langchain/openai";
10
+ import "@arcgis/core/config.js";
10
11
  import "@arcgis/core/core/reactiveUtils.js";
11
12
  import "@arcgis/core/layers/FeatureLayer.js";
12
13
  import "@arcgis/core/request.js";
13
- import { ToolNode as N } from "@langchain/langgraph/prebuilt";
14
+ import { ToolNode as L } from "@langchain/langgraph/prebuilt";
15
+ import { s as p, a as D } from "./index.js";
14
16
  import "@langchain/core/prompts";
15
17
  const w = [
16
- k,
17
- _,
18
18
  b,
19
+ _,
19
20
  K,
20
21
  A,
22
+ T,
21
23
  v,
22
- M
24
+ S
23
25
  ];
24
- async function L(e, a) {
25
- const i = await u("arcgis_knowledge_tool_prompt"), o = S(a), r = {
26
+ async function z(e, a) {
27
+ const i = await u("arcgis_knowledge_tool_prompt"), o = q(a), n = {
26
28
  assignedTask: e.agentExecutionContext.assignedTask,
27
29
  userRequest: e.agentExecutionContext.userRequest,
28
30
  priorSteps: e.agentExecutionContext.priorSteps,
29
31
  contextType: o
30
- }, s = await E({
32
+ }, s = await G({
31
33
  promptText: i,
32
34
  messages: e.arcgisKnowledgeMessages,
33
- inputVariables: r,
35
+ inputVariables: n,
34
36
  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
+ }), l = (s.tool_calls?.length ?? 0) > 0, t = typeof s.text == "string" ? s.text.trim() : "", r = t.length > 0, d = s.content.toString();
38
+ return !l && (o === "map" || o === "knowledgeGraph") ? {
37
39
  ...e,
38
40
  arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, s],
39
41
  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.",
@@ -41,26 +43,44 @@ async function L(e, a) {
41
43
  } : {
42
44
  ...e,
43
45
  arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, s],
44
- outputMessage: t ? d : n,
45
- status: t ? e.status : l ? "success" : "failed",
46
+ outputMessage: l ? d : t,
47
+ status: l ? e.status : r ? "success" : "failed",
46
48
  summary: d ? c(d) : "ArcGIS Knowledge Agent tool executed."
47
49
  };
48
50
  }
49
- async function z(e, a) {
50
- const i = new N(w, { handleToolErrors: !1 });
51
+ const y = {
52
+ generateCypher: "generated-cypher-query",
53
+ queryGraphData: "graph-query-result",
54
+ searchGraphData: "graph-search-result",
55
+ addRecords: "added-records",
56
+ applyLayout: "applied-layout",
57
+ changeNonspatialVisibility: "changed-nonspatial-visibility",
58
+ createLinkChart: "created-link-chart"
59
+ };
60
+ function F(e) {
61
+ return !!e && e.status === "success" && !!y[e.toolName];
62
+ }
63
+ function $(e) {
64
+ return {
65
+ type: y[e.toolName],
66
+ data: e.details
67
+ };
68
+ }
69
+ async function I(e, a) {
70
+ const i = new L(w, { handleToolErrors: !1 });
51
71
  try {
52
72
  const o = await i.invoke(
53
73
  {
54
74
  messages: e.arcgisKnowledgeMessages
55
75
  },
56
76
  a
57
- ), r = [];
77
+ ), n = [];
58
78
  for (const t of o.messages) {
59
- let n;
79
+ let r;
60
80
  if (typeof t.content != "string")
61
81
  throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);
62
82
  try {
63
- n = JSON.parse(t.content);
83
+ r = JSON.parse(t.content);
64
84
  } catch {
65
85
  throw new Error(
66
86
  `Failed to parse tool message content as JSON. Tool: ${t.name ?? "unknown"}.
@@ -68,11 +88,11 @@ async function z(e, a) {
68
88
  Original Content: ${t.content}`
69
89
  );
70
90
  }
71
- if (!n || typeof n != "object" || !("toolName" in n))
91
+ if (!r || typeof r != "object" || !("toolName" in r))
72
92
  throw new Error(
73
- `Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(n)}`
93
+ `Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(r)}`
74
94
  );
75
- r.push(n);
95
+ n.push(r);
76
96
  }
77
97
  await p(
78
98
  {
@@ -80,59 +100,59 @@ async function z(e, a) {
80
100
  },
81
101
  a
82
102
  );
83
- const s = r.filter((t) => typeof t != "string").map((t) => `- Called Tool: ${t.toolName}, Status: ${t.status}`);
84
- return {
103
+ const s = n.filter((t) => typeof t != "string").map((t) => `- Called Tool: ${t.toolName}, Status: ${t.status}`), l = n[0];
104
+ return l && F(l) && await D($(l), a), {
85
105
  ...e,
86
106
  outputMessage: s.join(`
87
107
  `),
88
108
  summary: s.length ? c(s.join(`
89
109
  `)) : "ArcGIS Knowledge Agent did not execute any tools or return any results.",
90
110
  arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, ...o.messages],
91
- arcgisKnowledgeToolResult: r
111
+ arcgisKnowledgeToolResult: n
92
112
  };
93
113
  } catch (o) {
94
- const r = o instanceof Error ? o.message : String(o);
114
+ const n = o instanceof Error ? o.message : String(o);
95
115
  return await p(
96
- { text: `ArcGIS Knowledge Agent tool execution failed unexpectedly: ${r}` },
116
+ { text: `ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}` },
97
117
  a
98
118
  ), {
99
119
  ...e,
100
- outputMessage: `ArcGIS Knowledge Agent tool execution failed unexpectedly: ${r}`,
120
+ outputMessage: `ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}`,
101
121
  status: "failed",
102
- summary: c(`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${r}`),
122
+ summary: c(`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}`),
103
123
  arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages]
104
124
  };
105
125
  }
106
126
  }
107
- const D = (e, a) => (
127
+ const V = (e, a) => (
108
128
  //agent services (ex: embeddingsWorker) would go in the array below, if required.
109
- T([], "ArcgisKnowledge Agent")(e, a)
129
+ M([], "ArcgisKnowledge Agent")(e, a)
110
130
  );
111
- async function $(e, a) {
131
+ async function j(e, a) {
112
132
  const o = (e.arcgisKnowledgeToolResult ?? []).map((d) => ({
113
133
  ...d,
114
134
  details: void 0
115
135
  // Remove details to avoid overwhelming the LLM with too much info
116
- })), { knowledgeGraph: r } = await q(a), s = C.getDataModelTypesSummary(r.dataModel), t = {
136
+ })), { knowledgeGraph: n } = await C(a), s = E.getDataModelTypesSummary(n.dataModel), l = {
117
137
  assignedTask: e.agentExecutionContext.assignedTask,
118
138
  userRequest: e.agentExecutionContext.userRequest,
119
139
  toolResult: o,
120
140
  dataModelSummary: s
121
- }, n = await G({
141
+ }, t = await N({
122
142
  promptText: await u("arcgis_knowledge_summarize_result_prompt"),
123
143
  modelTier: "default",
124
- inputVariables: t
125
- }), l = typeof n == "string" ? n : n.content;
144
+ inputVariables: l
145
+ }), r = typeof t == "string" ? t : t.content;
126
146
  return {
127
147
  ...e,
128
- outputMessage: l,
148
+ outputMessage: r,
129
149
  status: "success",
130
- summary: c(l),
131
- arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, new R(l)]
150
+ summary: c(r),
151
+ arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, new R(r)]
132
152
  };
133
153
  }
134
154
  function g(e) {
135
- return async (a, i) => i?.configurable?.abortSignal?.aborted ? (await p({ text: "Knowledge Agent execution cancelled" }, i), new x({
155
+ return async (a, i) => i?.configurable?.abortSignal?.aborted ? (await p({ text: "Knowledge Agent execution cancelled" }, i), new k({
136
156
  goto: h,
137
157
  update: {
138
158
  outputMessage: "Knowledge Agent execution cancelled",
@@ -141,7 +161,7 @@ function g(e) {
141
161
  }
142
162
  })) : await e(a, i);
143
163
  }
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).
164
+ const O = () => new f(m).addNode("requireArcgisKnowledgeServices", V).addNode("agent", g(z)).addNode("tools", g(I)).addNode("summarizationLLM", g(j)).addEdge(x, "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), P = 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).
145
165
  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.
146
166
  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,
147
167
  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
@@ -179,13 +199,13 @@ _example: "Discover and add all the relationships originating at 'Entity E' to t
179
199
  _example: "Show me all entities with a name similar to 'Smith' and add them to the link chart"_
180
200
  _example: "Find reports in my graph that have a title similar to 'Quarterly Earnings'"_
181
201
  _example: "Find John Smith and all people he has made phone calls to in the last year"_
182
- _example: "What is the average age of all people who work for Esri?"_`, ee = {
202
+ _example: "What is the average age of all people who work for Esri?"_`, re = {
183
203
  id: "arcgisKnowledge",
184
204
  name: "ArcgisKnowledge Agent",
185
- description: I,
186
- createGraph: F,
205
+ description: P,
206
+ createGraph: O,
187
207
  workspace: m
188
208
  };
189
209
  export {
190
- ee as A
210
+ re as A
191
211
  };
@@ -3,9 +3,11 @@ import { StateGraph as I, START as k, END as v } from "@langchain/langgraph/web"
3
3
  import { g as T, O as R, P as C, t as N, Q as V, f as h, R as D, r as z, S as b, T as P } from "./adapter.js";
4
4
  import "@arcgis/core/identity/IdentityManager.js";
5
5
  import "@arcgis/core/portal/Portal.js";
6
- import { s as n, j as _, h as Q } from "./generateLayerDescriptions.js";
6
+ import { h as _, e as Q } from "./generateLayerDescriptions.js";
7
7
  import { AIMessage as j } from "@langchain/core/messages";
8
+ import { s as n } from "./index.js";
8
9
  import "@langchain/openai";
10
+ import "@arcgis/core/config.js";
9
11
  import "@arcgis/core/core/reactiveUtils.js";
10
12
  import "@arcgis/core/layers/FeatureLayer.js";
11
13
  import "@arcgis/core/request.js";
@@ -30,6 +32,7 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
30
32
  }, r = await _({
31
33
  promptText: d,
32
34
  modelTier: "advanced",
35
+ config: e,
33
36
  messages: t.dataExplorationMessages,
34
37
  inputVariables: o,
35
38
  tools: C
@@ -66,6 +69,7 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
66
69
  }, p = await _({
67
70
  promptText: d,
68
71
  modelTier: "advanced",
72
+ config: e,
69
73
  messages: t.dataExplorationMessages,
70
74
  inputVariables: m,
71
75
  tools: V
@@ -90,6 +94,7 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
90
94
  }, s = await Q({
91
95
  promptText: d,
92
96
  modelTier: "fast",
97
+ config: e,
93
98
  messages: t.dataExplorationMessages,
94
99
  inputVariables: l
95
100
  }), o = typeof s == "string" ? s : s.content, r = new j(o);
@@ -293,7 +298,7 @@ ${r}` : i = "Vector search completed. No matching layers found.", await n({ text
293
298
  This also includes questions that ask which feature meets a given condition or where a particular feature in the data is located (e.g., “Where is the spring with the highest elevation?”). However, this agent does not handle addresses.
294
299
  _Example: “How many features are there?”_
295
300
  _Example: “What’s the average population?”_
296
- _Example: “Which values are in the status field?”_`, Me = {
301
+ _Example: “Which values are in the status field?”_`, Re = {
297
302
  id: "dataExploration",
298
303
  name: "Data Exploration Agent",
299
304
  description: de,
@@ -301,5 +306,5 @@ ${r}` : i = "Vector search completed. No matching layers found.", await n({ text
301
306
  workspace: b
302
307
  };
303
308
  export {
304
- Me as D
309
+ Re as D
305
310
  };