@wso2/am-core-ui 0.0.3-rc1 → 0.0.4

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.
@@ -0,0 +1,2227 @@
1
+ import { jsxs as S, jsx as n, Fragment as yn } from "react/jsx-runtime";
2
+ import { c as ce } from "react/compiler-runtime";
3
+ import { useParams as ue, generatePath as le, useNavigate as nt, useSearchParams as Dn, Route as ke, Routes as Rn } from "react-router-dom";
4
+ import { dq as $n, ar as oe, i as Un, I as jn, P as tt, bw as jt, x as Mn, z as cn, bV as ne, bX as On, _ as dn, bt as vn, p as nn, bv as Wn, u as Fn, S as bn, E as mn, cT as Wt, cm as zn, dy as Gn, du as Bn, ds as Kn, dC as qn, h as Hn, g as Zn, f as Yn, G as Qn, ao as Xn, cP as Jn, cV as an, bu as ln, b as er, D as Sn, ch as on, e as tr, c_ as nr, dn as rr, C as ar, bN as Ut } from "./index-D1OGVlu2.js";
5
+ import { Form as _, Typography as j, Box as ee, Divider as Nn, TextField as re, Alert as xe, Collapse as Te, Card as ir, CardContent as lr, Button as Ce, DialogContent as or, DialogTitle as sr, DialogActions as cr, Dialog as dr, FormHelperText as Mt, FormControl as rn, MenuItem as et, CircularProgress as rt, Stack as ae, Select as Ot, SearchBar as mr, ListingTable as pn, Tabs as pr, Tooltip as hn, Chip as Cn, Tab as hr, Avatar as ur, IconButton as fr, AccordionSummary as gr, AccordionDetails as yr, Accordion as vr, FormControlLabel as br, Checkbox as Sr, Skeleton as un } from "@wso2/oxygen-ui";
6
+ import "@tanstack/react-query";
7
+ import { useState as ie, useRef as Nr, useMemo as be, useCallback as Ne, useEffect as Le } from "react";
8
+ import { FileCode as Cr, Package as _r, CheckCircle as Ar, Circle as _n, Plus as Ft, DoorClosedLocked as kr, Link as An, Search as xr, Check as Pr, ChevronDown as Er, Trash2 as wr, Rocket as Ir, UserPlus as Tr } from "@wso2/oxygen-ui-icons-react";
9
+ const fn = (t) => {
10
+ const e = ce(18), {
11
+ type: r,
12
+ title: o,
13
+ subheader: l,
14
+ icon: a,
15
+ onClick: u
16
+ } = t;
17
+ let f;
18
+ e[0] !== u || e[1] !== r ? (f = () => {
19
+ u(r);
20
+ }, e[0] = u, e[1] = r, e[2] = f) : f = e[2];
21
+ const g = f;
22
+ let y;
23
+ e[3] === Symbol.for("react.memo_cache_sentinel") ? (y = {
24
+ width: 450,
25
+ py: 2
26
+ }, e[3] = y) : y = e[3];
27
+ let v;
28
+ e[4] !== o ? (v = /* @__PURE__ */ n(j, { width: "100%", variant: "h4", textAlign: "center", children: o }), e[4] = o, e[5] = v) : v = e[5];
29
+ let i;
30
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (i = {
31
+ display: "flex",
32
+ justifyContent: "center",
33
+ alignItems: "flex-end",
34
+ height: 250,
35
+ mb: 10
36
+ }, e[6] = i) : i = e[6];
37
+ let d;
38
+ e[7] !== a ? (d = /* @__PURE__ */ n(ee, { sx: i, children: a }), e[7] = a, e[8] = d) : d = e[8];
39
+ let s;
40
+ e[9] !== l ? (s = /* @__PURE__ */ n(j, { variant: "body2", textAlign: "center", children: l }), e[9] = l, e[10] = s) : s = e[10];
41
+ let p;
42
+ e[11] !== d || e[12] !== s ? (p = /* @__PURE__ */ S(_.CardContent, { children: [
43
+ d,
44
+ s
45
+ ] }), e[11] = d, e[12] = s, e[13] = p) : p = e[13];
46
+ let m;
47
+ return e[14] !== g || e[15] !== v || e[16] !== p ? (m = /* @__PURE__ */ S(_.CardButton, { onClick: g, sx: y, children: [
48
+ v,
49
+ p
50
+ ] }), e[14] = g, e[15] = v, e[16] = p, e[17] = m) : m = e[17], m;
51
+ }, Lr = (t) => {
52
+ const e = ce(20), {
53
+ onSelect: r
54
+ } = t, {
55
+ orgId: o,
56
+ projectId: l
57
+ } = ue(), a = o ?? "default", u = l ?? "default";
58
+ let f;
59
+ e[0] !== a || e[1] !== u ? (f = {
60
+ orgName: a,
61
+ projName: u
62
+ }, e[0] = a, e[1] = u, e[2] = f) : f = e[2];
63
+ const {
64
+ data: g
65
+ } = $n(f);
66
+ let y;
67
+ e[3] !== r ? (y = (T) => {
68
+ r(T);
69
+ }, e[3] = r, e[4] = y) : y = e[4];
70
+ const v = y, i = !!(g?.agents?.length && g?.agents?.length > 0);
71
+ let d;
72
+ e: {
73
+ if (!i) {
74
+ d = void 0;
75
+ break e;
76
+ }
77
+ const T = o ?? "", I = l ?? "default";
78
+ let P;
79
+ e[5] !== T || e[6] !== I ? (P = le(oe.children.org.children.projects.path, {
80
+ orgId: T,
81
+ projectId: I
82
+ }), e[5] = T, e[6] = I, e[7] = P) : P = e[7], d = P;
83
+ }
84
+ const s = d;
85
+ let p;
86
+ e[8] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ n(Un, { width: 150 }), e[8] = p) : p = e[8];
87
+ let m;
88
+ e[9] !== v ? (m = /* @__PURE__ */ n(fn, { type: "existing", title: "Externally-Hosted Agent", subheader: "Connect an existing agent running outside the platform and enable observability and governance.", icon: p, onClick: v }), e[9] = v, e[10] = m) : m = e[10];
89
+ let h;
90
+ e[11] === Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ n(jn, { width: 150 }), e[11] = h) : h = e[11];
91
+ let c;
92
+ e[12] !== v ? (c = /* @__PURE__ */ n(fn, { 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: h, onClick: v }), e[12] = v, e[13] = c) : c = e[13];
93
+ let A;
94
+ e[14] !== m || e[15] !== c ? (A = /* @__PURE__ */ S(ee, { display: "flex", flexDirection: "row", gap: 3, width: 1, children: [
95
+ m,
96
+ c
97
+ ] }), e[14] = m, e[15] = c, e[16] = A) : A = e[16];
98
+ let k;
99
+ return e[17] !== s || e[18] !== A ? (k = /* @__PURE__ */ n(tt, { 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: s, backLabel: "Back to Projects Home", children: A }), e[17] = s, e[18] = A, e[19] = k) : k = e[19], k;
100
+ }, Vr = (t) => {
101
+ const e = ce(12), {
102
+ onSelect: r
103
+ } = t, {
104
+ orgId: o,
105
+ projectId: l
106
+ } = ue();
107
+ let a;
108
+ e[0] !== r ? (a = (h) => {
109
+ r(h);
110
+ }, e[0] = r, e[1] = a) : a = e[1];
111
+ const u = a, f = o ?? "", g = l ?? "default";
112
+ let y;
113
+ e[2] !== f || e[3] !== g ? (y = le(oe.children.org.children.projects.path, {
114
+ orgId: f,
115
+ projectId: g
116
+ }), e[2] = f, e[3] = g, e[4] = y) : y = e[4];
117
+ const v = y;
118
+ let i;
119
+ e[5] === Symbol.for("react.memo_cache_sentinel") ? (i = {
120
+ type: "source",
121
+ title: "Source Code",
122
+ subheader: "Provide agent source code from project repository",
123
+ icon: /* @__PURE__ */ n(Cr, { size: 56 })
124
+ }, e[5] = i) : i = e[5];
125
+ let d;
126
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (d = [i, {
127
+ type: "catalog",
128
+ title: "Agent Catalog",
129
+ subheader: "Pick an Agent Kind from Agent Catalog",
130
+ icon: /* @__PURE__ */ n(_r, { size: 56 })
131
+ }], e[6] = d) : d = e[6];
132
+ const s = d;
133
+ let p;
134
+ e[7] !== u ? (p = /* @__PURE__ */ n(ee, { display: "flex", flexDirection: "row", gap: 3, flexWrap: "wrap", children: s.map((h) => /* @__PURE__ */ S(_.CardButton, { onClick: () => u(h.type), sx: {
135
+ minHeight: 152,
136
+ px: 3,
137
+ py: 2,
138
+ display: "flex",
139
+ flexDirection: "row",
140
+ alignItems: "center",
141
+ justifyContent: "flex-start",
142
+ gap: 3,
143
+ textAlign: "left"
144
+ }, children: [
145
+ /* @__PURE__ */ n(ee, { sx: {
146
+ height: 112,
147
+ display: "flex",
148
+ alignItems: "center",
149
+ justifyContent: "center",
150
+ flexShrink: 0
151
+ }, children: h.icon }),
152
+ /* @__PURE__ */ S(ee, { display: "flex", flexDirection: "column", gap: 1, alignItems: "flex-start", children: [
153
+ /* @__PURE__ */ n(j, { variant: "h3", textAlign: "left", children: h.title }),
154
+ /* @__PURE__ */ n(j, { variant: "body1", textAlign: "left", sx: {
155
+ maxWidth: 260
156
+ }, children: h.subheader })
157
+ ] })
158
+ ] }, h.type)) }), e[7] = u, e[8] = p) : p = e[8];
159
+ let m;
160
+ return e[9] !== v || e[10] !== p ? (m = /* @__PURE__ */ n(tt, { title: "Create a Platform-Hosted Agent", description: "Pick a source type for the agent", disableIcon: !0, backHref: v, backLabel: "Back to Agents", children: p }), e[9] = v, e[10] = p, e[11] = m) : m = e[11], m;
161
+ }, kn = {
162
+ displayName: ne().trim().min(1, "Name is required").min(3, "Name must be at least 3 characters").max(100, "Name must be at most 100 characters"),
163
+ name: ne().trim().max(50, "Name must be at most 50 characters"),
164
+ description: ne().trim().optional()
165
+ }, Dr = jt({
166
+ ...kn,
167
+ deploymentType: vn("existing").optional()
168
+ }), xn = jt({
169
+ ...kn,
170
+ deploymentType: vn("new").optional(),
171
+ enableAutoInstrumentation: cn().default(!0),
172
+ instrumentationVersion: dn(bn).optional(),
173
+ repositoryUrl: ne().trim().min(1, "Repository URL is required").url("Must be a valid URL"),
174
+ branch: ne().trim().min(1, "Branch is required"),
175
+ appPath: ne().trim().min(1, "App path is required").refine((t) => t.startsWith("/"), {
176
+ message: "App path must start with /"
177
+ }).refine((t) => !/\.\./.test(t), {
178
+ message: "Path traversal is not allowed"
179
+ }).refine((t) => /^\/[A-Za-z0-9._\-/]*$/.test(t), {
180
+ message: "App path can only contain letters, numbers, ., _, -, and /"
181
+ }).refine((t) => t === "/" ? !0 : !t.endsWith("/"), {
182
+ message: "App path must be a valid path (use / for root directory)"
183
+ }),
184
+ gitSecretRef: ne().trim().optional(),
185
+ runCommand: ne().trim().optional(),
186
+ language: ne().trim().min(1, "Language is required"),
187
+ languageVersion: ne().trim().optional(),
188
+ dockerfilePath: ne().trim().optional(),
189
+ interfaceType: dn(["DEFAULT", "CUSTOM"]),
190
+ port: On([Wn(), ne(), Fn()]).transform((t) => {
191
+ if (!(t === "" || t === null || t === void 0))
192
+ return typeof t == "string" ? Number(t) : t;
193
+ }).optional(),
194
+ basePath: ne().trim().optional(),
195
+ openApiPath: ne().trim().optional(),
196
+ env: Mn(jt({
197
+ key: ne().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(),
198
+ value: ne().trim().max(2048, "Environment variable value must be at most 2048 characters").optional(),
199
+ isSensitive: cn().default(!1)
200
+ })).max(50, "A maximum of 50 environment variables is allowed")
201
+ }).refine((t) => !(t.interfaceType === "CUSTOM" && !t.port), {
202
+ message: "Port is required when using custom interface",
203
+ path: ["port"]
204
+ }).refine((t) => !(t.interfaceType === "CUSTOM" && t.port !== void 0 && (!Number.isInteger(t.port) || t.port < 1 || t.port > 65535)), {
205
+ message: "Port must be between 1 and 65535",
206
+ path: ["port"]
207
+ }).refine((t) => !(t.interfaceType === "CUSTOM" && !t.basePath), {
208
+ message: "Base path is required when using custom interface",
209
+ path: ["basePath"]
210
+ }).refine((t) => !(t.interfaceType === "CUSTOM" && !t.openApiPath), {
211
+ message: "OpenAPI spec path is required when using custom interface",
212
+ path: ["openApiPath"]
213
+ }).refine((t) => !(t.language === "python" && !t.runCommand?.trim()), {
214
+ message: "Start Command is required for Python agents",
215
+ path: ["runCommand"]
216
+ }).refine((t) => !(t.language === "python" && !t.languageVersion?.trim()), {
217
+ message: "Python version is required for Python agents",
218
+ path: ["languageVersion"]
219
+ }).refine((t) => !(t.language === "python" && t.languageVersion?.trim() && !nn.includes(t.languageVersion.trim())), {
220
+ message: `Python version must be one of: ${nn.join(", ")}`,
221
+ path: ["languageVersion"]
222
+ }).refine((t) => !(t.language === "docker" && !t.dockerfilePath?.trim()), {
223
+ message: "Dockerfile path is required for Docker agents",
224
+ path: ["dockerfilePath"]
225
+ }).refine((t) => !(t.language === "docker" && t.dockerfilePath?.trim() && !t.dockerfilePath.startsWith("/")), {
226
+ message: "Dockerfile path must start with /",
227
+ path: ["dockerfilePath"]
228
+ }), Rr = [{
229
+ label: "Chat Agent",
230
+ description: "Standard chat interface with /chat endpoint on port 8000",
231
+ default: !0,
232
+ value: "DEFAULT"
233
+ }, {
234
+ label: "Custom API Agent",
235
+ description: "Custom HTTP API with user-specified OpenAPI specification and port configuration",
236
+ default: !1,
237
+ value: "CUSTOM"
238
+ }], $r = (t) => {
239
+ const e = ce(57), {
240
+ formData: r,
241
+ setFormData: o,
242
+ errors: l,
243
+ setFieldError: a,
244
+ validateField: u
245
+ } = t;
246
+ let f;
247
+ e[0] !== a || e[1] !== o || e[2] !== u ? (f = (O, B) => {
248
+ let Z = null;
249
+ if (o((te) => (Z = {
250
+ ...te,
251
+ [O]: B
252
+ }, Z)), Z) {
253
+ const te = u(O, B, Z);
254
+ a(O, te);
255
+ }
256
+ }, e[0] = a, e[1] = o, e[2] = u, e[3] = f) : f = e[3];
257
+ const g = f;
258
+ let y;
259
+ e[4] !== a || e[5] !== o || e[6] !== u ? (y = (O) => {
260
+ o((B) => ({
261
+ ...B,
262
+ interfaceType: O,
263
+ ...O === "DEFAULT" ? {
264
+ openApiPath: "",
265
+ port: "",
266
+ basePath: "/"
267
+ } : {}
268
+ })), o((B) => {
269
+ const Z = u("interfaceType", O, B);
270
+ if (a("interfaceType", Z), O === "CUSTOM") {
271
+ const te = u("port", B.port, B);
272
+ a("port", te);
273
+ const fe = u("openApiPath", B.openApiPath, B);
274
+ a("openApiPath", fe);
275
+ const se = u("basePath", B.basePath, B);
276
+ a("basePath", se);
277
+ } else
278
+ a("port", void 0), a("openApiPath", void 0), a("basePath", void 0);
279
+ return B;
280
+ });
281
+ }, e[4] = a, e[5] = o, e[6] = u, e[7] = y) : y = e[7];
282
+ const v = y;
283
+ let i;
284
+ e[8] !== g ? (i = (O) => {
285
+ const B = O.target.value;
286
+ /^\d*$/.test(B) && g("port", B === "" ? "" : Number(B));
287
+ }, e[8] = g, e[9] = i) : i = e[9];
288
+ const d = i;
289
+ let s, p;
290
+ e[10] === Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ n(_.Subheader, { children: "Agent Type" }), p = /* @__PURE__ */ n(j, { variant: "body2", color: "text.secondary", children: "How your agent receives requests" }), e[10] = s, e[11] = p) : (s = e[10], p = e[11]);
291
+ let m;
292
+ e[12] !== r.interfaceType || e[13] !== v ? (m = Rr.map((O) => /* @__PURE__ */ n(_.CardButton, { onClick: () => v(O.value), selected: r.interfaceType === O.value, sx: {
293
+ maxWidth: 500,
294
+ flexGrow: 1
295
+ }, children: /* @__PURE__ */ n(_.CardContent, { sx: {
296
+ height: "100%"
297
+ }, children: /* @__PURE__ */ S(ee, { display: "flex", flexDirection: "row", alignItems: "center", height: "100%", gap: 1, children: [
298
+ /* @__PURE__ */ n(ee, { children: r.interfaceType === O.value ? /* @__PURE__ */ n(Ar, { size: 16 }) : /* @__PURE__ */ n(_n, { size: 16 }) }),
299
+ /* @__PURE__ */ n(Nn, { orientation: "vertical", flexItem: !0 }),
300
+ /* @__PURE__ */ S(ee, { children: [
301
+ /* @__PURE__ */ n(j, { variant: "h6", children: O.label }),
302
+ /* @__PURE__ */ n(j, { variant: "caption", children: O.description })
303
+ ] })
304
+ ] }) }) }, O.value)), e[12] = r.interfaceType, e[13] = v, e[14] = m) : m = e[14];
305
+ let h;
306
+ e[15] !== m ? (h = /* @__PURE__ */ n(ee, { display: "flex", flexDirection: "row", gap: 1, children: m }), e[15] = m, e[16] = h) : h = e[16];
307
+ const c = r.interfaceType === "DEFAULT";
308
+ let A;
309
+ e[17] === Symbol.for("react.memo_cache_sentinel") ? (A = /* @__PURE__ */ n("strong", { children: "POST /chat" }), e[17] = A) : A = e[17];
310
+ let k, T;
311
+ e[18] === Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ n("strong", { children: "8000" }), T = /* @__PURE__ */ n("br", {}), e[18] = k, e[19] = T) : (k = e[18], T = e[19]);
312
+ let I, P;
313
+ e[20] === Symbol.for("react.memo_cache_sentinel") ? (I = /* @__PURE__ */ n("code", { children: "{message: string, session_id: string, context: JSON}" }), P = /* @__PURE__ */ n("br", {}), e[20] = I, e[21] = P) : (I = e[20], P = e[21]);
314
+ let E;
315
+ e[22] === Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ S(xe, { severity: "info", children: [
316
+ "Uses the standard chat interface: ",
317
+ A,
318
+ " on port ",
319
+ k,
320
+ T,
321
+ "Request:",
322
+ " ",
323
+ I,
324
+ P,
325
+ "Response: ",
326
+ /* @__PURE__ */ n("code", { children: "{response: string}" })
327
+ ] }), e[22] = E) : E = e[22];
328
+ let V;
329
+ e[23] !== c ? (V = /* @__PURE__ */ n(Te, { in: c, children: E }), e[23] = c, e[24] = V) : V = e[24];
330
+ const D = r.interfaceType === "CUSTOM", L = r.openApiPath || "";
331
+ let U;
332
+ e[25] !== g ? (U = (O) => g("openApiPath", O.target.value), e[25] = g, e[26] = U) : U = e[26];
333
+ const W = !!l.openApiPath, R = l.openApiPath || "Path to OpenAPI schema file in your repository";
334
+ let x;
335
+ e[27] !== L || e[28] !== U || e[29] !== W || e[30] !== R ? (x = /* @__PURE__ */ n(ee, { display: "flex", flexDirection: "column", flexGrow: 1, children: /* @__PURE__ */ n(_.ElementWrapper, { label: "OpenAPI Spec Path", name: "openApiPath", children: /* @__PURE__ */ n(re, { id: "openApiPath", placeholder: "/openapi.yaml", required: !0, value: L, onChange: U, error: W, helperText: R, fullWidth: !0 }) }) }), e[27] = L, e[28] = U, e[29] = W, e[30] = R, e[31] = x) : x = e[31];
336
+ const F = r.port ?? "", M = !!l.port, N = l.port || (r.port ? void 0 : "Port is required");
337
+ let w;
338
+ e[32] !== d || e[33] !== F || e[34] !== M || e[35] !== N ? (w = /* @__PURE__ */ n(ee, { children: /* @__PURE__ */ n(_.ElementWrapper, { label: "Port", name: "port", children: /* @__PURE__ */ n(re, { id: "port", placeholder: "8080", required: !0, value: F, onChange: d, type: "number", error: M, helperText: N }) }) }), e[32] = d, e[33] = F, e[34] = M, e[35] = N, e[36] = w) : w = e[36];
339
+ let b;
340
+ e[37] !== x || e[38] !== w ? (b = /* @__PURE__ */ S(_.Stack, { direction: "row", spacing: 2, children: [
341
+ x,
342
+ w
343
+ ] }), e[37] = x, e[38] = w, e[39] = b) : b = e[39];
344
+ const C = r.basePath || "";
345
+ let $;
346
+ e[40] !== g ? ($ = (O) => g("basePath", O.target.value), e[40] = g, e[41] = $) : $ = e[41];
347
+ const z = !!l.basePath, G = l.basePath || "API base path (e.g., / or /api/v1)";
348
+ let Q;
349
+ e[42] !== C || e[43] !== $ || e[44] !== z || e[45] !== G ? (Q = /* @__PURE__ */ n(_.ElementWrapper, { label: "Base Path", name: "basePath", children: /* @__PURE__ */ n(re, { id: "basePath", placeholder: "/", required: !0, value: C, onChange: $, error: z, helperText: G, fullWidth: !0 }) }), e[42] = C, e[43] = $, e[44] = z, e[45] = G, e[46] = Q) : Q = e[46];
350
+ let q;
351
+ e[47] !== b || e[48] !== Q ? (q = /* @__PURE__ */ S(_.Stack, { spacing: 2, children: [
352
+ b,
353
+ Q
354
+ ] }), e[47] = b, e[48] = Q, e[49] = q) : q = e[49];
355
+ let H;
356
+ e[50] !== D || e[51] !== q ? (H = /* @__PURE__ */ n(Te, { in: D, children: q }), e[50] = D, e[51] = q, e[52] = H) : H = e[52];
357
+ let X;
358
+ return e[53] !== V || e[54] !== H || e[55] !== h ? (X = /* @__PURE__ */ S(_.Section, { children: [
359
+ s,
360
+ p,
361
+ /* @__PURE__ */ S(_.Stack, { spacing: 2, children: [
362
+ h,
363
+ V,
364
+ H
365
+ ] })
366
+ ] }), e[53] = V, e[54] = H, e[55] = h, e[56] = X) : X = e[56], X;
367
+ }, Pn = ({
368
+ formData: t,
369
+ setFormData: e,
370
+ llmReservedNames: r = /* @__PURE__ */ new Set(),
371
+ lockedKeys: o = /* @__PURE__ */ new Set(),
372
+ hideAdd: l = !1
373
+ }) => {
374
+ const a = t.env || [], u = a.some((i) => !i?.key || !i?.value), f = () => {
375
+ e((i) => ({
376
+ ...i,
377
+ env: [...i.env || [], {
378
+ key: "",
379
+ value: "",
380
+ isSensitive: !1
381
+ }]
382
+ }));
383
+ }, g = (i) => {
384
+ e((d) => ({
385
+ ...d,
386
+ env: d.env?.filter((s, p) => p !== i) || []
387
+ }));
388
+ }, y = (i, d, s) => {
389
+ e((p) => ({
390
+ ...p,
391
+ env: p.env?.map((m, h) => h === i ? {
392
+ ...m,
393
+ [d]: s
394
+ } : m) || []
395
+ }));
396
+ }, v = (i, d) => {
397
+ e((s) => {
398
+ const p = s.env || [];
399
+ return p.length > 0 ? {
400
+ ...s,
401
+ env: p.map((m, h) => h === 0 ? {
402
+ ...m,
403
+ [i]: d
404
+ } : m)
405
+ } : {
406
+ ...s,
407
+ env: [{
408
+ key: i === "key" ? d : "",
409
+ value: i === "value" ? d : "",
410
+ isSensitive: i === "isSensitive" ? d : !1
411
+ }]
412
+ };
413
+ });
414
+ };
415
+ return /* @__PURE__ */ n(ir, { variant: "outlined", children: /* @__PURE__ */ S(lr, { children: [
416
+ /* @__PURE__ */ n(ee, { display: "flex", flexDirection: "row", alignItems: "center", gap: 1, children: /* @__PURE__ */ n(j, { variant: "h5", children: l ? "Environment Variables" : "Environment Variables (Optional)" }) }),
417
+ /* @__PURE__ */ n(ee, { display: "flex", flexDirection: "column", py: 2, gap: 2, children: a.length ? a.map((i, d) => {
418
+ const s = new Set(a.flatMap((h, c) => c !== d && h.key ? [h.key] : [])), p = !!i.key && o.has(i.key), m = i.key && r.has(i.key) ? "Already used as an LLM provider variable" : i.key && s.has(i.key) ? "Duplicate key" : void 0;
419
+ return /* @__PURE__ */ n(mn, { index: d, keyValue: i.key || "", valueValue: i.value || "", isSensitive: i.isSensitive || !1, onKeyChange: (h) => y(d, "key", h), onValueChange: (h) => y(d, "value", h), onSensitiveChange: (h) => y(d, "isSensitive", h), onRemove: p ? () => {
420
+ } : () => g(d), keyDisabled: p, keyError: m }, `env-${d}`);
421
+ }) : /* @__PURE__ */ n(mn, { index: 0, keyValue: a?.[0]?.key || "", valueValue: a?.[0]?.value || "", isSensitive: a?.[0]?.isSensitive || !1, onKeyChange: (i) => v("key", i), onValueChange: (i) => v("value", i), onSensitiveChange: (i) => v("isSensitive", i), onRemove: () => g(0), keyError: a?.[0]?.key && r.has(a[0].key) ? "Already used as an LLM provider variable" : void 0 }, "env-0") }),
422
+ !l && /* @__PURE__ */ n(Ce, { startIcon: /* @__PURE__ */ n(Ft, { fontSize: "small" }), disabled: u, variant: "outlined", color: "primary", size: "small", onClick: f, children: "Add" })
423
+ ] }) });
424
+ }, Ur = jt({
425
+ name: ne().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, {
426
+ message: "Name must start and end with alphanumeric characters"
427
+ }),
428
+ username: ne().trim().min(1, "Username is required"),
429
+ password: ne().min(1, "Password/PAT is required")
430
+ }), tn = {
431
+ name: "",
432
+ username: "",
433
+ password: ""
434
+ }, jr = (t) => {
435
+ const e = ce(59), {
436
+ open: r,
437
+ onClose: o,
438
+ onSecretCreated: l
439
+ } = t, {
440
+ orgId: a
441
+ } = ue(), [u, f] = ie(tn), {
442
+ errors: g,
443
+ validateForm: y,
444
+ clearErrors: v,
445
+ clearFieldError: i
446
+ } = Wt(Ur), {
447
+ mutate: d,
448
+ isPending: s,
449
+ error: p,
450
+ reset: m
451
+ } = zn();
452
+ let h;
453
+ e[0] !== i ? (h = (O, B) => {
454
+ f((Z) => ({
455
+ ...Z,
456
+ [O]: B
457
+ })), i(O);
458
+ }, e[0] = i, e[1] = h) : h = e[1];
459
+ const c = h;
460
+ let A;
461
+ e[2] !== d || e[3] !== u || e[4] !== l || e[5] !== a || e[6] !== y ? (A = () => {
462
+ y(u) && d({
463
+ params: {
464
+ orgName: a
465
+ },
466
+ body: {
467
+ name: u.name.trim(),
468
+ type: "basic-auth",
469
+ credentials: {
470
+ username: u.username.trim(),
471
+ password: u.password
472
+ }
473
+ }
474
+ }, {
475
+ onSuccess: () => {
476
+ l(u.name.trim()), f(tn);
477
+ }
478
+ });
479
+ }, e[2] = d, e[3] = u, e[4] = l, e[5] = a, e[6] = y, e[7] = A) : A = e[7];
480
+ const k = A;
481
+ let T;
482
+ e[8] !== v || e[9] !== s || e[10] !== o || e[11] !== m ? (T = () => {
483
+ s || (f(tn), v(), m(), o());
484
+ }, e[8] = v, e[9] = s, e[10] = o, e[11] = m, e[12] = T) : T = e[12];
485
+ const I = T;
486
+ let P;
487
+ e[13] === Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ n(sr, { children: "Create Git Secret" }), e[13] = P) : P = e[13];
488
+ let E, V;
489
+ e[14] === Symbol.for("react.memo_cache_sentinel") ? (E = {
490
+ mt: 1
491
+ }, V = /* @__PURE__ */ n(j, { 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]);
492
+ let D;
493
+ e[16] !== p ? (D = !!p && /* @__PURE__ */ n(xe, { severity: "error", children: "Failed to create git secret. Please try again." }), e[16] = p, e[17] = D) : D = e[17];
494
+ let L;
495
+ e[18] !== c ? (L = (O) => c("name", O.target.value), e[18] = c, e[19] = L) : L = e[19];
496
+ const U = !!g.name, W = g.name || "A unique name for this secret";
497
+ let R;
498
+ e[20] !== u.name || e[21] !== W || e[22] !== L || e[23] !== U ? (R = /* @__PURE__ */ n(_.ElementWrapper, { label: "Secret Name", name: "name", children: /* @__PURE__ */ n(re, { id: "name", placeholder: "e.g., my-github-pat", value: u.name, onChange: L, error: U, helperText: W, fullWidth: !0 }) }), e[20] = u.name, e[21] = W, e[22] = L, e[23] = U, e[24] = R) : R = e[24];
499
+ let x;
500
+ e[25] !== c ? (x = (O) => c("username", O.target.value), e[25] = c, e[26] = x) : x = e[26];
501
+ const F = !!g.username, M = g.username || "Your Git username";
502
+ let N;
503
+ e[27] !== u.username || e[28] !== x || e[29] !== F || e[30] !== M ? (N = /* @__PURE__ */ n(_.ElementWrapper, { label: "Username", name: "username", children: /* @__PURE__ */ n(re, { id: "username", placeholder: "e.g., your-github-username", value: u.username, onChange: x, error: F, helperText: M, fullWidth: !0 }) }), e[27] = u.username, e[28] = x, e[29] = F, e[30] = M, e[31] = N) : N = e[31];
504
+ let w;
505
+ e[32] !== c ? (w = (O) => c("password", O.target.value), e[32] = c, e[33] = w) : w = e[33];
506
+ const b = !!g.password, C = g.password || "Your personal access token (PAT) with repo access";
507
+ let $;
508
+ e[34] !== u.password || e[35] !== w || e[36] !== b || e[37] !== C ? ($ = /* @__PURE__ */ n(_.ElementWrapper, { label: "Personal Access Token", name: "password", children: /* @__PURE__ */ n(re, { id: "password", placeholder: "ghp_xxxxxxxxxxxx", type: "password", value: u.password, onChange: w, error: b, helperText: C, fullWidth: !0 }) }), e[34] = u.password, e[35] = w, e[36] = b, e[37] = C, e[38] = $) : $ = e[38];
509
+ let z;
510
+ e[39] !== R || e[40] !== N || e[41] !== $ || e[42] !== D ? (z = /* @__PURE__ */ n(or, { children: /* @__PURE__ */ S(_.Stack, { spacing: 3, sx: E, children: [
511
+ V,
512
+ D,
513
+ R,
514
+ N,
515
+ $
516
+ ] }) }), e[39] = R, e[40] = N, e[41] = $, e[42] = D, e[43] = z) : z = e[43];
517
+ let G;
518
+ e[44] !== I || e[45] !== s ? (G = /* @__PURE__ */ n(Ce, { onClick: I, disabled: s, children: "Cancel" }), e[44] = I, e[45] = s, e[46] = G) : G = e[46];
519
+ const Q = s ? "Creating..." : "Create Secret";
520
+ let q;
521
+ e[47] !== k || e[48] !== s || e[49] !== Q ? (q = /* @__PURE__ */ n(Ce, { variant: "contained", onClick: k, disabled: s, children: Q }), e[47] = k, e[48] = s, e[49] = Q, e[50] = q) : q = e[50];
522
+ let H;
523
+ e[51] !== G || e[52] !== q ? (H = /* @__PURE__ */ S(cr, { children: [
524
+ G,
525
+ q
526
+ ] }), e[51] = G, e[52] = q, e[53] = H) : H = e[53];
527
+ let X;
528
+ return e[54] !== I || e[55] !== r || e[56] !== z || e[57] !== H ? (X = /* @__PURE__ */ S(dr, { open: r, onClose: I, maxWidth: "sm", fullWidth: !0, children: [
529
+ P,
530
+ z,
531
+ H
532
+ ] }), e[54] = I, e[55] = r, e[56] = z, e[57] = H, e[58] = X) : X = e[58], X;
533
+ }, Mr = (t) => {
534
+ const e = ce(35), {
535
+ formData: r,
536
+ handleFieldChange: o,
537
+ errors: l
538
+ } = t, {
539
+ orgId: a
540
+ } = ue(), [u, f] = ie(!1);
541
+ let g;
542
+ e[0] !== a ? (g = {
543
+ orgName: a
544
+ }, e[0] = a, e[1] = g) : g = e[1];
545
+ let y;
546
+ e[2] === Symbol.for("react.memo_cache_sentinel") ? (y = {
547
+ limit: 100
548
+ }, e[2] = y) : y = e[2];
549
+ const {
550
+ data: v,
551
+ isLoading: i,
552
+ refetch: d
553
+ } = Gn(g, y);
554
+ let s;
555
+ e[3] !== v?.secrets ? (s = v?.secrets || [], e[3] = v?.secrets, e[4] = s) : s = e[4];
556
+ const p = s;
557
+ let m;
558
+ e[5] !== o ? (m = (F) => {
559
+ const M = F.target.value;
560
+ if (M === "__create_new__") {
561
+ f(!0);
562
+ return;
563
+ }
564
+ o("gitSecretRef", M || void 0);
565
+ }, e[5] = o, e[6] = m) : m = e[6];
566
+ const h = m;
567
+ let c;
568
+ e[7] !== o || e[8] !== d ? (c = (F) => {
569
+ o("gitSecretRef", F), d(), f(!1);
570
+ }, e[7] = o, e[8] = d, e[9] = c) : c = e[9];
571
+ const A = c, k = !!l.gitSecretRef, T = r.gitSecretRef || "";
572
+ let I;
573
+ e[10] !== i ? (I = i ? /* @__PURE__ */ n(rt, { size: 20, sx: {
574
+ mr: 1
575
+ } }) : void 0, e[10] = i, e[11] = I) : I = e[11];
576
+ let P;
577
+ e[12] === Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ n(et, { value: "", children: /* @__PURE__ */ n("em", { children: "Public Repo (None)" }) }), e[12] = P) : P = e[12];
578
+ let E;
579
+ e[13] !== p ? (E = p.map(Or), e[13] = p, e[14] = E) : E = e[14];
580
+ let V;
581
+ e[15] === Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ n(et, { value: "__create_new__", children: /* @__PURE__ */ n(ae, { direction: "row", spacing: 1, alignItems: "center", children: /* @__PURE__ */ n(Ce, { variant: "text", size: "small", startIcon: /* @__PURE__ */ n(Ft, { size: 16 }), sx: {
582
+ textTransform: "none",
583
+ p: 0
584
+ }, children: "Create new git secret" }) }) }), e[15] = V) : V = e[15];
585
+ let D;
586
+ e[16] !== h || e[17] !== i || e[18] !== E || e[19] !== T || e[20] !== I ? (D = /* @__PURE__ */ S(Ot, { id: "gitSecretRef", value: T, onChange: h, displayEmpty: !0, disabled: i, startAdornment: I, children: [
587
+ P,
588
+ E,
589
+ V
590
+ ] }), e[16] = h, e[17] = i, e[18] = E, e[19] = T, e[20] = I, e[21] = D) : D = e[21];
591
+ let L;
592
+ e[22] !== l.gitSecretRef ? (L = l.gitSecretRef ? /* @__PURE__ */ n(Mt, { error: !0, children: l.gitSecretRef }) : /* @__PURE__ */ n(Mt, { children: "Select a git secret for private repository authentication" }), e[22] = l.gitSecretRef, e[23] = L) : L = e[23];
593
+ let U;
594
+ e[24] !== D || e[25] !== L || e[26] !== k ? (U = /* @__PURE__ */ n(_.ElementWrapper, { label: "Git Secret (Optional)", name: "gitSecretRef", children: /* @__PURE__ */ S(rn, { fullWidth: !0, error: k, children: [
595
+ D,
596
+ L
597
+ ] }) }), e[24] = D, e[25] = L, e[26] = k, e[27] = U) : U = e[27];
598
+ let W;
599
+ e[28] === Symbol.for("react.memo_cache_sentinel") ? (W = () => f(!1), e[28] = W) : W = e[28];
600
+ let R;
601
+ e[29] !== A || e[30] !== u ? (R = /* @__PURE__ */ n(jr, { open: u, onClose: W, onSecretCreated: A }), e[29] = A, e[30] = u, e[31] = R) : R = e[31];
602
+ let x;
603
+ return e[32] !== U || e[33] !== R ? (x = /* @__PURE__ */ S(yn, { children: [
604
+ U,
605
+ R
606
+ ] }), e[32] = U, e[33] = R, e[34] = x) : x = e[34], x;
607
+ };
608
+ function Or(t) {
609
+ return /* @__PURE__ */ n(et, { value: t.name, children: /* @__PURE__ */ n(j, { children: t.name }) }, t.name);
610
+ }
611
+ function Wr(t) {
612
+ return t?.length ? [...t].sort((e, r) => new Date(r.deployedAt ?? 0).getTime() - new Date(e.deployedAt ?? 0).getTime())[0] ?? null : null;
613
+ }
614
+ const En = (t) => {
615
+ const e = ce(61), {
616
+ provider: r,
617
+ isSelected: o,
618
+ templateInfo: l,
619
+ fallbackLabel: a
620
+ } = t, u = a === void 0 ? "Select provider" : a, f = r?.deployments;
621
+ let g, y, v, i, d, s, p, m, h, c, A;
622
+ if (e[0] !== u || e[1] !== o || e[2] !== r || e[3] !== f || e[4] !== l) {
623
+ const R = Wr(f);
624
+ y = ae, h = "row", c = 2, A = 1, v = "center";
625
+ const x = o ? "primary.main" : "secondary.main", F = o ? "common.white" : "text.secondary";
626
+ let M;
627
+ e[16] !== x || e[17] !== F ? (M = {
628
+ height: 32,
629
+ width: 32,
630
+ backgroundColor: x,
631
+ color: F
632
+ }, e[16] = x, e[17] = F, e[18] = M) : M = e[18];
633
+ let N;
634
+ e[19] !== o ? (N = o ? /* @__PURE__ */ n(Pr, { size: 16 }) : /* @__PURE__ */ n(_n, { size: 16 }), e[19] = o, e[20] = N) : N = e[20], e[21] !== M || e[22] !== N ? (i = /* @__PURE__ */ n(ur, { sx: M, children: N }), e[21] = M, e[22] = N, e[23] = i) : i = e[23], g = ae, d = 0.25, s = 1;
635
+ const w = r?.name ?? u;
636
+ let b;
637
+ e[24] !== w ? (b = /* @__PURE__ */ S(j, { variant: "h6", children: [
638
+ w,
639
+ "  "
640
+ ] }), e[24] = w, e[25] = b) : b = e[25];
641
+ let C;
642
+ e[26] !== r || e[27] !== l ? (C = r?.template && /* @__PURE__ */ n(hn, { title: "Provider template", placement: "top", arrow: !0, children: /* @__PURE__ */ n(Cn, { label: l?.displayName ?? r.template, size: "small", variant: "outlined", icon: l?.logoUrl ? /* @__PURE__ */ n(ee, { component: "img", src: l.logoUrl, alt: l.displayName, sx: {
643
+ width: 14,
644
+ height: 14,
645
+ borderRadius: "100%"
646
+ } }) : void 0 }) }), e[26] = r, e[27] = l, e[28] = C) : C = e[28], e[29] !== b || e[30] !== C ? (p = /* @__PURE__ */ S(ae, { direction: "row", spacing: 0.25, alignItems: "center", children: [
647
+ b,
648
+ C
649
+ ] }), e[29] = b, e[30] = C, e[31] = p) : p = e[31], m = R?.deployedAt && /* @__PURE__ */ S(j, { variant: "caption", color: "text.secondary", children: [
650
+ "Deployed ",
651
+ Xn(new Date(R.deployedAt), {
652
+ addSuffix: !0
653
+ })
654
+ ] }), e[0] = u, e[1] = o, e[2] = r, e[3] = f, e[4] = l, e[5] = g, e[6] = y, e[7] = v, e[8] = i, e[9] = d, e[10] = s, e[11] = p, e[12] = m, e[13] = h, e[14] = c, e[15] = A;
655
+ } else
656
+ g = e[5], y = e[6], v = e[7], i = e[8], d = e[9], s = e[10], p = e[11], m = e[12], h = e[13], c = e[14], A = e[15];
657
+ let k;
658
+ e[32] === Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ n(Nn, { orientation: "vertical" }), e[32] = k) : k = e[32];
659
+ const T = r?.rateLimiting ? "text.primary" : "text.disabled";
660
+ let I;
661
+ e[33] !== r ? (I = r?.rateLimiting ? (() => {
662
+ const R = [], x = r.rateLimiting.providerLevel, F = r.rateLimiting.consumerLevel;
663
+ return x?.requestLimitCount && R.push(`${x.requestLimitCount} req/min`), x?.tokenLimitCount && R.push(`${x.tokenLimitCount} tokens/min`), F?.requestLimitCount && R.push(`Consumer: ${F.requestLimitCount} req/min`), R.length > 0 ? R.join(", ") : "Configured";
664
+ })() : "Not configured", e[33] = r, e[34] = I) : I = e[34];
665
+ let P;
666
+ e[35] !== T || e[36] !== I ? (P = /* @__PURE__ */ S(j, { variant: "caption", color: "text.secondary", children: [
667
+ "Rate Limiting:",
668
+ " ",
669
+ /* @__PURE__ */ n(j, { component: "span", variant: "body2", color: T, children: I })
670
+ ] }), e[35] = T, e[36] = I, e[37] = P) : P = e[37];
671
+ const E = r?.policies?.length ? "text.primary" : "text.disabled";
672
+ let V;
673
+ e[38] !== r ? (V = r?.policies?.length ? /* @__PURE__ */ S(ae, { direction: "row", spacing: 0.25, flexWrap: "wrap", alignItems: "center", children: [
674
+ r.policies.slice(0, 3).map(zr),
675
+ r.policies.length > 3 && /* @__PURE__ */ n(hn, { title: r.policies.join(", "), placement: "top", arrow: !0, children: /* @__PURE__ */ n(j, { variant: "caption", color: "text.secondary", children: ` +${r.policies.length - 3} more..` }) })
676
+ ] }) : "None", e[38] = r, e[39] = V) : V = e[39];
677
+ let D;
678
+ e[40] !== E || e[41] !== V ? (D = /* @__PURE__ */ S(j, { variant: "caption", color: "text.secondary", children: [
679
+ "Guardrails:",
680
+ " ",
681
+ /* @__PURE__ */ n(j, { component: "span", variant: "body2", color: E, children: V })
682
+ ] }), e[40] = E, e[41] = V, e[42] = D) : D = e[42];
683
+ let L;
684
+ e[43] !== P || e[44] !== D ? (L = /* @__PURE__ */ S(ae, { direction: "column", spacing: 0.25, children: [
685
+ P,
686
+ D
687
+ ] }), e[43] = P, e[44] = D, e[45] = L) : L = e[45];
688
+ let U;
689
+ e[46] !== g || e[47] !== L || e[48] !== d || e[49] !== s || e[50] !== p || e[51] !== m ? (U = /* @__PURE__ */ S(g, { spacing: d, flexGrow: s, children: [
690
+ p,
691
+ m,
692
+ k,
693
+ L
694
+ ] }), e[46] = g, e[47] = L, e[48] = d, e[49] = s, e[50] = p, e[51] = m, e[52] = U) : U = e[52];
695
+ let W;
696
+ return e[53] !== y || e[54] !== v || e[55] !== i || e[56] !== U || e[57] !== h || e[58] !== c || e[59] !== A ? (W = /* @__PURE__ */ S(y, { direction: h, spacing: c, flexGrow: A, alignItems: v, children: [
697
+ i,
698
+ U
699
+ ] }), e[53] = y, e[54] = v, e[55] = i, e[56] = U, e[57] = h, e[58] = c, e[59] = A, e[60] = W) : W = e[60], W;
700
+ }, Xe = /^[A-Za-z_][A-Za-z0-9_]*$/, Fr = (t) => {
701
+ const e = ce(93), {
702
+ entry: r,
703
+ index: o,
704
+ providers: l,
705
+ templateMap: a,
706
+ environments: u,
707
+ agentNameUpper: f,
708
+ usedVarNames: g,
709
+ onOpenDrawer: y,
710
+ onRemove: v,
711
+ onUpdateEntry: i
712
+ } = t, [d, s] = ie(0), p = u[d]?.name ?? "", m = r.selectedProviderByEnv[p]?.uuid ?? null;
713
+ let h;
714
+ e[0] !== r.selectedProviderByEnv ? (h = Object.values(r.selectedProviderByEnv).find(Gr), e[0] = r.selectedProviderByEnv, e[1] = h) : h = e[1];
715
+ const c = h;
716
+ let A;
717
+ e[2] !== c || e[3] !== o || e[4] !== l ? (A = (c ? l.find((Y) => Y.uuid === c.uuid)?.name : null) ?? `LLM Provider ${o + 1}`, e[2] = c, e[3] = o, e[4] = l, e[5] = A) : A = e[5];
718
+ const k = A;
719
+ let T;
720
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (T = (Y, J) => s(J), e[6] = T) : T = e[6];
721
+ const I = T;
722
+ let P;
723
+ e[7] !== o || e[8] !== v ? (P = (Y) => {
724
+ Y.stopPropagation(), v(o);
725
+ }, e[7] = o, e[8] = v, e[9] = P) : P = e[9];
726
+ const E = P;
727
+ let V;
728
+ e[10] !== o || e[11] !== y || e[12] !== p ? (V = () => y(o, p), e[10] = o, e[11] = y, e[12] = p, e[13] = V) : V = e[13];
729
+ const D = V;
730
+ let L;
731
+ e[14] !== r || e[15] !== o || e[16] !== i ? (L = (Y) => {
732
+ const J = Y.target.value;
733
+ J !== "" && !Xe.test(J) || i(o, {
734
+ ...r,
735
+ urlVarName: J
736
+ });
737
+ }, e[14] = r, e[15] = o, e[16] = i, e[17] = L) : L = e[17];
738
+ const U = L;
739
+ let W;
740
+ e[18] !== r || e[19] !== o || e[20] !== i ? (W = (Y) => {
741
+ const J = Y.target.value;
742
+ J !== "" && !Xe.test(J) || i(o, {
743
+ ...r,
744
+ apikeyVarName: J
745
+ });
746
+ }, e[18] = r, e[19] = o, e[20] = i, e[21] = W) : W = e[21];
747
+ const R = W;
748
+ let x;
749
+ e[22] !== r || e[23] !== o || e[24] !== i ? (x = (Y) => {
750
+ r.guardrails.some((ge) => ge.name === Y.name && ge.version === Y.version) || i(o, {
751
+ ...r,
752
+ guardrails: [...r.guardrails, Y]
753
+ });
754
+ }, e[22] = r, e[23] = o, e[24] = i, e[25] = x) : x = e[25];
755
+ const F = x;
756
+ let M;
757
+ e[26] !== r || e[27] !== o || e[28] !== i ? (M = (Y) => {
758
+ i(o, {
759
+ ...r,
760
+ guardrails: r.guardrails.map((J) => J.name === Y.name && J.version === Y.version ? Y : J)
761
+ });
762
+ }, e[26] = r, e[27] = o, e[28] = i, e[29] = M) : M = e[29];
763
+ const N = M;
764
+ let w;
765
+ e[30] !== r || e[31] !== o || e[32] !== i ? (w = (Y, J) => {
766
+ i(o, {
767
+ ...r,
768
+ guardrails: r.guardrails.filter((ge) => !(ge.name === Y && ge.version === J))
769
+ });
770
+ }, e[30] = r, e[31] = o, e[32] = i, e[33] = w) : w = e[33];
771
+ const b = w;
772
+ let C;
773
+ e[34] === Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ n(Er, { size: 18 }), e[34] = C) : C = e[34];
774
+ const $ = `llm-provider-${o}-content`, z = `llm-provider-${o}-header`;
775
+ let G;
776
+ e[35] !== k ? (G = /* @__PURE__ */ n(j, { variant: "subtitle2", children: k }), e[35] = k, e[36] = G) : G = e[36];
777
+ let Q;
778
+ e[37] === Symbol.for("react.memo_cache_sentinel") ? (Q = /* @__PURE__ */ n(wr, { size: 16 }), e[37] = Q) : Q = e[37];
779
+ let q;
780
+ e[38] !== E ? (q = /* @__PURE__ */ n(fr, { size: "small", "aria-label": "Remove LLM provider", onClick: E, children: Q }), e[38] = E, e[39] = q) : q = e[39];
781
+ let H;
782
+ e[40] !== G || e[41] !== q ? (H = /* @__PURE__ */ S(ae, { direction: "row", alignItems: "center", justifyContent: "space-between", flexGrow: 1, pr: 1, children: [
783
+ G,
784
+ q
785
+ ] }), e[40] = G, e[41] = q, e[42] = H) : H = e[42];
786
+ let X;
787
+ e[43] !== $ || e[44] !== z || e[45] !== H ? (X = /* @__PURE__ */ n(gr, { expandIcon: C, "aria-controls": $, id: z, children: H }), e[43] = $, e[44] = z, e[45] = H, e[46] = X) : X = e[46];
788
+ let O;
789
+ e[47] !== u || e[48] !== d ? (O = u.length > 1 && /* @__PURE__ */ n(pr, { value: d, onChange: I, sx: {
790
+ mb: 1
791
+ }, children: u.map(Br) }), e[47] = u, e[48] = d, e[49] = O) : O = e[49];
792
+ let B;
793
+ e[50] !== m || e[51] !== u || e[52] !== D || e[53] !== l || e[54] !== d || e[55] !== p || e[56] !== a ? (B = /* @__PURE__ */ n(ee, { children: m ? /* @__PURE__ */ n(_.CardButton, { onClick: D, selected: !0, children: /* @__PURE__ */ n(_.CardContent, { children: /* @__PURE__ */ n(En, { provider: l.find((Y) => Y.uuid === m) ?? null, isSelected: !0, templateInfo: a.get(l.find((Y) => Y.uuid === m)?.template ?? "") }) }) }) : /* @__PURE__ */ S(Ce, { variant: "outlined", size: "small", startIcon: /* @__PURE__ */ n(Ft, { size: 16 }), onClick: D, children: [
794
+ "Select Provider for ",
795
+ u[d]?.displayName ?? p
796
+ ] }) }), e[50] = m, e[51] = u, e[52] = D, e[53] = l, e[54] = d, e[55] = p, e[56] = a, e[57] = B) : B = e[57];
797
+ let Z;
798
+ e[58] === Symbol.for("react.memo_cache_sentinel") ? (Z = /* @__PURE__ */ n(j, { variant: "subtitle2", gutterBottom: !0, children: "Environment Variables" }), e[58] = Z) : Z = e[58];
799
+ const te = r.urlVarName ?? `${f}_${o + 1}_URL`, fe = `${f}_${o + 1}_URL`;
800
+ let se;
801
+ e[59] !== r.urlVarName || e[60] !== g ? (se = r.urlVarName !== void 0 && !Xe.test(r.urlVarName) || r.urlVarName !== void 0 && g.has(r.urlVarName), e[59] = r.urlVarName, e[60] = g, e[61] = se) : se = e[61];
802
+ const Pe = r.urlVarName !== void 0 && !Xe.test(r.urlVarName) ? "Must match /^[A-Za-z_][A-Za-z0-9_]*$/" : r.urlVarName !== void 0 && g.has(r.urlVarName) ? "Name is already used by another provider" : void 0;
803
+ let de;
804
+ e[62] !== U || e[63] !== te || e[64] !== fe || e[65] !== se || e[66] !== Pe ? (de = /* @__PURE__ */ n(_.ElementWrapper, { label: "URL variable name", name: "urlVarName", children: /* @__PURE__ */ n(re, { size: "small", fullWidth: !0, value: te, onChange: U, placeholder: fe, error: se, helperText: Pe }) }), e[62] = U, e[63] = te, e[64] = fe, e[65] = se, e[66] = Pe, e[67] = de) : de = e[67];
805
+ const Ee = r.apikeyVarName ?? `${f}_${o + 1}_API_KEY`, we = `${f}_${o + 1}_API_KEY`;
806
+ let me;
807
+ e[68] !== r.apikeyVarName || e[69] !== g ? (me = r.apikeyVarName !== void 0 && !Xe.test(r.apikeyVarName) || r.apikeyVarName !== void 0 && g.has(r.apikeyVarName), e[68] = r.apikeyVarName, e[69] = g, e[70] = me) : me = e[70];
808
+ const Ie = r.apikeyVarName !== void 0 && !Xe.test(r.apikeyVarName) ? "Must match /^[A-Za-z_][A-Za-z0-9_]*$/" : r.apikeyVarName !== void 0 && g.has(r.apikeyVarName) ? "Name is already used by another provider" : void 0;
809
+ let Se;
810
+ e[71] !== R || e[72] !== Ee || e[73] !== we || e[74] !== me || e[75] !== Ie ? (Se = /* @__PURE__ */ n(_.ElementWrapper, { label: "API key variable name", name: "apikeyVarName", children: /* @__PURE__ */ n(re, { size: "small", fullWidth: !0, value: Ee, onChange: R, placeholder: we, error: me, helperText: Ie }) }), e[71] = R, e[72] = Ee, e[73] = we, e[74] = me, e[75] = Ie, e[76] = Se) : Se = e[76];
811
+ let pe;
812
+ e[77] !== de || e[78] !== Se ? (pe = /* @__PURE__ */ S(ee, { children: [
813
+ Z,
814
+ /* @__PURE__ */ S(ae, { direction: "row", spacing: 2, children: [
815
+ de,
816
+ Se
817
+ ] })
818
+ ] }), e[77] = de, e[78] = Se, e[79] = pe) : pe = e[79];
819
+ let ye;
820
+ e[80] !== r.guardrails || e[81] !== F || e[82] !== N || e[83] !== b ? (ye = /* @__PURE__ */ n(Qn, { guardrails: r.guardrails, onAddGuardrail: F, onEditGuardrail: N, onRemoveGuardrail: b }), e[80] = r.guardrails, e[81] = F, e[82] = N, e[83] = b, e[84] = ye) : ye = e[84];
821
+ let he;
822
+ e[85] !== O || e[86] !== B || e[87] !== pe || e[88] !== ye ? (he = /* @__PURE__ */ n(yr, { children: /* @__PURE__ */ S(ae, { spacing: 3, children: [
823
+ O,
824
+ B,
825
+ pe,
826
+ ye
827
+ ] }) }), e[85] = O, e[86] = B, e[87] = pe, e[88] = ye, e[89] = he) : he = e[89];
828
+ let _e;
829
+ return e[90] !== X || e[91] !== he ? (_e = /* @__PURE__ */ S(vr, { defaultExpanded: !0, children: [
830
+ X,
831
+ he
832
+ ] }), e[90] = X, e[91] = he, e[92] = _e) : _e = e[92], _e;
833
+ }, wn = ({
834
+ llmProviders: t,
835
+ setLLMProviders: e,
836
+ agentDisplayName: r,
837
+ externalEnvKeys: o = /* @__PURE__ */ new Set()
838
+ }) => {
839
+ const {
840
+ orgId: l
841
+ } = ue(), [a, u] = ie(null), [f, g] = ie(""), [y, v] = ie(!1), [i, d] = ie(""), [s, p] = ie(""), m = Nr(null), h = nt(), {
842
+ data: c = [],
843
+ isLoading: A
844
+ } = Bn({
845
+ orgName: l
846
+ }), {
847
+ data: k,
848
+ isLoading: T
849
+ } = Kn({
850
+ orgName: l
851
+ }, {
852
+ limit: 50
853
+ }), {
854
+ data: I,
855
+ isLoading: P
856
+ } = qn({
857
+ orgName: l
858
+ }), E = T || P, V = be(() => {
859
+ const b = /* @__PURE__ */ new Map();
860
+ for (const C of I?.templates ?? [])
861
+ b.set(C.name, {
862
+ displayName: C.name,
863
+ logoUrl: C.metadata?.logoUrl
864
+ }), b.set(C.id, {
865
+ displayName: C.name,
866
+ logoUrl: C.metadata?.logoUrl
867
+ });
868
+ return b;
869
+ }, [I]), D = be(() => (k?.entries ?? []).map((b) => ({
870
+ uuid: b.uuid,
871
+ id: b.handle,
872
+ name: b.name,
873
+ version: b.version,
874
+ template: b.template,
875
+ deployments: b.deployments ?? [],
876
+ security: b.security,
877
+ rateLimiting: b.rateLimiting,
878
+ policies: b.policies ?? []
879
+ })), [k]), L = r ? r.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT", U = a !== null ? t[a]?.selectedProviderByEnv[f]?.uuid ?? null : null, W = Ne((b, C) => {
880
+ u(b), g(C), v(!0);
881
+ }, []), R = Ne(() => {
882
+ u(null), v(!0);
883
+ }, []), x = Ne(() => {
884
+ m.current && (clearTimeout(m.current), m.current = null), v(!1), d(""), p("");
885
+ }, []), F = Ne((b, C) => {
886
+ e(($) => {
887
+ if (a === null) {
888
+ if (c.length === 0) return $;
889
+ const z = {};
890
+ for (const Q of c)
891
+ z[Q.name] = {
892
+ uuid: b,
893
+ handle: C
894
+ };
895
+ const G = $.length;
896
+ return [...$, {
897
+ selectedProviderByEnv: z,
898
+ urlVarName: `${L}_${G + 1}_URL`,
899
+ apikeyVarName: `${L}_${G + 1}_API_KEY`,
900
+ guardrails: []
901
+ }];
902
+ } else {
903
+ const z = [...$], G = z[a];
904
+ return G ? (z[a] = {
905
+ ...G,
906
+ selectedProviderByEnv: {
907
+ ...G.selectedProviderByEnv,
908
+ [f]: {
909
+ uuid: b,
910
+ handle: C
911
+ }
912
+ }
913
+ }, z) : $;
914
+ }
915
+ }), m.current && (clearTimeout(m.current), m.current = null), v(!1), d(""), p("");
916
+ }, [a, f, c, L, e]), M = Ne((b) => {
917
+ e((C) => C.filter(($, z) => z !== b));
918
+ }, [e]), N = Ne((b, C) => {
919
+ e(($) => {
920
+ const z = [...$];
921
+ return z[b] = C, z;
922
+ });
923
+ }, [e]), w = Ne((b) => {
924
+ const C = b.target.value;
925
+ d(C), m.current && clearTimeout(m.current), m.current = setTimeout(() => p(C), 250);
926
+ }, []);
927
+ return /* @__PURE__ */ S(_.Section, { children: [
928
+ /* @__PURE__ */ n(_.Subheader, { children: "LLM Providers (Optional)" }),
929
+ /* @__PURE__ */ S(ae, { spacing: 1, children: [
930
+ t.map((b, C) => {
931
+ const $ = /* @__PURE__ */ new Set([...t.flatMap((z, G) => G === C ? [] : [z.urlVarName ?? `${L}_${G + 1}_URL`, z.apikeyVarName ?? `${L}_${G + 1}_API_KEY`]), ...Array.from(o)]);
932
+ return /* @__PURE__ */ n(Fr, { entry: b, index: C, providers: D, templateMap: V, environments: c, agentNameUpper: L, usedVarNames: $, onOpenDrawer: W, onRemove: M, onUpdateEntry: N }, C);
933
+ }),
934
+ /* @__PURE__ */ n(ee, { sx: {
935
+ pt: t.length > 0 ? 1 : 0
936
+ }, children: /* @__PURE__ */ n(Ce, { variant: "outlined", size: "small", startIcon: /* @__PURE__ */ n(Ft, { size: 16 }), onClick: R, disabled: A || T, children: "Add" }) })
937
+ ] }),
938
+ /* @__PURE__ */ S(Hn, { open: y, onClose: x, minWidth: 740, maxWidth: 740, children: [
939
+ /* @__PURE__ */ n(Zn, { icon: /* @__PURE__ */ n(kr, { size: 24 }), title: "Select Provider", onClose: x }),
940
+ /* @__PURE__ */ n(Yn, { children: /* @__PURE__ */ S(ae, { children: [
941
+ /* @__PURE__ */ n(j, { variant: "body2", color: "text.secondary", sx: {
942
+ mb: 1
943
+ }, children: a === null ? "Select a provider for this LLM configuration." : "Change the provider for this LLM configuration." }),
944
+ /* @__PURE__ */ n(mr, { placeholder: "Search providers", size: "small", fullWidth: !0, value: i, onChange: w, sx: {
945
+ mb: 1
946
+ } }),
947
+ /* @__PURE__ */ n(ae, { spacing: 1, sx: {
948
+ flex: 1,
949
+ overflowY: "auto"
950
+ }, children: E ? /* @__PURE__ */ n(ee, { sx: {
951
+ display: "flex",
952
+ justifyContent: "center",
953
+ py: 4
954
+ }, children: /* @__PURE__ */ n(rt, { size: 32 }) }) : (() => {
955
+ const b = D.filter((C) => {
956
+ if (!s.trim()) return !0;
957
+ const $ = s.toLowerCase();
958
+ return C.name.toLowerCase().includes($) || (C.template ?? "").toLowerCase().includes($) || (V.get(C.template ?? "")?.displayName ?? "").toLowerCase().includes($);
959
+ });
960
+ if (b.length === 0) {
961
+ const C = !!s.trim();
962
+ return /* @__PURE__ */ n(pn.Container, { children: /* @__PURE__ */ n(pn.EmptyState, { illustration: /* @__PURE__ */ n(xr, { size: 64 }), title: C ? "No LLM Service Providers match your search" : "No LLM Service Providers available", description: C ? "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: !C && l ? /* @__PURE__ */ n(Ce, { variant: "contained", size: "small", startIcon: /* @__PURE__ */ n(An, { size: 16 }), onClick: () => h(le(oe.children.org.children.llmProviders.children.add.path, {
963
+ orgId: l
964
+ })), children: "Add LLM Service Provider" }) : void 0 }) });
965
+ }
966
+ return b.map((C) => {
967
+ const $ = U === C.uuid, z = () => F(C.uuid, C.id);
968
+ return /* @__PURE__ */ n(_.CardButton, { onClick: z, selected: $, "aria-label": `${C.name}. ${$ ? "Selected" : "Click to select"}`, children: /* @__PURE__ */ n(_.CardContent, { children: /* @__PURE__ */ n(En, { provider: C, isSelected: $, templateInfo: V.get(C.template ?? "") }) }) }, C.uuid);
969
+ });
970
+ })() })
971
+ ] }) })
972
+ ] })
973
+ ] });
974
+ };
975
+ function zr(t) {
976
+ return /* @__PURE__ */ n(Cn, { label: t, size: "small", variant: "outlined" }, t);
977
+ }
978
+ function Gr(t) {
979
+ return t != null;
980
+ }
981
+ function Br(t, e) {
982
+ return /* @__PURE__ */ n(hr, { label: t.displayName ?? t.name, value: e }, t.name);
983
+ }
984
+ const Kr = [{
985
+ label: "Python",
986
+ value: "python"
987
+ }, {
988
+ label: "Docker",
989
+ value: "docker"
990
+ }], In = "https://wso2.github.io/agent-manager/docs/components/amp-instrumentation/", gn = `${In}#manual-instrumentation`, qr = `${In}#amp-instrumentation-version-mapping`, Hr = (t) => {
991
+ const e = ce(204), {
992
+ formData: r,
993
+ setFormData: o,
994
+ errors: l,
995
+ setFieldError: a,
996
+ validateField: u,
997
+ llmProviders: f,
998
+ setLLMProviders: g
999
+ } = t, {
1000
+ orgId: y,
1001
+ projectId: v
1002
+ } = ue(), i = Jn("private-repo-support"), d = i.length === 0 || i[0]?.value?.enabled !== !1;
1003
+ let s;
1004
+ e[0] !== y ? (s = {
1005
+ orgName: y
1006
+ }, e[0] = y, e[1] = s) : s = e[1];
1007
+ const {
1008
+ mutate: p,
1009
+ isPending: m
1010
+ } = an(s);
1011
+ let h;
1012
+ e[2] !== a || e[3] !== o || e[4] !== u ? (h = (K, ve) => {
1013
+ o(($t) => {
1014
+ const Ae = {
1015
+ ...$t,
1016
+ [K]: ve
1017
+ }, Ln = u(K, ve, Ae);
1018
+ if (a(K, Ln), K === "language") {
1019
+ if (ve === "python") {
1020
+ a("dockerfilePath", void 0);
1021
+ const en = u("runCommand", Ae.runCommand, Ae), Vn = u("languageVersion", Ae.languageVersion, Ae);
1022
+ a("runCommand", en), a("languageVersion", Vn);
1023
+ } else if (ve === "docker") {
1024
+ a("runCommand", void 0), a("languageVersion", void 0);
1025
+ const en = u("dockerfilePath", Ae.dockerfilePath, Ae);
1026
+ a("dockerfilePath", en);
1027
+ }
1028
+ }
1029
+ return Ae;
1030
+ });
1031
+ }, e[2] = a, e[3] = o, e[4] = u, e[5] = h) : h = e[5];
1032
+ const c = h;
1033
+ let A;
1034
+ e[6] !== p || e[7] !== c || e[8] !== v ? (A = ln.debounce((K) => {
1035
+ if (K.length < 3) {
1036
+ c("name", "");
1037
+ return;
1038
+ }
1039
+ p({
1040
+ displayName: K,
1041
+ resourceType: "agent",
1042
+ projectName: v
1043
+ }, {
1044
+ onSuccess: (ve) => {
1045
+ c("name", ve.name);
1046
+ },
1047
+ onError: Zr
1048
+ });
1049
+ }, 500), e[6] = p, e[7] = c, e[8] = v, e[9] = A) : A = e[9];
1050
+ const k = A;
1051
+ let T, I;
1052
+ e[10] !== k ? (T = () => () => {
1053
+ k.cancel();
1054
+ }, I = [k], e[10] = k, e[11] = T, e[12] = I) : (T = e[11], I = e[12]), Le(T, I);
1055
+ let P, E;
1056
+ e[13] !== k || e[14] !== r.displayName || e[15] !== c ? (P = () => {
1057
+ r.displayName && r.displayName.length >= 3 ? k(r.displayName) : (k.cancel(), c("name", ""));
1058
+ }, E = [r.displayName, c, k], e[13] = k, e[14] = r.displayName, e[15] = c, e[16] = P, e[17] = E) : (P = e[16], E = e[17]), Le(P, E);
1059
+ let V;
1060
+ e[18] === Symbol.for("react.memo_cache_sentinel") ? (V = /* @__PURE__ */ n(_.Subheader, { children: "Agent Details" }), e[18] = V) : V = e[18];
1061
+ let D;
1062
+ e[19] !== c ? (D = (K) => c("displayName", K.target.value), e[19] = c, e[20] = D) : D = e[20];
1063
+ const L = !!l.displayName;
1064
+ let U;
1065
+ e[21] !== l.displayName || e[22] !== m ? (U = m ? /* @__PURE__ */ S(ae, { direction: "row", alignItems: "center", gap: 1, children: [
1066
+ /* @__PURE__ */ n(rt, { size: 12 }),
1067
+ /* @__PURE__ */ n(j, { variant: "caption", children: "Validating name..." })
1068
+ ] }) : l.displayName || "A name for your agent", e[21] = l.displayName, e[22] = m, e[23] = U) : U = e[23];
1069
+ let W;
1070
+ e[24] !== r.displayName || e[25] !== L || e[26] !== U || e[27] !== D ? (W = /* @__PURE__ */ n(_.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ n(re, { id: "displayName", placeholder: "e.g., Customer Support Agent", value: r.displayName, onChange: D, error: L, helperText: U, fullWidth: !0 }) }), e[24] = r.displayName, e[25] = L, e[26] = U, e[27] = D, e[28] = W) : W = e[28];
1071
+ const R = r.description || "";
1072
+ let x;
1073
+ e[29] !== c ? (x = (K) => c("description", K.target.value), e[29] = c, e[30] = x) : x = e[30];
1074
+ const F = !!l.description;
1075
+ let M;
1076
+ e[31] !== l.description || e[32] !== R || e[33] !== x || e[34] !== F ? (M = /* @__PURE__ */ n(_.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ n(re, { id: "description", placeholder: "Short description of what this agent does", multiline: !0, minRows: 2, maxRows: 6, value: R, onChange: x, error: F, helperText: l.description, fullWidth: !0 }) }), e[31] = l.description, e[32] = R, e[33] = x, e[34] = F, e[35] = M) : M = e[35];
1077
+ let N;
1078
+ e[36] !== W || e[37] !== M ? (N = /* @__PURE__ */ S(_.Section, { children: [
1079
+ V,
1080
+ /* @__PURE__ */ S(_.Stack, { spacing: 2, children: [
1081
+ W,
1082
+ M
1083
+ ] })
1084
+ ] }), e[36] = W, e[37] = M, e[38] = N) : N = e[38];
1085
+ let w;
1086
+ e[39] === Symbol.for("react.memo_cache_sentinel") ? (w = /* @__PURE__ */ n(_.Subheader, { children: "Repository Details" }), e[39] = w) : w = e[39];
1087
+ let b;
1088
+ e[40] !== c ? (b = (K) => c("repositoryUrl", K.target.value), e[40] = c, e[41] = b) : b = e[41];
1089
+ const C = !!l.repositoryUrl;
1090
+ let $;
1091
+ e[42] !== l.repositoryUrl || e[43] !== r.repositoryUrl || e[44] !== b || e[45] !== C ? ($ = /* @__PURE__ */ n(_.ElementWrapper, { label: "GitHub Repository", name: "repositoryUrl", children: /* @__PURE__ */ n(re, { id: "repositoryUrl", placeholder: "https://github.com/username/repo", value: r.repositoryUrl, onChange: b, error: C, helperText: l.repositoryUrl, fullWidth: !0 }) }), e[42] = l.repositoryUrl, e[43] = r.repositoryUrl, e[44] = b, e[45] = C, e[46] = $) : $ = e[46];
1092
+ let z;
1093
+ e[47] !== l || e[48] !== r || e[49] !== c || e[50] !== d ? (z = d && /* @__PURE__ */ n(Mr, { formData: r, handleFieldChange: c, errors: l }), e[47] = l, e[48] = r, e[49] = c, e[50] = d, e[51] = z) : z = e[51];
1094
+ let G;
1095
+ e[52] !== c ? (G = (K) => c("branch", K.target.value), e[52] = c, e[53] = G) : G = e[53];
1096
+ const Q = !!l.branch;
1097
+ let q;
1098
+ e[54] !== l.branch || e[55] !== r.branch || e[56] !== G || e[57] !== Q ? (q = /* @__PURE__ */ n(_.ElementWrapper, { label: "Branch", name: "branch", children: /* @__PURE__ */ n(re, { id: "branch", placeholder: "main", value: r.branch, onChange: G, error: Q, helperText: l.branch, fullWidth: !0 }) }), e[54] = l.branch, e[55] = r.branch, e[56] = G, e[57] = Q, e[58] = q) : q = e[58];
1099
+ let H;
1100
+ e[59] !== c ? (H = (K) => c("appPath", K.target.value), e[59] = c, e[60] = H) : H = e[60];
1101
+ const X = !!l.appPath;
1102
+ let O;
1103
+ e[61] !== l.appPath || e[62] !== r.appPath || e[63] !== H || e[64] !== X ? (O = /* @__PURE__ */ n(_.ElementWrapper, { label: "Project Path", name: "appPath", children: /* @__PURE__ */ n(re, { id: "appPath", placeholder: "my-agent", value: r.appPath, onChange: H, error: X, helperText: l.appPath, fullWidth: !0 }) }), e[61] = l.appPath, e[62] = r.appPath, e[63] = H, e[64] = X, e[65] = O) : O = e[65];
1104
+ let B;
1105
+ e[66] !== q || e[67] !== O ? (B = /* @__PURE__ */ S(_.Stack, { direction: "row", spacing: 2, children: [
1106
+ q,
1107
+ O
1108
+ ] }), e[66] = q, e[67] = O, e[68] = B) : B = e[68];
1109
+ let Z;
1110
+ e[69] !== $ || e[70] !== z || e[71] !== B ? (Z = /* @__PURE__ */ S(_.Section, { children: [
1111
+ w,
1112
+ /* @__PURE__ */ S(_.Stack, { spacing: 2, children: [
1113
+ $,
1114
+ z,
1115
+ B
1116
+ ] })
1117
+ ] }), e[69] = $, e[70] = z, e[71] = B, e[72] = Z) : Z = e[72];
1118
+ let te;
1119
+ e[73] === Symbol.for("react.memo_cache_sentinel") ? (te = /* @__PURE__ */ n(_.Subheader, { children: "Build Details" }), e[73] = te) : te = e[73];
1120
+ let fe;
1121
+ e[74] !== r.language || e[75] !== c ? (fe = Kr.map((K) => {
1122
+ const ve = r.language === K.value;
1123
+ return /* @__PURE__ */ n(_.CardButton, { onClick: () => c("language", K.value), selected: ve, children: /* @__PURE__ */ n(_.CardHeader, { title: /* @__PURE__ */ S(_.Stack, { direction: "row", spacing: 2, justifyContent: "center", alignItems: "center", children: [
1124
+ /* @__PURE__ */ n(er, { language: K.value }),
1125
+ /* @__PURE__ */ n(_.Body, { children: K.label })
1126
+ ] }) }) }, K.value);
1127
+ }), e[74] = r.language, e[75] = c, e[76] = fe) : fe = e[76];
1128
+ let se;
1129
+ e[77] !== fe ? (se = /* @__PURE__ */ n(_.Stack, { direction: "row", spacing: 2, children: fe }), e[77] = fe, e[78] = se) : se = e[78];
1130
+ const Pe = r.language === "python";
1131
+ let de;
1132
+ e[79] !== c ? (de = (K) => c("runCommand", K.target.value), e[79] = c, e[80] = de) : de = e[80];
1133
+ const Ee = !!l.runCommand, we = l.runCommand || "Dependencies auto-install from package.json, requirements.txt, or pyproject.toml";
1134
+ let me;
1135
+ e[81] !== r.runCommand || e[82] !== de || e[83] !== Ee || e[84] !== we ? (me = /* @__PURE__ */ n(_.ElementWrapper, { label: "Start Command", name: "runCommand", children: /* @__PURE__ */ n(re, { id: "runCommand", placeholder: "python main.py", value: r.runCommand, onChange: de, error: Ee, helperText: we, fullWidth: !0 }) }), e[81] = r.runCommand, e[82] = de, e[83] = Ee, e[84] = we, e[85] = me) : me = e[85];
1136
+ const Ie = !!l.languageVersion, Se = r.languageVersion || "";
1137
+ let pe;
1138
+ e[86] !== c ? (pe = (K) => c("languageVersion", K.target.value), e[86] = c, e[87] = pe) : pe = e[87];
1139
+ let ye;
1140
+ e[88] === Symbol.for("react.memo_cache_sentinel") ? (ye = nn.map(Yr), e[88] = ye) : ye = e[88];
1141
+ let he;
1142
+ e[89] !== Se || e[90] !== pe ? (he = /* @__PURE__ */ n(Ot, { id: "languageVersion", value: Se, onChange: pe, children: ye }), e[89] = Se, e[90] = pe, e[91] = he) : he = e[91];
1143
+ const _e = l.languageVersion || "Python runtime version";
1144
+ let Y;
1145
+ e[92] !== _e ? (Y = /* @__PURE__ */ n(Mt, { children: _e }), e[92] = _e, e[93] = Y) : Y = e[93];
1146
+ let J;
1147
+ e[94] !== Ie || e[95] !== he || e[96] !== Y ? (J = /* @__PURE__ */ n(_.ElementWrapper, { label: "Language Version", name: "languageVersion", children: /* @__PURE__ */ S(rn, { fullWidth: !0, error: Ie, children: [
1148
+ he,
1149
+ Y
1150
+ ] }) }), e[94] = Ie, e[95] = he, e[96] = Y, e[97] = J) : J = e[97];
1151
+ let ge;
1152
+ e[98] !== me || e[99] !== J ? (ge = /* @__PURE__ */ S(_.Stack, { direction: "row", spacing: 2, children: [
1153
+ me,
1154
+ J
1155
+ ] }), e[98] = me, e[99] = J, e[100] = ge) : ge = e[100];
1156
+ const zt = r.enableAutoInstrumentation ?? !0;
1157
+ let Ve;
1158
+ e[101] !== c ? (Ve = (K) => c("enableAutoInstrumentation", K.target.checked), e[101] = c, e[102] = Ve) : Ve = e[102];
1159
+ let De;
1160
+ e[103] !== zt || e[104] !== Ve ? (De = /* @__PURE__ */ n(br, { control: /* @__PURE__ */ n(Sr, { checked: zt, onChange: Ve }), label: "Enable auto instrumentation" }), e[103] = zt, e[104] = Ve, e[105] = De) : De = e[105];
1161
+ const Gt = r.enableAutoInstrumentation !== !1;
1162
+ let at;
1163
+ e[106] === Symbol.for("react.memo_cache_sentinel") ? (at = /* @__PURE__ */ n(j, { variant: "body2", color: "text.secondary", children: "Automatically adds OTEL tracing instrumentation to your agent for observability." }), e[106] = at) : at = e[106];
1164
+ let it;
1165
+ e[107] === Symbol.for("react.memo_cache_sentinel") ? (it = {
1166
+ minWidth: 200
1167
+ }, e[107] = it) : it = e[107];
1168
+ const Bt = !!l.instrumentationVersion, Kt = r.instrumentationVersion || "";
1169
+ let Re;
1170
+ e[108] !== c ? (Re = (K) => c("instrumentationVersion", K.target.value), e[108] = c, e[109] = Re) : Re = e[109];
1171
+ let lt;
1172
+ e[110] === Symbol.for("react.memo_cache_sentinel") ? (lt = bn.map(Qr), e[110] = lt) : lt = e[110];
1173
+ let $e;
1174
+ e[111] !== Kt || e[112] !== Re ? ($e = /* @__PURE__ */ n(Ot, { id: "instrumentationVersion", value: Kt, onChange: Re, children: lt }), e[111] = Kt, e[112] = Re, e[113] = $e) : $e = e[113];
1175
+ const qt = l.instrumentationVersion || "Pins the init-container image and the bundled OpenLLMetry SDK version.";
1176
+ let Ue;
1177
+ e[114] !== qt ? (Ue = /* @__PURE__ */ n(Mt, { children: qt }), e[114] = qt, e[115] = Ue) : Ue = e[115];
1178
+ let je;
1179
+ e[116] !== Bt || e[117] !== $e || e[118] !== Ue ? (je = /* @__PURE__ */ S(ae, { spacing: 1, children: [
1180
+ at,
1181
+ /* @__PURE__ */ n(_.ElementWrapper, { label: "AMP Instrumentation Version", name: "instrumentationVersion", children: /* @__PURE__ */ S(rn, { sx: it, error: Bt, children: [
1182
+ $e,
1183
+ Ue
1184
+ ] }) })
1185
+ ] }), e[116] = Bt, e[117] = $e, e[118] = Ue, e[119] = je) : je = e[119];
1186
+ let Me;
1187
+ e[120] !== Gt || e[121] !== je ? (Me = /* @__PURE__ */ n(Te, { in: Gt, children: je }), e[120] = Gt, e[121] = je, e[122] = Me) : Me = e[122];
1188
+ const Ht = r.enableAutoInstrumentation === !1;
1189
+ let ot, st;
1190
+ e[123] === Symbol.for("react.memo_cache_sentinel") ? (ot = {
1191
+ mt: 1
1192
+ }, st = /* @__PURE__ */ n(j, { variant: "subtitle2", children: "Tracing Support for Python Agents" }), e[123] = ot, e[124] = st) : (ot = e[123], st = e[124]);
1193
+ let ct;
1194
+ e[125] === Symbol.for("react.memo_cache_sentinel") ? (ct = {
1195
+ mt: 1
1196
+ }, e[125] = ct) : ct = e[125];
1197
+ let dt;
1198
+ e[126] === Symbol.for("react.memo_cache_sentinel") ? (dt = /* @__PURE__ */ n(j, { component: "a", href: gn, target: "_blank", rel: "noopener noreferrer", sx: {
1199
+ color: "primary.main"
1200
+ }, children: "manual instrumentation contract" }), e[126] = dt) : dt = e[126];
1201
+ let mt;
1202
+ e[127] === Symbol.for("react.memo_cache_sentinel") ? (mt = /* @__PURE__ */ n(j, { component: "code", sx: {
1203
+ bgcolor: "action.hover",
1204
+ px: 0.5,
1205
+ borderRadius: 0.5
1206
+ }, children: "amp-instrumentation" }), e[127] = mt) : mt = e[127];
1207
+ let pt;
1208
+ e[128] === Symbol.for("react.memo_cache_sentinel") ? (pt = /* @__PURE__ */ S(j, { variant: "body2", sx: ct, children: [
1209
+ "With auto-instrumentation disabled, you can still manually instrument your Python agent using",
1210
+ " ",
1211
+ "your desired instrumentation library. Emit your own spans against the",
1212
+ " ",
1213
+ dt,
1214
+ " ",
1215
+ "—",
1216
+ " ",
1217
+ mt,
1218
+ " ",
1219
+ "ships an",
1220
+ " ",
1221
+ /* @__PURE__ */ n(j, { component: "code", sx: {
1222
+ bgcolor: "action.hover",
1223
+ px: 0.5,
1224
+ borderRadius: 0.5
1225
+ }, children: "init_otel()" }),
1226
+ " ",
1227
+ "helper that configures the OTLP exporter for you."
1228
+ ] }), e[128] = pt) : pt = e[128];
1229
+ let ht;
1230
+ e[129] === Symbol.for("react.memo_cache_sentinel") ? (ht = {
1231
+ mt: 1
1232
+ }, e[129] = ht) : ht = e[129];
1233
+ let ut;
1234
+ e[130] === Symbol.for("react.memo_cache_sentinel") ? (ut = /* @__PURE__ */ n(j, { component: "code", sx: {
1235
+ bgcolor: "action.hover",
1236
+ px: 0.5,
1237
+ borderRadius: 0.5
1238
+ }, children: "AMP_OTEL_ENDPOINT" }), e[130] = ut) : ut = e[130];
1239
+ let ft;
1240
+ e[131] === Symbol.for("react.memo_cache_sentinel") ? (ft = /* @__PURE__ */ S(j, { variant: "body2", sx: ht, children: [
1241
+ "Environment variables provided:",
1242
+ " ",
1243
+ ut,
1244
+ ", ",
1245
+ /* @__PURE__ */ n(j, { component: "code", sx: {
1246
+ bgcolor: "action.hover",
1247
+ px: 0.5,
1248
+ borderRadius: 0.5
1249
+ }, children: "AMP_AGENT_API_KEY" })
1250
+ ] }), e[131] = ft) : ft = e[131];
1251
+ let gt;
1252
+ e[132] === Symbol.for("react.memo_cache_sentinel") ? (gt = /* @__PURE__ */ n(j, { variant: "body2", sx: {
1253
+ mt: 1
1254
+ }, children: "Example configuration:" }), e[132] = gt) : gt = e[132];
1255
+ let yt;
1256
+ e[133] === Symbol.for("react.memo_cache_sentinel") ? (yt = {
1257
+ mt: 0.5,
1258
+ ml: 1
1259
+ }, e[133] = yt) : yt = e[133];
1260
+ let vt;
1261
+ e[134] === Symbol.for("react.memo_cache_sentinel") ? (vt = /* @__PURE__ */ S(j, { variant: "body2", component: "div", sx: yt, children: [
1262
+ "• OTLP exporter endpoint =",
1263
+ " ",
1264
+ /* @__PURE__ */ n(j, { component: "code", sx: {
1265
+ bgcolor: "action.hover",
1266
+ px: 0.5,
1267
+ borderRadius: 0.5
1268
+ }, children: "AMP_OTEL_ENDPOINT" })
1269
+ ] }), e[134] = vt) : vt = e[134];
1270
+ let bt;
1271
+ e[135] === Symbol.for("react.memo_cache_sentinel") ? (bt = {
1272
+ ml: 1
1273
+ }, e[135] = bt) : bt = e[135];
1274
+ let St;
1275
+ e[136] === Symbol.for("react.memo_cache_sentinel") ? (St = /* @__PURE__ */ S(xe, { severity: "info", sx: ot, children: [
1276
+ st,
1277
+ pt,
1278
+ ft,
1279
+ gt,
1280
+ vt,
1281
+ /* @__PURE__ */ S(j, { variant: "body2", component: "div", sx: bt, children: [
1282
+ "• OTLP headers =",
1283
+ " ",
1284
+ /* @__PURE__ */ n(j, { component: "code", sx: {
1285
+ bgcolor: "action.hover",
1286
+ px: 0.5,
1287
+ borderRadius: 0.5
1288
+ }, children: '{"x-amp-api-key": AMP_AGENT_API_KEY}' })
1289
+ ] })
1290
+ ] }), e[136] = St) : St = e[136];
1291
+ let Oe;
1292
+ e[137] !== Ht ? (Oe = /* @__PURE__ */ n(Te, { in: Ht, children: St }), e[137] = Ht, e[138] = Oe) : Oe = e[138];
1293
+ let We;
1294
+ e[139] !== Pe || e[140] !== ge || e[141] !== De || e[142] !== Me || e[143] !== Oe ? (We = /* @__PURE__ */ S(Te, { in: Pe, children: [
1295
+ ge,
1296
+ De,
1297
+ Me,
1298
+ Oe
1299
+ ] }), e[139] = Pe, e[140] = ge, e[141] = De, e[142] = Me, e[143] = Oe, e[144] = We) : We = e[144];
1300
+ const Zt = r.language === "docker", Yt = r.dockerfilePath || "";
1301
+ let Fe;
1302
+ e[145] !== c ? (Fe = (K) => c("dockerfilePath", K.target.value), e[145] = c, e[146] = Fe) : Fe = e[146];
1303
+ const Qt = !!l.dockerfilePath, Xt = l.dockerfilePath || "Path to Dockerfile in your repository";
1304
+ let ze;
1305
+ e[147] !== Yt || e[148] !== Fe || e[149] !== Qt || e[150] !== Xt ? (ze = /* @__PURE__ */ n(_.Stack, { direction: "row", spacing: 2, children: /* @__PURE__ */ n(_.ElementWrapper, { label: "Dockerfile Path", name: "dockerfilePath", children: /* @__PURE__ */ n(re, { id: "dockerfilePath", placeholder: "e.g., ./Dockerfile", value: Yt, onChange: Fe, error: Qt, helperText: Xt, fullWidth: !0 }) }) }), e[147] = Yt, e[148] = Fe, e[149] = Qt, e[150] = Xt, e[151] = ze) : ze = e[151];
1306
+ let Nt;
1307
+ e[152] === Symbol.for("react.memo_cache_sentinel") ? (Nt = /* @__PURE__ */ n(j, { variant: "subtitle2", gutterBottom: !0, children: "Tracing Support for Docker-Based Agents" }), e[152] = Nt) : Nt = e[152];
1308
+ let Ct;
1309
+ e[153] === Symbol.for("react.memo_cache_sentinel") ? (Ct = /* @__PURE__ */ n(j, { component: "code", sx: {
1310
+ bgcolor: "action.hover",
1311
+ px: 0.5,
1312
+ borderRadius: 0.5
1313
+ }, children: `pip install amp-instrumentation==${Sn}` }), e[153] = Ct) : Ct = e[153];
1314
+ let _t;
1315
+ e[154] === Symbol.for("react.memo_cache_sentinel") ? (_t = /* @__PURE__ */ n(j, { component: "code", sx: {
1316
+ bgcolor: "action.hover",
1317
+ px: 0.5,
1318
+ borderRadius: 0.5
1319
+ }, children: "amp-instrument python your_script.py" }), e[154] = _t) : _t = e[154];
1320
+ let At;
1321
+ e[155] === Symbol.for("react.memo_cache_sentinel") ? (At = /* @__PURE__ */ n(j, { component: "a", href: qr, target: "_blank", rel: "noopener noreferrer", sx: {
1322
+ color: "primary.main"
1323
+ }, children: "AMP instrumentation version mapping" }), e[155] = At) : At = e[155];
1324
+ let kt;
1325
+ e[156] === Symbol.for("react.memo_cache_sentinel") ? (kt = /* @__PURE__ */ S(j, { variant: "body2", paragraph: !0, children: [
1326
+ "Docker-based agents require OTEL instrumentation to export traces. For Python, use",
1327
+ " ",
1328
+ Ct,
1329
+ " ",
1330
+ "and run with",
1331
+ " ",
1332
+ _t,
1333
+ " ",
1334
+ "for zero-code tracing. To pick a different version, see the",
1335
+ " ",
1336
+ At,
1337
+ ". For agents on a framework the Traceloop SDK doesn't cover, emit your own spans against the",
1338
+ " ",
1339
+ /* @__PURE__ */ n(j, { component: "a", href: gn, target: "_blank", rel: "noopener noreferrer", sx: {
1340
+ color: "primary.main"
1341
+ }, children: "manual instrumentation contract" }),
1342
+ "."
1343
+ ] }), e[156] = kt) : kt = e[156];
1344
+ let xt;
1345
+ e[157] === Symbol.for("react.memo_cache_sentinel") ? (xt = /* @__PURE__ */ n(j, { component: "code", sx: {
1346
+ bgcolor: "action.hover",
1347
+ px: 0.5,
1348
+ borderRadius: 0.5
1349
+ }, children: "AMP_OTEL_ENDPOINT" }), e[157] = xt) : xt = e[157];
1350
+ let Pt;
1351
+ e[158] === Symbol.for("react.memo_cache_sentinel") ? (Pt = /* @__PURE__ */ S(j, { variant: "body2", gutterBottom: !0, children: [
1352
+ "Environment variables provided:",
1353
+ " ",
1354
+ xt,
1355
+ ", ",
1356
+ /* @__PURE__ */ n(j, { component: "code", sx: {
1357
+ bgcolor: "action.hover",
1358
+ px: 0.5,
1359
+ borderRadius: 0.5
1360
+ }, children: "AMP_AGENT_API_KEY" })
1361
+ ] }), e[158] = Pt) : Pt = e[158];
1362
+ let Et;
1363
+ e[159] === Symbol.for("react.memo_cache_sentinel") ? (Et = /* @__PURE__ */ n(j, { variant: "body2", sx: {
1364
+ mt: 1
1365
+ }, children: "Example configuration:" }), e[159] = Et) : Et = e[159];
1366
+ let wt;
1367
+ e[160] === Symbol.for("react.memo_cache_sentinel") ? (wt = {
1368
+ mt: 0.5,
1369
+ ml: 1
1370
+ }, e[160] = wt) : wt = e[160];
1371
+ let It;
1372
+ e[161] === Symbol.for("react.memo_cache_sentinel") ? (It = /* @__PURE__ */ S(j, { variant: "body2", component: "div", sx: wt, children: [
1373
+ "• OTLP exporter endpoint =",
1374
+ " ",
1375
+ /* @__PURE__ */ n(j, { component: "code", sx: {
1376
+ bgcolor: "action.hover",
1377
+ px: 0.5,
1378
+ borderRadius: 0.5
1379
+ }, children: "AMP_OTEL_ENDPOINT" })
1380
+ ] }), e[161] = It) : It = e[161];
1381
+ let Tt;
1382
+ e[162] === Symbol.for("react.memo_cache_sentinel") ? (Tt = {
1383
+ ml: 1
1384
+ }, e[162] = Tt) : Tt = e[162];
1385
+ let Lt;
1386
+ e[163] === Symbol.for("react.memo_cache_sentinel") ? (Lt = /* @__PURE__ */ S(xe, { severity: "info", children: [
1387
+ Nt,
1388
+ kt,
1389
+ Pt,
1390
+ Et,
1391
+ It,
1392
+ /* @__PURE__ */ S(j, { variant: "body2", component: "div", sx: Tt, children: [
1393
+ "• OTLP headers =",
1394
+ " ",
1395
+ /* @__PURE__ */ n(j, { component: "code", sx: {
1396
+ bgcolor: "action.hover",
1397
+ px: 0.5,
1398
+ borderRadius: 0.5
1399
+ }, children: '{"x-amp-api-key": AMP_AGENT_API_KEY}' })
1400
+ ] })
1401
+ ] }), e[163] = Lt) : Lt = e[163];
1402
+ let Ge;
1403
+ e[164] !== ze ? (Ge = /* @__PURE__ */ S(ae, { spacing: 2, children: [
1404
+ ze,
1405
+ Lt
1406
+ ] }), e[164] = ze, e[165] = Ge) : Ge = e[165];
1407
+ let Be;
1408
+ e[166] !== Zt || e[167] !== Ge ? (Be = /* @__PURE__ */ n(Te, { in: Zt, children: Ge }), e[166] = Zt, e[167] = Ge, e[168] = Be) : Be = e[168];
1409
+ let Ke;
1410
+ e[169] !== se || e[170] !== We || e[171] !== Be ? (Ke = /* @__PURE__ */ S(_.Section, { children: [
1411
+ te,
1412
+ /* @__PURE__ */ S(_.Stack, { spacing: 2, children: [
1413
+ se,
1414
+ We,
1415
+ Be
1416
+ ] })
1417
+ ] }), e[169] = se, e[170] = We, e[171] = Be, e[172] = Ke) : Ke = e[172];
1418
+ let qe;
1419
+ e[173] !== l || e[174] !== r || e[175] !== a || e[176] !== o || e[177] !== u ? (qe = /* @__PURE__ */ n($r, { formData: r, setFormData: o, errors: l, setFieldError: a, validateField: u }), e[173] = l, e[174] = r, e[175] = a, e[176] = o, e[177] = u, e[178] = qe) : qe = e[178];
1420
+ let He;
1421
+ e[179] !== r.env ? (He = new Set((r.env ?? []).map(Xr).filter(Jr)), e[179] = r.env, e[180] = He) : He = e[180];
1422
+ let Ze;
1423
+ e[181] !== r.displayName || e[182] !== f || e[183] !== g || e[184] !== He ? (Ze = /* @__PURE__ */ n(wn, { llmProviders: f, setLLMProviders: g, agentDisplayName: r.displayName, externalEnvKeys: He }), e[181] = r.displayName, e[182] = f, e[183] = g, e[184] = He, e[185] = Ze) : Ze = e[185];
1424
+ let Vt;
1425
+ e[186] !== r.displayName ? (Vt = r.displayName ? r.displayName.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT", e[186] = r.displayName, e[187] = Vt) : Vt = e[187];
1426
+ const Ye = Vt;
1427
+ let Dt;
1428
+ if (e[188] !== Ye || e[189] !== f) {
1429
+ let K;
1430
+ e[191] !== Ye ? (K = (ve, $t) => [ve.urlVarName ?? `${Ye}_${$t + 1}_URL`, ve.apikeyVarName ?? `${Ye}_${$t + 1}_API_KEY`], e[191] = Ye, e[192] = K) : K = e[192], Dt = new Set(f.flatMap(K)), e[188] = Ye, e[189] = f, e[190] = Dt;
1431
+ } else
1432
+ Dt = e[190];
1433
+ const Jt = Dt;
1434
+ let Qe;
1435
+ e[193] !== r || e[194] !== o || e[195] !== Jt ? (Qe = /* @__PURE__ */ n(Pn, { formData: r, setFormData: o, llmReservedNames: Jt }), e[193] = r, e[194] = o, e[195] = Jt, e[196] = Qe) : Qe = e[196];
1436
+ let Rt;
1437
+ return e[197] !== Ke || e[198] !== qe || e[199] !== Ze || e[200] !== Qe || e[201] !== N || e[202] !== Z ? (Rt = /* @__PURE__ */ S(_.Stack, { spacing: 3, children: [
1438
+ N,
1439
+ Z,
1440
+ Ke,
1441
+ qe,
1442
+ Ze,
1443
+ Qe
1444
+ ] }), e[197] = Ke, e[198] = qe, e[199] = Ze, e[200] = Qe, e[201] = N, e[202] = Z, e[203] = Rt) : Rt = e[203], Rt;
1445
+ };
1446
+ function Zr(t) {
1447
+ console.error("Failed to generate name:", t);
1448
+ }
1449
+ function Yr(t) {
1450
+ return /* @__PURE__ */ n(et, { value: t, children: t }, t);
1451
+ }
1452
+ function Qr(t) {
1453
+ return /* @__PURE__ */ n(et, { value: t, children: t }, t);
1454
+ }
1455
+ function Xr(t) {
1456
+ return t.key;
1457
+ }
1458
+ function Jr(t) {
1459
+ return !!t;
1460
+ }
1461
+ const sn = (t) => {
1462
+ const e = ce(22), {
1463
+ lastSubmittedValidationErrors: r,
1464
+ isPending: o,
1465
+ onCancel: l,
1466
+ onSubmit: a,
1467
+ mode: u,
1468
+ isNameEmpty: f,
1469
+ hasLLMVarConflicts: g
1470
+ } = t, y = u === void 0 ? "deploy" : u, v = f === void 0 ? !1 : f, i = g === void 0 ? !1 : g, d = y === "connect";
1471
+ let s;
1472
+ e[0] !== r ? (s = Object.values(r), e[0] = r, e[1] = s) : s = e[1];
1473
+ const p = s, m = p.length > 0;
1474
+ let h;
1475
+ e[2] !== p ? (h = /* @__PURE__ */ n(xe, { severity: "error", children: p.map(ea) }), e[2] = p, e[3] = h) : h = e[3];
1476
+ let c;
1477
+ e[4] !== m || e[5] !== h ? (c = /* @__PURE__ */ n(Te, { in: m, timeout: "auto", unmountOnExit: !0, children: h }), e[4] = m, e[5] = h, e[6] = c) : c = e[6];
1478
+ let A;
1479
+ e[7] !== l ? (A = /* @__PURE__ */ n(Ce, { variant: "outlined", color: "primary", size: "medium", onClick: l, children: "Cancel" }), e[7] = l, e[8] = A) : A = e[8];
1480
+ let k;
1481
+ e[9] !== d ? (k = d ? /* @__PURE__ */ n(An, { size: 16 }) : /* @__PURE__ */ n(Ir, { size: 16 }), e[9] = d, e[10] = k) : k = e[10];
1482
+ const T = o || v || i, I = d ? "Register" : "Deploy";
1483
+ let P;
1484
+ e[11] !== a || e[12] !== I || e[13] !== k || e[14] !== T ? (P = /* @__PURE__ */ n(Ce, { variant: "contained", color: "primary", size: "medium", startIcon: k, onClick: a, disabled: T, children: I }), e[11] = a, e[12] = I, e[13] = k, e[14] = T, e[15] = P) : P = e[15];
1485
+ let E;
1486
+ e[16] !== P || e[17] !== A ? (E = /* @__PURE__ */ S(ee, { display: "flex", flexDirection: "row", gap: 1, alignItems: "center", children: [
1487
+ A,
1488
+ P
1489
+ ] }), e[16] = P, e[17] = A, e[18] = E) : E = e[18];
1490
+ let V;
1491
+ return e[19] !== E || e[20] !== c ? (V = /* @__PURE__ */ S(ee, { display: "flex", flexDirection: "column", gap: 3, children: [
1492
+ c,
1493
+ E
1494
+ ] }), e[19] = E, e[20] = c, e[21] = V) : V = e[21], V;
1495
+ };
1496
+ function ea(t, e) {
1497
+ return /* @__PURE__ */ n(ee, { children: t }, e);
1498
+ }
1499
+ function ta(t) {
1500
+ const e = {};
1501
+ for (const [o, l] of Object.entries(t.selectedProviderByEnv))
1502
+ l && (e[o] = {
1503
+ providerName: l.handle,
1504
+ configuration: {
1505
+ policies: t.guardrails.length > 0 ? t.guardrails.map((a) => ({
1506
+ name: a.name,
1507
+ version: a.version,
1508
+ paths: [{
1509
+ path: "/*",
1510
+ methods: ["*"],
1511
+ params: a.settings ?? {}
1512
+ }]
1513
+ })) : void 0
1514
+ }
1515
+ });
1516
+ if (Object.keys(e).length === 0) return null;
1517
+ const r = [...t.urlVarName ? [{
1518
+ key: "url",
1519
+ name: t.urlVarName
1520
+ }] : [], ...t.apikeyVarName ? [{
1521
+ key: "apikey",
1522
+ name: t.apikeyVarName
1523
+ }] : []];
1524
+ return {
1525
+ envMappings: e,
1526
+ ...r.length > 0 ? {
1527
+ environmentVariables: r
1528
+ } : {}
1529
+ };
1530
+ }
1531
+ function Je(t) {
1532
+ if (!t.length) return;
1533
+ const e = t.map(ta).filter((r) => r !== null);
1534
+ return e.length > 0 ? e : void 0;
1535
+ }
1536
+ const Tn = (t, e, r = []) => t.deploymentType === "new" ? {
1537
+ params: e,
1538
+ body: {
1539
+ name: t.name,
1540
+ displayName: t.displayName,
1541
+ description: t.description?.trim() || void 0,
1542
+ provisioning: {
1543
+ type: "internal",
1544
+ repository: {
1545
+ url: t.repositoryUrl ?? "",
1546
+ branch: t.branch ?? "main",
1547
+ appPath: t.appPath?.trim() || "/",
1548
+ secretRef: t.gitSecretRef || null
1549
+ }
1550
+ },
1551
+ agentType: {
1552
+ type: "agent-api",
1553
+ subType: t.interfaceType === "CUSTOM" ? "custom-api" : "chat-api"
1554
+ },
1555
+ build: t.language === "docker" ? {
1556
+ type: "docker",
1557
+ docker: {
1558
+ dockerfilePath: t.dockerfilePath ?? "./Dockerfile"
1559
+ }
1560
+ } : {
1561
+ type: "buildpack",
1562
+ buildpack: {
1563
+ language: t.language ?? "python",
1564
+ languageVersion: t.languageVersion ?? "3.11",
1565
+ runCommand: t.runCommand ?? ""
1566
+ }
1567
+ },
1568
+ configurations: {
1569
+ env: t.env.filter((o) => o.key && o.value).map((o) => ({
1570
+ key: o.key.replace(/\s+/g, "_"),
1571
+ value: o.value,
1572
+ isSensitive: o.isSensitive || !1
1573
+ })),
1574
+ enableAutoInstrumentation: t.enableAutoInstrumentation,
1575
+ ...t.language === "python" && t.enableAutoInstrumentation !== !1 && t.instrumentationVersion ? {
1576
+ instrumentationVersion: t.instrumentationVersion
1577
+ } : {}
1578
+ },
1579
+ inputInterface: {
1580
+ type: "HTTP",
1581
+ ...t.interfaceType === "CUSTOM" ? {
1582
+ port: Number(t.port),
1583
+ basePath: t.basePath || "/",
1584
+ schema: {
1585
+ path: t.openApiPath ?? ""
1586
+ }
1587
+ } : {}
1588
+ },
1589
+ ...Je(r) ? {
1590
+ modelConfig: Je(r)
1591
+ } : {}
1592
+ }
1593
+ } : {
1594
+ params: e,
1595
+ body: {
1596
+ name: t.name,
1597
+ displayName: t.displayName,
1598
+ description: t.description,
1599
+ provisioning: {
1600
+ type: "external"
1601
+ },
1602
+ agentType: {
1603
+ type: "external-agent-api",
1604
+ subType: "custom-api"
1605
+ },
1606
+ ...Je(r) ? {
1607
+ modelConfig: Je(r)
1608
+ } : {}
1609
+ }
1610
+ }, na = (t, e, r, o, l = []) => ({
1611
+ params: e,
1612
+ body: {
1613
+ name: t.name,
1614
+ displayName: t.displayName,
1615
+ description: t.description?.trim() || void 0,
1616
+ provisioning: {
1617
+ type: "internal",
1618
+ agentKind: {
1619
+ name: r,
1620
+ version: o
1621
+ }
1622
+ },
1623
+ configurations: {
1624
+ env: (t.env ?? []).filter((a) => a.key && a.value).map((a) => ({
1625
+ key: a.key.trim().replace(/\s+/g, "_"),
1626
+ value: a.value,
1627
+ isSensitive: a.isSensitive || !1
1628
+ })),
1629
+ enableAutoInstrumentation: t.enableAutoInstrumentation
1630
+ },
1631
+ ...Je(l) ? {
1632
+ modelConfig: Je(l)
1633
+ } : {}
1634
+ }
1635
+ }), ra = () => {
1636
+ const t = ce(57), e = nt(), {
1637
+ orgId: r,
1638
+ projectId: o
1639
+ } = ue();
1640
+ let l;
1641
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (l = {
1642
+ deploymentType: "new",
1643
+ enableAutoInstrumentation: !0,
1644
+ instrumentationVersion: Sn,
1645
+ name: "",
1646
+ displayName: "",
1647
+ description: "",
1648
+ repositoryUrl: "",
1649
+ branch: "main",
1650
+ appPath: "/",
1651
+ runCommand: "python main.py",
1652
+ language: "python",
1653
+ languageVersion: tr,
1654
+ dockerfilePath: "/Dockerfile",
1655
+ interfaceType: "DEFAULT",
1656
+ port: "",
1657
+ basePath: "/",
1658
+ openApiPath: "",
1659
+ env: []
1660
+ }, t[0] = l) : l = t[0];
1661
+ const [a, u] = ie(l), {
1662
+ errors: f,
1663
+ validateForm: g,
1664
+ setFieldError: y,
1665
+ validateField: v
1666
+ } = Wt(xn);
1667
+ let i;
1668
+ t[1] === Symbol.for("react.memo_cache_sentinel") ? (i = [], t[1] = i) : i = t[1];
1669
+ const [d, s] = ie(i), {
1670
+ mutate: p,
1671
+ isPending: m,
1672
+ error: h
1673
+ } = on(), c = r ?? "default", A = o ?? "default";
1674
+ let k;
1675
+ t[2] !== c || t[3] !== A ? (k = {
1676
+ orgName: c,
1677
+ projName: A
1678
+ }, t[2] = c, t[3] = A, t[4] = k) : k = t[4];
1679
+ const T = k;
1680
+ let I;
1681
+ t[5] !== e || t[6] !== r || t[7] !== o ? (I = () => {
1682
+ e(le(oe.children.org.children.projects.path, {
1683
+ orgId: r ?? "",
1684
+ projectId: o ?? "default"
1685
+ }));
1686
+ }, t[5] = e, t[6] = r, t[7] = o, t[8] = I) : I = t[8];
1687
+ const P = I;
1688
+ let E;
1689
+ t[9] === Symbol.for("react.memo_cache_sentinel") ? (E = {}, t[9] = E) : E = t[9];
1690
+ const [V, D] = ie(E);
1691
+ let L;
1692
+ t[10] !== p || t[11] !== f || t[12] !== a || t[13] !== d || t[14] !== e || t[15] !== T || t[16] !== g ? (L = () => {
1693
+ if (g(a))
1694
+ D({});
1695
+ else {
1696
+ D(f);
1697
+ return;
1698
+ }
1699
+ const G = Tn(a, T, d);
1700
+ p(G, {
1701
+ onSuccess: () => {
1702
+ e(le(oe.children.org.children.projects.children.agents.path, {
1703
+ orgId: T.orgName ?? "",
1704
+ projectId: T.projName ?? "",
1705
+ agentId: G.body.name
1706
+ }) + "?setup=true");
1707
+ },
1708
+ onError: aa
1709
+ });
1710
+ }, t[10] = p, t[11] = f, t[12] = a, t[13] = d, t[14] = e, t[15] = T, t[16] = g, t[17] = L) : L = t[17];
1711
+ const U = L, W = r ?? "", R = o ?? "default";
1712
+ let x;
1713
+ t[18] !== W || t[19] !== R ? (x = le(oe.children.org.children.projects.children.newAgent.children.create.path, {
1714
+ orgId: W,
1715
+ projectId: R
1716
+ }), t[18] = W, t[19] = R, t[20] = x) : x = t[20];
1717
+ const F = x;
1718
+ let M;
1719
+ t[21] !== f || t[22] !== a || t[23] !== d || t[24] !== y || t[25] !== v ? (M = /* @__PURE__ */ n(Hr, { formData: a, setFormData: u, errors: f, setFieldError: y, validateField: v, llmProviders: d, setLLMProviders: s }), t[21] = f, t[22] = a, t[23] = d, t[24] = y, t[25] = v, t[26] = M) : M = t[26];
1720
+ let N;
1721
+ t[27] !== h ? (N = !!h && /* @__PURE__ */ n(xe, { severity: "error", sx: {
1722
+ mt: 2
1723
+ }, children: h instanceof Error ? h.message : "Failed to create agent" }), t[27] = h, t[28] = N) : N = t[28];
1724
+ const w = !a.name.trim();
1725
+ let b;
1726
+ e: {
1727
+ let G;
1728
+ t[29] !== a.displayName ? (G = a.displayName ? a.displayName.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT", t[29] = a.displayName, t[30] = G) : G = t[30];
1729
+ const Q = G;
1730
+ let q, H;
1731
+ if (t[31] !== Q || t[32] !== d) {
1732
+ let B;
1733
+ t[35] !== Q ? (B = (Z, te) => [Z.urlVarName ?? `${Q}_${te + 1}_URL`, Z.apikeyVarName ?? `${Q}_${te + 1}_API_KEY`], t[35] = Q, t[36] = B) : B = t[36], q = d.flatMap(B), H = new Set(q), t[31] = Q, t[32] = d, t[33] = q, t[34] = H;
1734
+ } else
1735
+ q = t[33], H = t[34];
1736
+ const X = H;
1737
+ if (q.length !== X.size) {
1738
+ b = !0;
1739
+ break e;
1740
+ }
1741
+ let O;
1742
+ if (t[37] !== a.env || t[38] !== X) {
1743
+ const B = (a.env ?? []).map(ia).filter(la);
1744
+ if (B.length !== new Set(B).size) {
1745
+ b = !0;
1746
+ break e;
1747
+ }
1748
+ let Z;
1749
+ t[41] !== X ? (Z = (te) => X.has(te), t[41] = X, t[42] = Z) : Z = t[42], O = B.some(Z), t[37] = a.env, t[38] = X, t[39] = O, t[40] = b;
1750
+ } else
1751
+ O = t[39], b = t[40];
1752
+ b = O;
1753
+ }
1754
+ let C;
1755
+ t[43] !== P || t[44] !== U || t[45] !== m || t[46] !== V || t[47] !== w || t[48] !== b ? (C = /* @__PURE__ */ n(sn, { lastSubmittedValidationErrors: V, isPending: m, onCancel: P, onSubmit: U, isNameEmpty: w, mode: "deploy", hasLLMVarConflicts: b }), t[43] = P, t[44] = U, t[45] = m, t[46] = V, t[47] = w, t[48] = b, t[49] = C) : C = t[49];
1756
+ let $;
1757
+ t[50] !== M || t[51] !== N || t[52] !== C ? ($ = /* @__PURE__ */ S(_.Stack, { spacing: 3, children: [
1758
+ M,
1759
+ N,
1760
+ C
1761
+ ] }), t[50] = M, t[51] = N, t[52] = C, t[53] = $) : $ = t[53];
1762
+ let z;
1763
+ return t[54] !== F || t[55] !== $ ? (z = /* @__PURE__ */ n(tt, { title: "Create a Platform-Hosted Agent", description: "Specify the source repository, select the agent type, and deploy it on the platform.", disableIcon: !0, backHref: F, backLabel: "Back to Source Type Selection", children: $ }), t[54] = F, t[55] = $, t[56] = z) : z = t[56], z;
1764
+ };
1765
+ function aa(t) {
1766
+ console.error("Failed to create agent:", t);
1767
+ }
1768
+ function ia(t) {
1769
+ return t.key;
1770
+ }
1771
+ function la(t) {
1772
+ return !!t;
1773
+ }
1774
+ const oa = (t) => {
1775
+ const e = ce(39), {
1776
+ formData: r,
1777
+ setFormData: o,
1778
+ errors: l,
1779
+ setFieldError: a,
1780
+ validateField: u
1781
+ } = t, {
1782
+ orgId: f,
1783
+ projectId: g
1784
+ } = ue();
1785
+ let y;
1786
+ e[0] !== f ? (y = {
1787
+ orgName: f
1788
+ }, e[0] = f, e[1] = y) : y = e[1];
1789
+ const {
1790
+ mutate: v,
1791
+ isPending: i
1792
+ } = an(y);
1793
+ let d;
1794
+ e[2] !== a || e[3] !== o || e[4] !== u ? (d = (x, F) => {
1795
+ o((M) => {
1796
+ const N = {
1797
+ ...M,
1798
+ [x]: F
1799
+ }, w = u(x, F, N);
1800
+ return a(x, w), N;
1801
+ });
1802
+ }, e[2] = a, e[3] = o, e[4] = u, e[5] = d) : d = e[5];
1803
+ const s = d;
1804
+ let p;
1805
+ e[6] !== v || e[7] !== s || e[8] !== g ? (p = ln.debounce((x) => {
1806
+ if (x.length < 3) {
1807
+ s("name", "");
1808
+ return;
1809
+ }
1810
+ v({
1811
+ displayName: x,
1812
+ resourceType: "agent",
1813
+ projectName: g
1814
+ }, {
1815
+ onSuccess: (F) => {
1816
+ s("name", F.name);
1817
+ },
1818
+ onError: sa
1819
+ });
1820
+ }, 500), e[6] = v, e[7] = s, e[8] = g, e[9] = p) : p = e[9];
1821
+ const m = p;
1822
+ let h, c;
1823
+ e[10] !== m ? (h = () => () => {
1824
+ m.cancel();
1825
+ }, c = [m], e[10] = m, e[11] = h, e[12] = c) : (h = e[11], c = e[12]), Le(h, c);
1826
+ let A, k;
1827
+ e[13] !== m || e[14] !== r.displayName || e[15] !== s ? (A = () => {
1828
+ r.displayName && r.displayName.length >= 3 ? m(r.displayName) : (m.cancel(), s("name", ""));
1829
+ }, k = [r.displayName, m, s], e[13] = m, e[14] = r.displayName, e[15] = s, e[16] = A, e[17] = k) : (A = e[16], k = e[17]), Le(A, k);
1830
+ let T;
1831
+ e[18] === Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ n(_.Subheader, { children: "Agent Details" }), e[18] = T) : T = e[18];
1832
+ let I;
1833
+ e[19] !== s ? (I = (x) => s("displayName", x.target.value), e[19] = s, e[20] = I) : I = e[20];
1834
+ const P = !!l.displayName;
1835
+ let E;
1836
+ e[21] !== l.displayName || e[22] !== i ? (E = i ? /* @__PURE__ */ S(ae, { direction: "row", alignItems: "center", gap: 1, children: [
1837
+ /* @__PURE__ */ n(rt, { size: 12 }),
1838
+ /* @__PURE__ */ n(j, { variant: "caption", children: "Validating name..." })
1839
+ ] }) : l.displayName || "A name for your agent", e[21] = l.displayName, e[22] = i, e[23] = E) : E = e[23];
1840
+ let V;
1841
+ e[24] !== r.displayName || e[25] !== P || e[26] !== E || e[27] !== I ? (V = /* @__PURE__ */ n(_.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ n(re, { id: "displayName", placeholder: "e.g., Customer Support Agent", value: r.displayName, onChange: I, error: P, helperText: E, fullWidth: !0 }) }), e[24] = r.displayName, e[25] = P, e[26] = E, e[27] = I, e[28] = V) : V = e[28];
1842
+ const D = r.description || "";
1843
+ let L;
1844
+ e[29] !== s ? (L = (x) => s("description", x.target.value), e[29] = s, e[30] = L) : L = e[30];
1845
+ const U = !!l.description;
1846
+ let W;
1847
+ e[31] !== l.description || e[32] !== D || e[33] !== L || e[34] !== U ? (W = /* @__PURE__ */ n(_.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ n(re, { id: "description", placeholder: "Short description of what this agent does", multiline: !0, minRows: 2, maxRows: 6, value: D, onChange: L, error: U, helperText: l.description, fullWidth: !0 }) }), e[31] = l.description, e[32] = D, e[33] = L, e[34] = U, e[35] = W) : W = e[35];
1848
+ let R;
1849
+ return e[36] !== V || e[37] !== W ? (R = /* @__PURE__ */ S(_.Section, { children: [
1850
+ T,
1851
+ /* @__PURE__ */ S(_.Stack, { spacing: 2, children: [
1852
+ V,
1853
+ W
1854
+ ] })
1855
+ ] }), e[36] = V, e[37] = W, e[38] = R) : R = e[38], R;
1856
+ };
1857
+ function sa(t) {
1858
+ console.error("Failed to generate name:", t);
1859
+ }
1860
+ const ca = () => {
1861
+ const t = nt(), [e] = Dn(), {
1862
+ orgId: r,
1863
+ projectId: o,
1864
+ kindId: l
1865
+ } = ue(), {
1866
+ data: a,
1867
+ isLoading: u
1868
+ } = nr({
1869
+ orgName: r,
1870
+ kindName: l ?? ""
1871
+ }), f = be(() => [...a?.versions ?? []].sort((N, w) => new Date(w.createdAt).getTime() - new Date(N.createdAt).getTime()), [a]), [g, y] = ie(""), v = e.get("version") ?? "", i = be(() => {
1872
+ const N = g || v;
1873
+ return N && f.some((w) => w.version === N) ? N : f[0]?.version || "";
1874
+ }, [g, v, f]), d = be(() => a?.versions.find((N) => N.version === i), [a, i]), [s, p] = ie({
1875
+ deploymentType: "new",
1876
+ enableAutoInstrumentation: !0,
1877
+ name: "",
1878
+ displayName: "",
1879
+ description: "",
1880
+ // Catalog flow intentionally hides repo/build/input type sections in UI,
1881
+ // so we seed valid defaults for those required fields.
1882
+ repositoryUrl: "https://github.com/wso2/agent-catalog-template",
1883
+ branch: "main",
1884
+ appPath: "/",
1885
+ runCommand: "python main.py",
1886
+ language: "python",
1887
+ languageVersion: "3.11",
1888
+ dockerfilePath: "/Dockerfile",
1889
+ interfaceType: "DEFAULT",
1890
+ port: "",
1891
+ basePath: "/",
1892
+ openApiPath: "",
1893
+ env: []
1894
+ }), {
1895
+ errors: m,
1896
+ validateForm: h,
1897
+ setFieldError: c,
1898
+ validateField: A
1899
+ } = Wt(xn);
1900
+ Le(() => {
1901
+ const N = d?.configSchema ?? [];
1902
+ N.length !== 0 && p((w) => ({
1903
+ ...w,
1904
+ env: N.map((b) => ({
1905
+ key: b.name,
1906
+ value: b.defaultValue ?? "",
1907
+ isSensitive: b.isSecret
1908
+ }))
1909
+ }));
1910
+ }, [d]);
1911
+ const k = be(() => new Set((d?.configSchema ?? []).map((N) => N.name)), [d]), {
1912
+ mutate: T,
1913
+ isPending: I,
1914
+ error: P
1915
+ } = on(), [E, V] = ie([]), D = be(() => ({
1916
+ orgName: r ?? "default",
1917
+ projName: o ?? "default"
1918
+ }), [r, o]), L = be(() => {
1919
+ const N = s.displayName ? s.displayName.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT";
1920
+ return new Set(E.flatMap((w, b) => [w.urlVarName ?? `${N}_${b + 1}_URL`, w.apikeyVarName ?? `${N}_${b + 1}_API_KEY`]));
1921
+ }, [s.displayName, E]), U = be(() => {
1922
+ const N = s.displayName ? s.displayName.toUpperCase().replace(/[^A-Z0-9]/g, "_") : "AGENT";
1923
+ return E.flatMap((w, b) => [w.urlVarName ?? `${N}_${b + 1}_URL`, w.apikeyVarName ?? `${N}_${b + 1}_API_KEY`]);
1924
+ }, [s.displayName, E]), W = Ne(() => {
1925
+ t(le(oe.children.org.children.projects.path, {
1926
+ orgId: r ?? "",
1927
+ projectId: o ?? "default"
1928
+ }));
1929
+ }, [t, r, o]), [R, x] = ie({}), F = Ne(() => {
1930
+ if (h(s))
1931
+ x({});
1932
+ else {
1933
+ x(m);
1934
+ return;
1935
+ }
1936
+ const N = na(s, D, l ?? "", i, E);
1937
+ T(N, {
1938
+ onSuccess: () => {
1939
+ t(le(oe.children.org.children.projects.children.agents.path, {
1940
+ orgId: D.orgName ?? "",
1941
+ projectId: D.projName ?? "",
1942
+ agentId: N.body.name
1943
+ }) + "?setup=true");
1944
+ },
1945
+ onError: (w) => {
1946
+ console.error("Failed to create catalog agent:", w);
1947
+ }
1948
+ });
1949
+ }, [h, s, T, t, D, m, E, l, i]), M = be(() => le(oe.children.org.children.projects.children.newAgent.children.create.children.catalog.path, {
1950
+ orgId: r ?? "",
1951
+ projectId: o ?? "default"
1952
+ }), [r, o]);
1953
+ return /* @__PURE__ */ S(tt, { title: a ? `Create a "${a.displayName}" Agent` : u ? "Loading..." : `Create a "${l}" Agent`, description: "Add agent details and configure deployment settings.", disableIcon: !0, backHref: M, backLabel: "Back to Kind Selection", children: [
1954
+ u && /* @__PURE__ */ S(yn, { children: [
1955
+ /* @__PURE__ */ n(un, { variant: "rounded", height: 32, sx: {
1956
+ mb: 2,
1957
+ maxWidth: 320
1958
+ } }),
1959
+ /* @__PURE__ */ n(un, { variant: "rounded", height: 48, sx: {
1960
+ mb: 1
1961
+ } })
1962
+ ] }),
1963
+ /* @__PURE__ */ S(_.Stack, { spacing: 3, children: [
1964
+ /* @__PURE__ */ n(oa, { formData: s, setFormData: p, errors: m, setFieldError: c, validateField: A }),
1965
+ f.length > 0 && /* @__PURE__ */ S(_.Section, { children: [
1966
+ /* @__PURE__ */ n(_.Subheader, { children: "Agent Kind Version" }),
1967
+ /* @__PURE__ */ n(_.Stack, { spacing: 2, children: /* @__PURE__ */ n(_.ElementWrapper, { label: "Version", name: "kindVersion", children: /* @__PURE__ */ n(Ot, { size: "small", value: i, onChange: (N) => y(N.target.value), sx: {
1968
+ minWidth: 160
1969
+ }, children: f.map((N) => /* @__PURE__ */ S(et, { value: N.version, children: [
1970
+ "v",
1971
+ N.version
1972
+ ] }, N.version)) }) }) })
1973
+ ] }),
1974
+ /* @__PURE__ */ n(wn, { llmProviders: E, setLLMProviders: V, agentDisplayName: s.displayName, externalEnvKeys: new Set((s.env ?? []).map((N) => N.key).filter((N) => !!N)) }),
1975
+ /* @__PURE__ */ n(Pn, { formData: s, setFormData: p, lockedKeys: k, hideAdd: !0, llmReservedNames: L }),
1976
+ !!P && /* @__PURE__ */ n(xe, { severity: "error", sx: {
1977
+ mt: 2
1978
+ }, children: P instanceof Error ? P.message : "Failed to create agent" }),
1979
+ /* @__PURE__ */ n(sn, { lastSubmittedValidationErrors: R, isPending: I, onCancel: W, onSubmit: F, isNameEmpty: !s.name.trim(), mode: "deploy", hasLLMVarConflicts: (() => {
1980
+ if (U.length !== L.size) return !0;
1981
+ const N = (s.env ?? []).map((w) => w.key).filter((w) => !!w);
1982
+ return N.length !== new Set(N).size ? !0 : N.some((w) => L.has(w));
1983
+ })() })
1984
+ ] })
1985
+ ] });
1986
+ }, da = () => {
1987
+ const t = ce(17), {
1988
+ orgId: e,
1989
+ projectId: r
1990
+ } = ue(), o = e ?? "";
1991
+ let l;
1992
+ t[0] !== o ? (l = {
1993
+ orgName: o
1994
+ }, t[0] = o, t[1] = l) : l = t[1];
1995
+ const {
1996
+ data: a,
1997
+ isLoading: u
1998
+ } = rr(l), f = e ?? "", g = r ?? "default";
1999
+ let y;
2000
+ t[2] !== f || t[3] !== g ? (y = le(oe.children.org.children.projects.children.newAgent.children.create.path, {
2001
+ orgId: f,
2002
+ projectId: g
2003
+ }), t[2] = f, t[3] = g, t[4] = y) : y = t[4];
2004
+ const v = y;
2005
+ let i;
2006
+ t[5] !== e || t[6] !== r ? (i = (h) => le(oe.children.org.children.projects.children.newAgent.children.create.children.catalog.children.withKind.path, {
2007
+ orgId: e ?? "",
2008
+ projectId: r ?? "default",
2009
+ kindId: h.name
2010
+ }), t[5] = e, t[6] = r, t[7] = i) : i = t[7];
2011
+ const d = i;
2012
+ let s;
2013
+ t[8] !== a?.kinds ? (s = a?.kinds ?? [], t[8] = a?.kinds, t[9] = s) : s = t[9];
2014
+ let p;
2015
+ t[10] !== d || t[11] !== u || t[12] !== s ? (p = /* @__PURE__ */ n(ar, { items: s, isLoading: u, getViewPath: d }), t[10] = d, t[11] = u, t[12] = s, t[13] = p) : p = t[13];
2016
+ let m;
2017
+ return t[14] !== v || t[15] !== p ? (m = /* @__PURE__ */ n(tt, { title: "Select an Agent Kind", description: "Browse the catalog and pick a Agent Kind to create your agent from.", disableIcon: !0, backHref: v, backLabel: "Back to Source Type Selection", children: p }), t[14] = v, t[15] = p, t[16] = m) : m = t[16], m;
2018
+ }, ma = ({
2019
+ formData: t,
2020
+ setFormData: e,
2021
+ errors: r,
2022
+ setFieldError: o,
2023
+ validateField: l
2024
+ }) => {
2025
+ const {
2026
+ orgId: a,
2027
+ projectId: u
2028
+ } = ue(), {
2029
+ mutate: f,
2030
+ isPending: g
2031
+ } = an({
2032
+ orgName: a
2033
+ }), y = Ne((i, d) => {
2034
+ e((s) => {
2035
+ const p = {
2036
+ ...s,
2037
+ [i]: d
2038
+ }, m = l(i, d, p);
2039
+ return o(i, m), p;
2040
+ });
2041
+ }, [e, l, o]), v = be(
2042
+ () => ln.debounce((i) => {
2043
+ if (i.length < 3) {
2044
+ y("name", "");
2045
+ return;
2046
+ }
2047
+ f({
2048
+ displayName: i,
2049
+ resourceType: "agent",
2050
+ projectName: u
2051
+ }, {
2052
+ onSuccess: (d) => {
2053
+ y("name", d.name);
2054
+ },
2055
+ onError: (d) => {
2056
+ console.error("Failed to generate name:", d);
2057
+ }
2058
+ });
2059
+ }, 500),
2060
+ // eslint-disable-next-line react-hooks/exhaustive-deps
2061
+ [f, u, a, y]
2062
+ );
2063
+ return Le(() => () => {
2064
+ v.cancel();
2065
+ }, [v]), Le(() => {
2066
+ t.displayName && t.displayName.length >= 3 ? v(t.displayName) : (v.cancel(), y("name", ""));
2067
+ }, [t.displayName, v, y]), /* @__PURE__ */ n(_.Stack, { spacing: 3, children: /* @__PURE__ */ S(_.Section, { children: [
2068
+ /* @__PURE__ */ n(_.Subheader, { children: "Agent Details" }),
2069
+ /* @__PURE__ */ S(_.Stack, { spacing: 2, children: [
2070
+ /* @__PURE__ */ n(_.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ n(re, { id: "displayName", placeholder: "e.g., Customer Support", value: t.displayName, onChange: (i) => y("displayName", i.target.value), error: !!r.displayName, helperText: g ? /* @__PURE__ */ S(ae, { direction: "row", alignItems: "center", gap: 1, children: [
2071
+ /* @__PURE__ */ n(rt, { size: 12 }),
2072
+ /* @__PURE__ */ n(j, { variant: "caption", children: "Validating name..." })
2073
+ ] }) : r.displayName, fullWidth: !0 }) }),
2074
+ /* @__PURE__ */ n(_.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ n(re, { id: "description", placeholder: "Short description of what this agent does", multiline: !0, minRows: 2, maxRows: 6, value: t.description || "", onChange: (i) => y("description", i.target.value), error: !!r.description, helperText: r.description, fullWidth: !0 }) })
2075
+ ] })
2076
+ ] }) });
2077
+ }, pa = () => {
2078
+ const t = ce(41), e = nt(), {
2079
+ orgId: r,
2080
+ projectId: o
2081
+ } = ue();
2082
+ let l;
2083
+ t[0] === Symbol.for("react.memo_cache_sentinel") ? (l = {
2084
+ deploymentType: "existing",
2085
+ name: "",
2086
+ displayName: "",
2087
+ description: ""
2088
+ }, t[0] = l) : l = t[0];
2089
+ const [a, u] = ie(l), {
2090
+ errors: f,
2091
+ validateForm: g,
2092
+ setFieldError: y,
2093
+ validateField: v
2094
+ } = Wt(Dr), {
2095
+ mutate: i,
2096
+ isPending: d,
2097
+ error: s
2098
+ } = on(), p = r ?? "default", m = o ?? "default";
2099
+ let h;
2100
+ t[1] !== p || t[2] !== m ? (h = {
2101
+ orgName: p,
2102
+ projName: m
2103
+ }, t[1] = p, t[2] = m, t[3] = h) : h = t[3];
2104
+ const c = h;
2105
+ let A;
2106
+ t[4] !== e || t[5] !== r || t[6] !== o ? (A = () => {
2107
+ e(le(oe.children.org.children.projects.path, {
2108
+ orgId: r ?? "",
2109
+ projectId: o ?? "default"
2110
+ }));
2111
+ }, t[4] = e, t[5] = r, t[6] = o, t[7] = A) : A = t[7];
2112
+ const k = A;
2113
+ let T;
2114
+ t[8] !== i || t[9] !== e || t[10] !== c ? (T = ($) => {
2115
+ const z = Tn($, c);
2116
+ i(z, {
2117
+ onSuccess: () => {
2118
+ e(le(oe.children.org.children.projects.children.agents.path, {
2119
+ orgId: c.orgName ?? "",
2120
+ projectId: c.projName ?? "",
2121
+ agentId: z.body.name
2122
+ }) + "?setup=true");
2123
+ },
2124
+ onError: ha
2125
+ });
2126
+ }, t[8] = i, t[9] = e, t[10] = c, t[11] = T) : T = t[11];
2127
+ const I = T;
2128
+ let P;
2129
+ t[12] === Symbol.for("react.memo_cache_sentinel") ? (P = {}, t[12] = P) : P = t[12];
2130
+ const [E, V] = ie(P);
2131
+ let D;
2132
+ t[13] !== f || t[14] !== a || t[15] !== I || t[16] !== g ? (D = () => {
2133
+ if (g(a))
2134
+ V({});
2135
+ else {
2136
+ V(f);
2137
+ return;
2138
+ }
2139
+ I(a);
2140
+ }, t[13] = f, t[14] = a, t[15] = I, t[16] = g, t[17] = D) : D = t[17];
2141
+ const L = D, U = r ?? "", W = o ?? "default";
2142
+ let R;
2143
+ t[18] !== U || t[19] !== W ? (R = le(oe.children.org.children.projects.path, {
2144
+ orgId: U,
2145
+ projectId: W
2146
+ }), t[18] = U, t[19] = W, t[20] = R) : R = t[20];
2147
+ const x = R;
2148
+ let F;
2149
+ t[21] !== f || t[22] !== a || t[23] !== y || t[24] !== v ? (F = /* @__PURE__ */ n(ma, { formData: a, setFormData: u, errors: f, setFieldError: y, validateField: v }), t[21] = f, t[22] = a, t[23] = y, t[24] = v, t[25] = F) : F = t[25];
2150
+ let M;
2151
+ t[26] !== s ? (M = !!s && /* @__PURE__ */ n(xe, { severity: "error", sx: {
2152
+ mt: 2
2153
+ }, children: s instanceof Error ? s.message : "Failed to register agent" }), t[26] = s, t[27] = M) : M = t[27];
2154
+ const N = !a.name.trim();
2155
+ let w;
2156
+ t[28] !== k || t[29] !== L || t[30] !== d || t[31] !== E || t[32] !== N ? (w = /* @__PURE__ */ n(sn, { lastSubmittedValidationErrors: E, isPending: d, onCancel: k, onSubmit: L, isNameEmpty: N, mode: "connect" }), t[28] = k, t[29] = L, t[30] = d, t[31] = E, t[32] = N, t[33] = w) : w = t[33];
2157
+ let b;
2158
+ t[34] !== F || t[35] !== M || t[36] !== w ? (b = /* @__PURE__ */ S(_.Stack, { spacing: 3, children: [
2159
+ F,
2160
+ M,
2161
+ w
2162
+ ] }), t[34] = F, t[35] = M, t[36] = w, t[37] = b) : b = t[37];
2163
+ let C;
2164
+ return t[38] !== x || t[39] !== b ? (C = /* @__PURE__ */ n(tt, { title: "Register an Externally-Hosted Agent", description: "Provide basic information to register your externally-hosted agent on the platform.", disableIcon: !0, backHref: x, backLabel: "Back to Agents", children: b }), t[38] = x, t[39] = b, t[40] = C) : C = t[40], C;
2165
+ };
2166
+ function ha(t) {
2167
+ console.error("Failed to register agent:", t);
2168
+ }
2169
+ const ua = () => {
2170
+ const t = ce(21), e = nt(), {
2171
+ orgId: r,
2172
+ projectId: o
2173
+ } = ue(), l = oe.children.org.children.projects.children.newAgent, a = l.children.create.path, u = l.children.connect.path;
2174
+ let f;
2175
+ t[0] !== e || t[1] !== r || t[2] !== o ? (f = (k) => {
2176
+ e(le(k === "new" ? a : u, {
2177
+ orgId: r ?? "",
2178
+ projectId: o ?? "default"
2179
+ }));
2180
+ }, t[0] = e, t[1] = r, t[2] = o, t[3] = f) : f = t[3];
2181
+ const g = f;
2182
+ let y;
2183
+ t[4] !== e || t[5] !== r || t[6] !== o ? (y = (k) => {
2184
+ e(le(`${a}/${k}`, {
2185
+ orgId: r ?? "",
2186
+ projectId: o ?? "default"
2187
+ }));
2188
+ }, t[4] = e, t[5] = r, t[6] = o, t[7] = y) : y = t[7];
2189
+ const v = y;
2190
+ let i;
2191
+ t[8] !== g ? (i = /* @__PURE__ */ n(ke, { index: !0, element: /* @__PURE__ */ n(Lr, { onSelect: g }) }), t[8] = g, t[9] = i) : i = t[9];
2192
+ let d;
2193
+ t[10] !== v ? (d = /* @__PURE__ */ n(ke, { index: !0, element: /* @__PURE__ */ n(Vr, { onSelect: v }) }), t[10] = v, t[11] = d) : d = t[11];
2194
+ let s;
2195
+ t[12] === Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ n(ke, { index: !0, element: /* @__PURE__ */ n(da, {}) }), t[12] = s) : s = t[12];
2196
+ let p;
2197
+ t[13] === Symbol.for("react.memo_cache_sentinel") ? (p = /* @__PURE__ */ S(ke, { path: Ut.children.org.children.projects.children.newAgent.children.create.children.catalog.path, children: [
2198
+ s,
2199
+ /* @__PURE__ */ n(ke, { path: Ut.children.org.children.projects.children.newAgent.children.create.children.catalog.children.withKind.path, element: /* @__PURE__ */ n(ca, {}) })
2200
+ ] }), t[13] = p) : p = t[13];
2201
+ let m;
2202
+ t[14] === Symbol.for("react.memo_cache_sentinel") ? (m = /* @__PURE__ */ n(ke, { path: Ut.children.org.children.projects.children.newAgent.children.create.children.source.path, element: /* @__PURE__ */ n(ra, {}) }), t[14] = m) : m = t[14];
2203
+ let h;
2204
+ t[15] !== d ? (h = /* @__PURE__ */ S(ke, { path: Ut.children.org.children.projects.children.newAgent.children.create.path, children: [
2205
+ d,
2206
+ p,
2207
+ m
2208
+ ] }), t[15] = d, t[16] = h) : h = t[16];
2209
+ let c;
2210
+ t[17] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ n(ke, { path: "connect", element: /* @__PURE__ */ n(pa, {}) }), t[17] = c) : c = t[17];
2211
+ let A;
2212
+ return t[18] !== i || t[19] !== h ? (A = /* @__PURE__ */ S(Rn, { children: [
2213
+ i,
2214
+ h,
2215
+ c
2216
+ ] }), t[18] = i, t[19] = h, t[20] = A) : A = t[20], A;
2217
+ }, _a = {
2218
+ title: "Add New Agent",
2219
+ description: "A page component for Add New Agent",
2220
+ icon: Tr,
2221
+ path: oe.children.org.children.projects.children.newAgent.path,
2222
+ component: ua
2223
+ };
2224
+ export {
2225
+ ua as AddNewAgent,
2226
+ _a as metaData
2227
+ };