@arcgis/ai-components 5.2.0-next.87 → 5.2.0-next.89

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 (51) hide show
  1. package/dist/agent-utils/LLMAgent.js +1 -0
  2. package/dist/cdn/222B5OU6.js +2 -0
  3. package/dist/cdn/{7XY54M57.js → 2FOCAXWJ.js} +1 -1
  4. package/dist/cdn/6VJXUIXY.js +3 -0
  5. package/dist/cdn/{LF2LOV25.js → C5ZL5Z52.js} +5 -5
  6. package/dist/cdn/{HNL4WZKH.js → COL6QYGQ.js} +1 -1
  7. package/dist/cdn/{JKMZQOJQ.js → CXP3ACSA.js} +1 -1
  8. package/dist/cdn/{IOKXNJWG.js → FUZ77UGP.js} +4 -4
  9. package/dist/cdn/{TAJLCMAG.js → HKSFWTWK.js} +5 -5
  10. package/dist/cdn/{WPKGJJ57.js → LPR72QZF.js} +2 -2
  11. package/dist/cdn/{PNFK73E5.js → LS4FJKFE.js} +1 -1
  12. package/dist/cdn/{Y2776DWQ.js → OYSPNIJI.js} +28 -28
  13. package/dist/cdn/{FAR3DFFK.js → PEYYWXFE.js} +1 -1
  14. package/dist/cdn/{NTBDGSXI.js → SUYWKYWI.js} +2 -2
  15. package/dist/cdn/{B3YSZHAE.js → VTQKRCKU.js} +1 -1
  16. package/dist/cdn/Y5TYSBLZ.js +3 -0
  17. package/dist/cdn/{CF6ZLMFG.js → Y7QZBO46.js} +1 -1
  18. package/dist/cdn/{EMLOVMD4.js → ZVGUAOXE.js} +1 -1
  19. package/dist/cdn/agent-utils/index.js +1 -1
  20. package/dist/cdn/index.js +1 -1
  21. package/dist/chunks/adapter.js +60 -55
  22. package/dist/chunks/arcgisKnowledgeGraph.js +3 -2
  23. package/dist/chunks/dataExplorationGraph.js +3 -2
  24. package/dist/chunks/helpGraph.js +3 -2
  25. package/dist/chunks/layerStylingGraph.js +1 -0
  26. package/dist/chunks/navigationGraph.js +3 -2
  27. package/dist/chunks/orchestrator.js +322 -193
  28. package/dist/chunks/toolCallResponse.js +3 -2
  29. package/dist/components/arcgis-assistant/customElement.d.ts +16 -0
  30. package/dist/components/arcgis-assistant/customElement.js +190 -178
  31. package/dist/components/arcgis-assistant-agent/customElement.js +209 -208
  32. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -0
  33. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
  34. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -0
  35. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +6 -5
  36. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
  37. package/dist/docs/api.json +1 -1
  38. package/dist/docs/docs.json +1 -1
  39. package/dist/docs/vscode.html-custom-data.json +1 -1
  40. package/dist/docs/web-types.json +1 -1
  41. package/dist/loader.js +1 -1
  42. package/dist/orchestrator/orchestrator/orchestratorEvents.d.ts +78 -0
  43. package/dist/types/lumina.d.ts +2 -1
  44. package/dist/types/preact.d.ts +2 -1
  45. package/dist/types/react.d.ts +2 -1
  46. package/dist/types/stencil.d.ts +2 -1
  47. package/package.json +5 -5
  48. package/dist/cdn/L7XTRDFM.js +0 -3
  49. package/dist/cdn/W5G35GO4.js +0 -2
  50. package/dist/cdn/ZUNLFO6M.js +0 -3
  51. /package/dist/cdn/{ONMNQBPO.js → SZ2QSSB3.js} +0 -0
@@ -1,19 +1,19 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { c as q } from "../../chunks/runtime.js";
3
- import { LitElement as L } from "@arcgis/lumina";
4
- import { b as M, i as W } from "../../chunks/utils2.js";
5
- import F from "@arcgis/core/portal/PortalItem.js";
3
+ import { LitElement as M } from "@arcgis/lumina";
4
+ import { b as W, i as L } from "../../chunks/utils2.js";
5
+ import C from "@arcgis/core/portal/PortalItem.js";
6
6
  import j from "@arcgis/core/portal/Portal.js";
7
7
  import { property as n, subclass as l } from "@arcgis/core/core/accessorSupport/decorators.js";
8
8
  import { BaseAgent as G } from "../../agent-utils/BaseAgent.js";
9
9
  import b from "@arcgis/core/core/Error.js";
10
10
  import { z as c } from "zod";
