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

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 (96) hide show
  1. package/dist/agents/runtime/skill/createSkillAgent.js +154 -123
  2. package/dist/cdn/{DWSVGHL4.js → 2I2FHPHR.js} +1 -1
  3. package/dist/cdn/{TVCMA2R2.js → 7W7KWR5O.js} +1 -1
  4. package/dist/cdn/AUDVUNF3.js +2 -0
  5. package/dist/cdn/BJUX4AYP.js +2 -0
  6. package/dist/cdn/{CWE6OD3H.js → C2W6MBDB.js} +1 -1
  7. package/dist/cdn/CF2V3NER.js +177 -0
  8. package/dist/cdn/CPQGLQGY.js +2 -0
  9. package/dist/cdn/CT2ZOYNX.js +2 -0
  10. package/dist/cdn/DNV3L5M6.js +2 -0
  11. package/dist/cdn/EDVH3G5A.js +2 -0
  12. package/dist/cdn/EIZR3Q5O.js +2 -0
  13. package/dist/cdn/{DXRFD4N3.js → GKWMAWFZ.js} +1 -1
  14. package/dist/cdn/{MNEK6V2R.js → HTB76P2C.js} +1 -1
  15. package/dist/cdn/HWGAJ4WN.js +2 -0
  16. package/dist/cdn/IHRX74QJ.js +2 -0
  17. package/dist/cdn/{JTKVVKZK.js → J4YHT55S.js} +1 -1
  18. package/dist/cdn/{C7P6MHMZ.js → K7BUBCK7.js} +1 -1
  19. package/dist/cdn/LRH2ZPVW.js +2 -0
  20. package/dist/cdn/QUZTFUWM.js +1 -0
  21. package/dist/cdn/{4PZ5RHFL.js → RIN3RP7D.js} +1 -1
  22. package/dist/cdn/SWVRA77H.js +2 -0
  23. package/dist/cdn/TLQ75QXG.js +2 -0
  24. package/dist/cdn/{UZ6OAU3F.js → TPF5Z277.js} +1 -1
  25. package/dist/cdn/UIIVUHXL.js +2 -0
  26. package/dist/cdn/UWZQWGZP.js +2 -0
  27. package/dist/cdn/{MCLO6ZVA.js → UXYYH6XF.js} +1 -1
  28. package/dist/cdn/Y2BCEVV6.js +2 -0
  29. package/dist/cdn/YJ4MZOVC.js +2 -0
  30. package/dist/cdn/YXIPCGGP.js +2 -0
  31. package/dist/cdn/YYFKFPSN.js +2 -0
  32. package/dist/cdn/agent-utils/index.js +1 -1
  33. package/dist/cdn/assets/agents/t9n/messages.en.json +1 -0
  34. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ar.json +1 -1
  35. package/dist/cdn/assets/assistant-interrupt/t9n/messages.bg.json +1 -1
  36. package/dist/cdn/assets/assistant-interrupt/t9n/messages.bs.json +1 -1
  37. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ca.json +1 -1
  38. package/dist/cdn/assets/assistant-interrupt/t9n/messages.cs.json +1 -1
  39. package/dist/cdn/assets/assistant-interrupt/t9n/messages.da.json +1 -1
  40. package/dist/cdn/assets/assistant-interrupt/t9n/messages.de.json +1 -1
  41. package/dist/cdn/assets/assistant-interrupt/t9n/messages.el.json +1 -1
  42. package/dist/cdn/assets/assistant-interrupt/t9n/messages.es.json +1 -1
  43. package/dist/cdn/assets/assistant-interrupt/t9n/messages.et.json +1 -1
  44. package/dist/cdn/assets/assistant-interrupt/t9n/messages.fi.json +1 -1
  45. package/dist/cdn/assets/assistant-interrupt/t9n/messages.fr.json +1 -1
  46. package/dist/cdn/assets/assistant-interrupt/t9n/messages.he.json +1 -1
  47. package/dist/cdn/assets/assistant-interrupt/t9n/messages.hr.json +1 -1
  48. package/dist/cdn/assets/assistant-interrupt/t9n/messages.hu.json +1 -1
  49. package/dist/cdn/assets/assistant-interrupt/t9n/messages.id.json +1 -1
  50. package/dist/cdn/assets/assistant-interrupt/t9n/messages.it.json +1 -1
  51. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ja.json +1 -1
  52. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ko.json +1 -1
  53. package/dist/cdn/assets/assistant-interrupt/t9n/messages.lt.json +1 -1
  54. package/dist/cdn/assets/assistant-interrupt/t9n/messages.lv.json +1 -1
  55. package/dist/cdn/assets/assistant-interrupt/t9n/messages.nl.json +1 -1
  56. package/dist/cdn/assets/assistant-interrupt/t9n/messages.no.json +1 -1
  57. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pl.json +1 -1
  58. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pt-BR.json +1 -1
  59. package/dist/cdn/assets/assistant-interrupt/t9n/messages.pt-PT.json +1 -1
  60. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ro.json +1 -1
  61. package/dist/cdn/assets/assistant-interrupt/t9n/messages.ru.json +1 -1
  62. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sk.json +1 -1
  63. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sl.json +1 -1
  64. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sr.json +1 -1
  65. package/dist/cdn/assets/assistant-interrupt/t9n/messages.sv.json +1 -1
  66. package/dist/cdn/assets/assistant-interrupt/t9n/messages.th.json +1 -1
  67. package/dist/cdn/assets/assistant-interrupt/t9n/messages.tr.json +1 -1
  68. package/dist/cdn/assets/assistant-interrupt/t9n/messages.uk.json +1 -1
  69. package/dist/cdn/assets/assistant-interrupt/t9n/messages.vi.json +1 -1
  70. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-CN.json +1 -1
  71. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-HK.json +1 -1
  72. package/dist/cdn/assets/assistant-interrupt/t9n/messages.zh-TW.json +1 -1
  73. package/dist/cdn/index.js +1 -1
  74. package/dist/chunks/orchestrator.js +2 -1
  75. package/dist/docs/api.json +1 -1
  76. package/dist/docs/docs.json +1 -1
  77. package/dist/docs/web-types.json +1 -1
  78. package/package.json +5 -5
  79. package/dist/cdn/4WYNWR6R.js +0 -2
  80. package/dist/cdn/5QXGQW2N.js +0 -2
  81. package/dist/cdn/7ELUGB4X.js +0 -2
  82. package/dist/cdn/ALCJFKAR.js +0 -177
  83. package/dist/cdn/DYZEQYTP.js +0 -2
  84. package/dist/cdn/IZ56DC4L.js +0 -2
  85. package/dist/cdn/K5FWDMTV.js +0 -2
  86. package/dist/cdn/KPJHQ424.js +0 -2
  87. package/dist/cdn/KQGC2FCP.js +0 -2
  88. package/dist/cdn/LEV5ORDL.js +0 -2
  89. package/dist/cdn/NE4NTGQN.js +0 -2
  90. package/dist/cdn/NR2O3AP2.js +0 -2
  91. package/dist/cdn/NWJQ7KTC.js +0 -2
  92. package/dist/cdn/OU4HN5HN.js +0 -2
  93. package/dist/cdn/PQRE67OM.js +0 -2
  94. package/dist/cdn/VYOIFJVE.js +0 -2
  95. package/dist/cdn/WB6PGHFS.js +0 -2
  96. package/dist/cdn/X5AOLYY5.js +0 -2
