@wso2/am-core-ui 0.0.13 → 0.0.15

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