@arcgis/ai-components 5.2.0-next.2 → 5.2.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.
Files changed (196) 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/LLMAgent.js +23 -22
  4. package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
  5. package/dist/agent-utils/index.d.ts +177 -0
  6. package/dist/agent-utils/index.js +167 -0
  7. package/dist/agent-utils/middlewares/trace.d.ts +2 -0
  8. package/dist/agent-utils/middlewares/trace.js +25 -33
  9. package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
  10. package/dist/agent-utils/types.d.ts +36 -7
  11. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
  12. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
  13. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
  14. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
  15. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
  16. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
  17. package/dist/cdn/27NEUQN3.js +2 -0
  18. package/dist/cdn/2NMR43NW.js +2 -0
  19. package/dist/cdn/3YMSOD5D.js +2 -0
  20. package/dist/cdn/434TAA3J.js +2 -0
  21. package/dist/cdn/4I4MCV7V.js +71 -0
  22. package/dist/cdn/4RZPOYZ7.js +9 -0
  23. package/dist/cdn/5SBLS4NW.js +2 -0
  24. package/dist/cdn/{AMP6IALT.js → 5W7S2RS4.js} +1 -1
  25. package/dist/cdn/6LZ6GOHF.js +56 -0
  26. package/dist/cdn/ADYIXCSG.js +2 -0
  27. package/dist/cdn/ASSH4WSC.js +36 -0
  28. package/dist/cdn/BFPMQT3A.js +2 -0
  29. package/dist/cdn/C7E7MJSR.js +2 -0
  30. package/dist/cdn/CAECQD75.js +2 -0
  31. package/dist/cdn/CIW3QMKV.js +2 -0
  32. package/dist/cdn/CJIV4KJZ.js +179 -0
  33. package/dist/cdn/CVHJMR5X.js +2 -0
  34. package/dist/cdn/DEAYZ3MK.js +2 -0
  35. package/dist/cdn/{H7422XUG.js → E2HENO3T.js} +1 -1
  36. package/dist/cdn/E7TMP4YV.js +3 -0
  37. package/dist/cdn/EBRNMPPO.js +48 -0
  38. package/dist/cdn/FWU6DFIB.js +2 -0
  39. package/dist/cdn/GJUD7EA3.js +3 -0
  40. package/dist/cdn/HCR23HJB.js +2 -0
  41. package/dist/cdn/HOCTVCHH.js +2 -0
  42. package/dist/cdn/I64KIZG3.js +2 -0
  43. package/dist/cdn/IB4WTK74.js +2 -0
  44. package/dist/cdn/IC5P5NYY.js +2 -0
  45. package/dist/cdn/ICA7JOSU.js +161 -0
  46. package/dist/cdn/IKEF7ZHH.js +181 -0
  47. package/dist/cdn/IXAKT6L3.js +2 -0
  48. package/dist/cdn/JEIMRNYM.js +2 -0
  49. package/dist/cdn/JN744CAW.js +2 -0
  50. package/dist/cdn/{NE7E52YR.js → KTK4HNL2.js} +8 -2
  51. package/dist/cdn/{4HU7735A.js → KTOL6IN7.js} +6 -4
  52. package/dist/cdn/L77BTGXY.js +2 -0
  53. package/dist/cdn/LODKJRS4.js +2 -0
  54. package/dist/cdn/M3SWPT3M.js +2 -0
  55. package/dist/cdn/MAV3DW27.js +4 -0
  56. package/dist/cdn/NOJYPREL.js +3 -0
  57. package/dist/cdn/NXKKG5TK.js +2 -0
  58. package/dist/cdn/O3F47IO5.js +2 -0
  59. package/dist/cdn/O7TGCM5P.js +6 -0
  60. package/dist/cdn/PBTINZTK.js +65 -0
  61. package/dist/cdn/PDEBKVBO.js +22 -0
  62. package/dist/cdn/PDT6I6TZ.js +2 -0
  63. package/dist/cdn/PSWI3MFB.js +2 -0
  64. package/dist/cdn/Q7TL5Q5N.js +2 -0
  65. package/dist/cdn/QSA4T3BU.js +2 -0
  66. package/dist/cdn/RMLXVQZ5.js +2 -0
  67. package/dist/cdn/ROLXMEVE.js +18 -0
  68. package/dist/cdn/RX45PCYB.js +9 -0
  69. package/dist/cdn/SMADRJ67.js +2 -0
  70. package/dist/cdn/{ZLXN7NMF.js → T537PKP4.js} +9 -7
  71. package/dist/cdn/{X2ZDYHCG.js → TNMXWUXU.js} +9 -4
  72. package/dist/cdn/U53OEX6L.js +2 -0
  73. package/dist/cdn/VDXSALQI.js +2 -0
  74. package/dist/cdn/VKU4WAQV.js +2 -0
  75. package/dist/cdn/W2JAKE2M.js +2 -0
  76. package/dist/cdn/WAVKMZA6.js +2 -0
  77. package/dist/cdn/WH6QQK6N.js +2 -0
  78. package/dist/cdn/WNS5ZUF5.js +2 -0
  79. package/dist/cdn/{FL4W4VYN.js → X7GE26KU.js} +16 -0
  80. package/dist/cdn/XGS5EIA5.js +14 -0
  81. package/dist/cdn/XVQJBUMY.js +2 -0
  82. package/dist/cdn/YJ3QQXF6.js +2 -0
  83. package/dist/cdn/YYY7HKYX.js +2 -0
  84. package/dist/cdn/ZEYIBYSF.js +66 -0
  85. package/dist/cdn/ZOSUDIJH.js +2 -0
  86. package/dist/cdn/ZPLFFLPF.js +2 -0
  87. package/dist/cdn/agent-utils/index.js +2 -0
  88. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  89. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  90. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  91. package/dist/cdn/index.js +1 -1
  92. package/dist/cdn/main.css +1 -1
  93. package/dist/chunks/adapter.js +1410 -1342
  94. package/dist/chunks/arcgisKnowledgeGraph.js +110 -72
  95. package/dist/chunks/converterUtils.js +39 -32
  96. package/dist/chunks/dataExplorationGraph.js +139 -113
  97. package/dist/chunks/data_explore_query_prompt.js +9 -4
  98. package/dist/chunks/generateLayerDescriptions.js +231 -191
  99. package/dist/chunks/helpGraph.js +17 -13
  100. package/dist/chunks/help_prompt.js +34 -17
  101. package/dist/chunks/index.js +11 -0
  102. package/dist/chunks/intent_prompt.js +16 -0
  103. package/dist/chunks/layerStylingGraph.js +24 -20
  104. package/dist/chunks/navigationGraph.js +33 -28
  105. package/dist/chunks/navigation_intent_prompt.js +8 -2
  106. package/dist/chunks/orchestrator.js +267 -226
  107. package/dist/chunks/slottableRequestUtils.js +3 -7
  108. package/dist/chunks/state.js +1 -1
  109. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  110. package/dist/chunks/toolCallResponse.js +12 -9
  111. package/dist/chunks/utils2.js +8 -8
  112. package/dist/components/arcgis-assistant/customElement.d.ts +27 -0
  113. package/dist/components/arcgis-assistant/customElement.js +385 -152
  114. package/dist/components/arcgis-assistant/index.js +2 -3
  115. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  116. package/dist/components/arcgis-assistant-agent/customElement.js +5 -1
  117. package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
  118. package/dist/components/arcgis-assistant-chat/customElement.js +23 -18
  119. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
  120. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  121. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +11 -5
  122. package/dist/components/arcgis-assistant-help-agent/customElement.js +8 -2
  123. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
  124. package/dist/components/arcgis-assistant-interrupt/customElement.js +12 -8
  125. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  126. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  127. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  128. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +17 -11
  129. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +10 -4
  130. package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
  131. package/dist/components/arcgis-assistant-message/customElement.js +28 -26
  132. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  133. package/dist/components/arcgis-assistant-message/index.js +2 -0
  134. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  135. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  136. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  137. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  138. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  139. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
  140. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
  141. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  142. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  143. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  144. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +5 -1
  145. package/dist/components/arcgis-assistant-message-text/customElement.js +12 -12
  146. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +11 -5
  147. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  148. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  149. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  150. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
  151. package/dist/components/arcgis-assistant-user-message/customElement.js +10 -8
  152. package/dist/docs/api.json +1 -1
  153. package/dist/docs/docs.json +1 -1
  154. package/dist/docs/vscode.html-custom-data.json +1 -1
  155. package/dist/docs/web-types.json +1 -1
  156. package/dist/index.d.ts +4 -0
  157. package/dist/loader.js +7 -6
  158. package/dist/types/lumina.d.ts +11 -5
  159. package/dist/types/preact.d.ts +12 -5
  160. package/dist/types/react.d.ts +13 -5
  161. package/dist/types/stencil.d.ts +11 -5
  162. package/dist/utils/index.d.ts +85 -42
  163. package/dist/utils/index.js +54 -49
  164. package/package.json +8 -7
  165. package/dist/cdn/2AXF774U.js +0 -2
  166. package/dist/cdn/3PKJWIC3.js +0 -2
  167. package/dist/cdn/462JBSEV.js +0 -422
  168. package/dist/cdn/7BCR6TUO.js +0 -2
  169. package/dist/cdn/7GH7VSB2.js +0 -2
  170. package/dist/cdn/7PLV4QH6.js +0 -2
  171. package/dist/cdn/AO7BQHKC.js +0 -2
  172. package/dist/cdn/DDLZOMUY.js +0 -2
  173. package/dist/cdn/DHOVCT6R.js +0 -2
  174. package/dist/cdn/F2AHA4GB.js +0 -54
  175. package/dist/cdn/FHVXO2WG.js +0 -166
  176. package/dist/cdn/FX5JFRDL.js +0 -2
  177. package/dist/cdn/GSEPHN3A.js +0 -106
  178. package/dist/cdn/HB5A5R2E.js +0 -2
  179. package/dist/cdn/JY6LLOUJ.js +0 -22
  180. package/dist/cdn/MDVYQQUG.js +0 -14
  181. package/dist/cdn/MH5RPXHM.js +0 -2
  182. package/dist/cdn/NAUXSHIE.js +0 -72
  183. package/dist/cdn/NVI3I46B.js +0 -2
  184. package/dist/cdn/OAVEHGB6.js +0 -2
  185. package/dist/cdn/OH64RMOR.js +0 -4
  186. package/dist/cdn/ON2V5XI2.js +0 -3
  187. package/dist/cdn/P6OPJQMC.js +0 -3
  188. package/dist/cdn/QR54T33D.js +0 -2
  189. package/dist/cdn/RVOAPUBN.js +0 -2
  190. package/dist/cdn/S6W6HV4T.js +0 -36
  191. package/dist/cdn/SXDLXCIM.js +0 -2
  192. package/dist/cdn/USMDJUFS.js +0 -2
  193. package/dist/cdn/V2P4AIGG.js +0 -2
  194. package/dist/cdn/V5YEZSRY.js +0 -16
  195. package/dist/cdn/Y333DGV6.js +0 -2
  196. package/dist/cdn/YY2SBO3V.js +0 -2
