@wso2/am-core-ui 0.0.19 → 0.0.20

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