@arcgis/ai-components 5.2.0-next.104 → 5.2.0-next.106
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.js +41 -40
- package/dist/agent-utils/middlewares/trace.js +5 -5
- package/dist/agents/runtime/skill/createSkillAgent.d.ts +31 -0
- package/dist/agents/runtime/skill/createSkillAgent.js +262 -0
- package/dist/agents/runtime/skill/loadAgentSkills.d.ts +16 -0
- package/dist/agents/runtime/skill/types.d.ts +28 -0
- package/dist/agents/runtime/skill/types.js +2 -0
- package/dist/agents/tools/filter/setFeatureEffect/adapter.js +20 -19
- package/dist/agents/tools/query/getStatistics/adapter.js +4 -3
- package/dist/agents/tools/query/getTopFeatures/adapter.js +4 -3
- package/dist/agents/tools/query/queryFeatures/adapter.js +4 -3
- package/dist/agents/tools/shared/resolveToolArtifact.d.ts +22 -0
- package/dist/agents/tools/shared/resolveToolArtifact.js +20 -0
- package/dist/agents/tools/shared/types.d.ts +22 -0
- package/dist/agents/tools/shared/types.js +6 -0
- package/dist/cdn/23C34FEU.js +2 -0
- package/dist/cdn/{NZSOJ726.js → 2AMUOR7X.js} +1 -1
- package/dist/cdn/2OHRNRNT.js +2 -0
- package/dist/cdn/2OUIRKTV.js +2 -0
- package/dist/cdn/2S6L3P4Q.js +2 -0
- package/dist/cdn/{C4FEETBZ.js → 2W7LK4HA.js} +1 -1
- package/dist/cdn/3IOP64NG.js +2 -0
- package/dist/cdn/3OH35VXS.js +2 -0
- package/dist/cdn/{5K5ZY267.js → 3SD47V7G.js} +1 -1
- package/dist/cdn/{7VAQUCBU.js → 3VCPN2KW.js} +1 -1
- package/dist/cdn/{LLUGJKAQ.js → 3XDT7MWI.js} +1 -1
- package/dist/cdn/{Y7XD7ZRD.js → 4ALF2CJY.js} +1 -1
- package/dist/cdn/{HAEFC2SJ.js → 5LMYUEK7.js} +1 -1
- package/dist/cdn/{655YIKL3.js → 6GODC6RU.js} +2 -2
- package/dist/cdn/{7VUSIGEM.js → 6RAWG2KQ.js} +1 -1
- package/dist/cdn/{GCVB5VG4.js → 6YZGKVYB.js} +1 -1
- package/dist/cdn/{VLLZ2FFU.js → 725MBCQF.js} +1 -1
- package/dist/cdn/74CVYM72.js +19 -0
- package/dist/cdn/{CP5BVGJU.js → 7EOS4SGJ.js} +1 -1
- package/dist/cdn/{5WYRJMBW.js → 7QIX4PZR.js} +1 -1
- package/dist/cdn/7UF3WRLO.js +72 -0
- package/dist/cdn/A7BKHIMA.js +2 -0
- package/dist/cdn/AFSBL4ZP.js +2 -0
- package/dist/cdn/{FG647IP6.js → AGQ5ADFU.js} +1 -1
- package/dist/cdn/{5ZFUGNRN.js → BQYF37UD.js} +1 -1
- package/dist/cdn/{4RDNI22D.js → BTTBKTFM.js} +4 -4
- package/dist/cdn/BVSK2GWP.js +2 -0
- package/dist/cdn/CFAC4FN3.js +2 -0
- package/dist/cdn/{HDACNIZF.js → D5EKX26R.js} +1 -1
- package/dist/cdn/EGN5BCHV.js +2 -0
- package/dist/cdn/{BXQ4I5HB.js → EJJFG5DE.js} +2 -2
- package/dist/cdn/{ZDV4K4WG.js → EOD5PNOL.js} +1 -1
- package/dist/cdn/{OE3GW5LE.js → ES6D4UD6.js} +1 -1
- package/dist/cdn/{K2R6XVK3.js → HB72YIII.js} +1 -1
- package/dist/cdn/{G2EGT3CF.js → HHBNLCJP.js} +1 -1
- package/dist/cdn/HLN5675C.js +2 -0
- package/dist/cdn/IFFOSSNB.js +2 -0
- package/dist/cdn/IO7DYFL2.js +2 -0
- package/dist/cdn/{IBZ2NEAO.js → IRSJXHRN.js} +1 -1
- package/dist/cdn/JD2TB7H4.js +2 -0
- package/dist/cdn/{ANRQWYU2.js → JKKU4K4C.js} +1 -1
- package/dist/cdn/{FUF3NAU7.js → JMNHFKGL.js} +1 -1
- package/dist/cdn/{22KHSDJI.js → JWZD3D5E.js} +1 -1
- package/dist/cdn/{HKOGIZDQ.js → KJLLN4P4.js} +18 -18
- package/dist/cdn/KZ73TZOB.js +2 -0
- package/dist/cdn/LEO3USHH.js +2 -0
- package/dist/cdn/LNIMGXB4.js +2 -0
- package/dist/cdn/MG2W2ZF3.js +2 -0
- package/dist/cdn/{NYJYRCGA.js → MSXMHRI7.js} +1 -1
- package/dist/cdn/MXAZE2VM.js +179 -0
- package/dist/cdn/{EWLXNGKH.js → OL7QBAGS.js} +15 -15
- package/dist/cdn/OMF6ITSG.js +2 -0
- package/dist/cdn/{Z5W4V7RC.js → OOGADOKQ.js} +1 -1
- package/dist/cdn/{KITIP6J2.js → OZ2CM3J2.js} +1 -1
- package/dist/cdn/{6YYPVU7H.js → P4GFYBBO.js} +1 -1
- package/dist/cdn/PK5KI2XF.js +2 -0
- package/dist/cdn/PWFUEBTT.js +2 -0
- package/dist/cdn/{HHUQXL3R.js → PYGX4HN7.js} +1 -1
- package/dist/cdn/RFVZ7KCG.js +66 -0
- package/dist/cdn/{YEZ3AMNX.js → RLB6TK6B.js} +1 -1
- package/dist/cdn/{WKTQVBFJ.js → RN6WMVZX.js} +1 -1
- package/dist/cdn/{WJXXOKGA.js → ROQGPAR5.js} +1 -1
- package/dist/cdn/RSJSRETN.js +2 -0
- package/dist/cdn/RSR66KB4.js +2 -0
- package/dist/cdn/{7SRLZQVC.js → RZIXMISL.js} +1 -1
- package/dist/cdn/{VOKXKU7M.js → S4LELUBK.js} +9 -9
- package/dist/cdn/{AI6DYOKR.js → S627D4K7.js} +1 -1
- package/dist/cdn/SL4Y7IRG.js +2 -0
- package/dist/cdn/STUBN3L5.js +2 -0
- package/dist/cdn/T2OYKP3V.js +2 -0
- package/dist/cdn/{C4JT4S5E.js → TBYDZN4H.js} +1 -1
- package/dist/cdn/{HHFNQR6Z.js → TEI6WXW7.js} +1 -1
- package/dist/cdn/{WGO5SER7.js → TFRWUAB6.js} +1 -1
- package/dist/cdn/U3ETGDT7.js +2 -0
- package/dist/cdn/{KWD2ECTM.js → UAG6GDUG.js} +1 -1
- package/dist/cdn/UHICISBZ.js +2 -0
- package/dist/cdn/{NNXISHCA.js → VMZZR7MY.js} +2 -2
- package/dist/cdn/WW4BEFDF.js +2 -0
- package/dist/cdn/XGCQS3N4.js +2 -0
- package/dist/cdn/{R2PQVY4O.js → XKH37FLY.js} +1 -1
- package/dist/cdn/XQ3NBBQ3.js +2 -0
- package/dist/cdn/{7BCQMK6D.js → XTCLJEID.js} +1 -1
- package/dist/cdn/{J6SZIQJA.js → Y7LGFSHO.js} +1 -1
- package/dist/cdn/ZFOG3KXV.js +2 -0
- package/dist/cdn/ZZZB3GES.js +14 -0
- 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/SKILL.js +5 -0
- package/dist/chunks/SKILL2.js +5 -0
- package/dist/chunks/SKILL3.js +22 -0
- package/dist/chunks/SKILL4.js +5 -0
- package/dist/chunks/adapter.js +137 -140
- package/dist/chunks/aiFactory.js +94 -0
- package/dist/chunks/arcgisKnowledgeGraph.js +14 -13
- package/dist/chunks/baseAgentState.js +2 -2
- package/dist/chunks/dataExplorationAgent.js +30 -0
- package/dist/chunks/generateLayerDescriptions.js +181 -268
- package/dist/chunks/helpAgent.js +37 -0
- package/dist/chunks/layerStylingGraph.js +91 -76
- package/dist/chunks/navigationAgent.js +40 -0
- package/dist/chunks/orchestrator.js +13 -12
- package/dist/chunks/requireAgentServices.js +11 -0
- package/dist/chunks/resolvePointGeometryFilter.js +11 -11
- package/dist/components/arcgis-assistant/customElement.d.ts +23 -3
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +17 -6
- package/dist/components/arcgis-assistant-help-agent/customElement.js +3 -1
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +18 -7
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/orchestrator/models/types.d.ts +1 -0
- package/dist/orchestrator/providers/arcgis/aiFactory.d.ts +15 -0
- package/dist/orchestrator/registry/agentRegistry.d.ts +33 -0
- package/dist/orchestrator/types/types.d.ts +17 -0
- package/dist/utils/index.d.ts +13 -3
- package/dist/utils/index.js +706 -82
- package/package.json +10 -6
- package/dist/cdn/2EY3BQQX.js +0 -2
- package/dist/cdn/2NDBI2VA.js +0 -156
- package/dist/cdn/4OGR5QKS.js +0 -2
- package/dist/cdn/5FL5BTTX.js +0 -66
- package/dist/cdn/5X7EG7D2.js +0 -2
- package/dist/cdn/6FCU2KJP.js +0 -2
- package/dist/cdn/7BJ4JKLG.js +0 -2
- package/dist/cdn/7HS5KX3J.js +0 -2
- package/dist/cdn/7UUYJTKT.js +0 -2
- package/dist/cdn/7V6OSTFC.js +0 -2
- package/dist/cdn/7VYYQ7BT.js +0 -2
- package/dist/cdn/ACJTJLZN.js +0 -2
- package/dist/cdn/AKD5UOVX.js +0 -2
- package/dist/cdn/C7LGDNB3.js +0 -14
- package/dist/cdn/CGJINV7H.js +0 -2
- package/dist/cdn/CJMUJXPL.js +0 -2
- package/dist/cdn/D2SS763Z.js +0 -2
- package/dist/cdn/FJO4KNOZ.js +0 -2
- package/dist/cdn/G3SF6U2U.js +0 -2
- package/dist/cdn/G6CR7JVM.js +0 -22
- package/dist/cdn/GL7BPKBN.js +0 -2
- package/dist/cdn/JO5ETMPS.js +0 -2
- package/dist/cdn/PUHRBGKB.js +0 -2
- package/dist/cdn/Q57QWN5W.js +0 -2
- package/dist/cdn/QUKNPVAF.js +0 -2
- package/dist/cdn/RBE55SWR.js +0 -2
- package/dist/cdn/SWH6ZHD4.js +0 -18
- package/dist/cdn/SZ2QSSB3.js +0 -2
- package/dist/cdn/T4RIGOXB.js +0 -2
- package/dist/cdn/W4JQDITQ.js +0 -36
- package/dist/cdn/XX6GHMNR.js +0 -2
- package/dist/cdn/YLVJA4ZE.js +0 -2
- package/dist/cdn/ZOEMBHRF.js +0 -2
- package/dist/cdn/ZRVZMPFN.js +0 -2
- package/dist/chunks/dataExplorationGraph.js +0 -254
- package/dist/chunks/helpGraph.js +0 -133
- package/dist/chunks/navigationGraph.js +0 -290
- package/dist/chunks/toolCallResponse.js +0 -33
|
@@ -1,202 +1,115 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { Annotation as
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import { ChatPromptTemplate as
|
|
6
|
-
import { s as
|
|
7
|
-
import { AIMessage as
|
|
8
|
-
import { createAgent as
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
import ne from "@arcgis/core/config.js";
|
|
15
|
-
const P = {
|
|
16
|
-
advanced: "gpt-5.6-sol",
|
|
17
|
-
default: "gpt-5.6-terra",
|
|
18
|
-
fast: "gpt-5.6-luna"
|
|
19
|
-
}, k = {
|
|
20
|
-
default: "text-embedding-ada-002"
|
|
21
|
-
}, S = /* @__PURE__ */ new Map();
|
|
22
|
-
let M = null;
|
|
23
|
-
const se = () => {
|
|
24
|
-
const t = F.getDefault().helperServices;
|
|
25
|
-
if (!t?.aiModels?.url)
|
|
26
|
-
throw new Error("AI Models Service URL is not defined in the portal's helper services.");
|
|
27
|
-
return t.aiModels.url;
|
|
28
|
-
}, j = async (e) => {
|
|
29
|
-
const t = se();
|
|
30
|
-
S.size === 0 && (M || (M = (async () => {
|
|
31
|
-
try {
|
|
32
|
-
(await U(`${t}/models`)).data.models.forEach((s) => S.set(s.name, s));
|
|
33
|
-
} catch (n) {
|
|
34
|
-
throw M = null, n;
|
|
35
|
-
}
|
|
36
|
-
})()), await M);
|
|
37
|
-
const o = S.get(e);
|
|
38
|
-
if (!o)
|
|
39
|
-
throw new Error(`Model '${e}' is not available in the discovery service.`);
|
|
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
|
-
agentExecutionContext: g({
|
|
43
|
-
default: K,
|
|
44
|
-
reducer: V
|
|
2
|
+
import { Annotation as m } from "@langchain/langgraph/web";
|
|
3
|
+
import { b as j, r as T, m as P, c as q } from "./baseAgentState.js";
|
|
4
|
+
import p, { z as s } from "zod";
|
|
5
|
+
import { ChatPromptTemplate as E, SystemMessagePromptTemplate as N } from "@langchain/core/prompts";
|
|
6
|
+
import { s as g } from "./index.js";
|
|
7
|
+
import { AIMessage as O, isAIMessage as $, isToolMessage as U } from "@langchain/core/messages";
|
|
8
|
+
import { createAgent as V, summarizationMiddleware as L, modelCallLimitMiddleware as z } from "langchain";
|
|
9
|
+
import { c as h, E as J } from "./aiFactory.js";
|
|
10
|
+
const ye = m.Root({
|
|
11
|
+
agentExecutionContext: m({
|
|
12
|
+
default: q,
|
|
13
|
+
reducer: P
|
|
45
14
|
}),
|
|
46
|
-
currentIntent:
|
|
15
|
+
currentIntent: m({
|
|
47
16
|
default: () => "none",
|
|
48
17
|
reducer: T
|
|
49
18
|
}),
|
|
50
|
-
routing:
|
|
19
|
+
routing: m({
|
|
51
20
|
default: () => ({ mode: "auto" }),
|
|
52
21
|
reducer: T
|
|
53
22
|
}),
|
|
54
|
-
lastExecutedAgent:
|
|
23
|
+
lastExecutedAgent: m({
|
|
55
24
|
default: () => "",
|
|
56
25
|
reducer: T
|
|
57
26
|
}),
|
|
58
|
-
requiresFollowUp:
|
|
27
|
+
requiresFollowUp: m({
|
|
59
28
|
default: () => !0,
|
|
60
29
|
reducer: T
|
|
61
30
|
}),
|
|
62
|
-
stepCount:
|
|
31
|
+
stepCount: m({
|
|
63
32
|
default: () => 0,
|
|
64
33
|
reducer: (e, t) => t ?? e + 1
|
|
65
34
|
}),
|
|
66
|
-
finalOutputMessage:
|
|
35
|
+
finalOutputMessage: m({
|
|
67
36
|
default: () => "",
|
|
68
|
-
reducer:
|
|
37
|
+
reducer: j
|
|
69
38
|
})
|
|
70
|
-
}),
|
|
39
|
+
}), W = (e) => {
|
|
71
40
|
if (!e || typeof e != "object" || !("services" in e))
|
|
72
41
|
return !1;
|
|
73
42
|
const t = e.services;
|
|
74
43
|
return !!t && typeof t == "object" && "agentRegistry" in t;
|
|
75
|
-
},
|
|
44
|
+
}, B = (e) => {
|
|
76
45
|
const t = e?.configurable;
|
|
77
|
-
return
|
|
78
|
-
},
|
|
46
|
+
return W(t) ? t : void 0;
|
|
47
|
+
}, G = (e, t, i) => {
|
|
79
48
|
const n = e[t];
|
|
80
|
-
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((
|
|
81
|
-
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(
|
|
49
|
+
return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((r, o) => {
|
|
50
|
+
(typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(o.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== i ? ". Note that variables only represent file names one level deep." : ""))));
|
|
82
51
|
});
|
|
83
|
-
},
|
|
84
|
-
const { agent: t, messages:
|
|
52
|
+
}, v = async (e) => (await G(/* @__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, H = async (e) => {
|
|
53
|
+
const { agent: t, messages: i, config: n } = e;
|
|
85
54
|
return { structuredResponse: (await t.invoke(
|
|
86
55
|
{
|
|
87
|
-
messages:
|
|
56
|
+
messages: i
|
|
88
57
|
},
|
|
89
58
|
n
|
|
90
59
|
)).structuredResponse };
|
|
91
|
-
},
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
abortSignal: e?.signal,
|
|
96
|
-
requestId: pe(),
|
|
97
|
-
requestSource: me(ne.applicationName)
|
|
98
|
-
};
|
|
99
|
-
}, ge = (e) => {
|
|
100
|
-
if (e == null || typeof e == "string" || e instanceof FormData || e instanceof HTMLFormElement)
|
|
101
|
-
return e;
|
|
102
|
-
if (e instanceof URLSearchParams)
|
|
103
|
-
return e.toString();
|
|
104
|
-
throw new TypeError(`Unsupported request body type: ${Object.prototype.toString.call(e)}`);
|
|
105
|
-
}, _ = async ({ config: e }) => {
|
|
106
|
-
const t = F.getDefault(), n = (await ee.getCredential(`${t.url}/sharing`))?.token;
|
|
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
|
-
const u = v.toLowerCase();
|
|
111
|
-
(u === "authorization" || u === "api-key" || u.startsWith("x-stainless-")) && d.delete(v);
|
|
112
|
-
}
|
|
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
|
-
responseType: "native",
|
|
119
|
-
signal: b
|
|
120
|
-
})).data;
|
|
121
|
-
};
|
|
122
|
-
}, w = async (e = {}) => {
|
|
123
|
-
const { modelTier: t = "default", config: o } = e, n = P[t], i = await oe(t);
|
|
124
|
-
return new Y({
|
|
125
|
-
modelName: n,
|
|
126
|
-
apiKey: "dummy-key",
|
|
127
|
-
useResponsesApi: !0,
|
|
128
|
-
// Prevent follow-up Responses API calls from replaying encrypted reasoning items the ArcGIS proxy cannot verify.
|
|
129
|
-
zdrEnabled: !0,
|
|
130
|
-
configuration: {
|
|
131
|
-
baseURL: i,
|
|
132
|
-
fetch: await _({ config: o })
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
}, ze = async (e = {}) => {
|
|
136
|
-
const { tier: t = "default", config: o } = e, n = k[t], i = await ie(t);
|
|
137
|
-
return new Z({
|
|
138
|
-
modelName: n,
|
|
139
|
-
apiKey: "dummy-key",
|
|
140
|
-
configuration: {
|
|
141
|
-
baseURL: i,
|
|
142
|
-
fetch: await _({ config: o })
|
|
143
|
-
},
|
|
144
|
-
batchSize: 2048,
|
|
145
|
-
maxConcurrency: 10
|
|
146
|
-
});
|
|
147
|
-
}, fe = r.object({
|
|
148
|
-
id: r.string().min(1),
|
|
149
|
-
name: r.string().min(1),
|
|
150
|
-
description: r.string().min(1)
|
|
60
|
+
}, K = s.object({
|
|
61
|
+
id: s.string().min(1),
|
|
62
|
+
name: s.string().min(1),
|
|
63
|
+
description: s.string().min(1)
|
|
151
64
|
});
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
const t = e.map((n) => n.id),
|
|
155
|
-
return
|
|
156
|
-
intent:
|
|
157
|
-
assignedTask:
|
|
158
|
-
requiresFollowUp:
|
|
65
|
+
s.array(K);
|
|
66
|
+
const I = (e) => JSON.stringify(e, null, 2), Q = (e) => {
|
|
67
|
+
const t = e.map((n) => n.id), i = s.enum(t);
|
|
68
|
+
return s.object({
|
|
69
|
+
intent: i.nullable(),
|
|
70
|
+
assignedTask: s.string().nullable(),
|
|
71
|
+
requiresFollowUp: s.boolean()
|
|
159
72
|
});
|
|
160
|
-
},
|
|
161
|
-
const
|
|
73
|
+
}, he = async (e, t) => {
|
|
74
|
+
const i = B(t);
|
|
162
75
|
if (t?.signal?.aborted)
|
|
163
|
-
return await
|
|
76
|
+
return await g({ text: "Run cancelled; skipping intent routing" }, t), {
|
|
164
77
|
...e,
|
|
165
78
|
currentIntent: "none",
|
|
166
79
|
finalOutputMessage: "Operation cancelled.",
|
|
167
80
|
requiresFollowUp: !1
|
|
168
81
|
};
|
|
169
82
|
try {
|
|
170
|
-
await
|
|
171
|
-
const
|
|
172
|
-
id:
|
|
173
|
-
name:
|
|
174
|
-
description:
|
|
83
|
+
await g({ text: "Asking LLM to route to an agent" }, t);
|
|
84
|
+
const r = i.services.agentRegistry?.list() ?? [], o = r.map(({ agent: u }) => ({
|
|
85
|
+
id: u.id,
|
|
86
|
+
name: u.name,
|
|
87
|
+
description: u.description
|
|
175
88
|
}));
|
|
176
|
-
if (!
|
|
177
|
-
return await
|
|
89
|
+
if (!o.length)
|
|
90
|
+
return await g({ text: "No agents registered; skipping intent detection" }, t), {
|
|
178
91
|
...e,
|
|
179
92
|
currentIntent: "none",
|
|
180
93
|
finalOutputMessage: "No agents registered; skipping intent detection."
|
|
181
94
|
};
|
|
182
|
-
const a = await
|
|
95
|
+
const a = await v("intent_prompt"), c = I(o), l = Q(o), d = {
|
|
183
96
|
registeredAgents: c,
|
|
184
|
-
priorSteps:
|
|
97
|
+
priorSteps: I(e.agentExecutionContext.priorSteps),
|
|
185
98
|
userRequest: e.agentExecutionContext.userRequest
|
|
186
|
-
},
|
|
187
|
-
model: await
|
|
99
|
+
}, k = await E.fromTemplate(a).format(d), D = V({
|
|
100
|
+
model: await h({
|
|
188
101
|
modelTier: "fast",
|
|
189
102
|
config: t
|
|
190
103
|
}),
|
|
191
104
|
tools: [],
|
|
192
|
-
systemPrompt:
|
|
105
|
+
systemPrompt: k,
|
|
193
106
|
responseFormat: l,
|
|
194
107
|
middleware: [
|
|
195
108
|
// Preserve recent conversation context while summarizing older messages
|
|
196
109
|
// to control token usage without losing important intent signals.
|
|
197
110
|
// The trigger and keep parameters can be tuned based on token limits and behavior.
|
|
198
|
-
|
|
199
|
-
model: await
|
|
111
|
+
L({
|
|
112
|
+
model: await h({
|
|
200
113
|
modelTier: "fast",
|
|
201
114
|
config: t
|
|
202
115
|
}),
|
|
@@ -205,36 +118,36 @@ const C = (e) => JSON.stringify(e, null, 2), he = (e) => {
|
|
|
205
118
|
}),
|
|
206
119
|
// Enforce no loop/retry.
|
|
207
120
|
// 1 usual LLM call and 1 optional summarization call.
|
|
208
|
-
|
|
121
|
+
z({ runLimit: 2 })
|
|
209
122
|
]
|
|
210
|
-
}), { structuredResponse:
|
|
211
|
-
agent:
|
|
123
|
+
}), { structuredResponse: R } = await H({
|
|
124
|
+
agent: D,
|
|
212
125
|
messages: e.agentExecutionContext.messages,
|
|
213
126
|
config: t
|
|
214
|
-
}),
|
|
215
|
-
|
|
216
|
-
), x =
|
|
127
|
+
}), f = l.parse(
|
|
128
|
+
R ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
|
|
129
|
+
), x = f.intent ?? "none", F = {
|
|
217
130
|
...e,
|
|
218
131
|
currentIntent: x,
|
|
219
|
-
requiresFollowUp:
|
|
132
|
+
requiresFollowUp: f.requiresFollowUp,
|
|
220
133
|
agentExecutionContext: {
|
|
221
134
|
...e.agentExecutionContext,
|
|
222
|
-
assignedTask:
|
|
135
|
+
assignedTask: f.assignedTask ?? ""
|
|
223
136
|
}
|
|
224
137
|
};
|
|
225
138
|
if (x === "none") {
|
|
226
|
-
const
|
|
139
|
+
const u = `I could not find an agent that can handle that request. I have access to the following agents: ${r.map(({ agent: _ }) => _.name).join(", ")}.
|
|
227
140
|
|
|
228
141
|
Please ask a question that can be answered by one of these agents.`;
|
|
229
|
-
return await
|
|
142
|
+
return await g({ text: "LLM did not identify a clear intent." }, t), {
|
|
230
143
|
...e,
|
|
231
144
|
currentIntent: x,
|
|
232
145
|
requiresFollowUp: !1,
|
|
233
|
-
finalOutputMessage:
|
|
146
|
+
finalOutputMessage: u,
|
|
234
147
|
agentExecutionContext: {
|
|
235
148
|
...e.agentExecutionContext,
|
|
236
149
|
assignedTask: "",
|
|
237
|
-
messages: [...e.agentExecutionContext.messages, new
|
|
150
|
+
messages: [...e.agentExecutionContext.messages, new O(u)],
|
|
238
151
|
priorSteps: [
|
|
239
152
|
...e.agentExecutionContext.priorSteps ?? [],
|
|
240
153
|
{
|
|
@@ -247,171 +160,171 @@ Please ask a question that can be answered by one of these agents.`;
|
|
|
247
160
|
}
|
|
248
161
|
};
|
|
249
162
|
}
|
|
250
|
-
return await
|
|
163
|
+
return await g(
|
|
251
164
|
{
|
|
252
165
|
text: `Agent picked: ${x}
|
|
253
|
-
Task Assigned: ${
|
|
254
|
-
Requires Follow-Up: ${
|
|
166
|
+
Task Assigned: ${f.assignedTask ?? ""}
|
|
167
|
+
Requires Follow-Up: ${f.requiresFollowUp}`
|
|
255
168
|
},
|
|
256
169
|
t
|
|
257
|
-
),
|
|
170
|
+
), F;
|
|
258
171
|
} catch (n) {
|
|
259
|
-
throw await
|
|
172
|
+
throw await g({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
|
|
260
173
|
}
|
|
261
|
-
},
|
|
174
|
+
}, X = "0.1", y = 1536, Y = "openai", Z = J.default, ee = `Name: {name}
|
|
262
175
|
Title: {title}
|
|
263
|
-
Description: {description}`,
|
|
176
|
+
Description: {description}`, te = `Name: {name}
|
|
264
177
|
Alias: {alias}
|
|
265
|
-
Description: {description}`,
|
|
266
|
-
schemaVersion:
|
|
267
|
-
modified:
|
|
268
|
-
embeddings:
|
|
269
|
-
modelProvider:
|
|
270
|
-
model:
|
|
271
|
-
dimensions:
|
|
272
|
-
templates:
|
|
273
|
-
layer:
|
|
274
|
-
field:
|
|
178
|
+
Description: {description}`, we = s.object({
|
|
179
|
+
schemaVersion: s.literal(X),
|
|
180
|
+
modified: s.number().int().nonnegative(),
|
|
181
|
+
embeddings: s.object({
|
|
182
|
+
modelProvider: s.literal(Y),
|
|
183
|
+
model: s.literal(Z),
|
|
184
|
+
dimensions: s.literal(y),
|
|
185
|
+
templates: s.object({
|
|
186
|
+
layer: s.string().default(ee),
|
|
187
|
+
field: s.string().default(te)
|
|
275
188
|
})
|
|
276
189
|
}),
|
|
277
|
-
layers:
|
|
278
|
-
|
|
279
|
-
id:
|
|
280
|
-
name:
|
|
281
|
-
title:
|
|
282
|
-
description:
|
|
283
|
-
vector:
|
|
190
|
+
layers: s.array(
|
|
191
|
+
s.object({
|
|
192
|
+
id: s.string().min(1),
|
|
193
|
+
name: s.string().min(1),
|
|
194
|
+
title: s.string().catch(""),
|
|
195
|
+
description: s.string().catch(""),
|
|
196
|
+
vector: s.array(s.number()).length(y, {
|
|
284
197
|
message: `Layer vector must be exactly ${y} dimensions`
|
|
285
198
|
}),
|
|
286
|
-
fields:
|
|
287
|
-
|
|
288
|
-
name:
|
|
289
|
-
alias:
|
|
290
|
-
description:
|
|
291
|
-
vector:
|
|
199
|
+
fields: s.array(
|
|
200
|
+
s.object({
|
|
201
|
+
name: s.string().min(1),
|
|
202
|
+
alias: s.string().catch(""),
|
|
203
|
+
description: s.string().catch(""),
|
|
204
|
+
vector: s.array(s.number()).length(y, {
|
|
292
205
|
message: `Field vector must be exactly ${y} dimensions`
|
|
293
206
|
})
|
|
294
207
|
})
|
|
295
208
|
)
|
|
296
209
|
})
|
|
297
210
|
).default([])
|
|
298
|
-
}),
|
|
211
|
+
}), ne = (e) => {
|
|
299
212
|
const t = /* @__PURE__ */ new Set();
|
|
300
213
|
for (const n of e)
|
|
301
|
-
if (
|
|
302
|
-
const
|
|
303
|
-
|
|
304
|
-
|
|
214
|
+
if ($(n)) {
|
|
215
|
+
const r = n;
|
|
216
|
+
r.tool_calls && r.tool_calls.length > 0 && r.tool_calls.forEach((o) => {
|
|
217
|
+
o.id && t.add(o.id);
|
|
305
218
|
});
|
|
306
219
|
}
|
|
307
220
|
return e.filter((n) => {
|
|
308
|
-
if (
|
|
309
|
-
const
|
|
310
|
-
return t.has(
|
|
221
|
+
if (U(n)) {
|
|
222
|
+
const r = n;
|
|
223
|
+
return t.has(r.tool_call_id);
|
|
311
224
|
}
|
|
312
225
|
return !0;
|
|
313
226
|
});
|
|
314
|
-
},
|
|
315
|
-
const
|
|
316
|
-
return
|
|
317
|
-
},
|
|
318
|
-
const { promptText: t, modelTier:
|
|
319
|
-
return
|
|
320
|
-
},
|
|
321
|
-
const { promptText: t, modelTier:
|
|
227
|
+
}, M = (e, t) => {
|
|
228
|
+
const i = N.fromTemplate(e);
|
|
229
|
+
return E.fromMessages([i, ...t]);
|
|
230
|
+
}, se = async (e) => {
|
|
231
|
+
const { promptText: t, modelTier: i, messages: n, config: r } = e, o = M(t, n ?? []), a = await h({ modelTier: i, config: r });
|
|
232
|
+
return o.pipe(a);
|
|
233
|
+
}, xe = async (e) => {
|
|
234
|
+
const { promptText: t, modelTier: i = "default", messages: n, inputVariables: r, config: o } = e, c = await (await se({
|
|
322
235
|
promptText: t,
|
|
323
|
-
modelTier:
|
|
236
|
+
modelTier: i,
|
|
324
237
|
messages: n,
|
|
325
|
-
config:
|
|
326
|
-
})).invoke(
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
const
|
|
330
|
-
return
|
|
331
|
-
},
|
|
332
|
-
const { promptText: t, modelTier:
|
|
333
|
-
return await
|
|
334
|
-
},
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
238
|
+
config: o
|
|
239
|
+
})).invoke(r ?? {}, o);
|
|
240
|
+
if (typeof c == "string")
|
|
241
|
+
return c;
|
|
242
|
+
const l = c.content;
|
|
243
|
+
return typeof l == "string" ? l : JSON.stringify(l);
|
|
244
|
+
}, A = async (e) => {
|
|
245
|
+
const { promptText: t, modelTier: i = "default", messages: n, inputVariables: r, schema: o, config: a } = e, c = M(t, n ?? []), d = (await h({ modelTier: i, config: a })).withStructuredOutput(o);
|
|
246
|
+
return await c.pipe(d).invoke(r ?? {}, a);
|
|
247
|
+
}, Te = async (e) => {
|
|
248
|
+
const { promptText: t, modelTier: i = "default", messages: n, inputVariables: r, tools: o, config: a } = e, c = o.length > 0 ? ne(n ?? []) : n ?? [], l = M(t, c), d = await h({ modelTier: i, config: a });
|
|
249
|
+
return await l.pipe(d.bindTools(o)).invoke(r ?? {}, a);
|
|
250
|
+
}, ie = p.object({
|
|
251
|
+
name: p.string(),
|
|
252
|
+
description: p.string(),
|
|
253
|
+
valueType: p.string(),
|
|
254
|
+
alias: p.string()
|
|
255
|
+
}), oe = p.object({
|
|
256
|
+
fields: p.array(ie)
|
|
257
|
+
}), C = (e, t) => e.getFieldAlias(t) ?? void 0, b = (e, t) => C(e, t.name) ?? t.alias ?? "", re = (e, t) => {
|
|
258
|
+
const i = C(e, t.name);
|
|
259
|
+
return !!(i && i !== (t.alias ?? ""));
|
|
344
260
|
};
|
|
345
|
-
function
|
|
346
|
-
const
|
|
261
|
+
function S(e, t) {
|
|
262
|
+
const i = /* @__PURE__ */ new Map();
|
|
347
263
|
for (const n of e.fields) {
|
|
348
|
-
const
|
|
264
|
+
const r = t.fields.find((l) => l.name === n.name), o = b(e, n), a = re(e, n), c = {
|
|
349
265
|
name: n.name,
|
|
350
266
|
type: n.type,
|
|
351
|
-
alias: a ?
|
|
352
|
-
description:
|
|
353
|
-
valueType:
|
|
267
|
+
alias: a ? o : r?.alias ?? o,
|
|
268
|
+
description: r?.description ?? n.description ?? "",
|
|
269
|
+
valueType: r?.valueType ?? n.valueType ?? "",
|
|
354
270
|
domain: e.getFieldDomain(n.name) ?? void 0
|
|
355
271
|
};
|
|
356
|
-
|
|
272
|
+
i.set(n.name, c);
|
|
357
273
|
}
|
|
358
|
-
return
|
|
274
|
+
return i;
|
|
359
275
|
}
|
|
360
|
-
const
|
|
361
|
-
const
|
|
362
|
-
const { name: c, type: l, description:
|
|
363
|
-
return [`Name: ${c}`, `Type: ${l}`, `Alias: ${
|
|
276
|
+
const be = async (e) => {
|
|
277
|
+
const i = await v("field_descriptions_prompt"), n = e.fields.filter((a) => !(b(e, a) && a.description)).map((a) => {
|
|
278
|
+
const { name: c, type: l, description: d } = a, w = b(e, a);
|
|
279
|
+
return [`Name: ${c}`, `Type: ${l}`, `Alias: ${w}`, `Description: ${d ?? "N/A"}`].join(", ");
|
|
364
280
|
}).join(`
|
|
365
281
|
`);
|
|
366
282
|
if (n.length === 0)
|
|
367
|
-
return
|
|
368
|
-
const
|
|
283
|
+
return S(e, { fields: [] });
|
|
284
|
+
const r = {
|
|
369
285
|
existingItemTitle: e.portalItem?.title,
|
|
370
286
|
existingItemDescription: e.portalItem?.description,
|
|
371
287
|
existingLayerTitle: e.title,
|
|
372
288
|
existingLayerDescription: e.portalItem?.description,
|
|
373
289
|
fieldInformation: n
|
|
374
|
-
},
|
|
375
|
-
promptText:
|
|
376
|
-
schema:
|
|
377
|
-
inputVariables:
|
|
290
|
+
}, o = await A({
|
|
291
|
+
promptText: i,
|
|
292
|
+
schema: oe,
|
|
293
|
+
inputVariables: r
|
|
378
294
|
});
|
|
379
|
-
return
|
|
380
|
-
},
|
|
381
|
-
title:
|
|
382
|
-
description:
|
|
383
|
-
name:
|
|
384
|
-
}),
|
|
385
|
-
const n = await
|
|
386
|
-
fieldInformation: JSON.stringify(
|
|
295
|
+
return S(e, o);
|
|
296
|
+
}, ae = p.object({
|
|
297
|
+
title: p.string(),
|
|
298
|
+
description: p.string(),
|
|
299
|
+
name: p.string().nullable()
|
|
300
|
+
}), ve = async (e, t) => {
|
|
301
|
+
const n = await v("layer_descriptions_prompt"), r = Array.from(t.values()), o = {
|
|
302
|
+
fieldInformation: JSON.stringify(r, null, 2),
|
|
387
303
|
existingLayerTitle: e.title,
|
|
388
304
|
existingLayerDescription: e.portalItem?.description,
|
|
389
305
|
existingLayerSnippet: e.portalItem?.snippet,
|
|
390
306
|
layerGeometryType: e.geometryType
|
|
391
307
|
};
|
|
392
|
-
return { ...await
|
|
308
|
+
return { ...await A({
|
|
393
309
|
promptText: n,
|
|
394
|
-
schema:
|
|
395
|
-
inputVariables:
|
|
310
|
+
schema: ae,
|
|
311
|
+
inputVariables: o
|
|
396
312
|
}), name: e.title ?? null };
|
|
397
313
|
};
|
|
398
314
|
export {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
Ve as n,
|
|
415
|
-
ze as o,
|
|
416
|
-
ye as s
|
|
315
|
+
ye as D,
|
|
316
|
+
we as W,
|
|
317
|
+
xe as a,
|
|
318
|
+
he as b,
|
|
319
|
+
be as c,
|
|
320
|
+
ve as d,
|
|
321
|
+
y as e,
|
|
322
|
+
te as f,
|
|
323
|
+
B as g,
|
|
324
|
+
Y as h,
|
|
325
|
+
Te as i,
|
|
326
|
+
A as j,
|
|
327
|
+
ee as l,
|
|
328
|
+
Z as m,
|
|
329
|
+
X as s
|
|
417
330
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { createSkillAgent as o } from "../agents/runtime/skill/createSkillAgent.js";
|
|
3
|
+
const d = (a, e) => {
|
|
4
|
+
const r = Array.from(a?.values() ?? []).map(({ fieldRegistry: l, layerItem: t }) => {
|
|
5
|
+
const s = Array.from(l.values(), ({ name: i }) => i);
|
|
6
|
+
return {
|
|
7
|
+
title: t.title,
|
|
8
|
+
description: t.description,
|
|
9
|
+
fields: s.slice(0, 10),
|
|
10
|
+
additionalFieldCount: Math.max(s.length - 10, 0)
|
|
11
|
+
};
|
|
12
|
+
}), n = (e?.list() ?? []).map(({ agent: { description: l, id: t, name: s } }) => ({
|
|
13
|
+
id: t,
|
|
14
|
+
name: s,
|
|
15
|
+
description: l
|
|
16
|
+
}));
|
|
17
|
+
return JSON.stringify({ layers: r, agents: n }, null, 2);
|
|
18
|
+
}, c = ({ config: a }) => {
|
|
19
|
+
const e = a?.configurable?.services;
|
|
20
|
+
return d(e?.layersAndFieldsRegistry, e?.agentRegistry);
|
|
21
|
+
}, p = [async () => (await import("./SKILL3.js")).default], u = {
|
|
22
|
+
listLayerFields: async () => (await import("../agents/tools/help/listFields/adapter.js")).listLayerFieldsTool
|
|
23
|
+
}, g = o({
|
|
24
|
+
id: "help",
|
|
25
|
+
name: "Help Agent",
|
|
26
|
+
description: "Answers questions about the current map, its layers and fields, and available assistant capabilities. Use for general help, unsupported map actions, and unrelated requests that should be redirected to map-related questions.",
|
|
27
|
+
skillLoaders: p,
|
|
28
|
+
toolLoaders: u,
|
|
29
|
+
modelTier: "default",
|
|
30
|
+
systemPrompt: "You are an ArcGIS map help agent.",
|
|
31
|
+
runtimeContextLoader: c,
|
|
32
|
+
fallbackMessage: "Help request completed.",
|
|
33
|
+
failureMessage: "I couldn't complete the help request."
|
|
34
|
+
});
|
|
35
|
+
export {
|
|
36
|
+
g as H
|
|
37
|
+
};
|