11
11
  import { c as B } from "../../chunks/graph.js";
12
- import S from "@arcgis/core/core/Accessor.js";
13
- import { LLMAgent as Z } from "../../agent-utils/LLMAgent.js";
14
- import { PromptTemplate as z } from "@langchain/core/prompts";
12
+ import T from "@arcgis/core/core/Accessor.js";
13
+ import { LLMAgent as z } from "../../agent-utils/LLMAgent.js";
14
+ import { PromptTemplate as Z } from "@langchain/core/prompts";
15
15
  import { Annotation as x } from "@langchain/langgraph";
16
- import { b as H, d as V } from "../../chunks/state.js";
16
+ import { b as H, d as U } from "../../chunks/state.js";
17
17
  import "@arcgis/core/identity/IdentityManager.js";
18
18
  import "@arcgis/core/request.js";
19
19
  import "@langchain/langgraph/web";
@@ -21,30 +21,31 @@ import "@arcgis/toolkit/string";
21
21
  import "../../chunks/generateLayerDescriptions.js";
22
22
  import "@langchain/core/messages";
23
23
  import "@langchain/core/callbacks/dispatch/web";
24
+ import "@langchain/core/callbacks/base";
24
25
  import "@langchain/openai";
25
26
  import "@arcgis/core/config.js";
26
27
  import "@arcgis/core/core/reactiveUtils.js";
27
28
  import "@arcgis/core/layers/FeatureLayer.js";
