@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.
Files changed (147) hide show
  1. package/dist/agent-utils/LLMAgent.d.ts +5 -2
  2. package/dist/agent-utils/LLMAgent.js +1 -1
  3. package/dist/agentic-workflow/jsonTypes.d.ts +8 -1
  4. package/dist/agentic-workflow/nodes/AgentNode.d.ts +2 -0
  5. package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
  6. package/dist/cdn/253R5CBD.js +2 -0
  7. package/dist/cdn/2VBPA27M.js +18 -0
  8. package/dist/cdn/{DWYODVWW.js → 323DHVYA.js} +5 -5
  9. package/dist/cdn/34O57OGV.js +2 -0
  10. package/dist/cdn/{FSMHR7GK.js → 4HDDRBIY.js} +1 -1
  11. package/dist/cdn/4MFEKBKL.js +11 -0
  12. package/dist/cdn/{Y5UFOH54.js → 4NJ2FF7H.js} +1 -1
  13. package/dist/cdn/4YXYLX4H.js +2 -0
  14. package/dist/cdn/5DVRVY4L.js +2 -0
  15. package/dist/cdn/5PJXNTLZ.js +2 -0
  16. package/dist/cdn/5R6QUF5B.js +2 -0
  17. package/dist/cdn/5RVELJU4.js +36 -0
  18. package/dist/cdn/5WLNL4HZ.js +2 -0
  19. package/dist/cdn/66SKMECC.js +2 -0
  20. package/dist/cdn/6CLF7KIK.js +2 -0
  21. package/dist/cdn/{S6ZAQRC6.js → 6KFMRBAA.js} +1 -1
  22. package/dist/cdn/77QFSIWW.js +5 -0
  23. package/dist/cdn/7E2QMWK6.js +2 -0
  24. package/dist/cdn/{HO2YDJI2.js → 7M6VKBTK.js} +1 -1
  25. package/dist/cdn/{HJG7QM2R.js → 7VAQUCBU.js} +1 -1
  26. package/dist/cdn/ACJTJLZN.js +2 -0
  27. package/dist/cdn/AI6DYOKR.js +181 -0
  28. package/dist/cdn/AT4XVTJR.js +44 -0
  29. package/dist/cdn/BS2PFNU4.js +2 -0
  30. package/dist/cdn/CCC6LBMY.js +2 -0
  31. package/dist/cdn/CGXQAB3A.js +2 -0
  32. package/dist/cdn/{M3MRIGDZ.js → CP5BVGJU.js} +1 -1
  33. package/dist/cdn/CWD37QFT.js +2 -0
  34. package/dist/cdn/DY36ATOA.js +2 -0
  35. package/dist/cdn/DYASSC7Z.js +2 -0
  36. package/dist/cdn/EAEQONP7.js +2 -0
  37. package/dist/cdn/EMLOVMD4.js +2 -0
  38. package/dist/cdn/EWLXNGKH.js +208 -0
  39. package/dist/cdn/FAR3DFFK.js +2 -0
  40. package/dist/cdn/FDOMMK2M.js +2 -0
  41. package/dist/cdn/GRHIFCQX.js +2 -0
  42. package/dist/cdn/{S3XUYAUX.js → HHFNQR6Z.js} +1 -1
  43. package/dist/cdn/{WQKNV6KK.js → HMUWQCXU.js} +1 -1
  44. package/dist/cdn/HZ5ARNAM.js +2 -0
  45. package/dist/cdn/I6PD2HSL.js +2 -0
  46. package/dist/cdn/IDUC4CPV.js +2 -0
  47. package/dist/cdn/IRNSIUBT.js +2 -0
  48. package/dist/cdn/{OYNIFMCJ.js → J6SZIQJA.js} +1 -1
  49. package/dist/cdn/K335IAIE.js +2 -0
  50. package/dist/cdn/K33MZ726.js +2 -0
  51. package/dist/cdn/KA3FF3ZO.js +2 -0
  52. package/dist/cdn/{DBHLKLKM.js → KPO4XX6J.js} +1 -1
  53. package/dist/cdn/{I4L45WQS.js → L7XTRDFM.js} +1 -1
  54. package/dist/cdn/LCFIADOZ.js +2 -0
  55. package/dist/cdn/MDM2K3U7.js +2 -0
  56. package/dist/cdn/MM33KJPF.js +2 -0
  57. package/dist/cdn/NIY32GK2.js +2 -0
  58. package/dist/cdn/{3ZPPYCNL.js → ONMNQBPO.js} +1 -1
  59. package/dist/cdn/ONQ6JSBJ.js +2 -0
  60. package/dist/cdn/{6QJFOL6M.js → OWTGH34K.js} +1 -1
  61. package/dist/cdn/{XPTCV6YV.js → PSYRZMX2.js} +1 -1
  62. package/dist/cdn/Q4IQUEZN.js +14 -0
  63. package/dist/cdn/QNNGPA3Q.js +2 -0
  64. package/dist/cdn/QRHZXLZN.js +2 -0
  65. package/dist/cdn/QVOMX3R6.js +2 -0
  66. package/dist/cdn/QZ3NQTNQ.js +2 -0
  67. package/dist/cdn/RADWN4ZP.js +2 -0
  68. package/dist/cdn/RU2T7GUX.js +2 -0
  69. package/dist/cdn/S6OYR4VI.js +156 -0
  70. package/dist/cdn/T2GJLEYV.js +2 -0
  71. package/dist/cdn/TKYI5QRL.js +2 -0
  72. package/dist/cdn/{5SFZS2RD.js → TQXLSW4A.js} +2 -2
  73. package/dist/cdn/{NJJYZP3R.js → U6FBRUM4.js} +1 -1
  74. package/dist/cdn/UIXX3XEN.js +2 -0
  75. package/dist/cdn/UPWAOZXQ.js +2 -0
  76. package/dist/cdn/{5SF6DEMO.js → VNJMTA6O.js} +1 -1
  77. package/dist/cdn/VOKXKU7M.js +56 -0
  78. package/dist/cdn/{33BF35AO.js → VYTYVWR6.js} +4 -4
  79. package/dist/cdn/WMZ24LWS.js +2 -0
  80. package/dist/cdn/{JYVBCHR6.js → WP7ORLSB.js} +1 -1
  81. package/dist/cdn/WS3T73IY.js +2 -0
  82. package/dist/cdn/{UZL6UVE4.js → ZLWWWTH4.js} +1 -1
  83. package/dist/cdn/{PAUIFUMO.js → ZQMBJ6MI.js} +1 -1
  84. package/dist/cdn/agent-utils/index.js +1 -1
  85. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
  86. package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
  87. package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
  88. package/dist/cdn/index.js +1 -1
  89. package/dist/chunks/adapter.js +938 -1938
  90. package/dist/chunks/adapter10.js +21 -0
  91. package/dist/chunks/adapter11.js +30 -0
  92. package/dist/chunks/adapter12.js +22 -0
  93. package/dist/chunks/adapter13.js +22 -0
  94. package/dist/chunks/adapter14.js +109 -0
  95. package/dist/chunks/adapter15.js +40 -0
  96. package/dist/chunks/adapter16.js +154 -0
  97. package/dist/chunks/adapter17.js +141 -0
  98. package/dist/chunks/adapter18.js +127 -0
  99. package/dist/chunks/adapter2.js +52 -0
  100. package/dist/chunks/adapter3.js +30 -0
  101. package/dist/chunks/adapter4.js +50 -0
  102. package/dist/chunks/adapter5.js +27 -0
  103. package/dist/chunks/adapter6.js +24 -0
  104. package/dist/chunks/adapter7.js +26 -0
  105. package/dist/chunks/adapter8.js +21 -0
  106. package/dist/chunks/adapter9.js +42 -0
  107. package/dist/chunks/arcgisKnowledgeGraph.js +5 -5
  108. package/dist/chunks/dataExplorationGraph.js +30 -27
  109. package/dist/chunks/fetchAgentContext.js +13 -0
  110. package/dist/chunks/fetchService.js +10 -0
  111. package/dist/chunks/formatFeatureAttributes.js +132 -0
  112. package/dist/chunks/generateLayerDescriptions.js +145 -148
  113. package/dist/chunks/helpGraph.js +11 -9
  114. package/dist/chunks/layerStylingGraph.js +22 -21
  115. package/dist/chunks/mergeWhereClauses.js +15 -0
  116. package/dist/chunks/navigationGraph.js +68 -57
  117. package/dist/chunks/types.js +59 -0
  118. package/dist/components/arcgis-assistant-agent/customElement.js +404 -279
  119. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +15 -5
  120. package/dist/components/arcgis-assistant-help-agent/customElement.js +21 -5
  121. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +39 -22
  122. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +22 -5
  123. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +13 -5
  124. package/dist/docs/api.json +1 -1
  125. package/dist/docs/docs.json +1 -1
  126. package/dist/docs/web-types.json +1 -1
  127. package/dist/types/stencil.d.ts +2 -2
  128. package/dist/utils/index.d.ts +4 -5
  129. package/dist/utils/index.js +19 -20
  130. package/package.json +8 -8
  131. package/dist/cdn/55M2HE4U.js +0 -2
  132. package/dist/cdn/5RZGG4F2.js +0 -2
  133. package/dist/cdn/BAB3MK4Y.js +0 -2
  134. package/dist/cdn/BMBV6Y2A.js +0 -2
  135. package/dist/cdn/D3RKQSWS.js +0 -2
  136. package/dist/cdn/E7KEOJZG.js +0 -208
  137. package/dist/cdn/IGQFAL3H.js +0 -2
  138. package/dist/cdn/LUY6V4TP.js +0 -181
  139. package/dist/cdn/NSXX2KYS.js +0 -2
  140. package/dist/cdn/OFRFP4BX.js +0 -2
  141. package/dist/cdn/OUFGJV3R.js +0 -2
  142. package/dist/cdn/RWM5T4XB.js +0 -180
  143. package/dist/cdn/SRFLL6ET.js +0 -2
  144. package/dist/cdn/WDOM6Z5O.js +0 -18
  145. package/dist/cdn/WZFC5HUX.js +0 -56
  146. package/dist/cdn/Z4XUJQ2I.js +0 -36
  147. 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 d, { z as i } from "zod";
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.2",
17
- default: "gpt-5-mini",
18
- fast: "gpt-5.4-nano"
19
- }, E = {
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
- }, I = /* @__PURE__ */ new Map();
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
- I.size === 0 && (M || (M = (async () => {
30
+ S.size === 0 && (M || (M = (async () => {
31
31
  try {
32
- (await U(`${t}/models`)).data.models.forEach((o) => I.set(o.name, o));
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 r = I.get(e);
38
- if (!r)
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 r.endpoint;
41
- }, oe = async (e = "default") => await j(P[e]), re = async (e = "default") => await j(E[e]), Le = g.Root({
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
- }), ie = (e) => {
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 ie(t) ? t : void 0;
78
- }, ce = (e, t, r) => {
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((s, o) => {
81
- (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(o.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== r ? ". Note that variables only represent file names one level deep." : ""))));
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
- }, R = 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: r, config: n } = e;
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: r
87
+ messages: o
88
88
  },
89
89
  n
90
90
  )).structuredResponse };
91
- }, me = (e) => typeof e == "string" && e.length > 0 ? e : void 0, pe = () => te(), de = (e) => typeof e != "string" || e.trim().length === 0 ? "MapsSDK" : `MapsSDK - ${e.trim()}`, ue = (e) => {
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: me(t?.thread_id),
94
+ conversationId: de(t?.thread_id),
95
95
  abortSignal: e?.signal,
96
96
  requestId: pe(),
97
- requestSource: de(ne.applicationName)
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 (s, o) => {
108
- const { conversationId: a, abortSignal: c, requestId: l, requestSource: m } = ue(e), p = new Headers(o?.headers);
109
- for (const v of [...p.keys()]) {
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-")) && p.delete(v);
111
+ (u === "authorization" || u === "api-key" || u.startsWith("x-stainless-")) && d.delete(v);
112
112
  }
113
- n && n.length > 0 && p.set("X-Esri-Authorization", `Bearer ${n}`), t.isPortal || (m && m.length > 0 && p.set("X-Esri-Request-Source", m), a && a.length > 0 && p.set("X-Esri-Conversation-Id", a), l.length > 0 && p.set("X-Esri-Request-Id", l));
114
- const y = c && o?.signal ? AbortSignal.any([c, o.signal]) : o?.signal ?? c;
115
- return (await U(s instanceof Request ? s.url : s.toString(), {
116
- body: ge(o?.body),
117
- headers: Object.fromEntries(p),
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: y
119
+ signal: b
120
120
  })).data;
121
121
  };
122
- }, b = async (e = {}) => {
123
- const { modelTier: t = "default", temperature: r = 0, config: n } = e, s = P[t], o = await oe(t);
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: s,
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: o,
131
- fetch: await _({ config: n })
128
+ baseURL: i,
129
+ fetch: await _({ config: o })
132
130
  }
133
131
  });
