@wso2/am-core-ui 0.0.19 → 0.0.20

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