@wso2/am-core-ui 0.0.3 → 0.0.5

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