@arcgis/ai-components 5.2.0-next.71 → 5.2.0-next.73

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 (167) hide show
  1. package/LICENSE.md +4 -2
  2. package/dist/agent-utils/LLMAgent.d.ts +5 -2
  3. package/dist/agent-utils/LLMAgent.js +1 -1
  4. package/dist/agent-utils/types.d.ts +1 -1
  5. package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
  6. package/dist/agentic-workflow/Edge.d.ts +16 -0
  7. package/dist/agentic-workflow/WebAgent.d.ts +39 -0
  8. package/dist/agentic-workflow/jsonTypes.d.ts +193 -0
  9. package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -0
  10. package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
  11. package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
  12. package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
  13. package/dist/agentic-workflow/nodes/support/Prompt.d.ts +20 -0
  14. package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
  15. package/dist/agentic-workflow/types.d.ts +29 -0
  16. package/dist/cdn/2EJROB32.js +2 -0
  17. package/dist/cdn/34O57OGV.js +2 -0
  18. package/dist/cdn/3LXXSMA5.js +2 -0
  19. package/dist/cdn/3MJQA533.js +2 -0
  20. package/dist/cdn/3U476GCP.js +5 -0
  21. package/dist/cdn/3XXZUQMQ.js +2 -0
  22. package/dist/cdn/4YDXYW4J.js +2 -0
  23. package/dist/cdn/4ZUUS4DH.js +2 -0
  24. package/dist/cdn/527C4GD2.js +36 -0
  25. package/dist/cdn/5RZGG4F2.js +2 -0
  26. package/dist/cdn/5SF6DEMO.js +2 -0
  27. package/dist/cdn/5Y6TQAJN.js +2 -0
  28. package/dist/cdn/65IWA2PM.js +2 -0
  29. package/dist/cdn/{MW5S2XCB.js → 67YCNNCN.js} +2 -2
  30. package/dist/cdn/6FKLWNGA.js +2 -0
  31. package/dist/cdn/6QJFOL6M.js +2 -0
  32. package/dist/cdn/6RDKDLSX.js +2 -0
  33. package/dist/cdn/6SGNSDLY.js +2 -0
  34. package/dist/cdn/7747YL7V.js +2 -0
  35. package/dist/cdn/7TO56JHS.js +2 -0
  36. package/dist/cdn/ABXLPDEK.js +2 -0
  37. package/dist/cdn/BBJDW6GC.js +2 -0
  38. package/dist/cdn/{PUFTYLJ2.js → C4FKFOU4.js} +4 -4
  39. package/dist/cdn/CCC6LBMY.js +2 -0
  40. package/dist/cdn/CGVVL52C.js +2 -0
  41. package/dist/cdn/DBHLKLKM.js +2 -0
  42. package/dist/cdn/DKLK4EUE.js +2 -0
  43. package/dist/cdn/E25RINU2.js +2 -0
  44. package/dist/cdn/E62P76TP.js +2 -0
  45. package/dist/cdn/E7JLG2A2.js +2 -0
  46. package/dist/cdn/{TFT6HK3O.js → E7KEOJZG.js} +1 -1
  47. package/dist/cdn/FDOMMK2M.js +2 -0
  48. package/dist/cdn/FSMHR7GK.js +2 -0
  49. package/dist/cdn/GG3AESSV.js +2 -0
  50. package/dist/cdn/H6JSNAT4.js +2 -0
  51. package/dist/cdn/HNMFFLSY.js +2 -0
  52. package/dist/cdn/HO2YDJI2.js +6 -0
  53. package/dist/cdn/{KQHLOYKL.js → I4L45WQS.js} +1 -1
  54. package/dist/cdn/ITBQGOMF.js +11 -0
  55. package/dist/cdn/JH6EAWB2.js +2 -0
  56. package/dist/cdn/JON2JHS2.js +2 -0
  57. package/dist/cdn/JWPB3XZM.js +2 -0
  58. package/dist/cdn/JXB4TNSG.js +2 -0
  59. package/dist/cdn/JYVBCHR6.js +6 -0
  60. package/dist/cdn/KRN6AFNB.js +18 -0
  61. package/dist/cdn/KZACIY2W.js +2 -0
  62. package/dist/cdn/MKJS7QYQ.js +2 -0
  63. package/dist/cdn/N735LT4S.js +2 -0
  64. package/dist/cdn/NP7DG7LQ.js +2 -0
  65. package/dist/cdn/NTZAOJH5.js +2 -0
  66. package/dist/cdn/{CXW5URTF.js → OHMNQ3RU.js} +5 -5
  67. package/dist/cdn/ONQ6JSBJ.js +2 -0
  68. package/dist/cdn/PAUIFUMO.js +2 -0
  69. package/dist/cdn/QNNGPA3Q.js +2 -0
  70. package/dist/cdn/RATZTLNX.js +2 -0
  71. package/dist/cdn/RU5DVLYG.js +156 -0
  72. package/dist/cdn/{YHQJ66WJ.js → S3XUYAUX.js} +1 -1
  73. package/dist/cdn/S6ZAQRC6.js +2 -0
  74. package/dist/cdn/SABZC4D4.js +2 -0
  75. package/dist/cdn/TYL5G7KR.js +2 -0
  76. package/dist/cdn/{XETNZW4D.js → UAZLKUFN.js} +1 -1
  77. package/dist/cdn/UZL6UVE4.js +2 -0
  78. package/dist/cdn/VBZ5XGAM.js +2 -0
  79. package/dist/cdn/VXBUMZYR.js +2 -0
  80. package/dist/cdn/W5FLNFSN.js +2 -0
  81. package/dist/cdn/W5J4Q3RO.js +14 -0
  82. package/dist/cdn/WQKNV6KK.js +2 -0
  83. package/dist/cdn/{ICYUPLZM.js → WZFC5HUX.js} +1 -1
  84. package/dist/cdn/XGBEHER5.js +2 -0
  85. package/dist/cdn/XPTCV6YV.js +2 -0
  86. package/dist/cdn/Y5UFOH54.js +2 -0
  87. package/dist/cdn/YGCTAIBS.js +2 -0
  88. package/dist/cdn/{SXHH575T.js → ZJEWP2ND.js} +20 -24
  89. package/dist/cdn/agent-utils/index.js +1 -1
  90. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
  91. package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
  92. package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
  93. package/dist/cdn/index.js +1 -1
  94. package/dist/chunks/adapter.js +939 -1950
  95. package/dist/chunks/adapter10.js +21 -0
  96. package/dist/chunks/adapter11.js +30 -0
  97. package/dist/chunks/adapter12.js +22 -0
  98. package/dist/chunks/adapter13.js +22 -0
  99. package/dist/chunks/adapter14.js +109 -0
  100. package/dist/chunks/adapter15.js +40 -0
  101. package/dist/chunks/adapter16.js +154 -0
  102. package/dist/chunks/adapter17.js +141 -0
  103. package/dist/chunks/adapter18.js +127 -0
  104. package/dist/chunks/adapter2.js +52 -0
  105. package/dist/chunks/adapter3.js +30 -0
  106. package/dist/chunks/adapter4.js +50 -0
  107. package/dist/chunks/adapter5.js +27 -0
  108. package/dist/chunks/adapter6.js +24 -0
  109. package/dist/chunks/adapter7.js +26 -0
  110. package/dist/chunks/adapter8.js +21 -0
  111. package/dist/chunks/adapter9.js +42 -0
  112. package/dist/chunks/arcgisKnowledgeGraph.js +5 -5
  113. package/dist/chunks/baseAgentState.js +56 -0
  114. package/dist/chunks/dataExplorationGraph.js +34 -31
  115. package/dist/chunks/fetchAgentContext.js +13 -0
  116. package/dist/chunks/fetchService.js +10 -0
  117. package/dist/chunks/formatFeatureAttributes.js +132 -0
  118. package/dist/chunks/generateLayerDescriptions.js +189 -235
  119. package/dist/chunks/helpGraph.js +11 -9
  120. package/dist/chunks/layerStylingGraph.js +22 -21
  121. package/dist/chunks/mergeWhereClauses.js +15 -0
  122. package/dist/chunks/navigationGraph.js +81 -70
  123. package/dist/chunks/orchestrator.js +1 -1
  124. package/dist/chunks/state.js +20 -26
  125. package/dist/chunks/types.js +59 -0
  126. package/dist/chunks/utils2.js +3 -3
  127. package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
  128. package/dist/components/arcgis-assistant-agent/customElement.js +636 -10
  129. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +15 -5
  130. package/dist/components/arcgis-assistant-help-agent/customElement.js +21 -5
  131. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +39 -22
  132. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +22 -5
  133. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +13 -5
  134. package/dist/docs/api.json +1 -1
  135. package/dist/docs/docs.json +1 -1
  136. package/dist/docs/vscode.html-custom-data.json +1 -1
  137. package/dist/docs/web-types.json +1 -1
  138. package/dist/loader.js +1 -1
  139. package/dist/types/lumina.d.ts +1 -1
  140. package/dist/types/preact.d.ts +1 -1
  141. package/dist/types/react.d.ts +1 -1
  142. package/dist/types/stencil.d.ts +1 -1
  143. package/dist/utils/index.js +26 -25
  144. package/package.json +4 -4
  145. package/dist/cdn/3DJDRAGV.js +0 -2
  146. package/dist/cdn/4CEMUECT.js +0 -2
  147. package/dist/cdn/4PCAK3ET.js +0 -2
  148. package/dist/cdn/57OMVTIU.js +0 -2
  149. package/dist/cdn/6U7TEAAJ.js +0 -2
  150. package/dist/cdn/BE7ZN5FZ.js +0 -2
  151. package/dist/cdn/BNSJO6X2.js +0 -2
  152. package/dist/cdn/CMDRED5H.js +0 -2
  153. package/dist/cdn/DTIVDIDY.js +0 -2
  154. package/dist/cdn/E5ZKBC24.js +0 -36
  155. package/dist/cdn/GP6NDTUE.js +0 -18
  156. package/dist/cdn/HBLRVXEB.js +0 -2
  157. package/dist/cdn/HQXPPYMD.js +0 -2
  158. package/dist/cdn/IEHPNCTL.js +0 -2
  159. package/dist/cdn/LHLO6PTD.js +0 -2
  160. package/dist/cdn/OWXCOUIQ.js +0 -2
  161. package/dist/cdn/PVE7Q43N.js +0 -2
  162. package/dist/cdn/ST5FQYT7.js +0 -180
  163. package/dist/cdn/WUNCZOGU.js +0 -2
  164. package/dist/cdn/WVPU4QOO.js +0 -2
  165. package/dist/cdn/WXWO5D3W.js +0 -2
  166. package/dist/cdn/XCRR2EEG.js +0 -6
  167. package/dist/cdn/ZS6SXJP2.js +0 -2
