@wso2/am-core-ui 0.0.17 → 0.0.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/APIKeysManager-C0phJriD.js +241 -0
  2. package/dist/CatalogKindListing-DtFI2YMG.js +118 -0
  3. package/dist/CodeBlock-mB_Loq7I.js +21736 -0
  4. package/dist/EnvironmentCard-09h1XRxx.js +310 -0
  5. package/dist/EnvironmentSelector-B7Bl93s2.js +48 -0
  6. package/dist/MCPLogo-D9IJzzl7.js +30 -0
  7. package/dist/PolicyListSection-o4k9e8XO.js +2475 -0
  8. package/dist/ResourceListShell-Cx6mdeqv.js +463 -0
  9. package/dist/SwaggerSpecViewer-BvkhoKsi.js +106 -0
  10. package/dist/clipboard-YAzStmkw.js +23 -0
  11. package/dist/debounce-BV83M53b.js +208 -0
  12. package/dist/format-BEZZRyE2.js +29 -0
  13. package/dist/formatDistanceToNow-TErllcH8.js +100 -0
  14. package/dist/gatewayScripts-D8O45W8u.js +72 -0
  15. package/dist/highlight-BsUzxSR3.js +454 -0
  16. package/dist/index-B52h3RHg.js +1290 -0
  17. package/dist/index-BP5drcF2.js +1265 -0
  18. package/dist/index-BZ4vxviI.js +7981 -0
  19. package/dist/index-B_Z0MwXk.js +25012 -0
  20. package/dist/index-BfjzUWDa.js +1397 -0
  21. package/dist/{index-CDm_burV.js → index-BnV-PkwM.js} +22 -20
  22. package/dist/index-CGDYgUCH.js +711 -0
  23. package/dist/index-COt7nJIf.js +2286 -0
  24. package/dist/index-CWZjOy1h.js +2247 -0
  25. package/dist/index-CezvogTQ.js +116 -0
  26. package/dist/index-CgCWbWzN.js +2342 -0
  27. package/dist/index-CjCkcuuI.js +322 -0
  28. package/dist/index-CjXvuf9m.js +1354 -0
  29. package/dist/index-DD4qF7gq.js +2340 -0
  30. package/dist/index-DeQ-9KTC.js +737 -0
  31. package/dist/index-Df6OBy4E.js +3041 -0
  32. package/dist/index-KRsV2L4V.js +1564 -0
  33. package/dist/index-PUuASE1F.js +2507 -0
  34. package/dist/index-PWsNvJB-.js +546 -0
  35. package/dist/index-UqDmyMSA.js +119 -0
  36. package/dist/index-_0Pj_ZtW.js +459 -0
  37. package/dist/{index-DJABKRWO.js → index-sr-mWz4T.js} +31 -30
  38. package/dist/index.d.ts +496 -200
  39. package/dist/index.js +462 -439
  40. package/dist/llmProviderPayload-CzihkdNa.js +332 -0
  41. package/dist/schemas-DFScWdSL.js +2969 -0
  42. package/package.json +1 -1
  43. package/dist/index-B0d-vovv.js +0 -236
  44. package/dist/index-CCmLfbLS.js +0 -80707
  45. package/dist/index-qanXZe0s.js +0 -3037
