@wso2/am-core-ui 0.0.17 → 0.0.19

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