@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.
Files changed (176) hide show
  1. package/dist/agent-utils/LLMAgent.js +41 -40
  2. package/dist/agent-utils/middlewares/trace.js +5 -5
  3. package/dist/agents/runtime/skill/createSkillAgent.d.ts +31 -0
  4. package/dist/agents/runtime/skill/createSkillAgent.js +262 -0
  5. package/dist/agents/runtime/skill/loadAgentSkills.d.ts +16 -0
  6. package/dist/agents/runtime/skill/types.d.ts +28 -0
  7. package/dist/agents/runtime/skill/types.js +2 -0
  8. package/dist/agents/tools/filter/setFeatureEffect/adapter.js +20 -19
  9. package/dist/agents/tools/query/getStatistics/adapter.js +4 -3
  10. package/dist/agents/tools/query/getTopFeatures/adapter.js +4 -3
  11. package/dist/agents/tools/query/queryFeatures/adapter.js +4 -3
  12. package/dist/agents/tools/shared/resolveToolArtifact.d.ts +22 -0
  13. package/dist/agents/tools/shared/resolveToolArtifact.js +20 -0
  14. package/dist/agents/tools/shared/types.d.ts +22 -0
  15. package/dist/agents/tools/shared/types.js +6 -0
  16. package/dist/cdn/23C34FEU.js +2 -0
  17. package/dist/cdn/{NZSOJ726.js → 2AMUOR7X.js} +1 -1
  18. package/dist/cdn/2OHRNRNT.js +2 -0
  19. package/dist/cdn/2OUIRKTV.js +2 -0
  20. package/dist/cdn/2S6L3P4Q.js +2 -0
  21. package/dist/cdn/{C4FEETBZ.js → 2W7LK4HA.js} +1 -1
  22. package/dist/cdn/3IOP64NG.js +2 -0
  23. package/dist/cdn/3OH35VXS.js +2 -0
  24. package/dist/cdn/{5K5ZY267.js → 3SD47V7G.js} +1 -1
  25. package/dist/cdn/{7VAQUCBU.js → 3VCPN2KW.js} +1 -1
  26. package/dist/cdn/{LLUGJKAQ.js → 3XDT7MWI.js} +1 -1
  27. package/dist/cdn/{Y7XD7ZRD.js → 4ALF2CJY.js} +1 -1
  28. package/dist/cdn/{HAEFC2SJ.js → 5LMYUEK7.js} +1 -1
  29. package/dist/cdn/{655YIKL3.js → 6GODC6RU.js} +2 -2
  30. package/dist/cdn/{7VUSIGEM.js → 6RAWG2KQ.js} +1 -1
  31. package/dist/cdn/{GCVB5VG4.js → 6YZGKVYB.js} +1 -1
  32. package/dist/cdn/{VLLZ2FFU.js → 725MBCQF.js} +1 -1
  33. package/dist/cdn/74CVYM72.js +19 -0
  34. package/dist/cdn/{CP5BVGJU.js → 7EOS4SGJ.js} +1 -1
  35. package/dist/cdn/{5WYRJMBW.js → 7QIX4PZR.js} +1 -1
  36. package/dist/cdn/7UF3WRLO.js +72 -0
  37. package/dist/cdn/A7BKHIMA.js +2 -0
  38. package/dist/cdn/AFSBL4ZP.js +2 -0
  39. package/dist/cdn/{FG647IP6.js → AGQ5ADFU.js} +1 -1
  40. package/dist/cdn/{5ZFUGNRN.js → BQYF37UD.js} +1 -1
  41. package/dist/cdn/{4RDNI22D.js → BTTBKTFM.js} +4 -4
  42. package/dist/cdn/BVSK2GWP.js +2 -0
  43. package/dist/cdn/CFAC4FN3.js +2 -0
  44. package/dist/cdn/{HDACNIZF.js → D5EKX26R.js} +1 -1
  45. package/dist/cdn/EGN5BCHV.js +2 -0
  46. package/dist/cdn/{BXQ4I5HB.js → EJJFG5DE.js} +2 -2
  47. package/dist/cdn/{ZDV4K4WG.js → EOD5PNOL.js} +1 -1
  48. package/dist/cdn/{OE3GW5LE.js → ES6D4UD6.js} +1 -1
  49. package/dist/cdn/{K2R6XVK3.js → HB72YIII.js} +1 -1
  50. package/dist/cdn/{G2EGT3CF.js → HHBNLCJP.js} +1 -1
  51. package/dist/cdn/HLN5675C.js +2 -0
  52. package/dist/cdn/IFFOSSNB.js +2 -0
  53. package/dist/cdn/IO7DYFL2.js +2 -0
  54. package/dist/cdn/{IBZ2NEAO.js → IRSJXHRN.js} +1 -1
  55. package/dist/cdn/JD2TB7H4.js +2 -0
  56. package/dist/cdn/{ANRQWYU2.js → JKKU4K4C.js} +1 -1
  57. package/dist/cdn/{FUF3NAU7.js → JMNHFKGL.js} +1 -1
  58. package/dist/cdn/{22KHSDJI.js → JWZD3D5E.js} +1 -1
  59. package/dist/cdn/{HKOGIZDQ.js → KJLLN4P4.js} +18 -18
  60. package/dist/cdn/KZ73TZOB.js +2 -0
  61. package/dist/cdn/LEO3USHH.js +2 -0
  62. package/dist/cdn/LNIMGXB4.js +2 -0
  63. package/dist/cdn/MG2W2ZF3.js +2 -0
  64. package/dist/cdn/{NYJYRCGA.js → MSXMHRI7.js} +1 -1
  65. package/dist/cdn/MXAZE2VM.js +179 -0
  66. package/dist/cdn/{EWLXNGKH.js → OL7QBAGS.js} +15 -15
  67. package/dist/cdn/OMF6ITSG.js +2 -0
  68. package/dist/cdn/{Z5W4V7RC.js → OOGADOKQ.js} +1 -1
  69. package/dist/cdn/{KITIP6J2.js → OZ2CM3J2.js} +1 -1
  70. package/dist/cdn/{6YYPVU7H.js → P4GFYBBO.js} +1 -1
  71. package/dist/cdn/PK5KI2XF.js +2 -0
  72. package/dist/cdn/PWFUEBTT.js +2 -0
  73. package/dist/cdn/{HHUQXL3R.js → PYGX4HN7.js} +1 -1
  74. package/dist/cdn/RFVZ7KCG.js +66 -0
  75. package/dist/cdn/{YEZ3AMNX.js → RLB6TK6B.js} +1 -1
  76. package/dist/cdn/{WKTQVBFJ.js → RN6WMVZX.js} +1 -1
  77. package/dist/cdn/{WJXXOKGA.js → ROQGPAR5.js} +1 -1
  78. package/dist/cdn/RSJSRETN.js +2 -0
  79. package/dist/cdn/RSR66KB4.js +2 -0
  80. package/dist/cdn/{7SRLZQVC.js → RZIXMISL.js} +1 -1
  81. package/dist/cdn/{VOKXKU7M.js → S4LELUBK.js} +9 -9
  82. package/dist/cdn/{AI6DYOKR.js → S627D4K7.js} +1 -1
  83. package/dist/cdn/SL4Y7IRG.js +2 -0
  84. package/dist/cdn/STUBN3L5.js +2 -0
  85. package/dist/cdn/T2OYKP3V.js +2 -0
  86. package/dist/cdn/{C4JT4S5E.js → TBYDZN4H.js} +1 -1
  87. package/dist/cdn/{HHFNQR6Z.js → TEI6WXW7.js} +1 -1
  88. package/dist/cdn/{WGO5SER7.js → TFRWUAB6.js} +1 -1
  89. package/dist/cdn/U3ETGDT7.js +2 -0
  90. package/dist/cdn/{KWD2ECTM.js → UAG6GDUG.js} +1 -1
  91. package/dist/cdn/UHICISBZ.js +2 -0
  92. package/dist/cdn/{NNXISHCA.js → VMZZR7MY.js} +2 -2
  93. package/dist/cdn/WW4BEFDF.js +2 -0
  94. package/dist/cdn/XGCQS3N4.js +2 -0
  95. package/dist/cdn/{R2PQVY4O.js → XKH37FLY.js} +1 -1
  96. package/dist/cdn/XQ3NBBQ3.js +2 -0
  97. package/dist/cdn/{7BCQMK6D.js → XTCLJEID.js} +1 -1
  98. package/dist/cdn/{J6SZIQJA.js → Y7LGFSHO.js} +1 -1
  99. package/dist/cdn/ZFOG3KXV.js +2 -0
  100. package/dist/cdn/ZZZB3GES.js +14 -0
  101. package/dist/cdn/agent-utils/index.js +1 -1
  102. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
  103. package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
  104. package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
  105. package/dist/cdn/index.js +1 -1
  106. package/dist/chunks/SKILL.js +5 -0
  107. package/dist/chunks/SKILL2.js +5 -0
  108. package/dist/chunks/SKILL3.js +22 -0
  109. package/dist/chunks/SKILL4.js +5 -0
  110. package/dist/chunks/adapter.js +137 -140
  111. package/dist/chunks/aiFactory.js +94 -0
  112. package/dist/chunks/arcgisKnowledgeGraph.js +14 -13
  113. package/dist/chunks/baseAgentState.js +2 -2
  114. package/dist/chunks/dataExplorationAgent.js +30 -0
  115. package/dist/chunks/generateLayerDescriptions.js +181 -268
  116. package/dist/chunks/helpAgent.js +37 -0
  117. package/dist/chunks/layerStylingGraph.js +91 -76
  118. package/dist/chunks/navigationAgent.js +40 -0
  119. package/dist/chunks/orchestrator.js +13 -12
  120. package/dist/chunks/requireAgentServices.js +11 -0
  121. package/dist/chunks/resolvePointGeometryFilter.js +11 -11
  122. package/dist/components/arcgis-assistant/customElement.d.ts +23 -3
  123. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +17 -6
  124. package/dist/components/arcgis-assistant-help-agent/customElement.js +3 -1
  125. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -0
  126. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
  127. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +18 -7
  128. package/dist/docs/api.json +1 -1
  129. package/dist/docs/docs.json +1 -1
  130. package/dist/docs/vscode.html-custom-data.json +1 -1
  131. package/dist/docs/web-types.json +1 -1
  132. package/dist/orchestrator/models/types.d.ts +1 -0
  133. package/dist/orchestrator/providers/arcgis/aiFactory.d.ts +15 -0
  134. package/dist/orchestrator/registry/agentRegistry.d.ts +33 -0
  135. package/dist/orchestrator/types/types.d.ts +17 -0
  136. package/dist/utils/index.d.ts +13 -3
  137. package/dist/utils/index.js +706 -82
  138. package/package.json +10 -6
  139. package/dist/cdn/2EY3BQQX.js +0 -2
  140. package/dist/cdn/2NDBI2VA.js +0 -156
  141. package/dist/cdn/4OGR5QKS.js +0 -2
  142. package/dist/cdn/5FL5BTTX.js +0 -66
  143. package/dist/cdn/5X7EG7D2.js +0 -2
  144. package/dist/cdn/6FCU2KJP.js +0 -2
  145. package/dist/cdn/7BJ4JKLG.js +0 -2
  146. package/dist/cdn/7HS5KX3J.js +0 -2
  147. package/dist/cdn/7UUYJTKT.js +0 -2
  148. package/dist/cdn/7V6OSTFC.js +0 -2
  149. package/dist/cdn/7VYYQ7BT.js +0 -2
  150. package/dist/cdn/ACJTJLZN.js +0 -2
  151. package/dist/cdn/AKD5UOVX.js +0 -2
  152. package/dist/cdn/C7LGDNB3.js +0 -14
  153. package/dist/cdn/CGJINV7H.js +0 -2
  154. package/dist/cdn/CJMUJXPL.js +0 -2
  155. package/dist/cdn/D2SS763Z.js +0 -2
  156. package/dist/cdn/FJO4KNOZ.js +0 -2
  157. package/dist/cdn/G3SF6U2U.js +0 -2
  158. package/dist/cdn/G6CR7JVM.js +0 -22
  159. package/dist/cdn/GL7BPKBN.js +0 -2
  160. package/dist/cdn/JO5ETMPS.js +0 -2
  161. package/dist/cdn/PUHRBGKB.js +0 -2
  162. package/dist/cdn/Q57QWN5W.js +0 -2
  163. package/dist/cdn/QUKNPVAF.js +0 -2
  164. package/dist/cdn/RBE55SWR.js +0 -2
  165. package/dist/cdn/SWH6ZHD4.js +0 -18
  166. package/dist/cdn/SZ2QSSB3.js +0 -2
  167. package/dist/cdn/T4RIGOXB.js +0 -2
  168. package/dist/cdn/W4JQDITQ.js +0 -36
  169. package/dist/cdn/XX6GHMNR.js +0 -2
  170. package/dist/cdn/YLVJA4ZE.js +0 -2
  171. package/dist/cdn/ZOEMBHRF.js +0 -2
  172. package/dist/cdn/ZRVZMPFN.js +0 -2
  173. package/dist/chunks/dataExplorationGraph.js +0 -254
  174. package/dist/chunks/helpGraph.js +0 -133
  175. package/dist/chunks/navigationGraph.js +0 -290
  176. 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 g } from "@langchain/langgraph/web";
