@wso2/am-core-ui 0.0.18 → 0.0.20

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 (48) hide show
  1. package/dist/APIKeysManager-C0phJriD.js +241 -0
  2. package/dist/CatalogKindListing-DvUuZEpc.js +137 -0
  3. package/dist/CodeBlock-B2Ecl916.js +21736 -0
  4. package/dist/EnvironmentCard-CIXhDhlZ.js +319 -0
  5. package/dist/EnvironmentSelector-D8S6nO9u.js +48 -0
  6. package/dist/IsolationTierIndicator-cf90kgjL.js +81 -0
  7. package/dist/LabelChips-7rA7_yre.js +139 -0
  8. package/dist/MCPLogo-D9IJzzl7.js +30 -0
  9. package/dist/PolicyListSection-D6aVSKwP.js +1143 -0
  10. package/dist/ResourceListShell-DFisKftq.js +463 -0
  11. package/dist/SwaggerSpecViewer-DzjR6U6W.js +106 -0
  12. package/dist/clipboard-YAzStmkw.js +23 -0
  13. package/dist/debounce-D17ObVdG.js +208 -0
  14. package/dist/format-wlHhWjGo.js +29 -0
  15. package/dist/formatDistanceToNow-DyjnT7l9.js +100 -0
  16. package/dist/gatewayScripts-D4ZDEDPS.js +72 -0
  17. package/dist/highlight-BsUzxSR3.js +454 -0
  18. package/dist/{index-CnXsN5I3.js → index-3K-zqdp-.js} +34 -33
  19. package/dist/index-6liAPSDn.js +1564 -0
  20. package/dist/index-B3ASENUJ.js +1290 -0
  21. package/dist/index-B7Pf4oPq.js +3069 -0
  22. package/dist/index-BNO3FhZK.js +2304 -0
  23. package/dist/index-BUZSfCl5.js +335 -0
  24. package/dist/index-BXiG1r_o.js +1409 -0
  25. package/dist/index-BYy7Iaam.js +459 -0
  26. package/dist/index-BbB_yx4V.js +1397 -0
  27. package/dist/index-BjWJ95lH.js +2728 -0
  28. package/dist/index-ByEInFlf.js +26408 -0
  29. package/dist/index-C8WIhzyz.js +123 -0
  30. package/dist/index-CnzvaT6b.js +2368 -0
  31. package/dist/index-CrnCf-hJ.js +763 -0
  32. package/dist/index-Cvsho9xg.js +2346 -0
  33. package/dist/index-CxnAo1_c.js +119 -0
  34. package/dist/{index-DYV1jEai.js → index-Cz7-AZwE.js} +22 -20
  35. package/dist/index-DBdRFjxm.js +1264 -0
  36. package/dist/index-DFsSvmMZ.js +7981 -0
  37. package/dist/index-DslzOSGN.js +2549 -0
  38. package/dist/index-DvpYvchM.js +2341 -0
  39. package/dist/index-PWsNvJB-.js +546 -0
  40. package/dist/index.d.ts +1398 -481
  41. package/dist/index.js +539 -438
  42. package/dist/js-yaml-CvhD-clg.js +1335 -0
  43. package/dist/llmProviderPayload-BPzWDy7n.js +332 -0
  44. package/dist/schemas-DFScWdSL.js +2969 -0
  45. package/package.json +1 -1
  46. package/dist/index-B47EJCom.js +0 -236
  47. package/dist/index-Bl1Y7Sro.js +0 -3037
  48. package/dist/index-DlS9Lybj.js +0 -80691
