@arcgis/ai-components 5.2.0-next.120 → 5.2.0-next.121

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 (133) hide show
  1. package/dist/agent-utils/LLMAgent.js +2 -0
  2. package/dist/agents/runtime/skill/createSkillAgent.js +115 -131
  3. package/dist/cdn/2DYOTV7W.js +4 -0
  4. package/dist/cdn/2WT4JANT.js +2 -0
  5. package/dist/cdn/{2NODROJN.js → 3F5EZZSG.js} +20 -24
  6. package/dist/cdn/4V3Q7XGS.js +2 -0
  7. package/dist/cdn/5GALSAQF.js +3 -0
  8. package/dist/cdn/72KYGCIU.js +2 -0
  9. package/dist/cdn/75OPJOCY.js +2 -0
  10. package/dist/cdn/7D6POJJA.js +2 -0
  11. package/dist/cdn/{SLR75R32.js → 7HVK7G55.js} +1 -1
  12. package/dist/cdn/7L6LPWRH.js +2 -0
  13. package/dist/cdn/7TAIUEMW.js +2 -0
  14. package/dist/cdn/{C2W6MBDB.js → D3E5NSY3.js} +1 -1
  15. package/dist/cdn/ESPC6NTI.js +68 -0
  16. package/dist/cdn/{HTB76P2C.js → EWO73MJA.js} +1 -1
  17. package/dist/cdn/{EIZR3Q5O.js → FGQLS3UX.js} +1 -1
  18. package/dist/cdn/FOZAOJCM.js +2 -0
  19. package/dist/cdn/GZDI2LAT.js +2 -0
  20. package/dist/cdn/H4ERKWFA.js +2 -0
  21. package/dist/cdn/{7W7KWR5O.js → H5AVPDSE.js} +4 -4
  22. package/dist/cdn/{2I2FHPHR.js → HDAMDEYL.js} +6 -6
  23. package/dist/cdn/JE55XX2C.js +2 -0
  24. package/dist/cdn/K36XPG2M.js +2 -0
  25. package/dist/cdn/KDE5MMMR.js +2 -0
  26. package/dist/cdn/{ZGZX7GR5.js → KONQTXBJ.js} +1 -1
  27. package/dist/cdn/{J4YHT55S.js → MCZJD3A4.js} +1 -1
  28. package/dist/cdn/MNZAQM3Q.js +3 -0
  29. package/dist/cdn/NHZRDYLP.js +2 -0
  30. package/dist/cdn/NYFV4A6L.js +3 -0
  31. package/dist/cdn/OGYNTGNM.js +2 -0
  32. package/dist/cdn/PGIXKPTW.js +2 -0
  33. package/dist/cdn/PTEKX5TX.js +2 -0
  34. package/dist/cdn/PUHPFUCU.js +2 -0
  35. package/dist/cdn/{GKWMAWFZ.js → QDOKDRBB.js} +1 -1
  36. package/dist/cdn/TGZBLBEJ.js +2 -0
  37. package/dist/cdn/{K7BUBCK7.js → UBKYXKMW.js} +1 -1
  38. package/dist/cdn/UXECAKJ7.js +2 -0
  39. package/dist/cdn/WXOKGQ4D.js +2 -0
  40. package/dist/cdn/Y364LLPN.js +2 -0
  41. package/dist/cdn/YBSY32EU.js +2 -0
  42. package/dist/cdn/{CF2V3NER.js → ZLLVPKDN.js} +35 -35
  43. package/dist/cdn/agent-utils/index.js +1 -1
  44. package/dist/cdn/assets/agents/t9n/messages.ar.json +1 -0
  45. package/dist/cdn/assets/agents/t9n/messages.bg.json +1 -0
  46. package/dist/cdn/assets/agents/t9n/messages.ca.json +1 -0
  47. package/dist/cdn/assets/agents/t9n/messages.cs.json +1 -0
  48. package/dist/cdn/assets/agents/t9n/messages.da.json +1 -0
  49. package/dist/cdn/assets/agents/t9n/messages.de.json +1 -0
  50. package/dist/cdn/assets/agents/t9n/messages.el.json +1 -0
  51. package/dist/cdn/assets/agents/t9n/messages.es.json +1 -0
  52. package/dist/cdn/assets/agents/t9n/messages.et.json +1 -0
  53. package/dist/cdn/assets/agents/t9n/messages.fi.json +1 -0
  54. package/dist/cdn/assets/agents/t9n/messages.fr.json +1 -0
  55. package/dist/cdn/assets/agents/t9n/messages.he.json +1 -0
  56. package/dist/cdn/assets/agents/t9n/messages.hr.json +1 -0
  57. package/dist/cdn/assets/agents/t9n/messages.hu.json +1 -0
  58. package/dist/cdn/assets/agents/t9n/messages.id.json +1 -0
  59. package/dist/cdn/assets/agents/t9n/messages.it.json +1 -0
  60. package/dist/cdn/assets/agents/t9n/messages.ja.json +1 -0
  61. package/dist/cdn/assets/agents/t9n/messages.ko.json +1 -0
  62. package/dist/cdn/assets/agents/t9n/messages.lt.json +1 -0
  63. package/dist/cdn/assets/agents/t9n/messages.lv.json +1 -0
  64. package/dist/cdn/assets/agents/t9n/messages.nl.json +1 -0
  65. package/dist/cdn/assets/agents/t9n/messages.no.json +1 -0
  66. package/dist/cdn/assets/agents/t9n/messages.pl.json +1 -0
  67. package/dist/cdn/assets/agents/t9n/messages.pt-BR.json +1 -0
  68. package/dist/cdn/assets/agents/t9n/messages.pt-PT.json +1 -0
  69. package/dist/cdn/assets/agents/t9n/messages.ro.json +1 -0
  70. package/dist/cdn/assets/agents/t9n/messages.ru.json +1 -0
  71. package/dist/cdn/assets/agents/t9n/messages.sk.json +1 -0
  72. package/dist/cdn/assets/agents/t9n/messages.sl.json +1 -0
  73. package/dist/cdn/assets/agents/t9n/messages.sr.json +1 -0
  74. package/dist/cdn/assets/agents/t9n/messages.sv.json +1 -0
  75. package/dist/cdn/assets/agents/t9n/messages.th.json +1 -0
  76. package/dist/cdn/assets/agents/t9n/messages.tr.json +1 -0
  77. package/dist/cdn/assets/agents/t9n/messages.uk.json +1 -0
  78. package/dist/cdn/assets/agents/t9n/messages.vi.json +1 -0
  79. package/dist/cdn/assets/agents/t9n/messages.zh-CN.json +1 -0
  80. package/dist/cdn/assets/agents/t9n/messages.zh-TW.json +1 -0
  81. package/dist/cdn/assets/orchestrator/t9n/messages.en.json +1 -0
  82. package/dist/cdn/index.js +1 -1
  83. package/dist/chunks/adapter.js +54 -52
  84. package/dist/chunks/aiFactory.js +59 -41
  85. package/dist/chunks/arcgisKnowledgeGraph.js +4 -2
  86. package/dist/chunks/dataExplorationAgent.js +1 -1
  87. package/dist/chunks/generateLayerDescriptions.js +160 -156
  88. package/dist/chunks/layerStylingGraph.js +2 -0
  89. package/dist/chunks/orchestrator.js +325 -295
  90. package/dist/components/arcgis-assistant/customElement.d.ts +1 -1
  91. package/dist/components/arcgis-assistant/customElement.js +113 -112
  92. package/dist/components/arcgis-assistant-agent/customElement.js +1 -0
  93. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -0
  94. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
  95. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +5 -4
  96. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
  97. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
  98. package/dist/docs/api.json +1 -1
  99. package/dist/docs/docs.json +1 -1
  100. package/dist/docs/vscode.html-custom-data.json +1 -1
  101. package/dist/docs/web-types.json +1 -1
  102. package/dist/utils/index.js +38 -36
  103. package/package.json +7 -7
  104. package/dist/cdn/5BBXNT75.js +0 -66
  105. package/dist/cdn/5HBAJ57P.js +0 -2
  106. package/dist/cdn/5MK44FNO.js +0 -2
  107. package/dist/cdn/6ECRQVHY.js +0 -2
  108. package/dist/cdn/AUDVUNF3.js +0 -2
  109. package/dist/cdn/BJUX4AYP.js +0 -2
  110. package/dist/cdn/COH3QXWG.js +0 -4
  111. package/dist/cdn/CPQGLQGY.js +0 -2
  112. package/dist/cdn/CT2ZOYNX.js +0 -2
  113. package/dist/cdn/DNV3L5M6.js +0 -2
  114. package/dist/cdn/EDVH3G5A.js +0 -2
  115. package/dist/cdn/HWGAJ4WN.js +0 -2
  116. package/dist/cdn/IHRX74QJ.js +0 -2
  117. package/dist/cdn/LRH2ZPVW.js +0 -2
  118. package/dist/cdn/OTOQL3QM.js +0 -3
  119. package/dist/cdn/R74ZHFA6.js +0 -2
  120. package/dist/cdn/RGVC76RW.js +0 -2
  121. package/dist/cdn/RIN3RP7D.js +0 -3
  122. package/dist/cdn/SWVRA77H.js +0 -2
  123. package/dist/cdn/TLQ75QXG.js +0 -2
  124. package/dist/cdn/TPF5Z277.js +0 -3
  125. package/dist/cdn/UIIVUHXL.js +0 -2
  126. package/dist/cdn/UWZQWGZP.js +0 -2
  127. package/dist/cdn/UXYYH6XF.js +0 -2
  128. package/dist/cdn/XUYARLRP.js +0 -2
  129. package/dist/cdn/XV3DHHYJ.js +0 -2
  130. package/dist/cdn/Y2BCEVV6.js +0 -2
  131. package/dist/cdn/YJ4MZOVC.js +0 -2
  132. package/dist/cdn/YXIPCGGP.js +0 -2
  133. package/dist/cdn/YYFKFPSN.js +0 -2
