@wso2/am-core-ui 0.0.19 → 0.0.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/CatalogKindListing-DvUuZEpc.js +137 -0
  2. package/dist/{CodeBlock-mB_Loq7I.js → CodeBlock-B2Ecl916.js} +1 -1
  3. package/dist/EnvironmentCard-CIXhDhlZ.js +319 -0
  4. package/dist/{EnvironmentSelector-B7Bl93s2.js → EnvironmentSelector-D8S6nO9u.js} +1 -1
  5. package/dist/IsolationTierIndicator-cf90kgjL.js +81 -0
  6. package/dist/LabelChips-7rA7_yre.js +139 -0
  7. package/dist/PolicyListSection-D6aVSKwP.js +1143 -0
  8. package/dist/{ResourceListShell-Cx6mdeqv.js → ResourceListShell-DFisKftq.js} +1 -1
  9. package/dist/{SwaggerSpecViewer-BvkhoKsi.js → SwaggerSpecViewer-DzjR6U6W.js} +1 -1
  10. package/dist/{debounce-BV83M53b.js → debounce-D17ObVdG.js} +1 -1
  11. package/dist/{format-BEZZRyE2.js → format-wlHhWjGo.js} +1 -1
  12. package/dist/{formatDistanceToNow-TErllcH8.js → formatDistanceToNow-DyjnT7l9.js} +11 -11
  13. package/dist/{gatewayScripts-D8O45W8u.js → gatewayScripts-D4ZDEDPS.js} +1 -1
  14. package/dist/{index-sr-mWz4T.js → index-3K-zqdp-.js} +32 -32
  15. package/dist/{index-KRsV2L4V.js → index-6liAPSDn.js} +160 -160
  16. package/dist/{index-B52h3RHg.js → index-B3ASENUJ.js} +109 -109
  17. package/dist/index-B7Pf4oPq.js +3069 -0
  18. package/dist/index-BNO3FhZK.js +2304 -0
  19. package/dist/index-BUZSfCl5.js +335 -0
  20. package/dist/index-BXiG1r_o.js +1409 -0
  21. package/dist/{index-_0Pj_ZtW.js → index-BYy7Iaam.js} +40 -40
  22. package/dist/{index-BfjzUWDa.js → index-BbB_yx4V.js} +103 -103
  23. package/dist/index-BjWJ95lH.js +2728 -0
  24. package/dist/{index-B_Z0MwXk.js → index-ByEInFlf.js} +10916 -9520
  25. package/dist/index-C8WIhzyz.js +123 -0
  26. package/dist/index-CnzvaT6b.js +2368 -0
  27. package/dist/index-CrnCf-hJ.js +763 -0
  28. package/dist/{index-CgCWbWzN.js → index-Cvsho9xg.js} +381 -377
  29. package/dist/{index-UqDmyMSA.js → index-CxnAo1_c.js} +21 -21
  30. package/dist/{index-BnV-PkwM.js → index-Cz7-AZwE.js} +2 -2
  31. package/dist/{index-BP5drcF2.js → index-DBdRFjxm.js} +232 -233
  32. package/dist/{index-BZ4vxviI.js → index-DFsSvmMZ.js} +5 -5
  33. package/dist/index-DslzOSGN.js +2549 -0
  34. package/dist/{index-DD4qF7gq.js → index-DvpYvchM.js} +101 -100
  35. package/dist/index.d.ts +784 -163
  36. package/dist/index.js +532 -454
  37. package/dist/js-yaml-CvhD-clg.js +1335 -0
  38. package/dist/{llmProviderPayload-CzihkdNa.js → llmProviderPayload-BPzWDy7n.js} +2 -2
  39. package/package.json +1 -1
  40. package/dist/CatalogKindListing-DtFI2YMG.js +0 -118
  41. package/dist/EnvironmentCard-09h1XRxx.js +0 -310
  42. package/dist/PolicyListSection-o4k9e8XO.js +0 -2475
  43. package/dist/index-CGDYgUCH.js +0 -711
  44. package/dist/index-COt7nJIf.js +0 -2286
  45. package/dist/index-CWZjOy1h.js +0 -2247
  46. package/dist/index-CezvogTQ.js +0 -116
  47. package/dist/index-CjCkcuuI.js +0 -322
  48. package/dist/index-CjXvuf9m.js +0 -1354
  49. package/dist/index-DeQ-9KTC.js +0 -737
  50. package/dist/index-Df6OBy4E.js +0 -3041
  51. package/dist/index-PUuASE1F.js +0 -2507