@@ -0,0 +1,3069 @@
1
+ import { jsxs as v, jsx as n, Fragment as Ln } from "react/jsx-runtime";
2
+ import { c as Ce } from "react/compiler-runtime";
3
+ import { useParams as Ae, generatePath as Ne, useNavigate as Vt, useSearchParams as aa, Route as De, Routes as ia } from "react-router-dom";
4
+ import { C as la, g as Se, cK as oa, cL as sa, P as It, aA as yr, aB as ca, y as Tn, Y as da, Z as ma, G as xr, aa as pa, ab as ua, t as kr, D as _r, s as Ar, a4 as ha, x as $t, cM as cr, aH as fa, a$ as dr, $ as ga, cN as mr, aG as Er, u as ya, K as va, be as An } from "./index-ByEInFlf.js";
5
+ import { Form as w, Typography as U, Box as J, Divider as $n, TextField as ge, Alert as Ie, Collapse as Te, Card as wr, CardContent as Vr, Button as Ee, DialogContent as ba, DialogTitle as Na, DialogActions as Sa, Dialog as Ca, FormHelperText as En, FormControl as sr, MenuItem as wt, CircularProgress as Lt, Stack as ne, Select as wn, SearchBar as Ir, ListingTable as Vn, Tabs as Lr, Tooltip as In, Chip as Mt, Tab as Tr, Avatar as $r, IconButton as pr, AccordionSummary as Mr, AccordionDetails as Dr, Accordion as Rr, FormControlLabel as vr, Checkbox as br, Skeleton as Nr } from "@wso2/oxygen-ui";
6
+ import "@tanstack/react-query";
7
+ import { useState as oe, useRef as Ur, useMemo as _e, useCallback as xe, useEffect as $e } from "react";
8
+ import { FileCode as Pa, Package as xa, CheckCircle as ka, Circle as ur, Plus as Me, DoorClosedLocked as _a, Link as hr, Search as zr, ExternalLink as Or, Check as jr, ChevronDown as Wr, Trash2 as Fr, Zap as Aa, Hash as Ea, Coins as wa, Info as Va, ServerCog as Ia, Copy as La, Rocket as Ta, UserPlus as $a } from "@wso2/oxygen-ui-icons-react";
9
+ import { o as Tt, c as Sr, b as ir, s as se, u as Ma, _ as Da, l as Br, r as Ra, n as Ua, a as za } from "./schemas-DFScWdSL.js";
10
+ import { P as Oa } from "./PolicyListSection-D6aVSKwP.js";
11
+ import { f as ja } from "./formatDistanceToNow-DyjnT7l9.js";
12
+ import { L as fr } from "./LabelChips-7rA7_yre.js";
13
+ import { C as Wa } from "./CatalogKindListing-DvUuZEpc.js";
14
+ const Cr = (t) => {
15
+ const e = Ce(18), {
16
+ type: r,
17
+ title: a,
18
+ subheader: s,
19
+ icon: l,
20
+ onClick: g
21
+ } = t;
22
+ let d;
23
+ e[0] !== g || e[1] !== r ? (d = () => {
24
+ g(r);
25
+ }, e[0] = g, e[1] = r, e[2] = d) : d = e[2];
26
+ const f = d;
27
+ let m;
28
+ e[3] === Symbol.for("react.memo_cache_sentinel") ? (m = {
29
+ width: 450,
30
+ py: 2
31
+ }, e[3] = m) : m = e[3];
32
+ let b;
33
+ e[4] !== a ? (b = /* @__PURE__ */ n(U, { width: "100%", variant: "h4", textAlign: "center", children: a }), e[4] = a, e[5] = b) : b = e[5];
34
+ let i;
35
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (i = {
36
+ display: "flex",
37
+ justifyContent: "center",
38
+ alignItems: "flex-end",
39
+ height: 250,
40
+ mb: 10
41
+ }, e[6] = i) : i = e[6];
42
+ let c;
43
+ e[7] !== l ? (c = /* @__PURE__ */ n(J, { sx: i, children: l }), e[7] = l, e[8] = c) : c = e[8];
44
+ let o;
45
+ e[9] !== s ? (o = /* @__PURE__ */ n(U, { variant: "body2", textAlign: "center", children: s }), e[9] = s, e[10] = o) : o = e[10];
46
+ let u;
47
+ e[11] !== c || e[12] !== o ? (u = /* @__PURE__ */ v(w.CardContent, { children: [
48
+ c,
49
+ o
50
+ ] }), e[11] = c, e[12] = o, e[13] = u) : u = e[13];
51
+ let h;
52
+ return e[14] !== f || e[15] !== b || e[16] !== u ? (h = /* @__PURE__ */ v(w.CardButton, { onClick: f, sx: m, children: [
53
+ b,
54
+ u
55
+ ] }), e[14] = f, e[15] = b, e[16] = u, e[17] = h) : h = e[17], h;
56
+ }, Fa = (t) => {
57
+ const e = Ce(20), {
58
+ onSelect: r
59
+ } = t, {
60
+ orgId: a,
61
+ projectId: s
62
+ } = Ae(), l = a ?? "default", g = s ?? "default";
63
+ let d;
64
+ e[0] !== l || e[1] !== g ? (d = {
65
+ orgName: l,
66
+ projName: g
67
+ }, e[0] = l, e[1] = g, e[2] = d) : d = e[2];
68
+ const {
69
+ data: f
70
+ } = la(d);
71
+ let m;
72
+ e[3] !== r ? (m = (M) => {
73
+ r(M);
74
+ }, e[3] = r, e[4] = m) : m = e[4];
75
+ const b = m, i = !!(f?.agents?.length && f?.agents?.length > 0);
76
+ let c;
77
+ e: {
78
+ if (!i) {
79
+ c = void 0;
80
+ break e;
81
+ }
82
+ const M = a ?? "", k = s ?? "default";
83
+ let $;
84
+ e[5] !== M || e[6] !== k ? ($ = Ne(Se.children.org.children.projects.path, {
85
+ orgId: M,
86
+ projectId: k
87
+ }), e[5] = M, e[6] = k, e[7] = $) : $ = e[7], c = $;
88
+ }
89
+ const o = c;
90
+ let u;
91
+ e[8] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ n(oa, { width: 150 }), e[8] = u) : u = e[8];
92
+ let h;
93
+ e[9] !== b ? (h = /* @__PURE__ */ n(Cr, { type: "existing", title: "Externally-Hosted Agent", subheader: "Connect an existing agent running outside the platform and enable observability and governance.", icon: u, onClick: b }), e[9] = b, e[10] = h) : h = e[10];
94
+ let p;
95
+ e[11] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ n(sa, { width: 150 }), e[11] = p) : p = e[11];
96
+ let y;
97
+ e[12] !== b ? (y = /* @__PURE__ */ n(Cr, { type: "new", title: "Platform-Hosted Agent", subheader: "Deploy and manage agents with full lifecycle support, including built-in CI/CD, scaling, observability, and governance.", icon: p, onClick: b }), e[12] = b, e[13] = y) : y = e[13];
98
+ let C;
99
+ e[14] !== h || e[15] !== y ? (C = /* @__PURE__ */ v(J, { display: "flex", flexDirection: "row", gap: 3, width: 1, children: [
100
+ h,
101
+ y
102
+ ] }), e[14] = h, e[15] = y, e[16] = C) : C = e[16];
103
+ let P;
104
+ return e[17] !== o || e[18] !== C ? (P = /* @__PURE__ */ n(It, { title: "Add a New Agent", description: "Choose how you want to get started. You can deploy an agent on the platform or register an agent that already runs elsewhere.", disableIcon: !0, backHref: o, backLabel: "Back to Projects Home", children: C }), e[17] = o, e[18] = C, e[19] = P) : P = e[19], P;
105
+ }, Ba = (t) => {
106
+ const e = Ce(12), {
107
+ onSelect: r
108
+ } = t, {
109
+ orgId: a,
110
+ projectId: s
111
+ } = Ae();
112
+ let l;
113
+ e[0] !== r ? (l = (p) => {
114
+ r(p);
115
+ }, e[0] = r, e[1] = l) : l = e[1];
116
+ const g = l, d = a ?? "", f = s ?? "default";
117
+ let m;
118
+ e[2] !== d || e[3] !== f ? (m = Ne(Se.children.org.children.projects.path, {
119
+ orgId: d,
120
+ projectId: f
121
+ }), e[2] = d, e[3] = f, e[4] = m) : m = e[4];
122
+ const b = m;
123
+ let i;
124
+ e[5] === Symbol.for("react.memo_cache_sentinel") ? (i = {
125
+ type: "source",
126
+ title: "Source Code",
127
+ subheader: "Provide agent source code from project repository",
128
+ icon: /* @__PURE__ */ n(Pa, { size: 56 })
129
+ }, e[5] = i) : i = e[5];
130
+ let c;
131
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (c = [i, {
132
+ type: "catalog",
133
+ title: "Agent Catalog",
134
+ subheader: "Pick an Agent Kind from Agent Catalog",
135
+ icon: /* @__PURE__ */ n(xa, { size: 56 })
136
+ }], e[6] = c) : c = e[6];
137
+ const o = c;
138
+ let u;
139
+ e[7] !== g ? (u = /* @__PURE__ */ n(J, { display: "flex", flexDirection: "row", gap: 3, flexWrap: "wrap", children: o.map((p) => /* @__PURE__ */ v(w.CardButton, { onClick: () => g(p.type), sx: {
140
+ minHeight: 152,
141
+ px: 3,
142
+ py: 2,
143
+ display: "flex",
144
+ flexDirection: "row",
145
+ alignItems: "center",
146
+ justifyContent: "flex-start",
147
+ gap: 3,
148
+ textAlign: "left"
149
+ }, children: [
150
+ /* @__PURE__ */ n(J, { sx: {
151
+ height: 112,
152
+ display: "flex",
153
+ alignItems: "center",
154
+ justifyContent: "center",
155
+ flexShrink: 0
156
+ }, children: p.icon }),
157
+ /* @__PURE__ */ v(J, { display: "flex", flexDirection: "column", gap: 1, alignItems: "flex-start", children: [
158
+ /* @__PURE__ */ n(U, { variant: "h3", textAlign: "left", children: p.title }),
159
+ /* @__PURE__ */ n(U, { variant: "body1", textAlign: "left", sx: {
160
+ maxWidth: 260
161
+ }, children: p.subheader })
162
+ ] })
163
+ ] }, p.type)) }), e[7] = g, e[8] = u) : u = e[8];
164
+ let h;
165
+ return e[9] !== b || e[10] !== u ? (h = /* @__PURE__ */ n(It, { title: "Create a Platform-Hosted Agent", description: "Pick a source type for the agent", disableIcon: !0, backHref: b, backLabel: "Back to Agents", children: u }), e[9] = b, e[10] = u, e[11] = h) : h = e[11], h;
166
+ }, Gr = {
167
+ displayName: se().trim().min(1, "Name is required").min(3, "Name must be at least 3 characters").max(100, "Name must be at most 100 characters"),
168
+ name: se().trim().max(50, "Name must be at most 50 characters"),
169
+ description: se().trim().optional(),
170
+ // Per-entry validation is enforced inline by LabelsEditor (mirroring the
171
+ // backend rules), so the schema only constrains the overall shape.
172
+ labels: Ra(se(), se()).optional()
173
+ }, Ga = Tt({
174
+ ...Gr,
175
+ deploymentType: Br("existing").optional()
176
+ }), Kr = Tt({
177
+ ...Gr,
178
+ deploymentType: Br("new").optional(),
179
+ enableAutoInstrumentation: ir().default(!0),
180
+ // instrumentationVersion is a plain string; the dropdown is populated
181
+ // dynamically from the agent-build-options endpoint and the server is
182
+ // the authoritative gate. nullable for the case where no AMP-provided
183
+ // instrumentation is available for the chosen Python version.
184
+ instrumentationVersion: se().trim().nullable().optional(),
185
+ repositoryUrl: se().trim().min(1, "Repository URL is required").url("Must be a valid URL"),
186
+ branch: se().trim().min(1, "Branch is required"),
187
+ appPath: se().trim().min(1, "App path is required").refine((t) => t.startsWith("/"), {
188
+ message: "App path must start with /"
189
+ }).refine((t) => !/\.\./.test(t), {
190
+ message: "Path traversal is not allowed"
191
+ }).refine((t) => /^\/[A-Za-z0-9._\-/]*$/.test(t), {
192
+ message: "App path can only contain letters, numbers, ., _, -, and /"
193
+ }).refine((t) => t === "/" ? !0 : !t.endsWith("/"), {
194
+ message: "App path must be a valid path (use / for root directory)"
195
+ }),
196
+ gitSecretRef: se().trim().optional(),
197
+ runCommand: se().trim().optional(),
198
+ language: se().trim().min(1, "Language is required"),
199
+ languageVersion: se().trim().optional(),
200
+ dockerfilePath: se().trim().optional(),
201
+ interfaceType: Da(["DEFAULT", "CUSTOM"]),
202
+ port: Ma([Ua(), se(), za()]).transform((t) => {
203
+ if (!(t === "" || t === null || t === void 0))
204
+ return typeof t == "string" ? Number(t) : t;
205
+ }).optional(),
206
+ basePath: se().trim().optional(),
207
+ openApiPath: se().trim().optional(),
208
+ env: Sr(Tt({
209
+ key: se().trim().min(1, "Environment variable key is required").max(64, "Environment variable key must be at most 64 characters").regex(/^[A-Za-z_][A-Za-z0-9_]*$/, "Env keys must match /^[A-Za-z_][A-Za-z0-9_]*$/").optional(),
210
+ value: se().trim().max(2048, "Environment variable value must be at most 2048 characters").optional(),
211
+ isSensitive: ir().default(!1)
212
+ })).max(50, "A maximum of 50 environment variables is allowed"),
213
+ files: Sr(Tt({
214
+ key: se().trim().min(1, "File name is required").max(253, "File name must be at most 253 characters").optional(),
215
+ mountPath: se().trim().min(1, "Mount path is required").refine((t) => !t || t.startsWith("/"), {
216
+ message: "Mount path must be an absolute path (start with /)"
217
+ }).refine((t) => !t || !t.includes(".."), {
218
+ message: "Path traversal (..) is not allowed"
219
+ }).refine((t) => !t || /^\/[A-Za-z0-9._\-/]*$/.test(t), {
220
+ message: "Mount path contains invalid characters"
221
+ }).optional(),
222
+ value: se().max(1048576, "File content must be at most 1MB").optional(),
223
+ isSensitive: ir().default(!1)
224
+ })).max(20, "A maximum of 20 file mounts is allowed")
225
+ }).refine((t) => !(t.interfaceType === "CUSTOM" && !t.port), {
226
+ message: "Port is required when using custom interface",
227
+ path: ["port"]
228
+ }).refine((t) => !(t.interfaceType === "CUSTOM" && t.port !== void 0 && (!Number.isInteger(t.port) || t.port < 1 || t.port > 65535)), {
229
+ message: "Port must be between 1 and 65535",
230
+ path: ["port"]
231
+ }).refine((t) => !(t.interfaceType === "CUSTOM" && !t.basePath), {
232
+ message: "Base path is required when using custom interface",
233
+ path: ["basePath"]
234
+ }).refine((t) => !(t.interfaceType === "CUSTOM" && !t.openApiPath), {
235
+ message: "OpenAPI spec path is required when using custom interface",
236
+ path: ["openApiPath"]
237
+ }).refine((t) => !(t.language === "python" && !t.runCommand?.trim()), {
238
+ message: "Start Command is required for Python agents",
239
+ path: ["runCommand"]
240
+ }).refine((t) => !(t.language === "python" && !t.languageVersion?.trim()), {
241
+ message: "Python version is required for Python agents",
242
+ path: ["languageVersion"]
243
+ }).refine((t) => !(t.language === "docker" && !t.dockerfilePath?.trim()), {
244
+ message: "Dockerfile path is required for Docker agents",
245
+ path: ["dockerfilePath"]
246
+ }).refine((t) => !(t.language === "docker" && t.dockerfilePath?.trim() && !t.dockerfilePath.startsWith("/")), {
247
+ message: "Dockerfile path must start with /",
248
+ path: ["dockerfilePath"]
249
+ }), Ka = [{
250
+ label: "Chat Agent",
251
+ description: "Standard chat interface with /chat endpoint on port 8000",
252
+ default: !0,
253
+ value: "DEFAULT"
254
+ }, {
255
+ label: "Custom API Agent",
256
+ description: "Custom HTTP API with user-specified OpenAPI specification and port configuration",
257
+ default: !1,
258
+ value: "CUSTOM"
259
+ }], qa = (t) => {
260
+ const e = Ce(57), {
261
+ formData: r,
262
+ setFormData: a,
263
+ errors: s,
264
+ setFieldError: l,
265
+ validateField: g
266
+ } = t;
267
+ let d;
268
+ e[0] !== l || e[1] !== a || e[2] !== g ? (d = (q, H) => {
269
+ let X = null;
270
+ if (a((ae) => (X = {
271
+ ...ae,
272
+ [q]: H
273
+ }, X)), X) {
274
+ const ae = g(q, H, X);
275
+ l(q, ae);
276
+ }
277
+ }, e[0] = l, e[1] = a, e[2] = g, e[3] = d) : d = e[3];
278
+ const f = d;
279
+ let m;
280
+ e[4] !== l || e[5] !== a || e[6] !== g ? (m = (q) => {
281
+ a((H) => ({
282
+ ...H,
283
+ interfaceType: q,
284
+ ...q === "DEFAULT" ? {
285
+ openApiPath: "",
286
+ port: "",
287
+ basePath: "/"
288
+ } : {}
289
+ })), a((H) => {
290
+ const X = g("interfaceType", q, H);
291
+ if (l("interfaceType", X), q === "CUSTOM") {
292
+ const ae = g("port", H.port, H);
293
+ l("port", ae);
294
+ const de = g("openApiPath", H.openApiPath, H);
295
+ l("openApiPath", de);
296
+ const ce = g("basePath", H.basePath, H);
297
+ l("basePath", ce);
298
+ } else
299
+ l("port", void 0), l("openApiPath", void 0), l("basePath", void 0);
300
+ return H;
301
+ });
302
+ }, e[4] = l, e[5] = a, e[6] = g, e[7] = m) : m = e[7];
303
+ const b = m;
304
+ let i;
305
+ e[8] !== f ? (i = (q) => {
306
+ const H = q.target.value;
307
+ /^\d*$/.test(H) && f("port", H === "" ? "" : Number(H));
308
+ }, e[8] = f, e[9] = i) : i = e[9];
309
+ const c = i;
310
+ let o, u;
311
+ e[10] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ n(w.Subheader, { children: "Agent Type" }), u = /* @__PURE__ */ n(U, { variant: "body2", color: "text.secondary", children: "How your agent receives requests" }), e[10] = o, e[11] = u) : (o = e[10], u = e[11]);
312
+ let h;
313
+ e[12] !== r.interfaceType || e[13] !== b ? (h = Ka.map((q) => /* @__PURE__ */ n(w.CardButton, { onClick: () => b(q.value), selected: r.interfaceType === q.value, sx: {
314
+ maxWidth: 500,
315
+ flexGrow: 1
316
+ }, children: /* @__PURE__ */ n(w.CardContent, { sx: {
317
+ height: "100%"
318
+ }, children: /* @__PURE__ */ v(J, { display: "flex", flexDirection: "row", alignItems: "center", height: "100%", gap: 1, children: [
319
+ /* @__PURE__ */ n(J, { children: r.interfaceType === q.value ? /* @__PURE__ */ n(ka, { size: 16 }) : /* @__PURE__ */ n(ur, { size: 16 }) }),
320
+ /* @__PURE__ */ n($n, { orientation: "vertical", flexItem: !0 }),
321
+ /* @__PURE__ */ v(J, { children: [
322
+ /* @__PURE__ */ n(U, { variant: "h6", children: q.label }),
323
+ /* @__PURE__ */ n(U, { variant: "caption", children: q.description })
324
+ ] })
325
+ ] }) }) }, q.value)), e[12] = r.interfaceType, e[13] = b, e[14] = h) : h = e[14];
326
+ let p;
327
+ e[15] !== h ? (p = /* @__PURE__ */ n(J, { display: "flex", flexDirection: "row", gap: 1, children: h }), e[15] = h, e[16] = p) : p = e[16];
328
+ const y = r.interfaceType === "DEFAULT";
329
+ let C;
330
+ e[17] === Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ n("strong", { children: "POST /chat" }), e[17] = C) : C = e[17];
331
+ let P, M;
332
+ e[18] === Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ n("strong", { children: "8000" }), M = /* @__PURE__ */ n("br", {}), e[18] = P, e[19] = M) : (P = e[18], M = e[19]);
333
+ let k, $;
334
+ e[20] === Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ n("code", { children: "{message: string, session_id: string, context: JSON}" }), $ = /* @__PURE__ */ n("br", {}), e[20] = k, e[21] = $) : (k = e[20], $ = e[21]);
335
+ let E;
336
+ e[22] === Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ v(Ie, { severity: "info", children: [
337
+ "Uses the standard chat interface: ",
338
+ C,
339
+ " on port ",
340
+ P,
341
+ M,
342
+ "Request:",
343
+ " ",
344
+ k,
345
+ $,
346
+ "Response: ",
347
+ /* @__PURE__ */ n("code", { children: "{response: string}" })
348
+ ] }), e[22] = E) : E = e[22];
349
+ let V;
350
+ e[23] !== y ? (V = /* @__PURE__ */ n(Te, { in: y, children: E }), e[23] = y, e[24] = V) : V = e[24];
351
+ const L = r.interfaceType === "CUSTOM", O = r.openApiPath || "";
352
+ let B;
353
+ e[25] !== f ? (B = (q) => f("openApiPath", q.target.value), e[25] = f, e[26] = B) : B = e[26];
354
+ const A = !!s.openApiPath, F = s.openApiPath || "Path to OpenAPI schema file in your repository";
355
+ let R;
356
+ e[27] !== O || e[28] !== B || e[29] !== A || e[30] !== F ? (R = /* @__PURE__ */ n(J, { display: "flex", flexDirection: "column", flexGrow: 1, children: /* @__PURE__ */ n(w.ElementWrapper, { label: "OpenAPI Spec Path", name: "openApiPath", children: /* @__PURE__ */ n(ge, { id: "openApiPath", placeholder: "/openapi.yaml", required: !0, value: O, onChange: B, error: A, helperText: F, fullWidth: !0 }) }) }), e[27] = O, e[28] = B, e[29] = A, e[30] = F, e[31] = R) : R = e[31];
357
+ const G = r.port ?? "", K = !!s.port, j = s.port || (r.port ? void 0 : "Port is required");
358
+ let x;
359
+ e[32] !== c || e[33] !== G || e[34] !== K || e[35] !== j ? (x = /* @__PURE__ */ n(J, { children: /* @__PURE__ */ n(w.ElementWrapper, { label: "Port", name: "port", children: /* @__PURE__ */ n(ge, { id: "port", placeholder: "8080", required: !0, value: G, onChange: c, type: "number", error: K, helperText: j }) }) }), e[32] = c, e[33] = G, e[34] = K, e[35] = j, e[36] = x) : x = e[36];
360
+ let I;
361
+ e[37] !== R || e[38] !== x ? (I = /* @__PURE__ */ v(w.Stack, { direction: "row", spacing: 2, children: [
362
+ R,
363
+ x
364
+ ] }), e[37] = R, e[38] = x, e[39] = I) : I = e[39];
365
+ const S = r.basePath || "";
366
+ let W;
367
+ e[40] !== f ? (W = (q) => f("basePath", q.target.value), e[40] = f, e[41] = W) : W = e[41];
368
+ const Y = !!s.basePath, T = s.basePath || "API base path (e.g., / or /api/v1)";
369
+ let N;
370
+ e[42] !== S || e[43] !== W || e[44] !== Y || e[45] !== T ? (N = /* @__PURE__ */ n(w.ElementWrapper, { label: "Base Path", name: "basePath", children: /* @__PURE__ */ n(ge, { id: "basePath", placeholder: "/", required: !0, value: S, onChange: W, error: Y, helperText: T, fullWidth: !0 }) }), e[42] = S, e[43] = W, e[44] = Y, e[45] = T, e[46] = N) : N = e[46];
371
+ let _;
372
+ e[47] !== I || e[48] !== N ? (_ = /* @__PURE__ */ v(w.Stack, { spacing: 2, children: [
373
+ I,
374
+ N
375
+ ] }), e[47] = I, e[48] = N, e[49] = _) : _ = e[49];
376
+ let D;
377
+ e[50] !== L || e[51] !== _ ? (D = /* @__PURE__ */ n(Te, { in: L, children: _ }), e[50] = L, e[51] = _, e[52] = D) : D = e[52];
378
+ let Z;
379
+ return e[53] !== V || e[54] !== D || e[55] !== p ? (Z = /* @__PURE__ */ v(w.Section, { children: [
380
+ o,
381
+ u,
382
+ /* @__PURE__ */ v(w.Stack, { spacing: 2, children: [
383
+ p,
384
+ V,
385
+ D
386
+ ] })
387
+ ] }), e[53] = V, e[54] = D, e[55] = p, e[56] = Z) : Z = e[56], Z;
388
+ }, qr = ({
389
+ formData: t,
390
+ setFormData: e,
391
+ llmReservedNames: r = /* @__PURE__ */ new Set(),
392
+ lockedKeys: a = /* @__PURE__ */ new Set(),
393
+ hideAdd: s = !1
394
+ }) => {
395
+ const l = t.env || [], g = l.some((i) => !i?.key || !i?.value), d = () => {
396
+ e((i) => ({
397
+ ...i,
398
+ env: [...i.env || [], {
399
+ key: "",
400
+ value: "",
401
+ isSensitive: !1
402
+ }]
403
+ }));
404
+ }, f = (i) => {
405
+ e((c) => ({
406
+ ...c,
407
+ env: c.env?.filter((o, u) => u !== i) || []
408
+ }));
409
+ }, m = (i, c, o) => {
410
+ e((u) => ({
411
+ ...u,
412
+ env: u.env?.map((h, p) => p === i ? {
413
+ ...h,
414
+ [c]: o
415
+ } : h) || []
416
+ }));
417
+ }, b = (i, c) => {
418
+ e((o) => {
419
+ const u = o.env || [];
420
+ return u.length > 0 ? {
421
+ ...o,
422
+ env: u.map((h, p) => p === 0 ? {
423
+ ...h,
424
+ [i]: c
425
+ } : h)
426
+ } : {
427
+ ...o,
428
+ env: [{
429
+ key: i === "key" ? c : "",
430
+ value: i === "value" ? c : "",
431
+ isSensitive: i === "isSensitive" ? c : !1
432
+ }]
433
+ };
434
+ });
435
+ };
436
+ return /* @__PURE__ */ n(wr, { variant: "outlined", children: /* @__PURE__ */ v(Vr, { children: [
437
+ /* @__PURE__ */ n(J, { display: "flex", flexDirection: "row", alignItems: "center", gap: 1, children: /* @__PURE__ */ n(U, { variant: "h5", children: s ? "Environment Variables" : "Environment Variables (Optional)" }) }),
438
+ /* @__PURE__ */ n(J, { display: "flex", flexDirection: "column", py: 2, gap: 2, children: l.length ? l.map((i, c) => {
439
+ const o = new Set(l.flatMap((p, y) => y !== c && p.key ? [p.key] : [])), u = !!i.key && a.has(i.key), h = i.key && r.has(i.key) ? "Already used as an LLM provider variable" : i.key && o.has(i.key) ? "Duplicate key" : void 0;
440
+ return /* @__PURE__ */ n(yr, { index: c, keyValue: i.key || "", valueValue: i.value || "", isSensitive: i.isSensitive || !1, onKeyChange: (p) => m(c, "key", p), onValueChange: (p) => m(c, "value", p), onSensitiveChange: (p) => m(c, "isSensitive", p), onRemove: u ? () => {
441
+ } : () => f(c), keyDisabled: u, keyError: h }, `env-${c}`);
442
+ }) : /* @__PURE__ */ n(yr, { index: 0, keyValue: l?.[0]?.key || "", valueValue: l?.[0]?.value || "", isSensitive: l?.[0]?.isSensitive || !1, onKeyChange: (i) => b("key", i), onValueChange: (i) => b("value", i), onSensitiveChange: (i) => b("isSensitive", i), onRemove: () => f(0), keyError: l?.[0]?.key && r.has(l[0].key) ? "Already used as an LLM provider variable" : void 0 }, "env-0") }),
443
+ !s && /* @__PURE__ */ n(Ee, { startIcon: /* @__PURE__ */ n(Me, { fontSize: "small" }), disabled: g, variant: "outlined", color: "primary", size: "small", onClick: d, children: "Add" })
444
+ ] }) });
445
+ }, Yr = (t) => {
446
+ const e = Ce(24), {
447
+ formData: r,
448
+ setFormData: a
449
+ } = t;
450
+ let s;
451
+ e[0] !== r.files ? (s = r.files || [], e[0] = r.files, e[1] = s) : s = e[1];
452
+ const l = s;
453
+ let g;
454
+ e[2] !== l ? (g = l.some(Ya), e[2] = l, e[3] = g) : g = e[3];
455
+ const d = g;
456
+ let f;
457
+ e[4] !== a ? (f = () => {
458
+ a(Za);
459
+ }, e[4] = a, e[5] = f) : f = e[5];
460
+ const m = f;
461
+ let b;
462
+ e[6] !== a ? (b = (M) => {
463
+ a((k) => ({
464
+ ...k,
465
+ files: k.files?.filter(($, E) => E !== M) || []
466
+ }));
467
+ }, e[6] = a, e[7] = b) : b = e[7];
468
+ const i = b;
469
+ let c;
470
+ e[8] !== a ? (c = (M, k, $) => {
471
+ a((E) => ({
472
+ ...E,
473
+ files: E.files?.map((V, L) => L === M ? {
474
+ ...V,
475
+ [k]: $
476
+ } : V) || []
477
+ }));
478
+ }, e[8] = a, e[9] = c) : c = e[9];
479
+ const o = c;
480
+ let u;
481
+ e[10] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ n(J, { display: "flex", flexDirection: "row", alignItems: "center", gap: 1, children: /* @__PURE__ */ n(U, { variant: "h5", children: "File Mounts (Optional)" }) }), e[10] = u) : u = e[10];
482
+ let h;
483
+ e[11] !== l || e[12] !== o || e[13] !== i ? (h = l.map((M, k) => {
484
+ const $ = new Set(l.flatMap((V, L) => L !== k && V.key ? [V.key] : [])), E = M.key && $.has(M.key) ? "Duplicate file name" : void 0;
485
+ return /* @__PURE__ */ n(ca, { index: k, keyValue: M.key || "", mountPathValue: M.mountPath || "", contentValue: M.value || "", isSensitive: M.isSensitive || !1, onKeyChange: (V) => o(k, "key", V), onMountPathChange: (V) => o(k, "mountPath", V), onContentChange: (V) => o(k, "value", V), onSensitiveChange: (V) => o(k, "isSensitive", V), onRemove: () => i(k), keyError: E }, `file-${k}`);
486
+ }), e[11] = l, e[12] = o, e[13] = i, e[14] = h) : h = e[14];
487
+ let p;
488
+ e[15] !== h ? (p = /* @__PURE__ */ n(J, { display: "flex", flexDirection: "column", py: 2, gap: 2, children: h }), e[15] = h, e[16] = p) : p = e[16];
489
+ let y;
490
+ e[17] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(Me, { fontSize: "small" }), e[17] = y) : y = e[17];
491
+ let C;
492
+ e[18] !== m || e[19] !== d ? (C = /* @__PURE__ */ n(Ee, { startIcon: y, disabled: d, variant: "outlined", color: "primary", size: "small", onClick: m, children: "Add File" }), e[18] = m, e[19] = d, e[20] = C) : C = e[20];
493
+ let P;
494
+ return e[21] !== C || e[22] !== p ? (P = /* @__PURE__ */ n(wr, { variant: "outlined", children: /* @__PURE__ */ v(Vr, { children: [
495
+ u,
496
+ p,
497
+ C
498
+ ] }) }), e[21] = C, e[22] = p, e[23] = P) : P = e[23], P;
499
+ };
500
+ function Ya(t) {
501
+ return !t?.key || !t?.mountPath;
502
+ }
503
+ function Za(t) {
504
+ return {
505
+ ...t,
506
+ files: [...t.files || [], {
507
+ key: "",
508
+ mountPath: "",
509
+ value: "",
510
+ isSensitive: !1
511
+ }]
512
+ };
513
+ }
514
+ const Ha = Tt({
515
+ name: se().trim().min(1, "Name is required").min(2, "Name must be at least 2 characters").max(25, "Name must be at most 25 characters").refine((t) => /^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$/.test(t) || t.length === 1, {
516
+ message: "Name must start and end with alphanumeric characters"
517
+ }),
518
+ username: se().trim().min(1, "Username is required"),
519
+ password: se().min(1, "Password/PAT is required")
520
+ }), lr = {
521
+ name: "",
522
+ username: "",
523
+ password: ""
524
+ }, Qa = (t) => {
525
+ const e = Ce(59), {
526
+ open: r,
527
+ onClose: a,
528
+ onSecretCreated: s
529
+ } = t, {
530
+ orgId: l
531
+ } = Ae(), [g, d] = oe(lr), {
532
+ errors: f,
533
+ validateForm: m,
534
+ clearErrors: b,
535
+ clearFieldError: i
536
+ } = Tn(Ha), {
537
+ mutate: c,
538
+ isPending: o,
539
+ error: u,
540
+ reset: h
541
+ } = da();
542
+ let p;
543
+ e[0] !== i ? (p = (q, H) => {
544
+ d((X) => ({
545
+ ...X,
546
+ [q]: H
547
+ })), i(q);
548
+ }, e[0] = i, e[1] = p) : p = e[1];
549
+ const y = p;
550
+ let C;
551
+ e[2] !== c || e[3] !== g || e[4] !== s || e[5] !== l || e[6] !== m ? (C = () => {
552
+ m(g) && c({
553
+ params: {
554
+ orgName: l
555
+ },
556
+ body: {
557
+ name: g.name.trim(),
558
+ type: "basic-auth",
559
+ credentials: {
560
+ username: g.username.trim(),
561
+ password: g.password
562
+ }
563
+ }
564
+ }, {
565
+ onSuccess: () => {
566
+ s(g.name.trim()), d(lr);
567
+ }
568
+ });
569
+ }, e[2] = c, e[3] = g, e[4] = s, e[5] = l, e[6] = m, e[7] = C) : C = e[7];
570
+ const P = C;
571
+ let M;
572
+ e[8] !== b || e[9] !== o || e[10] !== a || e[11] !== h ? (M = () => {
573
+ o || (d(lr), b(), h(), a());
574
+ }, e[8] = b, e[9] = o, e[10] = a, e[11] = h, e[12] = M) : M = e[12];
575
+ const k = M;
576
+ let $;
577
+ e[13] === Symbol.for("react.memo_cache_sentinel") ? ($ = /* @__PURE__ */ n(Na, { children: "Create Git Secret" }), e[13] = $) : $ = e[13];
578
+ let E, V;
579
+ e[14] === Symbol.for("react.memo_cache_sentinel") ? (E = {
580
+ mt: 1
581
+ }, V = /* @__PURE__ */ n(U, { variant: "body2", color: "text.secondary", children: "Create a secret to authenticate with private Git repositories. This secret will be available for all projects in your organization." }), e[14] = E, e[15] = V) : (E = e[14], V = e[15]);
582
+ let L;
583
+ e[16] !== u ? (L = !!u && /* @__PURE__ */ n(Ie, { severity: "error", children: "Failed to create git secret. Please try again." }), e[16] = u, e[17] = L) : L = e[17];
584
+ let O;
585
+ e[18] !== y ? (O = (q) => y("name", q.target.value), e[18] = y, e[19] = O) : O = e[19];
586
+ const B = !!f.name, A = f.name || "A unique name for this secret";
587
+ let F;
588
+ e[20] !== g.name || e[21] !== A || e[22] !== O || e[23] !== B ? (F = /* @__PURE__ */ n(w.ElementWrapper, { label: "Secret Name", name: "name", children: /* @__PURE__ */ n(ge, { id: "name", placeholder: "e.g., my-github-pat", value: g.name, onChange: O, error: B, helperText: A, fullWidth: !0 }) }), e[20] = g.name, e[21] = A, e[22] = O, e[23] = B, e[24] = F) : F = e[24];
589
+ let R;
590
+ e[25] !== y ? (R = (q) => y("username", q.target.value), e[25] = y, e[26] = R) : R = e[26];
591
+ const G = !!f.username, K = f.username || "Your Git username";
592
+ let j;
593
+ e[27] !== g.username || e[28] !== R || e[29] !== G || e[30] !== K ? (j = /* @__PURE__ */ n(w.ElementWrapper, { label: "Username", name: "username", children: /* @__PURE__ */ n(ge, { id: "username", placeholder: "e.g., your-github-username", value: g.username, onChange: R, error: G, helperText: K, fullWidth: !0 }) }), e[27] = g.username, e[28] = R, e[29] = G, e[30] = K, e[31] = j) : j = e[31];
594
+ let x;
595
+ e[32] !== y ? (x = (q) => y("password", q.target.value), e[32] = y, e[33] = x) : x = e[33];
596
+ const I = !!f.password, S = f.password || "Your personal access token (PAT) with repo access";
597
+ let W;
598
+ e[34] !== g.password || e[35] !== x || e[36] !== I || e[37] !== S ? (W = /* @__PURE__ */ n(w.ElementWrapper, { label: "Personal Access Token", name: "password", children: /* @__PURE__ */ n(ge, { id: "password", placeholder: "ghp_xxxxxxxxxxxx", type: "password", value: g.password, onChange: x, error: I, helperText: S, fullWidth: !0 }) }), e[34] = g.password, e[35] = x, e[36] = I, e[37] = S, e[38] = W) : W = e[38];
599
+ let Y;
600
+ e[39] !== F || e[40] !== j || e[41] !== W || e[42] !== L ? (Y = /* @__PURE__ */ n(ba, { children: /* @__PURE__ */ v(w.Stack, { spacing: 3, sx: E, children: [
601
+ V,
602
+ L,
603
+ F,
604
+ j,
605
+ W
606
+ ] }) }), e[39] = F, e[40] = j, e[41] = W, e[42] = L, e[43] = Y) : Y = e[43];
607
+ let T;
608
+ e[44] !== k || e[45] !== o ? (T = /* @__PURE__ */ n(Ee, { onClick: k, disabled: o, children: "Cancel" }), e[44] = k, e[45] = o, e[46] = T) : T = e[46];
609
+ const N = o ? "Creating..." : "Create Secret";
610
+ let _;
611
+ e[47] !== P || e[48] !== o || e[49] !== N ? (_ = /* @__PURE__ */ n(Ee, { variant: "contained", onClick: P, disabled: o, children: N }), e[47] = P, e[48] = o, e[49] = N, e[50] = _) : _ = e[50];
612
+ let D;
613
+ e[51] !== T || e[52] !== _ ? (D = /* @__PURE__ */ v(Sa, { children: [
614
+ T,
615
+ _
616
+ ] }), e[51] = T, e[52] = _, e[53] = D) : D = e[53];
617
+ let Z;
618
+ return e[54] !== k || e[55] !== r || e[56] !== Y || e[57] !== D ? (Z = /* @__PURE__ */ v(Ca, { open: r, onClose: k, maxWidth: "sm", fullWidth: !0, children: [
619
+ $,
620
+ Y,
621
+ D
622
+ ] }), e[54] = k, e[55] = r, e[56] = Y, e[57] = D, e[58] = Z) : Z = e[58], Z;
623
+ }, Xa = (t) => {
624
+ const e = Ce(35), {
625
+ formData: r,
626
+ handleFieldChange: a,
627
+ errors: s
628
+ } = t, {
629
+ orgId: l
630
+ } = Ae(), [g, d] = oe(!1);
631
+ let f;
632
+ e[0] !== l ? (f = {
633
+ orgName: l
634
+ }, e[0] = l, e[1] = f) : f = e[1];
635
+ let m;
636
+ e[2] === Symbol.for("react.memo_cache_sentinel") ? (m = {
637
+ limit: 100
638
+ }, e[2] = m) : m = e[2];
639
+ const {
640
+ data: b,
641
+ isLoading: i,
642
+ refetch: c
643
+ } = ma(f, m);
644
+ let o;
645
+ e[3] !== b?.secrets ? (o = b?.secrets || [], e[3] = b?.secrets, e[4] = o) : o = e[4];
646
+ const u = o;
647
+ let h;
648
+ e[5] !== a ? (h = (G) => {
649
+ const K = G.target.value;
650
+ if (K === "__create_new__") {
651
+ d(!0);
652
+ return;
653
+ }
654
+ a("gitSecretRef", K || void 0);
655
+ }, e[5] = a, e[6] = h) : h = e[6];
656
+ const p = h;
657
+ let y;
658
+ e[7] !== a || e[8] !== c ? (y = (G) => {
659
+ a("gitSecretRef", G), c(), d(!1);
660
+ }, e[7] = a, e[8] = c, e[9] = y) : y = e[9];
661
+ const C = y, P = !!s.gitSecretRef, M = r.gitSecretRef || "";
662
+ let k;
663
+ e[10] !== i ? (k = i ? /* @__PURE__ */ n(Lt, { size: 20, sx: {
664
+ mr: 1
665
+ } }) : void 0, e[10] = i, e[11] = k) : k = e[11];
666
+ let $;
667
+ e[12] === Symbol.for("react.memo_cache_sentinel") ? ($ = /* @__PURE__ */ n(wt, { value: "", children: /* @__PURE__ */ n("em", { children: "Public Repo (None)" }) }), e[12] = $) : $ = e[12];
668
+ let E;
669
+ e[13] !== u ? (E = u.map(Ja), e[13] = u, e[14] = E) : E = e[14];
670
+ let V;
671
+ e[15] === Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ n(wt, { value: "__create_new__", children: /* @__PURE__ */ n(ne, { direction: "row", spacing: 1, alignItems: "center", children: /* @__PURE__ */ n(Ee, { variant: "text", size: "small", startIcon: /* @__PURE__ */ n(Me, { size: 16 }), sx: {
672
+ textTransform: "none",
673
+ p: 0
674
+ }, children: "Create new git secret" }) }) }), e[15] = V) : V = e[15];
675
+ let L;
676
+ e[16] !== p || e[17] !== i || e[18] !== E || e[19] !== M || e[20] !== k ? (L = /* @__PURE__ */ v(wn, { id: "gitSecretRef", value: M, onChange: p, displayEmpty: !0, disabled: i, startAdornment: k, children: [
677
+ $,
678
+ E,
679
+ V
680
+ ] }), e[16] = p, e[17] = i, e[18] = E, e[19] = M, e[20] = k, e[21] = L) : L = e[21];
681
+ let O;
682
+ e[22] !== s.gitSecretRef ? (O = s.gitSecretRef ? /* @__PURE__ */ n(En, { error: !0, children: s.gitSecretRef }) : /* @__PURE__ */ n(En, { children: "Select a git secret for private repository authentication" }), e[22] = s.gitSecretRef, e[23] = O) : O = e[23];
683
+ let B;
684
+ e[24] !== L || e[25] !== O || e[26] !== P ? (B = /* @__PURE__ */ n(w.ElementWrapper, { label: "Git Secret (Optional)", name: "gitSecretRef", children: /* @__PURE__ */ v(sr, { fullWidth: !0, error: P, children: [
685
+ L,
686
+ O
687
+ ] }) }), e[24] = L, e[25] = O, e[26] = P, e[27] = B) : B = e[27];
688
+ let A;
689
+ e[28] === Symbol.for("react.memo_cache_sentinel") ? (A = () => d(!1), e[28] = A) : A = e[28];
690
+ let F;
691
+ e[29] !== C || e[30] !== g ? (F = /* @__PURE__ */ n(Qa, { open: g, onClose: A, onSecretCreated: C }), e[29] = C, e[30] = g, e[31] = F) : F = e[31];
692
+ let R;
693
+ return e[32] !== B || e[33] !== F ? (R = /* @__PURE__ */ v(Ln, { children: [
694
+ B,
695
+ F
696
+ ] }), e[32] = B, e[33] = F, e[34] = R) : R = e[34], R;
697
+ };
698
+ function Ja(t) {
699
+ return /* @__PURE__ */ n(wt, { value: t.name, children: /* @__PURE__ */ n(U, { children: t.name }) }, t.name);
700
+ }
701
+ function ei(t) {
702
+ return t?.length ? [...t].sort((e, r) => new Date(r.deployedAt ?? 0).getTime() - new Date(e.deployedAt ?? 0).getTime())[0] ?? null : null;
703
+ }
704
+ function ti(t) {
705
+ return t < 0.01 ? `$${t.toFixed(6)}` : `$${t.toFixed(2)}`;
706
+ }
707
+ function or(t, e) {
708
+ if (!e) return "";
709
+ const a = {
710
+ minute: "min",
711
+ hour: "hr",
712
+ day: "day"
713
+ }[e.toLowerCase()] ?? e;
714
+ return t && t !== 1 ? `${t} ${a}` : a;
715
+ }
716
+ const ni = (t) => {
717
+ const e = Ce(26), {
718
+ rateLimiting: r
719
+ } = t;
720
+ if (!r) {
721
+ let p;
722
+ return e[0] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ v(U, { variant: "caption", color: "text.secondary", children: [
723
+ "Rate Limiting: ",
724
+ /* @__PURE__ */ n(U, { component: "span", variant: "body2", color: "text.disabled", children: "Not configured" })
725
+ ] }), e[0] = p) : p = e[0], p;
726
+ }
727
+ const a = r.consumerLevel, s = r.providerLevel, l = a?.globalEnabled ?? !1, g = l && (a?.request != null || a?.token != null || a?.cost != null);
728
+ if (!l && !s?.globalEnabled) {
729
+ let p;
730
+ return e[1] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ v(U, { variant: "caption", color: "text.secondary", children: [
731
+ "Rate Limiting: ",
732
+ /* @__PURE__ */ n(U, { component: "span", variant: "body2", color: "text.disabled", children: "Configured (disabled)" })
733
+ ] }), e[1] = p) : p = e[1], p;
734
+ }
735
+ const d = g ? a : s, f = !g;
736
+ let m;
737
+ if (e[2] !== d) {
738
+ if (m = [], d?.request) {
739
+ const p = or(d.request.resetDuration, d.request.resetUnit);
740
+ let y;
741
+ e[4] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(Aa, { size: 12 }), e[4] = y) : y = e[4];
742
+ const C = `${d.request.limit.toLocaleString()}${p ? `/${p}` : ""}`;
743
+ let P;
744
+ e[5] !== C ? (P = {
745
+ icon: y,
746
+ label: "Requests",
747
+ value: C
748
+ }, e[5] = C, e[6] = P) : P = e[6], m.push(P);
749
+ }
750
+ if (d?.token) {
751
+ const p = or(d.token.resetDuration, d.token.resetUnit);
752
+ let y;
753
+ e[7] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(Ea, { size: 12 }), e[7] = y) : y = e[7];
754
+ const C = `${d.token.limit.toLocaleString()}${p ? `/${p}` : ""}`;
755
+ let P;
756
+ e[8] !== C ? (P = {
757
+ icon: y,
758
+ label: "Tokens",
759
+ value: C
760
+ }, e[8] = C, e[9] = P) : P = e[9], m.push(P);
761
+ }
762
+ if (d?.cost) {
763
+ const p = or(d.cost.resetDuration, d.cost.resetUnit);
764
+ let y;
765
+ e[10] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(wa, { size: 12 }), e[10] = y) : y = e[10];
766
+ const C = `${ti(d.cost.limit)}${p ? `/${p}` : ""}`;
767
+ let P;
768
+ e[11] !== C ? (P = {
769
+ icon: y,
770
+ label: "Budget",
771
+ value: C
772
+ }, e[11] = C, e[12] = P) : P = e[12], m.push(P);
773
+ }
774
+ e[2] = d, e[3] = m;
775
+ } else
776
+ m = e[3];
777
+ const b = f ? "Your Quota (org-wide limit):" : "Your Quota:";
778
+ let i;
779
+ e[13] !== b ? (i = /* @__PURE__ */ n(U, { variant: "caption", color: "text.secondary", children: b }), e[13] = b, e[14] = i) : i = e[14];
780
+ let c;
781
+ e[15] !== f ? (c = f && /* @__PURE__ */ n(In, { title: "No per-consumer limit is configured. The org-wide provider limit applies to all consumers.", placement: "top", arrow: !0, children: /* @__PURE__ */ n(J, { component: "span", sx: {
782
+ display: "inline-flex",
783
+ alignItems: "center",
784
+ color: "text.secondary",
785
+ cursor: "default"
786
+ }, children: /* @__PURE__ */ n(Va, { size: 12 }) }) }), e[15] = f, e[16] = c) : c = e[16];
787
+ let o;
788
+ e[17] !== i || e[18] !== c ? (o = /* @__PURE__ */ v(ne, { direction: "row", spacing: 0.5, alignItems: "center", children: [
789
+ i,
790
+ c
791
+ ] }), e[17] = i, e[18] = c, e[19] = o) : o = e[19];
792
+ let u;
793
+ e[20] !== f || e[21] !== m ? (u = m.length > 0 ? /* @__PURE__ */ n(ne, { direction: "row", spacing: 0.75, flexWrap: "wrap", children: m.map((p) => {
794
+ const {
795
+ icon: y,
796
+ label: C,
797
+ value: P
798
+ } = p;
799
+ return /* @__PURE__ */ n(Mt, { icon: /* @__PURE__ */ n(J, { component: "span", sx: {
800
+ display: "inline-flex",
801
+ alignItems: "center",
802
+ pl: 0.5
803
+ }, children: y }), label: `${C}: ${P}`, size: "small", variant: "outlined", color: f ? "default" : "primary", sx: {
804
+ fontVariantNumeric: "tabular-nums"
805
+ } }, C);
806
+ }) }) : /* @__PURE__ */ n(U, { variant: "body2", color: "text.secondary", children: "Enabled (no numeric limits set)" }), e[20] = f, e[21] = m, e[22] = u) : u = e[22];
807
+ let h;
808
+ return e[23] !== o || e[24] !== u ? (h = /* @__PURE__ */ v(ne, { spacing: 0.5, children: [
809
+ o,
810
+ u
811
+ ] }), e[23] = o, e[24] = u, e[25] = h) : h = e[25], h;
812
+ }, Zr = (t) => {
813
+ const e = Ce(58), {
814
+ provider: r,
815
+ isSelected: a,
816
+ templateInfo: s,
817
+ fallbackLabel: l
818
+ } = t, g = l === void 0 ? "Select provider" : l, d = r?.deployments;
819
+ let f, m, b, i, c, o, u, h, p, y, C;
820
+ if (e[0] !== g || e[1] !== a || e[2] !== r || e[3] !== d || e[4] !== s) {
821
+ const A = ei(d);
822
+ m = ne, p = "row", y = 2, C = 1, b = "center";
823
+ const F = a ? "primary.main" : "secondary.main", R = a ? "common.white" : "text.secondary";
824
+ let G;
825
+ e[16] !== F || e[17] !== R ? (G = {
826
+ height: 32,
827
+ width: 32,
828
+ backgroundColor: F,
829
+ color: R
830
+ }, e[16] = F, e[17] = R, e[18] = G) : G = e[18];
831
+ let K;
832
+ e[19] !== a ? (K = a ? /* @__PURE__ */ n(jr, { size: 16 }) : /* @__PURE__ */ n(ur, { size: 16 }), e[19] = a, e[20] = K) : K = e[20], e[21] !== G || e[22] !== K ? (i = /* @__PURE__ */ n($r, { sx: G, children: K }), e[21] = G, e[22] = K, e[23] = i) : i = e[23], f = ne, c = 0.25, o = 1;
833
+ const j = r?.name ?? g;
834
+ let x;
835
+ e[24] !== j ? (x = /* @__PURE__ */ v(U, { variant: "h6", children: [
836
+ j,
837
+ "  "
838
+ ] }), e[24] = j, e[25] = x) : x = e[25];
839
+ let I;
840
+ e[26] !== r || e[27] !== s ? (I = r?.template && /* @__PURE__ */ n(In, { title: "Provider template", placement: "top", arrow: !0, children: /* @__PURE__ */ n(Mt, { label: s?.displayName ?? r.template, size: "small", variant: "outlined", icon: s?.logoUrl ? /* @__PURE__ */ n(J, { component: "img", src: s.logoUrl, alt: s.displayName, sx: {
841
+ width: 14,
842
+ height: 14,
843
+ borderRadius: "100%"
844
+ } }) : void 0 }) }), e[26] = r, e[27] = s, e[28] = I) : I = e[28], e[29] !== x || e[30] !== I ? (u = /* @__PURE__ */ v(ne, { direction: "row", spacing: 0.25, alignItems: "center", children: [
845
+ x,
846
+ I
847
+ ] }), e[29] = x, e[30] = I, e[31] = u) : u = e[31], h = A?.deployedAt && /* @__PURE__ */ v(U, { variant: "caption", color: "text.secondary", children: [
848
+ "Deployed ",
849
+ ja(new Date(A.deployedAt), {
850
+ addSuffix: !0
851
+ })
852
+ ] }), e[0] = g, e[1] = a, e[2] = r, e[3] = d, e[4] = s, e[5] = f, e[6] = m, e[7] = b, e[8] = i, e[9] = c, e[10] = o, e[11] = u, e[12] = h, e[13] = p, e[14] = y, e[15] = C;
853
+ } else
854
+ f = e[5], m = e[6], b = e[7], i = e[8], c = e[9], o = e[10], u = e[11], h = e[12], p = e[13], y = e[14], C = e[15];
855
+ let P;
856
+ e[32] === Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ n($n, { orientation: "vertical" }), e[32] = P) : P = e[32];
857
+ const M = r?.rateLimiting;
858
+ let k;
859
+ e[33] !== M ? (k = /* @__PURE__ */ n(ni, { rateLimiting: M }), e[33] = M, e[34] = k) : k = e[34];
860
+ const $ = r?.policies?.length ? "text.primary" : "text.disabled";
861
+ let E;
862
+ e[35] !== r ? (E = r?.policies?.length ? /* @__PURE__ */ v(ne, { direction: "row", spacing: 0.25, flexWrap: "wrap", alignItems: "center", children: [
863
+ r.policies.slice(0, 3).map(ai),
864
+ r.policies.length > 3 && /* @__PURE__ */ n(In, { title: r.policies.join(", "), placement: "top", arrow: !0, children: /* @__PURE__ */ n(U, { variant: "caption", color: "text.secondary", children: ` +${r.policies.length - 3} more..` }) })
865
+ ] }) : "None", e[35] = r, e[36] = E) : E = e[36];
866
+ let V;
867
+ e[37] !== $ || e[38] !== E ? (V = /* @__PURE__ */ v(U, { variant: "caption", color: "text.secondary", children: [
868
+ "Guardrails:",
869
+ " ",
870
+ /* @__PURE__ */ n(U, { component: "span", variant: "body2", color: $, children: E })
871
+ ] }), e[37] = $, e[38] = E, e[39] = V) : V = e[39];
872
+ let L;
873
+ e[40] !== k || e[41] !== V ? (L = /* @__PURE__ */ v(ne, { direction: "column", spacing: 0.5, children: [
874
+ k,
875
+ V
876
+ ] }), e[40] = k, e[41] = V, e[42] = L) : L = e[42];
877
+ let O;
878
+ e[43] !== f || e[44] !== L || e[45] !== c || e[46] !== o || e[47] !== u || e[48] !== h ? (O = /* @__PURE__ */ v(f, { spacing: c, flexGrow: o, children: [
879
+ u,
880
+ h,
881
+ P,
882
+ L
883
+ ] }), e[43] = f, e[44] = L, e[45] = c, e[46] = o, e[47] = u, e[48] = h, e[49] = O) : O = e[49];
884
+ let B;
885
+ return e[50] !== m || e[51] !== b || e[52] !== i || e[53] !== O || e[54] !== p || e[55] !== y || e[56] !== C ? (B = /* @__PURE__ */ v(m, { direction: p, spacing: y, flexGrow: C, alignItems: b, children: [
886
+ i,
887
+ O
888
+ ] }), e[50] = m, e[51] = b, e[52] = i, e[53] = O, e[54] = p, e[55] = y, e[56] = C, e[57] = B) : B = e[57], B;
889
+ }, At = /^[A-Za-z_][A-Za-z0-9_]*$/, ri = (t) => {
890
+ const e = Ce(93), {
891
+ entry: r,
892
+ index: a,
893
+ providers: s,
894
+ templateMap: l,
895
+ environments: g,
896
+ agentNameUpper: d,
897
+ usedVarNames: f,
898
+ onOpenDrawer: m,
899
+ onRemove: b,
900
+ onUpdateEntry: i
901
+ } = t, [c, o] = oe(0), u = g[c]?.name ?? "", h = r.selectedProviderByEnv[u]?.uuid ?? null;
902
+ let p;
903
+ e[0] !== r.selectedProviderByEnv ? (p = Object.values(r.selectedProviderByEnv).find(ii), e[0] = r.selectedProviderByEnv, e[1] = p) : p = e[1];
904
+ const y = p;
905
+ let C;
906
+ e[2] !== y || e[3] !== a || e[4] !== s ? (C = (y ? s.find((re) => re.uuid === y.uuid)?.name : null) ?? `LLM Provider ${a + 1}`, e[2] = y, e[3] = a, e[4] = s, e[5] = C) : C = e[5];
907
+ const P = C;
908
+ let M;
909
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (M = (re, be) => o(be), e[6] = M) : M = e[6];
910
+ const k = M;
911
+ let $;
912
+ e[7] !== a || e[8] !== b ? ($ = (re) => {
913
+ re.stopPropagation(), b(a);
914
+ }, e[7] = a, e[8] = b, e[9] = $) : $ = e[9];
915
+ const E = $;
916
+ let V;
917
+ e[10] !== a || e[11] !== m || e[12] !== u ? (V = () => m(a, u), e[10] = a, e[11] = m, e[12] = u, e[13] = V) : V = e[13];
918
+ const L = V;
919
+ let O;
920
+ e[14] !== r || e[15] !== a || e[16] !== i ? (O = (re) => {
921
+ const be = re.target.value;
922
+ be !== "" && !At.test(be) || i(a, {
923
+ ...r,
924
+ urlVarName: be
925
+ });
926
+ }, e[14] = r, e[15] = a, e[16] = i, e[17] = O) : O = e[17];
927
+ const B = O;
928
+ let A;
929
+ e[18] !== r || e[19] !== a || e[20] !== i ? (A = (re) => {
930
+ const be = re.target.value;
931
+ be !== "" && !At.test(be) || i(a, {
932
+ ...r,
933
+ apikeyVarName: be
934
+ });
935
+ }, e[18] = r, e[19] = a, e[20] = i, e[21] = A) : A = e[21];
936
+ const F = A;
937
+ let R;
938
+ e[22] !== r || e[23] !== a || e[24] !== i ? (R = (re) => {
939
+ r.guardrails.some((we) => we.name === re.name && we.version === re.version) || i(a, {
940
+ ...r,
941
+ guardrails: [...r.guardrails, re]
942
+ });
943
+ }, e[22] = r, e[23] = a, e[24] = i, e[25] = R) : R = e[25];
944
+ const G = R;
945
+ let K;
946
+ e[26] !== r || e[27] !== a || e[28] !== i ? (K = (re) => {
947
+ i(a, {
948
+ ...r,
949
+ guardrails: r.guardrails.map((be) => be.name === re.name && be.version === re.version ? re : be)
950
+ });
951
+ }, e[26] = r, e[27] = a, e[28] = i, e[29] = K) : K = e[29];
952
+ const j = K;
953
+ let x;
954
+ e[30] !== r || e[31] !== a || e[32] !== i ? (x = (re, be) => {
955
+ i(a, {
956
+ ...r,
957
+ guardrails: r.guardrails.filter((we) => !(we.name === re && we.version === be))
958
+ });
959
+ }, e[30] = r, e[31] = a, e[32] = i, e[33] = x) : x = e[33];
960
+ const I = x;
961
+ let S;
962
+ e[34] === Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ n(Wr, { size: 18 }), e[34] = S) : S = e[34];
963
+ const W = `llm-provider-${a}-content`, Y = `llm-provider-${a}-header`;
964
+ let T;
965
+ e[35] !== P ? (T = /* @__PURE__ */ n(U, { variant: "subtitle2", children: P }), e[35] = P, e[36] = T) : T = e[36];
966
+ let N;
967
+ e[37] === Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ n(Fr, { size: 16 }), e[37] = N) : N = e[37];
968
+ let _;
969
+ e[38] !== E ? (_ = /* @__PURE__ */ n(pr, { size: "small", "aria-label": "Remove LLM provider", onClick: E, children: N }), e[38] = E, e[39] = _) : _ = e[39];
970
+ let D;
971
+ e[40] !== T || e[41] !== _ ? (D = /* @__PURE__ */ v(ne, { direction: "row", alignItems: "center", justifyContent: "space-between", flexGrow: 1, pr: 1, children: [
972
+ T,
973
+ _
974
+ ] }), e[40] = T, e[41] = _, e[42] = D) : D = e[42];
975
+ let Z;
976
+ e[43] !== W || e[44] !== Y || e[45] !== D ? (Z = /* @__PURE__ */ n(Mr, { expandIcon: S, "aria-controls": W, id: Y, children: D }), e[43] = W, e[44] = Y, e[45] = D, e[46] = Z) : Z = e[46];
977
+ let q;
978
+ e[47] !== g || e[48] !== c ? (q = g.length > 1 && /* @__PURE__ */ n(Lr, { value: c, onChange: k, sx: {
979
+ mb: 1
980
+ }, children: g.map(li) }), e[47] = g, e[48] = c, e[49] = q) : q = e[49];
981
+ let H;
982
+ e[50] !== h || e[51] !== g || e[52] !== L || e[53] !== s || e[54] !== c || e[55] !== u || e[56] !== l ? (H = /* @__PURE__ */ n(J, { children: h ? /* @__PURE__ */ n(w.CardButton, { onClick: L, selected: !0, children: /* @__PURE__ */ n(w.CardContent, { children: /* @__PURE__ */ n(Zr, { provider: s.find((re) => re.uuid === h) ?? null, isSelected: !0, templateInfo: l.get(s.find((re) => re.uuid === h)?.template ?? "") }) }) }) : /* @__PURE__ */ v(Ee, { variant: "outlined", size: "small", startIcon: /* @__PURE__ */ n(Me, { size: 16 }), onClick: L, children: [
983
+ "Select Provider for ",
984
+ g[c]?.displayName ?? u
985
+ ] }) }), e[50] = h, e[51] = g, e[52] = L, e[53] = s, e[54] = c, e[55] = u, e[56] = l, e[57] = H) : H = e[57];
986
+ let X;
987
+ e[58] === Symbol.for("react.memo_cache_sentinel") ? (X = /* @__PURE__ */ n(U, { variant: "subtitle2", gutterBottom: !0, children: "Environment Variables" }), e[58] = X) : X = e[58];
988
+ const ae = r.urlVarName ?? `${d}_${a + 1}_URL`, de = `${d}_${a + 1}_URL`;
989
+ let ce;
990
+ e[59] !== r.urlVarName || e[60] !== f ? (ce = r.urlVarName !== void 0 && !At.test(r.urlVarName) || r.urlVarName !== void 0 && f.has(r.urlVarName), e[59] = r.urlVarName, e[60] = f, e[61] = ce) : ce = e[61];
991
+ const me = r.urlVarName !== void 0 && !At.test(r.urlVarName) ? "Must match /^[A-Za-z_][A-Za-z0-9_]*$/" : r.urlVarName !== void 0 && f.has(r.urlVarName) ? "Name is already used by another provider" : void 0;
992
+ let ee;
993
+ e[62] !== B || e[63] !== ae || e[64] !== de || e[65] !== ce || e[66] !== me ? (ee = /* @__PURE__ */ n(w.ElementWrapper, { label: "URL variable name", name: "urlVarName", children: /* @__PURE__ */ n(ge, { size: "small", fullWidth: !0, value: ae, onChange: B, placeholder: de, error: ce, helperText: me }) }), e[62] = B, e[63] = ae, e[64] = de, e[65] = ce, e[66] = me, e[67] = ee) : ee = e[67];
994
+ const pe = r.apikeyVarName ?? `${d}_${a + 1}_API_KEY`, ye = `${d}_${a + 1}_API_KEY`;
995
+ let ie;
996
+ e[68] !== r.apikeyVarName || e[69] !== f ? (ie = r.apikeyVarName !== void 0 && !At.test(r.apikeyVarName) || r.apikeyVarName !== void 0 && f.has(r.apikeyVarName), e[68] = r.apikeyVarName, e[69] = f, e[70] = ie) : ie = e[70];
997
+ const le = r.apikeyVarName !== void 0 && !At.test(r.apikeyVarName) ? "Must match /^[A-Za-z_][A-Za-z0-9_]*$/" : r.apikeyVarName !== void 0 && f.has(r.apikeyVarName) ? "Name is already used by another provider" : void 0;
998
+ let ke;
999
+ e[71] !== F || e[72] !== pe || e[73] !== ye || e[74] !== ie || e[75] !== le ? (ke = /* @__PURE__ */ n(w.ElementWrapper, { label: "API key variable name", name: "apikeyVarName", children: /* @__PURE__ */ n(ge, { size: "small", fullWidth: !0, value: pe, onChange: F, placeholder: ye, error: ie, helperText: le }) }), e[71] = F, e[72] = pe, e[73] = ye, e[74] = ie, e[75] = le, e[76] = ke) : ke = e[76];
1000
+ let ue;
1001
+ e[77] !== ee || e[78] !== ke ? (ue = /* @__PURE__ */ v(J, { children: [
1002
+ X,
1003
+ /* @__PURE__ */ v(ne, { direction: "row", spacing: 2, children: [
1004
+ ee,
1005
+ ke
1006
+ ] })
1007
+ ] }), e[77] = ee, e[78] = ke, e[79] = ue) : ue = e[79];
1008
+ let ve;
1009
+ e[80] !== r.guardrails || e[81] !== G || e[82] !== j || e[83] !== I ? (ve = /* @__PURE__ */ n(Oa, { title: "Guardrails", description: "Add safety policies to enforce consistent protections.", addButtonLabel: "Add Guardrail", drawerAddTitle: "Add Guardrail", drawerEditTitle: "Edit Guardrail", drawerAddSubtitle: "Choose a guardrail to configure advanced options.", drawerEditSubtitle: "Update the guardrail configuration.", policyNoun: "guardrail", loadingLabel: "Loading guardrails...", searchPlaceholder: "Search guardrails...", catalogErrorLabel: "Failed to load guardrails.", emptySearchTitle: "No guardrails match your search", emptyCatalogTitle: "No guardrails available", emptyCatalogDescription: "No guardrail policies are available in the catalog.", policies: r.guardrails, onAdd: G, onEdit: j, onRemove: I }), e[80] = r.guardrails, e[81] = G, e[82] = j, e[83] = I, e[84] = ve) : ve = e[84];
1010
+ let he;
1011
+ e[85] !== q || e[86] !== H || e[87] !== ue || e[88] !== ve ? (he = /* @__PURE__ */ n(Dr, { children: /* @__PURE__ */ v(ne, { spacing: 3, children: [
1012
+ q,
1013
+ H,
1014
+ ue,
1015
+ ve
1016
+ ] }) }), e[85] = q, e[86] = H, e[87] = ue, e[88] = ve, e[89] = he) : he = e[89];
1017
+ let Pe;
1018
+ return e[90] !== Z || e[91] !== he ? (Pe = /* @__PURE__ */ v(Rr, { defaultExpanded: !0, children: [
1019
+ Z,
1020
+ he
1021
+ ] }), e[90] = Z, e[91] = he, e[92] = Pe) : Pe = e[92], Pe;
1022
+ }, Hr = ({
1023
+ llmProviders: t,
1024
+ setLLMProviders: e,
1025
+ agentDisplayName: r,
1026
+ initialEnvironmentName: a,
1027
+ isInitialEnvironmentLoading: s = !1,
1028
+ externalEnvKeys: l = /* @__PURE__ */ new Set()
1029
+ }) => {
1030
+ const {
1031
+ orgId: g
1032
+ } = Ae(), [d, f] = oe(null), [m, b] = oe(""), [i, c] = oe(!1), [o, u] = oe(""), [h, p] = oe(""), y = Ur(null), C = Vt(), {
1033
+ data: P = [],
1034
+ isLoading: M
1035
+ } = xr({
1036
+ orgName: g
1037
+ }), k = _e(() => a ? P.filter((T) => T.name === a) : [], [P, a]), $ = m ? P.find((T) => T.name === m)?.id : void 0, {
1038
+ data: E,
1039
+ isLoading: V
1040
+ } = pa({
1041
+ orgName: g
1042
+ }, {
1043
+ limit: 50,
1044
+ environmentId: $
1045
+ }), {
1046
+ data: L,
1047
+ isLoading: O
1048
+ } = ua({
1049
+ orgName: g
1050
+ }), B = V || O, A = _e(() => {
1051
+ const T = /* @__PURE__ */ new Map();
1052
+ for (const N of L?.templates ?? [])
1053
+ T.set(N.name, {
1054
+ displayName: N.name,
1055
+ logoUrl: N.metadata?.logoUrl
1056
+ }), T.set(N.id, {
1057
+ displayName: N.name,
1058
+ logoUrl: N.metadata?.logoUrl
1059
+ });
1060
+ return T;
1061
+ }, [L]), F = _e(() => (E?.entries ?? []).map((T) => ({
1062
+ uuid: T.uuid,
1063
+ id: T.handle,
1064
+ name: T.name,
1065
+ version: T.version,
1066
+ template: T.template,
1067
+ deployments: T.deployments ?? [],
1068
+ security: T.security,
1069
+ rateLimiting: T.rateLimiting,
1070
+ policies: T.policies ?? []
1071
+ })), [E]), R = r ? r.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT", G = d !== null ? t[d]?.selectedProviderByEnv[m]?.uuid ?? null : null, K = xe((T, N) => {
1072
+ f(T), b(N), c(!0);
1073
+ }, []), j = xe(() => {
1074
+ const T = k[0]?.name;
1075
+ T && (f(null), b(T), c(!0));
1076
+ }, [k]), x = xe(() => {
1077
+ y.current && (clearTimeout(y.current), y.current = null), c(!1), u(""), p("");
1078
+ }, []), I = xe((T, N) => {
1079
+ e((_) => {
1080
+ if (d === null) {
1081
+ if (k.length === 0) return _;
1082
+ const D = {};
1083
+ for (const q of k)
1084
+ D[q.name] = {
1085
+ uuid: T,
1086
+ handle: N
1087
+ };
1088
+ const Z = _.length;
1089
+ return [..._, {
1090
+ selectedProviderByEnv: D,
1091
+ urlVarName: `${R}_${Z + 1}_URL`,
1092
+ apikeyVarName: `${R}_${Z + 1}_API_KEY`,
1093
+ guardrails: []
1094
+ }];
1095
+ } else {
1096
+ const D = [..._], Z = D[d];
1097
+ return Z ? (D[d] = {
1098
+ ...Z,
1099
+ selectedProviderByEnv: {
1100
+ ...Z.selectedProviderByEnv,
1101
+ [m]: {
1102
+ uuid: T,
1103
+ handle: N
1104
+ }
1105
+ }
1106
+ }, D) : _;
1107
+ }
1108
+ }), y.current && (clearTimeout(y.current), y.current = null), c(!1), u(""), p("");
1109
+ }, [d, m, k, R, e]), S = xe((T) => {
1110
+ e((N) => N.filter((_, D) => D !== T));
1111
+ }, [e]), W = xe((T, N) => {
1112
+ e((_) => {
1113
+ const D = [..._];
1114
+ return D[T] = N, D;
1115
+ });
1116
+ }, [e]), Y = xe((T) => {
1117
+ const N = T.target.value;
1118
+ u(N), y.current && clearTimeout(y.current), y.current = setTimeout(() => p(N), 250);
1119
+ }, []);
1120
+ return /* @__PURE__ */ v(w.Section, { children: [
1121
+ /* @__PURE__ */ n(w.Subheader, { children: "LLM Providers (Optional)" }),
1122
+ /* @__PURE__ */ v(ne, { spacing: 1, children: [
1123
+ t.map((T, N) => {
1124
+ const _ = /* @__PURE__ */ new Set([...t.flatMap((D, Z) => Z === N ? [] : [D.urlVarName ?? `${R}_${Z + 1}_URL`, D.apikeyVarName ?? `${R}_${Z + 1}_API_KEY`]), ...Array.from(l)]);
1125
+ return /* @__PURE__ */ n(ri, { entry: T, index: N, providers: F, templateMap: A, environments: k, agentNameUpper: R, usedVarNames: _, onOpenDrawer: K, onRemove: S, onUpdateEntry: W }, N);
1126
+ }),
1127
+ /* @__PURE__ */ n(J, { sx: {
1128
+ pt: t.length > 0 ? 1 : 0
1129
+ }, children: /* @__PURE__ */ n(Ee, { variant: "outlined", size: "small", startIcon: /* @__PURE__ */ n(Me, { size: 16 }), onClick: j, disabled: M || s || V || k.length === 0, children: "Add" }) })
1130
+ ] }),
1131
+ /* @__PURE__ */ v(kr, { open: i, onClose: x, minWidth: 740, maxWidth: 740, children: [
1132
+ /* @__PURE__ */ n(_r, { icon: /* @__PURE__ */ n(_a, { size: 24 }), title: "Select Provider", onClose: x }),
1133
+ /* @__PURE__ */ n(Ar, { children: /* @__PURE__ */ v(ne, { children: [
1134
+ /* @__PURE__ */ n(U, { variant: "body2", color: "text.secondary", sx: {
1135
+ mb: 1
1136
+ }, children: d === null ? "Select a provider for this LLM configuration." : "Change the provider for this LLM configuration." }),
1137
+ /* @__PURE__ */ n(Ir, { placeholder: "Search providers", size: "small", fullWidth: !0, value: o, onChange: Y, sx: {
1138
+ mb: 1
1139
+ } }),
1140
+ /* @__PURE__ */ n(ne, { spacing: 1, sx: {
1141
+ flex: 1,
1142
+ overflowY: "auto"
1143
+ }, children: B ? /* @__PURE__ */ n(J, { sx: {
1144
+ display: "flex",
1145
+ justifyContent: "center",
1146
+ py: 4
1147
+ }, children: /* @__PURE__ */ n(Lt, { size: 32 }) }) : (() => {
1148
+ const T = F.filter((N) => {
1149
+ if (!h.trim()) return !0;
1150
+ const _ = h.toLowerCase();
1151
+ return N.name.toLowerCase().includes(_) || (N.template ?? "").toLowerCase().includes(_) || (A.get(N.template ?? "")?.displayName ?? "").toLowerCase().includes(_);
1152
+ });
1153
+ if (T.length === 0) {
1154
+ const N = !!h.trim();
1155
+ return /* @__PURE__ */ n(Vn.Container, { children: /* @__PURE__ */ n(Vn.EmptyState, { illustration: /* @__PURE__ */ n(zr, { size: 64 }), title: N ? "No LLM Service Providers match your search" : "No LLM Service Providers available", description: N ? "Try a different keyword or clear the search filter." : "No LLM Service Providers found in the catalog. Add LLM service providers from the organization LLM Service Providers page first.", action: !N && g ? /* @__PURE__ */ n(Ee, { variant: "contained", size: "small", startIcon: /* @__PURE__ */ n(hr, { size: 16 }), onClick: () => C(Ne(Se.children.org.children.llmProviders.children.add.path, {
1156
+ orgId: g
1157
+ })), children: "Add LLM Service Provider" }) : void 0 }) });
1158
+ }
1159
+ return T.map((N) => {
1160
+ const _ = G === N.uuid, D = () => I(N.uuid, N.id);
1161
+ return /* @__PURE__ */ n(w.CardButton, { onClick: D, selected: _, "aria-label": `${N.name}. ${_ ? "Selected" : "Click to select"}`, children: /* @__PURE__ */ n(w.CardContent, { children: /* @__PURE__ */ n(Zr, { provider: N, isSelected: _, templateInfo: A.get(N.template ?? "") }) }) }, N.uuid);
1162
+ });
1163
+ })() }),
1164
+ g && /* @__PURE__ */ v(Ln, { children: [
1165
+ /* @__PURE__ */ n($n, { sx: {
1166
+ mt: 2
1167
+ } }),
1168
+ /* @__PURE__ */ v(J, { component: "a", href: Ne(Se.children.org.children.llmProviders.children.add.path, {
1169
+ orgId: g
1170
+ }), target: "_blank", rel: "noopener noreferrer", sx: {
1171
+ display: "flex",
1172
+ alignItems: "center",
1173
+ gap: 1,
1174
+ pt: 1.5,
1175
+ color: "primary.main",
1176
+ textDecoration: "none",
1177
+ cursor: "pointer",
1178
+ "&:hover": {
1179
+ textDecoration: "underline"
1180
+ }
1181
+ }, children: [
1182
+ /* @__PURE__ */ n(Me, { size: 16 }),
1183
+ /* @__PURE__ */ n(U, { variant: "body2", color: "primary", children: "Add LLM Provider" }),
1184
+ /* @__PURE__ */ n(Or, { size: 14 })
1185
+ ] })
1186
+ ] })
1187
+ ] }) })
1188
+ ] })
1189
+ ] });
1190
+ };
1191
+ function ai(t) {
1192
+ return /* @__PURE__ */ n(Mt, { label: t, size: "small", variant: "outlined" }, t);
1193
+ }
1194
+ function ii(t) {
1195
+ return t != null;
1196
+ }
1197
+ function li(t, e) {
1198
+ return /* @__PURE__ */ n(Tr, { label: t.displayName ?? t.name, value: e }, t.name);
1199
+ }
1200
+ const Qr = (t) => {
1201
+ const e = Ce(26), {
1202
+ proxy: r,
1203
+ isSelected: a,
1204
+ fallbackLabel: s
1205
+ } = t, l = s === void 0 ? "Select MCP proxy" : s, g = a ? "primary.main" : "secondary.main", d = a ? "common.white" : "text.secondary";
1206
+ let f;
1207
+ e[0] !== g || e[1] !== d ? (f = {
1208
+ height: 32,
1209
+ width: 32,
1210
+ backgroundColor: g,
1211
+ color: d
1212
+ }, e[0] = g, e[1] = d, e[2] = f) : f = e[2];
1213
+ let m;
1214
+ e[3] !== a ? (m = a ? /* @__PURE__ */ n(jr, { size: 16 }) : /* @__PURE__ */ n(ur, { size: 16 }), e[3] = a, e[4] = m) : m = e[4];
1215
+ let b;
1216
+ e[5] !== f || e[6] !== m ? (b = /* @__PURE__ */ n($r, { sx: f, children: m }), e[5] = f, e[6] = m, e[7] = b) : b = e[7];
1217
+ const i = r?.name ?? l;
1218
+ let c;
1219
+ e[8] !== i ? (c = /* @__PURE__ */ v(U, { variant: "h6", children: [
1220
+ i,
1221
+ "  "
1222
+ ] }), e[8] = i, e[9] = c) : c = e[9];
1223
+ let o;
1224
+ e[10] !== r ? (o = r?.version && /* @__PURE__ */ n(Mt, { label: `v${r.version}`, size: "small", variant: "outlined" }), e[10] = r, e[11] = o) : o = e[11];
1225
+ let u;
1226
+ e[12] !== r ? (u = r?.status && /* @__PURE__ */ n(Mt, { label: r.status, size: "small", variant: "outlined", color: r.status === "deployed" ? "success" : "default" }), e[12] = r, e[13] = u) : u = e[13];
1227
+ let h;
1228
+ e[14] !== u || e[15] !== c || e[16] !== o ? (h = /* @__PURE__ */ v(ne, { direction: "row", spacing: 0.5, alignItems: "center", children: [
1229
+ c,
1230
+ o,
1231
+ u
1232
+ ] }), e[14] = u, e[15] = c, e[16] = o, e[17] = h) : h = e[17];
1233
+ let p;
1234
+ e[18] !== r ? (p = r?.description && /* @__PURE__ */ n(U, { variant: "caption", color: "text.secondary", children: r.description }), e[18] = r, e[19] = p) : p = e[19];
1235
+ let y;
1236
+ e[20] !== h || e[21] !== p ? (y = /* @__PURE__ */ v(ne, { spacing: 0.25, flexGrow: 1, children: [
1237
+ h,
1238
+ p
1239
+ ] }), e[20] = h, e[21] = p, e[22] = y) : y = e[22];
1240
+ let C;
1241
+ return e[23] !== y || e[24] !== b ? (C = /* @__PURE__ */ v(ne, { direction: "row", spacing: 2, flexGrow: 1, alignItems: "center", children: [
1242
+ b,
1243
+ y
1244
+ ] }), e[23] = y, e[24] = b, e[25] = C) : C = e[25], C;
1245
+ }, Et = /^[A-Za-z_][A-Za-z0-9_]*$/, oi = (t) => {
1246
+ const e = Ce(70), {
1247
+ entry: r,
1248
+ index: a,
1249
+ proxies: s,
1250
+ environments: l,
1251
+ agentNameUpper: g,
1252
+ usedVarNames: d,
1253
+ onOpenDrawer: f,
1254
+ onRemove: m,
1255
+ onUpdateEntry: b
1256
+ } = t, [i, c] = oe(0), o = l[i]?.name ?? "", u = l[i]?.displayName ?? o, h = r.selectedProxyByEnv[o]?.id ?? null, p = r.urlVarName !== void 0 && r.urlVarName === r.apikeyVarName;
1257
+ let y;
1258
+ e[0] !== r.selectedProxyByEnv ? (y = Object.values(r.selectedProxyByEnv).find(si), e[0] = r.selectedProxyByEnv, e[1] = y) : y = e[1];
1259
+ const P = y?.name ?? `MCP Proxy ${a + 1}`;
1260
+ let M;
1261
+ e[2] === Symbol.for("react.memo_cache_sentinel") ? (M = (ie, le) => c(le), e[2] = M) : M = e[2];
1262
+ const k = M;
1263
+ let $;
1264
+ e[3] !== a || e[4] !== m ? ($ = (ie) => {
1265
+ ie.stopPropagation(), m(a);
1266
+ }, e[3] = a, e[4] = m, e[5] = $) : $ = e[5];
1267
+ const E = $;
1268
+ let V;
1269
+ e[6] !== a || e[7] !== f || e[8] !== o ? (V = () => f(a, o), e[6] = a, e[7] = f, e[8] = o, e[9] = V) : V = e[9];
1270
+ const L = V;
1271
+ let O;
1272
+ e[10] !== r || e[11] !== a || e[12] !== b ? (O = (ie) => {
1273
+ const le = ie.target.value;
1274
+ le !== "" && !Et.test(le) || b(a, {
1275
+ ...r,
1276
+ urlVarName: le
1277
+ });
1278
+ }, e[10] = r, e[11] = a, e[12] = b, e[13] = O) : O = e[13];
1279
+ const B = O;
1280
+ let A;
1281
+ e[14] !== r || e[15] !== a || e[16] !== b ? (A = (ie) => {
1282
+ const le = ie.target.value;
1283
+ le !== "" && !Et.test(le) || b(a, {
1284
+ ...r,
1285
+ apikeyVarName: le
1286
+ });
1287
+ }, e[14] = r, e[15] = a, e[16] = b, e[17] = A) : A = e[17];
1288
+ const F = A;
1289
+ let R;
1290
+ e[18] === Symbol.for("react.memo_cache_sentinel") ? (R = /* @__PURE__ */ n(Wr, { size: 18 }), e[18] = R) : R = e[18];
1291
+ const G = `mcp-proxy-${a}-content`, K = `mcp-proxy-${a}-header`;
1292
+ let j;
1293
+ e[19] !== P ? (j = /* @__PURE__ */ n(U, { variant: "subtitle2", children: P }), e[19] = P, e[20] = j) : j = e[20];
1294
+ let x;
1295
+ e[21] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ n(Fr, { size: 16 }), e[21] = x) : x = e[21];
1296
+ let I;
1297
+ e[22] !== E ? (I = /* @__PURE__ */ n(pr, { size: "small", "aria-label": "Remove MCP proxy", onClick: E, children: x }), e[22] = E, e[23] = I) : I = e[23];
1298
+ let S;
1299
+ e[24] !== j || e[25] !== I ? (S = /* @__PURE__ */ v(ne, { direction: "row", alignItems: "center", justifyContent: "space-between", flexGrow: 1, pr: 1, children: [
1300
+ j,
1301
+ I
1302
+ ] }), e[24] = j, e[25] = I, e[26] = S) : S = e[26];
1303
+ let W;
1304
+ e[27] !== S || e[28] !== G || e[29] !== K ? (W = /* @__PURE__ */ n(Mr, { expandIcon: R, "aria-controls": G, id: K, children: S }), e[27] = S, e[28] = G, e[29] = K, e[30] = W) : W = e[30];
1305
+ let Y;
1306
+ e[31] !== l || e[32] !== i ? (Y = l.length > 1 && /* @__PURE__ */ n(Lr, { value: i, onChange: k, sx: {
1307
+ mb: 1
1308
+ }, children: l.map(ci) }), e[31] = l, e[32] = i, e[33] = Y) : Y = e[33];
1309
+ let T;
1310
+ e[34] !== h || e[35] !== L || e[36] !== s || e[37] !== u ? (T = /* @__PURE__ */ n(J, { children: h ? /* @__PURE__ */ n(w.CardButton, { onClick: L, selected: !0, children: /* @__PURE__ */ n(w.CardContent, { children: /* @__PURE__ */ n(Qr, { proxy: s.find((ie) => ie.id === h) ?? null, isSelected: !0 }) }) }) : /* @__PURE__ */ v(Ee, { variant: "outlined", size: "small", startIcon: /* @__PURE__ */ n(Me, { size: 16 }), onClick: L, children: [
1311
+ "Select MCP Proxy for ",
1312
+ u
1313
+ ] }) }), e[34] = h, e[35] = L, e[36] = s, e[37] = u, e[38] = T) : T = e[38];
1314
+ let N;
1315
+ e[39] === Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ n(U, { variant: "subtitle2", gutterBottom: !0, children: "Environment Variables" }), e[39] = N) : N = e[39];
1316
+ const _ = r.urlVarName ?? `${g}_MCP_${a + 1}_URL`, D = `${g}_MCP_${a + 1}_URL`;
1317
+ let Z;
1318
+ e[40] !== r.urlVarName || e[41] !== p || e[42] !== d ? (Z = r.urlVarName !== void 0 && !Et.test(r.urlVarName) || r.urlVarName !== void 0 && d.has(r.urlVarName) || p, e[40] = r.urlVarName, e[41] = p, e[42] = d, e[43] = Z) : Z = e[43];
1319
+ const q = r.urlVarName !== void 0 && !Et.test(r.urlVarName) ? "Must match /^[A-Za-z_][A-Za-z0-9_]*$/" : r.urlVarName !== void 0 && d.has(r.urlVarName) ? "Name is already used by another config" : p ? "URL and API key variable names must be different" : void 0;
1320
+ let H;
1321
+ e[44] !== B || e[45] !== _ || e[46] !== D || e[47] !== Z || e[48] !== q ? (H = /* @__PURE__ */ n(w.ElementWrapper, { label: "URL variable name", name: "urlVarName", children: /* @__PURE__ */ n(ge, { size: "small", fullWidth: !0, value: _, onChange: B, placeholder: D, error: Z, helperText: q }) }), e[44] = B, e[45] = _, e[46] = D, e[47] = Z, e[48] = q, e[49] = H) : H = e[49];
1322
+ const X = r.apikeyVarName ?? `${g}_MCP_${a + 1}_API_KEY`, ae = `${g}_MCP_${a + 1}_API_KEY`;
1323
+ let de;
1324
+ e[50] !== r.apikeyVarName || e[51] !== p || e[52] !== d ? (de = r.apikeyVarName !== void 0 && !Et.test(r.apikeyVarName) || r.apikeyVarName !== void 0 && d.has(r.apikeyVarName) || p, e[50] = r.apikeyVarName, e[51] = p, e[52] = d, e[53] = de) : de = e[53];
1325
+ const ce = r.apikeyVarName !== void 0 && !Et.test(r.apikeyVarName) ? "Must match /^[A-Za-z_][A-Za-z0-9_]*$/" : r.apikeyVarName !== void 0 && d.has(r.apikeyVarName) ? "Name is already used by another config" : p ? "URL and API key variable names must be different" : void 0;
1326
+ let me;
1327
+ e[54] !== F || e[55] !== X || e[56] !== ae || e[57] !== de || e[58] !== ce ? (me = /* @__PURE__ */ n(w.ElementWrapper, { label: "API key variable name", name: "apikeyVarName", children: /* @__PURE__ */ n(ge, { size: "small", fullWidth: !0, value: X, onChange: F, placeholder: ae, error: de, helperText: ce }) }), e[54] = F, e[55] = X, e[56] = ae, e[57] = de, e[58] = ce, e[59] = me) : me = e[59];
1328
+ let ee;
1329
+ e[60] !== H || e[61] !== me ? (ee = /* @__PURE__ */ v(J, { children: [
1330
+ N,
1331
+ /* @__PURE__ */ v(ne, { direction: "row", spacing: 2, children: [
1332
+ H,
1333
+ me
1334
+ ] })
1335
+ ] }), e[60] = H, e[61] = me, e[62] = ee) : ee = e[62];
1336
+ let pe;
1337
+ e[63] !== Y || e[64] !== T || e[65] !== ee ? (pe = /* @__PURE__ */ n(Dr, { children: /* @__PURE__ */ v(ne, { spacing: 3, children: [
1338
+ Y,
1339
+ T,
1340
+ ee
1341
+ ] }) }), e[63] = Y, e[64] = T, e[65] = ee, e[66] = pe) : pe = e[66];
1342
+ let ye;
1343
+ return e[67] !== W || e[68] !== pe ? (ye = /* @__PURE__ */ v(Rr, { defaultExpanded: !0, children: [
1344
+ W,
1345
+ pe
1346
+ ] }), e[67] = W, e[68] = pe, e[69] = ye) : ye = e[69], ye;
1347
+ }, Xr = ({
1348
+ mcpProxies: t,
1349
+ setMCPProxies: e,
1350
+ agentDisplayName: r,
1351
+ initialEnvironmentName: a,
1352
+ isInitialEnvironmentLoading: s = !1,
1353
+ externalEnvKeys: l = /* @__PURE__ */ new Set()
1354
+ }) => {
1355
+ const {
1356
+ orgId: g
1357
+ } = Ae(), [d, f] = oe(null), [m, b] = oe(""), [i, c] = oe(!1), [o, u] = oe(""), [h, p] = oe(""), y = Ur(null), C = Vt(), {
1358
+ data: P = [],
1359
+ isLoading: M
1360
+ } = xr({
1361
+ orgName: g
1362
+ }), k = _e(() => a ? P.filter((x) => x.name === a) : [], [P, a]), {
1363
+ data: $,
1364
+ isLoading: E
1365
+ } = ha({
1366
+ orgName: g
1367
+ }, {
1368
+ limit: 50
1369
+ }), V = _e(() => ($?.list ?? []).flatMap((x) => x.id ? [{
1370
+ id: x.id,
1371
+ name: x.name ?? x.id,
1372
+ version: x.version,
1373
+ description: x.description,
1374
+ status: x.status
1375
+ }] : []), [$]), L = r ? r.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT", O = d !== null ? t[d]?.selectedProxyByEnv[m]?.id ?? null : null, B = xe((x, I) => {
1376
+ f(x), b(I), c(!0);
1377
+ }, []), A = xe(() => {
1378
+ const x = k[0]?.name;
1379
+ x && (f(null), b(x), c(!0));
1380
+ }, [k]), F = xe(() => {
1381
+ y.current && (clearTimeout(y.current), y.current = null), c(!1), u(""), p("");
1382
+ }, []), R = xe((x, I) => {
1383
+ e((S) => {
1384
+ if (d === null) {
1385
+ if (k.length === 0) return S;
1386
+ const W = {};
1387
+ for (const T of k)
1388
+ W[T.name] = {
1389
+ id: x,
1390
+ name: I
1391
+ };
1392
+ const Y = S.length;
1393
+ return [...S, {
1394
+ selectedProxyByEnv: W,
1395
+ urlVarName: `${L}_MCP_${Y + 1}_URL`,
1396
+ apikeyVarName: `${L}_MCP_${Y + 1}_API_KEY`
1397
+ }];
1398
+ } else {
1399
+ const W = [...S], Y = W[d];
1400
+ return Y ? (W[d] = {
1401
+ ...Y,
1402
+ selectedProxyByEnv: {
1403
+ ...Y.selectedProxyByEnv,
1404
+ [m]: {
1405
+ id: x,
1406
+ name: I
1407
+ }
1408
+ }
1409
+ }, W) : S;
1410
+ }
1411
+ }), y.current && (clearTimeout(y.current), y.current = null), c(!1), u(""), p("");
1412
+ }, [d, m, k, L, e]), G = xe((x) => {
1413
+ e((I) => I.filter((S, W) => W !== x));
1414
+ }, [e]), K = xe((x, I) => {
1415
+ e((S) => {
1416
+ const W = [...S];
1417
+ return W[x] = I, W;
1418
+ });
1419
+ }, [e]), j = xe((x) => {
1420
+ const I = x.target.value;
1421
+ u(I), y.current && clearTimeout(y.current), y.current = setTimeout(() => p(I), 250);
1422
+ }, []);
1423
+ return /* @__PURE__ */ v(w.Section, { children: [
1424
+ /* @__PURE__ */ n(w.Subheader, { children: "MCP Proxies (Optional)" }),
1425
+ /* @__PURE__ */ v(ne, { spacing: 1, children: [
1426
+ t.map((x, I) => {
1427
+ const S = /* @__PURE__ */ new Set([...t.flatMap((W, Y) => Y === I ? [] : [W.urlVarName ?? `${L}_MCP_${Y + 1}_URL`, W.apikeyVarName ?? `${L}_MCP_${Y + 1}_API_KEY`]), ...Array.from(l)]);
1428
+ return /* @__PURE__ */ n(oi, { entry: x, index: I, proxies: V, environments: k, agentNameUpper: L, usedVarNames: S, onOpenDrawer: B, onRemove: G, onUpdateEntry: K }, I);
1429
+ }),
1430
+ /* @__PURE__ */ n(J, { sx: {
1431
+ pt: t.length > 0 ? 1 : 0
1432
+ }, children: /* @__PURE__ */ n(Ee, { variant: "outlined", size: "small", startIcon: /* @__PURE__ */ n(Me, { size: 16 }), onClick: A, disabled: M || s || E || k.length === 0, children: "Add" }) })
1433
+ ] }),
1434
+ /* @__PURE__ */ v(kr, { open: i, onClose: F, minWidth: 740, maxWidth: 740, children: [
1435
+ /* @__PURE__ */ n(_r, { icon: /* @__PURE__ */ n(Ia, { size: 24 }), title: "Select MCP Proxy", onClose: F }),
1436
+ /* @__PURE__ */ n(Ar, { children: /* @__PURE__ */ v(ne, { children: [
1437
+ /* @__PURE__ */ n(U, { variant: "body2", color: "text.secondary", sx: {
1438
+ mb: 1
1439
+ }, children: d === null ? "Select an MCP proxy for this configuration." : "Change the MCP proxy for this configuration." }),
1440
+ /* @__PURE__ */ n(Ir, { placeholder: "Search MCP proxies", size: "small", fullWidth: !0, value: o, onChange: j, sx: {
1441
+ mb: 1
1442
+ } }),
1443
+ /* @__PURE__ */ n(ne, { spacing: 1, sx: {
1444
+ flex: 1,
1445
+ overflowY: "auto"
1446
+ }, children: E ? /* @__PURE__ */ n(J, { sx: {
1447
+ display: "flex",
1448
+ justifyContent: "center",
1449
+ py: 4
1450
+ }, children: /* @__PURE__ */ n(Lt, { size: 32 }) }) : (() => {
1451
+ const x = V.filter((I) => {
1452
+ if (!h.trim()) return !0;
1453
+ const S = h.toLowerCase();
1454
+ return I.name.toLowerCase().includes(S) || (I.description ?? "").toLowerCase().includes(S);
1455
+ });
1456
+ if (x.length === 0) {
1457
+ const I = !!h.trim();
1458
+ return /* @__PURE__ */ n(Vn.Container, { children: /* @__PURE__ */ n(Vn.EmptyState, { illustration: /* @__PURE__ */ n(zr, { size: 64 }), title: I ? "No MCP proxies match your search" : "No MCP proxies available", description: I ? "Try a different keyword or clear the search filter." : "No MCP proxies found. Add MCP proxies from the organization MCP Proxies page first.", action: !I && g ? /* @__PURE__ */ n(Ee, { variant: "contained", size: "small", startIcon: /* @__PURE__ */ n(hr, { size: 16 }), onClick: () => C(Ne(Se.children.org.children.mcpProxies.children.add.path, {
1459
+ orgId: g
1460
+ })), children: "Add MCP Proxy" }) : void 0 }) });
1461
+ }
1462
+ return x.map((I) => {
1463
+ const S = O === I.id, W = () => R(I.id, I.name);
1464
+ return /* @__PURE__ */ n(w.CardButton, { onClick: W, selected: S, "aria-label": `${I.name}. ${S ? "Selected" : "Click to select"}`, children: /* @__PURE__ */ n(w.CardContent, { children: /* @__PURE__ */ n(Qr, { proxy: I, isSelected: S }) }) }, I.id);
1465
+ });
1466
+ })() }),
1467
+ g && /* @__PURE__ */ v(Ln, { children: [
1468
+ /* @__PURE__ */ n($n, { sx: {
1469
+ mt: 2
1470
+ } }),
1471
+ /* @__PURE__ */ v(J, { component: "a", href: Ne(Se.children.org.children.mcpProxies.children.add.path, {
1472
+ orgId: g
1473
+ }), target: "_blank", rel: "noopener noreferrer", sx: {
1474
+ display: "flex",
1475
+ alignItems: "center",
1476
+ gap: 1,
1477
+ pt: 1.5,
1478
+ color: "primary.main",
1479
+ textDecoration: "none",
1480
+ cursor: "pointer",
1481
+ "&:hover": {
1482
+ textDecoration: "underline"
1483
+ }
1484
+ }, children: [
1485
+ /* @__PURE__ */ n(Me, { size: 16 }),
1486
+ /* @__PURE__ */ n(U, { variant: "body2", color: "primary", children: "Add MCP Proxy" }),
1487
+ /* @__PURE__ */ n(Or, { size: 14 })
1488
+ ] })
1489
+ ] })
1490
+ ] }) })
1491
+ ] })
1492
+ ] });
1493
+ };
1494
+ function si(t) {
1495
+ return t != null;
1496
+ }
1497
+ function ci(t, e) {
1498
+ return /* @__PURE__ */ n(Tr, { label: t.displayName ?? t.name, value: e }, t.name);
1499
+ }
1500
+ const di = [{
1501
+ label: "Python",
1502
+ value: "python"
1503
+ }, {
1504
+ label: "Ballerina",
1505
+ value: "ballerina"
1506
+ }, {
1507
+ label: "Docker",
1508
+ value: "docker"
1509
+ }], Pr = `${$t.docsUrl ?? ""}${$t.instrumentationDocLinks?.manualInstrumentation ?? ""}`, mi = `${$t.docsUrl ?? ""}${$t.instrumentationDocLinks?.versionMapping ?? ""}`, pi = (t) => {
1510
+ const e = Ce(297), {
1511
+ formData: r,
1512
+ setFormData: a,
1513
+ errors: s,
1514
+ setFieldError: l,
1515
+ validateField: g,
1516
+ llmProviders: d,
1517
+ setLLMProviders: f,
1518
+ mcpProxies: m,
1519
+ setMCPProxies: b,
1520
+ initialEnvironmentName: i,
1521
+ isInitialEnvironmentLoading: c,
1522
+ firstEnvOnlyNotice: o
1523
+ } = t, u = c === void 0 ? !1 : c, {
1524
+ orgId: h,
1525
+ projectId: p
1526
+ } = Ae(), [y, C] = oe(!1);
1527
+ let P;
1528
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (P = async () => {
1529
+ try {
1530
+ await navigator.clipboard.writeText("import ballerinax/amp as _;"), C(!0), setTimeout(() => C(!1), 2e3);
1531
+ } catch {
1532
+ }
1533
+ }, e[0] = P) : P = e[0];
1534
+ const M = P, k = $t.featureFlags?.enablePrivateRepoSupport === !0;
1535
+ let $;
1536
+ e[1] !== h ? ($ = {
1537
+ orgName: h
1538
+ }, e[1] = h, e[2] = $) : $ = e[2];
1539
+ const {
1540
+ mutate: E,
1541
+ isPending: V
1542
+ } = cr($), L = h ?? "";
1543
+ let O;
1544
+ e[3] !== L ? (O = {
1545
+ orgName: L
1546
+ }, e[3] = L, e[4] = O) : O = e[4];
1547
+ const B = fa(O), A = B.data;
1548
+ let F;
1549
+ e: {
1550
+ if (!A) {
1551
+ let te;
1552
+ e[5] === Symbol.for("react.memo_cache_sentinel") ? (te = [], e[5] = te) : te = e[5], F = te;
1553
+ break e;
1554
+ }
1555
+ const z = r.languageVersion;
1556
+ if (!z) {
1557
+ F = A.instrumentation.versions;
1558
+ break e;
1559
+ }
1560
+ let Q;
1561
+ if (e[6] !== A.instrumentation.versions || e[7] !== z) {
1562
+ let te;
1563
+ e[9] !== z ? (te = (fe) => fe.pythonVersions.includes(z), e[9] = z, e[10] = te) : te = e[10], Q = A.instrumentation.versions.filter(te), e[6] = A.instrumentation.versions, e[7] = z, e[8] = Q;
1564
+ } else
1565
+ Q = e[8];
1566
+ F = Q;
1567
+ }
1568
+ const R = F;
1569
+ let G, K;
1570
+ e[11] !== A || e[12] !== a ? (G = () => {
1571
+ if (!A)
1572
+ return;
1573
+ const z = new Set(A.python.supportedVersions);
1574
+ a((Q) => {
1575
+ const te = {
1576
+ ...Q
1577
+ };
1578
+ let fe = !1;
1579
+ return (Q.languageVersion == null || !z.has(Q.languageVersion)) && (te.languageVersion = A.python.defaultVersion, fe = !0), Q.instrumentationVersion == null && (te.instrumentationVersion = A.instrumentation.defaultVersion, fe = !0), fe ? te : Q;
1580
+ });
1581
+ }, K = [A, a], e[11] = A, e[12] = a, e[13] = G, e[14] = K) : (G = e[13], K = e[14]), $e(G, K);
1582
+ let j, x;
1583
+ e[15] !== A || e[16] !== r.instrumentationVersion || e[17] !== r.languageVersion || e[18] !== a ? (x = () => {
1584
+ if (!A)
1585
+ return;
1586
+ const z = r.languageVersion;
1587
+ if (!z)
1588
+ return;
1589
+ const Q = A.instrumentation.versions.filter((Ve) => Ve.pythonVersions.includes(z)), te = r.instrumentationVersion;
1590
+ if (te != null && Q.some((Ve) => Ve.version === te))
1591
+ return;
1592
+ let _n = null;
1593
+ if (Q.length > 0) {
1594
+ const Ve = A.instrumentation.defaultVersion;
1595
+ _n = Q.some((ar) => ar.version === Ve) ? Ve : Q[0].version;
1596
+ }
1597
+ a((Ve) => ({
1598
+ ...Ve,
1599
+ instrumentationVersion: _n
1600
+ }));
1601
+ }, j = [A, r.languageVersion, r.instrumentationVersion, a], e[15] = A, e[16] = r.instrumentationVersion, e[17] = r.languageVersion, e[18] = a, e[19] = j, e[20] = x) : (j = e[19], x = e[20]), $e(x, j);
1602
+ let I;
1603
+ e[21] !== l || e[22] !== a || e[23] !== g ? (I = (z, Q) => {
1604
+ a((te) => {
1605
+ const fe = {
1606
+ ...te,
1607
+ [z]: Q
1608
+ }, _n = g(z, Q, fe);
1609
+ if (l(z, _n), z === "language")
1610
+ if (Q === "python") {
1611
+ l("dockerfilePath", void 0);
1612
+ const Ve = g("runCommand", fe.runCommand, fe), ar = g("languageVersion", fe.languageVersion, fe);
1613
+ l("runCommand", Ve), l("languageVersion", ar);
1614
+ } else if (Q === "docker") {
1615
+ l("runCommand", void 0), l("languageVersion", void 0);
1616
+ const Ve = g("dockerfilePath", fe.dockerfilePath, fe);
1617
+ l("dockerfilePath", Ve);
1618
+ } else
1619
+ Q === "ballerina" && (l("runCommand", void 0), l("languageVersion", void 0), l("dockerfilePath", void 0));
1620
+ return fe;
1621
+ });
1622
+ }, e[21] = l, e[22] = a, e[23] = g, e[24] = I) : I = e[24];
1623
+ const S = I;
1624
+ let W;
1625
+ e[25] !== E || e[26] !== S || e[27] !== p ? (W = dr.debounce((z) => {
1626
+ if (z.length < 3) {
1627
+ S("name", "");
1628
+ return;
1629
+ }
1630
+ E({
1631
+ displayName: z,
1632
+ resourceType: "agent",
1633
+ projectName: p
1634
+ }, {
1635
+ onSuccess: (Q) => {
1636
+ S("name", Q.name);
1637
+ },
1638
+ onError: ui
1639
+ });
1640
+ }, 500), e[25] = E, e[26] = S, e[27] = p, e[28] = W) : W = e[28];
1641
+ const Y = W;
1642
+ let T, N;
1643
+ e[29] !== Y ? (T = () => () => {
1644
+ Y.cancel();
1645
+ }, N = [Y], e[29] = Y, e[30] = T, e[31] = N) : (T = e[30], N = e[31]), $e(T, N);
1646
+ let _, D;
1647
+ e[32] !== Y || e[33] !== r.displayName || e[34] !== S ? (_ = () => {
1648
+ r.displayName && r.displayName.length >= 3 ? Y(r.displayName) : (Y.cancel(), S("name", ""));
1649
+ }, D = [r.displayName, S, Y], e[32] = Y, e[33] = r.displayName, e[34] = S, e[35] = _, e[36] = D) : (_ = e[35], D = e[36]), $e(_, D);
1650
+ let Z;
1651
+ e[37] === Symbol.for("react.memo_cache_sentinel") ? (Z = /* @__PURE__ */ n(w.Subheader, { children: "Agent Details" }), e[37] = Z) : Z = e[37];
1652
+ let q;
1653
+ e[38] !== S ? (q = (z) => S("displayName", z.target.value), e[38] = S, e[39] = q) : q = e[39];
1654
+ const H = !!s.displayName;
1655
+ let X;
1656
+ e[40] !== s.displayName || e[41] !== V ? (X = V ? /* @__PURE__ */ v(ne, { direction: "row", alignItems: "center", gap: 1, children: [
1657
+ /* @__PURE__ */ n(Lt, { size: 12 }),
1658
+ /* @__PURE__ */ n(U, { variant: "caption", children: "Validating name..." })
1659
+ ] }) : s.displayName || "A name for your agent", e[40] = s.displayName, e[41] = V, e[42] = X) : X = e[42];
1660
+ let ae;
1661
+ e[43] !== r.displayName || e[44] !== q || e[45] !== H || e[46] !== X ? (ae = /* @__PURE__ */ n(w.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ n(ge, { id: "displayName", placeholder: "e.g., Customer Support Agent", value: r.displayName, onChange: q, error: H, helperText: X, fullWidth: !0 }) }), e[43] = r.displayName, e[44] = q, e[45] = H, e[46] = X, e[47] = ae) : ae = e[47];
1662
+ const de = r.description || "";
1663
+ let ce;
1664
+ e[48] !== S ? (ce = (z) => S("description", z.target.value), e[48] = S, e[49] = ce) : ce = e[49];
1665
+ const me = !!s.description;
1666
+ let ee;
1667
+ e[50] !== s.description || e[51] !== de || e[52] !== ce || e[53] !== me ? (ee = /* @__PURE__ */ n(w.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ n(ge, { id: "description", placeholder: "Short description of what this agent does", multiline: !0, minRows: 2, maxRows: 6, value: de, onChange: ce, error: me, helperText: s.description, fullWidth: !0 }) }), e[50] = s.description, e[51] = de, e[52] = ce, e[53] = me, e[54] = ee) : ee = e[54];
1668
+ let pe;
1669
+ e[55] !== r.labels ? (pe = r.labels ?? {}, e[55] = r.labels, e[56] = pe) : pe = e[56];
1670
+ let ye;
1671
+ e[57] !== S ? (ye = (z) => S("labels", z), e[57] = S, e[58] = ye) : ye = e[58];
1672
+ let ie;
1673
+ e[59] !== pe || e[60] !== ye ? (ie = /* @__PURE__ */ n(w.ElementWrapper, { label: "Labels (optional)", name: "labels", children: /* @__PURE__ */ n(fr, { hideTitle: !0, description: "Attach key/value labels to organize and filter agents.", value: pe, onChange: ye }) }), e[59] = pe, e[60] = ye, e[61] = ie) : ie = e[61];
1674
+ let le;
1675
+ e[62] !== ae || e[63] !== ee || e[64] !== ie ? (le = /* @__PURE__ */ v(w.Section, { children: [
1676
+ Z,
1677
+ /* @__PURE__ */ v(w.Stack, { spacing: 2, children: [
1678
+ ae,
1679
+ ee,
1680
+ ie
1681
+ ] })
1682
+ ] }), e[62] = ae, e[63] = ee, e[64] = ie, e[65] = le) : le = e[65];
1683
+ let ke;
1684
+ e[66] === Symbol.for("react.memo_cache_sentinel") ? (ke = /* @__PURE__ */ n(w.Subheader, { children: "Repository Details" }), e[66] = ke) : ke = e[66];
1685
+ let ue;
1686
+ e[67] !== S ? (ue = (z) => S("repositoryUrl", z.target.value), e[67] = S, e[68] = ue) : ue = e[68];
1687
+ const ve = !!s.repositoryUrl;
1688
+ let he;
1689
+ e[69] !== s.repositoryUrl || e[70] !== r.repositoryUrl || e[71] !== ue || e[72] !== ve ? (he = /* @__PURE__ */ n(w.ElementWrapper, { label: "GitHub Repository", name: "repositoryUrl", children: /* @__PURE__ */ n(ge, { id: "repositoryUrl", placeholder: "https://github.com/username/repo", value: r.repositoryUrl, onChange: ue, error: ve, helperText: s.repositoryUrl, fullWidth: !0 }) }), e[69] = s.repositoryUrl, e[70] = r.repositoryUrl, e[71] = ue, e[72] = ve, e[73] = he) : he = e[73];
1690
+ let Pe;
1691
+ e[74] !== s || e[75] !== r || e[76] !== S ? (Pe = k && /* @__PURE__ */ n(Xa, { formData: r, handleFieldChange: S, errors: s }), e[74] = s, e[75] = r, e[76] = S, e[77] = Pe) : Pe = e[77];
1692
+ let re;
1693
+ e[78] !== S ? (re = (z) => S("branch", z.target.value), e[78] = S, e[79] = re) : re = e[79];
1694
+ const be = !!s.branch;
1695
+ let we;
1696
+ e[80] !== s.branch || e[81] !== r.branch || e[82] !== re || e[83] !== be ? (we = /* @__PURE__ */ n(w.ElementWrapper, { label: "Branch", name: "branch", children: /* @__PURE__ */ n(ge, { id: "branch", placeholder: "main", value: r.branch, onChange: re, error: be, helperText: s.branch, fullWidth: !0 }) }), e[80] = s.branch, e[81] = r.branch, e[82] = re, e[83] = be, e[84] = we) : we = e[84];
1697
+ let Re;
1698
+ e[85] !== S ? (Re = (z) => S("appPath", z.target.value), e[85] = S, e[86] = Re) : Re = e[86];
1699
+ const Mn = !!s.appPath;
1700
+ let Ue;
1701
+ e[87] !== s.appPath || e[88] !== r.appPath || e[89] !== Re || e[90] !== Mn ? (Ue = /* @__PURE__ */ n(w.ElementWrapper, { label: "Project Path", name: "appPath", children: /* @__PURE__ */ n(ge, { id: "appPath", placeholder: "my-agent", value: r.appPath, onChange: Re, error: Mn, helperText: s.appPath, fullWidth: !0 }) }), e[87] = s.appPath, e[88] = r.appPath, e[89] = Re, e[90] = Mn, e[91] = Ue) : Ue = e[91];
1702
+ let ze;
1703
+ e[92] !== we || e[93] !== Ue ? (ze = /* @__PURE__ */ v(w.Stack, { direction: "row", spacing: 2, children: [
1704
+ we,
1705
+ Ue
1706
+ ] }), e[92] = we, e[93] = Ue, e[94] = ze) : ze = e[94];
1707
+ let Oe;
1708
+ e[95] !== he || e[96] !== Pe || e[97] !== ze ? (Oe = /* @__PURE__ */ v(w.Section, { children: [
1709
+ ke,
1710
+ /* @__PURE__ */ v(w.Stack, { spacing: 2, children: [
1711
+ he,
1712
+ Pe,
1713
+ ze
1714
+ ] })
1715
+ ] }), e[95] = he, e[96] = Pe, e[97] = ze, e[98] = Oe) : Oe = e[98];
1716
+ let Dt;
1717
+ e[99] === Symbol.for("react.memo_cache_sentinel") ? (Dt = /* @__PURE__ */ n(w.Subheader, { children: "Build Details" }), e[99] = Dt) : Dt = e[99];
1718
+ let je;
1719
+ e[100] !== r.language || e[101] !== S ? (je = di.map((z) => {
1720
+ const Q = r.language === z.value;
1721
+ return /* @__PURE__ */ n(w.CardButton, { onClick: () => S("language", z.value), selected: Q, children: /* @__PURE__ */ n(w.CardHeader, { title: /* @__PURE__ */ v(w.Stack, { direction: "row", spacing: 2, justifyContent: "center", alignItems: "center", children: [
1722
+ /* @__PURE__ */ n(ga, { language: z.value }),
1723
+ /* @__PURE__ */ n(w.Body, { children: z.label })
1724
+ ] }) }) }, z.value);
1725
+ }), e[100] = r.language, e[101] = S, e[102] = je) : je = e[102];
1726
+ let We;
1727
+ e[103] !== je ? (We = /* @__PURE__ */ n(w.Stack, { direction: "row", spacing: 2, children: je }), e[103] = je, e[104] = We) : We = e[104];
1728
+ const Dn = r.language === "python";
1729
+ let Fe;
1730
+ e[105] !== S ? (Fe = (z) => S("runCommand", z.target.value), e[105] = S, e[106] = Fe) : Fe = e[106];
1731
+ const Rn = !!s.runCommand, Un = s.runCommand || "Dependencies auto-install from package.json, requirements.txt, or pyproject.toml";
1732
+ let Be;
1733
+ e[107] !== r.runCommand || e[108] !== Fe || e[109] !== Rn || e[110] !== Un ? (Be = /* @__PURE__ */ n(w.ElementWrapper, { label: "Start Command", name: "runCommand", children: /* @__PURE__ */ n(ge, { id: "runCommand", placeholder: "python main.py", value: r.runCommand, onChange: Fe, error: Rn, helperText: Un, fullWidth: !0 }) }), e[107] = r.runCommand, e[108] = Fe, e[109] = Rn, e[110] = Un, e[111] = Be) : Be = e[111];
1734
+ const zn = !!s.languageVersion, On = r.languageVersion || "";
1735
+ let Ge;
1736
+ e[112] !== S ? (Ge = (z) => S("languageVersion", z.target.value), e[112] = S, e[113] = Ge) : Ge = e[113];
1737
+ const jn = !A;
1738
+ let Ke;
1739
+ e[114] !== A?.python.supportedVersions ? (Ke = A?.python.supportedVersions ?? [], e[114] = A?.python.supportedVersions, e[115] = Ke) : Ke = e[115];
1740
+ let qe;
1741
+ e[116] !== Ke ? (qe = Ke.map(hi), e[116] = Ke, e[117] = qe) : qe = e[117];
1742
+ let Ye;
1743
+ e[118] !== On || e[119] !== Ge || e[120] !== jn || e[121] !== qe ? (Ye = /* @__PURE__ */ n(wn, { id: "languageVersion", value: On, onChange: Ge, disabled: jn, children: qe }), e[118] = On, e[119] = Ge, e[120] = jn, e[121] = qe, e[122] = Ye) : Ye = e[122];
1744
+ const Wn = s.languageVersion || (B.isError ? "Could not load supported Python versions; retry by refreshing." : "Python runtime version");
1745
+ let Ze;
1746
+ e[123] !== Wn ? (Ze = /* @__PURE__ */ n(En, { children: Wn }), e[123] = Wn, e[124] = Ze) : Ze = e[124];
1747
+ let He;
1748
+ e[125] !== zn || e[126] !== Ye || e[127] !== Ze ? (He = /* @__PURE__ */ n(w.ElementWrapper, { label: "Language Version", name: "languageVersion", children: /* @__PURE__ */ v(sr, { fullWidth: !0, error: zn, children: [
1749
+ Ye,
1750
+ Ze
1751
+ ] }) }), e[125] = zn, e[126] = Ye, e[127] = Ze, e[128] = He) : He = e[128];
1752
+ let Qe;
1753
+ e[129] !== Be || e[130] !== He ? (Qe = /* @__PURE__ */ v(w.Stack, { direction: "row", spacing: 2, children: [
1754
+ Be,
1755
+ He
1756
+ ] }), e[129] = Be, e[130] = He, e[131] = Qe) : Qe = e[131];
1757
+ const Fn = r.enableAutoInstrumentation ?? !0;
1758
+ let Xe;
1759
+ e[132] !== S ? (Xe = (z) => S("enableAutoInstrumentation", z.target.checked), e[132] = S, e[133] = Xe) : Xe = e[133];
1760
+ let Je;
1761
+ e[134] !== Fn || e[135] !== Xe ? (Je = /* @__PURE__ */ n(vr, { control: /* @__PURE__ */ n(br, { checked: Fn, onChange: Xe }), label: "Enable auto instrumentation" }), e[134] = Fn, e[135] = Xe, e[136] = Je) : Je = e[136];
1762
+ const Bn = r.enableAutoInstrumentation !== !1;
1763
+ let Rt;
1764
+ e[137] === Symbol.for("react.memo_cache_sentinel") ? (Rt = /* @__PURE__ */ n(U, { variant: "body2", color: "text.secondary", children: "Automatically adds OTEL tracing instrumentation to your agent for observability." }), e[137] = Rt) : Rt = e[137];
1765
+ let et;
1766
+ e[138] !== A || e[139] !== R || e[140] !== s.instrumentationVersion || e[141] !== r.instrumentationVersion || e[142] !== r.languageVersion || e[143] !== S ? (et = /* @__PURE__ */ v(ne, { spacing: 1, children: [
1767
+ Rt,
1768
+ R.length === 0 && A ? /* @__PURE__ */ v(Ie, { severity: "info", sx: {
1769
+ mt: 1
1770
+ }, children: [
1771
+ "No AMP-provided instrumentation is available for Python",
1772
+ " ",
1773
+ r.languageVersion ?? "the selected version",
1774
+ ". You can still deploy this agent and instrument it manually."
1775
+ ] }) : /* @__PURE__ */ n(w.ElementWrapper, { label: "AMP Instrumentation Version", name: "instrumentationVersion", children: /* @__PURE__ */ v(sr, { sx: {
1776
+ minWidth: 200
1777
+ }, error: !!s.instrumentationVersion, children: [
1778
+ /* @__PURE__ */ n(wn, { id: "instrumentationVersion", value: r.instrumentationVersion || "", onChange: (z) => S("instrumentationVersion", z.target.value), disabled: !A, children: R.map(fi) }),
1779
+ /* @__PURE__ */ n(En, { children: s.instrumentationVersion || "Pins the init-container image and the bundled OpenLLMetry SDK version." })
1780
+ ] }) })
1781
+ ] }), e[138] = A, e[139] = R, e[140] = s.instrumentationVersion, e[141] = r.instrumentationVersion, e[142] = r.languageVersion, e[143] = S, e[144] = et) : et = e[144];
1782
+ let tt;
1783
+ e[145] !== Bn || e[146] !== et ? (tt = /* @__PURE__ */ n(Te, { in: Bn, children: et }), e[145] = Bn, e[146] = et, e[147] = tt) : tt = e[147];
1784
+ const Gn = r.enableAutoInstrumentation === !1;
1785
+ let Ut, zt;
1786
+ e[148] === Symbol.for("react.memo_cache_sentinel") ? (Ut = {
1787
+ mt: 1
1788
+ }, zt = /* @__PURE__ */ n(U, { variant: "subtitle2", children: "Tracing Support for Python Agents" }), e[148] = Ut, e[149] = zt) : (Ut = e[148], zt = e[149]);
1789
+ let Ot;
1790
+ e[150] === Symbol.for("react.memo_cache_sentinel") ? (Ot = {
1791
+ mt: 1
1792
+ }, e[150] = Ot) : Ot = e[150];
1793
+ let jt;
1794
+ e[151] === Symbol.for("react.memo_cache_sentinel") ? (jt = /* @__PURE__ */ n(U, { component: "a", href: Pr, target: "_blank", rel: "noopener noreferrer", sx: {
1795
+ color: "primary.main"
1796
+ }, children: "manual instrumentation contract" }), e[151] = jt) : jt = e[151];
1797
+ let Wt;
1798
+ e[152] === Symbol.for("react.memo_cache_sentinel") ? (Wt = /* @__PURE__ */ n(U, { component: "code", sx: {
1799
+ bgcolor: "action.hover",
1800
+ px: 0.5,
1801
+ borderRadius: 0.5
1802
+ }, children: "amp-instrumentation" }), e[152] = Wt) : Wt = e[152];
1803
+ let Ft;
1804
+ e[153] === Symbol.for("react.memo_cache_sentinel") ? (Ft = /* @__PURE__ */ v(U, { variant: "body2", sx: Ot, children: [
1805
+ "With auto-instrumentation disabled, you can still manually instrument your Python agent using",
1806
+ " ",
1807
+ "your desired instrumentation library. Emit your own spans against the",
1808
+ " ",
1809
+ jt,
1810
+ " ",
1811
+ "—",
1812
+ " ",
1813
+ Wt,
1814
+ " ",
1815
+ "ships an",
1816
+ " ",
1817
+ /* @__PURE__ */ n(U, { component: "code", sx: {
1818
+ bgcolor: "action.hover",
1819
+ px: 0.5,
1820
+ borderRadius: 0.5
1821
+ }, children: "init_otel()" }),
1822
+ " ",
1823
+ "helper that configures the OTLP exporter for you."
1824
+ ] }), e[153] = Ft) : Ft = e[153];
1825
+ let Bt;
1826
+ e[154] === Symbol.for("react.memo_cache_sentinel") ? (Bt = {
1827
+ mt: 1
1828
+ }, e[154] = Bt) : Bt = e[154];
1829
+ let Gt;
1830
+ e[155] === Symbol.for("react.memo_cache_sentinel") ? (Gt = /* @__PURE__ */ n(U, { component: "code", sx: {
1831
+ bgcolor: "action.hover",
1832
+ px: 0.5,
1833
+ borderRadius: 0.5
1834
+ }, children: "AMP_OTEL_ENDPOINT" }), e[155] = Gt) : Gt = e[155];
1835
+ let Kt;
1836
+ e[156] === Symbol.for("react.memo_cache_sentinel") ? (Kt = /* @__PURE__ */ v(U, { variant: "body2", sx: Bt, children: [
1837
+ "Environment variables provided:",
1838
+ " ",
1839
+ Gt,
1840
+ ", ",
1841
+ /* @__PURE__ */ n(U, { component: "code", sx: {
1842
+ bgcolor: "action.hover",
1843
+ px: 0.5,
1844
+ borderRadius: 0.5
1845
+ }, children: "AMP_AGENT_API_KEY" })
1846
+ ] }), e[156] = Kt) : Kt = e[156];
1847
+ let qt;
1848
+ e[157] === Symbol.for("react.memo_cache_sentinel") ? (qt = /* @__PURE__ */ n(U, { variant: "body2", sx: {
1849
+ mt: 1
1850
+ }, children: "Example configuration:" }), e[157] = qt) : qt = e[157];
1851
+ let Yt;
1852
+ e[158] === Symbol.for("react.memo_cache_sentinel") ? (Yt = {
1853
+ mt: 0.5,
1854
+ ml: 1
1855
+ }, e[158] = Yt) : Yt = e[158];
1856
+ let Zt;
1857
+ e[159] === Symbol.for("react.memo_cache_sentinel") ? (Zt = /* @__PURE__ */ v(U, { variant: "body2", component: "div", sx: Yt, children: [
1858
+ "• OTLP exporter endpoint =",
1859
+ " ",
1860
+ /* @__PURE__ */ n(U, { component: "code", sx: {
1861
+ bgcolor: "action.hover",
1862
+ px: 0.5,
1863
+ borderRadius: 0.5
1864
+ }, children: "AMP_OTEL_ENDPOINT" })
1865
+ ] }), e[159] = Zt) : Zt = e[159];
1866
+ let Ht;
1867
+ e[160] === Symbol.for("react.memo_cache_sentinel") ? (Ht = {
1868
+ ml: 1
1869
+ }, e[160] = Ht) : Ht = e[160];
1870
+ let Qt;
1871
+ e[161] === Symbol.for("react.memo_cache_sentinel") ? (Qt = /* @__PURE__ */ v(Ie, { severity: "info", sx: Ut, children: [
1872
+ zt,
1873
+ Ft,
1874
+ Kt,
1875
+ qt,
1876
+ Zt,
1877
+ /* @__PURE__ */ v(U, { variant: "body2", component: "div", sx: Ht, children: [
1878
+ "• OTLP headers =",
1879
+ " ",
1880
+ /* @__PURE__ */ n(U, { component: "code", sx: {
1881
+ bgcolor: "action.hover",
1882
+ px: 0.5,
1883
+ borderRadius: 0.5
1884
+ }, children: '{"x-amp-api-key": AMP_AGENT_API_KEY}' })
1885
+ ] })
1886
+ ] }), e[161] = Qt) : Qt = e[161];
1887
+ let nt;
1888
+ e[162] !== Gn ? (nt = /* @__PURE__ */ n(Te, { in: Gn, children: Qt }), e[162] = Gn, e[163] = nt) : nt = e[163];
1889
+ let rt;
1890
+ e[164] !== Dn || e[165] !== Qe || e[166] !== Je || e[167] !== tt || e[168] !== nt ? (rt = /* @__PURE__ */ v(Te, { in: Dn, children: [
1891
+ Qe,
1892
+ Je,
1893
+ tt,
1894
+ nt
1895
+ ] }), e[164] = Dn, e[165] = Qe, e[166] = Je, e[167] = tt, e[168] = nt, e[169] = rt) : rt = e[169];
1896
+ const Kn = r.language === "ballerina", qn = r.enableAutoInstrumentation ?? !0;
1897
+ let at;
1898
+ e[170] !== S ? (at = (z) => S("enableAutoInstrumentation", z.target.checked), e[170] = S, e[171] = at) : at = e[171];
1899
+ let it;
1900
+ e[172] !== qn || e[173] !== at ? (it = /* @__PURE__ */ n(vr, { control: /* @__PURE__ */ n(br, { checked: qn, onChange: at }), label: "Enable auto instrumentation" }), e[172] = qn, e[173] = at, e[174] = it) : it = e[174];
1901
+ const Yn = r.enableAutoInstrumentation !== !1;
1902
+ let Xt, Jt, en;
1903
+ e[175] === Symbol.for("react.memo_cache_sentinel") ? (Xt = {
1904
+ mt: 1
1905
+ }, Jt = /* @__PURE__ */ n(U, { variant: "subtitle2", gutterBottom: !0, children: "Tracing Support for Ballerina-Based Agents" }), en = /* @__PURE__ */ n(U, { variant: "body2", gutterBottom: !0, children: "To enable the AMP extension in a Ballerina program, add the following import to your program." }), e[175] = Xt, e[176] = Jt, e[177] = en) : (Xt = e[175], Jt = e[176], en = e[177]);
1906
+ let tn;
1907
+ e[178] === Symbol.for("react.memo_cache_sentinel") ? (tn = {
1908
+ position: "relative",
1909
+ mt: 1
1910
+ }, e[178] = tn) : tn = e[178];
1911
+ let nn;
1912
+ e[179] === Symbol.for("react.memo_cache_sentinel") ? (nn = /* @__PURE__ */ n(U, { component: "pre", variant: "body2", sx: {
1913
+ m: 0,
1914
+ bgcolor: "action.hover",
1915
+ pl: 1,
1916
+ pr: 5,
1917
+ py: 0.5,
1918
+ borderRadius: 0.5,
1919
+ fontFamily: "monospace"
1920
+ }, children: "import ballerinax/amp as _;" }), e[179] = nn) : nn = e[179];
1921
+ const Zn = y ? "Copied!" : "Copy code";
1922
+ let rn;
1923
+ e[180] === Symbol.for("react.memo_cache_sentinel") ? (rn = /* @__PURE__ */ n(pr, { onClick: M, size: "small", sx: {
1924
+ position: "absolute",
1925
+ right: 4,
1926
+ top: "50%",
1927
+ transform: "translateY(-50%)"
1928
+ }, children: /* @__PURE__ */ n(La, { size: 16 }) }), e[180] = rn) : rn = e[180];
1929
+ let lt;
1930
+ e[181] !== Zn ? (lt = /* @__PURE__ */ v(J, { sx: tn, children: [
1931
+ nn,
1932
+ /* @__PURE__ */ n(In, { title: Zn, children: rn })
1933
+ ] }), e[181] = Zn, e[182] = lt) : lt = e[182];
1934
+ let an;
1935
+ e[183] === Symbol.for("react.memo_cache_sentinel") ? (an = {
1936
+ mt: 1
1937
+ }, e[183] = an) : an = e[183];
1938
+ let ln;
1939
+ e[184] === Symbol.for("react.memo_cache_sentinel") ? (ln = /* @__PURE__ */ v(U, { variant: "body2", sx: an, children: [
1940
+ "Compatible with Ballerina version",
1941
+ " ",
1942
+ /* @__PURE__ */ n(U, { component: "code", sx: {
1943
+ bgcolor: "action.hover",
1944
+ px: 0.5,
1945
+ borderRadius: 0.5
1946
+ }, children: "2201.13.x +" })
1947
+ ] }), e[184] = ln) : ln = e[184];
1948
+ let ot;
1949
+ e[185] !== lt ? (ot = /* @__PURE__ */ v(Ie, { severity: "info", sx: Xt, children: [
1950
+ Jt,
1951
+ en,
1952
+ lt,
1953
+ ln
1954
+ ] }), e[185] = lt, e[186] = ot) : ot = e[186];
1955
+ let st;
1956
+ e[187] !== ot || e[188] !== Yn ? (st = /* @__PURE__ */ n(Te, { in: Yn, children: ot }), e[187] = ot, e[188] = Yn, e[189] = st) : st = e[189];
1957
+ let ct;
1958
+ e[190] !== st || e[191] !== it ? (ct = /* @__PURE__ */ v(ne, { spacing: 2, children: [
1959
+ it,
1960
+ st
1961
+ ] }), e[190] = st, e[191] = it, e[192] = ct) : ct = e[192];
1962
+ let dt;
1963
+ e[193] !== ct || e[194] !== Kn ? (dt = /* @__PURE__ */ n(Te, { in: Kn, children: ct }), e[193] = ct, e[194] = Kn, e[195] = dt) : dt = e[195];
1964
+ const Hn = r.language === "docker", Qn = r.dockerfilePath || "";
1965
+ let mt;
1966
+ e[196] !== S ? (mt = (z) => S("dockerfilePath", z.target.value), e[196] = S, e[197] = mt) : mt = e[197];
1967
+ const Xn = !!s.dockerfilePath, Jn = s.dockerfilePath || "Path to Dockerfile in your repository";
1968
+ let pt;
1969
+ e[198] !== Qn || e[199] !== mt || e[200] !== Xn || e[201] !== Jn ? (pt = /* @__PURE__ */ n(w.Stack, { direction: "row", spacing: 2, children: /* @__PURE__ */ n(w.ElementWrapper, { label: "Dockerfile Path", name: "dockerfilePath", children: /* @__PURE__ */ n(ge, { id: "dockerfilePath", placeholder: "e.g., ./Dockerfile", value: Qn, onChange: mt, error: Xn, helperText: Jn, fullWidth: !0 }) }) }), e[198] = Qn, e[199] = mt, e[200] = Xn, e[201] = Jn, e[202] = pt) : pt = e[202];
1970
+ let on;
1971
+ e[203] === Symbol.for("react.memo_cache_sentinel") ? (on = /* @__PURE__ */ n(U, { variant: "subtitle2", gutterBottom: !0, children: "Tracing Support for Docker-Based Agents" }), e[203] = on) : on = e[203];
1972
+ let sn;
1973
+ e[204] === Symbol.for("react.memo_cache_sentinel") ? (sn = {
1974
+ bgcolor: "action.hover",
1975
+ px: 0.5,
1976
+ borderRadius: 0.5
1977
+ }, e[204] = sn) : sn = e[204];
1978
+ const er = `pip install amp-instrumentation==${r.instrumentationVersion ?? A?.instrumentation.defaultVersion ?? "latest"}`;
1979
+ let ut;
1980
+ e[205] !== er ? (ut = /* @__PURE__ */ n(U, { component: "code", sx: sn, children: er }), e[205] = er, e[206] = ut) : ut = e[206];
1981
+ let cn;
1982
+ e[207] === Symbol.for("react.memo_cache_sentinel") ? (cn = /* @__PURE__ */ n(U, { component: "code", sx: {
1983
+ bgcolor: "action.hover",
1984
+ px: 0.5,
1985
+ borderRadius: 0.5
1986
+ }, children: "amp-instrument python your_script.py" }), e[207] = cn) : cn = e[207];
1987
+ let dn;
1988
+ e[208] === Symbol.for("react.memo_cache_sentinel") ? (dn = /* @__PURE__ */ n(U, { component: "a", href: mi, target: "_blank", rel: "noopener noreferrer", sx: {
1989
+ color: "primary.main"
1990
+ }, children: "AMP instrumentation version mapping" }), e[208] = dn) : dn = e[208];
1991
+ let mn;
1992
+ e[209] === Symbol.for("react.memo_cache_sentinel") ? (mn = /* @__PURE__ */ n(U, { component: "a", href: Pr, target: "_blank", rel: "noopener noreferrer", sx: {
1993
+ color: "primary.main"
1994
+ }, children: "manual instrumentation contract" }), e[209] = mn) : mn = e[209];
1995
+ let ht;
1996
+ e[210] !== ut ? (ht = /* @__PURE__ */ v(U, { variant: "body2", paragraph: !0, children: [
1997
+ "Docker-based agents require OTEL instrumentation to export traces. For Python, use",
1998
+ " ",
1999
+ ut,
2000
+ " ",
2001
+ "and run with",
2002
+ " ",
2003
+ cn,
2004
+ " ",
2005
+ "for zero-code tracing. To pick a different version, see the",
2006
+ " ",
2007
+ dn,
2008
+ ". For agents on a framework the Traceloop SDK doesn't cover, emit your own spans against the",
2009
+ " ",
2010
+ mn,
2011
+ "."
2012
+ ] }), e[210] = ut, e[211] = ht) : ht = e[211];
2013
+ let pn;
2014
+ e[212] === Symbol.for("react.memo_cache_sentinel") ? (pn = /* @__PURE__ */ n(U, { component: "code", sx: {
2015
+ bgcolor: "action.hover",
2016
+ px: 0.5,
2017
+ borderRadius: 0.5
2018
+ }, children: "AMP_OTEL_ENDPOINT" }), e[212] = pn) : pn = e[212];
2019
+ let un;
2020
+ e[213] === Symbol.for("react.memo_cache_sentinel") ? (un = /* @__PURE__ */ v(U, { variant: "body2", gutterBottom: !0, children: [
2021
+ "Environment variables provided:",
2022
+ " ",
2023
+ pn,
2024
+ ", ",
2025
+ /* @__PURE__ */ n(U, { component: "code", sx: {
2026
+ bgcolor: "action.hover",
2027
+ px: 0.5,
2028
+ borderRadius: 0.5
2029
+ }, children: "AMP_AGENT_API_KEY" })
2030
+ ] }), e[213] = un) : un = e[213];
2031
+ let hn;
2032
+ e[214] === Symbol.for("react.memo_cache_sentinel") ? (hn = /* @__PURE__ */ n(U, { variant: "body2", sx: {
2033
+ mt: 1
2034
+ }, children: "Example configuration:" }), e[214] = hn) : hn = e[214];
2035
+ let fn;
2036
+ e[215] === Symbol.for("react.memo_cache_sentinel") ? (fn = {
2037
+ mt: 0.5,
2038
+ ml: 1
2039
+ }, e[215] = fn) : fn = e[215];
2040
+ let gn;
2041
+ e[216] === Symbol.for("react.memo_cache_sentinel") ? (gn = /* @__PURE__ */ v(U, { variant: "body2", component: "div", sx: fn, children: [
2042
+ "• OTLP exporter endpoint =",
2043
+ " ",
2044
+ /* @__PURE__ */ n(U, { component: "code", sx: {
2045
+ bgcolor: "action.hover",
2046
+ px: 0.5,
2047
+ borderRadius: 0.5
2048
+ }, children: "AMP_OTEL_ENDPOINT" })
2049
+ ] }), e[216] = gn) : gn = e[216];
2050
+ let yn;
2051
+ e[217] === Symbol.for("react.memo_cache_sentinel") ? (yn = {
2052
+ ml: 1
2053
+ }, e[217] = yn) : yn = e[217];
2054
+ let vn;
2055
+ e[218] === Symbol.for("react.memo_cache_sentinel") ? (vn = /* @__PURE__ */ v(U, { variant: "body2", component: "div", sx: yn, children: [
2056
+ "• OTLP headers =",
2057
+ " ",
2058
+ /* @__PURE__ */ n(U, { component: "code", sx: {
2059
+ bgcolor: "action.hover",
2060
+ px: 0.5,
2061
+ borderRadius: 0.5
2062
+ }, children: '{"x-amp-api-key": AMP_AGENT_API_KEY}' })
2063
+ ] }), e[218] = vn) : vn = e[218];
2064
+ let ft;
2065
+ e[219] !== ht ? (ft = /* @__PURE__ */ v(Ie, { severity: "info", children: [
2066
+ on,
2067
+ ht,
2068
+ un,
2069
+ hn,
2070
+ gn,
2071
+ vn
2072
+ ] }), e[219] = ht, e[220] = ft) : ft = e[220];
2073
+ let gt;
2074
+ e[221] !== pt || e[222] !== ft ? (gt = /* @__PURE__ */ v(ne, { spacing: 2, children: [
2075
+ pt,
2076
+ ft
2077
+ ] }), e[221] = pt, e[222] = ft, e[223] = gt) : gt = e[223];
2078
+ let yt;
2079
+ e[224] !== Hn || e[225] !== gt ? (yt = /* @__PURE__ */ n(Te, { in: Hn, children: gt }), e[224] = Hn, e[225] = gt, e[226] = yt) : yt = e[226];
2080
+ let vt;
2081
+ e[227] !== dt || e[228] !== yt || e[229] !== We || e[230] !== rt ? (vt = /* @__PURE__ */ v(w.Section, { children: [
2082
+ Dt,
2083
+ /* @__PURE__ */ v(w.Stack, { spacing: 2, children: [
2084
+ We,
2085
+ rt,
2086
+ dt,
2087
+ yt
2088
+ ] })
2089
+ ] }), e[227] = dt, e[228] = yt, e[229] = We, e[230] = rt, e[231] = vt) : vt = e[231];
2090
+ let bt;
2091
+ e[232] !== s || e[233] !== r || e[234] !== l || e[235] !== a || e[236] !== g ? (bt = /* @__PURE__ */ n(qa, { formData: r, setFormData: a, errors: s, setFieldError: l, validateField: g }), e[232] = s, e[233] = r, e[234] = l, e[235] = a, e[236] = g, e[237] = bt) : bt = e[237];
2092
+ let Nt;
2093
+ e[238] !== o ? (Nt = o && /* @__PURE__ */ v(Ie, { severity: "info", children: [
2094
+ "LLM providers, environment variables, and file mounts below apply only to the ",
2095
+ /* @__PURE__ */ n("strong", { children: o }),
2096
+ " environment. Configure values for other environments when promoting."
2097
+ ] }), e[238] = o, e[239] = Nt) : Nt = e[239];
2098
+ let bn;
2099
+ e[240] !== r.displayName ? (bn = r.displayName ? r.displayName.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT", e[240] = r.displayName, e[241] = bn) : bn = e[241];
2100
+ const St = bn;
2101
+ let Nn;
2102
+ if (e[242] !== St || e[243] !== r.env || e[244] !== m) {
2103
+ let z;
2104
+ e[246] !== St ? (z = (Q, te) => [Q.urlVarName ?? `${St}_MCP_${te + 1}_URL`, Q.apikeyVarName ?? `${St}_MCP_${te + 1}_API_KEY`], e[246] = St, e[247] = z) : z = e[247], Nn = /* @__PURE__ */ new Set([...(r.env ?? []).map(gi).filter(yi), ...m.flatMap(z)]), e[242] = St, e[243] = r.env, e[244] = m, e[245] = Nn;
2105
+ } else
2106
+ Nn = e[245];
2107
+ const tr = Nn;
2108
+ let Ct;
2109
+ e[248] !== r.displayName || e[249] !== i || e[250] !== u || e[251] !== d || e[252] !== f || e[253] !== tr ? (Ct = /* @__PURE__ */ n(Hr, { llmProviders: d, setLLMProviders: f, agentDisplayName: r.displayName, initialEnvironmentName: i, isInitialEnvironmentLoading: u, externalEnvKeys: tr }), e[248] = r.displayName, e[249] = i, e[250] = u, e[251] = d, e[252] = f, e[253] = tr, e[254] = Ct) : Ct = e[254];
2110
+ let Sn;
2111
+ e[255] !== r.displayName ? (Sn = r.displayName ? r.displayName.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT", e[255] = r.displayName, e[256] = Sn) : Sn = e[256];
2112
+ const Pt = Sn;
2113
+ let Cn;
2114
+ if (e[257] !== Pt || e[258] !== r.env || e[259] !== d) {
2115
+ let z;
2116
+ e[261] !== Pt ? (z = (Q, te) => [Q.urlVarName ?? `${Pt}_${te + 1}_URL`, Q.apikeyVarName ?? `${Pt}_${te + 1}_API_KEY`], e[261] = Pt, e[262] = z) : z = e[262], Cn = /* @__PURE__ */ new Set([...(r.env ?? []).map(vi).filter(bi), ...d.flatMap(z)]), e[257] = Pt, e[258] = r.env, e[259] = d, e[260] = Cn;
2117
+ } else
2118
+ Cn = e[260];
2119
+ const nr = Cn;
2120
+ let xt;
2121
+ e[263] !== r.displayName || e[264] !== i || e[265] !== u || e[266] !== m || e[267] !== b || e[268] !== nr ? (xt = /* @__PURE__ */ n(Xr, { mcpProxies: m, setMCPProxies: b, agentDisplayName: r.displayName, initialEnvironmentName: i, isInitialEnvironmentLoading: u, externalEnvKeys: nr }), e[263] = r.displayName, e[264] = i, e[265] = u, e[266] = m, e[267] = b, e[268] = nr, e[269] = xt) : xt = e[269];
2122
+ let Pn;
2123
+ e[270] !== r.displayName ? (Pn = r.displayName ? r.displayName.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT", e[270] = r.displayName, e[271] = Pn) : Pn = e[271];
2124
+ const Le = Pn;
2125
+ let xn;
2126
+ if (e[272] !== Le || e[273] !== d || e[274] !== m) {
2127
+ let z;
2128
+ e[276] !== Le ? (z = (te, fe) => [te.urlVarName ?? `${Le}_${fe + 1}_URL`, te.apikeyVarName ?? `${Le}_${fe + 1}_API_KEY`], e[276] = Le, e[277] = z) : z = e[277];
2129
+ let Q;
2130
+ e[278] !== Le ? (Q = (te, fe) => [te.urlVarName ?? `${Le}_MCP_${fe + 1}_URL`, te.apikeyVarName ?? `${Le}_MCP_${fe + 1}_API_KEY`], e[278] = Le, e[279] = Q) : Q = e[279], xn = /* @__PURE__ */ new Set([...d.flatMap(z), ...m.flatMap(Q)]), e[272] = Le, e[273] = d, e[274] = m, e[275] = xn;
2131
+ } else
2132
+ xn = e[275];
2133
+ const rr = xn;
2134
+ let kt;
2135
+ e[280] !== r || e[281] !== a || e[282] !== rr ? (kt = /* @__PURE__ */ n(qr, { formData: r, setFormData: a, llmReservedNames: rr }), e[280] = r, e[281] = a, e[282] = rr, e[283] = kt) : kt = e[283];
2136
+ let _t;
2137
+ e[284] !== r || e[285] !== a ? (_t = /* @__PURE__ */ n(Yr, { formData: r, setFormData: a }), e[284] = r, e[285] = a, e[286] = _t) : _t = e[286];
2138
+ let kn;
2139
+ return e[287] !== vt || e[288] !== bt || e[289] !== Nt || e[290] !== Ct || e[291] !== xt || e[292] !== kt || e[293] !== _t || e[294] !== le || e[295] !== Oe ? (kn = /* @__PURE__ */ v(w.Stack, { spacing: 3, children: [
2140
+ le,
2141
+ Oe,
2142
+ vt,
2143
+ bt,
2144
+ Nt,
2145
+ Ct,
2146
+ xt,
2147
+ kt,
2148
+ _t
2149
+ ] }), e[287] = vt, e[288] = bt, e[289] = Nt, e[290] = Ct, e[291] = xt, e[292] = kt, e[293] = _t, e[294] = le, e[295] = Oe, e[296] = kn) : kn = e[296], kn;
2150
+ };
2151
+ function ui(t) {
2152
+ console.error("Failed to generate name:", t);
2153
+ }
2154
+ function hi(t) {
2155
+ return /* @__PURE__ */ n(wt, { value: t, children: t }, t);
2156
+ }
2157
+ function fi(t) {
2158
+ return /* @__PURE__ */ n(wt, { value: t.version, children: t.traceloopSdk ? `${t.version} (OpenLLMetry v${t.traceloopSdk})` : t.version }, t.version);
2159
+ }
2160
+ function gi(t) {
2161
+ return t.key;
2162
+ }
2163
+ function yi(t) {
2164
+ return !!t;
2165
+ }
2166
+ function vi(t) {
2167
+ return t.key;
2168
+ }
2169
+ function bi(t) {
2170
+ return !!t;
2171
+ }
2172
+ const gr = (t) => {
2173
+ const e = Ce(22), {
2174
+ lastSubmittedValidationErrors: r,
2175
+ isPending: a,
2176
+ onCancel: s,
2177
+ onSubmit: l,
2178
+ mode: g,
2179
+ isNameEmpty: d,
2180
+ hasLLMVarConflicts: f
2181
+ } = t, m = g === void 0 ? "deploy" : g, b = d === void 0 ? !1 : d, i = f === void 0 ? !1 : f, c = m === "connect";
2182
+ let o;
2183
+ e[0] !== r ? (o = Object.values(r).filter(Ni), e[0] = r, e[1] = o) : o = e[1];
2184
+ const u = o, h = u.length > 0;
2185
+ let p;
2186
+ e[2] !== u ? (p = /* @__PURE__ */ n(Ie, { severity: "error", children: u.map(Si) }), e[2] = u, e[3] = p) : p = e[3];
2187
+ let y;
2188
+ e[4] !== h || e[5] !== p ? (y = /* @__PURE__ */ n(Te, { in: h, timeout: "auto", unmountOnExit: !0, children: p }), e[4] = h, e[5] = p, e[6] = y) : y = e[6];
2189
+ let C;
2190
+ e[7] !== s ? (C = /* @__PURE__ */ n(Ee, { variant: "outlined", color: "primary", size: "medium", onClick: s, children: "Cancel" }), e[7] = s, e[8] = C) : C = e[8];
2191
+ let P;
2192
+ e[9] !== c ? (P = c ? /* @__PURE__ */ n(hr, { size: 16 }) : /* @__PURE__ */ n(Ta, { size: 16 }), e[9] = c, e[10] = P) : P = e[10];
2193
+ const M = a || b || i, k = c ? "Register" : "Deploy";
2194
+ let $;
2195
+ e[11] !== l || e[12] !== k || e[13] !== P || e[14] !== M ? ($ = /* @__PURE__ */ n(Ee, { variant: "contained", color: "primary", size: "medium", startIcon: P, onClick: l, disabled: M, children: k }), e[11] = l, e[12] = k, e[13] = P, e[14] = M, e[15] = $) : $ = e[15];
2196
+ let E;
2197
+ e[16] !== $ || e[17] !== C ? (E = /* @__PURE__ */ v(J, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
2198
+ C,
2199
+ $
2200
+ ] }), e[16] = $, e[17] = C, e[18] = E) : E = e[18];
2201
+ let V;
2202
+ return e[19] !== E || e[20] !== y ? (V = /* @__PURE__ */ v(J, { display: "flex", flexDirection: "column", gap: 3, children: [
2203
+ y,
2204
+ E
2205
+ ] }), e[19] = E, e[20] = y, e[21] = V) : V = e[21], V;
2206
+ };
2207
+ function Ni(t) {
2208
+ return !!t;
2209
+ }
2210
+ function Si(t, e) {
2211
+ return /* @__PURE__ */ n(J, { children: t }, e);
2212
+ }
2213
+ function Jr(t = []) {
2214
+ const e = /* @__PURE__ */ new Set();
2215
+ for (const r of t)
2216
+ for (const a of r.targetEnvironmentRefs)
2217
+ e.add(a.name);
2218
+ return t.find((r) => !e.has(r.sourceEnvironmentRef))?.sourceEnvironmentRef;
2219
+ }
2220
+ function ea(t = []) {
2221
+ const e = /* @__PURE__ */ new Set();
2222
+ for (const r of t) {
2223
+ r.sourceEnvironmentRef && e.add(r.sourceEnvironmentRef);
2224
+ for (const a of r.targetEnvironmentRefs ?? [])
2225
+ a.name && e.add(a.name);
2226
+ if (e.size > 1) return !0;
2227
+ }
2228
+ return !1;
2229
+ }
2230
+ function Ci(t, e) {
2231
+ const r = e ? t.selectedProviderByEnv[e] : null;
2232
+ if (!r) return null;
2233
+ const a = t.guardrails.length > 0 ? t.guardrails.map((l) => ({
2234
+ name: l.name,
2235
+ version: l.version,
2236
+ paths: [{
2237
+ path: "/*",
2238
+ methods: ["*"],
2239
+ params: l.settings ?? {}
2240
+ }]
2241
+ })) : void 0, s = [...t.urlVarName ? [{
2242
+ key: "url",
2243
+ name: t.urlVarName
2244
+ }] : [], ...t.apikeyVarName ? [{
2245
+ key: "apikey",
2246
+ name: t.apikeyVarName
2247
+ }] : []];
2248
+ return {
2249
+ providerName: r.handle,
2250
+ ...a ? {
2251
+ configuration: {
2252
+ policies: a
2253
+ }
2254
+ } : {},
2255
+ ...s.length > 0 ? {
2256
+ environmentVariables: s
2257
+ } : {}
2258
+ };
2259
+ }
2260
+ function ta(t, e) {
2261
+ if (!t.length) return;
2262
+ const r = t.map((a) => Ci(a, e)).filter((a) => a !== null);
2263
+ return r.length > 0 ? r : void 0;
2264
+ }
2265
+ function Pi(t, e) {
2266
+ const r = e ? t.selectedProxyByEnv[e] : null;
2267
+ if (!r) return null;
2268
+ const a = [...t.urlVarName ? [{
2269
+ key: "url",
2270
+ name: t.urlVarName
2271
+ }] : [], ...t.apikeyVarName ? [{
2272
+ key: "apikey",
2273
+ name: t.apikeyVarName
2274
+ }] : []];
2275
+ return {
2276
+ proxyName: r.id,
2277
+ ...a.length > 0 ? {
2278
+ environmentVariables: a
2279
+ } : {}
2280
+ };
2281
+ }
2282
+ function na(t, e) {
2283
+ if (!t.length) return;
2284
+ const r = t.map((a) => Pi(a, e)).filter((a) => a !== null);
2285
+ return r.length > 0 ? r : void 0;
2286
+ }
2287
+ const ra = (t, e, r = [], a, s = []) => {
2288
+ const l = ta(r, a), g = na(s, a), d = t.labels && Object.keys(t.labels).length > 0 ? t.labels : void 0;
2289
+ return t.deploymentType === "new" ? {
2290
+ params: e,
2291
+ body: {
2292
+ name: t.name,
2293
+ displayName: t.displayName,
2294
+ description: t.description?.trim() || void 0,
2295
+ ...d ? {
2296
+ labels: d
2297
+ } : {},
2298
+ provisioning: {
2299
+ type: "internal",
2300
+ repository: {
2301
+ url: t.repositoryUrl ?? "",
2302
+ branch: t.branch ?? "main",
2303
+ appPath: t.appPath?.trim() || "/",
2304
+ secretRef: t.gitSecretRef || null
2305
+ }
2306
+ },
2307
+ agentType: {
2308
+ type: "agent-api",
2309
+ subType: t.interfaceType === "CUSTOM" ? "custom-api" : "chat-api"
2310
+ },
2311
+ build: t.language === "docker" ? {
2312
+ type: "docker",
2313
+ docker: {
2314
+ dockerfilePath: t.dockerfilePath ?? "./Dockerfile"
2315
+ }
2316
+ } : t.language === "ballerina" ? {
2317
+ type: "buildpack",
2318
+ buildpack: {
2319
+ language: "ballerina"
2320
+ }
2321
+ } : {
2322
+ type: "buildpack",
2323
+ buildpack: {
2324
+ language: t.language ?? "python",
2325
+ languageVersion: t.languageVersion ?? "3.11",
2326
+ runCommand: t.runCommand ?? ""
2327
+ }
2328
+ },
2329
+ configurations: {
2330
+ env: t.env.filter((f) => f.key && f.value).map((f) => ({
2331
+ key: f.key.replace(/\s+/g, "_"),
2332
+ value: f.value,
2333
+ isSensitive: f.isSensitive || !1
2334
+ })),
2335
+ files: (t.files ?? []).filter((f) => f.key && f.mountPath).map((f) => ({
2336
+ key: f.key,
2337
+ mountPath: f.mountPath,
2338
+ value: f.value ?? "",
2339
+ isSensitive: f.isSensitive || !1
2340
+ })),
2341
+ enableAutoInstrumentation: t.enableAutoInstrumentation,
2342
+ ...t.language === "python" && t.enableAutoInstrumentation !== !1 && t.instrumentationVersion ? {
2343
+ instrumentationVersion: t.instrumentationVersion
2344
+ } : {}
2345
+ },
2346
+ inputInterface: {
2347
+ type: "HTTP",
2348
+ ...t.interfaceType === "CUSTOM" ? {
2349
+ port: Number(t.port),
2350
+ basePath: t.basePath || "/",
2351
+ schema: {
2352
+ path: t.openApiPath ?? ""
2353
+ }
2354
+ } : {}
2355
+ },
2356
+ ...l ? {
2357
+ modelConfig: l
2358
+ } : {},
2359
+ ...g ? {
2360
+ mcpConfig: g
2361
+ } : {}
2362
+ }
2363
+ } : {
2364
+ params: e,
2365
+ body: {
2366
+ name: t.name,
2367
+ displayName: t.displayName,
2368
+ description: t.description,
2369
+ ...d ? {
2370
+ labels: d
2371
+ } : {},
2372
+ provisioning: {
2373
+ type: "external"
2374
+ },
2375
+ agentType: {
2376
+ type: "external-agent-api",
2377
+ subType: "custom-api"
2378
+ },
2379
+ ...l ? {
2380
+ modelConfig: l
2381
+ } : {}
2382
+ }
2383
+ };
2384
+ }, xi = (t, e, r, a, s = [], l, g = []) => {
2385
+ const d = ta(s, l), f = na(g, l);
2386
+ return {
2387
+ params: e,
2388
+ body: {
2389
+ name: t.name,
2390
+ displayName: t.displayName,
2391
+ description: t.description?.trim() || void 0,
2392
+ ...t.labels && Object.keys(t.labels).length > 0 ? {
2393
+ labels: t.labels
2394
+ } : {},
2395
+ provisioning: {
2396
+ type: "internal",
2397
+ agentKind: {
2398
+ name: r,
2399
+ version: a
2400
+ }
2401
+ },
2402
+ configurations: {
2403
+ env: (t.env ?? []).filter((m) => m.key && m.value).map((m) => ({
2404
+ key: m.key.trim().replace(/\s+/g, "_"),
2405
+ value: m.value,
2406
+ isSensitive: m.isSensitive || !1
2407
+ })),
2408
+ files: (t.files ?? []).filter((m) => m.key && m.mountPath).map((m) => ({
2409
+ key: m.key,
2410
+ mountPath: m.mountPath,
2411
+ value: m.value ?? "",
2412
+ isSensitive: m.isSensitive || !1
2413
+ })),
2414
+ enableAutoInstrumentation: t.enableAutoInstrumentation
2415
+ },
2416
+ ...d ? {
2417
+ modelConfig: d
2418
+ } : {},
2419
+ ...f ? {
2420
+ mcpConfig: f
2421
+ } : {}
2422
+ }
2423
+ };
2424
+ }, ki = () => {
2425
+ const t = Ce(72), e = Vt(), {
2426
+ orgId: r,
2427
+ projectId: a
2428
+ } = Ae();
2429
+ let s;
2430
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (s = {
2431
+ deploymentType: "new",
2432
+ enableAutoInstrumentation: !0,
2433
+ instrumentationVersion: void 0,
2434
+ name: "",
2435
+ displayName: "",
2436
+ description: "",
2437
+ repositoryUrl: "",
2438
+ branch: "main",
2439
+ appPath: "/",
2440
+ runCommand: "python main.py",
2441
+ language: "python",
2442
+ languageVersion: void 0,
2443
+ dockerfilePath: "/Dockerfile",
2444
+ interfaceType: "DEFAULT",
2445
+ port: "",
2446
+ basePath: "/",
2447
+ openApiPath: "",
2448
+ env: [],
2449
+ files: []
2450
+ }, t[0] = s) : s = t[0];
2451
+ const [l, g] = oe(s), {
2452
+ errors: d,
2453
+ validateForm: f,
2454
+ setFieldError: m,
2455
+ validateField: b
2456
+ } = Tn(Kr);
2457
+ let i;
2458
+ t[1] === Symbol.for("react.memo_cache_sentinel") ? (i = [], t[1] = i) : i = t[1];
2459
+ const [c, o] = oe(i);
2460
+ let u;
2461
+ t[2] === Symbol.for("react.memo_cache_sentinel") ? (u = [], t[2] = u) : u = t[2];
2462
+ const [h, p] = oe(u), {
2463
+ mutate: y,
2464
+ isPending: C,
2465
+ error: P
2466
+ } = mr(), M = r ?? "default", k = a ?? "default";
2467
+ let $;
2468
+ t[3] !== M || t[4] !== k ? ($ = {
2469
+ orgName: M,
2470
+ projName: k
2471
+ }, t[3] = M, t[4] = k, t[5] = $) : $ = t[5];
2472
+ const E = $, {
2473
+ data: V,
2474
+ isLoading: L
2475
+ } = Er(E);
2476
+ let O;
2477
+ t[6] !== V?.promotionPaths ? (O = () => Jr(V?.promotionPaths), t[6] = V?.promotionPaths, t[7] = O) : O = t[7], V?.promotionPaths;
2478
+ let B;
2479
+ t[8] !== O ? (B = O(), t[8] = O, t[9] = B) : B = t[9];
2480
+ const A = B;
2481
+ V?.promotionPaths;
2482
+ const R = ea(V?.promotionPaths) ? A : void 0;
2483
+ let G;
2484
+ t[10] !== e || t[11] !== r || t[12] !== a ? (G = () => {
2485
+ e(Ne(Se.children.org.children.projects.path, {
2486
+ orgId: r ?? "",
2487
+ projectId: a ?? "default"
2488
+ }));
2489
+ }, t[10] = e, t[11] = r, t[12] = a, t[13] = G) : G = t[13];
2490
+ const K = G;
2491
+ let j;
2492
+ t[14] === Symbol.for("react.memo_cache_sentinel") ? (j = {}, t[14] = j) : j = t[14];
2493
+ const [x, I] = oe(j);
2494
+ let S;
2495
+ t[15] !== y || t[16] !== d || t[17] !== l || t[18] !== A || t[19] !== c || t[20] !== h || t[21] !== e || t[22] !== E || t[23] !== f ? (S = () => {
2496
+ if (f(l))
2497
+ I({});
2498
+ else {
2499
+ I(d);
2500
+ return;
2501
+ }
2502
+ if ((c.length > 0 || h.length > 0) && !A) {
2503
+ I({
2504
+ llmProvider: "Unable to resolve the initial deployment environment for LLM provider / MCP proxy configuration."
2505
+ });
2506
+ return;
2507
+ }
2508
+ const me = ra(l, E, c, A, h);
2509
+ y(me, {
2510
+ onSuccess: () => {
2511
+ e(Ne(Se.children.org.children.projects.children.agents.path, {
2512
+ orgId: E.orgName ?? "",
2513
+ projectId: E.projName ?? "",
2514
+ agentId: me.body.name
2515
+ }) + "?setup=true");
2516
+ },
2517
+ onError: _i
2518
+ });
2519
+ }, t[15] = y, t[16] = d, t[17] = l, t[18] = A, t[19] = c, t[20] = h, t[21] = e, t[22] = E, t[23] = f, t[24] = S) : S = t[24];
2520
+ const W = S, Y = r ?? "", T = a ?? "default";
2521
+ let N;
2522
+ t[25] !== Y || t[26] !== T ? (N = Ne(Se.children.org.children.projects.children.newAgent.children.create.path, {
2523
+ orgId: Y,
2524
+ projectId: T
2525
+ }), t[25] = Y, t[26] = T, t[27] = N) : N = t[27];
2526
+ const _ = N;
2527
+ let D;
2528
+ t[28] !== d || t[29] !== R || t[30] !== l || t[31] !== A || t[32] !== L || t[33] !== c || t[34] !== h || t[35] !== m || t[36] !== b ? (D = /* @__PURE__ */ n(pi, { formData: l, setFormData: g, errors: d, setFieldError: m, validateField: b, llmProviders: c, setLLMProviders: o, mcpProxies: h, setMCPProxies: p, initialEnvironmentName: A, isInitialEnvironmentLoading: L, firstEnvOnlyNotice: R }), t[28] = d, t[29] = R, t[30] = l, t[31] = A, t[32] = L, t[33] = c, t[34] = h, t[35] = m, t[36] = b, t[37] = D) : D = t[37];
2529
+ let Z;
2530
+ t[38] !== P ? (Z = !!P && /* @__PURE__ */ n(Ie, { severity: "error", sx: {
2531
+ mt: 2
2532
+ }, children: P instanceof Error ? P.message : "Failed to create agent" }), t[38] = P, t[39] = Z) : Z = t[39];
2533
+ const q = C || (c.length > 0 || h.length > 0) && L, H = !l.name.trim();
2534
+ let X;
2535
+ e: {
2536
+ let me;
2537
+ t[40] !== l.displayName ? (me = l.displayName ? l.displayName.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT", t[40] = l.displayName, t[41] = me) : me = t[41];
2538
+ const ee = me;
2539
+ let pe;
2540
+ if (t[42] !== ee || t[43] !== c || t[44] !== h) {
2541
+ let ue;
2542
+ t[46] !== ee ? (ue = (he, Pe) => [he.urlVarName ?? `${ee}_${Pe + 1}_URL`, he.apikeyVarName ?? `${ee}_${Pe + 1}_API_KEY`], t[46] = ee, t[47] = ue) : ue = t[47];
2543
+ let ve;
2544
+ t[48] !== ee ? (ve = (he, Pe) => [he.urlVarName ?? `${ee}_MCP_${Pe + 1}_URL`, he.apikeyVarName ?? `${ee}_MCP_${Pe + 1}_API_KEY`], t[48] = ee, t[49] = ve) : ve = t[49], pe = [...c.flatMap(ue), ...h.flatMap(ve)], t[42] = ee, t[43] = c, t[44] = h, t[45] = pe;
2545
+ } else
2546
+ pe = t[45];
2547
+ const ye = pe;
2548
+ let ie;
2549
+ t[50] !== ye ? (ie = new Set(ye), t[50] = ye, t[51] = ie) : ie = t[51];
2550
+ const le = ie;
2551
+ if (ye.length !== le.size) {
2552
+ X = !0;
2553
+ break e;
2554
+ }
2555
+ let ke;
2556
+ if (t[52] !== l.env || t[53] !== le) {
2557
+ const ue = (l.env ?? []).map(Ai).filter(Ei);
2558
+ if (ue.length !== new Set(ue).size) {
2559
+ X = !0;
2560
+ break e;
2561
+ }
2562
+ let ve;
2563
+ t[56] !== le ? (ve = (he) => le.has(he), t[56] = le, t[57] = ve) : ve = t[57], ke = ue.some(ve), t[52] = l.env, t[53] = le, t[54] = ke, t[55] = X;
2564
+ } else
2565
+ ke = t[54], X = t[55];
2566
+ X = ke;
2567
+ }
2568
+ let ae;
2569
+ t[58] !== K || t[59] !== W || t[60] !== x || t[61] !== q || t[62] !== H || t[63] !== X ? (ae = /* @__PURE__ */ n(gr, { lastSubmittedValidationErrors: x, isPending: q, onCancel: K, onSubmit: W, isNameEmpty: H, mode: "deploy", hasLLMVarConflicts: X }), t[58] = K, t[59] = W, t[60] = x, t[61] = q, t[62] = H, t[63] = X, t[64] = ae) : ae = t[64];
2570
+ let de;
2571
+ t[65] !== D || t[66] !== Z || t[67] !== ae ? (de = /* @__PURE__ */ v(w.Stack, { spacing: 3, children: [
2572
+ D,
2573
+ Z,
2574
+ ae
2575
+ ] }), t[65] = D, t[66] = Z, t[67] = ae, t[68] = de) : de = t[68];
2576
+ let ce;
2577
+ return t[69] !== _ || t[70] !== de ? (ce = /* @__PURE__ */ n(It, { title: "Create a Platform-Hosted Agent", description: "Specify the source repository, select the agent type, and deploy it on the platform.", disableIcon: !0, backHref: _, backLabel: "Back to Source Type Selection", children: de }), t[69] = _, t[70] = de, t[71] = ce) : ce = t[71], ce;
2578
+ };
2579
+ function _i(t) {
2580
+ console.error("Failed to create agent:", t);
2581
+ }
2582
+ function Ai(t) {
2583
+ return t.key;
2584
+ }
2585
+ function Ei(t) {
2586
+ return !!t;
2587
+ }
2588
+ const wi = (t) => {
2589
+ const e = Ce(47), {
2590
+ formData: r,
2591
+ setFormData: a,
2592
+ errors: s,
2593
+ setFieldError: l,
2594
+ validateField: g
2595
+ } = t, {
2596
+ orgId: d,
2597
+ projectId: f
2598
+ } = Ae();
2599
+ let m;
2600
+ e[0] !== d ? (m = {
2601
+ orgName: d
2602
+ }, e[0] = d, e[1] = m) : m = e[1];
2603
+ const {
2604
+ mutate: b,
2605
+ isPending: i
2606
+ } = cr(m);
2607
+ let c;
2608
+ e[2] !== l || e[3] !== a || e[4] !== g ? (c = (j, x) => {
2609
+ a((I) => {
2610
+ const S = {
2611
+ ...I,
2612
+ [j]: x
2613
+ }, W = g(j, x, S);
2614
+ return l(j, W), S;
2615
+ });
2616
+ }, e[2] = l, e[3] = a, e[4] = g, e[5] = c) : c = e[5];
2617
+ const o = c;
2618
+ let u;
2619
+ e[6] !== b || e[7] !== o || e[8] !== f ? (u = dr.debounce((j) => {
2620
+ if (j.length < 3) {
2621
+ o("name", "");
2622
+ return;
2623
+ }
2624
+ b({
2625
+ displayName: j,
2626
+ resourceType: "agent",
2627
+ projectName: f
2628
+ }, {
2629
+ onSuccess: (x) => {
2630
+ o("name", x.name);
2631
+ },
2632
+ onError: Vi
2633
+ });
2634
+ }, 500), e[6] = b, e[7] = o, e[8] = f, e[9] = u) : u = e[9];
2635
+ const h = u;
2636
+ let p, y;
2637
+ e[10] !== h ? (p = () => () => {
2638
+ h.cancel();
2639
+ }, y = [h], e[10] = h, e[11] = p, e[12] = y) : (p = e[11], y = e[12]), $e(p, y);
2640
+ let C, P;
2641
+ e[13] !== h || e[14] !== r.displayName || e[15] !== o ? (C = () => {
2642
+ r.displayName && r.displayName.length >= 3 ? h(r.displayName) : (h.cancel(), o("name", ""));
2643
+ }, P = [r.displayName, h, o], e[13] = h, e[14] = r.displayName, e[15] = o, e[16] = C, e[17] = P) : (C = e[16], P = e[17]), $e(C, P);
2644
+ let M;
2645
+ e[18] === Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ n(w.Subheader, { children: "Agent Details" }), e[18] = M) : M = e[18];
2646
+ let k;
2647
+ e[19] !== o ? (k = (j) => o("displayName", j.target.value), e[19] = o, e[20] = k) : k = e[20];
2648
+ const $ = !!s.displayName;
2649
+ let E;
2650
+ e[21] !== s.displayName || e[22] !== i ? (E = i ? /* @__PURE__ */ v(ne, { direction: "row", alignItems: "center", gap: 1, children: [
2651
+ /* @__PURE__ */ n(Lt, { size: 12 }),
2652
+ /* @__PURE__ */ n(U, { variant: "caption", children: "Validating name..." })
2653
+ ] }) : s.displayName || "A name for your agent", e[21] = s.displayName, e[22] = i, e[23] = E) : E = e[23];
2654
+ let V;
2655
+ e[24] !== r.displayName || e[25] !== $ || e[26] !== E || e[27] !== k ? (V = /* @__PURE__ */ n(w.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ n(ge, { id: "displayName", placeholder: "e.g., Customer Support Agent", value: r.displayName, onChange: k, error: $, helperText: E, fullWidth: !0 }) }), e[24] = r.displayName, e[25] = $, e[26] = E, e[27] = k, e[28] = V) : V = e[28];
2656
+ const L = r.description || "";
2657
+ let O;
2658
+ e[29] !== o ? (O = (j) => o("description", j.target.value), e[29] = o, e[30] = O) : O = e[30];
2659
+ const B = !!s.description;
2660
+ let A;
2661
+ e[31] !== s.description || e[32] !== L || e[33] !== O || e[34] !== B ? (A = /* @__PURE__ */ n(w.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ n(ge, { id: "description", placeholder: "Short description of what this agent does", multiline: !0, minRows: 2, maxRows: 6, value: L, onChange: O, error: B, helperText: s.description, fullWidth: !0 }) }), e[31] = s.description, e[32] = L, e[33] = O, e[34] = B, e[35] = A) : A = e[35];
2662
+ let F;
2663
+ e[36] !== r.labels ? (F = r.labels ?? {}, e[36] = r.labels, e[37] = F) : F = e[37];
2664
+ let R;
2665
+ e[38] !== o ? (R = (j) => o("labels", j), e[38] = o, e[39] = R) : R = e[39];
2666
+ let G;
2667
+ e[40] !== F || e[41] !== R ? (G = /* @__PURE__ */ n(w.ElementWrapper, { label: "Labels (optional)", name: "labels", children: /* @__PURE__ */ n(fr, { hideTitle: !0, description: "Attach key/value labels to organize and filter agents.", value: F, onChange: R }) }), e[40] = F, e[41] = R, e[42] = G) : G = e[42];
2668
+ let K;
2669
+ return e[43] !== V || e[44] !== A || e[45] !== G ? (K = /* @__PURE__ */ v(w.Section, { children: [
2670
+ M,
2671
+ /* @__PURE__ */ v(w.Stack, { spacing: 2, children: [
2672
+ V,
2673
+ A,
2674
+ G
2675
+ ] })
2676
+ ] }), e[43] = V, e[44] = A, e[45] = G, e[46] = K) : K = e[46], K;
2677
+ };
2678
+ function Vi(t) {
2679
+ console.error("Failed to generate name:", t);
2680
+ }
2681
+ const Ii = () => {
2682
+ const t = Vt(), [e] = aa(), {
2683
+ orgId: r,
2684
+ projectId: a,
2685
+ kindId: s
2686
+ } = Ae(), {
2687
+ data: l,
2688
+ isLoading: g
2689
+ } = ya({
2690
+ orgName: r,
2691
+ kindName: s ?? ""
2692
+ }), d = _e(() => [...l?.versions ?? []].sort((N, _) => new Date(_.createdAt).getTime() - new Date(N.createdAt).getTime()), [l]), [f, m] = oe(""), b = e.get("version") ?? "", i = _e(() => {
2693
+ const N = f || b;
2694
+ return N && d.some((_) => _.version === N) ? N : d[0]?.version || "";
2695
+ }, [f, b, d]), c = _e(() => l?.versions.find((N) => N.version === i), [l, i]), [o, u] = oe({
2696
+ deploymentType: "new",
2697
+ enableAutoInstrumentation: !0,
2698
+ name: "",
2699
+ displayName: "",
2700
+ description: "",
2701
+ // Catalog flow intentionally hides repo/build/input type sections in UI,
2702
+ // so we seed valid defaults for those required fields.
2703
+ repositoryUrl: "https://github.com/wso2/agent-catalog-template",
2704
+ branch: "main",
2705
+ appPath: "/",
2706
+ runCommand: "python main.py",
2707
+ language: "python",
2708
+ languageVersion: "3.11",
2709
+ dockerfilePath: "/Dockerfile",
2710
+ interfaceType: "DEFAULT",
2711
+ port: "",
2712
+ basePath: "/",
2713
+ openApiPath: "",
2714
+ env: [],
2715
+ files: []
2716
+ }), {
2717
+ errors: h,
2718
+ validateForm: p,
2719
+ setFieldError: y,
2720
+ validateField: C
2721
+ } = Tn(Kr);
2722
+ $e(() => {
2723
+ const N = c?.configSchema ?? [];
2724
+ N.length !== 0 && u((_) => ({
2725
+ ..._,
2726
+ env: N.map((D) => ({
2727
+ key: D.name,
2728
+ value: D.defaultValue ?? "",
2729
+ isSensitive: D.isSecret
2730
+ }))
2731
+ }));
2732
+ }, [c]);
2733
+ const P = _e(() => new Set((c?.configSchema ?? []).map((N) => N.name)), [c]), {
2734
+ mutate: M,
2735
+ isPending: k,
2736
+ error: $
2737
+ } = mr(), [E, V] = oe([]), [L, O] = oe([]), B = _e(() => ({
2738
+ orgName: r ?? "default",
2739
+ projName: a ?? "default"
2740
+ }), [r, a]), {
2741
+ data: A,
2742
+ isLoading: F
2743
+ } = Er(B), R = _e(() => Jr(A?.promotionPaths), [A?.promotionPaths]), K = _e(() => ea(A?.promotionPaths), [A?.promotionPaths]) ? R : void 0, j = _e(() => {
2744
+ const N = o.displayName ? o.displayName.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT";
2745
+ return [...E.flatMap((_, D) => [_.urlVarName ?? `${N}_${D + 1}_URL`, _.apikeyVarName ?? `${N}_${D + 1}_API_KEY`]), ...L.flatMap((_, D) => [_.urlVarName ?? `${N}_MCP_${D + 1}_URL`, _.apikeyVarName ?? `${N}_MCP_${D + 1}_API_KEY`])];
2746
+ }, [o.displayName, E, L]), x = _e(() => new Set(j), [j]), I = xe(() => {
2747
+ t(Ne(Se.children.org.children.projects.path, {
2748
+ orgId: r ?? "",
2749
+ projectId: a ?? "default"
2750
+ }));
2751
+ }, [t, r, a]), [S, W] = oe({}), Y = xe(() => {
2752
+ if (p(o))
2753
+ W({});
2754
+ else {
2755
+ W(h);
2756
+ return;
2757
+ }
2758
+ if ((E.length > 0 || L.length > 0) && !R) {
2759
+ W({
2760
+ llmProvider: "Unable to resolve the initial deployment environment for LLM provider / MCP proxy configuration."
2761
+ });
2762
+ return;
2763
+ }
2764
+ const N = xi(o, B, s ?? "", i, E, R, L);
2765
+ M(N, {
2766
+ onSuccess: () => {
2767
+ t(Ne(Se.children.org.children.projects.children.agents.path, {
2768
+ orgId: B.orgName ?? "",
2769
+ projectId: B.projName ?? "",
2770
+ agentId: N.body.name
2771
+ }) + "?setup=true");
2772
+ },
2773
+ onError: (_) => {
2774
+ console.error("Failed to create catalog agent:", _);
2775
+ }
2776
+ });
2777
+ }, [p, o, M, t, B, h, E, s, L, i, R]), T = _e(() => Ne(Se.children.org.children.projects.children.newAgent.children.create.children.catalog.path, {
2778
+ orgId: r ?? "",
2779
+ projectId: a ?? "default"
2780
+ }), [r, a]);
2781
+ return /* @__PURE__ */ v(It, { title: l ? `Create a "${l.displayName}" Agent` : g ? "Loading..." : `Create a "${s}" Agent`, description: "Add agent details and configure deployment settings.", disableIcon: !0, backHref: T, backLabel: "Back to Kind Selection", children: [
2782
+ g && /* @__PURE__ */ v(Ln, { children: [
2783
+ /* @__PURE__ */ n(Nr, { variant: "rounded", height: 32, sx: {
2784
+ mb: 2,
2785
+ maxWidth: 320
2786
+ } }),
2787
+ /* @__PURE__ */ n(Nr, { variant: "rounded", height: 48, sx: {
2788
+ mb: 1
2789
+ } })
2790
+ ] }),
2791
+ /* @__PURE__ */ v(w.Stack, { spacing: 3, children: [
2792
+ /* @__PURE__ */ n(wi, { formData: o, setFormData: u, errors: h, setFieldError: y, validateField: C }),
2793
+ d.length > 0 && /* @__PURE__ */ v(w.Section, { children: [
2794
+ /* @__PURE__ */ n(w.Subheader, { children: "Agent Kind Version" }),
2795
+ /* @__PURE__ */ n(w.Stack, { spacing: 2, children: /* @__PURE__ */ n(w.ElementWrapper, { label: "Version", name: "kindVersion", children: /* @__PURE__ */ n(wn, { size: "small", value: i, onChange: (N) => m(N.target.value), sx: {
2796
+ minWidth: 160
2797
+ }, children: d.map((N) => /* @__PURE__ */ v(wt, { value: N.version, children: [
2798
+ "v",
2799
+ N.version
2800
+ ] }, N.version)) }) }) })
2801
+ ] }),
2802
+ K && /* @__PURE__ */ v(Ie, { severity: "info", children: [
2803
+ "LLM providers, environment variables, and file mounts below apply only to the ",
2804
+ /* @__PURE__ */ n("strong", { children: K }),
2805
+ " environment. Configure values for other environments when promoting."
2806
+ ] }),
2807
+ /* @__PURE__ */ n(Hr, { llmProviders: E, setLLMProviders: V, agentDisplayName: o.displayName, initialEnvironmentName: R, isInitialEnvironmentLoading: F, externalEnvKeys: (() => {
2808
+ const N = o.displayName ? o.displayName.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT";
2809
+ return /* @__PURE__ */ new Set([...(o.env ?? []).map((_) => _.key).filter((_) => !!_), ...L.flatMap((_, D) => [_.urlVarName ?? `${N}_MCP_${D + 1}_URL`, _.apikeyVarName ?? `${N}_MCP_${D + 1}_API_KEY`])]);
2810
+ })() }),
2811
+ /* @__PURE__ */ n(Xr, { mcpProxies: L, setMCPProxies: O, agentDisplayName: o.displayName, initialEnvironmentName: R, isInitialEnvironmentLoading: F, externalEnvKeys: (() => {
2812
+ const N = o.displayName ? o.displayName.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT";
2813
+ return /* @__PURE__ */ new Set([...(o.env ?? []).map((_) => _.key).filter((_) => !!_), ...E.flatMap((_, D) => [_.urlVarName ?? `${N}_${D + 1}_URL`, _.apikeyVarName ?? `${N}_${D + 1}_API_KEY`])]);
2814
+ })() }),
2815
+ /* @__PURE__ */ n(qr, { formData: o, setFormData: u, lockedKeys: P, hideAdd: !0, llmReservedNames: x }),
2816
+ /* @__PURE__ */ n(Yr, { formData: o, setFormData: u }),
2817
+ !!$ && /* @__PURE__ */ n(Ie, { severity: "error", sx: {
2818
+ mt: 2
2819
+ }, children: $ instanceof Error ? $.message : "Failed to create agent" }),
2820
+ /* @__PURE__ */ n(gr, { lastSubmittedValidationErrors: S, isPending: k || (E.length > 0 || L.length > 0) && F, onCancel: I, onSubmit: Y, isNameEmpty: !o.name.trim(), mode: "deploy", hasLLMVarConflicts: (() => {
2821
+ if (j.length !== x.size) return !0;
2822
+ const N = (o.env ?? []).map((_) => _.key).filter((_) => !!_);
2823
+ return N.length !== new Set(N).size ? !0 : N.some((_) => x.has(_));
2824
+ })() })
2825
+ ] })
2826
+ ] });
2827
+ }, Li = () => {
2828
+ const t = Ce(17), {
2829
+ orgId: e,
2830
+ projectId: r
2831
+ } = Ae(), a = e ?? "";
2832
+ let s;
2833
+ t[0] !== a ? (s = {
2834
+ orgName: a
2835
+ }, t[0] = a, t[1] = s) : s = t[1];
2836
+ const {
2837
+ data: l,
2838
+ isLoading: g
2839
+ } = va(s), d = e ?? "", f = r ?? "default";
2840
+ let m;
2841
+ t[2] !== d || t[3] !== f ? (m = Ne(Se.children.org.children.projects.children.newAgent.children.create.path, {
2842
+ orgId: d,
2843
+ projectId: f
2844
+ }), t[2] = d, t[3] = f, t[4] = m) : m = t[4];
2845
+ const b = m;
2846
+ let i;
2847
+ t[5] !== e || t[6] !== r ? (i = (p) => Ne(Se.children.org.children.projects.children.newAgent.children.create.children.catalog.children.withKind.path, {
2848
+ orgId: e ?? "",
2849
+ projectId: r ?? "default",
2850
+ kindId: p.name
2851
+ }), t[5] = e, t[6] = r, t[7] = i) : i = t[7];
2852
+ const c = i;
2853
+ let o;
2854
+ t[8] !== l?.kinds ? (o = l?.kinds ?? [], t[8] = l?.kinds, t[9] = o) : o = t[9];
2855
+ let u;
2856
+ t[10] !== c || t[11] !== g || t[12] !== o ? (u = /* @__PURE__ */ n(Wa, { items: o, isLoading: g, getViewPath: c }), t[10] = c, t[11] = g, t[12] = o, t[13] = u) : u = t[13];
2857
+ let h;
2858
+ return t[14] !== b || t[15] !== u ? (h = /* @__PURE__ */ n(It, { title: "Select an Agent Kind", description: "Browse the catalog and pick a Agent Kind to create your agent from.", disableIcon: !0, backHref: b, backLabel: "Back to Source Type Selection", children: u }), t[14] = b, t[15] = u, t[16] = h) : h = t[16], h;
2859
+ }, Ti = ({
2860
+ formData: t,
2861
+ setFormData: e,
2862
+ errors: r,
2863
+ setFieldError: a,
2864
+ validateField: s
2865
+ }) => {
2866
+ const {
2867
+ orgId: l,
2868
+ projectId: g
2869
+ } = Ae(), {
2870
+ mutate: d,
2871
+ isPending: f
2872
+ } = cr({
2873
+ orgName: l
2874
+ }), m = xe((i, c) => {
2875
+ e((o) => {
2876
+ const u = {
2877
+ ...o,
2878
+ [i]: c
2879
+ }, h = s(i, c, u);
2880
+ return a(i, h), u;
2881
+ });
2882
+ }, [e, s, a]), b = _e(
2883
+ () => dr.debounce((i) => {
2884
+ if (i.length < 3) {
2885
+ m("name", "");
2886
+ return;
2887
+ }
2888
+ d({
2889
+ displayName: i,
2890
+ resourceType: "agent",
2891
+ projectName: g
2892
+ }, {
2893
+ onSuccess: (c) => {
2894
+ m("name", c.name);
2895
+ },
2896
+ onError: (c) => {
2897
+ console.error("Failed to generate name:", c);
2898
+ }
2899
+ });
2900
+ }, 500),
2901
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2902
+ [d, g, l, m]
2903
+ );
2904
+ return $e(() => () => {
2905
+ b.cancel();
2906
+ }, [b]), $e(() => {
2907
+ t.displayName && t.displayName.length >= 3 ? b(t.displayName) : (b.cancel(), m("name", ""));
2908
+ }, [t.displayName, b, m]), /* @__PURE__ */ n(w.Stack, { spacing: 3, children: /* @__PURE__ */ v(w.Section, { children: [
2909
+ /* @__PURE__ */ n(w.Subheader, { children: "Agent Details" }),
2910
+ /* @__PURE__ */ v(w.Stack, { spacing: 2, children: [
2911
+ /* @__PURE__ */ n(w.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ n(ge, { id: "displayName", placeholder: "e.g., Customer Support", value: t.displayName, onChange: (i) => m("displayName", i.target.value), error: !!r.displayName, helperText: f ? /* @__PURE__ */ v(ne, { direction: "row", alignItems: "center", gap: 1, children: [
2912
+ /* @__PURE__ */ n(Lt, { size: 12 }),
2913
+ /* @__PURE__ */ n(U, { variant: "caption", children: "Validating name..." })
2914
+ ] }) : r.displayName, fullWidth: !0 }) }),
2915
+ /* @__PURE__ */ n(w.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ n(ge, { id: "description", placeholder: "Short description of what this agent does", multiline: !0, minRows: 2, maxRows: 6, value: t.description || "", onChange: (i) => m("description", i.target.value), error: !!r.description, helperText: r.description, fullWidth: !0 }) }),
2916
+ /* @__PURE__ */ n(w.ElementWrapper, { label: "Labels (optional)", name: "labels", children: /* @__PURE__ */ n(fr, { hideTitle: !0, description: "Attach key/value labels to organize and filter agents.", value: t.labels ?? {}, onChange: (i) => m("labels", i) }) })
2917
+ ] })
2918
+ ] }) });
2919
+ }, $i = () => {
2920
+ const t = Ce(41), e = Vt(), {
2921
+ orgId: r,
2922
+ projectId: a
2923
+ } = Ae();
2924
+ let s;
2925
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (s = {
2926
+ deploymentType: "existing",
2927
+ name: "",
2928
+ displayName: "",
2929
+ description: ""
2930
+ }, t[0] = s) : s = t[0];
2931
+ const [l, g] = oe(s), {
2932
+ errors: d,
2933
+ validateForm: f,
2934
+ setFieldError: m,
2935
+ validateField: b
2936
+ } = Tn(Ga), {
2937
+ mutate: i,
2938
+ isPending: c,
2939
+ error: o
2940
+ } = mr(), u = r ?? "default", h = a ?? "default";
2941
+ let p;
2942
+ t[1] !== u || t[2] !== h ? (p = {
2943
+ orgName: u,
2944
+ projName: h
2945
+ }, t[1] = u, t[2] = h, t[3] = p) : p = t[3];
2946
+ const y = p;
2947
+ let C;
2948
+ t[4] !== e || t[5] !== r || t[6] !== a ? (C = () => {
2949
+ e(Ne(Se.children.org.children.projects.path, {
2950
+ orgId: r ?? "",
2951
+ projectId: a ?? "default"
2952
+ }));
2953
+ }, t[4] = e, t[5] = r, t[6] = a, t[7] = C) : C = t[7];
2954
+ const P = C;
2955
+ let M;
2956
+ t[8] !== i || t[9] !== e || t[10] !== y ? (M = (W) => {
2957
+ const Y = ra(W, y);
2958
+ i(Y, {
2959
+ onSuccess: () => {
2960
+ e(Ne(Se.children.org.children.projects.children.agents.path, {
2961
+ orgId: y.orgName ?? "",
2962
+ projectId: y.projName ?? "",
2963
+ agentId: Y.body.name
2964
+ }) + "?setup=true");
2965
+ },
2966
+ onError: Mi
2967
+ });
2968
+ }, t[8] = i, t[9] = e, t[10] = y, t[11] = M) : M = t[11];
2969
+ const k = M;
2970
+ let $;
2971
+ t[12] === Symbol.for("react.memo_cache_sentinel") ? ($ = {}, t[12] = $) : $ = t[12];
2972
+ const [E, V] = oe($);
2973
+ let L;
2974
+ t[13] !== d || t[14] !== l || t[15] !== k || t[16] !== f ? (L = () => {
2975
+ if (f(l))
2976
+ V({});
2977
+ else {
2978
+ V(d);
2979
+ return;
2980
+ }
2981
+ k(l);
2982
+ }, t[13] = d, t[14] = l, t[15] = k, t[16] = f, t[17] = L) : L = t[17];
2983
+ const O = L, B = r ?? "", A = a ?? "default";
2984
+ let F;
2985
+ t[18] !== B || t[19] !== A ? (F = Ne(Se.children.org.children.projects.path, {
2986
+ orgId: B,
2987
+ projectId: A
2988
+ }), t[18] = B, t[19] = A, t[20] = F) : F = t[20];
2989
+ const R = F;
2990
+ let G;
2991
+ t[21] !== d || t[22] !== l || t[23] !== m || t[24] !== b ? (G = /* @__PURE__ */ n(Ti, { formData: l, setFormData: g, errors: d, setFieldError: m, validateField: b }), t[21] = d, t[22] = l, t[23] = m, t[24] = b, t[25] = G) : G = t[25];
2992
+ let K;
2993
+ t[26] !== o ? (K = !!o && /* @__PURE__ */ n(Ie, { severity: "error", sx: {
2994
+ mt: 2
2995
+ }, children: o instanceof Error ? o.message : "Failed to register agent" }), t[26] = o, t[27] = K) : K = t[27];
2996
+ const j = !l.name.trim();
2997
+ let x;
2998
+ t[28] !== P || t[29] !== O || t[30] !== c || t[31] !== E || t[32] !== j ? (x = /* @__PURE__ */ n(gr, { lastSubmittedValidationErrors: E, isPending: c, onCancel: P, onSubmit: O, isNameEmpty: j, mode: "connect" }), t[28] = P, t[29] = O, t[30] = c, t[31] = E, t[32] = j, t[33] = x) : x = t[33];
2999
+ let I;
3000
+ t[34] !== G || t[35] !== K || t[36] !== x ? (I = /* @__PURE__ */ v(w.Stack, { spacing: 3, children: [
3001
+ G,
3002
+ K,
3003
+ x
3004
+ ] }), t[34] = G, t[35] = K, t[36] = x, t[37] = I) : I = t[37];
3005
+ let S;
3006
+ return t[38] !== R || t[39] !== I ? (S = /* @__PURE__ */ n(It, { title: "Register an Externally-Hosted Agent", description: "Provide basic information to register your externally-hosted agent on the platform.", disableIcon: !0, backHref: R, backLabel: "Back to Agents", children: I }), t[38] = R, t[39] = I, t[40] = S) : S = t[40], S;
3007
+ };
3008
+ function Mi(t) {
3009
+ console.error("Failed to register agent:", t);
3010
+ }
3011
+ const Di = () => {
3012
+ const t = Ce(21), e = Vt(), {
3013
+ orgId: r,
3014
+ projectId: a
3015
+ } = Ae(), s = Se.children.org.children.projects.children.newAgent, l = s.children.create.path, g = s.children.connect.path;
3016
+ let d;
3017
+ t[0] !== e || t[1] !== r || t[2] !== a ? (d = (P) => {
3018
+ e(Ne(P === "new" ? l : g, {
3019
+ orgId: r ?? "",
3020
+ projectId: a ?? "default"
3021
+ }));
3022
+ }, t[0] = e, t[1] = r, t[2] = a, t[3] = d) : d = t[3];
3023
+ const f = d;
3024
+ let m;
3025
+ t[4] !== e || t[5] !== r || t[6] !== a ? (m = (P) => {
3026
+ e(Ne(`${l}/${P}`, {
3027
+ orgId: r ?? "",
3028
+ projectId: a ?? "default"
3029
+ }));
3030
+ }, t[4] = e, t[5] = r, t[6] = a, t[7] = m) : m = t[7];
3031
+ const b = m;
3032
+ let i;
3033
+ t[8] !== f ? (i = /* @__PURE__ */ n(De, { index: !0, element: /* @__PURE__ */ n(Fa, { onSelect: f }) }), t[8] = f, t[9] = i) : i = t[9];
3034
+ let c;
3035
+ t[10] !== b ? (c = /* @__PURE__ */ n(De, { index: !0, element: /* @__PURE__ */ n(Ba, { onSelect: b }) }), t[10] = b, t[11] = c) : c = t[11];
3036
+ let o;
3037
+ t[12] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ n(De, { index: !0, element: /* @__PURE__ */ n(Li, {}) }), t[12] = o) : o = t[12];
3038
+ let u;
3039
+ t[13] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ v(De, { path: An.children.org.children.projects.children.newAgent.children.create.children.catalog.path, children: [
3040
+ o,
3041
+ /* @__PURE__ */ n(De, { path: An.children.org.children.projects.children.newAgent.children.create.children.catalog.children.withKind.path, element: /* @__PURE__ */ n(Ii, {}) })
3042
+ ] }), t[13] = u) : u = t[13];
3043
+ let h;
3044
+ t[14] === Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ n(De, { path: An.children.org.children.projects.children.newAgent.children.create.children.source.path, element: /* @__PURE__ */ n(ki, {}) }), t[14] = h) : h = t[14];
3045
+ let p;
3046
+ t[15] !== c ? (p = /* @__PURE__ */ v(De, { path: An.children.org.children.projects.children.newAgent.children.create.path, children: [
3047
+ c,
3048
+ u,
3049
+ h
3050
+ ] }), t[15] = c, t[16] = p) : p = t[16];
3051
+ let y;
3052
+ t[17] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(De, { path: "connect", element: /* @__PURE__ */ n($i, {}) }), t[17] = y) : y = t[17];
3053
+ let C;
3054
+ return t[18] !== i || t[19] !== p ? (C = /* @__PURE__ */ v(ia, { children: [
3055
+ i,
3056
+ p,
3057
+ y
3058
+ ] }), t[18] = i, t[19] = p, t[20] = C) : C = t[20], C;
3059
+ }, Hi = {
3060
+ title: "Add New Agent",
3061
+ description: "A page component for Add New Agent",
3062
+ icon: $a,
3063
+ path: Se.children.org.children.projects.children.newAgent.path,
3064
+ component: Di
3065
+ };
3066
+ export {
3067
+ Di as AddNewAgent,
3068
+ Hi as metaData
3069
+ };