@arcgis/ai-components 5.2.0-next.90 → 5.2.0-next.91
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.
- package/dist/agentic-workflow/jsonTypes.d.ts +6 -0
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +2 -1
- package/dist/cdn/{HGDC6DEJ.js → 4KOV2NEI.js} +1 -1
- package/dist/cdn/{6U4GTCLJ.js → 5FL5BTTX.js} +24 -24
- package/dist/cdn/{Y4T4FQJC.js → AZCIDPML.js} +1 -1
- package/dist/cdn/KCU4FWF7.js +2 -0
- package/dist/cdn/{FULSCC5I.js → PKUDO2RC.js} +2 -2
- package/dist/cdn/{YB7AS6XQ.js → QCFICJ7U.js} +1 -1
- package/dist/cdn/{JQX7LNCN.js → WR2SQX3J.js} +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/components/arcgis-assistant/customElement.js +24 -24
- package/dist/components/arcgis-assistant-agent/customElement.js +188 -183
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +6 -6
- package/dist/cdn/XCW5WVZZ.js +0 -2
|
@@ -27,25 +27,25 @@ import "@arcgis/core/config.js";
|
|
|
27
27
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
28
28
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
29
29
|
import { a as V } from "../../chunks/baseAgentState.js";
|
|
30
|
-
var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, f = (
|
|
31
|
-
for (var o = s > 1 ? void 0 : s ? Q(
|
|
32
|
-
(i =
|
|
33
|
-
return s && o && K(
|
|
30
|
+
var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, f = (e, t, r, s) => {
|
|
31
|
+
for (var o = s > 1 ? void 0 : s ? Q(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
32
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
33
|
+
return s && o && K(t, r, o), o;
|
|
34
34
|
};
|
|
35
35
|
let p = class extends T {
|
|
36
36
|
//#region Lifecycle
|
|
37
|
-
constructor(
|
|
38
|
-
super(
|
|
37
|
+
constructor(e) {
|
|
38
|
+
super(e);
|
|
39
39
|
}
|
|
40
40
|
//#endregion
|
|
41
41
|
//#region Public Methods
|
|
42
|
-
static fromJSON(
|
|
42
|
+
static fromJSON(e) {
|
|
43
43
|
return new p({
|
|
44
|
-
id:
|
|
45
|
-
sourceAnchorId:
|
|
46
|
-
sourceNodeId:
|
|
47
|
-
targetAnchorId:
|
|
48
|
-
targetNodeId:
|
|
44
|
+
id: e.id,
|
|
45
|
+
sourceAnchorId: e.source_anchor_id,
|
|
46
|
+
sourceNodeId: e.source_node_id,
|
|
47
|
+
targetAnchorId: e.target_anchor_id,
|
|
48
|
+
targetNodeId: e.target_node_id
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
51
|
//#endregion
|
|
@@ -68,31 +68,31 @@ f([
|
|
|
68
68
|
p = f([
|
|
69
69
|
l("Edge")
|
|
70
70
|
], p);
|
|
71
|
-
var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, v = (
|
|
72
|
-
for (var o = s > 1 ? void 0 : s ? Y(
|
|
73
|
-
(i =
|
|
74
|
-
return s && o && X(
|
|
71
|
+
var X = Object.defineProperty, Y = Object.getOwnPropertyDescriptor, v = (e, t, r, s) => {
|
|
72
|
+
for (var o = s > 1 ? void 0 : s ? Y(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
73
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
74
|
+
return s && o && X(t, r, o), o;
|
|
75
75
|
};
|
|
76
|
-
let
|
|
76
|
+
let u = class extends T {
|
|
77
77
|
//#region Lifecycle
|
|
78
|
-
constructor(
|
|
79
|
-
super(
|
|
78
|
+
constructor(e) {
|
|
79
|
+
super(e);
|
|
80
80
|
}
|
|
81
81
|
//#endregion
|
|
82
82
|
//#region Public Methods
|
|
83
83
|
async load() {
|
|
84
84
|
return await Promise.resolve(this);
|
|
85
85
|
}
|
|
86
|
-
compile(
|
|
86
|
+
compile(e) {
|
|
87
87
|
return {
|
|
88
88
|
runtimeNode: this.createRuntimeNode(),
|
|
89
|
-
edges:
|
|
89
|
+
edges: e.outgoingEdges.map((t) => ({
|
|
90
90
|
from: this.id,
|
|
91
|
-
to:
|
|
91
|
+
to: t.targetNodeId
|
|
92
92
|
}))
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
|
-
static fromJSON(
|
|
95
|
+
static fromJSON(e) {
|
|
96
96
|
throw new Error("BaseNode is abstract and cannot be instantiated directly.");
|
|
97
97
|
}
|
|
98
98
|
//#endregion
|
|
@@ -101,48 +101,48 @@ let m = class extends T {
|
|
|
101
101
|
};
|
|
102
102
|
v([
|
|
103
103
|
n()
|
|
104
|
-
],
|
|
104
|
+
], u.prototype, "id", 2);
|
|
105
105
|
v([
|
|
106
106
|
n()
|
|
107
|
-
],
|
|
107
|
+
], u.prototype, "label", 2);
|
|
108
108
|
v([
|
|
109
109
|
n()
|
|
110
|
-
],
|
|
111
|
-
|
|
110
|
+
], u.prototype, "type", 2);
|
|
111
|
+
u = v([
|
|
112
112
|
l("BaseNode")
|
|
113
|
-
],
|
|
114
|
-
function I(
|
|
115
|
-
const
|
|
116
|
-
Object.entries(
|
|
113
|
+
], u);
|
|
114
|
+
function I(e) {
|
|
115
|
+
const t = new Set(e.required), r = Object.fromEntries(
|
|
116
|
+
Object.entries(e.properties).map(([s, o]) => {
|
|
117
117
|
const a = $(o);
|
|
118
|
-
return [s,
|
|
118
|
+
return [s, t.has(s) ? a : a.optional()];
|
|
119
119
|
})
|
|
120
120
|
);
|
|
121
121
|
return c.object(r);
|
|
122
122
|
}
|
|
123
|
-
function $(
|
|
124
|
-
let
|
|
125
|
-
switch (
|
|
123
|
+
function $(e) {
|
|
124
|
+
let t;
|
|
125
|
+
switch (e.type) {
|
|
126
126
|
case "array":
|
|
127
|
-
|
|
127
|
+
t = c.array(e.items ? $(e.items) : c.unknown());
|
|
128
128
|
break;
|
|
129
129
|
case "boolean":
|
|
130
|
-
|
|
130
|
+
t = c.boolean();
|
|
131
131
|
break;
|
|
132
132
|
case "number":
|
|
133
|
-
|
|
133
|
+
t = c.number();
|
|
134
134
|
break;
|
|
135
135
|
case "object":
|
|
136
|
-
|
|
137
|
-
properties:
|
|
138
|
-
required:
|
|
136
|
+
t = I({
|
|
137
|
+
properties: e.properties ?? {},
|
|
138
|
+
required: e.required
|
|
139
139
|
});
|
|
140
140
|
break;
|
|
141
141
|
case "string":
|
|
142
|
-
|
|
142
|
+
t = e.enum?.length ? c.enum(e.enum) : c.string();
|
|
143
143
|
break;
|
|
144
144
|
}
|
|
145
|
-
return
|
|
145
|
+
return e.description ? t.describe(e.description) : t;
|
|
146
146
|
}
|
|
147
147
|
const k = /* @__PURE__ */ new Map([
|
|
148
148
|
[
|
|
@@ -222,33 +222,33 @@ const k = /* @__PURE__ */ new Map([
|
|
|
222
222
|
async () => (await import("../../agents/tools/query/queryFeatures/adapter.js")).queryFeaturesTool
|
|
223
223
|
]
|
|
224
224
|
]);
|
|
225
|
-
async function
|
|
226
|
-
const
|
|
227
|
-
if (!
|
|
228
|
-
throw new Error(`ArcGIS tool is not supported in the browser runtime: ${
|
|
229
|
-
return await
|
|
225
|
+
async function ee(e) {
|
|
226
|
+
const t = k.get(e);
|
|
227
|
+
if (!t)
|
|
228
|
+
throw new Error(`ArcGIS tool is not supported in the browser runtime: ${e}`);
|
|
229
|
+
return await t();
|
|
230
230
|
}
|
|
231
|
-
var
|
|
232
|
-
for (var o = s > 1 ? void 0 : s ?
|
|
233
|
-
(i =
|
|
234
|
-
return s && o &&
|
|
231
|
+
var te = Object.defineProperty, oe = Object.getOwnPropertyDescriptor, N = (e, t, r, s) => {
|
|
232
|
+
for (var o = s > 1 ? void 0 : s ? oe(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
233
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
234
|
+
return s && o && te(t, r, o), o;
|
|
235
235
|
};
|
|
236
236
|
let d = class extends T {
|
|
237
237
|
//#region Lifecycle
|
|
238
|
-
constructor(
|
|
239
|
-
super(
|
|
238
|
+
constructor(e) {
|
|
239
|
+
super(e), this.type = "arcgis-tool";
|
|
240
240
|
}
|
|
241
241
|
//#endregion
|
|
242
242
|
//#region Public Methods
|
|
243
243
|
async createRuntimeTools() {
|
|
244
244
|
if (!this.name)
|
|
245
245
|
throw new Error("ArcgisTool name is required");
|
|
246
|
-
return [await
|
|
246
|
+
return [await ee(this.name)];
|
|
247
247
|
}
|
|
248
|
-
static fromJSON(
|
|
248
|
+
static fromJSON(e) {
|
|
249
249
|
return new d({
|
|
250
|
-
name:
|
|
251
|
-
requireApproval:
|
|
250
|
+
name: e.name,
|
|
251
|
+
requireApproval: e.require_approval
|
|
252
252
|
});
|
|
253
253
|
}
|
|
254
254
|
//#endregion
|
|
@@ -265,25 +265,25 @@ N([
|
|
|
265
265
|
d = N([
|
|
266
266
|
l("ArcgisTool")
|
|
267
267
|
], d);
|
|
268
|
-
var
|
|
269
|
-
throw TypeError(
|
|
270
|
-
},
|
|
271
|
-
for (var o = s > 1 ? void 0 : s ?
|
|
272
|
-
(i =
|
|
273
|
-
return s && o &&
|
|
274
|
-
},
|
|
275
|
-
let
|
|
268
|
+
var re = Object.defineProperty, se = Object.getOwnPropertyDescriptor, J = (e) => {
|
|
269
|
+
throw TypeError(e);
|
|
270
|
+
}, _ = (e, t, r, s) => {
|
|
271
|
+
for (var o = s > 1 ? void 0 : s ? se(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
272
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
273
|
+
return s && o && re(t, r, o), o;
|
|
274
|
+
}, ae = (e, t, r) => t.has(e) || J("Cannot " + r), ie = (e, t, r) => t.has(e) ? J("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), S, R;
|
|
275
|
+
let m = class extends u {
|
|
276
276
|
//#region Lifecycle
|
|
277
|
-
constructor(
|
|
278
|
-
super(
|
|
277
|
+
constructor(e) {
|
|
278
|
+
super(e), ie(this, S), this.type = "agent-node";
|
|
279
279
|
}
|
|
280
280
|
//#endregion
|
|
281
281
|
//#region Public Methods
|
|
282
282
|
createRuntimeNode() {
|
|
283
|
-
let
|
|
284
|
-
return async (
|
|
285
|
-
|
|
286
|
-
const o = await (await
|
|
283
|
+
let e;
|
|
284
|
+
return async (t, r) => {
|
|
285
|
+
e ??= ne(this, S, R).call(this);
|
|
286
|
+
const o = await (await e).run(t, r), a = this.outputSchema?.safeParse(o);
|
|
287
287
|
if (a && !a.success)
|
|
288
288
|
throw a.error;
|
|
289
289
|
const i = a?.data, O = i ?? o.outputMessage;
|
|
@@ -298,14 +298,14 @@ let u = class extends m {
|
|
|
298
298
|
};
|
|
299
299
|
};
|
|
300
300
|
}
|
|
301
|
-
compile(
|
|
302
|
-
const
|
|
301
|
+
compile(e) {
|
|
302
|
+
const t = e.outgoingEdges[0]?.targetNodeId;
|
|
303
303
|
return {
|
|
304
304
|
runtimeNode: this.createRuntimeNode(),
|
|
305
305
|
edges: [
|
|
306
306
|
{
|
|
307
307
|
from: this.id,
|
|
308
|
-
decide: (r) => r.status === "failed" ? void 0 :
|
|
308
|
+
decide: (r) => r.status === "failed" ? void 0 : t
|
|
309
309
|
}
|
|
310
310
|
],
|
|
311
311
|
schemas: [
|
|
@@ -315,86 +315,91 @@ let u = class extends m {
|
|
|
315
315
|
]
|
|
316
316
|
};
|
|
317
317
|
}
|
|
318
|
-
static fromJSON(
|
|
319
|
-
const
|
|
320
|
-
id:
|
|
321
|
-
label:
|
|
322
|
-
prompt:
|
|
323
|
-
type: "agent-node"
|
|
318
|
+
static fromJSON(e) {
|
|
319
|
+
const t = new m({
|
|
320
|
+
id: e.id,
|
|
321
|
+
label: e.label,
|
|
322
|
+
prompt: e.prompt?.content,
|
|
323
|
+
type: "agent-node",
|
|
324
|
+
modelTier: e.llm_model?.model_tier
|
|
324
325
|
});
|
|
325
|
-
return
|
|
326
|
+
return e.structured_output && (t.outputSchema = I(e.structured_output)), t.tools = e.tools?.filter((r) => r.type === "arcgis_tool").map((r) => d.fromJSON(r)), t;
|
|
326
327
|
}
|
|
327
328
|
//#endregion
|
|
328
329
|
};
|
|
329
330
|
S = /* @__PURE__ */ new WeakSet();
|
|
330
331
|
R = async function() {
|
|
331
|
-
const
|
|
332
|
-
if (!
|
|
332
|
+
const e = this.prompt;
|
|
333
|
+
if (!e?.trim())
|
|
333
334
|
throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);
|
|
334
|
-
const
|
|
335
|
+
const t = [];
|
|
335
336
|
if (this.tools)
|
|
336
337
|
for (const r of this.tools) {
|
|
337
338
|
const s = await r.createRuntimeTools();
|
|
338
|
-
|
|
339
|
+
t.push(...s);
|
|
339
340
|
}
|
|
340
341
|
return new z({
|
|
341
342
|
name: this.id,
|
|
342
343
|
// TODO: change to label
|
|
343
344
|
outputSchema: this.outputSchema,
|
|
344
|
-
|
|
345
|
-
|
|
345
|
+
modelTier: this.modelTier,
|
|
346
|
+
prompt: e,
|
|
347
|
+
tools: t
|
|
346
348
|
});
|
|
347
349
|
};
|
|
348
|
-
|
|
350
|
+
_([
|
|
349
351
|
n()
|
|
350
|
-
],
|
|
351
|
-
|
|
352
|
+
], m.prototype, "type", 2);
|
|
353
|
+
_([
|
|
352
354
|
n()
|
|
353
|
-
],
|
|
354
|
-
|
|
355
|
+
], m.prototype, "prompt", 2);
|
|
356
|
+
_([
|
|
355
357
|
n()
|
|
356
|
-
],
|
|
357
|
-
|
|
358
|
+
], m.prototype, "outputSchema", 2);
|
|
359
|
+
_([
|
|
358
360
|
n()
|
|
359
|
-
],
|
|
360
|
-
|
|
361
|
+
], m.prototype, "tools", 2);
|
|
362
|
+
_([
|
|
363
|
+
n()
|
|
364
|
+
], m.prototype, "modelTier", 2);
|
|
365
|
+
m = _([
|
|
361
366
|
l("AgentNode")
|
|
362
|
-
],
|
|
363
|
-
var
|
|
364
|
-
for (var o = s > 1 ? void 0 : s ?
|
|
365
|
-
(i =
|
|
366
|
-
return s && o &&
|
|
367
|
+
], m);
|
|
368
|
+
var ce = Object.defineProperty, pe = Object.getOwnPropertyDescriptor, A = (e, t, r, s) => {
|
|
369
|
+
for (var o = s > 1 ? void 0 : s ? pe(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
370
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
371
|
+
return s && o && ce(t, r, o), o;
|
|
367
372
|
};
|
|
368
|
-
let h = class extends
|
|
373
|
+
let h = class extends u {
|
|
369
374
|
//#region Lifecycle
|
|
370
|
-
constructor(
|
|
371
|
-
super(
|
|
375
|
+
constructor(e) {
|
|
376
|
+
super(e), this.type = "end-message-node";
|
|
372
377
|
}
|
|
373
378
|
//#endregion
|
|
374
379
|
//#region Public Methods
|
|
375
380
|
createRuntimeNode() {
|
|
376
|
-
return async (
|
|
377
|
-
const
|
|
381
|
+
return async (e) => {
|
|
382
|
+
const t = await Z.fromTemplate(this.message, { templateFormat: "mustache" }).format(e);
|
|
378
383
|
return {
|
|
379
|
-
outputMessage:
|
|
384
|
+
outputMessage: t,
|
|
380
385
|
status: "success",
|
|
381
|
-
summary:
|
|
386
|
+
summary: t
|
|
382
387
|
};
|
|
383
388
|
};
|
|
384
389
|
}
|
|
385
|
-
compile(
|
|
390
|
+
compile(e) {
|
|
386
391
|
return {
|
|
387
392
|
runtimeNode: this.createRuntimeNode(),
|
|
388
393
|
edges: []
|
|
389
394
|
};
|
|
390
395
|
}
|
|
391
|
-
static fromJSON(
|
|
392
|
-
const
|
|
393
|
-
id:
|
|
394
|
-
label:
|
|
396
|
+
static fromJSON(e) {
|
|
397
|
+
const t = new h({
|
|
398
|
+
id: e.id,
|
|
399
|
+
label: e.label,
|
|
395
400
|
type: "end-message-node"
|
|
396
401
|
});
|
|
397
|
-
return
|
|
402
|
+
return t.message = e.message, t;
|
|
398
403
|
}
|
|
399
404
|
//#endregion
|
|
400
405
|
//#region Private Methods
|
|
@@ -409,25 +414,25 @@ A([
|
|
|
409
414
|
h = A([
|
|
410
415
|
l("EndMessageNode")
|
|
411
416
|
], h);
|
|
412
|
-
var
|
|
413
|
-
for (var o = s > 1 ? void 0 : s ?
|
|
414
|
-
(i =
|
|
415
|
-
return s && o &&
|
|
417
|
+
var me = Object.defineProperty, ue = Object.getOwnPropertyDescriptor, D = (e, t, r, s) => {
|
|
418
|
+
for (var o = s > 1 ? void 0 : s ? ue(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
419
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
420
|
+
return s && o && me(t, r, o), o;
|
|
416
421
|
};
|
|
417
|
-
let
|
|
422
|
+
let w = class extends u {
|
|
418
423
|
//#region Lifecycle
|
|
419
|
-
constructor(
|
|
420
|
-
super(
|
|
424
|
+
constructor(e) {
|
|
425
|
+
super(e), this.type = "start-node";
|
|
421
426
|
}
|
|
422
427
|
//#endregion
|
|
423
428
|
//#region Public Methods
|
|
424
429
|
createRuntimeNode() {
|
|
425
|
-
return (
|
|
430
|
+
return (e) => ({ question: e.agentExecutionContext.userRequest });
|
|
426
431
|
}
|
|
427
|
-
static fromJSON(
|
|
428
|
-
return new
|
|
429
|
-
id:
|
|
430
|
-
label:
|
|
432
|
+
static fromJSON(e) {
|
|
433
|
+
return new w({
|
|
434
|
+
id: e.id,
|
|
435
|
+
label: e.label,
|
|
431
436
|
type: "start-node"
|
|
432
437
|
});
|
|
433
438
|
}
|
|
@@ -437,27 +442,27 @@ let _ = class extends m {
|
|
|
437
442
|
};
|
|
438
443
|
D([
|
|
439
444
|
n()
|
|
440
|
-
],
|
|
441
|
-
|
|
445
|
+
], w.prototype, "type", 2);
|
|
446
|
+
w = D([
|
|
442
447
|
l("StartNode")
|
|
443
|
-
],
|
|
444
|
-
function
|
|
445
|
-
switch (
|
|
448
|
+
], w);
|
|
449
|
+
function de(e) {
|
|
450
|
+
switch (e.type) {
|
|
446
451
|
case "agent_node":
|
|
447
|
-
return
|
|
452
|
+
return m.fromJSON(e);
|
|
448
453
|
case "end_message_node":
|
|
449
|
-
return h.fromJSON(
|
|
454
|
+
return h.fromJSON(e);
|
|
450
455
|
case "start_node":
|
|
451
|
-
return
|
|
456
|
+
return w.fromJSON(e);
|
|
452
457
|
default:
|
|
453
|
-
throw new Error(`WebAgent node "${
|
|
458
|
+
throw new Error(`WebAgent node "${e.id}" uses unsupported type "${e.type}".`);
|
|
454
459
|
}
|
|
455
460
|
}
|
|
456
|
-
function
|
|
457
|
-
const
|
|
458
|
-
if (H(
|
|
461
|
+
function le(e = {}) {
|
|
462
|
+
const t = Object.keys(e);
|
|
463
|
+
if (H(t), t.includes("nodes"))
|
|
459
464
|
throw new Error("node state cannot define reserved field: nodes.");
|
|
460
|
-
const r = U(
|
|
465
|
+
const r = U(e);
|
|
461
466
|
return x.Root({
|
|
462
467
|
...r,
|
|
463
468
|
nodes: x({
|
|
@@ -467,36 +472,36 @@ function lt(t = {}) {
|
|
|
467
472
|
...V()
|
|
468
473
|
});
|
|
469
474
|
}
|
|
470
|
-
function F(
|
|
471
|
-
const
|
|
472
|
-
for (const s of
|
|
475
|
+
function F(e) {
|
|
476
|
+
const t = /* @__PURE__ */ new Set();
|
|
477
|
+
for (const s of e)
|
|
473
478
|
for (const o of Object.keys(s.shape ?? {}))
|
|
474
|
-
o !== "nodes" &&
|
|
475
|
-
const r = Object.fromEntries([...
|
|
476
|
-
return
|
|
479
|
+
o !== "nodes" && t.add(o);
|
|
480
|
+
const r = Object.fromEntries([...t].map((s) => [s, void 0]));
|
|
481
|
+
return le(r);
|
|
477
482
|
}
|
|
478
483
|
class P {
|
|
479
484
|
//#endregion Private Properties
|
|
480
485
|
//#region Lifecycle
|
|
481
|
-
constructor(
|
|
482
|
-
this.sourceJSON =
|
|
486
|
+
constructor(t, r, s) {
|
|
487
|
+
this.sourceJSON = t, this.edges = r, this.nodes = s, this._loaded = !1;
|
|
483
488
|
}
|
|
484
489
|
//#endregion Lifecycle
|
|
485
490
|
//#region Public Methods
|
|
486
|
-
static fromJSON(
|
|
491
|
+
static fromJSON(t) {
|
|
487
492
|
return new P(
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
493
|
+
t,
|
|
494
|
+
t.graph.edges.map((r) => p.fromJSON(r)),
|
|
495
|
+
t.graph.nodes.map((r) => de(r))
|
|
491
496
|
);
|
|
492
497
|
}
|
|
493
498
|
async load() {
|
|
494
|
-
return this._loadPromise ??= Promise.all(this.nodes.map(async (
|
|
499
|
+
return this._loadPromise ??= Promise.all(this.nodes.map(async (t) => await t.load())).then(() => {
|
|
495
500
|
this._loaded = !0;
|
|
496
501
|
}), await this._loadPromise, this;
|
|
497
502
|
}
|
|
498
503
|
getSchemas() {
|
|
499
|
-
const
|
|
504
|
+
const t = Object.fromEntries(
|
|
500
505
|
this._getNodeCompilations().flatMap((s, o) => {
|
|
501
506
|
const a = this.nodes[o];
|
|
502
507
|
return s.schemas?.map((i) => [a.id, i]) ?? [];
|
|
@@ -504,15 +509,15 @@ class P {
|
|
|
504
509
|
);
|
|
505
510
|
return [c.object({
|
|
506
511
|
loopCounts: c.record(c.string(), c.number()).optional(),
|
|
507
|
-
nodes: c.object(
|
|
512
|
+
nodes: c.object(t).partial().optional(),
|
|
508
513
|
question: c.string().optional()
|
|
509
514
|
})];
|
|
510
515
|
}
|
|
511
516
|
generate() {
|
|
512
517
|
this._assertLoaded(), this._nodeCompilations = void 0;
|
|
513
|
-
const
|
|
518
|
+
const t = this._getNodeCompilations(), r = F(this.getSchemas()), s = this.nodes.find((i) => i.type === "start-node")?.id, o = {}, a = [];
|
|
514
519
|
for (const [i, O] of this.nodes.entries()) {
|
|
515
|
-
const y =
|
|
520
|
+
const y = t[i];
|
|
516
521
|
y && (y.runtimeNode && (o[O.id] = y.runtimeNode), a.push(...y.edges));
|
|
517
522
|
}
|
|
518
523
|
return {
|
|
@@ -528,25 +533,25 @@ class P {
|
|
|
528
533
|
}
|
|
529
534
|
_getNodeCompilations() {
|
|
530
535
|
return this._assertLoaded(), this._nodeCompilations ??= this.nodes.map(
|
|
531
|
-
(
|
|
532
|
-
outgoingEdges: this.edges.filter((r) => r.sourceNodeId ===
|
|
536
|
+
(t) => t.compile({
|
|
537
|
+
outgoingEdges: this.edges.filter((r) => r.sourceNodeId === t.id)
|
|
533
538
|
})
|
|
534
539
|
);
|
|
535
540
|
}
|
|
536
541
|
//#endregion Private Methods
|
|
537
542
|
}
|
|
538
|
-
var
|
|
539
|
-
for (var o = s > 1 ? void 0 : s ?
|
|
540
|
-
(i =
|
|
541
|
-
return s && o &&
|
|
543
|
+
var he = Object.defineProperty, ge = Object.getOwnPropertyDescriptor, E = (e, t, r, s) => {
|
|
544
|
+
for (var o = s > 1 ? void 0 : s ? ge(t, r) : t, a = e.length - 1, i; a >= 0; a--)
|
|
545
|
+
(i = e[a]) && (o = (s ? i(t, r, o) : i(o)) || o);
|
|
546
|
+
return s && o && he(t, r, o), o;
|
|
542
547
|
};
|
|
543
|
-
const
|
|
548
|
+
const fe = () => {
|
|
544
549
|
throw new Error("WebAgent must be loaded before it can run.");
|
|
545
550
|
};
|
|
546
551
|
let g = class extends G {
|
|
547
552
|
//#region Lifecycle
|
|
548
|
-
constructor(
|
|
549
|
-
super(
|
|
553
|
+
constructor(e) {
|
|
554
|
+
super(e);
|
|
550
555
|
}
|
|
551
556
|
//#endregion
|
|
552
557
|
//#region Public Methods
|
|
@@ -557,27 +562,27 @@ let g = class extends G {
|
|
|
557
562
|
} catch (r) {
|
|
558
563
|
throw new b("web-agent:load-portal-item", "Failed to load portal item", { error: r });
|
|
559
564
|
}
|
|
560
|
-
const
|
|
561
|
-
if (this.sourceJSON =
|
|
565
|
+
const t = await this.portalItem.fetchData();
|
|
566
|
+
if (this.sourceJSON = t, !this.portalItem.title)
|
|
562
567
|
throw new b("web-agent:missing-title", "The portal item is missing a title");
|
|
563
568
|
}
|
|
564
569
|
if (!this.sourceJSON)
|
|
565
570
|
throw new b("web-agent:missing-source-json", "The source JSON is missing");
|
|
566
571
|
if (!this.sourceJSON.description)
|
|
567
572
|
throw new b("web-agent:missing-description", "The source JSON is missing a description");
|
|
568
|
-
const
|
|
569
|
-
return await
|
|
573
|
+
const e = P.fromJSON(this.sourceJSON);
|
|
574
|
+
return await e.load(), this._runtime = e, this.description = this.sourceJSON.description, this.name = this.portalItem?.title ?? `web-agent-${Date.now()}`, this.generate(), this;
|
|
570
575
|
}
|
|
571
576
|
getSchemas() {
|
|
572
577
|
return this._runtime?.getSchemas() ?? [];
|
|
573
578
|
}
|
|
574
579
|
generate() {
|
|
575
580
|
if (!this._runtime) {
|
|
576
|
-
this._set("workspace", F([])), this._set("createGraph",
|
|
581
|
+
this._set("workspace", F([])), this._set("createGraph", fe);
|
|
577
582
|
return;
|
|
578
583
|
}
|
|
579
|
-
const { createGraph:
|
|
580
|
-
this._set("workspace",
|
|
584
|
+
const { createGraph: e, workspace: t } = this._runtime.generate();
|
|
585
|
+
this._set("workspace", t), this._set("createGraph", e);
|
|
581
586
|
}
|
|
582
587
|
//#endregion
|
|
583
588
|
};
|
|
@@ -590,29 +595,29 @@ E([
|
|
|
590
595
|
g = E([
|
|
591
596
|
l("WebAgent")
|
|
592
597
|
], g);
|
|
593
|
-
class
|
|
598
|
+
class _e extends M {
|
|
594
599
|
static {
|
|
595
600
|
this.properties = { agent: 0, context: 0, itemId: 1, workflow: 0 };
|
|
596
601
|
}
|
|
597
|
-
#
|
|
602
|
+
#e;
|
|
598
603
|
async getContext() {
|
|
599
604
|
return W(this.context) ? await this.context() : this.context;
|
|
600
605
|
}
|
|
601
606
|
async load() {
|
|
602
|
-
let
|
|
607
|
+
let t;
|
|
603
608
|
if (this.itemId) {
|
|
604
609
|
const r = j.getDefault();
|
|
605
|
-
|
|
606
|
-
} else this.workflow && (
|
|
607
|
-
if (
|
|
610
|
+
t = new g({ portalItem: new C({ id: this.itemId, portal: r }) });
|
|
611
|
+
} else this.workflow && (t = new g({ sourceJSON: this.workflow }));
|
|
612
|
+
if (t && (await t.load(), this.agent = t.registration), !this.agent)
|
|
608
613
|
throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");
|
|
609
|
-
this.#
|
|
614
|
+
this.#e = L(this);
|
|
610
615
|
}
|
|
611
616
|
disconnectedCallback() {
|
|
612
|
-
this.#
|
|
617
|
+
this.#e?.unregister(this.agent.id), super.disconnectedCallback();
|
|
613
618
|
}
|
|
614
619
|
}
|
|
615
|
-
q("arcgis-assistant-agent",
|
|
620
|
+
q("arcgis-assistant-agent", _e);
|
|
616
621
|
export {
|
|
617
|
-
|
|
622
|
+
_e as ArcgisAssistantAgent
|
|
618
623
|
};
|