@@ -1,2247 +0,0 @@
1
- import { jsxs as u, Fragment as se, jsx as n } from "react/jsx-runtime";
2
- import { c as K } from "react/compiler-runtime";
3
- import { u as Ot, g as ie, a as Ft, b as Ht, f as Ut, T as Ze, c as Kt, d as Vt, e as qt, h as Be, N as et, B as Xt, i as tt, j as Yt, k as Jt, l as Zt, D as nt, m as it, n as lt, o as Qt, p as en, q as tn, r as vt, s as nn, t as pt, v as wt, P as at, w as Nt, x as St, y as rt, z as _t, A as ln, C as an, E as rn, F as on, G as Pt, H as sn, I as cn, J as dn, K as mn } from "./index-B_Z0MwXk.js";
4
- import "@tanstack/react-query";
5
- import { useMemo as ae, useState as ne, useEffect as xe, useCallback as he } from "react";
6
- import { Box as w, Skeleton as H, Typography as I, IconButton as ze, Tooltip as ve, Card as re, CardContent as oe, Divider as te, useTheme as ot, Button as ee, Grid as We, Stack as J, Chip as $e, CircularProgress as st, MenuItem as ue, Select as ct, Form as Te, TextField as ht, DataGrid as pn, SearchBar as It, Menu as hn, Alert as fn, ListingTable as Q, Avatar as Ct, TablePagination as un, formatRelativeTime as gn } from "@wso2/oxygen-ui";
7
- import { generatePath as le, Link as pe, useParams as ge, useSearchParams as yn, useNavigate as bn } from "react-router-dom";
8
- import { ExternalLink as Ge, Tag as xn, ChevronRight as Oe, PauseCircle as vn, XCircle as wn, CheckCircle as Nn, GitHub as Sn, Settings as At, Edit as Me, Clock as kt, Link as _n, Rocket as Pn, GitBranch as Dt, ArrowRight as In, Plus as Qe, Trash2 as Fe, User as ft, Package as jt, Home as Cn } from "@wso2/oxygen-ui-icons-react";
9
- import { f as dt } from "./formatDistanceToNow-TErllcH8.js";
10
- import { AreaChart as An } from "@wso2/oxygen-ui-charts-react";
11
- import { E as Lt } from "./EnvironmentCard-09h1XRxx.js";
12
- import { C as Tt } from "./CodeBlock-mB_Loq7I.js";
13
- import { o as zt, s as be } from "./schemas-DFScWdSL.js";
14
- const kn = (t) => {
15
- const e = K(64), {
16
- orgId: i,
17
- kindName: l,
18
- framework: a,
19
- model: s
20
- } = t;
21
- let r;
22
- e[0] !== l || e[1] !== i ? (r = {
23
- orgName: i,
24
- kindName: l
25
- }, e[0] = l, e[1] = i, e[2] = r) : r = e[2];
26
- const {
27
- data: o,
28
- isLoading: d
29
- } = Ot(r);
30
- let m;
31
- e[3] !== l || e[4] !== i ? (m = le(ie.children.org.children.catalog.children.kindDetails.path, {
32
- orgId: i,
33
- kindId: l
34
- }), e[3] = l, e[4] = i, e[5] = m) : m = e[5];
35
- const g = m;
36
- let f, c, p, h, b, y, x, N, v, S, k, _, j, W, D, C, A;
37
- if (e[6] !== a || e[7] !== d || e[8] !== o || e[9] !== g || e[10] !== l || e[11] !== s) {
38
- const R = o?.versions?.find((B) => B.version === o.latestVersion) ?? o?.versions?.[0];
39
- h = re, S = "outlined", p = oe, e[29] === Symbol.for("react.memo_cache_sentinel") ? (x = {
40
- py: 1.5,
41
- "&:last-child": {
42
- pb: 1.5
43
- }
44
- }, e[29] = x) : x = e[29], e[30] === Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ n(w, { pb: 1, children: /* @__PURE__ */ n(I, { variant: "h6", children: "Kind Details" }) }), e[30] = N) : N = e[30], e[31] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ n(te, { sx: {
45
- mb: 1.5
46
- } }), e[31] = v) : v = e[31], c = w, D = "flex", C = 2, A = 0;
47
- let T;
48
- e[32] === Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", fontWeight: 600, sx: {
49
- textTransform: "uppercase",
50
- letterSpacing: "0.05em",
51
- display: "block",
52
- mb: 0.75
53
- }, children: "Agent Kind" }), e[32] = T) : T = e[32], e[33] !== d || e[34] !== o || e[35] !== g || e[36] !== l ? (b = /* @__PURE__ */ u(w, { flex: 1, minWidth: 0, children: [
54
- T,
55
- d ? /* @__PURE__ */ u(se, { children: [
56
- /* @__PURE__ */ n(H, { variant: "text", width: 160 }),
57
- /* @__PURE__ */ n(H, { variant: "text", width: 200, sx: {
58
- mt: 0.25
59
- } })
60
- ] }) : /* @__PURE__ */ u(se, { children: [
61
- /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 0.5, minWidth: 0, children: [
62
- /* @__PURE__ */ n(I, { variant: "body2", noWrap: !0, children: o?.displayName ?? l }),
63
- /* @__PURE__ */ n(ze, { size: "small", component: pe, to: g, sx: {
64
- p: 0.25,
65
- flexShrink: 0
66
- }, children: /* @__PURE__ */ n(Ge, { size: 12 }) })
67
- ] }),
68
- o?.description && /* @__PURE__ */ n(ve, { title: o.description, placement: "bottom-start", children: /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", mt: 0.25, sx: {
69
- overflow: "hidden",
70
- display: "-webkit-box",
71
- WebkitLineClamp: 2,
72
- WebkitBoxOrient: "vertical"
73
- }, children: o.description }) })
74
- ] })
75
- ] }), e[33] = d, e[34] = o, e[35] = g, e[36] = l, e[37] = b) : b = e[37], e[38] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(te, { orientation: "vertical", flexItem: !0 }), e[38] = y) : y = e[38], f = w, k = 1, _ = 0, e[39] === Symbol.for("react.memo_cache_sentinel") ? (j = /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", fontWeight: 600, sx: {
76
- textTransform: "uppercase",
77
- letterSpacing: "0.05em",
78
- display: "block",
79
- mb: 0.75
80
- }, children: "Latest Release" }), e[39] = j) : j = e[39], W = d ? /* @__PURE__ */ n(H, { variant: "rounded", height: 28 }) : R ? /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 1.5, minWidth: 0, children: [
81
- /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 0.5, sx: {
82
- flexShrink: 0
83
- }, children: [
84
- /* @__PURE__ */ n(xn, { size: 13 }),
85
- /* @__PURE__ */ u(I, { variant: "body2", color: "text.secondary", noWrap: !0, children: [
86
- "v",
87
- R.version
88
- ] })
89
- ] }),
90
- /* @__PURE__ */ n(I, { variant: "body2", color: "text.secondary", noWrap: !0, flex: 1, children: dt(new Date(R.createdAt), {
91
- addSuffix: !0
92
- }) }),
93
- (a || s) && /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", noWrap: !0, sx: {
94
- flexShrink: 0
95
- }, children: `Agent Type: ${[a, s].filter(Boolean).join("/")}` }),
96
- /* @__PURE__ */ n(ze, { size: "small", component: pe, to: g, children: /* @__PURE__ */ n(Ge, { size: 12 }) })
97
- ] }) : /* @__PURE__ */ n(I, { variant: "body2", color: "text.secondary", children: "No versions yet." }), e[6] = a, e[7] = d, e[8] = o, e[9] = g, e[10] = l, e[11] = s, e[12] = f, e[13] = c, e[14] = p, e[15] = h, e[16] = b, e[17] = y, e[18] = x, e[19] = N, e[20] = v, e[21] = S, e[22] = k, e[23] = _, e[24] = j, e[25] = W, e[26] = D, e[27] = C, e[28] = A;
98
- } else
99
- f = e[12], c = e[13], p = e[14], h = e[15], b = e[16], y = e[17], x = e[18], N = e[19], v = e[20], S = e[21], k = e[22], _ = e[23], j = e[24], W = e[25], D = e[26], C = e[27], A = e[28];
100
- let E;
101
- e[40] !== f || e[41] !== k || e[42] !== _ || e[43] !== j || e[44] !== W ? (E = /* @__PURE__ */ u(f, { flex: k, minWidth: _, children: [
102
- j,
103
- W
104
- ] }), e[40] = f, e[41] = k, e[42] = _, e[43] = j, e[44] = W, e[45] = E) : E = e[45];
105
- let $;
106
- e[46] !== c || e[47] !== b || e[48] !== y || e[49] !== E || e[50] !== D || e[51] !== C || e[52] !== A ? ($ = /* @__PURE__ */ u(c, { display: D, gap: C, minWidth: A, children: [
107
- b,
108
- y,
109
- E
110
- ] }), e[46] = c, e[47] = b, e[48] = y, e[49] = E, e[50] = D, e[51] = C, e[52] = A, e[53] = $) : $ = e[53];
111
- let M;
112
- e[54] !== p || e[55] !== x || e[56] !== N || e[57] !== v || e[58] !== $ ? (M = /* @__PURE__ */ u(p, { sx: x, children: [
113
- N,
114
- v,
115
- $
116
- ] }), e[54] = p, e[55] = x, e[56] = N, e[57] = v, e[58] = $, e[59] = M) : M = e[59];
117
- let L;
118
- return e[60] !== h || e[61] !== S || e[62] !== M ? (L = /* @__PURE__ */ n(h, { variant: S, children: M }), e[60] = h, e[61] = S, e[62] = M, e[63] = L) : L = e[63], L;
119
- }, Et = (t) => {
120
- const e = K(19), {
121
- percent: i,
122
- color: l,
123
- size: a
124
- } = t, s = a === void 0 ? 30 : a, r = ot(), o = s / 2, d = s * 0.43, m = s * 0.117, g = 2 * Math.PI * d, f = Number.isFinite(i) ? Math.min(Math.max(i, 0), 100) : 0, c = g * (1 - f / 100), p = `0 0 ${s} ${s}`;
125
- let h;
126
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (h = {
127
- display: "block"
128
- }, e[0] = h) : h = e[0];
129
- const b = r.vars?.palette?.action?.selected;
130
- let y;
131
- e[1] !== o || e[2] !== d || e[3] !== m || e[4] !== b ? (y = /* @__PURE__ */ n("circle", { cx: o, cy: o, r: d, fill: "none", stroke: b, strokeWidth: m }), e[1] = o, e[2] = d, e[3] = m, e[4] = b, e[5] = y) : y = e[5];
132
- const x = r.vars?.palette?.[l]?.main, N = `rotate(-90 ${o} ${o})`;
133
- let v;
134
- e[6] !== g || e[7] !== o || e[8] !== c || e[9] !== d || e[10] !== m || e[11] !== x || e[12] !== N ? (v = /* @__PURE__ */ n("circle", { cx: o, cy: o, r: d, fill: "none", stroke: x, strokeWidth: m, strokeDasharray: g, strokeDashoffset: c, strokeLinecap: "round", transform: N }), e[6] = g, e[7] = o, e[8] = c, e[9] = d, e[10] = m, e[11] = x, e[12] = N, e[13] = v) : v = e[13];
135
- let S;
136
- return e[14] !== s || e[15] !== p || e[16] !== y || e[17] !== v ? (S = /* @__PURE__ */ u("svg", { width: s, height: s, viewBox: p, style: h, children: [
137
- y,
138
- v
139
- ] }), e[14] = s, e[15] = p, e[16] = y, e[17] = v, e[18] = S) : S = e[18], S;
140
- }, Dn = (t) => {
141
- const e = t.map((i) => i.aggregations?.mean).filter((i) => typeof i == "number");
142
- return e.length === 0 ? null : e.reduce((i, l) => i + l, 0) / e.length;
143
- }, jn = (t) => !t || t <= 0 ? null : t < 60 ? `Runs every ${t} min${t === 1 ? "" : "s"}` : t === 60 ? "Runs hourly" : t === 1440 ? "Runs daily" : t % 1440 === 0 ? `Runs every ${t / 1440} days` : t % 60 === 0 ? `Runs every ${t / 60} hours` : `Runs every ${Math.floor(t / 60)}h ${t % 60}m`, Ln = (t) => t === null ? "primary" : t >= 70 ? "success" : t >= 40 ? "warning" : "error", Tn = (t) => {
144
- const e = K(50), {
145
- monitor: i,
146
- orgId: l,
147
- projectId: a,
148
- agentId: s,
149
- envId: r
150
- } = t;
151
- let o;
152
- e[0] !== s || e[1] !== i.name || e[2] !== l || e[3] !== a ? (o = {
153
- orgName: l,
154
- projName: a,
155
- agentName: s,
156
- monitorName: i.name
157
- }, e[0] = s, e[1] = i.name, e[2] = l, e[3] = a, e[4] = o) : o = e[4];
158
- let d;
159
- e[5] === Symbol.for("react.memo_cache_sentinel") ? (d = {
160
- timeRange: Ze.SEVEN_DAYS
161
- }, e[5] = d) : d = e[5];
162
- const {
163
- data: m,
164
- isLoading: g
165
- } = Ht(o, d);
166
- let f;
167
- e: {
168
- if (!m) {
169
- f = null;
170
- break e;
171
- }
172
- const B = Dn(m.evaluators);
173
- f = B !== null ? B * 100 : null;
174
- }
175
- const c = f;
176
- let p;
177
- e[6] !== s || e[7] !== r || e[8] !== i.name || e[9] !== l || e[10] !== a ? (p = le(ie.children.org.children.projects.children.agents.children.environment.children.evaluation.children.monitor.children.view.path, {
178
- orgId: l,
179
- projectId: a,
180
- agentId: s,
181
- envId: r,
182
- monitorId: i.name
183
- }), e[6] = s, e[7] = r, e[8] = i.name, e[9] = l, e[10] = a, e[11] = p) : p = e[11];
184
- const h = p;
185
- let b;
186
- e[12] !== i.evaluators ? (b = i.evaluators.map(zn).join(" · "), e[12] = i.evaluators, e[13] = b) : b = e[13];
187
- const y = b;
188
- let x;
189
- e[14] !== c ? (x = Ln(c), e[14] = c, e[15] = x) : x = e[15];
190
- const N = x;
191
- let v;
192
- e: {
193
- if (i.type === "past") {
194
- if (!i.traceStart || !i.traceEnd) {
195
- v = null;
196
- break e;
197
- }
198
- let O;
199
- e[16] !== i.traceEnd || e[17] !== i.traceStart ? (O = Ut(i.traceStart, i.traceEnd), e[16] = i.traceEnd, e[17] = i.traceStart, e[18] = O) : O = e[18], v = O;
200
- break e;
201
- }
202
- let B;
203
- e[19] !== i.intervalMinutes ? (B = jn(i.intervalMinutes), e[19] = i.intervalMinutes, e[20] = B) : B = e[20], v = B;
204
- }
205
- const S = v;
206
- let k;
207
- e[21] === Symbol.for("react.memo_cache_sentinel") ? (k = {
208
- display: "flex",
209
- alignItems: "center",
210
- gap: 2,
211
- "&:last-child": {
212
- pb: 1.5
213
- }
214
- }, e[21] = k) : k = e[21];
215
- let _;
216
- e[22] !== N || e[23] !== g || e[24] !== c ? (_ = g ? /* @__PURE__ */ n(H, { variant: "circular", width: 52, height: 52 }) : /* @__PURE__ */ n(Et, { percent: c ?? 0, color: N, size: 72 }), e[22] = N, e[23] = g, e[24] = c, e[25] = _) : _ = e[25];
217
- let j;
218
- e[26] !== g || e[27] !== c ? (j = g ? /* @__PURE__ */ n(H, { variant: "text", width: 48 }) : /* @__PURE__ */ n(I, { variant: "h6", lineHeight: 1.2, children: c !== null ? `${c.toFixed(2)}%` : "—" }), e[26] = g, e[27] = c, e[28] = j) : j = e[28];
219
- const W = i.displayName || i.name;
220
- let D;
221
- e[29] !== W ? (D = /* @__PURE__ */ n(I, { variant: "body2", noWrap: !0, fontWeight: 500, children: W }), e[29] = W, e[30] = D) : D = e[30];
222
- let C, A;
223
- e[31] === Symbol.for("react.memo_cache_sentinel") ? (C = {
224
- p: 0.25,
225
- flexShrink: 0
226
- }, A = /* @__PURE__ */ n(Ge, { size: 12 }), e[31] = C, e[32] = A) : (C = e[31], A = e[32]);
227
- let E;
228
- e[33] !== h ? (E = /* @__PURE__ */ n(ze, { size: "small", component: pe, to: h, sx: C, children: A }), e[33] = h, e[34] = E) : E = e[34];
229
- let $;
230
- e[35] !== D || e[36] !== E ? ($ = /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 0.5, minWidth: 0, children: [
231
- D,
232
- E
233
- ] }), e[35] = D, e[36] = E, e[37] = $) : $ = e[37];
234
- let M;
235
- e[38] !== y ? (M = y && /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", noWrap: !0, display: "block", title: y, children: y }), e[38] = y, e[39] = M) : M = e[39];
236
- let L;
237
- e[40] !== S ? (L = S && /* @__PURE__ */ n(I, { variant: "caption", color: "text.disabled", noWrap: !0, display: "block", title: S, children: S }), e[40] = S, e[41] = L) : L = e[41];
238
- let R;
239
- e[42] !== j || e[43] !== $ || e[44] !== M || e[45] !== L ? (R = /* @__PURE__ */ u(w, { minWidth: 0, flex: 1, overflow: "hidden", children: [
240
- j,
241
- $,
242
- M,
243
- L
244
- ] }), e[42] = j, e[43] = $, e[44] = M, e[45] = L, e[46] = R) : R = e[46];
245
- let T;
246
- return e[47] !== R || e[48] !== _ ? (T = /* @__PURE__ */ n(re, { variant: "outlined", children: /* @__PURE__ */ u(oe, { sx: k, children: [
247
- _,
248
- R
249
- ] }) }), e[47] = R, e[48] = _, e[49] = T) : T = e[49], T;
250
- }, Wt = (t) => {
251
- const e = K(30), {
252
- orgId: i,
253
- projectId: l,
254
- agentId: a,
255
- envId: s
256
- } = t;
257
- let r;
258
- e[0] !== a || e[1] !== i || e[2] !== l ? (r = {
259
- orgName: i,
260
- projName: l,
261
- agentName: a
262
- }, e[0] = a, e[1] = i, e[2] = l, e[3] = r) : r = e[3];
263
- let o;
264
- e[4] !== s ? (o = {
265
- environmentName: s
266
- }, e[4] = s, e[5] = o) : o = e[5];
267
- const {
268
- data: d,
269
- isLoading: m
270
- } = Ft(r, o);
271
- let g;
272
- e[6] !== d?.monitors ? (g = d?.monitors ?? [], e[6] = d?.monitors, e[7] = g) : g = e[7];
273
- const f = g;
274
- if (!m && f.length === 0)
275
- return null;
276
- let c;
277
- e[8] !== a || e[9] !== s || e[10] !== i || e[11] !== l ? (c = le(ie.children.org.children.projects.children.agents.children.environment.children.evaluation.children.monitor.path, {
278
- orgId: i,
279
- projectId: l,
280
- agentId: a,
281
- envId: s
282
- }), e[8] = a, e[9] = s, e[10] = i, e[11] = l, e[12] = c) : c = e[12];
283
- const p = c;
284
- let h;
285
- e[13] === Symbol.for("react.memo_cache_sentinel") ? (h = {
286
- display: "grid",
287
- gridTemplateColumns: {
288
- xs: "1fr",
289
- sm: "repeat(2, 1fr)",
290
- md: "repeat(3, 1fr)"
291
- },
292
- gap: 1.5
293
- }, e[13] = h) : h = e[13];
294
- const b = h;
295
- let y;
296
- e[14] === Symbol.for("react.memo_cache_sentinel") ? (y = /* @__PURE__ */ n(te, { sx: {
297
- mt: 2,
298
- mb: 1
299
- } }), e[14] = y) : y = e[14];
300
- let x;
301
- e[15] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", fontWeight: 600, sx: {
302
- textTransform: "uppercase",
303
- letterSpacing: "0.05em"
304
- }, children: "Agent Performance" }), e[15] = x) : x = e[15];
305
- let N;
306
- e[16] === Symbol.for("react.memo_cache_sentinel") ? (N = /* @__PURE__ */ n(Oe, { size: 14 }), e[16] = N) : N = e[16];
307
- let v;
308
- e[17] === Symbol.for("react.memo_cache_sentinel") ? (v = {
309
- minWidth: 0,
310
- fontSize: "0.75rem"
311
- }, e[17] = v) : v = e[17];
312
- let S;
313
- e[18] !== p ? (S = /* @__PURE__ */ u(w, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 0.5, children: [
314
- x,
315
- /* @__PURE__ */ n(ee, { size: "small", variant: "text", endIcon: N, component: pe, to: p, sx: v, children: "View all" })
316
- ] }), e[18] = p, e[19] = S) : S = e[19];
317
- let k;
318
- e[20] !== a || e[21] !== s || e[22] !== m || e[23] !== f || e[24] !== i || e[25] !== l ? (k = m ? /* @__PURE__ */ n(w, { sx: b, children: [1, 2, 3].map(En) }) : /* @__PURE__ */ n(w, { sx: b, children: f.map((j) => /* @__PURE__ */ n(Tn, { monitor: j, orgId: i, projectId: l, agentId: a, envId: s }, j.name)) }), e[20] = a, e[21] = s, e[22] = m, e[23] = f, e[24] = i, e[25] = l, e[26] = k) : k = e[26];
319
- let _;
320
- return e[27] !== S || e[28] !== k ? (_ = /* @__PURE__ */ u(se, { children: [
321
- y,
322
- S,
323
- k
324
- ] }), e[27] = S, e[28] = k, e[29] = _) : _ = e[29], _;
325
- };
326
- function zn(t) {
327
- return t.displayName;
328
- }
329
- function En(t) {
330
- return /* @__PURE__ */ n(H, { variant: "rounded", height: 96 }, t);
331
- }
332
- const ut = (t) => {
333
- const e = Math.round(t * 1e3);
334
- return e >= 1e3 ? `${(e / 1e3).toFixed(2)} cores` : `${e}m`;
335
- }, gt = (t) => t >= 1024 ** 3 ? `${(t / 1024 ** 3).toFixed(1)} GB` : t >= 1024 ** 2 ? `${(t / 1024 ** 2).toFixed(0)} MB` : `${Math.round(t / 1024)} KB`, Wn = (t) => t >= 1e3 ? `${(t / 1e3).toFixed(1)}k` : `${t}`, $n = (t) => {
336
- const e = t / 1e6;
337
- return e < 1e3 ? `${Math.round(e)}ms` : `${(e / 1e3).toFixed(1)}s`;
338
- }, Xe = (t) => {
339
- const e = K(17), {
340
- label: i,
341
- value: l,
342
- points: a,
343
- color: s,
344
- isLoading: r
345
- } = t, o = s === void 0 ? "currentColor" : s;
346
- let d;
347
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (d = {
348
- width: "100%"
349
- }, e[0] = d) : d = e[0];
350
- let m;
351
- e[1] === Symbol.for("react.memo_cache_sentinel") ? (m = {
352
- py: 1,
353
- px: 1.5,
354
- "&:last-child": {
355
- pb: 1
356
- },
357
- display: "flex",
358
- alignItems: "center",
359
- justifyContent: "space-between",
360
- gap: 1
361
- }, e[1] = m) : m = e[1];
362
- let g;
363
- e[2] !== r || e[3] !== l ? (g = r ? /* @__PURE__ */ n(H, { variant: "text", width: 48, height: 28 }) : /* @__PURE__ */ n(I, { variant: "h6", lineHeight: 1.2, children: l }), e[2] = r, e[3] = l, e[4] = g) : g = e[4];
364
- let f;
365
- e[5] !== i ? (f = /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", children: i }), e[5] = i, e[6] = f) : f = e[6];
366
- let c;
367
- e[7] !== g || e[8] !== f ? (c = /* @__PURE__ */ u(w, { children: [
368
- g,
369
- f
370
- ] }), e[7] = g, e[8] = f, e[9] = c) : c = e[9];
371
- let p;
372
- e[10] !== o || e[11] !== r || e[12] !== a ? (p = r ? /* @__PURE__ */ n(H, { variant: "rounded", width: 120, height: 48 }) : /* @__PURE__ */ n(An, { data: a, xAxisDataKey: "time", height: 48, width: 120, xAxis: {
373
- show: !1
374
- }, yAxis: {
375
- show: !1
376
- }, grid: {
377
- show: !1
378
- }, tooltip: {
379
- show: !1
380
- }, legend: {
381
- show: !1
382
- }, margin: {
383
- top: 4,
384
- right: 0,
385
- bottom: 0,
386
- left: 0
387
- }, areas: [{
388
- dataKey: "value",
389
- stroke: o,
390
- fill: o,
391
- fillOpacity: 0.15,
392
- dot: !1,
393
- activeDot: !1,
394
- connectNulls: !0,
395
- isAnimationActive: !1,
396
- type: "monotone"
397
- }] }), e[10] = o, e[11] = r, e[12] = a, e[13] = p) : p = e[13];
398
- let h;
399
- return e[14] !== c || e[15] !== p ? (h = /* @__PURE__ */ n(re, { variant: "outlined", sx: d, children: /* @__PURE__ */ u(oe, { sx: m, children: [
400
- c,
401
- p
402
- ] }) }), e[14] = c, e[15] = p, e[16] = h) : h = e[16], h;
403
- }, Mn = (t) => {
404
- const e = K(17), {
405
- label: i,
406
- value: l,
407
- percent: a,
408
- color: s,
409
- isLoading: r
410
- } = t;
411
- let o;
412
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (o = {
413
- width: "100%"
414
- }, e[0] = o) : o = e[0];
415
- let d;
416
- e[1] === Symbol.for("react.memo_cache_sentinel") ? (d = {
417
- py: 1,
418
- px: 1.5,
419
- "&:last-child": {
420
- pb: 1
421
- },
422
- display: "flex",
423
- alignItems: "center",
424
- justifyContent: "space-between",
425
- gap: 1
426
- }, e[1] = d) : d = e[1];
427
- let m;
428
- e[2] !== r || e[3] !== l ? (m = r ? /* @__PURE__ */ n(H, { variant: "text", width: 48, height: 28 }) : /* @__PURE__ */ n(I, { variant: "h6", lineHeight: 1.2, children: l }), e[2] = r, e[3] = l, e[4] = m) : m = e[4];
429
- let g;
430
- e[5] !== i ? (g = /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", children: i }), e[5] = i, e[6] = g) : g = e[6];
431
- let f;
432
- e[7] !== m || e[8] !== g ? (f = /* @__PURE__ */ u(w, { children: [
433
- m,
434
- g
435
- ] }), e[7] = m, e[8] = g, e[9] = f) : f = e[9];
436
- let c;
437
- e[10] !== s || e[11] !== r || e[12] !== a ? (c = r ? /* @__PURE__ */ n(H, { variant: "circular", width: 48, height: 48 }) : /* @__PURE__ */ n(Et, { percent: a, color: s, size: 48 }), e[10] = s, e[11] = r, e[12] = a, e[13] = c) : c = e[13];
438
- let p;
439
- return e[14] !== f || e[15] !== c ? (p = /* @__PURE__ */ n(re, { variant: "outlined", sx: o, children: /* @__PURE__ */ u(oe, { sx: d, children: [
440
- f,
441
- c
442
- ] }) }), e[14] = f, e[15] = c, e[16] = p) : p = e[16], p;
443
- }, yt = (t) => {
444
- const e = K(20), {
445
- label: i,
446
- value: l,
447
- limit: a,
448
- percent: s,
449
- isLoading: r
450
- } = t, o = ot(), d = Math.min(s ?? 0, 100), m = d >= 85 ? o.vars?.palette?.error?.main : d >= 60 ? o.vars?.palette?.warning?.main : o.vars?.palette?.success?.main;
451
- let g;
452
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (g = {
453
- width: "100%"
454
- }, e[0] = g) : g = e[0];
455
- let f;
456
- e[1] === Symbol.for("react.memo_cache_sentinel") ? (f = {
457
- py: 0.75,
458
- px: 1.5,
459
- "&:last-child": {
460
- pb: 0.75
461
- }
462
- }, e[1] = f) : f = e[1];
463
- let c;
464
- e[2] !== i ? (c = /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", children: i }), e[2] = i, e[3] = c) : c = e[3];
465
- let p;
466
- e[4] !== m || e[5] !== r || e[6] !== a || e[7] !== s || e[8] !== l ? (p = r ? /* @__PURE__ */ n(H, { variant: "text", width: 60, height: 18 }) : /* @__PURE__ */ u(w, { display: "flex", alignItems: "baseline", gap: 0.5, children: [
467
- /* @__PURE__ */ n(I, { variant: "caption", fontWeight: 600, color: "text.primary", children: l }),
468
- a && /* @__PURE__ */ u(I, { variant: "caption", color: "text.disabled", children: [
469
- "/ ",
470
- a
471
- ] }),
472
- s !== null && /* @__PURE__ */ u(I, { variant: "caption", fontWeight: 600, sx: {
473
- color: m
474
- }, children: [
475
- Math.round(s),
476
- "%"
477
- ] })
478
- ] }), e[4] = m, e[5] = r, e[6] = a, e[7] = s, e[8] = l, e[9] = p) : p = e[9];
479
- let h;
480
- e[10] !== c || e[11] !== p ? (h = /* @__PURE__ */ u(w, { display: "flex", justifyContent: "space-between", alignItems: "baseline", mb: 0.5, children: [
481
- c,
482
- p
483
- ] }), e[10] = c, e[11] = p, e[12] = h) : h = e[12];
484
- let b;
485
- e[13] !== m || e[14] !== r || e[15] !== d ? (b = r ? /* @__PURE__ */ n(H, { variant: "rounded", height: 4 }) : /* @__PURE__ */ n(w, { sx: {
486
- height: 4,
487
- borderRadius: 2,
488
- bgcolor: "action.selected",
489
- overflow: "hidden"
490
- }, children: /* @__PURE__ */ n(w, { sx: {
491
- height: "100%",
492
- width: `${d}%`,
493
- bgcolor: m,
494
- borderRadius: 2,
495
- transition: "width 0.4s ease"
496
- } }) }), e[13] = m, e[14] = r, e[15] = d, e[16] = b) : b = e[16];
497
- let y;
498
- return e[17] !== h || e[18] !== b ? (y = /* @__PURE__ */ n(re, { variant: "outlined", sx: g, children: /* @__PURE__ */ u(oe, { sx: f, children: [
499
- h,
500
- b
501
- ] }) }), e[17] = h, e[18] = b, e[19] = y) : y = e[19], y;
502
- }, $t = ({
503
- orgId: t,
504
- projectId: e,
505
- agentId: i,
506
- envId: l,
507
- hideMetrics: a = !1,
508
- external: s = !1
509
- }) => {
510
- const r = ot(), {
511
- data: o
512
- } = Kt({
513
- orgName: t,
514
- projName: e,
515
- agentName: i
516
- }, {
517
- enabled: !s
518
- }), d = o?.[l]?.status, m = !s && d === "suspended", f = !s && !(d === "active" || d === "error" || d === "failed" || d === "suspended"), {
519
- data: c,
520
- isLoading: p
521
- } = Vt({
522
- agentName: i,
523
- orgName: t,
524
- projName: e
525
- }, {
526
- environmentName: l
527
- }, {
528
- enabled: !a && !m && !f,
529
- enableAutoRefresh: !0,
530
- timeRange: Ze.ONE_HOUR
531
- }), {
532
- traceList: h,
533
- isLoading: b
534
- } = qt(t, e, i, l, Ze.ONE_DAY, 10, "desc", void 0, void 0, {
535
- enableAutoRefresh: !0,
536
- enabled: !f
537
- }), y = c?.cpuUsage ?? [], x = y.length ? y[y.length - 1].value : null, N = c?.cpuLimits ?? [], v = N.length ? N[N.length - 1].value : null, S = x !== null && v ? x / v * 100 : null, k = c?.memory ?? [], _ = k.length ? k[k.length - 1].value : null, j = c?.memoryLimits ?? [], W = j.length ? j[j.length - 1].value : null, D = _ !== null && W ? _ / W * 100 : null, C = ae(() => h?.traces ?? [], [h]), A = ae(() => [...C].reverse().map((z) => ({
538
- time: Be(new Date(z.startTime), "HH:mm"),
539
- value: Math.round(z.durationInNanos / 1e6)
540
- })), [C]), E = C.length ? C.reduce((z, F) => z + F.durationInNanos, 0) / C.length : null, $ = ae(() => [...C].reverse().filter((z) => z.tokenUsage?.totalTokens != null).map((z) => ({
541
- time: Be(new Date(z.startTime), "HH:mm"),
542
- value: z.tokenUsage.totalTokens
543
- })), [C]), M = (() => {
544
- const z = C.filter((F) => F.tokenUsage?.totalTokens != null);
545
- return z.length ? Math.round(z.reduce((F, P) => F + (P.tokenUsage?.totalTokens ?? 0), 0) / z.length) : null;
546
- })(), L = ae(() => [...C].reverse().filter((z) => z.score?.score != null).map((z) => ({
547
- time: Be(new Date(z.startTime), "HH:mm"),
548
- value: Math.round(z.score.score * 100)
549
- })), [C]), R = (() => {
550
- const z = C.filter((F) => F.score?.score != null);
551
- return z.length ? z.reduce((F, P) => F + (P.score?.score ?? 0), 0) / z.length : null;
552
- })(), T = C.length ? C.filter((z) => (z.status?.errorCount ?? 0) === 0).length / C.length * 100 : null, B = T === null ? "primary" : T >= 70 ? "success" : T >= 40 ? "warning" : "error", O = le(ie.children.org.children.projects.children.agents.children.environment.children.observability.children.traces.path, {
553
- orgId: t,
554
- projectId: e,
555
- agentId: i,
556
- envId: l
557
- }), G = le(ie.children.org.children.projects.children.agents.children.environment.children.observability.children.metrics.path, {
558
- orgId: t,
559
- projectId: e,
560
- agentId: i,
561
- envId: l
562
- });
563
- return f ? null : /* @__PURE__ */ u(se, { children: [
564
- /* @__PURE__ */ n(te, { sx: {
565
- mt: 2,
566
- mb: 1
567
- } }),
568
- /* @__PURE__ */ u(w, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 0.5, children: [
569
- /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", fontWeight: 600, sx: {
570
- textTransform: "uppercase",
571
- letterSpacing: "0.05em"
572
- }, children: "Recent Traces" }),
573
- /* @__PURE__ */ n(ee, { size: "small", variant: "text", endIcon: /* @__PURE__ */ n(Oe, { size: 14 }), component: pe, to: O, sx: {
574
- minWidth: 0,
575
- fontSize: "0.75rem"
576
- }, children: "View all" })
577
- ] }),
578
- /* @__PURE__ */ u(We, { container: !0, spacing: 1.5, children: [
579
- /* @__PURE__ */ n(We, { size: {
580
- xs: 12,
581
- sm: 6,
582
- lg: 3
583
- }, children: /* @__PURE__ */ n(Xe, { label: "Avg Latency", value: E !== null ? $n(E) : "—", points: A, color: r.vars?.palette?.info?.main, isLoading: b }) }),
584
- /* @__PURE__ */ n(We, { size: {
585
- xs: 12,
586
- sm: 6,
587
- lg: 3
588
- }, children: /* @__PURE__ */ n(Xe, { label: "Avg Tokens", value: M !== null ? Wn(M) : "—", points: $, color: r.vars?.palette?.warning?.main, isLoading: b }) }),
589
- R !== null && /* @__PURE__ */ n(We, { size: {
590
- xs: 12,
591
- sm: 6,
592
- lg: 3
593
- }, children: /* @__PURE__ */ n(Xe, { label: "Avg Score", value: `${(R * 100).toFixed(1)}%`, points: L, color: r.vars?.palette?.success?.main, isLoading: b }) }),
594
- /* @__PURE__ */ n(We, { size: {
595
- xs: 12,
596
- sm: 6,
597
- lg: 3
598
- }, children: /* @__PURE__ */ n(Mn, { label: "Success Rate", value: T !== null ? `${T.toFixed(1)}%` : "—", percent: T ?? 0, color: B, isLoading: b }) })
599
- ] }),
600
- !a && (m ? /* @__PURE__ */ n(et, { icon: /* @__PURE__ */ n(vn, { size: 32 }), message: "Environment Suspended", subtitle: "Metrics are unavailable while the environment is suspended.", disableBackground: !0 }) : /* @__PURE__ */ u(se, { children: [
601
- /* @__PURE__ */ n(te, { sx: {
602
- mt: 1.5,
603
- mb: 1
604
- } }),
605
- /* @__PURE__ */ u(w, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 1, children: [
606
- /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", fontWeight: 600, sx: {
607
- textTransform: "uppercase",
608
- letterSpacing: "0.05em"
609
- }, children: "System Metrics" }),
610
- /* @__PURE__ */ n(ee, { size: "small", variant: "text", endIcon: /* @__PURE__ */ n(Oe, { size: 14 }), component: pe, to: G, sx: {
611
- minWidth: 0,
612
- fontSize: "0.75rem"
613
- }, children: "View all" })
614
- ] }),
615
- /* @__PURE__ */ u(J, { direction: "row", spacing: 0.75, sx: {
616
- maxWidth: 400
617
- }, children: [
618
- /* @__PURE__ */ n(yt, { label: "CPU", value: x !== null ? ut(x) : "—", limit: v !== null ? ut(v) : null, percent: S, isLoading: p }),
619
- /* @__PURE__ */ n(yt, { label: "Memory", value: _ !== null ? gt(_) : "—", limit: W !== null ? gt(W) : null, percent: D, isLoading: p })
620
- ] })
621
- ] }))
622
- ] });
623
- }, Rn = (t) => {
624
- const e = K(39), {
625
- orgId: i,
626
- projectId: l,
627
- agentId: a,
628
- repository: s,
629
- latestBuild: r,
630
- isBuildsLoading: o,
631
- framework: d,
632
- model: m,
633
- build: g
634
- } = t;
635
- let f;
636
- e: {
637
- if (!g) {
638
- f = null;
639
- break e;
640
- }
641
- if (g.type === "buildpack") {
642
- const {
643
- language: G,
644
- languageVersion: z
645
- } = g.buildpack;
646
- f = z ? `${G} ${z}` : G;
647
- break e;
648
- }
649
- f = "Docker";
650
- }
651
- const c = f;
652
- let p;
653
- e[0] !== a || e[1] !== i || e[2] !== l ? (p = le(ie.children.org.children.projects.children.agents.children.build.path, {
654
- orgId: i,
655
- projectId: l,
656
- agentId: a
657
- }), e[0] = a, e[1] = i, e[2] = l, e[3] = p) : p = e[3];
658
- const h = p;
659
- let b;
660
- e[4] !== s ? (b = s ? (() => {
661
- const {
662
- url: G,
663
- branch: z,
664
- appPath: F
665
- } = s;
666
- if (F && F !== "/") {
667
- const P = F.startsWith("/") ? F.substring(1) : F;
668
- return `${G}/tree/${z}/${P}`;
669
- }
670
- return `${G}/tree/${z}`;
671
- })() : null, e[4] = s, e[5] = b) : b = e[5];
672
- const y = b, x = Bn;
673
- let N;
674
- e[6] === Symbol.for("react.memo_cache_sentinel") ? (N = {
675
- py: 1.5,
676
- "&:last-child": {
677
- pb: 1.5
678
- }
679
- }, e[6] = N) : N = e[6];
680
- let v;
681
- e[7] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ n(w, { pb: 1, children: /* @__PURE__ */ n(I, { variant: "h6", children: "Source & Build" }) }), e[7] = v) : v = e[7];
682
- let S;
683
- e[8] === Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ n(te, { sx: {
684
- mb: 1.5
685
- } }), e[8] = S) : S = e[8];
686
- let k;
687
- e[9] === Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", fontWeight: 600, sx: {
688
- textTransform: "uppercase",
689
- letterSpacing: "0.05em",
690
- display: "block",
691
- mb: 0.75
692
- }, children: "Repository" }), e[9] = k) : k = e[9];
693
- let _;
694
- e[10] === Symbol.for("react.memo_cache_sentinel") ? (_ = /* @__PURE__ */ n(Sn, { size: 14, style: {
695
- flexShrink: 0
696
- } }), e[10] = _) : _ = e[10];
697
- const j = y ?? "—";
698
- let W;
699
- e[11] !== j ? (W = /* @__PURE__ */ n(I, { variant: "body2", noWrap: !0, children: j }), e[11] = j, e[12] = W) : W = e[12];
700
- let D;
701
- e[13] !== y ? (D = y && /* @__PURE__ */ n(ze, { size: "small", component: "a", href: y, target: "_blank", rel: "noopener noreferrer", sx: {
702
- p: 0.25,
703
- flexShrink: 0
704
- }, children: /* @__PURE__ */ n(Ge, { size: 12 }) }), e[13] = y, e[14] = D) : D = e[14];
705
- let C;
706
- e[15] !== W || e[16] !== D ? (C = /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 0.5, minWidth: 0, children: [
707
- _,
708
- W,
709
- D
710
- ] }), e[15] = W, e[16] = D, e[17] = C) : C = e[17];
711
- let A;
712
- e[18] !== c || e[19] !== d || e[20] !== m ? (A = (d || m || c) && /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", noWrap: !0, display: "block", mt: 0.25, children: [(d || m) && `Agent Type: ${[d, m].filter(Boolean).join("/")}`, c && `Language: ${c}`].filter(Boolean).join(" · ") }), e[18] = c, e[19] = d, e[20] = m, e[21] = A) : A = e[21];
713
- let E;
714
- e[22] !== C || e[23] !== A ? (E = /* @__PURE__ */ u(w, { flex: 1, minWidth: 0, children: [
715
- k,
716
- C,
717
- A
718
- ] }), e[22] = C, e[23] = A, e[24] = E) : E = e[24];
719
- let $;
720
- e[25] === Symbol.for("react.memo_cache_sentinel") ? ($ = /* @__PURE__ */ n(te, { orientation: "vertical", flexItem: !0 }), e[25] = $) : $ = e[25];
721
- let M;
722
- e[26] === Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", fontWeight: 600, sx: {
723
- textTransform: "uppercase",
724
- letterSpacing: "0.05em"
725
- }, children: "Latest Build" }), e[26] = M) : M = e[26];
726
- let L;
727
- e[27] === Symbol.for("react.memo_cache_sentinel") ? (L = /* @__PURE__ */ n(Oe, { size: 12 }), e[27] = L) : L = e[27];
728
- let R;
729
- e[28] !== h ? (R = /* @__PURE__ */ u(w, { display: "flex", justifyContent: "space-between", alignItems: "center", mb: 0.75, children: [
730
- M,
731
- /* @__PURE__ */ n(ee, { size: "small", variant: "text", endIcon: L, component: pe, to: h, children: "View all" })
732
- ] }), e[28] = h, e[29] = R) : R = e[29];
733
- let T;
734
- e[30] !== o || e[31] !== r ? (T = o ? /* @__PURE__ */ n(H, { variant: "rounded", height: 28 }) : r ? /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 1.5, minWidth: 0, children: [
735
- /* @__PURE__ */ u(I, { variant: "body2", color: "text.secondary", noWrap: !0, sx: {
736
- flexShrink: 0
737
- }, children: [
738
- r.buildParameters?.branch,
739
- " :"
740
- ] }),
741
- /* @__PURE__ */ n(I, { variant: "body2", noWrap: !0, flex: 1, children: r.buildName }),
742
- /* @__PURE__ */ n(I, { variant: "body2", color: "text.secondary", noWrap: !0, sx: {
743
- flexShrink: 0
744
- }, children: Be(new Date(r.startedAt), "dd/MM/yyyy HH:mm:ss") }),
745
- /* @__PURE__ */ n($e, { label: r.status, size: "small", color: Xt[r.status] ?? "default", variant: "outlined", icon: x(r.status), sx: {
746
- flexShrink: 0
747
- } })
748
- ] }) : /* @__PURE__ */ n(I, { variant: "body2", color: "text.secondary", children: "No builds yet." }), e[30] = o, e[31] = r, e[32] = T) : T = e[32];
749
- let B;
750
- e[33] !== R || e[34] !== T ? (B = /* @__PURE__ */ u(w, { flex: 1, minWidth: 0, children: [
751
- R,
752
- T
753
- ] }), e[33] = R, e[34] = T, e[35] = B) : B = e[35];
754
- let O;
755
- return e[36] !== E || e[37] !== B ? (O = /* @__PURE__ */ n(re, { variant: "outlined", children: /* @__PURE__ */ u(oe, { sx: N, children: [
756
- v,
757
- S,
758
- /* @__PURE__ */ u(w, { display: "flex", gap: 2, minWidth: 0, children: [
759
- E,
760
- $,
761
- B
762
- ] })
763
- ] }) }), e[36] = E, e[37] = B, e[38] = O) : O = e[38], O;
764
- };
765
- function Bn(t) {
766
- if (t)
767
- return t === "Running" || t === "Pending" ? /* @__PURE__ */ n(st, { size: 12, color: "inherit" }) : t === "Failed" ? /* @__PURE__ */ n(wn, { size: 14 }) : /* @__PURE__ */ n(Nn, { size: 14 });
768
- }
769
- const Gn = () => {
770
- const t = K(30), {
771
- orgId: e,
772
- agentId: i,
773
- projectId: l
774
- } = ge();
775
- let a;
776
- t[0] !== i || t[1] !== e || t[2] !== l ? (a = {
777
- orgName: e,
778
- projName: l,
779
- agentName: i
780
- }, t[0] = i, t[1] = e, t[2] = l, t[3] = a) : a = t[3];
781
- const {
782
- data: s
783
- } = tt(a);
784
- let r;
785
- t[4] !== i || t[5] !== e || t[6] !== l ? (r = {
786
- orgName: e,
787
- projName: l,
788
- agentName: i
789
- }, t[4] = i, t[5] = e, t[6] = l, t[7] = r) : r = t[7];
790
- const {
791
- data: o,
792
- isLoading: d
793
- } = Yt(r), m = Jt(e, l), g = !!s?.kindName;
794
- let f;
795
- t[8] !== s || t[9] !== i || t[10] !== o?.builds || t[11] !== d || t[12] !== g || t[13] !== e || t[14] !== l ? (f = g ? /* @__PURE__ */ n(kn, { orgId: e ?? "", kindName: s.kindName, framework: s?.agentType?.type, model: s?.agentType?.subType }) : e && l && i && /* @__PURE__ */ n(Rn, { orgId: e, projectId: l, agentId: i, repository: s?.provisioning?.repository, latestBuild: o?.builds[0], isBuildsLoading: d, framework: s?.agentType?.type, model: s?.agentType?.subType, build: s?.build }), t[8] = s, t[9] = i, t[10] = o?.builds, t[11] = d, t[12] = g, t[13] = e, t[14] = l, t[15] = f) : f = t[15];
796
- let c;
797
- if (t[16] !== i || t[17] !== e || t[18] !== l || t[19] !== m) {
798
- let b;
799
- t[21] !== i || t[22] !== e || t[23] !== l ? (b = (y, x) => y && e && l && i && /* @__PURE__ */ n(Lt, { orgId: e, projectId: l, agentId: i, environment: y, isFirstEnvironment: x === 0, bottomContent: /* @__PURE__ */ u(se, { children: [
800
- /* @__PURE__ */ n($t, { orgId: e, projectId: l, agentId: i, envId: y.name }),
801
- /* @__PURE__ */ n(Wt, { orgId: e, projectId: l, agentId: i, envId: y.name })
802
- ] }) }, y.name), t[21] = i, t[22] = e, t[23] = l, t[24] = b) : b = t[24], c = m.map(b), t[16] = i, t[17] = e, t[18] = l, t[19] = m, t[20] = c;
803
- } else
804
- c = t[20];
805
- let p;
806
- t[25] !== c ? (p = /* @__PURE__ */ n(J, { spacing: 2, children: c }), t[25] = c, t[26] = p) : p = t[26];
807
- let h;
808
- return t[27] !== f || t[28] !== p ? (h = /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 2, children: [
809
- f,
810
- p
811
- ] }), t[27] = f, t[28] = p, t[29] = h) : h = t[29], h;
812
- }, ye = (t) => {
813
- const e = K(18), {
814
- stepNumber: i,
815
- title: l,
816
- description: a,
817
- code: s,
818
- language: r,
819
- fieldId: o
820
- } = t, d = r === void 0 ? "bash" : r;
821
- let m;
822
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (m = {
823
- gap: 2,
824
- width: 20,
825
- height: 20,
826
- borderRadius: "50%",
827
- display: "flex",
828
- alignItems: "center",
829
- justifyContent: "center",
830
- bgcolor: On,
831
- color: "primary.contrastText",
832
- fontWeight: 600
833
- }, e[0] = m) : m = e[0];
834
- let g;
835
- e[1] !== i ? (g = /* @__PURE__ */ n(w, { sx: m, children: /* @__PURE__ */ n(I, { variant: "body2", fontWeight: 600, children: i }) }), e[1] = i, e[2] = g) : g = e[2];
836
- let f;
837
- e[3] !== l ? (f = /* @__PURE__ */ n(I, { variant: "body1", children: l }), e[3] = l, e[4] = f) : f = e[4];
838
- let c;
839
- e[5] !== g || e[6] !== f ? (c = /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 1, children: [
840
- g,
841
- f
842
- ] }), e[5] = g, e[6] = f, e[7] = c) : c = e[7];
843
- let p;
844
- e[8] !== s || e[9] !== o || e[10] !== d ? (p = /* @__PURE__ */ n(w, { children: /* @__PURE__ */ n(Tt, { code: s, language: d, fieldId: o }) }), e[8] = s, e[9] = o, e[10] = d, e[11] = p) : p = e[11];
845
- let h;
846
- e[12] !== a ? (h = a && /* @__PURE__ */ n(I, { variant: "body2", color: "textSecondary", children: a }), e[12] = a, e[13] = h) : h = e[13];
847
- let b;
848
- return e[14] !== c || e[15] !== p || e[16] !== h ? (b = /* @__PURE__ */ u(w, { display: "flex", gap: 1, flexDirection: "column", children: [
849
- c,
850
- p,
851
- h
852
- ] }), e[14] = c, e[15] = p, e[16] = h, e[17] = b) : b = e[17], b;
853
- };
854
- function On(t) {
855
- return t.palette.primary.main;
856
- }
857
- const Fn = [{
858
- label: "30 days",
859
- value: "720h"
860
- }, {
861
- label: "90 days",
862
- value: "2160h"
863
- }, {
864
- label: "6 months",
865
- value: "4320h"
866
- }, {
867
- label: "1 year",
868
- value: "8760h"
869
- }, {
870
- label: "2 years",
871
- value: "17520h"
872
- }], bt = (t) => {
873
- const e = K(55), {
874
- stepNumber: i,
875
- orgName: l,
876
- projName: a,
877
- agentName: s,
878
- environment: r,
879
- onTokenGenerated: o
880
- } = t, [d, m] = ne("8760h");
881
- let g;
882
- e[0] !== s || e[1] !== l || e[2] !== a ? (g = {
883
- agentName: s,
884
- projName: a,
885
- orgName: l
886
- }, e[0] = s, e[1] = l, e[2] = a, e[3] = g) : g = e[3];
887
- let f;
888
- e[4] !== d ? (f = {
889
- expires_in: d
890
- }, e[4] = d, e[5] = f) : f = e[5];
891
- let c;
892
- e[6] !== r ? (c = r ? {
893
- environment: r
894
- } : void 0, e[6] = r, e[7] = c) : c = e[7];
895
- const {
896
- data: p,
897
- isFetching: h,
898
- error: b,
899
- refetch: y
900
- } = Zt(g, f, c);
901
- let x;
902
- e[8] !== p || e[9] !== o ? (x = () => {
903
- p?.token && o(p.token);
904
- }, e[8] = p, e[9] = o, e[10] = x) : x = e[10];
905
- const N = p?.token;
906
- let v;
907
- e[11] !== o || e[12] !== N ? (v = [N, o], e[11] = o, e[12] = N, e[13] = v) : v = e[13], xe(x, v);
908
- const k = `${p?.token || "ey***"}`;
909
- let _;
910
- e[14] === Symbol.for("react.memo_cache_sentinel") ? (_ = {
911
- gap: 2,
912
- width: 20,
913
- height: 20,
914
- borderRadius: "50%",
915
- display: "flex",
916
- alignItems: "center",
917
- justifyContent: "center",
918
- bgcolor: Hn,
919
- color: "primary.contrastText",
920
- fontWeight: 600
921
- }, e[14] = _) : _ = e[14];
922
- let j;
923
- e[15] !== i ? (j = /* @__PURE__ */ n(w, { sx: _, children: /* @__PURE__ */ n(I, { variant: "body2", fontWeight: 600, children: i }) }), e[15] = i, e[16] = j) : j = e[16];
924
- let W;
925
- e[17] === Symbol.for("react.memo_cache_sentinel") ? (W = /* @__PURE__ */ n(I, { variant: "body1", children: "Generate API Key" }), e[17] = W) : W = e[17];
926
- let D;
927
- e[18] !== j ? (D = /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 1, children: [
928
- j,
929
- W
930
- ] }), e[18] = j, e[19] = D) : D = e[19];
931
- let C;
932
- e[20] === Symbol.for("react.memo_cache_sentinel") ? (C = /* @__PURE__ */ n(I, { variant: "body2", color: "textSecondary", children: "Token Duration" }), e[20] = C) : C = e[20];
933
- let A;
934
- e[21] === Symbol.for("react.memo_cache_sentinel") ? (A = (Y) => m(Y.target.value), e[21] = A) : A = e[21];
935
- let E, $;
936
- e[22] === Symbol.for("react.memo_cache_sentinel") ? (E = {
937
- minWidth: 100
938
- }, $ = Fn.map(Un), e[22] = E, e[23] = $) : (E = e[22], $ = e[23]);
939
- let M;
940
- e[24] !== d || e[25] !== h ? (M = /* @__PURE__ */ n(ct, { value: d, onChange: A, size: "small", disabled: h, sx: E, children: $ }), e[24] = d, e[25] = h, e[26] = M) : M = e[26];
941
- let L;
942
- e[27] !== y ? (L = () => y(), e[27] = y, e[28] = L) : L = e[28];
943
- let R;
944
- e[29] !== h ? (R = h ? /* @__PURE__ */ n(st, { size: 16 }) : void 0, e[29] = h, e[30] = R) : R = e[30];
945
- const T = h ? "Generating..." : p?.token ? "Generated" : "Generate";
946
- let B;
947
- e[31] !== h || e[32] !== L || e[33] !== R || e[34] !== T ? (B = /* @__PURE__ */ n(ee, { variant: "contained", onClick: L, disabled: h, startIcon: R, size: "small", children: T }), e[31] = h, e[32] = L, e[33] = R, e[34] = T, e[35] = B) : B = e[35];
948
- let O;
949
- e[36] !== M || e[37] !== B ? (O = /* @__PURE__ */ u(w, { display: "flex", gap: 1, alignItems: "center", children: [
950
- C,
951
- M,
952
- B
953
- ] }), e[36] = M, e[37] = B, e[38] = O) : O = e[38];
954
- let G;
955
- e[39] !== D || e[40] !== O ? (G = /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 1, justifyContent: "space-between", children: [
956
- D,
957
- O
958
- ] }), e[39] = D, e[40] = O, e[41] = G) : G = e[41];
959
- let z;
960
- e[42] !== b ? (z = b ? /* @__PURE__ */ n(I, { variant: "body2", color: "error", children: "Failed to generate token. Please try again." }) : null, e[42] = b, e[43] = z) : z = e[43];
961
- let F;
962
- e[44] !== k ? (F = /* @__PURE__ */ n(Tt, { code: k, language: "bash", fieldId: "api-key" }), e[44] = k, e[45] = F) : F = e[45];
963
- const P = p?.token ? "Token generated successfully. Copy it now as you won't be able to see it again." : "Generate a token to authenticate your traces.";
964
- let U;
965
- e[46] !== P ? (U = /* @__PURE__ */ n(I, { variant: "body2", color: "textSecondary", children: P }), e[46] = P, e[47] = U) : U = e[47];
966
- let V;
967
- e[48] !== z || e[49] !== F || e[50] !== U ? (V = /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 1, children: [
968
- z,
969
- F,
970
- U
971
- ] }), e[48] = z, e[49] = F, e[50] = U, e[51] = V) : V = e[51];
972
- let X;
973
- return e[52] !== G || e[53] !== V ? (X = /* @__PURE__ */ u(w, { display: "flex", gap: 1, flexDirection: "column", children: [
974
- G,
975
- V
976
- ] }), e[52] = G, e[53] = V, e[54] = X) : X = e[54], X;
977
- };
978
- function Hn(t) {
979
- return t.palette.primary.main;
980
- }
981
- function Un(t) {
982
- return /* @__PURE__ */ n(ue, { value: t.value, children: t.label }, t.value);
983
- }
984
- const Kn = (t) => {
985
- const e = K(27), {
986
- open: i,
987
- onClose: l,
988
- orgName: a,
989
- projName: s,
990
- agentName: r,
991
- environment: o,
992
- instrumentationUrl: d,
993
- apiKey: m
994
- } = t, [g, f] = ne(null), [c, p] = ne("python"), h = g || m;
995
- let b;
996
- e[0] === Symbol.for("react.memo_cache_sentinel") ? (b = (E) => {
997
- p(E.target.value);
998
- }, e[0] = b) : b = e[0];
999
- const y = b;
1000
- let x;
1001
- e[1] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ n(At, { size: 24 }), e[1] = x) : x = e[1];
1002
- let N;
1003
- e[2] !== l ? (N = /* @__PURE__ */ n(nt, { icon: x, title: "Setup Agent", onClose: l }), e[2] = l, e[3] = N) : N = e[3];
1004
- let v;
1005
- e[4] === Symbol.for("react.memo_cache_sentinel") ? (v = /* @__PURE__ */ n(I, { variant: "h5", children: "Zero-code Instrumentation Guide" }), e[4] = v) : v = e[4];
1006
- let S;
1007
- e[5] === Symbol.for("react.memo_cache_sentinel") ? (S = /* @__PURE__ */ n(I, { variant: "body2", children: "Language:" }), e[5] = S) : S = e[5];
1008
- let k, _;
1009
- e[6] === Symbol.for("react.memo_cache_sentinel") ? (k = /* @__PURE__ */ n(ue, { value: "python", children: "Python" }), _ = /* @__PURE__ */ n(ue, { value: "ballerina", children: "Ballerina" }), e[6] = k, e[7] = _) : (k = e[6], _ = e[7]);
1010
- let j;
1011
- e[8] !== c ? (j = /* @__PURE__ */ u(J, { direction: "row", justifyContent: "space-between", alignItems: "center", children: [
1012
- v,
1013
- /* @__PURE__ */ u(J, { direction: "row", alignItems: "center", gap: 1, children: [
1014
- S,
1015
- /* @__PURE__ */ u(ct, { value: c, onChange: y, children: [
1016
- k,
1017
- _
1018
- ] })
1019
- ] })
1020
- ] }), e[8] = c, e[9] = j) : j = e[9];
1021
- let W;
1022
- e[10] === Symbol.for("react.memo_cache_sentinel") ? (W = {
1023
- display: "flex",
1024
- flexDirection: "column",
1025
- gap: 2,
1026
- pt: 1,
1027
- width: "100%"
1028
- }, e[10] = W) : W = e[10];
1029
- let D;
1030
- e[11] !== r || e[12] !== h || e[13] !== o || e[14] !== d || e[15] !== a || e[16] !== s || e[17] !== c ? (D = /* @__PURE__ */ n(w, { sx: W, children: c === "python" ? /* @__PURE__ */ u(se, { children: [
1031
- /* @__PURE__ */ n(ye, { stepNumber: 1, title: "Install AMP Instrumentation Package", code: "pip install amp-instrumentation", language: "bash", fieldId: "install", description: "Provides the ability to instrument your agent and export traces." }),
1032
- /* @__PURE__ */ n(bt, { stepNumber: 2, orgName: a, projName: s, agentName: r, environment: o, onTokenGenerated: f }),
1033
- /* @__PURE__ */ n(ye, { stepNumber: 3, title: "Set environment variables", code: `export AMP_OTEL_ENDPOINT="${d}"
1034
- export AMP_AGENT_API_KEY="${h}"`, language: "bash", fieldId: "env", description: "Sets the agent endpoint and agent-specific API key so traces can be exported securely." }),
1035
- /* @__PURE__ */ n(ye, { stepNumber: 4, title: "Run Agent with Instrumentation Enabled", code: "amp-instrument <run_command>", language: "bash", fieldId: "run", description: "Replace <run_command> with your agent's start command. For example: amp-instrument python app.py" })
1036
- ] }) : /* @__PURE__ */ u(se, { children: [
1037
- /* @__PURE__ */ n(ye, { stepNumber: 1, title: "Import Amp Module", code: "import ballerinax/amp as _;", language: "ballerina", fieldId: "import", description: "Add the import to your Ballerina program." }),
1038
- /* @__PURE__ */ n(ye, { stepNumber: 2, title: "Add the following configuration to Ballerina.toml", code: `[build-options]
1039
- observabilityIncluded = true`, language: "toml", fieldId: "ballerina-toml", description: "Ensure the following configuration is present when building the program." }),
1040
- /* @__PURE__ */ n(ye, { stepNumber: 3, title: "Update Config.toml", code: `[ballerina.observe]
1041
- tracingEnabled = true
1042
- tracingProvider = "amp"`, language: "toml", fieldId: "config-toml", description: "Enable tracing and set the provider to Amp." }),
1043
- /* @__PURE__ */ n(bt, { stepNumber: 4, orgName: a, projName: s, agentName: r, environment: o, onTokenGenerated: f }),
1044
- /* @__PURE__ */ n(ye, { stepNumber: 5, title: "Set Environment Variables", code: `export BAL_CONFIG_VAR_BALLERINAX_AMP_OTELENDPOINT="${d}"
1045
- export BAL_CONFIG_VAR_BALLERINAX_AMP_APIKEY="${h}"`, language: "bash", fieldId: "env-vars", description: "Configure the exporter using environment variables." })
1046
- ] }) }), e[11] = r, e[12] = h, e[13] = o, e[14] = d, e[15] = a, e[16] = s, e[17] = c, e[18] = D) : D = e[18];
1047
- let C;
1048
- e[19] !== D || e[20] !== j ? (C = /* @__PURE__ */ u(it, { children: [
1049
- j,
1050
- D
1051
- ] }), e[19] = D, e[20] = j, e[21] = C) : C = e[21];
1052
- let A;
1053
- return e[22] !== l || e[23] !== i || e[24] !== C || e[25] !== N ? (A = /* @__PURE__ */ u(lt, { open: i, onClose: l, maxWidth: 700, children: [
1054
- N,
1055
- C
1056
- ] }), e[22] = l, e[23] = i, e[24] = C, e[25] = N, e[26] = A) : A = e[26], A;
1057
- }, Vn = () => {
1058
- const t = K(41), {
1059
- agentId: e,
1060
- orgId: i,
1061
- projectId: l
1062
- } = ge(), [a, s] = yn(), [r, o] = ne("");
1063
- let d;
1064
- t[0] !== e || t[1] !== i || t[2] !== l ? (d = {
1065
- orgName: i,
1066
- projName: l,
1067
- agentName: e
1068
- }, t[0] = e, t[1] = i, t[2] = l, t[3] = d) : d = t[3];
1069
- const {
1070
- data: m
1071
- } = tt(d), {
1072
- environments: g,
1073
- isLoading: f
1074
- } = Qt(i, l), c = i ?? "";
1075
- let p;
1076
- t[4] !== c ? (p = {
1077
- orgName: c
1078
- }, t[4] = c, t[5] = p) : p = t[5];
1079
- let h;
1080
- t[6] !== r ? (h = {
1081
- environment: r
1082
- }, t[6] = r, t[7] = h) : h = t[7];
1083
- const {
1084
- data: b
1085
- } = en(p, h), y = b?.gateways?.[0]?.vhost, x = y ? `${y.replace(/\/$/, "")}/otel` : tn.instrumentationUrl || "http://localhost:22893/otel";
1086
- let N;
1087
- t[8] !== s ? (N = (T) => {
1088
- o(T), s({
1089
- setup: "true"
1090
- });
1091
- }, t[8] = s, t[9] = N) : N = t[9];
1092
- const v = N;
1093
- let S, k;
1094
- t[10] !== f || t[11] !== r || t[12] !== g ? (S = () => {
1095
- !f && !r && o(g.length > 0 ? g[0].id ?? "" : "");
1096
- }, k = [g, f, r], t[10] = f, t[11] = r, t[12] = g, t[13] = S, t[14] = k) : (S = t[13], k = t[14]), xe(S, k);
1097
- let _;
1098
- t[15] !== e || t[16] !== v || t[17] !== f || t[18] !== i || t[19] !== l || t[20] !== g ? (_ = /* @__PURE__ */ n(w, { display: "flex", flexDirection: "column", gap: 2, children: f ? /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 2, children: [
1099
- /* @__PURE__ */ n(H, { variant: "rounded", height: 100 }),
1100
- /* @__PURE__ */ n(H, { variant: "rounded", height: 100 })
1101
- ] }) : g.length === 0 ? /* @__PURE__ */ n(et, { message: "No environments found", subtitle: "Environments will appear here once they are created" }) : /* @__PURE__ */ n(J, { spacing: 2, children: g.map((T) => T && i && l && e && /* @__PURE__ */ n(Lt, { orgId: i, projectId: l, agentId: e, environment: T, actions: /* @__PURE__ */ n(ee, { variant: "text", size: "small", startIcon: /* @__PURE__ */ n(At, { size: 16 }), onClick: () => v(T.id ?? ""), children: "Setup Agent" }), bottomContent: /* @__PURE__ */ u(se, { children: [
1102
- /* @__PURE__ */ n($t, { orgId: i, projectId: l, agentId: e, envId: T.name, hideMetrics: !0, external: !0 }),
1103
- /* @__PURE__ */ n(Wt, { orgId: i, projectId: l, agentId: e, envId: T.name })
1104
- ] }) }, T.name)) }) }), t[15] = e, t[16] = v, t[17] = f, t[18] = i, t[19] = l, t[20] = g, t[21] = _) : _ = t[21];
1105
- const j = a.get("setup") === "true" && r !== "";
1106
- let W;
1107
- t[22] !== s ? (W = () => s({}), t[22] = s, t[23] = W) : W = t[23];
1108
- const D = e ?? "", C = i ?? "default", A = l ?? "default", E = e ?? "";
1109
- let $;
1110
- t[24] !== r || t[25] !== g ? ($ = g?.find((T) => T.id === r)?.name, t[24] = r, t[25] = g, t[26] = $) : $ = t[26];
1111
- const M = m?.uuid;
1112
- let L;
1113
- t[27] !== x || t[28] !== r || t[29] !== D || t[30] !== C || t[31] !== A || t[32] !== E || t[33] !== $ || t[34] !== M || t[35] !== j || t[36] !== W ? (L = /* @__PURE__ */ n(Kn, { open: j, onClose: W, agentId: D, orgName: C, projName: A, agentName: E, environment: $, instrumentationUrl: x, componentUid: M, environmentUid: r }), t[27] = x, t[28] = r, t[29] = D, t[30] = C, t[31] = A, t[32] = E, t[33] = $, t[34] = M, t[35] = j, t[36] = W, t[37] = L) : L = t[37];
1114
- let R;
1115
- return t[38] !== L || t[39] !== _ ? (R = /* @__PURE__ */ u(se, { children: [
1116
- _,
1117
- L
1118
- ] }), t[38] = L, t[39] = _, t[40] = R) : R = t[40], R;
1119
- }, qn = zt({
1120
- displayName: be().trim().min(1, "Display name is required").min(3, "Display name must be at least 3 characters").max(100, "Display name must be at most 100 characters"),
1121
- name: be().trim().min(1, "Name is required").regex(/^[a-z0-9-]+$/, "Name must be lowercase letters, numbers, and hyphens only (no spaces)").min(3, "Name must be at least 3 characters").max(50, "Name must be at most 50 characters"),
1122
- description: be().trim().optional()
1123
- });
1124
- function Xn(t) {
1125
- const e = K(70), {
1126
- open: i,
1127
- onClose: l,
1128
- agent: a,
1129
- orgId: s,
1130
- projectId: r
1131
- } = t, o = a.description || "";
1132
- let d;
1133
- e[0] !== a.displayName || e[1] !== a.name || e[2] !== o ? (d = {
1134
- name: a.name,
1135
- displayName: a.displayName,
1136
- description: o
1137
- }, e[0] = a.displayName, e[1] = a.name, e[2] = o, e[3] = d) : d = e[3];
1138
- const [m, g] = ne(d), {
1139
- errors: f,
1140
- validateField: c,
1141
- validateForm: p,
1142
- clearErrors: h,
1143
- setFieldError: b
1144
- } = vt(qn), {
1145
- mutate: y,
1146
- isPending: x
1147
- } = nn();
1148
- let N;
1149
- e[4] !== a.description || e[5] !== a.displayName || e[6] !== a.name || e[7] !== h || e[8] !== i ? (N = () => {
1150
- i && (g({
1151
- name: a.name,
1152
- displayName: a.displayName,
1153
- description: a.description || ""
1154
- }), h());
1155
- }, e[4] = a.description, e[5] = a.displayName, e[6] = a.name, e[7] = h, e[8] = i, e[9] = N) : N = e[9];
1156
- let v;
1157
- e[10] !== a || e[11] !== h || e[12] !== i ? (v = [a, i, h], e[10] = a, e[11] = h, e[12] = i, e[13] = v) : v = e[13], xe(N, v);
1158
- let S;
1159
- e[14] !== b || e[15] !== c ? (S = (Z, de) => {
1160
- const Ee = c(Z, de);
1161
- b(Z, Ee), g((fe) => ({
1162
- ...fe,
1163
- [Z]: de
1164
- }));
1165
- }, e[14] = b, e[15] = c, e[16] = S) : S = e[16];
1166
- const k = S;
1167
- let _;
1168
- e[17] !== a.name || e[18] !== h || e[19] !== m || e[20] !== l || e[21] !== s || e[22] !== r || e[23] !== y || e[24] !== p ? (_ = (Z) => {
1169
- if (Z.preventDefault(), !p(m))
1170
- return;
1171
- const de = {
1172
- displayName: m.displayName,
1173
- description: m.description
1174
- };
1175
- y({
1176
- params: {
1177
- orgName: s,
1178
- projName: r,
1179
- agentName: a.name
1180
- },
1181
- body: de
1182
- }, {
1183
- onSuccess: () => {
1184
- h(), l();
1185
- }
1186
- });
1187
- }, e[17] = a.name, e[18] = h, e[19] = m, e[20] = l, e[21] = s, e[22] = r, e[23] = y, e[24] = p, e[25] = _) : _ = e[25];
1188
- const j = _, W = !f.displayName && !f.description && m.displayName.trim().length > 0;
1189
- let D;
1190
- e[26] === Symbol.for("react.memo_cache_sentinel") ? (D = /* @__PURE__ */ n(Me, { size: 24 }), e[26] = D) : D = e[26];
1191
- let C;
1192
- e[27] !== l ? (C = /* @__PURE__ */ n(nt, { icon: D, title: "Edit Agent", onClose: l }), e[27] = l, e[28] = C) : C = e[28];
1193
- let A, E;
1194
- e[29] === Symbol.for("react.memo_cache_sentinel") ? (E = {
1195
- gap: 1,
1196
- display: "flex",
1197
- flexDirection: "column"
1198
- }, A = /* @__PURE__ */ n(I, { variant: "h5", children: "Agent Details" }), e[29] = A, e[30] = E) : (A = e[29], E = e[30]);
1199
- let $;
1200
- e[31] !== k ? ($ = (Z) => k("displayName", Z.target.value), e[31] = k, e[32] = $) : $ = e[32];
1201
- const M = !!f.displayName;
1202
- let L;
1203
- e[33] !== f.displayName || e[34] !== m.displayName || e[35] !== x || e[36] !== $ || e[37] !== M ? (L = /* @__PURE__ */ n(pt, { placeholder: "e.g., Customer Support Agent", label: "Name", fullWidth: !0, size: "small", value: m.displayName, onChange: $, error: M, helperText: f.displayName, disabled: x }), e[33] = f.displayName, e[34] = m.displayName, e[35] = x, e[36] = $, e[37] = M, e[38] = L) : L = e[38];
1204
- const R = m.description || "";
1205
- let T;
1206
- e[39] !== k ? (T = (Z) => k("description", Z.target.value), e[39] = k, e[40] = T) : T = e[40];
1207
- const B = !!f.description;
1208
- let O;
1209
- e[41] !== f.description || e[42] !== x || e[43] !== R || e[44] !== T || e[45] !== B ? (O = /* @__PURE__ */ n(pt, { placeholder: "Short description of what this agent does", label: "Description (optional)", fullWidth: !0, size: "small", multiline: !0, minRows: 2, maxRows: 6, value: R, onChange: T, error: B, helperText: f.description, disabled: x }), e[41] = f.description, e[42] = x, e[43] = R, e[44] = T, e[45] = B, e[46] = O) : O = e[46];
1210
- let G;
1211
- e[47] !== L || e[48] !== O ? (G = /* @__PURE__ */ n(re, { variant: "outlined", children: /* @__PURE__ */ u(oe, { sx: E, children: [
1212
- A,
1213
- /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 1, children: [
1214
- L,
1215
- O
1216
- ] })
1217
- ] }) }), e[47] = L, e[48] = O, e[49] = G) : G = e[49];
1218
- let z;
1219
- e[50] !== x || e[51] !== l ? (z = /* @__PURE__ */ n(ee, { variant: "outlined", color: "inherit", onClick: l, disabled: x, children: "Cancel" }), e[50] = x, e[51] = l, e[52] = z) : z = e[52];
1220
- const F = !W || x, P = x ? "Updating..." : "Update Agent";
1221
- let U;
1222
- e[53] !== F || e[54] !== P ? (U = /* @__PURE__ */ n(ee, { type: "submit", variant: "contained", color: "primary", disabled: F, children: P }), e[53] = F, e[54] = P, e[55] = U) : U = e[55];
1223
- let V;
1224
- e[56] !== z || e[57] !== U ? (V = /* @__PURE__ */ u(w, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
1225
- z,
1226
- U
1227
- ] }), e[56] = z, e[57] = U, e[58] = V) : V = e[58];
1228
- let X;
1229
- e[59] !== G || e[60] !== V ? (X = /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 2, flexGrow: 1, children: [
1230
- G,
1231
- V
1232
- ] }), e[59] = G, e[60] = V, e[61] = X) : X = e[61];
1233
- let Y;
1234
- e[62] !== j || e[63] !== X ? (Y = /* @__PURE__ */ n(it, { children: /* @__PURE__ */ n("form", { onSubmit: j, children: X }) }), e[62] = j, e[63] = X, e[64] = Y) : Y = e[64];
1235
- let ce;
1236
- return e[65] !== l || e[66] !== i || e[67] !== Y || e[68] !== C ? (ce = /* @__PURE__ */ u(lt, { open: i, onClose: l, children: [
1237
- C,
1238
- Y
1239
- ] }), e[65] = l, e[66] = i, e[67] = Y, e[68] = C, e[69] = ce) : ce = e[69], ce;
1240
- }
1241
- function Yn() {
1242
- const t = K(1);
1243
- let e;
1244
- return t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n(w, { display: "flex", flexDirection: "column", gap: 4, width: "100%", children: /* @__PURE__ */ n(H, { variant: "rounded", width: "100%", height: "40vh" }) }), t[0] = e) : e = t[0], e;
1245
- }
1246
- const Jn = (t) => {
1247
- const e = K(8), {
1248
- icon: i,
1249
- label: l,
1250
- value: a
1251
- } = t;
1252
- let s;
1253
- e[0] !== l ? (s = /* @__PURE__ */ u(I, { variant: "caption", color: "text.secondary", children: [
1254
- l,
1255
- ":"
1256
- ] }), e[0] = l, e[1] = s) : s = e[1];
1257
- let r;
1258
- e[2] !== a ? (r = /* @__PURE__ */ n(I, { variant: "caption", fontWeight: 500, children: a }), e[2] = a, e[3] = r) : r = e[3];
1259
- let o;
1260
- return e[4] !== i || e[5] !== s || e[6] !== r ? (o = /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 0.5, children: [
1261
- i,
1262
- s,
1263
- r
1264
- ] }), e[4] = i, e[5] = s, e[6] = r, e[7] = o) : o = e[7], o;
1265
- }, Zn = (t) => {
1266
- const e = K(9), {
1267
- agent: i
1268
- } = t;
1269
- let l;
1270
- e[0] !== i.createdAt ? (l = i.createdAt ? dt(new Date(i.createdAt), {
1271
- addSuffix: !0
1272
- }) : null, e[0] = i.createdAt, e[1] = l) : l = e[1];
1273
- const a = l;
1274
- let s;
1275
- e[2] !== i.description ? (s = i.description && /* @__PURE__ */ n(ve, { title: i.description, placement: "bottom-start", children: /* @__PURE__ */ n(I, { variant: "body2", color: "text.secondary", sx: {
1276
- overflow: "hidden",
1277
- display: "-webkit-box",
1278
- WebkitLineClamp: 2,
1279
- WebkitBoxOrient: "vertical",
1280
- maxWidth: "50%"
1281
- }, children: i.description }) }), e[2] = i.description, e[3] = s) : s = e[3];
1282
- let r;
1283
- e[4] !== a ? (r = a && /* @__PURE__ */ n(Jn, { icon: /* @__PURE__ */ n(kt, { size: 12 }), label: "Created", value: a }), e[4] = a, e[5] = r) : r = e[5];
1284
- let o;
1285
- return e[6] !== s || e[7] !== r ? (o = /* @__PURE__ */ u(J, { spacing: 0.75, children: [
1286
- s,
1287
- r
1288
- ] }), e[6] = s, e[7] = r, e[8] = o) : o = e[8], o;
1289
- };
1290
- function Qn() {
1291
- const t = K(32), {
1292
- orgId: e,
1293
- agentId: i,
1294
- projectId: l
1295
- } = ge(), [a, s] = ne(!1);
1296
- let r;
1297
- t[0] !== i || t[1] !== e || t[2] !== l ? (r = {
1298
- orgName: e,
1299
- projName: l,
1300
- agentName: i
1301
- }, t[0] = i, t[1] = e, t[2] = l, t[3] = r) : r = t[3];
1302
- const {
1303
- data: o,
1304
- isLoading: d
1305
- } = tt(r), m = o?.displayName ?? "Agent";
1306
- let g;
1307
- t[4] !== o ? (g = o ? /* @__PURE__ */ n(Zn, { agent: o }) : void 0, t[4] = o, t[5] = g) : g = t[5];
1308
- const f = o?.provisioning?.type;
1309
- let c;
1310
- t[6] !== f ? (c = wt(f), t[6] = f, t[7] = c) : c = t[7];
1311
- let p;
1312
- t[8] !== c ? (p = /* @__PURE__ */ n($e, { label: c, color: "default", size: "small", variant: "outlined" }), t[8] = c, t[9] = p) : p = t[9];
1313
- let h, b;
1314
- t[10] === Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ n(Me, { size: 16 }), b = () => s(!0), t[10] = h, t[11] = b) : (h = t[10], b = t[11]);
1315
- const y = !o;
1316
- let x;
1317
- t[12] !== y ? (x = /* @__PURE__ */ n(ee, { variant: "outlined", size: "small", startIcon: h, onClick: b, disabled: y, children: "Edit Agent" }), t[12] = y, t[13] = x) : x = t[13];
1318
- let N;
1319
- t[14] !== o?.provisioning?.type || t[15] !== d ? (N = d ? /* @__PURE__ */ n(Yn, {}) : /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 4, children: [
1320
- o?.provisioning?.type === "internal" && /* @__PURE__ */ n(Gn, {}),
1321
- o?.provisioning?.type === "external" && /* @__PURE__ */ n(Vn, {})
1322
- ] }), t[14] = o?.provisioning?.type, t[15] = d, t[16] = N) : N = t[16];
1323
- let v;
1324
- t[17] !== d || t[18] !== m || t[19] !== N || t[20] !== g || t[21] !== p || t[22] !== x ? (v = /* @__PURE__ */ n(at, { title: m, description: g, isLoading: d, titleTail: p, actions: x, children: N }), t[17] = d, t[18] = m, t[19] = N, t[20] = g, t[21] = p, t[22] = x, t[23] = v) : v = t[23];
1325
- let S;
1326
- t[24] !== o || t[25] !== a || t[26] !== e || t[27] !== l ? (S = o && /* @__PURE__ */ n(Xn, { open: a, onClose: () => s(!1), agent: o, orgId: e || "default", projectId: l || "default" }), t[24] = o, t[25] = a, t[26] = e, t[27] = l, t[28] = S) : S = t[28];
1327
- let k;
1328
- return t[29] !== v || t[30] !== S ? (k = /* @__PURE__ */ u(se, { children: [
1329
- v,
1330
- S
1331
- ] }), t[29] = v, t[30] = S, t[31] = k) : k = t[31], k;
1332
- }
1333
- const xt = () => {
1334
- const t = K(1);
1335
- let e;
1336
- return t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n(Qn, {}), t[0] = e) : e = t[0], e;
1337
- }, Ye = (t) => {
1338
- const e = K(10), i = t.bold ? "bold" : "normal", l = t?.icon;
1339
- let a;
1340
- e[0] !== t.label || e[1] !== i || e[2] !== l ? (a = /* @__PURE__ */ u(I, { variant: "body2", fontWeight: i, children: [
1341
- l,
1342
- "  ",
1343
- t.label
1344
- ] }), e[0] = t.label, e[1] = i, e[2] = l, e[3] = a) : a = e[3];
1345
- const s = t.bold ? "bold" : "normal";
1346
- let r;
1347
- e[4] !== t.value || e[5] !== s ? (r = /* @__PURE__ */ n(I, { variant: "body2", fontWeight: s, children: t.value }), e[4] = t.value, e[5] = s, e[6] = r) : r = e[6];
1348
- let o;
1349
- return e[7] !== a || e[8] !== r ? (o = /* @__PURE__ */ u(w, { display: "flex", flexDirection: "row", justifyContent: "space-between", gap: 2, children: [
1350
- a,
1351
- r
1352
- ] }), e[7] = a, e[8] = r, e[9] = o) : o = e[9], o;
1353
- };
1354
- function ei() {
1355
- const t = K(26), {
1356
- orgId: e,
1357
- projectId: i
1358
- } = ge();
1359
- let l;
1360
- t[0] !== e || t[1] !== i ? (l = {
1361
- orgName: e,
1362
- projName: i
1363
- }, t[0] = e, t[1] = i, t[2] = l) : l = t[2];
1364
- const {
1365
- data: a
1366
- } = Nt(l);
1367
- let s;
1368
- t[3] !== a?.agents ? (s = a?.agents?.filter(ni)?.length ?? 0, t[3] = a?.agents, t[4] = s) : s = t[4];
1369
- let r;
1370
- t[5] !== a?.agents ? (r = a?.agents?.filter(ti)?.length ?? 0, t[5] = a?.agents, t[6] = r) : r = t[6];
1371
- let o;
1372
- t[7] !== s || t[8] !== r ? (o = [s, r], t[7] = s, t[8] = r, t[9] = o) : o = t[9];
1373
- const [d, m] = o;
1374
- let g;
1375
- t[10] === Symbol.for("react.memo_cache_sentinel") ? (g = {
1376
- minWidth: 300,
1377
- flexGrow: 1
1378
- }, t[10] = g) : g = t[10];
1379
- let f;
1380
- t[11] === Symbol.for("react.memo_cache_sentinel") ? (f = /* @__PURE__ */ n(I, { variant: "h6", children: "Agent Deployments" }), t[11] = f) : f = t[11];
1381
- let c;
1382
- t[12] === Symbol.for("react.memo_cache_sentinel") ? (c = /* @__PURE__ */ n(_n, { size: 16 }), t[12] = c) : c = t[12];
1383
- let p;
1384
- t[13] !== d ? (p = /* @__PURE__ */ n(Ye, { label: "External", value: d, icon: c }), t[13] = d, t[14] = p) : p = t[14];
1385
- let h;
1386
- t[15] === Symbol.for("react.memo_cache_sentinel") ? (h = /* @__PURE__ */ n(te, {}), t[15] = h) : h = t[15];
1387
- let b;
1388
- t[16] === Symbol.for("react.memo_cache_sentinel") ? (b = /* @__PURE__ */ n(Pn, { size: 16 }), t[16] = b) : b = t[16];
1389
- let y;
1390
- t[17] !== m ? (y = /* @__PURE__ */ n(Ye, { label: "Platform", value: m, icon: b }), t[17] = m, t[18] = y) : y = t[18];
1391
- let x;
1392
- t[19] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ n(te, {}), t[19] = x) : x = t[19];
1393
- const N = a?.agents?.length ?? 0;
1394
- let v;
1395
- t[20] !== N ? (v = /* @__PURE__ */ n(Ye, { label: "Total", bold: !0, value: N }), t[20] = N, t[21] = v) : v = t[21];
1396
- let S;
1397
- return t[22] !== y || t[23] !== v || t[24] !== p ? (S = /* @__PURE__ */ n(re, { variant: "outlined", sx: g, children: /* @__PURE__ */ n(oe, { children: /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 1.5, children: [
1398
- f,
1399
- p,
1400
- h,
1401
- y,
1402
- x,
1403
- v
1404
- ] }) }) }), t[22] = y, t[23] = v, t[24] = p, t[25] = S) : S = t[25], S;
1405
- }
1406
- function ti(t) {
1407
- return t.provisioning.type === "internal";
1408
- }
1409
- function ni(t) {
1410
- return t.provisioning.type === "external";
1411
- }
1412
- const Je = {
1413
- minWidth: 300,
1414
- flexGrow: 1
1415
- };
1416
- function ii(t) {
1417
- if (!t.length) return [];
1418
- const e = new Set(t.flatMap((o) => o.targetEnvironmentRefs.map((d) => d.name))), i = new Map(t.map((o) => [o.sourceEnvironmentRef, o.targetEnvironmentRefs.map((d) => d.name)])), l = [...new Set(t.map((o) => o.sourceEnvironmentRef))].filter((o) => !e.has(o)), a = [], s = /* @__PURE__ */ new Set();
1419
- let r = l[0];
1420
- for (; r && !s.has(r); )
1421
- a.push(r), s.add(r), r = (i.get(r) ?? [])[0];
1422
- return e.forEach((o) => {
1423
- s.has(o) || a.push(o);
1424
- }), a;
1425
- }
1426
- function li() {
1427
- const {
1428
- orgId: t,
1429
- projectId: e
1430
- } = ge(), {
1431
- data: i,
1432
- isLoading: l
1433
- } = St({
1434
- orgName: t,
1435
- projName: e
1436
- }), {
1437
- data: a,
1438
- isLoading: s
1439
- } = rt({
1440
- orgName: t
1441
- }), {
1442
- data: r
1443
- } = _t({
1444
- orgName: t
1445
- }), o = ae(() => a?.deploymentPipelines?.find((c) => c.name === i?.deploymentPipeline), [a, i?.deploymentPipeline]), d = ae(() => new Map(r?.map((c) => [c.name, c]) ?? []), [r]), m = ae(() => ii(o?.promotionPaths ?? []), [o]), g = l || s, f = !!i?.deploymentPipeline;
1446
- return g ? /* @__PURE__ */ n(re, { variant: "outlined", sx: Je, children: /* @__PURE__ */ n(oe, { children: /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 1.5, children: [
1447
- /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 1, children: [
1448
- /* @__PURE__ */ n(H, { variant: "circular", width: 18, height: 18 }),
1449
- /* @__PURE__ */ n(H, { variant: "text", width: "60%", height: 28 })
1450
- ] }),
1451
- /* @__PURE__ */ n(H, { variant: "text", width: "85%", height: 16 }),
1452
- /* @__PURE__ */ n(te, {}),
1453
- /* @__PURE__ */ n(H, { variant: "text", width: "45%", height: 12 }),
1454
- /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 1, children: [
1455
- /* @__PURE__ */ n(H, { variant: "rounded", width: 64, height: 24, sx: {
1456
- borderRadius: 4
1457
- } }),
1458
- /* @__PURE__ */ n(H, { variant: "text", width: 14, height: 14 }),
1459
- /* @__PURE__ */ n(H, { variant: "rounded", width: 72, height: 24, sx: {
1460
- borderRadius: 4
1461
- } }),
1462
- /* @__PURE__ */ n(H, { variant: "text", width: 14, height: 14 }),
1463
- /* @__PURE__ */ n(H, { variant: "rounded", width: 80, height: 24, sx: {
1464
- borderRadius: 4
1465
- } })
1466
- ] })
1467
- ] }) }) }) : !f || !o ? /* @__PURE__ */ n(re, { variant: "outlined", sx: Je, children: /* @__PURE__ */ n(oe, { children: /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 1.5, children: [
1468
- /* @__PURE__ */ n(I, { variant: "h6", children: "Deployment Environments" }),
1469
- /* @__PURE__ */ n(te, {}),
1470
- /* @__PURE__ */ n(I, { variant: "body2", color: "text.secondary", sx: {
1471
- fontStyle: "italic"
1472
- }, children: "No deployment pipeline configured for this project." })
1473
- ] }) }) }) : /* @__PURE__ */ n(re, { variant: "outlined", sx: Je, children: /* @__PURE__ */ n(oe, { children: /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 1.5, children: [
1474
- /* @__PURE__ */ n(I, { variant: "h6", children: "Project Environments" }),
1475
- /* @__PURE__ */ n(te, {}),
1476
- /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 0.5, children: [
1477
- /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 0.75, children: [
1478
- /* @__PURE__ */ n(Dt, { size: 14, style: {
1479
- opacity: 0.6,
1480
- flexShrink: 0
1481
- } }),
1482
- /* @__PURE__ */ n(I, { variant: "body2", fontWeight: 500, children: o.displayName || o.name })
1483
- ] }),
1484
- o.description && /* @__PURE__ */ n(I, { variant: "body2", color: "text.disabled", sx: {
1485
- pl: 2.75
1486
- }, children: o.description })
1487
- ] }),
1488
- /* @__PURE__ */ n(te, {}),
1489
- /* @__PURE__ */ u(w, { display: "flex", flexWrap: "wrap", alignItems: "center", gap: 0.75, children: [
1490
- m.length > 0 ? m.map((c, p) => {
1491
- const h = d.get(c), b = h?.displayName || c, y = h?.isProduction ?? !1;
1492
- return /* @__PURE__ */ u(w, { display: "flex", alignItems: "center", gap: 0.75, children: [
1493
- /* @__PURE__ */ n(ve, { title: y ? "Production" : "", disableHoverListener: !y, children: /* @__PURE__ */ n($e, { label: b, size: "small", color: y ? "primary" : "default", variant: "outlined" }) }),
1494
- p < m.length - 1 && /* @__PURE__ */ n(In, { size: 14, style: {
1495
- opacity: 0.45,
1496
- flexShrink: 0
1497
- } })
1498
- ] }, c);
1499
- }) : /* @__PURE__ */ n(I, { variant: "body2", color: "text.disabled", sx: {
1500
- fontStyle: "italic"
1501
- }, children: "No promotion paths defined." }),
1502
- /* @__PURE__ */ n(ve, { title: "Edit Promotion Chain", children: /* @__PURE__ */ n(ee, { size: "small", startIcon: /* @__PURE__ */ n(Me, { size: 14 }), component: pe, to: le(ie.children.org.children.deploymentPipelines.path, {
1503
- orgId: t
1504
- }) + `?edit=${o.name}`, children: "Edit" }) })
1505
- ] })
1506
- ] }) }) });
1507
- }
1508
- function Mt(t, e) {
1509
- return t.promotionPaths.length ? [...t.promotionPaths.map((l) => l.sourceEnvironmentRef), t.promotionPaths[t.promotionPaths.length - 1]?.targetEnvironmentRefs[0]?.name].filter(Boolean).map((l) => e.get(l) ?? l).join(" → ") : null;
1510
- }
1511
- function ai(t) {
1512
- const e = K(10), {
1513
- pipeline: i,
1514
- envDisplayNameMap: l
1515
- } = t;
1516
- let a;
1517
- e[0] !== l || e[1] !== i ? (a = Mt(i, l), e[0] = l, e[1] = i, e[2] = a) : a = e[2];
1518
- const s = a;
1519
- let r;
1520
- e[3] !== i.displayName ? (r = /* @__PURE__ */ n(I, { variant: "body2", children: i.displayName }), e[3] = i.displayName, e[4] = r) : r = e[4];
1521
- let o;
1522
- e[5] !== s ? (o = s && /* @__PURE__ */ n(I, { variant: "caption", color: "text.disabled", children: s }), e[5] = s, e[6] = o) : o = e[6];
1523
- let d;
1524
- return e[7] !== r || e[8] !== o ? (d = /* @__PURE__ */ u(J, { direction: "row", alignItems: "center", spacing: 1, children: [
1525
- r,
1526
- o
1527
- ] }), e[7] = r, e[8] = o, e[9] = d) : d = e[9], d;
1528
- }
1529
- function ri(t) {
1530
- const e = K(10), {
1531
- pipeline: i,
1532
- envDisplayNameMap: l
1533
- } = t;
1534
- let a;
1535
- e[0] !== l || e[1] !== i ? (a = Mt(i, l), e[0] = l, e[1] = i, e[2] = a) : a = e[2];
1536
- const s = a;
1537
- let r;
1538
- e[3] !== i.displayName ? (r = /* @__PURE__ */ n(I, { variant: "body2", children: i.displayName }), e[3] = i.displayName, e[4] = r) : r = e[4];
1539
- let o;
1540
- e[5] !== s ? (o = s && /* @__PURE__ */ n(I, { variant: "caption", color: "text.disabled", children: s }), e[5] = s, e[6] = o) : o = e[6];
1541
- let d;
1542
- return e[7] !== r || e[8] !== o ? (d = /* @__PURE__ */ u(J, { children: [
1543
- r,
1544
- o
1545
- ] }), e[7] = r, e[8] = o, e[9] = d) : d = e[9], d;
1546
- }
1547
- const oi = zt({
1548
- displayName: be().trim().min(3, "Display name must be at least 3 characters").max(100, "Display name must be at most 100 characters"),
1549
- name: be().trim().min(3, "Name must be at least 3 characters").regex(/^[a-z0-9-]+$/, "Name must be lowercase letters, numbers, and hyphens only (no spaces)").max(50, "Name must be at most 50 characters"),
1550
- description: be().trim().optional(),
1551
- deploymentPipeline: be().trim().min(1, "Deployment pipeline is required")
1552
- });
1553
- function si(t) {
1554
- const e = K(116), {
1555
- open: i,
1556
- onClose: l,
1557
- project: a,
1558
- orgId: s
1559
- } = t, r = a.description || "", o = a.deploymentPipeline || "";
1560
- let d;
1561
- e[0] !== a.displayName || e[1] !== a.name || e[2] !== r || e[3] !== o ? (d = {
1562
- name: a.name,
1563
- displayName: a.displayName,
1564
- description: r,
1565
- deploymentPipeline: o
1566
- }, e[0] = a.displayName, e[1] = a.name, e[2] = r, e[3] = o, e[4] = d) : d = e[4];
1567
- const [m, g] = ne(d), {
1568
- errors: f,
1569
- validateField: c,
1570
- validateForm: p,
1571
- clearErrors: h,
1572
- setFieldError: b
1573
- } = vt(oi), {
1574
- checkDirty: y,
1575
- resetDirty: x
1576
- } = ln(m);
1577
- let N;
1578
- e[5] !== y || e[6] !== b || e[7] !== c ? (N = (q, me) => {
1579
- g((qe) => {
1580
- const mt = {
1581
- ...qe,
1582
- [q]: me
1583
- };
1584
- y(mt);
1585
- const Gt = c(q, me);
1586
- return b(q, Gt), mt;
1587
- });
1588
- }, e[5] = y, e[6] = b, e[7] = c, e[8] = N) : N = e[8];
1589
- const v = N;
1590
- let S;
1591
- e[9] !== s || e[10] !== a.name ? (S = {
1592
- orgName: s,
1593
- projName: a.name
1594
- }, e[9] = s, e[10] = a.name, e[11] = S) : S = e[11];
1595
- const {
1596
- mutate: k,
1597
- isPending: _
1598
- } = an(S);
1599
- let j;
1600
- e[12] !== s ? (j = {
1601
- orgName: s
1602
- }, e[12] = s, e[13] = j) : j = e[13];
1603
- const {
1604
- data: W,
1605
- isLoading: D
1606
- } = rt(j);
1607
- W?.deploymentPipelines;
1608
- let C;
1609
- e[14] !== W?.deploymentPipelines ? (C = W?.deploymentPipelines ?? [], e[14] = W?.deploymentPipelines, e[15] = C) : C = e[15];
1610
- const A = C;
1611
- let E;
1612
- e[16] !== s ? (E = {
1613
- orgName: s
1614
- }, e[16] = s, e[17] = E) : E = e[17];
1615
- const {
1616
- data: $
1617
- } = _t(E);
1618
- let M;
1619
- e[18] !== $ ? (M = /* @__PURE__ */ new Map(), ($ ?? []).forEach((q) => M.set(q.name, q.displayName ?? q.name)), e[18] = $, e[19] = M) : M = e[19];
1620
- const L = M;
1621
- let R;
1622
- e[20] !== m.deploymentPipeline || e[21] !== A[0] || e[22] !== A.length ? (R = () => {
1623
- !m.deploymentPipeline && A.length > 0 && g((q) => ({
1624
- ...q,
1625
- deploymentPipeline: A[0].name
1626
- }));
1627
- }, e[20] = m.deploymentPipeline, e[21] = A[0], e[22] = A.length, e[23] = R) : R = e[23];
1628
- let T;
1629
- e[24] !== m.deploymentPipeline || e[25] !== A ? (T = [A, m.deploymentPipeline], e[24] = m.deploymentPipeline, e[25] = A, e[26] = T) : T = e[26], xe(R, T);
1630
- let B;
1631
- e[27] !== h || e[28] !== i || e[29] !== a.deploymentPipeline || e[30] !== a.description || e[31] !== a.displayName || e[32] !== a.name || e[33] !== x ? (B = () => {
1632
- i && (g({
1633
- name: a.name,
1634
- displayName: a.displayName,
1635
- description: a.description || "",
1636
- deploymentPipeline: a.deploymentPipeline || ""
1637
- }), h(), x());
1638
- }, e[27] = h, e[28] = i, e[29] = a.deploymentPipeline, e[30] = a.description, e[31] = a.displayName, e[32] = a.name, e[33] = x, e[34] = B) : B = e[34];
1639
- let O;
1640
- e[35] !== h || e[36] !== i || e[37] !== a || e[38] !== x ? (O = [a, i, h, x], e[35] = h, e[36] = i, e[37] = a, e[38] = x, e[39] = O) : O = e[39], xe(B, O);
1641
- let G;
1642
- e[40] !== h || e[41] !== m || e[42] !== l || e[43] !== x || e[44] !== k || e[45] !== p ? (G = (q) => {
1643
- if (q.preventDefault(), !p(m))
1644
- return;
1645
- const me = {
1646
- name: m.name,
1647
- displayName: m.displayName,
1648
- description: m.description,
1649
- deploymentPipeline: m.deploymentPipeline
1650
- };
1651
- k(me, {
1652
- onSuccess: () => {
1653
- h(), x(), l();
1654
- }
1655
- });
1656
- }, e[40] = h, e[41] = m, e[42] = l, e[43] = x, e[44] = k, e[45] = p, e[46] = G) : G = e[46];
1657
- const z = G, F = m.displayName.trim().length >= 3 && m.name.trim().length >= 3 && Object.keys(f).length === 0;
1658
- let P;
1659
- e[47] === Symbol.for("react.memo_cache_sentinel") ? (P = /* @__PURE__ */ n(Me, { size: 24 }), e[47] = P) : P = e[47];
1660
- let U;
1661
- e[48] !== l ? (U = /* @__PURE__ */ n(nt, { icon: P, title: "Edit Project", onClose: l }), e[48] = l, e[49] = U) : U = e[49];
1662
- let V;
1663
- e[50] === Symbol.for("react.memo_cache_sentinel") ? (V = {
1664
- gap: 1,
1665
- display: "flex",
1666
- flexDirection: "column"
1667
- }, e[50] = V) : V = e[50];
1668
- let X;
1669
- e[51] === Symbol.for("react.memo_cache_sentinel") ? (X = /* @__PURE__ */ n(w, { display: "flex", flexDirection: "column", gap: 1, children: /* @__PURE__ */ n(I, { variant: "h5", children: "Project Details" }) }), e[51] = X) : X = e[51];
1670
- let Y;
1671
- e[52] !== v ? (Y = (q) => v("displayName", q.target.value), e[52] = v, e[53] = Y) : Y = e[53];
1672
- const ce = !!f.displayName;
1673
- let Z;
1674
- e[54] !== f.displayName || e[55] !== m.displayName || e[56] !== _ || e[57] !== Y || e[58] !== ce ? (Z = /* @__PURE__ */ n(Te.ElementWrapper, { label: "Name", name: "displayName", children: /* @__PURE__ */ n(ht, { id: "displayName", placeholder: "e.g., Customer Support Platform", size: "small", fullWidth: !0, disabled: _, value: m.displayName, onChange: Y, error: ce, helperText: f.displayName }) }), e[54] = f.displayName, e[55] = m.displayName, e[56] = _, e[57] = Y, e[58] = ce, e[59] = Z) : Z = e[59];
1675
- let de;
1676
- e[60] !== v ? (de = (q) => v("description", q.target.value), e[60] = v, e[61] = de) : de = e[61];
1677
- const Ee = !!f.description;
1678
- let fe;
1679
- e[62] !== f.description || e[63] !== m.description || e[64] !== _ || e[65] !== de || e[66] !== Ee ? (fe = /* @__PURE__ */ n(Te.ElementWrapper, { label: "Description (optional)", name: "description", children: /* @__PURE__ */ n(ht, { id: "description", placeholder: "Short description of this project", fullWidth: !0, size: "small", multiline: !0, minRows: 2, maxRows: 6, disabled: _, value: m.description, onChange: de, error: Ee, helperText: f.description }) }), e[62] = f.description, e[63] = m.description, e[64] = _, e[65] = de, e[66] = Ee, e[67] = fe) : fe = e[67];
1680
- const Bt = m.deploymentPipeline;
1681
- let we;
1682
- e[68] !== v ? (we = (q) => v("deploymentPipeline", q.target.value), e[68] = v, e[69] = we) : we = e[69];
1683
- const He = !!f.deploymentPipeline, Ue = D || _;
1684
- let Ne;
1685
- e[70] !== L || e[71] !== A ? (Ne = (q) => {
1686
- const me = A.find((qe) => qe.name === q);
1687
- return me ? /* @__PURE__ */ n(ai, { pipeline: me, envDisplayNameMap: L }) : /* @__PURE__ */ n(I, { variant: "body2", color: "text.disabled", children: "Select a pipeline" });
1688
- }, e[70] = L, e[71] = A, e[72] = Ne) : Ne = e[72];
1689
- let Se;
1690
- e[73] !== D ? (Se = D && /* @__PURE__ */ n(ue, { value: "", disabled: !0, children: /* @__PURE__ */ u(J, { direction: "row", alignItems: "center", gap: 1, children: [
1691
- /* @__PURE__ */ n(st, { size: 12 }),
1692
- /* @__PURE__ */ n(I, { variant: "caption", children: "Loading pipelines..." })
1693
- ] }) }), e[73] = D, e[74] = Se) : Se = e[74];
1694
- let _e;
1695
- e[75] !== D || e[76] !== A.length ? (_e = !D && A.length === 0 && /* @__PURE__ */ n(ue, { value: "", disabled: !0, children: "No deployment pipelines available" }), e[75] = D, e[76] = A.length, e[77] = _e) : _e = e[77];
1696
- let Pe;
1697
- if (e[78] !== L || e[79] !== A) {
1698
- let q;
1699
- e[81] !== L ? (q = (me) => /* @__PURE__ */ n(ue, { value: me.name, children: /* @__PURE__ */ n(ri, { pipeline: me, envDisplayNameMap: L }) }, me.name), e[81] = L, e[82] = q) : q = e[82], Pe = A.map(q), e[78] = L, e[79] = A, e[80] = Pe;
1700
- } else
1701
- Pe = e[80];
1702
- let Ie;
1703
- e[83] !== m.deploymentPipeline || e[84] !== we || e[85] !== He || e[86] !== Ue || e[87] !== Ne || e[88] !== Se || e[89] !== _e || e[90] !== Pe ? (Ie = /* @__PURE__ */ n(Te.ElementWrapper, { label: "Deployment Pipeline", name: "deploymentPipeline", children: /* @__PURE__ */ u(ct, { id: "deploymentPipeline", value: Bt, onChange: we, error: He, disabled: Ue, displayEmpty: !0, renderValue: Ne, fullWidth: !0, size: "small", children: [
1704
- Se,
1705
- _e,
1706
- Pe
1707
- ] }) }), e[83] = m.deploymentPipeline, e[84] = we, e[85] = He, e[86] = Ue, e[87] = Ne, e[88] = Se, e[89] = _e, e[90] = Pe, e[91] = Ie) : Ie = e[91];
1708
- let Ce;
1709
- e[92] !== Z || e[93] !== fe || e[94] !== Ie ? (Ce = /* @__PURE__ */ n(re, { variant: "outlined", children: /* @__PURE__ */ u(oe, { sx: V, children: [
1710
- X,
1711
- /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 1, children: [
1712
- Z,
1713
- fe,
1714
- Ie
1715
- ] })
1716
- ] }) }), e[92] = Z, e[93] = fe, e[94] = Ie, e[95] = Ce) : Ce = e[95];
1717
- let Ae;
1718
- e[96] !== _ || e[97] !== l ? (Ae = /* @__PURE__ */ n(ee, { variant: "outlined", color: "inherit", onClick: l, disabled: _, children: "Cancel" }), e[96] = _, e[97] = l, e[98] = Ae) : Ae = e[98];
1719
- const Ke = !F || _, Ve = _ ? "Updating..." : "Update Project";
1720
- let ke;
1721
- e[99] !== Ke || e[100] !== Ve ? (ke = /* @__PURE__ */ n(ee, { type: "submit", variant: "contained", color: "primary", disabled: Ke, children: Ve }), e[99] = Ke, e[100] = Ve, e[101] = ke) : ke = e[101];
1722
- let De;
1723
- e[102] !== Ae || e[103] !== ke ? (De = /* @__PURE__ */ u(w, { display: "flex", justifyContent: "flex-end", gap: 1, mt: 2, children: [
1724
- Ae,
1725
- ke
1726
- ] }), e[102] = Ae, e[103] = ke, e[104] = De) : De = e[104];
1727
- let je;
1728
- e[105] !== Ce || e[106] !== De ? (je = /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 2, flexGrow: 1, children: [
1729
- Ce,
1730
- De
1731
- ] }), e[105] = Ce, e[106] = De, e[107] = je) : je = e[107];
1732
- let Le;
1733
- e[108] !== z || e[109] !== je ? (Le = /* @__PURE__ */ n(it, { children: /* @__PURE__ */ n("form", { onSubmit: z, children: je }) }), e[108] = z, e[109] = je, e[110] = Le) : Le = e[110];
1734
- let Re;
1735
- return e[111] !== l || e[112] !== i || e[113] !== U || e[114] !== Le ? (Re = /* @__PURE__ */ u(lt, { open: i, onClose: l, children: [
1736
- U,
1737
- Le
1738
- ] }), e[111] = l, e[112] = i, e[113] = U, e[114] = Le, e[115] = Re) : Re = e[115], Re;
1739
- }
1740
- const {
1741
- DataGrid: ci
1742
- } = pn;
1743
- function di() {
1744
- const t = K(5);
1745
- let e;
1746
- t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = {
1747
- flexGrow: 1
1748
- }, t[0] = e) : e = t[0];
1749
- let i;
1750
- t[1] === Symbol.for("react.memo_cache_sentinel") ? (i = /* @__PURE__ */ u(J, { direction: "row", spacing: 1, children: [
1751
- /* @__PURE__ */ n(w, { flexGrow: 1, children: /* @__PURE__ */ n(H, { variant: "rounded", width: "100%", height: 40 }) }),
1752
- /* @__PURE__ */ n(H, { variant: "rounded", width: 120, height: 40 })
1753
- ] }), t[1] = i) : i = t[1];
1754
- let l;
1755
- t[2] === Symbol.for("react.memo_cache_sentinel") ? (l = /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 1, children: [
1756
- /* @__PURE__ */ n(H, { variant: "rounded", width: "100%", height: 48 }),
1757
- Array.from({
1758
- length: 5
1759
- }).map(mi)
1760
- ] }), t[2] = l) : l = t[2];
1761
- let a;
1762
- t[3] === Symbol.for("react.memo_cache_sentinel") ? (a = /* @__PURE__ */ u(J, { direction: "column", sx: e, spacing: 4, children: [
1763
- i,
1764
- l,
1765
- /* @__PURE__ */ n(w, { display: "flex", justifyContent: "flex-end", children: /* @__PURE__ */ n(H, { variant: "rounded", width: 300, height: 40 }) })
1766
- ] }), t[3] = a) : a = t[3];
1767
- let s;
1768
- return t[4] === Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ u(J, { direction: "row", justifyContent: "space-between", gap: 4, children: [
1769
- a,
1770
- /* @__PURE__ */ n(w, { width: 250, children: /* @__PURE__ */ n(H, { variant: "rounded", width: "100%", height: 200 }) })
1771
- ] }), t[4] = s) : s = t[4], s;
1772
- }
1773
- function mi(t, e) {
1774
- return /* @__PURE__ */ n(H, { variant: "rounded", width: "100%", height: 72 }, e);
1775
- }
1776
- const pi = () => {
1777
- const [t, e] = ne(""), [i, l] = ne(null), [a, s] = ne(0), [r, o] = ne(5), [d, m] = ne(!1), [g, f] = ne(null), c = typeof window < "u" && ("ontouchstart" in window || navigator.maxTouchPoints > 0), {
1778
- orgId: p,
1779
- projectId: h
1780
- } = ge(), b = bn(), {
1781
- data: y,
1782
- isLoading: x,
1783
- error: N,
1784
- isRefetching: v
1785
- } = Nt({
1786
- orgName: p,
1787
- projName: h
1788
- }), {
1789
- mutate: S,
1790
- isPending: k
1791
- } = rn(), {
1792
- data: _,
1793
- isLoading: j
1794
- } = St({
1795
- orgName: p,
1796
- projName: h
1797
- }), {
1798
- data: W
1799
- } = on({
1800
- orgName: p
1801
- }), D = ae(() => {
1802
- const P = {};
1803
- return W?.kinds?.forEach((U) => {
1804
- P[U.name] = U.displayName;
1805
- }), P;
1806
- }, [W?.kinds]), {
1807
- addConfirmation: C
1808
- } = Pt(), A = he((P) => {
1809
- S({
1810
- orgName: p,
1811
- projName: h,
1812
- agentName: P
1813
- });
1814
- }, [S, p, h]), E = he((P) => {
1815
- l(P.id);
1816
- }, []), $ = he(() => {
1817
- l(null);
1818
- }, []), M = he((P) => {
1819
- f(P.currentTarget);
1820
- }, []), L = he(() => {
1821
- f(null);
1822
- }, []), R = he(() => {
1823
- L(), b(le(ie.children.org.children.projects.children.newAgent.children.connect.path, {
1824
- orgId: p ?? "",
1825
- projectId: h ?? ""
1826
- }));
1827
- }, [L, b, p, h]), T = he(() => {
1828
- L(), b(le(ie.children.org.children.projects.children.newAgent.children.create.path, {
1829
- orgId: p ?? "",
1830
- projectId: h ?? ""
1831
- }));
1832
- }, [L, b, p, h]), B = he((P) => P ? dt(new Date(P), {
1833
- addSuffix: !0
1834
- }) : "—", []), O = (P) => {
1835
- let U = ie.children.org.children.projects.children.agents.path;
1836
- return P && (U = ie.children.org.children.projects.children.agents.path), U;
1837
- };
1838
- xe(() => {
1839
- p && h && !y?.agents?.length && !x && !v && b(le(ie.children.org.children.projects.children.newAgent.path, {
1840
- orgId: p ?? "",
1841
- projectId: h ?? ""
1842
- }));
1843
- }, [p, h, y?.agents, x, v, b]);
1844
- const G = ae(() => y?.agents?.filter((P) => P.displayName.toLowerCase().includes(t.toLowerCase()) || P.name.toLowerCase().includes(t.toLowerCase())).map((P) => ({
1845
- ...P,
1846
- href: le(O(P.provisioning.type === "internal"), {
1847
- orgId: p ?? "",
1848
- projectId: P.projectName,
1849
- agentId: P.name
1850
- }),
1851
- id: P.name,
1852
- agentInfo: {
1853
- name: P.name,
1854
- displayName: P.displayName,
1855
- description: P.description
1856
- }
1857
- })) ?? [], [y?.agents, t, p]);
1858
- xe(() => {
1859
- s(0);
1860
- }, [G]);
1861
- const z = ae(() => G.slice(a * r, a * r + r), [G, a, r]), F = j || v && !y?.agents?.length || k;
1862
- return /* @__PURE__ */ u(se, { children: [
1863
- /* @__PURE__ */ n(at, { title: _?.displayName ?? "Agents", description: _?.description ?? "Manage and monitor all your AI agents across environments", isLoading: F, actions: /* @__PURE__ */ n(ee, { variant: "outlined", color: "primary", size: "small", startIcon: /* @__PURE__ */ n(Me, { size: 16 }), onClick: () => m(!0), disabled: !_, children: "Edit Project" }), children: x ? /* @__PURE__ */ n(di, {}) : /* @__PURE__ */ u(J, { direction: "row", justifyContent: "space-between", gap: 4, children: [
1864
- /* @__PURE__ */ u(J, { direction: "column", sx: {
1865
- flexGrow: 1
1866
- }, spacing: 4, children: [
1867
- /* @__PURE__ */ u(J, { direction: "row", spacing: 1, children: [
1868
- /* @__PURE__ */ n(w, { flexGrow: 1, children: /* @__PURE__ */ n(It, { placeholder: "Search agents", size: "small", fullWidth: !0, onChange: (P) => e(P.target.value), value: t, disabled: !y?.agents?.length }) }),
1869
- /* @__PURE__ */ n(ee, { variant: "contained", color: "primary", size: "small", startIcon: /* @__PURE__ */ n(Qe, { size: 16 }), onClick: M, "aria-controls": g ? "add-agent-menu" : void 0, "aria-haspopup": "true", "aria-expanded": !!g, children: "Add Agent" }),
1870
- /* @__PURE__ */ u(hn, { id: "add-agent-menu", anchorEl: g, open: !!g, onClose: L, anchorOrigin: {
1871
- vertical: "bottom",
1872
- horizontal: "right"
1873
- }, transformOrigin: {
1874
- vertical: "top",
1875
- horizontal: "right"
1876
- }, children: [
1877
- /* @__PURE__ */ n(ue, { onClick: R, children: "External Agent" }),
1878
- /* @__PURE__ */ n(ue, { onClick: T, children: "Platform-Hosted Agent" })
1879
- ] })
1880
- ] }),
1881
- N ? /* @__PURE__ */ n(fn, { severity: "error", variant: "outlined", children: sn(N) }) : null,
1882
- x ? /* @__PURE__ */ n(ci, { rows: [], columns: [{
1883
- field: "name",
1884
- headerName: "Agent Name",
1885
- flex: 1
1886
- }, {
1887
- field: "description",
1888
- headerName: "Description",
1889
- flex: 2
1890
- }, {
1891
- field: "lastUpdated",
1892
- headerName: "Last Updated",
1893
- flex: 1
1894
- }], loading: !0, hideFooter: !0 }) : y?.agents?.length && G.length > 0 ? /* @__PURE__ */ u(Q.Container, { sx: {
1895
- minWidth: 600
1896
- }, disablePaper: !0, children: [
1897
- /* @__PURE__ */ u(Q, { variant: "card", children: [
1898
- /* @__PURE__ */ n(Q.Head, { children: /* @__PURE__ */ u(Q.Row, { children: [
1899
- /* @__PURE__ */ n(Q.Cell, { children: "Agent Name" }),
1900
- /* @__PURE__ */ n(Q.Cell, { children: "Description" }),
1901
- /* @__PURE__ */ n(Q.Cell, { align: "right", children: "Last Updated" })
1902
- ] }) }),
1903
- /* @__PURE__ */ n(Q.Body, { children: z.map((P) => /* @__PURE__ */ u(Q.Row, { variant: "card", hover: !0, clickable: !0, onClick: () => b(P.href), onMouseEnter: () => E(P), onMouseLeave: $, onFocus: () => E(P), onBlur: $, children: [
1904
- /* @__PURE__ */ n(Q.Cell, { children: /* @__PURE__ */ u(J, { direction: "row", alignItems: "center", spacing: 2, children: [
1905
- /* @__PURE__ */ n(Ct, { sx: {
1906
- bgcolor: "primary.main",
1907
- fontSize: 16,
1908
- height: 32,
1909
- width: 32,
1910
- color: "primary.contrastText"
1911
- }, children: P.displayName.charAt(0).toUpperCase() }),
1912
- /* @__PURE__ */ u(J, { direction: "row", alignItems: "flex-start", spacing: 1, children: [
1913
- /* @__PURE__ */ n(I, { variant: "body1", children: P.displayName }),
1914
- P.provisioning.type !== "internal" && /* @__PURE__ */ n($e, { label: wt(P.provisioning.type), size: "small", variant: "outlined" }),
1915
- P.kindName && /* @__PURE__ */ n($e, { size: "small", label: D[P.kindName] ?? P.kindName })
1916
- ] })
1917
- ] }) }),
1918
- /* @__PURE__ */ n(Q.Cell, { children: /* @__PURE__ */ n(I, { variant: "body2", noWrap: !0, textOverflow: "ellipsis", overflow: "hidden", children: P.description.substring(0, 40) + (P.description.length > 40 ? "..." : "") }) }),
1919
- /* @__PURE__ */ n(Q.Cell, { align: "right", children: /* @__PURE__ */ n(J, { direction: "row", alignItems: "center", spacing: 1, justifyContent: "flex-end", sx: {
1920
- minWidth: 150
1921
- }, children: i === P.id || c ? /* @__PURE__ */ n(cn, { children: /* @__PURE__ */ n(ve, { title: "Delete Agent", children: /* @__PURE__ */ n(ze, { color: "error", size: "small", onClick: (U) => {
1922
- U.stopPropagation(), C({
1923
- title: "Delete Agent?",
1924
- description: `Are you sure you want to delete the agent "${P.displayName}"? This action cannot be undone.`,
1925
- onConfirm: () => {
1926
- A(P.name);
1927
- },
1928
- confirmButtonColor: "error",
1929
- confirmButtonIcon: /* @__PURE__ */ n(Fe, { size: 16 }),
1930
- confirmButtonText: "Delete"
1931
- });
1932
- }, children: /* @__PURE__ */ n(Fe, { size: 14 }) }) }) }) : /* @__PURE__ */ n(I, { variant: "body2", color: "text.secondary", noWrap: !0, children: B(P.createdAt) }) }) })
1933
- ] }, P.id)) })
1934
- ] }),
1935
- /* @__PURE__ */ n(un, { rowsPerPageOptions: [5, 10, 25], component: "div", count: G.length, rowsPerPage: r, page: a, onPageChange: (P, U) => s(U), onRowsPerPageChange: (P) => {
1936
- o(parseInt(P.target.value, 10)), s(0);
1937
- } })
1938
- ] }) : y?.agents?.length && G.length === 0 ? /* @__PURE__ */ n(Q.Container, { children: /* @__PURE__ */ n(Q.EmptyState, { illustration: /* @__PURE__ */ n(ft, { size: 64 }), title: "No agents found", description: "No agents match your search criteria. Try adjusting your search." }) }) : !y?.agents?.length && !v ? /* @__PURE__ */ n(Q.Container, { children: /* @__PURE__ */ n(Q.EmptyState, { illustration: /* @__PURE__ */ n(ft, { size: 64 }), title: "No agents found", description: "Create a new agent to get started", action: /* @__PURE__ */ n(ee, { variant: "contained", color: "primary", startIcon: /* @__PURE__ */ n(Qe, {}), onClick: M, "aria-controls": g ? "add-agent-menu" : void 0, "aria-haspopup": "true", "aria-expanded": !!g, children: "Add New Agent" }) }) }) : null
1939
- ] }),
1940
- /* @__PURE__ */ u(w, { display: "flex", flexDirection: "column", gap: 2, width: 450, height: "fit-content", children: [
1941
- /* @__PURE__ */ n(ei, {}),
1942
- /* @__PURE__ */ n(li, {})
1943
- ] })
1944
- ] }) }),
1945
- _ && /* @__PURE__ */ n(si, { open: d, onClose: () => m(!1), project: _, orgId: p || "default" })
1946
- ] });
1947
- }, hi = () => {
1948
- const t = K(1);
1949
- let e;
1950
- return t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n(pi, {}), t[0] = e) : e = t[0], e;
1951
- }, Rt = 148, fi = {
1952
- xs: "repeat(1, minmax(0, 1fr))",
1953
- md: "repeat(2, minmax(0, 1fr))",
1954
- lg: "repeat(3, minmax(0, 1fr))",
1955
- xl: "repeat(4, minmax(0, 1fr))",
1956
- xxl: "repeat(5, minmax(0, 1fr))"
1957
- };
1958
- function ui(t) {
1959
- const e = K(55), {
1960
- project: i,
1961
- pipeline: l,
1962
- handleDeleteProject: a
1963
- } = t, {
1964
- orgId: s
1965
- } = ge();
1966
- let r;
1967
- e[0] !== s || e[1] !== i.name ? (r = le(ie.children.org.children.projects.path, {
1968
- orgId: s,
1969
- projectId: i.name
1970
- }), e[0] = s, e[1] = i.name, e[2] = r) : r = e[2];
1971
- const o = r;
1972
- let d;
1973
- e[3] !== i.description ? (d = i.description?.trim() ?? "", e[3] = i.description, e[4] = d) : d = e[4];
1974
- const m = d;
1975
- let g;
1976
- e[5] !== i.createdAt ? (g = i.createdAt ? gn(new Date(i.createdAt)) : "—", e[5] = i.createdAt, e[6] = g) : g = e[6];
1977
- const f = g;
1978
- let c;
1979
- e[7] !== a || e[8] !== i ? (c = (ce) => {
1980
- ce.preventDefault(), ce.stopPropagation(), a(i);
1981
- }, e[7] = a, e[8] = i, e[9] = c) : c = e[9];
1982
- const p = c;
1983
- let h;
1984
- e[10] === Symbol.for("react.memo_cache_sentinel") ? (h = {
1985
- textDecoration: "none"
1986
- }, e[10] = h) : h = e[10];
1987
- let b;
1988
- e[11] === Symbol.for("react.memo_cache_sentinel") ? (b = {
1989
- position: "relative",
1990
- width: "100%",
1991
- height: Rt,
1992
- textAlign: "left",
1993
- display: "flex",
1994
- flexDirection: "column",
1995
- p: 2,
1996
- boxSizing: "border-box"
1997
- }, e[11] = b) : b = e[11];
1998
- let y;
1999
- e[12] === Symbol.for("react.memo_cache_sentinel") ? (y = {
2000
- display: "flex",
2001
- alignItems: "flex-start",
2002
- gap: 1.5,
2003
- minWidth: 0
2004
- }, e[12] = y) : y = e[12];
2005
- let x;
2006
- e[13] === Symbol.for("react.memo_cache_sentinel") ? (x = /* @__PURE__ */ n(Ct, { sx: {
2007
- bgcolor: "secondary.main",
2008
- color: "primary.light",
2009
- height: 44,
2010
- width: 44,
2011
- flexShrink: 0
2012
- }, children: /* @__PURE__ */ n(jt, { size: 26 }) }), e[13] = x) : x = e[13];
2013
- let N;
2014
- e[14] === Symbol.for("react.memo_cache_sentinel") ? (N = {
2015
- flex: 1,
2016
- minWidth: 0
2017
- }, e[14] = N) : N = e[14];
2018
- let v;
2019
- e[15] === Symbol.for("react.memo_cache_sentinel") ? (v = {
2020
- lineHeight: 1.3,
2021
- mb: 0.4
2022
- }, e[15] = v) : v = e[15];
2023
- let S;
2024
- e[16] !== i.displayName ? (S = /* @__PURE__ */ n(I, { variant: "h5", noWrap: !0, sx: v, children: i.displayName }), e[16] = i.displayName, e[17] = S) : S = e[17];
2025
- const k = m || "", _ = !m, j = m ? "text.secondary" : "text.disabled", W = m ? "normal" : "italic";
2026
- let D;
2027
- e[18] !== W ? (D = {
2028
- display: "-webkit-box",
2029
- WebkitLineClamp: 2,
2030
- WebkitBoxOrient: "vertical",
2031
- overflow: "hidden",
2032
- fontStyle: W,
2033
- lineHeight: 1.5
2034
- }, e[18] = W, e[19] = D) : D = e[19];
2035
- const C = m || "No description";
2036
- let A;
2037
- e[20] !== j || e[21] !== D || e[22] !== C ? (A = /* @__PURE__ */ n(I, { variant: "caption", color: j, sx: D, children: C }), e[20] = j, e[21] = D, e[22] = C, e[23] = A) : A = e[23];
2038
- let E;
2039
- e[24] !== k || e[25] !== _ || e[26] !== A ? (E = /* @__PURE__ */ n(ve, { title: k, placement: "bottom-start", disableHoverListener: _, children: A }), e[24] = k, e[25] = _, e[26] = A, e[27] = E) : E = e[27];
2040
- let $;
2041
- e[28] !== S || e[29] !== E ? ($ = /* @__PURE__ */ u(w, { sx: y, children: [
2042
- x,
2043
- /* @__PURE__ */ u(w, { sx: N, children: [
2044
- S,
2045
- E
2046
- ] })
2047
- ] }), e[28] = S, e[29] = E, e[30] = $) : $ = e[30];
2048
- let M;
2049
- e[31] === Symbol.for("react.memo_cache_sentinel") ? (M = /* @__PURE__ */ n(te, { sx: {
2050
- mb: 1
2051
- } }), e[31] = M) : M = e[31];
2052
- let L;
2053
- e[32] === Symbol.for("react.memo_cache_sentinel") ? (L = {
2054
- display: "flex",
2055
- flexDirection: "column",
2056
- gap: 0.5,
2057
- minWidth: 0
2058
- }, e[32] = L) : L = e[32];
2059
- let R;
2060
- e[33] === Symbol.for("react.memo_cache_sentinel") ? (R = {
2061
- display: "flex",
2062
- alignItems: "center",
2063
- gap: 0.5,
2064
- overflow: "hidden"
2065
- }, e[33] = R) : R = e[33];
2066
- let T;
2067
- e[34] === Symbol.for("react.memo_cache_sentinel") ? (T = /* @__PURE__ */ n(Dt, { size: 13, style: {
2068
- opacity: 0.5,
2069
- flexShrink: 0
2070
- } }), e[34] = T) : T = e[34];
2071
- let B;
2072
- e[35] !== l ? (B = /* @__PURE__ */ u(w, { sx: R, children: [
2073
- T,
2074
- l ? /* @__PURE__ */ n(I, { variant: "caption", color: "text.secondary", noWrap: !0, children: l.displayName || l.name }) : /* @__PURE__ */ n(I, { variant: "caption", color: "text.disabled", sx: {
2075
- fontStyle: "italic"
2076
- }, children: "No pipeline" })
2077
- ] }), e[35] = l, e[36] = B) : B = e[36];
2078
- let O, G;
2079
- e[37] === Symbol.for("react.memo_cache_sentinel") ? (O = {
2080
- display: "flex",
2081
- alignItems: "center",
2082
- gap: 0.4
2083
- }, G = /* @__PURE__ */ n(kt, { size: 12 }), e[37] = O, e[38] = G) : (O = e[37], G = e[38]);
2084
- let z;
2085
- e[39] !== f ? (z = /* @__PURE__ */ u(I, { variant: "caption", color: "text.disabled", sx: O, children: [
2086
- G,
2087
- f
2088
- ] }), e[39] = f, e[40] = z) : z = e[40];
2089
- let F;
2090
- e[41] !== B || e[42] !== z ? (F = /* @__PURE__ */ u(w, { sx: L, children: [
2091
- B,
2092
- z
2093
- ] }), e[41] = B, e[42] = z, e[43] = F) : F = e[43];
2094
- let P;
2095
- e[44] === Symbol.for("react.memo_cache_sentinel") ? (P = {
2096
- position: "absolute",
2097
- bottom: 8,
2098
- right: 8
2099
- }, e[44] = P) : P = e[44];
2100
- let U;
2101
- e[45] === Symbol.for("react.memo_cache_sentinel") ? (U = /* @__PURE__ */ n(Fe, { size: 15 }), e[45] = U) : U = e[45];
2102
- let V;
2103
- e[46] !== p ? (V = /* @__PURE__ */ n(Te.DisappearingCardButtonContent, { sx: P, children: /* @__PURE__ */ n(ve, { title: "Delete Project", children: /* @__PURE__ */ n(ze, { size: "small", color: "error", onClick: p, children: U }) }) }), e[46] = p, e[47] = V) : V = e[47];
2104
- let X;
2105
- e[48] !== $ || e[49] !== F || e[50] !== V ? (X = /* @__PURE__ */ u(Te.CardButton, { sx: b, children: [
2106
- $,
2107
- M,
2108
- F,
2109
- V
2110
- ] }), e[48] = $, e[49] = F, e[50] = V, e[51] = X) : X = e[51];
2111
- let Y;
2112
- return e[52] !== o || e[53] !== X ? (Y = /* @__PURE__ */ n(pe, { to: o, style: h, children: X }), e[52] = o, e[53] = X, e[54] = Y) : Y = e[54], Y;
2113
- }
2114
- function gi() {
2115
- const t = K(8);
2116
- let e;
2117
- t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = {
2118
- width: "100%",
2119
- height: Rt,
2120
- textAlign: "left",
2121
- display: "flex",
2122
- flexDirection: "column",
2123
- p: 2,
2124
- boxSizing: "border-box",
2125
- pointerEvents: "none"
2126
- }, t[0] = e) : e = t[0];
2127
- let i, l;
2128
- t[1] === Symbol.for("react.memo_cache_sentinel") ? (i = {
2129
- display: "flex",
2130
- alignItems: "flex-start",
2131
- width: "100%",
2132
- gap: 1.5
2133
- }, l = /* @__PURE__ */ n(H, { variant: "circular", width: 44, height: 44 }), t[1] = i, t[2] = l) : (i = t[1], l = t[2]);
2134
- let a;
2135
- t[3] === Symbol.for("react.memo_cache_sentinel") ? (a = {
2136
- flex: 1
2137
- }, t[3] = a) : a = t[3];
2138
- let s;
2139
- t[4] === Symbol.for("react.memo_cache_sentinel") ? (s = /* @__PURE__ */ u(w, { sx: i, children: [
2140
- l,
2141
- /* @__PURE__ */ u(w, { sx: a, children: [
2142
- /* @__PURE__ */ n(H, { variant: "text", width: "55%", height: 22, sx: {
2143
- mb: 0.5
2144
- } }),
2145
- /* @__PURE__ */ n(H, { variant: "text", width: "90%", height: 14 }),
2146
- /* @__PURE__ */ n(H, { variant: "text", width: "70%", height: 14 })
2147
- ] })
2148
- ] }), t[4] = s) : s = t[4];
2149
- let r;
2150
- t[5] === Symbol.for("react.memo_cache_sentinel") ? (r = /* @__PURE__ */ n(w, { sx: {
2151
- flex: 1
2152
- } }), t[5] = r) : r = t[5];
2153
- let o;
2154
- t[6] === Symbol.for("react.memo_cache_sentinel") ? (o = /* @__PURE__ */ n(te, { sx: {
2155
- mb: 1
2156
- } }), t[6] = o) : o = t[6];
2157
- let d;
2158
- return t[7] === Symbol.for("react.memo_cache_sentinel") ? (d = /* @__PURE__ */ u(Te.CardButton, { tabIndex: -1, sx: e, children: [
2159
- s,
2160
- r,
2161
- o,
2162
- /* @__PURE__ */ u(w, { sx: {
2163
- display: "flex",
2164
- alignItems: "center",
2165
- gap: 2
2166
- }, children: [
2167
- /* @__PURE__ */ n(H, { variant: "text", width: 90, height: 16 }),
2168
- /* @__PURE__ */ n(H, { variant: "text", width: 70, height: 16 })
2169
- ] })
2170
- ] }), t[7] = d) : d = t[7], d;
2171
- }
2172
- function yi() {
2173
- const {
2174
- orgId: t
2175
- } = ge(), {
2176
- data: e,
2177
- isPending: i
2178
- } = dn({
2179
- orgName: t
2180
- }), {
2181
- data: l
2182
- } = rt({
2183
- orgName: t
2184
- }), a = ae(() => new Map(l?.deploymentPipelines?.map((c) => [c.name, c]) ?? []), [l]), {
2185
- addConfirmation: s
2186
- } = Pt(), {
2187
- mutate: r,
2188
- isPending: o
2189
- } = mn(), d = he((c) => {
2190
- s({
2191
- title: "Delete Project?",
2192
- description: `Are you sure you want to delete the project "${c.displayName}"? This action cannot be undone.`,
2193
- onConfirm: () => {
2194
- r({
2195
- orgName: t,
2196
- projName: c.name
2197
- });
2198
- },
2199
- confirmButtonColor: "error",
2200
- confirmButtonIcon: /* @__PURE__ */ n(Fe, { size: 16 }),
2201
- confirmButtonText: "Delete"
2202
- });
2203
- }, [s, r, t]), [m, g] = ne(""), f = ae(() => e?.projects?.filter((c) => c.displayName.toLowerCase().includes(m.toLowerCase())) ?? [], [e, m]);
2204
- return /* @__PURE__ */ n(at, { title: "All Projects", disableIcon: !0, children: /* @__PURE__ */ u(w, { sx: {
2205
- display: "flex",
2206
- flexDirection: "column",
2207
- gap: 4
2208
- }, children: [
2209
- /* @__PURE__ */ u(w, { display: "flex", gap: 2, children: [
2210
- /* @__PURE__ */ n(w, { flexGrow: 1, children: /* @__PURE__ */ n(It, { value: m, onChange: (c) => g(c.target.value), placeholder: "Search Projects", disabled: !e?.projects?.length, size: "small", fullWidth: !0 }) }),
2211
- /* @__PURE__ */ n(ee, { variant: "contained", color: "primary", size: "small", startIcon: /* @__PURE__ */ n(Qe, { size: 16 }), component: pe, to: le(ie.children.org.children.newProject.path, {
2212
- orgId: t
2213
- }), children: "Add Project" })
2214
- ] }),
2215
- f.length === 0 && !i && /* @__PURE__ */ n(et, { message: "No Projects Found", subtitle: m ? "Looks like there are no projects matching your search." : "Create a New Project to Get Started", iconElement: jt }),
2216
- /* @__PURE__ */ n(w, { sx: {
2217
- display: "grid",
2218
- gridTemplateColumns: fi,
2219
- gap: 2,
2220
- width: "100%"
2221
- }, children: i || o ? Array.from({
2222
- length: 4
2223
- }).map((c, p) => /* @__PURE__ */ n(gi, {}, p)) : f.map((c) => /* @__PURE__ */ n(ui, { project: c, pipeline: c.deploymentPipeline ? a.get(c.deploymentPipeline) : void 0, handleDeleteProject: d }, c.name)) })
2224
- ] }) });
2225
- }
2226
- const bi = () => {
2227
- const t = K(1);
2228
- let e;
2229
- return t[0] === Symbol.for("react.memo_cache_sentinel") ? (e = /* @__PURE__ */ n(yi, {}), t[0] = e) : e = t[0], e;
2230
- }, Li = {
2231
- title: "Overview",
2232
- description: "A page component for Overview",
2233
- icon: Cn,
2234
- path: "/overview",
2235
- component: xt,
2236
- levels: {
2237
- component: xt,
2238
- project: hi,
2239
- organization: bi
2240
- }
2241
- };
2242
- export {
2243
- xt as OverviewComponent,
2244
- bi as OverviewOrganization,
2245
- hi as OverviewProject,
2246
- Li as metaData
2247
- };