@@ -1,23 +1,649 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { c as t } from "../../chunks/runtime.js";
3
- import { LitElement as s } from "@arcgis/lumina";
4
- import { i as e, a as i } from "../../chunks/utils2.js";
5
- class n extends s {
2
+ import { c as W } from "../../chunks/runtime.js";
3
+ import { LitElement as L } from "@arcgis/lumina";
4
+ import { b as G, i as z } from "../../chunks/utils2.js";
5
+ import J from "@arcgis/core/portal/PortalItem.js";
6
+ import j from "@arcgis/core/portal/Portal.js";
7
+ import { property as n, subclass as l } from "@arcgis/core/core/accessorSupport/decorators.js";
8
+ import { BaseAgent as B } from "../../agent-utils/BaseAgent.js";
9
+ import v from "@arcgis/core/core/Error.js";
10
+ import { z as c } from "zod";
11
+ import { c as Z } from "../../chunks/graph.js";
12
+ import O from "@arcgis/core/core/Accessor.js";
13
+ import { LLMAgent as H } from "../../agent-utils/LLMAgent.js";
14
+ import { PromptTemplate as U } from "@langchain/core/prompts";
15
+ import { Annotation as C } from "@langchain/langgraph";
16
+ import { b as V, d as K } from "../../chunks/state.js";
17
+ import "@arcgis/core/identity/IdentityManager.js";
18
+ import "@arcgis/core/request.js";
19
+ import "@langchain/langgraph/web";
20
+ import "@arcgis/toolkit/string";
21
+ import "../../chunks/generateLayerDescriptions.js";
22
+ import "@langchain/core/messages";
23
+ import "@langchain/core/callbacks/dispatch/web";
24
+ import "@langchain/openai";
25
+ import "@arcgis/core/config.js";
26
+ import "@arcgis/core/core/reactiveUtils.js";
27
+ import "@arcgis/core/layers/FeatureLayer.js";
28
+ import { a as Q } from "../../chunks/baseAgentState.js";
29
+ var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, _ = (t, e, r, s) => {
30
+ for (var o = s > 1 ? void 0 : s ? Y(e, r) : e, a = t.length - 1, i; a >= 0; a--)
31
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
32
+ return s && o && X(e, r, o), o;
33
+ };
34
+ let p = class extends O {
35
+ //#region Lifecycle
36
+ constructor(t) {
37
+ super(t);
38
+ }
39
+ //#endregion
40
+ //#region Public Methods
41
+ static fromJSON(t) {
42
+ return new p({
43
+ id: t.id,
44
+ sourceAnchorId: t.source_anchor_id,
45
+ sourceNodeId: t.source_node_id,
46
+ targetAnchorId: t.target_anchor_id,
47
+ targetNodeId: t.target_node_id
48
+ });
49
+ }
50
+ //#endregion
51
+ };
52
+ _([
53
+ n()
54
+ ], p.prototype, "id", 2);
55
+ _([
56
+ n()
57
+ ], p.prototype, "sourceAnchorId", 2);
58
+ _([
59
+ n()
60
+ ], p.prototype, "sourceNodeId", 2);
61
+ _([
62
+ n()
63
+ ], p.prototype, "targetAnchorId", 2);
64
+ _([
65
+ n()
66
+ ], p.prototype, "targetNodeId", 2);
67
+ p = _([
68
+ l("Edge")
69
+ ], p);
70
+ var k = Object.defineProperty, tt = Object.getOwnPropertyDescriptor, N = (t, e, r, s) => {
71
+ for (var o = s > 1 ? void 0 : s ? tt(e, r) : e, a = t.length - 1, i; a >= 0; a--)
72
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
73
+ return s && o && k(e, r, o), o;
74
+ };
75
+ let m = class extends O {
76
+ //#region Lifecycle
77
+ constructor(t) {
78
+ super(t);
79
+ }
80
+ //#endregion
81
+ //#region Public Methods
82
+ async load() {
83
+ return await Promise.resolve(this);
84
+ }
85
+ compile(t) {
86
+ return {
87
+ runtimeNode: this.createRuntimeNode(),
88
+ edges: t.outgoingEdges.map((e) => ({
89
+ from: this.id,
90
+ to: e.targetNodeId
91
+ }))
92
+ };
93
+ }
94
+ static fromJSON(t) {
95
+ throw new Error("BaseNode is abstract and cannot be instantiated directly.");
96
+ }
97
+ //#endregion
98
+ //#region Private Methods
99
+ //#endregion
100
+ };
101
+ N([
102
+ n()
103
+ ], m.prototype, "id", 2);
104
+ N([
105
+ n()
106
+ ], m.prototype, "label", 2);
107
+ N([
108
+ n()
109
+ ], m.prototype, "type", 2);
110
+ m = N([
111
+ l("BaseNode")
112
+ ], m);
113
+ var et = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, T = (t, e, r, s) => {
114
+ for (var o = s > 1 ? void 0 : s ? ot(e, r) : e, a = t.length - 1, i; a >= 0; a--)
115
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
116
+ return s && o && et(e, r, o), o;
117
+ };
118
+ let u = class extends O {
119
+ //#region Lifecycle
120
+ constructor(t) {
121
+ super(t), this.messages = [];
122
+ }
123
+ //#endregion
124
+ //#region Public Methods
125
+ static fromJSON(t) {
126
+ const e = u._normalizeMessages(t.messages);
127
+ return new u({ id: t.id, messages: e });
128
+ }
129
+ //#endregion
130
+ //#region Private Methods
131
+ static _normalizeMessages(t) {
132
+ return Array.isArray(t) ? t.filter(
133
+ (e) => typeof e.content == "string"
134
+ ).map((e) => ({
135
+ content: e.content,
136
+ role: e.role ?? "system"
137
+ })) : [];
138
+ }
139
+ //#endregion
140
+ };
141
+ T([
142
+ n()
143
+ ], u.prototype, "id", 2);
144
+ T([
145
+ n()
146
+ ], u.prototype, "messages", 2);
147
+ u = T([
148
+ l("Prompt")
149
+ ], u);
150
+ function I(t) {
151
+ const e = new Set(t.required), r = Object.fromEntries(
152
+ Object.entries(t.properties).map(([s, o]) => {
153
+ const a = D(o);
154
+ return [s, e.has(s) ? a : a.optional()];
155
+ })
156
+ );
157
+ return c.object(r);
158
+ }
159
+ function D(t) {
160
+ let e;
161
+ switch (t.type) {
162
+ case "array":
163
+ e = c.array(t.items ? D(t.items) : c.unknown());
164
+ break;
165
+ case "boolean":
166
+ e = c.boolean();
167
+ break;
168
+ case "number":
169
+ e = c.number();
170
+ break;
171
+ case "object":
172
+ e = I({
173
+ properties: t.properties ?? {},
174
+ required: t.required
175
+ });
176
+ break;
177
+ case "string":
178
+ e = t.enum?.length ? c.enum(t.enum) : c.string();
179
+ break;
180
+ }
181
+ return t.description ? e.describe(t.description) : e;
182
+ }
183
+ const rt = /* @__PURE__ */ new Map([
184
+ [
185
+ "clear_filters",
186
+ async () => (await import("../../chunks/adapter12.js")).clearFiltersTool
187
+ ],
188
+ [
189
+ "reset_map",
190
+ async () => (await import("../../chunks/adapter13.js")).resetMapTool
191
+ ],
192
+ [
193
+ "set_feature_effect",
194
+ async () => (await import("../../chunks/adapter14.js")).setFeatureEffectTool
195
+ ],
196
+ [
197
+ "list_layer_fields",
198
+ async () => (await import("../../chunks/adapter11.js")).listLayerFieldsTool
199
+ ],
200
+ [
201
+ "go_to_address",
202
+ async () => (await import("../../chunks/adapter2.js")).goToAddressTool
203
+ ],
204
+ [
205
+ "go_to_bookmark",
206
+ async () => (await import("../../chunks/adapter3.js")).goToBookmarkTool
207
+ ],
208
+ [
209
+ "go_to_features",
210
+ async () => (await import("../../chunks/adapter4.js")).goToFeaturesTool
211
+ ],
212
+ [
213
+ "go_to_full_extent",
214
+ async () => (await import("../../chunks/adapter5.js")).goToFullExtentTool
215
+ ],
216
+ [
217
+ "go_to_home_extent",
218
+ async () => (await import("../../chunks/adapter6.js")).goToHomeExtentTool
219
+ ],
220
+ [
221
+ "go_to_layer",
222
+ async () => (await import("../../chunks/adapter7.js")).goToLayerTool
223
+ ],
224
+ [
225
+ "go_to_scale",
226
+ async () => (await import("../../chunks/adapter8.js")).goToScaleTool
227
+ ],
228
+ [
229
+ "go_to_viewpoint",
230
+ async () => (await import("../../chunks/adapter9.js")).goToViewpointTool
231
+ ],
232
+ [
233
+ "go_to_zoom",
234
+ async () => (await import("../../chunks/adapter10.js")).goToZoomTool
235
+ ],
236
+ [
237
+ "get_attribute",
238
+ async () => (await import("../../chunks/adapter15.js")).getAttributeTool
239
+ ],
240
+ [
241
+ "get_statistics",
242
+ async () => (await import("../../chunks/adapter16.js")).getStatisticsTool
243
+ ],
244
+ [
245
+ "get_top_features",
246
+ async () => (await import("../../chunks/adapter17.js")).getTopFeaturesTool
247
+ ],
248
+ [
249
+ "query_features",
250
+ async () => (await import("../../chunks/adapter18.js")).queryFeaturesTool
251
+ ]
252
+ ]);
253
+ async function st(t) {
254
+ const e = rt.get(t);
255
+ if (!e)
256
+ throw new Error(`ArcGIS tool is not supported in the browser runtime: ${t}`);
257
+ return await e();
258
+ }
259
+ var at = Object.defineProperty, it = Object.getOwnPropertyDescriptor, S = (t, e, r, s) => {
260
+ for (var o = s > 1 ? void 0 : s ? it(e, r) : e, a = t.length - 1, i; a >= 0; a--)
261
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
262
+ return s && o && at(e, r, o), o;
263
+ };
264
+ let h = class extends O {
265
+ //#region Lifecycle
266
+ constructor(t) {
267
+ super(t), this.type = "arcgis-tool";
268
+ }
269
+ //#endregion
270
+ //#region Public Methods
271
+ async createRuntimeTools() {
272
+ if (!this.name)
273
+ throw new Error("ArcgisTool name is required");
274
+ return [await st(this.name)];
275
+ }
276
+ static fromJSON(t) {
277
+ return new h({
278
+ name: t.name,
279
+ requireApproval: t.require_approval
280
+ });
281
+ }
282
+ //#endregion
283
+ };
284
+ S([
285
+ n()
286
+ ], h.prototype, "name", 2);
287
+ S([
288
+ n()
289
+ ], h.prototype, "requireApproval", 2);
290
+ S([
291
+ n()
292
+ ], h.prototype, "type", 2);
293
+ h = S([
294
+ l("ArcgisTool")
295
+ ], h);
296
+ var nt = Object.defineProperty, ct = Object.getOwnPropertyDescriptor, R = (t) => {
297
+ throw TypeError(t);
298
+ }, y = (t, e, r, s) => {
299
+ for (var o = s > 1 ? void 0 : s ? ct(e, r) : e, a = t.length - 1, i; a >= 0; a--)
300
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
301
+ return s && o && nt(e, r, o), o;
302
+ }, pt = (t, e, r) => e.has(t) || R("Cannot " + r), mt = (t, e, r) => e.has(t) ? R("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), ut = (t, e, r) => (pt(t, e, "access private method"), r), P, F;
303
+ let d = class extends m {
304
+ //#region Lifecycle
305
+ constructor(t) {
306
+ super(t), mt(this, P), this.type = "agent-node";
307
+ }
308
+ //#endregion
309
+ //#region Public Methods
310
+ createRuntimeNode() {
311
+ let t;
312
+ return async (e, r) => {
313
+ t ??= ut(this, P, F).call(this);
314
+ const o = await (await t).run(e, r), a = this.outputSchema?.safeParse(o);
315
+ if (a && !a.success)
316
+ throw a.error;
317
+ const i = a?.data, A = i ?? o.outputMessage;
318
+ return {
319
+ agentExecutionContext: o.agentExecutionContext,
320
+ ...i ? {} : { outputMessage: o.outputMessage },
321
+ status: o.status,
322
+ summary: o.summary,
323
+ nodes: {
324
+ [this.id]: { output: A }
325
+ }
326
+ };
327
+ };
328
+ }
329
+ compile(t) {
330
+ const e = t.outgoingEdges[0]?.targetNodeId;
331
+ return {
332
+ runtimeNode: this.createRuntimeNode(),
333
+ edges: [
334
+ {
335
+ from: this.id,
336
+ decide: (r) => r.status === "failed" ? void 0 : e
337
+ }
338
+ ],
339
+ schemas: [
340
+ c.object({
341
+ output: this.outputSchema ?? c.string()
342
+ })
343
+ ]
344
+ };
345
+ }
346
+ static fromJSON(t) {
347
+ const e = new d({
348
+ id: t.id,
349
+ label: t.label,
350
+ type: "agent-node"
351
+ });
352
+ return t.prompt && (typeof t.prompt == "string" ? e.prompt = u.fromJSON({
353
+ id: `prompt_${t.id}`,
354
+ type: "plain_text",
355
+ messages: [{ content: t.prompt, role: "system" }]
356
+ }) : e.prompt = u.fromJSON(t.prompt)), t.structured_output && (e.outputSchema = I(t.structured_output)), e.tools = t.tools?.filter((r) => r.type === "arcgis_tool").map((r) => h.fromJSON(r)), e;
357
+ }
358
+ //#endregion
359
+ };
360
+ P = /* @__PURE__ */ new WeakSet();
361
+ F = async function() {
362
+ const t = this.prompt?.messages?.[0].content;
363
+ if (!t?.trim())
364
+ throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);
365
+ const e = [];
366
+ if (this.tools)
367
+ for (const r of this.tools) {
368
+ const s = await r.createRuntimeTools();
369
+ e.push(...s);
370
+ }
371
+ return new H({
372
+ name: this.id,
373
+ // TODO: change to label
374
+ outputSchema: this.outputSchema,
375
+ prompt: t,
376
+ tools: e
377
+ });
378
+ };
379
+ y([
380
+ n()
381
+ ], d.prototype, "type", 2);
382
+ y([
383
+ n()
384
+ ], d.prototype, "prompt", 2);
385
+ y([
386
+ n()
387
+ ], d.prototype, "outputSchema", 2);
388
+ y([
389
+ n()
390
+ ], d.prototype, "tools", 2);
391
+ d = y([
392
+ l("AgentNode")
393
+ ], d);
394
+ var dt = Object.defineProperty, lt = Object.getOwnPropertyDescriptor, E = (t, e, r, s) => {
395
+ for (var o = s > 1 ? void 0 : s ? lt(e, r) : e, a = t.length - 1, i; a >= 0; a--)
396
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
397
+ return s && o && dt(e, r, o), o;
398
+ };
399
+ let g = class extends m {
400
+ //#region Lifecycle
401
+ constructor(t) {
402
+ super(t), this.type = "end-message-node";
403
+ }
404
+ //#endregion
405
+ //#region Public Methods
406
+ createRuntimeNode() {
407
+ return async (t) => {
408
+ const e = await U.fromTemplate(this.message, { templateFormat: "mustache" }).format(t);
409
+ return {
410
+ outputMessage: e,
411
+ status: "success",
412
+ summary: e
413
+ };
414
+ };
415
+ }
416
+ compile(t) {
417
+ return {
418
+ runtimeNode: this.createRuntimeNode(),
419
+ edges: []
420
+ };
421
+ }
422
+ static fromJSON(t) {
423
+ const e = new g({
424
+ id: t.id,
425
+ label: t.label,
426
+ type: "end-message-node"
427
+ });
428
+ return e.message = t.message, e;
429
+ }
430
+ //#endregion
431
+ //#region Private Methods
432
+ //#endregion
433
+ };
434
+ E([
435
+ n()
436
+ ], g.prototype, "type", 2);
437
+ E([
438
+ n()
439
+ ], g.prototype, "message", 2);
440
+ g = E([
441
+ l("EndMessageNode")
442
+ ], g);
443
+ var ht = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, q = (t, e, r, s) => {
444
+ for (var o = s > 1 ? void 0 : s ? gt(e, r) : e, a = t.length - 1, i; a >= 0; a--)
445
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
446
+ return s && o && ht(e, r, o), o;
447
+ };
448
+ let w = class extends m {
449
+ //#region Lifecycle
450
+ constructor(t) {
451
+ super(t), this.type = "start-node";
452
+ }
453
+ //#endregion
454
+ //#region Public Methods
455
+ createRuntimeNode() {
456
+ return (t) => ({ question: t.agentExecutionContext.userRequest });
457
+ }
458
+ static fromJSON(t) {
459
+ return new w({
460
+ id: t.id,
461
+ label: t.label,
462
+ type: "start-node"
463
+ });
464
+ }
465
+ //#endregion
466
+ //#region Private Methods
467
+ //#endregion
468
+ };
469
+ q([
470
+ n()
471
+ ], w.prototype, "type", 2);
472
+ w = q([
473
+ l("StartNode")
474
+ ], w);
475
+ function ft(t) {
476
+ switch (t.type) {
477
+ case "agent_node":
478
+ return d.fromJSON(t);
479
+ case "end_message_node":
480
+ return g.fromJSON(t);
481
+ case "start_node":
482
+ return w.fromJSON(t);
483
+ default:
484
+ throw new Error(`WebAgent node "${t.id}" uses unsupported type "${t.type}".`);
485
+ }
486
+ }
487
+ function _t(t = {}) {
488
+ const e = Object.keys(t);
489
+ if (V(e), e.includes("nodes"))
490
+ throw new Error("node state cannot define reserved field: nodes.");
491
+ const r = K(t);
492
+ return C.Root({
493
+ ...r,
494
+ nodes: C({
495
+ reducer: (s, o) => ({ ...s, ...o }),
496
+ default: () => ({})
497
+ }),
498
+ ...Q()
499
+ });
500
+ }
501
+ function M(t) {
502
+ const e = /* @__PURE__ */ new Set();
503
+ for (const s of t)
504
+ for (const o of Object.keys(s.shape ?? {}))
505
+ o !== "nodes" && e.add(o);
506
+ const r = Object.fromEntries([...e].map((s) => [s, void 0]));
507
+ return _t(r);
508
+ }
509
+ class x {
510
+ //#endregion Private Properties
511
+ //#region Lifecycle
512
+ constructor(e, r, s) {
513
+ this.sourceJSON = e, this.edges = r, this.nodes = s, this._loaded = !1;
514
+ }
515
+ //#endregion Lifecycle
516
+ //#region Public Methods
517
+ static fromJSON(e) {
518
+ return new x(
519
+ e,
520
+ e.graph.edges.map((r) => p.fromJSON(r)),
521
+ e.graph.nodes.map((r) => ft(r))
522
+ );
523
+ }
524
+ async load() {
525
+ return this._loadPromise ??= Promise.all(this.nodes.map(async (e) => await e.load())).then(() => {
526
+ this._loaded = !0;
527
+ }), await this._loadPromise, this;
528
+ }
529
+ getSchemas() {
530
+ const e = Object.fromEntries(
531
+ this._getNodeCompilations().flatMap((s, o) => {
532
+ const a = this.nodes[o];
533
+ return s.schemas?.map((i) => [a.id, i]) ?? [];
534
+ })
535
+ );
536
+ return [c.object({
537
+ loopCounts: c.record(c.string(), c.number()).optional(),
538
+ nodes: c.object(e).partial().optional(),
539
+ question: c.string().optional()
540
+ })];
541
+ }
542
+ generate() {
543
+ this._assertLoaded(), this._nodeCompilations = void 0;
544
+ const e = this._getNodeCompilations(), r = M(this.getSchemas()), s = this.nodes.find((i) => i.type === "start-node")?.id, o = {}, a = [];
545
+ for (const [i, A] of this.nodes.entries()) {
546
+ const b = e[i];
547
+ b && (b.runtimeNode && (o[A.id] = b.runtimeNode), a.push(...b.edges));
548
+ }
549
+ return {
550
+ createGraph: () => Z(o, a, r, { entryNode: s }),
551
+ workspace: r
552
+ };
553
+ }
554
+ //#endregion Public Methods
555
+ //#region Private Methods
556
+ _assertLoaded() {
557
+ if (!this._loaded)
558
+ throw new Error("AgenticWorkflowRuntime must be loaded before it can generate a graph.");
559
+ }
560
+ _getNodeCompilations() {
561
+ return this._assertLoaded(), this._nodeCompilations ??= this.nodes.map(
562
+ (e) => e.compile({
563
+ outgoingEdges: this.edges.filter((r) => r.sourceNodeId === e.id)
564
+ })
565
+ );
566
+ }
567
+ //#endregion Private Methods
568
+ }
569
+ var wt = Object.defineProperty, yt = Object.getOwnPropertyDescriptor, $ = (t, e, r, s) => {
570
+ for (var o = s > 1 ? void 0 : s ? yt(e, r) : e, a = t.length - 1, i; a >= 0; a--)
571
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
572
+ return s && o && wt(e, r, o), o;
573
+ };
574
+ const bt = () => {
575
+ throw new Error("WebAgent must be loaded before it can run.");
576
+ };
577
+ let f = class extends B {
578
+ //#region Lifecycle
579
+ constructor(t) {
580
+ super(t);
581
+ }
582
+ //#endregion
583
+ //#region Public Methods
584
+ async load() {
585
+ if (this.portalItem) {
586
+ try {
587
+ await this.portalItem.load();
588
+ } catch (r) {
589
+ throw new v("web-agent:load-portal-item", "Failed to load portal item", { error: r });
590
+ }
591
+ const e = await this.portalItem.fetchData();
592
+ if (this.sourceJSON = e, !this.portalItem.title)
593
+ throw new v("web-agent:missing-title", "The portal item is missing a title");
594
+ }
595
+ if (!this.sourceJSON)
596
+ throw new v("web-agent:missing-source-json", "The source JSON is missing");
597
+ if (!this.sourceJSON.description)
598
+ throw new v("web-agent:missing-description", "The source JSON is missing a description");
599
+ const t = x.fromJSON(this.sourceJSON);
600
+ return await t.load(), this._runtime = t, this.description = this.sourceJSON.description, this.name = this.portalItem?.title ?? `web-agent-${Date.now()}`, this.generate(), this;
601
+ }
602
+ getSchemas() {
603
+ return this._runtime?.getSchemas() ?? [];
604
+ }
605
+ generate() {
606
+ if (!this._runtime) {
607
+ this._set("workspace", M([])), this._set("createGraph", bt);
608
+ return;
609
+ }
610
+ const { createGraph: t, workspace: e } = this._runtime.generate();
611
+ this._set("workspace", e), this._set("createGraph", t);
612
+ }
613
+ //#endregion
614
+ };
615
+ $([
616
+ n({ type: J })
617
+ ], f.prototype, "portalItem", 2);
618
+ $([
619
+ n()
620
+ ], f.prototype, "sourceJSON", 2);
621
+ f = $([
622
+ l("WebAgent")
623
+ ], f);
624
+ class vt extends L {
6
625
  static {
7
- this.properties = { agent: 0, context: 0 };
626
+ this.properties = { agent: 0, context: 0, itemId: 1, workflow: 0 };
8
627
  }
9
628
  #t;
10
629
  async getContext() {
11
- return e(this.context) ? await this.context() : this.context;
630
+ return G(this.context) ? await this.context() : this.context;
12
631
  }
13
- load() {
14
- this.#t = i(this);
632
+ async load() {
633
+ let e;
634
+ if (this.itemId) {
635
+ const r = j.getDefault();
636
+ e = new f({ portalItem: new J({ id: this.itemId, portal: r }) });
637
+ } else this.workflow && (e = new f({ sourceJSON: this.workflow }));
638
+ if (e && (await e.load(), this.agent = e.registration), !this.agent)
639
+ throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");
640
+ this.#t = z(this);
15
641
  }
16
642
  disconnectedCallback() {
17
643
  this.#t?.unregister(this.agent.id), super.disconnectedCallback();
18
644
  }
19
645
  }
20
- t("arcgis-assistant-agent", n);
646
+ W("arcgis-assistant-agent", vt);
21
647
  export {
22
- n as ArcgisAssistantAgent
648
+ vt as ArcgisAssistantAgent
23
649
  };
@@ -15,13 +15,23 @@ import "@arcgis/core/config.js";
15
15
  import "@arcgis/core/core/reactiveUtils.js";
16
16
  import "@arcgis/core/layers/FeatureLayer.js";
17
17
  import "@langchain/core/prompts";
18
+ import "../../chunks/adapter2.js";
19
+ import "../../chunks/adapter3.js";
20
+ import "../../chunks/adapter4.js";
21
+ import "../../chunks/adapter5.js";
22
+ import "../../chunks/adapter6.js";
23
+ import "../../chunks/adapter7.js";
24
+ import "../../chunks/adapter8.js";
25
+ import "../../chunks/adapter9.js";
26
+ import "../../chunks/adapter10.js";
18
27
  import "@langchain/langgraph/prebuilt";
19
28
  import "zod";
20
29
  import { D as r } from "../../chunks/dataExplorationGraph.js";
30
+ import "../../chunks/adapter11.js";
21
31
  import "@arcgis/core/views/LinkChartView.js";
22
32
  import "@arcgis/core/rest/knowledgeGraphService.js";
23
- import { r as a, a as s } from "../../chunks/utils2.js";
24
- class e extends i {
33
+ import { r as o, i as a } from "../../chunks/utils2.js";
34
+ class s extends i {
25
35
  constructor() {
26
36
  super(...arguments), this.agent = r;
27
37
  }
@@ -36,13 +46,13 @@ class e extends i {
36
46
  return { mapView: this.#t };
37
47
  }
38
48
  load() {
39
- this.#t = a(this, "arcgis-assistant-data-exploration-agent"), this.#i = s(this);
49
+ this.#t = o(this, "arcgis-assistant-data-exploration-agent"), this.#i = a(this);
40
50
  }
41
51
  disconnectedCallback() {
42
52
  this.#i?.unregister(this.agent.id), super.disconnectedCallback();
43
53
  }
44
54
  }
45
- t("arcgis-assistant-data-exploration-agent", e);
55
+ t("arcgis-assistant-data-exploration-agent", s);
46
56
  export {
47
- e as ArcgisAssistantDataExplorationAgent
57
+ s as ArcgisAssistantDataExplorationAgent
48
58
  };