@arcgis/ai-components 5.2.0-next.13 → 5.2.0-next.14
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/cdn/{LREQ3XAW.js → 22IT5TDB.js} +2 -2
- package/dist/cdn/7PANDHIL.js +16 -0
- package/dist/cdn/{KWTJAVWV.js → GBYLKQIL.js} +1 -1
- package/dist/cdn/{55R6J3FL.js → I2Y67HBL.js} +1 -1
- package/dist/cdn/JG2BIENI.js +3 -0
- package/dist/cdn/{ET453NAD.js → L4XF4H6V.js} +1 -1
- package/dist/cdn/{SRSFESAD.js → QYR3NSF2.js} +3 -3
- package/dist/cdn/{CFVVQXPJ.js → S75VFYR4.js} +5 -5
- package/dist/cdn/{X2ZDYHCG.js → TNMXWUXU.js} +9 -4
- package/dist/cdn/{DSVMXDPZ.js → XU6NCSE2.js} +1 -1
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +1 -1
- package/dist/chunks/arcgisKnowledgeGraph.js +5 -5
- package/dist/chunks/dataExplorationGraph.js +85 -74
- package/dist/chunks/data_explore_query_prompt.js +9 -4
- package/dist/chunks/generateLayerDescriptions.js +106 -106
- package/dist/chunks/orchestrator.js +63 -63
- package/dist/components/arcgis-assistant/customElement.js +123 -117
- 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 +5 -5
- package/dist/cdn/MRLTR3UO.js +0 -16
- package/dist/cdn/SWBER53G.js +0 -3
|
@@ -10,18 +10,18 @@ import * as O from "@arcgis/core/core/reactiveUtils.js";
|
|
|
10
10
|
import T from "@arcgis/core/layers/FeatureLayer.js";
|
|
11
11
|
import U from "@arcgis/core/request.js";
|
|
12
12
|
const G = async (t) => {
|
|
13
|
-
const e = await N(), r = await I("default"), s = C.getDefault(),
|
|
13
|
+
const e = await N(), r = await I("default"), s = C.getDefault(), o = (await R.getCredential(`${s.url}/sharing`)).token, i = {
|
|
14
14
|
type: "generateEmbeddings",
|
|
15
15
|
webmapEmbeddings: t,
|
|
16
|
-
auth: { apiUrl: r, token:
|
|
16
|
+
auth: { apiUrl: r, token: o }
|
|
17
17
|
};
|
|
18
18
|
return e.postMessage(i), await new Promise((c, d) => {
|
|
19
|
-
const
|
|
20
|
-
u.data === "completed" && (e.removeEventListener("message",
|
|
19
|
+
const a = (u) => {
|
|
20
|
+
u.data === "completed" && (e.removeEventListener("message", a), c());
|
|
21
21
|
}, g = (u) => {
|
|
22
|
-
e.removeEventListener("message",
|
|
22
|
+
e.removeEventListener("message", a), d(u instanceof Error ? u : new Error("Embeddings worker error"));
|
|
23
23
|
};
|
|
24
|
-
e.addEventListener("message",
|
|
24
|
+
e.addEventListener("message", a), e.addEventListener("error", g, { once: !0 });
|
|
25
25
|
}), e;
|
|
26
26
|
}, N = async () => {
|
|
27
27
|
{
|
|
@@ -58,18 +58,18 @@ const G = async (t) => {
|
|
|
58
58
|
const { previousSharedState: e, patch: r, agentId: s } = t;
|
|
59
59
|
if (!r)
|
|
60
60
|
return e;
|
|
61
|
-
const n = Date.now(),
|
|
61
|
+
const n = Date.now(), o = {
|
|
62
62
|
...e
|
|
63
63
|
};
|
|
64
64
|
for (const [i, c] of Object.entries(r))
|
|
65
|
-
c?.value !== void 0 && (
|
|
65
|
+
c?.value !== void 0 && (o[i] = {
|
|
66
66
|
value: c.value,
|
|
67
67
|
meta: {
|
|
68
68
|
updatedByAgentId: s,
|
|
69
69
|
updatedAt: n
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
|
-
return
|
|
72
|
+
return o;
|
|
73
73
|
}, f = (t) => {
|
|
74
74
|
if (typeof t != "string")
|
|
75
75
|
return;
|
|
@@ -87,18 +87,18 @@ const G = async (t) => {
|
|
|
87
87
|
return "Agent completed without a summary.";
|
|
88
88
|
}
|
|
89
89
|
}, K = (t, e) => {
|
|
90
|
-
const r = f(e?.outputMessage), s = f(e?.summary), n = e?.status,
|
|
91
|
-
|
|
90
|
+
const r = f(e?.outputMessage), s = f(e?.summary), n = e?.status, o = n === "success" || n === "failed" ? n : "unknown";
|
|
91
|
+
o === "unknown" && console.warn(`Agent "${t}" returned missing/invalid status. Defaulting to "unknown".`);
|
|
92
92
|
const i = Q(e?.sharedStatePatch, t);
|
|
93
93
|
return {
|
|
94
94
|
outputMessage: r,
|
|
95
|
-
summary: s ?? r ?? J(
|
|
96
|
-
status:
|
|
95
|
+
summary: s ?? r ?? J(o),
|
|
96
|
+
status: o,
|
|
97
97
|
sharedStatePatch: i
|
|
98
98
|
};
|
|
99
99
|
}, E = 4e3, X = async (t, e) => {
|
|
100
100
|
const r = v(e);
|
|
101
|
-
if (
|
|
101
|
+
if (e?.signal?.aborted)
|
|
102
102
|
return await l({ text: "Run cancelled; skipping agent execution" }, e), {
|
|
103
103
|
...t,
|
|
104
104
|
currentIntent: "none",
|
|
@@ -108,7 +108,7 @@ const G = async (t) => {
|
|
|
108
108
|
if (!n)
|
|
109
109
|
return console.warn(`No agent found for intent: ${t.currentIntent}`), t;
|
|
110
110
|
await l({ text: `Executing registered agent: ${n.agent.name}` }, e);
|
|
111
|
-
const
|
|
111
|
+
const o = {
|
|
112
112
|
...e ?? {},
|
|
113
113
|
configurable: {
|
|
114
114
|
...r ?? {},
|
|
@@ -118,7 +118,7 @@ const G = async (t) => {
|
|
|
118
118
|
};
|
|
119
119
|
let i;
|
|
120
120
|
try {
|
|
121
|
-
const
|
|
121
|
+
const a = await n.agent.createGraph().compile().invoke(
|
|
122
122
|
{
|
|
123
123
|
agentExecutionContext: {
|
|
124
124
|
...t.agentExecutionContext,
|
|
@@ -129,14 +129,14 @@ const G = async (t) => {
|
|
|
129
129
|
sharedState: structuredClone(t.agentExecutionContext.sharedState ?? {})
|
|
130
130
|
}
|
|
131
131
|
},
|
|
132
|
-
|
|
132
|
+
o
|
|
133
133
|
);
|
|
134
|
-
i = K(n.agent.name,
|
|
135
|
-
} catch (
|
|
136
|
-
if (D(
|
|
137
|
-
throw
|
|
138
|
-
const g =
|
|
139
|
-
console.error(`Agent "${n.agent.name}" failed:`,
|
|
134
|
+
i = K(n.agent.name, a), await l({ text: `Finished executing registered agent: ${n.agent.name}` }, e);
|
|
135
|
+
} catch (a) {
|
|
136
|
+
if (D(a) || e?.signal?.aborted || a instanceof Error && a.name === "AbortError")
|
|
137
|
+
throw a;
|
|
138
|
+
const g = a instanceof Error ? a.message : String(a);
|
|
139
|
+
console.error(`Agent "${n.agent.name}" failed:`, a), await l({ text: `Registered agent failed: ${n.agent.name}. ${g}` }, e), i = {
|
|
140
140
|
status: "failed",
|
|
141
141
|
outputMessage: `Agent execution failed: ${g}`,
|
|
142
142
|
summary: `Agent execution failed: ${g}`
|
|
@@ -144,9 +144,9 @@ const G = async (t) => {
|
|
|
144
144
|
}
|
|
145
145
|
const c = i.outputMessage, d = [...t.agentExecutionContext.messages];
|
|
146
146
|
if (c) {
|
|
147
|
-
const
|
|
147
|
+
const a = c.length > E ? `${c.slice(0, E - 14)}
|
|
148
148
|
[truncated]` : c;
|
|
149
|
-
d.push(new P(
|
|
149
|
+
d.push(new P(a));
|
|
150
150
|
}
|
|
151
151
|
return {
|
|
152
152
|
...t,
|
|
@@ -247,7 +247,7 @@ const re = async (t) => {
|
|
|
247
247
|
} catch (e) {
|
|
248
248
|
throw console.error("Failed to generate embeddings:", e), e;
|
|
249
249
|
}
|
|
250
|
-
},
|
|
250
|
+
}, x = async (t, e) => {
|
|
251
251
|
const r = e.get(t);
|
|
252
252
|
if (r)
|
|
253
253
|
return r;
|
|
@@ -257,13 +257,13 @@ const re = async (t) => {
|
|
|
257
257
|
async function ne(t, e, r, s) {
|
|
258
258
|
const n = `req-${Date.now()}`, i = {
|
|
259
259
|
type: "layerSearch",
|
|
260
|
-
precomputedEmbedding: s ? await
|
|
260
|
+
precomputedEmbedding: s ? await x(t, s) : void 0,
|
|
261
261
|
requestId: n,
|
|
262
262
|
minScore: r
|
|
263
263
|
};
|
|
264
264
|
return await new Promise((c) => {
|
|
265
|
-
const d = (
|
|
266
|
-
|
|
265
|
+
const d = (a) => {
|
|
266
|
+
a.data.requestId === n && c(a.data.results);
|
|
267
267
|
};
|
|
268
268
|
e.addEventListener("message", d, { once: !0 }), e.postMessage(i);
|
|
269
269
|
});
|
|
@@ -286,9 +286,9 @@ const ae = async ({
|
|
|
286
286
|
embeddingsWorker: r,
|
|
287
287
|
minScore: s,
|
|
288
288
|
topResults: n,
|
|
289
|
-
embeddingCache:
|
|
289
|
+
embeddingCache: o
|
|
290
290
|
}) => {
|
|
291
|
-
const i = `req-${Date.now()}`, c =
|
|
291
|
+
const i = `req-${Date.now()}`, c = o ? await x(t, o) : void 0, d = {
|
|
292
292
|
type: "fieldSearch",
|
|
293
293
|
layerIdForFieldsSearch: e,
|
|
294
294
|
precomputedEmbedding: c,
|
|
@@ -296,7 +296,7 @@ const ae = async ({
|
|
|
296
296
|
minScore: s,
|
|
297
297
|
topResults: n
|
|
298
298
|
};
|
|
299
|
-
return await new Promise((
|
|
299
|
+
return await new Promise((a) => {
|
|
300
300
|
const g = (u) => {
|
|
301
301
|
if (u.data.requestId !== i)
|
|
302
302
|
return;
|
|
@@ -304,7 +304,7 @@ const ae = async ({
|
|
|
304
304
|
layerId: y,
|
|
305
305
|
results: m
|
|
306
306
|
}));
|
|
307
|
-
|
|
307
|
+
a(p);
|
|
308
308
|
};
|
|
309
309
|
r.addEventListener("message", g, { once: !0 }), r.postMessage(d);
|
|
310
310
|
});
|
|
@@ -312,13 +312,13 @@ const ae = async ({
|
|
|
312
312
|
function ie(t) {
|
|
313
313
|
const { worker: e } = t;
|
|
314
314
|
return {
|
|
315
|
-
async searchFields({ text: r, layerIds: s, minScore: n, topResults:
|
|
315
|
+
async searchFields({ text: r, layerIds: s, minScore: n, topResults: o, embeddingCache: i }) {
|
|
316
316
|
return await ae({
|
|
317
317
|
combinedQuery: r,
|
|
318
318
|
layerIds: s,
|
|
319
319
|
embeddingsWorker: e,
|
|
320
320
|
minScore: n,
|
|
321
|
-
topResults:
|
|
321
|
+
topResults: o,
|
|
322
322
|
embeddingCache: i
|
|
323
323
|
});
|
|
324
324
|
}
|
|
@@ -336,12 +336,12 @@ const oe = (t) => {
|
|
|
336
336
|
}), t.length !== s.size)
|
|
337
337
|
throw new Error("Layer count mismatch during registry restoration. Regenerate embeddings.");
|
|
338
338
|
for (const n of t) {
|
|
339
|
-
const
|
|
340
|
-
if (!
|
|
339
|
+
const o = s.get(n.id);
|
|
340
|
+
if (!o)
|
|
341
341
|
throw new Error(
|
|
342
342
|
`Layer with ID ${n.id} not found in the original map during registry restoration. Regenerate embeddings.`
|
|
343
343
|
);
|
|
344
|
-
if (n.fields.length !==
|
|
344
|
+
if (n.fields.length !== o.fields.length)
|
|
345
345
|
throw new Error(
|
|
346
346
|
`Field count mismatch for layer ID ${n.id} during registry restoration. Regenerate embeddings.`
|
|
347
347
|
);
|
|
@@ -351,18 +351,18 @@ const oe = (t) => {
|
|
|
351
351
|
description: n.description
|
|
352
352
|
}, c = /* @__PURE__ */ new Map();
|
|
353
353
|
for (const d of n.fields) {
|
|
354
|
-
const
|
|
355
|
-
if (!
|
|
354
|
+
const a = o.fieldsIndex.get(d.name);
|
|
355
|
+
if (!a)
|
|
356
356
|
throw new Error(
|
|
357
357
|
`Field with name ${d.name} not found in the original layer ${n.id} during registry restoration. Regenerate embeddings.`
|
|
358
358
|
);
|
|
359
359
|
c.set(d.name, {
|
|
360
360
|
name: d.name,
|
|
361
|
-
alias:
|
|
361
|
+
alias: o.getFieldAlias(d.name) ?? d.alias,
|
|
362
362
|
description: d.description,
|
|
363
|
-
type:
|
|
364
|
-
valueType:
|
|
365
|
-
domain:
|
|
363
|
+
type: a.type || "unknown",
|
|
364
|
+
valueType: a.valueType || "unknown",
|
|
365
|
+
domain: o.getFieldDomain(d.name) ?? void 0
|
|
366
366
|
});
|
|
367
367
|
}
|
|
368
368
|
r.set(n.id, {
|
|
@@ -389,7 +389,7 @@ const oe = (t) => {
|
|
|
389
389
|
const n = await de(s.resource.url);
|
|
390
390
|
return oe(n);
|
|
391
391
|
};
|
|
392
|
-
class
|
|
392
|
+
class b {
|
|
393
393
|
constructor() {
|
|
394
394
|
this.orchestratorReady = !1, this.chatHistory = [], this.priorSteps = [], this.sharedState = {}, this.agentRegistry = new ee(), this.activeRunId = "", this.cancelledRunIds = /* @__PURE__ */ new Set(), this.streamEpoch = 0;
|
|
395
395
|
}
|
|
@@ -399,7 +399,7 @@ class x {
|
|
|
399
399
|
* @returns Ready Orchestrator.
|
|
400
400
|
*/
|
|
401
401
|
static async init(e) {
|
|
402
|
-
const r = new
|
|
402
|
+
const r = new b();
|
|
403
403
|
try {
|
|
404
404
|
if (e.view?.map) {
|
|
405
405
|
await O.whenOnce(() => e.view.ready);
|
|
@@ -433,22 +433,22 @@ class x {
|
|
|
433
433
|
return;
|
|
434
434
|
const r = q();
|
|
435
435
|
this.activeRunId = r, this.activeAbortController = new AbortController(), this.graph || (this.graph = Z().compile({ checkpointer: new j() }));
|
|
436
|
-
const s = this.embeddingsWorker ? se({ worker: this.embeddingsWorker }) : void 0, n = this.embeddingsWorker ? ie({ worker: this.embeddingsWorker }) : void 0,
|
|
436
|
+
const s = this.embeddingsWorker ? se({ worker: this.embeddingsWorker }) : void 0, n = this.embeddingsWorker ? ie({ worker: this.embeddingsWorker }) : void 0, o = /* @__PURE__ */ new Map(), i = {
|
|
437
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
438
|
+
thread_id: r,
|
|
439
|
+
hitlResponse: null,
|
|
440
|
+
services: {
|
|
441
|
+
layerSearch: s,
|
|
442
|
+
fieldSearch: n,
|
|
443
|
+
layersAndFieldsRegistry: this.layersAndFieldsRegistry,
|
|
444
|
+
agentRegistry: this.agentRegistry,
|
|
445
|
+
embeddingCache: o
|
|
446
|
+
}
|
|
447
|
+
}, c = {
|
|
437
448
|
version: "v2",
|
|
438
449
|
streamMode: "custom",
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
thread_id: r,
|
|
442
|
-
abortSignal: this.activeAbortController.signal,
|
|
443
|
-
hitlResponse: null,
|
|
444
|
-
services: {
|
|
445
|
-
layerSearch: s,
|
|
446
|
-
fieldSearch: n,
|
|
447
|
-
layersAndFieldsRegistry: this.layersAndFieldsRegistry,
|
|
448
|
-
agentRegistry: this.agentRegistry,
|
|
449
|
-
embeddingCache: a
|
|
450
|
-
}
|
|
451
|
-
},
|
|
450
|
+
signal: this.activeAbortController.signal,
|
|
451
|
+
configurable: i,
|
|
452
452
|
subgraphs: !0
|
|
453
453
|
}, d = this.graph?.streamEvents(
|
|
454
454
|
{
|
|
@@ -460,8 +460,8 @@ class x {
|
|
|
460
460
|
}
|
|
461
461
|
},
|
|
462
462
|
c
|
|
463
|
-
),
|
|
464
|
-
if (yield* this.pipeStream(d,
|
|
463
|
+
), a = ++this.streamEpoch;
|
|
464
|
+
if (yield* this.pipeStream(d, a, r), this.isRunCancelled(r)) {
|
|
465
465
|
yield { runId: r, timestamp: Date.now(), type: "cancelled", reason: "user" };
|
|
466
466
|
return;
|
|
467
467
|
}
|
|
@@ -564,6 +564,6 @@ class x {
|
|
|
564
564
|
}
|
|
565
565
|
}
|
|
566
566
|
export {
|
|
567
|
-
|
|
567
|
+
b as O,
|
|
568
568
|
re as g
|
|
569
569
|
};
|