@@ -0,0 +1,2286 @@
1
+ import { jsx as t, jsxs as m, Fragment as Ae } from "react/jsx-runtime";
2
+ import { c as fe } from "react/compiler-runtime";
3
+ import { useState as X, useEffect as Se, useMemo as ee, useRef as Te, useCallback as Le, useId as ot } from "react";
4
+ import { useParams as Ee, useNavigate as De, Link as Bt, generatePath as xe, useLocation as vt } from "react-router-dom";
5
+ import { Form as re, Skeleton as be, Alert as he, Card as Be, CardContent as Fe, Stack as F, Box as le, Typography as j, Chip as yt, Button as ue, CircularProgress as Ge, TextField as Vt, IconButton as He, Tooltip as Ne, DialogTitle as jt, DialogContent as Kt, DialogActions as Gt, Dialog as Ut, ListingTable as U, TablePagination as Ot, Avatar as Je, SearchBar as Ct, Tab as Ue, Tabs as et, Divider as qe, ToggleButtonGroup as Wt, ToggleButton as at, FormLabel as bt, FormControl as Ft, Select as Ht, MenuItem as qt } from "@wso2/oxygen-ui";
6
+ import { N as Yt, G as Qt, t as Pe, _ as Zt, i as Ye, o as tt, $ as Pt, a0 as xt, a1 as Jt, n as Ve, D as je, m as Ke, g as Ie, a2 as Nt, a3 as Xt, a4 as en, P as we, a5 as Lt, a6 as St, a7 as wt, a8 as tn, a9 as kt, H as nn, aa as rn, ab as on, ac as an, ad as ln, z as It, ae as sn, af as cn, ag as dn, ah as mn, ai as un, aj as pn, ak as hn } from "./index-B_Z0MwXk.js";
7
+ import "@tanstack/react-query";
8
+ import { AlertTriangle as ke, Key as lt, RefreshCw as fn, Trash2 as gn, Plus as Re, Copy as vn, ServerCog as ze, Trash as st, Link as Oe, Search as nt, Edit as it, ExternalLink as At, Check as yn, Circle as Cn, Info as bn, BookOpen as $e, Settings as Pn } from "@wso2/oxygen-ui-icons-react";
9
+ import { f as Et } from "./formatDistanceToNow-TErllcH8.js";
10
+ import { M as xn } from "./MCPLogo-D9IJzzl7.js";
11
+ import { P as Mt } from "./PolicyListSection-o4k9e8XO.js";
12
+ import { C as Me } from "./CodeBlock-mB_Loq7I.js";
13
+ function Nn(n) {
14
+ const e = fe(19), {
15
+ apiKey: i,
16
+ onDismiss: a
17
+ } = n, [c, r] = X(!1);
18
+ let o;
19
+ e[0] !== i ? (o = () => {
20
+ navigator.clipboard.writeText(i).then(() => {
21
+ r(!0), setTimeout(() => r(!1), 2e3);
22
+ });
23
+ }, e[0] = i, e[1] = o) : o = e[1];
24
+ const s = o;
25
+ let d;
26
+ e[2] === Symbol.for("react.memo_cache_sentinel") ? (d = {
27
+ mb: 2,
28
+ "& .MuiAlert-message": {
29
+ flexGrow: 1
30
+ }
31
+ }, e[2] = d) : d = e[2];
32
+ let u;
33
+ e[3] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ t(j, { variant: "subtitle2", sx: {
34
+ mb: 0.5
35
+ }, children: "You will only see this key once. Copy it now." }), e[3] = u) : u = e[3];
36
+ let g;
37
+ e[4] === Symbol.for("react.memo_cache_sentinel") ? (g = {
38
+ input: {
39
+ readOnly: !0
40
+ }
41
+ }, e[4] = g) : g = e[4];
42
+ let h;
43
+ e[5] !== i ? (h = /* @__PURE__ */ t(Vt, { size: "small", fullWidth: !0, value: i, slotProps: g }), e[5] = i, e[6] = h) : h = e[6];
44
+ const f = c ? "Copied!" : "Copy";
45
+ let b;
46
+ e[7] === Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ t(vn, { size: 16 }), e[7] = b) : b = e[7];
47
+ let y;
48
+ e[8] !== s ? (y = /* @__PURE__ */ t(He, { size: "small", onClick: s, "aria-label": "Copy API key", children: b }), e[8] = s, e[9] = y) : y = e[9];
49
+ let v;
50
+ e[10] !== f || e[11] !== y ? (v = /* @__PURE__ */ t(Ne, { title: f, children: y }), e[10] = f, e[11] = y, e[12] = v) : v = e[12];
51
+ let C;
52
+ e[13] !== h || e[14] !== v ? (C = /* @__PURE__ */ m(le, { display: "flex", alignItems: "center", gap: 1, children: [
53
+ h,
54
+ v
55
+ ] }), e[13] = h, e[14] = v, e[15] = C) : C = e[15];
56
+ let p;
57
+ return e[16] !== a || e[17] !== C ? (p = /* @__PURE__ */ m(he, { severity: "success", onClose: a, sx: d, children: [
58
+ u,
59
+ C
60
+ ] }), e[16] = a, e[17] = C, e[18] = p) : p = e[18], p;
61
+ }
62
+ function ct(n) {
63
+ const e = fe(23), {
64
+ open: i,
65
+ title: a,
66
+ message: c,
67
+ confirmLabel: r,
68
+ isBusy: o,
69
+ onClose: s,
70
+ onConfirm: d
71
+ } = n;
72
+ let u;
73
+ e[0] !== a ? (u = /* @__PURE__ */ t(jt, { children: a }), e[0] = a, e[1] = u) : u = e[1];
74
+ let g;
75
+ e[2] !== c ? (g = /* @__PURE__ */ t(Kt, { children: /* @__PURE__ */ t(j, { variant: "body2", children: c }) }), e[2] = c, e[3] = g) : g = e[3];
76
+ let h;
77
+ e[4] !== o || e[5] !== s ? (h = /* @__PURE__ */ t(ue, { variant: "outlined", onClick: s, disabled: o, children: "Cancel" }), e[4] = o, e[5] = s, e[6] = h) : h = e[6];
78
+ let f;
79
+ e[7] !== o ? (f = o ? /* @__PURE__ */ t(Ge, { size: 16 }) : void 0, e[7] = o, e[8] = f) : f = e[8];
80
+ let b;
81
+ e[9] !== r || e[10] !== o || e[11] !== d || e[12] !== f ? (b = /* @__PURE__ */ t(ue, { variant: "contained", color: "error", onClick: d, disabled: o, startIcon: f, children: r }), e[9] = r, e[10] = o, e[11] = d, e[12] = f, e[13] = b) : b = e[13];
82
+ let y;
83
+ e[14] !== h || e[15] !== b ? (y = /* @__PURE__ */ m(Gt, { children: [
84
+ h,
85
+ b
86
+ ] }), e[14] = h, e[15] = b, e[16] = y) : y = e[16];
87
+ let v;
88
+ return e[17] !== s || e[18] !== i || e[19] !== u || e[20] !== g || e[21] !== y ? (v = /* @__PURE__ */ m(Ut, { open: i, onClose: s, maxWidth: "sm", fullWidth: !0, children: [
89
+ u,
90
+ g,
91
+ y
92
+ ] }), e[17] = s, e[18] = i, e[19] = u, e[20] = g, e[21] = y, e[22] = v) : v = e[22], v;
93
+ }
94
+ function _t(n) {
95
+ const e = fe(62), {
96
+ scopeKey: i,
97
+ title: a,
98
+ description: c,
99
+ apiKey: r,
100
+ isLoading: o,
101
+ isError: s,
102
+ isGenerating: d,
103
+ isDeleting: u,
104
+ isRegenerating: g,
105
+ emptyDescription: h,
106
+ disabledReason: f,
107
+ onGenerate: b,
108
+ onDelete: y,
109
+ onRegenerate: v
110
+ } = n, C = a === void 0 ? "API Keys" : a, p = s === void 0 ? !1 : s, N = u === void 0 ? !1 : u, L = g === void 0 ? !1 : g, z = h === void 0 ? "Generate an API key to authenticate requests through this configuration." : h, [E, x] = X(null), [w, I] = X(!1), [A, D] = X(!1);
111
+ let K;
112
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (K = () => {
113
+ x(null), I(!1), D(!1);
114
+ }, e[0] = K) : K = e[0];
115
+ let _;
116
+ e[1] !== i ? (_ = [i], e[1] = i, e[2] = _) : _ = e[2], Se(K, _);
117
+ let G;
118
+ e[3] !== b ? (G = async () => {
119
+ try {
120
+ const B = await b();
121
+ B && x(B);
122
+ } catch {
123
+ }
124
+ }, e[3] = b, e[4] = G) : G = e[4];
125
+ const k = G;
126
+ let V;
127
+ e[5] !== v ? (V = async () => {
128
+ try {
129
+ const B = await v();
130
+ D(!1), B && x(B);
131
+ } catch {
132
+ }
133
+ }, e[5] = v, e[6] = V) : V = e[6];
134
+ const W = V;
135
+ let O;
136
+ e[7] !== y ? (O = () => {
137
+ y(), I(!1), x(null);
138
+ }, e[7] = y, e[8] = O) : O = e[8];
139
+ const oe = O, T = !!f, $ = d || N || L;
140
+ let Y;
141
+ e[9] === Symbol.for("react.memo_cache_sentinel") ? (Y = {
142
+ flex: 1,
143
+ minWidth: 0
144
+ }, e[9] = Y) : Y = e[9];
145
+ let J;
146
+ e[10] !== C ? (J = /* @__PURE__ */ t(re.Subheader, { children: C }), e[10] = C, e[11] = J) : J = e[11];
147
+ let se;
148
+ e[12] !== c ? (se = c && /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", children: c }), e[12] = c, e[13] = se) : se = e[13];
149
+ let ne;
150
+ e[14] !== J || e[15] !== se ? (ne = /* @__PURE__ */ m(F, { spacing: 0.5, sx: Y, children: [
151
+ J,
152
+ se
153
+ ] }), e[14] = J, e[15] = se, e[16] = ne) : ne = e[16];
154
+ let Q;
155
+ e[17] !== T || e[18] !== r || e[19] !== $ || e[20] !== k || e[21] !== p || e[22] !== d || e[23] !== o ? (Q = !T && !o && !p && !r && /* @__PURE__ */ t(ue, { variant: "contained", size: "small", startIcon: d ? /* @__PURE__ */ t(Ge, { size: 16 }) : /* @__PURE__ */ t(Re, { size: 16 }), onClick: () => void k(), disabled: $, children: d ? "Generating…" : "Generate" }), e[17] = T, e[18] = r, e[19] = $, e[20] = k, e[21] = p, e[22] = d, e[23] = o, e[24] = Q) : Q = e[24];
156
+ let Z;
157
+ e[25] !== ne || e[26] !== Q ? (Z = /* @__PURE__ */ m(F, { direction: "row", justifyContent: "space-between", alignItems: "flex-start", spacing: 2, children: [
158
+ ne,
159
+ Q
160
+ ] }), e[25] = ne, e[26] = Q, e[27] = Z) : Z = e[27];
161
+ let ye;
162
+ e[28] === Symbol.for("react.memo_cache_sentinel") ? (ye = {
163
+ mt: 2
164
+ }, e[28] = ye) : ye = e[28];
165
+ let ce;
166
+ e[29] !== E ? (ce = E && /* @__PURE__ */ t(Nn, { apiKey: E, onDismiss: () => x(null) }), e[29] = E, e[30] = ce) : ce = e[30];
167
+ let ie;
168
+ e[31] !== r || e[32] !== $ || e[33] !== f || e[34] !== z || e[35] !== N || e[36] !== p || e[37] !== o || e[38] !== L ? (ie = o ? /* @__PURE__ */ t(be, { variant: "rounded", height: 72 }) : f ? /* @__PURE__ */ t(he, { severity: "info", children: f }) : p ? /* @__PURE__ */ t(he, { severity: "error", icon: /* @__PURE__ */ t(ke, { size: 18 }), children: "Failed to load the API key. Please refresh the page." }) : r ? /* @__PURE__ */ t(Be, { variant: "outlined", children: /* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ m(F, { direction: "row", justifyContent: "space-between", alignItems: "center", spacing: 2, children: [
169
+ /* @__PURE__ */ m(F, { direction: "row", spacing: 2, alignItems: "center", sx: {
170
+ minWidth: 0
171
+ }, children: [
172
+ /* @__PURE__ */ t(lt, { size: 18 }),
173
+ /* @__PURE__ */ m(le, { sx: {
174
+ minWidth: 0
175
+ }, children: [
176
+ /* @__PURE__ */ t(j, { variant: "body2", fontWeight: 500, noWrap: !0, children: r.displayName || r.name }),
177
+ /* @__PURE__ */ m(j, { variant: "caption", color: "text.secondary", children: [
178
+ r.maskedApiKey,
179
+ r.expiresAt && ` · Expires ${new Date(r.expiresAt).toLocaleDateString()}`
180
+ ] })
181
+ ] })
182
+ ] }),
183
+ /* @__PURE__ */ m(F, { direction: "row", spacing: 1, alignItems: "center", flexShrink: 0, children: [
184
+ /* @__PURE__ */ t(yt, { label: r.status, size: "small", color: r.status === "active" ? "success" : "default" }),
185
+ /* @__PURE__ */ t(ue, { variant: "outlined", size: "small", startIcon: L ? /* @__PURE__ */ t(Ge, { size: 16 }) : /* @__PURE__ */ t(fn, { size: 16 }), onClick: () => D(!0), disabled: $, children: "Regenerate" }),
186
+ /* @__PURE__ */ t(ue, { variant: "outlined", size: "small", color: "error", startIcon: N ? /* @__PURE__ */ t(Ge, { size: 16 }) : /* @__PURE__ */ t(gn, { size: 16 }), onClick: () => I(!0), disabled: $, children: "Delete" })
187
+ ] })
188
+ ] }) }) }) : /* @__PURE__ */ t(le, { sx: {
189
+ border: "1px dashed",
190
+ borderColor: "divider",
191
+ borderRadius: 1
192
+ }, children: /* @__PURE__ */ t(Yt, { disableBackground: !0, icon: /* @__PURE__ */ t(lt, { size: 48 }), message: "No API key generated yet", subtitle: z }) }), e[31] = r, e[32] = $, e[33] = f, e[34] = z, e[35] = N, e[36] = p, e[37] = o, e[38] = L, e[39] = ie) : ie = e[39];
193
+ let ge;
194
+ e[40] !== ce || e[41] !== ie ? (ge = /* @__PURE__ */ m(le, { sx: ye, children: [
195
+ ce,
196
+ ie
197
+ ] }), e[40] = ce, e[41] = ie, e[42] = ge) : ge = e[42];
198
+ const M = N ? "Deleting…" : "Delete";
199
+ let q;
200
+ e[43] === Symbol.for("react.memo_cache_sentinel") ? (q = () => I(!1), e[43] = q) : q = e[43];
201
+ let ae;
202
+ e[44] !== w || e[45] !== oe || e[46] !== N || e[47] !== M ? (ae = /* @__PURE__ */ t(ct, { open: w, title: "Delete API key?", message: "This will revoke and permanently remove the API key. Any client using it will immediately stop being able to authenticate.", confirmLabel: M, isBusy: N, onClose: q, onConfirm: oe }), e[44] = w, e[45] = oe, e[46] = N, e[47] = M, e[48] = ae) : ae = e[48];
203
+ const me = L ? "Regenerating…" : "Regenerate";
204
+ let S;
205
+ e[49] === Symbol.for("react.memo_cache_sentinel") ? (S = () => D(!1), e[49] = S) : S = e[49];
206
+ let l;
207
+ e[50] !== W ? (l = () => void W(), e[50] = W, e[51] = l) : l = e[51];
208
+ let P;
209
+ e[52] !== L || e[53] !== A || e[54] !== me || e[55] !== l ? (P = /* @__PURE__ */ t(ct, { open: A, title: "Regenerate API key?", message: "This will revoke the current API key and generate a new one. The current key will immediately stop working, and the new key is shown only once.", confirmLabel: me, isBusy: L, onClose: S, onConfirm: l }), e[52] = L, e[53] = A, e[54] = me, e[55] = l, e[56] = P) : P = e[56];
210
+ let R;
211
+ return e[57] !== Z || e[58] !== ge || e[59] !== ae || e[60] !== P ? (R = /* @__PURE__ */ m(re.Section, { children: [
212
+ Z,
213
+ ge,
214
+ ae,
215
+ P
216
+ ] }), e[57] = Z, e[58] = ge, e[59] = ae, e[60] = P, e[61] = R) : R = e[61], R;
217
+ }
218
+ function Tt(n) {
219
+ const e = fe(15), {
220
+ illustration: i,
221
+ title: a,
222
+ description: c,
223
+ action: r
224
+ } = n;
225
+ let o;
226
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (o = {
227
+ textAlign: "center",
228
+ py: 4
229
+ }, e[0] = o) : o = e[0];
230
+ let s;
231
+ e[1] === Symbol.for("react.memo_cache_sentinel") ? (s = {
232
+ mb: 2
233
+ }, e[1] = s) : s = e[1];
234
+ let d;
235
+ e[2] !== i ? (d = /* @__PURE__ */ t(le, { sx: s, children: i }), e[2] = i, e[3] = d) : d = e[3];
236
+ let u;
237
+ e[4] !== a ? (u = /* @__PURE__ */ t(j, { variant: "body2", fontWeight: 500, gutterBottom: !0, children: a }), e[4] = a, e[5] = u) : u = e[5];
238
+ let g;
239
+ e[6] !== c ? (g = /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", children: c }), e[6] = c, e[7] = g) : g = e[7];
240
+ let h;
241
+ e[8] !== r ? (h = r ? /* @__PURE__ */ t(le, { sx: {
242
+ mt: 2
243
+ }, children: r }) : null, e[8] = r, e[9] = h) : h = e[9];
244
+ let f;
245
+ return e[10] !== d || e[11] !== u || e[12] !== g || e[13] !== h ? (f = /* @__PURE__ */ m(le, { sx: o, children: [
246
+ d,
247
+ u,
248
+ g,
249
+ h
250
+ ] }), e[10] = d, e[11] = u, e[12] = g, e[13] = h, e[14] = f) : f = e[14], f;
251
+ }
252
+ function dt(n) {
253
+ const e = fe(8), {
254
+ illustration: i,
255
+ title: a,
256
+ description: c,
257
+ action: r,
258
+ colSpan: o
259
+ } = n;
260
+ let s;
261
+ e[0] !== r || e[1] !== c || e[2] !== i || e[3] !== a ? (s = /* @__PURE__ */ t(Tt, { illustration: i, title: a, description: c, action: r }), e[0] = r, e[1] = c, e[2] = i, e[3] = a, e[4] = s) : s = e[4];
262
+ let d;
263
+ return e[5] !== o || e[6] !== s ? (d = /* @__PURE__ */ t(U.Row, { children: /* @__PURE__ */ t(U.Cell, { colSpan: o, children: s }) }), e[5] = o, e[6] = s, e[7] = d) : d = e[7], d;
264
+ }
265
+ function Ln(n) {
266
+ const e = fe(17), {
267
+ title: i,
268
+ toolbar: a,
269
+ showToolbar: c,
270
+ tableHeader: r,
271
+ isLoading: o,
272
+ hasRows: s,
273
+ emptyState: d,
274
+ standaloneEmptyState: u,
275
+ children: g,
276
+ pagination: h
277
+ } = n, f = !o && !!u;
278
+ let b;
279
+ e[0] !== i ? (b = i && /* @__PURE__ */ t(j, { variant: "h6", children: i }), e[0] = i, e[1] = b) : b = e[1];
280
+ const y = c && a;
281
+ let v;
282
+ e[2] !== g || e[3] !== d || e[4] !== s || e[5] !== o || e[6] !== f || e[7] !== u || e[8] !== r ? (v = o ? /* @__PURE__ */ t(F, { spacing: 1, sx: {
283
+ m: 2
284
+ }, children: Array.from({
285
+ length: 3
286
+ }).map(Sn) }) : f ? u : /* @__PURE__ */ m(U, { children: [
287
+ r,
288
+ /* @__PURE__ */ t(U.Body, { children: s ? g : d })
289
+ ] }), e[2] = g, e[3] = d, e[4] = s, e[5] = o, e[6] = f, e[7] = u, e[8] = r, e[9] = v) : v = e[9];
290
+ const C = !f && h;
291
+ let p;
292
+ e[10] !== y || e[11] !== v || e[12] !== C ? (p = /* @__PURE__ */ m(U.Container, { children: [
293
+ y,
294
+ v,
295
+ C
296
+ ] }), e[10] = y, e[11] = v, e[12] = C, e[13] = p) : p = e[13];
297
+ let N;
298
+ return e[14] !== b || e[15] !== p ? (N = /* @__PURE__ */ m(F, { spacing: 2, children: [
299
+ b,
300
+ p
301
+ ] }), e[14] = b, e[15] = p, e[16] = N) : N = e[16], N;
302
+ }
303
+ function Sn(n, e) {
304
+ return /* @__PURE__ */ t(be, { variant: "rounded", height: 56 }, e);
305
+ }
306
+ const mt = 3, wn = [10, 25, 50];
307
+ function ut({
308
+ configs: n,
309
+ isLoading: e,
310
+ error: i,
311
+ labels: a,
312
+ addPath: c,
313
+ onAdd: r,
314
+ getViewPath: o,
315
+ onRemove: s,
316
+ isRemoving: d = !1,
317
+ showTitle: u = !0
318
+ }) {
319
+ const {
320
+ orgId: g,
321
+ projectId: h,
322
+ agentId: f
323
+ } = Ee(), b = De(), {
324
+ addConfirmation: y
325
+ } = Qt(), [v, C] = X(""), [p, N] = X(0), [L, z] = X(10), E = !!(g && h && f), x = ee(() => {
326
+ if (!v.trim()) return n;
327
+ const T = v.toLowerCase();
328
+ return n.filter(($) => $.name.toLowerCase().includes(T) || ($.description ?? "").toLowerCase().includes(T) || $.type.toLowerCase().includes(T));
329
+ }, [n, v]), w = x.length, I = Math.max(1, Math.ceil(w / L)), A = Math.min(p, I - 1), D = ee(() => x.slice(A * L, A * L + L), [x, A, L]), K = (T) => {
330
+ C(T), N(0);
331
+ }, _ = (T) => {
332
+ y({
333
+ title: a.removeTitle,
334
+ description: a.removeConfirmation(T),
335
+ confirmButtonText: "Remove",
336
+ confirmButtonColor: "error",
337
+ confirmButtonIcon: /* @__PURE__ */ t(st, { size: 16 }),
338
+ onConfirm: () => s(T.uuid)
339
+ });
340
+ }, G = (T) => r ? /* @__PURE__ */ t(ue, { variant: T, color: "primary", size: "small", startIcon: /* @__PURE__ */ t(Re, { size: 16 }), disabled: !E, onClick: r, children: a.addButtonLabel }) : /* @__PURE__ */ t(ue, { component: Bt, to: c ?? "#", variant: T, color: "primary", size: "small", startIcon: /* @__PURE__ */ t(Re, { size: 16 }), disabled: !E, children: a.addButtonLabel }), k = /* @__PURE__ */ t(U.Toolbar, { showSearch: !0, searchValue: v, onSearchChange: K, searchPlaceholder: a.searchPlaceholder, actions: G("contained") }), V = /* @__PURE__ */ t(U.Head, { children: /* @__PURE__ */ m(U.Row, { children: [
341
+ /* @__PURE__ */ t(U.Cell, { width: "70%", children: "Name" }),
342
+ /* @__PURE__ */ t(U.Cell, { width: "20%", children: "Created" }),
343
+ /* @__PURE__ */ t(U.Cell, { width: "10%", align: "right", children: "Actions" })
344
+ ] }) }), O = !i && n.length === 0 ? /* @__PURE__ */ t(Tt, { illustration: /* @__PURE__ */ t(ze, { size: 64 }), title: a.emptyTitle, description: a.emptyDescription, action: G("outlined") }) : void 0, oe = () => i ? /* @__PURE__ */ t(dt, { colSpan: mt, illustration: /* @__PURE__ */ t(le, { component: "span", sx: {
345
+ color: "error.main"
346
+ }, children: /* @__PURE__ */ t(ke, { size: 64 }) }), title: a.errorTitle, description: i instanceof Error ? i.message : a.errorFallback }) : /* @__PURE__ */ t(dt, { colSpan: mt, illustration: /* @__PURE__ */ t(ze, { size: 64 }), title: a.searchEmptyTitle, description: a.searchEmptyDescription });
347
+ return /* @__PURE__ */ t(
348
+ Ln,
349
+ {
350
+ title: u ? a.title : void 0,
351
+ toolbar: k,
352
+ showToolbar: n.length > 0,
353
+ tableHeader: V,
354
+ isLoading: e,
355
+ hasRows: x.length > 0,
356
+ emptyState: oe(),
357
+ standaloneEmptyState: O,
358
+ pagination: /* @__PURE__ */ t(Ot, { rowsPerPageOptions: wn, component: "div", count: w, rowsPerPage: L, page: A, onPageChange: (T, $) => N($), onRowsPerPageChange: (T) => {
359
+ z(parseInt(T.target.value, 10)), N(0);
360
+ } }),
361
+ children: D.map((T) => /* @__PURE__ */ m(U.Row, { hover: !0, clickable: !0, onClick: () => b(o(T.uuid)), children: [
362
+ /* @__PURE__ */ t(U.Cell, { children: /* @__PURE__ */ t(j, { variant: "body2", children: T.name }) }),
363
+ /* @__PURE__ */ t(U.Cell, { children: T.createdAt ? Et(new Date(T.createdAt), {
364
+ addSuffix: !0
365
+ }) : "-" }),
366
+ /* @__PURE__ */ t(U.Cell, { align: "right", children: /* @__PURE__ */ t(Ne, { title: a.removeTooltip, children: /* @__PURE__ */ t(He, { color: "error", size: "small", disabled: d, onClick: ($) => {
367
+ $.stopPropagation(), _(T);
368
+ }, "aria-label": a.removeAriaLabel(T), children: /* @__PURE__ */ t(st, { size: 16 }) }) }) })
369
+ ] }, T.uuid))
370
+ }
371
+ );
372
+ }
373
+ function Rt(n) {
374
+ const e = fe(13), {
375
+ value: i,
376
+ onChange: a,
377
+ description: c,
378
+ placeholder: r
379
+ } = n;
380
+ let o;
381
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ t(re.Subheader, { children: "Configuration Name" }), e[0] = o) : o = e[0];
382
+ let s;
383
+ e[1] === Symbol.for("react.memo_cache_sentinel") ? (s = {
384
+ mb: 2
385
+ }, e[1] = s) : s = e[1];
386
+ let d;
387
+ e[2] !== c ? (d = /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", sx: s, children: c }), e[2] = c, e[3] = d) : d = e[3];
388
+ let u;
389
+ e[4] !== a ? (u = (f) => a(f.target.value), e[4] = a, e[5] = u) : u = e[5];
390
+ let g;
391
+ e[6] !== r || e[7] !== u || e[8] !== i ? (g = /* @__PURE__ */ t(Pe, { label: "Name", value: i, onChange: u, placeholder: r, fullWidth: !0 }), e[6] = r, e[7] = u, e[8] = i, e[9] = g) : g = e[9];
392
+ let h;
393
+ return e[10] !== d || e[11] !== g ? (h = /* @__PURE__ */ m(re.Section, { children: [
394
+ o,
395
+ d,
396
+ g
397
+ ] }), e[10] = d, e[11] = g, e[12] = h) : h = e[12], h;
398
+ }
399
+ function Xe(n) {
400
+ const e = fe(31), {
401
+ server: i,
402
+ isSelected: a,
403
+ hideCheckbox: c
404
+ } = n;
405
+ if (!i)
406
+ return null;
407
+ const r = c ? 36 : 32;
408
+ let o;
409
+ e[0] !== c || e[1] !== a ? (o = !c && /* @__PURE__ */ t(Zt, { selected: a }), e[0] = c, e[1] = a, e[2] = o) : o = e[2];
410
+ let s;
411
+ e[3] !== r || e[4] !== c ? (s = c && /* @__PURE__ */ t(Je, { sx: {
412
+ height: r,
413
+ width: r,
414
+ backgroundColor: "action.selected"
415
+ }, children: /* @__PURE__ */ t(le, { sx: {
416
+ color: "text.secondary",
417
+ display: "inline-flex"
418
+ }, children: /* @__PURE__ */ t(xn, { size: 20 }) }) }), e[3] = r, e[4] = c, e[5] = s) : s = e[5];
419
+ let d;
420
+ e[6] === Symbol.for("react.memo_cache_sentinel") ? (d = {
421
+ minWidth: 0
422
+ }, e[6] = d) : d = e[6];
423
+ let u;
424
+ e[7] !== r ? (u = {
425
+ minHeight: r
426
+ }, e[7] = r, e[8] = u) : u = e[8];
427
+ let g;
428
+ e[9] !== i.name ? (g = /* @__PURE__ */ t(j, { variant: "h6", children: i.name }), e[9] = i.name, e[10] = g) : g = e[10];
429
+ let h;
430
+ e[11] !== u || e[12] !== g ? (h = /* @__PURE__ */ t(F, { direction: "row", alignItems: "center", sx: u, children: g }), e[11] = u, e[12] = g, e[13] = h) : h = e[13];
431
+ let f;
432
+ e[14] !== i.description ? (f = i.description && /* @__PURE__ */ t(j, { variant: "caption", color: "text.secondary", children: i.description }), e[14] = i.description, e[15] = f) : f = e[15];
433
+ let b;
434
+ e[16] !== i.context ? (b = i.context && /* @__PURE__ */ m(j, { variant: "caption", color: "text.secondary", children: [
435
+ "Context: ",
436
+ i.context
437
+ ] }), e[16] = i.context, e[17] = b) : b = e[17];
438
+ let y;
439
+ e[18] !== i.version ? (y = i.version && /* @__PURE__ */ m(j, { variant: "caption", color: "text.secondary", children: [
440
+ "Version: ",
441
+ i.version
442
+ ] }), e[18] = i.version, e[19] = y) : y = e[19];
443
+ let v;
444
+ e[20] !== b || e[21] !== y ? (v = /* @__PURE__ */ m(F, { direction: "row", spacing: 2, flexWrap: "wrap", children: [
445
+ b,
446
+ y
447
+ ] }), e[20] = b, e[21] = y, e[22] = v) : v = e[22];
448
+ let C;
449
+ e[23] !== v || e[24] !== h || e[25] !== f ? (C = /* @__PURE__ */ m(F, { spacing: 0.25, flexGrow: 1, sx: d, children: [
450
+ h,
451
+ f,
452
+ v
453
+ ] }), e[23] = v, e[24] = h, e[25] = f, e[26] = C) : C = e[26];
454
+ let p;
455
+ return e[27] !== o || e[28] !== C || e[29] !== s ? (p = /* @__PURE__ */ m(F, { direction: "row", spacing: 2, flexGrow: 1, alignItems: "flex-start", children: [
456
+ o,
457
+ s,
458
+ C
459
+ ] }), e[27] = o, e[28] = C, e[29] = s, e[30] = p) : p = e[30], p;
460
+ }
461
+ const We = ["url", "apikey"];
462
+ function _e(n) {
463
+ let e = n.replace(/[^A-Za-z0-9_]/g, "_").toUpperCase();
464
+ return e.length > 0 && e[0] >= "0" && e[0] <= "9" && (e = "_" + e), {
465
+ url: e ? `${e}_URL` : "URL",
466
+ apikey: e ? `${e}_API_KEY` : "API_KEY"
467
+ };
468
+ }
469
+ function zt(n, e, i) {
470
+ const a = (n || e).replace(/[^A-Za-z0-9-]/g, "-").toLowerCase();
471
+ if (!i.includes(a)) return a;
472
+ let c = 2;
473
+ for (; i.includes(`${a}-${c}`); ) c++;
474
+ return `${a}-${c}`;
475
+ }
476
+ const kn = {
477
+ url: "Base URL of the MCP server endpoint",
478
+ apikey: "API key for authenticating with the MCP server endpoint"
479
+ };
480
+ function In({
481
+ open: n,
482
+ orgId: e,
483
+ projectId: i,
484
+ agentId: a,
485
+ onClose: c
486
+ }) {
487
+ const r = De(), {
488
+ data: o
489
+ } = Ye({
490
+ orgName: e,
491
+ projName: i,
492
+ agentName: a
493
+ }), s = o?.provisioning?.type === "external", {
494
+ environments: d,
495
+ isLoading: u
496
+ } = tt(e, i), {
497
+ data: g,
498
+ isLoading: h
499
+ } = Pt({
500
+ orgName: e
501
+ }, {
502
+ limit: 50,
503
+ offset: 0
504
+ }), {
505
+ data: f
506
+ } = xt({
507
+ orgName: e,
508
+ projName: i,
509
+ agentName: a
510
+ }, {
511
+ limit: 1e3,
512
+ offset: 0
513
+ }), b = ee(() => g?.list ?? [], [g]), [y, v] = X(null), [C, p] = X(""), [N, L] = X(""), z = Te(!1), [E, x] = X(() => _e("")), w = Te(!1), I = Jt();
514
+ Se(() => {
515
+ n && (v(null), p(""), z.current = !1, w.current = !1, L(""), x(_e("")));
516
+ }, [n]);
517
+ const A = ee(() => b.find((k) => k.id === y) ?? null, [b, y]), D = ee(() => {
518
+ const k = C.trim().toLowerCase();
519
+ return k ? b.filter((V) => (V.name ?? "").toLowerCase().includes(k) || (V.description ?? "").toLowerCase().includes(k) || (V.context ?? "").toLowerCase().includes(k)) : b;
520
+ }, [b, C]);
521
+ Se(() => {
522
+ w.current || x(_e(y ?? ""));
523
+ }, [y]);
524
+ const K = ee(() => {
525
+ if (!y) return "";
526
+ const k = A?.name ?? y, V = (f?.configs ?? []).map((W) => W.name);
527
+ return zt(k, "mcp", V);
528
+ }, [y, A, f]);
529
+ Se(() => {
530
+ z.current || L(K);
531
+ }, [K]);
532
+ const _ = Le(() => {
533
+ if (!e || !i || !a || !y) return;
534
+ const k = {};
535
+ for (const O of d)
536
+ k[O.name] = {
537
+ proxyId: y,
538
+ configuration: {}
539
+ };
540
+ const V = s ? [] : We.map((O) => ({
541
+ key: O,
542
+ name: (E[O] ?? "").trim()
543
+ })).filter((O) => O.name.length > 0), W = N.trim() || K;
544
+ I.mutate({
545
+ params: {
546
+ orgName: e,
547
+ projName: i,
548
+ agentName: a
549
+ },
550
+ body: {
551
+ name: W,
552
+ type: "mcp",
553
+ envMappings: k,
554
+ environmentVariables: V.length > 0 ? V : void 0
555
+ }
556
+ }, {
557
+ onSuccess: () => c()
558
+ });
559
+ }, [e, i, a, y, d, s, E, N, K, I, c]), G = !!y && !I.isPending && !u && d.length > 0;
560
+ return /* @__PURE__ */ m(Ve, { open: n, onClose: c, minWidth: 740, children: [
561
+ /* @__PURE__ */ t(je, { icon: /* @__PURE__ */ t(ze, { size: 24 }), title: "Add Tool Configuration", onClose: c }),
562
+ /* @__PURE__ */ t(Ke, { children: /* @__PURE__ */ m(F, { spacing: 3, children: [
563
+ I.isError ? /* @__PURE__ */ t(he, { severity: "error", icon: /* @__PURE__ */ t(ke, { size: 18 }), onClose: I.reset, children: String(I.error instanceof Error ? I.error.message : "Failed to create MCP configuration. Please try again.") }) : null,
564
+ y ? (
565
+ /* Step 2 — the same drawer shows the selection + configuration. */
566
+ /* @__PURE__ */ m(F, { spacing: 3, children: [
567
+ /* @__PURE__ */ m(re.Section, { children: [
568
+ /* @__PURE__ */ t(re.Subheader, { children: "MCP Server" }),
569
+ /* @__PURE__ */ m(re.CardButton, { onClick: () => v(null), selected: !0, "aria-label": `Selected: ${A?.name}. Click to change.`, sx: {
570
+ position: "relative"
571
+ }, children: [
572
+ /* @__PURE__ */ t(Ne, { title: "Change MCP server", placement: "top", arrow: !0, children: /* @__PURE__ */ t(le, { sx: {
573
+ position: "absolute",
574
+ top: 8,
575
+ right: 8,
576
+ display: "inline-flex",
577
+ color: "text.secondary"
578
+ }, children: /* @__PURE__ */ t(it, { size: 16 }) }) }),
579
+ /* @__PURE__ */ t(re.CardContent, { children: /* @__PURE__ */ t(Xe, { server: A, isSelected: !1, hideCheckbox: !0 }) })
580
+ ] })
581
+ ] }),
582
+ /* @__PURE__ */ t(Rt, { value: N, onChange: (k) => {
583
+ z.current = !0, L(k);
584
+ }, description: "A name for this MCP configuration.", placeholder: "my-mcp-configuration" }),
585
+ s ? null : /* @__PURE__ */ m(re.Section, { children: [
586
+ /* @__PURE__ */ t(re.Subheader, { children: "Environment Variable Names" }),
587
+ /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", sx: {
588
+ mb: 2
589
+ }, children: "These names are shared across all environments. The platform injects the MCP server URL and API key values at runtime per environment (empty in environments the proxy is not configured for). Edit only if your code uses different names." }),
590
+ /* @__PURE__ */ t(U.Container, { children: /* @__PURE__ */ m(U, { density: "compact", children: [
591
+ /* @__PURE__ */ t(U.Head, { children: /* @__PURE__ */ m(U.Row, { children: [
592
+ /* @__PURE__ */ m(U.Cell, { children: [
593
+ "Variable Name",
594
+ " ",
595
+ /* @__PURE__ */ t(j, { component: "span", variant: "caption", color: "text.secondary", children: "(editable)" })
596
+ ] }),
597
+ /* @__PURE__ */ t(U.Cell, { children: "Description" })
598
+ ] }) }),
599
+ /* @__PURE__ */ t(U.Body, { children: We.map((k) => /* @__PURE__ */ m(U.Row, { children: [
600
+ /* @__PURE__ */ t(U.Cell, { children: /* @__PURE__ */ t(Pe, { value: E[k] ?? "", onChange: (V) => {
601
+ w.current = !0, x((W) => ({
602
+ ...W,
603
+ [k]: V.target.value
604
+ }));
605
+ }, copyable: !0, copyTooltipText: `Copy ${E[k] || k}`, size: "small" }) }),
606
+ /* @__PURE__ */ t(U.Cell, { children: /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", children: kn[k] }) })
607
+ ] }, k)) })
608
+ ] }) })
609
+ ] })
610
+ ] })
611
+ ) : (
612
+ /* Step 1 — pick an MCP server from the list. */
613
+ /* @__PURE__ */ m(F, { spacing: 1, children: [
614
+ /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", sx: {
615
+ mb: 1
616
+ }, children: "Choose the MCP server for this agent." }),
617
+ /* @__PURE__ */ t(Ct, { placeholder: "Search MCP servers", size: "small", fullWidth: !0, value: C, onChange: (k) => p(k.target.value), sx: {
618
+ mb: 1
619
+ } }),
620
+ /* @__PURE__ */ t(F, { spacing: 1, sx: {
621
+ overflowY: "auto"
622
+ }, children: h ? Array.from({
623
+ length: 3
624
+ }).map((k, V) => /* @__PURE__ */ t(be, { variant: "rounded", height: 72 }, V)) : b.length === 0 ? /* @__PURE__ */ t(U.Container, { children: /* @__PURE__ */ t(U.EmptyState, { illustration: /* @__PURE__ */ t(ze, { size: 64 }), title: "No MCP servers available", description: "No MCP servers found. Add MCP servers from the organization MCP Proxies page first.", action: e ? /* @__PURE__ */ t(ue, { variant: "contained", size: "small", startIcon: /* @__PURE__ */ t(Oe, { size: 16 }), onClick: () => r(xe(Ie.children.org.children.mcpProxies.children.add.path, {
625
+ orgId: e
626
+ })), children: "Add MCP Server" }) : void 0 }) }) : D.length === 0 ? /* @__PURE__ */ t(U.Container, { children: /* @__PURE__ */ t(U.EmptyState, { illustration: /* @__PURE__ */ t(nt, { size: 64 }), title: "No MCP servers match your search", description: "Try a different keyword or clear the search filter." }) }) : D.map((k) => /* @__PURE__ */ t(re.CardButton, { selected: !1, onClick: () => v(k.id ?? null), "aria-label": `${k.name}. Click to select`, children: /* @__PURE__ */ t(re.CardContent, { children: /* @__PURE__ */ t(Xe, { server: k, isSelected: !1 }) }) }, k.id)) })
627
+ ] })
628
+ ),
629
+ /* @__PURE__ */ m(le, { sx: {
630
+ display: "flex",
631
+ gap: 1,
632
+ justifyContent: "flex-end"
633
+ }, children: [
634
+ /* @__PURE__ */ t(ue, { variant: "outlined", onClick: c, children: "Cancel" }),
635
+ /* @__PURE__ */ t(ue, { variant: "contained", onClick: _, disabled: !G, children: I.isPending ? "Saving..." : "Save" })
636
+ ] })
637
+ ] }) })
638
+ ] });
639
+ }
640
+ const Qe = Ie.children.org.children.projects.children.agents.children.configure.children, pt = {
641
+ title: "LLM Configurations",
642
+ searchPlaceholder: "Search LLM configurations...",
643
+ addButtonLabel: "Add LLM Configuration",
644
+ emptyTitle: "No LLM configurations added yet",
645
+ emptyDescription: "Click Add LLM Configuration to connect a service provider.",
646
+ errorTitle: "Failed to load LLM configurations",
647
+ errorFallback: "Failed to load LLM configurations. Please try again.",
648
+ searchEmptyTitle: "No LLM configurations match your search",
649
+ searchEmptyDescription: "Try adjusting your search keywords.",
650
+ removeTitle: "Remove LLM Configuration",
651
+ removeTooltip: "Remove LLM configuration",
652
+ removeConfirmation: () => "This will remove the LLM configuration and its environment variable mappings from the agent. The catalog service itself will not be affected.",
653
+ removeAriaLabel: (n) => `Remove configuration ${n.name || n.uuid}`
654
+ }, ht = {
655
+ title: "Tool Configurations",
656
+ searchPlaceholder: "Search by name or description...",
657
+ addButtonLabel: "Add Tool Configuration",
658
+ emptyTitle: "No tool configurations added yet",
659
+ emptyDescription: "Add tool configurations that this agent can use.",
660
+ errorTitle: "Failed to load tool configurations",
661
+ errorFallback: "Failed to load tool configurations. Please try again.",
662
+ searchEmptyTitle: "No tool configurations match your search criteria",
663
+ searchEmptyDescription: "Try adjusting your search keywords.",
664
+ removeTitle: "Remove Tool Configuration",
665
+ removeTooltip: "Remove tool configuration",
666
+ removeConfirmation: (n) => `Are you sure you want to remove "${n.name}" from this agent?`,
667
+ removeAriaLabel: (n) => `Remove ${n.name}`
668
+ };
669
+ function ft(n) {
670
+ const e = fe(4), {
671
+ value: i,
672
+ index: a,
673
+ children: c
674
+ } = n, r = i !== a;
675
+ let o;
676
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (o = {
677
+ px: 3,
678
+ py: 3
679
+ }, e[0] = o) : o = e[0];
680
+ const s = i === a ? c : null;
681
+ let d;
682
+ return e[1] !== r || e[2] !== s ? (d = /* @__PURE__ */ t(le, { role: "tabpanel", hidden: r, sx: o, children: s }), e[1] = r, e[2] = s, e[3] = d) : d = e[3], d;
683
+ }
684
+ const An = () => {
685
+ const n = fe(78), [e, i] = X(0), [a, c] = X(!1), {
686
+ orgId: r,
687
+ projectId: o,
688
+ agentId: s
689
+ } = Ee();
690
+ let d;
691
+ n[0] !== s || n[1] !== r || n[2] !== o ? (d = {
692
+ orgName: r,
693
+ projName: o,
694
+ agentName: s
695
+ }, n[0] = s, n[1] = r, n[2] = o, n[3] = d) : d = n[3];
696
+ let u;
697
+ n[4] === Symbol.for("react.memo_cache_sentinel") ? (u = {
698
+ limit: 1e3,
699
+ offset: 0
700
+ }, n[4] = u) : u = n[4];
701
+ const {
702
+ data: g,
703
+ isLoading: h,
704
+ error: f
705
+ } = Nt(d, u);
706
+ let b;
707
+ n[5] !== s || n[6] !== r || n[7] !== o ? (b = {
708
+ orgName: r,
709
+ projName: o,
710
+ agentName: s
711
+ }, n[5] = s, n[6] = r, n[7] = o, n[8] = b) : b = n[8];
712
+ let y;
713
+ n[9] === Symbol.for("react.memo_cache_sentinel") ? (y = {
714
+ limit: 1e3,
715
+ offset: 0
716
+ }, n[9] = y) : y = n[9];
717
+ const {
718
+ data: v,
719
+ isLoading: C,
720
+ error: p
721
+ } = xt(b, y), {
722
+ mutate: N,
723
+ isPending: L
724
+ } = Xt(), {
725
+ mutate: z,
726
+ isPending: E
727
+ } = en();
728
+ let x;
729
+ n[10] !== g?.configs ? (x = g?.configs ?? [], n[10] = g?.configs, n[11] = x) : x = n[11];
730
+ const w = x;
731
+ let I;
732
+ n[12] !== v?.configs ? (I = v?.configs ?? [], n[12] = v?.configs, n[13] = I) : I = n[13];
733
+ const A = I, D = !!(r && o && s);
734
+ let K;
735
+ n[14] !== s || n[15] !== r || n[16] !== o ? (K = {
736
+ orgName: r,
737
+ projName: o,
738
+ agentName: s
739
+ }, n[14] = s, n[15] = r, n[16] = o, n[17] = K) : K = n[17];
740
+ const _ = K;
741
+ let G;
742
+ n[18] !== s || n[19] !== D || n[20] !== r || n[21] !== o ? (G = D ? xe(Qe.llmProviders.children.add.path, {
743
+ orgId: r,
744
+ projectId: o,
745
+ agentId: s
746
+ }) : "#", n[18] = s, n[19] = D, n[20] = r, n[21] = o, n[22] = G) : G = n[22];
747
+ const k = G;
748
+ let V;
749
+ n[23] !== s || n[24] !== D || n[25] !== r || n[26] !== o ? (V = (me) => D ? xe(Qe.llmProviders.children.view.path, {
750
+ orgId: r,
751
+ projectId: o,
752
+ agentId: s,
753
+ configId: encodeURIComponent(me)
754
+ }) : "#", n[23] = s, n[24] = D, n[25] = r, n[26] = o, n[27] = V) : V = n[27];
755
+ const W = V;
756
+ let O;
757
+ n[28] !== s || n[29] !== D || n[30] !== r || n[31] !== o ? (O = (me) => D ? xe(Qe.mcpProxies.children.view.path, {
758
+ orgId: r,
759
+ projectId: o,
760
+ agentId: s,
761
+ proxyId: encodeURIComponent(me)
762
+ }) : "#", n[28] = s, n[29] = D, n[30] = r, n[31] = o, n[32] = O) : O = n[32];
763
+ const oe = O;
764
+ let T;
765
+ n[33] === Symbol.for("react.memo_cache_sentinel") ? (T = (me, S) => i(S), n[33] = T) : T = n[33];
766
+ let $, Y;
767
+ n[34] === Symbol.for("react.memo_cache_sentinel") ? ($ = /* @__PURE__ */ t(Ue, { label: pt.title }), Y = /* @__PURE__ */ t(Ue, { label: ht.title }), n[34] = $, n[35] = Y) : ($ = n[34], Y = n[35]);
768
+ let J;
769
+ n[36] !== e ? (J = /* @__PURE__ */ m(et, { value: e, onChange: T, variant: "scrollable", allowScrollButtonsMobile: !0, children: [
770
+ $,
771
+ Y
772
+ ] }), n[36] = e, n[37] = J) : J = n[37];
773
+ let se;
774
+ n[38] === Symbol.for("react.memo_cache_sentinel") ? (se = /* @__PURE__ */ t(qe, {}), n[38] = se) : se = n[38];
775
+ let ne;
776
+ n[39] !== N || n[40] !== _ ? (ne = (me) => N({
777
+ ..._,
778
+ configId: me
779
+ }), n[39] = N, n[40] = _, n[41] = ne) : ne = n[41];
780
+ let Q;
781
+ n[42] !== W || n[43] !== h || n[44] !== L || n[45] !== k || n[46] !== w || n[47] !== f || n[48] !== ne ? (Q = /* @__PURE__ */ t(ut, { configs: w, isLoading: h, error: f, labels: pt, addPath: k, getViewPath: W, isRemoving: L, showTitle: !1, onRemove: ne }), n[42] = W, n[43] = h, n[44] = L, n[45] = k, n[46] = w, n[47] = f, n[48] = ne, n[49] = Q) : Q = n[49];
782
+ let Z;
783
+ n[50] !== Q || n[51] !== e ? (Z = /* @__PURE__ */ t(ft, { value: e, index: 0, children: Q }), n[50] = Q, n[51] = e, n[52] = Z) : Z = n[52];
784
+ let ye;
785
+ n[53] === Symbol.for("react.memo_cache_sentinel") ? (ye = () => c(!0), n[53] = ye) : ye = n[53];
786
+ let ce;
787
+ n[54] !== z || n[55] !== _ ? (ce = (me) => z({
788
+ ..._,
789
+ configId: me
790
+ }), n[54] = z, n[55] = _, n[56] = ce) : ce = n[56];
791
+ let ie;
792
+ n[57] !== oe || n[58] !== C || n[59] !== E || n[60] !== A || n[61] !== p || n[62] !== ce ? (ie = /* @__PURE__ */ t(ut, { configs: A, isLoading: C, error: p, labels: ht, onAdd: ye, getViewPath: oe, isRemoving: E, showTitle: !1, onRemove: ce }), n[57] = oe, n[58] = C, n[59] = E, n[60] = A, n[61] = p, n[62] = ce, n[63] = ie) : ie = n[63];
793
+ let ge;
794
+ n[64] === Symbol.for("react.memo_cache_sentinel") ? (ge = () => c(!1), n[64] = ge) : ge = n[64];
795
+ let M;
796
+ n[65] !== s || n[66] !== a || n[67] !== r || n[68] !== o ? (M = /* @__PURE__ */ t(In, { open: a, orgId: r, projectId: o, agentId: s, onClose: ge }), n[65] = s, n[66] = a, n[67] = r, n[68] = o, n[69] = M) : M = n[69];
797
+ let q;
798
+ n[70] !== ie || n[71] !== M || n[72] !== e ? (q = /* @__PURE__ */ m(ft, { value: e, index: 1, children: [
799
+ ie,
800
+ M
801
+ ] }), n[70] = ie, n[71] = M, n[72] = e, n[73] = q) : q = n[73];
802
+ let ae;
803
+ return n[74] !== J || n[75] !== Z || n[76] !== q ? (ae = /* @__PURE__ */ t(we, { title: "Configure Agent", disableIcon: !0, children: /* @__PURE__ */ m(Be, { variant: "outlined", children: [
804
+ J,
805
+ se,
806
+ Z,
807
+ q
808
+ ] }) }), n[74] = J, n[75] = Z, n[76] = q, n[77] = ae) : ae = n[77], ae;
809
+ }, $t = (n) => {
810
+ const e = fe(62), {
811
+ open: i,
812
+ onClose: a,
813
+ providers: c,
814
+ templateMap: r,
815
+ selectedUuid: o,
816
+ subtitle: s,
817
+ onSelect: d
818
+ } = n, {
819
+ orgId: u
820
+ } = Ee(), [g, h] = X(""), [f, b] = X(""), y = Te(null);
821
+ let v;
822
+ e[0] !== u ? (v = u ? xe(Ie.children.org.children.llmProviders.children.add.path, {
823
+ orgId: u
824
+ }) : null, e[0] = u, e[1] = v) : v = e[1];
825
+ const C = v;
826
+ let p, N, L, z, E, x, w, I, A, D, K, _, G, k;
827
+ if (e[2] !== f || e[3] !== a || e[4] !== d || e[5] !== i || e[6] !== c || e[7] !== g || e[8] !== o || e[9] !== s || e[10] !== r) {
828
+ let $;
829
+ e[25] !== f || e[26] !== r ? ($ = (Q) => {
830
+ if (!f.trim())
831
+ return !0;
832
+ const Z = f.toLowerCase();
833
+ return Q.name.toLowerCase().includes(Z) || (Q.template ?? "").toLowerCase().includes(Z) || (r.get(Q.template ?? "")?.displayName ?? "").toLowerCase().includes(Z);
834
+ }, e[25] = f, e[26] = r, e[27] = $) : $ = e[27];
835
+ const Y = c.filter($);
836
+ z = Ve, _ = i, G = a, k = 740, E = 740;
837
+ let J;
838
+ e[28] === Symbol.for("react.memo_cache_sentinel") ? (J = /* @__PURE__ */ t(Oe, { size: 24 }), e[28] = J) : J = e[28], e[29] !== a ? (x = /* @__PURE__ */ t(je, { icon: J, title: "Select LLM Service", onClose: a }), e[29] = a, e[30] = x) : x = e[30], L = Ke, N = F, e[31] !== s ? (D = s && /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", sx: {
839
+ mb: 1
840
+ }, children: s }), e[31] = s, e[32] = D) : D = e[32];
841
+ let se, ne;
842
+ e[33] === Symbol.for("react.memo_cache_sentinel") ? (se = (Q) => {
843
+ const Z = Q.target.value;
844
+ h(Z), y.current && clearTimeout(y.current), y.current = setTimeout(() => b(Z), 250);
845
+ }, ne = {
846
+ mb: 1
847
+ }, e[33] = se, e[34] = ne) : (se = e[33], ne = e[34]), e[35] !== g ? (K = /* @__PURE__ */ t(Ct, { placeholder: "Search providers", size: "small", fullWidth: !0, value: g, onChange: se, sx: ne }), e[35] = g, e[36] = K) : K = e[36], p = F, w = 1, e[37] === Symbol.for("react.memo_cache_sentinel") ? (I = {
848
+ flex: 1,
849
+ overflowY: "auto"
850
+ }, e[37] = I) : I = e[37], A = Y.length === 0 ? /* @__PURE__ */ t(U.Container, { children: /* @__PURE__ */ t(U.EmptyState, { illustration: /* @__PURE__ */ t(nt, { size: 64 }), title: f.trim() ? "No service providers match your search" : "No service providers available", description: f.trim() ? "Try a different keyword or clear the search filter." : "No service providers are available in the catalog." }) }) : Y.map((Q) => {
851
+ const Z = o === Q.uuid;
852
+ return /* @__PURE__ */ t(re.CardButton, { onClick: () => {
853
+ d(Q.uuid), a();
854
+ }, selected: Z, "aria-label": `${Q.name}. ${Z ? "Selected" : "Click to select"}`, children: /* @__PURE__ */ t(re.CardContent, { children: /* @__PURE__ */ t(rt, { provider: Q, isSelected: Z, templateInfo: r.get(Q.template ?? "") }) }) }, Q.uuid);
855
+ }), e[2] = f, e[3] = a, e[4] = d, e[5] = i, e[6] = c, e[7] = g, e[8] = o, e[9] = s, e[10] = r, e[11] = p, e[12] = N, e[13] = L, e[14] = z, e[15] = E, e[16] = x, e[17] = w, e[18] = I, e[19] = A, e[20] = D, e[21] = K, e[22] = _, e[23] = G, e[24] = k;
856
+ } else
857
+ p = e[11], N = e[12], L = e[13], z = e[14], E = e[15], x = e[16], w = e[17], I = e[18], A = e[19], D = e[20], K = e[21], _ = e[22], G = e[23], k = e[24];
858
+ let V;
859
+ e[38] !== p || e[39] !== w || e[40] !== I || e[41] !== A ? (V = /* @__PURE__ */ t(p, { spacing: w, sx: I, children: A }), e[38] = p, e[39] = w, e[40] = I, e[41] = A, e[42] = V) : V = e[42];
860
+ let W;
861
+ e[43] !== C ? (W = C && /* @__PURE__ */ m(Ae, { children: [
862
+ /* @__PURE__ */ t(qe, { sx: {
863
+ mt: 2
864
+ } }),
865
+ /* @__PURE__ */ m(le, { component: "a", href: C, target: "_blank", rel: "noopener noreferrer", sx: {
866
+ display: "flex",
867
+ alignItems: "center",
868
+ gap: 1,
869
+ pt: 1.5,
870
+ color: "primary.main",
871
+ textDecoration: "none",
872
+ cursor: "pointer",
873
+ "&:hover": {
874
+ textDecoration: "underline"
875
+ }
876
+ }, children: [
877
+ /* @__PURE__ */ t(Re, { size: 16 }),
878
+ /* @__PURE__ */ t(j, { variant: "body2", color: "primary", children: "Add LLM Provider" }),
879
+ /* @__PURE__ */ t(At, { size: 14 })
880
+ ] })
881
+ ] }), e[43] = C, e[44] = W) : W = e[44];
882
+ let O;
883
+ e[45] !== N || e[46] !== V || e[47] !== W || e[48] !== D || e[49] !== K ? (O = /* @__PURE__ */ m(N, { children: [
884
+ D,
885
+ K,
886
+ V,
887
+ W
888
+ ] }), e[45] = N, e[46] = V, e[47] = W, e[48] = D, e[49] = K, e[50] = O) : O = e[50];
889
+ let oe;
890
+ e[51] !== L || e[52] !== O ? (oe = /* @__PURE__ */ t(L, { children: O }), e[51] = L, e[52] = O, e[53] = oe) : oe = e[53];
891
+ let T;
892
+ return e[54] !== z || e[55] !== E || e[56] !== x || e[57] !== oe || e[58] !== _ || e[59] !== G || e[60] !== k ? (T = /* @__PURE__ */ m(z, { open: _, onClose: G, minWidth: k, maxWidth: E, children: [
893
+ x,
894
+ oe
895
+ ] }), e[54] = z, e[55] = E, e[56] = x, e[57] = oe, e[58] = _, e[59] = G, e[60] = k, e[61] = T) : T = e[61], T;
896
+ }, En = {
897
+ url: "Base URL of the LLM provider",
898
+ apikey: "API key for authenticating with the LLM provider"
899
+ };
900
+ function Mn(n) {
901
+ return n?.length ? [...n].sort((i, a) => new Date(a.deployedAt ?? 0).getTime() - new Date(i.deployedAt ?? 0).getTime())[0] ?? null : null;
902
+ }
903
+ function _n(n) {
904
+ return n < 0.01 ? `$${n.toFixed(6)}` : `$${n.toFixed(2)}`;
905
+ }
906
+ function Ze(n, e) {
907
+ if (!e) return "";
908
+ const a = {
909
+ minute: "min",
910
+ hour: "hr",
911
+ day: "day"
912
+ }[e.toLowerCase()] ?? e;
913
+ return n && n !== 1 ? `${n} ${a}` : a;
914
+ }
915
+ const Tn = (n) => {
916
+ const e = fe(21), {
917
+ rateLimiting: i
918
+ } = n;
919
+ if (!i) {
920
+ let v;
921
+ return e[0] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ m(j, { variant: "caption", color: "text.secondary", children: [
922
+ "Rate Limiting:",
923
+ " ",
924
+ /* @__PURE__ */ t(j, { component: "span", variant: "caption", color: "text.disabled", children: "Not configured" })
925
+ ] }), e[0] = v) : v = e[0], v;
926
+ }
927
+ const a = i.consumerLevel, c = i.providerLevel, r = a?.globalEnabled ?? !1, o = r && (a?.request != null || a?.token != null || a?.cost != null);
928
+ if (!r && !c?.globalEnabled) {
929
+ let v;
930
+ return e[1] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ m(j, { variant: "caption", color: "text.secondary", children: [
931
+ "Rate Limiting:",
932
+ " ",
933
+ /* @__PURE__ */ t(j, { component: "span", variant: "caption", color: "text.disabled", children: "Configured (disabled)" })
934
+ ] }), e[1] = v) : v = e[1], v;
935
+ }
936
+ const s = o ? a : c, d = !o;
937
+ let u;
938
+ if (e[2] !== s) {
939
+ if (u = [], s?.request) {
940
+ const v = Ze(s.request.resetDuration, s.request.resetUnit), C = `${s.request.limit.toLocaleString()}${v ? `/${v}` : ""}`;
941
+ let p;
942
+ e[4] !== C ? (p = {
943
+ label: "Requests",
944
+ value: C
945
+ }, e[4] = C, e[5] = p) : p = e[5], u.push(p);
946
+ }
947
+ if (s?.token) {
948
+ const v = Ze(s.token.resetDuration, s.token.resetUnit), C = `${s.token.limit.toLocaleString()}${v ? `/${v}` : ""}`;
949
+ let p;
950
+ e[6] !== C ? (p = {
951
+ label: "Tokens",
952
+ value: C
953
+ }, e[6] = C, e[7] = p) : p = e[7], u.push(p);
954
+ }
955
+ if (s?.cost) {
956
+ const v = Ze(s.cost.resetDuration, s.cost.resetUnit), C = `${_n(s.cost.limit)}${v ? `/${v}` : ""}`;
957
+ let p;
958
+ e[8] !== C ? (p = {
959
+ label: "Budget",
960
+ value: C
961
+ }, e[8] = C, e[9] = p) : p = e[9], u.push(p);
962
+ }
963
+ e[2] = s, e[3] = u;
964
+ } else
965
+ u = e[3];
966
+ const g = d ? "Your Quota (org-wide limit):" : "Your Quota:";
967
+ let h;
968
+ e[10] !== g ? (h = /* @__PURE__ */ t(j, { variant: "caption", color: "text.secondary", children: g }), e[10] = g, e[11] = h) : h = e[11];
969
+ let f;
970
+ e[12] !== d ? (f = d && /* @__PURE__ */ t(Ne, { title: "No per-consumer limit is configured. The org-wide provider limit applies to all consumers.", placement: "top", arrow: !0, children: /* @__PURE__ */ t(le, { component: "span", sx: {
971
+ display: "inline-flex",
972
+ alignItems: "center",
973
+ color: "text.secondary",
974
+ cursor: "default"
975
+ }, children: /* @__PURE__ */ t(bn, { size: 12 }) }) }), e[12] = d, e[13] = f) : f = e[13];
976
+ let b;
977
+ e[14] !== d || e[15] !== u ? (b = u.length > 0 ? /* @__PURE__ */ t(j, { variant: "caption", color: d ? "text.secondary" : "text.primary", sx: {
978
+ fontVariantNumeric: "tabular-nums"
979
+ }, children: u.map(Rn).join(" · ") }) : /* @__PURE__ */ t(j, { variant: "caption", color: "text.secondary", children: "Enabled (no numeric limits set)" }), e[14] = d, e[15] = u, e[16] = b) : b = e[16];
980
+ let y;
981
+ return e[17] !== h || e[18] !== f || e[19] !== b ? (y = /* @__PURE__ */ m(F, { direction: "row", spacing: 0.5, alignItems: "center", flexWrap: "wrap", useFlexGap: !0, children: [
982
+ h,
983
+ f,
984
+ b
985
+ ] }), e[17] = h, e[18] = f, e[19] = b, e[20] = y) : y = e[20], y;
986
+ }, rt = (n) => {
987
+ const e = fe(62), {
988
+ provider: i,
989
+ isSelected: a,
990
+ templateInfo: c,
991
+ fallbackLabel: r,
992
+ hideCheckbox: o
993
+ } = n, s = r === void 0 ? "Select provider" : r, d = i?.deployments;
994
+ let u, g, h, f, b, y, v, C, p, N, L, z, E;
995
+ if (e[0] !== s || e[1] !== o || e[2] !== a || e[3] !== i || e[4] !== d || e[5] !== c) {
996
+ const K = Mn(d), _ = o ? 36 : 32;
997
+ g = F, z = "row", E = 2, h = 1, f = "flex-start", e[19] !== _ || e[20] !== o || e[21] !== a ? (b = !o && /* @__PURE__ */ t(Je, { sx: {
998
+ height: _,
999
+ width: _,
1000
+ backgroundColor: a ? "primary.main" : "secondary.main",
1001
+ color: a ? "common.white" : "text.secondary"
1002
+ }, children: a ? /* @__PURE__ */ t(yn, { size: 16 }) : /* @__PURE__ */ t(Cn, { size: 16 }) }), e[19] = _, e[20] = o, e[21] = a, e[22] = b) : b = e[22], e[23] !== _ || e[24] !== o || e[25] !== c?.logoUrl ? (y = o && /* @__PURE__ */ t(Je, { src: c?.logoUrl, sx: {
1003
+ height: _,
1004
+ width: _,
1005
+ backgroundColor: "action.selected"
1006
+ }, children: /* @__PURE__ */ t(ze, { size: 16 }) }), e[23] = _, e[24] = o, e[25] = c?.logoUrl, e[26] = y) : y = e[26], u = F, v = 0.5, C = 1, e[27] === Symbol.for("react.memo_cache_sentinel") ? (p = {
1007
+ minWidth: 0
1008
+ }, e[27] = p) : p = e[27];
1009
+ let G;
1010
+ e[28] !== _ ? (G = {
1011
+ minHeight: _
1012
+ }, e[28] = _, e[29] = G) : G = e[29];
1013
+ const k = i?.name ?? s;
1014
+ let V;
1015
+ e[30] !== k ? (V = /* @__PURE__ */ t(j, { variant: "h4", children: k }), e[30] = k, e[31] = V) : V = e[31];
1016
+ let W;
1017
+ e[32] !== o || e[33] !== i || e[34] !== c ? (W = i?.template && /* @__PURE__ */ t(Ne, { title: "Service Provider template", placement: "top", arrow: !0, children: o ? /* @__PURE__ */ m(j, { variant: "caption", color: "text.disabled", children: [
1018
+ "| ",
1019
+ c?.displayName ?? i.template
1020
+ ] }) : /* @__PURE__ */ t(yt, { label: c?.displayName ?? i.template, size: "small", variant: "outlined", icon: c?.logoUrl ? /* @__PURE__ */ t(le, { component: "img", src: c.logoUrl, alt: c.displayName, sx: {
1021
+ width: 14,
1022
+ height: 14,
1023
+ borderRadius: "100%"
1024
+ } }) : void 0 }) }), e[32] = o, e[33] = i, e[34] = c, e[35] = W) : W = e[35], e[36] !== G || e[37] !== V || e[38] !== W ? (N = /* @__PURE__ */ m(F, { direction: "row", spacing: 0.75, alignItems: "center", flexWrap: "wrap", useFlexGap: !0, sx: G, children: [
1025
+ V,
1026
+ W
1027
+ ] }), e[36] = G, e[37] = V, e[38] = W, e[39] = N) : N = e[39], L = K?.deployedAt && /* @__PURE__ */ m(j, { variant: "caption", color: "text.secondary", children: [
1028
+ "Deployed",
1029
+ " ",
1030
+ Et(new Date(K.deployedAt), {
1031
+ addSuffix: !0
1032
+ })
1033
+ ] }), e[0] = s, e[1] = o, e[2] = a, e[3] = i, e[4] = d, e[5] = c, e[6] = u, e[7] = g, e[8] = h, e[9] = f, e[10] = b, e[11] = y, e[12] = v, e[13] = C, e[14] = p, e[15] = N, e[16] = L, e[17] = z, e[18] = E;
1034
+ } else
1035
+ u = e[6], g = e[7], h = e[8], f = e[9], b = e[10], y = e[11], v = e[12], C = e[13], p = e[14], N = e[15], L = e[16], z = e[17], E = e[18];
1036
+ const x = i?.rateLimiting;
1037
+ let w;
1038
+ e[40] !== x ? (w = /* @__PURE__ */ t(Tn, { rateLimiting: x }), e[40] = x, e[41] = w) : w = e[41];
1039
+ let I;
1040
+ e[42] !== i ? (I = /* @__PURE__ */ m(j, { variant: "caption", color: "text.secondary", children: [
1041
+ "Guardrails:",
1042
+ " ",
1043
+ i?.policies?.length ? /* @__PURE__ */ t(Ne, { title: i.policies.join(", "), placement: "top", arrow: !0, children: /* @__PURE__ */ m(j, { component: "span", variant: "caption", color: "text.primary", children: [
1044
+ i.policies.slice(0, 3).join(", "),
1045
+ i.policies.length > 3 && ` +${i.policies.length - 3} more`
1046
+ ] }) }) : /* @__PURE__ */ t(j, { component: "span", variant: "caption", color: "text.disabled", children: "None" })
1047
+ ] }), e[42] = i, e[43] = I) : I = e[43];
1048
+ let A;
1049
+ e[44] !== u || e[45] !== w || e[46] !== I || e[47] !== v || e[48] !== C || e[49] !== p || e[50] !== N || e[51] !== L ? (A = /* @__PURE__ */ m(u, { spacing: v, flexGrow: C, sx: p, children: [
1050
+ N,
1051
+ L,
1052
+ w,
1053
+ I
1054
+ ] }), e[44] = u, e[45] = w, e[46] = I, e[47] = v, e[48] = C, e[49] = p, e[50] = N, e[51] = L, e[52] = A) : A = e[52];
1055
+ let D;
1056
+ return e[53] !== g || e[54] !== h || e[55] !== f || e[56] !== b || e[57] !== y || e[58] !== A || e[59] !== z || e[60] !== E ? (D = /* @__PURE__ */ m(g, { direction: z, spacing: E, flexGrow: h, alignItems: f, children: [
1057
+ b,
1058
+ y,
1059
+ A
1060
+ ] }), e[53] = g, e[54] = h, e[55] = f, e[56] = b, e[57] = y, e[58] = A, e[59] = z, e[60] = E, e[61] = D) : D = e[61], D;
1061
+ }, ii = () => {
1062
+ const {
1063
+ orgId: n,
1064
+ projectId: e,
1065
+ agentId: i,
1066
+ configId: a
1067
+ } = Ee(), c = De(), r = !!a, [o, s] = X(0), [d, u] = X({}), [g, h] = X({}), [f, b] = X(() => _e("")), y = Te(!1), [v, C] = X(!1), [p, N] = X(""), L = Te(!1), z = n && e && i ? xe(Ie.children.org.children.projects.children.agents.children.configure.path, {
1068
+ orgId: n,
1069
+ projectId: e,
1070
+ agentId: i
1071
+ }) : "#", {
1072
+ data: E
1073
+ } = Ye({
1074
+ orgName: n,
1075
+ projName: e,
1076
+ agentName: i
1077
+ }), x = E?.provisioning?.type === "external", {
1078
+ environments: w,
1079
+ isLoading: I
1080
+ } = tt(n, e), {
1081
+ data: A
1082
+ } = Nt({
1083
+ orgName: n,
1084
+ projName: e,
1085
+ agentName: i
1086
+ }), D = w[o]?.id, {
1087
+ data: K
1088
+ } = Lt({
1089
+ orgName: n
1090
+ }, {
1091
+ limit: 50,
1092
+ environmentId: D
1093
+ }), {
1094
+ data: _
1095
+ } = St({
1096
+ orgName: n
1097
+ }), G = ee(() => {
1098
+ const S = /* @__PURE__ */ new Map();
1099
+ for (const l of _?.templates ?? [])
1100
+ S.set(l.name, {
1101
+ displayName: l.name,
1102
+ logoUrl: l.metadata?.logoUrl
1103
+ }), S.set(l.id, {
1104
+ displayName: l.name,
1105
+ logoUrl: l.metadata?.logoUrl
1106
+ });
1107
+ return S;
1108
+ }, [_]), k = ee(() => (K?.entries ?? []).map((S) => ({
1109
+ uuid: S.uuid,
1110
+ id: S.handle,
1111
+ name: S.name,
1112
+ version: S.version,
1113
+ template: S.template,
1114
+ deployments: S.deployments ?? [],
1115
+ security: S.security,
1116
+ rateLimiting: S.rateLimiting,
1117
+ policies: S.policies ?? []
1118
+ })), [K]), {
1119
+ data: V,
1120
+ isLoading: W,
1121
+ isError: O
1122
+ } = wt({
1123
+ orgName: n,
1124
+ projName: e,
1125
+ agentName: i,
1126
+ configId: a ?? void 0
1127
+ });
1128
+ Se(() => {
1129
+ if (!V || !r) return;
1130
+ const S = {};
1131
+ for (const [P, R] of Object.entries(V.envMappings ?? {})) {
1132
+ const B = R.configuration, H = B?.providerUuid ?? B?.proxyUuid ?? void 0;
1133
+ H && B?.providerName && (S[P] = {
1134
+ uuid: H,
1135
+ id: B.providerName
1136
+ });
1137
+ }
1138
+ u(S);
1139
+ const l = {};
1140
+ for (const [P, R] of Object.entries(V.envMappings ?? {})) {
1141
+ const B = R.configuration?.policies ?? [], H = /* @__PURE__ */ new Set(), te = [];
1142
+ for (const de of B) {
1143
+ const ve = `${de.name}@${de.version}`;
1144
+ if (H.has(ve)) continue;
1145
+ H.add(ve);
1146
+ const pe = de.paths?.[0]?.params;
1147
+ te.push({
1148
+ name: de.name,
1149
+ version: de.version,
1150
+ settings: pe ?? {}
1151
+ });
1152
+ }
1153
+ l[P] = te;
1154
+ }
1155
+ if (h(l), V.environmentVariables?.length) {
1156
+ const P = {};
1157
+ for (const R of V.environmentVariables)
1158
+ P[R.key] = R.name;
1159
+ b(P), y.current = !0;
1160
+ }
1161
+ V.name && (N(V.name), L.current = !0);
1162
+ }, [V, r]);
1163
+ const oe = ee(() => {
1164
+ const S = w[0]?.name, l = S ? d[S] : void 0;
1165
+ return l ? l.template ?? l.id ?? "" : "";
1166
+ }, [d, w]);
1167
+ Se(() => {
1168
+ r || y.current || b(_e(oe));
1169
+ }, [oe, r]);
1170
+ const T = ee(() => {
1171
+ const S = w.map((R) => d[R.name]).find(Boolean), l = S?.name ?? S?.template ?? S?.id ?? "";
1172
+ if (!l) return "";
1173
+ const P = (A?.configs ?? []).map((R) => R.name);
1174
+ return zt(l, "llm", P);
1175
+ }, [w, d, A]);
1176
+ Se(() => {
1177
+ r || L.current || N(T);
1178
+ }, [T, r]);
1179
+ const $ = ee(() => w[o]?.name ?? "", [w, o]), Y = tn(), J = kt(), se = ee(() => g[$] ?? [], [g, $]), ne = Le((S) => {
1180
+ h((l) => {
1181
+ const P = l[$] ?? [];
1182
+ return P.some((B) => B.name === S.name && B.version === S.version) ? l : {
1183
+ ...l,
1184
+ [$]: [...P, S]
1185
+ };
1186
+ });
1187
+ }, [$]), Q = Le((S) => {
1188
+ h((l) => {
1189
+ const R = (l[$] ?? []).map((B) => B.name === S.name && B.version === S.version ? S : B);
1190
+ return {
1191
+ ...l,
1192
+ [$]: R
1193
+ };
1194
+ });
1195
+ }, [$]), Z = Le((S, l) => {
1196
+ h((P) => {
1197
+ const B = (P[$] ?? []).filter((H) => !(H.name === S && H.version === l));
1198
+ return {
1199
+ ...P,
1200
+ [$]: B
1201
+ };
1202
+ });
1203
+ }, [$]), ye = Le(() => {
1204
+ const S = {};
1205
+ let l = !1;
1206
+ for (const te of w) {
1207
+ const de = d[te.name];
1208
+ if (!de) continue;
1209
+ l = !0;
1210
+ const pe = (g[te.name] ?? []).map((Ce) => ({
1211
+ name: Ce.name,
1212
+ version: Ce.version,
1213
+ paths: [{
1214
+ path: "/*",
1215
+ methods: ["*"],
1216
+ params: Ce.settings ?? {}
1217
+ }]
1218
+ }));
1219
+ S[te.name] = {
1220
+ providerName: de.id,
1221
+ configuration: {
1222
+ policies: pe.length > 0 ? pe : void 0
1223
+ }
1224
+ };
1225
+ }
1226
+ if (!l || !n || !e || !i)
1227
+ return;
1228
+ const P = x ? [] : We.map((te) => ({
1229
+ key: te,
1230
+ name: (f[te] ?? "").trim()
1231
+ })).filter((te) => te.name.length > 0), R = r ? V?.name ?? T : T, H = {
1232
+ name: p.trim() || R,
1233
+ envMappings: S,
1234
+ environmentVariables: P.length > 0 ? P : void 0
1235
+ };
1236
+ r && a ? J.mutate({
1237
+ params: {
1238
+ orgName: n,
1239
+ projName: e,
1240
+ agentName: i,
1241
+ configId: a
1242
+ },
1243
+ body: H
1244
+ }, {
1245
+ onSuccess: () => {
1246
+ c(z);
1247
+ }
1248
+ }) : Y.mutate({
1249
+ params: {
1250
+ orgName: n,
1251
+ projName: e,
1252
+ agentName: i
1253
+ },
1254
+ body: {
1255
+ ...H,
1256
+ type: "llm"
1257
+ }
1258
+ }, {
1259
+ onSuccess: (te) => {
1260
+ const de = {};
1261
+ for (const [ve, pe] of Object.entries(te.envMappings ?? {}))
1262
+ pe.configuration?.authInfo && (de[ve] = pe.configuration.authInfo);
1263
+ c(xe(Ie.children.org.children.projects.children.agents.children.configure.children.llmProviders.children.view.path, {
1264
+ orgId: n,
1265
+ projectId: e,
1266
+ agentId: i,
1267
+ configId: te.uuid
1268
+ }), {
1269
+ state: {
1270
+ authInfoByEnv: de
1271
+ }
1272
+ });
1273
+ }
1274
+ });
1275
+ }, [d, w, g, f, p, x, n, e, i, a, r, V, T, Y, J, c, z]), ce = (S) => !!d[S] || r && !!V?.envMappings?.[S]?.configuration?.providerName, ie = w.some((S) => ce(S.name)), ge = w.length > 0 && w.every((S) => ce(S.name)), M = ie, q = Y.isError ? Y.error : J.error, ae = Y.isPending || J.isPending, me = Le(() => {
1276
+ Y.reset(), J.reset();
1277
+ }, [Y, J]);
1278
+ return I || r && W ? /* @__PURE__ */ t(we, { title: r ? "Edit LLM Configuration" : "Add LLM Configuration", backHref: z, disableIcon: !0, backLabel: "Back to Configure", children: /* @__PURE__ */ m(F, { spacing: 2, children: [
1279
+ /* @__PURE__ */ t(be, { variant: "rounded", height: 56 }),
1280
+ /* @__PURE__ */ t(be, { variant: "rounded", height: 56 }),
1281
+ /* @__PURE__ */ t(be, { variant: "rounded", height: 120 })
1282
+ ] }) }) : r && !W && (O || !V) ? /* @__PURE__ */ t(we, { title: "Edit LLM Configuration", backHref: z, disableIcon: !0, backLabel: "Back to Configure", children: /* @__PURE__ */ t(he, { severity: "error", icon: /* @__PURE__ */ t(ke, { size: 18 }), children: "Config not found or failed to load." }) }) : /* @__PURE__ */ t(we, { title: r ? "Edit LLM Configuration" : "Add LLM Configuration", backHref: z, disableIcon: !0, backLabel: "Back to Configure", children: /* @__PURE__ */ m(F, { spacing: 3, children: [
1283
+ q ? /* @__PURE__ */ t(he, { severity: "error", icon: /* @__PURE__ */ t(ke, { size: 18 }), onClose: me, children: nn(q) || (r ? "Failed to update model config. Please try again." : "Failed to create model config. Please try again.") }) : null,
1284
+ /* @__PURE__ */ m(re.Section, { children: [
1285
+ /* @__PURE__ */ t(re.Subheader, { children: "LLM Service Provider" }),
1286
+ w.length > 1 && /* @__PURE__ */ m(Ae, { children: [
1287
+ /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", sx: {
1288
+ mb: 1
1289
+ }, children: "Select which LLM Service provider to use in each environment." }),
1290
+ /* @__PURE__ */ t(et, { value: o, onChange: (S, l) => s(l), sx: {
1291
+ borderBottom: 1,
1292
+ borderColor: "divider",
1293
+ mb: 2
1294
+ }, children: w.map((S, l) => {
1295
+ const P = ce(S.name);
1296
+ return /* @__PURE__ */ t(Ue, { label: /* @__PURE__ */ m(F, { direction: "row", spacing: 0.5, alignItems: "center", children: [
1297
+ /* @__PURE__ */ t("span", { children: S.displayName ?? S.name }),
1298
+ !P && /* @__PURE__ */ t(Ne, { title: "No provider selected", placement: "top", arrow: !0, children: /* @__PURE__ */ t(le, { component: "span", sx: {
1299
+ width: 8,
1300
+ height: 8,
1301
+ borderRadius: "50%",
1302
+ bgcolor: "warning.main",
1303
+ display: "inline-block"
1304
+ } }) })
1305
+ ] }), value: l }, S.name);
1306
+ }) })
1307
+ ] }),
1308
+ d[$] ? (() => {
1309
+ const S = d[$]?.uuid, l = k.find((P) => P.uuid === S) ?? null;
1310
+ return /* @__PURE__ */ m(re.CardButton, { onClick: () => C(!0), selected: !0, "aria-label": `Selected: ${l?.name ?? "Unknown"}. Click to change.`, sx: {
1311
+ position: "relative"
1312
+ }, children: [
1313
+ /* @__PURE__ */ t(Ne, { title: "Change provider", placement: "top", arrow: !0, children: /* @__PURE__ */ t(le, { sx: {
1314
+ position: "absolute",
1315
+ top: 8,
1316
+ right: 8,
1317
+ display: "inline-flex",
1318
+ color: "text.secondary"
1319
+ }, children: /* @__PURE__ */ t(it, { size: 16 }) }) }),
1320
+ /* @__PURE__ */ t(re.CardContent, { children: /* @__PURE__ */ t(rt, { provider: l, isSelected: !1, hideCheckbox: !0, templateInfo: G.get(l?.template ?? "") }) })
1321
+ ] });
1322
+ })() : /* @__PURE__ */ t(le, { children: K && k.length === 0 ? /* @__PURE__ */ t(U.Container, { children: /* @__PURE__ */ t(U.EmptyState, { illustration: /* @__PURE__ */ t(nt, { size: 64 }), title: "No service providers available", description: "No LLM service providers found in the catalog. Add LLM service providers from the organization LLM Service Providers page first.", action: n ? /* @__PURE__ */ t(ue, { variant: "contained", size: "small", startIcon: /* @__PURE__ */ t(Oe, { size: 16 }), onClick: () => c(xe(Ie.children.org.children.llmProviders.children.add.path, {
1323
+ orgId: n
1324
+ })), children: "Add LLM Service Provider" }) : void 0 }) }) : /* @__PURE__ */ m(le, { sx: {
1325
+ pt: 1
1326
+ }, children: [
1327
+ /* @__PURE__ */ t(ue, { variant: "outlined", onClick: () => C(!0), disabled: k.length === 0 || !$, startIcon: /* @__PURE__ */ t(Oe, { size: 16 }), children: "Select a Service Provider" }),
1328
+ /* @__PURE__ */ t(j, { variant: "caption", color: "text.secondary", sx: {
1329
+ display: "block",
1330
+ mt: 1
1331
+ }, children: "Selecting a provider will auto-generate environment variable names below." })
1332
+ ] }) }),
1333
+ /* @__PURE__ */ t($t, { open: v, onClose: () => C(!1), providers: k, templateMap: G, selectedUuid: d[$]?.uuid ?? void 0, subtitle: w.length > 1 ? `Choose the catalog provider for the ${w[o]?.displayName ?? w[o]?.name ?? ""} environment.` : "Choose the catalog provider for this agent.", onSelect: (S) => {
1334
+ if (!$) return;
1335
+ const l = k.find((P) => P.uuid === S);
1336
+ l && u((P) => ({
1337
+ ...P,
1338
+ [$]: {
1339
+ uuid: S,
1340
+ id: l.id,
1341
+ template: l.template,
1342
+ name: l.name
1343
+ }
1344
+ }));
1345
+ } }),
1346
+ d[$] && /* @__PURE__ */ t(Mt, { 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: se, onAdd: ne, onEdit: Q, onRemove: Z })
1347
+ ] }),
1348
+ ie && /* @__PURE__ */ t(Rt, { value: p, onChange: (S) => {
1349
+ L.current = !0, N(S);
1350
+ }, description: "A name for this LLM configuration.", placeholder: "my-llm-configuration" }),
1351
+ ie && !x && /* @__PURE__ */ m(re.Section, { children: [
1352
+ /* @__PURE__ */ t(re.Subheader, { children: "Environment Variable Names" }),
1353
+ /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", sx: {
1354
+ mb: 2
1355
+ }, children: "These names are shared across all environments. The platform injects the actual URL and API key values at runtime per environment. Edit only if your code uses different names." }),
1356
+ /* @__PURE__ */ t(U.Container, { children: /* @__PURE__ */ m(U, { density: "compact", children: [
1357
+ /* @__PURE__ */ t(U.Head, { children: /* @__PURE__ */ m(U.Row, { children: [
1358
+ /* @__PURE__ */ m(U.Cell, { children: [
1359
+ "Variable Name",
1360
+ " ",
1361
+ /* @__PURE__ */ t(j, { component: "span", variant: "caption", color: "text.secondary", children: "(editable)" })
1362
+ ] }),
1363
+ /* @__PURE__ */ t(U.Cell, { children: "Description" })
1364
+ ] }) }),
1365
+ /* @__PURE__ */ t(U.Body, { children: We.map((S) => /* @__PURE__ */ m(U.Row, { children: [
1366
+ /* @__PURE__ */ t(U.Cell, { children: /* @__PURE__ */ t(Pe, { value: f[S] ?? "", onChange: (l) => {
1367
+ y.current = !0, b((P) => ({
1368
+ ...P,
1369
+ [S]: l.target.value
1370
+ }));
1371
+ }, copyable: !0, copyTooltipText: `Copy ${f[S] ?? S}`, size: "small" }) }),
1372
+ /* @__PURE__ */ t(U.Cell, { children: /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", children: En[S] }) })
1373
+ ] }, S)) })
1374
+ ] }) })
1375
+ ] }),
1376
+ ie && !ge && /* @__PURE__ */ t(he, { severity: "info", icon: /* @__PURE__ */ t(ke, { size: 18 }), children: "Some environments don't have a provider selected. They will be skipped on save." }),
1377
+ /* @__PURE__ */ m(le, { sx: {
1378
+ display: "flex",
1379
+ gap: 1
1380
+ }, children: [
1381
+ /* @__PURE__ */ t(ue, { variant: "outlined", onClick: () => c(z), children: "Cancel" }),
1382
+ /* @__PURE__ */ t(Ne, { title: !M && !ae ? "Select a service provider for at least one environment to enable save" : "", placement: "top", children: /* @__PURE__ */ t("span", { children: /* @__PURE__ */ t(ue, { variant: "contained", onClick: ye, disabled: !M || ae, children: ae ? "Saving…" : "Save" }) }) })
1383
+ ] })
1384
+ ] }) });
1385
+ };
1386
+ function Rn(n) {
1387
+ return `${n.label}: ${n.value}`;
1388
+ }
1389
+ function zn(n) {
1390
+ const e = fe(10), {
1391
+ message: i,
1392
+ actionLabel: a,
1393
+ actionIcon: c,
1394
+ onAction: r,
1395
+ disabled: o
1396
+ } = n;
1397
+ let s;
1398
+ e[0] !== i ? (s = /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", children: i }), e[0] = i, e[1] = s) : s = e[1];
1399
+ let d;
1400
+ e[2] !== c || e[3] !== a || e[4] !== o || e[5] !== r ? (d = /* @__PURE__ */ t(ue, { variant: "outlined", size: "small", startIcon: c, onClick: r, disabled: o, children: a }), e[2] = c, e[3] = a, e[4] = o, e[5] = r, e[6] = d) : d = e[6];
1401
+ let u;
1402
+ return e[7] !== s || e[8] !== d ? (u = /* @__PURE__ */ t(Be, { variant: "outlined", children: /* @__PURE__ */ t(Fe, { children: /* @__PURE__ */ m(F, { spacing: 1.5, alignItems: "flex-start", children: [
1403
+ s,
1404
+ d
1405
+ ] }) }) }), e[7] = s, e[8] = d, e[9] = u) : u = e[9], u;
1406
+ }
1407
+ function $n(n) {
1408
+ const e = fe(34), {
1409
+ description: i,
1410
+ rows: a,
1411
+ variant: c,
1412
+ onNameChange: r,
1413
+ children: o
1414
+ } = n, s = c === void 0 ? "alert" : c, d = !!r;
1415
+ let u;
1416
+ e[0] === Symbol.for("react.memo_cache_sentinel") ? (u = /* @__PURE__ */ t(j, { variant: "body2", fontWeight: 600, sx: {
1417
+ mb: 1
1418
+ }, children: "Environment Variables References" }), e[0] = u) : u = e[0];
1419
+ let g;
1420
+ e[1] === Symbol.for("react.memo_cache_sentinel") ? (g = {
1421
+ mb: 2
1422
+ }, e[1] = g) : g = e[1];
1423
+ let h;
1424
+ e[2] !== i ? (h = /* @__PURE__ */ t(j, { variant: "body2", sx: g, children: i }), e[2] = i, e[3] = h) : h = e[3];
1425
+ let f;
1426
+ e[4] !== d ? (f = d && /* @__PURE__ */ t(j, { component: "span", variant: "caption", color: "text.secondary", children: "(editable)" }), e[4] = d, e[5] = f) : f = e[5];
1427
+ let b;
1428
+ e[6] !== f ? (b = /* @__PURE__ */ m(U.Cell, { children: [
1429
+ "Variable Name",
1430
+ " ",
1431
+ f
1432
+ ] }), e[6] = f, e[7] = b) : b = e[7];
1433
+ let y;
1434
+ e[8] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ t(U.Cell, { children: "Description" }), e[8] = y) : y = e[8];
1435
+ let v;
1436
+ e[9] !== b ? (v = /* @__PURE__ */ t(U.Head, { children: /* @__PURE__ */ m(U.Row, { children: [
1437
+ b,
1438
+ y
1439
+ ] }) }), e[9] = b, e[10] = v) : v = e[10];
1440
+ let C;
1441
+ if (e[11] !== d || e[12] !== r || e[13] !== a) {
1442
+ let I;
1443
+ e[15] !== d || e[16] !== r ? (I = (A) => /* @__PURE__ */ m(U.Row, { children: [
1444
+ /* @__PURE__ */ t(U.Cell, { children: /* @__PURE__ */ t(Pe, { value: A.name, onChange: r ? (D) => r(A.key, D.target.value) : void 0, copyable: !0, copyTooltipText: `Copy ${A.name}`, size: "small", slotProps: d ? void 0 : {
1445
+ input: {
1446
+ readOnly: !0
1447
+ }
1448
+ } }) }),
1449
+ /* @__PURE__ */ t(U.Cell, { children: /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", children: A.description }) })
1450
+ ] }, A.key), e[15] = d, e[16] = r, e[17] = I) : I = e[17], C = a.map(I), e[11] = d, e[12] = r, e[13] = a, e[14] = C;
1451
+ } else
1452
+ C = e[14];
1453
+ let p;
1454
+ e[18] !== C ? (p = /* @__PURE__ */ t(U.Body, { children: C }), e[18] = C, e[19] = p) : p = e[19];
1455
+ let N;
1456
+ e[20] !== p || e[21] !== v ? (N = /* @__PURE__ */ t(U.Container, { children: /* @__PURE__ */ m(U, { density: "compact", children: [
1457
+ v,
1458
+ p
1459
+ ] }) }), e[20] = p, e[21] = v, e[22] = N) : N = e[22];
1460
+ let L;
1461
+ e[23] !== o || e[24] !== N ? (L = /* @__PURE__ */ m(F, { spacing: 1, children: [
1462
+ N,
1463
+ o
1464
+ ] }), e[23] = o, e[24] = N, e[25] = L) : L = e[25];
1465
+ let z;
1466
+ e[26] !== L || e[27] !== h ? (z = /* @__PURE__ */ m(Ae, { children: [
1467
+ u,
1468
+ h,
1469
+ L
1470
+ ] }), e[26] = L, e[27] = h, e[28] = z) : z = e[28];
1471
+ const E = z;
1472
+ if (s === "plain") {
1473
+ let I;
1474
+ return e[29] !== E ? (I = /* @__PURE__ */ t(le, { children: E }), e[29] = E, e[30] = I) : I = e[30], I;
1475
+ }
1476
+ let x;
1477
+ e[31] === Symbol.for("react.memo_cache_sentinel") ? (x = {
1478
+ mt: 2
1479
+ }, e[31] = x) : x = e[31];
1480
+ let w;
1481
+ return e[32] !== E ? (w = /* @__PURE__ */ t(he, { severity: "info", sx: x, children: E }), e[32] = E, e[33] = w) : w = e[33], w;
1482
+ }
1483
+ function Dt(n) {
1484
+ const e = fe(30), {
1485
+ open: i,
1486
+ title: a,
1487
+ description: c,
1488
+ rows: r,
1489
+ isDirty: o,
1490
+ isSaving: s,
1491
+ hasInvalidNames: d,
1492
+ error: u,
1493
+ onClose: g,
1494
+ onCancel: h,
1495
+ onNameChange: f,
1496
+ onSave: b,
1497
+ children: y
1498
+ } = n, v = a === void 0 ? "Environment Variables & Integration Guide" : a, C = o === void 0 ? !1 : o, p = s === void 0 ? !1 : s, N = d === void 0 ? !1 : d, L = u ? u instanceof Error ? u.message : "Failed to update configuration. Please try again." : void 0;
1499
+ let z;
1500
+ e[0] !== g ? (z = () => g(), e[0] = g, e[1] = z) : z = e[1];
1501
+ let E;
1502
+ e[2] === Symbol.for("react.memo_cache_sentinel") ? (E = /* @__PURE__ */ t($e, { size: 24 }), e[2] = E) : E = e[2];
1503
+ let x;
1504
+ e[3] !== g || e[4] !== v ? (x = /* @__PURE__ */ t(je, { icon: E, title: v, onClose: g }), e[3] = g, e[4] = v, e[5] = x) : x = e[5];
1505
+ let w;
1506
+ e[6] !== L ? (w = L && /* @__PURE__ */ t(he, { severity: "error", icon: /* @__PURE__ */ t(ke, { size: 18 }), children: L }), e[6] = L, e[7] = w) : w = e[7];
1507
+ let I;
1508
+ e[8] !== L || e[9] !== N || e[10] !== C || e[11] !== p || e[12] !== h || e[13] !== g || e[14] !== b ? (I = C && !L && /* @__PURE__ */ t(he, { severity: "warning", action: /* @__PURE__ */ m(F, { direction: "row", spacing: 1, alignItems: "center", children: [
1509
+ /* @__PURE__ */ t(ue, { size: "small", variant: "outlined", onClick: h ?? g, children: "Cancel" }),
1510
+ /* @__PURE__ */ t(ue, { size: "small", variant: "contained", onClick: b, disabled: p || N, children: p ? "Saving..." : "Save changes" })
1511
+ ] }), children: "You have unsaved changes." }), e[8] = L, e[9] = N, e[10] = C, e[11] = p, e[12] = h, e[13] = g, e[14] = b, e[15] = I) : I = e[15];
1512
+ let A;
1513
+ e[16] !== y || e[17] !== c || e[18] !== f || e[19] !== r ? (A = /* @__PURE__ */ t($n, { variant: "plain", description: c, rows: r, onNameChange: f, children: y }), e[16] = y, e[17] = c, e[18] = f, e[19] = r, e[20] = A) : A = e[20];
1514
+ let D;
1515
+ e[21] !== A || e[22] !== w || e[23] !== I ? (D = /* @__PURE__ */ t(Ke, { children: /* @__PURE__ */ m(F, { spacing: 3, children: [
1516
+ w,
1517
+ I,
1518
+ A
1519
+ ] }) }), e[21] = A, e[22] = w, e[23] = I, e[24] = D) : D = e[24];
1520
+ let K;
1521
+ return e[25] !== i || e[26] !== D || e[27] !== z || e[28] !== x ? (K = /* @__PURE__ */ m(Ve, { open: i, onClose: z, minWidth: 640, maxWidth: 640, children: [
1522
+ x,
1523
+ D
1524
+ ] }), e[25] = i, e[26] = D, e[27] = z, e[28] = x, e[29] = K) : K = e[29], K;
1525
+ }
1526
+ function Dn(n) {
1527
+ const e = fe(46), {
1528
+ orgName: i,
1529
+ projName: a,
1530
+ agentName: c,
1531
+ configId: r,
1532
+ envName: o
1533
+ } = n;
1534
+ let s;
1535
+ e[0] !== c || e[1] !== r || e[2] !== o || e[3] !== i || e[4] !== a ? (s = {
1536
+ orgName: i,
1537
+ projName: a,
1538
+ agentName: c,
1539
+ configId: r,
1540
+ envName: o
1541
+ }, e[0] = c, e[1] = r, e[2] = o, e[3] = i, e[4] = a, e[5] = s) : s = e[5];
1542
+ const {
1543
+ data: d,
1544
+ isLoading: u,
1545
+ isError: g
1546
+ } = rn(s), {
1547
+ mutateAsync: h,
1548
+ isPending: f
1549
+ } = on(), {
1550
+ mutateAsync: b,
1551
+ isPending: y
1552
+ } = an(), {
1553
+ mutate: v,
1554
+ isPending: C
1555
+ } = ln(), p = d?.keys?.[0], N = !!(i && a && c && r && o);
1556
+ let L;
1557
+ e[6] !== r ? (L = () => `llm-config-${r}-${Math.random().toString(36).slice(2, 10)}`, e[6] = r, e[7] = L) : L = e[7];
1558
+ const z = L;
1559
+ let E;
1560
+ e[8] !== c || e[9] !== r || e[10] !== h || e[11] !== o || e[12] !== N || e[13] !== z || e[14] !== i || e[15] !== a ? (E = async () => N ? (await h({
1561
+ params: {
1562
+ orgName: i,
1563
+ projName: a,
1564
+ agentName: c,
1565
+ configId: r,
1566
+ envName: o
1567
+ },
1568
+ body: {
1569
+ name: z(),
1570
+ displayName: "LLM provider API key"
1571
+ }
1572
+ })).apiKey : void 0, e[8] = c, e[9] = r, e[10] = h, e[11] = o, e[12] = N, e[13] = z, e[14] = i, e[15] = a, e[16] = E) : E = e[16];
1573
+ const x = E;
1574
+ let w;
1575
+ e[17] !== c || e[18] !== p || e[19] !== r || e[20] !== o || e[21] !== N || e[22] !== i || e[23] !== a || e[24] !== b ? (w = async () => !N || !p ? void 0 : (await b({
1576
+ params: {
1577
+ orgName: i,
1578
+ projName: a,
1579
+ agentName: c,
1580
+ configId: r,
1581
+ envName: o,
1582
+ keyName: p.name
1583
+ },
1584
+ body: {}
1585
+ })).apiKey, e[17] = c, e[18] = p, e[19] = r, e[20] = o, e[21] = N, e[22] = i, e[23] = a, e[24] = b, e[25] = w) : w = e[25];
1586
+ const I = w;
1587
+ let A;
1588
+ e[26] !== c || e[27] !== p || e[28] !== r || e[29] !== o || e[30] !== N || e[31] !== i || e[32] !== a || e[33] !== v ? (A = () => {
1589
+ !N || !p || v({
1590
+ orgName: i,
1591
+ projName: a,
1592
+ agentName: c,
1593
+ configId: r,
1594
+ envName: o,
1595
+ keyName: p.name
1596
+ });
1597
+ }, e[26] = c, e[27] = p, e[28] = r, e[29] = o, e[30] = N, e[31] = i, e[32] = a, e[33] = v, e[34] = A) : A = e[34];
1598
+ const D = A, K = `${r ?? ""}:${o ?? ""}`;
1599
+ let _;
1600
+ return e[35] !== p || e[36] !== D || e[37] !== x || e[38] !== I || e[39] !== f || e[40] !== g || e[41] !== u || e[42] !== C || e[43] !== y || e[44] !== K ? (_ = /* @__PURE__ */ t(_t, { scopeKey: K, description: "Generate an API key to authenticate this agent's requests to the LLM provider through the gateway. Only one key can exist per configuration.", apiKey: p, isLoading: u, isError: g, isGenerating: f, isRegenerating: y, isDeleting: C, emptyDescription: "Generate an API key to authenticate requests to this LLM provider.", onGenerate: x, onRegenerate: I, onDelete: D }), e[35] = p, e[36] = D, e[37] = x, e[38] = I, e[39] = f, e[40] = g, e[41] = u, e[42] = C, e[43] = y, e[44] = K, e[45] = _) : _ = e[45], _;
1601
+ }
1602
+ function gt(n) {
1603
+ switch (n) {
1604
+ case "apikey":
1605
+ return "API Key for authenticating with the LLM provider";
1606
+ case "url":
1607
+ return "Base URL of the LLM provider";
1608
+ default:
1609
+ return n.replace(/([A-Z])/g, " $1").replace(/^./, (e) => e.toUpperCase());
1610
+ }
1611
+ }
1612
+ function Bn(n, e) {
1613
+ if (!n) return null;
1614
+ const i = e.find((r) => /url/i.test(r)), a = e.find((r) => /key/i.test(r)), c = (r, o) => ({
1615
+ importLine: r,
1616
+ setup: o.filter(Boolean).join(`
1617
+ `)
1618
+ });
1619
+ switch (n) {
1620
+ case "openai":
1621
+ return c("from openai import OpenAI", ["client = OpenAI(", i ? ` base_url=${i},` : null, ' api_key="",', ` default_headers={"API-Key": ${a}, "Authorization": ""}`, ")"]);
1622
+ case "anthropic":
1623
+ return c("from anthropic import Anthropic", ["client = Anthropic(", i ? ` base_url=${i},` : null, ` default_headers={"API-Key": ${a}, "Authorization": ""}`, ")"]);
1624
+ case "azure-openai":
1625
+ case "azureai-foundry":
1626
+ return c("from openai import AzureOpenAI", ["client = AzureOpenAI(", i ? ` azure_endpoint=${i},` : null, ' api_key="",', ` default_headers={"API-Key": ${a}, "Authorization": ""}`, ")"]);
1627
+ case "mistralai":
1628
+ return c(`import httpx
1629
+ from mistralai import Mistral`, [`_http_client = httpx.Client(headers={"API-Key": ${a}, "Authorization": ""})`, "client = Mistral(", i ? ` server_url=${i},` : null, " client=_http_client,", ")"]);
1630
+ case "gemini":
1631
+ return c(`from google import genai
1632
+ from google.genai import types`, [i ? `_http_options = types.HttpOptions(base_url=${i}, client_args={"headers": {"API-Key": ${a}, "Authorization": ""}})` : `_http_options = types.HttpOptions(client_args={"headers": {"API-Key": ${a}, "Authorization": ""}})`, "client = genai.Client(", " http_options=_http_options", ")"]);
1633
+ case "awsbedrock":
1634
+ return c(`import boto3
1635
+ from botocore import UNSIGNED
1636
+ from botocore.config import Config`, ["client = boto3.client(", ' "bedrock-runtime",', i ? ` endpoint_url=${i},` : null, " config=Config(signature_version=UNSIGNED),", ")", "def _add_headers(request, **kwargs):", ` request.headers["API-Key"] = ${a}`, ' request.headers["Authorization"] = ""', 'client.meta.events.register("before-send", _add_headers)']);
1637
+ default:
1638
+ return null;
1639
+ }
1640
+ }
1641
+ const ri = () => {
1642
+ const {
1643
+ orgId: n,
1644
+ projectId: e,
1645
+ agentId: i,
1646
+ configId: a
1647
+ } = Ee(), c = De(), o = vt().state?.authInfoByEnv, [s, d] = X(0), [u, g] = X({}), [h, f] = X({}), [b, y] = X(0), [v, C] = X(!!o), [p, N] = X(!1), [L, z] = X({}), E = n && e && i ? xe(Ie.children.org.children.projects.children.agents.children.configure.path, {
1648
+ orgId: n,
1649
+ projectId: e,
1650
+ agentId: i
1651
+ }) : "#", {
1652
+ data: x,
1653
+ isLoading: w,
1654
+ isError: I
1655
+ } = wt({
1656
+ orgName: n,
1657
+ projName: e,
1658
+ agentName: i,
1659
+ configId: a
1660
+ }), {
1661
+ data: A = []
1662
+ } = It({
1663
+ orgName: n
1664
+ }), {
1665
+ data: D
1666
+ } = Ye({
1667
+ orgName: n,
1668
+ projName: e,
1669
+ agentName: i
1670
+ }), K = D?.provisioning?.type === "external", {
1671
+ data: _
1672
+ } = Lt({
1673
+ orgName: n
1674
+ }, {
1675
+ limit: 50
1676
+ }), {
1677
+ data: G
1678
+ } = St({
1679
+ orgName: n
1680
+ }), k = kt(), V = ee(() => {
1681
+ const l = /* @__PURE__ */ new Map();
1682
+ for (const P of G?.templates ?? [])
1683
+ l.set(P.name, {
1684
+ displayName: P.name,
1685
+ logoUrl: P.metadata?.logoUrl
1686
+ }), l.set(P.id, {
1687
+ displayName: P.name,
1688
+ logoUrl: P.metadata?.logoUrl
1689
+ });
1690
+ return l;
1691
+ }, [G]), W = ee(() => (_?.entries ?? []).map((l) => ({
1692
+ uuid: l.uuid,
1693
+ id: l.handle,
1694
+ name: l.name,
1695
+ template: l.template,
1696
+ version: l.version,
1697
+ deployments: l.deployments,
1698
+ security: l.security,
1699
+ rateLimiting: l.rateLimiting,
1700
+ policies: l.policies
1701
+ })), [_]);
1702
+ Se(() => {
1703
+ if (!x) return;
1704
+ const l = {};
1705
+ for (const R of x.environmentVariables ?? [])
1706
+ l[R.key] = R.name;
1707
+ f(l);
1708
+ const P = {};
1709
+ for (const [R, B] of Object.entries(x.envMappings ?? {})) {
1710
+ const H = B.configuration?.policies ?? [], te = /* @__PURE__ */ new Set(), de = [];
1711
+ for (const ve of H) {
1712
+ const pe = `${ve.name}@${ve.version}`;
1713
+ if (te.has(pe)) continue;
1714
+ te.add(pe);
1715
+ const Ce = ve.paths?.[0]?.params;
1716
+ de.push({
1717
+ name: ve.name,
1718
+ version: ve.version,
1719
+ settings: Ce ?? {}
1720
+ });
1721
+ }
1722
+ P[R] = de;
1723
+ }
1724
+ g(P);
1725
+ }, [x]);
1726
+ const O = ee(() => A[s]?.name ?? "", [A, s]), T = ee(() => x?.envMappings?.[O], [x, O])?.configuration, $ = ee(() => {
1727
+ if (!(!T?.providerName || !_?.entries))
1728
+ return _.entries.find((l) => l.handle === T.providerName);
1729
+ }, [T?.providerName, _]), Y = ee(() => !$?.template || !G?.templates ? void 0 : G.templates.find((P) => P.id === $.template)?.metadata?.logoUrl, [$, G]), J = ee(() => !$?.template || !G?.templates ? void 0 : G.templates.find((P) => P.id === $.template)?.name, [$, G]), se = ee(() => u[O] ?? [], [u, O]), ne = ee(() => {
1730
+ if (!x) return !1;
1731
+ if (Object.keys(L).length > 0) return !0;
1732
+ for (const l of x.environmentVariables ?? [])
1733
+ if ((h[l.key] ?? l.name) !== l.name) return !0;
1734
+ for (const [l, P] of Object.entries(x.envMappings ?? {})) {
1735
+ const R = P.configuration?.policies ?? [], B = u[l] ?? [];
1736
+ if (R.length !== B.length) return !0;
1737
+ for (let H = 0; H < R.length; H++) {
1738
+ const te = R[H], de = B[H];
1739
+ if (te.name !== de?.name || te.version !== de?.version) return !0;
1740
+ const ve = te.paths?.[0]?.params ?? {}, pe = de?.settings ?? {};
1741
+ if (JSON.stringify(ve) !== JSON.stringify(pe)) return !0;
1742
+ }
1743
+ }
1744
+ return !1;
1745
+ }, [x, h, u, L]), Q = Le((l) => {
1746
+ g((P) => {
1747
+ const R = P[O] ?? [];
1748
+ return R.some((B) => B.name === l.name && B.version === l.version) ? P : {
1749
+ ...P,
1750
+ [O]: [...R, l]
1751
+ };
1752
+ });
1753
+ }, [O]), Z = Le((l) => {
1754
+ g((P) => {
1755
+ const R = P[O] ?? [];
1756
+ return {
1757
+ ...P,
1758
+ [O]: R.map((B) => B.name === l.name && B.version === l.version ? l : B)
1759
+ };
1760
+ });
1761
+ }, [O]), ye = Le((l, P) => {
1762
+ g((R) => {
1763
+ const B = R[O] ?? [];
1764
+ return {
1765
+ ...R,
1766
+ [O]: B.filter((H) => !(H.name === l && H.version === P))
1767
+ };
1768
+ });
1769
+ }, [O]), ce = Le(() => {
1770
+ if (!n || !e || !i || !a || !x) return;
1771
+ const l = {}, P = new Set(A.map((B) => B.name)), R = /* @__PURE__ */ new Set([...Object.keys(x.envMappings ?? {}).filter((B) => P.has(B)), ...Object.keys(L).filter((B) => P.has(B))]);
1772
+ for (const B of R) {
1773
+ const H = x.envMappings?.[B]?.configuration, te = L[B], de = te ? W.find((pe) => pe.uuid === te)?.id ?? H?.providerName : H?.providerName;
1774
+ if (!de) continue;
1775
+ const ve = u[B];
1776
+ if (ve !== void 0) {
1777
+ const pe = ve.length > 0 ? ve.map((Ce) => ({
1778
+ name: Ce.name,
1779
+ version: Ce.version,
1780
+ paths: [{
1781
+ path: "/*",
1782
+ methods: ["*"],
1783
+ params: Ce.settings ?? {}
1784
+ }]
1785
+ })) : void 0;
1786
+ l[B] = {
1787
+ providerName: de,
1788
+ configuration: {
1789
+ policies: pe
1790
+ }
1791
+ };
1792
+ } else
1793
+ l[B] = {
1794
+ providerName: de,
1795
+ configuration: {
1796
+ policies: H?.policies?.map((pe) => ({
1797
+ name: pe.name,
1798
+ version: pe.version,
1799
+ paths: pe.paths.map((Ce) => ({
1800
+ path: Ce.path,
1801
+ methods: Ce.methods,
1802
+ params: Ce.params ?? {}
1803
+ }))
1804
+ }))
1805
+ }
1806
+ };
1807
+ }
1808
+ k.mutate({
1809
+ params: {
1810
+ orgName: n,
1811
+ projName: e,
1812
+ agentName: i,
1813
+ configId: a
1814
+ },
1815
+ body: {
1816
+ name: x.name,
1817
+ envMappings: l,
1818
+ environmentVariables: Object.keys(h).length > 0 ? Object.entries(h).filter(([, B]) => B.trim() !== "").map(([B, H]) => ({
1819
+ key: B,
1820
+ name: H.trim()
1821
+ })) : void 0
1822
+ }
1823
+ }, {
1824
+ onSuccess: () => {
1825
+ z({});
1826
+ }
1827
+ });
1828
+ }, [n, e, i, a, x, u, h, L, W, A, k]);
1829
+ if (w)
1830
+ return /* @__PURE__ */ t(we, { title: "LLM Configuration", backHref: E, disableIcon: !0, backLabel: "Back to Configure", children: /* @__PURE__ */ m(F, { spacing: 2, children: [
1831
+ /* @__PURE__ */ t(be, { variant: "rounded", height: 56 }),
1832
+ /* @__PURE__ */ t(be, { variant: "rounded", height: 56 }),
1833
+ /* @__PURE__ */ t(be, { variant: "rounded", height: 120 })
1834
+ ] }) });
1835
+ if (I || !x)
1836
+ return /* @__PURE__ */ t(we, { title: "LLM Configuration", backHref: E, disableIcon: !0, backLabel: "Back to Configure", children: /* @__PURE__ */ t(he, { severity: "error", icon: /* @__PURE__ */ t(ke, { size: 18 }), children: "Configuration not found or failed to load." }) });
1837
+ const ie = T?.authInfo?.value, ge = x.name || $?.name || T?.providerName, M = (x.environmentVariables ?? []).some((l) => (h[l.key] ?? l.name).trim() === ""), q = K && !!T || !K && (x.environmentVariables?.length ?? 0) > 0, ae = (x.environmentVariables ?? []).map((l) => ({
1838
+ key: l.key,
1839
+ name: h[l.key] ?? l.name,
1840
+ description: gt(l.key)
1841
+ })), me = /* @__PURE__ */ m(Ae, { children: [
1842
+ /* @__PURE__ */ t(qe, { sx: {
1843
+ my: 2
1844
+ } }),
1845
+ /* @__PURE__ */ m(F, { spacing: 2, children: [
1846
+ /* @__PURE__ */ m(F, { spacing: 0.5, children: [
1847
+ /* @__PURE__ */ t(j, { variant: "subtitle1", fontWeight: 600, children: "Integration Guide" }),
1848
+ /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", children: "Copy the snippet below into your agent code. The environment variables will be injected automatically at runtime — do not hardcode their values." })
1849
+ ] }),
1850
+ /* @__PURE__ */ m(Wt, { size: "small", value: b, exclusive: !0, color: "primary", onChange: (l, P) => {
1851
+ P !== null && y(P);
1852
+ }, children: [
1853
+ /* @__PURE__ */ t(at, { value: 0, sx: {
1854
+ textTransform: "none"
1855
+ }, children: "Python" }),
1856
+ /* @__PURE__ */ t(at, { value: 1, sx: {
1857
+ textTransform: "none"
1858
+ }, children: "Copilot Prompt" })
1859
+ ] }),
1860
+ b === 0 && /* @__PURE__ */ t(Me, { language: "python", code: (() => {
1861
+ const l = Bn($?.template, x.environmentVariables.map((H) => H.key)), P = ["import os"];
1862
+ l && P.push(l.importLine);
1863
+ const R = x.environmentVariables.map((H) => `${H.key} = os.environ.get('${h[H.key] ?? H.name}')`), B = [P.join(`
1864
+ `), "", ...R];
1865
+ return l && B.push("", l.setup), B.join(`
1866
+ `);
1867
+ })() }),
1868
+ b === 1 && /* @__PURE__ */ t(Me, { language: "markdown", code: (() => {
1869
+ const l = J ?? $?.name ?? T?.providerName ?? "the LLM provider", P = x.environmentVariables.map((R) => `- ${gt(R.key)}: \`${h[R.key] ?? R.name}\``).join(`
1870
+ `);
1871
+ return [`Update my code to use ${l}.`, "", "Environment variables that will be injected at runtime:", P, "", "Requirements:", `- Read the environment variables listed above to configure the client for ${l}.`, `- Initialize the ${l} client with the URL and API key from those variables.`, "- Do not hardcode any secrets or endpoint URLs.", "- Keep the rest of my code unchanged."].join(`
1872
+ `);
1873
+ })() })
1874
+ ] })
1875
+ ] }), S = q && (K && T ? /* @__PURE__ */ m(Ve, { open: v, onClose: (l, P) => {
1876
+ P !== "backdropClick" && C(!1);
1877
+ }, minWidth: 640, maxWidth: 640, children: [
1878
+ /* @__PURE__ */ t(je, { icon: /* @__PURE__ */ t($e, { size: 24 }), title: "Connect to LLM Provider", onClose: () => C(!1) }),
1879
+ /* @__PURE__ */ t(Ke, { children: (() => {
1880
+ const l = o?.[O], P = x.environmentVariables?.find((te) => te.key === "apikey"), R = l?.name || "Authorization", B = l?.value || (P ? `$${P.name}` : "<api-key>"), H = [`curl -X POST ${T.url || "<endpoint-url>"}/chat/completions`, ` --header "${R}: ${B}"`, ` -d '{"model": "", "messages": [{"role": "user", "content": "Hi..."}]}'`].join(` \\
1881
+ `);
1882
+ return /* @__PURE__ */ m(F, { spacing: 2, children: [
1883
+ !l && /* @__PURE__ */ m(he, { severity: "info", children: [
1884
+ /* @__PURE__ */ t(j, { variant: "body2", children: "The credentials for this provider were issued during initial setup. To route your agent's traffic through the governance layer, configure your client with the provided endpoint and API key." }),
1885
+ /* @__PURE__ */ t(j, { variant: "body2", sx: {
1886
+ mt: 1,
1887
+ fontWeight: 600
1888
+ }, children: "Security Reminder: Credentials are only displayed once at creation time." })
1889
+ ] }),
1890
+ l && /* @__PURE__ */ m(Ae, { children: [
1891
+ /* @__PURE__ */ t(he, { severity: "info", children: /* @__PURE__ */ t(j, { variant: "body2", children: "To route your agent's LLM traffic through the governance layer, configure your client with the credentials below." }) }),
1892
+ /* @__PURE__ */ t(he, { severity: "warning", children: /* @__PURE__ */ t(j, { variant: "body2", fontWeight: 600, children: "Make sure to copy your API key now — you will not be able to see it again." }) })
1893
+ ] }),
1894
+ !!T.url && /* @__PURE__ */ t(Pe, { label: "Endpoint URL", value: T.url ?? "", copyable: !0, copyTooltipText: "Copy Endpoint URL", slotProps: {
1895
+ input: {
1896
+ readOnly: !0
1897
+ }
1898
+ }, size: "small" }),
1899
+ l && /* @__PURE__ */ t(Pe, { label: "Header Name", value: l.name, copyable: !0, copyTooltipText: "Copy Header Name", slotProps: {
1900
+ input: {
1901
+ readOnly: !0
1902
+ }
1903
+ }, size: "small" }),
1904
+ l?.value && /* @__PURE__ */ t(Pe, { label: "API Key", type: "password", value: l.value, copyable: !0, copyTooltipText: "Copy API Key", slotProps: {
1905
+ input: {
1906
+ readOnly: !0
1907
+ }
1908
+ }, size: "small" }),
1909
+ ie && /* @__PURE__ */ t(Pe, { label: "API Key", type: "password", value: ie, copyable: !0, copyTooltipText: "Copy API Key", slotProps: {
1910
+ input: {
1911
+ readOnly: !0
1912
+ }
1913
+ }, size: "small" }),
1914
+ /* @__PURE__ */ m(le, { children: [
1915
+ /* @__PURE__ */ t(bt, { sx: {
1916
+ display: "block",
1917
+ mb: 0.5
1918
+ }, children: "Example cURL" }),
1919
+ /* @__PURE__ */ t(Me, { code: H, language: "bash", fieldId: "curl" })
1920
+ ] })
1921
+ ] });
1922
+ })() })
1923
+ ] }) : /* @__PURE__ */ t(Dt, { open: v, onClose: () => C(!1), onCancel: () => {
1924
+ C(!1), c(E);
1925
+ }, onSave: ce, isDirty: ne, isSaving: k.isPending, hasInvalidNames: M, error: k.isError ? k.error : void 0, description: "These variable names are injected into the agent at runtime with environment-specific values. Rename them here if your code already uses different names, then save.", rows: ae, onNameChange: (l, P) => f((R) => ({
1926
+ ...R,
1927
+ [l]: P
1928
+ })), children: me }));
1929
+ return /* @__PURE__ */ m(we, { title: ge, backHref: E, disableIcon: !0, backLabel: "Back to Configure", actions: q ? /* @__PURE__ */ t(ue, { variant: "outlined", size: "small", startIcon: /* @__PURE__ */ t($e, { size: 16 }), onClick: () => C(!0), children: K ? "Connect to LLM Provider" : "Environment Variables & Integration Guide" }) : void 0, children: [
1930
+ /* @__PURE__ */ m(F, { spacing: 3, children: [
1931
+ k.isError && /* @__PURE__ */ t(he, { severity: "error", icon: /* @__PURE__ */ t(ke, { size: 18 }), onClose: () => k.reset(), children: k.error instanceof Error ? k.error.message : "Failed to update configuration. Please try again." }),
1932
+ /* @__PURE__ */ m(re.Section, { children: [
1933
+ /* @__PURE__ */ t(re.Subheader, { children: "Service Provider" }),
1934
+ /* @__PURE__ */ m(F, { spacing: 3, children: [
1935
+ A.length > 1 && /* @__PURE__ */ m(Ae, { children: [
1936
+ /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", children: "Each environment uses a separate catalog provider. The same variable names are injected in all environments with environment-specific values." }),
1937
+ /* @__PURE__ */ t(et, { value: s, onChange: (l, P) => d(P), sx: {
1938
+ borderBottom: 1,
1939
+ borderColor: "divider",
1940
+ mb: 2
1941
+ }, children: A.map((l, P) => /* @__PURE__ */ t(Ue, { label: l.displayName ?? l.name, value: P }, l.name)) })
1942
+ ] }),
1943
+ /* @__PURE__ */ t($t, { open: p, onClose: () => N(!1), providers: W, templateMap: V, selectedUuid: L[O] ?? ($ ? _?.entries?.find((l) => l.handle === T?.providerName)?.uuid : void 0), subtitle: "Choose the catalog provider for this agent.", onSelect: (l) => {
1944
+ O && z((P) => ({
1945
+ ...P,
1946
+ [O]: l
1947
+ }));
1948
+ } }),
1949
+ (() => {
1950
+ const l = L[O];
1951
+ if (!T && !l)
1952
+ return /* @__PURE__ */ t(zn, { message: "No provider is configured for this environment yet.", actionLabel: "Select Provider", actionIcon: /* @__PURE__ */ t(Re, { size: 16 }), onAction: () => N(!0) });
1953
+ const R = (l ? W.find((H) => H.uuid === l) : null) ? _?.entries?.find((H) => H.uuid === l) : $, B = R?.template ? V.get(R.template) : $?.template ? {
1954
+ displayName: J ?? $.template,
1955
+ logoUrl: Y
1956
+ } : null;
1957
+ return /* @__PURE__ */ t(Be, { variant: "outlined", children: /* @__PURE__ */ m(Fe, { sx: {
1958
+ position: "relative"
1959
+ }, children: [
1960
+ /* @__PURE__ */ t(Ne, { title: "Change provider", placement: "top", arrow: !0, children: /* @__PURE__ */ t(He, { size: "small", color: "primary", sx: {
1961
+ position: "absolute",
1962
+ top: 8,
1963
+ right: 8
1964
+ }, onClick: () => N(!0), "aria-label": "Change provider", children: /* @__PURE__ */ t(it, { size: 16 }) }) }),
1965
+ /* @__PURE__ */ t(rt, { provider: R ? {
1966
+ name: R.name ?? T?.providerName ?? "",
1967
+ template: R.template,
1968
+ version: R.version,
1969
+ deployments: R.deployments,
1970
+ security: R.security,
1971
+ rateLimiting: R.rateLimiting,
1972
+ policies: R.policies
1973
+ } : {
1974
+ name: T?.providerName ?? ""
1975
+ }, isSelected: !1, hideCheckbox: !0, templateInfo: B ?? null })
1976
+ ] }) });
1977
+ })(),
1978
+ /* @__PURE__ */ t(Mt, { 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: se, onAdd: Q, onEdit: Z, onRemove: ye }),
1979
+ ne && /* @__PURE__ */ m(F, { direction: "row", spacing: 1, justifyContent: "flex-end", children: [
1980
+ /* @__PURE__ */ t(ue, { variant: "outlined", size: "small", onClick: () => {
1981
+ z({}), c(E);
1982
+ }, children: "Cancel" }),
1983
+ /* @__PURE__ */ t(ue, { variant: "contained", size: "small", onClick: ce, disabled: k.isPending || M, children: k.isPending ? "Saving…" : "Save" })
1984
+ ] })
1985
+ ] })
1986
+ ] }),
1987
+ K && T && /* @__PURE__ */ t(Dn, { orgName: n, projName: e, agentName: i, configId: a, envName: O })
1988
+ ] }),
1989
+ S
1990
+ ] });
1991
+ };
1992
+ function Vn(n) {
1993
+ const e = fe(46), {
1994
+ orgName: i,
1995
+ projName: a,
1996
+ agentName: c,
1997
+ configId: r,
1998
+ envName: o
1999
+ } = n;
2000
+ let s;
2001
+ e[0] !== c || e[1] !== r || e[2] !== o || e[3] !== i || e[4] !== a ? (s = {
2002
+ orgName: i,
2003
+ projName: a,
2004
+ agentName: c,
2005
+ configId: r,
2006
+ envName: o
2007
+ }, e[0] = c, e[1] = r, e[2] = o, e[3] = i, e[4] = a, e[5] = s) : s = e[5];
2008
+ const {
2009
+ data: d,
2010
+ isLoading: u,
2011
+ isError: g
2012
+ } = sn(s), {
2013
+ mutateAsync: h,
2014
+ isPending: f
2015
+ } = cn(), {
2016
+ mutateAsync: b,
2017
+ isPending: y
2018
+ } = dn(), {
2019
+ mutate: v,
2020
+ isPending: C
2021
+ } = mn(), p = d?.keys?.[0], N = !!(i && a && c && r && o);
2022
+ let L;
2023
+ e[6] !== r ? (L = () => `mcp-config-${r}-${Math.random().toString(36).slice(2, 10)}`, e[6] = r, e[7] = L) : L = e[7];
2024
+ const z = L;
2025
+ let E;
2026
+ e[8] !== c || e[9] !== r || e[10] !== h || e[11] !== o || e[12] !== N || e[13] !== z || e[14] !== i || e[15] !== a ? (E = async () => N ? (await h({
2027
+ params: {
2028
+ orgName: i,
2029
+ projName: a,
2030
+ agentName: c,
2031
+ configId: r,
2032
+ envName: o
2033
+ },
2034
+ body: {
2035
+ name: z(),
2036
+ displayName: "MCP server API key"
2037
+ }
2038
+ })).apiKey : void 0, e[8] = c, e[9] = r, e[10] = h, e[11] = o, e[12] = N, e[13] = z, e[14] = i, e[15] = a, e[16] = E) : E = e[16];
2039
+ const x = E;
2040
+ let w;
2041
+ e[17] !== c || e[18] !== p || e[19] !== r || e[20] !== o || e[21] !== N || e[22] !== i || e[23] !== a || e[24] !== b ? (w = async () => !N || !p ? void 0 : (await b({
2042
+ params: {
2043
+ orgName: i,
2044
+ projName: a,
2045
+ agentName: c,
2046
+ configId: r,
2047
+ envName: o,
2048
+ keyName: p.name
2049
+ },
2050
+ body: {}
2051
+ })).apiKey, e[17] = c, e[18] = p, e[19] = r, e[20] = o, e[21] = N, e[22] = i, e[23] = a, e[24] = b, e[25] = w) : w = e[25];
2052
+ const I = w;
2053
+ let A;
2054
+ e[26] !== c || e[27] !== p || e[28] !== r || e[29] !== o || e[30] !== N || e[31] !== i || e[32] !== a || e[33] !== v ? (A = () => {
2055
+ !N || !p || v({
2056
+ orgName: i,
2057
+ projName: a,
2058
+ agentName: c,
2059
+ configId: r,
2060
+ envName: o,
2061
+ keyName: p.name
2062
+ });
2063
+ }, e[26] = c, e[27] = p, e[28] = r, e[29] = o, e[30] = N, e[31] = i, e[32] = a, e[33] = v, e[34] = A) : A = e[34];
2064
+ const D = A, K = `${r ?? ""}:${o ?? ""}`;
2065
+ let _;
2066
+ return e[35] !== p || e[36] !== D || e[37] !== x || e[38] !== I || e[39] !== f || e[40] !== g || e[41] !== u || e[42] !== C || e[43] !== y || e[44] !== K ? (_ = /* @__PURE__ */ t(_t, { scopeKey: K, description: "Generate an API key to authenticate this agent's requests to the MCP server through the gateway. Only one key can exist per configuration.", apiKey: p, isLoading: u, isError: g, isGenerating: f, isRegenerating: y, isDeleting: C, emptyDescription: "Generate an API key to authenticate requests to this MCP server.", onGenerate: x, onRegenerate: I, onDelete: D }), e[35] = p, e[36] = D, e[37] = x, e[38] = I, e[39] = f, e[40] = g, e[41] = u, e[42] = C, e[43] = y, e[44] = K, e[45] = _) : _ = e[45], _;
2067
+ }
2068
+ const oi = () => {
2069
+ const {
2070
+ orgId: n,
2071
+ projectId: e,
2072
+ agentId: i,
2073
+ proxyId: a
2074
+ } = Ee(), c = ee(() => jn(a), [a]), r = ot(), o = ot(), s = De(), d = vt(), u = d.state?.authInfoByEnv, [g, h] = X(() => !!(d.state?.openEnvPanel || u)), [f, b] = X(""), [y, v] = X({}), {
2075
+ data: C,
2076
+ isLoading: p,
2077
+ isError: N,
2078
+ error: L
2079
+ } = un({
2080
+ orgName: n,
2081
+ projName: e,
2082
+ agentName: i,
2083
+ configId: c
2084
+ }), {
2085
+ data: z
2086
+ } = Ye({
2087
+ orgName: n,
2088
+ projName: e,
2089
+ agentName: i
2090
+ }), E = z?.provisioning?.type === "external", {
2091
+ data: x = []
2092
+ } = It({
2093
+ orgName: n
2094
+ }), {
2095
+ environments: w
2096
+ } = tt(n, e), {
2097
+ data: I
2098
+ } = Pt({
2099
+ orgName: n
2100
+ }, {
2101
+ limit: 50,
2102
+ offset: 0
2103
+ }), A = ee(() => I?.list ?? [], [I]), D = pn(), K = n && e && i ? xe(Ie.children.org.children.projects.children.agents.children.configure.path, {
2104
+ orgId: n,
2105
+ projectId: e,
2106
+ agentId: i
2107
+ }) : "#", _ = ee(() => {
2108
+ const M = Object.keys(C?.envMappings ?? {}), q = w.map((S) => S.name), ae = M.filter((S) => !q.includes(S)), me = [...q, ...ae];
2109
+ return me.length > 0 ? me : M;
2110
+ }, [C, w]), G = ee(() => {
2111
+ for (const M of Object.values(C?.envMappings ?? {})) {
2112
+ const q = Kn(M.configuration);
2113
+ if (q) return q;
2114
+ }
2115
+ }, [C]), k = ee(() => A.find((M) => M.id === G), [A, G]), V = n && G ? xe(Ie.children.org.children.mcpProxies.children.view.path, {
2116
+ orgId: n,
2117
+ proxyId: G
2118
+ }) : void 0;
2119
+ Se(() => {
2120
+ _.length !== 0 && (_.includes(f) || b(_[0]));
2121
+ }, [_, f]);
2122
+ const W = C?.envMappings?.[f]?.configuration, {
2123
+ data: O
2124
+ } = hn({
2125
+ orgName: n,
2126
+ proxyId: G ?? ""
2127
+ }), oe = x.find((M) => M.name === f)?.id, T = oe ? O?.environments?.[oe]?.security : void 0, $ = Gn(T), Y = ee(() => C?.environmentVariables ?? [], [C]);
2128
+ Se(() => {
2129
+ const M = {};
2130
+ for (const q of Y)
2131
+ M[q.key] = q.name;
2132
+ v(M);
2133
+ }, [Y]);
2134
+ const J = Y.some((M) => (y[M.key] ?? M.name).trim() === ""), se = Y.some((M) => (y[M.key] ?? M.name) !== M.name), ne = () => {
2135
+ !n || !e || !i || !c || J || D.mutate({
2136
+ params: {
2137
+ orgName: n,
2138
+ projName: e,
2139
+ agentName: i,
2140
+ configId: c
2141
+ },
2142
+ body: {
2143
+ environmentVariables: Y.map((M) => ({
2144
+ key: M.key,
2145
+ name: (y[M.key] ?? M.name).trim()
2146
+ }))
2147
+ }
2148
+ }, {
2149
+ onSuccess: () => h(!1)
2150
+ });
2151
+ }, Q = () => {
2152
+ const M = {};
2153
+ for (const q of Y)
2154
+ M[q.key] = q.name;
2155
+ v(M);
2156
+ }, Z = ee(() => Y.map((M) => ({
2157
+ key: M.key,
2158
+ name: y[M.key] ?? M.name,
2159
+ description: Un(M.key)
2160
+ })), [Y, y]), ye = ee(() => On(Z), [Z]);
2161
+ if (p)
2162
+ return /* @__PURE__ */ t(we, { title: "Tool Configuration", backHref: K, disableIcon: !0, backLabel: "Back to Configure", children: /* @__PURE__ */ m(F, { spacing: 2, children: [
2163
+ /* @__PURE__ */ t(be, { variant: "rounded", height: 56 }),
2164
+ /* @__PURE__ */ t(be, { variant: "rounded", height: 180 }),
2165
+ /* @__PURE__ */ t(be, { variant: "rounded", height: 240 })
2166
+ ] }) });
2167
+ if (N || !C)
2168
+ return /* @__PURE__ */ t(we, { title: "Tool Configuration", backHref: K, disableIcon: !0, backLabel: "Back to Configure", children: /* @__PURE__ */ t(he, { severity: "error", icon: /* @__PURE__ */ t(ke, { size: 18 }), children: L instanceof Error ? L.message : "Configuration not found or failed to load." }) });
2169
+ const ce = C.name || k?.name || G || "Tool Configuration", ie = E && !!W || !E && Y.length > 0, ge = ie && (E && W ? /* @__PURE__ */ m(Ve, { open: g, onClose: (M, q) => {
2170
+ q !== "backdropClick" && h(!1);
2171
+ }, minWidth: 640, maxWidth: 640, children: [
2172
+ /* @__PURE__ */ t(je, { icon: /* @__PURE__ */ t($e, { size: 24 }), title: "Connect to MCP Server", onClose: () => h(!1) }),
2173
+ /* @__PURE__ */ t(Ke, { children: (() => {
2174
+ const M = u?.[f] ?? W.authInfo, q = $ || M?.name || "api-key", ae = M?.value || "<api-key>", me = [`curl -N ${W.url || "<endpoint-url>"}`, ` --header "${q}: ${ae}"`].join(` \\
2175
+ `);
2176
+ return /* @__PURE__ */ m(F, { spacing: 2, children: [
2177
+ M?.value ? /* @__PURE__ */ m(Ae, { children: [
2178
+ /* @__PURE__ */ t(he, { severity: "info", children: /* @__PURE__ */ t(j, { variant: "body2", children: "Configure your external agent with the endpoint and API key below to call this MCP server through the gateway." }) }),
2179
+ /* @__PURE__ */ t(he, { severity: "warning", children: /* @__PURE__ */ t(j, { variant: "body2", fontWeight: 600, children: "Make sure to copy your API key now. You will not be able to see it again." }) })
2180
+ ] }) : /* @__PURE__ */ t(he, { severity: "info", children: /* @__PURE__ */ t(j, { variant: "body2", children: "The endpoint is available below. If the MCP server requires an API key, the key was only displayed when this configuration was created." }) }),
2181
+ !!W.url && /* @__PURE__ */ t(Pe, { label: "Endpoint URL", value: W.url ?? "", copyable: !0, copyTooltipText: "Copy Endpoint URL", slotProps: {
2182
+ input: {
2183
+ readOnly: !0
2184
+ }
2185
+ }, size: "small" }),
2186
+ /* @__PURE__ */ t(Pe, { label: "Header Name", value: q, copyable: !0, copyTooltipText: "Copy Header Name", slotProps: {
2187
+ input: {
2188
+ readOnly: !0
2189
+ }
2190
+ }, size: "small" }),
2191
+ M?.value && /* @__PURE__ */ t(Pe, { label: "API Key", type: "password", value: M.value, copyable: !0, copyTooltipText: "Copy API Key", slotProps: {
2192
+ input: {
2193
+ readOnly: !0
2194
+ }
2195
+ }, size: "small" }),
2196
+ /* @__PURE__ */ m(le, { children: [
2197
+ /* @__PURE__ */ t(bt, { sx: {
2198
+ display: "block",
2199
+ mb: 0.5
2200
+ }, children: "Example cURL" }),
2201
+ /* @__PURE__ */ t(Me, { code: me, language: "bash", fieldId: "mcp-curl" })
2202
+ ] })
2203
+ ] });
2204
+ })() })
2205
+ ] }) : /* @__PURE__ */ m(Dt, { open: g, onClose: () => h(!1), onCancel: () => {
2206
+ Q(), h(!1);
2207
+ }, onSave: ne, isDirty: se, isSaving: D.isPending, hasInvalidNames: J, error: D.isError ? D.error : void 0, description: "These variable names are injected into the agent at runtime with environment-specific values. Rename them here if your code already uses different names, then save.", rows: Z, onNameChange: (M, q) => v((ae) => ({
2208
+ ...ae,
2209
+ [M]: q
2210
+ })), children: [
2211
+ /* @__PURE__ */ t(qe, { sx: {
2212
+ my: 2
2213
+ } }),
2214
+ /* @__PURE__ */ m(F, { spacing: 1.5, children: [
2215
+ /* @__PURE__ */ m(F, { spacing: 0.5, children: [
2216
+ /* @__PURE__ */ t(j, { variant: "subtitle1", fontWeight: 600, children: "Integration Guide" }),
2217
+ /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", children: "Copy this pattern into your agent code to load MCP tools through the injected proxy URL and API key." })
2218
+ ] }),
2219
+ /* @__PURE__ */ t(Me, { language: "python", fieldId: "mcp-python-snippet", code: ye })
2220
+ ] })
2221
+ ] }));
2222
+ return /* @__PURE__ */ m(we, { title: ce, backHref: K, disableIcon: !0, backLabel: "Back to Configuration Listing", actions: ie ? /* @__PURE__ */ t(ue, { variant: "outlined", size: "small", startIcon: /* @__PURE__ */ t($e, { size: 16 }), onClick: () => h(!0), children: E ? "Connect to MCP Server" : "Environment Variables & Integration Guide" }) : void 0, children: [
2223
+ /* @__PURE__ */ m(F, { spacing: 3, children: [
2224
+ /* @__PURE__ */ m(re.Section, { children: [
2225
+ /* @__PURE__ */ t(re.Subheader, { children: "MCP Server" }),
2226
+ k ? /* @__PURE__ */ t(Be, { variant: "outlined", children: /* @__PURE__ */ m(Fe, { sx: {
2227
+ position: "relative"
2228
+ }, children: [
2229
+ V && /* @__PURE__ */ t(Ne, { title: "View MCP proxy", placement: "top", arrow: !0, children: /* @__PURE__ */ t(He, { size: "small", color: "primary", onClick: () => s(V), "aria-label": `View MCP proxy ${k.name ?? G} in the organization`, sx: {
2230
+ position: "absolute",
2231
+ top: 8,
2232
+ right: 8
2233
+ }, children: /* @__PURE__ */ t(At, { size: 16 }) }) }),
2234
+ /* @__PURE__ */ t(Xe, { server: k, isSelected: !1, hideCheckbox: !0 })
2235
+ ] }) }) : /* @__PURE__ */ t(j, { variant: "body2", color: "text.secondary", children: G ?? "No MCP server referenced." })
2236
+ ] }),
2237
+ E && W && /* @__PURE__ */ m(F, { spacing: 2, children: [
2238
+ /* @__PURE__ */ m(F, { direction: "row", spacing: 2, alignItems: "center", children: [
2239
+ /* @__PURE__ */ t(j, { id: o, variant: "body2", color: "text.secondary", children: "Environment" }),
2240
+ /* @__PURE__ */ t(Ft, { size: "small", sx: {
2241
+ minWidth: 260
2242
+ }, children: /* @__PURE__ */ t(Ht, { id: r, labelId: o, value: f, onChange: (M) => b(M.target.value), children: _.map((M) => /* @__PURE__ */ t(qt, { value: M, children: x.find((q) => q.name === M)?.displayName ?? M }, M)) }) })
2243
+ ] }),
2244
+ /* @__PURE__ */ t(Vn, { orgName: n, projName: e, agentName: i, configId: c, envName: f })
2245
+ ] })
2246
+ ] }),
2247
+ ge
2248
+ ] });
2249
+ };
2250
+ function jn(n) {
2251
+ if (!n) return "";
2252
+ try {
2253
+ return decodeURIComponent(n);
2254
+ } catch {
2255
+ return n;
2256
+ }
2257
+ }
2258
+ function Kn(n) {
2259
+ return n?.proxyName ?? n?.proxyId ?? n?.mcpProxyName ?? n?.mcpProxyId ?? n?.providerName;
2260
+ }
2261
+ function Gn(n) {
2262
+ return n?.enabled === !1 || n?.apiKey?.enabled === !1 ? void 0 : n?.apiKey?.key?.trim() || "X-API-Key";
2263
+ }
2264
+ function Un(n) {
2265
+ return /url/i.test(n) ? "Base URL of the MCP server endpoint" : /api[-_]?key/i.test(n) ? "API key for authenticating with the MCP server endpoint" : n.replace(/([A-Z])/g, " $1").replace(/^./, (e) => e.toUpperCase());
2266
+ }
2267
+ function On(n) {
2268
+ const e = n.find((a) => /url/i.test(a.key))?.name ?? "MCP_SERVER_URL", i = n.find((a) => /api[-_]?key/i.test(a.key))?.name ?? "MCP_SERVER_API_KEY";
2269
+ return ["import os", "from typing import Any", "from langchain_mcp_adapters.client import MultiServerMCPClient", "", `raw_urls = os.environ.get("${e}", "")`, 'mcp_server_urls = [url.strip() for url in raw_urls.split(",") if url.strip()]', `mcp_api_key = os.environ.get("${i}", "").strip()`, "", "server_configs: dict[str, dict[str, Any]] = {", ' f"mcp_server_{i}": {', ' "url": url,', ' "transport": "streamable_http",', ' "headers": {', ' "API-Key": mcp_api_key,', ' "Authorization": "",', " },", " }", " for i, url in enumerate(mcp_server_urls)", "} if mcp_server_urls and mcp_api_key else {}", "", "mcp_client = MultiServerMCPClient(server_configs)", "tools = await mcp_client.get_tools()"].join(`
2270
+ `);
2271
+ }
2272
+ const ai = {
2273
+ title: "Configure",
2274
+ description: "A page component for Configure Agent",
2275
+ icon: Pn,
2276
+ path: "/configure",
2277
+ component: An
2278
+ };
2279
+ export {
2280
+ ii as AddLLMProviderComponent,
2281
+ An as ConfigureComponent,
2282
+ rt as ProviderDisplay,
2283
+ ri as ViewLLMProviderComponent,
2284
+ oi as ViewMCPServerComponent,
2285
+ ai as metaData
2286
+ };