@shuffleio/shuffle-mcps 0.0.6 → 0.0.8
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.
- package/README.md +122 -3
- package/dist/index.cjs +1929 -772
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +220 -11
- package/dist/index.d.ts +220 -11
- package/dist/index.js +1956 -774
- package/dist/index.js.map +1 -1
- package/dist/{shuffle-mcp-JQWKQNUP.css → shuffle-mcp-24XBNRGE.css} +45 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// index.ts
|
|
2
|
+
import "./shuffle-mcp-24XBNRGE.css";
|
|
3
|
+
|
|
1
4
|
// ShuffleMCP.tsx
|
|
2
5
|
import React, { useState as useState8, useEffect as useEffect6, useRef as useRef5, useCallback as useCallback7, useMemo as useMemo4, useImperativeHandle } from "react";
|
|
3
6
|
import { algoliasearch } from "algoliasearch";
|
|
@@ -400,6 +403,50 @@ var fetchAuthenticatedApps = (crossOrgId) => {
|
|
|
400
403
|
return promise;
|
|
401
404
|
};
|
|
402
405
|
|
|
406
|
+
// appsCache.ts
|
|
407
|
+
var TTL_MS2 = 3e4;
|
|
408
|
+
var cache2 = /* @__PURE__ */ new Map();
|
|
409
|
+
var cacheKey2 = (o) => `${o.baseUrl}|${o.path || "/api/v1/apps"}|${o.apiKey || ""}|${o.orgId || ""}`;
|
|
410
|
+
var doFetch2 = async (o) => {
|
|
411
|
+
const headers = {};
|
|
412
|
+
if (o.apiKey) headers["Authorization"] = `Bearer ${o.apiKey}`;
|
|
413
|
+
if (o.orgId) headers["Org-Id"] = o.orgId;
|
|
414
|
+
const response = await fetch(`${o.baseUrl}${o.path || "/api/v1/apps"}`, {
|
|
415
|
+
credentials: "include",
|
|
416
|
+
headers
|
|
417
|
+
});
|
|
418
|
+
if (!response.ok) return [];
|
|
419
|
+
const data = await response.json();
|
|
420
|
+
if (Array.isArray(data)) return data;
|
|
421
|
+
return Array.isArray(data?.data) ? data.data : [];
|
|
422
|
+
};
|
|
423
|
+
var fetchApps = (opts) => {
|
|
424
|
+
const key = cacheKey2(opts);
|
|
425
|
+
const entry = cache2.get(key) || {};
|
|
426
|
+
if (entry.data && entry.fetchedAt && Date.now() - entry.fetchedAt < TTL_MS2) {
|
|
427
|
+
return Promise.resolve(entry.data);
|
|
428
|
+
}
|
|
429
|
+
if (entry.promise) return entry.promise;
|
|
430
|
+
const promise = doFetch2(opts).then((data) => {
|
|
431
|
+
cache2.set(key, { data, fetchedAt: Date.now() });
|
|
432
|
+
return data;
|
|
433
|
+
}).catch((err) => {
|
|
434
|
+
cache2.delete(key);
|
|
435
|
+
throw err;
|
|
436
|
+
});
|
|
437
|
+
cache2.set(key, { ...entry, promise });
|
|
438
|
+
return promise;
|
|
439
|
+
};
|
|
440
|
+
var fetchAppsViaApiConfig = () => {
|
|
441
|
+
const headers = getAuthHeader();
|
|
442
|
+
const orgId = headers["Org-Id"] || null;
|
|
443
|
+
return fetchApps({
|
|
444
|
+
baseUrl: API_CONFIG.baseUrl,
|
|
445
|
+
apiKey: API_CONFIG.apiKey,
|
|
446
|
+
orgId
|
|
447
|
+
});
|
|
448
|
+
};
|
|
449
|
+
|
|
403
450
|
// auth-utils.ts
|
|
404
451
|
function deduplicateAuthApps(apps) {
|
|
405
452
|
const appMap = /* @__PURE__ */ new Map();
|
|
@@ -568,35 +615,25 @@ var IntegrationStatus = ({ collapsed, filterApps, onAddClick, iconSize = 26, onD
|
|
|
568
615
|
}
|
|
569
616
|
if (dedupedIntegrations.length < 10) {
|
|
570
617
|
try {
|
|
571
|
-
const
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
id: app.id || app.name,
|
|
591
|
-
name: app.name,
|
|
592
|
-
icon: app.large_image || "",
|
|
593
|
-
category: app.categories?.[0] || "Integration",
|
|
594
|
-
hasValidAuth: false,
|
|
595
|
-
authInstances: [],
|
|
596
|
-
isActiveOnly: true
|
|
597
|
-
});
|
|
598
|
-
added++;
|
|
599
|
-
}
|
|
618
|
+
const appsData = await fetchAppsViaApiConfig();
|
|
619
|
+
if (Array.isArray(appsData)) {
|
|
620
|
+
const activatedApps = appsData.filter((app) => app.activated);
|
|
621
|
+
const slotsRemaining = 10 - dedupedIntegrations.length;
|
|
622
|
+
let added = 0;
|
|
623
|
+
for (const app of activatedApps) {
|
|
624
|
+
if (added >= slotsRemaining) break;
|
|
625
|
+
if (!authNameSet.has((app.name || "").toLowerCase())) {
|
|
626
|
+
authNameSet.add((app.name || "").toLowerCase());
|
|
627
|
+
dedupedIntegrations.push({
|
|
628
|
+
id: app.id || app.name,
|
|
629
|
+
name: app.name,
|
|
630
|
+
icon: app.large_image || "",
|
|
631
|
+
category: app.categories?.[0] || "Integration",
|
|
632
|
+
hasValidAuth: false,
|
|
633
|
+
authInstances: [],
|
|
634
|
+
isActiveOnly: true
|
|
635
|
+
});
|
|
636
|
+
added++;
|
|
600
637
|
}
|
|
601
638
|
}
|
|
602
639
|
}
|
|
@@ -1221,8 +1258,8 @@ function AppTitleHeader({
|
|
|
1221
1258
|
py: 0.5,
|
|
1222
1259
|
minHeight: 0,
|
|
1223
1260
|
flexShrink: 0,
|
|
1224
|
-
bgcolor: "
|
|
1225
|
-
"&:hover": { bgcolor: "
|
|
1261
|
+
bgcolor: "hsl(var(--primary))",
|
|
1262
|
+
"&:hover": { bgcolor: "hsl(var(--primary) / 0.85)" }
|
|
1226
1263
|
},
|
|
1227
1264
|
children: "+ Add"
|
|
1228
1265
|
}
|
|
@@ -1243,7 +1280,7 @@ function AppTitleHeader({
|
|
|
1243
1280
|
py: 0.5,
|
|
1244
1281
|
minHeight: 0,
|
|
1245
1282
|
flexShrink: 0,
|
|
1246
|
-
...isActivated ? { color: "hsl(var(--muted-foreground))", borderColor: "hsl(var(--border))", "&:hover": { borderColor: "hsl(var(--destructive))", color: "hsl(var(--destructive))", bgcolor: "hsla(var(--destructive) / 0.08)" } } : { bgcolor: "
|
|
1283
|
+
...isActivated ? { color: "hsl(var(--muted-foreground))", borderColor: "hsl(var(--border))", "&:hover": { borderColor: "hsl(var(--destructive))", color: "hsl(var(--destructive))", bgcolor: "hsla(var(--destructive) / 0.08)" } } : { bgcolor: "hsl(var(--primary))", "&:hover": { bgcolor: "hsl(var(--primary) / 0.85)" } }
|
|
1247
1284
|
},
|
|
1248
1285
|
children: activateLoading ? "\u2026" : isActivated ? "Deactivate" : "Activate"
|
|
1249
1286
|
}
|
|
@@ -1335,7 +1372,10 @@ var AppAuthCard = ({
|
|
|
1335
1372
|
apiAuthEntries,
|
|
1336
1373
|
onSelectAuth,
|
|
1337
1374
|
onRefreshAuth,
|
|
1338
|
-
disableUrlPrefill
|
|
1375
|
+
disableUrlPrefill,
|
|
1376
|
+
hideHeader,
|
|
1377
|
+
hideStatusChips,
|
|
1378
|
+
hideDocsLink
|
|
1339
1379
|
}) => {
|
|
1340
1380
|
const getBestDefaultAuth = (entries) => {
|
|
1341
1381
|
if (entries.length === 0) return ADD_NEW_AUTH;
|
|
@@ -1555,6 +1595,22 @@ var AppAuthCard = ({
|
|
|
1555
1595
|
setLocalCredentials((prev) => ({ ...urlDefaults, ...prev }));
|
|
1556
1596
|
}
|
|
1557
1597
|
}, [auth?.parameters, disableUrlPrefill]);
|
|
1598
|
+
useEffect3(() => {
|
|
1599
|
+
const incoming = authState.credentials || {};
|
|
1600
|
+
setLocalCredentials((prev) => {
|
|
1601
|
+
let changed = false;
|
|
1602
|
+
const next = { ...prev };
|
|
1603
|
+
for (const [k, v] of Object.entries(incoming)) {
|
|
1604
|
+
const lk = k.toLowerCase();
|
|
1605
|
+
const isUrlish = lk.includes("url") || lk.includes("endpoint") || lk.includes("host");
|
|
1606
|
+
if (isUrlish && typeof v === "string" && v !== prev[k]) {
|
|
1607
|
+
next[k] = v;
|
|
1608
|
+
changed = true;
|
|
1609
|
+
}
|
|
1610
|
+
}
|
|
1611
|
+
return changed ? next : prev;
|
|
1612
|
+
});
|
|
1613
|
+
}, [authState.credentials]);
|
|
1558
1614
|
const [docsOpen, setDocsOpen] = useState4(false);
|
|
1559
1615
|
const [docsContent, setDocsContent] = useState4("");
|
|
1560
1616
|
const [docsLoading, setDocsLoading] = useState4(false);
|
|
@@ -1628,10 +1684,9 @@ var AppAuthCard = ({
|
|
|
1628
1684
|
const renderOAuth2Fields = () => {
|
|
1629
1685
|
if (!auth || !isOAuth2) return null;
|
|
1630
1686
|
const availableScopes = auth.scope || [];
|
|
1631
|
-
const isCloudOrDev = isDevEnvironment() || isCloudDomain();
|
|
1632
1687
|
const hasManualCredentials = !!localCredentials["client_id"]?.trim() && !!localCredentials["client_secret"]?.trim();
|
|
1633
1688
|
return /* @__PURE__ */ jsxs3(Box3, { sx: { display: "flex", flexDirection: "column", gap: 3 }, children: [
|
|
1634
|
-
|
|
1689
|
+
/* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
1635
1690
|
/* @__PURE__ */ jsx4(Collapse, { in: !hasManualCredentials, children: /* @__PURE__ */ jsxs3(Box3, { sx: { display: "flex", flexDirection: "column", gap: 3 }, children: [
|
|
1636
1691
|
/* @__PURE__ */ jsxs3(
|
|
1637
1692
|
Button2,
|
|
@@ -1818,7 +1873,7 @@ var AppAuthCard = ({
|
|
|
1818
1873
|
{
|
|
1819
1874
|
label: /* @__PURE__ */ jsxs3(Box3, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
1820
1875
|
param.name,
|
|
1821
|
-
param.required && /* @__PURE__ */ jsx4(Typography3, { component: "span", sx: { color: "
|
|
1876
|
+
param.required && /* @__PURE__ */ jsx4(Typography3, { component: "span", sx: { color: "hsl(var(--destructive))", fontSize: "0.8rem" }, children: "*" })
|
|
1822
1877
|
] }),
|
|
1823
1878
|
type: param.name.toLowerCase().includes("password") || param.name.toLowerCase().includes("secret") || param.name.toLowerCase().includes("key") ? "password" : "text",
|
|
1824
1879
|
placeholder: param.example || `Enter ${param.name}`,
|
|
@@ -1832,13 +1887,13 @@ var AppAuthCard = ({
|
|
|
1832
1887
|
"& .MuiOutlinedInput-root": {
|
|
1833
1888
|
backgroundColor: "hsl(var(--muted))",
|
|
1834
1889
|
borderRadius: 2,
|
|
1835
|
-
"& fieldset": { borderColor: fieldErrors[fieldKey] ? "
|
|
1836
|
-
"&:hover fieldset": { borderColor: fieldErrors[fieldKey] ? "
|
|
1837
|
-
"&.Mui-focused fieldset": { borderColor: fieldErrors[fieldKey] ? "
|
|
1890
|
+
"& fieldset": { borderColor: fieldErrors[fieldKey] ? "hsl(var(--destructive))" : "hsl(var(--border))" },
|
|
1891
|
+
"&:hover fieldset": { borderColor: fieldErrors[fieldKey] ? "hsl(var(--destructive))" : "hsl(var(--border))" },
|
|
1892
|
+
"&.Mui-focused fieldset": { borderColor: fieldErrors[fieldKey] ? "hsl(var(--destructive))" : "hsl(var(--primary))" }
|
|
1838
1893
|
},
|
|
1839
1894
|
"& .MuiInputBase-input": { color: "hsl(var(--foreground))" },
|
|
1840
1895
|
"& .MuiInputLabel-root": { color: "hsl(var(--muted-foreground))" },
|
|
1841
|
-
"& .MuiFormHelperText-root": { color: fieldErrors[fieldKey] ? "
|
|
1896
|
+
"& .MuiFormHelperText-root": { color: fieldErrors[fieldKey] ? "hsl(var(--destructive))" : "hsl(var(--muted-foreground))" }
|
|
1842
1897
|
}
|
|
1843
1898
|
},
|
|
1844
1899
|
fieldKey
|
|
@@ -1912,7 +1967,7 @@ var AppAuthCard = ({
|
|
|
1912
1967
|
maxWidth: "100%"
|
|
1913
1968
|
},
|
|
1914
1969
|
children: [
|
|
1915
|
-
/* @__PURE__ */ jsxs3(
|
|
1970
|
+
!hideHeader && /* @__PURE__ */ jsxs3(
|
|
1916
1971
|
CardContent,
|
|
1917
1972
|
{
|
|
1918
1973
|
onClick: onToggle,
|
|
@@ -2001,7 +2056,7 @@ var AppAuthCard = ({
|
|
|
2001
2056
|
width: { xs: "100%", sm: "auto" },
|
|
2002
2057
|
justifyContent: { xs: "flex-start", sm: "flex-end" }
|
|
2003
2058
|
}, children: [
|
|
2004
|
-
isNoAuthRequired(auth) ? /* @__PURE__ */ jsx4(
|
|
2059
|
+
!hideStatusChips && (isNoAuthRequired(auth) ? /* @__PURE__ */ jsx4(
|
|
2005
2060
|
Chip2,
|
|
2006
2061
|
{
|
|
2007
2062
|
label: "Auth not required",
|
|
@@ -2052,8 +2107,8 @@ var AppAuthCard = ({
|
|
|
2052
2107
|
)
|
|
2053
2108
|
}
|
|
2054
2109
|
)
|
|
2055
|
-
] }),
|
|
2056
|
-
/* @__PURE__ */ jsx4(Tooltip2, { title: "View documentation", children: /* @__PURE__ */ jsx4(
|
|
2110
|
+
] })),
|
|
2111
|
+
!hideDocsLink && /* @__PURE__ */ jsx4(Tooltip2, { title: "View documentation", children: /* @__PURE__ */ jsx4(
|
|
2057
2112
|
IconButton2,
|
|
2058
2113
|
{
|
|
2059
2114
|
size: "small",
|
|
@@ -2333,8 +2388,8 @@ var AppAuthCard = ({
|
|
|
2333
2388
|
width: 8,
|
|
2334
2389
|
height: 8,
|
|
2335
2390
|
borderRadius: "50%",
|
|
2336
|
-
backgroundColor: localTestStatus === "success" ? "
|
|
2337
|
-
boxShadow: localTestStatus === "success" ? "0 0 8px
|
|
2391
|
+
backgroundColor: localTestStatus === "success" ? "hsl(var(--severity-low))" : localTestStatus === "pending_validation" ? "hsl(var(--severity-medium))" : localTestStatus === "error" ? "hsl(var(--destructive))" : "hsl(var(--muted-foreground))",
|
|
2392
|
+
boxShadow: localTestStatus === "success" ? "0 0 8px hsl(var(--severity-low) / 0.6)" : localTestStatus === "pending_validation" ? "0 0 8px hsl(var(--severity-medium) / 0.6)" : localTestStatus === "error" ? "0 0 8px hsl(var(--destructive) / 0.6)" : "0 0 8px hsl(var(--muted-foreground) / 0.4)"
|
|
2338
2393
|
} }),
|
|
2339
2394
|
/* @__PURE__ */ jsx4(Typography3, { sx: {
|
|
2340
2395
|
color: "hsl(var(--muted-foreground))",
|
|
@@ -2365,11 +2420,11 @@ var AppAuthCard = ({
|
|
|
2365
2420
|
display: "flex",
|
|
2366
2421
|
alignItems: "center",
|
|
2367
2422
|
justifyContent: "center",
|
|
2368
|
-
backgroundColor: localTestStatus === "success" ? "
|
|
2369
|
-
border: `1px solid ${localTestStatus === "success" ? "
|
|
2423
|
+
backgroundColor: localTestStatus === "success" ? "hsl(var(--severity-low) / 0.1)" : localTestStatus === "error" ? "hsl(var(--destructive) / 0.1)" : localTestStatus === "pending_validation" ? "hsl(var(--severity-medium) / 0.1)" : isTested ? "hsl(var(--severity-low) / 0.1)" : isConfigured ? "hsl(var(--severity-medium) / 0.1)" : "hsl(var(--muted-foreground) / 0.1)",
|
|
2424
|
+
border: `1px solid ${localTestStatus === "success" ? "hsl(var(--severity-low) / 0.2)" : localTestStatus === "pending_validation" ? "hsl(var(--severity-medium) / 0.2)" : localTestStatus === "error" ? "hsl(var(--destructive) / 0.2)" : isTested ? "hsl(var(--severity-low) / 0.2)" : isConfigured ? "hsl(var(--severity-medium) / 0.2)" : "hsl(var(--muted-foreground) / 0.2)"}`,
|
|
2370
2425
|
flexShrink: 0
|
|
2371
2426
|
}, children: /* @__PURE__ */ jsx4(CheckCircleIcon2, { sx: {
|
|
2372
|
-
color: localTestStatus === "success" ? "
|
|
2427
|
+
color: localTestStatus === "success" ? "hsl(var(--severity-low))" : localTestStatus === "pending_validation" ? "hsl(var(--severity-medium))" : localTestStatus === "error" ? "hsl(var(--destructive))" : isTested ? "hsl(var(--severity-low))" : isConfigured ? "hsl(var(--severity-medium))" : "hsl(var(--muted-foreground))",
|
|
2373
2428
|
fontSize: 20
|
|
2374
2429
|
} }) }),
|
|
2375
2430
|
/* @__PURE__ */ jsxs3(Box3, { sx: { minWidth: 0, flex: 1 }, children: [
|
|
@@ -2463,7 +2518,7 @@ var AppAuthCard = ({
|
|
|
2463
2518
|
) })
|
|
2464
2519
|
] }) }),
|
|
2465
2520
|
/* @__PURE__ */ jsx4(Typography3, { sx: {
|
|
2466
|
-
color: localTestStatus === "success" ? "
|
|
2521
|
+
color: localTestStatus === "success" ? "hsl(var(--severity-low))" : localTestStatus === "pending_validation" ? "hsl(var(--severity-medium))" : localTestStatus === "error" ? "hsl(var(--destructive))" : isTested ? "hsl(var(--severity-low))" : isConfigured ? "hsl(var(--severity-medium))" : "hsl(var(--muted-foreground))",
|
|
2467
2522
|
fontSize: "0.75rem",
|
|
2468
2523
|
mt: 0.25,
|
|
2469
2524
|
fontWeight: localTestStatus !== "untested" || isTested || isConfigured ? 500 : 400
|
|
@@ -2483,9 +2538,9 @@ var AppAuthCard = ({
|
|
|
2483
2538
|
disabled: authState.status === "testing",
|
|
2484
2539
|
startIcon: authState.status === "testing" ? /* @__PURE__ */ jsx4(CircularProgress2, { size: 16, sx: { color: "inherit" } }) : /* @__PURE__ */ jsx4(CheckCircleIcon2, { sx: { fontSize: 18 } }),
|
|
2485
2540
|
sx: {
|
|
2486
|
-
borderColor: authState.status === "testing" ? "transparent" : "
|
|
2541
|
+
borderColor: authState.status === "testing" ? "transparent" : "hsl(var(--primary) / 0.5)",
|
|
2487
2542
|
color: authState.status === "testing" ? "hsl(var(--foreground))" : "hsl(var(--primary))",
|
|
2488
|
-
background: authState.status === "testing" ? "linear-gradient(90deg,
|
|
2543
|
+
background: authState.status === "testing" ? "linear-gradient(90deg, hsl(var(--primary) / 0.3) 0%, hsl(var(--primary) / 0.5) 50%, hsl(var(--primary) / 0.3) 100%)" : "transparent",
|
|
2489
2544
|
backgroundSize: authState.status === "testing" ? "200% 100%" : "auto",
|
|
2490
2545
|
animation: authState.status === "testing" ? "shimmer 1.5s infinite linear" : "none",
|
|
2491
2546
|
fontWeight: 600,
|
|
@@ -2503,7 +2558,7 @@ var AppAuthCard = ({
|
|
|
2503
2558
|
},
|
|
2504
2559
|
"&:hover": {
|
|
2505
2560
|
borderColor: "hsl(var(--primary))",
|
|
2506
|
-
backgroundColor: authState.status === "testing" ? void 0 : "
|
|
2561
|
+
backgroundColor: authState.status === "testing" ? void 0 : "hsl(var(--primary) / 0.08)"
|
|
2507
2562
|
},
|
|
2508
2563
|
"&.Mui-disabled": {
|
|
2509
2564
|
color: authState.status === "testing" ? "hsl(var(--foreground))" : "hsl(var(--muted-foreground))",
|
|
@@ -2522,11 +2577,11 @@ var AppAuthCard = ({
|
|
|
2522
2577
|
{
|
|
2523
2578
|
severity: "error",
|
|
2524
2579
|
sx: {
|
|
2525
|
-
backgroundColor: "
|
|
2526
|
-
color: "
|
|
2527
|
-
border: "1px solid
|
|
2580
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)",
|
|
2581
|
+
color: "hsl(var(--destructive))",
|
|
2582
|
+
border: "1px solid hsl(var(--destructive) / 0.2)",
|
|
2528
2583
|
borderRadius: 2,
|
|
2529
|
-
"& .MuiAlert-icon": { color: "
|
|
2584
|
+
"& .MuiAlert-icon": { color: "hsl(var(--destructive))" }
|
|
2530
2585
|
},
|
|
2531
2586
|
children: /* @__PURE__ */ jsxs3(Box3, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, width: "100%" }, children: [
|
|
2532
2587
|
/* @__PURE__ */ jsx4(Typography3, { sx: { fontSize: "0.875rem", flex: 1 }, children: localTestMessages.errorMessage }),
|
|
@@ -2539,16 +2594,16 @@ var AppAuthCard = ({
|
|
|
2539
2594
|
target: "_blank",
|
|
2540
2595
|
rel: "noopener noreferrer",
|
|
2541
2596
|
sx: {
|
|
2542
|
-
borderColor: "
|
|
2543
|
-
color: "
|
|
2597
|
+
borderColor: "hsl(var(--destructive) / 0.5)",
|
|
2598
|
+
color: "hsl(var(--destructive))",
|
|
2544
2599
|
textTransform: "none",
|
|
2545
2600
|
fontSize: "0.75rem",
|
|
2546
2601
|
py: 0.5,
|
|
2547
2602
|
px: 1.5,
|
|
2548
2603
|
flexShrink: 0,
|
|
2549
2604
|
"&:hover": {
|
|
2550
|
-
borderColor: "
|
|
2551
|
-
backgroundColor: "
|
|
2605
|
+
borderColor: "hsl(var(--destructive))",
|
|
2606
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)"
|
|
2552
2607
|
}
|
|
2553
2608
|
},
|
|
2554
2609
|
children: "View Execution"
|
|
@@ -2565,12 +2620,12 @@ var AppAuthCard = ({
|
|
|
2565
2620
|
{
|
|
2566
2621
|
severity: localTestMessages.warningMessage ? "warning" : "success",
|
|
2567
2622
|
sx: {
|
|
2568
|
-
backgroundColor: localTestMessages.warningMessage ? "
|
|
2569
|
-
color: localTestMessages.warningMessage ? "
|
|
2570
|
-
border: localTestMessages.warningMessage ? "1px solid
|
|
2623
|
+
backgroundColor: localTestMessages.warningMessage ? "hsl(var(--severity-medium) / 0.1)" : "hsl(var(--severity-low) / 0.1)",
|
|
2624
|
+
color: localTestMessages.warningMessage ? "hsl(var(--severity-medium))" : "hsl(var(--severity-low))",
|
|
2625
|
+
border: localTestMessages.warningMessage ? "1px solid hsl(var(--severity-medium) / 0.2)" : "1px solid hsl(var(--severity-low) / 0.2)",
|
|
2571
2626
|
borderRadius: 2,
|
|
2572
2627
|
"& .MuiAlert-icon": {
|
|
2573
|
-
color: localTestMessages.warningMessage ? "
|
|
2628
|
+
color: localTestMessages.warningMessage ? "hsl(var(--severity-medium))" : "hsl(var(--severity-low))"
|
|
2574
2629
|
}
|
|
2575
2630
|
},
|
|
2576
2631
|
children: localTestMessages.warningMessage ? /* @__PURE__ */ jsxs3(Box3, { children: [
|
|
@@ -2587,11 +2642,11 @@ var AppAuthCard = ({
|
|
|
2587
2642
|
{
|
|
2588
2643
|
severity: "warning",
|
|
2589
2644
|
sx: {
|
|
2590
|
-
backgroundColor: "
|
|
2591
|
-
color: "
|
|
2592
|
-
border: "1px solid
|
|
2645
|
+
backgroundColor: "hsl(var(--severity-medium) / 0.1)",
|
|
2646
|
+
color: "hsl(var(--severity-medium))",
|
|
2647
|
+
border: "1px solid hsl(var(--severity-medium) / 0.2)",
|
|
2593
2648
|
borderRadius: 2,
|
|
2594
|
-
"& .MuiAlert-icon": { color: "
|
|
2649
|
+
"& .MuiAlert-icon": { color: "hsl(var(--severity-medium))" }
|
|
2595
2650
|
},
|
|
2596
2651
|
children: /* @__PURE__ */ jsxs3(Box3, { children: [
|
|
2597
2652
|
/* @__PURE__ */ jsx4(Typography3, { sx: { fontWeight: 600, mb: 0.5 }, children: "Test passed (Status 200), but not marked as validated" }),
|
|
@@ -2602,7 +2657,7 @@ var AppAuthCard = ({
|
|
|
2602
2657
|
href: `${API_CONFIG.baseUrl}/admin?tab=app_auth`,
|
|
2603
2658
|
target: "_blank",
|
|
2604
2659
|
sx: {
|
|
2605
|
-
color: "
|
|
2660
|
+
color: "hsl(var(--severity-medium))",
|
|
2606
2661
|
fontWeight: 500,
|
|
2607
2662
|
fontSize: "0.85rem",
|
|
2608
2663
|
textDecoration: "underline",
|
|
@@ -2627,12 +2682,12 @@ var AppAuthCard = ({
|
|
|
2627
2682
|
{
|
|
2628
2683
|
severity: "warning",
|
|
2629
2684
|
sx: {
|
|
2630
|
-
backgroundColor: "
|
|
2631
|
-
color: "
|
|
2632
|
-
border: "1px solid
|
|
2685
|
+
backgroundColor: "hsl(var(--severity-medium) / 0.1)",
|
|
2686
|
+
color: "hsl(var(--severity-medium))",
|
|
2687
|
+
border: "1px solid hsl(var(--severity-medium) / 0.2)",
|
|
2633
2688
|
borderRadius: 2,
|
|
2634
2689
|
mb: 2,
|
|
2635
|
-
"& .MuiAlert-icon": { color: "
|
|
2690
|
+
"& .MuiAlert-icon": { color: "hsl(var(--severity-medium))" }
|
|
2636
2691
|
},
|
|
2637
2692
|
children: /* @__PURE__ */ jsx4(Typography3, { sx: { fontSize: "0.875rem" }, children: localTestMessages.errorCode === 401 ? "Previous credentials were invalid or expired. Please enter new credentials." : "Access was denied with the previous credentials. Please re-authenticate with valid permissions." })
|
|
2638
2693
|
}
|
|
@@ -2646,9 +2701,9 @@ var AppAuthCard = ({
|
|
|
2646
2701
|
{
|
|
2647
2702
|
severity: "error",
|
|
2648
2703
|
sx: {
|
|
2649
|
-
backgroundColor: "
|
|
2650
|
-
color: "
|
|
2651
|
-
border: "1px solid
|
|
2704
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)",
|
|
2705
|
+
color: "hsl(var(--destructive))",
|
|
2706
|
+
border: "1px solid hsl(var(--destructive) / 0.3)",
|
|
2652
2707
|
borderRadius: 2
|
|
2653
2708
|
},
|
|
2654
2709
|
children: error
|
|
@@ -2658,11 +2713,11 @@ var AppAuthCard = ({
|
|
|
2658
2713
|
{
|
|
2659
2714
|
severity: "info",
|
|
2660
2715
|
sx: {
|
|
2661
|
-
backgroundColor: "
|
|
2662
|
-
color: "
|
|
2663
|
-
border: "1px solid
|
|
2716
|
+
backgroundColor: "hsl(var(--severity-info) / 0.1)",
|
|
2717
|
+
color: "hsl(var(--severity-info))",
|
|
2718
|
+
border: "1px solid hsl(var(--severity-info) / 0.2)",
|
|
2664
2719
|
borderRadius: 2,
|
|
2665
|
-
"& .MuiAlert-icon": { color: "
|
|
2720
|
+
"& .MuiAlert-icon": { color: "hsl(var(--severity-info))" }
|
|
2666
2721
|
},
|
|
2667
2722
|
children: /* @__PURE__ */ jsxs3(Box3, { children: [
|
|
2668
2723
|
/* @__PURE__ */ jsx4(Typography3, { sx: { fontWeight: 600, mb: 0.5 }, children: "No authentication required" }),
|
|
@@ -2677,9 +2732,9 @@ var AppAuthCard = ({
|
|
|
2677
2732
|
{
|
|
2678
2733
|
severity: "error",
|
|
2679
2734
|
sx: {
|
|
2680
|
-
backgroundColor: "
|
|
2681
|
-
color: "
|
|
2682
|
-
border: "1px solid
|
|
2735
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)",
|
|
2736
|
+
color: "hsl(var(--destructive))",
|
|
2737
|
+
border: "1px solid hsl(var(--destructive) / 0.3)",
|
|
2683
2738
|
borderRadius: 2
|
|
2684
2739
|
},
|
|
2685
2740
|
children: /* @__PURE__ */ jsxs3(Box3, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: 2, width: "100%" }, children: [
|
|
@@ -2693,16 +2748,16 @@ var AppAuthCard = ({
|
|
|
2693
2748
|
target: "_blank",
|
|
2694
2749
|
rel: "noopener noreferrer",
|
|
2695
2750
|
sx: {
|
|
2696
|
-
borderColor: "
|
|
2697
|
-
color: "
|
|
2751
|
+
borderColor: "hsl(var(--destructive) / 0.5)",
|
|
2752
|
+
color: "hsl(var(--destructive))",
|
|
2698
2753
|
textTransform: "none",
|
|
2699
2754
|
fontSize: "0.75rem",
|
|
2700
2755
|
py: 0.5,
|
|
2701
2756
|
px: 1.5,
|
|
2702
2757
|
flexShrink: 0,
|
|
2703
2758
|
"&:hover": {
|
|
2704
|
-
borderColor: "
|
|
2705
|
-
backgroundColor: "
|
|
2759
|
+
borderColor: "hsl(var(--destructive))",
|
|
2760
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)"
|
|
2706
2761
|
}
|
|
2707
2762
|
},
|
|
2708
2763
|
children: "View Execution"
|
|
@@ -2716,9 +2771,9 @@ var AppAuthCard = ({
|
|
|
2716
2771
|
{
|
|
2717
2772
|
severity: "error",
|
|
2718
2773
|
sx: {
|
|
2719
|
-
backgroundColor: "
|
|
2720
|
-
color: "
|
|
2721
|
-
border: "1px solid
|
|
2774
|
+
backgroundColor: "hsl(var(--destructive) / 0.1)",
|
|
2775
|
+
color: "hsl(var(--destructive))",
|
|
2776
|
+
border: "1px solid hsl(var(--destructive) / 0.3)",
|
|
2722
2777
|
borderRadius: 2
|
|
2723
2778
|
},
|
|
2724
2779
|
children: "Failed to save authentication. Please try again."
|
|
@@ -3160,9 +3215,10 @@ var AppMcpChat = ({ appName, appIcon, appId, categories }) => {
|
|
|
3160
3215
|
const inputRef = useRef2(null);
|
|
3161
3216
|
const suggestions = useMemo(() => getSuggestions(appName, categories), [appName, categories]);
|
|
3162
3217
|
const primaryCategory = useMemo(() => getPrimaryCategory(appName, categories), [appName, categories]);
|
|
3218
|
+
const MIN_INPUT_LENGTH = 6;
|
|
3163
3219
|
const runAction = async () => {
|
|
3164
3220
|
const trimmed = input.trim();
|
|
3165
|
-
if (
|
|
3221
|
+
if (trimmed.length < MIN_INPUT_LENGTH || runState === "running") return;
|
|
3166
3222
|
setQuery(trimmed);
|
|
3167
3223
|
setInput("");
|
|
3168
3224
|
setRunState("running");
|
|
@@ -3383,7 +3439,8 @@ ${JSON.stringify(data, null, 2)}
|
|
|
3383
3439
|
{
|
|
3384
3440
|
component: "button",
|
|
3385
3441
|
onClick: runAction,
|
|
3386
|
-
disabled:
|
|
3442
|
+
disabled: input.trim().length < MIN_INPUT_LENGTH,
|
|
3443
|
+
title: input.trim().length < MIN_INPUT_LENGTH ? `Enter at least ${MIN_INPUT_LENGTH} characters` : void 0,
|
|
3387
3444
|
sx: {
|
|
3388
3445
|
all: "unset",
|
|
3389
3446
|
display: "flex",
|
|
@@ -3393,11 +3450,11 @@ ${JSON.stringify(data, null, 2)}
|
|
|
3393
3450
|
height: 30,
|
|
3394
3451
|
borderRadius: "8px",
|
|
3395
3452
|
flexShrink: 0,
|
|
3396
|
-
cursor: input.trim() ? "pointer" : "
|
|
3397
|
-
backgroundColor: input.trim() ? "hsl(var(--primary))" : "hsl(var(--muted))",
|
|
3398
|
-
color: input.trim() ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
3453
|
+
cursor: input.trim().length >= MIN_INPUT_LENGTH ? "pointer" : "not-allowed",
|
|
3454
|
+
backgroundColor: input.trim().length >= MIN_INPUT_LENGTH ? "hsl(var(--primary))" : "hsl(var(--muted))",
|
|
3455
|
+
color: input.trim().length >= MIN_INPUT_LENGTH ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
3399
3456
|
transition: "all 0.15s ease",
|
|
3400
|
-
"&:hover": input.trim() ? {
|
|
3457
|
+
"&:hover": input.trim().length >= MIN_INPUT_LENGTH ? {
|
|
3401
3458
|
filter: "brightness(1.1)"
|
|
3402
3459
|
} : {}
|
|
3403
3460
|
},
|
|
@@ -3728,23 +3785,32 @@ function buildSingulCurl(appName, action, opts) {
|
|
|
3728
3785
|
const act = action?.name || "{action}";
|
|
3729
3786
|
const body = {
|
|
3730
3787
|
app: appName || "<appname>",
|
|
3788
|
+
action: act,
|
|
3731
3789
|
fields: action?.fields.length ? action.fields : [{ name: "field1", value: "value1" }]
|
|
3732
3790
|
};
|
|
3733
3791
|
const token = opts?.apiKey || "YOUR_TOKEN";
|
|
3734
3792
|
const orgLine = opts?.orgId ? `
|
|
3735
3793
|
-H "Org-Id: ${opts.orgId}" \\` : "";
|
|
3736
|
-
|
|
3794
|
+
const base2 = (opts?.baseUrl || "").replace(/\/+$/, "");
|
|
3795
|
+
return `curl -X POST ${base2}/api/v1/singul \\
|
|
3737
3796
|
-H "Authorization: Bearer ${token}" \\${orgLine}
|
|
3738
3797
|
-d '${JSON.stringify(body, null, 2)}'`;
|
|
3739
3798
|
}
|
|
3740
|
-
function buildSingulPython(appName, action) {
|
|
3799
|
+
function buildSingulPython(appName, action, opts) {
|
|
3741
3800
|
const act = action?.name || "send_message";
|
|
3742
3801
|
const app = appName || "<appname>";
|
|
3743
3802
|
const fields = action?.fields.length ? action.fields : [];
|
|
3744
3803
|
const fieldsStr = JSON.stringify(fields);
|
|
3745
|
-
|
|
3804
|
+
const token = opts?.apiKey || "APIKEY";
|
|
3805
|
+
const base2 = (opts?.baseUrl || "").replace(/\/+$/, "");
|
|
3806
|
+
return `from shufflepy import Singul
|
|
3807
|
+
|
|
3808
|
+
singul = Singul(
|
|
3809
|
+
"${token}",
|
|
3810
|
+
url="${base2}",
|
|
3811
|
+
)
|
|
3746
3812
|
|
|
3747
|
-
response =
|
|
3813
|
+
response = singul.run("${app}", action="${act}", fields=${fieldsStr})
|
|
3748
3814
|
|
|
3749
3815
|
print(response)`;
|
|
3750
3816
|
}
|
|
@@ -3861,10 +3927,11 @@ var SingulActionsPreview = ({
|
|
|
3861
3927
|
const apiKey = API_CONFIG.apiKey;
|
|
3862
3928
|
const trackedOrg = getTrackedOrgId();
|
|
3863
3929
|
const orgId = trackedOrg && activeOrgId && trackedOrg !== activeOrgId ? trackedOrg : null;
|
|
3864
|
-
|
|
3930
|
+
const baseUrl = API_CONFIG.baseUrl;
|
|
3931
|
+
return { apiKey, orgId, baseUrl };
|
|
3865
3932
|
}, [activeOrgId]);
|
|
3866
3933
|
const buildSnippet = useCallback5(
|
|
3867
|
-
(action, l) => l === "python" ? buildSingulPython(appName, action) : buildSingulCurl(appName, action, curlOpts),
|
|
3934
|
+
(action, l) => l === "python" ? buildSingulPython(appName, action, curlOpts) : buildSingulCurl(appName, action, curlOpts),
|
|
3868
3935
|
[appName, curlOpts]
|
|
3869
3936
|
);
|
|
3870
3937
|
useEffect4(() => {
|
|
@@ -3915,7 +3982,7 @@ var SingulActionsPreview = ({
|
|
|
3915
3982
|
app_name: "http",
|
|
3916
3983
|
app_version: "1.4.0"
|
|
3917
3984
|
};
|
|
3918
|
-
const path = lang === "python" ? "/api/v1/apps/3e2bdf9d5069fe3f4746c29d68785a6a/run" : "/api/v1/apps/http/run";
|
|
3985
|
+
const path = lang === "python" ? "/api/v1/apps/3e2bdf9d5069fe3f4746c29d68785a6a/run?delete=true" : "/api/v1/apps/http/run?delete=true";
|
|
3919
3986
|
const res = await fetch(getApiUrl(path), {
|
|
3920
3987
|
method: "POST",
|
|
3921
3988
|
credentials: "include",
|
|
@@ -4338,14 +4405,8 @@ function AppDetailDrawer({
|
|
|
4338
4405
|
let appsList = null;
|
|
4339
4406
|
if (API_CONFIG.apiKey) {
|
|
4340
4407
|
try {
|
|
4341
|
-
const
|
|
4342
|
-
|
|
4343
|
-
headers: { ...getAuthHeader() }
|
|
4344
|
-
});
|
|
4345
|
-
if (res.ok) {
|
|
4346
|
-
const apps = await res.json();
|
|
4347
|
-
if (Array.isArray(apps)) appsList = apps;
|
|
4348
|
-
}
|
|
4408
|
+
const apps = await fetchAppsViaApiConfig();
|
|
4409
|
+
if (Array.isArray(apps)) appsList = apps;
|
|
4349
4410
|
} catch {
|
|
4350
4411
|
}
|
|
4351
4412
|
}
|
|
@@ -4656,7 +4717,7 @@ function AppDetailDrawer({
|
|
|
4656
4717
|
}
|
|
4657
4718
|
|
|
4658
4719
|
// ShuffleMCP.tsx
|
|
4659
|
-
import "./shuffle-mcp-
|
|
4720
|
+
import "./shuffle-mcp-24XBNRGE.css";
|
|
4660
4721
|
import { Fragment as Fragment5, jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
4661
4722
|
var DEFAULT_ALGOLIA_APP_ID = "JNSS5CFDZZ";
|
|
4662
4723
|
var DEFAULT_ALGOLIA_API_KEY = "33e4e3564f4f060e96e0531957bed552";
|
|
@@ -4746,18 +4807,12 @@ var ShuffleMCP = React.forwardRef(({
|
|
|
4746
4807
|
}
|
|
4747
4808
|
const fetchPrivateApps = async () => {
|
|
4748
4809
|
try {
|
|
4749
|
-
const
|
|
4750
|
-
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
...orgId ? { "Org-Id": orgId } : {}
|
|
4755
|
-
},
|
|
4756
|
-
credentials: "include"
|
|
4810
|
+
const apps = await fetchApps({
|
|
4811
|
+
baseUrl: apiBaseUrl,
|
|
4812
|
+
path: privateAppsPath,
|
|
4813
|
+
apiKey: apiKey || null,
|
|
4814
|
+
orgId: orgId || null
|
|
4757
4815
|
});
|
|
4758
|
-
if (!response.ok) return;
|
|
4759
|
-
const data = await response.json();
|
|
4760
|
-
const apps = Array.isArray(data) ? data : data?.data || [];
|
|
4761
4816
|
const normalized = apps.map((a) => ({
|
|
4762
4817
|
name: a.name || "",
|
|
4763
4818
|
description: a.description || "",
|
|
@@ -5002,6 +5057,8 @@ var ShuffleMCP = React.forwardRef(({
|
|
|
5002
5057
|
"div",
|
|
5003
5058
|
{
|
|
5004
5059
|
className: `singul-dropdown-item ${selected ? "singul-selected" : ""} ${authState.validated ? "singul-validated" : ""} ${authState.configured ? "singul-configured" : ""}`,
|
|
5060
|
+
"data-app-name": app.name,
|
|
5061
|
+
"data-object-id": app.objectID,
|
|
5005
5062
|
style: {
|
|
5006
5063
|
...customStyles.dropdownItem,
|
|
5007
5064
|
...selected ? customStyles.selectedItem : {}
|
|
@@ -5135,7 +5192,7 @@ var ShuffleMCP = React.forwardRef(({
|
|
|
5135
5192
|
displayResults.map((app, index) => renderAppItem(app, index)),
|
|
5136
5193
|
/* @__PURE__ */ jsx11("div", { className: "singul-end-of-results", style: {
|
|
5137
5194
|
padding: "10px 16px",
|
|
5138
|
-
color: "
|
|
5195
|
+
color: "hsl(var(--foreground) / 0.3)",
|
|
5139
5196
|
textAlign: "center",
|
|
5140
5197
|
fontSize: "11px",
|
|
5141
5198
|
gridColumn: "1 / -1"
|
|
@@ -5183,7 +5240,7 @@ ShuffleMCP.displayName = "ShuffleMCP";
|
|
|
5183
5240
|
var ShuffleMCP_default = ShuffleMCP;
|
|
5184
5241
|
|
|
5185
5242
|
// AppSearchDrawer.tsx
|
|
5186
|
-
import { useState as useState9 } from "react";
|
|
5243
|
+
import { useState as useState9, useEffect as useEffect7 } from "react";
|
|
5187
5244
|
import { Box as Box10, Typography as Typography10, IconButton as IconButton5, Drawer as Drawer2, Avatar as Avatar5, Tooltip as Tooltip5 } from "@mui/material";
|
|
5188
5245
|
import CloseIcon3 from "@mui/icons-material/Close";
|
|
5189
5246
|
import { motion as motion7, AnimatePresence as AnimatePresence2 } from "framer-motion";
|
|
@@ -5349,10 +5406,19 @@ function AppSearchDrawer({
|
|
|
5349
5406
|
onAddToCanvas,
|
|
5350
5407
|
priorityCategory,
|
|
5351
5408
|
connectionPathApps,
|
|
5352
|
-
pinnedApps
|
|
5409
|
+
pinnedApps,
|
|
5410
|
+
highlightAppName,
|
|
5411
|
+
highlightDelayMs = 5e3
|
|
5353
5412
|
}) {
|
|
5354
5413
|
const [detailAppName, setDetailAppName] = useState9(null);
|
|
5355
5414
|
const [detailAppId, setDetailAppId] = useState9(null);
|
|
5415
|
+
const [highlightActive, setHighlightActive] = useState9(false);
|
|
5416
|
+
useEffect7(() => {
|
|
5417
|
+
setHighlightActive(false);
|
|
5418
|
+
if (!open || !highlightAppName) return;
|
|
5419
|
+
const t = setTimeout(() => setHighlightActive(true), highlightDelayMs);
|
|
5420
|
+
return () => clearTimeout(t);
|
|
5421
|
+
}, [open, highlightAppName, highlightDelayMs]);
|
|
5356
5422
|
const handleClose = () => {
|
|
5357
5423
|
setDetailAppName(null);
|
|
5358
5424
|
setDetailAppId(null);
|
|
@@ -5493,10 +5559,39 @@ function AppSearchDrawer({
|
|
|
5493
5559
|
maxHeight: "none",
|
|
5494
5560
|
overflowY: "auto"
|
|
5495
5561
|
},
|
|
5562
|
+
"& .singul-results-grid": {
|
|
5563
|
+
gridAutoRows: "75px",
|
|
5564
|
+
gap: "12px"
|
|
5565
|
+
},
|
|
5496
5566
|
"& .singul-results-grid .singul-dropdown-item": {
|
|
5497
|
-
minHeight:
|
|
5498
|
-
|
|
5499
|
-
|
|
5567
|
+
minHeight: 75,
|
|
5568
|
+
maxHeight: 75,
|
|
5569
|
+
height: 75,
|
|
5570
|
+
padding: "14px 16px",
|
|
5571
|
+
alignItems: "center",
|
|
5572
|
+
overflow: "hidden"
|
|
5573
|
+
},
|
|
5574
|
+
"& .singul-results-grid .singul-app-info": {
|
|
5575
|
+
alignItems: "center",
|
|
5576
|
+
gap: "12px"
|
|
5577
|
+
},
|
|
5578
|
+
"& .singul-results-grid .singul-app-icon": {
|
|
5579
|
+
width: 40,
|
|
5580
|
+
height: 40,
|
|
5581
|
+
borderRadius: 8,
|
|
5582
|
+
padding: 4
|
|
5583
|
+
},
|
|
5584
|
+
...highlightActive && highlightAppName ? {
|
|
5585
|
+
[`& .singul-dropdown-item[data-app-name="${highlightAppName}"]`]: {
|
|
5586
|
+
borderColor: "hsl(var(--primary)) !important",
|
|
5587
|
+
boxShadow: "0 0 0 2px hsl(var(--primary)), 0 0 18px 2px hsl(var(--primary) / 0.55)",
|
|
5588
|
+
animation: "shuffleHighlightPulse 1.6s ease-in-out infinite"
|
|
5589
|
+
},
|
|
5590
|
+
"@keyframes shuffleHighlightPulse": {
|
|
5591
|
+
"0%, 100%": { boxShadow: "0 0 0 2px hsl(var(--primary)), 0 0 12px 1px hsl(var(--primary) / 0.4)" },
|
|
5592
|
+
"50%": { boxShadow: "0 0 0 2px hsl(var(--primary)), 0 0 24px 4px hsl(var(--primary) / 0.75)" }
|
|
5593
|
+
}
|
|
5594
|
+
} : {}
|
|
5500
5595
|
},
|
|
5501
5596
|
children: /* @__PURE__ */ jsx13(AnimatePresence2, { mode: "wait", children: /* @__PURE__ */ jsx13(
|
|
5502
5597
|
motion7.div,
|
|
@@ -5576,7 +5671,7 @@ function AppSearchDrawer({
|
|
|
5576
5671
|
}
|
|
5577
5672
|
|
|
5578
5673
|
// AgentUI.tsx
|
|
5579
|
-
import { useCallback as useCallback8, useEffect as
|
|
5674
|
+
import { useCallback as useCallback8, useEffect as useEffect8, useMemo as useMemo5, useRef as useRef6, useState as useState10 } from "react";
|
|
5580
5675
|
import { useNavigate } from "react-router-dom";
|
|
5581
5676
|
import {
|
|
5582
5677
|
Avatar as Avatar6,
|
|
@@ -5959,10 +6054,12 @@ var TimelineRow = ({
|
|
|
5959
6054
|
}
|
|
5960
6055
|
}
|
|
5961
6056
|
let toolApp;
|
|
5962
|
-
|
|
5963
|
-
|
|
6057
|
+
const skipToolIcon = item.category === "finalise" || item.category === "finish" || item.category === "ask" || details?.action === "finalise" || details?.action === "finish" || details?.action === "ask";
|
|
6058
|
+
if (!skipToolIcon && details?.tool && typeof details.tool === "string" && details.tool !== "singul" && details.tool !== "core") {
|
|
6059
|
+
const raw = details.tool;
|
|
6060
|
+
let tn = raw.toLowerCase().replace(/[\s-]+/g, "_");
|
|
5964
6061
|
if (tn.startsWith("app:")) tn = tn.split(":")[2] || tn;
|
|
5965
|
-
toolApp = appsById[tn];
|
|
6062
|
+
toolApp = appsById[raw] || appsById[tn];
|
|
5966
6063
|
}
|
|
5967
6064
|
const questions = [];
|
|
5968
6065
|
if (item.category === "ask" || details?.action === "ask") {
|
|
@@ -6024,7 +6121,9 @@ var TimelineRow = ({
|
|
|
6024
6121
|
maxHeight: 60,
|
|
6025
6122
|
overflow: "hidden",
|
|
6026
6123
|
"& p": { margin: 0 },
|
|
6027
|
-
"& pre, & code": { fontSize: "0.78rem" }
|
|
6124
|
+
"& pre, & code": { fontSize: "0.78rem" },
|
|
6125
|
+
"& a": { color: "hsl(var(--primary))", textDecoration: "underline", textUnderlineOffset: "2px" },
|
|
6126
|
+
"& a:hover": { opacity: 0.85 }
|
|
6028
6127
|
}, children: /* @__PURE__ */ jsx14(Markdown, { remarkPlugins: [remarkGfm4, remarkBreaks], children: normalizeMarkdown(displayLabel) }) }),
|
|
6029
6128
|
/* @__PURE__ */ jsx14(Tooltip6, { title: `Duration: ${dur.toFixed(1)}s \xB7 ${itemStart ? new Date(itemStart * 1e3).toLocaleString() : ""}`, children: /* @__PURE__ */ jsx14(Box11, { sx: { width: maxWidth, position: "relative", height: 10, flexShrink: 0 }, children: dur > 0 && /* @__PURE__ */ jsx14(Box11, { sx: {
|
|
6030
6129
|
position: "absolute",
|
|
@@ -6041,7 +6140,9 @@ var TimelineRow = ({
|
|
|
6041
6140
|
Box11,
|
|
6042
6141
|
{
|
|
6043
6142
|
sx: { display: "flex", alignItems: "center", gap: 0.25, ml: 1, minWidth: 96, justifyContent: "flex-end" },
|
|
6044
|
-
onClick: (e) =>
|
|
6143
|
+
onClick: (e) => {
|
|
6144
|
+
if (e.target.closest("button, a")) e.stopPropagation();
|
|
6145
|
+
},
|
|
6045
6146
|
children: [
|
|
6046
6147
|
item.type === "decision" && details?.run_details?.status === "WAITING" && (item.category === "ask" || details?.action === "ask") && questions.length === 0 && /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
6047
6148
|
/* @__PURE__ */ jsx14(Tooltip6, { title: "Approve this step", children: /* @__PURE__ */ jsx14("span", { children: /* @__PURE__ */ jsx14(
|
|
@@ -6245,6 +6346,7 @@ var AgentUI = ({
|
|
|
6245
6346
|
compact = false,
|
|
6246
6347
|
hideAppPicker = false,
|
|
6247
6348
|
hideAttach = false,
|
|
6349
|
+
disableStartTab = false,
|
|
6248
6350
|
appPickerLabel = "Select Apps / MCPs",
|
|
6249
6351
|
appPickerTitle = "Select Apps / MCPs",
|
|
6250
6352
|
appPickerSubtitle = "Pick the tools the agent is allowed to use for this run",
|
|
@@ -6254,16 +6356,21 @@ var AgentUI = ({
|
|
|
6254
6356
|
readUrlParams = true,
|
|
6255
6357
|
executionId,
|
|
6256
6358
|
authorization,
|
|
6359
|
+
initialExecution,
|
|
6257
6360
|
onRun,
|
|
6361
|
+
onViewChange,
|
|
6258
6362
|
apiKey,
|
|
6259
6363
|
apiBaseUrl,
|
|
6260
|
-
orgId
|
|
6364
|
+
orgId,
|
|
6365
|
+
className,
|
|
6366
|
+
sx,
|
|
6367
|
+
contentSx
|
|
6261
6368
|
}) => {
|
|
6262
|
-
const
|
|
6369
|
+
const resolveUrl2 = useCallback8(
|
|
6263
6370
|
(path) => apiBaseUrl ? `${apiBaseUrl.replace(/\/+$/, "")}${path}` : getApiUrl(path),
|
|
6264
6371
|
[apiBaseUrl]
|
|
6265
6372
|
);
|
|
6266
|
-
const
|
|
6373
|
+
const resolveHeaders2 = useCallback8(() => {
|
|
6267
6374
|
const h = apiKey ? { Authorization: `Bearer ${apiKey}` } : { ...getAuthHeader() };
|
|
6268
6375
|
if (orgId) h["Org-Id"] = orgId;
|
|
6269
6376
|
return h;
|
|
@@ -6277,6 +6384,8 @@ var AgentUI = ({
|
|
|
6277
6384
|
];
|
|
6278
6385
|
const [chosenApps, setChosenApps] = useState10(apps ?? defaultApps ?? BUILTIN_DEFAULT_APPS);
|
|
6279
6386
|
const [availableApps, setAvailableApps] = useState10([]);
|
|
6387
|
+
const [executionApps, setExecutionApps] = useState10([]);
|
|
6388
|
+
const [resolvedToolApps, setResolvedToolApps] = useState10({});
|
|
6280
6389
|
const [appSearchOpen, setAppSearchOpen] = useState10(false);
|
|
6281
6390
|
const [agentRequestLoading, setAgentRequestLoading] = useState10(false);
|
|
6282
6391
|
const [execution, setExecution] = useState10(null);
|
|
@@ -6313,14 +6422,14 @@ var AgentUI = ({
|
|
|
6313
6422
|
stateRef.current.continuationText = continuationText;
|
|
6314
6423
|
stateRef.current.localRunStart = localRunStart;
|
|
6315
6424
|
stateRef.current.showStarter = showStarter;
|
|
6316
|
-
|
|
6425
|
+
useEffect8(() => {
|
|
6317
6426
|
if (execution?.execution_id) {
|
|
6318
6427
|
setLocalRunStart((prev) => prev ?? Math.floor(Date.now() / 1e3));
|
|
6319
6428
|
} else if (!agentRequestLoading) {
|
|
6320
6429
|
setLocalRunStart(null);
|
|
6321
6430
|
}
|
|
6322
6431
|
}, [execution?.execution_id, agentRequestLoading]);
|
|
6323
|
-
|
|
6432
|
+
useEffect8(() => {
|
|
6324
6433
|
const status = (execution?.status || agentData?.status || "").toUpperCase();
|
|
6325
6434
|
const TERMINAL = ["FINISHED", "FAILURE", "ABORTED", "CANCELLED", "CANCELED"];
|
|
6326
6435
|
if (TERMINAL.includes(status)) return;
|
|
@@ -6355,16 +6464,119 @@ var AgentUI = ({
|
|
|
6355
6464
|
};
|
|
6356
6465
|
const appsById = useMemo5(() => {
|
|
6357
6466
|
const m = {};
|
|
6358
|
-
|
|
6359
|
-
|
|
6360
|
-
|
|
6467
|
+
const add = (a) => {
|
|
6468
|
+
if (!a?.name) return;
|
|
6469
|
+
const slug = a.name.toLowerCase().replace(/[\s-]+/g, "_");
|
|
6470
|
+
if (!m[slug] || !m[slug].icon && a.icon) m[slug] = a;
|
|
6471
|
+
if (a.id) {
|
|
6472
|
+
if (!m[a.id] || !m[a.id].icon && a.icon) m[a.id] = a;
|
|
6473
|
+
}
|
|
6474
|
+
};
|
|
6475
|
+
for (const a of chosenApps) add(a);
|
|
6476
|
+
for (const a of executionApps) add(a);
|
|
6477
|
+
for (const [k, v] of Object.entries(resolvedToolApps)) {
|
|
6478
|
+
if (!m[k] || !m[k].icon && v.icon) m[k] = v;
|
|
6479
|
+
add(v);
|
|
6361
6480
|
}
|
|
6362
6481
|
return m;
|
|
6363
|
-
}, [chosenApps]);
|
|
6364
|
-
|
|
6482
|
+
}, [chosenApps, executionApps, resolvedToolApps]);
|
|
6483
|
+
useEffect8(() => {
|
|
6365
6484
|
if (apps) setChosenApps(apps);
|
|
6366
6485
|
}, [apps]);
|
|
6367
|
-
|
|
6486
|
+
useEffect8(() => {
|
|
6487
|
+
const decisions = agentData?.decisions || [];
|
|
6488
|
+
if (!Array.isArray(decisions) || decisions.length === 0) return;
|
|
6489
|
+
const norm2 = (s) => s.toLowerCase().replace(/[\s-]+/g, "_");
|
|
6490
|
+
const wanted = [];
|
|
6491
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6492
|
+
for (const dec of decisions) {
|
|
6493
|
+
const action = dec?.action || dec?.details?.action;
|
|
6494
|
+
const category = dec?.category || dec?.details?.category;
|
|
6495
|
+
if (action === "finish" || action === "finalise" || action === "ask") continue;
|
|
6496
|
+
if (category === "finish" || category === "finalise" || category === "ask") continue;
|
|
6497
|
+
const tool = dec?.details?.tool ?? dec?.tool;
|
|
6498
|
+
if (!tool || typeof tool !== "string") continue;
|
|
6499
|
+
if (tool === "singul" || tool === "core") continue;
|
|
6500
|
+
let raw = tool;
|
|
6501
|
+
let slug = norm2(tool);
|
|
6502
|
+
if (slug.startsWith("app:")) slug = slug.split(":")[2] || slug;
|
|
6503
|
+
if (appsById[raw]?.icon || appsById[slug]?.icon) continue;
|
|
6504
|
+
if (resolvedToolApps[raw]?.icon || resolvedToolApps[slug]?.icon) continue;
|
|
6505
|
+
const key = `${raw}|${slug}`;
|
|
6506
|
+
if (seen.has(key)) continue;
|
|
6507
|
+
seen.add(key);
|
|
6508
|
+
wanted.push({ raw, slug });
|
|
6509
|
+
}
|
|
6510
|
+
if (wanted.length === 0) return;
|
|
6511
|
+
let cancelled = false;
|
|
6512
|
+
(async () => {
|
|
6513
|
+
const found = {};
|
|
6514
|
+
try {
|
|
6515
|
+
const all = await fetchApps({
|
|
6516
|
+
baseUrl: apiBaseUrl ? apiBaseUrl.replace(/\/+$/, "") : API_CONFIG.baseUrl,
|
|
6517
|
+
apiKey: apiKey || API_CONFIG.apiKey,
|
|
6518
|
+
orgId: orgId || null
|
|
6519
|
+
});
|
|
6520
|
+
if (Array.isArray(all) && all.length > 0) {
|
|
6521
|
+
const byId = /* @__PURE__ */ new Map();
|
|
6522
|
+
const byName = /* @__PURE__ */ new Map();
|
|
6523
|
+
for (const a of all) {
|
|
6524
|
+
if (a?.id) byId.set(String(a.id), a);
|
|
6525
|
+
if (a?.name) byName.set(norm2(String(a.name)), a);
|
|
6526
|
+
}
|
|
6527
|
+
for (const { raw, slug } of wanted) {
|
|
6528
|
+
const hit = byId.get(raw) || byName.get(slug);
|
|
6529
|
+
if (!hit) continue;
|
|
6530
|
+
const icon = hit.large_image || hit.image_url || hit.image || "";
|
|
6531
|
+
const app = { id: hit.id, name: hit.name || slug, icon };
|
|
6532
|
+
found[raw] = app;
|
|
6533
|
+
found[slug] = app;
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
} catch {
|
|
6537
|
+
}
|
|
6538
|
+
const stillMissing = wanted.filter(({ raw, slug }) => !found[raw] && !found[slug]);
|
|
6539
|
+
if (stillMissing.length > 0) {
|
|
6540
|
+
try {
|
|
6541
|
+
const { algoliasearch: algoliasearch2 } = await import("algoliasearch");
|
|
6542
|
+
const client = algoliasearch2("JNSS5CFDZZ", "33e4e3564f4f060e96e0531957bed552");
|
|
6543
|
+
await Promise.all(stillMissing.map(async ({ raw, slug }) => {
|
|
6544
|
+
try {
|
|
6545
|
+
try {
|
|
6546
|
+
const obj = await client.getObject({ indexName: "appsearch", objectID: raw });
|
|
6547
|
+
if (obj?.image_url || obj?.name) {
|
|
6548
|
+
const app = { id: obj.objectID || raw, name: obj.name || slug, icon: obj.image_url || "" };
|
|
6549
|
+
found[raw] = app;
|
|
6550
|
+
found[slug] = app;
|
|
6551
|
+
return;
|
|
6552
|
+
}
|
|
6553
|
+
} catch {
|
|
6554
|
+
}
|
|
6555
|
+
const res = await client.searchSingleIndex({
|
|
6556
|
+
indexName: "appsearch",
|
|
6557
|
+
searchParams: { query: slug.replace(/_/g, " "), hitsPerPage: 3 }
|
|
6558
|
+
});
|
|
6559
|
+
const hits = res.hits || [];
|
|
6560
|
+
const match = hits.find((h) => norm2(h.name || "") === slug) || hits[0];
|
|
6561
|
+
if (match?.image_url || match?.name) {
|
|
6562
|
+
const app = { id: match.objectID || raw, name: match.name || slug, icon: match.image_url || "" };
|
|
6563
|
+
found[raw] = app;
|
|
6564
|
+
found[slug] = app;
|
|
6565
|
+
}
|
|
6566
|
+
} catch {
|
|
6567
|
+
}
|
|
6568
|
+
}));
|
|
6569
|
+
} catch {
|
|
6570
|
+
}
|
|
6571
|
+
}
|
|
6572
|
+
if (cancelled || Object.keys(found).length === 0) return;
|
|
6573
|
+
setResolvedToolApps((prev) => ({ ...prev, ...found }));
|
|
6574
|
+
})();
|
|
6575
|
+
return () => {
|
|
6576
|
+
cancelled = true;
|
|
6577
|
+
};
|
|
6578
|
+
}, [JSON.stringify(agentData?.decisions?.map((d) => d?.details?.tool || d?.tool) || []), appsById]);
|
|
6579
|
+
useEffect8(() => {
|
|
6368
6580
|
const missing = chosenApps.filter((a) => !a.icon && a.name);
|
|
6369
6581
|
if (missing.length === 0) return;
|
|
6370
6582
|
let cancelled = false;
|
|
@@ -6395,18 +6607,17 @@ var AgentUI = ({
|
|
|
6395
6607
|
const stillMissing = missing.filter((a) => !resolved[a.name]);
|
|
6396
6608
|
if (stillMissing.length > 0) {
|
|
6397
6609
|
try {
|
|
6398
|
-
const
|
|
6399
|
-
|
|
6400
|
-
|
|
6610
|
+
const baseUrl = apiBaseUrl ? apiBaseUrl.replace(/\/+$/, "") : API_CONFIG.baseUrl;
|
|
6611
|
+
const apps2 = await fetchApps({
|
|
6612
|
+
baseUrl,
|
|
6613
|
+
apiKey: apiKey || API_CONFIG.apiKey,
|
|
6614
|
+
orgId: orgId || null
|
|
6401
6615
|
});
|
|
6402
|
-
if (
|
|
6403
|
-
const
|
|
6404
|
-
|
|
6405
|
-
|
|
6406
|
-
|
|
6407
|
-
const img = m?.large_image || m?.image_url || m?.image;
|
|
6408
|
-
if (img) resolved[a.name] = img;
|
|
6409
|
-
}
|
|
6616
|
+
if (Array.isArray(apps2)) {
|
|
6617
|
+
for (const a of stillMissing) {
|
|
6618
|
+
const m = apps2.find((x) => norm2(x.name || "") === norm2(a.name));
|
|
6619
|
+
const img = m?.large_image || m?.image_url || m?.image;
|
|
6620
|
+
if (img) resolved[a.name] = img;
|
|
6410
6621
|
}
|
|
6411
6622
|
}
|
|
6412
6623
|
} catch {
|
|
@@ -6422,17 +6633,17 @@ var AgentUI = ({
|
|
|
6422
6633
|
return () => {
|
|
6423
6634
|
cancelled = true;
|
|
6424
6635
|
};
|
|
6425
|
-
}, [chosenApps, availableApps,
|
|
6426
|
-
|
|
6636
|
+
}, [chosenApps, availableApps, resolveUrl2, resolveHeaders2]);
|
|
6637
|
+
useEffect8(() => {
|
|
6427
6638
|
if (!autoLoadApps) return;
|
|
6428
6639
|
if (apps || defaultApps) return;
|
|
6429
6640
|
if (!hasApiKey) return;
|
|
6430
6641
|
let cancelled = false;
|
|
6431
6642
|
(async () => {
|
|
6432
6643
|
try {
|
|
6433
|
-
const resp = await fetch(
|
|
6644
|
+
const resp = await fetch(resolveUrl2("/api/v1/apps/authentication"), {
|
|
6434
6645
|
credentials: "include",
|
|
6435
|
-
headers: { ...
|
|
6646
|
+
headers: { ...resolveHeaders2() }
|
|
6436
6647
|
});
|
|
6437
6648
|
if (!resp.ok) return;
|
|
6438
6649
|
const result = await resp.json();
|
|
@@ -6461,14 +6672,123 @@ var AgentUI = ({
|
|
|
6461
6672
|
return () => {
|
|
6462
6673
|
cancelled = true;
|
|
6463
6674
|
};
|
|
6464
|
-
}, [autoLoadApps, apps, defaultApps, hasApiKey,
|
|
6675
|
+
}, [autoLoadApps, apps, defaultApps, hasApiKey, resolveUrl2, resolveHeaders2]);
|
|
6676
|
+
useEffect8(() => {
|
|
6677
|
+
const raw = agentData?.allowed_actions;
|
|
6678
|
+
if (!Array.isArray(raw) || raw.length === 0) {
|
|
6679
|
+
setExecutionApps([]);
|
|
6680
|
+
return;
|
|
6681
|
+
}
|
|
6682
|
+
const parsed = [];
|
|
6683
|
+
const seen = /* @__PURE__ */ new Set();
|
|
6684
|
+
for (const entry of raw) {
|
|
6685
|
+
if (typeof entry !== "string") continue;
|
|
6686
|
+
const parts = entry.split(":");
|
|
6687
|
+
if (parts.length < 3 || parts[0] !== "app") continue;
|
|
6688
|
+
const id = parts[1] || "";
|
|
6689
|
+
const name = parts.slice(2).join(":") || "";
|
|
6690
|
+
if (!name && !id) continue;
|
|
6691
|
+
const key = `${id}|${name}`;
|
|
6692
|
+
if (seen.has(key)) continue;
|
|
6693
|
+
seen.add(key);
|
|
6694
|
+
parsed.push({ id, name });
|
|
6695
|
+
}
|
|
6696
|
+
if (parsed.length === 0) {
|
|
6697
|
+
setExecutionApps([]);
|
|
6698
|
+
return;
|
|
6699
|
+
}
|
|
6700
|
+
const resolveFromAvailable = (id, name) => {
|
|
6701
|
+
const byId = id ? availableApps.find((a) => a.id === id) : void 0;
|
|
6702
|
+
const byName = !byId && name ? availableApps.find((a) => (a.name || "").toLowerCase() === name.toLowerCase()) : void 0;
|
|
6703
|
+
const hit = byId || byName;
|
|
6704
|
+
return { id: id || hit?.id, name: hit?.name || name, icon: hit?.icon };
|
|
6705
|
+
};
|
|
6706
|
+
const initial = parsed.map(({ id, name }) => resolveFromAvailable(id, name));
|
|
6707
|
+
setExecutionApps(initial);
|
|
6708
|
+
if (initial.every((a) => !!a.icon)) return;
|
|
6709
|
+
let cancelled = false;
|
|
6710
|
+
const norm2 = (s) => (s || "").toLowerCase().replace(/[\s-]+/g, "_");
|
|
6711
|
+
(async () => {
|
|
6712
|
+
let next = initial;
|
|
6713
|
+
try {
|
|
6714
|
+
const all = await fetchApps({
|
|
6715
|
+
baseUrl: API_CONFIG.baseUrl,
|
|
6716
|
+
apiKey: apiKey || API_CONFIG.apiKey,
|
|
6717
|
+
orgId: orgId || null
|
|
6718
|
+
});
|
|
6719
|
+
if (!cancelled && Array.isArray(all) && all.length > 0) {
|
|
6720
|
+
const byIdMap = /* @__PURE__ */ new Map();
|
|
6721
|
+
const byNameMap = /* @__PURE__ */ new Map();
|
|
6722
|
+
for (const a of all) {
|
|
6723
|
+
if (a?.id) byIdMap.set(String(a.id), a);
|
|
6724
|
+
if (a?.name) byNameMap.set(norm2(String(a.name)), a);
|
|
6725
|
+
}
|
|
6726
|
+
next = next.map((a) => {
|
|
6727
|
+
if (a.icon) return a;
|
|
6728
|
+
const hit = a.id && byIdMap.get(a.id) || byNameMap.get(norm2(a.name || ""));
|
|
6729
|
+
if (!hit) return a;
|
|
6730
|
+
return {
|
|
6731
|
+
id: a.id || hit.id,
|
|
6732
|
+
name: hit.name || a.name,
|
|
6733
|
+
icon: hit.large_image || hit.image_url || hit.image || a.icon
|
|
6734
|
+
};
|
|
6735
|
+
});
|
|
6736
|
+
}
|
|
6737
|
+
} catch {
|
|
6738
|
+
}
|
|
6739
|
+
const stillMissing = next.filter((a) => !a.icon);
|
|
6740
|
+
if (stillMissing.length > 0) {
|
|
6741
|
+
try {
|
|
6742
|
+
const { algoliasearch: algoliasearch2 } = await import("algoliasearch");
|
|
6743
|
+
const client = algoliasearch2("JNSS5CFDZZ", "33e4e3564f4f060e96e0531957bed552");
|
|
6744
|
+
const resolved = {};
|
|
6745
|
+
await Promise.all(stillMissing.map(async (a) => {
|
|
6746
|
+
try {
|
|
6747
|
+
if (a.id) {
|
|
6748
|
+
try {
|
|
6749
|
+
const obj = await client.getObject({ indexName: "appsearch", objectID: a.id });
|
|
6750
|
+
if (obj?.image_url) {
|
|
6751
|
+
resolved[a.id || a.name] = { name: obj.name || a.name, icon: obj.image_url, id: obj.objectID || a.id };
|
|
6752
|
+
return;
|
|
6753
|
+
}
|
|
6754
|
+
} catch {
|
|
6755
|
+
}
|
|
6756
|
+
}
|
|
6757
|
+
const res = await client.searchSingleIndex({
|
|
6758
|
+
indexName: "appsearch",
|
|
6759
|
+
searchParams: { query: (a.name || "").replace(/_/g, " "), hitsPerPage: 3 }
|
|
6760
|
+
});
|
|
6761
|
+
const hits = res.hits || [];
|
|
6762
|
+
const match = hits.find((h) => norm2(h.name || "") === norm2(a.name || "")) || hits[0];
|
|
6763
|
+
if (match?.image_url) {
|
|
6764
|
+
resolved[a.id || a.name] = { name: match.name || a.name, icon: match.image_url, id: match.objectID || a.id || "" };
|
|
6765
|
+
}
|
|
6766
|
+
} catch {
|
|
6767
|
+
}
|
|
6768
|
+
}));
|
|
6769
|
+
if (Object.keys(resolved).length > 0) {
|
|
6770
|
+
next = next.map((a) => {
|
|
6771
|
+
if (a.icon) return a;
|
|
6772
|
+
const r = resolved[a.id || a.name];
|
|
6773
|
+
return r ? { id: r.id || a.id, name: r.name || a.name, icon: r.icon } : a;
|
|
6774
|
+
});
|
|
6775
|
+
}
|
|
6776
|
+
} catch {
|
|
6777
|
+
}
|
|
6778
|
+
}
|
|
6779
|
+
if (!cancelled) setExecutionApps(next);
|
|
6780
|
+
})();
|
|
6781
|
+
return () => {
|
|
6782
|
+
cancelled = true;
|
|
6783
|
+
};
|
|
6784
|
+
}, [JSON.stringify(agentData?.allowed_actions || []), availableApps]);
|
|
6465
6785
|
const getExecution = useCallback8(async (executionId2, authorization2) => {
|
|
6466
6786
|
if (!executionId2 || !authorization2) return;
|
|
6467
6787
|
try {
|
|
6468
|
-
const resp = await fetch(
|
|
6788
|
+
const resp = await fetch(resolveUrl2("/api/v1/streams/results"), {
|
|
6469
6789
|
method: "POST",
|
|
6470
6790
|
credentials: "include",
|
|
6471
|
-
headers: { "Content-Type": "application/json", ...
|
|
6791
|
+
headers: { "Content-Type": "application/json", ...resolveHeaders2() },
|
|
6472
6792
|
body: JSON.stringify({ execution_id: executionId2, authorization: authorization2 })
|
|
6473
6793
|
});
|
|
6474
6794
|
if (activeExecutionIdRef.current && activeExecutionIdRef.current !== executionId2) return;
|
|
@@ -6497,7 +6817,7 @@ var AgentUI = ({
|
|
|
6497
6817
|
setError(err instanceof Error ? err.message : "Network error.");
|
|
6498
6818
|
}
|
|
6499
6819
|
}, []);
|
|
6500
|
-
|
|
6820
|
+
useEffect8(() => {
|
|
6501
6821
|
let eid = null;
|
|
6502
6822
|
let auth = null;
|
|
6503
6823
|
if (executionId && authorization) {
|
|
@@ -6515,7 +6835,30 @@ var AgentUI = ({
|
|
|
6515
6835
|
getExecution(eid, auth);
|
|
6516
6836
|
}
|
|
6517
6837
|
}, [readUrlParams, executionId, authorization, getExecution]);
|
|
6518
|
-
|
|
6838
|
+
useEffect8(() => {
|
|
6839
|
+
if (!initialExecution || !initialExecution.execution_id) return;
|
|
6840
|
+
setShowStarter(false);
|
|
6841
|
+
activeExecutionIdRef.current = initialExecution.execution_id;
|
|
6842
|
+
setExecution(initialExecution);
|
|
6843
|
+
let actionResult = null;
|
|
6844
|
+
if (Array.isArray(initialExecution.results)) {
|
|
6845
|
+
actionResult = initialExecution.results.find((r) => r?.action?.app_name === "AI Agent") || initialExecution.results[0];
|
|
6846
|
+
} else {
|
|
6847
|
+
actionResult = initialExecution;
|
|
6848
|
+
}
|
|
6849
|
+
setAgentActionResult(actionResult);
|
|
6850
|
+
const v = validateJson(actionResult?.result);
|
|
6851
|
+
if (v.valid) {
|
|
6852
|
+
setAgentData({
|
|
6853
|
+
...v.result,
|
|
6854
|
+
started_at: initialExecution.started_at,
|
|
6855
|
+
completed_at: initialExecution.completed_at,
|
|
6856
|
+
status: initialExecution.status
|
|
6857
|
+
});
|
|
6858
|
+
}
|
|
6859
|
+
setError(null);
|
|
6860
|
+
}, [initialExecution?.execution_id]);
|
|
6861
|
+
useEffect8(() => {
|
|
6519
6862
|
if (!execution?.execution_id || !execution?.authorization) return;
|
|
6520
6863
|
const status = (execution.status || "").toUpperCase();
|
|
6521
6864
|
const TERMINAL = ["FINISHED", "FAILURE", "ABORTED", "CANCELLED", "CANCELED"];
|
|
@@ -6622,7 +6965,7 @@ var AgentUI = ({
|
|
|
6622
6965
|
}
|
|
6623
6966
|
}, [chosenApps, getExecution, onRun, attachedImages, readUrlParams]);
|
|
6624
6967
|
const autoSubmittedRef = useRef6(false);
|
|
6625
|
-
|
|
6968
|
+
useEffect8(() => {
|
|
6626
6969
|
if (autoSubmit && defaultInput && !autoSubmittedRef.current && !executionId) {
|
|
6627
6970
|
autoSubmittedRef.current = true;
|
|
6628
6971
|
submitInput(defaultInput);
|
|
@@ -6654,10 +6997,10 @@ var AgentUI = ({
|
|
|
6654
6997
|
decision_id: decisionId
|
|
6655
6998
|
});
|
|
6656
6999
|
try {
|
|
6657
|
-
const resp = await fetch(
|
|
7000
|
+
const resp = await fetch(resolveUrl2(`/api/v1/workflows/${wfId}/run?${params.toString()}`), {
|
|
6658
7001
|
method: "GET",
|
|
6659
7002
|
credentials: "include",
|
|
6660
|
-
headers: { ...
|
|
7003
|
+
headers: { ...resolveHeaders2() }
|
|
6661
7004
|
});
|
|
6662
7005
|
const json = await resp.json();
|
|
6663
7006
|
if (json.success === false) {
|
|
@@ -6724,10 +7067,10 @@ var AgentUI = ({
|
|
|
6724
7067
|
body.source_workflow = execution.workflow?.id;
|
|
6725
7068
|
setAgentRequestLoading(true);
|
|
6726
7069
|
try {
|
|
6727
|
-
const resp = await fetch(
|
|
7070
|
+
const resp = await fetch(resolveUrl2(`/api/v1/apps/agent/run?rerun=true&decision_id=${encodeURIComponent(decisionId)}`), {
|
|
6728
7071
|
method: "POST",
|
|
6729
7072
|
credentials: "include",
|
|
6730
|
-
headers: { "Content-Type": "application/json", ...
|
|
7073
|
+
headers: { "Content-Type": "application/json", ...resolveHeaders2() },
|
|
6731
7074
|
body: JSON.stringify(body)
|
|
6732
7075
|
});
|
|
6733
7076
|
const json = await resp.json().catch(() => ({}));
|
|
@@ -6837,6 +7180,9 @@ var AgentUI = ({
|
|
|
6837
7180
|
const activeTab = showStarter ? "start" : viewMode;
|
|
6838
7181
|
const hasExecution = !!execution?.execution_id;
|
|
6839
7182
|
const showRunSwitcher = hasExecution || agentRequestLoading;
|
|
7183
|
+
useEffect8(() => {
|
|
7184
|
+
onViewChange?.(activeTab);
|
|
7185
|
+
}, [activeTab, onViewChange]);
|
|
6840
7186
|
const goToTab = (t) => {
|
|
6841
7187
|
if (t === "start") {
|
|
6842
7188
|
setShowStarter(true);
|
|
@@ -6859,15 +7205,19 @@ var AgentUI = ({
|
|
|
6859
7205
|
/* @__PURE__ */ jsx14(Box11, { sx: { display: "inline-flex", gap: 0.25, p: 0.25, borderRadius: 999, bgcolor: "hsl(var(--muted) / 0.6)" }, children: ["start", "simple", "detailed"].map((t) => {
|
|
6860
7206
|
const active = activeTab === t;
|
|
6861
7207
|
const label = t === "start" ? "Start" : t === "simple" ? "Simple" : "Detailed";
|
|
7208
|
+
const disabled = t === "start" && disableStartTab;
|
|
6862
7209
|
return /* @__PURE__ */ jsx14(
|
|
6863
7210
|
Box11,
|
|
6864
7211
|
{
|
|
6865
7212
|
component: "button",
|
|
6866
7213
|
type: "button",
|
|
6867
|
-
onClick: () =>
|
|
7214
|
+
onClick: () => {
|
|
7215
|
+
if (!disabled) goToTab(t);
|
|
7216
|
+
},
|
|
7217
|
+
disabled,
|
|
6868
7218
|
sx: {
|
|
6869
7219
|
all: "unset",
|
|
6870
|
-
cursor: "pointer",
|
|
7220
|
+
cursor: disabled ? "not-allowed" : "pointer",
|
|
6871
7221
|
px: 1.75,
|
|
6872
7222
|
py: 0.5,
|
|
6873
7223
|
borderRadius: 999,
|
|
@@ -6875,8 +7225,9 @@ var AgentUI = ({
|
|
|
6875
7225
|
fontWeight: 600,
|
|
6876
7226
|
color: active ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
6877
7227
|
bgcolor: active ? "hsl(var(--primary))" : "transparent",
|
|
7228
|
+
opacity: disabled ? 0.4 : 1,
|
|
6878
7229
|
transition: "background 0.12s ease, color 0.12s ease",
|
|
6879
|
-
"&:hover": active ? {} : { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
7230
|
+
"&:hover": active || disabled ? {} : { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
6880
7231
|
},
|
|
6881
7232
|
children: label
|
|
6882
7233
|
},
|
|
@@ -6899,645 +7250,1478 @@ var AgentUI = ({
|
|
|
6899
7250
|
}
|
|
6900
7251
|
) }) })
|
|
6901
7252
|
] });
|
|
6902
|
-
return /* @__PURE__ */ jsx14(
|
|
6903
|
-
|
|
6904
|
-
|
|
6905
|
-
|
|
6906
|
-
|
|
6907
|
-
|
|
6908
|
-
|
|
6909
|
-
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6916
|
-
|
|
6917
|
-
|
|
6918
|
-
|
|
6919
|
-
|
|
6920
|
-
|
|
6921
|
-
|
|
6922
|
-
|
|
6923
|
-
|
|
6924
|
-
|
|
6925
|
-
|
|
6926
|
-
|
|
6927
|
-
|
|
6928
|
-
|
|
6929
|
-
|
|
6930
|
-
|
|
6931
|
-
|
|
6932
|
-
|
|
6933
|
-
|
|
6934
|
-
|
|
6935
|
-
|
|
6936
|
-
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
6946
|
-
|
|
6947
|
-
|
|
6948
|
-
|
|
6949
|
-
|
|
6950
|
-
|
|
6951
|
-
|
|
6952
|
-
|
|
6953
|
-
|
|
6954
|
-
|
|
6955
|
-
|
|
6956
|
-
|
|
6957
|
-
|
|
6958
|
-
|
|
6959
|
-
|
|
6960
|
-
|
|
6961
|
-
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
6968
|
-
/* @__PURE__ */ jsx14(IconButton6, { size: "small", onClick: () => setAttachedImages((prev) => prev.filter((_, i) => i !== idx)), sx: { p: 0.25, color: "hsl(var(--muted-foreground))", "&:hover": { color: "hsl(var(--destructive))" } }, "aria-label": "Remove attached image", children: /* @__PURE__ */ jsx14(CloseIcon4, { sx: { fontSize: 12 } }) })
|
|
6969
|
-
] }, `${img.name}-${idx}`)) }),
|
|
6970
|
-
/* @__PURE__ */ jsxs12(Box11, { sx: { display: "flex", alignItems: "flex-end", gap: 1, width: "100%" }, children: [
|
|
6971
|
-
/* @__PURE__ */ jsx14(
|
|
6972
|
-
InputBase2,
|
|
6973
|
-
{
|
|
6974
|
-
inputRef,
|
|
6975
|
-
autoFocus: true,
|
|
6976
|
-
multiline: true,
|
|
6977
|
-
minRows: 1,
|
|
6978
|
-
maxRows: 6,
|
|
6979
|
-
fullWidth: true,
|
|
6980
|
-
value: actionInput,
|
|
6981
|
-
onChange: (e) => setActionInput(e.target.value),
|
|
6982
|
-
placeholder,
|
|
6983
|
-
onKeyDown,
|
|
6984
|
-
onPaste: (e) => {
|
|
6985
|
-
const items = e.clipboardData?.items;
|
|
6986
|
-
if (!items) return;
|
|
6987
|
-
const files = [];
|
|
6988
|
-
for (const item of Array.from(items)) {
|
|
6989
|
-
if (item.kind === "file" && item.type.startsWith("image/")) {
|
|
6990
|
-
const file = item.getAsFile();
|
|
6991
|
-
if (file) files.push(file);
|
|
6992
|
-
}
|
|
7253
|
+
return /* @__PURE__ */ jsx14(
|
|
7254
|
+
Box11,
|
|
7255
|
+
{
|
|
7256
|
+
className,
|
|
7257
|
+
sx: [
|
|
7258
|
+
{ width: "100%", display: "flex", justifyContent: "center", pb: 4 },
|
|
7259
|
+
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
7260
|
+
],
|
|
7261
|
+
children: /* @__PURE__ */ jsxs12(
|
|
7262
|
+
Box11,
|
|
7263
|
+
{
|
|
7264
|
+
sx: [
|
|
7265
|
+
{ width: "100%", maxWidth, display: "flex", flexDirection: "column", gap: 3 },
|
|
7266
|
+
...Array.isArray(contentSx) ? contentSx : contentSx ? [contentSx] : []
|
|
7267
|
+
],
|
|
7268
|
+
children: [
|
|
7269
|
+
showRunSwitcher && tabBar,
|
|
7270
|
+
showStarter ? /* @__PURE__ */ jsxs12(
|
|
7271
|
+
Box11,
|
|
7272
|
+
{
|
|
7273
|
+
component: "form",
|
|
7274
|
+
onSubmit: (e) => {
|
|
7275
|
+
e.preventDefault();
|
|
7276
|
+
submitInput(actionInput);
|
|
7277
|
+
},
|
|
7278
|
+
sx: { display: "flex", flexDirection: "column", alignItems: "center", gap: compact ? 2 : 3, py: compact ? 2 : 4 },
|
|
7279
|
+
children: [
|
|
7280
|
+
!hideHeroIcon && !compact && /* @__PURE__ */ jsx14(Box11, { sx: {
|
|
7281
|
+
width: heroIconSize,
|
|
7282
|
+
height: heroIconSize,
|
|
7283
|
+
borderRadius: 3,
|
|
7284
|
+
bgcolor: "hsl(var(--card))",
|
|
7285
|
+
border: "1px solid hsl(var(--border))",
|
|
7286
|
+
display: "flex",
|
|
7287
|
+
alignItems: "center",
|
|
7288
|
+
justifyContent: "center",
|
|
7289
|
+
boxShadow: "0 8px 24px rgba(0,0,0,0.25)"
|
|
7290
|
+
}, children: heroIcon ?? /* @__PURE__ */ jsx14(AgentIcon_default, { size: Math.round(heroIconSize * 0.67) }) }),
|
|
7291
|
+
/* @__PURE__ */ jsx14(Typography11, { component: "h1", sx: {
|
|
7292
|
+
fontSize: compact ? { xs: "1.25rem", md: "1.5rem" } : { xs: "1.75rem", md: "2.25rem" },
|
|
7293
|
+
fontWeight: 600,
|
|
7294
|
+
color: "hsl(var(--foreground))",
|
|
7295
|
+
textAlign: "center",
|
|
7296
|
+
letterSpacing: "-0.01em"
|
|
7297
|
+
}, children: title }),
|
|
7298
|
+
subtitle && /* @__PURE__ */ jsx14(Typography11, { sx: {
|
|
7299
|
+
fontSize: "0.95rem",
|
|
7300
|
+
color: "hsl(var(--muted-foreground))",
|
|
7301
|
+
textAlign: "center",
|
|
7302
|
+
mt: -1,
|
|
7303
|
+
maxWidth: 600
|
|
7304
|
+
}, children: subtitle }),
|
|
7305
|
+
/* @__PURE__ */ jsxs12(Box11, { sx: {
|
|
7306
|
+
width: "100%",
|
|
7307
|
+
display: "flex",
|
|
7308
|
+
flexDirection: "column",
|
|
7309
|
+
gap: 1,
|
|
7310
|
+
borderRadius: attachedImages.length > 0 ? 4 : 999,
|
|
7311
|
+
border: "1.5px solid hsl(var(--border))",
|
|
7312
|
+
bgcolor: "hsl(var(--card))",
|
|
7313
|
+
px: 3,
|
|
7314
|
+
py: 1.75,
|
|
7315
|
+
transition: "border-color 0.15s ease, box-shadow 0.15s ease, border-radius 0.15s ease",
|
|
7316
|
+
"&:focus-within": {
|
|
7317
|
+
borderColor: "hsl(var(--primary))",
|
|
7318
|
+
boxShadow: "0 0 0 3px hsla(var(--primary) / 0.12)"
|
|
6993
7319
|
}
|
|
6994
|
-
|
|
6995
|
-
|
|
6996
|
-
|
|
7320
|
+
}, children: [
|
|
7321
|
+
attachedImages.length > 0 && /* @__PURE__ */ jsx14(Box11, { sx: { display: "flex", flexWrap: "wrap", gap: 0.75 }, children: attachedImages.map((img, idx) => /* @__PURE__ */ jsxs12(Box11, { sx: {
|
|
7322
|
+
display: "inline-flex",
|
|
7323
|
+
alignItems: "center",
|
|
7324
|
+
gap: 1,
|
|
7325
|
+
p: 0.5,
|
|
7326
|
+
pr: 1,
|
|
7327
|
+
borderRadius: 1.5,
|
|
7328
|
+
border: "1px solid hsl(var(--border))",
|
|
7329
|
+
bgcolor: "hsl(var(--background))",
|
|
7330
|
+
maxWidth: "100%"
|
|
7331
|
+
}, children: [
|
|
7332
|
+
/* @__PURE__ */ jsx14(Box11, { component: "img", src: img.dataUrl, alt: img.name, sx: { width: 32, height: 32, borderRadius: 1, objectFit: "cover", flexShrink: 0 } }),
|
|
7333
|
+
/* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.72rem", color: "hsl(var(--foreground))", maxWidth: 190, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: img.name }),
|
|
7334
|
+
/* @__PURE__ */ jsx14(IconButton6, { size: "small", onClick: () => setAttachedImages((prev) => prev.filter((_, i) => i !== idx)), sx: { p: 0.25, color: "hsl(var(--muted-foreground))", "&:hover": { color: "hsl(var(--destructive))" } }, "aria-label": "Remove attached image", children: /* @__PURE__ */ jsx14(CloseIcon4, { sx: { fontSize: 12 } }) })
|
|
7335
|
+
] }, `${img.name}-${idx}`)) }),
|
|
7336
|
+
/* @__PURE__ */ jsxs12(Box11, { sx: { display: "flex", alignItems: "flex-end", gap: 1, width: "100%" }, children: [
|
|
7337
|
+
/* @__PURE__ */ jsx14(
|
|
7338
|
+
InputBase2,
|
|
7339
|
+
{
|
|
7340
|
+
inputRef,
|
|
7341
|
+
autoFocus: true,
|
|
7342
|
+
multiline: true,
|
|
7343
|
+
minRows: 1,
|
|
7344
|
+
maxRows: 6,
|
|
7345
|
+
fullWidth: true,
|
|
7346
|
+
value: actionInput,
|
|
7347
|
+
onChange: (e) => setActionInput(e.target.value),
|
|
7348
|
+
placeholder,
|
|
7349
|
+
onKeyDown,
|
|
7350
|
+
onPaste: (e) => {
|
|
7351
|
+
const items = e.clipboardData?.items;
|
|
7352
|
+
if (!items) return;
|
|
7353
|
+
const files = [];
|
|
7354
|
+
for (const item of Array.from(items)) {
|
|
7355
|
+
if (item.kind === "file" && item.type.startsWith("image/")) {
|
|
7356
|
+
const file = item.getAsFile();
|
|
7357
|
+
if (file) files.push(file);
|
|
7358
|
+
}
|
|
7359
|
+
}
|
|
7360
|
+
if (files.length > 0) {
|
|
7361
|
+
e.preventDefault();
|
|
7362
|
+
handleImagesSelected(files);
|
|
7363
|
+
}
|
|
7364
|
+
},
|
|
7365
|
+
disabled: agentRequestLoading,
|
|
7366
|
+
sx: {
|
|
7367
|
+
fontSize: "1rem",
|
|
7368
|
+
color: "hsl(var(--foreground))",
|
|
7369
|
+
"& textarea::placeholder": { color: "hsl(var(--muted-foreground))", opacity: 0.7 }
|
|
7370
|
+
}
|
|
7371
|
+
}
|
|
7372
|
+
),
|
|
7373
|
+
/* @__PURE__ */ jsx14(
|
|
7374
|
+
"input",
|
|
7375
|
+
{
|
|
7376
|
+
ref: fileInputRef,
|
|
7377
|
+
type: "file",
|
|
7378
|
+
accept: "image/*",
|
|
7379
|
+
multiple: true,
|
|
7380
|
+
style: { display: "none" },
|
|
7381
|
+
onChange: (e) => {
|
|
7382
|
+
handleImagesSelected(e.target.files);
|
|
7383
|
+
if (e.target) e.target.value = "";
|
|
7384
|
+
}
|
|
7385
|
+
}
|
|
7386
|
+
),
|
|
7387
|
+
!hideAttach && /* @__PURE__ */ jsx14(
|
|
7388
|
+
IconButton6,
|
|
7389
|
+
{
|
|
7390
|
+
type: "button",
|
|
7391
|
+
onClick: () => fileInputRef.current?.click(),
|
|
7392
|
+
disabled: agentRequestLoading,
|
|
7393
|
+
title: attachedImages.length > 0 ? `Add image (${attachedImages.length} attached)` : "Attach image",
|
|
7394
|
+
sx: {
|
|
7395
|
+
width: 36,
|
|
7396
|
+
height: 36,
|
|
7397
|
+
color: attachedImages.length > 0 ? "hsl(var(--primary))" : "hsl(var(--muted-foreground))",
|
|
7398
|
+
bgcolor: attachedImages.length > 0 ? "hsla(var(--primary) / 0.1)" : "transparent",
|
|
7399
|
+
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
7400
|
+
},
|
|
7401
|
+
children: /* @__PURE__ */ jsx14(AttachFileIcon, { sx: { fontSize: 18 } })
|
|
7402
|
+
}
|
|
7403
|
+
),
|
|
7404
|
+
/* @__PURE__ */ jsx14(Tooltip6, { title: submitTooltip, placement: "top", arrow: true, children: /* @__PURE__ */ jsx14("span", { children: /* @__PURE__ */ jsx14(
|
|
7405
|
+
IconButton6,
|
|
7406
|
+
{
|
|
7407
|
+
type: "submit",
|
|
7408
|
+
disabled: actionInput.trim().length < 3 || agentRequestLoading,
|
|
7409
|
+
sx: {
|
|
7410
|
+
width: 36,
|
|
7411
|
+
height: 36,
|
|
7412
|
+
bgcolor: actionInput.trim().length >= 3 ? "hsl(var(--primary))" : "hsl(var(--muted))",
|
|
7413
|
+
color: actionInput.trim().length >= 3 ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
7414
|
+
"&:hover": actionInput.trim().length >= 3 ? { filter: "brightness(1.1)", bgcolor: "hsl(var(--primary))" } : {},
|
|
7415
|
+
"&.Mui-disabled": { bgcolor: "hsl(var(--muted))", color: "hsl(var(--muted-foreground))" }
|
|
7416
|
+
},
|
|
7417
|
+
children: agentRequestLoading ? /* @__PURE__ */ jsx14(CircularProgress4, { size: 16, sx: { color: "inherit" } }) : submitIcon ?? /* @__PURE__ */ jsx14(PlayArrowRoundedIcon2, {})
|
|
7418
|
+
}
|
|
7419
|
+
) }) })
|
|
7420
|
+
] })
|
|
7421
|
+
] }),
|
|
7422
|
+
!hideAppPicker && /* @__PURE__ */ jsx14(Box11, { sx: { display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsxs12(Box11, { sx: {
|
|
7423
|
+
display: "inline-flex",
|
|
7424
|
+
flexWrap: "wrap",
|
|
7425
|
+
alignItems: "center",
|
|
7426
|
+
gap: 0.5,
|
|
7427
|
+
p: 0.5,
|
|
7428
|
+
borderRadius: 999,
|
|
7429
|
+
border: "1px solid hsl(var(--border))",
|
|
7430
|
+
bgcolor: "hsl(var(--card))",
|
|
7431
|
+
maxWidth: "100%"
|
|
7432
|
+
}, children: [
|
|
7433
|
+
/* @__PURE__ */ jsxs12(
|
|
7434
|
+
Box11,
|
|
7435
|
+
{
|
|
7436
|
+
component: "button",
|
|
7437
|
+
type: "button",
|
|
7438
|
+
onClick: () => setAppSearchOpen(true),
|
|
7439
|
+
sx: {
|
|
7440
|
+
all: "unset",
|
|
7441
|
+
cursor: "pointer",
|
|
7442
|
+
display: "inline-flex",
|
|
7443
|
+
alignItems: "center",
|
|
7444
|
+
gap: 0.5,
|
|
7445
|
+
px: 1.5,
|
|
7446
|
+
py: 0.5,
|
|
7447
|
+
borderRadius: 999,
|
|
7448
|
+
fontSize: "0.8rem",
|
|
7449
|
+
fontWeight: 500,
|
|
7450
|
+
color: "hsl(var(--muted-foreground))",
|
|
7451
|
+
bgcolor: "transparent",
|
|
7452
|
+
transition: "color 0.12s ease, background-color 0.12s ease",
|
|
7453
|
+
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted) / 0.5)" }
|
|
7454
|
+
},
|
|
7455
|
+
children: [
|
|
7456
|
+
/* @__PURE__ */ jsx14(AddIcon2, { sx: { fontSize: 14 } }),
|
|
7457
|
+
appPickerLabel
|
|
7458
|
+
]
|
|
7459
|
+
}
|
|
7460
|
+
),
|
|
7461
|
+
chosenApps.map((app, i) => /* @__PURE__ */ jsxs12(
|
|
7462
|
+
Box11,
|
|
7463
|
+
{
|
|
7464
|
+
sx: {
|
|
7465
|
+
display: "inline-flex",
|
|
7466
|
+
alignItems: "center",
|
|
7467
|
+
gap: 0.5,
|
|
7468
|
+
pl: 0.5,
|
|
7469
|
+
pr: 0.75,
|
|
7470
|
+
py: 0.25,
|
|
7471
|
+
borderRadius: 999,
|
|
7472
|
+
bgcolor: "hsl(var(--muted) / 0.6)",
|
|
7473
|
+
fontSize: "0.8rem",
|
|
7474
|
+
color: "hsl(var(--foreground))"
|
|
7475
|
+
},
|
|
7476
|
+
children: [
|
|
7477
|
+
/* @__PURE__ */ jsx14(
|
|
7478
|
+
Avatar6,
|
|
7479
|
+
{
|
|
7480
|
+
src: app.icon || void 0,
|
|
7481
|
+
alt: app.name,
|
|
7482
|
+
variant: "rounded",
|
|
7483
|
+
sx: { width: 18, height: 18, bgcolor: "transparent" }
|
|
7484
|
+
}
|
|
7485
|
+
),
|
|
7486
|
+
/* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.8rem", mx: 0.25, textTransform: "capitalize" }, children: app.name.replace(/_/g, " ") }),
|
|
7487
|
+
/* @__PURE__ */ jsx14(
|
|
7488
|
+
IconButton6,
|
|
7489
|
+
{
|
|
7490
|
+
size: "small",
|
|
7491
|
+
onClick: () => setChosenApps((prev) => prev.filter((_, idx) => idx !== i)),
|
|
7492
|
+
sx: { p: 0.125, color: "hsl(var(--muted-foreground))", "&:hover": { color: "hsl(var(--destructive))" } },
|
|
7493
|
+
children: /* @__PURE__ */ jsx14(CloseIcon4, { sx: { fontSize: 12 } })
|
|
7494
|
+
}
|
|
7495
|
+
)
|
|
7496
|
+
]
|
|
7497
|
+
},
|
|
7498
|
+
`${app.name}-${i}`
|
|
7499
|
+
))
|
|
7500
|
+
] }) }),
|
|
7501
|
+
error && /* @__PURE__ */ jsx14(Box11, { sx: {
|
|
7502
|
+
width: "100%",
|
|
7503
|
+
p: 1.5,
|
|
7504
|
+
borderRadius: 1.5,
|
|
7505
|
+
border: "1px solid hsl(var(--destructive) / 0.4)",
|
|
7506
|
+
bgcolor: "hsl(var(--destructive) / 0.08)",
|
|
7507
|
+
color: "hsl(var(--destructive))",
|
|
7508
|
+
fontSize: "0.85rem"
|
|
7509
|
+
}, children: error })
|
|
7510
|
+
]
|
|
7511
|
+
}
|
|
7512
|
+
) : /* @__PURE__ */ jsxs12(Box11, { children: [
|
|
7513
|
+
/* @__PURE__ */ jsxs12(Box11, { sx: {
|
|
7514
|
+
display: "flex",
|
|
7515
|
+
alignItems: "center",
|
|
7516
|
+
gap: 2,
|
|
7517
|
+
p: 2,
|
|
7518
|
+
borderRadius: 2,
|
|
7519
|
+
border: "1px solid hsl(var(--border))",
|
|
7520
|
+
bgcolor: "hsl(var(--card))",
|
|
7521
|
+
mb: 2
|
|
7522
|
+
}, children: [
|
|
7523
|
+
/* @__PURE__ */ jsxs12(Box11, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
7524
|
+
/* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.85rem", color: "hsl(var(--foreground))", fontWeight: 600, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: agentData?.original_input || actionInput || "Agent run" }),
|
|
7525
|
+
/* @__PURE__ */ jsxs12(Typography11, { sx: { fontSize: "0.7rem", color: "hsl(var(--muted-foreground))" }, children: [
|
|
7526
|
+
"Status: ",
|
|
7527
|
+
execution?.status || agentData?.status || "\u2014",
|
|
7528
|
+
" \xB7 ",
|
|
7529
|
+
execution?.execution_id?.slice(0, 8) || ""
|
|
7530
|
+
] })
|
|
7531
|
+
] }),
|
|
7532
|
+
/* @__PURE__ */ jsx14(AvatarGroup, { max: 6, sx: { "& .MuiAvatar-root": { width: 28, height: 28, borderColor: "hsl(var(--border))" } }, children: (executionApps.length > 0 ? executionApps : chosenApps).map((app, i) => /* @__PURE__ */ jsx14(Tooltip6, { title: (app.name || "").replace(/_/g, " "), children: /* @__PURE__ */ jsx14(
|
|
7533
|
+
Avatar6,
|
|
7534
|
+
{
|
|
7535
|
+
src: app.icon || void 0,
|
|
7536
|
+
alt: app.name,
|
|
7537
|
+
variant: "rounded",
|
|
7538
|
+
onClick: () => navigate(`/apps/${encodeURIComponent((app.name || "").toLowerCase().replace(/\s+/g, "_"))}`),
|
|
7539
|
+
sx: {
|
|
7540
|
+
bgcolor: "hsl(var(--muted))",
|
|
7541
|
+
cursor: "pointer",
|
|
7542
|
+
transition: "transform 0.15s ease, border-color 0.15s ease",
|
|
7543
|
+
"&:hover": { transform: "scale(1.08)", borderColor: "hsl(var(--primary)) !important" }
|
|
6997
7544
|
}
|
|
6998
|
-
},
|
|
6999
|
-
disabled: agentRequestLoading,
|
|
7000
|
-
sx: {
|
|
7001
|
-
fontSize: "1rem",
|
|
7002
|
-
color: "hsl(var(--foreground))",
|
|
7003
|
-
"& textarea::placeholder": { color: "hsl(var(--muted-foreground))", opacity: 0.7 }
|
|
7004
7545
|
}
|
|
7546
|
+
) }, i)) })
|
|
7547
|
+
] }),
|
|
7548
|
+
error && /* @__PURE__ */ jsx14(Box11, { sx: {
|
|
7549
|
+
p: 1.5,
|
|
7550
|
+
borderRadius: 1.5,
|
|
7551
|
+
mb: 2,
|
|
7552
|
+
border: "1px solid hsl(var(--destructive) / 0.4)",
|
|
7553
|
+
bgcolor: "hsl(var(--destructive) / 0.08)",
|
|
7554
|
+
color: "hsl(var(--destructive))",
|
|
7555
|
+
fontSize: "0.85rem"
|
|
7556
|
+
}, children: error }),
|
|
7557
|
+
viewMode === "simple" && /* @__PURE__ */ jsx14(Box11, { sx: {
|
|
7558
|
+
borderRadius: 2,
|
|
7559
|
+
border: "1px solid hsl(var(--border))",
|
|
7560
|
+
bgcolor: "hsl(var(--card))",
|
|
7561
|
+
p: 2.5,
|
|
7562
|
+
display: "flex",
|
|
7563
|
+
flexDirection: "column",
|
|
7564
|
+
gap: 1.5
|
|
7565
|
+
}, children: (() => {
|
|
7566
|
+
const status = (execution?.status || agentData?.status || "EXECUTING").toUpperCase();
|
|
7567
|
+
const decisionCount = (agentData?.decisions || []).length;
|
|
7568
|
+
const isRunning = !["FINISHED", "FAILURE", "ABORTED", "CANCELLED", "CANCELED"].includes(status);
|
|
7569
|
+
const rawStartedAt = agentData?.started_at || execution?.started_at || 0;
|
|
7570
|
+
const startedAtSec = rawStartedAt > 1e12 ? Math.floor(rawStartedAt / 1e3) : rawStartedAt;
|
|
7571
|
+
const effectiveStart = startedAtSec || localRunStart || 0;
|
|
7572
|
+
let durationSec = null;
|
|
7573
|
+
if (isRunning && effectiveStart) {
|
|
7574
|
+
durationSec = Math.max(0, nowTick - effectiveStart);
|
|
7575
|
+
} else if (totalDuration && totalDuration > 0) {
|
|
7576
|
+
durationSec = Math.round(totalDuration);
|
|
7005
7577
|
}
|
|
7006
|
-
|
|
7007
|
-
|
|
7008
|
-
|
|
7009
|
-
|
|
7010
|
-
|
|
7011
|
-
|
|
7012
|
-
|
|
7013
|
-
|
|
7014
|
-
|
|
7015
|
-
|
|
7016
|
-
|
|
7017
|
-
if (e.target) e.target.value = "";
|
|
7578
|
+
const pendingAsk = (agentData?.decisions || []).slice().reverse().find((d) => {
|
|
7579
|
+
const isAsk = d.category === "ask" || d.action === "ask";
|
|
7580
|
+
const st = (d.run_details?.status || "").toUpperCase();
|
|
7581
|
+
return isAsk && (st === "RUNNING" || st === "WAITING");
|
|
7582
|
+
});
|
|
7583
|
+
const pendingQuestions = [];
|
|
7584
|
+
if (pendingAsk) {
|
|
7585
|
+
for (const f of pendingAsk.fields || []) {
|
|
7586
|
+
if (f.key === "question" && f.value) {
|
|
7587
|
+
pendingQuestions.push({ question: f.value, index: pendingQuestions.length + 1 });
|
|
7588
|
+
}
|
|
7018
7589
|
}
|
|
7019
7590
|
}
|
|
7020
|
-
|
|
7021
|
-
|
|
7022
|
-
|
|
7023
|
-
|
|
7024
|
-
|
|
7025
|
-
|
|
7026
|
-
|
|
7027
|
-
|
|
7028
|
-
|
|
7029
|
-
|
|
7030
|
-
|
|
7031
|
-
|
|
7032
|
-
|
|
7033
|
-
|
|
7034
|
-
|
|
7035
|
-
|
|
7591
|
+
const pendingAnswered = pendingQuestions.every((q) => questionAnswers[q.question]?.value);
|
|
7592
|
+
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
7593
|
+
/* @__PURE__ */ jsxs12(Box11, { sx: { display: "flex", alignItems: "center", gap: 1, flexWrap: "wrap" }, children: [
|
|
7594
|
+
isRunning ? /* @__PURE__ */ jsx14(CircularProgress4, { size: 16, sx: { color: "hsl(var(--primary))" } }) : status === "FINISHED" ? /* @__PURE__ */ jsx14(CheckCircleIcon3, { sx: { fontSize: 18, color: "hsl(142 70% 45%)" } }) : /* @__PURE__ */ jsx14(ErrorIcon, { sx: { fontSize: 18, color: "hsl(var(--destructive))" } }),
|
|
7595
|
+
/* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.9rem", fontWeight: 600, color: "hsl(var(--foreground))" }, children: isRunning ? "Agent is working\u2026" : status === "FINISHED" ? "Run finished" : `Run ${status.toLowerCase()}` }),
|
|
7596
|
+
/* @__PURE__ */ jsxs12(Typography11, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))" }, children: [
|
|
7597
|
+
decisionCount,
|
|
7598
|
+
" step",
|
|
7599
|
+
decisionCount === 1 ? "" : "s",
|
|
7600
|
+
durationSec != null ? ` \xB7 ${durationSec}s` : ""
|
|
7601
|
+
] })
|
|
7602
|
+
] }),
|
|
7603
|
+
finishAnswer ? /* @__PURE__ */ jsx14(Box11, { sx: {
|
|
7604
|
+
p: 2,
|
|
7605
|
+
borderRadius: 1.5,
|
|
7606
|
+
border: "1px solid hsl(var(--border))",
|
|
7607
|
+
bgcolor: "hsl(var(--background))",
|
|
7608
|
+
fontSize: "0.9rem",
|
|
7609
|
+
color: "hsl(var(--foreground))",
|
|
7610
|
+
"& > *:first-of-type": { mt: 0 },
|
|
7611
|
+
"& > *:last-child": { mb: 0 },
|
|
7612
|
+
"& p": { my: 1, lineHeight: 1.55 },
|
|
7613
|
+
"& h1, & h2, & h3, & h4": { mt: 2, mb: 1, fontWeight: 600, lineHeight: 1.3 },
|
|
7614
|
+
"& h1": { fontSize: "1.15rem" },
|
|
7615
|
+
"& h2": { fontSize: "1.05rem" },
|
|
7616
|
+
"& h3, & h4": { fontSize: "0.95rem" },
|
|
7617
|
+
"& ul": { my: 1, pl: 3, listStyleType: "disc", listStylePosition: "outside" },
|
|
7618
|
+
"& ol": { my: 1, pl: 3, listStyleType: "decimal", listStylePosition: "outside" },
|
|
7619
|
+
"& ul ul": { listStyleType: "circle" },
|
|
7620
|
+
"& ul ul ul": { listStyleType: "square" },
|
|
7621
|
+
"& li": { my: 0.25, display: "list-item" },
|
|
7622
|
+
"& li::marker": { color: "hsl(var(--muted-foreground))" },
|
|
7623
|
+
"& a": { color: "hsl(var(--primary))", textDecoration: "underline" },
|
|
7624
|
+
"& code": {
|
|
7625
|
+
px: 0.5,
|
|
7626
|
+
py: 0.125,
|
|
7627
|
+
borderRadius: 0.5,
|
|
7628
|
+
bgcolor: "hsl(var(--muted))",
|
|
7629
|
+
fontFamily: '"JetBrains Mono", ui-monospace, monospace',
|
|
7630
|
+
fontSize: "0.82em"
|
|
7631
|
+
},
|
|
7632
|
+
"& pre": {
|
|
7633
|
+
p: 1.5,
|
|
7634
|
+
my: 1,
|
|
7635
|
+
borderRadius: 1,
|
|
7636
|
+
bgcolor: "hsl(var(--muted))",
|
|
7637
|
+
overflowX: "auto",
|
|
7638
|
+
fontSize: "0.82rem"
|
|
7639
|
+
},
|
|
7640
|
+
"& pre code": { p: 0, bgcolor: "transparent" },
|
|
7641
|
+
"& blockquote": {
|
|
7642
|
+
borderLeft: "3px solid hsl(var(--border))",
|
|
7643
|
+
pl: 1.5,
|
|
7644
|
+
my: 1,
|
|
7645
|
+
color: "hsl(var(--muted-foreground))"
|
|
7646
|
+
},
|
|
7647
|
+
"& table": { borderCollapse: "collapse", my: 1, fontSize: "0.85rem" },
|
|
7648
|
+
"& th, & td": { border: "1px solid hsl(var(--border))", px: 1, py: 0.5 },
|
|
7649
|
+
"& hr": { border: 0, borderTop: "1px solid hsl(var(--border))", my: 1.5 }
|
|
7650
|
+
}, children: /* @__PURE__ */ jsx14(Markdown, { remarkPlugins: [remarkGfm4, remarkBreaks], children: normalizeMarkdown(finishAnswer) }) }) : pendingAsk && pendingQuestions.length > 0 ? (() => {
|
|
7651
|
+
const trySimpleSubmit = () => {
|
|
7652
|
+
if (agentRequestLoading) return;
|
|
7653
|
+
if (!pendingAnswered) {
|
|
7654
|
+
setSimpleSubmitAttempted(true);
|
|
7655
|
+
return;
|
|
7656
|
+
}
|
|
7657
|
+
if (pendingAsk.run_details?.id) {
|
|
7658
|
+
submitQuestions(pendingAsk.run_details.id, questionAnswers);
|
|
7659
|
+
}
|
|
7660
|
+
};
|
|
7661
|
+
return /* @__PURE__ */ jsxs12(Box11, { sx: { display: "flex", flexDirection: "column", gap: 1.5 }, children: [
|
|
7662
|
+
pendingQuestions.map((q, qi) => {
|
|
7663
|
+
const value = questionAnswers[q.question]?.value || "";
|
|
7664
|
+
const isMissing = simpleSubmitAttempted && !value;
|
|
7665
|
+
return /* @__PURE__ */ jsxs12(Box11, { children: [
|
|
7666
|
+
/* @__PURE__ */ jsx14(Box11, { sx: { fontSize: "0.9rem", color: "hsl(var(--foreground))", mb: 1, "& p": { my: 0.5 } }, children: /* @__PURE__ */ jsx14(Markdown, { remarkPlugins: [remarkGfm4, remarkBreaks], children: normalizeMarkdown(q.question) }) }),
|
|
7667
|
+
/* @__PURE__ */ jsx14(
|
|
7668
|
+
TextField4,
|
|
7669
|
+
{
|
|
7670
|
+
fullWidth: true,
|
|
7671
|
+
multiline: true,
|
|
7672
|
+
minRows: 2,
|
|
7673
|
+
placeholder: "Your answer here\u2026",
|
|
7674
|
+
value,
|
|
7675
|
+
error: isMissing,
|
|
7676
|
+
helperText: isMissing ? "Please answer this question" : void 0,
|
|
7677
|
+
onChange: (e) => {
|
|
7678
|
+
const v = e.target.value;
|
|
7679
|
+
setQuestionAnswers((prev) => ({
|
|
7680
|
+
...prev,
|
|
7681
|
+
[q.question]: { index: qi, value: v }
|
|
7682
|
+
}));
|
|
7683
|
+
},
|
|
7684
|
+
onKeyDown: (e) => {
|
|
7685
|
+
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
7686
|
+
e.preventDefault();
|
|
7687
|
+
trySimpleSubmit();
|
|
7688
|
+
}
|
|
7689
|
+
},
|
|
7690
|
+
size: "small",
|
|
7691
|
+
sx: { "& .MuiOutlinedInput-root": { bgcolor: "hsl(var(--background))" } }
|
|
7692
|
+
}
|
|
7693
|
+
)
|
|
7694
|
+
] }, qi);
|
|
7695
|
+
}),
|
|
7696
|
+
/* @__PURE__ */ jsxs12(Box11, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
7697
|
+
/* @__PURE__ */ jsx14(
|
|
7698
|
+
Button5,
|
|
7699
|
+
{
|
|
7700
|
+
variant: "contained",
|
|
7701
|
+
size: "small",
|
|
7702
|
+
disabled: agentRequestLoading,
|
|
7703
|
+
onClick: trySimpleSubmit,
|
|
7704
|
+
children: agentRequestLoading ? /* @__PURE__ */ jsx14(CircularProgress4, { size: 16 }) : "Submit"
|
|
7705
|
+
}
|
|
7706
|
+
),
|
|
7707
|
+
pendingAsk.run_details?.id && getFormUrl(pendingAsk.run_details.id) && /* @__PURE__ */ jsx14(Tooltip6, { title: "Answer in the Form UI", placement: "right", children: /* @__PURE__ */ jsx14(
|
|
7708
|
+
IconButton6,
|
|
7709
|
+
{
|
|
7710
|
+
size: "small",
|
|
7711
|
+
onClick: () => {
|
|
7712
|
+
const url = getFormUrl(pendingAsk.run_details.id);
|
|
7713
|
+
if (url) window.open(url, "_blank", "noopener,noreferrer");
|
|
7714
|
+
},
|
|
7715
|
+
sx: { color: "hsl(var(--muted-foreground))", "&:hover": { color: "hsl(var(--primary))" } },
|
|
7716
|
+
children: /* @__PURE__ */ jsx14(OpenInNewIcon2, { sx: { fontSize: 18 } })
|
|
7717
|
+
}
|
|
7718
|
+
) })
|
|
7719
|
+
] })
|
|
7720
|
+
] });
|
|
7721
|
+
})() : isRunning ? /* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: "Waiting for the agent to produce the first step." }) : /* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: "No final answer was returned. Open Detailed to inspect each step." }),
|
|
7722
|
+
!isRunning && /* @__PURE__ */ jsx14(Box11, { children: /* @__PURE__ */ jsx14(
|
|
7723
|
+
Button5,
|
|
7724
|
+
{
|
|
7725
|
+
size: "small",
|
|
7726
|
+
variant: "text",
|
|
7727
|
+
onClick: () => setViewMode("detailed"),
|
|
7728
|
+
sx: { color: "hsl(var(--primary))", textTransform: "none", px: 0 },
|
|
7729
|
+
children: "View detailed timeline \u2192"
|
|
7730
|
+
}
|
|
7731
|
+
) })
|
|
7732
|
+
] });
|
|
7733
|
+
})() }),
|
|
7734
|
+
viewMode === "detailed" && (() => {
|
|
7735
|
+
const detailedStatus = (execution?.status || agentData?.status || "EXECUTING").toUpperCase();
|
|
7736
|
+
const detailedIsRunning = !["FINISHED", "FAILURE", "ABORTED", "CANCELLED", "CANCELED"].includes(detailedStatus);
|
|
7737
|
+
const detailedRunFinished = !detailedIsRunning;
|
|
7738
|
+
return /* @__PURE__ */ jsx14(Box11, { sx: {
|
|
7739
|
+
borderRadius: 2,
|
|
7740
|
+
border: "1px solid hsl(var(--border))",
|
|
7741
|
+
bgcolor: "hsl(var(--card))",
|
|
7742
|
+
overflow: "hidden"
|
|
7743
|
+
}, children: timeline.length === 0 || timeline.length === 1 && agentRequestLoading ? /* @__PURE__ */ jsxs12(Box11, { sx: { p: 4, textAlign: "center", color: "hsl(var(--muted-foreground))", fontSize: "0.85rem" }, children: [
|
|
7744
|
+
/* @__PURE__ */ jsx14(CircularProgress4, { size: 20, sx: { mb: 1 } }),
|
|
7745
|
+
/* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.85rem" }, children: "Waiting for agent response\u2026" })
|
|
7746
|
+
] }) : /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
7747
|
+
timeline.map((item, i) => /* @__PURE__ */ jsx14(
|
|
7748
|
+
TimelineRow,
|
|
7749
|
+
{
|
|
7750
|
+
item,
|
|
7751
|
+
index: i,
|
|
7752
|
+
open: openIndexes.has(i),
|
|
7753
|
+
onToggle: () => toggleOpen(i),
|
|
7754
|
+
appsById,
|
|
7755
|
+
totalDuration,
|
|
7756
|
+
originalStartTime,
|
|
7757
|
+
maxWidth: 210,
|
|
7758
|
+
questionAnswers,
|
|
7759
|
+
setQuestionAnswers,
|
|
7760
|
+
onSubmitQuestions: submitQuestions,
|
|
7761
|
+
onRerunAgent: rerunAgent,
|
|
7762
|
+
onRerunDecision: rerunDecision,
|
|
7763
|
+
agentRequestLoading,
|
|
7764
|
+
getFormUrl,
|
|
7765
|
+
runFinished: detailedRunFinished
|
|
7766
|
+
},
|
|
7767
|
+
i
|
|
7768
|
+
)),
|
|
7769
|
+
detailedRunFinished && /* @__PURE__ */ jsxs12(Box11, { sx: {
|
|
7770
|
+
borderTop: "1px solid hsl(var(--border))",
|
|
7771
|
+
p: 2.5,
|
|
7772
|
+
display: "flex",
|
|
7773
|
+
flexDirection: "column",
|
|
7774
|
+
gap: 1.5,
|
|
7775
|
+
bgcolor: "hsl(var(--muted) / 0.2)"
|
|
7776
|
+
}, children: [
|
|
7777
|
+
/* @__PURE__ */ jsxs12(Box11, { sx: { display: "flex", alignItems: "center", gap: 1, flexWrap: "wrap" }, children: [
|
|
7778
|
+
detailedStatus === "FINISHED" ? /* @__PURE__ */ jsx14(CheckCircleIcon3, { sx: { fontSize: 18, color: "hsl(142 70% 45%)" } }) : /* @__PURE__ */ jsx14(ErrorIcon, { sx: { fontSize: 18, color: "hsl(var(--destructive))" } }),
|
|
7779
|
+
/* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.9rem", fontWeight: 600, color: "hsl(var(--foreground))" }, children: detailedStatus === "FINISHED" ? "Run finished" : `Run ${detailedStatus.toLowerCase()}` })
|
|
7780
|
+
] }),
|
|
7781
|
+
finishAnswer && /* @__PURE__ */ jsx14(Box11, { sx: {
|
|
7782
|
+
p: 2,
|
|
7783
|
+
borderRadius: 1.5,
|
|
7784
|
+
border: "1px solid hsl(var(--border))",
|
|
7785
|
+
bgcolor: "hsl(var(--background))",
|
|
7786
|
+
fontSize: "0.9rem",
|
|
7787
|
+
color: "hsl(var(--foreground))",
|
|
7788
|
+
"& > *:first-of-type": { mt: 0 },
|
|
7789
|
+
"& > *:last-child": { mb: 0 },
|
|
7790
|
+
"& p": { my: 1, lineHeight: 1.55 },
|
|
7791
|
+
"& a": { color: "hsl(var(--primary))", textDecoration: "underline" },
|
|
7792
|
+
"& code": {
|
|
7793
|
+
px: 0.5,
|
|
7794
|
+
py: 0.125,
|
|
7795
|
+
borderRadius: 0.5,
|
|
7796
|
+
bgcolor: "hsl(var(--muted))",
|
|
7797
|
+
fontFamily: '"JetBrains Mono", ui-monospace, monospace',
|
|
7798
|
+
fontSize: "0.82em"
|
|
7799
|
+
},
|
|
7800
|
+
"& pre": {
|
|
7801
|
+
p: 1.5,
|
|
7802
|
+
my: 1,
|
|
7803
|
+
borderRadius: 1,
|
|
7804
|
+
bgcolor: "hsl(var(--muted))",
|
|
7805
|
+
overflowX: "auto",
|
|
7806
|
+
fontSize: "0.82rem"
|
|
7807
|
+
},
|
|
7808
|
+
"& pre code": { p: 0, bgcolor: "transparent" }
|
|
7809
|
+
}, children: /* @__PURE__ */ jsx14(Markdown, { remarkPlugins: [remarkGfm4, remarkBreaks], children: normalizeMarkdown(finishAnswer) }) })
|
|
7810
|
+
] })
|
|
7811
|
+
] }) });
|
|
7812
|
+
})(),
|
|
7813
|
+
finishDecisionId && /* @__PURE__ */ jsx14(Box11, { sx: { mt: 3, display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsxs12(Box11, { sx: { width: "100%", maxWidth: 640 }, children: [
|
|
7814
|
+
/* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))", mb: 0.75, textAlign: "center" }, children: "Continue this agent run with more details" }),
|
|
7815
|
+
/* @__PURE__ */ jsxs12(
|
|
7816
|
+
Box11,
|
|
7817
|
+
{
|
|
7818
|
+
component: "form",
|
|
7819
|
+
onSubmit: (e) => {
|
|
7820
|
+
e.preventDefault();
|
|
7821
|
+
if (continuationText.trim()) {
|
|
7822
|
+
submitQuestions(finishDecisionId, { continue: continuationText }, true);
|
|
7823
|
+
}
|
|
7824
|
+
},
|
|
7825
|
+
sx: {
|
|
7826
|
+
display: "flex",
|
|
7827
|
+
alignItems: "flex-end",
|
|
7828
|
+
gap: 1,
|
|
7829
|
+
p: 1.25,
|
|
7830
|
+
borderRadius: 999,
|
|
7831
|
+
border: "1.5px solid hsl(var(--border))",
|
|
7832
|
+
bgcolor: "hsl(var(--card))",
|
|
7833
|
+
"&:focus-within": {
|
|
7834
|
+
borderColor: "hsl(var(--primary))",
|
|
7835
|
+
boxShadow: "0 0 0 3px hsla(var(--primary) / 0.12)"
|
|
7836
|
+
}
|
|
7837
|
+
},
|
|
7838
|
+
children: [
|
|
7839
|
+
/* @__PURE__ */ jsx14(
|
|
7840
|
+
InputBase2,
|
|
7841
|
+
{
|
|
7842
|
+
fullWidth: true,
|
|
7843
|
+
multiline: true,
|
|
7844
|
+
minRows: 1,
|
|
7845
|
+
maxRows: 4,
|
|
7846
|
+
placeholder: continuationPlaceholder,
|
|
7847
|
+
value: continuationText,
|
|
7848
|
+
onChange: (e) => setContinuationText(e.target.value),
|
|
7849
|
+
onKeyDown: (e) => {
|
|
7850
|
+
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
7851
|
+
e.preventDefault();
|
|
7852
|
+
if (continuationText.trim() && !agentRequestLoading) {
|
|
7853
|
+
submitQuestions(finishDecisionId, { continue: continuationText }, true);
|
|
7854
|
+
}
|
|
7855
|
+
}
|
|
7856
|
+
},
|
|
7857
|
+
disabled: agentRequestLoading,
|
|
7858
|
+
sx: { fontSize: "0.9rem", color: "hsl(var(--foreground))", px: 2 }
|
|
7859
|
+
}
|
|
7860
|
+
),
|
|
7861
|
+
/* @__PURE__ */ jsx14(
|
|
7862
|
+
IconButton6,
|
|
7863
|
+
{
|
|
7864
|
+
type: "submit",
|
|
7865
|
+
disabled: !continuationText.trim() || agentRequestLoading,
|
|
7866
|
+
sx: {
|
|
7867
|
+
width: 36,
|
|
7868
|
+
height: 36,
|
|
7869
|
+
bgcolor: continuationText.trim() && !agentRequestLoading ? "hsl(var(--primary))" : "hsl(var(--muted))",
|
|
7870
|
+
color: continuationText.trim() && !agentRequestLoading ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
7871
|
+
"&:hover": continuationText.trim() && !agentRequestLoading ? { filter: "brightness(1.1)", bgcolor: "hsl(var(--primary))" } : {}
|
|
7872
|
+
},
|
|
7873
|
+
children: agentRequestLoading ? /* @__PURE__ */ jsx14(CircularProgress4, { size: 16, sx: { color: "inherit" } }) : /* @__PURE__ */ jsx14(SendIcon, { sx: { fontSize: 18 } })
|
|
7874
|
+
}
|
|
7875
|
+
)
|
|
7876
|
+
]
|
|
7877
|
+
}
|
|
7878
|
+
)
|
|
7879
|
+
] }) })
|
|
7880
|
+
] }),
|
|
7881
|
+
/* @__PURE__ */ jsx14(
|
|
7882
|
+
AppSearchDrawer,
|
|
7883
|
+
{
|
|
7884
|
+
open: appSearchOpen,
|
|
7885
|
+
onClose: () => setAppSearchOpen(false),
|
|
7886
|
+
title: appPickerTitle,
|
|
7887
|
+
subtitle: appPickerSubtitle,
|
|
7888
|
+
onQuickSelect: (app) => {
|
|
7889
|
+
const known = availableApps.find((a) => a.name?.toLowerCase() === app.name?.toLowerCase());
|
|
7890
|
+
setChosenApps(
|
|
7891
|
+
(prev) => prev.some((a) => a.name === app.name) ? prev : [...prev, { name: app.name, icon: app.icon || known?.icon, id: app.id || known?.id || void 0 }]
|
|
7892
|
+
);
|
|
7036
7893
|
}
|
|
7037
|
-
|
|
7038
|
-
|
|
7039
|
-
|
|
7894
|
+
}
|
|
7895
|
+
)
|
|
7896
|
+
]
|
|
7897
|
+
}
|
|
7898
|
+
)
|
|
7899
|
+
}
|
|
7900
|
+
);
|
|
7901
|
+
};
|
|
7902
|
+
var AgentUI_default = AgentUI;
|
|
7903
|
+
|
|
7904
|
+
// AgentRunDrawer.tsx
|
|
7905
|
+
import { useEffect as useEffect9, useRef as useRef7, useState as useState11 } from "react";
|
|
7906
|
+
import {
|
|
7907
|
+
Box as Box12,
|
|
7908
|
+
Drawer as Drawer3,
|
|
7909
|
+
IconButton as IconButton7,
|
|
7910
|
+
Tab,
|
|
7911
|
+
Tabs,
|
|
7912
|
+
Tooltip as Tooltip7,
|
|
7913
|
+
Typography as Typography12
|
|
7914
|
+
} from "@mui/material";
|
|
7915
|
+
import CloseIcon5 from "@mui/icons-material/Close";
|
|
7916
|
+
import { Play, Server, ShieldCheck } from "lucide-react";
|
|
7917
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
7918
|
+
var TAB_ORDER = ["run", "permissions", "localLLM"];
|
|
7919
|
+
var AgentRunDrawer = ({
|
|
7920
|
+
open,
|
|
7921
|
+
onClose,
|
|
7922
|
+
initialTab = "run",
|
|
7923
|
+
permissionsSlot,
|
|
7924
|
+
localLLMSlot,
|
|
7925
|
+
localLLMTabBadge,
|
|
7926
|
+
permissionsDisabled = false,
|
|
7927
|
+
permissionsDisabledTooltip = "Coming soon",
|
|
7928
|
+
agentUIProps,
|
|
7929
|
+
width = 520,
|
|
7930
|
+
title = "Agent",
|
|
7931
|
+
subtitle = "Run actions and manage permissions",
|
|
7932
|
+
className,
|
|
7933
|
+
paperSx,
|
|
7934
|
+
headerSx,
|
|
7935
|
+
tabsSx,
|
|
7936
|
+
bodySx
|
|
7937
|
+
}) => {
|
|
7938
|
+
const [activeTab, setActiveTab] = useState11(initialTab);
|
|
7939
|
+
const prevOpenRef = useRef7(open);
|
|
7940
|
+
useEffect9(() => {
|
|
7941
|
+
if (open && !prevOpenRef.current) setActiveTab(initialTab);
|
|
7942
|
+
prevOpenRef.current = open;
|
|
7943
|
+
}, [open, initialTab]);
|
|
7944
|
+
const visibleTabs = TAB_ORDER.filter((t) => {
|
|
7945
|
+
if (t === "run") return true;
|
|
7946
|
+
if (t === "permissions") return !!permissionsSlot;
|
|
7947
|
+
if (t === "localLLM") return !!localLLMSlot;
|
|
7948
|
+
return false;
|
|
7949
|
+
});
|
|
7950
|
+
const showTabs = visibleTabs.length > 1;
|
|
7951
|
+
const safeActiveTab = visibleTabs.includes(activeTab) ? activeTab : "run";
|
|
7952
|
+
return /* @__PURE__ */ jsxs13(
|
|
7953
|
+
Drawer3,
|
|
7954
|
+
{
|
|
7955
|
+
anchor: "right",
|
|
7956
|
+
open,
|
|
7957
|
+
onClose,
|
|
7958
|
+
slotProps: {
|
|
7959
|
+
paper: {
|
|
7960
|
+
className,
|
|
7961
|
+
sx: [
|
|
7962
|
+
{
|
|
7963
|
+
width: { xs: "100%", sm: width },
|
|
7964
|
+
background: "linear-gradient(180deg, hsl(var(--card)) 0%, hsl(var(--background)) 100%)",
|
|
7965
|
+
borderLeft: "1px solid hsl(var(--border))",
|
|
7966
|
+
boxShadow: "-8px 0 32px hsla(0, 0%, 0%, 0.4)",
|
|
7967
|
+
display: "flex",
|
|
7968
|
+
flexDirection: "column"
|
|
7969
|
+
},
|
|
7970
|
+
...Array.isArray(paperSx) ? paperSx : paperSx ? [paperSx] : []
|
|
7971
|
+
]
|
|
7972
|
+
}
|
|
7973
|
+
},
|
|
7974
|
+
children: [
|
|
7975
|
+
/* @__PURE__ */ jsxs13(
|
|
7976
|
+
Box12,
|
|
7977
|
+
{
|
|
7978
|
+
sx: [
|
|
7979
|
+
{
|
|
7980
|
+
px: 3,
|
|
7981
|
+
py: 2.5,
|
|
7982
|
+
display: "flex",
|
|
7983
|
+
alignItems: "center",
|
|
7984
|
+
gap: 2,
|
|
7985
|
+
borderBottom: "1px solid hsl(var(--border))",
|
|
7986
|
+
flexShrink: 0
|
|
7987
|
+
},
|
|
7988
|
+
...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
|
|
7989
|
+
],
|
|
7990
|
+
children: [
|
|
7991
|
+
/* @__PURE__ */ jsx15(
|
|
7992
|
+
Box12,
|
|
7040
7993
|
{
|
|
7041
|
-
type: "submit",
|
|
7042
|
-
disabled: actionInput.trim().length < 3 || agentRequestLoading,
|
|
7043
7994
|
sx: {
|
|
7044
|
-
width:
|
|
7045
|
-
height:
|
|
7046
|
-
|
|
7047
|
-
|
|
7048
|
-
|
|
7049
|
-
|
|
7995
|
+
width: 40,
|
|
7996
|
+
height: 40,
|
|
7997
|
+
borderRadius: "50%",
|
|
7998
|
+
display: "flex",
|
|
7999
|
+
alignItems: "center",
|
|
8000
|
+
justifyContent: "center",
|
|
8001
|
+
background: "hsla(var(--primary) / 0.12)",
|
|
8002
|
+
color: "hsl(var(--primary))",
|
|
8003
|
+
flexShrink: 0
|
|
7050
8004
|
},
|
|
7051
|
-
children:
|
|
8005
|
+
children: /* @__PURE__ */ jsx15(AgentIcon_default, { size: 22 })
|
|
7052
8006
|
}
|
|
7053
|
-
)
|
|
7054
|
-
|
|
7055
|
-
|
|
7056
|
-
|
|
7057
|
-
|
|
7058
|
-
|
|
7059
|
-
|
|
7060
|
-
|
|
7061
|
-
|
|
7062
|
-
|
|
7063
|
-
|
|
7064
|
-
|
|
7065
|
-
|
|
7066
|
-
|
|
7067
|
-
|
|
7068
|
-
Box11,
|
|
8007
|
+
),
|
|
8008
|
+
/* @__PURE__ */ jsxs13(Box12, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
8009
|
+
/* @__PURE__ */ jsx15(Typography12, { sx: { fontWeight: 600, fontSize: "1.1rem", color: "hsl(var(--foreground))" }, children: title }),
|
|
8010
|
+
/* @__PURE__ */ jsx15(Typography12, { sx: { fontSize: "0.8rem", color: "hsl(var(--muted-foreground))" }, children: subtitle })
|
|
8011
|
+
] }),
|
|
8012
|
+
/* @__PURE__ */ jsx15(IconButton7, { onClick: onClose, size: "small", sx: { color: "hsl(var(--muted-foreground))" }, children: /* @__PURE__ */ jsx15(CloseIcon5, { fontSize: "small" }) })
|
|
8013
|
+
]
|
|
8014
|
+
}
|
|
8015
|
+
),
|
|
8016
|
+
showTabs && /* @__PURE__ */ jsx15(Box12, { sx: { borderBottom: "1px solid hsl(var(--border))", flexShrink: 0 }, children: /* @__PURE__ */ jsxs13(
|
|
8017
|
+
Tabs,
|
|
8018
|
+
{
|
|
8019
|
+
value: safeActiveTab,
|
|
8020
|
+
onChange: (_, v) => setActiveTab(v),
|
|
8021
|
+
sx: [
|
|
7069
8022
|
{
|
|
7070
|
-
|
|
7071
|
-
|
|
7072
|
-
|
|
7073
|
-
|
|
7074
|
-
|
|
7075
|
-
|
|
7076
|
-
display: "inline-flex",
|
|
7077
|
-
alignItems: "center",
|
|
7078
|
-
gap: 0.5,
|
|
7079
|
-
px: 1.5,
|
|
7080
|
-
py: 0.5,
|
|
7081
|
-
borderRadius: 999,
|
|
7082
|
-
fontSize: "0.8rem",
|
|
8023
|
+
minHeight: 42,
|
|
8024
|
+
px: 3,
|
|
8025
|
+
"& .MuiTab-root": {
|
|
8026
|
+
minHeight: 42,
|
|
8027
|
+
textTransform: "none",
|
|
8028
|
+
fontSize: "0.85rem",
|
|
7083
8029
|
fontWeight: 500,
|
|
7084
8030
|
color: "hsl(var(--muted-foreground))",
|
|
7085
|
-
|
|
7086
|
-
transition: "color 0.12s ease, background-color 0.12s ease",
|
|
7087
|
-
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted) / 0.5)" }
|
|
8031
|
+
"&.Mui-selected": { color: "hsl(var(--primary))" }
|
|
7088
8032
|
},
|
|
7089
|
-
|
|
7090
|
-
/* @__PURE__ */ jsx14(AddIcon2, { sx: { fontSize: 14 } }),
|
|
7091
|
-
appPickerLabel
|
|
7092
|
-
]
|
|
7093
|
-
}
|
|
7094
|
-
),
|
|
7095
|
-
chosenApps.map((app, i) => /* @__PURE__ */ jsxs12(
|
|
7096
|
-
Box11,
|
|
7097
|
-
{
|
|
7098
|
-
sx: {
|
|
7099
|
-
display: "inline-flex",
|
|
7100
|
-
alignItems: "center",
|
|
7101
|
-
gap: 0.5,
|
|
7102
|
-
pl: 0.5,
|
|
7103
|
-
pr: 0.75,
|
|
7104
|
-
py: 0.25,
|
|
7105
|
-
borderRadius: 999,
|
|
7106
|
-
bgcolor: "hsl(var(--muted) / 0.6)",
|
|
7107
|
-
fontSize: "0.8rem",
|
|
7108
|
-
color: "hsl(var(--foreground))"
|
|
7109
|
-
},
|
|
7110
|
-
children: [
|
|
7111
|
-
/* @__PURE__ */ jsx14(
|
|
7112
|
-
Avatar6,
|
|
7113
|
-
{
|
|
7114
|
-
src: app.icon || void 0,
|
|
7115
|
-
alt: app.name,
|
|
7116
|
-
variant: "rounded",
|
|
7117
|
-
sx: { width: 18, height: 18, bgcolor: "transparent" }
|
|
7118
|
-
}
|
|
7119
|
-
),
|
|
7120
|
-
/* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.8rem", mx: 0.25, textTransform: "capitalize" }, children: app.name.replace(/_/g, " ") }),
|
|
7121
|
-
/* @__PURE__ */ jsx14(
|
|
7122
|
-
IconButton6,
|
|
7123
|
-
{
|
|
7124
|
-
size: "small",
|
|
7125
|
-
onClick: () => setChosenApps((prev) => prev.filter((_, idx) => idx !== i)),
|
|
7126
|
-
sx: { p: 0.125, color: "hsl(var(--muted-foreground))", "&:hover": { color: "hsl(var(--destructive))" } },
|
|
7127
|
-
children: /* @__PURE__ */ jsx14(CloseIcon4, { sx: { fontSize: 12 } })
|
|
7128
|
-
}
|
|
7129
|
-
)
|
|
7130
|
-
]
|
|
8033
|
+
"& .MuiTabs-indicator": { bgcolor: "hsl(var(--primary))" }
|
|
7131
8034
|
},
|
|
7132
|
-
|
|
7133
|
-
|
|
7134
|
-
|
|
7135
|
-
|
|
7136
|
-
|
|
7137
|
-
|
|
7138
|
-
|
|
7139
|
-
|
|
7140
|
-
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
8035
|
+
...Array.isArray(tabsSx) ? tabsSx : tabsSx ? [tabsSx] : []
|
|
8036
|
+
],
|
|
8037
|
+
children: [
|
|
8038
|
+
visibleTabs.includes("run") && /* @__PURE__ */ jsx15(
|
|
8039
|
+
Tab,
|
|
8040
|
+
{
|
|
8041
|
+
value: "run",
|
|
8042
|
+
label: "Run",
|
|
8043
|
+
icon: /* @__PURE__ */ jsx15(Play, { size: 14 }),
|
|
8044
|
+
iconPosition: "start",
|
|
8045
|
+
sx: { gap: 0.75 }
|
|
8046
|
+
}
|
|
8047
|
+
),
|
|
8048
|
+
visibleTabs.includes("permissions") && /* @__PURE__ */ jsx15(
|
|
8049
|
+
Tab,
|
|
8050
|
+
{
|
|
8051
|
+
value: "permissions",
|
|
8052
|
+
label: permissionsDisabled ? /* @__PURE__ */ jsx15(Tooltip7, { title: permissionsDisabledTooltip, arrow: true, children: /* @__PURE__ */ jsx15(Box12, { component: "span", sx: { display: "inline-flex", alignItems: "center" }, children: "Permissions" }) }) : "Permissions",
|
|
8053
|
+
icon: /* @__PURE__ */ jsx15(ShieldCheck, { size: 14 }),
|
|
8054
|
+
iconPosition: "start",
|
|
8055
|
+
disabled: permissionsDisabled,
|
|
8056
|
+
sx: { gap: 0.75 }
|
|
8057
|
+
}
|
|
8058
|
+
),
|
|
8059
|
+
visibleTabs.includes("localLLM") && /* @__PURE__ */ jsx15(
|
|
8060
|
+
Tab,
|
|
8061
|
+
{
|
|
8062
|
+
value: "localLLM",
|
|
8063
|
+
label: /* @__PURE__ */ jsxs13(Box12, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
8064
|
+
"Local LLM",
|
|
8065
|
+
localLLMTabBadge
|
|
8066
|
+
] }),
|
|
8067
|
+
icon: /* @__PURE__ */ jsx15(Server, { size: 14 }),
|
|
8068
|
+
iconPosition: "start",
|
|
8069
|
+
sx: { gap: 0.75 }
|
|
8070
|
+
}
|
|
8071
|
+
)
|
|
8072
|
+
]
|
|
8073
|
+
}
|
|
8074
|
+
) }),
|
|
8075
|
+
/* @__PURE__ */ jsxs13(Box12, { sx: [{ flex: 1, overflowY: "auto" }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: [
|
|
8076
|
+
safeActiveTab === "run" && /* @__PURE__ */ jsx15(Box12, { sx: { px: 2, py: 2 }, children: /* @__PURE__ */ jsx15(
|
|
8077
|
+
AgentUI_default,
|
|
8078
|
+
{
|
|
8079
|
+
compact: true,
|
|
8080
|
+
hideHeroIcon: true,
|
|
8081
|
+
title: "",
|
|
8082
|
+
subtitle: null,
|
|
8083
|
+
...agentUIProps
|
|
8084
|
+
}
|
|
8085
|
+
) }),
|
|
8086
|
+
safeActiveTab === "permissions" && permissionsSlot && /* @__PURE__ */ jsx15(Box12, { sx: { px: 3, py: 2.5 }, children: permissionsSlot }),
|
|
8087
|
+
safeActiveTab === "localLLM" && localLLMSlot && /* @__PURE__ */ jsx15(Box12, { sx: { px: 3, py: 2.5 }, children: localLLMSlot })
|
|
8088
|
+
] })
|
|
8089
|
+
]
|
|
8090
|
+
}
|
|
8091
|
+
);
|
|
8092
|
+
};
|
|
8093
|
+
var AgentRunDrawer_default = AgentRunDrawer;
|
|
8094
|
+
|
|
8095
|
+
// AgentActivityList.tsx
|
|
8096
|
+
import { useCallback as useCallback9, useEffect as useEffect10, useRef as useRef8, useState as useState12 } from "react";
|
|
8097
|
+
import {
|
|
8098
|
+
Box as Box13,
|
|
8099
|
+
Button as Button6,
|
|
8100
|
+
Chip as Chip8,
|
|
8101
|
+
CircularProgress as CircularProgress5,
|
|
8102
|
+
InputAdornment,
|
|
8103
|
+
TextField as TextField5,
|
|
8104
|
+
Typography as Typography13
|
|
8105
|
+
} from "@mui/material";
|
|
8106
|
+
import SearchIcon from "@mui/icons-material/Search";
|
|
8107
|
+
import {
|
|
8108
|
+
Activity,
|
|
8109
|
+
AlertCircle,
|
|
8110
|
+
CheckCircle,
|
|
8111
|
+
Clock,
|
|
8112
|
+
FileText,
|
|
8113
|
+
Globe,
|
|
8114
|
+
Loader2,
|
|
8115
|
+
Server as Server2,
|
|
8116
|
+
XCircle,
|
|
8117
|
+
Zap
|
|
8118
|
+
} from "lucide-react";
|
|
8119
|
+
|
|
8120
|
+
// agentActivity.ts
|
|
8121
|
+
var resolveUrl = (path, baseUrl) => baseUrl ? `${baseUrl.replace(/\/+$/, "")}${path}` : getApiUrl(path);
|
|
8122
|
+
var resolveHeaders = (apiKey, orgId) => {
|
|
8123
|
+
const h = apiKey ? { Authorization: `Bearer ${apiKey}` } : { ...getAuthHeader() };
|
|
8124
|
+
if (orgId) h["Org-Id"] = orgId;
|
|
8125
|
+
return h;
|
|
8126
|
+
};
|
|
8127
|
+
var searchAgentActivity = async (params = {}) => {
|
|
8128
|
+
const {
|
|
8129
|
+
cursor = "",
|
|
8130
|
+
limit = 50,
|
|
8131
|
+
status = "",
|
|
8132
|
+
startTime = "",
|
|
8133
|
+
endTime = "",
|
|
8134
|
+
suborgRuns = false,
|
|
8135
|
+
apiKey,
|
|
8136
|
+
apiBaseUrl,
|
|
8137
|
+
orgId
|
|
8138
|
+
} = params;
|
|
8139
|
+
const payload = {
|
|
8140
|
+
workflow_id: "AGENT",
|
|
8141
|
+
cursor,
|
|
8142
|
+
limit,
|
|
8143
|
+
status,
|
|
8144
|
+
start_time: startTime,
|
|
8145
|
+
end_time: endTime,
|
|
8146
|
+
suborg_runs: suborgRuns
|
|
8147
|
+
};
|
|
8148
|
+
const response = await fetch(resolveUrl("/api/v1/workflows/search", apiBaseUrl), {
|
|
8149
|
+
method: "POST",
|
|
8150
|
+
credentials: "include",
|
|
8151
|
+
headers: {
|
|
8152
|
+
"Content-Type": "application/json",
|
|
8153
|
+
...resolveHeaders(apiKey, orgId)
|
|
8154
|
+
},
|
|
8155
|
+
body: JSON.stringify(payload)
|
|
8156
|
+
});
|
|
8157
|
+
if (!response.ok) {
|
|
8158
|
+
throw new Error(`Failed to fetch agent activity: ${response.statusText}`);
|
|
8159
|
+
}
|
|
8160
|
+
const data = await response.json();
|
|
8161
|
+
return {
|
|
8162
|
+
success: data.success ?? false,
|
|
8163
|
+
runs: data.runs || [],
|
|
8164
|
+
cursor: data.cursor || ""
|
|
8165
|
+
};
|
|
8166
|
+
};
|
|
8167
|
+
|
|
8168
|
+
// AgentActivityList.tsx
|
|
8169
|
+
import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
8170
|
+
var STATUS_CONFIG = {
|
|
8171
|
+
FINISHED: { icon: /* @__PURE__ */ jsx16(CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
|
|
8172
|
+
SUCCESS: { icon: /* @__PURE__ */ jsx16(CheckCircle, { size: 16 }), color: "hsl(var(--severity-low, 142 71% 45%))", label: "Completed" },
|
|
8173
|
+
FAILED: { icon: /* @__PURE__ */ jsx16(XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Failed" },
|
|
8174
|
+
ABORTED: { icon: /* @__PURE__ */ jsx16(XCircle, { size: 16 }), color: "hsl(var(--severity-critical, 0 72% 55%))", label: "Aborted" },
|
|
8175
|
+
EXECUTING: { icon: /* @__PURE__ */ jsx16(Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
|
|
8176
|
+
RUNNING: { icon: /* @__PURE__ */ jsx16(Loader2, { size: 16 }), color: "hsl(var(--severity-medium, 38 92% 50%))", label: "Running" },
|
|
8177
|
+
WAITING: { icon: /* @__PURE__ */ jsx16(Clock, { size: 16 }), color: "hsl(var(--severity-info, 217 91% 60%))", label: "Waiting" }
|
|
8178
|
+
};
|
|
8179
|
+
var getRunIcon = (run) => {
|
|
8180
|
+
const src = (run.execution_source || "").toLowerCase();
|
|
8181
|
+
const arg = (run.execution_argument || "").toLowerCase();
|
|
8182
|
+
if (src.includes("schedule") || src.includes("cron")) return /* @__PURE__ */ jsx16(Clock, { size: 18 });
|
|
8183
|
+
if (src.includes("webhook") || src.includes("http")) return /* @__PURE__ */ jsx16(Globe, { size: 18 });
|
|
8184
|
+
if (arg.includes("alert") || arg.includes("detect")) return /* @__PURE__ */ jsx16(Activity, { size: 18 });
|
|
8185
|
+
if (arg.includes("report") || arg.includes("email")) return /* @__PURE__ */ jsx16(FileText, { size: 18 });
|
|
8186
|
+
if (arg.includes("endpoint") || arg.includes("server")) return /* @__PURE__ */ jsx16(Server2, { size: 18 });
|
|
8187
|
+
return /* @__PURE__ */ jsx16(Zap, { size: 18 });
|
|
8188
|
+
};
|
|
8189
|
+
var getRunIconColor = (run) => {
|
|
8190
|
+
const status = (run.status || "").toUpperCase();
|
|
8191
|
+
if (status === "FINISHED" || status === "SUCCESS") return "hsl(var(--severity-low, 142 71% 45%))";
|
|
8192
|
+
if (status === "FAILED" || status === "ABORTED") return "hsl(var(--severity-critical, 0 72% 55%))";
|
|
8193
|
+
if (status === "EXECUTING" || status === "RUNNING") return "hsl(var(--severity-medium, 38 92% 50%))";
|
|
8194
|
+
return "hsl(var(--primary, 24 100% 50%))";
|
|
8195
|
+
};
|
|
8196
|
+
var formatDuration = (run) => {
|
|
8197
|
+
if (run.started_at && run.completed_at) {
|
|
8198
|
+
const startSec = Number(run.started_at);
|
|
8199
|
+
const endSec = Number(run.completed_at);
|
|
8200
|
+
if (!isNaN(startSec) && !isNaN(endSec)) {
|
|
8201
|
+
const ms = (endSec - startSec) * 1e3;
|
|
8202
|
+
if (ms < 1e3) return `${Math.round(ms)}ms`;
|
|
8203
|
+
if (ms < 6e4) return `${(ms / 1e3).toFixed(1)}s`;
|
|
8204
|
+
return `${Math.floor(ms / 6e4)}m ${Math.floor(ms % 6e4 / 1e3)}s`;
|
|
8205
|
+
}
|
|
8206
|
+
}
|
|
8207
|
+
if (run.duration) return `${run.duration.toFixed(1)}s`;
|
|
8208
|
+
return "";
|
|
8209
|
+
};
|
|
8210
|
+
var getTimeAgo = (dateStr) => {
|
|
8211
|
+
try {
|
|
8212
|
+
const ts = isNaN(Number(dateStr)) ? new Date(dateStr).getTime() : Number(dateStr) * 1e3;
|
|
8213
|
+
if (isNaN(ts)) return dateStr;
|
|
8214
|
+
const diffSec = Math.max(0, Math.floor((Date.now() - ts) / 1e3));
|
|
8215
|
+
if (diffSec < 60) return `${diffSec}s ago`;
|
|
8216
|
+
if (diffSec < 3600) return `${Math.floor(diffSec / 60)}m ago`;
|
|
8217
|
+
if (diffSec < 86400) return `${Math.floor(diffSec / 3600)}h ago`;
|
|
8218
|
+
return `${Math.floor(diffSec / 86400)}d ago`;
|
|
8219
|
+
} catch {
|
|
8220
|
+
return dateStr;
|
|
8221
|
+
}
|
|
8222
|
+
};
|
|
8223
|
+
var getRunTitle = (run) => {
|
|
8224
|
+
if (run.workflow?.name) return run.workflow.name;
|
|
8225
|
+
if (run.execution_argument) {
|
|
8226
|
+
try {
|
|
8227
|
+
const parsed = JSON.parse(run.execution_argument);
|
|
8228
|
+
if (parsed.title) return parsed.title;
|
|
8229
|
+
if (parsed.action) return parsed.action;
|
|
8230
|
+
if (parsed.name) return parsed.name;
|
|
8231
|
+
} catch {
|
|
8232
|
+
const clean = run.execution_argument.replace(/[{}"]/g, "").trim();
|
|
8233
|
+
if (clean.length > 0 && clean.length < 80) return clean;
|
|
8234
|
+
}
|
|
8235
|
+
}
|
|
8236
|
+
return `Execution ${run.execution_id?.slice(0, 8) || "\u2014"}`;
|
|
8237
|
+
};
|
|
8238
|
+
var getRunSubtitle = (run) => {
|
|
8239
|
+
if (run.result) {
|
|
8240
|
+
try {
|
|
8241
|
+
const p = JSON.parse(run.result);
|
|
8242
|
+
if (p.output && typeof p.output === "string") {
|
|
8243
|
+
return p.output.length > 120 ? p.output.slice(0, 120) + "\u2026" : p.output;
|
|
7145
8244
|
}
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
|
|
7149
|
-
|
|
7150
|
-
|
|
7151
|
-
|
|
7152
|
-
|
|
7153
|
-
|
|
7154
|
-
|
|
7155
|
-
|
|
7156
|
-
|
|
7157
|
-
|
|
7158
|
-
|
|
7159
|
-
|
|
7160
|
-
|
|
7161
|
-
|
|
7162
|
-
|
|
7163
|
-
|
|
7164
|
-
|
|
7165
|
-
|
|
7166
|
-
|
|
7167
|
-
|
|
8245
|
+
if (p.original_input && typeof p.original_input === "string") {
|
|
8246
|
+
return p.original_input.length > 120 ? p.original_input.slice(0, 120) + "\u2026" : p.original_input;
|
|
8247
|
+
}
|
|
8248
|
+
if (p.message && typeof p.message === "string") return p.message;
|
|
8249
|
+
} catch {
|
|
8250
|
+
if (run.result.length < 120) return run.result;
|
|
8251
|
+
}
|
|
8252
|
+
}
|
|
8253
|
+
return run.execution_source || "Agent execution";
|
|
8254
|
+
};
|
|
8255
|
+
var AgentRunRow = ({ run, onClick, sx }) => {
|
|
8256
|
+
const statusKey = (run.status || "").toUpperCase();
|
|
8257
|
+
const cfg = STATUS_CONFIG[statusKey] || STATUS_CONFIG.WAITING;
|
|
8258
|
+
const iconColor = getRunIconColor(run);
|
|
8259
|
+
const duration = formatDuration(run);
|
|
8260
|
+
return /* @__PURE__ */ jsxs14(
|
|
8261
|
+
Box13,
|
|
8262
|
+
{
|
|
8263
|
+
onClick,
|
|
8264
|
+
sx: [
|
|
8265
|
+
{
|
|
8266
|
+
borderRadius: 2,
|
|
8267
|
+
border: "1px solid hsl(var(--border))",
|
|
8268
|
+
bgcolor: "hsl(var(--card))",
|
|
8269
|
+
display: "flex",
|
|
8270
|
+
alignItems: "center",
|
|
8271
|
+
gap: 2,
|
|
8272
|
+
px: 2.5,
|
|
8273
|
+
py: 2,
|
|
8274
|
+
cursor: "pointer",
|
|
8275
|
+
transition: "background 0.15s ease, border-color 0.15s ease",
|
|
8276
|
+
"&:hover": {
|
|
8277
|
+
bgcolor: "hsla(var(--muted) / 0.5)",
|
|
8278
|
+
borderColor: "hsl(var(--muted-foreground) / 0.3)"
|
|
8279
|
+
}
|
|
8280
|
+
},
|
|
8281
|
+
...Array.isArray(sx) ? sx : sx ? [sx] : []
|
|
8282
|
+
],
|
|
8283
|
+
children: [
|
|
8284
|
+
/* @__PURE__ */ jsx16(
|
|
8285
|
+
Box13,
|
|
7168
8286
|
{
|
|
7169
|
-
src: app.icon || void 0,
|
|
7170
|
-
alt: app.name,
|
|
7171
|
-
variant: "rounded",
|
|
7172
|
-
onClick: () => navigate(`/apps/${encodeURIComponent(app.name.toLowerCase().replace(/\s+/g, "_"))}`),
|
|
7173
8287
|
sx: {
|
|
7174
|
-
|
|
7175
|
-
|
|
7176
|
-
|
|
7177
|
-
|
|
7178
|
-
|
|
8288
|
+
width: 40,
|
|
8289
|
+
height: 40,
|
|
8290
|
+
borderRadius: "50%",
|
|
8291
|
+
display: "flex",
|
|
8292
|
+
alignItems: "center",
|
|
8293
|
+
justifyContent: "center",
|
|
8294
|
+
bgcolor: `${iconColor}15`,
|
|
8295
|
+
color: iconColor,
|
|
8296
|
+
flexShrink: 0
|
|
8297
|
+
},
|
|
8298
|
+
children: getRunIcon(run)
|
|
7179
8299
|
}
|
|
7180
|
-
)
|
|
7181
|
-
|
|
7182
|
-
|
|
7183
|
-
|
|
7184
|
-
|
|
7185
|
-
|
|
7186
|
-
|
|
7187
|
-
|
|
7188
|
-
|
|
7189
|
-
|
|
7190
|
-
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7194
|
-
|
|
7195
|
-
|
|
7196
|
-
|
|
7197
|
-
|
|
7198
|
-
|
|
7199
|
-
|
|
7200
|
-
|
|
7201
|
-
|
|
7202
|
-
|
|
7203
|
-
|
|
7204
|
-
|
|
7205
|
-
|
|
7206
|
-
|
|
7207
|
-
|
|
7208
|
-
|
|
7209
|
-
|
|
7210
|
-
durationSec = Math.round(totalDuration);
|
|
7211
|
-
}
|
|
7212
|
-
const pendingAsk = (agentData?.decisions || []).slice().reverse().find((d) => {
|
|
7213
|
-
const isAsk = d.category === "ask" || d.action === "ask";
|
|
7214
|
-
const st = (d.run_details?.status || "").toUpperCase();
|
|
7215
|
-
return isAsk && (st === "RUNNING" || st === "WAITING");
|
|
7216
|
-
});
|
|
7217
|
-
const pendingQuestions = [];
|
|
7218
|
-
if (pendingAsk) {
|
|
7219
|
-
for (const f of pendingAsk.fields || []) {
|
|
7220
|
-
if (f.key === "question" && f.value) {
|
|
7221
|
-
pendingQuestions.push({ question: f.value, index: pendingQuestions.length + 1 });
|
|
8300
|
+
),
|
|
8301
|
+
/* @__PURE__ */ jsxs14(Box13, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
8302
|
+
/* @__PURE__ */ jsxs14(Box13, { sx: { display: "flex", alignItems: "center", gap: 1, mb: 0.25 }, children: [
|
|
8303
|
+
/* @__PURE__ */ jsx16(
|
|
8304
|
+
Typography13,
|
|
8305
|
+
{
|
|
8306
|
+
sx: {
|
|
8307
|
+
fontSize: "0.9rem",
|
|
8308
|
+
fontWeight: 500,
|
|
8309
|
+
color: "hsl(var(--foreground))",
|
|
8310
|
+
overflow: "hidden",
|
|
8311
|
+
textOverflow: "ellipsis",
|
|
8312
|
+
whiteSpace: "nowrap"
|
|
8313
|
+
},
|
|
8314
|
+
children: getRunTitle(run)
|
|
8315
|
+
}
|
|
8316
|
+
),
|
|
8317
|
+
/* @__PURE__ */ jsx16(Box13, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
|
|
8318
|
+
] }),
|
|
8319
|
+
/* @__PURE__ */ jsx16(
|
|
8320
|
+
Typography13,
|
|
8321
|
+
{
|
|
8322
|
+
sx: {
|
|
8323
|
+
fontSize: "0.78rem",
|
|
8324
|
+
color: "hsl(var(--muted-foreground))",
|
|
8325
|
+
overflow: "hidden",
|
|
8326
|
+
textOverflow: "ellipsis",
|
|
8327
|
+
whiteSpace: "nowrap"
|
|
8328
|
+
},
|
|
8329
|
+
children: getRunSubtitle(run)
|
|
7222
8330
|
}
|
|
7223
|
-
|
|
7224
|
-
|
|
7225
|
-
|
|
7226
|
-
|
|
7227
|
-
|
|
7228
|
-
|
|
7229
|
-
/* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.9rem", fontWeight: 600, color: "hsl(var(--foreground))" }, children: isRunning ? "Agent is working\u2026" : status === "FINISHED" ? "Run finished" : `Run ${status.toLowerCase()}` }),
|
|
7230
|
-
/* @__PURE__ */ jsxs12(Typography11, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))" }, children: [
|
|
7231
|
-
decisionCount,
|
|
7232
|
-
" step",
|
|
7233
|
-
decisionCount === 1 ? "" : "s",
|
|
7234
|
-
durationSec != null ? ` \xB7 ${durationSec}s` : ""
|
|
8331
|
+
),
|
|
8332
|
+
/* @__PURE__ */ jsxs14(Box13, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.5 }, children: [
|
|
8333
|
+
/* @__PURE__ */ jsx16(Typography13, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: run.started_at ? getTimeAgo(run.started_at) : "\u2014" }),
|
|
8334
|
+
duration && /* @__PURE__ */ jsxs14(Fragment8, { children: [
|
|
8335
|
+
/* @__PURE__ */ jsx16(Typography13, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
8336
|
+
/* @__PURE__ */ jsx16(Typography13, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.7 }, children: duration })
|
|
7235
8337
|
] })
|
|
7236
|
-
] })
|
|
7237
|
-
|
|
7238
|
-
|
|
7239
|
-
|
|
7240
|
-
|
|
7241
|
-
|
|
7242
|
-
|
|
7243
|
-
|
|
7244
|
-
|
|
7245
|
-
|
|
7246
|
-
|
|
7247
|
-
|
|
7248
|
-
|
|
7249
|
-
|
|
7250
|
-
|
|
7251
|
-
|
|
7252
|
-
|
|
7253
|
-
|
|
7254
|
-
|
|
7255
|
-
|
|
7256
|
-
|
|
7257
|
-
|
|
7258
|
-
|
|
7259
|
-
|
|
7260
|
-
|
|
7261
|
-
|
|
7262
|
-
|
|
7263
|
-
|
|
7264
|
-
|
|
7265
|
-
|
|
7266
|
-
|
|
7267
|
-
|
|
7268
|
-
|
|
7269
|
-
|
|
7270
|
-
|
|
7271
|
-
|
|
7272
|
-
|
|
7273
|
-
|
|
7274
|
-
|
|
7275
|
-
|
|
7276
|
-
|
|
7277
|
-
|
|
7278
|
-
|
|
7279
|
-
|
|
7280
|
-
|
|
7281
|
-
|
|
7282
|
-
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
8338
|
+
] })
|
|
8339
|
+
] })
|
|
8340
|
+
]
|
|
8341
|
+
}
|
|
8342
|
+
);
|
|
8343
|
+
};
|
|
8344
|
+
var STATUS_FILTERS = [
|
|
8345
|
+
{ label: "All", value: "" },
|
|
8346
|
+
{ label: "Completed", value: "FINISHED" },
|
|
8347
|
+
{ label: "Running", value: "EXECUTING" },
|
|
8348
|
+
{ label: "Failed", value: "ABORTED" }
|
|
8349
|
+
];
|
|
8350
|
+
var AgentActivityList = ({
|
|
8351
|
+
apiKey,
|
|
8352
|
+
apiBaseUrl,
|
|
8353
|
+
orgId,
|
|
8354
|
+
onRunClick,
|
|
8355
|
+
showSearchBar = true,
|
|
8356
|
+
showStatusChips = true,
|
|
8357
|
+
limit = 50,
|
|
8358
|
+
emptyTitle = "No agent activity found",
|
|
8359
|
+
emptySubtitle = "The agent has not performed any actions yet",
|
|
8360
|
+
className,
|
|
8361
|
+
sx,
|
|
8362
|
+
toolbarSx,
|
|
8363
|
+
rowSx
|
|
8364
|
+
}) => {
|
|
8365
|
+
const [runs, setRuns] = useState12([]);
|
|
8366
|
+
const [cursor, setCursor] = useState12("");
|
|
8367
|
+
const [hasMore, setHasMore] = useState12(false);
|
|
8368
|
+
const [isLoading, setIsLoading] = useState12(false);
|
|
8369
|
+
const [error, setError] = useState12(null);
|
|
8370
|
+
const [statusFilter, setStatusFilter] = useState12("");
|
|
8371
|
+
const [searchQuery, setSearchQuery] = useState12("");
|
|
8372
|
+
const [debouncedQuery, setDebouncedQuery] = useState12("");
|
|
8373
|
+
const debounceRef = useRef8();
|
|
8374
|
+
const updateSearchQuery = useCallback9((q) => {
|
|
8375
|
+
setSearchQuery(q);
|
|
8376
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
8377
|
+
debounceRef.current = setTimeout(() => setDebouncedQuery(q), 350);
|
|
8378
|
+
}, []);
|
|
8379
|
+
useEffect10(() => () => {
|
|
8380
|
+
if (debounceRef.current) clearTimeout(debounceRef.current);
|
|
8381
|
+
}, []);
|
|
8382
|
+
const fetchRuns = useCallback9(
|
|
8383
|
+
async (append = false, cursorParam = "") => {
|
|
8384
|
+
setIsLoading(true);
|
|
8385
|
+
setError(null);
|
|
8386
|
+
try {
|
|
8387
|
+
const result = await searchAgentActivity({
|
|
8388
|
+
limit,
|
|
8389
|
+
status: statusFilter,
|
|
8390
|
+
cursor: cursorParam,
|
|
8391
|
+
apiKey,
|
|
8392
|
+
apiBaseUrl,
|
|
8393
|
+
orgId
|
|
8394
|
+
});
|
|
8395
|
+
if (result.success) {
|
|
8396
|
+
setRuns((prev) => append ? [...prev, ...result.runs] : result.runs);
|
|
8397
|
+
setCursor(result.cursor);
|
|
8398
|
+
setHasMore(!!result.cursor && result.runs.length > 0);
|
|
8399
|
+
} else {
|
|
8400
|
+
setError("Failed to fetch agent activity");
|
|
8401
|
+
}
|
|
8402
|
+
} catch (err) {
|
|
8403
|
+
setError(err instanceof Error ? err.message : "Failed to fetch agent activity");
|
|
8404
|
+
} finally {
|
|
8405
|
+
setIsLoading(false);
|
|
8406
|
+
}
|
|
8407
|
+
},
|
|
8408
|
+
[statusFilter, limit, apiKey, apiBaseUrl, orgId]
|
|
8409
|
+
);
|
|
8410
|
+
useEffect10(() => {
|
|
8411
|
+
fetchRuns(false, "");
|
|
8412
|
+
}, [statusFilter, apiKey, apiBaseUrl, orgId]);
|
|
8413
|
+
const loadMore = useCallback9(() => {
|
|
8414
|
+
if (cursor && !isLoading) fetchRuns(true, cursor);
|
|
8415
|
+
}, [cursor, isLoading, fetchRuns]);
|
|
8416
|
+
const filteredRuns = debouncedQuery ? runs.filter((r) => {
|
|
8417
|
+
const hay = [
|
|
8418
|
+
getRunTitle(r),
|
|
8419
|
+
getRunSubtitle(r),
|
|
8420
|
+
r.execution_id,
|
|
8421
|
+
r.execution_source,
|
|
8422
|
+
r.status
|
|
8423
|
+
].filter(Boolean).join(" ").toLowerCase();
|
|
8424
|
+
return hay.includes(debouncedQuery.toLowerCase());
|
|
8425
|
+
}) : runs;
|
|
8426
|
+
return /* @__PURE__ */ jsxs14(
|
|
8427
|
+
Box13,
|
|
8428
|
+
{
|
|
8429
|
+
className,
|
|
8430
|
+
sx: [{ display: "flex", flexDirection: "column", gap: 2 }, ...Array.isArray(sx) ? sx : sx ? [sx] : []],
|
|
8431
|
+
children: [
|
|
8432
|
+
(showSearchBar || showStatusChips) && /* @__PURE__ */ jsxs14(Box13, { sx: [{ display: "flex", alignItems: "center", gap: 1.5, flexWrap: "wrap" }, ...Array.isArray(toolbarSx) ? toolbarSx : toolbarSx ? [toolbarSx] : []], children: [
|
|
8433
|
+
showSearchBar && /* @__PURE__ */ jsx16(
|
|
8434
|
+
TextField5,
|
|
8435
|
+
{
|
|
8436
|
+
placeholder: "Search results...",
|
|
8437
|
+
size: "small",
|
|
8438
|
+
value: searchQuery,
|
|
8439
|
+
onChange: (e) => updateSearchQuery(e.target.value),
|
|
8440
|
+
slotProps: {
|
|
8441
|
+
input: {
|
|
8442
|
+
startAdornment: /* @__PURE__ */ jsx16(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx16(SearchIcon, { sx: { fontSize: 18, color: "hsl(var(--muted-foreground))" } }) })
|
|
8443
|
+
}
|
|
8444
|
+
},
|
|
8445
|
+
sx: {
|
|
8446
|
+
flex: 1,
|
|
8447
|
+
maxWidth: 280,
|
|
8448
|
+
minWidth: 160,
|
|
8449
|
+
"& .MuiOutlinedInput-root": {
|
|
8450
|
+
bgcolor: "hsl(var(--card))",
|
|
8451
|
+
borderRadius: 1.5,
|
|
8452
|
+
fontSize: "0.85rem",
|
|
8453
|
+
height: 36,
|
|
8454
|
+
"& fieldset": { borderColor: "hsl(var(--border))" },
|
|
8455
|
+
"&:hover fieldset": { borderColor: "hsl(var(--muted-foreground) / 0.3)" },
|
|
8456
|
+
"&.Mui-focused fieldset": { borderColor: "hsl(var(--primary))" }
|
|
8457
|
+
},
|
|
8458
|
+
"& .MuiInputBase-input": { color: "hsl(var(--foreground))" }
|
|
7290
8459
|
}
|
|
7291
|
-
|
|
7292
|
-
|
|
8460
|
+
}
|
|
8461
|
+
),
|
|
8462
|
+
showStatusChips && STATUS_FILTERS.map((f) => /* @__PURE__ */ jsx16(
|
|
8463
|
+
Chip8,
|
|
8464
|
+
{
|
|
8465
|
+
label: f.label,
|
|
8466
|
+
size: "small",
|
|
8467
|
+
variant: statusFilter === f.value ? "filled" : "outlined",
|
|
8468
|
+
onClick: () => setStatusFilter(f.value),
|
|
8469
|
+
sx: {
|
|
8470
|
+
fontSize: "0.75rem",
|
|
8471
|
+
height: 28,
|
|
8472
|
+
borderColor: statusFilter === f.value ? "hsl(var(--primary))" : "hsl(var(--border))",
|
|
8473
|
+
bgcolor: statusFilter === f.value ? "hsla(var(--primary) / 0.15)" : "transparent",
|
|
8474
|
+
color: statusFilter === f.value ? "hsl(var(--primary))" : "hsl(var(--muted-foreground))",
|
|
8475
|
+
"&:hover": { bgcolor: "hsl(var(--muted))" }
|
|
7293
8476
|
}
|
|
7294
|
-
}
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7299
|
-
|
|
7300
|
-
|
|
7301
|
-
|
|
7302
|
-
|
|
7303
|
-
|
|
7304
|
-
|
|
7305
|
-
|
|
7306
|
-
|
|
7307
|
-
|
|
7308
|
-
|
|
7309
|
-
|
|
7310
|
-
helperText: isMissing ? "Please answer this question" : void 0,
|
|
7311
|
-
onChange: (e) => {
|
|
7312
|
-
const v = e.target.value;
|
|
7313
|
-
setQuestionAnswers((prev) => ({
|
|
7314
|
-
...prev,
|
|
7315
|
-
[q.question]: { index: qi, value: v }
|
|
7316
|
-
}));
|
|
7317
|
-
},
|
|
7318
|
-
onKeyDown: (e) => {
|
|
7319
|
-
if ((e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
7320
|
-
e.preventDefault();
|
|
7321
|
-
trySimpleSubmit();
|
|
7322
|
-
}
|
|
7323
|
-
},
|
|
7324
|
-
size: "small",
|
|
7325
|
-
sx: { "& .MuiOutlinedInput-root": { bgcolor: "hsl(var(--background))" } }
|
|
7326
|
-
}
|
|
7327
|
-
)
|
|
7328
|
-
] }, qi);
|
|
7329
|
-
}),
|
|
7330
|
-
/* @__PURE__ */ jsxs12(Box11, { sx: { display: "flex", alignItems: "center", gap: 1 }, children: [
|
|
7331
|
-
/* @__PURE__ */ jsx14(
|
|
7332
|
-
Button5,
|
|
7333
|
-
{
|
|
7334
|
-
variant: "contained",
|
|
7335
|
-
size: "small",
|
|
7336
|
-
disabled: agentRequestLoading,
|
|
7337
|
-
onClick: trySimpleSubmit,
|
|
7338
|
-
children: agentRequestLoading ? /* @__PURE__ */ jsx14(CircularProgress4, { size: 16 }) : "Submit"
|
|
7339
|
-
}
|
|
7340
|
-
),
|
|
7341
|
-
pendingAsk.run_details?.id && getFormUrl(pendingAsk.run_details.id) && /* @__PURE__ */ jsx14(Tooltip6, { title: "Answer in the Form UI", placement: "right", children: /* @__PURE__ */ jsx14(
|
|
7342
|
-
IconButton6,
|
|
7343
|
-
{
|
|
7344
|
-
size: "small",
|
|
7345
|
-
onClick: () => {
|
|
7346
|
-
const url = getFormUrl(pendingAsk.run_details.id);
|
|
7347
|
-
if (url) window.open(url, "_blank", "noopener,noreferrer");
|
|
7348
|
-
},
|
|
7349
|
-
sx: { color: "hsl(var(--muted-foreground))", "&:hover": { color: "hsl(var(--primary))" } },
|
|
7350
|
-
children: /* @__PURE__ */ jsx14(OpenInNewIcon2, { sx: { fontSize: 18 } })
|
|
7351
|
-
}
|
|
7352
|
-
) })
|
|
7353
|
-
] })
|
|
7354
|
-
] });
|
|
7355
|
-
})() : isRunning ? /* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: "Waiting for the agent to produce the first step." }) : /* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.85rem", color: "hsl(var(--muted-foreground))" }, children: "No final answer was returned. Open Detailed to inspect each step." }),
|
|
7356
|
-
!isRunning && /* @__PURE__ */ jsx14(Box11, { children: /* @__PURE__ */ jsx14(
|
|
7357
|
-
Button5,
|
|
8477
|
+
},
|
|
8478
|
+
f.value
|
|
8479
|
+
)),
|
|
8480
|
+
isLoading && runs.length > 0 && /* @__PURE__ */ jsx16(CircularProgress5, { size: 16, sx: { color: "hsl(var(--primary))", ml: 0.5 } })
|
|
8481
|
+
] }),
|
|
8482
|
+
isLoading && runs.length === 0 ? /* @__PURE__ */ jsx16(Box13, { sx: { display: "flex", justifyContent: "center", py: 8 }, children: /* @__PURE__ */ jsx16(CircularProgress5, { size: 28, sx: { color: "hsl(var(--primary))" } }) }) : error ? /* @__PURE__ */ jsxs14(Box13, { sx: { textAlign: "center", py: 6 }, children: [
|
|
8483
|
+
/* @__PURE__ */ jsx16(AlertCircle, { size: 28, style: { color: "hsl(var(--severity-critical, 0 72% 55%))", marginBottom: 8 } }),
|
|
8484
|
+
/* @__PURE__ */ jsx16(
|
|
8485
|
+
Typography13,
|
|
8486
|
+
{
|
|
8487
|
+
sx: { color: "hsl(var(--severity-critical, 0 72% 55%))", fontSize: "0.9rem", mb: 1 },
|
|
8488
|
+
children: error
|
|
8489
|
+
}
|
|
8490
|
+
),
|
|
8491
|
+
/* @__PURE__ */ jsx16(
|
|
8492
|
+
Button6,
|
|
7358
8493
|
{
|
|
7359
8494
|
size: "small",
|
|
7360
|
-
|
|
7361
|
-
|
|
7362
|
-
|
|
7363
|
-
children: "View detailed timeline \u2192"
|
|
8495
|
+
onClick: () => fetchRuns(false, ""),
|
|
8496
|
+
sx: { color: "hsl(var(--primary))", textTransform: "none" },
|
|
8497
|
+
children: "Try again"
|
|
7364
8498
|
}
|
|
7365
|
-
)
|
|
7366
|
-
] })
|
|
7367
|
-
|
|
7368
|
-
|
|
7369
|
-
|
|
7370
|
-
|
|
7371
|
-
|
|
7372
|
-
|
|
7373
|
-
|
|
7374
|
-
|
|
7375
|
-
|
|
7376
|
-
|
|
7377
|
-
}, children: timeline.length === 0 || timeline.length === 1 && agentRequestLoading ? /* @__PURE__ */ jsxs12(Box11, { sx: { p: 4, textAlign: "center", color: "hsl(var(--muted-foreground))", fontSize: "0.85rem" }, children: [
|
|
7378
|
-
/* @__PURE__ */ jsx14(CircularProgress4, { size: 20, sx: { mb: 1 } }),
|
|
7379
|
-
/* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.85rem" }, children: "Waiting for agent response\u2026" })
|
|
7380
|
-
] }) : /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
7381
|
-
timeline.map((item, i) => /* @__PURE__ */ jsx14(
|
|
7382
|
-
TimelineRow,
|
|
8499
|
+
)
|
|
8500
|
+
] }) : filteredRuns.length === 0 ? /* @__PURE__ */ jsxs14(Box13, { sx: { display: "flex", flexDirection: "column", alignItems: "center", textAlign: "center", py: 8 }, children: [
|
|
8501
|
+
/* @__PURE__ */ jsx16(
|
|
8502
|
+
Activity,
|
|
8503
|
+
{
|
|
8504
|
+
size: 40,
|
|
8505
|
+
style: { color: "hsl(var(--muted-foreground))", marginBottom: 12 }
|
|
8506
|
+
}
|
|
8507
|
+
),
|
|
8508
|
+
/* @__PURE__ */ jsx16(Typography13, { sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.9rem" }, children: emptyTitle }),
|
|
8509
|
+
/* @__PURE__ */ jsx16(
|
|
8510
|
+
Typography13,
|
|
7383
8511
|
{
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
onRerunAgent: rerunAgent,
|
|
7396
|
-
onRerunDecision: rerunDecision,
|
|
7397
|
-
agentRequestLoading,
|
|
7398
|
-
getFormUrl,
|
|
7399
|
-
runFinished: detailedRunFinished
|
|
8512
|
+
sx: { color: "hsl(var(--muted-foreground))", fontSize: "0.8rem", mt: 0.5, opacity: 0.7 },
|
|
8513
|
+
children: emptySubtitle
|
|
8514
|
+
}
|
|
8515
|
+
)
|
|
8516
|
+
] }) : /* @__PURE__ */ jsxs14(Box13, { sx: { display: "flex", flexDirection: "column", gap: 1.5 }, children: [
|
|
8517
|
+
filteredRuns.map((run, idx) => /* @__PURE__ */ jsx16(
|
|
8518
|
+
AgentRunRow,
|
|
8519
|
+
{
|
|
8520
|
+
run,
|
|
8521
|
+
onClick: () => onRunClick?.(run),
|
|
8522
|
+
sx: rowSx
|
|
7400
8523
|
},
|
|
7401
|
-
|
|
8524
|
+
run.execution_id || idx
|
|
7402
8525
|
)),
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
8526
|
+
hasMore && /* @__PURE__ */ jsx16(Box13, { sx: { display: "flex", justifyContent: "center", mt: 1 }, children: /* @__PURE__ */ jsxs14(
|
|
8527
|
+
Button6,
|
|
8528
|
+
{
|
|
8529
|
+
size: "small",
|
|
8530
|
+
onClick: loadMore,
|
|
8531
|
+
disabled: isLoading,
|
|
8532
|
+
sx: { color: "hsl(var(--primary))", textTransform: "none", fontSize: "0.8rem" },
|
|
8533
|
+
children: [
|
|
8534
|
+
isLoading ? /* @__PURE__ */ jsx16(CircularProgress5, { size: 14, sx: { mr: 1 } }) : null,
|
|
8535
|
+
"Load more"
|
|
8536
|
+
]
|
|
8537
|
+
}
|
|
8538
|
+
) })
|
|
8539
|
+
] })
|
|
8540
|
+
]
|
|
8541
|
+
}
|
|
8542
|
+
);
|
|
8543
|
+
};
|
|
8544
|
+
var AgentActivityList_default = AgentActivityList;
|
|
8545
|
+
|
|
8546
|
+
// AgentExecutionDrawer.tsx
|
|
8547
|
+
import { Box as Box14, Drawer as Drawer4, IconButton as IconButton8, Tooltip as Tooltip9, Typography as Typography14 } from "@mui/material";
|
|
8548
|
+
import CloseIcon6 from "@mui/icons-material/Close";
|
|
8549
|
+
import OpenInNewIcon3 from "@mui/icons-material/OpenInNew";
|
|
8550
|
+
import { Fragment as Fragment9, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
8551
|
+
var AgentExecutionDrawer = ({
|
|
8552
|
+
open,
|
|
8553
|
+
onClose,
|
|
8554
|
+
run,
|
|
8555
|
+
width = 720,
|
|
8556
|
+
apiKey,
|
|
8557
|
+
apiBaseUrl,
|
|
8558
|
+
orgId,
|
|
8559
|
+
className,
|
|
8560
|
+
paperSx,
|
|
8561
|
+
headerSx,
|
|
8562
|
+
bodySx
|
|
8563
|
+
}) => {
|
|
8564
|
+
const statusKey = (run?.status || "").toUpperCase();
|
|
8565
|
+
const cfg = STATUS_CONFIG[statusKey] || STATUS_CONFIG.WAITING;
|
|
8566
|
+
const duration = run ? formatDuration(run) : "";
|
|
8567
|
+
return /* @__PURE__ */ jsxs15(
|
|
8568
|
+
Drawer4,
|
|
8569
|
+
{
|
|
8570
|
+
anchor: "right",
|
|
8571
|
+
open,
|
|
8572
|
+
onClose,
|
|
8573
|
+
slotProps: {
|
|
8574
|
+
paper: {
|
|
8575
|
+
className,
|
|
8576
|
+
sx: [
|
|
8577
|
+
{
|
|
8578
|
+
width: { xs: "100%", sm: width },
|
|
8579
|
+
maxWidth: "100vw",
|
|
7419
8580
|
bgcolor: "hsl(var(--background))",
|
|
7420
|
-
fontSize: "0.9rem",
|
|
7421
8581
|
color: "hsl(var(--foreground))",
|
|
7422
|
-
|
|
7423
|
-
"
|
|
7424
|
-
"& p": { my: 1, lineHeight: 1.55 },
|
|
7425
|
-
"& a": { color: "hsl(var(--primary))", textDecoration: "underline" },
|
|
7426
|
-
"& code": {
|
|
7427
|
-
px: 0.5,
|
|
7428
|
-
py: 0.125,
|
|
7429
|
-
borderRadius: 0.5,
|
|
7430
|
-
bgcolor: "hsl(var(--muted))",
|
|
7431
|
-
fontFamily: '"JetBrains Mono", ui-monospace, monospace',
|
|
7432
|
-
fontSize: "0.82em"
|
|
7433
|
-
},
|
|
7434
|
-
"& pre": {
|
|
7435
|
-
p: 1.5,
|
|
7436
|
-
my: 1,
|
|
7437
|
-
borderRadius: 1,
|
|
7438
|
-
bgcolor: "hsl(var(--muted))",
|
|
7439
|
-
overflowX: "auto",
|
|
7440
|
-
fontSize: "0.82rem"
|
|
7441
|
-
},
|
|
7442
|
-
"& pre code": { p: 0, bgcolor: "transparent" }
|
|
7443
|
-
}, children: /* @__PURE__ */ jsx14(Markdown, { remarkPlugins: [remarkGfm4, remarkBreaks], children: normalizeMarkdown(finishAnswer) }) })
|
|
7444
|
-
] })
|
|
7445
|
-
] }) });
|
|
7446
|
-
})(),
|
|
7447
|
-
finishDecisionId && /* @__PURE__ */ jsx14(Box11, { sx: { mt: 3, display: "flex", justifyContent: "center" }, children: /* @__PURE__ */ jsxs12(Box11, { sx: { width: "100%", maxWidth: 640 }, children: [
|
|
7448
|
-
/* @__PURE__ */ jsx14(Typography11, { sx: { fontSize: "0.75rem", color: "hsl(var(--muted-foreground))", mb: 0.75, textAlign: "center" }, children: "Continue this agent run with more details" }),
|
|
7449
|
-
/* @__PURE__ */ jsxs12(
|
|
7450
|
-
Box11,
|
|
7451
|
-
{
|
|
7452
|
-
component: "form",
|
|
7453
|
-
onSubmit: (e) => {
|
|
7454
|
-
e.preventDefault();
|
|
7455
|
-
if (continuationText.trim()) {
|
|
7456
|
-
submitQuestions(finishDecisionId, { continue: continuationText }, true);
|
|
7457
|
-
}
|
|
7458
|
-
},
|
|
7459
|
-
sx: {
|
|
7460
|
-
display: "flex",
|
|
7461
|
-
alignItems: "flex-end",
|
|
7462
|
-
gap: 1,
|
|
7463
|
-
p: 1.25,
|
|
7464
|
-
borderRadius: 999,
|
|
7465
|
-
border: "1.5px solid hsl(var(--border))",
|
|
7466
|
-
bgcolor: "hsl(var(--card))",
|
|
7467
|
-
"&:focus-within": {
|
|
7468
|
-
borderColor: "hsl(var(--primary))",
|
|
7469
|
-
boxShadow: "0 0 0 3px hsla(var(--primary) / 0.12)"
|
|
7470
|
-
}
|
|
8582
|
+
backgroundImage: "none",
|
|
8583
|
+
borderLeft: "1px solid hsl(var(--border))"
|
|
7471
8584
|
},
|
|
8585
|
+
...Array.isArray(paperSx) ? paperSx : paperSx ? [paperSx] : []
|
|
8586
|
+
]
|
|
8587
|
+
}
|
|
8588
|
+
},
|
|
8589
|
+
children: [
|
|
8590
|
+
/* @__PURE__ */ jsxs15(
|
|
8591
|
+
Box14,
|
|
8592
|
+
{
|
|
8593
|
+
sx: [
|
|
8594
|
+
{
|
|
8595
|
+
display: "flex",
|
|
8596
|
+
alignItems: "center",
|
|
8597
|
+
gap: 1.5,
|
|
8598
|
+
px: 2.5,
|
|
8599
|
+
py: 1.75,
|
|
8600
|
+
borderBottom: "1px solid hsl(var(--border))",
|
|
8601
|
+
position: "sticky",
|
|
8602
|
+
top: 0,
|
|
8603
|
+
zIndex: 2,
|
|
8604
|
+
bgcolor: "hsl(var(--background))"
|
|
8605
|
+
},
|
|
8606
|
+
...Array.isArray(headerSx) ? headerSx : headerSx ? [headerSx] : []
|
|
8607
|
+
],
|
|
7472
8608
|
children: [
|
|
7473
|
-
/* @__PURE__ */
|
|
7474
|
-
|
|
8609
|
+
/* @__PURE__ */ jsx17(
|
|
8610
|
+
Box14,
|
|
7475
8611
|
{
|
|
7476
|
-
|
|
7477
|
-
|
|
7478
|
-
|
|
7479
|
-
|
|
7480
|
-
|
|
7481
|
-
|
|
7482
|
-
|
|
7483
|
-
|
|
7484
|
-
|
|
7485
|
-
|
|
7486
|
-
if (continuationText.trim() && !agentRequestLoading) {
|
|
7487
|
-
submitQuestions(finishDecisionId, { continue: continuationText }, true);
|
|
7488
|
-
}
|
|
7489
|
-
}
|
|
8612
|
+
sx: {
|
|
8613
|
+
width: 36,
|
|
8614
|
+
height: 36,
|
|
8615
|
+
borderRadius: "50%",
|
|
8616
|
+
display: "flex",
|
|
8617
|
+
alignItems: "center",
|
|
8618
|
+
justifyContent: "center",
|
|
8619
|
+
background: "hsla(var(--primary) / 0.12)",
|
|
8620
|
+
color: "hsl(var(--primary))",
|
|
8621
|
+
flexShrink: 0
|
|
7490
8622
|
},
|
|
7491
|
-
|
|
7492
|
-
sx: { fontSize: "0.9rem", color: "hsl(var(--foreground))", px: 2 }
|
|
8623
|
+
children: /* @__PURE__ */ jsx17(AgentIcon_default, { size: 20 })
|
|
7493
8624
|
}
|
|
7494
8625
|
),
|
|
7495
|
-
/* @__PURE__ */
|
|
7496
|
-
|
|
8626
|
+
/* @__PURE__ */ jsxs15(Box14, { sx: { flex: 1, minWidth: 0 }, children: [
|
|
8627
|
+
/* @__PURE__ */ jsxs15(Box14, { sx: { display: "flex", alignItems: "center", gap: 1, minWidth: 0 }, children: [
|
|
8628
|
+
/* @__PURE__ */ jsx17(
|
|
8629
|
+
Typography14,
|
|
8630
|
+
{
|
|
8631
|
+
sx: {
|
|
8632
|
+
fontSize: "0.95rem",
|
|
8633
|
+
fontWeight: 600,
|
|
8634
|
+
color: "hsl(var(--foreground))",
|
|
8635
|
+
overflow: "hidden",
|
|
8636
|
+
textOverflow: "ellipsis",
|
|
8637
|
+
whiteSpace: "nowrap"
|
|
8638
|
+
},
|
|
8639
|
+
children: run ? getRunTitle(run) : "Agent execution"
|
|
8640
|
+
}
|
|
8641
|
+
),
|
|
8642
|
+
run && /* @__PURE__ */ jsx17(Box14, { sx: { display: "flex", alignItems: "center", color: cfg.color, flexShrink: 0 }, children: cfg.icon })
|
|
8643
|
+
] }),
|
|
8644
|
+
run && /* @__PURE__ */ jsxs15(Box14, { sx: { display: "flex", alignItems: "center", gap: 1, mt: 0.25 }, children: [
|
|
8645
|
+
/* @__PURE__ */ jsx17(Typography14, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: cfg.label }),
|
|
8646
|
+
run.started_at && /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
8647
|
+
/* @__PURE__ */ jsx17(Typography14, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
8648
|
+
/* @__PURE__ */ jsx17(Typography14, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: getTimeAgo(run.started_at) })
|
|
8649
|
+
] }),
|
|
8650
|
+
duration && /* @__PURE__ */ jsxs15(Fragment9, { children: [
|
|
8651
|
+
/* @__PURE__ */ jsx17(Typography14, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))", opacity: 0.4 }, children: "\xB7" }),
|
|
8652
|
+
/* @__PURE__ */ jsx17(Typography14, { sx: { fontSize: "0.72rem", color: "hsl(var(--muted-foreground))" }, children: duration })
|
|
8653
|
+
] })
|
|
8654
|
+
] })
|
|
8655
|
+
] }),
|
|
8656
|
+
run?.execution_id && /* @__PURE__ */ jsx17(Tooltip9, { title: "Open in new tab", children: /* @__PURE__ */ jsx17(
|
|
8657
|
+
IconButton8,
|
|
7497
8658
|
{
|
|
7498
|
-
|
|
7499
|
-
|
|
8659
|
+
component: "a",
|
|
8660
|
+
href: `/agents?execution_id=${encodeURIComponent(run.execution_id)}${run.authorization ? `&authorization=${encodeURIComponent(run.authorization)}` : ""}`,
|
|
8661
|
+
target: "_blank",
|
|
8662
|
+
rel: "noopener noreferrer",
|
|
8663
|
+
size: "small",
|
|
7500
8664
|
sx: {
|
|
7501
|
-
|
|
7502
|
-
|
|
7503
|
-
bgcolor: continuationText.trim() && !agentRequestLoading ? "hsl(var(--primary))" : "hsl(var(--muted))",
|
|
7504
|
-
color: continuationText.trim() && !agentRequestLoading ? "hsl(var(--primary-foreground))" : "hsl(var(--muted-foreground))",
|
|
7505
|
-
"&:hover": continuationText.trim() && !agentRequestLoading ? { filter: "brightness(1.1)", bgcolor: "hsl(var(--primary))" } : {}
|
|
8665
|
+
color: "hsl(var(--muted-foreground))",
|
|
8666
|
+
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
7506
8667
|
},
|
|
7507
|
-
children:
|
|
8668
|
+
children: /* @__PURE__ */ jsx17(OpenInNewIcon3, { fontSize: "small" })
|
|
7508
8669
|
}
|
|
7509
|
-
)
|
|
8670
|
+
) }),
|
|
8671
|
+
/* @__PURE__ */ jsx17(Tooltip9, { title: "Close", children: /* @__PURE__ */ jsx17(
|
|
8672
|
+
IconButton8,
|
|
8673
|
+
{
|
|
8674
|
+
onClick: onClose,
|
|
8675
|
+
size: "small",
|
|
8676
|
+
sx: {
|
|
8677
|
+
color: "hsl(var(--muted-foreground))",
|
|
8678
|
+
"&:hover": { color: "hsl(var(--foreground))", bgcolor: "hsl(var(--muted))" }
|
|
8679
|
+
},
|
|
8680
|
+
children: /* @__PURE__ */ jsx17(CloseIcon6, { fontSize: "small" })
|
|
8681
|
+
}
|
|
8682
|
+
) })
|
|
7510
8683
|
]
|
|
7511
8684
|
}
|
|
7512
|
-
)
|
|
7513
|
-
|
|
7514
|
-
|
|
7515
|
-
|
|
7516
|
-
|
|
7517
|
-
|
|
7518
|
-
|
|
7519
|
-
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7523
|
-
|
|
7524
|
-
|
|
7525
|
-
|
|
7526
|
-
|
|
7527
|
-
|
|
7528
|
-
|
|
7529
|
-
|
|
7530
|
-
|
|
8685
|
+
),
|
|
8686
|
+
/* @__PURE__ */ jsx17(Box14, { sx: [{ flex: 1, overflowY: "auto", pt: 3 }, ...Array.isArray(bodySx) ? bodySx : bodySx ? [bodySx] : []], children: run ? /* @__PURE__ */ jsx17(
|
|
8687
|
+
AgentUI_default,
|
|
8688
|
+
{
|
|
8689
|
+
initialExecution: {
|
|
8690
|
+
execution_id: run.execution_id,
|
|
8691
|
+
status: run.status,
|
|
8692
|
+
started_at: run.started_at ? Number(run.started_at) : void 0,
|
|
8693
|
+
completed_at: run.completed_at ? Number(run.completed_at) : void 0,
|
|
8694
|
+
results: run.results,
|
|
8695
|
+
workflow: run.workflow,
|
|
8696
|
+
authorization: run.authorization
|
|
8697
|
+
},
|
|
8698
|
+
readUrlParams: false,
|
|
8699
|
+
autoLoadApps: false,
|
|
8700
|
+
hideHeroIcon: true,
|
|
8701
|
+
hideAppPicker: true,
|
|
8702
|
+
hideAttach: true,
|
|
8703
|
+
disableStartTab: true,
|
|
8704
|
+
compact: true,
|
|
8705
|
+
maxWidth: width - 32,
|
|
8706
|
+
apiKey,
|
|
8707
|
+
apiBaseUrl,
|
|
8708
|
+
orgId
|
|
8709
|
+
},
|
|
8710
|
+
run.execution_id
|
|
8711
|
+
) : null })
|
|
8712
|
+
]
|
|
8713
|
+
}
|
|
8714
|
+
);
|
|
7531
8715
|
};
|
|
7532
|
-
var
|
|
8716
|
+
var AgentExecutionDrawer_default = AgentExecutionDrawer;
|
|
7533
8717
|
|
|
7534
8718
|
// useAppLookup.ts
|
|
7535
|
-
import { useEffect as
|
|
8719
|
+
import { useEffect as useEffect11, useMemo as useMemo6, useState as useState13 } from "react";
|
|
7536
8720
|
var norm = (s) => s.toLowerCase().replace(/[\s_\-]+/g, "_");
|
|
7537
8721
|
function useAppLookup(appName) {
|
|
7538
|
-
const [loading, setLoading] =
|
|
7539
|
-
const [info, setInfo] =
|
|
7540
|
-
const [algoliaId, setAlgoliaId] =
|
|
8722
|
+
const [loading, setLoading] = useState13(false);
|
|
8723
|
+
const [info, setInfo] = useState13(null);
|
|
8724
|
+
const [algoliaId, setAlgoliaId] = useState13(null);
|
|
7541
8725
|
const {
|
|
7542
8726
|
authStates,
|
|
7543
8727
|
authenticatedApps,
|
|
@@ -7546,7 +8730,7 @@ function useAppLookup(appName) {
|
|
|
7546
8730
|
handleSaveAuth,
|
|
7547
8731
|
refreshAuth
|
|
7548
8732
|
} = useAppAuth();
|
|
7549
|
-
|
|
8733
|
+
useEffect11(() => {
|
|
7550
8734
|
if (!appName) {
|
|
7551
8735
|
setInfo(null);
|
|
7552
8736
|
setAlgoliaId(null);
|
|
@@ -7583,14 +8767,8 @@ function useAppLookup(appName) {
|
|
|
7583
8767
|
let appsList = null;
|
|
7584
8768
|
if (API_CONFIG.apiKey) {
|
|
7585
8769
|
try {
|
|
7586
|
-
const
|
|
7587
|
-
|
|
7588
|
-
headers: { ...getAuthHeader() }
|
|
7589
|
-
});
|
|
7590
|
-
if (res.ok) {
|
|
7591
|
-
const apps = await res.json();
|
|
7592
|
-
if (Array.isArray(apps)) appsList = apps;
|
|
7593
|
-
}
|
|
8770
|
+
const apps = await fetchAppsViaApiConfig();
|
|
8771
|
+
if (Array.isArray(apps)) appsList = apps;
|
|
7594
8772
|
} catch {
|
|
7595
8773
|
}
|
|
7596
8774
|
}
|
|
@@ -7677,6 +8855,9 @@ function useAppLookup(appName) {
|
|
|
7677
8855
|
}
|
|
7678
8856
|
export {
|
|
7679
8857
|
API_CONFIG,
|
|
8858
|
+
AgentActivityList_default as AgentActivityList,
|
|
8859
|
+
AgentExecutionDrawer_default as AgentExecutionDrawer,
|
|
8860
|
+
AgentRunDrawer_default as AgentRunDrawer,
|
|
7680
8861
|
AgentUI_default as AgentUI,
|
|
7681
8862
|
AppAuthSection,
|
|
7682
8863
|
AppDetailDrawer,
|
|
@@ -7692,6 +8873,7 @@ export {
|
|
|
7692
8873
|
getApiUrl,
|
|
7693
8874
|
getAuthHeader,
|
|
7694
8875
|
refreshAllIntegrationStatus,
|
|
8876
|
+
searchAgentActivity,
|
|
7695
8877
|
setToastImpl,
|
|
7696
8878
|
toast,
|
|
7697
8879
|
useAppAuth,
|