@@ -1,115 +1,118 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { Annotation as p } from "@langchain/langgraph/web";
3
- import { b as j, r as T, m as P, c as q } from "./baseAgentState.js";
2
+ import { Annotation as d } from "@langchain/langgraph/web";
3
+ import { b as P, r as w, m as q, c as N } from "./baseAgentState.js";
4
4
  import l, { z as s } from "zod";
5
- import { ChatPromptTemplate as S, SystemMessagePromptTemplate as N } from "@langchain/core/prompts";
5
+ import { ChatPromptTemplate as I, SystemMessagePromptTemplate as O } from "@langchain/core/prompts";
6
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 y, E as W } from "./aiFactory.js";
10
- const he = p.Root({
11
- agentExecutionContext: p({
12
- default: q,
13
- reducer: P
7
+ import { AIMessage as U, isAIMessage as V, isToolMessage as $ } from "@langchain/core/messages";
8
+ import { createAgent as z, summarizationMiddleware as W, modelCallLimitMiddleware as B } from "langchain";
9
+ import { g as G, a as H, c as T, E as J } from "./aiFactory.js";
10
+ const xe = d.Root({
11
+ agentExecutionContext: d({
12
+ default: N,
13
+ reducer: q
14
14
  }),
15
- currentIntent: p({
15
+ currentIntent: d({
16
16
  default: () => "none",
17
- reducer: T
17
+ reducer: w
18
18
  }),
19
- routing: p({
19
+ routing: d({
20
20
  default: () => ({ mode: "auto" }),
21
- reducer: T
21
+ reducer: w
22
22
  }),
23
- lastExecutedAgent: p({
23
+ lastExecutedAgent: d({
24
24
  default: () => "",
25
- reducer: T
25
+ reducer: w
26
26
  }),
27
- requiresFollowUp: p({
27
+ requiresFollowUp: d({
28
28
  default: () => !0,
29
- reducer: T
29
+ reducer: w
30
30
  }),
31
- stepCount: p({
31
+ stepCount: d({
32
32
  default: () => 0,
33
33
  reducer: (e, t) => t ?? e + 1
34
34
  }),
35
- finalOutputMessage: p({
35
+ finalOutputMessage: d({
36
36
  default: () => "",
37
- reducer: j
37
+ reducer: P
38
38
  })
39
- }), B = (e) => {
39
+ }), L = (e) => {
40
40
  if (!e || typeof e != "object" || !("services" in e))
41
41
  return !1;
42
42
  const t = e.services;
43
43
  return !!t && typeof t == "object" && "agentRegistry" in t;
44
- }, G = (e) => {
44
+ }, K = (e) => {
45
45
  const t = e?.configurable;
46
- return B(t) ? t : void 0;
47
- }, H = (e, t, i) => {
46
+ return L(t) ? t : void 0;
47
+ }, Q = (e, t, o) => {
48
48
  const n = e[t];
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." : ""))));
49
+ return n ? typeof n == "function" ? n() : Promise.resolve(n) : new Promise((i, r) => {
50
+ (typeof queueMicrotask == "function" ? queueMicrotask : setTimeout)(r.bind(null, /* @__PURE__ */ new Error("Unknown variable dynamic import: " + t + (t.split("/").length !== o ? ". Note that variables only represent file names one level deep." : ""))));
51
51
  });
52
- }, v = async (e) => (await H(/* @__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, J = async (e) => {
53
- const { agent: t, messages: i, config: n } = e;
52
+ }, M = async (e) => (await Q(/* @__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, X = async (e) => {
53
+ const { agent: t, messages: o, config: n } = e;
54
54
  return { structuredResponse: (await t.invoke(
55
55
  {
56
- messages: i
56
+ messages: o
57
57
  },
58
58
  n
59
59
  )).structuredResponse };
60
- }, K = s.object({
60
+ }, Y = s.object({
61
61
  id: s.string().min(1),
62
62
  name: s.string().min(1),
63
63
  description: s.string().min(1)
64
64
  });
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);
65
+ s.array(Y);
66
+ const k = (e) => JSON.stringify(e, null, 2), Z = (e) => {
67
+ const t = e.map((n) => n.id), o = s.enum(t);
68
68
  return s.object({
69
- intent: i.nullable(),
69
+ intent: o.nullable(),
70
70
  assignedTask: s.string().nullable(),
71
71
  requiresFollowUp: s.boolean()
72
72
  });
73
- }, ye = async (e, t) => {
74
- const i = G(t);
73
+ }, we = async (e, t) => {
74
+ const o = K(t), n = await G({
75
+ path: "./assets/orchestrator/t9n",
76
+ locale: H(t)
77
+ });
75
78
  if (t?.signal?.aborted)
76
- return await g({ text: "Run cancelled; skipping intent routing" }, t), {
79
+ return await g({ text: n.runCancelled }, t), {
77
80
  ...e,
78
81
  currentIntent: "none",
79
- finalOutputMessage: "Operation cancelled.",
82
+ finalOutputMessage: n.runCancelled,
80
83
  requiresFollowUp: !1
81
84
  };
82
85
  try {
83
- await g({ text: "Asking LLM to route to an agent" }, t);
84
- const r = i.services.agentRegistry?.list() ?? [], o = r.map(({ agent: u }) => ({
86
+ await g({ text: n.routingToAgent }, t);
87
+ const r = o.services.agentRegistry?.list() ?? [], a = r.map(({ agent: u }) => ({
85
88
  id: u.id,
86
89
  name: u.name,
87
90
  description: u.description
88
91
  }));
89
- if (!o.length)
90
- return await g({ text: "No agents registered; skipping intent detection" }, t), {
92
+ if (!a.length)
93
+ return await g({ text: n.noAgentsRegisteredTrace }, t), {
91
94
  ...e,
92
95
  currentIntent: "none",
93
- finalOutputMessage: "No agents registered; skipping intent detection."
96
+ finalOutputMessage: n.noAgentsRegisteredMessage
94
97
  };
95
- const a = await v("intent_prompt"), c = I(o), m = Q(o), d = {
96
- registeredAgents: c,
97
- priorSteps: I(e.agentExecutionContext.priorSteps),
98
+ const c = await M("intent_prompt"), m = k(a), p = Z(a), f = {
99
+ registeredAgents: m,
100
+ priorSteps: k(e.agentExecutionContext.priorSteps),
98
101
  userRequest: e.agentExecutionContext.userRequest
99
- }, k = await S.fromTemplate(a).format(d), D = V({
100
- model: await y({
102
+ }, E = await I.fromTemplate(c).format(f), F = z({
103
+ model: await T({
101
104
  modelTier: "fast",
102
105
  config: t
103
106
  }),
104
107
  tools: [],
105
- systemPrompt: k,
106
- responseFormat: m,
108
+ systemPrompt: E,
109
+ responseFormat: p,
107
110
  middleware: [
108
111
  // Preserve recent conversation context while summarizing older messages
109
112
  // to control token usage without losing important intent signals.
110
113
  // The trigger and keep parameters can be tuned based on token limits and behavior.
111
- L({
112
- model: await y({
114
+ W({
115
+ model: await T({
113
116
  modelTier: "fast",
114
117
  config: t
115
118
  }),
@@ -118,28 +121,29 @@ const I = (e) => JSON.stringify(e, null, 2), Q = (e) => {
118
121
  }),
119
122
  // Enforce no loop/retry.
120
123
  // 1 usual LLM call and 1 optional summarization call.
121
- z({ runLimit: 2 })
124
+ B({ runLimit: 2 })
122
125
  ]
123
- }), { structuredResponse: R } = await J({
124
- agent: D,
126
+ }), { structuredResponse: R } = await X({
127
+ agent: F,
125
128
  messages: e.agentExecutionContext.messages,
126
129
  config: t
127
- }), f = m.parse(
130
+ }), h = p.parse(
128
131
  R ?? { intent: null, assignedTask: null, requiresFollowUp: !1 }
129
- ), x = f.intent ?? "none", F = {
132
+ ), x = h.intent ?? "none", _ = {
130
133
  ...e,
131
134
  currentIntent: x,
132
- requiresFollowUp: f.requiresFollowUp,
135
+ requiresFollowUp: h.requiresFollowUp,
133
136
  agentExecutionContext: {
134
137
  ...e.agentExecutionContext,
135
- assignedTask: f.assignedTask ?? ""
138
+ assignedTask: h.assignedTask ?? ""
136
139
  }
137
140
  };
138
141
  if (x === "none") {
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(", ")}.
140
-
141
- Please ask a question that can be answered by one of these agents.`;
142
- return await g({ text: "LLM did not identify a clear intent." }, t), {
142
+ const u = n.noMatchingAgentMessage.replace(
143
+ "{agentNames}",
144
+ r.map(({ agent: j }) => j.name).join(", ")
145
+ );
146
+ return await g({ text: n.noMatchingAgentTrace }, t), {
143
147
  ...e,
144
148
  currentIntent: x,
145
149
  requiresFollowUp: !1,
@@ -147,7 +151,7 @@ Please ask a question that can be answered by one of these agents.`;
147
151
  agentExecutionContext: {
148
152
  ...e.agentExecutionContext,
149
153
  assignedTask: "",
150
- messages: [...e.agentExecutionContext.messages, new O(u)],
154
+ messages: [...e.agentExecutionContext.messages, new U(u)],
151
155
  priorSteps: [
152
156
  ...e.agentExecutionContext.priorSteps ?? [],
153
157
  {
@@ -162,29 +166,29 @@ Please ask a question that can be answered by one of these agents.`;
162
166
  }
163
167
  return await g(
164
168
  {
165
- text: `Agent picked: ${x}
166
- Task Assigned: ${f.assignedTask ?? ""}
167
- Requires Follow-Up: ${f.requiresFollowUp}`
169
+ text: n.agentPicked.replace("{intent}", x).replace("{assignedTask}", h.assignedTask ?? "").replace("{requiresFollowUp}", String(h.requiresFollowUp))
168
170
  },
169
171
  t
170
- ), F;
171
- } catch (n) {
172
- throw await g({ text: "Error during intent detection" }, t), new Error(`Error during intent detection: ${n instanceof Error ? n.message : String(n)}`);
172
+ ), _;
173
+ } catch (i) {
174
+ throw await g({ text: n.intentDetectionErrorTrace }, t), new Error(
175
+ n.intentDetectionError.replace("{error}", i instanceof Error ? i.message : String(i))
176
+ );
173
177
  }
174
- }, X = "0.1", h = 1536, Y = "openai", Z = W.default, ee = `Name: {name}
178
+ }, ee = "0.1", y = 1536, te = "openai", ne = J.default, se = `Name: {name}
175
179
  Title: {title}
176
- Description: {description}`, te = `Name: {name}
180
+ Description: {description}`, ie = `Name: {name}
177
181
  Alias: {alias}
178
- Description: {description}`, we = s.object({
179
- schemaVersion: s.literal(X),
182
+ Description: {description}`, be = s.object({
183
+ schemaVersion: s.literal(ee),
180
184
  modified: s.number().int().nonnegative(),
181
185
  embeddings: s.object({
182
- modelProvider: s.literal(Y),
183
- model: s.literal(Z),
184
- dimensions: s.literal(h),
186
+ modelProvider: s.literal(te),
187
+ model: s.literal(ne),
188
+ dimensions: s.literal(y),
185
189
  templates: s.object({
186
- layer: s.string().default(ee),
187
- field: s.string().default(te)
190
+ layer: s.string().default(se),
191
+ field: s.string().default(ie)
188
192
  })
189
193
  }),
190
194
  layers: s.array(
@@ -193,135 +197,135 @@ Description: {description}`, we = s.object({
193
197
  name: s.string().min(1),
194
198
  title: s.string().catch(""),
195
199
  description: s.string().catch(""),
196
- vector: s.array(s.number()).length(h, {
197
- message: `Layer vector must be exactly ${h} dimensions`
200
+ vector: s.array(s.number()).length(y, {
201
+ message: `Layer vector must be exactly ${y} dimensions`
198
202
  }),
199
203
  fields: s.array(
200
204
  s.object({
201
205
  name: s.string().min(1),
202
206
  alias: s.string().catch(""),
203
207
  description: s.string().catch(""),
204
- vector: s.array(s.number()).length(h, {
205
- message: `Field vector must be exactly ${h} dimensions`
208
+ vector: s.array(s.number()).length(y, {
209
+ message: `Field vector must be exactly ${y} dimensions`
206
210
  })
207
211
  })
208
212
  )
209
213
  })
210
214
  ).default([])
211
- }), ne = (e) => {
215
+ }), oe = (e) => {
212
216
  const t = /* @__PURE__ */ new Set();
213
217
  for (const n of e)
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);
218
+ if (V(n)) {
219
+ const i = n;
220
+ i.tool_calls && i.tool_calls.length > 0 && i.tool_calls.forEach((r) => {
221
+ r.id && t.add(r.id);
218
222
  });
219
223
  }
220
224
  return e.filter((n) => {
221
- if (U(n)) {
222
- const r = n;
223
- return t.has(r.tool_call_id);
225
+ if ($(n)) {
226
+ const i = n;
227
+ return t.has(i.tool_call_id);
224
228
  }
225
229
  return !0;
226
230
  });
227
- }, M = (e, t) => {
228
- const i = N.fromTemplate(e);
229
- return S.fromMessages([i, ...t]);
230
- }, se = async (e) => {
231
- const { promptText: t, modelTier: i, messages: n, config: r } = e, o = M(t, n ?? []), a = await y({ 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({
231
+ }, v = (e, t) => {
232
+ const o = O.fromTemplate(e);
233
+ return I.fromMessages([o, ...t]);
234
+ }, re = async (e) => {
235
+ const { promptText: t, modelTier: o, messages: n, config: i } = e, r = v(t, n ?? []), a = await T({ modelTier: o, config: i });
236
+ return r.pipe(a);
237
+ }, Me = async (e) => {
238
+ const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, config: r } = e, c = await (await re({
235
239
  promptText: t,
236
- modelTier: i,
240
+ modelTier: o,
237
241
  messages: n,
238
- config: o
239
- })).invoke(r ?? {}, o);
242
+ config: r
243
+ })).invoke(i ?? {}, r);
240
244
  return typeof c == "string" ? c : c.text;
241
- }, A = async (e) => {
242
- const { promptText: t, modelTier: i = "default", messages: n, inputVariables: r, schema: o, config: a } = e, c = M(t, n ?? []), d = (await y({ modelTier: i, config: a })).withStructuredOutput(o);
243
- return await c.pipe(d).invoke(r ?? {}, a);
244
- }, Te = async (e) => {
245
- const { promptText: t, modelTier: i = "default", messages: n, inputVariables: r, tools: o, config: a } = e, c = o.length > 0 ? ne(n ?? []) : n ?? [], m = M(t, c), d = await y({ modelTier: i, config: a });
246
- return await m.pipe(d.bindTools(o)).invoke(r ?? {}, a);
247
- }, ie = l.object({
245
+ }, S = async (e) => {
246
+ const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, schema: r, config: a } = e, c = v(t, n ?? []), p = (await T({ modelTier: o, config: a })).withStructuredOutput(r);
247
+ return await c.pipe(p).invoke(i ?? {}, a);
248
+ }, ve = async (e) => {
249
+ const { promptText: t, modelTier: o = "default", messages: n, inputVariables: i, tools: r, config: a } = e, c = r.length > 0 ? oe(n ?? []) : n ?? [], m = v(t, c), p = await T({ modelTier: o, config: a });
250
+ return await m.pipe(p.bindTools(r)).invoke(i ?? {}, a);
251
+ }, ae = l.object({
248
252
  name: l.string(),
249
253
  description: l.string(),
250
254
  valueType: l.string(),
251
255
  alias: l.string()
252
- }), oe = l.object({
253
- fields: l.array(ie)
254
- }), C = (e, t) => e.getFieldAlias(t) ?? void 0, b = (e, t) => C(e, t.name) ?? t.alias ?? "", re = (e, t) => {
255
- const i = C(e, t.name);
256
- return !!(i && i !== (t.alias ?? ""));
256
+ }), ce = l.object({
257
+ fields: l.array(ae)
258
+ }), A = (e, t) => e.getFieldAlias(t) ?? void 0, b = (e, t) => A(e, t.name) ?? t.alias ?? "", le = (e, t) => {
259
+ const o = A(e, t.name);
260
+ return !!(o && o !== (t.alias ?? ""));
257
261
  };
258
- function E(e, t) {
259
- const i = /* @__PURE__ */ new Map();
262
+ function C(e, t) {
263
+ const o = /* @__PURE__ */ new Map();
260
264
  for (const n of e.fields) {
261
- const r = t.fields.find((m) => m.name === n.name), o = b(e, n), a = re(e, n), c = {
265
+ const i = t.fields.find((m) => m.name === n.name), r = b(e, n), a = le(e, n), c = {
262
266
  name: n.name,
263
267
  type: n.type,
264
- alias: a ? o : r?.alias ?? o,
265
- description: r?.description ?? n.description ?? "",
266
- valueType: r?.valueType ?? n.valueType ?? "",
268
+ alias: a ? r : i?.alias ?? r,
269
+ description: i?.description ?? n.description ?? "",
270
+ valueType: i?.valueType ?? n.valueType ?? "",
267
271
  domain: e.getFieldDomain(n.name) ?? void 0
268
272
  };
269
- i.set(n.name, c);
273
+ o.set(n.name, c);
270
274
  }
271
- return i;
275
+ return o;
272
276
  }
273
- const be = async (e) => {
274
- const i = await v("field_descriptions_prompt"), n = e.fields.filter((a) => !(b(e, a) && a.description)).map((a) => {
275
- const { name: c, type: m, description: d } = a, w = b(e, a);
276
- return [`Name: ${c}`, `Type: ${m}`, `Alias: ${w}`, `Description: ${d ?? "N/A"}`].join(", ");
277
+ const ke = async (e) => {
278
+ const o = await M("field_descriptions_prompt"), n = e.fields.filter((a) => !(b(e, a) && a.description)).map((a) => {
279
+ const { name: c, type: m, description: p } = a, f = b(e, a);
280
+ return [`Name: ${c}`, `Type: ${m}`, `Alias: ${f}`, `Description: ${p ?? "N/A"}`].join(", ");
277
281
  }).join(`
278
282
  `);
279
283
  if (n.length === 0)
280
- return E(e, { fields: [] });
281
- const r = {
284
+ return C(e, { fields: [] });
285
+ const i = {
282
286
  existingItemTitle: e.portalItem?.title,
283
287
  existingItemDescription: e.portalItem?.description,
284
288
  existingLayerTitle: e.title,
285
289
  existingLayerDescription: e.portalItem?.description,
286
290
  fieldInformation: n
287
- }, o = await A({
288
- promptText: i,
289
- schema: oe,
290
- inputVariables: r
291
+ }, r = await S({
292
+ promptText: o,
293
+ schema: ce,
294
+ inputVariables: i
291
295
  });
292
- return E(e, o);
293
- }, ae = l.object({
296
+ return C(e, r);
297
+ }, me = l.object({
294
298
  title: l.string(),
295
299
  description: l.string(),
296
300
  name: l.string().nullable()
297
- }), ve = async (e, t) => {
298
- const n = await v("layer_descriptions_prompt"), r = Array.from(t.values()), o = {
299
- fieldInformation: JSON.stringify(r, null, 2),
301
+ }), Ce = async (e, t) => {
302
+ const n = await M("layer_descriptions_prompt"), i = Array.from(t.values()), r = {
303
+ fieldInformation: JSON.stringify(i, null, 2),
300
304
  existingLayerTitle: e.title,
301
305
  existingLayerDescription: e.portalItem?.description,
302
306
  existingLayerSnippet: e.portalItem?.snippet,
303
307
  layerGeometryType: e.geometryType
304
308
  };
305
- return { ...await A({
309
+ return { ...await S({
306
310
  promptText: n,
307
- schema: ae,
308
- inputVariables: o
311
+ schema: me,
312
+ inputVariables: r
309
313
  }), name: e.title ?? null };
310
314
  };
311
315
  export {
312
- he as D,
313
- we as W,
314
- xe as a,
315
- ye as b,
316
- be as c,
317
- ve as d,
318
- h as e,
319
- te as f,
320
- G as g,
321
- Y as h,
322
- Te as i,
323
- A as j,
324
- ee as l,
325
- Z as m,
326
- X as s
316
+ xe as D,
317
+ be as W,
318
+ Me as a,
319
+ we as b,
320
+ ke as c,
321
+ Ce as d,
322
+ y as e,
323
+ ie as f,
324
+ K as g,
325
+ te as h,
326
+ ve as i,
327
+ S as j,
328
+ se as l,
329
+ ne as m,
330
+ ee as s
327
331
  };
@@ -7,6 +7,8 @@ import "@arcgis/toolkit/string";
7
7
  import { i as v } from "./generateLayerDescriptions.js";
8
8
  import "@langchain/core/messages";
9
9
  import { s } from "./index.js";
10
+ import "@arcgis/toolkit/intl";
11
+ import "./runtime.js";
10
12
  import "@langchain/core/callbacks/base";
11
13
  import "@langchain/openai";
12
14
  import "@arcgis/core/config.js";