134
132
  }, ze = async (e = {}) => {
135
- const { tier: t = "default", config: r } = e, n = E[t], s = await re(t);
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: s,
141
- fetch: await _({ config: r })
138
+ baseURL: i,
139
+ fetch: await _({ config: o })
142
140
  },
143
141
  batchSize: 2048,
144
142
  maxConcurrency: 10
145
143
  });
146
- }, fe = i.object({
147
- id: i.string().min(1),
148
- name: i.string().min(1),
149
- description: i.string().min(1)
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
- i.array(fe);
149
+ r.array(fe);
152
150
  const A = (e) => JSON.stringify(e, null, 2), he = (e) => {
153
- const t = e.map((n) => n.id), r = i.enum(t);
154
- return i.object({
155
- intent: r.nullable(),
156
- assignedTask: i.string().nullable(),
157
- requiresFollowUp: i.boolean()
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 r = ae(t);
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 s = r.services.agentRegistry?.list() ?? [], o = s.map(({ agent: f }) => ({
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 (!o.length)
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 R("intent_prompt"), c = A(o), l = he(o), m = {
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
- }, y = await q.fromTemplate(a).format(m), S = G({
186
- model: await b({
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: y,
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 b({
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: S,
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: ${s.map(({ agent: L }) => L.name).join(", ")}.
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", w = 1536, we = "openai", be = E.default, ve = `Name: {name}
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 = i.object({
265
- schemaVersion: i.literal(ye),
266
- modified: i.number().int().nonnegative(),
267
- embeddings: i.object({
268
- modelProvider: i.literal(we),
269
- model: i.literal(be),
270
- dimensions: i.literal(w),
271
- templates: i.object({
272
- layer: i.string().default(ve),
273
- field: i.string().default(xe)
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: i.array(
277
- i.object({
278
- id: i.string().min(1),
279
- name: i.string().min(1),
280
- title: i.string().catch(""),
281
- description: i.string().catch(""),
282
- vector: i.array(i.number()).length(w, {
283
- message: `Layer vector must be exactly ${w} dimensions`
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: i.array(
286
- i.object({
287
- name: i.string().min(1),
288
- alias: i.string().catch(""),
289
- description: i.string().catch(""),
290
- vector: i.array(i.number()).length(w, {
291
- message: `Field vector must be exactly ${w} dimensions`
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 s = n;
302
- s.tool_calls && s.tool_calls.length > 0 && s.tool_calls.forEach((o) => {
303
- o.id && t.add(o.id);
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 s = n;
309
- return t.has(s.tool_call_id);
306
+ const i = n;
307
+ return t.has(i.tool_call_id);
310
308
  }
311
309
  return !0;
312
310
  });
313
- }, C = (e, t) => {
314
- const r = B.fromTemplate(e);
315
- return q.fromMessages([r, ...t]);
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: r, temperature: n, messages: s, config: o } = e, a = C(t, s ?? []), c = await b({ modelTier: r, temperature: n, config: o });
318
- return a.pipe(c);
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: r = "default", temperature: n = 0, messages: s, inputVariables: o, config: a } = e, l = await (await Me({
318
+ const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, config: s } = e, c = await (await Me({
321
319
  promptText: t,
322
- modelTier: r,
323
- temperature: n,
324
- messages: s,
325
- config: a
326
- })).invoke(o ?? {}, a);
327
- if (typeof l == "string")
328
- return l;
329
- const m = l.content;
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: r = "default", temperature: n = 0, messages: s, inputVariables: o, schema: a, config: c } = e, l = C(t, s ?? []), p = (await b({ modelTier: r, temperature: n, config: c })).withStructuredOutput(a);
333
- return await l.pipe(p).invoke(o ?? {}, c);
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: r = "default", temperature: n = 0, messages: s, inputVariables: o, tools: a, config: c } = e, l = a.length > 0 ? Te(s ?? []) : s ?? [], m = C(t, l), p = await b({ modelTier: r, temperature: n, config: c });
336
- return await m.pipe(p.bindTools(a)).invoke(o ?? {}, c);
337
- }, Se = d.object({
338
- name: d.string(),
339
- description: d.string(),
340
- valueType: d.string(),
341
- alias: d.string()
342
- }), Ie = d.object({
343
- fields: d.array(Se)
344
- }), $ = (e, t) => e.getFieldAlias(t) ?? void 0, k = (e, t) => $(e, t.name) ?? t.alias ?? "", ke = (e, t) => {
345
- const r = $(e, t.name);
346
- return !!(r && r !== (t.alias ?? ""));
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 r = /* @__PURE__ */ new Map();
346
+ const o = /* @__PURE__ */ new Map();
350
347
  for (const n of e.fields) {
351
- const s = t.fields.find((l) => l.name === n.name), o = k(e, n), a = ke(e, n), c = {
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 ? o : s?.alias ?? o,
355
- description: s?.description ?? n.description ?? "",
356
- valueType: s?.valueType ?? n.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
- r.set(n.name, c);
356
+ o.set(n.name, c);
360
357
  }
361
- return r;
358
+ return o;
362
359
  }
363
360
  const We = async (e) => {
364
- const r = await R("field_descriptions_prompt"), n = e.fields.filter((a) => !(k(e, a) && a.description)).map((a) => {
365
- const { name: c, type: l, description: m } = a, p = k(e, a);
366
- return [`Name: ${c}`, `Type: ${l}`, `Alias: ${p}`, `Description: ${m ?? "N/A"}`].join(", ");
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 s = {
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
- }, o = await O({
378
- promptText: r,
374
+ }, s = await O({
375
+ promptText: o,
379
376
  schema: Ie,
380
- inputVariables: s
377
+ inputVariables: i
381
378
  });
382
- return D(e, o);
383
- }, Ee = d.object({
384
- title: d.string(),
385
- description: d.string(),
386
- name: d.string().nullable()
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 R("layer_descriptions_prompt"), s = Array.from(t.values()), o = {
389
- fieldInformation: JSON.stringify(s, null, 2),
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: o
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
- b as c,
407
- w as d,
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
- re as j,
410
+ ie as j,
414
411
  ae as k,
415
412
  ve as l,
416
413
  be as m,