3
- import { d as z, r as T, m as V, c as K } from "./baseAgentState.js";
4
- import m, { z as r } from "zod";
5
- import { ChatPromptTemplate as q, SystemMessagePromptTemplate as B } from "@langchain/core/prompts";
6
- import { s as h } from "./index.js";
7
- import { AIMessage as H, isAIMessage as W, isToolMessage as X } from "@langchain/core/messages";
8
- import { createAgent as G, summarizationMiddleware as J, modelCallLimitMiddleware as Q } from "langchain";
9
- import { ChatOpenAI as Y, OpenAIEmbeddings as Z } from "@langchain/openai";
10
- import F from "@arcgis/core/portal/Portal.js";
11
- import U from "@arcgis/core/request.js";
12
- import ee from "@arcgis/core/identity/IdentityManager.js";
13
- import { generateGuid as te } from "@arcgis/toolkit/string";
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: g({
15
+ currentIntent: m({
47
16
  default: () => "none",
48
17
  reducer: T
49
18
  }),
50
- routing: g({
19
+ routing: m({
51
20
  default: () => ({ mode: "auto" }),
52
21
  reducer: T
53
22
  }),
54
- lastExecutedAgent: g({
23
+ lastExecutedAgent: m({
55
24
  default: () => "",
56
25
  reducer: T
57
26
  }),
58
- requiresFollowUp: g({
27
+ requiresFollowUp: m({
59
28
  default: () => !0,
60
29
  reducer: T
61
30
  }),
62
- stepCount: g({
31
+ stepCount: m({
63
32
  default: () => 0,
64
33
  reducer: (e, t) => t ?? e + 1
65
34
  }),
66
- finalOutputMessage: g({
35
+ finalOutputMessage: m({
67
36
  default: () => "",
68
- reducer: z
37
+ reducer: j
69
38
  })
70
- }), re = (e) => {
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
- }, ae = (e) => {
44
+ }, B = (e) => {
76
45
  const t = e?.configurable;
77
- return re(t) ? t : void 0;
78
- }, ce = (e, t, o) => {
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((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." : ""))));
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
- }, 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;
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: o
56
+ messages: i
88
57
  },
89
58
  n
90
59
  )).structuredResponse };
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
- const t = e?.configurable;
93
- return {
94
- conversationId: de(t?.thread_id),
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
- r.array(fe);
153
- const C = (e) => JSON.stringify(e, null, 2), he = (e) => {
154
- const t = e.map((n) => n.id), o = r.enum(t);
155
- return r.object({
156
- intent: o.nullable(),
157
- assignedTask: r.string().nullable(),
158
- requiresFollowUp: r.boolean()
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
- }, Ve = async (e, t) => {
161
- const o = ae(t);
73
+ }, he = async (e, t) => {
74
+ const i = B(t);
162
75
  if (t?.signal?.aborted)
163
- return await h({ text: "Run cancelled; skipping intent routing" }, t), {
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 h({ text: "Asking LLM to route to an agent" }, t);
171
- const i = o.services.agentRegistry?.list() ?? [], s = i.map(({ agent: f }) => ({
172
- id: f.id,
173
- name: f.name,
174
- description: f.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 (!s.length)
177
- return await h({ text: "No agents registered; skipping intent detection" }, t), {
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 E("intent_prompt"), c = C(s), l = he(s), p = {
95
+ const a = await v("intent_prompt"), c = I(o), l = Q(o), d = {
183
96
  registeredAgents: c,
184
- priorSteps: C(e.agentExecutionContext.priorSteps),
97
+ priorSteps: I(e.agentExecutionContext.priorSteps),
185
98
  userRequest: e.agentExecutionContext.userRequest
186
- }, b = await q.fromTemplate(a).format(p), A = G({
187
- model: await w({
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: b,
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
- J({
199
- model: await w({
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
- Q({ runLimit: 2 })
121
+ z({ runLimit: 2 })
209
122
  ]
210
- }), { structuredResponse: v } = await le({
211
- agent: A,
123
+ }), { structuredResponse: R } = await H({
124
+ agent: D,
212
125
  messages: e.agentExecutionContext.messages,
213
126
  config: t
214
- }), u = l.parse(
215
- v ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
216
- ), x = u.intent ?? "none", N = {
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: u.requiresFollowUp,
132
+ requiresFollowUp: f.requiresFollowUp,
220
133
  agentExecutionContext: {
221
134
  ...e.agentExecutionContext,
222
- assignedTask: u.assignedTask ?? ""
135
+ assignedTask: f.assignedTask ?? ""
223
136
  }
224
137
  };
225
138
  if (x === "none") {
226
- 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(", ")}.
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 h({ text: "LLM did not identify a clear intent." }, t), {
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: f,
146
+ finalOutputMessage: u,
234
147
  agentExecutionContext: {
235
148
  ...e.agentExecutionContext,
236
149
  assignedTask: "",
237
- messages: [...e.agentExecutionContext.messages, new H(f)],
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 h(
163
+ return await g(
251
164
  {
252
165
  text: `Agent picked: ${x}
253
- Task Assigned: ${u.assignedTask ?? ""}
254
- Requires Follow-Up: ${u.requiresFollowUp}`
166
+ Task Assigned: ${f.assignedTask ?? ""}
167
+ Requires Follow-Up: ${f.requiresFollowUp}`
255
168
  },
256
169
  t
257
- ), N;
170
+ ), F;
258
171
  } catch (n) {
259
- throw await h({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
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
- }, ye = "0.1", y = 1536, we = "openai", be = k.default, ve = `Name: {name}
174
+ }, X = "0.1", y = 1536, Y = "openai", Z = J.default, ee = `Name: {name}
262
175
  Title: {title}
263
- Description: {description}`, xe = `Name: {name}
176
+ Description: {description}`, te = `Name: {name}
264
177
  Alias: {alias}
265
- Description: {description}`, Ke = r.object({
266
- schemaVersion: r.literal(ye),
267
- modified: r.number().int().nonnegative(),
268
- embeddings: r.object({
269
- modelProvider: r.literal(we),
270
- model: r.literal(be),
271
- dimensions: r.literal(y),
272
- templates: r.object({
273
- layer: r.string().default(ve),
274
- field: r.string().default(xe)
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: r.array(
278
- r.object({
279
- id: r.string().min(1),
280
- name: r.string().min(1),
281
- title: r.string().catch(""),
282
- description: r.string().catch(""),
283
- vector: r.array(r.number()).length(y, {
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: r.array(
287
- r.object({
288
- name: r.string().min(1),
289
- alias: r.string().catch(""),
290
- description: r.string().catch(""),
291
- vector: r.array(r.number()).length(y, {
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
- }), Te = (e) => {
211
+ }), ne = (e) => {
299
212
  const t = /* @__PURE__ */ new Set();
300
213
  for (const n of e)
301
- if (W(n)) {
302
- const i = n;
303
- i.tool_calls && i.tool_calls.length > 0 && i.tool_calls.forEach((s) => {
304
- s.id && t.add(s.id);
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 (X(n)) {
309
- const i = n;
310
- return t.has(i.tool_call_id);
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
- }, R = (e, t) => {
315
- const o = B.fromTemplate(e);
316
- return q.fromMessages([o, ...t]);
317
- }, Me = async (e) => {
318
- const { promptText: t, modelTier: o, messages: n, config: i } = e, s = R(t, n ?? []), a = await w({ modelTier: o, config: i });
319
- return s.pipe(a);
320
- }, Be = async (e) => {
321
- const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, config: s } = e, c = await (await Me({
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: o,
236
+ modelTier: i,
324
237
  messages: n,
325
- config: s
326
- })).invoke(i ?? {}, s);
327
- return typeof c == "string" ? c : c.text;
328
- }, $ = async (e) => {
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);
331
- }, He = async (e) => {
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
- }), O = (e, t) => e.getFieldAlias(t) ?? void 0, I = (e, t) => O(e, t.name) ?? t.alias ?? "", ke = (e, t) => {
342
- const o = O(e, t.name);
343
- return !!(o && o !== (t.alias ?? ""));
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 D(e, t) {
346
- const o = /* @__PURE__ */ new Map();
261
+ function S(e, t) {
262
+ const i = /* @__PURE__ */ new Map();
347
263
  for (const n of e.fields) {
348
- const i = t.fields.find((l) => l.name === n.name), s = I(e, n), a = ke(e, n), c = {
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 ? s : i?.alias ?? s,
352
- description: i?.description ?? n.description ?? "",
353
- valueType: i?.valueType ?? n.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
- o.set(n.name, c);
272
+ i.set(n.name, c);
357
273
  }
358
- return o;
274
+ return i;
359
275
  }
360
- const We = async (e) => {
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(", ");
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 D(e, { fields: [] });
368
- const i = {
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
- }, s = await $({
375
- promptText: o,
376
- schema: Ie,
377
- inputVariables: i
290
+ }, o = await A({
291
+ promptText: i,
292
+ schema: oe,
293
+ inputVariables: r
378
294
  });
379
- return D(e, s);
380
- }, Ee = m.object({
381
- title: m.string(),
382
- description: m.string(),
383
- name: m.string().nullable()
384
- }), Xe = async (e, t) => {
385
- const n = await E("layer_descriptions_prompt"), i = Array.from(t.values()), s = {
386
- fieldInformation: JSON.stringify(i, null, 2),
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: Ee,
395
- inputVariables: s
310
+ schema: ae,
311
+ inputVariables: o
396
312
  }), name: e.title ?? null };
397
313
  };
398
314
  export {
399
- Le as D,
400
- Ke as W,
401
- Xe as a,
402
- we as b,
403
- w as c,
404
- y as d,
405
- Be as e,
406
- xe as f,
407
- We as g,
408
- He as h,
409
- $ as i,
410
- ie as j,
411
- ae as k,
412
- ve as l,
413
- be as m,
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
+ };