28
- import { a as U } from "../../chunks/baseAgentState.js";
29
- var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, f = (e, t, r, s) => {
30
- for (var o = s > 1 ? void 0 : s ? Q(t, r) : t, a = e.length - 1, i; a >= 0; a--)
31
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
32
- return s && o && K(t, r, o), o;
29
+ import { a as V } from "../../chunks/baseAgentState.js";
30
+ var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, f = (t, e, r, s) => {
31
+ for (var o = s > 1 ? void 0 : s ? Q(e, r) : e, a = t.length - 1, i; a >= 0; a--)
32
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
33
+ return s && o && K(e, r, o), o;
33
34
  };
34
- let p = class extends S {
35
+ let p = class extends T {
35
36
  //#region Lifecycle
36
- constructor(e) {
37
- super(e);
37
+ constructor(t) {
38
+ super(t);
38
39
  }
39
40
  //#endregion
40
41
  //#region Public Methods
41
- static fromJSON(e) {
42
+ static fromJSON(t) {
42
43
  return new p({
43
- id: e.id,
44
- sourceAnchorId: e.source_anchor_id,
45
- sourceNodeId: e.source_node_id,
46
- targetAnchorId: e.target_anchor_id,
47
- targetNodeId: e.target_node_id
44
+ id: t.id,
45
+ sourceAnchorId: t.source_anchor_id,
46
+ sourceNodeId: t.source_node_id,
47
+ targetAnchorId: t.target_anchor_id,
48
+ targetNodeId: t.target_node_id
48
49
  });
49
50
  }
50
51
  //#endregion
@@ -67,31 +68,31 @@ f([
67
68
  p = f([
68
69
  l("Edge")
69
70
  ], p);
70
- var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, v = (e, t, r, s) => {
71
- for (var o = s > 1 ? void 0 : s ? Y(t, r) : t, a = e.length - 1, i; a >= 0; a--)
72
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
73
- return s && o && X(t, r, o), o;
71
+ var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, v = (t, e, r, s) => {
72
+ for (var o = s > 1 ? void 0 : s ? Y(e, r) : e, a = t.length - 1, i; a >= 0; a--)
73
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
74
+ return s && o && X(e, r, o), o;
74
75
  };
75
- let m = class extends S {
76
+ let m = class extends T {
76
77
  //#region Lifecycle
77
- constructor(e) {
78
- super(e);
78
+ constructor(t) {
79
+ super(t);
79
80
  }
80
81
  //#endregion
81
82
  //#region Public Methods
82
83
  async load() {
83
84
  return await Promise.resolve(this);
84
85
  }
85
- compile(e) {
86
+ compile(t) {
86
87
  return {
87
88
  runtimeNode: this.createRuntimeNode(),
88
- edges: e.outgoingEdges.map((t) => ({
89
+ edges: t.outgoingEdges.map((e) => ({
89
90
  from: this.id,
90
- to: t.targetNodeId
91
+ to: e.targetNodeId
91
92
  }))
92
93
  };
93
94
  }
94
- static fromJSON(e) {
95
+ static fromJSON(t) {
95
96
  throw new Error("BaseNode is abstract and cannot be instantiated directly.");
96
97
  }
97
98
  //#endregion
@@ -110,144 +111,144 @@ v([
110
111
  m = v([
111
112
  l("BaseNode")
112
113
  ], m);
113
- function C(e) {
114
- const t = new Set(e.required), r = Object.fromEntries(
115
- Object.entries(e.properties).map(([s, o]) => {
116
- const a = I(o);
117
- return [s, t.has(s) ? a : a.optional()];
114
+ function I(t) {
115
+ const e = new Set(t.required), r = Object.fromEntries(
116
+ Object.entries(t.properties).map(([s, o]) => {
117
+ const a = $(o);
118
+ return [s, e.has(s) ? a : a.optional()];
118
119
  })
119
120
  );
120
121
  return c.object(r);
121
122
  }
122
- function I(e) {
123
- let t;
124
- switch (e.type) {
123
+ function $(t) {
124
+ let e;
125
+ switch (t.type) {
125
126
  case "array":
126
- t = c.array(e.items ? I(e.items) : c.unknown());
127
+ e = c.array(t.items ? $(t.items) : c.unknown());
127
128
  break;
128
129
  case "boolean":
129
- t = c.boolean();
130
+ e = c.boolean();
130
131
  break;
131
132
  case "number":
132
- t = c.number();
133
+ e = c.number();
133
134
  break;
134
135
  case "object":
135
- t = C({
136
- properties: e.properties ?? {},
137
- required: e.required
136
+ e = I({
137
+ properties: t.properties ?? {},
138
+ required: t.required
138
139
  });
139
140
  break;
140
141
  case "string":
141
- t = e.enum?.length ? c.enum(e.enum) : c.string();
142
+ e = t.enum?.length ? c.enum(t.enum) : c.string();
142
143
  break;
143
144
  }
144
- return e.description ? t.describe(e.description) : t;
145
+ return t.description ? e.describe(t.description) : e;
145
146
  }
146
147
  const k = /* @__PURE__ */ new Map([
147
148
  [
148
- "clearFilters",
149
+ "clear_filters",
149
150
  async () => (await import("../../agents/tools/filter/clearFilters/adapter.js")).clearFiltersTool
150
151
  ],
151
152
  [
152
- "resetMap",
153
+ "reset_map",
153
154
  async () => (await import("../../agents/tools/filter/resetMap/adapter.js")).resetMapTool
154
155
  ],
155
156
  [
156
- "setFeatureEffect",
157
+ "set_feature_effect",
157
158
  async () => (await import("../../agents/tools/filter/setFeatureEffect/adapter.js")).setFeatureEffectTool
158
159
  ],
159
160
  [
160
- "listLayerFields",
161
+ "list_layer_fields",
161
162
  async () => (await import("../../agents/tools/help/listFields/adapter.js")).listLayerFieldsTool
162
163
  ],
163
164
  [
164
- "goToAddress",
165
+ "go_to_address",
165
166
  async () => (await import("../../agents/tools/navigation/goToAddress/adapter.js")).goToAddressTool
166
167
  ],
167
168
  [
168
- "goToBookmark",
169
+ "go_to_bookmark",
169
170
  async () => (await import("../../agents/tools/navigation/goToBookmark/adapter.js")).goToBookmarkTool
170
171
  ],
171
172
  [
172
- "goToFeatures",
173
+ "go_to_features",
173
174
  async () => (await import("../../agents/tools/navigation/goToFeatures/adapter.js")).goToFeaturesTool
174
175
  ],
175
176
  [
176
- "goToFullExtent",
177
+ "go_to_full_extent",
177
178
  async () => (await import("../../agents/tools/navigation/goToFullExtent/adapter.js")).goToFullExtentTool
178
179
  ],
179
180
  [
180
- "goToHomeExtent",
181
+ "go_to_home_extent",
181
182
  async () => (await import("../../agents/tools/navigation/goToHomeExtent/adapter.js")).goToHomeExtentTool
182
183
  ],
183
184
  [
184
- "goToLayer",
185
+ "go_to_layer",
185
186
  async () => (await import("../../agents/tools/navigation/goToLayer/adapter.js")).goToLayerTool
186
187
  ],
187
188
  [
188
- "goToScale",
189
+ "go_to_scale",
189
190
  async () => (await import("../../agents/tools/navigation/goToScale/adapter.js")).goToScaleTool
190
191
  ],
191
192
  [
192
- "goToViewpoint",
193
+ "go_to_viewpoint",
193
194
  async () => (await import("../../agents/tools/navigation/goToViewpoint/adapter.js")).goToViewpointTool
194
195
  ],
195
196
  [
196
- "goToZoom",
197
+ "go_to_zoom",
197
198
  async () => (await import("../../agents/tools/navigation/goToZoom/adapter.js")).goToZoomTool
198
199
  ],
199
200
  [
200
- "findRelevantFields",
201
+ "find_relevant_fields",
201
202
  async () => (await import("../../agents/tools/search/findRelevantFields/adapter.js")).findRelevantFieldsTool
202
203
  ],
203
204
  [
204
- "findRelevantLayers",
205
+ "find_relevant_layers",
205
206
  async () => (await import("../../agents/tools/search/findRelevantLayers/adapter.js")).findRelevantLayersTool
206
207
  ],
207
208
  [
208
- "getAttribute",
209
+ "get_attribute",
209
210
  async () => (await import("../../agents/tools/query/getAttribute/adapter.js")).getAttributeTool
210
211
  ],
211
212
  [
212
- "getStatistics",
213
+ "get_statistics",
213
214
  async () => (await import("../../agents/tools/query/getStatistics/adapter.js")).getStatisticsTool
214
215
  ],
215
216
  [
216
- "getTopFeatures",
217
+ "get_top_features",
217
218
  async () => (await import("../../agents/tools/query/getTopFeatures/adapter.js")).getTopFeaturesTool
218
219
  ],
219
220
  [
220
- "queryFeatures",
221
+ "query_features",
221
222
  async () => (await import("../../agents/tools/query/queryFeatures/adapter.js")).queryFeaturesTool
222
223
  ]
223
224
  ]);
224
- async function ee(e) {
225
- const t = k.get(e);
226
- if (!t)
227
- throw new Error(`ArcGIS tool is not supported in the browser runtime: ${e}`);
228
- return await t();
225
+ async function tt(t) {
226
+ const e = k.get(t);
227
+ if (!e)
228
+ throw new Error(`ArcGIS tool is not supported in the browser runtime: ${t}`);
229
+ return await e();
229
230
  }
230
- var te = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, N = (e, t, r, s) => {
231
- for (var o = s > 1 ? void 0 : s ? oe(t, r) : t, a = e.length - 1, i; a >= 0; a--)
232
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
233
- return s && o && te(t, r, o), o;
231
+ var et = Object.defineProperty, ot = Object.getOwnPropertyDescriptor, N = (t, e, r, s) => {
232
+ for (var o = s > 1 ? void 0 : s ? ot(e, r) : e, a = t.length - 1, i; a >= 0; a--)
233
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
234
+ return s && o && et(e, r, o), o;
234
235
  };
235
- let d = class extends S {
236
+ let d = class extends T {
236
237
  //#region Lifecycle
237
- constructor(e) {
238
- super(e), this.type = "arcgis-tool";
238
+ constructor(t) {
239
+ super(t), this.type = "arcgis-tool";
239
240
  }
240
241
  //#endregion
241
242
  //#region Public Methods
242
243
  async createRuntimeTools() {
243
244
  if (!this.name)
244
245
  throw new Error("ArcgisTool name is required");
245
- return [await ee(this.name)];
246
+ return [await tt(this.name)];
246
247
  }
247
- static fromJSON(e) {
248
+ static fromJSON(t) {
248
249
  return new d({
249
- name: e.name,
250
- requireApproval: e.require_approval
250
+ name: t.name,
251
+ requireApproval: t.require_approval
251
252
  });
252
253
  }
253
254
  //#endregion
@@ -264,25 +265,25 @@ N([
264
265
  d = N([
265
266
  l("ArcgisTool")
266
267
  ], d);
267
- var re = Object.defineProperty, se = Object.getOwnPropertyDescriptor, $ = (e) => {
268
- throw TypeError(e);
269
- }, y = (e, t, r, s) => {
270
- for (var o = s > 1 ? void 0 : s ? se(t, r) : t, a = e.length - 1, i; a >= 0; a--)
271
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
272
- return s && o && re(t, r, o), o;
273
- }, ae = (e, t, r) => t.has(e) || $("Cannot " + r), ie = (e, t, r) => t.has(e) ? $("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, r), ne = (e, t, r) => (ae(e, t, "access private method"), r), T, J;
268
+ var rt = Object.defineProperty, st = Object.getOwnPropertyDescriptor, J = (t) => {
269
+ throw TypeError(t);
270
+ }, w = (t, e, r, s) => {
271
+ for (var o = s > 1 ? void 0 : s ? st(e, r) : e, a = t.length - 1, i; a >= 0; a--)
272
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
273
+ return s && o && rt(e, r, o), o;
274
+ }, at = (t, e, r) => e.has(t) || J("Cannot " + r), it = (t, e, r) => e.has(t) ? J("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(t) : e.set(t, r), nt = (t, e, r) => (at(t, e, "access private method"), r), S, R;
274
275
  let u = class extends m {
275
276
  //#region Lifecycle
276
- constructor(e) {
277
- super(e), ie(this, T), this.type = "agent-node";
277
+ constructor(t) {
278
+ super(t), it(this, S), this.type = "agent-node";
278
279
  }
279
280
  //#endregion
280
281
  //#region Public Methods
281
282
  createRuntimeNode() {
282
- let e;
283
- return async (t, r) => {
284
- e ??= ne(this, T, J).call(this);
285
- const o = await (await e).run(t, r), a = this.outputSchema?.safeParse(o);
283
+ let t;
284
+ return async (e, r) => {
285
+ t ??= nt(this, S, R).call(this);
286
+ const o = await (await t).run(e, r), a = this.outputSchema?.safeParse(o);
286
287
  if (a && !a.success)
287
288
  throw a.error;
288
289
  const i = a?.data, O = i ?? o.outputMessage;
@@ -297,14 +298,14 @@ let u = class extends m {
297
298
  };
298
299
  };
299
300
  }
300
- compile(e) {
301
- const t = e.outgoingEdges[0]?.targetNodeId;
301
+ compile(t) {
302
+ const e = t.outgoingEdges[0]?.targetNodeId;
302
303
  return {
303
304
  runtimeNode: this.createRuntimeNode(),
304
305
  edges: [
305
306
  {
306
307
  from: this.id,
307
- decide: (r) => r.status === "failed" ? void 0 : t
308
+ decide: (r) => r.status === "failed" ? void 0 : e
308
309
  }
309
310
  ],
310
311
  schemas: [
@@ -314,86 +315,86 @@ let u = class extends m {
314
315
  ]
315
316
  };
316
317
  }
317
- static fromJSON(e) {
318
- const t = new u({
319
- id: e.id,
320
- label: e.label,
321
- prompt: e.prompt?.content,
318
+ static fromJSON(t) {
319
+ const e = new u({
320
+ id: t.id,
321
+ label: t.label,
322
+ prompt: t.prompt?.content,
322
323
  type: "agent-node"
323
324
  });
324
- return e.structured_output && (t.outputSchema = C(e.structured_output)), t.tools = e.tools?.filter((r) => r.type === "arcgis_tool").map((r) => d.fromJSON(r)), t;
325
+ return t.structured_output && (e.outputSchema = I(t.structured_output)), e.tools = t.tools?.filter((r) => r.type === "arcgis_tool").map((r) => d.fromJSON(r)), e;
325
326
  }
326
327
  //#endregion
327
328
  };
328
- T = /* @__PURE__ */ new WeakSet();
329
- J = async function() {
330
- const e = this.prompt;
331
- if (!e?.trim())
329
+ S = /* @__PURE__ */ new WeakSet();
330
+ R = async function() {
331
+ const t = this.prompt;
332
+ if (!t?.trim())
332
333
  throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);
333
- const t = [];
334
+ const e = [];
334
335
  if (this.tools)
335
336
  for (const r of this.tools) {
336
337
  const s = await r.createRuntimeTools();
337
- t.push(...s);
338
+ e.push(...s);
338
339
  }
339
- return new Z({
340
+ return new z({
340
341
  name: this.id,
341
342
  // TODO: change to label
342
343
  outputSchema: this.outputSchema,
343
- prompt: e,
344
- tools: t
344
+ prompt: t,
345
+ tools: e
345
346
  });
346
347
  };
347
- y([
348
+ w([
348
349
  n()
349
350
  ], u.prototype, "type", 2);
350
- y([
351
+ w([
351
352
  n()
352
353
  ], u.prototype, "prompt", 2);
353
- y([
354
+ w([
354
355
  n()
355
356
  ], u.prototype, "outputSchema", 2);
356
- y([
357
+ w([
357
358
  n()
358
359
  ], u.prototype, "tools", 2);
359
- u = y([
360
+ u = w([
360
361
  l("AgentNode")
361
362
  ], u);
362
- var ce = Object.defineProperty, pe = Object.getOwnPropertyDescriptor, A = (e, t, r, s) => {
363
- for (var o = s > 1 ? void 0 : s ? pe(t, r) : t, a = e.length - 1, i; a >= 0; a--)
364
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
365
- return s && o && ce(t, r, o), o;
363
+ var ct = Object.defineProperty, pt = Object.getOwnPropertyDescriptor, A = (t, e, r, s) => {
364
+ for (var o = s > 1 ? void 0 : s ? pt(e, r) : e, a = t.length - 1, i; a >= 0; a--)
365
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
366
+ return s && o && ct(e, r, o), o;
366
367
  };
367
368
  let h = class extends m {
368
369
  //#region Lifecycle
369
- constructor(e) {
370
- super(e), this.type = "end-message-node";
370
+ constructor(t) {
371
+ super(t), this.type = "end-message-node";
371
372
  }
372
373
  //#endregion
373
374
  //#region Public Methods
374
375
  createRuntimeNode() {
375
- return async (e) => {
376
- const t = await z.fromTemplate(this.message, { templateFormat: "mustache" }).format(e);
376
+ return async (t) => {
377
+ const e = await Z.fromTemplate(this.message, { templateFormat: "mustache" }).format(t);
377
378
  return {
378
- outputMessage: t,
379
+ outputMessage: e,
379
380
  status: "success",
380
- summary: t
381
+ summary: e
381
382
  };
382
383
  };
383
384
  }
384
- compile(e) {
385
+ compile(t) {
385
386
  return {
386
387
  runtimeNode: this.createRuntimeNode(),
387
388
  edges: []
388
389
  };
389
390
  }
390
- static fromJSON(e) {
391
- const t = new h({
392
- id: e.id,
393
- label: e.label,
391
+ static fromJSON(t) {
392
+ const e = new h({
393
+ id: t.id,
394
+ label: t.label,
394
395
  type: "end-message-node"
395
396
  });
396
- return t.message = e.message, t;
397
+ return e.message = t.message, e;
397
398
  }
398
399
  //#endregion
399
400
  //#region Private Methods
@@ -408,25 +409,25 @@ A([
408
409
  h = A([
409
410
  l("EndMessageNode")
410
411
  ], h);
411
- var me = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, R = (e, t, r, s) => {
412
- for (var o = s > 1 ? void 0 : s ? ue(t, r) : t, a = e.length - 1, i; a >= 0; a--)
413
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
414
- return s && o && me(t, r, o), o;
412
+ var mt = Object.defineProperty, ut = Object.getOwnPropertyDescriptor, D = (t, e, r, s) => {
413
+ for (var o = s > 1 ? void 0 : s ? ut(e, r) : e, a = t.length - 1, i; a >= 0; a--)
414
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
415
+ return s && o && mt(e, r, o), o;
415
416
  };
416
- let w = class extends m {
417
+ let _ = class extends m {
417
418
  //#region Lifecycle
418
- constructor(e) {
419
- super(e), this.type = "start-node";
419
+ constructor(t) {
420
+ super(t), this.type = "start-node";
420
421
  }
421
422
  //#endregion
422
423
  //#region Public Methods
423
424
  createRuntimeNode() {
424
- return (e) => ({ question: e.agentExecutionContext.userRequest });
425
+ return (t) => ({ question: t.agentExecutionContext.userRequest });
425
426
  }
426
- static fromJSON(e) {
427
- return new w({
428
- id: e.id,
429
- label: e.label,
427
+ static fromJSON(t) {
428
+ return new _({
429
+ id: t.id,
430
+ label: t.label,
430
431
  type: "start-node"
431
432
  });
432
433
  }
@@ -434,68 +435,68 @@ let w = class extends m {
434
435
  //#region Private Methods
435
436
  //#endregion
436
437
  };
437
- R([
438
+ D([
438
439
  n()
439
- ], w.prototype, "type", 2);
440
- w = R([
440
+ ], _.prototype, "type", 2);
441
+ _ = D([
441
442
  l("StartNode")
442
- ], w);
443
- function de(e) {
444
- switch (e.type) {
443
+ ], _);
444
+ function dt(t) {
445
+ switch (t.type) {
445
446
  case "agent_node":
446
- return u.fromJSON(e);
447
+ return u.fromJSON(t);
447
448
  case "end_message_node":
448
- return h.fromJSON(e);
449
+ return h.fromJSON(t);
449
450
  case "start_node":
450
- return w.fromJSON(e);
451
+ return _.fromJSON(t);
451
452
  default:
452
- throw new Error(`WebAgent node "${e.id}" uses unsupported type "${e.type}".`);
453
+ throw new Error(`WebAgent node "${t.id}" uses unsupported type "${t.type}".`);
453
454
  }
454
455
  }
455
- function le(e = {}) {
456
- const t = Object.keys(e);
457
- if (H(t), t.includes("nodes"))
456
+ function lt(t = {}) {
457
+ const e = Object.keys(t);
458
+ if (H(e), e.includes("nodes"))
458
459
  throw new Error("node state cannot define reserved field: nodes.");
459
- const r = V(e);
460
+ const r = U(t);
460
461
  return x.Root({
461
462
  ...r,
462
463
  nodes: x({
463
464
  reducer: (s, o) => ({ ...s, ...o }),
464
465
  default: () => ({})
465
466
  }),
466
- ...U()
467
+ ...V()
467
468
  });
468
469
  }
469
- function D(e) {
470
- const t = /* @__PURE__ */ new Set();
471
- for (const s of e)
470
+ function F(t) {
471
+ const e = /* @__PURE__ */ new Set();
472
+ for (const s of t)
472
473
  for (const o of Object.keys(s.shape ?? {}))
473
- o !== "nodes" && t.add(o);
474
- const r = Object.fromEntries([...t].map((s) => [s, void 0]));
475
- return le(r);
474
+ o !== "nodes" && e.add(o);
475
+ const r = Object.fromEntries([...e].map((s) => [s, void 0]));
476
+ return lt(r);
476
477
  }
477
478
  class P {
478
479
  //#endregion Private Properties
479
480
  //#region Lifecycle
480
- constructor(t, r, s) {
481
- this.sourceJSON = t, this.edges = r, this.nodes = s, this._loaded = !1;
481
+ constructor(e, r, s) {
482
+ this.sourceJSON = e, this.edges = r, this.nodes = s, this._loaded = !1;
482
483
  }
483
484
  //#endregion Lifecycle
484
485
  //#region Public Methods
485
- static fromJSON(t) {
486
+ static fromJSON(e) {
486
487
  return new P(
487
- t,
488
- t.graph.edges.map((r) => p.fromJSON(r)),
489
- t.graph.nodes.map((r) => de(r))
488
+ e,
489
+ e.graph.edges.map((r) => p.fromJSON(r)),
490
+ e.graph.nodes.map((r) => dt(r))
490
491
  );
491
492
  }
492
493
  async load() {
493
- return this._loadPromise ??= Promise.all(this.nodes.map(async (t) => await t.load())).then(() => {
494
+ return this._loadPromise ??= Promise.all(this.nodes.map(async (e) => await e.load())).then(() => {
494
495
  this._loaded = !0;
495
496
  }), await this._loadPromise, this;
496
497
  }
497
498
  getSchemas() {
498
- const t = Object.fromEntries(
499
+ const e = Object.fromEntries(
499
500
  this._getNodeCompilations().flatMap((s, o) => {
500
501
  const a = this.nodes[o];
501
502
  return s.schemas?.map((i) => [a.id, i]) ?? [];
@@ -503,16 +504,16 @@ class P {
503
504
  );
504
505
  return [c.object({
505
506
  loopCounts: c.record(c.string(), c.number()).optional(),
506
- nodes: c.object(t).partial().optional(),
507
+ nodes: c.object(e).partial().optional(),
507
508
  question: c.string().optional()
508
509
  })];
509
510
  }
510
511
  generate() {
511
512
  this._assertLoaded(), this._nodeCompilations = void 0;
512
- const t = this._getNodeCompilations(), r = D(this.getSchemas()), s = this.nodes.find((i) => i.type === "start-node")?.id, o = {}, a = [];
513
+ const e = this._getNodeCompilations(), r = F(this.getSchemas()), s = this.nodes.find((i) => i.type === "start-node")?.id, o = {}, a = [];
513
514
  for (const [i, O] of this.nodes.entries()) {
514
- const _ = t[i];
515
- _ && (_.runtimeNode && (o[O.id] = _.runtimeNode), a.push(..._.edges));
515
+ const y = e[i];
516
+ y && (y.runtimeNode && (o[O.id] = y.runtimeNode), a.push(...y.edges));
516
517
  }
517
518
  return {
518
519
  createGraph: () => B(o, a, r, { entryNode: s }),
@@ -527,25 +528,25 @@ class P {
527
528
  }
528
529
  _getNodeCompilations() {
529
530
  return this._assertLoaded(), this._nodeCompilations ??= this.nodes.map(
530
- (t) => t.compile({
531
- outgoingEdges: this.edges.filter((r) => r.sourceNodeId === t.id)
531
+ (e) => e.compile({
532
+ outgoingEdges: this.edges.filter((r) => r.sourceNodeId === e.id)
532
533
  })
533
534
  );
534
535
  }
535
536
  //#endregion Private Methods
536
537
  }
537
- var he = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, E = (e, t, r, s) => {
538
- for (var o = s > 1 ? void 0 : s ? ge(t, r) : t, a = e.length - 1, i; a >= 0; a--)
539
- (i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
540
- return s && o && he(t, r, o), o;
538
+ var ht = Object.defineProperty, gt = Object.getOwnPropertyDescriptor, E = (t, e, r, s) => {
539
+ for (var o = s > 1 ? void 0 : s ? gt(e, r) : e, a = t.length - 1, i; a >= 0; a--)
540
+ (i = t[a]) && (o = (s ? i(e, r, o) : i(o)) || o);
541
+ return s && o && ht(e, r, o), o;
541
542
  };
542
- const fe = () => {
543
+ const ft = () => {
543
544
  throw new Error("WebAgent must be loaded before it can run.");
544
545
  };
545
546
  let g = class extends G {
546
547
  //#region Lifecycle
547
- constructor(e) {
548
- super(e);
548
+ constructor(t) {
549
+ super(t);
549
550
  }
550
551
  //#endregion
551
552
  //#region Public Methods
@@ -556,32 +557,32 @@ let g = class extends G {
556
557
  } catch (r) {
557
558
  throw new b("web-agent:load-portal-item", "Failed to load portal item", { error: r });
558
559
  }
559
- const t = await this.portalItem.fetchData();
560
- if (this.sourceJSON = t, !this.portalItem.title)
560
+ const e = await this.portalItem.fetchData();
561
+ if (this.sourceJSON = e, !this.portalItem.title)
561
562
  throw new b("web-agent:missing-title", "The portal item is missing a title");
562
563
  }
563
564
  if (!this.sourceJSON)
564
565
  throw new b("web-agent:missing-source-json", "The source JSON is missing");
565
566
  if (!this.sourceJSON.description)
566
567
  throw new b("web-agent:missing-description", "The source JSON is missing a description");
567
- const e = P.fromJSON(this.sourceJSON);
568
- return await e.load(), this._runtime = e, this.description = this.sourceJSON.description, this.name = this.portalItem?.title ?? `web-agent-${Date.now()}`, this.generate(), this;
568
+ const t = P.fromJSON(this.sourceJSON);
569
+ return await t.load(), this._runtime = t, this.description = this.sourceJSON.description, this.name = this.portalItem?.title ?? `web-agent-${Date.now()}`, this.generate(), this;
569
570
  }
570
571
  getSchemas() {
571
572
  return this._runtime?.getSchemas() ?? [];
572
573
  }
573
574
  generate() {
574
575
  if (!this._runtime) {
575
- this._set("workspace", D([])), this._set("createGraph", fe);
576
+ this._set("workspace", F([])), this._set("createGraph", ft);
576
577
  return;
577
578
  }
578
- const { createGraph: e, workspace: t } = this._runtime.generate();
579
- this._set("workspace", t), this._set("createGraph", e);
579
+ const { createGraph: t, workspace: e } = this._runtime.generate();
580
+ this._set("workspace", e), this._set("createGraph", t);
580
581
  }
581
582
  //#endregion
582
583
  };
583
584
  E([
584
- n({ type: F })
585
+ n({ type: C })
585
586
  ], g.prototype, "portalItem", 2);
586
587
  E([
587
588
  n()
@@ -589,29 +590,29 @@ E([
589
590
  g = E([
590
591
  l("WebAgent")
591
592
  ], g);
592
- class we extends L {
593
+ class _t extends M {
593
594
  static {
594
595
  this.properties = { agent: 0, context: 0, itemId: 1, workflow: 0 };
595
596
  }
596
- #e;
597
+ #t;
597
598
  async getContext() {
598
- return M(this.context) ? await this.context() : this.context;
599
+ return W(this.context) ? await this.context() : this.context;
599
600
  }
600
601
  async load() {
601
- let t;
602
+ let e;
602
603
  if (this.itemId) {
603
604
  const r = j.getDefault();
604
- t = new g({ portalItem: new F({ id: this.itemId, portal: r }) });
605
- } else this.workflow && (t = new g({ sourceJSON: this.workflow }));
606
- if (t && (await t.load(), this.agent = t.registration), !this.agent)
605
+ e = new g({ portalItem: new C({ id: this.itemId, portal: r }) });
606
+ } else this.workflow && (e = new g({ sourceJSON: this.workflow }));
607
+ if (e && (await e.load(), this.agent = e.registration), !this.agent)
607
608
  throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");
608
- this.#e = W(this);
609
+ this.#t = L(this);
609
610
  }
610
611
  disconnectedCallback() {
611
- this.#e?.unregister(this.agent.id), super.disconnectedCallback();
612
+ this.#t?.unregister(this.agent.id), super.disconnectedCallback();
612
613
  }
613
614
  }
614
- q("arcgis-assistant-agent", we);
615
+ q("arcgis-assistant-agent", _t);
615
616
  export {
616
- we as ArcgisAssistantAgent
617
+ _t as ArcgisAssistantAgent
617
618
  };