@@ -1,130 +1,168 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/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 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, g as u, h as M, t as c, r as S, 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 q, s as c, h as C } from "./generateLayerDescriptions.js";
7
- import { AIMessage as E } from "@langchain/core/messages";
6
+ import "@arcgis/toolkit/string";
7
+ import { h as G, e as N } from "./generateLayerDescriptions.js";
8
+ import { AIMessage as R } from "@langchain/core/messages";
8
9
  import "@langchain/core/callbacks/dispatch/web";
9
10
  import "@langchain/openai";
11
+ import "@arcgis/core/config.js";
10
12
  import "@arcgis/core/core/reactiveUtils.js";
11
13
  import "@arcgis/core/layers/FeatureLayer.js";
12
14
  import "@arcgis/core/request.js";
13
- import { ToolNode as G } from "@langchain/langgraph/prebuilt";
15
+ import { ToolNode as L } from "@langchain/langgraph/prebuilt";
16
+ import { s as p, a as D } from "./index.js";
14
17
  import "@langchain/core/prompts";
15
- const m = [
16
- f,
17
- x,
18
- k,
19
- _,
18
+ const w = [
20
19
  b,
20
+ _,
21
21
  K,
22
- v
22
+ A,
23
+ T,
24
+ v,
25
+ q
23
26
  ];
24
- async function R(e, o) {
25
- const l = await p("arcgis_knowledge_tool_prompt"), a = A(o), r = {
27
+ async function z(e, a) {
28
+ const i = await u("arcgis_knowledge_tool_prompt"), o = M(a), n = {
26
29
  assignedTask: e.agentExecutionContext.assignedTask,
27
30
  userRequest: e.agentExecutionContext.userRequest,
28
31
  priorSteps: e.agentExecutionContext.priorSteps,
29
- contextType: a
30
- }, n = await q({
31
- promptText: l,
32
+ contextType: o
33
+ }, s = await G({
34
+ promptText: i,
32
35
  messages: e.arcgisKnowledgeMessages,
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") ? {
36
+ inputVariables: n,
37
+ tools: w
38
+ }), l = (s.tool_calls?.length ?? 0) > 0, t = typeof s.text == "string" ? s.text.trim() : "", r = t.length > 0, d = s.content.toString();
39
+ return !l && (o === "map" || o === "knowledgeGraph") ? {
37
40
  ...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.",
41
+ arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, s],
42
+ 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
43
  status: "success"
41
44
  } : {
42
45
  ...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."
46
+ arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, s],
47
+ outputMessage: l ? d : t,
48
+ status: l ? e.status : r ? "success" : "failed",
49
+ summary: d ? c(d) : "ArcGIS Knowledge Agent tool executed."
50
+ };
51
+ }
52
+ const y = {
53
+ generateCypher: "generated-cypher-query",
54
+ queryGraphData: "graph-query-result",
55
+ searchGraphData: "graph-search-result",
56
+ addRecords: "added-records",
57
+ applyLayout: "applied-layout",
58
+ changeNonspatialVisibility: "changed-nonspatial-visibility",
59
+ createLinkChart: "created-link-chart"
60
+ };
61
+ function F(e) {
62
+ return !!e && e.status === "success" && !!y[e.toolName];
63
+ }
64
+ function $(e) {
65
+ return {
66
+ type: y[e.toolName],
67
+ data: e.details
47
68
  };
48
69
  }
49
- async function N(e, o) {
50
- const l = new G(m);
70
+ async function I(e, a) {
71
+ const i = new L(w, { handleToolErrors: !1 });
51
72
  try {
52
- const a = await l.invoke(
73
+ const o = await i.invoke(
53
74
  {
54
75
  messages: e.arcgisKnowledgeMessages
55
76
  },
56
- o
57
- ), r = [];
58
- for (const t of a.messages) {
59
- let s;
77
+ a
78
+ ), n = [];
79
+ for (const t of o.messages) {
80
+ let r;
60
81
  if (typeof t.content != "string")
61
82
  throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);
62
83
  try {
63
- s = JSON.parse(t.content);
84
+ r = JSON.parse(t.content);
64
85
  } catch {
65
- throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name ?? "unknown"}`);
86
+ throw new Error(
87
+ `Failed to parse tool message content as JSON. Tool: ${t.name ?? "unknown"}.
88
+
89
+ Original Content: ${t.content}`
90
+ );
66
91
  }
67
- if (!s || typeof s != "object" || !("toolName" in s))
92
+ if (!r || typeof r != "object" || !("toolName" in r))
68
93
  throw new Error(
69
- `Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(s)}`
94
+ `Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(r)}`
70
95
  );
71
- r.push(s);
96
+ n.push(r);
72
97
  }
73
- await c(
98
+ await p(
74
99
  {
75
- text: `Finished executing ArcGIS Knowledge Agent tools: ${a.messages.filter((t) => t.name).map((t) => t.name).join(", ")}`
100
+ text: `Finished executing ArcGIS Knowledge Agent tools: ${o.messages.filter((t) => t.name).map((t) => t.name).join(", ")}`
76
101
  },
77
- o
102
+ a
78
103
  );
79
- const n = r.filter((t) => typeof t != "string").map((t) => `- Called Tool: ${t.toolName}, Status: ${t.status}`);
80
- return {
104
+ const s = n.filter((t) => typeof t != "string").map((t) => `- Called Tool: ${t.toolName}, Status: ${t.status}`), l = n[0];
105
+ return l && F(l) && await D($(l), a), {
81
106
  ...e,
82
- outputMessage: n.join(`
107
+ outputMessage: s.join(`
83
108
  `),
84
- summary: n.length ? g(n.join(`
109
+ summary: s.length ? c(s.join(`
85
110
  `)) : "ArcGIS Knowledge Agent did not execute any tools or return any results.",
86
- arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, ...a.messages],
87
- arcgisKnowledgeToolResult: r
111
+ arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, ...o.messages],
112
+ arcgisKnowledgeToolResult: n
88
113
  };
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), {
114
+ } catch (o) {
115
+ const n = o instanceof Error ? o.message : String(o);
116
+ return await p(
117
+ { text: `ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}` },
118
+ a
119
+ ), {
92
120
  ...e,
93
- outputMessage: `ArcGIS Knowledge Agent tool execution failed: ${r}`,
121
+ outputMessage: `ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}`,
94
122
  status: "failed",
95
- summary: `ArcGIS Knowledge Agent tool execution failed: ${r}`,
123
+ summary: c(`ArcGIS Knowledge Agent tool execution failed unexpectedly: ${n}`),
96
124
  arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages]
97
125
  };
98
126
  }
99
127
  }
100
- const L = (e, o) => (
128
+ const V = (e, a) => (
101
129
  //agent services (ex: embeddingsWorker) would go in the array below, if required.
102
- M([], "ArcgisKnowledge Agent")(e, o)
130
+ S([], "ArcgisKnowledge Agent")(e, a)
103
131
  );
104
- async function z(e, o) {
105
- const a = (e.arcgisKnowledgeToolResult ?? []).map((d) => ({
132
+ async function j(e, a) {
133
+ const o = (e.arcgisKnowledgeToolResult ?? []).map((d) => ({
106
134
  ...d,
107
135
  details: void 0
108
136
  // Remove details to avoid overwhelming the LLM with too much info
109
- })), { knowledgeGraph: r } = await S(o), n = T.getDataModelTypesSummary(r.dataModel), t = {
137
+ })), { knowledgeGraph: n } = await C(a), s = E.getDataModelTypesSummary(n.dataModel), l = {
110
138
  assignedTask: e.agentExecutionContext.assignedTask,
111
139
  userRequest: e.agentExecutionContext.userRequest,
112
- toolResult: a,
113
- dataModelSummary: n
114
- }, s = await C({
115
- promptText: await p("arcgis_knowledge_summarize_result_prompt"),
140
+ toolResult: o,
141
+ dataModelSummary: s
142
+ }, t = await N({
143
+ promptText: await u("arcgis_knowledge_summarize_result_prompt"),
116
144
  modelTier: "default",
117
- inputVariables: t
118
- }), i = typeof s == "string" ? s : s.content;
145
+ inputVariables: l
146
+ }), r = typeof t == "string" ? t : t.content;
119
147
  return {
120
148
  ...e,
121
- outputMessage: i,
149
+ outputMessage: r,
122
150
  status: "success",
123
- summary: g(i),
124
- arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, new E(i)]
151
+ summary: c(r),
152
+ arcgisKnowledgeMessages: [...e.arcgisKnowledgeMessages, new R(r)]
125
153
  };
126
154
  }
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).
155
+ function g(e) {
156
+ return async (a, i) => i?.signal?.aborted ? (await p({ text: "Knowledge Agent execution cancelled" }, i), new k({
157
+ goto: h,
158
+ update: {
159
+ outputMessage: "Knowledge Agent execution cancelled",
160
+ summary: "Knowledge Agent execution cancelled",
161
+ status: "failed"
162
+ }
163
+ })) : await e(a, i);
164
+ }
165
+ 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).
128
166
  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
167
  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
168
  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 +200,13 @@ _example: "Discover and add all the relationships originating at 'Entity E' to t
162
200
  _example: "Show me all entities with a name similar to 'Smith' and add them to the link chart"_
163
201
  _example: "Find reports in my graph that have a title similar to 'Quarterly Earnings'"_
164
202
  _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 = {
203
+ _example: "What is the average age of all people who work for Esri?"_`, ie = {
166
204
  id: "arcgisKnowledge",
167
205
  name: "ArcgisKnowledge Agent",
168
- description: F,
169
- createGraph: D,
170
- workspace: u
206
+ description: P,
207
+ createGraph: O,
208
+ workspace: m
171
209
  };
172
210
  export {
173
- W as A
211
+ ie as A
174
212
  };
@@ -36,68 +36,74 @@ function x(e) {
36
36
  return null;
37
37
  for (let r = A(e, 0); r !== -1; r = A(e, r + 1)) {
38
38
  let a = 0, c = 0;
39
- for (let l = r; l < e.length; l++) {
40
- const n = e[l];
41
- if (n === "{" ? a++ : n === "}" ? a-- : n === "[" ? c++ : n === "]" && c--, a < 0 || c < 0)
39
+ for (let n = r; n < e.length; n++) {
40
+ const l = e[n];
41
+ if (l === "{" ? a++ : l === "}" ? a-- : l === "[" ? c++ : l === "]" && c--, a < 0 || c < 0)
42
42
  break;
43
- if (a === 0 && c === 0 && l > r)
44
- return e.slice(r, l + 1);
43
+ if (a === 0 && c === 0 && n > r)
44
+ return e.slice(r, n + 1);
45
45
  }
46
46
  }
47
47
  return null;
48
48
  }
49
- function H(e) {
49
+ function O(e) {
50
50
  if (!e)
51
51
  return "";
52
52
  let t = e;
53
53
  const r = x(e);
54
54
  if (r)
55
55
  try {
56
- const l = JSON.parse(r), f = `
56
+ const c = JSON.parse(r), l = `
57
57
 
58
58
  \`\`\`json
59
- ${JSON.stringify(l, null, 2)}
59
+ ${JSON.stringify(c, null, 2)}
60
60
  \`\`\`
61
61
 
62
62
  `;
63
- t = e.replace(r, f);
63
+ t = e.replace(r, l);
64
64
  } catch {
65
65
  }
66
- const a = q(t), c = E(a);
67
- return T(c);
66
+ const a = E(t);
67
+ return q(a);
68
68
  }
69
69
  function q(e) {
70
- return e ? S.parse(e, { async: !1 }) : "";
70
+ if (!e)
71
+ return "";
72
+ const t = M(e);
73
+ return T(t);
71
74
  }
72
75
  function E(e) {
76
+ return e ? S.parse(e, { async: !1 }) : "";
77
+ }
78
+ function M(e) {
73
79
  if (!e || typeof DOMParser > "u")
74
80
  return e;
75
81
  try {
76
82
  const t = new DOMParser().parseFromString(e, "text/html");
77
83
  return Array.from(t.querySelectorAll("table")).forEach((a, c) => {
78
- const l = t.createElement("calcite-table");
79
- l.setAttribute("caption", `Table ${c + 1}`), l.setAttribute("striped", "true");
80
- const n = a.querySelector("thead");
81
- if (n) {
82
- const d = Array.from(n.querySelectorAll("tr"));
83
- for (const h of d) {
84
+ const n = t.createElement("calcite-table");
85
+ n.setAttribute("caption", `Table ${c + 1}`), n.setAttribute("striped", "true");
86
+ const l = a.querySelector("thead");
87
+ if (l) {
88
+ const d = Array.from(l.querySelectorAll("tr"));
89
+ for (const u of d) {
84
90
  const o = t.createElement("calcite-table-row");
85
91
  o.setAttribute("slot", "table-header");
86
- const u = Array.from(h.querySelectorAll("th, td"));
87
- for (const b of u) {
88
- const s = (b.textContent ?? "").trim(), i = t.createElement("calcite-table-header");
92
+ const f = Array.from(u.querySelectorAll("th, td"));
93
+ for (const h of f) {
94
+ const s = (h.textContent ?? "").trim(), i = t.createElement("calcite-table-header");
89
95
  i.setAttribute("heading", s), o.appendChild(i);
90
96
  }
91
- l.appendChild(o);
97
+ n.appendChild(o);
92
98
  }
93
99
  }
94
- const f = a.querySelector("tbody");
95
- (f ? Array.from(f.querySelectorAll("tr")) : Array.from(a.querySelectorAll("tr")).filter((d) => !n?.contains(d))).forEach((d, h) => {
96
- const o = t.createElement("calcite-table-row"), u = !n && h === 0 && d.querySelectorAll("th").length > 0;
97
- u && o.setAttribute("slot", "table-header");
98
- const b = Array.from(d.querySelectorAll("th, td"));
99
- for (const s of b) {
100
- if (u && s.localName === "th") {
100
+ const b = a.querySelector("tbody");
101
+ (b ? Array.from(b.querySelectorAll("tr")) : Array.from(a.querySelectorAll("tr")).filter((d) => !l?.contains(d))).forEach((d, u) => {
102
+ const o = t.createElement("calcite-table-row"), f = !l && u === 0 && d.querySelectorAll("th").length > 0;
103
+ f && o.setAttribute("slot", "table-header");
104
+ const h = Array.from(d.querySelectorAll("th, td"));
105
+ for (const s of h) {
106
+ if (f && s.localName === "th") {
101
107
  const w = (s.textContent ?? "").trim(), y = t.createElement("calcite-table-header");
102
108
  y.setAttribute("heading", w), o.appendChild(y);
103
109
  return;
@@ -105,13 +111,14 @@ function E(e) {
105
111
  const i = t.createElement("calcite-table-cell"), p = s.getAttribute("colspan"), m = s.getAttribute("rowspan");
106
112
  p && i.setAttribute("colspan", p), m && i.setAttribute("rowspan", m), i.innerHTML = s.innerHTML, o.appendChild(i);
107
113
  }
108
- l.appendChild(o);
109
- }), a.replaceWith(l);
114
+ n.appendChild(o);
115
+ }), a.replaceWith(n);
110
116
  }), t.body.innerHTML;
111
117
  } catch {
112
118
  return e;
113
119
  }
114
120
  }
115
121
  export {
116
- H as p
122
+ q as a,
123
+ O as p
117
124
  };