@arcgis/ai-components 5.2.0-next.72 → 5.2.0-next.74
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/agent-utils/LLMAgent.d.ts +5 -2
- package/dist/agent-utils/LLMAgent.js +1 -1
- package/dist/agentic-workflow/jsonTypes.d.ts +8 -1
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +2 -0
- package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
- package/dist/cdn/253R5CBD.js +2 -0
- package/dist/cdn/2VBPA27M.js +18 -0
- package/dist/cdn/{DWYODVWW.js → 323DHVYA.js} +5 -5
- package/dist/cdn/34O57OGV.js +2 -0
- package/dist/cdn/{FSMHR7GK.js → 4HDDRBIY.js} +1 -1
- package/dist/cdn/4MFEKBKL.js +11 -0
- package/dist/cdn/{Y5UFOH54.js → 4NJ2FF7H.js} +1 -1
- package/dist/cdn/4YXYLX4H.js +2 -0
- package/dist/cdn/5DVRVY4L.js +2 -0
- package/dist/cdn/5PJXNTLZ.js +2 -0
- package/dist/cdn/5R6QUF5B.js +2 -0
- package/dist/cdn/5RVELJU4.js +36 -0
- package/dist/cdn/5WLNL4HZ.js +2 -0
- package/dist/cdn/66SKMECC.js +2 -0
- package/dist/cdn/6CLF7KIK.js +2 -0
- package/dist/cdn/{S6ZAQRC6.js → 6KFMRBAA.js} +1 -1
- package/dist/cdn/77QFSIWW.js +5 -0
- package/dist/cdn/7E2QMWK6.js +2 -0
- package/dist/cdn/{HO2YDJI2.js → 7M6VKBTK.js} +1 -1
- package/dist/cdn/{HJG7QM2R.js → 7VAQUCBU.js} +1 -1
- package/dist/cdn/ACJTJLZN.js +2 -0
- package/dist/cdn/AI6DYOKR.js +181 -0
- package/dist/cdn/AT4XVTJR.js +44 -0
- package/dist/cdn/BS2PFNU4.js +2 -0
- package/dist/cdn/CCC6LBMY.js +2 -0
- package/dist/cdn/CGXQAB3A.js +2 -0
- package/dist/cdn/{M3MRIGDZ.js → CP5BVGJU.js} +1 -1
- package/dist/cdn/CWD37QFT.js +2 -0
- package/dist/cdn/DY36ATOA.js +2 -0
- package/dist/cdn/DYASSC7Z.js +2 -0
- package/dist/cdn/EAEQONP7.js +2 -0
- package/dist/cdn/EMLOVMD4.js +2 -0
- package/dist/cdn/EWLXNGKH.js +208 -0
- package/dist/cdn/FAR3DFFK.js +2 -0
- package/dist/cdn/FDOMMK2M.js +2 -0
- package/dist/cdn/GRHIFCQX.js +2 -0
- package/dist/cdn/{S3XUYAUX.js → HHFNQR6Z.js} +1 -1
- package/dist/cdn/{WQKNV6KK.js → HMUWQCXU.js} +1 -1
- package/dist/cdn/HZ5ARNAM.js +2 -0
- package/dist/cdn/I6PD2HSL.js +2 -0
- package/dist/cdn/IDUC4CPV.js +2 -0
- package/dist/cdn/IRNSIUBT.js +2 -0
- package/dist/cdn/{OYNIFMCJ.js → J6SZIQJA.js} +1 -1
- package/dist/cdn/K335IAIE.js +2 -0
- package/dist/cdn/K33MZ726.js +2 -0
- package/dist/cdn/KA3FF3ZO.js +2 -0
- package/dist/cdn/{DBHLKLKM.js → KPO4XX6J.js} +1 -1
- package/dist/cdn/{I4L45WQS.js → L7XTRDFM.js} +1 -1
- package/dist/cdn/LCFIADOZ.js +2 -0
- package/dist/cdn/MDM2K3U7.js +2 -0
- package/dist/cdn/MM33KJPF.js +2 -0
- package/dist/cdn/NIY32GK2.js +2 -0
- package/dist/cdn/{3ZPPYCNL.js → ONMNQBPO.js} +1 -1
- package/dist/cdn/ONQ6JSBJ.js +2 -0
- package/dist/cdn/{6QJFOL6M.js → OWTGH34K.js} +1 -1
- package/dist/cdn/{XPTCV6YV.js → PSYRZMX2.js} +1 -1
- package/dist/cdn/Q4IQUEZN.js +14 -0
- package/dist/cdn/QNNGPA3Q.js +2 -0
- package/dist/cdn/QRHZXLZN.js +2 -0
- package/dist/cdn/QVOMX3R6.js +2 -0
- package/dist/cdn/QZ3NQTNQ.js +2 -0
- package/dist/cdn/RADWN4ZP.js +2 -0
- package/dist/cdn/RU2T7GUX.js +2 -0
- package/dist/cdn/S6OYR4VI.js +156 -0
- package/dist/cdn/T2GJLEYV.js +2 -0
- package/dist/cdn/TKYI5QRL.js +2 -0
- package/dist/cdn/{5SFZS2RD.js → TQXLSW4A.js} +2 -2
- package/dist/cdn/{NJJYZP3R.js → U6FBRUM4.js} +1 -1
- package/dist/cdn/UIXX3XEN.js +2 -0
- package/dist/cdn/UPWAOZXQ.js +2 -0
- package/dist/cdn/{5SF6DEMO.js → VNJMTA6O.js} +1 -1
- package/dist/cdn/VOKXKU7M.js +56 -0
- package/dist/cdn/{33BF35AO.js → VYTYVWR6.js} +4 -4
- package/dist/cdn/WMZ24LWS.js +2 -0
- package/dist/cdn/{JYVBCHR6.js → WP7ORLSB.js} +1 -1
- package/dist/cdn/WS3T73IY.js +2 -0
- package/dist/cdn/{UZL6UVE4.js → ZLWWWTH4.js} +1 -1
- package/dist/cdn/{PAUIFUMO.js → ZQMBJ6MI.js} +1 -1
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
- package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
- package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +938 -1938
- package/dist/chunks/adapter10.js +21 -0
- package/dist/chunks/adapter11.js +30 -0
- package/dist/chunks/adapter12.js +22 -0
- package/dist/chunks/adapter13.js +22 -0
- package/dist/chunks/adapter14.js +109 -0
- package/dist/chunks/adapter15.js +40 -0
- package/dist/chunks/adapter16.js +154 -0
- package/dist/chunks/adapter17.js +141 -0
- package/dist/chunks/adapter18.js +127 -0
- package/dist/chunks/adapter2.js +52 -0
- package/dist/chunks/adapter3.js +30 -0
- package/dist/chunks/adapter4.js +50 -0
- package/dist/chunks/adapter5.js +27 -0
- package/dist/chunks/adapter6.js +24 -0
- package/dist/chunks/adapter7.js +26 -0
- package/dist/chunks/adapter8.js +21 -0
- package/dist/chunks/adapter9.js +42 -0
- package/dist/chunks/arcgisKnowledgeGraph.js +5 -5
- package/dist/chunks/dataExplorationGraph.js +30 -27
- package/dist/chunks/fetchAgentContext.js +13 -0
- package/dist/chunks/fetchService.js +10 -0
- package/dist/chunks/formatFeatureAttributes.js +132 -0
- package/dist/chunks/generateLayerDescriptions.js +145 -148
- package/dist/chunks/helpGraph.js +11 -9
- package/dist/chunks/layerStylingGraph.js +22 -21
- package/dist/chunks/mergeWhereClauses.js +15 -0
- package/dist/chunks/navigationGraph.js +68 -57
- package/dist/chunks/types.js +59 -0
- package/dist/components/arcgis-assistant-agent/customElement.js +404 -279
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +15 -5
- package/dist/components/arcgis-assistant-help-agent/customElement.js +21 -5
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +39 -22
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +22 -5
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +13 -5
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/types/stencil.d.ts +2 -2
- package/dist/utils/index.d.ts +4 -5
- package/dist/utils/index.js +19 -20
- package/package.json +8 -8
- package/dist/cdn/55M2HE4U.js +0 -2
- package/dist/cdn/5RZGG4F2.js +0 -2
- package/dist/cdn/BAB3MK4Y.js +0 -2
- package/dist/cdn/BMBV6Y2A.js +0 -2
- package/dist/cdn/D3RKQSWS.js +0 -2
- package/dist/cdn/E7KEOJZG.js +0 -208
- package/dist/cdn/IGQFAL3H.js +0 -2
- package/dist/cdn/LUY6V4TP.js +0 -181
- package/dist/cdn/NSXX2KYS.js +0 -2
- package/dist/cdn/OFRFP4BX.js +0 -2
- package/dist/cdn/OUFGJV3R.js +0 -2
- package/dist/cdn/RWM5T4XB.js +0 -180
- package/dist/cdn/SRFLL6ET.js +0 -2
- package/dist/cdn/WDOM6Z5O.js +0 -18
- package/dist/cdn/WZFC5HUX.js +0 -56
- package/dist/cdn/Z4XUJQ2I.js +0 -36
- package/dist/cdn/ZJEWP2ND.js +0 -44
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { formatDateOnly as F, convertDateFormatToIntlOptions as m, formatTimeOnly as T, formatDate as p } from "@arcgis/core/intl.js";
|
|
3
|
+
const w = /* @__PURE__ */ new Set([
|
|
4
|
+
"date",
|
|
5
|
+
"esrifieldtypedate",
|
|
6
|
+
"date-only",
|
|
7
|
+
"dateonly",
|
|
8
|
+
"esrifieldtypedateonly",
|
|
9
|
+
"time-only",
|
|
10
|
+
"timeonly",
|
|
11
|
+
"esrifieldtypetimeonly",
|
|
12
|
+
"timestamp-offset",
|
|
13
|
+
"timestampoffset",
|
|
14
|
+
"esrifieldtypetimestampoffset"
|
|
15
|
+
]), g = (t) => {
|
|
16
|
+
if (!t)
|
|
17
|
+
return !1;
|
|
18
|
+
const e = t.toLowerCase();
|
|
19
|
+
return w.has(e);
|
|
20
|
+
}, d = (t) => {
|
|
21
|
+
if (t instanceof Date)
|
|
22
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
23
|
+
if (typeof t == "number" && Number.isFinite(t)) {
|
|
24
|
+
const e = new Date(t);
|
|
25
|
+
return Number.isNaN(e.getTime()) ? null : e;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}, I = (t) => !t || t === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : t === "unknown" ? "UTC" : t, N = (t) => {
|
|
29
|
+
if (typeof t == "string" && t)
|
|
30
|
+
return t;
|
|
31
|
+
const e = d(t);
|
|
32
|
+
return e ? e.toISOString().slice(0, 10) : null;
|
|
33
|
+
}, k = () => {
|
|
34
|
+
const t = (/* @__PURE__ */ new Date()).getTimezoneOffset(), e = t <= 0 ? "+" : "-", n = Math.floor(Math.abs(t) / 60).toString().padStart(2, "0"), o = (Math.abs(t) % 60).toString().padStart(2, "0"), i = `${e}${n}:${o}`;
|
|
35
|
+
return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: i };
|
|
36
|
+
}, S = (t, e, n) => {
|
|
37
|
+
const o = e?.toLowerCase();
|
|
38
|
+
if (o && !g(o))
|
|
39
|
+
return t;
|
|
40
|
+
if (o === "date-only") {
|
|
41
|
+
const s = N(t);
|
|
42
|
+
return s ? F(s, m("short-date")) : t;
|
|
43
|
+
}
|
|
44
|
+
if (o === "time-only") {
|
|
45
|
+
if (typeof t == "string" && t)
|
|
46
|
+
return T(t, m("long-time"));
|
|
47
|
+
const s = d(t);
|
|
48
|
+
return s ? p(s, {
|
|
49
|
+
...m("long-time"),
|
|
50
|
+
timeZone: "UTC"
|
|
51
|
+
}) : t;
|
|
52
|
+
}
|
|
53
|
+
const i = d(t);
|
|
54
|
+
return i ? p(i, {
|
|
55
|
+
...m("short-date-short-time"),
|
|
56
|
+
timeZone: I(n)
|
|
57
|
+
}) : t;
|
|
58
|
+
}, l = (t, e, n) => {
|
|
59
|
+
if (t && typeof t != "function") {
|
|
60
|
+
const o = "getField" in n && n.getField?.(t), i = o && "getFieldDomain" in n && n.getFieldDomain ? n.getFieldDomain(o.name) : null;
|
|
61
|
+
if (i?.type === "coded-value") {
|
|
62
|
+
const s = i.codedValues.find((r) => r.code === e);
|
|
63
|
+
return s ? s.name : null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}, O = (t) => !t || t === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : t === "unknown" ? "UTC" : t, C = (t) => {
|
|
68
|
+
if (t instanceof Date)
|
|
69
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
70
|
+
if (typeof t == "number" && Number.isFinite(t)) {
|
|
71
|
+
const e = new Date(t);
|
|
72
|
+
return Number.isNaN(e.getTime()) ? null : e;
|
|
73
|
+
}
|
|
74
|
+
if (typeof t == "string" && t) {
|
|
75
|
+
const e = new Date(t);
|
|
76
|
+
return Number.isNaN(e.getTime()) ? null : e;
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}, V = (t, e) => {
|
|
80
|
+
if (typeof t != "number")
|
|
81
|
+
return t;
|
|
82
|
+
const n = {};
|
|
83
|
+
e.minimumFractionDigits !== void 0 && (n.minimumFractionDigits = e.minimumFractionDigits), e.maximumFractionDigits !== void 0 && (n.maximumFractionDigits = e.maximumFractionDigits), e.useGrouping === "always" ? n.useGrouping = !0 : e.useGrouping === "never" && (n.useGrouping = !1);
|
|
84
|
+
try {
|
|
85
|
+
return new Intl.NumberFormat(void 0, n).format(t);
|
|
86
|
+
} catch {
|
|
87
|
+
return t;
|
|
88
|
+
}
|
|
89
|
+
}, x = (t, e, n) => {
|
|
90
|
+
const o = C(t);
|
|
91
|
+
if (!o)
|
|
92
|
+
return t;
|
|
93
|
+
const i = {};
|
|
94
|
+
e.dateStyle ? i.dateStyle = e.dateStyle : (e.year && (i.year = e.year), e.month && (i.month = e.month)), e.timeStyle && (i.timeStyle = e.timeStyle), e.timeStyle && e.hour12 === "always" ? i.hour12 = !0 : e.timeStyle && e.hour12 === "never" && (i.hour12 = !1), i.timeZone = O(n);
|
|
95
|
+
try {
|
|
96
|
+
return new Intl.DateTimeFormat(void 0, i).format(o);
|
|
97
|
+
} catch {
|
|
98
|
+
return t;
|
|
99
|
+
}
|
|
100
|
+
}, y = (t, e) => t.getFieldAlias?.(e) ?? t.fieldsIndex?.get(e)?.alias ?? t.fieldsIndex?.get(e)?.name ?? e, D = (t, e, n, o, i) => {
|
|
101
|
+
if (n == null)
|
|
102
|
+
return n;
|
|
103
|
+
const r = t.getFieldConfiguration?.(e)?.fieldFormat;
|
|
104
|
+
return r?.type === "number" ? V(n, r) : r?.type === "date-time" ? !o || g(o) ? x(n, r, i) : n : S(n, o, i);
|
|
105
|
+
}, L = (t, e, n, o) => {
|
|
106
|
+
const i = t.fieldsIndex?.get(e), s = l(e, n, t) ?? n;
|
|
107
|
+
return D(t, e, s, i?.type, o);
|
|
108
|
+
}, $ = (t, e) => y(t, e), j = (t, e, n) => {
|
|
109
|
+
const o = t.objectIdField, i = e.features.map(
|
|
110
|
+
(r) => r.attributes[o]
|
|
111
|
+
), s = e.features.map((r) => {
|
|
112
|
+
const u = r.attributes, c = {};
|
|
113
|
+
return t.fields.forEach((a) => {
|
|
114
|
+
if (!Object.hasOwn(u, a.name))
|
|
115
|
+
return;
|
|
116
|
+
const f = u[a.name];
|
|
117
|
+
if (a.name === o) {
|
|
118
|
+
c[a.name] = f;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const b = l(a.name, f, t) ?? f, h = y(t, a.name);
|
|
122
|
+
c[h] = D(t, a.name, b, a.type, n);
|
|
123
|
+
}), c;
|
|
124
|
+
});
|
|
125
|
+
return { objectIds: i, attributes: s };
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
j as a,
|
|
129
|
+
k as b,
|
|
130
|
+
L as f,
|
|
131
|
+
$ as g
|
|
132
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
2
|
import { Annotation as g } from "@langchain/langgraph/web";
|
|
3
3
|
import { d as z, r as T, m as V, c as K } from "./baseAgentState.js";
|
|
4
|
-
import
|
|
4
|
+
import m, { z as r } from "zod";
|
|
5
5
|
import { ChatPromptTemplate as q, SystemMessagePromptTemplate as B } from "@langchain/core/prompts";
|
|
6
6
|
import { s as h } from "./index.js";
|
|
7
7
|
import { AIMessage as H, isAIMessage as W, isToolMessage as X } from "@langchain/core/messages";
|
|
@@ -13,12 +13,12 @@ import ee from "@arcgis/core/identity/IdentityManager.js";
|
|
|
13
13
|
import { generateGuid as te } from "@arcgis/toolkit/string";
|
|
14
14
|
import ne from "@arcgis/core/config.js";
|
|
15
15
|
const P = {
|
|
16
|
-
advanced: "gpt-5.
|
|
17
|
-
default: "gpt-5-
|
|
18
|
-
fast: "gpt-5.
|
|
19
|
-
},
|
|
16
|
+
advanced: "gpt-5.6-sol",
|
|
17
|
+
default: "gpt-5.6-terra",
|
|
18
|
+
fast: "gpt-5.6-luna"
|
|
19
|
+
}, k = {
|
|
20
20
|
default: "text-embedding-ada-002"
|
|
21
|
-
},
|
|
21
|
+
}, S = /* @__PURE__ */ new Map();
|
|
22
22
|
let M = null;
|
|
23
23
|
const se = () => {
|
|
24
24
|
const t = F.getDefault().helperServices;
|
|
@@ -27,18 +27,18 @@ const se = () => {
|
|
|
27
27
|
return t.aiModels.url;
|
|
28
28
|
}, j = async (e) => {
|
|
29
29
|
const t = se();
|
|
30
|
-
|
|
30
|
+
S.size === 0 && (M || (M = (async () => {
|
|
31
31
|
try {
|
|
32
|
-
(await U(`${t}/models`)).data.models.forEach((
|
|
32
|
+
(await U(`${t}/models`)).data.models.forEach((s) => S.set(s.name, s));
|
|
33
33
|
} catch (n) {
|
|
34
34
|
throw M = null, n;
|
|
35
35
|
}
|
|
36
36
|
})()), await M);
|
|
37
|
-
const
|
|
38
|
-
if (!
|
|
37
|
+
const o = S.get(e);
|
|
38
|
+
if (!o)
|
|
39
39
|
throw new Error(`Model '${e}' is not available in the discovery service.`);
|
|
40
|
-
return
|
|
41
|
-
}, oe = async (e = "default") => await j(P[e]),
|
|
40
|
+
return o.endpoint;
|
|
41
|
+
}, oe = async (e = "default") => await j(P[e]), ie = async (e = "default") => await j(k[e]), Le = g.Root({
|
|
42
42
|
agentExecutionContext: g({
|
|
43
43
|
default: K,
|
|
44
44
|
reducer: V
|
|
@@ -67,34 +67,34 @@ const se = () => {
|
|
|
67
67
|
default: () => "",
|
|
68
68
|
reducer: z
|
|
69
69
|
})
|
|
70
|
-
}),
|
|
70
|
+
}), re = (e) => {
|
|
71
71
|
if (!e || typeof e != "object" || !("services" in e))
|
|
72
72
|
return !1;
|
|
73
73
|
const t = e.services;
|
|
74
74
|
return !!t && typeof t == "object" && "agentRegistry" in t;
|
|
75
75
|
}, ae = (e) => {
|
|
76
76
|
const t = e?.configurable;
|
|
77
|
-
return
|
|
78
|
-
}, ce = (e, t,
|
|
77
|
+
return re(t) ? t : void 0;
|
|
78
|
+
}, ce = (e, t, o) => {
|
|
79
79
|
const n = e[t];
|
|
80
|
-
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((
|
|
81
|
-
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
80
|
+
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, s) => {
|
|
81
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(s.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== o ? ". Note that variables only represent file names one level deep." : ""))));
|
|
82
82
|
});
|
|
83
|
-
},
|
|
84
|
-
const { agent: t, messages:
|
|
83
|
+
}, E = async (e) => (await ce(/* @__PURE__ */ Object.assign({ "./field_descriptions_prompt.md": () => import("./field_descriptions_prompt.js"), "./intent_prompt.md": () => import("./intent_prompt.js"), "./layer_descriptions_prompt.md": () => import("./layer_descriptions_prompt.js") }), `./${e}.md`, 2)).default, le = async (e) => {
|
|
84
|
+
const { agent: t, messages: o, config: n } = e;
|
|
85
85
|
return { structuredResponse: (await t.invoke(
|
|
86
86
|
{
|
|
87
|
-
messages:
|
|
87
|
+
messages: o
|
|
88
88
|
},
|
|
89
89
|
n
|
|
90
90
|
)).structuredResponse };
|
|
91
|
-
},
|
|
91
|
+
}, de = (e) => typeof e == "string" && e.length > 0 ? e : void 0, pe = () => te(), me = (e) => typeof e != "string" || e.trim().length === 0 ? "MapsSDK" : `MapsSDK - ${e.trim()}`, ue = (e) => {
|
|
92
92
|
const t = e?.configurable;
|
|
93
93
|
return {
|
|
94
|
-
conversationId:
|
|
94
|
+
conversationId: de(t?.thread_id),
|
|
95
95
|
abortSignal: e?.signal,
|
|
96
96
|
requestId: pe(),
|
|
97
|
-
requestSource:
|
|
97
|
+
requestSource: me(ne.applicationName)
|
|
98
98
|
};
|
|
99
99
|
}, ge = (e) => {
|
|
100
100
|
if (e == null || typeof e == "string" || e instanceof FormData || e instanceof HTMLFormElement)
|
|
@@ -104,60 +104,58 @@ const se = () => {
|
|
|
104
104
|
throw new TypeError(`Unsupported request body type: ${Object.prototype.toString.call(e)}`);
|
|
105
105
|
}, _ = async ({ config: e }) => {
|
|
106
106
|
const t = F.getDefault(), n = (await ee.getCredential(`${t.url}/sharing`))?.token;
|
|
107
|
-
return async (
|
|
108
|
-
const { conversationId: a, abortSignal: c, requestId: l, requestSource:
|
|
109
|
-
for (const v of [...
|
|
107
|
+
return async (i, s) => {
|
|
108
|
+
const { conversationId: a, abortSignal: c, requestId: l, requestSource: p } = ue(e), d = new Headers(s?.headers);
|
|
109
|
+
for (const v of [...d.keys()]) {
|
|
110
110
|
const u = v.toLowerCase();
|
|
111
|
-
(u === "authorization" || u === "api-key" || u.startsWith("x-stainless-")) &&
|
|
111
|
+
(u === "authorization" || u === "api-key" || u.startsWith("x-stainless-")) && d.delete(v);
|
|
112
112
|
}
|
|
113
|
-
n && n.length > 0 &&
|
|
114
|
-
const
|
|
115
|
-
return (await U(
|
|
116
|
-
body: ge(
|
|
117
|
-
headers: Object.fromEntries(
|
|
113
|
+
n && n.length > 0 && d.set("X-Esri-Authorization", `Bearer ${n}`), t.isPortal || (p && p.length > 0 && d.set("X-Esri-Request-Source", p), a && a.length > 0 && d.set("X-Esri-Conversation-Id", a), l.length > 0 && d.set("X-Esri-Request-Id", l));
|
|
114
|
+
const b = c && s?.signal ? AbortSignal.any([c, s.signal]) : s?.signal ?? c;
|
|
115
|
+
return (await U(i instanceof Request ? i.url : i.toString(), {
|
|
116
|
+
body: ge(s?.body),
|
|
117
|
+
headers: Object.fromEntries(d),
|
|
118
118
|
responseType: "native",
|
|
119
|
-
signal:
|
|
119
|
+
signal: b
|
|
120
120
|
})).data;
|
|
121
121
|
};
|
|
122
|
-
},
|
|
123
|
-
const { modelTier: t = "default",
|
|
122
|
+
}, w = async (e = {}) => {
|
|
123
|
+
const { modelTier: t = "default", config: o } = e, n = P[t], i = await oe(t);
|
|
124
124
|
return new Y({
|
|
125
|
-
modelName:
|
|
125
|
+
modelName: n,
|
|
126
126
|
apiKey: "dummy-key",
|
|
127
|
-
// 5-mini does not support temperature parameter
|
|
128
|
-
...t !== "default" && { temperature: r },
|
|
129
127
|
configuration: {
|
|
130
|
-
baseURL:
|
|
131
|
-
fetch: await _({ config:
|
|
128
|
+
baseURL: i,
|
|
129
|
+
fetch: await _({ config: o })
|
|
132
130
|
}
|
|
133
131
|
});
|
|
134
132
|
}, ze = async (e = {}) => {
|
|
135
|
-
const { tier: t = "default", config:
|
|
133
|
+
const { tier: t = "default", config: o } = e, n = k[t], i = await ie(t);
|
|
136
134
|
return new Z({
|
|
137
135
|
modelName: n,
|
|
138
136
|
apiKey: "dummy-key",
|
|
139
137
|
configuration: {
|
|
140
|
-
baseURL:
|
|
141
|
-
fetch: await _({ config:
|
|
138
|
+
baseURL: i,
|
|
139
|
+
fetch: await _({ config: o })
|
|
142
140
|
},
|
|
143
141
|
batchSize: 2048,
|
|
144
142
|
maxConcurrency: 10
|
|
145
143
|
});
|
|
146
|
-
}, fe =
|
|
147
|
-
id:
|
|
148
|
-
name:
|
|
149
|
-
description:
|
|
144
|
+
}, fe = r.object({
|
|
145
|
+
id: r.string().min(1),
|
|
146
|
+
name: r.string().min(1),
|
|
147
|
+
description: r.string().min(1)
|
|
150
148
|
});
|
|
151
|
-
|
|
149
|
+
r.array(fe);
|
|
152
150
|
const A = (e) => JSON.stringify(e, null, 2), he = (e) => {
|
|
153
|
-
const t = e.map((n) => n.id),
|
|
154
|
-
return
|
|
155
|
-
intent:
|
|
156
|
-
assignedTask:
|
|
157
|
-
requiresFollowUp:
|
|
151
|
+
const t = e.map((n) => n.id), o = r.enum(t);
|
|
152
|
+
return r.object({
|
|
153
|
+
intent: o.nullable(),
|
|
154
|
+
assignedTask: r.string().nullable(),
|
|
155
|
+
requiresFollowUp: r.boolean()
|
|
158
156
|
});
|
|
159
157
|
}, Ve = async (e, t) => {
|
|
160
|
-
const
|
|
158
|
+
const o = ae(t);
|
|
161
159
|
if (t?.signal?.aborted)
|
|
162
160
|
return await h({ text: "Run cancelled; skipping intent routing" }, t), {
|
|
163
161
|
...e,
|
|
@@ -167,35 +165,35 @@ const A = (e) => JSON.stringify(e, null, 2), he = (e) => {
|
|
|
167
165
|
};
|
|
168
166
|
try {
|
|
169
167
|
await h({ text: "Asking LLM to route to an agent" }, t);
|
|
170
|
-
const
|
|
168
|
+
const i = o.services.agentRegistry?.list() ?? [], s = i.map(({ agent: f }) => ({
|
|
171
169
|
id: f.id,
|
|
172
170
|
name: f.name,
|
|
173
171
|
description: f.description
|
|
174
172
|
}));
|
|
175
|
-
if (!
|
|
173
|
+
if (!s.length)
|
|
176
174
|
return await h({ text: "No agents registered; skipping intent detection" }, t), {
|
|
177
175
|
...e,
|
|
178
176
|
currentIntent: "none",
|
|
179
177
|
finalOutputMessage: "No agents registered; skipping intent detection."
|
|
180
178
|
};
|
|
181
|
-
const a = await
|
|
179
|
+
const a = await E("intent_prompt"), c = A(s), l = he(s), p = {
|
|
182
180
|
registeredAgents: c,
|
|
183
181
|
priorSteps: A(e.agentExecutionContext.priorSteps),
|
|
184
182
|
userRequest: e.agentExecutionContext.userRequest
|
|
185
|
-
},
|
|
186
|
-
model: await
|
|
183
|
+
}, b = await q.fromTemplate(a).format(p), C = G({
|
|
184
|
+
model: await w({
|
|
187
185
|
modelTier: "fast",
|
|
188
186
|
config: t
|
|
189
187
|
}),
|
|
190
188
|
tools: [],
|
|
191
|
-
systemPrompt:
|
|
189
|
+
systemPrompt: b,
|
|
192
190
|
responseFormat: l,
|
|
193
191
|
middleware: [
|
|
194
192
|
// Preserve recent conversation context while summarizing older messages
|
|
195
193
|
// to control token usage without losing important intent signals.
|
|
196
194
|
// The trigger and keep parameters can be tuned based on token limits and behavior.
|
|
197
195
|
J({
|
|
198
|
-
model: await
|
|
196
|
+
model: await w({
|
|
199
197
|
modelTier: "fast",
|
|
200
198
|
config: t
|
|
201
199
|
}),
|
|
@@ -207,7 +205,7 @@ const A = (e) => JSON.stringify(e, null, 2), he = (e) => {
|
|
|
207
205
|
Q({ runLimit: 2 })
|
|
208
206
|
]
|
|
209
207
|
}), { structuredResponse: v } = await le({
|
|
210
|
-
agent:
|
|
208
|
+
agent: C,
|
|
211
209
|
messages: e.agentExecutionContext.messages,
|
|
212
210
|
config: t
|
|
213
211
|
}), u = l.parse(
|
|
@@ -222,7 +220,7 @@ const A = (e) => JSON.stringify(e, null, 2), he = (e) => {
|
|
|
222
220
|
}
|
|
223
221
|
};
|
|
224
222
|
if (x === "none") {
|
|
225
|
-
const f = `I could not find an agent that can handle that request. I have access to the following agents: ${
|
|
223
|
+
const f = `I could not find an agent that can handle that request. I have access to the following agents: ${i.map(({ agent: L }) => L.name).join(", ")}.
|
|
226
224
|
|
|
227
225
|
Please ask a question that can be answered by one of these agents.`;
|
|
228
226
|
return await h({ text: "LLM did not identify a clear intent." }, t), {
|
|
@@ -257,38 +255,38 @@ Requires Follow-Up: ${u.requiresFollowUp}`
|
|
|
257
255
|
} catch (n) {
|
|
258
256
|
throw await h({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
|
|
259
257
|
}
|
|
260
|
-
}, ye = "0.1",
|
|
258
|
+
}, ye = "0.1", y = 1536, we = "openai", be = k.default, ve = `Name: {name}
|
|
261
259
|
Title: {title}
|
|
262
260
|
Description: {description}`, xe = `Name: {name}
|
|
263
261
|
Alias: {alias}
|
|
264
|
-
Description: {description}`, Ke =
|
|
265
|
-
schemaVersion:
|
|
266
|
-
modified:
|
|
267
|
-
embeddings:
|
|
268
|
-
modelProvider:
|
|
269
|
-
model:
|
|
270
|
-
dimensions:
|
|
271
|
-
templates:
|
|
272
|
-
layer:
|
|
273
|
-
field:
|
|
262
|
+
Description: {description}`, Ke = r.object({
|
|
263
|
+
schemaVersion: r.literal(ye),
|
|
264
|
+
modified: r.number().int().nonnegative(),
|
|
265
|
+
embeddings: r.object({
|
|
266
|
+
modelProvider: r.literal(we),
|
|
267
|
+
model: r.literal(be),
|
|
268
|
+
dimensions: r.literal(y),
|
|
269
|
+
templates: r.object({
|
|
270
|
+
layer: r.string().default(ve),
|
|
271
|
+
field: r.string().default(xe)
|
|
274
272
|
})
|
|
275
273
|
}),
|
|
276
|
-
layers:
|
|
277
|
-
|
|
278
|
-
id:
|
|
279
|
-
name:
|
|
280
|
-
title:
|
|
281
|
-
description:
|
|
282
|
-
vector:
|
|
283
|
-
message: `Layer vector must be exactly ${
|
|
274
|
+
layers: r.array(
|
|
275
|
+
r.object({
|
|
276
|
+
id: r.string().min(1),
|
|
277
|
+
name: r.string().min(1),
|
|
278
|
+
title: r.string().catch(""),
|
|
279
|
+
description: r.string().catch(""),
|
|
280
|
+
vector: r.array(r.number()).length(y, {
|
|
281
|
+
message: `Layer vector must be exactly ${y} dimensions`
|
|
284
282
|
}),
|
|
285
|
-
fields:
|
|
286
|
-
|
|
287
|
-
name:
|
|
288
|
-
alias:
|
|
289
|
-
description:
|
|
290
|
-
vector:
|
|
291
|
-
message: `Field vector must be exactly ${
|
|
283
|
+
fields: r.array(
|
|
284
|
+
r.object({
|
|
285
|
+
name: r.string().min(1),
|
|
286
|
+
alias: r.string().catch(""),
|
|
287
|
+
description: r.string().catch(""),
|
|
288
|
+
vector: r.array(r.number()).length(y, {
|
|
289
|
+
message: `Field vector must be exactly ${y} dimensions`
|
|
292
290
|
})
|
|
293
291
|
})
|
|
294
292
|
)
|
|
@@ -298,95 +296,94 @@ Description: {description}`, Ke = i.object({
|
|
|
298
296
|
const t = /* @__PURE__ */ new Set();
|
|
299
297
|
for (const n of e)
|
|
300
298
|
if (W(n)) {
|
|
301
|
-
const
|
|
302
|
-
|
|
303
|
-
|
|
299
|
+
const i = n;
|
|
300
|
+
i.tool_calls && i.tool_calls.length > 0 && i.tool_calls.forEach((s) => {
|
|
301
|
+
s.id && t.add(s.id);
|
|
304
302
|
});
|
|
305
303
|
}
|
|
306
304
|
return e.filter((n) => {
|
|
307
305
|
if (X(n)) {
|
|
308
|
-
const
|
|
309
|
-
return t.has(
|
|
306
|
+
const i = n;
|
|
307
|
+
return t.has(i.tool_call_id);
|
|
310
308
|
}
|
|
311
309
|
return !0;
|
|
312
310
|
});
|
|
313
|
-
},
|
|
314
|
-
const
|
|
315
|
-
return q.fromMessages([
|
|
311
|
+
}, R = (e, t) => {
|
|
312
|
+
const o = B.fromTemplate(e);
|
|
313
|
+
return q.fromMessages([o, ...t]);
|
|
316
314
|
}, Me = async (e) => {
|
|
317
|
-
const { promptText: t, modelTier:
|
|
318
|
-
return
|
|
315
|
+
const { promptText: t, modelTier: o, messages: n, config: i } = e, s = R(t, n ?? []), a = await w({ modelTier: o, config: i });
|
|
316
|
+
return s.pipe(a);
|
|
319
317
|
}, Be = async (e) => {
|
|
320
|
-
const { promptText: t, modelTier:
|
|
318
|
+
const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, config: s } = e, c = await (await Me({
|
|
321
319
|
promptText: t,
|
|
322
|
-
modelTier:
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
return typeof m == "string" ? m : JSON.stringify(m);
|
|
320
|
+
modelTier: o,
|
|
321
|
+
messages: n,
|
|
322
|
+
config: s
|
|
323
|
+
})).invoke(i ?? {}, s);
|
|
324
|
+
if (typeof c == "string")
|
|
325
|
+
return c;
|
|
326
|
+
const l = c.content;
|
|
327
|
+
return typeof l == "string" ? l : JSON.stringify(l);
|
|
331
328
|
}, O = async (e) => {
|
|
332
|
-
const { promptText: t, modelTier:
|
|
333
|
-
return await
|
|
329
|
+
const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, schema: s, config: a } = e, c = R(t, n ?? []), p = (await w({ modelTier: o, config: a })).withStructuredOutput(s);
|
|
330
|
+
return await c.pipe(p).invoke(i ?? {}, a);
|
|
334
331
|
}, He = async (e) => {
|
|
335
|
-
const { promptText: t, modelTier:
|
|
336
|
-
return await
|
|
337
|
-
}, Se =
|
|
338
|
-
name:
|
|
339
|
-
description:
|
|
340
|
-
valueType:
|
|
341
|
-
alias:
|
|
342
|
-
}), Ie =
|
|
343
|
-
fields:
|
|
344
|
-
}), $ = (e, t) => e.getFieldAlias(t) ?? void 0,
|
|
345
|
-
const
|
|
346
|
-
return !!(
|
|
332
|
+
const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, tools: s, config: a } = e, c = s.length > 0 ? Te(n ?? []) : n ?? [], l = R(t, c), p = await w({ modelTier: o, config: a });
|
|
333
|
+
return await l.pipe(p.bindTools(s)).invoke(i ?? {}, a);
|
|
334
|
+
}, Se = m.object({
|
|
335
|
+
name: m.string(),
|
|
336
|
+
description: m.string(),
|
|
337
|
+
valueType: m.string(),
|
|
338
|
+
alias: m.string()
|
|
339
|
+
}), Ie = m.object({
|
|
340
|
+
fields: m.array(Se)
|
|
341
|
+
}), $ = (e, t) => e.getFieldAlias(t) ?? void 0, I = (e, t) => $(e, t.name) ?? t.alias ?? "", ke = (e, t) => {
|
|
342
|
+
const o = $(e, t.name);
|
|
343
|
+
return !!(o && o !== (t.alias ?? ""));
|
|
347
344
|
};
|
|
348
345
|
function D(e, t) {
|
|
349
|
-
const
|
|
346
|
+
const o = /* @__PURE__ */ new Map();
|
|
350
347
|
for (const n of e.fields) {
|
|
351
|
-
const
|
|
348
|
+
const i = t.fields.find((l) => l.name === n.name), s = I(e, n), a = ke(e, n), c = {
|
|
352
349
|
name: n.name,
|
|
353
350
|
type: n.type,
|
|
354
|
-
alias: a ?
|
|
355
|
-
description:
|
|
356
|
-
valueType:
|
|
351
|
+
alias: a ? s : i?.alias ?? s,
|
|
352
|
+
description: i?.description ?? n.description ?? "",
|
|
353
|
+
valueType: i?.valueType ?? n.valueType ?? "",
|
|
357
354
|
domain: e.getFieldDomain(n.name) ?? void 0
|
|
358
355
|
};
|
|
359
|
-
|
|
356
|
+
o.set(n.name, c);
|
|
360
357
|
}
|
|
361
|
-
return
|
|
358
|
+
return o;
|
|
362
359
|
}
|
|
363
360
|
const We = async (e) => {
|
|
364
|
-
const
|
|
365
|
-
const { name: c, type: l, description:
|
|
366
|
-
return [`Name: ${c}`, `Type: ${l}`, `Alias: ${
|
|
361
|
+
const o = await E("field_descriptions_prompt"), n = e.fields.filter((a) => !(I(e, a) && a.description)).map((a) => {
|
|
362
|
+
const { name: c, type: l, description: p } = a, d = I(e, a);
|
|
363
|
+
return [`Name: ${c}`, `Type: ${l}`, `Alias: ${d}`, `Description: ${p ?? "N/A"}`].join(", ");
|
|
367
364
|
}).join(`
|
|
368
365
|
`);
|
|
369
366
|
if (n.length === 0)
|
|
370
367
|
return D(e, { fields: [] });
|
|
371
|
-
const
|
|
368
|
+
const i = {
|
|
372
369
|
existingItemTitle: e.portalItem?.title,
|
|
373
370
|
existingItemDescription: e.portalItem?.description,
|
|
374
371
|
existingLayerTitle: e.title,
|
|
375
372
|
existingLayerDescription: e.portalItem?.description,
|
|
376
373
|
fieldInformation: n
|
|
377
|
-
},
|
|
378
|
-
promptText:
|
|
374
|
+
}, s = await O({
|
|
375
|
+
promptText: o,
|
|
379
376
|
schema: Ie,
|
|
380
|
-
inputVariables:
|
|
377
|
+
inputVariables: i
|
|
381
378
|
});
|
|
382
|
-
return D(e,
|
|
383
|
-
}, Ee =
|
|
384
|
-
title:
|
|
385
|
-
description:
|
|
386
|
-
name:
|
|
379
|
+
return D(e, s);
|
|
380
|
+
}, Ee = m.object({
|
|
381
|
+
title: m.string(),
|
|
382
|
+
description: m.string(),
|
|
383
|
+
name: m.string().nullable()
|
|
387
384
|
}), Xe = async (e, t) => {
|
|
388
|
-
const n = await
|
|
389
|
-
fieldInformation: JSON.stringify(
|
|
385
|
+
const n = await E("layer_descriptions_prompt"), i = Array.from(t.values()), s = {
|
|
386
|
+
fieldInformation: JSON.stringify(i, null, 2),
|
|
390
387
|
existingLayerTitle: e.title,
|
|
391
388
|
existingLayerDescription: e.portalItem?.description,
|
|
392
389
|
existingLayerSnippet: e.portalItem?.snippet,
|
|
@@ -395,7 +392,7 @@ const We = async (e) => {
|
|
|
395
392
|
return { ...await O({
|
|
396
393
|
promptText: n,
|
|
397
394
|
schema: Ee,
|
|
398
|
-
inputVariables:
|
|
395
|
+
inputVariables: s
|
|
399
396
|
}), name: e.title ?? null };
|
|
400
397
|
};
|
|
401
398
|
export {
|
|
@@ -403,14 +400,14 @@ export {
|
|
|
403
400
|
Ke as W,
|
|
404
401
|
Xe as a,
|
|
405
402
|
we as b,
|
|
406
|
-
|
|
407
|
-
|
|
403
|
+
w as c,
|
|
404
|
+
y as d,
|
|
408
405
|
Be as e,
|
|
409
406
|
xe as f,
|
|
410
407
|
We as g,
|
|
411
408
|
He as h,
|
|
412
409
|
O as i,
|
|
413
|
-
|
|
410
|
+
ie as j,
|
|
414
411
|
ae as k,
|
|
415
412
|
ve as l,
|
|
416
413
|
be as m,
|