@@ -1,96 +1,123 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { getCurrentTaskInput as z, Annotation as F, StateGraph as I, START as q, END as D, isGraphInterrupt as G } from "@langchain/langgraph/web";
3
- import { createMiddleware as g, createAgent as K, providerStrategy as J } from "langchain";
2
+ import { getCurrentTaskInput as q, Annotation as G, StateGraph as K, START as L, END as D, isGraphInterrupt as J } from "@langchain/langgraph/web";
3
+ import { createMiddleware as f, createAgent as _, providerStrategy as U } from "langchain";
4
4
  import d, { z as m } from "zod";
5
- import { c as L } from "../../../chunks/aiFactory.js";
5
+ import { c as B } from "../../../chunks/aiFactory.js";
6
6
  import { s as p } from "../../../chunks/index.js";
7
- import { a as _ } from "../../../chunks/baseAgentState.js";
8
- import { ToolMessage as U } from "@langchain/core/messages";
9
- import { tool as R } from "@langchain/core/tools";
10
- import { r as B } from "../../../chunks/arcgisToolRegistry.js";
11
- const w = (e) => typeof e == "object" && e !== null && !Array.isArray(e), H = ["point", "polyline", "polygon", "extent", "custom"], Q = (e) => typeof e == "string" && H.some((t) => t === e), W = (e, t) => {
12
- if (!(!w(e) || !("value" in e))) {
13
- if (w(e.sharedStatePatch)) {
14
- const s = { ...t.sharedStatePatch };
15
- for (const [o, r] of Object.entries(e.sharedStatePatch))
16
- w(r) && "value" in r && (s[o] = { value: r.value });
17
- t.sharedStatePatch = s;
7
+ import { a as H } from "../../../chunks/baseAgentState.js";
8
+ import { ToolMessage as Q } from "@langchain/core/messages";
9
+ import { fetchT9nStringsBundle as W } from "@arcgis/toolkit/intl";
10
+ import { g as X } from "../../../chunks/runtime.js";
11
+ import { tool as M } from "@langchain/core/tools";
12
+ import { r as Y } from "../../../chunks/arcgisToolRegistry.js";
13
+ const h = (e) => typeof e == "object" && e !== null && !Array.isArray(e), Z = ["point", "polyline", "polygon", "extent", "custom"], V = (e) => typeof e == "string" && Z.some((t) => t === e), ee = (e, t) => {
14
+ if (!(!h(e) || !("value" in e))) {
15
+ if (h(e.sharedStatePatch)) {
16
+ const o = { ...t.sharedStatePatch };
17
+ for (const [s, r] of Object.entries(e.sharedStatePatch))
18
+ h(r) && "value" in r && (o[s] = { value: r.value });
19
+ t.sharedStatePatch = o;
18
20
  }
19
21
  if (Array.isArray(e.sharedResourceAdditions))
20
- for (const s of e.sharedResourceAdditions)
21
- w(s) && Q(s.kind) && typeof s.description == "string" && "payload" in s && t.sharedResourceAdditions.push({
22
- kind: s.kind,
23
- description: s.description,
24
- payload: s.payload
22
+ for (const o of e.sharedResourceAdditions)
23
+ h(o) && V(o.kind) && typeof o.description == "string" && "payload" in o && t.sharedResourceAdditions.push({
24
+ kind: o.kind,
25
+ description: o.description,
26
+ payload: o.payload
25
27
  });
26
28
  }
27
- }, X = () => {
29
+ }, te = () => {
28
30
  const e = { sharedResourceAdditions: [] };
29
31
  return {
30
- middleware: g({
32
+ middleware: f({
31
33
  name: "ToolArtifactMiddleware",
32
34
  afterAgent: (t) => {
33
- if (delete e.sharedStatePatch, e.sharedResourceAdditions.length = 0, !w(t))
35
+ if (delete e.sharedStatePatch, e.sharedResourceAdditions.length = 0, !h(t))
34
36
  return;
35
- const s = t.messages;
36
- if (Array.isArray(s)) {
37
- for (const o of s)
38
- if (U.isInstance(o) && o.status !== "error") {
39
- const r = o.artifact;
40
- W(r, e);
37
+ const o = t.messages;
38
+ if (Array.isArray(o)) {
39
+ for (const s of o)
40
+ if (Q.isInstance(s) && s.status !== "error") {
41
+ const r = s.artifact;
42
+ ee(r, e);
41
43
  }
42
44
  }
43
45
  }
44
46
  }),
45
47
  collectedEffects: e
46
48
  };
47
- }, Y = (e) => g({
48
- name: "TraceMiddleware",
49
- wrapModelCall: async (t, s) => {
50
- await p({ text: "Determining the next step" }, e);
51
- try {
52
- return await s(t);
53
- } catch (o) {
54
- throw await p({ text: "Failed calling model" }, e), o;
55
- }
56
- },
57
- wrapToolCall: async (t, s) => {
58
- await p(
59
- { text: `Calling ${t.toolCall.name} with parameters: ${JSON.stringify(t.toolCall.args)}` },
60
- e
61
- );
62
- try {
63
- return await s(t);
64
- } catch (o) {
65
- throw await p({ text: `Failed executing ${t.toolCall.name}` }, e), o;
66
- }
49
+ }, oe = /^\.\/assets\/[^/]+\/t9n$/u, $ = (e) => {
50
+ const t = e?.configurable;
51
+ if (t && typeof t == "object" && "locale" in t) {
52
+ const o = t.locale;
53
+ if (typeof o == "string")
54
+ return o;
67
55
  }
68
- }), $ = ["custom", "extent", "point", "polygon", "polyline"], Z = d.object({
56
+ return "en";
57
+ };
58
+ async function R(e) {
59
+ if (!oe.test(e.path))
60
+ throw new Error(`Invalid localization asset path: ${e.path}`);
61
+ return console.log(`Fetching localization strings from path: ${e.path} with language: ${e.locale}`), await W(e.locale, X(e.path), "messages.");
62
+ }
63
+ const se = async (e) => {
64
+ const t = await R({
65
+ path: "./assets/agents/t9n",
66
+ locale: $(e)
67
+ });
68
+ return f({
69
+ name: "TraceMiddleware",
70
+ wrapModelCall: async (o, s) => {
71
+ await p({ text: t.determiningNextSteps }, e);
72
+ try {
73
+ return await s(o);
74
+ } catch (r) {
75
+ throw await p({ text: t.failedCallingModel }, e), r;
76
+ }
77
+ },
78
+ wrapToolCall: async (o, s) => {
79
+ await p(
80
+ {
81
+ text: t.callingTool.replace("{toolName}", o.toolCall.name).replace("{toolArgs}", JSON.stringify(o.toolCall.args))
82
+ },
83
+ e
84
+ );
85
+ try {
86
+ return await s(o);
87
+ } catch (r) {
88
+ throw await p(
89
+ { text: t.failedExecutingTool.replace("{toolName}", o.toolCall.name) },
90
+ e
91
+ ), r;
92
+ }
93
+ }
94
+ });
95
+ }, E = ["custom", "extent", "point", "polygon", "polyline"], re = d.object({
69
96
  id: d.string(),
70
- kind: d.enum($),
97
+ kind: d.enum(E),
71
98
  description: d.string()
72
- }), V = d.object({
73
- kinds: d.array(d.enum($)).optional().describe("Optional resource kinds to include. Omit to list all available resources.")
74
- }), ee = ({ kinds: e }, t) => {
75
- const s = z(t), o = e ? new Set(e) : void 0, r = (s.agentExecutionContext?.sharedResources ?? []).flatMap((n) => {
76
- const i = Z.safeParse(n);
77
- return i.success && (!o || o.has(i.data.kind)) ? [i.data] : [];
99
+ }), ae = d.object({
100
+ kinds: d.array(d.enum(E)).optional().describe("Optional resource kinds to include. Omit to list all available resources.")
101
+ }), ne = ({ kinds: e }, t) => {
102
+ const o = q(t), s = e ? new Set(e) : void 0, r = (o.agentExecutionContext?.sharedResources ?? []).flatMap((n) => {
103
+ const i = re.safeParse(n);
104
+ return i.success && (!s || s.has(i.data.kind)) ? [i.data] : [];
78
105
  });
79
106
  return JSON.stringify({ resources: r }, null, 2);
80
- }, te = R(ee, {
107
+ }, ie = M(ne, {
81
108
  name: "listSharedResources",
82
109
  description: "List IDs, kinds, and descriptions for resources created by earlier agents. Use this to reuse prior results instead of repeating work. Resource payloads are hidden.",
83
- schema: V
84
- }), oe = (e) => {
110
+ schema: ae
111
+ }), le = (e) => {
85
112
  if (e.size === 0)
86
113
  throw new Error("At least one skill is required.");
87
114
  const t = [...e.keys()];
88
- return R(
89
- ({ name: s }) => {
90
- const o = e.get(s);
91
- if (!o)
92
- throw new Error(`Skill not found: ${s}`);
93
- return o.instructions;
115
+ return M(
116
+ ({ name: o }) => {
117
+ const s = e.get(o);
118
+ if (!s)
119
+ throw new Error(`Skill not found: ${o}`);
120
+ return s.instructions;
94
121
  },
95
122
  {
96
123
  name: "load_skill",
@@ -98,7 +125,7 @@ const w = (e) => typeof e == "object" && e !== null && !Array.isArray(e), H = ["
98
125
  schema: d.object({ name: d.enum(t) })
99
126
  }
100
127
  );
101
- }, se = (e) => {
128
+ }, ce = (e) => {
102
129
  const t = /^---\r?\nname: (?<name>[^\r\n]+)\r?\ndescription: (?<description>[^\r\n]+)\r?\n(?:allowed-tools: (?<allowedTools>[^\r\n]+)\r?\n)?---\r?\n(?<instructions>[\s\S]+)$/u.exec(
103
130
  e
104
131
  )?.groups;
@@ -110,28 +137,28 @@ const w = (e) => typeof e == "object" && e !== null && !Array.isArray(e), H = ["
110
137
  description: t.description,
111
138
  instructions: t.instructions.trim()
112
139
  };
113
- }, re = async (e) => {
114
- const t = await Promise.all(e.map(async (o) => se(await o()))), s = /* @__PURE__ */ new Map();
115
- for (const o of t) {
116
- if (s.has(o.name))
117
- throw new Error(`Skill name must be unique: ${o.name}`);
118
- s.set(o.name, o);
140
+ }, de = async (e) => {
141
+ const t = await Promise.all(e.map(async (s) => ce(await s()))), o = /* @__PURE__ */ new Map();
142
+ for (const s of t) {
143
+ if (o.has(s.name))
144
+ throw new Error(`Skill name must be unique: ${s.name}`);
145
+ o.set(s.name, s);
119
146
  }
120
- return s;
121
- }, b = "load_skill", v = (e) => typeof e == "object" && e !== null && "name" in e && typeof e.name == "string" ? e.name : void 0, ae = (e, t, s = []) => {
122
- let o = t;
123
- return g({
147
+ return o;
148
+ }, b = "load_skill", T = (e) => typeof e == "object" && e !== null && "name" in e && typeof e.name == "string" ? e.name : void 0, ue = (e, t, o = []) => {
149
+ let s = t;
150
+ return f({
124
151
  name: "ActiveSkillMiddleware",
125
152
  wrapModelCall: async (r, n) => {
126
153
  const i = /* @__PURE__ */ new Set([
127
154
  b,
128
- ...s,
129
- ...o?.allowedTools ?? []
155
+ ...o,
156
+ ...s?.allowedTools ?? []
130
157
  ]);
131
158
  return await n({
132
159
  ...r,
133
160
  tools: r.tools.filter((l) => {
134
- const a = v(l);
161
+ const a = T(l);
135
162
  return a !== void 0 && i.has(a);
136
163
  })
137
164
  });
@@ -139,38 +166,38 @@ const w = (e) => typeof e == "object" && e !== null && !Array.isArray(e), H = ["
139
166
  wrapToolCall: async (r, n) => {
140
167
  const i = await n(r);
141
168
  if (r.toolCall.name === b) {
142
- const l = v(r.toolCall.args), a = l ? e.get(l) : void 0;
143
- a && (o = a);
169
+ const l = T(r.toolCall.args), a = l ? e.get(l) : void 0;
170
+ a && (s = a);
144
171
  }
145
172
  return i;
146
173
  }
147
174
  });
148
- }, ne = async (e, t = {}) => {
149
- const s = new Set([...e.values()].flatMap((o) => o.allowedTools));
175
+ }, me = async (e, t = {}) => {
176
+ const o = new Set([...e.values()].flatMap((s) => s.allowedTools));
150
177
  return await Promise.all(
151
- [...s].map(async (o) => {
152
- const r = t[o], n = r ? await r() : await B(o);
153
- if (n.name !== o)
154
- throw new Error(`Skill tool "${o}" resolved to "${n.name}".`);
178
+ [...o].map(async (s) => {
179
+ const r = t[s], n = r ? await r() : await Y(s);
180
+ if (n.name !== s)
181
+ throw new Error(`Skill tool "${s}" resolved to "${n.name}".`);
155
182
  return n;
156
183
  })
157
184
  );
158
- }, ie = async (e, t = {}) => {
159
- const s = await re(e), o = [...s.values()];
160
- if (o.length === 0)
185
+ }, pe = async (e, t = {}) => {
186
+ const o = await de(e), s = [...o.values()];
187
+ if (s.length === 0)
161
188
  throw new Error("createSkillRuntime requires at least one skill.");
162
- const r = [te], n = new Set(r.map((a) => a.name));
163
- for (const a of o) {
164
- const h = a.allowedTools.find((f) => n.has(f));
165
- if (h)
189
+ const r = [ie], n = new Set(r.map((a) => a.name));
190
+ for (const a of s) {
191
+ const w = a.allowedTools.find((k) => n.has(k));
192
+ if (w)
166
193
  throw new Error(
167
- `Skill "${a.name}" must not declare framework tool "${h}" in allowed-tools; it is provided automatically.`
194
+ `Skill "${a.name}" must not declare framework tool "${w}" in allowed-tools; it is provided automatically.`
168
195
  );
169
196
  }
170
- const i = await ne(s, t), l = o.length === 1 ? o[0] : void 0;
197
+ const i = await me(o, t), l = s.length === 1 ? s[0] : void 0;
171
198
  return {
172
- activeSkillMiddleware: ae(
173
- s,
199
+ activeSkillMiddleware: ue(
200
+ o,
174
201
  l,
175
202
  r.map((a) => a.name)
176
203
  ),
@@ -178,13 +205,13 @@ const w = (e) => typeof e == "object" && e !== null && !Array.isArray(e), H = ["
178
205
  ${l.name}
179
206
 
180
207
  ${l.instructions}` : `Available skills:
181
- ${o.map((a) => `- ${a.name}: ${a.description}`).join(`
208
+ ${s.map((a) => `- ${a.name}: ${a.description}`).join(`
182
209
  `)}
183
210
 
184
211
  Call load_skill before using a skill and follow its instructions. Framework tools and the active skill's tools are available. Switch skills when another skill is needed to complete the task.`,
185
- tools: l ? [...r, ...i] : [oe(s), ...r, ...i]
212
+ tools: l ? [...r, ...i] : [le(o), ...r, ...i]
186
213
  };
187
- }, T = F.Root({ ..._() }), le = m.object({
214
+ }, v = G.Root({ ...H() }), he = m.object({
188
215
  agentExecutionContext: m.custom()
189
216
  }), x = m.object({
190
217
  outcome: m.enum(["completed", "blocked"]).describe(
@@ -196,31 +223,35 @@ Call load_skill before using a skill and follow its instructions. Framework tool
196
223
  summary: m.string().describe(
197
224
  "A concise orchestration summary. For a blocker, identify the missing prerequisite and capability needed."
198
225
  )
199
- }), ye = ({
226
+ }), $e = ({
200
227
  id: e,
201
228
  name: t,
202
- description: s,
203
- systemPrompt: o,
229
+ description: o,
230
+ systemPrompt: s,
204
231
  skillLoaders: r,
205
232
  toolLoaders: n,
206
233
  modelTier: i = "default",
207
234
  runtimeContextLoader: l,
208
235
  instructions: a
209
236
  }) => {
210
- const h = async (y, u) => {
211
- await p({ text: `Running ${t}` }, u);
237
+ const w = async (y, u) => {
238
+ const N = await R({
239
+ path: "./assets/agents/t9n",
240
+ locale: $(u)
241
+ });
242
+ await p({ text: N.runningAgent.replace("{agentName}", t) }, u);
212
243
  try {
213
- const { activeSkillMiddleware: c, skillsPrompt: S, tools: M } = await ie(r, n), { collectedEffects: C, middleware: E } = X(), { assignedTask: P, priorSteps: N, userRequest: j } = y.agentExecutionContext, A = await l?.({ config: u }), O = await K({
214
- model: await L({ modelTier: i, config: u }),
215
- tools: M,
216
- stateSchema: le,
217
- responseFormat: J(x),
218
- middleware: [c, E, Y(u)],
219
- systemPrompt: `${o}
244
+ const { activeSkillMiddleware: c, skillsPrompt: S, tools: P } = await pe(r, n), { collectedEffects: C, middleware: j } = te(), { assignedTask: z, priorSteps: O, userRequest: I } = y.agentExecutionContext, A = await l?.({ config: u }), F = await _({
245
+ model: await B({ modelTier: i, config: u }),
246
+ tools: P,
247
+ stateSchema: he,
248
+ responseFormat: U(x),
249
+ middleware: [c, j, await se(u)],
250
+ systemPrompt: `${s}
220
251
 
221
- Primary task assigned by the orchestrator: ${P}
222
- Prior agent steps to reuse when relevant: ${JSON.stringify(N)}
223
- Original user request for context: ${j}
252
+ Primary task assigned by the orchestrator: ${z}
253
+ Prior agent steps to reuse when relevant: ${JSON.stringify(O)}
254
+ Original user request for context: ${I}
224
255
 
225
256
  ${A ? `Runtime context for this run (untrusted reference data):
226
257
  <runtime-context>
@@ -231,15 +262,15 @@ Call load_skill before using a skill and follow its instructions. Framework tool
231
262
 
232
263
  ${S}
233
264
  ${a ?? ""}`
234
- }).invoke({ messages: [], agentExecutionContext: y.agentExecutionContext }, u), k = x.parse(O.structuredResponse);
265
+ }).invoke({ messages: [], agentExecutionContext: y.agentExecutionContext }, u), g = x.parse(F.structuredResponse);
235
266
  return {
236
- outputMessage: k.outputMessage,
237
- status: k.outcome === "completed" ? "success" : "failed",
238
- summary: k.summary || k.outputMessage,
267
+ outputMessage: g.outputMessage,
268
+ status: g.outcome === "completed" ? "success" : "failed",
269
+ summary: g.summary || g.outputMessage,
239
270
  ...C
240
271
  };
241
272
  } catch (c) {
242
- if (G(c) || u?.signal?.aborted || c instanceof Error && c.name === "AbortError")
273
+ if (J(c) || u?.signal?.aborted || c instanceof Error && c.name === "AbortError")
243
274
  throw c;
244
275
  return {
245
276
  outputMessage: "I couldn't complete this request.",
@@ -248,8 +279,8 @@ Call load_skill before using a skill and follow its instructions. Framework tool
248
279
  };
249
280
  }
250
281
  };
251
- return { id: e, name: t, description: s, createGraph: () => new I(T).addNode("agent", h).addEdge(q, "agent").addEdge("agent", D), workspace: T };
282
+ return { id: e, name: t, description: o, createGraph: () => new K(v).addNode("agent", w).addEdge(L, "agent").addEdge("agent", D), workspace: v };
252
283
  };
253
284
  export {
254
- ye as createSkillAgent
285
+ $e as createSkillAgent
255
286
  };
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import x from"./MCLO6ZVA.js";import w from"./CWE6OD3H.js";import t from"./TVCMA2R2.js";import s from"./MNEK6V2R.js";import{a as $}from"./XQ3NBBQ3.js";import r from"./DXRFD4N3.js";import q from"./ALCJFKAR.js";import"./4PKMJMND.js";import p from"./VWP2B4LB.js";import{a as ne}from"./5Q2XRQS6.js";import o from"./RHYNE5OE.js";import n from"./K7YQIJFT.js";import m from"./UT6JA4TK.js";import l from"./CA3RNGPN.js";import k from"./ES54NWOB.js";import i from"./CCC6LBMY.js";import"./34O57OGV.js";import{a as K}from"./LXPGQNXQ.js";import{a as u}from"./FDOMMK2M.js";import h from"./WVP73XWD.js";import{a as Y}from"./Z5XQLSYH.js";import{a as ee}from"./OZAZ277H.js";import g from"./AVRS6UCQ.js";import{a as ae}from"./K5JVB6FU.js";import{a as se}from"./FCI6M62J.js";import{a as oe}from"./BFZ5S7NF.js";import f from"./UZ6OAU3F.js";import e from"./2NODROJN.js";import{e as G,f as D}from"./QZL4SAYR.js";import"./WXQ26G5Q.js";import"./MJSIYEWN.js";import c from"./JNOH4PD5.js";import a from"./KA3S22NQ.js";import{a as b}from"./ONQ6JSBJ.js";import"./R74ZHFA6.js";import{a as d,b as H}from"./V7Y22FRP.js";import"./AXTQU5YL.js";import{Ya as T,r as v,s as y}from"./LOQ2PKV5.js";import{ta as j}from"./IYLFJCJ2.js";import{a as M}from"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([be,Se,,,,,,,{b:O,g:P,h:Z,i:W,j:B,k:R,l:C,m:J,n:_,o:q,p:S,q:Q,r:U},{a:F,b:Te},te,X,{a:N},,,,,ie,re,{b:k,c:L,d:x,e:w,f:A,g:le,h:I,i:ce,v:z},pe,{a:E,b:ue},me,ge,de])=>{var ke=async e=>{let t=e.allLayers.toArray(),a=[],r=new Map;for(let s of t)if(s instanceof be){let o=(async()=>{let i=await Q(s),n=await U(s,i);r.set(s.id,{layerItem:n,fieldRegistry:i})})();a.push(o)}return await Promise.all(a),r},$e=async e=>{await Se.whenOnce(()=>e.ready);let t=await ke(e.map),{layers:a}=await Me(t),r={schemaVersion:P,modified:Date.now(),embeddings:{modelProvider:W,model:B,dimensions:Z,templates:{layer:R,field:C}},layers:a},s=J.safeParse(r);if(!s.success)throw console.error("Schema Mismatch:",s.error.format()),new Error("Webmap embedding generation failed validation.");return s.data},Me=async e=>{let t=[],a=[];for(let[o,{fieldRegistry:i,layerItem:n}]of e.entries()){let l=he(R,{name:n.name,title:n.title,description:n.description});t.push(l);let c={id:o,name:n.name??"",title:n.title,description:n.description,vector:[],fields:[]};for(let[,m]of i.entries()){let g=he(C,{name:m.name,alias:m.alias,description:m.description});t.push(g),c.fields.push({name:m.name,alias:m.alias,description:m.description,vector:[]})}a.push(c)}let r=await F(t),s=0;return{layers:a.map(o=>(o.vector=r[s++],o.fields.forEach(i=>{i.vector=r[s++]}),o))}},he=(e,t)=>e.replace(/\{(\w+)\}/gu,(a,r)=>t[r]??""),Re=(e,t)=>{if(e.length!==t.length)throw new Error("Vectors must be the same length");let a=0,r=0,s=0;for(let n=0;n<e.length;++n){let l=e[n],c=t[n];a+=l*c,r+=l*l,s+=c*c}let o=Math.sqrt(r*s);if(o===0)return 0;let i=a/o;return Math.max(-1,Math.min(1,i))},V=[X,Y,ee,te,ae,se,oe,re,ne];async function Ce(e,t){let a=await x("navigation_tool_prompt"),{mapView:r}=b(t,["mapView"]),s=r.map.bookmarks?.map(f=>f.name).filter(Boolean)??[],o=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((f,ve)=>`${ve+1}. layerId=${f.id} | title=${f.title??""} | name=${f.name??""} | score=${f.score.toFixed(2)}`).join(`
2
+ import x from"./UXYYH6XF.js";import w from"./C2W6MBDB.js";import t from"./7W7KWR5O.js";import s from"./HTB76P2C.js";import{a as $}from"./XQ3NBBQ3.js";import r from"./GKWMAWFZ.js";import q from"./CF2V3NER.js";import"./4PKMJMND.js";import p from"./VWP2B4LB.js";import{a as ne}from"./5Q2XRQS6.js";import o from"./RHYNE5OE.js";import n from"./K7YQIJFT.js";import m from"./UT6JA4TK.js";import l from"./CA3RNGPN.js";import k from"./ES54NWOB.js";import i from"./CCC6LBMY.js";import"./34O57OGV.js";import{a as K}from"./LXPGQNXQ.js";import{a as u}from"./FDOMMK2M.js";import h from"./WVP73XWD.js";import{a as Y}from"./Z5XQLSYH.js";import{a as ee}from"./OZAZ277H.js";import g from"./AVRS6UCQ.js";import{a as ae}from"./K5JVB6FU.js";import{a as se}from"./FCI6M62J.js";import{a as oe}from"./BFZ5S7NF.js";import f from"./TPF5Z277.js";import"./HWGAJ4WN.js";import"./SWVRA77H.js";import e from"./2NODROJN.js";import{e as G,f as D}from"./QZL4SAYR.js";import"./WXQ26G5Q.js";import"./MJSIYEWN.js";import c from"./JNOH4PD5.js";import a from"./KA3S22NQ.js";import{a as b}from"./ONQ6JSBJ.js";import"./COH3QXWG.js";import"./R74ZHFA6.js";import{a as d,b as H}from"./V7Y22FRP.js";import"./AXTQU5YL.js";import{Ya as T,r as v,s as y}from"./LOQ2PKV5.js";import{ta as j}from"./IYLFJCJ2.js";import{a as M}from"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([be,Se,,,,,,,{b:O,g:P,h:Z,i:W,j:B,k:R,l:C,m:J,n:_,o:q,p:S,q:Q,r:U},{a:F,b:Te},te,X,{a:N},,,,,ie,re,{b:k,c:L,d:x,e:w,f:A,g:le,h:I,i:ce,v:z},pe,{a:E,b:ue},me,ge,de])=>{var ke=async e=>{let t=e.allLayers.toArray(),a=[],r=new Map;for(let s of t)if(s instanceof be){let o=(async()=>{let i=await Q(s),n=await U(s,i);r.set(s.id,{layerItem:n,fieldRegistry:i})})();a.push(o)}return await Promise.all(a),r},$e=async e=>{await Se.whenOnce(()=>e.ready);let t=await ke(e.map),{layers:a}=await Me(t),r={schemaVersion:P,modified:Date.now(),embeddings:{modelProvider:W,model:B,dimensions:Z,templates:{layer:R,field:C}},layers:a},s=J.safeParse(r);if(!s.success)throw console.error("Schema Mismatch:",s.error.format()),new Error("Webmap embedding generation failed validation.");return s.data},Me=async e=>{let t=[],a=[];for(let[o,{fieldRegistry:i,layerItem:n}]of e.entries()){let l=he(R,{name:n.name,title:n.title,description:n.description});t.push(l);let c={id:o,name:n.name??"",title:n.title,description:n.description,vector:[],fields:[]};for(let[,m]of i.entries()){let g=he(C,{name:m.name,alias:m.alias,description:m.description});t.push(g),c.fields.push({name:m.name,alias:m.alias,description:m.description,vector:[]})}a.push(c)}let r=await F(t),s=0;return{layers:a.map(o=>(o.vector=r[s++],o.fields.forEach(i=>{i.vector=r[s++]}),o))}},he=(e,t)=>e.replace(/\{(\w+)\}/gu,(a,r)=>t[r]??""),Re=(e,t)=>{if(e.length!==t.length)throw new Error("Vectors must be the same length");let a=0,r=0,s=0;for(let n=0;n<e.length;++n){let l=e[n],c=t[n];a+=l*c,r+=l*l,s+=c*c}let o=Math.sqrt(r*s);if(o===0)return 0;let i=a/o;return Math.max(-1,Math.min(1,i))},V=[X,Y,ee,te,ae,se,oe,re,ne];async function Ce(e,t){let a=await x("navigation_tool_prompt"),{mapView:r}=b(t,["mapView"]),s=r.map.bookmarks?.map(f=>f.name).filter(Boolean)??[],o=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((f,ve)=>`${ve+1}. layerId=${f.id} | title=${f.title??""} | name=${f.name??""} | score=${f.score.toFixed(2)}`).join(`
3
3
  `):"",i=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",n=e.intent==="goToBookmark"&&s.length?`Available bookmarks:
4
4
  ${s.map(f=>`- ${f}`).join(`
5
5
  `)}`:"",l=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{a as R}from"./XQ3NBBQ3.js";import b from"./ALCJFKAR.js";import a from"./2NODROJN.js";import{a as c,b as k}from"./V7Y22FRP.js";import{A as f,Ya as x,r as w,s as d}from"./LOQ2PKV5.js";import{ta as u}from"./IYLFJCJ2.js";export default $arcgis.t(([,,,,,,{n:_,p:b},{A:S,B:M,C:T,D:E,E:C,F:G,G:N,b:v,d:m,e:h,w:y,x:A,y:K,z:q}])=>{var z=[M,T,G,E,S,N,C];async function $(e,a){let o=await m("arcgis_knowledge_tool_prompt"),s=A(a),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:s},r=await b({promptText:o,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:z,config:a}),i=(r.tool_calls?.length??0)>0,t=typeof r.text=="string"?r.text.trim():"",l=t.length>0,p=r.text;return!i&&(s==="map"||s==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:s==="map"?"No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries.":"No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",status:"success"}:{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:i?p:t,status:i?e.status:l?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var L={generateCypher:"generated-cypher-query",queryGraphData:"graph-query-result",searchGraphData:"graph-search-result",addRecords:"added-records",applyLayout:"applied-layout",changeNonspatialVisibility:"changed-nonspatial-visibility",createLinkChart:"created-link-chart"};function I(e){return!!e&&e.status==="success"&&!!L[e.toolName]}function D(e){return{type:L[e.toolName],data:e.details}}async function F(e,a){let o=new v(z,{handleToolErrors:!1});try{let s=await o.invoke({messages:e.arcgisKnowledgeMessages},a),n=[];for(let t of s.messages){let l;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{l=JSON.parse(t.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name??"unknown"}.
2
+ import{a as R}from"./XQ3NBBQ3.js";import b from"./CF2V3NER.js";import a from"./2NODROJN.js";import{a as c,b as k}from"./V7Y22FRP.js";import{A as f,Ya as x,r as w,s as d}from"./LOQ2PKV5.js";import{ta as u}from"./IYLFJCJ2.js";export default $arcgis.t(([,,,,,,{n:_,p:b},{A:S,B:M,C:T,D:E,E:C,F:G,G:N,b:v,d:m,e:h,w:y,x:A,y:K,z:q}])=>{var z=[M,T,G,E,S,N,C];async function $(e,a){let o=await m("arcgis_knowledge_tool_prompt"),s=A(a),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:s},r=await b({promptText:o,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:z,config:a}),i=(r.tool_calls?.length??0)>0,t=typeof r.text=="string"?r.text.trim():"",l=t.length>0,p=r.text;return!i&&(s==="map"||s==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:s==="map"?"No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries.":"No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",status:"success"}:{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:i?p:t,status:i?e.status:l?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var L={generateCypher:"generated-cypher-query",queryGraphData:"graph-query-result",searchGraphData:"graph-search-result",addRecords:"added-records",applyLayout:"applied-layout",changeNonspatialVisibility:"changed-nonspatial-visibility",createLinkChart:"created-link-chart"};function I(e){return!!e&&e.status==="success"&&!!L[e.toolName]}function D(e){return{type:L[e.toolName],data:e.details}}async function F(e,a){let o=new v(z,{handleToolErrors:!1});try{let s=await o.invoke({messages:e.arcgisKnowledgeMessages},a),n=[];for(let t of s.messages){let l;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{l=JSON.parse(t.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name??"unknown"}.
3
3
 
4
4
  Original Content: ${t.content}`)}if(!l||typeof l!="object"||!("toolName"in l))throw new Error(`Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(l)}`);n.push(l)}await c({text:`Finished executing ArcGIS Knowledge Agent tools: ${s.messages.filter(t=>t.name).map(t=>t.name).join(", ")}`},a);let r=n.filter(t=>typeof t!="string").map(t=>`- Called Tool: ${t.toolName}, Status: ${t.status}`),i=n[0];return i&&I(i)&&await k(D(i),a),{...e,outputMessage:r.join(`
5
5
  `),summary:r.length?h(r.join(`
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{b as L,c as M}from"./K7BUBCK7.js";import{a as V}from"./4PKMJMND.js";import"./J4YHT55S.js";import"./QUZTFUWM.js";import"./SWVRA77H.js";import d from"./ZGZX7GR5.js";import"./P4XZMBU5.js";import b from"./ZCFYGCCV.js";import{a as F,b as G,e as z}from"./ZA2WIUWH.js";import a from"./2NODROJN.js";import{e as $}from"./QZL4SAYR.js";import{v as D,z as q}from"./COH3QXWG.js";import"./R74ZHFA6.js";import{c as U}from"./UCTC4JN4.js";import"./V7Y22FRP.js";import"./QRMRID2M.js";import"./AXTQU5YL.js";import{J as W,_ as E,ka as J}from"./LOQ2PKV5.js";import"./IYLFJCJ2.js";import"./VXFQANGJ.js";import{Dd as c}from"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([Q,ie,{property:a,subclass:h},v,C,,,,,,,H,B])=>{var ae=Object.defineProperty,ce=Object.getOwnPropertyDescriptor,y=(e,t,o,s)=>{for(var r=s>1?void 0:s?ce(t,o):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(r=(s?i(t,o,r):i(r))||r);return s&&r&&ae(t,o,r),r},p=class extends C{constructor(e){super(e)}static fromJSON(e){return new p({id:e.id,sourceAnchorId:e.source_anchor_id,sourceNodeId:e.source_node_id,targetAnchorId:e.target_anchor_id,targetNodeId:e.target_node_id})}};y([a()],p.prototype,"id",2);y([a()],p.prototype,"sourceAnchorId",2);y([a()],p.prototype,"sourceNodeId",2);y([a()],p.prototype,"targetAnchorId",2);y([a()],p.prototype,"targetNodeId",2);p=y([h("Edge")],p);var pe=Object.defineProperty,de=Object.getOwnPropertyDescriptor,I=(e,t,o,s)=>{for(var r=s>1?void 0:s?de(t,o):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(r=(s?i(t,o,r):i(r))||r);return s&&r&&pe(t,o,r),r},d=class extends C{constructor(e){super(e)}async load(){return await Promise.resolve(this)}compile(e){return{runtimeNode:this.createRuntimeNode(),edges:e.outgoingEdges.map(t=>({from:this.id,to:t.targetNodeId}))}}static fromJSON(e){throw new Error("BaseNode is abstract and cannot be instantiated directly.")}};I([a()],d.prototype,"id",2);I([a()],d.prototype,"label",2);I([a()],d.prototype,"type",2);d=I([h("BaseNode")],d);function X(e){let t=new Set(e.required),o=Object.fromEntries(Object.entries(e.properties).map(([s,r])=>{let n=Y(r);return[s,t.has(s)?n:n.optional()]}));return c.object(o)}function Y(e){let t;switch(e.type){case"array":t=c.array(e.items?Y(e.items):c.unknown());break;case"boolean":t=c.boolean();break;case"number":t=c.number();break;case"object":t=X({properties:e.properties??{},required:e.required});break;case"string":t=e.enum?.length?c.enum(e.enum):c.string();break}return e.description?t.describe(e.description):t}var ue=Object.defineProperty,me=Object.getOwnPropertyDescriptor,j=(e,t,o,s)=>{for(var r=s>1?void 0:s?me(t,o):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(r=(s?i(t,o,r):i(r))||r);return s&&r&&ue(t,o,r),r},he=e=>e.replace(/_([a-z])/gu,(t,o)=>o.toUpperCase()),l=class extends C{constructor(e){super(e),this.type="arcgis-tool"}async createRuntimeTools(){if(!this.name)throw new Error("ArcgisTool name is required");return[await V(he(this.name))]}static fromJSON(e){return new l({name:e.name,requireApproval:e.require_approval})}};j([a()],l.prototype,"name",2);j([a()],l.prototype,"requireApproval",2);j([a()],l.prototype,"type",2);l=j([h("ArcgisTool")],l);var le=Object.defineProperty,ge=Object.getOwnPropertyDescriptor,Z=e=>{throw TypeError(e)},w=(e,t,o,s)=>{for(var r=s>1?void 0:s?ge(t,o):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(r=(s?i(t,o,r):i(r))||r);return s&&r&&le(t,o,r),r},fe=(e,t,o)=>t.has(e)||Z("Cannot "+o),ye=(e,t,o)=>t.has(e)?Z("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),we=(e,t,o)=>(fe(e,t,"access private method"),o),k,ee,u=class extends d{constructor(e){super(e),ye(this,k),this.type="agent-node"}createRuntimeNode(){let e;return async(t,o)=>{e??=we(this,k,ee).call(this);let s=await(await e).run(t,o),r=this.outputSchema?.safeParse(s);if(r&&!r.success)throw r.error;let n=r?.data,i=n??s.outputMessage;return{agentExecutionContext:s.agentExecutionContext,...n?{}:{outputMessage:s.outputMessage},status:s.status,summary:s.summary,nodes:{[this.id]:{output:i}}}}}compile(e){let t=e.outgoingEdges[0]?.targetNodeId;return{runtimeNode:this.createRuntimeNode(),edges:[{from:this.id,decide:o=>o.status==="failed"?void 0:t}],schemas:[c.object({output:this.outputSchema??c.string()})]}}static fromJSON(e){let t=new u({id:e.id,label:e.label,prompt:e.prompt?.content,type:"agent-node",modelTier:e.llm_model?.model_tier});return e.structured_output&&(t.outputSchema=X(e.structured_output)),t.tools=e.tools?.filter(o=>o.type==="arcgis_tool").map(o=>l.fromJSON(o)),t}};k=new WeakSet;ee=async function(){let e=this.prompt;if(!e?.trim())throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);let t=[];if(this.tools)for(let o of this.tools){let s=await o.createRuntimeTools();t.push(...s)}return new B({name:this.id,outputSchema:this.outputSchema,modelTier:this.modelTier,prompt:e,tools:t})};w([a()],u.prototype,"type",2);w([a()],u.prototype,"prompt",2);w([a()],u.prototype,"outputSchema",2);w([a()],u.prototype,"tools",2);w([a()],u.prototype,"modelTier",2);u=w([h("AgentNode")],u);var be=Object.defineProperty,Ne=Object.getOwnPropertyDescriptor,T=(e,t,o,s)=>{for(var r=s>1?void 0:s?Ne(t,o):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(r=(s?i(t,o,r):i(r))||r);return s&&r&&be(t,o,r),r},g=class extends d{constructor(e){super(e),this.type="end-message-node"}createRuntimeNode(){return async e=>{let t=await E.fromTemplate(this.message,{templateFormat:"mustache"}).format(e);return{outputMessage:t,status:"success",summary:t}}}compile(e){return{runtimeNode:this.createRuntimeNode(),edges:[]}}static fromJSON(e){let t=new g({id:e.id,label:e.label,type:"end-message-node"});return t.message=e.message,t}};T([a()],g.prototype,"type",2);T([a()],g.prototype,"message",2);g=T([h("EndMessageNode")],g);var Oe=Object.defineProperty,Se=Object.getOwnPropertyDescriptor,te=e=>{throw TypeError(e)},O=(e,t,o,s)=>{for(var r=s>1?void 0:s?Se(t,o):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(r=(s?i(t,o,r):i(r))||r);return s&&r&&Oe(t,o,r),r},ve=(e,t,o)=>t.has(e)||te("Cannot "+o),_e=(e,t,o)=>t.has(e)?te("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,o),K=(e,t,o)=>(ve(e,t,"access private method"),o),_,oe,re,m=class extends d{constructor(e){super(e),_e(this,_),this.type="human-in-the-loop-node",this.conditions=[]}createRuntimeNode(){return async(e,t)=>{let o=Ie(t,this.id),s=`${o}:${this.id}`,r=U(t);if(r===void 0||!Ae(r,this.response?.type))throw new W({agentId:o,id:s,kind:je(this.response?.type),message:await K(this,_,oe).call(this,e),metadata:K(this,_,re).call(this,e)});return{nodes:{[this.id]:{output:r}}}}}compile(e){return{runtimeNode:this.createRuntimeNode(),edges:[{from:this.id,decide:t=>{if(!this.conditions.length)return e.outgoingEdges[0]?.targetNodeId;let o=t.nodes?.[this.id]?.output,s=Ee(o),r=this.conditions.find(n=>n.outcome===s);if(r)return e.outgoingEdges.find(n=>n.sourceAnchorId===r.sourceAnchorId)?.targetNodeId}}]}}static fromJSON(e){let t=new m({id:e.id,label:e.label,type:"human-in-the-loop-node"});return t.message=e.message,t.response=e.response,t.conditions=e.conditions.map(({outcome:o,source_anchor_id:s})=>({outcome:o,sourceAnchorId:s})),t}};_=new WeakSet;oe=async function(e){if(this.message?.source==="generated")throw new Error(`Human-in-the-loop node "${this.id}" does not support generated messages yet.`);let t=this.message?.content;if(!t)throw new Error(`Human-in-the-loop node "${this.id}" requires a message content.`);return await E.fromTemplate(t,{templateFormat:"mustache"}).format(e)};re=function(e){let t=this.response;if(!t||t.type==="confirmation"||t.type==="textInput")return;let o=t.choices;return o?.source==="fixed"?o.items?.map(s=>s.value??s.label??""):o?.source==="reference"?Je(e,o.reference)?.map(String):void 0};O([a()],m.prototype,"type",2);O([a()],m.prototype,"message",2);O([a()],m.prototype,"response",2);O([a()],m.prototype,"conditions",2);m=O([h("HumanInTheLoopNode")],m);function Ie(e,t){let o=e?.configurable?.agentId;return typeof o=="string"&&o?o:t}function je(e){switch(e){case"singleSelect":return"singleSelection";case"multipleSelect":return"multipleSelection";case"textInput":return"textInput";default:return"booleanChoice"}}function Ae(e,t){switch(t){case"confirmation":return typeof e=="boolean";case"singleSelect":return typeof e=="string"||Array.isArray(e)&&e.length===1&&typeof e[0]=="string";case"multipleSelect":return Array.isArray(e)&&e.every(o=>typeof o=="string");case"textInput":return typeof e=="string";default:return!0}}function Ee(e){return e===!1?"dismissed":"confirmed"}function Je(e,t){if(!t)return;let o=t.split(".").reduce((s,r)=>{if(s&&typeof s=="object"&&r in s)return s[r]},e);return Array.isArray(o)?o:typeof o=="string"?[o]:void 0}var ke=Object.defineProperty,xe=Object.getOwnPropertyDescriptor,se=(e,t,o,s)=>{for(var r=s>1?void 0:s?xe(t,o):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(r=(s?i(t,o,r):i(r))||r);return s&&r&&ke(t,o,r),r},N=class extends d{constructor(e){super(e),this.type="start-node"}createRuntimeNode(){return e=>({question:e.agentExecutionContext.userRequest})}static fromJSON(e){return new N({id:e.id,label:e.label,type:"start-node"})}};se([a()],N.prototype,"type",2);N=se([h("StartNode")],N);function Pe(e){switch(e.type){case"agent_node":return u.fromJSON(e);case"end_message_node":return g.fromJSON(e);case"human_input_node":return m.fromJSON(e);case"start_node":return N.fromJSON(e);default:throw new Error(`WebAgent node "${e.id}" uses unsupported type "${e.type}".`)}}function Ce(e={}){let t=Object.keys(e);if(F(t),t.includes("nodes"))throw new Error("node state cannot define reserved field: nodes.");let o=G(e);return J.Root({...o,nodes:J({reducer:(s,r)=>({...s,...r}),default:()=>({})}),...$()})}function ne(e,t={}){let o=new Set;for(let r of e)for(let n of Object.keys(r.shape??{}))n!=="nodes"&&o.add(n);let s=Object.fromEntries([...o].map(r=>[r,t[r]]));for(let[r,n]of Object.entries(t))s[r]=n;return Ce(s)}var x=class e{constructor(t,o,s){this.sourceJSON=t,this.edges=o,this.nodes=s,this._loaded=!1}static fromJSON(t){return new e(t,t.graph.edges.map(o=>p.fromJSON(o)),t.graph.nodes.map(o=>Pe(o)))}async load(){return this._loadPromise??=Promise.all(this.nodes.map(async t=>await t.load())).then(()=>{this._loaded=!0}),await this._loadPromise,this}getSchemas(){let t=Object.fromEntries(this._getNodeCompilations().flatMap((o,s)=>{let r=this.nodes[s];return o.schemas?.map(n=>[r.id,n])??[]}));return[c.object({loopCounts:c.record(c.string(),c.number()).optional(),nodes:c.object(t).partial().optional(),question:c.string().optional(),variables:this._getVariablesSchema()})]}generate(){this._assertLoaded(),this._nodeCompilations=void 0;let t=this._getNodeCompilations(),o=Object.fromEntries(this.sourceJSON.variables.map(({key:b,value:A})=>[b,A])),s=ne(this.getSchemas(),{variables:o}),r=this.nodes.find(b=>b.type==="start-node")?.id,n={},i=[];for(let[b,A]of this.nodes.entries()){let S=t[b];S&&(S.runtimeNode&&(n[A.id]=S.runtimeNode),i.push(...S.edges))}return{createGraph:()=>z(n,i,s,{entryNode:r}),workspace:s}}_assertLoaded(){if(!this._loaded)throw new Error("AgenticWorkflowRuntime must be loaded before it can generate a graph.")}_getNodeCompilations(){return this._assertLoaded(),this._nodeCompilations??=this.nodes.map(t=>t.compile({outgoingEdges:this.edges.filter(o=>o.sourceNodeId===t.id)}))}_getVariablesSchema(){return c.object(Object.fromEntries(this.sourceJSON.variables.map(({key:t})=>[t,c.unknown()])))}},Te=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,R=(e,t,o,s)=>{for(var r=s>1?void 0:s?Re(t,o):t,n=e.length-1,i;n>=0;n--)(i=e[n])&&(r=(s?i(t,o,r):i(r))||r);return s&&r&&Te(t,o,r),r},De=()=>{throw new Error("WebAgent must be loaded before it can run.")},f=class extends H{constructor(e){super(e)}async load(){if(this.portalItem){try{await this.portalItem.load()}catch(o){throw new v("web-agent:load-portal-item","Failed to load portal item",{error:o})}let t=await this.portalItem.fetchData();if(this.sourceJSON=t,!this.portalItem.title)throw new v("web-agent:missing-title","The portal item is missing a title")}if(!this.sourceJSON)throw new v("web-agent:missing-source-json","The source JSON is missing");if(!this.sourceJSON.description)throw new v("web-agent:missing-description","The source JSON is missing a description");let e=x.fromJSON(this.sourceJSON);return await e.load(),this._runtime=e,this.description=this.sourceJSON.description,this.name=this.portalItem?.title??`web-agent-${Date.now()}`,this.generate(),this}getSchemas(){return this._runtime?.getSchemas()??[]}generate(){if(!this._runtime){this._set("workspace",ne([])),this._set("createGraph",De);return}let{createGraph:e,workspace:t}=this._runtime.generate();this._set("workspace",t),this._set("createGraph",e)}};R([a({type:Q})],f.prototype,"portalItem",2);R([a()],f.prototype,"sourceJSON",2);f=R([h("WebAgent")],f);var P=class extends D{static{this.properties={agent:0,context:0,itemId:1,workflow:0}}#e;async getContext(){return L(this.context)?await this.context():this.context}async load(){let t;if(this.itemId){let o=ie.getDefault();t=new f({portalItem:new Q({id:this.itemId,portal:o})})}else this.workflow&&(t=new f({sourceJSON:this.workflow}));if(t&&(await t.load(),this.agent=t.registration),!this.agent)throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");this.#e=M(this)}disconnectedCallback(){this.#e?.unregister(this.agent.id),super.disconnectedCallback()}};q("arcgis-assistant-agent",P);return P},"portal/PortalItem","portal/Portal","core/accessorSupport/decorators","core/Error","core/Accessor","identity/IdentityManager","request","config","core/reactiveUtils","layers/FeatureLayer",a,b,d)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import n from"./7W7KWR5O.js";import"./XQ3NBBQ3.js";import m from"./CF2V3NER.js";import{c as s,d as p}from"./K7BUBCK7.js";import"./4PKMJMND.js";import l from"./VWP2B4LB.js";import"./5Q2XRQS6.js";import k from"./K7YQIJFT.js";import j from"./UT6JA4TK.js";import i from"./CA3RNGPN.js";import h from"./ES54NWOB.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import"./LXPGQNXQ.js";import"./FDOMMK2M.js";import f from"./WVP73XWD.js";import"./Z5XQLSYH.js";import"./OZAZ277H.js";import d from"./AVRS6UCQ.js";import"./K5JVB6FU.js";import"./FCI6M62J.js";import"./BFZ5S7NF.js";import"./HWGAJ4WN.js";import"./J4YHT55S.js";import"./QUZTFUWM.js";import"./SWVRA77H.js";import c from"./2NODROJN.js";import"./QZL4SAYR.js";import"./WXQ26G5Q.js";import"./MJSIYEWN.js";import b from"./JNOH4PD5.js";import a from"./KA3S22NQ.js";import"./ONQ6JSBJ.js";import{v as e,z as o}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./V7Y22FRP.js";import"./AXTQU5YL.js";import"./LOQ2PKV5.js";import"./IYLFJCJ2.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,{fetchKnowledgeGraph:n},,,,,,,,,,,,,m])=>{var r=class extends e{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1,serviceUrl:3,context:0}}#i;#r;#t;#e;get serviceUrl(){return this.#r}set serviceUrl(t){this.#r=t}async getContext(){let t=this.context?{...this.context,knowledgeGraph:void 0,view:void 0}:{};if(this.#i)return{...t,view:this.#i};if(this.#t)try{let i=await this.#t;return{...t,knowledgeGraph:i}}catch(i){console.error("Failed to load knowledge graph via service URL:",i)}if(!this.context?.knowledgeGraph&&!this.context?.view)throw new Error("arcgis-assistant-knowledge-agent requires either a knowledgeGraph or view in context, and neither were provided");return this.context}willUpdate(t){t.has("serviceUrl")&&this.serviceUrl?this.#t=n(this.serviceUrl):this.#t=void 0}load(){this.#i=p(this)??void 0,this.#e=s(this)}disconnectedCallback(){this.#e?.unregister(this.agent.id),super.disconnectedCallback()}};o("arcgis-assistant-knowledge-agent",r);return r},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,f,g,h,i,j,k,l,m,n)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./ALCJFKAR.js";export default $arcgis.t(([{a:i}])=>{var d=(r,e)=>{let n=Array.from(r?.values()??[]).map(({fieldRegistry:s,layerItem:t})=>{let a=Array.from(s.values(),({name:o})=>o);return{title:t.title,description:t.description,fields:a.slice(0,10),additionalFieldCount:Math.max(a.length-10,0)}}),l=(e?.list()??[]).map(({agent:{description:s,id:t,name:a}})=>({id:t,name:a,description:s}));return JSON.stringify({layers:n,agents:l},null,2)},p=({config:r})=>{let e=r?.configurable?.services;return d(e?.layersAndFieldsRegistry,e?.agentRegistry)},m=[async()=>(await import("./74CVYM72.js")).default],u=i({id:"help",name:"Help Agent",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.",skillLoaders:m,modelTier:"default",systemPrompt:"You are an ArcGIS map help agent.",runtimeContextLoader:p});return u},a)
2
+ import a from"./CF2V3NER.js";export default $arcgis.t(([{a:i}])=>{var d=(r,e)=>{let n=Array.from(r?.values()??[]).map(({fieldRegistry:s,layerItem:t})=>{let a=Array.from(s.values(),({name:o})=>o);return{title:t.title,description:t.description,fields:a.slice(0,10),additionalFieldCount:Math.max(a.length-10,0)}}),l=(e?.list()??[]).map(({agent:{description:s,id:t,name:a}})=>({id:t,name:a,description:s}));return JSON.stringify({layers:n,agents:l},null,2)},p=({config:r})=>{let e=r?.configurable?.services;return d(e?.layersAndFieldsRegistry,e?.agentRegistry)},m=[async()=>(await import("./74CVYM72.js")).default],u=i({id:"help",name:"Help Agent",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.",skillLoaders:m,modelTier:"default",systemPrompt:"You are an ArcGIS map help agent.",runtimeContextLoader:p});return u},a)